@eifi1/ui-kit 0.9.0 → 0.11.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.
Files changed (243) hide show
  1. package/README.md +37 -23
  2. package/dist/components/alert-banner.d.ts +57 -5
  3. package/dist/components/alert-banner.js +63 -17
  4. package/dist/components/alert-banner.js.map +1 -1
  5. package/dist/components/amount-input.d.ts +6 -0
  6. package/dist/components/breadcrumbs.d.ts +60 -0
  7. package/dist/components/breadcrumbs.js +88 -0
  8. package/dist/components/breadcrumbs.js.map +1 -0
  9. package/dist/components/bulk-action-bar.d.ts +112 -0
  10. package/dist/components/bulk-action-bar.js +196 -0
  11. package/dist/components/bulk-action-bar.js.map +1 -0
  12. package/dist/components/button-group.d.ts +58 -3
  13. package/dist/components/button-group.js +56 -5
  14. package/dist/components/button-group.js.map +1 -1
  15. package/dist/components/calculator.d.ts +6 -0
  16. package/dist/components/calendar-heatmap.d.ts +124 -0
  17. package/dist/components/calendar-heatmap.js +295 -0
  18. package/dist/components/calendar-heatmap.js.map +1 -0
  19. package/dist/components/chip.d.ts +31 -5
  20. package/dist/components/chip.js +85 -5
  21. package/dist/components/chip.js.map +1 -1
  22. package/dist/components/choice-card.d.ts +34 -2
  23. package/dist/components/choice-card.js +49 -0
  24. package/dist/components/choice-card.js.map +1 -1
  25. package/dist/components/copy-button.d.ts +14 -4
  26. package/dist/components/copy-button.js +17 -4
  27. package/dist/components/copy-button.js.map +1 -1
  28. package/dist/components/data-table.js +2 -0
  29. package/dist/components/data-table.js.map +1 -1
  30. package/dist/components/date-picker.d.ts +22 -2
  31. package/dist/components/date-picker.js +11 -3
  32. package/dist/components/date-picker.js.map +1 -1
  33. package/dist/components/description-list.d.ts +43 -6
  34. package/dist/components/description-list.js +91 -11
  35. package/dist/components/description-list.js.map +1 -1
  36. package/dist/components/dialog-frame.d.ts +7 -0
  37. package/dist/components/dialog-frame.js.map +1 -1
  38. package/dist/components/disclosure.d.ts +57 -2
  39. package/dist/components/disclosure.js +24 -12
  40. package/dist/components/disclosure.js.map +1 -1
  41. package/dist/components/field.d.ts +43 -0
  42. package/dist/components/field.js +52 -0
  43. package/dist/components/field.js.map +1 -0
  44. package/dist/components/file-button.d.ts +1 -0
  45. package/dist/components/file-dropzone.d.ts +4 -4
  46. package/dist/components/file-dropzone.js +2 -1
  47. package/dist/components/file-dropzone.js.map +1 -1
  48. package/dist/components/floating-panel.d.ts +147 -4
  49. package/dist/components/floating-panel.js +188 -28
  50. package/dist/components/floating-panel.js.map +1 -1
  51. package/dist/components/full-bleed-dialog.d.ts +23 -4
  52. package/dist/components/full-bleed-dialog.js +11 -2
  53. package/dist/components/full-bleed-dialog.js.map +1 -1
  54. package/dist/components/list.d.ts +187 -0
  55. package/dist/components/list.js +221 -0
  56. package/dist/components/list.js.map +1 -0
  57. package/dist/components/menu-item.d.ts +109 -0
  58. package/dist/components/menu-item.js +88 -0
  59. package/dist/components/menu-item.js.map +1 -0
  60. package/dist/components/mini-calendar.d.ts +70 -5
  61. package/dist/components/mini-calendar.js +166 -62
  62. package/dist/components/mini-calendar.js.map +1 -1
  63. package/dist/components/modal.d.ts +23 -1
  64. package/dist/components/modal.js +36 -10
  65. package/dist/components/modal.js.map +1 -1
  66. package/dist/components/nav-pills.d.ts +66 -0
  67. package/dist/components/nav-pills.js +65 -0
  68. package/dist/components/nav-pills.js.map +1 -0
  69. package/dist/components/number-field.d.ts +6 -0
  70. package/dist/components/number-input.d.ts +6 -0
  71. package/dist/components/numpad-sheet.d.ts +6 -0
  72. package/dist/components/page-contents.js +1 -2
  73. package/dist/components/page-contents.js.map +1 -1
  74. package/dist/components/page-header.d.ts +37 -0
  75. package/dist/components/page-header.js +36 -0
  76. package/dist/components/page-header.js.map +1 -0
  77. package/dist/components/progress-bar.d.ts +31 -2
  78. package/dist/components/progress-bar.js +73 -7
  79. package/dist/components/progress-bar.js.map +1 -1
  80. package/dist/components/series-chart-labels.d.ts +3 -0
  81. package/dist/components/series-chart-labels.js +2 -1
  82. package/dist/components/series-chart-labels.js.map +1 -1
  83. package/dist/components/series-chart.d.ts +32 -0
  84. package/dist/components/series-chart.js +141 -4
  85. package/dist/components/series-chart.js.map +1 -1
  86. package/dist/components/settings-fields.d.ts +1 -0
  87. package/dist/components/status-dot.d.ts +53 -0
  88. package/dist/components/status-dot.js +57 -0
  89. package/dist/components/status-dot.js.map +1 -0
  90. package/dist/components/table.d.ts +78 -13
  91. package/dist/components/table.js +84 -11
  92. package/dist/components/table.js.map +1 -1
  93. package/dist/components/text.d.ts +70 -0
  94. package/dist/components/text.js +24 -0
  95. package/dist/components/text.js.map +1 -0
  96. package/dist/components/time-input.d.ts +1 -0
  97. package/dist/components/toast.d.ts +167 -0
  98. package/dist/components/toast.js +226 -0
  99. package/dist/components/toast.js.map +1 -0
  100. package/dist/components/toggle-group.d.ts +44 -1
  101. package/dist/components/toggle-group.js +73 -4
  102. package/dist/components/toggle-group.js.map +1 -1
  103. package/dist/components/tooltip.d.ts +46 -15
  104. package/dist/components/tooltip.js +87 -47
  105. package/dist/components/tooltip.js.map +1 -1
  106. package/dist/components/ui.d.ts +158 -7
  107. package/dist/components/ui.js +191 -10
  108. package/dist/components/ui.js.map +1 -1
  109. package/dist/components/user-avatar.d.ts +25 -3
  110. package/dist/components/user-avatar.js +32 -3
  111. package/dist/components/user-avatar.js.map +1 -1
  112. package/dist/hooks/use-close-transition.d.ts +7 -1
  113. package/dist/hooks/use-close-transition.js +5 -2
  114. package/dist/hooks/use-close-transition.js.map +1 -1
  115. package/dist/hooks/use-copy-to-clipboard.js +1 -1
  116. package/dist/hooks/use-copy-to-clipboard.js.map +1 -1
  117. package/dist/hooks/use-file-drop.d.ts +1 -0
  118. package/dist/i18n/defaults.d.ts +6 -0
  119. package/dist/i18n/defaults.js +11 -1
  120. package/dist/i18n/defaults.js.map +1 -1
  121. package/dist/i18n/kit-labels.d.ts +11 -0
  122. package/dist/i18n/kit-labels.js.map +1 -1
  123. package/dist/i18n/locales/de-CH-informal.d.ts +6 -0
  124. package/dist/i18n/locales/de-CH.d.ts +6 -0
  125. package/dist/i18n/locales/de-informal.d.ts +6 -0
  126. package/dist/i18n/locales/de.d.ts +6 -0
  127. package/dist/i18n/locales/de.js +30 -2
  128. package/dist/i18n/locales/de.js.map +1 -1
  129. package/dist/i18n/locales/es.d.ts +6 -0
  130. package/dist/i18n/locales/es.js +30 -2
  131. package/dist/i18n/locales/es.js.map +1 -1
  132. package/dist/i18n/locales/fr.d.ts +6 -0
  133. package/dist/i18n/locales/fr.js +30 -2
  134. package/dist/i18n/locales/fr.js.map +1 -1
  135. package/dist/i18n/locales/hu.d.ts +6 -0
  136. package/dist/i18n/locales/hu.js +30 -2
  137. package/dist/i18n/locales/hu.js.map +1 -1
  138. package/dist/i18n/locales/it.d.ts +6 -0
  139. package/dist/i18n/locales/it.js +30 -2
  140. package/dist/i18n/locales/it.js.map +1 -1
  141. package/dist/i18n/locales/zh.d.ts +6 -0
  142. package/dist/i18n/locales/zh.js +30 -2
  143. package/dist/i18n/locales/zh.js.map +1 -1
  144. package/dist/index.d.ts +27 -15
  145. package/dist/index.js +15 -0
  146. package/dist/index.js.map +1 -1
  147. package/dist/lib/clipping.d.ts +25 -0
  148. package/dist/lib/clipping.js +17 -0
  149. package/dist/lib/clipping.js.map +1 -0
  150. package/dist/lib/dates.d.ts +17 -1
  151. package/dist/lib/dates.js +19 -0
  152. package/dist/lib/dates.js.map +1 -1
  153. package/dist/rhf/form.d.ts +1 -0
  154. package/dist/rhf/use-rhf-wizard-step.d.ts +22 -0
  155. package/dist/rhf/use-rhf-wizard-step.js +38 -0
  156. package/dist/rhf/use-rhf-wizard-step.js.map +1 -0
  157. package/dist/rhf.d.ts +2 -0
  158. package/dist/rhf.js +1 -0
  159. package/dist/rhf.js.map +1 -1
  160. package/dist/search/command-palette.d.ts +19 -2
  161. package/dist/search/command-palette.js +16 -5
  162. package/dist/search/command-palette.js.map +1 -1
  163. package/dist/search/global-search.d.ts +26 -1
  164. package/dist/search/global-search.js +29 -13
  165. package/dist/search/global-search.js.map +1 -1
  166. package/dist/search.d.ts +1 -1
  167. package/dist/shell/topbar-action-menu.d.ts +73 -3
  168. package/dist/shell/topbar-action-menu.js +100 -27
  169. package/dist/shell/topbar-action-menu.js.map +1 -1
  170. package/dist/shell.d.ts +2 -1
  171. package/dist/wizard/stepper-nav.d.ts +1 -0
  172. package/dist/wizard/stepper-nav.js +1 -1
  173. package/dist/wizard/stepper-nav.js.map +1 -1
  174. package/dist/wizard/types.d.ts +2 -2
  175. package/dist/wizard/types.js.map +1 -1
  176. package/dist/wizard/use-wizard.js +1 -1
  177. package/dist/wizard/use-wizard.js.map +1 -1
  178. package/dist/wizard/wizard-context.d.ts +7 -1
  179. package/dist/wizard/wizard-context.js +4 -0
  180. package/dist/wizard/wizard-context.js.map +1 -1
  181. package/dist/wizard/wizard-summary.js +3 -3
  182. package/dist/wizard/wizard-summary.js.map +1 -1
  183. package/dist/wizard.d.ts +2 -1
  184. package/package.json +16 -12
  185. package/src/components/alert-banner.tsx +149 -21
  186. package/src/components/breadcrumbs.tsx +168 -0
  187. package/src/components/bulk-action-bar.tsx +362 -0
  188. package/src/components/button-group.tsx +124 -4
  189. package/src/components/calendar-heatmap.tsx +504 -0
  190. package/src/components/chip.tsx +128 -7
  191. package/src/components/choice-card.tsx +97 -1
  192. package/src/components/copy-button.tsx +29 -7
  193. package/src/components/data-table.tsx +7 -0
  194. package/src/components/date-picker.tsx +49 -1
  195. package/src/components/description-list.tsx +168 -15
  196. package/src/components/dialog-frame.tsx +7 -0
  197. package/src/components/disclosure.tsx +93 -21
  198. package/src/components/field.tsx +137 -0
  199. package/src/components/file-dropzone.tsx +9 -10
  200. package/src/components/floating-panel.tsx +366 -15
  201. package/src/components/full-bleed-dialog.tsx +42 -5
  202. package/src/components/list.tsx +443 -0
  203. package/src/components/menu-item.tsx +235 -0
  204. package/src/components/mini-calendar.tsx +245 -54
  205. package/src/components/modal.tsx +80 -17
  206. package/src/components/nav-pills.tsx +145 -0
  207. package/src/components/page-contents.tsx +4 -4
  208. package/src/components/page-header.tsx +68 -0
  209. package/src/components/progress-bar.tsx +129 -11
  210. package/src/components/series-chart-labels.ts +4 -0
  211. package/src/components/series-chart.tsx +274 -3
  212. package/src/components/status-dot.tsx +107 -0
  213. package/src/components/table.tsx +176 -17
  214. package/src/components/text.tsx +97 -0
  215. package/src/components/toast.tsx +441 -0
  216. package/src/components/toggle-group.tsx +128 -4
  217. package/src/components/tooltip.tsx +200 -100
  218. package/src/components/ui.tsx +381 -14
  219. package/src/components/user-avatar.tsx +57 -3
  220. package/src/hooks/use-close-transition.ts +14 -5
  221. package/src/hooks/use-copy-to-clipboard.ts +1 -1
  222. package/src/i18n/defaults.ts +10 -0
  223. package/src/i18n/kit-labels.tsx +10 -0
  224. package/src/i18n/locales/de.ts +29 -0
  225. package/src/i18n/locales/es.ts +29 -0
  226. package/src/i18n/locales/fr.ts +29 -0
  227. package/src/i18n/locales/hu.ts +29 -0
  228. package/src/i18n/locales/it.ts +29 -0
  229. package/src/i18n/locales/zh.ts +29 -0
  230. package/src/index.ts +31 -0
  231. package/src/lib/clipping.ts +34 -0
  232. package/src/lib/dates.ts +37 -0
  233. package/src/rhf/use-rhf-wizard-step.ts +113 -0
  234. package/src/rhf.ts +2 -0
  235. package/src/search/command-palette.tsx +42 -5
  236. package/src/search/global-search.tsx +59 -18
  237. package/src/shell/topbar-action-menu.tsx +239 -49
  238. package/src/wizard/stepper-nav.tsx +2 -1
  239. package/src/wizard/types.ts +2 -2
  240. package/src/wizard/use-wizard.ts +3 -3
  241. package/src/wizard/wizard-context.tsx +9 -0
  242. package/src/wizard/wizard-summary.tsx +14 -10
  243. package/tokens.css +97 -0
@@ -0,0 +1,167 @@
1
+ import * as react from 'react';
2
+ import { ReactNode, MouseEvent, CSSProperties, ReactElement } from 'react';
3
+
4
+ /** The words the toast layer says. `close` and `notifications` are read by a screen
5
+ * reader (the close button's name, the toast region's name); `undo` and `redo` are
6
+ * the default action labels of {@link toast.undo} / {@link toast.redo}. */
7
+ interface ToastLabels {
8
+ close: string;
9
+ notifications: string;
10
+ undo: string;
11
+ redo: string;
12
+ }
13
+ declare const DEFAULT_TOAST_LABELS: ToastLabels;
14
+ type ToastId = string | number;
15
+ /** A button on the toast. Clicking it dismisses the toast, unless `onClick` calls
16
+ * `event.preventDefault()`. */
17
+ interface ToastAction {
18
+ label: ReactNode;
19
+ onClick: (event: MouseEvent<HTMLButtonElement>) => void;
20
+ }
21
+ interface ToastOptions {
22
+ /** Re-using an id REPLACES the toast on screen with that id (in place — it does not
23
+ * stack a second one), which is how a toast is updated. Default: a fresh id. */
24
+ id?: ToastId;
25
+ description?: ReactNode;
26
+ action?: ToastAction;
27
+ /** A second, quieter button (sonner's `cancel`). */
28
+ cancel?: ToastAction;
29
+ /** Milliseconds; `Infinity` keeps it until dismissed. Default 4s — or
30
+ * {@link TOAST_ACTION_DURATION} when there is an `action`, so there is time to
31
+ * read the message AND reach the button. */
32
+ duration?: number;
33
+ /** Called when the toast is closed by the user (close button, swipe, action). */
34
+ onDismiss?: (toast: {
35
+ id: ToastId;
36
+ }) => void;
37
+ /** Called when the toast times out. */
38
+ onAutoClose?: (toast: {
39
+ id: ToastId;
40
+ }) => void;
41
+ /** Wrap the message and the description in `data-private`, so an app's demo /
42
+ * privacy mode blurs them like every other sensitive value. */
43
+ redact?: boolean;
44
+ /** Replaces the tone's icon. */
45
+ icon?: ReactNode;
46
+ /** `false`: no close button, no swipe. */
47
+ dismissible?: boolean;
48
+ /** Per toast, over the `<Toaster>`'s `closeButton`. */
49
+ closeButton?: boolean;
50
+ className?: string;
51
+ style?: CSSProperties;
52
+ }
53
+ /** The default duration of a toast that carries an action (8s rather than 4s). */
54
+ declare const TOAST_ACTION_DURATION = 8000;
55
+ type Kind = "default" | "success" | "error" | "warning" | "info" | "loading";
56
+ interface ToastPromiseOptions<T> extends ToastOptions {
57
+ loading: ReactNode;
58
+ /** The success message, or a function of the resolved value. Omitted: the loading
59
+ * toast is dismissed. */
60
+ success?: ReactNode | ((value: T) => ReactNode);
61
+ /** The error message, or a function of the rejection. Omitted: dismissed. */
62
+ error?: ReactNode | ((error: unknown) => ReactNode);
63
+ finally?: () => void;
64
+ }
65
+ interface ToastUndoOptions extends Omit<ToastOptions, "action"> {
66
+ /** Called when the button is pressed. */
67
+ onUndo: () => void;
68
+ /** Default: `toast.undo` from `<UiKitProvider>` ("Undo"). */
69
+ label?: ReactNode;
70
+ /** Default `success` — the step the toast reports worked. */
71
+ tone?: Exclude<Kind, "loading">;
72
+ }
73
+ interface ToastRedoOptions extends Omit<ToastUndoOptions, "onUndo"> {
74
+ onRedo: () => void;
75
+ }
76
+ /**
77
+ * Show a toast. The same shape as sonner's `toast`, so an app migrates by changing the
78
+ * import: `toast(msg, opts)`, `toast.success` / `error` / `warning` / `info` /
79
+ * `loading`, `toast.promise`, `toast.dismiss`, `toast.custom`. Each returns the toast's
80
+ * id; pass it back as `id` to replace that toast in place.
81
+ *
82
+ * Needs a mounted {@link Toaster}. Messages may be any ReactNode.
83
+ */
84
+ declare const toast: ((message: ReactNode, opts?: ToastOptions) => ToastId) & {
85
+ message: (message: ReactNode, opts?: ToastOptions) => ToastId;
86
+ success: (message: ReactNode, opts?: ToastOptions) => ToastId;
87
+ error: (message: ReactNode, opts?: ToastOptions) => ToastId;
88
+ warning: (message: ReactNode, opts?: ToastOptions) => ToastId;
89
+ info: (message: ReactNode, opts?: ToastOptions) => ToastId;
90
+ /** A spinner that does not time out — replace it (same `id`) or dismiss it. */
91
+ loading: (message: ReactNode, opts?: ToastOptions) => ToastId;
92
+ /**
93
+ * A loading toast that becomes the success or the error toast, in place, when
94
+ * `promise` settles. Returns the toast's id; the promise itself is the caller's.
95
+ */
96
+ promise<T>(promise: Promise<T> | (() => Promise<T>), options: ToastPromiseOptions<T>): ToastId;
97
+ /** Close one toast, or every toast when `id` is omitted. */
98
+ dismiss(id?: ToastId): void;
99
+ /** Render your own node in a toast slot — `render` receives the id to dismiss it. */
100
+ custom(render: (id: ToastId) => ReactElement, opts?: Omit<ToastOptions, "redact">): ToastId;
101
+ /**
102
+ * "Deleted — Undo": a toast whose action takes the step back, labelled by the
103
+ * provider's `toast.undo`. The journal stays the app's; this is only its toast.
104
+ * Pair with {@link toast.redo} so the step back can itself be taken back.
105
+ */
106
+ undo(message: ReactNode, { onUndo, ...opts }: ToastUndoOptions): ToastId;
107
+ /** {@link toast.undo}'s mirror: the action is labelled `toast.redo`. */
108
+ redo(message: ReactNode, { onRedo, ...opts }: ToastRedoOptions): ToastId;
109
+ };
110
+ type ToastPosition = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
111
+ type ToastSwipeDirection = "top" | "right" | "bottom" | "left";
112
+ /** sonner's offset: one value for every edge, or per edge. Numbers are px. */
113
+ type ToasterOffset = string | number | {
114
+ top?: string | number;
115
+ right?: string | number;
116
+ bottom?: string | number;
117
+ left?: string | number;
118
+ };
119
+ interface ToasterProps {
120
+ /** Default: `bottom-center` on a phone (so the toast covers neither the header's
121
+ * buttons nor the bottom nav's), `top-center` from `md` up. */
122
+ position?: ToastPosition;
123
+ /** The height to keep clear at the bottom — AppShell's bottom nav. Default: its
124
+ * measured `--app-nav-h`, so nothing has to be passed under an AppShell. The safe
125
+ * area is added either way. Numbers are px. */
126
+ navOffset?: string | number;
127
+ /** Default: follows the `.dark` class the kit's theme store (`useApplyTheme`) puts
128
+ * on `<html>` — whichever store the app built, with nothing passed. */
129
+ theme?: "light" | "dark" | "system";
130
+ labels?: Partial<ToastLabels>;
131
+ /** Default 4s (8s for a toast with an action). */
132
+ duration?: number;
133
+ visibleToasts?: number;
134
+ expand?: boolean;
135
+ /** Default true. */
136
+ closeButton?: boolean;
137
+ /** Tone-coloured toasts (the AlertBanner tokens). Default true. */
138
+ richColors?: boolean;
139
+ /** Default: every direction. */
140
+ swipeDirections?: ToastSwipeDirection[];
141
+ /** Overrides the computed offset outright (above the nav on a phone, below a 48px
142
+ * top bar on desktop). */
143
+ offset?: ToasterOffset;
144
+ /** Below 600px, where sonner switches to its full-width layout. Default: `offset`'s
145
+ * phone value. */
146
+ mobileOffset?: ToasterOffset;
147
+ /** Keyboard shortcut that moves focus into the toasts. Default Alt+T. */
148
+ hotkey?: string[];
149
+ gap?: number;
150
+ dir?: "ltr" | "rtl" | "auto";
151
+ className?: string;
152
+ style?: CSSProperties;
153
+ }
154
+ /**
155
+ * Where the toasts appear, with the kit's defaults — mount ONE, near the root and
156
+ * inside `<UiKitProvider>` (it reads the `toast` labels) and inside the router if a
157
+ * toast's content navigates.
158
+ *
159
+ * Accessible as sonner makes it: the toasts sit in a polite live region, so a message
160
+ * is announced with its description and its action's label; every toast and every
161
+ * button in it is focusable, the timer pauses while focus or the pointer is inside,
162
+ * and Alt+T ({@link ToasterProps.hotkey}) moves focus to the newest toast. A toast
163
+ * with an action stays up 8s by default, so the button can be reached.
164
+ */
165
+ declare function Toaster({ position, navOffset, theme, labels: labelsProp, closeButton, richColors, swipeDirections, offset, mobileOffset, className, style, ...rest }: ToasterProps): react.JSX.Element | null;
166
+
167
+ export { DEFAULT_TOAST_LABELS, TOAST_ACTION_DURATION, type ToastAction, type ToastId, type ToastLabels, type ToastOptions, type ToastPosition, type ToastPromiseOptions, type ToastRedoOptions, type ToastSwipeDirection, type ToastUndoOptions, Toaster, type ToasterOffset, type ToasterProps, toast };
@@ -0,0 +1,226 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { useEffect, useState, useSyncExternalStore } from "react";
4
+ import { useKitLabels } from "../i18n/kit-labels.js";
5
+ import { useMediaQuery } from "../hooks/use-media-query.js";
6
+ import { PHONE_QUERY } from "./ui.js";
7
+ let sonner = null;
8
+ let loading = null;
9
+ const queue = [];
10
+ function loadSonner() {
11
+ loading ??= import("sonner").then(
12
+ (mod) => {
13
+ sonner = mod;
14
+ for (const fn of queue.splice(0)) fn(mod);
15
+ return mod;
16
+ },
17
+ () => {
18
+ queue.length = 0;
19
+ console.warn(
20
+ "@eifi1/ui-kit: `toast` needs the optional peer `sonner` \u2014 install it (npm i sonner) to show toasts."
21
+ );
22
+ return null;
23
+ }
24
+ );
25
+ return loading;
26
+ }
27
+ function withSonner(fn) {
28
+ if (sonner) {
29
+ fn(sonner);
30
+ return;
31
+ }
32
+ queue.push(fn);
33
+ void loadSonner();
34
+ }
35
+ let counter = 0;
36
+ const nextId = () => `kit-toast-${++counter}`;
37
+ const DEFAULT_TOAST_LABELS = {
38
+ close: "Close notification",
39
+ notifications: "Notifications",
40
+ undo: "Undo",
41
+ redo: "Redo"
42
+ };
43
+ let activeLabels = DEFAULT_TOAST_LABELS;
44
+ const TOAST_ACTION_DURATION = 8e3;
45
+ const privately = (node) => /* @__PURE__ */ jsx("span", { "data-private": "", children: node });
46
+ function toSonnerData(opts, id) {
47
+ const { redact, description, duration, action, ...rest } = opts ?? {};
48
+ const data = { ...rest, id };
49
+ if (description !== void 0) data.description = redact ? privately(description) : description;
50
+ if (action) data.action = action;
51
+ const resolved = duration ?? (action ? TOAST_ACTION_DURATION : void 0);
52
+ if (resolved !== void 0) data.duration = resolved;
53
+ return data;
54
+ }
55
+ function show(kind, message, opts) {
56
+ const id = opts?.id ?? nextId();
57
+ const title = opts?.redact ? privately(message) : message;
58
+ const data = toSonnerData(opts, id);
59
+ withSonner((s) => {
60
+ if (kind === "default") s.toast(title, data);
61
+ else s.toast[kind](title, data);
62
+ });
63
+ return id;
64
+ }
65
+ function undoable(message, { tone = "success", label, run, ...opts }, fallback) {
66
+ return show(tone, message, {
67
+ ...opts,
68
+ action: { label: label ?? fallback, onClick: () => run() }
69
+ });
70
+ }
71
+ const toast = Object.assign(
72
+ (message, opts) => show("default", message, opts),
73
+ {
74
+ message: (message, opts) => show("default", message, opts),
75
+ success: (message, opts) => show("success", message, opts),
76
+ error: (message, opts) => show("error", message, opts),
77
+ warning: (message, opts) => show("warning", message, opts),
78
+ info: (message, opts) => show("info", message, opts),
79
+ /** A spinner that does not time out — replace it (same `id`) or dismiss it. */
80
+ loading: (message, opts) => show("loading", message, opts),
81
+ /**
82
+ * A loading toast that becomes the success or the error toast, in place, when
83
+ * `promise` settles. Returns the toast's id; the promise itself is the caller's.
84
+ */
85
+ promise(promise, options) {
86
+ const { loading: pending, success, error, finally: onFinally, ...opts } = options;
87
+ const id = show("loading", pending, opts);
88
+ const same = { ...opts, id };
89
+ Promise.resolve().then(() => typeof promise === "function" ? promise() : promise).then(
90
+ (value) => {
91
+ if (success === void 0) toast.dismiss(id);
92
+ else show("success", typeof success === "function" ? success(value) : success, same);
93
+ },
94
+ (reason) => {
95
+ if (error === void 0) toast.dismiss(id);
96
+ else show("error", typeof error === "function" ? error(reason) : error, same);
97
+ }
98
+ ).finally(() => onFinally?.());
99
+ return id;
100
+ },
101
+ /** Close one toast, or every toast when `id` is omitted. */
102
+ dismiss(id) {
103
+ withSonner((s) => s.toast.dismiss(id));
104
+ },
105
+ /** Render your own node in a toast slot — `render` receives the id to dismiss it. */
106
+ custom(render, opts) {
107
+ const id = opts?.id ?? nextId();
108
+ const data = toSonnerData(opts, id);
109
+ withSonner((s) => s.toast.custom(render, data));
110
+ return id;
111
+ },
112
+ /**
113
+ * "Deleted — Undo": a toast whose action takes the step back, labelled by the
114
+ * provider's `toast.undo`. The journal stays the app's; this is only its toast.
115
+ * Pair with {@link toast.redo} so the step back can itself be taken back.
116
+ */
117
+ undo(message, { onUndo, ...opts }) {
118
+ return undoable(message, { ...opts, run: onUndo }, activeLabels.undo);
119
+ },
120
+ /** {@link toast.undo}'s mirror: the action is labelled `toast.redo`. */
121
+ redo(message, { onRedo, ...opts }) {
122
+ return undoable(message, { ...opts, run: onRedo }, activeLabels.redo);
123
+ }
124
+ }
125
+ );
126
+ const KIT_TOASTER_STYLE = {
127
+ zIndex: "var(--z-toast, 2147483647)",
128
+ fontFamily: "inherit",
129
+ "--normal-bg": "var(--bg-surface)",
130
+ "--normal-bg-hover": "var(--bg-hover)",
131
+ "--normal-border": "var(--border)",
132
+ "--normal-border-hover": "var(--border-strong)",
133
+ "--normal-text": "var(--text-primary)",
134
+ "--gray2": "var(--bg-hover)",
135
+ "--gray5": "var(--border-strong)",
136
+ "--gray11": "var(--text-muted)",
137
+ "--success-bg": "var(--toast-success-bg)",
138
+ "--success-border": "var(--toast-success-border)",
139
+ "--success-text": "var(--success)",
140
+ "--info-bg": "var(--toast-info-bg)",
141
+ "--info-border": "var(--toast-info-border)",
142
+ "--info-text": "var(--info)",
143
+ "--warning-bg": "var(--toast-warning-bg)",
144
+ "--warning-border": "var(--toast-warning-border)",
145
+ "--warning-text": "var(--warning)",
146
+ "--error-bg": "var(--toast-danger-bg)",
147
+ "--error-border": "var(--toast-danger-border)",
148
+ "--error-text": "var(--danger)"
149
+ };
150
+ const ALL_DIRECTIONS = ["top", "right", "bottom", "left"];
151
+ function readDocumentTheme() {
152
+ return typeof document !== "undefined" && document.documentElement.classList.contains("dark") ? "dark" : "light";
153
+ }
154
+ function subscribeDocumentTheme(onChange) {
155
+ if (typeof MutationObserver === "undefined") return () => {
156
+ };
157
+ const mo = new MutationObserver(onChange);
158
+ mo.observe(document.documentElement, { attributes: true, attributeFilter: ["class"] });
159
+ return () => mo.disconnect();
160
+ }
161
+ const px = (v) => typeof v === "number" ? `${v}px` : v;
162
+ function Toaster({
163
+ position,
164
+ navOffset,
165
+ theme,
166
+ labels: labelsProp,
167
+ closeButton = true,
168
+ richColors = true,
169
+ swipeDirections = ALL_DIRECTIONS,
170
+ offset,
171
+ mobileOffset,
172
+ className,
173
+ style,
174
+ ...rest
175
+ }) {
176
+ const [mod, setMod] = useState(sonner);
177
+ useEffect(() => {
178
+ if (mod) return;
179
+ let live = true;
180
+ void loadSonner().then((m) => {
181
+ if (live && m) setMod(m);
182
+ });
183
+ return () => {
184
+ live = false;
185
+ };
186
+ }, [mod]);
187
+ const labels = useKitLabels("toast", DEFAULT_TOAST_LABELS, labelsProp);
188
+ useEffect(() => {
189
+ activeLabels = labels;
190
+ return () => {
191
+ if (activeLabels === labels) activeLabels = DEFAULT_TOAST_LABELS;
192
+ };
193
+ }, [labels]);
194
+ const documentTheme = useSyncExternalStore(subscribeDocumentTheme, readDocumentTheme, () => "light");
195
+ const phone = useMediaQuery(PHONE_QUERY, false);
196
+ const resolved = position ?? (phone ? "bottom-center" : "top-center");
197
+ const bottom = `calc(max(${navOffset === void 0 ? "var(--app-nav-h, 0px)" : px(navOffset)}, env(safe-area-inset-bottom, 0px)) + 0.75rem)`;
198
+ const top = "calc(env(safe-area-inset-top, 0px) + 4rem)";
199
+ const computed = resolved.startsWith("bottom") ? { bottom } : { top };
200
+ if (!mod) return null;
201
+ const Sonner = mod.Toaster;
202
+ return /* @__PURE__ */ jsx(
203
+ Sonner,
204
+ {
205
+ ...rest,
206
+ position: resolved,
207
+ theme: theme ?? documentTheme,
208
+ closeButton,
209
+ richColors,
210
+ swipeDirections,
211
+ offset: offset ?? computed,
212
+ mobileOffset: mobileOffset ?? offset ?? computed,
213
+ containerAriaLabel: labels.notifications,
214
+ toastOptions: { closeButtonAriaLabel: labels.close },
215
+ className: className ? `kit-toaster ${className}` : "kit-toaster",
216
+ style: { ...KIT_TOASTER_STYLE, ...style }
217
+ }
218
+ );
219
+ }
220
+ export {
221
+ DEFAULT_TOAST_LABELS,
222
+ TOAST_ACTION_DURATION,
223
+ Toaster,
224
+ toast
225
+ };
226
+ //# sourceMappingURL=toast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/toast.tsx"],"sourcesContent":["import { useEffect, useState, useSyncExternalStore } from \"react\";\nimport type { CSSProperties, MouseEvent, ReactElement, ReactNode } from \"react\";\nimport { useKitLabels } from \"../i18n/kit-labels\";\nimport { useMediaQuery } from \"../hooks/use-media-query\";\nimport { PHONE_QUERY } from \"./ui\";\n\n/**\n * The kit's toast layer: a `toast` API and a `<Toaster>`, over sonner.\n *\n * WHY A WRAPPER AND NOT \"USE SONNER\". Both apps mounted sonner by hand and carried the\n * same policy in it — bottom-centre on a phone so the toast covers neither the header\n * nor the bottom nav, a lift above that nav, swipe in every direction, a z-index above\n * every overlay, the theme fed in from the store — and one of them wrote that policy\n * twice. `toast` mirrors sonner's call shape, so migrating is an import swap:\n *\n * import { toast } from \"@eifi1/ui-kit\"; // was: from \"sonner\"\n *\n * WHY SONNER IS LOADED LAZILY. It is an OPTIONAL peer, and this module is re-exported by\n * the barrel: a static import here would make every app that imports a Button install\n * it (see optional-peer-imports.test.tsx). So nothing here imports it statically. The\n * `<Toaster>` loads it when it mounts — long before anyone clicks anything — and a call\n * made before that is queued and replayed in order the moment it has loaded. Every call\n * returns its id synchronously anyway: the id is chosen here, not by sonner.\n */\n\ntype Sonner = typeof import(\"sonner\");\ntype SonnerData = NonNullable<Parameters<Sonner[\"toast\"]>[1]>;\n\n/* ── Loading sonner ──────────────────────────────────────────────────────── */\n\nlet sonner: Sonner | null = null;\nlet loading: Promise<Sonner | null> | null = null;\nconst queue: Array<(s: Sonner) => void> = [];\n\nfunction loadSonner(): Promise<Sonner | null> {\n loading ??= import(\"sonner\").then(\n (mod) => {\n sonner = mod;\n // Flushed in the SAME callback that sets `sonner`, so a call arriving between\n // the two cannot overtake one that was queued before it.\n for (const fn of queue.splice(0)) fn(mod);\n return mod;\n },\n () => {\n queue.length = 0;\n console.warn(\n \"@eifi1/ui-kit: `toast` needs the optional peer `sonner` — install it (npm i sonner) to show toasts.\",\n );\n return null;\n },\n );\n return loading;\n}\n\nfunction withSonner(fn: (s: Sonner) => void): void {\n if (sonner) {\n fn(sonner);\n return;\n }\n queue.push(fn);\n void loadSonner();\n}\n\nlet counter = 0;\nconst nextId = () => `kit-toast-${++counter}`;\n\n/* ── Labels ──────────────────────────────────────────────────────────────── */\n\n/** The words the toast layer says. `close` and `notifications` are read by a screen\n * reader (the close button's name, the toast region's name); `undo` and `redo` are\n * the default action labels of {@link toast.undo} / {@link toast.redo}. */\nexport interface ToastLabels {\n close: string;\n notifications: string;\n undo: string;\n redo: string;\n}\n\nexport const DEFAULT_TOAST_LABELS: ToastLabels = {\n close: \"Close notification\",\n notifications: \"Notifications\",\n undo: \"Undo\",\n redo: \"Redo\",\n};\n\n/** What the mounted `<Toaster>` resolved from `<UiKitProvider>` — so `toast.undo()`,\n * which is called from mutation callbacks and not from a component, still says\n * \"Rückgängig\" in a German app. */\nlet activeLabels: ToastLabels = DEFAULT_TOAST_LABELS;\n\n/* ── The API ─────────────────────────────────────────────────────────────── */\n\nexport type ToastId = string | number;\n\n/** A button on the toast. Clicking it dismisses the toast, unless `onClick` calls\n * `event.preventDefault()`. */\nexport interface ToastAction {\n label: ReactNode;\n onClick: (event: MouseEvent<HTMLButtonElement>) => void;\n}\n\nexport interface ToastOptions {\n /** Re-using an id REPLACES the toast on screen with that id (in place — it does not\n * stack a second one), which is how a toast is updated. Default: a fresh id. */\n id?: ToastId;\n description?: ReactNode;\n action?: ToastAction;\n /** A second, quieter button (sonner's `cancel`). */\n cancel?: ToastAction;\n /** Milliseconds; `Infinity` keeps it until dismissed. Default 4s — or\n * {@link TOAST_ACTION_DURATION} when there is an `action`, so there is time to\n * read the message AND reach the button. */\n duration?: number;\n /** Called when the toast is closed by the user (close button, swipe, action). */\n onDismiss?: (toast: { id: ToastId }) => void;\n /** Called when the toast times out. */\n onAutoClose?: (toast: { id: ToastId }) => void;\n /** Wrap the message and the description in `data-private`, so an app's demo /\n * privacy mode blurs them like every other sensitive value. */\n redact?: boolean;\n /** Replaces the tone's icon. */\n icon?: ReactNode;\n /** `false`: no close button, no swipe. */\n dismissible?: boolean;\n /** Per toast, over the `<Toaster>`'s `closeButton`. */\n closeButton?: boolean;\n className?: string;\n style?: CSSProperties;\n}\n\n/** The default duration of a toast that carries an action (8s rather than 4s). */\nexport const TOAST_ACTION_DURATION = 8000;\n\ntype Kind = \"default\" | \"success\" | \"error\" | \"warning\" | \"info\" | \"loading\";\n\nconst privately = (node: ReactNode) => <span data-private=\"\">{node}</span>;\n\nfunction toSonnerData(opts: ToastOptions | undefined, id: ToastId): SonnerData {\n const { redact, description, duration, action, ...rest } = opts ?? {};\n const data: SonnerData = { ...rest, id };\n if (description !== undefined) data.description = redact ? privately(description) : description;\n if (action) data.action = action;\n const resolved = duration ?? (action ? TOAST_ACTION_DURATION : undefined);\n if (resolved !== undefined) data.duration = resolved;\n return data;\n}\n\nfunction show(kind: Kind, message: ReactNode, opts?: ToastOptions): ToastId {\n const id = opts?.id ?? nextId();\n const title = opts?.redact ? privately(message) : message;\n const data = toSonnerData(opts, id);\n withSonner((s) => {\n if (kind === \"default\") s.toast(title, data);\n else s.toast[kind](title, data);\n });\n return id;\n}\n\nexport interface ToastPromiseOptions<T> extends ToastOptions {\n loading: ReactNode;\n /** The success message, or a function of the resolved value. Omitted: the loading\n * toast is dismissed. */\n success?: ReactNode | ((value: T) => ReactNode);\n /** The error message, or a function of the rejection. Omitted: dismissed. */\n error?: ReactNode | ((error: unknown) => ReactNode);\n finally?: () => void;\n}\n\nexport interface ToastUndoOptions extends Omit<ToastOptions, \"action\"> {\n /** Called when the button is pressed. */\n onUndo: () => void;\n /** Default: `toast.undo` from `<UiKitProvider>` (\"Undo\"). */\n label?: ReactNode;\n /** Default `success` — the step the toast reports worked. */\n tone?: Exclude<Kind, \"loading\">;\n}\n\nexport interface ToastRedoOptions extends Omit<ToastUndoOptions, \"onUndo\"> {\n onRedo: () => void;\n}\n\nfunction undoable(\n message: ReactNode,\n { tone = \"success\", label, run, ...opts }: Omit<ToastUndoOptions, \"onUndo\"> & { run: () => void },\n fallback: ReactNode,\n): ToastId {\n return show(tone, message, {\n ...opts,\n action: { label: label ?? fallback, onClick: () => run() },\n });\n}\n\n/**\n * Show a toast. The same shape as sonner's `toast`, so an app migrates by changing the\n * import: `toast(msg, opts)`, `toast.success` / `error` / `warning` / `info` /\n * `loading`, `toast.promise`, `toast.dismiss`, `toast.custom`. Each returns the toast's\n * id; pass it back as `id` to replace that toast in place.\n *\n * Needs a mounted {@link Toaster}. Messages may be any ReactNode.\n */\nexport const toast = Object.assign(\n (message: ReactNode, opts?: ToastOptions): ToastId => show(\"default\", message, opts),\n {\n message: (message: ReactNode, opts?: ToastOptions) => show(\"default\", message, opts),\n success: (message: ReactNode, opts?: ToastOptions) => show(\"success\", message, opts),\n error: (message: ReactNode, opts?: ToastOptions) => show(\"error\", message, opts),\n warning: (message: ReactNode, opts?: ToastOptions) => show(\"warning\", message, opts),\n info: (message: ReactNode, opts?: ToastOptions) => show(\"info\", message, opts),\n /** A spinner that does not time out — replace it (same `id`) or dismiss it. */\n loading: (message: ReactNode, opts?: ToastOptions) => show(\"loading\", message, opts),\n\n /**\n * A loading toast that becomes the success or the error toast, in place, when\n * `promise` settles. Returns the toast's id; the promise itself is the caller's.\n */\n promise<T>(promise: Promise<T> | (() => Promise<T>), options: ToastPromiseOptions<T>): ToastId {\n const { loading: pending, success, error, finally: onFinally, ...opts } = options;\n const id = show(\"loading\", pending, opts);\n const same = { ...opts, id };\n Promise.resolve()\n .then(() => (typeof promise === \"function\" ? promise() : promise))\n .then(\n (value) => {\n if (success === undefined) toast.dismiss(id);\n else show(\"success\", typeof success === \"function\" ? success(value) : success, same);\n },\n (reason: unknown) => {\n if (error === undefined) toast.dismiss(id);\n else show(\"error\", typeof error === \"function\" ? error(reason) : error, same);\n },\n )\n .finally(() => onFinally?.());\n return id;\n },\n\n /** Close one toast, or every toast when `id` is omitted. */\n dismiss(id?: ToastId): void {\n withSonner((s) => s.toast.dismiss(id));\n },\n\n /** Render your own node in a toast slot — `render` receives the id to dismiss it. */\n custom(render: (id: ToastId) => ReactElement, opts?: Omit<ToastOptions, \"redact\">): ToastId {\n const id = opts?.id ?? nextId();\n const data = toSonnerData(opts, id);\n withSonner((s) => s.toast.custom(render, data));\n return id;\n },\n\n /**\n * \"Deleted — Undo\": a toast whose action takes the step back, labelled by the\n * provider's `toast.undo`. The journal stays the app's; this is only its toast.\n * Pair with {@link toast.redo} so the step back can itself be taken back.\n */\n undo(message: ReactNode, { onUndo, ...opts }: ToastUndoOptions): ToastId {\n return undoable(message, { ...opts, run: onUndo }, activeLabels.undo);\n },\n\n /** {@link toast.undo}'s mirror: the action is labelled `toast.redo`. */\n redo(message: ReactNode, { onRedo, ...opts }: ToastRedoOptions): ToastId {\n return undoable(message, { ...opts, run: onRedo }, activeLabels.redo);\n },\n },\n);\n\n/* ── The Toaster ─────────────────────────────────────────────────────────── */\n\nexport type ToastPosition =\n | \"top-left\"\n | \"top-center\"\n | \"top-right\"\n | \"bottom-left\"\n | \"bottom-center\"\n | \"bottom-right\";\n\nexport type ToastSwipeDirection = \"top\" | \"right\" | \"bottom\" | \"left\";\n\n/** sonner's offset: one value for every edge, or per edge. Numbers are px. */\nexport type ToasterOffset =\n | string\n | number\n | { top?: string | number; right?: string | number; bottom?: string | number; left?: string | number };\n\nexport interface ToasterProps {\n /** Default: `bottom-center` on a phone (so the toast covers neither the header's\n * buttons nor the bottom nav's), `top-center` from `md` up. */\n position?: ToastPosition;\n /** The height to keep clear at the bottom — AppShell's bottom nav. Default: its\n * measured `--app-nav-h`, so nothing has to be passed under an AppShell. The safe\n * area is added either way. Numbers are px. */\n navOffset?: string | number;\n /** Default: follows the `.dark` class the kit's theme store (`useApplyTheme`) puts\n * on `<html>` — whichever store the app built, with nothing passed. */\n theme?: \"light\" | \"dark\" | \"system\";\n labels?: Partial<ToastLabels>;\n /** Default 4s (8s for a toast with an action). */\n duration?: number;\n visibleToasts?: number;\n expand?: boolean;\n /** Default true. */\n closeButton?: boolean;\n /** Tone-coloured toasts (the AlertBanner tokens). Default true. */\n richColors?: boolean;\n /** Default: every direction. */\n swipeDirections?: ToastSwipeDirection[];\n /** Overrides the computed offset outright (above the nav on a phone, below a 48px\n * top bar on desktop). */\n offset?: ToasterOffset;\n /** Below 600px, where sonner switches to its full-width layout. Default: `offset`'s\n * phone value. */\n mobileOffset?: ToasterOffset;\n /** Keyboard shortcut that moves focus into the toasts. Default Alt+T. */\n hotkey?: string[];\n gap?: number;\n dir?: \"ltr\" | \"rtl\" | \"auto\";\n className?: string;\n style?: CSSProperties;\n}\n\n/** The kit's palette, mapped onto sonner's variables. Inline on the toaster element,\n * so it wins over sonner's injected sheet with no specificity contest. The tone\n * backgrounds go through `--toast-*` aliases computed at `:root` in tokens.css:\n * sonner redefines `--success-bg` on this same element, and a variable cannot read\n * its own name — `--success-bg: var(--success-bg)` here would be a cycle. */\nconst KIT_TOASTER_STYLE = {\n zIndex: \"var(--z-toast, 2147483647)\",\n fontFamily: \"inherit\",\n \"--normal-bg\": \"var(--bg-surface)\",\n \"--normal-bg-hover\": \"var(--bg-hover)\",\n \"--normal-border\": \"var(--border)\",\n \"--normal-border-hover\": \"var(--border-strong)\",\n \"--normal-text\": \"var(--text-primary)\",\n \"--gray2\": \"var(--bg-hover)\",\n \"--gray5\": \"var(--border-strong)\",\n \"--gray11\": \"var(--text-muted)\",\n \"--success-bg\": \"var(--toast-success-bg)\",\n \"--success-border\": \"var(--toast-success-border)\",\n \"--success-text\": \"var(--success)\",\n \"--info-bg\": \"var(--toast-info-bg)\",\n \"--info-border\": \"var(--toast-info-border)\",\n \"--info-text\": \"var(--info)\",\n \"--warning-bg\": \"var(--toast-warning-bg)\",\n \"--warning-border\": \"var(--toast-warning-border)\",\n \"--warning-text\": \"var(--warning)\",\n \"--error-bg\": \"var(--toast-danger-bg)\",\n \"--error-border\": \"var(--toast-danger-border)\",\n \"--error-text\": \"var(--danger)\",\n} as CSSProperties;\n\nconst ALL_DIRECTIONS: ToastSwipeDirection[] = [\"top\", \"right\", \"bottom\", \"left\"];\n\n/** Light or dark, as the `.dark` class on `<html>` says right now. */\nfunction readDocumentTheme(): \"light\" | \"dark\" {\n return typeof document !== \"undefined\" && document.documentElement.classList.contains(\"dark\")\n ? \"dark\"\n : \"light\";\n}\n\nfunction subscribeDocumentTheme(onChange: () => void): () => void {\n if (typeof MutationObserver === \"undefined\") return () => {};\n const mo = new MutationObserver(onChange);\n mo.observe(document.documentElement, { attributes: true, attributeFilter: [\"class\"] });\n return () => mo.disconnect();\n}\n\nconst px = (v: string | number) => (typeof v === \"number\" ? `${v}px` : v);\n\n/**\n * Where the toasts appear, with the kit's defaults — mount ONE, near the root and\n * inside `<UiKitProvider>` (it reads the `toast` labels) and inside the router if a\n * toast's content navigates.\n *\n * Accessible as sonner makes it: the toasts sit in a polite live region, so a message\n * is announced with its description and its action's label; every toast and every\n * button in it is focusable, the timer pauses while focus or the pointer is inside,\n * and Alt+T ({@link ToasterProps.hotkey}) moves focus to the newest toast. A toast\n * with an action stays up 8s by default, so the button can be reached.\n */\nexport function Toaster({\n position,\n navOffset,\n theme,\n labels: labelsProp,\n closeButton = true,\n richColors = true,\n swipeDirections = ALL_DIRECTIONS,\n offset,\n mobileOffset,\n className,\n style,\n ...rest\n}: ToasterProps) {\n const [mod, setMod] = useState<Sonner | null>(sonner);\n useEffect(() => {\n if (mod) return;\n let live = true;\n void loadSonner().then((m) => {\n if (live && m) setMod(m);\n });\n return () => {\n live = false;\n };\n }, [mod]);\n\n const labels = useKitLabels(\"toast\", DEFAULT_TOAST_LABELS, labelsProp);\n useEffect(() => {\n activeLabels = labels;\n return () => {\n if (activeLabels === labels) activeLabels = DEFAULT_TOAST_LABELS;\n };\n }, [labels]);\n\n const documentTheme = useSyncExternalStore(subscribeDocumentTheme, readDocumentTheme, () => \"light\" as const);\n const phone = useMediaQuery(PHONE_QUERY, false);\n const resolved: ToastPosition = position ?? (phone ? \"bottom-center\" : \"top-center\");\n\n // Above the bottom nav and the home indicator: whichever is taller, since the nav\n // already pads itself by the safe area (the same sum BulkActionBar floats on).\n const bottom = `calc(max(${navOffset === undefined ? \"var(--app-nav-h, 0px)\" : px(navOffset)}, env(safe-area-inset-bottom, 0px)) + 0.75rem)`;\n // Below a 48px TopBar with the same 1rem clearance.\n const top = \"calc(env(safe-area-inset-top, 0px) + 4rem)\";\n const computed = resolved.startsWith(\"bottom\") ? { bottom } : { top };\n\n if (!mod) return null;\n const Sonner = mod.Toaster;\n return (\n <Sonner\n {...rest}\n position={resolved}\n theme={theme ?? documentTheme}\n closeButton={closeButton}\n richColors={richColors}\n swipeDirections={swipeDirections}\n offset={offset ?? computed}\n mobileOffset={mobileOffset ?? offset ?? computed}\n containerAriaLabel={labels.notifications}\n toastOptions={{ closeButtonAriaLabel: labels.close }}\n className={className ? `kit-toaster ${className}` : \"kit-toaster\"}\n style={{ ...KIT_TOASTER_STYLE, ...style }}\n />\n );\n}\n"],"mappings":"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","names":[]}
@@ -1,4 +1,4 @@
1
- import { ComponentPropsWithoutRef, ReactElement } from 'react';
1
+ import { ComponentPropsWithoutRef, ReactNode, ReactElement } from 'react';
2
2
 
3
3
  interface ToggleOption<T extends string> {
4
4
  value: T;
@@ -40,12 +40,53 @@ interface ToggleGroupBaseProps<T extends string> extends Omit<ComponentPropsWith
40
40
  * live and others are not is a menu with holes in it, and no caller here wants one.
41
41
  */
42
42
  disabled?: boolean;
43
+ /**
44
+ * `sm`: 12px options with `px-2 py-1` — the compact group keksdose's rule editor
45
+ * (rule-editor:204) writes as `optionClassName="px-2 py-1 text-xs"` beside a small
46
+ * caption. `md` (default) is the size every other group has.
47
+ */
48
+ size?: "sm" | "md";
49
+ /**
50
+ * Stand in a form row as a FIELD: with a label the group wears the field's chrome —
51
+ * border, surface, the top strip with a small static label in it, a labelled
52
+ * {@link Select}'s height — so beside an Input or a Select it reads as one of them
53
+ * rather than as a control with a caption over it. lenkbank builds exactly this by
54
+ * hand as `ToggleField` (features/gear/common.tsx:97, feedback #69), and its notes
55
+ * are why the chrome STRETCHES to its row as well as matching the select's padding:
56
+ * a native select's height is the browser's, so a toggle a few pixels short of it
57
+ * is levelled up by the row rather than by arithmetic.
58
+ *
59
+ * The label names the group (`aria-labelledby`), so `aria-label` is not needed. With
60
+ * a label, `className` styles the field's wrapper — as on {@link Select} — and the
61
+ * group's own box is dropped: two nested borders read as a control in a control.
62
+ */
63
+ label?: ReactNode;
64
+ /** A {@link FieldHint} on the label line, as on a labelled {@link Select}. Only with
65
+ * `label`. */
66
+ hint?: ReactNode;
67
+ /** The message under the field when it is wrong: paints the field's border with
68
+ * `--danger`, marks the group `aria-invalid` and describes it with the message, as
69
+ * {@link Select}'s `error` does. Only with `label`. */
70
+ error?: ReactNode;
43
71
  }
72
+ /**
73
+ * A line under the group saying what the CHOSEN option means — lenkbank's ToggleField
74
+ * `hint` (features/gear/common.tsx:97): not help behind a "?" but a caption, and one
75
+ * that changes as the choice does. Pass a function of the value for that; it is
76
+ * attached with `aria-describedby`, and a function caption is also a polite live
77
+ * region, because a description is read when the group is entered and not again when
78
+ * an arrow key changes the choice underneath it.
79
+ *
80
+ * In muted 11px text under the field (or the bare group), above an `error`.
81
+ */
82
+ type ToggleGroupCaption<V> = ReactNode | ((value: V) => ReactNode);
44
83
  /** The group as it has always been: one option is always the answer. */
45
84
  interface ToggleGroupRequiredProps<T extends string> extends ToggleGroupBaseProps<T> {
46
85
  allowEmpty?: false;
47
86
  value: T;
48
87
  onChange: (value: T) => void;
88
+ /** See {@link ToggleGroupCaption}. */
89
+ caption?: ToggleGroupCaption<T>;
49
90
  }
50
91
  /**
51
92
  * A group that can be emptied: clicking the active option clears it, and `onChange`
@@ -61,6 +102,8 @@ interface ToggleGroupClearableProps<T extends string> extends ToggleGroupBasePro
61
102
  allowEmpty: true;
62
103
  value: T | null;
63
104
  onChange: (value: T | null) => void;
105
+ /** See {@link ToggleGroupCaption}. `null` while nothing is chosen. */
106
+ caption?: ToggleGroupCaption<T | null>;
64
107
  }
65
108
  /** `allowEmpty` picks the shape, so `onChange` is typed `(T) => void` unless the group
66
109
  * can actually emit `null` — no existing caller has a `null` to handle. */
@@ -1,7 +1,9 @@
1
1
  "use client";
2
- import { jsx } from "react/jsx-runtime";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useId } from "react";
3
4
  import { cn } from "../lib/cn.js";
4
5
  import { horizontalStep } from "../lib/direction.js";
6
+ import { FIELD_INVALID, FloatingField } from "./ui.js";
5
7
  function ToggleGroup(props) {
6
8
  const {
7
9
  value,
@@ -10,10 +12,22 @@ function ToggleGroup(props) {
10
12
  optionClassName,
11
13
  ariaLabel,
12
14
  disabled = false,
15
+ size = "md",
16
+ label,
17
+ hint,
18
+ error,
13
19
  "aria-label": ariaLabelAttr,
14
20
  ...restWithMode
15
21
  } = props;
16
- const { allowEmpty: _allowEmpty, onChange: _onChange, ...rest } = restWithMode;
22
+ const labelId = useId();
23
+ const errorId = useId();
24
+ const field = label !== void 0 && label !== null && label !== false && label !== "";
25
+ const hasError = field && error !== void 0 && error !== null && error !== false && error !== "";
26
+ const { allowEmpty: _allowEmpty, onChange: _onChange, caption, ...rest } = restWithMode;
27
+ const captionId = useId();
28
+ const captionIsLive = typeof caption === "function";
29
+ const captionNode = captionIsLive ? caption(value) : caption;
30
+ const hasCaption = captionNode !== void 0 && captionNode !== null && captionNode !== false && captionNode !== "";
17
31
  const choose = (next) => {
18
32
  if (props.allowEmpty) props.onChange(next === value ? null : next);
19
33
  else props.onChange(next);
@@ -36,12 +50,15 @@ function ToggleGroup(props) {
36
50
  buttons?.[next]?.focus();
37
51
  choose(options[next].value);
38
52
  };
39
- return /* @__PURE__ */ jsx(
53
+ const group = /* @__PURE__ */ jsx(
40
54
  "div",
41
55
  {
42
56
  ...rest,
43
57
  role: clearable ? "group" : "radiogroup",
44
58
  "aria-label": ariaLabelAttr ?? ariaLabel,
59
+ "aria-labelledby": field && ariaLabelAttr === void 0 && ariaLabel === void 0 ? labelId : rest["aria-labelledby"],
60
+ "aria-invalid": hasError || rest["aria-invalid"] || void 0,
61
+ "aria-describedby": [rest["aria-describedby"], hasCaption && captionId, hasError && errorId].filter(Boolean).join(" ") || void 0,
45
62
  "aria-disabled": disabled || void 0,
46
63
  className: cn(
47
64
  // `gap-0.5` — the same 2px as the container's own padding, so EVERY segment
@@ -61,7 +78,10 @@ function ToggleGroup(props) {
61
78
  // package does; `cursor-not-allowed` is on the buttons, which is what a
62
79
  // pointer is actually over.
63
80
  disabled && "opacity-60",
64
- className
81
+ // Inside the field's chrome the group is only a row of segments: no border, no
82
+ // surface, no padding of its own, and the field (not the group) is what dims.
83
+ field && "border-0 bg-transparent p-0 shadow-none opacity-100",
84
+ !field && className
65
85
  ),
66
86
  children: options.map((opt, index) => {
67
87
  const active = opt.value === value;
@@ -100,6 +120,11 @@ function ToggleGroup(props) {
100
120
  // inside the segment it belongs to; focus-visible keeps it for the
101
121
  // keyboard, which is the only input that needs it.
102
122
  "min-w-0 flex-1 basis-auto truncate rounded px-3 py-1.5 text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--border-strong)]",
123
+ size === "sm" && "px-2 py-1 text-xs",
124
+ // In a field: no vertical padding and a 20px line — a `text-sm` line, the
125
+ // same line a labelled Select holds under its label strip — so the field's
126
+ // own `pt-4 pb-1` decides the height, as it does for the select.
127
+ field && "py-0 leading-5",
103
128
  active ? "bg-[var(--bg-inverse)] text-[var(--text-inverse)]" : "text-[var(--text-secondary)] hover:bg-[var(--bg-hover)]",
104
129
  // No hover fill on a group that cannot be changed — a segment that
105
130
  // lights up under the pointer is an offer, and there is none here.
@@ -114,6 +139,50 @@ function ToggleGroup(props) {
114
139
  })
115
140
  }
116
141
  );
142
+ const captionEl = hasCaption || captionIsLive ? /* @__PURE__ */ jsx(
143
+ "p",
144
+ {
145
+ id: captionId,
146
+ "aria-live": captionIsLive ? "polite" : void 0,
147
+ className: cn("text-[11px] leading-snug text-[var(--text-muted)]", hasCaption && "mt-1"),
148
+ children: hasCaption ? captionNode : null
149
+ }
150
+ ) : null;
151
+ if (!field) {
152
+ if (!captionEl) return group;
153
+ return /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
154
+ group,
155
+ captionEl
156
+ ] });
157
+ }
158
+ return (
159
+ // `h-full` + `flex-1`: the chrome fills a grid or stretched flex row, which is what
160
+ // levels it with a select beside it whatever the browser makes of the select.
161
+ /* @__PURE__ */ jsxs("div", { className: cn("flex h-full flex-col", className), children: [
162
+ /* @__PURE__ */ jsx(
163
+ FloatingField,
164
+ {
165
+ className: "flex flex-1 flex-col",
166
+ label: /* @__PURE__ */ jsx("span", { id: labelId, children: label }),
167
+ staticLabel: true,
168
+ hint,
169
+ children: /* @__PURE__ */ jsx(
170
+ "div",
171
+ {
172
+ className: cn(
173
+ "flex flex-1 flex-col justify-center rounded-md border border-[var(--border)] bg-[var(--bg-surface)] px-1 pt-4 pb-1 shadow-sm",
174
+ disabled && "bg-[var(--bg-surface-2)] opacity-60",
175
+ hasError && FIELD_INVALID
176
+ ),
177
+ children: group
178
+ }
179
+ )
180
+ }
181
+ ),
182
+ captionEl,
183
+ hasError && /* @__PURE__ */ jsx("p", { id: errorId, className: "mt-1 text-[11px] leading-tight text-[var(--danger)]", children: error })
184
+ ] })
185
+ );
117
186
  }
118
187
  export {
119
188
  ToggleGroup