@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 d from "clsx";
3
- import { useBoolean as x } from "usehooks-ts";
4
- import { FadeScale as k } from "../../../animations/fade-scale/fade-scale.component.js";
5
- import { FadeSlide as B } from "../../../animations/fade-slide/fade-slide.component.js";
6
- import { Box as C } from "../../primitives/box/box.component.js";
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 h } from "../../../utils/functions/functions.util.js";
8
+ import { baseProps as x } from "../../../utils/functions/functions.util.js";
9
9
  import "lucide-react";
10
- import { ErrorMessage as $ } from "../../primitives/error-message/error-message.component.js";
11
- import { Label as w } from "../../primitives/label/label.component.js";
12
- import { Input as D } from "../input/input.component.js";
13
- import '../../../assets/text-field-CMQWxQpy.css';const O = "_TextField_1jd9o_1", y = "_Content_1jd9o_11", q = "_Label_1jd9o_27", z = "_Idle_1jd9o_37", G = "_Active_1jd9o_42", H = "_Placeholder_1jd9o_47", J = "_PlaceholderText_1jd9o_54", K = "_ErrorMessage_1jd9o_62", Q = "_Input_1jd9o_66", R = "_MaskStart_1jd9o_70", e = {
14
- TextField: O,
15
- Content: y,
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: z,
18
- Active: G,
19
- Placeholder: H,
20
- PlaceholderText: J,
21
- ErrorMessage: K,
22
- Input: Q,
23
- MaskStart: R
24
- }, le = ({
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: l,
27
- value: s = "",
28
- disabled: I = !1,
29
- state: n = "idle",
30
- onChange: j,
31
- onFocus: F,
32
- onBlur: M,
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: c,
35
- maxLength: P = -1,
36
- label: T = "",
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: u, setTrue: g, setFalse: A } = x(!1), { value: r, setTrue: S, setFalse: b } = x(!1), a = r || !!s || u, E = !c && !!_ && r && !s && !u, N = !!m && n === "error", v = (o) => {
43
- S(), F?.(o);
44
- }, L = (o) => {
45
- b(), M?.(o);
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": h(p, "data-testid", "text-field"),
51
- className: d(e.TextField, h(p, "className")),
50
+ "data-testid": x(p, "data-testid", "text-field"),
51
+ className: c(e.TextField, x(p, "className")),
52
52
  children: [
53
- /* @__PURE__ */ i(C, { state: n, focused: r, children: [
53
+ /* @__PURE__ */ i(B, { state: l, focused: s, children: [
54
54
  /* @__PURE__ */ t(
55
- w,
55
+ $,
56
56
  {
57
57
  "data-testid": "text-label",
58
- text: T,
58
+ text: P,
59
59
  position: a ? "active" : "idle",
60
- state: a ? n : "idle",
61
- className: d(e.Label, a ? e.Active : e.Idle)
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: l,
67
+ htmlFor: d,
68
68
  className: e.Content,
69
69
  onPointerDown: (o) => {
70
- r && o.preventDefault();
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(k, { name: "text-placeholder", condition: E, className: e.Placeholder, children: /* @__PURE__ */ t("span", { "data-testid": "text-placeholder", className: e.PlaceholderText, children: _ }) }),
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
- D,
75
+ w,
78
76
  {
79
77
  "data-testid": "text-input",
80
- mask: c,
81
- maxLength: P,
82
- disabled: I,
83
- id: l,
84
- value: s,
85
- className: d(e.Input, {
86
- [e.MaskStart]: c && s === "" && !a
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: g,
86
+ onAnimationStart: T,
89
87
  onAnimationEnd: A,
90
- onChange: j,
91
- onFocus: v,
92
- onBlur: L
88
+ onChange: I,
89
+ onFocus: N,
90
+ onBlur: v
93
91
  }
94
92
  )
95
93
  ]
96
94
  }
97
95
  )
98
96
  ] }),
99
- /* @__PURE__ */ t(B, { name: "text-message", direction: "ltr", condition: N, children: /* @__PURE__ */ t($, { "data-testid": "text-error-message", text: m, className: e.ErrorMessage }) })
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
- le as TextField
103
+ ae as TextField
106
104
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arthurzakharov/ui-kit",
3
3
  "private": false,
4
- "version": "1.8.1",
4
+ "version": "1.8.3",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
7
7
  "types": "dist/main.d.ts",