@windstream/react-shared-components 0.0.10 → 0.0.12
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 +623 -623
- package/dist/contentful/index.d.ts +6 -2
- package/dist/contentful/index.esm.js +1 -1
- package/dist/contentful/index.esm.js.map +1 -1
- package/dist/contentful/index.js +1 -1
- package/dist/contentful/index.js.map +1 -1
- package/dist/core.d.ts +5 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +159 -159
- package/src/components/accordion/Accordion.stories.tsx +225 -225
- package/src/components/accordion/index.tsx +36 -36
- package/src/components/accordion/types.ts +9 -9
- package/src/components/alert-card/types.ts +9 -9
- package/src/components/brand-button/BrandButton.stories.tsx +221 -221
- package/src/components/brand-button/helpers.ts +35 -35
- package/src/components/brand-button/index.tsx +90 -90
- package/src/components/brand-button/types.ts +26 -26
- package/src/components/button/Button.stories.tsx +108 -108
- package/src/components/button/index.tsx +23 -23
- package/src/components/button/types.ts +14 -14
- package/src/components/call-button/CallButton.stories.tsx +324 -324
- package/src/components/call-button/index.tsx +80 -80
- package/src/components/call-button/types.ts +9 -9
- package/src/components/checkbox/Checkbox.stories.tsx +248 -248
- package/src/components/checkbox/types.ts +23 -23
- package/src/components/checklist/Checklist.stories.tsx +151 -151
- package/src/components/checklist/index.tsx +33 -33
- package/src/components/checklist/types.ts +5 -5
- package/src/components/collapse/Collapse.stories.tsx +256 -256
- package/src/components/collapse/index.tsx +44 -44
- package/src/components/collapse/types.ts +5 -5
- package/src/components/divider/Divider.stories.tsx +206 -206
- package/src/components/divider/index.tsx +23 -23
- package/src/components/divider/type.ts +2 -2
- package/src/components/input/Input.stories.tsx +358 -358
- package/src/components/input/index.tsx +174 -174
- package/src/components/input/types.ts +36 -36
- package/src/components/link/Link.stories.tsx +163 -163
- package/src/components/link/index.tsx +96 -96
- package/src/components/link/types.ts +25 -25
- package/src/components/list/List.stories.tsx +272 -272
- package/src/components/list/index.tsx +86 -86
- package/src/components/list/list-item/index.tsx +36 -36
- package/src/components/list/list-item/types.ts +13 -13
- package/src/components/list/types.ts +29 -29
- package/src/components/material-icon/MaterialIcon.stories.tsx +330 -330
- package/src/components/material-icon/constants.ts +95 -95
- package/src/components/material-icon/index.tsx +44 -44
- package/src/components/material-icon/types.ts +31 -31
- package/src/components/modal/Modal.stories.tsx +171 -171
- package/src/components/modal/index.tsx +168 -168
- package/src/components/modal/types.ts +23 -23
- package/src/components/radio-button/index.tsx +73 -73
- package/src/components/radio-button/types.ts +21 -21
- package/src/components/see-more/SeeMore.stories.tsx +182 -182
- package/src/components/see-more/index.tsx +38 -38
- package/src/components/see-more/types.ts +3 -3
- package/src/components/select/Select.stories.tsx +410 -410
- package/src/components/select/index.tsx +150 -150
- package/src/components/select/types.ts +34 -34
- package/src/components/select-plan-button/SelectPlanButton.stories.tsx +160 -160
- package/src/components/select-plan-button/index.tsx +20 -20
- package/src/components/select-plan-button/types.ts +3 -3
- package/src/components/skeleton/Skeleton.stories.tsx +180 -180
- package/src/components/skeleton/index.tsx +61 -61
- package/src/components/skeleton/types.ts +3 -3
- package/src/components/spinner/Spinner.stories.tsx +335 -335
- package/src/components/spinner/index.tsx +44 -44
- package/src/components/spinner/types.ts +4 -4
- package/src/components/text/Text.stories.tsx +302 -302
- package/src/components/text/index.tsx +26 -26
- package/src/components/text/types.ts +45 -45
- package/src/components/tooltip/Tooltip.stories.tsx +220 -220
- package/src/components/tooltip/index.tsx +78 -78
- package/src/components/tooltip/types.ts +6 -6
- package/src/components/view-cart-button/ViewCartButton.stories.tsx +241 -241
- package/src/components/view-cart-button/index.tsx +38 -38
- package/src/components/view-cart-button/types.ts +4 -4
- package/src/contentful/blocks/accordion/index.tsx +7 -7
- package/src/contentful/blocks/button/index.tsx +5 -5
- package/src/contentful/blocks/callout/index.tsx +7 -7
- package/src/contentful/blocks/cards/index.tsx +7 -7
- package/src/contentful/blocks/carousel/index.tsx +7 -7
- package/src/contentful/blocks/cta-callout/index.tsx +6 -0
- package/src/contentful/blocks/cta-callout/types.ts +1 -0
- package/src/contentful/blocks/floating-banner/index.tsx +7 -7
- package/src/contentful/blocks/footer/index.tsx +7 -7
- package/src/contentful/blocks/image-promo-bar/index.tsx +7 -7
- package/src/contentful/blocks/modal/index.tsx +5 -5
- package/src/contentful/blocks/navigation/index.tsx +7 -7
- package/src/contentful/blocks/primary-hero/index.tsx +7 -7
- package/src/contentful/blocks/shape-background-wrapper/index.tsx +123 -123
- package/src/contentful/blocks/shape-background-wrapper/types.ts +35 -35
- package/src/contentful/blocks/text/index.tsx +6 -6
- package/src/contentful/index.ts +4 -1
- package/src/hooks/use-body-scroll-lock.ts +31 -31
- package/src/index.ts +81 -81
- package/src/setupTests.ts +46 -46
- package/src/styles/globals.css +275 -319
- package/src/types/global.d.ts +9 -9
- package/src/utils/index.ts +49 -49
|
@@ -1,358 +1,358 @@
|
|
|
1
|
-
import { Input } from "./index";
|
|
2
|
-
import { DocsPage } from "@shared/stories/DocsTemplate";
|
|
3
|
-
|
|
4
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
5
|
-
|
|
6
|
-
const meta: Meta<typeof Input> = {
|
|
7
|
-
title: "Components/Input",
|
|
8
|
-
component: Input,
|
|
9
|
-
tags: ["autodocs"],
|
|
10
|
-
parameters: {
|
|
11
|
-
layout: "centered",
|
|
12
|
-
docs: {
|
|
13
|
-
page: DocsPage,
|
|
14
|
-
description: {
|
|
15
|
-
component:
|
|
16
|
-
"A comprehensive input component with support for labels, error states, icons, loading states, and multiple sizes.",
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
argTypes: {
|
|
21
|
-
placeholder: {
|
|
22
|
-
control: { type: "text" },
|
|
23
|
-
description: "Placeholder text",
|
|
24
|
-
},
|
|
25
|
-
label: {
|
|
26
|
-
control: { type: "text" },
|
|
27
|
-
description: "Label text",
|
|
28
|
-
},
|
|
29
|
-
size: {
|
|
30
|
-
control: { type: "select" },
|
|
31
|
-
options: ["slim", "medium", "large"],
|
|
32
|
-
description: "Input size",
|
|
33
|
-
},
|
|
34
|
-
state: {
|
|
35
|
-
control: { type: "select" },
|
|
36
|
-
options: ["default", "focus", "active", "hover", "filled", "error"],
|
|
37
|
-
description: "Visual state",
|
|
38
|
-
},
|
|
39
|
-
hasError: {
|
|
40
|
-
control: { type: "boolean" },
|
|
41
|
-
description: "Show error state",
|
|
42
|
-
},
|
|
43
|
-
errorText: {
|
|
44
|
-
control: { type: "text" },
|
|
45
|
-
description: "Error message text",
|
|
46
|
-
},
|
|
47
|
-
disabled: {
|
|
48
|
-
control: { type: "boolean" },
|
|
49
|
-
description: "Disable the input",
|
|
50
|
-
},
|
|
51
|
-
loading: {
|
|
52
|
-
control: { type: "boolean" },
|
|
53
|
-
description: "Show loading state",
|
|
54
|
-
},
|
|
55
|
-
required: {
|
|
56
|
-
control: { type: "boolean" },
|
|
57
|
-
description: "Mark input as required",
|
|
58
|
-
},
|
|
59
|
-
type: {
|
|
60
|
-
control: { type: "select" },
|
|
61
|
-
options: ["text", "email", "password", "number", "tel"],
|
|
62
|
-
description: "Input type",
|
|
63
|
-
},
|
|
64
|
-
prefixIconName: {
|
|
65
|
-
control: { type: "select" },
|
|
66
|
-
options: ["location_on", "search"],
|
|
67
|
-
description: "Prefix icon name",
|
|
68
|
-
},
|
|
69
|
-
suffixIconName: {
|
|
70
|
-
control: { type: "select" },
|
|
71
|
-
options: ["visibility", "visibility_off", "lock"],
|
|
72
|
-
description: "Suffix icon name",
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
args: {
|
|
76
|
-
placeholder: "Enter text...",
|
|
77
|
-
size: "medium",
|
|
78
|
-
},
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export default meta;
|
|
82
|
-
type Story = StoryObj<typeof meta>;
|
|
83
|
-
|
|
84
|
-
// Default input
|
|
85
|
-
export const Default: Story = {
|
|
86
|
-
args: {},
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
// With label
|
|
90
|
-
export const WithLabel: Story = {
|
|
91
|
-
args: {
|
|
92
|
-
label: "Email Address",
|
|
93
|
-
placeholder: "Enter your email",
|
|
94
|
-
},
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
// Required input
|
|
98
|
-
export const Required: Story = {
|
|
99
|
-
args: {
|
|
100
|
-
label: "Required Field",
|
|
101
|
-
placeholder: "This field is required",
|
|
102
|
-
required: true,
|
|
103
|
-
},
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
// Error state
|
|
107
|
-
export const Error: Story = {
|
|
108
|
-
args: {
|
|
109
|
-
label: "Email Address",
|
|
110
|
-
placeholder: "Enter your email",
|
|
111
|
-
hasError: true,
|
|
112
|
-
errorText: "Please enter a valid email address",
|
|
113
|
-
},
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
// Different sizes
|
|
117
|
-
export const Sizes: Story = {
|
|
118
|
-
render: () => (
|
|
119
|
-
<div className="w-full max-w-md space-y-4">
|
|
120
|
-
<div>
|
|
121
|
-
<Input
|
|
122
|
-
size="slim"
|
|
123
|
-
placeholder="Slim input"
|
|
124
|
-
label="Slim Size"
|
|
125
|
-
/>
|
|
126
|
-
</div>
|
|
127
|
-
<div>
|
|
128
|
-
<Input
|
|
129
|
-
size="medium"
|
|
130
|
-
placeholder="Medium input"
|
|
131
|
-
label="Medium Size"
|
|
132
|
-
/>
|
|
133
|
-
</div>
|
|
134
|
-
<div>
|
|
135
|
-
<Input
|
|
136
|
-
size="large"
|
|
137
|
-
placeholder="Large input"
|
|
138
|
-
label="Large Size"
|
|
139
|
-
/>
|
|
140
|
-
</div>
|
|
141
|
-
</div>
|
|
142
|
-
),
|
|
143
|
-
parameters: {
|
|
144
|
-
docs: {
|
|
145
|
-
description: {
|
|
146
|
-
story: "All available input sizes: slim, medium, and large.",
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
// With prefix icon
|
|
153
|
-
export const WithPrefixIcon: Story = {
|
|
154
|
-
args: {
|
|
155
|
-
label: "Search",
|
|
156
|
-
placeholder: "Search...",
|
|
157
|
-
prefixIconName: "search",
|
|
158
|
-
prefixIconSize: 24,
|
|
159
|
-
},
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
// With suffix icon
|
|
163
|
-
export const WithSuffixIcon: Story = {
|
|
164
|
-
args: {
|
|
165
|
-
label: "Password",
|
|
166
|
-
placeholder: "Enter password",
|
|
167
|
-
type: "password",
|
|
168
|
-
suffixIconName: "visibility",
|
|
169
|
-
suffixIconSize: 24,
|
|
170
|
-
},
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
// Password input
|
|
174
|
-
export const Password: Story = {
|
|
175
|
-
args: {
|
|
176
|
-
label: "Password",
|
|
177
|
-
placeholder: "Enter your password",
|
|
178
|
-
type: "password",
|
|
179
|
-
suffixIconName: "visibility",
|
|
180
|
-
},
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
// Loading state
|
|
184
|
-
export const Loading: Story = {
|
|
185
|
-
args: {
|
|
186
|
-
label: "Loading Input",
|
|
187
|
-
placeholder: "Loading...",
|
|
188
|
-
loading: true,
|
|
189
|
-
},
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
// Disabled state
|
|
193
|
-
export const Disabled: Story = {
|
|
194
|
-
args: {
|
|
195
|
-
label: "Disabled Input",
|
|
196
|
-
placeholder: "This input is disabled",
|
|
197
|
-
disabled: true,
|
|
198
|
-
},
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
// Different states
|
|
202
|
-
export const States: Story = {
|
|
203
|
-
render: () => (
|
|
204
|
-
<div className="w-full max-w-md space-y-4">
|
|
205
|
-
<div>
|
|
206
|
-
<Input
|
|
207
|
-
label="Default State"
|
|
208
|
-
placeholder="Default input"
|
|
209
|
-
state="default"
|
|
210
|
-
/>
|
|
211
|
-
</div>
|
|
212
|
-
<div>
|
|
213
|
-
<Input
|
|
214
|
-
label="Hover State"
|
|
215
|
-
placeholder="Hover over me"
|
|
216
|
-
state="hover"
|
|
217
|
-
/>
|
|
218
|
-
</div>
|
|
219
|
-
<div>
|
|
220
|
-
<Input
|
|
221
|
-
label="Focus State"
|
|
222
|
-
placeholder="Focus on me"
|
|
223
|
-
state="focus"
|
|
224
|
-
/>
|
|
225
|
-
</div>
|
|
226
|
-
<div>
|
|
227
|
-
<Input
|
|
228
|
-
label="Error State"
|
|
229
|
-
placeholder="Error input"
|
|
230
|
-
state="error"
|
|
231
|
-
errorText="This field has an error"
|
|
232
|
-
/>
|
|
233
|
-
</div>
|
|
234
|
-
</div>
|
|
235
|
-
),
|
|
236
|
-
parameters: {
|
|
237
|
-
docs: {
|
|
238
|
-
description: {
|
|
239
|
-
story: "Different visual states of the input component.",
|
|
240
|
-
},
|
|
241
|
-
},
|
|
242
|
-
},
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
// Email input
|
|
246
|
-
export const Email: Story = {
|
|
247
|
-
args: {
|
|
248
|
-
label: "Email",
|
|
249
|
-
placeholder: "example@email.com",
|
|
250
|
-
type: "email",
|
|
251
|
-
},
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
// Phone input
|
|
255
|
-
export const Phone: Story = {
|
|
256
|
-
args: {
|
|
257
|
-
label: "Phone Number",
|
|
258
|
-
placeholder: "(555) 123-4567",
|
|
259
|
-
type: "tel",
|
|
260
|
-
},
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
// Form example
|
|
264
|
-
export const FormExample: Story = {
|
|
265
|
-
render: () => (
|
|
266
|
-
<form className="w-full max-w-md space-y-4">
|
|
267
|
-
<Input
|
|
268
|
-
label="First Name"
|
|
269
|
-
placeholder="Enter your first name"
|
|
270
|
-
required
|
|
271
|
-
/>
|
|
272
|
-
<Input
|
|
273
|
-
label="Last Name"
|
|
274
|
-
placeholder="Enter your last name"
|
|
275
|
-
required
|
|
276
|
-
/>
|
|
277
|
-
<Input
|
|
278
|
-
label="Email"
|
|
279
|
-
placeholder="Enter your email"
|
|
280
|
-
type="email"
|
|
281
|
-
required
|
|
282
|
-
/>
|
|
283
|
-
<Input
|
|
284
|
-
label="Password"
|
|
285
|
-
placeholder="Enter your password"
|
|
286
|
-
type="password"
|
|
287
|
-
suffixIconName="visibility"
|
|
288
|
-
required
|
|
289
|
-
/>
|
|
290
|
-
<Input
|
|
291
|
-
label="Phone Number"
|
|
292
|
-
placeholder="(555) 123-4567"
|
|
293
|
-
type="tel"
|
|
294
|
-
/>
|
|
295
|
-
</form>
|
|
296
|
-
),
|
|
297
|
-
parameters: {
|
|
298
|
-
docs: {
|
|
299
|
-
description: {
|
|
300
|
-
story: "Example of multiple inputs used together in a form.",
|
|
301
|
-
},
|
|
302
|
-
},
|
|
303
|
-
},
|
|
304
|
-
};
|
|
305
|
-
|
|
306
|
-
// All variants showcase
|
|
307
|
-
export const AllVariants: Story = {
|
|
308
|
-
render: () => (
|
|
309
|
-
<div className="w-full max-w-2xl space-y-6">
|
|
310
|
-
<div>
|
|
311
|
-
<h3 className="mb-3 text-lg font-semibold">Sizes</h3>
|
|
312
|
-
<div className="space-y-3">
|
|
313
|
-
<Input size="slim" placeholder="Slim" label="Slim" />
|
|
314
|
-
<Input size="medium" placeholder="Medium" label="Medium" />
|
|
315
|
-
<Input size="large" placeholder="Large" label="Large" />
|
|
316
|
-
</div>
|
|
317
|
-
</div>
|
|
318
|
-
<div>
|
|
319
|
-
<h3 className="mb-3 text-lg font-semibold">With Icons</h3>
|
|
320
|
-
<div className="space-y-3">
|
|
321
|
-
<Input
|
|
322
|
-
placeholder="Search..."
|
|
323
|
-
label="With Prefix Icon"
|
|
324
|
-
prefixIconName="search"
|
|
325
|
-
/>
|
|
326
|
-
<Input
|
|
327
|
-
placeholder="Password"
|
|
328
|
-
label="With Suffix Icon"
|
|
329
|
-
type="password"
|
|
330
|
-
suffixIconName="visibility"
|
|
331
|
-
/>
|
|
332
|
-
</div>
|
|
333
|
-
</div>
|
|
334
|
-
<div>
|
|
335
|
-
<h3 className="mb-3 text-lg font-semibold">States</h3>
|
|
336
|
-
<div className="space-y-3">
|
|
337
|
-
<Input placeholder="Default" label="Default" />
|
|
338
|
-
<Input
|
|
339
|
-
placeholder="Error"
|
|
340
|
-
label="Error"
|
|
341
|
-
hasError
|
|
342
|
-
errorText="This field has an error"
|
|
343
|
-
/>
|
|
344
|
-
<Input placeholder="Loading" label="Loading" loading />
|
|
345
|
-
<Input placeholder="Disabled" label="Disabled" disabled />
|
|
346
|
-
</div>
|
|
347
|
-
</div>
|
|
348
|
-
</div>
|
|
349
|
-
),
|
|
350
|
-
parameters: {
|
|
351
|
-
docs: {
|
|
352
|
-
description: {
|
|
353
|
-
story: "Complete showcase of all input variants, sizes, and states.",
|
|
354
|
-
},
|
|
355
|
-
},
|
|
356
|
-
},
|
|
357
|
-
};
|
|
358
|
-
|
|
1
|
+
import { Input } from "./index";
|
|
2
|
+
import { DocsPage } from "@shared/stories/DocsTemplate";
|
|
3
|
+
|
|
4
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof Input> = {
|
|
7
|
+
title: "Components/Input",
|
|
8
|
+
component: Input,
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: "centered",
|
|
12
|
+
docs: {
|
|
13
|
+
page: DocsPage,
|
|
14
|
+
description: {
|
|
15
|
+
component:
|
|
16
|
+
"A comprehensive input component with support for labels, error states, icons, loading states, and multiple sizes.",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
argTypes: {
|
|
21
|
+
placeholder: {
|
|
22
|
+
control: { type: "text" },
|
|
23
|
+
description: "Placeholder text",
|
|
24
|
+
},
|
|
25
|
+
label: {
|
|
26
|
+
control: { type: "text" },
|
|
27
|
+
description: "Label text",
|
|
28
|
+
},
|
|
29
|
+
size: {
|
|
30
|
+
control: { type: "select" },
|
|
31
|
+
options: ["slim", "medium", "large"],
|
|
32
|
+
description: "Input size",
|
|
33
|
+
},
|
|
34
|
+
state: {
|
|
35
|
+
control: { type: "select" },
|
|
36
|
+
options: ["default", "focus", "active", "hover", "filled", "error"],
|
|
37
|
+
description: "Visual state",
|
|
38
|
+
},
|
|
39
|
+
hasError: {
|
|
40
|
+
control: { type: "boolean" },
|
|
41
|
+
description: "Show error state",
|
|
42
|
+
},
|
|
43
|
+
errorText: {
|
|
44
|
+
control: { type: "text" },
|
|
45
|
+
description: "Error message text",
|
|
46
|
+
},
|
|
47
|
+
disabled: {
|
|
48
|
+
control: { type: "boolean" },
|
|
49
|
+
description: "Disable the input",
|
|
50
|
+
},
|
|
51
|
+
loading: {
|
|
52
|
+
control: { type: "boolean" },
|
|
53
|
+
description: "Show loading state",
|
|
54
|
+
},
|
|
55
|
+
required: {
|
|
56
|
+
control: { type: "boolean" },
|
|
57
|
+
description: "Mark input as required",
|
|
58
|
+
},
|
|
59
|
+
type: {
|
|
60
|
+
control: { type: "select" },
|
|
61
|
+
options: ["text", "email", "password", "number", "tel"],
|
|
62
|
+
description: "Input type",
|
|
63
|
+
},
|
|
64
|
+
prefixIconName: {
|
|
65
|
+
control: { type: "select" },
|
|
66
|
+
options: ["location_on", "search"],
|
|
67
|
+
description: "Prefix icon name",
|
|
68
|
+
},
|
|
69
|
+
suffixIconName: {
|
|
70
|
+
control: { type: "select" },
|
|
71
|
+
options: ["visibility", "visibility_off", "lock"],
|
|
72
|
+
description: "Suffix icon name",
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
args: {
|
|
76
|
+
placeholder: "Enter text...",
|
|
77
|
+
size: "medium",
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export default meta;
|
|
82
|
+
type Story = StoryObj<typeof meta>;
|
|
83
|
+
|
|
84
|
+
// Default input
|
|
85
|
+
export const Default: Story = {
|
|
86
|
+
args: {},
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// With label
|
|
90
|
+
export const WithLabel: Story = {
|
|
91
|
+
args: {
|
|
92
|
+
label: "Email Address",
|
|
93
|
+
placeholder: "Enter your email",
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// Required input
|
|
98
|
+
export const Required: Story = {
|
|
99
|
+
args: {
|
|
100
|
+
label: "Required Field",
|
|
101
|
+
placeholder: "This field is required",
|
|
102
|
+
required: true,
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// Error state
|
|
107
|
+
export const Error: Story = {
|
|
108
|
+
args: {
|
|
109
|
+
label: "Email Address",
|
|
110
|
+
placeholder: "Enter your email",
|
|
111
|
+
hasError: true,
|
|
112
|
+
errorText: "Please enter a valid email address",
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// Different sizes
|
|
117
|
+
export const Sizes: Story = {
|
|
118
|
+
render: () => (
|
|
119
|
+
<div className="w-full max-w-md space-y-4">
|
|
120
|
+
<div>
|
|
121
|
+
<Input
|
|
122
|
+
size="slim"
|
|
123
|
+
placeholder="Slim input"
|
|
124
|
+
label="Slim Size"
|
|
125
|
+
/>
|
|
126
|
+
</div>
|
|
127
|
+
<div>
|
|
128
|
+
<Input
|
|
129
|
+
size="medium"
|
|
130
|
+
placeholder="Medium input"
|
|
131
|
+
label="Medium Size"
|
|
132
|
+
/>
|
|
133
|
+
</div>
|
|
134
|
+
<div>
|
|
135
|
+
<Input
|
|
136
|
+
size="large"
|
|
137
|
+
placeholder="Large input"
|
|
138
|
+
label="Large Size"
|
|
139
|
+
/>
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
),
|
|
143
|
+
parameters: {
|
|
144
|
+
docs: {
|
|
145
|
+
description: {
|
|
146
|
+
story: "All available input sizes: slim, medium, and large.",
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
// With prefix icon
|
|
153
|
+
export const WithPrefixIcon: Story = {
|
|
154
|
+
args: {
|
|
155
|
+
label: "Search",
|
|
156
|
+
placeholder: "Search...",
|
|
157
|
+
prefixIconName: "search",
|
|
158
|
+
prefixIconSize: 24,
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
// With suffix icon
|
|
163
|
+
export const WithSuffixIcon: Story = {
|
|
164
|
+
args: {
|
|
165
|
+
label: "Password",
|
|
166
|
+
placeholder: "Enter password",
|
|
167
|
+
type: "password",
|
|
168
|
+
suffixIconName: "visibility",
|
|
169
|
+
suffixIconSize: 24,
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
// Password input
|
|
174
|
+
export const Password: Story = {
|
|
175
|
+
args: {
|
|
176
|
+
label: "Password",
|
|
177
|
+
placeholder: "Enter your password",
|
|
178
|
+
type: "password",
|
|
179
|
+
suffixIconName: "visibility",
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
// Loading state
|
|
184
|
+
export const Loading: Story = {
|
|
185
|
+
args: {
|
|
186
|
+
label: "Loading Input",
|
|
187
|
+
placeholder: "Loading...",
|
|
188
|
+
loading: true,
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
// Disabled state
|
|
193
|
+
export const Disabled: Story = {
|
|
194
|
+
args: {
|
|
195
|
+
label: "Disabled Input",
|
|
196
|
+
placeholder: "This input is disabled",
|
|
197
|
+
disabled: true,
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
// Different states
|
|
202
|
+
export const States: Story = {
|
|
203
|
+
render: () => (
|
|
204
|
+
<div className="w-full max-w-md space-y-4">
|
|
205
|
+
<div>
|
|
206
|
+
<Input
|
|
207
|
+
label="Default State"
|
|
208
|
+
placeholder="Default input"
|
|
209
|
+
state="default"
|
|
210
|
+
/>
|
|
211
|
+
</div>
|
|
212
|
+
<div>
|
|
213
|
+
<Input
|
|
214
|
+
label="Hover State"
|
|
215
|
+
placeholder="Hover over me"
|
|
216
|
+
state="hover"
|
|
217
|
+
/>
|
|
218
|
+
</div>
|
|
219
|
+
<div>
|
|
220
|
+
<Input
|
|
221
|
+
label="Focus State"
|
|
222
|
+
placeholder="Focus on me"
|
|
223
|
+
state="focus"
|
|
224
|
+
/>
|
|
225
|
+
</div>
|
|
226
|
+
<div>
|
|
227
|
+
<Input
|
|
228
|
+
label="Error State"
|
|
229
|
+
placeholder="Error input"
|
|
230
|
+
state="error"
|
|
231
|
+
errorText="This field has an error"
|
|
232
|
+
/>
|
|
233
|
+
</div>
|
|
234
|
+
</div>
|
|
235
|
+
),
|
|
236
|
+
parameters: {
|
|
237
|
+
docs: {
|
|
238
|
+
description: {
|
|
239
|
+
story: "Different visual states of the input component.",
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
// Email input
|
|
246
|
+
export const Email: Story = {
|
|
247
|
+
args: {
|
|
248
|
+
label: "Email",
|
|
249
|
+
placeholder: "example@email.com",
|
|
250
|
+
type: "email",
|
|
251
|
+
},
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
// Phone input
|
|
255
|
+
export const Phone: Story = {
|
|
256
|
+
args: {
|
|
257
|
+
label: "Phone Number",
|
|
258
|
+
placeholder: "(555) 123-4567",
|
|
259
|
+
type: "tel",
|
|
260
|
+
},
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
// Form example
|
|
264
|
+
export const FormExample: Story = {
|
|
265
|
+
render: () => (
|
|
266
|
+
<form className="w-full max-w-md space-y-4">
|
|
267
|
+
<Input
|
|
268
|
+
label="First Name"
|
|
269
|
+
placeholder="Enter your first name"
|
|
270
|
+
required
|
|
271
|
+
/>
|
|
272
|
+
<Input
|
|
273
|
+
label="Last Name"
|
|
274
|
+
placeholder="Enter your last name"
|
|
275
|
+
required
|
|
276
|
+
/>
|
|
277
|
+
<Input
|
|
278
|
+
label="Email"
|
|
279
|
+
placeholder="Enter your email"
|
|
280
|
+
type="email"
|
|
281
|
+
required
|
|
282
|
+
/>
|
|
283
|
+
<Input
|
|
284
|
+
label="Password"
|
|
285
|
+
placeholder="Enter your password"
|
|
286
|
+
type="password"
|
|
287
|
+
suffixIconName="visibility"
|
|
288
|
+
required
|
|
289
|
+
/>
|
|
290
|
+
<Input
|
|
291
|
+
label="Phone Number"
|
|
292
|
+
placeholder="(555) 123-4567"
|
|
293
|
+
type="tel"
|
|
294
|
+
/>
|
|
295
|
+
</form>
|
|
296
|
+
),
|
|
297
|
+
parameters: {
|
|
298
|
+
docs: {
|
|
299
|
+
description: {
|
|
300
|
+
story: "Example of multiple inputs used together in a form.",
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
// All variants showcase
|
|
307
|
+
export const AllVariants: Story = {
|
|
308
|
+
render: () => (
|
|
309
|
+
<div className="w-full max-w-2xl space-y-6">
|
|
310
|
+
<div>
|
|
311
|
+
<h3 className="mb-3 text-lg font-semibold">Sizes</h3>
|
|
312
|
+
<div className="space-y-3">
|
|
313
|
+
<Input size="slim" placeholder="Slim" label="Slim" />
|
|
314
|
+
<Input size="medium" placeholder="Medium" label="Medium" />
|
|
315
|
+
<Input size="large" placeholder="Large" label="Large" />
|
|
316
|
+
</div>
|
|
317
|
+
</div>
|
|
318
|
+
<div>
|
|
319
|
+
<h3 className="mb-3 text-lg font-semibold">With Icons</h3>
|
|
320
|
+
<div className="space-y-3">
|
|
321
|
+
<Input
|
|
322
|
+
placeholder="Search..."
|
|
323
|
+
label="With Prefix Icon"
|
|
324
|
+
prefixIconName="search"
|
|
325
|
+
/>
|
|
326
|
+
<Input
|
|
327
|
+
placeholder="Password"
|
|
328
|
+
label="With Suffix Icon"
|
|
329
|
+
type="password"
|
|
330
|
+
suffixIconName="visibility"
|
|
331
|
+
/>
|
|
332
|
+
</div>
|
|
333
|
+
</div>
|
|
334
|
+
<div>
|
|
335
|
+
<h3 className="mb-3 text-lg font-semibold">States</h3>
|
|
336
|
+
<div className="space-y-3">
|
|
337
|
+
<Input placeholder="Default" label="Default" />
|
|
338
|
+
<Input
|
|
339
|
+
placeholder="Error"
|
|
340
|
+
label="Error"
|
|
341
|
+
hasError
|
|
342
|
+
errorText="This field has an error"
|
|
343
|
+
/>
|
|
344
|
+
<Input placeholder="Loading" label="Loading" loading />
|
|
345
|
+
<Input placeholder="Disabled" label="Disabled" disabled />
|
|
346
|
+
</div>
|
|
347
|
+
</div>
|
|
348
|
+
</div>
|
|
349
|
+
),
|
|
350
|
+
parameters: {
|
|
351
|
+
docs: {
|
|
352
|
+
description: {
|
|
353
|
+
story: "Complete showcase of all input variants, sizes, and states.",
|
|
354
|
+
},
|
|
355
|
+
},
|
|
356
|
+
},
|
|
357
|
+
};
|
|
358
|
+
|