From bd3ed79f654fc7e76939c7d0baa2a67e6b879ed8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Arenal=20Pereira?= Date: Mon, 25 Nov 2024 17:12:33 +0100 Subject: [PATCH] feat(xds)!: avoid overriding consumers theme by xds (#1658) BREAKING CHANGE: the x tailwincss plugin no longer admits an options configuration. The plugin theme is accessible through theme: extend: { x: {...}} so now if you need to customize a value you can do it via extending the general tailwind theme: module.exports = { theme: { extend: { spacing: theme => theme('x.spacing'), colors: theme => theme('x.colors'), screens: theme => theme('x.screens'), fontSize: theme => theme('x.fontSize'), fontFamily: theme => theme('x.fontFamily'), x: { colors: { neutral: { 5: '#56ac91' } .... To add new components you can do it via https://tailwindcss.com/docs/adding-custom-styles#adding-component-classes --- .../src/tailwind/plugin-options.ts | 4 +- .../demo/src/components/xds-badge.vue | 2 +- .../demo/src/components/xds-base-showcase.vue | 14 +-- .../demo/src/components/xds-button-group.vue | 16 +-- .../demo/src/components/xds-icon.vue | 4 +- .../components/xds-layout-fixed-header.vue | 28 +++--- .../components/xds-layout-single-column.vue | 24 ++--- .../src/components/xds-layout-two-columns.vue | 34 +++---- .../demo/src/components/xds-layout-utils.vue | 32 +++--- .../demo/src/components/xds-layout.vue | 23 ++--- .../demo/src/components/xds-picture.vue | 2 +- .../demo/src/components/xds-progress-bar.vue | 8 +- .../demo/src/components/xds-scroll.vue | 4 +- .../demo/src/components/xds-showcase.vue | 2 +- .../demo/src/components/xds-sliding-panel.vue | 4 +- .../x-tailwindcss/demo/tailwind.config.ts | 23 +---- .../x-tailwindcss/src/old-ds-plugin/plugin.ts | 98 +++++++++---------- packages/x-tailwindcss/src/types.ts | 86 +--------------- .../src/x-tailwind-plugin/components.ts | 10 +- .../components/attach/index.ts | 4 +- .../components/badge/bright.ts | 4 +- .../components/badge/circle.ts | 6 +- .../components/badge/default.ts | 12 +-- .../components/badge/index.ts | 2 +- .../components/badge/light.ts | 4 +- .../components/badge/outlined.ts | 6 +- .../components/badge/sizes.ts | 16 +-- .../components/button-group/default.ts | 8 +- .../components/button-group/divider.ts | 2 +- .../components/button-group/index.ts | 2 +- .../components/button/default.ts | 28 +++--- .../components/button/disabled.ts | 6 +- .../components/button/ghost.ts | 10 +- .../components/button/index.ts | 2 +- .../components/button/layouts.ts | 2 +- .../components/button/link.ts | 6 +- .../components/button/outlined.ts | 24 ++--- .../components/button/sizes.ts | 40 ++++---- .../components/button/tight.ts | 4 +- .../button/utils/background-on-hover.ts | 4 +- .../components/button/utils/no-background.ts | 6 +- .../components/facet-filter/default.ts | 18 ++-- .../components/facet-filter/ghost.ts | 16 +-- .../components/facet-filter/index.ts | 2 +- .../components/facet-filter/simple.ts | 12 +-- .../components/facet-filter/sizes.ts | 18 ++-- .../components/facet-filter/underline.ts | 4 +- .../components/highlight/default.ts | 4 +- .../components/highlight/index.ts | 2 +- .../components/icon/default.ts | 2 +- .../components/icon/index.ts | 2 +- .../components/icon/sizes.ts | 8 +- .../components/icon/stroke-widths.ts | 2 +- .../input-group/buttons/button-ghost.ts | 8 +- .../input-group/buttons/button-outlined.ts | 12 +-- .../input-group/buttons/button-primary.ts | 12 +-- .../input-group/buttons/button-rectangle.ts | 4 +- .../components/input-group/buttons/button.ts | 18 ++-- .../components/input-group/default.ts | 8 +- .../components/input-group/index.ts | 2 +- .../components/input-group/line.ts | 6 +- .../components/input-group/sizes.ts | 18 ++-- .../components/input/default.ts | 36 +++---- .../components/input/index.ts | 2 +- .../components/input/line.ts | 10 +- .../components/input/sizes.ts | 18 ++-- .../components/layout/index.ts | 2 +- .../components/layout/max-width.ts | 2 +- .../components/layout/min-margin.ts | 2 +- .../components/layout/utils.ts | 20 ++-- .../components/picture/default.ts | 4 +- .../components/picture/index.ts | 2 +- .../components/picture/overlay.ts | 4 +- .../components/picture/zoom.ts | 2 +- .../components/progress-bar/default.ts | 6 +- .../components/progress-bar/index.ts | 2 +- .../components/progress-bar/sizes.ts | 4 +- .../components/scroll/default.ts | 8 +- .../components/scroll/index.ts | 3 +- .../components/sliding-panel/buttons/hover.ts | 22 ++--- .../components/sliding-panel/buttons/index.ts | 2 +- .../sliding-panel/buttons/positions.ts | 12 +-- .../components/sliding-panel/fade/index.ts | 14 +-- .../components/sliding-panel/fade/sizes.ts | 66 ++++++------- .../components/sliding-panel/index.ts | 2 +- .../suggestion-group/button/ghost.ts | 2 +- .../suggestion-group/button/index.ts | 2 +- .../suggestion-group/button/lighter-colors.ts | 4 +- .../suggestion-group/button/rectangle.ts | 4 +- .../components/suggestion-group/default.ts | 10 +- .../components/suggestion-group/ghost.ts | 12 +-- .../components/suggestion-group/index.ts | 2 +- .../components/suggestion-group/outlined.ts | 18 ++-- .../components/suggestion-group/sizes.ts | 14 +-- .../components/suggestion/default.ts | 6 +- .../components/suggestion/ghost.ts | 6 +- .../components/suggestion/index.ts | 2 +- .../components/suggestion/outlined.ts | 4 +- .../components/suggestion/sizes.ts | 18 ++-- .../utils/common-ghost-and-tag-styles.ts | 2 +- .../suggestion/utils/padding-by-size.ts | 12 +-- .../components/tag/colors.ts | 8 +- .../components/tag/default.ts | 36 +++---- .../x-tailwind-plugin/components/tag/ghost.ts | 18 ++-- .../x-tailwind-plugin/components/tag/index.ts | 2 +- .../components/tag/outlined.ts | 20 ++-- .../x-tailwind-plugin/components/tag/sizes.ts | 24 ++--- .../x-tailwind-plugin/components/tag/solid.ts | 28 +++--- .../x-tailwind-plugin/components/tag/tight.ts | 16 +-- .../components/typography/text1/default.ts | 4 +- .../components/typography/text1/index.ts | 2 +- .../components/typography/text1/sizes.ts | 10 +- .../components/typography/text2/default.ts | 4 +- .../components/typography/text2/index.ts | 2 +- .../components/typography/text2/sizes.ts | 10 +- .../components/typography/title1/default.ts | 4 +- .../components/typography/title1/index.ts | 2 +- .../components/typography/title1/sizes.ts | 10 +- .../components/typography/title2/default.ts | 4 +- .../components/typography/title2/index.ts | 2 +- .../components/typography/title2/sizes.ts | 10 +- .../components/typography/title3/default.ts | 4 +- .../components/typography/title3/index.ts | 2 +- .../components/typography/title3/sizes.ts | 8 +- .../components/typography/title4/default.ts | 4 +- .../components/typography/title4/index.ts | 2 +- .../components/typography/title4/sizes.ts | 8 +- .../x-tailwind-plugin/dynamic-components.ts | 7 -- .../layout/layout-container.ts | 10 +- .../x-tailwind-plugin/dynamic-utilities.ts | 9 +- .../src/x-tailwind-plugin/plugin.ts | 51 +++++----- .../src/x-tailwind-plugin/theme.ts | 2 + .../src/x-tailwind-plugin/utilities.ts | 18 ++-- .../src/x-tailwind-plugin/utils/map-colors.ts | 2 +- 134 files changed, 680 insertions(+), 820 deletions(-) diff --git a/packages/x-components/src/tailwind/plugin-options.ts b/packages/x-components/src/tailwind/plugin-options.ts index 0460bf7b3c..ff8b4c5632 100644 --- a/packages/x-components/src/tailwind/plugin-options.ts +++ b/packages/x-components/src/tailwind/plugin-options.ts @@ -1,3 +1 @@ -import { PluginOptions } from '@empathyco/x-tailwindcss'; - -export default {} as PluginOptions; +export default {}; diff --git a/packages/x-tailwindcss/demo/src/components/xds-badge.vue b/packages/x-tailwindcss/demo/src/components/xds-badge.vue index 79d5ade82c..6d731c9763 100644 --- a/packages/x-tailwindcss/demo/src/components/xds-badge.vue +++ b/packages/x-tailwindcss/demo/src/components/xds-badge.vue @@ -118,7 +118,7 @@ }, setup(props) { const sectionClasses: ShowcaseSectionsClasses = { - Bright: 'x-bg-neutral-90 x-p-8' + Bright: 'bg-gray-700 p-8' }; const sections = computed(() => { return { diff --git a/packages/x-tailwindcss/demo/src/components/xds-base-showcase.vue b/packages/x-tailwindcss/demo/src/components/xds-base-showcase.vue index ef98e8d57b..ac1b31a9f8 100644 --- a/packages/x-tailwindcss/demo/src/components/xds-base-showcase.vue +++ b/packages/x-tailwindcss/demo/src/components/xds-base-showcase.vue @@ -1,15 +1,15 @@