asma-ui-core 3.106.0 → 3.107.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.
- package/dist/asma-ui-core.css +1 -1
- package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +103 -92
- package/dist/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.js +10 -9
- package/dist/components/inputs/select/StyledSelect.js +35 -35
- package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +71 -71
- package/dist/datetime/components/date-picker/components/BaseDatePickerInput.js +66 -56
- package/dist/datetime/components/date-picker/components/DatePickerInputSingle.js +13 -12
- package/dist/datetime/components/time-picker/TimePickerInput.js +47 -39
- package/dist/datetime/helpers/getTitleLabelling.js +10 -0
- package/dist/src/datetime/components/date-picker/components/BaseDatePickerInput.d.ts +2 -0
- package/dist/src/datetime/components/date-picker/types.d.ts +6 -0
- package/dist/src/datetime/components/time-picker/types.d.ts +6 -1
- package/dist/src/datetime/helpers/getTitleLabelling.d.ts +12 -0
- package/package.json +1 -1
|
@@ -1,47 +1,53 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { firstTabbable as
|
|
3
|
-
import { StyledTooltip as
|
|
4
|
-
import { DialogBusyContext as
|
|
5
|
-
import { useMobileMediaQuery as
|
|
6
|
-
import { useFocusTrap as
|
|
7
|
-
import { CloseBtn as
|
|
8
|
-
import { MinimizeBtn as
|
|
9
|
-
import { FullScreenBtn as
|
|
10
|
-
import
|
|
11
|
-
import { useTranslations as
|
|
12
|
-
import { useControlledProps as
|
|
13
|
-
import
|
|
14
|
-
import { useLayoutEffect as
|
|
15
|
-
import { Fragment as
|
|
16
|
-
var
|
|
17
|
-
const { showCloseIcon:
|
|
1
|
+
import { cn as s } from "../../../../helpers/cn.js";
|
|
2
|
+
import { firstTabbable as A } from "../../../../helpers/focusable.js";
|
|
3
|
+
import { StyledTooltip as te } from "../../../data-display/tooltip/StyledTooltip.js";
|
|
4
|
+
import { DialogBusyContext as $, useDialogBusyBoundary as ie } from "../../dialog/DialogBusyContext.js";
|
|
5
|
+
import { useMobileMediaQuery as le } from "../../../../hooks/useMediaQuery.hook.js";
|
|
6
|
+
import { useFocusTrap as ne } from "../../../../hooks/useFocusTrap.hook.js";
|
|
7
|
+
import { CloseBtn as O } from "../components/CloseBtn.js";
|
|
8
|
+
import { MinimizeBtn as V } from "../components/MinimizeBtn.js";
|
|
9
|
+
import { FullScreenBtn as oe } from "../components/FullscreenBtn.js";
|
|
10
|
+
import v from "./MinimizableDialogV2.module.js";
|
|
11
|
+
import { useTranslations as re } from "./useTranslations.js";
|
|
12
|
+
import { useControlledProps as se } from "./useControlledProps.js";
|
|
13
|
+
import ce from "clsx";
|
|
14
|
+
import { useId as q, useLayoutEffect as H, useRef as c } from "react";
|
|
15
|
+
import { Fragment as ae, jsx as e, jsxs as n } from "react/jsx-runtime";
|
|
16
|
+
var Se = (N) => {
|
|
17
|
+
const { showCloseIcon: R = !0, showMinimizeIcon: L = !0, showExpandIcon: W = !0, enableFullscreen: _ = !0, title: u, label: f, children: Q, open: o, onClose: U, classNameOverrides: h = {
|
|
18
18
|
maximized: "",
|
|
19
19
|
minimized: "",
|
|
20
20
|
fullscreen: ""
|
|
21
|
-
}, dataTest:
|
|
22
|
-
|
|
21
|
+
}, dataTest: G, actionNode: J, locale: K = "en", busyReason: X, style: C, initialFocusRef: S } = N, r = le(), i = re(K), a = c(null), p = c(null), F = c(null), T = c(null), b = c(!1), g = c(null), x = q(), I = q(), { minimized: t, setMinimized: M, fullScreen: l, setFullScreen: B } = se(N), d = l && !t, { busy: y, busyReason: E, contextValue: j } = ie(X ?? i.waitUntilSaved), z = () => {
|
|
22
|
+
y || (M(!1), U());
|
|
23
23
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}, [t]),
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
H(() => {
|
|
25
|
+
a.current?.toggleAttribute("inert", t), p.current?.toggleAttribute("inert", !t);
|
|
26
|
+
}, [t]), H(() => {
|
|
27
|
+
const w = o && !b.current, m = !o && b.current;
|
|
28
|
+
if (b.current = o, m) {
|
|
29
|
+
const P = g.current;
|
|
30
|
+
g.current = null, (!document.activeElement || document.activeElement === document.body) && P?.isConnected && P.focus({ preventScroll: !0 });
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (!w) return;
|
|
34
|
+
g.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
35
|
+
const D = t ? p.current : a.current, ee = t ? T.current : F.current;
|
|
36
|
+
(S?.current ?? ee ?? (D ? A(D) : void 0))?.focus({ preventScroll: !0 });
|
|
31
37
|
}, [
|
|
32
|
-
|
|
38
|
+
S,
|
|
33
39
|
t,
|
|
34
|
-
|
|
40
|
+
o
|
|
35
41
|
]);
|
|
36
42
|
const k = () => {
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
43
|
+
const w = t ? a : p;
|
|
44
|
+
M(!t), requestAnimationFrame(() => {
|
|
45
|
+
const m = w.current;
|
|
46
|
+
m && (m.querySelector('[data-testid="toggle-minimize-btn"]') ?? A(m))?.focus({ preventScroll: !0 });
|
|
41
47
|
});
|
|
42
48
|
};
|
|
43
|
-
|
|
44
|
-
const
|
|
49
|
+
ne(o && d, a, z);
|
|
50
|
+
const Y = d ? r ? {
|
|
45
51
|
inset: 0,
|
|
46
52
|
maxHeight: "100dvh",
|
|
47
53
|
maxWidth: "100dvw",
|
|
@@ -58,115 +64,120 @@ var ge = (y) => {
|
|
|
58
64
|
maxWidth: "min(1000px, calc(100vw - 32px))",
|
|
59
65
|
height: "95dvh"
|
|
60
66
|
} : void 0;
|
|
61
|
-
|
|
67
|
+
if (!o) return null;
|
|
68
|
+
const Z = f ? `${I} ${x}` : x;
|
|
69
|
+
return /* @__PURE__ */ n(ae, { children: [
|
|
62
70
|
/* @__PURE__ */ e("div", {
|
|
63
|
-
ref:
|
|
71
|
+
ref: p,
|
|
64
72
|
style: {
|
|
65
73
|
zIndex: 51,
|
|
66
|
-
...
|
|
74
|
+
...C
|
|
67
75
|
},
|
|
68
|
-
className:
|
|
69
|
-
children: /* @__PURE__ */
|
|
70
|
-
className:
|
|
71
|
-
"data-testid":
|
|
76
|
+
className: s(v["minimized-dialog"], !t && v.hidden, h.minimized),
|
|
77
|
+
children: /* @__PURE__ */ n("div", {
|
|
78
|
+
className: ce("flex items-center justify-between", !t && "hidden"),
|
|
79
|
+
"data-testid": G,
|
|
72
80
|
children: [/* @__PURE__ */ e("div", {
|
|
73
81
|
className: "max-w-[303px] truncate pr-1 text-lg font-semibold text-delta-800",
|
|
74
|
-
children: /* @__PURE__ */ e(
|
|
75
|
-
title:
|
|
82
|
+
children: /* @__PURE__ */ e(te, {
|
|
83
|
+
title: u,
|
|
76
84
|
placement: "top",
|
|
77
85
|
children: /* @__PURE__ */ e("div", {
|
|
78
86
|
className: "truncate",
|
|
79
|
-
children:
|
|
87
|
+
children: u
|
|
80
88
|
})
|
|
81
89
|
})
|
|
82
|
-
}), /* @__PURE__ */
|
|
90
|
+
}), /* @__PURE__ */ n("div", {
|
|
83
91
|
className: "flex items-center gap-x-1",
|
|
84
|
-
children: [/* @__PURE__ */ e(
|
|
92
|
+
children: [/* @__PURE__ */ e(V, {
|
|
85
93
|
type: "expand",
|
|
86
|
-
visibility:
|
|
94
|
+
visibility: W,
|
|
87
95
|
onClick: k,
|
|
88
96
|
tooltipTitle: i.expand
|
|
89
|
-
}), /* @__PURE__ */ e(
|
|
90
|
-
buttonRef:
|
|
91
|
-
showCloseIcon:
|
|
92
|
-
onClick:
|
|
93
|
-
disabledReason:
|
|
97
|
+
}), /* @__PURE__ */ e(O, {
|
|
98
|
+
buttonRef: T,
|
|
99
|
+
showCloseIcon: R,
|
|
100
|
+
onClick: z,
|
|
101
|
+
disabledReason: y ? E : void 0,
|
|
94
102
|
tooltipTitle: i.close
|
|
95
103
|
})]
|
|
96
104
|
})]
|
|
97
105
|
})
|
|
98
106
|
}),
|
|
99
|
-
|
|
107
|
+
d && /* @__PURE__ */ e("div", {
|
|
100
108
|
className: "fixed inset-0 z-[52] bg-[rgb(98,110,126)] bg-opacity-70",
|
|
101
109
|
onClick: () => {
|
|
102
|
-
|
|
110
|
+
B(!1);
|
|
103
111
|
}
|
|
104
112
|
}),
|
|
105
|
-
/* @__PURE__ */
|
|
113
|
+
/* @__PURE__ */ n("div", {
|
|
106
114
|
style: {
|
|
107
115
|
zIndex: 51,
|
|
108
|
-
...
|
|
109
|
-
...
|
|
116
|
+
...C,
|
|
117
|
+
...Y
|
|
110
118
|
},
|
|
111
|
-
ref:
|
|
112
|
-
role:
|
|
113
|
-
"aria-modal":
|
|
114
|
-
"aria-
|
|
115
|
-
className:
|
|
116
|
-
children: [/* @__PURE__ */
|
|
117
|
-
className:
|
|
118
|
-
children: [/* @__PURE__ */
|
|
119
|
+
ref: a,
|
|
120
|
+
role: "dialog",
|
|
121
|
+
"aria-modal": d ? !0 : void 0,
|
|
122
|
+
"aria-labelledby": Z,
|
|
123
|
+
className: s(v.dialog, t && v.hidden, !l && h.maximized, l && h.fullscreen, d && "fixed z-[53] duration-0"),
|
|
124
|
+
children: [/* @__PURE__ */ n("div", {
|
|
125
|
+
className: s("flex flex-col border-b-[1px] border-delta-200 px-4", r ? "py-3" : "py-4"),
|
|
126
|
+
children: [/* @__PURE__ */ n("div", {
|
|
119
127
|
className: "flex items-center justify-between",
|
|
120
|
-
children: [
|
|
128
|
+
children: [f ? /* @__PURE__ */ e("div", {
|
|
129
|
+
id: I,
|
|
121
130
|
className: "text-sm text-delta-700",
|
|
122
|
-
children:
|
|
131
|
+
children: f
|
|
123
132
|
}) : /* @__PURE__ */ e("div", {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
133
|
+
id: x,
|
|
134
|
+
className: s("font-semibold text-delta-800", r ? "line-clamp-2 text-xl" : "line-clamp-1 text-2xl"),
|
|
135
|
+
children: u
|
|
136
|
+
}), /* @__PURE__ */ n("div", {
|
|
127
137
|
className: "flex items-center gap-x-1",
|
|
128
138
|
children: [
|
|
129
|
-
/* @__PURE__ */ e(
|
|
130
|
-
value:
|
|
131
|
-
children:
|
|
139
|
+
/* @__PURE__ */ e($.Provider, {
|
|
140
|
+
value: j,
|
|
141
|
+
children: J
|
|
132
142
|
}),
|
|
133
|
-
/* @__PURE__ */ e(
|
|
134
|
-
visibility:
|
|
143
|
+
/* @__PURE__ */ e(V, {
|
|
144
|
+
visibility: L && !r && !l,
|
|
135
145
|
type: "minimize",
|
|
136
146
|
onClick: k,
|
|
137
147
|
tooltipTitle: i.minimize
|
|
138
148
|
}),
|
|
139
|
-
/* @__PURE__ */ e(
|
|
140
|
-
showFullScreenIcon:
|
|
149
|
+
/* @__PURE__ */ e(oe, {
|
|
150
|
+
showFullScreenIcon: _ && !r,
|
|
141
151
|
fullScreen: l,
|
|
142
152
|
onClick: () => {
|
|
143
|
-
|
|
153
|
+
B(!l);
|
|
144
154
|
},
|
|
145
155
|
tooltipTitle: l ? i.exitFullscreen : i.fullscreen
|
|
146
156
|
}),
|
|
147
|
-
/* @__PURE__ */ e(
|
|
148
|
-
buttonRef:
|
|
149
|
-
showCloseIcon:
|
|
150
|
-
onClick:
|
|
151
|
-
disabledReason:
|
|
157
|
+
/* @__PURE__ */ e(O, {
|
|
158
|
+
buttonRef: F,
|
|
159
|
+
showCloseIcon: R,
|
|
160
|
+
onClick: z,
|
|
161
|
+
disabledReason: y ? E : void 0,
|
|
152
162
|
tooltipTitle: i.close
|
|
153
163
|
})
|
|
154
164
|
]
|
|
155
165
|
})]
|
|
156
|
-
}),
|
|
157
|
-
|
|
158
|
-
|
|
166
|
+
}), f && /* @__PURE__ */ e("div", {
|
|
167
|
+
id: x,
|
|
168
|
+
className: s("font-semibold text-delta-800", r ? "line-clamp-2 text-xl" : "line-clamp-1 text-2xl"),
|
|
169
|
+
children: u
|
|
159
170
|
})]
|
|
160
171
|
}), /* @__PURE__ */ e("div", {
|
|
161
|
-
className:
|
|
162
|
-
children: /* @__PURE__ */ e(
|
|
163
|
-
value:
|
|
164
|
-
children:
|
|
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
|
|
165
176
|
})
|
|
166
177
|
})]
|
|
167
178
|
})
|
|
168
|
-
] })
|
|
179
|
+
] });
|
|
169
180
|
};
|
|
170
181
|
export {
|
|
171
|
-
|
|
182
|
+
Se as MinimizableDialogV2
|
|
172
183
|
};
|
|
@@ -11,7 +11,7 @@ import { DynamicInteractiveChipGroup as ne } from "./DynamicInteractiveChipGroup
|
|
|
11
11
|
import { createElement as F, forwardRef as se, useCallback as h, useState as de } from "react";
|
|
12
12
|
import { Fragment as K, jsx as l, jsxs as T } from "react/jsx-runtime";
|
|
13
13
|
var Ce = se((O, H) => {
|
|
14
|
-
const [_, S] = de(!1), { options: k, dataTest: f, value: g, readOnly: u, multiple: o, required: R, onChange: x, size:
|
|
14
|
+
const [_, S] = de(!1), { options: k, dataTest: f, value: g, readOnly: u, multiple: o, required: R, onChange: x, size: W, rowSize: y = "compact", title: v, noOptionsText: G, placeholder: J, disabled: I, helperText: M, disableHelperText: N, error: A, valueKey: P = "value", labelKey: Q = "label", renderLabel: s, getOptionTooltip: V, startAdornment: U, autocompleteProps: i, loading: m, maxTags: X, onFocus: Y, onBlur: Z } = O, d = (e) => typeof e == "object" ? e?.[Q]?.toString() ?? "" : e?.toString() ?? "", b = h((e) => typeof e == "object" ? e?.[P] : e, [P]), $ = h((e, t) => b(e) === b(t), [b]), w = (e) => {
|
|
15
15
|
const t = b(e);
|
|
16
16
|
return t == null ? "" : typeof t == "string" || typeof t == "number" || typeof t == "boolean" ? String(t) : e == null ? "" : d(e);
|
|
17
17
|
}, B = h((e) => {
|
|
@@ -20,13 +20,13 @@ var Ce = se((O, H) => {
|
|
|
20
20
|
S(!1), i?.onClose?.(e, t);
|
|
21
21
|
}, [i]);
|
|
22
22
|
if (o && u) return /* @__PURE__ */ l(ne, { ...O });
|
|
23
|
-
const C =
|
|
23
|
+
const C = v ? `${f}-title` : void 0;
|
|
24
24
|
return /* @__PURE__ */ T("div", {
|
|
25
25
|
className: "flex w-full flex-col gap-y-1",
|
|
26
|
-
children: [
|
|
26
|
+
children: [v && /* @__PURE__ */ l("span", {
|
|
27
27
|
id: C,
|
|
28
28
|
className: "text-base font-semibold text-delta-800",
|
|
29
|
-
children:
|
|
29
|
+
children: v
|
|
30
30
|
}), /* @__PURE__ */ l(ie, {
|
|
31
31
|
open: _,
|
|
32
32
|
onOpen: B,
|
|
@@ -34,12 +34,12 @@ var Ce = se((O, H) => {
|
|
|
34
34
|
disableCloseOnSelect: o,
|
|
35
35
|
dataTest: f,
|
|
36
36
|
disabled: !!I || !!m,
|
|
37
|
-
noOptionsText:
|
|
37
|
+
noOptionsText: G,
|
|
38
38
|
loading: m,
|
|
39
39
|
readOnly: u,
|
|
40
40
|
value: g,
|
|
41
|
-
size:
|
|
42
|
-
rowSize:
|
|
41
|
+
size: W,
|
|
42
|
+
rowSize: y,
|
|
43
43
|
disableClearable: R,
|
|
44
44
|
options: k,
|
|
45
45
|
fullWidth: !0,
|
|
@@ -99,7 +99,7 @@ var Ce = se((O, H) => {
|
|
|
99
99
|
"aria-selected": L,
|
|
100
100
|
key: e.id,
|
|
101
101
|
onClick: r ? void 0 : e.onClick,
|
|
102
|
-
className: q("relative flex cursor-pointer items-center gap-x-1 bg-white px-2 text-base aria-selected:bg-gama-50 hover:bg-delta-50",
|
|
102
|
+
className: q("relative box-border flex cursor-pointer items-center gap-x-1 bg-white px-2 py-2 text-base aria-selected:bg-gama-50 hover:bg-delta-50", y === "regular" ? "min-h-12" : "min-h-10", r && "cursor-not-allowed bg-delta-50 aria-selected:!bg-delta-50 hover:!bg-delta-50 [&_*]:cursor-not-allowed"),
|
|
103
103
|
"aria-disabled": r,
|
|
104
104
|
"aria-describedby": a
|
|
105
105
|
}, j, e["data-active"] !== void 0 && /* @__PURE__ */ l("span", {
|
|
@@ -114,6 +114,7 @@ var Ce = se((O, H) => {
|
|
|
114
114
|
dataTest: `${w(t)}-checkbox`,
|
|
115
115
|
size: "small",
|
|
116
116
|
decorative: !0,
|
|
117
|
+
hideWrapper: !0,
|
|
117
118
|
className: "min-w-[36px]",
|
|
118
119
|
checked: L
|
|
119
120
|
}), s ? s(t) : /* @__PURE__ */ l("span", {
|
|
@@ -128,7 +129,7 @@ var Ce = se((O, H) => {
|
|
|
128
129
|
role: "option",
|
|
129
130
|
"aria-selected": D,
|
|
130
131
|
key: e.id,
|
|
131
|
-
className: q("relative flex cursor-pointer items-center gap-x-1 px-2 text-base aria-selected:bg-gama-50 hover:bg-delta-50",
|
|
132
|
+
className: q("relative box-border flex cursor-pointer items-center gap-x-1 px-2 py-2 text-base aria-selected:bg-gama-50 hover:bg-delta-50", y === "regular" ? "min-h-12" : "min-h-10", r && "cursor-not-allowed bg-delta-50 aria-selected:!bg-delta-50 hover:!bg-delta-50 [&_*]:cursor-not-allowed"),
|
|
132
133
|
onClick: r ? void 0 : e.onClick,
|
|
133
134
|
"aria-disabled": r,
|
|
134
135
|
"aria-describedby": a
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cn as
|
|
1
|
+
import { cn as h } from "../../../helpers/cn.js";
|
|
2
2
|
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";
|
|
@@ -11,12 +11,12 @@ import { useFormControlContext as Xe } from "../../miscellaneous/FormControlCont
|
|
|
11
11
|
import { Children as se, cloneElement as Ze, isValidElement as f, useEffect as B, useId as et, useRef as tt, useState as x } from "react";
|
|
12
12
|
import { jsx as l, jsxs as L } from "react/jsx-runtime";
|
|
13
13
|
import { FloatingPortal as ot, autoUpdate as rt, flip as st, offset as nt, shift as lt, size as it, useClick as at, useDismiss as ct, useFloating as dt, useInteractions as ut, useMergeRefs as ft, useRole as pt } from "@floating-ui/react";
|
|
14
|
-
var Ct = ({ 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:
|
|
15
|
-
const u = Xe(), A = `${T}-listbox`, R =
|
|
16
|
-
K(e), e ||
|
|
17
|
-
}, { refs: { domReference: De, reference: J, setFloating: Se, setReference: Ce }, floatingStyles: Fe, context:
|
|
14
|
+
var Ct = ({ 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 }) => {
|
|
15
|
+
const u = Xe(), A = `${T}-listbox`, R = ge === "standard", p = le ?? u?.error ?? !1, n = de ?? u?.disabled ?? !1, Y = p ? ie ?? j : j, { show: F, role: xe } = Je("StyledSelect", p, Y, ae, c), z = et(), { fieldRef: we, rowRef: ve, rowStyle: Ae } = Ge(ce && F), [r, K] = x(!1), [k, I] = x(!1), [m, g] = 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, b = se.toArray(q), G = (e) => d ? Array.isArray(o) && o.includes(e) : e === o, s = b.flatMap((e, t) => f(e) && !e.props.disabled ? [t] : []), _ = b.findIndex((e) => f(e) && G(e.props.value)), ke = (e = 1) => s.includes(_) ? _ : s[e === 1 ? 0 : s.length - 1] ?? null, D = m === null ? void 0 : `${A}-option-${m}`, E = tt(null), y = (e) => {
|
|
16
|
+
K(e), e || g(null);
|
|
17
|
+
}, { refs: { domReference: De, reference: J, setFloating: Se, setReference: Ce }, floatingStyles: Fe, context: P } = dt({
|
|
18
18
|
open: r,
|
|
19
|
-
onOpenChange:
|
|
19
|
+
onOpenChange: y,
|
|
20
20
|
placement: "bottom-start",
|
|
21
21
|
strategy: "fixed",
|
|
22
22
|
whileElementsMounted: rt,
|
|
@@ -29,10 +29,10 @@ var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, err
|
|
|
29
29
|
} })
|
|
30
30
|
]
|
|
31
31
|
}), { getReferenceProps: Ie, getFloatingProps: Oe } = ut([
|
|
32
|
-
at(
|
|
33
|
-
ct(
|
|
34
|
-
pt(
|
|
35
|
-
]), [Q, X] = x(),
|
|
32
|
+
at(P, { enabled: !n && !c }),
|
|
33
|
+
ct(P),
|
|
34
|
+
pt(P, { role: "listbox" })
|
|
35
|
+
]), [Q, X] = x(), N = qe(Q), _e = ft([Ye(Se, N), E]);
|
|
36
36
|
B(() => u?.setFocused(r || k), [
|
|
37
37
|
r,
|
|
38
38
|
k,
|
|
@@ -45,8 +45,8 @@ var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, err
|
|
|
45
45
|
]), B(() => {
|
|
46
46
|
if (!r) return;
|
|
47
47
|
const e = requestAnimationFrame(() => {
|
|
48
|
-
const t = D ? document.getElementById(D) :
|
|
49
|
-
t &&
|
|
48
|
+
const t = D ? document.getElementById(D) : E.current?.querySelector('[role="option"][aria-selected="true"]');
|
|
49
|
+
t && E.current?.contains(t) && t.scrollIntoView({ block: "nearest" });
|
|
50
50
|
});
|
|
51
51
|
return () => cancelAnimationFrame(e);
|
|
52
52
|
}, [D, r]);
|
|
@@ -55,14 +55,14 @@ var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, err
|
|
|
55
55
|
O || W(oe), $?.({ target: {
|
|
56
56
|
value: oe,
|
|
57
57
|
name: w
|
|
58
|
-
} }, t), a && (
|
|
58
|
+
} }, t), a && (y(!1), requestAnimationFrame(() => De.current?.focus()));
|
|
59
59
|
}, ee = () => {
|
|
60
60
|
const e = d ? [] : "";
|
|
61
61
|
O || W(e), $?.({ target: {
|
|
62
62
|
value: e,
|
|
63
63
|
name: w
|
|
64
|
-
} }, null),
|
|
65
|
-
},
|
|
64
|
+
} }, null), y(!1), I(!1);
|
|
65
|
+
}, Ee = se.map(q, (e, t) => {
|
|
66
66
|
if (!f(e)) return e;
|
|
67
67
|
const a = e.props.value;
|
|
68
68
|
return Ze(e, {
|
|
@@ -70,22 +70,22 @@ var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, err
|
|
|
70
70
|
active: t === m,
|
|
71
71
|
selected: G(a),
|
|
72
72
|
onClick: () => {
|
|
73
|
-
|
|
73
|
+
g(null), Z(a, e.props.children);
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
|
-
}),
|
|
76
|
+
}), Pe = b.find((e) => f(e) && e.props.value === o), Ne = V ? V(o) : d && Array.isArray(o) ? b.filter((e) => f(e) && o.includes(e.props.value)).map((e) => {
|
|
77
77
|
const t = e.props.children;
|
|
78
78
|
return typeof t == "string" || typeof t == "number" ? String(t) : "";
|
|
79
|
-
}).join(", ") :
|
|
80
|
-
s.length !== 0 &&
|
|
81
|
-
const a = s.indexOf(t ??
|
|
79
|
+
}).join(", ") : Pe?.props.children, He = (e) => {
|
|
80
|
+
s.length !== 0 && g((t) => {
|
|
81
|
+
const a = s.indexOf(t ?? _ ?? -1);
|
|
82
82
|
return a === -1 ? s[e === 1 ? 0 : s.length - 1] ?? null : s[Math.min(Math.max(a + e, 0), s.length - 1)] ?? null;
|
|
83
83
|
});
|
|
84
84
|
}, te = (e) => {
|
|
85
|
-
const t = m === null ? void 0 :
|
|
85
|
+
const t = m === null ? void 0 : b[m];
|
|
86
86
|
!f(t) || t.props.disabled || Z(t.props.value, t.props.children, e);
|
|
87
87
|
}, Be = (e = 1) => {
|
|
88
|
-
X(re(J.current)),
|
|
88
|
+
X(re(J.current)), g(ke(e)), K(!0);
|
|
89
89
|
}, Le = (e) => {
|
|
90
90
|
if ((e.key === "Backspace" || e.key === "Delete") && U && i && !n && !c) {
|
|
91
91
|
e.preventDefault(), ee();
|
|
@@ -96,12 +96,12 @@ var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, err
|
|
|
96
96
|
e.preventDefault(), Be(e.key === "ArrowDown" ? 1 : -1);
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
|
-
r && (e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(), He(e.key === "ArrowDown" ? 1 : -1)) : e.key === "Home" || e.key === "End" ? (e.preventDefault(),
|
|
99
|
+
r && (e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(), He(e.key === "ArrowDown" ? 1 : -1)) : e.key === "Home" || e.key === "End" ? (e.preventDefault(), g(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(), y(!1)) : e.key === "Tab" && y(!1));
|
|
100
100
|
}
|
|
101
101
|
}, H = R && (r || k), Te = n ? "text-delta-300" : H ? "text-gama-500" : "text-delta-800", Me = n ? "text-delta-300" : "text-delta-700";
|
|
102
102
|
return /* @__PURE__ */ L("div", {
|
|
103
103
|
ref: we,
|
|
104
|
-
className:
|
|
104
|
+
className: h("group relative inline-flex flex-col", ue && "w-full", fe),
|
|
105
105
|
style: {
|
|
106
106
|
fontFamily: "Roboto, Helvetica, Arial, sans-serif",
|
|
107
107
|
...je(me),
|
|
@@ -128,17 +128,17 @@ var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, err
|
|
|
128
128
|
"aria-disabled": n ? !0 : void 0,
|
|
129
129
|
disabled: n,
|
|
130
130
|
onFocus: (e) => {
|
|
131
|
-
I(!0),
|
|
131
|
+
I(!0), ye?.(e);
|
|
132
132
|
},
|
|
133
133
|
onBlur: (e) => {
|
|
134
|
-
I(!1),
|
|
134
|
+
I(!1), he?.(e);
|
|
135
135
|
},
|
|
136
136
|
style: { minWidth: i && !R ? 105 : void 0 },
|
|
137
|
-
className:
|
|
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", H ? "bg-gama-50" : "bg-transparent", Te, R && "min-w-0", n && "cursor-not-allowed", c && "pointer-events-none"),
|
|
138
138
|
children: [
|
|
139
139
|
/* @__PURE__ */ l("span", {
|
|
140
|
-
className:
|
|
141
|
-
children: i || C ?
|
|
140
|
+
className: h("min-w-0 flex-1 truncate", !i && "text-delta-500"),
|
|
141
|
+
children: i || C ? Ne : S
|
|
142
142
|
}),
|
|
143
143
|
/* @__PURE__ */ L("span", {
|
|
144
144
|
className: "flex items-center gap-1",
|
|
@@ -156,7 +156,7 @@ var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, err
|
|
|
156
156
|
}), /* @__PURE__ */ l(ze, {
|
|
157
157
|
width: 24,
|
|
158
158
|
height: 24,
|
|
159
|
-
className:
|
|
159
|
+
className: h("shrink-0 transition-transform", H ? "text-gama-500" : Me, r && "flip-180")
|
|
160
160
|
})]
|
|
161
161
|
}),
|
|
162
162
|
/* @__PURE__ */ l("div", { className: Qe({
|
|
@@ -171,21 +171,21 @@ var Ct = ({ dataTest: T, value: M, defaultValue: ne, onChange: $, error: le, err
|
|
|
171
171
|
r && /* @__PURE__ */ l(ot, {
|
|
172
172
|
root: Q,
|
|
173
173
|
children: /* @__PURE__ */ l("ul", {
|
|
174
|
-
ref:
|
|
174
|
+
ref: _e,
|
|
175
175
|
...Oe(),
|
|
176
176
|
id: A,
|
|
177
177
|
role: "listbox",
|
|
178
178
|
"aria-multiselectable": d ? !0 : void 0,
|
|
179
179
|
"aria-labelledby": v,
|
|
180
180
|
"aria-label": v ? void 0 : w,
|
|
181
|
-
...
|
|
181
|
+
...N ? Ue : {},
|
|
182
182
|
style: {
|
|
183
|
-
...
|
|
183
|
+
...N ? Ve : {},
|
|
184
184
|
...Fe,
|
|
185
185
|
fontFamily: "Roboto, Helvetica, Arial, sans-serif"
|
|
186
186
|
},
|
|
187
|
-
className:
|
|
188
|
-
children:
|
|
187
|
+
className: h("z-[1300] m-0 max-h-72 list-none overflow-auto rounded border border-solid border-delta-300 bg-white px-0 py-2 shadow-[0px_2px_4px_0px_rgba(34,33,51,0.15)]", "[&>li:not(:last-child)]:shadow-[inset_0_-1px_0_var(--colors-delta-200)]", be?.className),
|
|
188
|
+
children: Ee
|
|
189
189
|
})
|
|
190
190
|
}),
|
|
191
191
|
F && /* @__PURE__ */ l(We, {
|