@geckou/ui-react 0.5.1 → 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.
- package/README.md +37 -0
- package/dist/components/CheckBox.d.ts +7 -1
- package/dist/components/CheckBox.js +28 -19
- package/dist/components/CheckBoxes.js +26 -25
- package/dist/components/DatePicker.js +112 -97
- package/dist/components/DateRangePicker.js +47 -47
- package/dist/components/ErrorMessage.js +10 -10
- package/dist/components/LabeledCheckbox.d.ts +3 -1
- package/dist/components/LabeledCheckbox.js +18 -16
- package/dist/components/ModalBox.js +35 -30
- package/dist/components/PopupBox.js +4 -3
- package/dist/components/SearchableSelectBox.d.ts +2 -1
- package/dist/components/SearchableSelectBox.js +57 -50
- package/dist/components/SelectBox.js +54 -53
- package/dist/components/SlideDownUi.js +9 -9
- package/dist/components/TextArea.js +51 -43
- package/dist/components/TextBox.d.ts +3 -1
- package/dist/components/TextBox.js +62 -60
- package/dist/index.d.ts +1 -0
- package/package.json +2 -2
|
@@ -1,68 +1,76 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { isEmptyValue as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { InputBox as
|
|
6
|
-
import { ErrorMessage as
|
|
7
|
-
function z({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
import { jsxs as H, jsx as h } from "react/jsx-runtime";
|
|
3
|
+
import { isEmptyValue as M, validateInputValue as T } from "@geckou/ui-core";
|
|
4
|
+
import { useState as j, useRef as m, useEffect as k } from "react";
|
|
5
|
+
import { InputBox as I } from "./InputBox.js";
|
|
6
|
+
import { ErrorMessage as W } from "./ErrorMessage.js";
|
|
7
|
+
function z(n) {
|
|
8
|
+
const e = getComputedStyle(n), t = (...r) => r.reduce((a, i) => a + (parseFloat(i) || 0), 0);
|
|
9
|
+
return e.boxSizing === "border-box" ? n.scrollHeight + t(e.borderTopWidth, e.borderBottomWidth) : n.scrollHeight - t(e.paddingTop, e.paddingBottom);
|
|
10
|
+
}
|
|
11
|
+
function q({
|
|
12
|
+
name: n,
|
|
13
|
+
value: e,
|
|
14
|
+
onChange: t,
|
|
11
15
|
cssStyle: r,
|
|
12
|
-
placeholder:
|
|
16
|
+
placeholder: a = "入力してください",
|
|
13
17
|
isDisabled: i,
|
|
14
|
-
isRequired:
|
|
15
|
-
rows:
|
|
16
|
-
maxLength:
|
|
18
|
+
isRequired: p,
|
|
19
|
+
rows: x,
|
|
20
|
+
maxLength: b = 100,
|
|
17
21
|
autocomplete: v = "off",
|
|
18
22
|
validates: E = [],
|
|
19
23
|
autoAdjustHeight: V
|
|
20
24
|
}) {
|
|
21
|
-
var
|
|
22
|
-
const [
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
return
|
|
26
|
-
if (V &&
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
var c, g;
|
|
26
|
+
const [l, B] = j([]), d = m(null), o = e ?? "", f = () => {
|
|
27
|
+
B(T(o, { isRequired: p, validates: E }));
|
|
28
|
+
}, C = m(o), s = m(!1);
|
|
29
|
+
return k(() => {
|
|
30
|
+
if (V && d.current) {
|
|
31
|
+
const u = d.current;
|
|
32
|
+
u.style.height = "auto", u.style.height = `${z(u)}px`;
|
|
33
|
+
}
|
|
34
|
+
if (!s.current) {
|
|
35
|
+
if (o === C.current) {
|
|
36
|
+
M(o) || f();
|
|
29
37
|
return;
|
|
30
38
|
}
|
|
31
|
-
|
|
39
|
+
s.current = !0;
|
|
32
40
|
}
|
|
33
|
-
|
|
34
|
-
}, [
|
|
35
|
-
|
|
41
|
+
f();
|
|
42
|
+
}, [o]), /* @__PURE__ */ H(
|
|
43
|
+
I,
|
|
36
44
|
{
|
|
37
45
|
cssStyle: r,
|
|
38
46
|
className: "min-h-[4em]",
|
|
39
|
-
isErrored: !!
|
|
47
|
+
isErrored: !!l.length,
|
|
40
48
|
isDisabled: i,
|
|
41
49
|
children: [
|
|
42
|
-
/* @__PURE__ */
|
|
50
|
+
/* @__PURE__ */ h(
|
|
43
51
|
"textarea",
|
|
44
52
|
{
|
|
45
|
-
ref:
|
|
46
|
-
name:
|
|
47
|
-
value:
|
|
48
|
-
required:
|
|
49
|
-
placeholder:
|
|
53
|
+
ref: d,
|
|
54
|
+
name: n,
|
|
55
|
+
value: o,
|
|
56
|
+
required: p,
|
|
57
|
+
placeholder: a,
|
|
50
58
|
disabled: i,
|
|
51
59
|
autoComplete: v,
|
|
52
|
-
rows:
|
|
53
|
-
maxLength:
|
|
54
|
-
"aria-invalid":
|
|
55
|
-
onChange: (
|
|
56
|
-
onBlur: () =>
|
|
60
|
+
rows: x,
|
|
61
|
+
maxLength: b,
|
|
62
|
+
"aria-invalid": l.length ? "true" : void 0,
|
|
63
|
+
onChange: (u) => t == null ? void 0 : t(u.target.value),
|
|
64
|
+
onBlur: () => f()
|
|
57
65
|
}
|
|
58
66
|
),
|
|
59
|
-
/* @__PURE__ */
|
|
60
|
-
|
|
67
|
+
/* @__PURE__ */ h(
|
|
68
|
+
W,
|
|
61
69
|
{
|
|
62
|
-
errorMessages:
|
|
70
|
+
errorMessages: l,
|
|
63
71
|
cssStyle: {
|
|
64
|
-
textColor: (
|
|
65
|
-
backgroundColor: (
|
|
72
|
+
textColor: (c = r == null ? void 0 : r.error) == null ? void 0 : c.backgroundColor,
|
|
73
|
+
backgroundColor: (g = r == null ? void 0 : r.error) == null ? void 0 : g.textColor
|
|
66
74
|
}
|
|
67
75
|
}
|
|
68
76
|
)
|
|
@@ -71,5 +79,5 @@ function z({
|
|
|
71
79
|
);
|
|
72
80
|
}
|
|
73
81
|
export {
|
|
74
|
-
|
|
82
|
+
q as TextArea
|
|
75
83
|
};
|
|
@@ -23,11 +23,13 @@ type Props = {
|
|
|
23
23
|
*/
|
|
24
24
|
role?: string;
|
|
25
25
|
ariaLabel?: string;
|
|
26
|
+
/** 可視ラベルがあるなら、その要素の id をここで指す(ariaLabel より優先) */
|
|
27
|
+
ariaLabelledBy?: string;
|
|
26
28
|
ariaExpanded?: boolean;
|
|
27
29
|
ariaControls?: string;
|
|
28
30
|
ariaActivedescendant?: string;
|
|
29
31
|
ariaAutocomplete?: 'none' | 'inline' | 'list' | 'both';
|
|
30
32
|
onKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
31
33
|
};
|
|
32
|
-
export declare function TextBox({ name, value, onChange, cssStyle, inputType, placeholder, isDisabled, isRequired, maxLength, autocomplete, validates, before, after, id, role, ariaLabel, ariaExpanded, ariaControls, ariaActivedescendant, ariaAutocomplete, onKeyDown, }: Props): import("react").JSX.Element;
|
|
34
|
+
export declare function TextBox({ name, value, onChange, cssStyle, inputType, placeholder, isDisabled, isRequired, maxLength, autocomplete, validates, before, after, id, role, ariaLabel, ariaLabelledBy, ariaExpanded, ariaControls, ariaActivedescendant, ariaAutocomplete, onKeyDown, }: Props): import("react").JSX.Element;
|
|
33
35
|
export {};
|
|
@@ -1,99 +1,101 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { isEmptyValue as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { InputBox as
|
|
6
|
-
import { ErrorMessage as
|
|
7
|
-
function
|
|
8
|
-
name:
|
|
9
|
-
value:
|
|
10
|
-
onChange:
|
|
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:
|
|
13
|
-
placeholder:
|
|
12
|
+
inputType: b = "text",
|
|
13
|
+
placeholder: g = "入力してください",
|
|
14
14
|
isDisabled: l,
|
|
15
15
|
isRequired: f,
|
|
16
|
-
maxLength:
|
|
17
|
-
autocomplete:
|
|
18
|
-
validates:
|
|
19
|
-
before:
|
|
20
|
-
after:
|
|
21
|
-
id:
|
|
22
|
-
role:
|
|
23
|
-
ariaLabel:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
|
31
|
-
const [o,
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
|
|
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 (
|
|
37
|
-
|
|
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
|
-
}, [
|
|
44
|
+
}, [t]);
|
|
44
45
|
const i = n(!1);
|
|
45
|
-
return /* @__PURE__ */
|
|
46
|
-
|
|
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
|
-
|
|
54
|
-
/* @__PURE__ */
|
|
54
|
+
k,
|
|
55
|
+
/* @__PURE__ */ x(
|
|
55
56
|
"input",
|
|
56
57
|
{
|
|
57
|
-
type:
|
|
58
|
-
id:
|
|
59
|
-
name:
|
|
60
|
-
role:
|
|
61
|
-
"aria-label":
|
|
62
|
-
"aria-
|
|
63
|
-
"aria-
|
|
64
|
-
"aria-
|
|
65
|
-
"aria-
|
|
66
|
-
|
|
67
|
-
|
|
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:
|
|
71
|
+
placeholder: g,
|
|
70
72
|
disabled: l,
|
|
71
|
-
autoComplete:
|
|
72
|
-
maxLength:
|
|
73
|
+
autoComplete: T,
|
|
74
|
+
maxLength: M,
|
|
73
75
|
"aria-invalid": o.length ? "true" : void 0,
|
|
74
76
|
onChange: (u) => {
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
i.current ?
|
|
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,
|
|
86
|
+
i.current = !1, e == null || e(v(u.currentTarget.value));
|
|
85
87
|
},
|
|
86
88
|
onBlur: () => a()
|
|
87
89
|
}
|
|
88
90
|
),
|
|
89
|
-
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
-
|
|
91
|
+
B,
|
|
92
|
+
/* @__PURE__ */ x(
|
|
93
|
+
R,
|
|
92
94
|
{
|
|
93
95
|
errorMessages: o,
|
|
94
96
|
cssStyle: {
|
|
95
|
-
textColor: (
|
|
96
|
-
backgroundColor: (
|
|
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
|
-
|
|
107
|
+
$ as TextBox
|
|
106
108
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { CheckBoxes } from './components/CheckBoxes';
|
|
|
4
4
|
export { CheckButton } from './components/CheckButton';
|
|
5
5
|
export { DatePicker } from './components/DatePicker';
|
|
6
6
|
export { DateRangePicker } from './components/DateRangePicker';
|
|
7
|
+
export type { DateRange } from './components/DateRangePicker';
|
|
7
8
|
export { DateSelector } from './components/DateSelector';
|
|
8
9
|
export { DropdownUi } from './components/DropdownUi';
|
|
9
10
|
export type { DropdownUiHandle } from './components/DropdownUi';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geckou/ui-react",
|
|
3
|
-
"version": "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.
|
|
43
|
+
"@geckou/ui-core": "^0.7.0"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "vite build && node scripts/copy-assets.mjs",
|