@ai-matrx/design-system 0.15.1 → 0.15.2
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/CHANGELOG.md +16 -0
- package/README.md +6 -0
- package/dist/data-table/index.cjs +1009 -676
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.js +1010 -677
- package/dist/data-table/index.js.map +1 -1
- package/dist/data-table/infer-filter.cjs +0 -3
- package/dist/data-table/infer-filter.cjs.map +1 -1
- package/dist/data-table/infer-filter.js +0 -3
- package/dist/data-table/infer-filter.js.map +1 -1
- package/dist/data-table/query-control.cjs +0 -3
- package/dist/data-table/query-control.cjs.map +1 -1
- package/dist/data-table/query-control.js +0 -3
- package/dist/data-table/query-control.js.map +1 -1
- package/package.json +1 -1
|
@@ -616,6 +616,9 @@ function lucideProps(props) {
|
|
|
616
616
|
...props
|
|
617
617
|
};
|
|
618
618
|
}
|
|
619
|
+
function Loader2Icon(props) {
|
|
620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { ...lucideProps(props), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }) });
|
|
621
|
+
}
|
|
619
622
|
function XIcon(props) {
|
|
620
623
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { ...lucideProps(props), children: [
|
|
621
624
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M18 6 6 18" }),
|
|
@@ -739,9 +742,268 @@ var Checkbox = React2.forwardRef(({ className, size = "md", ...props }, ref) =>
|
|
|
739
742
|
));
|
|
740
743
|
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
741
744
|
|
|
742
|
-
// src/
|
|
745
|
+
// src/alert-dialog.tsx
|
|
746
|
+
var AlertDialogPrimitive = __toESM(require("@radix-ui/react-alert-dialog"), 1);
|
|
747
|
+
var import_react_tree = require("@ai-matrx/kit/react-tree");
|
|
748
|
+
var React4 = __toESM(require("react"), 1);
|
|
749
|
+
|
|
750
|
+
// src/motion.ts
|
|
751
|
+
var MOTION_OVERLAY = "matrx-motion-overlay";
|
|
752
|
+
var MOTION_DIALOG = "matrx-motion-dialog";
|
|
753
|
+
var CENTERED_DIALOG = "matrx-dialog-centered";
|
|
754
|
+
var POPPER_OFFSET = "matrx-popper-offset";
|
|
755
|
+
var MOTION_BOTTOM_SHEET = "matrx-motion-bottom-sheet";
|
|
756
|
+
var MOTION_POPPER = "matrx-motion-popper";
|
|
757
|
+
var MOTION_SHEET = {
|
|
758
|
+
top: "matrx-motion-sheet-top",
|
|
759
|
+
bottom: "matrx-motion-sheet-bottom",
|
|
760
|
+
left: "matrx-motion-sheet-left",
|
|
761
|
+
right: "matrx-motion-sheet-right",
|
|
762
|
+
center: "matrx-motion-sheet-center"
|
|
763
|
+
};
|
|
764
|
+
var MOTION_PULSE = "matrx-pulse";
|
|
765
|
+
var MOTION_SPIN = "matrx-spin";
|
|
766
|
+
var ALL_MOTION_CLASSES = [
|
|
767
|
+
MOTION_OVERLAY,
|
|
768
|
+
MOTION_DIALOG,
|
|
769
|
+
MOTION_BOTTOM_SHEET,
|
|
770
|
+
MOTION_POPPER,
|
|
771
|
+
...Object.values(MOTION_SHEET),
|
|
772
|
+
MOTION_PULSE,
|
|
773
|
+
MOTION_SPIN
|
|
774
|
+
];
|
|
775
|
+
|
|
776
|
+
// src/portal-container.tsx
|
|
743
777
|
var React3 = __toESM(require("react"), 1);
|
|
744
778
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
779
|
+
var CONTEXT_SLOT = /* @__PURE__ */ Symbol.for("ai-matrx.design-system.portal-container-context");
|
|
780
|
+
var contextRegistry = globalThis;
|
|
781
|
+
var PortalContainerContext = contextRegistry[CONTEXT_SLOT] ??= React3.createContext(void 0);
|
|
782
|
+
function PortalContainerProvider({
|
|
783
|
+
container,
|
|
784
|
+
children
|
|
785
|
+
}) {
|
|
786
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PortalContainerContext.Provider, { value: container ?? void 0, children });
|
|
787
|
+
}
|
|
788
|
+
function usePortalContainer(explicit) {
|
|
789
|
+
const injected = React3.useContext(PortalContainerContext);
|
|
790
|
+
if (explicit !== void 0) {
|
|
791
|
+
return explicit ?? void 0;
|
|
792
|
+
}
|
|
793
|
+
return injected ?? void 0;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
// src/alert-dialog.tsx
|
|
797
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
798
|
+
var AlertDialog = AlertDialogPrimitive.Root;
|
|
799
|
+
var AlertDialogPortal = ({
|
|
800
|
+
container,
|
|
801
|
+
...props
|
|
802
|
+
}) => {
|
|
803
|
+
const resolved = usePortalContainer(container);
|
|
804
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AlertDialogPrimitive.Portal, { container: resolved ?? null, ...props });
|
|
805
|
+
};
|
|
806
|
+
AlertDialogPortal.displayName = "AlertDialogPortal";
|
|
807
|
+
var AlertDialogOverlay = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
808
|
+
AlertDialogPrimitive.Overlay,
|
|
809
|
+
{
|
|
810
|
+
ref,
|
|
811
|
+
"data-slot": "alert-dialog-overlay",
|
|
812
|
+
className: cn(
|
|
813
|
+
"fixed inset-0 z-[10000] bg-[var(--matrx-overlay-scrim)]",
|
|
814
|
+
MOTION_OVERLAY,
|
|
815
|
+
className
|
|
816
|
+
),
|
|
817
|
+
...props
|
|
818
|
+
}
|
|
819
|
+
));
|
|
820
|
+
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
|
|
821
|
+
var AlertDialogContentPrimitive = React4.forwardRef((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AlertDialogPrimitive.Content, { ...props, ref, "aria-modal": "true" }));
|
|
822
|
+
AlertDialogContentPrimitive.displayName = "AlertDialogContentPrimitive";
|
|
823
|
+
var AlertDialogDescription = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
824
|
+
AlertDialogPrimitive.Description,
|
|
825
|
+
{
|
|
826
|
+
ref,
|
|
827
|
+
"data-slot": "alert-dialog-description",
|
|
828
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
829
|
+
...props
|
|
830
|
+
}
|
|
831
|
+
));
|
|
832
|
+
AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;
|
|
833
|
+
var AlertDialogContent = React4.forwardRef(({ className, children, container, animated = true, ...props }, ref) => {
|
|
834
|
+
const hasDescription = (0, import_react_tree.treeContainsComponent)(children, AlertDialogDescription) || (0, import_react_tree.treeContainsComponent)(children, AlertDialogPrimitive.Description);
|
|
835
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(AlertDialogPortal, { container, children: [
|
|
836
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AlertDialogOverlay, {}),
|
|
837
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
838
|
+
AlertDialogContentPrimitive,
|
|
839
|
+
{
|
|
840
|
+
ref,
|
|
841
|
+
"data-slot": "alert-dialog-content",
|
|
842
|
+
className: cn(
|
|
843
|
+
`matrx-dialog-card fixed left-[50%] top-[50%] z-[10000] grid min-w-0 w-full max-w-lg ${CENTERED_DIALOG} gap-4 border bg-background p-6 shadow-lg`,
|
|
844
|
+
// Ruling 3 — never taller than the viewport, always scrollable, and
|
|
845
|
+
// the footer stays reachable via --dialog-pad like Dialog's.
|
|
846
|
+
// Ruling 5 (0.11.3) — `matrx-dialog-card` hands the bottom padding to
|
|
847
|
+
// a sticky footer when there is one, so the footer's box matches the
|
|
848
|
+
// space the grid gave it and sticky never clamps it up over the
|
|
849
|
+
// consequence copy.
|
|
850
|
+
"max-h-[85dvh] overflow-y-auto overscroll-contain [--dialog-pad:1.5rem] overflow-x-clip [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full",
|
|
851
|
+
"sm:rounded-lg",
|
|
852
|
+
animated && MOTION_DIALOG,
|
|
853
|
+
className
|
|
854
|
+
),
|
|
855
|
+
...props,
|
|
856
|
+
children: [
|
|
857
|
+
hasDescription ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AlertDialogPrimitive.Description, { className: "sr-only", children: "Please confirm the action described in this dialog." }),
|
|
858
|
+
children
|
|
859
|
+
]
|
|
860
|
+
}
|
|
861
|
+
)
|
|
862
|
+
] });
|
|
863
|
+
});
|
|
864
|
+
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
|
|
865
|
+
var AlertDialogHeader = ({
|
|
866
|
+
className,
|
|
867
|
+
...props
|
|
868
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
869
|
+
"div",
|
|
870
|
+
{
|
|
871
|
+
"data-slot": "alert-dialog-header",
|
|
872
|
+
className: cn("flex flex-col space-y-2 text-center sm:text-left", className),
|
|
873
|
+
...props
|
|
874
|
+
}
|
|
875
|
+
);
|
|
876
|
+
AlertDialogHeader.displayName = "AlertDialogHeader";
|
|
877
|
+
var AlertDialogFooter = ({
|
|
878
|
+
className,
|
|
879
|
+
...props
|
|
880
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
881
|
+
"div",
|
|
882
|
+
{
|
|
883
|
+
"data-slot": "alert-dialog-footer",
|
|
884
|
+
className: cn(
|
|
885
|
+
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
886
|
+
// Ruling 3/4 — sticky to the card edges so a scrolled body never shows
|
|
887
|
+
// through under the actions, and safe-area padded on a phone.
|
|
888
|
+
//
|
|
889
|
+
// 🚨 THERE IS NO `mb-[…]` HERE, AND THERE MUST NEVER BE ONE AGAIN
|
|
890
|
+
// (0.11.3, feedback bf8fb00b). The bleed over the card's bottom padding
|
|
891
|
+
// used to be a NEGATIVE BLOCK MARGIN, which makes this box taller than
|
|
892
|
+
// the grid area the card allocates it — and `position: sticky` CLAMPS a
|
|
893
|
+
// box to its containing block, so the browser yanked the footer UP by
|
|
894
|
+
// `--dialog-pad` against the card's `gap-4` and painted 8px of opaque
|
|
895
|
+
// footer over the last line of the consequence, at every length. The
|
|
896
|
+
// card now RESERVES this footer's block size instead (`matrx-dialog-card`
|
|
897
|
+
// in styles.css hands over its `padding-bottom`), so the bleed costs no
|
|
898
|
+
// margin at all. Guard: `sticky-footer-geometry.test.tsx`.
|
|
899
|
+
//
|
|
900
|
+
// These stay UTILITIES rather than a shipped rule so a caller's
|
|
901
|
+
// `className` still wins through tailwind-merge — a shipped rule would
|
|
902
|
+
// have to be unlayered to survive Tailwind preflight (§ THE PREFLIGHT
|
|
903
|
+
// RULE in styles.css) and would then override every caller's padding.
|
|
904
|
+
"sticky bottom-0 z-10 bg-background pt-3",
|
|
905
|
+
"mx-[calc(var(--dialog-pad,0px)*-1)] px-[var(--dialog-pad,0px)] pb-[var(--dialog-pad,0px)]",
|
|
906
|
+
className
|
|
907
|
+
),
|
|
908
|
+
...props
|
|
909
|
+
}
|
|
910
|
+
);
|
|
911
|
+
AlertDialogFooter.displayName = "AlertDialogFooter";
|
|
912
|
+
var AlertDialogTitle = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
913
|
+
AlertDialogPrimitive.Title,
|
|
914
|
+
{
|
|
915
|
+
ref,
|
|
916
|
+
"data-slot": "alert-dialog-title",
|
|
917
|
+
className: cn("text-lg font-semibold", className),
|
|
918
|
+
...props
|
|
919
|
+
}
|
|
920
|
+
));
|
|
921
|
+
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
|
|
922
|
+
var AlertDialogAction = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
923
|
+
AlertDialogPrimitive.Action,
|
|
924
|
+
{
|
|
925
|
+
ref,
|
|
926
|
+
"data-slot": "alert-dialog-action",
|
|
927
|
+
className: cn(buttonVariants(), className),
|
|
928
|
+
...props
|
|
929
|
+
}
|
|
930
|
+
));
|
|
931
|
+
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
|
|
932
|
+
var AlertDialogCancel = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
933
|
+
AlertDialogPrimitive.Cancel,
|
|
934
|
+
{
|
|
935
|
+
ref,
|
|
936
|
+
"data-slot": "alert-dialog-cancel",
|
|
937
|
+
className: cn(
|
|
938
|
+
buttonVariants({ variant: "outline" }),
|
|
939
|
+
"mt-2 sm:mt-0",
|
|
940
|
+
className
|
|
941
|
+
),
|
|
942
|
+
...props
|
|
943
|
+
}
|
|
944
|
+
));
|
|
945
|
+
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
|
|
946
|
+
|
|
947
|
+
// src/confirm-dialog.tsx
|
|
948
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
949
|
+
function ConfirmDialog({
|
|
950
|
+
open,
|
|
951
|
+
onOpenChange,
|
|
952
|
+
title,
|
|
953
|
+
description,
|
|
954
|
+
content,
|
|
955
|
+
contentClassName,
|
|
956
|
+
confirmLabel = "Confirm",
|
|
957
|
+
cancelLabel = "Cancel",
|
|
958
|
+
variant = "default",
|
|
959
|
+
busy = false,
|
|
960
|
+
confirmDisabled = false,
|
|
961
|
+
portalContainer,
|
|
962
|
+
onConfirm
|
|
963
|
+
}) {
|
|
964
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AlertDialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
965
|
+
AlertDialogContent,
|
|
966
|
+
{
|
|
967
|
+
className: contentClassName,
|
|
968
|
+
...portalContainer === void 0 ? {} : { container: portalContainer },
|
|
969
|
+
children: [
|
|
970
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(AlertDialogHeader, { children: [
|
|
971
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AlertDialogTitle, { children: title }),
|
|
972
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AlertDialogDescription, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: description }) }) : null
|
|
973
|
+
] }),
|
|
974
|
+
content ?? null,
|
|
975
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(AlertDialogFooter, { children: [
|
|
976
|
+
cancelLabel === null ? null : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AlertDialogCancel, { className: "max-lg:min-h-11", disabled: busy, children: cancelLabel }),
|
|
977
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
978
|
+
AlertDialogAction,
|
|
979
|
+
{
|
|
980
|
+
disabled: busy || confirmDisabled,
|
|
981
|
+
onClick: (event) => {
|
|
982
|
+
event.preventDefault();
|
|
983
|
+
void onConfirm();
|
|
984
|
+
},
|
|
985
|
+
className: cn(
|
|
986
|
+
"max-lg:min-h-11",
|
|
987
|
+
// One source of button appearance: the destructive look comes
|
|
988
|
+
// from `buttonVariants`, not a second hand-written copy of it.
|
|
989
|
+
// tailwind-merge makes it WIN over the default variant classes.
|
|
990
|
+
variant === "destructive" && buttonVariants({ variant: "destructive" })
|
|
991
|
+
),
|
|
992
|
+
children: [
|
|
993
|
+
busy ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Loader2Icon, { className: cn("mr-2 h-4 w-4", MOTION_SPIN) }) : null,
|
|
994
|
+
confirmLabel
|
|
995
|
+
]
|
|
996
|
+
}
|
|
997
|
+
)
|
|
998
|
+
] })
|
|
999
|
+
]
|
|
1000
|
+
}
|
|
1001
|
+
) });
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
// src/input.tsx
|
|
1005
|
+
var React5 = __toESM(require("react"), 1);
|
|
1006
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
745
1007
|
var getVariantStyles = (variant = "default") => {
|
|
746
1008
|
const baseStyles = `flex h-10 w-full border border-border bg-background text-foreground shadow-input rounded-md px-3 py-2 text-sm file:border-0 file:bg-transparent
|
|
747
1009
|
file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground
|
|
@@ -769,9 +1031,9 @@ var getVariantStyles = (variant = "default") => {
|
|
|
769
1031
|
return baseStyles;
|
|
770
1032
|
}
|
|
771
1033
|
};
|
|
772
|
-
var Input =
|
|
1034
|
+
var Input = React5.forwardRef(
|
|
773
1035
|
({ className, type, variant = "default", ...props }, ref) => {
|
|
774
|
-
return /* @__PURE__ */ (0,
|
|
1036
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
775
1037
|
"input",
|
|
776
1038
|
{
|
|
777
1039
|
type,
|
|
@@ -783,7 +1045,7 @@ var Input = React3.forwardRef(
|
|
|
783
1045
|
}
|
|
784
1046
|
);
|
|
785
1047
|
Input.displayName = "Input";
|
|
786
|
-
var EnterInput =
|
|
1048
|
+
var EnterInput = React5.forwardRef(
|
|
787
1049
|
({ onEnter, ...props }, ref) => {
|
|
788
1050
|
const handleKeyDown = (e) => {
|
|
789
1051
|
if (e.key === "Enter" && onEnter) {
|
|
@@ -791,7 +1053,7 @@ var EnterInput = React3.forwardRef(
|
|
|
791
1053
|
onEnter();
|
|
792
1054
|
}
|
|
793
1055
|
};
|
|
794
|
-
return /* @__PURE__ */ (0,
|
|
1056
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
795
1057
|
Input,
|
|
796
1058
|
{
|
|
797
1059
|
...props,
|
|
@@ -807,11 +1069,11 @@ var EnterInput = React3.forwardRef(
|
|
|
807
1069
|
}
|
|
808
1070
|
);
|
|
809
1071
|
EnterInput.displayName = "EnterInput";
|
|
810
|
-
var BasicInput =
|
|
1072
|
+
var BasicInput = React5.forwardRef(
|
|
811
1073
|
// `variant` is accepted (prop-compatible with Input) but intentionally
|
|
812
1074
|
// unused — and destructured so it never leaks onto the DOM element.
|
|
813
1075
|
({ className, type, variant: _variant = "default", ...props }, ref) => {
|
|
814
|
-
return /* @__PURE__ */ (0,
|
|
1076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
815
1077
|
"input",
|
|
816
1078
|
{
|
|
817
1079
|
type,
|
|
@@ -826,10 +1088,10 @@ var BasicInput = React3.forwardRef(
|
|
|
826
1088
|
}
|
|
827
1089
|
);
|
|
828
1090
|
BasicInput.displayName = "BasicInput";
|
|
829
|
-
var InputWithPrefix =
|
|
830
|
-
return /* @__PURE__ */ (0,
|
|
831
|
-
prefix && /* @__PURE__ */ (0,
|
|
832
|
-
/* @__PURE__ */ (0,
|
|
1091
|
+
var InputWithPrefix = React5.forwardRef(({ prefix, className, wrapperClassName, ...props }, ref) => {
|
|
1092
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: cn("relative", wrapperClassName), children: [
|
|
1093
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground", children: prefix }),
|
|
1094
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
833
1095
|
Input,
|
|
834
1096
|
{
|
|
835
1097
|
ref,
|
|
@@ -841,36 +1103,10 @@ var InputWithPrefix = React3.forwardRef(({ prefix, className, wrapperClassName,
|
|
|
841
1103
|
});
|
|
842
1104
|
InputWithPrefix.displayName = "InputWithPrefix";
|
|
843
1105
|
|
|
844
|
-
// src/motion.ts
|
|
845
|
-
var MOTION_OVERLAY = "matrx-motion-overlay";
|
|
846
|
-
var MOTION_DIALOG = "matrx-motion-dialog";
|
|
847
|
-
var CENTERED_DIALOG = "matrx-dialog-centered";
|
|
848
|
-
var POPPER_OFFSET = "matrx-popper-offset";
|
|
849
|
-
var MOTION_BOTTOM_SHEET = "matrx-motion-bottom-sheet";
|
|
850
|
-
var MOTION_POPPER = "matrx-motion-popper";
|
|
851
|
-
var MOTION_SHEET = {
|
|
852
|
-
top: "matrx-motion-sheet-top",
|
|
853
|
-
bottom: "matrx-motion-sheet-bottom",
|
|
854
|
-
left: "matrx-motion-sheet-left",
|
|
855
|
-
right: "matrx-motion-sheet-right",
|
|
856
|
-
center: "matrx-motion-sheet-center"
|
|
857
|
-
};
|
|
858
|
-
var MOTION_PULSE = "matrx-pulse";
|
|
859
|
-
var MOTION_SPIN = "matrx-spin";
|
|
860
|
-
var ALL_MOTION_CLASSES = [
|
|
861
|
-
MOTION_OVERLAY,
|
|
862
|
-
MOTION_DIALOG,
|
|
863
|
-
MOTION_BOTTOM_SHEET,
|
|
864
|
-
MOTION_POPPER,
|
|
865
|
-
...Object.values(MOTION_SHEET),
|
|
866
|
-
MOTION_PULSE,
|
|
867
|
-
MOTION_SPIN
|
|
868
|
-
];
|
|
869
|
-
|
|
870
1106
|
// src/skeleton.tsx
|
|
871
|
-
var
|
|
1107
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
872
1108
|
function Skeleton({ className, animated = true, ...props }) {
|
|
873
|
-
return /* @__PURE__ */ (0,
|
|
1109
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
874
1110
|
"div",
|
|
875
1111
|
{
|
|
876
1112
|
"data-slot": "skeleton",
|
|
@@ -1083,52 +1319,32 @@ function useScrollPagination({
|
|
|
1083
1319
|
// src/dialog.tsx
|
|
1084
1320
|
var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
1085
1321
|
var VisuallyHidden = __toESM(require("@radix-ui/react-visually-hidden"), 1);
|
|
1086
|
-
var
|
|
1087
|
-
var
|
|
1088
|
-
|
|
1089
|
-
// src/portal-container.tsx
|
|
1090
|
-
var React4 = __toESM(require("react"), 1);
|
|
1091
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1092
|
-
var CONTEXT_SLOT = /* @__PURE__ */ Symbol.for("ai-matrx.design-system.portal-container-context");
|
|
1093
|
-
var contextRegistry = globalThis;
|
|
1094
|
-
var PortalContainerContext = contextRegistry[CONTEXT_SLOT] ??= React4.createContext(void 0);
|
|
1095
|
-
function PortalContainerProvider({
|
|
1096
|
-
container,
|
|
1097
|
-
children
|
|
1098
|
-
}) {
|
|
1099
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PortalContainerContext.Provider, { value: container ?? void 0, children });
|
|
1100
|
-
}
|
|
1101
|
-
function usePortalContainer(explicit) {
|
|
1102
|
-
const injected = React4.useContext(PortalContainerContext);
|
|
1103
|
-
if (explicit !== void 0) {
|
|
1104
|
-
return explicit ?? void 0;
|
|
1105
|
-
}
|
|
1106
|
-
return injected ?? void 0;
|
|
1107
|
-
}
|
|
1322
|
+
var import_react_tree2 = require("@ai-matrx/kit/react-tree");
|
|
1323
|
+
var React8 = __toESM(require("react"), 1);
|
|
1108
1324
|
|
|
1109
1325
|
// src/radix-dialog-modal-context.tsx
|
|
1110
|
-
var
|
|
1111
|
-
var
|
|
1326
|
+
var React6 = __toESM(require("react"), 1);
|
|
1327
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1112
1328
|
var CONTEXT_SLOT2 = /* @__PURE__ */ Symbol.for("ai-matrx.design-system.dialog-modal-context");
|
|
1113
1329
|
var contextRegistry2 = globalThis;
|
|
1114
|
-
var RadixDialogModalContext = contextRegistry2[CONTEXT_SLOT2] ??=
|
|
1330
|
+
var RadixDialogModalContext = contextRegistry2[CONTEXT_SLOT2] ??= React6.createContext(true);
|
|
1115
1331
|
function RadixDialogModalProvider({
|
|
1116
1332
|
children,
|
|
1117
1333
|
modal
|
|
1118
1334
|
}) {
|
|
1119
|
-
return /* @__PURE__ */ (0,
|
|
1335
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(RadixDialogModalContext.Provider, { value: modal, children });
|
|
1120
1336
|
}
|
|
1121
1337
|
function useRadixDialogModal() {
|
|
1122
|
-
return
|
|
1338
|
+
return React6.useContext(RadixDialogModalContext);
|
|
1123
1339
|
}
|
|
1124
1340
|
|
|
1125
1341
|
// src/use-is-mobile.ts
|
|
1126
|
-
var
|
|
1342
|
+
var React7 = __toESM(require("react"), 1);
|
|
1127
1343
|
var MOBILE_BREAKPOINT = 768;
|
|
1128
1344
|
function useIsMobile() {
|
|
1129
|
-
const [isMobile, setIsMobile] =
|
|
1130
|
-
const [hasMounted, setHasMounted] =
|
|
1131
|
-
|
|
1345
|
+
const [isMobile, setIsMobile] = React7.useState(false);
|
|
1346
|
+
const [hasMounted, setHasMounted] = React7.useState(false);
|
|
1347
|
+
React7.useEffect(() => {
|
|
1132
1348
|
setHasMounted(true);
|
|
1133
1349
|
const onChange = () => {
|
|
1134
1350
|
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
@@ -1148,13 +1364,13 @@ function useIsMobile() {
|
|
|
1148
1364
|
}
|
|
1149
1365
|
|
|
1150
1366
|
// src/dialog.tsx
|
|
1151
|
-
var
|
|
1367
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1152
1368
|
var Dialog = ({
|
|
1153
1369
|
children,
|
|
1154
1370
|
...props
|
|
1155
1371
|
}) => {
|
|
1156
1372
|
const modal = props.modal ?? true;
|
|
1157
|
-
return /* @__PURE__ */ (0,
|
|
1373
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(RadixDialogModalProvider, { modal, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DialogPrimitive.Root, { ...props, modal, children }) });
|
|
1158
1374
|
};
|
|
1159
1375
|
Dialog.displayName = "Dialog";
|
|
1160
1376
|
var DialogPortal = ({
|
|
@@ -1162,13 +1378,13 @@ var DialogPortal = ({
|
|
|
1162
1378
|
...props
|
|
1163
1379
|
}) => {
|
|
1164
1380
|
const resolved = usePortalContainer(container);
|
|
1165
|
-
return /* @__PURE__ */ (0,
|
|
1381
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DialogPrimitive.Portal, { container: resolved ?? null, ...props });
|
|
1166
1382
|
};
|
|
1167
1383
|
DialogPortal.displayName = "DialogPortal";
|
|
1168
1384
|
var CONTEXT_SLOT3 = /* @__PURE__ */ Symbol.for("ai-matrx.design-system.dialog-container-context");
|
|
1169
1385
|
var contextRegistry3 = globalThis;
|
|
1170
|
-
var DialogContainerContext = contextRegistry3[CONTEXT_SLOT3] ??=
|
|
1171
|
-
var DialogOverlay =
|
|
1386
|
+
var DialogContainerContext = contextRegistry3[CONTEXT_SLOT3] ??= React8.createContext(null);
|
|
1387
|
+
var DialogOverlay = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1172
1388
|
DialogPrimitive.Overlay,
|
|
1173
1389
|
{
|
|
1174
1390
|
ref,
|
|
@@ -1184,9 +1400,9 @@ var DialogOverlay = React7.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
1184
1400
|
}
|
|
1185
1401
|
));
|
|
1186
1402
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
1187
|
-
var DialogContentPrimitive =
|
|
1403
|
+
var DialogContentPrimitive = React8.forwardRef((props, ref) => {
|
|
1188
1404
|
const isModal = useRadixDialogModal();
|
|
1189
|
-
return /* @__PURE__ */ (0,
|
|
1405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1190
1406
|
DialogPrimitive.Content,
|
|
1191
1407
|
{
|
|
1192
1408
|
...props,
|
|
@@ -1199,7 +1415,7 @@ DialogContentPrimitive.displayName = "DialogContentPrimitive";
|
|
|
1199
1415
|
var DIALOG_DESKTOP_CLASSES = "matrx-dialog-card fixed inset-0 z-[10000] m-auto grid h-fit min-w-0 w-full max-w-lg gap-4 max-h-[85dvh] overflow-y-auto overscroll-contain [--dialog-pad:1.5rem] overflow-x-clip border bg-background p-6 shadow-lg [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full sm:rounded-lg";
|
|
1200
1416
|
var DIALOG_MOBILE_SHEET_CLASSES = "matrx-mobile-sheet matrx-dialog-card fixed inset-x-0 bottom-0 left-0 right-0 top-auto z-[10000] flex min-w-0 flex-col w-full max-w-full max-h-[90dvh] gap-4 [--dialog-pad:1rem] overflow-x-clip border-t bg-background p-4 pb-safe shadow-lg [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full rounded-t-2xl rounded-b-none overflow-y-auto overscroll-contain";
|
|
1201
1417
|
var DIALOG_MOBILE_SHEET_OVERRIDE = "inset-x-0 bottom-0 left-0 right-0 top-auto translate-none w-full max-w-full max-h-[90dvh] rounded-b-none rounded-t-2xl overflow-y-auto";
|
|
1202
|
-
var DialogContent =
|
|
1418
|
+
var DialogContent = React8.forwardRef(
|
|
1203
1419
|
({
|
|
1204
1420
|
className,
|
|
1205
1421
|
children,
|
|
@@ -1213,10 +1429,10 @@ var DialogContent = React7.forwardRef(
|
|
|
1213
1429
|
const isModal = useRadixDialogModal();
|
|
1214
1430
|
const injectedContainer = usePortalContainer(container);
|
|
1215
1431
|
const asSheet = mobileSheet && isMobile;
|
|
1216
|
-
const [containerEl, setContainerEl] =
|
|
1432
|
+
const [containerEl, setContainerEl] = React8.useState(
|
|
1217
1433
|
null
|
|
1218
1434
|
);
|
|
1219
|
-
const mergedRef =
|
|
1435
|
+
const mergedRef = React8.useCallback(
|
|
1220
1436
|
(node) => {
|
|
1221
1437
|
setContainerEl(node);
|
|
1222
1438
|
if (typeof ref === "function") ref(node);
|
|
@@ -1225,11 +1441,11 @@ var DialogContent = React7.forwardRef(
|
|
|
1225
1441
|
},
|
|
1226
1442
|
[ref]
|
|
1227
1443
|
);
|
|
1228
|
-
const hasTitle = (0,
|
|
1229
|
-
const hasDescription = (0,
|
|
1230
|
-
return /* @__PURE__ */ (0,
|
|
1231
|
-
isModal ? /* @__PURE__ */ (0,
|
|
1232
|
-
/* @__PURE__ */ (0,
|
|
1444
|
+
const hasTitle = (0, import_react_tree2.treeContainsComponent)(children, DialogTitle) || (0, import_react_tree2.treeContainsComponent)(children, DialogPrimitive.Title);
|
|
1445
|
+
const hasDescription = (0, import_react_tree2.treeContainsComponent)(children, DialogDescription) || (0, import_react_tree2.treeContainsComponent)(children, DialogPrimitive.Description);
|
|
1446
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(DialogPortal, { container, children: [
|
|
1447
|
+
isModal ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DialogOverlay, {}) : null,
|
|
1448
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1233
1449
|
DialogContentPrimitive,
|
|
1234
1450
|
{
|
|
1235
1451
|
ref: mergedRef,
|
|
@@ -1248,23 +1464,23 @@ var DialogContent = React7.forwardRef(
|
|
|
1248
1464
|
...hasDescription ? {} : { "aria-describedby": void 0 },
|
|
1249
1465
|
...props,
|
|
1250
1466
|
children: [
|
|
1251
|
-
hasTitle ? null : /* @__PURE__ */ (0,
|
|
1252
|
-
/* @__PURE__ */ (0,
|
|
1467
|
+
hasTitle ? null : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(VisuallyHidden.Root, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DialogPrimitive.Title, { children: "Dialog" }) }),
|
|
1468
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DialogContainerContext.Provider, { value: containerEl, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1253
1469
|
PortalContainerProvider,
|
|
1254
1470
|
{
|
|
1255
1471
|
container: containerEl ?? injectedContainer ?? null,
|
|
1256
1472
|
children
|
|
1257
1473
|
}
|
|
1258
1474
|
) }),
|
|
1259
|
-
showCloseButton ? /* @__PURE__ */ (0,
|
|
1475
|
+
showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1260
1476
|
DialogPrimitive.Close,
|
|
1261
1477
|
{
|
|
1262
1478
|
"data-slot": "dialog-close",
|
|
1263
1479
|
"aria-label": "Close",
|
|
1264
1480
|
className: "absolute right-2 top-4 flex h-11 w-11 items-center justify-center rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground sm:right-4 lg:h-10 lg:w-10",
|
|
1265
1481
|
children: [
|
|
1266
|
-
/* @__PURE__ */ (0,
|
|
1267
|
-
/* @__PURE__ */ (0,
|
|
1482
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(XIcon, { className: "h-4 w-4" }),
|
|
1483
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "sr-only", children: "Close" })
|
|
1268
1484
|
]
|
|
1269
1485
|
}
|
|
1270
1486
|
) : null
|
|
@@ -1278,7 +1494,7 @@ DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
|
1278
1494
|
var DialogHeader = ({
|
|
1279
1495
|
className,
|
|
1280
1496
|
...props
|
|
1281
|
-
}) => /* @__PURE__ */ (0,
|
|
1497
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1282
1498
|
"div",
|
|
1283
1499
|
{
|
|
1284
1500
|
"data-slot": "dialog-header",
|
|
@@ -1295,7 +1511,7 @@ DialogHeader.displayName = "DialogHeader";
|
|
|
1295
1511
|
var DialogFooter = ({
|
|
1296
1512
|
className,
|
|
1297
1513
|
...props
|
|
1298
|
-
}) => /* @__PURE__ */ (0,
|
|
1514
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1299
1515
|
"div",
|
|
1300
1516
|
{
|
|
1301
1517
|
"data-slot": "dialog-footer",
|
|
@@ -1327,7 +1543,7 @@ var DialogFooter = ({
|
|
|
1327
1543
|
}
|
|
1328
1544
|
);
|
|
1329
1545
|
DialogFooter.displayName = "DialogFooter";
|
|
1330
|
-
var DialogTitle =
|
|
1546
|
+
var DialogTitle = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1331
1547
|
DialogPrimitive.Title,
|
|
1332
1548
|
{
|
|
1333
1549
|
ref,
|
|
@@ -1337,7 +1553,7 @@ var DialogTitle = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
1337
1553
|
}
|
|
1338
1554
|
));
|
|
1339
1555
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
1340
|
-
var DialogDescription =
|
|
1556
|
+
var DialogDescription = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1341
1557
|
DialogPrimitive.Description,
|
|
1342
1558
|
{
|
|
1343
1559
|
ref,
|
|
@@ -1350,13 +1566,13 @@ DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
|
1350
1566
|
|
|
1351
1567
|
// src/sheet.tsx
|
|
1352
1568
|
var SheetPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
1353
|
-
var
|
|
1569
|
+
var import_react_tree3 = require("@ai-matrx/kit/react-tree");
|
|
1354
1570
|
var import_class_variance_authority2 = require("class-variance-authority");
|
|
1355
|
-
var
|
|
1356
|
-
var
|
|
1357
|
-
var SheetContentBase =
|
|
1571
|
+
var React9 = __toESM(require("react"), 1);
|
|
1572
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1573
|
+
var SheetContentBase = React9.forwardRef(({ ...props }, ref) => {
|
|
1358
1574
|
const isModal = useRadixDialogModal();
|
|
1359
|
-
return /* @__PURE__ */ (0,
|
|
1575
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1360
1576
|
SheetPrimitive.Content,
|
|
1361
1577
|
{
|
|
1362
1578
|
...props,
|
|
@@ -1366,13 +1582,13 @@ var SheetContentBase = React8.forwardRef(({ ...props }, ref) => {
|
|
|
1366
1582
|
);
|
|
1367
1583
|
});
|
|
1368
1584
|
SheetContentBase.displayName = "SheetContentBase";
|
|
1369
|
-
var Sheet =
|
|
1585
|
+
var Sheet = React9.forwardRef(({ children, ...props }, _ref) => {
|
|
1370
1586
|
const modal = props.modal ?? true;
|
|
1371
|
-
return /* @__PURE__ */ (0,
|
|
1587
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RadixDialogModalProvider, { modal, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SheetPrimitive.Root, { ...props, modal, children }) });
|
|
1372
1588
|
});
|
|
1373
1589
|
Sheet.displayName = "Sheet";
|
|
1374
1590
|
var SheetPortal = SheetPrimitive.Portal;
|
|
1375
|
-
var SheetOverlay =
|
|
1591
|
+
var SheetOverlay = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1376
1592
|
SheetPrimitive.Overlay,
|
|
1377
1593
|
{
|
|
1378
1594
|
className: cn(
|
|
@@ -1409,7 +1625,7 @@ var sheetVariants = (0, import_class_variance_authority2.cva)(
|
|
|
1409
1625
|
}
|
|
1410
1626
|
}
|
|
1411
1627
|
);
|
|
1412
|
-
var SheetDescription =
|
|
1628
|
+
var SheetDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1413
1629
|
SheetPrimitive.Description,
|
|
1414
1630
|
{
|
|
1415
1631
|
ref,
|
|
@@ -1418,7 +1634,7 @@ var SheetDescription = React8.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
1418
1634
|
}
|
|
1419
1635
|
));
|
|
1420
1636
|
SheetDescription.displayName = SheetPrimitive.Description.displayName;
|
|
1421
|
-
var SheetContent =
|
|
1637
|
+
var SheetContent = React9.forwardRef(
|
|
1422
1638
|
({
|
|
1423
1639
|
side = "right",
|
|
1424
1640
|
className,
|
|
@@ -1429,10 +1645,10 @@ var SheetContent = React8.forwardRef(
|
|
|
1429
1645
|
animated = true,
|
|
1430
1646
|
...props
|
|
1431
1647
|
}, ref) => {
|
|
1432
|
-
const hasDescription = (0,
|
|
1433
|
-
return /* @__PURE__ */ (0,
|
|
1434
|
-
!hideOverlay && /* @__PURE__ */ (0,
|
|
1435
|
-
/* @__PURE__ */ (0,
|
|
1648
|
+
const hasDescription = (0, import_react_tree3.treeContainsComponent)(children, SheetDescription) || (0, import_react_tree3.treeContainsComponent)(children, SheetPrimitive.Description);
|
|
1649
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(SheetPortal, { children: [
|
|
1650
|
+
!hideOverlay && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SheetOverlay, { className: overlayClassName }),
|
|
1651
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1436
1652
|
SheetContentBase,
|
|
1437
1653
|
{
|
|
1438
1654
|
ref,
|
|
@@ -1444,9 +1660,9 @@ var SheetContent = React8.forwardRef(
|
|
|
1444
1660
|
...hasDescription ? {} : { "aria-describedby": void 0 },
|
|
1445
1661
|
...props,
|
|
1446
1662
|
children: [
|
|
1447
|
-
!hideCloseButton && /* @__PURE__ */ (0,
|
|
1448
|
-
/* @__PURE__ */ (0,
|
|
1449
|
-
/* @__PURE__ */ (0,
|
|
1663
|
+
!hideCloseButton && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(SheetPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary", children: [
|
|
1664
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Cross2Icon, { className: "h-4 w-4" }),
|
|
1665
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "sr-only", children: "Close" })
|
|
1450
1666
|
] }),
|
|
1451
1667
|
children
|
|
1452
1668
|
]
|
|
@@ -1459,7 +1675,7 @@ SheetContent.displayName = SheetPrimitive.Content.displayName;
|
|
|
1459
1675
|
var SheetHeader = ({
|
|
1460
1676
|
className,
|
|
1461
1677
|
...props
|
|
1462
|
-
}) => /* @__PURE__ */ (0,
|
|
1678
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1463
1679
|
"div",
|
|
1464
1680
|
{
|
|
1465
1681
|
className: cn(
|
|
@@ -1473,7 +1689,7 @@ SheetHeader.displayName = "SheetHeader";
|
|
|
1473
1689
|
var SheetFooter = ({
|
|
1474
1690
|
className,
|
|
1475
1691
|
...props
|
|
1476
|
-
}) => /* @__PURE__ */ (0,
|
|
1692
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1477
1693
|
"div",
|
|
1478
1694
|
{
|
|
1479
1695
|
"data-slot": "sheet-footer",
|
|
@@ -1485,7 +1701,7 @@ var SheetFooter = ({
|
|
|
1485
1701
|
}
|
|
1486
1702
|
);
|
|
1487
1703
|
SheetFooter.displayName = "SheetFooter";
|
|
1488
|
-
var SheetTitle =
|
|
1704
|
+
var SheetTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1489
1705
|
SheetPrimitive.Title,
|
|
1490
1706
|
{
|
|
1491
1707
|
ref,
|
|
@@ -1496,33 +1712,33 @@ var SheetTitle = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
1496
1712
|
SheetTitle.displayName = SheetPrimitive.Title.displayName;
|
|
1497
1713
|
|
|
1498
1714
|
// src/data-table/default-host.tsx
|
|
1499
|
-
var
|
|
1715
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1500
1716
|
function DefaultTableLink(props) {
|
|
1501
|
-
return /* @__PURE__ */ (0,
|
|
1717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("a", { ...props });
|
|
1502
1718
|
}
|
|
1503
1719
|
function DefaultTableSidePanel({ title, titleNode, description, defaultWidth = 480, onClose, headerActions, children }) {
|
|
1504
|
-
return /* @__PURE__ */ (0,
|
|
1720
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Sheet, { open: true, onOpenChange: (open) => {
|
|
1505
1721
|
if (!open) onClose();
|
|
1506
|
-
}, children: /* @__PURE__ */ (0,
|
|
1507
|
-
/* @__PURE__ */ (0,
|
|
1508
|
-
/* @__PURE__ */ (0,
|
|
1509
|
-
description ? /* @__PURE__ */ (0,
|
|
1722
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(SheetContent, { side: "right", className: "flex h-full flex-col", style: { width: `min(${defaultWidth}px, 100vw)` }, children: [
|
|
1723
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(SheetHeader, { children: [
|
|
1724
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SheetTitle, { children: titleNode ?? title }),
|
|
1725
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SheetDescription, { children: description }) : null,
|
|
1510
1726
|
headerActions
|
|
1511
1727
|
] }),
|
|
1512
|
-
/* @__PURE__ */ (0,
|
|
1728
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "min-h-0 flex-1 overflow-auto", children })
|
|
1513
1729
|
] }) });
|
|
1514
1730
|
}
|
|
1515
1731
|
function DefaultTableWindow({ title, onClose, width = 720, height = 560, actionsRight, sidebar, children }) {
|
|
1516
|
-
return /* @__PURE__ */ (0,
|
|
1732
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Dialog, { open: true, onOpenChange: (open) => {
|
|
1517
1733
|
if (!open) onClose();
|
|
1518
|
-
}, children: /* @__PURE__ */ (0,
|
|
1519
|
-
/* @__PURE__ */ (0,
|
|
1520
|
-
/* @__PURE__ */ (0,
|
|
1734
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(DialogContent, { className: "flex flex-col overflow-hidden", style: { width: `min(${width}px, calc(100vw - 2rem))`, height: `min(${height}px, 85dvh)` }, children: [
|
|
1735
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(DialogHeader, { children: [
|
|
1736
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DialogTitle, { children: title }),
|
|
1521
1737
|
actionsRight
|
|
1522
1738
|
] }),
|
|
1523
|
-
/* @__PURE__ */ (0,
|
|
1524
|
-
sidebar ? /* @__PURE__ */ (0,
|
|
1525
|
-
/* @__PURE__ */ (0,
|
|
1739
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex min-h-0 flex-1", children: [
|
|
1740
|
+
sidebar ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("aside", { className: "shrink-0 border-r pr-2", children: sidebar }) : null,
|
|
1741
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "min-h-0 min-w-0 flex-1 overflow-auto", children })
|
|
1526
1742
|
] })
|
|
1527
1743
|
] }) });
|
|
1528
1744
|
}
|
|
@@ -1532,19 +1748,19 @@ var import_react3 = require("react");
|
|
|
1532
1748
|
|
|
1533
1749
|
// src/data-table/host.tsx
|
|
1534
1750
|
var import_react2 = require("react");
|
|
1535
|
-
var
|
|
1751
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1536
1752
|
var HOST_SLOT = /* @__PURE__ */ Symbol.for("ai-matrx.design-system.table-host-context");
|
|
1537
1753
|
var hostRegistry = globalThis;
|
|
1538
1754
|
var HostContext = hostRegistry[HOST_SLOT] ??= (0, import_react2.createContext)({});
|
|
1539
1755
|
function MatrxDataTableProvider({ value, children }) {
|
|
1540
|
-
return /* @__PURE__ */ (0,
|
|
1756
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(HostContext.Provider, { value, children });
|
|
1541
1757
|
}
|
|
1542
1758
|
function useMatrxDataTableHost() {
|
|
1543
1759
|
return (0, import_react2.useContext)(HostContext);
|
|
1544
1760
|
}
|
|
1545
1761
|
|
|
1546
1762
|
// src/data-table/useTableNotice.tsx
|
|
1547
|
-
var
|
|
1763
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1548
1764
|
function useTableNotice() {
|
|
1549
1765
|
const host = useMatrxDataTableHost();
|
|
1550
1766
|
const [message, setMessage] = (0, import_react3.useState)(null);
|
|
@@ -1558,9 +1774,9 @@ function useTableNotice() {
|
|
|
1558
1774
|
else setMessage({ text, error: true });
|
|
1559
1775
|
}
|
|
1560
1776
|
};
|
|
1561
|
-
const notice = message ? /* @__PURE__ */ (0,
|
|
1777
|
+
const notice = message ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { role: message.error ? "alert" : "status", className: message.error ? "text-xs text-destructive" : "text-xs text-muted-foreground", children: [
|
|
1562
1778
|
message.text,
|
|
1563
|
-
/* @__PURE__ */ (0,
|
|
1779
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", "aria-label": "Dismiss notification", className: "ml-2 underline", onClick: () => setMessage(null), children: "Dismiss" })
|
|
1564
1780
|
] }) : null;
|
|
1565
1781
|
return { notify, notice };
|
|
1566
1782
|
}
|
|
@@ -1568,8 +1784,8 @@ function useTableNotice() {
|
|
|
1568
1784
|
// src/select.tsx
|
|
1569
1785
|
var SelectPrimitive = __toESM(require("@radix-ui/react-select"), 1);
|
|
1570
1786
|
var import_class_variance_authority3 = require("class-variance-authority");
|
|
1571
|
-
var
|
|
1572
|
-
var
|
|
1787
|
+
var React10 = __toESM(require("react"), 1);
|
|
1788
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1573
1789
|
var Select = SelectPrimitive.Root;
|
|
1574
1790
|
var SelectValue = SelectPrimitive.Value;
|
|
1575
1791
|
var selectTriggerVariants = (0, import_class_variance_authority3.cva)(
|
|
@@ -1587,7 +1803,7 @@ var selectTriggerVariants = (0, import_class_variance_authority3.cva)(
|
|
|
1587
1803
|
}
|
|
1588
1804
|
}
|
|
1589
1805
|
);
|
|
1590
|
-
var SelectTrigger =
|
|
1806
|
+
var SelectTrigger = React10.forwardRef(({ className, children, hideArrow = false, size, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1591
1807
|
SelectPrimitive.Trigger,
|
|
1592
1808
|
{
|
|
1593
1809
|
ref,
|
|
@@ -1595,12 +1811,12 @@ var SelectTrigger = React9.forwardRef(({ className, children, hideArrow = false,
|
|
|
1595
1811
|
...props,
|
|
1596
1812
|
children: [
|
|
1597
1813
|
children,
|
|
1598
|
-
!hideArrow && /* @__PURE__ */ (0,
|
|
1814
|
+
!hideArrow && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(RadixChevronDownIcon, { className: "h-4 w-4 opacity-50" }) })
|
|
1599
1815
|
]
|
|
1600
1816
|
}
|
|
1601
1817
|
));
|
|
1602
1818
|
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
1603
|
-
var SelectScrollUpButton =
|
|
1819
|
+
var SelectScrollUpButton = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1604
1820
|
SelectPrimitive.ScrollUpButton,
|
|
1605
1821
|
{
|
|
1606
1822
|
ref,
|
|
@@ -1609,11 +1825,11 @@ var SelectScrollUpButton = React9.forwardRef(({ className, ...props }, ref) => /
|
|
|
1609
1825
|
className
|
|
1610
1826
|
),
|
|
1611
1827
|
...props,
|
|
1612
|
-
children: /* @__PURE__ */ (0,
|
|
1828
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(RadixChevronUpIcon, {})
|
|
1613
1829
|
}
|
|
1614
1830
|
));
|
|
1615
1831
|
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
1616
|
-
var SelectScrollDownButton =
|
|
1832
|
+
var SelectScrollDownButton = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1617
1833
|
SelectPrimitive.ScrollDownButton,
|
|
1618
1834
|
{
|
|
1619
1835
|
ref,
|
|
@@ -1622,11 +1838,11 @@ var SelectScrollDownButton = React9.forwardRef(({ className, ...props }, ref) =>
|
|
|
1622
1838
|
className
|
|
1623
1839
|
),
|
|
1624
1840
|
...props,
|
|
1625
|
-
children: /* @__PURE__ */ (0,
|
|
1841
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(RadixChevronDownIcon, {})
|
|
1626
1842
|
}
|
|
1627
1843
|
));
|
|
1628
1844
|
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
1629
|
-
var SelectContent =
|
|
1845
|
+
var SelectContent = React10.forwardRef(
|
|
1630
1846
|
({
|
|
1631
1847
|
className,
|
|
1632
1848
|
children,
|
|
@@ -1636,7 +1852,7 @@ var SelectContent = React9.forwardRef(
|
|
|
1636
1852
|
...props
|
|
1637
1853
|
}, ref) => {
|
|
1638
1854
|
const portalContainer = usePortalContainer(container);
|
|
1639
|
-
return /* @__PURE__ */ (0,
|
|
1855
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SelectPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1640
1856
|
SelectPrimitive.Content,
|
|
1641
1857
|
{
|
|
1642
1858
|
ref,
|
|
@@ -1654,8 +1870,8 @@ var SelectContent = React9.forwardRef(
|
|
|
1654
1870
|
position,
|
|
1655
1871
|
...props,
|
|
1656
1872
|
children: [
|
|
1657
|
-
/* @__PURE__ */ (0,
|
|
1658
|
-
/* @__PURE__ */ (0,
|
|
1873
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SelectScrollUpButton, {}),
|
|
1874
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1659
1875
|
SelectPrimitive.Viewport,
|
|
1660
1876
|
{
|
|
1661
1877
|
className: cn(
|
|
@@ -1665,14 +1881,14 @@ var SelectContent = React9.forwardRef(
|
|
|
1665
1881
|
children
|
|
1666
1882
|
}
|
|
1667
1883
|
),
|
|
1668
|
-
/* @__PURE__ */ (0,
|
|
1884
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SelectScrollDownButton, {})
|
|
1669
1885
|
]
|
|
1670
1886
|
}
|
|
1671
1887
|
) });
|
|
1672
1888
|
}
|
|
1673
1889
|
);
|
|
1674
1890
|
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
1675
|
-
var SelectLabel =
|
|
1891
|
+
var SelectLabel = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1676
1892
|
SelectPrimitive.Label,
|
|
1677
1893
|
{
|
|
1678
1894
|
ref,
|
|
@@ -1681,7 +1897,7 @@ var SelectLabel = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
1681
1897
|
}
|
|
1682
1898
|
));
|
|
1683
1899
|
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
1684
|
-
var SelectItem =
|
|
1900
|
+
var SelectItem = React10.forwardRef(({ className, children, description, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1685
1901
|
SelectPrimitive.Item,
|
|
1686
1902
|
{
|
|
1687
1903
|
ref,
|
|
@@ -1692,14 +1908,14 @@ var SelectItem = React9.forwardRef(({ className, children, description, ...props
|
|
|
1692
1908
|
),
|
|
1693
1909
|
...props,
|
|
1694
1910
|
children: [
|
|
1695
|
-
/* @__PURE__ */ (0,
|
|
1696
|
-
/* @__PURE__ */ (0,
|
|
1697
|
-
description ? /* @__PURE__ */ (0,
|
|
1911
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CheckIcon, { className: "h-4 w-4" }) }) }),
|
|
1912
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SelectPrimitive.ItemText, { children }),
|
|
1913
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "block text-xs leading-snug text-muted-foreground", children: description }) : null
|
|
1698
1914
|
]
|
|
1699
1915
|
}
|
|
1700
1916
|
));
|
|
1701
1917
|
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
1702
|
-
var SelectSeparator =
|
|
1918
|
+
var SelectSeparator = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1703
1919
|
SelectPrimitive.Separator,
|
|
1704
1920
|
{
|
|
1705
1921
|
ref,
|
|
@@ -1710,7 +1926,7 @@ var SelectSeparator = React9.forwardRef(({ className, ...props }, ref) => /* @__
|
|
|
1710
1926
|
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
1711
1927
|
|
|
1712
1928
|
// src/data-table/pagination.tsx
|
|
1713
|
-
var
|
|
1929
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1714
1930
|
function GenericTablePagination({
|
|
1715
1931
|
totalItems,
|
|
1716
1932
|
itemsPerPage,
|
|
@@ -1769,8 +1985,8 @@ function GenericTablePagination({
|
|
|
1769
1985
|
className,
|
|
1770
1986
|
containerClassName
|
|
1771
1987
|
);
|
|
1772
|
-
return /* @__PURE__ */ (0,
|
|
1773
|
-
showItemsPerPageSelect && /* @__PURE__ */ (0,
|
|
1988
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { "data-matrx-table-footer": true, className: containerClass, children: [
|
|
1989
|
+
showItemsPerPageSelect && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1774
1990
|
"div",
|
|
1775
1991
|
{
|
|
1776
1992
|
className: cn(
|
|
@@ -1778,13 +1994,13 @@ function GenericTablePagination({
|
|
|
1778
1994
|
!compact && "sm:p-1",
|
|
1779
1995
|
selectContainerClassName
|
|
1780
1996
|
),
|
|
1781
|
-
children: /* @__PURE__ */ (0,
|
|
1997
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1782
1998
|
Select,
|
|
1783
1999
|
{
|
|
1784
2000
|
value: itemsPerPage.toString(),
|
|
1785
2001
|
onValueChange: (value) => onItemsPerPageChange(parseInt(value)),
|
|
1786
2002
|
children: [
|
|
1787
|
-
/* @__PURE__ */ (0,
|
|
2003
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1788
2004
|
SelectTrigger,
|
|
1789
2005
|
{
|
|
1790
2006
|
"aria-label": "Rows per page",
|
|
@@ -1792,31 +2008,31 @@ function GenericTablePagination({
|
|
|
1792
2008
|
"focus:ring-0",
|
|
1793
2009
|
compact ? "relative isolate h-11 w-14 border-0 bg-transparent px-2 text-xs before:absolute before:inset-x-1 before:inset-y-1.5 before:z-0 before:rounded-md before:border before:border-border before:bg-card before:content-[''] hover:before:bg-accent [&>*]:relative [&>*]:z-10 lg:h-7 lg:min-h-7 lg:w-16 lg:border lg:border-input lg:bg-background lg:px-2 lg:before:hidden" : "h-8 w-[3.75rem] text-xs sm:w-36 sm:text-sm"
|
|
1794
2010
|
),
|
|
1795
|
-
children: /* @__PURE__ */ (0,
|
|
2011
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SelectValue, { placeholder: itemsPerPage.toString() })
|
|
1796
2012
|
}
|
|
1797
2013
|
),
|
|
1798
|
-
/* @__PURE__ */ (0,
|
|
1799
|
-
availablePageSizes.map((size) => /* @__PURE__ */ (0,
|
|
1800
|
-
showAllOption ? /* @__PURE__ */ (0,
|
|
2014
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(SelectContent, { children: [
|
|
2015
|
+
availablePageSizes.map((size) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SelectItem, { value: size.toString(), children: size }, size)),
|
|
2016
|
+
showAllOption ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SelectItem, { value: allValue.toString(), children: allOptionLabel }) : null
|
|
1801
2017
|
] })
|
|
1802
2018
|
]
|
|
1803
2019
|
}
|
|
1804
2020
|
)
|
|
1805
2021
|
}
|
|
1806
2022
|
),
|
|
1807
|
-
/* @__PURE__ */ (0,
|
|
2023
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1808
2024
|
"div",
|
|
1809
2025
|
{
|
|
1810
2026
|
className: cn("flex min-w-0 justify-center", infoContainerClassName),
|
|
1811
|
-
children: showPageInfo && !hideEntriesInfo && /* @__PURE__ */ (0,
|
|
1812
|
-
/* @__PURE__ */ (0,
|
|
2027
|
+
children: showPageInfo && !hideEntriesInfo && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
2028
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "truncate text-[10px] tabular-nums text-muted-foreground sm:hidden", children: [
|
|
1813
2029
|
startItem,
|
|
1814
2030
|
"-",
|
|
1815
2031
|
endItem,
|
|
1816
2032
|
" / ",
|
|
1817
2033
|
totalItems
|
|
1818
2034
|
] }),
|
|
1819
|
-
/* @__PURE__ */ (0,
|
|
2035
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1820
2036
|
"span",
|
|
1821
2037
|
{
|
|
1822
2038
|
className: `hidden whitespace-nowrap ${compact ? "text-xs" : "text-sm"} text-muted-foreground sm:inline`,
|
|
@@ -1826,7 +2042,7 @@ function GenericTablePagination({
|
|
|
1826
2042
|
] })
|
|
1827
2043
|
}
|
|
1828
2044
|
),
|
|
1829
|
-
showPageControls && /* @__PURE__ */ (0,
|
|
2045
|
+
showPageControls && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1830
2046
|
"div",
|
|
1831
2047
|
{
|
|
1832
2048
|
className: cn(
|
|
@@ -1835,7 +2051,7 @@ function GenericTablePagination({
|
|
|
1835
2051
|
controlsContainerClassName
|
|
1836
2052
|
),
|
|
1837
2053
|
children: [
|
|
1838
|
-
/* @__PURE__ */ (0,
|
|
2054
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1839
2055
|
Button,
|
|
1840
2056
|
{
|
|
1841
2057
|
variant: "outline",
|
|
@@ -1849,10 +2065,10 @@ function GenericTablePagination({
|
|
|
1849
2065
|
compact ? compactButtonClass : "h-8 w-8 p-0",
|
|
1850
2066
|
navButtonClassName
|
|
1851
2067
|
),
|
|
1852
|
-
children: /* @__PURE__ */ (0,
|
|
2068
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChevronsLeft, { className: compact ? "h-3.5 w-3.5" : "h-4 w-4" })
|
|
1853
2069
|
}
|
|
1854
2070
|
),
|
|
1855
|
-
/* @__PURE__ */ (0,
|
|
2071
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1856
2072
|
Button,
|
|
1857
2073
|
{
|
|
1858
2074
|
variant: "outline",
|
|
@@ -1865,10 +2081,10 @@ function GenericTablePagination({
|
|
|
1865
2081
|
compact ? compactButtonClass : "h-8 w-8 p-0",
|
|
1866
2082
|
navButtonClassName
|
|
1867
2083
|
),
|
|
1868
|
-
children: /* @__PURE__ */ (0,
|
|
2084
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChevronLeft, { className: compact ? "h-3.5 w-3.5" : "h-4 w-4" })
|
|
1869
2085
|
}
|
|
1870
2086
|
),
|
|
1871
|
-
getPageNumbers(3).map((page) => /* @__PURE__ */ (0,
|
|
2087
|
+
getPageNumbers(3).map((page) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1872
2088
|
Button,
|
|
1873
2089
|
{
|
|
1874
2090
|
variant: currentPage === page ? "default" : "outline",
|
|
@@ -1883,11 +2099,11 @@ function GenericTablePagination({
|
|
|
1883
2099
|
compact && page === currentPage && compactActiveButtonClass,
|
|
1884
2100
|
page === currentPage ? pageActiveButtonClassName : pageButtonClassName
|
|
1885
2101
|
),
|
|
1886
|
-
children: /* @__PURE__ */ (0,
|
|
2102
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "relative z-10", children: page })
|
|
1887
2103
|
},
|
|
1888
2104
|
`mobile-${page}`
|
|
1889
2105
|
)),
|
|
1890
|
-
getPageNumbers().map((page) => /* @__PURE__ */ (0,
|
|
2106
|
+
getPageNumbers().map((page) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1891
2107
|
Button,
|
|
1892
2108
|
{
|
|
1893
2109
|
variant: currentPage === page ? "default" : "outline",
|
|
@@ -1901,11 +2117,11 @@ function GenericTablePagination({
|
|
|
1901
2117
|
compact && page === currentPage && compactActiveButtonClass,
|
|
1902
2118
|
currentPage === page ? pageActiveButtonClassName : pageButtonClassName
|
|
1903
2119
|
),
|
|
1904
|
-
children: /* @__PURE__ */ (0,
|
|
2120
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "relative z-10", children: page })
|
|
1905
2121
|
},
|
|
1906
2122
|
`desktop-${page}`
|
|
1907
2123
|
)),
|
|
1908
|
-
/* @__PURE__ */ (0,
|
|
2124
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1909
2125
|
Button,
|
|
1910
2126
|
{
|
|
1911
2127
|
variant: "outline",
|
|
@@ -1918,10 +2134,10 @@ function GenericTablePagination({
|
|
|
1918
2134
|
compact ? compactButtonClass : "h-8 w-8 p-0",
|
|
1919
2135
|
navButtonClassName
|
|
1920
2136
|
),
|
|
1921
|
-
children: /* @__PURE__ */ (0,
|
|
2137
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChevronRight, { className: compact ? "h-3.5 w-3.5" : "h-4 w-4" })
|
|
1922
2138
|
}
|
|
1923
2139
|
),
|
|
1924
|
-
/* @__PURE__ */ (0,
|
|
2140
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1925
2141
|
Button,
|
|
1926
2142
|
{
|
|
1927
2143
|
variant: "outline",
|
|
@@ -1935,7 +2151,7 @@ function GenericTablePagination({
|
|
|
1935
2151
|
compact ? compactButtonClass : "h-8 w-8 p-0",
|
|
1936
2152
|
navButtonClassName
|
|
1937
2153
|
),
|
|
1938
|
-
children: /* @__PURE__ */ (0,
|
|
2154
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChevronsRight, { className: compact ? "h-3.5 w-3.5" : "h-4 w-4" })
|
|
1939
2155
|
}
|
|
1940
2156
|
)
|
|
1941
2157
|
]
|
|
@@ -1950,11 +2166,11 @@ var import_clipboard = require("@ai-matrx/kit/clipboard");
|
|
|
1950
2166
|
|
|
1951
2167
|
// src/popover.tsx
|
|
1952
2168
|
var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"), 1);
|
|
1953
|
-
var
|
|
1954
|
-
var
|
|
2169
|
+
var React11 = __toESM(require("react"), 1);
|
|
2170
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1955
2171
|
var Popover = PopoverPrimitive.Root;
|
|
1956
2172
|
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
1957
|
-
var PopoverContent =
|
|
2173
|
+
var PopoverContent = React11.forwardRef(
|
|
1958
2174
|
({
|
|
1959
2175
|
className,
|
|
1960
2176
|
align = "center",
|
|
@@ -1964,7 +2180,7 @@ var PopoverContent = React10.forwardRef(
|
|
|
1964
2180
|
...props
|
|
1965
2181
|
}, ref) => {
|
|
1966
2182
|
const portalContainer = usePortalContainer(container);
|
|
1967
|
-
return /* @__PURE__ */ (0,
|
|
2183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PopoverPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1968
2184
|
PopoverPrimitive.Content,
|
|
1969
2185
|
{
|
|
1970
2186
|
ref,
|
|
@@ -2016,7 +2232,7 @@ ${JSON.stringify(value.data, null, 2)}
|
|
|
2016
2232
|
}
|
|
2017
2233
|
|
|
2018
2234
|
// src/data-table/copy.tsx
|
|
2019
|
-
var
|
|
2235
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2020
2236
|
function resolve(value) {
|
|
2021
2237
|
return typeof value === "function" ? value() : value;
|
|
2022
2238
|
}
|
|
@@ -2037,8 +2253,8 @@ function download(item) {
|
|
|
2037
2253
|
}
|
|
2038
2254
|
function CopyButtons(props) {
|
|
2039
2255
|
const { CopyControls } = useMatrxDataTableHost();
|
|
2040
|
-
if (CopyControls) return /* @__PURE__ */ (0,
|
|
2041
|
-
return /* @__PURE__ */ (0,
|
|
2256
|
+
if (CopyControls) return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CopyControls, { ...props });
|
|
2257
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DefaultCopyButtons, { ...props });
|
|
2042
2258
|
}
|
|
2043
2259
|
function DefaultCopyButtons({ human, agent, json, label, size = "icon", appearance = "segmented", disabled = false, stopPropagation = true, className, aiVariants = [], agentVariant, aiCustom, export: exportConfig, hide }) {
|
|
2044
2260
|
const { notify, notice } = useTableNotice();
|
|
@@ -2071,23 +2287,23 @@ function DefaultCopyButtons({ human, agent, json, label, size = "icon", appearan
|
|
|
2071
2287
|
const exports = hide?.includes("export") ? void 0 : exportConfig;
|
|
2072
2288
|
const showCustom = aiCustom && !hide?.includes("ai");
|
|
2073
2289
|
const buttonClass = `${size === "xs" ? "h-8 w-8 lg:h-5 lg:w-8" : ""} ${appearance === "bare" ? "border-0 bg-transparent shadow-none" : ""}`;
|
|
2074
|
-
return /* @__PURE__ */ (0,
|
|
2075
|
-
human !== void 0 && !hide?.includes("copy") ? /* @__PURE__ */ (0,
|
|
2076
|
-
variants.length > 0 || showCustom || exports ? /* @__PURE__ */ (0,
|
|
2077
|
-
/* @__PURE__ */ (0,
|
|
2078
|
-
/* @__PURE__ */ (0,
|
|
2079
|
-
variants.map((variant) => /* @__PURE__ */ (0,
|
|
2290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: `inline-flex flex-wrap items-center gap-0.5 ${className ?? ""}`, onClick: stopPropagation ? (event) => event.stopPropagation() : void 0, children: [
|
|
2291
|
+
human !== void 0 && !hide?.includes("copy") ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button, { type: "button", variant: "ghost", size: "icon", className: buttonClass, disabled: disabled || busy, "aria-label": `Copy ${label}`, onClick: () => void run(() => clipboard.copyText(resolve(human), `${label} copied`)), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Copy, { className: "h-3.5 w-3.5" }) }) : null,
|
|
2292
|
+
variants.length > 0 || showCustom || exports ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Popover, { children: [
|
|
2293
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button, { type: "button", variant: "ghost", size: "icon", className: buttonClass, disabled: disabled || busy, "aria-label": `Copy ${label} for AI or export`, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SlidersHorizontal, { className: "h-3.5 w-3.5" }) }) }),
|
|
2294
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(PopoverContent, { align: "end", className: "w-64 p-1", children: [
|
|
2295
|
+
variants.map((variant) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button, { type: "button", variant: "ghost", size: "sm", className: "w-full justify-start", disabled: busy, onClick: () => void run(async () => {
|
|
2080
2296
|
if (variant.onSelect) variant.onSelect();
|
|
2081
2297
|
else if (variant.modal) setModal(variant.id);
|
|
2082
2298
|
else if (variant.build) await clipboard.copyText(tableAgentText(await variant.build()), variant.successMessage ?? `${label} copied`);
|
|
2083
2299
|
else throw new Error(`No copy action is available for ${variant.label}.`);
|
|
2084
2300
|
}), children: variant.label }, variant.id)),
|
|
2085
|
-
showCustom ? /* @__PURE__ */ (0,
|
|
2086
|
-
exports?.items.map((item) => /* @__PURE__ */ (0,
|
|
2301
|
+
showCustom ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button, { type: "button", variant: "ghost", size: "sm", className: "w-full justify-start", onClick: () => setModal("custom"), children: aiCustom.label ?? "Custom copy\u2026" }) : null,
|
|
2302
|
+
exports?.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button, { type: "button", variant: "ghost", size: "sm", className: "w-full justify-start", disabled: busy, onClick: () => void run(async () => {
|
|
2087
2303
|
if (item.onSelect) await item.onSelect();
|
|
2088
2304
|
else download(item);
|
|
2089
2305
|
}), children: item.label }, item.id)),
|
|
2090
|
-
exports?.sheetRows ? /* @__PURE__ */ (0,
|
|
2306
|
+
exports?.sheetRows ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button, { type: "button", variant: "ghost", size: "sm", className: "w-full justify-start", onClick: () => void run(async () => {
|
|
2091
2307
|
const rows = exports.sheetRows?.();
|
|
2092
2308
|
if (!rows) return;
|
|
2093
2309
|
const keys = [...new Set(rows.flatMap((row) => Object.keys(row)))];
|
|
@@ -2096,8 +2312,8 @@ function DefaultCopyButtons({ human, agent, json, label, size = "icon", appearan
|
|
|
2096
2312
|
}), children: "Copy for Google Sheets" }) : null
|
|
2097
2313
|
] })
|
|
2098
2314
|
] }) : null,
|
|
2099
|
-
variants.map((variant) => variant.modal && modal === variant.id ? /* @__PURE__ */ (0,
|
|
2100
|
-
modal === "custom" && aiCustom ? /* @__PURE__ */ (0,
|
|
2315
|
+
variants.map((variant) => variant.modal && modal === variant.id ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: variant.modal({ open: true, onOpenChange: (open) => setModal(open ? variant.id : null) }) }, variant.id) : null),
|
|
2316
|
+
modal === "custom" && aiCustom ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CustomCopy, { source: aiCustom, onClose: () => setModal(null) }) : null,
|
|
2101
2317
|
notice
|
|
2102
2318
|
] });
|
|
2103
2319
|
}
|
|
@@ -2113,25 +2329,25 @@ function CustomCopy({ source, onClose }) {
|
|
|
2113
2329
|
} catch (raw) {
|
|
2114
2330
|
error = raw instanceof Error ? raw.message : String(raw);
|
|
2115
2331
|
}
|
|
2116
|
-
return /* @__PURE__ */ (0,
|
|
2332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Dialog, { open: true, onOpenChange: (open) => {
|
|
2117
2333
|
if (!open) onClose();
|
|
2118
|
-
}, children: /* @__PURE__ */ (0,
|
|
2119
|
-
/* @__PURE__ */ (0,
|
|
2120
|
-
source.dialogDescription ? /* @__PURE__ */ (0,
|
|
2121
|
-
source.options.map((option) => /* @__PURE__ */ (0,
|
|
2334
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(DialogContent, { children: [
|
|
2335
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DialogTitle, { children: source.dialogTitle ?? "Custom copy" }) }),
|
|
2336
|
+
source.dialogDescription ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-sm", children: source.dialogDescription }) : null,
|
|
2337
|
+
source.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center justify-between gap-3 text-sm", children: [
|
|
2122
2338
|
option.label,
|
|
2123
|
-
option.kind === "toggle" ? /* @__PURE__ */ (0,
|
|
2124
|
-
option.presets?.map((choice) => /* @__PURE__ */ (0,
|
|
2125
|
-
/* @__PURE__ */ (0,
|
|
2339
|
+
option.kind === "toggle" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { type: "checkbox", checked: values[option.key] === true, onChange: (e) => setValues({ ...values, [option.key]: e.target.checked }) }) : option.kind === "preset" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("select", { "aria-label": option.label, value: Number(values[option.key]), onChange: (e) => setValues({ ...values, [option.key]: Number(e.target.value) }), children: option.options.map((choice) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: choice.value, children: choice.label }, choice.value)) }) : option.kind === "slider" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { "aria-label": option.label, type: "range", min: 0, max: option.stops.length - 1, step: 1, value: Math.max(0, option.stops.indexOf(Number(values[option.key]))), onChange: (e) => setValues({ ...values, [option.key]: option.stops[Number(e.target.value)] ?? option.default }) }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "flex gap-1", children: [
|
|
2340
|
+
option.presets?.map((choice) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button, { type: "button", size: "sm", variant: "outline", onClick: () => setValues({ ...values, [option.key]: choice.value }), children: choice.label }, choice.value)),
|
|
2341
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", { "aria-label": option.label, type: "number", value: Number(values[option.key]), min: option.min, step: option.step, onChange: (e) => {
|
|
2126
2342
|
if (Number.isFinite(e.target.valueAsNumber)) setValues({ ...values, [option.key]: e.target.valueAsNumber });
|
|
2127
2343
|
} })
|
|
2128
2344
|
] })
|
|
2129
2345
|
] }, option.key)),
|
|
2130
|
-
error ? /* @__PURE__ */ (0,
|
|
2346
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { role: "alert", className: "text-destructive", children: error }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("pre", { className: "max-h-48 overflow-auto whitespace-pre-wrap text-xs", children: text }),
|
|
2131
2347
|
notice,
|
|
2132
|
-
/* @__PURE__ */ (0,
|
|
2133
|
-
/* @__PURE__ */ (0,
|
|
2134
|
-
/* @__PURE__ */ (0,
|
|
2348
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(DialogFooter, { children: [
|
|
2349
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button, { type: "button", variant: "outline", onClick: onClose, children: "Close" }),
|
|
2350
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button, { type: "button", disabled: error !== null, onClick: () => void clipboard.copyText(text, "Custom copy copied"), children: "Copy" })
|
|
2135
2351
|
] })
|
|
2136
2352
|
] }) });
|
|
2137
2353
|
}
|
|
@@ -2237,7 +2453,7 @@ function buildViewHuman(config, visible, columns) {
|
|
|
2237
2453
|
}
|
|
2238
2454
|
|
|
2239
2455
|
// src/data-table/CopySubset.tsx
|
|
2240
|
-
var
|
|
2456
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2241
2457
|
function CopySubsetDialog({ source, onClose }) {
|
|
2242
2458
|
const [rows] = (0, import_react5.useState)(() => [...source.rows]);
|
|
2243
2459
|
const [hidden, setHidden] = (0, import_react5.useState)(() => new Set(source.columns.filter((c) => c.hidden).map((c) => c.id)));
|
|
@@ -2258,14 +2474,14 @@ function CopySubsetDialog({ source, onClose }) {
|
|
|
2258
2474
|
} catch (raw) {
|
|
2259
2475
|
buildError = raw instanceof Error ? raw.message : String(raw);
|
|
2260
2476
|
}
|
|
2261
|
-
return /* @__PURE__ */ (0,
|
|
2477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Dialog, { open: true, onOpenChange: (open) => {
|
|
2262
2478
|
if (!open) onClose();
|
|
2263
|
-
}, children: /* @__PURE__ */ (0,
|
|
2264
|
-
/* @__PURE__ */ (0,
|
|
2265
|
-
/* @__PURE__ */ (0,
|
|
2266
|
-
/* @__PURE__ */ (0,
|
|
2267
|
-
source.columns.map((column) => /* @__PURE__ */ (0,
|
|
2268
|
-
/* @__PURE__ */ (0,
|
|
2479
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DialogContent, { className: "flex h-[80dvh] max-w-5xl flex-col overflow-hidden", children: [
|
|
2480
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DialogTitle, { children: "Filter & sort before copying" }) }),
|
|
2481
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("fieldset", { className: "max-h-24 shrink-0 overflow-auto text-xs", children: [
|
|
2482
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("legend", { children: "Visible columns" }),
|
|
2483
|
+
source.columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "mr-3 inline-flex items-center gap-1", children: [
|
|
2484
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("input", { type: "checkbox", checked: !hidden.has(column.id), onChange: () => setHidden((current) => {
|
|
2269
2485
|
const next = new Set(current);
|
|
2270
2486
|
next.has(column.id) ? next.delete(column.id) : next.add(column.id);
|
|
2271
2487
|
return next;
|
|
@@ -2273,20 +2489,20 @@ function CopySubsetDialog({ source, onClose }) {
|
|
|
2273
2489
|
column.header
|
|
2274
2490
|
] }, column.id))
|
|
2275
2491
|
] }),
|
|
2276
|
-
columns.length ? /* @__PURE__ */ (0,
|
|
2277
|
-
buildError ? /* @__PURE__ */ (0,
|
|
2492
|
+
columns.length ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MatrxDataTable, { data: rows, columns, getRowId: source.getRowId, query: { mode: "controlled-local", state: query, onStateChange: setQuery }, selection: { selectedIds, onSelectedIdsChange: setSelectedIds }, detail: { enabled: false }, window: { enabled: false }, toolbar: { searchMatch: {} } }) }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { children: "Show at least one column to copy." }),
|
|
2493
|
+
buildError ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { role: "alert", className: "text-destructive", children: buildError }) : null,
|
|
2278
2494
|
notice,
|
|
2279
|
-
/* @__PURE__ */ (0,
|
|
2280
|
-
/* @__PURE__ */ (0,
|
|
2495
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DialogFooter, { children: [
|
|
2496
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
2281
2497
|
"Format",
|
|
2282
|
-
/* @__PURE__ */ (0,
|
|
2283
|
-
/* @__PURE__ */ (0,
|
|
2284
|
-
/* @__PURE__ */ (0,
|
|
2285
|
-
/* @__PURE__ */ (0,
|
|
2286
|
-
/* @__PURE__ */ (0,
|
|
2498
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("select", { "aria-label": "Copy format", value: format, onChange: (event) => setFormat(event.target.value), children: [
|
|
2499
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "ai", children: "For AI" }),
|
|
2500
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "markdown", children: "Markdown" }),
|
|
2501
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "csv", children: "CSV" }),
|
|
2502
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "json", children: "JSON" })
|
|
2287
2503
|
] })
|
|
2288
2504
|
] }),
|
|
2289
|
-
/* @__PURE__ */ (0,
|
|
2505
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { role: "status", className: "text-xs", children: [
|
|
2290
2506
|
shaped.length,
|
|
2291
2507
|
" of ",
|
|
2292
2508
|
rows.length,
|
|
@@ -2296,13 +2512,13 @@ function CopySubsetDialog({ source, onClose }) {
|
|
|
2296
2512
|
text.length.toLocaleString(),
|
|
2297
2513
|
" characters"
|
|
2298
2514
|
] }),
|
|
2299
|
-
/* @__PURE__ */ (0,
|
|
2300
|
-
/* @__PURE__ */ (0,
|
|
2515
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Button, { type: "button", variant: "outline", onClick: onClose, children: "Close" }),
|
|
2516
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Button, { type: "button", disabled: buildError !== null || !columns.length || !shaped.length, onClick: () => void clipboard.copyText(text, `${source.label} copied`), children: "Copy subset" })
|
|
2301
2517
|
] })
|
|
2302
2518
|
] }) });
|
|
2303
2519
|
}
|
|
2304
2520
|
function useCopySubsetVariant() {
|
|
2305
|
-
return (getSource) => ({ id: "copy-subset", label: "Filter & sort before copying\u2026", section: "ai", modal: ({ open, onOpenChange }) => open ? /* @__PURE__ */ (0,
|
|
2521
|
+
return (getSource) => ({ id: "copy-subset", label: "Filter & sort before copying\u2026", section: "ai", modal: ({ open, onOpenChange }) => open ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CopySubsetDialog, { source: getSource(), onClose: () => onOpenChange(false) }) : null });
|
|
2306
2522
|
}
|
|
2307
2523
|
|
|
2308
2524
|
// src/data-table/clipping.ts
|
|
@@ -2504,9 +2720,9 @@ var import_react8 = require("react");
|
|
|
2504
2720
|
// src/command.tsx
|
|
2505
2721
|
var DialogPrimitive2 = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
2506
2722
|
var import_cmdk = require("cmdk");
|
|
2507
|
-
var
|
|
2508
|
-
var
|
|
2509
|
-
var Command =
|
|
2723
|
+
var React12 = __toESM(require("react"), 1);
|
|
2724
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2725
|
+
var Command = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2510
2726
|
import_cmdk.Command,
|
|
2511
2727
|
{
|
|
2512
2728
|
ref,
|
|
@@ -2521,12 +2737,12 @@ Command.displayName = import_cmdk.Command.displayName;
|
|
|
2521
2737
|
var DIALOG_DESKTOP_CLASSES2 = `fixed left-[50%] top-[50%] z-[10000] grid min-w-0 w-full max-w-lg ${CENTERED_DIALOG} gap-4 overflow-x-clip border bg-background p-6 shadow-lg [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full sm:rounded-lg`;
|
|
2522
2738
|
var DIALOG_MOBILE_SHEET_CLASSES2 = "fixed inset-x-0 bottom-0 left-0 right-0 top-auto z-[10000] flex min-w-0 flex-col w-full max-w-full max-h-[90dvh] translate-x-0 translate-y-0 gap-4 overflow-x-clip border-t bg-background p-4 pb-safe shadow-lg [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full rounded-t-2xl rounded-b-none overflow-y-auto overscroll-contain";
|
|
2523
2739
|
var DIALOG_MOBILE_SHEET_OVERRIDE2 = "inset-x-0 bottom-0 left-0 right-0 top-auto translate-x-0 translate-y-0 w-full max-w-full max-h-[90dvh] rounded-b-none rounded-t-2xl overflow-y-auto";
|
|
2524
|
-
var CommandDialogContent =
|
|
2740
|
+
var CommandDialogContent = React12.forwardRef(({ className, children, container, ...props }, ref) => {
|
|
2525
2741
|
const isMobile = useIsMobile();
|
|
2526
2742
|
const isModal = useRadixDialogModal();
|
|
2527
2743
|
const portalContainer = usePortalContainer(container);
|
|
2528
|
-
return /* @__PURE__ */ (0,
|
|
2529
|
-
isModal ? /* @__PURE__ */ (0,
|
|
2744
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DialogPrimitive2.Portal, { container: portalContainer, children: [
|
|
2745
|
+
isModal ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2530
2746
|
DialogPrimitive2.Overlay,
|
|
2531
2747
|
{
|
|
2532
2748
|
className: cn(
|
|
@@ -2535,7 +2751,7 @@ var CommandDialogContent = React11.forwardRef(({ className, children, container,
|
|
|
2535
2751
|
)
|
|
2536
2752
|
}
|
|
2537
2753
|
) : null,
|
|
2538
|
-
/* @__PURE__ */ (0,
|
|
2754
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2539
2755
|
DialogPrimitive2.Content,
|
|
2540
2756
|
{
|
|
2541
2757
|
ref,
|
|
@@ -2551,9 +2767,9 @@ var CommandDialogContent = React11.forwardRef(({ className, children, container,
|
|
|
2551
2767
|
...props,
|
|
2552
2768
|
children: [
|
|
2553
2769
|
children,
|
|
2554
|
-
/* @__PURE__ */ (0,
|
|
2555
|
-
/* @__PURE__ */ (0,
|
|
2556
|
-
/* @__PURE__ */ (0,
|
|
2770
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DialogPrimitive2.Close, { className: "absolute right-2 top-4 flex h-10 w-10 items-center justify-center rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground sm:right-4", children: [
|
|
2771
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(XIcon, { className: "h-4 w-4" }),
|
|
2772
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "sr-only", children: "Close" })
|
|
2557
2773
|
] })
|
|
2558
2774
|
]
|
|
2559
2775
|
}
|
|
@@ -2561,9 +2777,9 @@ var CommandDialogContent = React11.forwardRef(({ className, children, container,
|
|
|
2561
2777
|
] });
|
|
2562
2778
|
});
|
|
2563
2779
|
CommandDialogContent.displayName = "CommandDialogContent";
|
|
2564
|
-
var CommandInput =
|
|
2565
|
-
/* @__PURE__ */ (0,
|
|
2566
|
-
/* @__PURE__ */ (0,
|
|
2780
|
+
var CommandInput = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: [
|
|
2781
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(MagnifyingGlassIcon, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
2782
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2567
2783
|
import_cmdk.Command.Input,
|
|
2568
2784
|
{
|
|
2569
2785
|
ref,
|
|
@@ -2576,7 +2792,7 @@ var CommandInput = React11.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
2576
2792
|
)
|
|
2577
2793
|
] }));
|
|
2578
2794
|
CommandInput.displayName = import_cmdk.Command.Input.displayName;
|
|
2579
|
-
var CommandList =
|
|
2795
|
+
var CommandList = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2580
2796
|
import_cmdk.Command.List,
|
|
2581
2797
|
{
|
|
2582
2798
|
ref,
|
|
@@ -2585,7 +2801,7 @@ var CommandList = React11.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
2585
2801
|
}
|
|
2586
2802
|
));
|
|
2587
2803
|
CommandList.displayName = import_cmdk.Command.List.displayName;
|
|
2588
|
-
var CommandEmpty =
|
|
2804
|
+
var CommandEmpty = React12.forwardRef((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2589
2805
|
import_cmdk.Command.Empty,
|
|
2590
2806
|
{
|
|
2591
2807
|
ref,
|
|
@@ -2594,7 +2810,7 @@ var CommandEmpty = React11.forwardRef((props, ref) => /* @__PURE__ */ (0, import
|
|
|
2594
2810
|
}
|
|
2595
2811
|
));
|
|
2596
2812
|
CommandEmpty.displayName = import_cmdk.Command.Empty.displayName;
|
|
2597
|
-
var CommandGroup =
|
|
2813
|
+
var CommandGroup = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2598
2814
|
import_cmdk.Command.Group,
|
|
2599
2815
|
{
|
|
2600
2816
|
ref,
|
|
@@ -2606,7 +2822,7 @@ var CommandGroup = React11.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
2606
2822
|
}
|
|
2607
2823
|
));
|
|
2608
2824
|
CommandGroup.displayName = import_cmdk.Command.Group.displayName;
|
|
2609
|
-
var CommandSeparator =
|
|
2825
|
+
var CommandSeparator = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2610
2826
|
import_cmdk.Command.Separator,
|
|
2611
2827
|
{
|
|
2612
2828
|
ref,
|
|
@@ -2615,7 +2831,7 @@ var CommandSeparator = React11.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
2615
2831
|
}
|
|
2616
2832
|
));
|
|
2617
2833
|
CommandSeparator.displayName = import_cmdk.Command.Separator.displayName;
|
|
2618
|
-
var CommandItem =
|
|
2834
|
+
var CommandItem = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2619
2835
|
import_cmdk.Command.Item,
|
|
2620
2836
|
{
|
|
2621
2837
|
ref,
|
|
@@ -2631,7 +2847,7 @@ var CommandShortcut = ({
|
|
|
2631
2847
|
className,
|
|
2632
2848
|
...props
|
|
2633
2849
|
}) => {
|
|
2634
|
-
return /* @__PURE__ */ (0,
|
|
2850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2635
2851
|
"span",
|
|
2636
2852
|
{
|
|
2637
2853
|
className: cn(
|
|
@@ -2646,7 +2862,7 @@ CommandShortcut.displayName = "CommandShortcut";
|
|
|
2646
2862
|
|
|
2647
2863
|
// src/data-table/ColumnHeaderCell.tsx
|
|
2648
2864
|
init_filter_engine();
|
|
2649
|
-
var
|
|
2865
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2650
2866
|
function ColumnHeaderCell({
|
|
2651
2867
|
label,
|
|
2652
2868
|
labelText,
|
|
@@ -2695,7 +2911,7 @@ function ColumnHeaderCell({
|
|
|
2695
2911
|
else onFilterChange(next);
|
|
2696
2912
|
};
|
|
2697
2913
|
const menuLabel = labelText ? `Sort or filter ${labelText}` : "Sort or filter column";
|
|
2698
|
-
const menuContent = /* @__PURE__ */ (0,
|
|
2914
|
+
const menuContent = /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2699
2915
|
PopoverContent,
|
|
2700
2916
|
{
|
|
2701
2917
|
align: "start",
|
|
@@ -2712,9 +2928,9 @@ function ColumnHeaderCell({
|
|
|
2712
2928
|
input.focus();
|
|
2713
2929
|
},
|
|
2714
2930
|
children: [
|
|
2715
|
-
sortable ? /* @__PURE__ */ (0,
|
|
2716
|
-
/* @__PURE__ */ (0,
|
|
2717
|
-
/* @__PURE__ */ (0,
|
|
2931
|
+
sortable ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
2932
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col gap-0.5 pb-2", children: [
|
|
2933
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2718
2934
|
Button,
|
|
2719
2935
|
{
|
|
2720
2936
|
variant: isSorted && sortDirection === "asc" ? "secondary" : "ghost",
|
|
@@ -2722,12 +2938,12 @@ function ColumnHeaderCell({
|
|
|
2722
2938
|
className: "h-8 justify-start gap-2 px-2 text-xs font-normal",
|
|
2723
2939
|
onClick: onSortAsc,
|
|
2724
2940
|
children: [
|
|
2725
|
-
/* @__PURE__ */ (0,
|
|
2941
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ArrowUp, { className: "h-3.5 w-3.5" }),
|
|
2726
2942
|
"Sort ascending"
|
|
2727
2943
|
]
|
|
2728
2944
|
}
|
|
2729
2945
|
),
|
|
2730
|
-
/* @__PURE__ */ (0,
|
|
2946
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2731
2947
|
Button,
|
|
2732
2948
|
{
|
|
2733
2949
|
variant: isSorted && sortDirection === "desc" ? "secondary" : "ghost",
|
|
@@ -2735,12 +2951,12 @@ function ColumnHeaderCell({
|
|
|
2735
2951
|
className: "h-8 justify-start gap-2 px-2 text-xs font-normal",
|
|
2736
2952
|
onClick: onSortDesc,
|
|
2737
2953
|
children: [
|
|
2738
|
-
/* @__PURE__ */ (0,
|
|
2954
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ArrowDown, { className: "h-3.5 w-3.5" }),
|
|
2739
2955
|
"Sort descending"
|
|
2740
2956
|
]
|
|
2741
2957
|
}
|
|
2742
2958
|
),
|
|
2743
|
-
isSorted ? /* @__PURE__ */ (0,
|
|
2959
|
+
isSorted ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2744
2960
|
Button,
|
|
2745
2961
|
{
|
|
2746
2962
|
variant: "ghost",
|
|
@@ -2748,15 +2964,15 @@ function ColumnHeaderCell({
|
|
|
2748
2964
|
className: "h-8 justify-start gap-2 px-2 text-xs font-normal text-muted-foreground",
|
|
2749
2965
|
onClick: onClearSort,
|
|
2750
2966
|
children: [
|
|
2751
|
-
/* @__PURE__ */ (0,
|
|
2967
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ListX, { className: "h-3.5 w-3.5" }),
|
|
2752
2968
|
"Clear sort"
|
|
2753
2969
|
]
|
|
2754
2970
|
}
|
|
2755
2971
|
) : null
|
|
2756
2972
|
] }),
|
|
2757
|
-
filterKind ? /* @__PURE__ */ (0,
|
|
2973
|
+
filterKind ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "mb-2 h-px bg-border" }) : null
|
|
2758
2974
|
] }) : null,
|
|
2759
|
-
filterKind ? /* @__PURE__ */ (0,
|
|
2975
|
+
filterKind ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2760
2976
|
FilterBody,
|
|
2761
2977
|
{
|
|
2762
2978
|
kind: filterKind,
|
|
@@ -2771,10 +2987,10 @@ function ColumnHeaderCell({
|
|
|
2771
2987
|
allowNullModes
|
|
2772
2988
|
}
|
|
2773
2989
|
) : null,
|
|
2774
|
-
filterKind && visibleFilter && allowNegation ? /* @__PURE__ */ (0,
|
|
2775
|
-
/* @__PURE__ */ (0,
|
|
2776
|
-
/* @__PURE__ */ (0,
|
|
2777
|
-
/* @__PURE__ */ (0,
|
|
2990
|
+
filterKind && visibleFilter && allowNegation ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "mt-2 border-t border-border pt-2", children: [
|
|
2991
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "mb-1 text-[11px] font-medium uppercase tracking-wider text-muted-foreground", children: "Match mode" }),
|
|
2992
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "grid grid-cols-2 gap-1 rounded-md border p-0.5", children: [
|
|
2993
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2778
2994
|
"button",
|
|
2779
2995
|
{
|
|
2780
2996
|
type: "button",
|
|
@@ -2787,7 +3003,7 @@ function ColumnHeaderCell({
|
|
|
2787
3003
|
children: "Include"
|
|
2788
3004
|
}
|
|
2789
3005
|
),
|
|
2790
|
-
/* @__PURE__ */ (0,
|
|
3006
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2791
3007
|
"button",
|
|
2792
3008
|
{
|
|
2793
3009
|
type: "button",
|
|
@@ -2802,11 +3018,11 @@ function ColumnHeaderCell({
|
|
|
2802
3018
|
)
|
|
2803
3019
|
] })
|
|
2804
3020
|
] }) : null,
|
|
2805
|
-
filterKind && deferredFilter ? /* @__PURE__ */ (0,
|
|
2806
|
-
filterFooterHint ? /* @__PURE__ */ (0,
|
|
2807
|
-
/* @__PURE__ */ (0,
|
|
2808
|
-
filterShowCancel ? /* @__PURE__ */ (0,
|
|
2809
|
-
/* @__PURE__ */ (0,
|
|
3021
|
+
filterKind && deferredFilter ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "mt-2 border-t border-border pt-2", children: [
|
|
3022
|
+
filterFooterHint ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "mb-2 text-xs text-muted-foreground", children: filterFooterHint }) : null,
|
|
3023
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex justify-end gap-2", children: [
|
|
3024
|
+
filterShowCancel ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Button, { type: "button", variant: "ghost", size: "sm", onClick: cancelFilter, children: "Cancel" }) : null,
|
|
3025
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Button, { type: "button", size: "sm", onClick: applyFilter, children: filterApplyLabel ?? "Apply" })
|
|
2810
3026
|
] })
|
|
2811
3027
|
] }) : null
|
|
2812
3028
|
]
|
|
@@ -2814,9 +3030,9 @@ function ColumnHeaderCell({
|
|
|
2814
3030
|
);
|
|
2815
3031
|
if (compact) {
|
|
2816
3032
|
if (!sortable && !filterKind) {
|
|
2817
|
-
return /* @__PURE__ */ (0,
|
|
3033
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: cn("flex items-center justify-center", className), children: label });
|
|
2818
3034
|
}
|
|
2819
|
-
return /* @__PURE__ */ (0,
|
|
3035
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2820
3036
|
"div",
|
|
2821
3037
|
{
|
|
2822
3038
|
className: cn(
|
|
@@ -2824,8 +3040,8 @@ function ColumnHeaderCell({
|
|
|
2824
3040
|
align === "right" ? "justify-end" : "justify-center",
|
|
2825
3041
|
className
|
|
2826
3042
|
),
|
|
2827
|
-
children: /* @__PURE__ */ (0,
|
|
2828
|
-
/* @__PURE__ */ (0,
|
|
3043
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Popover, { open: filterOpen, onOpenChange: setFilterOpen, children: [
|
|
3044
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2829
3045
|
"button",
|
|
2830
3046
|
{
|
|
2831
3047
|
type: "button",
|
|
@@ -2838,8 +3054,8 @@ function ColumnHeaderCell({
|
|
|
2838
3054
|
),
|
|
2839
3055
|
children: [
|
|
2840
3056
|
label,
|
|
2841
|
-
isSorted ? sortDirection === "asc" ? /* @__PURE__ */ (0,
|
|
2842
|
-
filterActive ? /* @__PURE__ */ (0,
|
|
3057
|
+
isSorted ? sortDirection === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ArrowUp, { className: "absolute -top-1 right-0 h-2 w-2 text-primary" }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ArrowDown, { className: "absolute -top-1 right-0 h-2 w-2 text-primary" }) : null,
|
|
3058
|
+
filterActive ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2843
3059
|
"span",
|
|
2844
3060
|
{
|
|
2845
3061
|
"aria-hidden": true,
|
|
@@ -2854,7 +3070,7 @@ function ColumnHeaderCell({
|
|
|
2854
3070
|
}
|
|
2855
3071
|
);
|
|
2856
3072
|
}
|
|
2857
|
-
return /* @__PURE__ */ (0,
|
|
3073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2858
3074
|
"div",
|
|
2859
3075
|
{
|
|
2860
3076
|
className: cn(
|
|
@@ -2864,7 +3080,7 @@ function ColumnHeaderCell({
|
|
|
2864
3080
|
className
|
|
2865
3081
|
),
|
|
2866
3082
|
children: [
|
|
2867
|
-
sortable ? /* @__PURE__ */ (0,
|
|
3083
|
+
sortable ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2868
3084
|
"button",
|
|
2869
3085
|
{
|
|
2870
3086
|
type: "button",
|
|
@@ -2874,14 +3090,14 @@ function ColumnHeaderCell({
|
|
|
2874
3090
|
isSorted ? "text-foreground" : "text-muted-foreground hover:text-foreground"
|
|
2875
3091
|
),
|
|
2876
3092
|
children: [
|
|
2877
|
-
/* @__PURE__ */ (0,
|
|
2878
|
-
isSorted ? sortDirection === "asc" ? /* @__PURE__ */ (0,
|
|
3093
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "truncate", children: label }),
|
|
3094
|
+
isSorted ? sortDirection === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ArrowUp, { className: "h-3 w-3 shrink-0 text-primary" }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ArrowDown, { className: "h-3 w-3 shrink-0 text-primary" }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ArrowUpDown, { className: "h-3 w-3 shrink-0 opacity-40" })
|
|
2879
3095
|
]
|
|
2880
3096
|
}
|
|
2881
|
-
) : /* @__PURE__ */ (0,
|
|
2882
|
-
filterKind ? /* @__PURE__ */ (0,
|
|
2883
|
-
/* @__PURE__ */ (0,
|
|
2884
|
-
/* @__PURE__ */ (0,
|
|
3097
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "truncate text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: label }),
|
|
3098
|
+
filterKind ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "inline-flex items-center", children: [
|
|
3099
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Popover, { open: filterOpen, onOpenChange: setFilterOpen, children: [
|
|
3100
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2885
3101
|
"button",
|
|
2886
3102
|
{
|
|
2887
3103
|
type: "button",
|
|
@@ -2892,7 +3108,7 @@ function ColumnHeaderCell({
|
|
|
2892
3108
|
"rounded p-0.5 transition-colors",
|
|
2893
3109
|
filterActive ? "text-primary hover:text-primary/80" : "text-muted-foreground/40 hover:text-muted-foreground"
|
|
2894
3110
|
),
|
|
2895
|
-
children: /* @__PURE__ */ (0,
|
|
3111
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2896
3112
|
ListFilter,
|
|
2897
3113
|
{
|
|
2898
3114
|
className: cn("h-3 w-3", filterActive && "fill-primary/20")
|
|
@@ -2902,7 +3118,7 @@ function ColumnHeaderCell({
|
|
|
2902
3118
|
) }),
|
|
2903
3119
|
menuContent
|
|
2904
3120
|
] }),
|
|
2905
|
-
filterActive ? /* @__PURE__ */ (0,
|
|
3121
|
+
filterActive ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2906
3122
|
"button",
|
|
2907
3123
|
{
|
|
2908
3124
|
type: "button",
|
|
@@ -2913,7 +3129,7 @@ function ColumnHeaderCell({
|
|
|
2913
3129
|
onFilterChange(void 0);
|
|
2914
3130
|
},
|
|
2915
3131
|
className: "rounded p-0.5 text-primary hover:bg-muted hover:text-foreground",
|
|
2916
|
-
children: /* @__PURE__ */ (0,
|
|
3132
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(X, { className: "h-3 w-3" })
|
|
2917
3133
|
}
|
|
2918
3134
|
) : null
|
|
2919
3135
|
] }) : null
|
|
@@ -2939,14 +3155,14 @@ function FilterBody({
|
|
|
2939
3155
|
onChange({ kind: "text", value: "", mode: next });
|
|
2940
3156
|
}
|
|
2941
3157
|
};
|
|
2942
|
-
return /* @__PURE__ */ (0,
|
|
2943
|
-
/* @__PURE__ */ (0,
|
|
2944
|
-
/* @__PURE__ */ (0,
|
|
3158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "space-y-1.5 px-1", children: [
|
|
3159
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] font-medium uppercase tracking-wider text-muted-foreground", children: "Filter" }),
|
|
3160
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex gap-1", children: [
|
|
2945
3161
|
["contains", "Contains"],
|
|
2946
3162
|
["empty", "(empty)"],
|
|
2947
3163
|
["not_empty", "(not empty)"],
|
|
2948
3164
|
...allowNullModes ? [["null", "(null)"], ["not_null", "(not null)"]] : []
|
|
2949
|
-
].map(([m, label]) => /* @__PURE__ */ (0,
|
|
3165
|
+
].map(([m, label]) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2950
3166
|
"button",
|
|
2951
3167
|
{
|
|
2952
3168
|
type: "button",
|
|
@@ -2960,8 +3176,8 @@ function FilterBody({
|
|
|
2960
3176
|
},
|
|
2961
3177
|
m
|
|
2962
3178
|
)) }),
|
|
2963
|
-
mode === "contains" && /* @__PURE__ */ (0,
|
|
2964
|
-
/* @__PURE__ */ (0,
|
|
3179
|
+
mode === "contains" && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "relative", children: [
|
|
3180
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2965
3181
|
Input,
|
|
2966
3182
|
{
|
|
2967
3183
|
"data-matrx-filter-autofocus": true,
|
|
@@ -2974,14 +3190,14 @@ function FilterBody({
|
|
|
2974
3190
|
style: { fontSize: "16px" }
|
|
2975
3191
|
}
|
|
2976
3192
|
),
|
|
2977
|
-
text ? /* @__PURE__ */ (0,
|
|
3193
|
+
text ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2978
3194
|
"button",
|
|
2979
3195
|
{
|
|
2980
3196
|
type: "button",
|
|
2981
3197
|
"aria-label": "Clear filter text",
|
|
2982
3198
|
className: "absolute right-1.5 top-1/2 -translate-y-1/2 rounded p-0.5 text-muted-foreground hover:text-foreground",
|
|
2983
3199
|
onClick: () => onChange(void 0),
|
|
2984
|
-
children: /* @__PURE__ */ (0,
|
|
3200
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(X, { className: "h-3.5 w-3.5" })
|
|
2985
3201
|
}
|
|
2986
3202
|
) : null
|
|
2987
3203
|
] })
|
|
@@ -2989,7 +3205,7 @@ function FilterBody({
|
|
|
2989
3205
|
}
|
|
2990
3206
|
if (kind === "select") {
|
|
2991
3207
|
const selected = value?.kind === "select" ? value.values ?? (value.value && value.value !== "__all__" ? [value.value] : []) : [];
|
|
2992
|
-
return /* @__PURE__ */ (0,
|
|
3208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2993
3209
|
SearchableSelectFilter,
|
|
2994
3210
|
{
|
|
2995
3211
|
selected,
|
|
@@ -3001,9 +3217,9 @@ function FilterBody({
|
|
|
3001
3217
|
}
|
|
3002
3218
|
if (kind === "boolean") {
|
|
3003
3219
|
const current = value?.kind === "boolean" ? value.value : "__all__";
|
|
3004
|
-
return /* @__PURE__ */ (0,
|
|
3005
|
-
/* @__PURE__ */ (0,
|
|
3006
|
-
/* @__PURE__ */ (0,
|
|
3220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "space-y-1.5 px-1", children: [
|
|
3221
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] font-medium uppercase tracking-wider text-muted-foreground", children: "Filter" }),
|
|
3222
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
3007
3223
|
Select,
|
|
3008
3224
|
{
|
|
3009
3225
|
value: current === "__all__" ? "__all__" : current ? "true" : "false",
|
|
@@ -3012,18 +3228,18 @@ function FilterBody({
|
|
|
3012
3228
|
else onChange({ kind: "boolean", value: v === "true" });
|
|
3013
3229
|
},
|
|
3014
3230
|
children: [
|
|
3015
|
-
/* @__PURE__ */ (0,
|
|
3016
|
-
/* @__PURE__ */ (0,
|
|
3017
|
-
/* @__PURE__ */ (0,
|
|
3018
|
-
/* @__PURE__ */ (0,
|
|
3019
|
-
/* @__PURE__ */ (0,
|
|
3231
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SelectValue, {}) }),
|
|
3232
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(SelectContent, { children: [
|
|
3233
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SelectItem, { value: "__all__", children: "All" }),
|
|
3234
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SelectItem, { value: "true", children: "Yes" }),
|
|
3235
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SelectItem, { value: "false", children: "No" })
|
|
3020
3236
|
] })
|
|
3021
3237
|
]
|
|
3022
3238
|
}
|
|
3023
3239
|
)
|
|
3024
3240
|
] });
|
|
3025
3241
|
}
|
|
3026
|
-
return /* @__PURE__ */ (0,
|
|
3242
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(NumberFilterBody, { value, onChange });
|
|
3027
3243
|
}
|
|
3028
3244
|
function SearchableSelectFilter({
|
|
3029
3245
|
selected,
|
|
@@ -3051,13 +3267,13 @@ function SearchableSelectFilter({
|
|
|
3051
3267
|
next.length === 0 ? void 0 : { kind: "select", value: next[0] ?? "", values: next }
|
|
3052
3268
|
);
|
|
3053
3269
|
};
|
|
3054
|
-
return /* @__PURE__ */ (0,
|
|
3055
|
-
/* @__PURE__ */ (0,
|
|
3056
|
-
/* @__PURE__ */ (0,
|
|
3270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "space-y-1 px-0", children: [
|
|
3271
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center justify-between px-1 pb-1", children: [
|
|
3272
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("p", { className: "text-[11px] font-medium uppercase tracking-wider text-muted-foreground", children: [
|
|
3057
3273
|
"Filter",
|
|
3058
3274
|
selected.length > 1 ? ` (any of ${selected.length})` : ""
|
|
3059
3275
|
] }),
|
|
3060
|
-
selected.length > 0 ? /* @__PURE__ */ (0,
|
|
3276
|
+
selected.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3061
3277
|
"button",
|
|
3062
3278
|
{
|
|
3063
3279
|
type: "button",
|
|
@@ -3067,8 +3283,8 @@ function SearchableSelectFilter({
|
|
|
3067
3283
|
}
|
|
3068
3284
|
) : null
|
|
3069
3285
|
] }),
|
|
3070
|
-
/* @__PURE__ */ (0,
|
|
3071
|
-
/* @__PURE__ */ (0,
|
|
3286
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Command, { className: "rounded-md border border-border", shouldFilter: false, children: [
|
|
3287
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3072
3288
|
CommandInput,
|
|
3073
3289
|
{
|
|
3074
3290
|
"data-matrx-filter-autofocus": true,
|
|
@@ -3078,10 +3294,10 @@ function SearchableSelectFilter({
|
|
|
3078
3294
|
className: "h-8 text-sm"
|
|
3079
3295
|
}
|
|
3080
3296
|
),
|
|
3081
|
-
/* @__PURE__ */ (0,
|
|
3082
|
-
/* @__PURE__ */ (0,
|
|
3083
|
-
/* @__PURE__ */ (0,
|
|
3084
|
-
/* @__PURE__ */ (0,
|
|
3297
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(CommandList, { className: "max-h-48", children: [
|
|
3298
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CommandEmpty, { className: "py-3 text-xs text-muted-foreground", children: "No matches" }),
|
|
3299
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(CommandGroup, { children: [
|
|
3300
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3085
3301
|
CommandItem,
|
|
3086
3302
|
{
|
|
3087
3303
|
value: "__all__",
|
|
@@ -3092,7 +3308,7 @@ function SearchableSelectFilter({
|
|
|
3092
3308
|
),
|
|
3093
3309
|
filtered.map((o) => {
|
|
3094
3310
|
const active = selected.includes(o.value);
|
|
3095
|
-
return /* @__PURE__ */ (0,
|
|
3311
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
3096
3312
|
CommandItem,
|
|
3097
3313
|
{
|
|
3098
3314
|
value: o.value,
|
|
@@ -3102,7 +3318,7 @@ function SearchableSelectFilter({
|
|
|
3102
3318
|
active && "bg-accent text-accent-foreground"
|
|
3103
3319
|
),
|
|
3104
3320
|
children: [
|
|
3105
|
-
/* @__PURE__ */ (0,
|
|
3321
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3106
3322
|
"span",
|
|
3107
3323
|
{
|
|
3108
3324
|
className: cn(
|
|
@@ -3110,7 +3326,7 @@ function SearchableSelectFilter({
|
|
|
3110
3326
|
single ? "rounded-full" : "rounded-sm",
|
|
3111
3327
|
active ? "border-primary bg-primary text-primary-foreground" : "border-muted-foreground/40"
|
|
3112
3328
|
),
|
|
3113
|
-
children: active && /* @__PURE__ */ (0,
|
|
3329
|
+
children: active && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Check, { className: "h-2.5 w-2.5" })
|
|
3114
3330
|
}
|
|
3115
3331
|
),
|
|
3116
3332
|
o.label
|
|
@@ -3141,10 +3357,10 @@ function NumberFilterBody({
|
|
|
3141
3357
|
}
|
|
3142
3358
|
onChange({ kind: "number", min: nextMin, max: nextMax });
|
|
3143
3359
|
};
|
|
3144
|
-
return /* @__PURE__ */ (0,
|
|
3145
|
-
/* @__PURE__ */ (0,
|
|
3146
|
-
/* @__PURE__ */ (0,
|
|
3147
|
-
(min !== void 0 || max !== void 0) && /* @__PURE__ */ (0,
|
|
3360
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "space-y-1.5 px-1", children: [
|
|
3361
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
3362
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] font-medium uppercase tracking-wider text-muted-foreground", children: "Range" }),
|
|
3363
|
+
(min !== void 0 || max !== void 0) && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3148
3364
|
"button",
|
|
3149
3365
|
{
|
|
3150
3366
|
type: "button",
|
|
@@ -3158,8 +3374,8 @@ function NumberFilterBody({
|
|
|
3158
3374
|
}
|
|
3159
3375
|
)
|
|
3160
3376
|
] }),
|
|
3161
|
-
/* @__PURE__ */ (0,
|
|
3162
|
-
/* @__PURE__ */ (0,
|
|
3377
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
3378
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3163
3379
|
Input,
|
|
3164
3380
|
{
|
|
3165
3381
|
"data-matrx-filter-autofocus": true,
|
|
@@ -3174,8 +3390,8 @@ function NumberFilterBody({
|
|
|
3174
3390
|
style: { fontSize: "16px" }
|
|
3175
3391
|
}
|
|
3176
3392
|
),
|
|
3177
|
-
/* @__PURE__ */ (0,
|
|
3178
|
-
/* @__PURE__ */ (0,
|
|
3393
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground", children: "\u2013" }),
|
|
3394
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3179
3395
|
Input,
|
|
3180
3396
|
{
|
|
3181
3397
|
value: maxText,
|
|
@@ -3201,7 +3417,7 @@ function parseOptionalNumber(raw) {
|
|
|
3201
3417
|
// src/data-table/ColumnManager.tsx
|
|
3202
3418
|
var import_react9 = require("react");
|
|
3203
3419
|
init_filter_engine();
|
|
3204
|
-
var
|
|
3420
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3205
3421
|
function ColumnManager({
|
|
3206
3422
|
open,
|
|
3207
3423
|
onOpenChange,
|
|
@@ -3234,18 +3450,18 @@ function ColumnManager({
|
|
|
3234
3450
|
return next;
|
|
3235
3451
|
});
|
|
3236
3452
|
};
|
|
3237
|
-
return /* @__PURE__ */ (0,
|
|
3238
|
-
/* @__PURE__ */ (0,
|
|
3239
|
-
/* @__PURE__ */ (0,
|
|
3240
|
-
/* @__PURE__ */ (0,
|
|
3453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(DialogContent, { className: "max-w-md", children: [
|
|
3454
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(DialogHeader, { children: [
|
|
3455
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DialogTitle, { children: "Columns" }),
|
|
3456
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DialogDescription, { children: "Choose the columns to show and set their order." })
|
|
3241
3457
|
] }),
|
|
3242
|
-
/* @__PURE__ */ (0,
|
|
3458
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "max-h-[55dvh] divide-y overflow-y-auto rounded-md border", children: draftOrder.map((id, index) => {
|
|
3243
3459
|
const column = byId.get(id);
|
|
3244
3460
|
if (!column) return null;
|
|
3245
3461
|
const label = typeof column.header === "string" ? column.header : id;
|
|
3246
3462
|
const hideable = column.hideable !== false;
|
|
3247
3463
|
const visible = !draftHidden.has(id);
|
|
3248
|
-
return /* @__PURE__ */ (0,
|
|
3464
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3249
3465
|
"div",
|
|
3250
3466
|
{
|
|
3251
3467
|
className: cn(
|
|
@@ -3253,8 +3469,8 @@ function ColumnManager({
|
|
|
3253
3469
|
!visible && "bg-muted/30 text-muted-foreground"
|
|
3254
3470
|
),
|
|
3255
3471
|
children: [
|
|
3256
|
-
/* @__PURE__ */ (0,
|
|
3257
|
-
/* @__PURE__ */ (0,
|
|
3472
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GripVertical, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
3473
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3258
3474
|
Checkbox,
|
|
3259
3475
|
{
|
|
3260
3476
|
checked: visible,
|
|
@@ -3271,8 +3487,8 @@ function ColumnManager({
|
|
|
3271
3487
|
}
|
|
3272
3488
|
}
|
|
3273
3489
|
),
|
|
3274
|
-
/* @__PURE__ */ (0,
|
|
3275
|
-
/* @__PURE__ */ (0,
|
|
3490
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "min-w-0 flex-1 truncate text-sm", children: label }),
|
|
3491
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3276
3492
|
Button,
|
|
3277
3493
|
{
|
|
3278
3494
|
type: "button",
|
|
@@ -3282,10 +3498,10 @@ function ColumnManager({
|
|
|
3282
3498
|
"aria-label": `Move ${label} earlier`,
|
|
3283
3499
|
disabled: index === 0,
|
|
3284
3500
|
onClick: () => move(id, -1),
|
|
3285
|
-
children: /* @__PURE__ */ (0,
|
|
3501
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ArrowUp, { className: "h-4 w-4" })
|
|
3286
3502
|
}
|
|
3287
3503
|
),
|
|
3288
|
-
/* @__PURE__ */ (0,
|
|
3504
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3289
3505
|
Button,
|
|
3290
3506
|
{
|
|
3291
3507
|
type: "button",
|
|
@@ -3295,7 +3511,7 @@ function ColumnManager({
|
|
|
3295
3511
|
"aria-label": `Move ${label} later`,
|
|
3296
3512
|
disabled: index === draftOrder.length - 1,
|
|
3297
3513
|
onClick: () => move(id, 1),
|
|
3298
|
-
children: /* @__PURE__ */ (0,
|
|
3514
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ArrowDown, { className: "h-4 w-4" })
|
|
3299
3515
|
}
|
|
3300
3516
|
)
|
|
3301
3517
|
]
|
|
@@ -3303,9 +3519,9 @@ function ColumnManager({
|
|
|
3303
3519
|
id
|
|
3304
3520
|
);
|
|
3305
3521
|
}) }),
|
|
3306
|
-
/* @__PURE__ */ (0,
|
|
3307
|
-
/* @__PURE__ */ (0,
|
|
3308
|
-
/* @__PURE__ */ (0,
|
|
3522
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(DialogFooter, { children: [
|
|
3523
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), children: "Cancel" }),
|
|
3524
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3309
3525
|
Button,
|
|
3310
3526
|
{
|
|
3311
3527
|
type: "button",
|
|
@@ -3325,14 +3541,14 @@ var import_react10 = require("react");
|
|
|
3325
3541
|
|
|
3326
3542
|
// src/tooltip.tsx
|
|
3327
3543
|
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"), 1);
|
|
3328
|
-
var
|
|
3329
|
-
var
|
|
3544
|
+
var React13 = __toESM(require("react"), 1);
|
|
3545
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3330
3546
|
var TooltipProvider = TooltipPrimitive.Provider;
|
|
3331
3547
|
var Tooltip = TooltipPrimitive.Root;
|
|
3332
3548
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
3333
|
-
var TooltipContent =
|
|
3549
|
+
var TooltipContent = React13.forwardRef(({ className, sideOffset = 4, container, animated = true, ...props }, ref) => {
|
|
3334
3550
|
const resolved = usePortalContainer(container);
|
|
3335
|
-
return /* @__PURE__ */ (0,
|
|
3551
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TooltipPrimitive.Portal, { container: resolved ?? null, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3336
3552
|
TooltipPrimitive.Content,
|
|
3337
3553
|
{
|
|
3338
3554
|
ref,
|
|
@@ -3350,7 +3566,7 @@ var TooltipContent = React12.forwardRef(({ className, sideOffset = 4, container,
|
|
|
3350
3566
|
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
3351
3567
|
|
|
3352
3568
|
// src/data-table/MatrxUuidCell.tsx
|
|
3353
|
-
var
|
|
3569
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3354
3570
|
var SHORT_LEN = 8;
|
|
3355
3571
|
function shortUuid(id, len = SHORT_LEN) {
|
|
3356
3572
|
return id.slice(0, len);
|
|
@@ -3400,7 +3616,7 @@ function MatrxUuidCell({
|
|
|
3400
3616
|
[]
|
|
3401
3617
|
);
|
|
3402
3618
|
if (!value) {
|
|
3403
|
-
return /* @__PURE__ */ (0,
|
|
3619
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground/40", children: "\u2014" });
|
|
3404
3620
|
}
|
|
3405
3621
|
const doors = token ? resolveEntityDoors?.(token, value, href) ?? null : null;
|
|
3406
3622
|
const resolvedHref = doors?.href ?? href ?? null;
|
|
@@ -3443,13 +3659,13 @@ function MatrxUuidCell({
|
|
|
3443
3659
|
};
|
|
3444
3660
|
const idNode = (() => {
|
|
3445
3661
|
if (forbidden) {
|
|
3446
|
-
return /* @__PURE__ */ (0,
|
|
3447
|
-
/* @__PURE__ */ (0,
|
|
3448
|
-
/* @__PURE__ */ (0,
|
|
3662
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "inline-flex min-w-0 items-center gap-1 font-mono text-xs text-muted-foreground/70 tabular-nums", children: [
|
|
3663
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "min-w-0 truncate", children: display }),
|
|
3664
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ShieldOff, { className: "h-3 w-3 shrink-0 opacity-60", "aria-hidden": true })
|
|
3449
3665
|
] });
|
|
3450
3666
|
}
|
|
3451
3667
|
if (onOpen) {
|
|
3452
|
-
return /* @__PURE__ */ (0,
|
|
3668
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
3453
3669
|
"button",
|
|
3454
3670
|
{
|
|
3455
3671
|
type: "button",
|
|
@@ -3458,14 +3674,14 @@ function MatrxUuidCell({
|
|
|
3458
3674
|
disabled: opening,
|
|
3459
3675
|
className: "inline-flex min-w-0 items-center gap-1 font-mono text-xs text-sky-600 hover:underline dark:text-sky-400 disabled:opacity-60",
|
|
3460
3676
|
children: [
|
|
3461
|
-
/* @__PURE__ */ (0,
|
|
3462
|
-
/* @__PURE__ */ (0,
|
|
3677
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "min-w-0 truncate tabular-nums", children: display }),
|
|
3678
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(PanelRight, { className: "h-3 w-3 shrink-0 opacity-50" })
|
|
3463
3679
|
]
|
|
3464
3680
|
}
|
|
3465
3681
|
);
|
|
3466
3682
|
}
|
|
3467
3683
|
if (resolvedHref) {
|
|
3468
|
-
return /* @__PURE__ */ (0,
|
|
3684
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
3469
3685
|
"a",
|
|
3470
3686
|
{
|
|
3471
3687
|
href: resolvedHref,
|
|
@@ -3475,15 +3691,15 @@ function MatrxUuidCell({
|
|
|
3475
3691
|
onClick: stop,
|
|
3476
3692
|
className: "inline-flex min-w-0 items-center gap-1 font-mono text-xs text-sky-600 hover:underline dark:text-sky-400",
|
|
3477
3693
|
children: [
|
|
3478
|
-
/* @__PURE__ */ (0,
|
|
3479
|
-
/* @__PURE__ */ (0,
|
|
3694
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "min-w-0 truncate tabular-nums", children: display }),
|
|
3695
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ExternalLink, { className: "h-3 w-3 shrink-0 opacity-50" })
|
|
3480
3696
|
]
|
|
3481
3697
|
}
|
|
3482
3698
|
);
|
|
3483
3699
|
}
|
|
3484
|
-
return /* @__PURE__ */ (0,
|
|
3700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "min-w-0 truncate font-mono text-xs text-muted-foreground tabular-nums select-all", children: display });
|
|
3485
3701
|
})();
|
|
3486
|
-
return /* @__PURE__ */ (0,
|
|
3702
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
3487
3703
|
"span",
|
|
3488
3704
|
{
|
|
3489
3705
|
"data-matrx-cell-control": true,
|
|
@@ -3493,11 +3709,11 @@ function MatrxUuidCell({
|
|
|
3493
3709
|
),
|
|
3494
3710
|
onClick: stop,
|
|
3495
3711
|
children: [
|
|
3496
|
-
/* @__PURE__ */ (0,
|
|
3497
|
-
/* @__PURE__ */ (0,
|
|
3498
|
-
/* @__PURE__ */ (0,
|
|
3712
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Tooltip, { children: [
|
|
3713
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "inline-flex min-w-0 max-w-full items-center", children: idNode }) }),
|
|
3714
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TooltipContent, { side: "top", className: "max-w-sm break-all font-mono", children: forbidden ? `No access \xB7 ${tip}` : tip })
|
|
3499
3715
|
] }) }),
|
|
3500
|
-
/* @__PURE__ */ (0,
|
|
3716
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3501
3717
|
"button",
|
|
3502
3718
|
{
|
|
3503
3719
|
type: "button",
|
|
@@ -3508,10 +3724,10 @@ function MatrxUuidCell({
|
|
|
3508
3724
|
"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none",
|
|
3509
3725
|
copied && "text-primary"
|
|
3510
3726
|
),
|
|
3511
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
3727
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Check, { className: "h-3 w-3" }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Copy, { className: "h-3 w-3" })
|
|
3512
3728
|
}
|
|
3513
3729
|
),
|
|
3514
|
-
canPeek ? /* @__PURE__ */ (0,
|
|
3730
|
+
canPeek ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3515
3731
|
"button",
|
|
3516
3732
|
{
|
|
3517
3733
|
type: "button",
|
|
@@ -3522,10 +3738,10 @@ function MatrxUuidCell({
|
|
|
3522
3738
|
"aria-label": `Quick look at ${label ?? "record"}`,
|
|
3523
3739
|
title: `Quick look at ${label ?? "record"}`,
|
|
3524
3740
|
className: "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none",
|
|
3525
|
-
children: /* @__PURE__ */ (0,
|
|
3741
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Lightbulb, { className: "h-3 w-3" })
|
|
3526
3742
|
}
|
|
3527
3743
|
) : null,
|
|
3528
|
-
onOpen && resolvedHref && !forbidden ? /* @__PURE__ */ (0,
|
|
3744
|
+
onOpen && resolvedHref && !forbidden ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3529
3745
|
"a",
|
|
3530
3746
|
{
|
|
3531
3747
|
href: resolvedHref,
|
|
@@ -3535,12 +3751,12 @@ function MatrxUuidCell({
|
|
|
3535
3751
|
"aria-label": `Open ${label ?? "record"} in a new tab`,
|
|
3536
3752
|
title: `Open ${label ?? "record"} in a new tab`,
|
|
3537
3753
|
className: "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none",
|
|
3538
|
-
children: /* @__PURE__ */ (0,
|
|
3754
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ExternalLink, { className: "h-3 w-3" })
|
|
3539
3755
|
}
|
|
3540
3756
|
) : null,
|
|
3541
3757
|
trailing,
|
|
3542
3758
|
notice,
|
|
3543
|
-
canPeek && peekOpen && ResourcePeek ? /* @__PURE__ */ (0,
|
|
3759
|
+
canPeek && peekOpen && ResourcePeek ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3544
3760
|
ResourcePeek,
|
|
3545
3761
|
{
|
|
3546
3762
|
kind: doors?.peekKind ?? token ?? "record",
|
|
@@ -3563,7 +3779,7 @@ function tokenFromColumnName(name) {
|
|
|
3563
3779
|
}
|
|
3564
3780
|
|
|
3565
3781
|
// src/data-table/DataRowInspector.tsx
|
|
3566
|
-
var
|
|
3782
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3567
3783
|
var noFieldToken = () => null;
|
|
3568
3784
|
function formatValue(value) {
|
|
3569
3785
|
if (value == null) return "\u2014";
|
|
@@ -3592,7 +3808,7 @@ function DataRowInspector({
|
|
|
3592
3808
|
tokenForField = noFieldToken
|
|
3593
3809
|
}) {
|
|
3594
3810
|
const entries = isPlainObject(row) ? Object.entries(row) : [["value", row]];
|
|
3595
|
-
const fieldButtons = (key, value) => fieldCopy ? /* @__PURE__ */ (0,
|
|
3811
|
+
const fieldButtons = (key, value) => fieldCopy ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "absolute right-1 top-1 opacity-0 transition-opacity focus-within:opacity-100 group-hover/field:opacity-100", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3596
3812
|
CopyButtons,
|
|
3597
3813
|
{
|
|
3598
3814
|
size: "xs",
|
|
@@ -3607,21 +3823,21 @@ function DataRowInspector({
|
|
|
3607
3823
|
})
|
|
3608
3824
|
}
|
|
3609
3825
|
) }) : null;
|
|
3610
|
-
return /* @__PURE__ */ (0,
|
|
3826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
3611
3827
|
"div",
|
|
3612
3828
|
{
|
|
3613
3829
|
className: cn("flex h-full min-h-0 flex-col overflow-hidden", className),
|
|
3614
3830
|
children: [
|
|
3615
|
-
title ? /* @__PURE__ */ (0,
|
|
3616
|
-
/* @__PURE__ */ (0,
|
|
3831
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "shrink-0 border-b border-border px-3 py-2 text-sm font-medium", children: title }) : null,
|
|
3832
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "min-h-0 flex-1 overflow-auto p-3", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("dl", { className: "space-y-2", children: entries.map(([key, value]) => {
|
|
3617
3833
|
if (isUuidValue(value)) {
|
|
3618
|
-
return /* @__PURE__ */ (0,
|
|
3834
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
3619
3835
|
"div",
|
|
3620
3836
|
{
|
|
3621
3837
|
className: "group/field relative grid grid-cols-[minmax(7rem,9rem)_1fr] gap-2 rounded-md border border-border/60 bg-muted/20 px-2.5 py-2",
|
|
3622
3838
|
children: [
|
|
3623
|
-
/* @__PURE__ */ (0,
|
|
3624
|
-
/* @__PURE__ */ (0,
|
|
3839
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("dt", { className: "truncate text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: key }),
|
|
3840
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("dd", { className: "min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3625
3841
|
MatrxUuidCell,
|
|
3626
3842
|
{
|
|
3627
3843
|
value,
|
|
@@ -3636,13 +3852,13 @@ function DataRowInspector({
|
|
|
3636
3852
|
}
|
|
3637
3853
|
const formatted = formatValue(value);
|
|
3638
3854
|
const multiline = formatted.includes("\n") || formatted.length > 80;
|
|
3639
|
-
return /* @__PURE__ */ (0,
|
|
3855
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
3640
3856
|
"div",
|
|
3641
3857
|
{
|
|
3642
3858
|
className: "group/field relative grid grid-cols-[minmax(7rem,9rem)_1fr] gap-2 rounded-md border border-border/60 bg-muted/20 py-2 pl-2.5 pr-12",
|
|
3643
3859
|
children: [
|
|
3644
|
-
/* @__PURE__ */ (0,
|
|
3645
|
-
/* @__PURE__ */ (0,
|
|
3860
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("dt", { className: "truncate text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: key }),
|
|
3861
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3646
3862
|
"dd",
|
|
3647
3863
|
{
|
|
3648
3864
|
className: cn(
|
|
@@ -3665,7 +3881,7 @@ function DataRowInspector({
|
|
|
3665
3881
|
|
|
3666
3882
|
// src/data-table/DataRowWindow.tsx
|
|
3667
3883
|
var import_react11 = require("react");
|
|
3668
|
-
var
|
|
3884
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3669
3885
|
function DataRowWindow({
|
|
3670
3886
|
isOpen,
|
|
3671
3887
|
onClose,
|
|
@@ -3691,9 +3907,9 @@ function DataRowWindow({
|
|
|
3691
3907
|
setTab(defaultTab ?? (hasEdit ? "edit" : "view"));
|
|
3692
3908
|
}, [isOpen, windowId, hasEdit, defaultTab]);
|
|
3693
3909
|
if (!isOpen) return null;
|
|
3694
|
-
const viewBody = viewContent ?? /* @__PURE__ */ (0,
|
|
3695
|
-
const body = children ?? /* @__PURE__ */ (0,
|
|
3696
|
-
return /* @__PURE__ */ (0,
|
|
3910
|
+
const viewBody = viewContent ?? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DataRowInspector, { row });
|
|
3911
|
+
const body = children ?? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex h-full min-h-0 flex-1 flex-col overflow-hidden", children: hasTabs ? tab === "edit" ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "min-h-0 flex-1 overflow-y-auto", children: editContent }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "min-h-0 flex-1 overflow-y-auto", children: viewBody }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "min-h-0 flex-1 overflow-y-auto", children: viewBody }) });
|
|
3912
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3697
3913
|
WindowPanel,
|
|
3698
3914
|
{
|
|
3699
3915
|
id: windowId,
|
|
@@ -3707,26 +3923,26 @@ function DataRowWindow({
|
|
|
3707
3923
|
bodyClassName: "flex min-h-0 flex-1 flex-col overflow-hidden p-0",
|
|
3708
3924
|
sidebarDefaultSize: 140,
|
|
3709
3925
|
sidebarMinSize: 110,
|
|
3710
|
-
sidebar: hasTabs ? /* @__PURE__ */ (0,
|
|
3926
|
+
sidebar: hasTabs ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
3711
3927
|
"nav",
|
|
3712
3928
|
{
|
|
3713
3929
|
"aria-label": "Row window tabs",
|
|
3714
3930
|
className: "flex h-full flex-col gap-0.5 overflow-y-auto p-1.5",
|
|
3715
3931
|
children: [
|
|
3716
|
-
/* @__PURE__ */ (0,
|
|
3932
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3717
3933
|
TabButton,
|
|
3718
3934
|
{
|
|
3719
3935
|
active: tab === "view",
|
|
3720
|
-
icon: /* @__PURE__ */ (0,
|
|
3936
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Eye, { className: "h-4 w-4 shrink-0" }),
|
|
3721
3937
|
label: "View",
|
|
3722
3938
|
onClick: () => setTab("view")
|
|
3723
3939
|
}
|
|
3724
3940
|
),
|
|
3725
|
-
/* @__PURE__ */ (0,
|
|
3941
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3726
3942
|
TabButton,
|
|
3727
3943
|
{
|
|
3728
3944
|
active: tab === "edit",
|
|
3729
|
-
icon: /* @__PURE__ */ (0,
|
|
3945
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Pencil, { className: "h-4 w-4 shrink-0" }),
|
|
3730
3946
|
label: "Edit",
|
|
3731
3947
|
onClick: () => setTab("edit")
|
|
3732
3948
|
}
|
|
@@ -3744,7 +3960,7 @@ function TabButton({
|
|
|
3744
3960
|
label,
|
|
3745
3961
|
onClick
|
|
3746
3962
|
}) {
|
|
3747
|
-
return /* @__PURE__ */ (0,
|
|
3963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
3748
3964
|
"button",
|
|
3749
3965
|
{
|
|
3750
3966
|
type: "button",
|
|
@@ -3757,14 +3973,14 @@ function TabButton({
|
|
|
3757
3973
|
),
|
|
3758
3974
|
children: [
|
|
3759
3975
|
icon,
|
|
3760
|
-
/* @__PURE__ */ (0,
|
|
3976
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "min-w-0 flex-1 truncate", children: label })
|
|
3761
3977
|
]
|
|
3762
3978
|
}
|
|
3763
3979
|
);
|
|
3764
3980
|
}
|
|
3765
3981
|
|
|
3766
3982
|
// src/data-table/DirtySavePill.tsx
|
|
3767
|
-
var
|
|
3983
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3768
3984
|
function DirtySavePill({
|
|
3769
3985
|
changeCount,
|
|
3770
3986
|
saving,
|
|
@@ -3773,20 +3989,20 @@ function DirtySavePill({
|
|
|
3773
3989
|
className
|
|
3774
3990
|
}) {
|
|
3775
3991
|
if (changeCount <= 0) return null;
|
|
3776
|
-
return /* @__PURE__ */ (0,
|
|
3992
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3777
3993
|
"div",
|
|
3778
3994
|
{
|
|
3779
3995
|
className: cn(
|
|
3780
3996
|
"pointer-events-none fixed inset-x-0 bottom-6 z-50 flex justify-center pb-safe",
|
|
3781
3997
|
className
|
|
3782
3998
|
),
|
|
3783
|
-
children: /* @__PURE__ */ (0,
|
|
3784
|
-
/* @__PURE__ */ (0,
|
|
3999
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "pointer-events-auto flex items-center gap-2 rounded-full border border-border bg-card px-3 py-1.5 shadow-lg elevation-2", children: [
|
|
4000
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "px-1 text-xs font-medium text-muted-foreground", children: [
|
|
3785
4001
|
changeCount,
|
|
3786
4002
|
" unsaved change",
|
|
3787
4003
|
changeCount === 1 ? "" : "s"
|
|
3788
4004
|
] }),
|
|
3789
|
-
/* @__PURE__ */ (0,
|
|
4005
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
3790
4006
|
Button,
|
|
3791
4007
|
{
|
|
3792
4008
|
type: "button",
|
|
@@ -3796,12 +4012,12 @@ function DirtySavePill({
|
|
|
3796
4012
|
disabled: saving,
|
|
3797
4013
|
onClick: onCancel,
|
|
3798
4014
|
children: [
|
|
3799
|
-
/* @__PURE__ */ (0,
|
|
4015
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(X, { className: "h-3.5 w-3.5" }),
|
|
3800
4016
|
"Cancel"
|
|
3801
4017
|
]
|
|
3802
4018
|
}
|
|
3803
4019
|
),
|
|
3804
|
-
/* @__PURE__ */ (0,
|
|
4020
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
3805
4021
|
Button,
|
|
3806
4022
|
{
|
|
3807
4023
|
type: "button",
|
|
@@ -3810,7 +4026,7 @@ function DirtySavePill({
|
|
|
3810
4026
|
disabled: saving,
|
|
3811
4027
|
onClick: onSave,
|
|
3812
4028
|
children: [
|
|
3813
|
-
saving ? /* @__PURE__ */ (0,
|
|
4029
|
+
saving ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Loader2, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Save, { className: "h-3.5 w-3.5" }),
|
|
3814
4030
|
"Save"
|
|
3815
4031
|
]
|
|
3816
4032
|
}
|
|
@@ -3823,7 +4039,7 @@ function DirtySavePill({
|
|
|
3823
4039
|
// src/data-table/EditableTableCell.tsx
|
|
3824
4040
|
var import_react12 = require("react");
|
|
3825
4041
|
init_filter_engine();
|
|
3826
|
-
var
|
|
4042
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3827
4043
|
function CellEditShell({
|
|
3828
4044
|
href,
|
|
3829
4045
|
display,
|
|
@@ -3832,8 +4048,8 @@ function CellEditShell({
|
|
|
3832
4048
|
editButton
|
|
3833
4049
|
}) {
|
|
3834
4050
|
const { Link: HostLink } = useMatrxDataTableHost();
|
|
3835
|
-
const Link = HostLink ?? ((props) => /* @__PURE__ */ (0,
|
|
3836
|
-
return /* @__PURE__ */ (0,
|
|
4051
|
+
const Link = HostLink ?? ((props) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("a", { ...props }));
|
|
4052
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
3837
4053
|
"span",
|
|
3838
4054
|
{
|
|
3839
4055
|
className: cn(
|
|
@@ -3845,7 +4061,7 @@ function CellEditShell({
|
|
|
3845
4061
|
className
|
|
3846
4062
|
),
|
|
3847
4063
|
children: [
|
|
3848
|
-
href ? /* @__PURE__ */ (0,
|
|
4064
|
+
href ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3849
4065
|
Link,
|
|
3850
4066
|
{
|
|
3851
4067
|
href,
|
|
@@ -3853,7 +4069,7 @@ function CellEditShell({
|
|
|
3853
4069
|
className: "min-w-0 flex-1 overflow-hidden truncate rounded outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
3854
4070
|
children: display
|
|
3855
4071
|
}
|
|
3856
|
-
) : /* @__PURE__ */ (0,
|
|
4072
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "block min-w-0 flex-1 overflow-hidden", children: display }),
|
|
3857
4073
|
editButton
|
|
3858
4074
|
]
|
|
3859
4075
|
}
|
|
@@ -3874,7 +4090,7 @@ function EditableTableCell({
|
|
|
3874
4090
|
const [open, setOpen] = (0, import_react12.useState)(false);
|
|
3875
4091
|
const usePencil = Boolean(href) || editTrigger === "pencil";
|
|
3876
4092
|
if (editType === "string") {
|
|
3877
|
-
return /* @__PURE__ */ (0,
|
|
4093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3878
4094
|
InlineStringEditor,
|
|
3879
4095
|
{
|
|
3880
4096
|
value: stringifyCellValue(value),
|
|
@@ -3887,15 +4103,15 @@ function EditableTableCell({
|
|
|
3887
4103
|
}
|
|
3888
4104
|
);
|
|
3889
4105
|
}
|
|
3890
|
-
return /* @__PURE__ */ (0,
|
|
3891
|
-
usePencil ? /* @__PURE__ */ (0,
|
|
4106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Popover, { open, onOpenChange: setOpen, children: [
|
|
4107
|
+
usePencil ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3892
4108
|
CellEditShell,
|
|
3893
4109
|
{
|
|
3894
4110
|
...href === void 0 ? {} : { href },
|
|
3895
4111
|
display,
|
|
3896
4112
|
...dirty === void 0 ? {} : { dirty },
|
|
3897
4113
|
...className === void 0 ? {} : { className },
|
|
3898
|
-
editButton: /* @__PURE__ */ (0,
|
|
4114
|
+
editButton: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3899
4115
|
"button",
|
|
3900
4116
|
{
|
|
3901
4117
|
type: "button",
|
|
@@ -3903,11 +4119,11 @@ function EditableTableCell({
|
|
|
3903
4119
|
title: "Edit",
|
|
3904
4120
|
onClick: (e) => e.stopPropagation(),
|
|
3905
4121
|
className: CELL_PENCIL_CLASS,
|
|
3906
|
-
children: /* @__PURE__ */ (0,
|
|
4122
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Pencil, { className: "h-3 w-3" })
|
|
3907
4123
|
}
|
|
3908
4124
|
) })
|
|
3909
4125
|
}
|
|
3910
|
-
) : /* @__PURE__ */ (0,
|
|
4126
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
3911
4127
|
"button",
|
|
3912
4128
|
{
|
|
3913
4129
|
type: "button",
|
|
@@ -3919,18 +4135,18 @@ function EditableTableCell({
|
|
|
3919
4135
|
),
|
|
3920
4136
|
title: "Edit",
|
|
3921
4137
|
children: [
|
|
3922
|
-
/* @__PURE__ */ (0,
|
|
3923
|
-
editType === "select" ? /* @__PURE__ */ (0,
|
|
4138
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "min-w-0 flex-1 overflow-hidden", children: display }),
|
|
4139
|
+
editType === "select" ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronDown, { className: "h-3 w-3 shrink-0 text-muted-foreground/70 transition-colors group-hover/cell-select:text-foreground" }) : null
|
|
3924
4140
|
]
|
|
3925
4141
|
}
|
|
3926
4142
|
) }),
|
|
3927
|
-
/* @__PURE__ */ (0,
|
|
4143
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3928
4144
|
PopoverContent,
|
|
3929
4145
|
{
|
|
3930
4146
|
align: "start",
|
|
3931
4147
|
className: "w-56 p-2",
|
|
3932
4148
|
onClick: (e) => e.stopPropagation(),
|
|
3933
|
-
children: /* @__PURE__ */ (0,
|
|
4149
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3934
4150
|
TypedEditor,
|
|
3935
4151
|
{
|
|
3936
4152
|
editType,
|
|
@@ -3960,14 +4176,14 @@ function InlineStringEditor({
|
|
|
3960
4176
|
const [draft, setDraft] = (0, import_react12.useState)(value);
|
|
3961
4177
|
if (!editing) {
|
|
3962
4178
|
if (usePencil) {
|
|
3963
|
-
return /* @__PURE__ */ (0,
|
|
4179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3964
4180
|
CellEditShell,
|
|
3965
4181
|
{
|
|
3966
4182
|
...href === void 0 ? {} : { href },
|
|
3967
4183
|
display,
|
|
3968
4184
|
...dirty === void 0 ? {} : { dirty },
|
|
3969
4185
|
...className === void 0 ? {} : { className },
|
|
3970
|
-
editButton: /* @__PURE__ */ (0,
|
|
4186
|
+
editButton: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3971
4187
|
"button",
|
|
3972
4188
|
{
|
|
3973
4189
|
type: "button",
|
|
@@ -3979,13 +4195,13 @@ function InlineStringEditor({
|
|
|
3979
4195
|
setEditing(true);
|
|
3980
4196
|
},
|
|
3981
4197
|
className: CELL_PENCIL_CLASS,
|
|
3982
|
-
children: /* @__PURE__ */ (0,
|
|
4198
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Pencil, { className: "h-3 w-3" })
|
|
3983
4199
|
}
|
|
3984
4200
|
)
|
|
3985
4201
|
}
|
|
3986
4202
|
);
|
|
3987
4203
|
}
|
|
3988
|
-
return /* @__PURE__ */ (0,
|
|
4204
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3989
4205
|
"button",
|
|
3990
4206
|
{
|
|
3991
4207
|
type: "button",
|
|
@@ -4004,7 +4220,7 @@ function InlineStringEditor({
|
|
|
4004
4220
|
}
|
|
4005
4221
|
);
|
|
4006
4222
|
}
|
|
4007
|
-
return /* @__PURE__ */ (0,
|
|
4223
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4008
4224
|
Input,
|
|
4009
4225
|
{
|
|
4010
4226
|
autoFocus: true,
|
|
@@ -4040,9 +4256,9 @@ function TypedEditor({
|
|
|
4040
4256
|
}) {
|
|
4041
4257
|
if (editType === "boolean") {
|
|
4042
4258
|
const checked = Boolean(value);
|
|
4043
|
-
return /* @__PURE__ */ (0,
|
|
4044
|
-
/* @__PURE__ */ (0,
|
|
4045
|
-
/* @__PURE__ */ (0,
|
|
4259
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
4260
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-xs font-medium", children: "Value" }),
|
|
4261
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4046
4262
|
Checkbox,
|
|
4047
4263
|
{
|
|
4048
4264
|
checked,
|
|
@@ -4052,7 +4268,7 @@ function TypedEditor({
|
|
|
4052
4268
|
] });
|
|
4053
4269
|
}
|
|
4054
4270
|
if (editType === "number") {
|
|
4055
|
-
return /* @__PURE__ */ (0,
|
|
4271
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4056
4272
|
NumberEditor,
|
|
4057
4273
|
{
|
|
4058
4274
|
value: typeof value === "number" ? value : Number(value) || 0,
|
|
@@ -4062,7 +4278,7 @@ function TypedEditor({
|
|
|
4062
4278
|
);
|
|
4063
4279
|
}
|
|
4064
4280
|
if (editType === "tags") {
|
|
4065
|
-
return /* @__PURE__ */ (0,
|
|
4281
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4066
4282
|
TagsEditor,
|
|
4067
4283
|
{
|
|
4068
4284
|
value: Array.isArray(value) ? value.map(String) : [],
|
|
@@ -4073,19 +4289,19 @@ function TypedEditor({
|
|
|
4073
4289
|
);
|
|
4074
4290
|
}
|
|
4075
4291
|
if (editType === "select") {
|
|
4076
|
-
return /* @__PURE__ */ (0,
|
|
4292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4077
4293
|
Select,
|
|
4078
4294
|
{
|
|
4079
4295
|
value: stringifyCellValue(value),
|
|
4080
4296
|
onValueChange: (v) => onCommit(v),
|
|
4081
4297
|
children: [
|
|
4082
|
-
/* @__PURE__ */ (0,
|
|
4083
|
-
/* @__PURE__ */ (0,
|
|
4298
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SelectValue, {}) }),
|
|
4299
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SelectContent, { children: editOptions.map((o) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SelectItem, { value: o.value, children: o.label }, o.value)) })
|
|
4084
4300
|
]
|
|
4085
4301
|
}
|
|
4086
4302
|
);
|
|
4087
4303
|
}
|
|
4088
|
-
return /* @__PURE__ */ (0,
|
|
4304
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4089
4305
|
Input,
|
|
4090
4306
|
{
|
|
4091
4307
|
type: "date",
|
|
@@ -4115,10 +4331,10 @@ function TagsEditor({
|
|
|
4115
4331
|
const matches = suggestions.filter(
|
|
4116
4332
|
(s) => !tags.includes(s.value) && s.value !== "__none__" && (!draft || s.label.toLowerCase().includes(draft.trim().toLowerCase()))
|
|
4117
4333
|
).slice(0, 6);
|
|
4118
|
-
return /* @__PURE__ */ (0,
|
|
4119
|
-
/* @__PURE__ */ (0,
|
|
4120
|
-
tags.length === 0 && /* @__PURE__ */ (0,
|
|
4121
|
-
tags.map((tag) => /* @__PURE__ */ (0,
|
|
4334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "space-y-2", onClick: (e) => e.stopPropagation(), children: [
|
|
4335
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
4336
|
+
tags.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-xs text-muted-foreground", children: "No tags" }),
|
|
4337
|
+
tags.map((tag) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4122
4338
|
"button",
|
|
4123
4339
|
{
|
|
4124
4340
|
type: "button",
|
|
@@ -4127,13 +4343,13 @@ function TagsEditor({
|
|
|
4127
4343
|
title: `Remove ${tag}`,
|
|
4128
4344
|
children: [
|
|
4129
4345
|
tag,
|
|
4130
|
-
/* @__PURE__ */ (0,
|
|
4346
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(X, { className: "h-2.5 w-2.5" })
|
|
4131
4347
|
]
|
|
4132
4348
|
},
|
|
4133
4349
|
tag
|
|
4134
4350
|
))
|
|
4135
4351
|
] }),
|
|
4136
|
-
/* @__PURE__ */ (0,
|
|
4352
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4137
4353
|
Input,
|
|
4138
4354
|
{
|
|
4139
4355
|
autoFocus: true,
|
|
@@ -4154,7 +4370,7 @@ function TagsEditor({
|
|
|
4154
4370
|
className: "h-8 text-xs"
|
|
4155
4371
|
}
|
|
4156
4372
|
),
|
|
4157
|
-
matches.length > 0 && /* @__PURE__ */ (0,
|
|
4373
|
+
matches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex flex-wrap gap-1", children: matches.map((s) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4158
4374
|
"button",
|
|
4159
4375
|
{
|
|
4160
4376
|
type: "button",
|
|
@@ -4167,8 +4383,8 @@ function TagsEditor({
|
|
|
4167
4383
|
},
|
|
4168
4384
|
s.value
|
|
4169
4385
|
)) }),
|
|
4170
|
-
/* @__PURE__ */ (0,
|
|
4171
|
-
/* @__PURE__ */ (0,
|
|
4386
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex justify-end gap-1 pt-1", children: [
|
|
4387
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4172
4388
|
Button,
|
|
4173
4389
|
{
|
|
4174
4390
|
size: "sm",
|
|
@@ -4176,17 +4392,17 @@ function TagsEditor({
|
|
|
4176
4392
|
className: "h-7 px-2",
|
|
4177
4393
|
"aria-label": "Cancel edit",
|
|
4178
4394
|
onClick: onCancel,
|
|
4179
|
-
children: /* @__PURE__ */ (0,
|
|
4395
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(X, { className: "h-3.5 w-3.5" })
|
|
4180
4396
|
}
|
|
4181
4397
|
),
|
|
4182
|
-
/* @__PURE__ */ (0,
|
|
4398
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4183
4399
|
Button,
|
|
4184
4400
|
{
|
|
4185
4401
|
size: "sm",
|
|
4186
4402
|
className: "h-7 px-2",
|
|
4187
4403
|
"aria-label": "Apply tags",
|
|
4188
4404
|
onClick: () => onCommit(tags),
|
|
4189
|
-
children: /* @__PURE__ */ (0,
|
|
4405
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Check, { className: "h-3.5 w-3.5" })
|
|
4190
4406
|
}
|
|
4191
4407
|
)
|
|
4192
4408
|
] })
|
|
@@ -4198,8 +4414,8 @@ function NumberEditor({
|
|
|
4198
4414
|
onCancel
|
|
4199
4415
|
}) {
|
|
4200
4416
|
const [draft, setDraft] = (0, import_react12.useState)(String(value));
|
|
4201
|
-
return /* @__PURE__ */ (0,
|
|
4202
|
-
/* @__PURE__ */ (0,
|
|
4417
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
4418
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4203
4419
|
Input,
|
|
4204
4420
|
{
|
|
4205
4421
|
autoFocus: true,
|
|
@@ -4216,8 +4432,8 @@ function NumberEditor({
|
|
|
4216
4432
|
}
|
|
4217
4433
|
}
|
|
4218
4434
|
),
|
|
4219
|
-
/* @__PURE__ */ (0,
|
|
4220
|
-
/* @__PURE__ */ (0,
|
|
4435
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex justify-end gap-1", children: [
|
|
4436
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4221
4437
|
Button,
|
|
4222
4438
|
{
|
|
4223
4439
|
type: "button",
|
|
@@ -4226,10 +4442,10 @@ function NumberEditor({
|
|
|
4226
4442
|
className: "h-7",
|
|
4227
4443
|
"aria-label": "Cancel edit",
|
|
4228
4444
|
onClick: onCancel,
|
|
4229
|
-
children: /* @__PURE__ */ (0,
|
|
4445
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(X, { className: "h-3.5 w-3.5" })
|
|
4230
4446
|
}
|
|
4231
4447
|
),
|
|
4232
|
-
/* @__PURE__ */ (0,
|
|
4448
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4233
4449
|
Button,
|
|
4234
4450
|
{
|
|
4235
4451
|
type: "button",
|
|
@@ -4240,7 +4456,7 @@ function NumberEditor({
|
|
|
4240
4456
|
const n = Number(draft);
|
|
4241
4457
|
if (Number.isFinite(n)) onCommit(n);
|
|
4242
4458
|
},
|
|
4243
|
-
children: /* @__PURE__ */ (0,
|
|
4459
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Check, { className: "h-3.5 w-3.5" })
|
|
4244
4460
|
}
|
|
4245
4461
|
)
|
|
4246
4462
|
] })
|
|
@@ -4248,24 +4464,24 @@ function NumberEditor({
|
|
|
4248
4464
|
}
|
|
4249
4465
|
|
|
4250
4466
|
// src/data-table/ToolbarFacets.tsx
|
|
4251
|
-
var
|
|
4467
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4252
4468
|
function ToolbarFacets({ facets }) {
|
|
4253
4469
|
if (facets.length === 0) return null;
|
|
4254
|
-
return /* @__PURE__ */ (0,
|
|
4470
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex flex-wrap items-center gap-2", children: facets.map((facet) => {
|
|
4255
4471
|
if (facet.type === "custom") {
|
|
4256
|
-
return /* @__PURE__ */ (0,
|
|
4472
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { children: facet.render() }, facet.id);
|
|
4257
4473
|
}
|
|
4258
4474
|
const defaultValue = facet.defaultValue ?? facet.options[0]?.value ?? "";
|
|
4259
4475
|
const isNonDefault = facet.value !== defaultValue;
|
|
4260
|
-
return /* @__PURE__ */ (0,
|
|
4476
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
4261
4477
|
"div",
|
|
4262
4478
|
{
|
|
4263
4479
|
className: "flex flex-wrap items-center gap-1.5 max-sm:grid max-sm:w-full max-sm:grid-cols-3",
|
|
4264
4480
|
children: [
|
|
4265
|
-
facet.label ? /* @__PURE__ */ (0,
|
|
4481
|
+
facet.label ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "mr-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: facet.label }) : null,
|
|
4266
4482
|
facet.options.map((opt) => {
|
|
4267
4483
|
const active = facet.value === opt.value;
|
|
4268
|
-
return /* @__PURE__ */ (0,
|
|
4484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
4269
4485
|
Button,
|
|
4270
4486
|
{
|
|
4271
4487
|
type: "button",
|
|
@@ -4279,7 +4495,7 @@ function ToolbarFacets({ facets }) {
|
|
|
4279
4495
|
children: [
|
|
4280
4496
|
opt.icon,
|
|
4281
4497
|
opt.label,
|
|
4282
|
-
active && isNonDefault ? /* @__PURE__ */ (0,
|
|
4498
|
+
active && isNonDefault ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4283
4499
|
"span",
|
|
4284
4500
|
{
|
|
4285
4501
|
role: "button",
|
|
@@ -4298,7 +4514,7 @@ function ToolbarFacets({ facets }) {
|
|
|
4298
4514
|
facet.onChange(defaultValue);
|
|
4299
4515
|
}
|
|
4300
4516
|
},
|
|
4301
|
-
children: /* @__PURE__ */ (0,
|
|
4517
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(X, { className: "h-3 w-3" })
|
|
4302
4518
|
}
|
|
4303
4519
|
) : null
|
|
4304
4520
|
]
|
|
@@ -4324,7 +4540,7 @@ function resetToolbarFacets(facets) {
|
|
|
4324
4540
|
// src/data-table/LayeredFilterBuilder.tsx
|
|
4325
4541
|
var import_react13 = require("react");
|
|
4326
4542
|
init_layered_filters();
|
|
4327
|
-
var
|
|
4543
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4328
4544
|
function moveRule(rules, from, to) {
|
|
4329
4545
|
if (from === to || to < 0 || to >= rules.length) return [...rules];
|
|
4330
4546
|
const next = [...rules];
|
|
@@ -4370,8 +4586,8 @@ function LayeredFilterBuilder({
|
|
|
4370
4586
|
const reorder = (from, to) => {
|
|
4371
4587
|
onChange(moveRule(rules, from, to));
|
|
4372
4588
|
};
|
|
4373
|
-
return /* @__PURE__ */ (0,
|
|
4374
|
-
/* @__PURE__ */ (0,
|
|
4589
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex min-w-0 flex-wrap items-center gap-1", children: [
|
|
4590
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
4375
4591
|
Popover,
|
|
4376
4592
|
{
|
|
4377
4593
|
open,
|
|
@@ -4383,7 +4599,7 @@ function LayeredFilterBuilder({
|
|
|
4383
4599
|
}
|
|
4384
4600
|
},
|
|
4385
4601
|
children: [
|
|
4386
|
-
/* @__PURE__ */ (0,
|
|
4602
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
4387
4603
|
Button,
|
|
4388
4604
|
{
|
|
4389
4605
|
type: "button",
|
|
@@ -4392,25 +4608,25 @@ function LayeredFilterBuilder({
|
|
|
4392
4608
|
className: "h-8 gap-1.5 px-2 text-xs",
|
|
4393
4609
|
"aria-label": label,
|
|
4394
4610
|
children: [
|
|
4395
|
-
/* @__PURE__ */ (0,
|
|
4396
|
-
/* @__PURE__ */ (0,
|
|
4397
|
-
rules.length > 0 ? /* @__PURE__ */ (0,
|
|
4611
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(SlidersHorizontal, { className: "h-3.5 w-3.5" }),
|
|
4612
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "hidden sm:inline", children: rules.length > 0 ? `${rules.length} layers` : "Advanced" }),
|
|
4613
|
+
rules.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "sm:hidden", children: rules.length }) : null
|
|
4398
4614
|
]
|
|
4399
4615
|
}
|
|
4400
4616
|
) }),
|
|
4401
|
-
/* @__PURE__ */ (0,
|
|
4617
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
4402
4618
|
PopoverContent,
|
|
4403
4619
|
{
|
|
4404
4620
|
align: "start",
|
|
4405
4621
|
sideOffset: 6,
|
|
4406
4622
|
className: "w-[min(46rem,calc(100vw-1rem))] p-0",
|
|
4407
4623
|
children: [
|
|
4408
|
-
/* @__PURE__ */ (0,
|
|
4409
|
-
/* @__PURE__ */ (0,
|
|
4410
|
-
/* @__PURE__ */ (0,
|
|
4411
|
-
/* @__PURE__ */ (0,
|
|
4624
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-start justify-between gap-3 border-b border-border px-3 py-2.5", children: [
|
|
4625
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { children: [
|
|
4626
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-sm font-semibold text-foreground", children: "Narrow these results" }),
|
|
4627
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-xs text-muted-foreground", children: "Every layer must match. Drag layers to put them in the order that makes sense to you." })
|
|
4412
4628
|
] }),
|
|
4413
|
-
rules.length > 0 ? /* @__PURE__ */ (0,
|
|
4629
|
+
rules.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4414
4630
|
Button,
|
|
4415
4631
|
{
|
|
4416
4632
|
type: "button",
|
|
@@ -4422,10 +4638,10 @@ function LayeredFilterBuilder({
|
|
|
4422
4638
|
}
|
|
4423
4639
|
) : null
|
|
4424
4640
|
] }),
|
|
4425
|
-
/* @__PURE__ */ (0,
|
|
4426
|
-
/* @__PURE__ */ (0,
|
|
4427
|
-
/* @__PURE__ */ (0,
|
|
4428
|
-
] }) : rules.map((rule, index) => /* @__PURE__ */ (0,
|
|
4641
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "max-h-[min(28rem,65dvh)] space-y-1.5 overflow-y-auto p-2.5 scrollbar-thin", children: rules.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "rounded-md border border-dashed border-border px-3 py-5 text-center", children: [
|
|
4642
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-sm font-medium text-foreground", children: "Start with one simple layer" }),
|
|
4643
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "mt-1 text-xs text-muted-foreground", children: "For example: Keyword contains ITAD, then Keyword doesn't have the word \u201Cwhat\u201D." })
|
|
4644
|
+
] }) : rules.map((rule, index) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4429
4645
|
LayeredRuleRow,
|
|
4430
4646
|
{
|
|
4431
4647
|
index,
|
|
@@ -4445,9 +4661,9 @@ function LayeredFilterBuilder({
|
|
|
4445
4661
|
},
|
|
4446
4662
|
rule.id
|
|
4447
4663
|
)) }),
|
|
4448
|
-
/* @__PURE__ */ (0,
|
|
4449
|
-
/* @__PURE__ */ (0,
|
|
4450
|
-
/* @__PURE__ */ (0,
|
|
4664
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center justify-between gap-2 border-t border-border px-3 py-2", children: [
|
|
4665
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "The regular search still works and is applied before these layers." }),
|
|
4666
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
4451
4667
|
Button,
|
|
4452
4668
|
{
|
|
4453
4669
|
type: "button",
|
|
@@ -4457,7 +4673,7 @@ function LayeredFilterBuilder({
|
|
|
4457
4673
|
disabled: rules.length >= maxRules,
|
|
4458
4674
|
onClick: addRule,
|
|
4459
4675
|
children: [
|
|
4460
|
-
/* @__PURE__ */ (0,
|
|
4676
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Plus, { className: "h-3.5 w-3.5" }),
|
|
4461
4677
|
" Add layer"
|
|
4462
4678
|
]
|
|
4463
4679
|
}
|
|
@@ -4469,7 +4685,7 @@ function LayeredFilterBuilder({
|
|
|
4469
4685
|
]
|
|
4470
4686
|
}
|
|
4471
4687
|
),
|
|
4472
|
-
rules.map((rule, index) => /* @__PURE__ */ (0,
|
|
4688
|
+
rules.map((rule, index) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
4473
4689
|
"span",
|
|
4474
4690
|
{
|
|
4475
4691
|
className: cn(
|
|
@@ -4477,7 +4693,7 @@ function LayeredFilterBuilder({
|
|
|
4477
4693
|
isCompleteLayeredFilterRule(rule) ? "border-border bg-muted/50 text-foreground" : "border-dashed border-warning/50 bg-warning/10 text-warning"
|
|
4478
4694
|
),
|
|
4479
4695
|
children: [
|
|
4480
|
-
/* @__PURE__ */ (0,
|
|
4696
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
4481
4697
|
"button",
|
|
4482
4698
|
{
|
|
4483
4699
|
type: "button",
|
|
@@ -4485,19 +4701,19 @@ function LayeredFilterBuilder({
|
|
|
4485
4701
|
onClick: () => setOpen(true),
|
|
4486
4702
|
title: isCompleteLayeredFilterRule(rule) ? layeredFilterRuleSummary(rule, fields) : `Layer ${index + 1} needs a value`,
|
|
4487
4703
|
children: [
|
|
4488
|
-
/* @__PURE__ */ (0,
|
|
4704
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "mr-1 text-muted-foreground", children: index + 1 }),
|
|
4489
4705
|
isCompleteLayeredFilterRule(rule) ? layeredFilterRuleSummary(rule, fields) : "Choose a value"
|
|
4490
4706
|
]
|
|
4491
4707
|
}
|
|
4492
4708
|
),
|
|
4493
|
-
/* @__PURE__ */ (0,
|
|
4709
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4494
4710
|
"button",
|
|
4495
4711
|
{
|
|
4496
4712
|
type: "button",
|
|
4497
4713
|
className: "shrink-0 rounded-full p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
4498
4714
|
"aria-label": `Remove filter layer ${index + 1}`,
|
|
4499
4715
|
onClick: () => removeRule(index),
|
|
4500
|
-
children: /* @__PURE__ */ (0,
|
|
4716
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(X, { className: "h-3 w-3" })
|
|
4501
4717
|
}
|
|
4502
4718
|
)
|
|
4503
4719
|
]
|
|
@@ -4527,7 +4743,7 @@ function LayeredRuleRow({
|
|
|
4527
4743
|
event.preventDefault();
|
|
4528
4744
|
onKeyboardMove(event.key === "ArrowUp" ? -1 : 1);
|
|
4529
4745
|
};
|
|
4530
|
-
return /* @__PURE__ */ (0,
|
|
4746
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
4531
4747
|
"div",
|
|
4532
4748
|
{
|
|
4533
4749
|
className: cn(
|
|
@@ -4540,7 +4756,7 @@ function LayeredRuleRow({
|
|
|
4540
4756
|
onDrop(index);
|
|
4541
4757
|
},
|
|
4542
4758
|
children: [
|
|
4543
|
-
/* @__PURE__ */ (0,
|
|
4759
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4544
4760
|
"button",
|
|
4545
4761
|
{
|
|
4546
4762
|
type: "button",
|
|
@@ -4554,10 +4770,10 @@ function LayeredRuleRow({
|
|
|
4554
4770
|
},
|
|
4555
4771
|
onDragEnd,
|
|
4556
4772
|
onKeyDown: handleMoveKey,
|
|
4557
|
-
children: /* @__PURE__ */ (0,
|
|
4773
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(GripVertical, { className: "h-3.5 w-3.5" })
|
|
4558
4774
|
}
|
|
4559
4775
|
),
|
|
4560
|
-
/* @__PURE__ */ (0,
|
|
4776
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
4561
4777
|
Select,
|
|
4562
4778
|
{
|
|
4563
4779
|
value: field.id,
|
|
@@ -4575,16 +4791,16 @@ function LayeredRuleRow({
|
|
|
4575
4791
|
});
|
|
4576
4792
|
},
|
|
4577
4793
|
children: [
|
|
4578
|
-
/* @__PURE__ */ (0,
|
|
4794
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4579
4795
|
SelectTrigger,
|
|
4580
4796
|
{
|
|
4581
4797
|
size: "sm",
|
|
4582
4798
|
className: "h-7 w-full text-xs max-sm:col-span-1",
|
|
4583
4799
|
"aria-label": `Filter layer ${index + 1} field`,
|
|
4584
|
-
children: /* @__PURE__ */ (0,
|
|
4800
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(SelectValue, {})
|
|
4585
4801
|
}
|
|
4586
4802
|
),
|
|
4587
|
-
/* @__PURE__ */ (0,
|
|
4803
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(SelectContent, { children: fields.map((candidate) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4588
4804
|
SelectItem,
|
|
4589
4805
|
{
|
|
4590
4806
|
value: candidate.id,
|
|
@@ -4596,7 +4812,7 @@ function LayeredRuleRow({
|
|
|
4596
4812
|
]
|
|
4597
4813
|
}
|
|
4598
4814
|
),
|
|
4599
|
-
/* @__PURE__ */ (0,
|
|
4815
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
4600
4816
|
Select,
|
|
4601
4817
|
{
|
|
4602
4818
|
value: rule.operator,
|
|
@@ -4608,35 +4824,35 @@ function LayeredRuleRow({
|
|
|
4608
4824
|
});
|
|
4609
4825
|
},
|
|
4610
4826
|
children: [
|
|
4611
|
-
/* @__PURE__ */ (0,
|
|
4827
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4612
4828
|
SelectTrigger,
|
|
4613
4829
|
{
|
|
4614
4830
|
size: "sm",
|
|
4615
4831
|
className: "h-7 w-full text-xs max-sm:col-start-2",
|
|
4616
4832
|
"aria-label": `Filter layer ${index + 1} operator`,
|
|
4617
|
-
children: /* @__PURE__ */ (0,
|
|
4833
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(SelectValue, {})
|
|
4618
4834
|
}
|
|
4619
4835
|
),
|
|
4620
|
-
/* @__PURE__ */ (0,
|
|
4836
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(SelectContent, { children: operators.map((operator) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(SelectItem, { value: operator, className: "text-xs", children: LAYERED_FILTER_OPERATOR_LABELS[operator] }, operator)) })
|
|
4621
4837
|
]
|
|
4622
4838
|
}
|
|
4623
4839
|
),
|
|
4624
|
-
/* @__PURE__ */ (0,
|
|
4840
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "min-w-0 max-sm:col-span-3 max-sm:col-start-1", children: !needsValue ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "flex h-7 items-center px-2 text-xs text-muted-foreground", children: "No value needed" }) : field.kind === "select" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
4625
4841
|
Select,
|
|
4626
4842
|
{
|
|
4627
4843
|
value: rule.value,
|
|
4628
4844
|
onValueChange: (value) => onChange({ value }),
|
|
4629
4845
|
children: [
|
|
4630
|
-
/* @__PURE__ */ (0,
|
|
4846
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4631
4847
|
SelectTrigger,
|
|
4632
4848
|
{
|
|
4633
4849
|
size: "sm",
|
|
4634
4850
|
className: "h-7 w-full text-xs",
|
|
4635
4851
|
"aria-label": `Filter layer ${index + 1} value`,
|
|
4636
|
-
children: /* @__PURE__ */ (0,
|
|
4852
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(SelectValue, {})
|
|
4637
4853
|
}
|
|
4638
4854
|
),
|
|
4639
|
-
/* @__PURE__ */ (0,
|
|
4855
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(SelectContent, { children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4640
4856
|
SelectItem,
|
|
4641
4857
|
{
|
|
4642
4858
|
value: option.value,
|
|
@@ -4647,8 +4863,8 @@ function LayeredRuleRow({
|
|
|
4647
4863
|
)) })
|
|
4648
4864
|
]
|
|
4649
4865
|
}
|
|
4650
|
-
) : /* @__PURE__ */ (0,
|
|
4651
|
-
/* @__PURE__ */ (0,
|
|
4866
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
4867
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4652
4868
|
Input,
|
|
4653
4869
|
{
|
|
4654
4870
|
value: rule.value,
|
|
@@ -4659,9 +4875,9 @@ function LayeredRuleRow({
|
|
|
4659
4875
|
"aria-label": `Filter layer ${index + 1} value`
|
|
4660
4876
|
}
|
|
4661
4877
|
),
|
|
4662
|
-
rule.operator === "between" ? /* @__PURE__ */ (0,
|
|
4663
|
-
/* @__PURE__ */ (0,
|
|
4664
|
-
/* @__PURE__ */ (0,
|
|
4878
|
+
rule.operator === "between" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
4879
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "and" }),
|
|
4880
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4665
4881
|
Input,
|
|
4666
4882
|
{
|
|
4667
4883
|
value: rule.valueTo ?? "",
|
|
@@ -4674,7 +4890,7 @@ function LayeredRuleRow({
|
|
|
4674
4890
|
)
|
|
4675
4891
|
] }) : null
|
|
4676
4892
|
] }) }),
|
|
4677
|
-
/* @__PURE__ */ (0,
|
|
4893
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4678
4894
|
Button,
|
|
4679
4895
|
{
|
|
4680
4896
|
type: "button",
|
|
@@ -4683,7 +4899,7 @@ function LayeredRuleRow({
|
|
|
4683
4899
|
className: "h-7 w-7 p-0 text-muted-foreground hover:text-destructive max-sm:col-start-3 max-sm:row-start-1",
|
|
4684
4900
|
"aria-label": `Remove filter layer ${index + 1}`,
|
|
4685
4901
|
onClick: onRemove,
|
|
4686
|
-
children: /* @__PURE__ */ (0,
|
|
4902
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Trash2, { className: "h-3.5 w-3.5" })
|
|
4687
4903
|
}
|
|
4688
4904
|
)
|
|
4689
4905
|
]
|
|
@@ -4698,7 +4914,6 @@ init_filter_engine();
|
|
|
4698
4914
|
// src/data-table/infer-filter.ts
|
|
4699
4915
|
init_filter_engine();
|
|
4700
4916
|
var SELECT_CARDINALITY_CAP = 24;
|
|
4701
|
-
var EXPLICIT_SELECT_CAP = 500;
|
|
4702
4917
|
function resolveFilterKind(col, sampleRows) {
|
|
4703
4918
|
if (col.filter === false) return null;
|
|
4704
4919
|
if (col.filter && col.filter !== "auto") return col.filter;
|
|
@@ -4716,7 +4931,6 @@ function resolveFilterKind(col, sampleRows) {
|
|
|
4716
4931
|
return "text";
|
|
4717
4932
|
}
|
|
4718
4933
|
function collectSelectOptions(col, rows) {
|
|
4719
|
-
const cap = col.filter === "select" ? EXPLICIT_SELECT_CAP : SELECT_CARDINALITY_CAP;
|
|
4720
4934
|
const seen = /* @__PURE__ */ new Set();
|
|
4721
4935
|
const options = [];
|
|
4722
4936
|
let hasEmpty = false;
|
|
@@ -4730,7 +4944,6 @@ function collectSelectOptions(col, rows) {
|
|
|
4730
4944
|
if (col.filterOptions?.length || seen.has(value)) continue;
|
|
4731
4945
|
seen.add(value);
|
|
4732
4946
|
options.push({ value, label: value });
|
|
4733
|
-
if (options.length >= cap) break;
|
|
4734
4947
|
}
|
|
4735
4948
|
const base = col.filterOptions?.length ? [...col.filterOptions] : options.sort((a, b) => a.label.localeCompare(b.label));
|
|
4736
4949
|
if (hasEmpty) {
|
|
@@ -4790,13 +5003,13 @@ function safeQueryPage(requestedPage, totalItems, pageSize) {
|
|
|
4790
5003
|
}
|
|
4791
5004
|
|
|
4792
5005
|
// src/data-table/MatrxDataTable.tsx
|
|
4793
|
-
var
|
|
5006
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4794
5007
|
function TableRowCopyControl({
|
|
4795
5008
|
copy,
|
|
4796
5009
|
row,
|
|
4797
5010
|
size
|
|
4798
5011
|
}) {
|
|
4799
|
-
return /* @__PURE__ */ (0,
|
|
5012
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4800
5013
|
CopyButtons,
|
|
4801
5014
|
{
|
|
4802
5015
|
size,
|
|
@@ -4817,8 +5030,8 @@ function isStringArray(value) {
|
|
|
4817
5030
|
}
|
|
4818
5031
|
var activeUrlTableIds = /* @__PURE__ */ new Set();
|
|
4819
5032
|
function MatrxDataTable(props) {
|
|
4820
|
-
if (!props.urlState) return /* @__PURE__ */ (0,
|
|
4821
|
-
return /* @__PURE__ */ (0,
|
|
5033
|
+
if (!props.urlState) return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(MatrxDataTableCore, { ...props });
|
|
5034
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(MatrxDataTableWithUrlState, { ...props, urlState: props.urlState });
|
|
4822
5035
|
}
|
|
4823
5036
|
function MatrxDataTableWithUrlState({
|
|
4824
5037
|
urlState,
|
|
@@ -4873,7 +5086,7 @@ function MatrxDataTableWithUrlState({
|
|
|
4873
5086
|
props.selection?.onSelectedIdsChange(ids);
|
|
4874
5087
|
}
|
|
4875
5088
|
} : props.selection;
|
|
4876
|
-
return /* @__PURE__ */ (0,
|
|
5089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4877
5090
|
MatrxDataTableCore,
|
|
4878
5091
|
{
|
|
4879
5092
|
...props,
|
|
@@ -5074,18 +5287,76 @@ function MatrxDataTableCore({
|
|
|
5074
5287
|
onWindowRowIdChange?.(id);
|
|
5075
5288
|
};
|
|
5076
5289
|
const [windowRowSnapshot, setWindowRowSnapshot] = (0, import_react14.useState)(null);
|
|
5077
|
-
const
|
|
5078
|
-
const
|
|
5290
|
+
const editScopeKey = appendQueryKey === null ? "\0local" : `append:${appendQueryKey}`;
|
|
5291
|
+
const [editsByScope, setEditsByScope] = (0, import_react14.useState)({});
|
|
5292
|
+
const editRevisionRef = (0, import_react14.useRef)({});
|
|
5293
|
+
const [savingByScope, setSavingByScope] = (0, import_react14.useState)({});
|
|
5294
|
+
const [confirmForeignDraftDiscard, setConfirmForeignDraftDiscard] = (0, import_react14.useState)(false);
|
|
5295
|
+
const edits = editsByScope[editScopeKey]?.values ?? {};
|
|
5296
|
+
const saving = (savingByScope[editScopeKey] ?? 0) > 0;
|
|
5079
5297
|
const setEdits = (next) => {
|
|
5080
|
-
|
|
5081
|
-
|
|
5298
|
+
const scope = editScopeKey;
|
|
5299
|
+
setEditsByScope((current) => {
|
|
5300
|
+
const previous = current[scope];
|
|
5301
|
+
const values = typeof next === "function" ? next(previous?.values ?? {}) : next;
|
|
5302
|
+
return {
|
|
5303
|
+
...current,
|
|
5304
|
+
[scope]: {
|
|
5305
|
+
sourceKey: appendQueryKey,
|
|
5306
|
+
values,
|
|
5307
|
+
rows: appendQueryKey === null ? data : [...data],
|
|
5308
|
+
revisions: previous?.revisions ?? {}
|
|
5309
|
+
}
|
|
5310
|
+
};
|
|
5311
|
+
});
|
|
5312
|
+
};
|
|
5313
|
+
const setCellEdit = (rowId, field, value) => {
|
|
5314
|
+
const scope = editScopeKey;
|
|
5315
|
+
const scopeRevisions = editRevisionRef.current[scope] ?? {};
|
|
5316
|
+
const revision = (scopeRevisions[rowId]?.[field] ?? 0) + 1;
|
|
5317
|
+
editRevisionRef.current[scope] = {
|
|
5318
|
+
...scopeRevisions,
|
|
5319
|
+
[rowId]: { ...scopeRevisions[rowId] ?? {}, [field]: revision }
|
|
5320
|
+
};
|
|
5321
|
+
setEditsByScope((current) => {
|
|
5322
|
+
const previous = current[scope];
|
|
5323
|
+
const values = {
|
|
5324
|
+
...previous?.values ?? {},
|
|
5325
|
+
[rowId]: { ...previous?.values[rowId] ?? {}, [field]: value }
|
|
5326
|
+
};
|
|
5327
|
+
const revisions = {
|
|
5328
|
+
...previous?.revisions ?? {},
|
|
5329
|
+
[rowId]: { ...previous?.revisions[rowId] ?? {}, [field]: revision }
|
|
5330
|
+
};
|
|
5082
5331
|
return {
|
|
5083
|
-
|
|
5084
|
-
|
|
5332
|
+
...current,
|
|
5333
|
+
[scope]: {
|
|
5334
|
+
sourceKey: appendQueryKey,
|
|
5335
|
+
values,
|
|
5336
|
+
rows: appendQueryKey === null ? data : [...data],
|
|
5337
|
+
revisions
|
|
5338
|
+
}
|
|
5085
5339
|
};
|
|
5086
5340
|
});
|
|
5341
|
+
return revision;
|
|
5342
|
+
};
|
|
5343
|
+
const startSaving = (scope) => {
|
|
5344
|
+
setSavingByScope((current) => ({ ...current, [scope]: (current[scope] ?? 0) + 1 }));
|
|
5345
|
+
};
|
|
5346
|
+
const finishSaving = (scope) => {
|
|
5347
|
+
setSavingByScope((current) => {
|
|
5348
|
+
const remaining = Math.max(0, (current[scope] ?? 1) - 1);
|
|
5349
|
+
const next = { ...current };
|
|
5350
|
+
if (remaining === 0) delete next[scope];
|
|
5351
|
+
else next[scope] = remaining;
|
|
5352
|
+
return next;
|
|
5353
|
+
});
|
|
5087
5354
|
};
|
|
5088
|
-
const [
|
|
5355
|
+
const foreignDrafts = Object.entries(editsByScope).filter(([scope, draft]) => scope !== editScopeKey && Object.keys(draft.values).length > 0).map(([, draft]) => draft);
|
|
5356
|
+
const foreignDraftPayload = foreignDrafts.map((draft) => ({
|
|
5357
|
+
sourceKey: draft.sourceKey,
|
|
5358
|
+
rows: Object.entries(draft.values).map(([rowId, columns2]) => ({ rowId, columns: columns2 }))
|
|
5359
|
+
}));
|
|
5089
5360
|
const selection = appendSourceChanged && selectionConfig ? { ...selectionConfig, selectedIds: [] } : selectionConfig;
|
|
5090
5361
|
(0, import_react14.useEffect)(() => {
|
|
5091
5362
|
const previous = committedAppendQueryKey.current;
|
|
@@ -5096,8 +5367,6 @@ function MatrxDataTableCore({
|
|
|
5096
5367
|
setUncontrolledSelectedId(null);
|
|
5097
5368
|
setUncontrolledWindowRowId(null);
|
|
5098
5369
|
setWindowRowSnapshot(null);
|
|
5099
|
-
setEdits({});
|
|
5100
|
-
setSaving(false);
|
|
5101
5370
|
onSelectedIdChange?.(null);
|
|
5102
5371
|
onWindowRowIdChange?.(null);
|
|
5103
5372
|
selectionConfig?.onSelectedIdsChange([]);
|
|
@@ -5372,32 +5641,31 @@ function MatrxDataTableCore({
|
|
|
5372
5641
|
resetToolbarFacets(toolbar?.facets);
|
|
5373
5642
|
};
|
|
5374
5643
|
const commitCell = (rowId, field, next) => {
|
|
5644
|
+
const scope = editScopeKey;
|
|
5375
5645
|
const nextEdits = { [rowId]: { [field]: next } };
|
|
5376
|
-
|
|
5377
|
-
const rowEdits = { ...prev[rowId] ?? {}, [field]: next };
|
|
5378
|
-
return { ...prev, [rowId]: rowEdits };
|
|
5379
|
-
});
|
|
5646
|
+
const revision = setCellEdit(rowId, field, next);
|
|
5380
5647
|
if (edit?.autoSave && edit.onSave) {
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5648
|
+
const rowsAtCommit = appendQueryKey === null ? data : [...data];
|
|
5649
|
+
const save = edit.onSave;
|
|
5650
|
+
startSaving(scope);
|
|
5651
|
+
void Promise.resolve().then(() => save(nextEdits, rowsAtCommit)).then(() => {
|
|
5652
|
+
setEditsByScope((current) => {
|
|
5653
|
+
const draft = current[scope];
|
|
5654
|
+
if (!draft || draft.revisions[rowId]?.[field] !== revision) return current;
|
|
5655
|
+
const rowDraft = draft.values[rowId];
|
|
5656
|
+
if (!rowDraft) return current;
|
|
5386
5657
|
const { [field]: _saved, ...remainingFields } = rowDraft;
|
|
5387
|
-
const
|
|
5388
|
-
if (Object.keys(remainingFields).length === 0)
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
nextDrafts[rowId] = remainingFields;
|
|
5392
|
-
}
|
|
5393
|
-
return nextDrafts;
|
|
5658
|
+
const values = { ...draft.values };
|
|
5659
|
+
if (Object.keys(remainingFields).length === 0) delete values[rowId];
|
|
5660
|
+
else values[rowId] = remainingFields;
|
|
5661
|
+
return { ...current, [scope]: { ...draft, values } };
|
|
5394
5662
|
});
|
|
5395
5663
|
toast.success("Change saved");
|
|
5396
5664
|
}).catch((error) => {
|
|
5397
5665
|
toast.error(
|
|
5398
5666
|
`Couldn't save: ${error instanceof Error ? error.message : String(error)}`
|
|
5399
5667
|
);
|
|
5400
|
-
}).finally(() =>
|
|
5668
|
+
}).finally(() => finishSaving(scope));
|
|
5401
5669
|
}
|
|
5402
5670
|
};
|
|
5403
5671
|
const discardRowEdits = (rowId) => {
|
|
@@ -5581,17 +5849,40 @@ function MatrxDataTableCore({
|
|
|
5581
5849
|
};
|
|
5582
5850
|
const handleSaveEdits = async () => {
|
|
5583
5851
|
if (!edit?.onSave || changeCount === 0) return;
|
|
5584
|
-
|
|
5852
|
+
const scope = editScopeKey;
|
|
5853
|
+
const draft = editsByScope[scope];
|
|
5854
|
+
if (!draft) return;
|
|
5855
|
+
const values = draft.values;
|
|
5856
|
+
const revisions = draft.revisions;
|
|
5857
|
+
const rows = appendQueryKey === null ? data : draft.rows;
|
|
5858
|
+
const save = edit.onSave;
|
|
5859
|
+
startSaving(scope);
|
|
5585
5860
|
try {
|
|
5586
|
-
await
|
|
5587
|
-
|
|
5861
|
+
await Promise.resolve().then(() => save(values, rows));
|
|
5862
|
+
setEditsByScope((current) => {
|
|
5863
|
+
const currentDraft = current[scope];
|
|
5864
|
+
if (!currentDraft) return current;
|
|
5865
|
+
const nextValues = {};
|
|
5866
|
+
for (const [rowId, rowValues] of Object.entries(currentDraft.values)) {
|
|
5867
|
+
const savedRow = values[rowId];
|
|
5868
|
+
const savedRevisions = revisions[rowId];
|
|
5869
|
+
const currentRevisions = currentDraft.revisions[rowId];
|
|
5870
|
+
const remaining = Object.fromEntries(
|
|
5871
|
+
Object.entries(rowValues).filter(
|
|
5872
|
+
([field]) => !Object.hasOwn(savedRow ?? {}, field) || currentRevisions?.[field] !== savedRevisions?.[field]
|
|
5873
|
+
)
|
|
5874
|
+
);
|
|
5875
|
+
if (Object.keys(remaining).length > 0) nextValues[rowId] = remaining;
|
|
5876
|
+
}
|
|
5877
|
+
return { ...current, [scope]: { ...currentDraft, values: nextValues } };
|
|
5878
|
+
});
|
|
5588
5879
|
toast.success("Changes saved");
|
|
5589
5880
|
} catch (e) {
|
|
5590
5881
|
toast.error(
|
|
5591
5882
|
`Couldn't save: ${e instanceof Error ? e.message : String(e)}`
|
|
5592
5883
|
);
|
|
5593
5884
|
} finally {
|
|
5594
|
-
|
|
5885
|
+
finishSaving(scope);
|
|
5595
5886
|
}
|
|
5596
5887
|
};
|
|
5597
5888
|
const handleCancelEdits = () => {
|
|
@@ -5661,7 +5952,7 @@ function MatrxDataTableCore({
|
|
|
5661
5952
|
}
|
|
5662
5953
|
} : facet
|
|
5663
5954
|
) : toolbar?.facets;
|
|
5664
|
-
return /* @__PURE__ */ (0,
|
|
5955
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
5665
5956
|
import_core.DndContext,
|
|
5666
5957
|
{
|
|
5667
5958
|
sensors: hierarchySensors,
|
|
@@ -5673,7 +5964,7 @@ function MatrxDataTableCore({
|
|
|
5673
5964
|
onDragCancel: () => setDraggedRowId(null),
|
|
5674
5965
|
onDragEnd: endHierarchyDrag,
|
|
5675
5966
|
children: [
|
|
5676
|
-
/* @__PURE__ */ (0,
|
|
5967
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
5677
5968
|
"div",
|
|
5678
5969
|
{
|
|
5679
5970
|
ref: rootRef,
|
|
@@ -5691,13 +5982,13 @@ function MatrxDataTableCore({
|
|
|
5691
5982
|
),
|
|
5692
5983
|
children: [
|
|
5693
5984
|
notice,
|
|
5694
|
-
!hideToolbar && (showSearch || toolbar?.anyOf || toolbar?.layeredFilters || toolbar?.facets && toolbar.facets.length > 0 || toolbar?.leading || toolbar?.actions || hasActiveFilters || showToolbarCopy || columns.length > 0) && /* @__PURE__ */ (0,
|
|
5985
|
+
!hideToolbar && (showSearch || toolbar?.anyOf || toolbar?.layeredFilters || toolbar?.facets && toolbar.facets.length > 0 || toolbar?.leading || toolbar?.actions || hasActiveFilters || showToolbarCopy || columns.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
5695
5986
|
"div",
|
|
5696
5987
|
{
|
|
5697
5988
|
"data-matrx-table-toolbar": true,
|
|
5698
5989
|
className: "flex shrink-0 flex-nowrap items-center gap-2 sm:flex-wrap",
|
|
5699
5990
|
children: [
|
|
5700
|
-
showSearch ? /* @__PURE__ */ (0,
|
|
5991
|
+
showSearch ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
5701
5992
|
"div",
|
|
5702
5993
|
{
|
|
5703
5994
|
"data-matrx-table-search": true,
|
|
@@ -5706,9 +5997,9 @@ function MatrxDataTableCore({
|
|
|
5706
5997
|
toolbar?.searchMatch ? "sm:max-w-md" : "sm:max-w-xs"
|
|
5707
5998
|
),
|
|
5708
5999
|
children: [
|
|
5709
|
-
/* @__PURE__ */ (0,
|
|
5710
|
-
/* @__PURE__ */ (0,
|
|
5711
|
-
/* @__PURE__ */ (0,
|
|
6000
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
|
|
6001
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Search, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
|
|
6002
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5712
6003
|
Input,
|
|
5713
6004
|
{
|
|
5714
6005
|
value: searchValue,
|
|
@@ -5721,18 +6012,18 @@ function MatrxDataTableCore({
|
|
|
5721
6012
|
style: { fontSize: "16px" }
|
|
5722
6013
|
}
|
|
5723
6014
|
),
|
|
5724
|
-
searchValue ? /* @__PURE__ */ (0,
|
|
6015
|
+
searchValue ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5725
6016
|
"button",
|
|
5726
6017
|
{
|
|
5727
6018
|
type: "button",
|
|
5728
6019
|
"aria-label": "Clear search",
|
|
5729
6020
|
className: "absolute right-1.5 top-1/2 -translate-y-1/2 rounded p-0.5 text-muted-foreground hover:text-foreground",
|
|
5730
6021
|
onClick: () => setSearchValue(""),
|
|
5731
|
-
children: /* @__PURE__ */ (0,
|
|
6022
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(X, { className: "h-3.5 w-3.5" })
|
|
5732
6023
|
}
|
|
5733
6024
|
) : null
|
|
5734
6025
|
] }),
|
|
5735
|
-
toolbar?.searchMatch ? /* @__PURE__ */ (0,
|
|
6026
|
+
toolbar?.searchMatch ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
5736
6027
|
Button,
|
|
5737
6028
|
{
|
|
5738
6029
|
type: "button",
|
|
@@ -5746,7 +6037,7 @@ function MatrxDataTableCore({
|
|
|
5746
6037
|
searchMatchMode === "whole_words" ? "contains" : "whole_words"
|
|
5747
6038
|
),
|
|
5748
6039
|
children: [
|
|
5749
|
-
/* @__PURE__ */ (0,
|
|
6040
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(WholeWord, { className: "h-3.5 w-3.5" }),
|
|
5750
6041
|
searchMatchMode === "whole_words" ? "Whole words" : "Contains"
|
|
5751
6042
|
]
|
|
5752
6043
|
}
|
|
@@ -5754,7 +6045,7 @@ function MatrxDataTableCore({
|
|
|
5754
6045
|
]
|
|
5755
6046
|
}
|
|
5756
6047
|
) : null,
|
|
5757
|
-
toolbar?.layeredFilters ? /* @__PURE__ */ (0,
|
|
6048
|
+
toolbar?.layeredFilters ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5758
6049
|
LayeredFilterBuilder,
|
|
5759
6050
|
{
|
|
5760
6051
|
fields: toolbar.layeredFilters.fields,
|
|
@@ -5764,9 +6055,9 @@ function MatrxDataTableCore({
|
|
|
5764
6055
|
label: toolbar.layeredFilters.label
|
|
5765
6056
|
}
|
|
5766
6057
|
) : null,
|
|
5767
|
-
toolbar?.anyOf ? /* @__PURE__ */ (0,
|
|
5768
|
-
/* @__PURE__ */ (0,
|
|
5769
|
-
/* @__PURE__ */ (0,
|
|
6058
|
+
toolbar?.anyOf ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "relative w-full max-w-xs", children: [
|
|
6059
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Search, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
|
|
6060
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5770
6061
|
Input,
|
|
5771
6062
|
{
|
|
5772
6063
|
value: anyOfValue,
|
|
@@ -5776,26 +6067,26 @@ function MatrxDataTableCore({
|
|
|
5776
6067
|
style: { fontSize: "16px" }
|
|
5777
6068
|
}
|
|
5778
6069
|
),
|
|
5779
|
-
anyOfValue ? /* @__PURE__ */ (0,
|
|
6070
|
+
anyOfValue ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5780
6071
|
"button",
|
|
5781
6072
|
{
|
|
5782
6073
|
type: "button",
|
|
5783
6074
|
"aria-label": "Clear match-any search",
|
|
5784
6075
|
className: "absolute right-1.5 top-1/2 -translate-y-1/2 rounded p-0.5 text-muted-foreground hover:text-foreground",
|
|
5785
6076
|
onClick: () => setAnyOfValue(""),
|
|
5786
|
-
children: /* @__PURE__ */ (0,
|
|
6077
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(X, { className: "h-3.5 w-3.5" })
|
|
5787
6078
|
}
|
|
5788
6079
|
) : null
|
|
5789
6080
|
] }) : null,
|
|
5790
|
-
renderedFacets ? /* @__PURE__ */ (0,
|
|
6081
|
+
renderedFacets ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ToolbarFacets, { facets: renderedFacets }) : null,
|
|
5791
6082
|
toolbar?.leading,
|
|
5792
|
-
/* @__PURE__ */ (0,
|
|
6083
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
5793
6084
|
"div",
|
|
5794
6085
|
{
|
|
5795
6086
|
"data-matrx-table-actions": true,
|
|
5796
6087
|
className: "ml-auto flex shrink-0 flex-nowrap items-center gap-2 sm:flex-wrap",
|
|
5797
6088
|
children: [
|
|
5798
|
-
sourceTotal !== void 0 ? /* @__PURE__ */ (0,
|
|
6089
|
+
sourceTotal !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
5799
6090
|
"span",
|
|
5800
6091
|
{
|
|
5801
6092
|
"data-matrx-table-source-total": true,
|
|
@@ -5810,7 +6101,7 @@ function MatrxDataTableCore({
|
|
|
5810
6101
|
]
|
|
5811
6102
|
}
|
|
5812
6103
|
) : null,
|
|
5813
|
-
hasActiveFilters ? /* @__PURE__ */ (0,
|
|
6104
|
+
hasActiveFilters ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
5814
6105
|
Button,
|
|
5815
6106
|
{
|
|
5816
6107
|
type: "button",
|
|
@@ -5820,12 +6111,12 @@ function MatrxDataTableCore({
|
|
|
5820
6111
|
onClick: clearAllFilters,
|
|
5821
6112
|
title: "Clear all filters",
|
|
5822
6113
|
children: [
|
|
5823
|
-
/* @__PURE__ */ (0,
|
|
5824
|
-
/* @__PURE__ */ (0,
|
|
6114
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Eraser, { className: "h-3.5 w-3.5" }),
|
|
6115
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "max-sm:sr-only", children: "Clear all" })
|
|
5825
6116
|
]
|
|
5826
6117
|
}
|
|
5827
6118
|
) : null,
|
|
5828
|
-
showToolbarCopy && copy ? /* @__PURE__ */ (0,
|
|
6119
|
+
showToolbarCopy && copy ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5829
6120
|
CopyButtons,
|
|
5830
6121
|
{
|
|
5831
6122
|
size: "icon",
|
|
@@ -5881,7 +6172,7 @@ function MatrxDataTableCore({
|
|
|
5881
6172
|
}
|
|
5882
6173
|
}
|
|
5883
6174
|
) : null,
|
|
5884
|
-
columns.length > 0 ? /* @__PURE__ */ (0,
|
|
6175
|
+
columns.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
5885
6176
|
Button,
|
|
5886
6177
|
{
|
|
5887
6178
|
type: "button",
|
|
@@ -5892,8 +6183,8 @@ function MatrxDataTableCore({
|
|
|
5892
6183
|
className: "h-8 w-8",
|
|
5893
6184
|
onClick: () => setColumnManagerOpen(true),
|
|
5894
6185
|
children: [
|
|
5895
|
-
/* @__PURE__ */ (0,
|
|
5896
|
-
hiddenColumnIds.size > 0 ? /* @__PURE__ */ (0,
|
|
6186
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SlidersHorizontal, { className: "h-4 w-4" }),
|
|
6187
|
+
hiddenColumnIds.size > 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "sr-only", children: [
|
|
5897
6188
|
hiddenColumnIds.size,
|
|
5898
6189
|
" hidden"
|
|
5899
6190
|
] }) : null
|
|
@@ -5907,15 +6198,15 @@ function MatrxDataTableCore({
|
|
|
5907
6198
|
]
|
|
5908
6199
|
}
|
|
5909
6200
|
),
|
|
5910
|
-
selection && selectionCount > 0 ? /* @__PURE__ */ (0,
|
|
5911
|
-
/* @__PURE__ */ (0,
|
|
6201
|
+
selection && selectionCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex shrink-0 flex-wrap items-center gap-2 rounded-md border border-primary/30 bg-primary/5 px-2 py-1.5", children: [
|
|
6202
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "text-xs font-medium text-foreground", children: [
|
|
5912
6203
|
selectionCount.toLocaleString(),
|
|
5913
6204
|
" ",
|
|
5914
6205
|
selectionNoun,
|
|
5915
6206
|
selectionCount === 1 ? "" : "s",
|
|
5916
6207
|
" selected"
|
|
5917
6208
|
] }),
|
|
5918
|
-
/* @__PURE__ */ (0,
|
|
6209
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
5919
6210
|
Button,
|
|
5920
6211
|
{
|
|
5921
6212
|
type: "button",
|
|
@@ -5927,13 +6218,13 @@ function MatrxDataTableCore({
|
|
|
5927
6218
|
selection.onSelectedIdsChange([]);
|
|
5928
6219
|
},
|
|
5929
6220
|
children: [
|
|
5930
|
-
/* @__PURE__ */ (0,
|
|
6221
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(X, { className: "h-3.5 w-3.5" }),
|
|
5931
6222
|
"Clear"
|
|
5932
6223
|
]
|
|
5933
6224
|
}
|
|
5934
6225
|
),
|
|
5935
|
-
/* @__PURE__ */ (0,
|
|
5936
|
-
copy && selectedRows.length > 0 ? /* @__PURE__ */ (0,
|
|
6226
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "ml-auto flex flex-wrap items-center gap-1.5", children: [
|
|
6227
|
+
copy && selectedRows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5937
6228
|
CopyButtons,
|
|
5938
6229
|
{
|
|
5939
6230
|
size: "icon",
|
|
@@ -5989,9 +6280,9 @@ function MatrxDataTableCore({
|
|
|
5989
6280
|
selection.actions?.(selectedRows, selection.selectedIds)
|
|
5990
6281
|
] })
|
|
5991
6282
|
] }) : null,
|
|
5992
|
-
/* @__PURE__ */ (0,
|
|
5993
|
-
/* @__PURE__ */ (0,
|
|
5994
|
-
mobileCards ? /* @__PURE__ */ (0,
|
|
6283
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex min-h-0 flex-1 flex-col", children: [
|
|
6284
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "relative min-h-0 flex-1", children: [
|
|
6285
|
+
mobileCards ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
5995
6286
|
"div",
|
|
5996
6287
|
{
|
|
5997
6288
|
ref: cardsScrollRef,
|
|
@@ -6002,33 +6293,33 @@ function MatrxDataTableCore({
|
|
|
6002
6293
|
mobileCardsClass
|
|
6003
6294
|
),
|
|
6004
6295
|
children: [
|
|
6005
|
-
isFetching && !isLoading ? /* @__PURE__ */ (0,
|
|
6296
|
+
isFetching && !isLoading ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6006
6297
|
"div",
|
|
6007
6298
|
{
|
|
6008
6299
|
role: "status",
|
|
6009
6300
|
className: "h-0.5 shrink-0 overflow-hidden rounded-full bg-primary/15",
|
|
6010
6301
|
children: [
|
|
6011
|
-
/* @__PURE__ */ (0,
|
|
6012
|
-
/* @__PURE__ */ (0,
|
|
6302
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "h-full w-full animate-pulse bg-primary" }),
|
|
6303
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "sr-only", children: "Refreshing table data" })
|
|
6013
6304
|
]
|
|
6014
6305
|
}
|
|
6015
6306
|
) : null,
|
|
6016
|
-
isLoading ? Array.from({ length: 4 }).map((_, index) => /* @__PURE__ */ (0,
|
|
6307
|
+
isLoading ? Array.from({ length: 4 }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6017
6308
|
Skeleton,
|
|
6018
6309
|
{
|
|
6019
6310
|
className: "h-52 w-full shrink-0 rounded-lg"
|
|
6020
6311
|
},
|
|
6021
6312
|
`mobile-card-sk-${index}`
|
|
6022
|
-
)) : paginated.length === 0 ? /* @__PURE__ */ (0,
|
|
6313
|
+
)) : paginated.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex min-h-48 flex-1 items-center justify-center px-4 py-12 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex max-w-sm flex-col items-center gap-2", children: [
|
|
6023
6314
|
emptyState?.icon,
|
|
6024
|
-
/* @__PURE__ */ (0,
|
|
6025
|
-
emptyState?.description ? /* @__PURE__ */ (0,
|
|
6315
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-sm font-medium text-foreground", children: emptyState?.title ?? "No rows" }),
|
|
6316
|
+
emptyState?.description ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-xs text-muted-foreground", children: emptyState.description }) : null,
|
|
6026
6317
|
emptyState?.action
|
|
6027
6318
|
] }) }) : paginated.map((row, index) => {
|
|
6028
6319
|
const id = getRowId(row);
|
|
6029
6320
|
const displayRow = applyRowEdits(row, edits[id]);
|
|
6030
6321
|
const selectable = selection?.isRowSelectable?.(row) ?? Boolean(selection);
|
|
6031
|
-
return /* @__PURE__ */ (0,
|
|
6322
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react14.Fragment, { children: mobileCards(displayRow, index, {
|
|
6032
6323
|
selected: selectedIdSet.has(id),
|
|
6033
6324
|
selectable,
|
|
6034
6325
|
onSelectedChange: (nextSelected) => {
|
|
@@ -6040,13 +6331,13 @@ function MatrxDataTableCore({
|
|
|
6040
6331
|
else next.delete(id);
|
|
6041
6332
|
setSelectedIds(next);
|
|
6042
6333
|
},
|
|
6043
|
-
actions: showRowCopy || rowActions ? /* @__PURE__ */ (0,
|
|
6334
|
+
actions: showRowCopy || rowActions ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6044
6335
|
"div",
|
|
6045
6336
|
{
|
|
6046
6337
|
className: "inline-flex items-center gap-1",
|
|
6047
6338
|
onClick: (event) => event.stopPropagation(),
|
|
6048
6339
|
children: [
|
|
6049
|
-
showRowCopy && copy ? /* @__PURE__ */ (0,
|
|
6340
|
+
showRowCopy && copy ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6050
6341
|
TableRowCopyControl,
|
|
6051
6342
|
{
|
|
6052
6343
|
size: "xs",
|
|
@@ -6070,7 +6361,7 @@ function MatrxDataTableCore({
|
|
|
6070
6361
|
]
|
|
6071
6362
|
}
|
|
6072
6363
|
) : null,
|
|
6073
|
-
/* @__PURE__ */ (0,
|
|
6364
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6074
6365
|
"div",
|
|
6075
6366
|
{
|
|
6076
6367
|
ref: scrollRef,
|
|
@@ -6083,34 +6374,34 @@ function MatrxDataTableCore({
|
|
|
6083
6374
|
tableClassName
|
|
6084
6375
|
),
|
|
6085
6376
|
children: [
|
|
6086
|
-
hierarchy && draggedRow ? /* @__PURE__ */ (0,
|
|
6377
|
+
hierarchy && draggedRow ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6087
6378
|
HierarchyRootDropTarget,
|
|
6088
6379
|
{
|
|
6089
6380
|
label: hierarchy.rootDropLabel ?? "Drop here to move to the top level",
|
|
6090
6381
|
draggedLabel: hierarchy.itemLabel?.(draggedRow) ?? "Moving row"
|
|
6091
6382
|
}
|
|
6092
6383
|
) : null,
|
|
6093
|
-
hierarchy && draggedRowId ? /* @__PURE__ */ (0,
|
|
6384
|
+
hierarchy && draggedRowId ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6094
6385
|
HierarchyDragIndicatorLayer,
|
|
6095
6386
|
{
|
|
6096
6387
|
scrollRef,
|
|
6097
6388
|
resolve: resolveHierarchyMove
|
|
6098
6389
|
}
|
|
6099
6390
|
) : null,
|
|
6100
|
-
isFetching && !isLoading ? /* @__PURE__ */ (0,
|
|
6391
|
+
isFetching && !isLoading ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6101
6392
|
"div",
|
|
6102
6393
|
{
|
|
6103
6394
|
role: "status",
|
|
6104
6395
|
className: "sticky left-0 top-0 z-20 h-0.5 w-full overflow-hidden bg-primary/15",
|
|
6105
6396
|
children: [
|
|
6106
|
-
/* @__PURE__ */ (0,
|
|
6107
|
-
/* @__PURE__ */ (0,
|
|
6397
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "h-full w-full animate-pulse bg-primary" }),
|
|
6398
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "sr-only", children: "Refreshing table data" })
|
|
6108
6399
|
]
|
|
6109
6400
|
}
|
|
6110
6401
|
) : null,
|
|
6111
|
-
/* @__PURE__ */ (0,
|
|
6112
|
-
/* @__PURE__ */ (0,
|
|
6113
|
-
selection ? /* @__PURE__ */ (0,
|
|
6402
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("table", { className: "table w-max min-w-full max-w-none caption-bottom overflow-visible text-sm sm:w-full sm:min-w-0 sm:max-w-full", children: [
|
|
6403
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("thead", { className: "sticky top-0 z-10 border-b border-border bg-muted/90 shadow-[0_1px_0_0_var(--border)] backdrop-blur-sm", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("tr", { children: [
|
|
6404
|
+
selection ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("th", { className: "h-9 w-9 px-2 text-left align-middle", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6114
6405
|
Checkbox,
|
|
6115
6406
|
{
|
|
6116
6407
|
className: CHECKBOX_TAP_AREA,
|
|
@@ -6126,7 +6417,7 @@ function MatrxDataTableCore({
|
|
|
6126
6417
|
const isSorted = sort?.id === id;
|
|
6127
6418
|
const headerLabel = col.label ?? (typeof col.header === "string" ? col.header : id);
|
|
6128
6419
|
const defaultSortDirection = col.defaultSortDirection ?? "asc";
|
|
6129
|
-
return /* @__PURE__ */ (0,
|
|
6420
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6130
6421
|
"th",
|
|
6131
6422
|
{
|
|
6132
6423
|
"aria-sort": isSorted ? sort?.direction === "asc" ? "ascending" : "descending" : void 0,
|
|
@@ -6152,7 +6443,7 @@ function MatrxDataTableCore({
|
|
|
6152
6443
|
col.align === "right" && "text-right"
|
|
6153
6444
|
),
|
|
6154
6445
|
style: columnWidthVar(col.width),
|
|
6155
|
-
children: /* @__PURE__ */ (0,
|
|
6446
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6156
6447
|
ColumnHeaderCell,
|
|
6157
6448
|
{
|
|
6158
6449
|
label: col.header,
|
|
@@ -6192,11 +6483,11 @@ function MatrxDataTableCore({
|
|
|
6192
6483
|
id
|
|
6193
6484
|
);
|
|
6194
6485
|
}),
|
|
6195
|
-
showActionsCol && /* @__PURE__ */ (0,
|
|
6486
|
+
showActionsCol && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("th", { className: "h-9 w-28 px-2 text-right align-middle text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Actions" })
|
|
6196
6487
|
] }) }),
|
|
6197
|
-
/* @__PURE__ */ (0,
|
|
6198
|
-
selection ? /* @__PURE__ */ (0,
|
|
6199
|
-
visibleColumns.map((col) => /* @__PURE__ */ (0,
|
|
6488
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("tbody", { children: isLoading ? Array.from({ length: 6 }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("tr", { className: "border-b border-border/60", children: [
|
|
6489
|
+
selection ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { className: "px-2 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Skeleton, { className: "h-3.5 w-3.5" }) }) : null,
|
|
6490
|
+
visibleColumns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6200
6491
|
"td",
|
|
6201
6492
|
{
|
|
6202
6493
|
className: cn(
|
|
@@ -6204,20 +6495,20 @@ function MatrxDataTableCore({
|
|
|
6204
6495
|
col.compact ? "px-1" : "px-2",
|
|
6205
6496
|
col.mobileHidden && "max-sm:hidden"
|
|
6206
6497
|
),
|
|
6207
|
-
children: /* @__PURE__ */ (0,
|
|
6498
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Skeleton, { className: "h-5 w-full" })
|
|
6208
6499
|
},
|
|
6209
6500
|
columnId(col)
|
|
6210
6501
|
)),
|
|
6211
|
-
showActionsCol && /* @__PURE__ */ (0,
|
|
6212
|
-
] }, `sk-${i}`)) : paginated.length === 0 ? /* @__PURE__ */ (0,
|
|
6502
|
+
showActionsCol && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { className: "px-2 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Skeleton, { className: "ml-auto h-5 w-10" }) })
|
|
6503
|
+
] }, `sk-${i}`)) : paginated.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6213
6504
|
"td",
|
|
6214
6505
|
{
|
|
6215
6506
|
colSpan: visibleColumns.length + leadingCols + (showActionsCol ? 1 : 0),
|
|
6216
6507
|
className: "px-4 py-12 text-center",
|
|
6217
|
-
children: /* @__PURE__ */ (0,
|
|
6508
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "mx-auto flex max-w-sm flex-col items-center gap-2", children: [
|
|
6218
6509
|
emptyState?.icon,
|
|
6219
|
-
/* @__PURE__ */ (0,
|
|
6220
|
-
emptyState?.description ? /* @__PURE__ */ (0,
|
|
6510
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-sm font-medium text-foreground", children: emptyState?.title ?? "No rows" }),
|
|
6511
|
+
emptyState?.description ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-xs text-muted-foreground", children: emptyState.description }) : null,
|
|
6221
6512
|
emptyState?.action
|
|
6222
6513
|
] })
|
|
6223
6514
|
}
|
|
@@ -6227,7 +6518,7 @@ function MatrxDataTableCore({
|
|
|
6227
6518
|
const rowEdits = edits[id];
|
|
6228
6519
|
const displayRow = applyRowEdits(row, rowEdits);
|
|
6229
6520
|
const isChecked = selectedIdSet.has(id);
|
|
6230
|
-
const rowNode = /* @__PURE__ */ (0,
|
|
6521
|
+
const rowNode = /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6231
6522
|
"tr",
|
|
6232
6523
|
{
|
|
6233
6524
|
"data-row-id": id,
|
|
@@ -6250,12 +6541,12 @@ function MatrxDataTableCore({
|
|
|
6250
6541
|
zebra && index % 2 === 1 && !isSelected && !isChecked && "sm:bg-muted/20"
|
|
6251
6542
|
),
|
|
6252
6543
|
children: [
|
|
6253
|
-
selection ? /* @__PURE__ */ (0,
|
|
6544
|
+
selection ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6254
6545
|
"td",
|
|
6255
6546
|
{
|
|
6256
6547
|
className: "px-2 py-1.5 align-middle lg:py-0.5",
|
|
6257
6548
|
onClick: (e) => e.stopPropagation(),
|
|
6258
|
-
children: selection.isRowSelectable?.(row) ?? true ? /* @__PURE__ */ (0,
|
|
6549
|
+
children: selection.isRowSelectable?.(row) ?? true ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6259
6550
|
Checkbox,
|
|
6260
6551
|
{
|
|
6261
6552
|
className: CHECKBOX_TAP_AREA,
|
|
@@ -6276,7 +6567,7 @@ function MatrxDataTableCore({
|
|
|
6276
6567
|
rowEdits && field in rowEdits
|
|
6277
6568
|
);
|
|
6278
6569
|
const cellHref = col.href?.(row) ?? void 0;
|
|
6279
|
-
return /* @__PURE__ */ (0,
|
|
6570
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6280
6571
|
"td",
|
|
6281
6572
|
{
|
|
6282
6573
|
className: cn(
|
|
@@ -6292,14 +6583,14 @@ function MatrxDataTableCore({
|
|
|
6292
6583
|
col.align === "right" && "text-right"
|
|
6293
6584
|
),
|
|
6294
6585
|
style: columnWidthVar(col.width),
|
|
6295
|
-
children: /* @__PURE__ */ (0,
|
|
6586
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6296
6587
|
"div",
|
|
6297
6588
|
{
|
|
6298
6589
|
className: cn(
|
|
6299
6590
|
colIdx === 0 && hierarchy && "flex min-w-0 items-center"
|
|
6300
6591
|
),
|
|
6301
6592
|
children: [
|
|
6302
|
-
colIdx === 0 && hierarchy ? /* @__PURE__ */ (0,
|
|
6593
|
+
colIdx === 0 && hierarchy ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6303
6594
|
HierarchyDragHandle,
|
|
6304
6595
|
{
|
|
6305
6596
|
id,
|
|
@@ -6307,12 +6598,12 @@ function MatrxDataTableCore({
|
|
|
6307
6598
|
disabled: !(hierarchy.canReparent?.(row) ?? true)
|
|
6308
6599
|
}
|
|
6309
6600
|
) : null,
|
|
6310
|
-
/* @__PURE__ */ (0,
|
|
6601
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6311
6602
|
"div",
|
|
6312
6603
|
{
|
|
6313
6604
|
"data-matrx-cell-content": true,
|
|
6314
6605
|
className: "min-w-0 max-w-full flex-1 whitespace-normal break-words [overflow-wrap:anywhere] sm:[&_*]:min-w-0 sm:[&_*]:max-w-full sm:[&_*]:whitespace-normal sm:[&_*]:[overflow-wrap:anywhere] sm:[&_[data-matrx-cell-control]]:w-max sm:[&_[data-matrx-cell-control]]:min-w-max sm:[&_[data-matrx-cell-control]]:max-w-none sm:[&_[data-matrx-cell-control]]:whitespace-nowrap sm:[&_[data-matrx-cell-control]]:[overflow-wrap:normal] sm:[&_[data-matrx-cell-control]_*]:whitespace-nowrap sm:[&_[data-matrx-cell-control]_*]:[overflow-wrap:normal]",
|
|
6315
|
-
children: editable && col.editable ? /* @__PURE__ */ (0,
|
|
6606
|
+
children: editable && col.editable ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6316
6607
|
EditableTableCell,
|
|
6317
6608
|
{
|
|
6318
6609
|
value: rowEdits && field in rowEdits ? rowEdits[field] : getCellValue(row, col),
|
|
@@ -6324,7 +6615,7 @@ function MatrxDataTableCore({
|
|
|
6324
6615
|
...cellHref === void 0 ? {} : { href: cellHref },
|
|
6325
6616
|
...col.editTrigger === void 0 ? {} : { editTrigger: col.editTrigger }
|
|
6326
6617
|
}
|
|
6327
|
-
) : cellHref ? /* @__PURE__ */ (0,
|
|
6618
|
+
) : cellHref ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6328
6619
|
Link,
|
|
6329
6620
|
{
|
|
6330
6621
|
href: cellHref,
|
|
@@ -6342,13 +6633,13 @@ function MatrxDataTableCore({
|
|
|
6342
6633
|
columnId(col)
|
|
6343
6634
|
);
|
|
6344
6635
|
}),
|
|
6345
|
-
showActionsCol && /* @__PURE__ */ (0,
|
|
6636
|
+
showActionsCol && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { className: "px-2 py-1.5 text-right align-middle lg:py-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6346
6637
|
"div",
|
|
6347
6638
|
{
|
|
6348
6639
|
className: "inline-flex items-center justify-end gap-0.5",
|
|
6349
6640
|
onClick: (e) => e.stopPropagation(),
|
|
6350
6641
|
children: [
|
|
6351
|
-
showRowCopy && copy ? /* @__PURE__ */ (0,
|
|
6642
|
+
showRowCopy && copy ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6352
6643
|
TableRowCopyControl,
|
|
6353
6644
|
{
|
|
6354
6645
|
size: "xs",
|
|
@@ -6364,7 +6655,7 @@ function MatrxDataTableCore({
|
|
|
6364
6655
|
hasPendingEdits: Boolean(rowEdits),
|
|
6365
6656
|
discardPendingEdits: () => discardRowEdits(id)
|
|
6366
6657
|
}),
|
|
6367
|
-
windowEnabled ? /* @__PURE__ */ (0,
|
|
6658
|
+
windowEnabled ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6368
6659
|
Button,
|
|
6369
6660
|
{
|
|
6370
6661
|
type: "button",
|
|
@@ -6381,7 +6672,7 @@ function MatrxDataTableCore({
|
|
|
6381
6672
|
openWindow(row);
|
|
6382
6673
|
}
|
|
6383
6674
|
},
|
|
6384
|
-
children: opensWindowOnRowClick ? /* @__PURE__ */ (0,
|
|
6675
|
+
children: opensWindowOnRowClick ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PanelRightOpen, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PanelRight, { className: "h-3.5 w-3.5" })
|
|
6385
6676
|
}
|
|
6386
6677
|
) : null
|
|
6387
6678
|
]
|
|
@@ -6392,7 +6683,7 @@ function MatrxDataTableCore({
|
|
|
6392
6683
|
id
|
|
6393
6684
|
);
|
|
6394
6685
|
const wrappedRow = rowWrapper ? rowWrapper(row, rowNode) : rowNode;
|
|
6395
|
-
return hierarchy ? /* @__PURE__ */ (0,
|
|
6686
|
+
return hierarchy ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6396
6687
|
HierarchyDroppableRow,
|
|
6397
6688
|
{
|
|
6398
6689
|
id,
|
|
@@ -6400,11 +6691,11 @@ function MatrxDataTableCore({
|
|
|
6400
6691
|
children: wrappedRow
|
|
6401
6692
|
},
|
|
6402
6693
|
id
|
|
6403
|
-
) : /* @__PURE__ */ (0,
|
|
6694
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react14.Fragment, { children: wrappedRow }, id);
|
|
6404
6695
|
}) }),
|
|
6405
|
-
footerRows.length > 0 ? /* @__PURE__ */ (0,
|
|
6406
|
-
selection ? /* @__PURE__ */ (0,
|
|
6407
|
-
visibleColumns.map((column) => /* @__PURE__ */ (0,
|
|
6696
|
+
footerRows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("tfoot", { className: "border-t-2 border-border bg-muted/50 font-semibold", children: footerRows.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("tr", { children: [
|
|
6697
|
+
selection ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { className: "px-2 py-2" }) : null,
|
|
6698
|
+
visibleColumns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6408
6699
|
"td",
|
|
6409
6700
|
{
|
|
6410
6701
|
className: cn(
|
|
@@ -6419,13 +6710,13 @@ function MatrxDataTableCore({
|
|
|
6419
6710
|
},
|
|
6420
6711
|
columnId(column)
|
|
6421
6712
|
)),
|
|
6422
|
-
showActionsCol ? /* @__PURE__ */ (0,
|
|
6713
|
+
showActionsCol ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { className: "px-2 py-2" }) : null
|
|
6423
6714
|
] }, `footer-${index}`)) }) : null
|
|
6424
6715
|
] })
|
|
6425
6716
|
]
|
|
6426
6717
|
}
|
|
6427
6718
|
),
|
|
6428
|
-
scrollHintLeft ? /* @__PURE__ */ (0,
|
|
6719
|
+
scrollHintLeft ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6429
6720
|
Button,
|
|
6430
6721
|
{
|
|
6431
6722
|
type: "button",
|
|
@@ -6436,10 +6727,10 @@ function MatrxDataTableCore({
|
|
|
6436
6727
|
"data-matrx-table-scroll-control": "left",
|
|
6437
6728
|
className: "absolute left-1.5 top-1/2 z-30 hidden h-11 w-11 -translate-y-1/2 rounded-full border border-glass-edge bg-glass p-0 text-foreground shadow-glass backdrop-blur-glass backdrop-saturate-glass hover:bg-glass-hover active:bg-glass-active sm:inline-flex",
|
|
6438
6729
|
onClick: () => scrollTableHorizontally("left"),
|
|
6439
|
-
children: /* @__PURE__ */ (0,
|
|
6730
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChevronLeft, { className: "h-5 w-5" })
|
|
6440
6731
|
}
|
|
6441
6732
|
) : null,
|
|
6442
|
-
scrollHintRight ? /* @__PURE__ */ (0,
|
|
6733
|
+
scrollHintRight ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6443
6734
|
Button,
|
|
6444
6735
|
{
|
|
6445
6736
|
type: "button",
|
|
@@ -6450,17 +6741,17 @@ function MatrxDataTableCore({
|
|
|
6450
6741
|
"data-matrx-table-scroll-control": "right",
|
|
6451
6742
|
className: "absolute right-1.5 top-1/2 z-30 hidden h-11 w-11 -translate-y-1/2 rounded-full border border-glass-edge bg-glass p-0 text-foreground shadow-glass backdrop-blur-glass backdrop-saturate-glass hover:bg-glass-hover active:bg-glass-active sm:inline-flex",
|
|
6452
6743
|
onClick: () => scrollTableHorizontally("right"),
|
|
6453
|
-
children: /* @__PURE__ */ (0,
|
|
6744
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChevronRight, { className: "h-5 w-5" })
|
|
6454
6745
|
}
|
|
6455
6746
|
) : null
|
|
6456
6747
|
] }),
|
|
6457
|
-
appendQuery ? /* @__PURE__ */ (0,
|
|
6458
|
-
/* @__PURE__ */ (0,
|
|
6748
|
+
appendQuery ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { "data-matrx-table-footer": true, className: "flex min-h-16 shrink-0 items-center justify-between gap-3 border-t border-border px-3 py-2", "aria-busy": isLoading || isFetching, children: [
|
|
6749
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { role: "status", "aria-live": "polite", className: "text-xs text-muted-foreground", children: [
|
|
6459
6750
|
isFetching ? "Loading more rows\u2026" : isLoading ? "Loading rows\u2026" : `${data.length.toLocaleString()} loaded${appendQuery.pagination.totalItems === void 0 ? "" : ` of ${appendQuery.pagination.totalItems.toLocaleString()}`}`,
|
|
6460
|
-
scrollPagination.error ? /* @__PURE__ */ (0,
|
|
6751
|
+
scrollPagination.error ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { role: "alert", className: "text-destructive", children: scrollPagination.error.message }) : null
|
|
6461
6752
|
] }),
|
|
6462
|
-
scrollPagination.error && !appendQuery.pagination.hasNextPage ? /* @__PURE__ */ (0,
|
|
6463
|
-
] }) : !hidePagination && totalItems > 0 ? /* @__PURE__ */ (0,
|
|
6753
|
+
scrollPagination.error && !appendQuery.pagination.hasNextPage ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Button, { type: "button", variant: "outline", onClick: appendQuery.pagination.refresh, children: "Reload rows" }) : appendQuery.pagination.hasNextPage || scrollPagination.error ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Button, { type: "button", variant: "outline", disabled: isLoading || isFetching, onClick: () => void scrollPagination.requestNextPage(), children: scrollPagination.error ? "Retry" : "Load more" }) : !isLoading ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-xs text-muted-foreground", children: "All rows loaded" }) : null
|
|
6754
|
+
] }) : !hidePagination && totalItems > 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6464
6755
|
GenericTablePagination,
|
|
6465
6756
|
{
|
|
6466
6757
|
totalItems,
|
|
@@ -6480,7 +6771,7 @@ function MatrxDataTableCore({
|
|
|
6480
6771
|
}
|
|
6481
6772
|
) }) : null
|
|
6482
6773
|
] }),
|
|
6483
|
-
/* @__PURE__ */ (0,
|
|
6774
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6484
6775
|
ColumnManager,
|
|
6485
6776
|
{
|
|
6486
6777
|
open: columnManagerOpen,
|
|
@@ -6494,7 +6785,7 @@ function MatrxDataTableCore({
|
|
|
6494
6785
|
}
|
|
6495
6786
|
}
|
|
6496
6787
|
),
|
|
6497
|
-
detailEnabled && selectedRow ? /* @__PURE__ */ (0,
|
|
6788
|
+
detailEnabled && selectedRow ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6498
6789
|
SidePanelSurface,
|
|
6499
6790
|
{
|
|
6500
6791
|
title: resolveStringTitle(
|
|
@@ -6505,8 +6796,8 @@ function MatrxDataTableCore({
|
|
|
6505
6796
|
description: detail?.description?.(selectedRow),
|
|
6506
6797
|
onClose: () => setSelectedId(null),
|
|
6507
6798
|
defaultWidth: detail?.defaultWidth ?? 480,
|
|
6508
|
-
headerActions: /* @__PURE__ */ (0,
|
|
6509
|
-
copy && showRowCopy ? /* @__PURE__ */ (0,
|
|
6799
|
+
headerActions: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
6800
|
+
copy && showRowCopy ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6510
6801
|
TableRowCopyControl,
|
|
6511
6802
|
{
|
|
6512
6803
|
size: "icon",
|
|
@@ -6515,7 +6806,7 @@ function MatrxDataTableCore({
|
|
|
6515
6806
|
}
|
|
6516
6807
|
) : null,
|
|
6517
6808
|
detail?.headerActions?.(selectedRow),
|
|
6518
|
-
windowEnabled ? /* @__PURE__ */ (0,
|
|
6809
|
+
windowEnabled ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6519
6810
|
Button,
|
|
6520
6811
|
{
|
|
6521
6812
|
type: "button",
|
|
@@ -6525,7 +6816,7 @@ function MatrxDataTableCore({
|
|
|
6525
6816
|
"aria-label": "Open in window",
|
|
6526
6817
|
title: "Open in window",
|
|
6527
6818
|
onClick: () => openWindow(selectedRow),
|
|
6528
|
-
children: /* @__PURE__ */ (0,
|
|
6819
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PanelRight, { className: "h-3.5 w-3.5" })
|
|
6529
6820
|
}
|
|
6530
6821
|
) : null
|
|
6531
6822
|
] }),
|
|
@@ -6537,7 +6828,7 @@ function MatrxDataTableCore({
|
|
|
6537
6828
|
// fixes the whole class at once — a custom body that already
|
|
6538
6829
|
// scrolls (`h-full` + `overflow-y-auto` root) still resolves to
|
|
6539
6830
|
// this container's height, so no second scrollbar appears.
|
|
6540
|
-
/* @__PURE__ */ (0,
|
|
6831
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "h-full min-h-0 overflow-y-auto", children: detail.render(selectedRow, {
|
|
6541
6832
|
closeDetail: () => setSelectedId(null),
|
|
6542
6833
|
openDetail: () => openDetail(selectedRow),
|
|
6543
6834
|
openWindow: () => openWindow(selectedRow),
|
|
@@ -6545,7 +6836,7 @@ function MatrxDataTableCore({
|
|
|
6545
6836
|
hasPendingEdits: Boolean(edits[getRowId(selectedRow)]),
|
|
6546
6837
|
discardPendingEdits: () => discardRowEdits(getRowId(selectedRow))
|
|
6547
6838
|
}) })
|
|
6548
|
-
) : /* @__PURE__ */ (0,
|
|
6839
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6549
6840
|
DataRowInspector,
|
|
6550
6841
|
{
|
|
6551
6842
|
row: selectedRow,
|
|
@@ -6557,7 +6848,7 @@ function MatrxDataTableCore({
|
|
|
6557
6848
|
)
|
|
6558
6849
|
}
|
|
6559
6850
|
) : null,
|
|
6560
|
-
windowRow ? /* @__PURE__ */ (0,
|
|
6851
|
+
windowRow ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6561
6852
|
DataRowWindow,
|
|
6562
6853
|
{
|
|
6563
6854
|
isOpen: true,
|
|
@@ -6568,8 +6859,8 @@ function MatrxDataTableCore({
|
|
|
6568
6859
|
height: windowConfig?.height,
|
|
6569
6860
|
windowId: `matrx-data-row-${urlState?.id ?? "local"}-${getRowId(windowRow)}`,
|
|
6570
6861
|
defaultTab: windowConfig?.defaultTab,
|
|
6571
|
-
headerActions: /* @__PURE__ */ (0,
|
|
6572
|
-
opensWindowOnRowClick && detailEnabled ? /* @__PURE__ */ (0,
|
|
6862
|
+
headerActions: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
6863
|
+
opensWindowOnRowClick && detailEnabled ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6573
6864
|
Button,
|
|
6574
6865
|
{
|
|
6575
6866
|
type: "button",
|
|
@@ -6582,10 +6873,10 @@ function MatrxDataTableCore({
|
|
|
6582
6873
|
closeWindow();
|
|
6583
6874
|
openDetail(windowRow);
|
|
6584
6875
|
},
|
|
6585
|
-
children: /* @__PURE__ */ (0,
|
|
6876
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PanelRightOpen, { className: "h-3.5 w-3.5" })
|
|
6586
6877
|
}
|
|
6587
6878
|
) : null,
|
|
6588
|
-
copy ? /* @__PURE__ */ (0,
|
|
6879
|
+
copy ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6589
6880
|
TableRowCopyControl,
|
|
6590
6881
|
{
|
|
6591
6882
|
size: "icon",
|
|
@@ -6601,7 +6892,7 @@ function MatrxDataTableCore({
|
|
|
6601
6892
|
closeWindow,
|
|
6602
6893
|
hasPendingEdits: Boolean(edits[getRowId(windowRow)]),
|
|
6603
6894
|
discardPendingEdits: () => discardRowEdits(getRowId(windowRow))
|
|
6604
|
-
}) ?? (copy ? /* @__PURE__ */ (0,
|
|
6895
|
+
}) ?? (copy ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6605
6896
|
DataRowInspector,
|
|
6606
6897
|
{
|
|
6607
6898
|
row: windowRow,
|
|
@@ -6636,23 +6927,65 @@ function MatrxDataTableCore({
|
|
|
6636
6927
|
})
|
|
6637
6928
|
}
|
|
6638
6929
|
) : null,
|
|
6639
|
-
editEnabled ? /* @__PURE__ */ (0,
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6930
|
+
editEnabled ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
6931
|
+
foreignDrafts.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6932
|
+
"div",
|
|
6933
|
+
{
|
|
6934
|
+
"data-matrx-foreign-drafts": true,
|
|
6935
|
+
className: "fixed inset-x-3 bottom-20 z-50 flex flex-wrap items-center justify-center gap-2 rounded-lg border border-amber-500/40 bg-card px-3 py-2 text-xs shadow-lg sm:inset-x-auto sm:left-1/2 sm:-translate-x-1/2 sm:flex-nowrap",
|
|
6936
|
+
children: [
|
|
6937
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: "Unsaved edits from previous results" }),
|
|
6938
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6939
|
+
CopyButtons,
|
|
6940
|
+
{
|
|
6941
|
+
size: "xs",
|
|
6942
|
+
label: "retained drafts",
|
|
6943
|
+
human: () => JSON.stringify(foreignDraftPayload, null, 2),
|
|
6944
|
+
json: () => foreignDraftPayload
|
|
6945
|
+
}
|
|
6946
|
+
),
|
|
6947
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Button, { type: "button", size: "sm", variant: "ghost", className: "h-7 text-xs text-destructive", onClick: () => setConfirmForeignDraftDiscard(true), children: "Discard drafts" })
|
|
6948
|
+
]
|
|
6949
|
+
}
|
|
6950
|
+
) : null,
|
|
6951
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6952
|
+
ConfirmDialog,
|
|
6953
|
+
{
|
|
6954
|
+
open: confirmForeignDraftDiscard,
|
|
6955
|
+
onOpenChange: setConfirmForeignDraftDiscard,
|
|
6956
|
+
title: "Discard unsaved edits from previous results?",
|
|
6957
|
+
description: "This permanently removes edits retained for other result sets. Copy drafts first if you may need them.",
|
|
6958
|
+
confirmLabel: "Discard drafts",
|
|
6959
|
+
cancelLabel: "Keep drafts",
|
|
6960
|
+
variant: "destructive",
|
|
6961
|
+
onConfirm: () => {
|
|
6962
|
+
setEditsByScope(
|
|
6963
|
+
(current) => Object.fromEntries(
|
|
6964
|
+
Object.entries(current).filter(([scope]) => scope === editScopeKey)
|
|
6965
|
+
)
|
|
6966
|
+
);
|
|
6967
|
+
setConfirmForeignDraftDiscard(false);
|
|
6968
|
+
}
|
|
6969
|
+
}
|
|
6970
|
+
),
|
|
6971
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6972
|
+
DirtySavePill,
|
|
6973
|
+
{
|
|
6974
|
+
changeCount,
|
|
6975
|
+
saving,
|
|
6976
|
+
onSave: () => void handleSaveEdits(),
|
|
6977
|
+
onCancel: handleCancelEdits
|
|
6978
|
+
}
|
|
6979
|
+
)
|
|
6980
|
+
] }) : null
|
|
6648
6981
|
]
|
|
6649
6982
|
}
|
|
6650
6983
|
),
|
|
6651
|
-
/* @__PURE__ */ (0,
|
|
6984
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_core.DragOverlay, { children: draggedRow ? (
|
|
6652
6985
|
// w-max: the overlay inherits the ACTIVE node's size, and the active
|
|
6653
6986
|
// node is the 16px grip handle — without it the label wraps to one
|
|
6654
6987
|
// character per line.
|
|
6655
|
-
/* @__PURE__ */ (0,
|
|
6988
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "w-max max-w-xs truncate rounded border border-border bg-card px-2.5 py-1.5 text-sm font-medium text-foreground shadow-md", children: hierarchy?.itemLabel?.(draggedRow) ?? "Moving row" })
|
|
6656
6989
|
) : null })
|
|
6657
6990
|
]
|
|
6658
6991
|
}
|
|
@@ -6667,7 +7000,7 @@ function HierarchyDragHandle({
|
|
|
6667
7000
|
id,
|
|
6668
7001
|
disabled
|
|
6669
7002
|
});
|
|
6670
|
-
return /* @__PURE__ */ (0,
|
|
7003
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6671
7004
|
"button",
|
|
6672
7005
|
{
|
|
6673
7006
|
ref: setNodeRef,
|
|
@@ -6679,7 +7012,7 @@ function HierarchyDragHandle({
|
|
|
6679
7012
|
onClick: (event) => event.stopPropagation(),
|
|
6680
7013
|
...attributes,
|
|
6681
7014
|
...listeners,
|
|
6682
|
-
children: /* @__PURE__ */ (0,
|
|
7015
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(GripVertical, { className: "h-3.5 w-3.5" })
|
|
6683
7016
|
}
|
|
6684
7017
|
);
|
|
6685
7018
|
}
|
|
@@ -6688,7 +7021,7 @@ function HierarchyRootDropTarget({
|
|
|
6688
7021
|
draggedLabel
|
|
6689
7022
|
}) {
|
|
6690
7023
|
const { isOver, setNodeRef } = (0, import_core.useDroppable)({ id: "__root__" });
|
|
6691
|
-
return /* @__PURE__ */ (0,
|
|
7024
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6692
7025
|
"div",
|
|
6693
7026
|
{
|
|
6694
7027
|
ref: setNodeRef,
|
|
@@ -6698,8 +7031,8 @@ function HierarchyRootDropTarget({
|
|
|
6698
7031
|
isOver && "border-solid bg-primary/20 shadow-md shadow-primary/25"
|
|
6699
7032
|
),
|
|
6700
7033
|
children: [
|
|
6701
|
-
/* @__PURE__ */ (0,
|
|
6702
|
-
/* @__PURE__ */ (0,
|
|
7034
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "truncate", children: draggedLabel }),
|
|
7035
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-primary/75", children: label })
|
|
6703
7036
|
]
|
|
6704
7037
|
}
|
|
6705
7038
|
);
|
|
@@ -6748,7 +7081,7 @@ function HierarchyDragIndicatorLayer({
|
|
|
6748
7081
|
const { preview } = indicator;
|
|
6749
7082
|
const indent = indicator.left + 10 + preview.depth * 12;
|
|
6750
7083
|
if (preview.position === "inside") {
|
|
6751
|
-
return /* @__PURE__ */ (0,
|
|
7084
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6752
7085
|
"div",
|
|
6753
7086
|
{
|
|
6754
7087
|
"aria-hidden": "true",
|
|
@@ -6760,7 +7093,7 @@ function HierarchyDragIndicatorLayer({
|
|
|
6760
7093
|
width: Math.max(0, indicator.width - 4),
|
|
6761
7094
|
height: indicator.height
|
|
6762
7095
|
},
|
|
6763
|
-
children: /* @__PURE__ */ (0,
|
|
7096
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6764
7097
|
"span",
|
|
6765
7098
|
{
|
|
6766
7099
|
className: "absolute top-1/2 -translate-y-1/2 whitespace-nowrap rounded bg-card/95 px-1.5 py-0.5 text-[10px] font-medium text-primary",
|
|
@@ -6775,7 +7108,7 @@ function HierarchyDragIndicatorLayer({
|
|
|
6775
7108
|
);
|
|
6776
7109
|
}
|
|
6777
7110
|
const lineTop = preview.position === "before" ? indicator.top - 1 : indicator.top + indicator.height - 1;
|
|
6778
|
-
return /* @__PURE__ */ (0,
|
|
7111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6779
7112
|
"div",
|
|
6780
7113
|
{
|
|
6781
7114
|
"aria-hidden": "true",
|
|
@@ -6786,9 +7119,9 @@ function HierarchyDragIndicatorLayer({
|
|
|
6786
7119
|
left: indent,
|
|
6787
7120
|
width: Math.max(0, indicator.left + indicator.width - indent - 8)
|
|
6788
7121
|
},
|
|
6789
|
-
children: /* @__PURE__ */ (0,
|
|
6790
|
-
/* @__PURE__ */ (0,
|
|
6791
|
-
/* @__PURE__ */ (0,
|
|
7122
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "relative h-0.5 rounded-full bg-primary", children: [
|
|
7123
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "absolute -left-1 top-1/2 h-2 w-2 -translate-y-1/2 rounded-full border-2 border-primary bg-card" }),
|
|
7124
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
6792
7125
|
"span",
|
|
6793
7126
|
{
|
|
6794
7127
|
className: cn(
|
|
@@ -6833,7 +7166,7 @@ function renderCell(row, col, index) {
|
|
|
6833
7166
|
if (asUuid && typeof raw === "string") {
|
|
6834
7167
|
const forbidden = typeof col.fk?.forbidden === "function" ? col.fk.forbidden(raw, row) : Boolean(col.fk?.forbidden);
|
|
6835
7168
|
const declaredToken = typeof col.fk?.token === "function" ? col.fk.token(row) : col.fk?.token;
|
|
6836
|
-
return /* @__PURE__ */ (0,
|
|
7169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6837
7170
|
MatrxUuidCell,
|
|
6838
7171
|
{
|
|
6839
7172
|
value: raw,
|
|
@@ -6845,7 +7178,7 @@ function renderCell(row, col, index) {
|
|
|
6845
7178
|
}
|
|
6846
7179
|
);
|
|
6847
7180
|
}
|
|
6848
|
-
return /* @__PURE__ */ (0,
|
|
7181
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-sm text-foreground", children: stringifyCellValue(raw) || "\u2014" });
|
|
6849
7182
|
}
|
|
6850
7183
|
function defaultRowTitle(row, columns) {
|
|
6851
7184
|
for (const col of columns) {
|