jenosize-ui 0.1.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 (182) hide show
  1. package/LICENSE +28 -0
  2. package/README.md +100 -0
  3. package/THIRD-PARTY-NOTICES.md +163 -0
  4. package/dist/Button-Bt7pzM4R.d.ts +82 -0
  5. package/dist/PaymentInput-CKPIPNWH.d.ts +141 -0
  6. package/dist/Select-CVbEQ2Ep.d.ts +118 -0
  7. package/dist/TagInput-CTJYOB4J.d.ts +90 -0
  8. package/dist/avatar.d.ts +161 -0
  9. package/dist/avatar.js +11 -0
  10. package/dist/badge.d.ts +109 -0
  11. package/dist/badge.js +10 -0
  12. package/dist/breadcrumb.d.ts +58 -0
  13. package/dist/breadcrumb.js +7 -0
  14. package/dist/button.d.ts +54 -0
  15. package/dist/button.js +14 -0
  16. package/dist/calendar.d.ts +368 -0
  17. package/dist/calendar.js +21 -0
  18. package/dist/callout.d.ts +70 -0
  19. package/dist/callout.js +16 -0
  20. package/dist/card-nWicloNi.d.ts +80 -0
  21. package/dist/card.d.ts +2 -0
  22. package/dist/card.js +7 -0
  23. package/dist/checkbox.d.ts +133 -0
  24. package/dist/checkbox.js +11 -0
  25. package/dist/chunk-24TO7E32.js +42 -0
  26. package/dist/chunk-3Y5X7B5C.js +146 -0
  27. package/dist/chunk-4OLULPQG.js +202 -0
  28. package/dist/chunk-4P2NBLBW.js +103 -0
  29. package/dist/chunk-52IFGFTL.js +11 -0
  30. package/dist/chunk-5FATN5YD.js +115 -0
  31. package/dist/chunk-5NOBSXJN.js +297 -0
  32. package/dist/chunk-5RAPA22E.js +106 -0
  33. package/dist/chunk-7EUAMHMU.js +16 -0
  34. package/dist/chunk-7EWQKTNQ.js +1336 -0
  35. package/dist/chunk-7HOIZ3UO.js +110 -0
  36. package/dist/chunk-7IU5TMFL.js +452 -0
  37. package/dist/chunk-7JBNLEJ7.js +29 -0
  38. package/dist/chunk-7S2TBALK.js +23 -0
  39. package/dist/chunk-BJUZVYQC.js +188 -0
  40. package/dist/chunk-BVJWBYIG.js +66 -0
  41. package/dist/chunk-CME4DIML.js +65 -0
  42. package/dist/chunk-CYPPEUX5.js +73 -0
  43. package/dist/chunk-D5BTFSL7.js +71 -0
  44. package/dist/chunk-D6TPWNRK.js +387 -0
  45. package/dist/chunk-DJSXIAFH.js +66 -0
  46. package/dist/chunk-DRZCJCBO.js +46 -0
  47. package/dist/chunk-DWKILXHE.js +17 -0
  48. package/dist/chunk-E7ZSWBAK.js +70 -0
  49. package/dist/chunk-EDSK6FEH.js +8 -0
  50. package/dist/chunk-F2K7VJUV.js +114 -0
  51. package/dist/chunk-F6NLE6XJ.js +40 -0
  52. package/dist/chunk-FHHAPGCR.js +32 -0
  53. package/dist/chunk-FXIBGTS5.js +14 -0
  54. package/dist/chunk-GCVA3OIV.js +72 -0
  55. package/dist/chunk-GFOAJVW5.js +336 -0
  56. package/dist/chunk-GRLSUQQE.js +136 -0
  57. package/dist/chunk-GTHJWR3Q.js +77 -0
  58. package/dist/chunk-HMUZE6EK.js +67 -0
  59. package/dist/chunk-I7WU4GTY.js +503 -0
  60. package/dist/chunk-J2BCKBHC.js +151 -0
  61. package/dist/chunk-J36M3KRX.js +1315 -0
  62. package/dist/chunk-J7ZQQFPT.js +113 -0
  63. package/dist/chunk-JP26LPCY.js +234 -0
  64. package/dist/chunk-JTNFJLIY.js +1046 -0
  65. package/dist/chunk-JVJRHBTD.js +50 -0
  66. package/dist/chunk-JYGR44ZC.js +133 -0
  67. package/dist/chunk-KDLPXXD2.js +173 -0
  68. package/dist/chunk-KMSYEE23.js +224 -0
  69. package/dist/chunk-KNYKWUYX.js +52 -0
  70. package/dist/chunk-LME57Z6J.js +138 -0
  71. package/dist/chunk-MFJP5FA7.js +20 -0
  72. package/dist/chunk-MKC5HNA7.js +1692 -0
  73. package/dist/chunk-MQGD2OUF.js +39 -0
  74. package/dist/chunk-MUFHLP4S.js +566 -0
  75. package/dist/chunk-O2LG3PNI.js +74 -0
  76. package/dist/chunk-O4GRKO3I.js +66 -0
  77. package/dist/chunk-OHUFNYGN.js +791 -0
  78. package/dist/chunk-PWKWNDBS.js +243 -0
  79. package/dist/chunk-QA74ITR4.js +103 -0
  80. package/dist/chunk-R6RGJF4L.js +170 -0
  81. package/dist/chunk-S7NNXWIN.js +7 -0
  82. package/dist/chunk-SV56BSUQ.js +162 -0
  83. package/dist/chunk-T7FCG7XV.js +435 -0
  84. package/dist/chunk-THC2ISYP.js +57 -0
  85. package/dist/chunk-VWC72TR3.js +115 -0
  86. package/dist/chunk-W46K56XU.js +216 -0
  87. package/dist/chunk-W5GGOUUI.js +75 -0
  88. package/dist/chunk-WEUJYDCV.js +269 -0
  89. package/dist/chunk-WFY7DKQD.js +279 -0
  90. package/dist/chunk-WZQFC7ZN.js +448 -0
  91. package/dist/chunk-Z3ETJN5G.js +136 -0
  92. package/dist/chunk-ZOOX3TUB.js +192 -0
  93. package/dist/chunk-ZSNJ6UA3.js +42 -0
  94. package/dist/chunk-ZZA2LUTL.js +130 -0
  95. package/dist/chunk-ZZT2E5VT.js +24 -0
  96. package/dist/color-CtSxc1Rh.d.ts +6 -0
  97. package/dist/combobox.d.ts +184 -0
  98. package/dist/combobox.js +21 -0
  99. package/dist/date-input.d.ts +83 -0
  100. package/dist/date-input.js +16 -0
  101. package/dist/date-picker.d.ts +249 -0
  102. package/dist/date-picker.js +29 -0
  103. package/dist/date-utils-7hTFTXNK.d.ts +34 -0
  104. package/dist/date-vMJBKAFK.d.ts +22 -0
  105. package/dist/dialog.d.ts +86 -0
  106. package/dist/dialog.js +15 -0
  107. package/dist/drawer.d.ts +77 -0
  108. package/dist/drawer.js +14 -0
  109. package/dist/dropdown-menu.d.ts +218 -0
  110. package/dist/dropdown-menu.js +10 -0
  111. package/dist/file-trigger.d.ts +42 -0
  112. package/dist/file-trigger.js +3 -0
  113. package/dist/form.d.ts +487 -0
  114. package/dist/form.js +1179 -0
  115. package/dist/header-navigation.d.ts +74 -0
  116. package/dist/header-navigation.js +23 -0
  117. package/dist/icons/app.d.ts +48 -0
  118. package/dist/icons/app.js +282 -0
  119. package/dist/icons/flag.d.ts +817 -0
  120. package/dist/icons/flag.js +58336 -0
  121. package/dist/icons/integration.d.ts +36 -0
  122. package/dist/icons/integration.js +531 -0
  123. package/dist/icons/payment.d.ts +116 -0
  124. package/dist/icons/payment.js +2418 -0
  125. package/dist/icons.d.ts +2013 -0
  126. package/dist/icons.js +2012 -0
  127. package/dist/illustration.d.ts +48 -0
  128. package/dist/illustration.js +4 -0
  129. package/dist/index.d.ts +68 -0
  130. package/dist/index.js +73 -0
  131. package/dist/indicator.d.ts +51 -0
  132. package/dist/indicator.js +7 -0
  133. package/dist/input.d.ts +66 -0
  134. package/dist/input.js +15 -0
  135. package/dist/multi-value-CJb_tnvi.d.ts +8 -0
  136. package/dist/nav-Bla0o_-1.d.ts +98 -0
  137. package/dist/number-input.d.ts +80 -0
  138. package/dist/number-input.js +15 -0
  139. package/dist/options-CPEIgjtd.d.ts +68 -0
  140. package/dist/overflow-Df0h42Oi.d.ts +29 -0
  141. package/dist/pagination.d.ts +77 -0
  142. package/dist/pagination.js +17 -0
  143. package/dist/payment-input.d.ts +7 -0
  144. package/dist/payment-input.js +15 -0
  145. package/dist/popover.d.ts +60 -0
  146. package/dist/popover.js +14 -0
  147. package/dist/progress.d.ts +87 -0
  148. package/dist/progress.js +5 -0
  149. package/dist/radio.d.ts +77 -0
  150. package/dist/radio.js +12 -0
  151. package/dist/select.d.ts +68 -0
  152. package/dist/select.js +24 -0
  153. package/dist/shared-BNXAdgh2.d.ts +9 -0
  154. package/dist/shared-BYXJPnsN.d.ts +11 -0
  155. package/dist/shared-Dc-GgA16.d.ts +42 -0
  156. package/dist/sidebar-navigation.d.ts +129 -0
  157. package/dist/sidebar-navigation.js +15 -0
  158. package/dist/styles.css +2 -0
  159. package/dist/switch.d.ts +23 -0
  160. package/dist/switch.js +7 -0
  161. package/dist/table.d.ts +692 -0
  162. package/dist/table.js +44 -0
  163. package/dist/tabs.d.ts +111 -0
  164. package/dist/tabs.js +8 -0
  165. package/dist/tag-input.d.ts +12 -0
  166. package/dist/tag-input.js +19 -0
  167. package/dist/tag.d.ts +98 -0
  168. package/dist/tag.js +9 -0
  169. package/dist/textarea.d.ts +40 -0
  170. package/dist/textarea.js +12 -0
  171. package/dist/theme-script.d.ts +29 -0
  172. package/dist/theme-script.js +15 -0
  173. package/dist/theme.css +929 -0
  174. package/dist/theme.d.ts +71 -0
  175. package/dist/theme.js +15 -0
  176. package/dist/toast.d.ts +242 -0
  177. package/dist/toast.js +15 -0
  178. package/dist/tooltip.d.ts +70 -0
  179. package/dist/tooltip.js +6 -0
  180. package/dist/tree.d.ts +308 -0
  181. package/dist/tree.js +11 -0
  182. package/package.json +352 -0
@@ -0,0 +1,110 @@
1
+ import { useControlScrollFade } from './chunk-7EUAMHMU.js';
2
+ import { FieldShell } from './chunk-QA74ITR4.js';
3
+ import { useSeamlessSlot } from './chunk-KNYKWUYX.js';
4
+ import { useFieldValidity, FieldFrame } from './chunk-J2BCKBHC.js';
5
+ import { EyeOffIcon, EyeIcon } from './chunk-24TO7E32.js';
6
+ import { cn } from './chunk-ZSNJ6UA3.js';
7
+ import { Field } from '@base-ui/react/field';
8
+ import * as React from 'react';
9
+ import { jsx, Fragment } from 'react/jsx-runtime';
10
+
11
+ function InputAddon({ size: sizeProp, children, className }) {
12
+ const slot = useSeamlessSlot();
13
+ const size = sizeProp ?? slot?.size ?? "md";
14
+ return /* @__PURE__ */ jsx("span", { className: cn("flex items-center gap-1.5 px-3", size === "sm" ? "text-sm" : "text-md", className), children });
15
+ }
16
+ function Input(props) {
17
+ const {
18
+ size = "md",
19
+ fullWidth = true,
20
+ type = "text",
21
+ label,
22
+ tooltip,
23
+ tooltipDescription,
24
+ hint,
25
+ invalid = false,
26
+ error,
27
+ leading,
28
+ trailing,
29
+ leadingAddon,
30
+ trailingAddon,
31
+ scrollFade = false,
32
+ hideRequiredIndicator = false,
33
+ disabled = false,
34
+ required = false,
35
+ name,
36
+ id,
37
+ className,
38
+ ...rest
39
+ } = props;
40
+ const [revealed, setRevealed] = React.useState(false);
41
+ const isPassword = type === "password";
42
+ const controlType = isPassword ? revealed ? "text" : "password" : type;
43
+ const { isInvalid, showError } = useFieldValidity(invalid, error);
44
+ const { ref: inputRef, style: fadeStyle } = useControlScrollFade(scrollFade);
45
+ return /* @__PURE__ */ jsx(
46
+ FieldFrame,
47
+ {
48
+ label,
49
+ tooltip,
50
+ tooltipDescription,
51
+ required,
52
+ hideRequiredIndicator,
53
+ hint,
54
+ error,
55
+ isInvalid,
56
+ showError,
57
+ size,
58
+ disabled,
59
+ name,
60
+ fullWidth,
61
+ className,
62
+ children: /* @__PURE__ */ jsx(
63
+ FieldShell,
64
+ {
65
+ size,
66
+ invalid: isInvalid,
67
+ disabled,
68
+ leading,
69
+ trailing: isPassword ? void 0 : trailing,
70
+ leadingAddon,
71
+ trailingAddon,
72
+ glyphTrailing: /* @__PURE__ */ jsx(Fragment, { children: isPassword ? /* @__PURE__ */ jsx(
73
+ "button",
74
+ {
75
+ type: "button",
76
+ disabled,
77
+ onClick: () => setRevealed((v) => !v),
78
+ "aria-label": revealed ? "Hide password" : "Show password",
79
+ className: cn(
80
+ "inline-flex shrink-0 cursor-pointer text-fg-quaternary transition duration-100 ease-linear outline-none disabled:cursor-not-allowed",
81
+ "hover:text-fg-quaternary_hover focus-visible:text-fg-quaternary_hover",
82
+ "[&_svg]:size-4 [&_svg]:[stroke-width:2.25px]"
83
+ ),
84
+ children: revealed ? /* @__PURE__ */ jsx(EyeOffIcon, {}) : /* @__PURE__ */ jsx(EyeIcon, {})
85
+ }
86
+ ) : null }),
87
+ children: /* @__PURE__ */ jsx(
88
+ Field.Control,
89
+ {
90
+ id,
91
+ type: controlType,
92
+ required,
93
+ render: /* @__PURE__ */ jsx("input", { ref: inputRef }),
94
+ className: cn(
95
+ "min-w-0 flex-1 bg-transparent outline-none",
96
+ "placeholder:text-quaternary autofill:rounded-lg autofill:text-primary disabled:cursor-not-allowed"
97
+ ),
98
+ ...rest,
99
+ style: { ...rest.style, ...fadeStyle }
100
+ }
101
+ )
102
+ }
103
+ )
104
+ }
105
+ );
106
+ }
107
+
108
+ export { Input, InputAddon };
109
+ //# sourceMappingURL=chunk-7HOIZ3UO.js.map
110
+ //# sourceMappingURL=chunk-7HOIZ3UO.js.map
@@ -0,0 +1,452 @@
1
+ import { SKELETON_WIDTHS, SkeletonBar } from './chunk-FXIBGTS5.js';
2
+ import { DropdownMenu } from './chunk-JP26LPCY.js';
3
+ import { ButtonUtility } from './chunk-JVJRHBTD.js';
4
+ import { Slot } from './chunk-52IFGFTL.js';
5
+ import { PanelLeftIcon, ChevronRightIcon, ChevronDownIcon } from './chunk-24TO7E32.js';
6
+ import { TooltipExport } from './chunk-ZZA2LUTL.js';
7
+ import { devWarn } from './chunk-GCVA3OIV.js';
8
+ import { cn } from './chunk-ZSNJ6UA3.js';
9
+ import * as React from 'react';
10
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
11
+
12
+ var SidebarContext = React.createContext(null);
13
+ function useSidebar() {
14
+ const value = React.useContext(SidebarContext);
15
+ if (!value) throw new Error("[jenosize-ui] `useSidebar()` must be called inside a <SidebarProvider>.");
16
+ return value;
17
+ }
18
+ function useSidebarContext() {
19
+ return React.useContext(SidebarContext);
20
+ }
21
+ var BREAKPOINT_QUERY = {
22
+ sm: "(max-width: 639px)",
23
+ md: "(max-width: 767px)",
24
+ lg: "(max-width: 1023px)",
25
+ xl: "(max-width: 1279px)"
26
+ };
27
+ function readStored(storageKey, fallback) {
28
+ if (!storageKey || typeof window === "undefined") return fallback;
29
+ try {
30
+ const stored = localStorage.getItem(storageKey);
31
+ if (stored === "true") return true;
32
+ if (stored === "false") return false;
33
+ } catch {
34
+ }
35
+ return fallback;
36
+ }
37
+ function SidebarProvider(props) {
38
+ const { collapsed: controlled, defaultCollapsed = false, onCollapsedChange, storageKey, shortcut = true, collapseBelow, children } = props;
39
+ const [uncontrolled, setUncontrolled] = React.useState(() => readStored(storageKey, defaultCollapsed));
40
+ const collapsed = controlled ?? uncontrolled;
41
+ const collapsedRef = React.useRef(collapsed);
42
+ collapsedRef.current = collapsed;
43
+ const onChangeRef = React.useRef(onCollapsedChange);
44
+ onChangeRef.current = onCollapsedChange;
45
+ const commit = React.useCallback(
46
+ (next, remember) => {
47
+ if (controlled === void 0) setUncontrolled(next);
48
+ if (remember && storageKey) {
49
+ try {
50
+ localStorage.setItem(storageKey, String(next));
51
+ } catch {
52
+ }
53
+ }
54
+ onChangeRef.current?.(next);
55
+ },
56
+ [controlled, storageKey]
57
+ );
58
+ const setCollapsed = React.useCallback((next) => commit(next, true), [commit]);
59
+ const toggle = React.useCallback(() => commit(!collapsedRef.current, true), [commit]);
60
+ React.useEffect(() => {
61
+ if (!shortcut) return;
62
+ const onKeyDown = (event) => {
63
+ if (event.key.toLowerCase() !== "b" || !(event.metaKey || event.ctrlKey) || event.altKey || event.shiftKey) return;
64
+ event.preventDefault();
65
+ commit(!collapsedRef.current, true);
66
+ };
67
+ document.addEventListener("keydown", onKeyDown);
68
+ return () => document.removeEventListener("keydown", onKeyDown);
69
+ }, [shortcut, commit]);
70
+ React.useEffect(() => {
71
+ if (!collapseBelow || typeof window === "undefined" || !globalThis.matchMedia) return;
72
+ const query = globalThis.matchMedia(BREAKPOINT_QUERY[collapseBelow]);
73
+ const apply = () => commit(query.matches, false);
74
+ apply();
75
+ query.addEventListener("change", apply);
76
+ return () => query.removeEventListener("change", apply);
77
+ }, [collapseBelow, commit]);
78
+ const value = React.useMemo(() => ({ collapsed, setCollapsed, toggle }), [collapsed, setCollapsed, toggle]);
79
+ return /* @__PURE__ */ jsx(SidebarContext.Provider, { value, children });
80
+ }
81
+ SidebarProvider.displayName = "SidebarProvider";
82
+ function SidebarTrigger({ className }) {
83
+ const { collapsed, toggle } = useSidebar();
84
+ const label = collapsed ? "Expand sidebar" : "Collapse sidebar";
85
+ return /* @__PURE__ */ jsx(
86
+ ButtonUtility,
87
+ {
88
+ variant: "tertiary",
89
+ icon: /* @__PURE__ */ jsx(PanelLeftIcon, {}),
90
+ tooltip: label,
91
+ "aria-label": label,
92
+ "aria-expanded": !collapsed,
93
+ onClick: toggle,
94
+ className: cn(className)
95
+ }
96
+ );
97
+ }
98
+ SidebarTrigger.displayName = "SidebarTrigger";
99
+
100
+ // src/lib/nav.ts
101
+ var isNavSeparator = (item) => "separator" in item;
102
+ var isNavGroup = (item) => "group" in item;
103
+ function normalize(href) {
104
+ const hashRoute = /#(\/.*)$/.exec(href);
105
+ const raw = hashRoute?.[1] ?? href;
106
+ const path = raw.split(/[?#]/, 1)[0] ?? raw;
107
+ return path.length > 1 && path.endsWith("/") ? path.slice(0, -1) : path;
108
+ }
109
+ function linkMatches(activeHref, link) {
110
+ if (!link.href) return false;
111
+ const active = normalize(activeHref);
112
+ const href = normalize(link.href);
113
+ if (link.match === "exact") return active === href;
114
+ return active === href || active.startsWith(`${href}/`);
115
+ }
116
+ var EMPTY = { current: null, trail: /* @__PURE__ */ new Set() };
117
+ function resolveActive(items, activeHref) {
118
+ if (!activeHref) return EMPTY;
119
+ let best = null;
120
+ let bestTrail = [];
121
+ let bestLength = -1;
122
+ const consider = (link, ancestors) => {
123
+ if (!linkMatches(activeHref, link)) return;
124
+ const length = normalize(link.href ?? "").length;
125
+ if (length > bestLength) {
126
+ bestLength = length;
127
+ best = link;
128
+ bestTrail = ancestors;
129
+ }
130
+ };
131
+ const walk = (link, ancestors) => {
132
+ const children = link.items ?? [];
133
+ if (children.length > 0) {
134
+ const nested = [...ancestors, link];
135
+ for (const child of children) walk(child, nested);
136
+ }
137
+ consider(link, ancestors);
138
+ };
139
+ for (const item of items) {
140
+ if (isNavSeparator(item)) continue;
141
+ if (isNavGroup(item)) {
142
+ for (const link of item.items) walk(link, []);
143
+ continue;
144
+ }
145
+ walk(item, []);
146
+ }
147
+ return { current: best, trail: new Set(bestTrail) };
148
+ }
149
+ var ROW_WRAP = "group/row relative flex items-center";
150
+ var ROW_BASE = "relative flex min-w-0 flex-1 cursor-pointer items-center rounded-lg p-2 text-left outline-focus-ring transition-colors duration-100 ease-linear select-none focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2";
151
+ var ROW_IDLE = "group-hover/row:bg-secondary";
152
+ var ROW_DISABLED = "cursor-not-allowed opacity-50";
153
+ var ROW_ACTIVE = {
154
+ brand: "bg-brand-primary group-hover/row:bg-utility-brand-100",
155
+ neutral: "bg-secondary group-hover/row:bg-tertiary"
156
+ };
157
+ var ROW_LABEL = "min-w-0 truncate text-sm font-medium";
158
+ var ROW_MAIN = "flex min-w-0 flex-1 items-center gap-2";
159
+ var TEXT_TRANSITION = "transition-colors duration-100 ease-linear";
160
+ var TEXT_IDLE = "text-secondary group-hover/row:text-secondary_hover";
161
+ var TEXT_ACTIVE = {
162
+ brand: "font-semibold text-brand-secondary",
163
+ neutral: "font-semibold text-secondary_hover"
164
+ };
165
+ var ICON_IDLE = "text-fg-quaternary group-hover/row:text-fg-quaternary_hover";
166
+ var ICON_ACTIVE = {
167
+ brand: "text-brand-secondary",
168
+ neutral: "text-fg-quaternary_hover"
169
+ };
170
+ var CHEVRON = "ml-3 size-4 shrink-0 transition-colors duration-200 ease-out";
171
+ var NEST = {
172
+ // `border-strong`, not `border`: the trunk, the dot and the row's glyphs are one tone (`ICON_IDLE`),
173
+ // and `border` is the hairline every CARD and divider in the library draws — a nesting guide that
174
+ // shares it reads as a container edge rather than as part of the row.
175
+ line: "ml-[1.125rem] border-l border-primary pl-[calc(0.5rem+1px)]",
176
+ dot: "ml-7",
177
+ none: "ml-7"
178
+ };
179
+ var GUIDE_DOT = "absolute top-1/2 left-4 size-1 -translate-y-1/2 rounded-full bg-current";
180
+ var GUIDE_DOT_ROW = "-ml-7 pl-9";
181
+ var SEPARATOR_VARIANT = {
182
+ line: "h-px bg-border-secondary",
183
+ dot: "h-0.5 bg-[image:radial-gradient(circle,var(--color-border-secondary)_1px,transparent_1px)] bg-[length:5px_2px] bg-repeat-x"
184
+ };
185
+ var ACTION_BUTTON = "absolute top-1/2 right-1 z-10 grid size-6 -translate-y-1/2 cursor-pointer place-items-center rounded-md outline-focus-ring transition-[opacity,color,background-color] duration-100 ease-linear hover:bg-ghost-hover hover:text-secondary focus-visible:outline-2 focus-visible:outline-offset-1";
186
+ var ACTION_REVEAL = {
187
+ hover: "opacity-0 group-hover/row:opacity-100 focus-visible:opacity-100 aria-expanded:opacity-100",
188
+ always: ""
189
+ };
190
+ function RowIcon({ node, tone, reserve }) {
191
+ if (node == null) return reserve ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "mr-2 size-5 shrink-0" }) : null;
192
+ return /* @__PURE__ */ jsx(Slot, { className: cn("mr-2 size-5 [&>svg]:size-5", TEXT_TRANSITION, tone), children: node });
193
+ }
194
+ function RowContent({ link, text, icon, reserve, dot }) {
195
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
196
+ dot ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn(GUIDE_DOT, TEXT_TRANSITION, icon) }) : null,
197
+ /* @__PURE__ */ jsx(RowIcon, { node: link.leading, tone: icon, reserve }),
198
+ /* @__PURE__ */ jsxs("span", { className: ROW_MAIN, children: [
199
+ /* @__PURE__ */ jsx("span", { className: cn(ROW_LABEL, TEXT_TRANSITION, text), children: link.label }),
200
+ link.trailing != null ? /* @__PURE__ */ jsx(Slot, { className: cn(TEXT_TRANSITION, text), children: link.trailing }) : null
201
+ ] })
202
+ ] });
203
+ }
204
+ function RowAction({ action, icon }) {
205
+ const trigger = /* @__PURE__ */ jsx(
206
+ "button",
207
+ {
208
+ type: "button",
209
+ "aria-label": action.label,
210
+ onClick: action.items ? void 0 : action.onClick,
211
+ className: cn(ACTION_BUTTON, icon, ACTION_REVEAL[action.reveal ?? "hover"]),
212
+ children: /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "grid size-4 place-items-center [&>svg]:size-4", children: action.icon })
213
+ }
214
+ );
215
+ if (action.items) return /* @__PURE__ */ jsx(DropdownMenu, { trigger, items: action.items, side: "right", align: "start" });
216
+ return /* @__PURE__ */ jsx(TooltipExport, { content: action.label, side: "right", children: trigger });
217
+ }
218
+ function NavRow({ link, ctx, reserve, dot }) {
219
+ const isCurrent = link === ctx.current;
220
+ const className = cn(
221
+ ROW_BASE,
222
+ dot && GUIDE_DOT_ROW,
223
+ isCurrent ? ROW_ACTIVE[ctx.accent] : ROW_IDLE,
224
+ link.disabled && ROW_DISABLED,
225
+ link.action && "pr-8",
226
+ link.className
227
+ );
228
+ const icon = isCurrent ? ICON_ACTIVE[ctx.accent] : ICON_IDLE;
229
+ const content = /* @__PURE__ */ jsx(RowContent, { link, reserve, dot, text: isCurrent ? TEXT_ACTIVE[ctx.accent] : TEXT_IDLE, icon });
230
+ const handleClick = (event) => {
231
+ ctx.onNavigate?.(link, event);
232
+ link.onClick?.(event);
233
+ };
234
+ let row;
235
+ if (link.disabled) {
236
+ row = /* @__PURE__ */ jsx("span", { "aria-disabled": "true", className, children: content });
237
+ } else if (link.href) {
238
+ row = /* @__PURE__ */ jsx("a", { href: link.href, "aria-current": isCurrent ? "page" : void 0, onClick: handleClick, className, children: content });
239
+ } else {
240
+ row = /* @__PURE__ */ jsx("button", { type: "button", "aria-current": isCurrent ? "page" : void 0, onClick: handleClick, className, children: content });
241
+ }
242
+ return /* @__PURE__ */ jsxs("div", { className: ROW_WRAP, children: [
243
+ row,
244
+ link.action && !link.disabled ? /* @__PURE__ */ jsx(RowAction, { action: link.action, icon }) : null
245
+ ] });
246
+ }
247
+ function NavDisclosure({ link, ctx, reserve, dot }) {
248
+ const contentId = React.useId();
249
+ const children = link.items ?? [];
250
+ const isCurrent = link === ctx.current;
251
+ const inTrail = ctx.trail.has(link);
252
+ const shouldOpen = isCurrent || inTrail;
253
+ const [open, setOpen] = React.useState(shouldOpen || link.defaultOpen === true);
254
+ React.useEffect(() => {
255
+ if (shouldOpen) setOpen(true);
256
+ }, [shouldOpen]);
257
+ const standIn = isCurrent || inTrail && !open;
258
+ const accented = standIn || inTrail;
259
+ const text = accented ? TEXT_ACTIVE[ctx.accent] : TEXT_IDLE;
260
+ const icon = accented ? ICON_ACTIVE[ctx.accent] : ICON_IDLE;
261
+ return /* @__PURE__ */ jsxs("div", { children: [
262
+ /* @__PURE__ */ jsxs("div", { className: ROW_WRAP, children: [
263
+ /* @__PURE__ */ jsxs(
264
+ "button",
265
+ {
266
+ type: "button",
267
+ "aria-expanded": open,
268
+ "aria-controls": contentId,
269
+ onClick: () => setOpen((value) => !value),
270
+ className: cn(ROW_BASE, dot && GUIDE_DOT_ROW, standIn ? ROW_ACTIVE[ctx.accent] : ROW_IDLE, link.action && "pr-8", link.className),
271
+ children: [
272
+ /* @__PURE__ */ jsx(RowContent, { link, reserve, dot, text, icon }),
273
+ /* @__PURE__ */ jsx(ChevronDownIcon, { className: cn(CHEVRON, icon, open && "-scale-y-100"), strokeWidth: 2.5 })
274
+ ]
275
+ }
276
+ ),
277
+ link.action ? /* @__PURE__ */ jsx(RowAction, { action: link.action, icon }) : null
278
+ ] }),
279
+ /* @__PURE__ */ jsx(
280
+ "div",
281
+ {
282
+ id: contentId,
283
+ className: cn("grid transition-[grid-template-rows,visibility] duration-200 ease-out", open ? "visible grid-rows-[1fr]" : "invisible grid-rows-[0fr]"),
284
+ children: /* @__PURE__ */ jsx("div", { className: "overflow-hidden", children: /* @__PURE__ */ jsx(NavRows, { links: children, ctx, nested: true, className: NEST[ctx.guide] }) })
285
+ }
286
+ )
287
+ ] });
288
+ }
289
+ function NavRows({ links, ctx, nested = false, className }) {
290
+ const reserve = links.some((link) => link.leading != null);
291
+ const dot = nested && ctx.guide === "dot";
292
+ return /* @__PURE__ */ jsx("ul", { className: cn("flex flex-col", className), children: links.map((link) => /* @__PURE__ */ jsx("li", { className: "py-px", children: (link.items?.length ?? 0) > 0 ? /* @__PURE__ */ jsx(NavDisclosure, { link, ctx, reserve, dot }) : /* @__PURE__ */ jsx(NavRow, { link, ctx, reserve, dot }) }, link.label)) });
293
+ }
294
+ var RAIL_ROW = cn(
295
+ "group/row relative flex size-9 cursor-pointer items-center justify-center rounded-lg",
296
+ "outline-focus-ring transition-colors duration-100 ease-linear select-none",
297
+ "focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2"
298
+ );
299
+ var railClass = (link, current, accent) => cn(RAIL_ROW, current ? ROW_ACTIVE[accent] : ROW_IDLE, link.disabled && ROW_DISABLED, link.className);
300
+ function RailIcon({ link, current, accent }) {
301
+ return /* @__PURE__ */ jsx(Slot, { className: cn("size-5 [&>svg]:size-5", TEXT_TRANSITION, current ? ICON_ACTIVE[accent] : ICON_IDLE), children: link.leading ?? /* @__PURE__ */ jsx("span", { className: "size-2 rounded-full bg-current" }) });
302
+ }
303
+ function railTrigger(link, current, accent) {
304
+ return /* @__PURE__ */ jsxs("button", { type: "button", "aria-label": link.label, className: railClass(link, current, accent), children: [
305
+ /* @__PURE__ */ jsx(RailIcon, { link, current, accent }),
306
+ /* @__PURE__ */ jsx(
307
+ ChevronRightIcon,
308
+ {
309
+ "aria-hidden": "true",
310
+ className: cn("absolute top-1/2 right-0 size-2.5 -translate-y-1/2", TEXT_TRANSITION, current ? ICON_ACTIVE[accent] : ICON_IDLE),
311
+ strokeWidth: 3
312
+ }
313
+ )
314
+ ] });
315
+ }
316
+ function RailRow({ link, ctx }) {
317
+ const current = link === ctx.current;
318
+ const className = railClass(link, current, ctx.accent);
319
+ const icon = /* @__PURE__ */ jsx(RailIcon, { link, current, accent: ctx.accent });
320
+ const handleClick = (event) => {
321
+ ctx.onNavigate?.(link, event);
322
+ link.onClick?.(event);
323
+ };
324
+ const element = link.href ? /* @__PURE__ */ jsx("a", { href: link.href, "aria-label": link.label, "aria-current": current ? "page" : void 0, onClick: handleClick, className, children: icon }) : /* @__PURE__ */ jsx("button", { type: "button", "aria-label": link.label, "aria-current": current ? "page" : void 0, onClick: handleClick, className, children: icon });
325
+ return /* @__PURE__ */ jsx(TooltipExport, { content: link.label, side: "right", children: element });
326
+ }
327
+ function toMenuItems(links, ctx) {
328
+ return links.map((child) => {
329
+ const nested = child.items ?? [];
330
+ if (nested.length > 0) {
331
+ return {
332
+ label: child.label,
333
+ leading: child.leading,
334
+ active: child === ctx.current || ctx.trail.has(child),
335
+ items: toMenuItems(nested, ctx)
336
+ };
337
+ }
338
+ return {
339
+ label: child.label,
340
+ href: child.href,
341
+ leading: child.leading,
342
+ trailing: child.trailing,
343
+ active: child === ctx.current,
344
+ disabled: child.disabled,
345
+ onClick: (event) => {
346
+ ctx.onNavigate?.(child, event);
347
+ child.onClick?.(event);
348
+ }
349
+ };
350
+ });
351
+ }
352
+ function RailNode({ link, ctx }) {
353
+ const children = link.items ?? [];
354
+ const current = link === ctx.current || ctx.trail.has(link);
355
+ if (children.length > 0) {
356
+ return /* @__PURE__ */ jsx(DropdownMenu, { trigger: railTrigger(link, current, ctx.accent), items: toMenuItems(children, ctx), side: "right", align: "start" });
357
+ }
358
+ return /* @__PURE__ */ jsx(RailRow, { link, ctx });
359
+ }
360
+ function RailRows({ links, ctx }) {
361
+ return /* @__PURE__ */ jsx("ul", { className: "flex flex-col items-center gap-0.5", children: links.map((link) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(RailNode, { link, ctx }) }, link.label)) });
362
+ }
363
+ function Skeleton({ collapsed }) {
364
+ return /* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: cn("flex flex-col py-2", collapsed ? "items-center gap-2" : "gap-2 px-2"), children: SKELETON_WIDTHS.map((width) => /* @__PURE__ */ jsx(SkeletonBar, { className: cn("h-6", collapsed ? "w-6" : width) }, width)) });
365
+ }
366
+ function SidebarNavigation(props) {
367
+ const { items, activeHref, onNavigate, accent = "brand", guide = "line", header, footerItems, footer, toggle = false, loading = false, className } = props;
368
+ const ariaLabel = props["aria-label"] ?? "Main";
369
+ const sidebar = useSidebarContext();
370
+ const collapsed = props.collapsed ?? sidebar?.collapsed ?? false;
371
+ if (toggle && !sidebar) devWarn("<SidebarNavigation toggle> renders nothing outside a <SidebarProvider> \u2014 there is no state for it to flip.");
372
+ const { current, trail } = React.useMemo(
373
+ () => resolveActive(footerItems && footerItems.length > 0 ? [...items, ...footerItems] : items, activeHref),
374
+ [items, footerItems, activeHref]
375
+ );
376
+ const ctx = React.useMemo(() => ({ current, trail, accent, guide, onNavigate }), [current, trail, accent, guide, onNavigate]);
377
+ const renderGroup = (group, key) => /* @__PURE__ */ jsxs("li", { children: [
378
+ collapsed ? /* @__PURE__ */ jsx("hr", { className: "mx-auto my-2 h-px w-6 border-none bg-border-secondary" }) : /* @__PURE__ */ jsx("div", { className: "px-2 pb-1", children: /* @__PURE__ */ jsx("p", { className: "text-xs font-semibold text-fg-quaternary uppercase", children: group.group }) }),
379
+ collapsed ? /* @__PURE__ */ jsx(RailRows, { links: group.items, ctx }) : /* @__PURE__ */ jsx(NavRows, { links: group.items, ctx, className: "pb-5" })
380
+ ] }, key);
381
+ return /* @__PURE__ */ jsxs(
382
+ "nav",
383
+ {
384
+ "aria-label": ariaLabel,
385
+ "aria-busy": loading || void 0,
386
+ className: cn(
387
+ "relative flex h-full flex-col bg-primary",
388
+ // `shrink-0` because the width below is a DECLARED width, not a suggestion.
389
+ // A sidebar is a flex child of the app shell, and the page beside it is a
390
+ // flex item with the default `min-width: auto` — so one unbreakable token in
391
+ // the page (a long path, a URL, a wide table) makes that sibling demand its
392
+ // min-content width and quietly steals it from the nav. That reads as "the
393
+ // menu got narrower when I opened a different page": rows shrink, labels
394
+ // truncate earlier, and the column no longer matches the 280px design. The
395
+ // nav must not pay for the page's content.
396
+ "shrink-0",
397
+ // The one animated dimension. Everything inside swaps structure at the same
398
+ // moment (a rail row is a tooltip'd icon, not a squeezed row), so the width
399
+ // carries the motion and the content lands where it settles.
400
+ "transition-[width] duration-200 ease-out",
401
+ collapsed ? "w-16 items-center px-3" : "w-70 px-4",
402
+ className
403
+ ),
404
+ children: [
405
+ header != null ? /* @__PURE__ */ jsx("div", { className: cn("shrink-0 pt-5 pb-2", collapsed && "flex w-full justify-center overflow-hidden"), children: header }) : null,
406
+ loading ? /* @__PURE__ */ jsx("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ jsx(Skeleton, { collapsed }) }) : /* @__PURE__ */ jsx("ul", { className: cn("flex min-h-0 flex-1 flex-col overflow-y-auto py-2", collapsed && "w-full items-center gap-0.5"), children: items.map((item, index) => {
407
+ if (isNavSeparator(item)) {
408
+ return /* @__PURE__ */ jsx("li", { className: cn("w-full", collapsed ? "py-2" : "px-0.5 py-2"), children: /* @__PURE__ */ jsx("hr", { className: cn("border-none", SEPARATOR_VARIANT[item.variant ?? "line"], collapsed ? "mx-auto w-6" : "w-full") }) }, `separator-${index}`);
409
+ }
410
+ if (isNavGroup(item)) return renderGroup(item, `group-${index}`);
411
+ return /* @__PURE__ */ jsx("li", { className: collapsed ? void 0 : "py-px", children: collapsed ? /* @__PURE__ */ jsx(RailNode, { link: item, ctx }) : /* @__PURE__ */ jsx(NavRows, { links: [item], ctx }) }, item.label);
412
+ }) }),
413
+ footerItems != null && footerItems.length > 0 && !loading ? (
414
+ // `max-h-[40%]` + its own scroll, because the two lists resolve their heights
415
+ // BACKWARDS otherwise. `footerItems` is a bounded cluster (Support, Settings) and
416
+ // asks for its full content height; the menu above is `min-h-0 flex-1`, which means
417
+ // it will surrender ALL of its space rather than overflow. So an oversized pinned
418
+ // cluster wins every pixel: at 50 rows the menu collapsed to a 16px scroll sliver
419
+ // and the rows themselves ran ~1450px past the bottom of a 478px nav — visible in
420
+ // any shell that doesn't clip, since the nav's own overflow is `visible`.
421
+ // The cap makes it degrade the honest way round: the cluster keeps at most a
422
+ // minority share and scrolls inside it, and the menu — the reason the column
423
+ // exists — always keeps the rest. `min-h-0` so the cap can actually bite.
424
+ /* @__PURE__ */ jsx("div", { className: cn("max-h-[40%] min-h-0 shrink-0 overflow-y-auto pt-2", collapsed && "flex w-full justify-center"), children: collapsed ? /* @__PURE__ */ jsx(RailRows, { links: footerItems, ctx }) : /* @__PURE__ */ jsx(NavRows, { links: footerItems, ctx }) })
425
+ ) : null,
426
+ footer != null ? /* @__PURE__ */ jsx("div", { className: cn("mt-auto shrink-0 py-4", collapsed && "flex w-full justify-center overflow-hidden"), children: footer }) : null,
427
+ toggle && sidebar ? /* @__PURE__ */ jsx(
428
+ "button",
429
+ {
430
+ type: "button",
431
+ "aria-label": collapsed ? "Expand sidebar" : "Collapse sidebar",
432
+ "aria-expanded": !collapsed,
433
+ onClick: sidebar.toggle,
434
+ className: "group/handle absolute inset-y-0 right-0 z-20 flex w-3 cursor-pointer items-center justify-center outline-focus-ring focus-visible:outline-2 focus-visible:-outline-offset-2",
435
+ children: /* @__PURE__ */ jsx(
436
+ "span",
437
+ {
438
+ "aria-hidden": "true",
439
+ className: "h-8 w-0.5 rounded-full bg-border-secondary transition-colors duration-100 ease-linear group-hover/handle:bg-brand-solid"
440
+ }
441
+ )
442
+ }
443
+ ) : null
444
+ ]
445
+ }
446
+ );
447
+ }
448
+ SidebarNavigation.displayName = "SidebarNavigation";
449
+
450
+ export { SidebarNavigation, SidebarProvider, SidebarTrigger, linkMatches, resolveActive, useSidebar };
451
+ //# sourceMappingURL=chunk-7IU5TMFL.js.map
452
+ //# sourceMappingURL=chunk-7IU5TMFL.js.map
@@ -0,0 +1,29 @@
1
+ // src/components/field/options.ts
2
+ function isOptionGroup(entry) {
3
+ return typeof entry === "object" && entry !== null && "options" in entry && Array.isArray(entry.options);
4
+ }
5
+ function buildOptionMap(options) {
6
+ const map = /* @__PURE__ */ new Map();
7
+ if (options) {
8
+ for (const entry of options) {
9
+ if (isOptionGroup(entry)) {
10
+ for (const opt of entry.options) map.set(opt.value, opt);
11
+ } else {
12
+ map.set(entry.value, entry);
13
+ }
14
+ }
15
+ }
16
+ return map;
17
+ }
18
+ function mapOptions(options, render) {
19
+ return options.map(
20
+ (entry) => isOptionGroup(entry) ? render.group(
21
+ entry.label,
22
+ entry.options.map((opt) => render.item(opt))
23
+ ) : render.item(entry)
24
+ );
25
+ }
26
+
27
+ export { buildOptionMap, isOptionGroup, mapOptions };
28
+ //# sourceMappingURL=chunk-7JBNLEJ7.js.map
29
+ //# sourceMappingURL=chunk-7JBNLEJ7.js.map
@@ -0,0 +1,23 @@
1
+ import { cn } from './chunk-ZSNJ6UA3.js';
2
+ import 'react';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ var MEASURE_CAP = 24;
6
+ function widestCandidates(labels) {
7
+ if (labels.length <= MEASURE_CAP) return labels;
8
+ return [...labels].sort((a, b) => b.length - a.length).slice(0, MEASURE_CAP);
9
+ }
10
+ function IntrinsicWidth({ candidates, className }) {
11
+ if (candidates.length === 0) return null;
12
+ return /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn("invisible col-start-1 row-start-1 h-0 overflow-hidden", className), children: widestCandidates(candidates).map((label, i) => (
13
+ // `block` so each candidate is its own line box: the parent's max-content width then
14
+ // resolves to the widest LINE, which is exactly the number we want.
15
+ /* @__PURE__ */ jsx("span", { className: "block whitespace-nowrap", children: label }, `${label}-${i}`)
16
+ )) });
17
+ }
18
+ var INTRINSIC_STACK = "grid min-w-0 flex-1";
19
+ var INTRINSIC_CELL = "col-start-1 row-start-1 min-w-0";
20
+
21
+ export { INTRINSIC_CELL, INTRINSIC_STACK, IntrinsicWidth };
22
+ //# sourceMappingURL=chunk-7S2TBALK.js.map
23
+ //# sourceMappingURL=chunk-7S2TBALK.js.map