@geckou/ui-react 0.6.0 → 0.7.0

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,99 +1,101 @@
1
1
  "use client";
2
- import { jsxs as A, jsx as s } from "react/jsx-runtime";
3
- import { isEmptyValue as G, convertFullWidthToHalfWidth as x, validateInputValue as J } from "@geckou/ui-core";
4
- import { useState as K, useRef as n, useEffect as L } from "react";
5
- import { InputBox as O } from "./InputBox.js";
6
- import { ErrorMessage as P } from "./ErrorMessage.js";
7
- function Z({
8
- name: v,
9
- value: E,
10
- onChange: t,
2
+ import { jsxs as G, jsx as x } from "react/jsx-runtime";
3
+ import { isEmptyValue as J, convertFullWidthToHalfWidth as v, validateInputValue as K } from "@geckou/ui-core";
4
+ import { useState as O, useRef as n, useEffect as P } from "react";
5
+ import { InputBox as Q } from "./InputBox.js";
6
+ import { ErrorMessage as R } from "./ErrorMessage.js";
7
+ function $({
8
+ name: E,
9
+ value: V,
10
+ onChange: e,
11
11
  cssStyle: r,
12
- inputType: V = "text",
13
- placeholder: b = "入力してください",
12
+ inputType: b = "text",
13
+ placeholder: g = "入力してください",
14
14
  isDisabled: l,
15
15
  isRequired: f,
16
- maxLength: g = 30,
17
- autocomplete: B = "off",
18
- validates: M = [],
19
- before: T,
20
- after: j,
21
- id: k,
22
- role: I,
23
- ariaLabel: W,
24
- ariaExpanded: w,
25
- ariaControls: C,
26
- ariaActivedescendant: F,
27
- ariaAutocomplete: H,
28
- onKeyDown: N
16
+ maxLength: M = 30,
17
+ autocomplete: T = "off",
18
+ validates: j = [],
19
+ before: k,
20
+ after: B,
21
+ id: I,
22
+ role: W,
23
+ ariaLabel: w,
24
+ ariaLabelledBy: d,
25
+ ariaExpanded: C,
26
+ ariaControls: F,
27
+ ariaActivedescendant: H,
28
+ ariaAutocomplete: N,
29
+ onKeyDown: q
29
30
  }) {
30
- var d, c;
31
- const [o, q] = K([]), e = E ?? "", a = () => {
32
- q(J(e, { isRequired: f, validates: M }));
33
- }, z = n(e), p = n(!1);
34
- L(() => {
31
+ var c, m;
32
+ const [o, z] = O([]), t = V ?? "", a = () => {
33
+ z(K(t, { isRequired: f, validates: j }));
34
+ }, A = n(t), p = n(!1);
35
+ P(() => {
35
36
  if (!p.current) {
36
- if (e === z.current) {
37
- G(e) || a();
37
+ if (t === A.current) {
38
+ J(t) || a();
38
39
  return;
39
40
  }
40
41
  p.current = !0;
41
42
  }
42
43
  a();
43
- }, [e]);
44
+ }, [t]);
44
45
  const i = n(!1);
45
- return /* @__PURE__ */ A(
46
- O,
46
+ return /* @__PURE__ */ G(
47
+ Q,
47
48
  {
48
49
  cssStyle: r,
49
50
  className: "inline-flex [&>input]:flex-auto",
50
51
  isErrored: !!o.length,
51
52
  isDisabled: l,
52
53
  children: [
53
- T,
54
- /* @__PURE__ */ s(
54
+ k,
55
+ /* @__PURE__ */ x(
55
56
  "input",
56
57
  {
57
- type: V,
58
- id: k,
59
- name: v,
60
- role: I,
61
- "aria-label": W,
62
- "aria-expanded": w,
63
- "aria-controls": C,
64
- "aria-activedescendant": F,
65
- "aria-autocomplete": H,
66
- onKeyDown: N,
67
- value: e,
58
+ type: b,
59
+ id: I,
60
+ name: E,
61
+ role: W,
62
+ "aria-label": d ? void 0 : w,
63
+ "aria-labelledby": d,
64
+ "aria-expanded": C,
65
+ "aria-controls": F,
66
+ "aria-activedescendant": H,
67
+ "aria-autocomplete": N,
68
+ onKeyDown: q,
69
+ value: t,
68
70
  required: f,
69
- placeholder: b,
71
+ placeholder: g,
70
72
  disabled: l,
71
- autoComplete: B,
72
- maxLength: g,
73
+ autoComplete: T,
74
+ maxLength: M,
73
75
  "aria-invalid": o.length ? "true" : void 0,
74
76
  onChange: (u) => {
75
- const m = u.target.value;
76
- t == null || t(
77
- i.current ? m : x(m)
77
+ const s = u.target.value;
78
+ e == null || e(
79
+ i.current ? s : v(s)
78
80
  );
79
81
  },
80
82
  onCompositionStart: () => {
81
83
  i.current = !0;
82
84
  },
83
85
  onCompositionEnd: (u) => {
84
- i.current = !1, t == null || t(x(u.currentTarget.value));
86
+ i.current = !1, e == null || e(v(u.currentTarget.value));
85
87
  },
86
88
  onBlur: () => a()
87
89
  }
88
90
  ),
89
- j,
90
- /* @__PURE__ */ s(
91
- P,
91
+ B,
92
+ /* @__PURE__ */ x(
93
+ R,
92
94
  {
93
95
  errorMessages: o,
94
96
  cssStyle: {
95
- textColor: (d = r == null ? void 0 : r.error) == null ? void 0 : d.backgroundColor,
96
- backgroundColor: (c = r == null ? void 0 : r.error) == null ? void 0 : c.textColor
97
+ textColor: (c = r == null ? void 0 : r.error) == null ? void 0 : c.backgroundColor,
98
+ backgroundColor: (m = r == null ? void 0 : r.error) == null ? void 0 : m.textColor
97
99
  }
98
100
  }
99
101
  )
@@ -102,5 +104,5 @@ function Z({
102
104
  );
103
105
  }
104
106
  export {
105
- Z as TextBox
107
+ $ as TextBox
106
108
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geckou/ui-react",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "A set of reusable React UI components (forms) by Geckou",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -40,7 +40,7 @@
40
40
  "react-dom": "^19.0.0"
41
41
  },
42
42
  "dependencies": {
43
- "@geckou/ui-core": "^0.6.0"
43
+ "@geckou/ui-core": "^0.7.0"
44
44
  },
45
45
  "scripts": {
46
46
  "build": "vite build && node scripts/copy-assets.mjs",