asma-ui-core 3.107.3 → 3.108.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/asma-ui-core.css +1 -1
- package/dist/components/data-display/chip/StyledChip.js +55 -55
- package/dist/components/data-display/interactive-chip/StyledInteractiveChip.js +11 -11
- package/dist/components/inputs/checkbox/base-ui/StyledCheckbox.js +44 -49
- package/dist/components/inputs/checkbox/base-ui/StyledCheckbox.module.js +12 -12
- package/dist/components/inputs/radio-button/base-ui/StyledRadio.module.js +7 -7
- package/dist/src/components/data-display/interactive-chip/StyledInteractiveChip.d.ts +1 -1
- package/dist/src/components/inputs/checkbox/base-ui/StyledCheckbox.d.ts +2 -2
- package/dist/src/table/helpers/columnSpacing.d.ts +6 -0
- package/dist/table/components/StyledTable.module.js +54 -52
- package/dist/table/components/TableRow.js +51 -51
- package/dist/table/components/table-header/TableHeaderCell.js +24 -24
- package/dist/table/shared-components/StyledCheckbox.js +42 -47
- package/dist/table/shared-components/StyledCheckbox.module.js +12 -12
- package/package.json +1 -1
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import { ACTIONS_COLUMN_ID as q } from "../types.js";
|
|
2
|
-
import { useRootContext as
|
|
1
|
+
import { ACTIONS_COLUMN_ID as q, INTERNAL_COLUMN_IDS as pe } from "../types.js";
|
|
2
|
+
import { useRootContext as xe } from "../context/RootContext.js";
|
|
3
3
|
import n from "./StyledTable.module.js";
|
|
4
|
-
import { compact as
|
|
4
|
+
import { compact as be } from "../../helpers/arrays.js";
|
|
5
5
|
import K from "clsx";
|
|
6
|
-
import { Fragment as
|
|
6
|
+
import { Fragment as Ce, useCallback as G, useEffect as Re, useLayoutEffect as Se, useMemo as m, useRef as De, useState as Ne } from "react";
|
|
7
7
|
import { Fragment as ve, jsx as s, jsxs as C } from "react/jsx-runtime";
|
|
8
8
|
import { useSortable as ye } from "@dnd-kit/sortable";
|
|
9
|
-
import { flexRender as
|
|
10
|
-
import { CSS as
|
|
11
|
-
var
|
|
9
|
+
import { flexRender as Ee } from "@tanstack/react-table";
|
|
10
|
+
import { CSS as Ie } from "@dnd-kit/utilities";
|
|
11
|
+
var Fe = (R) => {
|
|
12
12
|
const t = R.closest("table");
|
|
13
13
|
if (!t) return !1;
|
|
14
14
|
const r = Array.from(document.querySelectorAll('a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])')).find((g) => !t.contains(g) && !!(t.compareDocumentPosition(g) & Node.DOCUMENT_POSITION_FOLLOWING));
|
|
15
15
|
return r ? (r.focus(), document.activeElement === r) : !1;
|
|
16
16
|
};
|
|
17
17
|
function We({ styledTableProps: R, row: t, index: r, hasFocusedRow: g, columnWindow: { paddingLeft: h, paddingRight: p, indexes: T } }) {
|
|
18
|
-
const { loading: V, getRowClassName: l, activeRowId:
|
|
18
|
+
const { loading: V, getRowClassName: l, activeRowId: L, rowHeight: x, onRowClick: S, expandArrow: Y, enableDnd: w, disableDndForRow: J, tdClassName: A, customSubRowData: M, renderSubRows: Q, defaultExpanded: X, actions: D, customActionsNode: Z, textExpandArrow: B, enableMultiRowSelection: ee, enableRowSelection: te, singleSelectionRow: ne } = R, N = J?.(t), { transform: ie, transition: oe, setNodeRef: O, isDragging: _ } = ye({
|
|
19
19
|
id: t.original.id,
|
|
20
|
-
disabled: !
|
|
20
|
+
disabled: !w || N
|
|
21
21
|
}), se = {
|
|
22
|
-
transform:
|
|
22
|
+
transform: Ie.Transform.toString(ie),
|
|
23
23
|
transition: oe,
|
|
24
|
-
opacity:
|
|
25
|
-
zIndex:
|
|
24
|
+
opacity: _ ? 0.8 : 1,
|
|
25
|
+
zIndex: _ ? 1 : 0,
|
|
26
26
|
position: "relative"
|
|
27
|
-
}, { isResizing: le, disableResizingFlag: ae } =
|
|
28
|
-
|
|
29
|
-
!
|
|
30
|
-
}, [
|
|
27
|
+
}, { isResizing: le, disableResizingFlag: ae } = xe(), v = t.isExpanded(), b = De(null), [ce, de] = Ne(void 0);
|
|
28
|
+
Se(() => {
|
|
29
|
+
!v && b.current && de(b.current.cells[0]?.clientHeight ?? b.current.offsetHeight);
|
|
30
|
+
}, [v]);
|
|
31
31
|
const re = G((e) => {
|
|
32
|
-
b.current = e,
|
|
33
|
-
}, [
|
|
34
|
-
|
|
32
|
+
b.current = e, N || O(e);
|
|
33
|
+
}, [N, O]), H = v ? ce ?? x : x;
|
|
34
|
+
Re(() => {
|
|
35
35
|
X && t.getCanExpand() && !t.getIsExpanded() && t.toggleExpand();
|
|
36
36
|
}, []);
|
|
37
|
-
const
|
|
37
|
+
const U = (e) => {
|
|
38
38
|
t.getCanExpand() && !Y && t.getToggleExpandedHandler()(), document.getElementById(t.id)?.focus();
|
|
39
39
|
const i = window.getSelection()?.type !== "Range" && !le, o = S instanceof Function;
|
|
40
|
-
!o &&
|
|
40
|
+
!o && B && i ? t.toggleExpand() : o && i && S(e, t), ae();
|
|
41
41
|
}, ue = (e) => {
|
|
42
|
-
e.target.classList.contains("MuiModal-backdrop") || e.target.nodeName === "INPUT" || e.target.nodeName === "BUTTON" || e.target.nodeName === "LI" || e.target.closest("li") ||
|
|
42
|
+
e.target.classList.contains("MuiModal-backdrop") || e.target.nodeName === "INPUT" || e.target.nodeName === "BUTTON" || e.target.nodeName === "LI" || e.target.closest("li") || U(e);
|
|
43
43
|
}, fe = (e) => {
|
|
44
44
|
if (e.target === e.currentTarget)
|
|
45
45
|
switch (e.key) {
|
|
@@ -51,7 +51,7 @@ function We({ styledTableProps: R, row: t, index: r, hasFocusedRow: g, columnWin
|
|
|
51
51
|
}
|
|
52
52
|
const i = e.currentTarget.closest("table")?.querySelector('thead tr[tabindex="0"]');
|
|
53
53
|
i && (e.preventDefault(), i.focus());
|
|
54
|
-
} else (t.focusNextRow() ||
|
|
54
|
+
} else (t.focusNextRow() || Fe(e.currentTarget)) && e.preventDefault();
|
|
55
55
|
break;
|
|
56
56
|
case "ArrowDown":
|
|
57
57
|
t.focusNextRow() && e.preventDefault();
|
|
@@ -60,32 +60,32 @@ function We({ styledTableProps: R, row: t, index: r, hasFocusedRow: g, columnWin
|
|
|
60
60
|
t.focusPrevRow() && e.preventDefault();
|
|
61
61
|
break;
|
|
62
62
|
case "Enter":
|
|
63
|
-
e.preventDefault(),
|
|
63
|
+
e.preventDefault(), U(e);
|
|
64
64
|
break;
|
|
65
65
|
}
|
|
66
66
|
}, u = t.getVisibleCells().map((e, i, o) => ({
|
|
67
67
|
...e,
|
|
68
68
|
left: o.slice(0, i).reduce((c, d) => c + (d.column.getSize() ?? 0), 0)
|
|
69
|
-
})),
|
|
69
|
+
})), z = m(() => u.filter((e) => !e.column.columnDef.fixedLeft && !e.column.columnDef.fixedRight && e.column.id !== "actions"), [u]), a = m(() => u.filter((e) => !!e.column.columnDef.fixedRight || e.column.id === "actions").map((e, i, o) => ({
|
|
70
70
|
...e,
|
|
71
71
|
right: o.slice(i + 1).reduce((c, d) => c + (d.column.getSize() ?? 0), 0)
|
|
72
|
-
})), [u]),
|
|
73
|
-
const o = e.column.id === q, c = e.column.columnDef.fixedLeft, d = !!e.column.columnDef.fixedRight, me = e.id === f.at(-1)?.id, ge = e.id === a.at(0)?.id && !o, he = t.isExpanded(),
|
|
72
|
+
})), [u]), W = m(() => a.some((e) => e.column.id === q), [a]), P = !!D || !!Z, $ = m(() => a.some((e) => !!e.column.columnDef.fixedRight), [a]), f = m(() => u.filter((e) => e.column.columnDef.fixedLeft), [u]), y = !ee && !te && ne, E = t.getIsSelected() && y, I = S instanceof Function, j = T.length > 0 ? be(T.map((e) => z[e])) : z, F = G((e, i) => {
|
|
73
|
+
const o = e.column.id === q, c = e.column.columnDef.fixedLeft, d = !!e.column.columnDef.fixedRight, me = e.id === f.at(-1)?.id, ge = e.id === a.at(0)?.id && !o, he = t.isExpanded(), k = i === 0;
|
|
74
74
|
return /* @__PURE__ */ s("td", {
|
|
75
|
-
className: K(n["t-cell"],
|
|
75
|
+
className: K(n["t-cell"], !pe.includes(e.column.id) && e.column.getSize() > 64 && n["data-cell"], e.column.id === "select" && n["select-cell"], I && "cursor-pointer", A, o && n["action-cell"], o && (!P || $) && n["action-cell--no-shadow"], o && !!D && f.length && n.shadowed, o && (l?.(t) ? l?.(t) : n["action-cell-default-background"]), c && n["fixed-cell"], d && n["fixed-right-cell"], me && n.shadowed, ge && n["shadowed-right"], t.getIsSelected() && n.selected, c && (l?.(t) ? l?.(t) : n["fixed-cell-default-background"]), d && (l?.(t) ? l?.(t) : n["fixed-right-cell-default-background"]), he && n.expanded_row, !!E && n["single-selection"]),
|
|
76
76
|
style: {
|
|
77
77
|
left: c ? e.left : void 0,
|
|
78
|
-
right: d ? e.right + (
|
|
78
|
+
right: d ? e.right + (W ? -1 : 0) : void 0
|
|
79
79
|
},
|
|
80
80
|
children: /* @__PURE__ */ C("div", {
|
|
81
81
|
style: {
|
|
82
82
|
display: "flex",
|
|
83
83
|
alignItems: "center",
|
|
84
|
-
minWidth:
|
|
85
|
-
minHeight:
|
|
84
|
+
minWidth: k ? 32 : void 0,
|
|
85
|
+
minHeight: H,
|
|
86
86
|
position: "relative"
|
|
87
87
|
},
|
|
88
|
-
children: [
|
|
88
|
+
children: [k && E && /* @__PURE__ */ s("span", {
|
|
89
89
|
style: {
|
|
90
90
|
display: "inline-flex",
|
|
91
91
|
alignItems: "center",
|
|
@@ -94,42 +94,42 @@ function We({ styledTableProps: R, row: t, index: r, hasFocusedRow: g, columnWin
|
|
|
94
94
|
top: "50%",
|
|
95
95
|
transform: "translateY(-50%)"
|
|
96
96
|
},
|
|
97
|
-
children: /* @__PURE__ */ s(
|
|
97
|
+
children: /* @__PURE__ */ s(ke, {})
|
|
98
98
|
}), /* @__PURE__ */ s("span", {
|
|
99
99
|
style: {
|
|
100
|
-
marginLeft:
|
|
100
|
+
marginLeft: k && y ? 30 : 0,
|
|
101
101
|
width: "100%"
|
|
102
102
|
},
|
|
103
|
-
children:
|
|
103
|
+
children: Ee(e.column.columnDef.cell, e.getContext())
|
|
104
104
|
})]
|
|
105
105
|
})
|
|
106
106
|
}, e.id);
|
|
107
107
|
}, [
|
|
108
|
-
|
|
108
|
+
E,
|
|
109
109
|
D,
|
|
110
|
-
|
|
110
|
+
H,
|
|
111
111
|
l,
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
I,
|
|
113
|
+
W,
|
|
114
114
|
$,
|
|
115
115
|
f,
|
|
116
116
|
a,
|
|
117
117
|
t,
|
|
118
118
|
P,
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
y,
|
|
120
|
+
A
|
|
121
121
|
]);
|
|
122
|
-
return /* @__PURE__ */ C(
|
|
122
|
+
return /* @__PURE__ */ C(Ce, { children: [/* @__PURE__ */ C("tr", {
|
|
123
123
|
"aria-selected": t.getIsSelected() || t.isFocused() ? "true" : "false",
|
|
124
124
|
tabIndex: t.isFocused() || r === 0 && !g ? 0 : -1,
|
|
125
125
|
"data-index": r,
|
|
126
126
|
"data-test": t.id,
|
|
127
|
-
"data-active":
|
|
127
|
+
"data-active": L != null && t.id === L ? "true" : void 0,
|
|
128
128
|
id: t.id,
|
|
129
129
|
className: K(n["t-row"], V && n["is-loading"], l?.(t)),
|
|
130
130
|
style: {
|
|
131
131
|
height: x ? `${x}px` : "inherit",
|
|
132
|
-
...
|
|
132
|
+
...w && se
|
|
133
133
|
},
|
|
134
134
|
ref: re,
|
|
135
135
|
onFocus: (e) => {
|
|
@@ -137,11 +137,11 @@ function We({ styledTableProps: R, row: t, index: r, hasFocusedRow: g, columnWin
|
|
|
137
137
|
},
|
|
138
138
|
onMouseUp: ue,
|
|
139
139
|
onMouseDown: (e) => {
|
|
140
|
-
e.detail > 1 && !
|
|
140
|
+
e.detail > 1 && !I && B && e.preventDefault();
|
|
141
141
|
},
|
|
142
142
|
onKeyDownCapture: fe,
|
|
143
143
|
children: [
|
|
144
|
-
f.map((e, i) =>
|
|
144
|
+
f.map((e, i) => F(e, i)),
|
|
145
145
|
h > 0 && /* @__PURE__ */ s("td", {
|
|
146
146
|
"aria-hidden": !0,
|
|
147
147
|
className: n["t-cell"],
|
|
@@ -153,7 +153,7 @@ function We({ styledTableProps: R, row: t, index: r, hasFocusedRow: g, columnWin
|
|
|
153
153
|
border: "none"
|
|
154
154
|
}
|
|
155
155
|
}),
|
|
156
|
-
j.map((e, i) =>
|
|
156
|
+
j.map((e, i) => F(e, f.length + i)),
|
|
157
157
|
p > 0 && /* @__PURE__ */ s("td", {
|
|
158
158
|
"aria-hidden": !0,
|
|
159
159
|
className: n["t-cell"],
|
|
@@ -165,14 +165,14 @@ function We({ styledTableProps: R, row: t, index: r, hasFocusedRow: g, columnWin
|
|
|
165
165
|
border: "none"
|
|
166
166
|
}
|
|
167
167
|
}),
|
|
168
|
-
a.map((e, i) =>
|
|
168
|
+
a.map((e, i) => F(e, f.length + j.length + i))
|
|
169
169
|
]
|
|
170
|
-
}), t.getIsExpanded() && /* @__PURE__ */ s(ve, { children:
|
|
171
|
-
rows:
|
|
170
|
+
}), t.getIsExpanded() && /* @__PURE__ */ s(ve, { children: M && Q?.({
|
|
171
|
+
rows: M.get(t.original.id.toString()) ?? [],
|
|
172
172
|
row: t.original
|
|
173
173
|
}) })] }, t.id);
|
|
174
174
|
}
|
|
175
|
-
var
|
|
175
|
+
var ke = () => /* @__PURE__ */ C("svg", {
|
|
176
176
|
xmlns: "http://www.w3.org/2000/svg",
|
|
177
177
|
width: "20",
|
|
178
178
|
height: "20",
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { ACTIONS_COLUMN_ID as
|
|
1
|
+
import { ACTIONS_COLUMN_ID as C, INTERNAL_COLUMN_IDS as S } from "../../types.js";
|
|
2
2
|
import { useRootContext as G } from "../../context/RootContext.js";
|
|
3
3
|
import n from "../StyledTable.module.js";
|
|
4
4
|
import { DropUpIcon as A } from "../../shared-components/DropUpIcon.js";
|
|
5
|
-
import { DropDownIcon as
|
|
6
|
-
import { getTableHeaderStyle as
|
|
7
|
-
import
|
|
8
|
-
import { useMemo as
|
|
9
|
-
import { jsx as
|
|
10
|
-
import { flexRender as
|
|
11
|
-
function
|
|
12
|
-
const { hideHeader: c = !1, enableResizing: r = !1, actions:
|
|
13
|
-
return /* @__PURE__ */
|
|
5
|
+
import { DropDownIcon as L } from "../../shared-components/DropDownIcon.js";
|
|
6
|
+
import { getTableHeaderStyle as w } from "../../helpers/getTableHeaderStyle.js";
|
|
7
|
+
import D from "clsx";
|
|
8
|
+
import { useMemo as i } from "react";
|
|
9
|
+
import { jsx as l, jsxs as F } from "react/jsx-runtime";
|
|
10
|
+
import { flexRender as M } from "@tanstack/react-table";
|
|
11
|
+
function Q({ styledTableProps: R, header: o, tableCanResize: _ = !1, left: N, right: b, tableWidth: z }) {
|
|
12
|
+
const { hideHeader: c = !1, enableResizing: r = !1, actions: I, customActionsNode: H } = R, { isResizing: a, enableResizingFlag: m, disableResizingFlag: u } = G(), d = o.column.columnDef.fixedLeft, g = !!o.column.columnDef.fixedRight, f = o.column.id === C, T = !!I || !!H, p = i(() => o.headerGroup.headers.some((e) => e.id === C), [o.headerGroup.headers]), h = i(() => o.headerGroup.headers.some((e) => !!e.column.columnDef.fixedRight), [o.headerGroup.headers]), v = i(() => o.headerGroup.headers[o.headerGroup.headers.length - (p ? 2 : 1)], [o.headerGroup.headers, p]), t = o.column.getCanSort(), x = o.column.getIsSorted(), y = t ? x === "asc" ? "ascending" : x === "desc" ? "descending" : "none" : void 0;
|
|
13
|
+
return /* @__PURE__ */ l("th", {
|
|
14
14
|
colSpan: o.colSpan,
|
|
15
|
-
"aria-sort":
|
|
16
|
-
className:
|
|
15
|
+
"aria-sort": y,
|
|
16
|
+
className: D(n["t-cell"], !S.includes(o.column.id) && o.column.getSize() > 64 && n["data-cell"], o.column.id === "select" && n["select-cell"], c && n["hide-header"], f && n["t-cell__actions"], f && (!T || h) && n["t-cell__actions--no-shadow"], d && n["t-cell__fixed"], g && n["t-cell__fixed-right"]),
|
|
17
17
|
style: {
|
|
18
|
-
...
|
|
18
|
+
...w({
|
|
19
19
|
enableResizing: r,
|
|
20
20
|
header: o,
|
|
21
|
-
tableWidth:
|
|
21
|
+
tableWidth: z
|
|
22
22
|
}),
|
|
23
|
-
...d && { left:
|
|
24
|
-
...g && { right:
|
|
23
|
+
...d && { left: N },
|
|
24
|
+
...g && { right: b }
|
|
25
25
|
},
|
|
26
|
-
children: /* @__PURE__ */
|
|
27
|
-
className:
|
|
26
|
+
children: /* @__PURE__ */ F("div", {
|
|
27
|
+
className: D("flex items-center justify-start", c ? n["hide-table-header"] : n["show-table-header"], t && n["sortable-column"], o.column.columnDef.className),
|
|
28
28
|
role: t ? "button" : void 0,
|
|
29
29
|
tabIndex: t ? 0 : void 0,
|
|
30
30
|
onClick: (e) => {
|
|
@@ -38,15 +38,15 @@ function J({ styledTableProps: D, header: o, tableCanResize: S = !1, left: _, ri
|
|
|
38
38
|
!a && s && s(e), u();
|
|
39
39
|
} : void 0,
|
|
40
40
|
children: [
|
|
41
|
-
/* @__PURE__ */
|
|
41
|
+
/* @__PURE__ */ l("div", {
|
|
42
42
|
className: n["header-content"],
|
|
43
|
-
children:
|
|
43
|
+
children: M(o.column.columnDef.header, o.getContext())
|
|
44
44
|
}),
|
|
45
45
|
{
|
|
46
|
-
asc: /* @__PURE__ */
|
|
47
|
-
desc: /* @__PURE__ */
|
|
46
|
+
asc: /* @__PURE__ */ l(A, { className: n["sort-icon"] }),
|
|
47
|
+
desc: /* @__PURE__ */ l(L, { className: n["sort-icon"] })
|
|
48
48
|
}[o.column.getIsSorted()] ?? null,
|
|
49
|
-
|
|
49
|
+
_ && (r ? !0 : o.id !== v?.id) && o.column.getCanResize() && !S.includes(o.column.id) && /* @__PURE__ */ l("div", {
|
|
50
50
|
onDoubleClick: () => o.column.resetSize(),
|
|
51
51
|
onMouseDown: (e) => {
|
|
52
52
|
e.stopPropagation(), m(), o.getResizeHandler()(e);
|
|
@@ -61,5 +61,5 @@ function J({ styledTableProps: D, header: o, tableCanResize: S = !1, left: _, ri
|
|
|
61
61
|
}, o.id);
|
|
62
62
|
}
|
|
63
63
|
export {
|
|
64
|
-
|
|
64
|
+
Q as TableHeaderCell
|
|
65
65
|
};
|
|
@@ -1,82 +1,77 @@
|
|
|
1
1
|
import { cn as x } from "../../helpers/cn.js";
|
|
2
2
|
import e from "./StyledCheckbox.module.js";
|
|
3
|
-
import
|
|
4
|
-
import { Fragment as
|
|
5
|
-
var
|
|
3
|
+
import F, { useEffect as v, useRef as b } from "react";
|
|
4
|
+
import { Fragment as P, jsx as t, jsxs as l } from "react/jsx-runtime";
|
|
5
|
+
var $ = (o) => /* @__PURE__ */ l("svg", {
|
|
6
6
|
viewBox: "0 0 24 24",
|
|
7
7
|
width: "100%",
|
|
8
8
|
height: "100%",
|
|
9
9
|
fill: "none",
|
|
10
|
-
...
|
|
10
|
+
...o,
|
|
11
11
|
children: [/* @__PURE__ */ t("title", { children: "Indeterminate icon" }), /* @__PURE__ */ t("path", {
|
|
12
12
|
d: "M6 12H18",
|
|
13
13
|
stroke: "currentColor",
|
|
14
|
-
strokeWidth:
|
|
14
|
+
strokeWidth: o.strokeWidth ?? 3,
|
|
15
15
|
strokeLinecap: "round"
|
|
16
16
|
})]
|
|
17
|
-
}),
|
|
18
|
-
viewBox: "0 0
|
|
17
|
+
}), j = () => /* @__PURE__ */ l("svg", {
|
|
18
|
+
viewBox: "0 0 16 16",
|
|
19
19
|
width: "100%",
|
|
20
20
|
height: "100%",
|
|
21
|
-
fill: "
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
strokeLinejoin: "round",
|
|
26
|
-
...r,
|
|
27
|
-
children: [/* @__PURE__ */ t("title", { children: "Check icon" }), /* @__PURE__ */ t("path", { d: "M4 12l5 5L20 6" })]
|
|
28
|
-
}), _ = ({ dataTest: r, size: d = "medium", disabled: h, readOnly: a, indeterminate: n = !1, checked: p, disableRipple: g, hideWrapper: I, className: N, onChange: R, decorative: w, ...W }) => {
|
|
29
|
-
const c = !!I, s = !g && !c && !h && !a, u = b(null), m = b(null);
|
|
21
|
+
fill: "currentColor",
|
|
22
|
+
children: [/* @__PURE__ */ t("title", { children: "Check icon" }), /* @__PURE__ */ t("path", { d: "M6 12.4L2 8.4L3.4 7L6 9.6L12.6 3L14 4.4L6 12.4Z" })]
|
|
23
|
+
}), _ = ({ dataTest: o, size: m = "medium", disabled: d, readOnly: a, indeterminate: r = !1, checked: h, disableRipple: g, hideWrapper: L, className: N, onChange: R, decorative: w, ...I }) => {
|
|
24
|
+
const c = !!L, s = !g && !c && !d && !a, p = b(null), u = b(null);
|
|
30
25
|
v(() => {
|
|
31
|
-
|
|
32
|
-
}, [
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
26
|
+
p.current && (p.current.indeterminate = r);
|
|
27
|
+
}, [r]);
|
|
28
|
+
const C = x(e.CheckboxWrapper, !c && e[`size-${m}`], c && e.HideWrapper, r && e.Indeterminate, a && e.ReadOnly, s && e.CheckboxHover, N), W = x(e.Checkbox, e[`size-${m}`], r && e.Indeterminate), E = r ? $ : j, H = F.useCallback((n) => {
|
|
29
|
+
if (n.stopPropagation(), !s) return;
|
|
35
30
|
const i = document.createElement("span");
|
|
36
|
-
i.className = e.CheckboxRipple ?? "", i.addEventListener("animationend", () => i.remove(), { once: !0 }),
|
|
31
|
+
i.className = e.CheckboxRipple ?? "", i.addEventListener("animationend", () => i.remove(), { once: !0 }), u.current?.appendChild(i);
|
|
37
32
|
}, [s]);
|
|
38
33
|
v(() => {
|
|
39
|
-
const
|
|
40
|
-
return () =>
|
|
34
|
+
const n = u.current;
|
|
35
|
+
return () => n?.replaceChildren();
|
|
41
36
|
}, []);
|
|
42
|
-
const
|
|
43
|
-
a || R?.(
|
|
44
|
-
},
|
|
45
|
-
"data-checked":
|
|
46
|
-
"data-unchecked": !
|
|
47
|
-
"data-indeterminate":
|
|
48
|
-
"data-disabled":
|
|
49
|
-
},
|
|
50
|
-
ref:
|
|
37
|
+
const y = (n) => {
|
|
38
|
+
a || R?.(n, n.target.checked);
|
|
39
|
+
}, f = {
|
|
40
|
+
"data-checked": h && !r ? "" : void 0,
|
|
41
|
+
"data-unchecked": !h && !r ? "" : void 0,
|
|
42
|
+
"data-indeterminate": r ? "" : void 0,
|
|
43
|
+
"data-disabled": d ? "" : void 0
|
|
44
|
+
}, k = /* @__PURE__ */ l(P, { children: [!c && s && /* @__PURE__ */ t("span", {
|
|
45
|
+
ref: u,
|
|
51
46
|
className: e.CheckboxRippleContainer
|
|
52
47
|
}), /* @__PURE__ */ t("span", {
|
|
53
|
-
className:
|
|
48
|
+
className: W,
|
|
54
49
|
children: /* @__PURE__ */ t("span", {
|
|
55
50
|
className: e.Indicator,
|
|
56
|
-
children: /* @__PURE__ */ t(E, {
|
|
51
|
+
children: /* @__PURE__ */ t(E, {})
|
|
57
52
|
})
|
|
58
53
|
})] });
|
|
59
54
|
return w ? /* @__PURE__ */ t("span", {
|
|
60
55
|
"aria-hidden": "true",
|
|
61
|
-
className:
|
|
62
|
-
"data-test":
|
|
63
|
-
...
|
|
64
|
-
children:
|
|
56
|
+
className: C,
|
|
57
|
+
"data-test": o,
|
|
58
|
+
...f,
|
|
59
|
+
children: k
|
|
65
60
|
}) : /* @__PURE__ */ l("label", {
|
|
66
|
-
className:
|
|
67
|
-
"data-test":
|
|
61
|
+
className: C,
|
|
62
|
+
"data-test": o,
|
|
68
63
|
onPointerDown: H,
|
|
69
|
-
...
|
|
64
|
+
...f,
|
|
70
65
|
children: [/* @__PURE__ */ t("input", {
|
|
71
|
-
ref:
|
|
66
|
+
ref: p,
|
|
72
67
|
type: "checkbox",
|
|
73
68
|
className: "sr-only",
|
|
74
|
-
checked:
|
|
75
|
-
disabled:
|
|
69
|
+
checked: h,
|
|
70
|
+
disabled: d,
|
|
76
71
|
readOnly: a,
|
|
77
|
-
onChange:
|
|
78
|
-
...
|
|
79
|
-
}),
|
|
72
|
+
onChange: y,
|
|
73
|
+
...I
|
|
74
|
+
}), k]
|
|
80
75
|
});
|
|
81
76
|
};
|
|
82
77
|
export {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var e = "
|
|
1
|
+
var e = "_CheckboxWrapper_k9tu2_1", _ = "_Checkbox_k9tu2_1", r = "_Indeterminate_k9tu2_29", a = "_ReadOnly_k9tu2_56", t = "_Indicator_k9tu2_65", k = "_HideWrapper_k9tu2_69", p = "_CheckboxHover_k9tu2_76", i = "_CheckboxRippleContainer_k9tu2_76", o = "_CheckboxRipple_k9tu2_76", u = "_ripple_k9tu2_1", l = {
|
|
2
2
|
CheckboxWrapper: e,
|
|
3
|
-
"size-small": "_size-
|
|
4
|
-
"size-medium": "_size-
|
|
3
|
+
"size-small": "_size-small_k9tu2_12",
|
|
4
|
+
"size-medium": "_size-medium_k9tu2_16",
|
|
5
5
|
Checkbox: _,
|
|
6
|
-
Indeterminate:
|
|
7
|
-
ReadOnly:
|
|
8
|
-
Indicator:
|
|
9
|
-
HideWrapper:
|
|
10
|
-
CheckboxHover:
|
|
11
|
-
CheckboxRippleContainer:
|
|
12
|
-
CheckboxRipple:
|
|
13
|
-
ripple:
|
|
6
|
+
Indeterminate: r,
|
|
7
|
+
ReadOnly: a,
|
|
8
|
+
Indicator: t,
|
|
9
|
+
HideWrapper: k,
|
|
10
|
+
CheckboxHover: p,
|
|
11
|
+
CheckboxRippleContainer: i,
|
|
12
|
+
CheckboxRipple: o,
|
|
13
|
+
ripple: u
|
|
14
14
|
};
|
|
15
15
|
export {
|
|
16
|
-
|
|
16
|
+
l as default
|
|
17
17
|
};
|