asma-ui-core 3.108.2 → 3.108.4
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/feedback/dialog/StyledDialog.js +139 -96
- package/dist/components/feedback/minimizable-dialog/MinimizableDialog.js +180 -171
- package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +115 -106
- package/dist/components/inputs/select/StyledSelect.js +56 -50
- package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +102 -96
- package/dist/components/navigation/drawer/StyledDrawer.js +55 -51
- package/dist/components/utils/bottom-sheet/StyledBottomSheet.js +158 -118
- package/dist/components/utils/popover/PopoverSheet.js +95 -85
- package/dist/components/utils/popover/StyledPopover.js +81 -71
- package/dist/datetime/components/date-picker/StyledDatePicker.js +33 -28
- package/dist/datetime/components/date-picker/components/StyledCalendarPicker.js +9 -8
- package/dist/datetime/components/time-picker/StyledTimePicker.js +56 -51
- package/dist/datetime/hooks/useBackNavigationClose.hook.js +16 -7
- package/dist/hooks/useBackCloses.hook.js +100 -0
- package/dist/src/components/feedback/dialog/StyledDialog.d.ts +6 -1
- package/dist/src/components/navigation/drawer/StyledDrawer.d.ts +2 -0
- package/dist/src/components/utils/bottom-sheet/StyledBottomSheet.d.ts +6 -2
- package/dist/src/components/utils/popover/StyledPopover.d.ts +3 -1
- package/dist/src/datetime/hooks/useBackNavigationClose.hook.d.ts +2 -1
- package/dist/src/hooks/useBackCloses.hook.d.ts +101 -0
- package/dist/src/hooks/useBackCloses.hook.test.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,53 +1,59 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { firstTabbable as
|
|
1
|
+
import { cn as a } from "../../../../helpers/cn.js";
|
|
2
|
+
import { firstTabbable as O } from "../../../../helpers/focusable.js";
|
|
3
3
|
import { StyledTooltip as te } from "../../../data-display/tooltip/StyledTooltip.js";
|
|
4
|
-
import { DialogBusyContext as
|
|
4
|
+
import { DialogBusyContext as A, useDialogBusyBoundary as ie } from "../../dialog/DialogBusyContext.js";
|
|
5
5
|
import { useMobileMediaQuery as le } from "../../../../hooks/useMediaQuery.hook.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
import { OverlayBackOwnerContext as ne, useBackCloses as oe } from "../../../../hooks/useBackCloses.hook.js";
|
|
7
|
+
import { useFocusTrap as re } from "../../../../hooks/useFocusTrap.hook.js";
|
|
8
|
+
import { CloseBtn as $ } from "../components/CloseBtn.js";
|
|
9
|
+
import { MinimizeBtn as q } from "../components/MinimizeBtn.js";
|
|
10
|
+
import { FullScreenBtn as se } from "../components/FullscreenBtn.js";
|
|
11
|
+
import h from "./MinimizableDialogV2.module.js";
|
|
12
|
+
import { useTranslations as ce } from "./useTranslations.js";
|
|
13
|
+
import { useControlledProps as ae } from "./useControlledProps.js";
|
|
14
|
+
import de from "clsx";
|
|
15
|
+
import { useId as V, useLayoutEffect as H, useRef as d } from "react";
|
|
16
|
+
import { Fragment as me, jsx as e, jsxs as r } from "react/jsx-runtime";
|
|
17
|
+
var Te = (C) => {
|
|
18
|
+
const { showCloseIcon: R = !0, showMinimizeIcon: L = !0, showExpandIcon: W = !0, enableFullscreen: _ = !0, title: u, label: f, children: Q, open: i, onClose: U, classNameOverrides: b = {
|
|
18
19
|
maximized: "",
|
|
19
20
|
minimized: "",
|
|
20
21
|
fullscreen: ""
|
|
21
|
-
}, dataTest: G, actionNode: J, locale: K = "en", busyReason: X, style:
|
|
22
|
-
|
|
22
|
+
}, dataTest: G, actionNode: J, locale: K = "en", busyReason: X, style: N, initialFocusRef: S } = C, s = le(), l = ce(K), n = d(null), p = d(null), F = d(null), B = d(null), g = d(!1), y = d(null), x = V(), T = V(), { minimized: t, setMinimized: I, fullScreen: o, setFullScreen: M } = ae(C), c = o && !t, { busy: z, busyReason: k, contextValue: E } = ie(X ?? l.waitUntilSaved), v = () => {
|
|
23
|
+
if (z) return !1;
|
|
24
|
+
I(!1), U();
|
|
23
25
|
};
|
|
24
26
|
H(() => {
|
|
25
|
-
|
|
27
|
+
n.current?.toggleAttribute("inert", t), p.current?.toggleAttribute("inert", !t);
|
|
26
28
|
}, [t]), H(() => {
|
|
27
|
-
const w =
|
|
28
|
-
if (
|
|
29
|
-
const
|
|
30
|
-
|
|
29
|
+
const w = i && !g.current, m = !i && g.current;
|
|
30
|
+
if (g.current = i, m) {
|
|
31
|
+
const D = y.current;
|
|
32
|
+
y.current = null, (!document.activeElement || document.activeElement === document.body) && D?.isConnected && D.focus({ preventScroll: !0 });
|
|
31
33
|
return;
|
|
32
34
|
}
|
|
33
35
|
if (!w) return;
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
(S?.current ?? ee ?? (
|
|
36
|
+
y.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
37
|
+
const P = t ? p.current : n.current, ee = t ? B.current : F.current;
|
|
38
|
+
(S?.current ?? ee ?? (P ? O(P) : void 0))?.focus({ preventScroll: !0 });
|
|
37
39
|
}, [
|
|
38
40
|
S,
|
|
39
41
|
t,
|
|
40
|
-
|
|
42
|
+
i
|
|
41
43
|
]);
|
|
42
|
-
const
|
|
43
|
-
const w = t ?
|
|
44
|
-
|
|
44
|
+
const j = () => {
|
|
45
|
+
const w = t ? n : p;
|
|
46
|
+
I(!t), requestAnimationFrame(() => {
|
|
45
47
|
const m = w.current;
|
|
46
|
-
m && (m.querySelector('[data-testid="toggle-minimize-btn"]') ??
|
|
48
|
+
m && (m.querySelector('[data-testid="toggle-minimize-btn"]') ?? O(m))?.focus({ preventScroll: !0 });
|
|
47
49
|
});
|
|
48
50
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
re(i && c, n, v), oe({
|
|
52
|
+
active: i && c,
|
|
53
|
+
requestClose: v,
|
|
54
|
+
ownerRef: n
|
|
55
|
+
});
|
|
56
|
+
const Y = c ? s ? {
|
|
51
57
|
inset: 0,
|
|
52
58
|
maxHeight: "100dvh",
|
|
53
59
|
maxWidth: "100dvw",
|
|
@@ -64,18 +70,18 @@ var Se = (N) => {
|
|
|
64
70
|
maxWidth: "min(1000px, calc(100vw - 32px))",
|
|
65
71
|
height: "95dvh"
|
|
66
72
|
} : void 0;
|
|
67
|
-
if (!
|
|
68
|
-
const Z = f ? `${
|
|
69
|
-
return /* @__PURE__ */
|
|
73
|
+
if (!i) return null;
|
|
74
|
+
const Z = f ? `${T} ${x}` : x;
|
|
75
|
+
return /* @__PURE__ */ r(me, { children: [
|
|
70
76
|
/* @__PURE__ */ e("div", {
|
|
71
77
|
ref: p,
|
|
72
78
|
style: {
|
|
73
79
|
zIndex: 51,
|
|
74
|
-
...
|
|
80
|
+
...N
|
|
75
81
|
},
|
|
76
|
-
className:
|
|
77
|
-
children: /* @__PURE__ */
|
|
78
|
-
className:
|
|
82
|
+
className: a(h["minimized-dialog"], !t && h.hidden, b.minimized),
|
|
83
|
+
children: /* @__PURE__ */ r("div", {
|
|
84
|
+
className: de("flex items-center justify-between", !t && "hidden"),
|
|
79
85
|
"data-testid": G,
|
|
80
86
|
children: [/* @__PURE__ */ e("div", {
|
|
81
87
|
className: "max-w-[303px] truncate pr-1 text-lg font-semibold text-delta-800",
|
|
@@ -87,97 +93,100 @@ var Se = (N) => {
|
|
|
87
93
|
children: u
|
|
88
94
|
})
|
|
89
95
|
})
|
|
90
|
-
}), /* @__PURE__ */
|
|
96
|
+
}), /* @__PURE__ */ r("div", {
|
|
91
97
|
className: "flex items-center gap-x-1",
|
|
92
|
-
children: [/* @__PURE__ */ e(
|
|
98
|
+
children: [/* @__PURE__ */ e(q, {
|
|
93
99
|
type: "expand",
|
|
94
100
|
visibility: W,
|
|
95
|
-
onClick:
|
|
96
|
-
tooltipTitle:
|
|
97
|
-
}), /* @__PURE__ */ e(
|
|
98
|
-
buttonRef:
|
|
101
|
+
onClick: j,
|
|
102
|
+
tooltipTitle: l.expand
|
|
103
|
+
}), /* @__PURE__ */ e($, {
|
|
104
|
+
buttonRef: B,
|
|
99
105
|
showCloseIcon: R,
|
|
100
|
-
onClick:
|
|
101
|
-
disabledReason:
|
|
102
|
-
tooltipTitle:
|
|
106
|
+
onClick: v,
|
|
107
|
+
disabledReason: z ? k : void 0,
|
|
108
|
+
tooltipTitle: l.close
|
|
103
109
|
})]
|
|
104
110
|
})]
|
|
105
111
|
})
|
|
106
112
|
}),
|
|
107
|
-
|
|
113
|
+
c && /* @__PURE__ */ e("div", {
|
|
108
114
|
className: "fixed inset-0 z-[52] bg-[rgb(98,110,126)] bg-opacity-70",
|
|
109
115
|
onClick: () => {
|
|
110
|
-
|
|
116
|
+
M(!1);
|
|
111
117
|
}
|
|
112
118
|
}),
|
|
113
|
-
/* @__PURE__ */
|
|
119
|
+
/* @__PURE__ */ e("div", {
|
|
114
120
|
style: {
|
|
115
121
|
zIndex: 51,
|
|
116
|
-
...
|
|
122
|
+
...N,
|
|
117
123
|
...Y
|
|
118
124
|
},
|
|
119
|
-
ref:
|
|
125
|
+
ref: n,
|
|
120
126
|
role: "dialog",
|
|
121
|
-
"aria-modal":
|
|
127
|
+
"aria-modal": c ? !0 : void 0,
|
|
122
128
|
"aria-labelledby": Z,
|
|
123
|
-
className:
|
|
124
|
-
children:
|
|
125
|
-
|
|
126
|
-
children: [/* @__PURE__ */
|
|
127
|
-
className: "flex
|
|
128
|
-
children: [
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
className: a(h.dialog, t && h.hidden, !o && b.maximized, o && b.fullscreen, c && "fixed z-[53] duration-0"),
|
|
130
|
+
children: /* @__PURE__ */ r(ne.Provider, {
|
|
131
|
+
value: n,
|
|
132
|
+
children: [/* @__PURE__ */ r("div", {
|
|
133
|
+
className: a("flex flex-col border-b-[1px] border-delta-200 px-4", s ? "py-3" : "py-4"),
|
|
134
|
+
children: [/* @__PURE__ */ r("div", {
|
|
135
|
+
className: "flex items-center justify-between",
|
|
136
|
+
children: [f ? /* @__PURE__ */ e("div", {
|
|
137
|
+
id: T,
|
|
138
|
+
className: "text-sm text-delta-700",
|
|
139
|
+
children: f
|
|
140
|
+
}) : /* @__PURE__ */ e("div", {
|
|
141
|
+
id: x,
|
|
142
|
+
className: a("font-semibold text-delta-800", s ? "line-clamp-2 text-xl" : "line-clamp-1 text-2xl"),
|
|
143
|
+
children: u
|
|
144
|
+
}), /* @__PURE__ */ r("div", {
|
|
145
|
+
className: "flex items-center gap-x-1",
|
|
146
|
+
children: [
|
|
147
|
+
/* @__PURE__ */ e(A.Provider, {
|
|
148
|
+
value: E,
|
|
149
|
+
children: J
|
|
150
|
+
}),
|
|
151
|
+
/* @__PURE__ */ e(q, {
|
|
152
|
+
visibility: L && !s && !o,
|
|
153
|
+
type: "minimize",
|
|
154
|
+
onClick: j,
|
|
155
|
+
tooltipTitle: l.minimize
|
|
156
|
+
}),
|
|
157
|
+
/* @__PURE__ */ e(se, {
|
|
158
|
+
showFullScreenIcon: _ && !s,
|
|
159
|
+
fullScreen: o,
|
|
160
|
+
onClick: () => {
|
|
161
|
+
M(!o);
|
|
162
|
+
},
|
|
163
|
+
tooltipTitle: o ? l.exitFullscreen : l.fullscreen
|
|
164
|
+
}),
|
|
165
|
+
/* @__PURE__ */ e($, {
|
|
166
|
+
buttonRef: F,
|
|
167
|
+
showCloseIcon: R,
|
|
168
|
+
onClick: v,
|
|
169
|
+
disabledReason: z ? k : void 0,
|
|
170
|
+
tooltipTitle: l.close
|
|
171
|
+
})
|
|
172
|
+
]
|
|
173
|
+
})]
|
|
174
|
+
}), f && /* @__PURE__ */ e("div", {
|
|
133
175
|
id: x,
|
|
134
|
-
className:
|
|
176
|
+
className: a("font-semibold text-delta-800", s ? "line-clamp-2 text-xl" : "line-clamp-1 text-2xl"),
|
|
135
177
|
children: u
|
|
136
|
-
}), /* @__PURE__ */ n("div", {
|
|
137
|
-
className: "flex items-center gap-x-1",
|
|
138
|
-
children: [
|
|
139
|
-
/* @__PURE__ */ e($.Provider, {
|
|
140
|
-
value: j,
|
|
141
|
-
children: J
|
|
142
|
-
}),
|
|
143
|
-
/* @__PURE__ */ e(V, {
|
|
144
|
-
visibility: L && !r && !l,
|
|
145
|
-
type: "minimize",
|
|
146
|
-
onClick: k,
|
|
147
|
-
tooltipTitle: i.minimize
|
|
148
|
-
}),
|
|
149
|
-
/* @__PURE__ */ e(oe, {
|
|
150
|
-
showFullScreenIcon: _ && !r,
|
|
151
|
-
fullScreen: l,
|
|
152
|
-
onClick: () => {
|
|
153
|
-
B(!l);
|
|
154
|
-
},
|
|
155
|
-
tooltipTitle: l ? i.exitFullscreen : i.fullscreen
|
|
156
|
-
}),
|
|
157
|
-
/* @__PURE__ */ e(O, {
|
|
158
|
-
buttonRef: F,
|
|
159
|
-
showCloseIcon: R,
|
|
160
|
-
onClick: z,
|
|
161
|
-
disabledReason: y ? E : void 0,
|
|
162
|
-
tooltipTitle: i.close
|
|
163
|
-
})
|
|
164
|
-
]
|
|
165
178
|
})]
|
|
166
|
-
}),
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
179
|
+
}), /* @__PURE__ */ e("div", {
|
|
180
|
+
className: a(t && "hidden", "flex flex-grow flex-col overflow-y-auto overscroll-contain"),
|
|
181
|
+
children: /* @__PURE__ */ e(A.Provider, {
|
|
182
|
+
value: E,
|
|
183
|
+
children: Q
|
|
184
|
+
})
|
|
170
185
|
})]
|
|
171
|
-
})
|
|
172
|
-
className: s(t && "hidden", "flex flex-grow flex-col overflow-y-auto overscroll-contain"),
|
|
173
|
-
children: /* @__PURE__ */ e($.Provider, {
|
|
174
|
-
value: j,
|
|
175
|
-
children: Q
|
|
176
|
-
})
|
|
177
|
-
})]
|
|
186
|
+
})
|
|
178
187
|
})
|
|
179
188
|
] });
|
|
180
189
|
};
|
|
181
190
|
export {
|
|
182
|
-
|
|
191
|
+
Te as MinimizableDialogV2
|
|
183
192
|
};
|
|
@@ -3,46 +3,52 @@ import { resolveSx as je } from "../../../helpers/sx.js";
|
|
|
3
3
|
import { TOP_LAYER_PROPS as Ue, TOP_LAYER_RESET_STYLE as Ve, getOpenModalDialogAncestor as re, shouldUsePopoverTopLayer as qe, useTopLayerRef as Ye } from "../../../hooks/useTopLayer.hook.js";
|
|
4
4
|
import { ChevronDownIcon as ze } from "../../icons/chevron-down-icon/ChevronDownIcon.js";
|
|
5
5
|
import { CloseIcon as Ke } from "../../icons/close-icon/CloseIcon.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
6
|
+
import { useBackCloses as We } from "../../../hooks/useBackCloses.hook.js";
|
|
7
|
+
import { HelperRow as Ge } from "../../../helpers/HelperRow.js";
|
|
8
|
+
import { useHelperRowBudget as Je } from "../../../helpers/useHelperRowBudget.js";
|
|
9
|
+
import { useHelperSlot as Qe } from "../../../helpers/useHelperSlot.js";
|
|
10
|
+
import { outlineClass as Xe } from "../field-styles.js";
|
|
11
|
+
import { useFormControlContext as Ze } from "../../miscellaneous/FormControlContext.js";
|
|
12
|
+
import { Children as se, cloneElement as et, isValidElement as p, useEffect as H, useId as tt, useRef as ot, useState as x } from "react";
|
|
12
13
|
import { jsx as l, jsxs as L } from "react/jsx-runtime";
|
|
13
|
-
import { FloatingPortal as
|
|
14
|
-
var
|
|
15
|
-
const u =
|
|
16
|
-
K(e), e ||
|
|
17
|
-
}, { refs: { domReference: De, reference: J, setFloating: Se, setReference: Ce }, floatingStyles: Fe, context: P } =
|
|
14
|
+
import { FloatingPortal as rt, autoUpdate as st, flip as nt, offset as lt, shift as it, size as at, useClick as ct, useDismiss as dt, useFloating as ut, useInteractions as ft, useMergeRefs as pt, useRole as mt } from "@floating-ui/react";
|
|
15
|
+
var It = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, errorText: ie, helperText: j, reserveHelperText: ae, expandHelperText: ce = !0, allowClear: U, disabled: de, readOnly: c, name: w, placeholder: S, displayEmpty: C, multiple: d, renderValue: V, fullWidth: ue, className: fe, style: pe, sx: me, variant: ge, children: q, MenuProps: be, onFocus: ye, onBlur: he, labelId: v }) => {
|
|
16
|
+
const u = Ze(), A = `${T}-listbox`, R = ge === "standard", m = le ?? u?.error ?? !1, n = de ?? u?.disabled ?? !1, Y = m ? ie ?? j : j, { show: F, role: xe } = Qe("StyledSelect", m, Y, ae, c), z = tt(), { fieldRef: we, rowRef: ve, rowStyle: Ae } = Je(ce && F), [r, K] = x(!1), [k, I] = x(!1), [g, b] = x(null), [Re, W] = x(ne), O = M !== void 0, o = O ? M : Re, i = Array.isArray(o) ? o.length > 0 : o !== void 0 && o !== "" && o !== null, y = se.toArray(q), G = (e) => d ? Array.isArray(o) && o.includes(e) : e === o, s = y.flatMap((e, t) => p(e) && !e.props.disabled ? [t] : []), _ = y.findIndex((e) => p(e) && G(e.props.value)), ke = (e = 1) => s.includes(_) ? _ : s[e === 1 ? 0 : s.length - 1] ?? null, D = g === null ? void 0 : `${A}-option-${g}`, E = ot(null), f = (e) => {
|
|
17
|
+
K(e), e || b(null);
|
|
18
|
+
}, { refs: { domReference: De, reference: J, setFloating: Se, setReference: Ce }, floatingStyles: Fe, context: P } = ut({
|
|
18
19
|
open: r,
|
|
19
|
-
onOpenChange:
|
|
20
|
+
onOpenChange: f,
|
|
20
21
|
placement: "bottom-start",
|
|
21
22
|
strategy: "fixed",
|
|
22
|
-
whileElementsMounted:
|
|
23
|
+
whileElementsMounted: st,
|
|
23
24
|
middleware: [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
lt(0),
|
|
26
|
+
nt({ padding: 8 }),
|
|
27
|
+
it({ padding: 8 }),
|
|
28
|
+
at({ apply({ rects: e, elements: t }) {
|
|
28
29
|
t.floating.style.minWidth = `${e.reference.width}px`;
|
|
29
30
|
} })
|
|
30
31
|
]
|
|
31
|
-
}), { getReferenceProps: Ie, getFloatingProps: Oe } =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
])
|
|
36
|
-
|
|
32
|
+
}), { getReferenceProps: Ie, getFloatingProps: Oe } = ft([
|
|
33
|
+
ct(P, { enabled: !n && !c }),
|
|
34
|
+
dt(P),
|
|
35
|
+
mt(P, { role: "listbox" })
|
|
36
|
+
]);
|
|
37
|
+
We({
|
|
38
|
+
active: r,
|
|
39
|
+
requestClose: () => f(!1)
|
|
40
|
+
});
|
|
41
|
+
const [Q, X] = x(), N = qe(Q), _e = pt([Ye(Se, N), E]);
|
|
42
|
+
H(() => u?.setFocused(r || k), [
|
|
37
43
|
r,
|
|
38
44
|
k,
|
|
39
45
|
u
|
|
40
|
-
]),
|
|
46
|
+
]), H(() => u?.setFilled(i || !!S || !!C), [
|
|
41
47
|
i,
|
|
42
48
|
S,
|
|
43
49
|
C,
|
|
44
50
|
u
|
|
45
|
-
]),
|
|
51
|
+
]), H(() => {
|
|
46
52
|
if (!r) return;
|
|
47
53
|
const e = requestAnimationFrame(() => {
|
|
48
54
|
const t = D ? document.getElementById(D) : E.current?.querySelector('[role="option"][aria-selected="true"]');
|
|
@@ -55,37 +61,37 @@ var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, err
|
|
|
55
61
|
O || W(oe), $?.({ target: {
|
|
56
62
|
value: oe,
|
|
57
63
|
name: w
|
|
58
|
-
} }, t), a && (
|
|
64
|
+
} }, t), a && (f(!1), requestAnimationFrame(() => De.current?.focus()));
|
|
59
65
|
}, ee = () => {
|
|
60
66
|
const e = d ? [] : "";
|
|
61
67
|
O || W(e), $?.({ target: {
|
|
62
68
|
value: e,
|
|
63
69
|
name: w
|
|
64
|
-
} }, null),
|
|
70
|
+
} }, null), f(!1), I(!1);
|
|
65
71
|
}, Ee = se.map(q, (e, t) => {
|
|
66
|
-
if (!
|
|
72
|
+
if (!p(e)) return e;
|
|
67
73
|
const a = e.props.value;
|
|
68
|
-
return
|
|
74
|
+
return et(e, {
|
|
69
75
|
id: `${A}-option-${t}`,
|
|
70
|
-
active: t ===
|
|
76
|
+
active: t === g,
|
|
71
77
|
selected: G(a),
|
|
72
78
|
onClick: () => {
|
|
73
|
-
|
|
79
|
+
b(null), Z(a, e.props.children);
|
|
74
80
|
}
|
|
75
81
|
});
|
|
76
|
-
}), Pe =
|
|
82
|
+
}), Pe = y.find((e) => p(e) && e.props.value === o), Ne = V ? V(o) : d && Array.isArray(o) ? y.filter((e) => p(e) && o.includes(e.props.value)).map((e) => {
|
|
77
83
|
const t = e.props.children;
|
|
78
84
|
return typeof t == "string" || typeof t == "number" ? String(t) : "";
|
|
79
|
-
}).join(", ") : Pe?.props.children,
|
|
80
|
-
s.length !== 0 &&
|
|
85
|
+
}).join(", ") : Pe?.props.children, Be = (e) => {
|
|
86
|
+
s.length !== 0 && b((t) => {
|
|
81
87
|
const a = s.indexOf(t ?? _ ?? -1);
|
|
82
88
|
return a === -1 ? s[e === 1 ? 0 : s.length - 1] ?? null : s[Math.min(Math.max(a + e, 0), s.length - 1)] ?? null;
|
|
83
89
|
});
|
|
84
90
|
}, te = (e) => {
|
|
85
|
-
const t =
|
|
86
|
-
!
|
|
87
|
-
},
|
|
88
|
-
X(re(J.current)),
|
|
91
|
+
const t = g === null ? void 0 : y[g];
|
|
92
|
+
!p(t) || t.props.disabled || Z(t.props.value, t.props.children, e);
|
|
93
|
+
}, He = (e = 1) => {
|
|
94
|
+
X(re(J.current)), b(ke(e)), K(!0);
|
|
89
95
|
}, Le = (e) => {
|
|
90
96
|
if ((e.key === "Backspace" || e.key === "Delete") && U && i && !n && !c) {
|
|
91
97
|
e.preventDefault(), ee();
|
|
@@ -93,12 +99,12 @@ var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, err
|
|
|
93
99
|
}
|
|
94
100
|
if (!(n || c)) {
|
|
95
101
|
if (!r && (e.key === "ArrowDown" || e.key === "ArrowUp")) {
|
|
96
|
-
e.preventDefault(),
|
|
102
|
+
e.preventDefault(), He(e.key === "ArrowDown" ? 1 : -1);
|
|
97
103
|
return;
|
|
98
104
|
}
|
|
99
|
-
r && (e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(),
|
|
105
|
+
r && (e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(), Be(e.key === "ArrowDown" ? 1 : -1)) : e.key === "Home" || e.key === "End" ? (e.preventDefault(), b(s[e.key === "Home" ? 0 : s.length - 1] ?? null)) : e.key === " " ? (e.preventDefault(), te(!1)) : e.key === "Enter" ? (e.preventDefault(), te(!0)) : e.key === "Escape" ? (e.preventDefault(), f(!1)) : e.key === "Tab" && f(!1));
|
|
100
106
|
}
|
|
101
|
-
},
|
|
107
|
+
}, B = R && (r || k), Te = n ? "text-delta-300" : B ? "text-gama-500" : "text-delta-800", Me = n ? "text-delta-300" : "text-delta-700";
|
|
102
108
|
return /* @__PURE__ */ L("div", {
|
|
103
109
|
ref: we,
|
|
104
110
|
className: h("group relative inline-flex flex-col", ue && "w-full", fe),
|
|
@@ -123,7 +129,7 @@ var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, err
|
|
|
123
129
|
"aria-activedescendant": r ? D : void 0,
|
|
124
130
|
"aria-labelledby": v,
|
|
125
131
|
"aria-label": v ? void 0 : w,
|
|
126
|
-
"aria-invalid":
|
|
132
|
+
"aria-invalid": m ? !0 : void 0,
|
|
127
133
|
"aria-describedby": F ? z : void 0,
|
|
128
134
|
"aria-disabled": n ? !0 : void 0,
|
|
129
135
|
disabled: n,
|
|
@@ -134,7 +140,7 @@ var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, err
|
|
|
134
140
|
I(!1), he?.(e);
|
|
135
141
|
},
|
|
136
142
|
style: { minWidth: i && !R ? 105 : void 0 },
|
|
137
|
-
className: h("relative flex w-full items-center justify-between text-left outline-none", "h-10 rounded-lg border-0 px-3 text-base transition-colors", "asma-touch-ready",
|
|
143
|
+
className: h("relative flex w-full items-center justify-between text-left outline-none", "h-10 rounded-lg border-0 px-3 text-base transition-colors", "asma-touch-ready", B ? "bg-gama-50" : "bg-transparent", Te, R && "min-w-0", n && "cursor-not-allowed", c && "pointer-events-none"),
|
|
138
144
|
children: [
|
|
139
145
|
/* @__PURE__ */ l("span", {
|
|
140
146
|
className: h("min-w-0 flex-1 truncate", !i && "text-delta-500"),
|
|
@@ -156,19 +162,19 @@ var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, err
|
|
|
156
162
|
}), /* @__PURE__ */ l(ze, {
|
|
157
163
|
width: 24,
|
|
158
164
|
height: 24,
|
|
159
|
-
className: h("shrink-0 transition-transform",
|
|
165
|
+
className: h("shrink-0 transition-transform", B ? "text-gama-500" : Me, r && "flip-180")
|
|
160
166
|
})]
|
|
161
167
|
}),
|
|
162
|
-
/* @__PURE__ */ l("div", { className:
|
|
168
|
+
/* @__PURE__ */ l("div", { className: Xe({
|
|
163
169
|
focused: r || k,
|
|
164
|
-
error:
|
|
170
|
+
error: m,
|
|
165
171
|
disabled: n,
|
|
166
172
|
readOnly: c,
|
|
167
173
|
borderless: R
|
|
168
174
|
}) })
|
|
169
175
|
]
|
|
170
176
|
}),
|
|
171
|
-
r && /* @__PURE__ */ l(
|
|
177
|
+
r && /* @__PURE__ */ l(rt, {
|
|
172
178
|
root: Q,
|
|
173
179
|
children: /* @__PURE__ */ l("ul", {
|
|
174
180
|
ref: _e,
|
|
@@ -188,11 +194,11 @@ var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, err
|
|
|
188
194
|
children: Ee
|
|
189
195
|
})
|
|
190
196
|
}),
|
|
191
|
-
F && /* @__PURE__ */ l(
|
|
197
|
+
F && /* @__PURE__ */ l(Ge, {
|
|
192
198
|
ref: ve,
|
|
193
199
|
id: z,
|
|
194
200
|
role: xe,
|
|
195
|
-
error:
|
|
201
|
+
error: m,
|
|
196
202
|
message: Y,
|
|
197
203
|
className: "m-0 mr-[14px] box-border items-center",
|
|
198
204
|
style: Ae
|
|
@@ -201,5 +207,5 @@ var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, err
|
|
|
201
207
|
});
|
|
202
208
|
};
|
|
203
209
|
export {
|
|
204
|
-
|
|
210
|
+
It as StyledSelect
|
|
205
211
|
};
|