asma-ui-core 3.80.3 → 3.81.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/Readme.md +32 -0
- package/dist/asma-ui-core.css +1 -1
- package/dist/components/inputs/phone-field/CountryCodeOptions.js +39 -0
- package/dist/components/inputs/phone-field/CountryCodeSelect.js +145 -0
- package/dist/components/inputs/phone-field/StyledCountryFlag.js +25 -0
- package/dist/components/inputs/phone-field/StyledPhoneField.js +74 -0
- package/dist/components/inputs/phone-field/useCountryPicker.js +55 -0
- package/dist/components/inputs/search-field/StyledSearchField.js +28 -24
- package/dist/components/inputs/slider/StyledSlider.js +98 -81
- package/dist/components/inputs/slider/StyledSlider.module.js +5 -5
- package/dist/index.js +117 -113
- package/dist/src/components/inputs/phone-field/CountryCodeOptions.d.ts +20 -0
- package/dist/src/components/inputs/phone-field/CountryCodeSelect.d.ts +30 -0
- package/dist/src/components/inputs/phone-field/StyledCountryFlag.d.ts +34 -0
- package/dist/src/components/inputs/phone-field/StyledPhoneField.d.ts +81 -0
- package/dist/src/components/inputs/phone-field/index.d.ts +3 -0
- package/dist/src/components/inputs/phone-field/types.d.ts +24 -0
- package/dist/src/components/inputs/phone-field/useCountryPicker.d.ts +30 -0
- package/dist/src/components/inputs/phone-field/useCountryPicker.test.d.ts +1 -0
- package/dist/src/components/inputs/select/StyledSelectItem.d.ts +2 -1
- package/dist/src/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { cn as i } from "../../../helpers/cn.js";
|
|
2
|
+
import { StyledSelectItem as u } from "../select/StyledSelectItem.js";
|
|
3
|
+
import { useEffect as x, useRef as N } from "react";
|
|
4
|
+
import { jsx as l, jsxs as o } from "react/jsx-runtime";
|
|
5
|
+
var j = ({ dataTest: m, visible: n, selectedIso2: d, activeIndex: s, optionId: r, onSelect: c, listId: f, label: p, renderFlag: b, className: h }) => {
|
|
6
|
+
const a = N(null);
|
|
7
|
+
return x(() => {
|
|
8
|
+
a.current?.querySelector(`#${CSS.escape(r(s))}`)?.scrollIntoView({ block: "nearest" });
|
|
9
|
+
}), /* @__PURE__ */ l("ul", {
|
|
10
|
+
ref: a,
|
|
11
|
+
id: f,
|
|
12
|
+
role: "listbox",
|
|
13
|
+
"aria-label": p,
|
|
14
|
+
"data-testid": `${m}-listbox`,
|
|
15
|
+
className: i("m-0 min-h-0 flex-1 list-none overflow-y-auto p-0", h),
|
|
16
|
+
children: n.map((e, t) => /* @__PURE__ */ l(u, {
|
|
17
|
+
id: r(t),
|
|
18
|
+
selected: e.iso2 === d,
|
|
19
|
+
onClick: () => c(e.iso2),
|
|
20
|
+
className: i("border-0 border-b border-solid border-delta-100", t === s && "bg-delta-50"),
|
|
21
|
+
children: /* @__PURE__ */ o("span", {
|
|
22
|
+
className: "flex w-full items-center justify-between gap-2",
|
|
23
|
+
children: [/* @__PURE__ */ o("span", {
|
|
24
|
+
className: "flex min-w-0 items-center gap-2",
|
|
25
|
+
children: [b?.(e.iso2, "eager"), /* @__PURE__ */ l("span", {
|
|
26
|
+
className: "truncate",
|
|
27
|
+
children: e.name
|
|
28
|
+
})]
|
|
29
|
+
}), /* @__PURE__ */ l("span", {
|
|
30
|
+
className: "shrink-0 font-medium text-delta-800",
|
|
31
|
+
children: `+${e.dialCode}`
|
|
32
|
+
})]
|
|
33
|
+
})
|
|
34
|
+
}, e.iso2))
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
export {
|
|
38
|
+
j as CountryCodeOptions
|
|
39
|
+
};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { cn as m } from "../../../helpers/cn.js";
|
|
2
|
+
import { ChevronDownIcon as E } from "../../icons/chevron-down-icon/ChevronDownIcon.js";
|
|
3
|
+
import { useMobileMediaQuery as Q } from "../../../hooks/useMediaQuery.hook.js";
|
|
4
|
+
import { StyledDialog as q } from "../../feedback/dialog/StyledDialog.js";
|
|
5
|
+
import { StyledPopover as A } from "../../utils/popover/StyledPopover.js";
|
|
6
|
+
import { notchedOutlineClass as F } from "../field-styles.js";
|
|
7
|
+
import { StyledSearchField as W } from "../search-field/StyledSearchField.js";
|
|
8
|
+
import { CountryCodeOptions as B } from "./CountryCodeOptions.js";
|
|
9
|
+
import { useCountryPicker as G } from "./useCountryPicker.js";
|
|
10
|
+
import { useEffect as K, useId as H, useRef as f, useState as x } from "react";
|
|
11
|
+
import { Fragment as J, jsx as e, jsxs as s } from "react/jsx-runtime";
|
|
12
|
+
var re = ({ dataTest: r, countries: b, value: n, onChange: O, disabled: i, selectCountryLabel: g, searchPlaceholder: P, renderFlag: u, labelledBy: v, className: M }) => {
|
|
13
|
+
const [t, w] = x(!1), [h, c] = x(""), [R, j] = x(null), y = f(null), C = f(null), I = f(!1), d = Q(), p = `${H()}-country-listbox`, N = b.find((a) => a.iso2 === n), k = N === void 0 ? "" : `+${N.dialCode}`, l = () => {
|
|
14
|
+
w(!1), c("");
|
|
15
|
+
}, D = (a) => {
|
|
16
|
+
O(a), l();
|
|
17
|
+
}, o = G({
|
|
18
|
+
countries: b,
|
|
19
|
+
selectedIso2: n,
|
|
20
|
+
query: h,
|
|
21
|
+
listId: p,
|
|
22
|
+
onSelect: D,
|
|
23
|
+
onDismiss: l
|
|
24
|
+
});
|
|
25
|
+
K(() => {
|
|
26
|
+
t && !d && y.current?.focus();
|
|
27
|
+
}, [t, d]), K(() => {
|
|
28
|
+
I.current && !t && C.current?.focus(), I.current = t;
|
|
29
|
+
}, [t]);
|
|
30
|
+
const S = /* @__PURE__ */ e(B, {
|
|
31
|
+
dataTest: r,
|
|
32
|
+
visible: o.visible,
|
|
33
|
+
selectedIso2: n,
|
|
34
|
+
activeIndex: o.activeIndex,
|
|
35
|
+
optionId: o.optionId,
|
|
36
|
+
onSelect: D,
|
|
37
|
+
listId: p,
|
|
38
|
+
label: g,
|
|
39
|
+
renderFlag: u
|
|
40
|
+
}), $ = {
|
|
41
|
+
role: "combobox",
|
|
42
|
+
"aria-activedescendant": o.visible.length > 0 ? o.optionId(o.activeIndex) : void 0,
|
|
43
|
+
"aria-autocomplete": "list",
|
|
44
|
+
"aria-controls": p,
|
|
45
|
+
"aria-expanded": !0
|
|
46
|
+
}, z = t && !d;
|
|
47
|
+
return /* @__PURE__ */ s(J, { children: [/* @__PURE__ */ s("div", {
|
|
48
|
+
ref: j,
|
|
49
|
+
"data-testid": `${r}-shell`,
|
|
50
|
+
style: { height: 40 },
|
|
51
|
+
className: m("group relative flex w-32 shrink-0 items-center gap-1.5 rounded px-3 text-base", i ? "cursor-not-allowed text-delta-300" : "text-delta-800"),
|
|
52
|
+
children: [/* @__PURE__ */ e("span", {
|
|
53
|
+
"aria-hidden": "true",
|
|
54
|
+
className: m(F({
|
|
55
|
+
disabled: i,
|
|
56
|
+
notched: !1
|
|
57
|
+
}), M)
|
|
58
|
+
}), z ? /* @__PURE__ */ s("span", {
|
|
59
|
+
className: "relative z-[1] flex w-full items-center gap-1.5",
|
|
60
|
+
children: [
|
|
61
|
+
u?.(n, "eager"),
|
|
62
|
+
/* @__PURE__ */ e("input", {
|
|
63
|
+
ref: y,
|
|
64
|
+
role: "combobox",
|
|
65
|
+
"data-testid": `${r}-search`,
|
|
66
|
+
className: "w-12 min-w-0 border-0 bg-transparent p-0 text-base outline-none",
|
|
67
|
+
value: h,
|
|
68
|
+
placeholder: k,
|
|
69
|
+
onChange: (a) => c(a.target.value),
|
|
70
|
+
onKeyDown: o.handleKeyDown,
|
|
71
|
+
"aria-controls": p,
|
|
72
|
+
"aria-expanded": !0,
|
|
73
|
+
"aria-activedescendant": $["aria-activedescendant"],
|
|
74
|
+
"aria-autocomplete": "list"
|
|
75
|
+
}),
|
|
76
|
+
/* @__PURE__ */ e("button", {
|
|
77
|
+
type: "button",
|
|
78
|
+
"data-testid": `${r}-collapse`,
|
|
79
|
+
"aria-labelledby": v,
|
|
80
|
+
"aria-expanded": !0,
|
|
81
|
+
onClick: l,
|
|
82
|
+
className: "ml-auto flex shrink-0 cursor-pointer border-0 bg-transparent p-0",
|
|
83
|
+
children: /* @__PURE__ */ e(E, {
|
|
84
|
+
width: 20,
|
|
85
|
+
height: 20,
|
|
86
|
+
className: "rotate-180"
|
|
87
|
+
})
|
|
88
|
+
})
|
|
89
|
+
]
|
|
90
|
+
}) : /* @__PURE__ */ s("button", {
|
|
91
|
+
ref: C,
|
|
92
|
+
type: "button",
|
|
93
|
+
"data-testid": r,
|
|
94
|
+
disabled: i,
|
|
95
|
+
"aria-haspopup": "listbox",
|
|
96
|
+
"aria-expanded": t,
|
|
97
|
+
"aria-labelledby": v,
|
|
98
|
+
onClick: () => w(!0),
|
|
99
|
+
className: m("relative z-[1] flex w-full items-center gap-1.5 border-0 bg-transparent p-0 text-base", i ? "cursor-not-allowed text-delta-300" : "cursor-pointer text-delta-800"),
|
|
100
|
+
children: [
|
|
101
|
+
u?.(n, "eager"),
|
|
102
|
+
/* @__PURE__ */ e("span", {
|
|
103
|
+
className: "w-12 text-left",
|
|
104
|
+
children: k
|
|
105
|
+
}),
|
|
106
|
+
/* @__PURE__ */ e(E, {
|
|
107
|
+
width: 20,
|
|
108
|
+
height: 20,
|
|
109
|
+
className: m("ml-auto shrink-0 transition-transform", t && "rotate-180")
|
|
110
|
+
})
|
|
111
|
+
]
|
|
112
|
+
})]
|
|
113
|
+
}), d ? /* @__PURE__ */ e(q, {
|
|
114
|
+
open: t,
|
|
115
|
+
onClose: l,
|
|
116
|
+
dataTest: `${r}-dialog`,
|
|
117
|
+
dialogTitle: g,
|
|
118
|
+
showCloseIcon: !0,
|
|
119
|
+
fullWidth: !0,
|
|
120
|
+
children: /* @__PURE__ */ s("div", {
|
|
121
|
+
className: "flex min-h-0 flex-1 flex-col",
|
|
122
|
+
children: [/* @__PURE__ */ e("div", {
|
|
123
|
+
className: "shrink-0 p-4",
|
|
124
|
+
children: /* @__PURE__ */ e(W, {
|
|
125
|
+
dataTest: `${r}-search`,
|
|
126
|
+
label: P,
|
|
127
|
+
value: h,
|
|
128
|
+
onChange: (a) => c(a.target.value),
|
|
129
|
+
onClear: () => c(""),
|
|
130
|
+
onKeyDown: o.handleKeyDown,
|
|
131
|
+
slotProps: { htmlInput: $ }
|
|
132
|
+
})
|
|
133
|
+
}), S]
|
|
134
|
+
})
|
|
135
|
+
}) : /* @__PURE__ */ e(A, {
|
|
136
|
+
open: t,
|
|
137
|
+
anchorEl: R,
|
|
138
|
+
onClose: l,
|
|
139
|
+
slotProps: { paper: { className: "flex max-h-80 w-80 flex-col overflow-hidden" } },
|
|
140
|
+
children: S
|
|
141
|
+
})] });
|
|
142
|
+
};
|
|
143
|
+
export {
|
|
144
|
+
re as CountryCodeSelect
|
|
145
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { cn as t } from "../../../helpers/cn.js";
|
|
2
|
+
import { useState as c } from "react";
|
|
3
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
4
|
+
var h = ({ iso2: r, src: o, loading: n = "lazy", className: d }) => {
|
|
5
|
+
const [s, i] = c(!1), e = t("h-4 w-6 shrink-0 rounded-sm bg-delta-100", d);
|
|
6
|
+
return s ? /* @__PURE__ */ a("span", {
|
|
7
|
+
"aria-hidden": "true",
|
|
8
|
+
"data-country": r.toLowerCase(),
|
|
9
|
+
className: e
|
|
10
|
+
}) : /* @__PURE__ */ a("img", {
|
|
11
|
+
src: o,
|
|
12
|
+
"data-country": r.toLowerCase(),
|
|
13
|
+
alt: "",
|
|
14
|
+
"aria-hidden": "true",
|
|
15
|
+
loading: n,
|
|
16
|
+
decoding: "async",
|
|
17
|
+
width: 24,
|
|
18
|
+
height: 16,
|
|
19
|
+
onError: () => i(!0),
|
|
20
|
+
className: t(e, "object-cover")
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
h as StyledCountryFlag
|
|
25
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { cn as L } from "../../../helpers/cn.js";
|
|
2
|
+
import { StyledInputField as M } from "../input-field/StyledInputField.js";
|
|
3
|
+
import { StyledLink as V } from "../../navigation/link/StyledLink.js";
|
|
4
|
+
import { CountryCodeSelect as W } from "./CountryCodeSelect.js";
|
|
5
|
+
import { useId as z } from "react";
|
|
6
|
+
import { jsx as t, jsxs as r } from "react/jsx-runtime";
|
|
7
|
+
var E = (e) => e.replace(/\D/g, ""), U = ({ dataTest: e, label: l, countries: h, country: n, onCountryChange: x, value: s, onChange: f, onBlur: N, error: v, helperText: y, reserveHelperText: g = !0, disabled: d, readOnly: $, readOnlyText: i, readOnlyHref: m, required: c, placeholder: b, formatNationalNumber: I, renderFlag: C, selectCountryLabel: S, searchPlaceholder: F, id: j, name: P, size: k = "medium", fieldClassName: p, helperTextClassName: w, className: A }) => {
|
|
8
|
+
const B = z(), a = j ?? `${B}-phone`, u = `${a}-label`, o = I?.(s, n) ?? s;
|
|
9
|
+
return /* @__PURE__ */ r("div", {
|
|
10
|
+
className: L("flex flex-col", A),
|
|
11
|
+
"data-testid": `${e}-root`,
|
|
12
|
+
children: [l != null && /* @__PURE__ */ r("label", {
|
|
13
|
+
id: u,
|
|
14
|
+
htmlFor: a,
|
|
15
|
+
className: "pb-1 text-base font-semibold text-delta-800",
|
|
16
|
+
children: [l, c === !0 && /* @__PURE__ */ t("span", {
|
|
17
|
+
"aria-hidden": "true",
|
|
18
|
+
children: " *"
|
|
19
|
+
})]
|
|
20
|
+
}), $ === !0 ? /* @__PURE__ */ t("span", {
|
|
21
|
+
className: "py-2 text-base text-delta-800",
|
|
22
|
+
children: m === void 0 ? /* @__PURE__ */ t("span", {
|
|
23
|
+
"data-testid": `${e}-readonly`,
|
|
24
|
+
children: i ?? o
|
|
25
|
+
}) : /* @__PURE__ */ t(V, {
|
|
26
|
+
dataTest: `${e}-readonly`,
|
|
27
|
+
href: m,
|
|
28
|
+
className: "-ml-1",
|
|
29
|
+
contentNode: i ?? o
|
|
30
|
+
})
|
|
31
|
+
}) : /* @__PURE__ */ r("div", {
|
|
32
|
+
className: "flex items-start gap-2.5",
|
|
33
|
+
children: [/* @__PURE__ */ t(W, {
|
|
34
|
+
dataTest: `${e}-country`,
|
|
35
|
+
countries: h,
|
|
36
|
+
value: n,
|
|
37
|
+
onChange: x,
|
|
38
|
+
disabled: d,
|
|
39
|
+
selectCountryLabel: S,
|
|
40
|
+
searchPlaceholder: F,
|
|
41
|
+
renderFlag: C,
|
|
42
|
+
labelledBy: l == null ? void 0 : u,
|
|
43
|
+
className: p
|
|
44
|
+
}), /* @__PURE__ */ t(M, {
|
|
45
|
+
dataTest: `${e}-number`,
|
|
46
|
+
className: "max-w-[200px]",
|
|
47
|
+
id: a,
|
|
48
|
+
name: P,
|
|
49
|
+
value: o,
|
|
50
|
+
onChange: (D) => f(E(D.target.value)),
|
|
51
|
+
onBlur: N,
|
|
52
|
+
placeholder: b,
|
|
53
|
+
error: v,
|
|
54
|
+
disabled: d,
|
|
55
|
+
required: c,
|
|
56
|
+
fullWidth: !0,
|
|
57
|
+
helperText: y,
|
|
58
|
+
reserveHelperText: g,
|
|
59
|
+
size: k,
|
|
60
|
+
slotProps: {
|
|
61
|
+
htmlInput: {
|
|
62
|
+
inputMode: "tel",
|
|
63
|
+
autoComplete: "tel"
|
|
64
|
+
},
|
|
65
|
+
input: { className: p },
|
|
66
|
+
formHelperText: { className: w }
|
|
67
|
+
}
|
|
68
|
+
})]
|
|
69
|
+
})]
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
export {
|
|
73
|
+
U as StyledPhoneField
|
|
74
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { useMemo as m, useState as v } from "react";
|
|
2
|
+
function D(r, i) {
|
|
3
|
+
const n = i.trim();
|
|
4
|
+
if (n.length === 0) return !0;
|
|
5
|
+
const s = n.replace(/^\+/, "").replace(/\D/g, "");
|
|
6
|
+
return s.length === 0 && !new RegExp("\\p{L}", "u").test(n) || r.name.toLocaleLowerCase().includes(n.toLocaleLowerCase()) ? !0 : s.length > 0 && r.dialCode.startsWith(s);
|
|
7
|
+
}
|
|
8
|
+
function b({ countries: r, selectedIso2: i, query: n, listId: s, onSelect: f, onDismiss: d }) {
|
|
9
|
+
const [p, a] = v(i), o = m(() => r.filter((e) => D(e, n)), [r, n]), l = o.findIndex((e) => e.iso2 === p), c = l >= 0 ? l : 0, h = (e) => `${s}-option-${e}`, u = (e) => {
|
|
10
|
+
if (o.length === 0) return;
|
|
11
|
+
const t = o[(c + e + o.length) % o.length];
|
|
12
|
+
t !== void 0 && a(t.iso2);
|
|
13
|
+
};
|
|
14
|
+
return {
|
|
15
|
+
visible: o,
|
|
16
|
+
activeIndex: c,
|
|
17
|
+
optionId: h,
|
|
18
|
+
handleKeyDown: (e) => {
|
|
19
|
+
switch (e.key) {
|
|
20
|
+
case "ArrowDown":
|
|
21
|
+
e.preventDefault(), u(1);
|
|
22
|
+
break;
|
|
23
|
+
case "ArrowUp":
|
|
24
|
+
e.preventDefault(), u(-1);
|
|
25
|
+
break;
|
|
26
|
+
case "Home": {
|
|
27
|
+
e.preventDefault();
|
|
28
|
+
const t = o[0];
|
|
29
|
+
t !== void 0 && a(t.iso2);
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
case "End": {
|
|
33
|
+
e.preventDefault();
|
|
34
|
+
const t = o[o.length - 1];
|
|
35
|
+
t !== void 0 && a(t.iso2);
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
case "Enter": {
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
const t = o[c];
|
|
41
|
+
t !== void 0 && f(t.iso2);
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
case "Escape":
|
|
45
|
+
e.preventDefault(), d();
|
|
46
|
+
break;
|
|
47
|
+
default:
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
b as useCountryPicker
|
|
55
|
+
};
|
|
@@ -1,49 +1,52 @@
|
|
|
1
1
|
import { cn as p } from "../../../helpers/cn.js";
|
|
2
|
-
import { SearchIcon as
|
|
2
|
+
import { SearchIcon as u } from "../../icons/search-icon/SearchIcon.js";
|
|
3
3
|
import { CloseIcon as f } from "../../icons/close-icon/CloseIcon.js";
|
|
4
|
-
import { StyledInputField as
|
|
5
|
-
import { useState as
|
|
4
|
+
import { StyledInputField as v } from "../input-field/StyledInputField.js";
|
|
5
|
+
import { useState as y } from "react";
|
|
6
6
|
import { jsx as t } from "react/jsx-runtime";
|
|
7
|
-
var
|
|
8
|
-
const [
|
|
7
|
+
var F = ({ value: r, onClear: d, label: a, onFocus: c, onBlur: h, slotProps: o, ...n }) => {
|
|
8
|
+
const [m, l] = y(!1), i = m || r, s = typeof a == "string" ? a : void 0;
|
|
9
9
|
return /* @__PURE__ */ t("div", {
|
|
10
10
|
className: "relative w-full",
|
|
11
|
-
children: /* @__PURE__ */ t(
|
|
11
|
+
children: /* @__PURE__ */ t(v, {
|
|
12
12
|
size: "small",
|
|
13
13
|
variant: "outlined",
|
|
14
|
-
value:
|
|
14
|
+
value: r,
|
|
15
15
|
reserveHelperText: !1,
|
|
16
|
-
label:
|
|
17
|
-
placeholder:
|
|
16
|
+
label: i ? a : void 0,
|
|
17
|
+
placeholder: i ? void 0 : s,
|
|
18
18
|
onFocus: (e) => {
|
|
19
|
-
l(!0),
|
|
19
|
+
l(!0), c?.(e);
|
|
20
20
|
},
|
|
21
21
|
onBlur: (e) => {
|
|
22
|
-
l(!1),
|
|
22
|
+
l(!1), h?.(e);
|
|
23
23
|
},
|
|
24
24
|
slotProps: {
|
|
25
|
+
...o,
|
|
25
26
|
htmlInput: {
|
|
27
|
+
"aria-label": i ? void 0 : s,
|
|
28
|
+
...o?.htmlInput,
|
|
26
29
|
style: {
|
|
27
30
|
overflow: "hidden",
|
|
28
31
|
textOverflow: "ellipsis",
|
|
29
32
|
whiteSpace: "nowrap",
|
|
30
|
-
...
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
...r ? { paddingRight: 40 } : {},
|
|
34
|
+
...o?.htmlInput?.style
|
|
35
|
+
}
|
|
33
36
|
},
|
|
34
37
|
input: {
|
|
35
|
-
endAdornment:
|
|
38
|
+
endAdornment: r ? /* @__PURE__ */ t("button", {
|
|
36
39
|
type: "button",
|
|
37
40
|
"aria-label": "Clear",
|
|
38
41
|
"data-testid": "styled-search-clear-icon",
|
|
39
|
-
className: p("cursor-pointer rounded-full border-0 bg-delta-50", "flex items-center justify-center", "transform-gpu transition-all duration-300 ease-in-out",
|
|
42
|
+
className: p("cursor-pointer rounded-full border-0 bg-delta-50", "flex items-center justify-center", "transform-gpu transition-all duration-300 ease-in-out", r ? "scale-100 opacity-100" : "pointer-events-none scale-75 opacity-0", n.readOnly && "-translate-x-[6.5px]"),
|
|
40
43
|
style: {
|
|
41
44
|
width: 24,
|
|
42
45
|
height: 24,
|
|
43
46
|
flexShrink: 0
|
|
44
47
|
},
|
|
45
48
|
onClick: (e) => {
|
|
46
|
-
e.preventDefault(), e.stopPropagation(),
|
|
49
|
+
e.preventDefault(), e.stopPropagation(), d?.();
|
|
47
50
|
},
|
|
48
51
|
children: /* @__PURE__ */ t(f, {
|
|
49
52
|
width: 20,
|
|
@@ -52,26 +55,27 @@ var I = ({ value: o, onClear: s, label: i, onFocus: d, onBlur: c, ...r }) => {
|
|
|
52
55
|
className: "pointer-events-none"
|
|
53
56
|
})
|
|
54
57
|
}) : null,
|
|
55
|
-
startAdornment:
|
|
58
|
+
startAdornment: i ? void 0 : /* @__PURE__ */ t("span", {
|
|
56
59
|
"data-testid": "styled-search-icon",
|
|
57
60
|
className: "flex items-center",
|
|
58
|
-
children: /* @__PURE__ */ t(
|
|
61
|
+
children: /* @__PURE__ */ t(u, {
|
|
59
62
|
width: 24,
|
|
60
63
|
height: 24,
|
|
61
64
|
color: "var(--colors-delta-700)",
|
|
62
65
|
className: "pointer-events-none"
|
|
63
66
|
})
|
|
64
|
-
})
|
|
67
|
+
}),
|
|
68
|
+
...o?.input
|
|
65
69
|
}
|
|
66
70
|
},
|
|
67
|
-
...
|
|
71
|
+
...n,
|
|
68
72
|
sx: {
|
|
69
|
-
width:
|
|
70
|
-
...
|
|
73
|
+
width: n.fullWidth ? "100%" : "var(--dynamic-toolbar-search-width, 160px)",
|
|
74
|
+
...n.sx
|
|
71
75
|
}
|
|
72
76
|
})
|
|
73
77
|
});
|
|
74
78
|
};
|
|
75
79
|
export {
|
|
76
|
-
|
|
80
|
+
F as StyledSearchField
|
|
77
81
|
};
|