@ttt-productions/ui-core 0.11.33 → 0.11.35

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 (238) hide show
  1. package/README.md +1 -1
  2. package/dist/browser/index.d.ts +2 -2
  3. package/dist/browser/index.d.ts.map +1 -1
  4. package/dist/browser/index.js +1 -2
  5. package/dist/browser/index.js.map +1 -1
  6. package/dist/browser/reload-recovery-watch.d.ts +2 -6
  7. package/dist/browser/reload-recovery-watch.d.ts.map +1 -1
  8. package/dist/browser/reload-recovery-watch.js +5 -10
  9. package/dist/browser/reload-recovery-watch.js.map +1 -1
  10. package/dist/index.d.ts +3 -3
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +3 -4
  13. package/dist/index.js.map +1 -1
  14. package/dist/lib/format-numbers.d.ts +0 -6
  15. package/dist/lib/format-numbers.d.ts.map +1 -1
  16. package/dist/lib/format-numbers.js +2 -8
  17. package/dist/lib/format-numbers.js.map +1 -1
  18. package/dist/lib/reload-recovery.d.ts +1 -9
  19. package/dist/lib/reload-recovery.d.ts.map +1 -1
  20. package/dist/lib/reload-recovery.js +14 -24
  21. package/dist/lib/reload-recovery.js.map +1 -1
  22. package/dist/lib/utils.d.ts +0 -3
  23. package/dist/lib/utils.d.ts.map +1 -1
  24. package/dist/lib/utils.js +0 -3
  25. package/dist/lib/utils.js.map +1 -1
  26. package/dist/react/components/accordion.d.ts +2 -2
  27. package/dist/react/components/accordion.d.ts.map +1 -1
  28. package/dist/react/components/accordion.js +8 -8
  29. package/dist/react/components/accordion.js.map +1 -1
  30. package/dist/react/components/action-row.d.ts +2 -9
  31. package/dist/react/components/action-row.d.ts.map +1 -1
  32. package/dist/react/components/action-row.js +7 -11
  33. package/dist/react/components/action-row.js.map +1 -1
  34. package/dist/react/components/alert-dialog.d.ts +2 -2
  35. package/dist/react/components/alert-dialog.d.ts.map +1 -1
  36. package/dist/react/components/alert-dialog.js +15 -15
  37. package/dist/react/components/alert-dialog.js.map +1 -1
  38. package/dist/react/components/alert.d.ts +2 -2
  39. package/dist/react/components/alert.d.ts.map +1 -1
  40. package/dist/react/components/alert.js +12 -12
  41. package/dist/react/components/alert.js.map +1 -1
  42. package/dist/react/components/avatar.d.ts +2 -2
  43. package/dist/react/components/avatar.d.ts.map +1 -1
  44. package/dist/react/components/avatar.js +7 -7
  45. package/dist/react/components/avatar.js.map +1 -1
  46. package/dist/react/components/badge.d.ts +2 -2
  47. package/dist/react/components/badge.d.ts.map +1 -1
  48. package/dist/react/components/badge.js +9 -9
  49. package/dist/react/components/badge.js.map +1 -1
  50. package/dist/react/components/button.d.ts +2 -12
  51. package/dist/react/components/button.d.ts.map +1 -1
  52. package/dist/react/components/button.js +30 -35
  53. package/dist/react/components/button.js.map +1 -1
  54. package/dist/react/components/card.d.ts +1 -1
  55. package/dist/react/components/card.d.ts.map +1 -1
  56. package/dist/react/components/card.js +15 -15
  57. package/dist/react/components/card.js.map +1 -1
  58. package/dist/react/components/checkbox.d.ts +2 -2
  59. package/dist/react/components/checkbox.d.ts.map +1 -1
  60. package/dist/react/components/checkbox.js +6 -6
  61. package/dist/react/components/checkbox.js.map +1 -1
  62. package/dist/react/components/collapsible.d.ts +1 -1
  63. package/dist/react/components/collapsible.d.ts.map +1 -1
  64. package/dist/react/components/collapsible.js +2 -2
  65. package/dist/react/components/collapsible.js.map +1 -1
  66. package/dist/react/components/consequence-dialog.d.ts +1 -48
  67. package/dist/react/components/consequence-dialog.d.ts.map +1 -1
  68. package/dist/react/components/consequence-dialog.js +7 -23
  69. package/dist/react/components/consequence-dialog.js.map +1 -1
  70. package/dist/react/components/date-picker.d.ts +1 -18
  71. package/dist/react/components/date-picker.d.ts.map +1 -1
  72. package/dist/react/components/date-picker.js +102 -98
  73. package/dist/react/components/date-picker.js.map +1 -1
  74. package/dist/react/components/date-time-picker.d.ts +1 -24
  75. package/dist/react/components/date-time-picker.d.ts.map +1 -1
  76. package/dist/react/components/date-time-picker.js +20 -37
  77. package/dist/react/components/date-time-picker.js.map +1 -1
  78. package/dist/react/components/dialog.d.ts +2 -2
  79. package/dist/react/components/dialog.d.ts.map +1 -1
  80. package/dist/react/components/dialog.js +14 -14
  81. package/dist/react/components/dialog.js.map +1 -1
  82. package/dist/react/components/dropdown-menu.d.ts +2 -10
  83. package/dist/react/components/dropdown-menu.d.ts.map +1 -1
  84. package/dist/react/components/dropdown-menu.js +24 -20
  85. package/dist/react/components/dropdown-menu.js.map +1 -1
  86. package/dist/react/components/end-of-list-indicator.d.ts +1 -1
  87. package/dist/react/components/end-of-list-indicator.js +3 -3
  88. package/dist/react/components/end-of-list-indicator.js.map +1 -1
  89. package/dist/react/components/form.d.ts +3 -3
  90. package/dist/react/components/form.d.ts.map +1 -1
  91. package/dist/react/components/form.js +17 -17
  92. package/dist/react/components/form.js.map +1 -1
  93. package/dist/react/components/format-control.d.ts +7 -20
  94. package/dist/react/components/format-control.d.ts.map +1 -1
  95. package/dist/react/components/format-control.js +18 -22
  96. package/dist/react/components/format-control.js.map +1 -1
  97. package/dist/react/components/input.d.ts +10 -27
  98. package/dist/react/components/input.d.ts.map +1 -1
  99. package/dist/react/components/input.js +11 -9
  100. package/dist/react/components/input.js.map +1 -1
  101. package/dist/react/components/label.d.ts +3 -3
  102. package/dist/react/components/label.d.ts.map +1 -1
  103. package/dist/react/components/label.js +6 -6
  104. package/dist/react/components/label.js.map +1 -1
  105. package/dist/react/components/layout/screen-adaptive-view.d.ts +2 -9
  106. package/dist/react/components/layout/screen-adaptive-view.d.ts.map +1 -1
  107. package/dist/react/components/layout/screen-adaptive-view.js +40 -37
  108. package/dist/react/components/layout/screen-adaptive-view.js.map +1 -1
  109. package/dist/react/components/list-pagination.d.ts +1 -31
  110. package/dist/react/components/list-pagination.d.ts.map +1 -1
  111. package/dist/react/components/list-pagination.js +10 -37
  112. package/dist/react/components/list-pagination.js.map +1 -1
  113. package/dist/react/components/menubar.d.ts +2 -2
  114. package/dist/react/components/menubar.d.ts.map +1 -1
  115. package/dist/react/components/menubar.js +17 -17
  116. package/dist/react/components/menubar.js.map +1 -1
  117. package/dist/react/components/opener-focus.d.ts +2 -8
  118. package/dist/react/components/opener-focus.d.ts.map +1 -1
  119. package/dist/react/components/opener-focus.js +4 -10
  120. package/dist/react/components/opener-focus.js.map +1 -1
  121. package/dist/react/components/pending-guard.d.ts +1 -7
  122. package/dist/react/components/pending-guard.d.ts.map +1 -1
  123. package/dist/react/components/pending-guard.js +1 -7
  124. package/dist/react/components/pending-guard.js.map +1 -1
  125. package/dist/react/components/popover.d.ts +2 -2
  126. package/dist/react/components/popover.d.ts.map +1 -1
  127. package/dist/react/components/popover.js +5 -5
  128. package/dist/react/components/popover.js.map +1 -1
  129. package/dist/react/components/progress.d.ts +2 -2
  130. package/dist/react/components/progress.d.ts.map +1 -1
  131. package/dist/react/components/progress.js +5 -5
  132. package/dist/react/components/progress.js.map +1 -1
  133. package/dist/react/components/radio-group.d.ts +2 -2
  134. package/dist/react/components/radio-group.d.ts.map +1 -1
  135. package/dist/react/components/radio-group.js +7 -7
  136. package/dist/react/components/radio-group.js.map +1 -1
  137. package/dist/react/components/relative-time.d.ts +1 -9
  138. package/dist/react/components/relative-time.d.ts.map +1 -1
  139. package/dist/react/components/relative-time.js +8 -11
  140. package/dist/react/components/relative-time.js.map +1 -1
  141. package/dist/react/components/reload-recovery-notice.d.ts +3 -17
  142. package/dist/react/components/reload-recovery-notice.d.ts.map +1 -1
  143. package/dist/react/components/reload-recovery-notice.js +7 -12
  144. package/dist/react/components/reload-recovery-notice.js.map +1 -1
  145. package/dist/react/components/scroll-area.d.ts +2 -2
  146. package/dist/react/components/scroll-area.d.ts.map +1 -1
  147. package/dist/react/components/scroll-area.js +6 -8
  148. package/dist/react/components/scroll-area.js.map +1 -1
  149. package/dist/react/components/scroll-to-top-button.d.ts +6 -30
  150. package/dist/react/components/scroll-to-top-button.d.ts.map +1 -1
  151. package/dist/react/components/scroll-to-top-button.js +9 -9
  152. package/dist/react/components/scroll-to-top-button.js.map +1 -1
  153. package/dist/react/components/search-dropdown.d.ts +0 -53
  154. package/dist/react/components/search-dropdown.d.ts.map +1 -1
  155. package/dist/react/components/search-dropdown.js +10 -39
  156. package/dist/react/components/search-dropdown.js.map +1 -1
  157. package/dist/react/components/select.d.ts +2 -9
  158. package/dist/react/components/select.d.ts.map +1 -1
  159. package/dist/react/components/select.js +19 -21
  160. package/dist/react/components/select.js.map +1 -1
  161. package/dist/react/components/separator.d.ts +2 -2
  162. package/dist/react/components/separator.d.ts.map +1 -1
  163. package/dist/react/components/separator.js +5 -5
  164. package/dist/react/components/separator.js.map +1 -1
  165. package/dist/react/components/sheet.d.ts +3 -3
  166. package/dist/react/components/sheet.d.ts.map +1 -1
  167. package/dist/react/components/sheet.js +21 -21
  168. package/dist/react/components/sheet.js.map +1 -1
  169. package/dist/react/components/show-more-toggle.d.ts +2 -18
  170. package/dist/react/components/show-more-toggle.d.ts.map +1 -1
  171. package/dist/react/components/show-more-toggle.js +6 -11
  172. package/dist/react/components/show-more-toggle.js.map +1 -1
  173. package/dist/react/components/skeleton.d.ts +1 -1
  174. package/dist/react/components/skeleton.d.ts.map +1 -1
  175. package/dist/react/components/skeleton.js +3 -3
  176. package/dist/react/components/skeleton.js.map +1 -1
  177. package/dist/react/components/slider.d.ts +2 -2
  178. package/dist/react/components/slider.d.ts.map +1 -1
  179. package/dist/react/components/slider.js +5 -5
  180. package/dist/react/components/slider.js.map +1 -1
  181. package/dist/react/components/spinner.d.ts +1 -15
  182. package/dist/react/components/spinner.d.ts.map +1 -1
  183. package/dist/react/components/spinner.js +10 -18
  184. package/dist/react/components/spinner.js.map +1 -1
  185. package/dist/react/components/switch.d.ts +2 -9
  186. package/dist/react/components/switch.d.ts.map +1 -1
  187. package/dist/react/components/switch.js +13 -10
  188. package/dist/react/components/switch.js.map +1 -1
  189. package/dist/react/components/table.d.ts +2 -12
  190. package/dist/react/components/table.d.ts.map +1 -1
  191. package/dist/react/components/table.js +24 -30
  192. package/dist/react/components/table.js.map +1 -1
  193. package/dist/react/components/tabs.d.ts +2 -2
  194. package/dist/react/components/tabs.d.ts.map +1 -1
  195. package/dist/react/components/tabs.js +7 -7
  196. package/dist/react/components/tabs.js.map +1 -1
  197. package/dist/react/components/textarea.d.ts +5 -16
  198. package/dist/react/components/textarea.d.ts.map +1 -1
  199. package/dist/react/components/textarea.js +11 -9
  200. package/dist/react/components/textarea.js.map +1 -1
  201. package/dist/react/components/toast.d.ts +4 -8
  202. package/dist/react/components/toast.d.ts.map +1 -1
  203. package/dist/react/components/toast.js +26 -47
  204. package/dist/react/components/toast.js.map +1 -1
  205. package/dist/react/components/toaster.d.ts.map +1 -1
  206. package/dist/react/components/toaster.js +5 -5
  207. package/dist/react/components/toaster.js.map +1 -1
  208. package/dist/react/components/tooltip.d.ts +2 -2
  209. package/dist/react/components/tooltip.d.ts.map +1 -1
  210. package/dist/react/components/tooltip.js +5 -5
  211. package/dist/react/components/tooltip.js.map +1 -1
  212. package/dist/react/hooks/use-async-action.d.ts +1 -21
  213. package/dist/react/hooks/use-async-action.d.ts.map +1 -1
  214. package/dist/react/hooks/use-async-action.js +3 -11
  215. package/dist/react/hooks/use-async-action.js.map +1 -1
  216. package/dist/react/hooks/use-cursor-page.d.ts +1 -63
  217. package/dist/react/hooks/use-cursor-page.d.ts.map +1 -1
  218. package/dist/react/hooks/use-cursor-page.js +3 -39
  219. package/dist/react/hooks/use-cursor-page.js.map +1 -1
  220. package/dist/react/hooks/use-media-query.js +5 -5
  221. package/dist/react/hooks/use-media-query.js.map +1 -1
  222. package/dist/react/hooks/use-paged-list.d.ts +0 -43
  223. package/dist/react/hooks/use-paged-list.d.ts.map +1 -1
  224. package/dist/react/hooks/use-paged-list.js +2 -17
  225. package/dist/react/hooks/use-paged-list.js.map +1 -1
  226. package/dist/react/hooks/use-return-scroll.d.ts +1 -10
  227. package/dist/react/hooks/use-return-scroll.d.ts.map +1 -1
  228. package/dist/react/hooks/use-return-scroll.js +13 -45
  229. package/dist/react/hooks/use-return-scroll.js.map +1 -1
  230. package/dist/react/hooks/use-toast.d.ts +3 -11
  231. package/dist/react/hooks/use-toast.d.ts.map +1 -1
  232. package/dist/react/hooks/use-toast.js +18 -21
  233. package/dist/react/hooks/use-toast.js.map +1 -1
  234. package/dist/react/index.d.ts +74 -74
  235. package/dist/react/index.d.ts.map +1 -1
  236. package/dist/react/index.js +51 -57
  237. package/dist/react/index.js.map +1 -1
  238. package/package.json +8 -6
@@ -1 +1 @@
1
- {"version":3,"file":"collapsible.js","sourceRoot":"","sources":["../../../src/react/components/collapsible.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,KAAK,oBAAoB,MAAM,6BAA6B,CAAA;AAEnE,MAAM,WAAW,GAAG,oBAAoB,CAAC,IAAI,CAAA;AAE7C,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,kBAAkB,CAAA;AAElE,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,kBAAkB,CAAA;AAElE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAA","sourcesContent":["\"use client\"\n\nimport * as CollapsiblePrimitive from \"@radix-ui/react-collapsible\"\n\nconst Collapsible = CollapsiblePrimitive.Root\n\nconst CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger\n\nconst CollapsibleContent = CollapsiblePrimitive.CollapsibleContent\n\nexport { Collapsible, CollapsibleTrigger, CollapsibleContent }"]}
1
+ {"version":3,"file":"collapsible.js","sourceRoot":"","sources":["../../../src/react/components/collapsible.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,KAAK,oBAAoB,MAAM,6BAA6B,CAAC;AAEpE,MAAM,WAAW,GAAG,oBAAoB,CAAC,IAAI,CAAC;AAE9C,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,kBAAkB,CAAC;AAEnE,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,kBAAkB,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["'use client';\n\nimport * as CollapsiblePrimitive from '@radix-ui/react-collapsible';\n\nconst Collapsible = CollapsiblePrimitive.Root;\n\nconst CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;\n\nconst CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;\n\nexport { Collapsible, CollapsibleTrigger, CollapsibleContent };\n"]}
@@ -1,10 +1,4 @@
1
1
  import { type DeclaredInputFormat } from '@ttt-productions/input-format-core';
2
- /**
3
- * The inline reason field. The caller OWNS the reason value/onChange (draft state lives at the call
4
- * site) and the field's declaration — this component declares no business numbers and no copy.
5
- * Confirm stays disabled until the value passes the declaration's check; `min: 0` makes the reason
6
- * optional.
7
- */
8
2
  export interface ConsequenceDialogReason {
9
3
  inputFormat: DeclaredInputFormat;
10
4
  placeholder?: string;
@@ -12,69 +6,28 @@ export interface ConsequenceDialogReason {
12
6
  value: string;
13
7
  onChange: (value: string) => void;
14
8
  rows?: number;
15
- /**
16
- * A line rendered directly under the reason box, such as why its current text is refused. It is
17
- * called with the id the box names in its `aria-describedby`, and the element it renders carries
18
- * that id. The caller owns the words; this component adds none.
19
- */
20
9
  hint?: (id: string) => React.ReactNode;
21
10
  }
22
- /**
23
- * The exact-match typed-confirmation gate. `phrase` is business copy owned by the CALLER; the
24
- * component only compares the typed value against it.
25
- */
26
11
  export interface ConsequenceDialogTypedConfirmation {
27
12
  phrase: string;
28
13
  label?: React.ReactNode;
29
14
  }
30
15
  export interface ConsequenceDialogProps {
31
- /** Uncontrolled open model: the element that opens the dialog (rendered `asChild`). */
32
16
  trigger?: React.ReactNode;
33
- /** Controlled open model. Provide with `onOpenChange`. */
34
17
  open?: boolean;
35
18
  onOpenChange?: (open: boolean) => void;
36
- /** Heading — a string or node so callers can interpolate amounts / names. */
37
19
  title: React.ReactNode;
38
- /** SLOT 1 — what happens right now (e.g. "initiates a Stripe refund of $X now"). */
39
20
  immediateEffect?: React.ReactNode;
40
- /** SLOT 2 — what settles later, out of band (webhook / worker / async confirmation). */
41
21
  delayedEffect?: React.ReactNode;
42
- /** SLOT 3 — whether/how this can be undone or superseded. */
43
22
  reversibility?: React.ReactNode;
44
- /** Inline reason field. Optional. */
45
23
  reason?: ConsequenceDialogReason;
46
- /** Exact-phrase typed-confirmation gate. Optional. */
47
24
  typedConfirmation?: ConsequenceDialogTypedConfirmation;
48
25
  confirmLabel: React.ReactNode;
49
26
  cancelLabel?: React.ReactNode;
50
- /** `true` styles the confirm button with `bg-destructive`. */
51
27
  destructive?: boolean;
52
- /**
53
- * Runs on confirm. May be async — while it is pending the dialog STAYS OPEN: the confirm button
54
- * is `aria-disabled`, keeps focus, ignores further presses, and shows its pending spinner, and
55
- * only Cancel is natively disabled. Closes on resolve. If it rejects the dialog
56
- * stays open so the caller's own surface (error toast, TOTP step-up) can show and the operator can
57
- * retry or cancel. This component takes no Sentry/monitoring dependency — every error path
58
- * belongs to the caller's `onConfirm`.
59
- */
60
28
  onConfirm: () => void | Promise<void>;
61
- /**
62
- * Runs as the dialog closes, before Radix returns focus to the control that opened it. A confirmed
63
- * action that removes that control moves focus to its own destination here and calls
64
- * `event.preventDefault()`, so the restore does not pull focus back onto a control about to go.
65
- */
66
29
  onCloseAutoFocus?: (event: Event) => void;
67
30
  }
68
- /**
69
- * A reusable confirm-before-a-consequential-action dialog. Three optional, consistently-styled
70
- * consequence slots (immediate / afterward / reversibility), an optional inline reason field,
71
- * and an optional exact-phrase typed-confirmation gate. Composes the ui-core AlertDialog primitives
72
- * (Radix) — it never re-implements them. Supports BOTH a `trigger` (uncontrolled) and `open` /
73
- * `onOpenChange` (controlled).
74
- *
75
- * Pending model: the confirm button is a plain `Button` (NOT `AlertDialogAction`), so Radix does not
76
- * auto-close on click; open state is managed here so the dialog stays open with a visible spinner
77
- * until `onConfirm` resolves.
78
- */
31
+ /** The confirm is a plain `Button`, not `AlertDialogAction`, so Radix does not close the dialog on click. */
79
32
  export declare function ConsequenceDialog({ trigger, open, onOpenChange, title, immediateEffect, delayedEffect, reversibility, reason, typedConfirmation, confirmLabel, cancelLabel, destructive, onConfirm, onCloseAutoFocus, }: ConsequenceDialogProps): import("react").JSX.Element;
80
33
  //# sourceMappingURL=consequence-dialog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"consequence-dialog.d.ts","sourceRoot":"","sources":["../../../src/react/components/consequence-dialog.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAuC,KAAK,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAGnH;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,mBAAmB,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;CACxC;AAED;;;GAGG;AACH,MAAM,WAAW,kCAAkC;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACzB;AAED,MAAM,WAAW,sBAAsB;IACrC,uFAAuF;IACvF,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,0DAA0D;IAC1D,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAEvC,6EAA6E;IAC7E,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IAEvB,oFAAoF;IACpF,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAClC,wFAAwF;IACxF,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,6DAA6D;IAC7D,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEhC,qCAAqC;IACrC,MAAM,CAAC,EAAE,uBAAuB,CAAC;IACjC,sDAAsD;IACtD,iBAAiB,CAAC,EAAE,kCAAkC,CAAC;IAEvD,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,8DAA8D;IAC9D,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;;;;OAOG;IACH,SAAS,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAC3C;AA+BD;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,eAAe,EACf,aAAa,EACb,aAAa,EACb,MAAM,EACN,iBAAiB,EACjB,YAAY,EACZ,WAAsB,EACtB,WAAmB,EACnB,SAAS,EACT,gBAAgB,GACjB,EAAE,sBAAsB,+BAoJxB"}
1
+ {"version":3,"file":"consequence-dialog.d.ts","sourceRoot":"","sources":["../../../src/react/components/consequence-dialog.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,oCAAoC,CAAC;AAG5C,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,mBAAmB,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;CACxC;AAED,MAAM,WAAW,kCAAkC;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACzB;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAEvC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IAEvB,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAClC,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEhC,MAAM,CAAC,EAAE,uBAAuB,CAAC;IACjC,iBAAiB,CAAC,EAAE,kCAAkC,CAAC;IAEvD,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,SAAS,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtC,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAC3C;AA2BD,6GAA6G;AAC7G,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,eAAe,EACf,aAAa,EACb,aAAa,EACb,MAAM,EACN,iBAAiB,EACjB,YAAY,EACZ,WAAsB,EACtB,WAAmB,EACnB,SAAS,EACT,gBAAgB,GACjB,EAAE,sBAAsB,+BA6IxB"}
@@ -6,28 +6,14 @@ import { Button } from './button.js';
6
6
  import { Textarea } from './textarea.js';
7
7
  import { Input } from './input.js';
8
8
  import { Label } from './label.js';
9
- import { checkInputFormat, defineInputFormat } from '@ttt-productions/input-format-core';
9
+ import { checkInputFormat, defineInputFormat, } from '@ttt-productions/input-format-core';
10
10
  import { Zap, Clock, RotateCcw } from 'lucide-react';
11
11
  const SLOT_ICON_CLASS = 'icon-xs mt-0.5 shrink-0 text-muted-foreground';
12
- /**
13
- * One consequence slot: the icon beside a block column whose label sits on its own line above
14
- * the slot text. Every element is a block: the `stack-*` spacing is a vertical margin, which an
15
- * inline element ignores.
16
- */
12
+ /** Every element is a block: the `stack-*` spacing is a vertical margin, which an inline element ignores. */
17
13
  function ConsequenceRow({ icon: Icon, label, children, }) {
18
14
  return (_jsxs("div", { className: "flex items-start gap-2", children: [_jsx(Icon, { className: SLOT_ICON_CLASS, "aria-hidden": "true" }), _jsxs("div", { className: "stack-1 min-w-0", children: [_jsx("div", { className: "text-caption font-medium uppercase tracking-wide text-muted-foreground", children: label }), _jsx("div", { className: "text-small text-foreground", children: children })] })] }));
19
15
  }
20
- /**
21
- * A reusable confirm-before-a-consequential-action dialog. Three optional, consistently-styled
22
- * consequence slots (immediate / afterward / reversibility), an optional inline reason field,
23
- * and an optional exact-phrase typed-confirmation gate. Composes the ui-core AlertDialog primitives
24
- * (Radix) — it never re-implements them. Supports BOTH a `trigger` (uncontrolled) and `open` /
25
- * `onOpenChange` (controlled).
26
- *
27
- * Pending model: the confirm button is a plain `Button` (NOT `AlertDialogAction`), so Radix does not
28
- * auto-close on click; open state is managed here so the dialog stays open with a visible spinner
29
- * until `onConfirm` resolves.
30
- */
16
+ /** The confirm is a plain `Button`, not `AlertDialogAction`, so Radix does not close the dialog on click. */
31
17
  export function ConsequenceDialog({ trigger, open, onOpenChange, title, immediateEffect, delayedEffect, reversibility, reason, typedConfirmation, confirmLabel, cancelLabel = 'Cancel', destructive = false, onConfirm, onCloseAutoFocus, }) {
32
18
  const isControlled = open !== undefined;
33
19
  const [internalOpen, setInternalOpen] = useState(false);
@@ -43,11 +29,10 @@ export function ConsequenceDialog({ trigger, open, onOpenChange, title, immediat
43
29
  else
44
30
  setInternalOpen(next);
45
31
  }, [isControlled, onOpenChange]);
46
- // Never allow an open-state change (Escape, cancel, controlled parent) to fight the pending action.
47
32
  const handleOpenChange = useCallback((next) => {
48
33
  if (pending)
49
34
  return;
50
- setTypedValue(''); // reset the typed gate on every open/close
35
+ setTypedValue('');
51
36
  setOpenState(next);
52
37
  }, [pending, setOpenState]);
53
38
  const handleConfirm = useCallback(async () => {
@@ -60,8 +45,6 @@ export function ConsequenceDialog({ trigger, open, onOpenChange, title, immediat
60
45
  setOpenState(false);
61
46
  }
62
47
  catch {
63
- // Keep the dialog open — the caller's onConfirm surfaced the error (toast / step-up). The
64
- // operator can retry or cancel. Never rethrow, never monitor here.
65
48
  }
66
49
  finally {
67
50
  setPending(false);
@@ -69,9 +52,10 @@ export function ConsequenceDialog({ trigger, open, onOpenChange, title, immediat
69
52
  }, [pending, onConfirm, setOpenState]);
70
53
  const reasonOk = !reason || checkInputFormat(reason.value, reason.inputFormat).ok;
71
54
  const typedOk = !typedConfirmation ? true : typedValue === typedConfirmation.phrase;
72
- // The phrase is one line, and nothing longer than it can ever match it.
73
55
  const phrase = typedConfirmation?.phrase ?? '';
74
- const typedFormat = useMemo(() => (phrase.length > 0 ? defineInputFormat({ format: 'singleLine', min: 1, max: phrase.length }) : null), [phrase]);
56
+ const typedFormat = useMemo(() => phrase.length > 0
57
+ ? defineInputFormat({ format: 'singleLine', min: 1, max: phrase.length })
58
+ : null, [phrase]);
75
59
  return (_jsxs(AlertDialog, { open: actualOpen, onOpenChange: handleOpenChange, children: [trigger ? _jsx(AlertDialogTrigger, { asChild: true, children: trigger }) : null, _jsxs(AlertDialogContent, { onEscapeKeyDown: (e) => {
76
60
  if (pending)
77
61
  e.preventDefault();
@@ -1 +1 @@
1
- {"version":3,"file":"consequence-dialog.js","sourceRoot":"","sources":["../../../src/react/components/consequence-dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,M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AAI,CAC1B,uCACO,eAAM,SAAS,EAAC,WAAW,YAAE,iBAAiB,CAAC,MAAM,GAAQ,mBACjE,CACJ,GACK,EACR,KAAC,KAAK,IACJ,EAAE,EAAE,OAAO,EACX,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAC9C,WAAW,EAAE,iBAAiB,CAAC,MAAM,EACrC,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,OAAO,EACjB,YAAY,EAAC,KAAK,GAClB,IACE,CACP,CAAC,CAAC,CAAC,IAAI,EAER,MAAC,iBAAiB,eAChB,KAAC,MAAM,IACL,OAAO,EAAC,SAAS,EACjB,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,EACtC,QAAQ,EAAE,OAAO,YAEhB,WAAW,GACL,EACT,KAAC,MAAM,IACL,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,EAChD,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,CAAC,QAAQ,IAAI,CAAC,OAAO,EAC/B,OAAO,EAAE,OAAO,YAEf,YAAY,GACN,IACS,IACD,IACT,CACf,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport { useCallback, useId, useMemo, useState } from 'react';\nimport {\n AlertDialog,\n AlertDialogTrigger,\n AlertDialogContent,\n AlertDialogHeader,\n AlertDialogFooter,\n AlertDialogTitle,\n AlertDialogDescription,\n} from './alert-dialog.js';\nimport { Button } from './button.js';\nimport { Textarea } from './textarea.js';\nimport { Input } from './input.js';\nimport { Label } from './label.js';\nimport { checkInputFormat, defineInputFormat, type DeclaredInputFormat } from '@ttt-productions/input-format-core';\nimport { Zap, Clock, RotateCcw } from 'lucide-react';\n\n/**\n * The inline reason field. The caller OWNS the reason value/onChange (draft state lives at the call\n * site) and the field's declaration — this component declares no business numbers and no copy.\n * Confirm stays disabled until the value passes the declaration's check; `min: 0` makes the reason\n * optional.\n */\nexport interface ConsequenceDialogReason {\n inputFormat: DeclaredInputFormat;\n placeholder?: string;\n label?: React.ReactNode;\n value: string;\n onChange: (value: string) => void;\n rows?: number;\n /**\n * A line rendered directly under the reason box, such as why its current text is refused. It is\n * called with the id the box names in its `aria-describedby`, and the element it renders carries\n * that id. The caller owns the words; this component adds none.\n */\n hint?: (id: string) => React.ReactNode;\n}\n\n/**\n * The exact-match typed-confirmation gate. `phrase` is business copy owned by the CALLER; the\n * component only compares the typed value against it.\n */\nexport interface ConsequenceDialogTypedConfirmation {\n phrase: string;\n label?: React.ReactNode;\n}\n\nexport interface ConsequenceDialogProps {\n /** Uncontrolled open model: the element that opens the dialog (rendered `asChild`). */\n trigger?: React.ReactNode;\n /** Controlled open model. Provide with `onOpenChange`. */\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n\n /** Heading — a string or node so callers can interpolate amounts / names. */\n title: React.ReactNode;\n\n /** SLOT 1 — what happens right now (e.g. \"initiates a Stripe refund of $X now\"). */\n immediateEffect?: React.ReactNode;\n /** SLOT 2 — what settles later, out of band (webhook / worker / async confirmation). */\n delayedEffect?: React.ReactNode;\n /** SLOT 3 — whether/how this can be undone or superseded. */\n reversibility?: React.ReactNode;\n\n /** Inline reason field. Optional. */\n reason?: ConsequenceDialogReason;\n /** Exact-phrase typed-confirmation gate. Optional. */\n typedConfirmation?: ConsequenceDialogTypedConfirmation;\n\n confirmLabel: React.ReactNode;\n cancelLabel?: React.ReactNode;\n /** `true` styles the confirm button with `bg-destructive`. */\n destructive?: boolean;\n\n /**\n * Runs on confirm. May be async — while it is pending the dialog STAYS OPEN: the confirm button\n * is `aria-disabled`, keeps focus, ignores further presses, and shows its pending spinner, and\n * only Cancel is natively disabled. Closes on resolve. If it rejects the dialog\n * stays open so the caller's own surface (error toast, TOTP step-up) can show and the operator can\n * retry or cancel. This component takes no Sentry/monitoring dependency — every error path\n * belongs to the caller's `onConfirm`.\n */\n onConfirm: () => void | Promise<void>;\n\n /**\n * Runs as the dialog closes, before Radix returns focus to the control that opened it. A confirmed\n * action that removes that control moves focus to its own destination here and calls\n * `event.preventDefault()`, so the restore does not pull focus back onto a control about to go.\n */\n onCloseAutoFocus?: (event: Event) => void;\n}\n\nconst SLOT_ICON_CLASS = 'icon-xs mt-0.5 shrink-0 text-muted-foreground';\n\n/**\n * One consequence slot: the icon beside a block column whose label sits on its own line above\n * the slot text. Every element is a block: the `stack-*` spacing is a vertical margin, which an\n * inline element ignores.\n */\nfunction ConsequenceRow({\n icon: Icon,\n label,\n children,\n}: {\n icon: typeof Zap;\n label: string;\n children: React.ReactNode;\n}) {\n return (\n <div className=\"flex items-start gap-2\">\n <Icon className={SLOT_ICON_CLASS} aria-hidden=\"true\" />\n <div className=\"stack-1 min-w-0\">\n <div className=\"text-caption font-medium uppercase tracking-wide text-muted-foreground\">\n {label}\n </div>\n <div className=\"text-small text-foreground\">{children}</div>\n </div>\n </div>\n );\n}\n\n/**\n * A reusable confirm-before-a-consequential-action dialog. Three optional, consistently-styled\n * consequence slots (immediate / afterward / reversibility), an optional inline reason field,\n * and an optional exact-phrase typed-confirmation gate. Composes the ui-core AlertDialog primitives\n * (Radix) — it never re-implements them. Supports BOTH a `trigger` (uncontrolled) and `open` /\n * `onOpenChange` (controlled).\n *\n * Pending model: the confirm button is a plain `Button` (NOT `AlertDialogAction`), so Radix does not\n * auto-close on click; open state is managed here so the dialog stays open with a visible spinner\n * until `onConfirm` resolves.\n */\nexport function ConsequenceDialog({\n trigger,\n open,\n onOpenChange,\n title,\n immediateEffect,\n delayedEffect,\n reversibility,\n reason,\n typedConfirmation,\n confirmLabel,\n cancelLabel = 'Cancel',\n destructive = false,\n onConfirm,\n onCloseAutoFocus,\n}: ConsequenceDialogProps) {\n const isControlled = open !== undefined;\n const [internalOpen, setInternalOpen] = useState(false);\n const [typedValue, setTypedValue] = useState('');\n const [pending, setPending] = useState(false);\n\n const actualOpen = isControlled ? open : internalOpen;\n\n const reasonId = useId();\n const reasonHintId = useId();\n const typedId = useId();\n\n const setOpenState = useCallback(\n (next: boolean) => {\n if (isControlled) onOpenChange?.(next);\n else setInternalOpen(next);\n },\n [isControlled, onOpenChange],\n );\n\n // Never allow an open-state change (Escape, cancel, controlled parent) to fight the pending action.\n const handleOpenChange = useCallback(\n (next: boolean) => {\n if (pending) return;\n setTypedValue(''); // reset the typed gate on every open/close\n setOpenState(next);\n },\n [pending, setOpenState],\n );\n\n const handleConfirm = useCallback(async () => {\n if (pending) return;\n setPending(true);\n try {\n await onConfirm();\n setTypedValue('');\n setOpenState(false);\n } catch {\n // Keep the dialog open — the caller's onConfirm surfaced the error (toast / step-up). The\n // operator can retry or cancel. Never rethrow, never monitor here.\n } finally {\n setPending(false);\n }\n }, [pending, onConfirm, setOpenState]);\n\n const reasonOk = !reason || checkInputFormat(reason.value, reason.inputFormat).ok;\n\n const typedOk = !typedConfirmation ? true : typedValue === typedConfirmation.phrase;\n // The phrase is one line, and nothing longer than it can ever match it.\n const phrase = typedConfirmation?.phrase ?? '';\n const typedFormat = useMemo(\n () => (phrase.length > 0 ? defineInputFormat({ format: 'singleLine', min: 1, max: phrase.length }) : null),\n [phrase],\n );\n\n return (\n <AlertDialog open={actualOpen} onOpenChange={handleOpenChange}>\n {trigger ? <AlertDialogTrigger asChild>{trigger}</AlertDialogTrigger> : null}\n <AlertDialogContent\n onEscapeKeyDown={(e) => {\n if (pending) e.preventDefault();\n }}\n onCloseAutoFocus={onCloseAutoFocus}\n >\n <AlertDialogHeader>\n <AlertDialogTitle>{title}</AlertDialogTitle>\n {/* A div, not the primitive's default <p>: the rows are blocks, which a <p> cannot hold.\n Left-aligned at every width — the header centres its text on narrow screens, and a\n wrapped consequence line reads as a list, not a caption. */}\n <AlertDialogDescription asChild>\n <div className=\"stack-3 text-left\">\n {immediateEffect ? (\n <ConsequenceRow icon={Zap} label=\"Immediately\">\n {immediateEffect}\n </ConsequenceRow>\n ) : null}\n {delayedEffect ? (\n <ConsequenceRow icon={Clock} label=\"Afterward\">\n {delayedEffect}\n </ConsequenceRow>\n ) : null}\n {reversibility ? (\n <ConsequenceRow icon={RotateCcw} label=\"Reversibility\">\n {reversibility}\n </ConsequenceRow>\n ) : null}\n </div>\n </AlertDialogDescription>\n </AlertDialogHeader>\n\n {reason ? (\n <div className=\"stack-2\">\n <Label htmlFor={reasonId}>{reason.label ?? 'Reason'}</Label>\n <Textarea\n id={reasonId}\n value={reason.value}\n onChange={(e) => reason.onChange(e.target.value)}\n placeholder={reason.placeholder}\n inputFormat={reason.inputFormat}\n rows={reason.rows ?? 3}\n disabled={pending}\n aria-describedby={reason.hint ? reasonHintId : undefined}\n />\n {reason.hint ? reason.hint(reasonHintId) : null}\n </div>\n ) : null}\n\n {typedConfirmation && typedFormat ? (\n <div className=\"stack-2\">\n <Label htmlFor={typedId}>\n {typedConfirmation.label ?? (\n <>\n Type <span className=\"font-mono\">{typedConfirmation.phrase}</span> to confirm\n </>\n )}\n </Label>\n <Input\n id={typedId}\n value={typedValue}\n onChange={(e) => setTypedValue(e.target.value)}\n placeholder={typedConfirmation.phrase}\n inputFormat={typedFormat}\n disabled={pending}\n autoComplete=\"off\"\n />\n </div>\n ) : null}\n\n <AlertDialogFooter>\n <Button\n variant=\"outline\"\n onClick={() => handleOpenChange(false)}\n disabled={pending}\n >\n {cancelLabel}\n </Button>\n <Button\n variant={destructive ? 'destructive' : 'default'}\n onClick={handleConfirm}\n disabled={!reasonOk || !typedOk}\n pending={pending}\n >\n {confirmLabel}\n </Button>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n );\n}\n"]}
1
+ {"version":3,"file":"consequence-dialog.js","sourceRoot":"","sources":["../../../src/react/components/consequence-dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,EACL,WAAW,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,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAC9C,WAAW,EAAE,iBAAiB,CAAC,MAAM,EACrC,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,OAAO,EACjB,YAAY,EAAC,KAAK,GAClB,IACE,CACP,CAAC,CAAC,CAAC,IAAI,EAER,MAAC,iBAAiB,eAChB,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,OAAO,YAChF,WAAW,GACL,EACT,KAAC,MAAM,IACL,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,EAChD,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,CAAC,QAAQ,IAAI,CAAC,OAAO,EAC/B,OAAO,EAAE,OAAO,YAEf,YAAY,GACN,IACS,IACD,IACT,CACf,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport { useCallback, useId, useMemo, useState } from 'react';\nimport {\n AlertDialog,\n AlertDialogTrigger,\n AlertDialogContent,\n AlertDialogHeader,\n AlertDialogFooter,\n AlertDialogTitle,\n AlertDialogDescription,\n} from './alert-dialog.js';\nimport { Button } from './button.js';\nimport { Textarea } from './textarea.js';\nimport { Input } from './input.js';\nimport { Label } from './label.js';\nimport {\n checkInputFormat,\n defineInputFormat,\n type DeclaredInputFormat,\n} from '@ttt-productions/input-format-core';\nimport { Zap, Clock, RotateCcw } from 'lucide-react';\n\nexport interface ConsequenceDialogReason {\n inputFormat: DeclaredInputFormat;\n placeholder?: string;\n label?: React.ReactNode;\n value: string;\n onChange: (value: string) => void;\n rows?: number;\n hint?: (id: string) => React.ReactNode;\n}\n\nexport interface ConsequenceDialogTypedConfirmation {\n phrase: string;\n label?: React.ReactNode;\n}\n\nexport interface ConsequenceDialogProps {\n trigger?: React.ReactNode;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n\n title: React.ReactNode;\n\n immediateEffect?: React.ReactNode;\n delayedEffect?: React.ReactNode;\n reversibility?: React.ReactNode;\n\n reason?: ConsequenceDialogReason;\n typedConfirmation?: ConsequenceDialogTypedConfirmation;\n\n confirmLabel: React.ReactNode;\n cancelLabel?: React.ReactNode;\n destructive?: boolean;\n\n onConfirm: () => void | Promise<void>;\n\n onCloseAutoFocus?: (event: Event) => void;\n}\n\nconst SLOT_ICON_CLASS = 'icon-xs mt-0.5 shrink-0 text-muted-foreground';\n\n/** Every element is a block: the `stack-*` spacing is a vertical margin, which an inline element ignores. */\nfunction ConsequenceRow({\n icon: Icon,\n label,\n children,\n}: {\n icon: typeof Zap;\n label: string;\n children: React.ReactNode;\n}) {\n return (\n <div className=\"flex items-start gap-2\">\n <Icon className={SLOT_ICON_CLASS} aria-hidden=\"true\" />\n <div className=\"stack-1 min-w-0\">\n <div className=\"text-caption font-medium uppercase tracking-wide text-muted-foreground\">\n {label}\n </div>\n <div className=\"text-small text-foreground\">{children}</div>\n </div>\n </div>\n );\n}\n\n/** The confirm is a plain `Button`, not `AlertDialogAction`, so Radix does not close the dialog on click. */\nexport function ConsequenceDialog({\n trigger,\n open,\n onOpenChange,\n title,\n immediateEffect,\n delayedEffect,\n reversibility,\n reason,\n typedConfirmation,\n confirmLabel,\n cancelLabel = 'Cancel',\n destructive = false,\n onConfirm,\n onCloseAutoFocus,\n}: ConsequenceDialogProps) {\n const isControlled = open !== undefined;\n const [internalOpen, setInternalOpen] = useState(false);\n const [typedValue, setTypedValue] = useState('');\n const [pending, setPending] = useState(false);\n\n const actualOpen = isControlled ? open : internalOpen;\n\n const reasonId = useId();\n const reasonHintId = useId();\n const typedId = useId();\n\n const setOpenState = useCallback(\n (next: boolean) => {\n if (isControlled) onOpenChange?.(next);\n else setInternalOpen(next);\n },\n [isControlled, onOpenChange],\n );\n\n const handleOpenChange = useCallback(\n (next: boolean) => {\n if (pending) return;\n setTypedValue('');\n setOpenState(next);\n },\n [pending, setOpenState],\n );\n\n const handleConfirm = useCallback(async () => {\n if (pending) return;\n setPending(true);\n try {\n await onConfirm();\n setTypedValue('');\n setOpenState(false);\n } catch {\n } finally {\n setPending(false);\n }\n }, [pending, onConfirm, setOpenState]);\n\n const reasonOk = !reason || checkInputFormat(reason.value, reason.inputFormat).ok;\n\n const typedOk = !typedConfirmation ? true : typedValue === typedConfirmation.phrase;\n const phrase = typedConfirmation?.phrase ?? '';\n const typedFormat = useMemo(\n () =>\n phrase.length > 0\n ? defineInputFormat({ format: 'singleLine', min: 1, max: phrase.length })\n : null,\n [phrase],\n );\n\n return (\n <AlertDialog open={actualOpen} onOpenChange={handleOpenChange}>\n {trigger ? <AlertDialogTrigger asChild>{trigger}</AlertDialogTrigger> : null}\n <AlertDialogContent\n onEscapeKeyDown={(e) => {\n if (pending) e.preventDefault();\n }}\n onCloseAutoFocus={onCloseAutoFocus}\n >\n <AlertDialogHeader>\n <AlertDialogTitle>{title}</AlertDialogTitle>\n {/* A div, not the primitive's default <p>: the rows are blocks, which a <p> cannot hold. */}\n <AlertDialogDescription asChild>\n <div className=\"stack-3 text-left\">\n {immediateEffect ? (\n <ConsequenceRow icon={Zap} label=\"Immediately\">\n {immediateEffect}\n </ConsequenceRow>\n ) : null}\n {delayedEffect ? (\n <ConsequenceRow icon={Clock} label=\"Afterward\">\n {delayedEffect}\n </ConsequenceRow>\n ) : null}\n {reversibility ? (\n <ConsequenceRow icon={RotateCcw} label=\"Reversibility\">\n {reversibility}\n </ConsequenceRow>\n ) : null}\n </div>\n </AlertDialogDescription>\n </AlertDialogHeader>\n\n {reason ? (\n <div className=\"stack-2\">\n <Label htmlFor={reasonId}>{reason.label ?? 'Reason'}</Label>\n <Textarea\n id={reasonId}\n value={reason.value}\n onChange={(e) => reason.onChange(e.target.value)}\n placeholder={reason.placeholder}\n inputFormat={reason.inputFormat}\n rows={reason.rows ?? 3}\n disabled={pending}\n aria-describedby={reason.hint ? reasonHintId : undefined}\n />\n {reason.hint ? reason.hint(reasonHintId) : null}\n </div>\n ) : null}\n\n {typedConfirmation && typedFormat ? (\n <div className=\"stack-2\">\n <Label htmlFor={typedId}>\n {typedConfirmation.label ?? (\n <>\n Type <span className=\"font-mono\">{typedConfirmation.phrase}</span> to confirm\n </>\n )}\n </Label>\n <Input\n id={typedId}\n value={typedValue}\n onChange={(e) => setTypedValue(e.target.value)}\n placeholder={typedConfirmation.phrase}\n inputFormat={typedFormat}\n disabled={pending}\n autoComplete=\"off\"\n />\n </div>\n ) : null}\n\n <AlertDialogFooter>\n <Button variant=\"outline\" onClick={() => handleOpenChange(false)} disabled={pending}>\n {cancelLabel}\n </Button>\n <Button\n variant={destructive ? 'destructive' : 'default'}\n onClick={handleConfirm}\n disabled={!reasonOk || !typedOk}\n pending={pending}\n >\n {confirmLabel}\n </Button>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n );\n}\n"]}
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  export interface DatePickerProps {
3
3
  selected?: Date;
4
4
  onSelect?: (date: Date | undefined) => void;
@@ -7,23 +7,6 @@ export interface DatePickerProps {
7
7
  disableFuture?: boolean;
8
8
  className?: string;
9
9
  }
10
- /**
11
- * Generic date-of-birth-friendly calendar.
12
- *
13
- * Stable footprint: the six-row day grid is always rendered, so the outer width
14
- * and content height never change; the month and year choosers render as an
15
- * overlay ON TOP of that grid rather than replacing it, so a Radix popover never
16
- * flips sides just because the internal view changed.
17
- *
18
- * Month and year are INDEPENDENT pickers: choosing a month keeps the current
19
- * year and returns to the day grid; choosing a year keeps the current month and
20
- * returns DIRECTLY to the day grid (it never opens the month grid). Only
21
- * choosing a day calls `onSelect` (which commits and, in a popover, closes).
22
- *
23
- * Keyboard: roving day focus with Arrow (±1 day / ±7 days), Home/End (within the
24
- * week), PageUp/PageDown (±1 month), and Enter/Space to select — no extra
25
- * dependency. Exactly one day sits in the tab order at a time.
26
- */
27
10
  declare function DatePicker({ selected, onSelect, disabled, disablePast, disableFuture, className, }: DatePickerProps): React.JSX.Element;
28
11
  declare namespace DatePicker {
29
12
  var displayName: string;
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../src/react/components/date-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,IAAI,CAAA;IACf,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,KAAK,IAAI,CAAA;IAC3C,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAA;IAClC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAqCD;;;;;;;;;;;;;;;;GAgBG;AACH,iBAAS,UAAU,CAAC,EAClB,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,WAAmB,EACnB,aAAqB,EACrB,SAAS,GACV,EAAE,eAAe,qBAuejB;kBA9eQ,UAAU;;;AAkfnB,OAAO,EAAE,UAAU,EAAE,CAAA"}
1
+ {"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../src/react/components/date-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,IAAI,CAAC;IAChB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,KAAK,IAAI,CAAC;IAC5C,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;IACnC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,C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