@cfx-dev/ui-components 4.3.12 → 4.3.13
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,22 +1,22 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as $, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import i from "react";
|
|
3
|
-
import { Icon as
|
|
4
|
-
import
|
|
5
|
-
import { Indicator as
|
|
6
|
-
import { clsx as
|
|
7
|
-
import { getValue as
|
|
8
|
-
import { ui as
|
|
9
|
-
const
|
|
10
|
-
root:
|
|
11
|
-
fullWidth:
|
|
12
|
-
input:
|
|
13
|
-
empty:
|
|
14
|
-
placeholderIcon:
|
|
15
|
-
decorator:
|
|
16
|
-
small:
|
|
17
|
-
large:
|
|
18
|
-
onlight:
|
|
19
|
-
backdropBlur:
|
|
3
|
+
import { Icon as q } from "../Icon/Icon.js";
|
|
4
|
+
import H from "../IconButton/IconButton.js";
|
|
5
|
+
import { Indicator as J } from "../Indicator/Indicator.js";
|
|
6
|
+
import { clsx as C } from "../../utils/clsx.js";
|
|
7
|
+
import { getValue as L } from "../../utils/getValue.js";
|
|
8
|
+
import { ui as O } from "../../utils/ui/ui.js";
|
|
9
|
+
const P = "cfxui__Input__root__6392b", Q = "cfxui__Input__fullWidth__5a033", U = "cfxui__Input__input__07830", Y = "cfxui__Input__empty__3b36a", Z = "cfxui__Input__placeholderIcon__4d079", ee = "cfxui__Input__decorator__3b81f", le = "cfxui__Input__small__c1513", te = "cfxui__Input__large__92d72", ae = "cfxui__Input__onlight__7d0b7", ie = "cfxui__Input__backdropBlur__fdde1", l = {
|
|
10
|
+
root: P,
|
|
11
|
+
fullWidth: Q,
|
|
12
|
+
input: U,
|
|
13
|
+
empty: Y,
|
|
14
|
+
placeholderIcon: Z,
|
|
15
|
+
decorator: ee,
|
|
16
|
+
small: le,
|
|
17
|
+
large: te,
|
|
18
|
+
onlight: ae,
|
|
19
|
+
backdropBlur: ie,
|
|
20
20
|
"inputSizeinitial-large": "cfxui__Input__inputSizeinitial-large__12afb",
|
|
21
21
|
"inputSizeinitial-small": "cfxui__Input__inputSizeinitial-small__33905",
|
|
22
22
|
"inputSizesmall-large": "cfxui__Input__inputSizesmall-large__e2689",
|
|
@@ -32,113 +32,115 @@ const O = "cfxui__Input__root__6392b", P = "cfxui__Input__fullWidth__5a033", Q =
|
|
|
32
32
|
"inputSizexlarge-large": "cfxui__Input__inputSizexlarge-large__1ef2c",
|
|
33
33
|
"inputSizexlarge-small": "cfxui__Input__inputSizexlarge-small__7f6ab"
|
|
34
34
|
};
|
|
35
|
-
function
|
|
35
|
+
function ne(n) {
|
|
36
36
|
const {
|
|
37
|
-
decorator:
|
|
38
|
-
loading:
|
|
39
|
-
type:
|
|
40
|
-
hasValue:
|
|
41
|
-
onCleare:
|
|
37
|
+
decorator: o,
|
|
38
|
+
loading: m,
|
|
39
|
+
type: p,
|
|
40
|
+
hasValue: a,
|
|
41
|
+
onCleare: u
|
|
42
42
|
} = n;
|
|
43
|
-
return
|
|
43
|
+
return m ? /* @__PURE__ */ t("div", { className: l.decorator, children: /* @__PURE__ */ t(J, {}) }) : o ? /* @__PURE__ */ t("div", { className: l.decorator, children: L(o) }) : p === "search" && a ? /* @__PURE__ */ t("div", { className: l.decorator, children: /* @__PURE__ */ t(H, { size: "xsmall", areaSize: "large", name: "Close", onClick: u }) }) : null;
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function de(n) {
|
|
46
46
|
const {
|
|
47
|
-
id:
|
|
47
|
+
id: o,
|
|
48
|
+
name: m,
|
|
48
49
|
fullWidth: p = !1,
|
|
49
50
|
value: a,
|
|
50
51
|
onChange: u,
|
|
51
|
-
onSubmit:
|
|
52
|
-
onKeyDown:
|
|
53
|
-
pattern:
|
|
54
|
-
tabIndex:
|
|
55
|
-
loading:
|
|
56
|
-
spellCheck:
|
|
57
|
-
autofocus:
|
|
58
|
-
disabled:
|
|
59
|
-
className:
|
|
60
|
-
containerClassName:
|
|
61
|
-
placeholder:
|
|
62
|
-
placeholderIcon:
|
|
63
|
-
type:
|
|
64
|
-
size:
|
|
65
|
-
theme:
|
|
66
|
-
decorator:
|
|
67
|
-
backdropBlur:
|
|
68
|
-
ref:
|
|
69
|
-
} = n, [
|
|
70
|
-
let
|
|
52
|
+
onSubmit: d,
|
|
53
|
+
onKeyDown: f,
|
|
54
|
+
pattern: g,
|
|
55
|
+
tabIndex: N,
|
|
56
|
+
loading: y = !1,
|
|
57
|
+
spellCheck: k = !0,
|
|
58
|
+
autofocus: R = !1,
|
|
59
|
+
disabled: w = !1,
|
|
60
|
+
className: v,
|
|
61
|
+
containerClassName: E,
|
|
62
|
+
placeholder: c = "",
|
|
63
|
+
placeholderIcon: s,
|
|
64
|
+
type: I = "text",
|
|
65
|
+
size: B = "normal",
|
|
66
|
+
theme: V = "default",
|
|
67
|
+
decorator: W,
|
|
68
|
+
backdropBlur: D = !1,
|
|
69
|
+
ref: F
|
|
70
|
+
} = n, [x, A] = i.useState(a), S = typeof x < "u" && x !== "" && x !== null || typeof a < "u" && a !== "" && a !== null;
|
|
71
|
+
let z, h, b;
|
|
71
72
|
if (n.type === "number") {
|
|
72
73
|
const {
|
|
73
74
|
min: e,
|
|
74
|
-
max:
|
|
75
|
-
step:
|
|
75
|
+
max: r,
|
|
76
|
+
step: X
|
|
76
77
|
} = n;
|
|
77
|
-
|
|
78
|
+
b = X ?? 1, z = e ?? Number.MIN_SAFE_INTEGER, h = r ?? Number.MAX_SAFE_INTEGER;
|
|
78
79
|
}
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
}, [u]),
|
|
80
|
+
const _ = i.useCallback((e) => {
|
|
81
|
+
A(e), u && u(e);
|
|
82
|
+
}, [u]), K = i.useCallback(
|
|
82
83
|
(e) => {
|
|
83
84
|
const {
|
|
84
|
-
value:
|
|
85
|
+
value: r
|
|
85
86
|
} = e.target;
|
|
86
|
-
if (
|
|
87
|
-
|
|
87
|
+
if (g) {
|
|
88
|
+
g.test(r) && _(r);
|
|
88
89
|
return;
|
|
89
90
|
}
|
|
90
|
-
r
|
|
91
|
+
_(r);
|
|
91
92
|
},
|
|
92
|
-
[
|
|
93
|
-
),
|
|
94
|
-
|
|
95
|
-
}, [
|
|
96
|
-
|
|
97
|
-
}, [
|
|
93
|
+
[_, g]
|
|
94
|
+
), M = i.useCallback((e) => {
|
|
95
|
+
f && f(e), d && e.key === "Enter" && d();
|
|
96
|
+
}, [f, d]), j = i.useCallback(() => {
|
|
97
|
+
_("");
|
|
98
|
+
}, [_]), G = C(
|
|
98
99
|
l.root,
|
|
99
|
-
l[
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
l[V],
|
|
101
|
+
E,
|
|
102
|
+
O.getResponsiveFlatClassnames("input-size", B).map((e) => l[e]),
|
|
102
103
|
{
|
|
103
104
|
[l.fullWidth]: p,
|
|
104
|
-
[l.backdropBlur]:
|
|
105
|
-
[l.empty]: !
|
|
105
|
+
[l.backdropBlur]: D,
|
|
106
|
+
[l.empty]: !S
|
|
106
107
|
}
|
|
107
|
-
),
|
|
108
|
-
return /* @__PURE__ */
|
|
108
|
+
), T = i.useMemo(() => c ? s ? ` ${c.trim()}` : c.trim() : "", [c, s]);
|
|
109
|
+
return /* @__PURE__ */ $("div", { className: G, children: [
|
|
109
110
|
/* @__PURE__ */ t(
|
|
110
111
|
"input",
|
|
111
112
|
{
|
|
112
|
-
id:
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
113
|
+
id: o,
|
|
114
|
+
name: m,
|
|
115
|
+
ref: F,
|
|
116
|
+
type: I,
|
|
117
|
+
tabIndex: N,
|
|
118
|
+
autoFocus: R,
|
|
119
|
+
className: C(l.input, v),
|
|
118
120
|
value: a,
|
|
119
|
-
placeholder:
|
|
120
|
-
disabled:
|
|
121
|
-
onChange:
|
|
122
|
-
onKeyDown:
|
|
123
|
-
spellCheck:
|
|
124
|
-
min:
|
|
125
|
-
max:
|
|
126
|
-
step:
|
|
121
|
+
placeholder: T,
|
|
122
|
+
disabled: w,
|
|
123
|
+
onChange: K,
|
|
124
|
+
onKeyDown: M,
|
|
125
|
+
spellCheck: k,
|
|
126
|
+
min: z,
|
|
127
|
+
max: h,
|
|
128
|
+
step: b
|
|
127
129
|
}
|
|
128
130
|
),
|
|
129
|
-
|
|
131
|
+
s && /* @__PURE__ */ t(q, { name: s, className: l.placeholderIcon }),
|
|
130
132
|
/* @__PURE__ */ t(
|
|
131
|
-
|
|
133
|
+
ne,
|
|
132
134
|
{
|
|
133
|
-
decorator:
|
|
134
|
-
loading:
|
|
135
|
-
type:
|
|
136
|
-
hasValue:
|
|
137
|
-
onCleare:
|
|
135
|
+
decorator: W,
|
|
136
|
+
loading: y,
|
|
137
|
+
type: I,
|
|
138
|
+
hasValue: S,
|
|
139
|
+
onCleare: j
|
|
138
140
|
}
|
|
139
141
|
)
|
|
140
142
|
] });
|
|
141
143
|
}
|
|
142
144
|
export {
|
|
143
|
-
|
|
145
|
+
de as default
|
|
144
146
|
};
|