@marwes-ui/core 1.2.0 → 1.4.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.
- package/README.md +22 -17
- package/dist/index.d.ts +1284 -217
- package/dist/index.js +1716 -83
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
|
+
// src/theme/text-variant.ts
|
|
2
|
+
var TextVariant = {
|
|
3
|
+
display: "display",
|
|
4
|
+
label: "label",
|
|
5
|
+
labelSmall: "label-small",
|
|
6
|
+
caption: "caption",
|
|
7
|
+
overline: "overline",
|
|
8
|
+
micro: "micro"
|
|
9
|
+
};
|
|
10
|
+
|
|
1
11
|
// src/theme/theme-types.ts
|
|
2
12
|
var ThemeMode = {
|
|
3
13
|
light: "light",
|
|
4
14
|
dark: "dark"
|
|
5
15
|
};
|
|
16
|
+
var defaultThemeBreakpoints = {
|
|
17
|
+
mobile: 640,
|
|
18
|
+
tablet: 900,
|
|
19
|
+
desktop: 1200,
|
|
20
|
+
wideDesktop: 1440
|
|
21
|
+
};
|
|
6
22
|
|
|
7
23
|
// src/theme/theme-mode.ts
|
|
8
24
|
function isThemeMode(value) {
|
|
@@ -84,6 +100,30 @@ function colorRoleVars(role, cr) {
|
|
|
84
100
|
[`--mw-color-${role}-label-disabled`]: cr.labelDisabled
|
|
85
101
|
};
|
|
86
102
|
}
|
|
103
|
+
function statusColorVars(role, tokens) {
|
|
104
|
+
return {
|
|
105
|
+
[`--mw-color-status-${role}-background`]: tokens.background,
|
|
106
|
+
[`--mw-color-status-${role}-text`]: tokens.text,
|
|
107
|
+
[`--mw-color-status-${role}-icon`]: tokens.icon,
|
|
108
|
+
[`--mw-color-status-${role}-border`]: tokens.border,
|
|
109
|
+
...tokens.borderAccessible ? { [`--mw-color-status-${role}-border-accessible`]: tokens.borderAccessible } : {},
|
|
110
|
+
[`--mw-color-status-${role}-border-strong`]: tokens.borderStrong
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function typographyStyleVars(prefix, style) {
|
|
114
|
+
return {
|
|
115
|
+
[`${prefix}-font-size`]: `${style.fontSize}px`,
|
|
116
|
+
[`${prefix}-line-height`]: `${style.lineHeight}`,
|
|
117
|
+
[`${prefix}-font-weight`]: `${style.fontWeight}`,
|
|
118
|
+
[`${prefix}-letter-spacing`]: `${style.letterSpacing}px`
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function textTypographyStyleVars(variant, style) {
|
|
122
|
+
return {
|
|
123
|
+
...typographyStyleVars(`--mw-typography-text-${variant}`, style),
|
|
124
|
+
[`--mw-typography-text-${variant}-transform`]: style.textTransform ?? "none"
|
|
125
|
+
};
|
|
126
|
+
}
|
|
87
127
|
function themeToCSSVars(theme) {
|
|
88
128
|
const { color, font, ui, typography } = theme;
|
|
89
129
|
return {
|
|
@@ -97,10 +137,12 @@ function themeToCSSVars(theme) {
|
|
|
97
137
|
...colorRoleVars("secondary", color.secondary),
|
|
98
138
|
"--mw-color-secondary-border": color.secondary.border,
|
|
99
139
|
"--mw-color-secondary-border-disabled": color.secondary.borderDisabled,
|
|
100
|
-
// Surface / semantic neutrals (
|
|
140
|
+
// Surface / semantic neutrals (24)
|
|
101
141
|
"--mw-color-background": color.background,
|
|
102
142
|
"--mw-color-surface": color.surface,
|
|
143
|
+
"--mw-color-surface-primary": color.surfacePrimary,
|
|
103
144
|
"--mw-color-surface-subtle": color.surfaceSubtle,
|
|
145
|
+
"--mw-color-surface-brand": color.surfaceBrand,
|
|
104
146
|
"--mw-color-surface-elevated": color.surfaceElevated,
|
|
105
147
|
"--mw-color-surface-disabled": color.surfaceDisabled,
|
|
106
148
|
"--mw-color-surface-inverted": color.surfaceInverted,
|
|
@@ -109,11 +151,22 @@ function themeToCSSVars(theme) {
|
|
|
109
151
|
"--mw-color-text-subtle": color.textSubtle,
|
|
110
152
|
"--mw-color-text-disabled": color.textDisabled,
|
|
111
153
|
"--mw-color-text-inverted": color.textInverted,
|
|
154
|
+
"--mw-color-text-brand": color.textBrand,
|
|
155
|
+
"--mw-color-text-link": color.textLink,
|
|
156
|
+
"--mw-color-icon-muted": color.iconMuted,
|
|
157
|
+
"--mw-color-border-low": color.borderLow,
|
|
112
158
|
"--mw-color-border": color.border,
|
|
113
159
|
"--mw-color-border-subtle": color.borderSubtle,
|
|
114
160
|
"--mw-color-border-strong": color.borderStrong,
|
|
115
161
|
"--mw-color-border-disabled": color.borderDisabled,
|
|
162
|
+
"--mw-color-border-brand": color.borderBrand,
|
|
163
|
+
"--mw-color-border-full": color.borderFull,
|
|
116
164
|
"--mw-color-focus": color.focus,
|
|
165
|
+
// Status role tokens (4 × 5 + optional accessible warning border = 21)
|
|
166
|
+
...statusColorVars("success", color.status.success),
|
|
167
|
+
...statusColorVars("warning", color.status.warning),
|
|
168
|
+
...statusColorVars("error", color.status.error),
|
|
169
|
+
...statusColorVars("info", color.status.info),
|
|
117
170
|
// Font (3)
|
|
118
171
|
"--mw-font-primary": font.primary,
|
|
119
172
|
"--mw-font-secondary": font.secondary,
|
|
@@ -122,19 +175,17 @@ function themeToCSSVars(theme) {
|
|
|
122
175
|
"--mw-ui-radius": `${ui.radius}px`,
|
|
123
176
|
// Density (10)
|
|
124
177
|
...densityToCSSVars(ui.density),
|
|
125
|
-
// Typography
|
|
126
|
-
"--mw-typography-
|
|
127
|
-
"--mw-typography-h1
|
|
128
|
-
"--mw-typography-
|
|
129
|
-
"--mw-typography-
|
|
130
|
-
"
|
|
131
|
-
"
|
|
132
|
-
"
|
|
133
|
-
"
|
|
134
|
-
"
|
|
135
|
-
"
|
|
136
|
-
"--mw-typography-h3-font-weight": `${typography.h3.fontWeight}`,
|
|
137
|
-
"--mw-typography-h3-letter-spacing": `${typography.h3.letterSpacing}px`,
|
|
178
|
+
// Typography
|
|
179
|
+
...typographyStyleVars("--mw-typography-display", typography.display),
|
|
180
|
+
...typographyStyleVars("--mw-typography-h1", typography.h1),
|
|
181
|
+
...typographyStyleVars("--mw-typography-h2", typography.h2),
|
|
182
|
+
...typographyStyleVars("--mw-typography-h3", typography.h3),
|
|
183
|
+
...textTypographyStyleVars("display", typography.text.display),
|
|
184
|
+
...textTypographyStyleVars("label", typography.text.label),
|
|
185
|
+
...textTypographyStyleVars("label-small", typography.text["label-small"]),
|
|
186
|
+
...textTypographyStyleVars("caption", typography.text.caption),
|
|
187
|
+
...textTypographyStyleVars("overline", typography.text.overline),
|
|
188
|
+
...textTypographyStyleVars("micro", typography.text.micro),
|
|
138
189
|
// Typography — paragraph (3 × 2 = 6)
|
|
139
190
|
"--mw-typography-paragraph-sm-font-size": `${typography.paragraph.sm.fontSize}px`,
|
|
140
191
|
"--mw-typography-paragraph-sm-line-height": `${typography.paragraph.sm.lineHeight}`,
|
|
@@ -349,7 +400,9 @@ var lightThemeDefaults = {
|
|
|
349
400
|
// Background & Surface
|
|
350
401
|
background: "#FFFFFF",
|
|
351
402
|
surface: "#F8F8F8",
|
|
403
|
+
surfacePrimary: "#FFFFFF",
|
|
352
404
|
surfaceSubtle: "#F5F5F5",
|
|
405
|
+
surfaceBrand: "#EEEEFF",
|
|
353
406
|
surfaceElevated: "#FFFFFF",
|
|
354
407
|
surfaceDisabled: "#F5F5F5",
|
|
355
408
|
surfaceInverted: "#141414",
|
|
@@ -359,17 +412,54 @@ var lightThemeDefaults = {
|
|
|
359
412
|
textSubtle: "#737373",
|
|
360
413
|
textDisabled: "#737373",
|
|
361
414
|
textInverted: "#FFFFFF",
|
|
415
|
+
textBrand: "#2F31FC",
|
|
416
|
+
textLink: "#2527CA",
|
|
417
|
+
iconMuted: "#A3A3A3",
|
|
362
418
|
// Borders
|
|
419
|
+
borderLow: "#00000026",
|
|
363
420
|
border: "#D8D8D8",
|
|
364
421
|
borderSubtle: "#D8D8D8",
|
|
365
422
|
borderStrong: "#A3A3A3",
|
|
366
423
|
borderDisabled: "#D8D8D8",
|
|
424
|
+
borderBrand: "#2F31FC",
|
|
425
|
+
borderFull: "#000000",
|
|
367
426
|
// Focus
|
|
368
427
|
focus: "#2F31FC",
|
|
369
428
|
// Semantic colors
|
|
370
429
|
danger: "#D90429",
|
|
371
430
|
success: "#006633",
|
|
372
|
-
warning: "#B45309"
|
|
431
|
+
warning: "#B45309",
|
|
432
|
+
status: {
|
|
433
|
+
success: {
|
|
434
|
+
background: "#E6F4ED",
|
|
435
|
+
text: "#006633",
|
|
436
|
+
icon: "#006D48",
|
|
437
|
+
border: "#90CAAD",
|
|
438
|
+
borderStrong: "#2E9970"
|
|
439
|
+
},
|
|
440
|
+
warning: {
|
|
441
|
+
background: "#FFF8E6",
|
|
442
|
+
text: "#B45309",
|
|
443
|
+
icon: "#D97706",
|
|
444
|
+
border: "#FDE08A",
|
|
445
|
+
borderAccessible: "#B45309",
|
|
446
|
+
borderStrong: "#E46F00"
|
|
447
|
+
},
|
|
448
|
+
error: {
|
|
449
|
+
background: "#FFE8EB",
|
|
450
|
+
text: "#A8031F",
|
|
451
|
+
icon: "#D90429",
|
|
452
|
+
border: "#FF8A95",
|
|
453
|
+
borderStrong: "#FF2847"
|
|
454
|
+
},
|
|
455
|
+
info: {
|
|
456
|
+
background: "#EEEEFF",
|
|
457
|
+
text: "#1B1D97",
|
|
458
|
+
icon: "#2F31FC",
|
|
459
|
+
border: "#ABABFD",
|
|
460
|
+
borderStrong: "#5859FC"
|
|
461
|
+
}
|
|
462
|
+
}
|
|
373
463
|
},
|
|
374
464
|
font: {
|
|
375
465
|
primary: "'Instrument Sans', Inter, system-ui, sans-serif",
|
|
@@ -380,7 +470,14 @@ var lightThemeDefaults = {
|
|
|
380
470
|
radius: 4,
|
|
381
471
|
density: "comfortable"
|
|
382
472
|
},
|
|
473
|
+
breakpoint: defaultThemeBreakpoints,
|
|
383
474
|
typography: {
|
|
475
|
+
display: {
|
|
476
|
+
fontSize: 44,
|
|
477
|
+
lineHeight: 1.1818181818,
|
|
478
|
+
fontWeight: 700,
|
|
479
|
+
letterSpacing: -1.32
|
|
480
|
+
},
|
|
384
481
|
h1: {
|
|
385
482
|
fontSize: 32,
|
|
386
483
|
lineHeight: 1.1875,
|
|
@@ -399,6 +496,45 @@ var lightThemeDefaults = {
|
|
|
399
496
|
fontWeight: 500,
|
|
400
497
|
letterSpacing: -0.6
|
|
401
498
|
},
|
|
499
|
+
text: {
|
|
500
|
+
display: {
|
|
501
|
+
fontSize: 44,
|
|
502
|
+
lineHeight: 1.1818181818,
|
|
503
|
+
fontWeight: 700,
|
|
504
|
+
letterSpacing: -1.32
|
|
505
|
+
},
|
|
506
|
+
label: {
|
|
507
|
+
fontSize: 14,
|
|
508
|
+
lineHeight: 1.1428571429,
|
|
509
|
+
fontWeight: 500,
|
|
510
|
+
letterSpacing: -0.42
|
|
511
|
+
},
|
|
512
|
+
"label-small": {
|
|
513
|
+
fontSize: 12,
|
|
514
|
+
lineHeight: 1,
|
|
515
|
+
fontWeight: 500,
|
|
516
|
+
letterSpacing: -0.36
|
|
517
|
+
},
|
|
518
|
+
caption: {
|
|
519
|
+
fontSize: 12,
|
|
520
|
+
lineHeight: 1.3333333333,
|
|
521
|
+
fontWeight: 500,
|
|
522
|
+
letterSpacing: 0
|
|
523
|
+
},
|
|
524
|
+
overline: {
|
|
525
|
+
fontSize: 11,
|
|
526
|
+
lineHeight: 1.4545454545,
|
|
527
|
+
fontWeight: 500,
|
|
528
|
+
letterSpacing: 0.88,
|
|
529
|
+
textTransform: "uppercase"
|
|
530
|
+
},
|
|
531
|
+
micro: {
|
|
532
|
+
fontSize: 11,
|
|
533
|
+
lineHeight: 1.2727272727,
|
|
534
|
+
fontWeight: 400,
|
|
535
|
+
letterSpacing: -0.33
|
|
536
|
+
}
|
|
537
|
+
},
|
|
402
538
|
paragraph: {
|
|
403
539
|
sm: {
|
|
404
540
|
fontSize: 14,
|
|
@@ -423,7 +559,9 @@ var darkThemeDefaults = {
|
|
|
423
559
|
// Background & Surface
|
|
424
560
|
background: "#0F0F0F",
|
|
425
561
|
surface: "#1A1A1A",
|
|
562
|
+
surfacePrimary: "#0F0F0F",
|
|
426
563
|
surfaceSubtle: "#050505",
|
|
564
|
+
surfaceBrand: "#090A32",
|
|
427
565
|
surfaceElevated: "#2B2B2B",
|
|
428
566
|
surfaceDisabled: "#1A1A1A",
|
|
429
567
|
surfaceInverted: "#FFFFFF",
|
|
@@ -433,17 +571,54 @@ var darkThemeDefaults = {
|
|
|
433
571
|
textSubtle: "#595959",
|
|
434
572
|
textDisabled: "#595959",
|
|
435
573
|
textInverted: "#141414",
|
|
574
|
+
textBrand: "#8182FC",
|
|
575
|
+
textLink: "#8182FC",
|
|
576
|
+
iconMuted: "#595959",
|
|
436
577
|
// Borders
|
|
578
|
+
borderLow: "#FFFFFF26",
|
|
437
579
|
border: "#474747",
|
|
438
580
|
borderSubtle: "#474747",
|
|
439
581
|
borderStrong: "#A3A3A3",
|
|
440
582
|
borderDisabled: "#474747",
|
|
583
|
+
borderBrand: "#5859FC",
|
|
584
|
+
borderFull: "#FFFFFF",
|
|
441
585
|
// Focus
|
|
442
586
|
focus: "#8182FC",
|
|
443
587
|
// Semantic colors
|
|
444
588
|
danger: "#FF002C",
|
|
445
589
|
success: "#90CAAD",
|
|
446
|
-
warning: "#FCC94A"
|
|
590
|
+
warning: "#FCC94A",
|
|
591
|
+
status: {
|
|
592
|
+
success: {
|
|
593
|
+
background: "#001A0C",
|
|
594
|
+
text: "#90CAAD",
|
|
595
|
+
icon: "#5DB189",
|
|
596
|
+
border: "#5DB189",
|
|
597
|
+
borderStrong: "#006D48"
|
|
598
|
+
},
|
|
599
|
+
warning: {
|
|
600
|
+
background: "#221004",
|
|
601
|
+
text: "#FCC94A",
|
|
602
|
+
icon: "#F9B21A",
|
|
603
|
+
border: "#E46F00",
|
|
604
|
+
borderAccessible: "#B45309",
|
|
605
|
+
borderStrong: "#B45308"
|
|
606
|
+
},
|
|
607
|
+
error: {
|
|
608
|
+
background: "#240006",
|
|
609
|
+
text: "#FF5566",
|
|
610
|
+
icon: "#FF2847",
|
|
611
|
+
border: "#FF2847",
|
|
612
|
+
borderStrong: "#FF2847"
|
|
613
|
+
},
|
|
614
|
+
info: {
|
|
615
|
+
background: "#040519",
|
|
616
|
+
text: "#ABABFD",
|
|
617
|
+
icon: "#8182FC",
|
|
618
|
+
border: "#8182FC",
|
|
619
|
+
borderStrong: "#252599"
|
|
620
|
+
}
|
|
621
|
+
}
|
|
447
622
|
},
|
|
448
623
|
font: {
|
|
449
624
|
primary: "'Instrument Sans', Inter, system-ui, sans-serif",
|
|
@@ -454,7 +629,14 @@ var darkThemeDefaults = {
|
|
|
454
629
|
radius: 4,
|
|
455
630
|
density: "comfortable"
|
|
456
631
|
},
|
|
632
|
+
breakpoint: defaultThemeBreakpoints,
|
|
457
633
|
typography: {
|
|
634
|
+
display: {
|
|
635
|
+
fontSize: 44,
|
|
636
|
+
lineHeight: 1.1818181818,
|
|
637
|
+
fontWeight: 700,
|
|
638
|
+
letterSpacing: -1.32
|
|
639
|
+
},
|
|
458
640
|
h1: {
|
|
459
641
|
fontSize: 32,
|
|
460
642
|
lineHeight: 1.1875,
|
|
@@ -473,6 +655,45 @@ var darkThemeDefaults = {
|
|
|
473
655
|
fontWeight: 500,
|
|
474
656
|
letterSpacing: -0.6
|
|
475
657
|
},
|
|
658
|
+
text: {
|
|
659
|
+
display: {
|
|
660
|
+
fontSize: 44,
|
|
661
|
+
lineHeight: 1.1818181818,
|
|
662
|
+
fontWeight: 700,
|
|
663
|
+
letterSpacing: -1.32
|
|
664
|
+
},
|
|
665
|
+
label: {
|
|
666
|
+
fontSize: 14,
|
|
667
|
+
lineHeight: 1.1428571429,
|
|
668
|
+
fontWeight: 500,
|
|
669
|
+
letterSpacing: -0.42
|
|
670
|
+
},
|
|
671
|
+
"label-small": {
|
|
672
|
+
fontSize: 12,
|
|
673
|
+
lineHeight: 1,
|
|
674
|
+
fontWeight: 500,
|
|
675
|
+
letterSpacing: -0.36
|
|
676
|
+
},
|
|
677
|
+
caption: {
|
|
678
|
+
fontSize: 12,
|
|
679
|
+
lineHeight: 1.3333333333,
|
|
680
|
+
fontWeight: 500,
|
|
681
|
+
letterSpacing: 0
|
|
682
|
+
},
|
|
683
|
+
overline: {
|
|
684
|
+
fontSize: 11,
|
|
685
|
+
lineHeight: 1.4545454545,
|
|
686
|
+
fontWeight: 500,
|
|
687
|
+
letterSpacing: 0.88,
|
|
688
|
+
textTransform: "uppercase"
|
|
689
|
+
},
|
|
690
|
+
micro: {
|
|
691
|
+
fontSize: 11,
|
|
692
|
+
lineHeight: 1.2727272727,
|
|
693
|
+
fontWeight: 400,
|
|
694
|
+
letterSpacing: -0.33
|
|
695
|
+
}
|
|
696
|
+
},
|
|
476
697
|
paragraph: {
|
|
477
698
|
sm: {
|
|
478
699
|
fontSize: 14,
|
|
@@ -625,6 +846,7 @@ var darkDefaultColorRoles = {
|
|
|
625
846
|
};
|
|
626
847
|
function resolveThemeInput(input) {
|
|
627
848
|
const mode = input.mode ?? ThemeMode.light;
|
|
849
|
+
const personality = input.personality ?? "flat";
|
|
628
850
|
const colorBase = mode === ThemeMode.dark ? darkThemeDefaults.color : lightThemeDefaults.color;
|
|
629
851
|
const defaultColorRoles = mode === ThemeMode.dark ? darkDefaultColorRoles : lightDefaultColorRoles;
|
|
630
852
|
const base = lightThemeDefaults;
|
|
@@ -637,6 +859,7 @@ function resolveThemeInput(input) {
|
|
|
637
859
|
const info = input.color?.primary === void 0 ? normalizeColorInput(defaultColorRoles.info) : resolveInfoRole(primary);
|
|
638
860
|
return {
|
|
639
861
|
mode,
|
|
862
|
+
personality,
|
|
640
863
|
color: {
|
|
641
864
|
primary,
|
|
642
865
|
secondary,
|
|
@@ -646,7 +869,9 @@ function resolveThemeInput(input) {
|
|
|
646
869
|
info,
|
|
647
870
|
background: input.color?.background ?? colorBase.background,
|
|
648
871
|
surface: input.color?.surface ?? colorBase.surface,
|
|
872
|
+
surfacePrimary: input.color?.surfacePrimary ?? colorBase.surfacePrimary,
|
|
649
873
|
surfaceSubtle: input.color?.surfaceSubtle ?? colorBase.surfaceSubtle,
|
|
874
|
+
surfaceBrand: input.color?.surfaceBrand ?? colorBase.surfaceBrand,
|
|
650
875
|
surfaceElevated: input.color?.surfaceElevated ?? colorBase.surfaceElevated,
|
|
651
876
|
surfaceDisabled: input.color?.surfaceDisabled ?? colorBase.surfaceDisabled,
|
|
652
877
|
surfaceInverted: input.color?.surfaceInverted ?? colorBase.surfaceInverted,
|
|
@@ -655,18 +880,63 @@ function resolveThemeInput(input) {
|
|
|
655
880
|
textSubtle: input.color?.textSubtle ?? colorBase.textSubtle,
|
|
656
881
|
textDisabled: input.color?.textDisabled ?? colorBase.textDisabled,
|
|
657
882
|
textInverted: input.color?.textInverted ?? colorBase.textInverted,
|
|
883
|
+
textBrand: colorBase.textBrand,
|
|
884
|
+
textLink: input.color?.textLink ?? colorBase.textLink,
|
|
885
|
+
iconMuted: input.color?.iconMuted ?? colorBase.iconMuted,
|
|
886
|
+
borderLow: input.color?.borderLow ?? colorBase.borderLow,
|
|
658
887
|
border: input.color?.border ?? colorBase.border,
|
|
659
888
|
borderSubtle: input.color?.borderSubtle ?? colorBase.borderSubtle,
|
|
660
889
|
borderStrong: input.color?.borderStrong ?? colorBase.borderStrong,
|
|
661
890
|
borderDisabled: input.color?.borderDisabled ?? colorBase.borderDisabled,
|
|
662
|
-
|
|
891
|
+
borderBrand: colorBase.borderBrand,
|
|
892
|
+
borderFull: input.color?.borderFull ?? colorBase.borderFull,
|
|
893
|
+
focus: input.color?.focus ?? colorBase.focus,
|
|
894
|
+
status: colorBase.status
|
|
663
895
|
},
|
|
664
896
|
font: { ...base.font, ...tone.font, ...input.font },
|
|
665
897
|
ui: { ...base.ui, ...tone.ui, ...input.ui },
|
|
898
|
+
breakpoint: { ...defaultThemeBreakpoints, ...input.breakpoint },
|
|
666
899
|
typography: {
|
|
900
|
+
display: {
|
|
901
|
+
...base.typography.display,
|
|
902
|
+
...tone.typography?.display,
|
|
903
|
+
...input.typography?.display
|
|
904
|
+
},
|
|
667
905
|
h1: { ...base.typography.h1, ...tone.typography?.h1, ...input.typography?.h1 },
|
|
668
906
|
h2: { ...base.typography.h2, ...tone.typography?.h2, ...input.typography?.h2 },
|
|
669
907
|
h3: { ...base.typography.h3, ...tone.typography?.h3, ...input.typography?.h3 },
|
|
908
|
+
text: {
|
|
909
|
+
display: {
|
|
910
|
+
...base.typography.text.display,
|
|
911
|
+
...tone.typography?.text?.display,
|
|
912
|
+
...input.typography?.text?.display
|
|
913
|
+
},
|
|
914
|
+
label: {
|
|
915
|
+
...base.typography.text.label,
|
|
916
|
+
...tone.typography?.text?.label,
|
|
917
|
+
...input.typography?.text?.label
|
|
918
|
+
},
|
|
919
|
+
"label-small": {
|
|
920
|
+
...base.typography.text["label-small"],
|
|
921
|
+
...tone.typography?.text?.["label-small"],
|
|
922
|
+
...input.typography?.text?.["label-small"]
|
|
923
|
+
},
|
|
924
|
+
caption: {
|
|
925
|
+
...base.typography.text.caption,
|
|
926
|
+
...tone.typography?.text?.caption,
|
|
927
|
+
...input.typography?.text?.caption
|
|
928
|
+
},
|
|
929
|
+
overline: {
|
|
930
|
+
...base.typography.text.overline,
|
|
931
|
+
...tone.typography?.text?.overline,
|
|
932
|
+
...input.typography?.text?.overline
|
|
933
|
+
},
|
|
934
|
+
micro: {
|
|
935
|
+
...base.typography.text.micro,
|
|
936
|
+
...tone.typography?.text?.micro,
|
|
937
|
+
...input.typography?.text?.micro
|
|
938
|
+
}
|
|
939
|
+
},
|
|
670
940
|
paragraph: {
|
|
671
941
|
sm: {
|
|
672
942
|
...base.typography.paragraph.sm,
|
|
@@ -739,6 +1009,21 @@ function serializeScriptData(value) {
|
|
|
739
1009
|
function mwVar(name, fallback) {
|
|
740
1010
|
return fallback === void 0 ? `var(${name})` : `var(${name}, ${fallback})`;
|
|
741
1011
|
}
|
|
1012
|
+
function createMwThemeMedia(breakpoint) {
|
|
1013
|
+
return {
|
|
1014
|
+
mobileAndAbove: `@media (min-width: ${breakpoint.mobile}px)`,
|
|
1015
|
+
tabletAndAbove: `@media (min-width: ${breakpoint.tablet}px)`,
|
|
1016
|
+
desktopAndAbove: `@media (min-width: ${breakpoint.desktop}px)`,
|
|
1017
|
+
wideDesktopAndAbove: `@media (min-width: ${breakpoint.wideDesktop}px)`,
|
|
1018
|
+
mobileAndBelow: `@media (max-width: ${formatMaxBreakpoint(breakpoint.mobile)}px)`,
|
|
1019
|
+
tabletAndBelow: `@media (max-width: ${formatMaxBreakpoint(breakpoint.tablet)}px)`,
|
|
1020
|
+
desktopAndBelow: `@media (max-width: ${formatMaxBreakpoint(breakpoint.desktop)}px)`,
|
|
1021
|
+
wideDesktopAndBelow: `@media (max-width: ${formatMaxBreakpoint(breakpoint.wideDesktop)}px)`
|
|
1022
|
+
};
|
|
1023
|
+
}
|
|
1024
|
+
function formatMaxBreakpoint(value) {
|
|
1025
|
+
return `${Number((value - 0.02).toFixed(2))}`;
|
|
1026
|
+
}
|
|
742
1027
|
var mwThemeVarNames = {
|
|
743
1028
|
color: {
|
|
744
1029
|
primary: {
|
|
@@ -793,7 +1078,9 @@ var mwThemeVarNames = {
|
|
|
793
1078
|
},
|
|
794
1079
|
background: "--mw-color-background",
|
|
795
1080
|
surface: "--mw-color-surface",
|
|
1081
|
+
surfacePrimary: "--mw-color-surface-primary",
|
|
796
1082
|
surfaceSubtle: "--mw-color-surface-subtle",
|
|
1083
|
+
surfaceBrand: "--mw-color-surface-brand",
|
|
797
1084
|
surfaceElevated: "--mw-color-surface-elevated",
|
|
798
1085
|
surfaceDisabled: "--mw-color-surface-disabled",
|
|
799
1086
|
surfaceInverted: "--mw-color-surface-inverted",
|
|
@@ -802,17 +1089,55 @@ var mwThemeVarNames = {
|
|
|
802
1089
|
textSubtle: "--mw-color-text-subtle",
|
|
803
1090
|
textDisabled: "--mw-color-text-disabled",
|
|
804
1091
|
textInverted: "--mw-color-text-inverted",
|
|
1092
|
+
textBrand: "--mw-color-text-brand",
|
|
1093
|
+
textLink: "--mw-color-text-link",
|
|
1094
|
+
iconMuted: "--mw-color-icon-muted",
|
|
1095
|
+
borderLow: "--mw-color-border-low",
|
|
805
1096
|
border: "--mw-color-border",
|
|
806
1097
|
borderSubtle: "--mw-color-border-subtle",
|
|
807
1098
|
borderStrong: "--mw-color-border-strong",
|
|
808
1099
|
borderDisabled: "--mw-color-border-disabled",
|
|
809
|
-
|
|
1100
|
+
borderBrand: "--mw-color-border-brand",
|
|
1101
|
+
borderFull: "--mw-color-border-full",
|
|
1102
|
+
focus: "--mw-color-focus",
|
|
1103
|
+
status: {
|
|
1104
|
+
success: {
|
|
1105
|
+
background: "--mw-color-status-success-background",
|
|
1106
|
+
text: "--mw-color-status-success-text",
|
|
1107
|
+
icon: "--mw-color-status-success-icon",
|
|
1108
|
+
border: "--mw-color-status-success-border",
|
|
1109
|
+
borderStrong: "--mw-color-status-success-border-strong"
|
|
1110
|
+
},
|
|
1111
|
+
warning: {
|
|
1112
|
+
background: "--mw-color-status-warning-background",
|
|
1113
|
+
text: "--mw-color-status-warning-text",
|
|
1114
|
+
icon: "--mw-color-status-warning-icon",
|
|
1115
|
+
border: "--mw-color-status-warning-border",
|
|
1116
|
+
borderAccessible: "--mw-color-status-warning-border-accessible",
|
|
1117
|
+
borderStrong: "--mw-color-status-warning-border-strong"
|
|
1118
|
+
},
|
|
1119
|
+
error: {
|
|
1120
|
+
background: "--mw-color-status-error-background",
|
|
1121
|
+
text: "--mw-color-status-error-text",
|
|
1122
|
+
icon: "--mw-color-status-error-icon",
|
|
1123
|
+
border: "--mw-color-status-error-border",
|
|
1124
|
+
borderStrong: "--mw-color-status-error-border-strong"
|
|
1125
|
+
},
|
|
1126
|
+
info: {
|
|
1127
|
+
background: "--mw-color-status-info-background",
|
|
1128
|
+
text: "--mw-color-status-info-text",
|
|
1129
|
+
icon: "--mw-color-status-info-icon",
|
|
1130
|
+
border: "--mw-color-status-info-border",
|
|
1131
|
+
borderStrong: "--mw-color-status-info-border-strong"
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
810
1134
|
},
|
|
811
1135
|
spacing: {
|
|
812
1136
|
sp0: "--mw-spacing-sp-0",
|
|
813
1137
|
sp2: "--mw-spacing-sp-2",
|
|
814
1138
|
sp4: "--mw-spacing-sp-4",
|
|
815
1139
|
sp8: "--mw-spacing-sp-8",
|
|
1140
|
+
sp12: "--mw-spacing-sp-12",
|
|
816
1141
|
sp16: "--mw-spacing-sp-16",
|
|
817
1142
|
sp24: "--mw-spacing-sp-24",
|
|
818
1143
|
sp32: "--mw-spacing-sp-32",
|
|
@@ -849,6 +1174,12 @@ var mwThemeVarNames = {
|
|
|
849
1174
|
fontSizeSm: "--mw-density-font-size-sm"
|
|
850
1175
|
},
|
|
851
1176
|
typography: {
|
|
1177
|
+
display: {
|
|
1178
|
+
fontSize: "--mw-typography-display-font-size",
|
|
1179
|
+
lineHeight: "--mw-typography-display-line-height",
|
|
1180
|
+
fontWeight: "--mw-typography-display-font-weight",
|
|
1181
|
+
letterSpacing: "--mw-typography-display-letter-spacing"
|
|
1182
|
+
},
|
|
852
1183
|
h1: {
|
|
853
1184
|
fontSize: "--mw-typography-h1-font-size",
|
|
854
1185
|
lineHeight: "--mw-typography-h1-line-height",
|
|
@@ -867,6 +1198,50 @@ var mwThemeVarNames = {
|
|
|
867
1198
|
fontWeight: "--mw-typography-h3-font-weight",
|
|
868
1199
|
letterSpacing: "--mw-typography-h3-letter-spacing"
|
|
869
1200
|
},
|
|
1201
|
+
text: {
|
|
1202
|
+
display: {
|
|
1203
|
+
fontSize: "--mw-typography-text-display-font-size",
|
|
1204
|
+
lineHeight: "--mw-typography-text-display-line-height",
|
|
1205
|
+
fontWeight: "--mw-typography-text-display-font-weight",
|
|
1206
|
+
letterSpacing: "--mw-typography-text-display-letter-spacing",
|
|
1207
|
+
textTransform: "--mw-typography-text-display-transform"
|
|
1208
|
+
},
|
|
1209
|
+
label: {
|
|
1210
|
+
fontSize: "--mw-typography-text-label-font-size",
|
|
1211
|
+
lineHeight: "--mw-typography-text-label-line-height",
|
|
1212
|
+
fontWeight: "--mw-typography-text-label-font-weight",
|
|
1213
|
+
letterSpacing: "--mw-typography-text-label-letter-spacing",
|
|
1214
|
+
textTransform: "--mw-typography-text-label-transform"
|
|
1215
|
+
},
|
|
1216
|
+
"label-small": {
|
|
1217
|
+
fontSize: "--mw-typography-text-label-small-font-size",
|
|
1218
|
+
lineHeight: "--mw-typography-text-label-small-line-height",
|
|
1219
|
+
fontWeight: "--mw-typography-text-label-small-font-weight",
|
|
1220
|
+
letterSpacing: "--mw-typography-text-label-small-letter-spacing",
|
|
1221
|
+
textTransform: "--mw-typography-text-label-small-transform"
|
|
1222
|
+
},
|
|
1223
|
+
caption: {
|
|
1224
|
+
fontSize: "--mw-typography-text-caption-font-size",
|
|
1225
|
+
lineHeight: "--mw-typography-text-caption-line-height",
|
|
1226
|
+
fontWeight: "--mw-typography-text-caption-font-weight",
|
|
1227
|
+
letterSpacing: "--mw-typography-text-caption-letter-spacing",
|
|
1228
|
+
textTransform: "--mw-typography-text-caption-transform"
|
|
1229
|
+
},
|
|
1230
|
+
overline: {
|
|
1231
|
+
fontSize: "--mw-typography-text-overline-font-size",
|
|
1232
|
+
lineHeight: "--mw-typography-text-overline-line-height",
|
|
1233
|
+
fontWeight: "--mw-typography-text-overline-font-weight",
|
|
1234
|
+
letterSpacing: "--mw-typography-text-overline-letter-spacing",
|
|
1235
|
+
textTransform: "--mw-typography-text-overline-transform"
|
|
1236
|
+
},
|
|
1237
|
+
micro: {
|
|
1238
|
+
fontSize: "--mw-typography-text-micro-font-size",
|
|
1239
|
+
lineHeight: "--mw-typography-text-micro-line-height",
|
|
1240
|
+
fontWeight: "--mw-typography-text-micro-font-weight",
|
|
1241
|
+
letterSpacing: "--mw-typography-text-micro-letter-spacing",
|
|
1242
|
+
textTransform: "--mw-typography-text-micro-transform"
|
|
1243
|
+
}
|
|
1244
|
+
},
|
|
870
1245
|
paragraph: {
|
|
871
1246
|
sm: {
|
|
872
1247
|
fontSize: "--mw-typography-paragraph-sm-font-size",
|
|
@@ -937,7 +1312,9 @@ var mwThemeVars = {
|
|
|
937
1312
|
},
|
|
938
1313
|
background: "var(--mw-color-background)",
|
|
939
1314
|
surface: "var(--mw-color-surface)",
|
|
1315
|
+
surfacePrimary: "var(--mw-color-surface-primary)",
|
|
940
1316
|
surfaceSubtle: "var(--mw-color-surface-subtle)",
|
|
1317
|
+
surfaceBrand: "var(--mw-color-surface-brand)",
|
|
941
1318
|
surfaceElevated: "var(--mw-color-surface-elevated)",
|
|
942
1319
|
surfaceDisabled: "var(--mw-color-surface-disabled)",
|
|
943
1320
|
surfaceInverted: "var(--mw-color-surface-inverted)",
|
|
@@ -946,17 +1323,55 @@ var mwThemeVars = {
|
|
|
946
1323
|
textSubtle: "var(--mw-color-text-subtle)",
|
|
947
1324
|
textDisabled: "var(--mw-color-text-disabled)",
|
|
948
1325
|
textInverted: "var(--mw-color-text-inverted)",
|
|
1326
|
+
textBrand: "var(--mw-color-text-brand)",
|
|
1327
|
+
textLink: "var(--mw-color-text-link)",
|
|
1328
|
+
iconMuted: "var(--mw-color-icon-muted)",
|
|
1329
|
+
borderLow: "var(--mw-color-border-low)",
|
|
949
1330
|
border: "var(--mw-color-border)",
|
|
950
1331
|
borderSubtle: "var(--mw-color-border-subtle)",
|
|
951
1332
|
borderStrong: "var(--mw-color-border-strong)",
|
|
952
1333
|
borderDisabled: "var(--mw-color-border-disabled)",
|
|
953
|
-
|
|
1334
|
+
borderBrand: "var(--mw-color-border-brand)",
|
|
1335
|
+
borderFull: "var(--mw-color-border-full)",
|
|
1336
|
+
focus: "var(--mw-color-focus)",
|
|
1337
|
+
status: {
|
|
1338
|
+
success: {
|
|
1339
|
+
background: "var(--mw-color-status-success-background)",
|
|
1340
|
+
text: "var(--mw-color-status-success-text)",
|
|
1341
|
+
icon: "var(--mw-color-status-success-icon)",
|
|
1342
|
+
border: "var(--mw-color-status-success-border)",
|
|
1343
|
+
borderStrong: "var(--mw-color-status-success-border-strong)"
|
|
1344
|
+
},
|
|
1345
|
+
warning: {
|
|
1346
|
+
background: "var(--mw-color-status-warning-background)",
|
|
1347
|
+
text: "var(--mw-color-status-warning-text)",
|
|
1348
|
+
icon: "var(--mw-color-status-warning-icon)",
|
|
1349
|
+
border: "var(--mw-color-status-warning-border)",
|
|
1350
|
+
borderAccessible: "var(--mw-color-status-warning-border-accessible)",
|
|
1351
|
+
borderStrong: "var(--mw-color-status-warning-border-strong)"
|
|
1352
|
+
},
|
|
1353
|
+
error: {
|
|
1354
|
+
background: "var(--mw-color-status-error-background)",
|
|
1355
|
+
text: "var(--mw-color-status-error-text)",
|
|
1356
|
+
icon: "var(--mw-color-status-error-icon)",
|
|
1357
|
+
border: "var(--mw-color-status-error-border)",
|
|
1358
|
+
borderStrong: "var(--mw-color-status-error-border-strong)"
|
|
1359
|
+
},
|
|
1360
|
+
info: {
|
|
1361
|
+
background: "var(--mw-color-status-info-background)",
|
|
1362
|
+
text: "var(--mw-color-status-info-text)",
|
|
1363
|
+
icon: "var(--mw-color-status-info-icon)",
|
|
1364
|
+
border: "var(--mw-color-status-info-border)",
|
|
1365
|
+
borderStrong: "var(--mw-color-status-info-border-strong)"
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
954
1368
|
},
|
|
955
1369
|
spacing: {
|
|
956
1370
|
sp0: "var(--mw-spacing-sp-0)",
|
|
957
1371
|
sp2: "var(--mw-spacing-sp-2)",
|
|
958
1372
|
sp4: "var(--mw-spacing-sp-4)",
|
|
959
1373
|
sp8: "var(--mw-spacing-sp-8)",
|
|
1374
|
+
sp12: "var(--mw-spacing-sp-12)",
|
|
960
1375
|
sp16: "var(--mw-spacing-sp-16)",
|
|
961
1376
|
sp24: "var(--mw-spacing-sp-24)",
|
|
962
1377
|
sp32: "var(--mw-spacing-sp-32)",
|
|
@@ -993,6 +1408,12 @@ var mwThemeVars = {
|
|
|
993
1408
|
fontSizeSm: "var(--mw-density-font-size-sm)"
|
|
994
1409
|
},
|
|
995
1410
|
typography: {
|
|
1411
|
+
display: {
|
|
1412
|
+
fontSize: "var(--mw-typography-display-font-size)",
|
|
1413
|
+
lineHeight: "var(--mw-typography-display-line-height)",
|
|
1414
|
+
fontWeight: "var(--mw-typography-display-font-weight)",
|
|
1415
|
+
letterSpacing: "var(--mw-typography-display-letter-spacing)"
|
|
1416
|
+
},
|
|
996
1417
|
h1: {
|
|
997
1418
|
fontSize: "var(--mw-typography-h1-font-size)",
|
|
998
1419
|
lineHeight: "var(--mw-typography-h1-line-height)",
|
|
@@ -1011,6 +1432,50 @@ var mwThemeVars = {
|
|
|
1011
1432
|
fontWeight: "var(--mw-typography-h3-font-weight)",
|
|
1012
1433
|
letterSpacing: "var(--mw-typography-h3-letter-spacing)"
|
|
1013
1434
|
},
|
|
1435
|
+
text: {
|
|
1436
|
+
display: {
|
|
1437
|
+
fontSize: "var(--mw-typography-text-display-font-size)",
|
|
1438
|
+
lineHeight: "var(--mw-typography-text-display-line-height)",
|
|
1439
|
+
fontWeight: "var(--mw-typography-text-display-font-weight)",
|
|
1440
|
+
letterSpacing: "var(--mw-typography-text-display-letter-spacing)",
|
|
1441
|
+
textTransform: "var(--mw-typography-text-display-transform)"
|
|
1442
|
+
},
|
|
1443
|
+
label: {
|
|
1444
|
+
fontSize: "var(--mw-typography-text-label-font-size)",
|
|
1445
|
+
lineHeight: "var(--mw-typography-text-label-line-height)",
|
|
1446
|
+
fontWeight: "var(--mw-typography-text-label-font-weight)",
|
|
1447
|
+
letterSpacing: "var(--mw-typography-text-label-letter-spacing)",
|
|
1448
|
+
textTransform: "var(--mw-typography-text-label-transform)"
|
|
1449
|
+
},
|
|
1450
|
+
"label-small": {
|
|
1451
|
+
fontSize: "var(--mw-typography-text-label-small-font-size)",
|
|
1452
|
+
lineHeight: "var(--mw-typography-text-label-small-line-height)",
|
|
1453
|
+
fontWeight: "var(--mw-typography-text-label-small-font-weight)",
|
|
1454
|
+
letterSpacing: "var(--mw-typography-text-label-small-letter-spacing)",
|
|
1455
|
+
textTransform: "var(--mw-typography-text-label-small-transform)"
|
|
1456
|
+
},
|
|
1457
|
+
caption: {
|
|
1458
|
+
fontSize: "var(--mw-typography-text-caption-font-size)",
|
|
1459
|
+
lineHeight: "var(--mw-typography-text-caption-line-height)",
|
|
1460
|
+
fontWeight: "var(--mw-typography-text-caption-font-weight)",
|
|
1461
|
+
letterSpacing: "var(--mw-typography-text-caption-letter-spacing)",
|
|
1462
|
+
textTransform: "var(--mw-typography-text-caption-transform)"
|
|
1463
|
+
},
|
|
1464
|
+
overline: {
|
|
1465
|
+
fontSize: "var(--mw-typography-text-overline-font-size)",
|
|
1466
|
+
lineHeight: "var(--mw-typography-text-overline-line-height)",
|
|
1467
|
+
fontWeight: "var(--mw-typography-text-overline-font-weight)",
|
|
1468
|
+
letterSpacing: "var(--mw-typography-text-overline-letter-spacing)",
|
|
1469
|
+
textTransform: "var(--mw-typography-text-overline-transform)"
|
|
1470
|
+
},
|
|
1471
|
+
micro: {
|
|
1472
|
+
fontSize: "var(--mw-typography-text-micro-font-size)",
|
|
1473
|
+
lineHeight: "var(--mw-typography-text-micro-line-height)",
|
|
1474
|
+
fontWeight: "var(--mw-typography-text-micro-font-weight)",
|
|
1475
|
+
letterSpacing: "var(--mw-typography-text-micro-letter-spacing)",
|
|
1476
|
+
textTransform: "var(--mw-typography-text-micro-transform)"
|
|
1477
|
+
}
|
|
1478
|
+
},
|
|
1014
1479
|
paragraph: {
|
|
1015
1480
|
sm: {
|
|
1016
1481
|
fontSize: "var(--mw-typography-paragraph-sm-font-size)",
|
|
@@ -1027,7 +1492,19 @@ var mwThemeVars = {
|
|
|
1027
1492
|
}
|
|
1028
1493
|
}
|
|
1029
1494
|
};
|
|
1030
|
-
|
|
1495
|
+
function createMwTheme(theme) {
|
|
1496
|
+
return {
|
|
1497
|
+
...mwThemeVars,
|
|
1498
|
+
breakpoint: theme.breakpoint,
|
|
1499
|
+
media: createMwThemeMedia(theme.breakpoint)
|
|
1500
|
+
};
|
|
1501
|
+
}
|
|
1502
|
+
var mwTheme = {
|
|
1503
|
+
...mwThemeVars,
|
|
1504
|
+
breakpoint: defaultThemeBreakpoints,
|
|
1505
|
+
media: createMwThemeMedia(defaultThemeBreakpoints)
|
|
1506
|
+
};
|
|
1507
|
+
var mwStyledTheme = mwTheme;
|
|
1031
1508
|
|
|
1032
1509
|
// src/theme/font-loader.ts
|
|
1033
1510
|
var mwFontFallbacks = {
|
|
@@ -1144,9 +1621,13 @@ function shouldLoadGoogleFont(name, config = "auto") {
|
|
|
1144
1621
|
}
|
|
1145
1622
|
function extractUsedWeights(typography) {
|
|
1146
1623
|
const weights = /* @__PURE__ */ new Set([400, 500]);
|
|
1624
|
+
if (typography.display) weights.add(typography.display.fontWeight);
|
|
1147
1625
|
weights.add(typography.h1.fontWeight);
|
|
1148
1626
|
weights.add(typography.h2.fontWeight);
|
|
1149
1627
|
weights.add(typography.h3.fontWeight);
|
|
1628
|
+
for (const textStyle of Object.values(typography.text ?? {})) {
|
|
1629
|
+
weights.add(textStyle.fontWeight);
|
|
1630
|
+
}
|
|
1150
1631
|
return [...weights].sort((a, b) => a - b);
|
|
1151
1632
|
}
|
|
1152
1633
|
|
|
@@ -1167,7 +1648,17 @@ var canonicalSemanticAttributeNames = [
|
|
|
1167
1648
|
"data-orientation"
|
|
1168
1649
|
];
|
|
1169
1650
|
var semanticLayers = ["atom", "molecule", "purpose"];
|
|
1170
|
-
var semanticFamilies = [
|
|
1651
|
+
var semanticFamilies = [
|
|
1652
|
+
"button",
|
|
1653
|
+
"badge",
|
|
1654
|
+
"banner",
|
|
1655
|
+
"avatar",
|
|
1656
|
+
"toast",
|
|
1657
|
+
"dialog",
|
|
1658
|
+
"drawer",
|
|
1659
|
+
"context-menu",
|
|
1660
|
+
"breadcrumb"
|
|
1661
|
+
];
|
|
1171
1662
|
var semanticIntents = [
|
|
1172
1663
|
"success",
|
|
1173
1664
|
"error",
|
|
@@ -1207,12 +1698,19 @@ var toastPurposes = [
|
|
|
1207
1698
|
"warning-toast",
|
|
1208
1699
|
"info-toast"
|
|
1209
1700
|
];
|
|
1701
|
+
var bannerPurposes = [
|
|
1702
|
+
"info-banner",
|
|
1703
|
+
"success-banner",
|
|
1704
|
+
"warning-banner",
|
|
1705
|
+
"error-banner"
|
|
1706
|
+
];
|
|
1210
1707
|
var dialogPurposes = ["confirm-dialog", "destructive-dialog", "info-dialog"];
|
|
1211
1708
|
var semanticPurposes = [
|
|
1212
1709
|
...buttonPurposes,
|
|
1213
1710
|
...badgePurposes,
|
|
1214
1711
|
...avatarPurposes,
|
|
1215
1712
|
...toastPurposes,
|
|
1713
|
+
...bannerPurposes,
|
|
1216
1714
|
...dialogPurposes
|
|
1217
1715
|
];
|
|
1218
1716
|
|
|
@@ -1281,7 +1779,7 @@ var canonicalSemanticAttributes = {
|
|
|
1281
1779
|
name: "data-destructive",
|
|
1282
1780
|
description: "Boolean marker for destructive actions or flows.",
|
|
1283
1781
|
allowedValues: ["true", "false"],
|
|
1284
|
-
applicableFamilies: ["button", "dialog"],
|
|
1782
|
+
applicableFamilies: ["button", "dialog", "context-menu"],
|
|
1285
1783
|
applicableLayers: semanticLayers
|
|
1286
1784
|
},
|
|
1287
1785
|
"data-confirmation-required": {
|
|
@@ -1355,6 +1853,16 @@ var familySemanticsRegistry = {
|
|
|
1355
1853
|
allowedPurposes: ["status", "priority", "notification"],
|
|
1356
1854
|
notes: "Badge needs base family identity normalized before full parity governance."
|
|
1357
1855
|
},
|
|
1856
|
+
banner: {
|
|
1857
|
+
family: "banner",
|
|
1858
|
+
defaultLayer: "atom",
|
|
1859
|
+
baseAttributes: {
|
|
1860
|
+
"data-component": "banner"
|
|
1861
|
+
},
|
|
1862
|
+
canonicalAttributes: ["data-component", "data-variant"],
|
|
1863
|
+
allowedPurposes: ["info-banner", "success-banner", "warning-banner", "error-banner"],
|
|
1864
|
+
notes: "Banner is a single-atom family with thin purpose variants that preset the variant prop and emit canonical data-purpose metadata."
|
|
1865
|
+
},
|
|
1358
1866
|
avatar: {
|
|
1359
1867
|
family: "avatar",
|
|
1360
1868
|
defaultLayer: "atom",
|
|
@@ -1384,6 +1892,36 @@ var familySemanticsRegistry = {
|
|
|
1384
1892
|
canonicalAttributes: ["data-component", "data-size", "data-intent"],
|
|
1385
1893
|
allowedPurposes: ["confirm-dialog", "destructive-dialog", "info-dialog"],
|
|
1386
1894
|
notes: "Dialog already has a strong purpose mapping and workflow semantics in adapters."
|
|
1895
|
+
},
|
|
1896
|
+
drawer: {
|
|
1897
|
+
family: "drawer",
|
|
1898
|
+
defaultLayer: "atom",
|
|
1899
|
+
baseAttributes: {
|
|
1900
|
+
"data-component": "drawer"
|
|
1901
|
+
},
|
|
1902
|
+
canonicalAttributes: ["data-component", "data-size"],
|
|
1903
|
+
allowedPurposes: [],
|
|
1904
|
+
notes: "Drawer shares dialog semantics while adding panel placement and scrim composition at the family level."
|
|
1905
|
+
},
|
|
1906
|
+
"context-menu": {
|
|
1907
|
+
family: "context-menu",
|
|
1908
|
+
defaultLayer: "atom",
|
|
1909
|
+
baseAttributes: {
|
|
1910
|
+
"data-component": "context-menu"
|
|
1911
|
+
},
|
|
1912
|
+
canonicalAttributes: ["data-component", "data-destructive"],
|
|
1913
|
+
allowedPurposes: [],
|
|
1914
|
+
notes: "ContextMenu exposes a menu surface and button-backed menu items while popover/open-state orchestration stays adapter-owned."
|
|
1915
|
+
},
|
|
1916
|
+
breadcrumb: {
|
|
1917
|
+
family: "breadcrumb",
|
|
1918
|
+
defaultLayer: "atom",
|
|
1919
|
+
baseAttributes: {
|
|
1920
|
+
"data-component": "breadcrumb"
|
|
1921
|
+
},
|
|
1922
|
+
canonicalAttributes: ["data-component"],
|
|
1923
|
+
allowedPurposes: [],
|
|
1924
|
+
notes: "Breadcrumb exposes navigation hierarchy while routing, link resolution, and page ownership stay consumer-owned."
|
|
1387
1925
|
}
|
|
1388
1926
|
};
|
|
1389
1927
|
|
|
@@ -1687,6 +2225,48 @@ var toastPurposeSemantics = {
|
|
|
1687
2225
|
supportedFrameworks: frameworks
|
|
1688
2226
|
}
|
|
1689
2227
|
};
|
|
2228
|
+
var bannerPurposeSemantics = {
|
|
2229
|
+
infoBanner: {
|
|
2230
|
+
purpose: "info-banner",
|
|
2231
|
+
family: "banner",
|
|
2232
|
+
layer: "purpose",
|
|
2233
|
+
attributes: {
|
|
2234
|
+
"data-purpose": "info-banner",
|
|
2235
|
+
"data-intent": "info"
|
|
2236
|
+
},
|
|
2237
|
+
supportedFrameworks: frameworks
|
|
2238
|
+
},
|
|
2239
|
+
successBanner: {
|
|
2240
|
+
purpose: "success-banner",
|
|
2241
|
+
family: "banner",
|
|
2242
|
+
layer: "purpose",
|
|
2243
|
+
attributes: {
|
|
2244
|
+
"data-purpose": "success-banner",
|
|
2245
|
+
"data-intent": "success"
|
|
2246
|
+
},
|
|
2247
|
+
supportedFrameworks: frameworks
|
|
2248
|
+
},
|
|
2249
|
+
warningBanner: {
|
|
2250
|
+
purpose: "warning-banner",
|
|
2251
|
+
family: "banner",
|
|
2252
|
+
layer: "purpose",
|
|
2253
|
+
attributes: {
|
|
2254
|
+
"data-purpose": "warning-banner",
|
|
2255
|
+
"data-intent": "warning"
|
|
2256
|
+
},
|
|
2257
|
+
supportedFrameworks: frameworks
|
|
2258
|
+
},
|
|
2259
|
+
errorBanner: {
|
|
2260
|
+
purpose: "error-banner",
|
|
2261
|
+
family: "banner",
|
|
2262
|
+
layer: "purpose",
|
|
2263
|
+
attributes: {
|
|
2264
|
+
"data-purpose": "error-banner",
|
|
2265
|
+
"data-intent": "error"
|
|
2266
|
+
},
|
|
2267
|
+
supportedFrameworks: frameworks
|
|
2268
|
+
}
|
|
2269
|
+
};
|
|
1690
2270
|
var dialogPurposeSemantics = {
|
|
1691
2271
|
confirmDialog: {
|
|
1692
2272
|
purpose: "confirm-dialog",
|
|
@@ -1726,6 +2306,7 @@ var purposeSemanticsRegistry = {
|
|
|
1726
2306
|
...badgePurposeSemantics,
|
|
1727
2307
|
...avatarPurposeSemantics,
|
|
1728
2308
|
...toastPurposeSemantics,
|
|
2309
|
+
...bannerPurposeSemantics,
|
|
1729
2310
|
...dialogPurposeSemantics
|
|
1730
2311
|
};
|
|
1731
2312
|
|
|
@@ -3742,7 +4323,8 @@ var buttonVariantVisualStyles = [
|
|
|
3742
4323
|
{ label: "secondary", text: "Outlined, brand-accent emphasis (action utilities)" },
|
|
3743
4324
|
{ label: "neutral", text: "Outlined, low-chroma emphasis (cancel/close/filter actions)" },
|
|
3744
4325
|
{ label: "text", text: "Minimal, low emphasis (tertiary/inline actions)" },
|
|
3745
|
-
{ label: "success", text: "Filled, positive emphasis (confirm actions)" }
|
|
4326
|
+
{ label: "success", text: "Filled, positive emphasis (confirm actions)" },
|
|
4327
|
+
{ label: "danger", text: "Filled, destructive emphasis (delete/discard actions)" }
|
|
3746
4328
|
];
|
|
3747
4329
|
var buttonActionSemanticPurposes = [
|
|
3748
4330
|
{ label: "submit", text: "Form submission" },
|
|
@@ -4208,14 +4790,15 @@ function resolveAvatarA11y(options, resolvedType, normalizedInitials) {
|
|
|
4208
4790
|
};
|
|
4209
4791
|
}
|
|
4210
4792
|
if (resolvedType === AvatarType.image) {
|
|
4211
|
-
|
|
4793
|
+
const imageAccessibleLabel = options.ariaLabel ?? options.label;
|
|
4794
|
+
if (__DEV__ && !options.alt && !imageAccessibleLabel) {
|
|
4212
4795
|
console.warn(
|
|
4213
|
-
"[marwes] Avatar: an image avatar was rendered without alt text or
|
|
4796
|
+
"[marwes] Avatar: an image avatar was rendered without alt text, ariaLabel, or label. Provide alt to describe the person, ariaLabel/label as a fallback, or use decorative={true} to explicitly mark it as presentational."
|
|
4214
4797
|
);
|
|
4215
4798
|
}
|
|
4216
4799
|
return {};
|
|
4217
4800
|
}
|
|
4218
|
-
const accessibleLabel = options.ariaLabel ?? normalizedInitials ?? "Avatar";
|
|
4801
|
+
const accessibleLabel = options.ariaLabel ?? options.label ?? normalizedInitials ?? "Avatar";
|
|
4219
4802
|
return {
|
|
4220
4803
|
role: "img",
|
|
4221
4804
|
ariaLabel: accessibleLabel
|
|
@@ -4368,6 +4951,305 @@ function createDialogRecipe(opts = {}) {
|
|
|
4368
4951
|
};
|
|
4369
4952
|
}
|
|
4370
4953
|
|
|
4954
|
+
// src/components/atoms/drawer/drawer-a11y.ts
|
|
4955
|
+
function resolveDrawerA11y(opts) {
|
|
4956
|
+
const a11y = {
|
|
4957
|
+
role: "dialog"
|
|
4958
|
+
};
|
|
4959
|
+
if (opts.modal) {
|
|
4960
|
+
a11y.ariaModal = true;
|
|
4961
|
+
}
|
|
4962
|
+
if (opts.ariaLabel) {
|
|
4963
|
+
a11y.ariaLabel = opts.ariaLabel;
|
|
4964
|
+
}
|
|
4965
|
+
if (opts.ariaLabelledBy) {
|
|
4966
|
+
a11y.ariaLabelledBy = opts.ariaLabelledBy;
|
|
4967
|
+
}
|
|
4968
|
+
if (opts.ariaDescribedBy) {
|
|
4969
|
+
a11y.ariaDescribedBy = opts.ariaDescribedBy;
|
|
4970
|
+
}
|
|
4971
|
+
return a11y;
|
|
4972
|
+
}
|
|
4973
|
+
|
|
4974
|
+
// src/components/atoms/drawer/drawer-recipe.ts
|
|
4975
|
+
function cx4(...parts) {
|
|
4976
|
+
return parts.filter(Boolean).join(" ");
|
|
4977
|
+
}
|
|
4978
|
+
function createDrawerRecipe(opts = {}) {
|
|
4979
|
+
const size = opts.size ?? "medium";
|
|
4980
|
+
const placement = opts.placement ?? "right";
|
|
4981
|
+
const showFooter = opts.showFooter ?? true;
|
|
4982
|
+
const showCloseButton = opts.dismissible ?? true;
|
|
4983
|
+
const showScrim = opts.showScrim ?? true;
|
|
4984
|
+
const rootDataAttributes = {
|
|
4985
|
+
...createFamilySemanticAttributes("drawer", {
|
|
4986
|
+
"data-size": size
|
|
4987
|
+
}),
|
|
4988
|
+
"data-placement": placement,
|
|
4989
|
+
"data-footer": showFooter ? "true" : "false",
|
|
4990
|
+
"data-dismissible": showCloseButton ? "true" : "false",
|
|
4991
|
+
"data-scrim": showScrim ? "true" : "false",
|
|
4992
|
+
...opts.dataAttributes
|
|
4993
|
+
};
|
|
4994
|
+
return {
|
|
4995
|
+
tag: "div",
|
|
4996
|
+
className: cx4(
|
|
4997
|
+
"mw-drawer",
|
|
4998
|
+
`mw-drawer--${placement}`,
|
|
4999
|
+
`mw-drawer--${size}`,
|
|
5000
|
+
showFooter ? "mw-drawer--with-footer" : "mw-drawer--without-footer",
|
|
5001
|
+
showScrim && "mw-drawer--with-scrim",
|
|
5002
|
+
showCloseButton && "mw-drawer--dismissible"
|
|
5003
|
+
),
|
|
5004
|
+
vars: {},
|
|
5005
|
+
size,
|
|
5006
|
+
placement,
|
|
5007
|
+
showFooter,
|
|
5008
|
+
showCloseButton,
|
|
5009
|
+
showScrim,
|
|
5010
|
+
dataAttributes: rootDataAttributes,
|
|
5011
|
+
panel: {
|
|
5012
|
+
tag: "div",
|
|
5013
|
+
className: "mw-drawer__panel",
|
|
5014
|
+
vars: {},
|
|
5015
|
+
a11y: resolveDrawerA11y(opts),
|
|
5016
|
+
dataAttributes: {
|
|
5017
|
+
...rootDataAttributes,
|
|
5018
|
+
"data-part": "panel"
|
|
5019
|
+
}
|
|
5020
|
+
},
|
|
5021
|
+
scrim: {
|
|
5022
|
+
tag: "div",
|
|
5023
|
+
className: "mw-drawer__scrim",
|
|
5024
|
+
vars: {},
|
|
5025
|
+
dataAttributes: {
|
|
5026
|
+
"data-component": "drawer",
|
|
5027
|
+
"data-part": "scrim",
|
|
5028
|
+
"data-placement": placement
|
|
5029
|
+
}
|
|
5030
|
+
}
|
|
5031
|
+
};
|
|
5032
|
+
}
|
|
5033
|
+
|
|
5034
|
+
// src/components/atoms/context-menu/context-menu-a11y.ts
|
|
5035
|
+
function resolveContextMenuA11y(options = {}) {
|
|
5036
|
+
return {
|
|
5037
|
+
role: "menu",
|
|
5038
|
+
ariaLabel: options.ariaLabel ?? "Context menu"
|
|
5039
|
+
};
|
|
5040
|
+
}
|
|
5041
|
+
function resolveContextMenuItemA11y(disabled = false) {
|
|
5042
|
+
return {
|
|
5043
|
+
role: "menuitem",
|
|
5044
|
+
type: "button",
|
|
5045
|
+
...disabled ? {
|
|
5046
|
+
disabled: true,
|
|
5047
|
+
ariaDisabled: "true"
|
|
5048
|
+
} : {}
|
|
5049
|
+
};
|
|
5050
|
+
}
|
|
5051
|
+
function resolveContextMenuDividerA11y() {
|
|
5052
|
+
return {
|
|
5053
|
+
role: "separator",
|
|
5054
|
+
ariaOrientation: "horizontal"
|
|
5055
|
+
};
|
|
5056
|
+
}
|
|
5057
|
+
|
|
5058
|
+
// src/components/atoms/context-menu/context-menu-recipe.ts
|
|
5059
|
+
function cx5(...parts) {
|
|
5060
|
+
return parts.filter(Boolean).join(" ");
|
|
5061
|
+
}
|
|
5062
|
+
function isActionItem(item) {
|
|
5063
|
+
return item.kind !== "divider";
|
|
5064
|
+
}
|
|
5065
|
+
function createContextMenuItemKey(item, index) {
|
|
5066
|
+
if (isActionItem(item)) {
|
|
5067
|
+
return `item-${item.value}`;
|
|
5068
|
+
}
|
|
5069
|
+
return item.id ?? `divider-${index}`;
|
|
5070
|
+
}
|
|
5071
|
+
function createContextMenuRecipe(options = {}) {
|
|
5072
|
+
const rootDataAttributes = {
|
|
5073
|
+
...createFamilySemanticAttributes("context-menu"),
|
|
5074
|
+
...options.dataAttributes
|
|
5075
|
+
};
|
|
5076
|
+
return {
|
|
5077
|
+
tag: "div",
|
|
5078
|
+
className: "mw-context-menu",
|
|
5079
|
+
vars: {},
|
|
5080
|
+
a11y: resolveContextMenuA11y(options),
|
|
5081
|
+
dataAttributes: rootDataAttributes,
|
|
5082
|
+
items: (options.items ?? []).map((item, index) => {
|
|
5083
|
+
const key = createContextMenuItemKey(item, index);
|
|
5084
|
+
if (!isActionItem(item)) {
|
|
5085
|
+
return {
|
|
5086
|
+
kind: "divider",
|
|
5087
|
+
key,
|
|
5088
|
+
item,
|
|
5089
|
+
className: "mw-context-menu__divider",
|
|
5090
|
+
vars: {},
|
|
5091
|
+
a11y: resolveContextMenuDividerA11y(),
|
|
5092
|
+
dataAttributes: {
|
|
5093
|
+
"data-component": "context-menu",
|
|
5094
|
+
"data-part": "divider",
|
|
5095
|
+
...item.dataAttributes
|
|
5096
|
+
}
|
|
5097
|
+
};
|
|
5098
|
+
}
|
|
5099
|
+
const disabled = item.disabled ?? false;
|
|
5100
|
+
const destructive = item.destructive ?? false;
|
|
5101
|
+
return {
|
|
5102
|
+
kind: "item",
|
|
5103
|
+
key,
|
|
5104
|
+
item,
|
|
5105
|
+
label: item.label,
|
|
5106
|
+
value: item.value,
|
|
5107
|
+
...item.icon ? { icon: item.icon } : {},
|
|
5108
|
+
className: cx5(
|
|
5109
|
+
"mw-context-menu__item",
|
|
5110
|
+
destructive && "mw-context-menu__item--destructive",
|
|
5111
|
+
disabled && "mw-context-menu__item--disabled"
|
|
5112
|
+
),
|
|
5113
|
+
vars: {},
|
|
5114
|
+
a11y: resolveContextMenuItemA11y(disabled),
|
|
5115
|
+
dataAttributes: {
|
|
5116
|
+
"data-component": "context-menu",
|
|
5117
|
+
"data-part": "item",
|
|
5118
|
+
"data-value": item.value,
|
|
5119
|
+
"data-disabled": disabled ? "true" : void 0,
|
|
5120
|
+
"data-destructive": destructive ? "true" : void 0,
|
|
5121
|
+
...item.dataAttributes
|
|
5122
|
+
}
|
|
5123
|
+
};
|
|
5124
|
+
})
|
|
5125
|
+
};
|
|
5126
|
+
}
|
|
5127
|
+
|
|
5128
|
+
// src/components/atoms/breadcrumb/breadcrumb-a11y.ts
|
|
5129
|
+
function resolveBreadcrumbA11y(options = {}) {
|
|
5130
|
+
return {
|
|
5131
|
+
ariaLabel: options.ariaLabel ?? "Breadcrumb"
|
|
5132
|
+
};
|
|
5133
|
+
}
|
|
5134
|
+
function resolveBreadcrumbListA11y() {
|
|
5135
|
+
return {
|
|
5136
|
+
role: "list"
|
|
5137
|
+
};
|
|
5138
|
+
}
|
|
5139
|
+
function resolveBreadcrumbSeparatorA11y() {
|
|
5140
|
+
return {
|
|
5141
|
+
ariaHidden: true
|
|
5142
|
+
};
|
|
5143
|
+
}
|
|
5144
|
+
function resolveBreadcrumbHomeA11y(homeLabel) {
|
|
5145
|
+
return {
|
|
5146
|
+
ariaLabel: homeLabel
|
|
5147
|
+
};
|
|
5148
|
+
}
|
|
5149
|
+
function resolveBreadcrumbItemA11y(item, current) {
|
|
5150
|
+
return {
|
|
5151
|
+
...current ? { ariaCurrent: "page" } : {},
|
|
5152
|
+
...item.ariaLabel ? { ariaLabel: item.ariaLabel } : {}
|
|
5153
|
+
};
|
|
5154
|
+
}
|
|
5155
|
+
|
|
5156
|
+
// src/components/atoms/breadcrumb/breadcrumb-recipe.ts
|
|
5157
|
+
function cx6(...parts) {
|
|
5158
|
+
return parts.filter(Boolean).join(" ");
|
|
5159
|
+
}
|
|
5160
|
+
function createItemKey(item, index) {
|
|
5161
|
+
return item.id ?? item.value ?? `${index}-${item.href ?? item.label}`;
|
|
5162
|
+
}
|
|
5163
|
+
function resolveCurrentIndex(items) {
|
|
5164
|
+
const explicitIndex = items.findIndex((item) => item.current === true);
|
|
5165
|
+
if (explicitIndex >= 0) return explicitIndex;
|
|
5166
|
+
return items.length - 1;
|
|
5167
|
+
}
|
|
5168
|
+
function createBreadcrumbItemRenderKit(item, index, currentIndex) {
|
|
5169
|
+
const current = index === currentIndex;
|
|
5170
|
+
const value = item.value ?? item.id ?? item.href ?? item.label;
|
|
5171
|
+
return {
|
|
5172
|
+
key: `item-${createItemKey(item, index)}`,
|
|
5173
|
+
kind: "item",
|
|
5174
|
+
item,
|
|
5175
|
+
label: item.label,
|
|
5176
|
+
value,
|
|
5177
|
+
...item.href ? { href: item.href } : {},
|
|
5178
|
+
current,
|
|
5179
|
+
className: cx6("mw-breadcrumb__item", current && "mw-breadcrumb__item--current"),
|
|
5180
|
+
actionClassName: cx6("mw-breadcrumb__action", current && "mw-breadcrumb__current"),
|
|
5181
|
+
vars: {},
|
|
5182
|
+
a11y: resolveBreadcrumbItemA11y(item, current),
|
|
5183
|
+
dataAttributes: {
|
|
5184
|
+
"data-component": "breadcrumb",
|
|
5185
|
+
"data-part": "item",
|
|
5186
|
+
"data-current": current ? "true" : void 0,
|
|
5187
|
+
"data-value": value,
|
|
5188
|
+
...item.dataAttributes
|
|
5189
|
+
}
|
|
5190
|
+
};
|
|
5191
|
+
}
|
|
5192
|
+
function createBreadcrumbRecipe(options = {}) {
|
|
5193
|
+
const showHome = options.showHome ?? true;
|
|
5194
|
+
const homeLabel = options.homeLabel ?? "Home";
|
|
5195
|
+
const items = options.items ?? [];
|
|
5196
|
+
const currentIndex = resolveCurrentIndex(items);
|
|
5197
|
+
const rootDataAttributes = {
|
|
5198
|
+
...createFamilySemanticAttributes("breadcrumb"),
|
|
5199
|
+
...options.dataAttributes
|
|
5200
|
+
};
|
|
5201
|
+
return {
|
|
5202
|
+
tag: "nav",
|
|
5203
|
+
className: "mw-breadcrumb",
|
|
5204
|
+
vars: {},
|
|
5205
|
+
a11y: resolveBreadcrumbA11y(options),
|
|
5206
|
+
dataAttributes: rootDataAttributes,
|
|
5207
|
+
list: {
|
|
5208
|
+
tag: "ol",
|
|
5209
|
+
className: "mw-breadcrumb__list",
|
|
5210
|
+
vars: {},
|
|
5211
|
+
a11y: resolveBreadcrumbListA11y()
|
|
5212
|
+
},
|
|
5213
|
+
separator: {
|
|
5214
|
+
tag: "span",
|
|
5215
|
+
className: "mw-breadcrumb__separator",
|
|
5216
|
+
vars: {},
|
|
5217
|
+
a11y: resolveBreadcrumbSeparatorA11y()
|
|
5218
|
+
},
|
|
5219
|
+
items: [
|
|
5220
|
+
...showHome ? [
|
|
5221
|
+
{
|
|
5222
|
+
key: "home",
|
|
5223
|
+
kind: "home",
|
|
5224
|
+
label: homeLabel,
|
|
5225
|
+
value: "home",
|
|
5226
|
+
...options.homeHref ? { href: options.homeHref } : {},
|
|
5227
|
+
current: items.length === 0,
|
|
5228
|
+
className: cx6(
|
|
5229
|
+
"mw-breadcrumb__item",
|
|
5230
|
+
"mw-breadcrumb__item--home",
|
|
5231
|
+
items.length === 0 && "mw-breadcrumb__item--current"
|
|
5232
|
+
),
|
|
5233
|
+
actionClassName: cx6(
|
|
5234
|
+
"mw-breadcrumb__action",
|
|
5235
|
+
"mw-breadcrumb__home",
|
|
5236
|
+
items.length === 0 && "mw-breadcrumb__current"
|
|
5237
|
+
),
|
|
5238
|
+
vars: {},
|
|
5239
|
+
a11y: resolveBreadcrumbHomeA11y(homeLabel),
|
|
5240
|
+
dataAttributes: {
|
|
5241
|
+
"data-component": "breadcrumb",
|
|
5242
|
+
"data-part": "home",
|
|
5243
|
+
"data-current": items.length === 0 ? "true" : void 0,
|
|
5244
|
+
"data-value": "home"
|
|
5245
|
+
}
|
|
5246
|
+
}
|
|
5247
|
+
] : [],
|
|
5248
|
+
...items.map((item, index) => createBreadcrumbItemRenderKit(item, index, currentIndex))
|
|
5249
|
+
]
|
|
5250
|
+
};
|
|
5251
|
+
}
|
|
5252
|
+
|
|
4371
5253
|
// src/components/atoms/toast/toast-a11y.ts
|
|
4372
5254
|
function resolveToastA11y(opts) {
|
|
4373
5255
|
const ariaLive = opts.ariaLive ?? "polite";
|
|
@@ -4379,14 +5261,14 @@ function resolveToastA11y(opts) {
|
|
|
4379
5261
|
}
|
|
4380
5262
|
|
|
4381
5263
|
// src/components/atoms/toast/toast-recipe.ts
|
|
4382
|
-
function
|
|
5264
|
+
function cx7(...parts) {
|
|
4383
5265
|
return parts.filter(Boolean).join(" ");
|
|
4384
5266
|
}
|
|
4385
5267
|
function createToastRecipe(opts) {
|
|
4386
5268
|
const variant = opts.variant ?? "outline";
|
|
4387
5269
|
return {
|
|
4388
5270
|
tag: "div",
|
|
4389
|
-
className:
|
|
5271
|
+
className: cx7("mw-toast", `mw-toast--${variant}`),
|
|
4390
5272
|
vars: {},
|
|
4391
5273
|
a11y: resolveToastA11y(opts),
|
|
4392
5274
|
dataAttributes: createFamilySemanticAttributes("toast", {
|
|
@@ -4419,19 +5301,20 @@ function createTooltipRecipe(options = {}) {
|
|
|
4419
5301
|
// src/components/atoms/badge/badge-a11y.ts
|
|
4420
5302
|
function resolveBadgeA11y(opts) {
|
|
4421
5303
|
const a11y = {};
|
|
4422
|
-
|
|
5304
|
+
const accessibleLabel = opts.ariaLabel ?? opts.label;
|
|
5305
|
+
if (accessibleLabel) a11y.ariaLabel = accessibleLabel;
|
|
4423
5306
|
return a11y;
|
|
4424
5307
|
}
|
|
4425
5308
|
|
|
4426
5309
|
// src/components/atoms/badge/badge-recipe.ts
|
|
4427
|
-
function
|
|
5310
|
+
function cx8(...parts) {
|
|
4428
5311
|
return parts.filter(Boolean).join(" ");
|
|
4429
5312
|
}
|
|
4430
5313
|
function createBadgeRecipe(opts) {
|
|
4431
5314
|
const variant = opts.variant ?? "neutral";
|
|
4432
5315
|
return {
|
|
4433
5316
|
tag: "span",
|
|
4434
|
-
className:
|
|
5317
|
+
className: cx8("mw-badge", `mw-badge--${variant}`),
|
|
4435
5318
|
vars: {},
|
|
4436
5319
|
a11y: resolveBadgeA11y(opts),
|
|
4437
5320
|
dataAttributes: createFamilySemanticAttributes("badge", {
|
|
@@ -4449,6 +5332,65 @@ var BadgeVariant = {
|
|
|
4449
5332
|
error: "error"
|
|
4450
5333
|
};
|
|
4451
5334
|
|
|
5335
|
+
// src/components/atoms/banner/banner-a11y.ts
|
|
5336
|
+
function resolveBannerA11y(opts) {
|
|
5337
|
+
const variant = opts.variant ?? "neutral";
|
|
5338
|
+
const isUrgent = variant === "error" || variant === "warning";
|
|
5339
|
+
return {
|
|
5340
|
+
role: isUrgent ? "alert" : "status",
|
|
5341
|
+
ariaLabel: opts.ariaLabel,
|
|
5342
|
+
ariaLive: isUrgent ? "assertive" : "polite"
|
|
5343
|
+
};
|
|
5344
|
+
}
|
|
5345
|
+
|
|
5346
|
+
// src/components/atoms/banner/banner-recipe.ts
|
|
5347
|
+
function cx9(...parts) {
|
|
5348
|
+
return parts.filter(Boolean).join(" ");
|
|
5349
|
+
}
|
|
5350
|
+
function createBannerRecipe(opts) {
|
|
5351
|
+
const variant = opts.variant ?? "neutral";
|
|
5352
|
+
const showIcon = opts.showIcon ?? true;
|
|
5353
|
+
const showAction = opts.showAction ?? false;
|
|
5354
|
+
const dismissible = opts.dismissible ?? true;
|
|
5355
|
+
return {
|
|
5356
|
+
root: {
|
|
5357
|
+
className: cx9("mw-banner", `mw-banner--${variant}`),
|
|
5358
|
+
a11y: resolveBannerA11y(opts),
|
|
5359
|
+
dataAttributes: createFamilySemanticAttributes("banner", {
|
|
5360
|
+
"data-variant": variant
|
|
5361
|
+
})
|
|
5362
|
+
},
|
|
5363
|
+
content: {
|
|
5364
|
+
className: "mw-banner__content"
|
|
5365
|
+
},
|
|
5366
|
+
icon: {
|
|
5367
|
+
className: "mw-banner__icon",
|
|
5368
|
+
visible: showIcon
|
|
5369
|
+
},
|
|
5370
|
+
message: {
|
|
5371
|
+
className: "mw-banner__message"
|
|
5372
|
+
},
|
|
5373
|
+
action: {
|
|
5374
|
+
className: "mw-banner__action",
|
|
5375
|
+
visible: showAction
|
|
5376
|
+
},
|
|
5377
|
+
dismiss: {
|
|
5378
|
+
className: "mw-banner__dismiss",
|
|
5379
|
+
visible: dismissible,
|
|
5380
|
+
ariaLabel: "Dismiss banner"
|
|
5381
|
+
}
|
|
5382
|
+
};
|
|
5383
|
+
}
|
|
5384
|
+
|
|
5385
|
+
// src/components/atoms/banner/banner-types.ts
|
|
5386
|
+
var BannerVariant = {
|
|
5387
|
+
neutral: "neutral",
|
|
5388
|
+
info: "info",
|
|
5389
|
+
success: "success",
|
|
5390
|
+
warning: "warning",
|
|
5391
|
+
error: "error"
|
|
5392
|
+
};
|
|
5393
|
+
|
|
4452
5394
|
// src/components/atoms/button/button-types.ts
|
|
4453
5395
|
var ButtonSize = {
|
|
4454
5396
|
xs: "xs",
|
|
@@ -4461,7 +5403,8 @@ var ButtonVariant = {
|
|
|
4461
5403
|
secondary: "secondary",
|
|
4462
5404
|
neutral: "neutral",
|
|
4463
5405
|
text: "text",
|
|
4464
|
-
success: "success"
|
|
5406
|
+
success: "success",
|
|
5407
|
+
danger: "danger"
|
|
4465
5408
|
};
|
|
4466
5409
|
var ButtonAction = {
|
|
4467
5410
|
submit: "submit",
|
|
@@ -4540,13 +5483,21 @@ function resolveButtonA11y(opts, resolvedLoading) {
|
|
|
4540
5483
|
const isDisabled = !!opts.disabled || resolvedLoading.isLoading && resolvedLoading.disableWhileLoading;
|
|
4541
5484
|
if (__DEV__2) {
|
|
4542
5485
|
const iconOnly = opts.iconOnly || opts.hasVisibleText === false;
|
|
5486
|
+
const accessibleLabel = opts.ariaLabel ?? opts.label;
|
|
4543
5487
|
const loadingAccessibleLabel = resolvedLoading.isLoading ? resolvedLoading.loadingLabel : void 0;
|
|
4544
|
-
if (iconOnly && !
|
|
4545
|
-
console.warn(
|
|
5488
|
+
if (iconOnly && !accessibleLabel && !loadingAccessibleLabel) {
|
|
5489
|
+
console.warn(
|
|
5490
|
+
"[marwes] Icon-only Button requires ariaLabel, label, or loadingLabel while loading."
|
|
5491
|
+
);
|
|
4546
5492
|
}
|
|
4547
5493
|
}
|
|
4548
5494
|
const common = {};
|
|
4549
|
-
if (opts.
|
|
5495
|
+
if (opts.ariaLabelledBy) {
|
|
5496
|
+
common.ariaLabelledBy = opts.ariaLabelledBy;
|
|
5497
|
+
} else {
|
|
5498
|
+
const accessibleLabel = opts.ariaLabel ?? opts.label;
|
|
5499
|
+
if (accessibleLabel) common.ariaLabel = accessibleLabel;
|
|
5500
|
+
}
|
|
4550
5501
|
if (resolvedLoading.isLoading) common.ariaBusy = true;
|
|
4551
5502
|
if (isDisabled) common.ariaDisabled = true;
|
|
4552
5503
|
if (opts.toggle) common.ariaPressed = !!opts.pressed;
|
|
@@ -4577,6 +5528,7 @@ function createButtonRecipe(opts) {
|
|
|
4577
5528
|
const size = opts.size ?? "md";
|
|
4578
5529
|
const variant = opts.variant ?? "primary";
|
|
4579
5530
|
const action = opts.action ?? (tag === "button" ? "button" : "navigate");
|
|
5531
|
+
const hasAffordance = resolvedLoading.isLoading || Boolean(opts.iconLeft || opts.iconRight);
|
|
4580
5532
|
return {
|
|
4581
5533
|
tag,
|
|
4582
5534
|
blockClick,
|
|
@@ -4598,6 +5550,8 @@ function createButtonRecipe(opts) {
|
|
|
4598
5550
|
"data-size": size
|
|
4599
5551
|
}),
|
|
4600
5552
|
"data-error": opts.error ? "true" : void 0,
|
|
5553
|
+
"data-has-affordance": hasAffordance ? "true" : void 0,
|
|
5554
|
+
"data-icon-only": opts.iconOnly ? "true" : void 0,
|
|
4601
5555
|
...opts.dataAttributes
|
|
4602
5556
|
},
|
|
4603
5557
|
vars: {}
|
|
@@ -4612,7 +5566,8 @@ function buildRadioA11y(opts) {
|
|
|
4612
5566
|
if (opts.value) a11y.value = opts.value;
|
|
4613
5567
|
if (opts.disabled) a11y.disabled = true;
|
|
4614
5568
|
if (opts.required) a11y.required = true;
|
|
4615
|
-
|
|
5569
|
+
const accessibleLabel = opts.ariaLabel ?? opts.label;
|
|
5570
|
+
if (accessibleLabel) a11y.ariaLabel = accessibleLabel;
|
|
4616
5571
|
if (opts.ariaLabelledBy) a11y.ariaLabelledBy = opts.ariaLabelledBy;
|
|
4617
5572
|
if (opts.ariaDescribedBy) a11y.ariaDescribedBy = opts.ariaDescribedBy;
|
|
4618
5573
|
if (opts.invalid) a11y.ariaInvalid = true;
|
|
@@ -4620,7 +5575,7 @@ function buildRadioA11y(opts) {
|
|
|
4620
5575
|
}
|
|
4621
5576
|
|
|
4622
5577
|
// src/components/atoms/radio/radio-recipe.ts
|
|
4623
|
-
function
|
|
5578
|
+
function cx10(...parts) {
|
|
4624
5579
|
return parts.filter(Boolean).join(" ");
|
|
4625
5580
|
}
|
|
4626
5581
|
function radioRecipe({
|
|
@@ -4628,7 +5583,7 @@ function radioRecipe({
|
|
|
4628
5583
|
invalid = false,
|
|
4629
5584
|
...opts
|
|
4630
5585
|
}) {
|
|
4631
|
-
const className =
|
|
5586
|
+
const className = cx10("mw-radio", disabled && "mw-radio--disabled", invalid && "mw-radio--invalid");
|
|
4632
5587
|
const kit = {
|
|
4633
5588
|
tag: "input",
|
|
4634
5589
|
className,
|
|
@@ -4650,8 +5605,9 @@ function resolveSwitchA11y(opts) {
|
|
|
4650
5605
|
ariaChecked: opts.checked ?? false
|
|
4651
5606
|
};
|
|
4652
5607
|
if (opts.disabled) a11y.ariaDisabled = true;
|
|
4653
|
-
|
|
4654
|
-
if (
|
|
5608
|
+
const accessibleLabel = opts.ariaLabel ?? opts.label;
|
|
5609
|
+
if (accessibleLabel) a11y.ariaLabel = accessibleLabel;
|
|
5610
|
+
if (opts.ariaLabelledBy) a11y.ariaLabelledBy = opts.ariaLabelledBy;
|
|
4655
5611
|
if (opts.ariaDescribedBy) a11y.ariaDescribedBy = opts.ariaDescribedBy;
|
|
4656
5612
|
return a11y;
|
|
4657
5613
|
}
|
|
@@ -4664,14 +5620,14 @@ var SwitchSize = {
|
|
|
4664
5620
|
};
|
|
4665
5621
|
|
|
4666
5622
|
// src/components/atoms/switch/switch-recipe.ts
|
|
4667
|
-
function
|
|
5623
|
+
function cx11(...parts) {
|
|
4668
5624
|
return parts.filter(Boolean).join(" ");
|
|
4669
5625
|
}
|
|
4670
5626
|
function createSwitchRecipe(opts) {
|
|
4671
5627
|
const size = opts.size ?? SwitchSize.compact;
|
|
4672
5628
|
return {
|
|
4673
5629
|
tag: "button",
|
|
4674
|
-
className:
|
|
5630
|
+
className: cx11(
|
|
4675
5631
|
"mw-switch",
|
|
4676
5632
|
`mw-switch--${size}`,
|
|
4677
5633
|
opts.checked && "mw-switch--checked",
|
|
@@ -4718,7 +5674,8 @@ function resolveSliderA11y(opts) {
|
|
|
4718
5674
|
if (opts.name) a11y.name = opts.name;
|
|
4719
5675
|
if (opts.disabled) a11y.disabled = true;
|
|
4720
5676
|
if (opts.required) a11y.required = true;
|
|
4721
|
-
|
|
5677
|
+
const accessibleLabel = opts.ariaLabel ?? opts.label;
|
|
5678
|
+
if (accessibleLabel) a11y.ariaLabel = accessibleLabel;
|
|
4722
5679
|
if (opts.ariaLabelledBy) a11y.ariaLabelledBy = opts.ariaLabelledBy;
|
|
4723
5680
|
if (opts.ariaDescribedBy) a11y.ariaDescribedBy = opts.ariaDescribedBy;
|
|
4724
5681
|
if (opts.ariaValueText) a11y.ariaValueText = opts.ariaValueText;
|
|
@@ -4739,13 +5696,13 @@ function resolveSliderCurrentValue(opts, min, max) {
|
|
|
4739
5696
|
return clampSliderValue(candidateValue, min, max);
|
|
4740
5697
|
}
|
|
4741
5698
|
function resolveSliderFillPercentage(currentValue, min, max) {
|
|
4742
|
-
const
|
|
4743
|
-
if (
|
|
5699
|
+
const range2 = max - min;
|
|
5700
|
+
if (range2 <= 0) {
|
|
4744
5701
|
return 0;
|
|
4745
5702
|
}
|
|
4746
|
-
return (currentValue - min) /
|
|
5703
|
+
return (currentValue - min) / range2 * 100;
|
|
4747
5704
|
}
|
|
4748
|
-
function
|
|
5705
|
+
function cx12(...parts) {
|
|
4749
5706
|
return parts.filter(Boolean).join(" ");
|
|
4750
5707
|
}
|
|
4751
5708
|
function createSliderRecipe(opts = {}) {
|
|
@@ -4757,7 +5714,7 @@ function createSliderRecipe(opts = {}) {
|
|
|
4757
5714
|
const orientation = opts.orientation ?? "horizontal";
|
|
4758
5715
|
return {
|
|
4759
5716
|
tag: "div",
|
|
4760
|
-
className:
|
|
5717
|
+
className: cx12(
|
|
4761
5718
|
"mw-slider",
|
|
4762
5719
|
`mw-slider--${orientation}`,
|
|
4763
5720
|
opts.disabled && "mw-slider--disabled",
|
|
@@ -4792,7 +5749,8 @@ function buildCheckboxA11y(props) {
|
|
|
4792
5749
|
if (props.value) a11y.value = props.value;
|
|
4793
5750
|
if (props.disabled) a11y.disabled = true;
|
|
4794
5751
|
if (props.required) a11y.required = true;
|
|
4795
|
-
|
|
5752
|
+
const accessibleLabel = props.ariaLabel ?? props.label;
|
|
5753
|
+
if (accessibleLabel) a11y.ariaLabel = accessibleLabel;
|
|
4796
5754
|
if (props.ariaLabelledBy) a11y.ariaLabelledBy = props.ariaLabelledBy;
|
|
4797
5755
|
if (props.ariaDescribedBy) a11y.ariaDescribedBy = props.ariaDescribedBy;
|
|
4798
5756
|
if (props.indeterminate) a11y.ariaChecked = "mixed";
|
|
@@ -4801,7 +5759,7 @@ function buildCheckboxA11y(props) {
|
|
|
4801
5759
|
}
|
|
4802
5760
|
|
|
4803
5761
|
// src/components/atoms/checkbox/checkbox-recipe.ts
|
|
4804
|
-
function
|
|
5762
|
+
function cx13(...parts) {
|
|
4805
5763
|
return parts.filter(Boolean).join(" ");
|
|
4806
5764
|
}
|
|
4807
5765
|
function checkboxRecipe({
|
|
@@ -4810,7 +5768,7 @@ function checkboxRecipe({
|
|
|
4810
5768
|
...props
|
|
4811
5769
|
}) {
|
|
4812
5770
|
const size = props.size ?? "md";
|
|
4813
|
-
const className =
|
|
5771
|
+
const className = cx13(
|
|
4814
5772
|
"mw-checkbox",
|
|
4815
5773
|
size === "sm" && "mw-checkbox--sm",
|
|
4816
5774
|
size === "md" && "mw-checkbox--md",
|
|
@@ -4888,17 +5846,18 @@ function resolveSpinnerA11y(options = {}) {
|
|
|
4888
5846
|
ariaHidden: true
|
|
4889
5847
|
};
|
|
4890
5848
|
}
|
|
4891
|
-
|
|
5849
|
+
const accessibleLabel = options.ariaLabel ?? options.label;
|
|
5850
|
+
if (accessibleLabel) {
|
|
4892
5851
|
return {
|
|
4893
5852
|
...options.id ? { id: options.id } : {},
|
|
4894
5853
|
role: "status",
|
|
4895
|
-
ariaLabel:
|
|
5854
|
+
ariaLabel: accessibleLabel,
|
|
4896
5855
|
ariaLive: "polite"
|
|
4897
5856
|
};
|
|
4898
5857
|
}
|
|
4899
5858
|
if (__DEV__3 && options.decorative === false) {
|
|
4900
5859
|
console.warn(
|
|
4901
|
-
"[marwes] Spinner: decorative={false} was passed without ariaLabel. The spinner stays hidden from assistive technology unless ariaLabel is also provided."
|
|
5860
|
+
"[marwes] Spinner: decorative={false} was passed without ariaLabel. The spinner stays hidden from assistive technology unless ariaLabel or label is also provided."
|
|
4902
5861
|
);
|
|
4903
5862
|
}
|
|
4904
5863
|
return {
|
|
@@ -5018,7 +5977,7 @@ function createDotsSquareNodes() {
|
|
|
5018
5977
|
y: "1.5",
|
|
5019
5978
|
width: "4",
|
|
5020
5979
|
height: "5",
|
|
5021
|
-
rx: "
|
|
5980
|
+
rx: "999",
|
|
5022
5981
|
fill: INDICATOR_COLOR,
|
|
5023
5982
|
opacity: "0.89375"
|
|
5024
5983
|
}),
|
|
@@ -5027,7 +5986,7 @@ function createDotsSquareNodes() {
|
|
|
5027
5986
|
y: "4.4",
|
|
5028
5987
|
width: "4.8",
|
|
5029
5988
|
height: "4.8",
|
|
5030
|
-
rx: "
|
|
5989
|
+
rx: "999",
|
|
5031
5990
|
fill: INDICATOR_COLOR,
|
|
5032
5991
|
opacity: "0.46875"
|
|
5033
5992
|
}),
|
|
@@ -5036,7 +5995,7 @@ function createDotsSquareNodes() {
|
|
|
5036
5995
|
y: "10",
|
|
5037
5996
|
width: "5",
|
|
5038
5997
|
height: "4",
|
|
5039
|
-
rx: "
|
|
5998
|
+
rx: "999",
|
|
5040
5999
|
fill: INDICATOR_COLOR,
|
|
5041
6000
|
opacity: "0.3625"
|
|
5042
6001
|
}),
|
|
@@ -5045,7 +6004,7 @@ function createDotsSquareNodes() {
|
|
|
5045
6004
|
y: "14.8",
|
|
5046
6005
|
width: "4.8",
|
|
5047
6006
|
height: "4.8",
|
|
5048
|
-
rx: "
|
|
6007
|
+
rx: "999",
|
|
5049
6008
|
fill: INDICATOR_COLOR,
|
|
5050
6009
|
opacity: "0.15"
|
|
5051
6010
|
}),
|
|
@@ -5054,7 +6013,7 @@ function createDotsSquareNodes() {
|
|
|
5054
6013
|
y: "17.5",
|
|
5055
6014
|
width: "4",
|
|
5056
6015
|
height: "5",
|
|
5057
|
-
rx: "
|
|
6016
|
+
rx: "999",
|
|
5058
6017
|
fill: INDICATOR_COLOR,
|
|
5059
6018
|
opacity: "0.575"
|
|
5060
6019
|
}),
|
|
@@ -5063,7 +6022,7 @@ function createDotsSquareNodes() {
|
|
|
5063
6022
|
y: "14.8",
|
|
5064
6023
|
width: "4.8",
|
|
5065
6024
|
height: "4.8",
|
|
5066
|
-
rx: "
|
|
6025
|
+
rx: "999",
|
|
5067
6026
|
fill: INDICATOR_COLOR,
|
|
5068
6027
|
opacity: "0.7875"
|
|
5069
6028
|
}),
|
|
@@ -5072,7 +6031,7 @@ function createDotsSquareNodes() {
|
|
|
5072
6031
|
y: "10",
|
|
5073
6032
|
width: "5",
|
|
5074
6033
|
height: "4",
|
|
5075
|
-
rx: "
|
|
6034
|
+
rx: "999",
|
|
5076
6035
|
fill: INDICATOR_COLOR,
|
|
5077
6036
|
opacity: "0.68125"
|
|
5078
6037
|
}),
|
|
@@ -5081,7 +6040,7 @@ function createDotsSquareNodes() {
|
|
|
5081
6040
|
y: "4.4",
|
|
5082
6041
|
width: "4.8",
|
|
5083
6042
|
height: "4.8",
|
|
5084
|
-
rx: "
|
|
6043
|
+
rx: "999",
|
|
5085
6044
|
fill: INDICATOR_COLOR,
|
|
5086
6045
|
opacity: "0.25625"
|
|
5087
6046
|
})
|
|
@@ -5177,7 +6136,7 @@ function createSpinnerSvgDefinition(variant) {
|
|
|
5177
6136
|
}
|
|
5178
6137
|
|
|
5179
6138
|
// src/components/atoms/spinner/spinner-recipe.ts
|
|
5180
|
-
function
|
|
6139
|
+
function cx14(...parts) {
|
|
5181
6140
|
return parts.filter(Boolean).join(" ");
|
|
5182
6141
|
}
|
|
5183
6142
|
function resolveSpinnerDataSize(size) {
|
|
@@ -5192,7 +6151,7 @@ function createSpinnerRecipe(options = {}) {
|
|
|
5192
6151
|
const resolvedSize = resolveSpinnerSize(requestedSize);
|
|
5193
6152
|
return {
|
|
5194
6153
|
tag: "span",
|
|
5195
|
-
className:
|
|
6154
|
+
className: cx14("mw-spinner", `mw-spinner--${variant}`),
|
|
5196
6155
|
vars: {
|
|
5197
6156
|
"--mw-spinner-size": `${resolvedSize}px`,
|
|
5198
6157
|
"--mw-spinner-rotation-duration": "800ms"
|
|
@@ -5264,7 +6223,7 @@ var FIGMA_TEXT_HEIGHT = 12;
|
|
|
5264
6223
|
var FIGMA_CIRCULAR_SIZE = 40;
|
|
5265
6224
|
var FIGMA_RECTANGULAR_SIZE = 120;
|
|
5266
6225
|
var FIGMA_RADIUS = 4;
|
|
5267
|
-
function
|
|
6226
|
+
function cx15(...parts) {
|
|
5268
6227
|
return parts.filter(Boolean).join(" ");
|
|
5269
6228
|
}
|
|
5270
6229
|
function toCssDimension(value) {
|
|
@@ -5289,7 +6248,7 @@ function createSkeletonRecipe(options = {}) {
|
|
|
5289
6248
|
const animation = options.animation ?? SkeletonAnimation.pulse;
|
|
5290
6249
|
return {
|
|
5291
6250
|
tag: "span",
|
|
5292
|
-
className:
|
|
6251
|
+
className: cx15(
|
|
5293
6252
|
"mw-skeleton",
|
|
5294
6253
|
`mw-skeleton--${variant}`,
|
|
5295
6254
|
animation !== SkeletonAnimation.none && `mw-skeleton--${animation}`
|
|
@@ -5308,6 +6267,117 @@ function createSkeletonRecipe(options = {}) {
|
|
|
5308
6267
|
};
|
|
5309
6268
|
}
|
|
5310
6269
|
|
|
6270
|
+
// src/components/atoms/progress-bar/progress-bar-a11y.ts
|
|
6271
|
+
var DEFAULT_PROGRESS_BAR_MIN = 0;
|
|
6272
|
+
var DEFAULT_PROGRESS_BAR_MAX = 100;
|
|
6273
|
+
var DEFAULT_PROGRESS_BAR_LABEL = "Progress";
|
|
6274
|
+
function resolveFiniteNumber(value, fallback) {
|
|
6275
|
+
return value === void 0 || !Number.isFinite(value) ? fallback : value;
|
|
6276
|
+
}
|
|
6277
|
+
function resolveProgressBarBounds(options) {
|
|
6278
|
+
const min = resolveFiniteNumber(options.min, DEFAULT_PROGRESS_BAR_MIN);
|
|
6279
|
+
const rawMax = resolveFiniteNumber(options.max, DEFAULT_PROGRESS_BAR_MAX);
|
|
6280
|
+
const max = rawMax > min ? rawMax : min + 1;
|
|
6281
|
+
return { min, max };
|
|
6282
|
+
}
|
|
6283
|
+
function clampProgressBarValue(value, min, max) {
|
|
6284
|
+
if (!Number.isFinite(value)) return min;
|
|
6285
|
+
return Math.min(max, Math.max(min, value));
|
|
6286
|
+
}
|
|
6287
|
+
function resolveProgressBarA11y(options, value) {
|
|
6288
|
+
const { min, max } = resolveProgressBarBounds(options);
|
|
6289
|
+
const label = options.label ?? DEFAULT_PROGRESS_BAR_LABEL;
|
|
6290
|
+
const labelId = options.id && options.showLabel !== false ? `${options.id}-label` : void 0;
|
|
6291
|
+
const ariaLabelledBy = options.ariaLabelledBy ?? labelId;
|
|
6292
|
+
const ariaLabel = ariaLabelledBy ? void 0 : options.ariaLabel ?? label;
|
|
6293
|
+
return {
|
|
6294
|
+
...options.id ? { id: options.id } : {},
|
|
6295
|
+
role: "progressbar",
|
|
6296
|
+
ariaValueMin: min,
|
|
6297
|
+
ariaValueMax: max,
|
|
6298
|
+
ariaValueNow: value,
|
|
6299
|
+
...options.valueLabel ? { ariaValueText: options.valueLabel } : {},
|
|
6300
|
+
...ariaLabel ? { ariaLabel } : {},
|
|
6301
|
+
...ariaLabelledBy ? { ariaLabelledBy } : {},
|
|
6302
|
+
...options.ariaDescribedBy ? { ariaDescribedBy: options.ariaDescribedBy } : {},
|
|
6303
|
+
...options.disabled ? { ariaDisabled: true } : {}
|
|
6304
|
+
};
|
|
6305
|
+
}
|
|
6306
|
+
|
|
6307
|
+
// src/components/atoms/progress-bar/progress-bar-types.ts
|
|
6308
|
+
var ProgressBarSize = {
|
|
6309
|
+
small: "small",
|
|
6310
|
+
default: "default"
|
|
6311
|
+
};
|
|
6312
|
+
var progressBarSizes = Object.values(ProgressBarSize);
|
|
6313
|
+
var ProgressBarState = {
|
|
6314
|
+
default: "default",
|
|
6315
|
+
hover: "hover",
|
|
6316
|
+
pressed: "pressed",
|
|
6317
|
+
focus: "focus"
|
|
6318
|
+
};
|
|
6319
|
+
var progressBarStates = Object.values(ProgressBarState);
|
|
6320
|
+
|
|
6321
|
+
// src/components/atoms/progress-bar/progress-bar-recipe.ts
|
|
6322
|
+
function cx16(...parts) {
|
|
6323
|
+
return parts.filter(Boolean).join(" ");
|
|
6324
|
+
}
|
|
6325
|
+
function resolveProgressBarPercentage(value, min, max) {
|
|
6326
|
+
const range2 = max - min;
|
|
6327
|
+
if (range2 <= 0) return 0;
|
|
6328
|
+
return (value - min) / range2 * 100;
|
|
6329
|
+
}
|
|
6330
|
+
function resolvePercentageLabel(percentage, valueLabel) {
|
|
6331
|
+
if (valueLabel) return valueLabel;
|
|
6332
|
+
return `${Math.round(percentage)}%`;
|
|
6333
|
+
}
|
|
6334
|
+
function createProgressBarRecipe(options = {}) {
|
|
6335
|
+
const { min, max } = resolveProgressBarBounds(options);
|
|
6336
|
+
const value = clampProgressBarValue(options.value ?? min, min, max);
|
|
6337
|
+
const percentage = resolveProgressBarPercentage(value, min, max);
|
|
6338
|
+
const size = options.size ?? ProgressBarSize.default;
|
|
6339
|
+
const state = options.state ?? ProgressBarState.default;
|
|
6340
|
+
const showLabel = options.showLabel !== false;
|
|
6341
|
+
const showPercentage = options.showPercentage !== false;
|
|
6342
|
+
const label = options.label ?? DEFAULT_PROGRESS_BAR_LABEL;
|
|
6343
|
+
const percentageLabel = resolvePercentageLabel(percentage, options.valueLabel);
|
|
6344
|
+
const a11y = resolveProgressBarA11y({ ...options, showLabel }, value);
|
|
6345
|
+
return {
|
|
6346
|
+
tag: "div",
|
|
6347
|
+
className: cx16(
|
|
6348
|
+
"mw-progress-bar",
|
|
6349
|
+
`mw-progress-bar--${size}`,
|
|
6350
|
+
state !== ProgressBarState.default && `mw-progress-bar--state-${state}`,
|
|
6351
|
+
options.disabled && "mw-progress-bar--disabled"
|
|
6352
|
+
),
|
|
6353
|
+
trackClassName: "mw-progress-bar__track",
|
|
6354
|
+
fillClassName: "mw-progress-bar__fill",
|
|
6355
|
+
labelClassName: "mw-progress-bar__label",
|
|
6356
|
+
percentageClassName: "mw-progress-bar__percentage",
|
|
6357
|
+
...a11y.ariaLabelledBy && options.id ? { labelId: `${options.id}-label` } : {},
|
|
6358
|
+
vars: {
|
|
6359
|
+
"--mw-progress-bar-value-percentage": `${percentage}%`
|
|
6360
|
+
},
|
|
6361
|
+
a11y,
|
|
6362
|
+
dataAttributes: {
|
|
6363
|
+
"data-component": "progress-bar",
|
|
6364
|
+
"data-size": size,
|
|
6365
|
+
"data-state": state,
|
|
6366
|
+
...options.disabled ? { "data-disabled": "true" } : {}
|
|
6367
|
+
},
|
|
6368
|
+
label,
|
|
6369
|
+
percentageLabel,
|
|
6370
|
+
value,
|
|
6371
|
+
min,
|
|
6372
|
+
max,
|
|
6373
|
+
percentage,
|
|
6374
|
+
size,
|
|
6375
|
+
state,
|
|
6376
|
+
showLabel,
|
|
6377
|
+
showPercentage
|
|
6378
|
+
};
|
|
6379
|
+
}
|
|
6380
|
+
|
|
5311
6381
|
// src/components/atoms/stat-tile/stat-tile-a11y.ts
|
|
5312
6382
|
function resolveStatTileTrendLabel(direction, trendValue) {
|
|
5313
6383
|
if (!direction || !trendValue) return void 0;
|
|
@@ -5451,6 +6521,9 @@ function createDayKit(day) {
|
|
|
5451
6521
|
function createDatePickerRecipe(opts = {}) {
|
|
5452
6522
|
const device = resolveDevice(opts.device);
|
|
5453
6523
|
const weeks = opts.weeks ?? defaultWeeks;
|
|
6524
|
+
const calendarLabel = opts.ariaLabel ?? opts.calendarLabel ?? "Choose date";
|
|
6525
|
+
const a11y = opts.ariaLabelledBy ? { ariaLabelledBy: opts.ariaLabelledBy } : { ariaLabel: calendarLabel };
|
|
6526
|
+
if (opts.ariaDescribedBy) a11y.ariaDescribedBy = opts.ariaDescribedBy;
|
|
5454
6527
|
return {
|
|
5455
6528
|
className: ["mw-date-picker", `mw-date-picker--${device}`].join(" "),
|
|
5456
6529
|
dataAttributes: {
|
|
@@ -5458,6 +6531,7 @@ function createDatePickerRecipe(opts = {}) {
|
|
|
5458
6531
|
"data-component": "date-picker",
|
|
5459
6532
|
"data-device": device
|
|
5460
6533
|
},
|
|
6534
|
+
a11y,
|
|
5461
6535
|
monthLabel: opts.monthLabel ?? "March 2026",
|
|
5462
6536
|
weekdayLabels: opts.weekdayLabels ?? defaultWeekdayLabels,
|
|
5463
6537
|
weeks,
|
|
@@ -5476,7 +6550,7 @@ function createDatePickerRecipe(opts = {}) {
|
|
|
5476
6550
|
footerButtonClassName: "mw-date-picker__footer-button"
|
|
5477
6551
|
},
|
|
5478
6552
|
labels: {
|
|
5479
|
-
calendar:
|
|
6553
|
+
calendar: calendarLabel,
|
|
5480
6554
|
previousYear: opts.previousYearLabel ?? "Previous year",
|
|
5481
6555
|
previousMonth: opts.previousMonthLabel ?? "Previous month",
|
|
5482
6556
|
nextMonth: opts.nextMonthLabel ?? "Next month",
|
|
@@ -10360,7 +11434,12 @@ function resolveInputA11y(opts) {
|
|
|
10360
11434
|
if (opts.inputMode) a11y.inputMode = opts.inputMode;
|
|
10361
11435
|
if (opts.autoComplete) a11y.autoComplete = opts.autoComplete;
|
|
10362
11436
|
if (opts.placeholder) a11y.placeholder = opts.placeholder;
|
|
10363
|
-
if (opts.
|
|
11437
|
+
if (opts.ariaLabelledBy) {
|
|
11438
|
+
a11y.ariaLabelledBy = opts.ariaLabelledBy;
|
|
11439
|
+
} else {
|
|
11440
|
+
const accessibleLabel = opts.ariaLabel ?? opts.label;
|
|
11441
|
+
if (accessibleLabel) a11y.ariaLabel = accessibleLabel;
|
|
11442
|
+
}
|
|
10364
11443
|
if (opts.invalid) a11y.ariaInvalid = true;
|
|
10365
11444
|
if (opts.describedBy) a11y.ariaDescribedBy = opts.describedBy;
|
|
10366
11445
|
return a11y;
|
|
@@ -10402,8 +11481,11 @@ function resolveInputOtpA11y(options) {
|
|
|
10402
11481
|
if (options.required) {
|
|
10403
11482
|
a11yProps.required = true;
|
|
10404
11483
|
}
|
|
10405
|
-
if (options.
|
|
10406
|
-
a11yProps.
|
|
11484
|
+
if (options.ariaLabelledBy) {
|
|
11485
|
+
a11yProps.ariaLabelledBy = options.ariaLabelledBy;
|
|
11486
|
+
} else {
|
|
11487
|
+
const accessibleLabel = options.ariaLabel ?? options.label;
|
|
11488
|
+
if (accessibleLabel) a11yProps.ariaLabel = accessibleLabel;
|
|
10407
11489
|
}
|
|
10408
11490
|
if (options.invalid) {
|
|
10409
11491
|
a11yProps.ariaInvalid = true;
|
|
@@ -10415,7 +11497,7 @@ function resolveInputOtpA11y(options) {
|
|
|
10415
11497
|
}
|
|
10416
11498
|
|
|
10417
11499
|
// src/components/atoms/input/input-otp-recipe.ts
|
|
10418
|
-
function
|
|
11500
|
+
function cx17(...parts) {
|
|
10419
11501
|
return parts.filter(Boolean).join(" ");
|
|
10420
11502
|
}
|
|
10421
11503
|
function sanitizeInputOtpValue(rawValue, length) {
|
|
@@ -10451,7 +11533,7 @@ function createInputOtpRecipe(options) {
|
|
|
10451
11533
|
};
|
|
10452
11534
|
return {
|
|
10453
11535
|
tag: "div",
|
|
10454
|
-
className:
|
|
11536
|
+
className: cx17(
|
|
10455
11537
|
"mw-input-otp",
|
|
10456
11538
|
options.invalid && "mw-input-otp--invalid",
|
|
10457
11539
|
options.disabled && "mw-input-otp--disabled",
|
|
@@ -10472,7 +11554,12 @@ function resolveSelectA11y(opts) {
|
|
|
10472
11554
|
if (opts.name) a11y.name = opts.name;
|
|
10473
11555
|
if (opts.disabled) a11y.disabled = true;
|
|
10474
11556
|
if (opts.required) a11y.required = true;
|
|
10475
|
-
if (opts.
|
|
11557
|
+
if (opts.ariaLabelledBy) {
|
|
11558
|
+
a11y.ariaLabelledBy = opts.ariaLabelledBy;
|
|
11559
|
+
} else {
|
|
11560
|
+
const accessibleLabel = opts.ariaLabel ?? opts.label;
|
|
11561
|
+
if (accessibleLabel) a11y.ariaLabel = accessibleLabel;
|
|
11562
|
+
}
|
|
10476
11563
|
if (opts.invalid) a11y.ariaInvalid = true;
|
|
10477
11564
|
if (opts.describedBy) a11y.ariaDescribedBy = opts.describedBy;
|
|
10478
11565
|
return a11y;
|
|
@@ -10515,7 +11602,12 @@ function resolveTextareaA11y(opts) {
|
|
|
10515
11602
|
if (opts.placeholder) a11y.placeholder = opts.placeholder;
|
|
10516
11603
|
if (opts.rows !== void 0) a11y.rows = opts.rows;
|
|
10517
11604
|
if (opts.cols !== void 0) a11y.cols = opts.cols;
|
|
10518
|
-
if (opts.
|
|
11605
|
+
if (opts.ariaLabelledBy) {
|
|
11606
|
+
a11y.ariaLabelledBy = opts.ariaLabelledBy;
|
|
11607
|
+
} else {
|
|
11608
|
+
const accessibleLabel = opts.ariaLabel ?? opts.label;
|
|
11609
|
+
if (accessibleLabel) a11y.ariaLabel = accessibleLabel;
|
|
11610
|
+
}
|
|
10519
11611
|
if (opts.invalid) a11y.ariaInvalid = true;
|
|
10520
11612
|
if (opts.describedBy) a11y.ariaDescribedBy = opts.describedBy;
|
|
10521
11613
|
return a11y;
|
|
@@ -10545,7 +11637,8 @@ function resolveRichTextA11y(opts) {
|
|
|
10545
11637
|
ariaMultiline: true
|
|
10546
11638
|
};
|
|
10547
11639
|
if (opts.id) a11y.id = opts.id;
|
|
10548
|
-
|
|
11640
|
+
const accessibleLabel = opts.ariaLabel ?? opts.label;
|
|
11641
|
+
if (accessibleLabel) a11y.ariaLabel = accessibleLabel;
|
|
10549
11642
|
if (opts.labelledBy) a11y.ariaLabelledBy = opts.labelledBy;
|
|
10550
11643
|
if (opts.describedBy) a11y.ariaDescribedBy = opts.describedBy;
|
|
10551
11644
|
if (opts.invalid) a11y.ariaInvalid = true;
|
|
@@ -10623,7 +11716,14 @@ function normalizeRichTextHtml(rawHtml) {
|
|
|
10623
11716
|
if (!trimmedHtml.includes("<")) {
|
|
10624
11717
|
return escapeRichTextHtml(trimmedHtml);
|
|
10625
11718
|
}
|
|
10626
|
-
|
|
11719
|
+
let normalizedHtml = trimmedHtml.replace(/<b(?:\s[^>]*)?>/gi, "<strong>").replace(/<\/b>/gi, "</strong>").replace(/<i(?:\s[^>]*)?>/gi, "<em>").replace(/<\/i>/gi, "</em>").replace(blockTagPattern, "<p>").replace(closingBlockTagPattern, "</p>").replace(openingParagraphPattern, "<p>").replace(openingStrongPattern, "<strong>").replace(openingEmphasisPattern, "<em>").replace(openingUnderlinePattern, "<u>").replace(lineBreakPattern, "<br>");
|
|
11720
|
+
let previous;
|
|
11721
|
+
do {
|
|
11722
|
+
previous = normalizedHtml;
|
|
11723
|
+
normalizedHtml = normalizedHtml.replace(disallowedTagPattern, "");
|
|
11724
|
+
} while (normalizedHtml !== previous);
|
|
11725
|
+
normalizedHtml = normalizedHtml.replace(unsupportedAnglePattern, "<");
|
|
11726
|
+
normalizedHtml = normalizedHtml.replace(/\s+/g, " ").trim();
|
|
10627
11727
|
return isRichTextHtmlEmpty(normalizedHtml) ? "" : normalizedHtml;
|
|
10628
11728
|
}
|
|
10629
11729
|
function isRichTextHtmlEmpty(rawHtml) {
|
|
@@ -10683,6 +11783,27 @@ function paragraphRecipe(opts, theme) {
|
|
|
10683
11783
|
};
|
|
10684
11784
|
}
|
|
10685
11785
|
|
|
11786
|
+
// src/components/atoms/text/text-recipe.ts
|
|
11787
|
+
function textRecipe(opts, theme) {
|
|
11788
|
+
const variant = opts.variant ?? "caption";
|
|
11789
|
+
const tag = opts.headingLevel ? `h${opts.headingLevel}` : opts.as ?? "span";
|
|
11790
|
+
const className = ["mw-text", `mw-text--${variant}`].filter(Boolean).join(" ");
|
|
11791
|
+
const typo = theme.typography.text[variant];
|
|
11792
|
+
const vars = {
|
|
11793
|
+
"--mw-text-size": `${typo.fontSize}px`,
|
|
11794
|
+
"--mw-text-line-height": `${typo.lineHeight}`,
|
|
11795
|
+
"--mw-text-weight": `${typo.fontWeight}`,
|
|
11796
|
+
"--mw-text-letter-spacing": `${typo.letterSpacing}px`,
|
|
11797
|
+
"--mw-text-transform": typo.textTransform ?? "none"
|
|
11798
|
+
};
|
|
11799
|
+
return {
|
|
11800
|
+
tag,
|
|
11801
|
+
className,
|
|
11802
|
+
vars,
|
|
11803
|
+
a11y: opts.id ? { id: opts.id } : {}
|
|
11804
|
+
};
|
|
11805
|
+
}
|
|
11806
|
+
|
|
10686
11807
|
// src/components/atoms/tab/tab-a11y.ts
|
|
10687
11808
|
function resolveTabA11y(opts) {
|
|
10688
11809
|
const a11y = {
|
|
@@ -10693,19 +11814,20 @@ function resolveTabA11y(opts) {
|
|
|
10693
11814
|
tabIndex: opts.selected && !opts.disabled ? 0 : -1
|
|
10694
11815
|
};
|
|
10695
11816
|
if (opts.disabled) a11y.ariaDisabled = true;
|
|
10696
|
-
|
|
11817
|
+
const accessibleLabel = opts.ariaLabel ?? opts.label;
|
|
11818
|
+
if (accessibleLabel) a11y.ariaLabel = accessibleLabel;
|
|
10697
11819
|
if (opts.ariaControls) a11y.ariaControls = opts.ariaControls;
|
|
10698
11820
|
return a11y;
|
|
10699
11821
|
}
|
|
10700
11822
|
|
|
10701
11823
|
// src/components/atoms/tab/tab-recipe.ts
|
|
10702
|
-
function
|
|
11824
|
+
function cx18(...parts) {
|
|
10703
11825
|
return parts.filter(Boolean).join(" ");
|
|
10704
11826
|
}
|
|
10705
11827
|
function createTabRecipe(opts) {
|
|
10706
11828
|
return {
|
|
10707
11829
|
tag: "button",
|
|
10708
|
-
className:
|
|
11830
|
+
className: cx18(
|
|
10709
11831
|
"mw-tab",
|
|
10710
11832
|
opts.selected && "mw-tab--selected",
|
|
10711
11833
|
opts.disabled && "mw-tab--disabled"
|
|
@@ -10796,6 +11918,7 @@ var Spacings = {
|
|
|
10796
11918
|
sp2: "sp-2",
|
|
10797
11919
|
sp4: "sp-4",
|
|
10798
11920
|
sp8: "sp-8",
|
|
11921
|
+
sp12: "sp-12",
|
|
10799
11922
|
sp16: "sp-16",
|
|
10800
11923
|
sp24: "sp-24",
|
|
10801
11924
|
sp32: "sp-32",
|
|
@@ -10814,6 +11937,7 @@ var Spacings = {
|
|
|
10814
11937
|
"sp-2": "sp-2",
|
|
10815
11938
|
"sp-4": "sp-4",
|
|
10816
11939
|
"sp-8": "sp-8",
|
|
11940
|
+
"sp-12": "sp-12",
|
|
10817
11941
|
"sp-16": "sp-16",
|
|
10818
11942
|
"sp-24": "sp-24",
|
|
10819
11943
|
"sp-32": "sp-32",
|
|
@@ -10830,6 +11954,478 @@ var Spacings = {
|
|
|
10830
11954
|
"sp-120": "sp-120"
|
|
10831
11955
|
};
|
|
10832
11956
|
|
|
11957
|
+
// src/components/atoms/segmented-control/segmented-control-a11y.ts
|
|
11958
|
+
function resolveSegmentedControlA11y(opts) {
|
|
11959
|
+
const a11y = {
|
|
11960
|
+
role: "radiogroup"
|
|
11961
|
+
};
|
|
11962
|
+
if (opts.ariaLabelledBy) {
|
|
11963
|
+
a11y.ariaLabelledBy = opts.ariaLabelledBy;
|
|
11964
|
+
} else {
|
|
11965
|
+
const accessibleLabel = opts.ariaLabel ?? opts.label;
|
|
11966
|
+
if (accessibleLabel) a11y.ariaLabel = accessibleLabel;
|
|
11967
|
+
}
|
|
11968
|
+
if (opts.ariaDescribedBy) a11y.ariaDescribedBy = opts.ariaDescribedBy;
|
|
11969
|
+
if (opts.disabled) a11y.ariaDisabled = true;
|
|
11970
|
+
return a11y;
|
|
11971
|
+
}
|
|
11972
|
+
function resolveSegmentedControlItemA11y(opts) {
|
|
11973
|
+
const a11y = {
|
|
11974
|
+
role: "radio",
|
|
11975
|
+
ariaChecked: opts.selected ?? false,
|
|
11976
|
+
tabIndex: opts.selected && !opts.disabled ? 0 : -1
|
|
11977
|
+
};
|
|
11978
|
+
if (opts.disabled) a11y.ariaDisabled = true;
|
|
11979
|
+
const accessibleLabel = opts.ariaLabel ?? opts.label;
|
|
11980
|
+
if (accessibleLabel) a11y.ariaLabel = accessibleLabel;
|
|
11981
|
+
return a11y;
|
|
11982
|
+
}
|
|
11983
|
+
function resolveSegmentedControlValue(items, requestedValue) {
|
|
11984
|
+
if (items.length === 0) return void 0;
|
|
11985
|
+
if (requestedValue) {
|
|
11986
|
+
const match = items.find((item) => item.value === requestedValue && !item.disabled);
|
|
11987
|
+
if (match) return match.value;
|
|
11988
|
+
}
|
|
11989
|
+
return items.find((item) => !item.disabled)?.value;
|
|
11990
|
+
}
|
|
11991
|
+
function moveSegmentedControlSelection(items, currentValue, direction) {
|
|
11992
|
+
const enabled = items.filter((item) => !item.disabled);
|
|
11993
|
+
if (enabled.length === 0) return void 0;
|
|
11994
|
+
if (direction === "start") return enabled[0]?.value;
|
|
11995
|
+
if (direction === "end") return enabled[enabled.length - 1]?.value;
|
|
11996
|
+
const currentIndex = enabled.findIndex((item) => item.value === currentValue);
|
|
11997
|
+
if (currentIndex === -1) return enabled[0]?.value;
|
|
11998
|
+
const delta = direction === "next" ? 1 : -1;
|
|
11999
|
+
const nextIndex = (currentIndex + delta + enabled.length) % enabled.length;
|
|
12000
|
+
return enabled[nextIndex]?.value;
|
|
12001
|
+
}
|
|
12002
|
+
|
|
12003
|
+
// src/components/atoms/segmented-control/segmented-control-recipe.ts
|
|
12004
|
+
function cx19(...parts) {
|
|
12005
|
+
return parts.filter(Boolean).join(" ");
|
|
12006
|
+
}
|
|
12007
|
+
function createSegmentedControlRecipe(opts) {
|
|
12008
|
+
const variant = opts.variant ?? "default";
|
|
12009
|
+
const size = opts.size ?? "md";
|
|
12010
|
+
return {
|
|
12011
|
+
tag: "div",
|
|
12012
|
+
className: cx19(
|
|
12013
|
+
"mw-segmented-control",
|
|
12014
|
+
variant !== "default" && `mw-segmented-control--${variant}`,
|
|
12015
|
+
size !== "md" && `mw-segmented-control--${size}`,
|
|
12016
|
+
opts.disabled && "mw-segmented-control--disabled",
|
|
12017
|
+
opts.fullWidth && "mw-segmented-control--full-width"
|
|
12018
|
+
),
|
|
12019
|
+
vars: {},
|
|
12020
|
+
a11y: resolveSegmentedControlA11y(opts)
|
|
12021
|
+
};
|
|
12022
|
+
}
|
|
12023
|
+
function createSegmentedControlItemRecipe(opts) {
|
|
12024
|
+
return {
|
|
12025
|
+
tag: "button",
|
|
12026
|
+
className: cx19(
|
|
12027
|
+
"mw-segmented-control__item",
|
|
12028
|
+
opts.selected && "mw-segmented-control__item--selected",
|
|
12029
|
+
opts.disabled && "mw-segmented-control__item--disabled",
|
|
12030
|
+
opts.iconOnly && "mw-segmented-control__item--icon-only"
|
|
12031
|
+
),
|
|
12032
|
+
vars: {},
|
|
12033
|
+
a11y: resolveSegmentedControlItemA11y(opts)
|
|
12034
|
+
};
|
|
12035
|
+
}
|
|
12036
|
+
|
|
12037
|
+
// src/components/atoms/pagination/pagination-a11y.ts
|
|
12038
|
+
function resolvePaginationA11y(opts) {
|
|
12039
|
+
const a11y = {};
|
|
12040
|
+
if (opts.ariaLabelledBy) {
|
|
12041
|
+
a11y.ariaLabelledBy = opts.ariaLabelledBy;
|
|
12042
|
+
} else {
|
|
12043
|
+
a11y.ariaLabel = opts.ariaLabel ?? "Pagination";
|
|
12044
|
+
}
|
|
12045
|
+
if (opts.ariaDescribedBy) a11y.ariaDescribedBy = opts.ariaDescribedBy;
|
|
12046
|
+
if (opts.disabled) a11y.ariaDisabled = true;
|
|
12047
|
+
return a11y;
|
|
12048
|
+
}
|
|
12049
|
+
function resolvePaginationListA11y() {
|
|
12050
|
+
return { role: "list" };
|
|
12051
|
+
}
|
|
12052
|
+
function resolvePaginationControlA11y(opts) {
|
|
12053
|
+
const fallbackByDirection = {
|
|
12054
|
+
first: "First page",
|
|
12055
|
+
previous: "Previous page",
|
|
12056
|
+
next: "Next page",
|
|
12057
|
+
last: "Last page"
|
|
12058
|
+
};
|
|
12059
|
+
const a11y = {
|
|
12060
|
+
ariaLabel: opts.ariaLabel ?? opts.label ?? fallbackByDirection[opts.direction]
|
|
12061
|
+
};
|
|
12062
|
+
if (opts.disabled) a11y.ariaDisabled = true;
|
|
12063
|
+
return a11y;
|
|
12064
|
+
}
|
|
12065
|
+
function resolvePaginationPageA11y(opts) {
|
|
12066
|
+
const a11y = {
|
|
12067
|
+
ariaLabel: opts.ariaLabel ?? (opts.selected ? `Page ${opts.page}, current page` : `Go to page ${opts.page}`)
|
|
12068
|
+
};
|
|
12069
|
+
if (opts.selected) a11y.ariaCurrent = "page";
|
|
12070
|
+
if (opts.disabled) a11y.ariaDisabled = true;
|
|
12071
|
+
return a11y;
|
|
12072
|
+
}
|
|
12073
|
+
function resolvePaginationEllipsisA11y() {
|
|
12074
|
+
return { ariaHidden: true };
|
|
12075
|
+
}
|
|
12076
|
+
function resolvePaginationItemAriaLabel(getItemAriaLabel, item) {
|
|
12077
|
+
return getItemAriaLabel?.(item);
|
|
12078
|
+
}
|
|
12079
|
+
|
|
12080
|
+
// src/components/atoms/pagination/pagination-recipe.ts
|
|
12081
|
+
function cx20(...parts) {
|
|
12082
|
+
return parts.filter(Boolean).join(" ");
|
|
12083
|
+
}
|
|
12084
|
+
function normalizeCount(value, fallback) {
|
|
12085
|
+
if (value === void 0) return fallback;
|
|
12086
|
+
if (!Number.isFinite(value)) return fallback;
|
|
12087
|
+
return Math.max(0, Math.floor(value));
|
|
12088
|
+
}
|
|
12089
|
+
function range(start, end) {
|
|
12090
|
+
if (end < start) return [];
|
|
12091
|
+
return Array.from({ length: end - start + 1 }, (_, index) => start + index);
|
|
12092
|
+
}
|
|
12093
|
+
function toPageItem(pageNumber, currentPage) {
|
|
12094
|
+
return {
|
|
12095
|
+
type: "page",
|
|
12096
|
+
page: pageNumber,
|
|
12097
|
+
key: `page-${pageNumber}`,
|
|
12098
|
+
selected: pageNumber === currentPage
|
|
12099
|
+
};
|
|
12100
|
+
}
|
|
12101
|
+
function clampPaginationPage(page, pageCount) {
|
|
12102
|
+
const normalizedPageCount = normalizeCount(pageCount, 0);
|
|
12103
|
+
if (normalizedPageCount <= 0) return 0;
|
|
12104
|
+
if (page === void 0 || !Number.isFinite(page)) return 1;
|
|
12105
|
+
return Math.min(Math.max(1, Math.floor(page)), normalizedPageCount);
|
|
12106
|
+
}
|
|
12107
|
+
function resolvePaginationAdaptiveMaxVisibleItems(opts) {
|
|
12108
|
+
const containerWidth = Math.max(0, opts.containerWidth);
|
|
12109
|
+
if (containerWidth <= 0) return void 0;
|
|
12110
|
+
const itemSize = opts.itemSize ?? 32;
|
|
12111
|
+
const itemGap = opts.itemGap ?? 2;
|
|
12112
|
+
const sectionGap = opts.sectionGap ?? 12;
|
|
12113
|
+
const controlWidth = opts.controlWidth ?? 0;
|
|
12114
|
+
const controlCount = opts.controlCount ?? 0;
|
|
12115
|
+
const controlGaps = controlCount > 0 ? sectionGap * controlCount : 0;
|
|
12116
|
+
const availableItemWidth = Math.max(0, containerWidth - controlWidth - controlGaps);
|
|
12117
|
+
return Math.max(1, Math.floor((availableItemWidth + itemGap) / (itemSize + itemGap)));
|
|
12118
|
+
}
|
|
12119
|
+
function resolvePaginationListWidth(itemCount, itemSize, itemGap) {
|
|
12120
|
+
if (itemCount <= 0) return 0;
|
|
12121
|
+
return itemCount * itemSize + Math.max(0, itemCount - 1) * itemGap;
|
|
12122
|
+
}
|
|
12123
|
+
function resolvePaginationLayoutWidth(itemCount, controlWidth, controlCount, itemSize, itemGap, sectionGap) {
|
|
12124
|
+
const controlGaps = controlCount > 0 ? sectionGap * controlCount : 0;
|
|
12125
|
+
return controlWidth + controlGaps + resolvePaginationListWidth(itemCount, itemSize, itemGap);
|
|
12126
|
+
}
|
|
12127
|
+
function resolvePaginationReducedItemCount(opts, controlWidth) {
|
|
12128
|
+
return resolvePaginationAdaptiveMaxVisibleItems({
|
|
12129
|
+
containerWidth: opts.containerWidth,
|
|
12130
|
+
controlWidth,
|
|
12131
|
+
...opts.controlCount !== void 0 ? { controlCount: opts.controlCount } : {},
|
|
12132
|
+
...opts.itemSize !== void 0 ? { itemSize: opts.itemSize } : {},
|
|
12133
|
+
...opts.itemGap !== void 0 ? { itemGap: opts.itemGap } : {},
|
|
12134
|
+
...opts.sectionGap !== void 0 ? { sectionGap: opts.sectionGap } : {}
|
|
12135
|
+
});
|
|
12136
|
+
}
|
|
12137
|
+
function createPaginationAdaptiveProfile(opts, controlDisplay, maxVisibleItems) {
|
|
12138
|
+
return {
|
|
12139
|
+
controlDisplay,
|
|
12140
|
+
maxVisibleItems,
|
|
12141
|
+
reservedItemCount: resolvePaginationReservedItemCount({
|
|
12142
|
+
pageCount: opts.pageCount,
|
|
12143
|
+
...opts.siblingCount !== void 0 ? { siblingCount: opts.siblingCount } : {},
|
|
12144
|
+
...opts.boundaryCount !== void 0 ? { boundaryCount: opts.boundaryCount } : {},
|
|
12145
|
+
...maxVisibleItems !== void 0 ? { maxVisibleItems } : {}
|
|
12146
|
+
})
|
|
12147
|
+
};
|
|
12148
|
+
}
|
|
12149
|
+
function resolvePaginationAdaptiveProfile(opts) {
|
|
12150
|
+
const containerWidth = Math.max(0, opts.containerWidth);
|
|
12151
|
+
const pageCount = normalizeCount(opts.pageCount, 0);
|
|
12152
|
+
const controlDisplay = opts.controlDisplay ?? "auto";
|
|
12153
|
+
if (containerWidth <= 0 || pageCount <= 0) {
|
|
12154
|
+
return createPaginationAdaptiveProfile(
|
|
12155
|
+
opts,
|
|
12156
|
+
controlDisplay === "icon" ? "icon" : "label",
|
|
12157
|
+
void 0
|
|
12158
|
+
);
|
|
12159
|
+
}
|
|
12160
|
+
const itemSize = opts.itemSize ?? 32;
|
|
12161
|
+
const itemGap = opts.itemGap ?? 2;
|
|
12162
|
+
const sectionGap = opts.sectionGap ?? 12;
|
|
12163
|
+
const controlCount = opts.controlCount ?? 0;
|
|
12164
|
+
const labelControlWidth = opts.labelControlWidth ?? opts.iconControlWidth ?? 0;
|
|
12165
|
+
const iconControlWidth = opts.iconControlWidth ?? labelControlWidth;
|
|
12166
|
+
const preferredItemCount = resolvePaginationReservedItemCount(opts);
|
|
12167
|
+
const preferredMaxVisibleItems = preferredItemCount > 0 ? preferredItemCount : void 0;
|
|
12168
|
+
const labelWidth = resolvePaginationLayoutWidth(
|
|
12169
|
+
preferredItemCount,
|
|
12170
|
+
labelControlWidth,
|
|
12171
|
+
controlCount,
|
|
12172
|
+
itemSize,
|
|
12173
|
+
itemGap,
|
|
12174
|
+
sectionGap
|
|
12175
|
+
);
|
|
12176
|
+
const iconWidth = resolvePaginationLayoutWidth(
|
|
12177
|
+
preferredItemCount,
|
|
12178
|
+
iconControlWidth,
|
|
12179
|
+
controlCount,
|
|
12180
|
+
itemSize,
|
|
12181
|
+
itemGap,
|
|
12182
|
+
sectionGap
|
|
12183
|
+
);
|
|
12184
|
+
if (controlDisplay === "label") {
|
|
12185
|
+
const maxVisibleItems = labelWidth <= containerWidth ? preferredMaxVisibleItems : resolvePaginationReducedItemCount(opts, labelControlWidth);
|
|
12186
|
+
return createPaginationAdaptiveProfile(opts, "label", maxVisibleItems);
|
|
12187
|
+
}
|
|
12188
|
+
if (controlDisplay === "icon") {
|
|
12189
|
+
const maxVisibleItems = iconWidth <= containerWidth ? preferredMaxVisibleItems : resolvePaginationReducedItemCount(opts, iconControlWidth);
|
|
12190
|
+
return createPaginationAdaptiveProfile(opts, "icon", maxVisibleItems);
|
|
12191
|
+
}
|
|
12192
|
+
if (labelWidth <= containerWidth) {
|
|
12193
|
+
return createPaginationAdaptiveProfile(opts, "label", preferredMaxVisibleItems);
|
|
12194
|
+
}
|
|
12195
|
+
if (iconWidth <= containerWidth) {
|
|
12196
|
+
return createPaginationAdaptiveProfile(opts, "icon", preferredMaxVisibleItems);
|
|
12197
|
+
}
|
|
12198
|
+
return createPaginationAdaptiveProfile(
|
|
12199
|
+
opts,
|
|
12200
|
+
"icon",
|
|
12201
|
+
resolvePaginationReducedItemCount(opts, iconControlWidth)
|
|
12202
|
+
);
|
|
12203
|
+
}
|
|
12204
|
+
function resolvePaginationReservedItemCount(opts) {
|
|
12205
|
+
const pageCount = normalizeCount(opts.pageCount, 0);
|
|
12206
|
+
if (pageCount <= 0) return 0;
|
|
12207
|
+
const maxVisibleItems = resolvePaginationEffectiveMaxVisibleItems(opts);
|
|
12208
|
+
if (maxVisibleItems > 0) return Math.min(pageCount, maxVisibleItems);
|
|
12209
|
+
const siblingCount = normalizeCount(opts.siblingCount, 1);
|
|
12210
|
+
const boundaryCount = normalizeCount(opts.boundaryCount, 1);
|
|
12211
|
+
const slotsWithEllipsis = boundaryCount * 2 + siblingCount * 2 + 3;
|
|
12212
|
+
return Math.min(pageCount, slotsWithEllipsis);
|
|
12213
|
+
}
|
|
12214
|
+
function resolvePaginationEffectiveMaxVisibleItems(opts) {
|
|
12215
|
+
const maxVisibleItems = normalizeCount(opts.maxVisibleItems, 0);
|
|
12216
|
+
if (maxVisibleItems <= 0) return 0;
|
|
12217
|
+
const siblingCount = normalizeCount(opts.siblingCount, 1);
|
|
12218
|
+
if (maxVisibleItems < 6 || siblingCount < 1) return maxVisibleItems;
|
|
12219
|
+
const pageCount = normalizeCount(opts.pageCount, 0);
|
|
12220
|
+
const boundaryCount = normalizeCount(opts.boundaryCount, 1);
|
|
12221
|
+
const muiMiddleRangeCount = boundaryCount * 2 + 5;
|
|
12222
|
+
return Math.min(pageCount, Math.max(maxVisibleItems, muiMiddleRangeCount));
|
|
12223
|
+
}
|
|
12224
|
+
function createFixedPaginationItems(opts) {
|
|
12225
|
+
const pageCount = normalizeCount(opts.pageCount, 0);
|
|
12226
|
+
if (pageCount <= 0) return [];
|
|
12227
|
+
const page = clampPaginationPage(opts.page, pageCount);
|
|
12228
|
+
const siblingCount = normalizeCount(opts.siblingCount, 1);
|
|
12229
|
+
const boundaryCount = normalizeCount(opts.boundaryCount, 1);
|
|
12230
|
+
const slotsWithoutEllipsis = boundaryCount * 2 + siblingCount * 2 + 1;
|
|
12231
|
+
const slotsWithEllipsis = slotsWithoutEllipsis + 2;
|
|
12232
|
+
if (pageCount <= slotsWithEllipsis) {
|
|
12233
|
+
return range(1, pageCount).map((pageNumber) => toPageItem(pageNumber, page));
|
|
12234
|
+
}
|
|
12235
|
+
const items = [];
|
|
12236
|
+
const startPages = range(1, Math.min(boundaryCount, pageCount));
|
|
12237
|
+
const endPages = range(Math.max(pageCount - boundaryCount + 1, boundaryCount + 1), pageCount);
|
|
12238
|
+
const leftSibling = Math.max(page - siblingCount, boundaryCount + 1);
|
|
12239
|
+
const rightSibling = Math.min(page + siblingCount, pageCount - boundaryCount);
|
|
12240
|
+
for (const pageNumber of startPages) items.push(toPageItem(pageNumber, page));
|
|
12241
|
+
if (leftSibling > boundaryCount + 1) {
|
|
12242
|
+
items.push({ type: "start-ellipsis", key: "ellipsis-start" });
|
|
12243
|
+
} else {
|
|
12244
|
+
for (const pageNumber of range(boundaryCount + 1, leftSibling - 1)) {
|
|
12245
|
+
items.push(toPageItem(pageNumber, page));
|
|
12246
|
+
}
|
|
12247
|
+
}
|
|
12248
|
+
for (const pageNumber of range(leftSibling, rightSibling)) {
|
|
12249
|
+
items.push(toPageItem(pageNumber, page));
|
|
12250
|
+
}
|
|
12251
|
+
if (rightSibling < pageCount - boundaryCount) {
|
|
12252
|
+
items.push({ type: "end-ellipsis", key: "ellipsis-end" });
|
|
12253
|
+
} else {
|
|
12254
|
+
for (const pageNumber of range(rightSibling + 1, pageCount - boundaryCount)) {
|
|
12255
|
+
items.push(toPageItem(pageNumber, page));
|
|
12256
|
+
}
|
|
12257
|
+
}
|
|
12258
|
+
for (const pageNumber of endPages) items.push(toPageItem(pageNumber, page));
|
|
12259
|
+
return items;
|
|
12260
|
+
}
|
|
12261
|
+
function createCompactPaginationItems(opts, maxVisibleItems) {
|
|
12262
|
+
const pageCount = normalizeCount(opts.pageCount, 0);
|
|
12263
|
+
const page = clampPaginationPage(opts.page, pageCount);
|
|
12264
|
+
if (pageCount <= 0 || maxVisibleItems <= 0) return [];
|
|
12265
|
+
if (maxVisibleItems === 1 || pageCount === 1) return [toPageItem(page, page)];
|
|
12266
|
+
if (maxVisibleItems === 2) {
|
|
12267
|
+
const edgePage = page === pageCount ? 1 : pageCount;
|
|
12268
|
+
return [page, edgePage].sort((a, b) => a - b).map((pageNumber) => toPageItem(pageNumber, page));
|
|
12269
|
+
}
|
|
12270
|
+
if (maxVisibleItems === 3) {
|
|
12271
|
+
return Array.from(/* @__PURE__ */ new Set([1, page, pageCount])).slice(0, maxVisibleItems).map((pageNumber) => toPageItem(pageNumber, page));
|
|
12272
|
+
}
|
|
12273
|
+
if (page <= 2) {
|
|
12274
|
+
return [
|
|
12275
|
+
toPageItem(1, page),
|
|
12276
|
+
toPageItem(2, page),
|
|
12277
|
+
{ type: "end-ellipsis", key: "ellipsis-end" },
|
|
12278
|
+
toPageItem(pageCount, page)
|
|
12279
|
+
];
|
|
12280
|
+
}
|
|
12281
|
+
if (page >= pageCount - 1) {
|
|
12282
|
+
return [
|
|
12283
|
+
toPageItem(1, page),
|
|
12284
|
+
{ type: "start-ellipsis", key: "ellipsis-start" },
|
|
12285
|
+
toPageItem(pageCount - 1, page),
|
|
12286
|
+
toPageItem(pageCount, page)
|
|
12287
|
+
];
|
|
12288
|
+
}
|
|
12289
|
+
return [
|
|
12290
|
+
toPageItem(1, page),
|
|
12291
|
+
{ type: "start-ellipsis", key: "ellipsis-start" },
|
|
12292
|
+
toPageItem(page, page),
|
|
12293
|
+
toPageItem(pageCount, page)
|
|
12294
|
+
];
|
|
12295
|
+
}
|
|
12296
|
+
function fillEdgePaginationItems(opts, maxVisibleItems, items) {
|
|
12297
|
+
const pageCount = normalizeCount(opts.pageCount, 0);
|
|
12298
|
+
const boundaryCount = normalizeCount(opts.boundaryCount, 1);
|
|
12299
|
+
const hasStartEllipsis = items.some((item) => item.type === "start-ellipsis");
|
|
12300
|
+
const hasEndEllipsis = items.some((item) => item.type === "end-ellipsis");
|
|
12301
|
+
if (items.length >= maxVisibleItems || pageCount <= maxVisibleItems) return items;
|
|
12302
|
+
if (hasStartEllipsis === hasEndEllipsis) return items;
|
|
12303
|
+
const page = clampPaginationPage(opts.page, pageCount);
|
|
12304
|
+
const edgePageCount = Math.max(boundaryCount + 1, maxVisibleItems - boundaryCount - 1);
|
|
12305
|
+
if (hasEndEllipsis) {
|
|
12306
|
+
const leadingPages = range(1, Math.min(edgePageCount, pageCount - boundaryCount - 1));
|
|
12307
|
+
return [
|
|
12308
|
+
...leadingPages.map((pageNumber) => toPageItem(pageNumber, page)),
|
|
12309
|
+
{ type: "end-ellipsis", key: "ellipsis-end" },
|
|
12310
|
+
...range(Math.max(pageCount - boundaryCount + 1, edgePageCount + 1), pageCount).map(
|
|
12311
|
+
(pageNumber) => toPageItem(pageNumber, page)
|
|
12312
|
+
)
|
|
12313
|
+
];
|
|
12314
|
+
}
|
|
12315
|
+
const trailingPages = range(Math.max(pageCount - edgePageCount + 1, boundaryCount + 2), pageCount);
|
|
12316
|
+
return [
|
|
12317
|
+
...range(1, Math.min(boundaryCount, pageCount)).map(
|
|
12318
|
+
(pageNumber) => toPageItem(pageNumber, page)
|
|
12319
|
+
),
|
|
12320
|
+
{ type: "start-ellipsis", key: "ellipsis-start" },
|
|
12321
|
+
...trailingPages.map((pageNumber) => toPageItem(pageNumber, page))
|
|
12322
|
+
];
|
|
12323
|
+
}
|
|
12324
|
+
function createPaginationItems(opts) {
|
|
12325
|
+
const pageCount = normalizeCount(opts.pageCount, 0);
|
|
12326
|
+
const maxVisibleItems = resolvePaginationEffectiveMaxVisibleItems(opts);
|
|
12327
|
+
if (pageCount <= 0) return [];
|
|
12328
|
+
if (maxVisibleItems <= 0) return createFixedPaginationItems(opts);
|
|
12329
|
+
if (pageCount <= maxVisibleItems) return createFixedPaginationItems(opts);
|
|
12330
|
+
const siblingCount = normalizeCount(opts.siblingCount, 1);
|
|
12331
|
+
const boundaryCount = normalizeCount(opts.boundaryCount, 1);
|
|
12332
|
+
for (let nextBoundaryCount = boundaryCount; nextBoundaryCount >= 1; nextBoundaryCount -= 1) {
|
|
12333
|
+
for (let nextSiblingCount = siblingCount; nextSiblingCount >= 0; nextSiblingCount -= 1) {
|
|
12334
|
+
const items = createFixedPaginationItems({
|
|
12335
|
+
...opts,
|
|
12336
|
+
boundaryCount: nextBoundaryCount,
|
|
12337
|
+
siblingCount: nextSiblingCount
|
|
12338
|
+
});
|
|
12339
|
+
if (items.length <= maxVisibleItems) {
|
|
12340
|
+
return fillEdgePaginationItems(opts, maxVisibleItems, items);
|
|
12341
|
+
}
|
|
12342
|
+
}
|
|
12343
|
+
}
|
|
12344
|
+
return createCompactPaginationItems(opts, maxVisibleItems);
|
|
12345
|
+
}
|
|
12346
|
+
function createPaginationRecipe(opts) {
|
|
12347
|
+
const reservedItemCount = resolvePaginationReservedItemCount(opts);
|
|
12348
|
+
const controlDisplay = opts.controlDisplay === "icon" ? "icon" : "label";
|
|
12349
|
+
return {
|
|
12350
|
+
tag: "nav",
|
|
12351
|
+
className: cx20(
|
|
12352
|
+
"mw-pagination",
|
|
12353
|
+
`mw-pagination--controls-${controlDisplay}`,
|
|
12354
|
+
opts.disabled && "mw-pagination--disabled"
|
|
12355
|
+
),
|
|
12356
|
+
vars: reservedItemCount > 0 ? {
|
|
12357
|
+
"--mw-pagination-list-width": `calc(${reservedItemCount} * var(--mw-pagination-size) + ${Math.max(
|
|
12358
|
+
0,
|
|
12359
|
+
reservedItemCount - 1
|
|
12360
|
+
)} * var(--mw-pagination-gap))`
|
|
12361
|
+
} : {},
|
|
12362
|
+
a11y: resolvePaginationA11y(opts),
|
|
12363
|
+
items: createPaginationItems(opts),
|
|
12364
|
+
reservedItemCount,
|
|
12365
|
+
controlDisplay,
|
|
12366
|
+
showPrevNext: opts.showPrevNext ?? true,
|
|
12367
|
+
showFirstLast: opts.showFirstLast ?? false
|
|
12368
|
+
};
|
|
12369
|
+
}
|
|
12370
|
+
function createPaginationListRecipe() {
|
|
12371
|
+
return {
|
|
12372
|
+
tag: "ul",
|
|
12373
|
+
className: "mw-pagination__list",
|
|
12374
|
+
vars: {},
|
|
12375
|
+
a11y: resolvePaginationListA11y()
|
|
12376
|
+
};
|
|
12377
|
+
}
|
|
12378
|
+
function createPaginationListItemRecipe() {
|
|
12379
|
+
return {
|
|
12380
|
+
tag: "li",
|
|
12381
|
+
className: "mw-pagination__list-item",
|
|
12382
|
+
vars: {}
|
|
12383
|
+
};
|
|
12384
|
+
}
|
|
12385
|
+
function createPaginationControlRecipe(opts) {
|
|
12386
|
+
return {
|
|
12387
|
+
tag: "button",
|
|
12388
|
+
className: cx20(
|
|
12389
|
+
"mw-pagination__control",
|
|
12390
|
+
`mw-pagination__control--${opts.direction}`,
|
|
12391
|
+
opts.disabled && "mw-pagination__control--disabled"
|
|
12392
|
+
),
|
|
12393
|
+
vars: {},
|
|
12394
|
+
a11y: resolvePaginationControlA11y(opts)
|
|
12395
|
+
};
|
|
12396
|
+
}
|
|
12397
|
+
function createPaginationPageRecipe(opts) {
|
|
12398
|
+
return {
|
|
12399
|
+
tag: "button",
|
|
12400
|
+
className: cx20(
|
|
12401
|
+
"mw-pagination__page",
|
|
12402
|
+
opts.selected && "mw-pagination__page--selected",
|
|
12403
|
+
opts.disabled && "mw-pagination__page--disabled"
|
|
12404
|
+
),
|
|
12405
|
+
vars: {},
|
|
12406
|
+
a11y: resolvePaginationPageA11y(opts)
|
|
12407
|
+
};
|
|
12408
|
+
}
|
|
12409
|
+
function createPaginationEllipsisRecipe() {
|
|
12410
|
+
return {
|
|
12411
|
+
tag: "span",
|
|
12412
|
+
className: "mw-pagination__ellipsis",
|
|
12413
|
+
vars: {},
|
|
12414
|
+
a11y: resolvePaginationEllipsisA11y()
|
|
12415
|
+
};
|
|
12416
|
+
}
|
|
12417
|
+
|
|
12418
|
+
// src/components/atoms/skip-link/skip-link-recipe.ts
|
|
12419
|
+
function cx21(...parts) {
|
|
12420
|
+
return parts.filter(Boolean).join(" ");
|
|
12421
|
+
}
|
|
12422
|
+
function createSkipLinkRecipe(opts) {
|
|
12423
|
+
return {
|
|
12424
|
+
tag: "a",
|
|
12425
|
+
className: cx21("mw-skip-link", opts.className)
|
|
12426
|
+
};
|
|
12427
|
+
}
|
|
12428
|
+
|
|
10833
12429
|
// src/storybook/storybook-fixtures.ts
|
|
10834
12430
|
var storybookLayout = {
|
|
10835
12431
|
centered: { layout: "centered" },
|
|
@@ -10846,6 +12442,10 @@ var storybookA11yPolicy = {
|
|
|
10846
12442
|
};
|
|
10847
12443
|
var storybookIconNames = [...iconNames];
|
|
10848
12444
|
var storybookOptionalIconNames = [void 0, ...storybookIconNames];
|
|
12445
|
+
var storybookButtonVariantArgType = {
|
|
12446
|
+
control: "select",
|
|
12447
|
+
options: ["primary", "secondary", "neutral", "text", "success", "danger"]
|
|
12448
|
+
};
|
|
10849
12449
|
var storybookButtonIconArgTypes = {
|
|
10850
12450
|
iconLeft: {
|
|
10851
12451
|
control: "select",
|
|
@@ -10860,7 +12460,18 @@ var storybookButtonIconArgTypes = {
|
|
|
10860
12460
|
}
|
|
10861
12461
|
};
|
|
10862
12462
|
var storybookButtonGeneralArgTypes = {
|
|
10863
|
-
...storybookButtonIconArgTypes
|
|
12463
|
+
...storybookButtonIconArgTypes,
|
|
12464
|
+
variant: storybookButtonVariantArgType
|
|
12465
|
+
};
|
|
12466
|
+
var storybookIconButtonArgTypes = {
|
|
12467
|
+
icon: {
|
|
12468
|
+
control: "select",
|
|
12469
|
+
options: storybookIconNames
|
|
12470
|
+
},
|
|
12471
|
+
variant: storybookButtonVariantArgType,
|
|
12472
|
+
disabled: {
|
|
12473
|
+
control: "boolean"
|
|
12474
|
+
}
|
|
10864
12475
|
};
|
|
10865
12476
|
var storybookButtonPurposeArgTypes = {
|
|
10866
12477
|
...storybookButtonIconArgTypes
|
|
@@ -10939,6 +12550,27 @@ var storybookSkeletonArgTypes = {
|
|
|
10939
12550
|
description: "Accessible label for standalone loading placeholder groups"
|
|
10940
12551
|
}
|
|
10941
12552
|
};
|
|
12553
|
+
var storybookProgressBarArgTypes = {
|
|
12554
|
+
label: { control: "text" },
|
|
12555
|
+
value: { control: { type: "number", min: -1e3, max: 1e3, step: 1 } },
|
|
12556
|
+
min: { control: { type: "number", min: -1e3, max: 1e3, step: 1 } },
|
|
12557
|
+
max: { control: { type: "number", min: -1e3, max: 1e3, step: 1 } },
|
|
12558
|
+
size: {
|
|
12559
|
+
control: "inline-radio",
|
|
12560
|
+
options: ["small", "default"],
|
|
12561
|
+
description: "Figma track size: small is 4px, default is 8px"
|
|
12562
|
+
},
|
|
12563
|
+
state: {
|
|
12564
|
+
control: "select",
|
|
12565
|
+
options: ["default", "hover", "pressed", "focus"],
|
|
12566
|
+
description: "Visual state for documentation and visual QA"
|
|
12567
|
+
},
|
|
12568
|
+
disabled: { control: "boolean" },
|
|
12569
|
+
showLabel: { control: "boolean" },
|
|
12570
|
+
showPercentage: { control: "boolean" },
|
|
12571
|
+
valueLabel: { control: "text" },
|
|
12572
|
+
ariaLabel: { control: "text" }
|
|
12573
|
+
};
|
|
10942
12574
|
var storybookStatTileArgTypes = {
|
|
10943
12575
|
tone: {
|
|
10944
12576
|
control: "select",
|
|
@@ -10981,6 +12613,7 @@ var storybookSpacingArgTypes = {
|
|
|
10981
12613
|
"sp-2",
|
|
10982
12614
|
"sp-4",
|
|
10983
12615
|
"sp-8",
|
|
12616
|
+
"sp-12",
|
|
10984
12617
|
"sp-16",
|
|
10985
12618
|
"sp-24",
|
|
10986
12619
|
"sp-32",
|
|
@@ -10996,7 +12629,7 @@ var storybookSpacingArgTypes = {
|
|
|
10996
12629
|
"sp-112",
|
|
10997
12630
|
"sp-120"
|
|
10998
12631
|
],
|
|
10999
|
-
description: "Size variant (sp-0=0 \u2026 sp-
|
|
12632
|
+
description: "Size variant (sp-0=0 \u2026 sp-12=12 \u2026 sp-24=24 \u2026 sp-120=120px)"
|
|
11000
12633
|
},
|
|
11001
12634
|
scale: {
|
|
11002
12635
|
control: { type: "number", min: 1, max: 8, step: 0.5 },
|
|
@@ -11048,7 +12681,7 @@ var storybookSliderArgTypes = {
|
|
|
11048
12681
|
};
|
|
11049
12682
|
var storybookDocsDescription = {
|
|
11050
12683
|
linkButton: "LinkButton locks navigation semantics, renders as an anchor, and keeps the canonical text treatment. Use Button for intentional visual deviations.",
|
|
11051
|
-
destructiveButton: "DestructiveButton locks destructive semantics, uses the canonical
|
|
12684
|
+
destructiveButton: "DestructiveButton locks destructive semantics, uses the canonical danger treatment, and requires confirmation by default. Use Button for intentional exceptions.",
|
|
11052
12685
|
submitButton: "SubmitButton locks form-submit semantics, always renders as a button, and keeps the canonical primary treatment.",
|
|
11053
12686
|
saveButton: "SaveButton locks save semantics and the canonical primary treatment. Use Button if you need a different visual hierarchy.",
|
|
11054
12687
|
confirmButton: "ConfirmButton locks affirmative confirmation semantics, always renders as a button, and keeps the canonical success treatment.",
|
|
@@ -11066,6 +12699,6 @@ var storybookDocsDescription = {
|
|
|
11066
12699
|
colors: "Complete color palette from the design system. Semantic roles map to CSS variables, with label colors auto-derived by default and overrideable for brand-specific fills."
|
|
11067
12700
|
};
|
|
11068
12701
|
|
|
11069
|
-
export { AvatarSize, AvatarType, BadgeVariant, ButtonAction, ButtonSize, ButtonVariant, DENSITY_SCALES, IconName, SkeletonAnimation, SkeletonVariant, Spacings, SpinnerVariant, SpinnerVariants, SwitchSize, ThemeMode, accordionPurposeComponentReference, accordionWhyPurposeComponents, avatarPurposeSemantics, avatarPurposes, badgePurposeComponentReference, badgePurposeSemantics, badgePurposes, badgeWhyPurposeComponents, buildAccordionFieldA11yIds, buildCheckboxA11y, buildCheckboxFieldA11yIds, buildCheckboxGroupFieldA11yIds, buildCurrencyHelperText, buildGoogleFontsUrl, buildHeadingA11y, buildInputFieldA11yIds, buildRadioA11y, buildRadioGroupFieldA11yIds, buildRichTextFieldA11yIds, buildSliderFieldA11yIds, buildSwitchFieldA11yIds, buildTabGroupA11yIds, buttonActionSemanticPurposes, buttonPurposeSemantics, buttonPurposes, buttonVariantVisualStyles, buttonWhySemanticComponents, canonicalSemanticAttributeNames, canonicalSemanticAttributeRegistry, canonicalSemanticAttributes, cardPurposeComponentReference, cardWhyPurposeComponents, checkboxRecipe, createAccordionRecipe, createAvatarRecipe, createBadgeRecipe, createButtonRecipe, createCardRecipe, createDatePickerRecipe, createDialogRecipe, createDividerRecipe, createFamilySemanticAttributes, createFontStack, createIconRecipe, createInputOtpRecipe, createInputRecipe, createMarwesThemeScript, createMarwesThemeStyle, createPurposeSemanticAttributes, createRichTextRecipe, createSelectRecipe, createSkeletonRecipe, createSliderRecipe, createSpacingRecipe, createSpinnerRecipe, createStatTileRecipe, createSwitchRecipe, createTabRecipe, createTextareaRecipe, createToastRecipe, createTooltipRecipe, currencyCodes, darkThemeDefaults, densityToCSSVars, dialogPurposeComponentReference, dialogPurposeSemantics, dialogPurposes, dialogWhyPurposeComponents, emptySemanticAttributes, escapeRichTextHtml, extractFontFamilyName, extractUsedWeights, familySemanticsRegistry, fieldComparisonRows, fieldWhyPurposeComponents, filterUndefinedSemanticAttributes, getCurrencySymbol, headingRecipe, iconNames, iconNamesList, iconRegistry, iconSizeScale, iconStrokeWidthScale, isRichTextHtmlEmpty, isSystemFont, isThemeMode, isThemePreference, lightThemeDefaults, mergeIdRefs, mergeSemanticAttributes, moveTabSelection, mwAvailableFonts, mwFontFallbacks, mwGoogleFontFamilies, mwStyledTheme, mwThemeVarNames, mwThemeVars, mwVar, nextThemeMode, normalizeRichTextHtml, paragraphRecipe, purposeSemanticsRegistry, radioPurposeComponentReference, radioRecipe, radioWhyPurposeComponents, resolveAccordionA11y, resolveAvatarA11y, resolveBadgeA11y, resolveButtonLoading, resolveDatePickerDayLabel, resolveDialogA11y, resolveIconA11y, resolveIconSize, resolveIconStrokeWidth, resolveRichTextAllowedFormats, resolveSelectMode, resolveServerThemeMode, resolveSkeletonA11y, resolveSliderA11y, resolveSpinnerA11y, resolveSpinnerSize, resolveStatTileTrendLabel, resolveSwitchA11y, resolveTabA11y, resolveTabValue, resolveThemeInput, resolveThemePreference, resolveToastA11y, resolveTone, resolveTooltipA11y, richTextCommandByFormat, richTextFormattingReference, richTextWhyUseIt, sanitizeCurrencyValue, sanitizeInputOtpValue, semanticFamilies, semanticFrameworkSupport, semanticIntents, semanticLayers, semanticOrientations, semanticOutcomes, semanticPurposes, shouldLoadGoogleFont, skeletonAnimations, skeletonVariants, sliderPurposeComponentReference, sliderWhyPurposeComponents, spinnerSizeScale, spinnerSizes, spinnerVariants, storybookA11yPolicy, storybookButtonGeneralArgTypes, storybookButtonIconArgTypes, storybookButtonPurposeArgTypes, storybookCheckboxArgTypes, storybookDatePickerArgTypes, storybookDividerArgTypes, storybookDocsDescription, storybookIconGalleryArgTypes, storybookIconGalleryDefaults, storybookIconNames, storybookLayout, storybookOptionalIconNames, storybookRadioArgTypes, storybookSkeletonArgTypes, storybookSliderArgTypes, storybookSpacingArgTypes, storybookSpinnerArgTypes, storybookStatTileArgTypes, switchPurposeComponentReference, switchWhyPurposeComponents, tabPurposeComponentReference, tabWhyPurposeComponents, themeModesToCSSRules, themeToCSSRule, themeToCSSVars, toastPurposeComponentReference, toastPurposeSemantics, toastPurposes, toastWhyPurposeComponents, validateSemanticRegistry };
|
|
12702
|
+
export { AvatarSize, AvatarType, BadgeVariant, BannerVariant, ButtonAction, ButtonSize, ButtonVariant, DEFAULT_PROGRESS_BAR_LABEL, DEFAULT_PROGRESS_BAR_MAX, DEFAULT_PROGRESS_BAR_MIN, DENSITY_SCALES, IconName, ProgressBarSize, ProgressBarState, SkeletonAnimation, SkeletonVariant, Spacings, SpinnerVariant, SpinnerVariants, SwitchSize, TextVariant, ThemeMode, accordionPurposeComponentReference, accordionWhyPurposeComponents, avatarPurposeSemantics, avatarPurposes, badgePurposeComponentReference, badgePurposeSemantics, badgePurposes, badgeWhyPurposeComponents, bannerPurposeSemantics, bannerPurposes, buildAccordionFieldA11yIds, buildCheckboxA11y, buildCheckboxFieldA11yIds, buildCheckboxGroupFieldA11yIds, buildCurrencyHelperText, buildGoogleFontsUrl, buildHeadingA11y, buildInputFieldA11yIds, buildRadioA11y, buildRadioGroupFieldA11yIds, buildRichTextFieldA11yIds, buildSliderFieldA11yIds, buildSwitchFieldA11yIds, buildTabGroupA11yIds, buttonActionSemanticPurposes, buttonPurposeSemantics, buttonPurposes, buttonVariantVisualStyles, buttonWhySemanticComponents, canonicalSemanticAttributeNames, canonicalSemanticAttributeRegistry, canonicalSemanticAttributes, cardPurposeComponentReference, cardWhyPurposeComponents, checkboxRecipe, clampPaginationPage, clampProgressBarValue, createAccordionRecipe, createAvatarRecipe, createBadgeRecipe, createBannerRecipe, createBreadcrumbRecipe, createButtonRecipe, createCardRecipe, createContextMenuRecipe, createDatePickerRecipe, createDialogRecipe, createDividerRecipe, createDrawerRecipe, createFamilySemanticAttributes, createFontStack, createIconRecipe, createInputOtpRecipe, createInputRecipe, createMarwesThemeScript, createMarwesThemeStyle, createMwTheme, createMwThemeMedia, createPaginationControlRecipe, createPaginationEllipsisRecipe, createPaginationItems, createPaginationListItemRecipe, createPaginationListRecipe, createPaginationPageRecipe, createPaginationRecipe, createProgressBarRecipe, createPurposeSemanticAttributes, createRichTextRecipe, createSegmentedControlItemRecipe, createSegmentedControlRecipe, createSelectRecipe, createSkeletonRecipe, createSkipLinkRecipe, createSliderRecipe, createSpacingRecipe, createSpinnerRecipe, createStatTileRecipe, createSwitchRecipe, createTabRecipe, createTextareaRecipe, createToastRecipe, createTooltipRecipe, currencyCodes, darkThemeDefaults, defaultThemeBreakpoints, densityToCSSVars, dialogPurposeComponentReference, dialogPurposeSemantics, dialogPurposes, dialogWhyPurposeComponents, emptySemanticAttributes, escapeRichTextHtml, extractFontFamilyName, extractUsedWeights, familySemanticsRegistry, fieldComparisonRows, fieldWhyPurposeComponents, filterUndefinedSemanticAttributes, getCurrencySymbol, headingRecipe, iconNames, iconNamesList, iconRegistry, iconSizeScale, iconStrokeWidthScale, isRichTextHtmlEmpty, isSystemFont, isThemeMode, isThemePreference, lightThemeDefaults, mergeIdRefs, mergeSemanticAttributes, moveSegmentedControlSelection, moveTabSelection, mwAvailableFonts, mwFontFallbacks, mwGoogleFontFamilies, mwStyledTheme, mwTheme, mwThemeVarNames, mwThemeVars, mwVar, nextThemeMode, normalizeRichTextHtml, paragraphRecipe, progressBarSizes, progressBarStates, purposeSemanticsRegistry, radioPurposeComponentReference, radioRecipe, radioWhyPurposeComponents, resolveAccordionA11y, resolveAvatarA11y, resolveBadgeA11y, resolveBannerA11y, resolveBreadcrumbA11y, resolveBreadcrumbHomeA11y, resolveBreadcrumbItemA11y, resolveBreadcrumbListA11y, resolveBreadcrumbSeparatorA11y, resolveButtonLoading, resolveContextMenuA11y, resolveContextMenuDividerA11y, resolveContextMenuItemA11y, resolveDatePickerDayLabel, resolveDialogA11y, resolveDrawerA11y, resolveIconA11y, resolveIconSize, resolveIconStrokeWidth, resolvePaginationA11y, resolvePaginationAdaptiveMaxVisibleItems, resolvePaginationAdaptiveProfile, resolvePaginationControlA11y, resolvePaginationEllipsisA11y, resolvePaginationItemAriaLabel, resolvePaginationListA11y, resolvePaginationPageA11y, resolvePaginationReservedItemCount, resolveProgressBarA11y, resolveProgressBarBounds, resolveRichTextAllowedFormats, resolveSegmentedControlA11y, resolveSegmentedControlItemA11y, resolveSegmentedControlValue, resolveSelectMode, resolveServerThemeMode, resolveSkeletonA11y, resolveSliderA11y, resolveSpinnerA11y, resolveSpinnerSize, resolveStatTileTrendLabel, resolveSwitchA11y, resolveTabA11y, resolveTabValue, resolveThemeInput, resolveThemePreference, resolveToastA11y, resolveTone, resolveTooltipA11y, richTextCommandByFormat, richTextFormattingReference, richTextWhyUseIt, sanitizeCurrencyValue, sanitizeInputOtpValue, semanticFamilies, semanticFrameworkSupport, semanticIntents, semanticLayers, semanticOrientations, semanticOutcomes, semanticPurposes, shouldLoadGoogleFont, skeletonAnimations, skeletonVariants, sliderPurposeComponentReference, sliderWhyPurposeComponents, spinnerSizeScale, spinnerSizes, spinnerVariants, storybookA11yPolicy, storybookButtonGeneralArgTypes, storybookButtonIconArgTypes, storybookButtonPurposeArgTypes, storybookCheckboxArgTypes, storybookDatePickerArgTypes, storybookDividerArgTypes, storybookDocsDescription, storybookIconButtonArgTypes, storybookIconGalleryArgTypes, storybookIconGalleryDefaults, storybookIconNames, storybookLayout, storybookOptionalIconNames, storybookProgressBarArgTypes, storybookRadioArgTypes, storybookSkeletonArgTypes, storybookSliderArgTypes, storybookSpacingArgTypes, storybookSpinnerArgTypes, storybookStatTileArgTypes, switchPurposeComponentReference, switchWhyPurposeComponents, tabPurposeComponentReference, tabWhyPurposeComponents, textRecipe, themeModesToCSSRules, themeToCSSRule, themeToCSSVars, toastPurposeComponentReference, toastPurposeSemantics, toastPurposes, toastWhyPurposeComponents, validateSemanticRegistry };
|
|
11070
12703
|
//# sourceMappingURL=index.js.map
|
|
11071
12704
|
//# sourceMappingURL=index.js.map
|