@byline/ui 6.8.0 → 6.9.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 +43 -5
- package/package.json +11 -2
- package/src/components/accordion/accordion.stories.tsx +121 -0
- package/src/components/animation/fade-in-lift.stories.tsx +80 -0
- package/src/components/avatar/avatar.stories.tsx +39 -0
- package/src/components/badge/badge.stories.tsx +41 -0
- package/src/components/button/button-group.stories.tsx +44 -0
- package/src/components/button/button-intents.stories.tsx +97 -0
- package/src/components/button/button-overrides.stories.tsx +59 -0
- package/src/components/button/button-test.stories.tsx +59 -0
- package/src/components/button/button-variants.stories.tsx +57 -0
- package/src/components/button/combo-buttons.stories.tsx +82 -0
- package/src/components/button/control-buttons.stories.tsx +60 -0
- package/src/components/button/copy-button.stories.tsx +50 -0
- package/src/components/button/icon-button.stories.tsx +140 -0
- package/src/components/card/card.stories.tsx +60 -0
- package/src/components/chips/chip.stories.tsx +120 -0
- package/src/components/container/container.stories.tsx +35 -0
- package/src/components/dropdown/dropdown.stories.tsx +108 -0
- package/src/components/hamburger/hamburger.stories.tsx +33 -0
- package/src/components/inputs/autocomplete.stories.tsx +189 -0
- package/src/components/inputs/calendar.stories.tsx +141 -0
- package/src/components/inputs/checkbox-group.stories.tsx +43 -0
- package/src/components/inputs/checkbox.stories.tsx +284 -0
- package/src/components/inputs/input.stories.tsx +189 -0
- package/src/components/inputs/radio-group.stories.tsx +73 -0
- package/src/components/inputs/select.stories.tsx +70 -0
- package/src/components/inputs/text-area.stories.tsx +45 -0
- package/src/components/notifications/alert.stories.tsx +75 -0
- package/src/components/notifications/toast.stories.tsx +40 -0
- package/src/components/pager/pagination.stories.tsx +189 -0
- package/src/components/scroll-area/scroll-area.stories.tsx +33 -0
- package/src/components/shimmer/shimmer.stories.tsx +24 -0
- package/src/components/table/table.stories.tsx +94 -0
- package/src/components/tabs/tabs.stories.tsx +47 -0
- package/src/components/tooltip/tooltip.stories.tsx +56 -0
- package/src/icons/icons.stories.tsx +67 -0
- package/src/icons/index.stories.tsx +24 -0
- package/src/loaders/loaders.stories.tsx +188 -0
- package/src/styles/base/colors.stories.tsx +671 -0
- package/src/styles/theme/theme.stories.tsx +40 -0
- package/src/styles/typography/article.stories.tsx +39 -0
- package/src/styles/typography/code.stories.tsx +73 -0
- package/src/styles/typography/default.stories.tsx +49 -0
- package/src/styles/typography/lists.stories.tsx +48 -0
- package/src/styles/typography/quote.stories.tsx +38 -0
- package/src/widgets/datepicker/datepicker.stories.tsx +42 -0
- package/src/widgets/drawer/drawer.stories.tsx +281 -0
- package/src/widgets/modal/modal.stories.tsx +63 -0
- package/src/widgets/search/search.stories.tsx +18 -0
- package/src/widgets/timeline/timeline.stories.tsx +50 -0
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import type React from 'react'
|
|
2
|
+
import { useState } from 'react'
|
|
3
|
+
|
|
4
|
+
import { Checkbox } from './checkbox.js'
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Components/Inputs/Checkbox',
|
|
8
|
+
component: Checkbox,
|
|
9
|
+
argTypes: {},
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const Default = (): React.JSX.Element => {
|
|
13
|
+
const [checked, setChecked] = useState(false)
|
|
14
|
+
const handleOnClick = (): void => {
|
|
15
|
+
console.log('clicked')
|
|
16
|
+
setChecked(!checked)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<>
|
|
21
|
+
<div style={{ maxWidth: '800px', margin: '2rem auto 2rem' }}>
|
|
22
|
+
<h2 style={{ fontSize: '1.25rem', marginBottom: '1rem' }}>Outlined</h2>
|
|
23
|
+
<div
|
|
24
|
+
style={{ display: 'grid', gridTemplateColumns: 'repeat(3, minmax(0, 1fr))', gap: '1rem' }}
|
|
25
|
+
>
|
|
26
|
+
<div style={{ minWidth: 0 }}>
|
|
27
|
+
<Checkbox
|
|
28
|
+
onClick={handleOnClick}
|
|
29
|
+
aria-label="Foo Primary"
|
|
30
|
+
checked={checked}
|
|
31
|
+
id="primary"
|
|
32
|
+
name="primary"
|
|
33
|
+
label="Foo Primary"
|
|
34
|
+
/>
|
|
35
|
+
</div>
|
|
36
|
+
<div style={{ minWidth: 0 }}>
|
|
37
|
+
<Checkbox
|
|
38
|
+
intent="secondary"
|
|
39
|
+
onClick={handleOnClick}
|
|
40
|
+
aria-label="Foo Secondary"
|
|
41
|
+
checked={checked}
|
|
42
|
+
id="secondary"
|
|
43
|
+
name="secondary"
|
|
44
|
+
label="Foo Secondary"
|
|
45
|
+
/>
|
|
46
|
+
</div>
|
|
47
|
+
<div style={{ minWidth: 0 }}>
|
|
48
|
+
<Checkbox
|
|
49
|
+
intent="noeffect"
|
|
50
|
+
onClick={handleOnClick}
|
|
51
|
+
aria-label="Foo No Effect"
|
|
52
|
+
checked={checked}
|
|
53
|
+
id="noeffect"
|
|
54
|
+
name="noneffect"
|
|
55
|
+
label="Foo No Effect"
|
|
56
|
+
/>
|
|
57
|
+
</div>
|
|
58
|
+
<div style={{ minWidth: 0 }}>
|
|
59
|
+
<Checkbox
|
|
60
|
+
intent="success"
|
|
61
|
+
onClick={handleOnClick}
|
|
62
|
+
aria-label="Foo Success"
|
|
63
|
+
checked={checked}
|
|
64
|
+
id="success"
|
|
65
|
+
name="success"
|
|
66
|
+
label="Foo Success"
|
|
67
|
+
/>
|
|
68
|
+
</div>
|
|
69
|
+
<div style={{ minWidth: 0 }}>
|
|
70
|
+
<Checkbox
|
|
71
|
+
intent="info"
|
|
72
|
+
onClick={handleOnClick}
|
|
73
|
+
aria-label="Foo Info"
|
|
74
|
+
checked={checked}
|
|
75
|
+
id="info"
|
|
76
|
+
name="info"
|
|
77
|
+
label="Foo Info"
|
|
78
|
+
/>
|
|
79
|
+
</div>
|
|
80
|
+
<div style={{ minWidth: 0 }}>
|
|
81
|
+
<Checkbox
|
|
82
|
+
intent="warning"
|
|
83
|
+
onClick={handleOnClick}
|
|
84
|
+
aria-label="Foo Warning"
|
|
85
|
+
checked={checked}
|
|
86
|
+
id="warning"
|
|
87
|
+
name="warning"
|
|
88
|
+
label="Foo Warning"
|
|
89
|
+
/>
|
|
90
|
+
</div>
|
|
91
|
+
<div style={{ minWidth: 0 }}>
|
|
92
|
+
<Checkbox
|
|
93
|
+
intent="danger"
|
|
94
|
+
onClick={handleOnClick}
|
|
95
|
+
aria-label="Foo Danger"
|
|
96
|
+
checked={checked}
|
|
97
|
+
id="danger"
|
|
98
|
+
name="danger"
|
|
99
|
+
label="Foo Danger"
|
|
100
|
+
/>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
<div style={{ maxWidth: '800px', margin: '0 auto 2rem' }}>
|
|
105
|
+
<h2 style={{ fontSize: '1.25rem', marginBottom: '1rem' }}>Filled</h2>
|
|
106
|
+
<div
|
|
107
|
+
style={{ display: 'grid', gridTemplateColumns: 'repeat(3, minmax(0, 1fr))', gap: '1rem' }}
|
|
108
|
+
>
|
|
109
|
+
<div style={{ minWidth: 0 }}>
|
|
110
|
+
<Checkbox
|
|
111
|
+
onClick={handleOnClick}
|
|
112
|
+
variant="filled"
|
|
113
|
+
aria-label="Foo Primary"
|
|
114
|
+
checked={checked}
|
|
115
|
+
id="primary"
|
|
116
|
+
name="primary"
|
|
117
|
+
label="Foo Primary"
|
|
118
|
+
/>
|
|
119
|
+
</div>
|
|
120
|
+
<div style={{ minWidth: 0 }}>
|
|
121
|
+
<Checkbox
|
|
122
|
+
intent="secondary"
|
|
123
|
+
onClick={handleOnClick}
|
|
124
|
+
variant="filled"
|
|
125
|
+
aria-label="Foo Secondary"
|
|
126
|
+
checked={checked}
|
|
127
|
+
id="secondary"
|
|
128
|
+
name="secondary"
|
|
129
|
+
label="Foo Secondary"
|
|
130
|
+
/>
|
|
131
|
+
</div>
|
|
132
|
+
<div style={{ minWidth: 0 }}>
|
|
133
|
+
<Checkbox
|
|
134
|
+
intent="noeffect"
|
|
135
|
+
onClick={handleOnClick}
|
|
136
|
+
variant="filled"
|
|
137
|
+
aria-label="Foo No Effect"
|
|
138
|
+
checked={checked}
|
|
139
|
+
id="noeffect"
|
|
140
|
+
name="noneffect"
|
|
141
|
+
label="Foo No Effect"
|
|
142
|
+
/>
|
|
143
|
+
</div>
|
|
144
|
+
<div style={{ minWidth: 0 }}>
|
|
145
|
+
<Checkbox
|
|
146
|
+
intent="success"
|
|
147
|
+
onClick={handleOnClick}
|
|
148
|
+
variant="filled"
|
|
149
|
+
aria-label="Foo Success"
|
|
150
|
+
checked={checked}
|
|
151
|
+
id="success"
|
|
152
|
+
name="success"
|
|
153
|
+
label="Foo Success"
|
|
154
|
+
/>
|
|
155
|
+
</div>
|
|
156
|
+
<div style={{ minWidth: 0 }}>
|
|
157
|
+
<Checkbox
|
|
158
|
+
intent="info"
|
|
159
|
+
onClick={handleOnClick}
|
|
160
|
+
variant="filled"
|
|
161
|
+
aria-label="Foo Info"
|
|
162
|
+
checked={checked}
|
|
163
|
+
id="info"
|
|
164
|
+
name="info"
|
|
165
|
+
label="Foo Info"
|
|
166
|
+
/>
|
|
167
|
+
</div>
|
|
168
|
+
<div style={{ minWidth: 0 }}>
|
|
169
|
+
<Checkbox
|
|
170
|
+
intent="warning"
|
|
171
|
+
onClick={handleOnClick}
|
|
172
|
+
variant="filled"
|
|
173
|
+
aria-label="Foo Warning"
|
|
174
|
+
checked={checked}
|
|
175
|
+
id="warning"
|
|
176
|
+
name="warning"
|
|
177
|
+
label="Foo Warning"
|
|
178
|
+
/>
|
|
179
|
+
</div>
|
|
180
|
+
<div style={{ minWidth: 0 }}>
|
|
181
|
+
<Checkbox
|
|
182
|
+
intent="danger"
|
|
183
|
+
onClick={handleOnClick}
|
|
184
|
+
variant="filled"
|
|
185
|
+
aria-label="Foo Danger"
|
|
186
|
+
checked={checked}
|
|
187
|
+
id="danger"
|
|
188
|
+
name="danger"
|
|
189
|
+
label="Foo Danger"
|
|
190
|
+
/>
|
|
191
|
+
</div>
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
</>
|
|
195
|
+
)
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export const Checked = (): React.JSX.Element => {
|
|
199
|
+
const [checked, setChecked] = useState(true)
|
|
200
|
+
const handleOnClick = (): void => {
|
|
201
|
+
setChecked(!checked)
|
|
202
|
+
}
|
|
203
|
+
return (
|
|
204
|
+
<div style={{ maxWidth: '800px', margin: '4rem auto' }}>
|
|
205
|
+
<Checkbox
|
|
206
|
+
aria-label="Foo Checkbox"
|
|
207
|
+
onClick={handleOnClick}
|
|
208
|
+
checked={checked}
|
|
209
|
+
id="foo"
|
|
210
|
+
name="foo"
|
|
211
|
+
label="Foo Checkbox"
|
|
212
|
+
/>
|
|
213
|
+
</div>
|
|
214
|
+
)
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export const Sized = (): React.JSX.Element => {
|
|
218
|
+
const [checked, setChecked] = useState(true)
|
|
219
|
+
const handleOnClick = (): void => {
|
|
220
|
+
setChecked(!checked)
|
|
221
|
+
}
|
|
222
|
+
return (
|
|
223
|
+
<div style={{ maxWidth: '800px', margin: '2rem auto 2rem' }}>
|
|
224
|
+
<h2 style={{ fontSize: '1.25rem', marginBottom: '1rem' }}>Outlined</h2>
|
|
225
|
+
<div
|
|
226
|
+
style={{ display: 'grid', gridTemplateColumns: 'repeat(3, minmax(0, 1fr))', gap: '1rem' }}
|
|
227
|
+
>
|
|
228
|
+
<div style={{ minWidth: 0 }}>
|
|
229
|
+
<Checkbox
|
|
230
|
+
onClick={handleOnClick}
|
|
231
|
+
aria-label="Large Checkbox"
|
|
232
|
+
size="lg"
|
|
233
|
+
checked={checked}
|
|
234
|
+
id="large"
|
|
235
|
+
name="large"
|
|
236
|
+
label="Large Checkbox"
|
|
237
|
+
/>
|
|
238
|
+
</div>
|
|
239
|
+
<div style={{ minWidth: 0 }}>
|
|
240
|
+
<Checkbox
|
|
241
|
+
onClick={handleOnClick}
|
|
242
|
+
aria-label="Medium Checkbox"
|
|
243
|
+
size="md"
|
|
244
|
+
checked={checked}
|
|
245
|
+
id="medium"
|
|
246
|
+
name="medium"
|
|
247
|
+
label="Medium Checkbox"
|
|
248
|
+
/>
|
|
249
|
+
</div>
|
|
250
|
+
<div style={{ minWidth: 0 }}>
|
|
251
|
+
<Checkbox
|
|
252
|
+
onClick={handleOnClick}
|
|
253
|
+
aria-label="Small Checkbox"
|
|
254
|
+
size="sm"
|
|
255
|
+
checked={checked}
|
|
256
|
+
id="small"
|
|
257
|
+
name="small"
|
|
258
|
+
label="Small Checkbox"
|
|
259
|
+
/>
|
|
260
|
+
</div>
|
|
261
|
+
</div>
|
|
262
|
+
</div>
|
|
263
|
+
)
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export const Disabled = (): React.JSX.Element => {
|
|
267
|
+
const [checked, setChecked] = useState(true)
|
|
268
|
+
const handleOnClick = (): void => {
|
|
269
|
+
setChecked(!checked)
|
|
270
|
+
}
|
|
271
|
+
return (
|
|
272
|
+
<div style={{ maxWidth: '800px', margin: '4rem auto' }}>
|
|
273
|
+
<Checkbox
|
|
274
|
+
aria-label="Foo Checkbox"
|
|
275
|
+
onClick={handleOnClick}
|
|
276
|
+
checked={checked}
|
|
277
|
+
disabled
|
|
278
|
+
id="foo"
|
|
279
|
+
name="foo"
|
|
280
|
+
label="Foo Checkbox"
|
|
281
|
+
/>
|
|
282
|
+
</div>
|
|
283
|
+
)
|
|
284
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import type React from 'react'
|
|
2
|
+
|
|
3
|
+
import { CloseIcon, SearchIcon } from '../../icons/index.js'
|
|
4
|
+
import { capitalize } from '../../utils/capitalize.js'
|
|
5
|
+
import { intent } from '../@types/shared.js'
|
|
6
|
+
import { IconButton } from '../button/icon-button.js'
|
|
7
|
+
import { size, variant } from './@types/input.js'
|
|
8
|
+
import { Input, InputAdornment } from './index.js'
|
|
9
|
+
import { InputPassword } from './input-password.js'
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
title: 'Components/Inputs/Text',
|
|
13
|
+
component: Input,
|
|
14
|
+
argTypes: {},
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const Default = (): React.JSX.Element => {
|
|
18
|
+
return (
|
|
19
|
+
<div style={{ margin: '2rem 0' }}>
|
|
20
|
+
<div
|
|
21
|
+
style={{
|
|
22
|
+
maxWidth: '600px',
|
|
23
|
+
margin: '0 auto',
|
|
24
|
+
display: 'flex',
|
|
25
|
+
flexDirection: 'column',
|
|
26
|
+
gap: '1rem',
|
|
27
|
+
}}
|
|
28
|
+
>
|
|
29
|
+
<Input
|
|
30
|
+
variant="outlined"
|
|
31
|
+
intent="primary"
|
|
32
|
+
id="name"
|
|
33
|
+
name="name"
|
|
34
|
+
label="Name"
|
|
35
|
+
placeHolder="Name"
|
|
36
|
+
helpText="Please enter your name."
|
|
37
|
+
disabled={false}
|
|
38
|
+
error={false}
|
|
39
|
+
/>
|
|
40
|
+
<Input
|
|
41
|
+
variant="outlined"
|
|
42
|
+
intent="secondary"
|
|
43
|
+
required
|
|
44
|
+
id="foo"
|
|
45
|
+
name="foo"
|
|
46
|
+
label="Foo Required"
|
|
47
|
+
placeHolder="Foo"
|
|
48
|
+
helpText="Please enter your foo."
|
|
49
|
+
disabled={false}
|
|
50
|
+
error={false}
|
|
51
|
+
/>
|
|
52
|
+
<Input
|
|
53
|
+
variant="outlined"
|
|
54
|
+
intent="primary"
|
|
55
|
+
label="Start and End Adornments"
|
|
56
|
+
startAdornment={
|
|
57
|
+
<InputAdornment>
|
|
58
|
+
<IconButton role="button" intent="noeffect" variant="text" ripple={false} size="xs">
|
|
59
|
+
<SearchIcon width="20px" height="20px" />
|
|
60
|
+
</IconButton>
|
|
61
|
+
</InputAdornment>
|
|
62
|
+
}
|
|
63
|
+
endAdornment={
|
|
64
|
+
<InputAdornment>
|
|
65
|
+
<IconButton role="button" intent="noeffect" variant="text" size="xs">
|
|
66
|
+
<CloseIcon width="16px" height="16px" />
|
|
67
|
+
</IconButton>
|
|
68
|
+
</InputAdornment>
|
|
69
|
+
}
|
|
70
|
+
id="search"
|
|
71
|
+
name="search"
|
|
72
|
+
placeHolder="Search"
|
|
73
|
+
disabled={false}
|
|
74
|
+
error={false}
|
|
75
|
+
/>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export const Variants = (): React.JSX.Element => {
|
|
82
|
+
return (
|
|
83
|
+
<div style={{ maxWidth: '1100px', margin: '0 auto' }}>
|
|
84
|
+
{variant.map((variant) => {
|
|
85
|
+
return (
|
|
86
|
+
<div
|
|
87
|
+
key={variant}
|
|
88
|
+
style={{
|
|
89
|
+
marginBottom: '2rem',
|
|
90
|
+
display: 'grid',
|
|
91
|
+
gridTemplateColumns: 'repeat(4, minmax(0, 1fr))',
|
|
92
|
+
alignItems: 'center',
|
|
93
|
+
gap: '3rem',
|
|
94
|
+
}}
|
|
95
|
+
>
|
|
96
|
+
{size.map((size) => {
|
|
97
|
+
return (
|
|
98
|
+
<Input
|
|
99
|
+
key={`${variant}=${size}`}
|
|
100
|
+
variant={variant}
|
|
101
|
+
inputSize={size}
|
|
102
|
+
id={`${variant}-${size}`}
|
|
103
|
+
name={`${variant}-${size}`}
|
|
104
|
+
label={`${capitalize(variant)} ${size.toUpperCase()}`}
|
|
105
|
+
placeHolder={`${capitalize(variant)} ${size.toUpperCase()}`}
|
|
106
|
+
helpText={`Please enter your ${variant} ${size.toUpperCase()}.`}
|
|
107
|
+
disabled={false}
|
|
108
|
+
error={false}
|
|
109
|
+
/>
|
|
110
|
+
)
|
|
111
|
+
})}
|
|
112
|
+
<Input
|
|
113
|
+
disabled={true}
|
|
114
|
+
key={`${variant}=${size}`}
|
|
115
|
+
variant={variant}
|
|
116
|
+
id={`${variant}-${size}`}
|
|
117
|
+
name={`${variant}-${size}`}
|
|
118
|
+
label={`${capitalize(variant)} Disabled`}
|
|
119
|
+
placeHolder={`${capitalize(variant)} disabled`}
|
|
120
|
+
helpText={`Please enter your ${variant} disabled.`}
|
|
121
|
+
error={false}
|
|
122
|
+
/>
|
|
123
|
+
</div>
|
|
124
|
+
)
|
|
125
|
+
})}
|
|
126
|
+
</div>
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export const Intents = (): React.JSX.Element => {
|
|
131
|
+
return (
|
|
132
|
+
<div style={{ maxWidth: '800px', margin: '0 auto' }}>
|
|
133
|
+
{intent.map((i) => {
|
|
134
|
+
return (
|
|
135
|
+
<div key={i} style={{ marginBottom: '12px' }}>
|
|
136
|
+
<Input
|
|
137
|
+
key={i}
|
|
138
|
+
variant="outlined"
|
|
139
|
+
intent={i}
|
|
140
|
+
inputSize="md"
|
|
141
|
+
id={i}
|
|
142
|
+
name={i}
|
|
143
|
+
label={capitalize(i)}
|
|
144
|
+
placeHolder={capitalize(i)}
|
|
145
|
+
helpText={`Please enter your ${i}`}
|
|
146
|
+
disabled={false}
|
|
147
|
+
error={false}
|
|
148
|
+
/>
|
|
149
|
+
</div>
|
|
150
|
+
)
|
|
151
|
+
})}
|
|
152
|
+
</div>
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>
|
|
157
|
+
export const Error = (): React.JSX.Element => {
|
|
158
|
+
return (
|
|
159
|
+
<div style={{ maxWidth: '600px', margin: '0 auto' }}>
|
|
160
|
+
<Input
|
|
161
|
+
required
|
|
162
|
+
id="name"
|
|
163
|
+
name="name"
|
|
164
|
+
label="Name"
|
|
165
|
+
placeHolder="Name"
|
|
166
|
+
helpText="Please enter your name."
|
|
167
|
+
disabled={false}
|
|
168
|
+
error={true}
|
|
169
|
+
errorText="Please enter a valid name."
|
|
170
|
+
/>
|
|
171
|
+
</div>
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export const Password = (): React.JSX.Element => {
|
|
176
|
+
return (
|
|
177
|
+
<div style={{ maxWidth: '300px', margin: '0 auto' }}>
|
|
178
|
+
<InputPassword
|
|
179
|
+
required
|
|
180
|
+
id="password"
|
|
181
|
+
name="password"
|
|
182
|
+
label="Password"
|
|
183
|
+
placeHolder="Password"
|
|
184
|
+
helpText="Please enter your password."
|
|
185
|
+
disabled={false}
|
|
186
|
+
/>
|
|
187
|
+
</div>
|
|
188
|
+
)
|
|
189
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { Meta } from '@storybook/react-vite'
|
|
2
|
+
|
|
3
|
+
import { RadioGroup as RadioGroupComponent, RadioGroupItem } from './radio-group.js'
|
|
4
|
+
import type { RadioGroupValue } from './radio-group.js'
|
|
5
|
+
|
|
6
|
+
const meta: Meta = {
|
|
7
|
+
/* 👇 The title prop is optional.
|
|
8
|
+
* See https://storybook.js.org/docs/react/configure/overview#configure-story-loading
|
|
9
|
+
* to learn how to generate automatic titles
|
|
10
|
+
*/
|
|
11
|
+
title: 'Components/Inputs/RadioGroup',
|
|
12
|
+
component: RadioGroupComponent,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default meta
|
|
16
|
+
|
|
17
|
+
const values1: RadioGroupValue[] = [
|
|
18
|
+
{ id: 'rg1', label: 'One', value: '1' },
|
|
19
|
+
{ id: 'rg2', label: 'Two', value: '2' },
|
|
20
|
+
{ id: 'rg3', label: 'Three', value: '3' },
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
const values2: RadioGroupValue[] = [
|
|
24
|
+
{ id: 'rg4', label: 'One', value: '1' },
|
|
25
|
+
{ id: 'rg5', label: 'Two', value: '2' },
|
|
26
|
+
{ id: 'rg6', label: 'Three', value: '3' },
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
const values3: RadioGroupValue[] = [
|
|
30
|
+
{ id: 'rg7', label: 'One', value: '1' },
|
|
31
|
+
{ id: 'rg8', label: 'Two', value: '2' },
|
|
32
|
+
{ id: 'rg9', label: 'Three', value: '3' },
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
export const Default = (): React.JSX.Element => {
|
|
36
|
+
return (
|
|
37
|
+
<>
|
|
38
|
+
<div style={{ maxWidth: '600px', margin: '2rem auto' }}>
|
|
39
|
+
<RadioGroupComponent direction="row" defaultValue="1">
|
|
40
|
+
{values1.map((value) => (
|
|
41
|
+
<RadioGroupItem key={value.id} value={value.value} id={value.id} label={value.label} />
|
|
42
|
+
))}
|
|
43
|
+
</RadioGroupComponent>
|
|
44
|
+
</div>
|
|
45
|
+
<div style={{ maxWidth: '600px', margin: '2rem auto' }}>
|
|
46
|
+
<RadioGroupComponent direction="row" defaultValue="2">
|
|
47
|
+
{values2.map((value) => (
|
|
48
|
+
<RadioGroupItem
|
|
49
|
+
intent="secondary"
|
|
50
|
+
key={value.id}
|
|
51
|
+
value={value.value}
|
|
52
|
+
id={value.id}
|
|
53
|
+
label={value.label}
|
|
54
|
+
/>
|
|
55
|
+
))}
|
|
56
|
+
</RadioGroupComponent>
|
|
57
|
+
</div>
|
|
58
|
+
<div style={{ maxWidth: '600px', margin: '2rem auto' }}>
|
|
59
|
+
<RadioGroupComponent direction="column" defaultValue="3">
|
|
60
|
+
{values3.map((value) => (
|
|
61
|
+
<RadioGroupItem
|
|
62
|
+
intent="success"
|
|
63
|
+
key={value.id}
|
|
64
|
+
value={value.value}
|
|
65
|
+
id={value.id}
|
|
66
|
+
label={value.label}
|
|
67
|
+
/>
|
|
68
|
+
))}
|
|
69
|
+
</RadioGroupComponent>
|
|
70
|
+
</div>
|
|
71
|
+
</>
|
|
72
|
+
)
|
|
73
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type React from 'react'
|
|
2
|
+
|
|
3
|
+
import { Select, SelectItem, type SelectValue } from './select.js'
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Components/Inputs/Select',
|
|
7
|
+
component: Select,
|
|
8
|
+
argTypes: {},
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const values: SelectValue[] = [
|
|
12
|
+
{ label: 'One', value: '1' },
|
|
13
|
+
{ label: 'Two', value: '2' },
|
|
14
|
+
{ label: 'Three', value: '3' },
|
|
15
|
+
{ label: 'Four', value: '4' },
|
|
16
|
+
{ label: 'Five', value: '5' },
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
export const Default = (): React.JSX.Element => {
|
|
20
|
+
return (
|
|
21
|
+
<>
|
|
22
|
+
<div style={{ maxWidth: '600px', margin: '2rem auto' }}>
|
|
23
|
+
<Select
|
|
24
|
+
items={values}
|
|
25
|
+
size="xl"
|
|
26
|
+
placeholder="Select one..."
|
|
27
|
+
helpText="Extra Large select."
|
|
28
|
+
/>
|
|
29
|
+
</div>
|
|
30
|
+
<div style={{ maxWidth: '600px', margin: '2rem auto' }}>
|
|
31
|
+
<Select items={values} size="lg" placeholder="Select one..." helpText="Large select." />
|
|
32
|
+
</div>
|
|
33
|
+
<div style={{ maxWidth: '600px', margin: '2rem auto' }}>
|
|
34
|
+
<Select items={values} size="md" placeholder="Select one..." helpText="Medium select." />
|
|
35
|
+
</div>
|
|
36
|
+
<div style={{ maxWidth: '600px', margin: '2rem auto' }}>
|
|
37
|
+
<Select items={values} size="sm" placeholder="Select one..." helpText="Small select." />
|
|
38
|
+
</div>
|
|
39
|
+
<div style={{ maxWidth: '600px', margin: '2rem auto' }}>
|
|
40
|
+
<Select
|
|
41
|
+
items={values}
|
|
42
|
+
size="xs"
|
|
43
|
+
placeholder="Select one..."
|
|
44
|
+
helpText="Extra small select."
|
|
45
|
+
/>
|
|
46
|
+
</div>
|
|
47
|
+
</>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const CustomChildren = (): React.JSX.Element => {
|
|
52
|
+
return (
|
|
53
|
+
<div style={{ maxWidth: '600px', margin: '2rem auto' }}>
|
|
54
|
+
<Select
|
|
55
|
+
items={values}
|
|
56
|
+
size="md"
|
|
57
|
+
placeholder="Select one..."
|
|
58
|
+
helpText="Custom children rendering."
|
|
59
|
+
>
|
|
60
|
+
{values.map((value) => (
|
|
61
|
+
<SelectItem key={value.value} value={value.value} label={value.label}>
|
|
62
|
+
{value.prefix}
|
|
63
|
+
{value.label}
|
|
64
|
+
{value.suffix}
|
|
65
|
+
</SelectItem>
|
|
66
|
+
))}
|
|
67
|
+
</Select>
|
|
68
|
+
</div>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type React from 'react'
|
|
2
|
+
|
|
3
|
+
import { TextArea } from './index.js'
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Components/Inputs/TextArea',
|
|
7
|
+
component: TextArea,
|
|
8
|
+
argTypes: {},
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const Default = (): React.JSX.Element => {
|
|
12
|
+
return (
|
|
13
|
+
<div style={{ maxWidth: '600px', margin: '2rem auto' }}>
|
|
14
|
+
<TextArea
|
|
15
|
+
required
|
|
16
|
+
id="message"
|
|
17
|
+
name="message"
|
|
18
|
+
rows={5}
|
|
19
|
+
label="Message"
|
|
20
|
+
helpText="Please enter a message."
|
|
21
|
+
disabled={false}
|
|
22
|
+
error={false}
|
|
23
|
+
/>
|
|
24
|
+
</div>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>
|
|
29
|
+
export const Error = (): React.JSX.Element => {
|
|
30
|
+
return (
|
|
31
|
+
<div style={{ maxWidth: '600px', margin: '2rem auto' }}>
|
|
32
|
+
<TextArea
|
|
33
|
+
required
|
|
34
|
+
id="message"
|
|
35
|
+
name="message"
|
|
36
|
+
rows={5}
|
|
37
|
+
label="Message"
|
|
38
|
+
helpText="Please enter a message."
|
|
39
|
+
disabled={false}
|
|
40
|
+
error={true}
|
|
41
|
+
errorText="Messages must be longer than 15 characers..."
|
|
42
|
+
/>
|
|
43
|
+
</div>
|
|
44
|
+
)
|
|
45
|
+
}
|