asma-ui-core 3.86.1 → 3.87.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 (50) hide show
  1. package/dist/asma-ui-core.css +1 -1
  2. package/dist/components/custom/pathfinder-card/PathfinderCard.js +28 -28
  3. package/dist/components/data-display/chip/StyledChip.js +33 -32
  4. package/dist/components/data-display/tooltip/StyledTooltip.js +76 -47
  5. package/dist/components/feedback/dialog/StyledDialog.js +62 -58
  6. package/dist/components/feedback/minimizable-dialog/MinimizableDialog.js +113 -105
  7. package/dist/components/feedback/minimizable-dialog/components/FullscreenBtn.js +10 -12
  8. package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +75 -67
  9. package/dist/components/feedback/snack-bar/StyledSnackbar.js +12 -10
  10. package/dist/components/feedback/snack-bar/components/StyledInfoSnackbar.js +10 -10
  11. package/dist/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.js +69 -71
  12. package/dist/components/inputs/input-field/StyledInputField.js +25 -24
  13. package/dist/components/inputs/phone-field/CountryCodeOptions.js +16 -15
  14. package/dist/components/inputs/phone-field/CountryCodeSelect.js +98 -85
  15. package/dist/components/inputs/phone-field/useCountryPicker.js +44 -24
  16. package/dist/components/inputs/search-field/StyledSearchField.js +10 -10
  17. package/dist/components/inputs/select/StyledSelect.js +16 -15
  18. package/dist/components/inputs/select/StyledSelectItem.js +9 -9
  19. package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +202 -175
  20. package/dist/components/inputs/switch/base-ui/StyledSwitch.js +22 -22
  21. package/dist/components/navigation/link/StyledLink.js +8 -8
  22. package/dist/components/navigation/listbox/Listbox.js +105 -54
  23. package/dist/components/navigation/menu/StyledMenu.js +22 -18
  24. package/dist/components/navigation/menu/StyledMenuItem.js +6 -6
  25. package/dist/components/navigation/title-chevron/StyledTitleChevron.js +7 -7
  26. package/dist/components/utils/accordion/base-ui/StyledAccordionDetails.js +26 -22
  27. package/dist/components/utils/accordion/base-ui/StyledAccordionSummary.js +14 -14
  28. package/dist/components/utils/copy-wrapper/CopyWrapper.module.js +2 -2
  29. package/dist/components/utils/popover/StyledPopover.js +102 -52
  30. package/dist/datetime/components/date-picker/StyledDatePicker.js +40 -34
  31. package/dist/datetime/components/date-picker/components/StyledCalendarPicker.js +5 -4
  32. package/dist/datetime/components/time-picker/StyledTimePicker.js +69 -56
  33. package/dist/helpers/focusable.js +5 -0
  34. package/dist/hooks/useFocusTrap.hook.js +24 -19
  35. package/dist/src/components/data-display/chip/StyledChip.d.ts +2 -0
  36. package/dist/src/components/inputs/dynamic-select/StyledDynamicSelect.d.ts +3 -4
  37. package/dist/src/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.test.d.ts +1 -0
  38. package/dist/src/components/inputs/phone-field/CountryCodeOptions.d.ts +1 -1
  39. package/dist/src/components/inputs/phone-field/useCountryPicker.d.ts +5 -2
  40. package/dist/src/components/navigation/listbox/Listbox.d.ts +3 -2
  41. package/dist/src/components/navigation/menu/StyledMenu.d.ts +3 -2
  42. package/dist/src/components/utils/accordion/base-ui/StyledAccordionDetails.d.ts +2 -1
  43. package/dist/src/components/utils/popover/StyledPopover.d.ts +9 -2
  44. package/dist/src/helpers/focusable.d.ts +8 -0
  45. package/dist/src/hooks/useFocusTrap.hook.d.ts +2 -1
  46. package/dist/table/components/columns/action-column/components/RowActionMenu.js +30 -34
  47. package/dist/table/components/table-footer/TablePagination.js +18 -17
  48. package/dist/table/components/table-footer/TableRowCountSelect.js +5 -4
  49. package/package.json +1 -1
  50. package/src/styles/touchHardening.interaction.test.tsx +269 -0
@@ -1,4 +1,4 @@
1
- import { cn as C } from "../../../helpers/cn.js";
1
+ import { cn as b } from "../../../helpers/cn.js";
2
2
  import { ChevronDownIcon as j } from "../../icons/chevron-down-icon/ChevronDownIcon.js";
3
3
  import { ChevronUpIcon as z } from "../../icons/chevron-up-icon/ChevronUpIcon.js";
4
4
  import h from "./Pathfinder.module.js";
@@ -6,32 +6,32 @@ import { useCallback as R, useEffect as M, useLayoutEffect as O, useMemo as y, u
6
6
  import { Fragment as D, jsx as e, jsxs as I } from "react/jsx-runtime";
7
7
  var _ = typeof window < "u" ? O : M;
8
8
  function q() {
9
- const [i, n] = x(null), d = R((t) => {
9
+ const [i, n] = x(null), a = R((t) => {
10
10
  n(t);
11
11
  }, []), s = R(() => i ? Math.floor(i.getBoundingClientRect().width) : 0, [i]);
12
12
  return {
13
- ref: d,
13
+ ref: a,
14
14
  width: P(R((t) => {
15
15
  if (!i || typeof ResizeObserver > "u") return () => {
16
16
  };
17
- let a = 0;
17
+ let d = 0;
18
18
  const o = new ResizeObserver(() => {
19
- cancelAnimationFrame(a), a = requestAnimationFrame(t);
19
+ cancelAnimationFrame(d), d = requestAnimationFrame(t);
20
20
  });
21
21
  return o.observe(i), () => {
22
- cancelAnimationFrame(a), o.disconnect();
22
+ cancelAnimationFrame(d), o.disconnect();
23
23
  };
24
24
  }, [i]), s, () => 0)
25
25
  };
26
26
  }
27
27
  function A(i) {
28
- return [...i].sort((n, d) => {
29
- const s = n.order ?? 0, t = d.order ?? 0;
30
- return s !== t ? s - t : n.id.localeCompare(d.id);
28
+ return [...i].sort((n, a) => {
29
+ const s = n.order ?? 0, t = a.order ?? 0;
30
+ return s !== t ? s - t : n.id.localeCompare(a.id);
31
31
  });
32
32
  }
33
33
  function K(i) {
34
- const { items: n, leadSlot: d, actionSlot: s } = i, t = k({}), a = k(null), o = k(null), [l, v] = x({
34
+ const { items: n, leadSlot: a, actionSlot: s } = i, t = k({}), d = k(null), o = k(null), [l, v] = x({
35
35
  itemWidths: {},
36
36
  leadWidth: 0,
37
37
  actionWidth: 0
@@ -48,7 +48,7 @@ function K(i) {
48
48
  const w = t.current[u.id], N = Math.ceil(w?.getBoundingClientRect().width ?? u.estimatedWidth ?? 0);
49
49
  r[u.id] = N;
50
50
  }
51
- const m = d ? Math.ceil(a.current?.getBoundingClientRect().width ?? 0) : 0, g = s ? Math.ceil(o.current?.getBoundingClientRect().width ?? 0) : 0, W = f.current;
51
+ const m = a ? Math.ceil(d.current?.getBoundingClientRect().width ?? 0) : 0, g = s ? Math.ceil(o.current?.getBoundingClientRect().width ?? 0) : 0, W = f.current;
52
52
  (!(Object.keys(W.itemWidths).length === Object.keys(r).length && n.every((u) => W.itemWidths[u.id] === r[u.id])) || W.leadWidth !== m || W.actionWidth !== g) && v({
53
53
  itemWidths: r,
54
54
  leadWidth: m,
@@ -56,29 +56,29 @@ function K(i) {
56
56
  });
57
57
  }, [
58
58
  n,
59
- d,
59
+ a,
60
60
  s
61
61
  ]), {
62
62
  measurements: l,
63
63
  registerItemRef: p,
64
- leadRef: a,
64
+ leadRef: d,
65
65
  actionRef: o
66
66
  };
67
67
  }
68
68
  function U(i) {
69
- const { items: n, availableWidth: d, gapPx: s, itemWidths: t } = i, a = [];
69
+ const { items: n, availableWidth: a, gapPx: s, itemWidths: t } = i, d = [];
70
70
  let o = 0;
71
71
  for (const l of A(n)) {
72
- const v = Math.max(0, t[l.id] ?? l.estimatedWidth ?? 0), f = a.length === 0 ? v : o + s + v;
73
- if (f > d) break;
74
- a.push(l), o = f;
72
+ const v = Math.max(0, t[l.id] ?? l.estimatedWidth ?? 0), f = d.length === 0 ? v : o + s + v;
73
+ if (f > a) break;
74
+ d.push(l), o = f;
75
75
  }
76
- return a;
76
+ return d;
77
77
  }
78
- function b({ item: i, compact: n }) {
78
+ function C({ item: i, compact: n }) {
79
79
  return /* @__PURE__ */ e(D, { children: i.render({ compact: n }) });
80
80
  }
81
- function Y({ items: i, expanded: n, onToggleExpanded: d, leadSlot: s, actionSlot: t, className: a, leadReservePx: o = 140, actionReservePx: l = 44 }) {
81
+ function Y({ items: i, expanded: n, onToggleExpanded: a, leadSlot: s, actionSlot: t, className: d, leadReservePx: o = 140, actionReservePx: l = 44 }) {
82
82
  const { ref: v, width: f } = q(), p = !n, r = y(() => A(i), [i]), { measurements: m, registerItemRef: g, leadRef: W, actionRef: u } = K({
83
83
  items: r,
84
84
  leadSlot: s,
@@ -104,27 +104,27 @@ function Y({ items: i, expanded: n, onToggleExpanded: d, leadSlot: s, actionSlot
104
104
  ]), N = p && w.length < Math.min(2, r.length), E = N ? r.slice(0, 2) : w;
105
105
  return /* @__PURE__ */ I("div", {
106
106
  ref: v,
107
- className: C(h.root, p ? "overflow-hidden" : "overflow-visible", a),
107
+ className: b(h.root, "asma-pressable", p ? "overflow-hidden" : "overflow-visible", d),
108
108
  "aria-expanded": n,
109
109
  role: "button",
110
110
  tabIndex: 0,
111
- onClick: d,
111
+ onClick: a,
112
112
  onKeyDown: (c) => {
113
- (c.key === "Enter" || c.key === " ") && (c.preventDefault(), d());
113
+ (c.key === "Enter" || c.key === " ") && (c.preventDefault(), a());
114
114
  },
115
115
  children: [
116
116
  /* @__PURE__ */ I("div", {
117
- className: C(h.shell, p ? h.shellCompact : h.shellExpanded),
117
+ className: b(h.shell, p ? h.shellCompact : h.shellExpanded),
118
118
  children: [s ? /* @__PURE__ */ e("div", {
119
119
  className: "shrink-0",
120
120
  children: s
121
121
  }) : null, /* @__PURE__ */ e("div", {
122
122
  className: h.content,
123
123
  children: p ? /* @__PURE__ */ e("div", {
124
- className: C(h.compactItems, N && h.compactItemsStacked),
124
+ className: b(h.compactItems, N && h.compactItemsStacked),
125
125
  children: E.map((c) => /* @__PURE__ */ e("div", {
126
126
  className: "shrink-0 whitespace-nowrap",
127
- children: /* @__PURE__ */ e(b, {
127
+ children: /* @__PURE__ */ e(C, {
128
128
  item: c,
129
129
  compact: p
130
130
  })
@@ -133,7 +133,7 @@ function Y({ items: i, expanded: n, onToggleExpanded: d, leadSlot: s, actionSlot
133
133
  className: h.expandedItems,
134
134
  children: [r.map((c) => /* @__PURE__ */ e("div", {
135
135
  className: "shrink-0 whitespace-nowrap",
136
- children: /* @__PURE__ */ e(b, {
136
+ children: /* @__PURE__ */ e(C, {
137
137
  item: c,
138
138
  compact: p
139
139
  })
@@ -168,7 +168,7 @@ function Y({ items: i, expanded: n, onToggleExpanded: d, leadSlot: s, actionSlot
168
168
  r.map((c) => /* @__PURE__ */ e("div", {
169
169
  ref: g(c.id),
170
170
  className: "shrink-0 whitespace-nowrap",
171
- children: /* @__PURE__ */ e(b, {
171
+ children: /* @__PURE__ */ e(C, {
172
172
  item: c,
173
173
  compact: !0
174
174
  })
@@ -1,58 +1,59 @@
1
1
  import { cn as i } from "../../../helpers/cn.js";
2
- import { resolveSx as $ } from "../../../helpers/sx.js";
3
- import { CloseIcon as E } from "../../icons/close-icon/CloseIcon.js";
2
+ import { resolveSx as E } from "../../../helpers/sx.js";
3
+ import { CloseIcon as L } from "../../icons/close-icon/CloseIcon.js";
4
4
  import { consumerOverrides as x } from "../../../helpers/classOverride.js";
5
- import { getChipPadding as L } from "./chipPadding.js";
6
- import U from "./StyledChip.module.js";
7
- import { forwardRef as q } from "react";
8
- import { jsx as m, jsxs as A } from "react/jsx-runtime";
9
- var z = q(({ dataTest: g, label: l, size: r = "medium", disabled: t, readOnly: o, clickable: b, icon: w, avatar: u, deleteIcon: _, onDelete: c, onClick: p, onMouseDown: k, onMouseUp: y, className: h, classes: a, sx: S, tabIndex: v, "aria-label": j, role: s, "aria-checked": C, "aria-readonly": R, "data-hovered": B, "data-focus": D, variant: F, color: G }, M) => {
10
- const n = !o && !t && (!!b || !!p), f = u ?? w, d = L(r, !!f, !!(c && !o)), N = {
5
+ import { getChipPadding as U } from "./chipPadding.js";
6
+ import q from "./StyledChip.module.js";
7
+ import { forwardRef as A } from "react";
8
+ import { jsx as m, jsxs as F } from "react/jsx-runtime";
9
+ var O = A(({ dataTest: u, label: c, size: r = "medium", disabled: t, readOnly: o, clickable: b, icon: w, avatar: g, deleteIcon: y, onDelete: l, onClick: p, onMouseDown: _, onMouseUp: k, className: h, classes: a, sx: S, tabIndex: v, deleteButtonTabIndex: j, "aria-label": C, role: s, "aria-checked": R, "aria-readonly": B, "data-hovered": D, "data-focus": I, variant: G, color: H }, M) => {
10
+ const n = !o && !t && (!!b || !!p), f = g ?? w, d = U(r, !!f, !!(l && !o)), N = {
11
11
  paddingTop: d.top,
12
12
  paddingRight: d.right,
13
13
  paddingBottom: d.bottom,
14
14
  paddingLeft: d.left
15
- }, I = (e) => {
16
- e.stopPropagation(), c?.(e);
17
15
  }, K = (e) => {
16
+ e.stopPropagation(), l?.(e);
17
+ }, P = (e) => {
18
18
  n && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), p?.(e));
19
- }, P = x(h, "width"), W = x(h, "max-width");
20
- return /* @__PURE__ */ A("div", {
19
+ }, W = x(h, "width"), $ = x(h, "max-width");
20
+ return /* @__PURE__ */ F("div", {
21
21
  ref: M,
22
- "data-testid": g,
23
- "aria-label": j,
24
- "data-hovered": B,
25
- "data-focus": D,
22
+ "data-testid": u,
23
+ "aria-label": C,
24
+ "data-hovered": D,
25
+ "data-focus": I,
26
26
  role: s ?? (n ? "button" : void 0),
27
- "aria-checked": s ? C : void 0,
28
- "aria-readonly": s ? R : void 0,
29
- tabIndex: o ? void 0 : n ? v ?? 0 : v,
27
+ "aria-checked": s ? R : void 0,
28
+ "aria-readonly": s ? B : void 0,
29
+ tabIndex: o || t ? void 0 : n ? v ?? 0 : v,
30
30
  onClick: t || o ? void 0 : p,
31
- onKeyDown: t || o ? void 0 : K,
32
- onMouseDown: t || o ? void 0 : k,
33
- onMouseUp: t || o ? void 0 : y,
34
- className: i("box-border inline-flex items-center gap-1 rounded-[25px] border border-solid border-delta-300 bg-white text-base text-delta-700", !P && "w-fit", !W && "max-w-full", r === "small" ? "h-6" : "h-8", o && "pointer-events-none", t && "pointer-events-none opacity-[0.38]", n && i("cursor-pointer outline-none", "data-[hovered]:border-gama-200 data-[hovered]:bg-gama-25 hover:border-gama-200 hover:bg-gama-25", "active:!border-gama-400 active:bg-gama-25 active:shadow-[0_0_0_2px_var(--colors-gama-400)]"), U["focus-ring"], a?.root, h),
31
+ onKeyDown: t || o ? void 0 : P,
32
+ onMouseDown: t || o ? void 0 : _,
33
+ onMouseUp: t || o ? void 0 : k,
34
+ className: i("box-border inline-flex items-center gap-1 rounded-[25px] border border-solid border-delta-300 bg-white text-base text-delta-700", !W && "w-fit", !$ && "max-w-full", r === "small" ? "h-6" : "h-8", o && "pointer-events-none", t && "pointer-events-none opacity-[0.38]", n && i("cursor-pointer outline-none", "asma-touch-ready", "data-[hovered]:border-gama-200 data-[hovered]:bg-gama-25 hover:border-gama-200 hover:bg-gama-25", "active:!border-gama-400 active:bg-gama-25 active:shadow-[0_0_0_2px_var(--colors-gama-400)]"), q["focus-ring"], a?.root, h),
35
35
  style: {
36
36
  ...N,
37
- ...$(S)
37
+ ...E(S)
38
38
  },
39
39
  children: [
40
40
  f && /* @__PURE__ */ m("span", {
41
- className: i("flex shrink-0 items-center justify-center", r === "small" ? "h-[18px] w-[18px]" : "h-6 w-6", u ? a?.avatar : a?.icon),
41
+ className: i("flex shrink-0 items-center justify-center", r === "small" ? "h-[18px] w-[18px]" : "h-6 w-6", g ? a?.avatar : a?.icon),
42
42
  children: f
43
43
  }),
44
44
  /* @__PURE__ */ m("span", {
45
45
  className: i("min-w-0 truncate", a?.label),
46
- children: l
46
+ children: c
47
47
  }),
48
- c && !o && /* @__PURE__ */ m("button", {
48
+ l && !o && /* @__PURE__ */ m("button", {
49
49
  type: "button",
50
- "data-testid": `${g}-delete`,
51
- "aria-label": typeof l == "string" ? `Remove ${l}` : "Remove",
52
- onClick: I,
50
+ tabIndex: j,
51
+ "data-testid": `${u}-delete`,
52
+ "aria-label": typeof c == "string" ? `Remove ${c}` : "Remove",
53
+ onClick: K,
53
54
  disabled: t,
54
55
  className: i("flex shrink-0 items-center justify-center rounded-full border border-solid border-delta-100 bg-delta-50 p-0 text-delta-700 [outline:none]", r === "small" ? "h-[18px] w-[18px]" : "h-5 w-5", a?.deleteIcon),
55
- children: _ ?? /* @__PURE__ */ m(E, {
56
+ children: y ?? /* @__PURE__ */ m(L, {
56
57
  height: r === "small" ? 14 : 16,
57
58
  width: r === "small" ? 14 : 16,
58
59
  className: "min-w-0 shrink-0"
@@ -62,5 +63,5 @@ var z = q(({ dataTest: g, label: l, size: r = "medium", disabled: t, readOnly: o
62
63
  });
63
64
  });
64
65
  export {
65
- z as StyledChip
66
+ O as StyledChip
66
67
  };
@@ -1,63 +1,92 @@
1
- import { cn as S } from "../../../helpers/cn.js";
2
- import { resolveSx as M } from "../../../helpers/sx.js";
3
- import { TOP_LAYER_PROPS as U, TOP_LAYER_RESET_STYLE as Y, getOpenModalDialogAncestor as j, shouldUsePopoverTopLayer as k, useTopLayerRef as C } from "../../../hooks/useTopLayer.hook.js";
4
- import { cloneElement as D, useRef as H, useState as I } from "react";
5
- import { Fragment as N, jsx as f, jsxs as g } from "react/jsx-runtime";
6
- import { FloatingArrow as z, FloatingPortal as B, arrow as G, autoUpdate as W, flip as q, offset as J, shift as K, useDismiss as Q, useFloating as V, useFocus as X, useHover as Z, useInteractions as $, useMergeRefs as ee, useRole as oe } from "@floating-ui/react";
7
- var te = "#363E4A", pe = (e) => !e.title && e.title !== 0 ? e.children : /* @__PURE__ */ f(re, { ...e }), re = ({ title: e, children: t, placement: u = "top", arrow: r = !1, enterDelay: x = 500, leaveDelay: v = 0, open: p, onOpen: R, onClose: y, disableHoverListener: h, disableFocusListener: w, offsetDistance: F, className: T, slotProps: s }) => {
8
- const [_, E] = I(!1), l = p !== void 0, n = p ?? _, c = H(null), O = (m) => {
9
- l || E(m), m ? R?.() : y?.();
10
- }, { refs: i, floatingStyles: b, context: o } = V({
11
- open: n,
12
- onOpenChange: O,
13
- placement: u,
1
+ import { cn as N } from "../../../helpers/cn.js";
2
+ import { resolveSx as U } from "../../../helpers/sx.js";
3
+ import { firstTabbable as Y } from "../../../helpers/focusable.js";
4
+ import { TOP_LAYER_PROPS as j, TOP_LAYER_RESET_STYLE as k, getOpenModalDialogAncestor as D, shouldUsePopoverTopLayer as z, useTopLayerRef as G } from "../../../hooks/useTopLayer.hook.js";
5
+ import { Fragment as W, cloneElement as $, useEffect as q, useLayoutEffect as J, useRef as K, useState as Q } from "react";
6
+ import { Fragment as V, jsx as c, jsxs as v } from "react/jsx-runtime";
7
+ import { FloatingArrow as X, FloatingPortal as Z, arrow as ee, autoUpdate as te, flip as oe, offset as ne, safePolygon as re, shift as se, useDismiss as ie, useFloating as ae, useFocus as le, useHover as ce, useInteractions as fe, useMergeRefs as de, useRole as pe } from "@floating-ui/react";
8
+ var ue = "#363E4A", me = (t) => {
9
+ const n = document.createRange();
10
+ return n.selectNodeContents(t), n.getBoundingClientRect();
11
+ }, Te = (t) => !t.title && t.title !== 0 ? t.children : /* @__PURE__ */ c(ge, { ...t }), ge = ({ title: t, children: n, placement: x = "top", arrow: f = !1, enterDelay: h = 500, leaveDelay: E = 0, open: b, onOpen: F, onClose: T, disableHoverListener: A, disableFocusListener: P, offsetDistance: _, className: w, slotProps: d }) => {
12
+ const [L, O] = Q(!1), p = b !== void 0, s = b ?? L, R = K(null), S = (e) => {
13
+ p || O(e), e ? F?.() : T?.();
14
+ }, { refs: o, floatingStyles: C, context: r } = ae({
15
+ open: s,
16
+ onOpenChange: S,
17
+ placement: x,
14
18
  strategy: "fixed",
15
- whileElementsMounted: W,
19
+ whileElementsMounted: te,
16
20
  middleware: [
17
- J(F ?? (r ? 8 : 6)),
18
- q({ padding: 8 }),
19
- K({ padding: 8 }),
20
- ...r ? [G({ element: c })] : []
21
+ ne(_ ?? (f ? 8 : 6)),
22
+ oe({ padding: 8 }),
23
+ se({ padding: 8 }),
24
+ ...f ? [ee({ element: R })] : []
21
25
  ]
22
- }), { getReferenceProps: P, getFloatingProps: A } = $([
23
- Z(o, {
24
- enabled: !l && !h,
26
+ }), { getReferenceProps: M, getFloatingProps: B } = fe([
27
+ ce(r, {
28
+ enabled: !p && !A,
25
29
  delay: {
26
- open: x,
27
- close: v
30
+ open: h,
31
+ close: E
28
32
  },
29
- move: !1
33
+ move: !1,
34
+ handleClose: re()
30
35
  }),
31
- X(o, { enabled: !l && !w }),
32
- Q(o),
33
- oe(o, { role: "tooltip" })
34
- ]), d = n ? j(i.reference.current) : void 0, a = k(d), L = C(i.setFloating, a);
35
- return /* @__PURE__ */ g(N, { children: [D(t, P({
36
- ref: ee([i.setReference, t.ref]),
37
- ...t.props
38
- })), n && /* @__PURE__ */ f(B, {
39
- root: d,
40
- children: /* @__PURE__ */ g("div", {
41
- ref: L,
42
- ...a ? U : {},
43
- ...A(),
36
+ le(r, { enabled: !p && !P }),
37
+ ie(r),
38
+ pe(r, { role: "tooltip" })
39
+ ]), y = s ? D(o.domReference.current) : void 0, u = z(y), H = G(o.setFloating, u), { floatingId: i } = r;
40
+ q(() => {
41
+ const e = o.domReference.current;
42
+ if (!s || !i || !(e instanceof HTMLElement)) return;
43
+ const a = Y(e) ?? e, l = a.getAttribute("aria-describedby");
44
+ return a.setAttribute("aria-describedby", l ? `${l} ${i}` : i), () => {
45
+ l === null ? a.removeAttribute("aria-describedby") : a.setAttribute("aria-describedby", l);
46
+ };
47
+ }, [
48
+ s,
49
+ o.domReference,
50
+ i
51
+ ]);
52
+ const m = n.type === W, g = m ? /* @__PURE__ */ c("span", {
53
+ style: { display: "contents" },
54
+ children: n
55
+ }) : n;
56
+ J(() => {
57
+ const e = o.domReference.current;
58
+ !m || !e || o.setPositionReference({
59
+ contextElement: e,
60
+ getBoundingClientRect: () => me(e)
61
+ });
62
+ }, [m, o]);
63
+ const { ["aria-describedby"]: be, ...I } = M({
64
+ ref: de([o.setReference, g.ref]),
65
+ ...g.props
66
+ });
67
+ return /* @__PURE__ */ v(V, { children: [$(g, I), s && /* @__PURE__ */ c(Z, {
68
+ root: y,
69
+ children: /* @__PURE__ */ v("div", {
70
+ ref: H,
71
+ ...u ? j : {},
72
+ ...B(),
44
73
  style: {
45
- ...a ? Y : {},
46
- ...b,
74
+ ...u ? k : {},
75
+ ...C,
47
76
  fontFamily: "Roboto, Helvetica, Arial, sans-serif",
48
77
  overflow: "visible",
49
- ...s?.tooltip?.style,
50
- ...M(s?.tooltip?.sx)
78
+ ...d?.tooltip?.style,
79
+ ...U(d?.tooltip?.sx)
51
80
  },
52
- className: S("z-[1500] block max-w-[320px] whitespace-normal break-words rounded-[3px] bg-[#363E4A] px-2 py-1 text-sm leading-5 text-white shadow-[0px_1px_6px_0px_rgba(0,0,0,0.15)]", T, s?.tooltip?.className),
53
- children: [e, r && /* @__PURE__ */ f(z, {
54
- ref: c,
55
- context: o,
56
- fill: te
81
+ className: N("z-[1500] block max-w-[320px] whitespace-normal break-words rounded-[3px] bg-[#363E4A] px-2 py-1 text-sm leading-5 text-white shadow-[0px_1px_6px_0px_rgba(0,0,0,0.15)]", w, d?.tooltip?.className),
82
+ children: [t, f && /* @__PURE__ */ c(X, {
83
+ ref: R,
84
+ context: r,
85
+ fill: ue
57
86
  })]
58
87
  })
59
88
  })] });
60
89
  };
61
90
  export {
62
- pe as StyledTooltip
91
+ Te as StyledTooltip
63
92
  };
@@ -1,108 +1,112 @@
1
- import { cn as f } from "../../../helpers/cn.js";
2
- import { resolveSx as N } from "../../../helpers/sx.js";
3
- import { CloseIcon as X } from "../../icons/close-icon/CloseIcon.js";
4
- import { registerOpenModalDialog as B } from "../../../hooks/useTopLayer.hook.js";
5
- import { StyledButton as G } from "../../inputs/button/StyledButton.js";
1
+ import { cn as p } from "../../../helpers/cn.js";
2
+ import { resolveSx as S } from "../../../helpers/sx.js";
3
+ import { CloseIcon as B } from "../../icons/close-icon/CloseIcon.js";
4
+ import { registerOpenModalDialog as G } from "../../../hooks/useTopLayer.hook.js";
5
+ import { StyledButton as L } from "../../inputs/button/StyledButton.js";
6
6
  import { useMobileMediaQuery as P } from "../../../hooks/useMediaQuery.hook.js";
7
7
  import Q from "./StyledDialog.module.js";
8
- import { useEffect as D, useLayoutEffect as $, useRef as u } from "react";
9
- import { jsx as l, jsxs as r } from "react/jsx-runtime";
8
+ import { useEffect as D, useLayoutEffect as $, useRef as i } from "react";
9
+ import { jsx as r, jsxs as l } from "react/jsx-runtime";
10
10
  var J = {
11
11
  xs: 444,
12
12
  sm: 600,
13
13
  md: 900,
14
14
  lg: 1200,
15
15
  xl: 1536
16
- }, re = ({ open: t, onClose: a, children: S, dataTest: i, maxWidth: x = "sm", fullWidth: _, fullScreen: C, scroll: E = "paper", disableEscapeKeyDown: p, className: H, style: j, sx: M, classes: h, PaperProps: O, slotProps: o, onCloseText: y, showCloseIcon: w = !0, dialogLabel: d, dialogTitle: s, dialogHeaderNode: R }) => {
17
- const W = P(), v = u(null), c = u(!1), b = u(t), n = C ?? W;
16
+ }, ne = ({ open: t, onClose: a, children: C, dataTest: c, maxWidth: h = "sm", fullWidth: H, fullScreen: _, scroll: M = "paper", disableEscapeKeyDown: y, className: j, style: R, sx: O, classes: w, PaperProps: W, slotProps: n, onCloseText: v, showCloseIcon: b = !0, dialogLabel: d, dialogTitle: s, dialogHeaderNode: I }) => {
17
+ const z = P(), g = i(null), m = i(null), f = i(!1), k = i(t), o = _ ?? z;
18
18
  D(() => {
19
- b.current && !t && o?.transition?.onExited?.(), b.current = t;
20
- }, [t, o]), $(() => {
21
- const e = v.current;
22
- if (!(!e || !t))
23
- return e.open || (e.showModal(), e.focus({ preventScroll: !0 }), requestAnimationFrame(() => e.open && e.focus({ preventScroll: !0 }))), B(e);
19
+ k.current && !t && n?.transition?.onExited?.(), k.current = t;
20
+ }, [t, n]), $(() => {
21
+ const e = g.current;
22
+ if (!e || !t) return;
23
+ e.open || (m.current = document.activeElement instanceof HTMLElement ? document.activeElement : null, e.showModal(), e.focus({ preventScroll: !0 }), requestAnimationFrame(() => e.open && e.focus({ preventScroll: !0 })));
24
+ const x = G(e);
25
+ return () => {
26
+ x(), m.current?.isConnected && m.current.focus({ preventScroll: !0 });
27
+ };
24
28
  }, [t]), D(() => {
25
29
  if (!t) return;
26
- const e = document.body.style.overflow, K = document.documentElement.style.overflow;
30
+ const e = document.body.style.overflow, x = document.documentElement.style.overflow;
27
31
  return document.body.style.overflow = "hidden", document.documentElement.style.overflow = "hidden", () => {
28
- document.body.style.overflow = e, document.documentElement.style.overflow = K;
32
+ document.body.style.overflow = e, document.documentElement.style.overflow = x;
29
33
  };
30
34
  }, [t]);
31
- const m = {
32
- ...O,
33
- ...o?.paper
34
- }, g = x === !1 ? void 0 : J[x], { className: I, style: z, onClick: q, ...A } = o?.backdrop ?? {}, k = (e) => {
35
- c.current || (c.current = !0, window.setTimeout(() => {
36
- c.current = !1;
35
+ const u = {
36
+ ...W,
37
+ ...n?.paper
38
+ }, N = h === !1 ? void 0 : J[h], { className: q, style: A, onClick: F, ...K } = n?.backdrop ?? {}, E = (e) => {
39
+ f.current || (f.current = !0, window.setTimeout(() => {
40
+ f.current = !1;
37
41
  }, 0), a?.(e, "escapeKeyDown"));
38
- }, F = (e) => {
39
- e.preventDefault(), p || k(e);
42
+ }, X = (e) => {
43
+ e.preventDefault(), y || E(e);
40
44
  };
41
- return t ? /* @__PURE__ */ r("dialog", {
42
- ref: v,
45
+ return t ? /* @__PURE__ */ l("dialog", {
46
+ ref: g,
43
47
  tabIndex: -1,
44
- "data-testid": i,
45
- "aria-label": i,
46
- onCancel: F,
48
+ "data-testid": c,
49
+ "aria-label": c,
50
+ onCancel: X,
47
51
  onKeyDown: (e) => {
48
- e.key !== "Escape" || p || (e.preventDefault(), k(e));
52
+ e.key !== "Escape" || y || (e.preventDefault(), E(e));
49
53
  },
50
- className: f(Q.StyledDialog, "fixed inset-0 m-0 h-full max-h-none w-full max-w-none items-center justify-center overflow-hidden border-0 bg-transparent p-0 outline-none open:flex", E === "body" && "overflow-y-auto", H, h?.root),
54
+ className: p(Q.StyledDialog, "fixed inset-0 m-0 h-full max-h-none w-full max-w-none items-center justify-center overflow-hidden border-0 bg-transparent p-0 outline-none open:flex", M === "body" && "overflow-y-auto", j, w?.root),
51
55
  style: {
52
56
  zIndex: 999,
53
- ...N(M),
54
- ...j
57
+ ...S(O),
58
+ ...R
55
59
  },
56
- children: [/* @__PURE__ */ l("div", {
57
- ...A,
58
- className: f("absolute inset-0 bg-[#626e7eb2]", I),
59
- style: z,
60
+ children: [/* @__PURE__ */ r("div", {
61
+ ...K,
62
+ className: p("absolute inset-0 bg-[#626e7eb2]", q),
63
+ style: A,
60
64
  onClick: (e) => {
61
- q?.(e), e.defaultPrevented || a?.(e, "backdropClick");
65
+ F?.(e), e.defaultPrevented || a?.(e, "backdropClick");
62
66
  }
63
- }), /* @__PURE__ */ r("div", {
64
- className: f("relative z-[1] flex flex-col overflow-hidden rounded-lg border-0 bg-white p-0 text-delta-800 shadow-[0px_4px_40px_0px_#22213366]", n && "rounded-none", m.className, h?.paper),
67
+ }), /* @__PURE__ */ l("div", {
68
+ className: p("relative z-[1] flex flex-col overflow-hidden rounded-lg border-0 bg-white p-0 text-delta-800 shadow-[0px_4px_40px_0px_#22213366]", o && "rounded-none", u.className, w?.paper),
65
69
  style: {
66
70
  minWidth: 0,
67
71
  minHeight: 0,
68
- ...!n && g ? { maxWidth: g } : {},
69
- ...n ? {
72
+ ...!o && N ? { maxWidth: N } : {},
73
+ ...o ? {
70
74
  width: "100%",
71
75
  maxWidth: "100%",
72
76
  height: "100%",
73
77
  maxHeight: "100%"
74
78
  } : {
75
- width: _ ? "calc(100% - 64px)" : "auto",
79
+ width: H ? "calc(100% - 64px)" : "auto",
76
80
  maxHeight: "100%"
77
81
  },
78
- ...N(m.sx),
79
- ...m.style,
80
- ...n ? {
82
+ ...S(u.sx),
83
+ ...u.style,
84
+ ...o ? {
81
85
  width: "100%",
82
86
  maxWidth: "100%",
83
87
  height: "100%",
84
88
  maxHeight: "100%"
85
89
  } : { maxHeight: "calc(100% - 64px)" }
86
90
  },
87
- children: [(!!d || !!s || w) && /* @__PURE__ */ r("div", {
91
+ children: [(!!d || !!s || b) && /* @__PURE__ */ l("div", {
88
92
  className: "box-border flex w-full min-w-0 max-w-full justify-between px-4 pt-4",
89
- children: [/* @__PURE__ */ r("div", {
93
+ children: [/* @__PURE__ */ l("div", {
90
94
  className: "flex min-w-0 flex-1 flex-col justify-start gap-0.5",
91
- children: [d && /* @__PURE__ */ l("div", {
95
+ children: [d && /* @__PURE__ */ r("div", {
92
96
  className: "flex h-8 items-center text-sm font-normal leading-5 text-delta-600",
93
97
  children: d
94
- }), s && /* @__PURE__ */ l("div", {
98
+ }), s && /* @__PURE__ */ r("div", {
95
99
  className: "flex text-2xl font-semibold leading-8 text-delta-800",
96
100
  children: s
97
101
  })]
98
- }), w && /* @__PURE__ */ r("div", {
102
+ }), b && /* @__PURE__ */ l("div", {
99
103
  className: "flex min-w-0 max-w-full shrink-0 justify-end gap-2",
100
- children: [R, /* @__PURE__ */ l(G, {
101
- dataTest: `close-button-${i}`,
102
- "aria-label": y ? void 0 : "Close",
104
+ children: [I, /* @__PURE__ */ r(L, {
105
+ dataTest: `close-button-${c}`,
106
+ "aria-label": v ? void 0 : "Close",
103
107
  variant: "textGray",
104
108
  size: "small",
105
- endIcon: /* @__PURE__ */ l(X, {
109
+ endIcon: /* @__PURE__ */ r(B, {
106
110
  width: 20,
107
111
  height: 20
108
112
  }),
@@ -113,13 +117,13 @@ var J = {
113
117
  paddingRight: "6px",
114
118
  paddingLeft: "6px"
115
119
  },
116
- children: y
120
+ children: v
117
121
  })]
118
122
  })]
119
- }), S]
123
+ }), C]
120
124
  })]
121
125
  }) : null;
122
126
  };
123
127
  export {
124
- re as StyledDialog
128
+ ne as StyledDialog
125
129
  };