@lerianstudio/sindarian-ui 1.3.0 → 1.4.0-beta.2
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 +93 -12
- package/dist/components/card/account-card/index.d.ts.map +1 -1
- package/dist/components/card/account-card/index.js +2 -2
- package/dist/components/card/entity-card/index.d.ts.map +1 -1
- package/dist/components/card/entity-card/index.js +5 -1
- package/dist/components/dialog/confirmation-dialog/index.d.ts +10 -2
- package/dist/components/dialog/confirmation-dialog/index.d.ts.map +1 -1
- package/dist/components/dialog/confirmation-dialog/index.js +72 -7
- package/dist/components/page-header/index.d.ts +14 -2
- package/dist/components/page-header/index.d.ts.map +1 -1
- package/dist/components/page-header/index.js +4 -4
- package/dist/components/ui/accordion/index.js +1 -1
- package/dist/components/ui/alert/index.d.ts +1 -1
- package/dist/components/ui/alert/styles.css +3 -3
- package/dist/components/ui/alert-dialog/index.d.ts +8 -2
- package/dist/components/ui/alert-dialog/index.d.ts.map +1 -1
- package/dist/components/ui/alert-dialog/index.js +4 -4
- package/dist/components/ui/autocomplete/index.d.ts +1 -1
- package/dist/components/ui/autocomplete/index.d.ts.map +1 -1
- package/dist/components/ui/autocomplete/index.js +42 -6
- package/dist/components/ui/badge/index.d.ts +10 -2
- package/dist/components/ui/badge/index.d.ts.map +1 -1
- package/dist/components/ui/badge/index.js +24 -4
- package/dist/components/ui/breadcrumb/styles.css +1 -1
- package/dist/components/ui/button/index.d.ts +2 -2
- package/dist/components/ui/button/index.d.ts.map +1 -1
- package/dist/components/ui/button/index.js +2 -1
- package/dist/components/ui/button/styles.css +17 -4
- package/dist/components/ui/card/index.d.ts +10 -2
- package/dist/components/ui/card/index.d.ts.map +1 -1
- package/dist/components/ui/card/index.js +2 -2
- package/dist/components/ui/command/index.js +1 -1
- package/dist/components/ui/dialog/styles.css +3 -3
- package/dist/components/ui/dropdown-menu/index.js +2 -2
- package/dist/components/ui/hover-card/index.js +1 -1
- package/dist/components/ui/input/adornment.d.ts +1 -1
- package/dist/components/ui/loading-button/index.js +1 -1
- package/dist/components/ui/multiple-select/index.js +1 -1
- package/dist/components/ui/otp-input/index.js +1 -1
- package/dist/components/ui/paper-collapsible/index.js +1 -1
- package/dist/components/ui/popover/index.js +1 -1
- package/dist/components/ui/select/styles.css +1 -1
- package/dist/components/ui/sheet/index.d.ts +1 -1
- package/dist/components/ui/sheet/index.js +2 -2
- package/dist/components/ui/sidebar/sidebar-expand-button.d.ts +5 -0
- package/dist/components/ui/sidebar/sidebar-expand-button.d.ts.map +1 -1
- package/dist/components/ui/sidebar/sidebar-expand-button.js +1 -1
- package/dist/components/ui/sidebar/sidebar-item-collapsible.js +1 -1
- package/dist/components/ui/skeleton/index.js +1 -1
- package/dist/components/ui/toast/toaster.d.ts +5 -0
- package/dist/components/ui/toast/toaster.d.ts.map +1 -1
- package/dist/components/ui/toast/toaster.js +6 -2
- package/dist/components/ui/tooltip/index.js +1 -1
- package/dist/domain/blotter/index.d.ts +7 -1
- package/dist/domain/blotter/index.d.ts.map +1 -1
- package/dist/domain/blotter/index.js +7 -3
- package/dist/domain/delinquency-aging/aging-buckets.d.ts +4 -1
- package/dist/domain/delinquency-aging/aging-buckets.d.ts.map +1 -1
- package/dist/domain/delinquency-aging/aging-buckets.js +7 -2
- package/dist/domain/delinquency-aging/index.d.ts +11 -1
- package/dist/domain/delinquency-aging/index.d.ts.map +1 -1
- package/dist/domain/delinquency-aging/index.js +7 -3
- package/dist/domain/figure/index.d.ts +13 -6
- package/dist/domain/figure/index.d.ts.map +1 -1
- package/dist/domain/figure/index.js +1 -0
- package/dist/domain/section-label/index.d.ts +7 -1
- package/dist/domain/section-label/index.d.ts.map +1 -1
- package/dist/domain/section-label/index.js +6 -2
- package/dist/enterprise/app-shell/index.d.ts +14 -0
- package/dist/enterprise/app-shell/index.d.ts.map +1 -1
- package/dist/enterprise/app-shell/index.js +2 -2
- package/dist/enterprise/data-table/index.d.ts +13 -1
- package/dist/enterprise/data-table/index.d.ts.map +1 -1
- package/dist/enterprise/data-table/index.js +7 -3
- package/dist/enterprise/search-input/index.d.ts +7 -1
- package/dist/enterprise/search-input/index.d.ts.map +1 -1
- package/dist/enterprise/search-input/index.js +2 -2
- package/dist/esm/components/card/account-card/index.d.ts.map +1 -1
- package/dist/esm/components/card/account-card/index.js +2 -2
- package/dist/esm/components/card/entity-card/index.d.ts.map +1 -1
- package/dist/esm/components/card/entity-card/index.js +5 -1
- package/dist/esm/components/dialog/confirmation-dialog/index.d.ts +10 -2
- package/dist/esm/components/dialog/confirmation-dialog/index.d.ts.map +1 -1
- package/dist/esm/components/dialog/confirmation-dialog/index.js +39 -7
- package/dist/esm/components/page-header/index.d.ts +14 -2
- package/dist/esm/components/page-header/index.d.ts.map +1 -1
- package/dist/esm/components/page-header/index.js +4 -4
- package/dist/esm/components/ui/accordion/index.js +1 -1
- package/dist/esm/components/ui/alert/index.d.ts +1 -1
- package/dist/esm/components/ui/alert-dialog/index.d.ts +8 -2
- package/dist/esm/components/ui/alert-dialog/index.d.ts.map +1 -1
- package/dist/esm/components/ui/alert-dialog/index.js +4 -4
- package/dist/esm/components/ui/autocomplete/index.d.ts +1 -1
- package/dist/esm/components/ui/autocomplete/index.d.ts.map +1 -1
- package/dist/esm/components/ui/autocomplete/index.js +42 -6
- package/dist/esm/components/ui/badge/index.d.ts +10 -2
- package/dist/esm/components/ui/badge/index.d.ts.map +1 -1
- package/dist/esm/components/ui/badge/index.js +24 -4
- package/dist/esm/components/ui/button/index.d.ts +2 -2
- package/dist/esm/components/ui/button/index.d.ts.map +1 -1
- package/dist/esm/components/ui/button/index.js +2 -1
- package/dist/esm/components/ui/card/index.d.ts +10 -2
- package/dist/esm/components/ui/card/index.d.ts.map +1 -1
- package/dist/esm/components/ui/card/index.js +2 -2
- package/dist/esm/components/ui/command/index.js +1 -1
- package/dist/esm/components/ui/dropdown-menu/index.js +2 -2
- package/dist/esm/components/ui/hover-card/index.js +1 -1
- package/dist/esm/components/ui/input/adornment.d.ts +1 -1
- package/dist/esm/components/ui/loading-button/index.js +1 -1
- package/dist/esm/components/ui/multiple-select/index.js +1 -1
- package/dist/esm/components/ui/otp-input/index.js +1 -1
- package/dist/esm/components/ui/paper-collapsible/index.js +1 -1
- package/dist/esm/components/ui/popover/index.js +1 -1
- package/dist/esm/components/ui/sheet/index.d.ts +1 -1
- package/dist/esm/components/ui/sheet/index.js +2 -2
- package/dist/esm/components/ui/sidebar/sidebar-expand-button.d.ts +5 -0
- package/dist/esm/components/ui/sidebar/sidebar-expand-button.d.ts.map +1 -1
- package/dist/esm/components/ui/sidebar/sidebar-expand-button.js +1 -1
- package/dist/esm/components/ui/sidebar/sidebar-item-collapsible.js +1 -1
- package/dist/esm/components/ui/skeleton/index.js +1 -1
- package/dist/esm/components/ui/toast/toaster.d.ts +5 -0
- package/dist/esm/components/ui/toast/toaster.d.ts.map +1 -1
- package/dist/esm/components/ui/toast/toaster.js +6 -2
- package/dist/esm/components/ui/tooltip/index.js +1 -1
- package/dist/esm/domain/blotter/index.d.ts +7 -1
- package/dist/esm/domain/blotter/index.d.ts.map +1 -1
- package/dist/esm/domain/blotter/index.js +7 -3
- package/dist/esm/domain/delinquency-aging/aging-buckets.d.ts +4 -1
- package/dist/esm/domain/delinquency-aging/aging-buckets.d.ts.map +1 -1
- package/dist/esm/domain/delinquency-aging/aging-buckets.js +7 -2
- package/dist/esm/domain/delinquency-aging/index.d.ts +11 -1
- package/dist/esm/domain/delinquency-aging/index.d.ts.map +1 -1
- package/dist/esm/domain/delinquency-aging/index.js +7 -3
- package/dist/esm/domain/figure/index.d.ts +13 -6
- package/dist/esm/domain/figure/index.d.ts.map +1 -1
- package/dist/esm/domain/figure/index.js +1 -0
- package/dist/esm/domain/section-label/index.d.ts +7 -1
- package/dist/esm/domain/section-label/index.d.ts.map +1 -1
- package/dist/esm/domain/section-label/index.js +6 -2
- package/dist/esm/enterprise/app-shell/index.d.ts +14 -0
- package/dist/esm/enterprise/app-shell/index.d.ts.map +1 -1
- package/dist/esm/enterprise/app-shell/index.js +2 -2
- package/dist/esm/enterprise/data-table/index.d.ts +13 -1
- package/dist/esm/enterprise/data-table/index.d.ts.map +1 -1
- package/dist/esm/enterprise/data-table/index.js +8 -4
- package/dist/esm/enterprise/search-input/index.d.ts +7 -1
- package/dist/esm/enterprise/search-input/index.d.ts.map +1 -1
- package/dist/esm/enterprise/search-input/index.js +2 -2
- package/dist/esm/lib/utils.d.ts.map +1 -1
- package/dist/esm/lib/utils.js +27 -1
- package/dist/esm/theme/theme-provider.d.ts +8 -0
- package/dist/esm/theme/theme-provider.d.ts.map +1 -1
- package/dist/esm/theme/theme-provider.js +10 -0
- package/dist/globals.css +85 -58
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +27 -1
- package/dist/theme/theme-provider.d.ts +8 -0
- package/dist/theme/theme-provider.d.ts.map +1 -1
- package/dist/theme/theme-provider.js +11 -0
- package/package.json +1 -1
package/dist/globals.css
CHANGED
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
@custom-variant dark (&:is(.dark *));
|
|
14
14
|
|
|
15
15
|
@theme inline {
|
|
16
|
-
--font-sans:
|
|
16
|
+
--font-sans:
|
|
17
|
+
var(--font-inter, 'Inter'), 'Inter', ui-sans-serif, system-ui, sans-serif;
|
|
17
18
|
|
|
18
19
|
--shadow-sidebar: 5px 0px 15px -3px hsl(var(--shadow-color) / 0.05);
|
|
19
20
|
--shadow-data-table:
|
|
@@ -211,6 +212,8 @@
|
|
|
211
212
|
|
|
212
213
|
@layer base {
|
|
213
214
|
:root {
|
|
215
|
+
color-scheme: light; /* native widgets (form controls, scrollbars) follow the theme */
|
|
216
|
+
|
|
214
217
|
/* Application tokens (from Figma ring-tokens) */
|
|
215
218
|
--body-surface: 240 5% 96%; /* base/100 = #F4F4F5 */
|
|
216
219
|
--body-text: 240 4% 46%; /* base/500 = #71717A */
|
|
@@ -319,6 +322,8 @@
|
|
|
319
322
|
}
|
|
320
323
|
|
|
321
324
|
.dark {
|
|
325
|
+
color-scheme: dark; /* native widgets (form controls, scrollbars) follow the theme */
|
|
326
|
+
|
|
322
327
|
/* Custom — Layout */
|
|
323
328
|
--link-hover: 240 5% 96%; /* #F4F4F5 80% (opacity via /80) */
|
|
324
329
|
--link-mute: 240 5% 96%; /* #F4F4F5 40% (opacity via /40) */
|
|
@@ -358,6 +363,17 @@
|
|
|
358
363
|
--accent-hover: 46 98% 57%; /* sunglow/400 = #FDCB28 - opacity via /70 */
|
|
359
364
|
--accent-mute: 46 98% 57%; /* sunglow/400 = #FDCB28 - opacity via /50 */
|
|
360
365
|
|
|
366
|
+
/*
|
|
367
|
+
Shadcn — Destructive. Lifted to red/400 like every other red in this
|
|
368
|
+
block (--system-error, --credit, --chart-2): the light red/500 inherited
|
|
369
|
+
here before, which left `text-destructive` at 2.76:1 on a --card surface
|
|
370
|
+
and `bg-destructive`/`text-destructive-foreground` at 3.78:1. The
|
|
371
|
+
foreground inverts to red/950 — the deep end this theme already uses as
|
|
372
|
+
--system-error-surface — so the pair reads 5.94:1.
|
|
373
|
+
*/
|
|
374
|
+
--destructive: 0 91% 71%; /* red/400 = #F87171 */
|
|
375
|
+
--destructive-foreground: 0 75% 15%; /* red/950 = #450A0A */
|
|
376
|
+
|
|
361
377
|
/* Shadcn — System Error */
|
|
362
378
|
--system-error: 0 91% 71%; /* red/400 = #F87171 */
|
|
363
379
|
--system-error-surface: 0 75% 15%; /* red/950 = #450A0A */
|
|
@@ -396,9 +412,23 @@
|
|
|
396
412
|
/* Shadow color for dark mode */
|
|
397
413
|
--shadow-color: 0 0% 100%;
|
|
398
414
|
|
|
399
|
-
/*
|
|
400
|
-
|
|
401
|
-
|
|
415
|
+
/*
|
|
416
|
+
Ledger credit semantic — lifted for the dark canvas; foreground mirrors.
|
|
417
|
+
Sized by the composite the mirror actually produces, not by the plain
|
|
418
|
+
pair: components write `bg-credit/10` + `text-credit`, so the real
|
|
419
|
+
measurement is credit-as-text over a 10% credit tint composited on
|
|
420
|
+
--card. red/400 read only 3.34:1 there. red/300 — the channel this block
|
|
421
|
+
already uses for --system-error-text — reaches 4.59:1, and 5.54:1 as
|
|
422
|
+
plain text on --card.
|
|
423
|
+
|
|
424
|
+
Credit stays one step further from the canvas than --destructive
|
|
425
|
+
(red/400 here), the way light keeps credit at red/700 against a red/500
|
|
426
|
+
destructive: on a dark ground "further from the canvas" means lighter,
|
|
427
|
+
so the direction inverts but the separation holds and the two never read
|
|
428
|
+
as the same signal.
|
|
429
|
+
*/
|
|
430
|
+
--credit: 0 94% 82%; /* red/300 = #FCA5A5 */
|
|
431
|
+
--credit-foreground: 0 94% 82%; /* mirrors --credit */
|
|
402
432
|
|
|
403
433
|
/* Reconciliation matte fills — raised surfaces over base/800, one step apart. */
|
|
404
434
|
--matched-surface: 240 5% 26%; /* base/700 = #3F3F46 */
|
|
@@ -433,21 +463,41 @@
|
|
|
433
463
|
0 4px 6px -4px rgba(0, 0, 0, 0.1);
|
|
434
464
|
}
|
|
435
465
|
|
|
466
|
+
/*
|
|
467
|
+
Type fills come from the system token families, so a toast themes with the
|
|
468
|
+
rest of the app. All three coloured types take ONE ink, --accent-foreground:
|
|
469
|
+
a solid system fill is bright enough to need near-black ink in BOTH themes,
|
|
470
|
+
and that token is the only one in this sheet that is near-black in both.
|
|
471
|
+
|
|
472
|
+
It replaced the per-family reasoning that stood here, which routed success
|
|
473
|
+
and error through --primary-foreground because that token inverts (white in
|
|
474
|
+
light, base/800 in dark). Inverting was the bug: white ink on the LIGHT
|
|
475
|
+
fills measured 3.35:1 on --system-success and 3.78:1 on --system-error,
|
|
476
|
+
both under AA, and no token value can fix that from the white side — the
|
|
477
|
+
light green/600 and red/500 fills sit mid-luminance, so white caps at ~3.8
|
|
478
|
+
while near-black reaches 5.9 and 5.3. Ratios now, ink over fill:
|
|
479
|
+
light 5.93 / 5.25 / 11.17 and dark 11.39 / 7.23 / 13.00
|
|
480
|
+
(success / error / warning). The dark pairs were already passing at
|
|
481
|
+
8.51 / 5.41 / 13.00 and only gained. `toast ink` in
|
|
482
|
+
src/__tests__/tokens-contract.test.ts recomputes all six from these
|
|
483
|
+
declarations, so the next token edit that drops a pair under 4.5 fails
|
|
484
|
+
instead of shipping.
|
|
485
|
+
*/
|
|
436
486
|
[data-sonner-toast][data-type='success'] {
|
|
437
|
-
--normal-bg:
|
|
438
|
-
--normal-text:
|
|
487
|
+
--normal-bg: hsl(var(--system-success));
|
|
488
|
+
--normal-text: hsl(var(--accent-foreground));
|
|
439
489
|
--normal-border: transparent;
|
|
440
490
|
}
|
|
441
491
|
|
|
442
492
|
[data-sonner-toast][data-type='error'] {
|
|
443
|
-
--normal-bg:
|
|
444
|
-
--normal-text:
|
|
493
|
+
--normal-bg: hsl(var(--system-error));
|
|
494
|
+
--normal-text: hsl(var(--accent-foreground));
|
|
445
495
|
--normal-border: transparent;
|
|
446
496
|
}
|
|
447
497
|
|
|
448
498
|
[data-sonner-toast][data-type='warning'] {
|
|
449
|
-
--normal-bg:
|
|
450
|
-
--normal-text:
|
|
499
|
+
--normal-bg: hsl(var(--system-alert));
|
|
500
|
+
--normal-text: hsl(var(--accent-foreground));
|
|
451
501
|
--normal-border: transparent;
|
|
452
502
|
}
|
|
453
503
|
|
|
@@ -476,42 +526,35 @@
|
|
|
476
526
|
display: none !important;
|
|
477
527
|
}
|
|
478
528
|
|
|
529
|
+
/*
|
|
530
|
+
The close button derives from the toast's own --normal-text, so it is legible
|
|
531
|
+
on every fill and in both themes by construction. That is what replaced the
|
|
532
|
+
six rules previously here: one per-theme pair plus one pair per coloured
|
|
533
|
+
type, each hardcoding the ink it assumed the fill needed.
|
|
534
|
+
|
|
535
|
+
Both rules keep !important. Sonner's own resting rule is
|
|
536
|
+
`[data-sonner-toast][data-styled='true'] [data-close-button]` (0,3,0,
|
|
537
|
+
color: var(--gray12)) and its dark rule adds a fourth compound, so a plain
|
|
538
|
+
descendant selector here cannot win the cascade against a stylesheet that is
|
|
539
|
+
injected at runtime — the fade this rule intends was previously decided by
|
|
540
|
+
source order rather than by the sheet.
|
|
541
|
+
*/
|
|
479
542
|
[data-sonner-toast] [data-close-button] {
|
|
480
|
-
color:
|
|
543
|
+
color: color-mix(in srgb, var(--normal-text) 50%, transparent) !important;
|
|
481
544
|
}
|
|
482
545
|
|
|
483
546
|
[data-sonner-toast] [data-close-button]:hover {
|
|
484
|
-
color:
|
|
485
|
-
background-color:
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
color:
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
[data-sonner-toast][data-type='success'] [data-close-button],
|
|
496
|
-
[data-sonner-toast][data-type='error'] [data-close-button] {
|
|
497
|
-
color: rgba(255, 255, 255, 0.6);
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
[data-sonner-toast][data-type='success'] [data-close-button]:hover,
|
|
501
|
-
[data-sonner-toast][data-type='error'] [data-close-button]:hover {
|
|
502
|
-
color: #ffffff !important;
|
|
503
|
-
background-color: hsl(var(--foreground)) !important;
|
|
504
|
-
border-color: hsl(var(--foreground)) !important;
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
[data-sonner-toast][data-type='warning'] [data-close-button] {
|
|
508
|
-
color: rgba(66, 32, 6, 0.5);
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
[data-sonner-toast][data-type='warning'] [data-close-button]:hover {
|
|
512
|
-
color: #422006 !important;
|
|
513
|
-
background-color: rgba(66, 32, 6, 0.15) !important;
|
|
514
|
-
border-color: rgba(66, 32, 6, 0.15) !important;
|
|
547
|
+
color: var(--normal-text) !important;
|
|
548
|
+
background-color: color-mix(
|
|
549
|
+
in srgb,
|
|
550
|
+
var(--normal-text) 15%,
|
|
551
|
+
transparent
|
|
552
|
+
) !important;
|
|
553
|
+
border-color: color-mix(
|
|
554
|
+
in srgb,
|
|
555
|
+
var(--normal-text) 15%,
|
|
556
|
+
transparent
|
|
557
|
+
) !important;
|
|
515
558
|
}
|
|
516
559
|
|
|
517
560
|
.dark [data-sonner-toast] {
|
|
@@ -557,22 +600,6 @@
|
|
|
557
600
|
}
|
|
558
601
|
}
|
|
559
602
|
|
|
560
|
-
@keyframes caret-blink {
|
|
561
|
-
0%,
|
|
562
|
-
70%,
|
|
563
|
-
100% {
|
|
564
|
-
opacity: 1;
|
|
565
|
-
}
|
|
566
|
-
20%,
|
|
567
|
-
50% {
|
|
568
|
-
opacity: 0;
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
@utility animate-caret-blink {
|
|
573
|
-
animation: caret-blink 1.25s ease-out infinite;
|
|
574
|
-
}
|
|
575
|
-
|
|
576
603
|
.ticket {
|
|
577
604
|
mask: radial-gradient(21px 13px at 50% 102%, #0000 98%, #000) 50%
|
|
578
605
|
calc(100% - 16px) / 64px 100% repeat-x;
|
package/dist/lib/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAQ,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAQ,MAAM,MAAM,CAAA;AA8B5C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC"}
|
package/dist/lib/utils.js
CHANGED
|
@@ -3,6 +3,32 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.cn = cn;
|
|
4
4
|
const clsx_1 = require("clsx");
|
|
5
5
|
const tailwind_merge_1 = require("tailwind-merge");
|
|
6
|
+
/**
|
|
7
|
+
* The kit's button variants are component classes in `@layer components`, not
|
|
8
|
+
* Tailwind utilities, so stock tailwind-merge has no group for them: it kept
|
|
9
|
+
* `button-primary button-destructive` together and let stylesheet source order
|
|
10
|
+
* pick the winner. Declaring the group makes the last one win, like every other
|
|
11
|
+
* conflict `cn` resolves.
|
|
12
|
+
*
|
|
13
|
+
* Variant classes only. `button-base`, `button-disabled`, `button-read-only`
|
|
14
|
+
* and `button-small` compose with a variant instead of conflicting with it, so
|
|
15
|
+
* they stay out of the group and are never merged away.
|
|
16
|
+
*/
|
|
17
|
+
const twMerge = (0, tailwind_merge_1.extendTailwindMerge)({
|
|
18
|
+
extend: {
|
|
19
|
+
classGroups: {
|
|
20
|
+
'sindarian-button-variant': [
|
|
21
|
+
'button-plain',
|
|
22
|
+
'button-primary',
|
|
23
|
+
'button-secondary',
|
|
24
|
+
'button-tertiary',
|
|
25
|
+
'button-outline',
|
|
26
|
+
'button-link',
|
|
27
|
+
'button-destructive'
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
6
32
|
function cn(...inputs) {
|
|
7
|
-
return
|
|
33
|
+
return twMerge((0, clsx_1.clsx)(inputs));
|
|
8
34
|
}
|
|
@@ -34,5 +34,13 @@ export interface ThemeProviderProps {
|
|
|
34
34
|
export declare function ThemeProvider({ children, storageKey, defaultTheme }: ThemeProviderProps): React.JSX.Element;
|
|
35
35
|
/** Reads the theme context. Throws if used outside a ThemeProvider. */
|
|
36
36
|
export declare function useTheme(): ThemeContextValue;
|
|
37
|
+
/**
|
|
38
|
+
* Reads the theme context without requiring a provider — `undefined` when
|
|
39
|
+
* there is none. For library components that should follow the theme when one
|
|
40
|
+
* exists but must not force every consumer to mount a ThemeProvider (Toaster).
|
|
41
|
+
* Not re-exported from the package barrel: consumers use `useTheme`, whose
|
|
42
|
+
* throw is the intended signal that the provider is missing.
|
|
43
|
+
*/
|
|
44
|
+
export declare function useOptionalTheme(): ThemeContextValue | undefined;
|
|
37
45
|
export {};
|
|
38
46
|
//# sourceMappingURL=theme-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-provider.d.ts","sourceRoot":"","sources":["../../src/theme/theme-provider.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAA;AAgBzD,KAAK,iBAAiB,GAAG;IACvB,oEAAoE;IACpE,KAAK,EAAE,eAAe,CAAA;IACtB,yEAAyE;IACzE,QAAQ,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,CAAA;IACzC,mDAAmD;IACnD,aAAa,EAAE,OAAO,GAAG,MAAM,CAAA;CAChC,CAAA;AAID,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,iEAAiE;IACjE,YAAY,CAAC,EAAE,eAAe,CAAA;CAC/B;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,UAA8B,EAC9B,YAAuB,EACxB,EAAE,kBAAkB,qBAwFpB;AAED,uEAAuE;AACvE,wBAAgB,QAAQ,IAAI,iBAAiB,CAM5C"}
|
|
1
|
+
{"version":3,"file":"theme-provider.d.ts","sourceRoot":"","sources":["../../src/theme/theme-provider.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAA;AAgBzD,KAAK,iBAAiB,GAAG;IACvB,oEAAoE;IACpE,KAAK,EAAE,eAAe,CAAA;IACtB,yEAAyE;IACzE,QAAQ,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,CAAA;IACzC,mDAAmD;IACnD,aAAa,EAAE,OAAO,GAAG,MAAM,CAAA;CAChC,CAAA;AAID,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,iEAAiE;IACjE,YAAY,CAAC,EAAE,eAAe,CAAA;CAC/B;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,UAA8B,EAC9B,YAAuB,EACxB,EAAE,kBAAkB,qBAwFpB;AAED,uEAAuE;AACvE,wBAAgB,QAAQ,IAAI,iBAAiB,CAM5C;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,IAAI,iBAAiB,GAAG,SAAS,CAEhE"}
|
|
@@ -36,6 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
37
|
exports.ThemeProvider = ThemeProvider;
|
|
38
38
|
exports.useTheme = useTheme;
|
|
39
|
+
exports.useOptionalTheme = useOptionalTheme;
|
|
39
40
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
40
41
|
/**
|
|
41
42
|
* ThemeProvider — owns theme preference ('light' | 'dark' | 'system'),
|
|
@@ -147,3 +148,13 @@ function useTheme() {
|
|
|
147
148
|
}
|
|
148
149
|
return context;
|
|
149
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* Reads the theme context without requiring a provider — `undefined` when
|
|
153
|
+
* there is none. For library components that should follow the theme when one
|
|
154
|
+
* exists but must not force every consumer to mount a ThemeProvider (Toaster).
|
|
155
|
+
* Not re-exported from the package barrel: consumers use `useTheme`, whose
|
|
156
|
+
* throw is the intended signal that the provider is missing.
|
|
157
|
+
*/
|
|
158
|
+
function useOptionalTheme() {
|
|
159
|
+
return React.useContext(ThemeContext) ?? undefined;
|
|
160
|
+
}
|