@geckou/ui-react 0.1.1 → 0.3.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 +46 -5
- package/dist/components/BasicButton.d.ts +14 -0
- package/dist/components/BasicButton.js +57 -0
- package/dist/components/CheckBox.d.ts +13 -0
- package/dist/components/CheckBox.js +74 -0
- package/dist/components/CheckBoxes.d.ts +12 -0
- package/dist/components/CheckBoxes.js +68 -0
- package/dist/components/CheckButton.d.ts +13 -0
- package/dist/components/CheckButton.js +56 -0
- package/dist/components/DatePicker.d.ts +18 -0
- package/dist/components/DatePicker.js +131 -0
- package/dist/components/DateRangePicker.d.ts +22 -0
- package/dist/components/DateRangePicker.js +65 -0
- package/dist/components/DateSelector.d.ts +13 -0
- package/dist/components/DateSelector.js +129 -0
- package/dist/components/DropdownUi.d.ts +16 -0
- package/dist/components/DropdownUi.js +88 -0
- package/dist/components/ErrorMessage.d.ts +9 -0
- package/dist/components/ErrorMessage.js +21 -0
- package/dist/components/FileInput.d.ts +7 -0
- package/dist/components/FileInput.js +91 -0
- package/dist/components/InputBox.d.ts +11 -0
- package/dist/components/InputBox.js +75 -0
- package/dist/components/InputGroup.d.ts +6 -0
- package/dist/components/InputGroup.js +7 -0
- package/dist/components/LabeledCheckbox.d.ts +12 -0
- package/dist/components/LabeledCheckbox.js +46 -0
- package/dist/components/LabeledFieldset.d.ts +8 -0
- package/dist/components/LabeledFieldset.js +10 -0
- package/dist/components/LoadingSpinner.d.ts +1 -0
- package/dist/components/LoadingSpinner.js +26 -0
- package/dist/components/ModalBox.d.ts +12 -0
- package/dist/components/ModalBox.js +83 -0
- package/dist/components/PopupBox.d.ts +14 -0
- package/dist/components/PopupBox.js +41 -0
- package/dist/components/RadioButtons.d.ts +13 -0
- package/dist/components/RadioButtons.js +64 -0
- package/dist/components/SearchableSelectBox.d.ts +14 -0
- package/dist/components/SearchableSelectBox.js +61 -0
- package/dist/components/SelectBox.d.ts +16 -0
- package/dist/components/SelectBox.js +107 -0
- package/dist/components/SlideDownUi.d.ts +17 -0
- package/dist/components/SlideDownUi.js +86 -0
- package/dist/components/TabUI.d.ts +18 -0
- package/dist/components/TabUI.js +76 -0
- package/dist/components/TextArea.d.ts +18 -0
- package/dist/components/TextArea.js +75 -0
- package/dist/components/TextBox.d.ts +20 -0
- package/dist/components/TextBox.js +90 -0
- package/dist/components/ToggleButton.d.ts +15 -0
- package/dist/components/ToggleButton.js +92 -0
- package/dist/components/icons/BackupIcon.d.ts +5 -0
- package/dist/components/icons/BackupIcon.js +16 -0
- package/dist/components/icons/CalendarIcon.d.ts +5 -0
- package/dist/components/icons/CalendarIcon.js +15 -0
- package/dist/components/icons/CheckIcon.d.ts +1 -0
- package/dist/components/icons/CheckIcon.js +7 -0
- package/dist/components/icons/CloseIcon.d.ts +5 -0
- package/dist/components/icons/CloseIcon.js +16 -0
- package/dist/components/icons/KeyboardArrowDownIcon.d.ts +5 -0
- package/dist/components/icons/KeyboardArrowDownIcon.js +16 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/hooks/useFormValidation.d.ts +33 -0
- package/dist/hooks/useFormValidation.js +28 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +70 -0
- package/{src → dist}/styles/tokens.css +1 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +17 -12
- package/src/components/BasicButton.tsx +0 -81
- package/src/components/CheckBox.tsx +0 -87
- package/src/components/CheckBoxes.tsx +0 -93
- package/src/components/CheckButton.tsx +0 -66
- package/src/components/DatePicker.tsx +0 -154
- package/src/components/DateRangePicker.tsx +0 -59
- package/src/components/DateSelector.tsx +0 -162
- package/src/components/DropdownUi.tsx +0 -126
- package/src/components/ErrorMessage.tsx +0 -30
- package/src/components/FileInput.tsx +0 -93
- package/src/components/InputBox.tsx +0 -118
- package/src/components/InputGroup.tsx +0 -13
- package/src/components/LabeledCheckbox.tsx +0 -61
- package/src/components/LabeledFieldset.tsx +0 -18
- package/src/components/LoadingSpinner.tsx +0 -23
- package/src/components/ModalBox.tsx +0 -109
- package/src/components/PopupBox.tsx +0 -70
- package/src/components/RadioButtons.tsx +0 -94
- package/src/components/SearchableSelectBox.tsx +0 -108
- package/src/components/SelectBox.tsx +0 -152
- package/src/components/SlideDownUi.tsx +0 -123
- package/src/components/TabUI.tsx +0 -112
- package/src/components/TextArea.tsx +0 -102
- package/src/components/TextBox.tsx +0 -120
- package/src/components/ToggleButton.tsx +0 -102
- package/src/components/icons/BackupIcon.tsx +0 -16
- package/src/components/icons/CalendarIcon.tsx +0 -15
- package/src/components/icons/CheckIcon.tsx +0 -7
- package/src/components/icons/CloseIcon.tsx +0 -16
- package/src/components/icons/KeyboardArrowDownIcon.tsx +0 -16
- package/src/constants/index.ts +0 -2
- package/src/hooks/useFormValidation.ts +0 -69
- package/src/index.ts +0 -66
- package/src/types/index.ts +0 -23
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as l, jsx as o } from "react/jsx-runtime";
|
|
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";
|
|
6
|
+
import { KeyboardArrowDownIcon as f } from "./icons/KeyboardArrowDownIcon.js";
|
|
7
|
+
import { useRegisterValidation as H } from "../hooks/useFormValidation.js";
|
|
8
|
+
const b = { year: "", month: "", day: "" };
|
|
9
|
+
function J({
|
|
10
|
+
name: n,
|
|
11
|
+
value: m,
|
|
12
|
+
onChange: s,
|
|
13
|
+
isRequired: c,
|
|
14
|
+
formValidationStore: Y,
|
|
15
|
+
type: i = "date"
|
|
16
|
+
}) {
|
|
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
|
|
22
|
+
), 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 },
|
|
27
|
+
(e, a) => (S + a).toString()
|
|
28
|
+
).map((e) => ({ label: e, value: e })), E = Array.from({ length: 12 }, (e, a) => {
|
|
29
|
+
const t = (a + 1).toString();
|
|
30
|
+
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) => {
|
|
32
|
+
const t = (a + 1).toString();
|
|
33
|
+
return { label: t, value: t.padStart(2, "0") };
|
|
34
|
+
}), D = (e) => {
|
|
35
|
+
d(e);
|
|
36
|
+
const a = i === "month" ? [e.year, e.month] : [e.year, e.month, e.day];
|
|
37
|
+
if (!e.year && !e.month && !e.day)
|
|
38
|
+
s == null || s("");
|
|
39
|
+
else {
|
|
40
|
+
if (a.some((t) => !t))
|
|
41
|
+
return;
|
|
42
|
+
s == null || s(a.join("-"));
|
|
43
|
+
}
|
|
44
|
+
}, u = (e, a) => {
|
|
45
|
+
const t = { ...r, [e]: a };
|
|
46
|
+
if (e !== "day" && t.day && t.month) {
|
|
47
|
+
const B = w(t.year, t.month);
|
|
48
|
+
Number(t.day) > B && (t.day = String(B).padStart(2, "0"));
|
|
49
|
+
}
|
|
50
|
+
D(t);
|
|
51
|
+
}, p = (e) => {
|
|
52
|
+
const t = e.currentTarget.firstElementChild;
|
|
53
|
+
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(
|
|
58
|
+
"select",
|
|
59
|
+
{
|
|
60
|
+
value: r.year,
|
|
61
|
+
name: `${n}-year`,
|
|
62
|
+
required: c,
|
|
63
|
+
onChange: (e) => u("year", e.target.value),
|
|
64
|
+
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
|
+
children: [
|
|
66
|
+
/* @__PURE__ */ o("option", { disabled: !0, value: "", children: "年" }),
|
|
67
|
+
k.map((e) => /* @__PURE__ */ o("option", { value: e.value, children: e.label }, e.value))
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
/* @__PURE__ */ o(f, { className: y })
|
|
72
|
+
] }),
|
|
73
|
+
/* @__PURE__ */ l("div", { className: v, style: h, onClick: p, children: [
|
|
74
|
+
/* @__PURE__ */ l(
|
|
75
|
+
"select",
|
|
76
|
+
{
|
|
77
|
+
value: r.month,
|
|
78
|
+
name: `${n}-month`,
|
|
79
|
+
required: c,
|
|
80
|
+
onChange: (e) => u("month", e.target.value),
|
|
81
|
+
className: x,
|
|
82
|
+
children: [
|
|
83
|
+
/* @__PURE__ */ o("option", { disabled: !0, value: "", children: "月" }),
|
|
84
|
+
E.map((e) => /* @__PURE__ */ o("option", { value: e.value, children: e.label }, e.value))
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
/* @__PURE__ */ o(f, { className: y })
|
|
89
|
+
] }),
|
|
90
|
+
i === "date" && /* @__PURE__ */ l(
|
|
91
|
+
"div",
|
|
92
|
+
{
|
|
93
|
+
className: v,
|
|
94
|
+
style: h,
|
|
95
|
+
onClick: p,
|
|
96
|
+
children: [
|
|
97
|
+
/* @__PURE__ */ l(
|
|
98
|
+
"select",
|
|
99
|
+
{
|
|
100
|
+
value: r.day,
|
|
101
|
+
name: `${n}-day`,
|
|
102
|
+
required: c,
|
|
103
|
+
onChange: (e) => u("day", e.target.value),
|
|
104
|
+
className: x,
|
|
105
|
+
children: [
|
|
106
|
+
/* @__PURE__ */ o("option", { disabled: !0, value: "", children: "日" }),
|
|
107
|
+
_.map((e) => /* @__PURE__ */ o("option", { value: e.value, children: e.label }, e.value))
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
/* @__PURE__ */ o(f, { className: y })
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
/* @__PURE__ */ o(
|
|
116
|
+
"button",
|
|
117
|
+
{
|
|
118
|
+
type: "button",
|
|
119
|
+
style: j,
|
|
120
|
+
className: "mx-[var(--sp-medium,0.75rem)] inline-flex cursor-pointer items-center gap-[var(--sp-min,0.1875rem)] text-[length:var(--fs-small,0.6875rem)] text-(--caution-color)",
|
|
121
|
+
onClick: () => D(b),
|
|
122
|
+
children: "削除"
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
] });
|
|
126
|
+
}
|
|
127
|
+
export {
|
|
128
|
+
J as DateSelector
|
|
129
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode, Ref } from 'react';
|
|
2
|
+
export type DropdownUiHandle = {
|
|
3
|
+
isContentsOpened: () => boolean;
|
|
4
|
+
close: () => void;
|
|
5
|
+
};
|
|
6
|
+
type Props = {
|
|
7
|
+
isHiddenArrow?: boolean;
|
|
8
|
+
contentAlignment?: 'left' | 'center' | 'right';
|
|
9
|
+
isDisabled?: boolean;
|
|
10
|
+
contentsWidth?: string;
|
|
11
|
+
trigger: ReactNode;
|
|
12
|
+
contents?: ReactNode;
|
|
13
|
+
ref?: Ref<DropdownUiHandle>;
|
|
14
|
+
};
|
|
15
|
+
export declare function DropdownUi({ isHiddenArrow, contentAlignment, isDisabled, contentsWidth, trigger, contents, ref, }: Props): import("react").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as f, jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import { useState as v, useRef as p, useImperativeHandle as I, useEffect as b } from "react";
|
|
4
|
+
import { KeyboardArrowDownIcon as N } from "./icons/KeyboardArrowDownIcon.js";
|
|
5
|
+
import { COLOR as h } from "@geckou/ui-core";
|
|
6
|
+
function L({
|
|
7
|
+
isHiddenArrow: g = !1,
|
|
8
|
+
contentAlignment: i = "left",
|
|
9
|
+
isDisabled: s = !1,
|
|
10
|
+
contentsWidth: x = "auto",
|
|
11
|
+
trigger: w,
|
|
12
|
+
contents: o,
|
|
13
|
+
ref: C
|
|
14
|
+
}) {
|
|
15
|
+
const [t, c] = v(!1), [z, O] = v(0), u = p(null), d = p(null), k = () => c((e) => !e), l = () => c(!1);
|
|
16
|
+
I(C, () => ({
|
|
17
|
+
isContentsOpened: () => t,
|
|
18
|
+
close: l
|
|
19
|
+
})), b(() => {
|
|
20
|
+
const e = (r) => {
|
|
21
|
+
const n = u.current;
|
|
22
|
+
n && !n.contains(r.target) && l();
|
|
23
|
+
};
|
|
24
|
+
return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
|
|
25
|
+
}, []), b(() => {
|
|
26
|
+
const e = d.current;
|
|
27
|
+
if (!e)
|
|
28
|
+
return;
|
|
29
|
+
const r = () => O(e.clientHeight);
|
|
30
|
+
r();
|
|
31
|
+
const n = new ResizeObserver(r);
|
|
32
|
+
return n.observe(e), () => n.disconnect();
|
|
33
|
+
}, [!!o]);
|
|
34
|
+
const m = s || !o, y = {
|
|
35
|
+
"--trigger-color": m ? h.black : h.blue
|
|
36
|
+
}, H = {
|
|
37
|
+
boxShadow: t ? "0 0 6px #33333333" : "none",
|
|
38
|
+
blockSize: t ? `${z}px` : 0,
|
|
39
|
+
inlineSize: x,
|
|
40
|
+
right: i === "right" ? "calc(var(--bv, 0.375rem) * -0.5)" : "auto",
|
|
41
|
+
left: i === "left" ? "calc(var(--bv, 0.375rem) * -0.5)" : "auto",
|
|
42
|
+
zIndex: 2
|
|
43
|
+
};
|
|
44
|
+
return /* @__PURE__ */ f("div", { ref: u, className: "relative", children: [
|
|
45
|
+
/* @__PURE__ */ f(
|
|
46
|
+
"button",
|
|
47
|
+
{
|
|
48
|
+
type: "button",
|
|
49
|
+
disabled: s,
|
|
50
|
+
"aria-expanded": t,
|
|
51
|
+
style: { ...y, cursor: m ? "auto" : "pointer" },
|
|
52
|
+
className: "flex size-full items-center gap-[var(--sp-small,0.375rem)] text-(--trigger-color)",
|
|
53
|
+
onClick: (e) => {
|
|
54
|
+
e.preventDefault(), k();
|
|
55
|
+
},
|
|
56
|
+
children: [
|
|
57
|
+
w,
|
|
58
|
+
!(g || !o || s) && /* @__PURE__ */ a(
|
|
59
|
+
N,
|
|
60
|
+
{
|
|
61
|
+
className: `size-[var(--icon-small,0.9375rem)] flex-none transition-all duration-100 ${t ? "rotate-180" : ""}`
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
o && /* @__PURE__ */ a(
|
|
68
|
+
"div",
|
|
69
|
+
{
|
|
70
|
+
style: H,
|
|
71
|
+
inert: !t,
|
|
72
|
+
className: "absolute top-[calc(100%-var(--sp-min,0.1875rem))] cursor-pointer overflow-hidden rounded-[var(--radius-small,0.1875rem)] transition-[block-size] duration-100",
|
|
73
|
+
children: /* @__PURE__ */ a(
|
|
74
|
+
"div",
|
|
75
|
+
{
|
|
76
|
+
ref: d,
|
|
77
|
+
className: "max-h-[calc(var(--bv,0.375rem)*56)] min-w-[calc(var(--bv,0.375rem)*20)] overflow-auto bg-white",
|
|
78
|
+
onClick: l,
|
|
79
|
+
children: o
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
] });
|
|
85
|
+
}
|
|
86
|
+
export {
|
|
87
|
+
L as DropdownUi
|
|
88
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { COLOR as t } from "@geckou/ui-core";
|
|
3
|
+
function a({ errorMessages: r, cssStyle: o }) {
|
|
4
|
+
if (!r || !r.length)
|
|
5
|
+
return null;
|
|
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
|
|
9
|
+
};
|
|
10
|
+
return /* @__PURE__ */ n(
|
|
11
|
+
"div",
|
|
12
|
+
{
|
|
13
|
+
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
|
+
style: b,
|
|
15
|
+
children: r.map((e) => /* @__PURE__ */ n("span", { children: e }, e))
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
a as ErrorMessage
|
|
21
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as a, jsx as l } from "react/jsx-runtime";
|
|
3
|
+
import { BackupIcon as v } from "./icons/BackupIcon.js";
|
|
4
|
+
import { CloseIcon as m } from "./icons/CloseIcon.js";
|
|
5
|
+
import { COLOR as o } from "@geckou/ui-core";
|
|
6
|
+
function N({ value: c, onChange: e, accept: n = "" }) {
|
|
7
|
+
const s = c ?? [], t = (r) => {
|
|
8
|
+
!r || !r.length || e == null || e([...s, ...Array.from(r)]);
|
|
9
|
+
}, p = (r) => {
|
|
10
|
+
e == null || e(s.filter((i) => i !== r));
|
|
11
|
+
}, u = (r) => {
|
|
12
|
+
r.preventDefault(), t(r.dataTransfer.files);
|
|
13
|
+
}, d = {
|
|
14
|
+
"--link-color": o.blue,
|
|
15
|
+
"--caution-color": o.red
|
|
16
|
+
};
|
|
17
|
+
return /* @__PURE__ */ a(
|
|
18
|
+
"div",
|
|
19
|
+
{
|
|
20
|
+
style: d,
|
|
21
|
+
className: "w-full rounded-[var(--radius-small,0.1875rem)] border border-dashed border-[var(--link-color,#1c4ac9)] p-[var(--sp-medium,0.75rem)]",
|
|
22
|
+
children: [
|
|
23
|
+
/* @__PURE__ */ a(
|
|
24
|
+
"div",
|
|
25
|
+
{
|
|
26
|
+
className: "flex h-full flex-col items-center justify-center gap-[var(--sp-small,0.375rem)] [&>span]:inline-block [&>span]:p-[var(--sp-small,0.375rem)]",
|
|
27
|
+
onDragOver: (r) => r.preventDefault(),
|
|
28
|
+
onDrop: u,
|
|
29
|
+
children: [
|
|
30
|
+
/* @__PURE__ */ l("span", { children: "ファイルをドロップしてアップロード" }),
|
|
31
|
+
/* @__PURE__ */ l("span", { children: "または" }),
|
|
32
|
+
/* @__PURE__ */ a("label", { className: "relative inline-flex cursor-pointer items-center gap-[var(--sp-small,0.375rem)] rounded-[var(--radius-small,0.1875rem)] bg-transparent p-[var(--sp-small,0.375rem)] font-medium text-[var(--link-color,#1c4ac9)] transition-colors duration-100 hover:bg-[var(--hover-color,#EEF7FB)] has-[input:focus-visible]:outline-2 has-[input:focus-visible]:outline-offset-2 has-[input:focus-visible]:outline-[var(--link-color,#1c4ac9)]", children: [
|
|
33
|
+
/* @__PURE__ */ l(v, { className: "size-[var(--icon-small,0.9375rem)]" }),
|
|
34
|
+
/* @__PURE__ */ l("span", { children: "ファイルを選択" }),
|
|
35
|
+
/* @__PURE__ */ l(
|
|
36
|
+
"input",
|
|
37
|
+
{
|
|
38
|
+
type: "file",
|
|
39
|
+
multiple: !0,
|
|
40
|
+
accept: n,
|
|
41
|
+
className: "sr-only",
|
|
42
|
+
onChange: (r) => {
|
|
43
|
+
t(r.target.files), r.target.value = "";
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
] })
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
),
|
|
51
|
+
s.length > 0 && /* @__PURE__ */ a("div", { className: "mt-[var(--sp-medium,0.75rem)] flex flex-col items-center gap-[var(--sp-small,0.375rem)] bg-[var(--light-blue,#d2e4f7)] p-[var(--sp-medium,0.75rem)] [&>*:last-child]:mt-[var(--sp-small,0.375rem)]", children: [
|
|
52
|
+
s.map((r, i) => /* @__PURE__ */ a(
|
|
53
|
+
"span",
|
|
54
|
+
{
|
|
55
|
+
className: "inline-flex items-center gap-[var(--sp-min,0.1875rem)]",
|
|
56
|
+
children: [
|
|
57
|
+
r.name,
|
|
58
|
+
/* @__PURE__ */ l(
|
|
59
|
+
"button",
|
|
60
|
+
{
|
|
61
|
+
type: "button",
|
|
62
|
+
"aria-label": `${r.name} を削除`,
|
|
63
|
+
className: "inline-flex cursor-pointer items-center",
|
|
64
|
+
onClick: () => p(r),
|
|
65
|
+
children: /* @__PURE__ */ l(m, { className: "size-[var(--icon-small,0.9375rem)] text-[var(--caution-color,#aa0000)]" })
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
`${r.name}_${i}`
|
|
71
|
+
)),
|
|
72
|
+
/* @__PURE__ */ a(
|
|
73
|
+
"button",
|
|
74
|
+
{
|
|
75
|
+
type: "button",
|
|
76
|
+
className: "inline-flex cursor-pointer items-center gap-[var(--sp-min,0.1875rem)] rounded-[var(--radius-small,0.1875rem)] border border-[var(--caution-color,#aa0000)] bg-white px-[var(--sp-medium,0.75rem)] py-[var(--sp-small,0.375rem)] text-[length:var(--fs-small,0.6875rem)] text-[var(--caution-color,#aa0000)]",
|
|
77
|
+
onClick: () => e == null ? void 0 : e([]),
|
|
78
|
+
children: [
|
|
79
|
+
/* @__PURE__ */ l(m, { className: "size-[var(--icon-min,0.75rem)]" }),
|
|
80
|
+
"全て削除"
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
] })
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
export {
|
|
90
|
+
N as FileInput
|
|
91
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { InputBoxStyleForEachStatus } from '../types';
|
|
3
|
+
type Props = {
|
|
4
|
+
cssStyle?: InputBoxStyleForEachStatus;
|
|
5
|
+
isErrored?: boolean;
|
|
6
|
+
isDisabled?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
};
|
|
10
|
+
export declare function InputBox({ cssStyle, isErrored, isDisabled, className, children, }: Props): import("react").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as C } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as a, useState as L, useCallback as E, useEffect as v } from "react";
|
|
4
|
+
import { INPUT_BOX_DEFAULT_STYLES as k } from "@geckou/ui-core";
|
|
5
|
+
function $({
|
|
6
|
+
cssStyle: m,
|
|
7
|
+
isErrored: u,
|
|
8
|
+
isDisabled: n,
|
|
9
|
+
className: _,
|
|
10
|
+
children: w
|
|
11
|
+
}) {
|
|
12
|
+
var b, p, h;
|
|
13
|
+
const l = a(null), [S, t] = L("default"), c = a(u);
|
|
14
|
+
c.current = u;
|
|
15
|
+
const r = E(() => {
|
|
16
|
+
var s;
|
|
17
|
+
const e = (s = l.current) == null ? void 0 : s.querySelector("input, textarea, select");
|
|
18
|
+
if (!e)
|
|
19
|
+
return t("default");
|
|
20
|
+
if (e.matches(":disabled"))
|
|
21
|
+
return t("disabled");
|
|
22
|
+
if (e.matches(":focus"))
|
|
23
|
+
return t("focus");
|
|
24
|
+
if (e.tagName.toLowerCase() === "select") {
|
|
25
|
+
const x = e;
|
|
26
|
+
return t(
|
|
27
|
+
x.required && !x.value ? "error" : "valid"
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
if (c.current || e.matches(":invalid"))
|
|
31
|
+
return t("error");
|
|
32
|
+
if (e.matches(":valid") && e.matches(":not(:placeholder-shown)") && e.matches(":not(:invalid)"))
|
|
33
|
+
return t("valid");
|
|
34
|
+
t("default");
|
|
35
|
+
}, []);
|
|
36
|
+
v(() => {
|
|
37
|
+
const e = l.current;
|
|
38
|
+
if (!e)
|
|
39
|
+
return;
|
|
40
|
+
const s = new MutationObserver(r);
|
|
41
|
+
return s.observe(e, { childList: !0, subtree: !0 }), e.addEventListener("focusin", r, !0), e.addEventListener("blur", r, !0), () => {
|
|
42
|
+
s.disconnect(), e.removeEventListener("focusin", r, !0), e.removeEventListener("blur", r, !0);
|
|
43
|
+
};
|
|
44
|
+
}, [r]);
|
|
45
|
+
const i = a(!0), d = a(n);
|
|
46
|
+
v(() => {
|
|
47
|
+
const e = d.current !== n;
|
|
48
|
+
if (d.current = n, i.current) {
|
|
49
|
+
i.current = !1, n && t("disabled");
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (e)
|
|
53
|
+
return t(n ? "disabled" : "default");
|
|
54
|
+
r();
|
|
55
|
+
}, [n, u, r]);
|
|
56
|
+
const f = { ...k, ...m }, o = f[S] ?? f.default, g = {
|
|
57
|
+
"--text-color": o.textColor,
|
|
58
|
+
"--placeholder-color": o.placeholderColor,
|
|
59
|
+
"--background-color": o.backgroundColor,
|
|
60
|
+
"--radius-size": ((b = o.border) == null ? void 0 : b.radius) || ".25rem",
|
|
61
|
+
"--input-box-shadow": `0 0 0 ${((p = o.border) == null ? void 0 : p.size) || "1px"} ${(h = o.border) == null ? void 0 : h.color} inset, ${o.boxShadow || "0 0 0 0 rgba(0, 0, 0, 0)"}`
|
|
62
|
+
};
|
|
63
|
+
return /* @__PURE__ */ C(
|
|
64
|
+
"div",
|
|
65
|
+
{
|
|
66
|
+
ref: l,
|
|
67
|
+
className: `relative inline-flex max-w-full rounded-(--radius-size) bg-(--background-color) text-(--text-color) shadow-(--input-box-shadow) has-[:disabled]:pointer-events-none has-[:disabled]:before:pointer-events-auto has-[:disabled]:before:absolute has-[:disabled]:before:inset-0 has-[:disabled]:before:cursor-not-allowed has-[:disabled]:before:content-[''] [&_*::placeholder]:font-normal [&_*::placeholder]:text-(--placeholder-color) [&_*:focus]:outline-none [&_:is(input,textarea,select)]:w-full [&_:is(input,textarea,select)]:appearance-none [&_:is(input,textarea,select)]:border-none [&_:is(input,textarea,select)]:bg-transparent [&_:is(input,textarea,select)]:p-4 [&_:is(input,textarea,select)]:outline-none ${_ || ""}`,
|
|
68
|
+
style: g,
|
|
69
|
+
children: w
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
export {
|
|
74
|
+
$ as InputBox
|
|
75
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
function o({ children: l }) {
|
|
3
|
+
return /* @__PURE__ */ n("div", { className: "inline-flex gap-px max-md:flex-wrap [&>*]:flex-auto [&>*]:rounded-none [&>*:first-child:not(:only-child)]:rounded-l-[var(--radius-small,0.1875rem)] [&>*:last-child:not(:only-child)]:rounded-r-[var(--radius-small,0.1875rem)] [&>button]:flex-none", children: l });
|
|
4
|
+
}
|
|
5
|
+
export {
|
|
6
|
+
o as InputGroup
|
|
7
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CheckBoxStyleForEachStatus } from '../types';
|
|
2
|
+
type Props = {
|
|
3
|
+
name: string;
|
|
4
|
+
label: string;
|
|
5
|
+
checked?: boolean;
|
|
6
|
+
onChange?: (newValue: boolean) => void;
|
|
7
|
+
isDisabled?: boolean;
|
|
8
|
+
cssStyle?: CheckBoxStyleForEachStatus;
|
|
9
|
+
isDisableAnimation?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare function LabeledCheckbox({ name, label, checked, onChange, isDisabled, cssStyle, isDisableAnimation, }: Props): import("react").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as m, jsx as n } from "react/jsx-runtime";
|
|
3
|
+
import { CheckBox as h } from "./CheckBox.js";
|
|
4
|
+
import { COLOR as r } from "@geckou/ui-core";
|
|
5
|
+
function f({
|
|
6
|
+
name: c,
|
|
7
|
+
label: l,
|
|
8
|
+
checked: d,
|
|
9
|
+
onChange: u,
|
|
10
|
+
isDisabled: e,
|
|
11
|
+
cssStyle: o,
|
|
12
|
+
isDisableAnimation: x
|
|
13
|
+
}) {
|
|
14
|
+
const t = d ?? !1, i = e ? o == null ? void 0 : o.disabled : o == null ? void 0 : o.default, a = {
|
|
15
|
+
textColor: e ? r.darkGray : r.black,
|
|
16
|
+
backgroundColor: e ? r.darkGray : r.blue,
|
|
17
|
+
...i ?? {}
|
|
18
|
+
}, k = {
|
|
19
|
+
"--text-color": a.textColor,
|
|
20
|
+
"--checked-color": a.backgroundColor
|
|
21
|
+
};
|
|
22
|
+
return /* @__PURE__ */ m("label", { className: "inline-flex cursor-pointer items-center gap-[.5em] has-[input:disabled]:cursor-auto", children: [
|
|
23
|
+
/* @__PURE__ */ n("span", { className: "pointer-events-none", children: /* @__PURE__ */ n(
|
|
24
|
+
h,
|
|
25
|
+
{
|
|
26
|
+
name: c,
|
|
27
|
+
checked: t,
|
|
28
|
+
onChange: u,
|
|
29
|
+
isDisabled: e,
|
|
30
|
+
cssStyle: o,
|
|
31
|
+
isDisableAnimation: x
|
|
32
|
+
}
|
|
33
|
+
) }),
|
|
34
|
+
/* @__PURE__ */ n(
|
|
35
|
+
"span",
|
|
36
|
+
{
|
|
37
|
+
style: k,
|
|
38
|
+
className: t ? "text-(--text-color)" : "text-(--checked-color)",
|
|
39
|
+
children: l
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
] });
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
f as LabeledCheckbox
|
|
46
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as e, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
function c({ isDisabled: l, label: s, children: d }) {
|
|
3
|
+
return /* @__PURE__ */ e("div", { className: "grid gap-2", children: /* @__PURE__ */ i("fieldset", { className: "contents", disabled: l, children: [
|
|
4
|
+
s && /* @__PURE__ */ e("legend", { className: "flex items-center", children: s }),
|
|
5
|
+
/* @__PURE__ */ e("div", { className: "[&>*]:w-full", children: d })
|
|
6
|
+
] }) });
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
c as LabeledFieldset
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function LoadingSpinner(): import("react").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as c, jsxs as r } from "react/jsx-runtime";
|
|
2
|
+
function i() {
|
|
3
|
+
return /* @__PURE__ */ c("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ r("g", { children: [
|
|
4
|
+
/* @__PURE__ */ c("circle", { cx: "12", cy: "2.5", r: "1.5", opacity: ".14" }),
|
|
5
|
+
/* @__PURE__ */ c("circle", { cx: "16.75", cy: "3.77", r: "1.5", opacity: ".29" }),
|
|
6
|
+
/* @__PURE__ */ c("circle", { cx: "20.23", cy: "7.25", r: "1.5", opacity: ".43" }),
|
|
7
|
+
/* @__PURE__ */ c("circle", { cx: "21.50", cy: "12.00", r: "1.5", opacity: ".57" }),
|
|
8
|
+
/* @__PURE__ */ c("circle", { cx: "20.23", cy: "16.75", r: "1.5", opacity: ".71" }),
|
|
9
|
+
/* @__PURE__ */ c("circle", { cx: "16.75", cy: "20.23", r: "1.5", opacity: ".86" }),
|
|
10
|
+
/* @__PURE__ */ c("circle", { cx: "12", cy: "21.5", r: "1.5" }),
|
|
11
|
+
/* @__PURE__ */ c(
|
|
12
|
+
"animateTransform",
|
|
13
|
+
{
|
|
14
|
+
attributeName: "transform",
|
|
15
|
+
type: "rotate",
|
|
16
|
+
calcMode: "discrete",
|
|
17
|
+
dur: "0.75s",
|
|
18
|
+
values: "0 12 12;30 12 12;60 12 12;90 12 12;120 12 12;150 12 12;180 12 12;210 12 12;240 12 12;270 12 12;300 12 12;330 12 12;360 12 12",
|
|
19
|
+
repeatCount: "indefinite"
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
] }) });
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
i as LoadingSpinner
|
|
26
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
isShown: boolean;
|
|
4
|
+
size?: 'small' | 'medium' | 'large';
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
header?: ReactNode;
|
|
7
|
+
footer?: ReactNode;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
ariaLabel?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function ModalBox({ isShown, size, onClose, header, footer, children, ariaLabel, }: Props): import("react").JSX.Element;
|
|
12
|
+
export {};
|