@assure-one/design-system 1.32.0 → 1.33.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 +44 -13
- package/codemods/README.md +60 -0
- package/codemods/lib/forms.mjs +253 -0
- package/codemods/lib/jsx.mjs +0 -0
- package/codemods/lib/registry.mjs +2 -0
- package/codemods/transforms/cm-14-hidden-mirrors.mjs +275 -0
- package/codemods/transforms/cm-20-select-sentinels.mjs +442 -0
- package/dist/css/components.css +7 -0
- package/dist/css/legacy-aliases.css +180 -4
- package/dist/css/shadcn.css +4 -4
- package/dist/css/tailwind.css +66 -3
- package/dist/css/tokens.css +205 -14
- package/dist/index.d.ts +529 -4
- package/dist/index.js +477 -51
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/system-BDU18fVg.d.ts +559 -0
- package/dist/tokens/index.d.ts +50 -439
- package/dist/tokens/index.js +513 -6
- package/dist/tokens/index.js.map +1 -1
- package/package.json +2 -1
package/dist/tokens/index.js
CHANGED
|
@@ -72,10 +72,10 @@ var radii = {
|
|
|
72
72
|
full: "9999px"
|
|
73
73
|
};
|
|
74
74
|
var shadows = {
|
|
75
|
-
quiet: "0 1px 2px rgba(
|
|
76
|
-
card: "0
|
|
77
|
-
pop: "0
|
|
78
|
-
focusRing: "0 0 0 2px
|
|
75
|
+
quiet: "0 1px 2px rgba(16, 20, 36, 0.05)",
|
|
76
|
+
card: "0 1px 2px rgba(16, 20, 36, 0.04), 0 4px 12px -4px rgba(16, 20, 36, 0.08)",
|
|
77
|
+
pop: "0 0 0 1px rgba(16, 20, 36, 0.03), 0 2px 4px -1px rgba(16, 20, 36, 0.06), 0 12px 28px -6px rgba(16, 20, 36, 0.14)",
|
|
78
|
+
focusRing: "0 0 0 2px #ffffff, 0 0 0 4px #6c42f8"
|
|
79
79
|
};
|
|
80
80
|
var overlays = {
|
|
81
81
|
hover: "rgba(10, 10, 10, 0.03)",
|
|
@@ -122,6 +122,28 @@ var motion = {
|
|
|
122
122
|
slow: "400ms"
|
|
123
123
|
}
|
|
124
124
|
};
|
|
125
|
+
var iconSizes = {
|
|
126
|
+
xs: "12px",
|
|
127
|
+
sm: "14px",
|
|
128
|
+
md: "16px",
|
|
129
|
+
lg: "20px"
|
|
130
|
+
};
|
|
131
|
+
var zIndex = {
|
|
132
|
+
base: 0,
|
|
133
|
+
sticky: 100,
|
|
134
|
+
overlay: 200,
|
|
135
|
+
modal: 300,
|
|
136
|
+
popover: 400,
|
|
137
|
+
toast: 500,
|
|
138
|
+
tooltip: 600
|
|
139
|
+
};
|
|
140
|
+
var breakpoints = {
|
|
141
|
+
sm: "40rem",
|
|
142
|
+
md: "48rem",
|
|
143
|
+
lg: "64rem",
|
|
144
|
+
xl: "80rem",
|
|
145
|
+
"2xl": "96rem"
|
|
146
|
+
};
|
|
125
147
|
var reference = {
|
|
126
148
|
colors,
|
|
127
149
|
typography,
|
|
@@ -131,7 +153,10 @@ var reference = {
|
|
|
131
153
|
layout,
|
|
132
154
|
motion,
|
|
133
155
|
spacing,
|
|
134
|
-
surfaces
|
|
156
|
+
surfaces,
|
|
157
|
+
iconSizes,
|
|
158
|
+
zIndex,
|
|
159
|
+
breakpoints
|
|
135
160
|
};
|
|
136
161
|
|
|
137
162
|
// src/tokens/system.ts
|
|
@@ -329,6 +354,54 @@ var systemTokens = {
|
|
|
329
354
|
}
|
|
330
355
|
}
|
|
331
356
|
},
|
|
357
|
+
/**
|
|
358
|
+
* Control sizing (amendment A1, W2-03). One outer height per size name, with
|
|
359
|
+
* the padding, gap, label size and glyph size derived from it.
|
|
360
|
+
*
|
|
361
|
+
* **Nothing reads these yet** and the numbers are gated on decision D5
|
|
362
|
+
* (implementation plan §3) — what each control renders *today* is in
|
|
363
|
+
* `docs/design-system/control-sizes.md`, and W2-05 is the task that unifies
|
|
364
|
+
* them. Referencing the scale here is also what keeps the custom properties
|
|
365
|
+
* in the published stylesheet, so `[data-ds-density="compact"]` has something
|
|
366
|
+
* to re-point.
|
|
367
|
+
*/
|
|
368
|
+
control: {
|
|
369
|
+
height: {
|
|
370
|
+
xs: "var(--control-height-xs)",
|
|
371
|
+
sm: "var(--control-height-sm)",
|
|
372
|
+
md: "var(--control-height-md)",
|
|
373
|
+
lg: "var(--control-height-lg)",
|
|
374
|
+
xl: "var(--control-height-xl)"
|
|
375
|
+
},
|
|
376
|
+
paddingX: {
|
|
377
|
+
xs: "var(--control-padding-x-xs)",
|
|
378
|
+
sm: "var(--control-padding-x-sm)",
|
|
379
|
+
md: "var(--control-padding-x-md)",
|
|
380
|
+
lg: "var(--control-padding-x-lg)",
|
|
381
|
+
xl: "var(--control-padding-x-xl)"
|
|
382
|
+
},
|
|
383
|
+
gap: {
|
|
384
|
+
xs: "var(--control-gap-xs)",
|
|
385
|
+
sm: "var(--control-gap-sm)",
|
|
386
|
+
md: "var(--control-gap-md)",
|
|
387
|
+
lg: "var(--control-gap-lg)",
|
|
388
|
+
xl: "var(--control-gap-xl)"
|
|
389
|
+
},
|
|
390
|
+
fontSize: {
|
|
391
|
+
xs: "var(--control-font-size-xs)",
|
|
392
|
+
sm: "var(--control-font-size-sm)",
|
|
393
|
+
md: "var(--control-font-size-md)",
|
|
394
|
+
lg: "var(--control-font-size-lg)",
|
|
395
|
+
xl: "var(--control-font-size-xl)"
|
|
396
|
+
},
|
|
397
|
+
icon: {
|
|
398
|
+
xs: "var(--control-icon-xs)",
|
|
399
|
+
sm: "var(--control-icon-sm)",
|
|
400
|
+
md: "var(--control-icon-md)",
|
|
401
|
+
lg: "var(--control-icon-lg)",
|
|
402
|
+
xl: "var(--control-icon-xl)"
|
|
403
|
+
}
|
|
404
|
+
},
|
|
332
405
|
layout: {
|
|
333
406
|
shellSidebarWidth: "var(--shell-sidebar-w)",
|
|
334
407
|
shellSidebarRailWidth: "var(--shell-sidebar-w-rail)",
|
|
@@ -346,6 +419,440 @@ var systemTokens = {
|
|
|
346
419
|
}
|
|
347
420
|
};
|
|
348
421
|
|
|
349
|
-
|
|
422
|
+
// src/foundation/theme/srgb.ts
|
|
423
|
+
var SRGB_TO_LINEAR_1E6 = [
|
|
424
|
+
0,
|
|
425
|
+
304,
|
|
426
|
+
607,
|
|
427
|
+
911,
|
|
428
|
+
1214,
|
|
429
|
+
1518,
|
|
430
|
+
1821,
|
|
431
|
+
2125,
|
|
432
|
+
2428,
|
|
433
|
+
2732,
|
|
434
|
+
3035,
|
|
435
|
+
3347,
|
|
436
|
+
3677,
|
|
437
|
+
4025,
|
|
438
|
+
4391,
|
|
439
|
+
4777,
|
|
440
|
+
5182,
|
|
441
|
+
5605,
|
|
442
|
+
6049,
|
|
443
|
+
6512,
|
|
444
|
+
6995,
|
|
445
|
+
7499,
|
|
446
|
+
8023,
|
|
447
|
+
8568,
|
|
448
|
+
9134,
|
|
449
|
+
9721,
|
|
450
|
+
10330,
|
|
451
|
+
10960,
|
|
452
|
+
11612,
|
|
453
|
+
12286,
|
|
454
|
+
12983,
|
|
455
|
+
13702,
|
|
456
|
+
14444,
|
|
457
|
+
15209,
|
|
458
|
+
15996,
|
|
459
|
+
16807,
|
|
460
|
+
17642,
|
|
461
|
+
18500,
|
|
462
|
+
19382,
|
|
463
|
+
20289,
|
|
464
|
+
21219,
|
|
465
|
+
22174,
|
|
466
|
+
23153,
|
|
467
|
+
24158,
|
|
468
|
+
25187,
|
|
469
|
+
26241,
|
|
470
|
+
27321,
|
|
471
|
+
28426,
|
|
472
|
+
29557,
|
|
473
|
+
30713,
|
|
474
|
+
31896,
|
|
475
|
+
33105,
|
|
476
|
+
34340,
|
|
477
|
+
35601,
|
|
478
|
+
36889,
|
|
479
|
+
38204,
|
|
480
|
+
39546,
|
|
481
|
+
40915,
|
|
482
|
+
42311,
|
|
483
|
+
43735,
|
|
484
|
+
45186,
|
|
485
|
+
46665,
|
|
486
|
+
48172,
|
|
487
|
+
49707,
|
|
488
|
+
51269,
|
|
489
|
+
52861,
|
|
490
|
+
54480,
|
|
491
|
+
56128,
|
|
492
|
+
57805,
|
|
493
|
+
59511,
|
|
494
|
+
61246,
|
|
495
|
+
63010,
|
|
496
|
+
64803,
|
|
497
|
+
66626,
|
|
498
|
+
68478,
|
|
499
|
+
70360,
|
|
500
|
+
72272,
|
|
501
|
+
74214,
|
|
502
|
+
76185,
|
|
503
|
+
78187,
|
|
504
|
+
80220,
|
|
505
|
+
82283,
|
|
506
|
+
84376,
|
|
507
|
+
86500,
|
|
508
|
+
88656,
|
|
509
|
+
90842,
|
|
510
|
+
93059,
|
|
511
|
+
95307,
|
|
512
|
+
97587,
|
|
513
|
+
99899,
|
|
514
|
+
102242,
|
|
515
|
+
104616,
|
|
516
|
+
107023,
|
|
517
|
+
109462,
|
|
518
|
+
111932,
|
|
519
|
+
114435,
|
|
520
|
+
116971,
|
|
521
|
+
119538,
|
|
522
|
+
122139,
|
|
523
|
+
124772,
|
|
524
|
+
127438,
|
|
525
|
+
130136,
|
|
526
|
+
132868,
|
|
527
|
+
135633,
|
|
528
|
+
138432,
|
|
529
|
+
141263,
|
|
530
|
+
144128,
|
|
531
|
+
147027,
|
|
532
|
+
149960,
|
|
533
|
+
152926,
|
|
534
|
+
155926,
|
|
535
|
+
158961,
|
|
536
|
+
162029,
|
|
537
|
+
165132,
|
|
538
|
+
168269,
|
|
539
|
+
171441,
|
|
540
|
+
174647,
|
|
541
|
+
177888,
|
|
542
|
+
181164,
|
|
543
|
+
184475,
|
|
544
|
+
187821,
|
|
545
|
+
191202,
|
|
546
|
+
194618,
|
|
547
|
+
198069,
|
|
548
|
+
201556,
|
|
549
|
+
205079,
|
|
550
|
+
208637,
|
|
551
|
+
212231,
|
|
552
|
+
215861,
|
|
553
|
+
219526,
|
|
554
|
+
223228,
|
|
555
|
+
226966,
|
|
556
|
+
230740,
|
|
557
|
+
234551,
|
|
558
|
+
238398,
|
|
559
|
+
242281,
|
|
560
|
+
246201,
|
|
561
|
+
250158,
|
|
562
|
+
254152,
|
|
563
|
+
258183,
|
|
564
|
+
262251,
|
|
565
|
+
266356,
|
|
566
|
+
270498,
|
|
567
|
+
274677,
|
|
568
|
+
278894,
|
|
569
|
+
283149,
|
|
570
|
+
287441,
|
|
571
|
+
291771,
|
|
572
|
+
296138,
|
|
573
|
+
300544,
|
|
574
|
+
304987,
|
|
575
|
+
309469,
|
|
576
|
+
313989,
|
|
577
|
+
318547,
|
|
578
|
+
323143,
|
|
579
|
+
327778,
|
|
580
|
+
332452,
|
|
581
|
+
337164,
|
|
582
|
+
341914,
|
|
583
|
+
346704,
|
|
584
|
+
351533,
|
|
585
|
+
356400,
|
|
586
|
+
361307,
|
|
587
|
+
366253,
|
|
588
|
+
371238,
|
|
589
|
+
376262,
|
|
590
|
+
381326,
|
|
591
|
+
386429,
|
|
592
|
+
391572,
|
|
593
|
+
396755,
|
|
594
|
+
401978,
|
|
595
|
+
407240,
|
|
596
|
+
412543,
|
|
597
|
+
417885,
|
|
598
|
+
423268,
|
|
599
|
+
428690,
|
|
600
|
+
434154,
|
|
601
|
+
439657,
|
|
602
|
+
445201,
|
|
603
|
+
450786,
|
|
604
|
+
456411,
|
|
605
|
+
462077,
|
|
606
|
+
467784,
|
|
607
|
+
473531,
|
|
608
|
+
479320,
|
|
609
|
+
485150,
|
|
610
|
+
491021,
|
|
611
|
+
496933,
|
|
612
|
+
502886,
|
|
613
|
+
508881,
|
|
614
|
+
514918,
|
|
615
|
+
520996,
|
|
616
|
+
527115,
|
|
617
|
+
533276,
|
|
618
|
+
539479,
|
|
619
|
+
545724,
|
|
620
|
+
552011,
|
|
621
|
+
558340,
|
|
622
|
+
564712,
|
|
623
|
+
571125,
|
|
624
|
+
577580,
|
|
625
|
+
584078,
|
|
626
|
+
590619,
|
|
627
|
+
597202,
|
|
628
|
+
603827,
|
|
629
|
+
610496,
|
|
630
|
+
617207,
|
|
631
|
+
623960,
|
|
632
|
+
630757,
|
|
633
|
+
637597,
|
|
634
|
+
644480,
|
|
635
|
+
651406,
|
|
636
|
+
658375,
|
|
637
|
+
665387,
|
|
638
|
+
672443,
|
|
639
|
+
679542,
|
|
640
|
+
686685,
|
|
641
|
+
693872,
|
|
642
|
+
701102,
|
|
643
|
+
708376,
|
|
644
|
+
715694,
|
|
645
|
+
723055,
|
|
646
|
+
730461,
|
|
647
|
+
737910,
|
|
648
|
+
745404,
|
|
649
|
+
752942,
|
|
650
|
+
760525,
|
|
651
|
+
768151,
|
|
652
|
+
775822,
|
|
653
|
+
783538,
|
|
654
|
+
791298,
|
|
655
|
+
799103,
|
|
656
|
+
806952,
|
|
657
|
+
814847,
|
|
658
|
+
822786,
|
|
659
|
+
830770,
|
|
660
|
+
838799,
|
|
661
|
+
846873,
|
|
662
|
+
854993,
|
|
663
|
+
863157,
|
|
664
|
+
871367,
|
|
665
|
+
879622,
|
|
666
|
+
887923,
|
|
667
|
+
896269,
|
|
668
|
+
904661,
|
|
669
|
+
913099,
|
|
670
|
+
921582,
|
|
671
|
+
930111,
|
|
672
|
+
938686,
|
|
673
|
+
947307,
|
|
674
|
+
955973,
|
|
675
|
+
964686,
|
|
676
|
+
973445,
|
|
677
|
+
982251,
|
|
678
|
+
991102,
|
|
679
|
+
1e6
|
|
680
|
+
];
|
|
681
|
+
var HEX_3 = /^#[0-9a-fA-F]{3}$/;
|
|
682
|
+
var HEX_6 = /^#[0-9a-fA-F]{6}$/;
|
|
683
|
+
var HEX_DIGITS = "0123456789abcdef";
|
|
684
|
+
function parseHexColor(value) {
|
|
685
|
+
if (HEX_6.test(value)) {
|
|
686
|
+
const n = Number.parseInt(value.slice(1), 16);
|
|
687
|
+
return [n >> 16 & 255, n >> 8 & 255, n & 255];
|
|
688
|
+
}
|
|
689
|
+
if (HEX_3.test(value)) {
|
|
690
|
+
const n = Number.parseInt(value.slice(1), 16);
|
|
691
|
+
const r = n >> 8 & 15;
|
|
692
|
+
const g = n >> 4 & 15;
|
|
693
|
+
const b = n & 15;
|
|
694
|
+
return [r * 17, g * 17, b * 17];
|
|
695
|
+
}
|
|
696
|
+
return null;
|
|
697
|
+
}
|
|
698
|
+
function formatHexColor([r, g, b]) {
|
|
699
|
+
const byte = (v) => HEX_DIGITS[v >> 4 & 15] + HEX_DIGITS[v & 15];
|
|
700
|
+
return `#${byte(r)}${byte(g)}${byte(b)}`;
|
|
701
|
+
}
|
|
702
|
+
function relativeLuminance([r, g, b]) {
|
|
703
|
+
const lr = SRGB_TO_LINEAR_1E6[r] / 1e6;
|
|
704
|
+
const lg = SRGB_TO_LINEAR_1E6[g] / 1e6;
|
|
705
|
+
const lb = SRGB_TO_LINEAR_1E6[b] / 1e6;
|
|
706
|
+
return 0.2126 * lr + 0.7152 * lg + 0.0722 * lb;
|
|
707
|
+
}
|
|
708
|
+
function contrastRatio(a, b) {
|
|
709
|
+
const la = relativeLuminance(a);
|
|
710
|
+
const lb = relativeLuminance(b);
|
|
711
|
+
const lighter = la > lb ? la : lb;
|
|
712
|
+
const darker = la > lb ? lb : la;
|
|
713
|
+
return (lighter + 0.05) / (darker + 0.05);
|
|
714
|
+
}
|
|
715
|
+
function mixSrgb(a, b, percent) {
|
|
716
|
+
const mix = (x, y) => Math.round((x * percent + y * (100 - percent)) / 100);
|
|
717
|
+
return [mix(a[0], b[0]), mix(a[1], b[1]), mix(a[2], b[2])];
|
|
718
|
+
}
|
|
719
|
+
var WHITE = [255, 255, 255];
|
|
720
|
+
var BLACK = [0, 0, 0];
|
|
721
|
+
function readableInk(fill) {
|
|
722
|
+
return contrastRatio(BLACK, fill) >= contrastRatio(WHITE, fill) ? BLACK : WHITE;
|
|
723
|
+
}
|
|
724
|
+
function darkenUntilContrast(colour, against, minRatio) {
|
|
725
|
+
for (let percent = 100; percent >= 0; percent -= 1) {
|
|
726
|
+
const candidate = mixSrgb(colour, BLACK, percent);
|
|
727
|
+
if (contrastRatio(candidate, against) >= minRatio) return candidate;
|
|
728
|
+
}
|
|
729
|
+
return BLACK;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
// src/foundation/theme/brand-theme.ts
|
|
733
|
+
var BRAND_THEME_PROPERTIES = [
|
|
734
|
+
"--ds-color-action-brand-bg",
|
|
735
|
+
"--ds-color-action-brand-bg-hover",
|
|
736
|
+
"--ds-color-action-brand-bg-active",
|
|
737
|
+
"--ds-color-action-brand-bg-disabled",
|
|
738
|
+
"--ds-color-action-brand-subtle-bg",
|
|
739
|
+
"--ds-color-action-brand-subtle-bg-hover",
|
|
740
|
+
"--ds-color-action-brand-subtle-bg-active",
|
|
741
|
+
"--ds-color-action-brand-border",
|
|
742
|
+
"--ds-color-action-brand-ring",
|
|
743
|
+
"--ds-color-action-brand-fg",
|
|
744
|
+
"--ds-color-action-accent-bg",
|
|
745
|
+
"--ds-color-action-accent-bg-strong",
|
|
746
|
+
"--ds-color-action-accent-bg-hover",
|
|
747
|
+
"--ds-color-action-accent-bg-active",
|
|
748
|
+
"--ds-color-action-accent-subtle-bg",
|
|
749
|
+
"--ds-color-action-accent-ring",
|
|
750
|
+
"--ds-color-action-accent-fg",
|
|
751
|
+
"--ds-color-border-focus",
|
|
752
|
+
"--ds-focus-ring-color",
|
|
753
|
+
"--ds-focus-ring-border",
|
|
754
|
+
"--ds-gradient-brand",
|
|
755
|
+
"--ds-compat-color-brand-soft",
|
|
756
|
+
"--ds-compat-color-brand-soft-foreground"
|
|
757
|
+
];
|
|
758
|
+
var MIN_FILL_CONTRAST = 3;
|
|
759
|
+
var MIN_TEXT_CONTRAST = 4.5;
|
|
760
|
+
var CANVAS = WHITE;
|
|
761
|
+
var RAMP = {
|
|
762
|
+
hover: 88,
|
|
763
|
+
active: 74,
|
|
764
|
+
disabled: 42,
|
|
765
|
+
subtle: 8,
|
|
766
|
+
subtleHover: 13,
|
|
767
|
+
subtleActive: 20,
|
|
768
|
+
border: 45,
|
|
769
|
+
ring: 20,
|
|
770
|
+
/** The soft tint and its ink, which the app-vocabulary bridge reads. */
|
|
771
|
+
soft: 12,
|
|
772
|
+
softInk: 68
|
|
773
|
+
};
|
|
774
|
+
var towardsInk = (colour, percent) => `color-mix(in srgb, ${colour} ${percent}%, var(--ds-color-content))`;
|
|
775
|
+
var towardsTransparent = (colour, percent) => `color-mix(in srgb, ${colour} ${percent}%, transparent)`;
|
|
776
|
+
var ACCEPTED = '#rgb or #rrggbb, for example "#6c42f8"';
|
|
777
|
+
var SEED_KEYS = /* @__PURE__ */ new Set(["brand", "accent"]);
|
|
778
|
+
function describe(value) {
|
|
779
|
+
if (typeof value === "string") return JSON.stringify(value);
|
|
780
|
+
if (value === null) return "null";
|
|
781
|
+
if (Array.isArray(value)) return "an array";
|
|
782
|
+
return typeof value;
|
|
783
|
+
}
|
|
784
|
+
function readColour(key, value) {
|
|
785
|
+
if (typeof value !== "string") {
|
|
786
|
+
throw new TypeError(
|
|
787
|
+
`createBrandTheme: "${key}" must be a hex colour string (${ACCEPTED}), received ${describe(value)}.`
|
|
788
|
+
);
|
|
789
|
+
}
|
|
790
|
+
const rgb = parseHexColor(value);
|
|
791
|
+
if (!rgb) {
|
|
792
|
+
throw new TypeError(
|
|
793
|
+
`createBrandTheme: "${key}" must be a hex colour (${ACCEPTED}), received ${describe(value)}. Named colours, rgb()/hsl() and eight-digit hex with alpha are not accepted \u2014 a brand seed must be opaque and unambiguous.`
|
|
794
|
+
);
|
|
795
|
+
}
|
|
796
|
+
return rgb;
|
|
797
|
+
}
|
|
798
|
+
function validateSeed(seed) {
|
|
799
|
+
if (seed === null || typeof seed !== "object" || Array.isArray(seed)) {
|
|
800
|
+
throw new TypeError(
|
|
801
|
+
`createBrandTheme: expected a seed object with a "brand" colour, received ${describe(seed)}.`
|
|
802
|
+
);
|
|
803
|
+
}
|
|
804
|
+
const unknown = Object.keys(seed).filter((key) => !SEED_KEYS.has(key));
|
|
805
|
+
if (unknown.length) {
|
|
806
|
+
throw new TypeError(
|
|
807
|
+
`createBrandTheme: unknown seed ${unknown.length === 1 ? "key" : "keys"} ${unknown.map((key) => JSON.stringify(key)).join(", ")}. The seed accepts "brand" and an optional "accent" (decision D7).`
|
|
808
|
+
);
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
function clampFill(seed) {
|
|
812
|
+
if (contrastRatio(seed, CANVAS) >= MIN_FILL_CONTRAST) return seed;
|
|
813
|
+
return darkenUntilContrast(seed, CANVAS, MIN_FILL_CONTRAST);
|
|
814
|
+
}
|
|
815
|
+
function createBrandTheme(seed) {
|
|
816
|
+
validateSeed(seed);
|
|
817
|
+
const brandSeed = readColour("brand", seed.brand);
|
|
818
|
+
const accentSeed = seed.accent === void 0 || seed.accent === null ? brandSeed : readColour("accent", seed.accent);
|
|
819
|
+
const brand = clampFill(brandSeed);
|
|
820
|
+
const accent = clampFill(accentSeed);
|
|
821
|
+
const brandHex = formatHexColor(brand);
|
|
822
|
+
const accentHex = formatHexColor(accent);
|
|
823
|
+
const soft = mixSrgb(brand, WHITE, RAMP.soft);
|
|
824
|
+
const softInk = darkenUntilContrast(mixSrgb(brand, BLACK, RAMP.softInk), soft, MIN_TEXT_CONTRAST);
|
|
825
|
+
return Object.freeze({
|
|
826
|
+
"--ds-color-action-brand-bg": brandHex,
|
|
827
|
+
"--ds-color-action-brand-bg-hover": towardsInk(brandHex, RAMP.hover),
|
|
828
|
+
"--ds-color-action-brand-bg-active": towardsInk(brandHex, RAMP.active),
|
|
829
|
+
"--ds-color-action-brand-bg-disabled": formatHexColor(mixSrgb(brand, WHITE, RAMP.disabled)),
|
|
830
|
+
"--ds-color-action-brand-subtle-bg": formatHexColor(mixSrgb(brand, WHITE, RAMP.subtle)),
|
|
831
|
+
"--ds-color-action-brand-subtle-bg-hover": formatHexColor(
|
|
832
|
+
mixSrgb(brand, WHITE, RAMP.subtleHover)
|
|
833
|
+
),
|
|
834
|
+
"--ds-color-action-brand-subtle-bg-active": formatHexColor(
|
|
835
|
+
mixSrgb(brand, WHITE, RAMP.subtleActive)
|
|
836
|
+
),
|
|
837
|
+
"--ds-color-action-brand-border": formatHexColor(mixSrgb(brand, WHITE, RAMP.border)),
|
|
838
|
+
"--ds-color-action-brand-ring": towardsTransparent(brandHex, RAMP.ring),
|
|
839
|
+
"--ds-color-action-brand-fg": formatHexColor(readableInk(brand)),
|
|
840
|
+
"--ds-color-action-accent-bg": accentHex,
|
|
841
|
+
"--ds-color-action-accent-bg-strong": towardsInk(accentHex, RAMP.active),
|
|
842
|
+
"--ds-color-action-accent-bg-hover": towardsInk(accentHex, RAMP.hover),
|
|
843
|
+
"--ds-color-action-accent-bg-active": towardsInk(accentHex, RAMP.active),
|
|
844
|
+
"--ds-color-action-accent-subtle-bg": formatHexColor(mixSrgb(accent, WHITE, RAMP.subtle)),
|
|
845
|
+
"--ds-color-action-accent-ring": towardsTransparent(accentHex, RAMP.ring),
|
|
846
|
+
"--ds-color-action-accent-fg": formatHexColor(readableInk(accent)),
|
|
847
|
+
"--ds-color-border-focus": accentHex,
|
|
848
|
+
"--ds-focus-ring-color": towardsTransparent(brandHex, RAMP.ring),
|
|
849
|
+
"--ds-focus-ring-border": brandHex,
|
|
850
|
+
"--ds-gradient-brand": `linear-gradient(135deg, ${brandHex}, ${towardsInk(brandHex, RAMP.hover)})`,
|
|
851
|
+
"--ds-compat-color-brand-soft": formatHexColor(soft),
|
|
852
|
+
"--ds-compat-color-brand-soft-foreground": formatHexColor(softInk)
|
|
853
|
+
});
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
export { BRAND_THEME_PROPERTIES, breakpoints, colors, createBrandTheme, iconSizes, layout, motion, overlays, radii, reference, shadows, spacing, surfaces, systemTokens, typography, zIndex };
|
|
350
857
|
//# sourceMappingURL=index.js.map
|
|
351
858
|
//# sourceMappingURL=index.js.map
|