@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
@@ -0,0 +1,267 @@
1
+ import { cn as e } from "../../lib/cn.js";
2
+ import { mergeRefs as t } from "../../lib/mergeRefs.js";
3
+ import { clamp as n } from "../../lib/math.js";
4
+ import { useControlSize as r } from "../../providers/ControlSizeContext.js";
5
+ import { useControllableState as i } from "../../hooks/useControllableState.js";
6
+ import { usePopover as a } from "../../hooks/usePopover.js";
7
+ import { calendarDateFromParts as o, calendarDateParts as s } from "../../lib/calendar.js";
8
+ import { MONTHS_SHORT as c } from "../../lib/months.js";
9
+ import { CalendarGrid as l } from "./CalendarGrid.js";
10
+ import { useId as u, useMemo as d, useState as f } from "react";
11
+ import { jsx as p, jsxs as m } from "react/jsx-runtime";
12
+ import { Calendar as h } from "lucide-react";
13
+ //#region src/components/ui/DateTimePicker.tsx
14
+ function g(e) {
15
+ return e === 0 ? {
16
+ hour12: 12,
17
+ period: "AM"
18
+ } : e < 12 ? {
19
+ hour12: e,
20
+ period: "AM"
21
+ } : e === 12 ? {
22
+ hour12: 12,
23
+ period: "PM"
24
+ } : {
25
+ hour12: e - 12,
26
+ period: "PM"
27
+ };
28
+ }
29
+ function _(e, t) {
30
+ return t === "AM" ? e === 12 ? 0 : e : e === 12 ? 12 : e + 12;
31
+ }
32
+ function v(e, t) {
33
+ if (t) return new Intl.DateTimeFormat("en-GB", {
34
+ timeZone: t,
35
+ day: "numeric",
36
+ month: "short",
37
+ year: "numeric",
38
+ hour: "2-digit",
39
+ minute: "2-digit",
40
+ timeZoneName: "short",
41
+ hourCycle: "h23"
42
+ }).format(e);
43
+ let n = c[e.getMonth()], r = e.getDate(), i = e.getFullYear(), { hour12: a, period: o } = g(e.getHours());
44
+ return `${n} ${r}, ${i} ${a}:${String(e.getMinutes()).padStart(2, "0")} ${o}`;
45
+ }
46
+ function y(e) {
47
+ return String(e).padStart(2, "0");
48
+ }
49
+ function b({ value: e, defaultValue: t = null, onValueChange: n, ...r }) {
50
+ let [a, o] = i({
51
+ value: e,
52
+ defaultValue: t,
53
+ onChange: n
54
+ });
55
+ return /* @__PURE__ */ p(x, {
56
+ ...r,
57
+ value: a,
58
+ onValueChange: o
59
+ }, r.timeZone ?? "browser-local");
60
+ }
61
+ function x({ controlSize: i, label: c, timeZone: b, value: x, onValueChange: S, placeholder: C = "Select date & time...", ref: w, className: T, ...E }) {
62
+ let D = r(i), { open: O, show: k, close: A, rootRef: j, anchorRef: ee, triggerRef: te, popupRef: ne, labelId: re, popupId: ie, triggerAria: ae } = a({
63
+ haspopup: "dialog",
64
+ labelled: !!c
65
+ }), oe = d(() => t(w, j), [w, j]), [M, N] = f(null), [P, F] = f(!1), [I, L] = f("reject"), R = u(), z = s(x ?? /* @__PURE__ */ new Date(), b), B = x ? g(s(x, b).hour) : {
66
+ hour12: 12,
67
+ period: "PM"
68
+ }, [V, H] = f(z.year), [U, W] = f(z.month - 1), [G, K] = f(String(B.hour12)), [q, J] = f(x ? y(s(x, b).minute) : "00"), [Y, X] = f(B.period), [Z, Q] = f(x);
69
+ function se(e) {
70
+ Q(e);
71
+ }
72
+ function ce(e) {
73
+ let t = e.replace(/\D/g, "").slice(0, 2);
74
+ K(t);
75
+ let n = parseInt(t, 10);
76
+ !isNaN(n) && n >= 13 && n <= 23 ? (K(String(n - 12)), X("PM")) : n === 0 && (K("12"), X("AM"));
77
+ }
78
+ function le() {
79
+ if (!Z) return;
80
+ let e = n(parseInt(G, 10) || 12, 1, 12), t = n(parseInt(q, 10) || 0, 0, 59), r = _(e, Y), i = {
81
+ ...s(Z, b),
82
+ hour: r,
83
+ minute: t,
84
+ second: 0,
85
+ millisecond: 0
86
+ }, a = x ? s(x, b) : null, c;
87
+ try {
88
+ c = I === "reject" && x && a && [
89
+ "year",
90
+ "month",
91
+ "day",
92
+ "hour",
93
+ "minute"
94
+ ].every((e) => a[e] === i[e]) ? new Date(x) : o(i, b, I);
95
+ let e = s(c, b);
96
+ if (e.hour !== r || e.minute !== t || e.day !== i.day) throw RangeError("This time does not exist in the selected timezone");
97
+ } catch (e) {
98
+ let t = e instanceof Error ? e.message : "Invalid date and time";
99
+ N(t), F(t.includes("twice"));
100
+ return;
101
+ }
102
+ N(null), S(c), A("select");
103
+ }
104
+ function $() {
105
+ if (O) {
106
+ A("toggle");
107
+ return;
108
+ }
109
+ if (x) {
110
+ H(s(x, b).year), W(s(x, b).month - 1), Q(x);
111
+ let e = g(s(x, b).hour);
112
+ K(String(e.hour12)), X(e.period), J(y(s(x, b).minute));
113
+ }
114
+ N(null);
115
+ let e = !1;
116
+ if (x && b) try {
117
+ o(s(x, b), b, "reject");
118
+ } catch (t) {
119
+ e = t instanceof Error && t.message.includes("twice");
120
+ }
121
+ F(e), L("reject"), k();
122
+ }
123
+ return /* @__PURE__ */ m("div", {
124
+ ...E,
125
+ ref: oe,
126
+ className: e("flex flex-col gap-1.5", T),
127
+ children: [c && /* @__PURE__ */ p("span", {
128
+ id: re,
129
+ className: "ui-field-label text-xs font-medium",
130
+ children: c
131
+ }), /* @__PURE__ */ m("div", {
132
+ className: "relative",
133
+ ref: ee,
134
+ children: [
135
+ /* @__PURE__ */ p("button", {
136
+ type: "button",
137
+ ref: te,
138
+ ...ae,
139
+ onClick: $,
140
+ "data-control-size": D,
141
+ className: e("ui-sized-control flex h-7 w-full cursor-pointer items-center rounded-md text-xs", "bg-bg-secondary border-border text-text-primary border", "hover:bg-bg-hover hover:border-border-strong", "transition-colors duration-[100ms]", "px-2 pr-7"),
142
+ children: x ? v(x, b) : /* @__PURE__ */ p("span", {
143
+ className: "text-text-placeholder",
144
+ children: C
145
+ })
146
+ }),
147
+ /* @__PURE__ */ p(h, { className: "text-text-tertiary pointer-events-none absolute top-1/2 right-2 h-3 w-3 -translate-y-1/2" }),
148
+ O && /* @__PURE__ */ m("div", {
149
+ ref: ne,
150
+ id: ie,
151
+ role: "dialog",
152
+ "aria-label": "Choose date and time",
153
+ 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", "p-3"),
154
+ children: [
155
+ /* @__PURE__ */ p(l, {
156
+ timeZone: b,
157
+ year: V,
158
+ month: U,
159
+ selected: Z,
160
+ onSelect: se,
161
+ onMonthChange: (e, t) => {
162
+ H(e), W(t);
163
+ }
164
+ }),
165
+ b && /* @__PURE__ */ p("p", {
166
+ className: "text-text-tertiary text-2xs",
167
+ children: b
168
+ }),
169
+ M && /* @__PURE__ */ p("p", {
170
+ id: R,
171
+ role: "alert",
172
+ className: "text-danger-fg text-xs",
173
+ children: M
174
+ }),
175
+ P && /* @__PURE__ */ m("select", {
176
+ "aria-label": "Repeated time occurrence",
177
+ value: I,
178
+ onChange: (e) => L(e.target.value),
179
+ className: "bg-bg-secondary text-text-primary border-border rounded-md border text-xs",
180
+ children: [
181
+ /* @__PURE__ */ p("option", {
182
+ value: "reject",
183
+ children: M ? "Choose an occurrence" : "Keep current occurrence"
184
+ }),
185
+ /* @__PURE__ */ p("option", {
186
+ value: "earlier",
187
+ children: "First occurrence (earlier instant)"
188
+ }),
189
+ /* @__PURE__ */ p("option", {
190
+ value: "later",
191
+ children: "Second occurrence (later instant)"
192
+ })
193
+ ]
194
+ }),
195
+ /* @__PURE__ */ m("div", {
196
+ className: "border-border mt-3 flex items-center gap-2 border-t pt-3",
197
+ children: [
198
+ /* @__PURE__ */ p("span", {
199
+ className: "text-text-secondary text-2xs font-medium",
200
+ children: "Time"
201
+ }),
202
+ /* @__PURE__ */ m("div", {
203
+ className: "flex items-center gap-1",
204
+ children: [
205
+ /* @__PURE__ */ p("input", {
206
+ type: "text",
207
+ inputMode: "numeric",
208
+ maxLength: 2,
209
+ value: G,
210
+ onChange: (e) => ce(e.target.value),
211
+ "aria-label": "Hour",
212
+ "aria-invalid": !!M || void 0,
213
+ "aria-describedby": M ? R : void 0,
214
+ className: "bg-bg-secondary border-border text-text-primary focus:border-accent h-6 w-8 rounded-md border text-center text-xs focus:outline-none"
215
+ }),
216
+ /* @__PURE__ */ p("span", {
217
+ className: "text-text-tertiary text-xs",
218
+ children: ":"
219
+ }),
220
+ /* @__PURE__ */ p("input", {
221
+ type: "text",
222
+ inputMode: "numeric",
223
+ maxLength: 2,
224
+ value: q,
225
+ onChange: (e) => J(e.target.value.replace(/\D/g, "").slice(0, 2)),
226
+ "aria-label": "Minute",
227
+ "aria-invalid": !!M || void 0,
228
+ "aria-describedby": M ? R : void 0,
229
+ className: "bg-bg-secondary border-border text-text-primary focus:border-accent h-6 w-8 rounded-md border text-center text-xs focus:outline-none"
230
+ })
231
+ ]
232
+ }),
233
+ /* @__PURE__ */ m("div", {
234
+ className: "border-border inline-flex overflow-hidden rounded-md border",
235
+ role: "group",
236
+ "aria-label": "Time period",
237
+ children: [/* @__PURE__ */ p("button", {
238
+ type: "button",
239
+ onClick: () => X("AM"),
240
+ "aria-pressed": Y === "AM",
241
+ className: e("text-2xs cursor-pointer px-2 py-0.5 font-medium transition-colors duration-[100ms]", Y === "AM" ? "bg-accent text-text-on-accent" : "bg-bg-secondary text-text-secondary hover:bg-bg-hover"),
242
+ children: "AM"
243
+ }), /* @__PURE__ */ p("button", {
244
+ type: "button",
245
+ onClick: () => X("PM"),
246
+ "aria-pressed": Y === "PM",
247
+ className: e("text-2xs cursor-pointer px-2 py-0.5 font-medium transition-colors duration-[100ms]", Y === "PM" ? "bg-accent text-text-on-accent" : "bg-bg-secondary text-text-secondary hover:bg-bg-hover"),
248
+ children: "PM"
249
+ })]
250
+ }),
251
+ /* @__PURE__ */ p("button", {
252
+ type: "button",
253
+ onClick: le,
254
+ disabled: !Z,
255
+ className: e("ml-auto h-6 rounded-md px-3 text-xs font-medium transition-colors duration-[100ms]", Z ? "bg-accent text-text-on-accent hover:bg-accent-hover cursor-pointer" : "bg-bg-hover text-text-disabled cursor-not-allowed"),
256
+ children: "Apply"
257
+ })
258
+ ]
259
+ })
260
+ ]
261
+ })
262
+ ]
263
+ })]
264
+ });
265
+ }
266
+ //#endregion
267
+ export { b as DateTimePicker };
@@ -1,5 +1,5 @@
1
- import { type ReactNode } from "react";
2
- export interface DetailPanelProps {
1
+ import { type ComponentPropsWithRef, type ReactNode } from "react";
2
+ export interface DetailPanelProps extends Omit<ComponentPropsWithRef<"section">, "title" | "children"> {
3
3
  /** Content renders only while open. Closing animates the width to zero. */
4
4
  open: boolean;
5
5
  /** Close request from the button or Escape. Consumers may intercept it. */
@@ -40,4 +40,4 @@ export interface DetailPanelProps {
40
40
  /** Focus the heading on opening. Default true. Closing never restores focus. */
41
41
  autoFocus?: boolean;
42
42
  }
43
- export declare function DetailPanel({ open, onClose, title, children, className, headerActions, sticky, resizable, defaultWidth, minWidth, maxWidth, fraction, defaultFraction, minFraction, maxFraction, onFractionChange, collapsed, onCollapsedChange, railIndicator, overlay, autoFocus, }: DetailPanelProps): import("react/jsx-runtime").JSX.Element;
43
+ export declare function DetailPanel({ open, onClose, title, children, className, headerActions, sticky, resizable, defaultWidth, minWidth, maxWidth, fraction, defaultFraction, minFraction, maxFraction, onFractionChange, collapsed, onCollapsedChange, railIndicator, overlay, autoFocus, ref, id, style, ...rest }: DetailPanelProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,183 @@
1
+ import { cn as e } from "../../lib/cn.js";
2
+ import { mergeRefs as t } from "../../lib/mergeRefs.js";
3
+ import { OverlayContext as n, useOverlayEscape as r } from "../../hooks/useOverlayStack.js";
4
+ import { panelResizeKey as ee } from "../../lib/panelResize.js";
5
+ import { useEffect as i, useId as a, useLayoutEffect as o, useMemo as te, useRef as s, useState as c } from "react";
6
+ import { Fragment as ne, jsx as l, jsxs as u } from "react/jsx-runtime";
7
+ import { GripVertical as d, PanelRightClose as f, PanelRightOpen as p, X as re } from "lucide-react";
8
+ //#region src/components/ui/DetailPanel.tsx
9
+ function m({ open: m, onClose: h, title: g, children: _, className: ie, headerActions: ae, sticky: v = !1, resizable: oe = !0, defaultWidth: y = 360, minWidth: se = 260, maxWidth: ce = 700, fraction: b, defaultFraction: x, minFraction: S, maxFraction: C, onFractionChange: w, collapsed: T = !1, onCollapsedChange: E, railIndicator: le, overlay: D = !1, autoFocus: O = !0, ref: k, id: A, style: ue, ...de }) {
10
+ let j = s(null), fe = te(() => t(k, j), [k]), M = s(null), N = s(null), P = s(null), F = s(null), I = s(!1), L = s(T), R = a(), z = a(), B = a(), V = A ?? B, [H, pe] = c(y), [me, he] = c(x ?? .5), [ge, U] = c(!1), W = s(null), G = b !== void 0 || x !== void 0 || S !== void 0 || C !== void 0 || w !== void 0, K = G ? Math.max(0, Math.min(1, S ?? .3)) : se, q = G ? Math.max(K, Math.min(1, C ?? .7)) : Math.max(K, ce), J = (e) => Math.max(K, Math.min(q, e)), Y = G ? J(b ?? me) : H, X = G ? x ?? .5 : y, _e = G ? `${Y * 100}%` : H, ve = r(m && !T, () => h(), j), Z = s(!1);
11
+ i(() => {
12
+ let e = j.current;
13
+ if (!e) return;
14
+ let t = () => {
15
+ I.current = e.contains(e.ownerDocument.activeElement);
16
+ };
17
+ return t(), e.ownerDocument.addEventListener("focusin", t), () => e.ownerDocument.removeEventListener("focusin", t);
18
+ }, []), o(() => {
19
+ m || (I.current = !1), m && L.current !== T && I.current && (T ? P : F).current?.focus(), L.current = T;
20
+ }, [T, m]), i(() => {
21
+ let e = j.current, t = e?.ownerDocument.activeElement;
22
+ m && !Z.current && O && !e?.contains(t ?? null) && !t?.closest("[role=\"dialog\"][aria-modal=\"true\"], dialog[open]") && M.current?.focus(), Z.current = m;
23
+ }, [m, O]), o(() => {
24
+ if (!m || T || !G) return;
25
+ let e = j.current?.parentElement, t = N.current;
26
+ if (!e || !t) return;
27
+ let n = (e) => {
28
+ t.style.width = `${e * Y}px`;
29
+ };
30
+ n(e.getBoundingClientRect().width);
31
+ let r = new ResizeObserver(([e]) => {
32
+ n(e.contentRect.width);
33
+ });
34
+ return r.observe(e), () => r.disconnect();
35
+ }, [
36
+ m,
37
+ T,
38
+ G,
39
+ Y
40
+ ]), i(() => {
41
+ let e = j.current?.ownerDocument, t = () => {
42
+ W.current = null, U(!1);
43
+ };
44
+ return e?.addEventListener("pointerup", t), e?.addEventListener("pointercancel", t), () => {
45
+ e?.removeEventListener("pointerup", t), e?.removeEventListener("pointercancel", t);
46
+ };
47
+ }, []);
48
+ function Q(e) {
49
+ let t = J(e);
50
+ G ? (b === void 0 && he(t), w?.(t)) : pe(t);
51
+ }
52
+ function $() {
53
+ W.current = null, U(!1);
54
+ }
55
+ return /* @__PURE__ */ l("section", {
56
+ ...de,
57
+ ref: fe,
58
+ id: V,
59
+ role: "region",
60
+ "aria-labelledby": m ? z : void 0,
61
+ "aria-hidden": !m || void 0,
62
+ className: e("border-border relative shrink-0 border-l", D ? "ui-glass ui-glass-popover bg-bg-secondary" : "bg-bg-pinned", !(ge && m && !T) && "transition-[width] duration-[200ms] ease-out", ie),
63
+ style: {
64
+ width: m ? T ? "3rem" : _e : 0,
65
+ position: D ? "absolute" : v ? "sticky" : void 0,
66
+ top: D ? 0 : v ? "var(--detail-panel-top, 0px)" : void 0,
67
+ right: D ? 0 : void 0,
68
+ bottom: D ? 0 : void 0,
69
+ height: v && !D ? "calc(100vh - var(--detail-panel-top, 0px))" : void 0,
70
+ alignSelf: v && !D ? "flex-start" : void 0,
71
+ zIndex: D ? 10 : void 0,
72
+ ...ue
73
+ },
74
+ children: m && /* @__PURE__ */ u(n.Provider, {
75
+ value: ve,
76
+ children: [oe && !T && /* @__PURE__ */ l("div", {
77
+ role: "separator",
78
+ tabIndex: 0,
79
+ "aria-orientation": "vertical",
80
+ "aria-label": "Resize panel",
81
+ "aria-controls": V,
82
+ "aria-valuenow": Math.round(Y * (G ? 100 : 1)),
83
+ "aria-valuemin": Math.round(K * (G ? 100 : 1)),
84
+ "aria-valuemax": Math.round(q * (G ? 100 : 1)),
85
+ "aria-valuetext": `${Math.round(Y * (G ? 100 : 1))}${G ? "%" : "px"}`,
86
+ className: "text-text-tertiary hover:text-text-secondary hover:bg-accent/30 active:bg-accent/40 focus-visible:outline-accent absolute top-0 left-0 z-10 h-full w-1 cursor-col-resize select-none focus-visible:outline-2 focus-visible:outline-offset-0",
87
+ style: { touchAction: "none" },
88
+ onPointerDown: (e) => {
89
+ e.button === 0 && (e.preventDefault(), e.currentTarget.focus(), e.currentTarget.setPointerCapture(e.pointerId), W.current = {
90
+ x: e.clientX,
91
+ width: Y,
92
+ pointerId: e.pointerId,
93
+ parentWidth: j.current?.parentElement?.getBoundingClientRect().width ?? 0
94
+ }, U(!0));
95
+ },
96
+ onPointerMove: (e) => {
97
+ let t = W.current;
98
+ !t || t.pointerId !== e.pointerId || G && !t.parentWidth || Q(t.width + (t.x - e.clientX) / (G ? t.parentWidth : 1));
99
+ },
100
+ onPointerUp: $,
101
+ onPointerCancel: $,
102
+ onLostPointerCapture: $,
103
+ onDoubleClick: () => Q(X),
104
+ onKeyDown: (e) => {
105
+ let t = ee(e.key, Y, G ? .02 : 16);
106
+ t !== void 0 && (e.preventDefault(), Q(t ?? X));
107
+ },
108
+ children: /* @__PURE__ */ l("span", {
109
+ "aria-hidden": "true",
110
+ className: "bg-bg-pinned border-border absolute left-0 flex h-8 w-4 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-md border transition-colors duration-[100ms]",
111
+ style: { top: "calc(100% / 3)" },
112
+ children: /* @__PURE__ */ l(d, {
113
+ "aria-hidden": "true",
114
+ className: "h-3.5 w-3.5"
115
+ })
116
+ })
117
+ }), /* @__PURE__ */ l("div", {
118
+ className: "h-full overflow-hidden",
119
+ children: /* @__PURE__ */ u("div", {
120
+ ref: N,
121
+ className: "animate-fade-in flex h-full flex-col",
122
+ style: { width: T ? "3rem" : G ? void 0 : H },
123
+ children: [/* @__PURE__ */ u("div", {
124
+ className: e("border-border flex shrink-0 items-center justify-between border-b px-3", T ? "flex-col gap-2 py-3" : "h-10"),
125
+ children: [/* @__PURE__ */ l("h3", {
126
+ ref: M,
127
+ id: z,
128
+ tabIndex: -1,
129
+ className: "text-text-primary truncate text-xs font-semibold",
130
+ style: T ? {
131
+ writingMode: "vertical-rl",
132
+ maxHeight: "12rem"
133
+ } : void 0,
134
+ children: g
135
+ }), T ? /* @__PURE__ */ u(ne, { children: [le, E && /* @__PURE__ */ u("button", {
136
+ type: "button",
137
+ onClick: () => E(!1),
138
+ ref: P,
139
+ "aria-labelledby": `${R} ${z}`,
140
+ className: "text-text-tertiary hover:text-text-primary flex h-6 w-6 shrink-0 items-center justify-center rounded",
141
+ children: [/* @__PURE__ */ l("span", {
142
+ id: R,
143
+ className: "sr-only",
144
+ children: "Expand"
145
+ }), /* @__PURE__ */ l(p, { className: "h-3.5 w-3.5" })]
146
+ })] }) : /* @__PURE__ */ u("div", {
147
+ className: "flex shrink-0 items-center gap-1",
148
+ children: [
149
+ E && /* @__PURE__ */ u("button", {
150
+ type: "button",
151
+ onClick: () => E(!0),
152
+ ref: F,
153
+ "aria-labelledby": `${R} ${z}`,
154
+ className: "text-text-tertiary hover:text-text-primary flex h-6 w-6 items-center justify-center rounded",
155
+ children: [/* @__PURE__ */ l("span", {
156
+ id: R,
157
+ className: "sr-only",
158
+ children: "Collapse"
159
+ }), /* @__PURE__ */ l(f, { className: "h-3.5 w-3.5" })]
160
+ }),
161
+ ae,
162
+ /* @__PURE__ */ l("button", {
163
+ type: "button",
164
+ onClick: h,
165
+ className: "text-text-tertiary hover:text-text-primary hover:bg-bg-hover flex h-6 w-6 cursor-pointer items-center justify-center rounded",
166
+ "aria-label": "Close panel",
167
+ children: /* @__PURE__ */ l(re, { className: "h-3.5 w-3.5" })
168
+ })
169
+ ]
170
+ })]
171
+ }), /* @__PURE__ */ l("div", {
172
+ hidden: T,
173
+ inert: T,
174
+ className: "min-h-0 flex-1 overflow-y-auto p-3",
175
+ children: _
176
+ })]
177
+ })
178
+ })]
179
+ })
180
+ });
181
+ }
182
+ //#endregion
183
+ export { m as DetailPanel };
@@ -1,9 +1,9 @@
1
- import { type ReactNode, type RefObject } from "react";
1
+ import { type ComponentPropsWithRef, type ReactNode, type RefObject } from "react";
2
2
  import { type AnchorPlacement } from "../../lib/anchorPlacement";
3
3
  /** Where a Dialog opens: the centred layout, or beside its anchor. */
4
4
  export type DialogPlacement = "center" | AnchorPlacement;
5
5
  export type DialogSize = "sm" | "md" | "lg" | "xl";
6
- export interface DialogProps {
6
+ export interface DialogProps extends Omit<ComponentPropsWithRef<"div">, "title" | "children" | "role" | "draggable"> {
7
7
  /** Maximum width: sm 400px, md 576px, lg 768px, xl 1024px. Defaults to `sm`. */
8
8
  size?: DialogSize;
9
9
  /** Whether the dialog is shown. It renders nothing when `false`. */
@@ -142,4 +142,4 @@ export interface DialogProps {
142
142
  */
143
143
  hideCloseButton?: boolean;
144
144
  }
145
- export declare function Dialog({ open, onClose, title, children, footer, className, size, draggable, resizable, rememberPosition, placement, anchorRef, role, description, "aria-label": ariaLabel, "aria-describedby": describedBy, initialFocusRef, returnFocusRef, busy, closeOnEscape, closeOnOverlayClick, hideCloseButton, }: DialogProps): import("react").ReactPortal | null;
145
+ export declare function Dialog({ open, onClose, title, children, footer, className, size, draggable, resizable, rememberPosition, placement, anchorRef, role, description, "aria-label": ariaLabel, "aria-describedby": describedBy, initialFocusRef, returnFocusRef, busy, closeOnEscape, closeOnOverlayClick, hideCloseButton, ref, ...rest }: DialogProps): import("react").ReactPortal | null;