@vkzstudio/muza-ui 1.9.2 → 1.9.3
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/Input/Input.js +1 -1
- package/dist/components/PhoneInput/PhoneInput.d.ts.map +1 -1
- package/dist/components/PhoneInput/PhoneInput.js +68 -60
- package/dist/components/Textarea/Textarea.js +1 -1
- package/dist/muza-ui.css +1 -1
- package/dist/stories/AutofillHarness.stories.d.ts +19 -0
- package/dist/stories/AutofillHarness.stories.d.ts.map +1 -0
- package/dist/styles/utilities.css +28 -0
- package/package.json +1 -1
|
@@ -37,7 +37,7 @@ const Y = M(
|
|
|
37
37
|
weight: "medium",
|
|
38
38
|
fixY: !0
|
|
39
39
|
}),
|
|
40
|
-
"flex-1 bg-transparent outline-0 text-comp-input-text-primary transition-colors",
|
|
40
|
+
"autofill-field flex-1 bg-transparent outline-0 text-comp-input-text-primary transition-colors",
|
|
41
41
|
"placeholder:text-comp-input-text-placeholder",
|
|
42
42
|
"placeholder:font-regular",
|
|
43
43
|
"disabled:cursor-not-allowed",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhoneInput.d.ts","sourceRoot":"","sources":["../../../src/components/PhoneInput/PhoneInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,SAAS,EAMf,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,KAAK,YAAY,EAAO,MAAM,0BAA0B,CAAA;AACjE,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,aAAa,EAGnB,MAAM,2BAA2B,CAAA;AAOlC;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,qFAAqF;IACrF,UAAU,EAAE,MAAM,CAAA;IAClB,4DAA4D;IAC5D,OAAO,EAAE,aAAa,CAAA;CACvB;AAKD,QAAA,MAAM,oBAAoB;;;8EAyBzB,CAAA;
|
|
1
|
+
{"version":3,"file":"PhoneInput.d.ts","source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CAAC,EAAE,OAAO,CAAA;IACjC,6FAA6F;IAC7F,UAAU,CAAC,EAAE,SAAS,CAAA;IACtB,sGAAsG;IACtG,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;OAGG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,eAAO,MAAM,UAAU,8GA6HtB,CAAA"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { cva as
|
|
4
|
-
import { usePhoneInput as
|
|
5
|
-
import { useMuzaTranslations as
|
|
1
|
+
import { jsx as p, jsxs as W } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as B, useId as G, useRef as H, useState as J, useEffect as K } from "react";
|
|
3
|
+
import { cva as O } from "class-variance-authority";
|
|
4
|
+
import { usePhoneInput as Q, defaultCountries as U } from "react-international-phone";
|
|
5
|
+
import { useMuzaTranslations as X } from "../../translations/TranslationContext.js";
|
|
6
6
|
import { cn as v } from "../../utils/cn.js";
|
|
7
|
-
import { FormField as
|
|
7
|
+
import { FormField as Y } from "../FormField/FormField.js";
|
|
8
8
|
import { typographyVariants as Z } from "../Typography/Typography.js";
|
|
9
9
|
import { CountrySelector as _ } from "./CountrySelector.js";
|
|
10
|
-
const q =
|
|
10
|
+
const q = O(
|
|
11
11
|
[
|
|
12
12
|
"group flex items-center",
|
|
13
13
|
"rounded-full border border-comp-input-stroke-def bg-comp-input-fill-def transition-colors",
|
|
@@ -32,43 +32,51 @@ const q = K(
|
|
|
32
32
|
error: !1
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
), ee = (
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
35
|
+
), ee = (o) => {
|
|
36
|
+
const e = o === "xs" || o === "sm";
|
|
37
|
+
return v(
|
|
38
|
+
Z({
|
|
39
|
+
size: e ? "input" : "base",
|
|
40
|
+
weight: "medium"
|
|
41
|
+
}),
|
|
42
|
+
// This input fills the field's height, so the browser paints the autofill
|
|
43
|
+
// highlight across the whole segment. `fixY` would nudge that painted box
|
|
44
|
+
// down along with the text, past the wrapper's rounded bottom edge, so the
|
|
45
|
+
// baseline correction is applied as padding and the outer end is rounded to
|
|
46
|
+
// follow the pill.
|
|
47
|
+
e ? "fix-y-box-1" : "fix-y-box",
|
|
48
|
+
"autofill-field h-full min-w-0 flex-1 rounded-r-full bg-transparent px-comp-input-p-hor text-comp-input-text-primary outline-0 transition-colors",
|
|
49
|
+
"placeholder:font-regular placeholder:text-comp-input-text-placeholder",
|
|
50
|
+
"disabled:cursor-not-allowed"
|
|
51
|
+
);
|
|
52
|
+
}, te = B(
|
|
45
53
|
({
|
|
46
|
-
className:
|
|
47
|
-
label:
|
|
48
|
-
hint:
|
|
49
|
-
size:
|
|
50
|
-
error:
|
|
54
|
+
className: o,
|
|
55
|
+
label: e,
|
|
56
|
+
hint: d,
|
|
57
|
+
size: c,
|
|
58
|
+
error: r,
|
|
51
59
|
value: m,
|
|
52
60
|
defaultValue: C,
|
|
53
61
|
onChange: i,
|
|
54
62
|
defaultCountry: V = "cz",
|
|
55
|
-
countries:
|
|
56
|
-
disabled:
|
|
57
|
-
required:
|
|
63
|
+
countries: f = U,
|
|
64
|
+
disabled: h,
|
|
65
|
+
required: s,
|
|
58
66
|
disableRequiredAsterisk: w,
|
|
59
67
|
labelExtra: P,
|
|
60
68
|
infoTooltip: R,
|
|
61
69
|
id: k,
|
|
62
70
|
countrySelectorAriaLabel: N,
|
|
63
|
-
searchPlaceholder:
|
|
64
|
-
noResultsText:
|
|
71
|
+
searchPlaceholder: S,
|
|
72
|
+
noResultsText: z,
|
|
65
73
|
...b
|
|
66
|
-
},
|
|
67
|
-
const
|
|
74
|
+
}, t) => {
|
|
75
|
+
const u = X(), F = G(), n = k ?? F, x = d ? `${n}-hint` : void 0, y = e ? `${n}-label` : void 0, l = H(null), I = m !== void 0, [j, A] = J(C ?? ""), L = I ? m : j, { inputValue: M, country: T, setCountry: $, handlePhoneValueChange: D } = Q({
|
|
68
76
|
defaultCountry: V,
|
|
69
77
|
value: L,
|
|
70
|
-
countries:
|
|
71
|
-
inputRef:
|
|
78
|
+
countries: f,
|
|
79
|
+
inputRef: l,
|
|
72
80
|
// Keep the dial code out of the number field — it lives in the country
|
|
73
81
|
// selector segment. `phone` in onChange is still full E.164.
|
|
74
82
|
disableDialCodeAndPrefix: !0,
|
|
@@ -83,54 +91,54 @@ const q = K(
|
|
|
83
91
|
});
|
|
84
92
|
}
|
|
85
93
|
});
|
|
86
|
-
return
|
|
87
|
-
|
|
88
|
-
}, [
|
|
89
|
-
|
|
94
|
+
return K(() => {
|
|
95
|
+
t && (typeof t == "function" ? t(l.current) : t.current = l.current);
|
|
96
|
+
}, [t]), /* @__PURE__ */ p(
|
|
97
|
+
Y,
|
|
90
98
|
{
|
|
91
|
-
label:
|
|
92
|
-
hint:
|
|
93
|
-
error:
|
|
94
|
-
required:
|
|
99
|
+
label: e,
|
|
100
|
+
hint: d,
|
|
101
|
+
error: r,
|
|
102
|
+
required: s,
|
|
95
103
|
disableRequiredAsterisk: w,
|
|
96
|
-
htmlFor:
|
|
97
|
-
labelId:
|
|
98
|
-
hintId:
|
|
104
|
+
htmlFor: n,
|
|
105
|
+
labelId: y,
|
|
106
|
+
hintId: x,
|
|
99
107
|
labelExtra: P,
|
|
100
108
|
infoTooltip: R,
|
|
101
|
-
children: /* @__PURE__ */ W("div", { className: v(q({ size:
|
|
102
|
-
/* @__PURE__ */
|
|
109
|
+
children: /* @__PURE__ */ W("div", { className: v(q({ size: c, error: r }), o), children: [
|
|
110
|
+
/* @__PURE__ */ p(
|
|
103
111
|
_,
|
|
104
112
|
{
|
|
105
113
|
selectedCountry: T.iso2,
|
|
106
114
|
onCountryChange: (a) => $(a),
|
|
107
|
-
countries:
|
|
108
|
-
disabled:
|
|
109
|
-
error:
|
|
110
|
-
ariaLabel: N ??
|
|
111
|
-
searchPlaceholder:
|
|
112
|
-
noResultsText:
|
|
115
|
+
countries: f,
|
|
116
|
+
disabled: h,
|
|
117
|
+
error: r,
|
|
118
|
+
ariaLabel: N ?? u.phoneInput.countrySelectorAriaLabel,
|
|
119
|
+
searchPlaceholder: S ?? u.phoneInput.searchPlaceholder,
|
|
120
|
+
noResultsText: z ?? u.phoneInput.noResults
|
|
113
121
|
}
|
|
114
122
|
),
|
|
115
|
-
/* @__PURE__ */
|
|
123
|
+
/* @__PURE__ */ p(
|
|
116
124
|
"input",
|
|
117
125
|
{
|
|
118
126
|
...b,
|
|
119
|
-
ref:
|
|
120
|
-
id:
|
|
127
|
+
ref: l,
|
|
128
|
+
id: n,
|
|
121
129
|
type: "tel",
|
|
122
130
|
inputMode: "tel",
|
|
123
131
|
autoComplete: b.autoComplete ?? "tel",
|
|
124
132
|
"data-slot": "phone-input",
|
|
125
133
|
value: M,
|
|
126
134
|
onChange: D,
|
|
127
|
-
disabled:
|
|
128
|
-
required:
|
|
129
|
-
"aria-describedby":
|
|
130
|
-
"aria-labelledby":
|
|
131
|
-
"aria-invalid":
|
|
132
|
-
"aria-required":
|
|
133
|
-
className: ee(
|
|
135
|
+
disabled: h,
|
|
136
|
+
required: s,
|
|
137
|
+
"aria-describedby": x,
|
|
138
|
+
"aria-labelledby": y,
|
|
139
|
+
"aria-invalid": r,
|
|
140
|
+
"aria-required": s,
|
|
141
|
+
className: ee(c)
|
|
134
142
|
}
|
|
135
143
|
)
|
|
136
144
|
] })
|
|
@@ -11,7 +11,7 @@ const E = x(
|
|
|
11
11
|
weight: "medium",
|
|
12
12
|
size: "base"
|
|
13
13
|
}),
|
|
14
|
-
"w-full font-text text-comp-input-text-primary transition-colors outline-none",
|
|
14
|
+
"w-full font-text text-comp-input-text-primary autofill-field transition-colors outline-none",
|
|
15
15
|
"placeholder:font-regular placeholder:text-comp-input-text-placeholder",
|
|
16
16
|
"mr-[calc(var(--spacing-xl)/2)] pt-xl pr-[calc(var(--spacing-comp-input-p-hor)-var(--spacing-xl)/2)] pb-[calc(var(--spacing-xl)/2)] pl-comp-input-p-hor",
|
|
17
17
|
"disabled:cursor-not-allowed"
|