@windstream/react-shared-components 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/LICENSE +21 -0
- package/README.md +360 -0
- package/dist/core.d.ts +389 -0
- package/dist/index.d.ts +389 -0
- package/dist/index.esm.js +35 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +3 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/index.esm.js +2 -0
- package/dist/utils/index.esm.js.map +1 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +151 -0
- package/src/components/accordion/Accordion.stories.tsx +225 -0
- package/src/components/accordion/index.tsx +36 -0
- package/src/components/accordion/types.ts +10 -0
- package/src/components/alert-card/AlertCard.stories.tsx +172 -0
- package/src/components/alert-card/index.tsx +35 -0
- package/src/components/alert-card/types.ts +9 -0
- package/src/components/brand-button/BrandButton.stories.tsx +221 -0
- package/src/components/brand-button/helpers.ts +35 -0
- package/src/components/brand-button/index.tsx +90 -0
- package/src/components/brand-button/types.ts +27 -0
- package/src/components/button/Button.stories.tsx +108 -0
- package/src/components/button/index.tsx +23 -0
- package/src/components/button/types.ts +14 -0
- package/src/components/call-button/CallButton.stories.tsx +324 -0
- package/src/components/call-button/index.tsx +80 -0
- package/src/components/call-button/types.ts +9 -0
- package/src/components/checkbox/Checkbox.stories.tsx +248 -0
- package/src/components/checkbox/index.tsx +185 -0
- package/src/components/checkbox/types.ts +24 -0
- package/src/components/checklist/Checklist.stories.tsx +151 -0
- package/src/components/checklist/index.tsx +33 -0
- package/src/components/checklist/types.ts +6 -0
- package/src/components/collapse/Collapse.stories.tsx +256 -0
- package/src/components/collapse/index.tsx +44 -0
- package/src/components/collapse/types.ts +6 -0
- package/src/components/divider/Divider.stories.tsx +206 -0
- package/src/components/divider/index.tsx +23 -0
- package/src/components/divider/type.ts +3 -0
- package/src/components/input/Input.stories.tsx +358 -0
- package/src/components/input/index.tsx +174 -0
- package/src/components/input/types.ts +37 -0
- package/src/components/link/Link.stories.tsx +163 -0
- package/src/components/link/index.tsx +96 -0
- package/src/components/link/types.ts +25 -0
- package/src/components/list/List.stories.tsx +272 -0
- package/src/components/list/index.tsx +86 -0
- package/src/components/list/list-item/index.tsx +36 -0
- package/src/components/list/list-item/types.ts +13 -0
- package/src/components/list/types.ts +29 -0
- package/src/components/material-icon/MaterialIcon.stories.tsx +330 -0
- package/src/components/material-icon/constants.ts +95 -0
- package/src/components/material-icon/index.tsx +44 -0
- package/src/components/material-icon/types.ts +31 -0
- package/src/components/modal/Modal.stories.tsx +171 -0
- package/src/components/modal/index.tsx +168 -0
- package/src/components/modal/types.ts +24 -0
- package/src/components/radio-button/RadioButton.stories.tsx +307 -0
- package/src/components/radio-button/index.tsx +73 -0
- package/src/components/radio-button/types.ts +22 -0
- package/src/components/see-more/SeeMore.stories.tsx +182 -0
- package/src/components/see-more/index.tsx +38 -0
- package/src/components/see-more/types.ts +4 -0
- package/src/components/select/Select.stories.tsx +410 -0
- package/src/components/select/index.tsx +150 -0
- package/src/components/select/types.ts +34 -0
- package/src/components/select-plan-button/SelectPlanButton.stories.tsx +160 -0
- package/src/components/select-plan-button/index.tsx +21 -0
- package/src/components/select-plan-button/types.ts +4 -0
- package/src/components/skeleton/Skeleton.stories.tsx +180 -0
- package/src/components/skeleton/index.tsx +61 -0
- package/src/components/skeleton/types.ts +4 -0
- package/src/components/spinner/Spinner.stories.tsx +335 -0
- package/src/components/spinner/index.tsx +44 -0
- package/src/components/spinner/types.ts +5 -0
- package/src/components/text/Text.stories.tsx +302 -0
- package/src/components/text/index.tsx +26 -0
- package/src/components/text/types.ts +45 -0
- package/src/components/tooltip/Tooltip.stories.tsx +220 -0
- package/src/components/tooltip/index.tsx +78 -0
- package/src/components/tooltip/types.ts +7 -0
- package/src/components/view-cart-button/ViewCartButton.stories.tsx +241 -0
- package/src/components/view-cart-button/index.tsx +39 -0
- package/src/components/view-cart-button/types.ts +5 -0
- package/src/hooks/use-body-scroll-lock.ts +31 -0
- package/src/index.ts +81 -0
- package/src/setupTests.ts +46 -0
- package/src/stories/DocsTemplate.tsx +26 -0
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +1 -0
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +1 -0
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +1 -0
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +1 -0
- package/src/stories/assets/youtube.svg +1 -0
- package/src/styles/globals.css +50 -0
- package/src/types/global.d.ts +9 -0
- package/src/utils/index.ts +49 -0
- package/tailwind.config.cjs +524 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { SeeMore } from "./index";
|
|
2
|
+
import { DocsPage } from "@shared/stories/DocsTemplate";
|
|
3
|
+
|
|
4
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof SeeMore> = {
|
|
7
|
+
title: "Components/SeeMore",
|
|
8
|
+
component: SeeMore,
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: "centered",
|
|
12
|
+
docs: {
|
|
13
|
+
page: DocsPage,
|
|
14
|
+
description: {
|
|
15
|
+
component:
|
|
16
|
+
"An expandable component that shows/hides a checklist of items with a toggle button.",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
argTypes: {
|
|
21
|
+
list: {
|
|
22
|
+
control: { type: "object" },
|
|
23
|
+
description: "Array of strings to display in the checklist",
|
|
24
|
+
},
|
|
25
|
+
text: {
|
|
26
|
+
control: { type: "text" },
|
|
27
|
+
description: "Text for the toggle button",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
args: {
|
|
31
|
+
list: ["Feature 1", "Feature 2", "Feature 3"],
|
|
32
|
+
text: "See details",
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default meta;
|
|
37
|
+
type Story = StoryObj<typeof meta>;
|
|
38
|
+
|
|
39
|
+
// Default see more
|
|
40
|
+
export const Default: Story = {
|
|
41
|
+
args: {},
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// Expanded by default
|
|
45
|
+
export const Expanded: Story = {
|
|
46
|
+
args: {
|
|
47
|
+
list: [
|
|
48
|
+
"High-speed internet connection",
|
|
49
|
+
"24/7 customer support",
|
|
50
|
+
"No data caps",
|
|
51
|
+
"Free installation",
|
|
52
|
+
],
|
|
53
|
+
text: "See details",
|
|
54
|
+
},
|
|
55
|
+
render: (args) => (
|
|
56
|
+
<div className="w-full max-w-md">
|
|
57
|
+
<SeeMore {...args} />
|
|
58
|
+
</div>
|
|
59
|
+
),
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// Collapsed by default
|
|
63
|
+
export const Collapsed: Story = {
|
|
64
|
+
args: {
|
|
65
|
+
list: ["Item 1", "Item 2", "Item 3"],
|
|
66
|
+
text: "Show more",
|
|
67
|
+
},
|
|
68
|
+
render: (args) => (
|
|
69
|
+
<div className="w-full max-w-md">
|
|
70
|
+
<SeeMore {...args} />
|
|
71
|
+
</div>
|
|
72
|
+
),
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// With checklist items
|
|
76
|
+
export const WithChecklistItems: Story = {
|
|
77
|
+
args: {
|
|
78
|
+
list: [
|
|
79
|
+
"Unlimited data usage",
|
|
80
|
+
"Free router included",
|
|
81
|
+
"24/7 technical support",
|
|
82
|
+
"No long-term contract",
|
|
83
|
+
"30-day money-back guarantee",
|
|
84
|
+
],
|
|
85
|
+
text: "View all features",
|
|
86
|
+
},
|
|
87
|
+
render: (args) => (
|
|
88
|
+
<div className="w-full max-w-md">
|
|
89
|
+
<SeeMore {...args} />
|
|
90
|
+
</div>
|
|
91
|
+
),
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// Custom button text
|
|
95
|
+
export const CustomButtonText: Story = {
|
|
96
|
+
args: {
|
|
97
|
+
list: ["Detail 1", "Detail 2", "Detail 3"],
|
|
98
|
+
text: "Learn more",
|
|
99
|
+
},
|
|
100
|
+
render: (args) => (
|
|
101
|
+
<div className="w-full max-w-md">
|
|
102
|
+
<SeeMore {...args} />
|
|
103
|
+
</div>
|
|
104
|
+
),
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
// Long list
|
|
108
|
+
export const LongList: Story = {
|
|
109
|
+
args: {
|
|
110
|
+
list: [
|
|
111
|
+
"Feature one with detailed description",
|
|
112
|
+
"Feature two",
|
|
113
|
+
"Feature three",
|
|
114
|
+
"Feature four",
|
|
115
|
+
"Feature five",
|
|
116
|
+
"Feature six",
|
|
117
|
+
"Feature seven",
|
|
118
|
+
"Feature eight",
|
|
119
|
+
"Feature nine",
|
|
120
|
+
"Feature ten",
|
|
121
|
+
],
|
|
122
|
+
text: "See all features",
|
|
123
|
+
},
|
|
124
|
+
render: (args) => (
|
|
125
|
+
<div className="w-full max-w-md">
|
|
126
|
+
<SeeMore {...args} />
|
|
127
|
+
</div>
|
|
128
|
+
),
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
// Single item
|
|
132
|
+
export const SingleItem: Story = {
|
|
133
|
+
args: {
|
|
134
|
+
list: ["Single checklist item"],
|
|
135
|
+
text: "See details",
|
|
136
|
+
},
|
|
137
|
+
render: (args) => (
|
|
138
|
+
<div className="w-full max-w-md">
|
|
139
|
+
<SeeMore {...args} />
|
|
140
|
+
</div>
|
|
141
|
+
),
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// All variants showcase
|
|
145
|
+
export const AllVariants: Story = {
|
|
146
|
+
render: () => (
|
|
147
|
+
<div className="w-full max-w-2xl space-y-8">
|
|
148
|
+
<div>
|
|
149
|
+
<h3 className="mb-3 text-lg font-semibold">Default</h3>
|
|
150
|
+
<SeeMore list={["Item 1", "Item 2", "Item 3"]} />
|
|
151
|
+
</div>
|
|
152
|
+
<div>
|
|
153
|
+
<h3 className="mb-3 text-lg font-semibold">Custom Button Text</h3>
|
|
154
|
+
<SeeMore
|
|
155
|
+
list={["Feature 1", "Feature 2", "Feature 3"]}
|
|
156
|
+
text="View all features"
|
|
157
|
+
/>
|
|
158
|
+
</div>
|
|
159
|
+
<div>
|
|
160
|
+
<h3 className="mb-3 text-lg font-semibold">Long List</h3>
|
|
161
|
+
<SeeMore
|
|
162
|
+
list={[
|
|
163
|
+
"Feature one",
|
|
164
|
+
"Feature two",
|
|
165
|
+
"Feature three",
|
|
166
|
+
"Feature four",
|
|
167
|
+
"Feature five",
|
|
168
|
+
]}
|
|
169
|
+
text="See all details"
|
|
170
|
+
/>
|
|
171
|
+
</div>
|
|
172
|
+
</div>
|
|
173
|
+
),
|
|
174
|
+
parameters: {
|
|
175
|
+
docs: {
|
|
176
|
+
description: {
|
|
177
|
+
story: "Showcase of all SeeMore variants and configurations.",
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { SeeMoreProps } from "@shared/components/see-more/types";
|
|
3
|
+
import { MaterialIcon } from "@shared/components/material-icon";
|
|
4
|
+
import { Collapse } from "@shared/components/collapse";
|
|
5
|
+
import { Checklist } from "@shared/components/checklist";
|
|
6
|
+
import { Button } from "@shared/components/button";
|
|
7
|
+
|
|
8
|
+
export const SeeMore: React.FC<SeeMoreProps> = (props) => {
|
|
9
|
+
const { list, text } = props
|
|
10
|
+
const [showDetails, setShowDetails] = useState<boolean>(true);
|
|
11
|
+
return (
|
|
12
|
+
<div className="mt-3">
|
|
13
|
+
<Button
|
|
14
|
+
type="button"
|
|
15
|
+
className="flex items-center gap-2 text-base font-semibold text-gray-900"
|
|
16
|
+
aria-expanded={showDetails}
|
|
17
|
+
onClick={(e) => { e.stopPropagation(); setShowDetails(v => !v); }}
|
|
18
|
+
>
|
|
19
|
+
<span>{text || 'See details'}</span>
|
|
20
|
+
<MaterialIcon
|
|
21
|
+
name={showDetails ? 'keyboard_arrow_down' : 'keyboard_arrow_up'}
|
|
22
|
+
fill={1}
|
|
23
|
+
size={24}
|
|
24
|
+
/>
|
|
25
|
+
</Button>
|
|
26
|
+
|
|
27
|
+
<Collapse open={showDetails}>
|
|
28
|
+
<div className="pt-1">
|
|
29
|
+
<Checklist listItemClassName="body3" items={list} />
|
|
30
|
+
</div>
|
|
31
|
+
</Collapse>
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
SeeMore.displayName = "SeeMore";
|
|
37
|
+
|
|
38
|
+
export type { SeeMoreProps };
|
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
import { Select } from "./index";
|
|
2
|
+
import { DocsPage } from "@shared/stories/DocsTemplate";
|
|
3
|
+
|
|
4
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof Select> = {
|
|
7
|
+
title: "Components/Select",
|
|
8
|
+
component: Select,
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: "centered",
|
|
12
|
+
docs: {
|
|
13
|
+
page: DocsPage,
|
|
14
|
+
description: {
|
|
15
|
+
component:
|
|
16
|
+
"A powerful select component built with react-select, featuring search/filtering, custom styling, and enhanced UX that matches the consumer app pattern.",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
argTypes: {
|
|
21
|
+
variant: {
|
|
22
|
+
control: { type: "select" },
|
|
23
|
+
options: ["default", "unstyled"],
|
|
24
|
+
description: "Select styling variant",
|
|
25
|
+
},
|
|
26
|
+
size: {
|
|
27
|
+
control: { type: "select" },
|
|
28
|
+
options: ["sm", "md"],
|
|
29
|
+
description: "Select size",
|
|
30
|
+
},
|
|
31
|
+
placeholder: {
|
|
32
|
+
control: { type: "text" },
|
|
33
|
+
description: "Placeholder text",
|
|
34
|
+
},
|
|
35
|
+
isDisabled: {
|
|
36
|
+
control: { type: "boolean" },
|
|
37
|
+
description: "Disable the select",
|
|
38
|
+
},
|
|
39
|
+
hasError: {
|
|
40
|
+
control: { type: "boolean" },
|
|
41
|
+
description: "Show error state",
|
|
42
|
+
},
|
|
43
|
+
error: {
|
|
44
|
+
control: { type: "text" },
|
|
45
|
+
description: "Error message text",
|
|
46
|
+
},
|
|
47
|
+
helperText: {
|
|
48
|
+
control: { type: "text" },
|
|
49
|
+
description: "Helper text",
|
|
50
|
+
},
|
|
51
|
+
label: {
|
|
52
|
+
control: { type: "text" },
|
|
53
|
+
description: "Label text",
|
|
54
|
+
},
|
|
55
|
+
isCustomStyle: {
|
|
56
|
+
control: { type: "boolean" },
|
|
57
|
+
description: "Use custom styling for dropdown indicator and values",
|
|
58
|
+
},
|
|
59
|
+
isSearchable: {
|
|
60
|
+
control: { type: "boolean" },
|
|
61
|
+
description: "Enable search/filtering functionality",
|
|
62
|
+
},
|
|
63
|
+
isClearable: {
|
|
64
|
+
control: { type: "boolean" },
|
|
65
|
+
description: "Allow clearing the selected value",
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
args: {
|
|
69
|
+
placeholder: "Select an option...",
|
|
70
|
+
variant: "default",
|
|
71
|
+
size: "md",
|
|
72
|
+
isDisabled: false,
|
|
73
|
+
hasError: false,
|
|
74
|
+
isCustomStyle: false,
|
|
75
|
+
isSearchable: true,
|
|
76
|
+
isClearable: false,
|
|
77
|
+
options: [
|
|
78
|
+
{ label: "Option 1", value: "option1" },
|
|
79
|
+
{ label: "Option 2", value: "option2" },
|
|
80
|
+
{ label: "Option 3", value: "option3" },
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export default meta;
|
|
86
|
+
type Story = StoryObj<typeof meta>;
|
|
87
|
+
|
|
88
|
+
// Default select
|
|
89
|
+
export const Default: Story = {
|
|
90
|
+
args: {},
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// Select with label
|
|
94
|
+
export const WithLabel: Story = {
|
|
95
|
+
render: (args: any) => (
|
|
96
|
+
<div className="space-y-2">
|
|
97
|
+
<Select
|
|
98
|
+
{...args}
|
|
99
|
+
label="Choose an option"
|
|
100
|
+
placeholder="Select an option"
|
|
101
|
+
/>
|
|
102
|
+
</div>
|
|
103
|
+
),
|
|
104
|
+
args: {
|
|
105
|
+
label: "Choose an option",
|
|
106
|
+
placeholder: "Select an option",
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
// Error state
|
|
111
|
+
export const Error: Story = {
|
|
112
|
+
args: {
|
|
113
|
+
hasError: true,
|
|
114
|
+
error: "This field is required",
|
|
115
|
+
placeholder: "Invalid selection",
|
|
116
|
+
},
|
|
117
|
+
render: (args: any) => (
|
|
118
|
+
<div className="space-y-2">
|
|
119
|
+
<Select {...args} />
|
|
120
|
+
</div>
|
|
121
|
+
),
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// With helper text
|
|
125
|
+
export const WithHelperText: Story = {
|
|
126
|
+
args: {
|
|
127
|
+
helperText: "Please select the most appropriate option",
|
|
128
|
+
placeholder: "Select an option",
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// Small select
|
|
133
|
+
export const Small: Story = {
|
|
134
|
+
args: {
|
|
135
|
+
size: "sm",
|
|
136
|
+
placeholder: "Small select",
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
// Medium select
|
|
141
|
+
export const Medium: Story = {
|
|
142
|
+
args: {
|
|
143
|
+
size: "md",
|
|
144
|
+
placeholder: "Medium select",
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
// Disabled select
|
|
149
|
+
export const Disabled: Story = {
|
|
150
|
+
args: {
|
|
151
|
+
isDisabled: true,
|
|
152
|
+
placeholder: "Disabled select",
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
// Unstyled variant
|
|
157
|
+
export const Unstyled: Story = {
|
|
158
|
+
args: {
|
|
159
|
+
variant: "unstyled",
|
|
160
|
+
placeholder: "Unstyled select",
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
// Searchable select
|
|
165
|
+
export const Searchable: Story = {
|
|
166
|
+
args: {
|
|
167
|
+
isSearchable: true,
|
|
168
|
+
placeholder: "Type to search...",
|
|
169
|
+
options: [
|
|
170
|
+
{ label: "Apple", value: "apple" },
|
|
171
|
+
{ label: "Banana", value: "banana" },
|
|
172
|
+
{ label: "Cherry", value: "cherry" },
|
|
173
|
+
{ label: "Date", value: "date" },
|
|
174
|
+
{ label: "Elderberry", value: "elderberry" },
|
|
175
|
+
{ label: "Fig", value: "fig" },
|
|
176
|
+
{ label: "Grape", value: "grape" },
|
|
177
|
+
],
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// Clearable select
|
|
182
|
+
export const Clearable: Story = {
|
|
183
|
+
args: {
|
|
184
|
+
isClearable: true,
|
|
185
|
+
placeholder: "Select and clear option",
|
|
186
|
+
value: { label: "Option 2", value: "option2" },
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
// Custom style select
|
|
191
|
+
export const CustomStyle: Story = {
|
|
192
|
+
args: {
|
|
193
|
+
isCustomStyle: true,
|
|
194
|
+
placeholder: "Custom styled select",
|
|
195
|
+
options: [
|
|
196
|
+
{ label: "Custom Option 1", value: "custom1" },
|
|
197
|
+
{ label: "Custom Option 2", value: "custom2" },
|
|
198
|
+
{ label: "Custom Option 3", value: "custom3" },
|
|
199
|
+
],
|
|
200
|
+
},
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
// With filtering options
|
|
204
|
+
export const WithFiltering: Story = {
|
|
205
|
+
args: {
|
|
206
|
+
isSearchable: true,
|
|
207
|
+
placeholder: "Search with custom filter...",
|
|
208
|
+
filterOptions: {
|
|
209
|
+
ignoreCase: true,
|
|
210
|
+
ignoreAccents: true,
|
|
211
|
+
matchFrom: "any",
|
|
212
|
+
},
|
|
213
|
+
options: [
|
|
214
|
+
{ label: "São Paulo", value: "sao-paulo" },
|
|
215
|
+
{ label: "Café", value: "cafe" },
|
|
216
|
+
{ label: "Naïve", value: "naive" },
|
|
217
|
+
{ label: "Café au lait", value: "cafe-au-lait" },
|
|
218
|
+
{ label: "São José", value: "sao-jose" },
|
|
219
|
+
],
|
|
220
|
+
},
|
|
221
|
+
parameters: {
|
|
222
|
+
docs: {
|
|
223
|
+
description: {
|
|
224
|
+
story: "Select with custom filtering options that ignore case and accents for better search experience.",
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
// With many options
|
|
231
|
+
export const ManyOptions: Story = {
|
|
232
|
+
args: {
|
|
233
|
+
placeholder: "Choose a country",
|
|
234
|
+
options: [
|
|
235
|
+
{ label: "United States", value: "us" },
|
|
236
|
+
{ label: "Canada", value: "ca" },
|
|
237
|
+
{ label: "United Kingdom", value: "uk" },
|
|
238
|
+
{ label: "Germany", value: "de" },
|
|
239
|
+
{ label: "France", value: "fr" },
|
|
240
|
+
{ label: "Spain", value: "es" },
|
|
241
|
+
{ label: "Italy", value: "it" },
|
|
242
|
+
{ label: "Japan", value: "jp" },
|
|
243
|
+
{ label: "China", value: "cn" },
|
|
244
|
+
{ label: "Australia", value: "au" },
|
|
245
|
+
{ label: "Brazil", value: "br" },
|
|
246
|
+
{ label: "India", value: "in" },
|
|
247
|
+
],
|
|
248
|
+
},
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
// With selected value
|
|
252
|
+
export const WithSelectedValue: Story = {
|
|
253
|
+
args: {
|
|
254
|
+
value: { label: "Option 2", value: "option2" },
|
|
255
|
+
placeholder: "Select an option",
|
|
256
|
+
},
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
// All variants showcase
|
|
260
|
+
export const AllVariants: Story = {
|
|
261
|
+
render: () => (
|
|
262
|
+
<div className="space-y-6">
|
|
263
|
+
<div className="grid grid-cols-2 gap-4">
|
|
264
|
+
<div>
|
|
265
|
+
<label className="mb-1 block text-sm font-medium text-gray-700">
|
|
266
|
+
Default
|
|
267
|
+
</label>
|
|
268
|
+
<Select
|
|
269
|
+
variant="default"
|
|
270
|
+
placeholder="Default select"
|
|
271
|
+
options={[
|
|
272
|
+
{ label: "Option 1", value: "option1" },
|
|
273
|
+
{ label: "Option 2", value: "option2" },
|
|
274
|
+
{ label: "Option 3", value: "option3" },
|
|
275
|
+
]}
|
|
276
|
+
/>
|
|
277
|
+
</div>
|
|
278
|
+
<div>
|
|
279
|
+
<label className="mb-1 block text-sm font-medium text-gray-700">
|
|
280
|
+
Error
|
|
281
|
+
</label>
|
|
282
|
+
<Select
|
|
283
|
+
hasError
|
|
284
|
+
error="This field is required"
|
|
285
|
+
placeholder="Error select"
|
|
286
|
+
options={[
|
|
287
|
+
{ label: "Option 1", value: "option1" },
|
|
288
|
+
{ label: "Option 2", value: "option2" },
|
|
289
|
+
{ label: "Option 3", value: "option3" },
|
|
290
|
+
]}
|
|
291
|
+
/>
|
|
292
|
+
</div>
|
|
293
|
+
</div>
|
|
294
|
+
<div className="grid grid-cols-2 gap-4">
|
|
295
|
+
<div>
|
|
296
|
+
<label className="mb-1 block text-sm font-medium text-gray-700">
|
|
297
|
+
Small
|
|
298
|
+
</label>
|
|
299
|
+
<Select
|
|
300
|
+
size="sm"
|
|
301
|
+
placeholder="Small select"
|
|
302
|
+
options={[
|
|
303
|
+
{ label: "Option 1", value: "option1" },
|
|
304
|
+
{ label: "Option 2", value: "option2" },
|
|
305
|
+
{ label: "Option 3", value: "option3" },
|
|
306
|
+
]}
|
|
307
|
+
/>
|
|
308
|
+
</div>
|
|
309
|
+
<div>
|
|
310
|
+
<label className="mb-1 block text-sm font-medium text-gray-700">
|
|
311
|
+
Medium
|
|
312
|
+
</label>
|
|
313
|
+
<Select
|
|
314
|
+
size="md"
|
|
315
|
+
placeholder="Medium select"
|
|
316
|
+
options={[
|
|
317
|
+
{ label: "Option 1", value: "option1" },
|
|
318
|
+
{ label: "Option 2", value: "option2" },
|
|
319
|
+
{ label: "Option 3", value: "option3" },
|
|
320
|
+
]}
|
|
321
|
+
/>
|
|
322
|
+
</div>
|
|
323
|
+
</div>
|
|
324
|
+
<div className="grid grid-cols-2 gap-4">
|
|
325
|
+
<div>
|
|
326
|
+
<label className="mb-1 block text-sm font-medium text-gray-700">
|
|
327
|
+
Disabled
|
|
328
|
+
</label>
|
|
329
|
+
<Select
|
|
330
|
+
isDisabled
|
|
331
|
+
placeholder="Disabled select"
|
|
332
|
+
options={[
|
|
333
|
+
{ label: "Option 1", value: "option1" },
|
|
334
|
+
{ label: "Option 2", value: "option2" },
|
|
335
|
+
{ label: "Option 3", value: "option3" },
|
|
336
|
+
]}
|
|
337
|
+
/>
|
|
338
|
+
</div>
|
|
339
|
+
<div>
|
|
340
|
+
<label className="mb-1 block text-sm font-medium text-gray-700">
|
|
341
|
+
With Helper Text
|
|
342
|
+
</label>
|
|
343
|
+
<Select
|
|
344
|
+
helperText="Please select an option"
|
|
345
|
+
placeholder="Select with helper"
|
|
346
|
+
options={[
|
|
347
|
+
{ label: "Option 1", value: "option1" },
|
|
348
|
+
{ label: "Option 2", value: "option2" },
|
|
349
|
+
{ label: "Option 3", value: "option3" },
|
|
350
|
+
]}
|
|
351
|
+
/>
|
|
352
|
+
</div>
|
|
353
|
+
</div>
|
|
354
|
+
</div>
|
|
355
|
+
),
|
|
356
|
+
parameters: {
|
|
357
|
+
docs: {
|
|
358
|
+
description: {
|
|
359
|
+
story: "Showcase of all select variants, sizes, and states.",
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
},
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
// Form example
|
|
366
|
+
export const FormExample: Story = {
|
|
367
|
+
render: () => (
|
|
368
|
+
<form className="space-y-4">
|
|
369
|
+
<div>
|
|
370
|
+
<label className="mb-1 block text-sm font-medium text-gray-700">
|
|
371
|
+
Country *
|
|
372
|
+
</label>
|
|
373
|
+
<Select
|
|
374
|
+
placeholder="Select your country"
|
|
375
|
+
hasError
|
|
376
|
+
error="Country is required"
|
|
377
|
+
options={[
|
|
378
|
+
{ label: "United States", value: "us" },
|
|
379
|
+
{ label: "Canada", value: "ca" },
|
|
380
|
+
{ label: "United Kingdom", value: "uk" },
|
|
381
|
+
{ label: "Germany", value: "de" },
|
|
382
|
+
{ label: "France", value: "fr" },
|
|
383
|
+
]}
|
|
384
|
+
/>
|
|
385
|
+
</div>
|
|
386
|
+
<div>
|
|
387
|
+
<label className="mb-1 block text-sm font-medium text-gray-700">
|
|
388
|
+
State/Province
|
|
389
|
+
</label>
|
|
390
|
+
<Select
|
|
391
|
+
placeholder="Select your state"
|
|
392
|
+
helperText="Optional field"
|
|
393
|
+
options={[
|
|
394
|
+
{ label: "California", value: "ca" },
|
|
395
|
+
{ label: "New York", value: "ny" },
|
|
396
|
+
{ label: "Texas", value: "tx" },
|
|
397
|
+
{ label: "Florida", value: "fl" },
|
|
398
|
+
]}
|
|
399
|
+
/>
|
|
400
|
+
</div>
|
|
401
|
+
</form>
|
|
402
|
+
),
|
|
403
|
+
parameters: {
|
|
404
|
+
docs: {
|
|
405
|
+
description: {
|
|
406
|
+
story: "Example of select components used in a form context.",
|
|
407
|
+
},
|
|
408
|
+
},
|
|
409
|
+
},
|
|
410
|
+
};
|