@geckou/ui-react 0.3.0 → 0.4.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 CHANGED
@@ -98,6 +98,18 @@ props は Vue 版(`@geckou/ui-vue`)と揃えている。`v-model` にあた
98
98
  yarn workspace @geckou/ui-react test
99
99
  ```
100
100
 
101
+ ## 0.4.0 の変更
102
+
103
+ - `RadioButtons` が必須エラー(「必須項目です」)を描画する。Vue 版と同じく、
104
+ 値が空へ変化したときに出る
105
+ - `CheckBox` / `ToggleButton` のロールが `aria-pressed` から
106
+ `role="checkbox" + aria-checked` / `role="switch" + aria-checked` に変わった。
107
+ アクセシブル名は `ariaLabel` / `ariaLabelledBy` で渡せる(未指定なら従来どおり `name`)
108
+ - `DateSelector` に `minYear` / `maxYear` を追加(既定は従来どおり「今年 -100 〜 今年 -14」)
109
+ - `DateRangePicker` が範囲(開始 > 終了)を検証し、`<name>Range` という名前で
110
+ `FormValidationStore` に登録する。`invalidNames` を見ている場合は増える
111
+ - `TabUI` の `color.text` を配線した
112
+
101
113
  ## License
102
114
 
103
115
  [MIT](../../LICENSE)
@@ -8,6 +8,12 @@ type Props = {
8
8
  cssStyle?: CheckBoxStyleForEachStatus;
9
9
  isDisableAnimation?: boolean;
10
10
  check?: ReactNode;
11
+ /**
12
+ * アクセシブル名。可視ラベルがあるなら ariaLabelledBy でその要素を指すこと。
13
+ * どちらも無いときだけ name を名前として使う(機械名でも無いよりはマシ)
14
+ */
15
+ ariaLabel?: string;
16
+ ariaLabelledBy?: string;
11
17
  };
12
- export declare function CheckBox({ name, checked, onChange, isDisabled, cssStyle, isDisableAnimation, check, }: Props): import("react").JSX.Element;
18
+ export declare function CheckBox({ name, checked, onChange, isDisabled, cssStyle, isDisableAnimation, check, ariaLabel, ariaLabelledBy, }: Props): import("react").JSX.Element;
13
19
  export {};
@@ -1,18 +1,20 @@
1
1
  "use client";
2
- import { jsxs as b, Fragment as x, jsx as c } from "react/jsx-runtime";
3
- import { CheckIcon as v } from "./icons/CheckIcon.js";
2
+ import { jsxs as f, Fragment as _, jsx as d } from "react/jsx-runtime";
3
+ import { CheckIcon as z } from "./icons/CheckIcon.js";
4
4
  import { COLOR as t } from "@geckou/ui-core";
5
- function j({
5
+ function g({
6
6
  name: l,
7
- checked: f,
7
+ checked: p,
8
8
  onChange: r,
9
9
  isDisabled: e,
10
10
  cssStyle: o,
11
- isDisableAnimation: p,
12
- check: k
11
+ isDisableAnimation: k,
12
+ check: h,
13
+ ariaLabel: x,
14
+ ariaLabelledBy: u
13
15
  }) {
14
- var u, s, n;
15
- const i = f ?? !1, h = e ? o == null ? void 0 : o.disabled : o == null ? void 0 : o.default, d = {
16
+ var n, s, b;
17
+ const i = p ?? !1, m = e ? o == null ? void 0 : o.disabled : o == null ? void 0 : o.default, c = {
16
18
  textColor: e ? t.darkGray : t.blue,
17
19
  backgroundColor: e ? t.lightGray : t.white,
18
20
  border: {
@@ -20,31 +22,33 @@ function j({
20
22
  size: "1px",
21
23
  radius: ".25rem"
22
24
  },
23
- ...h
24
- }, m = {
25
- "--text-color": d.textColor,
26
- "--border-color": (u = d.border) == null ? void 0 : u.color,
27
- "--border-size": (s = d.border) == null ? void 0 : s.size,
28
- "--radius-size": (n = d.border) == null ? void 0 : n.radius,
29
- "--background-color": d.backgroundColor,
30
- "--duration": p ? "0s" : ".3s"
25
+ ...m
26
+ }, v = {
27
+ "--text-color": c.textColor,
28
+ "--border-color": (n = c.border) == null ? void 0 : n.color,
29
+ "--border-size": (s = c.border) == null ? void 0 : s.size,
30
+ "--radius-size": (b = c.border) == null ? void 0 : b.radius,
31
+ "--background-color": c.backgroundColor,
32
+ "--duration": k ? "0s" : ".3s"
31
33
  };
32
- return /* @__PURE__ */ b(x, { children: [
33
- /* @__PURE__ */ c("style", { children: "@keyframes uiCheckPop{0%{scale:1}10%{scale:.8}50%{scale:1.1}100%{scale:1}}" }),
34
- /* @__PURE__ */ b(
34
+ return /* @__PURE__ */ f(_, { children: [
35
+ /* @__PURE__ */ d("style", { children: "@keyframes uiCheckPop{0%{scale:1}10%{scale:.8}50%{scale:1.1}100%{scale:1}}" }),
36
+ /* @__PURE__ */ f(
35
37
  "button",
36
38
  {
37
39
  type: "button",
38
- style: m,
39
- "aria-label": l,
40
- "aria-pressed": i,
40
+ style: v,
41
+ role: "checkbox",
42
+ "aria-checked": i,
43
+ "aria-labelledby": u,
44
+ "aria-label": u ? void 0 : x ?? l,
41
45
  disabled: e,
42
46
  onClick: (a) => {
43
47
  a.stopPropagation(), e || r == null || r(!i);
44
48
  },
45
49
  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) has-[input:disabled]:pointer-events-none has-[input:disabled]:before:pointer-events-auto has-[input:disabled]:before:absolute has-[input:disabled]:before:inset-0 has-[input:disabled]:before:cursor-not-allowed has-[input:disabled]:before:content-[''] ${i ? "animate-[uiCheckPop_var(--duration)_ease-out] bg-(--border-color)" : "bg-(--background-color)"}`,
46
50
  children: [
47
- /* @__PURE__ */ c(
51
+ /* @__PURE__ */ d(
48
52
  "input",
49
53
  {
50
54
  type: "checkbox",
@@ -57,11 +61,11 @@ function j({
57
61
  className: "hidden"
58
62
  }
59
63
  ),
60
- /* @__PURE__ */ c(
64
+ /* @__PURE__ */ d(
61
65
  "div",
62
66
  {
63
67
  className: `flex h-4 w-4 items-center justify-center [&>*]:fill-current [&>*]:text-current ${i ? "text-(--background-color)" : "text-(--border-color)"}`,
64
- children: k ?? /* @__PURE__ */ c(v, {})
68
+ children: h ?? /* @__PURE__ */ d(z, {})
65
69
  }
66
70
  )
67
71
  ]
@@ -70,5 +74,5 @@ function j({
70
74
  ] });
71
75
  }
72
76
  export {
73
- j as CheckBox
77
+ g as CheckBox
74
78
  };
@@ -1,66 +1,66 @@
1
1
  "use client";
2
- import { jsxs as V, jsx as t } from "react/jsx-runtime";
3
- import { formatDateValue as b, splitDate as h, COLOR as A, MESSAGES as B, composeDateValue as G, validateDateObject as R } from "@geckou/ui-core";
4
- import { useState as g, useRef as q, useEffect as C } from "react";
5
- import { InputBox as F } from "./InputBox.js";
6
- import { ErrorMessage as H } from "./ErrorMessage.js";
7
- import { CalendarIcon as J } from "./icons/CalendarIcon.js";
8
- import { useRegisterValidation as K } from "../hooks/useFormValidation.js";
9
- function _({
2
+ import { jsxs as N, jsx as t } from "react/jsx-runtime";
3
+ import { formatDateValue as g, splitDate as k, COLOR as G, MESSAGES as R, composeDateValue as q, validateDateObject as C } from "@geckou/ui-core";
4
+ import { useState as o, useRef as F, useEffect as H } from "react";
5
+ import { InputBox as J } from "./InputBox.js";
6
+ import { ErrorMessage as K } from "./ErrorMessage.js";
7
+ import { CalendarIcon as Q } from "./icons/CalendarIcon.js";
8
+ import { useRegisterValidation as T } from "../hooks/useFormValidation.js";
9
+ function ae({
10
10
  name: l,
11
11
  value: a,
12
12
  onChange: s,
13
- cssStyle: N,
13
+ cssStyle: E,
14
14
  isDisabled: i,
15
- isRequired: o,
16
- formValidationStore: O,
17
- minDate: E = "",
18
- maxDate: S = "",
19
- size: M = "medium",
15
+ isRequired: n,
16
+ formValidationStore: S,
17
+ minDate: I = "",
18
+ maxDate: M = "",
19
+ size: D = "medium",
20
20
  type: r = "date"
21
21
  }) {
22
- const [k, n] = g(
23
- () => a ? b(a, r) : ""
24
- ), [c, d] = g(
25
- () => a ? h(b(a, r)) : { year: "", month: "", day: "" }
26
- ), [p, $] = g(""), w = q(a);
27
- C(() => {
28
- if (w.current === a)
22
+ const [j, d] = o(
23
+ () => a ? g(a, r) : ""
24
+ ), [c, p] = o(
25
+ () => a ? k(g(a, r)) : { year: "", month: "", day: "" }
26
+ ), [u, V] = o(""), [L, f] = o(!0), $ = F(a);
27
+ H(() => {
28
+ if ($.current === a)
29
29
  return;
30
- w.current = a;
31
- const e = a ? b(a, r) : "";
32
- n(e), d(h(e));
30
+ $.current = a;
31
+ const e = a ? g(a, r) : "";
32
+ d(e), p(k(e)), f(!0);
33
33
  }, [a, r]);
34
- const y = (e) => !e && o ? { isValid: !1, message: B.required } : { isValid: !0, message: "" }, D = (e) => R(e, { type: r, isRequired: o }), I = (e) => {
35
- n(e), d(h(e));
36
- const { message: v } = y(e);
37
- $(v), s == null || s(e);
38
- }, u = (e, v) => {
39
- const x = { ...c, [e]: v };
40
- d(x);
41
- const { isValid: z, message: P } = D(x);
42
- if ($(P), z) {
43
- const j = G(x, r);
44
- n(j), s == null || s(j);
34
+ const w = (e) => !e && n ? { isValid: !1, message: R.required } : { isValid: !0, message: "" }, z = (e) => C(e, { type: r, isRequired: n }), P = (e) => {
35
+ d(e), p(k(e));
36
+ const { message: x } = w(e);
37
+ V(x), f(!0), s == null || s(e);
38
+ }, v = (e, x) => {
39
+ const h = { ...c, [e]: x };
40
+ p(h);
41
+ const { isValid: y, message: B } = z(h);
42
+ if (V(B), f(y), y) {
43
+ const O = q(h, r);
44
+ d(O), s == null || s(O);
45
45
  }
46
46
  };
47
- K(
48
- O,
47
+ T(
48
+ S,
49
49
  l,
50
- y(k).isValid
50
+ w(j).isValid && L
51
51
  );
52
- const m = M === "small", f = `flex-none! ${m ? "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)]!"}`, L = { "--icon-color": A.blue };
53
- return /* @__PURE__ */ V(
54
- F,
52
+ const m = D === "small", b = `flex-none! ${m ? "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)]!"}`, A = { "--icon-color": G.blue };
53
+ return /* @__PURE__ */ N(
54
+ J,
55
55
  {
56
- cssStyle: N,
56
+ cssStyle: E,
57
57
  isDisabled: i,
58
- isErrored: !!p,
58
+ isErrored: !!u,
59
59
  className: `flex w-full items-center leading-none ${m ? "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)]"}`,
60
60
  children: [
61
- /* @__PURE__ */ V("div", { className: "relative flex-none", style: L, children: [
61
+ /* @__PURE__ */ N("div", { className: "relative flex-none", style: A, children: [
62
62
  /* @__PURE__ */ t(
63
- J,
63
+ Q,
64
64
  {
65
65
  className: `pointer-events-none absolute inset-y-0 left-[var(--sp-small,0.375rem)] m-auto fill-(--icon-color) ${m ? "size-[var(--icon-small,0.9375rem)]" : "size-[var(--icon-medium,1.125rem)]"}`
66
66
  }
@@ -70,12 +70,12 @@ function _({
70
70
  {
71
71
  type: r,
72
72
  name: l,
73
- value: k,
74
- max: S,
75
- min: E,
76
- required: o,
73
+ value: j,
74
+ max: M,
75
+ min: I,
76
+ required: n,
77
77
  disabled: i,
78
- onChange: (e) => I(e.target.value),
78
+ onChange: (e) => P(e.target.value),
79
79
  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 ${m ? "py-[var(--sp-min,0.1875rem)]!" : "py-[var(--sp-medium,0.75rem)]!"}`
80
80
  }
81
81
  )
@@ -89,8 +89,8 @@ function _({
89
89
  maxLength: 4,
90
90
  type: "text",
91
91
  disabled: i,
92
- onChange: (e) => u("year", e.target.value),
93
- className: `w-[calc(var(--sp-medium,0.75rem)*2+5ch)]! ${f}`
92
+ onChange: (e) => v("year", e.target.value),
93
+ className: `w-[calc(var(--sp-medium,0.75rem)*2+5ch)]! ${b}`
94
94
  }
95
95
  ),
96
96
  "/",
@@ -103,8 +103,8 @@ function _({
103
103
  maxLength: 2,
104
104
  type: "text",
105
105
  disabled: i,
106
- onChange: (e) => u("month", e.target.value),
107
- className: `w-[calc(var(--sp-medium,0.75rem)*2+3ch)]! ${f}`
106
+ onChange: (e) => v("month", e.target.value),
107
+ className: `w-[calc(var(--sp-medium,0.75rem)*2+3ch)]! ${b}`
108
108
  }
109
109
  ),
110
110
  r === "date" && /* @__PURE__ */ t("span", { children: "/" }),
@@ -117,15 +117,15 @@ function _({
117
117
  maxLength: 2,
118
118
  type: "text",
119
119
  disabled: i,
120
- onChange: (e) => u("day", e.target.value),
121
- className: `w-[calc(var(--sp-medium,0.75rem)*2+3ch)]! ${f}`
120
+ onChange: (e) => v("day", e.target.value),
121
+ className: `w-[calc(var(--sp-medium,0.75rem)*2+3ch)]! ${b}`
122
122
  }
123
123
  ),
124
- /* @__PURE__ */ t(H, { errorMessages: p ? [p] : void 0 })
124
+ /* @__PURE__ */ t(K, { errorMessages: u ? [u] : void 0 })
125
125
  ]
126
126
  }
127
127
  );
128
128
  }
129
129
  export {
130
- _ as DatePicker
130
+ ae as DatePicker
131
131
  };
@@ -1,65 +1,75 @@
1
1
  "use client";
2
- import { jsxs as g, jsx as d } from "react/jsx-runtime";
3
- import { DatePicker as b } from "./DatePicker.js";
4
- import { COLOR as f } from "@geckou/ui-core";
5
- const h = { start: "", end: "" };
6
- function N({
7
- name: c,
8
- value: r = h,
9
- onChange: t,
10
- isDisabled: n,
11
- isRequired: a,
12
- formValidationStore: o,
13
- minDate: s = "",
14
- maxDate: l = "",
15
- size: m = "medium",
16
- type: i = "date"
2
+ import { jsxs as b, jsx as t } from "react/jsx-runtime";
3
+ import { COLOR as g, MESSAGES as R } from "@geckou/ui-core";
4
+ import { DatePicker as x } from "./DatePicker.js";
5
+ import { ErrorMessage as k } from "./ErrorMessage.js";
6
+ import { useRegisterValidation as u } from "../hooks/useFormValidation.js";
7
+ const M = { start: "", end: "" };
8
+ function $({
9
+ name: d,
10
+ value: r = M,
11
+ onChange: e,
12
+ isDisabled: a,
13
+ isRequired: c,
14
+ formValidationStore: s,
15
+ minDate: o = "",
16
+ maxDate: i = "",
17
+ size: l = "medium",
18
+ type: m = "date"
17
19
  }) {
18
- const x = (e) => t == null ? void 0 : t({ start: e, end: r.end }), u = (e) => t == null ? void 0 : t({ start: r.start, end: e }), v = {
19
- "--range-background-color": f.white,
20
- "--range-border-color": f.gray
20
+ const f = !(r.start && r.end && r.start > r.end);
21
+ u(s, `${d}Range`, f);
22
+ const E = (n) => e == null ? void 0 : e({ start: n, end: r.end }), p = (n) => e == null ? void 0 : e({ start: r.start, end: n }), h = {
23
+ "--range-background-color": g.white,
24
+ "--range-border-color": g.gray
21
25
  };
22
- return /* @__PURE__ */ g(
23
- "div",
24
- {
25
- style: v,
26
- 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)",
27
- children: [
28
- /* @__PURE__ */ d(
29
- b,
26
+ return (
27
+ // 角丸・区切り線は :first-child / :last-child で割り当てるため、
28
+ // ErrorMessage を同じ階層に置くとエラー表示時だけ枠の見た目が変わる。
29
+ // 入力群を内側にまとめ、ErrorMessage は外側(relative)に置く
30
+ /* @__PURE__ */ b("div", { style: h, className: "relative", children: [
31
+ /* @__PURE__ */ b("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__ */ t(
33
+ x,
30
34
  {
31
- name: `${c}Start`,
35
+ name: `${d}Start`,
32
36
  value: r.start,
33
- isDisabled: n,
34
- isRequired: a,
35
- formValidationStore: o,
36
- minDate: s,
37
- maxDate: r.end || l,
38
- size: m,
39
- type: i,
40
- onChange: x
37
+ isDisabled: a,
38
+ isRequired: c,
39
+ formValidationStore: s,
40
+ minDate: o,
41
+ maxDate: r.end || i,
42
+ size: l,
43
+ type: m,
44
+ onChange: E
41
45
  }
42
46
  ),
43
- /* @__PURE__ */ d("div", { className: "flex flex-none! items-center px-[var(--bv,0.375rem)]", children: "〜" }),
44
- /* @__PURE__ */ d(
45
- b,
47
+ /* @__PURE__ */ t("div", { className: "flex flex-none! items-center px-[var(--bv,0.375rem)]", children: "〜" }),
48
+ /* @__PURE__ */ t(
49
+ x,
46
50
  {
47
- name: `${c}End`,
51
+ name: `${d}End`,
48
52
  value: r.end,
49
- isDisabled: n,
50
- isRequired: a,
51
- formValidationStore: o,
52
- minDate: r.start || s,
53
- maxDate: l,
54
- size: m,
55
- type: i,
56
- onChange: u
53
+ isDisabled: a,
54
+ isRequired: c,
55
+ formValidationStore: s,
56
+ minDate: r.start || o,
57
+ maxDate: i,
58
+ size: l,
59
+ type: m,
60
+ onChange: p
57
61
  }
58
62
  )
59
- ]
60
- }
63
+ ] }),
64
+ /* @__PURE__ */ t(
65
+ k,
66
+ {
67
+ errorMessages: f ? void 0 : [R.startAfterEnd]
68
+ }
69
+ )
70
+ ] })
61
71
  );
62
72
  }
63
73
  export {
64
- N as DateRangePicker
74
+ $ as DateRangePicker
65
75
  };
@@ -8,6 +8,9 @@ type Props = {
8
8
  formValidationStore?: FormValidationStore | null;
9
9
  /** 'month' なら日の選択を出さない(Vue 版と揃える) */
10
10
  type?: 'date' | 'month';
11
+ /** 選べる年の下限・上限。既定は「今年 -100 〜 今年 -14」(生年月日向け) */
12
+ minYear?: number;
13
+ maxYear?: number;
11
14
  };
12
- export declare function DateSelector({ name, value, onChange, isRequired, formValidationStore, type, }: Props): import("react").JSX.Element;
15
+ export declare function DateSelector({ name, value, onChange, isRequired, formValidationStore, type, minYear, maxYear, }: Props): import("react").JSX.Element;
13
16
  export {};
@@ -1,45 +1,47 @@
1
1
  "use client";
2
- import { jsxs as l, jsx as o } from "react/jsx-runtime";
2
+ import { jsxs as s, jsx as l } from "react/jsx-runtime";
3
3
  import { useState as C, useEffect as F } from "react";
4
- import { splitDate as T, COLOR as I, daysInMonth as $ } from "@geckou/ui-core";
5
- import { InputBox as z } from "./InputBox.js";
4
+ import { splitDate as z, COLOR as I, daysInMonth as H } from "@geckou/ui-core";
5
+ import { InputBox as K } from "./InputBox.js";
6
6
  import { KeyboardArrowDownIcon as f } from "./icons/KeyboardArrowDownIcon.js";
7
- import { useRegisterValidation as H } from "../hooks/useFormValidation.js";
7
+ import { useRegisterValidation as L } from "../hooks/useFormValidation.js";
8
8
  const b = { year: "", month: "", day: "" };
9
- function J({
10
- name: n,
11
- value: m,
12
- onChange: s,
9
+ function R({
10
+ name: o,
11
+ value: i,
12
+ onChange: n,
13
13
  isRequired: c,
14
- formValidationStore: Y,
15
- type: i = "date"
14
+ formValidationStore: $,
15
+ type: m = "date",
16
+ minYear: A,
17
+ maxYear: M
16
18
  }) {
17
- const [r, d] = C(b), g = !!(r.year && r.month && (i === "month" || r.day)), A = !r.year && !r.month && !r.day;
18
- H(
19
- Y,
20
- n,
21
- c ? g : g || A
19
+ const [r, d] = C(b), g = !!(r.year && r.month && (m === "month" || r.day)), O = !r.year && !r.month && !r.day;
20
+ L(
21
+ $,
22
+ o,
23
+ c ? g : g || O
22
24
  ), F(() => {
23
- d(m ? T(m) : b);
24
- }, [m]);
25
- const N = /* @__PURE__ */ new Date(), S = N.getFullYear() - 100, O = N.getFullYear() - 14, k = Array.from(
26
- { length: O - S + 1 },
25
+ d(i ? z(i) : b);
26
+ }, [i]);
27
+ const N = (/* @__PURE__ */ new Date()).getFullYear(), S = A ?? N - 100, k = M ?? N - 14, E = Array.from(
28
+ { length: Math.max(k - S + 1, 0) },
27
29
  (e, a) => (S + a).toString()
28
- ).map((e) => ({ label: e, value: e })), E = Array.from({ length: 12 }, (e, a) => {
30
+ ).map((e) => ({ label: e, value: e })), T = Array.from({ length: 12 }, (e, a) => {
29
31
  const t = (a + 1).toString();
30
32
  return { label: t, value: t.padStart(2, "0") };
31
- }), w = (e, a) => $(Number(e) || 2e3, Number(a)), M = w(r.year, r.month), _ = Array.from({ length: M }, (e, a) => {
33
+ }), w = (e, a) => H(Number(e) || 2e3, Number(a)), Y = w(r.year, r.month), _ = Array.from({ length: Y }, (e, a) => {
32
34
  const t = (a + 1).toString();
33
35
  return { label: t, value: t.padStart(2, "0") };
34
36
  }), D = (e) => {
35
37
  d(e);
36
- const a = i === "month" ? [e.year, e.month] : [e.year, e.month, e.day];
38
+ const a = m === "month" ? [e.year, e.month] : [e.year, e.month, e.day];
37
39
  if (!e.year && !e.month && !e.day)
38
- s == null || s("");
40
+ n == null || n("");
39
41
  else {
40
42
  if (a.some((t) => !t))
41
43
  return;
42
- s == null || s(a.join("-"));
44
+ n == null || n(a.join("-"));
43
45
  }
44
46
  }, u = (e, a) => {
45
47
  const t = { ...r, [e]: a };
@@ -51,68 +53,71 @@ function J({
51
53
  }, p = (e) => {
52
54
  const t = e.currentTarget.firstElementChild;
53
55
  t && t.click();
54
- }, v = "relative w-max [&:has(select:focus)>svg]:rotate-180", y = "pointer-events-none absolute inset-y-0 right-[var(--sp-small,0.375rem)] m-auto size-[var(--icon-medium,1.125rem)] fill-(--icon-color)", x = "w-[calc(3ch+var(--sp-medium,0.75rem)*2+var(--icon-medium,1.125rem))]! p-[var(--sp-medium,0.75rem)]! pe-[calc(var(--sp-small,0.375rem)*2+var(--icon-medium,1.125rem))]! cursor-pointer", h = { "--icon-color": I.blue }, j = { "--caution-color": I.red };
55
- return /* @__PURE__ */ l(z, { className: "flex w-max items-center [&>*:not(:last-of-type)]:after:content-['/']", children: [
56
- /* @__PURE__ */ l("div", { className: v, style: h, onClick: p, children: [
57
- /* @__PURE__ */ l(
56
+ }, y = "relative w-max [&:has(select:focus)>svg]:rotate-180", v = "pointer-events-none absolute inset-y-0 right-[var(--sp-small,0.375rem)] m-auto size-[var(--icon-medium,1.125rem)] fill-(--icon-color)", x = "w-[calc(3ch+var(--sp-medium,0.75rem)*2+var(--icon-medium,1.125rem))]! p-[var(--sp-medium,0.75rem)]! pe-[calc(var(--sp-small,0.375rem)*2+var(--icon-medium,1.125rem))]! cursor-pointer", h = { "--icon-color": I.blue }, j = { "--caution-color": I.red };
57
+ return /* @__PURE__ */ s(K, { className: "flex w-max items-center [&>*:not(:last-of-type)]:after:content-['/']", children: [
58
+ /* @__PURE__ */ s("div", { className: y, style: h, onClick: p, children: [
59
+ /* @__PURE__ */ s(
58
60
  "select",
59
61
  {
60
62
  value: r.year,
61
- name: `${n}-year`,
63
+ name: `${o}-year`,
64
+ "aria-label": `${o}の年`,
62
65
  required: c,
63
66
  onChange: (e) => u("year", e.target.value),
64
67
  className: "w-[calc(5ch+var(--sp-medium,0.75rem)*2+var(--icon-medium,1.125rem))]! cursor-pointer p-[var(--sp-medium,0.75rem)]! pe-[calc(var(--sp-small,0.375rem)*2+var(--icon-medium,1.125rem))]!",
65
68
  children: [
66
- /* @__PURE__ */ o("option", { disabled: !0, value: "", children: "年" }),
67
- k.map((e) => /* @__PURE__ */ o("option", { value: e.value, children: e.label }, e.value))
69
+ /* @__PURE__ */ l("option", { disabled: !0, value: "", children: "年" }),
70
+ E.map((e) => /* @__PURE__ */ l("option", { value: e.value, children: e.label }, e.value))
68
71
  ]
69
72
  }
70
73
  ),
71
- /* @__PURE__ */ o(f, { className: y })
74
+ /* @__PURE__ */ l(f, { className: v })
72
75
  ] }),
73
- /* @__PURE__ */ l("div", { className: v, style: h, onClick: p, children: [
74
- /* @__PURE__ */ l(
76
+ /* @__PURE__ */ s("div", { className: y, style: h, onClick: p, children: [
77
+ /* @__PURE__ */ s(
75
78
  "select",
76
79
  {
77
80
  value: r.month,
78
- name: `${n}-month`,
81
+ name: `${o}-month`,
82
+ "aria-label": `${o}の月`,
79
83
  required: c,
80
84
  onChange: (e) => u("month", e.target.value),
81
85
  className: x,
82
86
  children: [
83
- /* @__PURE__ */ o("option", { disabled: !0, value: "", children: "月" }),
84
- E.map((e) => /* @__PURE__ */ o("option", { value: e.value, children: e.label }, e.value))
87
+ /* @__PURE__ */ l("option", { disabled: !0, value: "", children: "月" }),
88
+ T.map((e) => /* @__PURE__ */ l("option", { value: e.value, children: e.label }, e.value))
85
89
  ]
86
90
  }
87
91
  ),
88
- /* @__PURE__ */ o(f, { className: y })
92
+ /* @__PURE__ */ l(f, { className: v })
89
93
  ] }),
90
- i === "date" && /* @__PURE__ */ l(
94
+ m === "date" && /* @__PURE__ */ s(
91
95
  "div",
92
96
  {
93
- className: v,
97
+ className: y,
94
98
  style: h,
95
99
  onClick: p,
96
100
  children: [
97
- /* @__PURE__ */ l(
101
+ /* @__PURE__ */ s(
98
102
  "select",
99
103
  {
100
104
  value: r.day,
101
- name: `${n}-day`,
105
+ name: `${o}-day`,
106
+ "aria-label": `${o}の日`,
102
107
  required: c,
103
108
  onChange: (e) => u("day", e.target.value),
104
109
  className: x,
105
110
  children: [
106
- /* @__PURE__ */ o("option", { disabled: !0, value: "", children: "日" }),
107
- _.map((e) => /* @__PURE__ */ o("option", { value: e.value, children: e.label }, e.value))
111
+ /* @__PURE__ */ l("option", { disabled: !0, value: "", children: "日" }),
112
+ _.map((e) => /* @__PURE__ */ l("option", { value: e.value, children: e.label }, e.value))
108
113
  ]
109
114
  }
110
115
  ),
111
- /* @__PURE__ */ o(f, { className: y })
116
+ /* @__PURE__ */ l(f, { className: v })
112
117
  ]
113
118
  }
114
119
  ),
115
- /* @__PURE__ */ o(
120
+ /* @__PURE__ */ l(
116
121
  "button",
117
122
  {
118
123
  type: "button",
@@ -125,5 +130,5 @@ function J({
125
130
  ] });
126
131
  }
127
132
  export {
128
- J as DateSelector
133
+ R as DateSelector
129
134
  };
@@ -1,21 +1,22 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
2
  import { COLOR as t } from "@geckou/ui-core";
3
- function a({ errorMessages: r, cssStyle: o }) {
4
- if (!r || !r.length)
3
+ function f({ errorMessages: o, cssStyle: r }) {
4
+ if (!o || !o.length)
5
5
  return null;
6
6
  const b = {
7
- "--error-text-color": (o == null ? void 0 : o.textColor) || t.white,
8
- "--error-background-color": (o == null ? void 0 : o.backgroundColor) || t.red
7
+ "--error-text-color": (r == null ? void 0 : r.textColor) || t.white,
8
+ "--error-background-color": (r == null ? void 0 : r.backgroundColor) || t.red
9
9
  };
10
10
  return /* @__PURE__ */ n(
11
11
  "div",
12
12
  {
13
+ role: "alert",
13
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%)]",
14
15
  style: b,
15
- children: r.map((e) => /* @__PURE__ */ n("span", { children: e }, e))
16
+ children: o.map((e) => /* @__PURE__ */ n("span", { children: e }, e))
16
17
  }
17
18
  );
18
19
  }
19
20
  export {
20
- a as ErrorMessage
21
+ f as ErrorMessage
21
22
  };