asma-ui-core 3.127.2 → 3.128.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/inputs/emoji-choice/StyledEmojiChoice.js +259 -0
- package/dist/components/inputs/emoji-choice/StyledEmojiChoice.module.js +27 -0
- package/dist/components/inputs/radio-button/base-ui/StyledRadio.js +15 -15
- package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +84 -84
- package/dist/components/utils/bottom-sheet/StyledBottomSheet.js +45 -44
- package/dist/components/utils/bottom-sheet/formatResultsLabel.js +6 -2
- package/dist/components/utils/bottom-sheet/sheetCopy.js +15 -0
- package/dist/components/utils/popover/PopoverSheet.js +99 -97
- package/dist/index.js +162 -160
- package/dist/src/components/inputs/emoji-choice/StyledEmojiChoice.d.ts +37 -0
- package/dist/src/components/inputs/emoji-choice/index.d.ts +1 -0
- package/dist/src/components/inputs/select-autocomplete/StyledSelectAutocomplete.d.ts +3 -1
- package/dist/src/components/utils/bottom-sheet/StyledBottomSheet.d.ts +5 -2
- package/dist/src/components/utils/bottom-sheet/formatResultsLabel.d.ts +4 -1
- package/dist/src/components/utils/bottom-sheet/sheetCopy.d.ts +11 -0
- package/dist/src/components/utils/popover/PopoverSheet.d.ts +5 -2
- package/dist/src/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,63 +1,64 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { firstTabbable as
|
|
3
|
-
import { TOP_LAYER_PROPS as
|
|
4
|
-
import { StyledButton as
|
|
5
|
-
import { useMobileMediaQuery as
|
|
6
|
-
import { OverlayBackOwnerContext as
|
|
7
|
-
import { useDebouncedValue as
|
|
8
|
-
import { useFocusTrap as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
1
|
+
import { cn as Le } from "../../../helpers/cn.js";
|
|
2
|
+
import { firstTabbable as ne } from "../../../helpers/focusable.js";
|
|
3
|
+
import { TOP_LAYER_PROPS as Se, TOP_LAYER_RESET_STYLE as Ce, getOpenModalDialogAncestor as _e, shouldUsePopoverTopLayer as Ie, useTopLayerRef as Me } from "../../../hooks/useTopLayer.hook.js";
|
|
4
|
+
import { StyledButton as ke } from "../../inputs/button/StyledButton.js";
|
|
5
|
+
import { useMobileMediaQuery as He } from "../../../hooks/useMediaQuery.hook.js";
|
|
6
|
+
import { OverlayBackOwnerContext as We, requestCloseTopOverlayBack as Be, useBackCloses as De } from "../../../hooks/useBackCloses.hook.js";
|
|
7
|
+
import { useDebouncedValue as qe } from "../../../hooks/useDebouncedValue.hook.js";
|
|
8
|
+
import { useFocusTrap as Xe } from "../../../hooks/useFocusTrap.hook.js";
|
|
9
|
+
import { SHEET_TEXT as $e } from "../bottom-sheet/sheetCopy.js";
|
|
10
|
+
import { formatResultsLabel as Ne } from "../bottom-sheet/formatResultsLabel.js";
|
|
11
|
+
import { StyledBottomSheet as je } from "../bottom-sheet/StyledBottomSheet.js";
|
|
12
|
+
import { PopoverAnatomy as Ke } from "./PopoverAnatomy.js";
|
|
13
|
+
import { useCallback as d, useEffect as v, useId as Ue, useRef as f, useState as l } from "react";
|
|
14
|
+
import { Fragment as re, jsx as m, jsxs as ie } from "react/jsx-runtime";
|
|
15
|
+
import { FloatingPortal as Ye, autoUpdate as ze, flip as Ve, offset as Ge, shift as Qe, size as Je, useDismiss as Ze, useFloating as et, useInteractions as tt, useMergeRefs as ot } from "@floating-ui/react";
|
|
16
|
+
var C = 240, nt = {
|
|
16
17
|
info: 472,
|
|
17
18
|
action: 472
|
|
18
|
-
},
|
|
19
|
-
const g =
|
|
20
|
-
|
|
21
|
-
}, [
|
|
19
|
+
}, se = 0.6, ae = "calc(100vw - 32px)", Pt = ({ dataTest: p, renderTrigger: _, variant: I = "info", title: E, children: M, viewResultsAction: k, resetAction: H, footerActions: W, resultCount: x, locale: R = "en", closeLabel: B = $e[R].close, ariaLabel: D, onOpenChange: q, className: X, align: $ = "auto", ignoreOutside: N }) => {
|
|
20
|
+
const g = Ue(), j = `${g}-title`, [o, ce] = l(!1), [K, le] = l(), [ue, U] = l(), [de, fe] = l("start"), [T, Y] = l(), [me, z] = l(C), u = He(), n = I === "action", pe = u && !n, w = u && n, y = d((e) => {
|
|
21
|
+
ce(e), q?.(e);
|
|
22
|
+
}, [q]), { refs: b, floatingStyles: ge, context: he, placement: V, isPositioned: ve } = et({
|
|
22
23
|
open: o,
|
|
23
|
-
onOpenChange:
|
|
24
|
-
placement: `${
|
|
24
|
+
onOpenChange: y,
|
|
25
|
+
placement: `${T ?? "bottom"}-${de}`,
|
|
25
26
|
strategy: "fixed",
|
|
26
|
-
whileElementsMounted:
|
|
27
|
+
whileElementsMounted: ze,
|
|
27
28
|
middleware: [
|
|
28
|
-
|
|
29
|
-
...
|
|
29
|
+
Ge(8),
|
|
30
|
+
...pe || T ? [] : [Ve({
|
|
30
31
|
padding: 8,
|
|
31
32
|
crossAxis: !1,
|
|
32
33
|
flipAlignment: !1
|
|
33
34
|
})],
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
Qe({ padding: 8 }),
|
|
36
|
+
Je({
|
|
36
37
|
padding: 8,
|
|
37
38
|
apply({ availableHeight: e, rects: t }) {
|
|
38
|
-
|
|
39
|
+
U(Math.min(e, Math.round(window.innerHeight * se))), u || z((a) => Math.max(a, t.floating.width));
|
|
39
40
|
}
|
|
40
41
|
})
|
|
41
42
|
]
|
|
42
43
|
});
|
|
43
|
-
o &&
|
|
44
|
-
const F = Ie(
|
|
45
|
-
c.current = e,
|
|
46
|
-
}, []), ye =
|
|
44
|
+
o && ve && !T && Y(V.startsWith("top") ? "top" : "bottom");
|
|
45
|
+
const F = Ie(K), c = f(null), [r, Ee] = l(null), we = d((e) => {
|
|
46
|
+
c.current = e, Ee(e);
|
|
47
|
+
}, []), ye = ot([Me(b.setFloating, F), we]), A = f(null), Pe = d((e) => {
|
|
47
48
|
A.current = e, b.setReference(e);
|
|
48
|
-
}, [b]),
|
|
49
|
+
}, [b]), G = f(null), O = N?.length ? N.join(",") : void 0, Q = f(O);
|
|
49
50
|
v(() => {
|
|
50
|
-
|
|
51
|
-
}, [
|
|
51
|
+
Q.current = O;
|
|
52
|
+
}, [O]);
|
|
52
53
|
const h = d((e) => {
|
|
53
54
|
if (!(e instanceof Element)) return !1;
|
|
54
|
-
if (c.current?.contains(e) || A.current?.contains(e) ||
|
|
55
|
-
const t =
|
|
55
|
+
if (c.current?.contains(e) || A.current?.contains(e) || G.current === e) return !0;
|
|
56
|
+
const t = Q.current;
|
|
56
57
|
return t !== void 0 && e.closest(t) !== null;
|
|
57
|
-
}, []),
|
|
58
|
-
|
|
59
|
-
}, []), { getFloatingProps:
|
|
60
|
-
enabled: !
|
|
58
|
+
}, []), J = f(null), xe = d((e) => {
|
|
59
|
+
G.current = e.target, e.target instanceof HTMLElement && c.current?.contains(e.target) && (J.current = e.target);
|
|
60
|
+
}, []), { getFloatingProps: Re } = tt([Ze(he, {
|
|
61
|
+
enabled: !w,
|
|
61
62
|
escapeKey: !1,
|
|
62
63
|
outsidePress: (e) => {
|
|
63
64
|
const t = e.target;
|
|
@@ -67,24 +68,24 @@ var C = 240, tt = {
|
|
|
67
68
|
return !a || a.contains(c.current);
|
|
68
69
|
}
|
|
69
70
|
})]), s = d(() => {
|
|
70
|
-
|
|
71
|
-
}, [
|
|
72
|
-
|
|
71
|
+
y(!1);
|
|
72
|
+
}, [y]);
|
|
73
|
+
De({
|
|
73
74
|
active: o,
|
|
74
75
|
requestClose: s,
|
|
75
76
|
ownerRef: c
|
|
76
77
|
}), v(() => {
|
|
77
|
-
if (!o ||
|
|
78
|
+
if (!o || w) return;
|
|
78
79
|
const e = (t) => {
|
|
79
|
-
t.key !== "Escape" || t.defaultPrevented || t.isComposing || (t.preventDefault(), t.stopImmediatePropagation(),
|
|
80
|
+
t.key !== "Escape" || t.defaultPrevented || t.isComposing || (t.preventDefault(), t.stopImmediatePropagation(), Be(t));
|
|
80
81
|
};
|
|
81
82
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
82
|
-
}, [o,
|
|
83
|
-
const [
|
|
83
|
+
}, [o, w]), Xe(o && n && r !== null, c);
|
|
84
|
+
const [Z, Te] = l(!1);
|
|
84
85
|
v(() => {
|
|
85
|
-
if (!r || n && !
|
|
86
|
+
if (!r || n && !Z) return;
|
|
86
87
|
const e = requestAnimationFrame(() => {
|
|
87
|
-
(n ?
|
|
88
|
+
(n ? ne(r) : r)?.focus({ preventScroll: !0 });
|
|
88
89
|
});
|
|
89
90
|
return () => {
|
|
90
91
|
cancelAnimationFrame(e);
|
|
@@ -92,7 +93,7 @@ var C = 240, tt = {
|
|
|
92
93
|
}, [
|
|
93
94
|
r,
|
|
94
95
|
n,
|
|
95
|
-
|
|
96
|
+
Z
|
|
96
97
|
]), v(() => {
|
|
97
98
|
if (!r) return;
|
|
98
99
|
let e = 0;
|
|
@@ -100,18 +101,18 @@ var C = 240, tt = {
|
|
|
100
101
|
cancelAnimationFrame(e), e = requestAnimationFrame(() => {
|
|
101
102
|
const i = document.activeElement;
|
|
102
103
|
if (!r.isConnected || i && i !== document.body && h(i)) return;
|
|
103
|
-
const
|
|
104
|
-
(
|
|
104
|
+
const S = J.current;
|
|
105
|
+
(S?.isConnected && r.contains(S) ? S : ne(r) ?? r).focus({ preventScroll: !0 });
|
|
105
106
|
});
|
|
106
107
|
}, a = (i) => {
|
|
107
108
|
i.relatedTarget === null && s();
|
|
108
|
-
}, ee = (i) => {
|
|
109
|
-
i.relatedTarget === null && h(i.target) && t();
|
|
110
109
|
}, te = (i) => {
|
|
110
|
+
i.relatedTarget === null && h(i.target) && t();
|
|
111
|
+
}, oe = (i) => {
|
|
111
112
|
!r.isConnected || h(i.target) || (n ? t() : s());
|
|
112
113
|
};
|
|
113
|
-
return n ? document.addEventListener("focusout",
|
|
114
|
-
cancelAnimationFrame(e), document.removeEventListener("focusout",
|
|
114
|
+
return n ? document.addEventListener("focusout", te) : r.addEventListener("focusout", a), document.addEventListener("focusin", oe), () => {
|
|
115
|
+
cancelAnimationFrame(e), document.removeEventListener("focusout", te), r.removeEventListener("focusout", a), document.removeEventListener("focusin", oe);
|
|
115
116
|
};
|
|
116
117
|
}, [
|
|
117
118
|
r,
|
|
@@ -119,14 +120,14 @@ var C = 240, tt = {
|
|
|
119
120
|
s,
|
|
120
121
|
h
|
|
121
122
|
]);
|
|
122
|
-
const
|
|
123
|
+
const L = f(!1);
|
|
123
124
|
v(() => {
|
|
124
125
|
if (o) {
|
|
125
|
-
|
|
126
|
+
L.current = !0;
|
|
126
127
|
return;
|
|
127
128
|
}
|
|
128
|
-
if (!
|
|
129
|
-
|
|
129
|
+
if (!L.current) return;
|
|
130
|
+
L.current = !1;
|
|
130
131
|
const e = A.current;
|
|
131
132
|
if (!e) return;
|
|
132
133
|
const t = requestAnimationFrame(() => {
|
|
@@ -136,7 +137,7 @@ var C = 240, tt = {
|
|
|
136
137
|
cancelAnimationFrame(t);
|
|
137
138
|
};
|
|
138
139
|
}, [o]);
|
|
139
|
-
const
|
|
140
|
+
const ee = {
|
|
140
141
|
ref: Pe,
|
|
141
142
|
isOpen: o,
|
|
142
143
|
triggerProps: {
|
|
@@ -145,79 +146,80 @@ var C = 240, tt = {
|
|
|
145
146
|
s();
|
|
146
147
|
return;
|
|
147
148
|
}
|
|
148
|
-
|
|
149
|
+
le(_e(e.currentTarget));
|
|
149
150
|
const t = e.currentTarget.getBoundingClientRect(), a = t.left + t.width / 2 > window.innerWidth / 2;
|
|
150
|
-
|
|
151
|
+
fe($ === "auto" ? a ? "end" : "start" : $), Y(void 0), z(C), U(Math.round(window.innerHeight * se)), Te(e.detail === 0), y(!0);
|
|
151
152
|
},
|
|
152
153
|
"aria-expanded": o,
|
|
153
154
|
"aria-controls": o ? g : void 0,
|
|
154
155
|
"aria-haspopup": n ? "dialog" : void 0,
|
|
155
156
|
"aria-describedby": !n && o ? g : void 0
|
|
156
157
|
}
|
|
157
|
-
},
|
|
158
|
+
}, P = (e) => typeof e == "function" ? e({ close: s }) : e, be = qe(x, 500), Fe = k ?? (x === void 0 ? void 0 : /* @__PURE__ */ m(ke, {
|
|
158
159
|
dataTest: `${p}-view-results`,
|
|
159
160
|
type: "button",
|
|
160
161
|
variant: "text",
|
|
161
162
|
onClick: s,
|
|
162
|
-
children:
|
|
163
|
-
})), Ae = u ?
|
|
164
|
-
return
|
|
163
|
+
children: Ne(be, R)
|
|
164
|
+
})), Ae = u ? ae : nt[I], Oe = u ? ae : void 0;
|
|
165
|
+
return w ? /* @__PURE__ */ ie(re, { children: [_(ee), /* @__PURE__ */ m(je, {
|
|
165
166
|
id: g,
|
|
166
167
|
dataTest: p,
|
|
167
168
|
open: o,
|
|
168
169
|
onClose: s,
|
|
169
170
|
registerBackClose: !1,
|
|
170
171
|
ownerRef: c,
|
|
171
|
-
title:
|
|
172
|
-
ariaLabel:
|
|
173
|
-
viewResultsAction:
|
|
174
|
-
resetAction:
|
|
175
|
-
footerActions:
|
|
176
|
-
resultCount:
|
|
177
|
-
|
|
178
|
-
|
|
172
|
+
title: E,
|
|
173
|
+
ariaLabel: D,
|
|
174
|
+
viewResultsAction: k,
|
|
175
|
+
resetAction: H,
|
|
176
|
+
footerActions: W,
|
|
177
|
+
resultCount: x,
|
|
178
|
+
locale: R,
|
|
179
|
+
closeLabel: B,
|
|
180
|
+
className: X,
|
|
179
181
|
children: M
|
|
180
|
-
})] }) : /* @__PURE__ */ re
|
|
181
|
-
root:
|
|
182
|
+
})] }) : /* @__PURE__ */ ie(re, { children: [_(ee), o && /* @__PURE__ */ m(Ye, {
|
|
183
|
+
root: K,
|
|
182
184
|
children: /* @__PURE__ */ m("div", {
|
|
183
|
-
...
|
|
185
|
+
...Re(),
|
|
184
186
|
onFocusCapture: xe,
|
|
185
187
|
ref: ye,
|
|
186
188
|
id: g,
|
|
187
|
-
"data-placement":
|
|
189
|
+
"data-placement": V,
|
|
188
190
|
"data-test": p,
|
|
189
191
|
"data-testid": p,
|
|
190
192
|
role: n ? "dialog" : void 0,
|
|
191
|
-
"aria-labelledby": n &&
|
|
192
|
-
"aria-label": n && !
|
|
193
|
+
"aria-labelledby": n && E ? j : void 0,
|
|
194
|
+
"aria-label": n && !E ? D : void 0,
|
|
193
195
|
tabIndex: n ? void 0 : -1,
|
|
194
|
-
...F ?
|
|
196
|
+
...F ? Se : {},
|
|
195
197
|
style: {
|
|
196
198
|
...F ? Ce : {},
|
|
197
|
-
...
|
|
198
|
-
minWidth: u ? C :
|
|
199
|
-
width:
|
|
199
|
+
...ge,
|
|
200
|
+
minWidth: u ? C : me,
|
|
201
|
+
width: Oe,
|
|
200
202
|
maxWidth: Ae,
|
|
201
|
-
maxHeight:
|
|
203
|
+
maxHeight: ue
|
|
202
204
|
},
|
|
203
|
-
className:
|
|
204
|
-
children: /* @__PURE__ */ m(
|
|
205
|
+
className: Le("z-[1300]", "relative box-border flex flex-col overflow-hidden rounded-lg bg-white text-delta-700 outline-none shadow-[0px_4px_40px_0px_#22213366]", X),
|
|
206
|
+
children: /* @__PURE__ */ m(We.Provider, {
|
|
205
207
|
value: c,
|
|
206
|
-
children: /* @__PURE__ */ m(
|
|
208
|
+
children: /* @__PURE__ */ m(Ke, {
|
|
207
209
|
dataTest: p,
|
|
208
|
-
title:
|
|
209
|
-
titleId:
|
|
210
|
-
viewResultsAction:
|
|
211
|
-
resetAction:
|
|
212
|
-
footerActions:
|
|
213
|
-
closeLabel:
|
|
210
|
+
title: E,
|
|
211
|
+
titleId: j,
|
|
212
|
+
viewResultsAction: P(Fe),
|
|
213
|
+
resetAction: P(H),
|
|
214
|
+
footerActions: P(W),
|
|
215
|
+
closeLabel: B,
|
|
214
216
|
onClose: s,
|
|
215
|
-
children:
|
|
217
|
+
children: P(M)
|
|
216
218
|
})
|
|
217
219
|
})
|
|
218
220
|
})
|
|
219
221
|
})] });
|
|
220
222
|
};
|
|
221
223
|
export {
|
|
222
|
-
|
|
224
|
+
Pt as PopoverSheet
|
|
223
225
|
};
|