asma-ui-core 3.111.0 → 3.113.0
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/dynamic-select/components/DynamicSelectAutocomplete.js +95 -93
- package/dist/components/inputs/full-screen-picker/FullScreenPicker.js +93 -0
- package/dist/components/inputs/full-screen-picker/PickerLiveRegion.js +34 -0
- package/dist/components/inputs/full-screen-picker/pickerCopy.js +34 -0
- package/dist/components/inputs/full-screen-picker/useVisualViewportHeight.js +10 -0
- package/dist/components/inputs/input-field/StyledInputField.js +147 -157
- package/dist/components/inputs/phone-field/CountryCodeOptions.js +28 -24
- package/dist/components/inputs/phone-field/CountryCodeSelect.js +82 -75
- package/dist/components/inputs/select-autocomplete/SelectAutocompletePicker.js +217 -0
- package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +270 -220
- package/dist/components/inputs/select-autocomplete/draftChanges.js +24 -0
- package/dist/components/inputs/select-autocomplete/listboxCursor.js +7 -0
- package/dist/components/inputs/select-autocomplete/readFieldName.js +18 -0
- package/dist/components/inputs/textarea/StyledTextarea.js +46 -47
- package/dist/hooks/useMediaQuery.hook.js +12 -8
- package/dist/index.js +137 -133
- package/dist/src/components/inputs/dynamic-select/StyledDynamicSelect.d.ts +4 -1
- package/dist/src/components/inputs/full-screen-picker/FullScreenPicker.d.ts +62 -0
- package/dist/src/components/inputs/full-screen-picker/PickerLiveRegion.d.ts +31 -0
- package/dist/src/components/inputs/full-screen-picker/index.d.ts +2 -0
- package/dist/src/components/inputs/full-screen-picker/pickerCopy.d.ts +29 -0
- package/dist/src/components/inputs/full-screen-picker/useVisualViewportHeight.d.ts +8 -0
- package/dist/src/components/inputs/input-field/StyledInputField.d.ts +4 -1
- package/dist/src/components/inputs/phone-field/CountryCodeOptions.d.ts +9 -1
- package/dist/src/components/inputs/phone-field/CountryCodeSelect.d.ts +4 -3
- package/dist/src/components/inputs/phone-field/useCountryPicker.d.ts +2 -1
- package/dist/src/components/inputs/select-autocomplete/SelectAutocompletePicker.d.ts +52 -0
- package/dist/src/components/inputs/select-autocomplete/StyledSelectAutocomplete.d.ts +21 -2
- package/dist/src/components/inputs/select-autocomplete/draftChanges.d.ts +17 -0
- package/dist/src/components/inputs/select-autocomplete/listboxCursor.d.ts +9 -0
- package/dist/src/components/inputs/select-autocomplete/readFieldName.d.ts +13 -0
- package/dist/src/helpers/CharacterCounter.d.ts +2 -1
- package/dist/src/hooks/useMediaQuery.hook.d.ts +6 -0
- package/dist/src/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,173 +1,175 @@
|
|
|
1
|
-
import { cn as
|
|
1
|
+
import { cn as u } from "../../../../helpers/cn.js";
|
|
2
2
|
import { StyledTooltip as E } from "../../../data-display/tooltip/StyledTooltip.js";
|
|
3
|
-
import { LoadingIcon as
|
|
3
|
+
import { LoadingIcon as ie } from "../../../icons/loading-icon/LoadingIcon.js";
|
|
4
4
|
import { CheckIcon as ae } from "../../../icons/check-icon/CheckIcon.js";
|
|
5
|
-
import { PlusIconCircle as
|
|
5
|
+
import { PlusIconCircle as oe } from "../../../icons/plus-icon-circle/PlusIconCircle.js";
|
|
6
6
|
import { StyledChip as F } from "../../../data-display/chip/StyledChip.js";
|
|
7
|
-
import { StyledCheckbox as
|
|
8
|
-
import { fieldWidthStyle as
|
|
7
|
+
import { StyledCheckbox as ne } from "../../checkbox/base-ui/StyledCheckbox.js";
|
|
8
|
+
import { fieldWidthStyle as de } from "../../field-styles.js";
|
|
9
9
|
import { StyledInputField as se } from "../../input-field/StyledInputField.js";
|
|
10
|
-
import { StyledSelectAutocomplete as
|
|
11
|
-
import { DynamicSelectTitle as
|
|
12
|
-
import { DynamicInteractiveChipGroup as
|
|
13
|
-
import { createElement as K, forwardRef as
|
|
14
|
-
import { Fragment as H, jsx as l, jsxs as
|
|
15
|
-
var
|
|
16
|
-
const [_,
|
|
17
|
-
const t =
|
|
18
|
-
return t == null ? "" : typeof t == "string" || typeof t == "number" || typeof t == "boolean" ? String(t) : e == null ? "" :
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
}, [
|
|
22
|
-
|
|
23
|
-
}, [
|
|
24
|
-
if (
|
|
25
|
-
const
|
|
26
|
-
return /* @__PURE__ */
|
|
10
|
+
import { StyledSelectAutocomplete as ce } from "../../select-autocomplete/StyledSelectAutocomplete.js";
|
|
11
|
+
import { DynamicSelectTitle as ue } from "./DynamicSelectTitle.js";
|
|
12
|
+
import { DynamicInteractiveChipGroup as me } from "./DynamicInteractiveChipGroup.js";
|
|
13
|
+
import { createElement as K, forwardRef as pe, useCallback as f, useState as be } from "react";
|
|
14
|
+
import { Fragment as H, jsx as l, jsxs as C } from "react/jsx-runtime";
|
|
15
|
+
var Pe = pe((O, W) => {
|
|
16
|
+
const [_, S] = be(!1), { options: I, dataTest: g, value: x, readOnly: m, multiple: o, required: R, onChange: y, size: G, rowSize: v = "compact", title: w, titleSize: J, width: N = "full", noOptionsText: M, placeholder: Q, disabled: P, helperText: U, disableHelperText: A, error: V, valueKey: $ = "value", labelKey: X = "label", renderLabel: s, getOptionTooltip: B, startAdornment: Y, autocompleteProps: n, loading: p, maxTags: Z, onFocus: ee, onBlur: te, locale: le } = O, c = (e) => typeof e == "object" ? e?.[X]?.toString() ?? "" : e?.toString() ?? "", b = f((e) => typeof e == "object" ? e?.[$] : e, [$]), D = f((e, t) => b(e) === b(t), [b]), T = (e) => {
|
|
17
|
+
const t = b(e);
|
|
18
|
+
return t == null ? "" : typeof t == "string" || typeof t == "number" || typeof t == "boolean" ? String(t) : e == null ? "" : c(e);
|
|
19
|
+
}, j = f((e) => {
|
|
20
|
+
S(!0), n?.onOpen?.(e);
|
|
21
|
+
}, [n]), re = f((e, t) => {
|
|
22
|
+
S(!1), n?.onClose?.(e, t);
|
|
23
|
+
}, [n]);
|
|
24
|
+
if (o && m) return /* @__PURE__ */ l(me, { ...O });
|
|
25
|
+
const k = w ? `${g}-title` : void 0;
|
|
26
|
+
return /* @__PURE__ */ C("div", {
|
|
27
27
|
className: "flex flex-col gap-y-1",
|
|
28
|
-
"data-field-width":
|
|
29
|
-
style:
|
|
30
|
-
children: [/* @__PURE__ */ l(
|
|
31
|
-
id:
|
|
32
|
-
title:
|
|
28
|
+
"data-field-width": N,
|
|
29
|
+
style: de(N),
|
|
30
|
+
children: [/* @__PURE__ */ l(ue, {
|
|
31
|
+
id: k,
|
|
32
|
+
title: w,
|
|
33
33
|
titleSize: J
|
|
34
|
-
}), /* @__PURE__ */ l(
|
|
34
|
+
}), /* @__PURE__ */ l(ce, {
|
|
35
35
|
open: _,
|
|
36
|
-
onOpen:
|
|
37
|
-
onClose:
|
|
38
|
-
disableCloseOnSelect:
|
|
39
|
-
dataTest:
|
|
40
|
-
|
|
36
|
+
onOpen: j,
|
|
37
|
+
onClose: re,
|
|
38
|
+
disableCloseOnSelect: o,
|
|
39
|
+
dataTest: g,
|
|
40
|
+
pickerTitle: w,
|
|
41
|
+
locale: le,
|
|
42
|
+
disabled: !!P || !!p,
|
|
41
43
|
noOptionsText: M,
|
|
42
|
-
loading:
|
|
43
|
-
readOnly:
|
|
44
|
-
value:
|
|
44
|
+
loading: p,
|
|
45
|
+
readOnly: m,
|
|
46
|
+
value: x,
|
|
45
47
|
size: G,
|
|
46
|
-
rowSize:
|
|
48
|
+
rowSize: v,
|
|
47
49
|
disableClearable: R,
|
|
48
|
-
options:
|
|
50
|
+
options: I,
|
|
49
51
|
fullWidth: !0,
|
|
50
52
|
classes: { listbox: "max-h-[300px]" },
|
|
51
|
-
getOptionLabel:
|
|
53
|
+
getOptionLabel: n?.getOptionLabel ?? c,
|
|
52
54
|
onChange: (e, t) => {
|
|
53
|
-
|
|
55
|
+
y(t);
|
|
54
56
|
},
|
|
55
57
|
filterSelectedOptions: !1,
|
|
56
|
-
isOptionEqualToValue:
|
|
58
|
+
isOptionEqualToValue: n?.isOptionEqualToValue ?? D,
|
|
57
59
|
autoHeight: !0,
|
|
58
|
-
multiple:
|
|
59
|
-
renderValue:
|
|
60
|
+
multiple: o,
|
|
61
|
+
renderValue: o ? (e) => {
|
|
60
62
|
if (!Array.isArray(e)) return null;
|
|
61
|
-
const t = e,
|
|
62
|
-
return [...
|
|
63
|
-
dataTest: `${
|
|
64
|
-
readOnly:
|
|
63
|
+
const t = e, a = Z ?? I.length, i = t.slice(0, a), d = t.length - a;
|
|
64
|
+
return [...i.map((r) => /* @__PURE__ */ l(F, {
|
|
65
|
+
dataTest: `${T(r)}-chip`,
|
|
66
|
+
readOnly: m,
|
|
65
67
|
variant: "outlined",
|
|
66
|
-
label: s ? s(r) :
|
|
68
|
+
label: s ? s(r) : c(r),
|
|
67
69
|
classes: {
|
|
68
70
|
root: "h-fit w-fit min-h-[32px]",
|
|
69
71
|
label: "block whitespace-normal"
|
|
70
72
|
},
|
|
71
|
-
disabled: !!
|
|
73
|
+
disabled: !!P || !!p,
|
|
72
74
|
deleteButtonTabIndex: -1,
|
|
73
75
|
onDelete: () => {
|
|
74
|
-
Array.isArray(
|
|
76
|
+
Array.isArray(x) && y(x.filter((h) => !D(h, r)));
|
|
75
77
|
}
|
|
76
|
-
},
|
|
78
|
+
}, T(r))), d > 0 ? /* @__PURE__ */ l(F, {
|
|
77
79
|
dataTest: "remaining-count-tag-chip",
|
|
78
|
-
label: `+${
|
|
80
|
+
label: `+${d}`,
|
|
79
81
|
variant: "outlined",
|
|
80
82
|
tabIndex: -1,
|
|
81
|
-
onClick:
|
|
83
|
+
onClick: j
|
|
82
84
|
}, "remaining-count") : null];
|
|
83
85
|
} : void 0,
|
|
84
|
-
popupIcon:
|
|
86
|
+
popupIcon: p ? /* @__PURE__ */ l(ie, {
|
|
85
87
|
height: 24,
|
|
86
88
|
width: 24
|
|
87
|
-
}) :
|
|
89
|
+
}) : o ? /* @__PURE__ */ l(oe, {
|
|
88
90
|
height: 24,
|
|
89
91
|
width: 24
|
|
90
92
|
}) : void 0,
|
|
91
|
-
renderOption: (e, t,
|
|
92
|
-
const
|
|
93
|
+
renderOption: (e, t, a) => {
|
|
94
|
+
const i = typeof t == "object" ? !!t?.disabled : !1, d = B ? B(t) : null, r = i && d ? `${e.id}-reason` : void 0, h = r && e["data-active"] !== void 0 ? !0 : void 0, z = r && /* @__PURE__ */ l("span", {
|
|
93
95
|
id: r,
|
|
94
96
|
className: "sr-only",
|
|
95
97
|
"aria-hidden": "true",
|
|
96
|
-
children:
|
|
98
|
+
children: d
|
|
97
99
|
});
|
|
98
|
-
if (
|
|
99
|
-
const
|
|
100
|
+
if (o) {
|
|
101
|
+
const q = a.selected;
|
|
100
102
|
return /* @__PURE__ */ K("li", {
|
|
101
103
|
...e,
|
|
102
104
|
role: "option",
|
|
103
|
-
"aria-selected":
|
|
105
|
+
"aria-selected": q,
|
|
104
106
|
key: e.id,
|
|
105
|
-
onClick:
|
|
106
|
-
className:
|
|
107
|
-
"aria-disabled":
|
|
107
|
+
onClick: i ? void 0 : e.onClick,
|
|
108
|
+
className: u("relative box-border flex cursor-pointer items-center bg-white py-2 text-base text-delta-800 aria-selected:bg-gama-50 hover:bg-delta-50", a.inPicker ? "gap-x-0.5 pl-0.5" : "gap-x-1 px-2", v === "regular" ? "min-h-12" : "min-h-10", i && "cursor-not-allowed bg-delta-50 aria-selected:!bg-delta-50 hover:!bg-delta-50 [&_*]:cursor-not-allowed"),
|
|
109
|
+
"aria-disabled": i,
|
|
108
110
|
"aria-describedby": r
|
|
109
|
-
},
|
|
111
|
+
}, z, e["data-active"] !== void 0 && /* @__PURE__ */ l("span", {
|
|
110
112
|
"aria-hidden": "true",
|
|
111
113
|
className: "border-l-solid pointer-events-none absolute inset-y-0 left-0 border-l-[3px] border-focus-ring"
|
|
112
114
|
}), /* @__PURE__ */ l(E, {
|
|
113
115
|
arrow: !0,
|
|
114
|
-
title:
|
|
115
|
-
open:
|
|
116
|
-
children: /* @__PURE__ */
|
|
117
|
-
disabled:
|
|
118
|
-
dataTest: `${
|
|
116
|
+
title: d,
|
|
117
|
+
open: h,
|
|
118
|
+
children: /* @__PURE__ */ C(H, { children: [/* @__PURE__ */ l(ne, {
|
|
119
|
+
disabled: i,
|
|
120
|
+
dataTest: `${T(t)}-checkbox`,
|
|
119
121
|
size: "small",
|
|
120
122
|
decorative: !0,
|
|
121
123
|
hideWrapper: !0,
|
|
122
124
|
className: "min-w-[36px]",
|
|
123
|
-
checked:
|
|
125
|
+
checked: q
|
|
124
126
|
}), s ? s(t) : /* @__PURE__ */ l("span", {
|
|
125
|
-
className: "line-clamp-2 h-fit min-w-0 flex-1 break-words text-base
|
|
126
|
-
children:
|
|
127
|
+
className: u(!a.inPicker && "line-clamp-2", "h-fit min-w-0 flex-1 break-words text-base"),
|
|
128
|
+
children: c(t)
|
|
127
129
|
})] })
|
|
128
130
|
}));
|
|
129
131
|
}
|
|
130
|
-
const
|
|
132
|
+
const L = a.selected;
|
|
131
133
|
return /* @__PURE__ */ K("li", {
|
|
132
134
|
...e,
|
|
133
135
|
role: "option",
|
|
134
|
-
"aria-selected":
|
|
136
|
+
"aria-selected": L,
|
|
135
137
|
key: e.id,
|
|
136
|
-
className:
|
|
137
|
-
onClick:
|
|
138
|
-
"aria-disabled":
|
|
138
|
+
className: u("relative box-border flex cursor-pointer items-center gap-x-1 px-2 py-2 text-base text-delta-800 aria-selected:bg-gama-50 hover:bg-delta-50", v === "regular" ? "min-h-12" : "min-h-10", i && "cursor-not-allowed bg-delta-50 aria-selected:!bg-delta-50 hover:!bg-delta-50 [&_*]:cursor-not-allowed"),
|
|
139
|
+
onClick: i ? void 0 : e.onClick,
|
|
140
|
+
"aria-disabled": i,
|
|
139
141
|
"aria-describedby": r
|
|
140
|
-
},
|
|
142
|
+
}, z, e["data-active"] !== void 0 && /* @__PURE__ */ l("span", {
|
|
141
143
|
"aria-hidden": "true",
|
|
142
144
|
className: "border-l-solid pointer-events-none absolute inset-y-0 left-0 border-l-[3px] border-focus-ring"
|
|
143
145
|
}), /* @__PURE__ */ l(E, {
|
|
144
146
|
arrow: !0,
|
|
145
|
-
title:
|
|
146
|
-
open:
|
|
147
|
-
children: /* @__PURE__ */
|
|
148
|
-
className: "w-5 min-w-5",
|
|
149
|
-
children:
|
|
147
|
+
title: d,
|
|
148
|
+
open: h,
|
|
149
|
+
children: /* @__PURE__ */ C(H, { children: [/* @__PURE__ */ l("span", {
|
|
150
|
+
className: u("w-5 min-w-5", a.inPicker && "flex"),
|
|
151
|
+
children: L && /* @__PURE__ */ l(ae, {
|
|
150
152
|
className: "size-5 min-h-5 min-w-5 text-gama-500",
|
|
151
153
|
height: 20,
|
|
152
154
|
width: 20
|
|
153
155
|
})
|
|
154
156
|
}), s ? s(t) : /* @__PURE__ */ l("span", {
|
|
155
|
-
className: "line-clamp-2 min-w-0 flex-1 break-words text-base
|
|
156
|
-
children:
|
|
157
|
+
className: u(!a.inPicker && "line-clamp-2", "min-w-0 flex-1 break-words text-base"),
|
|
158
|
+
children: c(t)
|
|
157
159
|
})] })
|
|
158
160
|
}));
|
|
159
161
|
},
|
|
160
162
|
renderInput: (e) => /* @__PURE__ */ l(se, {
|
|
161
|
-
dataTest: `${
|
|
163
|
+
dataTest: `${g}-input-field`,
|
|
162
164
|
...e,
|
|
163
165
|
inputRef: W,
|
|
164
|
-
error:
|
|
166
|
+
error: V,
|
|
165
167
|
helperText: A ? void 0 : U,
|
|
166
|
-
reserveHelperText: A ? !1 :
|
|
168
|
+
reserveHelperText: A ? !1 : V !== void 0,
|
|
167
169
|
variant: "outlined",
|
|
168
170
|
label: "",
|
|
169
171
|
placeholder: Q,
|
|
170
|
-
readOnly:
|
|
172
|
+
readOnly: m,
|
|
171
173
|
onFocus: ee,
|
|
172
174
|
onBlur: te,
|
|
173
175
|
onKeyDown: e.onKeyDown,
|
|
@@ -180,14 +182,14 @@ var Ne = me((C, W) => {
|
|
|
180
182
|
},
|
|
181
183
|
htmlInput: {
|
|
182
184
|
...e.slotProps?.htmlInput ?? {},
|
|
183
|
-
...
|
|
185
|
+
...k ? { "aria-labelledby": k } : {}
|
|
184
186
|
}
|
|
185
187
|
}
|
|
186
188
|
}),
|
|
187
|
-
...
|
|
189
|
+
...n
|
|
188
190
|
})]
|
|
189
191
|
});
|
|
190
192
|
});
|
|
191
193
|
export {
|
|
192
|
-
|
|
194
|
+
Pe as DynamicSelectAutocomplete
|
|
193
195
|
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { CloseIcon as b } from "../../icons/close-icon/CloseIcon.js";
|
|
2
|
+
import { StyledButton as w } from "../button/StyledButton.js";
|
|
3
|
+
import { useShortViewportMediaQuery as g } from "../../../hooks/useMediaQuery.hook.js";
|
|
4
|
+
import { StyledDialog as y } from "../../feedback/dialog/StyledDialog.js";
|
|
5
|
+
import { PickerLiveRegion as N } from "./PickerLiveRegion.js";
|
|
6
|
+
import { useVisualViewportHeight as S } from "./useVisualViewportHeight.js";
|
|
7
|
+
import { useEffect as k, useRef as x } from "react";
|
|
8
|
+
import { jsx as e, jsxs as f } from "react/jsx-runtime";
|
|
9
|
+
var q = ({ open: i, onClose: l, dataTest: o, title: r, fallbackName: a, ...n }) => {
|
|
10
|
+
const t = r != null && r !== !1 && r !== "";
|
|
11
|
+
return /* @__PURE__ */ e(y, {
|
|
12
|
+
open: i,
|
|
13
|
+
onClose: (h, s) => l(s),
|
|
14
|
+
dataTest: o,
|
|
15
|
+
fullScreen: !0,
|
|
16
|
+
showCloseIcon: !1,
|
|
17
|
+
ariaLabel: t ? void 0 : a,
|
|
18
|
+
children: /* @__PURE__ */ e(I, {
|
|
19
|
+
...n,
|
|
20
|
+
dataTest: o,
|
|
21
|
+
title: t ? r : void 0,
|
|
22
|
+
onClose: l
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
}, I = ({ dataTest: i, title: l, closeLabel: o, search: r, headerRow: a, children: n, announcement: t, onClose: h }) => {
|
|
26
|
+
const s = g(), p = S(), c = x(null), u = x(null);
|
|
27
|
+
return k(() => {
|
|
28
|
+
const v = requestAnimationFrame(() => {
|
|
29
|
+
const d = c.current?.closest("dialog");
|
|
30
|
+
if (!d || document.activeElement !== d || !d.matches(":focus-visible")) return;
|
|
31
|
+
const m = u.current?.querySelector('[role="listbox"]');
|
|
32
|
+
(m && m.tabIndex >= 0 ? m : c.current)?.focus({ preventScroll: !0 });
|
|
33
|
+
});
|
|
34
|
+
return () => cancelAnimationFrame(v);
|
|
35
|
+
}, []), /* @__PURE__ */ f("div", {
|
|
36
|
+
className: "flex min-h-0 flex-col",
|
|
37
|
+
style: { height: p },
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ f("div", {
|
|
40
|
+
"data-testid": `${i}-header`,
|
|
41
|
+
className: "flex shrink-0 flex-col border-0 border-b border-solid border-delta-200 bg-white",
|
|
42
|
+
children: [
|
|
43
|
+
/* @__PURE__ */ f("div", {
|
|
44
|
+
className: "flex items-start gap-2",
|
|
45
|
+
children: [
|
|
46
|
+
l !== void 0 && /* @__PURE__ */ e("h2", {
|
|
47
|
+
className: "m-0 min-w-0 flex-1 break-words pl-4 pt-2 text-[20px] font-semibold leading-7 text-delta-800",
|
|
48
|
+
children: l
|
|
49
|
+
}),
|
|
50
|
+
s && /* @__PURE__ */ e("div", {
|
|
51
|
+
className: "min-w-0 max-w-[240px] flex-1 pt-2",
|
|
52
|
+
children: r
|
|
53
|
+
}),
|
|
54
|
+
/* @__PURE__ */ e(w, {
|
|
55
|
+
dataTest: `${i}-close`,
|
|
56
|
+
refLink: c,
|
|
57
|
+
"aria-label": o,
|
|
58
|
+
variant: "textGray",
|
|
59
|
+
startIcon: /* @__PURE__ */ e(b, {
|
|
60
|
+
width: 24,
|
|
61
|
+
height: 24
|
|
62
|
+
}),
|
|
63
|
+
className: "ml-auto h-10 w-10 min-w-10 shrink-0 px-0",
|
|
64
|
+
onClick: () => h("closeButton")
|
|
65
|
+
})
|
|
66
|
+
]
|
|
67
|
+
}),
|
|
68
|
+
!s && /* @__PURE__ */ e("div", {
|
|
69
|
+
className: "px-4 pt-2",
|
|
70
|
+
children: r
|
|
71
|
+
}),
|
|
72
|
+
a ?? /* @__PURE__ */ e("div", {
|
|
73
|
+
"aria-hidden": "true",
|
|
74
|
+
className: "h-2"
|
|
75
|
+
})
|
|
76
|
+
]
|
|
77
|
+
}),
|
|
78
|
+
/* @__PURE__ */ e("div", {
|
|
79
|
+
ref: u,
|
|
80
|
+
"data-testid": `${i}-body`,
|
|
81
|
+
className: "flex min-h-0 flex-1 flex-col overflow-y-auto px-4",
|
|
82
|
+
children: n
|
|
83
|
+
}),
|
|
84
|
+
/* @__PURE__ */ e(N, {
|
|
85
|
+
announcement: t,
|
|
86
|
+
dataTest: `${i}-live`
|
|
87
|
+
})
|
|
88
|
+
]
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
export {
|
|
92
|
+
q as FullScreenPicker
|
|
93
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useCallback as i, useEffect as a, useRef as s, useState as u } from "react";
|
|
2
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
3
|
+
var d = () => {
|
|
4
|
+
const [e, r] = u();
|
|
5
|
+
return [
|
|
6
|
+
e,
|
|
7
|
+
i((n) => r((t) => ({
|
|
8
|
+
text: n,
|
|
9
|
+
id: (t?.id ?? 0) + 1
|
|
10
|
+
})), []),
|
|
11
|
+
i(() => r(void 0), [])
|
|
12
|
+
];
|
|
13
|
+
}, f = ({ announcement: e, dataTest: r }) => {
|
|
14
|
+
const n = s(null);
|
|
15
|
+
return a(() => {
|
|
16
|
+
const t = n.current;
|
|
17
|
+
if (!t || (t.textContent = "", !e)) return;
|
|
18
|
+
const o = requestAnimationFrame(() => {
|
|
19
|
+
t.textContent = e.text;
|
|
20
|
+
});
|
|
21
|
+
return () => cancelAnimationFrame(o);
|
|
22
|
+
}, [e]), /* @__PURE__ */ c("div", {
|
|
23
|
+
ref: n,
|
|
24
|
+
role: "status",
|
|
25
|
+
"aria-live": "polite",
|
|
26
|
+
"aria-atomic": "true",
|
|
27
|
+
className: "sr-only",
|
|
28
|
+
"data-testid": r
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
f as PickerLiveRegion,
|
|
33
|
+
d as useAnnouncer
|
|
34
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var a = {
|
|
2
|
+
no: {
|
|
3
|
+
close: "Lukk",
|
|
4
|
+
search: "Søk",
|
|
5
|
+
done: "Ferdig",
|
|
6
|
+
clearOne: "Fjern valget",
|
|
7
|
+
clearAll: "Fjern alle valg",
|
|
8
|
+
selectedCount: (e) => `${e} valgt`,
|
|
9
|
+
noMatches: "Ingen treff",
|
|
10
|
+
matchCount: (e) => `${e} treff`,
|
|
11
|
+
cleared: "Valget er fjernet",
|
|
12
|
+
clearedAll: "Alle valg er fjernet",
|
|
13
|
+
truncated: (e, l) => `Viser ${e} av ${l}. Søk for å finne flere.`
|
|
14
|
+
},
|
|
15
|
+
en: {
|
|
16
|
+
close: "Close",
|
|
17
|
+
search: "Search",
|
|
18
|
+
done: "Done",
|
|
19
|
+
clearOne: "Clear selection",
|
|
20
|
+
clearAll: "Clear all selections",
|
|
21
|
+
selectedCount: (e) => `${e} selected`,
|
|
22
|
+
noMatches: "No matches",
|
|
23
|
+
matchCount: (e) => e === 1 ? "1 match" : `${e} matches`,
|
|
24
|
+
cleared: "Selection cleared",
|
|
25
|
+
clearedAll: "All selections cleared",
|
|
26
|
+
truncated: (e, l) => `Showing ${e} of ${l}. Search to find more.`
|
|
27
|
+
}
|
|
28
|
+
}, r = (e, l) => ({
|
|
29
|
+
...a[e],
|
|
30
|
+
...l
|
|
31
|
+
});
|
|
32
|
+
export {
|
|
33
|
+
r as getPickerText
|
|
34
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useSyncExternalStore as t } from "react";
|
|
2
|
+
var i = (e) => {
|
|
3
|
+
const r = window.visualViewport;
|
|
4
|
+
return r ? (r.addEventListener("resize", e), r.addEventListener("scroll", e), () => {
|
|
5
|
+
r.removeEventListener("resize", e), r.removeEventListener("scroll", e);
|
|
6
|
+
}) : (window.addEventListener("resize", e), () => window.removeEventListener("resize", e));
|
|
7
|
+
}, n = () => Math.round(window.visualViewport?.height ?? window.innerHeight), o = () => 0, v = () => t(i, n, o);
|
|
8
|
+
export {
|
|
9
|
+
v as useVisualViewportHeight
|
|
10
|
+
};
|