asma-ui-core 3.109.0 → 3.111.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/feedback/minimizable-dialog/MinimizableDialog.js +41 -39
- package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +62 -60
- package/dist/components/inputs/dynamic-select/components/DynamicInteractiveChipGroup.js +61 -58
- package/dist/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.js +74 -71
- package/dist/components/inputs/dynamic-select/components/DynamicSelectReadOnlyValue.js +13 -10
- package/dist/components/inputs/field-styles.js +16 -6
- package/dist/components/inputs/form-layout/StyledFieldPair.js +22 -0
- package/dist/components/inputs/form-layout/StyledFieldPair.module.js +8 -0
- package/dist/components/inputs/form-layout/StyledFormColumn.js +13 -0
- package/dist/components/inputs/input-field/StyledInputField.js +235 -198
- package/dist/components/inputs/phone-field/StyledPhoneField.js +41 -39
- package/dist/components/inputs/search-field/StyledSearchField.js +22 -20
- package/dist/components/inputs/select/StyledSelect.js +110 -108
- package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +111 -108
- package/dist/components/inputs/slider/StyledSlider.js +2 -2
- package/dist/components/inputs/textarea/StyledTextarea.js +50 -52
- package/dist/components/inputs/textarea/StyledTextarea.module.js +3 -3
- package/dist/components/miscellaneous/StyledFormControl.js +29 -25
- package/dist/components/miscellaneous/StyledInputLabel.js +28 -18
- package/dist/datetime/components/date-picker/components/BaseDatePickerInput.js +137 -122
- package/dist/datetime/components/date-picker/components/DatePickerInputRangeCompact.js +17 -15
- package/dist/datetime/components/date-picker/components/DatePickerInputRangeCompact.module.js +2 -2
- package/dist/datetime/components/date-picker/components/DatePickerInputSingle.js +9 -8
- package/dist/datetime/components/date-picker/components/StyledCalendarPickerSelectMonth.js +17 -14
- package/dist/datetime/components/date-picker/components/StyledCalendarPickerSelectYear.js +14 -9
- package/dist/datetime/components/time-picker/StyledTimePicker.js +78 -74
- package/dist/datetime/components/time-picker/TimePickerInput.js +43 -41
- package/dist/datetime/components/time-picker/helpers/timePickerWidth.js +12 -0
- package/dist/helpers/CharacterCounter.js +21 -0
- package/dist/hooks/useBackCloses.hook.js +67 -38
- package/dist/hooks/useTopLayer.hook.js +30 -26
- package/dist/index.js +284 -273
- package/dist/src/components/inputs/dynamic-select/components/DynamicSelectReadOnlyValue.d.ts +2 -2
- package/dist/src/components/inputs/dynamic-select/types.d.ts +3 -0
- package/dist/src/components/inputs/field-styles.d.ts +22 -0
- package/dist/src/components/inputs/form-layout/StyledFieldPair.d.ts +18 -0
- package/dist/src/components/inputs/form-layout/StyledFormColumn.d.ts +12 -0
- package/dist/src/components/inputs/form-layout/index.d.ts +4 -0
- package/dist/src/components/inputs/input-field/StyledInputField.d.ts +19 -4
- package/dist/src/components/inputs/select/StyledSelect.d.ts +7 -2
- package/dist/src/components/inputs/select-autocomplete/StyledSelectAutocomplete.d.ts +5 -1
- package/dist/src/components/inputs/textarea/StyledTextarea.d.ts +6 -0
- package/dist/src/components/miscellaneous/StyledFormControl.d.ts +5 -2
- package/dist/src/components/miscellaneous/StyledInputLabel.d.ts +7 -5
- package/dist/src/datetime/components/date-picker/components/BaseDatePickerInput.d.ts +2 -0
- package/dist/src/datetime/components/date-picker/types.d.ts +3 -0
- package/dist/src/datetime/components/time-picker/helpers/timePickerWidth.d.ts +7 -0
- package/dist/src/datetime/components/time-picker/types.d.ts +3 -1
- package/dist/src/helpers/CharacterCounter.d.ts +16 -0
- package/dist/src/helpers/CharacterCounter.test.d.ts +1 -0
- package/dist/src/hooks/useBackCloses.hook.d.ts +47 -2
- package/dist/src/hooks/useTopLayer.hook.d.ts +6 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/tailwind.config.d.ts +14 -0
- package/package.json +1 -1
- package/src/styles/fieldWidthTokens.css +8 -0
- package/src/styles/index.css +1 -0
- package/tw-configs/twConfigs.json +14 -0
|
@@ -1,231 +1,268 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { resolveSx as
|
|
3
|
-
import { CloseIcon as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { cn as l } from "../../../helpers/cn.js";
|
|
2
|
+
import { resolveSx as v } from "../../../helpers/sx.js";
|
|
3
|
+
import { CloseIcon as pt } from "../../icons/close-icon/CloseIcon.js";
|
|
4
|
+
import { CharacterCounter as gt } from "../../../helpers/CharacterCounter.js";
|
|
5
|
+
import { HelperRow as re } from "../../../helpers/HelperRow.js";
|
|
6
|
+
import { useHelperRowBudget as ft } from "../../../helpers/useHelperRowBudget.js";
|
|
7
|
+
import { useHelperSlot as xt } from "../../../helpers/useHelperSlot.js";
|
|
8
|
+
import { fieldLabelAboveClass as bt, fieldWidthStyle as yt, floatingLabelClass as Lt, floatingLabelLayoutStyle as St, notchedLegendClass as vt, notchedOutlineClass as de, singleLineInputLayoutStyle as Ht, singleLineShellLayoutStyle as It } from "../field-styles.js";
|
|
9
|
+
import b from "./StyledInputField.module.js";
|
|
10
|
+
import { Children as Nt, useCallback as ce, useId as At, useLayoutEffect as B, useRef as G, useState as M } from "react";
|
|
11
|
+
import { jsx as o, jsxs as p } from "react/jsx-runtime";
|
|
12
|
+
import { useMergeRefs as he } from "@floating-ui/react";
|
|
13
|
+
var Ot = ({ dataTest: y, label: r, labelPlacement: me = "above", value: g, defaultValue: L, onChange: ue, onBlur: pe, onFocus: ge, error: h, helperText: E, reserveHelperText: fe, expandHelperText: xe = !0, maxLength: be, counter: ye, locale: Le, disabled: d, readOnly: n, required: H, allowClear: Se, onClear: ve, type: He = "text", placeholder: Ie, name: Ne, id: Ae, autoComplete: Ce, autoFocus: Re, multiline: i, rows: I, minRows: k, maxRows: T, size: we = "medium", width: J = "full", fullWidth: Ct, className: Fe, style: _e, sx: Be, inputRef: Me, slotProps: t, InputProps: Q, onKeyDown: V, onClick: Ee, variant: Rt }) => {
|
|
14
|
+
const ke = At(), D = Ae ?? ke, W = `${D}-helper-text`, $ = G(null), j = G(0), X = G(null), [Te, De] = M(void 0), [N, Z] = M(!1), [We, q] = M(L != null && L !== ""), [$e, je] = M(String(L ?? "").length), A = g !== void 0, O = A ? g !== "" && g != null : We, ze = !!d || !!n, z = t?.input?.startAdornment ?? Q?.startAdornment, S = Nt.count(z) > 0, m = S && Array.isArray(z), f = t?.input?.endAdornment ?? Q?.endAdornment, C = !!(Se && O && !ze), { ref: Ue, ...a } = t?.htmlInput ?? {}, Ke = Me ?? Ue, { className: Pe, style: U, ref: Ye } = t?.input ?? {}, Ge = he([Ye]), Je = t?.input?.onMouseDown, ee = t?.input?.onClick, Qe = ee ? { onClick: ee } : {}, Ve = Ce ?? a.autoComplete, Xe = Ne ?? a.name, K = a.id ?? D, R = be ?? a.maxLength, te = `${D}-counter`, P = !!(ye && R && !n), Ze = A ? String(g ?? "").length : $e, w = me === "floating" && !!r, F = N || O || S, u = ce(() => {
|
|
15
|
+
const e = $.current;
|
|
16
|
+
if (!(!i || !e) && (j.current = e.offsetWidth, j.current !== 0)) {
|
|
17
|
+
if (e.removeAttribute("data-scrollable"), I != null && !n) e.style.height = "";
|
|
17
18
|
else {
|
|
18
19
|
if (e.style.height = "auto", e.scrollHeight === 0) {
|
|
19
20
|
e.style.height = "";
|
|
20
21
|
return;
|
|
21
22
|
}
|
|
22
|
-
const
|
|
23
|
-
e.style.height = `${Math.min(
|
|
23
|
+
const s = getComputedStyle(e), c = Number.parseFloat(s.lineHeight) || 24, ae = Number.parseFloat(s.paddingTop) + Number.parseFloat(s.paddingBottom), se = I ?? k, mt = se ? se * c + ae : 0, ut = n || !T ? Number.POSITIVE_INFINITY : T * c + ae;
|
|
24
|
+
e.style.height = `${Math.min(ut, Math.max(mt, e.scrollHeight))}px`;
|
|
24
25
|
}
|
|
25
26
|
e.scrollHeight > e.clientHeight + 1 && e.setAttribute("data-scrollable", "true");
|
|
26
27
|
}
|
|
27
28
|
}, [
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
]),
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
!
|
|
37
|
-
},
|
|
38
|
-
!
|
|
29
|
+
T,
|
|
30
|
+
k,
|
|
31
|
+
i,
|
|
32
|
+
n,
|
|
33
|
+
I
|
|
34
|
+
]), qe = (e) => {
|
|
35
|
+
n || (A || (q(e.target.value !== ""), je(e.target.value.length), u()), ue?.(e));
|
|
36
|
+
}, Oe = (e) => {
|
|
37
|
+
!d && !n && Z(!0), ge?.(e);
|
|
38
|
+
}, et = (e) => {
|
|
39
|
+
!d && !n && Z(!1), pe?.(e);
|
|
39
40
|
};
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
B(() => {
|
|
42
|
+
u();
|
|
42
43
|
}, [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
]),
|
|
47
|
-
if (!
|
|
48
|
-
const e = () =>
|
|
44
|
+
u,
|
|
45
|
+
L,
|
|
46
|
+
g
|
|
47
|
+
]), B(() => {
|
|
48
|
+
if (!i || !document.fonts) return;
|
|
49
|
+
const e = () => u();
|
|
49
50
|
return document.fonts.addEventListener("loadingdone", e), () => document.fonts.removeEventListener("loadingdone", e);
|
|
50
|
-
}, [
|
|
51
|
-
const e =
|
|
52
|
-
if (!
|
|
53
|
-
let
|
|
54
|
-
const
|
|
55
|
-
e.offsetWidth !==
|
|
51
|
+
}, [i, u]), B(() => {
|
|
52
|
+
const e = $.current;
|
|
53
|
+
if (!i || !e || typeof ResizeObserver > "u") return;
|
|
54
|
+
let s = 0;
|
|
55
|
+
const c = new ResizeObserver(() => {
|
|
56
|
+
e.offsetWidth !== j.current && (cancelAnimationFrame(s), s = requestAnimationFrame(u));
|
|
56
57
|
});
|
|
57
|
-
return
|
|
58
|
-
cancelAnimationFrame(
|
|
58
|
+
return c.observe(e), () => {
|
|
59
|
+
cancelAnimationFrame(s), c.disconnect();
|
|
59
60
|
};
|
|
60
|
-
}, [
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
}, [])]), { style:
|
|
64
|
-
...
|
|
65
|
-
...
|
|
66
|
-
} :
|
|
61
|
+
}, [i, u]);
|
|
62
|
+
const ne = he([Ke, ce((e) => {
|
|
63
|
+
$.current = e instanceof HTMLTextAreaElement ? e : null;
|
|
64
|
+
}, [])]), { style: Y, ...tt } = a, x = !i && !m, { height: wt, minHeight: Ft, maxHeight: _t, paddingTop: Bt, paddingBottom: Mt, ...nt } = U ?? {}, ot = x ? {
|
|
65
|
+
...nt,
|
|
66
|
+
...It()
|
|
67
|
+
} : m ? {
|
|
67
68
|
boxSizing: "border-box",
|
|
68
69
|
minHeight: 40,
|
|
69
|
-
...
|
|
70
|
-
} :
|
|
71
|
-
...
|
|
72
|
-
...
|
|
73
|
-
paddingLeft:
|
|
74
|
-
paddingRight:
|
|
70
|
+
...U
|
|
71
|
+
} : U, { height: Et, minHeight: kt, maxHeight: Tt, paddingTop: Dt, paddingBottom: Wt, paddingLeft: $t, paddingRight: it, ...lt } = Y ?? {}, at = x ? {
|
|
72
|
+
...lt,
|
|
73
|
+
...Ht({
|
|
74
|
+
paddingLeft: S ? 40 : 14,
|
|
75
|
+
paddingRight: it ?? Te ?? (C || f ? 40 : 14)
|
|
75
76
|
})
|
|
76
|
-
} :
|
|
77
|
-
|
|
78
|
-
if (!
|
|
79
|
-
const e =
|
|
80
|
-
|
|
77
|
+
} : Y;
|
|
78
|
+
B(() => {
|
|
79
|
+
if (!x) return;
|
|
80
|
+
const e = X.current, s = e ? Math.ceil(e.getBoundingClientRect().width) + 20 : void 0;
|
|
81
|
+
De((c) => c === s ? c : s);
|
|
81
82
|
}, [
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
x,
|
|
84
|
+
C,
|
|
85
|
+
f
|
|
85
86
|
]);
|
|
86
|
-
const
|
|
87
|
-
...
|
|
88
|
-
style:
|
|
89
|
-
id:
|
|
90
|
-
name:
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
"aria-
|
|
101
|
-
"aria-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
87
|
+
const st = F || !w, { show: _, role: oe } = xt("StyledInputField", h, E, fe, n), { fieldRef: rt, rowRef: dt, rowStyle: ct } = ft(xe && _ && !P), ie = {
|
|
88
|
+
...tt,
|
|
89
|
+
style: x ? at : Y,
|
|
90
|
+
id: K,
|
|
91
|
+
name: Xe,
|
|
92
|
+
maxLength: R,
|
|
93
|
+
placeholder: st ? Ie : void 0,
|
|
94
|
+
disabled: d,
|
|
95
|
+
readOnly: n,
|
|
96
|
+
required: H,
|
|
97
|
+
autoComplete: Ve,
|
|
98
|
+
autoFocus: Re,
|
|
99
|
+
value: g,
|
|
100
|
+
defaultValue: L,
|
|
101
|
+
"aria-invalid": h ? !0 : void 0,
|
|
102
|
+
"aria-label": a["aria-label"] ?? (a["aria-labelledby"] ? void 0 : typeof r == "string" && r !== "" ? r : void 0),
|
|
103
|
+
"aria-describedby": [_ ? W : a["aria-describedby"], P ? te : void 0].filter(Boolean).join(" ") || void 0,
|
|
104
|
+
onChange: qe,
|
|
105
|
+
onFocus: Oe,
|
|
106
|
+
onBlur: et,
|
|
107
|
+
onKeyDown: a.onKeyDown || V ? (e) => {
|
|
108
|
+
V?.(e), e.defaultPrevented || a.onKeyDown?.(e);
|
|
107
109
|
} : void 0
|
|
108
|
-
},
|
|
109
|
-
"data-start-adornment":
|
|
110
|
-
"data-end-adornment":
|
|
110
|
+
}, le = l(b.Input, "peer border-0 bg-transparent text-base tracking-[0.00938em] text-delta-800 outline-none placeholder:text-delta-500", m ? "box-border h-8 min-w-[60px] flex-1 py-0 pl-0 pr-0 leading-[23px]" : i ? l("w-full resize-none p-0 pl-0 pr-0 leading-[23px]", b["Input--multiline"]) : l("w-full", b["Input--singleLine"]), "disabled:text-delta-300", n && "text-delta-800", Pe), ht = !i && !m ? {
|
|
111
|
+
"data-start-adornment": S ? "true" : void 0,
|
|
112
|
+
"data-end-adornment": C || f ? "true" : void 0
|
|
111
113
|
} : {};
|
|
112
|
-
return /* @__PURE__ */
|
|
113
|
-
ref:
|
|
114
|
-
className:
|
|
115
|
-
onClick:
|
|
114
|
+
return /* @__PURE__ */ p("div", {
|
|
115
|
+
ref: rt,
|
|
116
|
+
className: l("group relative min-w-0 flex-col", Fe),
|
|
117
|
+
onClick: Ee,
|
|
118
|
+
"data-field-width": J,
|
|
116
119
|
style: {
|
|
117
|
-
display:
|
|
118
|
-
|
|
120
|
+
display: "flex",
|
|
121
|
+
...yt(J),
|
|
119
122
|
fontFamily: "Roboto, Helvetica, Arial, sans-serif",
|
|
120
123
|
letterSpacing: "0.00938em",
|
|
121
|
-
...
|
|
122
|
-
...
|
|
124
|
+
...v(Be),
|
|
125
|
+
..._e
|
|
123
126
|
},
|
|
124
|
-
children: [
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
ref: Y,
|
|
167
|
-
className: "absolute inset-y-0 right-[14px] flex max-w-[calc(100%-28px)] items-center gap-1",
|
|
168
|
-
children: h
|
|
169
|
-
}),
|
|
170
|
-
a ? /* @__PURE__ */ s("fieldset", {
|
|
171
|
-
"aria-hidden": !0,
|
|
172
|
-
className: ne({
|
|
173
|
-
focused: H,
|
|
174
|
-
error: m,
|
|
175
|
-
disabled: c,
|
|
176
|
-
readOnly: t,
|
|
177
|
-
notched: !0
|
|
127
|
+
children: [
|
|
128
|
+
r && !w && /* @__PURE__ */ o("div", {
|
|
129
|
+
className: l(bt({ disabled: d }), t?.inputLabel?.className),
|
|
130
|
+
style: {
|
|
131
|
+
...v(t?.inputLabel?.sx),
|
|
132
|
+
...t?.inputLabel?.style
|
|
133
|
+
},
|
|
134
|
+
children: /* @__PURE__ */ p("label", {
|
|
135
|
+
htmlFor: K,
|
|
136
|
+
children: [r, H && /* @__PURE__ */ o("span", {
|
|
137
|
+
"aria-hidden": "true",
|
|
138
|
+
children: " *"
|
|
139
|
+
})]
|
|
140
|
+
})
|
|
141
|
+
}),
|
|
142
|
+
/* @__PURE__ */ p("div", {
|
|
143
|
+
className: "relative overflow-visible",
|
|
144
|
+
children: [/* @__PURE__ */ p("div", {
|
|
145
|
+
className: l("relative flex", x && b.InputShell, i && "box-border items-center px-[14px] py-[16.5px]", m && l(b.AdornmentList, f && b["AdornmentList--endAdornment"]), n && "rounded bg-delta-50"),
|
|
146
|
+
ref: Ge,
|
|
147
|
+
onMouseDown: Je,
|
|
148
|
+
...Qe,
|
|
149
|
+
style: ot,
|
|
150
|
+
"data-testid": m ? `${y}-adornment-list` : `${y}-shell`,
|
|
151
|
+
children: [
|
|
152
|
+
S && /* @__PURE__ */ o("span", {
|
|
153
|
+
className: l("items-center text-delta-500", m ? "contents" : "absolute left-3 flex"),
|
|
154
|
+
children: z
|
|
155
|
+
}),
|
|
156
|
+
i ? /* @__PURE__ */ o("textarea", {
|
|
157
|
+
...ie,
|
|
158
|
+
ref: ne,
|
|
159
|
+
"data-testid": y,
|
|
160
|
+
rows: I ?? k ?? 2,
|
|
161
|
+
className: le
|
|
162
|
+
}) : /* @__PURE__ */ o("input", {
|
|
163
|
+
...ie,
|
|
164
|
+
...ht,
|
|
165
|
+
ref: ne,
|
|
166
|
+
"data-testid": y,
|
|
167
|
+
type: He,
|
|
168
|
+
className: le
|
|
178
169
|
}),
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
170
|
+
C ? /* @__PURE__ */ o("button", {
|
|
171
|
+
type: "button",
|
|
172
|
+
tabIndex: -1,
|
|
173
|
+
"aria-label": "Clear",
|
|
174
|
+
"data-testid": `${y}-clear`,
|
|
175
|
+
className: "asma-pressable absolute right-4 z-40 flex items-center justify-center rounded-full border-0 bg-transparent p-[2px] duration-300 hover:bg-gama-100",
|
|
176
|
+
onClick: (e) => {
|
|
177
|
+
e.stopPropagation(), e.preventDefault(), A || q(!1), ve?.();
|
|
178
|
+
},
|
|
179
|
+
children: /* @__PURE__ */ o(pt, {
|
|
180
|
+
width: 18,
|
|
181
|
+
height: 18
|
|
182
|
+
})
|
|
183
|
+
}) : f && /* @__PURE__ */ o("span", {
|
|
184
|
+
ref: X,
|
|
185
|
+
className: "absolute inset-y-0 right-[14px] flex max-w-[calc(100%-28px)] items-center gap-1",
|
|
186
|
+
children: f
|
|
187
|
+
}),
|
|
188
|
+
w ? /* @__PURE__ */ o("fieldset", {
|
|
189
|
+
"aria-hidden": !0,
|
|
190
|
+
className: de({
|
|
191
|
+
focused: N,
|
|
192
|
+
error: h,
|
|
193
|
+
disabled: d,
|
|
194
|
+
readOnly: n,
|
|
195
|
+
notched: !0
|
|
196
|
+
}),
|
|
197
|
+
children: /* @__PURE__ */ o("legend", {
|
|
198
|
+
className: vt(F),
|
|
199
|
+
children: /* @__PURE__ */ p("span", {
|
|
200
|
+
className: "inline-block px-[5px]",
|
|
201
|
+
children: [r, H && " *"]
|
|
202
|
+
})
|
|
203
|
+
})
|
|
204
|
+
}) : /* @__PURE__ */ o("div", {
|
|
205
|
+
"aria-hidden": !0,
|
|
206
|
+
className: de({
|
|
207
|
+
focused: N,
|
|
208
|
+
error: h,
|
|
209
|
+
disabled: d,
|
|
210
|
+
readOnly: n,
|
|
211
|
+
notched: !1
|
|
184
212
|
})
|
|
185
213
|
})
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
214
|
+
]
|
|
215
|
+
}), w && /* @__PURE__ */ p("label", {
|
|
216
|
+
htmlFor: K,
|
|
217
|
+
className: l(Lt({
|
|
218
|
+
shrink: F,
|
|
219
|
+
focused: N,
|
|
220
|
+
error: h,
|
|
221
|
+
disabled: d,
|
|
222
|
+
readOnly: n,
|
|
223
|
+
size: we
|
|
224
|
+
}), t?.inputLabel?.className),
|
|
225
|
+
style: {
|
|
226
|
+
...v(t?.inputLabel?.sx),
|
|
227
|
+
...t?.inputLabel?.style,
|
|
228
|
+
...St(F)
|
|
229
|
+
},
|
|
230
|
+
children: [r, H && " *"]
|
|
231
|
+
})]
|
|
232
|
+
}),
|
|
233
|
+
P && R ? /* @__PURE__ */ p("div", {
|
|
234
|
+
className: "flex items-start justify-between gap-4",
|
|
235
|
+
children: [_ && /* @__PURE__ */ o(re, {
|
|
236
|
+
id: W,
|
|
237
|
+
role: oe,
|
|
238
|
+
error: h,
|
|
239
|
+
message: E,
|
|
240
|
+
hideErrorIcon: t?.formHelperText?.hideErrorIcon,
|
|
241
|
+
className: l("box-border min-w-0 flex-1 items-start", t?.formHelperText?.className),
|
|
242
|
+
style: v(t?.formHelperText?.sx)
|
|
243
|
+
}), /* @__PURE__ */ o(gt, {
|
|
244
|
+
id: te,
|
|
245
|
+
length: Ze,
|
|
246
|
+
limit: R,
|
|
247
|
+
locale: Le,
|
|
248
|
+
className: "ml-auto shrink-0 whitespace-nowrap pt-1"
|
|
249
|
+
})]
|
|
250
|
+
}) : _ && /* @__PURE__ */ o(re, {
|
|
251
|
+
ref: dt,
|
|
252
|
+
id: W,
|
|
253
|
+
role: oe,
|
|
254
|
+
error: h,
|
|
255
|
+
message: E,
|
|
256
|
+
hideErrorIcon: t?.formHelperText?.hideErrorIcon,
|
|
257
|
+
className: l("mr-[14px] box-border items-start", t?.formHelperText?.className),
|
|
207
258
|
style: {
|
|
208
|
-
...
|
|
209
|
-
...
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
})]
|
|
214
|
-
}), D && /* @__PURE__ */ s(nt, {
|
|
215
|
-
ref: Xe,
|
|
216
|
-
id: V,
|
|
217
|
-
role: Je,
|
|
218
|
-
error: m,
|
|
219
|
-
message: j,
|
|
220
|
-
hideErrorIcon: n?.formHelperText?.hideErrorIcon,
|
|
221
|
-
className: r("mr-[14px] box-border items-start", n?.formHelperText?.className),
|
|
222
|
-
style: {
|
|
223
|
-
...Ze,
|
|
224
|
-
...P(n?.formHelperText?.sx)
|
|
225
|
-
}
|
|
226
|
-
})]
|
|
259
|
+
...ct,
|
|
260
|
+
...v(t?.formHelperText?.sx)
|
|
261
|
+
}
|
|
262
|
+
})
|
|
263
|
+
]
|
|
227
264
|
});
|
|
228
265
|
};
|
|
229
266
|
export {
|
|
230
|
-
|
|
267
|
+
Ot as StyledInputField
|
|
231
268
|
};
|
|
@@ -1,28 +1,31 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { cn as D } from "../../../helpers/cn.js";
|
|
2
|
+
import { fieldLabelAboveClass as M } from "../field-styles.js";
|
|
3
|
+
import { StyledInputField as V } from "../input-field/StyledInputField.js";
|
|
4
|
+
import { StyledLink as z } from "../../navigation/link/StyledLink.js";
|
|
5
|
+
import { CountryCodeSelect as E } from "./CountryCodeSelect.js";
|
|
6
|
+
import { useId as G } from "react";
|
|
7
|
+
import { jsx as l, jsxs as d } from "react/jsx-runtime";
|
|
8
|
+
var H = (e) => e.replace(/\D/g, ""), Y = ({ dataTest: e, label: t, countries: h, country: i, onCountryChange: f, value: n, onChange: v, onBlur: x, error: y, helperText: N, reserveHelperText: g = !0, disabled: s, readOnly: $, readOnlyText: m, readOnlyHref: c, required: p, placeholder: b, formatNationalNumber: I, renderFlag: C, selectCountryLabel: S, searchPlaceholder: F, id: j, name: A, size: L = "medium", fieldClassName: u, helperTextClassName: P, className: k }) => {
|
|
9
|
+
const w = G(), o = j ?? `${w}-phone`, a = `${o}-label`, r = I?.(n, i) ?? n;
|
|
9
10
|
return /* @__PURE__ */ d("div", {
|
|
10
|
-
className:
|
|
11
|
+
className: D("flex flex-col", k),
|
|
11
12
|
"data-testid": `${e}-root`,
|
|
12
|
-
children: [
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
children: [t != null && /* @__PURE__ */ l("div", {
|
|
14
|
+
className: M(),
|
|
15
|
+
children: /* @__PURE__ */ d("label", {
|
|
16
|
+
id: a,
|
|
17
|
+
htmlFor: o,
|
|
18
|
+
children: [t, p === !0 && /* @__PURE__ */ l("span", {
|
|
19
|
+
"aria-hidden": "true",
|
|
20
|
+
children: " *"
|
|
21
|
+
})]
|
|
22
|
+
})
|
|
23
|
+
}), $ === !0 ? /* @__PURE__ */ l("span", {
|
|
21
24
|
className: "py-2 text-base text-delta-800",
|
|
22
|
-
children: c === void 0 ? /* @__PURE__ */
|
|
25
|
+
children: c === void 0 ? /* @__PURE__ */ l("span", {
|
|
23
26
|
"data-testid": `${e}-readonly`,
|
|
24
27
|
children: m ?? r
|
|
25
|
-
}) : /* @__PURE__ */
|
|
28
|
+
}) : /* @__PURE__ */ l(z, {
|
|
26
29
|
dataTest: `${e}-readonly`,
|
|
27
30
|
href: c,
|
|
28
31
|
className: "-ml-1",
|
|
@@ -30,46 +33,45 @@ var E = (e) => e.replace(/\D/g, ""), U = ({ dataTest: e, label: l, countries: h,
|
|
|
30
33
|
})
|
|
31
34
|
}) : /* @__PURE__ */ d("div", {
|
|
32
35
|
className: "flex items-start gap-2.5",
|
|
33
|
-
children: [/* @__PURE__ */
|
|
36
|
+
children: [/* @__PURE__ */ l(E, {
|
|
34
37
|
dataTest: `${e}-country`,
|
|
35
38
|
countries: h,
|
|
36
|
-
value:
|
|
37
|
-
onChange:
|
|
38
|
-
disabled:
|
|
39
|
+
value: i,
|
|
40
|
+
onChange: f,
|
|
41
|
+
disabled: s,
|
|
39
42
|
selectCountryLabel: S,
|
|
40
43
|
searchPlaceholder: F,
|
|
41
44
|
renderFlag: C,
|
|
42
|
-
labelledBy:
|
|
45
|
+
labelledBy: t == null ? void 0 : a,
|
|
43
46
|
className: u
|
|
44
|
-
}), /* @__PURE__ */
|
|
47
|
+
}), /* @__PURE__ */ l(V, {
|
|
45
48
|
dataTest: `${e}-number`,
|
|
46
|
-
|
|
47
|
-
id:
|
|
48
|
-
name:
|
|
49
|
+
width: "s",
|
|
50
|
+
id: o,
|
|
51
|
+
name: A,
|
|
49
52
|
value: r,
|
|
50
|
-
onChange: (
|
|
51
|
-
onBlur:
|
|
52
|
-
placeholder:
|
|
53
|
+
onChange: (B) => v(H(B.target.value)),
|
|
54
|
+
onBlur: x,
|
|
55
|
+
placeholder: b,
|
|
53
56
|
error: y,
|
|
54
|
-
disabled:
|
|
57
|
+
disabled: s,
|
|
55
58
|
required: p,
|
|
56
|
-
fullWidth: !0,
|
|
57
59
|
helperText: N,
|
|
58
|
-
reserveHelperText:
|
|
59
|
-
size:
|
|
60
|
+
reserveHelperText: g,
|
|
61
|
+
size: L,
|
|
60
62
|
slotProps: {
|
|
61
63
|
htmlInput: {
|
|
62
64
|
inputMode: "tel",
|
|
63
65
|
autoComplete: "tel",
|
|
64
|
-
"aria-labelledby":
|
|
66
|
+
"aria-labelledby": t == null ? void 0 : a
|
|
65
67
|
},
|
|
66
68
|
input: { className: u },
|
|
67
|
-
formHelperText: { className:
|
|
69
|
+
formHelperText: { className: P }
|
|
68
70
|
}
|
|
69
71
|
})]
|
|
70
72
|
})]
|
|
71
73
|
});
|
|
72
74
|
};
|
|
73
75
|
export {
|
|
74
|
-
|
|
76
|
+
Y as StyledPhoneField
|
|
75
77
|
};
|