@upbound/monarch-blocks 0.13.2 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +168 -150
- 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.css +13 -0
- package/dist/graph.d.ts +15 -3
- package/dist/graph.js +130 -76
- package/dist/graph.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +354 -299
- 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 +3 -3
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" }) });
|
|
@@ -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,
|
|
@@ -3027,7 +3049,7 @@ var SEARCH_INPUT_PROPS = {
|
|
|
3027
3049
|
var SEARCH_INPUT_CLASS = "[&::-webkit-search-cancel-button]:appearance-none";
|
|
3028
3050
|
|
|
3029
3051
|
// src/data-table/data-table-search.tsx
|
|
3030
|
-
import { jsx as jsx6, jsxs as
|
|
3052
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3031
3053
|
function DataTableSearch({
|
|
3032
3054
|
value,
|
|
3033
3055
|
onValueChange,
|
|
@@ -3046,7 +3068,7 @@ function DataTableSearch({
|
|
|
3046
3068
|
setDraft(next);
|
|
3047
3069
|
startTransition(() => onValueChange(next));
|
|
3048
3070
|
};
|
|
3049
|
-
return /* @__PURE__ */
|
|
3071
|
+
return /* @__PURE__ */ jsxs6(InputGroup2, { className: cn("w-70", className), children: [
|
|
3050
3072
|
/* @__PURE__ */ jsx6(InputGroupAddon2, { align: "inline-start", children: /* @__PURE__ */ jsx6(Icon4, { name: "magnifying-glass" }) }),
|
|
3051
3073
|
/* @__PURE__ */ jsx6(
|
|
3052
3074
|
InputGroupInput2,
|
|
@@ -3083,7 +3105,7 @@ import { Button as Button4 } from "@upbound/monarch-core";
|
|
|
3083
3105
|
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@upbound/monarch-core";
|
|
3084
3106
|
import { Icon as Icon5 } from "@upbound/monarch-core";
|
|
3085
3107
|
import { IconTile } from "@upbound/monarch-core";
|
|
3086
|
-
import { jsx as jsx7, jsxs as
|
|
3108
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3087
3109
|
var defaultErrorConfig = {
|
|
3088
3110
|
icon: "circle-exclamation",
|
|
3089
3111
|
header: "Something went wrong",
|
|
@@ -3114,17 +3136,17 @@ function DataTableEmptyView({
|
|
|
3114
3136
|
const isFilteredEmpty = tableState === "empty" && filterCount > 0;
|
|
3115
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;
|
|
3116
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;
|
|
3117
|
-
const defaultAction = isFilteredEmpty && !(config == null ? void 0 : config.action) ? /* @__PURE__ */
|
|
3139
|
+
const defaultAction = isFilteredEmpty && !(config == null ? void 0 : config.action) ? /* @__PURE__ */ jsxs7(Button4, { variant: "outline", size: "sm", onClick: resetFilters, children: [
|
|
3118
3140
|
/* @__PURE__ */ jsx7(Icon5, { name: "xmark" }),
|
|
3119
3141
|
"Clear filters"
|
|
3120
3142
|
] }) : null;
|
|
3121
|
-
return /* @__PURE__ */ jsx7("div", { className: cn("flex size-full flex-col justify-center", wrapperClassName), children: config && /* @__PURE__ */
|
|
3122
|
-
/* @__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: [
|
|
3123
3145
|
config.icon && /* @__PURE__ */ jsx7(EmptyMedia, { children: /* @__PURE__ */ jsx7(IconTile, { variant: "branded", size: "md", children: /* @__PURE__ */ jsx7(Icon5, { name: config.icon }) }) }),
|
|
3124
3146
|
config.header && /* @__PURE__ */ jsx7(EmptyTitle, { children: config.header }),
|
|
3125
3147
|
config.subheader && /* @__PURE__ */ jsx7(EmptyDescription, { children: config.subheader })
|
|
3126
3148
|
] }),
|
|
3127
|
-
(config.details || config.action || defaultAction) && /* @__PURE__ */
|
|
3149
|
+
(config.details || config.action || defaultAction) && /* @__PURE__ */ jsxs7(EmptyContent, { children: [
|
|
3128
3150
|
config.details && /* @__PURE__ */ jsx7(Alert, { children: /* @__PURE__ */ jsx7(AlertDescription, { children: config.details }) }),
|
|
3129
3151
|
(_d = config.action) != null ? _d : defaultAction
|
|
3130
3152
|
] })
|
|
@@ -3133,9 +3155,9 @@ function DataTableEmptyView({
|
|
|
3133
3155
|
|
|
3134
3156
|
// src/data-table/filter-toggle.tsx
|
|
3135
3157
|
import { Badge as Badge2, Button as Button5, Icon as Icon6 } from "@upbound/monarch-core";
|
|
3136
|
-
import { jsx as jsx8, jsxs as
|
|
3158
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3137
3159
|
function FilterToggle({ pressed, onPressedChange, count }) {
|
|
3138
|
-
return /* @__PURE__ */
|
|
3160
|
+
return /* @__PURE__ */ jsxs8(Button5, { variant: "outline", onClick: () => onPressedChange(!pressed), className: "shrink-0", children: [
|
|
3139
3161
|
/* @__PURE__ */ jsx8(Icon6, { name: "filter", "data-icon": "inline-start" }),
|
|
3140
3162
|
pressed ? "Hide filters" : "Show filters",
|
|
3141
3163
|
!!count && /* @__PURE__ */ jsx8(Badge2, { variant: "secondary", className: "tabular-nums", children: count })
|
|
@@ -3154,8 +3176,8 @@ import {
|
|
|
3154
3176
|
PaginationLink
|
|
3155
3177
|
} from "@upbound/monarch-core";
|
|
3156
3178
|
import { Select as Select2, SelectContent as SelectContent2, SelectGroup as SelectGroup2, SelectItem as SelectItem2, SelectTrigger as SelectTrigger2, SelectValue as SelectValue2 } from "@upbound/monarch-core";
|
|
3157
|
-
import { Tooltip as
|
|
3158
|
-
import { jsx as jsx9, jsxs 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";
|
|
3159
3181
|
var DEFAULT_PAGINATION_CONFIG = {
|
|
3160
3182
|
summary: true,
|
|
3161
3183
|
arrows: true,
|
|
@@ -3194,8 +3216,8 @@ function DataTablePagination({
|
|
|
3194
3216
|
const currentPage = pageIndex + 1;
|
|
3195
3217
|
const mounted = useMounted();
|
|
3196
3218
|
const locale = mounted ? void 0 : "en-US";
|
|
3197
|
-
return /* @__PURE__ */
|
|
3198
|
-
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: [
|
|
3199
3221
|
"Showing ",
|
|
3200
3222
|
/* @__PURE__ */ jsx9("span", { className: "text-foreground font-medium", children: itemStart.toLocaleString(locale) }),
|
|
3201
3223
|
" to",
|
|
@@ -3203,26 +3225,26 @@ function DataTablePagination({
|
|
|
3203
3225
|
/* @__PURE__ */ jsx9("span", { className: "text-foreground font-medium", children: itemEnd.toLocaleString(locale) }),
|
|
3204
3226
|
" of",
|
|
3205
3227
|
" ",
|
|
3206
|
-
/* @__PURE__ */
|
|
3228
|
+
/* @__PURE__ */ jsxs9("span", { className: "text-foreground font-medium", children: [
|
|
3207
3229
|
rowCount.toLocaleString(locale),
|
|
3208
3230
|
!isRowCountExact && "+"
|
|
3209
3231
|
] }),
|
|
3210
3232
|
" ",
|
|
3211
3233
|
"results",
|
|
3212
|
-
!isRowCountExact && /* @__PURE__ */
|
|
3213
|
-
/* @__PURE__ */ jsx9(
|
|
3214
|
-
/* @__PURE__ */ jsx9(
|
|
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." })
|
|
3215
3237
|
] })
|
|
3216
3238
|
] }) : /* @__PURE__ */ jsx9("div", {}),
|
|
3217
|
-
/* @__PURE__ */
|
|
3218
|
-
resolved.pageSizeSelector && /* @__PURE__ */
|
|
3239
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-4", children: [
|
|
3240
|
+
resolved.pageSizeSelector && /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", children: [
|
|
3219
3241
|
/* @__PURE__ */ jsx9(Label2, { htmlFor: PAGE_SIZE_SELECT_ID, className: "font-semibold", children: "Rows per page" }),
|
|
3220
|
-
/* @__PURE__ */
|
|
3242
|
+
/* @__PURE__ */ jsxs9(Select2, { value: String(effectivePageSize), onValueChange: (value) => onPageSizeChange(Number(value)), children: [
|
|
3221
3243
|
/* @__PURE__ */ jsx9(SelectTrigger2, { id: PAGE_SIZE_SELECT_ID, size: "sm", className: "w-18", "data-testid": "table-page-size-select", children: /* @__PURE__ */ jsx9(SelectValue2, {}) }),
|
|
3222
3244
|
/* @__PURE__ */ jsx9(SelectContent2, { align: "end", children: /* @__PURE__ */ jsx9(SelectGroup2, { children: normalizedPageSizeOptions.map((option) => /* @__PURE__ */ jsx9(SelectItem2, { value: String(option), children: option }, option)) }) })
|
|
3223
3245
|
] })
|
|
3224
3246
|
] }),
|
|
3225
|
-
pageCount > 1 && (resolved.arrows || resolved.numbers) && /* @__PURE__ */ jsx9(Pagination, { className: "mx-0 w-auto justify-end", children: /* @__PURE__ */
|
|
3247
|
+
pageCount > 1 && (resolved.arrows || resolved.numbers) && /* @__PURE__ */ jsx9(Pagination, { className: "mx-0 w-auto justify-end", children: /* @__PURE__ */ jsxs9(PaginationContent, { children: [
|
|
3226
3248
|
resolved.arrows && /* @__PURE__ */ jsx9(PaginationItem, { children: /* @__PURE__ */ jsx9(
|
|
3227
3249
|
Button6,
|
|
3228
3250
|
{
|
|
@@ -3308,8 +3330,8 @@ import {
|
|
|
3308
3330
|
TableHeader as BaseTableHeader,
|
|
3309
3331
|
TableRow as BaseTableRow
|
|
3310
3332
|
} from "@upbound/monarch-core";
|
|
3311
|
-
import { Tooltip as
|
|
3312
|
-
import { Fragment as Fragment5, jsx as jsx10, jsxs 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";
|
|
3313
3335
|
var HEADER_SURFACE_BG = "bg-[color-mix(in_oklch,var(--muted)_50%,var(--card))]";
|
|
3314
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";
|
|
3315
3337
|
var TABLE_CELL_CLASSES = "px-4 py-2 align-middle whitespace-nowrap has-[[role=checkbox]]:pr-0";
|
|
@@ -3377,9 +3399,9 @@ function ColumnActionsMenuItems({
|
|
|
3377
3399
|
const canResize = header.column.getCanResize();
|
|
3378
3400
|
const canHide = header.column.getCanHide();
|
|
3379
3401
|
const canPin = !isGrid && header.column.getCanPin();
|
|
3380
|
-
return /* @__PURE__ */
|
|
3381
|
-
canSort && /* @__PURE__ */
|
|
3382
|
-
/* @__PURE__ */
|
|
3402
|
+
return /* @__PURE__ */ jsxs10(DropdownMenuContent3, { align: "start", className: "w-45", children: [
|
|
3403
|
+
canSort && /* @__PURE__ */ jsxs10(Fragment5, { children: [
|
|
3404
|
+
/* @__PURE__ */ jsxs10(
|
|
3383
3405
|
DropdownMenuItem3,
|
|
3384
3406
|
{
|
|
3385
3407
|
disabled: header.column.getIsSorted() === "asc",
|
|
@@ -3390,7 +3412,7 @@ function ColumnActionsMenuItems({
|
|
|
3390
3412
|
]
|
|
3391
3413
|
}
|
|
3392
3414
|
),
|
|
3393
|
-
/* @__PURE__ */
|
|
3415
|
+
/* @__PURE__ */ jsxs10(
|
|
3394
3416
|
DropdownMenuItem3,
|
|
3395
3417
|
{
|
|
3396
3418
|
disabled: header.column.getIsSorted() === "desc",
|
|
@@ -3401,32 +3423,32 @@ function ColumnActionsMenuItems({
|
|
|
3401
3423
|
]
|
|
3402
3424
|
}
|
|
3403
3425
|
),
|
|
3404
|
-
!!header.column.getIsSorted() && /* @__PURE__ */
|
|
3426
|
+
!!header.column.getIsSorted() && /* @__PURE__ */ jsxs10(DropdownMenuItem3, { onClick: () => header.column.clearSorting(), children: [
|
|
3405
3427
|
/* @__PURE__ */ jsx10(Icon8, { name: "xmark" }),
|
|
3406
3428
|
"Remove sorting"
|
|
3407
3429
|
] })
|
|
3408
3430
|
] }),
|
|
3409
|
-
canResize && /* @__PURE__ */
|
|
3431
|
+
canResize && /* @__PURE__ */ jsxs10(Fragment5, { children: [
|
|
3410
3432
|
canSort && /* @__PURE__ */ jsx10(DropdownMenuSeparator, {}),
|
|
3411
|
-
!isGrid && /* @__PURE__ */
|
|
3433
|
+
!isGrid && /* @__PURE__ */ jsxs10(DropdownMenuItem3, { onClick: () => onAutosizeColumn(header.column.id), children: [
|
|
3412
3434
|
/* @__PURE__ */ jsx10(Icon8, { name: "arrows-left-right" }),
|
|
3413
3435
|
"Autosize column"
|
|
3414
3436
|
] }),
|
|
3415
|
-
/* @__PURE__ */
|
|
3437
|
+
/* @__PURE__ */ jsxs10(DropdownMenuItem3, { onClick: () => onAutosizeAll(), children: [
|
|
3416
3438
|
/* @__PURE__ */ jsx10(Icon8, { name: "table-columns" }),
|
|
3417
3439
|
isGrid ? "Reset all columns" : "Autosize all columns"
|
|
3418
3440
|
] })
|
|
3419
3441
|
] }),
|
|
3420
|
-
(canHide || canPin) && /* @__PURE__ */
|
|
3442
|
+
(canHide || canPin) && /* @__PURE__ */ jsxs10(Fragment5, { children: [
|
|
3421
3443
|
(canSort || canResize) && /* @__PURE__ */ jsx10(DropdownMenuSeparator, {}),
|
|
3422
|
-
canHide && /* @__PURE__ */
|
|
3444
|
+
canHide && /* @__PURE__ */ jsxs10(DropdownMenuItem3, { onClick: () => header.column.toggleVisibility(), children: [
|
|
3423
3445
|
/* @__PURE__ */ jsx10(Icon8, { name: "eye-slash" }),
|
|
3424
3446
|
"Hide column"
|
|
3425
3447
|
] }),
|
|
3426
|
-
canPin && (header.column.getIsPinned() ? /* @__PURE__ */
|
|
3448
|
+
canPin && (header.column.getIsPinned() ? /* @__PURE__ */ jsxs10(DropdownMenuItem3, { onClick: () => header.column.pin(false), children: [
|
|
3427
3449
|
/* @__PURE__ */ jsx10(Icon8, { name: "thumbtack" }),
|
|
3428
3450
|
"Unpin column"
|
|
3429
|
-
] }) : /* @__PURE__ */
|
|
3451
|
+
] }) : /* @__PURE__ */ jsxs10(DropdownMenuItem3, { onClick: () => header.column.pin("start"), children: [
|
|
3430
3452
|
/* @__PURE__ */ jsx10(Icon8, { name: "thumbtack" }),
|
|
3431
3453
|
"Pin column"
|
|
3432
3454
|
] }))
|
|
@@ -3447,7 +3469,7 @@ function HeaderCellContent({
|
|
|
3447
3469
|
const resizeHandler = header.getResizeHandler();
|
|
3448
3470
|
const headerTitle = typeof header.column.columnDef.header === "string" ? header.column.columnDef.header : "";
|
|
3449
3471
|
const sorted = header.column.getIsSorted();
|
|
3450
|
-
const labelButton = /* @__PURE__ */
|
|
3472
|
+
const labelButton = /* @__PURE__ */ jsxs10(
|
|
3451
3473
|
"button",
|
|
3452
3474
|
{
|
|
3453
3475
|
type: "button",
|
|
@@ -3471,7 +3493,7 @@ function HeaderCellContent({
|
|
|
3471
3493
|
]
|
|
3472
3494
|
}
|
|
3473
3495
|
);
|
|
3474
|
-
const label = shouldShowActionsMenu ? /* @__PURE__ */
|
|
3496
|
+
const label = shouldShowActionsMenu ? /* @__PURE__ */ jsxs10(DropdownMenu3, { children: [
|
|
3475
3497
|
/* @__PURE__ */ jsx10(DropdownMenuTrigger3, { asChild: true, children: labelButton }),
|
|
3476
3498
|
/* @__PURE__ */ jsx10(
|
|
3477
3499
|
ColumnActionsMenuItems,
|
|
@@ -3483,10 +3505,10 @@ function HeaderCellContent({
|
|
|
3483
3505
|
}
|
|
3484
3506
|
)
|
|
3485
3507
|
] }) : labelButton;
|
|
3486
|
-
return /* @__PURE__ */
|
|
3487
|
-
/* @__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__ */
|
|
3488
|
-
/* @__PURE__ */ jsx10(
|
|
3489
|
-
/* @__PURE__ */ jsx10(
|
|
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 })
|
|
3490
3512
|
] }) : label) }) }),
|
|
3491
3513
|
canResize && /* @__PURE__ */ jsx10(
|
|
3492
3514
|
"button",
|
|
@@ -3663,7 +3685,7 @@ function DataTableCell({
|
|
|
3663
3685
|
}
|
|
3664
3686
|
);
|
|
3665
3687
|
if (!shouldShowContextualMenu || !onContextCell) return cellElement;
|
|
3666
|
-
return /* @__PURE__ */
|
|
3688
|
+
return /* @__PURE__ */ jsxs10(ContextMenu, { children: [
|
|
3667
3689
|
/* @__PURE__ */ jsx10(ContextMenuTrigger, { asChild: true, children: cellElement }),
|
|
3668
3690
|
/* @__PURE__ */ jsx10(
|
|
3669
3691
|
CellContextualFilter,
|
|
@@ -3784,7 +3806,7 @@ function DataTableBody({
|
|
|
3784
3806
|
}
|
|
3785
3807
|
const isExpanded = !!(((_d = row.getCanExpand) == null ? void 0 : _d.call(row)) && ((_e = row.getIsExpanded) == null ? void 0 : _e.call(row)));
|
|
3786
3808
|
const expandedRow = renderExpandedRow && isExpanded ? renderExpandedRow(row.original) : null;
|
|
3787
|
-
return /* @__PURE__ */
|
|
3809
|
+
return /* @__PURE__ */ jsxs10(React7.Fragment, { children: [
|
|
3788
3810
|
/* @__PURE__ */ jsx10(
|
|
3789
3811
|
DataTableRow,
|
|
3790
3812
|
__spreadProps(__spreadValues({}, onRowRender ? onRowRender(row.original, row) : {}), {
|
|
@@ -3849,7 +3871,7 @@ import {
|
|
|
3849
3871
|
import { Input as Input2 } from "@upbound/monarch-core";
|
|
3850
3872
|
import { Label as Label3 } from "@upbound/monarch-core";
|
|
3851
3873
|
import { Popover as Popover2, PopoverContent as PopoverContent2, PopoverTrigger as PopoverTrigger2 } from "@upbound/monarch-core";
|
|
3852
|
-
import { Fragment as Fragment6, jsx as jsx11, jsxs as
|
|
3874
|
+
import { Fragment as Fragment6, jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3853
3875
|
function asCheckboxValue(value) {
|
|
3854
3876
|
return Array.isArray(value) ? value : [];
|
|
3855
3877
|
}
|
|
@@ -3924,7 +3946,7 @@ function FilterBar(_a) {
|
|
|
3924
3946
|
setPendingOpenKey(key);
|
|
3925
3947
|
}
|
|
3926
3948
|
const containerRef = React8.useRef(null);
|
|
3927
|
-
return /* @__PURE__ */
|
|
3949
|
+
return /* @__PURE__ */ jsxs11(
|
|
3928
3950
|
"div",
|
|
3929
3951
|
__spreadProps(__spreadValues({
|
|
3930
3952
|
"data-slot": "filter-bar",
|
|
@@ -3933,7 +3955,7 @@ function FilterBar(_a) {
|
|
|
3933
3955
|
ref: composeRefs(containerRef, ref)
|
|
3934
3956
|
}, props), {
|
|
3935
3957
|
children: [
|
|
3936
|
-
availableFilters.length > 0 && /* @__PURE__ */
|
|
3958
|
+
availableFilters.length > 0 && /* @__PURE__ */ jsxs11(
|
|
3937
3959
|
Combobox2,
|
|
3938
3960
|
{
|
|
3939
3961
|
items: availableFilters,
|
|
@@ -3944,11 +3966,11 @@ function FilterBar(_a) {
|
|
|
3944
3966
|
if (filter) handleAddFilter(filter.key);
|
|
3945
3967
|
},
|
|
3946
3968
|
children: [
|
|
3947
|
-
/* @__PURE__ */
|
|
3969
|
+
/* @__PURE__ */ jsxs11(ComboboxTrigger2, { "aria-label": "Add filter", showIndicator: false, render: /* @__PURE__ */ jsx11(Button7, { variant: "outline" }), children: [
|
|
3948
3970
|
/* @__PURE__ */ jsx11(Icon9, { name: "plus", "data-icon": "inline-start" }),
|
|
3949
3971
|
"Add filter"
|
|
3950
3972
|
] }),
|
|
3951
|
-
/* @__PURE__ */
|
|
3973
|
+
/* @__PURE__ */ jsxs11(ComboboxContent2, { container: containerRef, align: "start", className: "w-48", children: [
|
|
3952
3974
|
/* @__PURE__ */ jsx11(ComboboxInput2, { showTrigger: false, placeholder: "Search filters\u2026" }),
|
|
3953
3975
|
/* @__PURE__ */ jsx11(ComboboxEmpty2, { children: "No filters found." }),
|
|
3954
3976
|
/* @__PURE__ */ jsx11(ComboboxList2, { children: (filter) => /* @__PURE__ */ jsx11(ComboboxItem2, { value: filter, children: filter.label }, filter.key) })
|
|
@@ -4060,9 +4082,9 @@ function CheckboxFilterChip({
|
|
|
4060
4082
|
const next = values.includes(optionValue) ? values.filter((v) => v !== optionValue) : [...values, optionValue];
|
|
4061
4083
|
onChangeValue(next);
|
|
4062
4084
|
}
|
|
4063
|
-
return /* @__PURE__ */
|
|
4085
|
+
return /* @__PURE__ */ jsxs11(ButtonGroup2, { children: [
|
|
4064
4086
|
/* @__PURE__ */ jsx11(ButtonGroupText2, { children: label }),
|
|
4065
|
-
searchable ? /* @__PURE__ */
|
|
4087
|
+
searchable ? /* @__PURE__ */ jsxs11(
|
|
4066
4088
|
Combobox2,
|
|
4067
4089
|
{
|
|
4068
4090
|
items: options,
|
|
@@ -4079,7 +4101,7 @@ function CheckboxFilterChip({
|
|
|
4079
4101
|
children: /* @__PURE__ */ jsx11("span", { className: values.length === 0 ? "text-muted-foreground" : "", children: displayLabel })
|
|
4080
4102
|
}
|
|
4081
4103
|
),
|
|
4082
|
-
/* @__PURE__ */
|
|
4104
|
+
/* @__PURE__ */ jsxs11(
|
|
4083
4105
|
ComboboxContent2,
|
|
4084
4106
|
{
|
|
4085
4107
|
container,
|
|
@@ -4087,19 +4109,19 @@ function CheckboxFilterChip({
|
|
|
4087
4109
|
collisionAvoidance: { side: "none", align: "shift" },
|
|
4088
4110
|
children: [
|
|
4089
4111
|
/* @__PURE__ */ jsx11(ComboboxInput2, { showTrigger: false, placeholder: `Search ${label.toLowerCase()}\u2026` }),
|
|
4090
|
-
values.length > 0 && /* @__PURE__ */
|
|
4091
|
-
/* @__PURE__ */
|
|
4112
|
+
values.length > 0 && /* @__PURE__ */ jsxs11(Fragment6, { children: [
|
|
4113
|
+
/* @__PURE__ */ jsxs11(ComboboxSelectedChips2, { children: [
|
|
4092
4114
|
/* @__PURE__ */ jsx11(ComboboxValue2, { children: (selected) => /* @__PURE__ */ jsx11(Fragment6, { children: selected.map((item) => /* @__PURE__ */ jsx11(ComboboxChip2, { children: item.label }, item.value)) }) }),
|
|
4093
4115
|
/* @__PURE__ */ jsx11(ComboboxClearAll2, { onClick: () => onChangeValue([]) })
|
|
4094
4116
|
] }),
|
|
4095
4117
|
/* @__PURE__ */ jsx11(ComboboxSeparator2, {})
|
|
4096
4118
|
] }),
|
|
4097
|
-
/* @__PURE__ */
|
|
4119
|
+
/* @__PURE__ */ jsxs11(ComboboxEmpty2, { children: [
|
|
4098
4120
|
"No ",
|
|
4099
4121
|
label.toLowerCase(),
|
|
4100
4122
|
" found."
|
|
4101
4123
|
] }),
|
|
4102
|
-
/* @__PURE__ */ jsx11(ComboboxList2, { children: (item) => /* @__PURE__ */
|
|
4124
|
+
/* @__PURE__ */ jsx11(ComboboxList2, { children: (item) => /* @__PURE__ */ jsxs11(ComboboxItem2, { value: item, children: [
|
|
4103
4125
|
item.icon,
|
|
4104
4126
|
item.label
|
|
4105
4127
|
] }, item.value) })
|
|
@@ -4108,12 +4130,12 @@ function CheckboxFilterChip({
|
|
|
4108
4130
|
)
|
|
4109
4131
|
]
|
|
4110
4132
|
}
|
|
4111
|
-
) : /* @__PURE__ */
|
|
4112
|
-
/* @__PURE__ */ jsx11(DropdownMenuTrigger4, { asChild: true, children: /* @__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: [
|
|
4113
4135
|
/* @__PURE__ */ jsx11("span", { className: values.length === 0 ? "text-muted-foreground" : "", children: displayLabel }),
|
|
4114
4136
|
/* @__PURE__ */ jsx11(Icon9, { name: "chevron-down", size: "sm", className: "text-muted-foreground" })
|
|
4115
4137
|
] }) }),
|
|
4116
|
-
/* @__PURE__ */ jsx11(DropdownMenuContent4, { align: "start", className: "w-48", children: options.map((opt) => /* @__PURE__ */
|
|
4138
|
+
/* @__PURE__ */ jsx11(DropdownMenuContent4, { align: "start", className: "w-48", children: options.map((opt) => /* @__PURE__ */ jsxs11(
|
|
4117
4139
|
DropdownMenuCheckboxItem2,
|
|
4118
4140
|
{
|
|
4119
4141
|
checked: values.includes(opt.value),
|
|
@@ -4143,9 +4165,9 @@ function RadioFilterChip({
|
|
|
4143
4165
|
const selectedValue = asRadioValue(value);
|
|
4144
4166
|
const displayLabel = selectedValue ? (_b = (_a = options.find((o) => o.value === selectedValue)) == null ? void 0 : _a.label) != null ? _b : selectedValue : "Any";
|
|
4145
4167
|
const selected = (_c = options.find((o) => o.value === selectedValue)) != null ? _c : null;
|
|
4146
|
-
return /* @__PURE__ */
|
|
4168
|
+
return /* @__PURE__ */ jsxs11(ButtonGroup2, { children: [
|
|
4147
4169
|
/* @__PURE__ */ jsx11(ButtonGroupText2, { children: label }),
|
|
4148
|
-
searchable ? /* @__PURE__ */
|
|
4170
|
+
searchable ? /* @__PURE__ */ jsxs11(
|
|
4149
4171
|
Combobox2,
|
|
4150
4172
|
{
|
|
4151
4173
|
items: options,
|
|
@@ -4164,7 +4186,7 @@ function RadioFilterChip({
|
|
|
4164
4186
|
children: /* @__PURE__ */ jsx11("span", { className: selectedValue ? "" : "text-muted-foreground", children: displayLabel })
|
|
4165
4187
|
}
|
|
4166
4188
|
),
|
|
4167
|
-
/* @__PURE__ */
|
|
4189
|
+
/* @__PURE__ */ jsxs11(
|
|
4168
4190
|
ComboboxContent2,
|
|
4169
4191
|
{
|
|
4170
4192
|
container,
|
|
@@ -4172,12 +4194,12 @@ function RadioFilterChip({
|
|
|
4172
4194
|
collisionAvoidance: { side: "none", align: "shift" },
|
|
4173
4195
|
children: [
|
|
4174
4196
|
/* @__PURE__ */ jsx11(ComboboxInput2, { showTrigger: false, placeholder: `Search ${label.toLowerCase()}\u2026` }),
|
|
4175
|
-
/* @__PURE__ */
|
|
4197
|
+
/* @__PURE__ */ jsxs11(ComboboxEmpty2, { children: [
|
|
4176
4198
|
"No ",
|
|
4177
4199
|
label.toLowerCase(),
|
|
4178
4200
|
" found."
|
|
4179
4201
|
] }),
|
|
4180
|
-
/* @__PURE__ */ jsx11(ComboboxList2, { children: (item) => /* @__PURE__ */
|
|
4202
|
+
/* @__PURE__ */ jsx11(ComboboxList2, { children: (item) => /* @__PURE__ */ jsxs11(ComboboxItem2, { value: item, children: [
|
|
4181
4203
|
item.icon,
|
|
4182
4204
|
item.label
|
|
4183
4205
|
] }, item.value) })
|
|
@@ -4186,12 +4208,12 @@ function RadioFilterChip({
|
|
|
4186
4208
|
)
|
|
4187
4209
|
]
|
|
4188
4210
|
}
|
|
4189
|
-
) : /* @__PURE__ */
|
|
4190
|
-
/* @__PURE__ */ jsx11(DropdownMenuTrigger4, { asChild: true, children: /* @__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: [
|
|
4191
4213
|
/* @__PURE__ */ jsx11("span", { className: selectedValue ? "" : "text-muted-foreground", children: displayLabel }),
|
|
4192
4214
|
/* @__PURE__ */ jsx11(Icon9, { name: "chevron-down", size: "sm", className: "text-muted-foreground" })
|
|
4193
4215
|
] }) }),
|
|
4194
|
-
/* @__PURE__ */ jsx11(DropdownMenuContent4, { align: "start", className: "w-48", children: /* @__PURE__ */ jsx11(DropdownMenuRadioGroup, { value: selectedValue, onValueChange: onChangeValue, children: options.map((opt) => /* @__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: [
|
|
4195
4217
|
opt.icon,
|
|
4196
4218
|
opt.label
|
|
4197
4219
|
] }, opt.value)) }) })
|
|
@@ -4209,9 +4231,9 @@ function TextFilterChip({
|
|
|
4209
4231
|
const { label, placeholder } = definition;
|
|
4210
4232
|
const text = asTextValue(value);
|
|
4211
4233
|
const [open, setOpen] = React8.useState(!!autoOpen);
|
|
4212
|
-
return /* @__PURE__ */
|
|
4234
|
+
return /* @__PURE__ */ jsxs11(ButtonGroup2, { children: [
|
|
4213
4235
|
/* @__PURE__ */ jsx11(ButtonGroupText2, { children: label }),
|
|
4214
|
-
/* @__PURE__ */
|
|
4236
|
+
/* @__PURE__ */ jsxs11(Popover2, { open, onOpenChange: setOpen, children: [
|
|
4215
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" }) }) }),
|
|
4216
4238
|
/* @__PURE__ */ jsx11(PopoverContent2, { align: "start", children: /* @__PURE__ */ jsx11(
|
|
4217
4239
|
Input2,
|
|
@@ -4252,12 +4274,12 @@ function MultiTextFilterChip({
|
|
|
4252
4274
|
function removeToken(token) {
|
|
4253
4275
|
onChangeValue(tokens.filter((t) => t !== token));
|
|
4254
4276
|
}
|
|
4255
|
-
return /* @__PURE__ */
|
|
4277
|
+
return /* @__PURE__ */ jsxs11(ButtonGroup2, { children: [
|
|
4256
4278
|
/* @__PURE__ */ jsx11(ButtonGroupText2, { children: label }),
|
|
4257
|
-
/* @__PURE__ */
|
|
4279
|
+
/* @__PURE__ */ jsxs11(Popover2, { defaultOpen: autoOpen, children: [
|
|
4258
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 }) }) }),
|
|
4259
|
-
/* @__PURE__ */ jsx11(PopoverContent2, { align: "start", children: /* @__PURE__ */
|
|
4260
|
-
tokens.length > 0 && /* @__PURE__ */ jsx11("div", { className: "flex flex-wrap gap-1", children: tokens.map((token) => /* @__PURE__ */
|
|
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: [
|
|
4261
4283
|
token,
|
|
4262
4284
|
/* @__PURE__ */ jsx11(
|
|
4263
4285
|
"button",
|
|
@@ -4319,11 +4341,11 @@ function DateFilterChip({
|
|
|
4319
4341
|
if (!endDate) return;
|
|
4320
4342
|
onChangeValue({ startDate, endDate: applyTimeToDate(endDate, time) });
|
|
4321
4343
|
}
|
|
4322
|
-
return /* @__PURE__ */
|
|
4344
|
+
return /* @__PURE__ */ jsxs11(ButtonGroup2, { children: [
|
|
4323
4345
|
/* @__PURE__ */ jsx11(ButtonGroupText2, { children: label }),
|
|
4324
|
-
/* @__PURE__ */
|
|
4346
|
+
/* @__PURE__ */ jsxs11(Popover2, { defaultOpen: autoOpen, children: [
|
|
4325
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 }) }) }),
|
|
4326
|
-
/* @__PURE__ */ jsx11(PopoverContent2, { align: "start", className: "w-fit", children: /* @__PURE__ */
|
|
4348
|
+
/* @__PURE__ */ jsx11(PopoverContent2, { align: "start", className: "w-fit", children: /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-2", children: [
|
|
4327
4349
|
/* @__PURE__ */ jsx11(
|
|
4328
4350
|
Calendar2,
|
|
4329
4351
|
{
|
|
@@ -4332,8 +4354,8 @@ function DateFilterChip({
|
|
|
4332
4354
|
onSelect: pickRange
|
|
4333
4355
|
}
|
|
4334
4356
|
),
|
|
4335
|
-
showTimeInputs && /* @__PURE__ */
|
|
4336
|
-
/* @__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: [
|
|
4337
4359
|
/* @__PURE__ */ jsx11(
|
|
4338
4360
|
Label3,
|
|
4339
4361
|
{
|
|
@@ -4354,7 +4376,7 @@ function DateFilterChip({
|
|
|
4354
4376
|
}
|
|
4355
4377
|
)
|
|
4356
4378
|
] }),
|
|
4357
|
-
/* @__PURE__ */
|
|
4379
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex w-full items-center gap-2", children: [
|
|
4358
4380
|
/* @__PURE__ */ jsx11(
|
|
4359
4381
|
Label3,
|
|
4360
4382
|
{
|
|
@@ -4382,12 +4404,6 @@ function DateFilterChip({
|
|
|
4382
4404
|
] });
|
|
4383
4405
|
}
|
|
4384
4406
|
|
|
4385
|
-
// src/lib/data-table/filter-types.ts
|
|
4386
|
-
var isDateRangeColumnFilter = (definition) => definition.type === "dateRange";
|
|
4387
|
-
var isRadioColumnFilter = (definition) => definition.type === "radio";
|
|
4388
|
-
var isCheckboxColumnFilter = (definition) => definition.type === "checkbox";
|
|
4389
|
-
var isMultiTextColumnFilter = (definition) => definition.type === "multiText";
|
|
4390
|
-
|
|
4391
4407
|
// src/data-table/view-filter.tsx
|
|
4392
4408
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
4393
4409
|
function toFilterOption(opt) {
|
|
@@ -4433,7 +4449,7 @@ function ViewFilter({
|
|
|
4433
4449
|
className
|
|
4434
4450
|
}) {
|
|
4435
4451
|
const filterableColumns = React9.useMemo(
|
|
4436
|
-
() => columns.filter((column) =>
|
|
4452
|
+
() => columns.filter((column) => column.getCanFilter()).flatMap((column) => {
|
|
4437
4453
|
var _a;
|
|
4438
4454
|
const filter = (_a = column.columnDef.meta) == null ? void 0 : _a.filter;
|
|
4439
4455
|
return filter ? [{ key: column.id, filter }] : [];
|
|
@@ -4498,7 +4514,7 @@ function SectionHeaderDescription(_a) {
|
|
|
4498
4514
|
}
|
|
4499
4515
|
|
|
4500
4516
|
// src/data-table/data-table.tsx
|
|
4501
|
-
import { Fragment as Fragment7, jsx as jsx14, jsxs as
|
|
4517
|
+
import { Fragment as Fragment7, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4502
4518
|
var DEFAULT_PAGE_SIZE = 20;
|
|
4503
4519
|
var noop = () => {
|
|
4504
4520
|
};
|
|
@@ -4639,7 +4655,9 @@ function DataTable({
|
|
|
4639
4655
|
const hasExternalSearch = parentGlobalFilter !== void 0;
|
|
4640
4656
|
const hasExternalFilters = parentColumnFilters !== void 0;
|
|
4641
4657
|
const shouldDisableFiltersModels = !!disableFilters && !!disableSearch && !hasExternalSearch && !hasExternalFilters;
|
|
4658
|
+
const columns = React10.useMemo(() => withDefaultFilterFns(config.columns), [config.columns]);
|
|
4642
4659
|
const table = useTable(__spreadProps(__spreadValues(__spreadProps(__spreadValues(__spreadValues(__spreadProps(__spreadValues({}, config), {
|
|
4660
|
+
columns,
|
|
4643
4661
|
features: dataTableFeatures,
|
|
4644
4662
|
// Row models are registered statically in `dataTableFeatures`, so a disabled stage is switched
|
|
4645
4663
|
// off with its `manual*` option (the stage then passes rows through untouched).
|
|
@@ -4787,7 +4805,7 @@ function DataTable({
|
|
|
4787
4805
|
disableColumnOrdering: disableColumnReordering
|
|
4788
4806
|
}
|
|
4789
4807
|
);
|
|
4790
|
-
return /* @__PURE__ */
|
|
4808
|
+
return /* @__PURE__ */ jsxs12(
|
|
4791
4809
|
"div",
|
|
4792
4810
|
{
|
|
4793
4811
|
id: `table-${id}`,
|
|
@@ -4798,13 +4816,13 @@ function DataTable({
|
|
|
4798
4816
|
className
|
|
4799
4817
|
),
|
|
4800
4818
|
children: [
|
|
4801
|
-
showViewHeader && /* @__PURE__ */ jsx14(SectionHeader, { className: "mb-4 flex w-full gap-2", children: /* @__PURE__ */
|
|
4819
|
+
showViewHeader && /* @__PURE__ */ jsx14(SectionHeader, { className: "mb-4 flex w-full gap-2", children: /* @__PURE__ */ jsxs12(SectionHeaderContent, { children: [
|
|
4802
4820
|
!!title && /* @__PURE__ */ jsx14(SectionHeaderTitle, { children: title }),
|
|
4803
4821
|
!!description && /* @__PURE__ */ jsx14(SectionHeaderDescription, { children: description })
|
|
4804
4822
|
] }) }),
|
|
4805
|
-
/* @__PURE__ */
|
|
4823
|
+
/* @__PURE__ */ jsxs12("div", { className: "mb-4 flex flex-row gap-2", children: [
|
|
4806
4824
|
toolbarSearch,
|
|
4807
|
-
/* @__PURE__ */
|
|
4825
|
+
/* @__PURE__ */ jsxs12("div", { className: "ml-auto flex items-center gap-2", children: [
|
|
4808
4826
|
showFilterToggle && /* @__PURE__ */ jsx14(FilterToggle, { pressed: filterRowVisible, onPressedChange: setFilterRowVisible, count: filterCount }),
|
|
4809
4827
|
!!Actions && /* @__PURE__ */ jsx14(Actions, { state: tableState }),
|
|
4810
4828
|
toolbarColumns
|
|
@@ -4829,7 +4847,7 @@ function DataTable({
|
|
|
4829
4847
|
className: "data-[visible-filters=true]:mb-4"
|
|
4830
4848
|
}
|
|
4831
4849
|
) }),
|
|
4832
|
-
shouldRenderTableContent ? /* @__PURE__ */
|
|
4850
|
+
shouldRenderTableContent ? /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
4833
4851
|
/* @__PURE__ */ jsx14("div", { className: "flex min-h-0 flex-1 flex-col", "data-testid": "table-main", children: /* @__PURE__ */ jsx14(
|
|
4834
4852
|
"div",
|
|
4835
4853
|
{
|
|
@@ -4839,7 +4857,7 @@ function DataTable({
|
|
|
4839
4857
|
"min-h-0 flex-1 overflow-auto rounded-lg border **:data-[slot=table-container]:overflow-visible",
|
|
4840
4858
|
!!stickyHeader && !fitContent && STICKY_HEADER_MAX_HEIGHT_CLASS
|
|
4841
4859
|
),
|
|
4842
|
-
children: /* @__PURE__ */
|
|
4860
|
+
children: /* @__PURE__ */ jsxs12(
|
|
4843
4861
|
DataTableRoot,
|
|
4844
4862
|
{
|
|
4845
4863
|
layout,
|