@ubie/vitals-ui-consumer 0.0.1
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/.storybook/main.ts +14 -0
- package/.storybook/preview.tsx +25 -0
- package/.storybook/vitest.setup.ts +7 -0
- package/dist/chunk-DKo7XVKm.mjs +33 -0
- package/dist/index.d.mts +1720 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +10594 -0
- package/dist/index.mjs.map +1 -0
- package/dist/style.css +2299 -0
- package/package.json +47 -0
- package/src/components/Accordion/Accordion.module.css +75 -0
- package/src/components/Accordion/Accordion.spec.tsx +18 -0
- package/src/components/Accordion/Accordion.stories.tsx +61 -0
- package/src/components/Accordion/Accordion.tsx +89 -0
- package/src/components/ActionHalfModal/ActionHalfModal.module.css +180 -0
- package/src/components/ActionHalfModal/ActionHalfModal.spec.tsx +57 -0
- package/src/components/ActionHalfModal/ActionHalfModal.stories.tsx +469 -0
- package/src/components/ActionHalfModal/ActionHalfModal.tsx +269 -0
- package/src/components/ActionModal/ActionModal.module.css +145 -0
- package/src/components/ActionModal/ActionModal.spec.tsx +57 -0
- package/src/components/ActionModal/ActionModal.stories.tsx +302 -0
- package/src/components/ActionModal/ActionModal.tsx +232 -0
- package/src/components/Bold/Bold.module.css +4 -0
- package/src/components/Bold/Bold.spec.tsx +24 -0
- package/src/components/Bold/Bold.stories.tsx +54 -0
- package/src/components/Bold/Bold.tsx +31 -0
- package/src/components/Box/Box.module.css +46 -0
- package/src/components/Box/Box.spec.tsx +188 -0
- package/src/components/Box/Box.tsx +242 -0
- package/src/components/Button/Button.module.css +261 -0
- package/src/components/Button/Button.spec.tsx +82 -0
- package/src/components/Button/Button.tsx +99 -0
- package/src/components/Button/ButtonTypes.ts +107 -0
- package/src/components/Button/LinkButton.spec.tsx +86 -0
- package/src/components/Button/LinkButton.tsx +80 -0
- package/src/components/Button/VariantIcon.tsx +20 -0
- package/src/components/Button/useIcon.tsx +16 -0
- package/src/components/ButtonCard/ButtonCard.module.css +35 -0
- package/src/components/ButtonCard/ButtonCard.spec.tsx +18 -0
- package/src/components/ButtonCard/ButtonCard.stories.tsx +54 -0
- package/src/components/ButtonCard/ButtonCard.tsx +18 -0
- package/src/components/Center/Center.module.css +19 -0
- package/src/components/Center/Center.spec.tsx +143 -0
- package/src/components/Center/Center.tsx +108 -0
- package/src/components/Checkbox/Checkbox.module.css +124 -0
- package/src/components/Checkbox/Checkbox.spec.tsx +17 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +213 -0
- package/src/components/Checkbox/Checkbox.tsx +50 -0
- package/src/components/CheckboxCard/CheckboxCard.module.css +102 -0
- package/src/components/CheckboxCard/CheckboxCard.spec.tsx +16 -0
- package/src/components/CheckboxCard/CheckboxCard.stories.tsx +205 -0
- package/src/components/CheckboxCard/CheckboxCard.tsx +53 -0
- package/src/components/CheckboxGroup/CheckboxGroup.module.css +16 -0
- package/src/components/CheckboxGroup/CheckboxGroup.spec.tsx +17 -0
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +64 -0
- package/src/components/Color/Color.module.css +3 -0
- package/src/components/Color/Color.spec.tsx +24 -0
- package/src/components/Color/Color.stories.tsx +71 -0
- package/src/components/Color/Color.tsx +28 -0
- package/src/components/Divider/Divider.module.css +9 -0
- package/src/components/Divider/Divider.spec.tsx +42 -0
- package/src/components/Divider/Divider.stories.tsx +77 -0
- package/src/components/Divider/Divider.tsx +49 -0
- package/src/components/ErrorMessage/ErrorMessage.module.css +8 -0
- package/src/components/ErrorMessage/ErrorMessage.spec.tsx +12 -0
- package/src/components/ErrorMessage/ErrorMessage.tsx +20 -0
- package/src/components/Flex/Flex.module.css +24 -0
- package/src/components/Flex/Flex.spec.tsx +188 -0
- package/src/components/Flex/Flex.tsx +173 -0
- package/src/components/FlexItem/FlexItem.module.css +14 -0
- package/src/components/FlexItem/FlexItem.spec.tsx +84 -0
- package/src/components/FlexItem/FlexItem.tsx +106 -0
- package/src/components/Heading/Heading.module.css +131 -0
- package/src/components/Heading/Heading.tsx +86 -0
- package/src/components/HelperMessage/HelperMessage.module.css +8 -0
- package/src/components/HelperMessage/HelperMessage.tsx +15 -0
- package/src/components/Icon/Icon.module.css +6 -0
- package/src/components/Icon/Icon.spec.tsx +24 -0
- package/src/components/Icon/Icon.stories.tsx +100 -0
- package/src/components/Icon/Icon.tsx +101 -0
- package/src/components/Input/Input.module.css +51 -0
- package/src/components/Input/Input.spec.tsx +14 -0
- package/src/components/Input/Input.tsx +27 -0
- package/src/components/Label/Label.module.css +14 -0
- package/src/components/Label/Label.tsx +39 -0
- package/src/components/LinkCard/LinkCard.module.css +72 -0
- package/src/components/LinkCard/LinkCard.tsx +96 -0
- package/src/components/MessageHalfModal/MessageHalfModal.module.css +181 -0
- package/src/components/MessageHalfModal/MessageHalfModal.spec.tsx +73 -0
- package/src/components/MessageHalfModal/MessageHalfModal.stories.tsx +242 -0
- package/src/components/MessageHalfModal/MessageHalfModal.tsx +194 -0
- package/src/components/MessageModal/MessageModal.module.css +149 -0
- package/src/components/MessageModal/MessageModal.spec.tsx +57 -0
- package/src/components/MessageModal/MessageModal.stories.tsx +223 -0
- package/src/components/MessageModal/MessageModal.tsx +178 -0
- package/src/components/Pre/Pre.module.css +8 -0
- package/src/components/Pre/Pre.spec.tsx +11 -0
- package/src/components/Pre/Pre.stories.tsx +76 -0
- package/src/components/Pre/Pre.tsx +40 -0
- package/src/components/RadioButton/RadioButton.module.css +92 -0
- package/src/components/RadioButton/RadioButton.spec.tsx +25 -0
- package/src/components/RadioButton/RadioButton.tsx +55 -0
- package/src/components/RadioCard/RadioCard.module.css +109 -0
- package/src/components/RadioCard/RadioCard.tsx +61 -0
- package/src/components/RadioGroup/RadioGroup.module.css +16 -0
- package/src/components/RadioGroup/RadioGroup.spec.tsx +17 -0
- package/src/components/RadioGroup/RadioGroup.tsx +60 -0
- package/src/components/Select/Select.module.css +70 -0
- package/src/components/Select/Select.spec.tsx +12 -0
- package/src/components/Select/Select.tsx +56 -0
- package/src/components/Stack/Stack.module.css +10 -0
- package/src/components/Stack/Stack.spec.tsx +177 -0
- package/src/components/Stack/Stack.tsx +151 -0
- package/src/components/Stepper/Stepper.module.css +137 -0
- package/src/components/Stepper/Stepper.spec.tsx +198 -0
- package/src/components/Stepper/Stepper.stories.tsx +192 -0
- package/src/components/Stepper/Stepper.tsx +70 -0
- package/src/components/Stepper/StepperItem.tsx +113 -0
- package/src/components/Text/Text.module.css +168 -0
- package/src/components/Text/Text.tsx +192 -0
- package/src/components/TextArea/TextArea.module.css +46 -0
- package/src/components/TextArea/TextArea.spec.tsx +13 -0
- package/src/components/TextArea/TextArea.tsx +29 -0
- package/src/components/Toggle/Toggle.module.css +71 -0
- package/src/components/Toggle/Toggle.spec.tsx +21 -0
- package/src/components/Toggle/Toggle.tsx +56 -0
- package/src/font.ts +2 -0
- package/src/hooks/useScrollable.ts +58 -0
- package/src/icons/AppleIcon.tsx +14 -0
- package/src/icons/GoogleIcon.tsx +27 -0
- package/src/icons/LINEIcon.tsx +16 -0
- package/src/index.ts +35 -0
- package/src/sharedComponents/RequiredLabel/RequiredLabel.module.css +10 -0
- package/src/sharedComponents/RequiredLabel/RequiredLabel.tsx +8 -0
- package/src/sharedComponents/VisuallyHidden/VisuallyHidden.module.css +15 -0
- package/src/sharedComponents/VisuallyHidden/VisuallyHidden.tsx +22 -0
- package/src/stories/Accordion.stories.portable.ts +4 -0
- package/src/stories/Box.stories.tsx +474 -0
- package/src/stories/Button.stories.tsx +262 -0
- package/src/stories/Center.stories.tsx +126 -0
- package/src/stories/ErrorMessage.stories.tsx +19 -0
- package/src/stories/Flex.stories.tsx +345 -0
- package/src/stories/Form.stories.tsx +83 -0
- package/src/stories/Heading.stories.tsx +263 -0
- package/src/stories/HelperMessage.stories.tsx +22 -0
- package/src/stories/Input.stories.tsx +145 -0
- package/src/stories/Label.stories.tsx +32 -0
- package/src/stories/LinkButton.stories.tsx +207 -0
- package/src/stories/LinkCard.stories.tsx +90 -0
- package/src/stories/RadioButton.stories.tsx +168 -0
- package/src/stories/RadioCard.stories.tsx +236 -0
- package/src/stories/Select.stories.tsx +97 -0
- package/src/stories/Stack.stories.tsx +167 -0
- package/src/stories/Text.stories.tsx +396 -0
- package/src/stories/TextArea.stories.tsx +49 -0
- package/src/stories/Toggle.stories.tsx +30 -0
- package/src/test/vitest-jest-dom.d.ts +12 -0
- package/src/types/attributes.ts +6 -0
- package/src/types/global.d.ts +11 -0
- package/src/types/icon.ts +3 -0
- package/src/types/style.ts +254 -0
- package/src/utils/component.ts +8 -0
- package/src/utils/style.spec.ts +57 -0
- package/src/utils/style.ts +387 -0
- package/src/utils/types.ts +8 -0
- package/tsconfig.json +18 -0
- package/tsconfig.spec-lint.tsbuildinfo +1 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/vite.config.ts +50 -0
- package/vitest.shims.d.ts +1 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { useState, useCallback } from "react";
|
|
3
|
+
import { RadioCard, Stack, RadioGroup } from "..";
|
|
4
|
+
import type { ChangeEventHandler } from "react";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Form/RadioCard",
|
|
8
|
+
component: RadioCard,
|
|
9
|
+
} satisfies Meta<typeof RadioCard>;
|
|
10
|
+
|
|
11
|
+
type Story = StoryObj<typeof RadioCard>;
|
|
12
|
+
|
|
13
|
+
const defaultArgs = {};
|
|
14
|
+
|
|
15
|
+
const options = ["option1", "option2", "option3"];
|
|
16
|
+
|
|
17
|
+
export const Default: Story = {
|
|
18
|
+
render: () => {
|
|
19
|
+
const [selectedItem, setSelectedItem] = useState(options[0]);
|
|
20
|
+
|
|
21
|
+
const onChange: ChangeEventHandler<HTMLInputElement> = useCallback((event) => {
|
|
22
|
+
setSelectedItem(event.target.value);
|
|
23
|
+
}, []);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Stack spacing="lg" alignItems="normal">
|
|
27
|
+
<RadioGroup label="RadioCard">
|
|
28
|
+
{options.map((option) => (
|
|
29
|
+
<RadioCard
|
|
30
|
+
name="options"
|
|
31
|
+
value={option}
|
|
32
|
+
onChange={onChange}
|
|
33
|
+
checked={selectedItem === option}
|
|
34
|
+
id={option}
|
|
35
|
+
key={option}
|
|
36
|
+
>
|
|
37
|
+
{option}
|
|
38
|
+
</RadioCard>
|
|
39
|
+
))}
|
|
40
|
+
</RadioGroup>
|
|
41
|
+
|
|
42
|
+
<dl>
|
|
43
|
+
<dt>Values</dt>
|
|
44
|
+
<dd>{selectedItem}</dd>
|
|
45
|
+
</dl>
|
|
46
|
+
</Stack>
|
|
47
|
+
);
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const Horizontally: Story = {
|
|
52
|
+
render: () => {
|
|
53
|
+
const [selectedItem, setSelectedItem] = useState(options[0]);
|
|
54
|
+
|
|
55
|
+
const onChange: ChangeEventHandler<HTMLInputElement> = useCallback((event) => {
|
|
56
|
+
setSelectedItem(event.target.value);
|
|
57
|
+
}, []);
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<RadioGroup label="RadioCard" direction="row">
|
|
61
|
+
{options.map((option) => (
|
|
62
|
+
<RadioCard
|
|
63
|
+
name="horizontally"
|
|
64
|
+
value={option}
|
|
65
|
+
onChange={onChange}
|
|
66
|
+
checked={selectedItem === option}
|
|
67
|
+
id={option}
|
|
68
|
+
key={option}
|
|
69
|
+
>
|
|
70
|
+
{option}
|
|
71
|
+
</RadioCard>
|
|
72
|
+
))}
|
|
73
|
+
</RadioGroup>
|
|
74
|
+
);
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const Block: Story = {
|
|
79
|
+
render: (args) => {
|
|
80
|
+
const options = ["option1", "option2", "option3"];
|
|
81
|
+
|
|
82
|
+
const [value, setValue] = useState<string>("option1");
|
|
83
|
+
|
|
84
|
+
const onChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
85
|
+
setValue(event.target.value);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<Stack spacing="sm">
|
|
90
|
+
{options.map((option) => (
|
|
91
|
+
<RadioCard
|
|
92
|
+
{...args}
|
|
93
|
+
key={option}
|
|
94
|
+
checked={value === option}
|
|
95
|
+
value={option}
|
|
96
|
+
onChange={onChange}
|
|
97
|
+
name="block"
|
|
98
|
+
>
|
|
99
|
+
{option}
|
|
100
|
+
</RadioCard>
|
|
101
|
+
))}
|
|
102
|
+
</Stack>
|
|
103
|
+
);
|
|
104
|
+
},
|
|
105
|
+
args: {
|
|
106
|
+
...defaultArgs,
|
|
107
|
+
name: "block",
|
|
108
|
+
block: true,
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export const ShowRequiredLabel: Story = {
|
|
113
|
+
render: () => {
|
|
114
|
+
const [selectedItem, setSelectedItem] = useState(options[0]);
|
|
115
|
+
|
|
116
|
+
const onChange: ChangeEventHandler<HTMLInputElement> = useCallback((event) => {
|
|
117
|
+
setSelectedItem(event.target.value);
|
|
118
|
+
}, []);
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<RadioGroup label="RadioCard" showRequiredLabel>
|
|
122
|
+
{options.map((option) => (
|
|
123
|
+
<RadioCard
|
|
124
|
+
name="options"
|
|
125
|
+
value={option}
|
|
126
|
+
onChange={onChange}
|
|
127
|
+
checked={selectedItem === option}
|
|
128
|
+
id={option}
|
|
129
|
+
key={option}
|
|
130
|
+
>
|
|
131
|
+
{option}
|
|
132
|
+
</RadioCard>
|
|
133
|
+
))}
|
|
134
|
+
</RadioGroup>
|
|
135
|
+
);
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export const CustomDataAttribute: Story = {
|
|
140
|
+
args: defaultArgs,
|
|
141
|
+
render: (args) => {
|
|
142
|
+
const options = ["option1", "option2", "option3"];
|
|
143
|
+
const [value, setValue] = useState<string>("option1");
|
|
144
|
+
|
|
145
|
+
const onChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
146
|
+
setValue(event.target.value);
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<Stack spacing="sm">
|
|
151
|
+
{options.map((option, index) => (
|
|
152
|
+
<RadioCard
|
|
153
|
+
{...args}
|
|
154
|
+
key={option}
|
|
155
|
+
checked={value === option}
|
|
156
|
+
value={option}
|
|
157
|
+
onChange={onChange}
|
|
158
|
+
name="customDataAttribute"
|
|
159
|
+
data-test-id={index}
|
|
160
|
+
>
|
|
161
|
+
{option}
|
|
162
|
+
</RadioCard>
|
|
163
|
+
))}
|
|
164
|
+
</Stack>
|
|
165
|
+
);
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export const Disabled: Story = {
|
|
170
|
+
render: () => {
|
|
171
|
+
const [selectedItem, setSelectedItem] = useState(options[0]);
|
|
172
|
+
|
|
173
|
+
const onChange: ChangeEventHandler<HTMLInputElement> = useCallback((event) => {
|
|
174
|
+
setSelectedItem(event.target.value);
|
|
175
|
+
}, []);
|
|
176
|
+
|
|
177
|
+
return (
|
|
178
|
+
<Stack spacing="lg" alignItems="normal">
|
|
179
|
+
<RadioGroup label="RadioCard">
|
|
180
|
+
{options.map((option) => (
|
|
181
|
+
<RadioCard
|
|
182
|
+
name="options"
|
|
183
|
+
value={option}
|
|
184
|
+
onChange={onChange}
|
|
185
|
+
checked={selectedItem === option}
|
|
186
|
+
id={option}
|
|
187
|
+
key={option}
|
|
188
|
+
disabled
|
|
189
|
+
>
|
|
190
|
+
{option}
|
|
191
|
+
</RadioCard>
|
|
192
|
+
))}
|
|
193
|
+
</RadioGroup>
|
|
194
|
+
|
|
195
|
+
<dl>
|
|
196
|
+
<dt>Values</dt>
|
|
197
|
+
<dd>{selectedItem}</dd>
|
|
198
|
+
</dl>
|
|
199
|
+
</Stack>
|
|
200
|
+
);
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
export const NoLabelOnGroup: Story = {
|
|
205
|
+
render: () => {
|
|
206
|
+
const [selectedItem, setSelectedItem] = useState(options[0]);
|
|
207
|
+
|
|
208
|
+
const onChange: ChangeEventHandler<HTMLInputElement> = useCallback((event) => {
|
|
209
|
+
setSelectedItem(event.target.value);
|
|
210
|
+
}, []);
|
|
211
|
+
|
|
212
|
+
return (
|
|
213
|
+
<Stack spacing="lg" alignItems="normal">
|
|
214
|
+
<RadioGroup>
|
|
215
|
+
{options.map((option) => (
|
|
216
|
+
<RadioCard
|
|
217
|
+
name="options"
|
|
218
|
+
value={option}
|
|
219
|
+
onChange={onChange}
|
|
220
|
+
checked={selectedItem === option}
|
|
221
|
+
id={option}
|
|
222
|
+
key={option}
|
|
223
|
+
>
|
|
224
|
+
{option}
|
|
225
|
+
</RadioCard>
|
|
226
|
+
))}
|
|
227
|
+
</RadioGroup>
|
|
228
|
+
|
|
229
|
+
<dl>
|
|
230
|
+
<dt>Values</dt>
|
|
231
|
+
<dd>{selectedItem}</dd>
|
|
232
|
+
</dl>
|
|
233
|
+
</Stack>
|
|
234
|
+
);
|
|
235
|
+
},
|
|
236
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { ChangeEventHandler, useState, useCallback } from "react";
|
|
3
|
+
import { Select, Stack } from "../";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "Form/Select",
|
|
7
|
+
component: Select,
|
|
8
|
+
} satisfies Meta<typeof Select>;
|
|
9
|
+
|
|
10
|
+
const defaultArgs = {
|
|
11
|
+
isInvalid: false,
|
|
12
|
+
disabled: false,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const Default: StoryObj<typeof Select> = {
|
|
16
|
+
render: (args) => {
|
|
17
|
+
const options = ["option1", "option2", "option3"];
|
|
18
|
+
|
|
19
|
+
const [selectedItem, setSelectedItem] = useState(options[0]);
|
|
20
|
+
|
|
21
|
+
const onChange: ChangeEventHandler<HTMLSelectElement> = useCallback((event) => {
|
|
22
|
+
setSelectedItem(event.target.value);
|
|
23
|
+
}, []);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Stack spacing="md" alignItems="normal">
|
|
27
|
+
<Select {...args} value={selectedItem} onChange={onChange}>
|
|
28
|
+
{options.map((o) => (
|
|
29
|
+
<option key={o}>{o}</option>
|
|
30
|
+
))}
|
|
31
|
+
</Select>
|
|
32
|
+
|
|
33
|
+
<dl>
|
|
34
|
+
<dt>Value</dt>
|
|
35
|
+
<dd>{selectedItem}</dd>
|
|
36
|
+
</dl>
|
|
37
|
+
</Stack>
|
|
38
|
+
);
|
|
39
|
+
},
|
|
40
|
+
args: defaultArgs,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const Disabled: StoryObj<typeof Select> = {
|
|
44
|
+
render: (args) => {
|
|
45
|
+
const options = ["option1", "option2", "option3"];
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Select {...args} value={options[0]}>
|
|
49
|
+
{options.map((o) => (
|
|
50
|
+
<option key={o}>{o}</option>
|
|
51
|
+
))}
|
|
52
|
+
</Select>
|
|
53
|
+
);
|
|
54
|
+
},
|
|
55
|
+
args: {
|
|
56
|
+
...defaultArgs,
|
|
57
|
+
disabled: true,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const IsInvalid: StoryObj<typeof Select> = {
|
|
62
|
+
render: (args) => {
|
|
63
|
+
const options = ["option1", "option2", "option3"];
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<Select {...args} value={options[0]}>
|
|
67
|
+
{options.map((o) => (
|
|
68
|
+
<option key={o}>{o}</option>
|
|
69
|
+
))}
|
|
70
|
+
</Select>
|
|
71
|
+
);
|
|
72
|
+
},
|
|
73
|
+
args: {
|
|
74
|
+
...defaultArgs,
|
|
75
|
+
isInvalid: true,
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const CustomDataAttribute: StoryObj<typeof Select> = {
|
|
80
|
+
render: (args) => {
|
|
81
|
+
const options = ["option1", "option2", "option3"];
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<Select {...args} value={options[0]}>
|
|
85
|
+
{options.map((o) => (
|
|
86
|
+
<option key={o} data-test-id={args["data-test-id"]}>
|
|
87
|
+
{o}
|
|
88
|
+
</option>
|
|
89
|
+
))}
|
|
90
|
+
</Select>
|
|
91
|
+
);
|
|
92
|
+
},
|
|
93
|
+
args: {
|
|
94
|
+
...defaultArgs,
|
|
95
|
+
"data-test-id": "select-custom-data-attribute",
|
|
96
|
+
},
|
|
97
|
+
};
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { Box, Stack } from "..";
|
|
3
|
+
import { Spacing } from "../types/style";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
component: Stack,
|
|
7
|
+
} satisfies Meta<typeof Stack>;
|
|
8
|
+
|
|
9
|
+
const defaultArgs = {
|
|
10
|
+
spacing: "md" as Spacing,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type Story = StoryObj<typeof Stack>;
|
|
14
|
+
|
|
15
|
+
export const Default: Story = {
|
|
16
|
+
render: (args) => (
|
|
17
|
+
<Stack {...args}>
|
|
18
|
+
<p style={{ margin: 0 }}>テスト</p>
|
|
19
|
+
<p style={{ margin: 0 }}>テスト</p>
|
|
20
|
+
<p style={{ margin: 0 }}>テスト</p>
|
|
21
|
+
<p style={{ margin: 0 }}>テスト</p>
|
|
22
|
+
</Stack>
|
|
23
|
+
),
|
|
24
|
+
args: defaultArgs,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const Nested: Story = {
|
|
28
|
+
render: () => (
|
|
29
|
+
<Stack spacing="xl">
|
|
30
|
+
<Stack spacing="lg">
|
|
31
|
+
<p style={{ margin: 0, background: "#DDD" }}>テスト</p>
|
|
32
|
+
<p style={{ margin: 0, background: "#DDD" }}>テスト</p>
|
|
33
|
+
<p style={{ margin: 0, background: "#DDD" }}>テスト</p>
|
|
34
|
+
</Stack>
|
|
35
|
+
|
|
36
|
+
<Stack spacing="lg">
|
|
37
|
+
<p style={{ margin: 0, background: "#DDD" }}>テスト</p>
|
|
38
|
+
<p style={{ margin: 0, background: "#DDD" }}>テスト</p>
|
|
39
|
+
<Stack spacing="xs">
|
|
40
|
+
<p style={{ margin: 0, background: "#DDD" }}>テスト</p>
|
|
41
|
+
<p style={{ margin: 0, background: "#DDD" }}>テスト</p>
|
|
42
|
+
<p style={{ margin: 0, background: "#DDD" }}>テスト</p>
|
|
43
|
+
</Stack>
|
|
44
|
+
<Stack>
|
|
45
|
+
<p style={{ margin: 0, background: "#DDD" }}>テスト</p>
|
|
46
|
+
<p style={{ margin: 0, background: "#DDD" }}>テスト</p>
|
|
47
|
+
<p style={{ margin: 0, background: "#DDD" }}>テスト</p>
|
|
48
|
+
</Stack>
|
|
49
|
+
</Stack>
|
|
50
|
+
</Stack>
|
|
51
|
+
),
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const MarkupAsList: Story = {
|
|
55
|
+
render: (args) => (
|
|
56
|
+
<Stack {...args} as="ul">
|
|
57
|
+
<li>テスト</li>
|
|
58
|
+
<li>テスト</li>
|
|
59
|
+
<li>テスト</li>
|
|
60
|
+
<li>テスト</li>
|
|
61
|
+
</Stack>
|
|
62
|
+
),
|
|
63
|
+
args: defaultArgs,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const PutOnTheEnd: Story = {
|
|
67
|
+
render: (args) => (
|
|
68
|
+
<Stack {...args} alignItems="flex-end">
|
|
69
|
+
<p style={{ margin: 0 }}>テスト</p>
|
|
70
|
+
<p style={{ margin: 0 }}>テスト</p>
|
|
71
|
+
<p style={{ margin: 0 }}>テスト</p>
|
|
72
|
+
<p style={{ margin: 0 }}>テスト</p>
|
|
73
|
+
</Stack>
|
|
74
|
+
),
|
|
75
|
+
args: defaultArgs,
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const MarginAndPadding: Story = {
|
|
79
|
+
render: (args) => (
|
|
80
|
+
<Stack {...args} mt="lg" mr="lg" mb="lg" ml="lg" pt="xxl" pr="xxl" pb="xxl" pl="xxl">
|
|
81
|
+
<p style={{ margin: 0 }}>Text</p>
|
|
82
|
+
<p style={{ margin: 0 }}>Text</p>
|
|
83
|
+
<p style={{ margin: 0 }}>Text</p>
|
|
84
|
+
<p style={{ margin: 0 }}>Text</p>
|
|
85
|
+
</Stack>
|
|
86
|
+
),
|
|
87
|
+
args: defaultArgs,
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export const AsBox: Story = {
|
|
91
|
+
render: (args) => (
|
|
92
|
+
<Stack
|
|
93
|
+
{...args}
|
|
94
|
+
as={<Box radius="md" backgroundColor="blue" pt="lg" pr="lg" pb="lg" pl="lg" />}
|
|
95
|
+
>
|
|
96
|
+
<p style={{ margin: 0 }}>Text</p>
|
|
97
|
+
<p style={{ margin: 0 }}>Text</p>
|
|
98
|
+
<p style={{ margin: 0 }}>Text</p>
|
|
99
|
+
<p style={{ margin: 0 }}>Text</p>
|
|
100
|
+
</Stack>
|
|
101
|
+
),
|
|
102
|
+
args: defaultArgs,
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const CustomDataAttribute: Story = {
|
|
106
|
+
render: (args) => (
|
|
107
|
+
<Stack {...args}>
|
|
108
|
+
<p>This is a paragraph.</p>
|
|
109
|
+
<p>This is a paragraph.</p>
|
|
110
|
+
</Stack>
|
|
111
|
+
),
|
|
112
|
+
args: { ...defaultArgs, "data-test-id": "custom-attribute" },
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export const Width: Story = {
|
|
116
|
+
render: (args) => (
|
|
117
|
+
<>
|
|
118
|
+
<Stack {...args} width="100%">
|
|
119
|
+
<p style={{ margin: 0 }}>width: 100%</p>
|
|
120
|
+
<p style={{ margin: 0 }}>Text</p>
|
|
121
|
+
<p style={{ margin: 0 }}>Text</p>
|
|
122
|
+
<p style={{ margin: 0 }}>Text</p>
|
|
123
|
+
</Stack>
|
|
124
|
+
|
|
125
|
+
<br />
|
|
126
|
+
|
|
127
|
+
<Stack {...args} minWidth="500px">
|
|
128
|
+
<p style={{ margin: 0 }}>min-width: 500px</p>
|
|
129
|
+
<p style={{ margin: 0 }}>Text</p>
|
|
130
|
+
<p style={{ margin: 0 }}>Text</p>
|
|
131
|
+
<p style={{ margin: 0 }}>Text</p>
|
|
132
|
+
</Stack>
|
|
133
|
+
|
|
134
|
+
<br />
|
|
135
|
+
|
|
136
|
+
<Stack {...args} maxWidth="500px">
|
|
137
|
+
<p style={{ margin: 0 }}>max-width: 500px</p>
|
|
138
|
+
<p style={{ margin: 0 }}>Text</p>
|
|
139
|
+
<p style={{ margin: 0 }}>Text</p>
|
|
140
|
+
<p style={{ margin: 0 }}>Text</p>
|
|
141
|
+
</Stack>
|
|
142
|
+
</>
|
|
143
|
+
),
|
|
144
|
+
args: defaultArgs,
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export const Gap: Story = {
|
|
148
|
+
render: () => (
|
|
149
|
+
<Stack gap="md">
|
|
150
|
+
<p style={{ margin: 0 }}>Text</p>
|
|
151
|
+
<p style={{ margin: 0 }}>Text</p>
|
|
152
|
+
<p style={{ margin: 0 }}>Text</p>
|
|
153
|
+
<p style={{ margin: 0 }}>Text</p>
|
|
154
|
+
</Stack>
|
|
155
|
+
),
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export const NoSpacing: Story = {
|
|
159
|
+
render: () => (
|
|
160
|
+
<Stack>
|
|
161
|
+
<p style={{ margin: 0 }}>Text</p>
|
|
162
|
+
<p style={{ margin: 0 }}>Text</p>
|
|
163
|
+
<p style={{ margin: 0 }}>Text</p>
|
|
164
|
+
<p style={{ margin: 0 }}>Text</p>
|
|
165
|
+
</Stack>
|
|
166
|
+
),
|
|
167
|
+
};
|