@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.mjs CHANGED
@@ -14,20 +14,21 @@ function cn(...inputs) {
14
14
  import { jsx } from "react/jsx-runtime";
15
15
  var buttonVariants = cva(
16
16
  // Base styles - using semantic color system
17
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
17
+ "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",
18
18
  {
19
19
  variants: {
20
20
  variant: {
21
21
  default: "bg-primary text-primary-foreground shadow hover:bg-primary-hover",
22
22
  secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary-hover",
23
- destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive-hover",
24
- outline: "border border-input bg-background shadow-sm hover:bg-accent-hover hover:text-accent-foreground",
25
- ghost: "hover:bg-accent-hover hover:text-accent-foreground",
23
+ destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive-hover focus-visible:ring-destructive",
24
+ outline: "border-2 border-primary text-primary bg-transparent hover:bg-primary hover:text-primary-foreground",
25
+ ghost: "hover:bg-muted-hover hover:text-foreground",
26
26
  link: "text-primary underline-offset-4 hover:underline"
27
27
  },
28
28
  size: {
29
29
  default: "h-10 px-4 py-2",
30
- sm: "h-9 rounded-md px-3 text-xs",
30
+ sm: "h-9 rounded-md px-3 text-sm",
31
+ md: "h-10 px-4 py-2",
31
32
  lg: "h-11 rounded-md px-8",
32
33
  icon: "h-10 w-10"
33
34
  }
@@ -39,9 +40,9 @@ var buttonVariants = cva(
39
40
  }
40
41
  );
41
42
  var Button = React.forwardRef(
42
- ({ className, variant, size, asChild = false, ...props }, ref) => {
43
+ ({ className, variant, size, asChild = false, children, ...props }, ref) => {
43
44
  const Comp = asChild ? Slot : "button";
44
- return /* @__PURE__ */ jsx(Comp, { className: cn(buttonVariants({ variant, size, className })), ref, ...props });
45
+ return /* @__PURE__ */ jsx(Comp, { className: cn(buttonVariants({ variant, size, className })), ref, ...props, children });
45
46
  }
46
47
  );
47
48
  Button.displayName = "Button";
@@ -50,8 +51,8 @@ Button.displayName = "Button";
50
51
  import * as React2 from "react";
51
52
  import { jsx as jsx2 } from "react/jsx-runtime";
52
53
  var Card = React2.forwardRef(
53
- ({ className, ...props }, ref) => /* @__PURE__ */ jsx2(
54
- "div",
54
+ ({ className, as: Component = "div", ...props }, ref) => /* @__PURE__ */ jsx2(
55
+ Component,
55
56
  {
56
57
  ref,
57
58
  className: cn(
@@ -68,8 +69,8 @@ var CardHeader = React2.forwardRef(
68
69
  );
69
70
  CardHeader.displayName = "CardHeader";
70
71
  var CardTitle = React2.forwardRef(
71
- ({ className, ...props }, ref) => /* @__PURE__ */ jsx2(
72
- "h3",
72
+ ({ className, as: Component = "h3", ...props }, ref) => /* @__PURE__ */ jsx2(
73
+ Component,
73
74
  {
74
75
  ref,
75
76
  className: cn("text-2xl font-semibold leading-none tracking-tight", className),
@@ -93,13 +94,32 @@ CardFooter.displayName = "CardFooter";
93
94
  import * as React3 from "react";
94
95
  import { jsx as jsx3 } from "react/jsx-runtime";
95
96
  var Input = React3.forwardRef(
96
- ({ className, type, ...props }, ref) => {
97
+ ({
98
+ className,
99
+ type,
100
+ "aria-invalid": ariaInvalid,
101
+ required,
102
+ "aria-describedby": ariaDescribedBy,
103
+ ...props
104
+ }, ref) => {
105
+ if (process.env.NODE_ENV !== "production") {
106
+ if (!props["aria-label"] && !props["aria-labelledby"] && !props.id) {
107
+ console.warn(
108
+ "Input: Missing accessible label. Provide aria-label, aria-labelledby, or associate with a Label using id/htmlFor for WCAG compliance."
109
+ );
110
+ }
111
+ }
97
112
  return /* @__PURE__ */ jsx3(
98
113
  "input",
99
114
  {
100
115
  type,
116
+ "aria-invalid": ariaInvalid,
117
+ "aria-required": required,
118
+ "aria-describedby": ariaDescribedBy,
119
+ required,
101
120
  className: cn(
102
121
  "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",
122
+ ariaInvalid === true || ariaInvalid === "true" ? "border-destructive focus-visible:ring-destructive" : "",
103
123
  className
104
124
  ),
105
125
  ref,
@@ -111,7 +131,57 @@ var Input = React3.forwardRef(
111
131
  Input.displayName = "Input";
112
132
 
113
133
  // src/components/PasswordInput.tsx
134
+ import * as React5 from "react";
135
+
136
+ // src/hooks/useAnnounce.ts
114
137
  import * as React4 from "react";
138
+ function useAnnounce(defaultOptions) {
139
+ const [message, setMessage] = React4.useState("");
140
+ const [politeness, setPoliteness] = React4.useState(
141
+ defaultOptions?.politeness ?? "polite"
142
+ );
143
+ const clearTimeoutRef = React4.useRef(null);
144
+ const clear = React4.useCallback(() => {
145
+ setMessage("");
146
+ if (clearTimeoutRef.current) {
147
+ clearTimeout(clearTimeoutRef.current);
148
+ clearTimeoutRef.current = null;
149
+ }
150
+ }, []);
151
+ const announce = React4.useCallback(
152
+ (newMessage, options) => {
153
+ if (clearTimeoutRef.current) {
154
+ clearTimeout(clearTimeoutRef.current);
155
+ }
156
+ if (options?.politeness) {
157
+ setPoliteness(options.politeness);
158
+ }
159
+ setMessage(newMessage);
160
+ const delay = options?.clearDelay ?? defaultOptions?.clearDelay ?? 1e3;
161
+ if (delay > 0) {
162
+ clearTimeoutRef.current = setTimeout(() => {
163
+ setMessage("");
164
+ }, delay);
165
+ }
166
+ },
167
+ [defaultOptions?.clearDelay]
168
+ );
169
+ React4.useEffect(() => {
170
+ return () => {
171
+ if (clearTimeoutRef.current) {
172
+ clearTimeout(clearTimeoutRef.current);
173
+ }
174
+ };
175
+ }, []);
176
+ return {
177
+ announce,
178
+ message,
179
+ politeness,
180
+ clear
181
+ };
182
+ }
183
+
184
+ // src/components/PasswordInput.tsx
115
185
  import { jsx as jsx4, jsxs } from "react/jsx-runtime";
116
186
  var EyeIcon = () => /* @__PURE__ */ jsxs(
117
187
  "svg",
@@ -124,6 +194,8 @@ var EyeIcon = () => /* @__PURE__ */ jsxs(
124
194
  strokeWidth: 2,
125
195
  strokeLinecap: "round",
126
196
  strokeLinejoin: "round",
197
+ "aria-hidden": "true",
198
+ focusable: "false",
127
199
  children: [
128
200
  /* @__PURE__ */ jsx4("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
129
201
  /* @__PURE__ */ jsx4("circle", { cx: "12", cy: "12", r: "3" })
@@ -141,20 +213,48 @@ var EyeOffIcon = () => /* @__PURE__ */ jsx4(
141
213
  strokeWidth: 2,
142
214
  strokeLinecap: "round",
143
215
  strokeLinejoin: "round",
216
+ "aria-hidden": "true",
217
+ focusable: "false",
144
218
  children: /* @__PURE__ */ jsx4("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" })
145
219
  }
146
220
  );
147
- var PasswordInput = React4.forwardRef(
148
- ({ className, disabled, showLabel = "Show password", hideLabel = "Hide password", ...props }, ref) => {
149
- const [showPassword, setShowPassword] = React4.useState(false);
221
+ var PasswordInput = React5.forwardRef(
222
+ ({
223
+ className,
224
+ disabled,
225
+ showLabel = "Show password",
226
+ hideLabel = "Hide password",
227
+ visibleAnnouncement = "Password is now visible",
228
+ hiddenAnnouncement = "Password is now hidden",
229
+ id,
230
+ "aria-label": ariaLabel,
231
+ "aria-labelledby": ariaLabelledBy,
232
+ ...props
233
+ }, ref) => {
234
+ const [showPassword, setShowPassword] = React5.useState(false);
235
+ const { announce, message, politeness } = useAnnounce();
236
+ if (process.env.NODE_ENV !== "production") {
237
+ if (!ariaLabel && !ariaLabelledBy && !id) {
238
+ console.warn(
239
+ "PasswordInput: Missing accessible label. Provide aria-label, aria-labelledby, or an id to associate with a Label element for WCAG compliance."
240
+ );
241
+ }
242
+ }
150
243
  const toggleVisibility = () => {
151
- setShowPassword((prev) => !prev);
244
+ setShowPassword((prev) => {
245
+ const newState = !prev;
246
+ announce(newState ? visibleAnnouncement : hiddenAnnouncement);
247
+ return newState;
248
+ });
152
249
  };
153
250
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
154
251
  /* @__PURE__ */ jsx4(
155
252
  "input",
156
253
  {
157
254
  type: showPassword ? "text" : "password",
255
+ id,
256
+ "aria-label": ariaLabel,
257
+ "aria-labelledby": ariaLabelledBy,
158
258
  className: cn(
159
259
  "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",
160
260
  className
@@ -168,140 +268,223 @@ var PasswordInput = React4.forwardRef(
168
268
  "button",
169
269
  {
170
270
  type: "button",
171
- className: "absolute right-0 top-0 h-10 w-10 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 rounded-r-md disabled:pointer-events-none disabled:opacity-50",
271
+ 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",
172
272
  onClick: toggleVisibility,
173
273
  disabled,
174
274
  "aria-label": showPassword ? hideLabel : showLabel,
275
+ "aria-pressed": showPassword,
175
276
  children: showPassword ? /* @__PURE__ */ jsx4(EyeOffIcon, {}) : /* @__PURE__ */ jsx4(EyeIcon, {})
176
277
  }
177
- )
278
+ ),
279
+ /* @__PURE__ */ jsx4("div", { role: "status", "aria-live": politeness, "aria-atomic": "true", className: "sr-only", children: message })
178
280
  ] });
179
281
  }
180
282
  );
181
283
  PasswordInput.displayName = "PasswordInput";
182
284
 
183
285
  // src/components/Label.tsx
184
- import * as React5 from "react";
286
+ import * as React6 from "react";
185
287
  import * as LabelPrimitive from "@radix-ui/react-label";
186
288
  import { cva as cva2 } from "class-variance-authority";
187
289
  import { jsx as jsx5 } from "react/jsx-runtime";
188
290
  var labelVariants = cva2(
189
291
  "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
190
292
  );
191
- var Label = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx5(LabelPrimitive.Root, { ref, className: cn(labelVariants(), className), ...props }));
293
+ var Label = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx5(LabelPrimitive.Root, { ref, className: cn(labelVariants(), className), ...props }));
192
294
  Label.displayName = LabelPrimitive.Root.displayName;
193
295
 
194
296
  // src/components/Badge.tsx
195
- import * as React6 from "react";
297
+ import * as React7 from "react";
196
298
  import { cva as cva3 } from "class-variance-authority";
197
- import { jsx as jsx6 } from "react/jsx-runtime";
299
+ import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
198
300
  var badgeVariants = cva3(
199
- "inline-flex items-center rounded-full border border-border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
301
+ "inline-flex items-center justify-center rounded-md border font-medium w-fit whitespace-nowrap shrink-0 gap-1",
200
302
  {
201
303
  variants: {
202
304
  variant: {
203
- default: "border-transparent bg-primary text-primary-foreground hover:bg-primary-hover",
204
- secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary-hover",
205
- destructive: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive-hover",
206
- outline: "text-foreground"
305
+ default: "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
306
+ secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
307
+ destructive: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
308
+ outline: "text-foreground hover:bg-accent hover:text-accent-foreground",
309
+ success: "border-transparent bg-success text-success-foreground hover:bg-success/80",
310
+ warning: "border-transparent bg-warning text-warning-foreground hover:bg-warning/80",
311
+ info: "border-transparent bg-info text-info-foreground hover:bg-info/80"
312
+ },
313
+ size: {
314
+ default: "px-2 py-0.5 text-xs",
315
+ sm: "px-1.5 py-0.5 text-xs",
316
+ dot: "h-5 w-5 p-0 text-xs"
207
317
  }
208
318
  },
209
319
  defaultVariants: {
210
- variant: "default"
320
+ variant: "default",
321
+ size: "default"
211
322
  }
212
323
  }
213
324
  );
214
- var Badge = React6.forwardRef(
215
- ({ className, variant, ...props }, ref) => {
216
- return /* @__PURE__ */ jsx6(
217
- "div",
218
- {
219
- ref,
220
- role: "status",
221
- className: cn(badgeVariants({ variant }), className),
222
- ...props
325
+ var Badge = React7.forwardRef(
326
+ ({ className, variant, size, live, clickable, label, children, onClick, ...props }, ref) => {
327
+ if (process.env.NODE_ENV !== "production") {
328
+ if (live && !label) {
329
+ console.warn(
330
+ '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).'
331
+ );
223
332
  }
333
+ }
334
+ const isInteractive = clickable || !!onClick;
335
+ const classes = cn(
336
+ badgeVariants({ variant, size }),
337
+ isInteractive && "cursor-pointer focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
338
+ className
224
339
  );
340
+ const sharedProps = {
341
+ role: live ? "status" : void 0,
342
+ "aria-live": live ? "polite" : void 0,
343
+ "aria-atomic": live ? "true" : void 0,
344
+ className: classes,
345
+ ...props
346
+ };
347
+ if (isInteractive) {
348
+ return /* @__PURE__ */ jsxs2(
349
+ "button",
350
+ {
351
+ ref,
352
+ type: "button",
353
+ onClick,
354
+ ...sharedProps,
355
+ children: [
356
+ children,
357
+ label && /* @__PURE__ */ jsx6("span", { className: "sr-only", children: label })
358
+ ]
359
+ }
360
+ );
361
+ }
362
+ return /* @__PURE__ */ jsxs2("span", { ref, ...sharedProps, children: [
363
+ children,
364
+ label && /* @__PURE__ */ jsx6("span", { className: "sr-only", children: label })
365
+ ] });
225
366
  }
226
367
  );
227
368
  Badge.displayName = "Badge";
228
369
 
229
370
  // src/components/Separator.tsx
230
- import * as React7 from "react";
371
+ import * as React8 from "react";
231
372
  import * as SeparatorPrimitive from "@radix-ui/react-separator";
232
373
  import { jsx as jsx7 } from "react/jsx-runtime";
233
- var Separator = React7.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx7(
234
- SeparatorPrimitive.Root,
235
- {
236
- ref,
237
- decorative,
238
- orientation,
239
- className: cn(
240
- "shrink-0 bg-border",
241
- orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
242
- className
243
- ),
244
- ...props
374
+ var Separator = React8.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => {
375
+ if (process.env.NODE_ENV !== "production") {
376
+ if (!decorative && !props["aria-label"]) {
377
+ console.warn(
378
+ "Separator: Non-decorative separators (decorative={false}) should have an aria-label to describe the content they separate."
379
+ );
380
+ }
245
381
  }
246
- ));
382
+ return /* @__PURE__ */ jsx7(
383
+ SeparatorPrimitive.Root,
384
+ {
385
+ ref,
386
+ decorative,
387
+ orientation,
388
+ className: cn(
389
+ "shrink-0 bg-border",
390
+ orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
391
+ className
392
+ ),
393
+ ...props
394
+ }
395
+ );
396
+ });
247
397
  Separator.displayName = SeparatorPrimitive.Root.displayName;
248
398
 
249
399
  // src/components/Switch.tsx
250
- import * as React8 from "react";
400
+ import * as React9 from "react";
251
401
  import * as SwitchPrimitives from "@radix-ui/react-switch";
252
402
  import { jsx as jsx8 } from "react/jsx-runtime";
253
403
  var SwitchRoot = SwitchPrimitives.Root;
254
404
  var SwitchThumb = SwitchPrimitives.Thumb;
255
- var Switch = React8.forwardRef(
256
- ({ className, size = "default", ...props }, ref) => /* @__PURE__ */ jsx8(
257
- SwitchRoot,
258
- {
259
- className: cn(
260
- "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",
261
- size === "default" && "h-7 w-12",
262
- size === "sm" && "h-5 w-9",
263
- className
264
- ),
265
- ref,
266
- ...props,
267
- children: /* @__PURE__ */ jsx8(
268
- SwitchThumb,
269
- {
270
- className: cn(
271
- "pointer-events-none block rounded-full bg-background shadow-lg ring-0 transition-transform",
272
- size === "default" && "h-5 w-5 data-[state=checked]:translate-x-[22px] data-[state=unchecked]:translate-x-0.5",
273
- size === "sm" && "h-4 w-4 data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"
274
- )
275
- }
276
- )
405
+ var Switch = React9.forwardRef(
406
+ ({
407
+ className,
408
+ size = "default",
409
+ "aria-label": ariaLabel,
410
+ "aria-labelledby": ariaLabelledBy,
411
+ "aria-describedby": ariaDescribedBy,
412
+ ...props
413
+ }, ref) => {
414
+ if (process.env.NODE_ENV !== "production") {
415
+ if (!ariaLabel && !ariaLabelledBy && !props.id) {
416
+ console.warn(
417
+ "Switch: Missing accessible label. Provide aria-label, aria-labelledby, or associate with a Label using id/htmlFor for WCAG compliance."
418
+ );
419
+ }
277
420
  }
278
- )
421
+ return /* @__PURE__ */ jsx8(
422
+ SwitchRoot,
423
+ {
424
+ className: cn(
425
+ "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",
426
+ size === "default" && "h-7 w-12",
427
+ size === "sm" && "h-5 w-9",
428
+ className
429
+ ),
430
+ ref,
431
+ "aria-label": ariaLabel,
432
+ "aria-labelledby": ariaLabelledBy,
433
+ "aria-describedby": ariaDescribedBy,
434
+ ...props,
435
+ children: /* @__PURE__ */ jsx8(
436
+ SwitchThumb,
437
+ {
438
+ className: cn(
439
+ "pointer-events-none block rounded-full bg-background shadow-lg ring-0 transition-transform",
440
+ size === "default" && "h-5 w-5 data-[state=checked]:translate-x-[22px] data-[state=unchecked]:translate-x-0.5",
441
+ size === "sm" && "h-4 w-4 data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"
442
+ )
443
+ }
444
+ )
445
+ }
446
+ );
447
+ }
279
448
  );
280
449
  Switch.displayName = SwitchPrimitives.Root.displayName;
281
450
 
282
451
  // src/components/Avatar.tsx
283
- import * as React9 from "react";
452
+ import * as React10 from "react";
284
453
  import * as AvatarPrimitive from "@radix-ui/react-avatar";
285
454
  import { jsx as jsx9 } from "react/jsx-runtime";
286
- var Avatar = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx9(
287
- AvatarPrimitive.Root,
288
- {
289
- ref,
290
- className: cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full", className),
291
- ...props
455
+ var Avatar = React10.forwardRef(
456
+ ({ className, name, "aria-label": ariaLabel, ...props }, ref) => {
457
+ if (process.env.NODE_ENV !== "production") {
458
+ if (!ariaLabel && !name) {
459
+ console.warn(
460
+ 'Avatar: Missing accessible text. Provide either a "name" prop or "aria-label" for screen reader users.'
461
+ );
462
+ }
463
+ }
464
+ const computedAriaLabel = ariaLabel ?? (name ? `Avatar for ${name}` : void 0);
465
+ return /* @__PURE__ */ jsx9(
466
+ AvatarPrimitive.Root,
467
+ {
468
+ ref,
469
+ "aria-label": computedAriaLabel,
470
+ className: cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full", className),
471
+ ...props
472
+ }
473
+ );
292
474
  }
293
- ));
475
+ );
294
476
  Avatar.displayName = AvatarPrimitive.Root.displayName;
295
- var AvatarImage = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx9(
477
+ var AvatarImage = React10.forwardRef(({ className, alt, ...props }, ref) => /* @__PURE__ */ jsx9(
296
478
  AvatarPrimitive.Image,
297
479
  {
298
480
  ref,
481
+ alt,
299
482
  className: cn("aspect-square h-full w-full object-cover", className),
300
483
  ...props
301
484
  }
302
485
  ));
303
486
  AvatarImage.displayName = AvatarPrimitive.Image.displayName;
304
- var AvatarFallback = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx9(
487
+ var AvatarFallback = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx9(
305
488
  AvatarPrimitive.Fallback,
306
489
  {
307
490
  ref,
@@ -315,9 +498,9 @@ var AvatarFallback = React9.forwardRef(({ className, ...props }, ref) => /* @__P
315
498
  AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
316
499
 
317
500
  // src/components/Dialog.tsx
318
- import * as React10 from "react";
501
+ import * as React11 from "react";
319
502
  import * as DialogPrimitive from "@radix-ui/react-dialog";
320
- import { jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
503
+ import { jsx as jsx10, jsxs as jsxs3 } from "react/jsx-runtime";
321
504
  var PrimitiveOverlay = DialogPrimitive.Overlay;
322
505
  var PrimitiveContent = DialogPrimitive.Content;
323
506
  var PrimitiveTitle = DialogPrimitive.Title;
@@ -326,26 +509,35 @@ var Dialog = DialogPrimitive.Root;
326
509
  var DialogTrigger = DialogPrimitive.Trigger;
327
510
  var DialogPortal = DialogPrimitive.Portal;
328
511
  var DialogClose = DialogPrimitive.Close;
329
- var DialogOverlay = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
512
+ var dialogSizeClasses = {
513
+ sm: "max-w-sm",
514
+ md: "max-w-lg",
515
+ lg: "max-w-xl",
516
+ xl: "max-w-2xl",
517
+ "2xl": "max-w-3xl",
518
+ full: "max-w-[calc(100vw-2rem)]"
519
+ };
520
+ var DialogOverlay = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
330
521
  PrimitiveOverlay,
331
522
  {
332
523
  ref,
333
524
  className: cn(
334
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
525
+ "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",
335
526
  className
336
527
  ),
337
528
  ...props
338
529
  }
339
530
  ));
340
531
  DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
341
- var DialogContent = React10.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs2(DialogPortal, { children: [
532
+ var DialogContent = React11.forwardRef(({ className, children, size = "md", ...props }, ref) => /* @__PURE__ */ jsxs3(DialogPortal, { children: [
342
533
  /* @__PURE__ */ jsx10(DialogOverlay, {}),
343
534
  /* @__PURE__ */ jsx10(
344
535
  PrimitiveContent,
345
536
  {
346
537
  ref,
347
538
  className: cn(
348
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg 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",
539
+ "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",
540
+ dialogSizeClasses[size],
349
541
  className
350
542
  ),
351
543
  ...props,
@@ -364,7 +556,7 @@ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx10(
364
556
  }
365
557
  );
366
558
  DialogFooter.displayName = "DialogFooter";
367
- var DialogTitle = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
559
+ var DialogTitle = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
368
560
  PrimitiveTitle,
369
561
  {
370
562
  ref,
@@ -373,7 +565,7 @@ var DialogTitle = React10.forwardRef(({ className, ...props }, ref) => /* @__PUR
373
565
  }
374
566
  ));
375
567
  DialogTitle.displayName = DialogPrimitive.Title.displayName;
376
- var DialogDescription = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
568
+ var DialogDescription = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
377
569
  PrimitiveDescription,
378
570
  {
379
571
  ref,
@@ -384,9 +576,9 @@ var DialogDescription = React10.forwardRef(({ className, ...props }, ref) => /*
384
576
  DialogDescription.displayName = DialogPrimitive.Description.displayName;
385
577
 
386
578
  // src/components/PageHeader.tsx
387
- import * as React11 from "react";
579
+ import * as React12 from "react";
388
580
  import { cva as cva4 } from "class-variance-authority";
389
- import { jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
581
+ import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
390
582
  var pageHeaderContainerVariants = cva4("", {
391
583
  variants: {
392
584
  variant: {
@@ -435,25 +627,34 @@ var pageHeaderActionsVariants = cva4("flex gap-4", {
435
627
  variant: "default"
436
628
  }
437
629
  });
438
- var PageHeader = React11.forwardRef(
439
- ({ className, variant, title, subtitle, actions, ...props }, ref) => /* @__PURE__ */ jsxs3(
440
- "header",
441
- {
442
- ref,
443
- className: cn(pageHeaderContainerVariants({ variant }), className),
444
- ...props,
445
- children: [
446
- /* @__PURE__ */ jsx11("h1", { className: pageHeaderTitleVariants({ variant }), children: title }),
447
- subtitle && /* @__PURE__ */ jsx11("p", { className: pageHeaderSubtitleVariants({ variant }), children: subtitle }),
448
- actions && /* @__PURE__ */ jsx11("div", { className: pageHeaderActionsVariants({ variant }), children: actions })
449
- ]
630
+ var PageHeader = React12.forwardRef(
631
+ ({ className, variant, title, subtitle, actions, as: Heading = "h1", ...props }, ref) => {
632
+ if (process.env.NODE_ENV !== "production") {
633
+ if (Heading === "h1") {
634
+ console.warn(
635
+ 'PageHeader: Using as="h1" (the default). Ensure there is only one h1 per page for proper document structure. Consider as="h2" for secondary headers.'
636
+ );
637
+ }
450
638
  }
451
- )
639
+ return /* @__PURE__ */ jsxs4(
640
+ "header",
641
+ {
642
+ ref,
643
+ className: cn(pageHeaderContainerVariants({ variant }), className),
644
+ ...props,
645
+ children: [
646
+ /* @__PURE__ */ jsx11(Heading, { className: pageHeaderTitleVariants({ variant }), children: title }),
647
+ subtitle && /* @__PURE__ */ jsx11("p", { className: pageHeaderSubtitleVariants({ variant }), children: subtitle }),
648
+ actions && /* @__PURE__ */ jsx11("div", { className: pageHeaderActionsVariants({ variant }), children: actions })
649
+ ]
650
+ }
651
+ );
652
+ }
452
653
  );
453
654
  PageHeader.displayName = "PageHeader";
454
655
 
455
656
  // src/components/DataPanel.tsx
456
- import * as React12 from "react";
657
+ import * as React13 from "react";
457
658
  import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
458
659
  import {
459
660
  DEFAULT_PANEL_STATE,
@@ -479,7 +680,7 @@ import {
479
680
  calculateDetachedPositionFromPinned,
480
681
  getPinnedPullTransform
481
682
  } from "@classic-homes/data-panel-core";
482
- import { Fragment, jsx as jsx12, jsxs as jsxs4 } from "react/jsx-runtime";
683
+ import { Fragment, jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
483
684
  var DropdownTrigger = DropdownMenuPrimitive.Trigger;
484
685
  var DropdownContent = DropdownMenuPrimitive.Content;
485
686
  var DropdownLabel = DropdownMenuPrimitive.Label;
@@ -494,28 +695,28 @@ function useDataPanel(options = {}) {
494
695
  constraints = {}
495
696
  } = options;
496
697
  const resolvedConstraints = { ...DEFAULT_CONSTRAINTS, ...constraints };
497
- const [persistedState] = React12.useState(() => {
698
+ const [persistedState] = React13.useState(() => {
498
699
  if (persistKey && typeof window !== "undefined") {
499
700
  return loadPanelState(persistKey);
500
701
  }
501
702
  return null;
502
703
  });
503
- const [mode, setMode] = React12.useState(persistedState?.mode ?? initialMode);
504
- const [edge, setEdge] = React12.useState(persistedState?.edge ?? initialEdge);
505
- const [isExpanded, setIsExpanded] = React12.useState(
704
+ const [mode, setMode] = React13.useState(persistedState?.mode ?? initialMode);
705
+ const [edge, setEdge] = React13.useState(persistedState?.edge ?? initialEdge);
706
+ const [isExpanded, setIsExpanded] = React13.useState(
506
707
  persistedState?.isExpanded ?? initialExpanded
507
708
  );
508
- const [detachedPosition, setDetachedPosition] = React12.useState(
709
+ const [detachedPosition, setDetachedPosition] = React13.useState(
509
710
  persistedState?.detachedPosition ?? DEFAULT_PANEL_STATE.detachedPosition
510
711
  );
511
- const [detachedSize, setDetachedSize] = React12.useState(
712
+ const [detachedSize, setDetachedSize] = React13.useState(
512
713
  persistedState?.detachedSize ?? DEFAULT_PANEL_STATE.detachedSize
513
714
  );
514
- const [pinnedSize, setPinnedSize] = React12.useState(
715
+ const [pinnedSize, setPinnedSize] = React13.useState(
515
716
  persistedState?.pinnedSize ?? DEFAULT_PANEL_STATE.pinnedSize
516
717
  );
517
- const saveTimeoutRef = React12.useRef(null);
518
- const debouncedSave = React12.useCallback(() => {
718
+ const saveTimeoutRef = React13.useRef(null);
719
+ const debouncedSave = React13.useCallback(() => {
519
720
  if (!persistKey) return;
520
721
  if (saveTimeoutRef.current) {
521
722
  clearTimeout(saveTimeoutRef.current);
@@ -533,7 +734,7 @@ function useDataPanel(options = {}) {
533
734
  });
534
735
  }, 300);
535
736
  }, [persistKey, mode, edge, isExpanded, detachedPosition, detachedSize, pinnedSize]);
536
- const handleSetMode = React12.useCallback(
737
+ const handleSetMode = React13.useCallback(
537
738
  (newMode) => {
538
739
  setMode(newMode);
539
740
  if (newMode === "detached" && typeof window !== "undefined" && detachedPosition.x === DEFAULT_PANEL_STATE.detachedPosition.x && detachedPosition.y === DEFAULT_PANEL_STATE.detachedPosition.y) {
@@ -544,7 +745,7 @@ function useDataPanel(options = {}) {
544
745
  },
545
746
  [detachedPosition, detachedSize]
546
747
  );
547
- const handleSetDetachedPosition = React12.useCallback(
748
+ const handleSetDetachedPosition = React13.useCallback(
548
749
  (position) => {
549
750
  if (typeof window === "undefined") {
550
751
  setDetachedPosition(position);
@@ -556,13 +757,13 @@ function useDataPanel(options = {}) {
556
757
  },
557
758
  [detachedSize]
558
759
  );
559
- const handleSetDetachedSize = React12.useCallback(
760
+ const handleSetDetachedSize = React13.useCallback(
560
761
  (size) => {
561
762
  setDetachedSize(constrainSize(size, resolvedConstraints));
562
763
  },
563
764
  [resolvedConstraints]
564
765
  );
565
- const handleSetPinnedSize = React12.useCallback(
766
+ const handleSetPinnedSize = React13.useCallback(
566
767
  (size) => {
567
768
  if (typeof window === "undefined") {
568
769
  setPinnedSize(size);
@@ -576,7 +777,7 @@ function useDataPanel(options = {}) {
576
777
  },
577
778
  [edge, resolvedConstraints]
578
779
  );
579
- React12.useEffect(() => {
780
+ React13.useEffect(() => {
580
781
  debouncedSave();
581
782
  }, [debouncedSave]);
582
783
  return {
@@ -609,7 +810,7 @@ var ChevronUpIcon = () => /* @__PURE__ */ jsx12(
609
810
  children: /* @__PURE__ */ jsx12("path", { d: "m18 15-6-6-6 6" })
610
811
  }
611
812
  );
612
- var MoreVerticalIcon = () => /* @__PURE__ */ jsxs4(
813
+ var MoreVerticalIcon = () => /* @__PURE__ */ jsxs5(
613
814
  "svg",
614
815
  {
615
816
  xmlns: "http://www.w3.org/2000/svg",
@@ -628,7 +829,7 @@ var MoreVerticalIcon = () => /* @__PURE__ */ jsxs4(
628
829
  ]
629
830
  }
630
831
  );
631
- var CloseIcon = () => /* @__PURE__ */ jsxs4(
832
+ var CloseIcon = () => /* @__PURE__ */ jsxs5(
632
833
  "svg",
633
834
  {
634
835
  xmlns: "http://www.w3.org/2000/svg",
@@ -652,10 +853,11 @@ var edgeLabels = {
652
853
  top: "Pin to top",
653
854
  bottom: "Pin to bottom"
654
855
  };
655
- var DataPanelHeader = React12.forwardRef(
856
+ var DataPanelHeader = React13.forwardRef(
656
857
  ({
657
858
  title,
658
859
  subtitle,
860
+ titleId,
659
861
  mode,
660
862
  edge,
661
863
  isExpanded,
@@ -670,7 +872,7 @@ var DataPanelHeader = React12.forwardRef(
670
872
  className,
671
873
  draggable = false
672
874
  }, ref) => {
673
- return /* @__PURE__ */ jsxs4(
875
+ return /* @__PURE__ */ jsxs5(
674
876
  "div",
675
877
  {
676
878
  ref,
@@ -681,34 +883,34 @@ var DataPanelHeader = React12.forwardRef(
681
883
  ),
682
884
  "data-panel-header": true,
683
885
  children: [
684
- /* @__PURE__ */ jsx12("div", { className: "flex flex-col min-w-0 flex-1", children: headerContent ? headerContent : /* @__PURE__ */ jsxs4(Fragment, { children: [
685
- title && /* @__PURE__ */ jsx12("h3", { className: "text-sm font-semibold leading-none truncate", children: title }),
886
+ /* @__PURE__ */ jsx12("div", { className: "flex flex-col min-w-0 flex-1", children: headerContent ? headerContent : /* @__PURE__ */ jsxs5(Fragment, { children: [
887
+ title && /* @__PURE__ */ jsx12("h3", { id: titleId, className: "text-sm font-semibold leading-none truncate", children: title }),
686
888
  subtitle && /* @__PURE__ */ jsx12("p", { className: "text-xs text-muted-foreground mt-1 truncate", children: subtitle })
687
889
  ] }) }),
688
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1 shrink-0", children: [
890
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-1 shrink-0", children: [
689
891
  headerActions,
690
892
  /* @__PURE__ */ jsx12(
691
893
  "button",
692
894
  {
693
895
  type: "button",
694
- className: "flex h-8 w-8 items-center justify-center rounded-md bg-transparent text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
896
+ 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",
695
897
  onClick: () => onExpandedChange?.(!isExpanded),
696
898
  "aria-label": isExpanded ? "Collapse panel" : "Expand panel",
697
899
  "aria-expanded": isExpanded,
698
900
  children: /* @__PURE__ */ jsx12("span", { className: cn("transition-transform", !isExpanded && "rotate-180"), children: /* @__PURE__ */ jsx12(ChevronUpIcon, {}) })
699
901
  }
700
902
  ),
701
- !disableModeSwitch && /* @__PURE__ */ jsxs4(DropdownMenuPrimitive.Root, { children: [
903
+ !disableModeSwitch && /* @__PURE__ */ jsxs5(DropdownMenuPrimitive.Root, { children: [
702
904
  /* @__PURE__ */ jsx12(DropdownTrigger, { asChild: true, children: /* @__PURE__ */ jsx12(
703
905
  "button",
704
906
  {
705
907
  type: "button",
706
- className: "flex h-8 w-8 items-center justify-center rounded-md bg-transparent text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
908
+ 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",
707
909
  "aria-label": "Panel options",
708
910
  children: /* @__PURE__ */ jsx12(MoreVerticalIcon, {})
709
911
  }
710
912
  ) }),
711
- /* @__PURE__ */ jsx12(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsxs4(
913
+ /* @__PURE__ */ jsx12(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsxs5(
712
914
  DropdownContent,
713
915
  {
714
916
  className: "z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95",
@@ -716,10 +918,10 @@ var DataPanelHeader = React12.forwardRef(
716
918
  align: "end",
717
919
  children: [
718
920
  /* @__PURE__ */ jsx12(DropdownLabel, { className: "px-2 py-1.5 text-sm font-semibold", children: "Panel Position" }),
719
- ["left", "right", "top", "bottom"].map((e) => /* @__PURE__ */ jsxs4(
921
+ ["left", "right", "top", "bottom"].map((e) => /* @__PURE__ */ jsxs5(
720
922
  DropdownItem,
721
923
  {
722
- className: "relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
924
+ 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",
723
925
  onSelect: () => {
724
926
  onModeChange?.("pinned");
725
927
  onEdgeChange?.(e);
@@ -732,10 +934,10 @@ var DataPanelHeader = React12.forwardRef(
732
934
  e
733
935
  )),
734
936
  /* @__PURE__ */ jsx12(DropdownSeparator, { className: "-mx-1 my-1 h-px bg-muted" }),
735
- /* @__PURE__ */ jsxs4(
937
+ /* @__PURE__ */ jsxs5(
736
938
  DropdownItem,
737
939
  {
738
- className: "relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground",
940
+ 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",
739
941
  onSelect: () => onModeChange?.("detached"),
740
942
  children: [
741
943
  "Detach",
@@ -751,7 +953,7 @@ var DataPanelHeader = React12.forwardRef(
751
953
  "button",
752
954
  {
753
955
  type: "button",
754
- className: "flex h-8 w-8 items-center justify-center rounded-md bg-transparent text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
956
+ 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",
755
957
  onClick: onClose,
756
958
  "aria-label": "Close panel",
757
959
  children: /* @__PURE__ */ jsx12(CloseIcon, {})
@@ -764,13 +966,22 @@ var DataPanelHeader = React12.forwardRef(
764
966
  }
765
967
  );
766
968
  DataPanelHeader.displayName = "DataPanelHeader";
767
- var DataPanelContent = React12.forwardRef(
768
- ({ children, className }, ref) => {
769
- return /* @__PURE__ */ jsx12("div", { ref, className: cn("flex-1 overflow-auto p-4", className), children });
969
+ var DataPanelContent = React13.forwardRef(
970
+ ({ children, className, "aria-label": ariaLabel = "Panel content" }, ref) => {
971
+ return /* @__PURE__ */ jsx12(
972
+ "div",
973
+ {
974
+ ref,
975
+ role: "region",
976
+ "aria-label": ariaLabel,
977
+ className: cn("flex-1 overflow-auto p-4", className),
978
+ children
979
+ }
980
+ );
770
981
  }
771
982
  );
772
983
  DataPanelContent.displayName = "DataPanelContent";
773
- var DataPanelFooter = React12.forwardRef(
984
+ var DataPanelFooter = React13.forwardRef(
774
985
  ({ actions = [], footerContent, footerActions, className }, ref) => {
775
986
  if (!footerContent && actions.length === 0 && !footerActions) {
776
987
  return null;
@@ -787,7 +998,7 @@ var DataPanelFooter = React12.forwardRef(
787
998
  "flex items-center justify-end gap-2 border-t border-border bg-muted/30 px-4 py-3",
788
999
  className
789
1000
  ),
790
- children: footerContent ? footerContent : /* @__PURE__ */ jsxs4(Fragment, { children: [
1001
+ children: footerContent ? footerContent : /* @__PURE__ */ jsxs5(Fragment, { children: [
791
1002
  footerActions,
792
1003
  actions.map((action, index) => /* @__PURE__ */ jsx12(
793
1004
  Button,
@@ -806,7 +1017,7 @@ var DataPanelFooter = React12.forwardRef(
806
1017
  }
807
1018
  );
808
1019
  DataPanelFooter.displayName = "DataPanelFooter";
809
- var DataPanelTab = React12.forwardRef(
1020
+ var DataPanelTab = React13.forwardRef(
810
1021
  ({ title = "Panel", edge, onClick, className }, ref) => {
811
1022
  const positionClasses = {
812
1023
  left: "left-0 top-1/2 -translate-y-1/2 rounded-r-md border-l-0",
@@ -821,13 +1032,13 @@ var DataPanelTab = React12.forwardRef(
821
1032
  top: "rotate-180",
822
1033
  bottom: ""
823
1034
  }[edge];
824
- return /* @__PURE__ */ jsxs4(
1035
+ return /* @__PURE__ */ jsxs5(
825
1036
  "button",
826
1037
  {
827
1038
  ref,
828
1039
  type: "button",
829
1040
  className: cn(
830
- "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 transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
1041
+ "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",
831
1042
  positionClasses,
832
1043
  isVertical && "[writing-mode:vertical-rl]",
833
1044
  className
@@ -843,7 +1054,186 @@ var DataPanelTab = React12.forwardRef(
843
1054
  }
844
1055
  );
845
1056
  DataPanelTab.displayName = "DataPanelTab";
846
- var DataPanel = React12.forwardRef(
1057
+ var KEYBOARD_RESIZE_STEP = 10;
1058
+ var KEYBOARD_RESIZE_STEP_LARGE = 50;
1059
+ function ResizeHandles({
1060
+ mode,
1061
+ edge,
1062
+ detachedSize,
1063
+ pinnedSize,
1064
+ onResizeStart,
1065
+ onSizeChange,
1066
+ onPinnedSizeChange,
1067
+ constraints
1068
+ }) {
1069
+ const handleDetachedKeyDown = React13.useCallback(
1070
+ (e, handle) => {
1071
+ const step = e.shiftKey ? KEYBOARD_RESIZE_STEP_LARGE : KEYBOARD_RESIZE_STEP;
1072
+ let newSize = { ...detachedSize };
1073
+ let handled = false;
1074
+ switch (e.key) {
1075
+ case "ArrowUp":
1076
+ if (handle.includes("top")) {
1077
+ newSize.height = Math.max(constraints.minHeight || 200, detachedSize.height + step);
1078
+ handled = true;
1079
+ } else if (handle.includes("bottom")) {
1080
+ newSize.height = Math.max(constraints.minHeight || 200, detachedSize.height - step);
1081
+ handled = true;
1082
+ }
1083
+ break;
1084
+ case "ArrowDown":
1085
+ if (handle.includes("top")) {
1086
+ newSize.height = Math.max(constraints.minHeight || 200, detachedSize.height - step);
1087
+ handled = true;
1088
+ } else if (handle.includes("bottom")) {
1089
+ newSize.height = Math.min(constraints.maxHeight || 800, detachedSize.height + step);
1090
+ handled = true;
1091
+ }
1092
+ break;
1093
+ case "ArrowLeft":
1094
+ if (handle.includes("left")) {
1095
+ newSize.width = Math.max(constraints.minWidth || 280, detachedSize.width + step);
1096
+ handled = true;
1097
+ } else if (handle.includes("right")) {
1098
+ newSize.width = Math.max(constraints.minWidth || 280, detachedSize.width - step);
1099
+ handled = true;
1100
+ }
1101
+ break;
1102
+ case "ArrowRight":
1103
+ if (handle.includes("left")) {
1104
+ newSize.width = Math.max(constraints.minWidth || 280, detachedSize.width - step);
1105
+ handled = true;
1106
+ } else if (handle.includes("right")) {
1107
+ newSize.width = Math.min(constraints.maxWidth || 600, detachedSize.width + step);
1108
+ handled = true;
1109
+ }
1110
+ break;
1111
+ }
1112
+ if (handled) {
1113
+ e.preventDefault();
1114
+ onSizeChange(newSize);
1115
+ }
1116
+ },
1117
+ [detachedSize, constraints, onSizeChange]
1118
+ );
1119
+ const handlePinnedKeyDown = React13.useCallback(
1120
+ (e) => {
1121
+ const step = e.shiftKey ? KEYBOARD_RESIZE_STEP_LARGE : KEYBOARD_RESIZE_STEP;
1122
+ let newSize = pinnedSize;
1123
+ let handled = false;
1124
+ const isHorizontal2 = edge === "left" || edge === "right";
1125
+ if (isHorizontal2) {
1126
+ if (e.key === "ArrowLeft" && edge === "right" || e.key === "ArrowRight" && edge === "left") {
1127
+ newSize = Math.min(constraints.maxWidth || 600, pinnedSize + step);
1128
+ handled = true;
1129
+ } else if (e.key === "ArrowRight" && edge === "right" || e.key === "ArrowLeft" && edge === "left") {
1130
+ newSize = Math.max(constraints.minWidth || 280, pinnedSize - step);
1131
+ handled = true;
1132
+ }
1133
+ } else {
1134
+ if (e.key === "ArrowUp" && edge === "bottom" || e.key === "ArrowDown" && edge === "top") {
1135
+ newSize = Math.min(constraints.maxHeight || 800, pinnedSize + step);
1136
+ handled = true;
1137
+ } else if (e.key === "ArrowDown" && edge === "bottom" || e.key === "ArrowUp" && edge === "top") {
1138
+ newSize = Math.max(constraints.minHeight || 200, pinnedSize - step);
1139
+ handled = true;
1140
+ }
1141
+ }
1142
+ if (handled) {
1143
+ e.preventDefault();
1144
+ onPinnedSizeChange(newSize);
1145
+ }
1146
+ },
1147
+ [edge, pinnedSize, constraints, onPinnedSizeChange]
1148
+ );
1149
+ const getAriaValueNow = (handle) => {
1150
+ if (handle.includes("left") || handle.includes("right")) {
1151
+ return mode === "detached" ? detachedSize.width : pinnedSize;
1152
+ }
1153
+ return mode === "detached" ? detachedSize.height : pinnedSize;
1154
+ };
1155
+ const getAriaValueMinMax = (handle) => {
1156
+ const isWidth = handle.includes("left") || handle.includes("right");
1157
+ if (isWidth) {
1158
+ return {
1159
+ min: constraints.minWidth || 280,
1160
+ max: constraints.maxWidth || 600
1161
+ };
1162
+ }
1163
+ return {
1164
+ min: constraints.minHeight || 200,
1165
+ max: constraints.maxHeight || 800
1166
+ };
1167
+ };
1168
+ if (mode === "detached") {
1169
+ const handles = [
1170
+ "top",
1171
+ "bottom",
1172
+ "left",
1173
+ "right",
1174
+ "top-left",
1175
+ "top-right",
1176
+ "bottom-left",
1177
+ "bottom-right"
1178
+ ];
1179
+ return /* @__PURE__ */ jsx12(Fragment, { children: handles.map((handle) => {
1180
+ const isCorner = handle.includes("-");
1181
+ const isHorizontal2 = handle === "top" || handle === "bottom";
1182
+ const isVertical = handle === "left" || handle === "right";
1183
+ const { min: min2, max: max2 } = getAriaValueMinMax(handle);
1184
+ return /* @__PURE__ */ jsx12(
1185
+ "div",
1186
+ {
1187
+ className: cn(
1188
+ "resize-handle",
1189
+ isHorizontal2 && "resize-handle--horizontal",
1190
+ isVertical && "resize-handle--vertical",
1191
+ isCorner && "resize-handle--corner",
1192
+ `resize-handle--${handle}`
1193
+ ),
1194
+ role: "slider",
1195
+ tabIndex: 0,
1196
+ "aria-orientation": isVertical ? "vertical" : "horizontal",
1197
+ "aria-label": `Resize panel from ${handle.replace("-", "")} ${isCorner ? "corner" : "edge"}`,
1198
+ "aria-valuenow": getAriaValueNow(handle),
1199
+ "aria-valuemin": min2,
1200
+ "aria-valuemax": max2,
1201
+ "aria-valuetext": `${getAriaValueNow(handle)} pixels`,
1202
+ style: isCorner ? { "--handle-radius": "6px" } : void 0,
1203
+ onPointerDown: (e) => onResizeStart(e, handle),
1204
+ onKeyDown: (e) => handleDetachedKeyDown(e, handle)
1205
+ },
1206
+ handle
1207
+ );
1208
+ }) });
1209
+ }
1210
+ const pinnedHandle = getPinnedResizeHandle(edge);
1211
+ const isHorizontal = edge === "left" || edge === "right";
1212
+ const { min, max } = getAriaValueMinMax(pinnedHandle);
1213
+ return /* @__PURE__ */ jsx12(
1214
+ "div",
1215
+ {
1216
+ className: cn(
1217
+ "resize-handle",
1218
+ edge === "left" && "resize-handle--vertical resize-handle--right",
1219
+ edge === "right" && "resize-handle--vertical resize-handle--left",
1220
+ edge === "top" && "resize-handle--horizontal resize-handle--bottom",
1221
+ edge === "bottom" && "resize-handle--horizontal resize-handle--top"
1222
+ ),
1223
+ role: "slider",
1224
+ tabIndex: 0,
1225
+ "aria-orientation": isHorizontal ? "horizontal" : "vertical",
1226
+ "aria-label": `Resize panel from ${edge} edge`,
1227
+ "aria-valuenow": pinnedSize,
1228
+ "aria-valuemin": min,
1229
+ "aria-valuemax": max,
1230
+ "aria-valuetext": `${pinnedSize} pixels`,
1231
+ onPointerDown: (e) => onResizeStart(e, pinnedHandle),
1232
+ onKeyDown: handlePinnedKeyDown
1233
+ }
1234
+ );
1235
+ }
1236
+ var DataPanel = React13.forwardRef(
847
1237
  ({
848
1238
  open: controlledOpen,
849
1239
  onOpenChange,
@@ -872,31 +1262,33 @@ var DataPanel = React12.forwardRef(
872
1262
  className
873
1263
  }, ref) => {
874
1264
  const resolvedConstraints = { ...DEFAULT_CONSTRAINTS, ...constraints };
875
- const [internalOpen, setInternalOpen] = React12.useState(true);
876
- const [internalMode, setInternalMode] = React12.useState(DEFAULT_PANEL_STATE.mode);
877
- const [internalEdge, setInternalEdge] = React12.useState(DEFAULT_PANEL_STATE.edge);
878
- const [internalExpanded, setInternalExpanded] = React12.useState(
1265
+ const panelId = React13.useId();
1266
+ const titleId = `${panelId}-title`;
1267
+ const [internalOpen, setInternalOpen] = React13.useState(true);
1268
+ const [internalMode, setInternalMode] = React13.useState(DEFAULT_PANEL_STATE.mode);
1269
+ const [internalEdge, setInternalEdge] = React13.useState(DEFAULT_PANEL_STATE.edge);
1270
+ const [internalExpanded, setInternalExpanded] = React13.useState(
879
1271
  DEFAULT_PANEL_STATE.isExpanded
880
1272
  );
881
- const [detachedPosition, setDetachedPosition] = React12.useState(
1273
+ const [detachedPosition, setDetachedPosition] = React13.useState(
882
1274
  DEFAULT_PANEL_STATE.detachedPosition
883
1275
  );
884
- const [detachedSize, setDetachedSize] = React12.useState(DEFAULT_PANEL_STATE.detachedSize);
885
- const [pinnedSize, setPinnedSize] = React12.useState(DEFAULT_PANEL_STATE.pinnedSize);
886
- const [isDragging, setIsDragging] = React12.useState(false);
887
- const [isResizing, setIsResizing] = React12.useState(false);
888
- const [snapPreview, setSnapPreview] = React12.useState(null);
889
- const [isPinnedDragging, setIsPinnedDragging] = React12.useState(false);
890
- const [pullOffset, setPullOffset] = React12.useState(0);
891
- const dragStateRef = React12.useRef({
1276
+ const [detachedSize, setDetachedSize] = React13.useState(DEFAULT_PANEL_STATE.detachedSize);
1277
+ const [pinnedSize, setPinnedSize] = React13.useState(DEFAULT_PANEL_STATE.pinnedSize);
1278
+ const [isDragging, setIsDragging] = React13.useState(false);
1279
+ const [isResizing, setIsResizing] = React13.useState(false);
1280
+ const [snapPreview, setSnapPreview] = React13.useState(null);
1281
+ const [isPinnedDragging, setIsPinnedDragging] = React13.useState(false);
1282
+ const [pullOffset, setPullOffset] = React13.useState(0);
1283
+ const dragStateRef = React13.useRef({
892
1284
  startPosition: { x: 0, y: 0 },
893
1285
  startPanelPosition: { x: 0, y: 0 }
894
1286
  });
895
- const pinnedDragStateRef = React12.useRef({
1287
+ const pinnedDragStateRef = React13.useRef({
896
1288
  startPosition: { x: 0, y: 0 },
897
1289
  hasDetached: false
898
1290
  });
899
- const resizeStateRef = React12.useRef({
1291
+ const resizeStateRef = React13.useRef({
900
1292
  handle: null,
901
1293
  startPosition: { x: 0, y: 0 },
902
1294
  startSize: { width: 0, height: 0 },
@@ -906,8 +1298,8 @@ var DataPanel = React12.forwardRef(
906
1298
  const mode = controlledMode ?? internalMode;
907
1299
  const edge = controlledEdge ?? internalEdge;
908
1300
  const isExpanded = controlledExpanded ?? internalExpanded;
909
- const saveTimeoutRef = React12.useRef(null);
910
- const debouncedSave = React12.useCallback(() => {
1301
+ const saveTimeoutRef = React13.useRef(null);
1302
+ const debouncedSave = React13.useCallback(() => {
911
1303
  if (!persistKey) return;
912
1304
  if (saveTimeoutRef.current) {
913
1305
  clearTimeout(saveTimeoutRef.current);
@@ -933,7 +1325,7 @@ var DataPanel = React12.forwardRef(
933
1325
  detachedSize,
934
1326
  pinnedSize
935
1327
  ]);
936
- React12.useEffect(() => {
1328
+ React13.useEffect(() => {
937
1329
  if (!persistKey) return;
938
1330
  const persisted = loadPanelState(persistKey);
939
1331
  if (persisted) {
@@ -946,7 +1338,7 @@ var DataPanel = React12.forwardRef(
946
1338
  if (persisted.pinnedSize) setPinnedSize(persisted.pinnedSize);
947
1339
  }
948
1340
  }, [persistKey, controlledMode, controlledEdge, controlledExpanded]);
949
- React12.useEffect(() => {
1341
+ React13.useEffect(() => {
950
1342
  if (mode === "detached" && detachedPosition.x === DEFAULT_PANEL_STATE.detachedPosition.x && detachedPosition.y === DEFAULT_PANEL_STATE.detachedPosition.y) {
951
1343
  setDetachedPosition(
952
1344
  getInitialDetachedPosition(detachedSize, window.innerWidth, window.innerHeight)
@@ -1004,7 +1396,7 @@ var DataPanel = React12.forwardRef(
1004
1396
  document.body.style.userSelect = "none";
1005
1397
  }
1006
1398
  };
1007
- const handleDragMove = React12.useCallback(
1399
+ const handleDragMove = React13.useCallback(
1008
1400
  (e) => {
1009
1401
  if (!isDragging) return;
1010
1402
  const currentPos = getPointerPosition(e);
@@ -1031,7 +1423,7 @@ var DataPanel = React12.forwardRef(
1031
1423
  },
1032
1424
  [isDragging, detachedSize, snapThreshold]
1033
1425
  );
1034
- const handleDragEnd = React12.useCallback(() => {
1426
+ const handleDragEnd = React13.useCallback(() => {
1035
1427
  if (!isDragging) return;
1036
1428
  setIsDragging(false);
1037
1429
  document.body.style.cursor = "";
@@ -1044,7 +1436,7 @@ var DataPanel = React12.forwardRef(
1044
1436
  debouncedSave();
1045
1437
  }
1046
1438
  }, [isDragging, snapPreview, handleModeChange, handleEdgeChange, debouncedSave]);
1047
- const handlePinnedDragMove = React12.useCallback(
1439
+ const handlePinnedDragMove = React13.useCallback(
1048
1440
  (e) => {
1049
1441
  if (!isPinnedDragging) return;
1050
1442
  const currentPos = getPointerPosition(e);
@@ -1080,7 +1472,7 @@ var DataPanel = React12.forwardRef(
1080
1472
  },
1081
1473
  [isPinnedDragging, edge, detachThreshold, pinnedSize, detachedSize, handleModeChange]
1082
1474
  );
1083
- const handlePinnedDragEnd = React12.useCallback(() => {
1475
+ const handlePinnedDragEnd = React13.useCallback(() => {
1084
1476
  if (!isPinnedDragging) return;
1085
1477
  setIsPinnedDragging(false);
1086
1478
  setPullOffset(0);
@@ -1102,7 +1494,7 @@ var DataPanel = React12.forwardRef(
1102
1494
  document.body.style.cursor = getResizeCursor(handle);
1103
1495
  document.body.style.userSelect = "none";
1104
1496
  };
1105
- const handleResizeMove = React12.useCallback(
1497
+ const handleResizeMove = React13.useCallback(
1106
1498
  (e) => {
1107
1499
  if (!isResizing || !resizeStateRef.current.handle) return;
1108
1500
  const currentPos = getPointerPosition(e);
@@ -1140,7 +1532,7 @@ var DataPanel = React12.forwardRef(
1140
1532
  },
1141
1533
  [isResizing, mode, edge, resolvedConstraints]
1142
1534
  );
1143
- const handleResizeEnd = React12.useCallback(() => {
1535
+ const handleResizeEnd = React13.useCallback(() => {
1144
1536
  if (!isResizing) return;
1145
1537
  setIsResizing(false);
1146
1538
  resizeStateRef.current.handle = null;
@@ -1148,7 +1540,7 @@ var DataPanel = React12.forwardRef(
1148
1540
  document.body.style.userSelect = "";
1149
1541
  debouncedSave();
1150
1542
  }, [isResizing, debouncedSave]);
1151
- React12.useEffect(() => {
1543
+ React13.useEffect(() => {
1152
1544
  if (isDragging) {
1153
1545
  window.addEventListener("pointermove", handleDragMove);
1154
1546
  window.addEventListener("pointerup", handleDragEnd);
@@ -1158,7 +1550,7 @@ var DataPanel = React12.forwardRef(
1158
1550
  };
1159
1551
  }
1160
1552
  }, [isDragging, handleDragMove, handleDragEnd]);
1161
- React12.useEffect(() => {
1553
+ React13.useEffect(() => {
1162
1554
  if (isPinnedDragging) {
1163
1555
  window.addEventListener("pointermove", handlePinnedDragMove);
1164
1556
  window.addEventListener("pointerup", handlePinnedDragEnd);
@@ -1168,7 +1560,7 @@ var DataPanel = React12.forwardRef(
1168
1560
  };
1169
1561
  }
1170
1562
  }, [isPinnedDragging, handlePinnedDragMove, handlePinnedDragEnd]);
1171
- React12.useEffect(() => {
1563
+ React13.useEffect(() => {
1172
1564
  if (isResizing) {
1173
1565
  window.addEventListener("pointermove", handleResizeMove);
1174
1566
  window.addEventListener("pointerup", handleResizeEnd);
@@ -1178,7 +1570,7 @@ var DataPanel = React12.forwardRef(
1178
1570
  };
1179
1571
  }
1180
1572
  }, [isResizing, handleResizeMove, handleResizeEnd]);
1181
- const panelStyles = React12.useMemo(() => {
1573
+ const panelStyles = React13.useMemo(() => {
1182
1574
  if (mode === "pinned") {
1183
1575
  const baseStyles = getPinnedPositionStyles(edge, pinnedSize);
1184
1576
  if (pullOffset > 0) {
@@ -1205,7 +1597,7 @@ var DataPanel = React12.forwardRef(
1205
1597
  if (!isExpanded && mode === "pinned") {
1206
1598
  return /* @__PURE__ */ jsx12(DataPanelTab, { title, edge, onClick: () => handleExpandedChange(true) });
1207
1599
  }
1208
- return /* @__PURE__ */ jsxs4(Fragment, { children: [
1600
+ return /* @__PURE__ */ jsxs5(Fragment, { children: [
1209
1601
  snapPreview && /* @__PURE__ */ jsx12(
1210
1602
  "div",
1211
1603
  {
@@ -1218,7 +1610,7 @@ var DataPanel = React12.forwardRef(
1218
1610
  )
1219
1611
  }
1220
1612
  ),
1221
- /* @__PURE__ */ jsxs4(
1613
+ /* @__PURE__ */ jsxs5(
1222
1614
  "div",
1223
1615
  {
1224
1616
  ref,
@@ -1231,9 +1623,10 @@ var DataPanel = React12.forwardRef(
1231
1623
  className
1232
1624
  ),
1233
1625
  style: panelStyles,
1234
- role: mode === "detached" ? "dialog" : void 0,
1626
+ role: mode === "detached" ? "dialog" : "complementary",
1235
1627
  "aria-modal": mode === "detached" ? "true" : void 0,
1236
- "aria-labelledby": title ? "data-panel-title" : void 0,
1628
+ "aria-labelledby": title ? titleId : void 0,
1629
+ "aria-label": !title ? "Side panel" : void 0,
1237
1630
  onPointerDown: handleDragStart,
1238
1631
  children: [
1239
1632
  /* @__PURE__ */ jsx12(
@@ -1241,6 +1634,7 @@ var DataPanel = React12.forwardRef(
1241
1634
  {
1242
1635
  title,
1243
1636
  subtitle,
1637
+ titleId,
1244
1638
  mode,
1245
1639
  edge,
1246
1640
  isExpanded,
@@ -1264,80 +1658,31 @@ var DataPanel = React12.forwardRef(
1264
1658
  footerActions
1265
1659
  }
1266
1660
  ),
1267
- !disableResize && /* @__PURE__ */ jsx12(Fragment, { children: mode === "detached" ? /* @__PURE__ */ jsxs4(Fragment, { children: [
1268
- /* @__PURE__ */ jsx12(
1269
- "div",
1270
- {
1271
- className: "resize-handle resize-handle--horizontal resize-handle--top",
1272
- onPointerDown: (e) => handleResizeStart(e, "top")
1273
- }
1274
- ),
1275
- /* @__PURE__ */ jsx12(
1276
- "div",
1277
- {
1278
- className: "resize-handle resize-handle--horizontal resize-handle--bottom",
1279
- onPointerDown: (e) => handleResizeStart(e, "bottom")
1280
- }
1281
- ),
1282
- /* @__PURE__ */ jsx12(
1283
- "div",
1284
- {
1285
- className: "resize-handle resize-handle--vertical resize-handle--left",
1286
- onPointerDown: (e) => handleResizeStart(e, "left")
1287
- }
1288
- ),
1289
- /* @__PURE__ */ jsx12(
1290
- "div",
1291
- {
1292
- className: "resize-handle resize-handle--vertical resize-handle--right",
1293
- onPointerDown: (e) => handleResizeStart(e, "right")
1294
- }
1295
- ),
1296
- /* @__PURE__ */ jsx12(
1297
- "div",
1298
- {
1299
- className: "resize-handle resize-handle--corner resize-handle--top-left",
1300
- style: { "--handle-radius": "6px" },
1301
- onPointerDown: (e) => handleResizeStart(e, "top-left")
1302
- }
1303
- ),
1304
- /* @__PURE__ */ jsx12(
1305
- "div",
1306
- {
1307
- className: "resize-handle resize-handle--corner resize-handle--top-right",
1308
- style: { "--handle-radius": "6px" },
1309
- onPointerDown: (e) => handleResizeStart(e, "top-right")
1310
- }
1311
- ),
1312
- /* @__PURE__ */ jsx12(
1313
- "div",
1314
- {
1315
- className: "resize-handle resize-handle--corner resize-handle--bottom-left",
1316
- style: { "--handle-radius": "6px" },
1317
- onPointerDown: (e) => handleResizeStart(e, "bottom-left")
1318
- }
1319
- ),
1320
- /* @__PURE__ */ jsx12(
1321
- "div",
1322
- {
1323
- className: "resize-handle resize-handle--corner resize-handle--bottom-right",
1324
- style: { "--handle-radius": "6px" },
1325
- onPointerDown: (e) => handleResizeStart(e, "bottom-right")
1326
- }
1327
- )
1328
- ] }) : /* @__PURE__ */ jsx12(
1329
- "div",
1661
+ !disableResize && /* @__PURE__ */ jsx12(
1662
+ ResizeHandles,
1330
1663
  {
1331
- className: cn(
1332
- "resize-handle",
1333
- edge === "left" && "resize-handle--vertical resize-handle--right",
1334
- edge === "right" && "resize-handle--vertical resize-handle--left",
1335
- edge === "top" && "resize-handle--horizontal resize-handle--bottom",
1336
- edge === "bottom" && "resize-handle--horizontal resize-handle--top"
1337
- ),
1338
- onPointerDown: (e) => handleResizeStart(e, getPinnedResizeHandle(edge))
1664
+ mode,
1665
+ edge,
1666
+ detachedSize,
1667
+ pinnedSize,
1668
+ onResizeStart: handleResizeStart,
1669
+ onSizeChange: (size) => setDetachedSize(constrainSize(size, resolvedConstraints)),
1670
+ onPinnedSizeChange: (size) => {
1671
+ if (typeof window === "undefined") {
1672
+ setPinnedSize(size);
1673
+ return;
1674
+ }
1675
+ if (isHorizontalEdge(edge)) {
1676
+ setPinnedSize(constrainPinnedWidth(size, resolvedConstraints, window.innerWidth));
1677
+ } else {
1678
+ setPinnedSize(
1679
+ constrainPinnedHeight(size, resolvedConstraints, window.innerHeight)
1680
+ );
1681
+ }
1682
+ },
1683
+ constraints: resolvedConstraints
1339
1684
  }
1340
- ) })
1685
+ )
1341
1686
  ]
1342
1687
  }
1343
1688
  )
@@ -1345,6 +1690,891 @@ var DataPanel = React12.forwardRef(
1345
1690
  }
1346
1691
  );
1347
1692
  DataPanel.displayName = "DataPanel";
1693
+
1694
+ // src/components/Skeleton.tsx
1695
+ import * as React14 from "react";
1696
+ import { cva as cva5 } from "class-variance-authority";
1697
+ import { jsx as jsx13 } from "react/jsx-runtime";
1698
+ var skeletonVariants = cva5("rounded-md bg-muted", {
1699
+ variants: {
1700
+ variant: {
1701
+ default: "",
1702
+ text: "h-4 w-full",
1703
+ avatar: "h-12 w-12 rounded-full",
1704
+ card: "h-32 w-full",
1705
+ button: "h-10 w-24",
1706
+ title: "h-6 w-3/4"
1707
+ }
1708
+ },
1709
+ defaultVariants: {
1710
+ variant: "default"
1711
+ }
1712
+ });
1713
+ var Skeleton = React14.forwardRef(
1714
+ ({ className, variant, animation = "pulse", ...props }, ref) => {
1715
+ const animationClass = animation === "pulse" ? "animate-pulse" : animation === "shimmer" ? "animate-shimmer" : "";
1716
+ return /* @__PURE__ */ jsx13(
1717
+ "div",
1718
+ {
1719
+ ref,
1720
+ className: cn(skeletonVariants({ variant }), animationClass, className),
1721
+ ...props
1722
+ }
1723
+ );
1724
+ }
1725
+ );
1726
+ Skeleton.displayName = "Skeleton";
1727
+
1728
+ // src/components/Spinner.tsx
1729
+ import * as React15 from "react";
1730
+ import { cva as cva6 } from "class-variance-authority";
1731
+ import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
1732
+ var spinnerVariants = cva6("animate-spin text-current", {
1733
+ variants: {
1734
+ size: {
1735
+ sm: "h-4 w-4",
1736
+ md: "h-6 w-6",
1737
+ lg: "h-8 w-8",
1738
+ xl: "h-12 w-12"
1739
+ }
1740
+ },
1741
+ defaultVariants: {
1742
+ size: "md"
1743
+ }
1744
+ });
1745
+ var Spinner = React15.forwardRef(
1746
+ ({ className, size, label = "Loading...", ...props }, ref) => {
1747
+ return /* @__PURE__ */ jsxs6(
1748
+ "svg",
1749
+ {
1750
+ ref,
1751
+ className: cn(spinnerVariants({ size }), className),
1752
+ xmlns: "http://www.w3.org/2000/svg",
1753
+ fill: "none",
1754
+ viewBox: "0 0 24 24",
1755
+ "aria-label": label,
1756
+ role: "status",
1757
+ ...props,
1758
+ children: [
1759
+ /* @__PURE__ */ jsx14(
1760
+ "circle",
1761
+ {
1762
+ className: "opacity-25",
1763
+ cx: "12",
1764
+ cy: "12",
1765
+ r: "10",
1766
+ stroke: "currentColor",
1767
+ strokeWidth: "4"
1768
+ }
1769
+ ),
1770
+ /* @__PURE__ */ jsx14(
1771
+ "path",
1772
+ {
1773
+ className: "opacity-75",
1774
+ fill: "currentColor",
1775
+ 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"
1776
+ }
1777
+ ),
1778
+ /* @__PURE__ */ jsx14("title", { children: label })
1779
+ ]
1780
+ }
1781
+ );
1782
+ }
1783
+ );
1784
+ Spinner.displayName = "Spinner";
1785
+
1786
+ // src/components/LoadingLogo.tsx
1787
+ import * as React16 from "react";
1788
+ import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
1789
+ var logoPaths = [
1790
+ "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",
1791
+ "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",
1792
+ "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",
1793
+ "M9.002 18.1c-.8 0-.7.8-.1.8h6.7c.7 0 .7-.8-.1-.8h-6.5z",
1794
+ "M13.802 24.8c-1.1-1.1-.9-4.6-.9-4.6h-1.3s.2 3.6-.9 4.6h3.1z",
1795
+ "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",
1796
+ "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"
1797
+ ];
1798
+ var colors = {
1799
+ dark: {
1800
+ fill: "#C50F22",
1801
+ fillLoading: "#ffffff",
1802
+ stroke: "#C50F22"
1803
+ },
1804
+ light: {
1805
+ fill: "#ffffff",
1806
+ fillLoading: "#C50F22",
1807
+ stroke: "#ffffff"
1808
+ }
1809
+ };
1810
+ var LoadingLogo = React16.forwardRef(
1811
+ ({ width = 40, height = 40, loading = false, variant = "dark", className, ...props }, ref) => {
1812
+ const currentColors = colors[variant];
1813
+ const fillColor = loading ? currentColors.fillLoading : currentColors.fill;
1814
+ const strokeColor = currentColors.stroke;
1815
+ return /* @__PURE__ */ jsxs7(
1816
+ "div",
1817
+ {
1818
+ ref,
1819
+ className: cn("inline-flex items-center justify-center", className),
1820
+ style: { width: `${width}px`, height: `${height}px` },
1821
+ role: loading ? "status" : "img",
1822
+ "aria-label": loading ? "Loading" : "Classic Homes",
1823
+ ...props,
1824
+ children: [
1825
+ /* @__PURE__ */ jsxs7(
1826
+ "svg",
1827
+ {
1828
+ width: "100%",
1829
+ height: "100%",
1830
+ viewBox: "-1 0 26 25",
1831
+ fill: "none",
1832
+ xmlns: "http://www.w3.org/2000/svg",
1833
+ "aria-hidden": "true",
1834
+ children: [
1835
+ /* @__PURE__ */ jsx15("g", { fill: fillColor, className: "transition-all duration-300", children: logoPaths.map((path, i) => /* @__PURE__ */ jsx15("path", { d: path }, i)) }),
1836
+ loading && /* @__PURE__ */ jsx15(
1837
+ "g",
1838
+ {
1839
+ fill: "none",
1840
+ stroke: strokeColor,
1841
+ strokeWidth: "0.5",
1842
+ strokeDasharray: "10 4",
1843
+ className: "animate-trace",
1844
+ children: logoPaths.map((path, i) => /* @__PURE__ */ jsx15("path", { d: path }, i))
1845
+ }
1846
+ )
1847
+ ]
1848
+ }
1849
+ ),
1850
+ loading && /* @__PURE__ */ jsx15("span", { className: "sr-only", children: "Loading" })
1851
+ ]
1852
+ }
1853
+ );
1854
+ }
1855
+ );
1856
+ LoadingLogo.displayName = "LoadingLogo";
1857
+
1858
+ // src/components/ProgressBar.tsx
1859
+ import * as React17 from "react";
1860
+ import { cva as cva7 } from "class-variance-authority";
1861
+ import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
1862
+ var progressBarVariants = cva7("w-full overflow-hidden rounded-full bg-muted", {
1863
+ variants: {
1864
+ size: {
1865
+ sm: "h-1",
1866
+ md: "h-2",
1867
+ lg: "h-3"
1868
+ }
1869
+ },
1870
+ defaultVariants: {
1871
+ size: "md"
1872
+ }
1873
+ });
1874
+ var progressFillVariants = cva7("h-full rounded-full transition-all duration-300", {
1875
+ variants: {
1876
+ variant: {
1877
+ default: "bg-primary",
1878
+ success: "bg-success",
1879
+ warning: "bg-warning",
1880
+ destructive: "bg-destructive"
1881
+ }
1882
+ },
1883
+ defaultVariants: {
1884
+ variant: "default"
1885
+ }
1886
+ });
1887
+ var ProgressBar = React17.forwardRef(
1888
+ ({ className, size, variant, value, max = 100, label = "Progress", showValue = false, ...props }, ref) => {
1889
+ const isIndeterminate = value === void 0;
1890
+ const clampedValue = isIndeterminate ? 0 : Math.min(Math.max(0, value), max);
1891
+ const percentage = isIndeterminate ? 0 : Math.round(clampedValue / max * 100);
1892
+ return /* @__PURE__ */ jsxs8(
1893
+ "div",
1894
+ {
1895
+ ref,
1896
+ role: "progressbar",
1897
+ "aria-label": label,
1898
+ "aria-valuenow": isIndeterminate ? void 0 : clampedValue,
1899
+ "aria-valuemin": 0,
1900
+ "aria-valuemax": max,
1901
+ className: cn("flex items-center gap-2", className),
1902
+ ...props,
1903
+ children: [
1904
+ /* @__PURE__ */ jsx16("div", { className: cn(progressBarVariants({ size })), children: /* @__PURE__ */ jsx16(
1905
+ "div",
1906
+ {
1907
+ className: cn(
1908
+ progressFillVariants({ variant }),
1909
+ isIndeterminate && "w-1/4 animate-progress-indeterminate"
1910
+ ),
1911
+ style: isIndeterminate ? void 0 : { width: `${percentage}%` }
1912
+ }
1913
+ ) }),
1914
+ showValue && !isIndeterminate && /* @__PURE__ */ jsxs8("span", { className: "text-sm tabular-nums text-muted-foreground", children: [
1915
+ percentage,
1916
+ "%"
1917
+ ] })
1918
+ ]
1919
+ }
1920
+ );
1921
+ }
1922
+ );
1923
+ ProgressBar.displayName = "ProgressBar";
1924
+
1925
+ // src/components/LoadingOverlay.tsx
1926
+ import * as React18 from "react";
1927
+ import { Fragment as Fragment2, jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
1928
+ var spinnerSizeMap = { sm: "sm", md: "md", lg: "lg", xl: "xl" };
1929
+ var logoSizeMap = { sm: 32, md: 40, lg: 56, xl: 80 };
1930
+ var LoadingOverlay = React18.forwardRef(
1931
+ ({
1932
+ loading = true,
1933
+ variant = "spinner",
1934
+ mode = "overlay",
1935
+ size = "md",
1936
+ message,
1937
+ progress,
1938
+ blur = true,
1939
+ opaque = false,
1940
+ delay = 0,
1941
+ className,
1942
+ children,
1943
+ ...props
1944
+ }, ref) => {
1945
+ const [visible, setVisible] = React18.useState(delay === 0 && loading);
1946
+ React18.useEffect(() => {
1947
+ if (!loading) {
1948
+ setVisible(false);
1949
+ return;
1950
+ }
1951
+ if (delay === 0) {
1952
+ setVisible(true);
1953
+ return;
1954
+ }
1955
+ const timer = setTimeout(() => setVisible(true), delay);
1956
+ return () => clearTimeout(timer);
1957
+ }, [loading, delay]);
1958
+ if (!visible) {
1959
+ return mode === "inline" ? null : /* @__PURE__ */ jsx17(Fragment2, { children });
1960
+ }
1961
+ const indicator = /* @__PURE__ */ jsxs9(Fragment2, { children: [
1962
+ variant === "spinner" && /* @__PURE__ */ jsx17(Spinner, { size: spinnerSizeMap[size] }),
1963
+ variant === "logo" && /* @__PURE__ */ jsx17(LoadingLogo, { loading: true, width: logoSizeMap[size], height: logoSizeMap[size] }),
1964
+ variant === "progress" && /* @__PURE__ */ jsx17(ProgressBar, { value: progress, className: "w-48 max-w-full" }),
1965
+ variant === "skeleton" && /* @__PURE__ */ jsxs9("div", { className: "w-full space-y-3", children: [
1966
+ /* @__PURE__ */ jsx17(Skeleton, { variant: "title" }),
1967
+ /* @__PURE__ */ jsx17(Skeleton, { variant: "text" }),
1968
+ /* @__PURE__ */ jsx17(Skeleton, { variant: "text" }),
1969
+ /* @__PURE__ */ jsx17(Skeleton, { variant: "text", className: "w-2/3" })
1970
+ ] }),
1971
+ message && /* @__PURE__ */ jsx17("p", { className: "mt-2 text-sm text-muted-foreground animate-pulse-subtle", children: message }),
1972
+ !message && /* @__PURE__ */ jsx17("span", { className: "sr-only", children: "Loading" })
1973
+ ] });
1974
+ if (mode === "inline") {
1975
+ return /* @__PURE__ */ jsx17(
1976
+ "div",
1977
+ {
1978
+ ref,
1979
+ role: "status",
1980
+ "aria-live": "polite",
1981
+ className: cn("inline-flex items-center gap-2", className),
1982
+ ...props,
1983
+ children: indicator
1984
+ }
1985
+ );
1986
+ }
1987
+ const bgClass = opaque ? "bg-background" : mode === "fullscreen" ? "bg-background/80" : "bg-background/60";
1988
+ const positionClass = mode === "fullscreen" ? "fixed inset-0 z-50" : "absolute inset-0 z-10";
1989
+ return /* @__PURE__ */ jsxs9(Fragment2, { children: [
1990
+ children,
1991
+ /* @__PURE__ */ jsx17(
1992
+ "div",
1993
+ {
1994
+ ref,
1995
+ role: "status",
1996
+ "aria-live": "polite",
1997
+ className: cn(
1998
+ positionClass,
1999
+ bgClass,
2000
+ blur && "backdrop-blur-sm",
2001
+ "flex flex-col items-center justify-center",
2002
+ className
2003
+ ),
2004
+ ...props,
2005
+ children: indicator
2006
+ }
2007
+ )
2008
+ ] });
2009
+ }
2010
+ );
2011
+ LoadingOverlay.displayName = "LoadingOverlay";
2012
+
2013
+ // src/components/LoadingPage.tsx
2014
+ import * as React19 from "react";
2015
+ import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
2016
+ var LoadingPage = React19.forwardRef(
2017
+ ({
2018
+ loading = true,
2019
+ message,
2020
+ progress,
2021
+ showLogo = true,
2022
+ logoVariant = "dark",
2023
+ delay = 200,
2024
+ className,
2025
+ ...props
2026
+ }, ref) => {
2027
+ const [visible, setVisible] = React19.useState(delay === 0 && loading);
2028
+ React19.useEffect(() => {
2029
+ if (!loading) {
2030
+ setVisible(false);
2031
+ return;
2032
+ }
2033
+ if (delay === 0) {
2034
+ setVisible(true);
2035
+ return;
2036
+ }
2037
+ const timer = setTimeout(() => setVisible(true), delay);
2038
+ return () => clearTimeout(timer);
2039
+ }, [loading, delay]);
2040
+ if (!visible) return null;
2041
+ return /* @__PURE__ */ jsxs10(
2042
+ "div",
2043
+ {
2044
+ ref,
2045
+ role: "status",
2046
+ "aria-live": "polite",
2047
+ className: cn(
2048
+ "fixed inset-0 z-50 flex flex-col items-center justify-center bg-background",
2049
+ className
2050
+ ),
2051
+ ...props,
2052
+ children: [
2053
+ showLogo ? /* @__PURE__ */ jsx18(LoadingLogo, { loading: true, width: 64, height: 64, variant: logoVariant }) : /* @__PURE__ */ jsx18(Spinner, { size: "xl" }),
2054
+ progress !== void 0 && /* @__PURE__ */ jsx18(ProgressBar, { value: progress, className: "mt-6 w-48 max-w-full" }),
2055
+ message && /* @__PURE__ */ jsx18("p", { className: "mt-4 text-sm text-muted-foreground animate-pulse-subtle", children: message }),
2056
+ /* @__PURE__ */ jsxs10("span", { className: "sr-only", children: [
2057
+ message || "Loading",
2058
+ progress !== void 0 && `, ${Math.round(progress)}% complete`
2059
+ ] })
2060
+ ]
2061
+ }
2062
+ );
2063
+ }
2064
+ );
2065
+ LoadingPage.displayName = "LoadingPage";
2066
+
2067
+ // src/components/LoadingSection.tsx
2068
+ import * as React20 from "react";
2069
+ import { jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
2070
+ var LoadingSection = React20.forwardRef(
2071
+ ({
2072
+ loading = false,
2073
+ variant = "spinner",
2074
+ message,
2075
+ progress,
2076
+ minHeight = "12rem",
2077
+ blur = true,
2078
+ delay = 0,
2079
+ className,
2080
+ children,
2081
+ ...props
2082
+ }, ref) => {
2083
+ return /* @__PURE__ */ jsxs11(
2084
+ "div",
2085
+ {
2086
+ ref,
2087
+ className: cn("relative", className),
2088
+ style: { minHeight },
2089
+ "aria-busy": loading,
2090
+ ...props,
2091
+ children: [
2092
+ children,
2093
+ loading && /* @__PURE__ */ jsx19(
2094
+ LoadingOverlay,
2095
+ {
2096
+ mode: "overlay",
2097
+ variant,
2098
+ message,
2099
+ progress,
2100
+ blur,
2101
+ delay
2102
+ }
2103
+ )
2104
+ ]
2105
+ }
2106
+ );
2107
+ }
2108
+ );
2109
+ LoadingSection.displayName = "LoadingSection";
2110
+
2111
+ // src/components/LiveRegion.tsx
2112
+ import * as React21 from "react";
2113
+ import { jsx as jsx20 } from "react/jsx-runtime";
2114
+ var LiveRegion = React21.forwardRef(
2115
+ ({ message, politeness = "polite", atomic = true, visuallyHidden = true, className, children }, ref) => {
2116
+ return /* @__PURE__ */ jsx20(
2117
+ "div",
2118
+ {
2119
+ ref,
2120
+ role: "status",
2121
+ "aria-live": politeness,
2122
+ "aria-atomic": atomic,
2123
+ className: cn(
2124
+ visuallyHidden && "sr-only absolute h-px w-px overflow-hidden whitespace-nowrap border-0 p-0",
2125
+ className
2126
+ ),
2127
+ children: message || children
2128
+ }
2129
+ );
2130
+ }
2131
+ );
2132
+ LiveRegion.displayName = "LiveRegion";
2133
+
2134
+ // src/components/SkipLink.tsx
2135
+ import * as React22 from "react";
2136
+ import { jsx as jsx21 } from "react/jsx-runtime";
2137
+ var SkipLink = React22.forwardRef(
2138
+ ({ targetId, className, children = "Skip to main content", ...props }, ref) => {
2139
+ const handleClick = (e) => {
2140
+ e.preventDefault();
2141
+ const target = document.getElementById(targetId);
2142
+ if (target) {
2143
+ if (target.tabIndex === -1) {
2144
+ target.setAttribute("tabindex", "-1");
2145
+ }
2146
+ target.focus();
2147
+ target.scrollIntoView();
2148
+ } else if (process.env.NODE_ENV !== "production") {
2149
+ console.warn(
2150
+ `SkipLink: Target element with id="${targetId}" not found. Ensure the target element exists and has the correct id attribute.`
2151
+ );
2152
+ }
2153
+ props.onClick?.(e);
2154
+ };
2155
+ return /* @__PURE__ */ jsx21(
2156
+ "a",
2157
+ {
2158
+ ref,
2159
+ href: `#${targetId}`,
2160
+ className: cn("skip-link", className),
2161
+ onClick: handleClick,
2162
+ ...props,
2163
+ children
2164
+ }
2165
+ );
2166
+ }
2167
+ );
2168
+ SkipLink.displayName = "SkipLink";
2169
+
2170
+ // src/hooks/useFocusTrap.ts
2171
+ import { useEffect as useEffect5, useRef as useRef3, useCallback as useCallback3 } from "react";
2172
+ var FOCUSABLE_SELECTOR = [
2173
+ "a[href]",
2174
+ "area[href]",
2175
+ 'input:not([disabled]):not([type="hidden"])',
2176
+ "select:not([disabled])",
2177
+ "textarea:not([disabled])",
2178
+ "button:not([disabled])",
2179
+ "iframe",
2180
+ "object",
2181
+ "embed",
2182
+ "[contenteditable]",
2183
+ '[tabindex]:not([tabindex="-1"])'
2184
+ ].join(",");
2185
+ function getFocusableElements(container) {
2186
+ const elements = container.querySelectorAll(FOCUSABLE_SELECTOR);
2187
+ return Array.from(elements).filter(
2188
+ (el) => el.offsetParent !== null && getComputedStyle(el).visibility !== "hidden"
2189
+ );
2190
+ }
2191
+ function useFocusTrap(options = {}) {
2192
+ const { active = true, returnFocusTo, initialFocus, preventScroll = false } = options;
2193
+ const containerRef = useRef3(null);
2194
+ const previousActiveElementRef = useRef3(null);
2195
+ const handleKeyDown = useCallback3(
2196
+ (event) => {
2197
+ if (!active || event.key !== "Tab") return;
2198
+ const container = containerRef.current;
2199
+ if (!container) return;
2200
+ const focusableElements = getFocusableElements(container);
2201
+ if (focusableElements.length === 0) return;
2202
+ const firstElement = focusableElements[0];
2203
+ const lastElement = focusableElements[focusableElements.length - 1];
2204
+ if (event.shiftKey) {
2205
+ if (document.activeElement === firstElement) {
2206
+ event.preventDefault();
2207
+ lastElement.focus({ preventScroll });
2208
+ }
2209
+ } else {
2210
+ if (document.activeElement === lastElement) {
2211
+ event.preventDefault();
2212
+ firstElement.focus({ preventScroll });
2213
+ }
2214
+ }
2215
+ },
2216
+ [active, preventScroll]
2217
+ );
2218
+ useEffect5(() => {
2219
+ if (!active) return;
2220
+ const container = containerRef.current;
2221
+ if (!container) return;
2222
+ previousActiveElementRef.current = document.activeElement;
2223
+ const focusableElements = getFocusableElements(container);
2224
+ if (focusableElements.length > 0) {
2225
+ let elementToFocus = null;
2226
+ if (initialFocus) {
2227
+ elementToFocus = container.querySelector(initialFocus);
2228
+ }
2229
+ if (!elementToFocus) {
2230
+ elementToFocus = focusableElements[0];
2231
+ }
2232
+ requestAnimationFrame(() => {
2233
+ elementToFocus?.focus({ preventScroll });
2234
+ });
2235
+ }
2236
+ document.addEventListener("keydown", handleKeyDown);
2237
+ return () => {
2238
+ document.removeEventListener("keydown", handleKeyDown);
2239
+ const elementToReturn = returnFocusTo ?? previousActiveElementRef.current;
2240
+ if (elementToReturn && typeof elementToReturn.focus === "function") {
2241
+ elementToReturn.focus({ preventScroll });
2242
+ }
2243
+ };
2244
+ }, [active, initialFocus, returnFocusTo, handleKeyDown, preventScroll]);
2245
+ return containerRef;
2246
+ }
2247
+
2248
+ // src/hooks/useFocusRef.ts
2249
+ import { useRef as useRef4, useEffect as useEffect6 } from "react";
2250
+ function useFocusRef(options = {}) {
2251
+ const { focusOnMount = false, preventScroll = false, delay = 0 } = options;
2252
+ const ref = useRef4(null);
2253
+ useEffect6(() => {
2254
+ if (!focusOnMount) return;
2255
+ const focus = () => {
2256
+ if (ref.current && typeof ref.current.focus === "function") {
2257
+ ref.current.focus({ preventScroll });
2258
+ }
2259
+ };
2260
+ if (delay > 0) {
2261
+ const timer = setTimeout(focus, delay);
2262
+ return () => clearTimeout(timer);
2263
+ } else {
2264
+ const frame = requestAnimationFrame(focus);
2265
+ return () => cancelAnimationFrame(frame);
2266
+ }
2267
+ }, [focusOnMount, preventScroll, delay]);
2268
+ return ref;
2269
+ }
2270
+
2271
+ // src/hooks/useReducedMotion.ts
2272
+ import { useState as useState6, useEffect as useEffect7 } from "react";
2273
+ function useReducedMotion() {
2274
+ const [reducedMotion, setReducedMotion] = useState6(false);
2275
+ useEffect7(() => {
2276
+ const mediaQuery = window.matchMedia("(prefers-reduced-motion: reduce)");
2277
+ setReducedMotion(mediaQuery.matches);
2278
+ const handleChange = (event) => {
2279
+ setReducedMotion(event.matches);
2280
+ };
2281
+ mediaQuery.addEventListener("change", handleChange);
2282
+ return () => {
2283
+ mediaQuery.removeEventListener("change", handleChange);
2284
+ };
2285
+ }, []);
2286
+ return reducedMotion;
2287
+ }
2288
+
2289
+ // src/hooks/useArrowNavigation.ts
2290
+ import { useCallback as useCallback4, useRef as useRef5 } from "react";
2291
+ var DEFAULT_SELECTOR = '[role="menuitem"], [role="option"], [role="tab"], button, a, [tabindex]:not([tabindex="-1"])';
2292
+ function useArrowNavigation(options = {}) {
2293
+ const {
2294
+ orientation = "vertical",
2295
+ loop = true,
2296
+ itemSelector = DEFAULT_SELECTOR,
2297
+ onFocusChange
2298
+ } = options;
2299
+ const containerRef = useRef5(null);
2300
+ const focusedIndexRef = useRef5(-1);
2301
+ const getFocusableItems = useCallback4(() => {
2302
+ if (!containerRef.current) return [];
2303
+ return Array.from(containerRef.current.querySelectorAll(itemSelector));
2304
+ }, [itemSelector]);
2305
+ const focusItem = useCallback4(
2306
+ (index) => {
2307
+ const items = getFocusableItems();
2308
+ if (items.length === 0) return;
2309
+ let targetIndex = index;
2310
+ if (loop) {
2311
+ if (targetIndex < 0) targetIndex = items.length - 1;
2312
+ if (targetIndex >= items.length) targetIndex = 0;
2313
+ } else {
2314
+ targetIndex = Math.max(0, Math.min(targetIndex, items.length - 1));
2315
+ }
2316
+ const element = items[targetIndex];
2317
+ if (element) {
2318
+ element.focus();
2319
+ focusedIndexRef.current = targetIndex;
2320
+ onFocusChange?.(targetIndex, element);
2321
+ }
2322
+ },
2323
+ [getFocusableItems, loop, onFocusChange]
2324
+ );
2325
+ const handleKeyDown = useCallback4(
2326
+ (event) => {
2327
+ const items = getFocusableItems();
2328
+ if (items.length === 0) return;
2329
+ const currentIndex = focusedIndexRef.current;
2330
+ let handled = false;
2331
+ switch (event.key) {
2332
+ case "ArrowUp":
2333
+ if (orientation === "vertical" || orientation === "both") {
2334
+ focusItem(currentIndex - 1);
2335
+ handled = true;
2336
+ }
2337
+ break;
2338
+ case "ArrowDown":
2339
+ if (orientation === "vertical" || orientation === "both") {
2340
+ focusItem(currentIndex + 1);
2341
+ handled = true;
2342
+ }
2343
+ break;
2344
+ case "ArrowLeft":
2345
+ if (orientation === "horizontal" || orientation === "both") {
2346
+ focusItem(currentIndex - 1);
2347
+ handled = true;
2348
+ }
2349
+ break;
2350
+ case "ArrowRight":
2351
+ if (orientation === "horizontal" || orientation === "both") {
2352
+ focusItem(currentIndex + 1);
2353
+ handled = true;
2354
+ }
2355
+ break;
2356
+ case "Home":
2357
+ focusItem(0);
2358
+ handled = true;
2359
+ break;
2360
+ case "End":
2361
+ focusItem(items.length - 1);
2362
+ handled = true;
2363
+ break;
2364
+ }
2365
+ if (handled) {
2366
+ event.preventDefault();
2367
+ event.stopPropagation();
2368
+ }
2369
+ },
2370
+ [orientation, focusItem, getFocusableItems]
2371
+ );
2372
+ const handleFocus = useCallback4(
2373
+ (event) => {
2374
+ const items = getFocusableItems();
2375
+ const index = items.indexOf(event.target);
2376
+ if (index !== -1) {
2377
+ focusedIndexRef.current = index;
2378
+ }
2379
+ },
2380
+ [getFocusableItems]
2381
+ );
2382
+ const containerProps = {
2383
+ ref: (node) => {
2384
+ containerRef.current = node;
2385
+ },
2386
+ onKeyDown: handleKeyDown,
2387
+ onFocus: handleFocus
2388
+ };
2389
+ const getItemProps = useCallback4(
2390
+ (index) => ({
2391
+ tabIndex: index === 0 ? 0 : -1,
2392
+ onFocus: () => {
2393
+ focusedIndexRef.current = index;
2394
+ }
2395
+ }),
2396
+ []
2397
+ );
2398
+ return {
2399
+ containerProps,
2400
+ getItemProps,
2401
+ focusItem,
2402
+ getFocusedIndex: () => focusedIndexRef.current
2403
+ };
2404
+ }
2405
+
2406
+ // src/hooks/useRovingTabindex.ts
2407
+ import { useState as useState7, useCallback as useCallback5, useRef as useRef6 } from "react";
2408
+ var DEFAULT_SELECTOR2 = "[data-roving-tabindex-item]";
2409
+ function useRovingTabindex(options = {}) {
2410
+ const { loop = true, itemSelector = DEFAULT_SELECTOR2, initialIndex = 0, onIndexChange } = options;
2411
+ const [activeIndex, setActiveIndex] = useState7(initialIndex);
2412
+ const containerRef = useRef6(null);
2413
+ const itemsRef = useRef6(/* @__PURE__ */ new Map());
2414
+ const getItems = useCallback5(() => {
2415
+ if (!containerRef.current) {
2416
+ return Array.from(itemsRef.current.values());
2417
+ }
2418
+ return Array.from(containerRef.current.querySelectorAll(itemSelector));
2419
+ }, [itemSelector]);
2420
+ const focusIndex = useCallback5(
2421
+ (index) => {
2422
+ const items = getItems();
2423
+ if (items.length === 0) return;
2424
+ let targetIndex = index;
2425
+ if (loop) {
2426
+ if (targetIndex < 0) targetIndex = items.length - 1;
2427
+ if (targetIndex >= items.length) targetIndex = 0;
2428
+ } else {
2429
+ targetIndex = Math.max(0, Math.min(targetIndex, items.length - 1));
2430
+ }
2431
+ setActiveIndex(targetIndex);
2432
+ onIndexChange?.(targetIndex);
2433
+ const element = items[targetIndex];
2434
+ if (element) {
2435
+ element.focus();
2436
+ }
2437
+ },
2438
+ [getItems, loop, onIndexChange]
2439
+ );
2440
+ const handleKeyDown = useCallback5(
2441
+ (event) => {
2442
+ const items = getItems();
2443
+ if (items.length === 0) return;
2444
+ let handled = false;
2445
+ switch (event.key) {
2446
+ case "ArrowUp":
2447
+ case "ArrowLeft":
2448
+ focusIndex(activeIndex - 1);
2449
+ handled = true;
2450
+ break;
2451
+ case "ArrowDown":
2452
+ case "ArrowRight":
2453
+ focusIndex(activeIndex + 1);
2454
+ handled = true;
2455
+ break;
2456
+ case "Home":
2457
+ focusIndex(0);
2458
+ handled = true;
2459
+ break;
2460
+ case "End":
2461
+ focusIndex(items.length - 1);
2462
+ handled = true;
2463
+ break;
2464
+ }
2465
+ if (handled) {
2466
+ event.preventDefault();
2467
+ event.stopPropagation();
2468
+ }
2469
+ },
2470
+ [activeIndex, focusIndex, getItems]
2471
+ );
2472
+ const containerProps = {
2473
+ ref: (node) => {
2474
+ containerRef.current = node;
2475
+ },
2476
+ onKeyDown: handleKeyDown
2477
+ };
2478
+ const getItemProps = useCallback5(
2479
+ (index) => ({
2480
+ "data-roving-tabindex-item": true,
2481
+ tabIndex: index === activeIndex ? 0 : -1,
2482
+ ref: (node) => {
2483
+ if (node) {
2484
+ itemsRef.current.set(index, node);
2485
+ } else {
2486
+ itemsRef.current.delete(index);
2487
+ }
2488
+ },
2489
+ onClick: () => {
2490
+ setActiveIndex(index);
2491
+ onIndexChange?.(index);
2492
+ },
2493
+ onFocus: () => {
2494
+ if (activeIndex !== index) {
2495
+ setActiveIndex(index);
2496
+ onIndexChange?.(index);
2497
+ }
2498
+ }
2499
+ }),
2500
+ [activeIndex, onIndexChange]
2501
+ );
2502
+ return {
2503
+ containerProps,
2504
+ getItemProps,
2505
+ activeIndex,
2506
+ setActiveIndex: focusIndex,
2507
+ focusNext: () => focusIndex(activeIndex + 1),
2508
+ focusPrevious: () => focusIndex(activeIndex - 1),
2509
+ focusFirst: () => focusIndex(0),
2510
+ focusLast: () => focusIndex(getItems().length - 1)
2511
+ };
2512
+ }
2513
+
2514
+ // src/hooks/useEscapeKey.ts
2515
+ import * as React23 from "react";
2516
+ function useEscapeKey(callback, options) {
2517
+ const { enabled = true, preventDefault = true, stopPropagation = false } = options ?? {};
2518
+ const callbackRef = React23.useRef(callback);
2519
+ React23.useEffect(() => {
2520
+ callbackRef.current = callback;
2521
+ }, [callback]);
2522
+ React23.useEffect(() => {
2523
+ if (!enabled) return;
2524
+ const handleKeyDown = (event) => {
2525
+ if (event.key === "Escape") {
2526
+ if (preventDefault) {
2527
+ event.preventDefault();
2528
+ }
2529
+ if (stopPropagation) {
2530
+ event.stopPropagation();
2531
+ }
2532
+ callbackRef.current(event);
2533
+ }
2534
+ };
2535
+ document.addEventListener("keydown", handleKeyDown);
2536
+ return () => {
2537
+ document.removeEventListener("keydown", handleKeyDown);
2538
+ };
2539
+ }, [enabled, preventDefault, stopPropagation]);
2540
+ }
2541
+
2542
+ // src/hooks/useClickOutside.ts
2543
+ import * as React24 from "react";
2544
+ function useClickOutside(ref, callback, options) {
2545
+ const {
2546
+ enabled = true,
2547
+ events = ["mousedown", "touchstart"],
2548
+ ignoreElements = []
2549
+ } = options ?? {};
2550
+ const callbackRef = React24.useRef(callback);
2551
+ React24.useEffect(() => {
2552
+ callbackRef.current = callback;
2553
+ }, [callback]);
2554
+ React24.useEffect(() => {
2555
+ if (!enabled) return;
2556
+ const handleEvent = (event) => {
2557
+ const target = event.target;
2558
+ if (ref.current?.contains(target)) {
2559
+ return;
2560
+ }
2561
+ for (const ignoreRef of ignoreElements) {
2562
+ if (ignoreRef.current?.contains(target)) {
2563
+ return;
2564
+ }
2565
+ }
2566
+ callbackRef.current(event);
2567
+ };
2568
+ events.forEach((eventType) => {
2569
+ document.addEventListener(eventType, handleEvent);
2570
+ });
2571
+ return () => {
2572
+ events.forEach((eventType) => {
2573
+ document.removeEventListener(eventType, handleEvent);
2574
+ });
2575
+ };
2576
+ }, [enabled, events, ignoreElements, ref]);
2577
+ }
1348
2578
  export {
1349
2579
  Avatar,
1350
2580
  AvatarFallback,
@@ -1374,9 +2604,18 @@ export {
1374
2604
  DialogTrigger,
1375
2605
  Input,
1376
2606
  Label,
2607
+ LiveRegion,
2608
+ LoadingLogo,
2609
+ LoadingOverlay,
2610
+ LoadingPage,
2611
+ LoadingSection,
1377
2612
  PageHeader,
1378
2613
  PasswordInput,
2614
+ ProgressBar,
1379
2615
  Separator,
2616
+ Skeleton,
2617
+ SkipLink,
2618
+ Spinner,
1380
2619
  Switch,
1381
2620
  badgeVariants,
1382
2621
  buttonVariants,
@@ -1385,5 +2624,16 @@ export {
1385
2624
  pageHeaderContainerVariants,
1386
2625
  pageHeaderSubtitleVariants,
1387
2626
  pageHeaderTitleVariants,
1388
- useDataPanel
2627
+ progressBarVariants,
2628
+ skeletonVariants,
2629
+ spinnerVariants,
2630
+ useAnnounce,
2631
+ useArrowNavigation,
2632
+ useClickOutside,
2633
+ useDataPanel,
2634
+ useEscapeKey,
2635
+ useFocusRef,
2636
+ useFocusTrap,
2637
+ useReducedMotion,
2638
+ useRovingTabindex
1389
2639
  };