@db-ux/core-foundations 4.5.4 → 4.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +16 -69
  3. package/agent/_instructions.md +84 -0
  4. package/agent/tailwind/Variables.md +11 -9
  5. package/build/styles/bundle.css +4820 -0
  6. package/build/styles/{index.scss → bundle.scss} +5 -0
  7. package/build/styles/colors/_default-color-mappings.scss +3461 -3472
  8. package/build/styles/colors/_placeholder.scss +155 -159
  9. package/build/styles/colors/classes/all.css +2499 -2601
  10. package/build/styles/colors/classes/blue.css +147 -185
  11. package/build/styles/colors/classes/brand.css +147 -185
  12. package/build/styles/colors/classes/burgundy.css +147 -185
  13. package/build/styles/colors/classes/critical.css +147 -185
  14. package/build/styles/colors/classes/cyan.css +147 -185
  15. package/build/styles/colors/classes/green.css +147 -185
  16. package/build/styles/colors/classes/informational.css +147 -185
  17. package/build/styles/colors/classes/light-green.css +147 -185
  18. package/build/styles/colors/classes/neutral.css +147 -185
  19. package/build/styles/colors/classes/orange.css +147 -185
  20. package/build/styles/colors/classes/pink.css +147 -185
  21. package/build/styles/colors/classes/red.css +147 -185
  22. package/build/styles/colors/classes/successful.css +147 -185
  23. package/build/styles/colors/classes/turquoise.css +147 -185
  24. package/build/styles/colors/classes/violet.css +147 -185
  25. package/build/styles/colors/classes/warning.css +147 -185
  26. package/build/styles/colors/classes/yellow.css +147 -185
  27. package/build/styles/defaults/default-code.css +97 -97
  28. package/build/styles/defaults/default-container-properties.css +1 -0
  29. package/build/styles/defaults/default-container-variables.css +1 -0
  30. package/build/styles/defaults/default-elevation.css +1 -1
  31. package/build/styles/defaults/default-fonts.css +1 -1
  32. package/build/styles/defaults/default-icons.css +1 -1
  33. package/build/styles/defaults/default-properties.css +1 -0
  34. package/build/styles/defaults/default-required.css +1 -1
  35. package/build/styles/defaults/default-required.scss +13 -16
  36. package/build/styles/defaults/default-root.css +97 -97
  37. package/build/styles/defaults/default-variables.css +1 -0
  38. package/build/styles/density/_scaling-placeholder.scss +51 -54
  39. package/build/styles/density/_typography-placeholder.scss +54 -60
  40. package/build/styles/density/classes/all.css +759 -907
  41. package/build/styles/density/classes/expressive.css +255 -377
  42. package/build/styles/density/classes/functional.css +255 -377
  43. package/build/styles/density/classes/regular.css +255 -377
  44. package/build/styles/fonts/_font-sizes.scss +10 -16
  45. package/build/styles/fonts/absolute.scss +1 -1
  46. package/build/styles/fonts/classes/all.css +54 -214
  47. package/build/styles/fonts/classes/body/2xl.css +3 -95
  48. package/build/styles/fonts/classes/body/2xs.css +3 -95
  49. package/build/styles/fonts/classes/body/3xl.css +3 -95
  50. package/build/styles/fonts/classes/body/3xs.css +3 -95
  51. package/build/styles/fonts/classes/body/all.css +27 -151
  52. package/build/styles/fonts/classes/body/lg.css +3 -95
  53. package/build/styles/fonts/classes/body/md.css +3 -95
  54. package/build/styles/fonts/classes/body/sm.css +3 -95
  55. package/build/styles/fonts/classes/body/xl.css +3 -95
  56. package/build/styles/fonts/classes/body/xs.css +3 -95
  57. package/build/styles/fonts/classes/headline/2xl.css +3 -95
  58. package/build/styles/fonts/classes/headline/2xs.css +3 -95
  59. package/build/styles/fonts/classes/headline/3xl.css +3 -95
  60. package/build/styles/fonts/classes/headline/3xs.css +3 -95
  61. package/build/styles/fonts/classes/headline/all.css +27 -151
  62. package/build/styles/fonts/classes/headline/lg.css +3 -95
  63. package/build/styles/fonts/classes/headline/md.css +3 -95
  64. package/build/styles/fonts/classes/headline/sm.css +3 -95
  65. package/build/styles/fonts/classes/headline/xl.css +3 -95
  66. package/build/styles/fonts/classes/headline/xs.css +3 -95
  67. package/build/styles/fonts/relative.scss +1 -1
  68. package/build/styles/fonts/rollup.scss +1 -1
  69. package/build/styles/fonts/webpack.scss +1 -1
  70. package/build/styles/helpers/_index.scss +0 -1
  71. package/build/styles/helpers/classes/all.css +0 -34
  72. package/build/styles/helpers/classes/divider.css +0 -34
  73. package/build/styles/helpers/classes/focus.css +0 -34
  74. package/build/styles/icons/absolute.css +1 -1
  75. package/build/styles/icons/absolute.scss +1 -1
  76. package/build/styles/icons/relative.css +1 -1
  77. package/build/styles/icons/relative.scss +1 -1
  78. package/build/styles/icons/rollup.css +1 -1
  79. package/build/styles/icons/rollup.scss +1 -1
  80. package/build/styles/icons/webpack.css +1 -1
  81. package/build/styles/icons/webpack.scss +1 -1
  82. package/build/styles/theme/absolute.css +1 -0
  83. package/build/styles/theme/relative.css +1 -0
  84. package/build/styles/{defaults/default-theme.scss → theme/relative.scss} +3 -6
  85. package/build/styles/theme/rollup.css +1 -0
  86. package/build/styles/theme/webpack.css +1 -0
  87. package/build/tailwind/theme/colors.css +1 -2953
  88. package/build/tailwind/theme/colors.scss +1 -10
  89. package/build/tailwind/theme/dimensions.css +77 -160
  90. package/package.json +4 -4
  91. package/build/styles/absolute.css +0 -10635
  92. package/build/styles/defaults/default-theme.css +0 -97
  93. package/build/styles/helpers/_layer.scss +0 -1
  94. package/build/styles/index.css +0 -4907
  95. package/build/styles/relative.css +0 -10635
  96. package/build/styles/relative.scss +0 -4
  97. package/build/styles/rollup.css +0 -10635
  98. package/build/styles/webpack.css +0 -10635
  99. package/build/tailwind/theme/_variables.scss +0 -77
  100. package/build/tailwind/theme/dimensions.scss +0 -17
  101. /package/build/styles/defaults/{_default-container-properties.scss → default-container-properties.scss} +0 -0
  102. /package/build/styles/defaults/{_default-container-variables.scss → default-container-variables.scss} +0 -0
  103. /package/build/styles/defaults/{_default-properties.scss → default-properties.scss} +0 -0
  104. /package/build/styles/defaults/{_default-variables.scss → default-variables.scss} +0 -0
  105. /package/build/styles/{_absolute.assets-paths.scss → theme/_absolute.assets-paths.scss} +0 -0
  106. /package/build/styles/{_default.assets-paths.scss → theme/_default.assets-paths.scss} +0 -0
  107. /package/build/styles/{_rollup.assets-paths.scss → theme/_rollup.assets-paths.scss} +0 -0
  108. /package/build/styles/{_webpack.assets-paths.scss → theme/_webpack.assets-paths.scss} +0 -0
  109. /package/build/styles/{absolute.scss → theme/absolute.scss} +0 -0
  110. /package/build/styles/{rollup.scss → theme/rollup.scss} +0 -0
  111. /package/build/styles/{webpack.scss → theme/webpack.scss} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @db-ux/core-foundations
2
2
 
3
+ ## 4.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - refactor: exclude whitelabel-theme from default bundle to reduce size and to align with "how to import a theme" - [see commit f272967](https://github.com/db-ux-design-system/core-web/commit/f272967acb7a37dc9b07d9786134e437b284e9b6)
8
+
9
+ ### Patch Changes
10
+
11
+ - fix: issue with tailwind duplicating some classes by using `@theme` inline - [see commit 92de4e6](https://github.com/db-ux-design-system/core-web/commit/92de4e6e5fdad3be5629d7457944d3b9b7396cf4)
12
+
3
13
  ## 4.5.4
4
14
 
5
15
  ### Patch Changes
package/README.md CHANGED
@@ -38,11 +38,11 @@ npm i @db-ux/core-foundations
38
38
 
39
39
  You use this library if you need some colors, spacings etc.
40
40
 
41
- > **tl;dr:** Use the default theme and the bundled styles by importing [relative|absolute|rollup|webpack].css`.
41
+ > **tl;dr:** Use the default theme and the bundled styles by importing `bundle.css` and `theme/[relative|absolute|rollup|webpack].css`.
42
42
 
43
43
  ---
44
44
 
45
- First of all you need to import a theme which contains all tokens (css-properties). We provide a `default-theme.css` which handles dark/light mode as well.
45
+ First of all you need to import a theme which contains all tokens (css-properties). We provide a `theme/[relative|absolute|rollup|webpack].css` which handles dark/light mode as well.
46
46
 
47
47
  Afterward, you may import helper classes / placeholders to easily consume the tokens from your theme. There are some categories:
48
48
 
@@ -53,7 +53,7 @@ Afterward, you may import helper classes / placeholders to easily consume the to
53
53
  - **density**: Overwrite default density to scale adaptive components inside container using density
54
54
  - **colors**: Sets an adaptive color to a container, which passes all required css-properties to children
55
55
 
56
- You can import the complete **init** styles with `[relative|absolute|rollup|webpack].css` which apply the default:
56
+ The `bundle.css` applies those default:
57
57
 
58
58
  - [Density](https://marketingportal.extranet.deutschebahn.com/marketingportal/Design-Anwendungen/db-ux-design-system/version-3/principles/adaptive#:~:text=und%20Textfarben%20sicherstellt.-,Sizing,-Adaptive%20Sizing%20ist): `regular`
59
59
  - [Adaptive Coloring](https://marketingportal.extranet.deutschebahn.com/marketingportal/Design-Anwendungen/db-ux-design-system/version-3/principles/adaptive#:~:text=Akzeptieren-,Coloring,-Adaptive%20Coloring%20bezieht): `neutral-bg-lvl-1`
@@ -64,39 +64,28 @@ Default assets path for `relative.css` is `../assets`. Make sure to copy all use
64
64
 
65
65
  #### Import
66
66
 
67
- Import the styles in your main `.js | .ts` file or in your main `.css` file.
68
-
69
- CSS:
67
+ Import the styles in your main `.css` file.
70
68
 
71
69
  ```css
72
70
  /* index.css */
73
- @import "@db-ux/core-foundations/build/styles/relative.css";
74
-
75
- /* Optional: Use [data-divider] & [data-focus] everywhere */
76
- @import "@db-ux/core-foundations/build/styles/helpers/classes/all.css";
77
- /* Optional: Use [data-density] everywhere */
78
- @import "@db-ux/core-foundations/build/styles/density/classes/all.css";
79
- /* Optional: Use [data-font-size] everywhere */
80
- @import "@db-ux/core-foundations/build/styles/fonts/classes/all.css";
81
- /* Optional: Use [data-color] everywhere */
82
- @import "@db-ux/core-foundations/build/styles/colors/classes/all.css";
83
- ```
71
+ @layer whitelabel-theme, db-ux;
84
72
 
85
- JS/TS:
73
+ @import "@db-ux/core-foundations/build/styles/theme/relative.css" layer(theme);
86
74
 
87
- ```ts
88
- // main.[js|ts]
89
- /* index.css */
90
- import "@db-ux/core-foundations/build/styles/relative.css";
75
+ @import "@db-ux/core-foundations/build/styles/bundle.css" layer(db-ux);
91
76
 
92
77
  /* Optional: Use [data-divider] & [data-focus] everywhere */
93
- import "@db-ux/core-foundations/build/styles/helpers/classes/all.css";
78
+ @import "@db-ux/core-foundations/build/styles/helpers/classes/all.css"
79
+ layer(db-ux);
94
80
  /* Optional: Use [data-density] everywhere */
95
- import "@db-ux/core-foundations/build/styles/density/classes/all.css";
81
+ @import "@db-ux/core-foundations/build/styles/density/classes/all.css"
82
+ layer(db-ux);
96
83
  /* Optional: Use [data-font-size] everywhere */
97
- import "@db-ux/core-foundations/build/styles/fonts/classes/all.css";
84
+ @import "@db-ux/core-foundations/build/styles/fonts/classes/all.css"
85
+ layer(db-ux);
98
86
  /* Optional: Use [data-color] everywhere */
99
- import "@db-ux/core-foundations/build/styles/colors/classes/all.css";
87
+ @import "@db-ux/core-foundations/build/styles/colors/classes/all.css"
88
+ layer(db-ux);
100
89
  ```
101
90
 
102
91
  #### Use
@@ -130,46 +119,6 @@ In HTML:
130
119
 
131
120
  ### SCSS
132
121
 
133
- Default assets path for `relative.scss` is `../assets`. Make sure to copy all used resources like icons and fonts into your `public` folder before build. **Or** you use a modern bundler which handles bundling for you. In this case use `[rollup|webpack].scss`.
134
-
135
- #### Import
136
-
137
- Import the styles in your main `.js | .ts` file or in your main `.scss` file.
138
-
139
- SCSS:
140
-
141
- ```scss
142
- /* index.css */
143
- @forward "@db-ux/core-foundations/build/styles/relative";
144
-
145
- /* Optional: Use [data-divider] & [data-focus] everywhere */
146
- @forward "@db-ux/core-foundations/build/styles/helpers/classes/all";
147
- /* Optional: Use [data-density] everywhere */
148
- @forward "@db-ux/core-foundations/build/styles/density/classes/all";
149
- /* Optional: Use [data-font-size] everywhere */
150
- @forward "@db-ux/core-foundations/build/styles/fonts/classes/all";
151
- /* Optional: Use [data-color] everywhere */
152
- @forward "@db-ux/core-foundations/build/styles/colors/classes/all";
153
- ```
154
-
155
- > **Note:** Besides of forwarding the classes you can use placeholders to include only some specific styles.
156
-
157
- JS/TS:
158
-
159
- ```ts
160
- // main.[js|ts]
161
- import "@db-ux/core-foundations/build/styles/relative.scss";
162
-
163
- /* Optional: Use [data-divider] & [data-focus] everywhere */
164
- import "@db-ux/core-foundations/build/styles/helpers/classes/all.scss";
165
- /* Optional: Use [data-density] everywhere */
166
- import "@db-ux/core-foundations/build/styles/density/classes/all.scss";
167
- /* Optional: Use [data-font-size] everywhere */
168
- import "@db-ux/core-foundations/build/styles/fonts/classes/all.scss";
169
- /* Optional: Use [data-color] everywhere */
170
- import "@db-ux/core-foundations/build/styles/colors/classes/all.scss";
171
- ```
172
-
173
122
  #### Use
174
123
 
175
124
  In SCSS:
@@ -313,13 +262,11 @@ If you want to optimize the size of the loaded styles, you might want to skip lo
313
262
 
314
263
  ```css
315
264
  /* The theme contains all prop required for components like spacings, colors, etc. You can replace it with your own theme. */
316
- @import "@db-ux/core-foundations/build/styles/defaults/default-theme.css";
265
+ @import "@db-ux/core-foundations/build/styles/theme/relative.css";
317
266
  /* The font include uses default font families based on your bundling paths (relative, absolute, webpack, rollup). You can replace it with your own fonts. */
318
267
  @import "@db-ux/core-foundations/build/styles/fonts/relative.css";
319
268
  /* The icon include uses default icons based on your bundling paths (relative, absolute, webpack, rollup). You can replace it with your own icons. */
320
269
  @import "@db-ux/core-foundations/build/styles/icons/relative.css";
321
- /* The index file will add some additional styles to normalize html defaults and add some default settings like default density, etc. */
322
- @import "@db-ux/core-foundations/build/styles/index.css";
323
270
  ```
324
271
 
325
272
  #### Optimize index
@@ -40,6 +40,41 @@
40
40
  - font: `text-body-sm`
41
41
  - Always stick to the variables. Don't use values like `p-4` or `m-[16px]`; use `p-fix-xs` or `m-fix-md` instead.
42
42
 
43
+ ### Import
44
+
45
+ #### Tailwind v4
46
+
47
+ ```css
48
+ @import "tailwindcss";
49
+ @import "@db-ux/core-foundations/build/tailwind/theme/index.css";
50
+ ```
51
+
52
+ #### Tailwind v3
53
+
54
+ > **Note:** In Tailwind v4 you can use the config with `@config "tailwind.config.[js|ts]";` inside your `.css` file as well.
55
+
56
+ After this you can extend your tailwind config like this:
57
+
58
+ ```javascript
59
+ //tailwind.config.js
60
+ /** @type {import('tailwindcss').Config} */
61
+ import tokens from "@db-ux/core-foundations/build/tailwind/tailwind-tokens.json";
62
+
63
+ export default {
64
+ content: ["./index.html", "./src/**/*.{js,jsx,ts,tsx}"],
65
+ plugins: [],
66
+ theme: {
67
+ ...tokens,
68
+ gap: ({ theme }) => ({
69
+ ...theme("spacing")
70
+ }),
71
+ space: ({ theme }) => ({
72
+ ...theme("spacing")
73
+ })
74
+ }
75
+ };
76
+ ```
77
+
43
78
  ## Figma MCP
44
79
 
45
80
  - If you use Figma MCP always generate code with project's conventions, such as using @db-ux/core-components and @db-ux/core-foundations.
@@ -53,3 +88,52 @@ If you use tailwind follow those rules as well:
53
88
 
54
89
  - Don't use values like `p-4` or `m-[16px]`; use `p-fix-xs` or `m-fix-md` instead.
55
90
  - Never use something like `font-['DB_Neo_Screen_Head']` and `leading-[48px]` instead use `text-head-xx` class, where `-xx` can be a t-shirt size from `3xs` to `3xl`; If it has a `font-wight:300;` use `text-head-light-xx` instead.
91
+
92
+ ## Stylelint Rules (Common CSS/SCSS Mistakes)
93
+
94
+ The `@db-ux/core-stylelint` plugin enforces design token usage. Never use raw `px`, `rem`, or hardcoded color values for the following properties:
95
+
96
+ ### Spacings (`db-ux/use-spacings`)
97
+
98
+ - Applies to: `margin`, `padding`, `gap` (and all sub-properties like `margin-top`, `padding-inline`, etc.)
99
+ - Use `var(--db-spacing-fixed-xx)` or `var(--db-spacing-responsive-xx)` instead of `px`/`rem` values
100
+ - `var(--db-sizing-xx)`, `%`, `vw`, `vh` are also allowed
101
+ - Allowed exact values: `0px`, `0`, `auto`, `inherit`, `initial`, `unset`
102
+ - ❌ `margin: 20px;` / `padding: 0.5rem;` / `margin-top: 8px;`
103
+ - ✅ `margin: var(--db-spacing-fixed-md);` / `padding: var(--db-spacing-responsive-lg);`
104
+
105
+ ### Sizing (`db-ux/use-sizing`)
106
+
107
+ - Applies to: `width`, `height`, `min-width`, `min-height`, `max-width`, `max-height`, `block-size`, `inline-size`
108
+ - Use `var(--db-sizing-xx)`, `var(--db-screen-xx)`, `var(--db-container-xx)`, `%`, `lh`, `ch`, `vw`, `vh` instead of `px`/`rem`
109
+ - Additional allowed values: `fit-content`, `max-content`, `min-content`, `none`, `revert`, `revert-layer`
110
+ - ❌ `width: 100px;` / `height: 50px;` / `block-size: 200px;`
111
+ - ✅ `width: var(--db-sizing-md);` / `height: 100%;` / `block-size: var(--db-screen-sm);`
112
+
113
+ ### Border Radius (`db-ux/use-border-radius`)
114
+
115
+ - Applies to: all `border-*-radius` properties
116
+ - Use `var(--db-border-radius-xx)` instead of `px`/`rem`
117
+ - ❌ `border-radius: 4px;` / `border-top-left-radius: 0.5rem;`
118
+ - ✅ `border-radius: var(--db-border-radius-md);`
119
+
120
+ ### Border Width (`db-ux/use-border-width`)
121
+
122
+ - Applies to: `border`, `border-top`, `border-right`, `border-bottom`, `border-left`, `border-block`, `border-block-start`, `border-block-end`, `border-inline`, `border-inline-start`, `border-inline-end`, and all `border-*-width` properties
123
+ - Use `var(--db-border-width-xx)` instead of `px`/`rem` for the width part
124
+ - ❌ `border: 1px solid transparent;` / `border-top: 2px solid red;`
125
+ - ✅ `border: var(--db-border-width-sm) solid transparent;`
126
+
127
+ ### Border Color (`db-ux/use-border-color`)
128
+
129
+ - Applies to: same border properties as border-width, plus all `border-*-color` properties
130
+ - Use `var(--db-adaptive-on-bg-basic-emphasis-xx-default)` or `var(--db-adaptive-on-bg-inverted)` for border colors
131
+ - `transparent` and `currentcolor` are also allowed
132
+ - ❌ `border: 1px solid red;` / `border-color: #ff0;` / `border-top: 1px solid blue;`
133
+ - ✅ `border: var(--db-border-width-sm) solid var(--db-adaptive-on-bg-basic-emphasis-100-default);`
134
+
135
+ ### General Notes
136
+
137
+ - CSS custom properties (`--my-var`) and SCSS variables (`$my-var`) are always allowed as values
138
+ - `0px`, `0`, `auto`, `inherit`, `initial`, `unset` are always allowed
139
+ - `calc()` expressions can be allowed via config option `allowCalc: true`
@@ -1,3 +1,5 @@
1
+ ## Usage
2
+
1
3
  ```html
2
4
  <div class="flex flex-col gap-md">
3
5
  <div class="grid grid-cols-2 md:grid-cols-3 gap-xs">
@@ -125,12 +127,12 @@
125
127
 
126
128
  ### Gap
127
129
 
128
- - `gap-3xs`
129
- - `gap-2xs`
130
- - `gap-xs`
131
- - `gap-sm`
132
- - `gap-md`
133
- - `gap-lg`
134
- - `gap-xl`
135
- - `gap-2xl`
136
- - `gap-3xl`
130
+ - `gap-fix-3xs`
131
+ - `gap-fix-2xs`
132
+ - `gap-fix-xs`
133
+ - `gap-fix-sm`
134
+ - `gap-fix-md`
135
+ - `gap-fix-lg`
136
+ - `gap-fix-xl`
137
+ - `gap-fix-2xl`
138
+ - `gap-fix-3xl`