@arthurzakharov/ui-kit 1.7.3 → 1.7.4
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/assets/input-DfrrUlEe.css +1 -0
- package/dist/assets/text-area-CvucKIow.css +1 -0
- package/dist/controls/interactives/input/input.component.js +14 -14
- package/dist/controls/interactives/text-area/text-area.component.js +7 -7
- package/package.json +1 -1
- package/dist/assets/input-D66hMzHc.css +0 -1
- package/dist/assets/text-area-Dgc2jHSx.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._Input_16els_1{outline:none;box-sizing:border-box;border:none;display:inline-flex;font-family:Lato,sans-serif;font-weight:var(--rm-ui-font-weight-medium);font-size:var(--rm-ui-font-size-body);line-height:var(--rm-ui-line-height-body);color:var(--rm-ui-color-text-primary);background-color:transparent}._Input_16els_1:hover{cursor:pointer}._Input_16els_1:disabled{opacity:.33}._Input_16els_1:disabled,._Input_16els_1:-webkit-autofill,._Input_16els_1:-webkit-autofill:hover,._Input_16els_1:-webkit-autofill:focus,._Input_16els_1:-webkit-autofill:active,._Input_16els_1:autofill,._Input_16els_1:autofill:hover,._Input_16els_1:autofill:focus,._Input_16els_1:autofill:active{-webkit-text-fill-color:var(--rm-ui-color-text-primary);background:transparent;transition:background 7200s ease-in-out 0s}._Input_16els_1:-webkit-autofill{animation-name:_autofill-start_16els_1;animation-duration:.1s}._Input_16els_1:not(:-webkit-autofill){animation-name:_autofill-end_16els_1;animation-duration:.1s}._Placeholder_16els_46{color:var(--rm-ui-color-text-secondary);font-weight:var(--rm-ui-font-weight-light)}@keyframes _autofill-start_16els_1{}@keyframes _autofill-end_16els_1{}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._TextArea_1auuc_1{display:flex;flex-direction:column}._Input_1auuc_6{resize:none;outline:none;box-sizing:border-box;width:100%;border:none;border-radius:10px;padding:var(--rm-ui-padding-xs) var(--rm-ui-padding-sm);font-family:Lato,sans-serif;font-weight:var(--rm-ui-font-weight-medium);font-size:var(--rm-ui-font-size-body);line-height:var(--rm-ui-line-height-body);color:var(--rm-ui-color-text-primary)}._Input_1auuc_6:hover{cursor:pointer}._Input_1auuc_6:disabled{opacity:.33}._ErrorMessage_1auuc_29{padding-top:var(--rm-ui-padding-xxs)}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsx as M } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as d, useState as O, useLayoutEffect as Q, useCallback as R, useEffect as W } from "react";
|
|
3
3
|
import K from "clsx";
|
|
4
|
-
import { compareStrings as X, isDigit as Y, getFirstNotEnteredCharIndex as
|
|
4
|
+
import { compareStrings as X, isDigit as Y, getFirstNotEnteredCharIndex as P, replaceCharByIndex as b, getNextChar as T, isSeparator as w, getPreviousChar as Z, applyMask as k } from "./input.utils.js";
|
|
5
5
|
import { useControlInteraction as tt } from "../../utils/hooks/use-control-interaction/use-control-interaction.hook.js";
|
|
6
6
|
import { baseProps as h } from "../../../utils/functions/functions.util.js";
|
|
7
|
-
import '../../../assets/input-
|
|
7
|
+
import '../../../assets/input-DfrrUlEe.css';const et = "_Input_16els_1", nt = "_Placeholder_16els_46", y = {
|
|
8
8
|
Input: et,
|
|
9
9
|
Placeholder: nt
|
|
10
10
|
}, it = ({
|
|
11
11
|
// Interactive props
|
|
12
12
|
id: u,
|
|
13
|
-
value:
|
|
13
|
+
value: v = "",
|
|
14
14
|
disabled: g = !1,
|
|
15
15
|
onChange: $,
|
|
16
16
|
onFocus: L,
|
|
@@ -29,7 +29,7 @@ import '../../../assets/input-D66hMzHc.css';const et = "_Input_gfvsr_1", nt = "_
|
|
|
29
29
|
onChange: $,
|
|
30
30
|
onFocus: L,
|
|
31
31
|
onBlur: j
|
|
32
|
-
}), o = d(null), D = d(!1), a = d(null), N = d(!0), [r, I] = O(
|
|
32
|
+
}), o = d(null), D = d(!1), a = d(null), N = d(!0), [r, I] = O(v || n), i = (t) => {
|
|
33
33
|
const c = Math.max(0, t);
|
|
34
34
|
if (a.current = c, !o.current) return;
|
|
35
35
|
const e = Math.min(c, o.current.value.length);
|
|
@@ -41,17 +41,17 @@ import '../../../assets/input-D66hMzHc.css';const et = "_Input_gfvsr_1", nt = "_
|
|
|
41
41
|
o.current.setSelectionRange(t, t), a.current = null;
|
|
42
42
|
}, [r, n]);
|
|
43
43
|
const F = () => {
|
|
44
|
-
const t = o.current?.value || "", c =
|
|
44
|
+
const t = o.current?.value || "", c = P(t, n);
|
|
45
45
|
c !== t.length && i(c);
|
|
46
46
|
}, G = R(() => {
|
|
47
47
|
const t = o.current?.value || "", c = X(r, t);
|
|
48
48
|
if (!Y(c)) return;
|
|
49
|
-
const e = o.current?.selectionEnd || 0, m =
|
|
49
|
+
const e = o.current?.selectionEnd || 0, m = P(t, n) === t.length, l = b(r, e - 1, c), p = P(l, n);
|
|
50
50
|
if (m) {
|
|
51
|
-
const
|
|
52
|
-
I(J), i(
|
|
51
|
+
const f = t.slice(0, e - 1), x = t.slice(e - 1, e), B = t.slice(e), J = b(f + B, e - 1, x), _ = T(f + B, e) || "";
|
|
52
|
+
I(J), i(w(_, n) && _ ? e + 1 : e);
|
|
53
53
|
} else
|
|
54
|
-
I(l), i(
|
|
54
|
+
I(l), i(p);
|
|
55
55
|
}, [r, n]), H = R(
|
|
56
56
|
(t) => {
|
|
57
57
|
if ([
|
|
@@ -73,8 +73,8 @@ import '../../../assets/input-D66hMzHc.css';const et = "_Input_gfvsr_1", nt = "_
|
|
|
73
73
|
t.preventDefault();
|
|
74
74
|
const e = o.current?.selectionEnd || 0;
|
|
75
75
|
if (e) {
|
|
76
|
-
const A = Z(r, e), m = T(r, e - 1), l =
|
|
77
|
-
I(x), i(
|
|
76
|
+
const A = Z(r, e), m = T(r, e - 1), l = w(A, n), p = w(m, n), f = e - (l || p ? 2 : 1), x = k(r, n, e - (p ? 2 : 1));
|
|
77
|
+
I(x), i(f);
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
},
|
|
@@ -103,7 +103,7 @@ import '../../../assets/input-D66hMzHc.css';const et = "_Input_gfvsr_1", nt = "_
|
|
|
103
103
|
id: u,
|
|
104
104
|
name: u,
|
|
105
105
|
value: r,
|
|
106
|
-
className: K(
|
|
106
|
+
className: K(y.Input, h(s, "className"), { [y.Placeholder]: r === n }),
|
|
107
107
|
onAnimationStart: (t) => V(t.animationName),
|
|
108
108
|
onKeyDown: H,
|
|
109
109
|
onChange: G,
|
|
@@ -129,8 +129,8 @@ import '../../../assets/input-D66hMzHc.css';const et = "_Input_gfvsr_1", nt = "_
|
|
|
129
129
|
type: "text",
|
|
130
130
|
id: u,
|
|
131
131
|
name: u,
|
|
132
|
-
value:
|
|
133
|
-
className: K(
|
|
132
|
+
value: v,
|
|
133
|
+
className: K(y.Input, h(s, "className")),
|
|
134
134
|
onChange: (t) => C(t.target.value, "keyboard"),
|
|
135
135
|
onAnimationStart: (t) => V(t.animationName),
|
|
136
136
|
onFocus: S,
|
|
@@ -7,10 +7,10 @@ import { baseProps as t } from "../../../utils/functions/functions.util.js";
|
|
|
7
7
|
import "lucide-react";
|
|
8
8
|
import { ErrorMessage as C } from "../../primitives/error-message/error-message.component.js";
|
|
9
9
|
import "usehooks-ts";
|
|
10
|
-
import { useControlInteraction as
|
|
11
|
-
import '../../../assets/text-area-
|
|
12
|
-
Input:
|
|
13
|
-
ErrorMessage:
|
|
10
|
+
import { useControlInteraction as B } from "../../utils/hooks/use-control-interaction/use-control-interaction.hook.js";
|
|
11
|
+
import '../../../assets/text-area-CvucKIow.css';const F = "_Input_1auuc_6", j = "_ErrorMessage_1auuc_29", a = {
|
|
12
|
+
Input: F,
|
|
13
|
+
ErrorMessage: j
|
|
14
14
|
}, z = ({
|
|
15
15
|
// Interactive props
|
|
16
16
|
id: o,
|
|
@@ -27,7 +27,7 @@ import '../../../assets/text-area-Dgc2jHSx.css';const B = "_Input_11gck_6", F =
|
|
|
27
27
|
// Base props
|
|
28
28
|
...e
|
|
29
29
|
}) => {
|
|
30
|
-
const { focused:
|
|
30
|
+
const { focused: x, emitChange: g, handleFocus: f, handleBlur: h } = B({
|
|
31
31
|
id: o,
|
|
32
32
|
disabled: s,
|
|
33
33
|
onChange: c,
|
|
@@ -40,7 +40,7 @@ import '../../../assets/text-area-Dgc2jHSx.css';const B = "_Input_11gck_6", F =
|
|
|
40
40
|
"data-testid": t(e, "data-testid", "textarea"),
|
|
41
41
|
className: N(a.Container, t(e, "className")),
|
|
42
42
|
children: [
|
|
43
|
-
/* @__PURE__ */ r(I, { state: n, focused:
|
|
43
|
+
/* @__PURE__ */ r(I, { state: n, focused: x, className: t(e, "className"), children: /* @__PURE__ */ r(
|
|
44
44
|
"textarea",
|
|
45
45
|
{
|
|
46
46
|
"data-testid": "textarea-input",
|
|
@@ -50,7 +50,7 @@ import '../../../assets/text-area-Dgc2jHSx.css';const B = "_Input_11gck_6", F =
|
|
|
50
50
|
placeholder: p,
|
|
51
51
|
value: i,
|
|
52
52
|
className: a.Input,
|
|
53
|
-
onChange: (E) =>
|
|
53
|
+
onChange: (E) => g(E.target.value, "keyboard"),
|
|
54
54
|
onFocus: () => f(),
|
|
55
55
|
onBlur: () => h()
|
|
56
56
|
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
._Input_gfvsr_1{outline:none;box-sizing:border-box;border:none;display:inline-flex;font-weight:var(--rm-ui-font-weight-medium);font-size:var(--rm-ui-font-size-body);line-height:var(--rm-ui-line-height-body);color:var(--rm-ui-color-text-primary);background-color:transparent}._Input_gfvsr_1:hover{cursor:pointer}._Input_gfvsr_1:disabled{opacity:.33}._Input_gfvsr_1:disabled,._Input_gfvsr_1:-webkit-autofill,._Input_gfvsr_1:-webkit-autofill:hover,._Input_gfvsr_1:-webkit-autofill:focus,._Input_gfvsr_1:-webkit-autofill:active,._Input_gfvsr_1:autofill,._Input_gfvsr_1:autofill:hover,._Input_gfvsr_1:autofill:focus,._Input_gfvsr_1:autofill:active{-webkit-text-fill-color:var(--rm-ui-color-text-primary);background:transparent;transition:background 7200s ease-in-out 0s}._Input_gfvsr_1:-webkit-autofill{animation-name:_autofill-start_gfvsr_1;animation-duration:.1s}._Input_gfvsr_1:not(:-webkit-autofill){animation-name:_autofill-end_gfvsr_1;animation-duration:.1s}._Placeholder_gfvsr_45{color:var(--rm-ui-color-text-secondary);font-weight:var(--rm-ui-font-weight-light)}@keyframes _autofill-start_gfvsr_1{}@keyframes _autofill-end_gfvsr_1{}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
._TextArea_11gck_1{display:flex;flex-direction:column}._Input_11gck_6{resize:none;outline:none;box-sizing:border-box;width:100%;border:none;border-radius:10px;padding:var(--rm-ui-padding-xs) var(--rm-ui-padding-sm);font-weight:var(--rm-ui-font-weight-medium);font-size:var(--rm-ui-font-size-body);line-height:var(--rm-ui-line-height-body);color:var(--rm-ui-color-text-primary)}._Input_11gck_6:hover{cursor:pointer}._Input_11gck_6:disabled{opacity:.33}._ErrorMessage_11gck_28{padding-top:var(--rm-ui-padding-xxs)}
|