asma-ui-core 3.108.3 → 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/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 +36 -27
- package/dist/datetime/components/date-picker/components/StyledCalendarPicker.js +9 -8
- package/dist/datetime/components/time-picker/StyledTimePicker.js +75 -64
- package/dist/datetime/hooks/useBackNavigationClose.hook.js +19 -0
- 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 +5 -0
- package/package.json +1 -1
|
@@ -3,54 +3,59 @@ import { firstTabbable as se } from "../../../helpers/focusable.js";
|
|
|
3
3
|
import { TOP_LAYER_PROPS as ae, TOP_LAYER_RESET_STYLE as le, getOpenModalDialogAncestor as ce, shouldUsePopoverTopLayer as de, useTopLayerRef as ue } from "../../../hooks/useTopLayer.hook.js";
|
|
4
4
|
import { StyledButton as fe } from "../../inputs/button/StyledButton.js";
|
|
5
5
|
import { useMobileMediaQuery as pe } from "../../../hooks/useMediaQuery.hook.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
6
|
+
import { OverlayBackOwnerContext as me, useBackCloses as ge } from "../../../hooks/useBackCloses.hook.js";
|
|
7
|
+
import { useDebouncedValue as ve } from "../../../hooks/useDebouncedValue.hook.js";
|
|
8
|
+
import { useFocusTrap as he } from "../../../hooks/useFocusTrap.hook.js";
|
|
9
|
+
import { formatResultsLabel as xe } from "../bottom-sheet/formatResultsLabel.js";
|
|
10
|
+
import { StyledBottomSheet as _e } from "../bottom-sheet/StyledBottomSheet.js";
|
|
11
|
+
import { PopoverAnatomy as Pe } from "./PopoverAnatomy.js";
|
|
12
|
+
import { useCallback as x, useEffect as w, useId as be, useRef as O, useState as d } from "react";
|
|
13
|
+
import { Fragment as D, jsx as a, jsxs as N } from "react/jsx-runtime";
|
|
14
|
+
import { FloatingPortal as ye, autoUpdate as Re, flip as we, offset as Oe, shift as Te, size as Ee, useDismiss as Me, useFloating as Se, useInteractions as Ae, useMergeRefs as Fe } from "@floating-ui/react";
|
|
15
|
+
var Ie = 240, Ce = {
|
|
15
16
|
info: 472,
|
|
16
17
|
action: 472
|
|
17
|
-
},
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
}, [
|
|
18
|
+
}, ke = 0.6, X = "calc(100vw - 32px)", Le = (i, u, f) => Re(i, u, f, { elementResize: !1 }), Je = ({ dataTest: i, renderTrigger: u, variant: f = "info", title: p, children: T, viewResultsAction: E, resetAction: M, footerActions: S, resultCount: _, closeLabel: A = "Lukk", ariaLabel: F, onOpenChange: I, className: C }) => {
|
|
19
|
+
const l = be(), k = `${l}-title`, [o, q] = d(!1), [L, z] = d(), [K, U] = d(), m = pe(), t = f === "action", Y = m && !t, H = m && t, g = x((e) => {
|
|
20
|
+
q(e), I?.(e);
|
|
21
|
+
}, [I]), { refs: P, floatingStyles: $, context: j } = Se({
|
|
21
22
|
open: o,
|
|
22
|
-
onOpenChange:
|
|
23
|
+
onOpenChange: g,
|
|
23
24
|
placement: "bottom-start",
|
|
24
25
|
strategy: "fixed",
|
|
25
26
|
whileElementsMounted: Le,
|
|
26
27
|
middleware: [
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
Oe(8),
|
|
29
|
+
...Y ? [] : [we({ padding: 8 })],
|
|
29
30
|
Te({ padding: 8 }),
|
|
30
31
|
Ee({
|
|
31
32
|
padding: 8,
|
|
32
33
|
apply({ availableHeight: e }) {
|
|
33
|
-
|
|
34
|
+
U(Math.min(e, Math.round(window.innerHeight * ke)));
|
|
34
35
|
}
|
|
35
36
|
})
|
|
36
37
|
]
|
|
37
|
-
}), { getFloatingProps: V } =
|
|
38
|
-
enabled: !
|
|
38
|
+
}), { getFloatingProps: V } = Ae([Me(j, {
|
|
39
|
+
enabled: !H,
|
|
39
40
|
escapeKey: !0,
|
|
40
41
|
outsidePress: (e) => {
|
|
41
|
-
const s =
|
|
42
|
+
const s = v.current;
|
|
42
43
|
return !(s && e.target instanceof Node && s.contains(e.target));
|
|
43
44
|
}
|
|
44
|
-
})]), b = de(
|
|
45
|
-
|
|
46
|
-
}, []), J =
|
|
47
|
-
|
|
48
|
-
}, [
|
|
49
|
-
|
|
50
|
-
}, [
|
|
51
|
-
ge(
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
})]), b = de(L), c = O(null), [r, G] = d(null), Q = x((e) => {
|
|
46
|
+
c.current = e, G(e);
|
|
47
|
+
}, []), J = Fe([ue(P.setFloating, b), Q]), v = O(null), Z = x((e) => {
|
|
48
|
+
v.current = e, P.setReference(e);
|
|
49
|
+
}, [P]), n = x(() => {
|
|
50
|
+
g(!1);
|
|
51
|
+
}, [g]);
|
|
52
|
+
ge({
|
|
53
|
+
active: o,
|
|
54
|
+
requestClose: n,
|
|
55
|
+
ownerRef: c
|
|
56
|
+
}), he(o && t && r !== null, c);
|
|
57
|
+
const [W, ee] = d(!1);
|
|
58
|
+
w(() => {
|
|
54
59
|
if (!r || t && !W) return;
|
|
55
60
|
const e = requestAnimationFrame(() => {
|
|
56
61
|
(t ? se(r) : r)?.focus({ preventScroll: !0 });
|
|
@@ -62,11 +67,11 @@ var Oe = 240, Fe = {
|
|
|
62
67
|
r,
|
|
63
68
|
t,
|
|
64
69
|
W
|
|
65
|
-
]),
|
|
70
|
+
]), w(() => {
|
|
66
71
|
if (!r || t) return;
|
|
67
72
|
const e = (s) => {
|
|
68
|
-
const
|
|
69
|
-
|
|
73
|
+
const R = s.relatedTarget;
|
|
74
|
+
R instanceof Node && (r.contains(R) || v.current?.contains(R)) || n();
|
|
70
75
|
};
|
|
71
76
|
return r.addEventListener("focusout", e), () => {
|
|
72
77
|
r.removeEventListener("focusout", e);
|
|
@@ -74,17 +79,17 @@ var Oe = 240, Fe = {
|
|
|
74
79
|
}, [
|
|
75
80
|
r,
|
|
76
81
|
t,
|
|
77
|
-
|
|
82
|
+
n
|
|
78
83
|
]);
|
|
79
|
-
const
|
|
80
|
-
|
|
84
|
+
const y = O(!1);
|
|
85
|
+
w(() => {
|
|
81
86
|
if (o) {
|
|
82
|
-
|
|
87
|
+
y.current = !0;
|
|
83
88
|
return;
|
|
84
89
|
}
|
|
85
|
-
if (!
|
|
86
|
-
|
|
87
|
-
const e =
|
|
90
|
+
if (!y.current) return;
|
|
91
|
+
y.current = !1;
|
|
92
|
+
const e = v.current;
|
|
88
93
|
if (!e) return;
|
|
89
94
|
const s = requestAnimationFrame(() => {
|
|
90
95
|
document.activeElement === document.body && e.focus();
|
|
@@ -93,79 +98,84 @@ var Oe = 240, Fe = {
|
|
|
93
98
|
cancelAnimationFrame(s);
|
|
94
99
|
};
|
|
95
100
|
}, [o]);
|
|
96
|
-
const
|
|
101
|
+
const B = {
|
|
97
102
|
ref: Z,
|
|
98
103
|
isOpen: o,
|
|
99
104
|
triggerProps: {
|
|
100
105
|
onClick: (e) => {
|
|
101
106
|
if (o) {
|
|
102
|
-
|
|
107
|
+
n();
|
|
103
108
|
return;
|
|
104
109
|
}
|
|
105
|
-
|
|
110
|
+
z(ce(e.currentTarget)), ee(e.detail === 0), g(!0);
|
|
106
111
|
},
|
|
107
112
|
"aria-expanded": o,
|
|
108
|
-
"aria-controls": o ?
|
|
113
|
+
"aria-controls": o ? l : void 0,
|
|
109
114
|
"aria-haspopup": t ? "dialog" : void 0,
|
|
110
|
-
"aria-describedby": !t && o ?
|
|
115
|
+
"aria-describedby": !t && o ? l : void 0
|
|
111
116
|
}
|
|
112
|
-
}, h = (e) => typeof e == "function" ? e({ close:
|
|
113
|
-
dataTest: `${
|
|
117
|
+
}, h = (e) => typeof e == "function" ? e({ close: n }) : e, te = ve(_, 500), oe = E ?? (_ === void 0 ? void 0 : /* @__PURE__ */ a(fe, {
|
|
118
|
+
dataTest: `${i}-view-results`,
|
|
114
119
|
type: "button",
|
|
115
120
|
variant: "text",
|
|
116
|
-
onClick:
|
|
117
|
-
children:
|
|
118
|
-
})), re =
|
|
119
|
-
return
|
|
120
|
-
id:
|
|
121
|
-
dataTest:
|
|
121
|
+
onClick: n,
|
|
122
|
+
children: xe(te)
|
|
123
|
+
})), re = m ? X : Ce[f], ne = m ? X : void 0;
|
|
124
|
+
return H ? /* @__PURE__ */ N(D, { children: [u(B), /* @__PURE__ */ a(_e, {
|
|
125
|
+
id: l,
|
|
126
|
+
dataTest: i,
|
|
122
127
|
open: o,
|
|
123
|
-
onClose:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
onClose: n,
|
|
129
|
+
registerBackClose: !1,
|
|
130
|
+
ownerRef: c,
|
|
131
|
+
title: p,
|
|
132
|
+
ariaLabel: F,
|
|
133
|
+
viewResultsAction: E,
|
|
134
|
+
resetAction: M,
|
|
135
|
+
footerActions: S,
|
|
136
|
+
resultCount: _,
|
|
130
137
|
closeLabel: A,
|
|
131
|
-
className:
|
|
132
|
-
children:
|
|
133
|
-
})] }) : /* @__PURE__ */
|
|
134
|
-
root:
|
|
135
|
-
children: /* @__PURE__ */
|
|
138
|
+
className: C,
|
|
139
|
+
children: T
|
|
140
|
+
})] }) : /* @__PURE__ */ N(D, { children: [u(B), o && /* @__PURE__ */ a(ye, {
|
|
141
|
+
root: L,
|
|
142
|
+
children: /* @__PURE__ */ a("div", {
|
|
136
143
|
...V(),
|
|
137
144
|
ref: J,
|
|
138
|
-
id:
|
|
139
|
-
"data-test":
|
|
140
|
-
"data-testid":
|
|
145
|
+
id: l,
|
|
146
|
+
"data-test": i,
|
|
147
|
+
"data-testid": i,
|
|
141
148
|
role: t ? "dialog" : void 0,
|
|
142
|
-
"aria-labelledby": t &&
|
|
143
|
-
"aria-label": t && !
|
|
149
|
+
"aria-labelledby": t && p ? k : void 0,
|
|
150
|
+
"aria-label": t && !p ? F : void 0,
|
|
144
151
|
tabIndex: t ? void 0 : -1,
|
|
145
152
|
...b ? ae : {},
|
|
146
153
|
style: {
|
|
147
154
|
...b ? le : {},
|
|
148
|
-
|
|
149
|
-
minWidth:
|
|
155
|
+
...$,
|
|
156
|
+
minWidth: Ie,
|
|
150
157
|
width: ne,
|
|
151
158
|
maxWidth: re,
|
|
152
|
-
maxHeight:
|
|
159
|
+
maxHeight: K
|
|
153
160
|
},
|
|
154
|
-
className: ie("z-[1300]", "box-border flex flex-col overflow-hidden rounded-lg bg-white text-delta-700 outline-none shadow-[inset_0_0_0_1px_var(--colors-delta-300),0px_4px_40px_0px_#22213366]",
|
|
155
|
-
children: /* @__PURE__ */
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
161
|
+
className: ie("z-[1300]", "box-border flex flex-col overflow-hidden rounded-lg bg-white text-delta-700 outline-none shadow-[inset_0_0_0_1px_var(--colors-delta-300),0px_4px_40px_0px_#22213366]", C),
|
|
162
|
+
children: /* @__PURE__ */ a(me.Provider, {
|
|
163
|
+
value: c,
|
|
164
|
+
children: /* @__PURE__ */ a(Pe, {
|
|
165
|
+
dataTest: i,
|
|
166
|
+
title: p,
|
|
167
|
+
titleId: k,
|
|
168
|
+
viewResultsAction: h(oe),
|
|
169
|
+
resetAction: h(M),
|
|
170
|
+
footerActions: h(S),
|
|
171
|
+
closeLabel: A,
|
|
172
|
+
onClose: n,
|
|
173
|
+
children: h(T)
|
|
174
|
+
})
|
|
165
175
|
})
|
|
166
176
|
})
|
|
167
177
|
})] });
|
|
168
178
|
};
|
|
169
179
|
export {
|
|
170
|
-
|
|
180
|
+
Je as PopoverSheet
|
|
171
181
|
};
|
|
@@ -1,124 +1,134 @@
|
|
|
1
1
|
import { cn as Y } from "../../../helpers/cn.js";
|
|
2
|
-
import { resolveSx as
|
|
3
|
-
import { tabbableWithin as
|
|
4
|
-
import { TOP_LAYER_PROPS as W, TOP_LAYER_RESET_STYLE as $, getOpenModalDialogAncestor as j, shouldUsePopoverTopLayer as q, useTopLayerRef as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
2
|
+
import { resolveSx as h } from "../../../helpers/sx.js";
|
|
3
|
+
import { tabbableWithin as g } from "../../../helpers/focusable.js";
|
|
4
|
+
import { TOP_LAYER_PROPS as W, TOP_LAYER_RESET_STYLE as $, getOpenModalDialogAncestor as j, shouldUsePopoverTopLayer as q, useTopLayerRef as C } from "../../../hooks/useTopLayer.hook.js";
|
|
5
|
+
import { OverlayBackOwnerContext as G, useBackCloses as J } from "../../../hooks/useBackCloses.hook.js";
|
|
6
|
+
import { useEffect as w, useMemo as Q, useRef as V, useState as x } from "react";
|
|
7
|
+
import { jsx as P } from "react/jsx-runtime";
|
|
8
|
+
import { FloatingPortal as X, autoUpdate as Z, flip as ee, offset as te, shift as oe, useDismiss as ne, useFloating as re, useInteractions as se, useMergeRefs as ie } from "@floating-ui/react";
|
|
9
|
+
var ae = {
|
|
9
10
|
vertical: "bottom",
|
|
10
11
|
horizontal: "left"
|
|
11
|
-
},
|
|
12
|
+
}, ce = {
|
|
12
13
|
vertical: "top",
|
|
13
14
|
horizontal: "left"
|
|
14
|
-
},
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
const m =
|
|
18
|
-
|
|
19
|
-
const { refs:
|
|
20
|
-
open:
|
|
21
|
-
placement:
|
|
15
|
+
}, fe = (t, o) => `${o.vertical === "bottom" ? "top" : o.vertical === "top" ? "bottom" : t.vertical === "top" ? "top" : "bottom"}${t.horizontal === "left" ? "-start" : t.horizontal === "right" ? "-end" : ""}`, Pe = ({ open: t, anchorEl: o, onClose: c, anchorOrigin: b = ae, transformOrigin: L = ce, id: D, className: T, sx: K, slotProps: l, onClick: k, children: E, keepMounted: O = !1, tabIntoContent: d = !0, registerBackClose: S = !0 }) => {
|
|
16
|
+
const _ = Q(() => fe(b, L), [b, L]), [R, F] = x(t), f = V(!1);
|
|
17
|
+
t && !R && F(!0);
|
|
18
|
+
const m = t || O && R, p = j(o), [v, M] = x(p);
|
|
19
|
+
o && v !== p && M(p);
|
|
20
|
+
const { refs: i, floatingStyles: A, context: N } = re({
|
|
21
|
+
open: t,
|
|
22
|
+
placement: _,
|
|
22
23
|
strategy: "fixed",
|
|
23
|
-
whileElementsMounted:
|
|
24
|
-
elements: { reference:
|
|
24
|
+
whileElementsMounted: Z,
|
|
25
|
+
elements: { reference: o ?? void 0 },
|
|
25
26
|
middleware: [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
te(4),
|
|
28
|
+
ee({ padding: 8 }),
|
|
29
|
+
oe({ padding: 8 })
|
|
29
30
|
],
|
|
30
31
|
onOpenChange: (e, r, n) => {
|
|
31
|
-
e ||
|
|
32
|
+
e || c?.(r ?? {}, n === "escape-key" ? "escapeKeyDown" : "backdropClick");
|
|
32
33
|
}
|
|
33
|
-
}), { getFloatingProps:
|
|
34
|
+
}), { getFloatingProps: z } = se([ne(N, {
|
|
34
35
|
outsidePress: (e) => {
|
|
35
36
|
const r = e.target;
|
|
36
|
-
return !(
|
|
37
|
+
return !(o instanceof Element && r instanceof Node && o.contains(r));
|
|
37
38
|
},
|
|
38
39
|
escapeKey: !0
|
|
39
|
-
})])
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
})]);
|
|
41
|
+
J({
|
|
42
|
+
active: t && S,
|
|
43
|
+
requestClose: (e) => c ? c(e ?? new Event("overlayBack"), "escapeKeyDown") : !1,
|
|
44
|
+
ownerRef: i.floating
|
|
45
|
+
});
|
|
46
|
+
const u = q(v), H = ie([C(i.setFloating, u)]);
|
|
47
|
+
w(() => {
|
|
48
|
+
if (!t) return;
|
|
49
|
+
const e = o instanceof HTMLElement ? o : null, r = () => i.floating.current?.contains(document.activeElement) ?? !1;
|
|
43
50
|
let n = r();
|
|
44
51
|
const s = () => {
|
|
45
52
|
n = r();
|
|
46
53
|
};
|
|
47
54
|
return document.addEventListener("focusin", s), () => {
|
|
48
55
|
document.removeEventListener("focusin", s);
|
|
49
|
-
const
|
|
50
|
-
n &&
|
|
56
|
+
const a = document.activeElement, y = !a || a === document.body || r();
|
|
57
|
+
n && y && e?.isConnected && e.focus({ preventScroll: !0 });
|
|
51
58
|
};
|
|
52
59
|
}, [
|
|
53
|
-
o,
|
|
54
60
|
t,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
o,
|
|
62
|
+
i.floating
|
|
63
|
+
]), w(() => {
|
|
64
|
+
if (!t) return;
|
|
58
65
|
const e = (n) => {
|
|
59
|
-
if (
|
|
60
|
-
const s =
|
|
61
|
-
if (!s || !(
|
|
62
|
-
const [
|
|
63
|
-
|
|
66
|
+
if (f.current = n.key === "Tab", !d || !f.current || n.shiftKey || n.defaultPrevented) return;
|
|
67
|
+
const s = i.floating.current;
|
|
68
|
+
if (!s || !(o instanceof Element) || !o.contains(document.activeElement)) return;
|
|
69
|
+
const [a] = g(s);
|
|
70
|
+
a && (n.preventDefault(), a.focus({ preventScroll: !0 }), f.current = !1);
|
|
64
71
|
}, r = (n) => {
|
|
65
|
-
const s = n.target,
|
|
66
|
-
|
|
72
|
+
const s = n.target, a = s instanceof Node && ((i.floating.current?.contains(s) ?? !1) || o instanceof Element && o.contains(s));
|
|
73
|
+
f.current && !a && c?.(n, "tabKeyDown"), f.current = !1;
|
|
67
74
|
};
|
|
68
75
|
return document.addEventListener("keydown", e, !0), document.addEventListener("focusin", r), () => {
|
|
69
76
|
document.removeEventListener("keydown", e, !0), document.removeEventListener("focusin", r);
|
|
70
77
|
};
|
|
71
78
|
}, [
|
|
72
|
-
o,
|
|
73
79
|
t,
|
|
74
|
-
|
|
75
|
-
|
|
80
|
+
o,
|
|
81
|
+
c,
|
|
82
|
+
i.floating,
|
|
76
83
|
d
|
|
77
84
|
]);
|
|
78
|
-
const
|
|
79
|
-
onClick:
|
|
85
|
+
const U = t ? z({
|
|
86
|
+
onClick: k,
|
|
80
87
|
onKeyDown: (e) => {
|
|
81
|
-
if (e.key !== "Tab" || e.defaultPrevented || !(
|
|
82
|
-
const r = e.currentTarget, n =
|
|
88
|
+
if (e.key !== "Tab" || e.defaultPrevented || !(o instanceof HTMLElement)) return;
|
|
89
|
+
const r = e.currentTarget, n = g(r), s = n.indexOf(document.activeElement);
|
|
83
90
|
if (s === -1 || (e.shiftKey ? s !== 0 : s !== n.length - 1)) return;
|
|
84
91
|
e.preventDefault();
|
|
85
|
-
const
|
|
86
|
-
|
|
92
|
+
const a = g(document).filter((I) => !r.contains(I)), y = a[a.indexOf(o) + (e.shiftKey ? -1 : 1)], B = (d && e.shiftKey ? void 0 : y) ?? o;
|
|
93
|
+
f.current = !1, B.focus({ preventScroll: !0 }), c?.(e, "tabKeyDown");
|
|
87
94
|
}
|
|
88
95
|
}) : {};
|
|
89
|
-
return
|
|
90
|
-
if (!m || !
|
|
91
|
-
const e =
|
|
96
|
+
return w(() => {
|
|
97
|
+
if (!m || !u) return;
|
|
98
|
+
const e = i.floating.current;
|
|
92
99
|
if (!(!e || typeof e.showPopover != "function"))
|
|
93
100
|
try {
|
|
94
|
-
|
|
101
|
+
t && !e.matches(":popover-open") && e.showPopover(), !t && e.matches(":popover-open") && e.hidePopover();
|
|
95
102
|
} catch {
|
|
96
103
|
}
|
|
97
104
|
}, [
|
|
98
|
-
|
|
105
|
+
t,
|
|
99
106
|
m,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
]), m ? /* @__PURE__ */
|
|
107
|
+
u,
|
|
108
|
+
i.floating
|
|
109
|
+
]), m ? /* @__PURE__ */ P(X, {
|
|
103
110
|
root: v,
|
|
104
|
-
children: /* @__PURE__ */
|
|
105
|
-
ref:
|
|
106
|
-
id:
|
|
107
|
-
...
|
|
111
|
+
children: /* @__PURE__ */ P("div", {
|
|
112
|
+
ref: H,
|
|
113
|
+
id: D,
|
|
114
|
+
...u ? W : {},
|
|
108
115
|
style: {
|
|
109
|
-
...
|
|
110
|
-
...
|
|
111
|
-
...
|
|
112
|
-
...
|
|
116
|
+
...u ? $ : {},
|
|
117
|
+
...t ? A : {},
|
|
118
|
+
...h(K),
|
|
119
|
+
...h(l?.paper?.sx),
|
|
113
120
|
...l?.paper?.style,
|
|
114
|
-
...
|
|
121
|
+
...t ? null : { display: "none" }
|
|
115
122
|
},
|
|
116
|
-
...
|
|
117
|
-
className: Y("z-[1300] overflow-auto rounded bg-white shadow-[0px_1px_12px_0px_rgba(0,0,0,0.15)]",
|
|
118
|
-
children:
|
|
123
|
+
...U,
|
|
124
|
+
className: Y("z-[1300] overflow-auto rounded bg-white shadow-[0px_1px_12px_0px_rgba(0,0,0,0.15)]", T ?? "my-1", l?.paper?.className),
|
|
125
|
+
children: /* @__PURE__ */ P(G.Provider, {
|
|
126
|
+
value: i.floating,
|
|
127
|
+
children: E
|
|
128
|
+
})
|
|
119
129
|
})
|
|
120
130
|
}) : null;
|
|
121
131
|
};
|
|
122
132
|
export {
|
|
123
|
-
|
|
133
|
+
Pe as StyledPopover
|
|
124
134
|
};
|
|
@@ -1,36 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { isOverlayBackEnabled as k, useBackCloses as P } from "../../../hooks/useBackCloses.hook.js";
|
|
2
|
+
import { setPickerPosition as v } from "./helpers.js";
|
|
3
|
+
import { StyledDayPicker as y } from "./components/StyledDayPicker.js";
|
|
4
|
+
import { StyledCalendarPicker as C } from "./components/StyledCalendarPicker.js";
|
|
5
|
+
import { DatePickerInputIndex as b } from "./components/DatePickerInputIndex.js";
|
|
5
6
|
import { useIsMobileView as x } from "../../hooks/useWindowWidthSize.hook.js";
|
|
6
|
-
import { StyledDrawer as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
import { StyledDrawer as h } from "../../../components/navigation/drawer/StyledDrawer.js";
|
|
8
|
+
import { useBackNavigationClose as E } from "../../hooks/useBackNavigationClose.hook.js";
|
|
9
|
+
import { useEffect as D, useState as n } from "react";
|
|
10
|
+
import { Fragment as g, jsx as t, jsxs as w } from "react/jsx-runtime";
|
|
11
|
+
var N = (p) => {
|
|
12
|
+
const i = x(), [e, l] = n(null), [m, d] = n(!1), [f, c] = n(!1), u = (r) => {
|
|
13
|
+
l(r.currentTarget), v(r, d);
|
|
12
14
|
}, o = () => {
|
|
13
|
-
|
|
15
|
+
c(!0), l(null);
|
|
14
16
|
};
|
|
15
|
-
|
|
17
|
+
D(() => {
|
|
16
18
|
if (!e) return;
|
|
17
|
-
const r = (
|
|
18
|
-
document.activeElement === e && (
|
|
19
|
+
const r = (a) => {
|
|
20
|
+
document.activeElement === e && (a.key === "Escape" ? (a.preventDefault(), a.stopPropagation(), o()) : a.key === "Tab" && o());
|
|
19
21
|
};
|
|
20
22
|
return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
|
|
21
|
-
}, [e])
|
|
22
|
-
|
|
23
|
+
}, [e]), P({
|
|
24
|
+
active: !!e,
|
|
25
|
+
requestClose: o
|
|
26
|
+
}), E({
|
|
27
|
+
open: !!e && !k(),
|
|
28
|
+
onClose: o
|
|
29
|
+
});
|
|
30
|
+
const s = {
|
|
23
31
|
...p,
|
|
24
32
|
validateOnCalendarClose: f,
|
|
25
|
-
onValidatedOnce: () =>
|
|
33
|
+
onValidatedOnce: () => c(!1)
|
|
26
34
|
};
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
/* @__PURE__ */ t(
|
|
29
|
-
datePickerProps:
|
|
30
|
-
onClick:
|
|
35
|
+
return /* @__PURE__ */ w(g, { children: [
|
|
36
|
+
/* @__PURE__ */ t(b, {
|
|
37
|
+
datePickerProps: s,
|
|
38
|
+
onClick: u
|
|
31
39
|
}),
|
|
32
|
-
!i && /* @__PURE__ */ t(
|
|
33
|
-
datePickerProps: { ...
|
|
40
|
+
!i && /* @__PURE__ */ t(C, {
|
|
41
|
+
datePickerProps: { ...s },
|
|
34
42
|
popoverProps: {
|
|
35
43
|
open: !!e,
|
|
36
44
|
anchorEl: e,
|
|
@@ -38,15 +46,16 @@ var j = (p) => {
|
|
|
38
46
|
},
|
|
39
47
|
positionAbove: m
|
|
40
48
|
}),
|
|
41
|
-
i && /* @__PURE__ */ t(
|
|
49
|
+
i && /* @__PURE__ */ t(h, {
|
|
42
50
|
anchor: "bottom",
|
|
43
51
|
open: !!e,
|
|
44
52
|
onClose: o,
|
|
45
53
|
anchorEl: e,
|
|
54
|
+
registerBackClose: !1,
|
|
46
55
|
children: /* @__PURE__ */ t("div", {
|
|
47
56
|
className: "mx-auto max-w-[360px] px-2 pb-[max(1.5rem,env(safe-area-inset-bottom))]",
|
|
48
|
-
children: /* @__PURE__ */ t(
|
|
49
|
-
datePickerProps: { ...
|
|
57
|
+
children: /* @__PURE__ */ t(y, {
|
|
58
|
+
datePickerProps: { ...s },
|
|
50
59
|
popoverProps: {
|
|
51
60
|
open: !!e,
|
|
52
61
|
anchorEl: e,
|
|
@@ -58,5 +67,5 @@ var j = (p) => {
|
|
|
58
67
|
] });
|
|
59
68
|
};
|
|
60
69
|
export {
|
|
61
|
-
|
|
70
|
+
N as StyledDatePicker
|
|
62
71
|
};
|
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
import { StyledPopover as i } from "../../../../components/utils/popover/StyledPopover.js";
|
|
2
2
|
import { StyledDayPicker as c } from "./StyledDayPicker.js";
|
|
3
3
|
import { jsx as r } from "react/jsx-runtime";
|
|
4
|
-
var
|
|
5
|
-
const { open: l, anchorEl:
|
|
4
|
+
var d = ({ datePickerProps: o, popoverProps: t, positionAbove: e }) => {
|
|
5
|
+
const { open: l, anchorEl: a, onClose: n } = t;
|
|
6
6
|
return /* @__PURE__ */ r(i, {
|
|
7
7
|
open: l,
|
|
8
|
-
anchorEl:
|
|
9
|
-
onClose:
|
|
8
|
+
anchorEl: a,
|
|
9
|
+
onClose: n,
|
|
10
10
|
tabIntoContent: !1,
|
|
11
|
+
registerBackClose: !1,
|
|
11
12
|
anchorOrigin: {
|
|
12
|
-
vertical:
|
|
13
|
+
vertical: e ? "top" : 50,
|
|
13
14
|
horizontal: "left"
|
|
14
15
|
},
|
|
15
16
|
transformOrigin: {
|
|
16
|
-
vertical:
|
|
17
|
+
vertical: e ? "bottom" : "top",
|
|
17
18
|
horizontal: "left"
|
|
18
19
|
},
|
|
19
20
|
children: /* @__PURE__ */ r("div", {
|
|
20
21
|
className: "p-4",
|
|
21
22
|
children: /* @__PURE__ */ r(c, {
|
|
22
|
-
datePickerProps:
|
|
23
|
+
datePickerProps: o,
|
|
23
24
|
popoverProps: t
|
|
24
25
|
})
|
|
25
26
|
})
|
|
26
27
|
});
|
|
27
28
|
};
|
|
28
29
|
export {
|
|
29
|
-
|
|
30
|
+
d as StyledCalendarPicker
|
|
30
31
|
};
|