@digigov/css 1.0.0-blabla-test → 1.0.0-e322b0cc
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.
- package/defaultTheme/footer.json +5 -5
- package/defaultTheme/typography.json +22 -2
- package/dist/base/index.css +1 -3
- package/dist/base.js +1 -1
- package/dist/components.js +1 -1
- package/dist/digigov.css +3 -5
- package/dist/utilities/index.css +1 -1
- package/dist/utilities.js +1 -1
- package/index.js +1 -1
- package/package.json +6 -7
- package/postcss.config.js +15 -14
- package/src/base/index.css +4 -0
- package/src/base/postcss.config.js +23 -22
- package/src/base/tailwind.config.js +19 -15
- package/src/components/accordion.css +67 -13
- package/src/components/admin-header.css +27 -1
- package/src/components/admin-layout.css +6 -0
- package/src/components/autocomplete.css +12 -9
- package/src/components/bottom-info.css +2 -1
- package/src/components/button.css +99 -32
- package/src/components/card.css +30 -15
- package/src/components/checkboxes.css +56 -10
- package/src/components/chip.css +35 -15
- package/src/components/copy-to-clipboard.css +52 -30
- package/src/components/drawer.css +58 -27
- package/src/components/dropdown.css +96 -71
- package/src/components/filter.css +71 -63
- package/src/components/footer.css +29 -23
- package/src/components/form.css +70 -47
- package/src/components/header.css +86 -32
- package/src/components/hidden.css +3 -0
- package/src/components/index.css +3 -1
- package/src/components/kitchensink.css +2 -2
- package/src/components/layout.css +25 -25
- package/src/components/loader.css +11 -22
- package/src/components/masthead.css +78 -0
- package/src/components/misc.css +17 -41
- package/src/components/modal.css +10 -3
- package/src/components/nav.css +93 -126
- package/src/components/notification-banner.css +32 -10
- package/src/components/pagination.css +41 -24
- package/src/components/panel.css +5 -4
- package/src/components/phase-banner.css +1 -7
- package/src/components/postcss.config.js +15 -16
- package/src/components/radios.css +34 -25
- package/src/components/stack.css +66 -0
- package/src/components/stepnav.css +34 -10
- package/src/components/summary-list.css +22 -15
- package/src/components/svg-icons.css +2 -62
- package/src/components/table.css +43 -47
- package/src/components/tabs.css +33 -1
- package/src/components/tailwind.config.js +12 -6
- package/src/components/task-list.css +28 -15
- package/src/components/timeline.css +21 -6
- package/src/components/typography.css +98 -64
- package/src/components/warning-text.css +23 -0
- package/src/fonts.css +1 -1
- package/src/index.css +0 -2
- package/src/pages/admin-filtering-data.js +1 -1
- package/src/pages/dropdown.js +2 -2
- package/src/pages/form.js +1 -1
- package/src/pages/index.js +12 -10
- package/src/utilities/index.css +142 -22
- package/src/utilities/postcss.config.js +15 -16
- package/src/utilities/tailwind.config.js +10 -1
- package/src/utilities/utilities.css +158 -34
- package/tailwind.config.js +18 -30
- package/themes.plugin.js +95 -100
- package/src/components/accessibility-menu.css +0 -71
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
@layer utilities {
|
|
3
3
|
.govgr-m-0 {
|
|
4
4
|
@apply m-0 !important;
|
|
5
|
-
}
|
|
5
|
+
}
|
|
6
6
|
.govgr-m-1 {
|
|
7
7
|
@apply m-1 !important;
|
|
8
8
|
}
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
}
|
|
42
42
|
.govgr-mt-0 {
|
|
43
43
|
@apply mt-0 !important;
|
|
44
|
-
}
|
|
44
|
+
}
|
|
45
45
|
.govgr-mt-1 {
|
|
46
46
|
@apply mt-1 !important;
|
|
47
47
|
}
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
}
|
|
81
81
|
.govgr-mb-0 {
|
|
82
82
|
@apply mb-0 !important;
|
|
83
|
-
}
|
|
83
|
+
}
|
|
84
84
|
.govgr-mb-1 {
|
|
85
85
|
@apply mb-1 !important;
|
|
86
86
|
}
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
}
|
|
120
120
|
.govgr-ml-0 {
|
|
121
121
|
@apply ml-0 !important;
|
|
122
|
-
}
|
|
122
|
+
}
|
|
123
123
|
.govgr-ml-1 {
|
|
124
124
|
@apply ml-1 !important;
|
|
125
125
|
}
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
}
|
|
159
159
|
.govgr-mr-0 {
|
|
160
160
|
@apply mr-0 !important;
|
|
161
|
-
}
|
|
161
|
+
}
|
|
162
162
|
.govgr-mr-1 {
|
|
163
163
|
@apply mr-1 !important;
|
|
164
164
|
}
|
|
@@ -197,7 +197,7 @@
|
|
|
197
197
|
}
|
|
198
198
|
.govgr-p-0 {
|
|
199
199
|
@apply p-0 !important;
|
|
200
|
-
}
|
|
200
|
+
}
|
|
201
201
|
.govgr-p-1 {
|
|
202
202
|
@apply p-1 !important;
|
|
203
203
|
}
|
|
@@ -236,7 +236,7 @@
|
|
|
236
236
|
}
|
|
237
237
|
.govgr-pt-0 {
|
|
238
238
|
@apply pt-0 !important;
|
|
239
|
-
}
|
|
239
|
+
}
|
|
240
240
|
.govgr-pt-1 {
|
|
241
241
|
@apply pt-1 !important;
|
|
242
242
|
}
|
|
@@ -275,7 +275,7 @@
|
|
|
275
275
|
}
|
|
276
276
|
.govgr-pb-0 {
|
|
277
277
|
@apply pb-0 !important;
|
|
278
|
-
}
|
|
278
|
+
}
|
|
279
279
|
.govgr-pb-1 {
|
|
280
280
|
@apply pb-1 !important;
|
|
281
281
|
}
|
|
@@ -314,7 +314,7 @@
|
|
|
314
314
|
}
|
|
315
315
|
.govgr-pl-0 {
|
|
316
316
|
@apply pl-0 !important;
|
|
317
|
-
}
|
|
317
|
+
}
|
|
318
318
|
.govgr-pl-1 {
|
|
319
319
|
@apply pl-1 !important;
|
|
320
320
|
}
|
|
@@ -353,7 +353,7 @@
|
|
|
353
353
|
}
|
|
354
354
|
.govgr-pr-0 {
|
|
355
355
|
@apply pr-0 !important;
|
|
356
|
-
}
|
|
356
|
+
}
|
|
357
357
|
.govgr-pr-1 {
|
|
358
358
|
@apply pr-1 !important;
|
|
359
359
|
}
|
|
@@ -390,32 +390,11 @@
|
|
|
390
390
|
.govgr-pr-12 {
|
|
391
391
|
@apply pr-11 md:pr-20 !important;
|
|
392
392
|
}
|
|
393
|
-
.govgr-grid {
|
|
394
|
-
@apply grid grid-cols-12;
|
|
395
|
-
}
|
|
396
393
|
.govgr-grid-inline {
|
|
397
394
|
@apply inline-grid;
|
|
398
395
|
}
|
|
399
|
-
.govgr-
|
|
400
|
-
@apply
|
|
401
|
-
}
|
|
402
|
-
.govgr-grid__gap-2 {
|
|
403
|
-
@apply gap-2;
|
|
404
|
-
}
|
|
405
|
-
.govgr-grid__gap-4 {
|
|
406
|
-
@apply gap-4;
|
|
407
|
-
}
|
|
408
|
-
.govgr-grid__gap-6 {
|
|
409
|
-
@apply gap-6;
|
|
410
|
-
}
|
|
411
|
-
.govgr-grid__gap-8 {
|
|
412
|
-
@apply gap-8;
|
|
413
|
-
}
|
|
414
|
-
.govgr-grid__gap-10 {
|
|
415
|
-
@apply gap-10;
|
|
416
|
-
}
|
|
417
|
-
.govgr-grid__gap-12 {
|
|
418
|
-
@apply gap-12;
|
|
396
|
+
.govgr-grid {
|
|
397
|
+
@apply grid grid-cols-12;
|
|
419
398
|
}
|
|
420
399
|
.govgr-grid__col-auto {
|
|
421
400
|
@apply col-auto;
|
|
@@ -465,4 +444,149 @@
|
|
|
465
444
|
.govgr-print-visible-inline {
|
|
466
445
|
@apply print:inline !important;
|
|
467
446
|
}
|
|
468
|
-
|
|
447
|
+
.govgr-gap-1 {
|
|
448
|
+
@apply gap-1;
|
|
449
|
+
}
|
|
450
|
+
.govgr-gap-2 {
|
|
451
|
+
@apply gap-2;
|
|
452
|
+
}
|
|
453
|
+
.govgr-gap-4 {
|
|
454
|
+
@apply gap-4;
|
|
455
|
+
}
|
|
456
|
+
.govgr-gap-5 {
|
|
457
|
+
@apply gap-5;
|
|
458
|
+
}
|
|
459
|
+
.govgr-gap-6 {
|
|
460
|
+
@apply gap-6;
|
|
461
|
+
}
|
|
462
|
+
.govgr-gap-8 {
|
|
463
|
+
@apply gap-8;
|
|
464
|
+
}
|
|
465
|
+
.govgr-gap-10 {
|
|
466
|
+
@apply gap-10;
|
|
467
|
+
}
|
|
468
|
+
.govgr-gap-12 {
|
|
469
|
+
@apply gap-12;
|
|
470
|
+
}
|
|
471
|
+
.govgr-gap-xs-1 {
|
|
472
|
+
@apply gap-1;
|
|
473
|
+
}
|
|
474
|
+
.govgr-gap-xs-2 {
|
|
475
|
+
@apply gap-2;
|
|
476
|
+
}
|
|
477
|
+
.govgr-gap-xs-4 {
|
|
478
|
+
@apply gap-4;
|
|
479
|
+
}
|
|
480
|
+
.govgr-gap-xs-5 {
|
|
481
|
+
@apply gap-5;
|
|
482
|
+
}
|
|
483
|
+
.govgr-gap-xs-6 {
|
|
484
|
+
@apply gap-6;
|
|
485
|
+
}
|
|
486
|
+
.govgr-gap-xs-8 {
|
|
487
|
+
@apply gap-8;
|
|
488
|
+
}
|
|
489
|
+
.govgr-gap-xs-10 {
|
|
490
|
+
@apply gap-10;
|
|
491
|
+
}
|
|
492
|
+
.govgr-gap-xs-12 {
|
|
493
|
+
@apply gap-12;
|
|
494
|
+
}
|
|
495
|
+
.govgr-gap-sm-1 {
|
|
496
|
+
@apply sm:gap-1;
|
|
497
|
+
}
|
|
498
|
+
.govgr-gap-sm-2 {
|
|
499
|
+
@apply sm:gap-2;
|
|
500
|
+
}
|
|
501
|
+
.govgr-gap-sm-4 {
|
|
502
|
+
@apply sm:gap-4;
|
|
503
|
+
}
|
|
504
|
+
.govgr-gap-sm-5 {
|
|
505
|
+
@apply sm:gap-5;
|
|
506
|
+
}
|
|
507
|
+
.govgr-gap-sm-6 {
|
|
508
|
+
@apply sm:gap-6;
|
|
509
|
+
}
|
|
510
|
+
.govgr-gap-sm-8 {
|
|
511
|
+
@apply sm:gap-8;
|
|
512
|
+
}
|
|
513
|
+
.govgr-gap-sm-10 {
|
|
514
|
+
@apply sm:gap-10;
|
|
515
|
+
}
|
|
516
|
+
.govgr-gap-sm-12 {
|
|
517
|
+
@apply sm:gap-12;
|
|
518
|
+
}
|
|
519
|
+
.govgr-gap-md-1 {
|
|
520
|
+
@apply md:gap-1;
|
|
521
|
+
}
|
|
522
|
+
.govgr-gap-md-2 {
|
|
523
|
+
@apply md:gap-2;
|
|
524
|
+
}
|
|
525
|
+
.govgr-gap-md-4 {
|
|
526
|
+
@apply md:gap-4;
|
|
527
|
+
}
|
|
528
|
+
.govgr-gap-md-5 {
|
|
529
|
+
@apply md:gap-5;
|
|
530
|
+
}
|
|
531
|
+
.govgr-gap-md-6 {
|
|
532
|
+
@apply md:gap-6;
|
|
533
|
+
}
|
|
534
|
+
.govgr-gap-md-8 {
|
|
535
|
+
@apply md:gap-8;
|
|
536
|
+
}
|
|
537
|
+
.govgr-gap-md-10 {
|
|
538
|
+
@apply md:gap-10;
|
|
539
|
+
}
|
|
540
|
+
.govgr-gap-md-12 {
|
|
541
|
+
@apply md:gap-12;
|
|
542
|
+
}
|
|
543
|
+
.govgr-gap-lg-1 {
|
|
544
|
+
@apply lg:gap-1;
|
|
545
|
+
}
|
|
546
|
+
.govgr-gap-lg-2 {
|
|
547
|
+
@apply lg:gap-2;
|
|
548
|
+
}
|
|
549
|
+
.govgr-gap-lg-4 {
|
|
550
|
+
@apply lg:gap-4;
|
|
551
|
+
}
|
|
552
|
+
.govgr-gap-lg-5 {
|
|
553
|
+
@apply lg:gap-5;
|
|
554
|
+
}
|
|
555
|
+
.govgr-gap-lg-6 {
|
|
556
|
+
@apply lg:gap-6;
|
|
557
|
+
}
|
|
558
|
+
.govgr-gap-lg-8 {
|
|
559
|
+
@apply lg:gap-8;
|
|
560
|
+
}
|
|
561
|
+
.govgr-gap-lg-10 {
|
|
562
|
+
@apply lg:gap-10;
|
|
563
|
+
}
|
|
564
|
+
.govgr-gap-lg-12 {
|
|
565
|
+
@apply lg:gap-12;
|
|
566
|
+
}
|
|
567
|
+
.govgr-gap-xl-1 {
|
|
568
|
+
@apply xl:gap-1;
|
|
569
|
+
}
|
|
570
|
+
.govgr-gap-xl-2 {
|
|
571
|
+
@apply xl:gap-2;
|
|
572
|
+
}
|
|
573
|
+
.govgr-gap-xl-4 {
|
|
574
|
+
@apply xl:gap-4;
|
|
575
|
+
}
|
|
576
|
+
.govgr-gap-xl-5 {
|
|
577
|
+
@apply xl:gap-5;
|
|
578
|
+
}
|
|
579
|
+
.govgr-gap-xl-6 {
|
|
580
|
+
@apply xl:gap-6;
|
|
581
|
+
}
|
|
582
|
+
.govgr-gap-xl-8 {
|
|
583
|
+
@apply xl:gap-8;
|
|
584
|
+
}
|
|
585
|
+
.govgr-gap-xl-10 {
|
|
586
|
+
@apply xl:gap-10;
|
|
587
|
+
}
|
|
588
|
+
.govgr-gap-xl-12 {
|
|
589
|
+
@apply xl:gap-12;
|
|
590
|
+
}
|
|
591
|
+
};
|
|
592
|
+
|
package/tailwind.config.js
CHANGED
|
@@ -64,14 +64,8 @@ const allColors = [
|
|
|
64
64
|
"shadow600",
|
|
65
65
|
];
|
|
66
66
|
|
|
67
|
-
const buildOnly = !process.env["DIGIGOV_CSS_BUILD"]
|
|
68
|
-
? {
|
|
69
|
-
mode: "jit",
|
|
70
|
-
}
|
|
71
|
-
: {};
|
|
72
|
-
|
|
73
67
|
const colorVariables = allColors.reduce((colorVars, color) => {
|
|
74
|
-
if ([
|
|
68
|
+
if (["transparent", "currentColor"].includes(color)) {
|
|
75
69
|
colorVars[color] = color;
|
|
76
70
|
} else {
|
|
77
71
|
colorVars[color] = ({ opacityVariable, opacityValue }) => {
|
|
@@ -87,13 +81,17 @@ const colorVariables = allColors.reduce((colorVars, color) => {
|
|
|
87
81
|
return colorVars;
|
|
88
82
|
}, {});
|
|
89
83
|
|
|
84
|
+
/** @type {import('tailwindcss').Config} */
|
|
90
85
|
module.exports = {
|
|
91
|
-
|
|
92
|
-
|
|
86
|
+
darkMode: "class",
|
|
87
|
+
content: {
|
|
88
|
+
files: ["./src/*.css"],
|
|
89
|
+
relative: true,
|
|
90
|
+
},
|
|
93
91
|
themes: {
|
|
94
|
-
light: require.resolve(
|
|
92
|
+
light: require.resolve("./defaultTheme"),
|
|
95
93
|
},
|
|
96
|
-
defaultTheme:
|
|
94
|
+
defaultTheme: "light",
|
|
97
95
|
theme: {
|
|
98
96
|
colors: colorVariables,
|
|
99
97
|
container: {
|
|
@@ -111,11 +109,11 @@ module.exports = {
|
|
|
111
109
|
xl: "1280px",
|
|
112
110
|
"2xl": "1280px",
|
|
113
111
|
print: { raw: "print" },
|
|
114
|
-
xsOnly: {
|
|
115
|
-
smOnly: {
|
|
116
|
-
mdOnly: {
|
|
117
|
-
lgOnly: {
|
|
118
|
-
xlOnly: {
|
|
112
|
+
xsOnly: { min: "0px", max: "639.98px" },
|
|
113
|
+
smOnly: { min: "640px", max: "767.98px" },
|
|
114
|
+
mdOnly: { min: "768px", max: "1023.98px" },
|
|
115
|
+
lgOnly: { min: "1024px", max: "1279.98px" },
|
|
116
|
+
xlOnly: { min: "1280px", max: "1535.98px" },
|
|
119
117
|
},
|
|
120
118
|
fontFamily: {
|
|
121
119
|
sans: ["Roboto", ...defaultTheme.fontFamily.sans],
|
|
@@ -126,8 +124,8 @@ module.exports = {
|
|
|
126
124
|
},
|
|
127
125
|
width: {
|
|
128
126
|
fit: "fit-content",
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
"2xl": "42rem",
|
|
128
|
+
"4xl": "56rem",
|
|
131
129
|
},
|
|
132
130
|
maxWidth: {
|
|
133
131
|
fit: "fit-content",
|
|
@@ -156,6 +154,8 @@ module.exports = {
|
|
|
156
154
|
zIndex: {
|
|
157
155
|
"/1": -1,
|
|
158
156
|
1: 1,
|
|
157
|
+
2: 2,
|
|
158
|
+
3: 3,
|
|
159
159
|
},
|
|
160
160
|
opacity: {
|
|
161
161
|
85: "0.85",
|
|
@@ -166,18 +166,6 @@ module.exports = {
|
|
|
166
166
|
boxShadow: {
|
|
167
167
|
thick: "0 0 30px rgba(0, 0, 0, 0.6)",
|
|
168
168
|
},
|
|
169
|
-
borderColor: {
|
|
170
|
-
// TODO: fix this invalid value in the future
|
|
171
|
-
// Read more: https://gitlab.grnet.gr/devs/digigov/digigov-sdk/-/merge_requests/818
|
|
172
|
-
DEFAULT: 'reset',
|
|
173
|
-
}
|
|
174
|
-
},
|
|
175
|
-
},
|
|
176
|
-
variants: {
|
|
177
|
-
extend: {
|
|
178
|
-
textDecoration: ["active"],
|
|
179
|
-
backgroundColor: ["active"],
|
|
180
|
-
borderColor: ["active"],
|
|
181
169
|
},
|
|
182
170
|
},
|
|
183
171
|
plugins: [plugin(themesPlugin)],
|
package/themes.plugin.js
CHANGED
|
@@ -6,92 +6,20 @@ const postcssJs = require("postcss-js");
|
|
|
6
6
|
|
|
7
7
|
const prefix = "govgr";
|
|
8
8
|
const mediaQueriesMapping = {
|
|
9
|
-
xs: "",
|
|
9
|
+
xs: "@media (min-width: 0px)",
|
|
10
10
|
sm: "@media (min-width: 640px)",
|
|
11
11
|
md: "@media (min-width: 768px)",
|
|
12
12
|
lg: "@media (min-width: 1024px)",
|
|
13
13
|
print: "@media print",
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
function hexToRGB(hex) {
|
|
17
|
-
var r = parseInt(hex.slice(1, 3), 16),
|
|
18
|
-
g = parseInt(hex.slice(3, 5), 16),
|
|
19
|
-
b = parseInt(hex.slice(5, 7), 16);
|
|
20
|
-
|
|
21
|
-
return r + ", " + g + ", " + b;
|
|
22
|
-
}
|
|
23
16
|
let hasRun = false;
|
|
24
17
|
|
|
25
|
-
function addThemes({ addBase,
|
|
18
|
+
module.exports = function addThemes({ addBase, config }) {
|
|
26
19
|
if (hasRun) {
|
|
27
20
|
return;
|
|
28
21
|
}
|
|
29
22
|
hasRun = true;
|
|
30
|
-
function extractColorVars(colorObj, colorGroup = "") {
|
|
31
|
-
return Object.keys(colorObj).reduce((vars, colorKey) => {
|
|
32
|
-
const value = colorObj[colorKey];
|
|
33
|
-
const colorName =
|
|
34
|
-
colorKey == "default"
|
|
35
|
-
? `--color${colorGroup}`
|
|
36
|
-
: `--color${colorGroup}-${colorKey}`;
|
|
37
|
-
const newVars =
|
|
38
|
-
typeof value === "string"
|
|
39
|
-
? {
|
|
40
|
-
[colorName]: value,
|
|
41
|
-
[`${colorName}-rgb`]: hexToRGB(value),
|
|
42
|
-
}
|
|
43
|
-
: extractColorVars(value, `-${colorKey}`);
|
|
44
|
-
return { ...vars, ...newVars };
|
|
45
|
-
}, {});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function extractMediaQueriesFromComponentVars(componentObj, customTheme) {
|
|
49
|
-
let mediaObj = {};
|
|
50
|
-
Object.keys(componentObj).forEach((componentClass) => {
|
|
51
|
-
Object.keys(componentObj[componentClass]).forEach((componentAttr) => {
|
|
52
|
-
Object.keys(componentObj[componentClass][componentAttr]).forEach(
|
|
53
|
-
(componentMedia) => {
|
|
54
|
-
const newAttrKey = `--${componentClass}-${componentAttr}`;
|
|
55
|
-
const newAttrValue =
|
|
56
|
-
componentObj[componentClass][componentAttr][componentMedia];
|
|
57
|
-
const newAttr = { [newAttrKey]: newAttrValue };
|
|
58
|
-
const newClass = `.${prefix}-${componentClass}`;
|
|
59
|
-
const newMedia = mediaQueriesMapping[componentMedia];
|
|
60
|
-
const newTheme =
|
|
61
|
-
customTheme === defaultTheme ? "" : `.${customTheme}`;
|
|
62
|
-
|
|
63
|
-
if (mediaObj[newMedia]) {
|
|
64
|
-
if (mediaObj[newMedia][newTheme][newClass]) {
|
|
65
|
-
mediaObj[newMedia][newTheme][newClass][newAttrKey] =
|
|
66
|
-
newAttrValue;
|
|
67
|
-
} else {
|
|
68
|
-
mediaObj[newMedia][newTheme][newClass] = newAttr;
|
|
69
|
-
}
|
|
70
|
-
} else {
|
|
71
|
-
mediaObj[newMedia] = { [newTheme]: { [newClass]: newAttr } };
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
return mediaObj;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function extractGlobalVars(globalVarsObj) {
|
|
81
|
-
return Object.keys(globalVarsObj).reduce((vars, varKey) => {
|
|
82
|
-
const value = globalVarsObj[varKey];
|
|
83
|
-
vars[`--${varKey}`] = value;
|
|
84
|
-
return vars;
|
|
85
|
-
}, {});
|
|
86
|
-
}
|
|
87
|
-
function extractVars(themeObj) {
|
|
88
|
-
const colorVars = extractColorVars(themeObj.colors);
|
|
89
|
-
const globalVars =
|
|
90
|
-
themeObj.variables && themeObj.variables.globals
|
|
91
|
-
? extractGlobalVars(themeObj.variables.globals)
|
|
92
|
-
: {};
|
|
93
|
-
return { ...colorVars, ...globalVars };
|
|
94
|
-
}
|
|
95
23
|
|
|
96
24
|
let base = {};
|
|
97
25
|
const themes = config("themes");
|
|
@@ -99,44 +27,35 @@ function addThemes({ addBase, addComponents, theme, config }) {
|
|
|
99
27
|
for (const customTheme in themes) {
|
|
100
28
|
const customThemeObject = require(themes[customTheme]);
|
|
101
29
|
if (customThemeObject.overrides) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
.
|
|
106
|
-
path.resolve(
|
|
107
|
-
path.dirname(themes[customTheme]),
|
|
108
|
-
"overrides/index.css"
|
|
109
|
-
)
|
|
110
|
-
)
|
|
111
|
-
.toString();
|
|
112
|
-
const ctx = {};
|
|
113
|
-
const { plugins, options } = postcssrc.sync(ctx);
|
|
114
|
-
const result = postcss(plugins).process(css, options).root;
|
|
115
|
-
const cssJs = postcssJs.objectify(result);
|
|
116
|
-
base[`.${customTheme}`] = cssJs;
|
|
117
|
-
} else {
|
|
118
|
-
customThemeObject.overrides.forEach((override) => {
|
|
119
|
-
const cssJs = require(path.resolve(
|
|
30
|
+
console.log("Loading theme css from source...");
|
|
31
|
+
const css = fs
|
|
32
|
+
.readFileSync(
|
|
33
|
+
path.resolve(
|
|
120
34
|
path.dirname(themes[customTheme]),
|
|
121
|
-
|
|
122
|
-
)
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
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;
|
|
126
44
|
}
|
|
127
45
|
if (customTheme === defaultTheme) {
|
|
128
46
|
base[`:root,:root.${customTheme},::before,::after`] =
|
|
129
47
|
extractVars(customThemeObject);
|
|
130
48
|
} else {
|
|
131
49
|
base[
|
|
132
|
-
`:root.${customTheme},.${customTheme} *::before,.${customTheme} *::after`
|
|
50
|
+
`:root.${customTheme},.${customTheme},.${customTheme} *::before,.${customTheme} *::after`
|
|
133
51
|
] = extractVars(customThemeObject);
|
|
134
52
|
}
|
|
135
53
|
|
|
136
54
|
if (customThemeObject.variables && customThemeObject.variables.components) {
|
|
137
55
|
const extractedVariables = extractMediaQueriesFromComponentVars(
|
|
138
56
|
customThemeObject.variables.components,
|
|
139
|
-
customTheme
|
|
57
|
+
customTheme,
|
|
58
|
+
defaultTheme,
|
|
140
59
|
);
|
|
141
60
|
Object.keys(extractedVariables).forEach((key) => {
|
|
142
61
|
if (base[key]) {
|
|
@@ -148,6 +67,82 @@ function addThemes({ addBase, addComponents, theme, config }) {
|
|
|
148
67
|
}
|
|
149
68
|
}
|
|
150
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 };
|
|
151
79
|
}
|
|
152
80
|
|
|
153
|
-
|
|
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
|
+
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
.govgr-accessibility-menu {}
|
|
2
|
-
.govgr-accessibility-menu--left {
|
|
3
|
-
.govgr-accessibility-menu__btn {
|
|
4
|
-
@apply left-4;
|
|
5
|
-
}
|
|
6
|
-
.govgr-accessibility-menu__content {
|
|
7
|
-
@apply left-0;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
.govgr-accessibility-menu--right {
|
|
11
|
-
.govgr-accessibility-menu__btn {
|
|
12
|
-
@apply right-4;
|
|
13
|
-
}
|
|
14
|
-
.govgr-accessibility-menu__content {
|
|
15
|
-
@apply right-0;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
.govgr-accessibility-menu__btn {
|
|
19
|
-
@apply absolute bottom-4 bg-base-300;
|
|
20
|
-
@apply p-4 rounded-full !important;
|
|
21
|
-
box-shadow: 0px 2px 5px rgba(var(--color-base-900-rgb), 0.3);
|
|
22
|
-
&:hover {
|
|
23
|
-
@apply bg-base-400;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
.govgr-accessibility-menu__content {
|
|
27
|
-
@apply bg-base-200 absolute top-0 bottom-0 p-4 flex flex-col max-w-md;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.govgr-accessibility-menu__header {
|
|
31
|
-
@apply inline-flex justify-between items-center mb-6 gap-2;
|
|
32
|
-
}
|
|
33
|
-
.govgr-accessibility-menu__header-btn {
|
|
34
|
-
@apply flex flex-nowrap;
|
|
35
|
-
}
|
|
36
|
-
.govgr-accessibility-menu__body {
|
|
37
|
-
@apply overflow-y-scroll p-3 flex-grow;
|
|
38
|
-
}
|
|
39
|
-
.govgr-accessibility-menu__list {
|
|
40
|
-
@apply grid grid-cols-1 sm:grid-cols-2 gap-5;
|
|
41
|
-
}
|
|
42
|
-
.govgr-accessibility-menu__list-item {
|
|
43
|
-
@apply col-span-1;
|
|
44
|
-
}
|
|
45
|
-
.govgr-accessibility-menu__option-btn {
|
|
46
|
-
@apply flex flex-col gap-2;
|
|
47
|
-
@apply bg-base-100 border-base-100 border-2;
|
|
48
|
-
@apply w-full sm:w-fit leading-tight m-0 !important;
|
|
49
|
-
padding: calc(1rem + 2px) !important;
|
|
50
|
-
&:hover {
|
|
51
|
-
@apply border-base-content;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
.govgr-accessibility-menu__option-btn--selected {
|
|
55
|
-
@apply border-success border-4 text-success p-4 !important;
|
|
56
|
-
.govgr-svg-icon {
|
|
57
|
-
fill: var(--color-success) !important;
|
|
58
|
-
}
|
|
59
|
-
.govgr-accessibility-menu__steps {
|
|
60
|
-
@apply opacity-100;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
.govgr-accessibility-menu__steps {
|
|
64
|
-
@apply flex flex-nowrap w-full gap-2 h-1 mt-2 opacity-0;
|
|
65
|
-
}
|
|
66
|
-
.govgr-accessibility-menu__step {
|
|
67
|
-
@apply bg-base-300 w-full;
|
|
68
|
-
}
|
|
69
|
-
.govgr-accessibility-menu__step--active {
|
|
70
|
-
@apply bg-success;
|
|
71
|
-
}
|