@leonardaustin/ui 0.25.0 → 0.26.1

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 +97 -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 +4 -4
  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,53 @@
1
+ import { cn as e } from "../../lib/cn.js";
2
+ import { useControllableState as t } from "../../hooks/useControllableState.js";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ //#region src/components/ui/RadioPill.tsx
5
+ function r({ options: r, value: i, defaultValue: a, onValueChange: o, disabled: s, className: c, "aria-label": l, ref: u, ...d }) {
6
+ let [f, p] = t({
7
+ value: i,
8
+ defaultValue: a,
9
+ onChange: (e) => o?.(e)
10
+ }), m = s ? [] : r.filter((e) => !e.disabled), h = m.find((e) => e.value === f) ?? m[0];
11
+ function g(e, t) {
12
+ if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) return;
13
+ let n;
14
+ switch (e.key) {
15
+ case "ArrowRight":
16
+ case "ArrowDown":
17
+ n = 1;
18
+ break;
19
+ case "ArrowLeft":
20
+ case "ArrowUp":
21
+ n = -1;
22
+ break;
23
+ default: return;
24
+ }
25
+ let r = m.findIndex((e) => e.value === t);
26
+ if (r < 0) return;
27
+ e.preventDefault();
28
+ let i = (r + n + m.length) % m.length;
29
+ (e.currentTarget.parentElement?.querySelectorAll("[role=\"radio\"]:enabled"))?.[i]?.focus();
30
+ let a = m[i].value;
31
+ a !== f && p(a);
32
+ }
33
+ return /* @__PURE__ */ n("div", {
34
+ ref: u,
35
+ ...d,
36
+ role: "radiogroup",
37
+ "aria-label": l,
38
+ className: e("border-border inline-flex overflow-hidden rounded-md border", s && "cursor-not-allowed opacity-40", c),
39
+ children: r.map((t) => /* @__PURE__ */ n("button", {
40
+ type: "button",
41
+ role: "radio",
42
+ "aria-checked": t.value === f,
43
+ tabIndex: t === h ? 0 : -1,
44
+ disabled: s || t.disabled,
45
+ onKeyDown: (e) => g(e, t.value),
46
+ onClick: () => p(t.value),
47
+ className: e("font-control px-3 py-1.5 text-xs font-medium transition-colors duration-[100ms]", "focus-visible:outline-accent focus-visible:outline-2 focus-visible:outline-offset-[-2px]", t.disabled && !s && "cursor-not-allowed opacity-40", !s && !t.disabled && "cursor-pointer", t.value === f ? "bg-accent text-text-on-accent" : "bg-bg-secondary text-text-secondary hover:bg-bg-hover hover:text-text-primary"),
48
+ children: t.label
49
+ }, t.value))
50
+ });
51
+ }
52
+ //#endregion
53
+ export { r as RadioPill };
@@ -1,5 +1,5 @@
1
- import { type Key, type ReactNode } from "react";
2
- export interface ReorderListProps<T> {
1
+ import { type ComponentPropsWithRef, type Key, type ReactNode } from "react";
2
+ export interface ReorderListProps<T> extends Omit<ComponentPropsWithRef<"div">, "children" | "onChange"> {
3
3
  items: T[];
4
4
  /** Unique, stable identity; never use the item's current index. */
5
5
  getKey: (item: T) => Key;
@@ -17,4 +17,4 @@ export interface ReorderListProps<T> {
17
17
  /** Disable list actions; caller-owned content and add controls manage their own disabled state. */
18
18
  disabled?: boolean;
19
19
  }
20
- export declare function ReorderList<T>({ items, getKey, renderItem, onReorder, onRemove, canRemove, getItemLabel, addButton, disabled, }: ReorderListProps<T>): import("react/jsx-runtime").JSX.Element;
20
+ export declare function ReorderList<T>({ items, getKey, renderItem, onReorder, onRemove, canRemove, getItemLabel, addButton, disabled, className, ref, ...rest }: ReorderListProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,123 @@
1
+ import { cn as e } from "../../lib/cn.js";
2
+ import { Button as t } from "./Button.js";
3
+ import { useLayoutEffect as n, useRef as r, useState as i } from "react";
4
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
5
+ import { ArrowDown as s, ArrowUp as c, Trash2 as l } from "lucide-react";
6
+ //#region src/components/ui/ReorderList.tsx
7
+ function u({ items: u, getKey: d, renderItem: f, onReorder: p, onRemove: m, canRemove: h, getItemLabel: g, addButton: _, disabled: v = !1, className: y, ref: b, ...x }) {
8
+ let [S, C] = i(""), w = r(/* @__PURE__ */ new Map()), T = r(null), E = r(null);
9
+ n(() => {
10
+ let e = T.current;
11
+ e && u[e.index] !== void 0 && d(u[e.index]) === e.key && (w.current.get(e.key)?.[e.direction]?.focus(), T.current = null);
12
+ let t = E.current;
13
+ if (!t || u.some((e) => d(e) === t.key)) return;
14
+ let n = u[Math.min(t.index, u.length - 1)];
15
+ if (n !== void 0) {
16
+ let e = w.current.get(d(n));
17
+ (e?.remove ?? e?.down ?? e?.up)?.focus();
18
+ }
19
+ E.current = null;
20
+ }, [u, d]);
21
+ function D(e, t) {
22
+ let n = e + t;
23
+ if (v || n < 0 || n >= u.length) return;
24
+ let r = [...u];
25
+ [r[e], r[n]] = [r[n], r[e]], T.current = {
26
+ key: d(u[e]),
27
+ index: n,
28
+ direction: t === -1 ? "up" : "down"
29
+ }, p(r), C(`${g(u[e])} moved to position ${n + 1} of ${u.length}`);
30
+ }
31
+ return /* @__PURE__ */ o("div", {
32
+ ref: b,
33
+ ...x,
34
+ className: e("space-y-3", y),
35
+ children: [
36
+ /* @__PURE__ */ a("ol", {
37
+ role: "list",
38
+ className: "space-y-3",
39
+ children: u.map((n, r) => {
40
+ let i = d(n), p = g(n);
41
+ return /* @__PURE__ */ o("li", {
42
+ className: "border-border space-y-3 rounded-md border p-3",
43
+ children: [/* @__PURE__ */ o("div", {
44
+ className: "flex items-center justify-end gap-1.5",
45
+ children: [
46
+ /* @__PURE__ */ a(t, {
47
+ ref: (e) => {
48
+ let t = w.current.get(i) ?? {
49
+ up: null,
50
+ down: null,
51
+ remove: null
52
+ };
53
+ t.up = e, t.up || t.down || t.remove ? w.current.set(i, t) : w.current.delete(i);
54
+ },
55
+ variant: "ghost",
56
+ size: "sm",
57
+ icon: c,
58
+ "aria-label": `Move ${p} up`,
59
+ disabled: v,
60
+ "aria-disabled": r === 0 || v,
61
+ className: e(r === 0 && "cursor-not-allowed opacity-40"),
62
+ onClick: () => D(r, -1),
63
+ children: "Up"
64
+ }),
65
+ /* @__PURE__ */ a(t, {
66
+ ref: (e) => {
67
+ let t = w.current.get(i) ?? {
68
+ up: null,
69
+ down: null,
70
+ remove: null
71
+ };
72
+ t.down = e, t.up || t.down || t.remove ? w.current.set(i, t) : w.current.delete(i);
73
+ },
74
+ variant: "ghost",
75
+ size: "sm",
76
+ icon: s,
77
+ "aria-label": `Move ${p} down`,
78
+ disabled: v,
79
+ "aria-disabled": r === u.length - 1 || v,
80
+ className: e(r === u.length - 1 && "cursor-not-allowed opacity-40"),
81
+ onClick: () => D(r, 1),
82
+ children: "Down"
83
+ }),
84
+ m && (h?.(n, r) ?? !0) && /* @__PURE__ */ a(t, {
85
+ ref: (e) => {
86
+ let t = w.current.get(i) ?? {
87
+ up: null,
88
+ down: null,
89
+ remove: null
90
+ };
91
+ t.remove = e, t.up || t.down || t.remove ? w.current.set(i, t) : w.current.delete(i);
92
+ },
93
+ variant: "ghost",
94
+ size: "sm",
95
+ icon: l,
96
+ "aria-label": `Remove ${p}`,
97
+ disabled: v,
98
+ onClick: () => {
99
+ E.current = {
100
+ key: i,
101
+ index: r
102
+ }, m(n, r), C(`${p} removed`);
103
+ },
104
+ children: "Remove"
105
+ })
106
+ ]
107
+ }), f(n, r)]
108
+ }, i);
109
+ })
110
+ }),
111
+ /* @__PURE__ */ a("div", {
112
+ role: "status",
113
+ "aria-live": "polite",
114
+ "aria-atomic": "true",
115
+ className: "sr-only",
116
+ children: S
117
+ }),
118
+ _
119
+ ]
120
+ });
121
+ }
122
+ //#endregion
123
+ export { u as ReorderList };
@@ -1,10 +1,12 @@
1
- import { type InputHTMLAttributes, type ReactNode } from "react";
1
+ import { type ComponentPropsWithRef, type ReactNode } from "react";
2
2
  import { type LucideIcon } from "lucide-react";
3
- export interface SearchInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "type" | "children" | "dangerouslySetInnerHTML" | "defaultValue"> {
3
+ export interface SearchInputProps extends Omit<ComponentPropsWithRef<"input">, "value" | "defaultValue" | "type" | "children" | "dangerouslySetInnerHTML"> {
4
4
  /** Current search text (controlled). */
5
- value: string;
5
+ value?: string;
6
+ /** Initial text when uncontrolled. */
7
+ defaultValue?: string;
6
8
  /** Called with the new text on every change. */
7
- onChange: (value: string) => void;
9
+ onValueChange?: (value: string) => void;
8
10
  /** Placeholder text. Defaults to "Search...". */
9
11
  placeholder?: string;
10
12
  /** Additional utility classes appended to the wrapper. */
@@ -18,4 +20,4 @@ export interface SearchInputProps extends Omit<InputHTMLAttributes<HTMLInputElem
18
20
  /** Message shown below the input while invalid. */
19
21
  errorMessage?: ReactNode;
20
22
  }
21
- export declare function SearchInput({ value, onChange, placeholder, className, inputClassName, icon: Icon, invalid, errorMessage, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy, ...inputProps }: SearchInputProps): import("react/jsx-runtime").JSX.Element;
23
+ export declare function SearchInput({ value: valueProp, defaultValue, onValueChange, onChange, placeholder, className, inputClassName, icon: Icon, invalid, errorMessage, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy, ref, ...inputProps }: SearchInputProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,49 @@
1
+ import { cn as e } from "../../lib/cn.js";
2
+ import { useControllableState as t } from "../../hooks/useControllableState.js";
3
+ import { describeField as n } from "./FieldContext.js";
4
+ import { useId as r } from "react";
5
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ import { AlertTriangle as o, Search as s } from "lucide-react";
7
+ //#region src/components/ui/SearchInput.tsx
8
+ function c({ value: c, defaultValue: l = "", onValueChange: u, onChange: d, placeholder: f = "Search...", className: p, inputClassName: m, icon: h = s, invalid: g = !1, errorMessage: _, "aria-invalid": v, "aria-describedby": y, ref: b, ...x }) {
9
+ let [S, C] = t({
10
+ value: c,
11
+ defaultValue: l,
12
+ onChange: u
13
+ }), w = `${r()}-error`, T = g || v != null && v !== !1 && v !== "false", E = T && _ != null && typeof _ != "boolean" && _ !== "";
14
+ return /* @__PURE__ */ a("div", {
15
+ className: e("flex flex-col gap-1.5", p),
16
+ children: [/* @__PURE__ */ a("div", {
17
+ className: "relative",
18
+ children: [
19
+ /* @__PURE__ */ i(h, {
20
+ "aria-hidden": "true",
21
+ className: "text-text-tertiary pointer-events-none absolute top-1/2 left-2 h-3.5 w-3.5 -translate-y-1/2"
22
+ }),
23
+ /* @__PURE__ */ i("input", {
24
+ ...x,
25
+ ref: b,
26
+ type: "search",
27
+ value: S,
28
+ onChange: (e) => {
29
+ d?.(e), C(e.target.value);
30
+ },
31
+ placeholder: f,
32
+ "aria-invalid": g ? !0 : v,
33
+ "aria-describedby": n(y, E ? w : void 0),
34
+ className: e("bg-bg-secondary text-text-primary h-7 w-full pl-7 text-xs", !T && "pr-2", "border-border rounded-md border", "placeholder:text-text-placeholder", "transition-colors duration-[100ms]", "focus:outline-none", T ? "border-danger focus:border-danger" : "focus:border-accent", T && "search-input-invalid", m)
35
+ }),
36
+ T && /* @__PURE__ */ i(o, {
37
+ "aria-hidden": "true",
38
+ className: "search-input-warning text-danger pointer-events-none absolute top-1/2 h-3.5 w-3.5 -translate-y-1/2"
39
+ })
40
+ ]
41
+ }), E && /* @__PURE__ */ i("p", {
42
+ id: w,
43
+ className: "text-2xs text-danger-fg",
44
+ children: _
45
+ })]
46
+ });
47
+ }
48
+ //#endregion
49
+ export { c as SearchInput };
@@ -15,8 +15,8 @@
15
15
  * <SectionHeader as="h3" className="mb-4">Settings</SectionHeader>
16
16
  * ```
17
17
  */
18
- import type { ElementType, ReactNode } from "react";
19
- export interface SectionHeaderProps {
18
+ import type { ComponentPropsWithRef, ElementType, ReactNode } from "react";
19
+ export interface SectionHeaderProps extends Omit<ComponentPropsWithRef<"h2">, "children"> {
20
20
  /** The heading text or content. */
21
21
  children: ReactNode;
22
22
  /**
@@ -30,4 +30,4 @@ export interface SectionHeaderProps {
30
30
  /** Render the dividing bottom border. Defaults to true. */
31
31
  border?: boolean;
32
32
  }
33
- export declare function SectionHeader({ children, as: Tag, className, border, }: SectionHeaderProps): import("react/jsx-runtime").JSX.Element;
33
+ export declare function SectionHeader({ children, as: Tag, className, border, ref, ...rest }: SectionHeaderProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { cn as e } from "../../lib/cn.js";
2
+ import { jsx as t } from "react/jsx-runtime";
3
+ //#region src/components/ui/SectionHeader.tsx
4
+ function n({ children: n, as: r = "h2", className: i, border: a = !0, ref: o, ...s }) {
5
+ return /* @__PURE__ */ t(r, {
6
+ ref: o,
7
+ ...s,
8
+ className: e("text-text-primary font-heading text-xs font-semibold", a && "border-border border-b pb-2", i),
9
+ children: n
10
+ });
11
+ }
12
+ //#endregion
13
+ export { n as SectionHeader };
@@ -1,4 +1,4 @@
1
- import { type SelectHTMLAttributes } from "react";
1
+ import { type ComponentPropsWithRef } from "react";
2
2
  import { type ControlSize } from "../../providers/ControlSizeContext";
3
3
  export interface SelectOption {
4
4
  value: string;
@@ -11,12 +11,12 @@ export interface SelectOptionGroup {
11
11
  /** Groups contain leaf options; nested groups are not supported. */
12
12
  options: SelectOption[];
13
13
  }
14
- export interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, "value"> {
14
+ export interface SelectProps extends Omit<ComponentPropsWithRef<"select">, "value"> {
15
15
  /** Label text rendered above the select and linked to it. */
16
16
  label?: string;
17
17
  /** Render the label inside an empty single-select control. Listboxes retain the above label. */
18
18
  labelPlacement?: "above" | "placeholder";
19
- value?: SelectHTMLAttributes<HTMLSelectElement>["value"] | null;
19
+ value?: ComponentPropsWithRef<"select">["value"] | null;
20
20
  /** Error message shown next to the label; also marks the select invalid and turns the border red. */
21
21
  error?: string;
22
22
  /** Helper text shown above the select and linked via `aria-describedby`. */
@@ -26,4 +26,4 @@ export interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement
26
26
  /** Leaf choices and labelled groups, rendered as native options and optgroups. */
27
27
  options: (SelectOption | SelectOptionGroup)[];
28
28
  }
29
- export declare const Select: import("react").ForwardRefExoticComponent<SelectProps & import("react").RefAttributes<HTMLSelectElement>>;
29
+ export declare function Select({ label, labelPlacement, error, options, className, id, hint, controlSize, required, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, ref, ...props }: SelectProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,117 @@
1
+ import { cn as e } from "../../lib/cn.js";
2
+ import { useControlSize as t } from "../../providers/ControlSizeContext.js";
3
+ import { useFieldControl as n } from "./useFieldControl.js";
4
+ import { useCallback as r, useEffect as i, useRef as a, useState as o } from "react";
5
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
6
+ import { ChevronDown as l } from "lucide-react";
7
+ //#region src/components/ui/Select.tsx
8
+ function u({ label: u, labelPlacement: d = "above", error: f, options: p, className: m, id: h, hint: g, controlSize: _, required: v, "aria-describedby": y, "aria-invalid": b, ref: x, ...S }) {
9
+ let C = n({
10
+ id: h,
11
+ error: f,
12
+ hint: g,
13
+ describedBy: y,
14
+ invalid: b,
15
+ required: v
16
+ }), { inputId: w, errorId: T, hintId: E } = C, D = t(_), O = a(null), k = r((e) => {
17
+ if (O.current = e, typeof x == "function") return x(e);
18
+ x && (x.current = e);
19
+ }, [x]), A = d === "placeholder" && u ? u : u ? void 0 : C.placeholderLabel, j = !!A && !S.multiple && (!S.size || S.size <= 1), M = S.value !== void 0, [N, P] = o(S.value ?? S.defaultValue ?? ""), F = M ? S.value ?? "" : N, I = j && F === "", L = p.some((e) => !("options" in e) && e.value === ""), R = (e) => /* @__PURE__ */ s("option", {
20
+ value: e.value,
21
+ disabled: e.disabled,
22
+ style: j ? { color: "var(--text-primary)" } : void 0,
23
+ children: e.label
24
+ }, e.value);
25
+ return i(() => {
26
+ let e = O.current;
27
+ if (!e || M || !j) return;
28
+ let t = !0;
29
+ queueMicrotask(() => {
30
+ t && P(e.value);
31
+ });
32
+ let n = e.form, r, i = () => {
33
+ clearTimeout(r), r = setTimeout(() => {
34
+ P(e.value);
35
+ }, 0);
36
+ };
37
+ n?.addEventListener("reset", i);
38
+ let a = new MutationObserver(() => {
39
+ P(e.value);
40
+ });
41
+ return a.observe(e, {
42
+ childList: !0,
43
+ subtree: !0,
44
+ attributes: !0,
45
+ attributeFilter: ["value", "selected"]
46
+ }), () => {
47
+ t = !1, n?.removeEventListener("reset", i), a.disconnect(), clearTimeout(r);
48
+ };
49
+ }, [
50
+ M,
51
+ j,
52
+ S.form
53
+ ]), /* @__PURE__ */ c("div", {
54
+ className: "flex flex-col gap-1.5",
55
+ children: [
56
+ g && /* @__PURE__ */ s("p", {
57
+ id: E,
58
+ className: "text-text-secondary text-xs",
59
+ children: g
60
+ }),
61
+ (u || f) && /* @__PURE__ */ c("div", {
62
+ className: e("flex items-center justify-between", j && !f && "sr-only"),
63
+ children: [u && /* @__PURE__ */ s("label", {
64
+ htmlFor: w,
65
+ className: e("ui-field-label font-label text-xs font-medium", j && "sr-only"),
66
+ children: u
67
+ }), f && /* @__PURE__ */ s("p", {
68
+ id: T,
69
+ className: "text-2xs text-danger-fg",
70
+ children: f
71
+ })]
72
+ }),
73
+ /* @__PURE__ */ c("div", {
74
+ className: "relative",
75
+ "data-control-size": j ? D : void 0,
76
+ children: [
77
+ /* @__PURE__ */ c("select", {
78
+ ref: j ? k : x,
79
+ "data-control-size": D,
80
+ required: C.required,
81
+ "aria-invalid": C.invalid,
82
+ "aria-describedby": C.describedBy,
83
+ id: w,
84
+ className: e("ui-sized-control bg-bg-secondary text-text-primary font-control h-7 w-full px-2 pr-7 text-xs", "appearance-none rounded-md border", "transition-colors duration-[100ms]", "focus:border-accent focus:outline-none", "disabled:cursor-not-allowed disabled:opacity-40", "cursor-pointer", f ? "border-danger" : "border-border", m),
85
+ ...S,
86
+ value: j && M ? S.value ?? "" : S.value ?? void 0,
87
+ defaultValue: j && !M ? S.defaultValue ?? "" : S.defaultValue,
88
+ onChange: j ? (e) => {
89
+ M || P(e.currentTarget.value), S.onChange?.(e);
90
+ } : S.onChange,
91
+ style: I ? {
92
+ ...S.style,
93
+ color: "transparent"
94
+ } : S.style,
95
+ children: [j && !L && /* @__PURE__ */ s("option", {
96
+ value: "",
97
+ disabled: !0,
98
+ hidden: !0
99
+ }), p.map((e, t) => "options" in e ? /* @__PURE__ */ s("optgroup", {
100
+ label: e.label,
101
+ style: j ? { color: "var(--text-primary)" } : void 0,
102
+ children: e.options.map(R)
103
+ }, `group-${t}`) : R(e))]
104
+ }),
105
+ I && /* @__PURE__ */ s("span", {
106
+ "aria-hidden": "true",
107
+ className: "ui-select-placeholder text-text-placeholder font-control pointer-events-none absolute top-1/2 -translate-y-1/2 truncate",
108
+ children: A
109
+ }),
110
+ /* @__PURE__ */ s(l, { className: "text-text-tertiary pointer-events-none absolute top-1/2 right-2.5 h-3.5 w-3.5 -translate-y-1/2" })
111
+ ]
112
+ })
113
+ ]
114
+ });
115
+ }
116
+ //#endregion
117
+ export { u as Select };
@@ -1,10 +1,15 @@
1
+ import { type ComponentPropsWithRef } from "react";
1
2
  import type { SelectOption, SelectOptionGroup } from "./Select";
2
3
  export type SelectDropdownSize = "sm" | "md";
3
- export interface SelectDropdownProps {
4
+ export interface SelectDropdownProps extends Omit<ComponentPropsWithRef<"div">, "defaultValue" | "children" | "onChange"> {
4
5
  /** Flat options, labelled groups, or a mix of both. Disabled leaves are skipped. */
5
6
  options: (SelectOption | SelectOptionGroup)[];
7
+ /** Selected value (controlled). */
6
8
  value?: string | null;
7
- onChange: (value: string) => void;
9
+ /** Initially selected value when uncontrolled. */
10
+ defaultValue?: string | null;
11
+ /** Called with the chosen option's value. */
12
+ onValueChange?: (value: string) => void;
8
13
  label?: string;
9
14
  /** Render the label in the empty trigger, including when an empty-valued option is selected. */
10
15
  labelPlacement?: "above" | "placeholder";
@@ -22,4 +27,4 @@ export interface SelectDropdownProps {
22
27
  * typed text (the text resets after a short pause, and repeating a letter
23
28
  * cycles); on the closed trigger it selects the match without opening.
24
29
  */
25
- export declare function SelectDropdown({ options: entries, value, onChange, label, labelPlacement, placeholder, className, size, disabled, }: SelectDropdownProps): import("react/jsx-runtime").JSX.Element;
30
+ export declare function SelectDropdown({ options: entries, value: valueProp, defaultValue, onValueChange, label, labelPlacement, placeholder, className, size, disabled, ref, ...rest }: SelectDropdownProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,206 @@
1
+ import { cn as e } from "../../lib/cn.js";
2
+ import { mergeRefs as t } from "../../lib/mergeRefs.js";
3
+ import { useControllableState as n } from "../../hooks/useControllableState.js";
4
+ import { usePopover as r } from "../../hooks/usePopover.js";
5
+ import { findTypeaheadMatch as i, isTypeaheadKey as a } from "../../lib/typeahead.js";
6
+ import { useTypeahead as o } from "../../hooks/useTypeahead.js";
7
+ import { FieldContext as s } from "./FieldContext.js";
8
+ import { useContext as ee, useEffect as c, useMemo as te, useRef as l, useState as ne } from "react";
9
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
10
+ import { Check as f, ChevronDown as re } from "lucide-react";
11
+ //#region src/components/ui/SelectDropdown.tsx
12
+ function ie(e) {
13
+ let t = 0;
14
+ return e.map((e) => {
15
+ let n = t;
16
+ return t += "options" in e ? e.options.length : 1, {
17
+ entry: e,
18
+ firstIndex: n
19
+ };
20
+ });
21
+ }
22
+ function p({ options: p, value: m, defaultValue: h = null, onValueChange: g, label: _, labelPlacement: v = "above", placeholder: y = "Select...", className: b, size: x = "md", disabled: S = !1, ref: C, ...w }) {
23
+ let T = ee(s), [E, D] = n({
24
+ value: m,
25
+ defaultValue: h,
26
+ onChange: (e) => g?.(e)
27
+ }), O = v === "placeholder" && _ ? _ : _ ? void 0 : T?.placeholderLabel, k = p.flatMap((e) => "options" in e ? e.options : [e]), [A, j] = ne(-1), { open: M, show: ae, close: N, rootRef: P, anchorRef: oe, triggerRef: se, popupRef: F, labelId: I, popupId: L, triggerAria: R } = r({
28
+ haspopup: "listbox",
29
+ matchWidth: !0,
30
+ labelled: !!_,
31
+ disabled: S
32
+ }), z = te(() => t(C, P), [C, P]), B = o(), V = l(!1), H = l(!1), U = (e) => `${L}-option-${e}`, W = !_ && T?.id ? T.labelId : void 0, G = T?.claimLabel;
33
+ c(() => {
34
+ if (W && G) return G();
35
+ }, [W, G]), c(() => {
36
+ S && N("disabled");
37
+ }, [
38
+ S,
39
+ M,
40
+ N
41
+ ]);
42
+ let K = O && !E ? void 0 : k.find((e) => e.value === E), q = l(!1);
43
+ c(() => {
44
+ q.current && !M && B.clear(), q.current = M;
45
+ }), c(() => {
46
+ !M || !V.current || (V.current = !1, document.getElementById(U(A))?.scrollIntoView({ block: "nearest" }));
47
+ });
48
+ function J() {
49
+ let e = k.findIndex((e) => e.value === E);
50
+ B.clear(), X(e >= 0 && !k[e].disabled ? e : Q(1)), ae();
51
+ }
52
+ function Y(e) {
53
+ S || e.disabled || (D(e.value), N("select"));
54
+ }
55
+ function ce(e) {
56
+ S || H.current && (H.current = !1, e.detail === 0) || (M ? N("toggle") : J());
57
+ }
58
+ function X(e) {
59
+ V.current = !0, j(e);
60
+ }
61
+ function Z(e, t) {
62
+ for (let n = e + t; n >= 0 && n < k.length; n += t) if (!k[n].disabled) return n;
63
+ return e;
64
+ }
65
+ function Q(e) {
66
+ let t = Z(e === 1 ? -1 : k.length, e);
67
+ return t >= 0 && t < k.length ? t : -1;
68
+ }
69
+ function le(e) {
70
+ e.preventDefault();
71
+ let t = B.push(e.key), n = k.map((e) => e.label), r = (e) => !!k[e].disabled;
72
+ if (M) {
73
+ let e = i(n, r, A, t);
74
+ e !== -1 && X(e);
75
+ } else {
76
+ let e = i(n, r, k.findIndex((e) => e.value === E), t);
77
+ e !== -1 && k[e].value !== E && D(k[e].value);
78
+ }
79
+ }
80
+ function ue(e) {
81
+ e.key === " " && H.current && e.preventDefault();
82
+ }
83
+ function de(e) {
84
+ if (!S) {
85
+ if (H.current = !1, e.key === " " && (M || B.active()) && (H.current = !0), a(e) && (e.key !== " " || B.active())) {
86
+ le(e);
87
+ return;
88
+ }
89
+ if (!M) {
90
+ (e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), J());
91
+ return;
92
+ }
93
+ switch (e.key) {
94
+ case "ArrowDown":
95
+ e.preventDefault(), X(Z(A, 1));
96
+ break;
97
+ case "ArrowUp":
98
+ e.preventDefault(), X(Z(A, -1));
99
+ break;
100
+ case "Home":
101
+ e.preventDefault();
102
+ {
103
+ let e = Q(1);
104
+ e !== -1 && X(e);
105
+ }
106
+ break;
107
+ case "End":
108
+ e.preventDefault();
109
+ {
110
+ let e = Q(-1);
111
+ e !== -1 && X(e);
112
+ }
113
+ break;
114
+ case "Enter":
115
+ case " ": {
116
+ e.preventDefault();
117
+ let t = k[A];
118
+ t && !t.disabled && Y(t);
119
+ break;
120
+ }
121
+ case "Escape":
122
+ e.preventDefault(), N("escape");
123
+ break;
124
+ }
125
+ }
126
+ }
127
+ function $(t, n) {
128
+ return /* @__PURE__ */ d("li", {
129
+ id: U(n),
130
+ role: "option",
131
+ "aria-selected": t.value === E,
132
+ "aria-disabled": t.disabled || void 0,
133
+ onClick: () => {
134
+ t.disabled || Y(t);
135
+ },
136
+ onMouseEnter: () => {
137
+ t.disabled || j(n);
138
+ },
139
+ className: e("font-control flex h-7 w-full items-center gap-2 px-3 text-xs", !t.disabled && "cursor-pointer", "transition-colors duration-[100ms]", t.disabled ? "text-text-disabled cursor-not-allowed" : n === A ? "bg-accent-muted text-accent-fg" : t.value === E ? "text-accent-fg" : "text-text-secondary hover:text-text-primary hover:bg-bg-hover"),
140
+ children: [/* @__PURE__ */ u("span", {
141
+ className: "flex-1 truncate",
142
+ children: t.label
143
+ }), t.value === E && /* @__PURE__ */ u(f, { className: "h-3 w-3 shrink-0" })]
144
+ }, t.value);
145
+ }
146
+ let fe = ie(p);
147
+ return /* @__PURE__ */ d("div", {
148
+ ...w,
149
+ className: e("flex flex-col gap-1.5", b),
150
+ ref: z,
151
+ children: [_ && /* @__PURE__ */ u("span", {
152
+ id: I,
153
+ className: e("ui-field-label font-label text-xs font-medium", v === "placeholder" && "sr-only"),
154
+ children: _
155
+ }), /* @__PURE__ */ d("div", {
156
+ className: "relative",
157
+ ref: oe,
158
+ children: [
159
+ /* @__PURE__ */ u("button", {
160
+ type: "button",
161
+ disabled: S,
162
+ onClick: ce,
163
+ onKeyDown: de,
164
+ onKeyUp: ue,
165
+ ref: se,
166
+ ...R,
167
+ id: T?.id ?? R.id,
168
+ "aria-labelledby": _ && T?.id ? `${I} ${T.id}` : W && G ? `${W} ${T?.id}` : R["aria-labelledby"],
169
+ "aria-describedby": T?.describedBy,
170
+ "aria-invalid": T?.invalid || void 0,
171
+ "aria-activedescendant": M && A >= 0 && k[A] && !k[A].disabled ? U(A) : void 0,
172
+ className: e("font-control flex w-full cursor-pointer items-center rounded-md text-xs", "bg-bg-secondary border-border text-text-primary border", "transition-colors duration-[100ms]", "focus-visible:outline-accent focus-visible:outline-2 focus-visible:outline-offset-2", x === "sm" ? "h-6 px-2 pr-6" : "h-7 px-2 pr-7", S ? "cursor-not-allowed opacity-40" : "hover:bg-bg-hover hover:border-border-strong"),
173
+ children: K ? K.label : /* @__PURE__ */ u("span", {
174
+ className: "text-text-placeholder",
175
+ "aria-hidden": O ? !0 : void 0,
176
+ children: O ?? y
177
+ })
178
+ }),
179
+ /* @__PURE__ */ u(re, { className: e("text-text-tertiary pointer-events-none absolute top-1/2 h-3 w-3 -translate-y-1/2 transition-transform", x === "sm" ? "right-1.5" : "right-2", M && "rotate-180") }),
180
+ M && !S && /* @__PURE__ */ u("div", {
181
+ ref: F,
182
+ 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", "overflow-hidden"),
183
+ children: /* @__PURE__ */ u("ul", {
184
+ id: L,
185
+ className: "max-h-48 overflow-y-auto py-1",
186
+ role: "listbox",
187
+ children: fe.map(({ entry: e, firstIndex: t }, n) => "options" in e ? /* @__PURE__ */ d("li", {
188
+ role: "group",
189
+ "aria-label": e.label,
190
+ children: [/* @__PURE__ */ u("div", {
191
+ "aria-hidden": "true",
192
+ className: "text-text-tertiary px-3 py-1 text-2xs font-medium",
193
+ children: e.label
194
+ }), /* @__PURE__ */ u("ul", {
195
+ role: "presentation",
196
+ children: e.options.map((e, n) => $(e, t + n))
197
+ })]
198
+ }, `group-${n}`) : $(e, t))
199
+ })
200
+ })
201
+ ]
202
+ })]
203
+ });
204
+ }
205
+ //#endregion
206
+ export { p as SelectDropdown };