@pos-360/horizon 0.13.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-BRG5D46G.js → chunk-6CAMHXUV.js} +9 -5
- package/dist/chunk-6CAMHXUV.js.map +1 -0
- package/dist/{chunk-E7Q6YGBZ.mjs → chunk-6YUIM6WB.mjs} +212 -27
- package/dist/chunk-6YUIM6WB.mjs.map +1 -0
- package/dist/{chunk-ZH36QN2D.mjs → chunk-A4QVL4JL.mjs} +9 -5
- package/dist/chunk-A4QVL4JL.mjs.map +1 -0
- package/dist/{chunk-7LWVFFKM.js → chunk-AJP6WOSY.js} +211 -25
- package/dist/chunk-AJP6WOSY.js.map +1 -0
- package/dist/enhanced.d.mts +1 -0
- package/dist/enhanced.d.ts +1 -0
- package/dist/enhanced.js +27 -27
- package/dist/enhanced.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +132 -124
- package/dist/index.mjs +2 -2
- package/dist/primitives.d.mts +56 -6
- package/dist/primitives.d.ts +56 -6
- package/dist/primitives.js +105 -97
- package/dist/primitives.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-7LWVFFKM.js.map +0 -1
- package/dist/chunk-BRG5D46G.js.map +0 -1
- package/dist/chunk-E7Q6YGBZ.mjs.map +0 -1
- package/dist/chunk-ZH36QN2D.mjs.map +0 -1
|
@@ -683,7 +683,8 @@ var Select = ({
|
|
|
683
683
|
) });
|
|
684
684
|
};
|
|
685
685
|
var SelectGroup = SelectPrimitive__namespace.Group;
|
|
686
|
-
var SelectValue = SelectPrimitive__namespace.Value;
|
|
686
|
+
var SelectValue = React9__namespace.forwardRef(({ children, placeholder, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Value, { ref, placeholder, ...props, children }));
|
|
687
|
+
SelectValue.displayName = SelectPrimitive__namespace.Value.displayName;
|
|
687
688
|
var SelectTrigger = React9__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
688
689
|
SelectPrimitive__namespace.Trigger,
|
|
689
690
|
{
|
|
@@ -754,8 +755,10 @@ var SelectContent = React9__namespace.forwardRef(({ className, children, positio
|
|
|
754
755
|
sticky,
|
|
755
756
|
hideWhenDetached
|
|
756
757
|
} = props;
|
|
757
|
-
|
|
758
|
-
|
|
758
|
+
const ForceMountPortal = SelectPrimitive__namespace.Portal;
|
|
759
|
+
const ForceMountContent = SelectPrimitive__namespace.Content;
|
|
760
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ForceMountPortal, { forceMount: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
761
|
+
ForceMountContent,
|
|
759
762
|
{
|
|
760
763
|
ref,
|
|
761
764
|
position,
|
|
@@ -773,12 +776,12 @@ var SelectContent = React9__namespace.forwardRef(({ className, children, positio
|
|
|
773
776
|
onEscapeKeyDown,
|
|
774
777
|
onPointerDownOutside,
|
|
775
778
|
asChild: true,
|
|
779
|
+
...{ forceMount: true },
|
|
776
780
|
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
777
781
|
framerMotion.motion.div,
|
|
778
782
|
{
|
|
779
|
-
initial:
|
|
780
|
-
animate: { opacity: 1, scale: 1, y: 0 },
|
|
781
|
-
exit: { opacity: 0, scale: 0.96, y: -8 },
|
|
783
|
+
initial: false,
|
|
784
|
+
animate: open ? { opacity: 1, scale: 1, y: 0, pointerEvents: "auto" } : { opacity: 0, scale: 0.96, y: -8, pointerEvents: "none" },
|
|
782
785
|
transition: {
|
|
783
786
|
type: "spring",
|
|
784
787
|
stiffness: 400,
|
|
@@ -823,7 +826,7 @@ var SelectContent = React9__namespace.forwardRef(({ className, children, positio
|
|
|
823
826
|
}
|
|
824
827
|
)
|
|
825
828
|
}
|
|
826
|
-
) })
|
|
829
|
+
) });
|
|
827
830
|
});
|
|
828
831
|
SelectContent.displayName = SelectPrimitive__namespace.Content.displayName;
|
|
829
832
|
var SelectLabel = React9__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -967,7 +970,7 @@ var useTableContext = () => {
|
|
|
967
970
|
const context = React9__namespace.useContext(TableContext);
|
|
968
971
|
return context;
|
|
969
972
|
};
|
|
970
|
-
var
|
|
973
|
+
var TableInner = React9__namespace.forwardRef(
|
|
971
974
|
({
|
|
972
975
|
className,
|
|
973
976
|
selectable = false,
|
|
@@ -976,10 +979,18 @@ var Table = React9__namespace.forwardRef(
|
|
|
976
979
|
onSelectionChange,
|
|
977
980
|
getRowId,
|
|
978
981
|
rows,
|
|
982
|
+
columns,
|
|
983
|
+
data,
|
|
984
|
+
visibleColumns,
|
|
985
|
+
showDividers = false,
|
|
986
|
+
highlightMode = "row",
|
|
987
|
+
children,
|
|
979
988
|
...props
|
|
980
989
|
}, ref) => {
|
|
981
990
|
const [internalSelectedRows, setInternalSelectedRows] = React9__namespace.useState(/* @__PURE__ */ new Set());
|
|
982
991
|
const [registeredRowIds, setRegisteredRowIds] = React9__namespace.useState(/* @__PURE__ */ new Set());
|
|
992
|
+
const [hoveredCol, setHoveredCol] = React9__namespace.useState(null);
|
|
993
|
+
const [hoveredRowIndex, setHoveredRowIndex] = React9__namespace.useState(null);
|
|
983
994
|
const isControlled = controlledSelectedRows !== void 0;
|
|
984
995
|
const selectedRowsSet = isControlled ? new Set(controlledSelectedRows) : internalSelectedRows;
|
|
985
996
|
const defaultGetRowId = React9__namespace.useCallback((row) => {
|
|
@@ -1096,17 +1107,82 @@ var Table = React9__namespace.forwardRef(
|
|
|
1096
1107
|
registerRowId,
|
|
1097
1108
|
unregisterRowId
|
|
1098
1109
|
]);
|
|
1099
|
-
return /* @__PURE__ */ jsxRuntime.jsx(TableContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1100
|
-
"
|
|
1110
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TableContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1111
|
+
"div",
|
|
1101
1112
|
{
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1113
|
+
className: "relative w-full overflow-auto",
|
|
1114
|
+
onMouseLeave: () => {
|
|
1115
|
+
setHoveredCol(null);
|
|
1116
|
+
setHoveredRowIndex(null);
|
|
1117
|
+
},
|
|
1118
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1119
|
+
"table",
|
|
1120
|
+
{
|
|
1121
|
+
ref,
|
|
1122
|
+
className: chunkYO72COII_js.cn("w-full caption-bottom text-sm", className),
|
|
1123
|
+
...props,
|
|
1124
|
+
children: columns && data ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: (() => {
|
|
1125
|
+
const visibleCols = columns.filter(
|
|
1126
|
+
(col) => col.sticky || !visibleColumns || visibleColumns.includes(col.key)
|
|
1127
|
+
);
|
|
1128
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1129
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "[&_tr]:border-b [&_tr]:border-gray-200 dark:[&_tr]:border-gray-700", children: /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "border-b border-gray-200 transition-colors dark:border-neutral-700", children: visibleCols.map((col) => {
|
|
1130
|
+
const isColHovered = (highlightMode === "column" || highlightMode === "cross") && hoveredCol === col.key;
|
|
1131
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1132
|
+
"th",
|
|
1133
|
+
{
|
|
1134
|
+
style: col.minWidth ? { minWidth: col.minWidth } : void 0,
|
|
1135
|
+
onMouseEnter: () => {
|
|
1136
|
+
if (highlightMode === "column" || highlightMode === "cross") setHoveredCol(col.key);
|
|
1137
|
+
},
|
|
1138
|
+
className: chunkYO72COII_js.cn(
|
|
1139
|
+
"h-12 px-4 text-left align-middle font-medium text-gray-500 dark:text-gray-400 transition-colors",
|
|
1140
|
+
col.sticky ? chunkYO72COII_js.cn("sticky left-0 z-20", isColHovered ? "bg-gray-50 dark:bg-neutral-800/50" : "bg-white dark:bg-neutral-900") : isColHovered ? "bg-gray-50 dark:bg-neutral-800/50" : void 0,
|
|
1141
|
+
showDividers && "border-r border-gray-200 dark:border-neutral-700"
|
|
1142
|
+
),
|
|
1143
|
+
children: col.label
|
|
1144
|
+
},
|
|
1145
|
+
col.key
|
|
1146
|
+
);
|
|
1147
|
+
}) }) }),
|
|
1148
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "[&_tr:last-child]:border-0", children: data.map((row, rowIndex) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1149
|
+
"tr",
|
|
1150
|
+
{
|
|
1151
|
+
className: "border-b border-gray-200 transition-colors dark:border-neutral-700",
|
|
1152
|
+
children: visibleCols.map((col) => {
|
|
1153
|
+
const isRowHovered = (highlightMode === "row" || highlightMode === "cross") && rowIndex === hoveredRowIndex;
|
|
1154
|
+
const isColHovered = (highlightMode === "column" || highlightMode === "cross") && hoveredCol === col.key;
|
|
1155
|
+
const isHighlighted = isRowHovered || isColHovered;
|
|
1156
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1157
|
+
"td",
|
|
1158
|
+
{
|
|
1159
|
+
onMouseEnter: () => {
|
|
1160
|
+
if (highlightMode === "column" || highlightMode === "cross") setHoveredCol(col.key);
|
|
1161
|
+
if (highlightMode === "row" || highlightMode === "cross") setHoveredRowIndex(rowIndex);
|
|
1162
|
+
},
|
|
1163
|
+
className: chunkYO72COII_js.cn(
|
|
1164
|
+
"p-4 align-middle transition-colors",
|
|
1165
|
+
col.sticky ? chunkYO72COII_js.cn("sticky left-0 z-20", isHighlighted ? "bg-gray-50 dark:bg-neutral-800/50" : "bg-white dark:bg-neutral-900") : isHighlighted ? "bg-gray-50 dark:bg-neutral-800/50" : void 0,
|
|
1166
|
+
showDividers && "border-r border-gray-200 dark:border-neutral-700"
|
|
1167
|
+
),
|
|
1168
|
+
children: col.cell(row)
|
|
1169
|
+
},
|
|
1170
|
+
col.key
|
|
1171
|
+
);
|
|
1172
|
+
})
|
|
1173
|
+
},
|
|
1174
|
+
finalGetRowId ? finalGetRowId(row) : rowIndex
|
|
1175
|
+
)) })
|
|
1176
|
+
] });
|
|
1177
|
+
})() }) : children
|
|
1178
|
+
}
|
|
1179
|
+
)
|
|
1105
1180
|
}
|
|
1106
|
-
) })
|
|
1181
|
+
) });
|
|
1107
1182
|
}
|
|
1108
1183
|
);
|
|
1109
|
-
|
|
1184
|
+
TableInner.displayName = "Table";
|
|
1185
|
+
var Table = TableInner;
|
|
1110
1186
|
var TableHeader = React9__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1111
1187
|
"thead",
|
|
1112
1188
|
{
|
|
@@ -1193,14 +1269,20 @@ var TableHead = React9__namespace.forwardRef(({ className, ...props }, ref) => /
|
|
|
1193
1269
|
}
|
|
1194
1270
|
));
|
|
1195
1271
|
TableHead.displayName = "TableHead";
|
|
1196
|
-
var TableCell = React9__namespace.forwardRef(
|
|
1197
|
-
"
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1272
|
+
var TableCell = React9__namespace.forwardRef(
|
|
1273
|
+
({ className, variant = "default", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1274
|
+
"td",
|
|
1275
|
+
{
|
|
1276
|
+
ref,
|
|
1277
|
+
className: chunkYO72COII_js.cn(
|
|
1278
|
+
"align-middle [&:has([role=checkbox])]:pr-0",
|
|
1279
|
+
variant === "embed" ? "p-1.5" : "p-4",
|
|
1280
|
+
className
|
|
1281
|
+
),
|
|
1282
|
+
...props
|
|
1283
|
+
}
|
|
1284
|
+
)
|
|
1285
|
+
);
|
|
1204
1286
|
TableCell.displayName = "TableCell";
|
|
1205
1287
|
var TableCaption = React9__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1206
1288
|
"caption",
|
|
@@ -1269,6 +1351,108 @@ var useTableSelection = () => {
|
|
|
1269
1351
|
}
|
|
1270
1352
|
return context;
|
|
1271
1353
|
};
|
|
1354
|
+
function getDefaultColumns(columns, isMobile) {
|
|
1355
|
+
return columns.filter((col) => {
|
|
1356
|
+
if (col.sticky) return true;
|
|
1357
|
+
if (isMobile) return col.mobileVisible === true;
|
|
1358
|
+
return col.defaultVisible !== false;
|
|
1359
|
+
}).map((col) => col.key);
|
|
1360
|
+
}
|
|
1361
|
+
function useColumnVisibility(columns, options = {}) {
|
|
1362
|
+
const { storageKey } = options;
|
|
1363
|
+
const [visibleColumns, setVisibleColumnsState] = React9.useState(() => {
|
|
1364
|
+
if (storageKey && typeof window !== "undefined") {
|
|
1365
|
+
try {
|
|
1366
|
+
const saved = localStorage.getItem(storageKey);
|
|
1367
|
+
if (saved) {
|
|
1368
|
+
const parsed = JSON.parse(saved);
|
|
1369
|
+
const stickyKeys = columns.filter((c) => c.sticky).map((c) => c.key);
|
|
1370
|
+
return Array.from(/* @__PURE__ */ new Set([...stickyKeys, ...parsed]));
|
|
1371
|
+
}
|
|
1372
|
+
} catch {
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
return getDefaultColumns(columns, false);
|
|
1376
|
+
});
|
|
1377
|
+
React9.useEffect(() => {
|
|
1378
|
+
if (storageKey) {
|
|
1379
|
+
try {
|
|
1380
|
+
const saved = localStorage.getItem(storageKey);
|
|
1381
|
+
if (saved) return;
|
|
1382
|
+
} catch {
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
const isMobile = window.innerWidth < 768;
|
|
1386
|
+
if (isMobile) {
|
|
1387
|
+
setVisibleColumnsState(getDefaultColumns(columns, true));
|
|
1388
|
+
}
|
|
1389
|
+
}, []);
|
|
1390
|
+
const setVisibleColumns = React9.useCallback((cols) => {
|
|
1391
|
+
const stickyKeys = columns.filter((c) => c.sticky).map((c) => c.key);
|
|
1392
|
+
const merged = Array.from(/* @__PURE__ */ new Set([...stickyKeys, ...cols]));
|
|
1393
|
+
setVisibleColumnsState(merged);
|
|
1394
|
+
if (storageKey) {
|
|
1395
|
+
try {
|
|
1396
|
+
localStorage.setItem(storageKey, JSON.stringify(merged));
|
|
1397
|
+
} catch {
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
}, [columns, storageKey]);
|
|
1401
|
+
return { visibleColumns, setVisibleColumns };
|
|
1402
|
+
}
|
|
1403
|
+
function ColumnPicker({
|
|
1404
|
+
columns,
|
|
1405
|
+
visibleColumns,
|
|
1406
|
+
onVisibleColumnsChange,
|
|
1407
|
+
triggerLabel = "Edit Fields"
|
|
1408
|
+
}) {
|
|
1409
|
+
const handleToggle = React9__namespace.useCallback((key, checked) => {
|
|
1410
|
+
if (checked) {
|
|
1411
|
+
if (!visibleColumns.includes(key)) {
|
|
1412
|
+
onVisibleColumnsChange([...visibleColumns, key]);
|
|
1413
|
+
}
|
|
1414
|
+
} else {
|
|
1415
|
+
onVisibleColumnsChange(visibleColumns.filter((k) => k !== key));
|
|
1416
|
+
}
|
|
1417
|
+
}, [visibleColumns, onVisibleColumnsChange]);
|
|
1418
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
|
|
1419
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "outline", size: "sm", children: [
|
|
1420
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.SlidersHorizontal, { className: "h-4 w-4", "aria-hidden": "true" }),
|
|
1421
|
+
triggerLabel
|
|
1422
|
+
] }) }),
|
|
1423
|
+
/* @__PURE__ */ jsxRuntime.jsxs(PopoverContent, { align: "end", className: "w-56 p-2", children: [
|
|
1424
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-2 py-1.5 text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wide", children: "Columns" }),
|
|
1425
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1 mt-1", children: columns.map((col) => {
|
|
1426
|
+
const isSticky = !!col.sticky;
|
|
1427
|
+
const isChecked = isSticky || visibleColumns.includes(col.key);
|
|
1428
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1429
|
+
"label",
|
|
1430
|
+
{
|
|
1431
|
+
className: chunkYO72COII_js.cn(
|
|
1432
|
+
"flex items-center gap-2.5 rounded-hz-md px-2 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-neutral-800",
|
|
1433
|
+
isSticky && "opacity-50 cursor-not-allowed"
|
|
1434
|
+
),
|
|
1435
|
+
children: [
|
|
1436
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1437
|
+
Checkbox,
|
|
1438
|
+
{
|
|
1439
|
+
"aria-label": col.label,
|
|
1440
|
+
checked: isChecked,
|
|
1441
|
+
disabled: isSticky,
|
|
1442
|
+
onCheckedChange: (checked) => {
|
|
1443
|
+
if (!isSticky) handleToggle(col.key, !!checked);
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
),
|
|
1447
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-700 dark:text-gray-300", children: col.label })
|
|
1448
|
+
]
|
|
1449
|
+
},
|
|
1450
|
+
col.key
|
|
1451
|
+
);
|
|
1452
|
+
}) })
|
|
1453
|
+
] })
|
|
1454
|
+
] });
|
|
1455
|
+
}
|
|
1272
1456
|
var TabsContext = React9__namespace.createContext(null);
|
|
1273
1457
|
var useTabsContext = () => {
|
|
1274
1458
|
const context = React9__namespace.useContext(TabsContext);
|
|
@@ -1727,6 +1911,7 @@ exports.CardFooter = CardFooter;
|
|
|
1727
1911
|
exports.CardHeader = CardHeader;
|
|
1728
1912
|
exports.CardTitle = CardTitle;
|
|
1729
1913
|
exports.Checkbox = Checkbox;
|
|
1914
|
+
exports.ColumnPicker = ColumnPicker;
|
|
1730
1915
|
exports.Dialog = Dialog;
|
|
1731
1916
|
exports.DialogClose = DialogClose;
|
|
1732
1917
|
exports.DialogContent = DialogContent;
|
|
@@ -1812,8 +1997,9 @@ exports.switchThumbVariants = switchThumbVariants;
|
|
|
1812
1997
|
exports.switchTrackVariants = switchTrackVariants;
|
|
1813
1998
|
exports.toggleGroupVariants = toggleGroupVariants;
|
|
1814
1999
|
exports.toggleItemVariants = toggleItemVariants;
|
|
2000
|
+
exports.useColumnVisibility = useColumnVisibility;
|
|
1815
2001
|
exports.useFormContext = useFormContext;
|
|
1816
2002
|
exports.useFormFieldContext = useFormFieldContext;
|
|
1817
2003
|
exports.useTableSelection = useTableSelection;
|
|
1818
|
-
//# sourceMappingURL=chunk-
|
|
1819
|
-
//# sourceMappingURL=chunk-
|
|
2004
|
+
//# sourceMappingURL=chunk-AJP6WOSY.js.map
|
|
2005
|
+
//# sourceMappingURL=chunk-AJP6WOSY.js.map
|