asma-ui-core 3.60.0 → 3.61.1
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.
|
@@ -17,9 +17,9 @@ import H from "clsx";
|
|
|
17
17
|
import { useRef as fe, useState as J } from "react";
|
|
18
18
|
import { Fragment as z, jsx as e, jsxs as i } from "react/jsx-runtime";
|
|
19
19
|
var Ee = ({ onCloseText: u = "", onMinimizeText: N = "", onExpandText: I = "", onFullScreenText: M = "", showCloseIcon: j = !0, showMinimizeIcon: Q = !0, showExpandIcon: T = !0, showFullScreenIcon: W = !0, title: s, label: b, children: g, open: C, onClose: x, className: _ = "", primaryButtonText: w, primaryButtonLoading: k = !1, secondaryButtonText: c, onPrimaryButtonClick: v, onSecondaryButtonClick: p, dataTest: F, actionNode: X, extraActions: r, extraActionsText: m, btnContainerClassName: G, footerClassName: Y, footerInfo: D, locale: l = "en", enableFullscreen: Z = !0, fullScreenState: E, handleFullScreenState: L }) => {
|
|
20
|
-
const [d, A] = J(!1), [R, P] = J(!1), { open: B, anchorEl: ee, handleOpen: ie, handleClose: te } = he(), S = fe(null),
|
|
21
|
-
if (se(C &&
|
|
22
|
-
const le =
|
|
20
|
+
const [d, A] = J(!1), [R, P] = J(!1), { open: B, anchorEl: ee, handleOpen: ie, handleClose: te } = he(), S = fe(null), a = E ?? R, n = a && !d;
|
|
21
|
+
if (se(C && n, S, x), !C) return null;
|
|
22
|
+
const le = n ? {
|
|
23
23
|
right: "auto",
|
|
24
24
|
bottom: "auto",
|
|
25
25
|
left: "50%",
|
|
@@ -27,11 +27,11 @@ var Ee = ({ onCloseText: u = "", onMinimizeText: N = "", onExpandText: I = "", o
|
|
|
27
27
|
transform: "translate(-50%, -50%)",
|
|
28
28
|
width: "min(1000px, calc(100vw - 32px))",
|
|
29
29
|
height: "95dvh"
|
|
30
|
-
} : void 0, O =
|
|
30
|
+
} : void 0, O = a ? l === "en" ? "Exit full screen" : "Avslutt fullskjerm" : l === "en" ? "Full screen" : "Fullskjerm", y = w ?? k, U = y || c, V = () => {
|
|
31
31
|
A(!d);
|
|
32
32
|
};
|
|
33
33
|
return /* @__PURE__ */ i(z, { children: [
|
|
34
|
-
|
|
34
|
+
n && /* @__PURE__ */ e("div", { className: "fixed inset-0 z-[51] bg-[rgb(98,110,126)] bg-opacity-70" }),
|
|
35
35
|
/* @__PURE__ */ e("div", {
|
|
36
36
|
style: { zIndex: 51 },
|
|
37
37
|
className: h(q.dialog, !d && q.hidden),
|
|
@@ -80,10 +80,10 @@ var Ee = ({ onCloseText: u = "", onMinimizeText: N = "", onExpandText: I = "", o
|
|
|
80
80
|
/* @__PURE__ */ i("div", {
|
|
81
81
|
ref: S,
|
|
82
82
|
style: le,
|
|
83
|
-
role:
|
|
84
|
-
"aria-modal":
|
|
85
|
-
"aria-label":
|
|
86
|
-
className: h("fixed bottom-4 right-4 z-[51] rounded-lg bg-white shadow-[0_4px_40px_0px_rgba(34,33,51,0.4)] transition-all duration-300", _ && !d && !
|
|
83
|
+
role: n ? "dialog" : void 0,
|
|
84
|
+
"aria-modal": n ? !0 : void 0,
|
|
85
|
+
"aria-label": n && typeof s == "string" ? s : void 0,
|
|
86
|
+
className: h("fixed bottom-4 right-4 z-[51] rounded-lg bg-white shadow-[0_4px_40px_0px_rgba(34,33,51,0.4)] transition-all duration-300", _ && !d && !a ? _ : "", d && "!h-0 !w-0 opacity-0 duration-0", n && "fixed duration-0"),
|
|
87
87
|
"data-testid": F,
|
|
88
88
|
children: [/* @__PURE__ */ i("div", {
|
|
89
89
|
className: "flex flex-col gap-y-2 border-b-[1px] border-delta-200 p-4",
|
|
@@ -99,7 +99,7 @@ var Ee = ({ onCloseText: u = "", onMinimizeText: N = "", onExpandText: I = "", o
|
|
|
99
99
|
className: "flex items-center gap-x-1",
|
|
100
100
|
children: [
|
|
101
101
|
X,
|
|
102
|
-
Q && /* @__PURE__ */ e(f, {
|
|
102
|
+
Q && !a && /* @__PURE__ */ e(f, {
|
|
103
103
|
title: l === "en" ? "Minimize" : "Minimer",
|
|
104
104
|
children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(t, {
|
|
105
105
|
dataTest: "minimize-button",
|
|
@@ -122,10 +122,10 @@ var Ee = ({ onCloseText: u = "", onMinimizeText: N = "", onExpandText: I = "", o
|
|
|
122
122
|
"aria-label": M ? void 0 : O,
|
|
123
123
|
variant: "textGray",
|
|
124
124
|
size: "small",
|
|
125
|
-
onClick: (
|
|
126
|
-
E !== void 0 && L ? L() : P(!R),
|
|
125
|
+
onClick: (o) => {
|
|
126
|
+
E !== void 0 && L ? L() : P(!R), o.detail !== 0 && o.currentTarget.blur();
|
|
127
127
|
},
|
|
128
|
-
endIcon:
|
|
128
|
+
endIcon: a ? /* @__PURE__ */ e(oe, {
|
|
129
129
|
width: 20,
|
|
130
130
|
height: 20,
|
|
131
131
|
color: "text-delta-700"
|
|
@@ -160,10 +160,10 @@ var Ee = ({ onCloseText: u = "", onMinimizeText: N = "", onExpandText: I = "", o
|
|
|
160
160
|
children: s
|
|
161
161
|
})]
|
|
162
162
|
}), /* @__PURE__ */ i("div", {
|
|
163
|
-
className: H("flex flex-col",
|
|
163
|
+
className: H("flex flex-col", a && !d && "h-[87dvh]"),
|
|
164
164
|
children: [/* @__PURE__ */ e("div", {
|
|
165
165
|
className: "flex-grow overflow-y-auto",
|
|
166
|
-
children: typeof g == "function" ? g({ fullScreen:
|
|
166
|
+
children: typeof g == "function" ? g({ fullScreen: a }) : g
|
|
167
167
|
}), (Array.isArray(r) && r.length || typeof r == "function") && m || D ? /* @__PURE__ */ i("div", {
|
|
168
168
|
className: h("flex items-center justify-between border-0 border-t-[1px] border-solid border-delta-200 bg-white p-4", Y),
|
|
169
169
|
children: [
|
|
@@ -180,11 +180,11 @@ var Ee = ({ onCloseText: u = "", onMinimizeText: N = "", onExpandText: I = "", o
|
|
|
180
180
|
open: B,
|
|
181
181
|
anchorEl: ee,
|
|
182
182
|
onClose: te,
|
|
183
|
-
children: r.map((
|
|
184
|
-
className:
|
|
185
|
-
onClick:
|
|
186
|
-
children:
|
|
187
|
-
},
|
|
183
|
+
children: r.map((o) => /* @__PURE__ */ e(me, {
|
|
184
|
+
className: o.className,
|
|
185
|
+
onClick: o.onClick,
|
|
186
|
+
children: o.label
|
|
187
|
+
}, o.label))
|
|
188
188
|
})] }) : m && typeof r == "function" && /* @__PURE__ */ e(t, {
|
|
189
189
|
dataTest: "extra-action-button",
|
|
190
190
|
variant: "text",
|
|
@@ -10,17 +10,17 @@ import { useTranslations as V } from "./useTranslations.js";
|
|
|
10
10
|
import { useControlledProps as _ } from "./useControlledProps.js";
|
|
11
11
|
import $ from "clsx";
|
|
12
12
|
import { useRef as A } from "react";
|
|
13
|
-
import { Fragment as E, jsx as e, jsxs as
|
|
13
|
+
import { Fragment as E, jsx as e, jsxs as o } from "react/jsx-runtime";
|
|
14
14
|
var ee = (f) => {
|
|
15
|
-
const { showCloseIcon: u = !0, showMinimizeIcon: N = !0, showExpandIcon: w = !0, enableFullscreen: C = !0, title:
|
|
15
|
+
const { showCloseIcon: u = !0, showMinimizeIcon: N = !0, showExpandIcon: w = !0, enableFullscreen: C = !0, title: n, label: m, children: F, open: h, onClose: T, classNameOverrides: d = {
|
|
16
16
|
maximized: "",
|
|
17
17
|
minimized: "",
|
|
18
18
|
fullscreen: ""
|
|
19
|
-
}, dataTest: M, actionNode: S, locale: k = "en", style: v } = f, s = B(),
|
|
19
|
+
}, dataTest: M, actionNode: S, locale: k = "en", style: v } = f, s = B(), a = V(k), b = A(null), { minimized: i, setMinimized: x, fullScreen: l, setFullScreen: g } = _(f), t = l && !i, p = () => {
|
|
20
20
|
x(!1), T();
|
|
21
21
|
};
|
|
22
|
-
D(h &&
|
|
23
|
-
const I =
|
|
22
|
+
D(h && t, b, p);
|
|
23
|
+
const I = t ? {
|
|
24
24
|
right: "auto",
|
|
25
25
|
bottom: "auto",
|
|
26
26
|
left: "50%",
|
|
@@ -30,27 +30,27 @@ var ee = (f) => {
|
|
|
30
30
|
maxWidth: "min(1000px, calc(100vw - 32px))",
|
|
31
31
|
height: "95dvh"
|
|
32
32
|
} : void 0;
|
|
33
|
-
return h ? /* @__PURE__ */
|
|
33
|
+
return h ? /* @__PURE__ */ o(E, { children: [
|
|
34
34
|
/* @__PURE__ */ e("div", {
|
|
35
35
|
style: {
|
|
36
36
|
zIndex: 51,
|
|
37
37
|
...v
|
|
38
38
|
},
|
|
39
39
|
className: r(c["minimized-dialog"], !i && c.hidden, d.minimized),
|
|
40
|
-
children: /* @__PURE__ */
|
|
40
|
+
children: /* @__PURE__ */ o("div", {
|
|
41
41
|
className: $("flex items-center justify-between", !i && "hidden"),
|
|
42
42
|
"data-testid": M,
|
|
43
43
|
children: [/* @__PURE__ */ e("div", {
|
|
44
44
|
className: "max-w-[303px] truncate pr-1 text-lg font-semibold text-delta-800",
|
|
45
45
|
children: /* @__PURE__ */ e(j, {
|
|
46
|
-
title:
|
|
46
|
+
title: n,
|
|
47
47
|
placement: "top",
|
|
48
48
|
children: /* @__PURE__ */ e("div", {
|
|
49
49
|
className: "truncate",
|
|
50
|
-
children:
|
|
50
|
+
children: n
|
|
51
51
|
})
|
|
52
52
|
})
|
|
53
|
-
}), /* @__PURE__ */
|
|
53
|
+
}), /* @__PURE__ */ o("div", {
|
|
54
54
|
className: "flex items-center gap-x-1",
|
|
55
55
|
children: [/* @__PURE__ */ e(z, {
|
|
56
56
|
type: "expand",
|
|
@@ -58,72 +58,72 @@ var ee = (f) => {
|
|
|
58
58
|
onClick: () => {
|
|
59
59
|
x(!i);
|
|
60
60
|
},
|
|
61
|
-
tooltipTitle:
|
|
61
|
+
tooltipTitle: a.expand
|
|
62
62
|
}), /* @__PURE__ */ e(y, {
|
|
63
63
|
showCloseIcon: u,
|
|
64
64
|
onClick: p,
|
|
65
|
-
tooltipTitle:
|
|
65
|
+
tooltipTitle: a.close
|
|
66
66
|
})]
|
|
67
67
|
})]
|
|
68
68
|
})
|
|
69
69
|
}),
|
|
70
|
-
|
|
70
|
+
t && /* @__PURE__ */ e("div", {
|
|
71
71
|
className: "fixed inset-0 z-[52] bg-[rgb(98,110,126)] bg-opacity-70",
|
|
72
72
|
onClick: () => {
|
|
73
73
|
g(!1);
|
|
74
74
|
}
|
|
75
75
|
}),
|
|
76
|
-
/* @__PURE__ */
|
|
76
|
+
/* @__PURE__ */ o("div", {
|
|
77
77
|
style: {
|
|
78
78
|
zIndex: 51,
|
|
79
79
|
...v,
|
|
80
80
|
...I
|
|
81
81
|
},
|
|
82
82
|
ref: b,
|
|
83
|
-
role:
|
|
84
|
-
"aria-modal":
|
|
85
|
-
"aria-label":
|
|
86
|
-
className: r(c.dialog, i && c.hidden, !
|
|
87
|
-
children: [/* @__PURE__ */
|
|
83
|
+
role: t ? "dialog" : void 0,
|
|
84
|
+
"aria-modal": t ? !0 : void 0,
|
|
85
|
+
"aria-label": t && typeof n == "string" ? n : void 0,
|
|
86
|
+
className: r(c.dialog, i && c.hidden, !l && d.maximized, l && d.fullscreen, t && "fixed z-[53] duration-0"),
|
|
87
|
+
children: [/* @__PURE__ */ o("div", {
|
|
88
88
|
className: r("flex flex-col border-b-[1px] border-delta-200 px-4", s ? "py-3" : "py-4"),
|
|
89
|
-
children: [/* @__PURE__ */
|
|
89
|
+
children: [/* @__PURE__ */ o("div", {
|
|
90
90
|
className: "flex items-center justify-between",
|
|
91
91
|
children: [m ? /* @__PURE__ */ e("div", {
|
|
92
92
|
className: "text-sm text-delta-700",
|
|
93
93
|
children: m
|
|
94
94
|
}) : /* @__PURE__ */ e("div", {
|
|
95
95
|
className: r("font-semibold text-delta-800", s ? "line-clamp-2 text-xl" : "line-clamp-1 text-2xl"),
|
|
96
|
-
children:
|
|
97
|
-
}), /* @__PURE__ */
|
|
96
|
+
children: n
|
|
97
|
+
}), /* @__PURE__ */ o("div", {
|
|
98
98
|
className: "flex items-center gap-x-1",
|
|
99
99
|
children: [
|
|
100
100
|
S,
|
|
101
101
|
/* @__PURE__ */ e(z, {
|
|
102
|
-
visibility: N && !s,
|
|
102
|
+
visibility: N && !s && !l,
|
|
103
103
|
type: "minimize",
|
|
104
104
|
onClick: () => {
|
|
105
105
|
x(!i);
|
|
106
106
|
},
|
|
107
|
-
tooltipTitle:
|
|
107
|
+
tooltipTitle: a.minimize
|
|
108
108
|
}),
|
|
109
109
|
/* @__PURE__ */ e(R, {
|
|
110
110
|
showFullScreenIcon: C && !s,
|
|
111
|
-
fullScreen:
|
|
111
|
+
fullScreen: l,
|
|
112
112
|
onClick: () => {
|
|
113
|
-
g(!
|
|
113
|
+
g(!l);
|
|
114
114
|
},
|
|
115
|
-
tooltipTitle:
|
|
115
|
+
tooltipTitle: l ? a.exitFullscreen : a.fullscreen
|
|
116
116
|
}),
|
|
117
117
|
/* @__PURE__ */ e(y, {
|
|
118
118
|
showCloseIcon: u,
|
|
119
119
|
onClick: p,
|
|
120
|
-
tooltipTitle:
|
|
120
|
+
tooltipTitle: a.close
|
|
121
121
|
})
|
|
122
122
|
]
|
|
123
123
|
})]
|
|
124
124
|
}), m && /* @__PURE__ */ e("div", {
|
|
125
125
|
className: r("font-semibold text-delta-800", s ? "line-clamp-2 text-xl" : "line-clamp-1 text-2xl"),
|
|
126
|
-
children:
|
|
126
|
+
children: n
|
|
127
127
|
})]
|
|
128
128
|
}), /* @__PURE__ */ e("div", {
|
|
129
129
|
className: r(i && "hidden", "flex flex-grow flex-col overflow-y-auto"),
|
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
import { cn as f } from "../../../helpers/cn.js";
|
|
2
|
-
import { resolveSx as
|
|
3
|
-
import { ChevronDownIcon as
|
|
4
|
-
import { CloseIcon as
|
|
5
|
-
import { ErrorOutlineIcon as
|
|
6
|
-
import { TOP_LAYER_PROPS as
|
|
7
|
-
import { outlineClass as
|
|
8
|
-
import { useFormControlContext as
|
|
9
|
-
import { StyledFormHelperText as
|
|
10
|
-
import { Children as
|
|
11
|
-
import { jsx as n, jsxs as
|
|
12
|
-
import { FloatingPortal as
|
|
13
|
-
var
|
|
14
|
-
const a =
|
|
2
|
+
import { resolveSx as ge } from "../../../helpers/sx.js";
|
|
3
|
+
import { ChevronDownIcon as xe } from "../../icons/chevron-down-icon/ChevronDownIcon.js";
|
|
4
|
+
import { CloseIcon as ye } from "../../icons/close-icon/CloseIcon.js";
|
|
5
|
+
import { ErrorOutlineIcon as be } from "../../icons/error-outline-icon/ErrorOutlineIcon.js";
|
|
6
|
+
import { TOP_LAYER_PROPS as he, TOP_LAYER_RESET_STYLE as we, getOpenModalDialogAncestor as Ae, useTopLayerRef as ve } from "../../../hooks/useTopLayer.hook.js";
|
|
7
|
+
import { outlineClass as Re } from "../field-styles.js";
|
|
8
|
+
import { useFormControlContext as ke } from "../../miscellaneous/FormControlContext.js";
|
|
9
|
+
import { StyledFormHelperText as Fe } from "../../miscellaneous/StyledFormHelperText.js";
|
|
10
|
+
import { Children as C, cloneElement as De, isValidElement as E, useEffect as N, useMemo as Se, useRef as Ce, useState as _ } from "react";
|
|
11
|
+
import { jsx as n, jsxs as h } from "react/jsx-runtime";
|
|
12
|
+
import { FloatingPortal as Ee, autoUpdate as Ne, flip as _e, offset as qe, shift as Pe, size as Te, useClick as Ve, useDismiss as je, useFloating as Be, useInteractions as Ie, useMergeRefs as L, useRole as Ue } from "@floating-ui/react";
|
|
13
|
+
var Xe = ({ dataTest: q, value: P, defaultValue: M, onChange: T, error: H, errorText: O, allowClear: V, disabled: Y, readOnly: c, name: m, placeholder: w, displayEmpty: A, multiple: d, renderValue: j, fullWidth: z, className: W, style: $, sx: G, variant: J, children: v, MenuProps: Q, onFocus: X, onBlur: Z, labelId: p }) => {
|
|
14
|
+
const a = ke(), B = `${q}-listbox`, g = J === "standard", I = H ?? a?.error ?? !1, s = Y ?? a?.disabled ?? !1, [o, x] = _(!1), [y, R] = _(!1), [ee, U] = _(M), k = P !== void 0, r = k ? P : ee, l = Array.isArray(r) ? r.length > 0 : r !== void 0 && r !== "" && r !== null, i = Ce(null), { refs: u, floatingStyles: te, context: F } = Be({
|
|
15
15
|
open: o,
|
|
16
|
-
onOpenChange:
|
|
16
|
+
onOpenChange: x,
|
|
17
17
|
placement: "bottom-start",
|
|
18
18
|
strategy: "fixed",
|
|
19
|
-
whileElementsMounted:
|
|
19
|
+
whileElementsMounted: Ne,
|
|
20
20
|
middleware: [
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
qe(4),
|
|
22
|
+
_e({ padding: 8 }),
|
|
23
|
+
Pe({ padding: 8 }),
|
|
24
|
+
Te({ apply({ rects: e, elements: t }) {
|
|
25
25
|
t.floating.style.minWidth = `${e.reference.width + 20}px`;
|
|
26
26
|
} })
|
|
27
27
|
]
|
|
28
|
-
}), { getReferenceProps:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
]),
|
|
33
|
-
|
|
28
|
+
}), { getReferenceProps: re, getFloatingProps: oe } = Ie([
|
|
29
|
+
Ve(F, { enabled: !s && !c }),
|
|
30
|
+
je(F),
|
|
31
|
+
Ue(F, { role: "listbox" })
|
|
32
|
+
]), se = L([u.setReference]), ne = L([ve(u.setFloating), i]), le = Se(() => o ? Ae(u.reference.current) : void 0, [o, u]);
|
|
33
|
+
N(() => a?.setFocused(o || y), [
|
|
34
34
|
o,
|
|
35
|
-
|
|
35
|
+
y,
|
|
36
36
|
a
|
|
37
|
-
]),
|
|
37
|
+
]), N(() => a?.setFilled(l || !!w || !!A), [
|
|
38
38
|
l,
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
w,
|
|
40
|
+
A,
|
|
41
41
|
a
|
|
42
|
-
]),
|
|
42
|
+
]), N(() => {
|
|
43
43
|
if (!o) return;
|
|
44
44
|
const e = requestAnimationFrame(() => {
|
|
45
45
|
const t = i.current?.querySelector('[role="option"][aria-selected="true"]');
|
|
@@ -47,136 +47,136 @@ var Ge = ({ dataTest: _, value: q, defaultValue: L, onChange: P, error: M, error
|
|
|
47
47
|
});
|
|
48
48
|
return () => cancelAnimationFrame(e);
|
|
49
49
|
}, [o]);
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
k || U(
|
|
53
|
-
value:
|
|
54
|
-
name:
|
|
55
|
-
} }, t), d || (
|
|
56
|
-
},
|
|
50
|
+
const ae = (e, t) => {
|
|
51
|
+
const b = d ? Array.isArray(r) && r.includes(e) ? r.filter((S) => S !== e) : [...Array.isArray(r) ? r : [], e] : e;
|
|
52
|
+
k || U(b), T?.({ target: {
|
|
53
|
+
value: b,
|
|
54
|
+
name: m
|
|
55
|
+
} }, t), d || (x(!1), requestAnimationFrame(() => u.domReference.current?.focus()));
|
|
56
|
+
}, K = () => {
|
|
57
57
|
const e = d ? [] : "";
|
|
58
|
-
k || U(e),
|
|
58
|
+
k || U(e), T?.({ target: {
|
|
59
59
|
value: e,
|
|
60
|
-
name:
|
|
61
|
-
} }, null),
|
|
62
|
-
},
|
|
60
|
+
name: m
|
|
61
|
+
} }, null), x(!1), R(!1);
|
|
62
|
+
}, ie = C.map(v, (e) => {
|
|
63
63
|
if (!E(e)) return e;
|
|
64
64
|
const t = e.props.value;
|
|
65
|
-
return
|
|
65
|
+
return De(e, {
|
|
66
66
|
selected: d ? Array.isArray(r) && r.includes(t) : t === r,
|
|
67
|
-
onClick: () =>
|
|
67
|
+
onClick: () => ae(t, e.props.children)
|
|
68
68
|
});
|
|
69
|
-
}),
|
|
69
|
+
}), ce = C.toArray(v).find((e) => E(e) && e.props.value === r), de = j ? j(r) : d && Array.isArray(r) ? C.toArray(v).filter((e) => E(e) && r.includes(e.props.value)).map((e) => {
|
|
70
70
|
const t = e.props.children;
|
|
71
71
|
return typeof t == "string" || typeof t == "number" ? String(t) : "";
|
|
72
|
-
}).join(", ") :
|
|
73
|
-
if ((e.key === "Backspace" || e.key === "Delete") &&
|
|
74
|
-
e.preventDefault(),
|
|
72
|
+
}).join(", ") : ce?.props.children, ue = (e) => {
|
|
73
|
+
if ((e.key === "Backspace" || e.key === "Delete") && V && l && !s && !c) {
|
|
74
|
+
e.preventDefault(), K();
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
|
-
e.key !== "ArrowDown" && e.key !== "ArrowUp" || s || c || (e.preventDefault(),
|
|
77
|
+
e.key !== "ArrowDown" && e.key !== "ArrowUp" || s || c || (e.preventDefault(), x(!0), requestAnimationFrame(() => {
|
|
78
78
|
if (i.current?.querySelector('[role="option"][aria-selected="true"]')) return;
|
|
79
79
|
const t = i.current?.querySelectorAll('[role="option"]:not([aria-disabled="true"])');
|
|
80
80
|
t?.length && t[e.key === "ArrowUp" ? t.length - 1 : 0]?.focus();
|
|
81
81
|
}));
|
|
82
|
-
},
|
|
82
|
+
}, fe = (e) => {
|
|
83
83
|
const t = i.current ? Array.from(i.current.querySelectorAll('[role="option"]:not([aria-disabled="true"])')) : [];
|
|
84
84
|
if (t.length === 0) return;
|
|
85
|
-
const
|
|
86
|
-
e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(), t[(
|
|
87
|
-
};
|
|
88
|
-
return /* @__PURE__ */
|
|
89
|
-
className: f("group relative inline-flex flex-col",
|
|
85
|
+
const b = t.findIndex((S) => S === document.activeElement);
|
|
86
|
+
e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(), t[(b + (e.key === "ArrowDown" ? 1 : -1) + t.length) % t.length]?.focus()) : (e.key === "Enter" || e.key === " ") && (e.preventDefault(), document.activeElement?.click());
|
|
87
|
+
}, D = g && (o || y), me = s ? "text-delta-300" : D ? "text-gama-500" : "text-delta-800", pe = s ? "text-delta-300" : "text-delta-700";
|
|
88
|
+
return /* @__PURE__ */ h("div", {
|
|
89
|
+
className: f("group relative inline-flex flex-col", z && "w-full", W),
|
|
90
90
|
style: {
|
|
91
91
|
fontFamily: "Roboto, Helvetica, Arial, sans-serif",
|
|
92
|
-
...
|
|
93
|
-
|
|
92
|
+
...ge(G),
|
|
93
|
+
...$
|
|
94
94
|
},
|
|
95
95
|
children: [
|
|
96
|
-
/* @__PURE__ */
|
|
97
|
-
ref:
|
|
96
|
+
/* @__PURE__ */ h("button", {
|
|
97
|
+
ref: se,
|
|
98
98
|
type: "button",
|
|
99
|
-
"data-testid":
|
|
100
|
-
...
|
|
99
|
+
"data-testid": q,
|
|
100
|
+
...re({ onKeyDown: ue }),
|
|
101
101
|
role: "combobox",
|
|
102
102
|
"aria-haspopup": "listbox",
|
|
103
103
|
"aria-expanded": o,
|
|
104
|
-
"aria-controls":
|
|
105
|
-
"aria-labelledby":
|
|
106
|
-
"aria-label":
|
|
104
|
+
"aria-controls": B,
|
|
105
|
+
"aria-labelledby": p,
|
|
106
|
+
"aria-label": p ? void 0 : m,
|
|
107
107
|
"aria-disabled": s ? !0 : void 0,
|
|
108
108
|
disabled: s,
|
|
109
109
|
onFocus: (e) => {
|
|
110
|
-
R(!0),
|
|
110
|
+
R(!0), X?.(e);
|
|
111
111
|
},
|
|
112
112
|
onBlur: (e) => {
|
|
113
|
-
R(!1),
|
|
113
|
+
R(!1), Z?.(e);
|
|
114
114
|
},
|
|
115
|
-
style: { minWidth: l && !
|
|
116
|
-
className: f("relative flex w-full items-center justify-between
|
|
115
|
+
style: { minWidth: l && !g ? 105 : void 0 },
|
|
116
|
+
className: f("relative flex w-full items-center justify-between text-left outline-none", "h-10 rounded-lg border-0 px-3 text-base transition-colors", D ? "bg-gama-50" : "bg-transparent", me, g && "min-w-0", s && "cursor-not-allowed", c && "pointer-events-none"),
|
|
117
117
|
children: [
|
|
118
118
|
/* @__PURE__ */ n("span", {
|
|
119
119
|
className: f("min-w-0 flex-1 truncate", !l && "text-delta-500"),
|
|
120
|
-
children: l ||
|
|
120
|
+
children: l || A ? de : w
|
|
121
121
|
}),
|
|
122
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ h("span", {
|
|
123
123
|
className: "flex items-center gap-1",
|
|
124
|
-
children: [
|
|
124
|
+
children: [V && l && !s && /* @__PURE__ */ n("span", {
|
|
125
125
|
"aria-hidden": "true",
|
|
126
126
|
"data-testid": "select-clear-button",
|
|
127
127
|
className: "flex items-center justify-center rounded-full p-[2px] hover:bg-gama-100",
|
|
128
128
|
onClick: (e) => {
|
|
129
|
-
e.stopPropagation(),
|
|
129
|
+
e.stopPropagation(), K();
|
|
130
130
|
},
|
|
131
|
-
children: /* @__PURE__ */ n(
|
|
131
|
+
children: /* @__PURE__ */ n(ye, {
|
|
132
132
|
width: 18,
|
|
133
133
|
height: 18
|
|
134
134
|
})
|
|
135
|
-
}), /* @__PURE__ */ n(
|
|
135
|
+
}), /* @__PURE__ */ n(xe, {
|
|
136
136
|
width: 24,
|
|
137
137
|
height: 24,
|
|
138
|
-
className: f("shrink-0 transition-transform",
|
|
138
|
+
className: f("shrink-0 transition-transform", D ? "text-gama-500" : pe, o && "rotate-180")
|
|
139
139
|
})]
|
|
140
140
|
}),
|
|
141
|
-
/* @__PURE__ */ n("div", { className:
|
|
142
|
-
focused: o ||
|
|
141
|
+
/* @__PURE__ */ n("div", { className: Re({
|
|
142
|
+
focused: o || y,
|
|
143
143
|
error: I,
|
|
144
144
|
disabled: s,
|
|
145
145
|
readOnly: c,
|
|
146
|
-
borderless:
|
|
146
|
+
borderless: g
|
|
147
147
|
}) })
|
|
148
148
|
]
|
|
149
149
|
}),
|
|
150
|
-
o && /* @__PURE__ */ n(
|
|
151
|
-
root:
|
|
150
|
+
o && /* @__PURE__ */ n(Ee, {
|
|
151
|
+
root: le,
|
|
152
152
|
children: /* @__PURE__ */ n("ul", {
|
|
153
|
-
ref:
|
|
154
|
-
id:
|
|
153
|
+
ref: ne,
|
|
154
|
+
id: B,
|
|
155
155
|
role: "listbox",
|
|
156
|
-
"aria-labelledby":
|
|
157
|
-
"aria-label":
|
|
158
|
-
...
|
|
156
|
+
"aria-labelledby": p,
|
|
157
|
+
"aria-label": p ? void 0 : m,
|
|
158
|
+
...he,
|
|
159
159
|
style: {
|
|
160
|
-
...
|
|
161
|
-
...
|
|
160
|
+
...we,
|
|
161
|
+
...te,
|
|
162
162
|
fontFamily: "Roboto, Helvetica, Arial, sans-serif"
|
|
163
163
|
},
|
|
164
|
-
...
|
|
165
|
-
onKeyDown:
|
|
166
|
-
className: f("z-[1300] m-0 max-h-72 list-none overflow-auto rounded-lg border border-solid border-delta-300 bg-white px-0 py-1 shadow-[0px_2px_4px_0px_rgba(34,33,51,0.15)]",
|
|
167
|
-
children:
|
|
164
|
+
...oe(),
|
|
165
|
+
onKeyDown: fe,
|
|
166
|
+
className: f("z-[1300] m-0 max-h-72 list-none overflow-auto rounded-lg border border-solid border-delta-300 bg-white px-0 py-1 shadow-[0px_2px_4px_0px_rgba(34,33,51,0.15)]", Q?.className),
|
|
167
|
+
children: ie
|
|
168
168
|
})
|
|
169
169
|
}),
|
|
170
|
-
I && /* @__PURE__ */
|
|
170
|
+
I && /* @__PURE__ */ h(Fe, {
|
|
171
171
|
className: "m-0 flex items-center gap-1 pt-1 text-sm text-error-500",
|
|
172
|
-
children: [/* @__PURE__ */ n(
|
|
172
|
+
children: [/* @__PURE__ */ n(be, {
|
|
173
173
|
width: 20,
|
|
174
174
|
height: 20
|
|
175
|
-
}),
|
|
175
|
+
}), O ?? "Required"]
|
|
176
176
|
})
|
|
177
177
|
]
|
|
178
178
|
});
|
|
179
179
|
};
|
|
180
180
|
export {
|
|
181
|
-
|
|
181
|
+
Xe as StyledSelect
|
|
182
182
|
};
|