@bubble-design-system/ui 1.0.1 → 1.2.0
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/README.md +607 -303
- package/dist/index.cjs +1252 -181
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +131 -10
- package/dist/index.d.ts +131 -10
- package/dist/index.js +1246 -183
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1900 -577
- package/dist/tokens.css +472 -382
- package/package.json +9 -8
package/dist/index.cjs
CHANGED
|
@@ -20,6 +20,7 @@ var tabs = require('@base-ui/react/tabs');
|
|
|
20
20
|
var menu = require('@base-ui/react/menu');
|
|
21
21
|
var toggle = require('@base-ui/react/toggle');
|
|
22
22
|
var toggleGroup = require('@base-ui/react/toggle-group');
|
|
23
|
+
var popover = require('@base-ui/react/popover');
|
|
23
24
|
|
|
24
25
|
// src/utils/cn.ts
|
|
25
26
|
function cn(...inputs) {
|
|
@@ -196,15 +197,22 @@ var SelectValue = react.forwardRef(
|
|
|
196
197
|
SelectValue.displayName = "Select.Value";
|
|
197
198
|
var SelectContent = react.forwardRef(
|
|
198
199
|
({ className, sideOffset = 6, children, ...props }, ref) => {
|
|
199
|
-
return /* @__PURE__ */ jsxRuntime.jsx(select.Select.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
200
|
-
select.Select.
|
|
200
|
+
return /* @__PURE__ */ jsxRuntime.jsx(select.Select.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
201
|
+
select.Select.Positioner,
|
|
201
202
|
{
|
|
202
|
-
|
|
203
|
-
className:
|
|
204
|
-
|
|
205
|
-
|
|
203
|
+
sideOffset,
|
|
204
|
+
className: "pds-select-positioner",
|
|
205
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
206
|
+
select.Select.Popup,
|
|
207
|
+
{
|
|
208
|
+
ref,
|
|
209
|
+
className: cn("pds-select-popup", className),
|
|
210
|
+
...props,
|
|
211
|
+
children
|
|
212
|
+
}
|
|
213
|
+
)
|
|
206
214
|
}
|
|
207
|
-
) })
|
|
215
|
+
) });
|
|
208
216
|
}
|
|
209
217
|
);
|
|
210
218
|
SelectContent.displayName = "Select.Content";
|
|
@@ -323,7 +331,12 @@ Divider.displayName = "Divider";
|
|
|
323
331
|
var ModalContent = react.forwardRef(
|
|
324
332
|
({ className, backdropClassName, children, ...props }, ref) => {
|
|
325
333
|
return /* @__PURE__ */ jsxRuntime.jsxs(dialog.Dialog.Portal, { children: [
|
|
326
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
334
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
335
|
+
dialog.Dialog.Backdrop,
|
|
336
|
+
{
|
|
337
|
+
className: cn("pds-modal-backdrop", backdropClassName)
|
|
338
|
+
}
|
|
339
|
+
),
|
|
327
340
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
328
341
|
dialog.Dialog.Popup,
|
|
329
342
|
{
|
|
@@ -350,18 +363,16 @@ var ModalTitle = react.forwardRef(
|
|
|
350
363
|
}
|
|
351
364
|
);
|
|
352
365
|
ModalTitle.displayName = "Modal.Title";
|
|
353
|
-
var ModalDescription = react.forwardRef(
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
}
|
|
364
|
-
);
|
|
366
|
+
var ModalDescription = react.forwardRef(({ className, ...props }, ref) => {
|
|
367
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
368
|
+
dialog.Dialog.Description,
|
|
369
|
+
{
|
|
370
|
+
ref,
|
|
371
|
+
className: cn("pds-modal-description", className),
|
|
372
|
+
...props
|
|
373
|
+
}
|
|
374
|
+
);
|
|
375
|
+
});
|
|
365
376
|
ModalDescription.displayName = "Modal.Description";
|
|
366
377
|
var Modal = {
|
|
367
378
|
Root: dialog.Dialog.Root,
|
|
@@ -376,50 +387,33 @@ var ToastProvider = ({ children, ...props }) => {
|
|
|
376
387
|
return /* @__PURE__ */ jsxRuntime.jsx(toast.Toast.Provider, { ...props, children });
|
|
377
388
|
};
|
|
378
389
|
ToastProvider.displayName = "Toast.Provider";
|
|
379
|
-
var ToastViewport = react.forwardRef(
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
}
|
|
391
|
-
);
|
|
390
|
+
var ToastViewport = react.forwardRef(({ className, ...props }, ref) => {
|
|
391
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
392
|
+
toast.Toast.Viewport,
|
|
393
|
+
{
|
|
394
|
+
ref,
|
|
395
|
+
className: cn("pds-toast-viewport", className),
|
|
396
|
+
style: { ["--gap"]: "12px" },
|
|
397
|
+
...props
|
|
398
|
+
}
|
|
399
|
+
);
|
|
400
|
+
});
|
|
392
401
|
ToastViewport.displayName = "Toast.Viewport";
|
|
393
402
|
var Toaster = () => {
|
|
394
403
|
const { toasts } = useToastManager();
|
|
395
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ToastViewport, { children: toasts.map((toast$1) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
396
|
-
toast.Toast.
|
|
397
|
-
{
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
409
|
-
"path",
|
|
410
|
-
{
|
|
411
|
-
d: "M4 4l8 8M12 4l-8 8",
|
|
412
|
-
stroke: "currentColor",
|
|
413
|
-
strokeWidth: "1.5",
|
|
414
|
-
strokeLinecap: "round"
|
|
415
|
-
}
|
|
416
|
-
) })
|
|
417
|
-
}
|
|
418
|
-
)
|
|
419
|
-
]
|
|
420
|
-
},
|
|
421
|
-
toast$1.id
|
|
422
|
-
)) });
|
|
404
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ToastViewport, { children: toasts.map((toast$1) => /* @__PURE__ */ jsxRuntime.jsxs(toast.Toast.Root, { toast: toast$1, className: "pds-toast-item", children: [
|
|
405
|
+
toast$1.title ? /* @__PURE__ */ jsxRuntime.jsx(toast.Toast.Title, { className: "pds-toast-title" }) : null,
|
|
406
|
+
toast$1.description ? /* @__PURE__ */ jsxRuntime.jsx(toast.Toast.Description, { className: "pds-toast-description" }) : null,
|
|
407
|
+
/* @__PURE__ */ jsxRuntime.jsx(toast.Toast.Close, { "aria-label": "Close", className: "pds-toast-close", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
408
|
+
"path",
|
|
409
|
+
{
|
|
410
|
+
d: "M4 4l8 8M12 4l-8 8",
|
|
411
|
+
stroke: "currentColor",
|
|
412
|
+
strokeWidth: "1.5",
|
|
413
|
+
strokeLinecap: "round"
|
|
414
|
+
}
|
|
415
|
+
) }) })
|
|
416
|
+
] }, toast$1.id)) });
|
|
423
417
|
};
|
|
424
418
|
Toaster.displayName = "Toaster";
|
|
425
419
|
var Toast = {
|
|
@@ -428,7 +422,14 @@ var Toast = {
|
|
|
428
422
|
Toaster
|
|
429
423
|
};
|
|
430
424
|
var TooltipContent = react.forwardRef(
|
|
431
|
-
({
|
|
425
|
+
({
|
|
426
|
+
className,
|
|
427
|
+
sideOffset = 6,
|
|
428
|
+
side = "top",
|
|
429
|
+
align = "center",
|
|
430
|
+
children,
|
|
431
|
+
...props
|
|
432
|
+
}, ref) => {
|
|
432
433
|
return /* @__PURE__ */ jsxRuntime.jsx(tooltip.Tooltip.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
433
434
|
tooltip.Tooltip.Positioner,
|
|
434
435
|
{
|
|
@@ -520,21 +521,62 @@ var Tabs = Object.assign(TabsRoot, {
|
|
|
520
521
|
var icons = {
|
|
521
522
|
info: /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
522
523
|
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "8", cy: "8", r: "7", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
523
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
524
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
525
|
+
"path",
|
|
526
|
+
{
|
|
527
|
+
d: "M8 7.5v4",
|
|
528
|
+
stroke: "currentColor",
|
|
529
|
+
strokeWidth: "1.5",
|
|
530
|
+
strokeLinecap: "round"
|
|
531
|
+
}
|
|
532
|
+
),
|
|
524
533
|
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "8", cy: "5", r: "0.75", fill: "currentColor" })
|
|
525
534
|
] }),
|
|
526
535
|
success: /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
527
536
|
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "8", cy: "8", r: "7", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
528
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
537
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
538
|
+
"path",
|
|
539
|
+
{
|
|
540
|
+
d: "M5 8.5l2 2 4-4.5",
|
|
541
|
+
stroke: "currentColor",
|
|
542
|
+
strokeWidth: "1.5",
|
|
543
|
+
strokeLinecap: "round",
|
|
544
|
+
strokeLinejoin: "round"
|
|
545
|
+
}
|
|
546
|
+
)
|
|
529
547
|
] }),
|
|
530
548
|
warning: /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
531
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
532
|
-
|
|
549
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
550
|
+
"path",
|
|
551
|
+
{
|
|
552
|
+
d: "M8 1.75L14.5 13.5h-13L8 1.75z",
|
|
553
|
+
stroke: "currentColor",
|
|
554
|
+
strokeWidth: "1.5",
|
|
555
|
+
strokeLinejoin: "round"
|
|
556
|
+
}
|
|
557
|
+
),
|
|
558
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
559
|
+
"path",
|
|
560
|
+
{
|
|
561
|
+
d: "M8 6.5v3.5",
|
|
562
|
+
stroke: "currentColor",
|
|
563
|
+
strokeWidth: "1.5",
|
|
564
|
+
strokeLinecap: "round"
|
|
565
|
+
}
|
|
566
|
+
),
|
|
533
567
|
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "8", cy: "11.75", r: "0.75", fill: "currentColor" })
|
|
534
568
|
] }),
|
|
535
569
|
danger: /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
536
570
|
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "8", cy: "8", r: "7", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
537
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
571
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
572
|
+
"path",
|
|
573
|
+
{
|
|
574
|
+
d: "M5.5 5.5l5 5M10.5 5.5l-5 5",
|
|
575
|
+
stroke: "currentColor",
|
|
576
|
+
strokeWidth: "1.5",
|
|
577
|
+
strokeLinecap: "round"
|
|
578
|
+
}
|
|
579
|
+
)
|
|
538
580
|
] })
|
|
539
581
|
};
|
|
540
582
|
var Alert = react.forwardRef(
|
|
@@ -559,27 +601,25 @@ var Alert = react.forwardRef(
|
|
|
559
601
|
}
|
|
560
602
|
);
|
|
561
603
|
Alert.displayName = "Alert";
|
|
562
|
-
var DropdownMenuContent = react.forwardRef(
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
}
|
|
582
|
-
);
|
|
604
|
+
var DropdownMenuContent = react.forwardRef(({ className, sideOffset = 6, align = "start", children, ...props }, ref) => {
|
|
605
|
+
return /* @__PURE__ */ jsxRuntime.jsx(menu.Menu.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
606
|
+
menu.Menu.Positioner,
|
|
607
|
+
{
|
|
608
|
+
sideOffset,
|
|
609
|
+
align,
|
|
610
|
+
className: "pds-menu-positioner",
|
|
611
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
612
|
+
menu.Menu.Popup,
|
|
613
|
+
{
|
|
614
|
+
ref,
|
|
615
|
+
className: cn("pds-menu-popup", className),
|
|
616
|
+
...props,
|
|
617
|
+
children
|
|
618
|
+
}
|
|
619
|
+
)
|
|
620
|
+
}
|
|
621
|
+
) });
|
|
622
|
+
});
|
|
583
623
|
DropdownMenuContent.displayName = "DropdownMenu.Content";
|
|
584
624
|
var DropdownMenuItem = react.forwardRef(
|
|
585
625
|
({ className, ...props }, ref) => {
|
|
@@ -594,48 +634,44 @@ var DropdownMenuItem = react.forwardRef(
|
|
|
594
634
|
}
|
|
595
635
|
);
|
|
596
636
|
DropdownMenuItem.displayName = "DropdownMenu.Item";
|
|
597
|
-
var DropdownMenuCheckboxItem = react.forwardRef(
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
children:
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
}
|
|
621
|
-
);
|
|
637
|
+
var DropdownMenuCheckboxItem = react.forwardRef(({ className, children, ...props }, ref) => {
|
|
638
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
639
|
+
menu.Menu.CheckboxItem,
|
|
640
|
+
{
|
|
641
|
+
ref,
|
|
642
|
+
className: cn("pds-menu-item", "pds-menu-item--indented", className),
|
|
643
|
+
...props,
|
|
644
|
+
children: [
|
|
645
|
+
/* @__PURE__ */ jsxRuntime.jsx(menu.Menu.CheckboxItemIndicator, { className: "pds-menu-item__indicator", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
646
|
+
"path",
|
|
647
|
+
{
|
|
648
|
+
d: "M3.5 8.5l3 3 6-6.5",
|
|
649
|
+
stroke: "currentColor",
|
|
650
|
+
strokeWidth: "2",
|
|
651
|
+
strokeLinecap: "round",
|
|
652
|
+
strokeLinejoin: "round"
|
|
653
|
+
}
|
|
654
|
+
) }) }),
|
|
655
|
+
children
|
|
656
|
+
]
|
|
657
|
+
}
|
|
658
|
+
);
|
|
659
|
+
});
|
|
622
660
|
DropdownMenuCheckboxItem.displayName = "DropdownMenu.CheckboxItem";
|
|
623
|
-
var DropdownMenuRadioItem = react.forwardRef(
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
children:
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
}
|
|
638
|
-
);
|
|
661
|
+
var DropdownMenuRadioItem = react.forwardRef(({ className, children, ...props }, ref) => {
|
|
662
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
663
|
+
menu.Menu.RadioItem,
|
|
664
|
+
{
|
|
665
|
+
ref,
|
|
666
|
+
className: cn("pds-menu-item", "pds-menu-item--indented", className),
|
|
667
|
+
...props,
|
|
668
|
+
children: [
|
|
669
|
+
/* @__PURE__ */ jsxRuntime.jsx(menu.Menu.RadioItemIndicator, { className: "pds-menu-item__indicator pds-menu-item__indicator--radio", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "8", cy: "8", r: "8" }) }) }),
|
|
670
|
+
children
|
|
671
|
+
]
|
|
672
|
+
}
|
|
673
|
+
);
|
|
674
|
+
});
|
|
639
675
|
DropdownMenuRadioItem.displayName = "DropdownMenu.RadioItem";
|
|
640
676
|
var DropdownMenuLabel = react.forwardRef(
|
|
641
677
|
({ className, ...props }, ref) => {
|
|
@@ -650,18 +686,16 @@ var DropdownMenuLabel = react.forwardRef(
|
|
|
650
686
|
}
|
|
651
687
|
);
|
|
652
688
|
DropdownMenuLabel.displayName = "DropdownMenu.Label";
|
|
653
|
-
var DropdownMenuSeparator = react.forwardRef(
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
}
|
|
664
|
-
);
|
|
689
|
+
var DropdownMenuSeparator = react.forwardRef(({ className, ...props }, ref) => {
|
|
690
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
691
|
+
menu.Menu.Separator,
|
|
692
|
+
{
|
|
693
|
+
ref,
|
|
694
|
+
className: cn("pds-menu-separator", className),
|
|
695
|
+
...props
|
|
696
|
+
}
|
|
697
|
+
);
|
|
698
|
+
});
|
|
665
699
|
DropdownMenuSeparator.displayName = "DropdownMenu.Separator";
|
|
666
700
|
var DropdownMenu = {
|
|
667
701
|
Root: menu.Menu.Root,
|
|
@@ -703,25 +737,11 @@ var CardRoot = react.forwardRef(
|
|
|
703
737
|
);
|
|
704
738
|
CardRoot.displayName = "Card";
|
|
705
739
|
var CardHeader = react.forwardRef(
|
|
706
|
-
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
707
|
-
"div",
|
|
708
|
-
{
|
|
709
|
-
ref,
|
|
710
|
-
className: cn("pds-card__header", className),
|
|
711
|
-
...props
|
|
712
|
-
}
|
|
713
|
-
)
|
|
740
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("pds-card__header", className), ...props })
|
|
714
741
|
);
|
|
715
742
|
CardHeader.displayName = "Card.Header";
|
|
716
743
|
var CardTitle = react.forwardRef(
|
|
717
|
-
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
718
|
-
"h3",
|
|
719
|
-
{
|
|
720
|
-
ref,
|
|
721
|
-
className: cn("pds-card__title", className),
|
|
722
|
-
...props
|
|
723
|
-
}
|
|
724
|
-
)
|
|
744
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("h3", { ref, className: cn("pds-card__title", className), ...props })
|
|
725
745
|
);
|
|
726
746
|
CardTitle.displayName = "Card.Title";
|
|
727
747
|
var CardDescription = react.forwardRef(
|
|
@@ -736,36 +756,15 @@ var CardDescription = react.forwardRef(
|
|
|
736
756
|
);
|
|
737
757
|
CardDescription.displayName = "Card.Description";
|
|
738
758
|
var CardAction = react.forwardRef(
|
|
739
|
-
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
740
|
-
"div",
|
|
741
|
-
{
|
|
742
|
-
ref,
|
|
743
|
-
className: cn("pds-card__action", className),
|
|
744
|
-
...props
|
|
745
|
-
}
|
|
746
|
-
)
|
|
759
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("pds-card__action", className), ...props })
|
|
747
760
|
);
|
|
748
761
|
CardAction.displayName = "Card.Action";
|
|
749
762
|
var CardBody = react.forwardRef(
|
|
750
|
-
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
751
|
-
"div",
|
|
752
|
-
{
|
|
753
|
-
ref,
|
|
754
|
-
className: cn("pds-card__body", className),
|
|
755
|
-
...props
|
|
756
|
-
}
|
|
757
|
-
)
|
|
763
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("pds-card__body", className), ...props })
|
|
758
764
|
);
|
|
759
765
|
CardBody.displayName = "Card.Body";
|
|
760
766
|
var CardFooter = react.forwardRef(
|
|
761
|
-
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
762
|
-
"div",
|
|
763
|
-
{
|
|
764
|
-
ref,
|
|
765
|
-
className: cn("pds-card__footer", className),
|
|
766
|
-
...props
|
|
767
|
-
}
|
|
768
|
-
)
|
|
767
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("pds-card__footer", className), ...props })
|
|
769
768
|
);
|
|
770
769
|
CardFooter.displayName = "Card.Footer";
|
|
771
770
|
var Card = Object.assign(CardRoot, {
|
|
@@ -944,19 +943,1090 @@ GridCol.displayName = "Grid.Col";
|
|
|
944
943
|
var Grid = Object.assign(GridRoot, {
|
|
945
944
|
Col: GridCol
|
|
946
945
|
});
|
|
946
|
+
var PopoverContent = react.forwardRef(
|
|
947
|
+
({
|
|
948
|
+
className,
|
|
949
|
+
side = "bottom",
|
|
950
|
+
align = "center",
|
|
951
|
+
sideOffset = 10,
|
|
952
|
+
showArrow = true,
|
|
953
|
+
children,
|
|
954
|
+
...props
|
|
955
|
+
}, ref) => {
|
|
956
|
+
return /* @__PURE__ */ jsxRuntime.jsx(popover.Popover.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
957
|
+
popover.Popover.Positioner,
|
|
958
|
+
{
|
|
959
|
+
side,
|
|
960
|
+
align,
|
|
961
|
+
sideOffset,
|
|
962
|
+
className: "pds-popover-positioner",
|
|
963
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
964
|
+
popover.Popover.Popup,
|
|
965
|
+
{
|
|
966
|
+
ref,
|
|
967
|
+
className: cn("pds-popover-popup", className),
|
|
968
|
+
...props,
|
|
969
|
+
children: [
|
|
970
|
+
showArrow && /* @__PURE__ */ jsxRuntime.jsx(popover.Popover.Arrow, { className: "pds-popover-arrow" }),
|
|
971
|
+
children
|
|
972
|
+
]
|
|
973
|
+
}
|
|
974
|
+
)
|
|
975
|
+
}
|
|
976
|
+
) });
|
|
977
|
+
}
|
|
978
|
+
);
|
|
979
|
+
PopoverContent.displayName = "Popover.Content";
|
|
980
|
+
var PopoverTitle = react.forwardRef(
|
|
981
|
+
({ className, ...props }, ref) => {
|
|
982
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
983
|
+
popover.Popover.Title,
|
|
984
|
+
{
|
|
985
|
+
ref,
|
|
986
|
+
className: cn("pds-popover-title", className),
|
|
987
|
+
...props
|
|
988
|
+
}
|
|
989
|
+
);
|
|
990
|
+
}
|
|
991
|
+
);
|
|
992
|
+
PopoverTitle.displayName = "Popover.Title";
|
|
993
|
+
var PopoverDescription = react.forwardRef(({ className, ...props }, ref) => {
|
|
994
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
995
|
+
popover.Popover.Description,
|
|
996
|
+
{
|
|
997
|
+
ref,
|
|
998
|
+
className: cn("pds-popover-description", className),
|
|
999
|
+
...props
|
|
1000
|
+
}
|
|
1001
|
+
);
|
|
1002
|
+
});
|
|
1003
|
+
PopoverDescription.displayName = "Popover.Description";
|
|
1004
|
+
var PopoverHeader = react.forwardRef(
|
|
1005
|
+
({ className, ...props }, ref) => {
|
|
1006
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1007
|
+
"div",
|
|
1008
|
+
{
|
|
1009
|
+
ref,
|
|
1010
|
+
className: cn("pds-popover__header", className),
|
|
1011
|
+
...props
|
|
1012
|
+
}
|
|
1013
|
+
);
|
|
1014
|
+
}
|
|
1015
|
+
);
|
|
1016
|
+
PopoverHeader.displayName = "Popover.Header";
|
|
1017
|
+
var PopoverBody = react.forwardRef(
|
|
1018
|
+
({ className, ...props }, ref) => {
|
|
1019
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1020
|
+
"div",
|
|
1021
|
+
{
|
|
1022
|
+
ref,
|
|
1023
|
+
className: cn("pds-popover__body", className),
|
|
1024
|
+
...props
|
|
1025
|
+
}
|
|
1026
|
+
);
|
|
1027
|
+
}
|
|
1028
|
+
);
|
|
1029
|
+
PopoverBody.displayName = "Popover.Body";
|
|
1030
|
+
var PopoverFooter = react.forwardRef(
|
|
1031
|
+
({ className, ...props }, ref) => {
|
|
1032
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1033
|
+
"div",
|
|
1034
|
+
{
|
|
1035
|
+
ref,
|
|
1036
|
+
className: cn("pds-popover__footer", className),
|
|
1037
|
+
...props
|
|
1038
|
+
}
|
|
1039
|
+
);
|
|
1040
|
+
}
|
|
1041
|
+
);
|
|
1042
|
+
PopoverFooter.displayName = "Popover.Footer";
|
|
1043
|
+
var Popover = {
|
|
1044
|
+
Root: popover.Popover.Root,
|
|
1045
|
+
Trigger: popover.Popover.Trigger,
|
|
1046
|
+
Content: PopoverContent,
|
|
1047
|
+
Title: PopoverTitle,
|
|
1048
|
+
Description: PopoverDescription,
|
|
1049
|
+
Close: popover.Popover.Close,
|
|
1050
|
+
Header: PopoverHeader,
|
|
1051
|
+
Body: PopoverBody,
|
|
1052
|
+
Footer: PopoverFooter
|
|
1053
|
+
};
|
|
1054
|
+
function SearchIcon() {
|
|
1055
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1056
|
+
"svg",
|
|
1057
|
+
{
|
|
1058
|
+
width: "14",
|
|
1059
|
+
height: "14",
|
|
1060
|
+
viewBox: "0 0 14 14",
|
|
1061
|
+
fill: "none",
|
|
1062
|
+
"aria-hidden": "true",
|
|
1063
|
+
children: [
|
|
1064
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1065
|
+
"circle",
|
|
1066
|
+
{
|
|
1067
|
+
cx: "6.2",
|
|
1068
|
+
cy: "6.2",
|
|
1069
|
+
r: "4.3",
|
|
1070
|
+
stroke: "currentColor",
|
|
1071
|
+
strokeWidth: "1.4"
|
|
1072
|
+
}
|
|
1073
|
+
),
|
|
1074
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1075
|
+
"path",
|
|
1076
|
+
{
|
|
1077
|
+
d: "M9.5 9.5L13 13",
|
|
1078
|
+
stroke: "currentColor",
|
|
1079
|
+
strokeWidth: "1.4",
|
|
1080
|
+
strokeLinecap: "round"
|
|
1081
|
+
}
|
|
1082
|
+
)
|
|
1083
|
+
]
|
|
1084
|
+
}
|
|
1085
|
+
);
|
|
1086
|
+
}
|
|
1087
|
+
function ChevronLeftIcon() {
|
|
1088
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1089
|
+
"svg",
|
|
1090
|
+
{
|
|
1091
|
+
width: "12",
|
|
1092
|
+
height: "12",
|
|
1093
|
+
viewBox: "0 0 12 12",
|
|
1094
|
+
fill: "none",
|
|
1095
|
+
"aria-hidden": "true",
|
|
1096
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1097
|
+
"path",
|
|
1098
|
+
{
|
|
1099
|
+
d: "M7.5 2L4 6l3.5 4",
|
|
1100
|
+
stroke: "currentColor",
|
|
1101
|
+
strokeWidth: "1.6",
|
|
1102
|
+
strokeLinecap: "round",
|
|
1103
|
+
strokeLinejoin: "round"
|
|
1104
|
+
}
|
|
1105
|
+
)
|
|
1106
|
+
}
|
|
1107
|
+
);
|
|
1108
|
+
}
|
|
1109
|
+
function ChevronRightIcon() {
|
|
1110
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1111
|
+
"svg",
|
|
1112
|
+
{
|
|
1113
|
+
width: "12",
|
|
1114
|
+
height: "12",
|
|
1115
|
+
viewBox: "0 0 12 12",
|
|
1116
|
+
fill: "none",
|
|
1117
|
+
"aria-hidden": "true",
|
|
1118
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1119
|
+
"path",
|
|
1120
|
+
{
|
|
1121
|
+
d: "M4.5 2L8 6l-3.5 4",
|
|
1122
|
+
stroke: "currentColor",
|
|
1123
|
+
strokeWidth: "1.6",
|
|
1124
|
+
strokeLinecap: "round",
|
|
1125
|
+
strokeLinejoin: "round"
|
|
1126
|
+
}
|
|
1127
|
+
)
|
|
1128
|
+
}
|
|
1129
|
+
);
|
|
1130
|
+
}
|
|
1131
|
+
function SortIcon({ direction }) {
|
|
1132
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pds-datatable__sort-icon", "aria-hidden": "true", children: [
|
|
1133
|
+
/* @__PURE__ */ jsxRuntime.jsx("svg", { width: "7", height: "4", viewBox: "0 0 7 4", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1134
|
+
"path",
|
|
1135
|
+
{
|
|
1136
|
+
d: "M0 4L3.5 0L7 4H0Z",
|
|
1137
|
+
fill: direction === "asc" ? "var(--color-text-brand)" : "currentColor"
|
|
1138
|
+
}
|
|
1139
|
+
) }),
|
|
1140
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1141
|
+
"svg",
|
|
1142
|
+
{
|
|
1143
|
+
width: "7",
|
|
1144
|
+
height: "4",
|
|
1145
|
+
viewBox: "0 0 7 4",
|
|
1146
|
+
fill: "none",
|
|
1147
|
+
style: { opacity: direction === "desc" ? 1 : 0.3 },
|
|
1148
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1149
|
+
"path",
|
|
1150
|
+
{
|
|
1151
|
+
d: "M0 0L3.5 4L7 0H0Z",
|
|
1152
|
+
fill: direction === "desc" ? "var(--color-text-brand)" : "currentColor"
|
|
1153
|
+
}
|
|
1154
|
+
)
|
|
1155
|
+
}
|
|
1156
|
+
)
|
|
1157
|
+
] });
|
|
1158
|
+
}
|
|
1159
|
+
function renderCell(value) {
|
|
1160
|
+
if (value === null || value === void 0) return "\u2014";
|
|
1161
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
1162
|
+
return value;
|
|
1163
|
+
}
|
|
1164
|
+
return String(value);
|
|
1165
|
+
}
|
|
1166
|
+
function DataTable({
|
|
1167
|
+
columns,
|
|
1168
|
+
data,
|
|
1169
|
+
selectable = true,
|
|
1170
|
+
searchable = true,
|
|
1171
|
+
pageSize = 10,
|
|
1172
|
+
actions,
|
|
1173
|
+
className
|
|
1174
|
+
}) {
|
|
1175
|
+
const [query, setQuery] = react.useState("");
|
|
1176
|
+
const [selected, setSelected] = react.useState(/* @__PURE__ */ new Set());
|
|
1177
|
+
const [sort, setSort] = react.useState(
|
|
1178
|
+
{ key: null, dir: "asc" }
|
|
1179
|
+
);
|
|
1180
|
+
const [page, setPage] = react.useState(1);
|
|
1181
|
+
const filtered = react.useMemo(() => {
|
|
1182
|
+
let rows = data;
|
|
1183
|
+
if (query.trim()) {
|
|
1184
|
+
const q = query.toLowerCase();
|
|
1185
|
+
rows = rows.filter(
|
|
1186
|
+
(row) => columns.some((col) => {
|
|
1187
|
+
const v = row[col.key];
|
|
1188
|
+
return v != null && String(v).toLowerCase().includes(q);
|
|
1189
|
+
})
|
|
1190
|
+
);
|
|
1191
|
+
}
|
|
1192
|
+
if (sort.key) {
|
|
1193
|
+
const key = sort.key;
|
|
1194
|
+
rows = [...rows].sort((a, b) => {
|
|
1195
|
+
const av = a[key] ?? "";
|
|
1196
|
+
const bv = b[key] ?? "";
|
|
1197
|
+
const cmp = String(av).localeCompare(String(bv), void 0, {
|
|
1198
|
+
numeric: true
|
|
1199
|
+
});
|
|
1200
|
+
return sort.dir === "asc" ? cmp : -cmp;
|
|
1201
|
+
});
|
|
1202
|
+
}
|
|
1203
|
+
return rows;
|
|
1204
|
+
}, [data, query, sort, columns]);
|
|
1205
|
+
const totalPages = Math.max(1, Math.ceil(filtered.length / pageSize));
|
|
1206
|
+
const pageData = filtered.slice((page - 1) * pageSize, page * pageSize);
|
|
1207
|
+
const allSelected = pageData.length > 0 && pageData.every((r) => selected.has(r.id));
|
|
1208
|
+
const someSelected = pageData.some((r) => selected.has(r.id));
|
|
1209
|
+
const toggleAll = () => {
|
|
1210
|
+
const next = new Set(selected);
|
|
1211
|
+
if (allSelected) {
|
|
1212
|
+
pageData.forEach((r) => next.delete(r.id));
|
|
1213
|
+
} else {
|
|
1214
|
+
pageData.forEach((r) => next.add(r.id));
|
|
1215
|
+
}
|
|
1216
|
+
setSelected(next);
|
|
1217
|
+
};
|
|
1218
|
+
const toggleRow = (id) => {
|
|
1219
|
+
const next = new Set(selected);
|
|
1220
|
+
if (next.has(id)) next.delete(id);
|
|
1221
|
+
else next.add(id);
|
|
1222
|
+
setSelected(next);
|
|
1223
|
+
};
|
|
1224
|
+
const toggleSort = (key) => {
|
|
1225
|
+
setSort(
|
|
1226
|
+
(s) => s.key === key ? { key, dir: s.dir === "asc" ? "desc" : "asc" } : { key, dir: "asc" }
|
|
1227
|
+
);
|
|
1228
|
+
setPage(1);
|
|
1229
|
+
};
|
|
1230
|
+
const onSearch = (e) => {
|
|
1231
|
+
setQuery(e.target.value);
|
|
1232
|
+
setPage(1);
|
|
1233
|
+
};
|
|
1234
|
+
const startItem = filtered.length === 0 ? 0 : (page - 1) * pageSize + 1;
|
|
1235
|
+
const endItem = Math.min(page * pageSize, filtered.length);
|
|
1236
|
+
const pageNums = (() => {
|
|
1237
|
+
if (totalPages <= 5) {
|
|
1238
|
+
return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
1239
|
+
}
|
|
1240
|
+
if (page <= 3) return [1, 2, 3, 4, 5];
|
|
1241
|
+
if (page >= totalPages - 2) {
|
|
1242
|
+
return [
|
|
1243
|
+
totalPages - 4,
|
|
1244
|
+
totalPages - 3,
|
|
1245
|
+
totalPages - 2,
|
|
1246
|
+
totalPages - 1,
|
|
1247
|
+
totalPages
|
|
1248
|
+
];
|
|
1249
|
+
}
|
|
1250
|
+
return [page - 2, page - 1, page, page + 1, page + 2];
|
|
1251
|
+
})();
|
|
1252
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("pds-datatable", className), children: [
|
|
1253
|
+
(searchable || actions) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pds-datatable__toolbar", children: [
|
|
1254
|
+
searchable && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pds-datatable__search", children: [
|
|
1255
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pds-datatable__search-icon", children: /* @__PURE__ */ jsxRuntime.jsx(SearchIcon, {}) }),
|
|
1256
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1257
|
+
"input",
|
|
1258
|
+
{
|
|
1259
|
+
className: "pds-datatable__search-input",
|
|
1260
|
+
type: "search",
|
|
1261
|
+
placeholder: "Search\u2026",
|
|
1262
|
+
value: query,
|
|
1263
|
+
onChange: onSearch,
|
|
1264
|
+
"aria-label": "Search table"
|
|
1265
|
+
}
|
|
1266
|
+
)
|
|
1267
|
+
] }),
|
|
1268
|
+
selected.size > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pds-datatable__bulk-label", children: [
|
|
1269
|
+
selected.size,
|
|
1270
|
+
" selected"
|
|
1271
|
+
] }),
|
|
1272
|
+
actions && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pds-datatable__toolbar-right", children: actions })
|
|
1273
|
+
] }),
|
|
1274
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pds-datatable__wrap", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1275
|
+
"table",
|
|
1276
|
+
{
|
|
1277
|
+
className: cn(
|
|
1278
|
+
"pds-datatable__table",
|
|
1279
|
+
selectable && "pds-datatable__table--selectable"
|
|
1280
|
+
),
|
|
1281
|
+
"aria-label": "Data table",
|
|
1282
|
+
children: [
|
|
1283
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "pds-datatable__thead", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "pds-datatable__row", children: [
|
|
1284
|
+
selectable && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1285
|
+
"th",
|
|
1286
|
+
{
|
|
1287
|
+
className: "pds-datatable__th pds-datatable__check-col",
|
|
1288
|
+
"aria-label": "Select all",
|
|
1289
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1290
|
+
Checkbox,
|
|
1291
|
+
{
|
|
1292
|
+
size: "sm",
|
|
1293
|
+
checked: allSelected,
|
|
1294
|
+
indeterminate: someSelected && !allSelected,
|
|
1295
|
+
onCheckedChange: toggleAll
|
|
1296
|
+
}
|
|
1297
|
+
)
|
|
1298
|
+
}
|
|
1299
|
+
),
|
|
1300
|
+
columns.map((col) => {
|
|
1301
|
+
const sortable = col.sortable !== false;
|
|
1302
|
+
const isSorted = sort.key === col.key;
|
|
1303
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1304
|
+
"th",
|
|
1305
|
+
{
|
|
1306
|
+
className: cn(
|
|
1307
|
+
"pds-datatable__th",
|
|
1308
|
+
sortable && "pds-datatable__th--sort",
|
|
1309
|
+
isSorted && "pds-datatable__th--sorted"
|
|
1310
|
+
),
|
|
1311
|
+
onClick: sortable ? () => toggleSort(col.key) : void 0,
|
|
1312
|
+
style: col.width ? { width: col.width } : void 0,
|
|
1313
|
+
"aria-sort": isSorted ? sort.dir === "asc" ? "ascending" : "descending" : void 0,
|
|
1314
|
+
children: [
|
|
1315
|
+
col.label,
|
|
1316
|
+
sortable && /* @__PURE__ */ jsxRuntime.jsx(SortIcon, { direction: isSorted ? sort.dir : null })
|
|
1317
|
+
]
|
|
1318
|
+
},
|
|
1319
|
+
col.key
|
|
1320
|
+
);
|
|
1321
|
+
})
|
|
1322
|
+
] }) }),
|
|
1323
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "pds-datatable__tbody", children: pageData.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "pds-datatable__row", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1324
|
+
"td",
|
|
1325
|
+
{
|
|
1326
|
+
className: "pds-datatable__td pds-datatable__empty",
|
|
1327
|
+
colSpan: columns.length + (selectable ? 1 : 0),
|
|
1328
|
+
children: "No results found"
|
|
1329
|
+
}
|
|
1330
|
+
) }) : pageData.map((row) => {
|
|
1331
|
+
const isSel = selected.has(row.id);
|
|
1332
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1333
|
+
"tr",
|
|
1334
|
+
{
|
|
1335
|
+
className: cn(
|
|
1336
|
+
"pds-datatable__row",
|
|
1337
|
+
isSel && "pds-datatable__row--selected"
|
|
1338
|
+
),
|
|
1339
|
+
"aria-selected": isSel,
|
|
1340
|
+
onClick: selectable ? () => toggleRow(row.id) : void 0,
|
|
1341
|
+
children: [
|
|
1342
|
+
selectable && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1343
|
+
"td",
|
|
1344
|
+
{
|
|
1345
|
+
className: "pds-datatable__td pds-datatable__check-col",
|
|
1346
|
+
onClick: (e) => e.stopPropagation(),
|
|
1347
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1348
|
+
Checkbox,
|
|
1349
|
+
{
|
|
1350
|
+
size: "sm",
|
|
1351
|
+
checked: isSel,
|
|
1352
|
+
onCheckedChange: () => toggleRow(row.id)
|
|
1353
|
+
}
|
|
1354
|
+
)
|
|
1355
|
+
}
|
|
1356
|
+
),
|
|
1357
|
+
columns.map((col) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1358
|
+
"td",
|
|
1359
|
+
{
|
|
1360
|
+
className: cn(
|
|
1361
|
+
"pds-datatable__td",
|
|
1362
|
+
col.muted && "pds-datatable__td--muted",
|
|
1363
|
+
col.mono && "pds-datatable__td--mono"
|
|
1364
|
+
),
|
|
1365
|
+
children: col.render ? col.render(
|
|
1366
|
+
row[col.key],
|
|
1367
|
+
row
|
|
1368
|
+
) : renderCell(
|
|
1369
|
+
row[col.key]
|
|
1370
|
+
)
|
|
1371
|
+
},
|
|
1372
|
+
col.key
|
|
1373
|
+
))
|
|
1374
|
+
]
|
|
1375
|
+
},
|
|
1376
|
+
row.id
|
|
1377
|
+
);
|
|
1378
|
+
}) })
|
|
1379
|
+
]
|
|
1380
|
+
}
|
|
1381
|
+
) }),
|
|
1382
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pds-datatable__footer", children: [
|
|
1383
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pds-datatable__page-info", children: filtered.length === 0 ? "No results" : `${startItem}\u2013${endItem} of ${filtered.length}` }),
|
|
1384
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1385
|
+
"div",
|
|
1386
|
+
{
|
|
1387
|
+
className: "pds-datatable__pagination",
|
|
1388
|
+
role: "navigation",
|
|
1389
|
+
"aria-label": "Pagination",
|
|
1390
|
+
children: [
|
|
1391
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1392
|
+
"button",
|
|
1393
|
+
{
|
|
1394
|
+
type: "button",
|
|
1395
|
+
className: "pds-datatable__page-btn",
|
|
1396
|
+
onClick: () => setPage((p) => Math.max(1, p - 1)),
|
|
1397
|
+
disabled: page <= 1,
|
|
1398
|
+
"aria-label": "Previous page",
|
|
1399
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ChevronLeftIcon, {})
|
|
1400
|
+
}
|
|
1401
|
+
),
|
|
1402
|
+
pageNums.map((p) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1403
|
+
"button",
|
|
1404
|
+
{
|
|
1405
|
+
type: "button",
|
|
1406
|
+
className: cn(
|
|
1407
|
+
"pds-datatable__page-btn",
|
|
1408
|
+
p === page && "pds-datatable__page-btn--active"
|
|
1409
|
+
),
|
|
1410
|
+
onClick: () => setPage(p),
|
|
1411
|
+
"aria-current": p === page ? "page" : void 0,
|
|
1412
|
+
children: p
|
|
1413
|
+
},
|
|
1414
|
+
p
|
|
1415
|
+
)),
|
|
1416
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1417
|
+
"button",
|
|
1418
|
+
{
|
|
1419
|
+
type: "button",
|
|
1420
|
+
className: "pds-datatable__page-btn",
|
|
1421
|
+
onClick: () => setPage((p) => Math.min(totalPages, p + 1)),
|
|
1422
|
+
disabled: page >= totalPages,
|
|
1423
|
+
"aria-label": "Next page",
|
|
1424
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ChevronRightIcon, {})
|
|
1425
|
+
}
|
|
1426
|
+
)
|
|
1427
|
+
]
|
|
1428
|
+
}
|
|
1429
|
+
)
|
|
1430
|
+
] })
|
|
1431
|
+
] });
|
|
1432
|
+
}
|
|
1433
|
+
function SearchIcon2({ size = 16 }) {
|
|
1434
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1435
|
+
"svg",
|
|
1436
|
+
{
|
|
1437
|
+
width: size,
|
|
1438
|
+
height: size,
|
|
1439
|
+
viewBox: "0 0 16 16",
|
|
1440
|
+
fill: "none",
|
|
1441
|
+
"aria-hidden": "true",
|
|
1442
|
+
children: [
|
|
1443
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "7", cy: "7", r: "4.5", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
1444
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1445
|
+
"path",
|
|
1446
|
+
{
|
|
1447
|
+
d: "M10.5 10.5L14 14",
|
|
1448
|
+
stroke: "currentColor",
|
|
1449
|
+
strokeWidth: "1.5",
|
|
1450
|
+
strokeLinecap: "round"
|
|
1451
|
+
}
|
|
1452
|
+
)
|
|
1453
|
+
]
|
|
1454
|
+
}
|
|
1455
|
+
);
|
|
1456
|
+
}
|
|
1457
|
+
function XSmallIcon({ size = 10 }) {
|
|
1458
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1459
|
+
"svg",
|
|
1460
|
+
{
|
|
1461
|
+
width: size,
|
|
1462
|
+
height: size,
|
|
1463
|
+
viewBox: "0 0 10 10",
|
|
1464
|
+
fill: "none",
|
|
1465
|
+
"aria-hidden": "true",
|
|
1466
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1467
|
+
"path",
|
|
1468
|
+
{
|
|
1469
|
+
d: "M2 2l6 6M8 2L2 8",
|
|
1470
|
+
stroke: "currentColor",
|
|
1471
|
+
strokeWidth: "1.6",
|
|
1472
|
+
strokeLinecap: "round"
|
|
1473
|
+
}
|
|
1474
|
+
)
|
|
1475
|
+
}
|
|
1476
|
+
);
|
|
1477
|
+
}
|
|
1478
|
+
function useCommandPalette() {
|
|
1479
|
+
const [open, setOpen] = react.useState(false);
|
|
1480
|
+
react.useEffect(() => {
|
|
1481
|
+
const handler = (e) => {
|
|
1482
|
+
if ((e.metaKey || e.ctrlKey) && e.key === "k") {
|
|
1483
|
+
e.preventDefault();
|
|
1484
|
+
setOpen((o) => !o);
|
|
1485
|
+
}
|
|
1486
|
+
};
|
|
1487
|
+
window.addEventListener("keydown", handler);
|
|
1488
|
+
return () => window.removeEventListener("keydown", handler);
|
|
1489
|
+
}, []);
|
|
1490
|
+
return { open, setOpen };
|
|
1491
|
+
}
|
|
1492
|
+
function CommandPalette({
|
|
1493
|
+
open,
|
|
1494
|
+
onOpenChange,
|
|
1495
|
+
groups = [],
|
|
1496
|
+
placeholder = "Type to search",
|
|
1497
|
+
onSelect,
|
|
1498
|
+
className
|
|
1499
|
+
}) {
|
|
1500
|
+
const [query, setQuery] = react.useState("");
|
|
1501
|
+
const [activeIndex, setActiveIndex] = react.useState(0);
|
|
1502
|
+
const [prevOpen, setPrevOpen] = react.useState(open);
|
|
1503
|
+
const [prevQuery, setPrevQuery] = react.useState(query);
|
|
1504
|
+
const inputRef = react.useRef(null);
|
|
1505
|
+
if (open !== prevOpen) {
|
|
1506
|
+
setPrevOpen(open);
|
|
1507
|
+
if (open) {
|
|
1508
|
+
setQuery("");
|
|
1509
|
+
setActiveIndex(0);
|
|
1510
|
+
setPrevQuery("");
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
if (query !== prevQuery) {
|
|
1514
|
+
setPrevQuery(query);
|
|
1515
|
+
setActiveIndex(0);
|
|
1516
|
+
}
|
|
1517
|
+
const filteredGroups = react.useMemo(() => {
|
|
1518
|
+
if (!query.trim()) return groups;
|
|
1519
|
+
const q = query.toLowerCase();
|
|
1520
|
+
return groups.map((group) => ({
|
|
1521
|
+
...group,
|
|
1522
|
+
items: group.items.filter(
|
|
1523
|
+
(item) => item.label.toLowerCase().includes(q) || item.description && item.description.toLowerCase().includes(q) || item.keywords && item.keywords.some((k) => k.toLowerCase().includes(q))
|
|
1524
|
+
)
|
|
1525
|
+
})).filter((group) => group.items.length > 0);
|
|
1526
|
+
}, [groups, query]);
|
|
1527
|
+
const allItems = react.useMemo(
|
|
1528
|
+
() => filteredGroups.flatMap((group) => group.items),
|
|
1529
|
+
[filteredGroups]
|
|
1530
|
+
);
|
|
1531
|
+
const selectItem = (item) => {
|
|
1532
|
+
item.onSelect?.();
|
|
1533
|
+
onSelect?.(item);
|
|
1534
|
+
onOpenChange(false);
|
|
1535
|
+
};
|
|
1536
|
+
const onKeyDown = (e) => {
|
|
1537
|
+
if (e.key === "ArrowDown") {
|
|
1538
|
+
e.preventDefault();
|
|
1539
|
+
setActiveIndex((i) => Math.min(allItems.length - 1, i + 1));
|
|
1540
|
+
} else if (e.key === "ArrowUp") {
|
|
1541
|
+
e.preventDefault();
|
|
1542
|
+
setActiveIndex((i) => Math.max(0, i - 1));
|
|
1543
|
+
} else if (e.key === "Enter") {
|
|
1544
|
+
e.preventDefault();
|
|
1545
|
+
const item = allItems[activeIndex];
|
|
1546
|
+
if (item) selectItem(item);
|
|
1547
|
+
}
|
|
1548
|
+
};
|
|
1549
|
+
let flatIndex = 0;
|
|
1550
|
+
return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog.Root, { open, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(dialog.Dialog.Portal, { children: [
|
|
1551
|
+
/* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog.Backdrop, { className: "pds-command-palette-backdrop" }),
|
|
1552
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1553
|
+
dialog.Dialog.Popup,
|
|
1554
|
+
{
|
|
1555
|
+
className: cn("pds-command-palette", className),
|
|
1556
|
+
"aria-label": "Command palette",
|
|
1557
|
+
initialFocus: inputRef,
|
|
1558
|
+
children: [
|
|
1559
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pds-command-palette__search", children: [
|
|
1560
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pds-command-palette__search-icon", children: /* @__PURE__ */ jsxRuntime.jsx(SearchIcon2, { size: 16 }) }),
|
|
1561
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1562
|
+
"input",
|
|
1563
|
+
{
|
|
1564
|
+
ref: inputRef,
|
|
1565
|
+
className: "pds-command-palette__input",
|
|
1566
|
+
type: "text",
|
|
1567
|
+
placeholder,
|
|
1568
|
+
value: query,
|
|
1569
|
+
onChange: (e) => setQuery(e.target.value),
|
|
1570
|
+
onKeyDown,
|
|
1571
|
+
role: "combobox",
|
|
1572
|
+
"aria-autocomplete": "list",
|
|
1573
|
+
"aria-expanded": "true"
|
|
1574
|
+
}
|
|
1575
|
+
),
|
|
1576
|
+
query && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1577
|
+
"button",
|
|
1578
|
+
{
|
|
1579
|
+
type: "button",
|
|
1580
|
+
className: "pds-command-palette__clear",
|
|
1581
|
+
onClick: () => setQuery(""),
|
|
1582
|
+
"aria-label": "Clear",
|
|
1583
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(XSmallIcon, {})
|
|
1584
|
+
}
|
|
1585
|
+
)
|
|
1586
|
+
] }),
|
|
1587
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pds-command-palette__list", role: "listbox", children: allItems.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pds-command-palette__empty", children: [
|
|
1588
|
+
/* @__PURE__ */ jsxRuntime.jsx(SearchIcon2, { size: 20 }),
|
|
1589
|
+
'No results for "',
|
|
1590
|
+
query,
|
|
1591
|
+
'"'
|
|
1592
|
+
] }) : filteredGroups.map((group, gi) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1593
|
+
"div",
|
|
1594
|
+
{
|
|
1595
|
+
className: "pds-command-palette__group",
|
|
1596
|
+
role: "group",
|
|
1597
|
+
"aria-label": group.label,
|
|
1598
|
+
children: [
|
|
1599
|
+
group.label && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pds-command-palette__group-label", children: group.label }),
|
|
1600
|
+
group.items.map((item) => {
|
|
1601
|
+
const thisIndex = flatIndex++;
|
|
1602
|
+
const isActive = thisIndex === activeIndex;
|
|
1603
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1604
|
+
"button",
|
|
1605
|
+
{
|
|
1606
|
+
type: "button",
|
|
1607
|
+
role: "option",
|
|
1608
|
+
"aria-selected": isActive,
|
|
1609
|
+
className: cn(
|
|
1610
|
+
"pds-command-palette__item",
|
|
1611
|
+
isActive && "pds-command-palette__item--active"
|
|
1612
|
+
),
|
|
1613
|
+
onMouseEnter: () => setActiveIndex(thisIndex),
|
|
1614
|
+
onClick: () => selectItem(item),
|
|
1615
|
+
children: [
|
|
1616
|
+
item.icon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1617
|
+
"span",
|
|
1618
|
+
{
|
|
1619
|
+
className: "pds-command-palette__item-icon",
|
|
1620
|
+
"aria-hidden": "true",
|
|
1621
|
+
children: item.icon
|
|
1622
|
+
}
|
|
1623
|
+
),
|
|
1624
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pds-command-palette__item-body", children: [
|
|
1625
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pds-command-palette__item-label", children: item.label }),
|
|
1626
|
+
item.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pds-command-palette__item-desc", children: item.description })
|
|
1627
|
+
] }),
|
|
1628
|
+
item.shortcut && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1629
|
+
"span",
|
|
1630
|
+
{
|
|
1631
|
+
className: "pds-command-palette__shortcut",
|
|
1632
|
+
"aria-label": `Shortcut: ${item.shortcut}`,
|
|
1633
|
+
children: item.shortcut.split("+").map((key, ki) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1634
|
+
"kbd",
|
|
1635
|
+
{
|
|
1636
|
+
className: "pds-command-palette__kbd",
|
|
1637
|
+
children: key
|
|
1638
|
+
},
|
|
1639
|
+
ki
|
|
1640
|
+
))
|
|
1641
|
+
}
|
|
1642
|
+
)
|
|
1643
|
+
]
|
|
1644
|
+
},
|
|
1645
|
+
item.id
|
|
1646
|
+
);
|
|
1647
|
+
})
|
|
1648
|
+
]
|
|
1649
|
+
},
|
|
1650
|
+
group.label ?? gi
|
|
1651
|
+
)) }),
|
|
1652
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pds-command-palette__footer", "aria-hidden": "true", children: [
|
|
1653
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pds-command-palette__hint", children: [
|
|
1654
|
+
/* @__PURE__ */ jsxRuntime.jsx("kbd", { className: "pds-command-palette__kbd", children: "\u2191" }),
|
|
1655
|
+
/* @__PURE__ */ jsxRuntime.jsx("kbd", { className: "pds-command-palette__kbd", children: "\u2193" }),
|
|
1656
|
+
" navigate"
|
|
1657
|
+
] }),
|
|
1658
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pds-command-palette__hint", children: [
|
|
1659
|
+
/* @__PURE__ */ jsxRuntime.jsx("kbd", { className: "pds-command-palette__kbd", children: "\u21B5" }),
|
|
1660
|
+
" select"
|
|
1661
|
+
] }),
|
|
1662
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pds-command-palette__hint", children: [
|
|
1663
|
+
/* @__PURE__ */ jsxRuntime.jsx("kbd", { className: "pds-command-palette__kbd", children: "Esc" }),
|
|
1664
|
+
" close"
|
|
1665
|
+
] })
|
|
1666
|
+
] })
|
|
1667
|
+
]
|
|
1668
|
+
}
|
|
1669
|
+
)
|
|
1670
|
+
] }) });
|
|
1671
|
+
}
|
|
1672
|
+
function ChatSendIcon() {
|
|
1673
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1674
|
+
"svg",
|
|
1675
|
+
{
|
|
1676
|
+
width: 16,
|
|
1677
|
+
height: 16,
|
|
1678
|
+
viewBox: "0 0 16 16",
|
|
1679
|
+
fill: "none",
|
|
1680
|
+
"aria-hidden": "true",
|
|
1681
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1682
|
+
"path",
|
|
1683
|
+
{
|
|
1684
|
+
d: "M2.5 8h11M9 3.5L13.5 8 9 12.5",
|
|
1685
|
+
stroke: "currentColor",
|
|
1686
|
+
strokeWidth: "1.7",
|
|
1687
|
+
strokeLinecap: "round",
|
|
1688
|
+
strokeLinejoin: "round"
|
|
1689
|
+
}
|
|
1690
|
+
)
|
|
1691
|
+
}
|
|
1692
|
+
);
|
|
1693
|
+
}
|
|
1694
|
+
function ChatPaperclipIcon() {
|
|
1695
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1696
|
+
"svg",
|
|
1697
|
+
{
|
|
1698
|
+
width: 16,
|
|
1699
|
+
height: 16,
|
|
1700
|
+
viewBox: "0 0 16 16",
|
|
1701
|
+
fill: "none",
|
|
1702
|
+
"aria-hidden": "true",
|
|
1703
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1704
|
+
"path",
|
|
1705
|
+
{
|
|
1706
|
+
d: "M13.2 7.2L7.5 12.9a3.5 3.5 0 0 1-4.95-4.95l6.36-6.36a2.2 2.2 0 0 1 3.11 3.11L5.66 10.9a.88.88 0 0 1-1.24-1.24l5.3-5.3",
|
|
1707
|
+
stroke: "currentColor",
|
|
1708
|
+
strokeWidth: "1.4",
|
|
1709
|
+
strokeLinecap: "round",
|
|
1710
|
+
strokeLinejoin: "round"
|
|
1711
|
+
}
|
|
1712
|
+
)
|
|
1713
|
+
}
|
|
1714
|
+
);
|
|
1715
|
+
}
|
|
1716
|
+
function ChatSmileIcon() {
|
|
1717
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1718
|
+
"svg",
|
|
1719
|
+
{
|
|
1720
|
+
width: 16,
|
|
1721
|
+
height: 16,
|
|
1722
|
+
viewBox: "0 0 16 16",
|
|
1723
|
+
fill: "none",
|
|
1724
|
+
"aria-hidden": "true",
|
|
1725
|
+
children: [
|
|
1726
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "8", cy: "8", r: "6.2", stroke: "currentColor", strokeWidth: "1.4" }),
|
|
1727
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1728
|
+
"path",
|
|
1729
|
+
{
|
|
1730
|
+
d: "M5.5 9.8c.4.9 2.6 1.4 3 0",
|
|
1731
|
+
stroke: "currentColor",
|
|
1732
|
+
strokeWidth: "1.4",
|
|
1733
|
+
strokeLinecap: "round"
|
|
1734
|
+
}
|
|
1735
|
+
),
|
|
1736
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "6", cy: "6.8", r: "0.8", fill: "currentColor" }),
|
|
1737
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "10", cy: "6.8", r: "0.8", fill: "currentColor" })
|
|
1738
|
+
]
|
|
1739
|
+
}
|
|
1740
|
+
);
|
|
1741
|
+
}
|
|
1742
|
+
function ChatDeliveryIcon({ status }) {
|
|
1743
|
+
if (status === "sending") {
|
|
1744
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1745
|
+
"svg",
|
|
1746
|
+
{
|
|
1747
|
+
width: 14,
|
|
1748
|
+
height: 14,
|
|
1749
|
+
viewBox: "0 0 14 14",
|
|
1750
|
+
fill: "none",
|
|
1751
|
+
"aria-hidden": "true",
|
|
1752
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1753
|
+
"circle",
|
|
1754
|
+
{
|
|
1755
|
+
cx: "7",
|
|
1756
|
+
cy: "7",
|
|
1757
|
+
r: "5.2",
|
|
1758
|
+
stroke: "currentColor",
|
|
1759
|
+
strokeWidth: "1.4",
|
|
1760
|
+
strokeDasharray: "2.5 2"
|
|
1761
|
+
}
|
|
1762
|
+
)
|
|
1763
|
+
}
|
|
1764
|
+
);
|
|
1765
|
+
}
|
|
1766
|
+
if (status === "sent") {
|
|
1767
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1768
|
+
"svg",
|
|
1769
|
+
{
|
|
1770
|
+
width: 14,
|
|
1771
|
+
height: 14,
|
|
1772
|
+
viewBox: "0 0 14 14",
|
|
1773
|
+
fill: "none",
|
|
1774
|
+
"aria-hidden": "true",
|
|
1775
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1776
|
+
"path",
|
|
1777
|
+
{
|
|
1778
|
+
d: "M3 7.2l2.4 2.4L11 4.6",
|
|
1779
|
+
stroke: "currentColor",
|
|
1780
|
+
strokeWidth: "1.6",
|
|
1781
|
+
strokeLinecap: "round",
|
|
1782
|
+
strokeLinejoin: "round"
|
|
1783
|
+
}
|
|
1784
|
+
)
|
|
1785
|
+
}
|
|
1786
|
+
);
|
|
1787
|
+
}
|
|
1788
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1789
|
+
"svg",
|
|
1790
|
+
{
|
|
1791
|
+
width: 18,
|
|
1792
|
+
height: 14,
|
|
1793
|
+
viewBox: "0 0 18 14",
|
|
1794
|
+
fill: "none",
|
|
1795
|
+
"aria-label": status === "read" ? "Read" : "Delivered",
|
|
1796
|
+
children: [
|
|
1797
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1798
|
+
"path",
|
|
1799
|
+
{
|
|
1800
|
+
d: "M1.5 7.2l2.4 2.4L9.5 4.6",
|
|
1801
|
+
stroke: "currentColor",
|
|
1802
|
+
strokeWidth: "1.5",
|
|
1803
|
+
strokeLinecap: "round",
|
|
1804
|
+
strokeLinejoin: "round"
|
|
1805
|
+
}
|
|
1806
|
+
),
|
|
1807
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1808
|
+
"path",
|
|
1809
|
+
{
|
|
1810
|
+
d: "M5.5 7.2l2.4 2.4 5.6-5",
|
|
1811
|
+
stroke: "currentColor",
|
|
1812
|
+
strokeWidth: "1.5",
|
|
1813
|
+
strokeLinecap: "round",
|
|
1814
|
+
strokeLinejoin: "round"
|
|
1815
|
+
}
|
|
1816
|
+
)
|
|
1817
|
+
]
|
|
1818
|
+
}
|
|
1819
|
+
);
|
|
1820
|
+
}
|
|
1821
|
+
var ChatThread = react.forwardRef(
|
|
1822
|
+
({ className, ...props }, ref) => {
|
|
1823
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("pds-chat-thread", className), ...props });
|
|
1824
|
+
}
|
|
1825
|
+
);
|
|
1826
|
+
ChatThread.displayName = "ChatThread";
|
|
1827
|
+
var ChatDateDivider = react.forwardRef(
|
|
1828
|
+
({ className, children, ...props }, ref) => {
|
|
1829
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1830
|
+
"div",
|
|
1831
|
+
{
|
|
1832
|
+
ref,
|
|
1833
|
+
role: "separator",
|
|
1834
|
+
className: cn("pds-chat-divider", className),
|
|
1835
|
+
...props,
|
|
1836
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pds-chat-divider__label", children })
|
|
1837
|
+
}
|
|
1838
|
+
);
|
|
1839
|
+
}
|
|
1840
|
+
);
|
|
1841
|
+
ChatDateDivider.displayName = "ChatDateDivider";
|
|
1842
|
+
var ChatMessage = react.forwardRef(
|
|
1843
|
+
({
|
|
1844
|
+
side = "received",
|
|
1845
|
+
name,
|
|
1846
|
+
avatar,
|
|
1847
|
+
time,
|
|
1848
|
+
status,
|
|
1849
|
+
reactions,
|
|
1850
|
+
position = "solo",
|
|
1851
|
+
className,
|
|
1852
|
+
children,
|
|
1853
|
+
...props
|
|
1854
|
+
}, ref) => {
|
|
1855
|
+
const isSent = side === "sent";
|
|
1856
|
+
const showMeta = position === "solo" || position === "first";
|
|
1857
|
+
const showAvatar = !isSent && avatar && (position === "solo" || position === "last");
|
|
1858
|
+
const showStatus = isSent && status && (position === "solo" || position === "last");
|
|
1859
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1860
|
+
"div",
|
|
1861
|
+
{
|
|
1862
|
+
ref,
|
|
1863
|
+
className: cn(
|
|
1864
|
+
"pds-chat-msg",
|
|
1865
|
+
`pds-chat-msg--${side}`,
|
|
1866
|
+
`pds-chat-msg--${position}`,
|
|
1867
|
+
className
|
|
1868
|
+
),
|
|
1869
|
+
...props,
|
|
1870
|
+
children: [
|
|
1871
|
+
showMeta && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pds-chat-msg__meta-row", children: [
|
|
1872
|
+
!isSent && name && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pds-chat-msg__name", children: name }),
|
|
1873
|
+
time && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pds-chat-msg__time", children: time })
|
|
1874
|
+
] }),
|
|
1875
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pds-chat-msg__row", children: [
|
|
1876
|
+
!isSent && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pds-chat-msg__avatar-slot", children: showAvatar && avatar }),
|
|
1877
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pds-chat-msg__bubble-col", children: [
|
|
1878
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1879
|
+
"div",
|
|
1880
|
+
{
|
|
1881
|
+
className: cn(
|
|
1882
|
+
"pds-chat-bubble",
|
|
1883
|
+
`pds-chat-bubble--${side}`,
|
|
1884
|
+
`pds-chat-bubble--${position}`
|
|
1885
|
+
),
|
|
1886
|
+
children
|
|
1887
|
+
}
|
|
1888
|
+
),
|
|
1889
|
+
reactions && reactions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pds-chat-reactions", children: reactions.map((reaction, index) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1890
|
+
"button",
|
|
1891
|
+
{
|
|
1892
|
+
type: "button",
|
|
1893
|
+
className: cn(
|
|
1894
|
+
"pds-chat-reaction",
|
|
1895
|
+
reaction.mine && "pds-chat-reaction--mine"
|
|
1896
|
+
),
|
|
1897
|
+
children: [
|
|
1898
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: reaction.emoji }),
|
|
1899
|
+
reaction.count !== void 0 && reaction.count > 1 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pds-chat-reaction__count", children: reaction.count })
|
|
1900
|
+
]
|
|
1901
|
+
},
|
|
1902
|
+
index
|
|
1903
|
+
)) })
|
|
1904
|
+
] })
|
|
1905
|
+
] }),
|
|
1906
|
+
showStatus && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1907
|
+
"div",
|
|
1908
|
+
{
|
|
1909
|
+
className: cn(
|
|
1910
|
+
"pds-chat-msg__status",
|
|
1911
|
+
status === "read" && "pds-chat-msg__status--read"
|
|
1912
|
+
),
|
|
1913
|
+
children: [
|
|
1914
|
+
/* @__PURE__ */ jsxRuntime.jsx(ChatDeliveryIcon, { status }),
|
|
1915
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pds-chat-msg__status-label", children: status })
|
|
1916
|
+
]
|
|
1917
|
+
}
|
|
1918
|
+
)
|
|
1919
|
+
]
|
|
1920
|
+
}
|
|
1921
|
+
);
|
|
1922
|
+
}
|
|
1923
|
+
);
|
|
1924
|
+
ChatMessage.displayName = "ChatMessage";
|
|
1925
|
+
function ChatCompose({
|
|
1926
|
+
value,
|
|
1927
|
+
onChange,
|
|
1928
|
+
onSend,
|
|
1929
|
+
placeholder = "Write a message\u2026",
|
|
1930
|
+
avatar,
|
|
1931
|
+
disabled,
|
|
1932
|
+
className
|
|
1933
|
+
}) {
|
|
1934
|
+
const [internalValue, setInternalValue] = react.useState("");
|
|
1935
|
+
const textareaRef = react.useRef(null);
|
|
1936
|
+
const isControlled = value !== void 0;
|
|
1937
|
+
const text = isControlled ? value : internalValue;
|
|
1938
|
+
react.useEffect(() => {
|
|
1939
|
+
const textarea = textareaRef.current;
|
|
1940
|
+
if (!textarea) return;
|
|
1941
|
+
textarea.style.height = "auto";
|
|
1942
|
+
textarea.style.height = `${Math.min(textarea.scrollHeight, 120)}px`;
|
|
1943
|
+
}, [text]);
|
|
1944
|
+
function handleChange(event) {
|
|
1945
|
+
if (!isControlled) setInternalValue(event.target.value);
|
|
1946
|
+
onChange?.(event);
|
|
1947
|
+
}
|
|
1948
|
+
function send() {
|
|
1949
|
+
const trimmed = text.trim();
|
|
1950
|
+
if (!trimmed) return;
|
|
1951
|
+
onSend?.(trimmed);
|
|
1952
|
+
if (!isControlled) setInternalValue("");
|
|
1953
|
+
}
|
|
1954
|
+
function handleKeyDown(event) {
|
|
1955
|
+
if (event.key === "Enter" && !event.shiftKey) {
|
|
1956
|
+
event.preventDefault();
|
|
1957
|
+
send();
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
const canSend = text.trim().length > 0;
|
|
1961
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("pds-chat-compose", className), children: [
|
|
1962
|
+
avatar && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pds-chat-compose__avatar", children: avatar }),
|
|
1963
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pds-chat-compose__field", children: [
|
|
1964
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1965
|
+
"button",
|
|
1966
|
+
{
|
|
1967
|
+
type: "button",
|
|
1968
|
+
className: "pds-chat-compose__icon-btn",
|
|
1969
|
+
"aria-label": "Attach file",
|
|
1970
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ChatPaperclipIcon, {})
|
|
1971
|
+
}
|
|
1972
|
+
),
|
|
1973
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1974
|
+
"textarea",
|
|
1975
|
+
{
|
|
1976
|
+
ref: textareaRef,
|
|
1977
|
+
className: "pds-chat-compose__textarea",
|
|
1978
|
+
value: text,
|
|
1979
|
+
onChange: handleChange,
|
|
1980
|
+
onKeyDown: handleKeyDown,
|
|
1981
|
+
placeholder,
|
|
1982
|
+
disabled,
|
|
1983
|
+
rows: 1,
|
|
1984
|
+
"aria-label": "Message"
|
|
1985
|
+
}
|
|
1986
|
+
),
|
|
1987
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1988
|
+
"button",
|
|
1989
|
+
{
|
|
1990
|
+
type: "button",
|
|
1991
|
+
className: "pds-chat-compose__icon-btn",
|
|
1992
|
+
"aria-label": "Add emoji",
|
|
1993
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ChatSmileIcon, {})
|
|
1994
|
+
}
|
|
1995
|
+
)
|
|
1996
|
+
] }),
|
|
1997
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1998
|
+
"button",
|
|
1999
|
+
{
|
|
2000
|
+
type: "button",
|
|
2001
|
+
className: cn("pds-chat-send", canSend && "pds-chat-send--active"),
|
|
2002
|
+
onClick: send,
|
|
2003
|
+
disabled: disabled || !canSend,
|
|
2004
|
+
"aria-label": "Send message",
|
|
2005
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ChatSendIcon, {})
|
|
2006
|
+
}
|
|
2007
|
+
)
|
|
2008
|
+
] });
|
|
2009
|
+
}
|
|
947
2010
|
|
|
948
2011
|
exports.Alert = Alert;
|
|
949
2012
|
exports.Avatar = Avatar;
|
|
950
2013
|
exports.Badge = Badge;
|
|
951
2014
|
exports.Button = Button;
|
|
952
2015
|
exports.Card = Card;
|
|
2016
|
+
exports.ChatCompose = ChatCompose;
|
|
2017
|
+
exports.ChatDateDivider = ChatDateDivider;
|
|
2018
|
+
exports.ChatMessage = ChatMessage;
|
|
2019
|
+
exports.ChatThread = ChatThread;
|
|
953
2020
|
exports.Checkbox = Checkbox;
|
|
2021
|
+
exports.CommandPalette = CommandPalette;
|
|
954
2022
|
exports.Container = Container;
|
|
2023
|
+
exports.DataTable = DataTable;
|
|
955
2024
|
exports.Divider = Divider;
|
|
956
2025
|
exports.DropdownMenu = DropdownMenu;
|
|
957
2026
|
exports.Grid = Grid;
|
|
958
2027
|
exports.Input = Input;
|
|
959
2028
|
exports.Modal = Modal;
|
|
2029
|
+
exports.Popover = Popover;
|
|
960
2030
|
exports.Radio = Radio;
|
|
961
2031
|
exports.RadioGroup = RadioGroup;
|
|
962
2032
|
exports.Segmented = Segmented;
|
|
@@ -969,6 +2039,7 @@ exports.Textarea = Textarea;
|
|
|
969
2039
|
exports.Toast = Toast;
|
|
970
2040
|
exports.Tooltip = Tooltip;
|
|
971
2041
|
exports.cn = cn;
|
|
2042
|
+
exports.useCommandPalette = useCommandPalette;
|
|
972
2043
|
exports.useToast = useToastManager;
|
|
973
2044
|
//# sourceMappingURL=index.cjs.map
|
|
974
2045
|
//# sourceMappingURL=index.cjs.map
|