@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,40 @@
1
+ import { cn as e } from "../../lib/cn.js";
2
+ import { formatMediaTime as t } from "../../lib/formatMediaTime.js";
3
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
+ //#region src/components/ui/TranscriptLine.tsx
5
+ function i({ speaker: i, role: a = "patient", time: o, onSeek: s, highlighted: c = !1, children: l, className: u, ref: d, ...f }) {
6
+ let p = o != null && Number.isFinite(o) && o >= 0 ? o : null, m = p == null ? null : t(p);
7
+ return /* @__PURE__ */ r("div", {
8
+ ...f,
9
+ ref: d,
10
+ "data-role": a,
11
+ "data-highlighted": c || void 0,
12
+ className: e("flex gap-3 rounded-md p-2 text-xs", c && "bg-accent-subtle", a === "system" ? "text-text-tertiary italic" : "text-text-secondary", a === "agent" && "border-l-2 border-accent", a === "staff" && "border-l-2 border-border-strong", u),
13
+ children: [m != null && /* @__PURE__ */ n("div", {
14
+ className: "font-mono text-2xs shrink-0 pt-1",
15
+ children: s ? /* @__PURE__ */ n("button", {
16
+ type: "button",
17
+ onClick: () => s(p),
18
+ "aria-label": `Seek to ${m}`,
19
+ className: "cursor-pointer rounded-md text-accent-fg hover:underline focus-visible:outline-accent focus-visible:outline-2 focus-visible:outline-offset-2",
20
+ children: m
21
+ }) : /* @__PURE__ */ n("span", { children: m })
22
+ }), /* @__PURE__ */ r("div", {
23
+ className: "min-w-0 flex-1",
24
+ style: { overflowWrap: "anywhere" },
25
+ children: [
26
+ /* @__PURE__ */ n("span", {
27
+ className: "text-text-primary font-medium",
28
+ children: i
29
+ }),
30
+ ": ",
31
+ /* @__PURE__ */ n("span", {
32
+ className: "whitespace-pre-wrap",
33
+ children: l
34
+ })
35
+ ]
36
+ })]
37
+ });
38
+ }
39
+ //#endregion
40
+ export { i as TranscriptLine };
@@ -1,14 +1,12 @@
1
- import { type ChangeEvent, type DragEvent, type InputHTMLAttributes, type ReactNode } from "react";
2
- export interface UploadDropzoneProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "onChange" | "title" | "children"> {
1
+ import { type ChangeEvent, type ComponentPropsWithRef, type DragEvent, type ReactNode } from "react";
2
+ export interface UploadDropzoneProps extends Omit<ComponentPropsWithRef<"input">, "type" | "title" | "children"> {
3
3
  /** Primary prompt text; defaults to a drag-and-drop or click-to-browse message. */
4
4
  title?: ReactNode;
5
5
  /** Secondary hint text (e.g. accepted types or size limits), linked via `aria-describedby`. */
6
6
  description?: ReactNode;
7
7
  /** Replaces the default upload icon. */
8
8
  icon?: ReactNode;
9
- /** Existing picker callback; receives the genuine native-input change event. */
10
- onChange?: (files: FileList | null, event: ChangeEvent<HTMLInputElement>) => void;
11
9
  /** Receives both picker selections and drops. The caller owns upload and file validation. */
12
10
  onFilesChange?: (files: FileList, event: ChangeEvent<HTMLInputElement> | DragEvent<HTMLLabelElement>) => void;
13
11
  }
14
- export declare const UploadDropzone: import("react").ForwardRefExoticComponent<UploadDropzoneProps & import("react").RefAttributes<HTMLInputElement>>;
12
+ export declare function UploadDropzone({ title, description, icon, multiple, disabled, onChange, onFilesChange, className, id, "aria-describedby": describedBy, ref, ...inputProps }: UploadDropzoneProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,55 @@
1
+ import { cn as e } from "../../lib/cn.js";
2
+ import { useId as t, useImperativeHandle as n, useRef as r } from "react";
3
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
4
+ import { UploadCloud as o } from "lucide-react";
5
+ //#region src/components/ui/UploadDropzone.tsx
6
+ function s({ title: s = "Drag and drop files here, or click to browse", description: c, icon: l, multiple: u, disabled: d, onChange: f, onFilesChange: p, className: m, id: h, "aria-describedby": g, ref: _, ...v }) {
7
+ let y = r(null);
8
+ n(_, () => y.current, []);
9
+ let b = t(), x = `${h ?? b}-description`;
10
+ return /* @__PURE__ */ a("label", {
11
+ className: e("ui-upload-dropzone border-border hover:border-border-strong relative block rounded-md border-2 border-dashed p-8 text-center transition-colors duration-[100ms]", d ? "cursor-not-allowed opacity-60" : "cursor-pointer hover:bg-bg-hover", m),
12
+ onDragOver: (e) => {
13
+ e.preventDefault(), e.dataTransfer.dropEffect = d || y.current?.matches(":disabled") ? "none" : "copy";
14
+ },
15
+ onDrop: (e) => {
16
+ e.preventDefault();
17
+ let t = y.current;
18
+ if (d || !t || t.matches(":disabled") || !e.dataTransfer.files.length) return;
19
+ let n = new DataTransfer(), r = Array.from(e.dataTransfer.files);
20
+ for (let e of u ? r : r.slice(0, 1)) n.items.add(e);
21
+ t.files = n.files, p?.(t.files, e);
22
+ },
23
+ children: [
24
+ /* @__PURE__ */ i("input", {
25
+ ...v,
26
+ id: h,
27
+ ref: y,
28
+ type: "file",
29
+ multiple: u,
30
+ disabled: d,
31
+ className: "sr-only",
32
+ "aria-describedby": [g, c && x].filter(Boolean).join(" ") || void 0,
33
+ onChange: (e) => {
34
+ f?.(e), e.target.files && p?.(e.target.files, e);
35
+ }
36
+ }),
37
+ /* @__PURE__ */ i("div", {
38
+ "aria-hidden": "true",
39
+ className: "text-text-tertiary mx-auto mb-3 flex h-9 w-9 items-center justify-center rounded-md bg-bg-tertiary",
40
+ children: l ?? /* @__PURE__ */ i(o, { className: "h-4.5 w-4.5" })
41
+ }),
42
+ /* @__PURE__ */ i("span", {
43
+ className: "text-text-secondary mb-1 block text-xs",
44
+ children: s
45
+ }),
46
+ c && /* @__PURE__ */ i("span", {
47
+ id: x,
48
+ className: "text-2xs text-text-tertiary block",
49
+ children: c
50
+ })
51
+ ]
52
+ });
53
+ }
54
+ //#endregion
55
+ export { s as UploadDropzone };
@@ -0,0 +1,5 @@
1
+ import { tones as e } from "../../lib/tones.js";
2
+ //#region src/components/ui/badgeColors.ts
3
+ var t = e;
4
+ //#endregion
5
+ export { t as badgeColors };
@@ -0,0 +1,140 @@
1
+ import { cn as e } from "../../../lib/cn.js";
2
+ import { formatTimeRange as t, resourceIdsOf as n } from "../../../lib/calendar.js";
3
+ import { useCalendarContext as r } from "./context.js";
4
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
+ //#region src/components/ui/calendar/AgendaView.tsx
6
+ function o({ days: t, events: o, availability: l, label: u }) {
7
+ let d = r(), { daySegment: f, eventsOnDay: p, getFormatter: m, isAllDayLike: h, isSameDay: g, toDateKey: _ } = d.dates, v = m(d.locale, {
8
+ weekday: "long",
9
+ day: "numeric",
10
+ month: "long"
11
+ }), y = (e) => n(e).map((e) => d.resourceById.get(e)?.title).filter(Boolean).join(", ");
12
+ return /* @__PURE__ */ i("div", {
13
+ className: "ui-cal-scroll min-h-0 flex-1 overflow-y-auto",
14
+ "aria-label": u,
15
+ role: "region",
16
+ children: t.map((t) => {
17
+ let n = p(o, t).map((e) => ({
18
+ type: "event",
19
+ value: e
20
+ }));
21
+ if (d.agendaShowAvailability) {
22
+ for (let e of l) f(e.start, e.end, t) && n.push({
23
+ type: "availability",
24
+ value: e
25
+ });
26
+ n.sort((e, t) => {
27
+ let n = Number(e.type === "event" && h(e.value)) - Number(t.type === "event" && h(t.value));
28
+ return n ? -n : e.value.start.getTime() - t.value.start.getTime() || (e.type === "availability" ? -1 : 1);
29
+ });
30
+ }
31
+ let r = g(t, d.now);
32
+ return /* @__PURE__ */ a("section", {
33
+ "aria-label": v.format(t),
34
+ children: [/* @__PURE__ */ i("h3", {
35
+ className: e("ui-cal-agenda-day border-border border-b px-3 py-1.5 text-xs font-semibold", r ? "text-accent-fg" : "text-text-primary"),
36
+ children: /* @__PURE__ */ i("button", {
37
+ type: "button",
38
+ className: "cursor-pointer hover:underline",
39
+ onClick: () => d.openDay(t),
40
+ "aria-current": r ? "date" : void 0,
41
+ children: v.format(t)
42
+ })
43
+ }), n.length === 0 ? /* @__PURE__ */ i("p", {
44
+ className: "text-text-tertiary border-border border-b px-3 py-2 text-xs",
45
+ children: d.labels.noEvents
46
+ }) : /* @__PURE__ */ i("ul", {
47
+ className: "divide-border divide-y border-border border-b",
48
+ children: n.map((e) => /* @__PURE__ */ i("li", { children: e.type === "event" ? /* @__PURE__ */ i(s, {
49
+ event: e.value,
50
+ resources: y(e.value.resourceId)
51
+ }) : /* @__PURE__ */ i(c, {
52
+ block: e.value,
53
+ resources: y(e.value.resourceId)
54
+ }) }, `${e.type}:${e.value.id}`))
55
+ })]
56
+ }, _(t));
57
+ })
58
+ });
59
+ }
60
+ function s({ event: n, resources: o }) {
61
+ let s = r(), { isAllDayLike: c } = s.dates, l = s.statusLabel(n), u = c(n) ? s.labels.allDay : t(n.start, n.end, s);
62
+ return /* @__PURE__ */ a("div", {
63
+ role: "button",
64
+ tabIndex: 0,
65
+ "aria-label": s.describeEvent(n),
66
+ "data-status": n.status ?? "confirmed",
67
+ className: e("ui-cal-agenda-row hover:bg-bg-hover flex cursor-pointer items-start gap-3 px-3 py-2 transition-colors duration-[100ms]", `ui-cal-c-${s.eventColor(n)}`),
68
+ onClick: () => s.clickEvent(n),
69
+ onKeyDown: (e) => {
70
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), s.clickEvent(n));
71
+ },
72
+ children: [
73
+ /* @__PURE__ */ i("span", {
74
+ className: "text-text-secondary font-mono w-24 shrink-0 text-xs",
75
+ children: u
76
+ }),
77
+ /* @__PURE__ */ i("span", {
78
+ className: "ui-cal-dot mt-1",
79
+ "aria-hidden": "true"
80
+ }),
81
+ /* @__PURE__ */ a("span", {
82
+ className: "min-w-0 flex-1",
83
+ children: [/* @__PURE__ */ i("span", {
84
+ className: "ui-cal-title block text-xs",
85
+ children: n.title
86
+ }), n.description && /* @__PURE__ */ i("span", {
87
+ className: "ui-cal-meta block text-2xs",
88
+ children: n.description
89
+ })]
90
+ }),
91
+ o && /* @__PURE__ */ i("span", {
92
+ className: "text-text-tertiary hidden max-w-40 truncate text-2xs sm:block",
93
+ children: o
94
+ }),
95
+ (l || n.badge) && /* @__PURE__ */ a("span", {
96
+ className: "flex shrink-0 gap-1",
97
+ children: [l && /* @__PURE__ */ i("span", {
98
+ className: "ui-cal-badge",
99
+ children: l
100
+ }), n.badge && /* @__PURE__ */ i("span", {
101
+ className: "ui-cal-badge",
102
+ children: n.badge
103
+ })]
104
+ })
105
+ ]
106
+ });
107
+ }
108
+ function c({ block: n, resources: o }) {
109
+ let s = r(), c = n.kind ?? "available", l = c === "available" ? s.labels.available : s.labels.unavailable, u = s.hasBlockClick;
110
+ return /* @__PURE__ */ a("div", {
111
+ role: u ? "button" : void 0,
112
+ tabIndex: u ? 0 : void 0,
113
+ "aria-label": s.describeBlock(n),
114
+ className: e("text-text-tertiary flex items-start gap-3 px-3 py-1.5 text-2xs", u && "hover:bg-bg-hover cursor-pointer transition-colors duration-[100ms]", `ui-cal-c-${s.blockColor(n)}`),
115
+ onClick: u ? () => s.clickBlock(n) : void 0,
116
+ onKeyDown: u ? (e) => {
117
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), s.clickBlock(n));
118
+ } : void 0,
119
+ children: [
120
+ /* @__PURE__ */ i("span", {
121
+ className: "font-mono w-24 shrink-0",
122
+ children: t(n.start, n.end, s)
123
+ }),
124
+ /* @__PURE__ */ i("span", {
125
+ className: e("ui-cal-agenda-swatch mt-0.5", c === "unavailable" && "ui-cal-agenda-swatch-off"),
126
+ "aria-hidden": "true"
127
+ }),
128
+ /* @__PURE__ */ a("span", {
129
+ className: "min-w-0 flex-1 truncate",
130
+ children: [l, n.label ? ` · ${n.label}` : ""]
131
+ }),
132
+ o && /* @__PURE__ */ i("span", {
133
+ className: "hidden max-w-40 truncate sm:block",
134
+ children: o
135
+ })
136
+ ]
137
+ });
138
+ }
139
+ //#endregion
140
+ export { o as AgendaView };
@@ -0,0 +1,321 @@
1
+ import { cn as e } from "../../../lib/cn.js";
2
+ import { usePortalContainer as t } from "../../../hooks/usePortalContainer.js";
3
+ import { useFixedPopupAt as n } from "../../../hooks/useAnchoredPopup.js";
4
+ import { useDismiss as r } from "../../../hooks/useDismiss.js";
5
+ import { formatTime as i, formatTimeRange as a, replaceResource as o } from "../../../lib/calendar.js";
6
+ import { useCalendarContext as s } from "./context.js";
7
+ import { useCallback as c, useEffect as l, useLayoutEffect as u, useMemo as d, useRef as f, useState as p } from "react";
8
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
9
+ import { X as ee } from "lucide-react";
10
+ import { createPortal as te } from "react-dom";
11
+ //#region src/components/ui/calendar/MonthView.tsx
12
+ var ne = 96, re = 224;
13
+ function g(e) {
14
+ return `${e.type}:${e.value.id}`;
15
+ }
16
+ function _({ date: _, events: v, availability: y, label: ie }) {
17
+ let b = s(), { addDays: x, daySegment: S, differenceInDays: ae, eventsOnDay: C, formatLongDate: w, fromDateKey: T, getFormatter: E, getMonthWeeks: D, isAllDayLike: oe, isSameDay: se, shiftRangeDays: ce, toDateKey: O } = b.dates, k = d(() => D(_, b.weekStartsOn), [
18
+ _,
19
+ b.weekStartsOn,
20
+ D
21
+ ]), A = f(null), j = f(null), [M, N] = p(null), [P, F] = p(null), le = t(), I = f(null), [ue, L] = p(null), [R, z] = p(null), B = f(null), V = f(b);
22
+ u(() => {
23
+ V.current = b;
24
+ }), l(() => {
25
+ let e = B;
26
+ return () => {
27
+ e.current?.cleanup(), e.current = null;
28
+ };
29
+ }, []);
30
+ let H = f(!1), [U, de] = p(null);
31
+ l(() => {
32
+ let e = A.current;
33
+ if (!e || typeof ResizeObserver > "u") return;
34
+ let t = new ResizeObserver((e) => {
35
+ de(e[0]?.contentRect.height ?? null);
36
+ });
37
+ return t.observe(e), () => t.disconnect();
38
+ }, []);
39
+ let W = c(() => F(null), []);
40
+ r(P !== null, W, [j]), n(P !== null, I, j, (e, t) => {
41
+ let n = Math.max(e.width, re);
42
+ return {
43
+ top: Math.max(8, e.top),
44
+ left: Math.max(8, Math.min(e.left, t - n - 8)),
45
+ width: n
46
+ };
47
+ }), l(() => {
48
+ P && j.current?.querySelector("[data-cal-close]")?.focus();
49
+ }, [P]);
50
+ let G = b.editLayer === "availability", K = b.dates.parts(_).month, q = d(() => k.flat(), [k]), J = O(b.now), fe = q.find((e) => O(e) === J && b.dates.parts(e).month === K) ?? q.find((e) => b.dates.parts(e).month === K && b.dates.parts(e).day === b.dates.parts(_).day) ?? q.find((e) => b.dates.parts(e).month === K) ?? q[0], pe = M && q.some((e) => O(e) === M) ? M : O(fe), me = d(() => {
51
+ let e = /* @__PURE__ */ new Map();
52
+ for (let t of q) {
53
+ let n = C(v, t).map((e) => ({
54
+ type: "event",
55
+ value: e
56
+ })), r = y.filter((e) => S(e.start, e.end, t)).sort((e, t) => e.start.getTime() - t.start.getTime()), i = r.some((e) => (e.kind ?? "available") === "available"), a = G ? r.map((e) => ({
57
+ type: "availability",
58
+ value: e
59
+ })) : n;
60
+ e.set(O(t), {
61
+ items: a,
62
+ hasAvailable: i
63
+ });
64
+ }
65
+ return e;
66
+ }, [
67
+ q,
68
+ v,
69
+ y,
70
+ G,
71
+ C,
72
+ S,
73
+ O
74
+ ]), he = E(b.locale, { weekday: "short" }), ge = b.monthMaxEvents ?? (U ? Math.max(1, Math.floor((Math.max(U / k.length, ne) - 28) / 20)) : 3);
75
+ function Y(e) {
76
+ let t = O(e);
77
+ N(t), requestAnimationFrame(() => {
78
+ A.current?.querySelector(`[data-cal-date="${t}"]`)?.focus();
79
+ });
80
+ }
81
+ function _e(e, t) {
82
+ if (e.target !== e.currentTarget) return;
83
+ let n = {
84
+ ArrowLeft: -1,
85
+ ArrowRight: 1,
86
+ ArrowUp: -7,
87
+ ArrowDown: 7
88
+ };
89
+ if (e.key in n) {
90
+ e.preventDefault();
91
+ let r = x(t, n[e.key]);
92
+ q.some((e) => se(e, r)) && Y(r);
93
+ } else if (e.key === "Home" || e.key === "End") {
94
+ e.preventDefault();
95
+ let n = (b.dates.weekday(t) - b.weekStartsOn + 7) % 7;
96
+ Y(x(t, e.key === "Home" ? -n : 6 - n));
97
+ } else (e.key === "Enter" || e.key === " ") && (e.preventDefault(), b.openDay(t));
98
+ }
99
+ function X(e) {
100
+ return e.type === "event" ? b.canEditEvent(e.value) : b.canEditBlock(e.value);
101
+ }
102
+ function Z(e, t) {
103
+ let n = {
104
+ action: "move",
105
+ ...ce(e.value, t),
106
+ resourceIds: o(e.value.resourceId, void 0, void 0)
107
+ };
108
+ return e.type === "event" ? {
109
+ target: "event",
110
+ event: e.value,
111
+ ...n
112
+ } : {
113
+ target: "availability",
114
+ availability: e.value,
115
+ ...n
116
+ };
117
+ }
118
+ function Q(e) {
119
+ e.type === "event" ? b.clickEvent(e.value) : b.clickBlock(e.value);
120
+ }
121
+ function ve(e, t, n) {
122
+ if (e.button !== 0 || B.current || (e.stopPropagation(), e.pointerType === "touch" || !X(t))) return;
123
+ let r = (e) => {
124
+ let t = B.current;
125
+ if (!t || e.pointerId !== t.pointerId) return;
126
+ if (!t.started) {
127
+ if (Math.hypot(e.clientX - t.startX, e.clientY - t.startY) < 4) return;
128
+ t.started = !0, z(g(t.item));
129
+ }
130
+ let n = document.elementFromPoint(e.clientX, e.clientY)?.closest("[data-cal-date]"), r = n && A.current?.contains(n) ? n.dataset.calDate ?? null : null;
131
+ t.overKey = r ?? void 0, L(r);
132
+ }, i = (e) => {
133
+ let t = B.current;
134
+ if (!t || (B.current = null, t.cleanup(), L(null), z(null), t.started && (H.current = !0, setTimeout(() => {
135
+ H.current = !1;
136
+ }, 0)), !e || !t.started || !t.overKey || t.overKey === t.originKey)) return;
137
+ let n = ae(T(t.overKey), T(t.originKey));
138
+ V.current.commit(Z(t.item, n), "pointer");
139
+ }, a = (e) => {
140
+ e.pointerId === B.current?.pointerId && i(!0);
141
+ }, o = (e) => {
142
+ e.pointerId === B.current?.pointerId && i(!1);
143
+ }, s = (e) => {
144
+ e.key === "Escape" && i(!1);
145
+ };
146
+ window.addEventListener("pointermove", r), window.addEventListener("pointerup", a), window.addEventListener("pointercancel", o), window.addEventListener("keydown", s), B.current = {
147
+ item: t,
148
+ originKey: n,
149
+ pointerId: e.pointerId,
150
+ startX: e.clientX,
151
+ startY: e.clientY,
152
+ started: !1,
153
+ cleanup: () => {
154
+ window.removeEventListener("pointermove", r), window.removeEventListener("pointerup", a), window.removeEventListener("pointercancel", o), window.removeEventListener("keydown", s);
155
+ }
156
+ };
157
+ }
158
+ function ye(e) {
159
+ H.current || Q(e);
160
+ }
161
+ function be(e, t) {
162
+ if (e.key === "Enter" || e.key === " ") {
163
+ e.preventDefault(), e.stopPropagation(), Q(t);
164
+ return;
165
+ }
166
+ if (e.altKey && (e.key === "ArrowLeft" || e.key === "ArrowRight")) {
167
+ if (e.preventDefault(), e.stopPropagation(), !X(t)) return;
168
+ b.commit(Z(t, e.key === "ArrowLeft" ? -1 : 1), "keyboard");
169
+ }
170
+ }
171
+ function xe(e, t) {
172
+ e.target !== e.currentTarget || !b.selectable || b.commit({
173
+ target: "selection",
174
+ action: "create",
175
+ start: t,
176
+ end: x(t, 1),
177
+ allDay: !0
178
+ }, "pointer");
179
+ }
180
+ let $ = (t, n) => {
181
+ let r = g(t), o = t.value.placeholder ? {
182
+ "aria-hidden": !0,
183
+ "data-placeholder": !0
184
+ } : {
185
+ role: "button",
186
+ tabIndex: 0,
187
+ onPointerDown: (e) => ve(e, t, n),
188
+ onClick: () => ye(t),
189
+ onKeyDown: (e) => be(e, t)
190
+ };
191
+ if (t.type === "availability") {
192
+ let n = t.value;
193
+ return /* @__PURE__ */ h("div", {
194
+ className: e("ui-cal-chip", `ui-cal-c-${b.blockColor(n)}`),
195
+ "data-all-day": !0,
196
+ "data-dragging": R === r || void 0,
197
+ "aria-label": n.placeholder ? void 0 : b.describeBlock(n),
198
+ ...o,
199
+ children: [b.display.time && /* @__PURE__ */ m("span", {
200
+ className: "ui-cal-meta font-mono shrink-0",
201
+ children: a(n.start, n.end, b)
202
+ }), b.display.blockLabels && /* @__PURE__ */ m("span", {
203
+ className: "ui-cal-title",
204
+ children: n.label ?? ((n.kind ?? "available") === "available" ? b.labels.available : b.labels.unavailable)
205
+ })]
206
+ }, r);
207
+ }
208
+ let s = t.value, c = oe(s), l = b.statusLabel(s);
209
+ return /* @__PURE__ */ h("div", {
210
+ className: e("ui-cal-chip", `ui-cal-c-${b.eventColor(s)}`),
211
+ "data-all-day": c || void 0,
212
+ "data-status": s.status ?? "confirmed",
213
+ "data-dragging": R === r || void 0,
214
+ "aria-label": s.placeholder ? void 0 : b.describeEvent(s),
215
+ title: l ? `${s.title} (${l})` : s.title,
216
+ ...o,
217
+ children: [
218
+ !c && /* @__PURE__ */ m("span", {
219
+ className: "ui-cal-dot",
220
+ "aria-hidden": "true"
221
+ }),
222
+ !c && b.display.time && /* @__PURE__ */ m("span", {
223
+ className: "ui-cal-meta font-mono shrink-0",
224
+ children: i(s.start, b)
225
+ }),
226
+ /* @__PURE__ */ m("span", {
227
+ className: "ui-cal-title font-medium",
228
+ children: s.title
229
+ })
230
+ ]
231
+ }, r);
232
+ };
233
+ return /* @__PURE__ */ h("div", {
234
+ className: "flex min-h-0 flex-1 flex-col",
235
+ children: [/* @__PURE__ */ m("div", {
236
+ className: "border-border grid grid-cols-7 border-b",
237
+ "aria-hidden": "true",
238
+ children: k[0].map((e) => /* @__PURE__ */ m("div", {
239
+ className: "text-text-tertiary py-1.5 text-center text-2xs font-medium uppercase",
240
+ children: he.format(e)
241
+ }, b.dates.weekday(e)))
242
+ }), /* @__PURE__ */ m("div", {
243
+ ref: A,
244
+ role: "grid",
245
+ "aria-label": ie,
246
+ "data-cal-drag": R ? "move" : void 0,
247
+ className: "ui-cal-scroll flex min-h-0 flex-1 flex-col overflow-y-auto",
248
+ children: k.map((t) => /* @__PURE__ */ m("div", {
249
+ role: "row",
250
+ className: "grid min-h-24 flex-1 grid-cols-7",
251
+ children: t.map((t) => {
252
+ let n = O(t), r = me.get(n), i = r?.items ?? [], a = Math.max(1, ge), o = i.length > a, s = o ? i.slice(0, a - 1) : i, c = n === J, l = b.dates.parts(t).month !== K, u = b.hasAvailability && b.shadeOutsideAvailability && !r?.hasAvailable;
253
+ return /* @__PURE__ */ h("div", {
254
+ role: "gridcell",
255
+ tabIndex: n === pe ? 0 : -1,
256
+ "data-cal-date": n,
257
+ "data-outside-month": l || void 0,
258
+ "data-unavailable": u || void 0,
259
+ "data-drop-target": ue === n || void 0,
260
+ "aria-label": `${w(t, b.locale)}${i.length ? `, ${b.labels.eventCount(i.length)}` : ""}`,
261
+ "aria-current": c ? "date" : void 0,
262
+ className: "ui-cal-month-cell flex flex-col gap-0.5 p-1",
263
+ onFocus: (e) => {
264
+ e.target === e.currentTarget && N(n);
265
+ },
266
+ onKeyDown: (e) => _e(e, t),
267
+ onClick: (e) => xe(e, t),
268
+ children: [
269
+ /* @__PURE__ */ m("button", {
270
+ type: "button",
271
+ tabIndex: -1,
272
+ onClick: () => b.openDay(t),
273
+ "aria-label": w(t, b.locale),
274
+ className: e("flex h-5 min-w-5 cursor-pointer items-center justify-center self-start rounded-full px-1 text-2xs font-semibold transition-colors duration-[100ms]", c ? "bg-accent text-text-on-accent" : l ? "text-text-tertiary hover:bg-bg-hover" : "text-text-primary hover:bg-bg-hover"),
275
+ children: b.dates.parts(t).day
276
+ }),
277
+ s.map((e) => $(e, n)),
278
+ o && /* @__PURE__ */ m("button", {
279
+ type: "button",
280
+ className: "text-text-secondary hover:bg-bg-hover hover:text-text-primary cursor-pointer self-start rounded-md px-1 text-2xs font-medium transition-colors duration-[100ms]",
281
+ "aria-haspopup": "dialog",
282
+ "aria-expanded": P === n,
283
+ onClick: (e) => {
284
+ I.current = e.currentTarget.closest("[data-cal-date]"), F(n);
285
+ },
286
+ children: b.labels.more(i.length - s.length)
287
+ }),
288
+ P === n && te(/* @__PURE__ */ m("div", {
289
+ ref: j,
290
+ role: "dialog",
291
+ "aria-label": w(t, b.locale),
292
+ className: "ui-cal ui-cal-popover ui-glass ui-glass-popover flex flex-col gap-0.5",
293
+ children: /* @__PURE__ */ h("div", {
294
+ className: "ui-cal-popover-scroll",
295
+ children: [/* @__PURE__ */ h("div", {
296
+ className: "mb-1 flex items-center justify-between gap-2 pl-1",
297
+ children: [/* @__PURE__ */ m("button", {
298
+ type: "button",
299
+ className: "text-text-primary cursor-pointer text-xs font-semibold hover:underline",
300
+ onClick: () => b.openDay(t),
301
+ children: w(t, b.locale)
302
+ }), /* @__PURE__ */ m("button", {
303
+ type: "button",
304
+ "aria-label": b.labels.close,
305
+ className: "text-text-tertiary hover:text-text-primary hover:bg-bg-hover flex h-6 w-6 cursor-pointer items-center justify-center rounded-md transition-colors duration-[100ms]",
306
+ onClick: W,
307
+ "data-cal-close": !0,
308
+ children: /* @__PURE__ */ m(ee, { className: "h-3.5 w-3.5" })
309
+ })]
310
+ }), i.map((e) => $(e, n))]
311
+ })
312
+ }), le ?? document.body)
313
+ ]
314
+ }, n);
315
+ })
316
+ }, O(t[0])))
317
+ })]
318
+ });
319
+ }
320
+ //#endregion
321
+ export { _ as MonthView };