@classic-homes/theme-react 0.1.51 → 0.1.52
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.d.mts +20 -7
- package/dist/index.d.ts +20 -7
- package/dist/index.js +232 -149
- package/dist/index.mjs +231 -149
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -59,6 +59,7 @@ __export(index_exports, {
|
|
|
59
59
|
Input: () => Input,
|
|
60
60
|
Label: () => Label,
|
|
61
61
|
PageHeader: () => PageHeader,
|
|
62
|
+
PasswordInput: () => PasswordInput,
|
|
62
63
|
Separator: () => Separator,
|
|
63
64
|
Switch: () => Switch,
|
|
64
65
|
badgeVariants: () => badgeVariants,
|
|
@@ -184,21 +185,91 @@ var Input = React3.forwardRef(
|
|
|
184
185
|
);
|
|
185
186
|
Input.displayName = "Input";
|
|
186
187
|
|
|
187
|
-
// src/components/
|
|
188
|
+
// src/components/PasswordInput.tsx
|
|
188
189
|
var React4 = __toESM(require("react"));
|
|
190
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
191
|
+
var EyeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
192
|
+
"svg",
|
|
193
|
+
{
|
|
194
|
+
width: 18,
|
|
195
|
+
height: 18,
|
|
196
|
+
viewBox: "0 0 24 24",
|
|
197
|
+
fill: "none",
|
|
198
|
+
stroke: "currentColor",
|
|
199
|
+
strokeWidth: 2,
|
|
200
|
+
strokeLinecap: "round",
|
|
201
|
+
strokeLinejoin: "round",
|
|
202
|
+
children: [
|
|
203
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
|
|
204
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { cx: "12", cy: "12", r: "3" })
|
|
205
|
+
]
|
|
206
|
+
}
|
|
207
|
+
);
|
|
208
|
+
var EyeOffIcon = () => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
209
|
+
"svg",
|
|
210
|
+
{
|
|
211
|
+
width: 18,
|
|
212
|
+
height: 18,
|
|
213
|
+
viewBox: "0 0 24 24",
|
|
214
|
+
fill: "none",
|
|
215
|
+
stroke: "currentColor",
|
|
216
|
+
strokeWidth: 2,
|
|
217
|
+
strokeLinecap: "round",
|
|
218
|
+
strokeLinejoin: "round",
|
|
219
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24M1 1l22 22" })
|
|
220
|
+
}
|
|
221
|
+
);
|
|
222
|
+
var PasswordInput = React4.forwardRef(
|
|
223
|
+
({ className, disabled, showLabel = "Show password", hideLabel = "Hide password", ...props }, ref) => {
|
|
224
|
+
const [showPassword, setShowPassword] = React4.useState(false);
|
|
225
|
+
const toggleVisibility = () => {
|
|
226
|
+
setShowPassword((prev) => !prev);
|
|
227
|
+
};
|
|
228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "relative", children: [
|
|
229
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
230
|
+
"input",
|
|
231
|
+
{
|
|
232
|
+
type: showPassword ? "text" : "password",
|
|
233
|
+
className: cn(
|
|
234
|
+
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 pr-10 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
235
|
+
className
|
|
236
|
+
),
|
|
237
|
+
disabled,
|
|
238
|
+
ref,
|
|
239
|
+
...props
|
|
240
|
+
}
|
|
241
|
+
),
|
|
242
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
243
|
+
"button",
|
|
244
|
+
{
|
|
245
|
+
type: "button",
|
|
246
|
+
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",
|
|
247
|
+
onClick: toggleVisibility,
|
|
248
|
+
disabled,
|
|
249
|
+
"aria-label": showPassword ? hideLabel : showLabel,
|
|
250
|
+
children: showPassword ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(EyeOffIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(EyeIcon, {})
|
|
251
|
+
}
|
|
252
|
+
)
|
|
253
|
+
] });
|
|
254
|
+
}
|
|
255
|
+
);
|
|
256
|
+
PasswordInput.displayName = "PasswordInput";
|
|
257
|
+
|
|
258
|
+
// src/components/Label.tsx
|
|
259
|
+
var React5 = __toESM(require("react"));
|
|
189
260
|
var LabelPrimitive = __toESM(require("@radix-ui/react-label"));
|
|
190
261
|
var import_class_variance_authority2 = require("class-variance-authority");
|
|
191
|
-
var
|
|
262
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
192
263
|
var labelVariants = (0, import_class_variance_authority2.cva)(
|
|
193
264
|
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
194
265
|
);
|
|
195
|
-
var Label =
|
|
266
|
+
var Label = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LabelPrimitive.Root, { ref, className: cn(labelVariants(), className), ...props }));
|
|
196
267
|
Label.displayName = LabelPrimitive.Root.displayName;
|
|
197
268
|
|
|
198
269
|
// src/components/Badge.tsx
|
|
199
|
-
var
|
|
270
|
+
var React6 = __toESM(require("react"));
|
|
200
271
|
var import_class_variance_authority3 = require("class-variance-authority");
|
|
201
|
-
var
|
|
272
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
202
273
|
var badgeVariants = (0, import_class_variance_authority3.cva)(
|
|
203
274
|
"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",
|
|
204
275
|
{
|
|
@@ -215,9 +286,9 @@ var badgeVariants = (0, import_class_variance_authority3.cva)(
|
|
|
215
286
|
}
|
|
216
287
|
}
|
|
217
288
|
);
|
|
218
|
-
var Badge =
|
|
289
|
+
var Badge = React6.forwardRef(
|
|
219
290
|
({ className, variant, ...props }, ref) => {
|
|
220
|
-
return /* @__PURE__ */ (0,
|
|
291
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
221
292
|
"div",
|
|
222
293
|
{
|
|
223
294
|
ref,
|
|
@@ -231,10 +302,10 @@ var Badge = React5.forwardRef(
|
|
|
231
302
|
Badge.displayName = "Badge";
|
|
232
303
|
|
|
233
304
|
// src/components/Separator.tsx
|
|
234
|
-
var
|
|
305
|
+
var React7 = __toESM(require("react"));
|
|
235
306
|
var SeparatorPrimitive = __toESM(require("@radix-ui/react-separator"));
|
|
236
|
-
var
|
|
237
|
-
var Separator =
|
|
307
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
308
|
+
var Separator = React7.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
238
309
|
SeparatorPrimitive.Root,
|
|
239
310
|
{
|
|
240
311
|
ref,
|
|
@@ -251,12 +322,14 @@ var Separator = React6.forwardRef(({ className, orientation = "horizontal", deco
|
|
|
251
322
|
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
252
323
|
|
|
253
324
|
// src/components/Switch.tsx
|
|
254
|
-
var
|
|
325
|
+
var React8 = __toESM(require("react"));
|
|
255
326
|
var SwitchPrimitives = __toESM(require("@radix-ui/react-switch"));
|
|
256
|
-
var
|
|
257
|
-
var
|
|
258
|
-
|
|
259
|
-
|
|
327
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
328
|
+
var SwitchRoot = SwitchPrimitives.Root;
|
|
329
|
+
var SwitchThumb = SwitchPrimitives.Thumb;
|
|
330
|
+
var Switch = React8.forwardRef(
|
|
331
|
+
({ className, size = "default", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
332
|
+
SwitchRoot,
|
|
260
333
|
{
|
|
261
334
|
className: cn(
|
|
262
335
|
"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",
|
|
@@ -264,10 +337,10 @@ var Switch = React7.forwardRef(
|
|
|
264
337
|
size === "sm" && "h-5 w-9",
|
|
265
338
|
className
|
|
266
339
|
),
|
|
267
|
-
...props,
|
|
268
340
|
ref,
|
|
269
|
-
|
|
270
|
-
|
|
341
|
+
...props,
|
|
342
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
343
|
+
SwitchThumb,
|
|
271
344
|
{
|
|
272
345
|
className: cn(
|
|
273
346
|
"pointer-events-none block rounded-full bg-background shadow-lg ring-0 transition-transform",
|
|
@@ -282,10 +355,10 @@ var Switch = React7.forwardRef(
|
|
|
282
355
|
Switch.displayName = SwitchPrimitives.Root.displayName;
|
|
283
356
|
|
|
284
357
|
// src/components/Avatar.tsx
|
|
285
|
-
var
|
|
358
|
+
var React9 = __toESM(require("react"));
|
|
286
359
|
var AvatarPrimitive = __toESM(require("@radix-ui/react-avatar"));
|
|
287
|
-
var
|
|
288
|
-
var Avatar =
|
|
360
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
361
|
+
var Avatar = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
289
362
|
AvatarPrimitive.Root,
|
|
290
363
|
{
|
|
291
364
|
ref,
|
|
@@ -294,7 +367,7 @@ var Avatar = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
294
367
|
}
|
|
295
368
|
));
|
|
296
369
|
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
297
|
-
var AvatarImage =
|
|
370
|
+
var AvatarImage = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
298
371
|
AvatarPrimitive.Image,
|
|
299
372
|
{
|
|
300
373
|
ref,
|
|
@@ -303,7 +376,7 @@ var AvatarImage = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
303
376
|
}
|
|
304
377
|
));
|
|
305
378
|
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
306
|
-
var AvatarFallback =
|
|
379
|
+
var AvatarFallback = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
307
380
|
AvatarPrimitive.Fallback,
|
|
308
381
|
{
|
|
309
382
|
ref,
|
|
@@ -317,15 +390,19 @@ var AvatarFallback = React8.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
317
390
|
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
318
391
|
|
|
319
392
|
// src/components/Dialog.tsx
|
|
320
|
-
var
|
|
393
|
+
var React10 = __toESM(require("react"));
|
|
321
394
|
var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"));
|
|
322
|
-
var
|
|
395
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
396
|
+
var PrimitiveOverlay = DialogPrimitive.Overlay;
|
|
397
|
+
var PrimitiveContent = DialogPrimitive.Content;
|
|
398
|
+
var PrimitiveTitle = DialogPrimitive.Title;
|
|
399
|
+
var PrimitiveDescription = DialogPrimitive.Description;
|
|
323
400
|
var Dialog = DialogPrimitive.Root;
|
|
324
401
|
var DialogTrigger = DialogPrimitive.Trigger;
|
|
325
402
|
var DialogPortal = DialogPrimitive.Portal;
|
|
326
403
|
var DialogClose = DialogPrimitive.Close;
|
|
327
|
-
var DialogOverlay =
|
|
328
|
-
|
|
404
|
+
var DialogOverlay = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
405
|
+
PrimitiveOverlay,
|
|
329
406
|
{
|
|
330
407
|
ref,
|
|
331
408
|
className: cn(
|
|
@@ -336,10 +413,10 @@ var DialogOverlay = React9.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
336
413
|
}
|
|
337
414
|
));
|
|
338
415
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
339
|
-
var DialogContent =
|
|
340
|
-
/* @__PURE__ */ (0,
|
|
341
|
-
/* @__PURE__ */ (0,
|
|
342
|
-
|
|
416
|
+
var DialogContent = React10.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DialogPortal, { children: [
|
|
417
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DialogOverlay, {}),
|
|
418
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
419
|
+
PrimitiveContent,
|
|
343
420
|
{
|
|
344
421
|
ref,
|
|
345
422
|
className: cn(
|
|
@@ -352,9 +429,9 @@ var DialogContent = React9.forwardRef(({ className, children, ...props }, ref) =
|
|
|
352
429
|
)
|
|
353
430
|
] }));
|
|
354
431
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
355
|
-
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ (0,
|
|
432
|
+
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props });
|
|
356
433
|
DialogHeader.displayName = "DialogHeader";
|
|
357
|
-
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0,
|
|
434
|
+
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
358
435
|
"div",
|
|
359
436
|
{
|
|
360
437
|
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
|
|
@@ -362,8 +439,8 @@ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_r
|
|
|
362
439
|
}
|
|
363
440
|
);
|
|
364
441
|
DialogFooter.displayName = "DialogFooter";
|
|
365
|
-
var DialogTitle =
|
|
366
|
-
|
|
442
|
+
var DialogTitle = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
443
|
+
PrimitiveTitle,
|
|
367
444
|
{
|
|
368
445
|
ref,
|
|
369
446
|
className: cn("text-lg font-semibold leading-none tracking-tight", className),
|
|
@@ -371,8 +448,8 @@ var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
371
448
|
}
|
|
372
449
|
));
|
|
373
450
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
374
|
-
var DialogDescription =
|
|
375
|
-
|
|
451
|
+
var DialogDescription = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
452
|
+
PrimitiveDescription,
|
|
376
453
|
{
|
|
377
454
|
ref,
|
|
378
455
|
className: cn("text-sm text-muted-foreground", className),
|
|
@@ -382,9 +459,9 @@ var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
382
459
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
383
460
|
|
|
384
461
|
// src/components/PageHeader.tsx
|
|
385
|
-
var
|
|
462
|
+
var React11 = __toESM(require("react"));
|
|
386
463
|
var import_class_variance_authority4 = require("class-variance-authority");
|
|
387
|
-
var
|
|
464
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
388
465
|
var pageHeaderContainerVariants = (0, import_class_variance_authority4.cva)("", {
|
|
389
466
|
variants: {
|
|
390
467
|
variant: {
|
|
@@ -433,17 +510,17 @@ var pageHeaderActionsVariants = (0, import_class_variance_authority4.cva)("flex
|
|
|
433
510
|
variant: "default"
|
|
434
511
|
}
|
|
435
512
|
});
|
|
436
|
-
var PageHeader =
|
|
437
|
-
({ className, variant, title, subtitle, actions, ...props }, ref) => /* @__PURE__ */ (0,
|
|
513
|
+
var PageHeader = React11.forwardRef(
|
|
514
|
+
({ className, variant, title, subtitle, actions, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
438
515
|
"header",
|
|
439
516
|
{
|
|
440
517
|
ref,
|
|
441
518
|
className: cn(pageHeaderContainerVariants({ variant }), className),
|
|
442
519
|
...props,
|
|
443
520
|
children: [
|
|
444
|
-
/* @__PURE__ */ (0,
|
|
445
|
-
subtitle && /* @__PURE__ */ (0,
|
|
446
|
-
actions && /* @__PURE__ */ (0,
|
|
521
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h1", { className: pageHeaderTitleVariants({ variant }), children: title }),
|
|
522
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: pageHeaderSubtitleVariants({ variant }), children: subtitle }),
|
|
523
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: pageHeaderActionsVariants({ variant }), children: actions })
|
|
447
524
|
]
|
|
448
525
|
}
|
|
449
526
|
)
|
|
@@ -451,10 +528,15 @@ var PageHeader = React10.forwardRef(
|
|
|
451
528
|
PageHeader.displayName = "PageHeader";
|
|
452
529
|
|
|
453
530
|
// src/components/DataPanel.tsx
|
|
454
|
-
var
|
|
531
|
+
var React12 = __toESM(require("react"));
|
|
455
532
|
var DropdownMenuPrimitive = __toESM(require("@radix-ui/react-dropdown-menu"));
|
|
456
533
|
var import_data_panel_core = require("@classic-homes/data-panel-core");
|
|
457
|
-
var
|
|
534
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
535
|
+
var DropdownTrigger = DropdownMenuPrimitive.Trigger;
|
|
536
|
+
var DropdownContent = DropdownMenuPrimitive.Content;
|
|
537
|
+
var DropdownLabel = DropdownMenuPrimitive.Label;
|
|
538
|
+
var DropdownItem = DropdownMenuPrimitive.Item;
|
|
539
|
+
var DropdownSeparator = DropdownMenuPrimitive.Separator;
|
|
458
540
|
function useDataPanel(options = {}) {
|
|
459
541
|
const {
|
|
460
542
|
persistKey,
|
|
@@ -464,28 +546,28 @@ function useDataPanel(options = {}) {
|
|
|
464
546
|
constraints = {}
|
|
465
547
|
} = options;
|
|
466
548
|
const resolvedConstraints = { ...import_data_panel_core.DEFAULT_CONSTRAINTS, ...constraints };
|
|
467
|
-
const [persistedState] =
|
|
549
|
+
const [persistedState] = React12.useState(() => {
|
|
468
550
|
if (persistKey && typeof window !== "undefined") {
|
|
469
551
|
return (0, import_data_panel_core.loadPanelState)(persistKey);
|
|
470
552
|
}
|
|
471
553
|
return null;
|
|
472
554
|
});
|
|
473
|
-
const [mode, setMode] =
|
|
474
|
-
const [edge, setEdge] =
|
|
475
|
-
const [isExpanded, setIsExpanded] =
|
|
555
|
+
const [mode, setMode] = React12.useState(persistedState?.mode ?? initialMode);
|
|
556
|
+
const [edge, setEdge] = React12.useState(persistedState?.edge ?? initialEdge);
|
|
557
|
+
const [isExpanded, setIsExpanded] = React12.useState(
|
|
476
558
|
persistedState?.isExpanded ?? initialExpanded
|
|
477
559
|
);
|
|
478
|
-
const [detachedPosition, setDetachedPosition] =
|
|
560
|
+
const [detachedPosition, setDetachedPosition] = React12.useState(
|
|
479
561
|
persistedState?.detachedPosition ?? import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition
|
|
480
562
|
);
|
|
481
|
-
const [detachedSize, setDetachedSize] =
|
|
563
|
+
const [detachedSize, setDetachedSize] = React12.useState(
|
|
482
564
|
persistedState?.detachedSize ?? import_data_panel_core.DEFAULT_PANEL_STATE.detachedSize
|
|
483
565
|
);
|
|
484
|
-
const [pinnedSize, setPinnedSize] =
|
|
566
|
+
const [pinnedSize, setPinnedSize] = React12.useState(
|
|
485
567
|
persistedState?.pinnedSize ?? import_data_panel_core.DEFAULT_PANEL_STATE.pinnedSize
|
|
486
568
|
);
|
|
487
|
-
const saveTimeoutRef =
|
|
488
|
-
const debouncedSave =
|
|
569
|
+
const saveTimeoutRef = React12.useRef(null);
|
|
570
|
+
const debouncedSave = React12.useCallback(() => {
|
|
489
571
|
if (!persistKey) return;
|
|
490
572
|
if (saveTimeoutRef.current) {
|
|
491
573
|
clearTimeout(saveTimeoutRef.current);
|
|
@@ -503,7 +585,7 @@ function useDataPanel(options = {}) {
|
|
|
503
585
|
});
|
|
504
586
|
}, 300);
|
|
505
587
|
}, [persistKey, mode, edge, isExpanded, detachedPosition, detachedSize, pinnedSize]);
|
|
506
|
-
const handleSetMode =
|
|
588
|
+
const handleSetMode = React12.useCallback(
|
|
507
589
|
(newMode) => {
|
|
508
590
|
setMode(newMode);
|
|
509
591
|
if (newMode === "detached" && typeof window !== "undefined" && detachedPosition.x === import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition.x && detachedPosition.y === import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition.y) {
|
|
@@ -514,7 +596,7 @@ function useDataPanel(options = {}) {
|
|
|
514
596
|
},
|
|
515
597
|
[detachedPosition, detachedSize]
|
|
516
598
|
);
|
|
517
|
-
const handleSetDetachedPosition =
|
|
599
|
+
const handleSetDetachedPosition = React12.useCallback(
|
|
518
600
|
(position) => {
|
|
519
601
|
if (typeof window === "undefined") {
|
|
520
602
|
setDetachedPosition(position);
|
|
@@ -526,13 +608,13 @@ function useDataPanel(options = {}) {
|
|
|
526
608
|
},
|
|
527
609
|
[detachedSize]
|
|
528
610
|
);
|
|
529
|
-
const handleSetDetachedSize =
|
|
611
|
+
const handleSetDetachedSize = React12.useCallback(
|
|
530
612
|
(size) => {
|
|
531
613
|
setDetachedSize((0, import_data_panel_core.constrainSize)(size, resolvedConstraints));
|
|
532
614
|
},
|
|
533
615
|
[resolvedConstraints]
|
|
534
616
|
);
|
|
535
|
-
const handleSetPinnedSize =
|
|
617
|
+
const handleSetPinnedSize = React12.useCallback(
|
|
536
618
|
(size) => {
|
|
537
619
|
if (typeof window === "undefined") {
|
|
538
620
|
setPinnedSize(size);
|
|
@@ -546,7 +628,7 @@ function useDataPanel(options = {}) {
|
|
|
546
628
|
},
|
|
547
629
|
[edge, resolvedConstraints]
|
|
548
630
|
);
|
|
549
|
-
|
|
631
|
+
React12.useEffect(() => {
|
|
550
632
|
debouncedSave();
|
|
551
633
|
}, [debouncedSave]);
|
|
552
634
|
return {
|
|
@@ -564,7 +646,7 @@ function useDataPanel(options = {}) {
|
|
|
564
646
|
setPinnedSize: handleSetPinnedSize
|
|
565
647
|
};
|
|
566
648
|
}
|
|
567
|
-
var ChevronUpIcon = () => /* @__PURE__ */ (0,
|
|
649
|
+
var ChevronUpIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
568
650
|
"svg",
|
|
569
651
|
{
|
|
570
652
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -576,10 +658,10 @@ var ChevronUpIcon = () => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
|
576
658
|
strokeWidth: "2",
|
|
577
659
|
strokeLinecap: "round",
|
|
578
660
|
strokeLinejoin: "round",
|
|
579
|
-
children: /* @__PURE__ */ (0,
|
|
661
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "m18 15-6-6-6 6" })
|
|
580
662
|
}
|
|
581
663
|
);
|
|
582
|
-
var MoreVerticalIcon = () => /* @__PURE__ */ (0,
|
|
664
|
+
var MoreVerticalIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
583
665
|
"svg",
|
|
584
666
|
{
|
|
585
667
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -592,13 +674,13 @@ var MoreVerticalIcon = () => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
|
592
674
|
strokeLinecap: "round",
|
|
593
675
|
strokeLinejoin: "round",
|
|
594
676
|
children: [
|
|
595
|
-
/* @__PURE__ */ (0,
|
|
596
|
-
/* @__PURE__ */ (0,
|
|
597
|
-
/* @__PURE__ */ (0,
|
|
677
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("circle", { cx: "12", cy: "12", r: "1" }),
|
|
678
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("circle", { cx: "12", cy: "5", r: "1" }),
|
|
679
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("circle", { cx: "12", cy: "19", r: "1" })
|
|
598
680
|
]
|
|
599
681
|
}
|
|
600
682
|
);
|
|
601
|
-
var CloseIcon = () => /* @__PURE__ */ (0,
|
|
683
|
+
var CloseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
602
684
|
"svg",
|
|
603
685
|
{
|
|
604
686
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -611,8 +693,8 @@ var CloseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
|
611
693
|
strokeLinecap: "round",
|
|
612
694
|
strokeLinejoin: "round",
|
|
613
695
|
children: [
|
|
614
|
-
/* @__PURE__ */ (0,
|
|
615
|
-
/* @__PURE__ */ (0,
|
|
696
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M18 6 6 18" }),
|
|
697
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "m6 6 12 12" })
|
|
616
698
|
]
|
|
617
699
|
}
|
|
618
700
|
);
|
|
@@ -622,7 +704,7 @@ var edgeLabels = {
|
|
|
622
704
|
top: "Pin to top",
|
|
623
705
|
bottom: "Pin to bottom"
|
|
624
706
|
};
|
|
625
|
-
var DataPanelHeader =
|
|
707
|
+
var DataPanelHeader = React12.forwardRef(
|
|
626
708
|
({
|
|
627
709
|
title,
|
|
628
710
|
subtitle,
|
|
@@ -640,7 +722,7 @@ var DataPanelHeader = React11.forwardRef(
|
|
|
640
722
|
className,
|
|
641
723
|
draggable = false
|
|
642
724
|
}, ref) => {
|
|
643
|
-
return /* @__PURE__ */ (0,
|
|
725
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
644
726
|
"div",
|
|
645
727
|
{
|
|
646
728
|
ref,
|
|
@@ -651,13 +733,13 @@ var DataPanelHeader = React11.forwardRef(
|
|
|
651
733
|
),
|
|
652
734
|
"data-panel-header": true,
|
|
653
735
|
children: [
|
|
654
|
-
/* @__PURE__ */ (0,
|
|
655
|
-
title && /* @__PURE__ */ (0,
|
|
656
|
-
subtitle && /* @__PURE__ */ (0,
|
|
736
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex flex-col min-w-0 flex-1", children: headerContent ? headerContent : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
737
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "text-sm font-semibold leading-none truncate", children: title }),
|
|
738
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-xs text-muted-foreground mt-1 truncate", children: subtitle })
|
|
657
739
|
] }) }),
|
|
658
|
-
/* @__PURE__ */ (0,
|
|
740
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
659
741
|
headerActions,
|
|
660
|
-
/* @__PURE__ */ (0,
|
|
742
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
661
743
|
"button",
|
|
662
744
|
{
|
|
663
745
|
type: "button",
|
|
@@ -665,29 +747,29 @@ var DataPanelHeader = React11.forwardRef(
|
|
|
665
747
|
onClick: () => onExpandedChange?.(!isExpanded),
|
|
666
748
|
"aria-label": isExpanded ? "Collapse panel" : "Expand panel",
|
|
667
749
|
"aria-expanded": isExpanded,
|
|
668
|
-
children: /* @__PURE__ */ (0,
|
|
750
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: cn("transition-transform", !isExpanded && "rotate-180"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChevronUpIcon, {}) })
|
|
669
751
|
}
|
|
670
752
|
),
|
|
671
|
-
!disableModeSwitch && /* @__PURE__ */ (0,
|
|
672
|
-
/* @__PURE__ */ (0,
|
|
753
|
+
!disableModeSwitch && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(DropdownMenuPrimitive.Root, { children: [
|
|
754
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DropdownTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
673
755
|
"button",
|
|
674
756
|
{
|
|
675
757
|
type: "button",
|
|
676
758
|
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",
|
|
677
759
|
"aria-label": "Panel options",
|
|
678
|
-
children: /* @__PURE__ */ (0,
|
|
760
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MoreVerticalIcon, {})
|
|
679
761
|
}
|
|
680
762
|
) }),
|
|
681
|
-
/* @__PURE__ */ (0,
|
|
682
|
-
|
|
763
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
764
|
+
DropdownContent,
|
|
683
765
|
{
|
|
684
766
|
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",
|
|
685
767
|
sideOffset: 4,
|
|
686
768
|
align: "end",
|
|
687
769
|
children: [
|
|
688
|
-
/* @__PURE__ */ (0,
|
|
689
|
-
["left", "right", "top", "bottom"].map((e) => /* @__PURE__ */ (0,
|
|
690
|
-
|
|
770
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DropdownLabel, { className: "px-2 py-1.5 text-sm font-semibold", children: "Panel Position" }),
|
|
771
|
+
["left", "right", "top", "bottom"].map((e) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
772
|
+
DropdownItem,
|
|
691
773
|
{
|
|
692
774
|
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",
|
|
693
775
|
onSelect: () => {
|
|
@@ -696,20 +778,20 @@ var DataPanelHeader = React11.forwardRef(
|
|
|
696
778
|
},
|
|
697
779
|
children: [
|
|
698
780
|
edgeLabels[e],
|
|
699
|
-
mode === "pinned" && edge === e && /* @__PURE__ */ (0,
|
|
781
|
+
mode === "pinned" && edge === e && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "ml-auto text-xs", children: "\u2713" })
|
|
700
782
|
]
|
|
701
783
|
},
|
|
702
784
|
e
|
|
703
785
|
)),
|
|
704
|
-
/* @__PURE__ */ (0,
|
|
705
|
-
/* @__PURE__ */ (0,
|
|
706
|
-
|
|
786
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DropdownSeparator, { className: "-mx-1 my-1 h-px bg-muted" }),
|
|
787
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
788
|
+
DropdownItem,
|
|
707
789
|
{
|
|
708
790
|
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",
|
|
709
791
|
onSelect: () => onModeChange?.("detached"),
|
|
710
792
|
children: [
|
|
711
793
|
"Detach",
|
|
712
|
-
mode === "detached" && /* @__PURE__ */ (0,
|
|
794
|
+
mode === "detached" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "ml-auto text-xs", children: "\u2713" })
|
|
713
795
|
]
|
|
714
796
|
}
|
|
715
797
|
)
|
|
@@ -717,14 +799,14 @@ var DataPanelHeader = React11.forwardRef(
|
|
|
717
799
|
}
|
|
718
800
|
) })
|
|
719
801
|
] }),
|
|
720
|
-
!disableClose && /* @__PURE__ */ (0,
|
|
802
|
+
!disableClose && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
721
803
|
"button",
|
|
722
804
|
{
|
|
723
805
|
type: "button",
|
|
724
806
|
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",
|
|
725
807
|
onClick: onClose,
|
|
726
808
|
"aria-label": "Close panel",
|
|
727
|
-
children: /* @__PURE__ */ (0,
|
|
809
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CloseIcon, {})
|
|
728
810
|
}
|
|
729
811
|
)
|
|
730
812
|
] })
|
|
@@ -734,13 +816,13 @@ var DataPanelHeader = React11.forwardRef(
|
|
|
734
816
|
}
|
|
735
817
|
);
|
|
736
818
|
DataPanelHeader.displayName = "DataPanelHeader";
|
|
737
|
-
var DataPanelContent =
|
|
819
|
+
var DataPanelContent = React12.forwardRef(
|
|
738
820
|
({ children, className }, ref) => {
|
|
739
|
-
return /* @__PURE__ */ (0,
|
|
821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { ref, className: cn("flex-1 overflow-auto p-4", className), children });
|
|
740
822
|
}
|
|
741
823
|
);
|
|
742
824
|
DataPanelContent.displayName = "DataPanelContent";
|
|
743
|
-
var DataPanelFooter =
|
|
825
|
+
var DataPanelFooter = React12.forwardRef(
|
|
744
826
|
({ actions = [], footerContent, footerActions, className }, ref) => {
|
|
745
827
|
if (!footerContent && actions.length === 0 && !footerActions) {
|
|
746
828
|
return null;
|
|
@@ -749,7 +831,7 @@ var DataPanelFooter = React11.forwardRef(
|
|
|
749
831
|
if (variant === "primary") return "default";
|
|
750
832
|
return variant ?? "default";
|
|
751
833
|
};
|
|
752
|
-
return /* @__PURE__ */ (0,
|
|
834
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
753
835
|
"div",
|
|
754
836
|
{
|
|
755
837
|
ref,
|
|
@@ -757,9 +839,9 @@ var DataPanelFooter = React11.forwardRef(
|
|
|
757
839
|
"flex items-center justify-end gap-2 border-t border-border bg-muted/30 px-4 py-3",
|
|
758
840
|
className
|
|
759
841
|
),
|
|
760
|
-
children: footerContent ? footerContent : /* @__PURE__ */ (0,
|
|
842
|
+
children: footerContent ? footerContent : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
761
843
|
footerActions,
|
|
762
|
-
actions.map((action, index) => /* @__PURE__ */ (0,
|
|
844
|
+
actions.map((action, index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
763
845
|
Button,
|
|
764
846
|
{
|
|
765
847
|
variant: mapVariant(action.variant),
|
|
@@ -776,7 +858,7 @@ var DataPanelFooter = React11.forwardRef(
|
|
|
776
858
|
}
|
|
777
859
|
);
|
|
778
860
|
DataPanelFooter.displayName = "DataPanelFooter";
|
|
779
|
-
var DataPanelTab =
|
|
861
|
+
var DataPanelTab = React12.forwardRef(
|
|
780
862
|
({ title = "Panel", edge, onClick, className }, ref) => {
|
|
781
863
|
const positionClasses = {
|
|
782
864
|
left: "left-0 top-1/2 -translate-y-1/2 rounded-r-md border-l-0",
|
|
@@ -791,7 +873,7 @@ var DataPanelTab = React11.forwardRef(
|
|
|
791
873
|
top: "rotate-180",
|
|
792
874
|
bottom: ""
|
|
793
875
|
}[edge];
|
|
794
|
-
return /* @__PURE__ */ (0,
|
|
876
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
795
877
|
"button",
|
|
796
878
|
{
|
|
797
879
|
ref,
|
|
@@ -805,15 +887,15 @@ var DataPanelTab = React11.forwardRef(
|
|
|
805
887
|
onClick,
|
|
806
888
|
"aria-label": `Expand ${title} panel`,
|
|
807
889
|
children: [
|
|
808
|
-
/* @__PURE__ */ (0,
|
|
809
|
-
/* @__PURE__ */ (0,
|
|
890
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: cn("shrink-0", iconRotation), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChevronUpIcon, {}) }),
|
|
891
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: cn(isVertical && "rotate-180"), children: title })
|
|
810
892
|
]
|
|
811
893
|
}
|
|
812
894
|
);
|
|
813
895
|
}
|
|
814
896
|
);
|
|
815
897
|
DataPanelTab.displayName = "DataPanelTab";
|
|
816
|
-
var DataPanel =
|
|
898
|
+
var DataPanel = React12.forwardRef(
|
|
817
899
|
({
|
|
818
900
|
open: controlledOpen,
|
|
819
901
|
onOpenChange,
|
|
@@ -842,31 +924,31 @@ var DataPanel = React11.forwardRef(
|
|
|
842
924
|
className
|
|
843
925
|
}, ref) => {
|
|
844
926
|
const resolvedConstraints = { ...import_data_panel_core.DEFAULT_CONSTRAINTS, ...constraints };
|
|
845
|
-
const [internalOpen, setInternalOpen] =
|
|
846
|
-
const [internalMode, setInternalMode] =
|
|
847
|
-
const [internalEdge, setInternalEdge] =
|
|
848
|
-
const [internalExpanded, setInternalExpanded] =
|
|
927
|
+
const [internalOpen, setInternalOpen] = React12.useState(true);
|
|
928
|
+
const [internalMode, setInternalMode] = React12.useState(import_data_panel_core.DEFAULT_PANEL_STATE.mode);
|
|
929
|
+
const [internalEdge, setInternalEdge] = React12.useState(import_data_panel_core.DEFAULT_PANEL_STATE.edge);
|
|
930
|
+
const [internalExpanded, setInternalExpanded] = React12.useState(
|
|
849
931
|
import_data_panel_core.DEFAULT_PANEL_STATE.isExpanded
|
|
850
932
|
);
|
|
851
|
-
const [detachedPosition, setDetachedPosition] =
|
|
933
|
+
const [detachedPosition, setDetachedPosition] = React12.useState(
|
|
852
934
|
import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition
|
|
853
935
|
);
|
|
854
|
-
const [detachedSize, setDetachedSize] =
|
|
855
|
-
const [pinnedSize, setPinnedSize] =
|
|
856
|
-
const [isDragging, setIsDragging] =
|
|
857
|
-
const [isResizing, setIsResizing] =
|
|
858
|
-
const [snapPreview, setSnapPreview] =
|
|
859
|
-
const [isPinnedDragging, setIsPinnedDragging] =
|
|
860
|
-
const [pullOffset, setPullOffset] =
|
|
861
|
-
const dragStateRef =
|
|
936
|
+
const [detachedSize, setDetachedSize] = React12.useState(import_data_panel_core.DEFAULT_PANEL_STATE.detachedSize);
|
|
937
|
+
const [pinnedSize, setPinnedSize] = React12.useState(import_data_panel_core.DEFAULT_PANEL_STATE.pinnedSize);
|
|
938
|
+
const [isDragging, setIsDragging] = React12.useState(false);
|
|
939
|
+
const [isResizing, setIsResizing] = React12.useState(false);
|
|
940
|
+
const [snapPreview, setSnapPreview] = React12.useState(null);
|
|
941
|
+
const [isPinnedDragging, setIsPinnedDragging] = React12.useState(false);
|
|
942
|
+
const [pullOffset, setPullOffset] = React12.useState(0);
|
|
943
|
+
const dragStateRef = React12.useRef({
|
|
862
944
|
startPosition: { x: 0, y: 0 },
|
|
863
945
|
startPanelPosition: { x: 0, y: 0 }
|
|
864
946
|
});
|
|
865
|
-
const pinnedDragStateRef =
|
|
947
|
+
const pinnedDragStateRef = React12.useRef({
|
|
866
948
|
startPosition: { x: 0, y: 0 },
|
|
867
949
|
hasDetached: false
|
|
868
950
|
});
|
|
869
|
-
const resizeStateRef =
|
|
951
|
+
const resizeStateRef = React12.useRef({
|
|
870
952
|
handle: null,
|
|
871
953
|
startPosition: { x: 0, y: 0 },
|
|
872
954
|
startSize: { width: 0, height: 0 },
|
|
@@ -876,8 +958,8 @@ var DataPanel = React11.forwardRef(
|
|
|
876
958
|
const mode = controlledMode ?? internalMode;
|
|
877
959
|
const edge = controlledEdge ?? internalEdge;
|
|
878
960
|
const isExpanded = controlledExpanded ?? internalExpanded;
|
|
879
|
-
const saveTimeoutRef =
|
|
880
|
-
const debouncedSave =
|
|
961
|
+
const saveTimeoutRef = React12.useRef(null);
|
|
962
|
+
const debouncedSave = React12.useCallback(() => {
|
|
881
963
|
if (!persistKey) return;
|
|
882
964
|
if (saveTimeoutRef.current) {
|
|
883
965
|
clearTimeout(saveTimeoutRef.current);
|
|
@@ -903,7 +985,7 @@ var DataPanel = React11.forwardRef(
|
|
|
903
985
|
detachedSize,
|
|
904
986
|
pinnedSize
|
|
905
987
|
]);
|
|
906
|
-
|
|
988
|
+
React12.useEffect(() => {
|
|
907
989
|
if (!persistKey) return;
|
|
908
990
|
const persisted = (0, import_data_panel_core.loadPanelState)(persistKey);
|
|
909
991
|
if (persisted) {
|
|
@@ -916,7 +998,7 @@ var DataPanel = React11.forwardRef(
|
|
|
916
998
|
if (persisted.pinnedSize) setPinnedSize(persisted.pinnedSize);
|
|
917
999
|
}
|
|
918
1000
|
}, [persistKey, controlledMode, controlledEdge, controlledExpanded]);
|
|
919
|
-
|
|
1001
|
+
React12.useEffect(() => {
|
|
920
1002
|
if (mode === "detached" && detachedPosition.x === import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition.x && detachedPosition.y === import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition.y) {
|
|
921
1003
|
setDetachedPosition(
|
|
922
1004
|
(0, import_data_panel_core.getInitialDetachedPosition)(detachedSize, window.innerWidth, window.innerHeight)
|
|
@@ -974,7 +1056,7 @@ var DataPanel = React11.forwardRef(
|
|
|
974
1056
|
document.body.style.userSelect = "none";
|
|
975
1057
|
}
|
|
976
1058
|
};
|
|
977
|
-
const handleDragMove =
|
|
1059
|
+
const handleDragMove = React12.useCallback(
|
|
978
1060
|
(e) => {
|
|
979
1061
|
if (!isDragging) return;
|
|
980
1062
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -1001,7 +1083,7 @@ var DataPanel = React11.forwardRef(
|
|
|
1001
1083
|
},
|
|
1002
1084
|
[isDragging, detachedSize, snapThreshold]
|
|
1003
1085
|
);
|
|
1004
|
-
const handleDragEnd =
|
|
1086
|
+
const handleDragEnd = React12.useCallback(() => {
|
|
1005
1087
|
if (!isDragging) return;
|
|
1006
1088
|
setIsDragging(false);
|
|
1007
1089
|
document.body.style.cursor = "";
|
|
@@ -1014,7 +1096,7 @@ var DataPanel = React11.forwardRef(
|
|
|
1014
1096
|
debouncedSave();
|
|
1015
1097
|
}
|
|
1016
1098
|
}, [isDragging, snapPreview, handleModeChange, handleEdgeChange, debouncedSave]);
|
|
1017
|
-
const handlePinnedDragMove =
|
|
1099
|
+
const handlePinnedDragMove = React12.useCallback(
|
|
1018
1100
|
(e) => {
|
|
1019
1101
|
if (!isPinnedDragging) return;
|
|
1020
1102
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -1050,7 +1132,7 @@ var DataPanel = React11.forwardRef(
|
|
|
1050
1132
|
},
|
|
1051
1133
|
[isPinnedDragging, edge, detachThreshold, pinnedSize, detachedSize, handleModeChange]
|
|
1052
1134
|
);
|
|
1053
|
-
const handlePinnedDragEnd =
|
|
1135
|
+
const handlePinnedDragEnd = React12.useCallback(() => {
|
|
1054
1136
|
if (!isPinnedDragging) return;
|
|
1055
1137
|
setIsPinnedDragging(false);
|
|
1056
1138
|
setPullOffset(0);
|
|
@@ -1072,7 +1154,7 @@ var DataPanel = React11.forwardRef(
|
|
|
1072
1154
|
document.body.style.cursor = (0, import_data_panel_core.getResizeCursor)(handle);
|
|
1073
1155
|
document.body.style.userSelect = "none";
|
|
1074
1156
|
};
|
|
1075
|
-
const handleResizeMove =
|
|
1157
|
+
const handleResizeMove = React12.useCallback(
|
|
1076
1158
|
(e) => {
|
|
1077
1159
|
if (!isResizing || !resizeStateRef.current.handle) return;
|
|
1078
1160
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -1110,7 +1192,7 @@ var DataPanel = React11.forwardRef(
|
|
|
1110
1192
|
},
|
|
1111
1193
|
[isResizing, mode, edge, resolvedConstraints]
|
|
1112
1194
|
);
|
|
1113
|
-
const handleResizeEnd =
|
|
1195
|
+
const handleResizeEnd = React12.useCallback(() => {
|
|
1114
1196
|
if (!isResizing) return;
|
|
1115
1197
|
setIsResizing(false);
|
|
1116
1198
|
resizeStateRef.current.handle = null;
|
|
@@ -1118,7 +1200,7 @@ var DataPanel = React11.forwardRef(
|
|
|
1118
1200
|
document.body.style.userSelect = "";
|
|
1119
1201
|
debouncedSave();
|
|
1120
1202
|
}, [isResizing, debouncedSave]);
|
|
1121
|
-
|
|
1203
|
+
React12.useEffect(() => {
|
|
1122
1204
|
if (isDragging) {
|
|
1123
1205
|
window.addEventListener("pointermove", handleDragMove);
|
|
1124
1206
|
window.addEventListener("pointerup", handleDragEnd);
|
|
@@ -1128,7 +1210,7 @@ var DataPanel = React11.forwardRef(
|
|
|
1128
1210
|
};
|
|
1129
1211
|
}
|
|
1130
1212
|
}, [isDragging, handleDragMove, handleDragEnd]);
|
|
1131
|
-
|
|
1213
|
+
React12.useEffect(() => {
|
|
1132
1214
|
if (isPinnedDragging) {
|
|
1133
1215
|
window.addEventListener("pointermove", handlePinnedDragMove);
|
|
1134
1216
|
window.addEventListener("pointerup", handlePinnedDragEnd);
|
|
@@ -1138,7 +1220,7 @@ var DataPanel = React11.forwardRef(
|
|
|
1138
1220
|
};
|
|
1139
1221
|
}
|
|
1140
1222
|
}, [isPinnedDragging, handlePinnedDragMove, handlePinnedDragEnd]);
|
|
1141
|
-
|
|
1223
|
+
React12.useEffect(() => {
|
|
1142
1224
|
if (isResizing) {
|
|
1143
1225
|
window.addEventListener("pointermove", handleResizeMove);
|
|
1144
1226
|
window.addEventListener("pointerup", handleResizeEnd);
|
|
@@ -1148,7 +1230,7 @@ var DataPanel = React11.forwardRef(
|
|
|
1148
1230
|
};
|
|
1149
1231
|
}
|
|
1150
1232
|
}, [isResizing, handleResizeMove, handleResizeEnd]);
|
|
1151
|
-
const panelStyles =
|
|
1233
|
+
const panelStyles = React12.useMemo(() => {
|
|
1152
1234
|
if (mode === "pinned") {
|
|
1153
1235
|
const baseStyles = (0, import_data_panel_core.getPinnedPositionStyles)(edge, pinnedSize);
|
|
1154
1236
|
if (pullOffset > 0) {
|
|
@@ -1173,10 +1255,10 @@ var DataPanel = React11.forwardRef(
|
|
|
1173
1255
|
}[edge] : "animate-scale-in";
|
|
1174
1256
|
if (!open) return null;
|
|
1175
1257
|
if (!isExpanded && mode === "pinned") {
|
|
1176
|
-
return /* @__PURE__ */ (0,
|
|
1258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DataPanelTab, { title, edge, onClick: () => handleExpandedChange(true) });
|
|
1177
1259
|
}
|
|
1178
|
-
return /* @__PURE__ */ (0,
|
|
1179
|
-
snapPreview && /* @__PURE__ */ (0,
|
|
1260
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
1261
|
+
snapPreview && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1180
1262
|
"div",
|
|
1181
1263
|
{
|
|
1182
1264
|
className: cn(
|
|
@@ -1188,7 +1270,7 @@ var DataPanel = React11.forwardRef(
|
|
|
1188
1270
|
)
|
|
1189
1271
|
}
|
|
1190
1272
|
),
|
|
1191
|
-
/* @__PURE__ */ (0,
|
|
1273
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1192
1274
|
"div",
|
|
1193
1275
|
{
|
|
1194
1276
|
ref,
|
|
@@ -1206,7 +1288,7 @@ var DataPanel = React11.forwardRef(
|
|
|
1206
1288
|
"aria-labelledby": title ? "data-panel-title" : void 0,
|
|
1207
1289
|
onPointerDown: handleDragStart,
|
|
1208
1290
|
children: [
|
|
1209
|
-
/* @__PURE__ */ (0,
|
|
1291
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1210
1292
|
DataPanelHeader,
|
|
1211
1293
|
{
|
|
1212
1294
|
title,
|
|
@@ -1225,8 +1307,8 @@ var DataPanel = React11.forwardRef(
|
|
|
1225
1307
|
draggable: !disableDrag && (mode === "detached" || mode === "pinned" && detachThreshold > 0)
|
|
1226
1308
|
}
|
|
1227
1309
|
),
|
|
1228
|
-
/* @__PURE__ */ (0,
|
|
1229
|
-
/* @__PURE__ */ (0,
|
|
1310
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DataPanelContent, { children }),
|
|
1311
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1230
1312
|
DataPanelFooter,
|
|
1231
1313
|
{
|
|
1232
1314
|
actions,
|
|
@@ -1234,36 +1316,36 @@ var DataPanel = React11.forwardRef(
|
|
|
1234
1316
|
footerActions
|
|
1235
1317
|
}
|
|
1236
1318
|
),
|
|
1237
|
-
!disableResize && /* @__PURE__ */ (0,
|
|
1238
|
-
/* @__PURE__ */ (0,
|
|
1319
|
+
!disableResize && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: mode === "detached" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
1320
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1239
1321
|
"div",
|
|
1240
1322
|
{
|
|
1241
1323
|
className: "resize-handle resize-handle--horizontal resize-handle--top",
|
|
1242
1324
|
onPointerDown: (e) => handleResizeStart(e, "top")
|
|
1243
1325
|
}
|
|
1244
1326
|
),
|
|
1245
|
-
/* @__PURE__ */ (0,
|
|
1327
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1246
1328
|
"div",
|
|
1247
1329
|
{
|
|
1248
1330
|
className: "resize-handle resize-handle--horizontal resize-handle--bottom",
|
|
1249
1331
|
onPointerDown: (e) => handleResizeStart(e, "bottom")
|
|
1250
1332
|
}
|
|
1251
1333
|
),
|
|
1252
|
-
/* @__PURE__ */ (0,
|
|
1334
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1253
1335
|
"div",
|
|
1254
1336
|
{
|
|
1255
1337
|
className: "resize-handle resize-handle--vertical resize-handle--left",
|
|
1256
1338
|
onPointerDown: (e) => handleResizeStart(e, "left")
|
|
1257
1339
|
}
|
|
1258
1340
|
),
|
|
1259
|
-
/* @__PURE__ */ (0,
|
|
1341
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1260
1342
|
"div",
|
|
1261
1343
|
{
|
|
1262
1344
|
className: "resize-handle resize-handle--vertical resize-handle--right",
|
|
1263
1345
|
onPointerDown: (e) => handleResizeStart(e, "right")
|
|
1264
1346
|
}
|
|
1265
1347
|
),
|
|
1266
|
-
/* @__PURE__ */ (0,
|
|
1348
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1267
1349
|
"div",
|
|
1268
1350
|
{
|
|
1269
1351
|
className: "resize-handle resize-handle--corner resize-handle--top-left",
|
|
@@ -1271,7 +1353,7 @@ var DataPanel = React11.forwardRef(
|
|
|
1271
1353
|
onPointerDown: (e) => handleResizeStart(e, "top-left")
|
|
1272
1354
|
}
|
|
1273
1355
|
),
|
|
1274
|
-
/* @__PURE__ */ (0,
|
|
1356
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1275
1357
|
"div",
|
|
1276
1358
|
{
|
|
1277
1359
|
className: "resize-handle resize-handle--corner resize-handle--top-right",
|
|
@@ -1279,7 +1361,7 @@ var DataPanel = React11.forwardRef(
|
|
|
1279
1361
|
onPointerDown: (e) => handleResizeStart(e, "top-right")
|
|
1280
1362
|
}
|
|
1281
1363
|
),
|
|
1282
|
-
/* @__PURE__ */ (0,
|
|
1364
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1283
1365
|
"div",
|
|
1284
1366
|
{
|
|
1285
1367
|
className: "resize-handle resize-handle--corner resize-handle--bottom-left",
|
|
@@ -1287,7 +1369,7 @@ var DataPanel = React11.forwardRef(
|
|
|
1287
1369
|
onPointerDown: (e) => handleResizeStart(e, "bottom-left")
|
|
1288
1370
|
}
|
|
1289
1371
|
),
|
|
1290
|
-
/* @__PURE__ */ (0,
|
|
1372
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1291
1373
|
"div",
|
|
1292
1374
|
{
|
|
1293
1375
|
className: "resize-handle resize-handle--corner resize-handle--bottom-right",
|
|
@@ -1295,7 +1377,7 @@ var DataPanel = React11.forwardRef(
|
|
|
1295
1377
|
onPointerDown: (e) => handleResizeStart(e, "bottom-right")
|
|
1296
1378
|
}
|
|
1297
1379
|
)
|
|
1298
|
-
] }) : /* @__PURE__ */ (0,
|
|
1380
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1299
1381
|
"div",
|
|
1300
1382
|
{
|
|
1301
1383
|
className: cn(
|
|
@@ -1346,6 +1428,7 @@ DataPanel.displayName = "DataPanel";
|
|
|
1346
1428
|
Input,
|
|
1347
1429
|
Label,
|
|
1348
1430
|
PageHeader,
|
|
1431
|
+
PasswordInput,
|
|
1349
1432
|
Separator,
|
|
1350
1433
|
Switch,
|
|
1351
1434
|
badgeVariants,
|