@stella-source/stellasource-dsl 3.6.0 → 5.1.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/cjs/index.js +453 -263
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/RadioButton/RadioButton.d.ts +4 -0
- package/dist/cjs/types/components/RadioButton/RadioButton.stories.d.ts +14 -0
- package/dist/cjs/types/components/RadioButton/styles.d.ts +38 -0
- package/dist/cjs/types/components/RadioButton/types.d.ts +13 -0
- package/dist/cjs/types/components/RadioButtonGroup/RadioButtonGroup.d.ts +4 -0
- package/dist/cjs/types/components/RadioButtonGroup/RadioButtonGroup.stories.d.ts +87 -0
- package/dist/cjs/types/components/RadioButtonGroup/styles.d.ts +8 -0
- package/dist/cjs/types/components/RadioButtonGroup/types.d.ts +22 -0
- package/dist/cjs/types/components/StellaIcon/types.d.ts +1 -1
- package/dist/cjs/types/components/Table/Table.d.ts +1 -1
- package/dist/cjs/types/components/Table/Table.stories.d.ts +8 -0
- package/dist/cjs/types/components/Table/TableComponents/CheckboxDropdownMenu.d.ts +26 -0
- package/dist/cjs/types/components/Table/styles.d.ts +10 -1
- package/dist/cjs/types/components/Table/types.d.ts +8 -3
- package/dist/cjs/types/components/Table/useTableState.d.ts +9 -0
- package/dist/esm/index.esm.js +453 -263
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/esm/types/components/RadioButton/RadioButton.d.ts +4 -0
- package/dist/esm/types/components/RadioButton/RadioButton.stories.d.ts +14 -0
- package/dist/esm/types/components/RadioButton/styles.d.ts +38 -0
- package/dist/esm/types/components/RadioButton/types.d.ts +13 -0
- package/dist/esm/types/components/RadioButtonGroup/RadioButtonGroup.d.ts +4 -0
- package/dist/esm/types/components/RadioButtonGroup/RadioButtonGroup.stories.d.ts +87 -0
- package/dist/esm/types/components/RadioButtonGroup/styles.d.ts +8 -0
- package/dist/esm/types/components/RadioButtonGroup/types.d.ts +22 -0
- package/dist/esm/types/components/StellaIcon/types.d.ts +1 -1
- package/dist/esm/types/components/Table/Table.d.ts +1 -1
- package/dist/esm/types/components/Table/Table.stories.d.ts +8 -0
- package/dist/esm/types/components/Table/TableComponents/CheckboxDropdownMenu.d.ts +26 -0
- package/dist/esm/types/components/Table/styles.d.ts +10 -1
- package/dist/esm/types/components/Table/types.d.ts +8 -3
- package/dist/esm/types/components/Table/useTableState.d.ts +9 -0
- package/dist/index.d.ts +9 -4
- package/package.json +1 -1
package/dist/esm/index.esm.js
CHANGED
|
@@ -941,7 +941,7 @@ const a$f = /* @__PURE__ */ new Map([
|
|
|
941
941
|
]
|
|
942
942
|
]);
|
|
943
943
|
|
|
944
|
-
const H = /* @__PURE__ */ new Map([
|
|
944
|
+
const H$1 = /* @__PURE__ */ new Map([
|
|
945
945
|
[
|
|
946
946
|
"bold",
|
|
947
947
|
/* @__PURE__ */ a$n.createElement(a$n.Fragment, null, /* @__PURE__ */ a$n.createElement("path", { d: "M28,132a12,12,0,0,1,0-24H56a4,4,0,0,0,0-8H40a28,28,0,0,1-3.38-55.79A12,12,0,0,1,59.3,44H64a12,12,0,0,1,0,24H40a4,4,0,0,0,0,8H56a28,28,0,0,1,3.38,55.79A12,12,0,0,1,36.7,132ZM236,56V192a20,20,0,0,1-20,20H40a20,20,0,0,1-20-20V164a12,12,0,0,1,24,0v24H156V164H88a12,12,0,0,1,0-24h68V116H112a12,12,0,0,1,0-24H212V68H104a12,12,0,0,1,0-24H224A12,12,0,0,1,236,56Zm-56,84h32V116H180Zm32,48V164H180v24Z" }))
|
|
@@ -1553,6 +1553,33 @@ const e$j = /* @__PURE__ */ new Map([
|
|
|
1553
1553
|
]
|
|
1554
1554
|
]);
|
|
1555
1555
|
|
|
1556
|
+
const H = /* @__PURE__ */ new Map([
|
|
1557
|
+
[
|
|
1558
|
+
"bold",
|
|
1559
|
+
/* @__PURE__ */ a$n.createElement(a$n.Fragment, null, /* @__PURE__ */ a$n.createElement("path", { d: "M224,44H32A12,12,0,0,0,20,56V192a20,20,0,0,0,20,20H216a20,20,0,0,0,20-20V56A12,12,0,0,0,224,44ZM44,116H76v24H44Zm56,0H212v24H100ZM212,68V92H44V68ZM44,164H76v24H44Zm56,24V164H212v24Z" }))
|
|
1560
|
+
],
|
|
1561
|
+
[
|
|
1562
|
+
"duotone",
|
|
1563
|
+
/* @__PURE__ */ a$n.createElement(a$n.Fragment, null, /* @__PURE__ */ a$n.createElement("path", { d: "M88,104v96H32V104Z", opacity: "0.2" }), /* @__PURE__ */ a$n.createElement("path", { d: "M224,48H32a8,8,0,0,0-8,8V192a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A8,8,0,0,0,224,48ZM40,112H80v32H40Zm56,0H216v32H96ZM216,64V96H40V64ZM40,160H80v32H40Zm176,32H96V160H216v32Z" }))
|
|
1564
|
+
],
|
|
1565
|
+
[
|
|
1566
|
+
"fill",
|
|
1567
|
+
/* @__PURE__ */ a$n.createElement(a$n.Fragment, null, /* @__PURE__ */ a$n.createElement("path", { d: "M224,48H32a8,8,0,0,0-8,8V192a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A8,8,0,0,0,224,48ZM40,112H80v32H40Zm56,0H216v32H96ZM40,160H80v32H40Zm176,32H96V160H216v32Z" }))
|
|
1568
|
+
],
|
|
1569
|
+
[
|
|
1570
|
+
"light",
|
|
1571
|
+
/* @__PURE__ */ a$n.createElement(a$n.Fragment, null, /* @__PURE__ */ a$n.createElement("path", { d: "M224,50H32a6,6,0,0,0-6,6V192a14,14,0,0,0,14,14H216a14,14,0,0,0,14-14V56A6,6,0,0,0,224,50ZM38,110H82v36H38Zm56,0H218v36H94ZM218,62V98H38V62ZM38,192V158H82v36H40A2,2,0,0,1,38,192Zm178,2H94V158H218v34A2,2,0,0,1,216,194Z" }))
|
|
1572
|
+
],
|
|
1573
|
+
[
|
|
1574
|
+
"regular",
|
|
1575
|
+
/* @__PURE__ */ a$n.createElement(a$n.Fragment, null, /* @__PURE__ */ a$n.createElement("path", { d: "M224,48H32a8,8,0,0,0-8,8V192a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A8,8,0,0,0,224,48ZM40,112H80v32H40Zm56,0H216v32H96ZM216,64V96H40V64ZM40,160H80v32H40Zm176,32H96V160H216v32Z" }))
|
|
1576
|
+
],
|
|
1577
|
+
[
|
|
1578
|
+
"thin",
|
|
1579
|
+
/* @__PURE__ */ a$n.createElement(a$n.Fragment, null, /* @__PURE__ */ a$n.createElement("path", { d: "M224,52H32a4,4,0,0,0-4,4V192a12,12,0,0,0,12,12H216a12,12,0,0,0,12-12V56A4,4,0,0,0,224,52ZM36,108H84v40H36Zm56,0H220v40H92ZM220,60v40H36V60ZM36,192V156H84v40H40A4,4,0,0,1,36,192Zm180,4H92V156H220v36A4,4,0,0,1,216,196Z" }))
|
|
1580
|
+
]
|
|
1581
|
+
]);
|
|
1582
|
+
|
|
1556
1583
|
const e$i = /* @__PURE__ */ new Map([
|
|
1557
1584
|
[
|
|
1558
1585
|
"bold",
|
|
@@ -1826,7 +1853,7 @@ const a$5 = /* @__PURE__ */ new Map([
|
|
|
1826
1853
|
]
|
|
1827
1854
|
]);
|
|
1828
1855
|
|
|
1829
|
-
const o$
|
|
1856
|
+
const o$n = createContext({
|
|
1830
1857
|
color: "currentColor",
|
|
1831
1858
|
size: "1em",
|
|
1832
1859
|
weight: "regular",
|
|
@@ -1850,7 +1877,7 @@ const p$2 = a$n.forwardRef(
|
|
|
1850
1877
|
weight: f = "regular",
|
|
1851
1878
|
mirrored: g = false,
|
|
1852
1879
|
...w
|
|
1853
|
-
} = a$n.useContext(o$
|
|
1880
|
+
} = a$n.useContext(o$n);
|
|
1854
1881
|
return /* @__PURE__ */ a$n.createElement(
|
|
1855
1882
|
"svg",
|
|
1856
1883
|
{
|
|
@@ -1872,9 +1899,9 @@ const p$2 = a$n.forwardRef(
|
|
|
1872
1899
|
);
|
|
1873
1900
|
p$2.displayName = "IconBase";
|
|
1874
1901
|
|
|
1875
|
-
const o$
|
|
1876
|
-
o$
|
|
1877
|
-
const p$1 = o$
|
|
1902
|
+
const o$m = a$n.forwardRef((e, c) => /* @__PURE__ */ a$n.createElement(p$2, { ref: c, ...e, weights: a$m }));
|
|
1903
|
+
o$m.displayName = "ArrowCircleUpIcon";
|
|
1904
|
+
const p$1 = o$m;
|
|
1878
1905
|
|
|
1879
1906
|
const r$7 = a$n.forwardRef((e, t) => /* @__PURE__ */ a$n.createElement(p$2, { ref: t, ...e, weights: a$l }));
|
|
1880
1907
|
r$7.displayName = "ArrowUpIcon";
|
|
@@ -1891,9 +1918,9 @@ const e$d = a$n.forwardRef((o, t) => /* @__PURE__ */ a$n.createElement(p$2, { re
|
|
|
1891
1918
|
e$d.displayName = "ArrowsOutLineVerticalIcon";
|
|
1892
1919
|
const n$c = e$d;
|
|
1893
1920
|
|
|
1894
|
-
const o$
|
|
1895
|
-
o$
|
|
1896
|
-
const c$9 = o$
|
|
1921
|
+
const o$l = a$n.forwardRef((r, s) => /* @__PURE__ */ a$n.createElement(p$2, { ref: s, ...r, weights: e$E }));
|
|
1922
|
+
o$l.displayName = "AsteriskIcon";
|
|
1923
|
+
const c$9 = o$l;
|
|
1897
1924
|
|
|
1898
1925
|
const a$4 = a$n.forwardRef((e, r) => /* @__PURE__ */ a$n.createElement(p$2, { ref: r, ...e, weights: e$D }));
|
|
1899
1926
|
a$4.displayName = "BankIcon";
|
|
@@ -1929,16 +1956,16 @@ const c$6 = a$n.forwardRef((o, r) => /* @__PURE__ */ a$n.createElement(p$2, { re
|
|
|
1929
1956
|
c$6.displayName = "CheckCircleIcon";
|
|
1930
1957
|
const s$2 = c$6;
|
|
1931
1958
|
|
|
1932
|
-
const o$
|
|
1933
|
-
o$
|
|
1934
|
-
const n$b = o$
|
|
1959
|
+
const o$k = a$n.forwardRef((t, a) => /* @__PURE__ */ a$n.createElement(p$2, { ref: a, ...t, weights: l$6 }));
|
|
1960
|
+
o$k.displayName = "CheckFatIcon";
|
|
1961
|
+
const n$b = o$k;
|
|
1935
1962
|
|
|
1936
|
-
const o$
|
|
1937
|
-
o$
|
|
1963
|
+
const o$j = a$n.forwardRef((r, a) => /* @__PURE__ */ a$n.createElement(p$2, { ref: a, ...r, weights: e$y }));
|
|
1964
|
+
o$j.displayName = "CheckSquareIcon";
|
|
1938
1965
|
|
|
1939
|
-
const o$
|
|
1940
|
-
o$
|
|
1941
|
-
const l = o$
|
|
1966
|
+
const o$i = a$n.forwardRef((r, a) => /* @__PURE__ */ a$n.createElement(p$2, { ref: a, ...r, weights: a$i }));
|
|
1967
|
+
o$i.displayName = "CircleHalfIcon";
|
|
1968
|
+
const l = o$i;
|
|
1942
1969
|
|
|
1943
1970
|
const e$9 = a$n.forwardRef((o, c) => /* @__PURE__ */ a$n.createElement(p$2, { ref: c, ...o, weights: e$x }));
|
|
1944
1971
|
e$9.displayName = "CurrencyCircleDollarIcon";
|
|
@@ -1954,21 +1981,21 @@ const n$a = t$3;
|
|
|
1954
1981
|
const t$2 = a$n.forwardRef((m, e) => /* @__PURE__ */ a$n.createElement(p$2, { ref: e, ...m, weights: a$h }));
|
|
1955
1982
|
t$2.displayName = "EmptyIcon";
|
|
1956
1983
|
|
|
1957
|
-
const o$
|
|
1958
|
-
o$
|
|
1959
|
-
const n$9 = o$
|
|
1984
|
+
const o$h = a$n.forwardRef((r, t) => /* @__PURE__ */ a$n.createElement(p$2, { ref: t, ...r, weights: a$g }));
|
|
1985
|
+
o$h.displayName = "EyeIcon";
|
|
1986
|
+
const n$9 = o$h;
|
|
1960
1987
|
|
|
1961
|
-
const o$
|
|
1962
|
-
o$
|
|
1963
|
-
const n$8 = o$
|
|
1988
|
+
const o$g = a$n.forwardRef((a, r) => /* @__PURE__ */ a$n.createElement(p$2, { ref: r, ...a, weights: e$u }));
|
|
1989
|
+
o$g.displayName = "EyeSlashIcon";
|
|
1990
|
+
const n$8 = o$g;
|
|
1964
1991
|
|
|
1965
|
-
const o$
|
|
1966
|
-
o$
|
|
1967
|
-
const s$1 = o$
|
|
1992
|
+
const o$f = a$n.forwardRef((n, r) => /* @__PURE__ */ a$n.createElement(p$2, { ref: r, ...n, weights: l$5 }));
|
|
1993
|
+
o$f.displayName = "FunnelIcon";
|
|
1994
|
+
const s$1 = o$f;
|
|
1968
1995
|
|
|
1969
|
-
const o$
|
|
1970
|
-
o$
|
|
1971
|
-
const n$7 = o$
|
|
1996
|
+
const o$e = a$n.forwardRef((r, a) => /* @__PURE__ */ a$n.createElement(p$2, { ref: a, ...r, weights: l$4 }));
|
|
1997
|
+
o$e.displayName = "GearIcon";
|
|
1998
|
+
const n$7 = o$e;
|
|
1972
1999
|
|
|
1973
2000
|
const e$8 = a$n.forwardRef((r, s) => /* @__PURE__ */ a$n.createElement(p$2, { ref: s, ...r, weights: l$3 }));
|
|
1974
2001
|
e$8.displayName = "HourglassSimpleLowIcon";
|
|
@@ -1977,41 +2004,41 @@ const e$7 = a$n.forwardRef((r, t) => /* @__PURE__ */ a$n.createElement(p$2, { re
|
|
|
1977
2004
|
e$7.displayName = "InfoIcon";
|
|
1978
2005
|
const c$4 = e$7;
|
|
1979
2006
|
|
|
1980
|
-
const e$6 = a$n.forwardRef((c, r) => /* @__PURE__ */ a$n.createElement(p$2, { ref: r, ...c, weights: H }));
|
|
2007
|
+
const e$6 = a$n.forwardRef((c, r) => /* @__PURE__ */ a$n.createElement(p$2, { ref: r, ...c, weights: H$1 }));
|
|
1981
2008
|
e$6.displayName = "InvoiceIcon";
|
|
1982
2009
|
const m$8 = e$6;
|
|
1983
2010
|
|
|
1984
|
-
const o$
|
|
1985
|
-
o$
|
|
1986
|
-
const n$6 = o$
|
|
2011
|
+
const o$d = a$n.forwardRef((r, t) => /* @__PURE__ */ a$n.createElement(p$2, { ref: t, ...r, weights: a$e }));
|
|
2012
|
+
o$d.displayName = "KeyholeIcon";
|
|
2013
|
+
const n$6 = o$d;
|
|
1987
2014
|
|
|
1988
|
-
const o$
|
|
1989
|
-
o$
|
|
2015
|
+
const o$c = a$n.forwardRef((s, t) => /* @__PURE__ */ a$n.createElement(p$2, { ref: t, ...s, weights: l$2 }));
|
|
2016
|
+
o$c.displayName = "ListChecksIcon";
|
|
1990
2017
|
|
|
1991
|
-
const o$
|
|
1992
|
-
o$
|
|
1993
|
-
const a = o$
|
|
2018
|
+
const o$b = a$n.forwardRef((m, p) => /* @__PURE__ */ a$n.createElement(p$2, { ref: p, ...m, weights: e$t }));
|
|
2019
|
+
o$b.displayName = "LockSimpleOpenIcon";
|
|
2020
|
+
const a = o$b;
|
|
1994
2021
|
|
|
1995
|
-
const o$
|
|
1996
|
-
o$
|
|
1997
|
-
const f = o$
|
|
2022
|
+
const o$a = a$n.forwardRef((s, n) => /* @__PURE__ */ a$n.createElement(p$2, { ref: n, ...s, weights: a$d }));
|
|
2023
|
+
o$a.displayName = "MagnifyingGlassIcon";
|
|
2024
|
+
const f = o$a;
|
|
1998
2025
|
|
|
1999
|
-
const o$
|
|
2000
|
-
o$
|
|
2026
|
+
const o$9 = a$n.forwardRef((r, a) => /* @__PURE__ */ a$n.createElement(p$2, { ref: a, ...r, weights: e$s }));
|
|
2027
|
+
o$9.displayName = "MinusSquareIcon";
|
|
2001
2028
|
|
|
2002
2029
|
const e$5 = a$n.forwardRef((a, r) => /* @__PURE__ */ a$n.createElement(p$2, { ref: r, ...a, weights: e$r }));
|
|
2003
2030
|
e$5.displayName = "MoneyWavyIcon";
|
|
2004
2031
|
|
|
2005
|
-
const o$
|
|
2006
|
-
o$
|
|
2032
|
+
const o$8 = a$n.forwardRef((t, c) => /* @__PURE__ */ a$n.createElement(p$2, { ref: c, ...t, weights: e$q }));
|
|
2033
|
+
o$8.displayName = "NotePencilIcon";
|
|
2007
2034
|
|
|
2008
2035
|
const t$1 = a$n.forwardRef((o, a) => /* @__PURE__ */ a$n.createElement(p$2, { ref: a, ...o, weights: e$p }));
|
|
2009
2036
|
t$1.displayName = "PaletteIcon";
|
|
2010
2037
|
const n$5 = t$1;
|
|
2011
2038
|
|
|
2012
|
-
const o$
|
|
2013
|
-
o$
|
|
2014
|
-
const m$7 = o$
|
|
2039
|
+
const o$7 = a$n.forwardRef((r, a) => /* @__PURE__ */ a$n.createElement(p$2, { ref: a, ...r, weights: e$o }));
|
|
2040
|
+
o$7.displayName = "PaperclipIcon";
|
|
2041
|
+
const m$7 = o$7;
|
|
2015
2042
|
|
|
2016
2043
|
const e$4 = a$n.forwardRef((r, s) => /* @__PURE__ */ a$n.createElement(p$2, { ref: s, ...r, weights: a$c }));
|
|
2017
2044
|
e$4.displayName = "PlusIcon";
|
|
@@ -2021,24 +2048,24 @@ const e$3 = a$n.forwardRef((t, r) => /* @__PURE__ */ a$n.createElement(p$2, { re
|
|
|
2021
2048
|
e$3.displayName = "QuestionIcon";
|
|
2022
2049
|
const m$6 = e$3;
|
|
2023
2050
|
|
|
2024
|
-
const o$
|
|
2025
|
-
o$
|
|
2026
|
-
const h = o$
|
|
2051
|
+
const o$6 = a$n.forwardRef((c, r) => /* @__PURE__ */ a$n.createElement(p$2, { ref: r, ...c, weights: e$n }));
|
|
2052
|
+
o$6.displayName = "ShieldCheckIcon";
|
|
2053
|
+
const h = o$6;
|
|
2027
2054
|
|
|
2028
2055
|
const p = a$n.forwardRef((e, r) => /* @__PURE__ */ a$n.createElement(p$2, { ref: r, ...e, weights: e$m }));
|
|
2029
2056
|
p.displayName = "ShoppingCartSimpleIcon";
|
|
2030
2057
|
const n$3 = p;
|
|
2031
2058
|
|
|
2032
|
-
const o$
|
|
2033
|
-
o$
|
|
2034
|
-
const c$3 = o$
|
|
2059
|
+
const o$5 = a$n.forwardRef((r, s) => /* @__PURE__ */ a$n.createElement(p$2, { ref: s, ...r, weights: e$l }));
|
|
2060
|
+
o$5.displayName = "SlidersIcon";
|
|
2061
|
+
const c$3 = o$5;
|
|
2035
2062
|
|
|
2036
|
-
const o$
|
|
2037
|
-
o$
|
|
2038
|
-
const m$5 = o$
|
|
2063
|
+
const o$4 = a$n.forwardRef((r, n) => /* @__PURE__ */ a$n.createElement(p$2, { ref: n, ...r, weights: e$k }));
|
|
2064
|
+
o$4.displayName = "SpinnerGapIcon";
|
|
2065
|
+
const m$5 = o$4;
|
|
2039
2066
|
|
|
2040
|
-
const o$
|
|
2041
|
-
o$
|
|
2067
|
+
const o$3 = a$n.forwardRef((r, a) => /* @__PURE__ */ a$n.createElement(p$2, { ref: a, ...r, weights: a$a }));
|
|
2068
|
+
o$3.displayName = "SquareIcon";
|
|
2042
2069
|
|
|
2043
2070
|
const t = a$n.forwardRef((a, c) => /* @__PURE__ */ a$n.createElement(p$2, { ref: c, ...a, weights: a$9 }));
|
|
2044
2071
|
t.displayName = "StackIcon";
|
|
@@ -2052,6 +2079,9 @@ const e$2 = a$n.forwardRef((o, r) => /* @__PURE__ */ a$n.createElement(p$2, { re
|
|
|
2052
2079
|
e$2.displayName = "StudentIcon";
|
|
2053
2080
|
const s = e$2;
|
|
2054
2081
|
|
|
2082
|
+
const o$2 = a$n.forwardRef((a, r) => /* @__PURE__ */ a$n.createElement(p$2, { ref: r, ...a, weights: H }));
|
|
2083
|
+
o$2.displayName = "TableIcon";
|
|
2084
|
+
|
|
2055
2085
|
const m$4 = a$n.forwardRef((e, r) => /* @__PURE__ */ a$n.createElement(p$2, { ref: r, ...e, weights: e$i }));
|
|
2056
2086
|
m$4.displayName = "ThumbsDownIcon";
|
|
2057
2087
|
const c$2 = m$4;
|
|
@@ -2195,7 +2225,7 @@ const selectIcon = (iconName) => {
|
|
|
2195
2225
|
case "sync":
|
|
2196
2226
|
return { icon: r$6, color: Styles.color.blue.primary };
|
|
2197
2227
|
case "check-square":
|
|
2198
|
-
return { icon: o$
|
|
2228
|
+
return { icon: o$j, color: Styles.color.blue.primary };
|
|
2199
2229
|
case "empty":
|
|
2200
2230
|
return { icon: t$2, color: Styles.color.states.error };
|
|
2201
2231
|
case "money":
|
|
@@ -2214,9 +2244,11 @@ const selectIcon = (iconName) => {
|
|
|
2214
2244
|
case "truck":
|
|
2215
2245
|
return { icon: r$2, color: Styles.color.grey.shadow };
|
|
2216
2246
|
case "list-checks":
|
|
2217
|
-
return { icon: o$
|
|
2247
|
+
return { icon: o$c, color: Styles.color.blue.primary };
|
|
2218
2248
|
case "note-pencil":
|
|
2219
|
-
return { icon: o$
|
|
2249
|
+
return { icon: o$8, color: Styles.color.grey.charcoal };
|
|
2250
|
+
case "table":
|
|
2251
|
+
return { icon: o$2, color: Styles.color.grey.charcoal };
|
|
2220
2252
|
default:
|
|
2221
2253
|
return {
|
|
2222
2254
|
icon: ({ size, color, id, className, dataTestId }) => (a__default.createElement(StellaIcon$1, { size: size, color: color, id: id, className: className, "data-testid": dataTestId })),
|
|
@@ -2261,6 +2293,7 @@ const getFill = (iconName) => {
|
|
|
2261
2293
|
"list-checks",
|
|
2262
2294
|
"broadcast",
|
|
2263
2295
|
"eye",
|
|
2296
|
+
"table",
|
|
2264
2297
|
];
|
|
2265
2298
|
if (boldIcons.includes(iconName)) {
|
|
2266
2299
|
return "bold";
|
|
@@ -21768,6 +21801,54 @@ function useReactTable(options) {
|
|
|
21768
21801
|
return tableRef.current;
|
|
21769
21802
|
}
|
|
21770
21803
|
|
|
21804
|
+
const TABLE_STORAGE_PREFIX = "ds-table-state";
|
|
21805
|
+
function loadTableState(tableId) {
|
|
21806
|
+
try {
|
|
21807
|
+
const raw = localStorage.getItem(`${TABLE_STORAGE_PREFIX}:${tableId}`);
|
|
21808
|
+
return raw ? JSON.parse(raw) : {};
|
|
21809
|
+
}
|
|
21810
|
+
catch {
|
|
21811
|
+
return {};
|
|
21812
|
+
}
|
|
21813
|
+
}
|
|
21814
|
+
function saveTableState(tableId, state) {
|
|
21815
|
+
try {
|
|
21816
|
+
localStorage.setItem(`${TABLE_STORAGE_PREFIX}:${tableId}`, JSON.stringify(state));
|
|
21817
|
+
}
|
|
21818
|
+
catch { }
|
|
21819
|
+
}
|
|
21820
|
+
function usePersistTableState(tableId, state, sizingDebounceMs = 300) {
|
|
21821
|
+
const debounceTimer = useRef(null);
|
|
21822
|
+
const latestSizing = useRef(state.columnSizing);
|
|
21823
|
+
useEffect(() => {
|
|
21824
|
+
latestSizing.current = state.columnSizing;
|
|
21825
|
+
}, [state.columnSizing]);
|
|
21826
|
+
// Persist visibility and sorting immediately
|
|
21827
|
+
useEffect(() => {
|
|
21828
|
+
saveTableState(tableId, {
|
|
21829
|
+
columnVisibility: state.columnVisibility,
|
|
21830
|
+
columnSizing: latestSizing.current,
|
|
21831
|
+
sorting: state.sorting,
|
|
21832
|
+
});
|
|
21833
|
+
}, [tableId, state.columnVisibility, state.sorting]);
|
|
21834
|
+
// Persist sizing debounced
|
|
21835
|
+
useEffect(() => {
|
|
21836
|
+
if (debounceTimer.current)
|
|
21837
|
+
clearTimeout(debounceTimer.current);
|
|
21838
|
+
debounceTimer.current = setTimeout(() => {
|
|
21839
|
+
saveTableState(tableId, {
|
|
21840
|
+
columnVisibility: state.columnVisibility,
|
|
21841
|
+
columnSizing: latestSizing.current,
|
|
21842
|
+
sorting: state.sorting,
|
|
21843
|
+
});
|
|
21844
|
+
}, sizingDebounceMs);
|
|
21845
|
+
return () => {
|
|
21846
|
+
if (debounceTimer.current)
|
|
21847
|
+
clearTimeout(debounceTimer.current);
|
|
21848
|
+
};
|
|
21849
|
+
}, [tableId, state.columnSizing]);
|
|
21850
|
+
}
|
|
21851
|
+
|
|
21771
21852
|
const getSelectWidth = (digits) => {
|
|
21772
21853
|
if (digits >= 10 && digits <= 99)
|
|
21773
21854
|
return "36px";
|
|
@@ -22277,6 +22358,49 @@ const ClearFilterButtonRow = styled.div `
|
|
|
22277
22358
|
align-items: "center";
|
|
22278
22359
|
text-align: "center";
|
|
22279
22360
|
`;
|
|
22361
|
+
const ExpandedContentRow = styled.tr `
|
|
22362
|
+
background-color: ${Styles.color.grey.pale};
|
|
22363
|
+
`;
|
|
22364
|
+
const ExpandedContentCell = styled.td `
|
|
22365
|
+
padding: 12px 16px;
|
|
22366
|
+
border-bottom: 1px solid ${Styles.color.grey.light};
|
|
22367
|
+
background-color: ${Styles.color.grey.pale};
|
|
22368
|
+
`;
|
|
22369
|
+
const ExpandChevronButton = styled.button `
|
|
22370
|
+
display: flex;
|
|
22371
|
+
align-items: center;
|
|
22372
|
+
justify-content: center;
|
|
22373
|
+
background: none;
|
|
22374
|
+
border: none;
|
|
22375
|
+
cursor: pointer;
|
|
22376
|
+
padding: 4px;
|
|
22377
|
+
border-radius: 4px;
|
|
22378
|
+
transition:
|
|
22379
|
+
transform 0.2s ease,
|
|
22380
|
+
background-color 0.15s ease;
|
|
22381
|
+
|
|
22382
|
+
& > svg {
|
|
22383
|
+
transition: transform 0.2s ease;
|
|
22384
|
+
transform: ${({ $expanded }) => $expanded ? "rotate(90deg)" : "rotate(0deg)"};
|
|
22385
|
+
fill: ${Styles.color.grey.charcoal};
|
|
22386
|
+
}
|
|
22387
|
+
|
|
22388
|
+
&:hover {
|
|
22389
|
+
background-color: ${Styles.color.grey.light};
|
|
22390
|
+
}
|
|
22391
|
+
`;
|
|
22392
|
+
const ActionBar = styled.div `
|
|
22393
|
+
display: flex;
|
|
22394
|
+
justify-content: space-between;
|
|
22395
|
+
height: fit-content;
|
|
22396
|
+
width: 100%;
|
|
22397
|
+
`;
|
|
22398
|
+
const GlobalActionWrapper = styled.div `
|
|
22399
|
+
display: flex;
|
|
22400
|
+
gap: 10px;
|
|
22401
|
+
width: fit-content;
|
|
22402
|
+
padding-bottom: 5px;
|
|
22403
|
+
`;
|
|
22280
22404
|
|
|
22281
22405
|
const IndeterminateCheckbox = ({ isIndeterminate, isChecked, onChange, }) => {
|
|
22282
22406
|
const ref = useRef(null);
|
|
@@ -22319,6 +22443,40 @@ function useDebounceCallback(callback, delay) {
|
|
|
22319
22443
|
return [debounced, { flush, cancel }];
|
|
22320
22444
|
}
|
|
22321
22445
|
|
|
22446
|
+
const CheckboxDropdownMenu = ({ options, selected, mode = "multiSelect", coords, menuRef, onApply, onClear, showSelectAll = true, showClear = false, searchInputId = "search", searchInputLabel = "Search", onSearch, onSearchBlur, serverSide = false, }) => {
|
|
22447
|
+
const [tempSelected, setTempSelected] = useState(selected);
|
|
22448
|
+
const toggleItem = (key) => {
|
|
22449
|
+
setTempSelected((prev) => prev.includes(key) ? prev.filter((i) => i !== key) : [...prev, key]);
|
|
22450
|
+
};
|
|
22451
|
+
const toggleAll = () => {
|
|
22452
|
+
setTempSelected((prev) => prev.length === options.length ? [] : options.map((o) => o.key));
|
|
22453
|
+
};
|
|
22454
|
+
const showApplyButton = mode === "multiSelect" || (mode === "search" && serverSide);
|
|
22455
|
+
return createPortal(a__default.createElement(FilterMenu, { style: { top: coords.top, left: coords.left, position: "absolute" }, ref: menuRef },
|
|
22456
|
+
a__default.createElement(MenuItemGroup, null,
|
|
22457
|
+
mode === "search" && (a__default.createElement("div", { style: { padding: "4px 10px" } },
|
|
22458
|
+
a__default.createElement(TextInput, { id: searchInputId, label: searchInputLabel, placeholder: "Search", hideLabel: true, onChange: (value) => {
|
|
22459
|
+
setTempSelected(value === "" ? [] : [value]);
|
|
22460
|
+
if (!serverSide)
|
|
22461
|
+
onSearch?.(value);
|
|
22462
|
+
}, onBlur: () => !serverSide && onSearchBlur?.(), endIcon: "search", value: tempSelected?.[0] }))),
|
|
22463
|
+
mode === "multiSelect" && showSelectAll && (a__default.createElement(MenuItem, { key: "select-all" },
|
|
22464
|
+
a__default.createElement(Checkbox, { id: "all-checkbox", name: "all-checkbox", checked: options.every((opt) => tempSelected.includes(opt.key)), onChange: toggleAll }),
|
|
22465
|
+
a__default.createElement(FilterBoxLabel, { htmlFor: "all-checkbox" }, "Select All"))),
|
|
22466
|
+
mode !== "search" &&
|
|
22467
|
+
options.map(({ key, value }, index) => {
|
|
22468
|
+
if (mode === "singleSelect") {
|
|
22469
|
+
return (a__default.createElement(MenuItemOption, { key: `${key}-${index}`, id: `${key}-button`, onClick: () => onApply([key]), "$applied": selected.includes(key) }, value));
|
|
22470
|
+
}
|
|
22471
|
+
return (a__default.createElement(MenuItem, { key: key },
|
|
22472
|
+
a__default.createElement(Checkbox, { id: `${key}-checkbox`, name: `${key}-checkbox`, checked: tempSelected.includes(key), onChange: () => toggleItem(key) }),
|
|
22473
|
+
a__default.createElement(FilterLabelTransparent, null, value),
|
|
22474
|
+
a__default.createElement(FilterBoxLabel, { htmlFor: `${key}-checkbox` }, value)));
|
|
22475
|
+
})),
|
|
22476
|
+
showApplyButton && (a__default.createElement(MenuButton, { onClick: () => onApply(tempSelected) }, "Apply Selection")),
|
|
22477
|
+
showClear && a__default.createElement(MenuButton, { onClick: onClear }, "Clear Filter")), document.body);
|
|
22478
|
+
};
|
|
22479
|
+
|
|
22322
22480
|
const normalizeOptions = (raw) => {
|
|
22323
22481
|
return raw
|
|
22324
22482
|
.map((item) => {
|
|
@@ -22335,27 +22493,29 @@ const TableHeaderCell = ({ header, serverSide, filters, sorting, scrollPosition,
|
|
|
22335
22493
|
const column = header.column;
|
|
22336
22494
|
const columnDef = column.columnDef;
|
|
22337
22495
|
const meta = columnDef.meta;
|
|
22338
|
-
// Filter dropdown logic
|
|
22339
22496
|
const menuRef = useRef(null);
|
|
22340
22497
|
const buttonRef = useRef(null);
|
|
22341
22498
|
const [showFilter, setShowFilter] = useState(false);
|
|
22342
22499
|
const [coords, setCoords] = useState({ top: 0, left: 0 });
|
|
22343
|
-
const [tempFilters, setTempFilters] = useState([]);
|
|
22344
|
-
const [currentAppliedFilters, setCurrentAppliedFilters] = useState([]);
|
|
22345
22500
|
const [filterOptions, setFilterOptions] = useState([]);
|
|
22346
|
-
const displayOptions = serverSide
|
|
22347
|
-
? filterOptions
|
|
22348
|
-
: normalizeOptions(Array.from(header.column.getFacetedUniqueValues().keys()));
|
|
22349
22501
|
const [textAlign, setTextAlign] = useState("left");
|
|
22350
22502
|
const [handleSave, { flush }] = useDebounceCallback((value) => {
|
|
22351
|
-
column?.setFilterValue([value]);
|
|
22352
|
-
if (value === "")
|
|
22353
|
-
column?.setFilterValue([]);
|
|
22503
|
+
column?.setFilterValue(value === "" ? [] : [value]);
|
|
22354
22504
|
onFilterApply?.();
|
|
22355
22505
|
}, 300);
|
|
22506
|
+
const displayOptions = serverSide
|
|
22507
|
+
? filterOptions
|
|
22508
|
+
: normalizeOptions(Array.from(header.column.getFacetedUniqueValues().keys()));
|
|
22356
22509
|
useEffect(() => {
|
|
22357
22510
|
setFilterOptions(normalizeOptions(meta?.filterOptions || []));
|
|
22358
22511
|
}, [meta]);
|
|
22512
|
+
useEffect(() => {
|
|
22513
|
+
setTextAlign(meta?.headerAlign || (meta?.dataType === "number" ? "right" : "left"));
|
|
22514
|
+
}, [meta]);
|
|
22515
|
+
useEffect(() => {
|
|
22516
|
+
if (meta?.pin)
|
|
22517
|
+
column.pin(meta.pin);
|
|
22518
|
+
}, []);
|
|
22359
22519
|
const toggleMenu = (e) => {
|
|
22360
22520
|
e.stopPropagation();
|
|
22361
22521
|
if (buttonRef.current) {
|
|
@@ -22365,11 +22525,13 @@ const TableHeaderCell = ({ header, serverSide, filters, sorting, scrollPosition,
|
|
|
22365
22525
|
left: rect.right + window.scrollX - 25,
|
|
22366
22526
|
});
|
|
22367
22527
|
}
|
|
22368
|
-
|
|
22528
|
+
const next = !showFilter;
|
|
22529
|
+
onFilterMenuInteraction?.(column.id, next);
|
|
22530
|
+
setShowFilter(next);
|
|
22369
22531
|
};
|
|
22370
|
-
const
|
|
22371
|
-
onFilterMenuInteraction?.(column.id,
|
|
22372
|
-
setShowFilter(
|
|
22532
|
+
const closeMenu = () => {
|
|
22533
|
+
onFilterMenuInteraction?.(column.id, false);
|
|
22534
|
+
setShowFilter(false);
|
|
22373
22535
|
};
|
|
22374
22536
|
// Close on outside click
|
|
22375
22537
|
useEffect(() => {
|
|
@@ -22377,28 +22539,14 @@ const TableHeaderCell = ({ header, serverSide, filters, sorting, scrollPosition,
|
|
|
22377
22539
|
return;
|
|
22378
22540
|
const handleClickOutside = (e) => {
|
|
22379
22541
|
const target = e.target;
|
|
22380
|
-
|
|
22381
|
-
|
|
22382
|
-
if (!insideButton && !insideMenu) {
|
|
22383
|
-
setTempFilters(filters?.[header.id] || currentAppliedFilters);
|
|
22384
|
-
showFilterMenu(false);
|
|
22542
|
+
if (!buttonRef.current?.contains(target) && !menuRef.current?.contains(target)) {
|
|
22543
|
+
closeMenu();
|
|
22385
22544
|
}
|
|
22386
22545
|
};
|
|
22387
22546
|
document.addEventListener("click", handleClickOutside, true);
|
|
22388
22547
|
return () => document.removeEventListener("click", handleClickOutside, true);
|
|
22389
22548
|
}, [showFilter]);
|
|
22390
|
-
|
|
22391
|
-
setTextAlign(meta?.headerAlign || (meta?.dataType === "number" ? "right" : "left"));
|
|
22392
|
-
}, [meta]);
|
|
22393
|
-
useEffect(() => {
|
|
22394
|
-
const currentFilters = filters?.[header.id];
|
|
22395
|
-
setTempFilters(currentFilters ? currentFilters : []);
|
|
22396
|
-
}, [filters]);
|
|
22397
|
-
useEffect(() => {
|
|
22398
|
-
if (meta?.pin) {
|
|
22399
|
-
column.pin(meta?.pin);
|
|
22400
|
-
}
|
|
22401
|
-
}, []);
|
|
22549
|
+
const appliedFilters = filters?.[header.id] ?? [];
|
|
22402
22550
|
return (a__default.createElement(HeaderCell, { "$isPinnedLeft": column.getIsPinned() === "left", "$isPinnedRight": column.getIsPinned() === "right", "$columnInfo": column, "$filterMenuOpen": showFilter, style: {
|
|
22403
22551
|
textAlign: meta?.headerAlign || (meta?.dataType === "number" ? "right" : "left"),
|
|
22404
22552
|
width: header.getSize(),
|
|
@@ -22409,82 +22557,19 @@ const TableHeaderCell = ({ header, serverSide, filters, sorting, scrollPosition,
|
|
|
22409
22557
|
? "none"
|
|
22410
22558
|
: undefined,
|
|
22411
22559
|
} },
|
|
22412
|
-
a__default.createElement(HeaderCellPosition, { style: {
|
|
22413
|
-
justifyContent: textAlign === "left" ? "start" : "end",
|
|
22414
|
-
} },
|
|
22560
|
+
a__default.createElement(HeaderCellPosition, { style: { justifyContent: textAlign === "left" ? "start" : "end" } },
|
|
22415
22561
|
textAlign === "left" && (a__default.createElement("span", { style: { fontWeight: 600 } }, flexRender(columnDef.header, header.getContext()))),
|
|
22416
|
-
header.column.getCanFilter() && (a__default.createElement("div", { style: {
|
|
22417
|
-
|
|
22418
|
-
|
|
22419
|
-
|
|
22420
|
-
|
|
22421
|
-
|
|
22422
|
-
|
|
22423
|
-
|
|
22424
|
-
|
|
22425
|
-
|
|
22426
|
-
|
|
22427
|
-
}, ref: menuRef },
|
|
22428
|
-
a__default.createElement(MenuItemGroup, null,
|
|
22429
|
-
meta?.filterMode === "search" && (a__default.createElement("div", { style: { padding: "4px 10px" } },
|
|
22430
|
-
a__default.createElement(TextInput, { id: `${columnDef.header}-search`, label: `${columnDef.header} search`, placeholder: "Search", hideLabel: true, onChange: (value) => {
|
|
22431
|
-
value === ""
|
|
22432
|
-
? setTempFilters([])
|
|
22433
|
-
: setTempFilters([value]);
|
|
22434
|
-
!serverSide && handleSave(value);
|
|
22435
|
-
}, onBlur: () => !serverSide && flush(), endIcon: "search", value: tempFilters?.[0] }))),
|
|
22436
|
-
(meta?.filterMode === "multiSelect" ||
|
|
22437
|
-
!meta?.filterMode) && (a__default.createElement(MenuItem, { key: "select-all" },
|
|
22438
|
-
a__default.createElement(Checkbox, { id: "all-checkbox", name: "all-checkbox", checked: displayOptions?.every((opt) => tempFilters?.includes(opt.key)), onChange: () => {
|
|
22439
|
-
setTempFilters((prev) => {
|
|
22440
|
-
if (prev?.length === displayOptions?.length) {
|
|
22441
|
-
return [];
|
|
22442
|
-
}
|
|
22443
|
-
else {
|
|
22444
|
-
return displayOptions.map((opt) => opt.key);
|
|
22445
|
-
}
|
|
22446
|
-
});
|
|
22447
|
-
} }),
|
|
22448
|
-
a__default.createElement(FilterBoxLabel, { htmlFor: "all-checkbox" }, "Select All"))),
|
|
22449
|
-
displayOptions?.map(({ key, value }, index) => {
|
|
22450
|
-
if (meta?.filterMode === "singleSelect") {
|
|
22451
|
-
return (a__default.createElement(MenuItemOption, { key: `${key}-${index}`, id: `${key}-button`, onClick: () => {
|
|
22452
|
-
setCurrentAppliedFilters([key]);
|
|
22453
|
-
column?.setFilterValue([key]);
|
|
22454
|
-
showFilterMenu(false);
|
|
22455
|
-
onFilterApply?.();
|
|
22456
|
-
}, "$applied": tempFilters?.includes(key) }, value));
|
|
22457
|
-
}
|
|
22458
|
-
if (meta?.filterMode === "multiSelect" ||
|
|
22459
|
-
!meta?.filterMode) {
|
|
22460
|
-
return (a__default.createElement(MenuItem, { key: key },
|
|
22461
|
-
a__default.createElement(Checkbox, { id: `${key}-checkbox`, name: `${key}-checkbox`, checked: tempFilters?.includes(key), onChange: () => {
|
|
22462
|
-
setTempFilters((prev) => {
|
|
22463
|
-
if (prev?.includes(key))
|
|
22464
|
-
return prev.filter((i) => i !== key);
|
|
22465
|
-
else
|
|
22466
|
-
return [...prev, key];
|
|
22467
|
-
});
|
|
22468
|
-
} }),
|
|
22469
|
-
a__default.createElement(FilterLabelTransparent, null, value),
|
|
22470
|
-
a__default.createElement(FilterBoxLabel, { htmlFor: `${key}-checkbox` }, value)));
|
|
22471
|
-
}
|
|
22472
|
-
})),
|
|
22473
|
-
(meta?.filterMode === "multiSelect" ||
|
|
22474
|
-
(meta?.filterMode === "search" && serverSide) ||
|
|
22475
|
-
!meta?.filterMode) && (a__default.createElement(MenuButton, { key: "apply", onClick: () => {
|
|
22476
|
-
setCurrentAppliedFilters(tempFilters);
|
|
22477
|
-
column?.setFilterValue(tempFilters?.length > 0 ? tempFilters : []);
|
|
22478
|
-
showFilterMenu(false);
|
|
22479
|
-
onFilterApply?.();
|
|
22480
|
-
} }, "Apply Selection")),
|
|
22481
|
-
filters?.[header.id]?.length > 0 && (a__default.createElement(MenuButton, { key: "clear", onClick: () => {
|
|
22482
|
-
column?.setFilterValue([]);
|
|
22483
|
-
showFilterMenu(false);
|
|
22484
|
-
setTempFilters([]);
|
|
22485
|
-
setCurrentAppliedFilters([]);
|
|
22486
|
-
onFilterApply?.();
|
|
22487
|
-
} }, "Clear Filter"))), document.body))),
|
|
22562
|
+
header.column.getCanFilter() && (a__default.createElement("div", { style: { display: "flex", alignItems: "center", position: "relative" } },
|
|
22563
|
+
a__default.createElement(CustomIconButton$1, { className: "icon", iconName: "filter", ariaLabel: "Filter Button", variant: "tertiary", "$active": appliedFilters.length > 0 || showFilter, onClick: (e) => toggleMenu(e), ref: buttonRef }),
|
|
22564
|
+
showFilter && (a__default.createElement(CheckboxDropdownMenu, { options: displayOptions, selected: appliedFilters, mode: meta?.filterMode ?? "multiSelect", coords: coords, menuRef: menuRef, showSelectAll: meta?.filterMode !== "singleSelect", showClear: appliedFilters.length > 0, onApply: (selected) => {
|
|
22565
|
+
column?.setFilterValue(selected.length > 0 ? selected : []);
|
|
22566
|
+
closeMenu();
|
|
22567
|
+
onFilterApply?.();
|
|
22568
|
+
}, onClear: () => {
|
|
22569
|
+
column?.setFilterValue([]);
|
|
22570
|
+
closeMenu();
|
|
22571
|
+
onFilterApply?.();
|
|
22572
|
+
}, serverSide: serverSide, onSearch: handleSave, onSearchBlur: flush, searchInputId: `${String(columnDef.header)}-search`, searchInputLabel: `${String(columnDef.header)} search` })))),
|
|
22488
22573
|
header.column.getCanSort() && (a__default.createElement(SortButton, { className: "icon", iconName: "sort", ariaLabel: "Sort Button", variant: "tertiary", "$active": sorting.some((s) => s.id === header.column.id), "$sort": column.getIsSorted(), onClick: (e) => header.column.getToggleSortingHandler()?.(e) })),
|
|
22489
22574
|
textAlign === "right" && (a__default.createElement("span", { style: { fontWeight: 600 } }, flexRender(columnDef.header, header.getContext()))))));
|
|
22490
22575
|
};
|
|
@@ -22544,7 +22629,7 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
22544
22629
|
startingPage: 1,
|
|
22545
22630
|
rowsPerPage: 10,
|
|
22546
22631
|
totalRows: data.length,
|
|
22547
|
-
}, selectionMenuItems, dataAuto, dataTestId, id, className, htmlProps, resetTrigger, emptyTableState, defaultFilters, staticFilters, }) {
|
|
22632
|
+
}, selectionMenuItems, dataAuto, dataTestId, id, className, htmlProps, resetTrigger, emptyTableState, defaultFilters, staticFilters, enableShowHide, globalActions, showExpandedRowToggle = false, renderExpandedRow, }) {
|
|
22548
22633
|
const [rowSelection, setRowSelection] = useState({});
|
|
22549
22634
|
const [selectedRows] = useState({});
|
|
22550
22635
|
const [pageIndex, setPageIndex] = useState(paginationDetails?.startingPage);
|
|
@@ -22555,9 +22640,20 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
22555
22640
|
const [localData, setLocalData] = useState(data);
|
|
22556
22641
|
const [localColumns, setLocalColumns] = useState(columns);
|
|
22557
22642
|
const [totalData, setTotalData] = useState(paginationDetails?.totalRows);
|
|
22558
|
-
const [sorting, setSorting] = useState([]);
|
|
22643
|
+
const [sorting, setSorting] = useState(() => loadTableState(id).sorting ?? []);
|
|
22559
22644
|
const [filters, setFilters] = useState({});
|
|
22560
22645
|
const [rowState, setRowState] = useState({});
|
|
22646
|
+
const [columnVisibility, setColumnVisibility] = useState(() => {
|
|
22647
|
+
const persisted = loadTableState(id);
|
|
22648
|
+
if (persisted.columnVisibility)
|
|
22649
|
+
return persisted.columnVisibility;
|
|
22650
|
+
return Object.fromEntries(columns
|
|
22651
|
+
.filter((col) => col.meta?.defaultHidden)
|
|
22652
|
+
.map((col) => [
|
|
22653
|
+
"accessorKey" in col ? col.accessorKey : col.id,
|
|
22654
|
+
false,
|
|
22655
|
+
]));
|
|
22656
|
+
});
|
|
22561
22657
|
const [columnFilters, setColumnFilters] = useState(() => {
|
|
22562
22658
|
const base = defaultFilters ?? [];
|
|
22563
22659
|
if (!staticFilters?.length)
|
|
@@ -22580,12 +22676,27 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
22580
22676
|
});
|
|
22581
22677
|
const [columnPinning, setColumnPinning] = useState({ left: ["select"], right: ["options"] });
|
|
22582
22678
|
const scrollRef = useRef(null);
|
|
22679
|
+
const visibilityButtonRef = useRef(null);
|
|
22680
|
+
const visibilityMenuRef = useRef(null);
|
|
22681
|
+
const [showVisibilityMenu, setShowVisibilityMenu] = useState(false);
|
|
22682
|
+
const [visibilityMenuCoords, setVisibilityMenuCoords] = useState({
|
|
22683
|
+
top: 0,
|
|
22684
|
+
left: 0,
|
|
22685
|
+
});
|
|
22583
22686
|
const [scrollState, setScrollState] = useState({
|
|
22584
22687
|
atLeft: true,
|
|
22585
22688
|
atRight: false,
|
|
22586
22689
|
});
|
|
22587
22690
|
const [rowStatusesState, setRowStatusesState] = useState(rowStatuses || {});
|
|
22588
22691
|
const [filterMenuOpen, setFilterMenuOpen] = useState({});
|
|
22692
|
+
const [expandedRows, setExpandedRows] = useState(new Set());
|
|
22693
|
+
const toggleRowExpanded = (rowId) => {
|
|
22694
|
+
setExpandedRows((prev) => {
|
|
22695
|
+
const next = new Set(prev);
|
|
22696
|
+
next.has(rowId) ? next.delete(rowId) : next.add(rowId);
|
|
22697
|
+
return next;
|
|
22698
|
+
});
|
|
22699
|
+
};
|
|
22589
22700
|
useEffect(() => {
|
|
22590
22701
|
setRowStatusesState(rowStatuses || {});
|
|
22591
22702
|
}, [rowStatuses]);
|
|
@@ -22600,6 +22711,19 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
22600
22711
|
if (paginationDetails && paginationDetails.startingPage !== pageIndex)
|
|
22601
22712
|
setPageIndex(paginationDetails?.startingPage);
|
|
22602
22713
|
}, [paginationDetails, data, columns]);
|
|
22714
|
+
useEffect(() => {
|
|
22715
|
+
if (!showVisibilityMenu)
|
|
22716
|
+
return;
|
|
22717
|
+
const handleClickOutside = (e) => {
|
|
22718
|
+
const target = e.target;
|
|
22719
|
+
if (!visibilityButtonRef.current?.contains(target) &&
|
|
22720
|
+
!visibilityMenuRef.current?.contains(target)) {
|
|
22721
|
+
setShowVisibilityMenu(false);
|
|
22722
|
+
}
|
|
22723
|
+
};
|
|
22724
|
+
document.addEventListener("click", handleClickOutside, true);
|
|
22725
|
+
return () => document.removeEventListener("click", handleClickOutside, true);
|
|
22726
|
+
}, [showVisibilityMenu]);
|
|
22603
22727
|
useLayoutEffect$1(() => {
|
|
22604
22728
|
const el = scrollRef.current;
|
|
22605
22729
|
if (!el)
|
|
@@ -22646,6 +22770,18 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
22646
22770
|
};
|
|
22647
22771
|
const enhancedColumns = useMemo$1(() => {
|
|
22648
22772
|
const cols = [];
|
|
22773
|
+
if (showExpandedRowToggle) {
|
|
22774
|
+
cols.push({
|
|
22775
|
+
id: "expand",
|
|
22776
|
+
header: "",
|
|
22777
|
+
cell: ({ row }) => !!renderExpandedRow?.(row) ? (a__default.createElement(ExpandChevronButton, { "$expanded": expandedRows.has(row.id), onClick: (e) => {
|
|
22778
|
+
e.stopPropagation();
|
|
22779
|
+
toggleRowExpanded(row.id);
|
|
22780
|
+
}, "aria-label": expandedRows.has(row.id) ? "Collapse row" : "Expand row" },
|
|
22781
|
+
a__default.createElement(StellaIcon, { iconName: "chevron-right", size: 14 }))) : (a__default.createElement(a__default.Fragment, null)),
|
|
22782
|
+
size: 36,
|
|
22783
|
+
});
|
|
22784
|
+
}
|
|
22649
22785
|
if (showSelection) {
|
|
22650
22786
|
cols.push({
|
|
22651
22787
|
id: "select",
|
|
@@ -22677,11 +22813,13 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
22677
22813
|
onRowSelect,
|
|
22678
22814
|
showSelection,
|
|
22679
22815
|
showRowOptions,
|
|
22816
|
+
expandedRows,
|
|
22680
22817
|
]);
|
|
22681
22818
|
const table = useReactTable({
|
|
22682
22819
|
data: localData,
|
|
22683
22820
|
columns: enhancedColumns,
|
|
22684
22821
|
state: {
|
|
22822
|
+
columnVisibility,
|
|
22685
22823
|
pagination,
|
|
22686
22824
|
sorting,
|
|
22687
22825
|
columnFilters,
|
|
@@ -22697,6 +22835,7 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
22697
22835
|
enableRowSelection: showSelection,
|
|
22698
22836
|
rowCount: serverSide ? paginationDetails?.totalRows : undefined,
|
|
22699
22837
|
enableColumnPinning: true,
|
|
22838
|
+
onColumnVisibilityChange: setColumnVisibility,
|
|
22700
22839
|
getCoreRowModel: getCoreRowModel(),
|
|
22701
22840
|
getFacetedRowModel: !serverSide ? getFacetedRowModel() : undefined,
|
|
22702
22841
|
getFacetedUniqueValues: !serverSide ? getFacetedUniqueValues() : undefined,
|
|
@@ -22750,6 +22889,7 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
22750
22889
|
},
|
|
22751
22890
|
},
|
|
22752
22891
|
});
|
|
22892
|
+
usePersistTableState(id, { columnVisibility, sorting });
|
|
22753
22893
|
useEffect(() => {
|
|
22754
22894
|
if (onRowSelect) {
|
|
22755
22895
|
const selectedData = table
|
|
@@ -22777,95 +22917,145 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
22777
22917
|
});
|
|
22778
22918
|
table.toggleAllRowsSelected(false);
|
|
22779
22919
|
};
|
|
22780
|
-
return (a__default.createElement(
|
|
22781
|
-
|
|
22782
|
-
a__default.createElement(
|
|
22783
|
-
|
|
22784
|
-
|
|
22785
|
-
|
|
22786
|
-
|
|
22787
|
-
|
|
22788
|
-
|
|
22789
|
-
|
|
22790
|
-
|
|
22791
|
-
|
|
22792
|
-
|
|
22793
|
-
|
|
22794
|
-
|
|
22795
|
-
|
|
22796
|
-
|
|
22797
|
-
|
|
22798
|
-
|
|
22799
|
-
|
|
22800
|
-
|
|
22801
|
-
|
|
22802
|
-
|
|
22803
|
-
|
|
22804
|
-
|
|
22805
|
-
|
|
22806
|
-
|
|
22807
|
-
|
|
22808
|
-
|
|
22809
|
-
|
|
22810
|
-
|
|
22811
|
-
|
|
22812
|
-
|
|
22813
|
-
|
|
22814
|
-
|
|
22815
|
-
|
|
22816
|
-
|
|
22817
|
-
|
|
22818
|
-
|
|
22819
|
-
|
|
22820
|
-
|
|
22821
|
-
|
|
22822
|
-
|
|
22823
|
-
|
|
22824
|
-
|
|
22825
|
-
|
|
22826
|
-
|
|
22827
|
-
|
|
22828
|
-
|
|
22829
|
-
|
|
22830
|
-
|
|
22831
|
-
|
|
22832
|
-
|
|
22833
|
-
|
|
22834
|
-
|
|
22835
|
-
|
|
22836
|
-
|
|
22837
|
-
|
|
22838
|
-
|
|
22839
|
-
|
|
22840
|
-
|
|
22841
|
-
|
|
22842
|
-
|
|
22843
|
-
|
|
22844
|
-
|
|
22845
|
-
|
|
22846
|
-
|
|
22847
|
-
|
|
22848
|
-
|
|
22849
|
-
|
|
22850
|
-
|
|
22851
|
-
|
|
22852
|
-
|
|
22853
|
-
|
|
22854
|
-
|
|
22855
|
-
|
|
22856
|
-
|
|
22857
|
-
|
|
22858
|
-
|
|
22859
|
-
|
|
22860
|
-
|
|
22861
|
-
|
|
22862
|
-
|
|
22863
|
-
|
|
22864
|
-
|
|
22865
|
-
|
|
22866
|
-
|
|
22867
|
-
|
|
22868
|
-
|
|
22920
|
+
return (a__default.createElement(a__default.Fragment, null,
|
|
22921
|
+
!isLoading && (a__default.createElement(ActionBar, null,
|
|
22922
|
+
a__default.createElement(GlobalActionWrapper, null, globalActions?.(table)),
|
|
22923
|
+
a__default.createElement(GlobalActionWrapper, null, enableShowHide && (a__default.createElement(a__default.Fragment, null,
|
|
22924
|
+
a__default.createElement(IconButton, { ref: visibilityButtonRef, ariaLabel: "Column show hide button", variant: "tertiary", iconName: "table", onClick: () => {
|
|
22925
|
+
const rect = visibilityButtonRef.current?.getBoundingClientRect();
|
|
22926
|
+
if (rect) {
|
|
22927
|
+
setVisibilityMenuCoords({
|
|
22928
|
+
top: rect.bottom + window.scrollY + 4,
|
|
22929
|
+
left: rect.right + window.scrollX - 140,
|
|
22930
|
+
});
|
|
22931
|
+
}
|
|
22932
|
+
setShowVisibilityMenu((prev) => !prev);
|
|
22933
|
+
} }),
|
|
22934
|
+
showVisibilityMenu && (a__default.createElement(CheckboxDropdownMenu, { options: table
|
|
22935
|
+
.getAllLeafColumns()
|
|
22936
|
+
.filter((col) => col.id !== "select" && col.id !== "options")
|
|
22937
|
+
.map((col) => ({
|
|
22938
|
+
key: col.id,
|
|
22939
|
+
value: typeof col.columnDef.header === "string"
|
|
22940
|
+
? col.columnDef.header
|
|
22941
|
+
: col.id,
|
|
22942
|
+
})), selected: table
|
|
22943
|
+
.getAllLeafColumns()
|
|
22944
|
+
.filter((col) => col.getIsVisible())
|
|
22945
|
+
.map((col) => col.id), mode: "multiSelect", coords: visibilityMenuCoords, menuRef: visibilityMenuRef, showSelectAll: true, showClear: false, onApply: (selected) => {
|
|
22946
|
+
const next = {};
|
|
22947
|
+
table
|
|
22948
|
+
.getAllLeafColumns()
|
|
22949
|
+
.filter((col) => col.id !== "select" && col.id !== "options")
|
|
22950
|
+
.forEach((col) => {
|
|
22951
|
+
next[col.id] = selected.includes(col.id);
|
|
22952
|
+
});
|
|
22953
|
+
setColumnVisibility(next);
|
|
22954
|
+
setShowVisibilityMenu(false);
|
|
22955
|
+
}, onClear: () => { } }))))))),
|
|
22956
|
+
a__default.createElement(TableWrapper, { className: className, id: id, "data-testid": dataTestId, "data-auto": dataAuto },
|
|
22957
|
+
a__default.createElement(TableWrapperScroll, { "$stopScroll": Object.values(filterMenuOpen).some((value) => value), ref: scrollRef }, isLoading ? (a__default.createElement("div", null,
|
|
22958
|
+
a__default.createElement("div", { style: {
|
|
22959
|
+
width: "100%",
|
|
22960
|
+
maxWidth: "100%",
|
|
22961
|
+
height: "100%",
|
|
22962
|
+
marginBottom: "4px",
|
|
22963
|
+
backgroundColor: "#f9f9f9",
|
|
22964
|
+
display: "flex",
|
|
22965
|
+
flexDirection: "column",
|
|
22966
|
+
overflow: "hidden",
|
|
22967
|
+
boxSizing: "border-box",
|
|
22968
|
+
} }, Array.from({
|
|
22969
|
+
length: pagination?.pageSize,
|
|
22970
|
+
}).map((_, index) => (a__default.createElement("div", { style: {
|
|
22971
|
+
position: "relative",
|
|
22972
|
+
display: "flex",
|
|
22973
|
+
flexDirection: "row",
|
|
22974
|
+
gap: "90px",
|
|
22975
|
+
padding: "10px 25px",
|
|
22976
|
+
backgroundColor: index === 0 ? "#ededed" : "transparent",
|
|
22977
|
+
borderBottom: "1px solid #e0e0e0",
|
|
22978
|
+
alignItems: "center",
|
|
22979
|
+
height: "50px",
|
|
22980
|
+
minHeight: "50px",
|
|
22981
|
+
}, key: index + "loading-row" }, Array.from({
|
|
22982
|
+
length: 10,
|
|
22983
|
+
}).map((_, i) => (a__default.createElement(LoadingShimmer, { key: `${i}-loading`, "$width": "110px", "$height": "25px" }))))))))) : (a__default.createElement(StyledTable, { id: `${id}-table`, ...htmlProps },
|
|
22984
|
+
a__default.createElement("thead", null, table.getHeaderGroups().map((headerGroup) => (a__default.createElement(HeaderRow, { key: headerGroup.id }, headerGroup.headers.map((header, i) => {
|
|
22985
|
+
return (a__default.createElement(TableHeaderCell, { key: header.id, serverSide: serverSide, header: header, filters: filters, sorting: sorting, scrollPosition: scrollState, onFilterMenuInteraction: (id, active) => {
|
|
22986
|
+
setFilterMenuOpen((prev) => ({
|
|
22987
|
+
...prev,
|
|
22988
|
+
[id]: active,
|
|
22989
|
+
}));
|
|
22990
|
+
}, onFilterApply: () => {
|
|
22991
|
+
setPageIndex(1);
|
|
22992
|
+
setPagination((prev) => ({
|
|
22993
|
+
...prev,
|
|
22994
|
+
pageIndex: 0,
|
|
22995
|
+
}));
|
|
22996
|
+
} }));
|
|
22997
|
+
}))))),
|
|
22998
|
+
a__default.createElement("tbody", null,
|
|
22999
|
+
table.getRowModel().rows.length === 0 && (a__default.createElement(EmptyTableState, { header: emptyTableState?.header || "No data available.", subHeader: emptyTableState?.subHeader, showClearFilterButton: emptyTableState?.showClearFilterButton, onClearFilters: resetTable, colSpan: table.getVisibleLeafColumns().length, size: "large" })),
|
|
23000
|
+
table.getRowModel().rows.map((row) => (a__default.createElement(a__default.Fragment, { key: row.id },
|
|
23001
|
+
a__default.createElement(CellRow, { onClick: () => {
|
|
23002
|
+
if (!showExpandedRowToggle &&
|
|
23003
|
+
!!renderExpandedRow?.(row))
|
|
23004
|
+
toggleRowExpanded(row.id);
|
|
23005
|
+
onRowClick?.(row.original);
|
|
23006
|
+
}, "$isClickable": !!onRowClick }, row.getVisibleCells().map((cell) => {
|
|
23007
|
+
const value = flexRender(cell.column.columnDef.cell, {
|
|
23008
|
+
...cell.getContext(),
|
|
23009
|
+
localValue: rowState[row.id]?.[cell.column.id],
|
|
23010
|
+
onLocalChange: (val) => handleInputChange(row.id, cell.column.id, val),
|
|
23011
|
+
});
|
|
23012
|
+
const meta = cell.column.columnDef
|
|
23013
|
+
.meta;
|
|
23014
|
+
return (a__default.createElement(BodyCell, { key: cell.id, style: {
|
|
23015
|
+
width: cell.column.getSize(),
|
|
23016
|
+
textAlign: meta?.cellAlign ||
|
|
23017
|
+
(typeof cell.getValue() === "number" ||
|
|
23018
|
+
meta?.dataType === "number"
|
|
23019
|
+
? "right"
|
|
23020
|
+
: "left"),
|
|
23021
|
+
boxShadow: scrollState.atLeft &&
|
|
23022
|
+
cell.column.getIsPinned() === "left"
|
|
23023
|
+
? "none"
|
|
23024
|
+
: scrollState.atRight &&
|
|
23025
|
+
cell.column.getIsPinned() === "right"
|
|
23026
|
+
? "none"
|
|
23027
|
+
: undefined,
|
|
23028
|
+
backgroundColor: table
|
|
23029
|
+
.getSelectedRowModel()
|
|
23030
|
+
.rows.find((r) => r.id === row.id)
|
|
23031
|
+
? "#EBF0FA"
|
|
23032
|
+
: rowStatusesState?.[row.id] ===
|
|
23033
|
+
"action-pending"
|
|
23034
|
+
? "#FFFDEB"
|
|
23035
|
+
: rowStatusesState?.[row.id] === "completed"
|
|
23036
|
+
? "#F5F5F5"
|
|
23037
|
+
: "",
|
|
23038
|
+
}, "$isPinnedLeft": cell.column.getIsPinned() === "left", "$isPinnedRight": cell.column.getIsPinned() === "right", "$columnInfo": cell.column, "$isLastRow": serverSide
|
|
23039
|
+
? row.index ===
|
|
23040
|
+
table.getRowModel().rows.length - 1
|
|
23041
|
+
: row.index -
|
|
23042
|
+
pagination.pageSize *
|
|
23043
|
+
pagination.pageIndex ===
|
|
23044
|
+
table.getRowModel().rows.length - 1 }, value));
|
|
23045
|
+
})),
|
|
23046
|
+
expandedRows.has(row.id) &&
|
|
23047
|
+
renderExpandedRow &&
|
|
23048
|
+
!!renderExpandedRow(row) && (a__default.createElement(ExpandedContentRow, null,
|
|
23049
|
+
a__default.createElement(ExpandedContentCell, { colSpan: table.getVisibleLeafColumns().length }, renderExpandedRow(row))))))))))),
|
|
23050
|
+
showPagination && paginationDetails?.totalRows > 0 && (a__default.createElement(CustomPagination, { "$hasData": table.getRowModel().rows.length > 0, totalRows: serverSide ? totalData : table.getFilteredRowModel().rows.length, isLoading: isLoading, rowsPerPage: paginationDetails?.rowsPerPage, startingPage: pageIndex, onPageChange: (page, pageSize) => {
|
|
23051
|
+
table.toggleAllRowsSelected(false);
|
|
23052
|
+
setPageIndex(page);
|
|
23053
|
+
setPagination((prev) => ({
|
|
23054
|
+
...prev,
|
|
23055
|
+
pageIndex: page - 1,
|
|
23056
|
+
}));
|
|
23057
|
+
onPageChange?.(page, pageSize);
|
|
23058
|
+
}, resetTrigger: resetTrigger })))));
|
|
22869
23059
|
}
|
|
22870
23060
|
|
|
22871
23061
|
const SyncContainer = styled.div `
|
|
@@ -22946,7 +23136,7 @@ const HeaderText = styled.span `
|
|
|
22946
23136
|
color: #4d4d4d;
|
|
22947
23137
|
text-align: right;
|
|
22948
23138
|
font-family: Inter;
|
|
22949
|
-
font-size:
|
|
23139
|
+
font-size: 14px;
|
|
22950
23140
|
font-style: normal;
|
|
22951
23141
|
font-weight: 500;
|
|
22952
23142
|
line-height: normal;
|
|
@@ -22955,7 +23145,7 @@ const SubHeaderText = styled.span `
|
|
|
22955
23145
|
color: #9f9f9f;
|
|
22956
23146
|
text-align: right;
|
|
22957
23147
|
font-family: Inter;
|
|
22958
|
-
font-size:
|
|
23148
|
+
font-size: 11px;
|
|
22959
23149
|
font-style: normal;
|
|
22960
23150
|
font-weight: 500;
|
|
22961
23151
|
line-height: normal;
|
|
@@ -23415,10 +23605,10 @@ const CheckBox = ({ id, className, label, checked, indeterminate = false, disabl
|
|
|
23415
23605
|
? Styles.color.grey.medium
|
|
23416
23606
|
: Styles.color.core.primary;
|
|
23417
23607
|
if (isIndeterminate)
|
|
23418
|
-
return (a__default.createElement(o$
|
|
23608
|
+
return (a__default.createElement(o$9, { "data-testid": "indeterminate-icon", className: "checkbox-icon", size: 18, weight: "fill", color: color }));
|
|
23419
23609
|
if (isChecked)
|
|
23420
|
-
return (a__default.createElement(o$
|
|
23421
|
-
return (a__default.createElement(o$
|
|
23610
|
+
return (a__default.createElement(o$j, { "data-testid": "check-icon", className: "checkbox-icon", size: 18, weight: "fill", color: color }));
|
|
23611
|
+
return (a__default.createElement(o$3, { "data-testid": "square-icon", className: "checkbox-icon", size: 18, weight: "regular", color: color }));
|
|
23422
23612
|
};
|
|
23423
23613
|
return (a__default.createElement(CheckBoxWrapper, { id: `${id}-label`, className: className, "$disabled": disabled, "$align": align, "$fontSize": fontSize },
|
|
23424
23614
|
a__default.createElement(HiddenInput, { id: id, ref: inputRef, checked: isChecked, disabled: disabled, onChange: handleChange, ...htmlProps }),
|