@k8o/arte-odyssey 0.0.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/LICENSE +21 -0
- package/dist/components/accordion/accordion-button.d.ts +2 -0
- package/dist/components/accordion/accordion-button.js +40 -0
- package/dist/components/accordion/accordion-item.d.ts +4 -0
- package/dist/components/accordion/accordion-item.js +11 -0
- package/dist/components/accordion/accordion-panel.d.ts +2 -0
- package/dist/components/accordion/accordion-panel.js +21 -0
- package/dist/components/accordion/accordion.d.ts +2 -0
- package/dist/components/accordion/accordion.js +17 -0
- package/dist/components/accordion/accordion.stories.js +89 -0
- package/dist/components/accordion/context.d.ts +10 -0
- package/dist/components/accordion/context.js +38 -0
- package/dist/components/accordion/index.d.ts +4 -0
- package/dist/components/accordion/index.js +4 -0
- package/dist/components/alert/alert.d.ts +8 -0
- package/dist/components/alert/alert.js +46 -0
- package/dist/components/alert/alert.stories.js +51 -0
- package/dist/components/alert/index.d.ts +1 -0
- package/dist/components/alert/index.js +1 -0
- package/dist/components/anchor/anchor.d.ts +14 -0
- package/dist/components/anchor/anchor.js +31 -0
- package/dist/components/anchor/anchor.stories.js +23 -0
- package/dist/components/anchor/index.d.ts +1 -0
- package/dist/components/anchor/index.js +1 -0
- package/dist/components/baseline-status/baseline-status.d.ts +16 -0
- package/dist/components/baseline-status/baseline-status.js +39 -0
- package/dist/components/baseline-status/baseline-status.stories.js +15 -0
- package/dist/components/baseline-status/index.d.ts +1 -0
- package/dist/components/baseline-status/index.js +1 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +18 -0
- package/dist/components/breadcrumb/breadcrumb.js +36 -0
- package/dist/components/breadcrumb/breadcrumb.stories.js +40 -0
- package/dist/components/breadcrumb/index.d.ts +1 -0
- package/dist/components/breadcrumb/index.js +1 -0
- package/dist/components/button/button.d.ts +10 -0
- package/dist/components/button/button.js +55 -0
- package/dist/components/button/button.stories.js +96 -0
- package/dist/components/button/index.d.ts +1 -0
- package/dist/components/button/index.js +1 -0
- package/dist/components/card/card.d.ts +3 -0
- package/dist/components/card/card.js +26 -0
- package/dist/components/card/card.stories.js +38 -0
- package/dist/components/card/index.d.ts +2 -0
- package/dist/components/card/index.js +2 -0
- package/dist/components/card/interactive-card.d.ts +3 -0
- package/dist/components/card/interactive-card.js +34 -0
- package/dist/components/card/type.d.ts +6 -0
- package/dist/components/card/type.js +0 -0
- package/dist/components/code/code.d.ts +4 -0
- package/dist/components/code/code.js +38 -0
- package/dist/components/code/code.stories.js +60 -0
- package/dist/components/code/index.d.ts +1 -0
- package/dist/components/code/index.js +4 -0
- package/dist/components/dialog/dialog.d.ts +17 -0
- package/dist/components/dialog/dialog.js +85 -0
- package/dist/components/dialog/dialog.stories.js +98 -0
- package/dist/components/dialog/index.d.ts +1 -0
- package/dist/components/dialog/index.js +1 -0
- package/dist/components/drawer/drawer.d.ts +6 -0
- package/dist/components/drawer/drawer.js +56 -0
- package/dist/components/drawer/drawer.stories.js +25 -0
- package/dist/components/drawer/index.d.ts +1 -0
- package/dist/components/drawer/index.js +1 -0
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +24 -0
- package/dist/components/dropdown-menu/dropdown-menu.js +130 -0
- package/dist/components/dropdown-menu/dropdown-menu.stories.js +111 -0
- package/dist/components/dropdown-menu/hooks.d.ts +23 -0
- package/dist/components/dropdown-menu/hooks.js +56 -0
- package/dist/components/dropdown-menu/index.d.ts +1 -0
- package/dist/components/dropdown-menu/index.js +1 -0
- package/dist/components/error-boundary/index.d.ts +1 -0
- package/dist/components/error-boundary/index.js +4 -0
- package/dist/components/form/autocomplete/autocomplete.d.ts +14 -0
- package/dist/components/form/autocomplete/autocomplete.js +225 -0
- package/dist/components/form/autocomplete/autocomplete.stories.js +59 -0
- package/dist/components/form/autocomplete/index.d.ts +1 -0
- package/dist/components/form/autocomplete/index.js +1 -0
- package/dist/components/form/checkbox/checkbox.d.ts +8 -0
- package/dist/components/form/checkbox/checkbox.js +40 -0
- package/dist/components/form/checkbox/checkbox.stories.js +27 -0
- package/dist/components/form/checkbox/index.d.ts +1 -0
- package/dist/components/form/checkbox/index.js +1 -0
- package/dist/components/form/form-control/form-control.d.ts +20 -0
- package/dist/components/form/form-control/form-control.js +53 -0
- package/dist/components/form/form-control/form-control.stories.js +94 -0
- package/dist/components/form/form-control/index.d.ts +1 -0
- package/dist/components/form/form-control/index.js +1 -0
- package/dist/components/form/number-field/index.d.ts +1 -0
- package/dist/components/form/number-field/index.js +1 -0
- package/dist/components/form/number-field/number-field.d.ts +17 -0
- package/dist/components/form/number-field/number-field.js +150 -0
- package/dist/components/form/number-field/number-field.stories.js +106 -0
- package/dist/components/form/radio/index.d.ts +1 -0
- package/dist/components/form/radio/index.js +1 -0
- package/dist/components/form/radio/radio.d.ts +11 -0
- package/dist/components/form/radio/radio.js +51 -0
- package/dist/components/form/radio/radio.stories.js +55 -0
- package/dist/components/form/range-field/index.d.ts +1 -0
- package/dist/components/form/range-field/index.js +4 -0
- package/dist/components/form/range-field/range-field.d.ts +17 -0
- package/dist/components/form/range-field/range-field.js +54 -0
- package/dist/components/form/range-field/range-field.stories.js +162 -0
- package/dist/components/form/select/index.d.ts +1 -0
- package/dist/components/form/select/index.js +1 -0
- package/dist/components/form/select/select.d.ts +14 -0
- package/dist/components/form/select/select.js +39 -0
- package/dist/components/form/select/select.stories.js +58 -0
- package/dist/components/form/text-field/index.d.ts +1 -0
- package/dist/components/form/text-field/index.js +1 -0
- package/dist/components/form/text-field/text-field.d.ts +15 -0
- package/dist/components/form/text-field/text-field.js +40 -0
- package/dist/components/form/text-field/text-field.stories.js +61 -0
- package/dist/components/form/textarea/index.d.ts +1 -0
- package/dist/components/form/textarea/index.js +1 -0
- package/dist/components/form/textarea/textarea.d.ts +18 -0
- package/dist/components/form/textarea/textarea.js +56 -0
- package/dist/components/form/textarea/textarea.stories.js +92 -0
- package/dist/components/heading/heading.d.ts +8 -0
- package/dist/components/heading/heading.js +77 -0
- package/dist/components/heading/heading.stories.js +52 -0
- package/dist/components/heading/index.d.ts +1 -0
- package/dist/components/heading/index.js +1 -0
- package/dist/components/icon-button/icon-button.d.ts +8 -0
- package/dist/components/icon-button/icon-button.js +38 -0
- package/dist/components/icon-button/icon-button.stories.js +54 -0
- package/dist/components/icon-button/index.d.ts +1 -0
- package/dist/components/icon-button/index.js +1 -0
- package/dist/components/icon-link/icon-link.d.ts +17 -0
- package/dist/components/icon-link/icon-link.js +37 -0
- package/dist/components/icon-link/icon-link.stories.js +40 -0
- package/dist/components/icon-link/index.d.ts +1 -0
- package/dist/components/icon-link/index.js +1 -0
- package/dist/components/icons/arte-odyssey.d.ts +3 -0
- package/dist/components/icons/arte-odyssey.js +463 -0
- package/dist/components/icons/base.d.ts +9 -0
- package/dist/components/icons/base.js +13 -0
- package/dist/components/icons/github-mark.d.ts +3 -0
- package/dist/components/icons/github-mark.js +33 -0
- package/dist/components/icons/icons.stories.js +276 -0
- package/dist/components/icons/index.d.ts +7 -0
- package/dist/components/icons/index.js +7 -0
- package/dist/components/icons/logo.d.ts +6 -0
- package/dist/components/icons/logo.js +50 -0
- package/dist/components/icons/lucide.d.ts +50 -0
- package/dist/components/icons/lucide.js +569 -0
- package/dist/components/icons/qiita.d.ts +3 -0
- package/dist/components/icons/qiita.js +48 -0
- package/dist/components/icons/twitter.d.ts +3 -0
- package/dist/components/icons/twitter.js +34 -0
- package/dist/components/icons/zenn.d.ts +6 -0
- package/dist/components/icons/zenn.js +41 -0
- package/dist/components/index.d.ts +37 -0
- package/dist/components/index.js +37 -0
- package/dist/components/link-button/index.d.ts +1 -0
- package/dist/components/link-button/index.js +1 -0
- package/dist/components/link-button/link-button.d.ts +19 -0
- package/dist/components/link-button/link-button.js +46 -0
- package/dist/components/link-button/link-button.stories.js +51 -0
- package/dist/components/list-box/hooks.d.ts +37 -0
- package/dist/components/list-box/hooks.js +70 -0
- package/dist/components/list-box/index.d.ts +1 -0
- package/dist/components/list-box/index.js +1 -0
- package/dist/components/list-box/list-box.d.ts +22 -0
- package/dist/components/list-box/list-box.js +145 -0
- package/dist/components/list-box/list-box.stories.js +69 -0
- package/dist/components/modal/index.d.ts +1 -0
- package/dist/components/modal/index.js +1 -0
- package/dist/components/modal/modal.d.ts +8 -0
- package/dist/components/modal/modal.js +118 -0
- package/dist/components/modal/modal.stories.js +22 -0
- package/dist/components/popover/hooks.d.ts +65 -0
- package/dist/components/popover/hooks.js +187 -0
- package/dist/components/popover/index.d.ts +1 -0
- package/dist/components/popover/index.js +1 -0
- package/dist/components/popover/popover.d.ts +18 -0
- package/dist/components/popover/popover.js +141 -0
- package/dist/components/popover/popover.stories.js +45 -0
- package/dist/components/progress/index.d.ts +1 -0
- package/dist/components/progress/index.js +1 -0
- package/dist/components/progress/progress.d.ts +7 -0
- package/dist/components/progress/progress.js +21 -0
- package/dist/components/progress/progress.stories.js +16 -0
- package/dist/components/providers/component-provider.d.ts +2 -0
- package/dist/components/providers/component-provider.js +9 -0
- package/dist/components/providers/index.d.ts +2 -0
- package/dist/components/providers/index.js +2 -0
- package/dist/components/providers/portal-root.d.ts +5 -0
- package/dist/components/providers/portal-root.js +17 -0
- package/dist/components/scroll-linked/index.d.ts +1 -0
- package/dist/components/scroll-linked/index.js +1 -0
- package/dist/components/scroll-linked/scroll-linked.d.ts +2 -0
- package/dist/components/scroll-linked/scroll-linked.js +21 -0
- package/dist/components/scroll-linked/scroll-linked.stories.js +18 -0
- package/dist/components/separator/index.d.ts +1 -0
- package/dist/components/separator/index.js +1 -0
- package/dist/components/separator/separator.d.ts +4 -0
- package/dist/components/separator/separator.js +20 -0
- package/dist/components/separator/separator.stories.js +27 -0
- package/dist/components/tabs/index.d.ts +1 -0
- package/dist/components/tabs/index.js +1 -0
- package/dist/components/tabs/tabs.d.ts +16 -0
- package/dist/components/tabs/tabs.js +145 -0
- package/dist/components/tabs/tabs.stories.js +49 -0
- package/dist/components/text-tag/index.d.ts +1 -0
- package/dist/components/text-tag/index.js +1 -0
- package/dist/components/text-tag/text-tag.d.ts +5 -0
- package/dist/components/text-tag/text-tag.js +23 -0
- package/dist/components/text-tag/text-tag.stories.js +30 -0
- package/dist/components/toast/index.d.ts +1 -0
- package/dist/components/toast/index.js +5 -0
- package/dist/components/toast/provider.d.ts +11 -0
- package/dist/components/toast/provider.js +125 -0
- package/dist/components/toast/toast.d.ts +9 -0
- package/dist/components/toast/toast.js +19 -0
- package/dist/components/toast/toast.stories.js +45 -0
- package/dist/components/tooltip/index.d.ts +1 -0
- package/dist/components/tooltip/index.js +1 -0
- package/dist/components/tooltip/tooltip.d.ts +13 -0
- package/dist/components/tooltip/tooltip.js +60 -0
- package/dist/components/tooltip/tooltip.stories.js +40 -0
- package/dist/helpers/cn.d.ts +2 -0
- package/dist/helpers/cn.js +8 -0
- package/dist/helpers/color/find-all-colors.d.ts +12 -0
- package/dist/helpers/color/find-all-colors.js +210 -0
- package/dist/helpers/is-internal-route.d.ts +1 -0
- package/dist/helpers/is-internal-route.js +12 -0
- package/dist/helpers/number/between.d.ts +1 -0
- package/dist/helpers/number/between.js +19 -0
- package/dist/helpers/number/cast.d.ts +1 -0
- package/dist/helpers/number/cast.js +41 -0
- package/dist/helpers/number/commalize.d.ts +1 -0
- package/dist/helpers/number/commalize.js +22 -0
- package/dist/helpers/number/index.d.ts +4 -0
- package/dist/helpers/number/index.js +10 -0
- package/dist/helpers/number/to-precision.d.ts +1 -0
- package/dist/helpers/number/to-precision.js +17 -0
- package/dist/helpers/uuid-v4.d.ts +1 -0
- package/dist/helpers/uuid-v4.js +32 -0
- package/dist/hooks/click-away/index.d.ts +2 -0
- package/dist/hooks/click-away/index.js +24 -0
- package/dist/hooks/click-away/index.test.js +31 -0
- package/dist/hooks/client/index.d.ts +1 -0
- package/dist/hooks/client/index.js +12 -0
- package/dist/hooks/clipboard/index.d.ts +4 -0
- package/dist/hooks/clipboard/index.js +17 -0
- package/dist/hooks/clipboard/index.test.js +35 -0
- package/dist/hooks/hash/index.d.ts +1 -0
- package/dist/hooks/hash/index.js +28 -0
- package/dist/hooks/hash/index.test.js +46 -0
- package/dist/hooks/index.d.ts +10 -0
- package/dist/hooks/index.js +10 -0
- package/dist/hooks/interval/index.d.ts +1 -0
- package/dist/hooks/interval/index.js +17 -0
- package/dist/hooks/interval/index.test.js +32 -0
- package/dist/hooks/local-storage/index.d.ts +1 -0
- package/dist/hooks/local-storage/index.js +48 -0
- package/dist/hooks/local-storage/index.test.js +82 -0
- package/dist/hooks/scroll-direction/index.d.ts +6 -0
- package/dist/hooks/scroll-direction/index.js +40 -0
- package/dist/hooks/scroll-direction/index.test.js +174 -0
- package/dist/hooks/step/index.d.ts +13 -0
- package/dist/hooks/step/index.js +39 -0
- package/dist/hooks/step/index.test.js +85 -0
- package/dist/hooks/timeout/index.d.ts +1 -0
- package/dist/hooks/timeout/index.js +17 -0
- package/dist/hooks/timeout/index.test.js +31 -0
- package/dist/hooks/window-size/index.d.ts +6 -0
- package/dist/hooks/window-size/index.js +22 -0
- package/dist/hooks/window-size/index.test.js +18 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/package.json +6 -0
- package/dist/styles/index.css +394 -0
- package/dist/types/variables.d.ts +6 -0
- package/dist/types/variables.js +0 -0
- package/package.json +110 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Radio } from "./radio";
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "components/form/radio",
|
|
6
|
+
component: Radio
|
|
7
|
+
};
|
|
8
|
+
var radio_stories_default = meta;
|
|
9
|
+
const Default = {
|
|
10
|
+
render: () => {
|
|
11
|
+
const options = [
|
|
12
|
+
{ value: "0", label: "\u306F\u3044" },
|
|
13
|
+
{ value: "1", label: "\u3044\u3044\u3048" }
|
|
14
|
+
];
|
|
15
|
+
const [value, setValue] = useState("0");
|
|
16
|
+
return /* @__PURE__ */ jsx(
|
|
17
|
+
Radio,
|
|
18
|
+
{
|
|
19
|
+
isDisabled: false,
|
|
20
|
+
labelId: "radio",
|
|
21
|
+
onChange: (e) => {
|
|
22
|
+
setValue(e.target.value);
|
|
23
|
+
},
|
|
24
|
+
options,
|
|
25
|
+
value
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const Disabled = {
|
|
31
|
+
render: () => {
|
|
32
|
+
const options = [
|
|
33
|
+
{ value: "0", label: "\u306F\u3044" },
|
|
34
|
+
{ value: "1", label: "\u3044\u3044\u3048" }
|
|
35
|
+
];
|
|
36
|
+
const [value, setValue] = useState("0");
|
|
37
|
+
return /* @__PURE__ */ jsx(
|
|
38
|
+
Radio,
|
|
39
|
+
{
|
|
40
|
+
isDisabled: true,
|
|
41
|
+
labelId: "radio",
|
|
42
|
+
onChange: (e) => {
|
|
43
|
+
setValue(e.target.value);
|
|
44
|
+
},
|
|
45
|
+
options,
|
|
46
|
+
value
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
Default,
|
|
53
|
+
Disabled,
|
|
54
|
+
radio_stories_default as default
|
|
55
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RangeField } from './range-field';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
id?: string;
|
|
4
|
+
describedbyId?: string | undefined;
|
|
5
|
+
isInvalid: boolean;
|
|
6
|
+
isDisabled: boolean;
|
|
7
|
+
isRequired: boolean;
|
|
8
|
+
value: number;
|
|
9
|
+
onChange: (value: number) => void;
|
|
10
|
+
step?: number;
|
|
11
|
+
max?: number;
|
|
12
|
+
min?: number;
|
|
13
|
+
showValue?: boolean;
|
|
14
|
+
unit?: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const RangeField: FC<Props>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "./../../../helpers/cn";
|
|
3
|
+
const RangeField = ({
|
|
4
|
+
id,
|
|
5
|
+
describedbyId,
|
|
6
|
+
isInvalid,
|
|
7
|
+
isDisabled,
|
|
8
|
+
isRequired,
|
|
9
|
+
value,
|
|
10
|
+
onChange,
|
|
11
|
+
step = 1,
|
|
12
|
+
max = 100,
|
|
13
|
+
min = 0,
|
|
14
|
+
showValue = true,
|
|
15
|
+
unit = ""
|
|
16
|
+
}) => {
|
|
17
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
|
|
18
|
+
/* @__PURE__ */ jsx(
|
|
19
|
+
"input",
|
|
20
|
+
{
|
|
21
|
+
"aria-describedby": describedbyId,
|
|
22
|
+
"aria-invalid": isInvalid,
|
|
23
|
+
"aria-valuemax": max,
|
|
24
|
+
"aria-valuemin": min,
|
|
25
|
+
"aria-valuenow": value,
|
|
26
|
+
className: cn(
|
|
27
|
+
"h-2 flex-1 cursor-pointer appearance-none rounded-lg bg-bg-subtle",
|
|
28
|
+
"range-slider",
|
|
29
|
+
"focus:outline-none focus:ring-2 focus:ring-border-info focus:ring-opacity-50",
|
|
30
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
31
|
+
isInvalid && "ring-2 ring-border-error"
|
|
32
|
+
),
|
|
33
|
+
disabled: isDisabled,
|
|
34
|
+
id,
|
|
35
|
+
max,
|
|
36
|
+
min,
|
|
37
|
+
onChange: (e) => {
|
|
38
|
+
onChange(Number(e.target.value));
|
|
39
|
+
},
|
|
40
|
+
required: isRequired,
|
|
41
|
+
step,
|
|
42
|
+
type: "range",
|
|
43
|
+
value
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
showValue && /* @__PURE__ */ jsxs("span", { className: "w-16 text-fg-base text-sm", children: [
|
|
47
|
+
value,
|
|
48
|
+
unit
|
|
49
|
+
] })
|
|
50
|
+
] });
|
|
51
|
+
};
|
|
52
|
+
export {
|
|
53
|
+
RangeField
|
|
54
|
+
};
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { RangeField } from "./range-field";
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "components/form/RangeField",
|
|
6
|
+
component: RangeField,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: "centered",
|
|
9
|
+
a11y: {
|
|
10
|
+
options: {
|
|
11
|
+
rules: {
|
|
12
|
+
// RangeField単体ではラベルを付随しない
|
|
13
|
+
"label-title-only": { enabled: false },
|
|
14
|
+
label: { enabled: false }
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
argTypes: {
|
|
20
|
+
onChange: { action: "changed" }
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
var range_field_stories_default = meta;
|
|
24
|
+
const Default = {
|
|
25
|
+
render: (args) => {
|
|
26
|
+
const [value, setValue] = useState(args.value || 50);
|
|
27
|
+
return /* @__PURE__ */ jsx("div", { className: "w-80", children: /* @__PURE__ */ jsx(
|
|
28
|
+
RangeField,
|
|
29
|
+
{
|
|
30
|
+
...args,
|
|
31
|
+
onChange: (newValue) => {
|
|
32
|
+
setValue(newValue);
|
|
33
|
+
args.onChange(newValue);
|
|
34
|
+
},
|
|
35
|
+
value
|
|
36
|
+
}
|
|
37
|
+
) });
|
|
38
|
+
},
|
|
39
|
+
args: {
|
|
40
|
+
value: 50,
|
|
41
|
+
min: 0,
|
|
42
|
+
max: 100,
|
|
43
|
+
step: 1,
|
|
44
|
+
isInvalid: false,
|
|
45
|
+
isDisabled: false,
|
|
46
|
+
isRequired: false,
|
|
47
|
+
showValue: true
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const WithUnit = {
|
|
51
|
+
render: (args) => {
|
|
52
|
+
const [value, setValue] = useState(args.value || 200);
|
|
53
|
+
return /* @__PURE__ */ jsx("div", { className: "w-80", children: /* @__PURE__ */ jsx(
|
|
54
|
+
RangeField,
|
|
55
|
+
{
|
|
56
|
+
...args,
|
|
57
|
+
onChange: (newValue) => {
|
|
58
|
+
setValue(newValue);
|
|
59
|
+
args.onChange(newValue);
|
|
60
|
+
},
|
|
61
|
+
value
|
|
62
|
+
}
|
|
63
|
+
) });
|
|
64
|
+
},
|
|
65
|
+
args: {
|
|
66
|
+
value: 200,
|
|
67
|
+
min: 100,
|
|
68
|
+
max: 500,
|
|
69
|
+
step: 10,
|
|
70
|
+
unit: "px",
|
|
71
|
+
isInvalid: false,
|
|
72
|
+
isDisabled: false,
|
|
73
|
+
isRequired: false,
|
|
74
|
+
showValue: true
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const WithoutValue = {
|
|
78
|
+
render: (args) => {
|
|
79
|
+
const [value, setValue] = useState(args.value || 75);
|
|
80
|
+
return /* @__PURE__ */ jsx("div", { className: "w-80", children: /* @__PURE__ */ jsx(
|
|
81
|
+
RangeField,
|
|
82
|
+
{
|
|
83
|
+
...args,
|
|
84
|
+
onChange: (newValue) => {
|
|
85
|
+
setValue(newValue);
|
|
86
|
+
args.onChange(newValue);
|
|
87
|
+
},
|
|
88
|
+
value
|
|
89
|
+
}
|
|
90
|
+
) });
|
|
91
|
+
},
|
|
92
|
+
args: {
|
|
93
|
+
value: 75,
|
|
94
|
+
min: 0,
|
|
95
|
+
max: 100,
|
|
96
|
+
step: 5,
|
|
97
|
+
showValue: false,
|
|
98
|
+
isInvalid: false,
|
|
99
|
+
isDisabled: false,
|
|
100
|
+
isRequired: false
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
const Disabled = {
|
|
104
|
+
render: (args) => {
|
|
105
|
+
const [value, setValue] = useState(args.value || 30);
|
|
106
|
+
return /* @__PURE__ */ jsx("div", { className: "w-80", children: /* @__PURE__ */ jsx(
|
|
107
|
+
RangeField,
|
|
108
|
+
{
|
|
109
|
+
...args,
|
|
110
|
+
onChange: (newValue) => {
|
|
111
|
+
setValue(newValue);
|
|
112
|
+
args.onChange(newValue);
|
|
113
|
+
},
|
|
114
|
+
value
|
|
115
|
+
}
|
|
116
|
+
) });
|
|
117
|
+
},
|
|
118
|
+
args: {
|
|
119
|
+
value: 30,
|
|
120
|
+
min: 0,
|
|
121
|
+
max: 100,
|
|
122
|
+
step: 1,
|
|
123
|
+
isInvalid: false,
|
|
124
|
+
isDisabled: true,
|
|
125
|
+
isRequired: false,
|
|
126
|
+
showValue: true
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
const Invalid = {
|
|
130
|
+
render: (args) => {
|
|
131
|
+
const [value, setValue] = useState(args.value || 90);
|
|
132
|
+
return /* @__PURE__ */ jsx("div", { className: "w-80", children: /* @__PURE__ */ jsx(
|
|
133
|
+
RangeField,
|
|
134
|
+
{
|
|
135
|
+
...args,
|
|
136
|
+
onChange: (newValue) => {
|
|
137
|
+
setValue(newValue);
|
|
138
|
+
args.onChange(newValue);
|
|
139
|
+
},
|
|
140
|
+
value
|
|
141
|
+
}
|
|
142
|
+
) });
|
|
143
|
+
},
|
|
144
|
+
args: {
|
|
145
|
+
value: 90,
|
|
146
|
+
min: 0,
|
|
147
|
+
max: 100,
|
|
148
|
+
step: 1,
|
|
149
|
+
isInvalid: true,
|
|
150
|
+
isDisabled: false,
|
|
151
|
+
isRequired: false,
|
|
152
|
+
showValue: true
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
export {
|
|
156
|
+
Default,
|
|
157
|
+
Disabled,
|
|
158
|
+
Invalid,
|
|
159
|
+
WithUnit,
|
|
160
|
+
WithoutValue,
|
|
161
|
+
range_field_stories_default as default
|
|
162
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './select';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./select";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ChangeEventHandler, FC } from 'react';
|
|
2
|
+
import type { Option } from '../../../types/variables';
|
|
3
|
+
type Props = {
|
|
4
|
+
id: string;
|
|
5
|
+
describedbyId: string | undefined;
|
|
6
|
+
isInvalid: boolean;
|
|
7
|
+
isDisabled: boolean;
|
|
8
|
+
isRequired: boolean;
|
|
9
|
+
options: readonly Option[];
|
|
10
|
+
value: string;
|
|
11
|
+
onChange: ChangeEventHandler<HTMLSelectElement>;
|
|
12
|
+
};
|
|
13
|
+
export declare const Select: FC<Props>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "./../../../helpers/cn";
|
|
3
|
+
import { ChevronIcon } from "../../icons";
|
|
4
|
+
const Select = ({
|
|
5
|
+
id,
|
|
6
|
+
describedbyId,
|
|
7
|
+
isInvalid,
|
|
8
|
+
isDisabled,
|
|
9
|
+
isRequired,
|
|
10
|
+
options,
|
|
11
|
+
value,
|
|
12
|
+
onChange
|
|
13
|
+
}) => {
|
|
14
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative h-fit w-full", children: [
|
|
15
|
+
/* @__PURE__ */ jsx(
|
|
16
|
+
"select",
|
|
17
|
+
{
|
|
18
|
+
"aria-describedby": describedbyId,
|
|
19
|
+
"aria-invalid": isInvalid,
|
|
20
|
+
"aria-required": isRequired,
|
|
21
|
+
className: cn(
|
|
22
|
+
"w-full appearance-none rounded-md border border-border-base bg-bg-base px-3 py-2 shadow-xs",
|
|
23
|
+
"aria-invalid:border-border-error",
|
|
24
|
+
"disabled:cursor-not-allowed disabled:border-border-mute disabled:bg-bg-mute disabled:hover:bg-bg-mute",
|
|
25
|
+
"focus-visible:border-transparent focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-border-info"
|
|
26
|
+
),
|
|
27
|
+
disabled: isDisabled,
|
|
28
|
+
id,
|
|
29
|
+
onChange,
|
|
30
|
+
value,
|
|
31
|
+
children: options.map((option) => /* @__PURE__ */ jsx("option", { value: option.value, children: option.label }, option.value))
|
|
32
|
+
}
|
|
33
|
+
),
|
|
34
|
+
/* @__PURE__ */ jsx("div", { className: "-translate-y-1/2 absolute top-2/4 right-3", children: /* @__PURE__ */ jsx(ChevronIcon, { direction: "down", size: "sm" }) })
|
|
35
|
+
] });
|
|
36
|
+
};
|
|
37
|
+
export {
|
|
38
|
+
Select
|
|
39
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Select } from "./select";
|
|
2
|
+
const meta = {
|
|
3
|
+
title: "components/form/select",
|
|
4
|
+
component: Select,
|
|
5
|
+
args: {
|
|
6
|
+
id: "select",
|
|
7
|
+
describedbyId: "select-feedback",
|
|
8
|
+
options: [
|
|
9
|
+
{ value: "2", label: "2\u9032\u6570" },
|
|
10
|
+
{ value: "8", label: "8\u9032\u6570" },
|
|
11
|
+
{ value: "10", label: "10\u9032\u6570" },
|
|
12
|
+
{ value: "16", label: "16\u9032\u6570" }
|
|
13
|
+
],
|
|
14
|
+
value: "10",
|
|
15
|
+
onChange: (e) => {
|
|
16
|
+
console.log(e.target.value);
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
parameters: {
|
|
20
|
+
a11y: {
|
|
21
|
+
options: {
|
|
22
|
+
rules: {
|
|
23
|
+
// Select単体ではラベルを付随しない
|
|
24
|
+
"label-title-only": { enabled: false },
|
|
25
|
+
"select-name": { enabled: false }
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
var select_stories_default = meta;
|
|
32
|
+
const Default = {
|
|
33
|
+
args: {
|
|
34
|
+
isDisabled: false,
|
|
35
|
+
isInvalid: false,
|
|
36
|
+
isRequired: false
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const Invalid = {
|
|
40
|
+
args: {
|
|
41
|
+
isDisabled: false,
|
|
42
|
+
isInvalid: true,
|
|
43
|
+
isRequired: false
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const Disabled = {
|
|
47
|
+
args: {
|
|
48
|
+
isDisabled: true,
|
|
49
|
+
isInvalid: false,
|
|
50
|
+
isRequired: false
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
export {
|
|
54
|
+
Default,
|
|
55
|
+
Disabled,
|
|
56
|
+
Invalid,
|
|
57
|
+
select_stories_default as default
|
|
58
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './text-field';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./text-field";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ChangeEventHandler, FC } from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
id?: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
describedbyId?: string | undefined;
|
|
6
|
+
isInvalid: boolean;
|
|
7
|
+
isDisabled: boolean;
|
|
8
|
+
isRequired: boolean;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
defaultValue?: string;
|
|
11
|
+
value?: string;
|
|
12
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
13
|
+
};
|
|
14
|
+
export declare const TextField: FC<Props>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "./../../../helpers/cn";
|
|
3
|
+
const TextField = ({
|
|
4
|
+
id,
|
|
5
|
+
name,
|
|
6
|
+
describedbyId,
|
|
7
|
+
isInvalid,
|
|
8
|
+
isDisabled,
|
|
9
|
+
isRequired,
|
|
10
|
+
placeholder,
|
|
11
|
+
defaultValue,
|
|
12
|
+
value,
|
|
13
|
+
onChange
|
|
14
|
+
}) => {
|
|
15
|
+
return /* @__PURE__ */ jsx(
|
|
16
|
+
"input",
|
|
17
|
+
{
|
|
18
|
+
"aria-describedby": describedbyId,
|
|
19
|
+
"aria-invalid": isInvalid,
|
|
20
|
+
"aria-required": isRequired,
|
|
21
|
+
className: cn(
|
|
22
|
+
"w-full rounded-md border border-border-base bg-bg-base px-3 py-2",
|
|
23
|
+
"aria-invalid:border-border-error",
|
|
24
|
+
"disabled:cursor-not-allowed disabled:border-border-mute disabled:bg-bg-mute disabled:hover:bg-bg-mute",
|
|
25
|
+
"focus-visible:border-transparent focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-border-info"
|
|
26
|
+
),
|
|
27
|
+
defaultValue,
|
|
28
|
+
disabled: isDisabled,
|
|
29
|
+
id,
|
|
30
|
+
name,
|
|
31
|
+
onChange,
|
|
32
|
+
placeholder,
|
|
33
|
+
type: "text",
|
|
34
|
+
value
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
TextField
|
|
40
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { TextField } from "./text-field";
|
|
2
|
+
const meta = {
|
|
3
|
+
title: "components/form/text-field",
|
|
4
|
+
component: TextField,
|
|
5
|
+
args: {
|
|
6
|
+
id: "textfield",
|
|
7
|
+
describedbyId: "textfield-feedback",
|
|
8
|
+
value: "",
|
|
9
|
+
onChange: (e) => {
|
|
10
|
+
console.log(e.target.value);
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
parameters: {
|
|
14
|
+
a11y: {
|
|
15
|
+
options: {
|
|
16
|
+
rules: {
|
|
17
|
+
// TextField単体ではラベルを付随しない
|
|
18
|
+
"label-title-only": { enabled: false },
|
|
19
|
+
label: { enabled: false }
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
var text_field_stories_default = meta;
|
|
26
|
+
const Default = {
|
|
27
|
+
args: {
|
|
28
|
+
isDisabled: false,
|
|
29
|
+
isInvalid: false,
|
|
30
|
+
isRequired: false
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const Placeholder = {
|
|
34
|
+
args: {
|
|
35
|
+
isDisabled: false,
|
|
36
|
+
isInvalid: false,
|
|
37
|
+
isRequired: false,
|
|
38
|
+
placeholder: "ID"
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const Invalid = {
|
|
42
|
+
args: {
|
|
43
|
+
isDisabled: false,
|
|
44
|
+
isInvalid: true,
|
|
45
|
+
isRequired: false
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const Disabled = {
|
|
49
|
+
args: {
|
|
50
|
+
isDisabled: true,
|
|
51
|
+
isInvalid: false,
|
|
52
|
+
isRequired: false
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
Default,
|
|
57
|
+
Disabled,
|
|
58
|
+
Invalid,
|
|
59
|
+
Placeholder,
|
|
60
|
+
text_field_stories_default as default
|
|
61
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './textarea';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./textarea";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ChangeEventHandler, type FC } from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
id: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
describedbyId: string | undefined;
|
|
6
|
+
isInvalid: boolean;
|
|
7
|
+
isDisabled: boolean;
|
|
8
|
+
isRequired: boolean;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
rows?: number;
|
|
11
|
+
fullHeight?: boolean;
|
|
12
|
+
autoResize?: boolean;
|
|
13
|
+
defaultValue?: string;
|
|
14
|
+
value?: string;
|
|
15
|
+
onChange?: ChangeEventHandler<HTMLTextAreaElement>;
|
|
16
|
+
};
|
|
17
|
+
export declare const Textarea: FC<Props>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
import { cn } from "./../../../helpers/cn";
|
|
4
|
+
const Textarea = ({
|
|
5
|
+
id,
|
|
6
|
+
name,
|
|
7
|
+
describedbyId,
|
|
8
|
+
isInvalid,
|
|
9
|
+
isDisabled,
|
|
10
|
+
isRequired,
|
|
11
|
+
placeholder,
|
|
12
|
+
rows,
|
|
13
|
+
fullHeight = false,
|
|
14
|
+
autoResize = false,
|
|
15
|
+
defaultValue,
|
|
16
|
+
value,
|
|
17
|
+
onChange
|
|
18
|
+
}) => {
|
|
19
|
+
const ref = useRef(null);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (ref.current && autoResize) {
|
|
22
|
+
ref.current.style.height = "auto";
|
|
23
|
+
ref.current.style.height = `${ref.current.scrollHeight.toString()}px`;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
27
|
+
"textarea",
|
|
28
|
+
{
|
|
29
|
+
"aria-describedby": describedbyId,
|
|
30
|
+
"aria-invalid": isInvalid,
|
|
31
|
+
"aria-required": isRequired,
|
|
32
|
+
className: cn(
|
|
33
|
+
"w-full resize-none rounded-md border border-border-base bg-bg-base px-3 py-2",
|
|
34
|
+
"aria-invalid:border-border-error",
|
|
35
|
+
"disabled:cursor-not-allowed disabled:border-border-mute disabled:bg-bg-mute disabled:hover:bg-bg-mute",
|
|
36
|
+
"focus-visible:border-transparent focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-border-info",
|
|
37
|
+
fullHeight && "h-full"
|
|
38
|
+
),
|
|
39
|
+
defaultValue,
|
|
40
|
+
disabled: isDisabled,
|
|
41
|
+
id,
|
|
42
|
+
name,
|
|
43
|
+
onChange,
|
|
44
|
+
onKeyDown: (e) => {
|
|
45
|
+
e.stopPropagation();
|
|
46
|
+
},
|
|
47
|
+
placeholder,
|
|
48
|
+
ref,
|
|
49
|
+
rows,
|
|
50
|
+
value
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
export {
|
|
55
|
+
Textarea
|
|
56
|
+
};
|