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.
Files changed (44) hide show
  1. package/dist/asma-ui-core.css +1 -1
  2. package/dist/components/data-display/chip/StyledChip.js +41 -41
  3. package/dist/components/inputs/button/StyledButton.module.js +8 -8
  4. package/dist/components/inputs/checkbox/base-ui/StyledCheckbox.js +45 -42
  5. package/dist/components/inputs/checkbox/base-ui/StyledCheckbox.module.js +8 -8
  6. package/dist/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.js +25 -17
  7. package/dist/components/inputs/field-styles.js +3 -3
  8. package/dist/components/inputs/radio-button/base-ui/StyledRadio.js +34 -31
  9. package/dist/components/inputs/radio-button/base-ui/StyledRadio.module.js +10 -10
  10. package/dist/components/inputs/select/StyledSelect.js +147 -135
  11. package/dist/components/inputs/select/StyledSelectItem.js +29 -19
  12. package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +195 -162
  13. package/dist/components/inputs/switch/base-ui/StyledSwitch.module.js +4 -4
  14. package/dist/components/inputs/textarea/StyledTextarea.module.js +4 -4
  15. package/dist/components/navigation/link/StyledLink.js +11 -10
  16. package/dist/components/navigation/link/StyledLink.module.js +5 -5
  17. package/dist/components/navigation/menu/StyledMenuList.js +27 -19
  18. package/dist/components/navigation/tabs/StyledTab.js +7 -7
  19. package/dist/components/utils/accordion/base-ui/StyledAccordion.module.js +3 -3
  20. package/dist/datetime/shared-components/button/StyledButton.module.js +12 -12
  21. package/dist/src/components/inputs/select/StyledSelectItem.d.ts +3 -1
  22. package/dist/src/components/navigation/menu/StyledMenuList.d.ts +3 -1
  23. package/dist/src/table/components/TableRow.d.ts +2 -1
  24. package/dist/src/table/custom-features/focus-rows/types.d.ts +2 -2
  25. package/dist/src/table/hooks/useToggleMenuVisibility.hook.d.ts +14 -1
  26. package/dist/table/components/StyledTable.module.js +52 -52
  27. package/dist/table/components/TableRow.js +92 -80
  28. package/dist/table/components/TableRows.js +10 -8
  29. package/dist/table/components/table-footer/TablePagination.js +77 -64
  30. package/dist/table/components/table-footer/TableRowCountSelect.js +63 -44
  31. package/dist/table/components/table-header/TableHeader.js +72 -64
  32. package/dist/table/custom-features/focus-rows/FocusRowsFeature.js +4 -4
  33. package/dist/table/hooks/useToggleMenuVisibility.hook.js +77 -11
  34. package/dist/table/shared-components/button/StyledButton.module.js +9 -9
  35. package/dist/tailwind.config.d.ts +1 -0
  36. package/package.json +1 -1
  37. package/src/styles/_focus.scss +23 -0
  38. package/src/styles/color-variables/defaultTokens.css +2 -4
  39. package/src/styles/color-variables/fretexTokens.css +6 -7
  40. package/src/styles/color-variables/jadeTokens.css +2 -4
  41. package/src/styles/components-colors/inputVariables.css +2 -2
  42. package/tw-configs/twConfigs.json +1 -0
  43. package/dist/table/shared-components/CheckIcon.js +0 -12
  44. package/dist/table/shared-components/menu-item/index.js +0 -22
@@ -1,17 +1,17 @@
1
- import { ChevronRightIcon as y } from "../../../components/icons/chevron-right-icon/ChevronRightIcon.js";
2
- import { ChevronLeftIcon as S } from "../../../components/icons/chevron-left-icon/ChevronLeftIcon.js";
3
- import { StyledPopover as I } from "../../../components/utils/popover/StyledPopover.js";
4
- import { StyledMenuList as N } from "../../../components/navigation/menu/StyledMenuList.js";
5
- import c from "../StyledTable.module.js";
6
- import { StyledTooltip as g } from "../../shared-components/tooltip/index.js";
7
- import { ChevronDownIcon as O } from "../../shared-components/ChevronDownIcon.js";
8
- import { useToggleMenuVisibility as w } from "../../hooks/useToggleMenuVisibility.hook.js";
9
- import { StyledButton as m } from "../../shared-components/button/StyledButton.js";
10
- import { StyledMenuItem as k } from "../../shared-components/menu-item/index.js";
11
- import { useCallback as v, useMemo as P, useRef as z } from "react";
12
- import { Fragment as $, jsx as e, jsxs as h } from "react/jsx-runtime";
13
- function V({ table: o, locale: C }) {
14
- const { anchorEl: s, open: p, handleClose: d, handleOpen: b } = w(), u = z(null), n = C === "no", f = P(() => ({
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
- }), []), i = v(() => {
24
- const t = c["asma-ui-table-styled-table"], r = u.current?.closest(`.${t}`)?.querySelector(`.${c["table-scroll"]}, .${c["table-wrapper"]}`);
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
- }, []), a = o.getPageCount() || 1, l = o.getState().pagination.pageIndex + 1, x = P(() => Array.from({ length: a }, (t, r) => r + 1), [a]), T = v((t) => {
30
- o.setPageIndex(t - 1), d(), i();
31
- }, [
32
- o,
33
- d,
34
- i
35
- ]);
36
- return /* @__PURE__ */ h($, { children: [
37
- /* @__PURE__ */ e(g, {
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: u,
41
- children: /* @__PURE__ */ h(m, {
40
+ ref: v,
41
+ children: /* @__PURE__ */ f(u, {
42
42
  dataTest: "current-page-button",
43
43
  variant: "outlined",
44
44
  size: "large",
45
- onClick: b,
46
- endIcon: /* @__PURE__ */ e(O, {
47
- className: `${p ? "rotate-180" : "rotate-0"} transition-transform duration-300`,
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
- l,
61
+ i,
55
62
  " ",
56
63
  n ? "av" : "of",
57
64
  " ",
58
- a
65
+ s
59
66
  ]
60
67
  })
61
68
  })
62
69
  }),
63
- /* @__PURE__ */ e(I, {
64
- open: p,
65
- anchorEl: s,
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: s ? s.clientWidth : void 0,
76
+ width: g ? g.clientWidth : void 0,
70
77
  maxHeight: 288,
71
78
  overflowY: "auto"
72
79
  }
73
80
  } },
74
- onClose: d,
75
- anchorOrigin: f.anchorOrigin,
76
- transformOrigin: f.transformOrigin,
77
- children: /* @__PURE__ */ e(N, { children: x.map((t) => /* @__PURE__ */ e(k, {
78
- onClick: (r) => {
79
- r.stopPropagation(), r.preventDefault(), T(t);
80
- },
81
- selected: t === l,
82
- children: /* @__PURE__ */ h("span", {
83
- className: "text-base font-normal text-delta-700",
84
- children: [
85
- n ? "Side" : "Page",
86
- " ",
87
- t
88
- ]
89
- })
90
- }, t)) })
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(g, {
93
- title: l === 1 ? "" : n ? "Forrige side" : "Previous Page",
94
- children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(m, {
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(), i();
111
+ o.previousPage(), l();
99
112
  },
100
113
  size: "large",
101
114
  disabled: !o.getCanPreviousPage(),
102
- startIcon: /* @__PURE__ */ e(S, {
115
+ startIcon: /* @__PURE__ */ e(O, {
103
116
  height: 24,
104
117
  width: 24
105
118
  })
106
119
  }) })
107
120
  }),
108
- /* @__PURE__ */ e(g, {
109
- title: l === a ? "" : n ? "Neste side" : "Next Page",
110
- children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(m, {
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(), i();
127
+ o.nextPage(), l();
115
128
  },
116
129
  size: "large",
117
130
  disabled: !o.getCanNextPage(),
118
- startIcon: /* @__PURE__ */ e(y, {
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
- V as TablePagination
140
+ U as TablePagination
128
141
  };
@@ -1,20 +1,20 @@
1
- import { StyledPopover as w } from "../../../components/utils/popover/StyledPopover.js";
2
- import { StyledMenuList as O } from "../../../components/navigation/menu/StyledMenuList.js";
3
- import { ChevronDownIcon as S } from "../../shared-components/ChevronDownIcon.js";
4
- import { useToggleMenuVisibility as v } from "../../hooks/useToggleMenuVisibility.hook.js";
5
- import { StyledButton as C } from "../../shared-components/button/StyledButton.js";
6
- import { StyledMenuItem as b } from "../../shared-components/menu-item/index.js";
7
- import { useCallback as x, useMemo as d } from "react";
8
- import { Fragment as y, jsx as e, jsxs as s } from "react/jsx-runtime";
9
- var M = [
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 D({ table: n, locale: p }) {
17
- const { anchorEl: i, open: l, handleClose: a, handleOpen: h } = v(), t = n.getState().pagination.pageSize, c = p === "no", m = d(() => ({
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
- }), []), g = d(() => {
27
- const o = /* @__PURE__ */ new Set([...M, t]);
28
- return Array.from(o).sort((r, f) => r - f);
29
- }, [t]), u = x((o) => {
30
- n.setPageSize(o), a();
31
- }, [a, n]);
32
- return /* @__PURE__ */ s(y, { children: [/* @__PURE__ */ s(C, {
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
- onClick: h,
37
- endIcon: /* @__PURE__ */ e(S, {
38
- className: `${l ? "rotate-180" : "rotate-0"} transition-transform duration-300`,
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
- t,
56
+ e,
44
57
  " ",
45
58
  c ? "rader" : "rows"
46
59
  ]
47
- }), /* @__PURE__ */ e(w, {
48
- open: l,
49
- anchorEl: i,
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: i ? i.clientWidth : void 0,
66
+ width: d ? d.clientWidth : void 0,
54
67
  maxHeight: 288,
55
68
  overflowY: "auto"
56
69
  }
57
70
  } },
58
- onClose: a,
59
- anchorOrigin: m.anchorOrigin,
60
- transformOrigin: m.transformOrigin,
61
- children: /* @__PURE__ */ e(O, { children: g.map((o) => /* @__PURE__ */ e(b, {
62
- onClick: (r) => {
63
- r.stopPropagation(), r.preventDefault(), u(o);
64
- },
65
- selected: t === o,
66
- children: /* @__PURE__ */ s("span", {
67
- className: "whitespace-nowrap text-base font-normal text-delta-700",
68
- children: [
69
- o,
70
- " ",
71
- c ? "rader" : "rows"
72
- ]
73
- })
74
- }, o)) })
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
- D as TableRowCountSelect
97
+ A as TableRowCountSelect
79
98
  };
@@ -1,78 +1,86 @@
1
- import { cn as b } from "../../../helpers/cn.js";
2
- import { ACTIONS_COLUMN_ID as j } from "../../types.js";
3
- import p from "../StyledTable.module.js";
4
- import { TableHeaderCell as a } from "./TableHeaderCell.js";
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 k } from "react/jsx-runtime";
6
+ import { jsx as n, jsxs as O } from "react/jsx-runtime";
7
7
  import "@tanstack/react-table";
8
- function q({ table: x, styledTableProps: o, tableCanResize: m, tableWidth: l, columnWindow: { paddingLeft: i, paddingRight: c, indexes: H } }) {
9
- const { stickyHeader: S = !1, tableHeaderRef: g, tableHeaderStyle: D = {} } = o, y = x.getHeaderGroups(), N = { ...D };
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: b(p["table-header"], S && p["table-header--sticky"], o.tableHeaderClassName),
12
- style: N,
13
- ref: g,
14
- children: y.map((f) => {
15
- const s = f.headers.map((e, t, r) => ({
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, u) => d + (u.column.getSize() ?? 0), 0)
18
- })), W = s.filter(({ header: e }) => e.column.columnDef.fixedLeft), _ = s.filter(({ header: e }) => !e.column.columnDef.fixedLeft && !e.column.columnDef.fixedRight && e.column.id !== "actions"), h = s.filter(({ header: e }) => !!e.column.columnDef.fixedRight || e.column.id === "actions"), w = h.some(({ header: e }) => e.column.id === j), C = h.map((e, t, r) => ({
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, u) => d + (u.header.column.getSize() ?? 0), 0) + (w ? -1 : 0)
21
- })), O = H.reduce((e, t) => {
22
- const r = _[t];
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__ */ k("tr", { children: [
26
- W.map(({ header: e, left: t }) => /* @__PURE__ */ n(a, {
27
- styledTableProps: o,
28
- header: e,
29
- tableCanResize: m,
30
- left: t,
31
- tableWidth: l
32
- }, e.id)),
33
- i > 0 && /* @__PURE__ */ n("th", {
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: t,
49
- tableCanResize: m,
50
- left: r,
35
+ header: e,
36
+ tableCanResize: s,
37
+ left: t,
51
38
  tableWidth: l
52
- }, t.id);
53
- }),
54
- c > 0 && /* @__PURE__ */ n("th", {
55
- "aria-hidden": !0,
56
- style: {
57
- width: String(c) + "px",
58
- minWidth: String(c) + "px",
59
- maxWidth: String(c) + "px",
60
- padding: 0,
61
- border: "none"
62
- }
63
- }),
64
- C.map(({ header: e, left: t, right: r }) => /* @__PURE__ */ n(a, {
65
- styledTableProps: o,
66
- header: e,
67
- tableCanResize: m,
68
- left: t,
69
- right: r,
70
- tableWidth: l
71
- }, e.id))
72
- ] }, f.id);
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
- q as TableHeader
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 f = {
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 && (t.onChangeFocused(!0, t.id), document.getElementById(t.id)?.focus({ preventScroll: !0 }));
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 && (t.onChangeFocused(!0, t.id), document.getElementById(t.id)?.focus({ preventScroll: !0 }));
45
+ return t ? (t.onChangeFocused(!0, t.id), !0) : !1;
46
46
  };
47
47
  }
48
48
  };
49
49
  export {
50
- f as FocusedRowsFeature
50
+ a as FocusedRowsFeature
51
51
  };
@@ -1,17 +1,83 @@
1
- import { useCallback as n, useState as t } from "react";
2
- var c = () => {
3
- const [l, r] = t(null), [s, e] = t(!1), o = n((a) => {
4
- r(a.currentTarget), e(!0);
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: s,
8
- handleClose: n(() => {
9
- e(!1);
10
- }, []),
11
- handleOpen: o,
12
- anchorEl: l
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
- c as useToggleMenuVisibility
81
+ m as useKeyboardSelectMenu,
82
+ D as useToggleMenuVisibility
17
83
  };
@@ -1,16 +1,16 @@
1
- var _ = "_contained_13b4p_6", t = "_common_13b4p_6", a = "_medium_13b4p_48", e = "_small_13b4p_53", r = "_large_13b4p_58", o = "_error_13b4p_68", b = "_outlined_13b4p_130", m = "_text_13b4p_254", l = "_textGray_13b4p_378", p = "_textWhite_13b4p_440", u = {
2
- "asma-core-ui-button": "_asma-core-ui-button_13b4p_1",
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: r,
8
- error: o,
9
- outlined: b,
10
- text: m,
11
- textGray: l,
12
- textWhite: p
7
+ large: m,
8
+ error: r,
9
+ outlined: o,
10
+ text: s,
11
+ textGray: y,
12
+ textWhite: g
13
13
  };
14
14
  export {
15
- u as default
15
+ l as default
16
16
  };