@arthurzakharov/ui-kit 1.8.1 → 1.8.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.
|
@@ -1,106 +1,104 @@
|
|
|
1
1
|
import { jsxs as i, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { useBoolean as
|
|
4
|
-
import { FadeScale as
|
|
5
|
-
import { FadeSlide as
|
|
6
|
-
import { Box as
|
|
2
|
+
import c from "clsx";
|
|
3
|
+
import { useBoolean as u } from "usehooks-ts";
|
|
4
|
+
import { FadeScale as L } from "../../../animations/fade-scale/fade-scale.component.js";
|
|
5
|
+
import { FadeSlide as k } from "../../../animations/fade-slide/fade-slide.component.js";
|
|
6
|
+
import { Box as B } from "../../primitives/box/box.component.js";
|
|
7
7
|
import "react";
|
|
8
|
-
import { baseProps as
|
|
8
|
+
import { baseProps as x } from "../../../utils/functions/functions.util.js";
|
|
9
9
|
import "lucide-react";
|
|
10
|
-
import { ErrorMessage as
|
|
11
|
-
import { Label as
|
|
12
|
-
import { Input as
|
|
13
|
-
import '../../../assets/text-field-CMQWxQpy.css';const
|
|
14
|
-
TextField:
|
|
15
|
-
Content:
|
|
10
|
+
import { ErrorMessage as C } from "../../primitives/error-message/error-message.component.js";
|
|
11
|
+
import { Label as $ } from "../../primitives/label/label.component.js";
|
|
12
|
+
import { Input as w } from "../input/input.component.js";
|
|
13
|
+
import '../../../assets/text-field-CMQWxQpy.css';const D = "_TextField_1jd9o_1", O = "_Content_1jd9o_11", q = "_Label_1jd9o_27", y = "_Idle_1jd9o_37", z = "_Active_1jd9o_42", G = "_Placeholder_1jd9o_47", H = "_PlaceholderText_1jd9o_54", J = "_ErrorMessage_1jd9o_62", K = "_Input_1jd9o_66", Q = "_MaskStart_1jd9o_70", e = {
|
|
14
|
+
TextField: D,
|
|
15
|
+
Content: O,
|
|
16
16
|
Label: q,
|
|
17
|
-
Idle:
|
|
18
|
-
Active:
|
|
19
|
-
Placeholder:
|
|
20
|
-
PlaceholderText:
|
|
21
|
-
ErrorMessage:
|
|
22
|
-
Input:
|
|
23
|
-
MaskStart:
|
|
24
|
-
},
|
|
17
|
+
Idle: y,
|
|
18
|
+
Active: z,
|
|
19
|
+
Placeholder: G,
|
|
20
|
+
PlaceholderText: H,
|
|
21
|
+
ErrorMessage: J,
|
|
22
|
+
Input: K,
|
|
23
|
+
MaskStart: Q
|
|
24
|
+
}, ae = ({
|
|
25
25
|
// Interactive props
|
|
26
|
-
id:
|
|
27
|
-
value:
|
|
28
|
-
disabled:
|
|
29
|
-
state:
|
|
30
|
-
onChange:
|
|
31
|
-
onFocus:
|
|
32
|
-
onBlur:
|
|
26
|
+
id: d,
|
|
27
|
+
value: r = "",
|
|
28
|
+
disabled: h = !1,
|
|
29
|
+
state: l = "idle",
|
|
30
|
+
onChange: I,
|
|
31
|
+
onFocus: j,
|
|
32
|
+
onBlur: F,
|
|
33
33
|
// Text props
|
|
34
|
-
mask:
|
|
35
|
-
maxLength:
|
|
36
|
-
label:
|
|
34
|
+
mask: n,
|
|
35
|
+
maxLength: M = -1,
|
|
36
|
+
label: P = "",
|
|
37
37
|
message: m = "",
|
|
38
38
|
placeholder: _ = "",
|
|
39
39
|
// Base props
|
|
40
40
|
...p
|
|
41
41
|
}) => {
|
|
42
|
-
const { value:
|
|
43
|
-
S(),
|
|
44
|
-
},
|
|
45
|
-
b(),
|
|
42
|
+
const { value: f, setTrue: T, setFalse: A } = u(!1), { value: s, setTrue: S, setFalse: b } = u(!1), a = s || !!r || f, g = !n && !!_ && s && !r && !f, E = !!m && l === "error", N = (o) => {
|
|
43
|
+
S(), j?.(o);
|
|
44
|
+
}, v = (o) => {
|
|
45
|
+
b(), F?.(o);
|
|
46
46
|
};
|
|
47
47
|
return /* @__PURE__ */ i(
|
|
48
48
|
"div",
|
|
49
49
|
{
|
|
50
|
-
"data-testid":
|
|
51
|
-
className:
|
|
50
|
+
"data-testid": x(p, "data-testid", "text-field"),
|
|
51
|
+
className: c(e.TextField, x(p, "className")),
|
|
52
52
|
children: [
|
|
53
|
-
/* @__PURE__ */ i(
|
|
53
|
+
/* @__PURE__ */ i(B, { state: l, focused: s, children: [
|
|
54
54
|
/* @__PURE__ */ t(
|
|
55
|
-
|
|
55
|
+
$,
|
|
56
56
|
{
|
|
57
57
|
"data-testid": "text-label",
|
|
58
|
-
text:
|
|
58
|
+
text: P,
|
|
59
59
|
position: a ? "active" : "idle",
|
|
60
|
-
state: a ?
|
|
61
|
-
className:
|
|
60
|
+
state: a ? l : "idle",
|
|
61
|
+
className: c(e.Label, a ? e.Active : e.Idle)
|
|
62
62
|
}
|
|
63
63
|
),
|
|
64
64
|
/* @__PURE__ */ i(
|
|
65
65
|
"label",
|
|
66
66
|
{
|
|
67
|
-
htmlFor:
|
|
67
|
+
htmlFor: d,
|
|
68
68
|
className: e.Content,
|
|
69
69
|
onPointerDown: (o) => {
|
|
70
|
-
|
|
71
|
-
const f = document.getElementById(l);
|
|
72
|
-
console.log("input", f), f?.click();
|
|
70
|
+
s && o.preventDefault();
|
|
73
71
|
},
|
|
74
72
|
children: [
|
|
75
|
-
/* @__PURE__ */ t(
|
|
73
|
+
/* @__PURE__ */ t(L, { name: "text-placeholder", condition: g, className: e.Placeholder, children: /* @__PURE__ */ t("span", { "data-testid": "text-placeholder", className: e.PlaceholderText, children: _ }) }),
|
|
76
74
|
/* @__PURE__ */ t(
|
|
77
|
-
|
|
75
|
+
w,
|
|
78
76
|
{
|
|
79
77
|
"data-testid": "text-input",
|
|
80
|
-
mask:
|
|
81
|
-
maxLength:
|
|
82
|
-
disabled:
|
|
83
|
-
id:
|
|
84
|
-
value:
|
|
85
|
-
className:
|
|
86
|
-
[e.MaskStart]:
|
|
78
|
+
mask: n,
|
|
79
|
+
maxLength: M,
|
|
80
|
+
disabled: h,
|
|
81
|
+
id: d,
|
|
82
|
+
value: r,
|
|
83
|
+
className: c(e.Input, {
|
|
84
|
+
[e.MaskStart]: n && r === "" && !a
|
|
87
85
|
}),
|
|
88
|
-
onAnimationStart:
|
|
86
|
+
onAnimationStart: T,
|
|
89
87
|
onAnimationEnd: A,
|
|
90
|
-
onChange:
|
|
91
|
-
onFocus:
|
|
92
|
-
onBlur:
|
|
88
|
+
onChange: I,
|
|
89
|
+
onFocus: N,
|
|
90
|
+
onBlur: v
|
|
93
91
|
}
|
|
94
92
|
)
|
|
95
93
|
]
|
|
96
94
|
}
|
|
97
95
|
)
|
|
98
96
|
] }),
|
|
99
|
-
/* @__PURE__ */ t(
|
|
97
|
+
/* @__PURE__ */ t(k, { name: "text-message", direction: "ltr", condition: E, children: /* @__PURE__ */ t(C, { "data-testid": "text-error-message", text: m, className: e.ErrorMessage }) })
|
|
100
98
|
]
|
|
101
99
|
}
|
|
102
100
|
);
|
|
103
101
|
};
|
|
104
102
|
export {
|
|
105
|
-
|
|
103
|
+
ae as TextField
|
|
106
104
|
};
|