@leonardaustin/ui 0.25.0 → 0.26.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 (279) hide show
  1. package/README.md +11 -0
  2. package/dist/components/app-shell/AppShell.d.ts +3 -3
  3. package/dist/components/app-shell/AppShell.js +82 -0
  4. package/dist/components/app-shell/AuthLayout.d.ts +3 -3
  5. package/dist/components/app-shell/AuthLayout.js +16 -0
  6. package/dist/components/app-shell/BackLink.d.ts +3 -3
  7. package/dist/components/app-shell/BackLink.js +19 -0
  8. package/dist/components/app-shell/BottomNav.d.ts +3 -2
  9. package/dist/components/app-shell/BottomNav.js +37 -0
  10. package/dist/components/app-shell/Breadcrumbs.d.ts +3 -2
  11. package/dist/components/app-shell/Breadcrumbs.js +46 -0
  12. package/dist/components/app-shell/CommandPalette.d.ts +3 -2
  13. package/dist/components/app-shell/CommandPalette.js +119 -0
  14. package/dist/components/app-shell/MobileDrawer.d.ts +3 -3
  15. package/dist/components/app-shell/MobileDrawer.js +128 -0
  16. package/dist/components/app-shell/Sidebar.d.ts +3 -3
  17. package/dist/components/app-shell/Sidebar.js +355 -0
  18. package/dist/components/app-shell/ThemeMenu.d.ts +3 -2
  19. package/dist/components/app-shell/ThemeMenu.js +273 -0
  20. package/dist/components/app-shell/TopBar.d.ts +3 -3
  21. package/dist/components/app-shell/TopBar.js +129 -0
  22. package/dist/components/app-shell/commandPaletteEvents.js +16 -0
  23. package/dist/components/app-shell/navigation.js +21 -0
  24. package/dist/components/app-shell/themeMenuEvents.js +7 -0
  25. package/dist/components/charts/AreaChart.d.ts +4 -3
  26. package/dist/components/charts/AreaChart.js +217 -0
  27. package/dist/components/charts/BarChart.d.ts +4 -3
  28. package/dist/components/charts/BarChart.js +91 -0
  29. package/dist/components/charts/DonutChart.d.ts +4 -3
  30. package/dist/components/charts/DonutChart.js +172 -0
  31. package/dist/components/charts/RadarChart.d.ts +4 -3
  32. package/dist/components/charts/RadarChart.js +142 -0
  33. package/dist/components/charts/RadialBarChart.d.ts +4 -3
  34. package/dist/components/charts/RadialBarChart.js +219 -0
  35. package/dist/components/charts/SparkLine.d.ts +4 -3
  36. package/dist/components/charts/SparkLine.js +39 -0
  37. package/dist/components/charts/StackedBarChart.d.ts +4 -3
  38. package/dist/components/charts/StackedBarChart.js +249 -0
  39. package/dist/components/charts/VerticalBarChart.d.ts +4 -3
  40. package/dist/components/charts/VerticalBarChart.js +143 -0
  41. package/dist/components/charts/chartUtils.js +68 -0
  42. package/dist/components/tables/ColumnPicker.d.ts +3 -3
  43. package/dist/components/tables/ColumnPicker.js +59 -0
  44. package/dist/components/tables/Pagination.d.ts +3 -3
  45. package/dist/components/tables/Pagination.js +56 -0
  46. package/dist/components/tables/ResourceTable.d.ts +3 -3
  47. package/dist/components/tables/ResourceTable.js +88 -0
  48. package/dist/components/tables/Table.js +95 -0
  49. package/dist/components/tables/sortRows.js +11 -0
  50. package/dist/components/ui/Accordion.d.ts +2 -1
  51. package/dist/components/ui/Accordion.js +35 -0
  52. package/dist/components/ui/Alert.d.ts +3 -2
  53. package/dist/components/ui/Alert.js +51 -0
  54. package/dist/components/ui/AttachmentList.d.ts +5 -5
  55. package/dist/components/ui/AttachmentList.js +90 -0
  56. package/dist/components/ui/AudioPlayer.d.ts +5 -2
  57. package/dist/components/ui/AudioPlayer.js +447 -0
  58. package/dist/components/ui/AuthCard.d.ts +3 -3
  59. package/dist/components/ui/AuthCard.js +39 -0
  60. package/dist/components/ui/AuthorByline.d.ts +3 -3
  61. package/dist/components/ui/AuthorByline.js +23 -0
  62. package/dist/components/ui/Avatar.d.ts +3 -2
  63. package/dist/components/ui/Avatar.js +36 -0
  64. package/dist/components/ui/Badge.d.ts +3 -2
  65. package/dist/components/ui/Badge.js +47 -0
  66. package/dist/components/ui/Button.d.ts +3 -3
  67. package/dist/components/ui/Button.js +83 -0
  68. package/dist/components/ui/Calendar.d.ts +3 -3
  69. package/dist/components/ui/Calendar.js +344 -0
  70. package/dist/components/ui/CalendarGrid.d.ts +3 -2
  71. package/dist/components/ui/CalendarGrid.js +136 -0
  72. package/dist/components/ui/Card.d.ts +6 -5
  73. package/dist/components/ui/Card.js +53 -0
  74. package/dist/components/ui/CharacterCount.d.ts +3 -3
  75. package/dist/components/ui/CharacterCount.js +27 -0
  76. package/dist/components/ui/Checkbox.d.ts +10 -8
  77. package/dist/components/ui/Checkbox.js +52 -0
  78. package/dist/components/ui/CodeInput.d.ts +7 -4
  79. package/dist/components/ui/CodeInput.js +96 -0
  80. package/dist/components/ui/Combobox.d.ts +8 -6
  81. package/dist/components/ui/Combobox.js +213 -0
  82. package/dist/components/ui/CopyButton.d.ts +1 -1
  83. package/dist/components/ui/CopyButton.js +57 -0
  84. package/dist/components/ui/DangerZone.d.ts +3 -3
  85. package/dist/components/ui/DangerZone.js +23 -0
  86. package/dist/components/ui/DatePartsInput.d.ts +6 -4
  87. package/dist/components/ui/DatePartsInput.js +138 -0
  88. package/dist/components/ui/DatePicker.d.ts +9 -4
  89. package/dist/components/ui/DatePicker.js +84 -0
  90. package/dist/components/ui/DateRangePicker.d.ts +7 -4
  91. package/dist/components/ui/DateRangePicker.js +143 -0
  92. package/dist/components/ui/DateTimePicker.d.ts +7 -4
  93. package/dist/components/ui/DateTimePicker.js +267 -0
  94. package/dist/components/ui/DetailPanel.d.ts +3 -3
  95. package/dist/components/ui/DetailPanel.js +183 -0
  96. package/dist/components/ui/Dialog.d.ts +3 -3
  97. package/dist/components/ui/Dialog.js +411 -0
  98. package/dist/components/ui/DialogActions.d.ts +3 -3
  99. package/dist/components/ui/DialogActions.js +35 -0
  100. package/dist/components/ui/Disclosure.d.ts +3 -3
  101. package/dist/components/ui/Disclosure.js +45 -0
  102. package/dist/components/ui/DividerLabel.d.ts +3 -3
  103. package/dist/components/ui/DividerLabel.js +20 -0
  104. package/dist/components/ui/DropdownMenu.d.ts +3 -3
  105. package/dist/components/ui/DropdownMenu.js +229 -0
  106. package/dist/components/ui/EmptyState.d.ts +3 -3
  107. package/dist/components/ui/EmptyState.js +31 -0
  108. package/dist/components/ui/ErrorBoundary.js +46 -0
  109. package/dist/components/ui/FieldContext.js +8 -0
  110. package/dist/components/ui/Fieldset.d.ts +2 -2
  111. package/dist/components/ui/Fieldset.js +39 -0
  112. package/dist/components/ui/FilterButton.d.ts +4 -7
  113. package/dist/components/ui/FilterButton.js +17 -0
  114. package/dist/components/ui/FilterDropdown.d.ts +4 -4
  115. package/dist/components/ui/FilterDropdown.js +18 -0
  116. package/dist/components/ui/FormField.d.ts +4 -4
  117. package/dist/components/ui/FormField.js +68 -0
  118. package/dist/components/ui/Grid.d.ts +1 -1
  119. package/dist/components/ui/Grid.js +19 -0
  120. package/dist/components/ui/GridItem.d.ts +1 -1
  121. package/dist/components/ui/GridItem.js +16 -0
  122. package/dist/components/ui/Inline.d.ts +1 -1
  123. package/dist/components/ui/Inline.js +24 -0
  124. package/dist/components/ui/Kbd.d.ts +3 -2
  125. package/dist/components/ui/Kbd.js +13 -0
  126. package/dist/components/ui/ListItemLink.d.ts +3 -3
  127. package/dist/components/ui/ListItemLink.js +44 -0
  128. package/dist/components/ui/LoadingSpinner.d.ts +3 -2
  129. package/dist/components/ui/LoadingSpinner.js +19 -0
  130. package/dist/components/ui/MessageBubble.d.ts +2 -2
  131. package/dist/components/ui/MessageBubble.js +41 -0
  132. package/dist/components/ui/MetadataGrid.d.ts +5 -3
  133. package/dist/components/ui/MetadataGrid.js +76 -0
  134. package/dist/components/ui/MetricCard.d.ts +3 -3
  135. package/dist/components/ui/MetricCard.js +51 -0
  136. package/dist/components/ui/NavTabs.d.ts +2 -2
  137. package/dist/components/ui/NavTabs.js +29 -0
  138. package/dist/components/ui/OAuthButton.d.ts +2 -2
  139. package/dist/components/ui/OAuthButton.js +55 -0
  140. package/dist/components/ui/OverlineLabel.d.ts +3 -3
  141. package/dist/components/ui/OverlineLabel.js +13 -0
  142. package/dist/components/ui/PageHeader.d.ts +3 -3
  143. package/dist/components/ui/PageHeader.js +33 -0
  144. package/dist/components/ui/PageSection.d.ts +3 -3
  145. package/dist/components/ui/PageSection.js +31 -0
  146. package/dist/components/ui/PaginationBar.d.ts +3 -3
  147. package/dist/components/ui/PaginationBar.js +62 -0
  148. package/dist/components/ui/PasswordInput.d.ts +3 -3
  149. package/dist/components/ui/PasswordInput.js +62 -0
  150. package/dist/components/ui/PasswordRequirements.d.ts +3 -2
  151. package/dist/components/ui/PasswordRequirements.js +34 -0
  152. package/dist/components/ui/Popover.d.ts +3 -3
  153. package/dist/components/ui/Popover.js +53 -0
  154. package/dist/components/ui/ProfileHeader.d.ts +3 -3
  155. package/dist/components/ui/ProfileHeader.js +54 -0
  156. package/dist/components/ui/ProgressBar.d.ts +3 -3
  157. package/dist/components/ui/ProgressBar.js +42 -0
  158. package/dist/components/ui/ProseContent.d.ts +3 -3
  159. package/dist/components/ui/ProseContent.js +13 -0
  160. package/dist/components/ui/QrCode.d.ts +3 -3
  161. package/dist/components/ui/QrCode.js +47 -0
  162. package/dist/components/ui/Radio.d.ts +9 -6
  163. package/dist/components/ui/Radio.js +58 -0
  164. package/dist/components/ui/RadioPill.d.ts +7 -4
  165. package/dist/components/ui/RadioPill.js +53 -0
  166. package/dist/components/ui/ReorderList.d.ts +3 -3
  167. package/dist/components/ui/ReorderList.js +123 -0
  168. package/dist/components/ui/SearchInput.d.ts +7 -5
  169. package/dist/components/ui/SearchInput.js +49 -0
  170. package/dist/components/ui/SectionHeader.d.ts +3 -3
  171. package/dist/components/ui/SectionHeader.js +13 -0
  172. package/dist/components/ui/Select.d.ts +4 -4
  173. package/dist/components/ui/Select.js +117 -0
  174. package/dist/components/ui/SelectDropdown.d.ts +8 -3
  175. package/dist/components/ui/SelectDropdown.js +206 -0
  176. package/dist/components/ui/SettingRow.d.ts +5 -5
  177. package/dist/components/ui/SettingRow.js +25 -0
  178. package/dist/components/ui/SideSheet.d.ts +3 -3
  179. package/dist/components/ui/SideSheet.js +164 -0
  180. package/dist/components/ui/Skeleton.d.ts +3 -3
  181. package/dist/components/ui/Skeleton.js +18 -0
  182. package/dist/components/ui/Slider.d.ts +11 -6
  183. package/dist/components/ui/Slider.js +58 -0
  184. package/dist/components/ui/SplitPaneLayout.d.ts +5 -5
  185. package/dist/components/ui/SplitPaneLayout.js +22 -0
  186. package/dist/components/ui/Stack.d.ts +1 -1
  187. package/dist/components/ui/Stack.js +18 -0
  188. package/dist/components/ui/StatusDot.d.ts +3 -2
  189. package/dist/components/ui/StatusDot.js +24 -0
  190. package/dist/components/ui/StepProgress.d.ts +3 -2
  191. package/dist/components/ui/StepProgress.js +33 -0
  192. package/dist/components/ui/Tabs.d.ts +5 -5
  193. package/dist/components/ui/Tabs.js +63 -0
  194. package/dist/components/ui/TextInput.d.ts +3 -3
  195. package/dist/components/ui/TextInput.js +57 -0
  196. package/dist/components/ui/Textarea.d.ts +3 -3
  197. package/dist/components/ui/Textarea.js +59 -0
  198. package/dist/components/ui/ThemePreview.d.ts +3 -3
  199. package/dist/components/ui/ThemePreview.js +28 -0
  200. package/dist/components/ui/TimeInput.d.ts +7 -6
  201. package/dist/components/ui/TimeInput.js +22 -0
  202. package/dist/components/ui/Timeline.d.ts +3 -2
  203. package/dist/components/ui/Timeline.js +29 -0
  204. package/dist/components/ui/Toast.js +121 -0
  205. package/dist/components/ui/Toggle.d.ts +5 -3
  206. package/dist/components/ui/Toggle.js +34 -0
  207. package/dist/components/ui/Toolbar.d.ts +3 -3
  208. package/dist/components/ui/Toolbar.js +70 -0
  209. package/dist/components/ui/Tooltip.js +91 -0
  210. package/dist/components/ui/TranscriptLine.d.ts +3 -3
  211. package/dist/components/ui/TranscriptLine.js +40 -0
  212. package/dist/components/ui/UploadDropzone.d.ts +3 -5
  213. package/dist/components/ui/UploadDropzone.js +55 -0
  214. package/dist/components/ui/badgeColors.js +5 -0
  215. package/dist/components/ui/calendar/AgendaView.js +140 -0
  216. package/dist/components/ui/calendar/MonthView.js +321 -0
  217. package/dist/components/ui/calendar/TimeGrid.js +501 -0
  218. package/dist/components/ui/calendar/TimelineView.js +311 -0
  219. package/dist/components/ui/calendar/context.js +10 -0
  220. package/dist/components/ui/calendar/items.js +152 -0
  221. package/dist/components/ui/calendar/types.js +38 -0
  222. package/dist/components/ui/calendar/useGridInteraction.js +393 -0
  223. package/dist/components/ui/useFieldControl.d.ts +1 -1
  224. package/dist/components/ui/useFieldControl.js +17 -0
  225. package/dist/config/theme.js +219 -0
  226. package/dist/core.css +2933 -0
  227. package/dist/hooks/useAnchoredPopup.js +162 -0
  228. package/dist/hooks/useApplyTheme.js +16 -0
  229. package/dist/hooks/useControllableState.d.ts +14 -0
  230. package/dist/hooks/useControllableState.js +10 -0
  231. package/dist/hooks/useDismiss.js +24 -0
  232. package/dist/hooks/useFocusTrap.js +42 -0
  233. package/dist/hooks/useOverlayStack.js +23 -0
  234. package/dist/hooks/usePopover.js +47 -0
  235. package/dist/hooks/usePortalContainer.js +14 -0
  236. package/dist/hooks/useSettings.js +8 -0
  237. package/dist/hooks/useTheme.js +8 -0
  238. package/dist/hooks/useTypeahead.js +19 -0
  239. package/dist/index.js +133 -12884
  240. package/dist/lib/anchorPlacement.js +75 -0
  241. package/dist/lib/calendar.js +666 -0
  242. package/dist/lib/cn.js +228 -0
  243. package/dist/lib/codeInput.js +51 -0
  244. package/dist/lib/dateParts.js +31 -0
  245. package/dist/lib/dialogDrag.js +45 -0
  246. package/dist/lib/dialogResize.js +47 -0
  247. package/dist/lib/formatDate.js +29 -0
  248. package/dist/lib/formatMediaTime.js +7 -0
  249. package/dist/lib/layout.js +29 -0
  250. package/dist/lib/math.js +6 -0
  251. package/dist/lib/mergeRefs.d.ts +6 -0
  252. package/dist/lib/mergeRefs.js +17 -0
  253. package/dist/lib/months.js +30 -0
  254. package/dist/lib/overlayStack.js +47 -0
  255. package/dist/lib/panelResize.js +8 -0
  256. package/dist/lib/passwordRequirements.js +23 -0
  257. package/dist/lib/qrCode.js +570 -0
  258. package/dist/lib/tones.js +104 -0
  259. package/dist/lib/typeahead.js +31 -0
  260. package/dist/providers/ControlSizeContext.js +9 -0
  261. package/dist/providers/ControlSizeProvider.js +11 -0
  262. package/dist/providers/SettingsContext.js +53 -0
  263. package/dist/providers/SettingsProvider.js +249 -0
  264. package/dist/providers/ThemeContext.js +5 -0
  265. package/dist/providers/ThemeProvider.js +17 -0
  266. package/dist/providers/accentColors.js +75 -0
  267. package/dist/providers/themeClasses.d.ts +1 -0
  268. package/dist/providers/themeClasses.js +20 -0
  269. package/dist/styles.css +228 -176
  270. package/dist/themes/cyber-brutal-dark.css +53 -0
  271. package/dist/themes/cyber-brutal-light.css +75 -0
  272. package/dist/themes/glass-dark.css +217 -0
  273. package/dist/themes/glass-light.css +215 -0
  274. package/dist/themes/hashi.css +66 -0
  275. package/dist/themes/light-inverted.css +32 -0
  276. package/dist/themes/light.css +1 -0
  277. package/dist/themes/monokai.css +51 -0
  278. package/dist/themes/solarized.css +55 -0
  279. package/package.json +3 -1
@@ -1,5 +1,5 @@
1
- import { type HTMLAttributes } from "react";
2
- export interface CharacterCountProps extends HTMLAttributes<HTMLParagraphElement> {
1
+ import { type ComponentPropsWithRef } from "react";
2
+ export interface CharacterCountProps extends ComponentPropsWithRef<"p"> {
3
3
  /** Current text; its length is counted. */
4
4
  value: string;
5
5
  /** Character limit; the count turns red when exceeded. */
@@ -8,4 +8,4 @@ export interface CharacterCountProps extends HTMLAttributes<HTMLParagraphElement
8
8
  announcementDelay?: number;
9
9
  }
10
10
  /** Counts UTF-16 code units, matching native input/textarea maxLength. */
11
- export declare function CharacterCount({ value, maxLength, announcementDelay, className, ...props }: CharacterCountProps): import("react/jsx-runtime").JSX.Element;
11
+ export declare function CharacterCount({ value, maxLength, announcementDelay, className, ref, ...props }: CharacterCountProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,27 @@
1
+ import { cn as e } from "../../lib/cn.js";
2
+ import { useEffect as t, useState as n } from "react";
3
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
4
+ //#region src/components/ui/CharacterCount.tsx
5
+ function a({ value: a, maxLength: o, announcementDelay: s = 1e3, className: c, ref: l, ...u }) {
6
+ let d = o - a.length, f = Math.abs(d), p = `${f} ${f === 1 ? "character" : "characters"} ${d < 0 ? "over the limit" : "remaining"}`, [m, h] = n(p);
7
+ return t(() => {
8
+ let e = setTimeout(() => h(p), s);
9
+ return () => clearTimeout(e);
10
+ }, [p, s]), /* @__PURE__ */ i("p", {
11
+ ref: l,
12
+ ...u,
13
+ className: e("text-2xs", d < 0 ? "text-danger-fg" : "text-text-tertiary", c),
14
+ children: [/* @__PURE__ */ r("span", {
15
+ "aria-hidden": "true",
16
+ children: p
17
+ }), /* @__PURE__ */ r("span", {
18
+ className: "sr-only",
19
+ role: "status",
20
+ "aria-live": "polite",
21
+ "aria-atomic": "true",
22
+ children: m
23
+ })]
24
+ });
25
+ }
26
+ //#endregion
27
+ export { a as CharacterCount };
@@ -1,16 +1,18 @@
1
- import { type ChangeEvent, type InputHTMLAttributes, type ReactNode } from "react";
2
- export interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "onChange" | "size"> {
1
+ import { type ComponentPropsWithRef, type ReactNode } from "react";
2
+ export interface CheckboxProps extends Omit<ComponentPropsWithRef<"input">, "type" | "size" | "checked" | "defaultChecked"> {
3
3
  /** Whether the checkbox is checked (controlled). */
4
- checked: boolean;
4
+ checked?: boolean;
5
+ /** Initial checked state when uncontrolled. */
6
+ defaultChecked?: boolean;
5
7
  /** Show the mixed state (dash) and expose aria-checked="mixed". */
6
8
  indeterminate?: boolean;
7
- /** Existing boolean-first callback; native event is also available. */
8
- onChange: (checked: boolean, event: ChangeEvent<HTMLInputElement>) => void;
9
+ /** Called with the new checked state. */
10
+ onCheckedChange?: (checked: boolean) => void;
9
11
  /** Visible label rendered beside the checkbox. */
10
12
  label?: ReactNode;
11
- /** Accessible name when no visible label is given; aria-label takes precedence. */
12
- ariaLabel?: string;
13
+ /** Accessible name when no visible label is given. */
14
+ "aria-label"?: string;
13
15
  /** Opt-in larger controls, or inherit ControlSizeProvider. */
14
16
  controlSize?: "compact" | "comfortable";
15
17
  }
16
- export declare const Checkbox: import("react").ForwardRefExoticComponent<CheckboxProps & import("react").RefAttributes<HTMLInputElement>>;
18
+ export declare function Checkbox({ id, checked: checkedProp, defaultChecked, indeterminate, onChange, onCheckedChange, label, disabled, controlSize, className, "aria-label": ariaLabel, "aria-describedby": describedBy, "aria-invalid": invalid, required, ref, ...props }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,52 @@
1
+ import { cn as e } from "../../lib/cn.js";
2
+ import { mergeRefs as t } from "../../lib/mergeRefs.js";
3
+ import { useControlSize as n } from "../../providers/ControlSizeContext.js";
4
+ import { useControllableState as r } from "../../hooks/useControllableState.js";
5
+ import { FieldContext as i, describeField as a } from "./FieldContext.js";
6
+ import { useContext as o, useEffect as s, useId as c, useMemo as l, useRef as u } from "react";
7
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
8
+ import { Check as p, Minus as m } from "lucide-react";
9
+ //#region src/components/ui/Checkbox.tsx
10
+ function h({ id: h, checked: g, defaultChecked: _ = !1, indeterminate: v, onChange: y, onCheckedChange: b, label: x, disabled: S, controlSize: C, className: w, "aria-label": T, "aria-describedby": E, "aria-invalid": D, required: O, ref: k, ...A }) {
11
+ let [j, M] = r({
12
+ value: g,
13
+ defaultValue: _,
14
+ onChange: b
15
+ }), N = c(), P = n(C), F = o(i), I = h ?? F?.id ?? N, L = u(null), R = l(() => t(L, k), [k]);
16
+ return s(() => {
17
+ L.current && (L.current.indeterminate = !!v);
18
+ }, [v]), /* @__PURE__ */ f("div", {
19
+ className: e("ui-choice flex w-fit items-center gap-2.5", S ? "cursor-not-allowed opacity-40" : "cursor-pointer", w),
20
+ "data-control-size": P,
21
+ children: [/* @__PURE__ */ f("span", {
22
+ className: "ui-checkbox-control",
23
+ children: [/* @__PURE__ */ d("input", {
24
+ ...A,
25
+ ref: R,
26
+ id: I,
27
+ type: "checkbox",
28
+ checked: j,
29
+ "aria-checked": v ? "mixed" : j,
30
+ "aria-label": T,
31
+ "aria-describedby": a(E, F?.describedBy),
32
+ "aria-invalid": D ?? (F?.invalid || void 0),
33
+ disabled: S,
34
+ required: O ?? F?.required,
35
+ onChange: (e) => {
36
+ y?.(e), M(e.target.checked);
37
+ },
38
+ className: "ui-checkbox-input"
39
+ }), /* @__PURE__ */ d("span", {
40
+ className: "ui-checkbox-decoration",
41
+ "aria-hidden": "true",
42
+ children: v ? /* @__PURE__ */ d(m, { className: "h-3 w-3" }) : j ? /* @__PURE__ */ d(p, { className: "h-3 w-3" }) : null
43
+ })]
44
+ }), x && /* @__PURE__ */ d("label", {
45
+ htmlFor: I,
46
+ className: e("text-text-primary text-xs", S ? "cursor-not-allowed" : "cursor-pointer"),
47
+ children: x
48
+ })]
49
+ });
50
+ }
51
+ //#endregion
52
+ export { h as Checkbox };
@@ -1,11 +1,14 @@
1
- export interface CodeInputProps {
1
+ import { type ComponentPropsWithRef } from "react";
2
+ export interface CodeInputProps extends Omit<ComponentPropsWithRef<"div">, "children" | "defaultValue" | "onChange"> {
2
3
  /**
3
4
  * The digits entered so far (controlled). Boxes the user has cleared are
4
5
  * left out, so `value.length === length` only when every box is filled.
5
6
  */
6
- value: string;
7
+ value?: string;
8
+ /** Initial digits when uncontrolled. */
9
+ defaultValue?: string;
7
10
  /** Called with the digits entered so far after every edit. */
8
- onChange: (value: string) => void;
11
+ onValueChange?: (value: string) => void;
9
12
  /**
10
13
  * Called with the code whenever an edit leaves every box filled — use it
11
14
  * to auto-submit. Fires again if the user then changes a digit.
@@ -33,4 +36,4 @@ export interface CodeInputProps {
33
36
  * Handles typing, paste, SMS autofill, Backspace/Delete and arrow keys; each
34
37
  * box keeps its position, so clearing one never shifts the others.
35
38
  */
36
- export declare function CodeInput({ value, onChange, onComplete, length, error, invalid, disabled, autoFocus, name, "aria-label": ariaLabel, className, }: CodeInputProps): import("react/jsx-runtime").JSX.Element;
39
+ export declare function CodeInput({ value: valueProp, defaultValue, onValueChange, onComplete, length, error, invalid, disabled, autoFocus, name, "aria-label": ariaLabel, className, ref, ...rest }: CodeInputProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,96 @@
1
+ import { cn as e } from "../../lib/cn.js";
2
+ import { useControllableState as t } from "../../hooks/useControllableState.js";
3
+ import { applyBackspace as n, applyInput as r, applyText as i, toSlots as a } from "../../lib/codeInput.js";
4
+ import { useId as o, useRef as s, useState as c } from "react";
5
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
6
+ //#region src/components/ui/CodeInput.tsx
7
+ function d({ value: d, defaultValue: f = "", onValueChange: p, onComplete: m, length: h = 6, error: g, invalid: _, disabled: v, autoFocus: y, name: b, "aria-label": x = "Verification code", className: S, ref: C, ...w }) {
8
+ let [T, E] = t({
9
+ value: d,
10
+ defaultValue: f,
11
+ onChange: p
12
+ }), D = s([]), O = o(), k = _ || !!g, [A, j] = c(() => {
13
+ let e = a(T, h);
14
+ return {
15
+ proposed: e,
16
+ shown: e
17
+ };
18
+ }), M = (e) => e.length === h && e.join("") === T, [N, P] = c({
19
+ value: T,
20
+ length: h
21
+ });
22
+ if ((N.value !== T || N.length !== h) && (P({
23
+ value: T,
24
+ length: h
25
+ }), !M(A.proposed) && !M(A.shown))) {
26
+ let e = a(T, h);
27
+ j({
28
+ proposed: e,
29
+ shown: e
30
+ });
31
+ }
32
+ let F = M(A.proposed) ? A.proposed : M(A.shown) ? A.shown : a(T, h);
33
+ function I(e) {
34
+ let t = D.current[Math.max(0, Math.min(e, h - 1))];
35
+ t?.focus(), t?.select();
36
+ }
37
+ function L(e) {
38
+ if (!e) return;
39
+ j({
40
+ proposed: e.slots,
41
+ shown: F
42
+ });
43
+ let t = e.slots.join("");
44
+ E(t), e.slots.every(Boolean) && m?.(t), I(e.focus);
45
+ }
46
+ function R(e, t) {
47
+ t.key === "Backspace" ? (t.preventDefault(), L(n(F, e))) : t.key === "ArrowLeft" ? (t.preventDefault(), I(e - 1)) : t.key === "ArrowRight" && (t.preventDefault(), I(e + 1));
48
+ }
49
+ return /* @__PURE__ */ u("div", {
50
+ ref: C,
51
+ ...w,
52
+ className: e("flex flex-col gap-1.5", S),
53
+ children: [
54
+ /* @__PURE__ */ l("div", {
55
+ role: "group",
56
+ "aria-label": x,
57
+ className: "flex justify-between gap-2",
58
+ children: F.map((t, n) => /* @__PURE__ */ l("input", {
59
+ ref: (e) => {
60
+ D.current[n] = e;
61
+ },
62
+ type: "text",
63
+ inputMode: "numeric",
64
+ autoComplete: n === 0 ? "one-time-code" : "off",
65
+ autoFocus: y && n === 0,
66
+ disabled: v,
67
+ "aria-label": `Digit ${n + 1} of ${h}`,
68
+ "aria-invalid": k || void 0,
69
+ "aria-describedby": g ? O : void 0,
70
+ value: t,
71
+ onFocus: (e) => e.target.select(),
72
+ onChange: (e) => L(r(F, n, e.target.value, e.target.selectionStart)),
73
+ onKeyDown: (e) => R(n, e),
74
+ onPaste: (e) => {
75
+ e.preventDefault(), L(i(F, n, e.clipboardData.getData("text")));
76
+ },
77
+ className: e("bg-bg-secondary text-text-primary h-10 w-10 rounded-md border text-center font-mono text-sm", "transition-colors duration-[100ms]", "focus:border-accent focus:outline-none", "disabled:cursor-not-allowed disabled:opacity-40", k ? "border-danger" : "border-border")
78
+ }, n))
79
+ }),
80
+ b && /* @__PURE__ */ l("input", {
81
+ type: "hidden",
82
+ name: b,
83
+ value: T,
84
+ disabled: v
85
+ }),
86
+ g && /* @__PURE__ */ l("p", {
87
+ id: O,
88
+ role: "alert",
89
+ className: "text-2xs text-danger-fg",
90
+ children: g
91
+ })
92
+ ]
93
+ });
94
+ }
95
+ //#endregion
96
+ export { d as CodeInput };
@@ -1,8 +1,8 @@
1
- import { type ReactNode } from "react";
1
+ import { type ComponentPropsWithRef, type ReactNode } from "react";
2
2
  import { type PopoverCloseReason, type PopoverOpenReason } from "../../hooks/usePopover";
3
3
  import { type ControlSize } from "../../providers/ControlSizeContext";
4
4
  export interface ComboboxOption {
5
- /** Unique value returned to onChange when the option is chosen. */
5
+ /** Unique value returned to onValueChange when the option is chosen. */
6
6
  value: string;
7
7
  /** Text shown in the list and, once selected, on the trigger. */
8
8
  label: string;
@@ -20,13 +20,15 @@ export interface ComboboxOption {
20
20
  * `disabled` (the field was disabled while open).
21
21
  */
22
22
  export type ComboboxOpenChangeReason = PopoverOpenReason | PopoverCloseReason;
23
- export interface ComboboxProps<T extends ComboboxOption = ComboboxOption> {
23
+ export interface ComboboxProps<T extends ComboboxOption = ComboboxOption> extends Omit<ComponentPropsWithRef<"div">, "children" | "defaultValue" | "onChange" | "placeholder"> {
24
24
  /** Options to choose from. Filtered by label against the search text unless filterOptions is false. */
25
25
  options: T[];
26
26
  /** Value of the selected option (controlled). */
27
- value: string;
27
+ value?: string;
28
+ /** Initially selected value when uncontrolled. */
29
+ defaultValue?: string;
28
30
  /** Called with the value of the chosen option. */
29
- onChange: (value: string) => void;
31
+ onValueChange?: (value: string) => void;
30
32
  /** Receives the complete result, including caller-owned metadata. */
31
33
  onOptionChange?: (option: T) => void;
32
34
  /** Text shown on the trigger when nothing is selected. Defaults to "Select...". */
@@ -83,4 +85,4 @@ export interface ComboboxProps<T extends ComboboxOption = ComboboxOption> {
83
85
  */
84
86
  flip?: boolean;
85
87
  }
86
- export declare function Combobox<T extends ComboboxOption = ComboboxOption>({ options, value, onChange, onOptionChange, placeholder, label, className, controlSize, id, name, disabled, "aria-label": ariaLabel, "aria-describedby": describedBy, "aria-invalid": invalid, query, onQueryChange, filterOptions, selectedOption, renderOption, loading, loadingMessage, error, onRetry, emptyMessage, footer, onOpenChange, flip, }: ComboboxProps<T>): import("react/jsx-runtime").JSX.Element;
88
+ export declare function Combobox<T extends ComboboxOption = ComboboxOption>({ options, value: valueProp, defaultValue, onValueChange, onOptionChange, placeholder, label, className, controlSize, id, name, disabled, "aria-label": ariaLabel, "aria-describedby": describedBy, "aria-invalid": invalid, query, onQueryChange, filterOptions, selectedOption, renderOption, loading, loadingMessage, error, onRetry, emptyMessage, footer, onOpenChange, flip, ref, onBlur, ...rest }: ComboboxProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,213 @@
1
+ import { cn as e } from "../../lib/cn.js";
2
+ import { mergeRefs as t } from "../../lib/mergeRefs.js";
3
+ import { useControlSize as n } from "../../providers/ControlSizeContext.js";
4
+ import { useControllableState as r } from "../../hooks/useControllableState.js";
5
+ import { usePopover as i } from "../../hooks/usePopover.js";
6
+ import { useEffect as a, useId as ee, useMemo as te, useReducer as ne, useRef as o, useState as s } from "react";
7
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
8
+ import { Check as re, ChevronDown as ie, Search as ae } from "lucide-react";
9
+ //#region src/components/ui/Combobox.tsx
10
+ function u({ options: u, value: oe, defaultValue: d = "", onValueChange: se, onOptionChange: ce, placeholder: f = "Select...", label: p, className: le, controlSize: ue, id: de, name: m, disabled: h, "aria-label": g, "aria-describedby": _, "aria-invalid": v, query: y, onQueryChange: fe, filterOptions: pe = !0, selectedOption: b, renderOption: x, loading: S = !1, loadingMessage: me = "Loading results…", error: C, onRetry: w, emptyMessage: he = "No results", footer: T, onOpenChange: ge, flip: _e = !0, ref: E, onBlur: ve, ...ye }) {
11
+ let D = n(ue), { open: O, show: be, close: k, rootRef: A, anchorRef: j, triggerRef: M, popupRef: N, labelId: P, triggerId: F, popupId: I } = i({
12
+ haspopup: "listbox",
13
+ matchWidth: !0,
14
+ disabled: h,
15
+ flip: _e,
16
+ onOpenChange: ge
17
+ }), [L, xe] = r({
18
+ value: oe,
19
+ defaultValue: d,
20
+ onChange: se
21
+ }), [Se, R] = s(""), [Ce, z] = s(0), [B, we] = s(() => u.find((e) => e.value === L)), V = o(null), H = o(!1), [, Te] = ne((e) => e + 1, 0);
22
+ function U() {
23
+ H.current = !0, Te();
24
+ }
25
+ let W = ee(), Ee = de ?? `${W}-search`, G = `${W}-selected`, K = y ?? Se, q = u.find((e) => e.value === L) ?? (b?.value === L ? b : void 0) ?? (B?.value === L ? B : void 0), J = pe ? u.filter((e) => e.label.toLowerCase().includes(K.toLowerCase())) : u, Y = Math.min(Ce, Math.max(J.length - 1, 0)), X = J[Y]?.disabled ? J.findIndex((e) => !e.disabled) : Y, Z = J[X];
26
+ function De(e) {
27
+ y === void 0 && R(e), fe?.(e), z(0), U();
28
+ let t = N.current?.ownerDocument.getElementById(I);
29
+ t && (t.scrollTop = 0);
30
+ }
31
+ function Q(e) {
32
+ e.disabled || (we(e), xe(e.value), ce?.(e), k("select"));
33
+ }
34
+ function Oe(e) {
35
+ if ([
36
+ "ArrowDown",
37
+ "ArrowUp",
38
+ "Home",
39
+ "End"
40
+ ].includes(e.key)) {
41
+ e.preventDefault();
42
+ let t = e.key === "ArrowUp" || e.key === "End" ? -1 : 1, n = e.key === "Home" ? 0 : e.key === "End" ? J.length - 1 : X + t;
43
+ for (; n >= 0 && n < J.length && J[n].disabled;) n += t;
44
+ n >= 0 && n < J.length && (z(n), U());
45
+ } else e.key === "Enter" ? (e.preventDefault(), Z && Q(Z)) : e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), k("escape"));
46
+ }
47
+ function $(e) {
48
+ be(e), y === void 0 && R("");
49
+ let t = (y === void 0 ? u : J).findIndex((e) => e.value === L && !e.disabled);
50
+ z(Math.max(t, 0)), U(), setTimeout(() => V.current?.focus(), 0);
51
+ }
52
+ a(() => {
53
+ h && k("disabled");
54
+ }, [
55
+ h,
56
+ O,
57
+ k
58
+ ]), a(() => {
59
+ if (!O || !H.current) return;
60
+ H.current = !1;
61
+ let e = N.current?.ownerDocument, t = e?.getElementById(I), n = e?.getElementById(`${I}-${X}`);
62
+ if (!t || !n) return;
63
+ let r = t.getBoundingClientRect(), i = n.getBoundingClientRect(), a = t.offsetHeight ? r.height / t.offsetHeight : 1;
64
+ i.top < r.top ? t.scrollTop -= (r.top - i.top) / a : i.bottom > r.bottom && (t.scrollTop += (i.bottom - r.bottom) / a);
65
+ });
66
+ let ke = te(() => t(A, E), [A, E]);
67
+ return /* @__PURE__ */ l("div", {
68
+ ...ye,
69
+ className: e("flex flex-col gap-1.5", le),
70
+ ref: ke,
71
+ onBlur: (e) => {
72
+ ve?.(e), !e.defaultPrevented && O && !e.currentTarget.contains(e.relatedTarget) && k("blur");
73
+ },
74
+ children: [
75
+ p && /* @__PURE__ */ c("span", {
76
+ id: P,
77
+ className: "ui-field-label font-label text-xs font-medium",
78
+ children: p
79
+ }),
80
+ m && /* @__PURE__ */ c("input", {
81
+ type: "hidden",
82
+ name: m,
83
+ value: L,
84
+ disabled: h
85
+ }),
86
+ /* @__PURE__ */ l("div", {
87
+ className: "relative",
88
+ ref: j,
89
+ children: [
90
+ /* @__PURE__ */ c("button", {
91
+ ref: M,
92
+ id: F,
93
+ "data-control-size": D,
94
+ type: "button",
95
+ disabled: h,
96
+ "aria-label": g ?? (p ? void 0 : f),
97
+ "aria-labelledby": p && !g ? `${P} ${G}` : void 0,
98
+ "aria-describedby": _,
99
+ "aria-invalid": v,
100
+ "aria-expanded": O,
101
+ "aria-haspopup": "listbox",
102
+ "aria-controls": O ? I : void 0,
103
+ onClick: () => O ? k("toggle") : $("toggle"),
104
+ onKeyDown: (e) => {
105
+ (e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), $("keyboard"));
106
+ },
107
+ className: e("ui-sized-control font-control flex h-7 w-full cursor-pointer items-center rounded-md px-2 pr-7 text-xs", "bg-bg-secondary border-border text-text-primary border", "hover:bg-bg-hover hover:border-border-strong", "transition-colors duration-[100ms] disabled:cursor-not-allowed disabled:opacity-40", "focus-visible:outline-accent focus-visible:outline-2 focus-visible:outline-offset-2"),
108
+ children: /* @__PURE__ */ c("span", {
109
+ id: G,
110
+ children: q ? q.label : /* @__PURE__ */ c("span", {
111
+ className: "text-text-placeholder",
112
+ children: L || f
113
+ })
114
+ })
115
+ }),
116
+ /* @__PURE__ */ c(ie, {
117
+ "aria-hidden": "true",
118
+ className: e("text-text-tertiary pointer-events-none absolute top-1/2 right-2.5 h-3.5 w-3.5 -translate-y-1/2 transition-transform", O && "rotate-180")
119
+ }),
120
+ O && /* @__PURE__ */ l("div", {
121
+ ref: N,
122
+ className: e("ui-glass ui-glass-popover bg-bg-tertiary border-border-strong animate-scale-in fixed top-0 left-0 z-[100] rounded-md border shadow-lg", "flex flex-col overflow-hidden"),
123
+ onMouseDown: (e) => {
124
+ e.target.closest("input, textarea, select, [contenteditable]") || e.preventDefault();
125
+ },
126
+ children: [
127
+ /* @__PURE__ */ c("div", {
128
+ className: "border-border shrink-0 border-b p-1.5",
129
+ children: /* @__PURE__ */ l("div", {
130
+ className: "relative",
131
+ children: [/* @__PURE__ */ c(ae, {
132
+ "aria-hidden": "true",
133
+ className: "text-text-tertiary absolute top-1/2 left-2 h-3 w-3 -translate-y-1/2"
134
+ }), /* @__PURE__ */ c("input", {
135
+ ref: V,
136
+ "data-control-size": D,
137
+ "data-has-icon": "true",
138
+ id: Ee,
139
+ type: "text",
140
+ role: "combobox",
141
+ "aria-label": g ?? (p ? `Search ${p}` : "Search options"),
142
+ "aria-expanded": "true",
143
+ "aria-controls": I,
144
+ "aria-activedescendant": Z && !Z.disabled ? `${I}-${X}` : void 0,
145
+ "aria-autocomplete": "list",
146
+ "aria-describedby": _,
147
+ "aria-invalid": v,
148
+ value: K,
149
+ onChange: (e) => De(e.target.value),
150
+ onKeyDown: Oe,
151
+ placeholder: "Search...",
152
+ className: "ui-sized-control bg-bg-secondary text-text-primary border-border placeholder:text-text-placeholder focus:border-accent font-control h-7 w-full rounded border pr-2 pl-7 text-xs focus:outline-none"
153
+ })]
154
+ })
155
+ }),
156
+ S && /* @__PURE__ */ c("div", {
157
+ role: "status",
158
+ className: "text-text-tertiary shrink-0 px-3 py-2 text-xs",
159
+ children: me
160
+ }),
161
+ C && /* @__PURE__ */ l("div", {
162
+ role: "alert",
163
+ className: "text-text-secondary shrink-0 px-3 py-2 text-xs",
164
+ children: [C, w && /* @__PURE__ */ c("button", {
165
+ type: "button",
166
+ onClick: w,
167
+ className: "text-accent-fg ml-2",
168
+ children: "Retry"
169
+ })]
170
+ }),
171
+ /* @__PURE__ */ c("ul", {
172
+ id: I,
173
+ className: "max-h-48 min-h-0 overflow-y-auto py-1",
174
+ role: "listbox",
175
+ "aria-label": p ?? g ?? "Options",
176
+ "aria-busy": S,
177
+ children: J.map((t, n) => /* @__PURE__ */ l("li", {
178
+ id: `${I}-${n}`,
179
+ role: "option",
180
+ "aria-selected": t.value === L,
181
+ "aria-disabled": t.disabled || void 0,
182
+ onClick: () => Q(t),
183
+ onMouseEnter: () => {
184
+ t.disabled || z(n);
185
+ },
186
+ className: e("font-control flex w-full items-center gap-2 px-3 py-1.5 text-xs", "transition-colors duration-[100ms]", t.disabled ? "text-text-disabled cursor-not-allowed" : "cursor-pointer", !t.disabled && (n === X ? "bg-accent-muted text-accent-fg" : t.value === L ? "text-accent-fg" : "text-text-secondary hover:text-text-primary hover:bg-bg-hover")),
187
+ children: [/* @__PURE__ */ c("span", {
188
+ className: "flex-1",
189
+ children: x ? x(t) : t.label
190
+ }), t.value === L && /* @__PURE__ */ c(re, {
191
+ "aria-hidden": "true",
192
+ className: "h-3 w-3 shrink-0"
193
+ })]
194
+ }, t.value))
195
+ }),
196
+ J.length === 0 && !S && !C && /* @__PURE__ */ c("div", {
197
+ role: "status",
198
+ className: "text-text-tertiary shrink-0 px-3 py-2 text-center text-xs",
199
+ children: he
200
+ }),
201
+ T && /* @__PURE__ */ c("div", {
202
+ className: "border-border shrink-0 border-t p-1.5",
203
+ children: T
204
+ })
205
+ ]
206
+ })
207
+ ]
208
+ })
209
+ ]
210
+ });
211
+ }
212
+ //#endregion
213
+ export { u as Combobox };
@@ -11,4 +11,4 @@ export interface CopyButtonProps extends Omit<ButtonProps, "children" | "icon" |
11
11
  /** Called with true on success or false on failure. */
12
12
  onCopy?: (ok: boolean) => void;
13
13
  }
14
- export declare function CopyButton({ value, label, copiedLabel, iconOnly, onCopy, variant, ...props }: CopyButtonProps): import("react/jsx-runtime").JSX.Element;
14
+ export declare function CopyButton({ value, label, copiedLabel, iconOnly, onCopy, variant, ref, ...props }: CopyButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,57 @@
1
+ import { Button as e } from "./Button.js";
2
+ import { useEffect as t, useRef as n, useState as r } from "react";
3
+ import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
4
+ import { Check as s, Copy as c } from "lucide-react";
5
+ //#region src/components/ui/CopyButton.tsx
6
+ function l(e) {
7
+ let t = document.activeElement, n = document.createElement("textarea");
8
+ n.value = e, n.setAttribute("readonly", ""), n.style.position = "fixed", n.style.opacity = "0", document.body.appendChild(n);
9
+ try {
10
+ return n.focus(), n.select(), document.execCommand("copy");
11
+ } catch {
12
+ return !1;
13
+ } finally {
14
+ n.remove(), t instanceof HTMLElement && t.focus();
15
+ }
16
+ }
17
+ async function u(e) {
18
+ if (navigator.clipboard?.writeText) try {
19
+ return await navigator.clipboard.writeText(e), !0;
20
+ } catch {}
21
+ return l(e);
22
+ }
23
+ function d({ value: l, label: d = "Copy", copiedLabel: f = "Copied", iconOnly: p = !1, onCopy: m, variant: h, ref: g, ..._ }) {
24
+ let [v, y] = r(null), [b, x] = r(""), S = n(null), C = n(null);
25
+ t(() => () => {
26
+ C.current !== null && clearTimeout(C.current), S.current !== null && clearTimeout(S.current);
27
+ }, []);
28
+ async function w() {
29
+ let e = !1;
30
+ try {
31
+ e = await u(typeof l == "function" ? l() : l);
32
+ } catch {}
33
+ C.current !== null && clearTimeout(C.current), y(e ? "copied" : "failed"), x(""), S.current !== null && clearTimeout(S.current), S.current = setTimeout(() => {
34
+ x(e ? f : "Copy failed"), S.current = null;
35
+ }, 50), C.current = setTimeout(() => {
36
+ y(null), x(""), C.current = null;
37
+ }, 2e3), m?.(e);
38
+ }
39
+ let T = v === "copied" ? f : v === "failed" ? "Copy failed" : d;
40
+ return /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a(e, {
41
+ ..._,
42
+ ref: g,
43
+ variant: h ?? (p ? "icon" : "secondary"),
44
+ icon: v === "copied" ? s : c,
45
+ "aria-label": p ? T : _["aria-label"],
46
+ title: p ? T : _.title,
47
+ onClick: w,
48
+ children: p ? void 0 : T
49
+ }), /* @__PURE__ */ a("span", {
50
+ className: "sr-only",
51
+ role: "status",
52
+ "aria-live": "polite",
53
+ children: b
54
+ })] });
55
+ }
56
+ //#endregion
57
+ export { d as CopyButton };
@@ -17,8 +17,8 @@
17
17
  * </DangerZone>
18
18
  * ```
19
19
  */
20
- import type { ReactNode } from "react";
21
- export interface DangerZoneProps {
20
+ import type { ComponentPropsWithRef, ReactNode } from "react";
21
+ export interface DangerZoneProps extends Omit<ComponentPropsWithRef<"div">, "title" | "children"> {
22
22
  /**
23
23
  * Section heading.
24
24
  * Defaults to "Danger Zone" — the universal convention for destructive
@@ -35,4 +35,4 @@ export interface DangerZoneProps {
35
35
  /** Additional utility classes for the root container. */
36
36
  className?: string;
37
37
  }
38
- export declare function DangerZone({ title, description, children, className, }: DangerZoneProps): import("react/jsx-runtime").JSX.Element;
38
+ export declare function DangerZone({ title, description, children, className, ref, ...rest }: DangerZoneProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,23 @@
1
+ import { cn as e } from "../../lib/cn.js";
2
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
+ //#region src/components/ui/DangerZone.tsx
4
+ function r({ title: r = "Danger Zone", description: i, children: a, className: o, ref: s, ...c }) {
5
+ return /* @__PURE__ */ n("div", {
6
+ ref: s,
7
+ ...c,
8
+ className: e("border-border mt-8 border-t pt-6", o),
9
+ children: [
10
+ /* @__PURE__ */ t("h3", {
11
+ className: "text-danger-fg mb-2 text-xs font-semibold",
12
+ children: r
13
+ }),
14
+ i && /* @__PURE__ */ t("p", {
15
+ className: "text-text-secondary mb-3 text-xs",
16
+ children: i
17
+ }),
18
+ a
19
+ ]
20
+ });
21
+ }
22
+ //#endregion
23
+ export { r as DangerZone };
@@ -4,11 +4,13 @@ export interface DateParts {
4
4
  month: string;
5
5
  year: string;
6
6
  }
7
- export interface DatePartsInputProps {
7
+ export interface DatePartsInputProps extends Omit<ComponentPropsWithRef<"fieldset">, "children" | "defaultValue" | "onChange"> {
8
8
  /** Raw day, month and year strings (controlled); may be partial or invalid. */
9
- value: DateParts;
9
+ value?: DateParts;
10
+ /** Initial strings when uncontrolled. */
11
+ defaultValue?: DateParts;
10
12
  /** Called with the updated day, month and year strings on every edit. */
11
- onChange: (value: DateParts) => void;
13
+ onValueChange?: (value: DateParts) => void;
12
14
  /** Group legend describing the date, e.g. "Date of birth". */
13
15
  label: ReactNode;
14
16
  /** Helper text shown below the legend. */
@@ -33,4 +35,4 @@ export interface DatePartsInputProps {
33
35
  inputProps?: Partial<Record<keyof DateParts, ComponentPropsWithRef<"input">>>;
34
36
  }
35
37
  /** Retains raw strings, including partial/invalid dates. Validates the combined civil date and offers native selectors for each field. */
36
- export declare function DatePartsInput({ value, onChange, label, hint, error, id, name, disabled, required, className, inputProps, minYear, maxYear, }: DatePartsInputProps): import("react/jsx-runtime").JSX.Element;
38
+ export declare function DatePartsInput({ value: valueProp, defaultValue, onValueChange, label, hint, error, id, name, disabled, required, className, inputProps, minYear, maxYear, ref, ...rest }: DatePartsInputProps): import("react/jsx-runtime").JSX.Element;