@digigov/css 2.0.0-36b707c1 → 2.0.0-44e7106a

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 (115) hide show
  1. package/dist/base/index.css +1 -1
  2. package/dist/base.js +1 -1
  3. package/dist/components.js +1 -1
  4. package/dist/digigov.css +3 -3
  5. package/dist/utilities/index.css +1 -1
  6. package/dist/utilities.js +1 -1
  7. package/index.js +99 -69
  8. package/package.json +13 -13
  9. package/postcss.config.js +4 -4
  10. package/src/base/index.css +1 -0
  11. package/src/base/index.native.css +0 -0
  12. package/src/base/postcss.config.js +11 -10
  13. package/src/base/tailwind.config.js +4 -11
  14. package/src/components/accordion.common.css +29 -0
  15. package/src/components/accordion.css +9 -7
  16. package/src/components/accordion.native.css +27 -0
  17. package/src/components/autocomplete.css +1 -3
  18. package/src/components/blockquote.common.css +11 -11
  19. package/src/components/blockquote.css +6 -6
  20. package/src/components/blockquote.native.css +4 -1
  21. package/src/components/breadcrumbs.css +1 -1
  22. package/src/components/button.css +1 -1
  23. package/src/components/button.native.css +6 -7
  24. package/src/components/card.common.css +30 -30
  25. package/src/components/card.css +1 -1
  26. package/src/components/checkboxes.common.css +13 -13
  27. package/src/components/checkboxes.native.css +2 -3
  28. package/src/components/chip.common.css +19 -0
  29. package/src/components/chip.css +5 -4
  30. package/src/components/chip.native.css +15 -0
  31. package/src/components/code.css +7 -7
  32. package/src/components/copy-to-clipboard.css +1 -1
  33. package/src/components/copy-to-clipboard.native.css +2 -4
  34. package/src/components/details.common.css +23 -23
  35. package/src/components/details.native.css +8 -0
  36. package/src/components/drawer.css +20 -3
  37. package/src/components/dropdown.common.css +19 -19
  38. package/src/components/dropdown.native.css +10 -11
  39. package/src/components/filter.css +71 -22
  40. package/src/components/footer.css +8 -7
  41. package/src/components/form.common.css +75 -76
  42. package/src/components/form.css +8 -4
  43. package/src/components/form.native.css +102 -53
  44. package/src/components/header.common.css +32 -33
  45. package/src/components/header.css +9 -13
  46. package/src/components/header.native.css +5 -10
  47. package/src/components/kitchensink.css +2 -2
  48. package/src/components/layout.common.css +2 -2
  49. package/src/components/layout.css +1 -1
  50. package/src/components/layout.native.css +1 -0
  51. package/src/components/loader.common.css +7 -0
  52. package/src/components/loader.css +3 -1
  53. package/src/components/loader.native.css +5 -0
  54. package/src/components/modal.common.css +3 -4
  55. package/src/components/modal.css +14 -10
  56. package/src/components/modal.native.css +5 -5
  57. package/src/components/nav.common.css +18 -18
  58. package/src/components/nav.native.css +4 -6
  59. package/src/components/notification-banner.common.css +2 -2
  60. package/src/components/notification-banner.css +20 -2
  61. package/src/components/pagination.css +19 -3
  62. package/src/components/panel.common.css +26 -26
  63. package/src/components/panel.native.css +8 -2
  64. package/src/components/phase-banner.native.css +0 -1
  65. package/src/components/postcss.config.js +7 -6
  66. package/src/components/radios.common.css +1 -1
  67. package/src/components/radios.native.css +2 -3
  68. package/src/components/skeleton.common.css +20 -0
  69. package/src/components/skeleton.css +7 -10
  70. package/src/components/skeleton.native.css +53 -0
  71. package/src/components/stack.common.css +67 -0
  72. package/src/components/stack.css +23 -21
  73. package/src/components/stack.native.css +68 -0
  74. package/src/components/summary-list.common.css +5 -2
  75. package/src/components/summary-list.css +10 -7
  76. package/src/components/summary-list.native.css +5 -1
  77. package/src/components/svg-icons.common.css +1 -1
  78. package/src/components/svg-icons.native.css +2 -3
  79. package/src/components/table.css +44 -11
  80. package/src/components/test.css +2 -2
  81. package/src/components/typography.common.css +2 -7
  82. package/src/components/typography.css +20 -18
  83. package/src/components/typography.native.css +31 -0
  84. package/src/components/warning-text.common.css +1 -1
  85. package/src/components/warning-text.css +8 -6
  86. package/src/index.native.css +5 -0
  87. package/src/utilities/gap.css +1 -1
  88. package/src/utilities/index.css +6 -6
  89. package/src/utilities/index.native.css +6 -6
  90. package/src/utilities/layout.css +1 -1
  91. package/src/utilities/layout.native.css +1 -1
  92. package/src/utilities/margin.css +35 -35
  93. package/src/utilities/padding.css +1 -1
  94. package/src/utilities/postcss.config.js +7 -6
  95. package/src/utilities/print.css +1 -1
  96. package/src/utilities/utilities.css +3 -4
  97. package/tailwind.config.js +102 -106
  98. package/theming.js +121 -0
  99. package/defaultTheme/accordion.json +0 -16
  100. package/defaultTheme/back-to-top.json +0 -27
  101. package/defaultTheme/brandConfig.json +0 -147
  102. package/defaultTheme/breadcrumbs.json +0 -8
  103. package/defaultTheme/button.json +0 -94
  104. package/defaultTheme/card.json +0 -23
  105. package/defaultTheme/form.json +0 -132
  106. package/defaultTheme/globals.json +0 -81
  107. package/defaultTheme/index.js +0 -27
  108. package/defaultTheme/layout.json +0 -55
  109. package/defaultTheme/misc.json +0 -68
  110. package/defaultTheme/panel.json +0 -48
  111. package/defaultTheme/phase-banner.json +0 -8
  112. package/defaultTheme/radios.json +0 -8
  113. package/defaultTheme/summary-list.json +0 -8
  114. package/defaultTheme/typography.json +0 -295
  115. package/themes.plugin.js +0 -148
@@ -1,8 +0,0 @@
1
- {
2
- "radios__label": {
3
- "font-size": {
4
- "xs": "var(--text-base)",
5
- "md": "var(--text-lg)"
6
- }
7
- }
8
- }
@@ -1,8 +0,0 @@
1
- {
2
- "summary-list": {
3
- "font-size": {
4
- "xs": "var(--text-base)",
5
- "md": "var(--text-lg)"
6
- }
7
- }
8
- }
@@ -1,295 +0,0 @@
1
- {
2
- "heading-xl": {
3
- "font-size": {
4
- "xs": "var(--text-3xl)",
5
- "md": "var(--text-5xl)"
6
- },
7
- "line-height": {
8
- "xs": "var(--line-h-3xl)",
9
- "md": "var(--line-h-5xl)"
10
- },
11
- "margin-bottom": {
12
- "xs": "2rem",
13
- "md": "3rem"
14
- },
15
- "font-weight": {
16
- "xs": "700"
17
- },
18
- "letter-spacing": {
19
- "xs": "var(--letter-spacing-normal)"
20
- }
21
- },
22
- "heading-lg": {
23
- "font-size": {
24
- "xs": "var(--text-2xl)",
25
- "md": "var(--text-4xl)"
26
- },
27
- "line-height": {
28
- "xs": "var(--line-h-2xl)",
29
- "md": "var(--line-h-4xl)"
30
- },
31
- "margin-bottom": {
32
- "xs": "2rem",
33
- "md": "2.5rem"
34
- },
35
- "font-weight": {
36
- "xs": "700"
37
- },
38
- "letter-spacing": {
39
- "xs": "var(--letter-spacing-normal)"
40
- }
41
- },
42
- "heading-md": {
43
- "font-size": {
44
- "xs": "var(--text-xl)",
45
- "md": "var(--text-2xl)"
46
- },
47
- "line-height": {
48
- "xs": "var(--line-h-xl)",
49
- "md": "var(--line-h-2xl)"
50
- },
51
- "margin-bottom": {
52
- "xs": "1.5rem",
53
- "md": "2rem"
54
- },
55
- "font-weight": {
56
- "xs": "700"
57
- },
58
- "letter-spacing": {
59
- "xs": "var(--letter-spacing-normal)"
60
- }
61
- },
62
- "heading-sm": {
63
- "font-size": {
64
- "xs": "var(--text-base)",
65
- "md": "var(--text-lg)"
66
- },
67
- "line-height": {
68
- "xs": "var(--line-h-base)",
69
- "md": "var(--line-h-lg)"
70
- },
71
- "margin-bottom": {
72
- "xs": "0.75rem",
73
- "md": "1.25rem"
74
- },
75
- "font-weight": {
76
- "xs": "700"
77
- },
78
- "letter-spacing": {
79
- "xs": "var(--letter-spacing-normal)"
80
- }
81
- },
82
- "heading-xs": {
83
- "font-size": {
84
- "xs": "var(--text-sm)",
85
- "md": "var(--text-base)"
86
- },
87
- "line-height": {
88
- "xs": "var(--line-h-sm)",
89
- "md": "var(--line-h-base)"
90
- },
91
- "margin-bottom": {
92
- "xs": "0.5rem",
93
- "md": "1rem"
94
- },
95
- "font-weight": {
96
- "xs": "700"
97
- },
98
- "letter-spacing": {
99
- "xs": "var(--letter-spacing-normal)"
100
- }
101
- },
102
- "caption-xl": {
103
- "font-size": {
104
- "xs": "var(--text-xl)",
105
- "md": "var(--text-2xl)"
106
- },
107
- "line-height": {
108
- "xs": "var(--line-h-xl)",
109
- "md": "var(--line-h-2xl)"
110
- },
111
- "margin-bottom": {
112
- "xs": "0.25rem",
113
- "md": "0.5rem"
114
- },
115
- "color": {
116
- "xs": "var(--color-base-800)"
117
- },
118
- "font-weight": {
119
- "xs": "400"
120
- },
121
- "letter-spacing": {
122
- "xs": "var(--letter-spacing-normal)"
123
- }
124
- },
125
- "caption-lg": {
126
- "font-size": {
127
- "xs": "var(--text-lg)",
128
- "md": "var(--text-xl)"
129
- },
130
- "line-height": {
131
- "xs": "var(--line-h-lg)",
132
- "md": "var(--line-h-xl)"
133
- },
134
- "margin-bottom": {
135
- "xs": "0rem"
136
- },
137
- "color": {
138
- "xs": "var(--color-base-800)"
139
- },
140
- "font-weight": {
141
- "xs": "400"
142
- },
143
- "letter-spacing": {
144
- "xs": "var(--letter-spacing-normal)"
145
- }
146
- },
147
- "caption-md": {
148
- "font-size": {
149
- "xs": "var(--text-base)",
150
- "md": "var(--text-lg)"
151
- },
152
- "line-height": {
153
- "xs": "var(--line-h-base)",
154
- "md": "var(--line-h-lg)"
155
- },
156
- "margin-bottom": {
157
- "xs": "0rem"
158
- },
159
- "color": {
160
- "xs": "var(--color-base-800)"
161
- },
162
- "font-weight": {
163
- "xs": "400"
164
- },
165
- "letter-spacing": {
166
- "xs": "var(--letter-spacing-normal)"
167
- }
168
- },
169
- "body": {
170
- "font-size": {
171
- "xs": "var(--text-base)",
172
- "md": "var(--text-lg)"
173
- },
174
- "line-height": {
175
- "xs": "var(--line-h-base)",
176
- "md": "var(--line-h-lg)"
177
- },
178
- "margin-bottom": {
179
- "xs": "1rem",
180
- "md": "2rem"
181
- },
182
- "color": {
183
- "xs": "var(--color-base-content)"
184
- },
185
- "letter-spacing": {
186
- "xs": "var(--letter-spacing-normal)"
187
- }
188
- },
189
- "body--lg": {
190
- "font-size": {
191
- "xs": "var(--text-lg)",
192
- "md": "var(--text-2xl)"
193
- },
194
- "line-height": {
195
- "xs": "var(--line-h-lg)",
196
- "md": "var(--line-h-2xl)"
197
- }
198
- },
199
- "body--sm": {
200
- "font-size": {
201
- "xs": "var(--text-sm)",
202
- "md": "var(--text-base)"
203
- },
204
- "line-height": {
205
- "xs": "var(--line-h-sm)",
206
- "md": "var(--text-base)"
207
- }
208
- },
209
- "hint": {
210
- "font-size": {
211
- "xs": "var(--text-base)",
212
- "md": "var(--text-lg)"
213
- },
214
- "line-height": {
215
- "xs": "var(--line-h-base)",
216
- "md": "var(--line-h-lg)"
217
- },
218
- "margin-bottom": {
219
- "xs": "1rem"
220
- },
221
- "color": {
222
- "xs": "var(--color-base-800)"
223
- },
224
- "letter-spacing": {
225
- "xs": "var(--letter-spacing-normal)"
226
- }
227
- },
228
- "hint--lg": {
229
- "font-size": {
230
- "xs": "var(--text-lg)",
231
- "md": "var(--text-2xl)"
232
- },
233
- "line-height": {
234
- "xs": "var(--line-h-lg)",
235
- "md": "var(--line-h-2xl)"
236
- }
237
- },
238
- "hint--sm": {
239
- "font-size": {
240
- "xs": "var(--text-sm)",
241
- "md": "var(--text-base)"
242
- },
243
- "line-height": {
244
- "xs": "var(--line-h-sm)",
245
- "md": "var(--text-lg)"
246
- }
247
- },
248
- "link": {
249
- "color": {
250
- "xs": "var(--color-link)"
251
- },
252
- "color-active": {
253
- "xs": "var(--color-link-active)"
254
- },
255
- "color-hover": {
256
- "xs": "var(--color-link-hover)"
257
- },
258
- "padding": {
259
- "xs": "0px"
260
- },
261
- "font-size": {
262
- "xs": "var(--text-base)",
263
- "md": "var(--text-lg)"
264
- },
265
- "line-height": {
266
- "xs": "var(--line-h-base)",
267
- "md": "var(--line-h-lg)"
268
- },
269
- "letter-spacing": {
270
- "xs": "var(--letter-spacing-normal)"
271
- }
272
- },
273
- "back-link": {
274
- "font-size": {
275
- "xs": "var(--text-base)",
276
- "md": "var(--text-lg)"
277
- },
278
- "letter-spacing": {
279
- "xs": "var(--letter-spacing-normal)"
280
- }
281
- },
282
- "list": {
283
- "font-size": {
284
- "xs": "var(--text-base)",
285
- "md": "var(--text-lg)"
286
- },
287
- "line-height": {
288
- "xs": "var(--line-h-base)",
289
- "md": "var(--line-h-lg)"
290
- },
291
- "letter-spacing": {
292
- "xs": "var(--letter-spacing-normal)"
293
- }
294
- }
295
- }
package/themes.plugin.js DELETED
@@ -1,148 +0,0 @@
1
- const fs = require("fs");
2
- const path = require("path");
3
- const postcss = require("postcss");
4
- const postcssrc = require("postcss-load-config");
5
- const postcssJs = require("postcss-js");
6
-
7
- const prefix = "ds";
8
- const mediaQueriesMapping = {
9
- xs: "@media (min-width: 0px)",
10
- sm: "@media (min-width: 640px)",
11
- md: "@media (min-width: 768px)",
12
- lg: "@media (min-width: 1024px)",
13
- print: "@media print",
14
- };
15
-
16
- let hasRun = false;
17
-
18
- module.exports = function addThemes({ addBase, config }) {
19
- if (hasRun) {
20
- return;
21
- }
22
- hasRun = true;
23
-
24
- let base = {};
25
- const themes = config("themes");
26
- const defaultTheme = config("defaultTheme");
27
- for (const customTheme in themes) {
28
- const customThemeObject = require(themes[customTheme]);
29
- if (customThemeObject.overrides) {
30
- console.log("Loading theme css from source...");
31
- const css = fs
32
- .readFileSync(
33
- path.resolve(
34
- path.dirname(themes[customTheme]),
35
- "overrides/index.css",
36
- ),
37
- )
38
- .toString();
39
- const ctx = {};
40
- const { plugins, options } = postcssrc.sync(ctx);
41
- const result = postcss(plugins).process(css, options).result.root;
42
- const cssJs = postcssJs.objectify(result);
43
- base[`.${customTheme}`] = cssJs;
44
- }
45
- if (customTheme === defaultTheme) {
46
- base[`:root,:root.${customTheme},::before,::after`] =
47
- extractVars(customThemeObject);
48
- } else {
49
- base[
50
- `:root.${customTheme},.${customTheme},.${customTheme} *::before,.${customTheme} *::after`
51
- ] = extractVars(customThemeObject);
52
- }
53
-
54
- if (customThemeObject.variables && customThemeObject.variables.components) {
55
- const extractedVariables = extractMediaQueriesFromComponentVars(
56
- customThemeObject.variables.components,
57
- customTheme,
58
- defaultTheme,
59
- );
60
- Object.keys(extractedVariables).forEach((key) => {
61
- if (base[key]) {
62
- base[key] = { ...base[key], ...extractedVariables[key] };
63
- } else {
64
- base[key] = extractedVariables[key];
65
- }
66
- });
67
- }
68
- }
69
- addBase(base);
70
- };
71
-
72
- function extractVars(themeObj) {
73
- const colorVars = extractColorVars(themeObj.colors);
74
- const globalVars =
75
- themeObj.variables && themeObj.variables.globals
76
- ? extractGlobalVars(themeObj.variables.globals)
77
- : {};
78
- return { ...colorVars, ...globalVars };
79
- }
80
-
81
- function extractColorVars(colorObj, colorGroup = "") {
82
- return Object.keys(colorObj).reduce((vars, colorKey) => {
83
- const value = colorObj[colorKey];
84
- const colorName =
85
- colorKey == "default"
86
- ? `--color${colorGroup}`
87
- : `--color${colorGroup}-${colorKey}`;
88
- const newVars =
89
- typeof value === "string"
90
- ? {
91
- [colorName]: value,
92
- [`${colorName}-rgb`]: hexToRGB(value),
93
- }
94
- : extractColorVars(value, `-${colorKey}`);
95
- return { ...vars, ...newVars };
96
- }, {});
97
- }
98
-
99
- function extractGlobalVars(globalVarsObj) {
100
- return Object.keys(globalVarsObj).reduce((vars, varKey) => {
101
- const value = globalVarsObj[varKey];
102
- vars[`--${varKey}`] = value;
103
- return vars;
104
- }, {});
105
- }
106
-
107
- function hexToRGB(hex) {
108
- const r = parseInt(hex.slice(1, 3), 16),
109
- g = parseInt(hex.slice(3, 5), 16),
110
- b = parseInt(hex.slice(5, 7), 16);
111
-
112
- return r + ", " + g + ", " + b;
113
- }
114
-
115
- function extractMediaQueriesFromComponentVars(
116
- componentObj,
117
- customTheme,
118
- defaultTheme,
119
- ) {
120
- let mediaObj = {};
121
- Object.keys(componentObj).forEach((componentClass) => {
122
- Object.keys(componentObj[componentClass]).forEach((componentAttr) => {
123
- Object.keys(componentObj[componentClass][componentAttr]).forEach(
124
- (componentMedia) => {
125
- const newAttrKey = `--${componentClass}-${componentAttr}`;
126
- const newAttrValue =
127
- componentObj[componentClass][componentAttr][componentMedia];
128
- const newAttr = { [newAttrKey]: newAttrValue };
129
- const newClass = `.${prefix}-${componentClass}`;
130
- const newMedia = mediaQueriesMapping[componentMedia];
131
- const newTheme =
132
- customTheme === defaultTheme ? "" : `.${customTheme}`;
133
-
134
- if (mediaObj[newMedia]) {
135
- if (mediaObj[newMedia][newTheme][newClass]) {
136
- mediaObj[newMedia][newTheme][newClass][newAttrKey] = newAttrValue;
137
- } else {
138
- mediaObj[newMedia][newTheme][newClass] = newAttr;
139
- }
140
- } else {
141
- mediaObj[newMedia] = { [newTheme]: { [newClass]: newAttr } };
142
- }
143
- },
144
- );
145
- });
146
- });
147
- return mediaObj;
148
- }