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