@inf-monkeys-tech/monkeys-design 0.4.46 → 0.4.47

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.
@@ -1,16 +1,3228 @@
1
- import { useState, useEffect } from 'react';
1
+ import { forwardRef, useRef, useState, useEffect, useId, useMemo, createContext, useContext } from 'react';
2
2
  import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
3
3
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
4
+ import '@radix-ui/react-context-menu';
4
5
 
5
6
  // src/components/layout/index.tsx
6
- function cn(...inputs) {
7
+
8
+ // src/components/base/utils.ts
9
+ function cn(...parts) {
10
+ return parts.filter(Boolean).join(" ");
11
+ }
12
+ function hasRenderableNode(node) {
13
+ return node !== void 0 && node !== null && typeof node !== "boolean";
14
+ }
15
+
16
+ // src/components/base/theme.ts
17
+ var emptyStyles = {};
18
+ var motionBase = "motion-safe:transition motion-safe:duration-300 motion-safe:ease-out";
19
+ var motionInteractive = "motion-safe:transition-all motion-safe:duration-300 motion-safe:ease-out";
20
+ var motionTransform = "motion-safe:transition-transform motion-safe:duration-300 motion-safe:ease-out";
21
+ var baseSlots = {
22
+ buttonBase: cn(
23
+ "group/button inline-flex min-w-0 items-center justify-center gap-2 rounded-md border px-3 text-sm font-medium focus-visible:outline-none",
24
+ "cursor-pointer disabled:!cursor-not-allowed",
25
+ motionInteractive
26
+ ),
27
+ buttonDefault: "border-border bg-background text-foreground hover:bg-accent/60",
28
+ buttonPrimary: "border-primary/20 bg-primary/10 text-primary hover:bg-primary/15",
29
+ buttonSuccess: "border-emerald-500/30 bg-emerald-500/10 text-emerald-700 hover:bg-emerald-500/15",
30
+ buttonWarning: "border-amber-500/30 bg-amber-500/10 text-amber-700 hover:bg-amber-500/15",
31
+ buttonDanger: "border-destructive/20 bg-destructive/10 text-destructive hover:bg-destructive/15",
32
+ buttonMuted: "border-border/60 bg-muted/45 text-muted-foreground hover:bg-muted/70 hover:text-foreground",
33
+ buttonActive: "border-primary/35 bg-primary/10 text-primary",
34
+ buttonDisabled: "!cursor-not-allowed opacity-60",
35
+ buttonIconOnly: "w-9 px-0",
36
+ buttonIcon: "inline-flex h-4 w-4 shrink-0 items-center justify-center",
37
+ buttonLabel: "min-w-0 truncate",
38
+ badgeBase: cn(
39
+ "inline-flex max-w-full items-center gap-1.5 rounded-full border px-2 py-0.5 text-xs font-medium",
40
+ motionBase
41
+ ),
42
+ badgeDefault: "border-border/60 bg-background text-foreground",
43
+ badgePrimary: "border-primary/30 bg-primary/10 text-primary",
44
+ badgeSuccess: "border-emerald-500/30 bg-emerald-500/10 text-emerald-700",
45
+ badgeWarning: "border-amber-500/30 bg-amber-500/10 text-amber-700",
46
+ badgeDanger: "border-destructive/30 bg-destructive/10 text-destructive",
47
+ badgeMuted: "border-border/60 bg-muted text-muted-foreground",
48
+ badgeIcon: "inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center",
49
+ badgeLabel: "min-w-0 truncate",
50
+ panelRoot: cn(
51
+ "group relative flex min-w-0 flex-col overflow-hidden rounded-lg border border-border/70 bg-background",
52
+ motionInteractive
53
+ ),
54
+ panelInteractive: "cursor-pointer hover:shadow-md",
55
+ panelSelected: "border-primary/45 bg-primary/5",
56
+ panelDisabled: "!cursor-not-allowed opacity-60",
57
+ panelMedia: "shrink-0 overflow-hidden",
58
+ panelHeader: "min-w-0 p-4",
59
+ panelTitle: "min-w-0 truncate text-sm font-semibold leading-none text-foreground",
60
+ panelDescription: "mt-1 text-sm leading-5 text-muted-foreground",
61
+ panelBody: "min-w-0 px-4 pb-4 text-sm text-foreground",
62
+ panelBodyStandalone: "pt-4",
63
+ panelFooter: "shrink-0 border-t border-border/60 px-4 py-3",
64
+ stateRoot: cn(
65
+ "flex min-h-48 flex-col items-center justify-center rounded-lg border border-border/70 bg-background px-6 py-10 text-center",
66
+ motionBase
67
+ ),
68
+ stateIcon: "mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted text-muted-foreground motion-safe:animate-in motion-safe:fade-in",
69
+ stateTitle: "text-sm font-semibold text-foreground",
70
+ stateDescription: "mt-2 max-w-md text-sm leading-6 text-muted-foreground",
71
+ stateActions: "mt-5 flex flex-wrap items-center justify-center gap-2",
72
+ loadingSpinner: "h-5 w-5 animate-spin",
73
+ fieldRoot: "grid min-w-0 gap-2",
74
+ fieldLabelRow: "flex min-w-0 items-center justify-between gap-3",
75
+ fieldLabel: "min-w-0 text-sm font-medium leading-none text-foreground",
76
+ fieldRequired: "text-destructive",
77
+ fieldDescription: "text-sm leading-5 text-muted-foreground",
78
+ fieldMessage: "text-sm leading-5 text-muted-foreground",
79
+ fieldControl: "min-w-0",
80
+ controlWrapper: cn(
81
+ "relative flex min-w-0 items-center rounded-md border border-border bg-background text-foreground focus-within:border-primary/35",
82
+ motionBase
83
+ ),
84
+ controlBase: "min-w-0 flex-1 bg-transparent px-3 text-sm text-foreground outline-none placeholder:text-muted-foreground disabled:!cursor-not-allowed",
85
+ controlInput: "h-9",
86
+ controlTextarea: "min-h-24 resize-y py-2 leading-6",
87
+ controlSelect: "h-9 cursor-pointer appearance-none pr-9 disabled:!cursor-not-allowed",
88
+ controlIcon: "pointer-events-none ml-3 inline-flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground",
89
+ controlTrailing: "mr-3 inline-flex shrink-0 items-center justify-center text-muted-foreground",
90
+ controlInvalid: "border-destructive/45 focus-within:border-destructive/60",
91
+ controlDisabled: "!cursor-not-allowed opacity-60",
92
+ controlReadOnly: "bg-muted/35",
93
+ selectChevron: cn(
94
+ "pointer-events-none absolute right-3 top-1/2 h-2 w-2 -translate-y-1/2 rotate-45 border-b border-r border-current text-muted-foreground",
95
+ motionTransform
96
+ ),
97
+ selectMenu: "absolute left-0 right-0 top-[calc(100%+0.375rem)] z-50 max-h-60 origin-top overflow-auto rounded-md border border-border bg-background p-1 text-sm text-foreground shadow-lg outline-none motion-safe:animate-in motion-safe:fade-in motion-safe:duration-300 motion-safe:ease-out",
98
+ selectOption: cn(
99
+ "flex min-h-8 w-full min-w-0 cursor-pointer items-center rounded-sm px-2.5 py-1.5 text-left text-sm text-foreground",
100
+ motionInteractive
101
+ ),
102
+ selectOptionActive: "bg-accent text-accent-foreground",
103
+ selectOptionSelected: "bg-primary/10 text-primary",
104
+ selectOptionDisabled: "!cursor-not-allowed opacity-50",
105
+ selectPlaceholder: "text-muted-foreground",
106
+ selectNative: "sr-only",
107
+ switchRoot: "inline-flex min-w-0 cursor-pointer items-start gap-3",
108
+ switchInput: "sr-only",
109
+ switchTrack: cn(
110
+ "relative mt-0.5 inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-border bg-muted focus-within:border-primary/35",
111
+ motionBase
112
+ ),
113
+ switchThumb: cn(
114
+ "h-4 w-4 translate-x-1 rounded-full bg-background shadow-sm",
115
+ motionTransform
116
+ ),
117
+ switchChecked: "border-primary/40 bg-primary/80 text-primary-foreground",
118
+ switchDisabled: "!cursor-not-allowed opacity-60",
119
+ switchContent: "grid min-w-0 gap-1",
120
+ switchLabel: "text-sm font-medium leading-none text-foreground",
121
+ switchDescription: "text-sm leading-5 text-muted-foreground",
122
+ checkboxRoot: "inline-flex min-w-0 cursor-pointer items-start gap-3",
123
+ checkboxInput: "sr-only",
124
+ checkboxBox: cn(
125
+ "mt-0.5 inline-flex h-4 w-4 shrink-0 items-center justify-center rounded border border-border bg-background text-primary focus-within:border-primary/40",
126
+ motionBase
127
+ ),
128
+ checkboxBoxChecked: "border-primary/45 bg-primary text-primary-foreground",
129
+ checkboxBoxInvalid: "border-destructive/50",
130
+ checkboxIndicator: "text-[11px] font-bold leading-none",
131
+ checkboxDisabled: "!cursor-not-allowed opacity-60",
132
+ checkboxContent: "grid min-w-0 gap-1",
133
+ checkboxLabel: "text-sm font-medium leading-none text-foreground",
134
+ checkboxDescription: "text-sm leading-5 text-muted-foreground",
135
+ radioGroupRoot: "grid min-w-0 gap-2",
136
+ radioOption: cn(
137
+ "inline-flex min-w-0 cursor-pointer items-start gap-3 rounded-md border border-border/60 bg-background px-3 py-2 text-sm",
138
+ motionInteractive,
139
+ "hover:bg-muted/35"
140
+ ),
141
+ radioInput: "sr-only",
142
+ radioMarker: cn(
143
+ "mt-0.5 inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full border border-border bg-background text-primary focus-within:border-primary/40",
144
+ motionBase
145
+ ),
146
+ radioMarkerChecked: "border-primary/50 bg-primary/10",
147
+ radioIndicator: "h-2 w-2 rounded-full bg-primary",
148
+ radioOptionDisabled: "!cursor-not-allowed opacity-60 hover:bg-background",
149
+ radioContent: "grid min-w-0 gap-1",
150
+ radioLabel: "text-sm font-medium leading-none text-foreground",
151
+ radioDescription: "text-sm leading-5 text-muted-foreground",
152
+ dialogRoot: "relative",
153
+ dialogTrigger: "",
154
+ dialogTriggerDisabled: "!cursor-not-allowed opacity-60",
155
+ dialogOverlay: "fixed inset-0 z-50 bg-background/70 backdrop-blur-sm motion-safe:animate-in motion-safe:fade-in motion-safe:duration-300 motion-safe:ease-out",
156
+ dialogContent: "fixed inset-0 z-50 flex min-h-0 items-center justify-center p-4",
157
+ dialogPanel: cn(
158
+ "relative flex max-h-[min(85vh,720px)] w-full max-w-lg min-w-0 flex-col overflow-hidden rounded-lg border border-border/70 bg-background text-foreground shadow-xl",
159
+ "motion-safe:animate-in motion-safe:fade-in motion-safe:zoom-in-95 motion-safe:duration-300 motion-safe:ease-out"
160
+ ),
161
+ dialogHeader: "grid min-w-0 gap-1 border-b border-border/60 px-5 py-4",
162
+ dialogTitle: "min-w-0 pr-8 text-base font-semibold leading-6 text-foreground",
163
+ dialogDescription: "text-sm leading-6 text-muted-foreground",
164
+ dialogBody: "min-h-0 min-w-0 overflow-auto px-5 py-4 text-sm text-foreground",
165
+ dialogFooter: "flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-border/60 px-5 py-4",
166
+ dialogClose: cn(
167
+ "absolute right-3 top-3 inline-flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-muted-foreground hover:bg-muted/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",
168
+ motionInteractive
169
+ ),
170
+ dropdownRoot: "relative inline-flex min-w-0",
171
+ dropdownTrigger: "",
172
+ dropdownTriggerDisabled: "!cursor-not-allowed opacity-60",
173
+ dropdownMenu: "absolute left-0 top-[calc(100%+0.375rem)] z-50 min-w-48 overflow-hidden rounded-md border border-border bg-background p-1 text-sm text-foreground shadow-lg motion-safe:animate-in motion-safe:fade-in motion-safe:duration-300 motion-safe:ease-out",
174
+ dropdownMenuTop: "bottom-[calc(100%+0.375rem)] top-auto",
175
+ dropdownMenuEnd: "left-auto right-0",
176
+ dropdownLabel: "px-2.5 py-1.5 text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground",
177
+ dropdownSeparator: "my-1 h-px bg-border/70",
178
+ dropdownItem: cn(
179
+ "flex min-w-0 cursor-pointer items-center gap-2 rounded-sm px-2.5 py-2 text-left text-sm text-foreground hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",
180
+ motionInteractive
181
+ ),
182
+ dropdownItemDanger: "text-destructive hover:bg-destructive/10",
183
+ dropdownItemDisabled: "!cursor-not-allowed opacity-50 hover:bg-transparent",
184
+ dropdownItemIcon: "inline-flex h-4 w-4 shrink-0 items-center justify-center",
185
+ dropdownItemContent: "grid min-w-0 flex-1 gap-0.5",
186
+ dropdownItemLabel: "min-w-0 truncate",
187
+ dropdownItemDescription: "min-w-0 truncate text-xs leading-4 text-muted-foreground",
188
+ dropdownItemShortcut: "ml-3 shrink-0 text-xs font-medium text-muted-foreground",
189
+ tooltipRoot: "relative inline-flex min-w-0",
190
+ tooltipTrigger: "inline-flex min-w-0",
191
+ tooltipContent: "pointer-events-none absolute z-50 max-w-xs rounded-md border border-border bg-popover px-2.5 py-1.5 text-xs leading-5 text-popover-foreground shadow-lg motion-safe:animate-in motion-safe:fade-in motion-safe:duration-300 motion-safe:ease-out",
192
+ noticeBase: cn(
193
+ "flex min-w-0 gap-3 rounded-lg border px-4 py-3 text-sm",
194
+ motionBase,
195
+ "motion-safe:animate-in motion-safe:fade-in"
196
+ ),
197
+ noticeDefault: "border-border bg-background text-foreground",
198
+ noticePrimary: "border-primary/25 bg-primary/10 text-primary",
199
+ noticeSuccess: "border-emerald-500/30 bg-emerald-500/10 text-emerald-700",
200
+ noticeWarning: "border-amber-500/30 bg-amber-500/10 text-amber-700",
201
+ noticeDanger: "border-destructive/30 bg-destructive/10 text-destructive",
202
+ noticeMuted: "border-border/60 bg-muted/35 text-muted-foreground",
203
+ noticeIcon: "mt-0.5 inline-flex h-4 w-4 shrink-0 items-center justify-center motion-safe:animate-in motion-safe:fade-in",
204
+ noticeTitle: "font-semibold leading-5",
205
+ noticeDescription: "leading-6",
206
+ noticeActions: "mt-3 flex flex-wrap items-center gap-2",
207
+ dividerRoot: cn("shrink-0 border-border/70", motionBase),
208
+ dividerLabel: "mx-3 shrink-0 text-xs font-medium uppercase tracking-[0.12em] text-muted-foreground motion-safe:animate-in motion-safe:fade-in",
209
+ sectionHeaderRoot: "flex min-w-0 flex-wrap items-start justify-between gap-3 motion-safe:animate-in motion-safe:fade-in motion-safe:duration-300 motion-safe:ease-out",
210
+ sectionHeaderContent: "grid min-w-0 gap-1",
211
+ sectionHeaderEyebrow: "text-xs font-semibold uppercase tracking-[0.14em] text-muted-foreground",
212
+ sectionHeaderTitle: "text-base font-semibold leading-6 text-foreground",
213
+ sectionHeaderDescription: "max-w-2xl text-sm leading-6 text-muted-foreground",
214
+ sectionHeaderActions: "flex shrink-0 flex-wrap items-center gap-2",
215
+ tabsRoot: "grid min-w-0 gap-3",
216
+ tabsList: cn(
217
+ "inline-flex min-w-0 flex-wrap items-center gap-1 rounded-lg border border-border/70 bg-muted/30 p-1",
218
+ motionBase
219
+ ),
220
+ tabsTrigger: cn(
221
+ "inline-flex min-w-0 cursor-pointer items-center justify-center rounded-md px-3 py-1.5 text-sm font-medium text-muted-foreground hover:bg-background/70 hover:text-foreground focus-visible:outline-none",
222
+ motionInteractive
223
+ ),
224
+ tabsTriggerActive: "bg-background text-foreground shadow-sm",
225
+ tabsTriggerDisabled: "!cursor-not-allowed opacity-50 hover:bg-transparent",
226
+ tabsPanel: "min-w-0 rounded-lg border border-border/70 bg-background p-4 text-sm text-foreground motion-safe:animate-in motion-safe:fade-in motion-safe:duration-300 motion-safe:ease-out",
227
+ segmentedRoot: cn(
228
+ "inline-flex min-w-0 items-center gap-1 rounded-lg border border-border/70 bg-muted/30 p-1",
229
+ motionBase
230
+ ),
231
+ segmentedItem: cn(
232
+ "inline-flex min-w-0 cursor-pointer items-center justify-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium text-muted-foreground hover:bg-background/70 hover:text-foreground focus-visible:outline-none",
233
+ motionInteractive
234
+ ),
235
+ segmentedItemActive: "bg-background text-foreground shadow-sm",
236
+ segmentedItemDisabled: "!cursor-not-allowed opacity-50 hover:bg-transparent",
237
+ progressRoot: "grid min-w-0 gap-2",
238
+ progressTrack: "h-2 w-full overflow-hidden rounded-full bg-muted",
239
+ progressIndicator: "h-full rounded-full bg-primary motion-safe:transition-[width] motion-safe:duration-500 motion-safe:ease-out",
240
+ progressLabelRow: "flex min-w-0 items-center justify-between gap-3",
241
+ progressLabel: "min-w-0 truncate text-sm font-medium text-foreground",
242
+ progressValue: "shrink-0 text-xs font-medium text-muted-foreground",
243
+ skeletonRoot: "relative overflow-hidden rounded-md bg-muted/70",
244
+ avatarRoot: "relative inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full border border-border bg-muted text-sm font-semibold text-muted-foreground motion-safe:transition motion-safe:duration-300 motion-safe:ease-out",
245
+ avatarImage: "h-full w-full object-cover",
246
+ avatarFallback: "flex h-full w-full items-center justify-center bg-muted text-muted-foreground",
247
+ avatarStatus: "absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full border-2 border-background bg-muted-foreground motion-safe:animate-pulse",
248
+ avatarText: "min-w-0 truncate text-sm font-medium text-foreground",
249
+ toolbarRoot: cn(
250
+ "flex min-w-0 flex-wrap items-center justify-between gap-3 rounded-lg border border-border/70 bg-background px-4 py-3",
251
+ motionBase
252
+ ),
253
+ toolbarLeading: "flex min-w-0 items-center gap-3",
254
+ toolbarTitle: "min-w-0 truncate text-sm font-semibold text-foreground",
255
+ toolbarDescription: "mt-0.5 text-sm leading-5 text-muted-foreground",
256
+ toolbarContent: "min-w-0 flex-1",
257
+ toolbarActions: "flex shrink-0 flex-wrap items-center gap-2",
258
+ breadcrumbRoot: "min-w-0 text-sm text-muted-foreground",
259
+ breadcrumbList: "flex min-w-0 flex-wrap items-center gap-1.5",
260
+ breadcrumbItem: "inline-flex min-w-0 items-center gap-1.5",
261
+ breadcrumbLink: "min-w-0 cursor-pointer truncate text-muted-foreground hover:text-foreground disabled:!cursor-not-allowed disabled:opacity-50 aria-disabled:!cursor-not-allowed aria-disabled:opacity-50 aria-disabled:hover:text-muted-foreground motion-safe:transition motion-safe:duration-300 motion-safe:ease-out",
262
+ breadcrumbCurrent: "min-w-0 truncate font-medium text-foreground",
263
+ breadcrumbSeparator: "shrink-0 text-muted-foreground/70",
264
+ paginationRoot: "flex min-w-0 flex-wrap items-center justify-between gap-3 text-sm",
265
+ paginationInfo: "min-w-0 text-muted-foreground",
266
+ paginationControls: "flex shrink-0 items-center gap-1.5",
267
+ paginationButton: "inline-flex h-8 min-w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background px-2.5 text-sm font-medium text-foreground hover:bg-accent/60 disabled:!cursor-not-allowed disabled:opacity-50 motion-safe:transition motion-safe:duration-300 motion-safe:ease-out",
268
+ paginationButtonDisabled: "!cursor-not-allowed opacity-50",
269
+ paginationPage: "inline-flex h-8 min-w-8 items-center justify-center rounded-md bg-muted/50 px-2.5 text-sm font-medium text-foreground",
270
+ descriptionListRoot: "grid min-w-0 gap-3 text-sm",
271
+ descriptionListItem: "grid min-w-0 gap-1 rounded-md border border-border/60 bg-background px-3 py-2 motion-safe:transition motion-safe:duration-300 motion-safe:ease-out hover:shadow-sm",
272
+ descriptionListTerm: "min-w-0 truncate text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground",
273
+ descriptionListValue: "min-w-0 text-sm leading-6 text-foreground",
274
+ accordionRoot: "grid min-w-0 gap-2",
275
+ accordionItem: "overflow-hidden rounded-lg border border-border/70 bg-background motion-safe:transition motion-safe:duration-300 motion-safe:ease-out",
276
+ accordionTrigger: "flex w-full min-w-0 cursor-pointer items-center justify-between gap-3 px-4 py-3 text-left text-sm font-medium text-foreground hover:bg-muted/40 disabled:!cursor-not-allowed disabled:opacity-50 motion-safe:transition motion-safe:duration-300 motion-safe:ease-out",
277
+ accordionTriggerIcon: cn(
278
+ "h-2 w-2 shrink-0 rotate-45 border-b border-r border-current text-muted-foreground",
279
+ motionTransform
280
+ ),
281
+ accordionPanel: "border-t border-border/60 px-4 py-3 text-sm leading-6 text-muted-foreground motion-safe:animate-in motion-safe:fade-in motion-safe:duration-300 motion-safe:ease-out",
282
+ menuTrigger: "inline-flex min-w-0",
283
+ menuContent: "z-50 min-w-44 overflow-hidden rounded-md border border-border bg-background p-1 text-sm text-foreground shadow-lg outline-none motion-safe:animate-in motion-safe:fade-in motion-safe:zoom-in-95 motion-safe:duration-300 motion-safe:ease-out",
284
+ menuLabel: "px-2 py-1.5 text-xs font-medium text-muted-foreground",
285
+ menuSeparator: "-mx-1 my-1 h-px bg-border",
286
+ menuItem: cn(
287
+ "relative flex min-h-8 min-w-0 cursor-pointer select-none items-center gap-2 rounded-sm px-2.5 py-1.5 text-sm text-foreground outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:!cursor-not-allowed data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
288
+ motionInteractive
289
+ ),
290
+ menuItemDefault: "text-foreground",
291
+ menuItemPrimary: "text-primary focus:text-primary data-[highlighted]:text-primary",
292
+ menuItemSuccess: "text-emerald-700 focus:text-emerald-700 data-[highlighted]:text-emerald-700",
293
+ menuItemWarning: "text-amber-700 focus:text-amber-700 data-[highlighted]:text-amber-700",
294
+ menuItemDanger: "text-destructive focus:text-destructive data-[highlighted]:text-destructive",
295
+ menuItemMuted: "text-muted-foreground focus:text-foreground data-[highlighted]:text-foreground",
296
+ menuItemDisabled: "!cursor-not-allowed opacity-50 data-[disabled]:pointer-events-none",
297
+ menuItemIcon: "inline-flex h-4 w-4 shrink-0 items-center justify-center",
298
+ menuItemLabel: "min-w-0 flex-1 truncate",
299
+ menuItemShortcut: "ml-4 shrink-0 text-xs font-medium text-muted-foreground",
300
+ menuCheckboxIndicator: "absolute left-2 inline-flex h-4 w-4 items-center justify-center text-current",
301
+ menuRadioIndicator: "absolute left-2 inline-flex h-4 w-4 items-center justify-center text-current",
302
+ menuSubTrigger: cn(
303
+ "relative flex min-h-8 min-w-0 cursor-pointer select-none items-center gap-2 rounded-sm px-2.5 py-1.5 text-sm text-foreground outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:!cursor-not-allowed data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
304
+ motionInteractive
305
+ ),
306
+ menuSubTriggerIcon: "ml-auto inline-flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground",
307
+ menuSubContent: "z-50 min-w-40 overflow-hidden rounded-md border border-border bg-background p-1 text-sm text-foreground shadow-lg outline-none motion-safe:animate-in motion-safe:fade-in motion-safe:zoom-in-95 motion-safe:duration-300 motion-safe:ease-out",
308
+ tableContainer: cn(
309
+ "relative min-w-0 overflow-auto rounded-lg border border-border/70 bg-background",
310
+ motionBase
311
+ ),
312
+ tableContainerFooterAttached: "!rounded-b-none !shadow-none",
313
+ tableRoot: "w-full caption-bottom border-collapse text-sm text-foreground",
314
+ tableCaption: "mt-3 text-sm text-muted-foreground",
315
+ tableHeader: "border-b border-border/70 bg-muted/35",
316
+ tableBody: "[&_tr:last-child]:border-0",
317
+ tableFooter: "border-t border-border/70 bg-muted/30 font-medium",
318
+ tableFooterBar: cn(
319
+ "flex min-w-0 flex-wrap items-center justify-between gap-3 rounded-lg border border-border/70 bg-muted/20 px-4 py-3 text-sm text-muted-foreground shadow-none",
320
+ motionBase
321
+ ),
322
+ tableFooterBarAttached: "-mt-px rounded-t-none border-t border-border/70 shadow-none",
323
+ tableFooterBarLeading: "flex min-w-0 items-center gap-2",
324
+ tableFooterBarContent: "min-w-0 flex-1",
325
+ tableFooterBarActions: "ml-auto flex shrink-0 flex-wrap items-center gap-2",
326
+ tableRow: cn(
327
+ "border-b border-border/60 data-[state=selected]:bg-primary/5",
328
+ motionBase
329
+ ),
330
+ tableRowInteractive: "cursor-pointer hover:bg-muted/35",
331
+ tableRowSelected: "bg-primary/5",
332
+ tableRowDisabled: "!cursor-not-allowed opacity-60",
333
+ tableHead: "relative h-11 whitespace-nowrap px-3 py-2 text-left align-middle text-xs font-semibold text-muted-foreground",
334
+ tableHeadContent: "flex min-w-0 items-center justify-between gap-2",
335
+ tableHeadMain: "flex min-w-0 items-center gap-2",
336
+ tableHeadIcon: "inline-flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground",
337
+ tableHeadText: "grid min-w-0 gap-0.5",
338
+ tableHeadLabel: "min-w-0 truncate text-xs font-semibold leading-4 text-foreground",
339
+ tableHeadDescription: "min-w-0 truncate text-[11px] font-normal leading-4 text-muted-foreground",
340
+ tableHeadMeta: "shrink-0 text-[11px] font-medium text-muted-foreground",
341
+ tableHeadActions: "flex shrink-0 items-center gap-1",
342
+ tableHeadSortButton: cn(
343
+ "inline-flex min-w-0 cursor-pointer items-center gap-1 rounded-sm text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 disabled:!cursor-not-allowed disabled:opacity-60",
344
+ motionBase
345
+ ),
346
+ tableHeadSortIcon: cn(
347
+ "inline-flex h-3 w-3 shrink-0 items-center justify-center text-muted-foreground",
348
+ motionTransform
349
+ ),
350
+ tableHeadDragHandle: cn(
351
+ "inline-flex h-5 w-4 shrink-0 cursor-grab items-center justify-center rounded-sm text-muted-foreground hover:bg-muted active:cursor-grabbing focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 disabled:!cursor-not-allowed disabled:opacity-50",
352
+ motionBase
353
+ ),
354
+ tableHeadResizeHandle: "absolute right-0 top-1/2 h-7 w-2 -translate-y-1/2 cursor-col-resize rounded-sm after:absolute after:left-1/2 after:top-1/2 after:h-5 after:w-px after:-translate-x-1/2 after:-translate-y-1/2 after:bg-border hover:after:bg-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 disabled:!cursor-not-allowed disabled:opacity-50",
355
+ tableCell: "px-3 py-2 align-middle text-sm text-foreground",
356
+ tableCellAlignCenter: "text-center",
357
+ tableCellAlignRight: "text-right",
358
+ tableEmptyRow: "border-b border-border/60",
359
+ tableEmptyCell: "px-4 py-10 text-center",
360
+ tableEmptyContent: "mx-auto flex max-w-md flex-col items-center justify-center text-center",
361
+ tableEmptyIcon: "mb-3 flex h-10 w-10 items-center justify-center rounded-full bg-muted text-muted-foreground",
362
+ tableEmptyTitle: "text-sm font-semibold text-foreground",
363
+ tableEmptyDescription: "mt-1 text-sm leading-6 text-muted-foreground",
364
+ tableEmptyActions: "mt-4 flex flex-wrap items-center justify-center gap-2",
365
+ tableLoadingRow: "border-b border-border/60",
366
+ tableLoadingCell: "px-3 py-2",
367
+ tableLoadingSkeleton: "h-4 w-full rounded-md bg-muted/70",
368
+ layoutRoot: cn(
369
+ "grid min-w-0 overflow-hidden grid-rows-[auto_minmax(0,1fr)_auto] gap-3 rounded-lg border border-border/70 bg-background p-3 text-foreground",
370
+ motionBase
371
+ ),
372
+ layoutRootFull: "h-full min-h-0",
373
+ layoutHeader: "min-w-0",
374
+ layoutBody: "grid min-h-0 min-w-0 overflow-hidden gap-3",
375
+ layoutSidebar: "min-h-0 min-w-0 overflow-hidden",
376
+ layoutMain: "min-h-0 min-w-0 overflow-hidden",
377
+ layoutAside: "min-h-0 min-w-0 overflow-hidden",
378
+ layoutFooter: "min-w-0",
379
+ layoutPane: cn(
380
+ "h-full max-h-full min-h-0 min-w-0 overflow-hidden rounded-lg bg-background text-foreground",
381
+ motionBase
382
+ ),
383
+ layoutPaneScrollable: "overflow-auto",
384
+ layoutPaneBordered: "border border-border/70",
385
+ layoutPaneMuted: "bg-muted/25",
386
+ layoutPaneSoft: "bg-background/95 shadow-sm",
387
+ layoutPaneTransparent: "bg-transparent shadow-none",
388
+ layoutSplitRoot: "grid min-h-0 min-w-0 overflow-hidden",
389
+ layoutSplitHorizontal: "grid-flow-col",
390
+ layoutSplitVertical: "grid-flow-row",
391
+ layoutSplitPane: "min-h-0 min-w-0 overflow-hidden",
392
+ layoutSplitPrimary: "",
393
+ layoutSplitSecondary: "",
394
+ layoutResizeHandle: cn(
395
+ "group/resize relative z-10 flex shrink-0 items-center justify-center bg-transparent text-muted-foreground hover:bg-border/60 active:bg-border/70 focus-visible:bg-border/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",
396
+ motionInteractive
397
+ ),
398
+ layoutResizeHandleHorizontal: "w-2 cursor-col-resize",
399
+ layoutResizeHandleVertical: "h-2 cursor-row-resize",
400
+ layoutResizeHandleDisabled: "cursor-default opacity-60",
401
+ layoutResizeHandleIndicator: "rounded-full bg-muted-foreground/45 group-hover/resize:bg-primary/70"
402
+ };
403
+ var densitySlots = {
404
+ compact: {
405
+ buttonBase: "h-8 px-2.5 text-xs",
406
+ buttonIconOnly: "h-8 w-8 px-0",
407
+ badgeBase: "px-1.5 py-0 text-[11px]",
408
+ panelHeader: "p-3",
409
+ panelBody: "px-3 pb-3 text-xs",
410
+ panelBodyStandalone: "pt-3",
411
+ panelFooter: "px-3 py-2",
412
+ stateRoot: "min-h-36 px-4 py-7",
413
+ stateIcon: "mb-3 h-10 w-10",
414
+ fieldRoot: "gap-1.5",
415
+ fieldLabel: "text-xs",
416
+ fieldDescription: "text-xs leading-5",
417
+ fieldMessage: "text-xs leading-5",
418
+ controlInput: "h-8 text-xs",
419
+ controlTextarea: "min-h-20 text-xs",
420
+ controlSelect: "h-8 text-xs",
421
+ selectMenu: "text-xs",
422
+ selectOption: "min-h-7 px-2 py-1 text-xs",
423
+ switchTrack: "h-5 w-9",
424
+ switchThumb: "h-3.5 w-3.5",
425
+ checkboxBox: "h-3.5 w-3.5",
426
+ checkboxLabel: "text-xs",
427
+ checkboxDescription: "text-xs leading-5",
428
+ radioOption: "px-2 py-1.5 text-xs",
429
+ radioMarker: "h-3.5 w-3.5",
430
+ radioIndicator: "h-1.5 w-1.5",
431
+ radioLabel: "text-xs",
432
+ radioDescription: "text-xs leading-5",
433
+ dialogPanel: "max-w-md",
434
+ dialogHeader: "px-4 py-3",
435
+ dialogTitle: "text-sm leading-5",
436
+ dialogDescription: "text-xs leading-5",
437
+ dialogBody: "px-4 py-3 text-xs",
438
+ dialogFooter: "px-4 py-3",
439
+ dropdownMenu: "min-w-44 text-xs",
440
+ dropdownItem: "px-2 py-1.5 text-xs",
441
+ tooltipContent: "text-[11px] leading-4",
442
+ noticeBase: "px-3 py-2 text-xs",
443
+ dividerLabel: "text-[11px]",
444
+ sectionHeaderRoot: "gap-2",
445
+ sectionHeaderTitle: "text-sm leading-5",
446
+ sectionHeaderDescription: "text-xs leading-5",
447
+ tabsList: "gap-0.5 p-0.5",
448
+ tabsTrigger: "px-2 py-1 text-xs",
449
+ tabsPanel: "p-3 text-xs",
450
+ segmentedRoot: "gap-0.5 p-0.5",
451
+ segmentedItem: "px-2 py-1 text-xs",
452
+ progressTrack: "h-1.5",
453
+ avatarRoot: "text-xs",
454
+ toolbarRoot: "gap-2 px-3 py-2",
455
+ toolbarTitle: "text-xs",
456
+ toolbarDescription: "text-xs leading-5",
457
+ paginationButton: "h-7 min-w-7 px-2 text-xs",
458
+ paginationPage: "h-7 min-w-7 px-2 text-xs",
459
+ descriptionListRoot: "gap-2 text-xs",
460
+ descriptionListItem: "px-2 py-1.5",
461
+ descriptionListTerm: "text-[11px]",
462
+ descriptionListValue: "text-xs leading-5",
463
+ accordionTrigger: "px-3 py-2 text-xs",
464
+ accordionPanel: "px-3 py-2 text-xs leading-5",
465
+ menuContent: "min-w-40 p-0.5 text-xs",
466
+ menuSubContent: "min-w-36 p-0.5 text-xs",
467
+ menuLabel: "px-2 py-1 text-[11px]",
468
+ menuItem: "min-h-7 px-2 py-1 text-xs",
469
+ menuSubTrigger: "min-h-7 px-2 py-1 text-xs",
470
+ menuItemShortcut: "text-[11px]",
471
+ tableHead: "h-9 px-2 py-1.5 text-[11px]",
472
+ tableCell: "px-2 py-1.5 text-xs",
473
+ tableHeadLabel: "text-[11px]",
474
+ tableHeadDescription: "text-[10px] leading-3",
475
+ tableLoadingCell: "px-2 py-1.5",
476
+ layoutRoot: "gap-2 p-2",
477
+ layoutBody: "gap-2",
478
+ layoutPane: "rounded-md text-xs",
479
+ layoutResizeHandleHorizontal: "w-1.5",
480
+ layoutResizeHandleVertical: "h-1.5"
481
+ },
482
+ default: {
483
+ buttonBase: "h-9"
484
+ },
485
+ comfortable: {
486
+ buttonBase: "h-10 px-3.5",
487
+ buttonIconOnly: "h-10 w-10 px-0",
488
+ badgeBase: "px-2.5 py-1",
489
+ panelHeader: "p-5",
490
+ panelBody: "px-5 pb-5",
491
+ panelBodyStandalone: "pt-5",
492
+ panelFooter: "px-5 py-3.5",
493
+ stateRoot: "min-h-56 px-8 py-12",
494
+ stateIcon: "mb-5 h-14 w-14",
495
+ fieldRoot: "gap-2.5",
496
+ controlInput: "h-10",
497
+ controlTextarea: "min-h-28",
498
+ controlSelect: "h-10",
499
+ selectMenu: "p-1.5",
500
+ selectOption: "min-h-9 px-3 py-2",
501
+ switchTrack: "h-7 w-12",
502
+ switchThumb: "h-5 w-5",
503
+ checkboxBox: "h-5 w-5",
504
+ radioOption: "px-4 py-3",
505
+ radioMarker: "h-5 w-5",
506
+ radioIndicator: "h-2.5 w-2.5",
507
+ dialogPanel: "max-w-xl",
508
+ dialogHeader: "px-6 py-5",
509
+ dialogBody: "px-6 py-5",
510
+ dialogFooter: "px-6 py-5",
511
+ dropdownMenu: "min-w-56",
512
+ dropdownItem: "px-3 py-2.5",
513
+ noticeBase: "px-5 py-4",
514
+ sectionHeaderTitle: "text-lg leading-7",
515
+ tabsTrigger: "px-3.5 py-2",
516
+ tabsPanel: "p-5",
517
+ segmentedItem: "px-3.5 py-2",
518
+ progressTrack: "h-2.5",
519
+ toolbarRoot: "px-5 py-4",
520
+ paginationButton: "h-9 min-w-9 px-3",
521
+ paginationPage: "h-9 min-w-9 px-3",
522
+ descriptionListItem: "px-4 py-3",
523
+ accordionTrigger: "px-5 py-4",
524
+ accordionPanel: "px-5 py-4",
525
+ menuContent: "min-w-48 p-1.5",
526
+ menuSubContent: "min-w-44 p-1.5",
527
+ menuItem: "min-h-9 px-3 py-2",
528
+ menuSubTrigger: "min-h-9 px-3 py-2",
529
+ tableHead: "h-12 px-4 py-3",
530
+ tableCell: "px-4 py-3",
531
+ tableLoadingCell: "px-4 py-3",
532
+ layoutRoot: "gap-4 p-4",
533
+ layoutBody: "gap-4",
534
+ layoutPane: "rounded-xl",
535
+ layoutResizeHandleHorizontal: "w-2.5",
536
+ layoutResizeHandleVertical: "h-2.5"
537
+ }
538
+ };
539
+ var radiusSlots = {
540
+ none: {
541
+ buttonBase: "rounded-none",
542
+ badgeBase: "rounded-none",
543
+ panelRoot: "rounded-none",
544
+ stateRoot: "rounded-none",
545
+ stateIcon: "rounded-none",
546
+ controlWrapper: "rounded-none",
547
+ selectMenu: "rounded-none",
548
+ selectOption: "rounded-none",
549
+ switchTrack: "rounded-none",
550
+ switchThumb: "rounded-none",
551
+ checkboxBox: "rounded-none",
552
+ radioOption: "rounded-none",
553
+ dialogPanel: "rounded-none",
554
+ dialogClose: "rounded-none",
555
+ dropdownMenu: "rounded-none",
556
+ dropdownItem: "rounded-none",
557
+ tooltipContent: "rounded-none",
558
+ noticeBase: "rounded-none",
559
+ tabsList: "rounded-none",
560
+ tabsTrigger: "rounded-none",
561
+ tabsPanel: "rounded-none",
562
+ segmentedRoot: "rounded-none",
563
+ segmentedItem: "rounded-none",
564
+ progressTrack: "rounded-none",
565
+ progressIndicator: "rounded-none",
566
+ skeletonRoot: "rounded-none",
567
+ avatarRoot: "rounded-none",
568
+ avatarStatus: "rounded-none",
569
+ toolbarRoot: "rounded-none",
570
+ paginationButton: "rounded-none",
571
+ paginationPage: "rounded-none",
572
+ descriptionListItem: "rounded-none",
573
+ accordionItem: "rounded-none",
574
+ menuContent: "rounded-none",
575
+ menuItem: "rounded-none",
576
+ menuSubTrigger: "rounded-none",
577
+ menuSubContent: "rounded-none",
578
+ tableContainer: "rounded-none",
579
+ tableEmptyIcon: "rounded-none",
580
+ tableLoadingSkeleton: "rounded-none",
581
+ layoutRoot: "rounded-none",
582
+ layoutPane: "rounded-none"
583
+ },
584
+ sm: {
585
+ buttonBase: "rounded-sm",
586
+ badgeBase: "rounded-sm",
587
+ panelRoot: "rounded-sm",
588
+ stateRoot: "rounded-sm",
589
+ stateIcon: "rounded-sm",
590
+ controlWrapper: "rounded-sm",
591
+ selectMenu: "rounded-sm",
592
+ selectOption: "rounded-sm",
593
+ switchTrack: "rounded-sm",
594
+ switchThumb: "rounded-sm",
595
+ checkboxBox: "rounded-sm",
596
+ radioOption: "rounded-sm",
597
+ dialogPanel: "rounded-sm",
598
+ dialogClose: "rounded-sm",
599
+ dropdownMenu: "rounded-sm",
600
+ dropdownItem: "rounded-sm",
601
+ tooltipContent: "rounded-sm",
602
+ noticeBase: "rounded-sm",
603
+ tabsList: "rounded-sm",
604
+ tabsTrigger: "rounded-sm",
605
+ tabsPanel: "rounded-sm",
606
+ segmentedRoot: "rounded-sm",
607
+ segmentedItem: "rounded-sm",
608
+ progressTrack: "rounded-sm",
609
+ progressIndicator: "rounded-sm",
610
+ skeletonRoot: "rounded-sm",
611
+ avatarRoot: "rounded-sm",
612
+ avatarStatus: "rounded-sm",
613
+ toolbarRoot: "rounded-sm",
614
+ paginationButton: "rounded-sm",
615
+ paginationPage: "rounded-sm",
616
+ descriptionListItem: "rounded-sm",
617
+ accordionItem: "rounded-sm",
618
+ menuContent: "rounded-sm",
619
+ menuItem: "rounded-sm",
620
+ menuSubTrigger: "rounded-sm",
621
+ menuSubContent: "rounded-sm",
622
+ tableContainer: "rounded-sm",
623
+ tableEmptyIcon: "rounded-sm",
624
+ tableLoadingSkeleton: "rounded-sm",
625
+ layoutRoot: "rounded-sm",
626
+ layoutPane: "rounded-sm"
627
+ },
628
+ md: {},
629
+ lg: {
630
+ buttonBase: "rounded-lg",
631
+ badgeBase: "rounded-lg",
632
+ panelRoot: "rounded-xl",
633
+ stateRoot: "rounded-xl",
634
+ stateIcon: "rounded-xl",
635
+ controlWrapper: "rounded-lg",
636
+ selectMenu: "rounded-lg",
637
+ selectOption: "rounded-md",
638
+ switchTrack: "rounded-full",
639
+ switchThumb: "rounded-full",
640
+ checkboxBox: "rounded-md",
641
+ radioOption: "rounded-xl",
642
+ dialogPanel: "rounded-xl",
643
+ dialogClose: "rounded-lg",
644
+ dropdownMenu: "rounded-lg",
645
+ dropdownItem: "rounded-md",
646
+ tooltipContent: "rounded-md",
647
+ noticeBase: "rounded-xl",
648
+ tabsList: "rounded-xl",
649
+ tabsTrigger: "rounded-lg",
650
+ tabsPanel: "rounded-xl",
651
+ segmentedRoot: "rounded-xl",
652
+ segmentedItem: "rounded-lg",
653
+ skeletonRoot: "rounded-lg",
654
+ toolbarRoot: "rounded-xl",
655
+ descriptionListItem: "rounded-lg",
656
+ accordionItem: "rounded-xl",
657
+ menuContent: "rounded-lg",
658
+ menuItem: "rounded-md",
659
+ menuSubTrigger: "rounded-md",
660
+ menuSubContent: "rounded-lg",
661
+ tableContainer: "rounded-xl",
662
+ tableEmptyIcon: "rounded-xl",
663
+ tableLoadingSkeleton: "rounded-lg",
664
+ layoutRoot: "rounded-xl",
665
+ layoutPane: "rounded-xl"
666
+ },
667
+ xl: {
668
+ buttonBase: "rounded-xl",
669
+ badgeBase: "rounded-xl",
670
+ panelRoot: "rounded-2xl",
671
+ stateRoot: "rounded-2xl",
672
+ stateIcon: "rounded-2xl",
673
+ controlWrapper: "rounded-xl",
674
+ selectMenu: "rounded-xl",
675
+ selectOption: "rounded-lg",
676
+ switchTrack: "rounded-full",
677
+ switchThumb: "rounded-full",
678
+ checkboxBox: "rounded-lg",
679
+ radioOption: "rounded-2xl",
680
+ dialogPanel: "rounded-2xl",
681
+ dialogClose: "rounded-xl",
682
+ dropdownMenu: "rounded-xl",
683
+ dropdownItem: "rounded-lg",
684
+ tooltipContent: "rounded-lg",
685
+ noticeBase: "rounded-2xl",
686
+ tabsList: "rounded-2xl",
687
+ tabsTrigger: "rounded-xl",
688
+ tabsPanel: "rounded-2xl",
689
+ segmentedRoot: "rounded-2xl",
690
+ segmentedItem: "rounded-xl",
691
+ skeletonRoot: "rounded-xl",
692
+ toolbarRoot: "rounded-2xl",
693
+ paginationButton: "rounded-xl",
694
+ paginationPage: "rounded-xl",
695
+ descriptionListItem: "rounded-xl",
696
+ accordionItem: "rounded-2xl",
697
+ menuContent: "rounded-xl",
698
+ menuItem: "rounded-lg",
699
+ menuSubTrigger: "rounded-lg",
700
+ menuSubContent: "rounded-xl",
701
+ tableContainer: "rounded-2xl",
702
+ tableEmptyIcon: "rounded-2xl",
703
+ tableLoadingSkeleton: "rounded-xl",
704
+ layoutRoot: "rounded-2xl",
705
+ layoutPane: "rounded-2xl"
706
+ },
707
+ full: {
708
+ buttonBase: "rounded-full",
709
+ badgeBase: "rounded-full",
710
+ panelRoot: "rounded-2xl",
711
+ stateRoot: "rounded-2xl",
712
+ stateIcon: "rounded-full",
713
+ controlWrapper: "rounded-full",
714
+ selectMenu: "rounded-2xl",
715
+ selectOption: "rounded-full",
716
+ switchTrack: "rounded-full",
717
+ switchThumb: "rounded-full",
718
+ checkboxBox: "rounded-full",
719
+ radioOption: "rounded-2xl",
720
+ dialogPanel: "rounded-2xl",
721
+ dialogClose: "rounded-full",
722
+ dropdownMenu: "rounded-2xl",
723
+ dropdownItem: "rounded-full",
724
+ tooltipContent: "rounded-full",
725
+ noticeBase: "rounded-2xl",
726
+ tabsList: "rounded-full",
727
+ tabsTrigger: "rounded-full",
728
+ tabsPanel: "rounded-2xl",
729
+ segmentedRoot: "rounded-full",
730
+ segmentedItem: "rounded-full",
731
+ progressTrack: "rounded-full",
732
+ progressIndicator: "rounded-full",
733
+ skeletonRoot: "rounded-full",
734
+ avatarRoot: "rounded-full",
735
+ avatarStatus: "rounded-full",
736
+ toolbarRoot: "rounded-2xl",
737
+ paginationButton: "rounded-full",
738
+ paginationPage: "rounded-full",
739
+ descriptionListItem: "rounded-2xl",
740
+ accordionItem: "rounded-2xl",
741
+ menuContent: "rounded-2xl",
742
+ menuItem: "rounded-full",
743
+ menuSubTrigger: "rounded-full",
744
+ menuSubContent: "rounded-2xl",
745
+ tableContainer: "rounded-2xl",
746
+ tableEmptyIcon: "rounded-full",
747
+ tableLoadingSkeleton: "rounded-full",
748
+ layoutRoot: "rounded-2xl",
749
+ layoutPane: "rounded-2xl"
750
+ }
751
+ };
752
+ var borderSlots = {
753
+ none: {
754
+ buttonBase: "border-transparent",
755
+ badgeBase: "border-transparent",
756
+ panelRoot: "border-transparent",
757
+ panelFooter: "border-transparent",
758
+ stateRoot: "border-transparent",
759
+ controlWrapper: "border-transparent",
760
+ selectMenu: "border-transparent",
761
+ switchTrack: "border-transparent",
762
+ checkboxBox: "border-transparent",
763
+ radioOption: "border-transparent",
764
+ radioMarker: "border-transparent",
765
+ dialogPanel: "border-transparent",
766
+ dialogHeader: "border-transparent",
767
+ dialogFooter: "border-transparent",
768
+ dropdownMenu: "border-transparent",
769
+ tooltipContent: "border-transparent",
770
+ noticeBase: "border-transparent",
771
+ dividerRoot: "border-transparent",
772
+ tabsList: "border-transparent",
773
+ tabsPanel: "border-transparent",
774
+ segmentedRoot: "border-transparent",
775
+ avatarRoot: "border-transparent",
776
+ toolbarRoot: "border-transparent",
777
+ paginationButton: "border-transparent",
778
+ descriptionListItem: "border-transparent",
779
+ accordionItem: "border-transparent",
780
+ accordionPanel: "border-transparent",
781
+ menuContent: "border-transparent",
782
+ menuSeparator: "bg-transparent",
783
+ menuSubContent: "border-transparent",
784
+ tableContainer: "border-transparent",
785
+ tableHeader: "border-transparent",
786
+ tableFooter: "border-transparent",
787
+ tableFooterBar: "border-transparent",
788
+ tableFooterBarAttached: "border-t border-transparent",
789
+ tableRow: "border-transparent",
790
+ tableEmptyRow: "border-transparent",
791
+ tableLoadingRow: "border-transparent",
792
+ layoutRoot: "border-transparent",
793
+ layoutPaneBordered: "border-transparent",
794
+ layoutResizeHandle: "bg-transparent hover:bg-transparent active:bg-transparent focus-visible:bg-transparent"
795
+ },
796
+ subtle: {
797
+ buttonDefault: "border-border/60",
798
+ badgeDefault: "border-border/60",
799
+ panelRoot: "border-border/60",
800
+ panelFooter: "border-border/60",
801
+ stateRoot: "border-border/60",
802
+ controlWrapper: "border-border/60",
803
+ selectMenu: "border-border/60",
804
+ switchTrack: "border-border/60",
805
+ checkboxBox: "border-border/60",
806
+ radioOption: "border-border/60",
807
+ radioMarker: "border-border/60",
808
+ dialogPanel: "border-border/60",
809
+ dialogHeader: "border-border/60",
810
+ dialogFooter: "border-border/60",
811
+ dropdownMenu: "border-border/60",
812
+ tooltipContent: "border-border/60",
813
+ noticeDefault: "border-border/60",
814
+ dividerRoot: "border-border/60",
815
+ tabsList: "border-border/60",
816
+ tabsPanel: "border-border/60",
817
+ segmentedRoot: "border-border/60",
818
+ avatarRoot: "border-border/60",
819
+ toolbarRoot: "border-border/60",
820
+ paginationButton: "border-border/60",
821
+ descriptionListItem: "border-border/60",
822
+ accordionItem: "border-border/60",
823
+ accordionPanel: "border-border/60",
824
+ menuContent: "border-border/60",
825
+ menuSeparator: "bg-border/60",
826
+ menuSubContent: "border-border/60",
827
+ tableContainer: "border-border/60",
828
+ tableHeader: "border-border/60",
829
+ tableFooter: "border-border/60",
830
+ tableFooterBar: "border-border/60",
831
+ tableFooterBarAttached: "border-t border-border/60",
832
+ tableRow: "border-border/50",
833
+ tableEmptyRow: "border-border/50",
834
+ tableLoadingRow: "border-border/50",
835
+ layoutRoot: "border-border/60",
836
+ layoutPaneBordered: "border-border/60"
837
+ },
838
+ solid: {},
839
+ strong: {
840
+ buttonDefault: "border-foreground/20",
841
+ badgeDefault: "border-foreground/20",
842
+ panelRoot: "border-foreground/20",
843
+ panelFooter: "border-foreground/20",
844
+ stateRoot: "border-foreground/20",
845
+ controlWrapper: "border-foreground/20",
846
+ selectMenu: "border-foreground/20",
847
+ switchTrack: "border-foreground/20",
848
+ checkboxBox: "border-foreground/20",
849
+ radioOption: "border-foreground/20",
850
+ radioMarker: "border-foreground/20",
851
+ dialogPanel: "border-foreground/20",
852
+ dialogHeader: "border-foreground/15",
853
+ dialogFooter: "border-foreground/15",
854
+ dropdownMenu: "border-foreground/20",
855
+ tooltipContent: "border-foreground/20",
856
+ noticeDefault: "border-foreground/20",
857
+ dividerRoot: "border-foreground/20",
858
+ tabsList: "border-foreground/20",
859
+ tabsPanel: "border-foreground/20",
860
+ segmentedRoot: "border-foreground/20",
861
+ avatarRoot: "border-foreground/20",
862
+ toolbarRoot: "border-foreground/20",
863
+ paginationButton: "border-foreground/20",
864
+ descriptionListItem: "border-foreground/20",
865
+ accordionItem: "border-foreground/20",
866
+ accordionPanel: "border-foreground/20",
867
+ menuContent: "border-foreground/20",
868
+ menuSeparator: "bg-foreground/15",
869
+ menuSubContent: "border-foreground/20",
870
+ tableContainer: "border-foreground/20",
871
+ tableHeader: "border-foreground/20",
872
+ tableFooter: "border-foreground/20",
873
+ tableFooterBar: "border-foreground/20",
874
+ tableFooterBarAttached: "border-t border-foreground/20",
875
+ tableRow: "border-foreground/15",
876
+ tableEmptyRow: "border-foreground/15",
877
+ tableLoadingRow: "border-foreground/15",
878
+ layoutRoot: "border-foreground/20",
879
+ layoutPaneBordered: "border-foreground/20",
880
+ layoutResizeHandle: "hover:bg-foreground/15 active:bg-foreground/20 focus-visible:bg-foreground/15"
881
+ }
882
+ };
883
+ var backgroundSlots = {
884
+ plain: {},
885
+ muted: {
886
+ buttonDefault: "bg-muted/20 hover:bg-muted/45",
887
+ panelRoot: "bg-card",
888
+ panelFooter: "bg-muted/20",
889
+ stateRoot: "bg-muted/20",
890
+ controlWrapper: "bg-background",
891
+ selectMenu: "bg-background",
892
+ selectOptionActive: "bg-muted/70 text-foreground",
893
+ checkboxBox: "bg-background",
894
+ radioOption: "bg-card hover:bg-muted/45",
895
+ radioMarker: "bg-background",
896
+ dialogPanel: "bg-card",
897
+ dropdownMenu: "bg-background",
898
+ dropdownItem: "hover:bg-muted/60",
899
+ tooltipContent: "bg-popover",
900
+ noticeDefault: "bg-muted/20",
901
+ tabsList: "bg-muted/35",
902
+ tabsTriggerActive: "bg-background",
903
+ tabsPanel: "bg-card",
904
+ segmentedRoot: "bg-muted/35",
905
+ segmentedItemActive: "bg-background",
906
+ progressTrack: "bg-muted/60",
907
+ skeletonRoot: "bg-muted",
908
+ toolbarRoot: "bg-card",
909
+ paginationButton: "bg-background hover:bg-muted/60",
910
+ paginationPage: "bg-muted/60",
911
+ descriptionListItem: "bg-card",
912
+ accordionItem: "bg-card",
913
+ menuContent: "bg-background",
914
+ menuItem: "focus:bg-muted/70 data-[highlighted]:bg-muted/70",
915
+ menuSubTrigger: "focus:bg-muted/70 data-[highlighted]:bg-muted/70 data-[state=open]:bg-muted/70",
916
+ menuSubContent: "bg-background",
917
+ tableContainer: "bg-card",
918
+ tableHeader: "bg-muted/45",
919
+ tableFooter: "bg-muted/35",
920
+ tableFooterBar: "bg-muted/30 shadow-none",
921
+ tableRowInteractive: "cursor-pointer hover:bg-muted/45",
922
+ tableLoadingSkeleton: "bg-muted",
923
+ layoutRoot: "bg-card",
924
+ layoutPane: "bg-card",
925
+ layoutPaneMuted: "bg-muted/35",
926
+ layoutResizeHandle: "hover:bg-border/70 active:bg-border/80 focus-visible:bg-border/70"
927
+ },
928
+ soft: {
929
+ buttonDefault: "bg-muted/30 hover:bg-muted/55",
930
+ panelRoot: "bg-background/95 shadow-sm",
931
+ stateRoot: "bg-background/95 shadow-sm",
932
+ controlWrapper: "bg-background/95",
933
+ selectMenu: "bg-background/95 shadow-xl",
934
+ selectOptionActive: "bg-muted/60 text-foreground",
935
+ checkboxBox: "bg-background/95",
936
+ radioOption: "bg-background/95 shadow-sm hover:bg-muted/35",
937
+ radioMarker: "bg-background/95",
938
+ dialogPanel: "bg-background/95 shadow-xl",
939
+ dropdownMenu: "bg-background/95 shadow-xl",
940
+ dropdownItem: "hover:bg-muted/55",
941
+ tooltipContent: "bg-popover shadow-xl",
942
+ noticeDefault: "bg-background/95 shadow-sm",
943
+ tabsList: "bg-background/60 shadow-sm",
944
+ tabsTriggerActive: "bg-background",
945
+ tabsPanel: "bg-background/95 shadow-sm",
946
+ segmentedRoot: "bg-background/60 shadow-sm",
947
+ segmentedItemActive: "bg-background",
948
+ skeletonRoot: "bg-background/80",
949
+ toolbarRoot: "bg-background/95 shadow-sm",
950
+ paginationButton: "bg-background/95 hover:bg-muted/55",
951
+ descriptionListItem: "bg-background/95 shadow-sm",
952
+ accordionItem: "bg-background/95 shadow-sm",
953
+ menuContent: "bg-background/95 shadow-xl",
954
+ menuItem: "focus:bg-muted/60 data-[highlighted]:bg-muted/60",
955
+ menuSubTrigger: "focus:bg-muted/60 data-[highlighted]:bg-muted/60 data-[state=open]:bg-muted/60",
956
+ menuSubContent: "bg-background/95 shadow-xl",
957
+ tableContainer: "bg-background/95 shadow-sm",
958
+ tableHeader: "bg-muted/35",
959
+ tableFooter: "bg-muted/25",
960
+ tableFooterBar: "bg-muted/25 shadow-none",
961
+ tableRowInteractive: "cursor-pointer hover:bg-muted/35",
962
+ tableLoadingSkeleton: "bg-muted/65",
963
+ layoutRoot: "bg-background/95 shadow-sm",
964
+ layoutPane: "bg-background/95 shadow-sm",
965
+ layoutPaneSoft: "bg-background/95 shadow-md"
966
+ },
967
+ glass: {
968
+ buttonBase: "backdrop-blur-md",
969
+ buttonDefault: "border-white/10 bg-white/[0.08] text-foreground hover:bg-white/[0.14]",
970
+ badgeDefault: "border-white/10 bg-white/[0.08] text-foreground",
971
+ panelRoot: "border-white/10 bg-white/[0.06] shadow-none backdrop-blur-md",
972
+ panelFooter: "border-white/10 bg-white/[0.05]",
973
+ stateRoot: "border-white/10 bg-white/[0.06] shadow-none backdrop-blur-md",
974
+ stateIcon: "bg-white/10 text-foreground",
975
+ controlWrapper: "border-white/10 bg-white/[0.08] text-foreground backdrop-blur-md",
976
+ selectMenu: "border-white/10 bg-white/[0.10] text-foreground shadow-[0_18px_60px_rgba(15,23,42,0.18)] backdrop-blur-md",
977
+ selectOption: "text-foreground",
978
+ selectOptionActive: "bg-white/[0.14] text-foreground",
979
+ selectOptionSelected: "bg-white/[0.18] text-foreground",
980
+ switchTrack: "border-white/10 bg-white/[0.12] backdrop-blur-md",
981
+ checkboxBox: "border-white/10 bg-white/[0.08] backdrop-blur-md",
982
+ checkboxBoxChecked: "border-white/20 bg-white/[0.22] text-foreground",
983
+ radioOption: "border-white/10 bg-white/[0.06] backdrop-blur-md hover:bg-white/[0.10]",
984
+ radioMarker: "border-white/10 bg-white/[0.08] backdrop-blur-md",
985
+ radioMarkerChecked: "border-white/25 bg-white/[0.16]",
986
+ dialogOverlay: "bg-background/45 backdrop-blur-md",
987
+ dialogPanel: "border-white/10 bg-white/[0.08] shadow-2xl backdrop-blur-md",
988
+ dialogHeader: "border-white/10",
989
+ dialogFooter: "border-white/10",
990
+ dropdownMenu: "border-white/10 bg-white/[0.10] text-foreground shadow-[0_18px_60px_rgba(15,23,42,0.18)] backdrop-blur-md",
991
+ dropdownItem: "text-foreground hover:bg-white/[0.14]",
992
+ tooltipContent: "border-white/10 bg-white/[0.14] text-foreground shadow-[0_18px_60px_rgba(15,23,42,0.18)] backdrop-blur-md",
993
+ noticeDefault: "border-white/10 bg-white/[0.08] text-foreground backdrop-blur-md",
994
+ dividerRoot: "border-white/15",
995
+ tabsList: "border-white/10 bg-white/[0.08] backdrop-blur-md",
996
+ tabsTrigger: "text-muted-foreground hover:bg-white/[0.12] hover:text-foreground",
997
+ tabsTriggerActive: "bg-white/[0.16] text-foreground shadow-none",
998
+ tabsPanel: "border-white/10 bg-white/[0.06] shadow-none backdrop-blur-md",
999
+ segmentedRoot: "border-white/10 bg-white/[0.08] backdrop-blur-md",
1000
+ segmentedItem: "text-muted-foreground hover:bg-white/[0.12] hover:text-foreground",
1001
+ segmentedItemActive: "bg-white/[0.16] text-foreground shadow-none",
1002
+ progressTrack: "bg-white/[0.12]",
1003
+ skeletonRoot: "bg-white/[0.16]",
1004
+ avatarRoot: "border-white/10 bg-white/[0.12] text-foreground",
1005
+ avatarFallback: "bg-white/[0.12] text-foreground",
1006
+ avatarStatus: "border-background",
1007
+ toolbarRoot: "border-white/10 bg-white/[0.06] shadow-none backdrop-blur-md",
1008
+ paginationButton: "border-white/10 bg-white/[0.08] text-foreground hover:bg-white/[0.14]",
1009
+ paginationPage: "bg-white/[0.12] text-foreground",
1010
+ descriptionListItem: "border-white/10 bg-white/[0.06] shadow-none backdrop-blur-md",
1011
+ accordionItem: "border-white/10 bg-white/[0.06] shadow-none backdrop-blur-md",
1012
+ accordionPanel: "border-white/10",
1013
+ menuContent: "border-white/10 bg-white/[0.10] text-foreground shadow-[0_18px_60px_rgba(15,23,42,0.18)] backdrop-blur-md",
1014
+ menuSeparator: "bg-white/10",
1015
+ menuItem: "text-foreground focus:bg-white/[0.14] focus:text-foreground data-[highlighted]:bg-white/[0.14] data-[highlighted]:text-foreground",
1016
+ menuSubTrigger: "text-foreground focus:bg-white/[0.14] focus:text-foreground data-[highlighted]:bg-white/[0.14] data-[highlighted]:text-foreground data-[state=open]:bg-white/[0.16]",
1017
+ menuSubContent: "border-white/10 bg-white/[0.10] text-foreground shadow-[0_18px_60px_rgba(15,23,42,0.18)] backdrop-blur-md",
1018
+ tableContainer: "border-white/10 bg-white/[0.06] shadow-none backdrop-blur-md",
1019
+ tableHeader: "border-white/10 bg-white/[0.08]",
1020
+ tableFooter: "border-white/10 bg-white/[0.05]",
1021
+ tableFooterBar: "border-white/10 bg-white/[0.05] shadow-none backdrop-blur-md",
1022
+ tableFooterBarAttached: "border-t border-white/10",
1023
+ tableRow: "border-white/10",
1024
+ tableRowInteractive: "cursor-pointer hover:bg-white/[0.08]",
1025
+ tableHeadLabel: "text-foreground",
1026
+ tableLoadingSkeleton: "bg-white/[0.16]",
1027
+ layoutRoot: "border-white/10 bg-white/[0.05] shadow-none backdrop-blur-md",
1028
+ layoutPane: "border-white/10 bg-white/[0.06] shadow-none backdrop-blur-md",
1029
+ layoutPaneMuted: "bg-white/[0.08]",
1030
+ layoutPaneSoft: "bg-white/[0.10] shadow-none backdrop-blur-md",
1031
+ layoutResizeHandle: "text-foreground/65 hover:bg-white/10 active:bg-white/15 focus-visible:bg-white/10",
1032
+ layoutResizeHandleIndicator: "bg-white/45 group-hover/resize:bg-white/75"
1033
+ },
1034
+ dark: {
1035
+ buttonBase: "border-white/15 text-white shadow-lg backdrop-blur",
1036
+ buttonDefault: "bg-black/30 hover:bg-black/[0.45]",
1037
+ buttonPrimary: "border-white/25 bg-white/20 text-white hover:bg-white/25",
1038
+ buttonMuted: "border-white/10 bg-black/20 text-white/70 hover:bg-black/[0.35] hover:text-white",
1039
+ badgeDefault: "border-white/10 bg-white/[0.08] text-white",
1040
+ badgeMuted: "border-white/10 bg-black/20 text-white/70",
1041
+ panelRoot: "border-white/10 bg-slate-950 text-white shadow-none",
1042
+ panelTitle: "text-white",
1043
+ panelDescription: "text-white/65",
1044
+ panelBody: "text-white/85",
1045
+ panelFooter: "border-white/10 bg-white/[0.04]",
1046
+ stateRoot: "border-white/10 bg-slate-950 text-white shadow-none",
1047
+ stateIcon: "bg-white/10 text-white/75",
1048
+ stateTitle: "text-white",
1049
+ stateDescription: "text-white/65",
1050
+ fieldLabel: "text-white",
1051
+ fieldDescription: "text-white/65",
1052
+ fieldMessage: "text-white/65",
1053
+ controlWrapper: "border-white/15 bg-black/30 text-white shadow-lg backdrop-blur focus-within:border-white/35",
1054
+ controlBase: "text-white placeholder:text-white/45",
1055
+ selectChevron: "text-white/65",
1056
+ selectMenu: "border-white/15 bg-slate-950 text-white shadow-2xl",
1057
+ selectOption: "text-white",
1058
+ selectOptionActive: "bg-white/[0.12] text-white",
1059
+ selectOptionSelected: "bg-white/[0.16] text-white",
1060
+ selectPlaceholder: "text-white/45",
1061
+ switchTrack: "border-white/15 bg-black/30 shadow-lg backdrop-blur",
1062
+ switchChecked: "border-white/25 bg-white/25 text-white",
1063
+ switchLabel: "text-white",
1064
+ switchDescription: "text-white/65",
1065
+ checkboxBox: "border-white/15 bg-black/30 text-white shadow-lg backdrop-blur",
1066
+ checkboxBoxChecked: "border-white/25 bg-white/25 text-white",
1067
+ checkboxLabel: "text-white",
1068
+ checkboxDescription: "text-white/65",
1069
+ radioOption: "border-white/10 bg-white/[0.06] text-white hover:bg-white/[0.08]",
1070
+ radioMarker: "border-white/15 bg-black/30 text-white shadow-lg backdrop-blur",
1071
+ radioMarkerChecked: "border-white/25 bg-white/25",
1072
+ radioIndicator: "bg-white",
1073
+ radioLabel: "text-white",
1074
+ radioDescription: "text-white/65",
1075
+ dialogOverlay: "bg-slate-950/75",
1076
+ dialogPanel: "border-white/10 bg-slate-950 text-white shadow-2xl",
1077
+ dialogHeader: "border-white/10",
1078
+ dialogTitle: "text-white",
1079
+ dialogDescription: "text-white/65",
1080
+ dialogBody: "text-white/85",
1081
+ dialogFooter: "border-white/10",
1082
+ dialogClose: "text-white/65 hover:bg-white/[0.08] hover:text-white",
1083
+ dropdownMenu: "border-white/15 bg-slate-950 text-white shadow-2xl",
1084
+ dropdownLabel: "text-white/55",
1085
+ dropdownSeparator: "bg-white/15",
1086
+ dropdownItem: "text-white hover:bg-white/[0.10]",
1087
+ dropdownItemDescription: "text-white/55",
1088
+ dropdownItemShortcut: "text-white/55",
1089
+ tooltipContent: "border-white/15 bg-slate-950 text-white shadow-2xl",
1090
+ noticeDefault: "border-white/10 bg-white/[0.08] text-white",
1091
+ noticeMuted: "border-white/10 bg-black/20 text-white/70",
1092
+ dividerRoot: "border-white/15",
1093
+ dividerLabel: "text-white/55",
1094
+ sectionHeaderEyebrow: "text-white/55",
1095
+ sectionHeaderTitle: "text-white",
1096
+ sectionHeaderDescription: "text-white/65",
1097
+ tabsList: "border-white/10 bg-white/[0.08]",
1098
+ tabsTrigger: "text-white/65 hover:bg-white/[0.12] hover:text-white",
1099
+ tabsTriggerActive: "bg-white/[0.16] text-white shadow-none",
1100
+ tabsPanel: "border-white/10 bg-white/[0.06] text-white",
1101
+ segmentedRoot: "border-white/10 bg-white/[0.08]",
1102
+ segmentedItem: "text-white/65 hover:bg-white/[0.12] hover:text-white",
1103
+ segmentedItemActive: "bg-white/[0.16] text-white shadow-none",
1104
+ progressTrack: "bg-white/[0.12]",
1105
+ progressLabel: "text-white",
1106
+ progressValue: "text-white/65",
1107
+ skeletonRoot: "bg-white/[0.14]",
1108
+ avatarRoot: "border-white/15 bg-white/[0.10] text-white",
1109
+ avatarFallback: "bg-white/[0.10] text-white/75",
1110
+ avatarText: "text-white",
1111
+ avatarStatus: "border-slate-950",
1112
+ toolbarRoot: "border-white/10 bg-white/[0.06] text-white",
1113
+ toolbarTitle: "text-white",
1114
+ toolbarDescription: "text-white/65",
1115
+ breadcrumbLink: "text-white/65 hover:text-white",
1116
+ breadcrumbCurrent: "text-white",
1117
+ breadcrumbSeparator: "text-white/45",
1118
+ paginationInfo: "text-white/65",
1119
+ paginationButton: "border-white/10 bg-white/[0.08] text-white hover:bg-white/[0.14]",
1120
+ paginationPage: "bg-white/[0.14] text-white",
1121
+ descriptionListItem: "border-white/10 bg-white/[0.06]",
1122
+ descriptionListTerm: "text-white/55",
1123
+ descriptionListValue: "text-white",
1124
+ accordionItem: "border-white/10 bg-white/[0.06]",
1125
+ accordionTrigger: "text-white hover:bg-white/[0.08]",
1126
+ accordionPanel: "border-white/10 text-white/70",
1127
+ tableContainer: "border-white/10 bg-slate-950 text-white shadow-none",
1128
+ tableRoot: "text-white",
1129
+ tableHeader: "border-white/10 bg-white/[0.06]",
1130
+ tableFooter: "border-white/10 bg-white/[0.05]",
1131
+ tableFooterBar: "border-white/10 bg-white/[0.05] text-white/65",
1132
+ tableFooterBarAttached: "border-t border-white/10",
1133
+ tableRow: "border-white/10",
1134
+ tableRowInteractive: "cursor-pointer hover:bg-white/[0.06]",
1135
+ tableHead: "text-white/65",
1136
+ tableHeadLabel: "text-white",
1137
+ tableHeadDescription: "text-white/55",
1138
+ tableHeadMeta: "text-white/55",
1139
+ tableHeadIcon: "text-white/55",
1140
+ tableHeadSortIcon: "text-white/55",
1141
+ tableHeadDragHandle: "text-white/55 hover:bg-white/[0.08]",
1142
+ tableHeadResizeHandle: "after:bg-white/20 hover:after:bg-white/60",
1143
+ tableCell: "text-white/85",
1144
+ tableEmptyIcon: "bg-white/10 text-white/65",
1145
+ tableEmptyTitle: "text-white",
1146
+ tableEmptyDescription: "text-white/60",
1147
+ menuContent: "border-white/10 bg-slate-950 text-white shadow-2xl",
1148
+ menuLabel: "text-white/55",
1149
+ menuSeparator: "bg-white/10",
1150
+ menuItem: "text-white focus:bg-white/[0.10] focus:text-white data-[highlighted]:bg-white/[0.10] data-[highlighted]:text-white",
1151
+ menuItemDefault: "text-white",
1152
+ menuItemPrimary: "text-sky-200 focus:text-sky-200 data-[highlighted]:text-sky-200",
1153
+ menuItemSuccess: "text-emerald-200 focus:text-emerald-200 data-[highlighted]:text-emerald-200",
1154
+ menuItemWarning: "text-amber-200 focus:text-amber-200 data-[highlighted]:text-amber-200",
1155
+ menuItemDanger: "text-red-200 focus:text-red-200 data-[highlighted]:text-red-200",
1156
+ menuItemMuted: "text-white/65 focus:text-white data-[highlighted]:text-white",
1157
+ menuItemShortcut: "text-white/45",
1158
+ menuSubTrigger: "text-white focus:bg-white/[0.10] focus:text-white data-[highlighted]:bg-white/[0.10] data-[highlighted]:text-white data-[state=open]:bg-white/[0.12]",
1159
+ menuSubTriggerIcon: "text-white/55",
1160
+ menuSubContent: "border-white/10 bg-slate-950 text-white shadow-2xl",
1161
+ tableLoadingSkeleton: "bg-white/[0.14]",
1162
+ layoutRoot: "border-white/10 bg-slate-950 text-white shadow-none",
1163
+ layoutPane: "border-white/10 bg-slate-950 text-white shadow-none",
1164
+ layoutPaneMuted: "bg-white/[0.06]",
1165
+ layoutPaneSoft: "bg-white/[0.08] shadow-none",
1166
+ layoutResizeHandle: "text-white/65 hover:bg-white/10 active:bg-white/15 focus-visible:bg-white/10",
1167
+ layoutResizeHandleIndicator: "bg-white/45 group-hover/resize:bg-white/75"
1168
+ }
1169
+ };
1170
+ var presetDefaults = {
1171
+ default: {
1172
+ density: "default",
1173
+ radius: "md",
1174
+ border: "solid",
1175
+ background: "plain"
1176
+ },
1177
+ admin: {
1178
+ density: "default",
1179
+ radius: "lg",
1180
+ border: "subtle",
1181
+ background: "soft"
1182
+ },
1183
+ monkey: {
1184
+ density: "compact",
1185
+ radius: "md",
1186
+ border: "subtle",
1187
+ background: "muted"
1188
+ },
1189
+ bsd: {
1190
+ density: "default",
1191
+ radius: "lg",
1192
+ border: "subtle",
1193
+ background: "glass"
1194
+ },
1195
+ glass: {
1196
+ density: "default",
1197
+ radius: "xl",
1198
+ border: "subtle",
1199
+ background: "glass"
1200
+ },
1201
+ "hard-edge": {
1202
+ density: "compact",
1203
+ radius: "none",
1204
+ border: "strong",
1205
+ background: "plain"
1206
+ }
1207
+ };
1208
+ var presetSlots = {
1209
+ admin: {
1210
+ buttonBase: "font-medium",
1211
+ panelRoot: "border-border/70",
1212
+ controlWrapper: "font-medium",
1213
+ tabsTrigger: "font-medium",
1214
+ segmentedItem: "font-medium",
1215
+ toolbarRoot: "border-border/70",
1216
+ tableContainer: "border-border/70",
1217
+ tableFooterBar: "border-border/70",
1218
+ tableHeadLabel: "font-semibold",
1219
+ menuItemLabel: "font-medium"
1220
+ },
1221
+ monkey: {
1222
+ buttonBase: "text-xs",
1223
+ badgeBase: "text-[11px]",
1224
+ fieldLabel: "text-xs",
1225
+ controlBase: "text-xs",
1226
+ selectOption: "text-xs",
1227
+ menuItem: "text-xs",
1228
+ menuSubTrigger: "text-xs",
1229
+ noticeBase: "text-xs",
1230
+ sectionHeaderTitle: "text-sm",
1231
+ tabsTrigger: "text-xs",
1232
+ segmentedItem: "text-xs",
1233
+ toolbarTitle: "text-xs",
1234
+ paginationRoot: "text-xs"
1235
+ },
1236
+ bsd: {
1237
+ buttonPrimary: "border-sky-300/25 bg-sky-300/15 text-sky-50 hover:bg-sky-300/20",
1238
+ badgePrimary: "border-sky-300/25 bg-sky-300/15 text-sky-50",
1239
+ noticePrimary: "border-sky-300/25 bg-sky-300/15 text-sky-50",
1240
+ progressIndicator: "bg-sky-300",
1241
+ avatarStatus: "border-slate-950"
1242
+ },
1243
+ glass: {
1244
+ panelRoot: "shadow-[0_24px_80px_rgba(15,23,42,0.12)]",
1245
+ stateRoot: "shadow-[0_24px_80px_rgba(15,23,42,0.12)]",
1246
+ noticeBase: "shadow-[0_18px_60px_rgba(15,23,42,0.10)]",
1247
+ tabsPanel: "shadow-[0_18px_60px_rgba(15,23,42,0.10)]",
1248
+ toolbarRoot: "shadow-[0_18px_60px_rgba(15,23,42,0.10)]",
1249
+ descriptionListItem: "shadow-[0_12px_40px_rgba(15,23,42,0.08)]",
1250
+ accordionItem: "shadow-[0_12px_40px_rgba(15,23,42,0.08)]"
1251
+ },
1252
+ "hard-edge": {
1253
+ buttonBase: "shadow-none",
1254
+ panelRoot: "shadow-none",
1255
+ stateRoot: "shadow-none",
1256
+ controlWrapper: "shadow-none",
1257
+ selectMenu: "shadow-none",
1258
+ menuContent: "shadow-none",
1259
+ menuSubContent: "shadow-none",
1260
+ noticeBase: "shadow-none",
1261
+ tabsList: "shadow-none",
1262
+ tabsTriggerActive: "shadow-none",
1263
+ tabsPanel: "shadow-none",
1264
+ segmentedRoot: "shadow-none",
1265
+ segmentedItemActive: "shadow-none",
1266
+ toolbarRoot: "shadow-none",
1267
+ descriptionListItem: "shadow-none",
1268
+ accordionItem: "shadow-none"
1269
+ }
1270
+ };
1271
+ function getPresetDefaults(preset) {
1272
+ return presetDefaults[preset] ?? presetDefaults.default;
1273
+ }
1274
+ var slotKeys = Object.keys(baseSlots);
1275
+ function mergeSlots(...sources) {
1276
+ return slotKeys.reduce((resolved, key) => {
1277
+ resolved[key] = cn(...sources.map((source) => source?.[key]));
1278
+ return resolved;
1279
+ }, {});
1280
+ }
1281
+ function mergeStyles(...styleSets) {
1282
+ return Object.assign({}, ...styleSets.filter(Boolean));
1283
+ }
1284
+ function resolveBaseAppearance(appearance) {
1285
+ const preset = appearance?.preset ?? "default";
1286
+ const defaults = getPresetDefaults(preset);
1287
+ const density = appearance?.density ?? defaults.density ?? "default";
1288
+ const radius = appearance?.radius ?? defaults.radius ?? "md";
1289
+ const border = appearance?.border ?? defaults.border ?? "solid";
1290
+ const background = appearance?.background ?? defaults.background ?? "plain";
1291
+ return {
1292
+ preset,
1293
+ density,
1294
+ radius,
1295
+ border,
1296
+ background,
1297
+ styles: mergeStyles(emptyStyles, appearance?.styles),
1298
+ slots: mergeSlots(
1299
+ baseSlots,
1300
+ presetSlots[preset],
1301
+ densitySlots[density],
1302
+ radiusSlots[radius],
1303
+ borderSlots[border],
1304
+ backgroundSlots[background],
1305
+ appearance?.slots
1306
+ )
1307
+ };
1308
+ }
1309
+ function getBaseButtonToneClassName(theme, tone = "default", active = false) {
1310
+ return cn(
1311
+ tone === "default" && theme.slots.buttonDefault,
1312
+ tone === "primary" && theme.slots.buttonPrimary,
1313
+ tone === "success" && theme.slots.buttonSuccess,
1314
+ tone === "warning" && theme.slots.buttonWarning,
1315
+ tone === "danger" && theme.slots.buttonDanger,
1316
+ tone === "muted" && theme.slots.buttonMuted,
1317
+ active && theme.slots.buttonActive
1318
+ );
1319
+ }
1320
+ var sizeClassNames = {
1321
+ sm: "h-7 w-7 text-xs",
1322
+ md: "h-9 w-9 text-sm",
1323
+ lg: "h-12 w-12 text-base"
1324
+ };
1325
+ var statusClassNames = {
1326
+ online: "bg-emerald-500",
1327
+ busy: "bg-amber-500",
1328
+ offline: "bg-muted-foreground",
1329
+ neutral: "bg-muted-foreground"
1330
+ };
1331
+ function isStatusPreset(status) {
1332
+ return typeof status === "string" && status in statusClassNames;
1333
+ }
1334
+ function getInitials(name) {
1335
+ if (!name) return void 0;
1336
+ const words = name.trim().split(/\s+/).filter(Boolean);
1337
+ if (!words.length) return void 0;
1338
+ return words.slice(0, 2).map((word) => word[0]?.toUpperCase()).join("");
1339
+ }
1340
+ function BaseAvatar({
1341
+ src,
1342
+ alt,
1343
+ name,
1344
+ initials,
1345
+ icon,
1346
+ status,
1347
+ size = "md",
1348
+ appearance,
1349
+ className,
1350
+ classNames,
1351
+ style,
1352
+ children,
1353
+ ...avatarProps
1354
+ }) {
1355
+ const theme = resolveBaseAppearance(appearance);
1356
+ const fallback = children ?? initials ?? getInitials(name) ?? icon;
1357
+ return /* @__PURE__ */ jsxs(
1358
+ "div",
1359
+ {
1360
+ ...avatarProps,
1361
+ className: cn(
1362
+ theme.slots.avatarRoot,
1363
+ sizeClassNames[size],
1364
+ classNames?.root,
1365
+ className
1366
+ ),
1367
+ style: {
1368
+ ...theme.styles.avatar,
1369
+ ...style
1370
+ },
1371
+ title: name,
1372
+ children: [
1373
+ src ? /* @__PURE__ */ jsx(
1374
+ "img",
1375
+ {
1376
+ src,
1377
+ alt: alt ?? name ?? "",
1378
+ className: cn(theme.slots.avatarImage, classNames?.image)
1379
+ }
1380
+ ) : /* @__PURE__ */ jsx("span", { className: cn(theme.slots.avatarFallback, classNames?.fallback), children: hasRenderableNode(fallback) ? fallback : "?" }),
1381
+ isStatusPreset(status) ? /* @__PURE__ */ jsx(
1382
+ "span",
1383
+ {
1384
+ "aria-hidden": "true",
1385
+ className: cn(
1386
+ theme.slots.avatarStatus,
1387
+ statusClassNames[status],
1388
+ classNames?.status
1389
+ )
1390
+ }
1391
+ ) : hasRenderableNode(status) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.avatarStatus, classNames?.status), children: status }) : null
1392
+ ]
1393
+ }
1394
+ );
1395
+ }
1396
+ function LoadingIcon() {
1397
+ return /* @__PURE__ */ jsxs(
1398
+ "svg",
1399
+ {
1400
+ "aria-hidden": "true",
1401
+ viewBox: "0 0 24 24",
1402
+ className: "h-4 w-4 animate-spin",
1403
+ fill: "none",
1404
+ children: [
1405
+ /* @__PURE__ */ jsx(
1406
+ "circle",
1407
+ {
1408
+ cx: "12",
1409
+ cy: "12",
1410
+ r: "9",
1411
+ className: "opacity-25",
1412
+ stroke: "currentColor",
1413
+ strokeWidth: "3"
1414
+ }
1415
+ ),
1416
+ /* @__PURE__ */ jsx(
1417
+ "path",
1418
+ {
1419
+ className: "opacity-75",
1420
+ fill: "currentColor",
1421
+ d: "M12 3a9 9 0 0 1 9 9h-3a6 6 0 0 0-6-6V3Z"
1422
+ }
1423
+ )
1424
+ ]
1425
+ }
1426
+ );
1427
+ }
1428
+ var BaseButton = forwardRef(
1429
+ function BaseButton2({
1430
+ children,
1431
+ label,
1432
+ icon,
1433
+ endIcon,
1434
+ type = "button",
1435
+ title,
1436
+ ariaLabel,
1437
+ tone,
1438
+ active = false,
1439
+ iconOnly = false,
1440
+ disabled = false,
1441
+ loading = false,
1442
+ stopPropagation = false,
1443
+ appearance,
1444
+ className,
1445
+ classNames,
1446
+ style,
1447
+ onClick,
1448
+ "aria-label": nativeAriaLabel,
1449
+ ...buttonProps
1450
+ }, ref) {
1451
+ const theme = resolveBaseAppearance(appearance);
1452
+ const resolvedLabel = children ?? label;
1453
+ const labelText = typeof resolvedLabel === "string" ? resolvedLabel : void 0;
1454
+ const resolvedAriaLabel = ariaLabel ?? nativeAriaLabel ?? labelText ?? title ?? (iconOnly ? "Action" : void 0);
1455
+ const resolvedDisabled = disabled || loading;
1456
+ const handleClick = (event) => {
1457
+ if (stopPropagation) {
1458
+ event.stopPropagation();
1459
+ }
1460
+ if (resolvedDisabled) return;
1461
+ onClick?.(event);
1462
+ };
1463
+ return /* @__PURE__ */ jsxs(
1464
+ "button",
1465
+ {
1466
+ ...buttonProps,
1467
+ ref,
1468
+ type,
1469
+ title,
1470
+ "aria-label": resolvedAriaLabel,
1471
+ "aria-pressed": active || void 0,
1472
+ "aria-busy": loading || void 0,
1473
+ disabled: resolvedDisabled,
1474
+ className: cn(
1475
+ theme.slots.buttonBase,
1476
+ iconOnly && theme.slots.buttonIconOnly,
1477
+ getBaseButtonToneClassName(theme, tone, active),
1478
+ resolvedDisabled && theme.slots.buttonDisabled,
1479
+ classNames?.root,
1480
+ className
1481
+ ),
1482
+ style: {
1483
+ ...theme.styles.button,
1484
+ ...active ? theme.styles.buttonActive : void 0,
1485
+ ...resolvedDisabled ? theme.styles.buttonDisabled : void 0,
1486
+ ...style
1487
+ },
1488
+ onClick: handleClick,
1489
+ children: [
1490
+ loading ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.buttonIcon, classNames?.icon), children: /* @__PURE__ */ jsx(LoadingIcon, {}) }) : icon ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.buttonIcon, classNames?.icon), children: icon }) : null,
1491
+ iconOnly ? hasRenderableNode(resolvedLabel) ? /* @__PURE__ */ jsx("span", { className: "sr-only", children: resolvedLabel }) : null : hasRenderableNode(resolvedLabel) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.buttonLabel, classNames?.label), children: resolvedLabel }) : null,
1492
+ !loading && endIcon ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.buttonIcon, classNames?.icon), children: endIcon }) : null
1493
+ ]
1494
+ }
1495
+ );
1496
+ }
1497
+ );
1498
+ function setRefs(element, ...refs) {
1499
+ refs.forEach((ref) => {
1500
+ if (!ref) return;
1501
+ if (typeof ref === "function") {
1502
+ ref(element);
1503
+ return;
1504
+ }
1505
+ ref.current = element;
1506
+ });
1507
+ }
1508
+ forwardRef(
1509
+ function BaseCheckbox2({
1510
+ label,
1511
+ description,
1512
+ indeterminate = false,
1513
+ invalid = false,
1514
+ disabled = false,
1515
+ appearance,
1516
+ className,
1517
+ classNames,
1518
+ style,
1519
+ checked,
1520
+ defaultChecked,
1521
+ onChange,
1522
+ "aria-invalid": nativeAriaInvalid,
1523
+ ...checkboxProps
1524
+ }, forwardedRef) {
1525
+ const theme = resolveBaseAppearance(appearance);
1526
+ const inputRef = useRef(null);
1527
+ const [uncontrolledChecked, setUncontrolledChecked] = useState(
1528
+ defaultChecked ?? false
1529
+ );
1530
+ const isControlled = checked !== void 0;
1531
+ const resolvedChecked = Boolean(isControlled ? checked : uncontrolledChecked);
1532
+ const active = indeterminate || resolvedChecked;
1533
+ useEffect(() => {
1534
+ if (inputRef.current) {
1535
+ inputRef.current.indeterminate = indeterminate;
1536
+ }
1537
+ }, [indeterminate]);
1538
+ const handleChange = (event) => {
1539
+ if (disabled) return;
1540
+ if (!isControlled) {
1541
+ setUncontrolledChecked(event.currentTarget.checked);
1542
+ }
1543
+ onChange?.(event);
1544
+ };
1545
+ return /* @__PURE__ */ jsxs(
1546
+ "label",
1547
+ {
1548
+ className: cn(
1549
+ theme.slots.checkboxRoot,
1550
+ disabled && theme.slots.checkboxDisabled,
1551
+ classNames?.root,
1552
+ className
1553
+ ),
1554
+ style: {
1555
+ ...theme.styles.checkboxRoot,
1556
+ ...style
1557
+ },
1558
+ children: [
1559
+ /* @__PURE__ */ jsxs(
1560
+ "span",
1561
+ {
1562
+ className: cn(
1563
+ theme.slots.checkboxBox,
1564
+ active && theme.slots.checkboxBoxChecked,
1565
+ invalid && theme.slots.checkboxBoxInvalid,
1566
+ classNames?.box
1567
+ ),
1568
+ style: {
1569
+ ...theme.styles.checkboxBox
1570
+ },
1571
+ children: [
1572
+ /* @__PURE__ */ jsx(
1573
+ "input",
1574
+ {
1575
+ ...checkboxProps,
1576
+ ref: (element) => setRefs(element, inputRef, forwardedRef),
1577
+ type: "checkbox",
1578
+ disabled,
1579
+ checked,
1580
+ defaultChecked,
1581
+ "aria-invalid": nativeAriaInvalid ?? (invalid || void 0),
1582
+ "aria-checked": indeterminate ? "mixed" : resolvedChecked,
1583
+ className: cn(theme.slots.checkboxInput, classNames?.input),
1584
+ onChange: handleChange
1585
+ }
1586
+ ),
1587
+ active ? /* @__PURE__ */ jsx(
1588
+ "span",
1589
+ {
1590
+ "aria-hidden": "true",
1591
+ className: cn(theme.slots.checkboxIndicator, classNames?.indicator),
1592
+ children: indeterminate ? "\u2013" : "\u2713"
1593
+ }
1594
+ ) : null
1595
+ ]
1596
+ }
1597
+ ),
1598
+ hasRenderableNode(label) || hasRenderableNode(description) ? /* @__PURE__ */ jsxs("span", { className: cn(theme.slots.checkboxContent, classNames?.content), children: [
1599
+ hasRenderableNode(label) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.checkboxLabel, classNames?.label), children: label }) : null,
1600
+ hasRenderableNode(description) ? /* @__PURE__ */ jsx(
1601
+ "span",
1602
+ {
1603
+ className: cn(
1604
+ theme.slots.checkboxDescription,
1605
+ classNames?.description
1606
+ ),
1607
+ children: description
1608
+ }
1609
+ ) : null
1610
+ ] }) : null
1611
+ ]
1612
+ }
1613
+ );
1614
+ }
1615
+ );
1616
+ forwardRef(
1617
+ function BaseInput2({
1618
+ icon,
1619
+ trailing,
1620
+ invalid = false,
1621
+ disabled = false,
1622
+ readOnly = false,
1623
+ appearance,
1624
+ className,
1625
+ classNames,
1626
+ style,
1627
+ "aria-invalid": nativeAriaInvalid,
1628
+ ...inputProps
1629
+ }, ref) {
1630
+ const theme = resolveBaseAppearance(appearance);
1631
+ return /* @__PURE__ */ jsxs(
1632
+ "div",
1633
+ {
1634
+ className: cn(
1635
+ theme.slots.controlWrapper,
1636
+ invalid && theme.slots.controlInvalid,
1637
+ disabled && theme.slots.controlDisabled,
1638
+ readOnly && theme.slots.controlReadOnly,
1639
+ classNames?.root,
1640
+ className
1641
+ ),
1642
+ style: {
1643
+ ...theme.styles.control,
1644
+ ...invalid ? theme.styles.controlInvalid : void 0,
1645
+ ...disabled ? theme.styles.controlDisabled : void 0,
1646
+ ...style
1647
+ },
1648
+ children: [
1649
+ hasRenderableNode(icon) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.controlIcon, classNames?.icon), children: icon }) : null,
1650
+ /* @__PURE__ */ jsx(
1651
+ "input",
1652
+ {
1653
+ ...inputProps,
1654
+ ref,
1655
+ disabled,
1656
+ readOnly,
1657
+ "aria-invalid": nativeAriaInvalid ?? (invalid || void 0),
1658
+ className: cn(
1659
+ theme.slots.controlBase,
1660
+ theme.slots.controlInput,
1661
+ classNames?.control
1662
+ )
1663
+ }
1664
+ ),
1665
+ hasRenderableNode(trailing) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.controlTrailing, classNames?.trailing), children: trailing }) : null
1666
+ ]
1667
+ }
1668
+ );
1669
+ }
1670
+ );
1671
+ function normalizeValues(values) {
1672
+ const nextValues = [];
1673
+ const seen = /* @__PURE__ */ new Set();
1674
+ values?.forEach((value) => {
1675
+ if (seen.has(value)) return;
1676
+ seen.add(value);
1677
+ nextValues.push(value);
1678
+ });
1679
+ return nextValues;
1680
+ }
1681
+ function getNextEnabledIndex(options, currentIndex, direction) {
1682
+ if (!options.length) return -1;
1683
+ const startIndex = currentIndex >= 0 ? currentIndex : 0;
1684
+ for (let offset = 1; offset <= options.length; offset += 1) {
1685
+ const nextIndex = (startIndex + offset * direction + options.length) % options.length;
1686
+ if (!options[nextIndex]?.disabled) {
1687
+ return nextIndex;
1688
+ }
1689
+ }
1690
+ return -1;
1691
+ }
1692
+ function getFirstEnabledIndex(options) {
1693
+ return options.findIndex((option) => !option.disabled);
1694
+ }
1695
+ function getSafeTagCount(maxTagCount, total) {
1696
+ if (maxTagCount === void 0) return total;
1697
+ if (!Number.isFinite(maxTagCount)) return total;
1698
+ return Math.max(0, Math.min(total, Math.floor(maxTagCount)));
1699
+ }
1700
+ function getDefaultRemoveLabel(option) {
1701
+ return `Remove ${option.value}`;
1702
+ }
1703
+ forwardRef(
1704
+ function BaseMultiSelect2({
1705
+ options,
1706
+ value,
1707
+ defaultValue,
1708
+ name,
1709
+ placeholder = "Select options",
1710
+ icon,
1711
+ invalid = false,
1712
+ disabled = false,
1713
+ required = false,
1714
+ openForPreview = false,
1715
+ maxTagCount,
1716
+ removeLabel = getDefaultRemoveLabel,
1717
+ emptyLabel = "No options",
1718
+ appearance,
1719
+ className,
1720
+ classNames,
1721
+ style,
1722
+ id,
1723
+ "aria-invalid": nativeAriaInvalid,
1724
+ "aria-label": nativeAriaLabel,
1725
+ "aria-labelledby": nativeAriaLabelledBy,
1726
+ onValueChange,
1727
+ ...rootProps
1728
+ }, ref) {
1729
+ const theme = resolveBaseAppearance(appearance);
1730
+ const generatedId = useId();
1731
+ const multiSelectId = id ?? generatedId;
1732
+ const controlId = `${multiSelectId}-control`;
1733
+ const listboxId = `${multiSelectId}-listbox`;
1734
+ const rootRef = useRef(null);
1735
+ const optionList = options ?? [];
1736
+ const forceOpen = openForPreview;
1737
+ const [uncontrolledOpen, setUncontrolledOpen] = useState(false);
1738
+ const open = forceOpen || uncontrolledOpen;
1739
+ const [uncontrolledValue, setUncontrolledValue] = useState(
1740
+ () => normalizeValues(defaultValue)
1741
+ );
1742
+ const [activeIndex, setActiveIndex] = useState(
1743
+ () => getFirstEnabledIndex(optionList)
1744
+ );
1745
+ const isControlled = value !== void 0;
1746
+ const selectedValues = useMemo(
1747
+ () => normalizeValues(isControlled ? value : uncontrolledValue),
1748
+ [isControlled, uncontrolledValue, value]
1749
+ );
1750
+ const selectedValueSet = useMemo(
1751
+ () => new Set(selectedValues),
1752
+ [selectedValues]
1753
+ );
1754
+ const optionByValue = useMemo(() => {
1755
+ const map = /* @__PURE__ */ new Map();
1756
+ optionList.forEach((option) => {
1757
+ if (!map.has(option.value)) {
1758
+ map.set(option.value, option);
1759
+ }
1760
+ });
1761
+ return map;
1762
+ }, [optionList]);
1763
+ const selectedOptions = useMemo(
1764
+ () => selectedValues.map((selectedValue) => optionByValue.get(selectedValue)).filter(
1765
+ (option) => option !== void 0
1766
+ ),
1767
+ [optionByValue, selectedValues]
1768
+ );
1769
+ const firstEnabledIndex = useMemo(
1770
+ () => getFirstEnabledIndex(optionList),
1771
+ [optionList]
1772
+ );
1773
+ const resolvedActiveIndex = activeIndex >= 0 && !optionList[activeIndex]?.disabled ? activeIndex : firstEnabledIndex;
1774
+ const visibleTagCount = getSafeTagCount(
1775
+ maxTagCount,
1776
+ selectedOptions.length
1777
+ );
1778
+ const visibleOptions = selectedOptions.slice(0, visibleTagCount);
1779
+ const overflowCount = selectedOptions.length - visibleOptions.length;
1780
+ const isPlaceholder = selectedOptions.length === 0;
1781
+ const setRootRef = (node) => {
1782
+ rootRef.current = node;
1783
+ if (typeof ref === "function") {
1784
+ ref(node);
1785
+ } else if (ref) {
1786
+ ref.current = node;
1787
+ }
1788
+ };
1789
+ const setOpen = (nextOpen) => {
1790
+ if (disabled || forceOpen) return;
1791
+ setUncontrolledOpen(nextOpen);
1792
+ if (nextOpen) {
1793
+ setActiveIndex(resolvedActiveIndex);
1794
+ }
1795
+ };
1796
+ useEffect(() => {
1797
+ if (!open || forceOpen) return void 0;
1798
+ const handlePointerDown = (event) => {
1799
+ if (!rootRef.current?.contains(event.target)) {
1800
+ setUncontrolledOpen(false);
1801
+ }
1802
+ };
1803
+ document.addEventListener("pointerdown", handlePointerDown);
1804
+ return () => {
1805
+ document.removeEventListener("pointerdown", handlePointerDown);
1806
+ };
1807
+ }, [forceOpen, open]);
1808
+ useEffect(() => {
1809
+ if (resolvedActiveIndex >= 0 && resolvedActiveIndex !== activeIndex) {
1810
+ setActiveIndex(resolvedActiveIndex);
1811
+ }
1812
+ }, [activeIndex, resolvedActiveIndex]);
1813
+ const commitValues = (nextValues) => {
1814
+ const normalizedValues = normalizeValues(nextValues);
1815
+ if (!isControlled) {
1816
+ setUncontrolledValue(normalizedValues);
1817
+ }
1818
+ onValueChange?.(normalizedValues);
1819
+ };
1820
+ const toggleOption = (option) => {
1821
+ if (!option || option.disabled || disabled) return;
1822
+ const nextValues = selectedValueSet.has(option.value) ? selectedValues.filter((selectedValue) => selectedValue !== option.value) : [...selectedValues, option.value];
1823
+ commitValues(nextValues);
1824
+ };
1825
+ const removeOption = (option) => {
1826
+ if (disabled) return;
1827
+ commitValues(
1828
+ selectedValues.filter((selectedValue) => selectedValue !== option.value)
1829
+ );
1830
+ };
1831
+ const focusOption = (direction) => {
1832
+ const nextIndex = getNextEnabledIndex(
1833
+ optionList,
1834
+ resolvedActiveIndex,
1835
+ direction
1836
+ );
1837
+ if (nextIndex >= 0) {
1838
+ setActiveIndex(nextIndex);
1839
+ }
1840
+ };
1841
+ const handleKeyDown = (event) => {
1842
+ if (disabled) return;
1843
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
1844
+ event.preventDefault();
1845
+ if (!open) {
1846
+ setOpen(true);
1847
+ setActiveIndex(firstEnabledIndex);
1848
+ return;
1849
+ }
1850
+ focusOption(event.key === "ArrowDown" ? 1 : -1);
1851
+ return;
1852
+ }
1853
+ if (event.key === "Home") {
1854
+ event.preventDefault();
1855
+ setOpen(true);
1856
+ setActiveIndex(firstEnabledIndex);
1857
+ return;
1858
+ }
1859
+ if (event.key === "End") {
1860
+ event.preventDefault();
1861
+ setOpen(true);
1862
+ for (let index = optionList.length - 1; index >= 0; index -= 1) {
1863
+ if (!optionList[index]?.disabled) {
1864
+ setActiveIndex(index);
1865
+ break;
1866
+ }
1867
+ }
1868
+ return;
1869
+ }
1870
+ if (event.key === "Enter" || event.key === " ") {
1871
+ event.preventDefault();
1872
+ if (!open) {
1873
+ setOpen(true);
1874
+ return;
1875
+ }
1876
+ toggleOption(optionList[resolvedActiveIndex]);
1877
+ return;
1878
+ }
1879
+ if (event.key === "Escape") {
1880
+ setOpen(false);
1881
+ }
1882
+ };
1883
+ return /* @__PURE__ */ jsxs(
1884
+ "div",
1885
+ {
1886
+ ...rootProps,
1887
+ id,
1888
+ ref: setRootRef,
1889
+ className: cn(
1890
+ theme.slots.controlWrapper,
1891
+ "overflow-visible",
1892
+ open && "z-50",
1893
+ invalid && theme.slots.controlInvalid,
1894
+ disabled && theme.slots.controlDisabled,
1895
+ classNames?.root,
1896
+ className
1897
+ ),
1898
+ style: {
1899
+ ...theme.styles.control,
1900
+ ...invalid ? theme.styles.controlInvalid : void 0,
1901
+ ...disabled ? theme.styles.controlDisabled : void 0,
1902
+ ...style
1903
+ },
1904
+ children: [
1905
+ hasRenderableNode(icon) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.controlIcon, classNames?.icon), children: icon }) : null,
1906
+ /* @__PURE__ */ jsx(
1907
+ "div",
1908
+ {
1909
+ id: controlId,
1910
+ role: "combobox",
1911
+ tabIndex: disabled ? -1 : 0,
1912
+ "aria-haspopup": "listbox",
1913
+ "aria-expanded": open,
1914
+ "aria-controls": listboxId,
1915
+ "aria-disabled": disabled || void 0,
1916
+ "aria-required": required || void 0,
1917
+ "aria-invalid": nativeAriaInvalid ?? (invalid || void 0),
1918
+ "aria-label": nativeAriaLabel,
1919
+ "aria-labelledby": nativeAriaLabelledBy,
1920
+ className: cn(
1921
+ theme.slots.controlBase,
1922
+ "flex min-h-9 cursor-pointer flex-wrap items-center gap-1.5 py-1.5 pr-9 text-left",
1923
+ disabled && "!cursor-not-allowed",
1924
+ classNames?.control
1925
+ ),
1926
+ onClick: () => setOpen(!open),
1927
+ onKeyDown: handleKeyDown,
1928
+ children: /* @__PURE__ */ jsxs(
1929
+ "span",
1930
+ {
1931
+ className: cn(
1932
+ "flex min-w-0 flex-1 flex-wrap items-center gap-1.5",
1933
+ classNames?.tagList
1934
+ ),
1935
+ children: [
1936
+ visibleOptions.map((option) => /* @__PURE__ */ jsxs(
1937
+ "span",
1938
+ {
1939
+ className: cn(
1940
+ "inline-flex max-w-full items-center gap-1 rounded-full border border-border/70 bg-muted/65 px-2 py-0.5 text-xs font-medium text-foreground",
1941
+ classNames?.tag
1942
+ ),
1943
+ children: [
1944
+ /* @__PURE__ */ jsx(
1945
+ "span",
1946
+ {
1947
+ className: cn(
1948
+ "max-w-40 truncate",
1949
+ classNames?.tagLabel
1950
+ ),
1951
+ children: option.label
1952
+ }
1953
+ ),
1954
+ /* @__PURE__ */ jsx(
1955
+ "button",
1956
+ {
1957
+ type: "button",
1958
+ "aria-label": removeLabel(option),
1959
+ disabled,
1960
+ className: cn(
1961
+ "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:bg-background/80 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 disabled:!cursor-not-allowed",
1962
+ classNames?.tagRemove
1963
+ ),
1964
+ onClick: (event) => {
1965
+ event.preventDefault();
1966
+ event.stopPropagation();
1967
+ removeOption(option);
1968
+ },
1969
+ onMouseDown: (event) => {
1970
+ event.preventDefault();
1971
+ event.stopPropagation();
1972
+ },
1973
+ onKeyDown: (event) => event.stopPropagation(),
1974
+ children: /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: "x" })
1975
+ }
1976
+ )
1977
+ ]
1978
+ },
1979
+ option.value
1980
+ )),
1981
+ overflowCount > 0 ? /* @__PURE__ */ jsxs(
1982
+ "span",
1983
+ {
1984
+ className: cn(
1985
+ "inline-flex max-w-full items-center rounded-full border border-border/70 bg-muted/45 px-2 py-0.5 text-xs font-medium text-muted-foreground",
1986
+ classNames?.tag
1987
+ ),
1988
+ children: [
1989
+ "+",
1990
+ overflowCount
1991
+ ]
1992
+ }
1993
+ ) : null,
1994
+ isPlaceholder ? /* @__PURE__ */ jsx(
1995
+ "span",
1996
+ {
1997
+ className: cn(
1998
+ "min-w-0 truncate",
1999
+ theme.slots.selectPlaceholder,
2000
+ classNames?.placeholder
2001
+ ),
2002
+ children: placeholder
2003
+ }
2004
+ ) : null
2005
+ ]
2006
+ }
2007
+ )
2008
+ }
2009
+ ),
2010
+ /* @__PURE__ */ jsx(
2011
+ "span",
2012
+ {
2013
+ className: cn(
2014
+ theme.slots.selectChevron,
2015
+ open && "rotate-[225deg]",
2016
+ classNames?.chevron
2017
+ )
2018
+ }
2019
+ ),
2020
+ name ? selectedValues.map((selectedValue) => /* @__PURE__ */ jsx(
2021
+ "input",
2022
+ {
2023
+ type: "hidden",
2024
+ name,
2025
+ value: selectedValue,
2026
+ className: classNames?.hiddenInput
2027
+ },
2028
+ selectedValue
2029
+ )) : null,
2030
+ open ? /* @__PURE__ */ jsx(
2031
+ "div",
2032
+ {
2033
+ id: listboxId,
2034
+ role: "listbox",
2035
+ "aria-multiselectable": "true",
2036
+ "aria-labelledby": controlId,
2037
+ className: cn(theme.slots.selectMenu, classNames?.menu),
2038
+ style: theme.styles.selectMenu,
2039
+ children: optionList.length > 0 ? optionList.map((option, index) => {
2040
+ const selected = selectedValueSet.has(option.value);
2041
+ const active = index === resolvedActiveIndex;
2042
+ return /* @__PURE__ */ jsxs(
2043
+ "button",
2044
+ {
2045
+ type: "button",
2046
+ role: "option",
2047
+ "aria-selected": selected,
2048
+ disabled: option.disabled,
2049
+ className: cn(
2050
+ theme.slots.selectOption,
2051
+ "gap-2",
2052
+ active && theme.slots.selectOptionActive,
2053
+ selected && theme.slots.selectOptionSelected,
2054
+ option.disabled && theme.slots.selectOptionDisabled,
2055
+ classNames?.option
2056
+ ),
2057
+ style: {
2058
+ ...theme.styles.selectOption,
2059
+ ...active ? theme.styles.selectOptionActive : void 0,
2060
+ ...selected ? theme.styles.selectOptionSelected : void 0
2061
+ },
2062
+ onMouseEnter: () => {
2063
+ if (!option.disabled) {
2064
+ setActiveIndex(index);
2065
+ }
2066
+ },
2067
+ onMouseDown: (event) => event.preventDefault(),
2068
+ onClick: () => toggleOption(option),
2069
+ children: [
2070
+ /* @__PURE__ */ jsx(
2071
+ "span",
2072
+ {
2073
+ "aria-hidden": "true",
2074
+ className: cn(
2075
+ "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border border-border/70 text-[10px]",
2076
+ selected && "border-primary/40 bg-primary text-primary-foreground",
2077
+ classNames?.optionIndicator
2078
+ ),
2079
+ children: selected ? "\u2713" : null
2080
+ }
2081
+ ),
2082
+ /* @__PURE__ */ jsx(
2083
+ "span",
2084
+ {
2085
+ className: cn(
2086
+ "min-w-0 flex-1 truncate",
2087
+ classNames?.optionLabel
2088
+ ),
2089
+ children: option.label
2090
+ }
2091
+ )
2092
+ ]
2093
+ },
2094
+ option.value
2095
+ );
2096
+ }) : /* @__PURE__ */ jsx(
2097
+ "div",
2098
+ {
2099
+ className: cn(
2100
+ "px-2.5 py-2 text-sm text-muted-foreground",
2101
+ classNames?.empty
2102
+ ),
2103
+ children: emptyLabel
2104
+ }
2105
+ )
2106
+ }
2107
+ ) : null
2108
+ ]
2109
+ }
2110
+ );
2111
+ }
2112
+ );
2113
+ function findOption(options, value) {
2114
+ if (value === void 0) return void 0;
2115
+ return options.find((option) => option.value === value);
2116
+ }
2117
+ function getInitialValue(options, defaultValue) {
2118
+ if (typeof defaultValue === "string") {
2119
+ return defaultValue;
2120
+ }
2121
+ return "";
2122
+ }
2123
+ function getNextEnabledIndex2(options, currentIndex, direction) {
2124
+ if (!options.length) return -1;
2125
+ for (let offset = 1; offset <= options.length; offset += 1) {
2126
+ const nextIndex = (currentIndex + offset * direction + options.length) % options.length;
2127
+ if (!options[nextIndex]?.disabled) {
2128
+ return nextIndex;
2129
+ }
2130
+ }
2131
+ return -1;
2132
+ }
2133
+ forwardRef(
2134
+ function BaseSelect2({
2135
+ options,
2136
+ placeholder,
2137
+ icon,
2138
+ invalid = false,
2139
+ disabled = false,
2140
+ openForPreview = false,
2141
+ appearance,
2142
+ className,
2143
+ classNames,
2144
+ style,
2145
+ children,
2146
+ value,
2147
+ defaultValue,
2148
+ onChange,
2149
+ name,
2150
+ id,
2151
+ required,
2152
+ "aria-invalid": nativeAriaInvalid,
2153
+ "aria-label": nativeAriaLabel,
2154
+ "aria-labelledby": nativeAriaLabelledBy,
2155
+ ...selectProps
2156
+ }, ref) {
2157
+ const theme = resolveBaseAppearance(appearance);
2158
+ const generatedId = useId();
2159
+ const selectId = id ?? generatedId;
2160
+ const listboxId = `${selectId}-listbox`;
2161
+ const rootRef = useRef(null);
2162
+ const selectRef = useRef(null);
2163
+ const optionList = options ?? [];
2164
+ const isCustomSelect = optionList.length > 0;
2165
+ const forceOpen = openForPreview;
2166
+ const [uncontrolledOpen, setUncontrolledOpen] = useState(false);
2167
+ const open = forceOpen || uncontrolledOpen;
2168
+ const [uncontrolledValue, setUncontrolledValue] = useState(
2169
+ () => getInitialValue(optionList, defaultValue)
2170
+ );
2171
+ const isControlled = value !== void 0;
2172
+ const selectedValue = String(isControlled ? value : uncontrolledValue);
2173
+ const selectedOption = findOption(optionList, selectedValue);
2174
+ const activeIndex = useMemo(() => {
2175
+ const selectedIndex = optionList.findIndex(
2176
+ (option) => option.value === selectedValue && !option.disabled
2177
+ );
2178
+ if (selectedIndex >= 0) return selectedIndex;
2179
+ return optionList.findIndex((option) => !option.disabled);
2180
+ }, [optionList, selectedValue]);
2181
+ const visibleLabel = selectedOption?.label ?? placeholder;
2182
+ const isPlaceholder = !selectedOption;
2183
+ const setSelectRef = (node) => {
2184
+ selectRef.current = node;
2185
+ if (typeof ref === "function") {
2186
+ ref(node);
2187
+ } else if (ref) {
2188
+ ref.current = node;
2189
+ }
2190
+ };
2191
+ useEffect(() => {
2192
+ if (!open || forceOpen) return void 0;
2193
+ const handlePointerDown = (event) => {
2194
+ if (!rootRef.current?.contains(event.target)) {
2195
+ setUncontrolledOpen(false);
2196
+ }
2197
+ };
2198
+ document.addEventListener("pointerdown", handlePointerDown);
2199
+ return () => {
2200
+ document.removeEventListener("pointerdown", handlePointerDown);
2201
+ };
2202
+ }, [forceOpen, open]);
2203
+ const notifyChange = (nextValue) => {
2204
+ const selectElement = selectRef.current;
2205
+ if (!selectElement) return;
2206
+ const valueSetter = Object.getOwnPropertyDescriptor(
2207
+ HTMLSelectElement.prototype,
2208
+ "value"
2209
+ )?.set;
2210
+ valueSetter?.call(selectElement, nextValue);
2211
+ selectElement.dispatchEvent(new Event("change", { bubbles: true }));
2212
+ };
2213
+ const commitValue = (nextValue, optionDisabled) => {
2214
+ if (optionDisabled || disabled) return;
2215
+ if (!isControlled) {
2216
+ setUncontrolledValue(nextValue);
2217
+ }
2218
+ notifyChange(nextValue);
2219
+ if (!forceOpen) {
2220
+ setUncontrolledOpen(false);
2221
+ }
2222
+ };
2223
+ const focusOption = (direction) => {
2224
+ const currentIndex = activeIndex >= 0 ? activeIndex : 0;
2225
+ const nextIndex = getNextEnabledIndex2(optionList, currentIndex, direction);
2226
+ if (nextIndex >= 0) {
2227
+ commitValue(optionList[nextIndex].value, optionList[nextIndex].disabled);
2228
+ }
2229
+ };
2230
+ const handleKeyDown = (event) => {
2231
+ if (disabled) return;
2232
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
2233
+ event.preventDefault();
2234
+ if (!open) {
2235
+ setUncontrolledOpen(true);
2236
+ return;
2237
+ }
2238
+ focusOption(event.key === "ArrowDown" ? 1 : -1);
2239
+ return;
2240
+ }
2241
+ if (event.key === "Enter" || event.key === " ") {
2242
+ event.preventDefault();
2243
+ if (!forceOpen) {
2244
+ setUncontrolledOpen((current) => !current);
2245
+ }
2246
+ return;
2247
+ }
2248
+ if (event.key === "Escape") {
2249
+ setUncontrolledOpen(false);
2250
+ }
2251
+ };
2252
+ if (!isCustomSelect) {
2253
+ return /* @__PURE__ */ jsxs(
2254
+ "div",
2255
+ {
2256
+ className: cn(
2257
+ theme.slots.controlWrapper,
2258
+ invalid && theme.slots.controlInvalid,
2259
+ disabled && theme.slots.controlDisabled,
2260
+ classNames?.root,
2261
+ className
2262
+ ),
2263
+ style: {
2264
+ ...theme.styles.control,
2265
+ ...invalid ? theme.styles.controlInvalid : void 0,
2266
+ ...disabled ? theme.styles.controlDisabled : void 0,
2267
+ ...style
2268
+ },
2269
+ children: [
2270
+ hasRenderableNode(icon) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.controlIcon, classNames?.icon), children: icon }) : null,
2271
+ /* @__PURE__ */ jsxs(
2272
+ "select",
2273
+ {
2274
+ ...selectProps,
2275
+ id,
2276
+ ref,
2277
+ name,
2278
+ value,
2279
+ defaultValue,
2280
+ required,
2281
+ disabled,
2282
+ "aria-invalid": nativeAriaInvalid ?? (invalid || void 0),
2283
+ "aria-label": nativeAriaLabel,
2284
+ "aria-labelledby": nativeAriaLabelledBy,
2285
+ onChange,
2286
+ className: cn(
2287
+ theme.slots.controlBase,
2288
+ theme.slots.controlSelect,
2289
+ classNames?.control
2290
+ ),
2291
+ children: [
2292
+ hasRenderableNode(placeholder) ? /* @__PURE__ */ jsx("option", { value: "", disabled: true, children: placeholder }) : null,
2293
+ children
2294
+ ]
2295
+ }
2296
+ ),
2297
+ /* @__PURE__ */ jsx("span", { className: theme.slots.selectChevron })
2298
+ ]
2299
+ }
2300
+ );
2301
+ }
2302
+ return /* @__PURE__ */ jsxs(
2303
+ "div",
2304
+ {
2305
+ ref: rootRef,
2306
+ className: cn(
2307
+ theme.slots.controlWrapper,
2308
+ "overflow-visible",
2309
+ open && "z-50",
2310
+ invalid && theme.slots.controlInvalid,
2311
+ disabled && theme.slots.controlDisabled,
2312
+ classNames?.root,
2313
+ className
2314
+ ),
2315
+ style: {
2316
+ ...theme.styles.control,
2317
+ ...invalid ? theme.styles.controlInvalid : void 0,
2318
+ ...disabled ? theme.styles.controlDisabled : void 0,
2319
+ ...style
2320
+ },
2321
+ children: [
2322
+ hasRenderableNode(icon) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.controlIcon, classNames?.icon), children: icon }) : null,
2323
+ /* @__PURE__ */ jsx(
2324
+ "button",
2325
+ {
2326
+ type: "button",
2327
+ id: `${selectId}-button`,
2328
+ disabled,
2329
+ "aria-haspopup": "listbox",
2330
+ "aria-expanded": open,
2331
+ "aria-controls": listboxId,
2332
+ "aria-invalid": nativeAriaInvalid ?? (invalid || void 0),
2333
+ "aria-label": nativeAriaLabel,
2334
+ "aria-labelledby": nativeAriaLabelledBy,
2335
+ className: cn(
2336
+ theme.slots.controlBase,
2337
+ theme.slots.controlSelect,
2338
+ "flex items-center text-left",
2339
+ classNames?.control
2340
+ ),
2341
+ onClick: () => {
2342
+ if (!forceOpen) {
2343
+ setUncontrolledOpen((current) => !current);
2344
+ }
2345
+ },
2346
+ onKeyDown: handleKeyDown,
2347
+ children: /* @__PURE__ */ jsx(
2348
+ "span",
2349
+ {
2350
+ className: cn(
2351
+ "min-w-0 flex-1 truncate",
2352
+ isPlaceholder && theme.slots.selectPlaceholder,
2353
+ isPlaceholder && classNames?.placeholder
2354
+ ),
2355
+ children: visibleLabel
2356
+ }
2357
+ )
2358
+ }
2359
+ ),
2360
+ /* @__PURE__ */ jsx(
2361
+ "span",
2362
+ {
2363
+ className: cn(
2364
+ theme.slots.selectChevron,
2365
+ open && "rotate-[225deg]"
2366
+ )
2367
+ }
2368
+ ),
2369
+ /* @__PURE__ */ jsxs(
2370
+ "select",
2371
+ {
2372
+ ...selectProps,
2373
+ ref: setSelectRef,
2374
+ id,
2375
+ name,
2376
+ value: selectedValue,
2377
+ required,
2378
+ disabled,
2379
+ "aria-hidden": "true",
2380
+ tabIndex: -1,
2381
+ className: theme.slots.selectNative,
2382
+ onChange,
2383
+ children: [
2384
+ hasRenderableNode(placeholder) ? /* @__PURE__ */ jsx("option", { value: "", disabled: true, children: placeholder }) : null,
2385
+ optionList.map((option) => /* @__PURE__ */ jsx(
2386
+ "option",
2387
+ {
2388
+ value: option.value,
2389
+ disabled: option.disabled,
2390
+ children: typeof option.label === "string" ? option.label : option.value
2391
+ },
2392
+ option.value
2393
+ ))
2394
+ ]
2395
+ }
2396
+ ),
2397
+ open ? /* @__PURE__ */ jsx(
2398
+ "div",
2399
+ {
2400
+ id: listboxId,
2401
+ role: "listbox",
2402
+ "aria-labelledby": `${selectId}-button`,
2403
+ className: cn(theme.slots.selectMenu, classNames?.menu),
2404
+ style: theme.styles.selectMenu,
2405
+ children: optionList.map((option, index) => {
2406
+ const selected = option.value === selectedValue;
2407
+ const active = index === activeIndex;
2408
+ return /* @__PURE__ */ jsx(
2409
+ "button",
2410
+ {
2411
+ type: "button",
2412
+ role: "option",
2413
+ "aria-selected": selected,
2414
+ disabled: option.disabled,
2415
+ className: cn(
2416
+ theme.slots.selectOption,
2417
+ active && theme.slots.selectOptionActive,
2418
+ selected && theme.slots.selectOptionSelected,
2419
+ option.disabled && theme.slots.selectOptionDisabled,
2420
+ classNames?.option
2421
+ ),
2422
+ style: {
2423
+ ...theme.styles.selectOption,
2424
+ ...active ? theme.styles.selectOptionActive : void 0,
2425
+ ...selected ? theme.styles.selectOptionSelected : void 0
2426
+ },
2427
+ onMouseDown: (event) => event.preventDefault(),
2428
+ onClick: () => commitValue(option.value, option.disabled),
2429
+ children: /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: option.label })
2430
+ },
2431
+ option.value
2432
+ );
2433
+ })
2434
+ }
2435
+ ) : null
2436
+ ]
2437
+ }
2438
+ );
2439
+ }
2440
+ );
2441
+ forwardRef(
2442
+ function BaseSwitch2({
2443
+ label,
2444
+ description,
2445
+ disabled = false,
2446
+ appearance,
2447
+ className,
2448
+ classNames,
2449
+ style,
2450
+ checked,
2451
+ defaultChecked,
2452
+ onChange,
2453
+ ...switchProps
2454
+ }, ref) {
2455
+ const theme = resolveBaseAppearance(appearance);
2456
+ const [uncontrolledChecked, setUncontrolledChecked] = useState(
2457
+ defaultChecked ?? false
2458
+ );
2459
+ const isControlled = checked !== void 0;
2460
+ const resolvedChecked = isControlled ? checked : uncontrolledChecked;
2461
+ const handleChange = (event) => {
2462
+ if (!isControlled) {
2463
+ setUncontrolledChecked(event.currentTarget.checked);
2464
+ }
2465
+ onChange?.(event);
2466
+ };
2467
+ return /* @__PURE__ */ jsxs(
2468
+ "label",
2469
+ {
2470
+ className: cn(
2471
+ theme.slots.switchRoot,
2472
+ disabled && theme.slots.switchDisabled,
2473
+ classNames?.root,
2474
+ className
2475
+ ),
2476
+ style: {
2477
+ ...theme.styles.switchRoot,
2478
+ ...style
2479
+ },
2480
+ children: [
2481
+ /* @__PURE__ */ jsxs(
2482
+ "span",
2483
+ {
2484
+ className: cn(
2485
+ theme.slots.switchTrack,
2486
+ resolvedChecked && theme.slots.switchChecked,
2487
+ classNames?.track
2488
+ ),
2489
+ style: theme.styles.switchTrack,
2490
+ children: [
2491
+ /* @__PURE__ */ jsx(
2492
+ "input",
2493
+ {
2494
+ ...switchProps,
2495
+ ref,
2496
+ type: "checkbox",
2497
+ disabled,
2498
+ checked,
2499
+ defaultChecked,
2500
+ onChange: handleChange,
2501
+ className: cn(theme.slots.switchInput, classNames?.input)
2502
+ }
2503
+ ),
2504
+ /* @__PURE__ */ jsx(
2505
+ "span",
2506
+ {
2507
+ className: cn(
2508
+ theme.slots.switchThumb,
2509
+ resolvedChecked && "translate-x-5",
2510
+ classNames?.thumb
2511
+ ),
2512
+ style: theme.styles.switchThumb
2513
+ }
2514
+ )
2515
+ ]
2516
+ }
2517
+ ),
2518
+ hasRenderableNode(label) || hasRenderableNode(description) ? /* @__PURE__ */ jsxs("span", { className: cn(theme.slots.switchContent, classNames?.content), children: [
2519
+ hasRenderableNode(label) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.switchLabel, classNames?.label), children: label }) : null,
2520
+ hasRenderableNode(description) ? /* @__PURE__ */ jsx(
2521
+ "span",
2522
+ {
2523
+ className: cn(
2524
+ theme.slots.switchDescription,
2525
+ classNames?.description
2526
+ ),
2527
+ children: description
2528
+ }
2529
+ ) : null
2530
+ ] }) : null
2531
+ ]
2532
+ }
2533
+ );
2534
+ }
2535
+ );
2536
+ var DATA_TRANSFER_COLUMN_TYPE = "application/x-monkeys-base-table-column";
2537
+ var BaseTableContext = createContext(null);
2538
+ function useBaseTableContext(appearance) {
2539
+ const context = useContext(BaseTableContext);
2540
+ if (context) {
2541
+ return {
2542
+ ...context,
2543
+ theme: appearance ? resolveBaseAppearance(appearance) : context.theme,
2544
+ appearance: appearance ?? context.appearance
2545
+ };
2546
+ }
2547
+ const theme = resolveBaseAppearance(appearance);
2548
+ return {
2549
+ appearance,
2550
+ theme,
2551
+ setDraggingColumnId: () => {
2552
+ }
2553
+ };
2554
+ }
2555
+ function toCssSize(value) {
2556
+ if (value === void 0) return void 0;
2557
+ return typeof value === "number" ? `${value}px` : value;
2558
+ }
2559
+ function clampWidth(value, minWidth, maxWidth) {
2560
+ const min = minWidth ?? 48;
2561
+ const max = maxWidth ?? Number.POSITIVE_INFINITY;
2562
+ return Math.min(Math.max(value, min), max);
2563
+ }
2564
+ function getNextColumnOrder(order, columnId, targetColumnId) {
2565
+ if (!order || columnId === targetColumnId) return void 0;
2566
+ const fromIndex = order.indexOf(columnId);
2567
+ const toIndex = order.indexOf(targetColumnId);
2568
+ if (fromIndex < 0 || toIndex < 0) return void 0;
2569
+ const next = [...order];
2570
+ const [moved] = next.splice(fromIndex, 1);
2571
+ next.splice(toIndex, 0, moved);
2572
+ return next;
2573
+ }
2574
+ function sortAriaValue(direction) {
2575
+ switch (direction) {
2576
+ case "asc":
2577
+ return "ascending";
2578
+ case "desc":
2579
+ return "descending";
2580
+ default:
2581
+ return void 0;
2582
+ }
2583
+ }
2584
+ function SortIndicator({
2585
+ direction,
2586
+ className
2587
+ }) {
2588
+ return /* @__PURE__ */ jsx(
2589
+ "span",
2590
+ {
2591
+ "aria-hidden": "true",
2592
+ className: cn(
2593
+ className,
2594
+ direction === "desc" && "rotate-180",
2595
+ (!direction || direction === "none") && "opacity-45"
2596
+ ),
2597
+ children: "\u25B2"
2598
+ }
2599
+ );
2600
+ }
2601
+ function DragHandleIcon() {
2602
+ return /* @__PURE__ */ jsxs("span", { "aria-hidden": "true", className: "grid gap-0.5", children: [
2603
+ /* @__PURE__ */ jsx("span", { className: "h-0.5 w-0.5 rounded-full bg-current" }),
2604
+ /* @__PURE__ */ jsx("span", { className: "h-0.5 w-0.5 rounded-full bg-current" }),
2605
+ /* @__PURE__ */ jsx("span", { className: "h-0.5 w-0.5 rounded-full bg-current" })
2606
+ ] });
2607
+ }
2608
+ forwardRef(function BaseTableHead2({
2609
+ columnId,
2610
+ align = "left",
2611
+ icon,
2612
+ label,
2613
+ description,
2614
+ meta,
2615
+ actions,
2616
+ trailing,
2617
+ sortable,
2618
+ sortDirection = "none",
2619
+ sortLabel,
2620
+ onSort,
2621
+ draggable,
2622
+ dragLabel,
2623
+ resizable,
2624
+ resizeLabel,
2625
+ width,
2626
+ minWidth,
2627
+ maxWidth,
2628
+ appearance,
2629
+ className,
2630
+ classNames,
2631
+ style,
2632
+ children,
2633
+ onDragOver,
2634
+ onDrop,
2635
+ ...headProps
2636
+ }, forwardedRef) {
2637
+ const tableContext = useBaseTableContext(appearance);
2638
+ const { theme } = tableContext;
2639
+ const headRef = useRef(null);
2640
+ const setHeadRef = (node) => {
2641
+ headRef.current = node;
2642
+ if (typeof forwardedRef === "function") {
2643
+ forwardedRef(node);
2644
+ } else if (forwardedRef) {
2645
+ forwardedRef.current = node;
2646
+ }
2647
+ };
2648
+ const controlledWidth = columnId && tableContext.columnSizes?.[columnId] !== void 0 ? tableContext.columnSizes[columnId] : width;
2649
+ const canDrag = Boolean(
2650
+ columnId && draggable !== false && (draggable || tableContext.columnDragEnabled) && tableContext.columnOrder && tableContext.onColumnOrderChange
2651
+ );
2652
+ const canResize = Boolean(
2653
+ columnId && resizable !== false && (resizable || tableContext.columnResizeEnabled) && tableContext.onColumnSizeChange
2654
+ );
2655
+ const interactiveSort = Boolean(sortable || onSort);
2656
+ const ariaSort = sortAriaValue(sortDirection);
2657
+ const content = hasRenderableNode(label) ? label : children;
2658
+ const usesRichHeader = canDrag || hasRenderableNode(icon) || hasRenderableNode(label) || hasRenderableNode(description) || hasRenderableNode(meta) || hasRenderableNode(actions) || hasRenderableNode(trailing) || interactiveSort;
2659
+ const renderedContent = usesRichHeader ? /* @__PURE__ */ jsxs("div", { className: cn(theme.slots.tableHeadContent, classNames?.content), children: [
2660
+ /* @__PURE__ */ jsxs("div", { className: cn(theme.slots.tableHeadMain, classNames?.main), children: [
2661
+ canDrag ? /* @__PURE__ */ jsx(
2662
+ "button",
2663
+ {
2664
+ type: "button",
2665
+ draggable: true,
2666
+ title: dragLabel,
2667
+ "aria-label": dragLabel ?? `Drag column ${columnId}`,
2668
+ className: cn(theme.slots.tableHeadDragHandle, classNames?.dragHandle),
2669
+ onClick: (event) => event.stopPropagation(),
2670
+ onDragStart: (event) => {
2671
+ event.stopPropagation();
2672
+ tableContext.setDraggingColumnId(columnId);
2673
+ event.dataTransfer.effectAllowed = "move";
2674
+ event.dataTransfer.setData(DATA_TRANSFER_COLUMN_TYPE, columnId);
2675
+ },
2676
+ onDragEnd: (event) => {
2677
+ event.stopPropagation();
2678
+ tableContext.setDraggingColumnId(void 0);
2679
+ },
2680
+ children: /* @__PURE__ */ jsx(DragHandleIcon, {})
2681
+ }
2682
+ ) : null,
2683
+ icon ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.tableHeadIcon, classNames?.icon), children: icon }) : null,
2684
+ interactiveSort ? /* @__PURE__ */ jsxs(
2685
+ "button",
2686
+ {
2687
+ type: "button",
2688
+ disabled: !onSort,
2689
+ title: sortLabel,
2690
+ className: cn(theme.slots.tableHeadSortButton, classNames?.sortButton),
2691
+ onClick: (event) => {
2692
+ event.stopPropagation();
2693
+ onSort?.(columnId);
2694
+ },
2695
+ children: [
2696
+ /* @__PURE__ */ jsxs("span", { className: cn(theme.slots.tableHeadText, classNames?.text), children: [
2697
+ hasRenderableNode(content) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.tableHeadLabel, classNames?.label), children: content }) : null,
2698
+ hasRenderableNode(description) ? /* @__PURE__ */ jsx(
2699
+ "span",
2700
+ {
2701
+ className: cn(
2702
+ theme.slots.tableHeadDescription,
2703
+ classNames?.description
2704
+ ),
2705
+ children: description
2706
+ }
2707
+ ) : null
2708
+ ] }),
2709
+ /* @__PURE__ */ jsx(
2710
+ SortIndicator,
2711
+ {
2712
+ direction: sortDirection,
2713
+ className: cn(theme.slots.tableHeadSortIcon, classNames?.sortIcon)
2714
+ }
2715
+ )
2716
+ ]
2717
+ }
2718
+ ) : /* @__PURE__ */ jsxs("span", { className: cn(theme.slots.tableHeadText, classNames?.text), children: [
2719
+ hasRenderableNode(content) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.tableHeadLabel, classNames?.label), children: content }) : null,
2720
+ hasRenderableNode(description) ? /* @__PURE__ */ jsx(
2721
+ "span",
2722
+ {
2723
+ className: cn(
2724
+ theme.slots.tableHeadDescription,
2725
+ classNames?.description
2726
+ ),
2727
+ children: description
2728
+ }
2729
+ ) : null
2730
+ ] })
2731
+ ] }),
2732
+ hasRenderableNode(meta) || hasRenderableNode(actions) || hasRenderableNode(trailing) ? /* @__PURE__ */ jsxs("div", { className: cn(theme.slots.tableHeadActions, classNames?.actions), children: [
2733
+ hasRenderableNode(meta) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.tableHeadMeta, classNames?.meta), children: meta }) : null,
2734
+ actions,
2735
+ trailing
2736
+ ] }) : null
2737
+ ] }) : children;
2738
+ const handleDragOver = (event) => {
2739
+ onDragOver?.(event);
2740
+ if (!canDrag || !tableContext.draggingColumnId || tableContext.draggingColumnId === columnId) {
2741
+ return;
2742
+ }
2743
+ event.preventDefault();
2744
+ event.dataTransfer.dropEffect = "move";
2745
+ };
2746
+ const handleDrop = (event) => {
2747
+ onDrop?.(event);
2748
+ if (!canDrag || !columnId) return;
2749
+ const sourceColumnId = tableContext.draggingColumnId || event.dataTransfer.getData(DATA_TRANSFER_COLUMN_TYPE);
2750
+ if (!sourceColumnId || sourceColumnId === columnId) return;
2751
+ const nextOrder = getNextColumnOrder(
2752
+ tableContext.columnOrder,
2753
+ sourceColumnId,
2754
+ columnId
2755
+ );
2756
+ if (nextOrder) {
2757
+ event.preventDefault();
2758
+ tableContext.onColumnOrderChange?.(nextOrder, {
2759
+ columnId: sourceColumnId,
2760
+ targetColumnId: columnId
2761
+ });
2762
+ }
2763
+ tableContext.setDraggingColumnId(void 0);
2764
+ };
2765
+ const handleResizePointerDown = (event) => {
2766
+ if (!canResize || !columnId || !tableContext.onColumnSizeChange) return;
2767
+ event.preventDefault();
2768
+ event.stopPropagation();
2769
+ const startX = event.clientX;
2770
+ const currentWidth = typeof controlledWidth === "number" ? controlledWidth : headRef.current?.offsetWidth ?? minWidth ?? 96;
2771
+ const previousWidth = clampWidth(currentWidth, minWidth, maxWidth);
2772
+ const pointerId = event.pointerId;
2773
+ const target = event.currentTarget;
2774
+ target.setPointerCapture?.(pointerId);
2775
+ const handlePointerMove = (moveEvent) => {
2776
+ const nextWidth = clampWidth(
2777
+ previousWidth + moveEvent.clientX - startX,
2778
+ minWidth,
2779
+ maxWidth
2780
+ );
2781
+ tableContext.onColumnSizeChange?.(columnId, nextWidth, {
2782
+ columnId,
2783
+ previousWidth,
2784
+ minWidth,
2785
+ maxWidth
2786
+ });
2787
+ };
2788
+ const cleanup = () => {
2789
+ target.releasePointerCapture?.(pointerId);
2790
+ window.removeEventListener("pointermove", handlePointerMove);
2791
+ window.removeEventListener("pointerup", cleanup);
2792
+ window.removeEventListener("pointercancel", cleanup);
2793
+ };
2794
+ window.addEventListener("pointermove", handlePointerMove);
2795
+ window.addEventListener("pointerup", cleanup);
2796
+ window.addEventListener("pointercancel", cleanup);
2797
+ };
2798
+ return /* @__PURE__ */ jsxs(
2799
+ "th",
2800
+ {
2801
+ ...headProps,
2802
+ ref: setHeadRef,
2803
+ scope: headProps.scope ?? "col",
2804
+ "aria-sort": ariaSort,
2805
+ className: cn(
2806
+ theme.slots.tableHead,
2807
+ align === "center" && theme.slots.tableCellAlignCenter,
2808
+ align === "right" && theme.slots.tableCellAlignRight,
2809
+ classNames?.root,
2810
+ className
2811
+ ),
2812
+ style: {
2813
+ ...theme.styles.tableHead,
2814
+ width: toCssSize(controlledWidth),
2815
+ minWidth: toCssSize(minWidth),
2816
+ maxWidth: toCssSize(maxWidth),
2817
+ ...style
2818
+ },
2819
+ onDragOver: handleDragOver,
2820
+ onDrop: handleDrop,
2821
+ children: [
2822
+ renderedContent,
2823
+ canResize ? /* @__PURE__ */ jsx(
2824
+ "button",
2825
+ {
2826
+ type: "button",
2827
+ title: resizeLabel,
2828
+ "aria-label": resizeLabel ?? `Resize column ${columnId}`,
2829
+ className: cn(theme.slots.tableHeadResizeHandle, classNames?.resizeHandle),
2830
+ onClick: (event) => event.stopPropagation(),
2831
+ onPointerDown: handleResizePointerDown
2832
+ }
2833
+ ) : null
2834
+ ]
2835
+ }
2836
+ );
2837
+ });
2838
+ forwardRef(
2839
+ function BaseTextarea2({
2840
+ invalid = false,
2841
+ disabled = false,
2842
+ readOnly = false,
2843
+ appearance,
2844
+ className,
2845
+ classNames,
2846
+ style,
2847
+ "aria-invalid": nativeAriaInvalid,
2848
+ ...textareaProps
2849
+ }, ref) {
2850
+ const theme = resolveBaseAppearance(appearance);
2851
+ return /* @__PURE__ */ jsx(
2852
+ "textarea",
2853
+ {
2854
+ ...textareaProps,
2855
+ ref,
2856
+ disabled,
2857
+ readOnly,
2858
+ "aria-invalid": nativeAriaInvalid ?? (invalid || void 0),
2859
+ className: cn(
2860
+ theme.slots.controlWrapper,
2861
+ theme.slots.controlBase,
2862
+ theme.slots.controlTextarea,
2863
+ invalid && theme.slots.controlInvalid,
2864
+ disabled && theme.slots.controlDisabled,
2865
+ readOnly && theme.slots.controlReadOnly,
2866
+ classNames?.control,
2867
+ className
2868
+ ),
2869
+ style: {
2870
+ ...theme.styles.control,
2871
+ ...invalid ? theme.styles.controlInvalid : void 0,
2872
+ ...disabled ? theme.styles.controlDisabled : void 0,
2873
+ ...style
2874
+ }
2875
+ }
2876
+ );
2877
+ }
2878
+ );
2879
+ function getTooltipPlacementClassName(placement) {
2880
+ switch (placement) {
2881
+ case "bottom":
2882
+ return "left-1/2 top-[calc(100%+0.5rem)] -translate-x-1/2";
2883
+ case "left":
2884
+ return "right-[calc(100%+0.5rem)] top-1/2 -translate-y-1/2";
2885
+ case "right":
2886
+ return "left-[calc(100%+0.5rem)] top-1/2 -translate-y-1/2";
2887
+ case "top":
2888
+ default:
2889
+ return "bottom-[calc(100%+0.5rem)] left-1/2 -translate-x-1/2";
2890
+ }
2891
+ }
2892
+ function BaseTooltip({
2893
+ content,
2894
+ children,
2895
+ open,
2896
+ defaultOpen = false,
2897
+ placement = "top",
2898
+ disabled = false,
2899
+ appearance,
2900
+ className,
2901
+ classNames,
2902
+ style,
2903
+ onOpenChange,
2904
+ ...tooltipProps
2905
+ }) {
2906
+ const theme = resolveBaseAppearance(appearance);
2907
+ const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);
2908
+ const isControlled = open !== void 0;
2909
+ const isOpen = isControlled ? open : uncontrolledOpen;
2910
+ const canShow = !disabled && hasRenderableNode(content);
2911
+ const setOpen = (nextOpen) => {
2912
+ if (!canShow && nextOpen) return;
2913
+ if (!isControlled) {
2914
+ setUncontrolledOpen(nextOpen);
2915
+ }
2916
+ onOpenChange?.(nextOpen);
2917
+ };
2918
+ return /* @__PURE__ */ jsxs(
2919
+ "span",
2920
+ {
2921
+ ...tooltipProps,
2922
+ className: cn(theme.slots.tooltipRoot, classNames?.root, className),
2923
+ style,
2924
+ onMouseEnter: () => setOpen(true),
2925
+ onMouseLeave: () => setOpen(false),
2926
+ onFocus: () => setOpen(true),
2927
+ onBlur: () => setOpen(false),
2928
+ children: [
2929
+ /* @__PURE__ */ jsx("span", { className: cn(theme.slots.tooltipTrigger, classNames?.trigger), children }),
2930
+ canShow && isOpen ? /* @__PURE__ */ jsx(
2931
+ "span",
2932
+ {
2933
+ role: "tooltip",
2934
+ className: cn(
2935
+ theme.slots.tooltipContent,
2936
+ getTooltipPlacementClassName(placement),
2937
+ classNames?.content
2938
+ ),
2939
+ style: theme.styles.tooltip,
2940
+ children: content
2941
+ }
2942
+ ) : null
2943
+ ]
2944
+ }
2945
+ );
2946
+ }
2947
+ var defaultAppearance = {
2948
+ preset: "admin",
2949
+ density: "compact",
2950
+ radius: "lg",
2951
+ border: "subtle",
2952
+ background: "soft"
2953
+ };
2954
+ var radiusClassNames = {
2955
+ default: "rounded-md",
2956
+ none: "rounded-none",
2957
+ sm: "rounded-sm",
2958
+ md: "rounded-md",
2959
+ lg: "rounded-lg",
2960
+ xl: "rounded-xl",
2961
+ full: "rounded-full"
2962
+ };
2963
+ function CheckIcon() {
2964
+ return /* @__PURE__ */ jsx(
2965
+ "svg",
2966
+ {
2967
+ "aria-hidden": "true",
2968
+ className: "h-3 w-3",
2969
+ viewBox: "0 0 24 24",
2970
+ fill: "none",
2971
+ stroke: "currentColor",
2972
+ strokeWidth: "2.25",
2973
+ strokeLinecap: "round",
2974
+ strokeLinejoin: "round",
2975
+ children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" })
2976
+ }
2977
+ );
2978
+ }
2979
+ function MoreIcon() {
2980
+ return /* @__PURE__ */ jsxs(
2981
+ "svg",
2982
+ {
2983
+ "aria-hidden": "true",
2984
+ className: "h-4 w-4",
2985
+ viewBox: "0 0 24 24",
2986
+ fill: "none",
2987
+ stroke: "currentColor",
2988
+ strokeWidth: "2",
2989
+ strokeLinecap: "round",
2990
+ strokeLinejoin: "round",
2991
+ children: [
2992
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "1" }),
2993
+ /* @__PURE__ */ jsx("circle", { cx: "19", cy: "12", r: "1" }),
2994
+ /* @__PURE__ */ jsx("circle", { cx: "5", cy: "12", r: "1" })
2995
+ ]
2996
+ }
2997
+ );
2998
+ }
2999
+ function getInitials2(name) {
3000
+ if (!name) return "U";
3001
+ const words = name.trim().split(/\s+/).filter(Boolean);
3002
+ if (!words.length) return "U";
3003
+ if (words.length === 1) return words[0].slice(0, 2).toUpperCase();
3004
+ return words.slice(0, 2).map((word) => word[0]).join("").toUpperCase();
3005
+ }
3006
+ function renderIcon(icon, className) {
3007
+ if (!icon) return null;
3008
+ return /* @__PURE__ */ jsx("span", { className: cn("inline-flex h-4 w-4 shrink-0 items-center justify-center", className), children: icon });
3009
+ }
3010
+ function getCurrentOptionLabel(selector) {
3011
+ return selector.options.find((option) => option.value === selector.value)?.label ?? selector.value;
3012
+ }
3013
+ function UserAccountMenuSelector({
3014
+ classNames,
3015
+ menuRadius,
3016
+ selector
3017
+ }) {
3018
+ if (selector.visible === false || selector.options.length === 0) return null;
3019
+ const radiusClass = radiusClassNames[menuRadius];
3020
+ const currentLabel = getCurrentOptionLabel(selector);
3021
+ return /* @__PURE__ */ jsxs(DropdownMenu.Sub, { children: [
3022
+ /* @__PURE__ */ jsxs(
3023
+ DropdownMenu.SubTrigger,
3024
+ {
3025
+ disabled: selector.disabled,
3026
+ className: cn(
3027
+ "relative flex cursor-pointer select-none items-center gap-2 px-2 py-2 text-sm outline-none transition-colors hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--accent-foreground))] data-[state=open]:bg-[hsl(var(--accent))] data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
3028
+ radiusClass,
3029
+ classNames?.subTrigger
3030
+ ),
3031
+ children: [
3032
+ renderIcon(selector.icon),
3033
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: selector.label }),
3034
+ /* @__PURE__ */ jsx("span", { className: "ml-auto min-w-0 max-w-[7rem] truncate text-xs text-[hsl(var(--muted-foreground))]", children: currentLabel })
3035
+ ]
3036
+ }
3037
+ ),
3038
+ /* @__PURE__ */ jsx(DropdownMenu.Portal, { children: /* @__PURE__ */ jsx(
3039
+ DropdownMenu.SubContent,
3040
+ {
3041
+ sideOffset: 8,
3042
+ className: cn(
3043
+ "z-50 min-w-40 border border-[hsl(var(--border))] bg-[hsl(var(--popover))] p-1.5 text-[hsl(var(--popover-foreground))] shadow-md animate-in fade-in-0 zoom-in-95",
3044
+ radiusClass,
3045
+ selector.contentWidthClassName,
3046
+ classNames?.subContent
3047
+ ),
3048
+ children: /* @__PURE__ */ jsx(DropdownMenu.RadioGroup, { value: selector.value, onValueChange: selector.onChange, children: selector.options.map((option) => /* @__PURE__ */ jsxs(
3049
+ DropdownMenu.RadioItem,
3050
+ {
3051
+ value: option.value,
3052
+ disabled: option.disabled,
3053
+ className: cn(
3054
+ "relative flex cursor-pointer select-none items-center gap-2 px-2 py-2 pl-8 text-sm outline-none transition-colors hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--accent-foreground))] data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
3055
+ radiusClass,
3056
+ classNames?.item
3057
+ ),
3058
+ children: [
3059
+ /* @__PURE__ */ jsx(DropdownMenu.ItemIndicator, { className: "absolute left-2 inline-flex h-4 w-4 items-center justify-center", children: /* @__PURE__ */ jsx(CheckIcon, {}) }),
3060
+ renderIcon(option.icon, classNames?.itemIcon),
3061
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: option.label })
3062
+ ]
3063
+ },
3064
+ option.value
3065
+ )) })
3066
+ }
3067
+ ) })
3068
+ ] });
3069
+ }
3070
+ function UserAccountMenu({
3071
+ align = "end",
3072
+ appearance = defaultAppearance,
3073
+ ariaLabel,
3074
+ className,
3075
+ classNames,
3076
+ contentWidthClassName = "w-56",
3077
+ fallbackName = "User",
3078
+ items = [],
3079
+ menuRadius = "default",
3080
+ selectors = [],
3081
+ side = "bottom",
3082
+ sideOffset = 8,
3083
+ triggerEndIcon,
3084
+ triggerTitle,
3085
+ triggerVariant = "avatar",
3086
+ user
3087
+ }) {
3088
+ const displayName = user.name?.trim() || fallbackName;
3089
+ const initials = user.initials ?? getInitials2(displayName);
3090
+ const radiusClass = radiusClassNames[menuRadius];
3091
+ const visibleSelectors = selectors.filter(
3092
+ (selector) => selector.visible !== false && selector.options.length > 0
3093
+ );
3094
+ const visibleItems = items.filter((item) => item.visible !== false);
3095
+ const hasMenuBody = visibleSelectors.length > 0 || visibleItems.length > 0;
3096
+ const avatar = /* @__PURE__ */ jsx(
3097
+ BaseAvatar,
3098
+ {
3099
+ appearance,
3100
+ alt: user.avatarAlt ?? displayName,
3101
+ className: cn("h-8 w-8", classNames?.avatar),
3102
+ initials,
3103
+ name: displayName,
3104
+ size: "sm",
3105
+ src: user.avatarUrl
3106
+ }
3107
+ );
3108
+ const isProfileTrigger = triggerVariant === "profile";
3109
+ return /* @__PURE__ */ jsxs(DropdownMenu.Root, { children: [
3110
+ /* @__PURE__ */ jsx(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(
3111
+ BaseButton,
3112
+ {
3113
+ appearance,
3114
+ ariaLabel: ariaLabel ?? displayName,
3115
+ className: cn(
3116
+ isProfileTrigger ? "h-auto w-full justify-start rounded-lg border-transparent bg-transparent px-2 py-2 text-left shadow-none transition-all hover:bg-[hsl(var(--muted))]/60" : "h-9 w-9 overflow-visible rounded-full border-transparent bg-transparent p-0 shadow-none transition-all hover:ring-2 hover:ring-[hsl(var(--ring))]/20",
3117
+ className,
3118
+ classNames?.root,
3119
+ classNames?.trigger
3120
+ ),
3121
+ classNames: {
3122
+ icon: "h-8 w-8",
3123
+ label: isProfileTrigger ? "min-w-0 flex-1 text-left" : void 0
3124
+ },
3125
+ endIcon: isProfileTrigger ? triggerEndIcon ?? /* @__PURE__ */ jsx(MoreIcon, {}) : void 0,
3126
+ icon: avatar,
3127
+ iconOnly: !isProfileTrigger,
3128
+ label: isProfileTrigger ? /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-col items-start", children: [
3129
+ /* @__PURE__ */ jsx("span", { className: "max-w-full truncate text-sm font-medium leading-none text-[hsl(var(--foreground))]", children: displayName }),
3130
+ user.secondaryText ? /* @__PURE__ */ jsx("span", { className: "mt-1 max-w-full truncate text-xs leading-none text-[hsl(var(--muted-foreground))]", children: user.secondaryText }) : null
3131
+ ] }) : void 0,
3132
+ title: triggerTitle ?? displayName,
3133
+ tone: "muted"
3134
+ }
3135
+ ) }),
3136
+ /* @__PURE__ */ jsx(DropdownMenu.Portal, { children: /* @__PURE__ */ jsxs(
3137
+ DropdownMenu.Content,
3138
+ {
3139
+ align,
3140
+ side,
3141
+ sideOffset,
3142
+ className: cn(
3143
+ "z-50 border border-[hsl(var(--border))] bg-[hsl(var(--popover))] p-1.5 text-[hsl(var(--popover-foreground))] shadow-md animate-in fade-in-0 zoom-in-95",
3144
+ contentWidthClassName,
3145
+ radiusClass,
3146
+ classNames?.content
3147
+ ),
3148
+ children: [
3149
+ /* @__PURE__ */ jsx(DropdownMenu.Label, { className: cn("px-2 py-1.5 font-normal", classNames?.label), children: /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
3150
+ avatar,
3151
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col", children: [
3152
+ /* @__PURE__ */ jsx("span", { className: cn("truncate text-sm font-medium leading-none", classNames?.userName), children: displayName }),
3153
+ user.secondaryText ? /* @__PURE__ */ jsx(
3154
+ "span",
3155
+ {
3156
+ className: cn(
3157
+ "truncate pt-1 text-xs leading-none text-[hsl(var(--muted-foreground))]",
3158
+ classNames?.secondaryText
3159
+ ),
3160
+ children: user.secondaryText
3161
+ }
3162
+ ) : null
3163
+ ] })
3164
+ ] }) }),
3165
+ hasMenuBody ? /* @__PURE__ */ jsx(
3166
+ DropdownMenu.Separator,
3167
+ {
3168
+ className: cn("my-1 h-px bg-[hsl(var(--border))]", classNames?.separator)
3169
+ }
3170
+ ) : null,
3171
+ visibleSelectors.map((selector, index) => /* @__PURE__ */ jsx(
3172
+ UserAccountMenuSelector,
3173
+ {
3174
+ classNames,
3175
+ menuRadius,
3176
+ selector
3177
+ },
3178
+ selector.id ?? `selector-${index}`
3179
+ )),
3180
+ visibleSelectors.length > 0 && visibleItems.length > 0 ? /* @__PURE__ */ jsx(
3181
+ DropdownMenu.Separator,
3182
+ {
3183
+ className: cn("my-1 h-px bg-[hsl(var(--border))]", classNames?.separator)
3184
+ }
3185
+ ) : null,
3186
+ visibleItems.map((item) => /* @__PURE__ */ jsxs("div", { children: [
3187
+ item.separatorBefore ? /* @__PURE__ */ jsx(
3188
+ DropdownMenu.Separator,
3189
+ {
3190
+ className: cn("my-1 h-px bg-[hsl(var(--border))]", classNames?.separator)
3191
+ }
3192
+ ) : null,
3193
+ /* @__PURE__ */ jsxs(
3194
+ DropdownMenu.Item,
3195
+ {
3196
+ disabled: item.disabled,
3197
+ onSelect: item.onSelect,
3198
+ className: cn(
3199
+ "relative flex cursor-pointer select-none items-center gap-2 px-2 py-2 text-sm outline-none transition-colors hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--accent-foreground))] data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
3200
+ radiusClass,
3201
+ item.tone === "danger" && "text-[hsl(var(--destructive))] hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--destructive))] focus:text-[hsl(var(--destructive))]",
3202
+ classNames?.item,
3203
+ item.tone === "danger" && classNames?.dangerItem
3204
+ ),
3205
+ children: [
3206
+ renderIcon(item.icon, classNames?.itemIcon),
3207
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: item.label }),
3208
+ item.shortcut ? /* @__PURE__ */ jsx("span", { className: "ml-3 shrink-0 text-xs text-[hsl(var(--muted-foreground))]", children: item.shortcut }) : null
3209
+ ]
3210
+ }
3211
+ )
3212
+ ] }, item.id))
3213
+ ]
3214
+ }
3215
+ ) })
3216
+ ] });
3217
+ }
3218
+ function cn2(...inputs) {
7
3219
  return inputs.filter(Boolean).join(" ");
8
3220
  }
9
3221
  function NavButton({ active, icon, postfix, onClick, className, children }) {
10
3222
  return /* @__PURE__ */ jsxs(
11
3223
  "div",
12
3224
  {
13
- className: cn(
3225
+ className: cn2(
14
3226
  "flex w-full cursor-pointer select-none items-center gap-2 rounded-xl border p-2 text-xs text-[hsl(var(--foreground))] transition-colors",
15
3227
  active ? "border-[hsl(var(--input))] bg-[hsl(var(--muted))] font-bold" : "border-transparent hover:border-[hsl(var(--input))]/60 hover:bg-[hsl(var(--muted))]/60",
16
3228
  className
@@ -40,7 +3252,7 @@ function AppHeader({
40
3252
  return /* @__PURE__ */ jsxs(
41
3253
  "header",
42
3254
  {
43
- className: cn(
3255
+ className: cn2(
44
3256
  "flex h-[72px] w-full shrink-0 items-center justify-between gap-4 rounded-xl border border-[hsl(var(--input))] bg-[hsl(var(--background))] p-[var(--global-spacing,0.75rem)]",
45
3257
  className
46
3258
  ),
@@ -54,7 +3266,7 @@ function AppHeader({
54
3266
  /* @__PURE__ */ jsx(
55
3267
  "div",
56
3268
  {
57
- className: cn(
3269
+ className: cn2(
58
3270
  "flex h-8 w-8 items-center justify-center rounded-lg overflow-hidden",
59
3271
  logo.url ? "bg-transparent" : "bg-[hsl(var(--primary))] text-[hsl(var(--primary-foreground))]"
60
3272
  ),
@@ -70,7 +3282,7 @@ function AppHeader({
70
3282
  /* @__PURE__ */ jsx("div", { className: "flex flex-1 items-center", children: /* @__PURE__ */ jsx("div", { className: "inline-flex h-9 items-center gap-1 rounded-md bg-transparent p-1", children: tabs.map((tab) => /* @__PURE__ */ jsx(
71
3283
  "button",
72
3284
  {
73
- className: cn(
3285
+ className: cn2(
74
3286
  "inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium transition-all",
75
3287
  tab.id === activeTab ? "bg-[hsl(var(--muted))] text-[hsl(var(--foreground))] shadow-sm" : "text-[hsl(var(--muted-foreground))] hover:bg-[hsl(var(--muted))]/50"
76
3288
  ),
@@ -142,7 +3354,7 @@ function AppSidebar({
142
3354
  return /* @__PURE__ */ jsxs(
143
3355
  "div",
144
3356
  {
145
- className: cn(
3357
+ className: cn2(
146
3358
  "flex w-[13.7rem] shrink-0 flex-col justify-between gap-[var(--global-spacing,0.75rem)] overflow-y-hidden rounded-xl border border-[hsl(var(--input))] bg-[hsl(var(--background))] p-5",
147
3359
  className
148
3360
  ),
@@ -151,7 +3363,7 @@ function AppSidebar({
151
3363
  /* @__PURE__ */ jsx(
152
3364
  "div",
153
3365
  {
154
- className: cn(
3366
+ className: cn2(
155
3367
  "flex h-8 w-8 items-center justify-center rounded-lg overflow-hidden",
156
3368
  logo.url ? "bg-transparent" : "bg-[hsl(var(--primary))] text-[hsl(var(--primary-foreground))]"
157
3369
  ),
@@ -275,21 +3487,720 @@ function SidebarNavList({ items, activeItemId, onNavigate, defaultExpandedGroups
275
3487
  ] });
276
3488
  }
277
3489
  function AppLayout({ header, sidebar, children, flush = false, className }) {
278
- return /* @__PURE__ */ jsxs("div", { className: cn(
3490
+ return /* @__PURE__ */ jsxs("div", { className: cn2(
279
3491
  "flex h-screen flex-col gap-[var(--global-spacing,0.75rem)] overflow-hidden p-[var(--global-spacing,0.75rem)]",
280
3492
  className
281
3493
  ), style: { backgroundColor: "hsl(var(--muted))" }, children: [
282
- header,
3494
+ header ? header : null,
283
3495
  /* @__PURE__ */ jsxs("div", { className: "flex flex-1 gap-[var(--global-spacing,0.75rem)] overflow-hidden min-h-0", children: [
284
- sidebar,
285
- /* @__PURE__ */ jsx("main", { className: cn(
3496
+ sidebar ? sidebar : null,
3497
+ /* @__PURE__ */ jsx("main", { className: cn2(
286
3498
  "flex-1 min-h-0 overflow-hidden rounded-xl border border-[hsl(var(--input))] bg-[hsl(var(--background))]",
287
3499
  !flush && "overflow-y-auto"
288
3500
  ), children: flush ? children : /* @__PURE__ */ jsx("div", { className: "h-full overflow-y-auto", children }) })
289
3501
  ] })
290
3502
  ] });
291
3503
  }
3504
+ var NAVIGATION_LAYOUT_SIDEBAR_EXPANDED_WIDTH = "13.7rem";
3505
+ var NAVIGATION_LAYOUT_SIDEBAR_COLLAPSED_WIDTH = "4.25rem";
3506
+ var NAVIGATION_LAYOUT_TRANSITION_TIMING = "cubic-bezier(0.22, 1, 0.36, 1)";
3507
+ var NAVIGATION_LAYOUT_HEADBAR_DEFAULT_HEIGHT_PX = 72;
3508
+ var NAVIGATION_LAYOUT_HEADBAR_MIN_HEIGHT_PX = 56;
3509
+ var NAVIGATION_LAYOUT_HEADBAR_MAX_HEIGHT_PX = 120;
3510
+ var NAVIGATION_LAYOUT_HEADBAR_COMPACT_HEIGHT_THRESHOLD_PX = 64;
3511
+ var NAVIGATION_LAYOUT_HEADBAR_BOXED_VERTICAL_PADDING_PX = 12;
3512
+ var NAVIGATION_LAYOUT_HEADBAR_COMPACT_VERTICAL_PADDING_PX = 8;
3513
+ var NAVIGATION_LAYOUT_HEADBAR_LOGO_DEFAULT_SIZE_PX = 44;
3514
+ var NAVIGATION_LAYOUT_HEADBAR_LOGO_COMPACT_SIZE_PX = 36;
3515
+ var NAVIGATION_LAYOUT_DEFAULT_APPEARANCE = {
3516
+ preset: "admin",
3517
+ density: "compact",
3518
+ radius: "lg",
3519
+ border: "subtle",
3520
+ background: "soft"
3521
+ };
3522
+ var NAVIGATION_LAYOUT_MENU_RADIUS_CLASS_MAP = {
3523
+ none: { all: "rounded-none", left: "!rounded-none", right: "!rounded-none" },
3524
+ sm: { all: "rounded-sm", left: "!rounded-l-sm !rounded-r-none", right: "!rounded-l-none !rounded-r-sm" },
3525
+ md: { all: "rounded-md", left: "!rounded-l-md !rounded-r-none", right: "!rounded-l-none !rounded-r-md" },
3526
+ lg: { all: "rounded-lg", left: "!rounded-l-lg !rounded-r-none", right: "!rounded-l-none !rounded-r-lg" },
3527
+ xl: { all: "rounded-xl", left: "!rounded-l-xl !rounded-r-none", right: "!rounded-l-none !rounded-r-xl" },
3528
+ full: { all: "rounded-full", left: "!rounded-l-full !rounded-r-none", right: "!rounded-l-none !rounded-r-full" }
3529
+ };
3530
+ function clampHeadbarHeight(value) {
3531
+ if (typeof value !== "number" || !Number.isFinite(value)) return NAVIGATION_LAYOUT_HEADBAR_DEFAULT_HEIGHT_PX;
3532
+ return Math.min(NAVIGATION_LAYOUT_HEADBAR_MAX_HEIGHT_PX, Math.max(NAVIGATION_LAYOUT_HEADBAR_MIN_HEIGHT_PX, Math.round(value)));
3533
+ }
3534
+ function getHeadbarVerticalPaddingPx(heightPx) {
3535
+ return heightPx <= NAVIGATION_LAYOUT_HEADBAR_COMPACT_HEIGHT_THRESHOLD_PX ? NAVIGATION_LAYOUT_HEADBAR_COMPACT_VERTICAL_PADDING_PX : NAVIGATION_LAYOUT_HEADBAR_BOXED_VERTICAL_PADDING_PX;
3536
+ }
3537
+ function getHeadbarLogoSizePx(heightPx) {
3538
+ return heightPx <= NAVIGATION_LAYOUT_HEADBAR_COMPACT_HEIGHT_THRESHOLD_PX ? NAVIGATION_LAYOUT_HEADBAR_LOGO_COMPACT_SIZE_PX : NAVIGATION_LAYOUT_HEADBAR_LOGO_DEFAULT_SIZE_PX;
3539
+ }
3540
+ function getHeadbarMenuRadiusClass(menuRadius = "default", part = "all") {
3541
+ if (menuRadius === "default") {
3542
+ if (part === "left") return "rounded-l-lg rounded-r-none";
3543
+ if (part === "right") return "rounded-l-none rounded-r-lg";
3544
+ return "rounded-lg";
3545
+ }
3546
+ return NAVIGATION_LAYOUT_MENU_RADIUS_CLASS_MAP[menuRadius][part];
3547
+ }
3548
+ function getHeadbarFrameClass(layoutMode = "boxed") {
3549
+ return layoutMode === "full-bleed" ? "relative z-40 grid w-full shrink-0 grid-cols-[minmax(0,1fr)_minmax(0,max-content)_minmax(0,1fr)] items-center gap-4 rounded-none border-b border-x-0 border-t-0 border-[hsl(var(--input))] bg-[hsl(var(--background))] p-[var(--global-spacing,0.75rem)]" : "relative z-40 grid w-full shrink-0 grid-cols-[minmax(0,1fr)_minmax(0,max-content)_minmax(0,1fr)] items-center gap-4 rounded-xl border border-[hsl(var(--input))] bg-[hsl(var(--background))] p-[var(--global-spacing,0.75rem)]";
3550
+ }
3551
+ function getHeadbarFrameStyle(layoutMode = "boxed", heightPx) {
3552
+ const verticalPaddingPx = getHeadbarVerticalPaddingPx(heightPx);
3553
+ const style = {
3554
+ height: `${heightPx}px`,
3555
+ minHeight: `${heightPx}px`,
3556
+ paddingTop: `${verticalPaddingPx}px`,
3557
+ paddingBottom: `${verticalPaddingPx}px`
3558
+ };
3559
+ if (layoutMode === "full-bleed") {
3560
+ style.marginLeft = "calc(var(--global-spacing,0.75rem) * -1)";
3561
+ style.marginRight = "calc(var(--global-spacing,0.75rem) * -1)";
3562
+ style.marginTop = "calc(var(--global-spacing,0.75rem) * -1)";
3563
+ style.width = "calc(100% + (var(--global-spacing,0.75rem) * 2))";
3564
+ }
3565
+ return style;
3566
+ }
3567
+ function getHeadbarNavClass(navPosition = "center") {
3568
+ if (navPosition === "left") return "justify-start";
3569
+ if (navPosition === "right") return "justify-end";
3570
+ return "justify-center";
3571
+ }
3572
+ function findNavigationRootId(items, activeItemId) {
3573
+ for (const item of items) {
3574
+ if (item.id === activeItemId) return item.id;
3575
+ if (item.children?.some((child) => child.id === activeItemId)) return item.id;
3576
+ }
3577
+ return activeItemId;
3578
+ }
3579
+ function getNavigationActionTitle(action) {
3580
+ return action.title || (typeof action.label === "string" ? action.label : void 0);
3581
+ }
3582
+ function NavigationLayoutActionButtons({
3583
+ actions,
3584
+ compact
3585
+ }) {
3586
+ if (!actions.length) return null;
3587
+ if (compact) {
3588
+ return /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center gap-2", children: actions.map((action) => {
3589
+ const title = getNavigationActionTitle(action);
3590
+ return /* @__PURE__ */ jsx(
3591
+ BaseTooltip,
3592
+ {
3593
+ appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
3594
+ content: action.label,
3595
+ placement: "right",
3596
+ children: /* @__PURE__ */ jsx(
3597
+ BaseButton,
3598
+ {
3599
+ appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
3600
+ tone: "muted",
3601
+ iconOnly: true,
3602
+ icon: action.icon,
3603
+ onClick: action.onClick,
3604
+ title,
3605
+ ariaLabel: title,
3606
+ className: cn2(
3607
+ "h-10 w-10 rounded-lg border-transparent text-[hsl(var(--muted-foreground))] shadow-none",
3608
+ "hover:-translate-y-0.5 hover:border-[hsl(var(--input))]/80 hover:bg-[hsl(var(--muted))] hover:text-[hsl(var(--foreground))]",
3609
+ "active:translate-y-0 active:scale-[0.96]"
3610
+ )
3611
+ }
3612
+ )
3613
+ },
3614
+ action.id
3615
+ );
3616
+ }) });
3617
+ }
3618
+ return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: actions.map((action) => /* @__PURE__ */ jsx(
3619
+ BaseButton,
3620
+ {
3621
+ appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
3622
+ tone: "muted",
3623
+ icon: action.icon,
3624
+ label: /* @__PURE__ */ jsx("span", { className: "truncate", children: action.label }),
3625
+ onClick: action.onClick,
3626
+ title: getNavigationActionTitle(action),
3627
+ className: cn2(
3628
+ "h-9 w-full justify-start gap-2.5 rounded-lg border-transparent px-3 text-left text-[13px] text-[hsl(var(--muted-foreground))] shadow-none",
3629
+ "hover:-translate-y-0.5 hover:border-[hsl(var(--input))]/80 hover:bg-[hsl(var(--muted))]/70 hover:text-[hsl(var(--foreground))]",
3630
+ "active:translate-y-0 active:scale-[0.985]"
3631
+ )
3632
+ },
3633
+ action.id
3634
+ )) });
3635
+ }
3636
+ function SidebarNavigationList({
3637
+ activeItemId,
3638
+ items,
3639
+ onNavigate,
3640
+ revealRequest
3641
+ }) {
3642
+ const navRef = useRef(null);
3643
+ const [expandedByRoot, setExpandedByRoot] = useState({});
3644
+ const toggleRoot = (id) => {
3645
+ setExpandedByRoot((current) => ({
3646
+ ...current,
3647
+ [id]: !current[id]
3648
+ }));
3649
+ };
3650
+ useEffect(() => {
3651
+ if (!revealRequest) return;
3652
+ setExpandedByRoot((current) => ({
3653
+ ...current,
3654
+ [revealRequest.id]: true
3655
+ }));
3656
+ const frameId = window.requestAnimationFrame(() => {
3657
+ const targetElement = navRef.current?.querySelector(
3658
+ `[data-navigation-sidebar-root-id="${CSS.escape(revealRequest.id)}"]`
3659
+ );
3660
+ if (targetElement instanceof HTMLElement) {
3661
+ targetElement.scrollIntoView({ behavior: "auto", block: "nearest", inline: "nearest" });
3662
+ }
3663
+ });
3664
+ return () => window.cancelAnimationFrame(frameId);
3665
+ }, [revealRequest]);
3666
+ return /* @__PURE__ */ jsxs("div", { className: "h-full flex-1 overflow-y-auto", style: { scrollbarWidth: "none", msOverflowStyle: "none" }, children: [
3667
+ /* @__PURE__ */ jsx("style", { children: `.monkeys-navigation-sidebar-nav::-webkit-scrollbar { display: none; }` }),
3668
+ /* @__PURE__ */ jsx(
3669
+ "div",
3670
+ {
3671
+ ref: navRef,
3672
+ className: "monkeys-navigation-sidebar-nav flex w-full flex-col gap-2 text-xs text-[hsl(var(--foreground))]",
3673
+ children: items.map((item) => {
3674
+ const isGroup = Boolean(item.children?.length);
3675
+ const isExpanded = Boolean(expandedByRoot[item.id]);
3676
+ const isActive = activeItemId === item.id;
3677
+ if (isGroup) {
3678
+ return /* @__PURE__ */ jsxs("div", { "data-navigation-sidebar-root-id": item.id, children: [
3679
+ /* @__PURE__ */ jsx(
3680
+ NavButton,
3681
+ {
3682
+ icon: item.icon,
3683
+ onClick: () => toggleRoot(item.id),
3684
+ postfix: /* @__PURE__ */ jsx("div", { className: "flex flex-1 justify-end", children: /* @__PURE__ */ jsx(
3685
+ "svg",
3686
+ {
3687
+ xmlns: "http://www.w3.org/2000/svg",
3688
+ width: "16",
3689
+ height: "16",
3690
+ viewBox: "0 0 24 24",
3691
+ fill: "none",
3692
+ stroke: "currentColor",
3693
+ strokeWidth: "2",
3694
+ strokeLinecap: "round",
3695
+ strokeLinejoin: "round",
3696
+ className: "shrink-0 text-[hsl(var(--foreground))] transition-transform duration-200",
3697
+ style: { transform: isExpanded ? "rotate(90deg)" : "rotate(0deg)" },
3698
+ children: /* @__PURE__ */ jsx("path", { d: "m9 18 6-6-6-6" })
3699
+ }
3700
+ ) }),
3701
+ children: item.label
3702
+ }
3703
+ ),
3704
+ isExpanded ? /* @__PURE__ */ jsx("div", { className: "mt-1 flex flex-col gap-1", children: item.children?.map((child) => /* @__PURE__ */ jsx(
3705
+ NavButton,
3706
+ {
3707
+ active: activeItemId === child.id,
3708
+ onClick: () => onNavigate?.(child.id),
3709
+ children: child.label
3710
+ },
3711
+ child.id
3712
+ )) }) : null
3713
+ ] }, item.id);
3714
+ }
3715
+ return /* @__PURE__ */ jsx("div", { "data-navigation-sidebar-root-id": item.id, children: /* @__PURE__ */ jsx(NavButton, { active: isActive, icon: item.icon, onClick: () => onNavigate?.(item.id), children: item.label }) }, item.id);
3716
+ })
3717
+ }
3718
+ )
3719
+ ] });
3720
+ }
3721
+ function SidebarBrand({
3722
+ collapsed,
3723
+ logo,
3724
+ title
3725
+ }) {
3726
+ if (!logo) return null;
3727
+ const brandTitle = title ?? logo.title;
3728
+ const logoMark = /* @__PURE__ */ jsx(
3729
+ "div",
3730
+ {
3731
+ className: cn2(
3732
+ "flex h-9 w-9 shrink-0 items-center justify-center overflow-hidden rounded-lg",
3733
+ logo.url ? "bg-transparent" : "bg-[hsl(var(--primary))] text-[hsl(var(--primary-foreground))]"
3734
+ ),
3735
+ children: logo.url ? /* @__PURE__ */ jsx("img", { src: logo.url, alt: logo.title, className: "h-full w-full object-contain" }) : /* @__PURE__ */ jsx("span", { className: "text-sm font-bold", children: logo.title.charAt(0) })
3736
+ }
3737
+ );
3738
+ if (collapsed) {
3739
+ return /* @__PURE__ */ jsx(
3740
+ BaseTooltip,
3741
+ {
3742
+ appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
3743
+ content: brandTitle,
3744
+ placement: "right",
3745
+ children: /* @__PURE__ */ jsx(
3746
+ BaseButton,
3747
+ {
3748
+ appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
3749
+ ariaLabel: typeof brandTitle === "string" ? brandTitle : logo.title,
3750
+ className: "h-10 w-10 rounded-lg border-transparent bg-transparent p-0 shadow-none hover:bg-[hsl(var(--muted))]/60",
3751
+ icon: logoMark,
3752
+ iconOnly: true,
3753
+ onClick: logo.onClick,
3754
+ title: typeof brandTitle === "string" ? brandTitle : logo.title,
3755
+ tone: "muted"
3756
+ }
3757
+ )
3758
+ }
3759
+ );
3760
+ }
3761
+ return /* @__PURE__ */ jsx(
3762
+ BaseButton,
3763
+ {
3764
+ appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
3765
+ ariaLabel: logo.title,
3766
+ className: "h-auto w-full justify-start gap-3 border-transparent bg-transparent p-0 text-left shadow-none hover:bg-transparent",
3767
+ classNames: { icon: "h-9 w-9" },
3768
+ icon: logoMark,
3769
+ label: /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate text-sm font-semibold text-[hsl(var(--foreground))]", children: brandTitle }),
3770
+ onClick: logo.onClick,
3771
+ title: typeof brandTitle === "string" ? brandTitle : logo.title,
3772
+ tone: "muted"
3773
+ }
3774
+ );
3775
+ }
3776
+ function Sidebar({
3777
+ accountMenu,
3778
+ activeItemId,
3779
+ actions = [],
3780
+ collapsed,
3781
+ collapsedAccountMenu,
3782
+ footer,
3783
+ header,
3784
+ items,
3785
+ logo,
3786
+ onCollapsedChange,
3787
+ onNavigate,
3788
+ onRevealRoot,
3789
+ revealRequest,
3790
+ title
3791
+ }) {
3792
+ if (collapsed) {
3793
+ const activeRootId = findNavigationRootId(items, activeItemId);
3794
+ return /* @__PURE__ */ jsxs("div", { className: "flex h-full min-h-0 w-full flex-col rounded-xl border border-[hsl(var(--input))] bg-[hsl(var(--background))] p-2 shadow-sm", children: [
3795
+ /* @__PURE__ */ jsx("div", { className: "mb-3 flex shrink-0 justify-center", children: header ?? /* @__PURE__ */ jsx(SidebarBrand, { collapsed: true, logo, title }) }),
3796
+ /* @__PURE__ */ jsx(
3797
+ "div",
3798
+ {
3799
+ className: "flex min-h-0 flex-1 flex-col items-center gap-2 overflow-y-auto pb-3",
3800
+ style: { scrollbarWidth: "none", msOverflowStyle: "none" },
3801
+ children: items.map((item) => {
3802
+ const isActive = activeRootId === item.id;
3803
+ return /* @__PURE__ */ jsx(
3804
+ BaseTooltip,
3805
+ {
3806
+ appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
3807
+ content: item.label,
3808
+ placement: "right",
3809
+ children: /* @__PURE__ */ jsx(
3810
+ BaseButton,
3811
+ {
3812
+ appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
3813
+ tone: "muted",
3814
+ active: isActive,
3815
+ iconOnly: true,
3816
+ icon: item.icon,
3817
+ onClick: () => {
3818
+ onRevealRoot?.(item.id);
3819
+ onCollapsedChange?.(false);
3820
+ if (item.children?.length) return;
3821
+ onNavigate?.(item.id);
3822
+ },
3823
+ title: typeof item.label === "string" ? item.label : void 0,
3824
+ ariaLabel: typeof item.label === "string" ? item.label : item.id,
3825
+ className: cn2(
3826
+ "h-10 w-10 rounded-lg border text-[hsl(var(--muted-foreground))] shadow-none",
3827
+ "hover:-translate-y-0.5 active:translate-y-0 active:scale-[0.96]",
3828
+ isActive ? "border-[hsl(var(--input))] bg-[hsl(var(--muted))] text-[hsl(var(--foreground))] shadow-sm" : "border-transparent hover:border-[hsl(var(--input))]/80 hover:bg-[hsl(var(--muted))]/70 hover:text-[hsl(var(--foreground))]"
3829
+ )
3830
+ }
3831
+ )
3832
+ },
3833
+ item.id
3834
+ );
3835
+ })
3836
+ }
3837
+ ),
3838
+ /* @__PURE__ */ jsxs("div", { className: "-mx-2 mt-2 border-t border-[hsl(var(--input))] bg-[hsl(var(--background))] px-2 pt-2.5 pb-0.5", children: [
3839
+ /* @__PURE__ */ jsx(NavigationLayoutActionButtons, { actions, compact: true }),
3840
+ collapsedAccountMenu ? /* @__PURE__ */ jsx("div", { className: "mt-2 flex justify-center border-t border-[hsl(var(--input))] pt-2", children: collapsedAccountMenu }) : null
3841
+ ] })
3842
+ ] });
3843
+ }
3844
+ return /* @__PURE__ */ jsxs("div", { className: "flex h-full min-h-0 w-full flex-col justify-between gap-0 overflow-y-hidden rounded-xl border border-[hsl(var(--input))] bg-[hsl(var(--background))] px-5 pt-5 pb-1.5", children: [
3845
+ /* @__PURE__ */ jsx("div", { className: "mb-4 shrink-0", children: header ?? /* @__PURE__ */ jsx(SidebarBrand, { logo, title }) }),
3846
+ /* @__PURE__ */ jsx(
3847
+ SidebarNavigationList,
3848
+ {
3849
+ activeItemId,
3850
+ items,
3851
+ onNavigate,
3852
+ revealRequest
3853
+ }
3854
+ ),
3855
+ /* @__PURE__ */ jsxs("div", { className: "-mx-5 mt-2 border-t border-[hsl(var(--input))] bg-[hsl(var(--background))] px-4 pt-2.5 pb-1", children: [
3856
+ /* @__PURE__ */ jsx(NavigationLayoutActionButtons, { actions, compact: false }),
3857
+ footer,
3858
+ accountMenu ? /* @__PURE__ */ jsx("div", { className: "mt-2 border-t border-[hsl(var(--input))] pt-2", children: accountMenu }) : null
3859
+ ] })
3860
+ ] });
3861
+ }
3862
+ function HeadbarChevronIcon({ open }) {
3863
+ return /* @__PURE__ */ jsx(
3864
+ "svg",
3865
+ {
3866
+ "aria-hidden": "true",
3867
+ className: cn2("h-4 w-4 shrink-0 transition-transform duration-200", open && "rotate-180"),
3868
+ viewBox: "0 0 24 24",
3869
+ fill: "none",
3870
+ stroke: "currentColor",
3871
+ strokeWidth: "2",
3872
+ strokeLinecap: "round",
3873
+ strokeLinejoin: "round",
3874
+ children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" })
3875
+ }
3876
+ );
3877
+ }
3878
+ function HeadbarNavMenuItem({
3879
+ activeItemId,
3880
+ isActive,
3881
+ item,
3882
+ label,
3883
+ menuButtonRadiusClass,
3884
+ menuContentRadiusClass,
3885
+ menuItemRadiusClass,
3886
+ onNavigate
3887
+ }) {
3888
+ const [open, setOpen] = useState(false);
3889
+ const closeTimerRef = useRef(null);
3890
+ const clearCloseTimer = () => {
3891
+ if (!closeTimerRef.current) return;
3892
+ clearTimeout(closeTimerRef.current);
3893
+ closeTimerRef.current = null;
3894
+ };
3895
+ const openMenu = () => {
3896
+ clearCloseTimer();
3897
+ setOpen(true);
3898
+ };
3899
+ const scheduleCloseMenu = () => {
3900
+ clearCloseTimer();
3901
+ closeTimerRef.current = setTimeout(() => {
3902
+ setOpen(false);
3903
+ closeTimerRef.current = null;
3904
+ }, 120);
3905
+ };
3906
+ useEffect(() => clearCloseTimer, []);
3907
+ return /* @__PURE__ */ jsxs(DropdownMenu.Root, { modal: false, open, onOpenChange: setOpen, children: [
3908
+ /* @__PURE__ */ jsx(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(
3909
+ BaseButton,
3910
+ {
3911
+ appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
3912
+ tone: "muted",
3913
+ active: isActive || open,
3914
+ icon: item.icon,
3915
+ endIcon: /* @__PURE__ */ jsx(HeadbarChevronIcon, { open }),
3916
+ label: /* @__PURE__ */ jsx("span", { className: "truncate whitespace-nowrap", children: label }),
3917
+ onClick: () => setOpen(true),
3918
+ onMouseEnter: openMenu,
3919
+ onMouseLeave: scheduleCloseMenu,
3920
+ className: cn2(
3921
+ "h-9 max-w-[12rem] border-transparent !bg-transparent px-3 text-sm font-medium shadow-none",
3922
+ menuButtonRadiusClass,
3923
+ isActive || open ? "!bg-[hsl(var(--muted))] text-[hsl(var(--foreground))]" : "text-[hsl(var(--muted-foreground))] hover:!bg-[hsl(var(--muted))]/60 hover:text-[hsl(var(--foreground))]"
3924
+ )
3925
+ }
3926
+ ) }),
3927
+ /* @__PURE__ */ jsx(DropdownMenu.Portal, { children: /* @__PURE__ */ jsx(
3928
+ DropdownMenu.Content,
3929
+ {
3930
+ align: "start",
3931
+ sideOffset: 5,
3932
+ onCloseAutoFocus: (event) => event.preventDefault(),
3933
+ onMouseEnter: openMenu,
3934
+ onMouseLeave: scheduleCloseMenu,
3935
+ className: cn2(
3936
+ "z-50 min-w-56 border border-[hsl(var(--border))] bg-[hsl(var(--popover))] p-1.5 text-[hsl(var(--popover-foreground))] shadow-md animate-in fade-in-0 zoom-in-95",
3937
+ menuContentRadiusClass
3938
+ ),
3939
+ children: item.children?.map((child) => /* @__PURE__ */ jsxs(
3940
+ DropdownMenu.Item,
3941
+ {
3942
+ className: cn2(
3943
+ "relative flex cursor-pointer select-none items-center gap-2.5 px-3 py-2 text-sm outline-none transition-colors hover:bg-[hsl(var(--accent))]",
3944
+ menuItemRadiusClass,
3945
+ child.id === activeItemId && "bg-[hsl(var(--muted))] text-[hsl(var(--foreground))]"
3946
+ ),
3947
+ onSelect: () => {
3948
+ setOpen(false);
3949
+ onNavigate?.(child.id);
3950
+ },
3951
+ children: [
3952
+ child.icon ? /* @__PURE__ */ jsx("span", { className: "inline-flex h-4 w-4 shrink-0 items-center justify-center text-[hsl(var(--muted-foreground))]", children: child.icon }) : null,
3953
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: child.headbarLabel ?? child.label })
3954
+ ]
3955
+ },
3956
+ child.id
3957
+ ))
3958
+ }
3959
+ ) })
3960
+ ] });
3961
+ }
3962
+ function HeadbarNav({
3963
+ activeItemId,
3964
+ activeRootId,
3965
+ items,
3966
+ menuRadius,
3967
+ onNavigate
3968
+ }) {
3969
+ const menuButtonRadiusClass = getHeadbarMenuRadiusClass(menuRadius);
3970
+ const menuContentRadiusClass = getHeadbarMenuRadiusClass(menuRadius);
3971
+ const menuItemRadiusClass = getHeadbarMenuRadiusClass(menuRadius);
3972
+ return /* @__PURE__ */ jsx("div", { className: "flex min-w-0 items-center gap-1", children: items.map((item) => {
3973
+ const isActive = activeRootId === item.id || activeItemId === item.id;
3974
+ const label = item.headbarLabel ?? item.label;
3975
+ if (item.children?.length) {
3976
+ return /* @__PURE__ */ jsx(
3977
+ HeadbarNavMenuItem,
3978
+ {
3979
+ activeItemId,
3980
+ isActive,
3981
+ item,
3982
+ label,
3983
+ menuButtonRadiusClass,
3984
+ menuContentRadiusClass,
3985
+ menuItemRadiusClass,
3986
+ onNavigate
3987
+ },
3988
+ item.id
3989
+ );
3990
+ }
3991
+ return /* @__PURE__ */ jsx(
3992
+ BaseButton,
3993
+ {
3994
+ appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
3995
+ tone: "muted",
3996
+ active: isActive,
3997
+ icon: item.icon,
3998
+ label: /* @__PURE__ */ jsx("span", { className: "truncate whitespace-nowrap", children: label }),
3999
+ onClick: () => onNavigate?.(item.id),
4000
+ className: cn2(
4001
+ "h-9 max-w-[12rem] border-transparent !bg-transparent px-3 text-sm font-medium shadow-none",
4002
+ menuButtonRadiusClass,
4003
+ isActive ? "!bg-[hsl(var(--muted))] text-[hsl(var(--foreground))]" : "text-[hsl(var(--muted-foreground))] hover:!bg-[hsl(var(--muted))]/60 hover:text-[hsl(var(--foreground))]"
4004
+ )
4005
+ },
4006
+ item.id
4007
+ );
4008
+ }) });
4009
+ }
4010
+ function Headbar({
4011
+ activeItemId,
4012
+ activeRootId,
4013
+ actions,
4014
+ accountMenu,
4015
+ extra,
4016
+ layout,
4017
+ logo,
4018
+ navItems,
4019
+ onNavigate
4020
+ }) {
4021
+ const heightPx = clampHeadbarHeight(layout?.heightPx);
4022
+ const layoutMode = layout?.layoutMode ?? "boxed";
4023
+ const menuRadius = layout?.menuRadius ?? "default";
4024
+ const logoHeightPx = getHeadbarLogoSizePx(heightPx);
4025
+ const frameStyle = getHeadbarFrameStyle(layoutMode, heightPx);
4026
+ const showBrandTitle = Boolean(layout?.brandTitle);
4027
+ return /* @__PURE__ */ jsxs("header", { className: getHeadbarFrameClass(layoutMode), style: frameStyle, children: [
4028
+ /* @__PURE__ */ jsx("div", { className: "flex min-w-0 items-center justify-start", children: logo ? /* @__PURE__ */ jsx(
4029
+ BaseButton,
4030
+ {
4031
+ appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
4032
+ tone: "muted",
4033
+ icon: /* @__PURE__ */ jsx(
4034
+ "div",
4035
+ {
4036
+ className: cn2(
4037
+ "flex items-center justify-center overflow-hidden rounded-lg",
4038
+ logo.url ? "w-auto max-w-[min(22rem,30vw)] bg-transparent" : "bg-[hsl(var(--primary))] text-[hsl(var(--primary-foreground))]"
4039
+ ),
4040
+ style: logo.url ? { height: logoHeightPx } : { width: logoHeightPx, height: logoHeightPx },
4041
+ children: logo.url ? /* @__PURE__ */ jsx("img", { src: logo.url, alt: logo.title, className: "block h-full w-auto object-contain" }) : /* @__PURE__ */ jsx("span", { className: "text-base font-bold", children: logo.title.charAt(0) })
4042
+ }
4043
+ ),
4044
+ label: showBrandTitle ? /* @__PURE__ */ jsx("span", { className: "truncate whitespace-nowrap text-base font-medium text-[hsl(var(--foreground))]", children: layout?.brandTitle }) : null,
4045
+ ariaLabel: logo.title,
4046
+ title: logo.title,
4047
+ className: "h-auto min-w-0 justify-start border-transparent bg-transparent p-0 shadow-none hover:bg-transparent",
4048
+ classNames: logo.url ? { icon: "!h-auto !w-auto shrink-0" } : void 0,
4049
+ onClick: logo.onClick
4050
+ }
4051
+ ) : null }),
4052
+ /* @__PURE__ */ jsx("div", { className: cn2("flex min-w-0 items-center", getHeadbarNavClass(layout?.navPosition)), children: /* @__PURE__ */ jsx("div", { className: "no-scrollbar flex max-w-full min-w-0 items-center overflow-x-auto overscroll-x-contain", children: /* @__PURE__ */ jsx(
4053
+ HeadbarNav,
4054
+ {
4055
+ activeItemId,
4056
+ activeRootId,
4057
+ items: navItems,
4058
+ menuRadius,
4059
+ onNavigate
4060
+ }
4061
+ ) }) }),
4062
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center justify-end gap-3", children: [
4063
+ actions,
4064
+ extra,
4065
+ accountMenu
4066
+ ] })
4067
+ ] });
4068
+ }
4069
+ function NavigationLayout({
4070
+ activeItemId,
4071
+ activeRootId,
4072
+ allowModeSwitch = false,
4073
+ accountMenu,
4074
+ children,
4075
+ className,
4076
+ collapsedSidebarAccountMenu,
4077
+ collapsedSidebarWidth = NAVIGATION_LAYOUT_SIDEBAR_COLLAPSED_WIDTH,
4078
+ defaultMode = "headbar",
4079
+ defaultSidebarCollapsed = false,
4080
+ expandedSidebarWidth = NAVIGATION_LAYOUT_SIDEBAR_EXPANDED_WIDTH,
4081
+ flush = false,
4082
+ headbarActions,
4083
+ headbarLayout,
4084
+ logo,
4085
+ mode,
4086
+ navItems,
4087
+ onModeChange,
4088
+ onNavigate,
4089
+ onSidebarCollapsedChange,
4090
+ renderHeadbarExtra,
4091
+ sidebarAccountMenu,
4092
+ sidebarFooter,
4093
+ sidebarHeader,
4094
+ switchToHeadbarLabel = "Switch to headbar",
4095
+ switchToSidebarLabel = "Switch to sidebar"
4096
+ }) {
4097
+ const [uncontrolledMode, setUncontrolledMode] = useState(defaultMode);
4098
+ const [sidebarCollapsed, setSidebarCollapsed] = useState(defaultSidebarCollapsed);
4099
+ const [revealRequest, setRevealRequest] = useState(null);
4100
+ const isModeControlled = mode !== void 0;
4101
+ const navigationMode = isModeControlled ? mode : uncontrolledMode;
4102
+ const isHeadbarMode = navigationMode === "headbar";
4103
+ const sidebarWidth = sidebarCollapsed ? collapsedSidebarWidth : expandedSidebarWidth;
4104
+ useEffect(() => {
4105
+ if (!isModeControlled) {
4106
+ setUncontrolledMode(defaultMode);
4107
+ }
4108
+ }, [defaultMode, isModeControlled]);
4109
+ const setNavigationMode = (nextMode) => {
4110
+ if (!isModeControlled) {
4111
+ setUncontrolledMode(nextMode);
4112
+ }
4113
+ onModeChange?.(nextMode);
4114
+ };
4115
+ const setCollapsed = (collapsed) => {
4116
+ setSidebarCollapsed(collapsed);
4117
+ onSidebarCollapsedChange?.(collapsed);
4118
+ };
4119
+ const navigationActions = [];
4120
+ if (allowModeSwitch) {
4121
+ navigationActions.push({
4122
+ id: "toggle-headbar",
4123
+ label: switchToHeadbarLabel,
4124
+ onClick: () => setNavigationMode("headbar"),
4125
+ icon: /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-[18px] w-[18px] rotate-180", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", children: [
4126
+ /* @__PURE__ */ jsx("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
4127
+ /* @__PURE__ */ jsx("path", { d: "M3 9h18" })
4128
+ ] })
4129
+ });
4130
+ }
4131
+ navigationActions.push({
4132
+ id: "toggle-sidebar",
4133
+ label: sidebarCollapsed ? "Expand sidebar" : "Collapse sidebar",
4134
+ onClick: () => setCollapsed(!sidebarCollapsed),
4135
+ icon: /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-[18px] w-[18px]", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", children: [
4136
+ /* @__PURE__ */ jsx("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
4137
+ /* @__PURE__ */ jsx("path", { d: "M9 3v18" }),
4138
+ /* @__PURE__ */ jsx("path", { d: sidebarCollapsed ? "m14 9 3 3-3 3" : "m16 15-3-3 3-3" })
4139
+ ] })
4140
+ });
4141
+ const sidebar = isHeadbarMode ? null : /* @__PURE__ */ jsx(
4142
+ "div",
4143
+ {
4144
+ className: "relative h-full min-h-0 shrink-0 overflow-hidden transition-[width] duration-260",
4145
+ style: { width: sidebarWidth, transitionTimingFunction: NAVIGATION_LAYOUT_TRANSITION_TIMING },
4146
+ children: /* @__PURE__ */ jsx(
4147
+ Sidebar,
4148
+ {
4149
+ accountMenu: sidebarAccountMenu ?? accountMenu,
4150
+ activeItemId,
4151
+ actions: navigationActions,
4152
+ collapsed: sidebarCollapsed,
4153
+ collapsedAccountMenu: collapsedSidebarAccountMenu ?? accountMenu,
4154
+ footer: sidebarFooter,
4155
+ header: sidebarHeader,
4156
+ items: navItems,
4157
+ logo,
4158
+ onCollapsedChange: setCollapsed,
4159
+ onNavigate,
4160
+ onRevealRoot: (rootId) => setRevealRequest((prev) => ({ id: rootId, nonce: (prev?.nonce ?? 0) + 1 })),
4161
+ revealRequest,
4162
+ title: headbarLayout?.brandTitle
4163
+ }
4164
+ )
4165
+ }
4166
+ );
4167
+ const header = isHeadbarMode ? /* @__PURE__ */ jsx(
4168
+ Headbar,
4169
+ {
4170
+ activeItemId,
4171
+ activeRootId: activeRootId ?? findNavigationRootId(navItems, activeItemId),
4172
+ actions: allowModeSwitch ? /* @__PURE__ */ jsxs(Fragment, { children: [
4173
+ headbarActions,
4174
+ /* @__PURE__ */ jsx(
4175
+ BaseButton,
4176
+ {
4177
+ appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
4178
+ tone: "muted",
4179
+ icon: /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-4 w-4 shrink-0", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", children: [
4180
+ /* @__PURE__ */ jsx("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
4181
+ /* @__PURE__ */ jsx("path", { d: "M9 3v18" }),
4182
+ /* @__PURE__ */ jsx("path", { d: "m14 9 3 3-3 3" })
4183
+ ] }),
4184
+ label: /* @__PURE__ */ jsx("span", { className: "truncate whitespace-nowrap", children: switchToSidebarLabel }),
4185
+ onClick: () => setNavigationMode("sidebar"),
4186
+ className: cn2(
4187
+ "h-auto min-w-0 shrink px-3 py-2 text-sm font-medium text-[hsl(var(--muted-foreground))] shadow-none hover:border-[hsl(var(--input))]/70 hover:bg-[hsl(var(--muted))]/60 hover:text-[hsl(var(--foreground))]",
4188
+ getHeadbarMenuRadiusClass(headbarLayout?.menuRadius)
4189
+ )
4190
+ }
4191
+ )
4192
+ ] }) : headbarActions,
4193
+ accountMenu,
4194
+ extra: renderHeadbarExtra,
4195
+ layout: headbarLayout,
4196
+ logo,
4197
+ navItems,
4198
+ onNavigate
4199
+ }
4200
+ ) : null;
4201
+ return /* @__PURE__ */ jsx(AppLayout, { header, sidebar, flush, className, children });
4202
+ }
292
4203
 
293
- export { AppHeader, AppLayout, AppSidebar, NavButton, cn };
4204
+ export { AppHeader, AppLayout, AppSidebar, NavButton, NavigationLayout, UserAccountMenu, cn2 as cn };
294
4205
  //# sourceMappingURL=index.mjs.map
295
4206
  //# sourceMappingURL=index.mjs.map