@geckou/ui-react 0.3.0 → 0.5.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 +33 -0
- package/dist/components/CheckBox.d.ts +7 -1
- package/dist/components/CheckBox.js +37 -46
- package/dist/components/DatePicker.d.ts +8 -1
- package/dist/components/DatePicker.js +86 -79
- package/dist/components/DateRangePicker.js +60 -50
- package/dist/components/DateSelector.d.ts +11 -1
- package/dist/components/DateSelector.js +74 -62
- package/dist/components/ErrorMessage.js +7 -6
- package/dist/components/InputBox.js +36 -40
- package/dist/components/LabeledCheckbox.js +26 -23
- package/dist/components/ModalBox.js +54 -35
- package/dist/components/RadioButtons.js +45 -39
- package/dist/components/SearchableSelectBox.d.ts +3 -1
- package/dist/components/SearchableSelectBox.js +86 -43
- package/dist/components/TabUI.js +28 -27
- package/dist/components/TextBox.d.ts +15 -2
- package/dist/components/TextBox.js +54 -38
- package/dist/components/ToggleButton.d.ts +4 -1
- package/dist/components/ToggleButton.js +50 -53
- package/package.json +8 -6
|
@@ -1,64 +1,70 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useId as
|
|
4
|
-
import { COLOR as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
import { jsxs as f, jsx as u } from "react/jsx-runtime";
|
|
3
|
+
import { useState as N, useRef as G, useEffect as R, useId as z } from "react";
|
|
4
|
+
import { isEmptyValue as M, MESSAGES as V, COLOR as o } from "@geckou/ui-core";
|
|
5
|
+
import { ErrorMessage as j } from "./ErrorMessage.js";
|
|
6
|
+
function A({
|
|
7
|
+
value: p,
|
|
8
|
+
onChange: s,
|
|
9
|
+
options: m,
|
|
10
|
+
name: _,
|
|
11
|
+
isDisabled: a,
|
|
12
|
+
isRequired: n,
|
|
12
13
|
cssStyle: e,
|
|
13
|
-
isDisableAnimation:
|
|
14
|
+
isDisableAnimation: v
|
|
14
15
|
}) {
|
|
15
|
-
var
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
var i, d;
|
|
17
|
+
const r = p ?? "", [g, x] = N(!1), c = G(r);
|
|
18
|
+
R(() => {
|
|
19
|
+
c.current !== r && (c.current = r, x(!0));
|
|
20
|
+
}, [r]);
|
|
21
|
+
const h = g && n && M(r) ? [V.required] : void 0, k = z(), w = _ ?? k, C = a ? e == null ? void 0 : e.disabled : e == null ? void 0 : e.default, l = {
|
|
22
|
+
textColor: a ? o.darkGray : o.black,
|
|
23
|
+
backgroundColor: a ? o.lightGray : o.white,
|
|
19
24
|
border: {
|
|
20
|
-
color:
|
|
25
|
+
color: a ? o.darkGray : o.blue,
|
|
21
26
|
size: "1px"
|
|
22
27
|
},
|
|
23
|
-
...
|
|
24
|
-
},
|
|
28
|
+
...C ?? {}
|
|
29
|
+
}, E = {
|
|
25
30
|
"--text-color": l.textColor,
|
|
26
|
-
"--border-color": (
|
|
27
|
-
"--border-size": (
|
|
31
|
+
"--border-color": (i = l.border) == null ? void 0 : i.color,
|
|
32
|
+
"--border-size": (d = l.border) == null ? void 0 : d.size,
|
|
28
33
|
"--background-color": l.backgroundColor,
|
|
29
|
-
"--duration":
|
|
34
|
+
"--duration": v ? "0s" : ".3s"
|
|
30
35
|
};
|
|
31
|
-
return /* @__PURE__ */
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
+
return /* @__PURE__ */ f("div", { className: "relative flex flex-wrap items-center gap-4", children: [
|
|
37
|
+
/* @__PURE__ */ u("style", { children: "@keyframes uiRadioPop{0%{scale:1}10%{scale:.8}50%{scale:1.2}100%{scale:1}}" }),
|
|
38
|
+
m.map((t) => {
|
|
39
|
+
const b = t.value === r;
|
|
40
|
+
return /* @__PURE__ */ f(
|
|
36
41
|
"label",
|
|
37
42
|
{
|
|
38
|
-
style:
|
|
39
|
-
className: `relative grid cursor-pointer grid-cols-[auto_1fr] items-center gap-2 before:inline-block before:aspect-square before:w-4 before:rounded-full before:transition-all before:duration-(--duration) before:ease-linear before:content-[''] has-[input:disabled]:cursor-not-allowed has-[input:focus-visible]:outline-2 has-[input:focus-visible]:outline-offset-2 has-[input:focus-visible]:outline-(--border-color) ${
|
|
43
|
+
style: E,
|
|
44
|
+
className: `relative grid cursor-pointer grid-cols-[auto_1fr] items-center gap-2 before:inline-block before:aspect-square before:w-4 before:rounded-full before:transition-all before:duration-(--duration) before:ease-linear before:content-[''] has-[input:disabled]:cursor-not-allowed has-[input:focus-visible]:outline-2 has-[input:focus-visible]:outline-offset-2 has-[input:focus-visible]:outline-(--border-color) ${b ? "text-(--text-color) before:animate-[uiRadioPop_var(--duration)_ease-out] before:bg-(--border-color) before:shadow-[0_0_0_2px_var(--background-color)_inset,0_0_0_1px_var(--border-color)]" : "text-(--border-color) before:bg-(--background-color) before:shadow-[0_0_0_1px_var(--border-color)_inset]"}`,
|
|
40
45
|
children: [
|
|
41
|
-
/* @__PURE__ */
|
|
46
|
+
/* @__PURE__ */ u(
|
|
42
47
|
"input",
|
|
43
48
|
{
|
|
44
49
|
type: "radio",
|
|
45
|
-
name:
|
|
46
|
-
value:
|
|
47
|
-
disabled:
|
|
48
|
-
required:
|
|
49
|
-
checked:
|
|
50
|
-
onChange: () =>
|
|
50
|
+
name: w,
|
|
51
|
+
value: t.value,
|
|
52
|
+
disabled: a,
|
|
53
|
+
required: n,
|
|
54
|
+
checked: b,
|
|
55
|
+
onChange: () => s == null ? void 0 : s(t.value),
|
|
51
56
|
className: "sr-only"
|
|
52
57
|
}
|
|
53
58
|
),
|
|
54
|
-
/* @__PURE__ */
|
|
59
|
+
/* @__PURE__ */ u("span", { children: t.label })
|
|
55
60
|
]
|
|
56
61
|
},
|
|
57
|
-
|
|
62
|
+
t.value
|
|
58
63
|
);
|
|
59
|
-
})
|
|
64
|
+
}),
|
|
65
|
+
/* @__PURE__ */ u(j, { errorMessages: h })
|
|
60
66
|
] });
|
|
61
67
|
}
|
|
62
68
|
export {
|
|
63
|
-
|
|
69
|
+
A as RadioButtons
|
|
64
70
|
};
|
|
@@ -9,6 +9,8 @@ type Props = {
|
|
|
9
9
|
isDisabled?: boolean;
|
|
10
10
|
searchTarget?: 'label' | 'value';
|
|
11
11
|
cssStyle?: InputBoxStyleForEachStatus;
|
|
12
|
+
/** combobox のアクセシブル名。可視ラベルがあるならそちらを ariaLabelledBy で指すこと */
|
|
13
|
+
ariaLabel?: string;
|
|
12
14
|
};
|
|
13
|
-
export declare function SearchableSelectBox({ options, value, onChange, onSelect, name, placeholder, isDisabled, searchTarget, cssStyle, }: Props): import("react").JSX.Element;
|
|
15
|
+
export declare function SearchableSelectBox({ options, value, onChange, onSelect, name, placeholder, isDisabled, searchTarget, cssStyle, ariaLabel, }: Props): import("react").JSX.Element;
|
|
14
16
|
export {};
|
|
@@ -1,61 +1,104 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as N, jsx as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { TextBox as
|
|
5
|
-
function
|
|
6
|
-
options:
|
|
7
|
-
value:
|
|
2
|
+
import { jsxs as N, jsx as w } from "react/jsx-runtime";
|
|
3
|
+
import { useState as v, useRef as k, useId as _, useEffect as y } from "react";
|
|
4
|
+
import { TextBox as $ } from "./TextBox.js";
|
|
5
|
+
function R({
|
|
6
|
+
options: h,
|
|
7
|
+
value: o,
|
|
8
8
|
onChange: s,
|
|
9
|
-
onSelect:
|
|
10
|
-
name:
|
|
11
|
-
placeholder:
|
|
12
|
-
isDisabled:
|
|
13
|
-
searchTarget:
|
|
14
|
-
cssStyle:
|
|
9
|
+
onSelect: d,
|
|
10
|
+
name: A,
|
|
11
|
+
placeholder: I = "入力してください",
|
|
12
|
+
isDisabled: g,
|
|
13
|
+
searchTarget: B = "label",
|
|
14
|
+
cssStyle: L,
|
|
15
|
+
ariaLabel: O
|
|
15
16
|
}) {
|
|
16
|
-
const [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}, [
|
|
17
|
+
const [u, f] = v(o), [p, a] = v(!1), [i, n] = v(-1), x = k(null), m = _(), b = (e) => `${m}-option-${e}`, E = k(o);
|
|
18
|
+
y(() => {
|
|
19
|
+
E.current !== o && (E.current = o, f(o));
|
|
20
|
+
}, [o]), y(() => {
|
|
20
21
|
const e = (r) => {
|
|
21
|
-
const
|
|
22
|
-
|
|
22
|
+
const t = x.current;
|
|
23
|
+
t && !t.contains(r.target) && a(!1);
|
|
23
24
|
};
|
|
24
25
|
return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
|
|
25
26
|
}, []);
|
|
26
|
-
const
|
|
27
|
-
(e) => String(e[
|
|
28
|
-
) :
|
|
27
|
+
const l = u ? h.filter(
|
|
28
|
+
(e) => String(e[B]).toLowerCase().includes(u.toLowerCase())
|
|
29
|
+
) : h, F = (e) => {
|
|
29
30
|
const r = String(e);
|
|
30
|
-
|
|
31
|
-
},
|
|
31
|
+
f(r), a(!!r), n(-1), s == null || s(r);
|
|
32
|
+
}, D = (e) => {
|
|
32
33
|
const r = e.value.toString();
|
|
33
|
-
|
|
34
|
+
f(r), a(!1), n(-1), s == null || s(r), d == null || d(r);
|
|
35
|
+
}, c = p && l.length > 0, S = (e) => {
|
|
36
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
37
|
+
if (e.preventDefault(), !p) {
|
|
38
|
+
a(!0), n(
|
|
39
|
+
e.key === "ArrowDown" ? 0 : l.length - 1
|
|
40
|
+
);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (l.length === 0)
|
|
44
|
+
return;
|
|
45
|
+
n((r) => {
|
|
46
|
+
const t = l.length - 1;
|
|
47
|
+
return e.key === "ArrowDown" ? r >= t ? 0 : r + 1 : r <= 0 ? t : r - 1;
|
|
48
|
+
});
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (e.key === "Enter") {
|
|
52
|
+
const r = c ? l[i] : void 0;
|
|
53
|
+
r && (e.preventDefault(), D(r));
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
e.key === "Escape" && p && (e.preventDefault(), a(!1), n(-1));
|
|
34
57
|
};
|
|
35
|
-
return /* @__PURE__ */ N("div", { ref:
|
|
36
|
-
/* @__PURE__ */
|
|
37
|
-
|
|
58
|
+
return /* @__PURE__ */ N("div", { ref: x, className: "relative", children: [
|
|
59
|
+
/* @__PURE__ */ w(
|
|
60
|
+
$,
|
|
38
61
|
{
|
|
39
|
-
name:
|
|
40
|
-
value:
|
|
41
|
-
onChange:
|
|
42
|
-
isDisabled:
|
|
43
|
-
placeholder:
|
|
44
|
-
cssStyle:
|
|
62
|
+
name: A,
|
|
63
|
+
value: u,
|
|
64
|
+
onChange: F,
|
|
65
|
+
isDisabled: g,
|
|
66
|
+
placeholder: I,
|
|
67
|
+
cssStyle: L,
|
|
68
|
+
role: "combobox",
|
|
69
|
+
ariaLabel: O,
|
|
70
|
+
ariaAutocomplete: "list",
|
|
71
|
+
ariaExpanded: c,
|
|
72
|
+
ariaControls: m,
|
|
73
|
+
ariaActivedescendant: c && i >= 0 ? b(i) : void 0,
|
|
74
|
+
onKeyDown: S
|
|
45
75
|
}
|
|
46
76
|
),
|
|
47
|
-
|
|
48
|
-
"
|
|
77
|
+
c && /* @__PURE__ */ w(
|
|
78
|
+
"div",
|
|
49
79
|
{
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
children: e
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
80
|
+
id: m,
|
|
81
|
+
role: "listbox",
|
|
82
|
+
className: "absolute top-[calc(100%-var(--sp-min,0.1875rem))] left-0 z-[2] max-h-[calc(var(--bv,0.375rem)*56)] min-w-full overflow-auto rounded-[var(--radius-small,0.1875rem)] bg-white py-[var(--sp-small,0.375rem)] shadow-[0_0_6px_#33333333]",
|
|
83
|
+
children: l.map((e, r) => /* @__PURE__ */ w(
|
|
84
|
+
"div",
|
|
85
|
+
{
|
|
86
|
+
id: b(r),
|
|
87
|
+
role: "option",
|
|
88
|
+
"aria-selected": r === i,
|
|
89
|
+
className: `block w-full cursor-pointer p-[var(--sp-medium,0.75rem)] text-left text-[length:var(--fs-small,0.6875rem)] text-[var(--link-color,#1c4ac9)] hover:bg-[var(--hover-color,#EEF7FB)] hover:transition-all hover:duration-100 ${r === i ? "bg-[var(--hover-color,#EEF7FB)]" : ""}`,
|
|
90
|
+
onPointerDown: (t) => {
|
|
91
|
+
t.preventDefault(), D(e);
|
|
92
|
+
},
|
|
93
|
+
onMouseEnter: () => n(r),
|
|
94
|
+
children: e.label
|
|
95
|
+
},
|
|
96
|
+
e.value
|
|
97
|
+
))
|
|
98
|
+
}
|
|
99
|
+
)
|
|
57
100
|
] });
|
|
58
101
|
}
|
|
59
102
|
export {
|
|
60
|
-
|
|
103
|
+
R as SearchableSelectBox
|
|
61
104
|
};
|
package/dist/components/TabUI.js
CHANGED
|
@@ -1,70 +1,71 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as I, jsx as
|
|
3
|
-
import { useState as
|
|
2
|
+
import { jsxs as I, jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import { useState as v, useRef as $, useId as w } from "react";
|
|
4
4
|
import { COLOR as T } from "@geckou/ui-core";
|
|
5
5
|
function C({
|
|
6
|
-
tabs:
|
|
7
|
-
color:
|
|
6
|
+
tabs: t,
|
|
7
|
+
color: r,
|
|
8
8
|
initialIndex: p = 0,
|
|
9
9
|
tabSlots: d,
|
|
10
10
|
panelSlots: y
|
|
11
11
|
}) {
|
|
12
|
-
const [
|
|
12
|
+
const [i, k] = v(
|
|
13
13
|
() => {
|
|
14
14
|
var e, n;
|
|
15
|
-
return ((e =
|
|
15
|
+
return ((e = t[p]) == null ? void 0 : e.key) ?? ((n = t[0]) == null ? void 0 : n.key) ?? "";
|
|
16
16
|
}
|
|
17
|
-
), s =
|
|
17
|
+
), s = $([]), u = w(), o = (e) => `${u}-tab-${e}`, f = (e) => `${u}-panel-${e}`, l = (e) => k(e), x = (e) => {
|
|
18
18
|
var n;
|
|
19
|
-
|
|
19
|
+
k(t[e].key), (n = s.current[e]) == null || n.focus();
|
|
20
20
|
}, h = (e) => {
|
|
21
21
|
if (e.key !== "ArrowLeft" && e.key !== "ArrowRight")
|
|
22
22
|
return;
|
|
23
|
-
const n =
|
|
23
|
+
const n = t.findIndex((g) => g.key === i);
|
|
24
24
|
if (n === -1)
|
|
25
25
|
return;
|
|
26
26
|
e.preventDefault();
|
|
27
|
-
const
|
|
28
|
-
e.key === "ArrowLeft" ?
|
|
29
|
-
},
|
|
30
|
-
"--active-color": (
|
|
31
|
-
"--background-color": (
|
|
27
|
+
const c = t.length - 1;
|
|
28
|
+
e.key === "ArrowLeft" ? x(n > 0 ? n - 1 : c) : x(n < c ? n + 1 : 0);
|
|
29
|
+
}, m = {
|
|
30
|
+
"--active-color": (r == null ? void 0 : r.active) || T.blue,
|
|
31
|
+
"--background-color": (r == null ? void 0 : r.background) || "transparent",
|
|
32
|
+
"--text-color": (r == null ? void 0 : r.text) || "inherit"
|
|
32
33
|
};
|
|
33
34
|
return /* @__PURE__ */ I("div", { children: [
|
|
34
|
-
/* @__PURE__ */
|
|
35
|
+
/* @__PURE__ */ a(
|
|
35
36
|
"div",
|
|
36
37
|
{
|
|
37
|
-
style:
|
|
38
|
+
style: m,
|
|
38
39
|
className: "flex bg-(--background-color)",
|
|
39
40
|
role: "tablist",
|
|
40
41
|
onKeyDown: h,
|
|
41
|
-
children:
|
|
42
|
+
children: t.map((e, n) => /* @__PURE__ */ a(
|
|
42
43
|
"button",
|
|
43
44
|
{
|
|
44
|
-
id:
|
|
45
|
-
ref: (
|
|
46
|
-
s.current[n] =
|
|
45
|
+
id: o(e.key),
|
|
46
|
+
ref: (c) => {
|
|
47
|
+
s.current[n] = c;
|
|
47
48
|
},
|
|
48
49
|
type: "button",
|
|
49
50
|
role: "tab",
|
|
50
51
|
"aria-controls": f(e.key),
|
|
51
|
-
"aria-selected":
|
|
52
|
-
tabIndex:
|
|
53
|
-
className: `border-none bg-transparent px-4 py-2 text-base ${
|
|
54
|
-
onClick: () =>
|
|
52
|
+
"aria-selected": i === e.key,
|
|
53
|
+
tabIndex: i === e.key ? 0 : -1,
|
|
54
|
+
className: `border-none bg-transparent px-4 py-2 text-base ${i === e.key ? "cursor-auto text-(--active-color)" : "cursor-pointer text-(--text-color)"}`,
|
|
55
|
+
onClick: () => l(e.key),
|
|
55
56
|
children: (d == null ? void 0 : d[e.key]) ?? e.label
|
|
56
57
|
},
|
|
57
58
|
e.key
|
|
58
59
|
))
|
|
59
60
|
}
|
|
60
61
|
),
|
|
61
|
-
|
|
62
|
+
t.map((e) => /* @__PURE__ */ a(
|
|
62
63
|
"div",
|
|
63
64
|
{
|
|
64
65
|
id: f(e.key),
|
|
65
66
|
role: "tabpanel",
|
|
66
|
-
"aria-labelledby":
|
|
67
|
-
hidden:
|
|
67
|
+
"aria-labelledby": o(e.key),
|
|
68
|
+
hidden: i !== e.key,
|
|
68
69
|
children: y == null ? void 0 : y[`${e.key}Contents`]
|
|
69
70
|
},
|
|
70
71
|
`${e.key}_panel`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { KeyboardEvent, ReactNode } from 'react';
|
|
2
2
|
import { InputBoxStyleForEachStatus, Validates } from '../types';
|
|
3
3
|
type InputValue = string | number;
|
|
4
4
|
type Props = {
|
|
@@ -15,6 +15,19 @@ type Props = {
|
|
|
15
15
|
validates?: Validates;
|
|
16
16
|
before?: ReactNode;
|
|
17
17
|
after?: ReactNode;
|
|
18
|
+
/** input の id。combobox のように外から参照する必要があるときに渡す */
|
|
19
|
+
id?: string;
|
|
20
|
+
/**
|
|
21
|
+
* input へそのまま渡す ARIA 属性とキー操作。
|
|
22
|
+
* SearchableSelectBox のような複合ウィジェットから使う(通常は指定しない)
|
|
23
|
+
*/
|
|
24
|
+
role?: string;
|
|
25
|
+
ariaLabel?: string;
|
|
26
|
+
ariaExpanded?: boolean;
|
|
27
|
+
ariaControls?: string;
|
|
28
|
+
ariaActivedescendant?: string;
|
|
29
|
+
ariaAutocomplete?: 'none' | 'inline' | 'list' | 'both';
|
|
30
|
+
onKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
18
31
|
};
|
|
19
|
-
export declare function TextBox({ name, value, onChange, cssStyle, inputType, placeholder, isDisabled, isRequired, maxLength, autocomplete, validates, before, after, }: Props): import("react").JSX.Element;
|
|
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;
|
|
20
33
|
export {};
|
|
@@ -1,83 +1,99 @@
|
|
|
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
|
|
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
8
|
name: v,
|
|
9
9
|
value: E,
|
|
10
10
|
onChange: t,
|
|
11
11
|
cssStyle: r,
|
|
12
12
|
inputType: V = "text",
|
|
13
|
-
placeholder:
|
|
13
|
+
placeholder: b = "入力してください",
|
|
14
14
|
isDisabled: l,
|
|
15
15
|
isRequired: f,
|
|
16
|
-
maxLength:
|
|
17
|
-
autocomplete:
|
|
18
|
-
validates:
|
|
19
|
-
before:
|
|
20
|
-
after: j
|
|
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
|
|
21
29
|
}) {
|
|
22
|
-
var
|
|
23
|
-
const [o,
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
|
|
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(() => {
|
|
27
35
|
if (!p.current) {
|
|
28
|
-
if (e ===
|
|
29
|
-
|
|
36
|
+
if (e === z.current) {
|
|
37
|
+
G(e) || a();
|
|
30
38
|
return;
|
|
31
39
|
}
|
|
32
40
|
p.current = !0;
|
|
33
41
|
}
|
|
34
|
-
|
|
42
|
+
a();
|
|
35
43
|
}, [e]);
|
|
36
44
|
const i = n(!1);
|
|
37
|
-
return /* @__PURE__ */
|
|
38
|
-
|
|
45
|
+
return /* @__PURE__ */ A(
|
|
46
|
+
O,
|
|
39
47
|
{
|
|
40
48
|
cssStyle: r,
|
|
41
49
|
className: "inline-flex [&>input]:flex-auto",
|
|
42
50
|
isErrored: !!o.length,
|
|
43
51
|
isDisabled: l,
|
|
44
52
|
children: [
|
|
45
|
-
|
|
46
|
-
/* @__PURE__ */
|
|
53
|
+
T,
|
|
54
|
+
/* @__PURE__ */ s(
|
|
47
55
|
"input",
|
|
48
56
|
{
|
|
49
57
|
type: V,
|
|
58
|
+
id: k,
|
|
50
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,
|
|
51
67
|
value: e,
|
|
52
68
|
required: f,
|
|
53
|
-
placeholder:
|
|
69
|
+
placeholder: b,
|
|
54
70
|
disabled: l,
|
|
55
|
-
autoComplete:
|
|
56
|
-
maxLength:
|
|
71
|
+
autoComplete: B,
|
|
72
|
+
maxLength: g,
|
|
57
73
|
"aria-invalid": o.length ? "true" : void 0,
|
|
58
|
-
onChange: (
|
|
59
|
-
const
|
|
74
|
+
onChange: (u) => {
|
|
75
|
+
const m = u.target.value;
|
|
60
76
|
t == null || t(
|
|
61
|
-
i.current ?
|
|
77
|
+
i.current ? m : x(m)
|
|
62
78
|
);
|
|
63
79
|
},
|
|
64
80
|
onCompositionStart: () => {
|
|
65
81
|
i.current = !0;
|
|
66
82
|
},
|
|
67
|
-
onCompositionEnd: (
|
|
68
|
-
i.current = !1, t == null || t(x(
|
|
83
|
+
onCompositionEnd: (u) => {
|
|
84
|
+
i.current = !1, t == null || t(x(u.currentTarget.value));
|
|
69
85
|
},
|
|
70
|
-
onBlur: () =>
|
|
86
|
+
onBlur: () => a()
|
|
71
87
|
}
|
|
72
88
|
),
|
|
73
89
|
j,
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
|
|
90
|
+
/* @__PURE__ */ s(
|
|
91
|
+
P,
|
|
76
92
|
{
|
|
77
93
|
errorMessages: o,
|
|
78
94
|
cssStyle: {
|
|
79
|
-
textColor: (
|
|
80
|
-
backgroundColor: (
|
|
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
|
|
81
97
|
}
|
|
82
98
|
}
|
|
83
99
|
)
|
|
@@ -86,5 +102,5 @@ function L({
|
|
|
86
102
|
);
|
|
87
103
|
}
|
|
88
104
|
export {
|
|
89
|
-
|
|
105
|
+
Z as TextBox
|
|
90
106
|
};
|
|
@@ -10,6 +10,9 @@ type Props = {
|
|
|
10
10
|
onChange?: (newValue: boolean) => void;
|
|
11
11
|
isDisabled?: boolean;
|
|
12
12
|
cssStyle?: StyleForEachStatus<ToggleStyle>;
|
|
13
|
+
/** アクセシブル名。可視ラベルがあるなら ariaLabelledBy でその要素を指すこと */
|
|
14
|
+
ariaLabel?: string;
|
|
15
|
+
ariaLabelledBy?: string;
|
|
13
16
|
};
|
|
14
|
-
export declare function ToggleButton({ name, label, checked, onChange, isDisabled, cssStyle, }: Props): import("react").JSX.Element;
|
|
17
|
+
export declare function ToggleButton({ name, label, checked, onChange, isDisabled, cssStyle, ariaLabel, ariaLabelledBy, }: Props): import("react").JSX.Element;
|
|
15
18
|
export {};
|