@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.
- package/README.md +22 -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 +86 -80
- 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/SearchableSelectBox.d.ts +2 -1
- package/dist/components/SearchableSelectBox.js +52 -45
- 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/package.json +2 -2
package/README.md
CHANGED
|
@@ -108,6 +108,28 @@ props は Vue 版(`@geckou/ui-vue`)と揃えている。`v-model` にあた
|
|
|
108
108
|
yarn workspace @geckou/ui-react test
|
|
109
109
|
```
|
|
110
110
|
|
|
111
|
+
## 0.7.0 の変更
|
|
112
|
+
|
|
113
|
+
- `CheckBox` / `LabeledCheckbox` に `value` を追加。`CheckBoxes` は各選択肢の
|
|
114
|
+
`value` を送信用の hidden へ渡すようになった。これまでは全て `value="on"` で、
|
|
115
|
+
ネイティブ送信(Server Actions / `<form action>`)でどれが選ばれたか区別できなかった
|
|
116
|
+
- `DatePicker` の年月日欄は**入力中にエラー文言を出さない**。判定は入力のたびに
|
|
117
|
+
更新し、文言は欄を離れた時点(blur)で出す。あわせて 1 桁の月・日は blur で
|
|
118
|
+
2 桁へ正規化する(「1」→「01」)
|
|
119
|
+
- `DatePicker` の年月日欄が不正なとき、送信値と `onChange` が空文字になる
|
|
120
|
+
(これまでは valid のときだけ更新していたため、画面と送信値が食い違っていた)
|
|
121
|
+
- `SelectBox` が `isDisabled` かつ値が `0` / `'NA'` のときにプレースホルダを
|
|
122
|
+
出す分岐を削除した。0 は正当な選択値として扱う
|
|
123
|
+
- `SelectBox` がエラー時に `InputBox` へ `isErrored` を渡し、`aria-invalid` を付ける
|
|
124
|
+
- `SearchableSelectBox` は `isDisabled` の選択肢を候補に出さず、確定後の入力欄には
|
|
125
|
+
`value` ではなく**ラベル**を表示する(通知は従来どおり `value`)。
|
|
126
|
+
`ariaLabelledBy` を追加(`TextBox` にも追加)
|
|
127
|
+
- `TextArea` の `autoAdjustHeight` が `box-sizing` を見て高さを補正する
|
|
128
|
+
(border-box のリセット CSS を当てた環境で 2rem 足りなかった)
|
|
129
|
+
- `DateRangePicker` は範囲の比較前に日付を正規化する
|
|
130
|
+
- `ErrorMessage` は同じ文言を複数受け取っても重複キーの警告を出さない
|
|
131
|
+
- `SlideDownUi` のトリガーが `<button>` の中に `<div>` を置かなくなった
|
|
132
|
+
|
|
111
133
|
## 0.6.0 の変更
|
|
112
134
|
|
|
113
135
|
- `ModalBox` を重ねたとき、Escape で閉じるのは**最前面の 1 枚だけ**になった
|
|
@@ -2,6 +2,12 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { CheckBoxStyleForEachStatus } from '../types';
|
|
3
3
|
type Props = {
|
|
4
4
|
name: string;
|
|
5
|
+
/**
|
|
6
|
+
* ネイティブ送信時の値。既定は 'on'(<input type="checkbox"> と同じ)。
|
|
7
|
+
* 同じ name を共有する複数のチェックボックスでは、これを指定しないと
|
|
8
|
+
* FormData からどれが選ばれたか区別できない
|
|
9
|
+
*/
|
|
10
|
+
value?: string | number;
|
|
5
11
|
checked?: boolean;
|
|
6
12
|
onChange?: (newValue: boolean) => void;
|
|
7
13
|
isDisabled?: boolean;
|
|
@@ -15,5 +21,5 @@ type Props = {
|
|
|
15
21
|
ariaLabel?: string;
|
|
16
22
|
ariaLabelledBy?: string;
|
|
17
23
|
};
|
|
18
|
-
export declare function CheckBox({ name, checked, onChange, isDisabled, cssStyle, isDisableAnimation, check, ariaLabel, ariaLabelledBy, }: Props): import("react").JSX.Element;
|
|
24
|
+
export declare function CheckBox({ name, value, checked, onChange, isDisabled, cssStyle, isDisableAnimation, check, ariaLabel, ariaLabelledBy, }: Props): import("react").JSX.Element;
|
|
19
25
|
export {};
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { CheckIcon as
|
|
2
|
+
import { jsxs as C, Fragment as _, jsx as i } from "react/jsx-runtime";
|
|
3
|
+
import { CheckIcon as g } from "./icons/CheckIcon.js";
|
|
4
4
|
import { COLOR as t } from "@geckou/ui-core";
|
|
5
|
-
function
|
|
5
|
+
function y({
|
|
6
6
|
name: l,
|
|
7
|
-
|
|
7
|
+
value: s,
|
|
8
|
+
checked: f,
|
|
8
9
|
onChange: c,
|
|
9
10
|
isDisabled: e,
|
|
10
11
|
cssStyle: r,
|
|
11
|
-
isDisableAnimation:
|
|
12
|
-
check:
|
|
13
|
-
ariaLabel:
|
|
12
|
+
isDisableAnimation: k,
|
|
13
|
+
check: p,
|
|
14
|
+
ariaLabel: h,
|
|
14
15
|
ariaLabelledBy: a
|
|
15
16
|
}) {
|
|
16
17
|
var n, u, b;
|
|
17
|
-
const o =
|
|
18
|
+
const o = f ?? !1, x = e ? r == null ? void 0 : r.disabled : r == null ? void 0 : r.default, d = {
|
|
18
19
|
textColor: e ? t.darkGray : t.blue,
|
|
19
20
|
backgroundColor: e ? t.lightGray : t.white,
|
|
20
21
|
border: {
|
|
@@ -22,44 +23,52 @@ function j({
|
|
|
22
23
|
size: "1px",
|
|
23
24
|
radius: ".25rem"
|
|
24
25
|
},
|
|
25
|
-
...
|
|
26
|
-
},
|
|
26
|
+
...x
|
|
27
|
+
}, m = {
|
|
27
28
|
"--text-color": d.textColor,
|
|
28
29
|
"--border-color": (n = d.border) == null ? void 0 : n.color,
|
|
29
30
|
"--border-size": (u = d.border) == null ? void 0 : u.size,
|
|
30
31
|
"--radius-size": (b = d.border) == null ? void 0 : b.radius,
|
|
31
32
|
"--background-color": d.backgroundColor,
|
|
32
|
-
"--duration":
|
|
33
|
+
"--duration": k ? "0s" : ".3s"
|
|
33
34
|
};
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
+
return /* @__PURE__ */ C(_, { children: [
|
|
35
36
|
/* @__PURE__ */ i("style", { children: "@keyframes uiCheckPop{0%{scale:1}10%{scale:.8}50%{scale:1.1}100%{scale:1}}" }),
|
|
36
37
|
/* @__PURE__ */ i(
|
|
37
38
|
"button",
|
|
38
39
|
{
|
|
39
40
|
type: "button",
|
|
40
|
-
style:
|
|
41
|
+
style: m,
|
|
41
42
|
role: "checkbox",
|
|
42
43
|
"aria-checked": o,
|
|
43
44
|
"data-checked": o,
|
|
44
45
|
"aria-labelledby": a,
|
|
45
|
-
"aria-label": a ? void 0 :
|
|
46
|
+
"aria-label": a ? void 0 : h ?? l,
|
|
46
47
|
disabled: e,
|
|
47
|
-
onClick: (
|
|
48
|
-
|
|
48
|
+
onClick: (v) => {
|
|
49
|
+
v.stopPropagation(), e || c == null || c(!o);
|
|
49
50
|
},
|
|
50
51
|
className: `relative flex h-6 w-6 cursor-pointer items-center justify-center rounded-(--radius-size) border-none shadow-[0_0_0_var(--border-size)_var(--border-color)_inset] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--border-color) disabled:pointer-events-none disabled:before:pointer-events-auto disabled:before:absolute disabled:before:inset-0 disabled:before:cursor-not-allowed disabled:before:content-[''] ${o ? "animate-[uiCheckPop_var(--duration)_ease-out] bg-(--border-color)" : "bg-(--background-color)"}`,
|
|
51
52
|
children: /* @__PURE__ */ i(
|
|
52
53
|
"div",
|
|
53
54
|
{
|
|
54
55
|
className: `flex h-4 w-4 items-center justify-center [&>*]:fill-current [&>*]:text-current ${o ? "text-(--background-color)" : "text-(--border-color)"}`,
|
|
55
|
-
children:
|
|
56
|
+
children: p ?? /* @__PURE__ */ i(g, {})
|
|
56
57
|
}
|
|
57
58
|
)
|
|
58
59
|
}
|
|
59
60
|
),
|
|
60
|
-
o && /* @__PURE__ */ i(
|
|
61
|
+
o && /* @__PURE__ */ i(
|
|
62
|
+
"input",
|
|
63
|
+
{
|
|
64
|
+
type: "hidden",
|
|
65
|
+
name: l,
|
|
66
|
+
value: s ?? "on",
|
|
67
|
+
disabled: e
|
|
68
|
+
}
|
|
69
|
+
)
|
|
61
70
|
] });
|
|
62
71
|
}
|
|
63
72
|
export {
|
|
64
|
-
|
|
73
|
+
y as CheckBox
|
|
65
74
|
};
|
|
@@ -1,55 +1,56 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as M, jsx as g } from "react/jsx-runtime";
|
|
3
|
-
import { COLOR as
|
|
4
|
-
import { useState as
|
|
3
|
+
import { COLOR as a, MESSAGES as V } from "@geckou/ui-core";
|
|
4
|
+
import { useState as b, useRef as w, useEffect as R } from "react";
|
|
5
5
|
import { LabeledCheckbox as j } from "./LabeledCheckbox.js";
|
|
6
6
|
import { ErrorMessage as L } from "./ErrorMessage.js";
|
|
7
7
|
function F({
|
|
8
|
-
name:
|
|
9
|
-
options:
|
|
10
|
-
value:
|
|
8
|
+
name: k,
|
|
9
|
+
options: u,
|
|
10
|
+
value: e,
|
|
11
11
|
onChange: s,
|
|
12
|
-
isDisabled:
|
|
12
|
+
isDisabled: p,
|
|
13
13
|
isRequired: C,
|
|
14
14
|
cssStyle: o
|
|
15
15
|
}) {
|
|
16
|
-
const [
|
|
17
|
-
C &&
|
|
16
|
+
const [i, d] = b(e ?? []), [f, h] = b(""), m = (r) => h(
|
|
17
|
+
C && r.length === 0 ? V.required : ""
|
|
18
18
|
), n = w(!0);
|
|
19
19
|
R(() => {
|
|
20
20
|
if (n.current) {
|
|
21
|
-
n.current = !1,
|
|
21
|
+
n.current = !1, e != null && e.length && m(e);
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
}, [
|
|
26
|
-
const E = (
|
|
27
|
-
const
|
|
28
|
-
(t) => t ===
|
|
24
|
+
e && d(e);
|
|
25
|
+
}, [e]);
|
|
26
|
+
const E = (r, l) => {
|
|
27
|
+
const c = u.map((t) => t.value).filter(
|
|
28
|
+
(t) => t === r ? l : i.includes(t)
|
|
29
29
|
);
|
|
30
|
-
d(
|
|
30
|
+
d(c), m(c), s == null || s(c);
|
|
31
31
|
}, x = {
|
|
32
32
|
...(o == null ? void 0 : o.error) ?? {},
|
|
33
|
-
textColor:
|
|
34
|
-
backgroundColor:
|
|
33
|
+
textColor: a.white,
|
|
34
|
+
backgroundColor: a.red,
|
|
35
35
|
border: {
|
|
36
|
-
color:
|
|
36
|
+
color: a.red,
|
|
37
37
|
size: "1px",
|
|
38
38
|
radius: ".25rem"
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
return /* @__PURE__ */ M("div", { className: "relative flex flex-wrap gap-x-6 gap-y-4", children: [
|
|
42
|
-
|
|
42
|
+
u.map((r) => /* @__PURE__ */ g(
|
|
43
43
|
j,
|
|
44
44
|
{
|
|
45
|
-
name:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
name: k,
|
|
46
|
+
value: r.value,
|
|
47
|
+
label: r.label,
|
|
48
|
+
checked: i.includes(r.value),
|
|
49
|
+
onChange: (l) => E(r.value, l),
|
|
50
|
+
isDisabled: p,
|
|
50
51
|
cssStyle: o
|
|
51
52
|
},
|
|
52
|
-
|
|
53
|
+
r.value
|
|
53
54
|
)),
|
|
54
55
|
/* @__PURE__ */ g(
|
|
55
56
|
L,
|
|
@@ -1,90 +1,93 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { formatDateValue as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { InputBox as
|
|
6
|
-
import { ErrorMessage as
|
|
7
|
-
import { CalendarIcon as
|
|
8
|
-
import { useRegisterValidation as
|
|
9
|
-
function
|
|
10
|
-
name:
|
|
2
|
+
import { jsxs as V, jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import { formatDateValue as w, splitDate as N, COLOR as H, MESSAGES as J, normalizeDateObject as K, composeDateValue as Q, validateDateObject as T } from "@geckou/ui-core";
|
|
4
|
+
import { useState as u, useRef as U, useEffect as W, useId as X } from "react";
|
|
5
|
+
import { InputBox as Y } from "./InputBox.js";
|
|
6
|
+
import { ErrorMessage as Z } from "./ErrorMessage.js";
|
|
7
|
+
import { CalendarIcon as _ } from "./icons/CalendarIcon.js";
|
|
8
|
+
import { useRegisterValidation as ee } from "../hooks/useFormValidation.js";
|
|
9
|
+
function ne({
|
|
10
|
+
name: f,
|
|
11
11
|
value: r,
|
|
12
12
|
onChange: s,
|
|
13
|
-
cssStyle:
|
|
14
|
-
isDisabled:
|
|
15
|
-
isRequired:
|
|
16
|
-
formValidationStore:
|
|
13
|
+
cssStyle: D,
|
|
14
|
+
isDisabled: l,
|
|
15
|
+
isRequired: v,
|
|
16
|
+
formValidationStore: M,
|
|
17
17
|
minDate: L = "",
|
|
18
|
-
maxDate:
|
|
18
|
+
maxDate: B = "",
|
|
19
19
|
size: P = "medium",
|
|
20
20
|
type: t = "date",
|
|
21
21
|
ariaLabel: A,
|
|
22
|
-
ariaLabelledBy:
|
|
22
|
+
ariaLabelledBy: b
|
|
23
23
|
}) {
|
|
24
|
-
const [
|
|
25
|
-
() => r ?
|
|
26
|
-
), [
|
|
27
|
-
() => r ? w(
|
|
28
|
-
), [
|
|
29
|
-
|
|
30
|
-
if (
|
|
24
|
+
const [h, x] = u(
|
|
25
|
+
() => r ? w(r, t) : ""
|
|
26
|
+
), [i, m] = u(
|
|
27
|
+
() => r ? N(w(r, t)) : { year: "", month: "", day: "" }
|
|
28
|
+
), [$, I] = u(""), [G, g] = u(!0), E = U(r);
|
|
29
|
+
W(() => {
|
|
30
|
+
if (E.current === r)
|
|
31
31
|
return;
|
|
32
|
-
|
|
33
|
-
const e = r ?
|
|
34
|
-
|
|
32
|
+
E.current = r;
|
|
33
|
+
const e = r ? w(r, t) : "";
|
|
34
|
+
x(e), m(N(e)), g(!0);
|
|
35
35
|
}, [r, t]);
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
const { message:
|
|
39
|
-
|
|
40
|
-
},
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
36
|
+
const S = (e) => !e && v ? { isValid: !1, message: J.required } : { isValid: !0, message: "" }, R = (e) => T(e, { type: t, isRequired: v }), q = (e) => {
|
|
37
|
+
x(e), m(N(e));
|
|
38
|
+
const { message: n } = S(e);
|
|
39
|
+
I(n), g(!0), s == null || s(e);
|
|
40
|
+
}, z = (e, n) => {
|
|
41
|
+
const { isValid: o, message: F } = R(e);
|
|
42
|
+
g(o), I(n ? F : "");
|
|
43
|
+
const y = o ? Q(e, t) : "";
|
|
44
|
+
y !== h && (x(y), s == null || s(y));
|
|
45
|
+
}, j = (e, n) => {
|
|
46
|
+
const o = { ...i, [e]: n };
|
|
47
|
+
m(o), z(o, !1);
|
|
48
|
+
}, k = () => {
|
|
49
|
+
const e = K(i);
|
|
50
|
+
m(e), z(e, !0);
|
|
48
51
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
ee(
|
|
53
|
+
M,
|
|
54
|
+
f,
|
|
55
|
+
S(h).isValid && G
|
|
53
56
|
);
|
|
54
|
-
const
|
|
55
|
-
return /* @__PURE__ */
|
|
56
|
-
|
|
57
|
+
const c = X(), d = (e) => b ? { "aria-labelledby": `${b} ${c}-${e}` } : { "aria-label": `${A ?? f}の${e}` }, p = P === "small", O = `flex-none! ${p ? "px-[var(--sp-small,0.375rem)]! py-[var(--sp-min,0.1875rem)]! text-[length:var(--fs-small,0.6875rem)]" : "p-[var(--sp-medium,0.75rem)]!"}`, C = { "--icon-color": H.blue };
|
|
58
|
+
return /* @__PURE__ */ V(
|
|
59
|
+
Y,
|
|
57
60
|
{
|
|
58
|
-
cssStyle:
|
|
59
|
-
isDisabled:
|
|
60
|
-
isErrored:
|
|
61
|
-
className: `flex w-full items-center leading-none ${
|
|
61
|
+
cssStyle: D,
|
|
62
|
+
isDisabled: l,
|
|
63
|
+
isErrored: !!$,
|
|
64
|
+
className: `flex w-full items-center leading-none ${p ? "h-[calc(var(--bv,0.375rem)*5)] px-[var(--sp-min,0.1875rem)]" : "h-[calc(var(--bv,0.375rem)*6)] px-[var(--sp-small,0.375rem)]"}`,
|
|
62
65
|
children: [
|
|
63
|
-
/* @__PURE__ */
|
|
66
|
+
/* @__PURE__ */ V(
|
|
64
67
|
"div",
|
|
65
68
|
{
|
|
66
69
|
className: "relative flex-none rounded-[var(--radius-small,0.1875rem)] has-[input:focus-visible]:outline-2 has-[input:focus-visible]:outline-offset-2 has-[input:focus-visible]:outline-(--icon-color)",
|
|
67
70
|
style: C,
|
|
68
71
|
children: [
|
|
69
72
|
/* @__PURE__ */ a(
|
|
70
|
-
|
|
73
|
+
_,
|
|
71
74
|
{
|
|
72
|
-
className: `pointer-events-none absolute inset-y-0 left-[var(--sp-small,0.375rem)] m-auto fill-(--icon-color) ${
|
|
75
|
+
className: `pointer-events-none absolute inset-y-0 left-[var(--sp-small,0.375rem)] m-auto fill-(--icon-color) ${p ? "size-[var(--icon-small,0.9375rem)]" : "size-[var(--icon-medium,1.125rem)]"}`
|
|
73
76
|
}
|
|
74
77
|
),
|
|
75
78
|
/* @__PURE__ */ a(
|
|
76
79
|
"input",
|
|
77
80
|
{
|
|
78
81
|
type: t,
|
|
79
|
-
name:
|
|
80
|
-
value:
|
|
81
|
-
...
|
|
82
|
-
max:
|
|
82
|
+
name: f,
|
|
83
|
+
value: h,
|
|
84
|
+
...d("カレンダー"),
|
|
85
|
+
max: B,
|
|
83
86
|
min: L,
|
|
84
|
-
required:
|
|
85
|
-
disabled:
|
|
87
|
+
required: v,
|
|
88
|
+
disabled: l,
|
|
86
89
|
onChange: (e) => q(e.target.value),
|
|
87
|
-
className: `w-[calc(var(--icon-medium,1.125rem)+var(--sp-small,0.375rem)*2)]! cursor-pointer px-[var(--sp-small,0.375rem)]! opacity-0 [&::-webkit-calendar-picker-indicator]:absolute [&::-webkit-calendar-picker-indicator]:left-0 [&::-webkit-calendar-picker-indicator]:h-full [&::-webkit-calendar-picker-indicator]:w-full [&::-webkit-calendar-picker-indicator]:cursor-pointer [&::-webkit-calendar-picker-indicator]:opacity-0 ${
|
|
90
|
+
className: `w-[calc(var(--icon-medium,1.125rem)+var(--sp-small,0.375rem)*2)]! cursor-pointer px-[var(--sp-small,0.375rem)]! opacity-0 [&::-webkit-calendar-picker-indicator]:absolute [&::-webkit-calendar-picker-indicator]:left-0 [&::-webkit-calendar-picker-indicator]:h-full [&::-webkit-calendar-picker-indicator]:w-full [&::-webkit-calendar-picker-indicator]:cursor-pointer [&::-webkit-calendar-picker-indicator]:opacity-0 ${p ? "py-[var(--sp-min,0.1875rem)]!" : "py-[var(--sp-medium,0.75rem)]!"}`
|
|
88
91
|
}
|
|
89
92
|
)
|
|
90
93
|
]
|
|
@@ -93,55 +96,58 @@ function le({
|
|
|
93
96
|
/* @__PURE__ */ a(
|
|
94
97
|
"input",
|
|
95
98
|
{
|
|
96
|
-
value:
|
|
99
|
+
value: i.year,
|
|
97
100
|
placeholder: "年",
|
|
98
|
-
...
|
|
101
|
+
...d("年"),
|
|
99
102
|
maxLength: 4,
|
|
100
103
|
type: "text",
|
|
101
|
-
disabled:
|
|
102
|
-
onChange: (e) =>
|
|
103
|
-
|
|
104
|
+
disabled: l,
|
|
105
|
+
onChange: (e) => j("year", e.target.value),
|
|
106
|
+
onBlur: k,
|
|
107
|
+
className: `w-[calc(var(--sp-medium,0.75rem)*2+5ch)]! ${O}`
|
|
104
108
|
}
|
|
105
109
|
),
|
|
106
110
|
"/",
|
|
107
111
|
/* @__PURE__ */ a(
|
|
108
112
|
"input",
|
|
109
113
|
{
|
|
110
|
-
value:
|
|
114
|
+
value: i.month,
|
|
111
115
|
placeholder: "月",
|
|
112
|
-
...
|
|
116
|
+
...d("月"),
|
|
113
117
|
maxLength: 2,
|
|
114
118
|
type: "text",
|
|
115
|
-
disabled:
|
|
116
|
-
onChange: (e) =>
|
|
117
|
-
|
|
119
|
+
disabled: l,
|
|
120
|
+
onChange: (e) => j("month", e.target.value),
|
|
121
|
+
onBlur: k,
|
|
122
|
+
className: `w-[calc(var(--sp-medium,0.75rem)*2+3ch)]! ${O}`
|
|
118
123
|
}
|
|
119
124
|
),
|
|
120
125
|
t === "date" && /* @__PURE__ */ a("span", { children: "/" }),
|
|
121
126
|
t === "date" && /* @__PURE__ */ a(
|
|
122
127
|
"input",
|
|
123
128
|
{
|
|
124
|
-
value:
|
|
129
|
+
value: i.day,
|
|
125
130
|
placeholder: "日",
|
|
126
|
-
...
|
|
131
|
+
...d("日"),
|
|
127
132
|
maxLength: 2,
|
|
128
133
|
type: "text",
|
|
129
|
-
disabled:
|
|
130
|
-
onChange: (e) =>
|
|
131
|
-
|
|
134
|
+
disabled: l,
|
|
135
|
+
onChange: (e) => j("day", e.target.value),
|
|
136
|
+
onBlur: k,
|
|
137
|
+
className: `w-[calc(var(--sp-medium,0.75rem)*2+3ch)]! ${O}`
|
|
132
138
|
}
|
|
133
139
|
),
|
|
134
|
-
|
|
135
|
-
/* @__PURE__ */ a("span", { id: `${
|
|
136
|
-
/* @__PURE__ */ a("span", { id: `${
|
|
137
|
-
/* @__PURE__ */ a("span", { id: `${
|
|
138
|
-
/* @__PURE__ */ a("span", { id: `${
|
|
140
|
+
b && /* @__PURE__ */ V("span", { className: "sr-only", children: [
|
|
141
|
+
/* @__PURE__ */ a("span", { id: `${c}-カレンダー`, children: "のカレンダー" }),
|
|
142
|
+
/* @__PURE__ */ a("span", { id: `${c}-年`, children: "の年" }),
|
|
143
|
+
/* @__PURE__ */ a("span", { id: `${c}-月`, children: "の月" }),
|
|
144
|
+
/* @__PURE__ */ a("span", { id: `${c}-日`, children: "の日" })
|
|
139
145
|
] }),
|
|
140
|
-
/* @__PURE__ */ a(
|
|
146
|
+
/* @__PURE__ */ a(Z, { errorMessages: $ ? [$] : void 0 })
|
|
141
147
|
]
|
|
142
148
|
}
|
|
143
149
|
);
|
|
144
150
|
}
|
|
145
151
|
export {
|
|
146
|
-
|
|
152
|
+
ne as DatePicker
|
|
147
153
|
};
|
|
@@ -1,75 +1,75 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { COLOR as
|
|
4
|
-
import { DatePicker as
|
|
5
|
-
import { ErrorMessage as
|
|
6
|
-
import { useRegisterValidation as
|
|
7
|
-
const
|
|
8
|
-
function
|
|
2
|
+
import { jsxs as u, jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import { formatDateValue as E, COLOR as x, MESSAGES as p } from "@geckou/ui-core";
|
|
4
|
+
import { DatePicker as v } from "./DatePicker.js";
|
|
5
|
+
import { ErrorMessage as M } from "./ErrorMessage.js";
|
|
6
|
+
import { useRegisterValidation as N } from "../hooks/useFormValidation.js";
|
|
7
|
+
const S = { start: "", end: "" };
|
|
8
|
+
function G({
|
|
9
9
|
name: d,
|
|
10
|
-
value: r =
|
|
10
|
+
value: r = S,
|
|
11
11
|
onChange: e,
|
|
12
|
-
isDisabled:
|
|
13
|
-
isRequired:
|
|
14
|
-
formValidationStore:
|
|
15
|
-
minDate:
|
|
16
|
-
maxDate:
|
|
17
|
-
size:
|
|
18
|
-
type:
|
|
12
|
+
isDisabled: l,
|
|
13
|
+
isRequired: i,
|
|
14
|
+
formValidationStore: n,
|
|
15
|
+
minDate: m = "",
|
|
16
|
+
maxDate: f = "",
|
|
17
|
+
size: b = "medium",
|
|
18
|
+
type: t = "date"
|
|
19
19
|
}) {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
"--range-background-color":
|
|
24
|
-
"--range-border-color":
|
|
20
|
+
const s = E(r.start, t), o = E(r.end, t), g = !(s && o && s > o);
|
|
21
|
+
N(n, `${d}Range`, g);
|
|
22
|
+
const h = (c) => e == null ? void 0 : e({ start: c, end: r.end }), R = (c) => e == null ? void 0 : e({ start: r.start, end: c }), k = {
|
|
23
|
+
"--range-background-color": x.white,
|
|
24
|
+
"--range-border-color": x.gray
|
|
25
25
|
};
|
|
26
26
|
return (
|
|
27
27
|
// 角丸・区切り線は :first-child / :last-child で割り当てるため、
|
|
28
28
|
// ErrorMessage を同じ階層に置くとエラー表示時だけ枠の見た目が変わる。
|
|
29
29
|
// 入力群を内側にまとめ、ErrorMessage は外側(relative)に置く
|
|
30
|
-
/* @__PURE__ */
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
|
|
30
|
+
/* @__PURE__ */ u("div", { style: k, className: "relative", children: [
|
|
31
|
+
/* @__PURE__ */ u("div", { className: "flex bg-(--range-background-color) [&>*]:flex-auto [&>*]:rounded-none! [&>*:first-child]:rounded-s-[calc(var(--bv,0.375rem)/2)]! [&>*:last-child]:rounded-e-[calc(var(--bv,0.375rem)/2)]! [&>*:not(:last-child)]:border-e [&>*:not(:last-child)]:border-(--range-border-color)", children: [
|
|
32
|
+
/* @__PURE__ */ a(
|
|
33
|
+
v,
|
|
34
34
|
{
|
|
35
35
|
name: `${d}Start`,
|
|
36
36
|
value: r.start,
|
|
37
|
-
isDisabled:
|
|
38
|
-
isRequired:
|
|
39
|
-
formValidationStore:
|
|
40
|
-
minDate:
|
|
41
|
-
maxDate:
|
|
42
|
-
size:
|
|
43
|
-
type:
|
|
44
|
-
onChange:
|
|
37
|
+
isDisabled: l,
|
|
38
|
+
isRequired: i,
|
|
39
|
+
formValidationStore: n,
|
|
40
|
+
minDate: m,
|
|
41
|
+
maxDate: o || f,
|
|
42
|
+
size: b,
|
|
43
|
+
type: t,
|
|
44
|
+
onChange: h
|
|
45
45
|
}
|
|
46
46
|
),
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
|
|
47
|
+
/* @__PURE__ */ a("div", { className: "flex flex-none! items-center px-[var(--bv,0.375rem)]", children: "〜" }),
|
|
48
|
+
/* @__PURE__ */ a(
|
|
49
|
+
v,
|
|
50
50
|
{
|
|
51
51
|
name: `${d}End`,
|
|
52
52
|
value: r.end,
|
|
53
|
-
isDisabled:
|
|
54
|
-
isRequired:
|
|
55
|
-
formValidationStore:
|
|
56
|
-
minDate:
|
|
57
|
-
maxDate:
|
|
58
|
-
size:
|
|
59
|
-
type:
|
|
60
|
-
onChange:
|
|
53
|
+
isDisabled: l,
|
|
54
|
+
isRequired: i,
|
|
55
|
+
formValidationStore: n,
|
|
56
|
+
minDate: s || m,
|
|
57
|
+
maxDate: f,
|
|
58
|
+
size: b,
|
|
59
|
+
type: t,
|
|
60
|
+
onChange: R
|
|
61
61
|
}
|
|
62
62
|
)
|
|
63
63
|
] }),
|
|
64
|
-
/* @__PURE__ */
|
|
65
|
-
|
|
64
|
+
/* @__PURE__ */ a(
|
|
65
|
+
M,
|
|
66
66
|
{
|
|
67
|
-
errorMessages:
|
|
67
|
+
errorMessages: g ? void 0 : [p.startAfterEnd]
|
|
68
68
|
}
|
|
69
69
|
)
|
|
70
70
|
] })
|
|
71
71
|
);
|
|
72
72
|
}
|
|
73
73
|
export {
|
|
74
|
-
|
|
74
|
+
G as DateRangePicker
|
|
75
75
|
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { COLOR as
|
|
3
|
-
function
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { COLOR as n } from "@geckou/ui-core";
|
|
3
|
+
function m({ errorMessages: o, cssStyle: r }) {
|
|
4
4
|
if (!o || !o.length)
|
|
5
5
|
return null;
|
|
6
|
-
const
|
|
7
|
-
"--error-text-color": (r == null ? void 0 : r.textColor) ||
|
|
8
|
-
"--error-background-color": (r == null ? void 0 : r.backgroundColor) ||
|
|
6
|
+
const t = {
|
|
7
|
+
"--error-text-color": (r == null ? void 0 : r.textColor) || n.white,
|
|
8
|
+
"--error-background-color": (r == null ? void 0 : r.backgroundColor) || n.red
|
|
9
9
|
};
|
|
10
|
-
return /* @__PURE__ */
|
|
10
|
+
return /* @__PURE__ */ e(
|
|
11
11
|
"div",
|
|
12
12
|
{
|
|
13
13
|
role: "alert",
|
|
14
14
|
className: "absolute top-[calc(100%+0.25rem)] flex w-max flex-col gap-2 rounded-sm bg-(--error-background-color) px-3 py-2 text-sm leading-none text-(--error-text-color) shadow-[0_0_0.5rem_0.25rem_#33333322] before:absolute before:bottom-[calc(100%-1px)] before:left-[0.85rem] before:block before:h-[0.53rem] before:w-[0.85rem] before:bg-(--error-background-color) before:content-[''] before:[clip-path:polygon(50%_0%,100%_100%,0%_100%)]",
|
|
15
|
-
style:
|
|
16
|
-
children: o.map((
|
|
15
|
+
style: t,
|
|
16
|
+
children: o.map((b, l) => /* @__PURE__ */ e("span", { children: b }, l))
|
|
17
17
|
}
|
|
18
18
|
);
|
|
19
19
|
}
|
|
20
20
|
export {
|
|
21
|
-
|
|
21
|
+
m as ErrorMessage
|
|
22
22
|
};
|
|
@@ -2,11 +2,13 @@ import { CheckBoxStyleForEachStatus } from '../types';
|
|
|
2
2
|
type Props = {
|
|
3
3
|
name: string;
|
|
4
4
|
label: string;
|
|
5
|
+
/** ネイティブ送信時の値(→ CheckBox の value) */
|
|
6
|
+
value?: string | number;
|
|
5
7
|
checked?: boolean;
|
|
6
8
|
onChange?: (newValue: boolean) => void;
|
|
7
9
|
isDisabled?: boolean;
|
|
8
10
|
cssStyle?: CheckBoxStyleForEachStatus;
|
|
9
11
|
isDisableAnimation?: boolean;
|
|
10
12
|
};
|
|
11
|
-
export declare function LabeledCheckbox({ name, label, checked, onChange, isDisabled, cssStyle, isDisableAnimation, }: Props): import("react").JSX.Element;
|
|
13
|
+
export declare function LabeledCheckbox({ name, label, value, checked, onChange, isDisabled, cssStyle, isDisableAnimation, }: Props): import("react").JSX.Element;
|
|
12
14
|
export {};
|