@4alldigital/foundation-ui--core 3.6.4 → 3.7.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/package.json +2 -2
- package/src/components/Accordion/Accordion.tsx +2 -2
- package/src/components/Button/Button.stories.tsx +247 -18
- package/src/components/Button/Button.tsx +252 -105
- package/src/components/Button/Button.types.ts +44 -12
- package/src/components/Button/index.ts +8 -1
- package/src/components/ButtonDeprecated/Button.stories.tsx +51 -0
- package/src/components/ButtonDeprecated/Button.tsx +138 -0
- package/src/components/ButtonDeprecated/Button.types.ts +43 -0
- package/src/components/ButtonDeprecated/index.ts +1 -0
- package/src/components/ProductCard/ProductCard.tsx +5 -5
- package/src/components/ProductDetail/ProductDetail.tsx +7 -7
- package/src/components/ShadcnCarousel/ShadcnCarousel.tsx +7 -7
- package/src/components/index.ts +4 -4
- package/src/templates/NotFoundScreen/NotFoundScreen.tsx +0 -1
- package/src/templates/ProductListScreen/ProductListScreen.tsx +0 -1
- package/src/templates/PurchaseConfirmationScreen/PurchaseConfirmationScreen.tsx +7 -7
- package/src/components/ShadcnButton/ShadcnButton.stories.tsx +0 -152
- package/src/components/ShadcnButton/ShadcnButton.tsx +0 -57
- package/src/components/ShadcnButton/index.ts +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@4alldigital/foundation-ui--core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"description": "Foundation UI Core Component Library (source distribution)",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
},
|
|
33
33
|
"author": "Joe Mewes",
|
|
34
34
|
"license": "MIT",
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "0049b7335f8f06215701846c7d2efb20d12ed15a"
|
|
36
36
|
}
|
|
@@ -12,12 +12,12 @@ const AccordionItem = ({ title, content }: { title: string; content: string }) =
|
|
|
12
12
|
<Collapsible.Root open={open} onOpenChange={setOpen} className="mb-2">
|
|
13
13
|
<Collapsible.Trigger
|
|
14
14
|
className={cx(
|
|
15
|
-
'accordion-trigger w-full',
|
|
15
|
+
'accordion-trigger w-full flex gap-2 items-center justify-between',
|
|
16
16
|
{
|
|
17
17
|
'accordion-trigger-open': open,
|
|
18
18
|
},
|
|
19
19
|
)}>
|
|
20
|
-
<Copy className={cx('transition-all mb-0 mr-2', { 'text-
|
|
20
|
+
<Copy bold className={cx('transition-all mb-0 mr-2', { 'text-body': open })}>
|
|
21
21
|
{title}
|
|
22
22
|
</Copy>
|
|
23
23
|
<div className="">
|
|
@@ -1,50 +1,279 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/
|
|
2
|
-
import Button from '
|
|
3
|
-
import { BTN_VARIANTS } from './Button.types';
|
|
4
|
-
|
|
5
|
-
type Story = StoryObj<typeof Button>;
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Button } from './Button';
|
|
3
|
+
import { BTN_VARIANTS, BTN_SIZES } from './Button.types';
|
|
4
|
+
import { ChevronRight, Mail, Loader2 } from 'lucide-react';
|
|
6
5
|
|
|
7
6
|
const meta: Meta<typeof Button> = {
|
|
8
7
|
title: 'ATOMS/Button',
|
|
9
8
|
component: Button,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
variant: {
|
|
12
|
+
control: 'select',
|
|
13
|
+
options: ['primary', 'secondary', 'tertiary', 'link', 'outline', 'ghost', 'destructive', 'default'],
|
|
14
|
+
description: 'Button visual variant',
|
|
15
|
+
},
|
|
16
|
+
size: {
|
|
17
|
+
control: 'select',
|
|
18
|
+
options: ['sm', 'default', 'lg', 'icon', 'small', 'medium', 'large'],
|
|
19
|
+
description: 'Button size (supports both new and legacy size names)',
|
|
20
|
+
},
|
|
21
|
+
disabled: {
|
|
22
|
+
control: 'boolean',
|
|
23
|
+
description: 'Disabled state',
|
|
24
|
+
},
|
|
25
|
+
wide: {
|
|
26
|
+
control: 'boolean',
|
|
27
|
+
description: 'Wide padding variant',
|
|
28
|
+
},
|
|
29
|
+
rounded: {
|
|
30
|
+
control: 'boolean',
|
|
31
|
+
description: 'Fully rounded variant',
|
|
32
|
+
},
|
|
33
|
+
raised: {
|
|
34
|
+
control: 'boolean',
|
|
35
|
+
description: 'Add shadow effect',
|
|
36
|
+
},
|
|
37
|
+
uppercase: {
|
|
38
|
+
control: 'boolean',
|
|
39
|
+
description: 'Uppercase text',
|
|
40
|
+
},
|
|
41
|
+
outline: {
|
|
42
|
+
control: 'boolean',
|
|
43
|
+
description: 'Outline variant',
|
|
44
|
+
},
|
|
45
|
+
isLoading: {
|
|
46
|
+
control: 'boolean',
|
|
47
|
+
description: 'Show loading spinner',
|
|
48
|
+
},
|
|
49
|
+
asChild: {
|
|
50
|
+
control: 'boolean',
|
|
51
|
+
description: 'Merge props with child element (Radix UI Slot)',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
10
54
|
};
|
|
11
55
|
|
|
12
56
|
export default meta;
|
|
57
|
+
type Story = StoryObj<typeof Button>;
|
|
58
|
+
|
|
59
|
+
// New CVA-based variants
|
|
60
|
+
export const Primary: Story = {
|
|
61
|
+
args: {
|
|
62
|
+
children: 'Primary Button',
|
|
63
|
+
variant: 'primary',
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const Secondary: Story = {
|
|
68
|
+
args: {
|
|
69
|
+
children: 'Secondary Button',
|
|
70
|
+
variant: 'secondary',
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const Tertiary: Story = {
|
|
75
|
+
args: {
|
|
76
|
+
children: 'Tertiary Button',
|
|
77
|
+
variant: 'tertiary',
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const Link: Story = {
|
|
82
|
+
args: {
|
|
83
|
+
children: 'Link Button',
|
|
84
|
+
variant: 'link',
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const Outline: Story = {
|
|
89
|
+
args: {
|
|
90
|
+
children: 'Outline Button',
|
|
91
|
+
outline: true,
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const Ghost: Story = {
|
|
96
|
+
args: {
|
|
97
|
+
children: 'Ghost Button',
|
|
98
|
+
variant: 'ghost',
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export const Destructive: Story = {
|
|
103
|
+
args: {
|
|
104
|
+
children: 'Delete',
|
|
105
|
+
variant: 'destructive',
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// Size variants
|
|
110
|
+
export const Small: Story = {
|
|
111
|
+
args: {
|
|
112
|
+
children: 'Small Button',
|
|
113
|
+
size: 'sm',
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export const DefaultSize: Story = {
|
|
118
|
+
args: {
|
|
119
|
+
children: 'Default Button',
|
|
120
|
+
size: 'default',
|
|
121
|
+
},
|
|
122
|
+
};
|
|
13
123
|
|
|
14
|
-
|
|
15
|
-
export const Default: Story = {
|
|
124
|
+
export const Large: Story = {
|
|
16
125
|
args: {
|
|
17
|
-
children:
|
|
126
|
+
children: 'Large Button',
|
|
127
|
+
size: 'lg',
|
|
18
128
|
},
|
|
19
129
|
};
|
|
20
130
|
|
|
131
|
+
// Wide variant
|
|
132
|
+
export const Wide: Story = {
|
|
133
|
+
args: {
|
|
134
|
+
children: 'Wide Button',
|
|
135
|
+
wide: true,
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// Rounded variant
|
|
140
|
+
export const Rounded: Story = {
|
|
141
|
+
args: {
|
|
142
|
+
children: 'Rounded',
|
|
143
|
+
rounded: true,
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
// Raised variant
|
|
148
|
+
export const Raised: Story = {
|
|
149
|
+
args: {
|
|
150
|
+
children: 'Raised Button',
|
|
151
|
+
raised: true,
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
// With icon
|
|
21
156
|
export const WithIcon: Story = {
|
|
22
157
|
args: {
|
|
23
|
-
variant:
|
|
24
|
-
children:
|
|
158
|
+
variant: 'primary',
|
|
159
|
+
children: 'Next',
|
|
25
160
|
icon: 'carbon:arrow-right',
|
|
26
161
|
},
|
|
27
162
|
};
|
|
28
163
|
|
|
164
|
+
export const IconFirst: Story = {
|
|
165
|
+
args: {
|
|
166
|
+
variant: 'primary',
|
|
167
|
+
children: 'Previous',
|
|
168
|
+
icon: 'carbon:arrow-left',
|
|
169
|
+
iconFirst: true,
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
|
|
29
173
|
export const IconOnly: Story = {
|
|
30
174
|
args: {
|
|
31
|
-
variant:
|
|
175
|
+
variant: 'primary',
|
|
32
176
|
icon: 'carbon:arrow-right',
|
|
177
|
+
size: 'icon',
|
|
33
178
|
},
|
|
34
179
|
};
|
|
35
180
|
|
|
36
|
-
export const
|
|
181
|
+
export const ExternalLink: Story = {
|
|
37
182
|
args: {
|
|
38
|
-
variant:
|
|
39
|
-
children:
|
|
40
|
-
|
|
183
|
+
variant: 'link',
|
|
184
|
+
children: 'External Link',
|
|
185
|
+
external: true,
|
|
41
186
|
},
|
|
42
187
|
};
|
|
43
188
|
|
|
44
|
-
|
|
189
|
+
// Loading state
|
|
190
|
+
export const Loading: Story = {
|
|
45
191
|
args: {
|
|
46
|
-
variant:
|
|
47
|
-
children:
|
|
192
|
+
variant: 'primary',
|
|
193
|
+
children: 'Processing',
|
|
48
194
|
isLoading: true,
|
|
49
195
|
},
|
|
50
196
|
};
|
|
197
|
+
|
|
198
|
+
// Disabled
|
|
199
|
+
export const Disabled: Story = {
|
|
200
|
+
args: {
|
|
201
|
+
children: 'Disabled Button',
|
|
202
|
+
disabled: true,
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
// Backward compatibility - using legacy enum values
|
|
207
|
+
export const LegacyPrimary: Story = {
|
|
208
|
+
name: 'Legacy: PRIMARY enum',
|
|
209
|
+
args: {
|
|
210
|
+
children: 'Legacy Primary',
|
|
211
|
+
variant: BTN_VARIANTS.PRIMARY,
|
|
212
|
+
size: BTN_SIZES.MEDIUM,
|
|
213
|
+
},
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
export const LegacySecondary: Story = {
|
|
217
|
+
name: 'Legacy: SECONDARY enum',
|
|
218
|
+
args: {
|
|
219
|
+
children: 'Legacy Secondary',
|
|
220
|
+
variant: BTN_VARIANTS.SECONDARY,
|
|
221
|
+
size: BTN_SIZES.LARGE,
|
|
222
|
+
},
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
// All variants showcase
|
|
226
|
+
export const AllVariants: Story = {
|
|
227
|
+
render: () => (
|
|
228
|
+
<div className="flex flex-wrap gap-4">
|
|
229
|
+
<Button variant="primary">Primary</Button>
|
|
230
|
+
<Button variant="secondary">Secondary</Button>
|
|
231
|
+
<Button variant="tertiary">Tertiary</Button>
|
|
232
|
+
<Button variant="link">Link</Button>
|
|
233
|
+
<Button outline>Outline</Button>
|
|
234
|
+
<Button variant="ghost">Ghost</Button>
|
|
235
|
+
<Button variant="destructive">Destructive</Button>
|
|
236
|
+
</div>
|
|
237
|
+
),
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
// All sizes showcase
|
|
241
|
+
export const AllSizes: Story = {
|
|
242
|
+
render: () => (
|
|
243
|
+
<div className="flex flex-wrap items-center gap-4">
|
|
244
|
+
<Button size="sm">Small</Button>
|
|
245
|
+
<Button size="default">Default</Button>
|
|
246
|
+
<Button size="lg">Large</Button>
|
|
247
|
+
<Button size="icon" icon="carbon:arrow-right" />
|
|
248
|
+
</div>
|
|
249
|
+
),
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
// Complex example with multiple props
|
|
253
|
+
export const ComplexExample: Story = {
|
|
254
|
+
render: () => (
|
|
255
|
+
<div className="space-y-4">
|
|
256
|
+
<div className="flex gap-4">
|
|
257
|
+
<Button variant="primary" size="lg" wide raised uppercase>
|
|
258
|
+
Call to Action
|
|
259
|
+
</Button>
|
|
260
|
+
</div>
|
|
261
|
+
<div className="flex gap-4">
|
|
262
|
+
<Button variant="secondary" icon="carbon:shopping-cart">
|
|
263
|
+
Add to Cart
|
|
264
|
+
</Button>
|
|
265
|
+
<Button variant="tertiary" icon="carbon:favorite" iconFirst>
|
|
266
|
+
Favorite
|
|
267
|
+
</Button>
|
|
268
|
+
</div>
|
|
269
|
+
<div className="flex gap-4">
|
|
270
|
+
<Button outline rounded>
|
|
271
|
+
Rounded Outline
|
|
272
|
+
</Button>
|
|
273
|
+
<Button variant="link" external>
|
|
274
|
+
Learn More
|
|
275
|
+
</Button>
|
|
276
|
+
</div>
|
|
277
|
+
</div>
|
|
278
|
+
),
|
|
279
|
+
};
|