asma-ui-core 3.121.5 → 3.122.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 (30) hide show
  1. package/dist/asma-ui-core.css +1 -1
  2. package/dist/components/custom/module/header-layout/ToolbarRows.js +64 -60
  3. package/dist/components/custom/pathfinder-card/Pathfinder.module.js +14 -13
  4. package/dist/components/custom/pathfinder-card/PathfinderCard.js +64 -64
  5. package/dist/components/custom/widget/widget/StyledWidget.js +44 -37
  6. package/dist/components/custom/widget/widget-header/StyledWidgetHeader.js +7 -7
  7. package/dist/components/custom/widget/widget-title/StyledWidgetTitle.js +8 -8
  8. package/dist/components/data-display/chip/StyledChip.js +42 -42
  9. package/dist/components/data-display/form-label/components/StyledFormLabel.js +15 -15
  10. package/dist/components/feedback/dialog/StyledDialog.js +75 -75
  11. package/dist/components/feedback/dialog/StyledDialogActions.js +4 -4
  12. package/dist/components/feedback/dialog/StyledDialogTitle.js +13 -13
  13. package/dist/components/feedback/dialog/dialog-footer/StyledDialogFooter.js +70 -69
  14. package/dist/components/feedback/minimizable-dialog/MinimizableDialog.js +69 -69
  15. package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +81 -81
  16. package/dist/components/feedback/snack-bar/StyledAlert.js +16 -16
  17. package/dist/components/inputs/button/StyledButton.js +36 -35
  18. package/dist/components/inputs/input-field/StyledInputField.js +38 -38
  19. package/dist/components/inputs/search-field/StyledSearchField.js +18 -17
  20. package/dist/components/miscellaneous/StyledFormControlLabel.js +13 -13
  21. package/dist/components/navigation/link/StyledLink.js +44 -44
  22. package/dist/components/navigation/title-chevron/StyledTitleChevron.js +13 -13
  23. package/dist/components/utils/bottom-sheet/StyledBottomSheet.js +45 -45
  24. package/dist/components/utils/popover/PopoverAnatomy.js +23 -23
  25. package/dist/hooks/useMediaQuery.hook.js +3 -2
  26. package/dist/src/components/custom/module/header-layout/ToolbarRows.d.ts +3 -1
  27. package/dist/src/hooks/useMediaQuery.hook.d.ts +2 -0
  28. package/dist/src/table/types.d.ts +8 -0
  29. package/dist/table/components/TableRow.js +89 -87
  30. package/package.json +1 -1
@@ -1,27 +1,27 @@
1
- import { cn as d } from "../../../helpers/cn.js";
1
+ import { cn as l } from "../../../helpers/cn.js";
2
2
  import { registerOpenModalDialog as z } from "../../../hooks/useTopLayer.hook.js";
3
3
  import { CloseIcon as J } from "../../icons/close-icon/CloseIcon.js";
4
4
  import { IndeterminateIcon as W } from "../../icons/indeterminate-icon/IndeterminateIcon.js";
5
5
  import { StyledButton as j } from "../../inputs/button/StyledButton.js";
6
6
  import { useShortViewportMediaQuery as X } from "../../../hooks/useMediaQuery.hook.js";
7
- import { OverlayBackOwnerContext as Z, isOverlayBackEnabled as P, requestCloseTopOverlayBack as x, useBackCloses as ee } from "../../../hooks/useBackCloses.hook.js";
7
+ import { OverlayBackOwnerContext as Z, isOverlayBackEnabled as P, requestCloseTopOverlayBack as y, useBackCloses as ee } from "../../../hooks/useBackCloses.hook.js";
8
8
  import { useDebouncedValue as te } from "../../../hooks/useDebouncedValue.hook.js";
9
9
  import { useFocusTrap as re } from "../../../hooks/useFocusTrap.hook.js";
10
10
  import { formatResultsLabel as oe } from "./formatResultsLabel.js";
11
11
  import { useBodyScrollLock as ne } from "../../../hooks/useBodyScrollLock.hook.js";
12
12
  import ae from "./StyledBottomSheet.module.js";
13
13
  import { useDragToDismiss as se } from "./useDragToDismiss.hook.js";
14
- import { useEffect as y, useId as ie, useLayoutEffect as le, useRef as l, useState as ce } from "react";
14
+ import { useEffect as g, useId as ie, useLayoutEffect as le, useRef as c, useState as ce } from "react";
15
15
  import { jsx as o, jsxs as u } from "react/jsx-runtime";
16
- var de = 500, Le = ({ dataTest: c, id: T, open: t, onClose: s, title: m, ariaLabel: _, children: q, viewResultsAction: g, resetAction: $, footerActions: A, resultCount: E, closeLabel: U = "Lukk", className: V, registerBackClose: H = !0, ownerRef: K }) => {
17
- const k = ie(), i = l(null), S = l(null), N = l(null), R = K ?? i, h = l(!1), [b, L] = ce(!1), G = X(), f = l(s), B = l(t);
18
- y(() => {
19
- f.current = s, B.current = t;
16
+ var de = 500, Le = ({ dataTest: d, id: T, open: t, onClose: s, title: m, ariaLabel: _, children: q, viewResultsAction: E, resetAction: $, footerActions: A, resultCount: k, closeLabel: U = "Lukk", className: V, registerBackClose: H = !0, ownerRef: K }) => {
17
+ const S = ie(), i = c(null), N = c(null), R = c(null), L = K ?? i, h = c(!1), [x, B] = ce(!1), G = X(), f = c(s), C = c(t);
18
+ g(() => {
19
+ f.current = s, C.current = t;
20
20
  }, [s, t]);
21
- const { dragHandleProps: Q, dragOffset: C } = se(S, () => {
21
+ const { dragHandleProps: Q, dragOffset: O } = se(N, () => {
22
22
  f.current("drag");
23
23
  });
24
- ne(t), re(t, i), y(() => {
24
+ ne(t), re(t, i), g(() => {
25
25
  if (!t) return;
26
26
  const e = (r) => {
27
27
  r.key === "Escape" && (h.current = !0, window.setTimeout(() => {
@@ -30,7 +30,7 @@ var de = 500, Le = ({ dataTest: c, id: T, open: t, onClose: s, title: m, ariaLab
30
30
  }, n = (r) => {
31
31
  if (r.key !== "Escape" || r.defaultPrevented) return;
32
32
  const a = document.activeElement;
33
- a instanceof Element && a.closest("dialog[open]") !== i.current || (r.preventDefault(), r.stopImmediatePropagation(), x(r));
33
+ a instanceof Element && a.closest("dialog[open]") !== i.current || (r.preventDefault(), r.stopImmediatePropagation(), y(r));
34
34
  };
35
35
  return window.addEventListener("keydown", e, !0), window.addEventListener("keydown", n), () => {
36
36
  window.removeEventListener("keydown", e, !0), window.removeEventListener("keydown", n);
@@ -38,78 +38,78 @@ var de = 500, Le = ({ dataTest: c, id: T, open: t, onClose: s, title: m, ariaLab
38
38
  }, [t]), ee({
39
39
  active: t && H,
40
40
  requestClose: () => f.current("escape"),
41
- ownerRef: R
41
+ ownerRef: L
42
42
  }), le(() => {
43
43
  const e = i.current;
44
44
  if (!t || !e) return;
45
- N.current = document.activeElement instanceof HTMLElement ? document.activeElement : null, e.open || e.showModal(), e.focus({ preventScroll: !0 });
45
+ R.current = document.activeElement instanceof HTMLElement ? document.activeElement : null, e.open || e.showModal(), e.focus({ preventScroll: !0 });
46
46
  const n = requestAnimationFrame(() => {
47
- L(!0);
47
+ B(!0);
48
48
  }), r = z(e);
49
49
  return () => {
50
- cancelAnimationFrame(n), r(), L(!1), e.open && e.close();
51
- const a = N.current;
50
+ cancelAnimationFrame(n), r(), B(!1), e.open && e.close();
51
+ const a = R.current;
52
52
  a?.isConnected && a.focus({ preventScroll: !0 });
53
53
  };
54
- }, [t]), y(() => {
54
+ }, [t]), g(() => {
55
55
  const e = i.current;
56
56
  if (!e || !t) return;
57
57
  let n = !1;
58
58
  const r = () => {
59
59
  requestAnimationFrame(() => {
60
- n = !1, B.current && e.isConnected && !e.open && (e.showModal(), e.focus({ preventScroll: !0 }));
60
+ n = !1, C.current && e.isConnected && !e.open && (e.showModal(), e.focus({ preventScroll: !0 }));
61
61
  });
62
62
  }, a = () => {
63
- n || (n = !0, P() && x(), r());
63
+ n || (n = !0, P() && y(), r());
64
64
  };
65
65
  return e.addEventListener("close", a), () => e.removeEventListener("close", a);
66
66
  }, [t]);
67
- const O = oe(te(E, de));
67
+ const I = oe(te(k, de));
68
68
  if (!t) return null;
69
69
  const Y = { close: () => {
70
70
  s("action");
71
- } }, p = (e) => typeof e == "function" ? e(Y) : e, I = E !== void 0, w = g !== void 0 ? p(g) : I ? /* @__PURE__ */ o(j, {
72
- dataTest: `${c}-view-results`,
71
+ } }, p = (e) => typeof e == "function" ? e(Y) : e, D = k !== void 0, b = E !== void 0 ? p(E) : D ? /* @__PURE__ */ o(j, {
72
+ dataTest: `${d}-view-results`,
73
73
  type: "button",
74
74
  variant: "text",
75
75
  onClick: () => {
76
76
  s("viewResults");
77
77
  },
78
- children: O
79
- }) : void 0, D = p($), v = p(A), F = !!(w ?? D), M = C > 0;
78
+ children: I
79
+ }) : void 0, F = p($), v = p(A), w = !!(b ?? F), M = O > 0;
80
80
  return /* @__PURE__ */ o("dialog", {
81
81
  ref: i,
82
82
  id: T,
83
83
  tabIndex: -1,
84
84
  "aria-modal": "true",
85
- "aria-labelledby": m ? k : void 0,
85
+ "aria-labelledby": m ? S : void 0,
86
86
  "aria-label": m ? void 0 : _,
87
- "data-test": c,
88
- "data-testid": c,
87
+ "data-test": d,
88
+ "data-testid": d,
89
89
  onCancel: (e) => {
90
90
  if (e.cancelable && e.preventDefault(), !h.current) {
91
91
  if (!P()) {
92
92
  f.current("escape");
93
93
  return;
94
94
  }
95
- x();
95
+ y();
96
96
  }
97
97
  },
98
- className: d(ae.StyledBottomSheet, "fixed inset-0 m-0 h-full max-h-none w-full max-w-none flex-col items-center justify-end overflow-hidden border-0 bg-transparent p-0 outline-none open:flex"),
98
+ className: l(ae.StyledBottomSheet, "fixed inset-0 m-0 h-full max-h-none w-full max-w-none flex-col items-center justify-end overflow-hidden border-0 bg-transparent p-0 outline-none open:flex"),
99
99
  children: /* @__PURE__ */ u(Z.Provider, {
100
- value: R,
100
+ value: L,
101
101
  children: [/* @__PURE__ */ o("div", {
102
102
  "aria-hidden": "true",
103
- "data-testid": `${c}-scrim`,
103
+ "data-testid": `${d}-scrim`,
104
104
  onClick: () => {
105
105
  s("scrim");
106
106
  },
107
- className: d("absolute inset-0 bg-[#626e7eb2] transition-opacity duration-[250ms] ease-out motion-reduce:duration-150", b ? "opacity-100" : "opacity-0")
107
+ className: l("absolute inset-0 bg-[#626e7eb2] transition-opacity duration-[250ms] ease-out motion-reduce:duration-150", x ? "opacity-100" : "opacity-0")
108
108
  }), /* @__PURE__ */ u("div", {
109
- ref: S,
110
- "data-state": b ? "open" : "closed",
111
- style: M ? { transform: `translateY(${C}px)` } : void 0,
112
- className: d("relative box-border flex w-full max-w-[640px] flex-col border border-solid border-delta-300 bg-white text-delta-700 outline-none", G ? "h-full max-h-none rounded-none" : "max-h-[90dvh] rounded-t-[28px]", !M && ["ease-out motion-safe:transition-transform motion-safe:duration-[250ms] motion-reduce:transition-opacity motion-reduce:duration-150", b ? "translate-y-0 opacity-100" : "motion-safe:translate-y-full motion-reduce:opacity-0"], V),
109
+ ref: N,
110
+ "data-state": x ? "open" : "closed",
111
+ style: M ? { transform: `translateY(${O}px)` } : void 0,
112
+ className: l("relative box-border flex w-full max-w-[640px] flex-col border border-solid border-delta-300 bg-white text-delta-700 outline-none", G ? "h-full max-h-none rounded-none" : "max-h-[90dvh] rounded-t-[28px]", !M && ["ease-out motion-safe:transition-transform motion-safe:duration-[250ms] motion-reduce:transition-opacity motion-reduce:duration-150", x ? "translate-y-0 opacity-100" : "motion-safe:translate-y-full motion-reduce:opacity-0"], V),
113
113
  children: [
114
114
  /* @__PURE__ */ u("div", {
115
115
  className: "border-b-solid shrink-0 border-b border-delta-200 pb-2",
@@ -119,7 +119,7 @@ var de = 500, Le = ({ dataTest: c, id: T, open: t, onClose: s, title: m, ariaLab
119
119
  children: [
120
120
  /* @__PURE__ */ o("div", { className: "min-w-0 flex-1" }),
121
121
  /* @__PURE__ */ o(j, {
122
- dataTest: `${c}-close`,
122
+ dataTest: `${d}-close`,
123
123
  variant: "textGray",
124
124
  type: "button",
125
125
  "aria-label": U,
@@ -140,31 +140,31 @@ var de = 500, Le = ({ dataTest: c, id: T, open: t, onClose: s, title: m, ariaLab
140
140
  })
141
141
  ]
142
142
  }), m && /* @__PURE__ */ o("div", {
143
- id: k,
143
+ id: S,
144
144
  className: "truncate px-4 text-lg font-semibold leading-7 text-delta-800",
145
145
  children: m
146
146
  })]
147
147
  }),
148
148
  /* @__PURE__ */ o("div", {
149
- className: d("flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto overscroll-contain pl-4 pr-2 pt-2", F || v ? "pb-2" : "pb-[max(0.5rem,env(safe-area-inset-bottom))]"),
149
+ className: l("flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto overscroll-contain pl-4 pr-2 pt-2", w || v ? "pb-2" : "pb-[max(0.5rem,env(safe-area-inset-bottom))]"),
150
150
  children: p(q)
151
151
  }),
152
- F && /* @__PURE__ */ u("div", {
153
- className: d("border-t-solid flex shrink-0 items-start border-t border-delta-200 bg-white p-1", w ? "justify-between" : "justify-end", !v && "pb-[max(0.25rem,env(safe-area-inset-bottom))]"),
152
+ w && /* @__PURE__ */ u("div", {
153
+ className: l("border-t-solid flex shrink-0 items-start border-t border-delta-200 bg-white p-1", b ? "justify-between" : "justify-end", "max-xs:flex-wrap max-xs:gap-y-2 max-xs:[&>:nth-child(2)]:ml-auto", !v && "pb-[max(0.25rem,env(safe-area-inset-bottom))]"),
154
154
  children: [
155
- w,
156
- D,
157
- I && /* @__PURE__ */ o("span", {
155
+ b,
156
+ F,
157
+ D && /* @__PURE__ */ o("span", {
158
158
  className: "sr-only",
159
159
  role: "status",
160
160
  "aria-live": "polite",
161
161
  "aria-atomic": "true",
162
- children: O
162
+ children: I
163
163
  })
164
164
  ]
165
165
  }),
166
166
  v && /* @__PURE__ */ o("div", {
167
- className: "flex shrink-0 flex-col items-end bg-white p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]",
167
+ className: l("flex shrink-0 flex-col items-end bg-white p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]", w && "max-xs:pt-1"),
168
168
  children: v
169
169
  })
170
170
  ]
@@ -1,42 +1,42 @@
1
- import { cn as d } from "../../../helpers/cn.js";
2
- import { CloseIcon as c } from "../../icons/close-icon/CloseIcon.js";
3
- import { StyledButton as h } from "../../inputs/button/StyledButton.js";
1
+ import { cn as r } from "../../../helpers/cn.js";
2
+ import { CloseIcon as h } from "../../icons/close-icon/CloseIcon.js";
3
+ import { StyledButton as c } from "../../inputs/button/StyledButton.js";
4
4
  import { useScrollGutter as u } from "./useScrollGutter.js";
5
5
  import { useRef as v } from "react";
6
- import { Fragment as _, jsx as e, jsxs as l } from "react/jsx-runtime";
7
- var g = 40, j = "relative box-border flex flex-col overflow-hidden rounded-lg bg-white text-delta-700 outline-none shadow-[0px_4px_40px_0px_#22213366]", b = "pointer-events-none absolute inset-0 rounded-[inherit] shadow-[inset_0_0_0_1px_var(--colors-delta-300)]", k = ({ dataTest: a, title: t, titleId: m, children: p, viewResultsAction: r, resetAction: o, footerActions: i, closeLabel: f, onClose: x }) => {
8
- const n = v(null), s = u(n);
9
- return /* @__PURE__ */ l(_, { children: [
10
- /* @__PURE__ */ l("div", {
6
+ import { Fragment as g, jsx as e, jsxs as o } from "react/jsx-runtime";
7
+ var _ = 40, j = "relative box-border flex flex-col overflow-hidden rounded-lg bg-white text-delta-700 outline-none shadow-[0px_4px_40px_0px_#22213366]", b = "pointer-events-none absolute inset-0 rounded-[inherit] shadow-[inset_0_0_0_1px_var(--colors-delta-300)]", k = ({ dataTest: s, title: a, titleId: m, children: x, viewResultsAction: t, resetAction: l, footerActions: i, closeLabel: p, onClose: f }) => {
8
+ const n = v(null), d = u(n);
9
+ return /* @__PURE__ */ o(g, { children: [
10
+ /* @__PURE__ */ o("div", {
11
11
  className: "relative flex min-h-0 flex-1 flex-col",
12
- children: [t && /* @__PURE__ */ e("div", {
12
+ children: [a && /* @__PURE__ */ e("div", {
13
13
  id: m,
14
14
  className: "shrink-0 truncate pb-1 pl-4 pr-10 pt-2 text-lg font-semibold leading-7 text-delta-800",
15
- children: t
15
+ children: a
16
16
  }), /* @__PURE__ */ e("div", {
17
17
  ref: n,
18
- className: d("flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto py-2 pl-4 [scrollbar-gutter:stable]", !t && s.overflows && "mt-10"),
19
- style: { paddingRight: Math.max(0, g - s.width) },
20
- children: p
18
+ className: r("flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto py-2 pl-4 [scrollbar-gutter:stable]", !a && d.overflows && "mt-10"),
19
+ style: { paddingRight: Math.max(0, _ - d.width) },
20
+ children: x
21
21
  })]
22
22
  }),
23
- (r ?? o) && /* @__PURE__ */ l("div", {
24
- className: d("flex shrink-0 items-start p-1", r ? "justify-between" : "justify-end"),
25
- children: [r, o]
23
+ (t ?? l) && /* @__PURE__ */ o("div", {
24
+ className: r("flex shrink-0 items-start p-1", t ? "justify-between" : "justify-end", "max-xs:flex-wrap max-xs:gap-y-2 max-xs:[&>:last-child]:ml-auto"),
25
+ children: [t, l]
26
26
  }),
27
27
  i && /* @__PURE__ */ e("div", {
28
- className: "flex shrink-0 flex-col items-end p-3",
28
+ className: r("flex shrink-0 flex-col items-end p-3", (t ?? l) && "max-xs:pt-1"),
29
29
  children: i
30
30
  }),
31
31
  /* @__PURE__ */ e("div", {
32
32
  className: "absolute right-0 top-0",
33
- children: /* @__PURE__ */ e(h, {
34
- dataTest: `${a}-close`,
33
+ children: /* @__PURE__ */ e(c, {
34
+ dataTest: `${s}-close`,
35
35
  variant: "textGray",
36
36
  type: "button",
37
- "aria-label": f,
38
- onClick: x,
39
- startIcon: /* @__PURE__ */ e(c, {
37
+ "aria-label": p,
38
+ onClick: f,
39
+ startIcon: /* @__PURE__ */ e(h, {
40
40
  width: 24,
41
41
  height: 24
42
42
  })
@@ -44,7 +44,7 @@ var g = 40, j = "relative box-border flex flex-col overflow-hidden rounded-lg bg
44
44
  }),
45
45
  /* @__PURE__ */ e("span", {
46
46
  "aria-hidden": !0,
47
- "data-test": `${a}-edge`,
47
+ "data-test": `${s}-edge`,
48
48
  className: b
49
49
  })
50
50
  ] });
@@ -16,10 +16,11 @@ function e(t) {
16
16
  return o(a, i, u);
17
17
  };
18
18
  }
19
- var h = e("(max-width: 743px)"), s = e("(max-height: 480px)"), c = e("(max-height: 480px) and (min-width: 480px)"), m = e("(max-width: 743px), (max-height: 480px)");
19
+ var h = e("(max-width: 743px)"), s = e("not all and (min-width: 320px)"), x = e("(max-height: 480px)"), c = e("(max-height: 480px) and (min-width: 480px)"), m = e("(max-width: 743px), (max-height: 480px)");
20
20
  export {
21
21
  m as useFullScreenPickerMediaQuery,
22
+ s as useMaxXsMediaQuery,
22
23
  h as useMobileMediaQuery,
23
24
  c as usePickerOneRowHeaderMediaQuery,
24
- s as useShortViewportMediaQuery
25
+ x as useShortViewportMediaQuery
25
26
  };
@@ -29,8 +29,10 @@ export declare function SearchSlot({ search, expanded, measureRef, }: {
29
29
  measureRef?: MeasureRef;
30
30
  }): JSX.Element;
31
31
  /** Keeps children mounted while hidden so slots fade instead of popping. */
32
- export declare function FadeSlot({ visible, children }: {
32
+ export declare function FadeSlot({ visible, flattenBelowXs, children, }: {
33
33
  visible: boolean;
34
+ /** Below xs, drops both wrappers so each child wraps as its own item of the parent row. */
35
+ flattenBelowXs?: boolean;
34
36
  children: ReactNode;
35
37
  }): JSX.Element;
36
38
  export declare function TitleText({ title, measureRef }: {
@@ -1,5 +1,7 @@
1
1
  export declare function makeMediaQueryStore(mediaQuery: string): () => boolean;
2
2
  export declare const useMobileMediaQuery: () => boolean;
3
+ /** Narrower than any phone — the same query as the `max-xs:` Tailwind variant (tailwind.config.ts). */
4
+ export declare const useMaxXsMediaQuery: () => boolean;
3
5
  /** A phone in landscape: too short for a sheet capped at 90vh to leave a usable body. */
4
6
  export declare const useShortViewportMediaQuery: () => boolean;
5
7
  /**
@@ -77,6 +77,14 @@ export type StyledTableProps<TData, TCustomData> = {
77
77
  customActionsNode?: (row: CellContext<TData, unknown>) => ReactNode;
78
78
  customSubRowData?: Map<string, TCustomData[]>;
79
79
  headerPin?: boolean;
80
+ /**
81
+ * Pins the internal actions column's body cells to the right edge. By default they are pinned
82
+ * when the column renders actions (`actions` / `customActionsNode`) or the table has fixed-right
83
+ * columns; a column that only hosts the header pin menu scrolls with the data. The header cell
84
+ * with the pin menu stays pinned either way. Not supported as `false` together with fixed-right
85
+ * columns: their body and header offsets would no longer match.
86
+ */
87
+ stickyActions?: boolean;
80
88
  expandArrow?: boolean;
81
89
  defaultExpanded?: boolean;
82
90
  loading?: boolean;
@@ -1,53 +1,53 @@
1
- import { ACTIONS_COLUMN_ID as q, INTERNAL_COLUMN_IDS as xe } from "../types.js";
2
- import { useRootContext as Ce } from "../context/RootContext.js";
1
+ import { ACTIONS_COLUMN_ID as w, INTERNAL_COLUMN_IDS as Re } from "../types.js";
2
+ import { useRootContext as Se } from "../context/RootContext.js";
3
3
  import n from "./StyledTable.module.js";
4
- import { compact as be } from "../../helpers/arrays.js";
5
- import G from "clsx";
6
- import { Fragment as Re, useCallback as K, useEffect as Se, useLayoutEffect as De, useMemo as h, useRef as Ne, useState as ve } from "react";
7
- import { Fragment as Ee, jsx as s, jsxs as b } from "react/jsx-runtime";
8
- import { useSortable as Ie } from "@dnd-kit/sortable";
9
- import { flexRender as ye } from "@tanstack/react-table";
10
- import { CSS as Te } from "@dnd-kit/utilities";
11
- var V = (R, t) => {
12
- const f = R.closest("table");
13
- if (!f) return !1;
14
- const S = t === "next" ? Node.DOCUMENT_POSITION_FOLLOWING : Node.DOCUMENT_POSITION_PRECEDING, c = Array.from(document.querySelectorAll('a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])')).filter((p) => !f.contains(p) && !!(f.compareDocumentPosition(p) & S)), l = t === "next" ? c[0] : c.at(-1);
4
+ import { compact as De } from "../../helpers/arrays.js";
5
+ import V from "clsx";
6
+ import { Fragment as Ne, useCallback as Y, useEffect as ve, useLayoutEffect as Ee, useMemo as R, useRef as Ie, useState as ye } from "react";
7
+ import { Fragment as Te, jsx as s, jsxs as S } from "react/jsx-runtime";
8
+ import { useSortable as ke } from "@dnd-kit/sortable";
9
+ import { flexRender as Fe } from "@tanstack/react-table";
10
+ import { CSS as Ae } from "@dnd-kit/utilities";
11
+ var J = (D, t) => {
12
+ const g = D.closest("table");
13
+ if (!g) return !1;
14
+ const N = t === "next" ? Node.DOCUMENT_POSITION_FOLLOWING : Node.DOCUMENT_POSITION_PRECEDING, r = Array.from(document.querySelectorAll('a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])')).filter((p) => !g.contains(p) && !!(g.compareDocumentPosition(p) & N)), l = t === "next" ? r[0] : r.at(-1);
15
15
  return l ? (l.focus(), document.activeElement === l) : !1;
16
16
  };
17
- function We({ styledTableProps: R, row: t, index: f, hasFocusedRow: S, columnWindow: { paddingLeft: c, paddingRight: l, indexes: p } }) {
18
- const { loading: Y, getRowClassName: a, activeRowId: L, rowHeight: x, onRowClick: D, expandArrow: J, enableDnd: M, disableDndForRow: Q, tdClassName: O, customSubRowData: w, renderSubRows: X, defaultExpanded: Z, actions: N, customActionsNode: ee, textExpandArrow: A, enableMultiRowSelection: te, enableRowSelection: ne, singleSelectionRow: ie } = R, v = Q?.(t), { transform: oe, transition: se, setNodeRef: _, isDragging: B } = Ie({
17
+ function je({ styledTableProps: D, row: t, index: g, hasFocusedRow: N, columnWindow: { paddingLeft: r, paddingRight: l, indexes: p } }) {
18
+ const { loading: Q, getRowClassName: a, activeRowId: _, rowHeight: x, onRowClick: v, expandArrow: X, enableDnd: B, disableDndForRow: Z, tdClassName: H, customSubRowData: U, renderSubRows: ee, defaultExpanded: te, actions: E, customActionsNode: ne, stickyActions: ie, textExpandArrow: z, enableMultiRowSelection: oe, enableRowSelection: se, singleSelectionRow: le } = D, I = Z?.(t), { transform: ae, transition: ce, setNodeRef: W, isDragging: P } = ke({
19
19
  id: t.original.id,
20
- disabled: !M || v
21
- }), le = {
22
- transform: Te.Transform.toString(oe),
23
- transition: se,
24
- opacity: B ? 0.8 : 1,
25
- zIndex: B ? 1 : 0,
20
+ disabled: !B || I
21
+ }), de = {
22
+ transform: Ae.Transform.toString(ae),
23
+ transition: ce,
24
+ opacity: P ? 0.8 : 1,
25
+ zIndex: P ? 1 : 0,
26
26
  position: "relative"
27
- }, { isResizing: ae, disableResizingFlag: ce } = Ce(), E = t.isExpanded(), C = Ne(null), [de, re] = ve(void 0);
28
- De(() => {
29
- !E && C.current && re(C.current.cells[0]?.clientHeight ?? C.current.offsetHeight);
30
- }, [E]);
31
- const ue = K((e) => {
32
- C.current = e, v || _(e);
33
- }, [v, _]), H = E ? de ?? x : x;
34
- Se(() => {
35
- Z && t.getCanExpand() && !t.getIsExpanded() && t.toggleExpand();
27
+ }, { isResizing: re, disableResizingFlag: ue } = Se(), y = t.isExpanded(), C = Ie(null), [fe, me] = ye(void 0);
28
+ Ee(() => {
29
+ !y && C.current && me(C.current.cells[0]?.clientHeight ?? C.current.offsetHeight);
30
+ }, [y]);
31
+ const ge = Y((e) => {
32
+ C.current = e, I || W(e);
33
+ }, [I, W]), $ = y ? fe ?? x : x;
34
+ ve(() => {
35
+ te && t.getCanExpand() && !t.getIsExpanded() && t.toggleExpand();
36
36
  }, []);
37
- const U = (e) => {
38
- t.getCanExpand() && !J && t.getToggleExpandedHandler()(), document.getElementById(t.id)?.focus();
39
- const i = window.getSelection()?.type !== "Range" && !ae, o = D instanceof Function;
40
- !o && A && i ? t.toggleExpand() : o && i && D(e, t), ce();
41
- }, fe = (e) => {
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
- }, me = (e) => {
37
+ const j = (e) => {
38
+ t.getCanExpand() && !X && t.getToggleExpandedHandler()(), document.getElementById(t.id)?.focus();
39
+ const i = window.getSelection()?.type !== "Range" && !re, o = v instanceof Function;
40
+ !o && z && i ? t.toggleExpand() : o && i && v(e, t), ue();
41
+ }, he = (e) => {
42
+ e.target.classList.contains("MuiModal-backdrop") || e.target.nodeName === "INPUT" || e.target.nodeName === "BUTTON" || e.target.nodeName === "LI" || e.target.closest("li") || j(e);
43
+ }, pe = (e) => {
44
44
  if (e.target === e.currentTarget)
45
45
  switch (e.key) {
46
46
  case "Tab":
47
47
  if (e.shiftKey) {
48
48
  const i = e.currentTarget.closest("table")?.querySelector('thead tr[tabindex="0"]');
49
- i ? (e.preventDefault(), i.focus()) : V(e.currentTarget, "prev") && e.preventDefault();
50
- } else V(e.currentTarget, "next") && e.preventDefault();
49
+ i ? (e.preventDefault(), i.focus()) : J(e.currentTarget, "prev") && e.preventDefault();
50
+ } else J(e.currentTarget, "next") && e.preventDefault();
51
51
  break;
52
52
  case "ArrowDown":
53
53
  t.focusNextRow() && e.preventDefault();
@@ -56,32 +56,32 @@ function We({ styledTableProps: R, row: t, index: f, hasFocusedRow: S, columnWin
56
56
  t.focusPrevRow() && e.preventDefault();
57
57
  break;
58
58
  case "Enter":
59
- e.preventDefault(), U(e);
59
+ e.preventDefault(), j(e);
60
60
  break;
61
61
  }
62
- }, m = t.getVisibleCells().map((e, i, o) => ({
62
+ }, c = t.getVisibleCells().map((e, i, o) => ({
63
63
  ...e,
64
- left: o.slice(0, i).reduce((r, u) => r + (u.column.getSize() ?? 0), 0)
65
- })), z = h(() => m.filter((e) => !e.column.columnDef.fixedLeft && !e.column.columnDef.fixedRight && e.column.id !== "actions"), [m]), d = h(() => m.filter((e) => !!e.column.columnDef.fixedRight || e.column.id === "actions").map((e, i, o) => ({
64
+ left: o.slice(0, i).reduce((f, m) => f + (m.column.getSize() ?? 0), 0)
65
+ })), T = !!E || !!ne, k = c.some((e) => !!e.column.columnDef.fixedRight), d = ie ?? (T || k), q = R(() => c.filter((e) => !e.column.columnDef.fixedLeft && !e.column.columnDef.fixedRight && e.column.id !== "actions"), [c]), h = R(() => c.filter((e) => !!e.column.columnDef.fixedRight || e.column.id === "actions" && d).map((e, i, o) => ({
66
66
  ...e,
67
- right: o.slice(i + 1).reduce((r, u) => r + (u.column.getSize() ?? 0), 0)
68
- })), [m]), W = h(() => d.some((e) => e.column.id === q), [d]), P = !!N || !!ee, $ = h(() => d.some((e) => !!e.column.columnDef.fixedRight), [d]), g = h(() => m.filter((e) => e.column.columnDef.fixedLeft), [m]), I = !te && !ne && ie, y = t.getIsSelected() && I, T = D instanceof Function, j = p.length > 0 ? be(p.map((e) => z[e])) : z, F = K((e, i) => {
69
- const o = e.column.id === q, r = e.column.columnDef.fixedLeft, u = !!e.column.columnDef.fixedRight, ge = e.id === g.at(-1)?.id, pe = e.id === d.at(0)?.id && !o, he = t.isExpanded(), k = i === 0;
67
+ right: o.slice(i + 1).reduce((f, m) => f + (m.column.getSize() ?? 0), 0)
68
+ })), [c, d]), G = R(() => h.some((e) => e.column.id === w), [h]), K = d ? void 0 : c.find((e) => e.column.id === w), u = R(() => c.filter((e) => e.column.columnDef.fixedLeft), [c]), F = !oe && !se && le, A = t.getIsSelected() && F, L = v instanceof Function, M = p.length > 0 ? De(p.map((e) => q[e])) : q, b = Y((e, i) => {
69
+ const o = e.column.id === w, f = e.column.columnDef.fixedLeft, m = !!e.column.columnDef.fixedRight, xe = e.id === u.at(-1)?.id, Ce = e.id === h.at(0)?.id && !o, be = t.isExpanded(), O = i === 0;
70
70
  return /* @__PURE__ */ s("td", {
71
- className: G(n["t-cell"], !xe.includes(e.column.id) && e.column.getSize() > 64 && n["data-cell"], e.column.id === "select" && n["select-cell"], T && "cursor-pointer", O, o && n["action-cell"], o && (!P || $) && n["action-cell--no-shadow"], o && !!N && g.length && n.shadowed, o && (a?.(t) ? a?.(t) : n["action-cell-default-background"]), r && n["fixed-cell"], u && n["fixed-right-cell"], ge && n.shadowed, pe && n["shadowed-right"], t.getIsSelected() && n.selected, r && (a?.(t) ? a?.(t) : n["fixed-cell-default-background"]), u && (a?.(t) ? a?.(t) : n["fixed-right-cell-default-background"]), he && n.expanded_row, !!y && n["single-selection"]),
71
+ className: V(n["t-cell"], !Re.includes(e.column.id) && e.column.getSize() > 64 && n["data-cell"], e.column.id === "select" && n["select-cell"], L && "cursor-pointer", H, o && d && n["action-cell"], o && d && (!T || k) && n["action-cell--no-shadow"], o && d && !!E && u.length && n.shadowed, o && d && (a?.(t) ? a?.(t) : n["action-cell-default-background"]), f && n["fixed-cell"], m && n["fixed-right-cell"], xe && n.shadowed, Ce && n["shadowed-right"], t.getIsSelected() && n.selected, f && (a?.(t) ? a?.(t) : n["fixed-cell-default-background"]), m && (a?.(t) ? a?.(t) : n["fixed-right-cell-default-background"]), be && n.expanded_row, !!A && n["single-selection"]),
72
72
  style: {
73
- left: r ? e.left : void 0,
74
- right: u ? e.right + (W ? -1 : 0) : void 0
73
+ left: f ? e.left : void 0,
74
+ right: m ? e.right + (G ? -1 : 0) : void 0
75
75
  },
76
- children: /* @__PURE__ */ b("div", {
76
+ children: /* @__PURE__ */ S("div", {
77
77
  style: {
78
78
  display: "flex",
79
79
  alignItems: "center",
80
- minWidth: k ? 32 : void 0,
81
- minHeight: H,
80
+ minWidth: O ? 32 : void 0,
81
+ minHeight: $,
82
82
  position: "relative"
83
83
  },
84
- children: [k && y && /* @__PURE__ */ s("span", {
84
+ children: [O && A && /* @__PURE__ */ s("span", {
85
85
  style: {
86
86
  display: "inline-flex",
87
87
  alignItems: "center",
@@ -90,66 +90,67 @@ function We({ styledTableProps: R, row: t, index: f, hasFocusedRow: S, columnWin
90
90
  top: "50%",
91
91
  transform: "translateY(-50%)"
92
92
  },
93
- children: /* @__PURE__ */ s(Fe, {})
93
+ children: /* @__PURE__ */ s(Le, {})
94
94
  }), /* @__PURE__ */ s("span", {
95
95
  style: {
96
- marginLeft: k && I ? 30 : 0,
96
+ marginLeft: O && F ? 30 : 0,
97
97
  width: "100%"
98
98
  },
99
- children: ye(e.column.columnDef.cell, e.getContext())
99
+ children: Fe(e.column.columnDef.cell, e.getContext())
100
100
  })]
101
101
  })
102
102
  }, e.id);
103
103
  }, [
104
- y,
105
- N,
106
- H,
104
+ A,
105
+ E,
106
+ $,
107
107
  a,
108
+ L,
109
+ G,
110
+ k,
111
+ u,
112
+ h,
113
+ t,
108
114
  T,
109
- W,
110
- $,
111
- g,
112
115
  d,
113
- t,
114
- P,
115
- I,
116
- O
116
+ F,
117
+ H
117
118
  ]);
118
- return /* @__PURE__ */ b(Re, { children: [/* @__PURE__ */ b("tr", {
119
+ return /* @__PURE__ */ S(Ne, { children: [/* @__PURE__ */ S("tr", {
119
120
  "aria-selected": t.getIsSelected() || t.isFocused() ? "true" : "false",
120
- tabIndex: t.isFocused() || f === 0 && !S ? 0 : -1,
121
- "data-index": f,
121
+ tabIndex: t.isFocused() || g === 0 && !N ? 0 : -1,
122
+ "data-index": g,
122
123
  "data-test": t.id,
123
- "data-active": L != null && t.id === L ? "true" : void 0,
124
+ "data-active": _ != null && t.id === _ ? "true" : void 0,
124
125
  id: t.id,
125
- className: G(n["t-row"], Y && n["is-loading"], a?.(t)),
126
+ className: V(n["t-row"], Q && n["is-loading"], a?.(t)),
126
127
  style: {
127
128
  height: x ? `${x}px` : "inherit",
128
- ...M && le
129
+ ...B && de
129
130
  },
130
- ref: ue,
131
+ ref: ge,
131
132
  onFocus: (e) => {
132
133
  e.target === e.currentTarget && !t.isFocused() && t.onChangeFocused(!0);
133
134
  },
134
- onMouseUp: fe,
135
+ onMouseUp: he,
135
136
  onMouseDown: (e) => {
136
- e.detail > 1 && !T && A && e.preventDefault();
137
+ e.detail > 1 && !L && z && e.preventDefault();
137
138
  },
138
- onKeyDownCapture: me,
139
+ onKeyDownCapture: pe,
139
140
  children: [
140
- g.map((e, i) => F(e, i)),
141
- c > 0 && /* @__PURE__ */ s("td", {
141
+ u.map((e, i) => b(e, i)),
142
+ r > 0 && /* @__PURE__ */ s("td", {
142
143
  "aria-hidden": !0,
143
144
  className: n["t-cell"],
144
145
  style: {
145
- width: String(c) + "px",
146
- minWidth: String(c) + "px",
147
- maxWidth: String(c) + "px",
146
+ width: String(r) + "px",
147
+ minWidth: String(r) + "px",
148
+ maxWidth: String(r) + "px",
148
149
  padding: 0,
149
150
  border: "none"
150
151
  }
151
152
  }),
152
- j.map((e, i) => F(e, g.length + i)),
153
+ M.map((e, i) => b(e, u.length + i)),
153
154
  l > 0 && /* @__PURE__ */ s("td", {
154
155
  "aria-hidden": !0,
155
156
  className: n["t-cell"],
@@ -161,14 +162,15 @@ function We({ styledTableProps: R, row: t, index: f, hasFocusedRow: S, columnWin
161
162
  border: "none"
162
163
  }
163
164
  }),
164
- d.map((e, i) => F(e, g.length + j.length + i))
165
+ h.map((e, i) => b(e, u.length + M.length + i)),
166
+ K && b(K, u.length + M.length + h.length)
165
167
  ]
166
- }), t.getIsExpanded() && /* @__PURE__ */ s(Ee, { children: w && X?.({
167
- rows: w.get(t.original.id.toString()) ?? [],
168
+ }), t.getIsExpanded() && /* @__PURE__ */ s(Te, { children: U && ee?.({
169
+ rows: U.get(t.original.id.toString()) ?? [],
168
170
  row: t.original
169
171
  }) })] }, t.id);
170
172
  }
171
- var Fe = () => /* @__PURE__ */ b("svg", {
173
+ var Le = () => /* @__PURE__ */ S("svg", {
172
174
  xmlns: "http://www.w3.org/2000/svg",
173
175
  width: "20",
174
176
  height: "20",
@@ -180,5 +182,5 @@ var Fe = () => /* @__PURE__ */ b("svg", {
180
182
  })]
181
183
  });
182
184
  export {
183
- We as TableRow
185
+ je as TableRow
184
186
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.121.5",
6
+ "version": "3.122.0",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",