@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,393 @@
1
+ import { clamp as e } from "../../../lib/math.js";
2
+ import { replaceResource as t, resourceIdsOf as n, sameRange as r, snapMinutes as i } from "../../../lib/calendar.js";
3
+ import { useCalendarContext as a } from "./context.js";
4
+ import { useEffect as o, useLayoutEffect as s, useRef as c, useState as l } from "react";
5
+ //#region src/components/ui/calendar/useGridInteraction.ts
6
+ var u = 4, d = 10, f = 36;
7
+ function p(e, r, i, a, o) {
8
+ let s = n(e.value.resourceId).length > 0, c = {
9
+ action: r,
10
+ start: i.start,
11
+ end: i.end,
12
+ resourceId: s ? o : void 0,
13
+ previousResourceId: s ? a : void 0,
14
+ resourceIds: t(e.value.resourceId, a, o)
15
+ };
16
+ return e.type === "event" ? {
17
+ target: "event",
18
+ event: e.value,
19
+ ...c
20
+ } : {
21
+ target: "availability",
22
+ availability: e.value,
23
+ ...c
24
+ };
25
+ }
26
+ function m(e, t) {
27
+ return t.target === "selection" ? !1 : r(e.value, t) && (t.resourceId === void 0 || t.resourceId === t.previousResourceId);
28
+ }
29
+ function h({ axis: t, columns: n, pxPerMinute: r, scrollRef: h, events: g, blocks: _, initialColumn: v }) {
30
+ let y = a(), { addMinutes: b, computeNudgeRange: x, dateAtMinutes: S, differenceInDays: C, shiftRangeDays: w } = y.dates, [T, E] = l(null), [D, O] = l(null), k = c(null), A = c({
31
+ ctx: y,
32
+ columns: n,
33
+ axis: t,
34
+ pxPerMinute: r
35
+ });
36
+ s(() => {
37
+ A.current = {
38
+ ctx: y,
39
+ columns: n,
40
+ axis: t,
41
+ pxPerMinute: r
42
+ };
43
+ }), o(() => {
44
+ let e = k;
45
+ return () => {
46
+ let t = e.current;
47
+ t && (e.current = null, t.cleanup(), t.frame && cancelAnimationFrame(t.frame));
48
+ };
49
+ }, []);
50
+ let { step: j } = y;
51
+ function M(e) {
52
+ return h.current?.querySelector(`[data-cal-col="${e}"]`) ?? null;
53
+ }
54
+ function N(t, n, r) {
55
+ let { ctx: i, axis: a, pxPerMinute: o } = A.current, s = A.current.columns[Number(t.dataset.calCol)], c = s ? i.dayBounds(s.day) : i.bounds, l = t.getBoundingClientRect(), u = a === "y" ? r - l.top : n - l.left;
56
+ return e(c.min + u / o, c.min, c.max);
57
+ }
58
+ function P(e, t, n) {
59
+ let { columns: r, axis: i } = A.current, a = h.current, o = document.elementFromPoint(e, t)?.closest("[data-cal-col]");
60
+ if (o && a?.contains(o)) return {
61
+ index: Number(o.dataset.calCol),
62
+ el: o
63
+ };
64
+ let s = M(n);
65
+ if (!s) return null;
66
+ let c = s.getBoundingClientRect(), l = n, u = i === "y" ? e < c.left : t < c.top, d = i === "y" ? e > c.right : t > c.bottom;
67
+ u && (l = Math.max(0, n - 1)), d && (l = Math.min(r.length - 1, n + 1));
68
+ let f = l === n ? s : M(l);
69
+ return f ? {
70
+ index: l,
71
+ el: f
72
+ } : {
73
+ index: n,
74
+ el: s
75
+ };
76
+ }
77
+ function F(e) {
78
+ let { ctx: t, columns: n } = A.current, { computeCreateRange: r, computeMoveRange: i, computeResizeEnd: a } = t.dates, { step: o } = t, s = n[e.origin];
79
+ if (!s) return;
80
+ let c = t.dayBounds(s.day), l;
81
+ if (e.kind === "create") {
82
+ let t = M(e.origin);
83
+ if (!t) return;
84
+ l = {
85
+ target: "selection",
86
+ action: "create",
87
+ ...r(s.day, e.anchorMinute, N(t, e.lastX, e.lastY), o, c),
88
+ allDay: !1,
89
+ resourceId: s.resourceId
90
+ };
91
+ } else if (e.kind === "move" && e.item) {
92
+ let r = P(e.lastX, e.lastY, e.hover);
93
+ if (!r) return;
94
+ e.hover = r.index;
95
+ let a = n[r.index], c = i(e.item.value, a.day, N(r.el, e.lastX, e.lastY), e.grabOffset, o, t.dayBounds(a.day));
96
+ l = p(e.item, "move", c, s.resourceId, a.resourceId);
97
+ } else if (e.kind === "resize" && e.item) {
98
+ let t = M(e.origin);
99
+ if (!t) return;
100
+ let n = a(e.item.value, s.day, N(t, e.lastX, e.lastY), o, c);
101
+ l = p(e.item, "resize", {
102
+ start: e.item.value.start,
103
+ end: n
104
+ }, s.resourceId, s.resourceId);
105
+ } else return;
106
+ return {
107
+ draft: l,
108
+ invalid: t.check(l),
109
+ itemId: e.item?.value.id
110
+ };
111
+ }
112
+ function I(e) {
113
+ let t = h.current;
114
+ if (!t || !e.started) return;
115
+ let n = t.getBoundingClientRect(), r = 0, i = 0;
116
+ if (e.lastY < n.top + f ? i = -1 : e.lastY > n.bottom - f && (i = 1), e.lastX < n.left + f ? r = -1 : e.lastX > n.right - f && (r = 1), !r && !i) {
117
+ e.frame = void 0;
118
+ return;
119
+ }
120
+ t.scrollBy(r * 10, i * 10);
121
+ let a = F(e);
122
+ a && (e.current = a, E(a)), e.frame = requestAnimationFrame(() => I(e));
123
+ }
124
+ function L(t) {
125
+ let { ctx: n, columns: r } = A.current, { dateAtMinutes: a } = n.dates, { step: o } = n, s = k.current;
126
+ if (s && (k.current = null, s.cleanup(), s.frame && cancelAnimationFrame(s.frame), E(null), t)) {
127
+ if (s.started) {
128
+ let e = s.current;
129
+ if (!e || s.item && m(s.item, e.draft)) return;
130
+ n.commit(e.draft, "pointer");
131
+ return;
132
+ }
133
+ if (!s.moved) {
134
+ if (s.item) {
135
+ s.item.type === "event" ? n.clickEvent(s.item.value) : n.clickBlock(s.item.value);
136
+ return;
137
+ }
138
+ if (s.kind === "create") {
139
+ let t = r[s.origin];
140
+ if (!t) return;
141
+ let c = n.dayBounds(t.day), l = Math.min(o, c.max - c.min), u = e(i(s.anchorMinute, o, "floor"), c.min, c.max - l), d = Math.min(u + Math.max(o, n.clickCreateDuration), c.max);
142
+ n.commit({
143
+ target: "selection",
144
+ action: "create",
145
+ start: a(t.day, u),
146
+ end: a(t.day, d),
147
+ allDay: !1,
148
+ resourceId: t.resourceId
149
+ }, "pointer");
150
+ }
151
+ }
152
+ }
153
+ }
154
+ function R(e) {
155
+ if (e.button !== 0 || k.current) return;
156
+ let t = e.target;
157
+ if (t.closest("[data-cal-ignore]")) return;
158
+ let r = t.closest("[data-cal-col]");
159
+ if (!r || !e.currentTarget.contains(r)) return;
160
+ let i = Number(r.dataset.calCol), a = n[i];
161
+ if (!a) return;
162
+ let o, s, c = t.closest("[data-cal-item]");
163
+ if (c) {
164
+ let e = c.dataset.calId ?? "";
165
+ if (c.dataset.calItem === "event") {
166
+ let t = g.get(e);
167
+ if (!t) return;
168
+ o = {
169
+ type: "event",
170
+ value: t
171
+ };
172
+ } else {
173
+ let t = _.get(e);
174
+ if (!t) return;
175
+ o = {
176
+ type: "availability",
177
+ value: t
178
+ };
179
+ }
180
+ let n = o.type === "event" ? y.canEditEvent(o.value) : y.canEditBlock(o.value), r = n && !!t.closest("[data-cal-resize]");
181
+ s = n ? r ? "resize" : "move" : "click";
182
+ } else if (y.selectable) s = "create";
183
+ else return;
184
+ let l = N(r, e.clientX, e.clientY), f = o ? (S(a.day, l).getTime() - o.value.start.getTime()) / 6e4 : 0, p = (e) => {
185
+ let t = k.current;
186
+ if (!t || e.pointerId !== t.pointerId) return;
187
+ t.lastX = e.clientX, t.lastY = e.clientY;
188
+ let n = Math.hypot(e.clientX - t.startX, e.clientY - t.startY);
189
+ if (!t.started) {
190
+ if (t.pointerType === "touch") {
191
+ n > d && (t.moved = !0);
192
+ return;
193
+ }
194
+ if (t.kind === "click" || n < u) {
195
+ n >= u && (t.moved = !0);
196
+ return;
197
+ }
198
+ t.started = !0, h.current?.setPointerCapture?.(t.pointerId);
199
+ }
200
+ let r = F(t);
201
+ r && (t.current = r, E(r)), t.frame || I(t);
202
+ }, m = (e) => {
203
+ e.pointerId === k.current?.pointerId && L(!0);
204
+ }, v = (e) => {
205
+ e.pointerId === k.current?.pointerId && L(!1);
206
+ }, b = (e) => {
207
+ e.key === "Escape" && (e.preventDefault(), L(!1));
208
+ };
209
+ window.addEventListener("pointermove", p), window.addEventListener("pointerup", m), window.addEventListener("pointercancel", v), window.addEventListener("keydown", b), k.current = {
210
+ pointerId: e.pointerId,
211
+ pointerType: e.pointerType,
212
+ startX: e.clientX,
213
+ startY: e.clientY,
214
+ lastX: e.clientX,
215
+ lastY: e.clientY,
216
+ started: !1,
217
+ moved: !1,
218
+ kind: s,
219
+ item: o,
220
+ origin: i,
221
+ hover: i,
222
+ anchorMinute: l,
223
+ grabOffset: f,
224
+ cleanup: () => {
225
+ window.removeEventListener("pointermove", p), window.removeEventListener("pointerup", m), window.removeEventListener("pointercancel", v), window.removeEventListener("keydown", b);
226
+ }
227
+ };
228
+ }
229
+ function z(e) {
230
+ requestAnimationFrame(() => {
231
+ h.current?.querySelector(`[data-cal-item][data-cal-id="${CSS.escape(e)}"]`)?.focus();
232
+ });
233
+ }
234
+ function B(e, r, i, a) {
235
+ let o = r === "event" ? g.get(i) : _.get(i);
236
+ if (!o) return;
237
+ let s = {
238
+ type: r,
239
+ value: o
240
+ };
241
+ if (e.key === "Enter" || e.key === " ") {
242
+ e.preventDefault(), s.type === "event" ? y.clickEvent(s.value) : y.clickBlock(s.value);
243
+ return;
244
+ }
245
+ if (!e.altKey || !e.key.startsWith("Arrow") || !(s.type === "event" ? y.canEditEvent(s.value) : y.canEditBlock(s.value))) return;
246
+ let c = t === "y" ? ["ArrowUp", "ArrowDown"] : ["ArrowLeft", "ArrowRight"], l = t === "y" ? ["ArrowLeft", "ArrowRight"] : ["ArrowUp", "ArrowDown"], u = n[a];
247
+ if (!u) return;
248
+ let d = null;
249
+ if (c.includes(e.key)) {
250
+ let t = e.key === c[0] ? -j : j;
251
+ if (e.shiftKey) {
252
+ let e = b(o.end, t);
253
+ if (e.getTime() - o.start.getTime() < j * 6e4) return;
254
+ d = p(s, "resize", {
255
+ start: o.start,
256
+ end: e
257
+ }, u.resourceId, u.resourceId);
258
+ } else d = p(s, "move", x(o, t, y.dayBounds(o.start)), u.resourceId, u.resourceId);
259
+ } else if (l.includes(e.key) && !e.shiftKey) {
260
+ let t = n[a + (e.key === l[0] ? -1 : 1)];
261
+ if (!t) return;
262
+ d = p(s, "move", w(o, C(t.day, u.day)), u.resourceId, t.resourceId);
263
+ }
264
+ d && (e.preventDefault(), !m(s, d) && y.commit(d, "keyboard") && z(i));
265
+ }
266
+ function V(e) {
267
+ if (e.target !== e.currentTarget || D) return;
268
+ let t = !0;
269
+ try {
270
+ t = e.currentTarget.matches(":focus-visible");
271
+ } catch {}
272
+ t && O(H());
273
+ }
274
+ function H() {
275
+ let t = n[e(v, 0, Math.max(0, n.length - 1))], r = t ? y.dayBounds(t.day) : y.bounds, a = Math.min(j, r.max - r.min), o = e(i((t && y.timeZone && y.scrollToMinute !== void 0 ? y.dates.minutesOfDay(y.dates.wallDateAtMinutes(t.day, y.scrollToMinute)) : y.scrollToMinute) ?? r.min, j, "floor"), r.min, r.max - a);
276
+ return {
277
+ column: e(v, 0, Math.max(0, n.length - 1)),
278
+ start: o,
279
+ end: Math.min(o + Math.max(j, y.clickCreateDuration), r.max)
280
+ };
281
+ }
282
+ function U(e) {
283
+ e.target === e.currentTarget && O(null);
284
+ }
285
+ function W() {
286
+ requestAnimationFrame(() => {
287
+ h.current?.querySelector("[data-cal-cursor]")?.scrollIntoView({
288
+ block: "nearest",
289
+ inline: "nearest"
290
+ });
291
+ });
292
+ }
293
+ function G(r) {
294
+ if (r.target !== r.currentTarget) return;
295
+ if (!D) {
296
+ (r.key.startsWith("Arrow") || r.key === "Enter" || r.key === " ") && (r.preventDefault(), O(H()), W());
297
+ return;
298
+ }
299
+ let i = n[D.column];
300
+ if (!i) {
301
+ O(null);
302
+ return;
303
+ }
304
+ let a = y.dayBounds(i.day), o = t === "y" ? "ArrowUp" : "ArrowLeft", s = t === "y" ? "ArrowDown" : "ArrowRight", c = t === "y" ? "ArrowLeft" : "ArrowUp", l = t === "y" ? "ArrowRight" : "ArrowDown", u = D.end - D.start, d = null;
305
+ switch (r.key) {
306
+ case o:
307
+ case s: {
308
+ let t = r.key === o ? -j : j;
309
+ if (r.shiftKey) {
310
+ let n = e(D.end + t, D.start + j, a.max);
311
+ d = {
312
+ ...D,
313
+ end: n
314
+ };
315
+ } else {
316
+ let n = e(D.start + t, a.min, a.max - u);
317
+ d = {
318
+ ...D,
319
+ start: n,
320
+ end: n + u
321
+ };
322
+ }
323
+ break;
324
+ }
325
+ case c:
326
+ case l: {
327
+ let t = e(D.column + (r.key === c ? -1 : 1), 0, n.length - 1), i = y.dayBounds(n[t].day), o = Math.min(u, i.max - i.min), s = e(i.min + D.start - a.min, i.min, i.max - o);
328
+ d = {
329
+ ...D,
330
+ column: t,
331
+ start: s,
332
+ end: s + o
333
+ };
334
+ break;
335
+ }
336
+ case "PageUp":
337
+ case "PageDown": {
338
+ let t = r.key === "PageUp" ? -60 : 60, n = e(D.start + t, a.min, a.max - u);
339
+ d = {
340
+ ...D,
341
+ start: n,
342
+ end: n + u
343
+ };
344
+ break;
345
+ }
346
+ case "Home":
347
+ d = {
348
+ ...D,
349
+ start: a.min,
350
+ end: a.min + u
351
+ };
352
+ break;
353
+ case "End":
354
+ d = {
355
+ ...D,
356
+ start: a.max - u,
357
+ end: a.max
358
+ };
359
+ break;
360
+ case "Enter":
361
+ case " ": {
362
+ r.preventDefault();
363
+ let e = n[D.column];
364
+ if (!e || !y.selectable) return;
365
+ y.commit({
366
+ target: "selection",
367
+ action: "create",
368
+ start: S(e.day, D.start),
369
+ end: S(e.day, D.end),
370
+ allDay: !1,
371
+ resourceId: e.resourceId
372
+ }, "keyboard");
373
+ return;
374
+ }
375
+ case "Escape":
376
+ r.preventDefault(), O(null);
377
+ return;
378
+ default: return;
379
+ }
380
+ r.preventDefault(), O(d), W();
381
+ }
382
+ return {
383
+ drag: T,
384
+ cursor: D,
385
+ onPointerDown: R,
386
+ onItemKeyDown: B,
387
+ onGridFocus: V,
388
+ onGridBlur: U,
389
+ onGridKeyDown: G
390
+ };
391
+ }
392
+ //#endregion
393
+ export { h as useGridInteraction };
@@ -11,7 +11,7 @@ export declare function useFieldControl({ id, error, hint, describedBy, invalid,
11
11
  errorId: string | undefined;
12
12
  hintId: string | undefined;
13
13
  describedBy: string | undefined;
14
- invalid: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
14
+ invalid: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
15
15
  required: boolean | undefined;
16
16
  placeholderLabel: string | undefined;
17
17
  };
@@ -0,0 +1,17 @@
1
+ import { FieldContext as e, describeField as t } from "./FieldContext.js";
2
+ import { useContext as n, useId as r } from "react";
3
+ //#region src/components/ui/useFieldControl.ts
4
+ function i({ id: i, error: a, hint: o, describedBy: s, invalid: c, required: l }) {
5
+ let u = r(), d = n(e), f = i ?? d?.id ?? u, p = a ? `${f}-error` : void 0, m = o ? `${f}-hint` : void 0;
6
+ return {
7
+ inputId: f,
8
+ errorId: p,
9
+ hintId: m,
10
+ describedBy: t(s, d?.describedBy, m, p),
11
+ invalid: c ?? (!!a || d?.invalid || void 0),
12
+ required: l ?? d?.required,
13
+ placeholderLabel: d?.placeholderLabel
14
+ };
15
+ }
16
+ //#endregion
17
+ export { i as useFieldControl };
@@ -0,0 +1,219 @@
1
+ import { BookOpen as e, Layers3 as t, Monitor as n, Moon as r, Palette as i, Sun as a, Zap as o } from "lucide-react";
2
+ //#region src/config/theme.ts
3
+ var s = [
4
+ {
5
+ value: "dark",
6
+ label: "Dark",
7
+ icon: r,
8
+ preview: {
9
+ bg: "#0d0f12",
10
+ fg: "#2a2e38"
11
+ }
12
+ },
13
+ {
14
+ value: "light",
15
+ label: "Light",
16
+ icon: a,
17
+ preview: {
18
+ bg: "#f5f5f5",
19
+ fg: "#d4d4d8"
20
+ }
21
+ },
22
+ {
23
+ value: "lightInverted",
24
+ label: "Light Inverted",
25
+ icon: a,
26
+ preview: {
27
+ bg: "#f1f2f4",
28
+ fg: "#ffffff"
29
+ }
30
+ },
31
+ {
32
+ value: "monokai",
33
+ label: "Monokai",
34
+ icon: i,
35
+ preview: {
36
+ bg: "#272822",
37
+ fg: "#3E3D32"
38
+ }
39
+ },
40
+ {
41
+ value: "solarized",
42
+ label: "Solarized",
43
+ icon: n,
44
+ preview: {
45
+ bg: "#002B36",
46
+ fg: "#0A3F4C"
47
+ }
48
+ },
49
+ {
50
+ value: "cyberBrutalDark",
51
+ label: "Cyber Brutal Dark",
52
+ icon: o,
53
+ preview: {
54
+ bg: "#050505",
55
+ fg: "#18181b"
56
+ }
57
+ },
58
+ {
59
+ value: "cyberBrutalLight",
60
+ label: "Cyber Brutal Light",
61
+ icon: o,
62
+ preview: {
63
+ bg: "#e4e4e7",
64
+ fg: "#d4d4d8"
65
+ }
66
+ },
67
+ {
68
+ value: "hashiTheme",
69
+ label: "HashiTheme",
70
+ icon: e,
71
+ preview: {
72
+ bg: "#ffffff",
73
+ fg: "#364153"
74
+ }
75
+ },
76
+ {
77
+ value: "glassDark",
78
+ label: "Glass Dark",
79
+ icon: t,
80
+ preview: {
81
+ bg: "#1e2035",
82
+ fg: "#272d40"
83
+ }
84
+ },
85
+ {
86
+ value: "glassLight",
87
+ label: "Glass Light",
88
+ icon: t,
89
+ preview: {
90
+ bg: "#ecebf4",
91
+ fg: "#f7f8fc"
92
+ }
93
+ }
94
+ ], c = new Set([
95
+ "light",
96
+ "lightInverted",
97
+ "cyberBrutalLight",
98
+ "hashiTheme",
99
+ "glassLight"
100
+ ]);
101
+ function l(e) {
102
+ return c.has(e);
103
+ }
104
+ var u = s.filter((e) => l(e.value)), d = s.filter((e) => !l(e.value)), f = {
105
+ uiFont: "inter",
106
+ headingFont: "inter",
107
+ proseFont: "inter",
108
+ controlFont: "inter",
109
+ labelFont: "inter",
110
+ navigationFont: "inter",
111
+ dataFont: "inter",
112
+ codeFont: "jetbrains-mono",
113
+ fontSize: 15,
114
+ borderRadius: 6,
115
+ borderWidth: 1,
116
+ tracking: .05,
117
+ lineHeight: 1.45,
118
+ density: .25
119
+ }, p = {
120
+ uiFont: "jetbrains-mono",
121
+ headingFont: "jetbrains-mono",
122
+ proseFont: "jetbrains-mono",
123
+ controlFont: "jetbrains-mono",
124
+ labelFont: "jetbrains-mono",
125
+ navigationFont: "jetbrains-mono",
126
+ dataFont: "jetbrains-mono",
127
+ codeFont: "jetbrains-mono",
128
+ fontSize: 15,
129
+ borderRadius: 0,
130
+ borderWidth: 1,
131
+ tracking: .2,
132
+ lineHeight: 1.4,
133
+ density: .22
134
+ }, m = {
135
+ uiFont: "inter",
136
+ headingFont: "archivo-expanded",
137
+ proseFont: "pt-serif",
138
+ controlFont: "inter",
139
+ labelFont: "inter",
140
+ navigationFont: "inter",
141
+ dataFont: "inter",
142
+ codeFont: "jetbrains-mono",
143
+ fontSize: 14,
144
+ borderRadius: 6,
145
+ borderWidth: 1,
146
+ tracking: 0,
147
+ lineHeight: 1.45,
148
+ density: .25
149
+ }, h = {
150
+ ...f,
151
+ borderRadius: 12
152
+ }, g = {
153
+ dark: f,
154
+ light: f,
155
+ lightInverted: f,
156
+ monokai: f,
157
+ solarized: f,
158
+ cyberBrutalDark: p,
159
+ cyberBrutalLight: p,
160
+ hashiTheme: m,
161
+ glassDark: h,
162
+ glassLight: h
163
+ }, _ = [
164
+ {
165
+ value: "archivo-expanded",
166
+ label: "Archivo Expanded"
167
+ },
168
+ {
169
+ value: "inter",
170
+ label: "Inter"
171
+ },
172
+ {
173
+ value: "jetbrains-mono",
174
+ label: "JetBrains Mono"
175
+ },
176
+ {
177
+ value: "pt-serif",
178
+ label: "PT Serif"
179
+ },
180
+ {
181
+ value: "system",
182
+ label: "System"
183
+ }
184
+ ], v = [
185
+ {
186
+ value: "purple",
187
+ color: "#7a59fc"
188
+ },
189
+ {
190
+ value: "blue",
191
+ color: "#3B82F6"
192
+ },
193
+ {
194
+ value: "green",
195
+ color: "#15803D"
196
+ },
197
+ {
198
+ value: "teal",
199
+ color: "#0F766E"
200
+ },
201
+ {
202
+ value: "orange",
203
+ color: "#C2410C"
204
+ },
205
+ {
206
+ value: "red",
207
+ color: "#EF4444"
208
+ },
209
+ {
210
+ value: "pink",
211
+ color: "#EC4899"
212
+ },
213
+ {
214
+ value: "indigo",
215
+ color: "#6265f1"
216
+ }
217
+ ];
218
+ //#endregion
219
+ export { v as accentItems, d as darkThemes, _ as fontOptions, l as isLightTheme, u as lightThemes, g as themeDefaults, s as themeItems };