@classic-homes/theme-react 0.1.52 → 0.1.54
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/index.css +12 -10
- package/dist/index.d.mts +767 -56
- package/dist/index.d.ts +767 -56
- package/dist/index.js +1509 -239
- package/dist/index.mjs +1505 -255
- package/package.json +14 -4
package/dist/index.js
CHANGED
|
@@ -58,9 +58,18 @@ __export(index_exports, {
|
|
|
58
58
|
DialogTrigger: () => DialogTrigger,
|
|
59
59
|
Input: () => Input,
|
|
60
60
|
Label: () => Label,
|
|
61
|
+
LiveRegion: () => LiveRegion,
|
|
62
|
+
LoadingLogo: () => LoadingLogo,
|
|
63
|
+
LoadingOverlay: () => LoadingOverlay,
|
|
64
|
+
LoadingPage: () => LoadingPage,
|
|
65
|
+
LoadingSection: () => LoadingSection,
|
|
61
66
|
PageHeader: () => PageHeader,
|
|
62
67
|
PasswordInput: () => PasswordInput,
|
|
68
|
+
ProgressBar: () => ProgressBar,
|
|
63
69
|
Separator: () => Separator,
|
|
70
|
+
Skeleton: () => Skeleton,
|
|
71
|
+
SkipLink: () => SkipLink,
|
|
72
|
+
Spinner: () => Spinner,
|
|
64
73
|
Switch: () => Switch,
|
|
65
74
|
badgeVariants: () => badgeVariants,
|
|
66
75
|
buttonVariants: () => buttonVariants,
|
|
@@ -69,7 +78,18 @@ __export(index_exports, {
|
|
|
69
78
|
pageHeaderContainerVariants: () => pageHeaderContainerVariants,
|
|
70
79
|
pageHeaderSubtitleVariants: () => pageHeaderSubtitleVariants,
|
|
71
80
|
pageHeaderTitleVariants: () => pageHeaderTitleVariants,
|
|
72
|
-
|
|
81
|
+
progressBarVariants: () => progressBarVariants,
|
|
82
|
+
skeletonVariants: () => skeletonVariants,
|
|
83
|
+
spinnerVariants: () => spinnerVariants,
|
|
84
|
+
useAnnounce: () => useAnnounce,
|
|
85
|
+
useArrowNavigation: () => useArrowNavigation,
|
|
86
|
+
useClickOutside: () => useClickOutside,
|
|
87
|
+
useDataPanel: () => useDataPanel,
|
|
88
|
+
useEscapeKey: () => useEscapeKey,
|
|
89
|
+
useFocusRef: () => useFocusRef,
|
|
90
|
+
useFocusTrap: () => useFocusTrap,
|
|
91
|
+
useReducedMotion: () => useReducedMotion,
|
|
92
|
+
useRovingTabindex: () => useRovingTabindex
|
|
73
93
|
});
|
|
74
94
|
module.exports = __toCommonJS(index_exports);
|
|
75
95
|
|
|
@@ -89,20 +109,21 @@ function cn(...inputs) {
|
|
|
89
109
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
90
110
|
var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
91
111
|
// Base styles - using semantic color system
|
|
92
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-
|
|
112
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
93
113
|
{
|
|
94
114
|
variants: {
|
|
95
115
|
variant: {
|
|
96
116
|
default: "bg-primary text-primary-foreground shadow hover:bg-primary-hover",
|
|
97
117
|
secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary-hover",
|
|
98
|
-
destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive-hover",
|
|
99
|
-
outline: "border border-
|
|
100
|
-
ghost: "hover:bg-
|
|
118
|
+
destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive-hover focus-visible:ring-destructive",
|
|
119
|
+
outline: "border-2 border-primary text-primary bg-transparent hover:bg-primary hover:text-primary-foreground",
|
|
120
|
+
ghost: "hover:bg-muted-hover hover:text-foreground",
|
|
101
121
|
link: "text-primary underline-offset-4 hover:underline"
|
|
102
122
|
},
|
|
103
123
|
size: {
|
|
104
124
|
default: "h-10 px-4 py-2",
|
|
105
|
-
sm: "h-9 rounded-md px-3 text-
|
|
125
|
+
sm: "h-9 rounded-md px-3 text-sm",
|
|
126
|
+
md: "h-10 px-4 py-2",
|
|
106
127
|
lg: "h-11 rounded-md px-8",
|
|
107
128
|
icon: "h-10 w-10"
|
|
108
129
|
}
|
|
@@ -114,9 +135,9 @@ var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
|
114
135
|
}
|
|
115
136
|
);
|
|
116
137
|
var Button = React.forwardRef(
|
|
117
|
-
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
138
|
+
({ className, variant, size, asChild = false, children, ...props }, ref) => {
|
|
118
139
|
const Comp = asChild ? import_react_slot.Slot : "button";
|
|
119
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Comp, { className: cn(buttonVariants({ variant, size, className })), ref, ...props });
|
|
140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Comp, { className: cn(buttonVariants({ variant, size, className })), ref, ...props, children });
|
|
120
141
|
}
|
|
121
142
|
);
|
|
122
143
|
Button.displayName = "Button";
|
|
@@ -125,8 +146,8 @@ Button.displayName = "Button";
|
|
|
125
146
|
var React2 = __toESM(require("react"));
|
|
126
147
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
127
148
|
var Card = React2.forwardRef(
|
|
128
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
129
|
-
|
|
149
|
+
({ className, as: Component = "div", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
150
|
+
Component,
|
|
130
151
|
{
|
|
131
152
|
ref,
|
|
132
153
|
className: cn(
|
|
@@ -143,8 +164,8 @@ var CardHeader = React2.forwardRef(
|
|
|
143
164
|
);
|
|
144
165
|
CardHeader.displayName = "CardHeader";
|
|
145
166
|
var CardTitle = React2.forwardRef(
|
|
146
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
147
|
-
|
|
167
|
+
({ className, as: Component = "h3", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
168
|
+
Component,
|
|
148
169
|
{
|
|
149
170
|
ref,
|
|
150
171
|
className: cn("text-2xl font-semibold leading-none tracking-tight", className),
|
|
@@ -168,13 +189,32 @@ CardFooter.displayName = "CardFooter";
|
|
|
168
189
|
var React3 = __toESM(require("react"));
|
|
169
190
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
170
191
|
var Input = React3.forwardRef(
|
|
171
|
-
({
|
|
192
|
+
({
|
|
193
|
+
className,
|
|
194
|
+
type,
|
|
195
|
+
"aria-invalid": ariaInvalid,
|
|
196
|
+
required,
|
|
197
|
+
"aria-describedby": ariaDescribedBy,
|
|
198
|
+
...props
|
|
199
|
+
}, ref) => {
|
|
200
|
+
if (process.env.NODE_ENV !== "production") {
|
|
201
|
+
if (!props["aria-label"] && !props["aria-labelledby"] && !props.id) {
|
|
202
|
+
console.warn(
|
|
203
|
+
"Input: Missing accessible label. Provide aria-label, aria-labelledby, or associate with a Label using id/htmlFor for WCAG compliance."
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
172
207
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
173
208
|
"input",
|
|
174
209
|
{
|
|
175
210
|
type,
|
|
211
|
+
"aria-invalid": ariaInvalid,
|
|
212
|
+
"aria-required": required,
|
|
213
|
+
"aria-describedby": ariaDescribedBy,
|
|
214
|
+
required,
|
|
176
215
|
className: cn(
|
|
177
216
|
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
217
|
+
ariaInvalid === true || ariaInvalid === "true" ? "border-destructive focus-visible:ring-destructive" : "",
|
|
178
218
|
className
|
|
179
219
|
),
|
|
180
220
|
ref,
|
|
@@ -186,7 +226,57 @@ var Input = React3.forwardRef(
|
|
|
186
226
|
Input.displayName = "Input";
|
|
187
227
|
|
|
188
228
|
// src/components/PasswordInput.tsx
|
|
229
|
+
var React5 = __toESM(require("react"));
|
|
230
|
+
|
|
231
|
+
// src/hooks/useAnnounce.ts
|
|
189
232
|
var React4 = __toESM(require("react"));
|
|
233
|
+
function useAnnounce(defaultOptions) {
|
|
234
|
+
const [message, setMessage] = React4.useState("");
|
|
235
|
+
const [politeness, setPoliteness] = React4.useState(
|
|
236
|
+
defaultOptions?.politeness ?? "polite"
|
|
237
|
+
);
|
|
238
|
+
const clearTimeoutRef = React4.useRef(null);
|
|
239
|
+
const clear = React4.useCallback(() => {
|
|
240
|
+
setMessage("");
|
|
241
|
+
if (clearTimeoutRef.current) {
|
|
242
|
+
clearTimeout(clearTimeoutRef.current);
|
|
243
|
+
clearTimeoutRef.current = null;
|
|
244
|
+
}
|
|
245
|
+
}, []);
|
|
246
|
+
const announce = React4.useCallback(
|
|
247
|
+
(newMessage, options) => {
|
|
248
|
+
if (clearTimeoutRef.current) {
|
|
249
|
+
clearTimeout(clearTimeoutRef.current);
|
|
250
|
+
}
|
|
251
|
+
if (options?.politeness) {
|
|
252
|
+
setPoliteness(options.politeness);
|
|
253
|
+
}
|
|
254
|
+
setMessage(newMessage);
|
|
255
|
+
const delay = options?.clearDelay ?? defaultOptions?.clearDelay ?? 1e3;
|
|
256
|
+
if (delay > 0) {
|
|
257
|
+
clearTimeoutRef.current = setTimeout(() => {
|
|
258
|
+
setMessage("");
|
|
259
|
+
}, delay);
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
[defaultOptions?.clearDelay]
|
|
263
|
+
);
|
|
264
|
+
React4.useEffect(() => {
|
|
265
|
+
return () => {
|
|
266
|
+
if (clearTimeoutRef.current) {
|
|
267
|
+
clearTimeout(clearTimeoutRef.current);
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
}, []);
|
|
271
|
+
return {
|
|
272
|
+
announce,
|
|
273
|
+
message,
|
|
274
|
+
politeness,
|
|
275
|
+
clear
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// src/components/PasswordInput.tsx
|
|
190
280
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
191
281
|
var EyeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
192
282
|
"svg",
|
|
@@ -199,6 +289,8 @@ var EyeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
|
199
289
|
strokeWidth: 2,
|
|
200
290
|
strokeLinecap: "round",
|
|
201
291
|
strokeLinejoin: "round",
|
|
292
|
+
"aria-hidden": "true",
|
|
293
|
+
focusable: "false",
|
|
202
294
|
children: [
|
|
203
295
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
|
|
204
296
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { cx: "12", cy: "12", r: "3" })
|
|
@@ -216,20 +308,48 @@ var EyeOffIcon = () => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
|
216
308
|
strokeWidth: 2,
|
|
217
309
|
strokeLinecap: "round",
|
|
218
310
|
strokeLinejoin: "round",
|
|
311
|
+
"aria-hidden": "true",
|
|
312
|
+
focusable: "false",
|
|
219
313
|
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24M1 1l22 22" })
|
|
220
314
|
}
|
|
221
315
|
);
|
|
222
|
-
var PasswordInput =
|
|
223
|
-
({
|
|
224
|
-
|
|
316
|
+
var PasswordInput = React5.forwardRef(
|
|
317
|
+
({
|
|
318
|
+
className,
|
|
319
|
+
disabled,
|
|
320
|
+
showLabel = "Show password",
|
|
321
|
+
hideLabel = "Hide password",
|
|
322
|
+
visibleAnnouncement = "Password is now visible",
|
|
323
|
+
hiddenAnnouncement = "Password is now hidden",
|
|
324
|
+
id,
|
|
325
|
+
"aria-label": ariaLabel,
|
|
326
|
+
"aria-labelledby": ariaLabelledBy,
|
|
327
|
+
...props
|
|
328
|
+
}, ref) => {
|
|
329
|
+
const [showPassword, setShowPassword] = React5.useState(false);
|
|
330
|
+
const { announce, message, politeness } = useAnnounce();
|
|
331
|
+
if (process.env.NODE_ENV !== "production") {
|
|
332
|
+
if (!ariaLabel && !ariaLabelledBy && !id) {
|
|
333
|
+
console.warn(
|
|
334
|
+
"PasswordInput: Missing accessible label. Provide aria-label, aria-labelledby, or an id to associate with a Label element for WCAG compliance."
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
225
338
|
const toggleVisibility = () => {
|
|
226
|
-
setShowPassword((prev) =>
|
|
339
|
+
setShowPassword((prev) => {
|
|
340
|
+
const newState = !prev;
|
|
341
|
+
announce(newState ? visibleAnnouncement : hiddenAnnouncement);
|
|
342
|
+
return newState;
|
|
343
|
+
});
|
|
227
344
|
};
|
|
228
345
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "relative", children: [
|
|
229
346
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
230
347
|
"input",
|
|
231
348
|
{
|
|
232
349
|
type: showPassword ? "text" : "password",
|
|
350
|
+
id,
|
|
351
|
+
"aria-label": ariaLabel,
|
|
352
|
+
"aria-labelledby": ariaLabelledBy,
|
|
233
353
|
className: cn(
|
|
234
354
|
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 pr-10 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
235
355
|
className
|
|
@@ -243,140 +363,223 @@ var PasswordInput = React4.forwardRef(
|
|
|
243
363
|
"button",
|
|
244
364
|
{
|
|
245
365
|
type: "button",
|
|
246
|
-
className: "absolute right-0 top-0 h-
|
|
366
|
+
className: "absolute right-0 top-0 h-11 w-11 -mr-0.5 -mt-0.5 flex items-center justify-center text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background rounded-r-md disabled:pointer-events-none disabled:opacity-50",
|
|
247
367
|
onClick: toggleVisibility,
|
|
248
368
|
disabled,
|
|
249
369
|
"aria-label": showPassword ? hideLabel : showLabel,
|
|
370
|
+
"aria-pressed": showPassword,
|
|
250
371
|
children: showPassword ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(EyeOffIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(EyeIcon, {})
|
|
251
372
|
}
|
|
252
|
-
)
|
|
373
|
+
),
|
|
374
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { role: "status", "aria-live": politeness, "aria-atomic": "true", className: "sr-only", children: message })
|
|
253
375
|
] });
|
|
254
376
|
}
|
|
255
377
|
);
|
|
256
378
|
PasswordInput.displayName = "PasswordInput";
|
|
257
379
|
|
|
258
380
|
// src/components/Label.tsx
|
|
259
|
-
var
|
|
381
|
+
var React6 = __toESM(require("react"));
|
|
260
382
|
var LabelPrimitive = __toESM(require("@radix-ui/react-label"));
|
|
261
383
|
var import_class_variance_authority2 = require("class-variance-authority");
|
|
262
384
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
263
385
|
var labelVariants = (0, import_class_variance_authority2.cva)(
|
|
264
386
|
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
265
387
|
);
|
|
266
|
-
var Label =
|
|
388
|
+
var Label = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LabelPrimitive.Root, { ref, className: cn(labelVariants(), className), ...props }));
|
|
267
389
|
Label.displayName = LabelPrimitive.Root.displayName;
|
|
268
390
|
|
|
269
391
|
// src/components/Badge.tsx
|
|
270
|
-
var
|
|
392
|
+
var React7 = __toESM(require("react"));
|
|
271
393
|
var import_class_variance_authority3 = require("class-variance-authority");
|
|
272
394
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
273
395
|
var badgeVariants = (0, import_class_variance_authority3.cva)(
|
|
274
|
-
"inline-flex items-center rounded-
|
|
396
|
+
"inline-flex items-center justify-center rounded-md border font-medium w-fit whitespace-nowrap shrink-0 gap-1",
|
|
275
397
|
{
|
|
276
398
|
variants: {
|
|
277
399
|
variant: {
|
|
278
|
-
default: "border-transparent bg-primary text-primary-foreground hover:bg-primary
|
|
279
|
-
secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary
|
|
280
|
-
destructive: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive
|
|
281
|
-
outline: "text-foreground"
|
|
400
|
+
default: "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
|
|
401
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
402
|
+
destructive: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
|
|
403
|
+
outline: "text-foreground hover:bg-accent hover:text-accent-foreground",
|
|
404
|
+
success: "border-transparent bg-success text-success-foreground hover:bg-success/80",
|
|
405
|
+
warning: "border-transparent bg-warning text-warning-foreground hover:bg-warning/80",
|
|
406
|
+
info: "border-transparent bg-info text-info-foreground hover:bg-info/80"
|
|
407
|
+
},
|
|
408
|
+
size: {
|
|
409
|
+
default: "px-2 py-0.5 text-xs",
|
|
410
|
+
sm: "px-1.5 py-0.5 text-xs",
|
|
411
|
+
dot: "h-5 w-5 p-0 text-xs"
|
|
282
412
|
}
|
|
283
413
|
},
|
|
284
414
|
defaultVariants: {
|
|
285
|
-
variant: "default"
|
|
415
|
+
variant: "default",
|
|
416
|
+
size: "default"
|
|
286
417
|
}
|
|
287
418
|
}
|
|
288
419
|
);
|
|
289
|
-
var Badge =
|
|
290
|
-
({ className, variant, ...props }, ref) => {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
className: cn(badgeVariants({ variant }), className),
|
|
297
|
-
...props
|
|
420
|
+
var Badge = React7.forwardRef(
|
|
421
|
+
({ className, variant, size, live, clickable, label, children, onClick, ...props }, ref) => {
|
|
422
|
+
if (process.env.NODE_ENV !== "production") {
|
|
423
|
+
if (live && !label) {
|
|
424
|
+
console.warn(
|
|
425
|
+
'Badge: When using live={true} for dynamic content, consider providing a label prop for better screen reader context (e.g., label="unread notifications" for a count badge).'
|
|
426
|
+
);
|
|
298
427
|
}
|
|
428
|
+
}
|
|
429
|
+
const isInteractive = clickable || !!onClick;
|
|
430
|
+
const classes = cn(
|
|
431
|
+
badgeVariants({ variant, size }),
|
|
432
|
+
isInteractive && "cursor-pointer focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
433
|
+
className
|
|
299
434
|
);
|
|
435
|
+
const sharedProps = {
|
|
436
|
+
role: live ? "status" : void 0,
|
|
437
|
+
"aria-live": live ? "polite" : void 0,
|
|
438
|
+
"aria-atomic": live ? "true" : void 0,
|
|
439
|
+
className: classes,
|
|
440
|
+
...props
|
|
441
|
+
};
|
|
442
|
+
if (isInteractive) {
|
|
443
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
444
|
+
"button",
|
|
445
|
+
{
|
|
446
|
+
ref,
|
|
447
|
+
type: "button",
|
|
448
|
+
onClick,
|
|
449
|
+
...sharedProps,
|
|
450
|
+
children: [
|
|
451
|
+
children,
|
|
452
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "sr-only", children: label })
|
|
453
|
+
]
|
|
454
|
+
}
|
|
455
|
+
);
|
|
456
|
+
}
|
|
457
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { ref, ...sharedProps, children: [
|
|
458
|
+
children,
|
|
459
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "sr-only", children: label })
|
|
460
|
+
] });
|
|
300
461
|
}
|
|
301
462
|
);
|
|
302
463
|
Badge.displayName = "Badge";
|
|
303
464
|
|
|
304
465
|
// src/components/Separator.tsx
|
|
305
|
-
var
|
|
466
|
+
var React8 = __toESM(require("react"));
|
|
306
467
|
var SeparatorPrimitive = __toESM(require("@radix-ui/react-separator"));
|
|
307
468
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
308
|
-
var Separator =
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
"shrink-0 bg-border",
|
|
316
|
-
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
|
317
|
-
className
|
|
318
|
-
),
|
|
319
|
-
...props
|
|
469
|
+
var Separator = React8.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => {
|
|
470
|
+
if (process.env.NODE_ENV !== "production") {
|
|
471
|
+
if (!decorative && !props["aria-label"]) {
|
|
472
|
+
console.warn(
|
|
473
|
+
"Separator: Non-decorative separators (decorative={false}) should have an aria-label to describe the content they separate."
|
|
474
|
+
);
|
|
475
|
+
}
|
|
320
476
|
}
|
|
321
|
-
)
|
|
477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
478
|
+
SeparatorPrimitive.Root,
|
|
479
|
+
{
|
|
480
|
+
ref,
|
|
481
|
+
decorative,
|
|
482
|
+
orientation,
|
|
483
|
+
className: cn(
|
|
484
|
+
"shrink-0 bg-border",
|
|
485
|
+
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
|
486
|
+
className
|
|
487
|
+
),
|
|
488
|
+
...props
|
|
489
|
+
}
|
|
490
|
+
);
|
|
491
|
+
});
|
|
322
492
|
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
323
493
|
|
|
324
494
|
// src/components/Switch.tsx
|
|
325
|
-
var
|
|
495
|
+
var React9 = __toESM(require("react"));
|
|
326
496
|
var SwitchPrimitives = __toESM(require("@radix-ui/react-switch"));
|
|
327
497
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
328
498
|
var SwitchRoot = SwitchPrimitives.Root;
|
|
329
499
|
var SwitchThumb = SwitchPrimitives.Thumb;
|
|
330
|
-
var Switch =
|
|
331
|
-
({
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
className: cn(
|
|
346
|
-
"pointer-events-none block rounded-full bg-background shadow-lg ring-0 transition-transform",
|
|
347
|
-
size === "default" && "h-5 w-5 data-[state=checked]:translate-x-[22px] data-[state=unchecked]:translate-x-0.5",
|
|
348
|
-
size === "sm" && "h-4 w-4 data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"
|
|
349
|
-
)
|
|
350
|
-
}
|
|
351
|
-
)
|
|
500
|
+
var Switch = React9.forwardRef(
|
|
501
|
+
({
|
|
502
|
+
className,
|
|
503
|
+
size = "default",
|
|
504
|
+
"aria-label": ariaLabel,
|
|
505
|
+
"aria-labelledby": ariaLabelledBy,
|
|
506
|
+
"aria-describedby": ariaDescribedBy,
|
|
507
|
+
...props
|
|
508
|
+
}, ref) => {
|
|
509
|
+
if (process.env.NODE_ENV !== "production") {
|
|
510
|
+
if (!ariaLabel && !ariaLabelledBy && !props.id) {
|
|
511
|
+
console.warn(
|
|
512
|
+
"Switch: Missing accessible label. Provide aria-label, aria-labelledby, or associate with a Label using id/htmlFor for WCAG compliance."
|
|
513
|
+
);
|
|
514
|
+
}
|
|
352
515
|
}
|
|
353
|
-
|
|
516
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
517
|
+
SwitchRoot,
|
|
518
|
+
{
|
|
519
|
+
className: cn(
|
|
520
|
+
"peer inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
|
|
521
|
+
size === "default" && "h-7 w-12",
|
|
522
|
+
size === "sm" && "h-5 w-9",
|
|
523
|
+
className
|
|
524
|
+
),
|
|
525
|
+
ref,
|
|
526
|
+
"aria-label": ariaLabel,
|
|
527
|
+
"aria-labelledby": ariaLabelledBy,
|
|
528
|
+
"aria-describedby": ariaDescribedBy,
|
|
529
|
+
...props,
|
|
530
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
531
|
+
SwitchThumb,
|
|
532
|
+
{
|
|
533
|
+
className: cn(
|
|
534
|
+
"pointer-events-none block rounded-full bg-background shadow-lg ring-0 transition-transform",
|
|
535
|
+
size === "default" && "h-5 w-5 data-[state=checked]:translate-x-[22px] data-[state=unchecked]:translate-x-0.5",
|
|
536
|
+
size === "sm" && "h-4 w-4 data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"
|
|
537
|
+
)
|
|
538
|
+
}
|
|
539
|
+
)
|
|
540
|
+
}
|
|
541
|
+
);
|
|
542
|
+
}
|
|
354
543
|
);
|
|
355
544
|
Switch.displayName = SwitchPrimitives.Root.displayName;
|
|
356
545
|
|
|
357
546
|
// src/components/Avatar.tsx
|
|
358
|
-
var
|
|
547
|
+
var React10 = __toESM(require("react"));
|
|
359
548
|
var AvatarPrimitive = __toESM(require("@radix-ui/react-avatar"));
|
|
360
549
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
361
|
-
var Avatar =
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
550
|
+
var Avatar = React10.forwardRef(
|
|
551
|
+
({ className, name, "aria-label": ariaLabel, ...props }, ref) => {
|
|
552
|
+
if (process.env.NODE_ENV !== "production") {
|
|
553
|
+
if (!ariaLabel && !name) {
|
|
554
|
+
console.warn(
|
|
555
|
+
'Avatar: Missing accessible text. Provide either a "name" prop or "aria-label" for screen reader users.'
|
|
556
|
+
);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
const computedAriaLabel = ariaLabel ?? (name ? `Avatar for ${name}` : void 0);
|
|
560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
561
|
+
AvatarPrimitive.Root,
|
|
562
|
+
{
|
|
563
|
+
ref,
|
|
564
|
+
"aria-label": computedAriaLabel,
|
|
565
|
+
className: cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full", className),
|
|
566
|
+
...props
|
|
567
|
+
}
|
|
568
|
+
);
|
|
367
569
|
}
|
|
368
|
-
)
|
|
570
|
+
);
|
|
369
571
|
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
370
|
-
var AvatarImage =
|
|
572
|
+
var AvatarImage = React10.forwardRef(({ className, alt, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
371
573
|
AvatarPrimitive.Image,
|
|
372
574
|
{
|
|
373
575
|
ref,
|
|
576
|
+
alt,
|
|
374
577
|
className: cn("aspect-square h-full w-full object-cover", className),
|
|
375
578
|
...props
|
|
376
579
|
}
|
|
377
580
|
));
|
|
378
581
|
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
379
|
-
var AvatarFallback =
|
|
582
|
+
var AvatarFallback = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
380
583
|
AvatarPrimitive.Fallback,
|
|
381
584
|
{
|
|
382
585
|
ref,
|
|
@@ -390,7 +593,7 @@ var AvatarFallback = React9.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
390
593
|
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
391
594
|
|
|
392
595
|
// src/components/Dialog.tsx
|
|
393
|
-
var
|
|
596
|
+
var React11 = __toESM(require("react"));
|
|
394
597
|
var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"));
|
|
395
598
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
396
599
|
var PrimitiveOverlay = DialogPrimitive.Overlay;
|
|
@@ -401,26 +604,35 @@ var Dialog = DialogPrimitive.Root;
|
|
|
401
604
|
var DialogTrigger = DialogPrimitive.Trigger;
|
|
402
605
|
var DialogPortal = DialogPrimitive.Portal;
|
|
403
606
|
var DialogClose = DialogPrimitive.Close;
|
|
404
|
-
var
|
|
607
|
+
var dialogSizeClasses = {
|
|
608
|
+
sm: "max-w-sm",
|
|
609
|
+
md: "max-w-lg",
|
|
610
|
+
lg: "max-w-xl",
|
|
611
|
+
xl: "max-w-2xl",
|
|
612
|
+
"2xl": "max-w-3xl",
|
|
613
|
+
full: "max-w-[calc(100vw-2rem)]"
|
|
614
|
+
};
|
|
615
|
+
var DialogOverlay = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
405
616
|
PrimitiveOverlay,
|
|
406
617
|
{
|
|
407
618
|
ref,
|
|
408
619
|
className: cn(
|
|
409
|
-
"fixed inset-0 z-50 bg-
|
|
620
|
+
"fixed inset-0 z-50 bg-foreground/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
410
621
|
className
|
|
411
622
|
),
|
|
412
623
|
...props
|
|
413
624
|
}
|
|
414
625
|
));
|
|
415
626
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
416
|
-
var DialogContent =
|
|
627
|
+
var DialogContent = React11.forwardRef(({ className, children, size = "md", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DialogPortal, { children: [
|
|
417
628
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DialogOverlay, {}),
|
|
418
629
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
419
630
|
PrimitiveContent,
|
|
420
631
|
{
|
|
421
632
|
ref,
|
|
422
633
|
className: cn(
|
|
423
|
-
"fixed left-[50%] top-[50%] z-50 grid w-full
|
|
634
|
+
"fixed left-[50%] top-[50%] z-50 grid w-full translate-x-[-50%] translate-y-[-50%] gap-4 border border-border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
|
635
|
+
dialogSizeClasses[size],
|
|
424
636
|
className
|
|
425
637
|
),
|
|
426
638
|
...props,
|
|
@@ -439,7 +651,7 @@ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_r
|
|
|
439
651
|
}
|
|
440
652
|
);
|
|
441
653
|
DialogFooter.displayName = "DialogFooter";
|
|
442
|
-
var DialogTitle =
|
|
654
|
+
var DialogTitle = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
443
655
|
PrimitiveTitle,
|
|
444
656
|
{
|
|
445
657
|
ref,
|
|
@@ -448,7 +660,7 @@ var DialogTitle = React10.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
448
660
|
}
|
|
449
661
|
));
|
|
450
662
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
451
|
-
var DialogDescription =
|
|
663
|
+
var DialogDescription = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
452
664
|
PrimitiveDescription,
|
|
453
665
|
{
|
|
454
666
|
ref,
|
|
@@ -459,7 +671,7 @@ var DialogDescription = React10.forwardRef(({ className, ...props }, ref) => /*
|
|
|
459
671
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
460
672
|
|
|
461
673
|
// src/components/PageHeader.tsx
|
|
462
|
-
var
|
|
674
|
+
var React12 = __toESM(require("react"));
|
|
463
675
|
var import_class_variance_authority4 = require("class-variance-authority");
|
|
464
676
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
465
677
|
var pageHeaderContainerVariants = (0, import_class_variance_authority4.cva)("", {
|
|
@@ -510,25 +722,34 @@ var pageHeaderActionsVariants = (0, import_class_variance_authority4.cva)("flex
|
|
|
510
722
|
variant: "default"
|
|
511
723
|
}
|
|
512
724
|
});
|
|
513
|
-
var PageHeader =
|
|
514
|
-
({ className, variant, title, subtitle, actions, ...props }, ref) =>
|
|
515
|
-
"
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h1", { className: pageHeaderTitleVariants({ variant }), children: title }),
|
|
522
|
-
subtitle && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: pageHeaderSubtitleVariants({ variant }), children: subtitle }),
|
|
523
|
-
actions && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: pageHeaderActionsVariants({ variant }), children: actions })
|
|
524
|
-
]
|
|
725
|
+
var PageHeader = React12.forwardRef(
|
|
726
|
+
({ className, variant, title, subtitle, actions, as: Heading = "h1", ...props }, ref) => {
|
|
727
|
+
if (process.env.NODE_ENV !== "production") {
|
|
728
|
+
if (Heading === "h1") {
|
|
729
|
+
console.warn(
|
|
730
|
+
'PageHeader: Using as="h1" (the default). Ensure there is only one h1 per page for proper document structure. Consider as="h2" for secondary headers.'
|
|
731
|
+
);
|
|
732
|
+
}
|
|
525
733
|
}
|
|
526
|
-
|
|
734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
735
|
+
"header",
|
|
736
|
+
{
|
|
737
|
+
ref,
|
|
738
|
+
className: cn(pageHeaderContainerVariants({ variant }), className),
|
|
739
|
+
...props,
|
|
740
|
+
children: [
|
|
741
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Heading, { className: pageHeaderTitleVariants({ variant }), children: title }),
|
|
742
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: pageHeaderSubtitleVariants({ variant }), children: subtitle }),
|
|
743
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: pageHeaderActionsVariants({ variant }), children: actions })
|
|
744
|
+
]
|
|
745
|
+
}
|
|
746
|
+
);
|
|
747
|
+
}
|
|
527
748
|
);
|
|
528
749
|
PageHeader.displayName = "PageHeader";
|
|
529
750
|
|
|
530
751
|
// src/components/DataPanel.tsx
|
|
531
|
-
var
|
|
752
|
+
var React13 = __toESM(require("react"));
|
|
532
753
|
var DropdownMenuPrimitive = __toESM(require("@radix-ui/react-dropdown-menu"));
|
|
533
754
|
var import_data_panel_core = require("@classic-homes/data-panel-core");
|
|
534
755
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
@@ -546,28 +767,28 @@ function useDataPanel(options = {}) {
|
|
|
546
767
|
constraints = {}
|
|
547
768
|
} = options;
|
|
548
769
|
const resolvedConstraints = { ...import_data_panel_core.DEFAULT_CONSTRAINTS, ...constraints };
|
|
549
|
-
const [persistedState] =
|
|
770
|
+
const [persistedState] = React13.useState(() => {
|
|
550
771
|
if (persistKey && typeof window !== "undefined") {
|
|
551
772
|
return (0, import_data_panel_core.loadPanelState)(persistKey);
|
|
552
773
|
}
|
|
553
774
|
return null;
|
|
554
775
|
});
|
|
555
|
-
const [mode, setMode] =
|
|
556
|
-
const [edge, setEdge] =
|
|
557
|
-
const [isExpanded, setIsExpanded] =
|
|
776
|
+
const [mode, setMode] = React13.useState(persistedState?.mode ?? initialMode);
|
|
777
|
+
const [edge, setEdge] = React13.useState(persistedState?.edge ?? initialEdge);
|
|
778
|
+
const [isExpanded, setIsExpanded] = React13.useState(
|
|
558
779
|
persistedState?.isExpanded ?? initialExpanded
|
|
559
780
|
);
|
|
560
|
-
const [detachedPosition, setDetachedPosition] =
|
|
781
|
+
const [detachedPosition, setDetachedPosition] = React13.useState(
|
|
561
782
|
persistedState?.detachedPosition ?? import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition
|
|
562
783
|
);
|
|
563
|
-
const [detachedSize, setDetachedSize] =
|
|
784
|
+
const [detachedSize, setDetachedSize] = React13.useState(
|
|
564
785
|
persistedState?.detachedSize ?? import_data_panel_core.DEFAULT_PANEL_STATE.detachedSize
|
|
565
786
|
);
|
|
566
|
-
const [pinnedSize, setPinnedSize] =
|
|
787
|
+
const [pinnedSize, setPinnedSize] = React13.useState(
|
|
567
788
|
persistedState?.pinnedSize ?? import_data_panel_core.DEFAULT_PANEL_STATE.pinnedSize
|
|
568
789
|
);
|
|
569
|
-
const saveTimeoutRef =
|
|
570
|
-
const debouncedSave =
|
|
790
|
+
const saveTimeoutRef = React13.useRef(null);
|
|
791
|
+
const debouncedSave = React13.useCallback(() => {
|
|
571
792
|
if (!persistKey) return;
|
|
572
793
|
if (saveTimeoutRef.current) {
|
|
573
794
|
clearTimeout(saveTimeoutRef.current);
|
|
@@ -585,7 +806,7 @@ function useDataPanel(options = {}) {
|
|
|
585
806
|
});
|
|
586
807
|
}, 300);
|
|
587
808
|
}, [persistKey, mode, edge, isExpanded, detachedPosition, detachedSize, pinnedSize]);
|
|
588
|
-
const handleSetMode =
|
|
809
|
+
const handleSetMode = React13.useCallback(
|
|
589
810
|
(newMode) => {
|
|
590
811
|
setMode(newMode);
|
|
591
812
|
if (newMode === "detached" && typeof window !== "undefined" && detachedPosition.x === import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition.x && detachedPosition.y === import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition.y) {
|
|
@@ -596,7 +817,7 @@ function useDataPanel(options = {}) {
|
|
|
596
817
|
},
|
|
597
818
|
[detachedPosition, detachedSize]
|
|
598
819
|
);
|
|
599
|
-
const handleSetDetachedPosition =
|
|
820
|
+
const handleSetDetachedPosition = React13.useCallback(
|
|
600
821
|
(position) => {
|
|
601
822
|
if (typeof window === "undefined") {
|
|
602
823
|
setDetachedPosition(position);
|
|
@@ -608,13 +829,13 @@ function useDataPanel(options = {}) {
|
|
|
608
829
|
},
|
|
609
830
|
[detachedSize]
|
|
610
831
|
);
|
|
611
|
-
const handleSetDetachedSize =
|
|
832
|
+
const handleSetDetachedSize = React13.useCallback(
|
|
612
833
|
(size) => {
|
|
613
834
|
setDetachedSize((0, import_data_panel_core.constrainSize)(size, resolvedConstraints));
|
|
614
835
|
},
|
|
615
836
|
[resolvedConstraints]
|
|
616
837
|
);
|
|
617
|
-
const handleSetPinnedSize =
|
|
838
|
+
const handleSetPinnedSize = React13.useCallback(
|
|
618
839
|
(size) => {
|
|
619
840
|
if (typeof window === "undefined") {
|
|
620
841
|
setPinnedSize(size);
|
|
@@ -628,7 +849,7 @@ function useDataPanel(options = {}) {
|
|
|
628
849
|
},
|
|
629
850
|
[edge, resolvedConstraints]
|
|
630
851
|
);
|
|
631
|
-
|
|
852
|
+
React13.useEffect(() => {
|
|
632
853
|
debouncedSave();
|
|
633
854
|
}, [debouncedSave]);
|
|
634
855
|
return {
|
|
@@ -704,10 +925,11 @@ var edgeLabels = {
|
|
|
704
925
|
top: "Pin to top",
|
|
705
926
|
bottom: "Pin to bottom"
|
|
706
927
|
};
|
|
707
|
-
var DataPanelHeader =
|
|
928
|
+
var DataPanelHeader = React13.forwardRef(
|
|
708
929
|
({
|
|
709
930
|
title,
|
|
710
931
|
subtitle,
|
|
932
|
+
titleId,
|
|
711
933
|
mode,
|
|
712
934
|
edge,
|
|
713
935
|
isExpanded,
|
|
@@ -734,7 +956,7 @@ var DataPanelHeader = React12.forwardRef(
|
|
|
734
956
|
"data-panel-header": true,
|
|
735
957
|
children: [
|
|
736
958
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex flex-col min-w-0 flex-1", children: headerContent ? headerContent : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
737
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "text-sm font-semibold leading-none truncate", children: title }),
|
|
959
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { id: titleId, className: "text-sm font-semibold leading-none truncate", children: title }),
|
|
738
960
|
subtitle && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-xs text-muted-foreground mt-1 truncate", children: subtitle })
|
|
739
961
|
] }) }),
|
|
740
962
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
@@ -743,7 +965,7 @@ var DataPanelHeader = React12.forwardRef(
|
|
|
743
965
|
"button",
|
|
744
966
|
{
|
|
745
967
|
type: "button",
|
|
746
|
-
className: "flex h-8 w-8 items-center justify-center rounded-md bg-transparent text-muted-foreground
|
|
968
|
+
className: "flex h-8 w-8 items-center justify-center rounded-md bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
747
969
|
onClick: () => onExpandedChange?.(!isExpanded),
|
|
748
970
|
"aria-label": isExpanded ? "Collapse panel" : "Expand panel",
|
|
749
971
|
"aria-expanded": isExpanded,
|
|
@@ -755,7 +977,7 @@ var DataPanelHeader = React12.forwardRef(
|
|
|
755
977
|
"button",
|
|
756
978
|
{
|
|
757
979
|
type: "button",
|
|
758
|
-
className: "flex h-8 w-8 items-center justify-center rounded-md bg-transparent text-muted-foreground
|
|
980
|
+
className: "flex h-8 w-8 items-center justify-center rounded-md bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
759
981
|
"aria-label": "Panel options",
|
|
760
982
|
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MoreVerticalIcon, {})
|
|
761
983
|
}
|
|
@@ -771,7 +993,7 @@ var DataPanelHeader = React12.forwardRef(
|
|
|
771
993
|
["left", "right", "top", "bottom"].map((e) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
772
994
|
DropdownItem,
|
|
773
995
|
{
|
|
774
|
-
className: "relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none
|
|
996
|
+
className: "relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none bg-popover focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
775
997
|
onSelect: () => {
|
|
776
998
|
onModeChange?.("pinned");
|
|
777
999
|
onEdgeChange?.(e);
|
|
@@ -787,7 +1009,7 @@ var DataPanelHeader = React12.forwardRef(
|
|
|
787
1009
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
788
1010
|
DropdownItem,
|
|
789
1011
|
{
|
|
790
|
-
className: "relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none
|
|
1012
|
+
className: "relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none bg-popover focus:bg-accent focus:text-accent-foreground",
|
|
791
1013
|
onSelect: () => onModeChange?.("detached"),
|
|
792
1014
|
children: [
|
|
793
1015
|
"Detach",
|
|
@@ -803,7 +1025,7 @@ var DataPanelHeader = React12.forwardRef(
|
|
|
803
1025
|
"button",
|
|
804
1026
|
{
|
|
805
1027
|
type: "button",
|
|
806
|
-
className: "flex h-8 w-8 items-center justify-center rounded-md bg-transparent text-muted-foreground
|
|
1028
|
+
className: "flex h-8 w-8 items-center justify-center rounded-md bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
807
1029
|
onClick: onClose,
|
|
808
1030
|
"aria-label": "Close panel",
|
|
809
1031
|
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CloseIcon, {})
|
|
@@ -816,13 +1038,22 @@ var DataPanelHeader = React12.forwardRef(
|
|
|
816
1038
|
}
|
|
817
1039
|
);
|
|
818
1040
|
DataPanelHeader.displayName = "DataPanelHeader";
|
|
819
|
-
var DataPanelContent =
|
|
820
|
-
({ children, className }, ref) => {
|
|
821
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1041
|
+
var DataPanelContent = React13.forwardRef(
|
|
1042
|
+
({ children, className, "aria-label": ariaLabel = "Panel content" }, ref) => {
|
|
1043
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1044
|
+
"div",
|
|
1045
|
+
{
|
|
1046
|
+
ref,
|
|
1047
|
+
role: "region",
|
|
1048
|
+
"aria-label": ariaLabel,
|
|
1049
|
+
className: cn("flex-1 overflow-auto p-4", className),
|
|
1050
|
+
children
|
|
1051
|
+
}
|
|
1052
|
+
);
|
|
822
1053
|
}
|
|
823
1054
|
);
|
|
824
1055
|
DataPanelContent.displayName = "DataPanelContent";
|
|
825
|
-
var DataPanelFooter =
|
|
1056
|
+
var DataPanelFooter = React13.forwardRef(
|
|
826
1057
|
({ actions = [], footerContent, footerActions, className }, ref) => {
|
|
827
1058
|
if (!footerContent && actions.length === 0 && !footerActions) {
|
|
828
1059
|
return null;
|
|
@@ -858,7 +1089,7 @@ var DataPanelFooter = React12.forwardRef(
|
|
|
858
1089
|
}
|
|
859
1090
|
);
|
|
860
1091
|
DataPanelFooter.displayName = "DataPanelFooter";
|
|
861
|
-
var DataPanelTab =
|
|
1092
|
+
var DataPanelTab = React13.forwardRef(
|
|
862
1093
|
({ title = "Panel", edge, onClick, className }, ref) => {
|
|
863
1094
|
const positionClasses = {
|
|
864
1095
|
left: "left-0 top-1/2 -translate-y-1/2 rounded-r-md border-l-0",
|
|
@@ -879,7 +1110,7 @@ var DataPanelTab = React12.forwardRef(
|
|
|
879
1110
|
ref,
|
|
880
1111
|
type: "button",
|
|
881
1112
|
className: cn(
|
|
882
|
-
"fixed z-40 flex items-center justify-center gap-2 border border-border bg-background px-3 py-2 text-sm font-medium shadow-md
|
|
1113
|
+
"fixed z-40 flex items-center justify-center gap-2 border border-border bg-background px-3 py-2 text-sm font-medium shadow-md hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
883
1114
|
positionClasses,
|
|
884
1115
|
isVertical && "[writing-mode:vertical-rl]",
|
|
885
1116
|
className
|
|
@@ -895,7 +1126,186 @@ var DataPanelTab = React12.forwardRef(
|
|
|
895
1126
|
}
|
|
896
1127
|
);
|
|
897
1128
|
DataPanelTab.displayName = "DataPanelTab";
|
|
898
|
-
var
|
|
1129
|
+
var KEYBOARD_RESIZE_STEP = 10;
|
|
1130
|
+
var KEYBOARD_RESIZE_STEP_LARGE = 50;
|
|
1131
|
+
function ResizeHandles({
|
|
1132
|
+
mode,
|
|
1133
|
+
edge,
|
|
1134
|
+
detachedSize,
|
|
1135
|
+
pinnedSize,
|
|
1136
|
+
onResizeStart,
|
|
1137
|
+
onSizeChange,
|
|
1138
|
+
onPinnedSizeChange,
|
|
1139
|
+
constraints
|
|
1140
|
+
}) {
|
|
1141
|
+
const handleDetachedKeyDown = React13.useCallback(
|
|
1142
|
+
(e, handle) => {
|
|
1143
|
+
const step = e.shiftKey ? KEYBOARD_RESIZE_STEP_LARGE : KEYBOARD_RESIZE_STEP;
|
|
1144
|
+
let newSize = { ...detachedSize };
|
|
1145
|
+
let handled = false;
|
|
1146
|
+
switch (e.key) {
|
|
1147
|
+
case "ArrowUp":
|
|
1148
|
+
if (handle.includes("top")) {
|
|
1149
|
+
newSize.height = Math.max(constraints.minHeight || 200, detachedSize.height + step);
|
|
1150
|
+
handled = true;
|
|
1151
|
+
} else if (handle.includes("bottom")) {
|
|
1152
|
+
newSize.height = Math.max(constraints.minHeight || 200, detachedSize.height - step);
|
|
1153
|
+
handled = true;
|
|
1154
|
+
}
|
|
1155
|
+
break;
|
|
1156
|
+
case "ArrowDown":
|
|
1157
|
+
if (handle.includes("top")) {
|
|
1158
|
+
newSize.height = Math.max(constraints.minHeight || 200, detachedSize.height - step);
|
|
1159
|
+
handled = true;
|
|
1160
|
+
} else if (handle.includes("bottom")) {
|
|
1161
|
+
newSize.height = Math.min(constraints.maxHeight || 800, detachedSize.height + step);
|
|
1162
|
+
handled = true;
|
|
1163
|
+
}
|
|
1164
|
+
break;
|
|
1165
|
+
case "ArrowLeft":
|
|
1166
|
+
if (handle.includes("left")) {
|
|
1167
|
+
newSize.width = Math.max(constraints.minWidth || 280, detachedSize.width + step);
|
|
1168
|
+
handled = true;
|
|
1169
|
+
} else if (handle.includes("right")) {
|
|
1170
|
+
newSize.width = Math.max(constraints.minWidth || 280, detachedSize.width - step);
|
|
1171
|
+
handled = true;
|
|
1172
|
+
}
|
|
1173
|
+
break;
|
|
1174
|
+
case "ArrowRight":
|
|
1175
|
+
if (handle.includes("left")) {
|
|
1176
|
+
newSize.width = Math.max(constraints.minWidth || 280, detachedSize.width - step);
|
|
1177
|
+
handled = true;
|
|
1178
|
+
} else if (handle.includes("right")) {
|
|
1179
|
+
newSize.width = Math.min(constraints.maxWidth || 600, detachedSize.width + step);
|
|
1180
|
+
handled = true;
|
|
1181
|
+
}
|
|
1182
|
+
break;
|
|
1183
|
+
}
|
|
1184
|
+
if (handled) {
|
|
1185
|
+
e.preventDefault();
|
|
1186
|
+
onSizeChange(newSize);
|
|
1187
|
+
}
|
|
1188
|
+
},
|
|
1189
|
+
[detachedSize, constraints, onSizeChange]
|
|
1190
|
+
);
|
|
1191
|
+
const handlePinnedKeyDown = React13.useCallback(
|
|
1192
|
+
(e) => {
|
|
1193
|
+
const step = e.shiftKey ? KEYBOARD_RESIZE_STEP_LARGE : KEYBOARD_RESIZE_STEP;
|
|
1194
|
+
let newSize = pinnedSize;
|
|
1195
|
+
let handled = false;
|
|
1196
|
+
const isHorizontal2 = edge === "left" || edge === "right";
|
|
1197
|
+
if (isHorizontal2) {
|
|
1198
|
+
if (e.key === "ArrowLeft" && edge === "right" || e.key === "ArrowRight" && edge === "left") {
|
|
1199
|
+
newSize = Math.min(constraints.maxWidth || 600, pinnedSize + step);
|
|
1200
|
+
handled = true;
|
|
1201
|
+
} else if (e.key === "ArrowRight" && edge === "right" || e.key === "ArrowLeft" && edge === "left") {
|
|
1202
|
+
newSize = Math.max(constraints.minWidth || 280, pinnedSize - step);
|
|
1203
|
+
handled = true;
|
|
1204
|
+
}
|
|
1205
|
+
} else {
|
|
1206
|
+
if (e.key === "ArrowUp" && edge === "bottom" || e.key === "ArrowDown" && edge === "top") {
|
|
1207
|
+
newSize = Math.min(constraints.maxHeight || 800, pinnedSize + step);
|
|
1208
|
+
handled = true;
|
|
1209
|
+
} else if (e.key === "ArrowDown" && edge === "bottom" || e.key === "ArrowUp" && edge === "top") {
|
|
1210
|
+
newSize = Math.max(constraints.minHeight || 200, pinnedSize - step);
|
|
1211
|
+
handled = true;
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
if (handled) {
|
|
1215
|
+
e.preventDefault();
|
|
1216
|
+
onPinnedSizeChange(newSize);
|
|
1217
|
+
}
|
|
1218
|
+
},
|
|
1219
|
+
[edge, pinnedSize, constraints, onPinnedSizeChange]
|
|
1220
|
+
);
|
|
1221
|
+
const getAriaValueNow = (handle) => {
|
|
1222
|
+
if (handle.includes("left") || handle.includes("right")) {
|
|
1223
|
+
return mode === "detached" ? detachedSize.width : pinnedSize;
|
|
1224
|
+
}
|
|
1225
|
+
return mode === "detached" ? detachedSize.height : pinnedSize;
|
|
1226
|
+
};
|
|
1227
|
+
const getAriaValueMinMax = (handle) => {
|
|
1228
|
+
const isWidth = handle.includes("left") || handle.includes("right");
|
|
1229
|
+
if (isWidth) {
|
|
1230
|
+
return {
|
|
1231
|
+
min: constraints.minWidth || 280,
|
|
1232
|
+
max: constraints.maxWidth || 600
|
|
1233
|
+
};
|
|
1234
|
+
}
|
|
1235
|
+
return {
|
|
1236
|
+
min: constraints.minHeight || 200,
|
|
1237
|
+
max: constraints.maxHeight || 800
|
|
1238
|
+
};
|
|
1239
|
+
};
|
|
1240
|
+
if (mode === "detached") {
|
|
1241
|
+
const handles = [
|
|
1242
|
+
"top",
|
|
1243
|
+
"bottom",
|
|
1244
|
+
"left",
|
|
1245
|
+
"right",
|
|
1246
|
+
"top-left",
|
|
1247
|
+
"top-right",
|
|
1248
|
+
"bottom-left",
|
|
1249
|
+
"bottom-right"
|
|
1250
|
+
];
|
|
1251
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: handles.map((handle) => {
|
|
1252
|
+
const isCorner = handle.includes("-");
|
|
1253
|
+
const isHorizontal2 = handle === "top" || handle === "bottom";
|
|
1254
|
+
const isVertical = handle === "left" || handle === "right";
|
|
1255
|
+
const { min: min2, max: max2 } = getAriaValueMinMax(handle);
|
|
1256
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1257
|
+
"div",
|
|
1258
|
+
{
|
|
1259
|
+
className: cn(
|
|
1260
|
+
"resize-handle",
|
|
1261
|
+
isHorizontal2 && "resize-handle--horizontal",
|
|
1262
|
+
isVertical && "resize-handle--vertical",
|
|
1263
|
+
isCorner && "resize-handle--corner",
|
|
1264
|
+
`resize-handle--${handle}`
|
|
1265
|
+
),
|
|
1266
|
+
role: "slider",
|
|
1267
|
+
tabIndex: 0,
|
|
1268
|
+
"aria-orientation": isVertical ? "vertical" : "horizontal",
|
|
1269
|
+
"aria-label": `Resize panel from ${handle.replace("-", "")} ${isCorner ? "corner" : "edge"}`,
|
|
1270
|
+
"aria-valuenow": getAriaValueNow(handle),
|
|
1271
|
+
"aria-valuemin": min2,
|
|
1272
|
+
"aria-valuemax": max2,
|
|
1273
|
+
"aria-valuetext": `${getAriaValueNow(handle)} pixels`,
|
|
1274
|
+
style: isCorner ? { "--handle-radius": "6px" } : void 0,
|
|
1275
|
+
onPointerDown: (e) => onResizeStart(e, handle),
|
|
1276
|
+
onKeyDown: (e) => handleDetachedKeyDown(e, handle)
|
|
1277
|
+
},
|
|
1278
|
+
handle
|
|
1279
|
+
);
|
|
1280
|
+
}) });
|
|
1281
|
+
}
|
|
1282
|
+
const pinnedHandle = (0, import_data_panel_core.getPinnedResizeHandle)(edge);
|
|
1283
|
+
const isHorizontal = edge === "left" || edge === "right";
|
|
1284
|
+
const { min, max } = getAriaValueMinMax(pinnedHandle);
|
|
1285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1286
|
+
"div",
|
|
1287
|
+
{
|
|
1288
|
+
className: cn(
|
|
1289
|
+
"resize-handle",
|
|
1290
|
+
edge === "left" && "resize-handle--vertical resize-handle--right",
|
|
1291
|
+
edge === "right" && "resize-handle--vertical resize-handle--left",
|
|
1292
|
+
edge === "top" && "resize-handle--horizontal resize-handle--bottom",
|
|
1293
|
+
edge === "bottom" && "resize-handle--horizontal resize-handle--top"
|
|
1294
|
+
),
|
|
1295
|
+
role: "slider",
|
|
1296
|
+
tabIndex: 0,
|
|
1297
|
+
"aria-orientation": isHorizontal ? "horizontal" : "vertical",
|
|
1298
|
+
"aria-label": `Resize panel from ${edge} edge`,
|
|
1299
|
+
"aria-valuenow": pinnedSize,
|
|
1300
|
+
"aria-valuemin": min,
|
|
1301
|
+
"aria-valuemax": max,
|
|
1302
|
+
"aria-valuetext": `${pinnedSize} pixels`,
|
|
1303
|
+
onPointerDown: (e) => onResizeStart(e, pinnedHandle),
|
|
1304
|
+
onKeyDown: handlePinnedKeyDown
|
|
1305
|
+
}
|
|
1306
|
+
);
|
|
1307
|
+
}
|
|
1308
|
+
var DataPanel = React13.forwardRef(
|
|
899
1309
|
({
|
|
900
1310
|
open: controlledOpen,
|
|
901
1311
|
onOpenChange,
|
|
@@ -924,31 +1334,33 @@ var DataPanel = React12.forwardRef(
|
|
|
924
1334
|
className
|
|
925
1335
|
}, ref) => {
|
|
926
1336
|
const resolvedConstraints = { ...import_data_panel_core.DEFAULT_CONSTRAINTS, ...constraints };
|
|
927
|
-
const
|
|
928
|
-
const
|
|
929
|
-
const [
|
|
930
|
-
const [
|
|
1337
|
+
const panelId = React13.useId();
|
|
1338
|
+
const titleId = `${panelId}-title`;
|
|
1339
|
+
const [internalOpen, setInternalOpen] = React13.useState(true);
|
|
1340
|
+
const [internalMode, setInternalMode] = React13.useState(import_data_panel_core.DEFAULT_PANEL_STATE.mode);
|
|
1341
|
+
const [internalEdge, setInternalEdge] = React13.useState(import_data_panel_core.DEFAULT_PANEL_STATE.edge);
|
|
1342
|
+
const [internalExpanded, setInternalExpanded] = React13.useState(
|
|
931
1343
|
import_data_panel_core.DEFAULT_PANEL_STATE.isExpanded
|
|
932
1344
|
);
|
|
933
|
-
const [detachedPosition, setDetachedPosition] =
|
|
1345
|
+
const [detachedPosition, setDetachedPosition] = React13.useState(
|
|
934
1346
|
import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition
|
|
935
1347
|
);
|
|
936
|
-
const [detachedSize, setDetachedSize] =
|
|
937
|
-
const [pinnedSize, setPinnedSize] =
|
|
938
|
-
const [isDragging, setIsDragging] =
|
|
939
|
-
const [isResizing, setIsResizing] =
|
|
940
|
-
const [snapPreview, setSnapPreview] =
|
|
941
|
-
const [isPinnedDragging, setIsPinnedDragging] =
|
|
942
|
-
const [pullOffset, setPullOffset] =
|
|
943
|
-
const dragStateRef =
|
|
1348
|
+
const [detachedSize, setDetachedSize] = React13.useState(import_data_panel_core.DEFAULT_PANEL_STATE.detachedSize);
|
|
1349
|
+
const [pinnedSize, setPinnedSize] = React13.useState(import_data_panel_core.DEFAULT_PANEL_STATE.pinnedSize);
|
|
1350
|
+
const [isDragging, setIsDragging] = React13.useState(false);
|
|
1351
|
+
const [isResizing, setIsResizing] = React13.useState(false);
|
|
1352
|
+
const [snapPreview, setSnapPreview] = React13.useState(null);
|
|
1353
|
+
const [isPinnedDragging, setIsPinnedDragging] = React13.useState(false);
|
|
1354
|
+
const [pullOffset, setPullOffset] = React13.useState(0);
|
|
1355
|
+
const dragStateRef = React13.useRef({
|
|
944
1356
|
startPosition: { x: 0, y: 0 },
|
|
945
1357
|
startPanelPosition: { x: 0, y: 0 }
|
|
946
1358
|
});
|
|
947
|
-
const pinnedDragStateRef =
|
|
1359
|
+
const pinnedDragStateRef = React13.useRef({
|
|
948
1360
|
startPosition: { x: 0, y: 0 },
|
|
949
1361
|
hasDetached: false
|
|
950
1362
|
});
|
|
951
|
-
const resizeStateRef =
|
|
1363
|
+
const resizeStateRef = React13.useRef({
|
|
952
1364
|
handle: null,
|
|
953
1365
|
startPosition: { x: 0, y: 0 },
|
|
954
1366
|
startSize: { width: 0, height: 0 },
|
|
@@ -958,8 +1370,8 @@ var DataPanel = React12.forwardRef(
|
|
|
958
1370
|
const mode = controlledMode ?? internalMode;
|
|
959
1371
|
const edge = controlledEdge ?? internalEdge;
|
|
960
1372
|
const isExpanded = controlledExpanded ?? internalExpanded;
|
|
961
|
-
const saveTimeoutRef =
|
|
962
|
-
const debouncedSave =
|
|
1373
|
+
const saveTimeoutRef = React13.useRef(null);
|
|
1374
|
+
const debouncedSave = React13.useCallback(() => {
|
|
963
1375
|
if (!persistKey) return;
|
|
964
1376
|
if (saveTimeoutRef.current) {
|
|
965
1377
|
clearTimeout(saveTimeoutRef.current);
|
|
@@ -985,7 +1397,7 @@ var DataPanel = React12.forwardRef(
|
|
|
985
1397
|
detachedSize,
|
|
986
1398
|
pinnedSize
|
|
987
1399
|
]);
|
|
988
|
-
|
|
1400
|
+
React13.useEffect(() => {
|
|
989
1401
|
if (!persistKey) return;
|
|
990
1402
|
const persisted = (0, import_data_panel_core.loadPanelState)(persistKey);
|
|
991
1403
|
if (persisted) {
|
|
@@ -998,7 +1410,7 @@ var DataPanel = React12.forwardRef(
|
|
|
998
1410
|
if (persisted.pinnedSize) setPinnedSize(persisted.pinnedSize);
|
|
999
1411
|
}
|
|
1000
1412
|
}, [persistKey, controlledMode, controlledEdge, controlledExpanded]);
|
|
1001
|
-
|
|
1413
|
+
React13.useEffect(() => {
|
|
1002
1414
|
if (mode === "detached" && detachedPosition.x === import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition.x && detachedPosition.y === import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition.y) {
|
|
1003
1415
|
setDetachedPosition(
|
|
1004
1416
|
(0, import_data_panel_core.getInitialDetachedPosition)(detachedSize, window.innerWidth, window.innerHeight)
|
|
@@ -1056,7 +1468,7 @@ var DataPanel = React12.forwardRef(
|
|
|
1056
1468
|
document.body.style.userSelect = "none";
|
|
1057
1469
|
}
|
|
1058
1470
|
};
|
|
1059
|
-
const handleDragMove =
|
|
1471
|
+
const handleDragMove = React13.useCallback(
|
|
1060
1472
|
(e) => {
|
|
1061
1473
|
if (!isDragging) return;
|
|
1062
1474
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -1083,7 +1495,7 @@ var DataPanel = React12.forwardRef(
|
|
|
1083
1495
|
},
|
|
1084
1496
|
[isDragging, detachedSize, snapThreshold]
|
|
1085
1497
|
);
|
|
1086
|
-
const handleDragEnd =
|
|
1498
|
+
const handleDragEnd = React13.useCallback(() => {
|
|
1087
1499
|
if (!isDragging) return;
|
|
1088
1500
|
setIsDragging(false);
|
|
1089
1501
|
document.body.style.cursor = "";
|
|
@@ -1096,7 +1508,7 @@ var DataPanel = React12.forwardRef(
|
|
|
1096
1508
|
debouncedSave();
|
|
1097
1509
|
}
|
|
1098
1510
|
}, [isDragging, snapPreview, handleModeChange, handleEdgeChange, debouncedSave]);
|
|
1099
|
-
const handlePinnedDragMove =
|
|
1511
|
+
const handlePinnedDragMove = React13.useCallback(
|
|
1100
1512
|
(e) => {
|
|
1101
1513
|
if (!isPinnedDragging) return;
|
|
1102
1514
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -1132,7 +1544,7 @@ var DataPanel = React12.forwardRef(
|
|
|
1132
1544
|
},
|
|
1133
1545
|
[isPinnedDragging, edge, detachThreshold, pinnedSize, detachedSize, handleModeChange]
|
|
1134
1546
|
);
|
|
1135
|
-
const handlePinnedDragEnd =
|
|
1547
|
+
const handlePinnedDragEnd = React13.useCallback(() => {
|
|
1136
1548
|
if (!isPinnedDragging) return;
|
|
1137
1549
|
setIsPinnedDragging(false);
|
|
1138
1550
|
setPullOffset(0);
|
|
@@ -1154,7 +1566,7 @@ var DataPanel = React12.forwardRef(
|
|
|
1154
1566
|
document.body.style.cursor = (0, import_data_panel_core.getResizeCursor)(handle);
|
|
1155
1567
|
document.body.style.userSelect = "none";
|
|
1156
1568
|
};
|
|
1157
|
-
const handleResizeMove =
|
|
1569
|
+
const handleResizeMove = React13.useCallback(
|
|
1158
1570
|
(e) => {
|
|
1159
1571
|
if (!isResizing || !resizeStateRef.current.handle) return;
|
|
1160
1572
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -1192,7 +1604,7 @@ var DataPanel = React12.forwardRef(
|
|
|
1192
1604
|
},
|
|
1193
1605
|
[isResizing, mode, edge, resolvedConstraints]
|
|
1194
1606
|
);
|
|
1195
|
-
const handleResizeEnd =
|
|
1607
|
+
const handleResizeEnd = React13.useCallback(() => {
|
|
1196
1608
|
if (!isResizing) return;
|
|
1197
1609
|
setIsResizing(false);
|
|
1198
1610
|
resizeStateRef.current.handle = null;
|
|
@@ -1200,7 +1612,7 @@ var DataPanel = React12.forwardRef(
|
|
|
1200
1612
|
document.body.style.userSelect = "";
|
|
1201
1613
|
debouncedSave();
|
|
1202
1614
|
}, [isResizing, debouncedSave]);
|
|
1203
|
-
|
|
1615
|
+
React13.useEffect(() => {
|
|
1204
1616
|
if (isDragging) {
|
|
1205
1617
|
window.addEventListener("pointermove", handleDragMove);
|
|
1206
1618
|
window.addEventListener("pointerup", handleDragEnd);
|
|
@@ -1210,7 +1622,7 @@ var DataPanel = React12.forwardRef(
|
|
|
1210
1622
|
};
|
|
1211
1623
|
}
|
|
1212
1624
|
}, [isDragging, handleDragMove, handleDragEnd]);
|
|
1213
|
-
|
|
1625
|
+
React13.useEffect(() => {
|
|
1214
1626
|
if (isPinnedDragging) {
|
|
1215
1627
|
window.addEventListener("pointermove", handlePinnedDragMove);
|
|
1216
1628
|
window.addEventListener("pointerup", handlePinnedDragEnd);
|
|
@@ -1220,7 +1632,7 @@ var DataPanel = React12.forwardRef(
|
|
|
1220
1632
|
};
|
|
1221
1633
|
}
|
|
1222
1634
|
}, [isPinnedDragging, handlePinnedDragMove, handlePinnedDragEnd]);
|
|
1223
|
-
|
|
1635
|
+
React13.useEffect(() => {
|
|
1224
1636
|
if (isResizing) {
|
|
1225
1637
|
window.addEventListener("pointermove", handleResizeMove);
|
|
1226
1638
|
window.addEventListener("pointerup", handleResizeEnd);
|
|
@@ -1230,7 +1642,7 @@ var DataPanel = React12.forwardRef(
|
|
|
1230
1642
|
};
|
|
1231
1643
|
}
|
|
1232
1644
|
}, [isResizing, handleResizeMove, handleResizeEnd]);
|
|
1233
|
-
const panelStyles =
|
|
1645
|
+
const panelStyles = React13.useMemo(() => {
|
|
1234
1646
|
if (mode === "pinned") {
|
|
1235
1647
|
const baseStyles = (0, import_data_panel_core.getPinnedPositionStyles)(edge, pinnedSize);
|
|
1236
1648
|
if (pullOffset > 0) {
|
|
@@ -1283,9 +1695,10 @@ var DataPanel = React12.forwardRef(
|
|
|
1283
1695
|
className
|
|
1284
1696
|
),
|
|
1285
1697
|
style: panelStyles,
|
|
1286
|
-
role: mode === "detached" ? "dialog" :
|
|
1698
|
+
role: mode === "detached" ? "dialog" : "complementary",
|
|
1287
1699
|
"aria-modal": mode === "detached" ? "true" : void 0,
|
|
1288
|
-
"aria-labelledby": title ?
|
|
1700
|
+
"aria-labelledby": title ? titleId : void 0,
|
|
1701
|
+
"aria-label": !title ? "Side panel" : void 0,
|
|
1289
1702
|
onPointerDown: handleDragStart,
|
|
1290
1703
|
children: [
|
|
1291
1704
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
@@ -1293,6 +1706,7 @@ var DataPanel = React12.forwardRef(
|
|
|
1293
1706
|
{
|
|
1294
1707
|
title,
|
|
1295
1708
|
subtitle,
|
|
1709
|
+
titleId,
|
|
1296
1710
|
mode,
|
|
1297
1711
|
edge,
|
|
1298
1712
|
isExpanded,
|
|
@@ -1316,80 +1730,31 @@ var DataPanel = React12.forwardRef(
|
|
|
1316
1730
|
footerActions
|
|
1317
1731
|
}
|
|
1318
1732
|
),
|
|
1319
|
-
!disableResize && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1320
|
-
|
|
1321
|
-
"div",
|
|
1322
|
-
{
|
|
1323
|
-
className: "resize-handle resize-handle--horizontal resize-handle--top",
|
|
1324
|
-
onPointerDown: (e) => handleResizeStart(e, "top")
|
|
1325
|
-
}
|
|
1326
|
-
),
|
|
1327
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1328
|
-
"div",
|
|
1329
|
-
{
|
|
1330
|
-
className: "resize-handle resize-handle--horizontal resize-handle--bottom",
|
|
1331
|
-
onPointerDown: (e) => handleResizeStart(e, "bottom")
|
|
1332
|
-
}
|
|
1333
|
-
),
|
|
1334
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1335
|
-
"div",
|
|
1336
|
-
{
|
|
1337
|
-
className: "resize-handle resize-handle--vertical resize-handle--left",
|
|
1338
|
-
onPointerDown: (e) => handleResizeStart(e, "left")
|
|
1339
|
-
}
|
|
1340
|
-
),
|
|
1341
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1342
|
-
"div",
|
|
1343
|
-
{
|
|
1344
|
-
className: "resize-handle resize-handle--vertical resize-handle--right",
|
|
1345
|
-
onPointerDown: (e) => handleResizeStart(e, "right")
|
|
1346
|
-
}
|
|
1347
|
-
),
|
|
1348
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1349
|
-
"div",
|
|
1350
|
-
{
|
|
1351
|
-
className: "resize-handle resize-handle--corner resize-handle--top-left",
|
|
1352
|
-
style: { "--handle-radius": "6px" },
|
|
1353
|
-
onPointerDown: (e) => handleResizeStart(e, "top-left")
|
|
1354
|
-
}
|
|
1355
|
-
),
|
|
1356
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1357
|
-
"div",
|
|
1358
|
-
{
|
|
1359
|
-
className: "resize-handle resize-handle--corner resize-handle--top-right",
|
|
1360
|
-
style: { "--handle-radius": "6px" },
|
|
1361
|
-
onPointerDown: (e) => handleResizeStart(e, "top-right")
|
|
1362
|
-
}
|
|
1363
|
-
),
|
|
1364
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1365
|
-
"div",
|
|
1366
|
-
{
|
|
1367
|
-
className: "resize-handle resize-handle--corner resize-handle--bottom-left",
|
|
1368
|
-
style: { "--handle-radius": "6px" },
|
|
1369
|
-
onPointerDown: (e) => handleResizeStart(e, "bottom-left")
|
|
1370
|
-
}
|
|
1371
|
-
),
|
|
1372
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1373
|
-
"div",
|
|
1374
|
-
{
|
|
1375
|
-
className: "resize-handle resize-handle--corner resize-handle--bottom-right",
|
|
1376
|
-
style: { "--handle-radius": "6px" },
|
|
1377
|
-
onPointerDown: (e) => handleResizeStart(e, "bottom-right")
|
|
1378
|
-
}
|
|
1379
|
-
)
|
|
1380
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1381
|
-
"div",
|
|
1733
|
+
!disableResize && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1734
|
+
ResizeHandles,
|
|
1382
1735
|
{
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
)
|
|
1390
|
-
|
|
1736
|
+
mode,
|
|
1737
|
+
edge,
|
|
1738
|
+
detachedSize,
|
|
1739
|
+
pinnedSize,
|
|
1740
|
+
onResizeStart: handleResizeStart,
|
|
1741
|
+
onSizeChange: (size) => setDetachedSize((0, import_data_panel_core.constrainSize)(size, resolvedConstraints)),
|
|
1742
|
+
onPinnedSizeChange: (size) => {
|
|
1743
|
+
if (typeof window === "undefined") {
|
|
1744
|
+
setPinnedSize(size);
|
|
1745
|
+
return;
|
|
1746
|
+
}
|
|
1747
|
+
if ((0, import_data_panel_core.isHorizontalEdge)(edge)) {
|
|
1748
|
+
setPinnedSize((0, import_data_panel_core.constrainPinnedWidth)(size, resolvedConstraints, window.innerWidth));
|
|
1749
|
+
} else {
|
|
1750
|
+
setPinnedSize(
|
|
1751
|
+
(0, import_data_panel_core.constrainPinnedHeight)(size, resolvedConstraints, window.innerHeight)
|
|
1752
|
+
);
|
|
1753
|
+
}
|
|
1754
|
+
},
|
|
1755
|
+
constraints: resolvedConstraints
|
|
1391
1756
|
}
|
|
1392
|
-
)
|
|
1757
|
+
)
|
|
1393
1758
|
]
|
|
1394
1759
|
}
|
|
1395
1760
|
)
|
|
@@ -1397,6 +1762,891 @@ var DataPanel = React12.forwardRef(
|
|
|
1397
1762
|
}
|
|
1398
1763
|
);
|
|
1399
1764
|
DataPanel.displayName = "DataPanel";
|
|
1765
|
+
|
|
1766
|
+
// src/components/Skeleton.tsx
|
|
1767
|
+
var React14 = __toESM(require("react"));
|
|
1768
|
+
var import_class_variance_authority5 = require("class-variance-authority");
|
|
1769
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1770
|
+
var skeletonVariants = (0, import_class_variance_authority5.cva)("rounded-md bg-muted", {
|
|
1771
|
+
variants: {
|
|
1772
|
+
variant: {
|
|
1773
|
+
default: "",
|
|
1774
|
+
text: "h-4 w-full",
|
|
1775
|
+
avatar: "h-12 w-12 rounded-full",
|
|
1776
|
+
card: "h-32 w-full",
|
|
1777
|
+
button: "h-10 w-24",
|
|
1778
|
+
title: "h-6 w-3/4"
|
|
1779
|
+
}
|
|
1780
|
+
},
|
|
1781
|
+
defaultVariants: {
|
|
1782
|
+
variant: "default"
|
|
1783
|
+
}
|
|
1784
|
+
});
|
|
1785
|
+
var Skeleton = React14.forwardRef(
|
|
1786
|
+
({ className, variant, animation = "pulse", ...props }, ref) => {
|
|
1787
|
+
const animationClass = animation === "pulse" ? "animate-pulse" : animation === "shimmer" ? "animate-shimmer" : "";
|
|
1788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1789
|
+
"div",
|
|
1790
|
+
{
|
|
1791
|
+
ref,
|
|
1792
|
+
className: cn(skeletonVariants({ variant }), animationClass, className),
|
|
1793
|
+
...props
|
|
1794
|
+
}
|
|
1795
|
+
);
|
|
1796
|
+
}
|
|
1797
|
+
);
|
|
1798
|
+
Skeleton.displayName = "Skeleton";
|
|
1799
|
+
|
|
1800
|
+
// src/components/Spinner.tsx
|
|
1801
|
+
var React15 = __toESM(require("react"));
|
|
1802
|
+
var import_class_variance_authority6 = require("class-variance-authority");
|
|
1803
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1804
|
+
var spinnerVariants = (0, import_class_variance_authority6.cva)("animate-spin text-current", {
|
|
1805
|
+
variants: {
|
|
1806
|
+
size: {
|
|
1807
|
+
sm: "h-4 w-4",
|
|
1808
|
+
md: "h-6 w-6",
|
|
1809
|
+
lg: "h-8 w-8",
|
|
1810
|
+
xl: "h-12 w-12"
|
|
1811
|
+
}
|
|
1812
|
+
},
|
|
1813
|
+
defaultVariants: {
|
|
1814
|
+
size: "md"
|
|
1815
|
+
}
|
|
1816
|
+
});
|
|
1817
|
+
var Spinner = React15.forwardRef(
|
|
1818
|
+
({ className, size, label = "Loading...", ...props }, ref) => {
|
|
1819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1820
|
+
"svg",
|
|
1821
|
+
{
|
|
1822
|
+
ref,
|
|
1823
|
+
className: cn(spinnerVariants({ size }), className),
|
|
1824
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1825
|
+
fill: "none",
|
|
1826
|
+
viewBox: "0 0 24 24",
|
|
1827
|
+
"aria-label": label,
|
|
1828
|
+
role: "status",
|
|
1829
|
+
...props,
|
|
1830
|
+
children: [
|
|
1831
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1832
|
+
"circle",
|
|
1833
|
+
{
|
|
1834
|
+
className: "opacity-25",
|
|
1835
|
+
cx: "12",
|
|
1836
|
+
cy: "12",
|
|
1837
|
+
r: "10",
|
|
1838
|
+
stroke: "currentColor",
|
|
1839
|
+
strokeWidth: "4"
|
|
1840
|
+
}
|
|
1841
|
+
),
|
|
1842
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1843
|
+
"path",
|
|
1844
|
+
{
|
|
1845
|
+
className: "opacity-75",
|
|
1846
|
+
fill: "currentColor",
|
|
1847
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
1848
|
+
}
|
|
1849
|
+
),
|
|
1850
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("title", { children: label })
|
|
1851
|
+
]
|
|
1852
|
+
}
|
|
1853
|
+
);
|
|
1854
|
+
}
|
|
1855
|
+
);
|
|
1856
|
+
Spinner.displayName = "Spinner";
|
|
1857
|
+
|
|
1858
|
+
// src/components/LoadingLogo.tsx
|
|
1859
|
+
var React16 = __toESM(require("react"));
|
|
1860
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1861
|
+
var logoPaths = [
|
|
1862
|
+
"M9.902 16.6c.3.7 1.7.8 1-.6-.6-1.4-2.3-5.1-6.1-6.3-1.7-.5-3.7.4-4.3 1.6-.4.7-1.1 2.9.5 4.3.8.7 1.9 1.2 3.6 1 .4-.1.9-.5.6-.8-.5-.4-1.9-1.7-1.1-2.7.7-.8 1.4-.6 2-.3.4.2 2.1 1 3.7 3.6l.1.2z",
|
|
1863
|
+
"M14.602 16.6c-.3.7-1.7.8-1-.6.6-1.4 2.3-5.1 6.1-6.3 1.7-.5 3.7.4 4.3 1.6.4.7 1.1 2.9-.5 4.3-.8.7-1.9 1.2-3.6 1-.4-.1-.9-.5-.6-.8.5-.4 1.9-1.7 1.1-2.7-.7-.8-1.4-.6-2-.3-.4.2-2.1 1-3.7 3.6l-.1.2z",
|
|
1864
|
+
"M12.202 0c.7 1.3 2.1 3.2 2.3 5.3.1 1.5-.8 8.3-2.3 11.7-1.5-3.5-2.4-10.3-2.3-11.7.2-2.1 1.6-4 2.3-5.3z",
|
|
1865
|
+
"M9.002 18.1c-.8 0-.7.8-.1.8h6.7c.7 0 .7-.8-.1-.8h-6.5z",
|
|
1866
|
+
"M13.802 24.8c-1.1-1.1-.9-4.6-.9-4.6h-1.3s.2 3.6-.9 4.6h3.1z",
|
|
1867
|
+
"M14.202 22.5c-.1-.3-.5-1.4-.6-2.3 0-.2.6-.5.7.1.1.6.4 1.6.6 1.9.3.5-.4.9-.7.3z",
|
|
1868
|
+
"M10.302 22.5c.1-.3.5-1.4.6-2.2 0-.3-.5-.6-.7 0-.1.6-.4 1.6-.6 1.9-.3.5.4.9.7.3z"
|
|
1869
|
+
];
|
|
1870
|
+
var colors = {
|
|
1871
|
+
dark: {
|
|
1872
|
+
fill: "#C50F22",
|
|
1873
|
+
fillLoading: "#ffffff",
|
|
1874
|
+
stroke: "#C50F22"
|
|
1875
|
+
},
|
|
1876
|
+
light: {
|
|
1877
|
+
fill: "#ffffff",
|
|
1878
|
+
fillLoading: "#C50F22",
|
|
1879
|
+
stroke: "#ffffff"
|
|
1880
|
+
}
|
|
1881
|
+
};
|
|
1882
|
+
var LoadingLogo = React16.forwardRef(
|
|
1883
|
+
({ width = 40, height = 40, loading = false, variant = "dark", className, ...props }, ref) => {
|
|
1884
|
+
const currentColors = colors[variant];
|
|
1885
|
+
const fillColor = loading ? currentColors.fillLoading : currentColors.fill;
|
|
1886
|
+
const strokeColor = currentColors.stroke;
|
|
1887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
1888
|
+
"div",
|
|
1889
|
+
{
|
|
1890
|
+
ref,
|
|
1891
|
+
className: cn("inline-flex items-center justify-center", className),
|
|
1892
|
+
style: { width: `${width}px`, height: `${height}px` },
|
|
1893
|
+
role: loading ? "status" : "img",
|
|
1894
|
+
"aria-label": loading ? "Loading" : "Classic Homes",
|
|
1895
|
+
...props,
|
|
1896
|
+
children: [
|
|
1897
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
1898
|
+
"svg",
|
|
1899
|
+
{
|
|
1900
|
+
width: "100%",
|
|
1901
|
+
height: "100%",
|
|
1902
|
+
viewBox: "-1 0 26 25",
|
|
1903
|
+
fill: "none",
|
|
1904
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1905
|
+
"aria-hidden": "true",
|
|
1906
|
+
children: [
|
|
1907
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("g", { fill: fillColor, className: "transition-all duration-300", children: logoPaths.map((path, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: path }, i)) }),
|
|
1908
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1909
|
+
"g",
|
|
1910
|
+
{
|
|
1911
|
+
fill: "none",
|
|
1912
|
+
stroke: strokeColor,
|
|
1913
|
+
strokeWidth: "0.5",
|
|
1914
|
+
strokeDasharray: "10 4",
|
|
1915
|
+
className: "animate-trace",
|
|
1916
|
+
children: logoPaths.map((path, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: path }, i))
|
|
1917
|
+
}
|
|
1918
|
+
)
|
|
1919
|
+
]
|
|
1920
|
+
}
|
|
1921
|
+
),
|
|
1922
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "sr-only", children: "Loading" })
|
|
1923
|
+
]
|
|
1924
|
+
}
|
|
1925
|
+
);
|
|
1926
|
+
}
|
|
1927
|
+
);
|
|
1928
|
+
LoadingLogo.displayName = "LoadingLogo";
|
|
1929
|
+
|
|
1930
|
+
// src/components/ProgressBar.tsx
|
|
1931
|
+
var React17 = __toESM(require("react"));
|
|
1932
|
+
var import_class_variance_authority7 = require("class-variance-authority");
|
|
1933
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1934
|
+
var progressBarVariants = (0, import_class_variance_authority7.cva)("w-full overflow-hidden rounded-full bg-muted", {
|
|
1935
|
+
variants: {
|
|
1936
|
+
size: {
|
|
1937
|
+
sm: "h-1",
|
|
1938
|
+
md: "h-2",
|
|
1939
|
+
lg: "h-3"
|
|
1940
|
+
}
|
|
1941
|
+
},
|
|
1942
|
+
defaultVariants: {
|
|
1943
|
+
size: "md"
|
|
1944
|
+
}
|
|
1945
|
+
});
|
|
1946
|
+
var progressFillVariants = (0, import_class_variance_authority7.cva)("h-full rounded-full transition-all duration-300", {
|
|
1947
|
+
variants: {
|
|
1948
|
+
variant: {
|
|
1949
|
+
default: "bg-primary",
|
|
1950
|
+
success: "bg-success",
|
|
1951
|
+
warning: "bg-warning",
|
|
1952
|
+
destructive: "bg-destructive"
|
|
1953
|
+
}
|
|
1954
|
+
},
|
|
1955
|
+
defaultVariants: {
|
|
1956
|
+
variant: "default"
|
|
1957
|
+
}
|
|
1958
|
+
});
|
|
1959
|
+
var ProgressBar = React17.forwardRef(
|
|
1960
|
+
({ className, size, variant, value, max = 100, label = "Progress", showValue = false, ...props }, ref) => {
|
|
1961
|
+
const isIndeterminate = value === void 0;
|
|
1962
|
+
const clampedValue = isIndeterminate ? 0 : Math.min(Math.max(0, value), max);
|
|
1963
|
+
const percentage = isIndeterminate ? 0 : Math.round(clampedValue / max * 100);
|
|
1964
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1965
|
+
"div",
|
|
1966
|
+
{
|
|
1967
|
+
ref,
|
|
1968
|
+
role: "progressbar",
|
|
1969
|
+
"aria-label": label,
|
|
1970
|
+
"aria-valuenow": isIndeterminate ? void 0 : clampedValue,
|
|
1971
|
+
"aria-valuemin": 0,
|
|
1972
|
+
"aria-valuemax": max,
|
|
1973
|
+
className: cn("flex items-center gap-2", className),
|
|
1974
|
+
...props,
|
|
1975
|
+
children: [
|
|
1976
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: cn(progressBarVariants({ size })), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1977
|
+
"div",
|
|
1978
|
+
{
|
|
1979
|
+
className: cn(
|
|
1980
|
+
progressFillVariants({ variant }),
|
|
1981
|
+
isIndeterminate && "w-1/4 animate-progress-indeterminate"
|
|
1982
|
+
),
|
|
1983
|
+
style: isIndeterminate ? void 0 : { width: `${percentage}%` }
|
|
1984
|
+
}
|
|
1985
|
+
) }),
|
|
1986
|
+
showValue && !isIndeterminate && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "text-sm tabular-nums text-muted-foreground", children: [
|
|
1987
|
+
percentage,
|
|
1988
|
+
"%"
|
|
1989
|
+
] })
|
|
1990
|
+
]
|
|
1991
|
+
}
|
|
1992
|
+
);
|
|
1993
|
+
}
|
|
1994
|
+
);
|
|
1995
|
+
ProgressBar.displayName = "ProgressBar";
|
|
1996
|
+
|
|
1997
|
+
// src/components/LoadingOverlay.tsx
|
|
1998
|
+
var React18 = __toESM(require("react"));
|
|
1999
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2000
|
+
var spinnerSizeMap = { sm: "sm", md: "md", lg: "lg", xl: "xl" };
|
|
2001
|
+
var logoSizeMap = { sm: 32, md: 40, lg: 56, xl: 80 };
|
|
2002
|
+
var LoadingOverlay = React18.forwardRef(
|
|
2003
|
+
({
|
|
2004
|
+
loading = true,
|
|
2005
|
+
variant = "spinner",
|
|
2006
|
+
mode = "overlay",
|
|
2007
|
+
size = "md",
|
|
2008
|
+
message,
|
|
2009
|
+
progress,
|
|
2010
|
+
blur = true,
|
|
2011
|
+
opaque = false,
|
|
2012
|
+
delay = 0,
|
|
2013
|
+
className,
|
|
2014
|
+
children,
|
|
2015
|
+
...props
|
|
2016
|
+
}, ref) => {
|
|
2017
|
+
const [visible, setVisible] = React18.useState(delay === 0 && loading);
|
|
2018
|
+
React18.useEffect(() => {
|
|
2019
|
+
if (!loading) {
|
|
2020
|
+
setVisible(false);
|
|
2021
|
+
return;
|
|
2022
|
+
}
|
|
2023
|
+
if (delay === 0) {
|
|
2024
|
+
setVisible(true);
|
|
2025
|
+
return;
|
|
2026
|
+
}
|
|
2027
|
+
const timer = setTimeout(() => setVisible(true), delay);
|
|
2028
|
+
return () => clearTimeout(timer);
|
|
2029
|
+
}, [loading, delay]);
|
|
2030
|
+
if (!visible) {
|
|
2031
|
+
return mode === "inline" ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jsx_runtime17.Fragment, { children });
|
|
2032
|
+
}
|
|
2033
|
+
const indicator = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
2034
|
+
variant === "spinner" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Spinner, { size: spinnerSizeMap[size] }),
|
|
2035
|
+
variant === "logo" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LoadingLogo, { loading: true, width: logoSizeMap[size], height: logoSizeMap[size] }),
|
|
2036
|
+
variant === "progress" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ProgressBar, { value: progress, className: "w-48 max-w-full" }),
|
|
2037
|
+
variant === "skeleton" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w-full space-y-3", children: [
|
|
2038
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Skeleton, { variant: "title" }),
|
|
2039
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Skeleton, { variant: "text" }),
|
|
2040
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Skeleton, { variant: "text" }),
|
|
2041
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Skeleton, { variant: "text", className: "w-2/3" })
|
|
2042
|
+
] }),
|
|
2043
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "mt-2 text-sm text-muted-foreground animate-pulse-subtle", children: message }),
|
|
2044
|
+
!message && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "sr-only", children: "Loading" })
|
|
2045
|
+
] });
|
|
2046
|
+
if (mode === "inline") {
|
|
2047
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2048
|
+
"div",
|
|
2049
|
+
{
|
|
2050
|
+
ref,
|
|
2051
|
+
role: "status",
|
|
2052
|
+
"aria-live": "polite",
|
|
2053
|
+
className: cn("inline-flex items-center gap-2", className),
|
|
2054
|
+
...props,
|
|
2055
|
+
children: indicator
|
|
2056
|
+
}
|
|
2057
|
+
);
|
|
2058
|
+
}
|
|
2059
|
+
const bgClass = opaque ? "bg-background" : mode === "fullscreen" ? "bg-background/80" : "bg-background/60";
|
|
2060
|
+
const positionClass = mode === "fullscreen" ? "fixed inset-0 z-50" : "absolute inset-0 z-10";
|
|
2061
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
2062
|
+
children,
|
|
2063
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2064
|
+
"div",
|
|
2065
|
+
{
|
|
2066
|
+
ref,
|
|
2067
|
+
role: "status",
|
|
2068
|
+
"aria-live": "polite",
|
|
2069
|
+
className: cn(
|
|
2070
|
+
positionClass,
|
|
2071
|
+
bgClass,
|
|
2072
|
+
blur && "backdrop-blur-sm",
|
|
2073
|
+
"flex flex-col items-center justify-center",
|
|
2074
|
+
className
|
|
2075
|
+
),
|
|
2076
|
+
...props,
|
|
2077
|
+
children: indicator
|
|
2078
|
+
}
|
|
2079
|
+
)
|
|
2080
|
+
] });
|
|
2081
|
+
}
|
|
2082
|
+
);
|
|
2083
|
+
LoadingOverlay.displayName = "LoadingOverlay";
|
|
2084
|
+
|
|
2085
|
+
// src/components/LoadingPage.tsx
|
|
2086
|
+
var React19 = __toESM(require("react"));
|
|
2087
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2088
|
+
var LoadingPage = React19.forwardRef(
|
|
2089
|
+
({
|
|
2090
|
+
loading = true,
|
|
2091
|
+
message,
|
|
2092
|
+
progress,
|
|
2093
|
+
showLogo = true,
|
|
2094
|
+
logoVariant = "dark",
|
|
2095
|
+
delay = 200,
|
|
2096
|
+
className,
|
|
2097
|
+
...props
|
|
2098
|
+
}, ref) => {
|
|
2099
|
+
const [visible, setVisible] = React19.useState(delay === 0 && loading);
|
|
2100
|
+
React19.useEffect(() => {
|
|
2101
|
+
if (!loading) {
|
|
2102
|
+
setVisible(false);
|
|
2103
|
+
return;
|
|
2104
|
+
}
|
|
2105
|
+
if (delay === 0) {
|
|
2106
|
+
setVisible(true);
|
|
2107
|
+
return;
|
|
2108
|
+
}
|
|
2109
|
+
const timer = setTimeout(() => setVisible(true), delay);
|
|
2110
|
+
return () => clearTimeout(timer);
|
|
2111
|
+
}, [loading, delay]);
|
|
2112
|
+
if (!visible) return null;
|
|
2113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2114
|
+
"div",
|
|
2115
|
+
{
|
|
2116
|
+
ref,
|
|
2117
|
+
role: "status",
|
|
2118
|
+
"aria-live": "polite",
|
|
2119
|
+
className: cn(
|
|
2120
|
+
"fixed inset-0 z-50 flex flex-col items-center justify-center bg-background",
|
|
2121
|
+
className
|
|
2122
|
+
),
|
|
2123
|
+
...props,
|
|
2124
|
+
children: [
|
|
2125
|
+
showLogo ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(LoadingLogo, { loading: true, width: 64, height: 64, variant: logoVariant }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Spinner, { size: "xl" }),
|
|
2126
|
+
progress !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ProgressBar, { value: progress, className: "mt-6 w-48 max-w-full" }),
|
|
2127
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "mt-4 text-sm text-muted-foreground animate-pulse-subtle", children: message }),
|
|
2128
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "sr-only", children: [
|
|
2129
|
+
message || "Loading",
|
|
2130
|
+
progress !== void 0 && `, ${Math.round(progress)}% complete`
|
|
2131
|
+
] })
|
|
2132
|
+
]
|
|
2133
|
+
}
|
|
2134
|
+
);
|
|
2135
|
+
}
|
|
2136
|
+
);
|
|
2137
|
+
LoadingPage.displayName = "LoadingPage";
|
|
2138
|
+
|
|
2139
|
+
// src/components/LoadingSection.tsx
|
|
2140
|
+
var React20 = __toESM(require("react"));
|
|
2141
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2142
|
+
var LoadingSection = React20.forwardRef(
|
|
2143
|
+
({
|
|
2144
|
+
loading = false,
|
|
2145
|
+
variant = "spinner",
|
|
2146
|
+
message,
|
|
2147
|
+
progress,
|
|
2148
|
+
minHeight = "12rem",
|
|
2149
|
+
blur = true,
|
|
2150
|
+
delay = 0,
|
|
2151
|
+
className,
|
|
2152
|
+
children,
|
|
2153
|
+
...props
|
|
2154
|
+
}, ref) => {
|
|
2155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2156
|
+
"div",
|
|
2157
|
+
{
|
|
2158
|
+
ref,
|
|
2159
|
+
className: cn("relative", className),
|
|
2160
|
+
style: { minHeight },
|
|
2161
|
+
"aria-busy": loading,
|
|
2162
|
+
...props,
|
|
2163
|
+
children: [
|
|
2164
|
+
children,
|
|
2165
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2166
|
+
LoadingOverlay,
|
|
2167
|
+
{
|
|
2168
|
+
mode: "overlay",
|
|
2169
|
+
variant,
|
|
2170
|
+
message,
|
|
2171
|
+
progress,
|
|
2172
|
+
blur,
|
|
2173
|
+
delay
|
|
2174
|
+
}
|
|
2175
|
+
)
|
|
2176
|
+
]
|
|
2177
|
+
}
|
|
2178
|
+
);
|
|
2179
|
+
}
|
|
2180
|
+
);
|
|
2181
|
+
LoadingSection.displayName = "LoadingSection";
|
|
2182
|
+
|
|
2183
|
+
// src/components/LiveRegion.tsx
|
|
2184
|
+
var React21 = __toESM(require("react"));
|
|
2185
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2186
|
+
var LiveRegion = React21.forwardRef(
|
|
2187
|
+
({ message, politeness = "polite", atomic = true, visuallyHidden = true, className, children }, ref) => {
|
|
2188
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2189
|
+
"div",
|
|
2190
|
+
{
|
|
2191
|
+
ref,
|
|
2192
|
+
role: "status",
|
|
2193
|
+
"aria-live": politeness,
|
|
2194
|
+
"aria-atomic": atomic,
|
|
2195
|
+
className: cn(
|
|
2196
|
+
visuallyHidden && "sr-only absolute h-px w-px overflow-hidden whitespace-nowrap border-0 p-0",
|
|
2197
|
+
className
|
|
2198
|
+
),
|
|
2199
|
+
children: message || children
|
|
2200
|
+
}
|
|
2201
|
+
);
|
|
2202
|
+
}
|
|
2203
|
+
);
|
|
2204
|
+
LiveRegion.displayName = "LiveRegion";
|
|
2205
|
+
|
|
2206
|
+
// src/components/SkipLink.tsx
|
|
2207
|
+
var React22 = __toESM(require("react"));
|
|
2208
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2209
|
+
var SkipLink = React22.forwardRef(
|
|
2210
|
+
({ targetId, className, children = "Skip to main content", ...props }, ref) => {
|
|
2211
|
+
const handleClick = (e) => {
|
|
2212
|
+
e.preventDefault();
|
|
2213
|
+
const target = document.getElementById(targetId);
|
|
2214
|
+
if (target) {
|
|
2215
|
+
if (target.tabIndex === -1) {
|
|
2216
|
+
target.setAttribute("tabindex", "-1");
|
|
2217
|
+
}
|
|
2218
|
+
target.focus();
|
|
2219
|
+
target.scrollIntoView();
|
|
2220
|
+
} else if (process.env.NODE_ENV !== "production") {
|
|
2221
|
+
console.warn(
|
|
2222
|
+
`SkipLink: Target element with id="${targetId}" not found. Ensure the target element exists and has the correct id attribute.`
|
|
2223
|
+
);
|
|
2224
|
+
}
|
|
2225
|
+
props.onClick?.(e);
|
|
2226
|
+
};
|
|
2227
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2228
|
+
"a",
|
|
2229
|
+
{
|
|
2230
|
+
ref,
|
|
2231
|
+
href: `#${targetId}`,
|
|
2232
|
+
className: cn("skip-link", className),
|
|
2233
|
+
onClick: handleClick,
|
|
2234
|
+
...props,
|
|
2235
|
+
children
|
|
2236
|
+
}
|
|
2237
|
+
);
|
|
2238
|
+
}
|
|
2239
|
+
);
|
|
2240
|
+
SkipLink.displayName = "SkipLink";
|
|
2241
|
+
|
|
2242
|
+
// src/hooks/useFocusTrap.ts
|
|
2243
|
+
var import_react = require("react");
|
|
2244
|
+
var FOCUSABLE_SELECTOR = [
|
|
2245
|
+
"a[href]",
|
|
2246
|
+
"area[href]",
|
|
2247
|
+
'input:not([disabled]):not([type="hidden"])',
|
|
2248
|
+
"select:not([disabled])",
|
|
2249
|
+
"textarea:not([disabled])",
|
|
2250
|
+
"button:not([disabled])",
|
|
2251
|
+
"iframe",
|
|
2252
|
+
"object",
|
|
2253
|
+
"embed",
|
|
2254
|
+
"[contenteditable]",
|
|
2255
|
+
'[tabindex]:not([tabindex="-1"])'
|
|
2256
|
+
].join(",");
|
|
2257
|
+
function getFocusableElements(container) {
|
|
2258
|
+
const elements = container.querySelectorAll(FOCUSABLE_SELECTOR);
|
|
2259
|
+
return Array.from(elements).filter(
|
|
2260
|
+
(el) => el.offsetParent !== null && getComputedStyle(el).visibility !== "hidden"
|
|
2261
|
+
);
|
|
2262
|
+
}
|
|
2263
|
+
function useFocusTrap(options = {}) {
|
|
2264
|
+
const { active = true, returnFocusTo, initialFocus, preventScroll = false } = options;
|
|
2265
|
+
const containerRef = (0, import_react.useRef)(null);
|
|
2266
|
+
const previousActiveElementRef = (0, import_react.useRef)(null);
|
|
2267
|
+
const handleKeyDown = (0, import_react.useCallback)(
|
|
2268
|
+
(event) => {
|
|
2269
|
+
if (!active || event.key !== "Tab") return;
|
|
2270
|
+
const container = containerRef.current;
|
|
2271
|
+
if (!container) return;
|
|
2272
|
+
const focusableElements = getFocusableElements(container);
|
|
2273
|
+
if (focusableElements.length === 0) return;
|
|
2274
|
+
const firstElement = focusableElements[0];
|
|
2275
|
+
const lastElement = focusableElements[focusableElements.length - 1];
|
|
2276
|
+
if (event.shiftKey) {
|
|
2277
|
+
if (document.activeElement === firstElement) {
|
|
2278
|
+
event.preventDefault();
|
|
2279
|
+
lastElement.focus({ preventScroll });
|
|
2280
|
+
}
|
|
2281
|
+
} else {
|
|
2282
|
+
if (document.activeElement === lastElement) {
|
|
2283
|
+
event.preventDefault();
|
|
2284
|
+
firstElement.focus({ preventScroll });
|
|
2285
|
+
}
|
|
2286
|
+
}
|
|
2287
|
+
},
|
|
2288
|
+
[active, preventScroll]
|
|
2289
|
+
);
|
|
2290
|
+
(0, import_react.useEffect)(() => {
|
|
2291
|
+
if (!active) return;
|
|
2292
|
+
const container = containerRef.current;
|
|
2293
|
+
if (!container) return;
|
|
2294
|
+
previousActiveElementRef.current = document.activeElement;
|
|
2295
|
+
const focusableElements = getFocusableElements(container);
|
|
2296
|
+
if (focusableElements.length > 0) {
|
|
2297
|
+
let elementToFocus = null;
|
|
2298
|
+
if (initialFocus) {
|
|
2299
|
+
elementToFocus = container.querySelector(initialFocus);
|
|
2300
|
+
}
|
|
2301
|
+
if (!elementToFocus) {
|
|
2302
|
+
elementToFocus = focusableElements[0];
|
|
2303
|
+
}
|
|
2304
|
+
requestAnimationFrame(() => {
|
|
2305
|
+
elementToFocus?.focus({ preventScroll });
|
|
2306
|
+
});
|
|
2307
|
+
}
|
|
2308
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
2309
|
+
return () => {
|
|
2310
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
2311
|
+
const elementToReturn = returnFocusTo ?? previousActiveElementRef.current;
|
|
2312
|
+
if (elementToReturn && typeof elementToReturn.focus === "function") {
|
|
2313
|
+
elementToReturn.focus({ preventScroll });
|
|
2314
|
+
}
|
|
2315
|
+
};
|
|
2316
|
+
}, [active, initialFocus, returnFocusTo, handleKeyDown, preventScroll]);
|
|
2317
|
+
return containerRef;
|
|
2318
|
+
}
|
|
2319
|
+
|
|
2320
|
+
// src/hooks/useFocusRef.ts
|
|
2321
|
+
var import_react2 = require("react");
|
|
2322
|
+
function useFocusRef(options = {}) {
|
|
2323
|
+
const { focusOnMount = false, preventScroll = false, delay = 0 } = options;
|
|
2324
|
+
const ref = (0, import_react2.useRef)(null);
|
|
2325
|
+
(0, import_react2.useEffect)(() => {
|
|
2326
|
+
if (!focusOnMount) return;
|
|
2327
|
+
const focus = () => {
|
|
2328
|
+
if (ref.current && typeof ref.current.focus === "function") {
|
|
2329
|
+
ref.current.focus({ preventScroll });
|
|
2330
|
+
}
|
|
2331
|
+
};
|
|
2332
|
+
if (delay > 0) {
|
|
2333
|
+
const timer = setTimeout(focus, delay);
|
|
2334
|
+
return () => clearTimeout(timer);
|
|
2335
|
+
} else {
|
|
2336
|
+
const frame = requestAnimationFrame(focus);
|
|
2337
|
+
return () => cancelAnimationFrame(frame);
|
|
2338
|
+
}
|
|
2339
|
+
}, [focusOnMount, preventScroll, delay]);
|
|
2340
|
+
return ref;
|
|
2341
|
+
}
|
|
2342
|
+
|
|
2343
|
+
// src/hooks/useReducedMotion.ts
|
|
2344
|
+
var import_react3 = require("react");
|
|
2345
|
+
function useReducedMotion() {
|
|
2346
|
+
const [reducedMotion, setReducedMotion] = (0, import_react3.useState)(false);
|
|
2347
|
+
(0, import_react3.useEffect)(() => {
|
|
2348
|
+
const mediaQuery = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
2349
|
+
setReducedMotion(mediaQuery.matches);
|
|
2350
|
+
const handleChange = (event) => {
|
|
2351
|
+
setReducedMotion(event.matches);
|
|
2352
|
+
};
|
|
2353
|
+
mediaQuery.addEventListener("change", handleChange);
|
|
2354
|
+
return () => {
|
|
2355
|
+
mediaQuery.removeEventListener("change", handleChange);
|
|
2356
|
+
};
|
|
2357
|
+
}, []);
|
|
2358
|
+
return reducedMotion;
|
|
2359
|
+
}
|
|
2360
|
+
|
|
2361
|
+
// src/hooks/useArrowNavigation.ts
|
|
2362
|
+
var import_react4 = require("react");
|
|
2363
|
+
var DEFAULT_SELECTOR = '[role="menuitem"], [role="option"], [role="tab"], button, a, [tabindex]:not([tabindex="-1"])';
|
|
2364
|
+
function useArrowNavigation(options = {}) {
|
|
2365
|
+
const {
|
|
2366
|
+
orientation = "vertical",
|
|
2367
|
+
loop = true,
|
|
2368
|
+
itemSelector = DEFAULT_SELECTOR,
|
|
2369
|
+
onFocusChange
|
|
2370
|
+
} = options;
|
|
2371
|
+
const containerRef = (0, import_react4.useRef)(null);
|
|
2372
|
+
const focusedIndexRef = (0, import_react4.useRef)(-1);
|
|
2373
|
+
const getFocusableItems = (0, import_react4.useCallback)(() => {
|
|
2374
|
+
if (!containerRef.current) return [];
|
|
2375
|
+
return Array.from(containerRef.current.querySelectorAll(itemSelector));
|
|
2376
|
+
}, [itemSelector]);
|
|
2377
|
+
const focusItem = (0, import_react4.useCallback)(
|
|
2378
|
+
(index) => {
|
|
2379
|
+
const items = getFocusableItems();
|
|
2380
|
+
if (items.length === 0) return;
|
|
2381
|
+
let targetIndex = index;
|
|
2382
|
+
if (loop) {
|
|
2383
|
+
if (targetIndex < 0) targetIndex = items.length - 1;
|
|
2384
|
+
if (targetIndex >= items.length) targetIndex = 0;
|
|
2385
|
+
} else {
|
|
2386
|
+
targetIndex = Math.max(0, Math.min(targetIndex, items.length - 1));
|
|
2387
|
+
}
|
|
2388
|
+
const element = items[targetIndex];
|
|
2389
|
+
if (element) {
|
|
2390
|
+
element.focus();
|
|
2391
|
+
focusedIndexRef.current = targetIndex;
|
|
2392
|
+
onFocusChange?.(targetIndex, element);
|
|
2393
|
+
}
|
|
2394
|
+
},
|
|
2395
|
+
[getFocusableItems, loop, onFocusChange]
|
|
2396
|
+
);
|
|
2397
|
+
const handleKeyDown = (0, import_react4.useCallback)(
|
|
2398
|
+
(event) => {
|
|
2399
|
+
const items = getFocusableItems();
|
|
2400
|
+
if (items.length === 0) return;
|
|
2401
|
+
const currentIndex = focusedIndexRef.current;
|
|
2402
|
+
let handled = false;
|
|
2403
|
+
switch (event.key) {
|
|
2404
|
+
case "ArrowUp":
|
|
2405
|
+
if (orientation === "vertical" || orientation === "both") {
|
|
2406
|
+
focusItem(currentIndex - 1);
|
|
2407
|
+
handled = true;
|
|
2408
|
+
}
|
|
2409
|
+
break;
|
|
2410
|
+
case "ArrowDown":
|
|
2411
|
+
if (orientation === "vertical" || orientation === "both") {
|
|
2412
|
+
focusItem(currentIndex + 1);
|
|
2413
|
+
handled = true;
|
|
2414
|
+
}
|
|
2415
|
+
break;
|
|
2416
|
+
case "ArrowLeft":
|
|
2417
|
+
if (orientation === "horizontal" || orientation === "both") {
|
|
2418
|
+
focusItem(currentIndex - 1);
|
|
2419
|
+
handled = true;
|
|
2420
|
+
}
|
|
2421
|
+
break;
|
|
2422
|
+
case "ArrowRight":
|
|
2423
|
+
if (orientation === "horizontal" || orientation === "both") {
|
|
2424
|
+
focusItem(currentIndex + 1);
|
|
2425
|
+
handled = true;
|
|
2426
|
+
}
|
|
2427
|
+
break;
|
|
2428
|
+
case "Home":
|
|
2429
|
+
focusItem(0);
|
|
2430
|
+
handled = true;
|
|
2431
|
+
break;
|
|
2432
|
+
case "End":
|
|
2433
|
+
focusItem(items.length - 1);
|
|
2434
|
+
handled = true;
|
|
2435
|
+
break;
|
|
2436
|
+
}
|
|
2437
|
+
if (handled) {
|
|
2438
|
+
event.preventDefault();
|
|
2439
|
+
event.stopPropagation();
|
|
2440
|
+
}
|
|
2441
|
+
},
|
|
2442
|
+
[orientation, focusItem, getFocusableItems]
|
|
2443
|
+
);
|
|
2444
|
+
const handleFocus = (0, import_react4.useCallback)(
|
|
2445
|
+
(event) => {
|
|
2446
|
+
const items = getFocusableItems();
|
|
2447
|
+
const index = items.indexOf(event.target);
|
|
2448
|
+
if (index !== -1) {
|
|
2449
|
+
focusedIndexRef.current = index;
|
|
2450
|
+
}
|
|
2451
|
+
},
|
|
2452
|
+
[getFocusableItems]
|
|
2453
|
+
);
|
|
2454
|
+
const containerProps = {
|
|
2455
|
+
ref: (node) => {
|
|
2456
|
+
containerRef.current = node;
|
|
2457
|
+
},
|
|
2458
|
+
onKeyDown: handleKeyDown,
|
|
2459
|
+
onFocus: handleFocus
|
|
2460
|
+
};
|
|
2461
|
+
const getItemProps = (0, import_react4.useCallback)(
|
|
2462
|
+
(index) => ({
|
|
2463
|
+
tabIndex: index === 0 ? 0 : -1,
|
|
2464
|
+
onFocus: () => {
|
|
2465
|
+
focusedIndexRef.current = index;
|
|
2466
|
+
}
|
|
2467
|
+
}),
|
|
2468
|
+
[]
|
|
2469
|
+
);
|
|
2470
|
+
return {
|
|
2471
|
+
containerProps,
|
|
2472
|
+
getItemProps,
|
|
2473
|
+
focusItem,
|
|
2474
|
+
getFocusedIndex: () => focusedIndexRef.current
|
|
2475
|
+
};
|
|
2476
|
+
}
|
|
2477
|
+
|
|
2478
|
+
// src/hooks/useRovingTabindex.ts
|
|
2479
|
+
var import_react5 = require("react");
|
|
2480
|
+
var DEFAULT_SELECTOR2 = "[data-roving-tabindex-item]";
|
|
2481
|
+
function useRovingTabindex(options = {}) {
|
|
2482
|
+
const { loop = true, itemSelector = DEFAULT_SELECTOR2, initialIndex = 0, onIndexChange } = options;
|
|
2483
|
+
const [activeIndex, setActiveIndex] = (0, import_react5.useState)(initialIndex);
|
|
2484
|
+
const containerRef = (0, import_react5.useRef)(null);
|
|
2485
|
+
const itemsRef = (0, import_react5.useRef)(/* @__PURE__ */ new Map());
|
|
2486
|
+
const getItems = (0, import_react5.useCallback)(() => {
|
|
2487
|
+
if (!containerRef.current) {
|
|
2488
|
+
return Array.from(itemsRef.current.values());
|
|
2489
|
+
}
|
|
2490
|
+
return Array.from(containerRef.current.querySelectorAll(itemSelector));
|
|
2491
|
+
}, [itemSelector]);
|
|
2492
|
+
const focusIndex = (0, import_react5.useCallback)(
|
|
2493
|
+
(index) => {
|
|
2494
|
+
const items = getItems();
|
|
2495
|
+
if (items.length === 0) return;
|
|
2496
|
+
let targetIndex = index;
|
|
2497
|
+
if (loop) {
|
|
2498
|
+
if (targetIndex < 0) targetIndex = items.length - 1;
|
|
2499
|
+
if (targetIndex >= items.length) targetIndex = 0;
|
|
2500
|
+
} else {
|
|
2501
|
+
targetIndex = Math.max(0, Math.min(targetIndex, items.length - 1));
|
|
2502
|
+
}
|
|
2503
|
+
setActiveIndex(targetIndex);
|
|
2504
|
+
onIndexChange?.(targetIndex);
|
|
2505
|
+
const element = items[targetIndex];
|
|
2506
|
+
if (element) {
|
|
2507
|
+
element.focus();
|
|
2508
|
+
}
|
|
2509
|
+
},
|
|
2510
|
+
[getItems, loop, onIndexChange]
|
|
2511
|
+
);
|
|
2512
|
+
const handleKeyDown = (0, import_react5.useCallback)(
|
|
2513
|
+
(event) => {
|
|
2514
|
+
const items = getItems();
|
|
2515
|
+
if (items.length === 0) return;
|
|
2516
|
+
let handled = false;
|
|
2517
|
+
switch (event.key) {
|
|
2518
|
+
case "ArrowUp":
|
|
2519
|
+
case "ArrowLeft":
|
|
2520
|
+
focusIndex(activeIndex - 1);
|
|
2521
|
+
handled = true;
|
|
2522
|
+
break;
|
|
2523
|
+
case "ArrowDown":
|
|
2524
|
+
case "ArrowRight":
|
|
2525
|
+
focusIndex(activeIndex + 1);
|
|
2526
|
+
handled = true;
|
|
2527
|
+
break;
|
|
2528
|
+
case "Home":
|
|
2529
|
+
focusIndex(0);
|
|
2530
|
+
handled = true;
|
|
2531
|
+
break;
|
|
2532
|
+
case "End":
|
|
2533
|
+
focusIndex(items.length - 1);
|
|
2534
|
+
handled = true;
|
|
2535
|
+
break;
|
|
2536
|
+
}
|
|
2537
|
+
if (handled) {
|
|
2538
|
+
event.preventDefault();
|
|
2539
|
+
event.stopPropagation();
|
|
2540
|
+
}
|
|
2541
|
+
},
|
|
2542
|
+
[activeIndex, focusIndex, getItems]
|
|
2543
|
+
);
|
|
2544
|
+
const containerProps = {
|
|
2545
|
+
ref: (node) => {
|
|
2546
|
+
containerRef.current = node;
|
|
2547
|
+
},
|
|
2548
|
+
onKeyDown: handleKeyDown
|
|
2549
|
+
};
|
|
2550
|
+
const getItemProps = (0, import_react5.useCallback)(
|
|
2551
|
+
(index) => ({
|
|
2552
|
+
"data-roving-tabindex-item": true,
|
|
2553
|
+
tabIndex: index === activeIndex ? 0 : -1,
|
|
2554
|
+
ref: (node) => {
|
|
2555
|
+
if (node) {
|
|
2556
|
+
itemsRef.current.set(index, node);
|
|
2557
|
+
} else {
|
|
2558
|
+
itemsRef.current.delete(index);
|
|
2559
|
+
}
|
|
2560
|
+
},
|
|
2561
|
+
onClick: () => {
|
|
2562
|
+
setActiveIndex(index);
|
|
2563
|
+
onIndexChange?.(index);
|
|
2564
|
+
},
|
|
2565
|
+
onFocus: () => {
|
|
2566
|
+
if (activeIndex !== index) {
|
|
2567
|
+
setActiveIndex(index);
|
|
2568
|
+
onIndexChange?.(index);
|
|
2569
|
+
}
|
|
2570
|
+
}
|
|
2571
|
+
}),
|
|
2572
|
+
[activeIndex, onIndexChange]
|
|
2573
|
+
);
|
|
2574
|
+
return {
|
|
2575
|
+
containerProps,
|
|
2576
|
+
getItemProps,
|
|
2577
|
+
activeIndex,
|
|
2578
|
+
setActiveIndex: focusIndex,
|
|
2579
|
+
focusNext: () => focusIndex(activeIndex + 1),
|
|
2580
|
+
focusPrevious: () => focusIndex(activeIndex - 1),
|
|
2581
|
+
focusFirst: () => focusIndex(0),
|
|
2582
|
+
focusLast: () => focusIndex(getItems().length - 1)
|
|
2583
|
+
};
|
|
2584
|
+
}
|
|
2585
|
+
|
|
2586
|
+
// src/hooks/useEscapeKey.ts
|
|
2587
|
+
var React23 = __toESM(require("react"));
|
|
2588
|
+
function useEscapeKey(callback, options) {
|
|
2589
|
+
const { enabled = true, preventDefault = true, stopPropagation = false } = options ?? {};
|
|
2590
|
+
const callbackRef = React23.useRef(callback);
|
|
2591
|
+
React23.useEffect(() => {
|
|
2592
|
+
callbackRef.current = callback;
|
|
2593
|
+
}, [callback]);
|
|
2594
|
+
React23.useEffect(() => {
|
|
2595
|
+
if (!enabled) return;
|
|
2596
|
+
const handleKeyDown = (event) => {
|
|
2597
|
+
if (event.key === "Escape") {
|
|
2598
|
+
if (preventDefault) {
|
|
2599
|
+
event.preventDefault();
|
|
2600
|
+
}
|
|
2601
|
+
if (stopPropagation) {
|
|
2602
|
+
event.stopPropagation();
|
|
2603
|
+
}
|
|
2604
|
+
callbackRef.current(event);
|
|
2605
|
+
}
|
|
2606
|
+
};
|
|
2607
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
2608
|
+
return () => {
|
|
2609
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
2610
|
+
};
|
|
2611
|
+
}, [enabled, preventDefault, stopPropagation]);
|
|
2612
|
+
}
|
|
2613
|
+
|
|
2614
|
+
// src/hooks/useClickOutside.ts
|
|
2615
|
+
var React24 = __toESM(require("react"));
|
|
2616
|
+
function useClickOutside(ref, callback, options) {
|
|
2617
|
+
const {
|
|
2618
|
+
enabled = true,
|
|
2619
|
+
events = ["mousedown", "touchstart"],
|
|
2620
|
+
ignoreElements = []
|
|
2621
|
+
} = options ?? {};
|
|
2622
|
+
const callbackRef = React24.useRef(callback);
|
|
2623
|
+
React24.useEffect(() => {
|
|
2624
|
+
callbackRef.current = callback;
|
|
2625
|
+
}, [callback]);
|
|
2626
|
+
React24.useEffect(() => {
|
|
2627
|
+
if (!enabled) return;
|
|
2628
|
+
const handleEvent = (event) => {
|
|
2629
|
+
const target = event.target;
|
|
2630
|
+
if (ref.current?.contains(target)) {
|
|
2631
|
+
return;
|
|
2632
|
+
}
|
|
2633
|
+
for (const ignoreRef of ignoreElements) {
|
|
2634
|
+
if (ignoreRef.current?.contains(target)) {
|
|
2635
|
+
return;
|
|
2636
|
+
}
|
|
2637
|
+
}
|
|
2638
|
+
callbackRef.current(event);
|
|
2639
|
+
};
|
|
2640
|
+
events.forEach((eventType) => {
|
|
2641
|
+
document.addEventListener(eventType, handleEvent);
|
|
2642
|
+
});
|
|
2643
|
+
return () => {
|
|
2644
|
+
events.forEach((eventType) => {
|
|
2645
|
+
document.removeEventListener(eventType, handleEvent);
|
|
2646
|
+
});
|
|
2647
|
+
};
|
|
2648
|
+
}, [enabled, events, ignoreElements, ref]);
|
|
2649
|
+
}
|
|
1400
2650
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1401
2651
|
0 && (module.exports = {
|
|
1402
2652
|
Avatar,
|
|
@@ -1427,9 +2677,18 @@ DataPanel.displayName = "DataPanel";
|
|
|
1427
2677
|
DialogTrigger,
|
|
1428
2678
|
Input,
|
|
1429
2679
|
Label,
|
|
2680
|
+
LiveRegion,
|
|
2681
|
+
LoadingLogo,
|
|
2682
|
+
LoadingOverlay,
|
|
2683
|
+
LoadingPage,
|
|
2684
|
+
LoadingSection,
|
|
1430
2685
|
PageHeader,
|
|
1431
2686
|
PasswordInput,
|
|
2687
|
+
ProgressBar,
|
|
1432
2688
|
Separator,
|
|
2689
|
+
Skeleton,
|
|
2690
|
+
SkipLink,
|
|
2691
|
+
Spinner,
|
|
1433
2692
|
Switch,
|
|
1434
2693
|
badgeVariants,
|
|
1435
2694
|
buttonVariants,
|
|
@@ -1438,5 +2697,16 @@ DataPanel.displayName = "DataPanel";
|
|
|
1438
2697
|
pageHeaderContainerVariants,
|
|
1439
2698
|
pageHeaderSubtitleVariants,
|
|
1440
2699
|
pageHeaderTitleVariants,
|
|
1441
|
-
|
|
2700
|
+
progressBarVariants,
|
|
2701
|
+
skeletonVariants,
|
|
2702
|
+
spinnerVariants,
|
|
2703
|
+
useAnnounce,
|
|
2704
|
+
useArrowNavigation,
|
|
2705
|
+
useClickOutside,
|
|
2706
|
+
useDataPanel,
|
|
2707
|
+
useEscapeKey,
|
|
2708
|
+
useFocusRef,
|
|
2709
|
+
useFocusTrap,
|
|
2710
|
+
useReducedMotion,
|
|
2711
|
+
useRovingTabindex
|
|
1442
2712
|
});
|