asma-ui-core 3.78.12 → 3.79.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 +41 -41
- package/dist/components/inputs/button/StyledButton.module.js +8 -8
- package/dist/components/inputs/checkbox/base-ui/StyledCheckbox.js +45 -42
- package/dist/components/inputs/checkbox/base-ui/StyledCheckbox.module.js +8 -8
- package/dist/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.js +25 -17
- package/dist/components/inputs/field-styles.js +3 -3
- package/dist/components/inputs/radio-button/base-ui/StyledRadio.js +34 -31
- package/dist/components/inputs/radio-button/base-ui/StyledRadio.module.js +10 -10
- package/dist/components/inputs/select/StyledSelect.js +147 -135
- package/dist/components/inputs/select/StyledSelectItem.js +29 -19
- package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +195 -162
- package/dist/components/inputs/switch/base-ui/StyledSwitch.module.js +4 -4
- package/dist/components/inputs/textarea/StyledTextarea.module.js +4 -4
- package/dist/components/navigation/link/StyledLink.js +11 -10
- package/dist/components/navigation/link/StyledLink.module.js +5 -5
- package/dist/components/navigation/menu/StyledMenuList.js +27 -19
- package/dist/components/navigation/tabs/StyledTab.js +7 -7
- package/dist/components/utils/accordion/base-ui/StyledAccordion.module.js +3 -3
- package/dist/datetime/shared-components/button/StyledButton.module.js +12 -12
- package/dist/src/components/inputs/select/StyledSelectItem.d.ts +3 -1
- package/dist/src/components/navigation/menu/StyledMenuList.d.ts +3 -1
- package/dist/src/table/components/TableRow.d.ts +2 -1
- package/dist/src/table/custom-features/focus-rows/types.d.ts +2 -2
- package/dist/src/table/hooks/useToggleMenuVisibility.hook.d.ts +14 -1
- package/dist/table/components/StyledTable.module.js +52 -52
- package/dist/table/components/TableRow.js +92 -80
- package/dist/table/components/TableRows.js +10 -8
- package/dist/table/components/table-footer/TablePagination.js +77 -64
- package/dist/table/components/table-footer/TableRowCountSelect.js +63 -44
- package/dist/table/components/table-header/TableHeader.js +72 -64
- package/dist/table/custom-features/focus-rows/FocusRowsFeature.js +4 -4
- package/dist/table/hooks/useToggleMenuVisibility.hook.js +77 -11
- package/dist/table/shared-components/button/StyledButton.module.js +9 -9
- package/dist/tailwind.config.d.ts +1 -0
- package/package.json +1 -1
- package/src/styles/_focus.scss +23 -0
- package/src/styles/color-variables/defaultTokens.css +2 -4
- package/src/styles/color-variables/fretexTokens.css +6 -7
- package/src/styles/color-variables/jadeTokens.css +2 -4
- package/src/styles/components-colors/inputVariables.css +2 -2
- package/tw-configs/twConfigs.json +1 -0
- package/dist/table/shared-components/CheckIcon.js +0 -12
- package/dist/table/shared-components/menu-item/index.js +0 -22
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { ChevronRightIcon as
|
|
2
|
-
import { ChevronLeftIcon as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { useCallback as
|
|
12
|
-
import { Fragment as
|
|
13
|
-
function
|
|
14
|
-
const
|
|
1
|
+
import { ChevronRightIcon as N } from "../../../components/icons/chevron-right-icon/ChevronRightIcon.js";
|
|
2
|
+
import { ChevronLeftIcon as O } from "../../../components/icons/chevron-left-icon/ChevronLeftIcon.js";
|
|
3
|
+
import { StyledSelectItem as k } from "../../../components/inputs/select/StyledSelectItem.js";
|
|
4
|
+
import { StyledPopover as z } from "../../../components/utils/popover/StyledPopover.js";
|
|
5
|
+
import { StyledMenuList as D } from "../../../components/navigation/menu/StyledMenuList.js";
|
|
6
|
+
import m from "../StyledTable.module.js";
|
|
7
|
+
import { StyledTooltip as p } from "../../shared-components/tooltip/index.js";
|
|
8
|
+
import { ChevronDownIcon as L } from "../../shared-components/ChevronDownIcon.js";
|
|
9
|
+
import { useKeyboardSelectMenu as R } from "../../hooks/useToggleMenuVisibility.hook.js";
|
|
10
|
+
import { StyledButton as u } from "../../shared-components/button/StyledButton.js";
|
|
11
|
+
import { useCallback as I, useId as F, useMemo as S, useRef as K } from "react";
|
|
12
|
+
import { Fragment as M, jsx as e, jsxs as f } from "react/jsx-runtime";
|
|
13
|
+
function U({ table: o, locale: y }) {
|
|
14
|
+
const v = K(null), n = y === "no", a = F(), P = S(() => ({
|
|
15
15
|
anchorOrigin: {
|
|
16
16
|
vertical: -5,
|
|
17
17
|
horizontal: "center"
|
|
@@ -20,102 +20,115 @@ function V({ table: o, locale: C }) {
|
|
|
20
20
|
vertical: "bottom",
|
|
21
21
|
horizontal: "center"
|
|
22
22
|
}
|
|
23
|
-
}), []),
|
|
24
|
-
const t =
|
|
23
|
+
}), []), l = I(() => {
|
|
24
|
+
const t = m["asma-ui-table-styled-table"], r = v.current?.closest(`.${t}`)?.querySelector(`.${m["table-scroll"]}, .${m["table-wrapper"]}`);
|
|
25
25
|
r && r.scrollTo({
|
|
26
26
|
top: 0,
|
|
27
27
|
behavior: "smooth"
|
|
28
28
|
});
|
|
29
|
-
}, []),
|
|
30
|
-
o.setPageIndex(t - 1),
|
|
31
|
-
}, [
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return /* @__PURE__ */
|
|
37
|
-
/* @__PURE__ */ e(
|
|
29
|
+
}, []), s = o.getPageCount() || 1, i = o.getState().pagination.pageIndex + 1, c = S(() => Array.from({ length: s }, (t, r) => r + 1), [s]), b = I((t) => {
|
|
30
|
+
o.setPageIndex(t - 1), l();
|
|
31
|
+
}, [o, l]), { anchorEl: g, open: d, handleClose: x, handleOpen: T, triggerRef: w, activeIndex: h, handleKeyDown: $ } = R({
|
|
32
|
+
optionCount: c.length,
|
|
33
|
+
selectedIndex: i - 1,
|
|
34
|
+
onSelect: (t) => b(c[t])
|
|
35
|
+
});
|
|
36
|
+
return /* @__PURE__ */ f(M, { children: [
|
|
37
|
+
/* @__PURE__ */ e(p, {
|
|
38
38
|
title: n ? "Nåværende side" : "Current Page",
|
|
39
39
|
children: /* @__PURE__ */ e("div", {
|
|
40
|
-
ref:
|
|
41
|
-
children: /* @__PURE__ */
|
|
40
|
+
ref: v,
|
|
41
|
+
children: /* @__PURE__ */ f(u, {
|
|
42
42
|
dataTest: "current-page-button",
|
|
43
43
|
variant: "outlined",
|
|
44
44
|
size: "large",
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
refLink: w,
|
|
46
|
+
onClick: T,
|
|
47
|
+
onKeyDown: $,
|
|
48
|
+
role: "combobox",
|
|
49
|
+
"aria-haspopup": "listbox",
|
|
50
|
+
"aria-controls": d ? a : void 0,
|
|
51
|
+
"aria-expanded": d,
|
|
52
|
+
"aria-activedescendant": h === null ? void 0 : `${a}-option-${h}`,
|
|
53
|
+
endIcon: /* @__PURE__ */ e(L, {
|
|
54
|
+
className: `${d ? "rotate-180" : "rotate-0"} transition-transform duration-300`,
|
|
48
55
|
height: 24,
|
|
49
56
|
width: 24
|
|
50
57
|
}),
|
|
51
58
|
children: [
|
|
52
59
|
n ? "Side" : "Page",
|
|
53
60
|
" ",
|
|
54
|
-
|
|
61
|
+
i,
|
|
55
62
|
" ",
|
|
56
63
|
n ? "av" : "of",
|
|
57
64
|
" ",
|
|
58
|
-
|
|
65
|
+
s
|
|
59
66
|
]
|
|
60
67
|
})
|
|
61
68
|
})
|
|
62
69
|
}),
|
|
63
|
-
/* @__PURE__ */ e(
|
|
64
|
-
open:
|
|
65
|
-
anchorEl:
|
|
70
|
+
/* @__PURE__ */ e(z, {
|
|
71
|
+
open: d,
|
|
72
|
+
anchorEl: g,
|
|
66
73
|
slotProps: { paper: {
|
|
67
74
|
className: "border border-solid border-delta-200",
|
|
68
75
|
sx: {
|
|
69
|
-
width:
|
|
76
|
+
width: g ? g.clientWidth : void 0,
|
|
70
77
|
maxHeight: 288,
|
|
71
78
|
overflowY: "auto"
|
|
72
79
|
}
|
|
73
80
|
} },
|
|
74
|
-
onClose:
|
|
75
|
-
anchorOrigin:
|
|
76
|
-
transformOrigin:
|
|
77
|
-
children: /* @__PURE__ */ e(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
81
|
+
onClose: x,
|
|
82
|
+
anchorOrigin: P.anchorOrigin,
|
|
83
|
+
transformOrigin: P.transformOrigin,
|
|
84
|
+
children: /* @__PURE__ */ e(D, {
|
|
85
|
+
id: a,
|
|
86
|
+
role: "listbox",
|
|
87
|
+
children: c.map((t, r) => /* @__PURE__ */ e(k, {
|
|
88
|
+
id: `${a}-option-${r}`,
|
|
89
|
+
active: r === h,
|
|
90
|
+
onClick: (C) => {
|
|
91
|
+
C.stopPropagation(), C.preventDefault(), b(t), x();
|
|
92
|
+
},
|
|
93
|
+
selected: t === i,
|
|
94
|
+
children: /* @__PURE__ */ f("span", {
|
|
95
|
+
className: "text-base font-normal text-delta-700",
|
|
96
|
+
children: [
|
|
97
|
+
n ? "Side" : "Page",
|
|
98
|
+
" ",
|
|
99
|
+
t
|
|
100
|
+
]
|
|
101
|
+
})
|
|
102
|
+
}, t))
|
|
103
|
+
})
|
|
91
104
|
}),
|
|
92
|
-
/* @__PURE__ */ e(
|
|
93
|
-
title:
|
|
94
|
-
children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
105
|
+
/* @__PURE__ */ e(p, {
|
|
106
|
+
title: i === 1 ? "" : n ? "Forrige side" : "Previous Page",
|
|
107
|
+
children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(u, {
|
|
95
108
|
dataTest: "prev-page-button",
|
|
96
109
|
variant: "outlined",
|
|
97
110
|
onClick: () => {
|
|
98
|
-
o.previousPage(),
|
|
111
|
+
o.previousPage(), l();
|
|
99
112
|
},
|
|
100
113
|
size: "large",
|
|
101
114
|
disabled: !o.getCanPreviousPage(),
|
|
102
|
-
startIcon: /* @__PURE__ */ e(
|
|
115
|
+
startIcon: /* @__PURE__ */ e(O, {
|
|
103
116
|
height: 24,
|
|
104
117
|
width: 24
|
|
105
118
|
})
|
|
106
119
|
}) })
|
|
107
120
|
}),
|
|
108
|
-
/* @__PURE__ */ e(
|
|
109
|
-
title:
|
|
110
|
-
children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
121
|
+
/* @__PURE__ */ e(p, {
|
|
122
|
+
title: i === s ? "" : n ? "Neste side" : "Next Page",
|
|
123
|
+
children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(u, {
|
|
111
124
|
dataTest: "next-page-button",
|
|
112
125
|
variant: "outlined",
|
|
113
126
|
onClick: () => {
|
|
114
|
-
o.nextPage(),
|
|
127
|
+
o.nextPage(), l();
|
|
115
128
|
},
|
|
116
129
|
size: "large",
|
|
117
130
|
disabled: !o.getCanNextPage(),
|
|
118
|
-
startIcon: /* @__PURE__ */ e(
|
|
131
|
+
startIcon: /* @__PURE__ */ e(N, {
|
|
119
132
|
height: 24,
|
|
120
133
|
width: 24
|
|
121
134
|
})
|
|
@@ -124,5 +137,5 @@ function V({ table: o, locale: C }) {
|
|
|
124
137
|
] });
|
|
125
138
|
}
|
|
126
139
|
export {
|
|
127
|
-
|
|
140
|
+
U as TablePagination
|
|
128
141
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { useCallback as
|
|
8
|
-
import { Fragment as
|
|
9
|
-
var
|
|
1
|
+
import { StyledSelectItem as O } from "../../../components/inputs/select/StyledSelectItem.js";
|
|
2
|
+
import { StyledPopover as C } from "../../../components/utils/popover/StyledPopover.js";
|
|
3
|
+
import { StyledMenuList as y } from "../../../components/navigation/menu/StyledMenuList.js";
|
|
4
|
+
import { ChevronDownIcon as $ } from "../../shared-components/ChevronDownIcon.js";
|
|
5
|
+
import { useKeyboardSelectMenu as I } from "../../hooks/useToggleMenuVisibility.hook.js";
|
|
6
|
+
import { StyledButton as k } from "../../shared-components/button/StyledButton.js";
|
|
7
|
+
import { useCallback as D, useId as N, useMemo as g } from "react";
|
|
8
|
+
import { Fragment as P, jsx as s, jsxs as m } from "react/jsx-runtime";
|
|
9
|
+
var R = [
|
|
10
10
|
5,
|
|
11
11
|
10,
|
|
12
12
|
20,
|
|
13
13
|
50,
|
|
14
14
|
100
|
|
15
15
|
];
|
|
16
|
-
function
|
|
17
|
-
const
|
|
16
|
+
function A({ table: l, locale: w }) {
|
|
17
|
+
const e = l.getState().pagination.pageSize, c = w === "no", t = N(), h = g(() => ({
|
|
18
18
|
anchorOrigin: {
|
|
19
19
|
vertical: -5,
|
|
20
20
|
horizontal: "center"
|
|
@@ -23,57 +23,76 @@ function D({ table: n, locale: p }) {
|
|
|
23
23
|
vertical: "bottom",
|
|
24
24
|
horizontal: "center"
|
|
25
25
|
}
|
|
26
|
-
}), []),
|
|
27
|
-
const o = /* @__PURE__ */ new Set([...
|
|
28
|
-
return Array.from(o).sort((
|
|
29
|
-
}, [
|
|
30
|
-
|
|
31
|
-
}, [
|
|
32
|
-
|
|
26
|
+
}), []), r = g(() => {
|
|
27
|
+
const o = /* @__PURE__ */ new Set([...R, e]);
|
|
28
|
+
return Array.from(o).sort((a, i) => a - i);
|
|
29
|
+
}, [e]), u = D((o) => {
|
|
30
|
+
l.setPageSize(o);
|
|
31
|
+
}, [l]), b = r.indexOf(e), { anchorEl: d, open: n, handleClose: f, handleOpen: v, triggerRef: S, activeIndex: p, handleKeyDown: x } = I({
|
|
32
|
+
optionCount: r.length,
|
|
33
|
+
selectedIndex: b,
|
|
34
|
+
onSelect: (o) => u(r[o]),
|
|
35
|
+
focusHeaderOnShiftTab: !0
|
|
36
|
+
});
|
|
37
|
+
return /* @__PURE__ */ m(P, { children: [/* @__PURE__ */ m(k, {
|
|
33
38
|
dataTest: "table-rows-count-button",
|
|
34
39
|
variant: "outlined",
|
|
35
40
|
size: "large",
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
refLink: S,
|
|
42
|
+
onClick: v,
|
|
43
|
+
onKeyDown: x,
|
|
44
|
+
role: "combobox",
|
|
45
|
+
"aria-haspopup": "listbox",
|
|
46
|
+
"aria-controls": n ? t : void 0,
|
|
47
|
+
"aria-expanded": n,
|
|
48
|
+
"aria-activedescendant": p === null ? void 0 : `${t}-option-${p}`,
|
|
49
|
+
"aria-label": `${e} ${c ? "rader" : "rows"}`,
|
|
50
|
+
endIcon: /* @__PURE__ */ s($, {
|
|
51
|
+
className: `${n ? "rotate-180" : "rotate-0"} transition-transform duration-300`,
|
|
39
52
|
height: 24,
|
|
40
53
|
width: 24
|
|
41
54
|
}),
|
|
42
55
|
children: [
|
|
43
|
-
|
|
56
|
+
e,
|
|
44
57
|
" ",
|
|
45
58
|
c ? "rader" : "rows"
|
|
46
59
|
]
|
|
47
|
-
}), /* @__PURE__ */
|
|
48
|
-
open:
|
|
49
|
-
anchorEl:
|
|
60
|
+
}), /* @__PURE__ */ s(C, {
|
|
61
|
+
open: n,
|
|
62
|
+
anchorEl: d,
|
|
50
63
|
slotProps: { paper: {
|
|
51
64
|
className: "border border-solid border-delta-200",
|
|
52
65
|
sx: {
|
|
53
|
-
width:
|
|
66
|
+
width: d ? d.clientWidth : void 0,
|
|
54
67
|
maxHeight: 288,
|
|
55
68
|
overflowY: "auto"
|
|
56
69
|
}
|
|
57
70
|
} },
|
|
58
|
-
onClose:
|
|
59
|
-
anchorOrigin:
|
|
60
|
-
transformOrigin:
|
|
61
|
-
children: /* @__PURE__ */
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
onClose: f,
|
|
72
|
+
anchorOrigin: h.anchorOrigin,
|
|
73
|
+
transformOrigin: h.transformOrigin,
|
|
74
|
+
children: /* @__PURE__ */ s(y, {
|
|
75
|
+
id: t,
|
|
76
|
+
role: "listbox",
|
|
77
|
+
children: r.map((o, a) => /* @__PURE__ */ s(O, {
|
|
78
|
+
id: `${t}-option-${a}`,
|
|
79
|
+
active: a === p,
|
|
80
|
+
onClick: (i) => {
|
|
81
|
+
i.stopPropagation(), i.preventDefault(), u(o), f();
|
|
82
|
+
},
|
|
83
|
+
selected: e === o,
|
|
84
|
+
children: /* @__PURE__ */ m("span", {
|
|
85
|
+
className: "whitespace-nowrap text-base font-normal text-delta-700",
|
|
86
|
+
children: [
|
|
87
|
+
o,
|
|
88
|
+
" ",
|
|
89
|
+
c ? "rader" : "rows"
|
|
90
|
+
]
|
|
91
|
+
})
|
|
92
|
+
}, o))
|
|
93
|
+
})
|
|
75
94
|
})] });
|
|
76
95
|
}
|
|
77
96
|
export {
|
|
78
|
-
|
|
97
|
+
A as TableRowCountSelect
|
|
79
98
|
};
|
|
@@ -1,78 +1,86 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { ACTIONS_COLUMN_ID as
|
|
3
|
-
import
|
|
4
|
-
import { TableHeaderCell as
|
|
1
|
+
import { cn as C } from "../../../helpers/cn.js";
|
|
2
|
+
import { ACTIONS_COLUMN_ID as I } from "../../types.js";
|
|
3
|
+
import x from "../StyledTable.module.js";
|
|
4
|
+
import { TableHeaderCell as u } from "./TableHeaderCell.js";
|
|
5
5
|
import "react";
|
|
6
|
-
import { jsx as n, jsxs as
|
|
6
|
+
import { jsx as n, jsxs as O } from "react/jsx-runtime";
|
|
7
7
|
import "@tanstack/react-table";
|
|
8
|
-
function
|
|
9
|
-
const { stickyHeader: S = !1, tableHeaderRef:
|
|
8
|
+
function M({ table: p, styledTableProps: o, tableCanResize: s, tableWidth: l, columnWindow: { paddingLeft: i, paddingRight: c, indexes: H } }) {
|
|
9
|
+
const { stickyHeader: S = !1, tableHeaderRef: y, tableHeaderStyle: g = {} } = o, D = p.getHeaderGroups(), b = { ...g };
|
|
10
10
|
return /* @__PURE__ */ n("thead", {
|
|
11
|
-
className:
|
|
12
|
-
style:
|
|
13
|
-
ref:
|
|
14
|
-
children:
|
|
15
|
-
const
|
|
11
|
+
className: C(x["table-header"], S && x["table-header--sticky"], o.tableHeaderClassName),
|
|
12
|
+
style: b,
|
|
13
|
+
ref: y,
|
|
14
|
+
children: D.map((f) => {
|
|
15
|
+
const m = f.headers.map((e, t, r) => ({
|
|
16
16
|
header: e,
|
|
17
|
-
left: r.slice(0, t).reduce((d,
|
|
18
|
-
})),
|
|
17
|
+
left: r.slice(0, t).reduce((d, a) => d + (a.column.getSize() ?? 0), 0)
|
|
18
|
+
})), w = m.filter(({ header: e }) => e.column.columnDef.fixedLeft), N = m.filter(({ header: e }) => !e.column.columnDef.fixedLeft && !e.column.columnDef.fixedRight && e.column.id !== "actions"), h = m.filter(({ header: e }) => !!e.column.columnDef.fixedRight || e.column.id === "actions"), W = h.some(({ header: e }) => e.column.id === I), _ = h.map((e, t, r) => ({
|
|
19
19
|
...e,
|
|
20
|
-
right: r.slice(t + 1).reduce((d,
|
|
21
|
-
})),
|
|
22
|
-
const r =
|
|
20
|
+
right: r.slice(t + 1).reduce((d, a) => d + (a.header.column.getSize() ?? 0), 0) + (W ? -1 : 0)
|
|
21
|
+
})), k = H.reduce((e, t) => {
|
|
22
|
+
const r = N[t];
|
|
23
23
|
return r && e.push(r), e;
|
|
24
24
|
}, []);
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"aria-hidden": !0,
|
|
35
|
-
style: {
|
|
36
|
-
width: String(i) + "px",
|
|
37
|
-
minWidth: String(i) + "px",
|
|
38
|
-
maxWidth: String(i) + "px",
|
|
39
|
-
padding: 0,
|
|
40
|
-
border: "none"
|
|
41
|
-
}
|
|
42
|
-
}),
|
|
43
|
-
O.map((e) => {
|
|
44
|
-
if (!e) return null;
|
|
45
|
-
const { header: t, left: r } = e;
|
|
46
|
-
return /* @__PURE__ */ n(a, {
|
|
25
|
+
return /* @__PURE__ */ O("tr", {
|
|
26
|
+
tabIndex: 0,
|
|
27
|
+
onKeyDown: (e) => {
|
|
28
|
+
if (e.key !== "Tab" || e.shiftKey) return;
|
|
29
|
+
const t = e.currentTarget.closest("table")?.querySelector('tbody tr[data-index="0"]');
|
|
30
|
+
t && (e.preventDefault(), t.focus());
|
|
31
|
+
},
|
|
32
|
+
children: [
|
|
33
|
+
w.map(({ header: e, left: t }) => /* @__PURE__ */ n(u, {
|
|
47
34
|
styledTableProps: o,
|
|
48
|
-
header:
|
|
49
|
-
tableCanResize:
|
|
50
|
-
left:
|
|
35
|
+
header: e,
|
|
36
|
+
tableCanResize: s,
|
|
37
|
+
left: t,
|
|
51
38
|
tableWidth: l
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
39
|
+
}, e.id)),
|
|
40
|
+
i > 0 && /* @__PURE__ */ n("th", {
|
|
41
|
+
"aria-hidden": !0,
|
|
42
|
+
style: {
|
|
43
|
+
width: String(i) + "px",
|
|
44
|
+
minWidth: String(i) + "px",
|
|
45
|
+
maxWidth: String(i) + "px",
|
|
46
|
+
padding: 0,
|
|
47
|
+
border: "none"
|
|
48
|
+
}
|
|
49
|
+
}),
|
|
50
|
+
k.map((e) => {
|
|
51
|
+
if (!e) return null;
|
|
52
|
+
const { header: t, left: r } = e;
|
|
53
|
+
return /* @__PURE__ */ n(u, {
|
|
54
|
+
styledTableProps: o,
|
|
55
|
+
header: t,
|
|
56
|
+
tableCanResize: s,
|
|
57
|
+
left: r,
|
|
58
|
+
tableWidth: l
|
|
59
|
+
}, t.id);
|
|
60
|
+
}),
|
|
61
|
+
c > 0 && /* @__PURE__ */ n("th", {
|
|
62
|
+
"aria-hidden": !0,
|
|
63
|
+
style: {
|
|
64
|
+
width: String(c) + "px",
|
|
65
|
+
minWidth: String(c) + "px",
|
|
66
|
+
maxWidth: String(c) + "px",
|
|
67
|
+
padding: 0,
|
|
68
|
+
border: "none"
|
|
69
|
+
}
|
|
70
|
+
}),
|
|
71
|
+
_.map(({ header: e, left: t, right: r }) => /* @__PURE__ */ n(u, {
|
|
72
|
+
styledTableProps: o,
|
|
73
|
+
header: e,
|
|
74
|
+
tableCanResize: s,
|
|
75
|
+
left: t,
|
|
76
|
+
right: r,
|
|
77
|
+
tableWidth: l
|
|
78
|
+
}, e.id))
|
|
79
|
+
]
|
|
80
|
+
}, f.id);
|
|
73
81
|
})
|
|
74
82
|
});
|
|
75
83
|
}
|
|
76
84
|
export {
|
|
77
|
-
|
|
85
|
+
M as TableHeader
|
|
78
86
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { functionalUpdate as u, makeStateUpdater as i } from "@tanstack/react-table";
|
|
2
|
-
var
|
|
2
|
+
var a = {
|
|
3
3
|
getInitialState: (e) => ({
|
|
4
4
|
focusedRow: null,
|
|
5
5
|
...e
|
|
@@ -39,13 +39,13 @@ var f = {
|
|
|
39
39
|
}
|
|
40
40
|
}, e.toggleFocused = () => e.onChangeFocused(!e.isFocused()), e.focusNextRow = () => {
|
|
41
41
|
const o = s.getRowModel().rows, t = o[o.findIndex((n) => n.id === s.getState().focusedRow) + 1];
|
|
42
|
-
t
|
|
42
|
+
return t ? (t.onChangeFocused(!0, t.id), !0) : !1;
|
|
43
43
|
}, e.focusPrevRow = () => {
|
|
44
44
|
const o = s.getRowModel().rows, t = o[o.findIndex((n) => n.id === s.getState().focusedRow) - 1];
|
|
45
|
-
t
|
|
45
|
+
return t ? (t.onChangeFocused(!0, t.id), !0) : !1;
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
export {
|
|
50
|
-
|
|
50
|
+
a as FocusedRowsFeature
|
|
51
51
|
};
|
|
@@ -1,17 +1,83 @@
|
|
|
1
|
-
import { useCallback as
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { useCallback as c, useRef as b, useState as p } from "react";
|
|
2
|
+
var d = (r) => {
|
|
3
|
+
let a = r?.parentElement;
|
|
4
|
+
for (; a; ) {
|
|
5
|
+
const l = a.querySelector('table thead tr[tabindex="0"]');
|
|
6
|
+
if (l)
|
|
7
|
+
return l.focus(), !0;
|
|
8
|
+
a = a.parentElement;
|
|
9
|
+
}
|
|
10
|
+
return !1;
|
|
11
|
+
}, D = () => {
|
|
12
|
+
const [r, a] = p(null), [l, t] = p(!1), n = c((o) => {
|
|
13
|
+
a(o.currentTarget), t(!0);
|
|
5
14
|
}, []);
|
|
6
15
|
return {
|
|
7
|
-
open:
|
|
8
|
-
handleClose:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
open: l,
|
|
17
|
+
handleClose: c(() => t(!1), []),
|
|
18
|
+
handleOpen: n,
|
|
19
|
+
anchorEl: r
|
|
20
|
+
};
|
|
21
|
+
}, m = ({ optionCount: r, selectedIndex: a, onSelect: l, focusHeaderOnShiftTab: t = !1 }) => {
|
|
22
|
+
const { open: n, anchorEl: o, handleOpen: f, handleClose: w } = D(), i = b(null), [u, h] = p(null), s = c(() => {
|
|
23
|
+
w(), h(null);
|
|
24
|
+
}, [w]), k = c((e) => {
|
|
25
|
+
r !== 0 && h((y) => Math.min(Math.max((y ?? a) + e, 0), r - 1));
|
|
26
|
+
}, [r, a]);
|
|
27
|
+
return {
|
|
28
|
+
open: n,
|
|
29
|
+
handleClose: s,
|
|
30
|
+
handleOpen: f,
|
|
31
|
+
anchorEl: o,
|
|
32
|
+
triggerRef: i,
|
|
33
|
+
activeIndex: u,
|
|
34
|
+
handleKeyDown: c((e) => {
|
|
35
|
+
if (t && e.key === "Tab" && e.shiftKey && d(i.current)) {
|
|
36
|
+
e.preventDefault(), s();
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (!n && [
|
|
40
|
+
"Enter",
|
|
41
|
+
"ArrowDown",
|
|
42
|
+
"ArrowUp"
|
|
43
|
+
].includes(e.key)) {
|
|
44
|
+
e.preventDefault(), f(e), e.key !== "Enter" && k(e.key === "ArrowDown" ? 1 : -1);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (n)
|
|
48
|
+
switch (e.key) {
|
|
49
|
+
case "ArrowDown":
|
|
50
|
+
case "ArrowUp":
|
|
51
|
+
e.preventDefault(), k(e.key === "ArrowDown" ? 1 : -1);
|
|
52
|
+
break;
|
|
53
|
+
case "Home":
|
|
54
|
+
case "End":
|
|
55
|
+
e.preventDefault(), h(e.key === "Home" ? 0 : r ? r - 1 : null);
|
|
56
|
+
break;
|
|
57
|
+
case " ":
|
|
58
|
+
case "Enter":
|
|
59
|
+
if (u === null) break;
|
|
60
|
+
e.preventDefault(), l(u), e.key === "Enter" && s();
|
|
61
|
+
break;
|
|
62
|
+
case "Escape":
|
|
63
|
+
e.preventDefault(), s(), i.current?.focus();
|
|
64
|
+
break;
|
|
65
|
+
case "Tab":
|
|
66
|
+
s();
|
|
67
|
+
}
|
|
68
|
+
}, [
|
|
69
|
+
u,
|
|
70
|
+
t,
|
|
71
|
+
s,
|
|
72
|
+
f,
|
|
73
|
+
k,
|
|
74
|
+
l,
|
|
75
|
+
n,
|
|
76
|
+
r
|
|
77
|
+
])
|
|
13
78
|
};
|
|
14
79
|
};
|
|
15
80
|
export {
|
|
16
|
-
|
|
81
|
+
m as useKeyboardSelectMenu,
|
|
82
|
+
D as useToggleMenuVisibility
|
|
17
83
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var _ = "
|
|
2
|
-
"asma-core-ui-button": "_asma-core-ui-
|
|
1
|
+
var _ = "_contained_1ysgm_6", t = "_common_1ysgm_6", a = "_medium_1ysgm_56", e = "_small_1ysgm_61", m = "_large_1ysgm_66", r = "_error_1ysgm_76", o = "_outlined_1ysgm_146", s = "_text_1ysgm_286", y = "_textGray_1ysgm_426", g = "_textWhite_1ysgm_496", l = {
|
|
2
|
+
"asma-core-ui-button": "_asma-core-ui-button_1ysgm_1",
|
|
3
3
|
contained: _,
|
|
4
4
|
common: t,
|
|
5
5
|
medium: a,
|
|
6
6
|
small: e,
|
|
7
|
-
large:
|
|
8
|
-
error:
|
|
9
|
-
outlined:
|
|
10
|
-
text:
|
|
11
|
-
textGray:
|
|
12
|
-
textWhite:
|
|
7
|
+
large: m,
|
|
8
|
+
error: r,
|
|
9
|
+
outlined: o,
|
|
10
|
+
text: s,
|
|
11
|
+
textGray: y,
|
|
12
|
+
textWhite: g
|
|
13
13
|
};
|
|
14
14
|
export {
|
|
15
|
-
|
|
15
|
+
l as default
|
|
16
16
|
};
|