@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.
Files changed (103) hide show
  1. package/README.md +46 -5
  2. package/dist/components/BasicButton.d.ts +14 -0
  3. package/dist/components/BasicButton.js +57 -0
  4. package/dist/components/CheckBox.d.ts +13 -0
  5. package/dist/components/CheckBox.js +74 -0
  6. package/dist/components/CheckBoxes.d.ts +12 -0
  7. package/dist/components/CheckBoxes.js +68 -0
  8. package/dist/components/CheckButton.d.ts +13 -0
  9. package/dist/components/CheckButton.js +56 -0
  10. package/dist/components/DatePicker.d.ts +18 -0
  11. package/dist/components/DatePicker.js +131 -0
  12. package/dist/components/DateRangePicker.d.ts +22 -0
  13. package/dist/components/DateRangePicker.js +65 -0
  14. package/dist/components/DateSelector.d.ts +13 -0
  15. package/dist/components/DateSelector.js +129 -0
  16. package/dist/components/DropdownUi.d.ts +16 -0
  17. package/dist/components/DropdownUi.js +88 -0
  18. package/dist/components/ErrorMessage.d.ts +9 -0
  19. package/dist/components/ErrorMessage.js +21 -0
  20. package/dist/components/FileInput.d.ts +7 -0
  21. package/dist/components/FileInput.js +91 -0
  22. package/dist/components/InputBox.d.ts +11 -0
  23. package/dist/components/InputBox.js +75 -0
  24. package/dist/components/InputGroup.d.ts +6 -0
  25. package/dist/components/InputGroup.js +7 -0
  26. package/dist/components/LabeledCheckbox.d.ts +12 -0
  27. package/dist/components/LabeledCheckbox.js +46 -0
  28. package/dist/components/LabeledFieldset.d.ts +8 -0
  29. package/dist/components/LabeledFieldset.js +10 -0
  30. package/dist/components/LoadingSpinner.d.ts +1 -0
  31. package/dist/components/LoadingSpinner.js +26 -0
  32. package/dist/components/ModalBox.d.ts +12 -0
  33. package/dist/components/ModalBox.js +83 -0
  34. package/dist/components/PopupBox.d.ts +14 -0
  35. package/dist/components/PopupBox.js +41 -0
  36. package/dist/components/RadioButtons.d.ts +13 -0
  37. package/dist/components/RadioButtons.js +64 -0
  38. package/dist/components/SearchableSelectBox.d.ts +14 -0
  39. package/dist/components/SearchableSelectBox.js +61 -0
  40. package/dist/components/SelectBox.d.ts +16 -0
  41. package/dist/components/SelectBox.js +107 -0
  42. package/dist/components/SlideDownUi.d.ts +17 -0
  43. package/dist/components/SlideDownUi.js +86 -0
  44. package/dist/components/TabUI.d.ts +18 -0
  45. package/dist/components/TabUI.js +76 -0
  46. package/dist/components/TextArea.d.ts +18 -0
  47. package/dist/components/TextArea.js +75 -0
  48. package/dist/components/TextBox.d.ts +20 -0
  49. package/dist/components/TextBox.js +90 -0
  50. package/dist/components/ToggleButton.d.ts +15 -0
  51. package/dist/components/ToggleButton.js +92 -0
  52. package/dist/components/icons/BackupIcon.d.ts +5 -0
  53. package/dist/components/icons/BackupIcon.js +16 -0
  54. package/dist/components/icons/CalendarIcon.d.ts +5 -0
  55. package/dist/components/icons/CalendarIcon.js +15 -0
  56. package/dist/components/icons/CheckIcon.d.ts +1 -0
  57. package/dist/components/icons/CheckIcon.js +7 -0
  58. package/dist/components/icons/CloseIcon.d.ts +5 -0
  59. package/dist/components/icons/CloseIcon.js +16 -0
  60. package/dist/components/icons/KeyboardArrowDownIcon.d.ts +5 -0
  61. package/dist/components/icons/KeyboardArrowDownIcon.js +16 -0
  62. package/dist/constants/index.d.ts +1 -0
  63. package/dist/hooks/useFormValidation.d.ts +33 -0
  64. package/dist/hooks/useFormValidation.js +28 -0
  65. package/dist/index.d.ts +38 -0
  66. package/dist/index.js +70 -0
  67. package/{src → dist}/styles/tokens.css +1 -1
  68. package/dist/types/index.d.ts +1 -0
  69. package/package.json +17 -12
  70. package/src/components/BasicButton.tsx +0 -81
  71. package/src/components/CheckBox.tsx +0 -87
  72. package/src/components/CheckBoxes.tsx +0 -93
  73. package/src/components/CheckButton.tsx +0 -66
  74. package/src/components/DatePicker.tsx +0 -154
  75. package/src/components/DateRangePicker.tsx +0 -59
  76. package/src/components/DateSelector.tsx +0 -162
  77. package/src/components/DropdownUi.tsx +0 -126
  78. package/src/components/ErrorMessage.tsx +0 -30
  79. package/src/components/FileInput.tsx +0 -93
  80. package/src/components/InputBox.tsx +0 -118
  81. package/src/components/InputGroup.tsx +0 -13
  82. package/src/components/LabeledCheckbox.tsx +0 -61
  83. package/src/components/LabeledFieldset.tsx +0 -18
  84. package/src/components/LoadingSpinner.tsx +0 -23
  85. package/src/components/ModalBox.tsx +0 -109
  86. package/src/components/PopupBox.tsx +0 -70
  87. package/src/components/RadioButtons.tsx +0 -94
  88. package/src/components/SearchableSelectBox.tsx +0 -108
  89. package/src/components/SelectBox.tsx +0 -152
  90. package/src/components/SlideDownUi.tsx +0 -123
  91. package/src/components/TabUI.tsx +0 -112
  92. package/src/components/TextArea.tsx +0 -102
  93. package/src/components/TextBox.tsx +0 -120
  94. package/src/components/ToggleButton.tsx +0 -102
  95. package/src/components/icons/BackupIcon.tsx +0 -16
  96. package/src/components/icons/CalendarIcon.tsx +0 -15
  97. package/src/components/icons/CheckIcon.tsx +0 -7
  98. package/src/components/icons/CloseIcon.tsx +0 -16
  99. package/src/components/icons/KeyboardArrowDownIcon.tsx +0 -16
  100. package/src/constants/index.ts +0 -2
  101. package/src/hooks/useFormValidation.ts +0 -69
  102. package/src/index.ts +0 -66
  103. package/src/types/index.ts +0 -23
@@ -0,0 +1,83 @@
1
+ "use client";
2
+ import { jsx as e, jsxs as c } from "react/jsx-runtime";
3
+ import { useId as p, useRef as f, useEffect as d } from "react";
4
+ const v = {
5
+ small: "max-w-[var(--mobile-lower-width,430px)]",
6
+ medium: "max-w-[var(--desktop-lower-width,1025px)]",
7
+ large: "max-w-[var(--contents-max-width,1440px)]"
8
+ };
9
+ function x() {
10
+ return /* @__PURE__ */ e(
11
+ "svg",
12
+ {
13
+ xmlns: "http://www.w3.org/2000/svg",
14
+ viewBox: "0 -960 960 960",
15
+ fill: "currentColor",
16
+ children: /* @__PURE__ */ e("path", { d: "m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z" })
17
+ }
18
+ );
19
+ }
20
+ function w({
21
+ isShown: r,
22
+ size: s = "medium",
23
+ onClose: t,
24
+ header: l,
25
+ footer: o,
26
+ children: u,
27
+ ariaLabel: n
28
+ }) {
29
+ const i = p(), m = f(null);
30
+ return d(() => (r ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
31
+ document.body.style.overflow = "";
32
+ }), [r]), d(() => {
33
+ var a;
34
+ r && ((a = m.current) == null || a.focus());
35
+ }, [r]), /* @__PURE__ */ e(
36
+ "div",
37
+ {
38
+ className: `fixed top-0 left-0 z-50 flex h-dvh w-dvw cursor-pointer items-center justify-center overflow-hidden bg-[#33333380] p-[var(--sp-larger,3rem)] backdrop-blur-sm transition-opacity duration-100 max-md:px-[var(--sp-large,1.5rem)] ${r ? "pointer-events-auto opacity-100" : "pointer-events-none opacity-0"}`,
39
+ "aria-hidden": !r,
40
+ inert: !r,
41
+ onClick: (a) => {
42
+ a.target === a.currentTarget && t();
43
+ },
44
+ children: /* @__PURE__ */ c(
45
+ "div",
46
+ {
47
+ ref: m,
48
+ role: "dialog",
49
+ "aria-modal": "true",
50
+ "aria-labelledby": l ? i : void 0,
51
+ "aria-label": l ? void 0 : n ?? "ダイアログ",
52
+ tabIndex: -1,
53
+ className: `relative flex max-h-full w-full cursor-auto flex-col rounded-[var(--radius-small,0.1875rem)] bg-white drop-shadow-[0_0_6px_#33333355] ${v[s]}`,
54
+ children: [
55
+ l && /* @__PURE__ */ e(
56
+ "header",
57
+ {
58
+ id: i,
59
+ className: "border-b border-[#eee] px-[var(--sp-large,1.5rem)] py-[var(--sp-medium,0.75rem)] max-md:p-[var(--sp-medium,0.75rem)] [&>h2]:font-bold [&>h2]:text-[var(--fs-large,0.875rem)]",
60
+ children: l
61
+ }
62
+ ),
63
+ /* @__PURE__ */ e("div", { className: "flex-auto overflow-auto p-[var(--sp-large,1.5rem)] max-md:p-[var(--sp-medium,0.75rem)]", children: u }),
64
+ o && /* @__PURE__ */ e("footer", { className: "flex justify-center gap-[var(--sp-large,1.5rem)] border-t border-[#eee] px-[var(--sp-large,1.5rem)] py-[var(--sp-medium,0.75rem)] max-md:gap-[var(--sp-medium,0.75rem)] max-md:p-[var(--sp-medium,0.75rem)] max-md:[&>*]:flex-auto", children: o }),
65
+ /* @__PURE__ */ e(
66
+ "button",
67
+ {
68
+ type: "button",
69
+ "aria-label": "閉じる",
70
+ className: "absolute bottom-full left-full size-[var(--icon-medium,1.125rem)] cursor-pointer leading-none text-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white [&>*]:size-full",
71
+ onClick: t,
72
+ children: /* @__PURE__ */ e(x, {})
73
+ }
74
+ )
75
+ ]
76
+ }
77
+ )
78
+ }
79
+ );
80
+ }
81
+ export {
82
+ w as ModalBox
83
+ };
@@ -0,0 +1,14 @@
1
+ import { ReactNode, Ref } from 'react';
2
+ export type PopupBoxHandle = {
3
+ showPopup: () => void;
4
+ };
5
+ type Props = {
6
+ position?: {
7
+ x: 'left' | 'right' | 'center';
8
+ y: 'top' | 'bottom' | 'center';
9
+ };
10
+ ref?: Ref<PopupBoxHandle>;
11
+ children: ReactNode;
12
+ };
13
+ export declare function PopupBox({ position, ref, children, }: Props): import('react').ReactPortal | null;
14
+ export {};
@@ -0,0 +1,41 @@
1
+ "use client";
2
+ import { jsx as i } from "react/jsx-runtime";
3
+ import { useState as o, useRef as c, useEffect as l, useImperativeHandle as f } from "react";
4
+ import { createPortal as p } from "react-dom";
5
+ import { COLOR as d } from "@geckou/ui-core";
6
+ const x = {
7
+ left: "left-[max(calc((100vw-64rem)/2),1rem)]",
8
+ right: "right-[max(calc((100vw-64rem)/2),1rem)]",
9
+ center: "inset-0 m-auto"
10
+ }, S = {
11
+ top: "top-14",
12
+ bottom: "bottom-4",
13
+ center: "inset-0 m-auto"
14
+ };
15
+ function y({
16
+ position: t = { x: "right", y: "top" },
17
+ ref: n,
18
+ children: m
19
+ }) {
20
+ const [u, r] = o(!1), [s, a] = o(!1), e = c(null);
21
+ return l(() => (a(!0), () => {
22
+ e.current && clearTimeout(e.current);
23
+ }), []), f(n, () => ({
24
+ showPopup: () => {
25
+ r(!0), e.current && clearTimeout(e.current), e.current = setTimeout(() => r(!1), 3e3);
26
+ }
27
+ })), s ? p(
28
+ /* @__PURE__ */ i(
29
+ "div",
30
+ {
31
+ style: { borderColor: d.blue },
32
+ className: `pointer-events-none fixed z-50 h-max w-max max-w-40 rounded-[var(--radius-small,0.1875rem)] border bg-white p-[var(--sp-medium,0.75rem)] transition-[transform,opacity] duration-300 ${x[t.x]} ${S[t.y]} ${u ? "opacity-100" : "opacity-0"}`,
33
+ children: m
34
+ }
35
+ ),
36
+ document.body
37
+ ) : null;
38
+ }
39
+ export {
40
+ y as PopupBox
41
+ };
@@ -0,0 +1,13 @@
1
+ import { Option, RadioButtonStyleForEachStatus, SelectValue } from '../types';
2
+ type Props = {
3
+ value: SelectValue;
4
+ onChange?: (newValue: SelectValue) => void;
5
+ options: Option[];
6
+ name?: string;
7
+ isDisabled?: boolean;
8
+ isRequired?: boolean;
9
+ cssStyle?: RadioButtonStyleForEachStatus;
10
+ isDisableAnimation?: boolean;
11
+ };
12
+ export declare function RadioButtons({ value, onChange, options, name, isDisabled, isRequired, cssStyle, isDisableAnimation, }: Props): import("react").JSX.Element;
13
+ export {};
@@ -0,0 +1,64 @@
1
+ "use client";
2
+ import { jsxs as n, jsx as c } from "react/jsx-runtime";
3
+ import { useId as h } from "react";
4
+ import { COLOR as r } from "@geckou/ui-core";
5
+ function R({
6
+ value: s,
7
+ onChange: t,
8
+ options: b,
9
+ name: f,
10
+ isDisabled: o,
11
+ isRequired: p,
12
+ cssStyle: e,
13
+ isDisableAnimation: m
14
+ }) {
15
+ var d, i;
16
+ const _ = s ?? "", x = h(), v = f ?? x, k = o ? e == null ? void 0 : e.disabled : e == null ? void 0 : e.default, l = {
17
+ textColor: o ? r.darkGray : r.black,
18
+ backgroundColor: o ? r.lightGray : r.white,
19
+ border: {
20
+ color: o ? r.darkGray : r.blue,
21
+ size: "1px"
22
+ },
23
+ ...k ?? {}
24
+ }, g = {
25
+ "--text-color": l.textColor,
26
+ "--border-color": (d = l.border) == null ? void 0 : d.color,
27
+ "--border-size": (i = l.border) == null ? void 0 : i.size,
28
+ "--background-color": l.backgroundColor,
29
+ "--duration": m ? "0s" : ".3s"
30
+ };
31
+ return /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-4", children: [
32
+ /* @__PURE__ */ c("style", { children: "@keyframes uiRadioPop{0%{scale:1}10%{scale:.8}50%{scale:1.2}100%{scale:1}}" }),
33
+ b.map((a) => {
34
+ const u = a.value === _;
35
+ return /* @__PURE__ */ n(
36
+ "label",
37
+ {
38
+ style: g,
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) ${u ? "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
+ children: [
41
+ /* @__PURE__ */ c(
42
+ "input",
43
+ {
44
+ type: "radio",
45
+ name: v,
46
+ value: a.value,
47
+ disabled: o,
48
+ required: p,
49
+ checked: u,
50
+ onChange: () => t == null ? void 0 : t(a.value),
51
+ className: "sr-only"
52
+ }
53
+ ),
54
+ /* @__PURE__ */ c("span", { children: a.label })
55
+ ]
56
+ },
57
+ a.value
58
+ );
59
+ })
60
+ ] });
61
+ }
62
+ export {
63
+ R as RadioButtons
64
+ };
@@ -0,0 +1,14 @@
1
+ import { InputBoxStyleForEachStatus, Option } from '../types';
2
+ type Props = {
3
+ options: Option[];
4
+ value: string;
5
+ onChange?: (newValue: string) => void;
6
+ onSelect?: (newValue: string) => void;
7
+ name: string;
8
+ placeholder?: string;
9
+ isDisabled?: boolean;
10
+ searchTarget?: 'label' | 'value';
11
+ cssStyle?: InputBoxStyleForEachStatus;
12
+ };
13
+ export declare function SearchableSelectBox({ options, value, onChange, onSelect, name, placeholder, isDisabled, searchTarget, cssStyle, }: Props): import("react").JSX.Element;
14
+ export {};
@@ -0,0 +1,61 @@
1
+ "use client";
2
+ import { jsxs as N, jsx as n } from "react/jsx-runtime";
3
+ import { useState as p, useRef as v, useEffect as w } from "react";
4
+ import { TextBox as S } from "./TextBox.js";
5
+ function F({
6
+ options: i,
7
+ value: t,
8
+ onChange: s,
9
+ onSelect: o,
10
+ name: x,
11
+ placeholder: b = "入力してください",
12
+ isDisabled: h,
13
+ searchTarget: E = "label",
14
+ cssStyle: O
15
+ }) {
16
+ const [l, a] = p(t), [k, c] = p(!1), u = v(null), d = v(t);
17
+ w(() => {
18
+ d.current !== t && (d.current = t, a(t));
19
+ }, [t]), w(() => {
20
+ const e = (r) => {
21
+ const f = u.current;
22
+ f && !f.contains(r.target) && c(!1);
23
+ };
24
+ return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
25
+ }, []);
26
+ const m = l ? i.filter(
27
+ (e) => String(e[E]).toLowerCase().includes(l.toLowerCase())
28
+ ) : i, B = (e) => {
29
+ const r = String(e);
30
+ a(r), c(!!r), s == null || s(r);
31
+ }, L = (e) => {
32
+ const r = e.value.toString();
33
+ a(r), c(!1), s == null || s(r), o == null || o(r);
34
+ };
35
+ return /* @__PURE__ */ N("div", { ref: u, className: "relative", children: [
36
+ /* @__PURE__ */ n(
37
+ S,
38
+ {
39
+ name: x,
40
+ value: l,
41
+ onChange: B,
42
+ isDisabled: h,
43
+ placeholder: b,
44
+ cssStyle: O
45
+ }
46
+ ),
47
+ k && m.length > 0 && /* @__PURE__ */ n("div", { 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]", children: m.map((e) => /* @__PURE__ */ n(
48
+ "button",
49
+ {
50
+ type: "button",
51
+ 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",
52
+ onClick: () => L(e),
53
+ children: e.label
54
+ },
55
+ e.value
56
+ )) })
57
+ ] });
58
+ }
59
+ export {
60
+ F as SearchableSelectBox
61
+ };
@@ -0,0 +1,16 @@
1
+ import { ReactNode } from 'react';
2
+ import { Option, InputBoxStyleForEachStatus, SelectValue } from '../types';
3
+ type Props = {
4
+ options: Array<Option | Record<string, Option[]>>;
5
+ name: string;
6
+ value?: SelectValue;
7
+ onChange?: (newValue: SelectValue) => void;
8
+ cssStyle?: InputBoxStyleForEachStatus;
9
+ placeholder?: string;
10
+ canOmitSelect?: boolean;
11
+ isDisabled?: boolean;
12
+ isRequired?: boolean;
13
+ arrow?: ReactNode;
14
+ };
15
+ export declare function SelectBox({ options, name, value, onChange, cssStyle, placeholder, canOmitSelect, isDisabled, isRequired, arrow, }: Props): import("react").JSX.Element;
16
+ export {};
@@ -0,0 +1,107 @@
1
+ "use client";
2
+ import { jsxs as f, jsx as r } from "react/jsx-runtime";
3
+ import { MESSAGES as I } from "@geckou/ui-core";
4
+ import { useState as O, useRef as x, useEffect as V, Fragment as q } from "react";
5
+ import { InputBox as w } from "./InputBox.js";
6
+ import { ErrorMessage as D } from "./ErrorMessage.js";
7
+ import { KeyboardArrowDownIcon as F } from "./icons/KeyboardArrowDownIcon.js";
8
+ function p(t) {
9
+ return typeof t == "object" && t !== null && "label" in t && typeof t.label == "string" && "value" in t;
10
+ }
11
+ function P({
12
+ options: t,
13
+ name: g,
14
+ value: E,
15
+ onChange: u,
16
+ cssStyle: a,
17
+ placeholder: o = "選択してください",
18
+ canOmitSelect: M,
19
+ isDisabled: s,
20
+ isRequired: m,
21
+ arrow: A
22
+ }) {
23
+ var b, h;
24
+ const [B, C] = O([]), l = E ?? "", c = () => {
25
+ const e = [];
26
+ l === "" && m && e.push(I.required), C(e);
27
+ }, N = x(l), v = x(!1);
28
+ V(() => {
29
+ if (!v.current) {
30
+ if (l === N.current) {
31
+ l !== "" && c();
32
+ return;
33
+ }
34
+ v.current = !0;
35
+ }
36
+ c();
37
+ }, [l]);
38
+ const j = t.flatMap(
39
+ (e) => p(e) ? [e] : Object.values(e).flat()
40
+ ), k = (e) => {
41
+ const n = j.find(
42
+ (d) => String(d.value) === e
43
+ );
44
+ u == null || u(n ? n.value : e);
45
+ };
46
+ return /* @__PURE__ */ f(
47
+ w,
48
+ {
49
+ cssStyle: a,
50
+ className: "inline-flex [&>select]:flex-auto [&>select]:cursor-pointer [&>select]:pe-8",
51
+ isDisabled: s,
52
+ children: [
53
+ /* @__PURE__ */ f(
54
+ "select",
55
+ {
56
+ name: g,
57
+ value: l,
58
+ disabled: s,
59
+ required: m,
60
+ onChange: (e) => k(e.target.value),
61
+ onBlur: () => c(),
62
+ children: [
63
+ M ? /* @__PURE__ */ r("option", { value: "", children: o || "選択しない" }) : /* @__PURE__ */ r("option", { disabled: !0, value: "", children: o || "選択してください" }),
64
+ ["0", "NA"].includes(l.toString()) && s && /* @__PURE__ */ r("option", { disabled: !0, value: l, children: o || "選択してください" }),
65
+ t.map(
66
+ (e) => p(e) ? /* @__PURE__ */ r(
67
+ "option",
68
+ {
69
+ value: e.value,
70
+ disabled: e.isDisabled,
71
+ children: e.label
72
+ },
73
+ e.value
74
+ ) : /* @__PURE__ */ f(q, { children: [
75
+ Object.entries(e).map(([n, d]) => /* @__PURE__ */ r("optgroup", { label: n, children: d.map((i) => /* @__PURE__ */ r(
76
+ "option",
77
+ {
78
+ value: i.value,
79
+ disabled: i.isDisabled,
80
+ children: i.label
81
+ },
82
+ i.value
83
+ )) }, n)),
84
+ /* @__PURE__ */ r("hr", {})
85
+ ] }, Object.keys(e)[0])
86
+ )
87
+ ]
88
+ }
89
+ ),
90
+ /* @__PURE__ */ r("div", { className: "pointer-events-none absolute inset-y-0 end-2 flex items-center [&>*]:h-4 [&>*]:fill-current [&>*]:text-current", children: A ?? /* @__PURE__ */ r(F, {}) }),
91
+ /* @__PURE__ */ r(
92
+ D,
93
+ {
94
+ errorMessages: B,
95
+ cssStyle: {
96
+ textColor: (b = a == null ? void 0 : a.error) == null ? void 0 : b.backgroundColor,
97
+ backgroundColor: (h = a == null ? void 0 : a.error) == null ? void 0 : h.textColor
98
+ }
99
+ }
100
+ )
101
+ ]
102
+ }
103
+ );
104
+ }
105
+ export {
106
+ P as SelectBox
107
+ };
@@ -0,0 +1,17 @@
1
+ import { ReactNode, Ref } from 'react';
2
+ export type SlideDownUiHandle = {
3
+ isOpenedContents: () => boolean;
4
+ close: () => void;
5
+ };
6
+ type Props = {
7
+ isOpened?: boolean | null;
8
+ isHiddenArrow?: boolean;
9
+ isDisabled?: boolean;
10
+ isDisableClickOutside?: boolean;
11
+ duration?: number;
12
+ trigger: ReactNode;
13
+ children: ReactNode;
14
+ ref?: Ref<SlideDownUiHandle>;
15
+ };
16
+ export declare function SlideDownUi({ isOpened, isHiddenArrow, isDisabled, isDisableClickOutside, duration, trigger, children, ref, }: Props): import("react").JSX.Element;
17
+ export {};
@@ -0,0 +1,86 @@
1
+ "use client";
2
+ import { jsxs as v, jsx as i } from "react/jsx-runtime";
3
+ import { useState as a, useRef as h, useImperativeHandle as E, useEffect as l } from "react";
4
+ import { KeyboardArrowDownIcon as I } from "./icons/KeyboardArrowDownIcon.js";
5
+ import { COLOR as N } from "@geckou/ui-core";
6
+ function $({
7
+ isOpened: n = null,
8
+ isHiddenArrow: p = !1,
9
+ isDisabled: b = !1,
10
+ isDisableClickOutside: f = !1,
11
+ duration: c = 0.3,
12
+ trigger: g,
13
+ children: w,
14
+ ref: x
15
+ }) {
16
+ const [t, r] = a(n || !1), [C, u] = a(n || !1), [y, H] = a(0), d = h(null), m = h(null), R = () => r((e) => !e);
17
+ E(x, () => ({
18
+ isOpenedContents: () => t,
19
+ close: () => r(!1)
20
+ })), l(() => {
21
+ typeof n == "boolean" && r(n);
22
+ }, [n]), l(() => {
23
+ if (f)
24
+ return;
25
+ const e = (s) => {
26
+ const o = d.current;
27
+ o && !o.contains(s.target) && r(!1);
28
+ };
29
+ return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
30
+ }, [f]), l(() => {
31
+ const e = m.current;
32
+ if (!e)
33
+ return;
34
+ const s = () => H(e.clientHeight);
35
+ s();
36
+ const o = new ResizeObserver(s);
37
+ return o.observe(e), () => o.disconnect();
38
+ }, []), l(() => {
39
+ if (!t) {
40
+ u(!1);
41
+ return;
42
+ }
43
+ const e = setTimeout(() => u(!0), c * 1e3);
44
+ return () => clearTimeout(e);
45
+ }, [t, c]);
46
+ const k = { "--link-color": N.blue };
47
+ return /* @__PURE__ */ v("div", { ref: d, style: k, children: [
48
+ /* @__PURE__ */ v(
49
+ "button",
50
+ {
51
+ type: "button",
52
+ disabled: b,
53
+ "aria-expanded": t,
54
+ className: "relative grid w-full cursor-pointer grid-cols-[1fr_auto] items-center justify-items-start text-(--link-color)",
55
+ onClick: (e) => {
56
+ e.preventDefault(), R();
57
+ },
58
+ children: [
59
+ /* @__PURE__ */ i("div", { className: "w-full text-left", children: g }),
60
+ !p && /* @__PURE__ */ i(
61
+ I,
62
+ {
63
+ className: `size-[var(--icon-medium,1.125rem)] flex-none text-(--link-color) transition-all duration-100 ${t ? "rotate-180" : ""}`
64
+ }
65
+ )
66
+ ]
67
+ }
68
+ ),
69
+ /* @__PURE__ */ i(
70
+ "div",
71
+ {
72
+ style: {
73
+ height: t ? `${y}px` : 0,
74
+ transitionDuration: `${c}s`,
75
+ overflow: C ? "visible" : "hidden"
76
+ },
77
+ inert: !t,
78
+ className: "transition-[height]",
79
+ children: /* @__PURE__ */ i("div", { ref: m, children: w })
80
+ }
81
+ )
82
+ ] });
83
+ }
84
+ export {
85
+ $ as SlideDownUi
86
+ };
@@ -0,0 +1,18 @@
1
+ import { ReactNode } from 'react';
2
+ type Tab = {
3
+ key: string;
4
+ label: string;
5
+ };
6
+ type Props = {
7
+ tabs: Tab[];
8
+ color?: {
9
+ active: string;
10
+ background: string;
11
+ text: string;
12
+ };
13
+ initialIndex?: number;
14
+ tabSlots?: Record<string, ReactNode>;
15
+ panelSlots?: Record<string, ReactNode>;
16
+ };
17
+ export declare function TabUI({ tabs, color, initialIndex, tabSlots, panelSlots, }: Props): import("react").JSX.Element;
18
+ export {};
@@ -0,0 +1,76 @@
1
+ "use client";
2
+ import { jsxs as I, jsx as k } from "react/jsx-runtime";
3
+ import { useState as $, useRef as v, useId as w } from "react";
4
+ import { COLOR as T } from "@geckou/ui-core";
5
+ function C({
6
+ tabs: r,
7
+ color: t,
8
+ initialIndex: p = 0,
9
+ tabSlots: d,
10
+ panelSlots: y
11
+ }) {
12
+ const [c, o] = $(
13
+ () => {
14
+ var e, n;
15
+ return ((e = r[p]) == null ? void 0 : e.key) ?? ((n = r[0]) == null ? void 0 : n.key) ?? "";
16
+ }
17
+ ), s = v([]), a = w(), u = (e) => `${a}-tab-${e}`, f = (e) => `${a}-panel-${e}`, m = (e) => o(e), l = (e) => {
18
+ var n;
19
+ o(r[e].key), (n = s.current[e]) == null || n.focus();
20
+ }, h = (e) => {
21
+ if (e.key !== "ArrowLeft" && e.key !== "ArrowRight")
22
+ return;
23
+ const n = r.findIndex((g) => g.key === c);
24
+ if (n === -1)
25
+ return;
26
+ e.preventDefault();
27
+ const i = r.length - 1;
28
+ e.key === "ArrowLeft" ? l(n > 0 ? n - 1 : i) : l(n < i ? n + 1 : 0);
29
+ }, x = {
30
+ "--active-color": (t == null ? void 0 : t.active) || T.blue,
31
+ "--background-color": (t == null ? void 0 : t.background) || "transparent"
32
+ };
33
+ return /* @__PURE__ */ I("div", { children: [
34
+ /* @__PURE__ */ k(
35
+ "div",
36
+ {
37
+ style: x,
38
+ className: "flex bg-(--background-color)",
39
+ role: "tablist",
40
+ onKeyDown: h,
41
+ children: r.map((e, n) => /* @__PURE__ */ k(
42
+ "button",
43
+ {
44
+ id: u(e.key),
45
+ ref: (i) => {
46
+ s.current[n] = i;
47
+ },
48
+ type: "button",
49
+ role: "tab",
50
+ "aria-controls": f(e.key),
51
+ "aria-selected": c === e.key,
52
+ tabIndex: c === e.key ? 0 : -1,
53
+ className: `border-none bg-transparent px-4 py-2 text-base ${c === e.key ? "cursor-auto" : "cursor-pointer"}`,
54
+ onClick: () => m(e.key),
55
+ children: (d == null ? void 0 : d[e.key]) ?? e.label
56
+ },
57
+ e.key
58
+ ))
59
+ }
60
+ ),
61
+ r.map((e) => /* @__PURE__ */ k(
62
+ "div",
63
+ {
64
+ id: f(e.key),
65
+ role: "tabpanel",
66
+ "aria-labelledby": u(e.key),
67
+ hidden: c !== e.key,
68
+ children: y == null ? void 0 : y[`${e.key}Contents`]
69
+ },
70
+ `${e.key}_panel`
71
+ ))
72
+ ] });
73
+ }
74
+ export {
75
+ C as TabUI
76
+ };
@@ -0,0 +1,18 @@
1
+ import { InputBoxStyleForEachStatus, Validates } from '../types';
2
+ type InputValue = string | null;
3
+ type Props = {
4
+ name: string;
5
+ value?: InputValue;
6
+ onChange?: (newValue: InputValue) => void;
7
+ cssStyle?: InputBoxStyleForEachStatus;
8
+ placeholder?: string;
9
+ isDisabled?: boolean;
10
+ isRequired?: boolean;
11
+ rows?: number;
12
+ maxLength?: number;
13
+ autocomplete?: string;
14
+ validates?: Validates;
15
+ autoAdjustHeight?: boolean;
16
+ };
17
+ export declare function TextArea({ name, value, onChange, cssStyle, placeholder, isDisabled, isRequired, rows, maxLength, autocomplete, validates, autoAdjustHeight, }: Props): import("react").JSX.Element;
18
+ export {};