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