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.
Files changed (23) hide show
  1. package/dist/asma-ui-core.css +1 -1
  2. package/dist/components/feedback/dialog/StyledDialog.js +139 -96
  3. package/dist/components/feedback/minimizable-dialog/MinimizableDialog.js +180 -171
  4. package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +115 -106
  5. package/dist/components/inputs/select/StyledSelect.js +56 -50
  6. package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +102 -96
  7. package/dist/components/navigation/drawer/StyledDrawer.js +55 -51
  8. package/dist/components/utils/bottom-sheet/StyledBottomSheet.js +158 -118
  9. package/dist/components/utils/popover/PopoverSheet.js +95 -85
  10. package/dist/components/utils/popover/StyledPopover.js +81 -71
  11. package/dist/datetime/components/date-picker/StyledDatePicker.js +33 -28
  12. package/dist/datetime/components/date-picker/components/StyledCalendarPicker.js +9 -8
  13. package/dist/datetime/components/time-picker/StyledTimePicker.js +56 -51
  14. package/dist/datetime/hooks/useBackNavigationClose.hook.js +16 -7
  15. package/dist/hooks/useBackCloses.hook.js +100 -0
  16. package/dist/src/components/feedback/dialog/StyledDialog.d.ts +6 -1
  17. package/dist/src/components/navigation/drawer/StyledDrawer.d.ts +2 -0
  18. package/dist/src/components/utils/bottom-sheet/StyledBottomSheet.d.ts +6 -2
  19. package/dist/src/components/utils/popover/StyledPopover.d.ts +3 -1
  20. package/dist/src/datetime/hooks/useBackNavigationClose.hook.d.ts +2 -1
  21. package/dist/src/hooks/useBackCloses.hook.d.ts +101 -0
  22. package/dist/src/hooks/useBackCloses.hook.test.d.ts +1 -0
  23. package/package.json +1 -1
@@ -1,53 +1,59 @@
1
- import { cn as s } from "../../../../helpers/cn.js";
2
- import { firstTabbable as A } from "../../../../helpers/focusable.js";
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 $, useDialogBusyBoundary as ie } from "../../dialog/DialogBusyContext.js";
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 { 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 = {
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: 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());
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
- a.current?.toggleAttribute("inert", t), p.current?.toggleAttribute("inert", !t);
27
+ n.current?.toggleAttribute("inert", t), p.current?.toggleAttribute("inert", !t);
26
28
  }, [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 });
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
- 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 });
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
- o
42
+ i
41
43
  ]);
42
- const k = () => {
43
- const w = t ? a : p;
44
- M(!t), requestAnimationFrame(() => {
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"]') ?? A(m))?.focus({ preventScroll: !0 });
48
+ m && (m.querySelector('[data-testid="toggle-minimize-btn"]') ?? O(m))?.focus({ preventScroll: !0 });
47
49
  });
48
50
  };
49
- ne(o && d, a, z);
50
- const Y = d ? r ? {
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 (!o) return null;
68
- const Z = f ? `${I} ${x}` : x;
69
- return /* @__PURE__ */ n(ae, { children: [
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
- ...C
80
+ ...N
75
81
  },
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"),
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__ */ n("div", {
96
+ }), /* @__PURE__ */ r("div", {
91
97
  className: "flex items-center gap-x-1",
92
- children: [/* @__PURE__ */ e(V, {
98
+ children: [/* @__PURE__ */ e(q, {
93
99
  type: "expand",
94
100
  visibility: W,
95
- onClick: k,
96
- tooltipTitle: i.expand
97
- }), /* @__PURE__ */ e(O, {
98
- buttonRef: T,
101
+ onClick: j,
102
+ tooltipTitle: l.expand
103
+ }), /* @__PURE__ */ e($, {
104
+ buttonRef: B,
99
105
  showCloseIcon: R,
100
- onClick: z,
101
- disabledReason: y ? E : void 0,
102
- tooltipTitle: i.close
106
+ onClick: v,
107
+ disabledReason: z ? k : void 0,
108
+ tooltipTitle: l.close
103
109
  })]
104
110
  })]
105
111
  })
106
112
  }),
107
- d && /* @__PURE__ */ e("div", {
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
- B(!1);
116
+ M(!1);
111
117
  }
112
118
  }),
113
- /* @__PURE__ */ n("div", {
119
+ /* @__PURE__ */ e("div", {
114
120
  style: {
115
121
  zIndex: 51,
116
- ...C,
122
+ ...N,
117
123
  ...Y
118
124
  },
119
- ref: a,
125
+ ref: n,
120
126
  role: "dialog",
121
- "aria-modal": d ? !0 : void 0,
127
+ "aria-modal": c ? !0 : void 0,
122
128
  "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", {
127
- className: "flex items-center justify-between",
128
- children: [f ? /* @__PURE__ */ e("div", {
129
- id: I,
130
- className: "text-sm text-delta-700",
131
- children: f
132
- }) : /* @__PURE__ */ e("div", {
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: s("font-semibold text-delta-800", r ? "line-clamp-2 text-xl" : "line-clamp-1 text-2xl"),
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
- }), 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
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
- }), /* @__PURE__ */ e("div", {
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
- Se as MinimizableDialogV2
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 { HelperRow as We } from "../../../helpers/HelperRow.js";
7
- import { useHelperRowBudget as Ge } from "../../../helpers/useHelperRowBudget.js";
8
- import { useHelperSlot as Je } from "../../../helpers/useHelperSlot.js";
9
- import { outlineClass as Qe } from "../field-styles.js";
10
- import { useFormControlContext as Xe } from "../../miscellaneous/FormControlContext.js";
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";
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 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: 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({
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: y,
20
+ onOpenChange: f,
20
21
  placement: "bottom-start",
21
22
  strategy: "fixed",
22
- whileElementsMounted: rt,
23
+ whileElementsMounted: st,
23
24
  middleware: [
24
- nt(0),
25
- st({ padding: 8 }),
26
- lt({ padding: 8 }),
27
- it({ apply({ rects: e, elements: t }) {
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 } = ut([
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
- B(() => u?.setFocused(r || k), [
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
- ]), B(() => u?.setFilled(i || !!S || !!C), [
46
+ ]), H(() => u?.setFilled(i || !!S || !!C), [
41
47
  i,
42
48
  S,
43
49
  C,
44
50
  u
45
- ]), B(() => {
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 && (y(!1), requestAnimationFrame(() => De.current?.focus()));
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), y(!1), I(!1);
70
+ } }, null), f(!1), I(!1);
65
71
  }, Ee = se.map(q, (e, t) => {
66
- if (!f(e)) return e;
72
+ if (!p(e)) return e;
67
73
  const a = e.props.value;
68
- return Ze(e, {
74
+ return et(e, {
69
75
  id: `${A}-option-${t}`,
70
- active: t === m,
76
+ active: t === g,
71
77
  selected: G(a),
72
78
  onClick: () => {
73
- g(null), Z(a, e.props.children);
79
+ b(null), Z(a, e.props.children);
74
80
  }
75
81
  });
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) => {
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, He = (e) => {
80
- s.length !== 0 && g((t) => {
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 = m === null ? void 0 : b[m];
86
- !f(t) || t.props.disabled || Z(t.props.value, t.props.children, e);
87
- }, Be = (e = 1) => {
88
- X(re(J.current)), g(ke(e)), K(!0);
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(), Be(e.key === "ArrowDown" ? 1 : -1);
102
+ e.preventDefault(), He(e.key === "ArrowDown" ? 1 : -1);
97
103
  return;
98
104
  }
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));
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
- }, H = R && (r || k), Te = n ? "text-delta-300" : H ? "text-gama-500" : "text-delta-800", Me = n ? "text-delta-300" : "text-delta-700";
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": p ? !0 : void 0,
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", H ? "bg-gama-50" : "bg-transparent", Te, R && "min-w-0", n && "cursor-not-allowed", c && "pointer-events-none"),
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", H ? "text-gama-500" : Me, r && "flip-180")
165
+ className: h("shrink-0 transition-transform", B ? "text-gama-500" : Me, r && "flip-180")
160
166
  })]
161
167
  }),
162
- /* @__PURE__ */ l("div", { className: Qe({
168
+ /* @__PURE__ */ l("div", { className: Xe({
163
169
  focused: r || k,
164
- error: p,
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(ot, {
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(We, {
197
+ F && /* @__PURE__ */ l(Ge, {
192
198
  ref: ve,
193
199
  id: z,
194
200
  role: xe,
195
- error: p,
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
- Ct as StyledSelect
210
+ It as StyledSelect
205
211
  };