@upbound/monarch-blocks 0.13.1 → 0.13.3
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/chat-interface.js +60 -59
- package/dist/chat-interface.js.map +1 -1
- package/dist/data-table.d.ts +4 -3
- package/dist/data-table.js +429 -383
- package/dist/data-table.js.map +1 -1
- package/dist/{empty-view-BgEn71l5.d.ts → empty-view-DQt8-Ho8.d.ts} +9 -2
- package/dist/graph.d.ts +1 -1
- package/dist/graph.js +242 -185
- package/dist/graph.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +633 -603
- package/dist/index.js.map +1 -1
- package/dist/relative-time.d.ts +1 -1
- package/dist/relative-time.js +6 -11
- package/dist/relative-time.js.map +1 -1
- package/package.json +6 -6
package/dist/data-table.js
CHANGED
|
@@ -134,6 +134,12 @@ function sortBy(items, getKey) {
|
|
|
134
134
|
return [...items].sort((a, b) => getKey(a).localeCompare(getKey(b)));
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
// src/lib/data-table/filter-types.ts
|
|
138
|
+
var isDateRangeColumnFilter = (definition) => definition.type === "dateRange";
|
|
139
|
+
var isRadioColumnFilter = (definition) => definition.type === "radio";
|
|
140
|
+
var isCheckboxColumnFilter = (definition) => definition.type === "checkbox";
|
|
141
|
+
var isMultiTextColumnFilter = (definition) => definition.type === "multiText";
|
|
142
|
+
|
|
137
143
|
// src/lib/data-table/utils.ts
|
|
138
144
|
var TO_EACH_SIDE = 2;
|
|
139
145
|
function normalizeColumnOrdering(columnOrdering, allColumnIds) {
|
|
@@ -190,17 +196,38 @@ function getPaginationInfo(pageIndex, totalRows, pageSize) {
|
|
|
190
196
|
itemEnd: Math.min(currentPage * pageSize, totalRows)
|
|
191
197
|
};
|
|
192
198
|
}
|
|
199
|
+
var filterColumnByCheckedValues = Object.assign(
|
|
200
|
+
(row, columnId, checkedValues) => {
|
|
201
|
+
if (!(checkedValues == null ? void 0 : checkedValues.length)) return true;
|
|
202
|
+
const value = row.getValue(columnId);
|
|
203
|
+
const values = Array.isArray(value) ? value : [value];
|
|
204
|
+
return values.some((item) => item != null && checkedValues.includes(String(item)));
|
|
205
|
+
},
|
|
206
|
+
{ autoRemove: (checkedValues) => !Array.isArray(checkedValues) || checkedValues.length === 0 }
|
|
207
|
+
);
|
|
208
|
+
function withDefaultFilterFns(columns) {
|
|
209
|
+
return columns.map((column) => {
|
|
210
|
+
var _a;
|
|
211
|
+
let next = column;
|
|
212
|
+
if ("columns" in column && column.columns) {
|
|
213
|
+
next = __spreadProps(__spreadValues({}, next), { columns: withDefaultFilterFns(column.columns) });
|
|
214
|
+
}
|
|
215
|
+
const filter = (_a = column.meta) == null ? void 0 : _a.filter;
|
|
216
|
+
if (filter && isCheckboxColumnFilter(filter) && column.filterFn === void 0) {
|
|
217
|
+
next = __spreadProps(__spreadValues({}, next), { filterFn: filterColumnByCheckedValues });
|
|
218
|
+
}
|
|
219
|
+
return next;
|
|
220
|
+
});
|
|
221
|
+
}
|
|
193
222
|
function isFilterOnlyColumn(column) {
|
|
194
223
|
var _a;
|
|
195
224
|
return ((_a = column.columnDef.meta) == null ? void 0 : _a.filterOnly) === true;
|
|
196
225
|
}
|
|
197
226
|
function hasFilterableColumns(columns) {
|
|
198
|
-
return columns.some(
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
);
|
|
227
|
+
return columns.some((column) => {
|
|
228
|
+
var _a;
|
|
229
|
+
return column.getCanFilter() && !!((_a = column.columnDef.meta) == null ? void 0 : _a.filter);
|
|
230
|
+
});
|
|
204
231
|
}
|
|
205
232
|
function getTableState({
|
|
206
233
|
error,
|
|
@@ -439,6 +466,7 @@ import { Link } from "@upbound/monarch-core";
|
|
|
439
466
|
|
|
440
467
|
// src/relative-time.tsx
|
|
441
468
|
import * as React2 from "react";
|
|
469
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "@upbound/monarch-core";
|
|
442
470
|
|
|
443
471
|
// src/hooks/use-mounted.ts
|
|
444
472
|
import { useSyncExternalStore } from "react";
|
|
@@ -455,7 +483,7 @@ function useMounted() {
|
|
|
455
483
|
}
|
|
456
484
|
|
|
457
485
|
// src/relative-time.tsx
|
|
458
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
486
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
459
487
|
function formatRelativeDefault(date, locale) {
|
|
460
488
|
const now = /* @__PURE__ */ new Date();
|
|
461
489
|
const diffMs = now.getTime() - date.getTime();
|
|
@@ -560,27 +588,21 @@ function RelativeTime(_a) {
|
|
|
560
588
|
const id = schedule();
|
|
561
589
|
return () => window.clearInterval(id);
|
|
562
590
|
}, [d, variant, locale]);
|
|
563
|
-
return /* @__PURE__ */
|
|
564
|
-
"time",
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
title: title != null ? title : absoluteTitle(d, locale),
|
|
568
|
-
className: cn("tabular-nums", className)
|
|
569
|
-
}, props), {
|
|
570
|
-
children: label
|
|
571
|
-
})
|
|
572
|
-
);
|
|
591
|
+
return /* @__PURE__ */ jsxs3(Tooltip, { children: [
|
|
592
|
+
/* @__PURE__ */ jsx3(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx3("time", __spreadProps(__spreadValues({ dateTime: d.toISOString(), className: cn("tabular-nums", className) }, props), { children: label })) }),
|
|
593
|
+
/* @__PURE__ */ jsx3(TooltipContent, { children: title != null ? title : absoluteTitle(d, locale) })
|
|
594
|
+
] });
|
|
573
595
|
}
|
|
574
596
|
|
|
575
597
|
// src/data-table/columns.tsx
|
|
576
|
-
import { Tooltip, TooltipContent, TooltipTrigger } from "@upbound/monarch-core";
|
|
577
|
-
import { jsx as jsx4, jsxs as
|
|
598
|
+
import { Tooltip as Tooltip2, TooltipContent as TooltipContent2, TooltipTrigger as TooltipTrigger2 } from "@upbound/monarch-core";
|
|
599
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
578
600
|
function RowActions({
|
|
579
601
|
align = "end",
|
|
580
602
|
children,
|
|
581
603
|
contentClassName
|
|
582
604
|
}) {
|
|
583
|
-
return /* @__PURE__ */
|
|
605
|
+
return /* @__PURE__ */ jsxs4(DropdownMenu2, { children: [
|
|
584
606
|
/* @__PURE__ */ jsx4(DropdownMenuTrigger2, { asChild: true, children: /* @__PURE__ */ jsx4(
|
|
585
607
|
Button2,
|
|
586
608
|
{
|
|
@@ -612,9 +634,9 @@ function RowActionItem({
|
|
|
612
634
|
}) {
|
|
613
635
|
const item = /* @__PURE__ */ jsx4(DropdownMenuItem2, { variant, disabled, className, onClick, children });
|
|
614
636
|
if (!tooltip) return item;
|
|
615
|
-
return /* @__PURE__ */
|
|
616
|
-
/* @__PURE__ */ jsx4(
|
|
617
|
-
/* @__PURE__ */ jsx4(
|
|
637
|
+
return /* @__PURE__ */ jsxs4(Tooltip2, { children: [
|
|
638
|
+
/* @__PURE__ */ jsx4(TooltipTrigger2, { asChild: true, children: /* @__PURE__ */ jsx4("span", { className: "block", children: item }) }),
|
|
639
|
+
/* @__PURE__ */ jsx4(TooltipContent2, { children: tooltip })
|
|
618
640
|
] });
|
|
619
641
|
}
|
|
620
642
|
function getActionsColumnDefinition({
|
|
@@ -672,8 +694,8 @@ function DataTableValueCell({ content, title, className, href, onClick }) {
|
|
|
672
694
|
return /* @__PURE__ */ jsx4("p", { className: baseClassName, children: /* @__PURE__ */ jsx4(Link, { href, title, onClick, children: content }) });
|
|
673
695
|
}
|
|
674
696
|
if (title) {
|
|
675
|
-
return /* @__PURE__ */
|
|
676
|
-
/* @__PURE__ */ jsx4(
|
|
697
|
+
return /* @__PURE__ */ jsxs4(Tooltip2, { children: [
|
|
698
|
+
/* @__PURE__ */ jsx4(TooltipTrigger2, { asChild: true, children: /* @__PURE__ */ jsx4(
|
|
677
699
|
"button",
|
|
678
700
|
{
|
|
679
701
|
type: "button",
|
|
@@ -685,7 +707,7 @@ function DataTableValueCell({ content, title, className, href, onClick }) {
|
|
|
685
707
|
children: content
|
|
686
708
|
}
|
|
687
709
|
) }),
|
|
688
|
-
/* @__PURE__ */ jsx4(
|
|
710
|
+
/* @__PURE__ */ jsx4(TooltipContent2, { side: "bottom", children: title })
|
|
689
711
|
] });
|
|
690
712
|
}
|
|
691
713
|
return /* @__PURE__ */ jsx4("p", { className: baseClassName, children: content ? /* @__PURE__ */ jsx4("span", { children: content }) : /* @__PURE__ */ jsx4("span", { children: "\u2014" }) });
|
|
@@ -696,7 +718,7 @@ function TimestampCell({ timestamp }) {
|
|
|
696
718
|
}
|
|
697
719
|
|
|
698
720
|
// src/data-table/data-table.tsx
|
|
699
|
-
import * as
|
|
721
|
+
import * as React10 from "react";
|
|
700
722
|
import {
|
|
701
723
|
useTable
|
|
702
724
|
} from "@tanstack/react-table";
|
|
@@ -1675,7 +1697,7 @@ function removeConditionById(tree, conditionId) {
|
|
|
1675
1697
|
}
|
|
1676
1698
|
|
|
1677
1699
|
// src/cel-filter-bar/cel-filter-bar.tsx
|
|
1678
|
-
import { Fragment as Fragment3, jsx as jsx5, jsxs as
|
|
1700
|
+
import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1679
1701
|
var RELATIVE_PRESET_LABELS = {
|
|
1680
1702
|
"24h": "Last 24 hours",
|
|
1681
1703
|
"168h": "Last 7 days",
|
|
@@ -1731,7 +1753,7 @@ function CelFilterBar({
|
|
|
1731
1753
|
onChange({ root: __spreadProps(__spreadValues({}, tree.root), { children: [] }) });
|
|
1732
1754
|
editor.clearSuppress();
|
|
1733
1755
|
}
|
|
1734
|
-
return /* @__PURE__ */
|
|
1756
|
+
return /* @__PURE__ */ jsxs5("div", { "data-slot": "cel-filter-bar", className: cn("flex flex-wrap items-center gap-2", className), ref: containerRef, children: [
|
|
1735
1757
|
/* @__PURE__ */ jsx5(CelAddFilterButton, { schema, conditions, onSelect: handleAddFilter, container: containerRef }),
|
|
1736
1758
|
conditions.map((condition) => {
|
|
1737
1759
|
const columnDef = resolveColumnDefinition(condition, schema);
|
|
@@ -1780,7 +1802,7 @@ function CelAddFilterButton({
|
|
|
1780
1802
|
Array.from(groupMap.entries()).map(([value, items]) => ({ value, items: sortBy(items, (item) => item.title) })),
|
|
1781
1803
|
(group) => group.value
|
|
1782
1804
|
);
|
|
1783
|
-
return /* @__PURE__ */
|
|
1805
|
+
return /* @__PURE__ */ jsxs5(
|
|
1784
1806
|
Combobox,
|
|
1785
1807
|
{
|
|
1786
1808
|
items: groups,
|
|
@@ -1791,14 +1813,14 @@ function CelAddFilterButton({
|
|
|
1791
1813
|
if (column) onSelect(column.id);
|
|
1792
1814
|
},
|
|
1793
1815
|
children: [
|
|
1794
|
-
/* @__PURE__ */
|
|
1816
|
+
/* @__PURE__ */ jsxs5(ComboboxTrigger, { "aria-label": "Add filter", showIndicator: false, render: /* @__PURE__ */ jsx5(Button3, { variant: "outline" }), children: [
|
|
1795
1817
|
/* @__PURE__ */ jsx5(Icon3, { name: "plus", "data-icon": "inline-start" }),
|
|
1796
1818
|
"Add filter"
|
|
1797
1819
|
] }),
|
|
1798
|
-
/* @__PURE__ */
|
|
1820
|
+
/* @__PURE__ */ jsxs5(ComboboxContent, { container, align: "start", className: "w-64", children: [
|
|
1799
1821
|
/* @__PURE__ */ jsx5(ComboboxInput, { showTrigger: false, placeholder: "Search filters\u2026" }),
|
|
1800
1822
|
/* @__PURE__ */ jsx5(ComboboxEmpty, { children: "No filters found." }),
|
|
1801
|
-
/* @__PURE__ */ jsx5(ComboboxList, { children: (group) => /* @__PURE__ */
|
|
1823
|
+
/* @__PURE__ */ jsx5(ComboboxList, { children: (group) => /* @__PURE__ */ jsxs5(ComboboxGroup, { items: group.items, children: [
|
|
1802
1824
|
group.value && /* @__PURE__ */ jsx5(ComboboxLabel, { children: group.value }),
|
|
1803
1825
|
/* @__PURE__ */ jsx5(ComboboxCollection, { children: (column) => /* @__PURE__ */ jsx5(ComboboxItem, { value: column, children: column.title }, column.id) })
|
|
1804
1826
|
] }, group.value) })
|
|
@@ -1908,7 +1930,7 @@ function CelFilterPill({
|
|
|
1908
1930
|
if (hadValue && next.value === void 0) controller.beginEditing();
|
|
1909
1931
|
}
|
|
1910
1932
|
const allowedOperators = getAllowedOperators(columnDef);
|
|
1911
|
-
return /* @__PURE__ */
|
|
1933
|
+
return /* @__PURE__ */ jsxs5(
|
|
1912
1934
|
Popover,
|
|
1913
1935
|
{
|
|
1914
1936
|
open: controller.popoverVisible,
|
|
@@ -1917,7 +1939,7 @@ function CelFilterPill({
|
|
|
1917
1939
|
else if (!controller.isDismissSuppressed()) controller.handlePopoverDismiss();
|
|
1918
1940
|
},
|
|
1919
1941
|
children: [
|
|
1920
|
-
/* @__PURE__ */
|
|
1942
|
+
/* @__PURE__ */ jsxs5(ButtonGroup, { children: [
|
|
1921
1943
|
/* @__PURE__ */ jsx5(ButtonGroupText, { children: columnDef.title }),
|
|
1922
1944
|
/* @__PURE__ */ jsx5(
|
|
1923
1945
|
CelOperatorSegment,
|
|
@@ -1937,13 +1959,13 @@ function CelFilterPill({
|
|
|
1937
1959
|
onChangeValue: updateValue
|
|
1938
1960
|
}
|
|
1939
1961
|
),
|
|
1940
|
-
/* @__PURE__ */ jsx5(PopoverTrigger, { asChild: true, children: /* @__PURE__ */
|
|
1962
|
+
/* @__PURE__ */ jsx5(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs5(Button3, { variant: "outline", className: "gap-1 font-normal", children: [
|
|
1941
1963
|
/* @__PURE__ */ jsx5("span", { className: cn(issues.length > 0 && "text-destructive"), children: formatConditionSummary(condition, columnDef, locale) }),
|
|
1942
1964
|
/* @__PURE__ */ jsx5(Icon3, { name: "chevron-down", size: "sm", className: "text-muted-foreground" })
|
|
1943
1965
|
] }) }),
|
|
1944
1966
|
/* @__PURE__ */ jsx5(Button3, { variant: "outline", size: "icon", "aria-label": `Remove ${columnDef.title} filter`, onClick: onRemove, children: /* @__PURE__ */ jsx5(Icon3, { name: "xmark" }) })
|
|
1945
1967
|
] }),
|
|
1946
|
-
/* @__PURE__ */
|
|
1968
|
+
/* @__PURE__ */ jsxs5(PopoverContent, { align: "start", className: shape === "date" ? "w-fit" : "w-72", children: [
|
|
1947
1969
|
shape === "text" && /* @__PURE__ */ jsx5(CelTextValueEditor, { condition, onChangeValue: updateValue, onCommit: controller.commit }),
|
|
1948
1970
|
shape === "multiText" && /* @__PURE__ */ jsx5(CelMultiTextValueEditor, { condition, onChangeValue: updateValue }),
|
|
1949
1971
|
shape === "date" && /* @__PURE__ */ jsx5(CelDateValueEditor, { condition, onChangeValue: updateValue }),
|
|
@@ -1962,7 +1984,7 @@ function CelOperatorSegment({
|
|
|
1962
1984
|
onChangeOperator
|
|
1963
1985
|
}) {
|
|
1964
1986
|
if (allowedOperators.length > 1) {
|
|
1965
|
-
return /* @__PURE__ */
|
|
1987
|
+
return /* @__PURE__ */ jsxs5(Select, { value: operator, onValueChange: (value) => onChangeOperator(value), children: [
|
|
1966
1988
|
/* @__PURE__ */ jsx5(SelectTrigger, { "aria-label": `${columnTitle} operator`, className: SEGMENT_SELECT_TRIGGER_CLASSNAME, children: /* @__PURE__ */ jsx5(SelectValue, {}) }),
|
|
1967
1989
|
/* @__PURE__ */ jsx5(SelectContent, { position: "popper", children: /* @__PURE__ */ jsx5(SelectGroup, { children: allowedOperators.map((op) => /* @__PURE__ */ jsx5(SelectItem, { value: op, children: getOperatorLabel(op) }, op)) }) })
|
|
1968
1990
|
] });
|
|
@@ -1979,7 +2001,7 @@ function CelQuantifierSegment({
|
|
|
1979
2001
|
}) {
|
|
1980
2002
|
var _a;
|
|
1981
2003
|
if (value.tokens.length <= 1) return null;
|
|
1982
|
-
return /* @__PURE__ */
|
|
2004
|
+
return /* @__PURE__ */ jsxs5(
|
|
1983
2005
|
Select,
|
|
1984
2006
|
{
|
|
1985
2007
|
value: (_a = value.quantifier) != null ? _a : "any",
|
|
@@ -1988,7 +2010,7 @@ function CelQuantifierSegment({
|
|
|
1988
2010
|
},
|
|
1989
2011
|
children: [
|
|
1990
2012
|
/* @__PURE__ */ jsx5(SelectTrigger, { "aria-label": `${columnTitle} quantifier`, className: SEGMENT_SELECT_TRIGGER_CLASSNAME, children: /* @__PURE__ */ jsx5(SelectValue, {}) }),
|
|
1991
|
-
/* @__PURE__ */ jsx5(SelectContent, { position: "popper", children: /* @__PURE__ */
|
|
2013
|
+
/* @__PURE__ */ jsx5(SelectContent, { position: "popper", children: /* @__PURE__ */ jsxs5(SelectGroup, { children: [
|
|
1992
2014
|
/* @__PURE__ */ jsx5(SelectItem, { value: "any", children: getQuantifierLabel("any") }),
|
|
1993
2015
|
/* @__PURE__ */ jsx5(SelectItem, { value: "all", children: getQuantifierLabel("all") })
|
|
1994
2016
|
] }) })
|
|
@@ -2028,7 +2050,7 @@ function CelCheckboxComboboxPill({
|
|
|
2028
2050
|
const added = nextSelected.find((option) => !current.has(option.value) && !option.disabled && option.operator);
|
|
2029
2051
|
if (added == null ? void 0 : added.operator) updateOperator(added.operator);
|
|
2030
2052
|
}
|
|
2031
|
-
return /* @__PURE__ */
|
|
2053
|
+
return /* @__PURE__ */ jsxs5(
|
|
2032
2054
|
Combobox,
|
|
2033
2055
|
{
|
|
2034
2056
|
items: options,
|
|
@@ -2042,7 +2064,7 @@ function CelCheckboxComboboxPill({
|
|
|
2042
2064
|
else if (!controller.isDismissSuppressed()) controller.handlePopoverDismiss();
|
|
2043
2065
|
},
|
|
2044
2066
|
children: [
|
|
2045
|
-
/* @__PURE__ */
|
|
2067
|
+
/* @__PURE__ */ jsxs5(ButtonGroup, { children: [
|
|
2046
2068
|
/* @__PURE__ */ jsx5(ButtonGroupText, { children: columnDef.title }),
|
|
2047
2069
|
/* @__PURE__ */ jsx5(
|
|
2048
2070
|
CelOperatorSegment,
|
|
@@ -2064,16 +2086,16 @@ function CelCheckboxComboboxPill({
|
|
|
2064
2086
|
),
|
|
2065
2087
|
/* @__PURE__ */ jsx5(Button3, { variant: "outline", size: "icon", "aria-label": `Remove ${columnDef.title} filter`, onClick: onRemove, children: /* @__PURE__ */ jsx5(Icon3, { name: "xmark" }) })
|
|
2066
2088
|
] }),
|
|
2067
|
-
/* @__PURE__ */
|
|
2089
|
+
/* @__PURE__ */ jsxs5(ComboboxContent, { container, className: "min-w-64", collisionAvoidance: { side: "none", align: "shift" }, children: [
|
|
2068
2090
|
/* @__PURE__ */ jsx5(ComboboxInput, { showTrigger: false, placeholder: `Search ${columnDef.title.toLowerCase()}\u2026` }),
|
|
2069
|
-
selected.length > 0 && /* @__PURE__ */
|
|
2070
|
-
/* @__PURE__ */
|
|
2091
|
+
selected.length > 0 && /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
2092
|
+
/* @__PURE__ */ jsxs5(ComboboxSelectedChips, { children: [
|
|
2071
2093
|
/* @__PURE__ */ jsx5(ComboboxValue, { children: (items) => /* @__PURE__ */ jsx5(Fragment3, { children: items.map((item) => /* @__PURE__ */ jsx5(ComboboxChip, { children: item.label }, item.value)) }) }),
|
|
2072
2094
|
/* @__PURE__ */ jsx5(ComboboxClearAll, { onClick: () => applySelection([]) })
|
|
2073
2095
|
] }),
|
|
2074
2096
|
/* @__PURE__ */ jsx5(ComboboxSeparator, {})
|
|
2075
2097
|
] }),
|
|
2076
|
-
/* @__PURE__ */
|
|
2098
|
+
/* @__PURE__ */ jsxs5(ComboboxEmpty, { children: [
|
|
2077
2099
|
"No ",
|
|
2078
2100
|
columnDef.title.toLowerCase(),
|
|
2079
2101
|
" found."
|
|
@@ -2114,7 +2136,7 @@ function CelRadioComboboxPill({
|
|
|
2114
2136
|
if (option.operator) updateOperator(option.operator);
|
|
2115
2137
|
controller.commit();
|
|
2116
2138
|
}
|
|
2117
|
-
return /* @__PURE__ */
|
|
2139
|
+
return /* @__PURE__ */ jsxs5(
|
|
2118
2140
|
Combobox,
|
|
2119
2141
|
{
|
|
2120
2142
|
items: options,
|
|
@@ -2127,7 +2149,7 @@ function CelRadioComboboxPill({
|
|
|
2127
2149
|
else if (!controller.isDismissSuppressed()) controller.handlePopoverDismiss();
|
|
2128
2150
|
},
|
|
2129
2151
|
children: [
|
|
2130
|
-
/* @__PURE__ */
|
|
2152
|
+
/* @__PURE__ */ jsxs5(ButtonGroup, { children: [
|
|
2131
2153
|
/* @__PURE__ */ jsx5(ButtonGroupText, { children: columnDef.title }),
|
|
2132
2154
|
/* @__PURE__ */ jsx5(
|
|
2133
2155
|
CelOperatorSegment,
|
|
@@ -2149,9 +2171,9 @@ function CelRadioComboboxPill({
|
|
|
2149
2171
|
),
|
|
2150
2172
|
/* @__PURE__ */ jsx5(Button3, { variant: "outline", size: "icon", "aria-label": `Remove ${columnDef.title} filter`, onClick: onRemove, children: /* @__PURE__ */ jsx5(Icon3, { name: "xmark" }) })
|
|
2151
2173
|
] }),
|
|
2152
|
-
/* @__PURE__ */
|
|
2174
|
+
/* @__PURE__ */ jsxs5(ComboboxContent, { container, className: "min-w-64", collisionAvoidance: { side: "none", align: "shift" }, children: [
|
|
2153
2175
|
/* @__PURE__ */ jsx5(ComboboxInput, { showTrigger: false, placeholder: `Search ${columnDef.title.toLowerCase()}\u2026` }),
|
|
2154
|
-
/* @__PURE__ */
|
|
2176
|
+
/* @__PURE__ */ jsxs5(ComboboxEmpty, { children: [
|
|
2155
2177
|
"No ",
|
|
2156
2178
|
columnDef.title.toLowerCase(),
|
|
2157
2179
|
" found."
|
|
@@ -2203,8 +2225,8 @@ function CelMultiTextValueEditor({
|
|
|
2203
2225
|
function removeToken(token) {
|
|
2204
2226
|
onChangeValue(__spreadProps(__spreadValues({}, value), { tokens: value.tokens.filter((t) => t !== token) }));
|
|
2205
2227
|
}
|
|
2206
|
-
return /* @__PURE__ */
|
|
2207
|
-
value.tokens.length > 0 && /* @__PURE__ */ jsx5("div", { className: "flex flex-wrap gap-1", children: value.tokens.map((token) => /* @__PURE__ */
|
|
2228
|
+
return /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2", children: [
|
|
2229
|
+
value.tokens.length > 0 && /* @__PURE__ */ jsx5("div", { className: "flex flex-wrap gap-1", children: value.tokens.map((token) => /* @__PURE__ */ jsxs5(Badge, { variant: "secondary", className: "gap-1", children: [
|
|
2208
2230
|
token,
|
|
2209
2231
|
/* @__PURE__ */ jsx5(
|
|
2210
2232
|
"button",
|
|
@@ -2244,8 +2266,8 @@ function CelKeyValueValueEditor({
|
|
|
2244
2266
|
var _a;
|
|
2245
2267
|
const value = readMapKeyCelValue(condition.value);
|
|
2246
2268
|
const needsValue = condition.operator === "has_value" || condition.operator === "does_not_have_value";
|
|
2247
|
-
return /* @__PURE__ */
|
|
2248
|
-
/* @__PURE__ */
|
|
2269
|
+
return /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2", children: [
|
|
2270
|
+
/* @__PURE__ */ jsxs5(InputGroup, { children: [
|
|
2249
2271
|
/* @__PURE__ */ jsx5(InputGroupAddon, { children: /* @__PURE__ */ jsx5(InputGroupText, { children: "Key" }) }),
|
|
2250
2272
|
/* @__PURE__ */ jsx5(
|
|
2251
2273
|
InputGroupInput,
|
|
@@ -2259,7 +2281,7 @@ function CelKeyValueValueEditor({
|
|
|
2259
2281
|
}
|
|
2260
2282
|
)
|
|
2261
2283
|
] }),
|
|
2262
|
-
needsValue && /* @__PURE__ */
|
|
2284
|
+
needsValue && /* @__PURE__ */ jsxs5(InputGroup, { children: [
|
|
2263
2285
|
/* @__PURE__ */ jsx5(InputGroupAddon, { children: /* @__PURE__ */ jsx5(InputGroupText, { children: "Value" }) }),
|
|
2264
2286
|
/* @__PURE__ */ jsx5(
|
|
2265
2287
|
InputGroupInput,
|
|
@@ -2300,9 +2322,9 @@ function CelDateValueEditor({
|
|
|
2300
2322
|
if (!value.instant) return;
|
|
2301
2323
|
onChangeValue({ instant: withTimeOfDay(value.instant, timeOfDay), hasTime: true });
|
|
2302
2324
|
}
|
|
2303
|
-
return /* @__PURE__ */
|
|
2304
|
-
/* @__PURE__ */
|
|
2305
|
-
relativeCapable && /* @__PURE__ */
|
|
2325
|
+
return /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2", children: [
|
|
2326
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex", children: [
|
|
2327
|
+
relativeCapable && /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-1 border-r pr-2", children: [
|
|
2306
2328
|
/* @__PURE__ */ jsx5("p", { className: "text-body-sm text-muted-foreground px-2 font-medium", children: "Quick select" }),
|
|
2307
2329
|
RELATIVE_DURATION_PRESET_VALUES.map((preset) => /* @__PURE__ */ jsx5(
|
|
2308
2330
|
Button3,
|
|
@@ -2333,7 +2355,7 @@ function CelDateValueEditor({
|
|
|
2333
2355
|
}
|
|
2334
2356
|
)
|
|
2335
2357
|
] }),
|
|
2336
|
-
showTime && !isRelative && /* @__PURE__ */
|
|
2358
|
+
showTime && !isRelative && /* @__PURE__ */ jsxs5("div", { className: "flex w-full items-center gap-2", children: [
|
|
2337
2359
|
/* @__PURE__ */ jsx5(Label, { htmlFor: "cel-date-time", className: "text-body-sm text-muted-foreground shrink-0", children: "Time (UTC)" }),
|
|
2338
2360
|
/* @__PURE__ */ jsx5(
|
|
2339
2361
|
Input,
|
|
@@ -2350,10 +2372,6 @@ function CelDateValueEditor({
|
|
|
2350
2372
|
] });
|
|
2351
2373
|
}
|
|
2352
2374
|
|
|
2353
|
-
// src/data-table/data-table.tsx
|
|
2354
|
-
import { Icon as Icon9 } from "@upbound/monarch-core";
|
|
2355
|
-
import { InputGroup as InputGroup2, InputGroupAddon as InputGroupAddon2, InputGroupButton, InputGroupInput as InputGroupInput2 } from "@upbound/monarch-core";
|
|
2356
|
-
|
|
2357
2375
|
// src/lib/data-table/features.ts
|
|
2358
2376
|
import {
|
|
2359
2377
|
columnFacetingFeature,
|
|
@@ -2496,21 +2514,6 @@ function getColumnFilterCount(filterValue, filter) {
|
|
|
2496
2514
|
return 0;
|
|
2497
2515
|
}
|
|
2498
2516
|
|
|
2499
|
-
// src/lib/search-input.ts
|
|
2500
|
-
var SEARCH_INPUT_PROPS = {
|
|
2501
|
-
type: "search",
|
|
2502
|
-
autoComplete: "off",
|
|
2503
|
-
"data-1p-ignore": true,
|
|
2504
|
-
// 1Password
|
|
2505
|
-
"data-lpignore": "true",
|
|
2506
|
-
// LastPass
|
|
2507
|
-
"data-bwignore": true,
|
|
2508
|
-
// Bitwarden
|
|
2509
|
-
"data-form-type": "other"
|
|
2510
|
-
// Dashlane
|
|
2511
|
-
};
|
|
2512
|
-
var SEARCH_INPUT_CLASS = "[&::-webkit-search-cancel-button]:appearance-none";
|
|
2513
|
-
|
|
2514
2517
|
// src/hooks/use-table-column-resizing.ts
|
|
2515
2518
|
import { useCallback as useCallback4, useEffect as useEffect3, useRef as useRef3, useState as useState5 } from "react";
|
|
2516
2519
|
var RESIZE_MIN = 40;
|
|
@@ -3025,13 +3028,84 @@ function useFilterVisibility(filterVisibility) {
|
|
|
3025
3028
|
return { showFilterToggle, filterRowVisible, setFilterRowVisible };
|
|
3026
3029
|
}
|
|
3027
3030
|
|
|
3031
|
+
// src/data-table/data-table-search.tsx
|
|
3032
|
+
import * as React6 from "react";
|
|
3033
|
+
import { Icon as Icon4 } from "@upbound/monarch-core";
|
|
3034
|
+
import { InputGroup as InputGroup2, InputGroupAddon as InputGroupAddon2, InputGroupButton, InputGroupInput as InputGroupInput2 } from "@upbound/monarch-core";
|
|
3035
|
+
|
|
3036
|
+
// src/lib/search-input.ts
|
|
3037
|
+
var SEARCH_INPUT_PROPS = {
|
|
3038
|
+
type: "search",
|
|
3039
|
+
autoComplete: "off",
|
|
3040
|
+
"data-1p-ignore": true,
|
|
3041
|
+
// 1Password
|
|
3042
|
+
"data-lpignore": "true",
|
|
3043
|
+
// LastPass
|
|
3044
|
+
"data-bwignore": true,
|
|
3045
|
+
// Bitwarden
|
|
3046
|
+
"data-form-type": "other"
|
|
3047
|
+
// Dashlane
|
|
3048
|
+
};
|
|
3049
|
+
var SEARCH_INPUT_CLASS = "[&::-webkit-search-cancel-button]:appearance-none";
|
|
3050
|
+
|
|
3051
|
+
// src/data-table/data-table-search.tsx
|
|
3052
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3053
|
+
function DataTableSearch({
|
|
3054
|
+
value,
|
|
3055
|
+
onValueChange,
|
|
3056
|
+
placeholder = "Search\u2026",
|
|
3057
|
+
className,
|
|
3058
|
+
disabled = false
|
|
3059
|
+
}) {
|
|
3060
|
+
const id = `table-search-${React6.useId()}`;
|
|
3061
|
+
const inputRef = React6.useRef(null);
|
|
3062
|
+
const [draft, setDraft] = React6.useState(value);
|
|
3063
|
+
const [isPending, startTransition] = React6.useTransition();
|
|
3064
|
+
if (!isPending && draft !== value) {
|
|
3065
|
+
setDraft(value);
|
|
3066
|
+
}
|
|
3067
|
+
const commit = (next) => {
|
|
3068
|
+
setDraft(next);
|
|
3069
|
+
startTransition(() => onValueChange(next));
|
|
3070
|
+
};
|
|
3071
|
+
return /* @__PURE__ */ jsxs6(InputGroup2, { className: cn("w-70", className), children: [
|
|
3072
|
+
/* @__PURE__ */ jsx6(InputGroupAddon2, { align: "inline-start", children: /* @__PURE__ */ jsx6(Icon4, { name: "magnifying-glass" }) }),
|
|
3073
|
+
/* @__PURE__ */ jsx6(
|
|
3074
|
+
InputGroupInput2,
|
|
3075
|
+
__spreadProps(__spreadValues({}, SEARCH_INPUT_PROPS), {
|
|
3076
|
+
id,
|
|
3077
|
+
className: SEARCH_INPUT_CLASS,
|
|
3078
|
+
"aria-label": "Search",
|
|
3079
|
+
placeholder,
|
|
3080
|
+
disabled,
|
|
3081
|
+
ref: inputRef,
|
|
3082
|
+
value: draft,
|
|
3083
|
+
onChange: (e) => commit(e.target.value)
|
|
3084
|
+
})
|
|
3085
|
+
),
|
|
3086
|
+
!!draft && !disabled && /* @__PURE__ */ jsx6(InputGroupAddon2, { align: "inline-end", children: /* @__PURE__ */ jsx6(
|
|
3087
|
+
InputGroupButton,
|
|
3088
|
+
{
|
|
3089
|
+
size: "icon-xs",
|
|
3090
|
+
"aria-label": "Clear search",
|
|
3091
|
+
onClick: () => {
|
|
3092
|
+
var _a;
|
|
3093
|
+
commit("");
|
|
3094
|
+
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
3095
|
+
},
|
|
3096
|
+
children: /* @__PURE__ */ jsx6(Icon4, { name: "xmark" })
|
|
3097
|
+
}
|
|
3098
|
+
) })
|
|
3099
|
+
] });
|
|
3100
|
+
}
|
|
3101
|
+
|
|
3028
3102
|
// src/data-table/empty-view.tsx
|
|
3029
3103
|
import { Alert, AlertDescription } from "@upbound/monarch-core";
|
|
3030
3104
|
import { Button as Button4 } from "@upbound/monarch-core";
|
|
3031
3105
|
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@upbound/monarch-core";
|
|
3032
|
-
import { Icon as
|
|
3106
|
+
import { Icon as Icon5 } from "@upbound/monarch-core";
|
|
3033
3107
|
import { IconTile } from "@upbound/monarch-core";
|
|
3034
|
-
import { jsx as
|
|
3108
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3035
3109
|
var defaultErrorConfig = {
|
|
3036
3110
|
icon: "circle-exclamation",
|
|
3037
3111
|
header: "Something went wrong",
|
|
@@ -3062,37 +3136,37 @@ function DataTableEmptyView({
|
|
|
3062
3136
|
const isFilteredEmpty = tableState === "empty" && filterCount > 0;
|
|
3063
3137
|
const config = tableState === "error" ? mergeConfig(defaultErrorConfig, emptyView == null ? void 0 : emptyView.error) : tableState === "empty" ? isFilteredEmpty ? mergeConfig(defaultNoFilterFoundConfig, emptyView == null ? void 0 : emptyView.filter) : mergeConfig(defaultEmptyConfig, emptyView == null ? void 0 : emptyView.empty) : null;
|
|
3064
3138
|
const wrapperClassName = tableState === "error" ? (_c = (_a = emptyView == null ? void 0 : emptyView.error) == null ? void 0 : _a.wrapperClassName) != null ? _c : (_b = emptyView == null ? void 0 : emptyView.empty) == null ? void 0 : _b.wrapperClassName : config == null ? void 0 : config.wrapperClassName;
|
|
3065
|
-
const defaultAction = isFilteredEmpty && !(config == null ? void 0 : config.action) ? /* @__PURE__ */
|
|
3066
|
-
/* @__PURE__ */
|
|
3139
|
+
const defaultAction = isFilteredEmpty && !(config == null ? void 0 : config.action) ? /* @__PURE__ */ jsxs7(Button4, { variant: "outline", size: "sm", onClick: resetFilters, children: [
|
|
3140
|
+
/* @__PURE__ */ jsx7(Icon5, { name: "xmark" }),
|
|
3067
3141
|
"Clear filters"
|
|
3068
3142
|
] }) : null;
|
|
3069
|
-
return /* @__PURE__ */
|
|
3070
|
-
/* @__PURE__ */
|
|
3071
|
-
config.icon && /* @__PURE__ */
|
|
3072
|
-
config.header && /* @__PURE__ */
|
|
3073
|
-
config.subheader && /* @__PURE__ */
|
|
3143
|
+
return /* @__PURE__ */ jsx7("div", { className: cn("flex size-full flex-col justify-center", wrapperClassName), children: config && /* @__PURE__ */ jsxs7(Empty, { className: cn("border border-dashed", config.className), children: [
|
|
3144
|
+
/* @__PURE__ */ jsxs7(EmptyHeader, { children: [
|
|
3145
|
+
config.icon && /* @__PURE__ */ jsx7(EmptyMedia, { children: /* @__PURE__ */ jsx7(IconTile, { variant: "branded", size: "md", children: /* @__PURE__ */ jsx7(Icon5, { name: config.icon }) }) }),
|
|
3146
|
+
config.header && /* @__PURE__ */ jsx7(EmptyTitle, { children: config.header }),
|
|
3147
|
+
config.subheader && /* @__PURE__ */ jsx7(EmptyDescription, { children: config.subheader })
|
|
3074
3148
|
] }),
|
|
3075
|
-
(config.details || config.action || defaultAction) && /* @__PURE__ */
|
|
3076
|
-
config.details && /* @__PURE__ */
|
|
3149
|
+
(config.details || config.action || defaultAction) && /* @__PURE__ */ jsxs7(EmptyContent, { children: [
|
|
3150
|
+
config.details && /* @__PURE__ */ jsx7(Alert, { children: /* @__PURE__ */ jsx7(AlertDescription, { children: config.details }) }),
|
|
3077
3151
|
(_d = config.action) != null ? _d : defaultAction
|
|
3078
3152
|
] })
|
|
3079
3153
|
] }) });
|
|
3080
3154
|
}
|
|
3081
3155
|
|
|
3082
3156
|
// src/data-table/filter-toggle.tsx
|
|
3083
|
-
import { Badge as Badge2, Button as Button5, Icon as
|
|
3084
|
-
import { jsx as
|
|
3157
|
+
import { Badge as Badge2, Button as Button5, Icon as Icon6 } from "@upbound/monarch-core";
|
|
3158
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3085
3159
|
function FilterToggle({ pressed, onPressedChange, count }) {
|
|
3086
|
-
return /* @__PURE__ */
|
|
3087
|
-
/* @__PURE__ */
|
|
3160
|
+
return /* @__PURE__ */ jsxs8(Button5, { variant: "outline", onClick: () => onPressedChange(!pressed), className: "shrink-0", children: [
|
|
3161
|
+
/* @__PURE__ */ jsx8(Icon6, { name: "filter", "data-icon": "inline-start" }),
|
|
3088
3162
|
pressed ? "Hide filters" : "Show filters",
|
|
3089
|
-
!!count && /* @__PURE__ */
|
|
3163
|
+
!!count && /* @__PURE__ */ jsx8(Badge2, { variant: "secondary", className: "tabular-nums", children: count })
|
|
3090
3164
|
] });
|
|
3091
3165
|
}
|
|
3092
3166
|
|
|
3093
3167
|
// src/data-table/pagination.tsx
|
|
3094
3168
|
import { Button as Button6 } from "@upbound/monarch-core";
|
|
3095
|
-
import { Icon as
|
|
3169
|
+
import { Icon as Icon7 } from "@upbound/monarch-core";
|
|
3096
3170
|
import { Label as Label2 } from "@upbound/monarch-core";
|
|
3097
3171
|
import {
|
|
3098
3172
|
Pagination,
|
|
@@ -3102,8 +3176,8 @@ import {
|
|
|
3102
3176
|
PaginationLink
|
|
3103
3177
|
} from "@upbound/monarch-core";
|
|
3104
3178
|
import { Select as Select2, SelectContent as SelectContent2, SelectGroup as SelectGroup2, SelectItem as SelectItem2, SelectTrigger as SelectTrigger2, SelectValue as SelectValue2 } from "@upbound/monarch-core";
|
|
3105
|
-
import { Tooltip as
|
|
3106
|
-
import { jsx as
|
|
3179
|
+
import { Tooltip as Tooltip3, TooltipContent as TooltipContent3, TooltipTrigger as TooltipTrigger3 } from "@upbound/monarch-core";
|
|
3180
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3107
3181
|
var DEFAULT_PAGINATION_CONFIG = {
|
|
3108
3182
|
summary: true,
|
|
3109
3183
|
arrows: true,
|
|
@@ -3142,36 +3216,36 @@ function DataTablePagination({
|
|
|
3142
3216
|
const currentPage = pageIndex + 1;
|
|
3143
3217
|
const mounted = useMounted();
|
|
3144
3218
|
const locale = mounted ? void 0 : "en-US";
|
|
3145
|
-
return /* @__PURE__ */
|
|
3146
|
-
resolved.summary ? /* @__PURE__ */
|
|
3219
|
+
return /* @__PURE__ */ jsxs9("div", { "data-testid": "table-footer", className: "flex items-center justify-between px-2 pt-4", children: [
|
|
3220
|
+
resolved.summary ? /* @__PURE__ */ jsxs9("div", { className: "text-body text-muted-foreground", "data-testid": "table-pagination-summary", children: [
|
|
3147
3221
|
"Showing ",
|
|
3148
|
-
/* @__PURE__ */
|
|
3222
|
+
/* @__PURE__ */ jsx9("span", { className: "text-foreground font-medium", children: itemStart.toLocaleString(locale) }),
|
|
3149
3223
|
" to",
|
|
3150
3224
|
" ",
|
|
3151
|
-
/* @__PURE__ */
|
|
3225
|
+
/* @__PURE__ */ jsx9("span", { className: "text-foreground font-medium", children: itemEnd.toLocaleString(locale) }),
|
|
3152
3226
|
" of",
|
|
3153
3227
|
" ",
|
|
3154
|
-
/* @__PURE__ */
|
|
3228
|
+
/* @__PURE__ */ jsxs9("span", { className: "text-foreground font-medium", children: [
|
|
3155
3229
|
rowCount.toLocaleString(locale),
|
|
3156
3230
|
!isRowCountExact && "+"
|
|
3157
3231
|
] }),
|
|
3158
3232
|
" ",
|
|
3159
3233
|
"results",
|
|
3160
|
-
!isRowCountExact && /* @__PURE__ */
|
|
3161
|
-
/* @__PURE__ */
|
|
3162
|
-
/* @__PURE__ */
|
|
3234
|
+
!isRowCountExact && /* @__PURE__ */ jsxs9(Tooltip3, { children: [
|
|
3235
|
+
/* @__PURE__ */ jsx9(TooltipTrigger3, { className: "ml-1 align-middle", children: /* @__PURE__ */ jsx9(Icon7, { name: "circle-info", size: "sm" }) }),
|
|
3236
|
+
/* @__PURE__ */ jsx9(TooltipContent3, { children: "Add filters or refine your search to reduce the result set." })
|
|
3163
3237
|
] })
|
|
3164
|
-
] }) : /* @__PURE__ */
|
|
3165
|
-
/* @__PURE__ */
|
|
3166
|
-
resolved.pageSizeSelector && /* @__PURE__ */
|
|
3167
|
-
/* @__PURE__ */
|
|
3168
|
-
/* @__PURE__ */
|
|
3169
|
-
/* @__PURE__ */
|
|
3170
|
-
/* @__PURE__ */
|
|
3238
|
+
] }) : /* @__PURE__ */ jsx9("div", {}),
|
|
3239
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-4", children: [
|
|
3240
|
+
resolved.pageSizeSelector && /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", children: [
|
|
3241
|
+
/* @__PURE__ */ jsx9(Label2, { htmlFor: PAGE_SIZE_SELECT_ID, className: "font-semibold", children: "Rows per page" }),
|
|
3242
|
+
/* @__PURE__ */ jsxs9(Select2, { value: String(effectivePageSize), onValueChange: (value) => onPageSizeChange(Number(value)), children: [
|
|
3243
|
+
/* @__PURE__ */ jsx9(SelectTrigger2, { id: PAGE_SIZE_SELECT_ID, size: "sm", className: "w-18", "data-testid": "table-page-size-select", children: /* @__PURE__ */ jsx9(SelectValue2, {}) }),
|
|
3244
|
+
/* @__PURE__ */ jsx9(SelectContent2, { align: "end", children: /* @__PURE__ */ jsx9(SelectGroup2, { children: normalizedPageSizeOptions.map((option) => /* @__PURE__ */ jsx9(SelectItem2, { value: String(option), children: option }, option)) }) })
|
|
3171
3245
|
] })
|
|
3172
3246
|
] }),
|
|
3173
|
-
pageCount > 1 && (resolved.arrows || resolved.numbers) && /* @__PURE__ */
|
|
3174
|
-
resolved.arrows && /* @__PURE__ */
|
|
3247
|
+
pageCount > 1 && (resolved.arrows || resolved.numbers) && /* @__PURE__ */ jsx9(Pagination, { className: "mx-0 w-auto justify-end", children: /* @__PURE__ */ jsxs9(PaginationContent, { children: [
|
|
3248
|
+
resolved.arrows && /* @__PURE__ */ jsx9(PaginationItem, { children: /* @__PURE__ */ jsx9(
|
|
3175
3249
|
Button6,
|
|
3176
3250
|
{
|
|
3177
3251
|
variant: "outline",
|
|
@@ -3179,10 +3253,10 @@ function DataTablePagination({
|
|
|
3179
3253
|
"aria-label": "Go to first page",
|
|
3180
3254
|
disabled: currentPage <= 1,
|
|
3181
3255
|
onClick: () => onPageChange(1),
|
|
3182
|
-
children: /* @__PURE__ */
|
|
3256
|
+
children: /* @__PURE__ */ jsx9(Icon7, { name: "chevrons-left", className: "cn-rtl-flip" })
|
|
3183
3257
|
}
|
|
3184
3258
|
) }),
|
|
3185
|
-
resolved.arrows && /* @__PURE__ */
|
|
3259
|
+
resolved.arrows && /* @__PURE__ */ jsx9(PaginationItem, { children: /* @__PURE__ */ jsx9(
|
|
3186
3260
|
Button6,
|
|
3187
3261
|
{
|
|
3188
3262
|
variant: "outline",
|
|
@@ -3190,11 +3264,11 @@ function DataTablePagination({
|
|
|
3190
3264
|
"aria-label": "Go to previous page",
|
|
3191
3265
|
disabled: currentPage <= 1,
|
|
3192
3266
|
onClick: () => onPageChange(currentPage - 1),
|
|
3193
|
-
children: /* @__PURE__ */
|
|
3267
|
+
children: /* @__PURE__ */ jsx9(Icon7, { name: "chevron-left", className: "cn-rtl-flip" })
|
|
3194
3268
|
}
|
|
3195
3269
|
) }),
|
|
3196
3270
|
resolved.numbers && visiblePages.map(
|
|
3197
|
-
(page, index) => page === void 0 ? /* @__PURE__ */
|
|
3271
|
+
(page, index) => page === void 0 ? /* @__PURE__ */ jsx9(PaginationItem, { children: /* @__PURE__ */ jsx9(PaginationEllipsis, {}) }, `ellipsis-${index}`) : /* @__PURE__ */ jsx9(PaginationItem, { children: /* @__PURE__ */ jsx9(
|
|
3198
3272
|
PaginationLink,
|
|
3199
3273
|
{
|
|
3200
3274
|
href: "#",
|
|
@@ -3208,7 +3282,7 @@ function DataTablePagination({
|
|
|
3208
3282
|
}
|
|
3209
3283
|
) }, page)
|
|
3210
3284
|
),
|
|
3211
|
-
resolved.arrows && /* @__PURE__ */
|
|
3285
|
+
resolved.arrows && /* @__PURE__ */ jsx9(PaginationItem, { children: /* @__PURE__ */ jsx9(
|
|
3212
3286
|
Button6,
|
|
3213
3287
|
{
|
|
3214
3288
|
variant: "outline",
|
|
@@ -3216,10 +3290,10 @@ function DataTablePagination({
|
|
|
3216
3290
|
"aria-label": "Go to next page",
|
|
3217
3291
|
disabled: currentPage >= pageCount,
|
|
3218
3292
|
onClick: () => onPageChange(currentPage + 1),
|
|
3219
|
-
children: /* @__PURE__ */
|
|
3293
|
+
children: /* @__PURE__ */ jsx9(Icon7, { name: "chevron-right", className: "cn-rtl-flip" })
|
|
3220
3294
|
}
|
|
3221
3295
|
) }),
|
|
3222
|
-
resolved.arrows && /* @__PURE__ */
|
|
3296
|
+
resolved.arrows && /* @__PURE__ */ jsx9(PaginationItem, { children: /* @__PURE__ */ jsx9(
|
|
3223
3297
|
Button6,
|
|
3224
3298
|
{
|
|
3225
3299
|
variant: "outline",
|
|
@@ -3227,7 +3301,7 @@ function DataTablePagination({
|
|
|
3227
3301
|
"aria-label": "Go to last page",
|
|
3228
3302
|
disabled: currentPage >= pageCount,
|
|
3229
3303
|
onClick: () => onPageChange(pageCount),
|
|
3230
|
-
children: /* @__PURE__ */
|
|
3304
|
+
children: /* @__PURE__ */ jsx9(Icon7, { name: "chevrons-right", className: "cn-rtl-flip" })
|
|
3231
3305
|
}
|
|
3232
3306
|
) })
|
|
3233
3307
|
] }) })
|
|
@@ -3236,7 +3310,7 @@ function DataTablePagination({
|
|
|
3236
3310
|
}
|
|
3237
3311
|
|
|
3238
3312
|
// src/data-table/table-primitives.tsx
|
|
3239
|
-
import * as
|
|
3313
|
+
import * as React7 from "react";
|
|
3240
3314
|
import { flexRender as flexRender2 } from "@tanstack/react-table";
|
|
3241
3315
|
import { ContextMenu, ContextMenuTrigger } from "@upbound/monarch-core";
|
|
3242
3316
|
import {
|
|
@@ -3246,7 +3320,7 @@ import {
|
|
|
3246
3320
|
DropdownMenuSeparator,
|
|
3247
3321
|
DropdownMenuTrigger as DropdownMenuTrigger3
|
|
3248
3322
|
} from "@upbound/monarch-core";
|
|
3249
|
-
import { Icon as
|
|
3323
|
+
import { Icon as Icon8 } from "@upbound/monarch-core";
|
|
3250
3324
|
import { Skeleton } from "@upbound/monarch-core";
|
|
3251
3325
|
import {
|
|
3252
3326
|
Table as BaseTable,
|
|
@@ -3256,8 +3330,8 @@ import {
|
|
|
3256
3330
|
TableHeader as BaseTableHeader,
|
|
3257
3331
|
TableRow as BaseTableRow
|
|
3258
3332
|
} from "@upbound/monarch-core";
|
|
3259
|
-
import { Tooltip as
|
|
3260
|
-
import { Fragment as Fragment5, jsx as
|
|
3333
|
+
import { Tooltip as Tooltip4, TooltipContent as TooltipContent4, TooltipTrigger as TooltipTrigger4 } from "@upbound/monarch-core";
|
|
3334
|
+
import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3261
3335
|
var HEADER_SURFACE_BG = "bg-[color-mix(in_oklch,var(--muted)_50%,var(--card))]";
|
|
3262
3336
|
var TABLE_HEAD_CLASSES = "text-body-sm text-muted-foreground h-10 px-4 text-left align-middle font-medium whitespace-nowrap has-[[role=checkbox]]:pr-0";
|
|
3263
3337
|
var TABLE_CELL_CLASSES = "px-4 py-2 align-middle whitespace-nowrap has-[[role=checkbox]]:pr-0";
|
|
@@ -3271,7 +3345,7 @@ function DataTableRoot({
|
|
|
3271
3345
|
children
|
|
3272
3346
|
}) {
|
|
3273
3347
|
if (layout === "grid") {
|
|
3274
|
-
return /* @__PURE__ */
|
|
3348
|
+
return /* @__PURE__ */ jsx10(
|
|
3275
3349
|
"div",
|
|
3276
3350
|
{
|
|
3277
3351
|
ref: gridRootRef,
|
|
@@ -3282,7 +3356,7 @@ function DataTableRoot({
|
|
|
3282
3356
|
}
|
|
3283
3357
|
);
|
|
3284
3358
|
}
|
|
3285
|
-
return /* @__PURE__ */
|
|
3359
|
+
return /* @__PURE__ */ jsx10(BaseTable, { className, style, children });
|
|
3286
3360
|
}
|
|
3287
3361
|
function getColumnPinningProps(column, surface = "body") {
|
|
3288
3362
|
const isPinned = column.getIsPinned();
|
|
@@ -3305,8 +3379,8 @@ function getColumnPinningProps(column, surface = "body") {
|
|
|
3305
3379
|
}
|
|
3306
3380
|
function DataTableSortIcon({ sortOrder }) {
|
|
3307
3381
|
if (!sortOrder) return null;
|
|
3308
|
-
return /* @__PURE__ */
|
|
3309
|
-
|
|
3382
|
+
return /* @__PURE__ */ jsx10(
|
|
3383
|
+
Icon8,
|
|
3310
3384
|
{
|
|
3311
3385
|
size: "xs",
|
|
3312
3386
|
name: sortOrder === "asc" ? "arrow-up" : "arrow-down",
|
|
@@ -3325,57 +3399,57 @@ function ColumnActionsMenuItems({
|
|
|
3325
3399
|
const canResize = header.column.getCanResize();
|
|
3326
3400
|
const canHide = header.column.getCanHide();
|
|
3327
3401
|
const canPin = !isGrid && header.column.getCanPin();
|
|
3328
|
-
return /* @__PURE__ */
|
|
3329
|
-
canSort && /* @__PURE__ */
|
|
3330
|
-
/* @__PURE__ */
|
|
3402
|
+
return /* @__PURE__ */ jsxs10(DropdownMenuContent3, { align: "start", className: "w-45", children: [
|
|
3403
|
+
canSort && /* @__PURE__ */ jsxs10(Fragment5, { children: [
|
|
3404
|
+
/* @__PURE__ */ jsxs10(
|
|
3331
3405
|
DropdownMenuItem3,
|
|
3332
3406
|
{
|
|
3333
3407
|
disabled: header.column.getIsSorted() === "asc",
|
|
3334
3408
|
onClick: () => header.column.toggleSorting(false),
|
|
3335
3409
|
children: [
|
|
3336
|
-
/* @__PURE__ */
|
|
3410
|
+
/* @__PURE__ */ jsx10(Icon8, { name: "arrow-up" }),
|
|
3337
3411
|
"Sort ascending"
|
|
3338
3412
|
]
|
|
3339
3413
|
}
|
|
3340
3414
|
),
|
|
3341
|
-
/* @__PURE__ */
|
|
3415
|
+
/* @__PURE__ */ jsxs10(
|
|
3342
3416
|
DropdownMenuItem3,
|
|
3343
3417
|
{
|
|
3344
3418
|
disabled: header.column.getIsSorted() === "desc",
|
|
3345
3419
|
onClick: () => header.column.toggleSorting(true),
|
|
3346
3420
|
children: [
|
|
3347
|
-
/* @__PURE__ */
|
|
3421
|
+
/* @__PURE__ */ jsx10(Icon8, { name: "arrow-down" }),
|
|
3348
3422
|
"Sort descending"
|
|
3349
3423
|
]
|
|
3350
3424
|
}
|
|
3351
3425
|
),
|
|
3352
|
-
!!header.column.getIsSorted() && /* @__PURE__ */
|
|
3353
|
-
/* @__PURE__ */
|
|
3426
|
+
!!header.column.getIsSorted() && /* @__PURE__ */ jsxs10(DropdownMenuItem3, { onClick: () => header.column.clearSorting(), children: [
|
|
3427
|
+
/* @__PURE__ */ jsx10(Icon8, { name: "xmark" }),
|
|
3354
3428
|
"Remove sorting"
|
|
3355
3429
|
] })
|
|
3356
3430
|
] }),
|
|
3357
|
-
canResize && /* @__PURE__ */
|
|
3358
|
-
canSort && /* @__PURE__ */
|
|
3359
|
-
!isGrid && /* @__PURE__ */
|
|
3360
|
-
/* @__PURE__ */
|
|
3431
|
+
canResize && /* @__PURE__ */ jsxs10(Fragment5, { children: [
|
|
3432
|
+
canSort && /* @__PURE__ */ jsx10(DropdownMenuSeparator, {}),
|
|
3433
|
+
!isGrid && /* @__PURE__ */ jsxs10(DropdownMenuItem3, { onClick: () => onAutosizeColumn(header.column.id), children: [
|
|
3434
|
+
/* @__PURE__ */ jsx10(Icon8, { name: "arrows-left-right" }),
|
|
3361
3435
|
"Autosize column"
|
|
3362
3436
|
] }),
|
|
3363
|
-
/* @__PURE__ */
|
|
3364
|
-
/* @__PURE__ */
|
|
3437
|
+
/* @__PURE__ */ jsxs10(DropdownMenuItem3, { onClick: () => onAutosizeAll(), children: [
|
|
3438
|
+
/* @__PURE__ */ jsx10(Icon8, { name: "table-columns" }),
|
|
3365
3439
|
isGrid ? "Reset all columns" : "Autosize all columns"
|
|
3366
3440
|
] })
|
|
3367
3441
|
] }),
|
|
3368
|
-
(canHide || canPin) && /* @__PURE__ */
|
|
3369
|
-
(canSort || canResize) && /* @__PURE__ */
|
|
3370
|
-
canHide && /* @__PURE__ */
|
|
3371
|
-
/* @__PURE__ */
|
|
3442
|
+
(canHide || canPin) && /* @__PURE__ */ jsxs10(Fragment5, { children: [
|
|
3443
|
+
(canSort || canResize) && /* @__PURE__ */ jsx10(DropdownMenuSeparator, {}),
|
|
3444
|
+
canHide && /* @__PURE__ */ jsxs10(DropdownMenuItem3, { onClick: () => header.column.toggleVisibility(), children: [
|
|
3445
|
+
/* @__PURE__ */ jsx10(Icon8, { name: "eye-slash" }),
|
|
3372
3446
|
"Hide column"
|
|
3373
3447
|
] }),
|
|
3374
|
-
canPin && (header.column.getIsPinned() ? /* @__PURE__ */
|
|
3375
|
-
/* @__PURE__ */
|
|
3448
|
+
canPin && (header.column.getIsPinned() ? /* @__PURE__ */ jsxs10(DropdownMenuItem3, { onClick: () => header.column.pin(false), children: [
|
|
3449
|
+
/* @__PURE__ */ jsx10(Icon8, { name: "thumbtack" }),
|
|
3376
3450
|
"Unpin column"
|
|
3377
|
-
] }) : /* @__PURE__ */
|
|
3378
|
-
/* @__PURE__ */
|
|
3451
|
+
] }) : /* @__PURE__ */ jsxs10(DropdownMenuItem3, { onClick: () => header.column.pin("start"), children: [
|
|
3452
|
+
/* @__PURE__ */ jsx10(Icon8, { name: "thumbtack" }),
|
|
3379
3453
|
"Pin column"
|
|
3380
3454
|
] }))
|
|
3381
3455
|
] })
|
|
@@ -3395,7 +3469,7 @@ function HeaderCellContent({
|
|
|
3395
3469
|
const resizeHandler = header.getResizeHandler();
|
|
3396
3470
|
const headerTitle = typeof header.column.columnDef.header === "string" ? header.column.columnDef.header : "";
|
|
3397
3471
|
const sorted = header.column.getIsSorted();
|
|
3398
|
-
const labelButton = /* @__PURE__ */
|
|
3472
|
+
const labelButton = /* @__PURE__ */ jsxs10(
|
|
3399
3473
|
"button",
|
|
3400
3474
|
{
|
|
3401
3475
|
type: "button",
|
|
@@ -3406,10 +3480,10 @@ function HeaderCellContent({
|
|
|
3406
3480
|
shouldShowActionsMenu ? "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50 cursor-pointer" : "cursor-default"
|
|
3407
3481
|
),
|
|
3408
3482
|
children: [
|
|
3409
|
-
/* @__PURE__ */
|
|
3410
|
-
/* @__PURE__ */
|
|
3411
|
-
shouldShowActionsMenu && /* @__PURE__ */
|
|
3412
|
-
|
|
3483
|
+
/* @__PURE__ */ jsx10(DataTableSortIcon, { sortOrder: sorted }),
|
|
3484
|
+
/* @__PURE__ */ jsx10("span", { className: "min-w-0 truncate", children: flexRender2(header.column.columnDef.header, header.getContext()) }),
|
|
3485
|
+
shouldShowActionsMenu && /* @__PURE__ */ jsx10(
|
|
3486
|
+
Icon8,
|
|
3413
3487
|
{
|
|
3414
3488
|
size: "sm",
|
|
3415
3489
|
name: "ellipsis",
|
|
@@ -3419,9 +3493,9 @@ function HeaderCellContent({
|
|
|
3419
3493
|
]
|
|
3420
3494
|
}
|
|
3421
3495
|
);
|
|
3422
|
-
const label = shouldShowActionsMenu ? /* @__PURE__ */
|
|
3423
|
-
/* @__PURE__ */
|
|
3424
|
-
/* @__PURE__ */
|
|
3496
|
+
const label = shouldShowActionsMenu ? /* @__PURE__ */ jsxs10(DropdownMenu3, { children: [
|
|
3497
|
+
/* @__PURE__ */ jsx10(DropdownMenuTrigger3, { asChild: true, children: labelButton }),
|
|
3498
|
+
/* @__PURE__ */ jsx10(
|
|
3425
3499
|
ColumnActionsMenuItems,
|
|
3426
3500
|
{
|
|
3427
3501
|
header,
|
|
@@ -3431,12 +3505,12 @@ function HeaderCellContent({
|
|
|
3431
3505
|
}
|
|
3432
3506
|
)
|
|
3433
3507
|
] }) : labelButton;
|
|
3434
|
-
return /* @__PURE__ */
|
|
3435
|
-
/* @__PURE__ */
|
|
3436
|
-
/* @__PURE__ */
|
|
3437
|
-
/* @__PURE__ */
|
|
3508
|
+
return /* @__PURE__ */ jsxs10(Fragment5, { children: [
|
|
3509
|
+
/* @__PURE__ */ jsx10("div", { className: "flex min-w-0 flex-1 items-center gap-1", children: /* @__PURE__ */ jsx10("div", { className: "min-w-0 flex-1", children: !isActionColumn && !isGroupedColumn && (headerTitle ? /* @__PURE__ */ jsxs10(Tooltip4, { children: [
|
|
3510
|
+
/* @__PURE__ */ jsx10(TooltipTrigger4, { asChild: true, children: label }),
|
|
3511
|
+
/* @__PURE__ */ jsx10(TooltipContent4, { children: headerTitle })
|
|
3438
3512
|
] }) : label) }) }),
|
|
3439
|
-
canResize && /* @__PURE__ */
|
|
3513
|
+
canResize && /* @__PURE__ */ jsx10(
|
|
3440
3514
|
"button",
|
|
3441
3515
|
{
|
|
3442
3516
|
type: "button",
|
|
@@ -3480,7 +3554,7 @@ function DataTableHeader({
|
|
|
3480
3554
|
const stickyTopPx = stickyHeader ? stickyHeaderOffset + headerGroupIndex * stickyHeaderRowHeight : void 0;
|
|
3481
3555
|
const isPinned = !isGrid && header.column.getIsPinned();
|
|
3482
3556
|
const pinning = isGrid ? { className: "", style: {} } : getColumnPinningProps(header.column, "header");
|
|
3483
|
-
const content = /* @__PURE__ */
|
|
3557
|
+
const content = /* @__PURE__ */ jsx10(
|
|
3484
3558
|
HeaderCellContent,
|
|
3485
3559
|
{
|
|
3486
3560
|
header,
|
|
@@ -3501,7 +3575,7 @@ function DataTableHeader({
|
|
|
3501
3575
|
isPinned && "z-30"
|
|
3502
3576
|
);
|
|
3503
3577
|
if (isGrid) {
|
|
3504
|
-
return /* @__PURE__ */
|
|
3578
|
+
return /* @__PURE__ */ jsx10(
|
|
3505
3579
|
"div",
|
|
3506
3580
|
{
|
|
3507
3581
|
role: "columnheader",
|
|
@@ -3514,7 +3588,7 @@ function DataTableHeader({
|
|
|
3514
3588
|
header.id
|
|
3515
3589
|
);
|
|
3516
3590
|
}
|
|
3517
|
-
return /* @__PURE__ */
|
|
3591
|
+
return /* @__PURE__ */ jsx10(
|
|
3518
3592
|
BaseTableHead,
|
|
3519
3593
|
{
|
|
3520
3594
|
className: cn(cellClassName, "whitespace-normal"),
|
|
@@ -3529,19 +3603,19 @@ function DataTableHeader({
|
|
|
3529
3603
|
});
|
|
3530
3604
|
};
|
|
3531
3605
|
if (isGrid) {
|
|
3532
|
-
return /* @__PURE__ */
|
|
3606
|
+
return /* @__PURE__ */ jsx10(
|
|
3533
3607
|
"div",
|
|
3534
3608
|
{
|
|
3535
3609
|
role: "rowgroup",
|
|
3536
3610
|
className: cn("col-span-full grid grid-cols-subgrid", HEADER_SURFACE_BG, !!stickyHeader && "sticky z-20"),
|
|
3537
3611
|
style: stickyHeader ? { top: stickyHeaderOffset } : void 0,
|
|
3538
|
-
children: headerGroups.map((headerGroup, headerGroupIndex) => /* @__PURE__ */
|
|
3612
|
+
children: headerGroups.map((headerGroup, headerGroupIndex) => /* @__PURE__ */ jsx10("div", { role: "row", className: "col-span-full grid grid-cols-subgrid border-b", children: renderHeaders(headerGroup, headerGroupIndex) }, headerGroup.id))
|
|
3539
3613
|
}
|
|
3540
3614
|
);
|
|
3541
3615
|
}
|
|
3542
|
-
return /* @__PURE__ */
|
|
3616
|
+
return /* @__PURE__ */ jsx10(BaseTableHeader, { children: headerGroups.map((headerGroup, headerGroupIndex) => /* @__PURE__ */ jsx10(BaseTableRow, { children: renderHeaders(headerGroup, headerGroupIndex) }, headerGroup.id)) });
|
|
3543
3617
|
}
|
|
3544
|
-
var DataTableRow =
|
|
3618
|
+
var DataTableRow = React7.forwardRef(
|
|
3545
3619
|
(_a, ref) => {
|
|
3546
3620
|
var _b = _a, { hoverable, disabled, className, layout = "auto" } = _b, props = __objRest(_b, ["hoverable", "disabled", "className", "layout"]);
|
|
3547
3621
|
const classes = cn(
|
|
@@ -3551,7 +3625,7 @@ var DataTableRow = React6.forwardRef(
|
|
|
3551
3625
|
className
|
|
3552
3626
|
);
|
|
3553
3627
|
if (layout === "grid") {
|
|
3554
|
-
return /* @__PURE__ */
|
|
3628
|
+
return /* @__PURE__ */ jsx10(
|
|
3555
3629
|
"div",
|
|
3556
3630
|
__spreadValues({
|
|
3557
3631
|
ref,
|
|
@@ -3560,7 +3634,7 @@ var DataTableRow = React6.forwardRef(
|
|
|
3560
3634
|
}, props)
|
|
3561
3635
|
);
|
|
3562
3636
|
}
|
|
3563
|
-
return /* @__PURE__ */
|
|
3637
|
+
return /* @__PURE__ */ jsx10(BaseTableRow, __spreadValues({ ref, className: classes }, props));
|
|
3564
3638
|
}
|
|
3565
3639
|
);
|
|
3566
3640
|
DataTableRow.displayName = "DataTableRow";
|
|
@@ -3591,7 +3665,7 @@ function DataTableCell({
|
|
|
3591
3665
|
isPinned && "z-10",
|
|
3592
3666
|
className
|
|
3593
3667
|
);
|
|
3594
|
-
const cellElement = isGrid ? /* @__PURE__ */
|
|
3668
|
+
const cellElement = isGrid ? /* @__PURE__ */ jsx10(
|
|
3595
3669
|
"div",
|
|
3596
3670
|
{
|
|
3597
3671
|
role: "cell",
|
|
@@ -3599,7 +3673,7 @@ function DataTableCell({
|
|
|
3599
3673
|
style: { minWidth: cell.column.columnDef.minSize },
|
|
3600
3674
|
children: content
|
|
3601
3675
|
}
|
|
3602
|
-
) : /* @__PURE__ */
|
|
3676
|
+
) : /* @__PURE__ */ jsx10(
|
|
3603
3677
|
BaseTableCell,
|
|
3604
3678
|
{
|
|
3605
3679
|
className: cellClassName,
|
|
@@ -3611,9 +3685,9 @@ function DataTableCell({
|
|
|
3611
3685
|
}
|
|
3612
3686
|
);
|
|
3613
3687
|
if (!shouldShowContextualMenu || !onContextCell) return cellElement;
|
|
3614
|
-
return /* @__PURE__ */
|
|
3615
|
-
/* @__PURE__ */
|
|
3616
|
-
/* @__PURE__ */
|
|
3688
|
+
return /* @__PURE__ */ jsxs10(ContextMenu, { children: [
|
|
3689
|
+
/* @__PURE__ */ jsx10(ContextMenuTrigger, { asChild: true, children: cellElement }),
|
|
3690
|
+
/* @__PURE__ */ jsx10(
|
|
3617
3691
|
CellContextualFilter,
|
|
3618
3692
|
{
|
|
3619
3693
|
filter: contextualFilter,
|
|
@@ -3632,7 +3706,7 @@ function DataTableGroupRow({
|
|
|
3632
3706
|
layout = "auto"
|
|
3633
3707
|
}) {
|
|
3634
3708
|
if (layout === "grid") {
|
|
3635
|
-
return /* @__PURE__ */
|
|
3709
|
+
return /* @__PURE__ */ jsx10("div", { role: "row", className: "bg-muted/50 hover:bg-muted/50 col-span-full grid grid-cols-subgrid", children: /* @__PURE__ */ jsx10(
|
|
3636
3710
|
"div",
|
|
3637
3711
|
{
|
|
3638
3712
|
role: "cell",
|
|
@@ -3642,7 +3716,7 @@ function DataTableGroupRow({
|
|
|
3642
3716
|
}
|
|
3643
3717
|
) });
|
|
3644
3718
|
}
|
|
3645
|
-
return /* @__PURE__ */
|
|
3719
|
+
return /* @__PURE__ */ jsx10(BaseTableRow, { className: "bg-muted/50 hover:bg-muted/50", children: /* @__PURE__ */ jsx10(BaseTableCell, { colSpan, className: "text-foreground border-b font-semibold whitespace-nowrap", children: groupLabel }) });
|
|
3646
3720
|
}
|
|
3647
3721
|
function DataTableSkeletonBody({
|
|
3648
3722
|
rowCount = 10,
|
|
@@ -3651,32 +3725,32 @@ function DataTableSkeletonBody({
|
|
|
3651
3725
|
layout = "auto"
|
|
3652
3726
|
}) {
|
|
3653
3727
|
const isGrid = layout === "grid";
|
|
3654
|
-
const rows = Array.from({ length: rowCount }).map((_, rowIndex) => /* @__PURE__ */
|
|
3728
|
+
const rows = Array.from({ length: rowCount }).map((_, rowIndex) => /* @__PURE__ */ jsx10(DataTableRow, { layout, children: columns.map(
|
|
3655
3729
|
(col) => {
|
|
3656
3730
|
var _a, _b;
|
|
3657
|
-
return isGrid ? /* @__PURE__ */
|
|
3731
|
+
return isGrid ? /* @__PURE__ */ jsx10(
|
|
3658
3732
|
"div",
|
|
3659
3733
|
{
|
|
3660
3734
|
role: "cell",
|
|
3661
3735
|
className: cn(TABLE_CELL_CLASSES, "flex items-center overflow-hidden"),
|
|
3662
3736
|
style: { minWidth: col.minSize },
|
|
3663
|
-
children: (_a = renderCell == null ? void 0 : renderCell(col.id)) != null ? _a : /* @__PURE__ */
|
|
3737
|
+
children: (_a = renderCell == null ? void 0 : renderCell(col.id)) != null ? _a : /* @__PURE__ */ jsx10(Skeleton, { className: "h-4 w-full" })
|
|
3664
3738
|
},
|
|
3665
3739
|
`skeleton-col-${col.id}-row-${rowIndex}`
|
|
3666
|
-
) : /* @__PURE__ */
|
|
3740
|
+
) : /* @__PURE__ */ jsx10(
|
|
3667
3741
|
BaseTableCell,
|
|
3668
3742
|
{
|
|
3669
3743
|
style: { width: col.size, minWidth: col.minSize, maxWidth: col.maxSize },
|
|
3670
|
-
children: (_b = renderCell == null ? void 0 : renderCell(col.id)) != null ? _b : /* @__PURE__ */
|
|
3744
|
+
children: (_b = renderCell == null ? void 0 : renderCell(col.id)) != null ? _b : /* @__PURE__ */ jsx10(Skeleton, { className: "h-4 w-full" })
|
|
3671
3745
|
},
|
|
3672
3746
|
`skeleton-col-${col.id}-row-${rowIndex}`
|
|
3673
3747
|
);
|
|
3674
3748
|
}
|
|
3675
3749
|
) }, `skeleton-row-${rowIndex}`));
|
|
3676
3750
|
if (isGrid) {
|
|
3677
|
-
return /* @__PURE__ */
|
|
3751
|
+
return /* @__PURE__ */ jsx10("div", { role: "rowgroup", className: "col-span-full grid grid-cols-subgrid", "data-testid": "table-skeleton-loader", children: rows });
|
|
3678
3752
|
}
|
|
3679
|
-
return /* @__PURE__ */
|
|
3753
|
+
return /* @__PURE__ */ jsx10(BaseTableBody, { "data-testid": "table-skeleton-loader", children: rows });
|
|
3680
3754
|
}
|
|
3681
3755
|
function DataTableExpandedRow({
|
|
3682
3756
|
colSpan,
|
|
@@ -3686,9 +3760,9 @@ function DataTableExpandedRow({
|
|
|
3686
3760
|
}) {
|
|
3687
3761
|
if (!show) return null;
|
|
3688
3762
|
if (layout === "grid") {
|
|
3689
|
-
return /* @__PURE__ */
|
|
3763
|
+
return /* @__PURE__ */ jsx10("div", { role: "row", className: "col-span-full grid grid-cols-subgrid", children: /* @__PURE__ */ jsx10("div", { role: "cell", style: { gridColumn: `span ${colSpan}` }, className: "bg-card p-0 align-top whitespace-normal", children }) });
|
|
3690
3764
|
}
|
|
3691
|
-
return /* @__PURE__ */
|
|
3765
|
+
return /* @__PURE__ */ jsx10(BaseTableRow, { className: "hover:bg-transparent", children: /* @__PURE__ */ jsx10(BaseTableCell, { colSpan, className: "bg-card p-0 align-top whitespace-normal", children }) });
|
|
3692
3766
|
}
|
|
3693
3767
|
function DataTableBody({
|
|
3694
3768
|
tableRows,
|
|
@@ -3714,7 +3788,7 @@ function DataTableBody({
|
|
|
3714
3788
|
minSize: c.columnDef.minSize,
|
|
3715
3789
|
maxSize: c.columnDef.maxSize
|
|
3716
3790
|
}));
|
|
3717
|
-
return /* @__PURE__ */
|
|
3791
|
+
return /* @__PURE__ */ jsx10(
|
|
3718
3792
|
DataTableSkeletonBody,
|
|
3719
3793
|
{
|
|
3720
3794
|
columns: skeletonColumns,
|
|
@@ -3728,18 +3802,18 @@ function DataTableBody({
|
|
|
3728
3802
|
var _a, _b, _c, _d, _e;
|
|
3729
3803
|
if ((_a = row.getIsGrouped) == null ? void 0 : _a.call(row)) {
|
|
3730
3804
|
const groupLabel = (_c = row.groupingValue) != null ? _c : row.groupingColumnId ? (_b = row.getGroupingValue) == null ? void 0 : _b.call(row, row.groupingColumnId) : void 0;
|
|
3731
|
-
return /* @__PURE__ */
|
|
3805
|
+
return /* @__PURE__ */ jsx10(DataTableGroupRow, { groupLabel: String(groupLabel != null ? groupLabel : ""), colSpan, layout }, row.id);
|
|
3732
3806
|
}
|
|
3733
3807
|
const isExpanded = !!(((_d = row.getCanExpand) == null ? void 0 : _d.call(row)) && ((_e = row.getIsExpanded) == null ? void 0 : _e.call(row)));
|
|
3734
3808
|
const expandedRow = renderExpandedRow && isExpanded ? renderExpandedRow(row.original) : null;
|
|
3735
|
-
return /* @__PURE__ */
|
|
3736
|
-
/* @__PURE__ */
|
|
3809
|
+
return /* @__PURE__ */ jsxs10(React7.Fragment, { children: [
|
|
3810
|
+
/* @__PURE__ */ jsx10(
|
|
3737
3811
|
DataTableRow,
|
|
3738
3812
|
__spreadProps(__spreadValues({}, onRowRender ? onRowRender(row.original, row) : {}), {
|
|
3739
3813
|
"data-expanded": isExpanded || void 0,
|
|
3740
3814
|
"data-depth": row.depth || void 0,
|
|
3741
3815
|
layout,
|
|
3742
|
-
children: row.getVisibleCells().filter((cell) => !isFilterOnlyColumn(cell.column)).map((cell) => /* @__PURE__ */
|
|
3816
|
+
children: row.getVisibleCells().filter((cell) => !isFilterOnlyColumn(cell.column)).map((cell) => /* @__PURE__ */ jsx10(
|
|
3743
3817
|
DataTableCell,
|
|
3744
3818
|
{
|
|
3745
3819
|
cell,
|
|
@@ -3753,21 +3827,21 @@ function DataTableBody({
|
|
|
3753
3827
|
))
|
|
3754
3828
|
})
|
|
3755
3829
|
),
|
|
3756
|
-
/* @__PURE__ */
|
|
3830
|
+
/* @__PURE__ */ jsx10(DataTableExpandedRow, { colSpan, show: expandedRow != null, layout, children: expandedRow })
|
|
3757
3831
|
] }, row.id);
|
|
3758
3832
|
});
|
|
3759
3833
|
if (isGrid) {
|
|
3760
|
-
return /* @__PURE__ */
|
|
3834
|
+
return /* @__PURE__ */ jsx10("div", { role: "rowgroup", className: "col-span-full grid grid-cols-subgrid", children: rows });
|
|
3761
3835
|
}
|
|
3762
|
-
return /* @__PURE__ */
|
|
3836
|
+
return /* @__PURE__ */ jsx10(BaseTableBody, { children: rows });
|
|
3763
3837
|
}
|
|
3764
3838
|
|
|
3765
3839
|
// src/data-table/view-filter.tsx
|
|
3766
|
-
import * as
|
|
3840
|
+
import * as React9 from "react";
|
|
3767
3841
|
|
|
3768
3842
|
// src/filter-bar/filter-bar.tsx
|
|
3769
|
-
import * as
|
|
3770
|
-
import { Icon as
|
|
3843
|
+
import * as React8 from "react";
|
|
3844
|
+
import { Icon as Icon9 } from "@upbound/monarch-core";
|
|
3771
3845
|
import { Badge as Badge3 } from "@upbound/monarch-core";
|
|
3772
3846
|
import { Button as Button7 } from "@upbound/monarch-core";
|
|
3773
3847
|
import { ButtonGroup as ButtonGroup2, ButtonGroupText as ButtonGroupText2 } from "@upbound/monarch-core";
|
|
@@ -3797,7 +3871,7 @@ import {
|
|
|
3797
3871
|
import { Input as Input2 } from "@upbound/monarch-core";
|
|
3798
3872
|
import { Label as Label3 } from "@upbound/monarch-core";
|
|
3799
3873
|
import { Popover as Popover2, PopoverContent as PopoverContent2, PopoverTrigger as PopoverTrigger2 } from "@upbound/monarch-core";
|
|
3800
|
-
import { Fragment as Fragment6, jsx as
|
|
3874
|
+
import { Fragment as Fragment6, jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3801
3875
|
function asCheckboxValue(value) {
|
|
3802
3876
|
return Array.isArray(value) ? value : [];
|
|
3803
3877
|
}
|
|
@@ -3866,13 +3940,13 @@ function FilterBar(_a) {
|
|
|
3866
3940
|
const remainingFilters = filters.filter((f) => !usedKeys.has(f.key));
|
|
3867
3941
|
const availableFilters = filters.some(hasOrder) ? remainingFilters : sortBy(remainingFilters, (f) => f.label);
|
|
3868
3942
|
const shouldShowFilters = availableFilters.length > 0 || activeFilters.length > 0;
|
|
3869
|
-
const [pendingOpenKey, setPendingOpenKey] =
|
|
3943
|
+
const [pendingOpenKey, setPendingOpenKey] = React8.useState(null);
|
|
3870
3944
|
function handleAddFilter(key) {
|
|
3871
3945
|
onAddFilter(key);
|
|
3872
3946
|
setPendingOpenKey(key);
|
|
3873
3947
|
}
|
|
3874
|
-
const containerRef =
|
|
3875
|
-
return /* @__PURE__ */
|
|
3948
|
+
const containerRef = React8.useRef(null);
|
|
3949
|
+
return /* @__PURE__ */ jsxs11(
|
|
3876
3950
|
"div",
|
|
3877
3951
|
__spreadProps(__spreadValues({
|
|
3878
3952
|
"data-slot": "filter-bar",
|
|
@@ -3881,7 +3955,7 @@ function FilterBar(_a) {
|
|
|
3881
3955
|
ref: composeRefs(containerRef, ref)
|
|
3882
3956
|
}, props), {
|
|
3883
3957
|
children: [
|
|
3884
|
-
availableFilters.length > 0 && /* @__PURE__ */
|
|
3958
|
+
availableFilters.length > 0 && /* @__PURE__ */ jsxs11(
|
|
3885
3959
|
Combobox2,
|
|
3886
3960
|
{
|
|
3887
3961
|
items: availableFilters,
|
|
@@ -3892,14 +3966,14 @@ function FilterBar(_a) {
|
|
|
3892
3966
|
if (filter) handleAddFilter(filter.key);
|
|
3893
3967
|
},
|
|
3894
3968
|
children: [
|
|
3895
|
-
/* @__PURE__ */
|
|
3896
|
-
/* @__PURE__ */
|
|
3969
|
+
/* @__PURE__ */ jsxs11(ComboboxTrigger2, { "aria-label": "Add filter", showIndicator: false, render: /* @__PURE__ */ jsx11(Button7, { variant: "outline" }), children: [
|
|
3970
|
+
/* @__PURE__ */ jsx11(Icon9, { name: "plus", "data-icon": "inline-start" }),
|
|
3897
3971
|
"Add filter"
|
|
3898
3972
|
] }),
|
|
3899
|
-
/* @__PURE__ */
|
|
3900
|
-
/* @__PURE__ */
|
|
3901
|
-
/* @__PURE__ */
|
|
3902
|
-
/* @__PURE__ */
|
|
3973
|
+
/* @__PURE__ */ jsxs11(ComboboxContent2, { container: containerRef, align: "start", className: "w-48", children: [
|
|
3974
|
+
/* @__PURE__ */ jsx11(ComboboxInput2, { showTrigger: false, placeholder: "Search filters\u2026" }),
|
|
3975
|
+
/* @__PURE__ */ jsx11(ComboboxEmpty2, { children: "No filters found." }),
|
|
3976
|
+
/* @__PURE__ */ jsx11(ComboboxList2, { children: (filter) => /* @__PURE__ */ jsx11(ComboboxItem2, { value: filter, children: filter.label }, filter.key) })
|
|
3903
3977
|
] })
|
|
3904
3978
|
]
|
|
3905
3979
|
}
|
|
@@ -3907,7 +3981,7 @@ function FilterBar(_a) {
|
|
|
3907
3981
|
activeFilters.map((active) => {
|
|
3908
3982
|
const definition = filters.find((f) => f.key === active.key);
|
|
3909
3983
|
if (!definition) return null;
|
|
3910
|
-
return /* @__PURE__ */
|
|
3984
|
+
return /* @__PURE__ */ jsx11(
|
|
3911
3985
|
FilterChip,
|
|
3912
3986
|
{
|
|
3913
3987
|
definition,
|
|
@@ -3930,7 +4004,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
3930
4004
|
const type = (_a = definition.type) != null ? _a : "checkbox";
|
|
3931
4005
|
switch (type) {
|
|
3932
4006
|
case "checkbox":
|
|
3933
|
-
return /* @__PURE__ */
|
|
4007
|
+
return /* @__PURE__ */ jsx11(
|
|
3934
4008
|
CheckboxFilterChip,
|
|
3935
4009
|
{
|
|
3936
4010
|
definition,
|
|
@@ -3942,7 +4016,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
3942
4016
|
}
|
|
3943
4017
|
);
|
|
3944
4018
|
case "radio":
|
|
3945
|
-
return /* @__PURE__ */
|
|
4019
|
+
return /* @__PURE__ */ jsx11(
|
|
3946
4020
|
RadioFilterChip,
|
|
3947
4021
|
{
|
|
3948
4022
|
definition,
|
|
@@ -3954,7 +4028,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
3954
4028
|
}
|
|
3955
4029
|
);
|
|
3956
4030
|
case "text":
|
|
3957
|
-
return /* @__PURE__ */
|
|
4031
|
+
return /* @__PURE__ */ jsx11(
|
|
3958
4032
|
TextFilterChip,
|
|
3959
4033
|
{
|
|
3960
4034
|
definition,
|
|
@@ -3965,7 +4039,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
3965
4039
|
}
|
|
3966
4040
|
);
|
|
3967
4041
|
case "multiText":
|
|
3968
|
-
return /* @__PURE__ */
|
|
4042
|
+
return /* @__PURE__ */ jsx11(
|
|
3969
4043
|
MultiTextFilterChip,
|
|
3970
4044
|
{
|
|
3971
4045
|
definition,
|
|
@@ -3976,7 +4050,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
3976
4050
|
}
|
|
3977
4051
|
);
|
|
3978
4052
|
case "date":
|
|
3979
|
-
return /* @__PURE__ */
|
|
4053
|
+
return /* @__PURE__ */ jsx11(
|
|
3980
4054
|
DateFilterChip,
|
|
3981
4055
|
{
|
|
3982
4056
|
definition,
|
|
@@ -3989,7 +4063,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
3989
4063
|
}
|
|
3990
4064
|
}
|
|
3991
4065
|
function FilterChipRemoveButton({ label, onRemove }) {
|
|
3992
|
-
return /* @__PURE__ */
|
|
4066
|
+
return /* @__PURE__ */ jsx11(Button7, { variant: "outline", size: "icon", "aria-label": `Remove ${label} filter`, onClick: onRemove, children: /* @__PURE__ */ jsx11(Icon9, { name: "xmark" }) });
|
|
3993
4067
|
}
|
|
3994
4068
|
function CheckboxFilterChip({
|
|
3995
4069
|
definition,
|
|
@@ -4008,9 +4082,9 @@ function CheckboxFilterChip({
|
|
|
4008
4082
|
const next = values.includes(optionValue) ? values.filter((v) => v !== optionValue) : [...values, optionValue];
|
|
4009
4083
|
onChangeValue(next);
|
|
4010
4084
|
}
|
|
4011
|
-
return /* @__PURE__ */
|
|
4012
|
-
/* @__PURE__ */
|
|
4013
|
-
searchable ? /* @__PURE__ */
|
|
4085
|
+
return /* @__PURE__ */ jsxs11(ButtonGroup2, { children: [
|
|
4086
|
+
/* @__PURE__ */ jsx11(ButtonGroupText2, { children: label }),
|
|
4087
|
+
searchable ? /* @__PURE__ */ jsxs11(
|
|
4014
4088
|
Combobox2,
|
|
4015
4089
|
{
|
|
4016
4090
|
items: options,
|
|
@@ -4020,34 +4094,34 @@ function CheckboxFilterChip({
|
|
|
4020
4094
|
value: options.filter((o) => values.includes(o.value)),
|
|
4021
4095
|
onValueChange: (selected) => onChangeValue(selected.map((s) => s.value)),
|
|
4022
4096
|
children: [
|
|
4023
|
-
/* @__PURE__ */
|
|
4097
|
+
/* @__PURE__ */ jsx11(
|
|
4024
4098
|
ComboboxTrigger2,
|
|
4025
4099
|
{
|
|
4026
|
-
render: /* @__PURE__ */
|
|
4027
|
-
children: /* @__PURE__ */
|
|
4100
|
+
render: /* @__PURE__ */ jsx11(Button7, { variant: "outline", className: "gap-1 font-normal [&>svg:last-child]:size-(--icon-sm)" }),
|
|
4101
|
+
children: /* @__PURE__ */ jsx11("span", { className: values.length === 0 ? "text-muted-foreground" : "", children: displayLabel })
|
|
4028
4102
|
}
|
|
4029
4103
|
),
|
|
4030
|
-
/* @__PURE__ */
|
|
4104
|
+
/* @__PURE__ */ jsxs11(
|
|
4031
4105
|
ComboboxContent2,
|
|
4032
4106
|
{
|
|
4033
4107
|
container,
|
|
4034
4108
|
className: "min-w-64",
|
|
4035
4109
|
collisionAvoidance: { side: "none", align: "shift" },
|
|
4036
4110
|
children: [
|
|
4037
|
-
/* @__PURE__ */
|
|
4038
|
-
values.length > 0 && /* @__PURE__ */
|
|
4039
|
-
/* @__PURE__ */
|
|
4040
|
-
/* @__PURE__ */
|
|
4041
|
-
/* @__PURE__ */
|
|
4111
|
+
/* @__PURE__ */ jsx11(ComboboxInput2, { showTrigger: false, placeholder: `Search ${label.toLowerCase()}\u2026` }),
|
|
4112
|
+
values.length > 0 && /* @__PURE__ */ jsxs11(Fragment6, { children: [
|
|
4113
|
+
/* @__PURE__ */ jsxs11(ComboboxSelectedChips2, { children: [
|
|
4114
|
+
/* @__PURE__ */ jsx11(ComboboxValue2, { children: (selected) => /* @__PURE__ */ jsx11(Fragment6, { children: selected.map((item) => /* @__PURE__ */ jsx11(ComboboxChip2, { children: item.label }, item.value)) }) }),
|
|
4115
|
+
/* @__PURE__ */ jsx11(ComboboxClearAll2, { onClick: () => onChangeValue([]) })
|
|
4042
4116
|
] }),
|
|
4043
|
-
/* @__PURE__ */
|
|
4117
|
+
/* @__PURE__ */ jsx11(ComboboxSeparator2, {})
|
|
4044
4118
|
] }),
|
|
4045
|
-
/* @__PURE__ */
|
|
4119
|
+
/* @__PURE__ */ jsxs11(ComboboxEmpty2, { children: [
|
|
4046
4120
|
"No ",
|
|
4047
4121
|
label.toLowerCase(),
|
|
4048
4122
|
" found."
|
|
4049
4123
|
] }),
|
|
4050
|
-
/* @__PURE__ */
|
|
4124
|
+
/* @__PURE__ */ jsx11(ComboboxList2, { children: (item) => /* @__PURE__ */ jsxs11(ComboboxItem2, { value: item, children: [
|
|
4051
4125
|
item.icon,
|
|
4052
4126
|
item.label
|
|
4053
4127
|
] }, item.value) })
|
|
@@ -4056,12 +4130,12 @@ function CheckboxFilterChip({
|
|
|
4056
4130
|
)
|
|
4057
4131
|
]
|
|
4058
4132
|
}
|
|
4059
|
-
) : /* @__PURE__ */
|
|
4060
|
-
/* @__PURE__ */
|
|
4061
|
-
/* @__PURE__ */
|
|
4062
|
-
/* @__PURE__ */
|
|
4133
|
+
) : /* @__PURE__ */ jsxs11(DropdownMenu4, { defaultOpen: autoOpen, children: [
|
|
4134
|
+
/* @__PURE__ */ jsx11(DropdownMenuTrigger4, { asChild: true, children: /* @__PURE__ */ jsxs11(Button7, { variant: "outline", className: "gap-1 font-normal", children: [
|
|
4135
|
+
/* @__PURE__ */ jsx11("span", { className: values.length === 0 ? "text-muted-foreground" : "", children: displayLabel }),
|
|
4136
|
+
/* @__PURE__ */ jsx11(Icon9, { name: "chevron-down", size: "sm", className: "text-muted-foreground" })
|
|
4063
4137
|
] }) }),
|
|
4064
|
-
/* @__PURE__ */
|
|
4138
|
+
/* @__PURE__ */ jsx11(DropdownMenuContent4, { align: "start", className: "w-48", children: options.map((opt) => /* @__PURE__ */ jsxs11(
|
|
4065
4139
|
DropdownMenuCheckboxItem2,
|
|
4066
4140
|
{
|
|
4067
4141
|
checked: values.includes(opt.value),
|
|
@@ -4074,7 +4148,7 @@ function CheckboxFilterChip({
|
|
|
4074
4148
|
opt.value
|
|
4075
4149
|
)) })
|
|
4076
4150
|
] }),
|
|
4077
|
-
/* @__PURE__ */
|
|
4151
|
+
/* @__PURE__ */ jsx11(FilterChipRemoveButton, { label, onRemove })
|
|
4078
4152
|
] });
|
|
4079
4153
|
}
|
|
4080
4154
|
function RadioFilterChip({
|
|
@@ -4091,9 +4165,9 @@ function RadioFilterChip({
|
|
|
4091
4165
|
const selectedValue = asRadioValue(value);
|
|
4092
4166
|
const displayLabel = selectedValue ? (_b = (_a = options.find((o) => o.value === selectedValue)) == null ? void 0 : _a.label) != null ? _b : selectedValue : "Any";
|
|
4093
4167
|
const selected = (_c = options.find((o) => o.value === selectedValue)) != null ? _c : null;
|
|
4094
|
-
return /* @__PURE__ */
|
|
4095
|
-
/* @__PURE__ */
|
|
4096
|
-
searchable ? /* @__PURE__ */
|
|
4168
|
+
return /* @__PURE__ */ jsxs11(ButtonGroup2, { children: [
|
|
4169
|
+
/* @__PURE__ */ jsx11(ButtonGroupText2, { children: label }),
|
|
4170
|
+
searchable ? /* @__PURE__ */ jsxs11(
|
|
4097
4171
|
Combobox2,
|
|
4098
4172
|
{
|
|
4099
4173
|
items: options,
|
|
@@ -4105,27 +4179,27 @@ function RadioFilterChip({
|
|
|
4105
4179
|
return onChangeValue((_a2 = next == null ? void 0 : next.value) != null ? _a2 : "");
|
|
4106
4180
|
},
|
|
4107
4181
|
children: [
|
|
4108
|
-
/* @__PURE__ */
|
|
4182
|
+
/* @__PURE__ */ jsx11(
|
|
4109
4183
|
ComboboxTrigger2,
|
|
4110
4184
|
{
|
|
4111
|
-
render: /* @__PURE__ */
|
|
4112
|
-
children: /* @__PURE__ */
|
|
4185
|
+
render: /* @__PURE__ */ jsx11(Button7, { variant: "outline", className: "gap-1 font-normal [&>svg:last-child]:size-(--icon-sm)" }),
|
|
4186
|
+
children: /* @__PURE__ */ jsx11("span", { className: selectedValue ? "" : "text-muted-foreground", children: displayLabel })
|
|
4113
4187
|
}
|
|
4114
4188
|
),
|
|
4115
|
-
/* @__PURE__ */
|
|
4189
|
+
/* @__PURE__ */ jsxs11(
|
|
4116
4190
|
ComboboxContent2,
|
|
4117
4191
|
{
|
|
4118
4192
|
container,
|
|
4119
4193
|
className: "min-w-64",
|
|
4120
4194
|
collisionAvoidance: { side: "none", align: "shift" },
|
|
4121
4195
|
children: [
|
|
4122
|
-
/* @__PURE__ */
|
|
4123
|
-
/* @__PURE__ */
|
|
4196
|
+
/* @__PURE__ */ jsx11(ComboboxInput2, { showTrigger: false, placeholder: `Search ${label.toLowerCase()}\u2026` }),
|
|
4197
|
+
/* @__PURE__ */ jsxs11(ComboboxEmpty2, { children: [
|
|
4124
4198
|
"No ",
|
|
4125
4199
|
label.toLowerCase(),
|
|
4126
4200
|
" found."
|
|
4127
4201
|
] }),
|
|
4128
|
-
/* @__PURE__ */
|
|
4202
|
+
/* @__PURE__ */ jsx11(ComboboxList2, { children: (item) => /* @__PURE__ */ jsxs11(ComboboxItem2, { value: item, children: [
|
|
4129
4203
|
item.icon,
|
|
4130
4204
|
item.label
|
|
4131
4205
|
] }, item.value) })
|
|
@@ -4134,17 +4208,17 @@ function RadioFilterChip({
|
|
|
4134
4208
|
)
|
|
4135
4209
|
]
|
|
4136
4210
|
}
|
|
4137
|
-
) : /* @__PURE__ */
|
|
4138
|
-
/* @__PURE__ */
|
|
4139
|
-
/* @__PURE__ */
|
|
4140
|
-
/* @__PURE__ */
|
|
4211
|
+
) : /* @__PURE__ */ jsxs11(DropdownMenu4, { defaultOpen: autoOpen, children: [
|
|
4212
|
+
/* @__PURE__ */ jsx11(DropdownMenuTrigger4, { asChild: true, children: /* @__PURE__ */ jsxs11(Button7, { variant: "outline", className: "gap-1 font-normal", children: [
|
|
4213
|
+
/* @__PURE__ */ jsx11("span", { className: selectedValue ? "" : "text-muted-foreground", children: displayLabel }),
|
|
4214
|
+
/* @__PURE__ */ jsx11(Icon9, { name: "chevron-down", size: "sm", className: "text-muted-foreground" })
|
|
4141
4215
|
] }) }),
|
|
4142
|
-
/* @__PURE__ */
|
|
4216
|
+
/* @__PURE__ */ jsx11(DropdownMenuContent4, { align: "start", className: "w-48", children: /* @__PURE__ */ jsx11(DropdownMenuRadioGroup, { value: selectedValue, onValueChange: onChangeValue, children: options.map((opt) => /* @__PURE__ */ jsxs11(DropdownMenuRadioItem, { value: opt.value, children: [
|
|
4143
4217
|
opt.icon,
|
|
4144
4218
|
opt.label
|
|
4145
4219
|
] }, opt.value)) }) })
|
|
4146
4220
|
] }),
|
|
4147
|
-
/* @__PURE__ */
|
|
4221
|
+
/* @__PURE__ */ jsx11(FilterChipRemoveButton, { label, onRemove })
|
|
4148
4222
|
] });
|
|
4149
4223
|
}
|
|
4150
4224
|
function TextFilterChip({
|
|
@@ -4156,12 +4230,12 @@ function TextFilterChip({
|
|
|
4156
4230
|
}) {
|
|
4157
4231
|
const { label, placeholder } = definition;
|
|
4158
4232
|
const text = asTextValue(value);
|
|
4159
|
-
const [open, setOpen] =
|
|
4160
|
-
return /* @__PURE__ */
|
|
4161
|
-
/* @__PURE__ */
|
|
4162
|
-
/* @__PURE__ */
|
|
4163
|
-
/* @__PURE__ */
|
|
4164
|
-
/* @__PURE__ */
|
|
4233
|
+
const [open, setOpen] = React8.useState(!!autoOpen);
|
|
4234
|
+
return /* @__PURE__ */ jsxs11(ButtonGroup2, { children: [
|
|
4235
|
+
/* @__PURE__ */ jsx11(ButtonGroupText2, { children: label }),
|
|
4236
|
+
/* @__PURE__ */ jsxs11(Popover2, { open, onOpenChange: setOpen, children: [
|
|
4237
|
+
/* @__PURE__ */ jsx11(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsx11(Button7, { variant: "outline", className: "gap-1 font-normal", children: /* @__PURE__ */ jsx11("span", { className: text ? "" : "text-muted-foreground", children: text || "Any" }) }) }),
|
|
4238
|
+
/* @__PURE__ */ jsx11(PopoverContent2, { align: "start", children: /* @__PURE__ */ jsx11(
|
|
4165
4239
|
Input2,
|
|
4166
4240
|
{
|
|
4167
4241
|
autoFocus: true,
|
|
@@ -4174,7 +4248,7 @@ function TextFilterChip({
|
|
|
4174
4248
|
}
|
|
4175
4249
|
) })
|
|
4176
4250
|
] }),
|
|
4177
|
-
/* @__PURE__ */
|
|
4251
|
+
/* @__PURE__ */ jsx11(FilterChipRemoveButton, { label, onRemove })
|
|
4178
4252
|
] });
|
|
4179
4253
|
}
|
|
4180
4254
|
function MultiTextFilterChip({
|
|
@@ -4186,7 +4260,7 @@ function MultiTextFilterChip({
|
|
|
4186
4260
|
}) {
|
|
4187
4261
|
const { label, placeholder } = definition;
|
|
4188
4262
|
const tokens = asMultiTextValue(value);
|
|
4189
|
-
const [draft, setDraft] =
|
|
4263
|
+
const [draft, setDraft] = React8.useState("");
|
|
4190
4264
|
const displayLabel = tokens.length === 0 ? "Any" : tokens.length === 1 ? tokens[0] : `${tokens.length} values`;
|
|
4191
4265
|
function addToken() {
|
|
4192
4266
|
const token = draft.trim();
|
|
@@ -4200,25 +4274,25 @@ function MultiTextFilterChip({
|
|
|
4200
4274
|
function removeToken(token) {
|
|
4201
4275
|
onChangeValue(tokens.filter((t) => t !== token));
|
|
4202
4276
|
}
|
|
4203
|
-
return /* @__PURE__ */
|
|
4204
|
-
/* @__PURE__ */
|
|
4205
|
-
/* @__PURE__ */
|
|
4206
|
-
/* @__PURE__ */
|
|
4207
|
-
/* @__PURE__ */
|
|
4208
|
-
tokens.length > 0 && /* @__PURE__ */
|
|
4277
|
+
return /* @__PURE__ */ jsxs11(ButtonGroup2, { children: [
|
|
4278
|
+
/* @__PURE__ */ jsx11(ButtonGroupText2, { children: label }),
|
|
4279
|
+
/* @__PURE__ */ jsxs11(Popover2, { defaultOpen: autoOpen, children: [
|
|
4280
|
+
/* @__PURE__ */ jsx11(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsx11(Button7, { variant: "outline", className: "gap-1 font-normal", children: /* @__PURE__ */ jsx11("span", { className: tokens.length === 0 ? "text-muted-foreground" : "", children: displayLabel }) }) }),
|
|
4281
|
+
/* @__PURE__ */ jsx11(PopoverContent2, { align: "start", children: /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-2", children: [
|
|
4282
|
+
tokens.length > 0 && /* @__PURE__ */ jsx11("div", { className: "flex flex-wrap gap-1", children: tokens.map((token) => /* @__PURE__ */ jsxs11(Badge3, { variant: "secondary", className: "gap-1", children: [
|
|
4209
4283
|
token,
|
|
4210
|
-
/* @__PURE__ */
|
|
4284
|
+
/* @__PURE__ */ jsx11(
|
|
4211
4285
|
"button",
|
|
4212
4286
|
{
|
|
4213
4287
|
type: "button",
|
|
4214
4288
|
"aria-label": `Remove ${token}`,
|
|
4215
4289
|
onClick: () => removeToken(token),
|
|
4216
4290
|
className: "cursor-pointer",
|
|
4217
|
-
children: /* @__PURE__ */
|
|
4291
|
+
children: /* @__PURE__ */ jsx11(Icon9, { name: "xmark", size: "xs" })
|
|
4218
4292
|
}
|
|
4219
4293
|
)
|
|
4220
4294
|
] }, token)) }),
|
|
4221
|
-
/* @__PURE__ */
|
|
4295
|
+
/* @__PURE__ */ jsx11(
|
|
4222
4296
|
Input2,
|
|
4223
4297
|
{
|
|
4224
4298
|
autoFocus: true,
|
|
@@ -4237,7 +4311,7 @@ function MultiTextFilterChip({
|
|
|
4237
4311
|
)
|
|
4238
4312
|
] }) })
|
|
4239
4313
|
] }),
|
|
4240
|
-
/* @__PURE__ */
|
|
4314
|
+
/* @__PURE__ */ jsx11(FilterChipRemoveButton, { label, onRemove })
|
|
4241
4315
|
] });
|
|
4242
4316
|
}
|
|
4243
4317
|
function DateFilterChip({
|
|
@@ -4267,12 +4341,12 @@ function DateFilterChip({
|
|
|
4267
4341
|
if (!endDate) return;
|
|
4268
4342
|
onChangeValue({ startDate, endDate: applyTimeToDate(endDate, time) });
|
|
4269
4343
|
}
|
|
4270
|
-
return /* @__PURE__ */
|
|
4271
|
-
/* @__PURE__ */
|
|
4272
|
-
/* @__PURE__ */
|
|
4273
|
-
/* @__PURE__ */
|
|
4274
|
-
/* @__PURE__ */
|
|
4275
|
-
/* @__PURE__ */
|
|
4344
|
+
return /* @__PURE__ */ jsxs11(ButtonGroup2, { children: [
|
|
4345
|
+
/* @__PURE__ */ jsx11(ButtonGroupText2, { children: label }),
|
|
4346
|
+
/* @__PURE__ */ jsxs11(Popover2, { defaultOpen: autoOpen, children: [
|
|
4347
|
+
/* @__PURE__ */ jsx11(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsx11(Button7, { variant: "outline", className: "gap-1 font-normal", children: /* @__PURE__ */ jsx11("span", { className: startDate ? "" : "text-muted-foreground", children: displayLabel }) }) }),
|
|
4348
|
+
/* @__PURE__ */ jsx11(PopoverContent2, { align: "start", className: "w-fit", children: /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-2", children: [
|
|
4349
|
+
/* @__PURE__ */ jsx11(
|
|
4276
4350
|
Calendar2,
|
|
4277
4351
|
{
|
|
4278
4352
|
mode: "range",
|
|
@@ -4280,9 +4354,9 @@ function DateFilterChip({
|
|
|
4280
4354
|
onSelect: pickRange
|
|
4281
4355
|
}
|
|
4282
4356
|
),
|
|
4283
|
-
showTimeInputs && /* @__PURE__ */
|
|
4284
|
-
/* @__PURE__ */
|
|
4285
|
-
/* @__PURE__ */
|
|
4357
|
+
showTimeInputs && /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-2", children: [
|
|
4358
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex w-full items-center gap-2", children: [
|
|
4359
|
+
/* @__PURE__ */ jsx11(
|
|
4286
4360
|
Label3,
|
|
4287
4361
|
{
|
|
4288
4362
|
htmlFor: `${definition.key}-start-time`,
|
|
@@ -4290,7 +4364,7 @@ function DateFilterChip({
|
|
|
4290
4364
|
children: "Start"
|
|
4291
4365
|
}
|
|
4292
4366
|
),
|
|
4293
|
-
/* @__PURE__ */
|
|
4367
|
+
/* @__PURE__ */ jsx11(
|
|
4294
4368
|
Input2,
|
|
4295
4369
|
{
|
|
4296
4370
|
id: `${definition.key}-start-time`,
|
|
@@ -4302,8 +4376,8 @@ function DateFilterChip({
|
|
|
4302
4376
|
}
|
|
4303
4377
|
)
|
|
4304
4378
|
] }),
|
|
4305
|
-
/* @__PURE__ */
|
|
4306
|
-
/* @__PURE__ */
|
|
4379
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex w-full items-center gap-2", children: [
|
|
4380
|
+
/* @__PURE__ */ jsx11(
|
|
4307
4381
|
Label3,
|
|
4308
4382
|
{
|
|
4309
4383
|
htmlFor: `${definition.key}-end-time`,
|
|
@@ -4311,7 +4385,7 @@ function DateFilterChip({
|
|
|
4311
4385
|
children: "End"
|
|
4312
4386
|
}
|
|
4313
4387
|
),
|
|
4314
|
-
/* @__PURE__ */
|
|
4388
|
+
/* @__PURE__ */ jsx11(
|
|
4315
4389
|
Input2,
|
|
4316
4390
|
{
|
|
4317
4391
|
id: `${definition.key}-end-time`,
|
|
@@ -4326,18 +4400,12 @@ function DateFilterChip({
|
|
|
4326
4400
|
] })
|
|
4327
4401
|
] }) })
|
|
4328
4402
|
] }),
|
|
4329
|
-
/* @__PURE__ */
|
|
4403
|
+
/* @__PURE__ */ jsx11(FilterChipRemoveButton, { label, onRemove })
|
|
4330
4404
|
] });
|
|
4331
4405
|
}
|
|
4332
4406
|
|
|
4333
|
-
// src/lib/data-table/filter-types.ts
|
|
4334
|
-
var isDateRangeColumnFilter = (definition) => definition.type === "dateRange";
|
|
4335
|
-
var isRadioColumnFilter = (definition) => definition.type === "radio";
|
|
4336
|
-
var isCheckboxColumnFilter = (definition) => definition.type === "checkbox";
|
|
4337
|
-
var isMultiTextColumnFilter = (definition) => definition.type === "multiText";
|
|
4338
|
-
|
|
4339
4407
|
// src/data-table/view-filter.tsx
|
|
4340
|
-
import { jsx as
|
|
4408
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
4341
4409
|
function toFilterOption(opt) {
|
|
4342
4410
|
return typeof opt === "string" ? { value: opt, label: opt } : { value: opt.value, label: opt.label };
|
|
4343
4411
|
}
|
|
@@ -4380,15 +4448,15 @@ function ViewFilter({
|
|
|
4380
4448
|
onColumnFiltersChange,
|
|
4381
4449
|
className
|
|
4382
4450
|
}) {
|
|
4383
|
-
const filterableColumns =
|
|
4384
|
-
() => columns.filter((column) =>
|
|
4451
|
+
const filterableColumns = React9.useMemo(
|
|
4452
|
+
() => columns.filter((column) => column.getCanFilter()).flatMap((column) => {
|
|
4385
4453
|
var _a;
|
|
4386
4454
|
const filter = (_a = column.columnDef.meta) == null ? void 0 : _a.filter;
|
|
4387
4455
|
return filter ? [{ key: column.id, filter }] : [];
|
|
4388
4456
|
}),
|
|
4389
4457
|
[columns]
|
|
4390
4458
|
);
|
|
4391
|
-
const filterDefinitions =
|
|
4459
|
+
const filterDefinitions = React9.useMemo(
|
|
4392
4460
|
() => filterableColumns.map(({ key, filter }) => toFilterBarDefinition(key, filter)).sort((a, b) => {
|
|
4393
4461
|
if (a.order == null && b.order == null) return 0;
|
|
4394
4462
|
if (a.order == null) return 1;
|
|
@@ -4397,15 +4465,15 @@ function ViewFilter({
|
|
|
4397
4465
|
}),
|
|
4398
4466
|
[filterableColumns]
|
|
4399
4467
|
);
|
|
4400
|
-
const emptyValueByKey =
|
|
4468
|
+
const emptyValueByKey = React9.useMemo(
|
|
4401
4469
|
() => new Map(filterableColumns.map(({ key, filter }) => [key, emptyValueFor(filter)])),
|
|
4402
4470
|
[filterableColumns]
|
|
4403
4471
|
);
|
|
4404
|
-
const activeFilters =
|
|
4472
|
+
const activeFilters = React9.useMemo(
|
|
4405
4473
|
() => columnFilters.map((filter) => ({ key: filter.id, value: filter.value })),
|
|
4406
4474
|
[columnFilters]
|
|
4407
4475
|
);
|
|
4408
|
-
return /* @__PURE__ */
|
|
4476
|
+
return /* @__PURE__ */ jsx12(
|
|
4409
4477
|
FilterBar,
|
|
4410
4478
|
{
|
|
4411
4479
|
className,
|
|
@@ -4419,10 +4487,10 @@ function ViewFilter({
|
|
|
4419
4487
|
}
|
|
4420
4488
|
|
|
4421
4489
|
// src/section-header.tsx
|
|
4422
|
-
import { jsx as
|
|
4490
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
4423
4491
|
function SectionHeader(_a) {
|
|
4424
4492
|
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
4425
|
-
return /* @__PURE__ */
|
|
4493
|
+
return /* @__PURE__ */ jsx13(
|
|
4426
4494
|
"div",
|
|
4427
4495
|
__spreadProps(__spreadValues({
|
|
4428
4496
|
"data-slot": "section-header",
|
|
@@ -4434,19 +4502,19 @@ function SectionHeader(_a) {
|
|
|
4434
4502
|
}
|
|
4435
4503
|
function SectionHeaderContent(_a) {
|
|
4436
4504
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
4437
|
-
return /* @__PURE__ */
|
|
4505
|
+
return /* @__PURE__ */ jsx13("div", __spreadValues({ "data-slot": "section-header-content", className: cn("flex flex-col gap-1", className) }, props));
|
|
4438
4506
|
}
|
|
4439
4507
|
function SectionHeaderTitle(_a) {
|
|
4440
4508
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
4441
|
-
return /* @__PURE__ */
|
|
4509
|
+
return /* @__PURE__ */ jsx13("h2", __spreadValues({ "data-slot": "section-header-title", className: cn("text-h3 text-foreground", className) }, props));
|
|
4442
4510
|
}
|
|
4443
4511
|
function SectionHeaderDescription(_a) {
|
|
4444
4512
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
4445
|
-
return /* @__PURE__ */
|
|
4513
|
+
return /* @__PURE__ */ jsx13("p", __spreadValues({ "data-slot": "section-header-description", className: cn("text-body text-muted-foreground", className) }, props));
|
|
4446
4514
|
}
|
|
4447
4515
|
|
|
4448
4516
|
// src/data-table/data-table.tsx
|
|
4449
|
-
import { Fragment as Fragment7, jsx as
|
|
4517
|
+
import { Fragment as Fragment7, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4450
4518
|
var DEFAULT_PAGE_SIZE = 20;
|
|
4451
4519
|
var noop = () => {
|
|
4452
4520
|
};
|
|
@@ -4504,23 +4572,21 @@ function DataTable({
|
|
|
4504
4572
|
celFilterConfig,
|
|
4505
4573
|
filterVisibility
|
|
4506
4574
|
}) {
|
|
4507
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
4575
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
4508
4576
|
const isGrid = layout === "grid";
|
|
4509
|
-
const
|
|
4510
|
-
const
|
|
4511
|
-
const
|
|
4512
|
-
const [
|
|
4513
|
-
const [
|
|
4514
|
-
const [
|
|
4515
|
-
const [
|
|
4516
|
-
const [innerColumnPinning, setInnerColumnPinning] = React9.useState({ start: [], end: [] });
|
|
4517
|
-
const [innerPagination, setInnerPagination] = React9.useState({
|
|
4577
|
+
const tableBodyScrollRef = React10.useRef(null);
|
|
4578
|
+
const [innerGlobalFilter, setInnerGlobalFilter] = React10.useState("");
|
|
4579
|
+
const [innerColumnOrdering, setInnerColumnOrdering] = React10.useState([]);
|
|
4580
|
+
const [innerColumnFilters, setInnerColumnFilters] = React10.useState([]);
|
|
4581
|
+
const [innerSorting, setInnerSorting] = React10.useState(((_a = config.state) == null ? void 0 : _a.sorting) || []);
|
|
4582
|
+
const [innerColumnPinning, setInnerColumnPinning] = React10.useState({ start: [], end: [] });
|
|
4583
|
+
const [innerPagination, setInnerPagination] = React10.useState({
|
|
4518
4584
|
pageIndex: ((_c = (_b = config.state) == null ? void 0 : _b.pagination) == null ? void 0 : _c.pageIndex) || 0,
|
|
4519
4585
|
pageSize: ((_e = (_d = config.state) == null ? void 0 : _d.pagination) == null ? void 0 : _e.pageSize) || DEFAULT_PAGE_SIZE
|
|
4520
4586
|
});
|
|
4521
|
-
const [innerGrouping, setInnerGrouping] =
|
|
4522
|
-
const [innerColumnVisibility, setInnerColumnVisibility] =
|
|
4523
|
-
const [innerExpanded, setInnerExpanded] =
|
|
4587
|
+
const [innerGrouping, setInnerGrouping] = React10.useState([]);
|
|
4588
|
+
const [innerColumnVisibility, setInnerColumnVisibility] = React10.useState({});
|
|
4589
|
+
const [innerExpanded, setInnerExpanded] = React10.useState({});
|
|
4524
4590
|
const {
|
|
4525
4591
|
columnSizing,
|
|
4526
4592
|
handleColumnSizingChange,
|
|
@@ -4537,6 +4603,9 @@ function DataTable({
|
|
|
4537
4603
|
filterRowVisible,
|
|
4538
4604
|
setFilterRowVisible
|
|
4539
4605
|
} = useFilterVisibility(filterVisibility);
|
|
4606
|
+
if (parentGlobalFilter !== void 0 && parentGlobalFilter !== innerGlobalFilter) {
|
|
4607
|
+
setInnerGlobalFilter(parentGlobalFilter);
|
|
4608
|
+
}
|
|
4540
4609
|
const globalFilter = parentGlobalFilter != null ? parentGlobalFilter : innerGlobalFilter;
|
|
4541
4610
|
const applyGlobalFilter = parentSetGlobalFilter != null ? parentSetGlobalFilter : setInnerGlobalFilter;
|
|
4542
4611
|
const columnFilters = parentColumnFilters || innerColumnFilters;
|
|
@@ -4544,25 +4613,25 @@ function DataTable({
|
|
|
4544
4613
|
const pagination = parentPagination || innerPagination;
|
|
4545
4614
|
const setPagination = parentSetPagination != null ? parentSetPagination : setInnerPagination;
|
|
4546
4615
|
const shouldDisablePagination = paginationConfig === false;
|
|
4547
|
-
const resetPageIndexOnFilterChange =
|
|
4616
|
+
const resetPageIndexOnFilterChange = React10.useCallback(() => {
|
|
4548
4617
|
if (!serverSidePagination || pagination.pageIndex === 0) return;
|
|
4549
4618
|
setPagination((prev) => __spreadProps(__spreadValues({}, prev), { pageIndex: 0 }));
|
|
4550
4619
|
}, [serverSidePagination, pagination.pageIndex, setPagination]);
|
|
4551
|
-
const setGlobalFilter =
|
|
4620
|
+
const setGlobalFilter = React10.useCallback(
|
|
4552
4621
|
(value) => {
|
|
4553
4622
|
applyGlobalFilter(value);
|
|
4554
4623
|
resetPageIndexOnFilterChange();
|
|
4555
4624
|
},
|
|
4556
4625
|
[applyGlobalFilter, resetPageIndexOnFilterChange]
|
|
4557
4626
|
);
|
|
4558
|
-
const setColumnFilters =
|
|
4627
|
+
const setColumnFilters = React10.useCallback(
|
|
4559
4628
|
(value) => {
|
|
4560
4629
|
applyColumnFilters(value);
|
|
4561
4630
|
resetPageIndexOnFilterChange();
|
|
4562
4631
|
},
|
|
4563
4632
|
[applyColumnFilters, resetPageIndexOnFilterChange]
|
|
4564
4633
|
);
|
|
4565
|
-
|
|
4634
|
+
React10.useLayoutEffect(() => {
|
|
4566
4635
|
var _a2;
|
|
4567
4636
|
if (shouldDisablePagination) return;
|
|
4568
4637
|
(_a2 = tableBodyScrollRef.current) == null ? void 0 : _a2.scrollTo({ top: 0 });
|
|
@@ -4586,7 +4655,9 @@ function DataTable({
|
|
|
4586
4655
|
const hasExternalSearch = parentGlobalFilter !== void 0;
|
|
4587
4656
|
const hasExternalFilters = parentColumnFilters !== void 0;
|
|
4588
4657
|
const shouldDisableFiltersModels = !!disableFilters && !!disableSearch && !hasExternalSearch && !hasExternalFilters;
|
|
4658
|
+
const columns = React10.useMemo(() => withDefaultFilterFns(config.columns), [config.columns]);
|
|
4589
4659
|
const table = useTable(__spreadProps(__spreadValues(__spreadProps(__spreadValues(__spreadValues(__spreadProps(__spreadValues({}, config), {
|
|
4660
|
+
columns,
|
|
4590
4661
|
features: dataTableFeatures,
|
|
4591
4662
|
// Row models are registered statically in `dataTableFeatures`, so a disabled stage is switched
|
|
4592
4663
|
// off with its `manual*` option (the stage then passes rows through untouched).
|
|
@@ -4644,7 +4715,7 @@ function DataTable({
|
|
|
4644
4715
|
const orderedVisibleColumns = table.getVisibleLeafColumns().filter((col) => !isFilterOnlyColumn(col));
|
|
4645
4716
|
const hasFilters = !!celFilterConfig || hasFilterableColumns(flatColumns);
|
|
4646
4717
|
const showFilterToggle = filterToggleRequested && !disableFilters && hasFilters;
|
|
4647
|
-
const [gridMeasuredMins, setGridMeasuredMins] =
|
|
4718
|
+
const [gridMeasuredMins, setGridMeasuredMins] = React10.useState({});
|
|
4648
4719
|
const { gridTemplateColumns, gridRootRef, handleAutosizeAll, handleAutosizeColumn, handleResetColumnSize } = useGridLayout({
|
|
4649
4720
|
layout,
|
|
4650
4721
|
table,
|
|
@@ -4658,7 +4729,7 @@ function DataTable({
|
|
|
4658
4729
|
rawHandleAutosizeColumn,
|
|
4659
4730
|
rawHandleResetColumnSize
|
|
4660
4731
|
});
|
|
4661
|
-
const handleContextCell =
|
|
4732
|
+
const handleContextCell = React10.useCallback(
|
|
4662
4733
|
(filter, cell) => {
|
|
4663
4734
|
var _a2, _b2;
|
|
4664
4735
|
if (celFilterConfig == null ? void 0 : celFilterConfig.onContextualFilter) {
|
|
@@ -4675,13 +4746,13 @@ function DataTable({
|
|
|
4675
4746
|
},
|
|
4676
4747
|
[celFilterConfig, onContextCell, setColumnFilters, table]
|
|
4677
4748
|
);
|
|
4678
|
-
const handleContextSearch =
|
|
4749
|
+
const handleContextSearch = React10.useCallback(
|
|
4679
4750
|
(searchTerm) => {
|
|
4680
4751
|
setGlobalFilter(searchTerm);
|
|
4681
4752
|
},
|
|
4682
4753
|
[setGlobalFilter]
|
|
4683
4754
|
);
|
|
4684
|
-
const totalTableWidth =
|
|
4755
|
+
const totalTableWidth = React10.useMemo(() => {
|
|
4685
4756
|
if (isGrid) return 0;
|
|
4686
4757
|
const firstGroup = headerGroups[0];
|
|
4687
4758
|
if (!firstGroup) return 0;
|
|
@@ -4705,12 +4776,7 @@ function DataTable({
|
|
|
4705
4776
|
}
|
|
4706
4777
|
setGlobalFilter("");
|
|
4707
4778
|
};
|
|
4708
|
-
|
|
4709
|
-
if (parentGlobalFilter !== void 0) {
|
|
4710
|
-
setInnerGlobalFilter(parentGlobalFilter);
|
|
4711
|
-
}
|
|
4712
|
-
}, [parentGlobalFilter]);
|
|
4713
|
-
React9.useEffect(() => {
|
|
4779
|
+
React10.useEffect(() => {
|
|
4714
4780
|
if (disableColumnReordering) return;
|
|
4715
4781
|
const allColumnIds = flatColumns.map((col) => col.id);
|
|
4716
4782
|
const normalizedColumnOrdering = normalizeColumnOrdering(columnOrdering, allColumnIds);
|
|
@@ -4719,38 +4785,18 @@ function DataTable({
|
|
|
4719
4785
|
}
|
|
4720
4786
|
}, [columnOrdering, disableColumnReordering, flatColumns, setColumnOrdering]);
|
|
4721
4787
|
const showViewHeader = !!title || !!Actions;
|
|
4722
|
-
const showClearSearchButton = globalFilter && !shouldDisable;
|
|
4723
4788
|
const showColumnOptions = !disableColumnReordering || !disableColumnVisibility;
|
|
4724
|
-
const toolbarSearch = !disableSearch && /* @__PURE__ */
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
value: globalFilter,
|
|
4736
|
-
onChange: (e) => setGlobalFilter(e.target.value)
|
|
4737
|
-
})
|
|
4738
|
-
),
|
|
4739
|
-
!!showClearSearchButton && /* @__PURE__ */ jsx13(InputGroupAddon2, { align: "inline-end", children: /* @__PURE__ */ jsx13(
|
|
4740
|
-
InputGroupButton,
|
|
4741
|
-
{
|
|
4742
|
-
size: "icon-xs",
|
|
4743
|
-
"aria-label": "Clear search",
|
|
4744
|
-
onClick: () => {
|
|
4745
|
-
var _a2;
|
|
4746
|
-
setGlobalFilter("");
|
|
4747
|
-
(_a2 = searchInputRef.current) == null ? void 0 : _a2.focus();
|
|
4748
|
-
},
|
|
4749
|
-
children: /* @__PURE__ */ jsx13(Icon9, { name: "xmark" })
|
|
4750
|
-
}
|
|
4751
|
-
) })
|
|
4752
|
-
] });
|
|
4753
|
-
const toolbarColumns = !!showColumnOptions && /* @__PURE__ */ jsx13(
|
|
4789
|
+
const toolbarSearch = !disableSearch && /* @__PURE__ */ jsx14(
|
|
4790
|
+
DataTableSearch,
|
|
4791
|
+
{
|
|
4792
|
+
value: globalFilter,
|
|
4793
|
+
onValueChange: setGlobalFilter,
|
|
4794
|
+
placeholder: search == null ? void 0 : search.placeholder,
|
|
4795
|
+
className: search == null ? void 0 : search.className,
|
|
4796
|
+
disabled: shouldDisable
|
|
4797
|
+
}
|
|
4798
|
+
);
|
|
4799
|
+
const toolbarColumns = !!showColumnOptions && /* @__PURE__ */ jsx14(
|
|
4754
4800
|
ColumnOptions,
|
|
4755
4801
|
{
|
|
4756
4802
|
columns: flatColumns,
|
|
@@ -4759,7 +4805,7 @@ function DataTable({
|
|
|
4759
4805
|
disableColumnOrdering: disableColumnReordering
|
|
4760
4806
|
}
|
|
4761
4807
|
);
|
|
4762
|
-
return /* @__PURE__ */
|
|
4808
|
+
return /* @__PURE__ */ jsxs12(
|
|
4763
4809
|
"div",
|
|
4764
4810
|
{
|
|
4765
4811
|
id: `table-${id}`,
|
|
@@ -4770,19 +4816,19 @@ function DataTable({
|
|
|
4770
4816
|
className
|
|
4771
4817
|
),
|
|
4772
4818
|
children: [
|
|
4773
|
-
showViewHeader && /* @__PURE__ */
|
|
4774
|
-
!!title && /* @__PURE__ */
|
|
4775
|
-
!!description && /* @__PURE__ */
|
|
4819
|
+
showViewHeader && /* @__PURE__ */ jsx14(SectionHeader, { className: "mb-4 flex w-full gap-2", children: /* @__PURE__ */ jsxs12(SectionHeaderContent, { children: [
|
|
4820
|
+
!!title && /* @__PURE__ */ jsx14(SectionHeaderTitle, { children: title }),
|
|
4821
|
+
!!description && /* @__PURE__ */ jsx14(SectionHeaderDescription, { children: description })
|
|
4776
4822
|
] }) }),
|
|
4777
|
-
/* @__PURE__ */
|
|
4823
|
+
/* @__PURE__ */ jsxs12("div", { className: "mb-4 flex flex-row gap-2", children: [
|
|
4778
4824
|
toolbarSearch,
|
|
4779
|
-
/* @__PURE__ */
|
|
4780
|
-
showFilterToggle && /* @__PURE__ */
|
|
4781
|
-
!!Actions && /* @__PURE__ */
|
|
4825
|
+
/* @__PURE__ */ jsxs12("div", { className: "ml-auto flex items-center gap-2", children: [
|
|
4826
|
+
showFilterToggle && /* @__PURE__ */ jsx14(FilterToggle, { pressed: filterRowVisible, onPressedChange: setFilterRowVisible, count: filterCount }),
|
|
4827
|
+
!!Actions && /* @__PURE__ */ jsx14(Actions, { state: tableState }),
|
|
4782
4828
|
toolbarColumns
|
|
4783
4829
|
] })
|
|
4784
4830
|
] }),
|
|
4785
|
-
!disableFilters && (!showFilterToggle || filterRowVisible) && /* @__PURE__ */
|
|
4831
|
+
!disableFilters && (!showFilterToggle || filterRowVisible) && /* @__PURE__ */ jsx14("div", { className: "flex w-full", children: celFilterConfig ? /* @__PURE__ */ jsx14("div", { className: cn("mr-2 mb-4 min-w-0 flex-1", celFilterClassName), children: /* @__PURE__ */ jsx14(
|
|
4786
4832
|
CelFilterBar,
|
|
4787
4833
|
{
|
|
4788
4834
|
schema: celFilterConfig.schema,
|
|
@@ -4792,7 +4838,7 @@ function DataTable({
|
|
|
4792
4838
|
onRestrictedOptionSelect: celFilterConfig.onRestrictedOptionSelect,
|
|
4793
4839
|
showClearButton: celFilterConfig.showClearButton
|
|
4794
4840
|
}
|
|
4795
|
-
) }) : /* @__PURE__ */
|
|
4841
|
+
) }) : /* @__PURE__ */ jsx14(
|
|
4796
4842
|
ViewFilter,
|
|
4797
4843
|
{
|
|
4798
4844
|
columns: flatColumns,
|
|
@@ -4801,8 +4847,8 @@ function DataTable({
|
|
|
4801
4847
|
className: "data-[visible-filters=true]:mb-4"
|
|
4802
4848
|
}
|
|
4803
4849
|
) }),
|
|
4804
|
-
shouldRenderTableContent ? /* @__PURE__ */
|
|
4805
|
-
/* @__PURE__ */
|
|
4850
|
+
shouldRenderTableContent ? /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
4851
|
+
/* @__PURE__ */ jsx14("div", { className: "flex min-h-0 flex-1 flex-col", "data-testid": "table-main", children: /* @__PURE__ */ jsx14(
|
|
4806
4852
|
"div",
|
|
4807
4853
|
{
|
|
4808
4854
|
ref: tableBodyScrollRef,
|
|
@@ -4811,7 +4857,7 @@ function DataTable({
|
|
|
4811
4857
|
"min-h-0 flex-1 overflow-auto rounded-lg border **:data-[slot=table-container]:overflow-visible",
|
|
4812
4858
|
!!stickyHeader && !fitContent && STICKY_HEADER_MAX_HEIGHT_CLASS
|
|
4813
4859
|
),
|
|
4814
|
-
children: /* @__PURE__ */
|
|
4860
|
+
children: /* @__PURE__ */ jsxs12(
|
|
4815
4861
|
DataTableRoot,
|
|
4816
4862
|
{
|
|
4817
4863
|
layout,
|
|
@@ -4819,7 +4865,7 @@ function DataTable({
|
|
|
4819
4865
|
gridRootRef,
|
|
4820
4866
|
style: isGrid ? { width: "100%" } : totalTableWidth > 0 ? { width: `max(100%, ${totalTableWidth}px)`, minWidth: "100%" } : { width: "100%" },
|
|
4821
4867
|
children: [
|
|
4822
|
-
/* @__PURE__ */
|
|
4868
|
+
/* @__PURE__ */ jsx14(
|
|
4823
4869
|
DataTableHeader,
|
|
4824
4870
|
{
|
|
4825
4871
|
headerGroups,
|
|
@@ -4830,7 +4876,7 @@ function DataTable({
|
|
|
4830
4876
|
layout
|
|
4831
4877
|
}
|
|
4832
4878
|
),
|
|
4833
|
-
/* @__PURE__ */
|
|
4879
|
+
/* @__PURE__ */ jsx14(
|
|
4834
4880
|
DataTableBody,
|
|
4835
4881
|
{
|
|
4836
4882
|
tableRows,
|
|
@@ -4852,11 +4898,11 @@ function DataTable({
|
|
|
4852
4898
|
)
|
|
4853
4899
|
}
|
|
4854
4900
|
) }),
|
|
4855
|
-
!shouldDisablePagination && !!pagination && /* @__PURE__ */
|
|
4901
|
+
!shouldDisablePagination && !!pagination && /* @__PURE__ */ jsx14(
|
|
4856
4902
|
DataTablePagination,
|
|
4857
4903
|
{
|
|
4858
4904
|
rowCount,
|
|
4859
|
-
rowCountRelation: (
|
|
4905
|
+
rowCountRelation: (_g = config.rowCountRelation) != null ? _g : "eq",
|
|
4860
4906
|
paginationConfig,
|
|
4861
4907
|
pageSize: pagination.pageSize,
|
|
4862
4908
|
pageIndex: pagination.pageIndex,
|
|
@@ -4864,7 +4910,7 @@ function DataTable({
|
|
|
4864
4910
|
onPageSizeChange: (nextPageSize) => setPagination((prev) => __spreadProps(__spreadValues({}, prev || pagination), { pageIndex: 0, pageSize: nextPageSize }))
|
|
4865
4911
|
}
|
|
4866
4912
|
)
|
|
4867
|
-
] }) : /* @__PURE__ */
|
|
4913
|
+
] }) : /* @__PURE__ */ jsx14(
|
|
4868
4914
|
DataTableEmptyView,
|
|
4869
4915
|
{
|
|
4870
4916
|
emptyView,
|