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.
- package/dist/asma-ui-core.css +1 -1
- package/dist/components/custom/pathfinder-card/PathfinderCard.js +28 -28
- package/dist/components/data-display/chip/StyledChip.js +33 -32
- package/dist/components/data-display/tooltip/StyledTooltip.js +76 -47
- package/dist/components/feedback/dialog/StyledDialog.js +62 -58
- package/dist/components/feedback/minimizable-dialog/MinimizableDialog.js +113 -105
- package/dist/components/feedback/minimizable-dialog/components/FullscreenBtn.js +10 -12
- package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +75 -67
- package/dist/components/feedback/snack-bar/StyledSnackbar.js +12 -10
- package/dist/components/feedback/snack-bar/components/StyledInfoSnackbar.js +10 -10
- package/dist/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.js +69 -71
- package/dist/components/inputs/input-field/StyledInputField.js +25 -24
- package/dist/components/inputs/phone-field/CountryCodeOptions.js +16 -15
- package/dist/components/inputs/phone-field/CountryCodeSelect.js +98 -85
- package/dist/components/inputs/phone-field/useCountryPicker.js +44 -24
- package/dist/components/inputs/search-field/StyledSearchField.js +10 -10
- package/dist/components/inputs/select/StyledSelect.js +16 -15
- package/dist/components/inputs/select/StyledSelectItem.js +9 -9
- package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +202 -175
- package/dist/components/inputs/switch/base-ui/StyledSwitch.js +22 -22
- package/dist/components/navigation/link/StyledLink.js +8 -8
- package/dist/components/navigation/listbox/Listbox.js +105 -54
- package/dist/components/navigation/menu/StyledMenu.js +22 -18
- package/dist/components/navigation/menu/StyledMenuItem.js +6 -6
- package/dist/components/navigation/title-chevron/StyledTitleChevron.js +7 -7
- package/dist/components/utils/accordion/base-ui/StyledAccordionDetails.js +26 -22
- package/dist/components/utils/accordion/base-ui/StyledAccordionSummary.js +14 -14
- package/dist/components/utils/copy-wrapper/CopyWrapper.module.js +2 -2
- package/dist/components/utils/popover/StyledPopover.js +102 -52
- package/dist/datetime/components/date-picker/StyledDatePicker.js +40 -34
- package/dist/datetime/components/date-picker/components/StyledCalendarPicker.js +5 -4
- package/dist/datetime/components/time-picker/StyledTimePicker.js +69 -56
- package/dist/helpers/focusable.js +5 -0
- package/dist/hooks/useFocusTrap.hook.js +24 -19
- package/dist/src/components/data-display/chip/StyledChip.d.ts +2 -0
- package/dist/src/components/inputs/dynamic-select/StyledDynamicSelect.d.ts +3 -4
- package/dist/src/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.test.d.ts +1 -0
- package/dist/src/components/inputs/phone-field/CountryCodeOptions.d.ts +1 -1
- package/dist/src/components/inputs/phone-field/useCountryPicker.d.ts +5 -2
- package/dist/src/components/navigation/listbox/Listbox.d.ts +3 -2
- package/dist/src/components/navigation/menu/StyledMenu.d.ts +3 -2
- package/dist/src/components/utils/accordion/base-ui/StyledAccordionDetails.d.ts +2 -1
- package/dist/src/components/utils/popover/StyledPopover.d.ts +9 -2
- package/dist/src/helpers/focusable.d.ts +8 -0
- package/dist/src/hooks/useFocusTrap.hook.d.ts +2 -1
- package/dist/table/components/columns/action-column/components/RowActionMenu.js +30 -34
- package/dist/table/components/table-footer/TablePagination.js +18 -17
- package/dist/table/components/table-footer/TableRowCountSelect.js +5 -4
- package/package.json +1 -1
- package/src/styles/touchHardening.interaction.test.tsx +269 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cn as
|
|
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),
|
|
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:
|
|
13
|
+
ref: a,
|
|
14
14
|
width: P(R((t) => {
|
|
15
15
|
if (!i || typeof ResizeObserver > "u") return () => {
|
|
16
16
|
};
|
|
17
|
-
let
|
|
17
|
+
let d = 0;
|
|
18
18
|
const o = new ResizeObserver(() => {
|
|
19
|
-
cancelAnimationFrame(
|
|
19
|
+
cancelAnimationFrame(d), d = requestAnimationFrame(t);
|
|
20
20
|
});
|
|
21
21
|
return o.observe(i), () => {
|
|
22
|
-
cancelAnimationFrame(
|
|
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,
|
|
29
|
-
const s = n.order ?? 0, t =
|
|
30
|
-
return s !== t ? s - t : n.id.localeCompare(
|
|
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:
|
|
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 =
|
|
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
|
-
|
|
59
|
+
a,
|
|
60
60
|
s
|
|
61
61
|
]), {
|
|
62
62
|
measurements: l,
|
|
63
63
|
registerItemRef: p,
|
|
64
|
-
leadRef:
|
|
64
|
+
leadRef: d,
|
|
65
65
|
actionRef: o
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
function U(i) {
|
|
69
|
-
const { items: n, availableWidth:
|
|
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 =
|
|
73
|
-
if (f >
|
|
74
|
-
|
|
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
|
|
76
|
+
return d;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
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:
|
|
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:
|
|
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:
|
|
111
|
+
onClick: a,
|
|
112
112
|
onKeyDown: (c) => {
|
|
113
|
-
(c.key === "Enter" || c.key === " ") && (c.preventDefault(),
|
|
113
|
+
(c.key === "Enter" || c.key === " ") && (c.preventDefault(), a());
|
|
114
114
|
},
|
|
115
115
|
children: [
|
|
116
116
|
/* @__PURE__ */ I("div", {
|
|
117
|
-
className:
|
|
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:
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
|
3
|
-
import { CloseIcon as
|
|
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
|
|
6
|
-
import
|
|
7
|
-
import { forwardRef as
|
|
8
|
-
import { jsx as m, jsxs as
|
|
9
|
-
var
|
|
10
|
-
const n = !o && !t && (!!b || !!p), f =
|
|
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
|
-
},
|
|
20
|
-
return /* @__PURE__ */
|
|
19
|
+
}, W = x(h, "width"), $ = x(h, "max-width");
|
|
20
|
+
return /* @__PURE__ */ F("div", {
|
|
21
21
|
ref: M,
|
|
22
|
-
"data-testid":
|
|
23
|
-
"aria-label":
|
|
24
|
-
"data-hovered":
|
|
25
|
-
"data-focus":
|
|
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 ?
|
|
28
|
-
"aria-readonly": s ?
|
|
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 :
|
|
32
|
-
onMouseDown: t || o ? void 0 :
|
|
33
|
-
onMouseUp: t || o ? void 0 :
|
|
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", !
|
|
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
|
-
|
|
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",
|
|
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:
|
|
46
|
+
children: c
|
|
47
47
|
}),
|
|
48
|
-
|
|
48
|
+
l && !o && /* @__PURE__ */ m("button", {
|
|
49
49
|
type: "button",
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
|
|
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:
|
|
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
|
-
|
|
66
|
+
O as StyledChip
|
|
66
67
|
};
|
|
@@ -1,63 +1,92 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { resolveSx as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { Fragment as
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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:
|
|
19
|
+
whileElementsMounted: te,
|
|
16
20
|
middleware: [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
...
|
|
21
|
+
ne(_ ?? (f ? 8 : 6)),
|
|
22
|
+
oe({ padding: 8 }),
|
|
23
|
+
se({ padding: 8 }),
|
|
24
|
+
...f ? [ee({ element: R })] : []
|
|
21
25
|
]
|
|
22
|
-
}), { getReferenceProps:
|
|
23
|
-
|
|
24
|
-
enabled: !
|
|
26
|
+
}), { getReferenceProps: M, getFloatingProps: B } = fe([
|
|
27
|
+
ce(r, {
|
|
28
|
+
enabled: !p && !A,
|
|
25
29
|
delay: {
|
|
26
|
-
open:
|
|
27
|
-
close:
|
|
30
|
+
open: h,
|
|
31
|
+
close: E
|
|
28
32
|
},
|
|
29
|
-
move: !1
|
|
33
|
+
move: !1,
|
|
34
|
+
handleClose: re()
|
|
30
35
|
}),
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
]),
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
...
|
|
46
|
-
...
|
|
74
|
+
...u ? k : {},
|
|
75
|
+
...C,
|
|
47
76
|
fontFamily: "Roboto, Helvetica, Arial, sans-serif",
|
|
48
77
|
overflow: "visible",
|
|
49
|
-
...
|
|
50
|
-
...
|
|
78
|
+
...d?.tooltip?.style,
|
|
79
|
+
...U(d?.tooltip?.sx)
|
|
51
80
|
},
|
|
52
|
-
className:
|
|
53
|
-
children: [
|
|
54
|
-
ref:
|
|
55
|
-
context:
|
|
56
|
-
fill:
|
|
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
|
-
|
|
91
|
+
Te as StyledTooltip
|
|
63
92
|
};
|
|
@@ -1,108 +1,112 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { resolveSx as
|
|
3
|
-
import { CloseIcon as
|
|
4
|
-
import { registerOpenModalDialog as
|
|
5
|
-
import { StyledButton as
|
|
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
|
|
9
|
-
import { jsx as
|
|
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
|
-
},
|
|
17
|
-
const
|
|
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
|
-
|
|
20
|
-
}, [t,
|
|
21
|
-
const e =
|
|
22
|
-
if (!
|
|
23
|
-
|
|
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,
|
|
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 =
|
|
32
|
+
document.body.style.overflow = e, document.documentElement.style.overflow = x;
|
|
29
33
|
};
|
|
30
34
|
}, [t]);
|
|
31
|
-
const
|
|
32
|
-
...
|
|
33
|
-
...
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
},
|
|
39
|
-
e.preventDefault(),
|
|
42
|
+
}, X = (e) => {
|
|
43
|
+
e.preventDefault(), y || E(e);
|
|
40
44
|
};
|
|
41
|
-
return t ? /* @__PURE__ */
|
|
42
|
-
ref:
|
|
45
|
+
return t ? /* @__PURE__ */ l("dialog", {
|
|
46
|
+
ref: g,
|
|
43
47
|
tabIndex: -1,
|
|
44
|
-
"data-testid":
|
|
45
|
-
"aria-label":
|
|
46
|
-
onCancel:
|
|
48
|
+
"data-testid": c,
|
|
49
|
+
"aria-label": c,
|
|
50
|
+
onCancel: X,
|
|
47
51
|
onKeyDown: (e) => {
|
|
48
|
-
e.key !== "Escape" ||
|
|
52
|
+
e.key !== "Escape" || y || (e.preventDefault(), E(e));
|
|
49
53
|
},
|
|
50
|
-
className:
|
|
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
|
-
...
|
|
54
|
-
...
|
|
57
|
+
...S(O),
|
|
58
|
+
...R
|
|
55
59
|
},
|
|
56
|
-
children: [/* @__PURE__ */
|
|
57
|
-
...
|
|
58
|
-
className:
|
|
59
|
-
style:
|
|
60
|
+
children: [/* @__PURE__ */ r("div", {
|
|
61
|
+
...K,
|
|
62
|
+
className: p("absolute inset-0 bg-[#626e7eb2]", q),
|
|
63
|
+
style: A,
|
|
60
64
|
onClick: (e) => {
|
|
61
|
-
|
|
65
|
+
F?.(e), e.defaultPrevented || a?.(e, "backdropClick");
|
|
62
66
|
}
|
|
63
|
-
}), /* @__PURE__ */
|
|
64
|
-
className:
|
|
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
|
-
...!
|
|
69
|
-
...
|
|
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:
|
|
79
|
+
width: H ? "calc(100% - 64px)" : "auto",
|
|
76
80
|
maxHeight: "100%"
|
|
77
81
|
},
|
|
78
|
-
...
|
|
79
|
-
...
|
|
80
|
-
...
|
|
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 ||
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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
|
-
}),
|
|
102
|
+
}), b && /* @__PURE__ */ l("div", {
|
|
99
103
|
className: "flex min-w-0 max-w-full shrink-0 justify-end gap-2",
|
|
100
|
-
children: [
|
|
101
|
-
dataTest: `close-button-${
|
|
102
|
-
"aria-label":
|
|
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__ */
|
|
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:
|
|
120
|
+
children: v
|
|
117
121
|
})]
|
|
118
122
|
})]
|
|
119
|
-
}),
|
|
123
|
+
}), C]
|
|
120
124
|
})]
|
|
121
125
|
}) : null;
|
|
122
126
|
};
|
|
123
127
|
export {
|
|
124
|
-
|
|
128
|
+
ne as StyledDialog
|
|
125
129
|
};
|