@widgetic/design-system 0.5.30 → 0.5.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/components/EmptyState.svelte +5 -2
  2. package/dist/components/chat/OptionRow.svelte +1 -1
  3. package/dist/components/modals/ActionModal.svelte +10 -9
  4. package/dist/components/modals/BaseModal.svelte +6 -6
  5. package/dist/components/modals/README.md +1 -1
  6. package/dist/components/shell/SettingsDialog.svelte +54 -33
  7. package/dist/components/shell/WidgetRow.svelte +8 -1
  8. package/dist/components/shell/WidgetRow.svelte.d.ts +2 -0
  9. package/dist/components/toast/ToasterModal.svelte +65 -33
  10. package/dist/components/toast/ToasterModal.svelte.d.ts +6 -1
  11. package/dist/components/toast/toastDismissCountdown.d.ts +5 -0
  12. package/dist/components/toast/toastDismissCountdown.js +47 -0
  13. package/dist/components/toast/toastDismissCountdownPayload.d.ts +16 -0
  14. package/dist/components/toast/toastDismissCountdownPayload.js +24 -0
  15. package/dist/components/ui/button/button.svelte +1 -1
  16. package/dist/components/ui/command/command-item.svelte +1 -1
  17. package/dist/components/ui/command/command-link-item.svelte +1 -1
  18. package/dist/components/ui/dialog/DialogLayerSync.svelte +38 -0
  19. package/dist/components/ui/dialog/DialogLayerSync.svelte.d.ts +8 -0
  20. package/dist/components/ui/dialog/dialog-content.svelte +63 -20
  21. package/dist/components/ui/dialog/dialog-content.svelte.d.ts +1 -0
  22. package/dist/components/ui/dialog/dialog-overlay.svelte +24 -20
  23. package/dist/components/ui/dialog/overlay-layer-context.d.ts +8 -0
  24. package/dist/components/ui/dialog/overlay-layer-context.js +1 -0
  25. package/dist/components/ui/drawer/drawer-content.svelte +25 -1
  26. package/dist/components/ui/drawer/drawer-overlay.svelte +32 -5
  27. package/dist/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +1 -1
  28. package/dist/components/ui/dropdown-menu/dropdown-menu-content.svelte +3 -1
  29. package/dist/components/ui/dropdown-menu/dropdown-menu-item.svelte +1 -1
  30. package/dist/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte +1 -1
  31. package/dist/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte +3 -1
  32. package/dist/components/ui/hover-card/hover-card-content.svelte +3 -1
  33. package/dist/components/ui/popover/popover-content.svelte +3 -1
  34. package/dist/components/ui/select/select-content.svelte +3 -1
  35. package/dist/components/ui/slider/slider.svelte +17 -6
  36. package/dist/components/ui/tabs/tabs-trigger.svelte +1 -1
  37. package/dist/components/ui/toggle/toggle.svelte +1 -1
  38. package/dist/components/ui/toggle/toggle.svelte.d.ts +2 -2
  39. package/dist/components/ui/tooltip/tooltip-content.svelte +3 -1
  40. package/dist/styles/fonts.css +4 -33
  41. package/dist/styles/global.css +86 -20
  42. package/dist/styles/tokens.css +6 -10
  43. package/dist/utils/overlayLayerStack.d.ts +54 -0
  44. package/dist/utils/overlayLayerStack.js +89 -0
  45. package/dist/utils/overlayMotion.d.ts +17 -39
  46. package/dist/utils/overlayMotion.js +42 -61
  47. package/dist/utils/toastMotion.d.ts +12 -0
  48. package/dist/utils/toastMotion.js +12 -0
  49. package/package.json +2 -2
  50. package/tailwind.config.ts +4 -11
  51. package/dist/fonts/Cousine/Cousine-Bold.woff2 +0 -0
  52. package/dist/fonts/Cousine/Cousine-Regular.woff2 +0 -0
@@ -28,18 +28,10 @@ go 3 levels up in development mode, 2 levels up in production mode*/
28
28
  --color-grey6: hsl(var(--grey6));
29
29
  --color-grey7: hsl(var(--grey7));
30
30
 
31
- /* Figma Foundations Tokens (01 — Foundations 38:142) */
31
+ /* Figma Foundations Tokens (01 — Foundations 38:142). Round 31 removed the eight that no code read (ink-secondary, ink-muted, surface-canvas, surface-dark, surface-ink-on-dark, accent-orange, accent-green, primary-green-muted): see __docs/migrating-to-the-new-tokens.md. */
32
32
  --color-ink-primary: hsl(var(--ink-primary));
33
33
  --color-primary-green: hsl(var(--primary-green));
34
- --color-ink-secondary: hsl(var(--ink-secondary));
35
- --color-ink-muted: hsl(var(--ink-muted));
36
34
  --color-ink-subtle: hsl(var(--ink-subtle));
37
- --color-surface-canvas: hsl(var(--surface-canvas));
38
- --color-surface-dark: hsl(var(--surface-dark));
39
- --color-surface-ink-on-dark: hsl(var(--surface-ink-on-dark));
40
- --color-accent-orange: hsl(var(--accent-orange));
41
- --color-accent-green: hsl(var(--accent-green));
42
- --color-primary-green-muted: hsl(var(--primary-green-muted));
43
35
 
44
36
  --radius-pill: 100px;
45
37
  --radius-large: 15px;
@@ -135,8 +127,7 @@ go 3 levels up in development mode, 2 levels up in production mode*/
135
127
  --scrollbar-thumb-hover-color: hsl(var(--grey3));
136
128
  --scrollbar-track-color: hsl(var(--grey1));
137
129
 
138
- /* Icon Colors */
139
- --icon-success: 142 71% 45%;
130
+ /* Icon Colors (--icon-success was removed in round 31: nothing read it) */
140
131
  --icon-error: 0 84% 60%;
141
132
 
142
133
 
@@ -161,18 +152,10 @@ go 3 levels up in development mode, 2 levels up in production mode*/
161
152
  --grey6: 0 0% 26.7%; /* #444444 */
162
153
  --grey7: 124 36.2% 9.2%; /* #0F2010 */
163
154
 
164
- /* Figma Foundations Tokens (01 — Foundations 38:142) */
155
+ /* Figma Foundations Tokens (01 — Foundations 38:142). The other eight of this block were removed in round 31 (nothing read them). */
165
156
  --ink-primary: 124 36.2% 9.2%; /* #0F2010 */
166
157
  --primary-green: 116.3 25.4% 24.7%; /* #314F2F */
167
- --ink-secondary: 0 0% 26.7%; /* #444444 */
168
- --ink-muted: 0 0% 45.9%; /* #757575 */
169
158
  --ink-subtle: 0 0% 40%; /* #666666 */
170
- --surface-canvas: 0 0% 100%; /* #FFFFFF */
171
- --surface-dark: 124 36.2% 9.2%; /* #0F2010 */
172
- --surface-ink-on-dark: 0 0% 100%; /* #FFFFFF */
173
- --accent-orange: 0 88.6% 65.7%; /* #F55A5A */
174
- --accent-green: 101.6 25.8% 52.9%; /* #7BA668 */
175
- --primary-green-muted: 88.2 20% 83.3%; /* #D5DDCC */
176
159
 
177
160
 
178
161
 
@@ -953,6 +936,89 @@ go 3 levels up in development mode, 2 levels up in production mode*/
953
936
  }
954
937
  } /* End of Base Layer Styles */
955
938
 
939
+ /* Toast (ToasterModal): width fits copy; stack stays above dialogs (Portal ~1e8, sonner default ~1e9). */
940
+ .toast-modal-host[data-sonner-toaster] {
941
+ left: 50% !important;
942
+ right: auto !important;
943
+ transform: translateX(-50%) !important;
944
+ width: max-content !important;
945
+ max-width: min(420px, calc(100vw - 2rem));
946
+ }
947
+
948
+ .toast-modal-host [data-sonner-toast].toast-modal {
949
+ width: max-content;
950
+ max-width: 420px;
951
+ }
952
+
953
+ .toast-modal-host [data-sonner-toast].toast-modal [data-title] {
954
+ text-align: start;
955
+ }
956
+
957
+ .toast-modal-host [data-sonner-toast].toast-modal [data-description] {
958
+ display: none !important;
959
+ }
960
+
961
+ /* Toast (ToasterModal): top-centre pill, slide in, fade out in place. */
962
+ @media (prefers-reduced-motion: no-preference) {
963
+ [data-sonner-toaster][data-y-position='top'] {
964
+ top: 1rem !important;
965
+ }
966
+
967
+ [data-sonner-toaster][data-y-position='top'] [data-sonner-toast][data-mounted] {
968
+ animation: widgetic-toast-enter var(--toast-enter-ms, 200ms) cubic-bezier(0.33, 1, 0.68, 1);
969
+ }
970
+
971
+ [data-sonner-toaster][data-y-position='top'] [data-sonner-toast][data-removed='true'] {
972
+ animation: widgetic-toast-exit var(--toast-exit-ms, 150ms) ease-out forwards;
973
+ }
974
+ }
975
+
976
+ @keyframes widgetic-toast-enter {
977
+ from {
978
+ opacity: 0;
979
+ transform: translateY(-16px);
980
+ }
981
+
982
+ to {
983
+ opacity: 1;
984
+ transform: translateY(0);
985
+ }
986
+ }
987
+
988
+ @keyframes widgetic-toast-exit {
989
+ from {
990
+ opacity: 1;
991
+ }
992
+
993
+ to {
994
+ opacity: 0;
995
+ }
996
+ }
997
+
998
+ @media (prefers-reduced-motion: reduce) {
999
+ [data-sonner-toaster][data-y-position='top'] [data-sonner-toast][data-mounted],
1000
+ [data-sonner-toaster][data-y-position='top'] [data-sonner-toast][data-removed='true'] {
1001
+ animation: none !important;
1002
+ }
1003
+ }
1004
+
1005
+ /* Sonner's <600px rules left-align the stack; toasts stay viewport-centred. */
1006
+ @media (max-width: 600px) {
1007
+ .toast-modal-host[data-sonner-toaster] {
1008
+ left: 50% !important;
1009
+ right: auto !important;
1010
+ transform: translateX(-50%) !important;
1011
+ width: max-content !important;
1012
+ }
1013
+
1014
+ .toast-modal-host[data-sonner-toaster] [data-sonner-toast] {
1015
+ left: auto !important;
1016
+ right: auto !important;
1017
+ width: max-content !important;
1018
+ max-width: min(420px, calc(100vw - 2rem));
1019
+ }
1020
+ }
1021
+
956
1022
  /* Debug styles */
957
1023
  [data-debug="true"] [data-debug-footer] {
958
1024
  @apply bg-blue-100/30;
@@ -16,6 +16,11 @@
16
16
  --color-amber: #b45309;
17
17
  --color-sage-green: #7ba668;
18
18
  --color-light-green: #e3f0db;
19
+ /*
20
+ * Success toast pill (round 5): the green of the reference toast, one step darker so that white 14px/500 text keeps 4.5:1 (4.54:1).
21
+ * Used by the toast only, and not a Figma variable yet (add it to the Color collection before it is used anywhere else).
22
+ */
23
+ --color-toast-green: #008932;
19
24
 
20
25
  --color-alpha-dark-04: color-mix(in oklab, var(--color-dark) 4%, transparent);
21
26
  --color-alpha-dark-08: color-mix(in oklab, var(--color-dark) 8%, transparent);
@@ -56,7 +61,7 @@
56
61
  --accent-hover: var(--color-alpha-dark-08);
57
62
  --destructive: var(--color-error);
58
63
  --destructive-foreground: var(--color-white);
59
- /* Warning icon and text, 5.0:1 on white. For the Warning tone of a toast or a note, never a button or a surface. */
64
+ /* Warning icon and text, 5.0:1 on white, and the surface of the Warning toast (white text on it is 5.0:1 too). Never a button. */
60
65
  --warning: var(--color-amber);
61
66
  --brand: var(--color-sage-green);
62
67
  --brand-foreground: var(--color-dark);
@@ -67,11 +72,8 @@
67
72
  --ring: var(--color-deep-forest-green);
68
73
  --sidebar: var(--color-neutral-100);
69
74
  --sidebar-foreground: var(--color-dark);
70
- --sidebar-primary: var(--color-deep-forest-green);
71
- --sidebar-primary-foreground: var(--color-white);
72
75
  --sidebar-accent: var(--color-alpha-dark-04);
73
76
  --sidebar-accent-foreground: var(--color-dark);
74
- --sidebar-border: var(--color-neutral-200);
75
77
  --sidebar-ring: var(--color-deep-forest-green);
76
78
  --shadow-soft: var(--color-alpha-dark-08);
77
79
  --inverse: var(--color-dark);
@@ -170,11 +172,8 @@
170
172
  --ring: var(--color-sage-green);
171
173
  --sidebar: var(--color-dark);
172
174
  --sidebar-foreground: var(--color-white);
173
- --sidebar-primary: var(--color-sage-green);
174
- --sidebar-primary-foreground: var(--color-dark);
175
175
  --sidebar-accent: var(--color-alpha-light-10);
176
176
  --sidebar-accent-foreground: var(--color-white);
177
- --sidebar-border: var(--color-alpha-sage-25);
178
177
  --sidebar-ring: var(--color-sage-green);
179
178
  }
180
179
 
@@ -206,11 +205,8 @@
206
205
  --color-ring: var(--ring);
207
206
  --color-sidebar: var(--sidebar);
208
207
  --color-sidebar-foreground: var(--sidebar-foreground);
209
- --color-sidebar-primary: var(--sidebar-primary);
210
- --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
211
208
  --color-sidebar-accent: var(--sidebar-accent);
212
209
  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
213
- --color-sidebar-border: var(--sidebar-border);
214
210
  --color-sidebar-ring: var(--sidebar-ring);
215
211
  --color-inverse: var(--inverse);
216
212
  --color-inverse-foreground: var(--inverse-foreground);
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Z-index stack for dialog / drawer scrims portaled to the document.
3
+ *
4
+ * Only scrims get a rising z-index (`50 + 2 * index`). Panels sit one above their scrim (`scrim + 1`, see
5
+ * `overlayLayerZIndexStyle`) and popovers read `--widgetic-overlay-floating-z` (`scrim + 2` of the top layer), so selects and
6
+ * menus stay above every panel.
7
+ *
8
+ * A host that draws layers of its own above 50 (the creator's floating panels sit at 2003) says so where it opens a dialog,
9
+ * with `layerBase` on `Dialog.Content`: that dialog, and every dialog opened above it, start from that base. Page CSS cannot
10
+ * do it (see `overlayLayerZIndexStyle`: the layers are out of its reach, by design).
11
+ */
12
+ /** First scrim z-index when the host asks for nothing else; leaves z-40 for the canvas overlay portal. */
13
+ export declare const overlayLayerBaseZ = 50;
14
+ export declare const overlayLayerStride = 2;
15
+ /** Default when no overlay is open (matches legacy `z-50` on floating layers). */
16
+ export declare const overlayFloatingContentDefaultZ = 50;
17
+ /**
18
+ * Claim the next scrim layer while a dialog is opening.
19
+ *
20
+ * @param layerBase - Where the layer starts when nothing is open below it (`overlayLayerBaseZ`, 50, unless the host asked
21
+ * for more). A layer opened above another one is always above it, whatever its base: the dialog opened last is on top.
22
+ * @returns Scrim z-index plus `release` when the portal unmounts. `panelZ` is kept for tests only (scrim + 1).
23
+ */
24
+ export declare function claimOverlayLayerPair(layerBase?: number): {
25
+ scrimZ: number;
26
+ panelZ: number;
27
+ release: () => void;
28
+ };
29
+ /**
30
+ * The inline style that puts a scrim or a panel on its layer.
31
+ *
32
+ * It carries `!important` on purpose. An inline declaration with `!important` outranks every rule of every stylesheet,
33
+ * `!important` ones included, and the order of a dialog's two layers (the scrim at `z`, the panel at `z + 1`) is all that keeps
34
+ * the panel above its own scrim. A page can break that order from outside with one rule, and one did: the creator shipped a
35
+ * global `[data-dialog-overlay] { z-index: 9998 !important }`, which lifted the scrim of every dialog in the page above its
36
+ * panel (still at 51), so the Invite dialog of the dashboard, the settings dialog and the drawers were drawn under their own
37
+ * scrim whenever the creator's stylesheet was loaded. With the pair out of reach of the host page's CSS, that cannot happen
38
+ * again, whoever writes the next rule.
39
+ *
40
+ * This is the string form, for a `style` prop of a component or an element that spreads nothing. An element that spreads
41
+ * bits-ui's `props` (the scrim, the settings panel) writes the same thing as `style:z-index|important={z}`: a `style`
42
+ * ATTRIBUTE after the spread would replace `props.style`, where bits-ui keeps `pointer-events: auto` (the page behind a modal
43
+ * dialog has `pointer-events: none`), and nothing inside the settings dialog could be clicked; a `style:` directive merges.
44
+ * `tests/overlayLayerZIndexInline.test.ts` holds both rules.
45
+ *
46
+ * @param zIndex - The layer: `scrimZ` for a scrim, `scrimZ + 1` for a panel.
47
+ */
48
+ export declare function overlayLayerZIndexStyle(zIndex: number): string;
49
+ /** z-index for select / popover / menu / tooltip portals (above every open dialog panel). */
50
+ export declare function overlayFloatingContentZ(): number;
51
+ /** Tailwind-friendly class for floating overlay content (literal for the scanner). */
52
+ export declare const overlayFloatingContentZClass = "z-[var(--widgetic-overlay-floating-z,50)]";
53
+ export declare function overlayLayerStackDepth(): number;
54
+ export declare function resetOverlayLayerStackForTests(): void;
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Z-index stack for dialog / drawer scrims portaled to the document.
3
+ *
4
+ * Only scrims get a rising z-index (`50 + 2 * index`). Panels sit one above their scrim (`scrim + 1`, see
5
+ * `overlayLayerZIndexStyle`) and popovers read `--widgetic-overlay-floating-z` (`scrim + 2` of the top layer), so selects and
6
+ * menus stay above every panel.
7
+ *
8
+ * A host that draws layers of its own above 50 (the creator's floating panels sit at 2003) says so where it opens a dialog,
9
+ * with `layerBase` on `Dialog.Content`: that dialog, and every dialog opened above it, start from that base. Page CSS cannot
10
+ * do it (see `overlayLayerZIndexStyle`: the layers are out of its reach, by design).
11
+ */
12
+ /** First scrim z-index when the host asks for nothing else; leaves z-40 for the canvas overlay portal. */
13
+ export const overlayLayerBaseZ = 50;
14
+ export const overlayLayerStride = 2;
15
+ /** Default when no overlay is open (matches legacy `z-50` on floating layers). */
16
+ export const overlayFloatingContentDefaultZ = overlayLayerBaseZ;
17
+ const FLOATING_CSS_VAR = '--widgetic-overlay-floating-z';
18
+ let openLayers = [];
19
+ function syncFloatingCssVar() {
20
+ if (typeof document === 'undefined')
21
+ return;
22
+ const top = openLayers.at(-1);
23
+ const floatingZ = top ? top.scrimZ + 2 : overlayFloatingContentDefaultZ;
24
+ document.documentElement.style.setProperty(FLOATING_CSS_VAR, String(floatingZ));
25
+ }
26
+ /**
27
+ * Claim the next scrim layer while a dialog is opening.
28
+ *
29
+ * @param layerBase - Where the layer starts when nothing is open below it (`overlayLayerBaseZ`, 50, unless the host asked
30
+ * for more). A layer opened above another one is always above it, whatever its base: the dialog opened last is on top.
31
+ * @returns Scrim z-index plus `release` when the portal unmounts. `panelZ` is kept for tests only (scrim + 1).
32
+ */
33
+ export function claimOverlayLayerPair(layerBase = overlayLayerBaseZ) {
34
+ // A base below the default would put a scrim under the page chrome the stack is built to cover: ignore it
35
+ const startZ = Number.isFinite(layerBase) ? Math.max(layerBase, overlayLayerBaseZ) : overlayLayerBaseZ;
36
+ const below = openLayers.at(-1);
37
+ const scrimZ = below ? Math.max(startZ, below.scrimZ + overlayLayerStride) : startZ;
38
+ const entry = { scrimZ };
39
+ openLayers = [...openLayers, entry];
40
+ syncFloatingCssVar();
41
+ let released = false;
42
+ return {
43
+ scrimZ,
44
+ panelZ: scrimZ + 1,
45
+ release() {
46
+ if (released)
47
+ return;
48
+ released = true;
49
+ openLayers = openLayers.filter((layer) => layer !== entry);
50
+ syncFloatingCssVar();
51
+ }
52
+ };
53
+ }
54
+ /**
55
+ * The inline style that puts a scrim or a panel on its layer.
56
+ *
57
+ * It carries `!important` on purpose. An inline declaration with `!important` outranks every rule of every stylesheet,
58
+ * `!important` ones included, and the order of a dialog's two layers (the scrim at `z`, the panel at `z + 1`) is all that keeps
59
+ * the panel above its own scrim. A page can break that order from outside with one rule, and one did: the creator shipped a
60
+ * global `[data-dialog-overlay] { z-index: 9998 !important }`, which lifted the scrim of every dialog in the page above its
61
+ * panel (still at 51), so the Invite dialog of the dashboard, the settings dialog and the drawers were drawn under their own
62
+ * scrim whenever the creator's stylesheet was loaded. With the pair out of reach of the host page's CSS, that cannot happen
63
+ * again, whoever writes the next rule.
64
+ *
65
+ * This is the string form, for a `style` prop of a component or an element that spreads nothing. An element that spreads
66
+ * bits-ui's `props` (the scrim, the settings panel) writes the same thing as `style:z-index|important={z}`: a `style`
67
+ * ATTRIBUTE after the spread would replace `props.style`, where bits-ui keeps `pointer-events: auto` (the page behind a modal
68
+ * dialog has `pointer-events: none`), and nothing inside the settings dialog could be clicked; a `style:` directive merges.
69
+ * `tests/overlayLayerZIndexInline.test.ts` holds both rules.
70
+ *
71
+ * @param zIndex - The layer: `scrimZ` for a scrim, `scrimZ + 1` for a panel.
72
+ */
73
+ export function overlayLayerZIndexStyle(zIndex) {
74
+ return `z-index: ${zIndex} !important`;
75
+ }
76
+ /** z-index for select / popover / menu / tooltip portals (above every open dialog panel). */
77
+ export function overlayFloatingContentZ() {
78
+ const top = openLayers.at(-1);
79
+ return top ? top.scrimZ + 2 : overlayFloatingContentDefaultZ;
80
+ }
81
+ /** Tailwind-friendly class for floating overlay content (literal for the scanner). */
82
+ export const overlayFloatingContentZClass = 'z-[var(--widgetic-overlay-floating-z,50)]';
83
+ export function overlayLayerStackDepth() {
84
+ return openLayers.length;
85
+ }
86
+ export function resetOverlayLayerStackForTests() {
87
+ openLayers = [];
88
+ syncFloatingCssVar();
89
+ }
@@ -1,55 +1,33 @@
1
1
  /**
2
2
  * Shared overlay motion tokens so BaseModal, bits-ui Dialog, and related surfaces stay in sync.
3
- * FilePreview / legacy modals: backdrop fades 200ms with cubicOut; the card scales from 0.95 with the same timing.
4
- * Change here when Figma updates overlay motion.
5
3
  */
6
4
  import { cubicOut } from 'svelte/easing';
7
- /** Backdrop scrim + card motion duration (ms). Intentionally 200ms; DS `--duration-base` is 160ms for small UI. */
5
+ import type { FadeParams, FlyParams } from 'svelte/transition';
6
+ /** Backdrop scrim + card motion duration (ms). */
8
7
  export declare const overlayTransitionDurationMs = 200;
9
- /** Easing for open/close (Svelte transition easing function — matches “cubic out” in the legacy modals). */
10
8
  export declare const overlayTransitionEasing: typeof cubicOut;
11
- /**
12
- * Backdrop blur (px) of the scrim behind every modal, dialog, drawer and sheet. It is the Figma effect style
13
- * `Overlay/Scrim blur` (a background blur of 3).
14
- */
15
9
  export declare const overlayBackdropBlurPx = 3;
16
- /** Content scale at the start of the open transition / end of the close transition. */
17
10
  export declare const overlayContentScaleStart = 0.95;
18
- /**
19
- * Tailwind duration class — must be a source literal so Tailwind's scanner emits `duration-[200ms]`.
20
- * Kept in sync with `overlayTransitionDurationMs` (see tests/overlayMotionDuration.test.ts).
21
- */
11
+ export declare const overlayContentSlideDistance = 5;
12
+ export declare const overlayContentSlidePx: number;
13
+ export declare const overlayDialogContentSlideClasses: readonly ["data-[state=closed]:slide-out-to-bottom-5", "data-[state=open]:slide-in-from-bottom-5"];
22
14
  export declare const overlayDurationClass = "duration-[200ms]";
23
- /**
24
- * bits-ui applies `data-[state=open]:animate-in` at specificity 0,2,0 with a 150ms default duration, which beats a
25
- * plain `duration-[200ms]` (0,1,0). These state-scoped arbitrary properties match open/closed and win in cascade.
26
- * Literal strings — keep in sync with `overlayTransitionDurationMs`.
27
- */
28
- export declare const overlayDialogOpenClosedAnimationDurationClasses: readonly ["data-[state=open]:[animation-duration:200ms]", "data-[state=closed]:[animation-duration:200ms]"];
29
- /**
30
- * The scrim colour: the muted foreground token (neutral 550 in the design system) at 80%. The opacity is part of the colour, not of
31
- * the layer, because an element that is itself translucent would not blur what is behind it. Literal so Tailwind's
32
- * scanner emits it; `bg-muted-foreground/80` is the Figma scrim (`Foundations / Overlay`).
33
- */
34
15
  export declare const overlayScrimColorClass = "bg-muted-foreground/80";
35
- /** Backdrop blur class — matches `overlayBackdropBlurPx`. Literal for the same reason as the colour. */
36
16
  export declare const overlayBackdropBlurClass = "backdrop-blur-[3px]";
37
- /**
38
- * The whole scrim: colour and blur. Every surface that dims the page behind a panel (dialogs, modals, drawers, the
39
- * navigation drawer) uses these two classes, so the overlay looks the same everywhere. Written out, not joined from the
40
- * two constants above, so the scanner of Tailwind finds both classes in this one literal as well.
41
- */
42
17
  export declare const overlayScrimClasses = "bg-muted-foreground/80 backdrop-blur-[3px]";
43
- /** Tailwind arbitrary easing approximating Svelte `cubicOut` (ease-out cubic, 1 − (1 − t)³). */
44
18
  export declare const overlayEasingClass = "ease-[cubic-bezier(0.33,1,0.68,1)]";
45
- /**
46
- * A scrim drawn over another scrim only dims: the one below blurs the page already, and two backdrop blurs that fade
47
- * in together flicker. `markStackedScrim` (`overlayStacking.ts`) puts `data-stacked` on such a scrim, and this takes its
48
- * blur off. Literal so Tailwind's scanner emits it.
49
- */
50
19
  export declare const overlayStackedScrimClass = "data-[stacked]:backdrop-blur-none";
51
- /** Overlay + panel classes for bits-ui Dialog (aligned with BaseModal motion: fade, 200ms, cubic-out-like, zoom from 0.95). */
20
+ /** Scrim surface classes only (motion is Svelte `fade` on the overlay child element). */
52
21
  export declare const overlayDialogOverlayClasses: string;
22
+ /** Card chrome inside the flex-centred dialog host (no fixed positioning on the card itself). */
23
+ export declare const overlayDialogPanelCardClasses = "relative";
24
+ /** Full-viewport host that centres the card (see `dialog-content.svelte`). */
25
+ export declare const overlayDialogPanelLayoutClasses = "fixed inset-0 flex items-center justify-center";
26
+ /** @deprecated Kept for grep tests; motion no longer uses Tailwind animate utilities. */
53
27
  export declare const overlayDialogContentClasses: string;
54
- /** Applied with overlay dialog classes so users who prefer reduced motion get instant open/close. */
55
- export declare const overlayReducedMotionClasses = "motion-reduce:!duration-0 motion-reduce:data-[state=open]:animate-none motion-reduce:data-[state=closed]:animate-none";
28
+ /** @deprecated */
29
+ export declare const overlayDialogContentMotionClasses: string;
30
+ export declare const overlayReducedMotionClasses = "motion-reduce:transition-none";
31
+ export declare function prefersReducedOverlayMotion(): boolean;
32
+ export declare function overlayScrimFadeTransition(reducedMotion?: boolean): FadeParams;
33
+ export declare function overlayPanelFlyTransition(reducedMotion?: boolean): FlyParams;
@@ -1,78 +1,59 @@
1
1
  /**
2
2
  * Shared overlay motion tokens so BaseModal, bits-ui Dialog, and related surfaces stay in sync.
3
- * FilePreview / legacy modals: backdrop fades 200ms with cubicOut; the card scales from 0.95 with the same timing.
4
- * Change here when Figma updates overlay motion.
5
3
  */
6
4
  import { cubicOut } from 'svelte/easing';
7
- /** Backdrop scrim + card motion duration (ms). Intentionally 200ms; DS `--duration-base` is 160ms for small UI. */
5
+ /** Backdrop scrim + card motion duration (ms). */
8
6
  export const overlayTransitionDurationMs = 200;
9
- /** Easing for open/close (Svelte transition easing function — matches “cubic out” in the legacy modals). */
10
7
  export const overlayTransitionEasing = cubicOut;
11
- /**
12
- * Backdrop blur (px) of the scrim behind every modal, dialog, drawer and sheet. It is the Figma effect style
13
- * `Overlay/Scrim blur` (a background blur of 3).
14
- */
15
8
  export const overlayBackdropBlurPx = 3;
16
- /** Content scale at the start of the open transition / end of the close transition. */
17
9
  export const overlayContentScaleStart = 0.95;
18
- /**
19
- * Tailwind duration class — must be a source literal so Tailwind's scanner emits `duration-[200ms]`.
20
- * Kept in sync with `overlayTransitionDurationMs` (see tests/overlayMotionDuration.test.ts).
21
- */
22
- export const overlayDurationClass = 'duration-[200ms]';
23
- /**
24
- * bits-ui applies `data-[state=open]:animate-in` at specificity 0,2,0 with a 150ms default duration, which beats a
25
- * plain `duration-[200ms]` (0,1,0). These state-scoped arbitrary properties match open/closed and win in cascade.
26
- * Literal strings — keep in sync with `overlayTransitionDurationMs`.
27
- */
28
- export const overlayDialogOpenClosedAnimationDurationClasses = [
29
- 'data-[state=open]:[animation-duration:200ms]',
30
- 'data-[state=closed]:[animation-duration:200ms]'
10
+ export const overlayContentSlideDistance = 5;
11
+ export const overlayContentSlidePx = overlayContentSlideDistance * 4;
12
+ export const overlayDialogContentSlideClasses = [
13
+ `data-[state=closed]:slide-out-to-bottom-${overlayContentSlideDistance}`,
14
+ `data-[state=open]:slide-in-from-bottom-${overlayContentSlideDistance}`
31
15
  ];
32
- /**
33
- * The scrim colour: the muted foreground token (neutral 550 in the design system) at 80%. The opacity is part of the colour, not of
34
- * the layer, because an element that is itself translucent would not blur what is behind it. Literal so Tailwind's
35
- * scanner emits it; `bg-muted-foreground/80` is the Figma scrim (`Foundations / Overlay`).
36
- */
16
+ export const overlayDurationClass = 'duration-[200ms]';
37
17
  export const overlayScrimColorClass = 'bg-muted-foreground/80';
38
- /** Backdrop blur class — matches `overlayBackdropBlurPx`. Literal for the same reason as the colour. */
39
18
  export const overlayBackdropBlurClass = 'backdrop-blur-[3px]';
40
- /**
41
- * The whole scrim: colour and blur. Every surface that dims the page behind a panel (dialogs, modals, drawers, the
42
- * navigation drawer) uses these two classes, so the overlay looks the same everywhere. Written out, not joined from the
43
- * two constants above, so the scanner of Tailwind finds both classes in this one literal as well.
44
- */
45
19
  export const overlayScrimClasses = 'bg-muted-foreground/80 backdrop-blur-[3px]';
46
- /** Tailwind arbitrary easing approximating Svelte `cubicOut` (ease-out cubic, 1 − (1 − t)³). */
47
20
  export const overlayEasingClass = 'ease-[cubic-bezier(0.33,1,0.68,1)]';
48
- /**
49
- * A scrim drawn over another scrim only dims: the one below blurs the page already, and two backdrop blurs that fade
50
- * in together flicker. `markStackedScrim` (`overlayStacking.ts`) puts `data-stacked` on such a scrim, and this takes its
51
- * blur off. Literal so Tailwind's scanner emits it.
52
- */
53
21
  export const overlayStackedScrimClass = 'data-[stacked]:backdrop-blur-none';
54
- /** Overlay + panel classes for bits-ui Dialog (aligned with BaseModal motion: fade, 200ms, cubic-out-like, zoom from 0.95). */
22
+ /** Scrim surface classes only (motion is Svelte `fade` on the overlay child element). */
55
23
  export const overlayDialogOverlayClasses = [
56
24
  overlayScrimClasses,
57
- overlayStackedScrimClass,
58
- overlayDurationClass,
59
- overlayEasingClass,
60
- ...overlayDialogOpenClosedAnimationDurationClasses,
61
- `data-[state=open]:animate-in`,
62
- `data-[state=closed]:animate-out`,
63
- `data-[state=closed]:fade-out-0`,
64
- `data-[state=open]:fade-in-0`
65
- ].join(' ');
66
- export const overlayDialogContentClasses = [
67
- overlayDurationClass,
68
- overlayEasingClass,
69
- ...overlayDialogOpenClosedAnimationDurationClasses,
70
- `data-[state=open]:animate-in`,
71
- `data-[state=closed]:animate-out`,
72
- `data-[state=closed]:fade-out-0`,
73
- `data-[state=open]:fade-in-0`,
74
- `data-[state=closed]:zoom-out-95`,
75
- `data-[state=open]:zoom-in-95`
25
+ overlayStackedScrimClass
76
26
  ].join(' ');
77
- /** Applied with overlay dialog classes so users who prefer reduced motion get instant open/close. */
78
- export const overlayReducedMotionClasses = 'motion-reduce:!duration-0 motion-reduce:data-[state=open]:animate-none motion-reduce:data-[state=closed]:animate-none';
27
+ /** Card chrome inside the flex-centred dialog host (no fixed positioning on the card itself). */
28
+ export const overlayDialogPanelCardClasses = 'relative';
29
+ /** Full-viewport host that centres the card (see `dialog-content.svelte`). */
30
+ export const overlayDialogPanelLayoutClasses = 'fixed inset-0 flex items-center justify-center';
31
+ /** @deprecated Kept for grep tests; motion no longer uses Tailwind animate utilities. */
32
+ export const overlayDialogContentClasses = overlayDialogPanelLayoutClasses;
33
+ /** @deprecated */
34
+ export const overlayDialogContentMotionClasses = overlayDialogPanelLayoutClasses;
35
+ export const overlayReducedMotionClasses = 'motion-reduce:transition-none';
36
+ export function prefersReducedOverlayMotion() {
37
+ if (typeof window === 'undefined' || typeof window.matchMedia !== 'function')
38
+ return false;
39
+ return window.matchMedia('(prefers-reduced-motion: reduce)').matches;
40
+ }
41
+ function isVitestEnvironment() {
42
+ return typeof process !== 'undefined' && (process.env.VITEST === 'true' || process.env.NODE_ENV === 'test');
43
+ }
44
+ export function overlayScrimFadeTransition(reducedMotion = prefersReducedOverlayMotion()) {
45
+ if (isVitestEnvironment() || reducedMotion)
46
+ return { duration: 0 };
47
+ return { duration: overlayTransitionDurationMs, easing: overlayTransitionEasing };
48
+ }
49
+ export function overlayPanelFlyTransition(reducedMotion = prefersReducedOverlayMotion()) {
50
+ if (isVitestEnvironment() || reducedMotion) {
51
+ return { duration: 0, y: 0, opacity: 1 };
52
+ }
53
+ return {
54
+ duration: overlayTransitionDurationMs,
55
+ y: overlayContentSlidePx,
56
+ opacity: 0,
57
+ easing: overlayTransitionEasing
58
+ };
59
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Toast enter/exit motion aligned with round-5 site spec (OpenAI-style top pill).
3
+ * Change here when Figma Toast (135:87) motion updates.
4
+ */
5
+ /** Slide-in from the top uses the same base duration as overlay fades. */
6
+ export declare const toastEnterDurationMs = 200;
7
+ /** Dismiss fades in place (no slide), slightly quicker than enter. */
8
+ export declare const toastExitDurationMs = 150;
9
+ /** Long titles wrap inside this width (px). */
10
+ export declare const toastMaxWidthPx = 420;
11
+ /** Literal for Tailwind scanner — keep in sync with `toastMaxWidthPx`. */
12
+ export declare const toastMaxWidthClass = "!max-w-[420px]";
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Toast enter/exit motion aligned with round-5 site spec (OpenAI-style top pill).
3
+ * Change here when Figma Toast (135:87) motion updates.
4
+ */
5
+ /** Slide-in from the top uses the same base duration as overlay fades. */
6
+ export const toastEnterDurationMs = 200;
7
+ /** Dismiss fades in place (no slide), slightly quicker than enter. */
8
+ export const toastExitDurationMs = 150;
9
+ /** Long titles wrap inside this width (px). */
10
+ export const toastMaxWidthPx = 420;
11
+ /** Literal for Tailwind scanner — keep in sync with `toastMaxWidthPx`. */
12
+ export const toastMaxWidthClass = '!max-w-[420px]';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widgetic/design-system",
3
- "version": "0.5.30",
3
+ "version": "0.5.32",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "type": "module",
6
6
  "svelte": "./dist/index.js",
@@ -20,7 +20,7 @@
20
20
  "llinks": "ls -la node_modules/@widgetic",
21
21
  "glinks": "npm ls --global | grep widgetic",
22
22
  "set-git": "git config core.ignorecase false",
23
- "ensure-fonts": "mkdir -p static/fonts && ln -sfn ../../src/lib/fonts/Inter static/fonts/Inter && ln -sfn ../../src/lib/fonts/JetBrainsMono static/fonts/JetBrainsMono && ln -sfn ../../src/lib/fonts/Cousine static/fonts/Cousine",
23
+ "ensure-fonts": "mkdir -p static/fonts && ln -sfn ../../src/lib/fonts/Inter static/fonts/Inter && ln -sfn ../../src/lib/fonts/JetBrainsMono static/fonts/JetBrainsMono",
24
24
  "predev": "npm run ensure-fonts && npx svelte-kit sync",
25
25
  "predev-sv": "npm run ensure-fonts && npx svelte-kit sync",
26
26
  "dev": "npm run dev-sv",
@@ -30,25 +30,18 @@ const config: Config = {
30
30
  grey5: "hsl(var(--grey5) / <alpha-value>)",
31
31
  grey7: "hsl(var(--grey7) / <alpha-value>)",
32
32
 
33
- // Figma Foundations Tokens (01 — Foundations 38:142)
33
+ // Figma Foundations Tokens (01 — Foundations 38:142). Round 31 removed the eight that no code read
34
+ // (ink-secondary, ink-muted, surface-canvas, surface-dark, surface-ink-on-dark, accent-orange, accent-green, primary-green-muted).
34
35
  "ink-primary": "hsl(var(--ink-primary) / <alpha-value>)",
35
36
  "primary-green": "hsl(var(--primary-green) / <alpha-value>)",
36
- "ink-secondary": "hsl(var(--ink-secondary) / <alpha-value>)",
37
- "ink-muted": "hsl(var(--ink-muted) / <alpha-value>)",
38
37
  "ink-subtle": "hsl(var(--ink-subtle) / <alpha-value>)",
39
- "surface-canvas": "hsl(var(--surface-canvas) / <alpha-value>)",
40
- "surface-dark": "hsl(var(--surface-dark) / <alpha-value>)",
41
- "surface-ink-on-dark": "hsl(var(--surface-ink-on-dark) / <alpha-value>)",
42
- "accent-orange": "hsl(var(--accent-orange) / <alpha-value>)",
43
- "accent-green": "hsl(var(--accent-green) / <alpha-value>)",
44
- "primary-green-muted": "hsl(var(--primary-green-muted) / <alpha-value>)",
45
38
  },
39
+ // Inter for the interface, JetBrains Mono for code. (Cousine was removed in round 31: nothing set a font in it.)
46
40
  fontFamily: {
47
41
  sans: ["Inter", "ui-sans-serif", "system-ui", "-apple-system", "BlinkMacSystemFont", "Segoe UI", "Roboto", "sans-serif"],
48
42
  inter: ["Inter", "sans-serif"],
49
- mono: ["JetBrains Mono", "Cousine", "ui-monospace", "SFMono-Regular", "Menlo", "Monaco", "Consolas", "monospace"],
43
+ mono: ["JetBrains Mono", "ui-monospace", "SFMono-Regular", "Menlo", "Monaco", "Consolas", "monospace"],
50
44
  "jetbrains-mono": ["JetBrains Mono", "monospace"],
51
- cousine: ["Cousine", "monospace"],
52
45
  },
53
46
  borderRadius: {
54
47
  sm: "var(--radius-sm)",