infinity-ui-elements 1.0.3 → 1.0.5
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/dist/components/Button/Button.d.ts +8 -3
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/index.css +2 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/Button/Button.stories.tsx +0 -458
- package/src/components/Button/Button.tsx +0 -308
- package/src/components/Button/index.ts +0 -2
- package/src/index.css +0 -546
- package/src/index.ts +0 -5
- package/src/lib/utils.ts +0 -6
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "infinity-ui-elements",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "A React TypeScript component library with Tailwind CSS design system",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"style": "dist/index.css",
|
|
8
9
|
"files": [
|
|
9
|
-
"dist"
|
|
10
|
-
"src"
|
|
10
|
+
"dist"
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build": "yarn build:css && rollup -c",
|
|
@@ -1,458 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { Button } from "./Button";
|
|
3
|
-
import {
|
|
4
|
-
Download,
|
|
5
|
-
Heart,
|
|
6
|
-
Star,
|
|
7
|
-
Plus,
|
|
8
|
-
ArrowRight,
|
|
9
|
-
Settings,
|
|
10
|
-
} from "lucide-react";
|
|
11
|
-
|
|
12
|
-
const meta: Meta<typeof Button> = {
|
|
13
|
-
title: "Components/Button",
|
|
14
|
-
component: Button,
|
|
15
|
-
parameters: {
|
|
16
|
-
layout: "centered",
|
|
17
|
-
a11y: {
|
|
18
|
-
// Component-specific accessibility configuration
|
|
19
|
-
config: {
|
|
20
|
-
rules: [
|
|
21
|
-
{
|
|
22
|
-
// Ensure buttons have accessible names
|
|
23
|
-
id: "button-name",
|
|
24
|
-
enabled: true,
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
// Check for proper ARIA attributes
|
|
28
|
-
id: "aria-allowed-attr",
|
|
29
|
-
enabled: true,
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
tags: ["autodocs"],
|
|
36
|
-
argTypes: {
|
|
37
|
-
variant: {
|
|
38
|
-
control: { type: "select" },
|
|
39
|
-
options: ["primary", "secondary", "tertiary"],
|
|
40
|
-
},
|
|
41
|
-
color: {
|
|
42
|
-
control: { type: "select" },
|
|
43
|
-
options: ["primary", "positive", "negative", "notice", "info", "neutral"],
|
|
44
|
-
},
|
|
45
|
-
size: {
|
|
46
|
-
control: { type: "select" },
|
|
47
|
-
options: ["xsmall", "small", "medium", "large"],
|
|
48
|
-
},
|
|
49
|
-
isIconOnly: {
|
|
50
|
-
control: { type: "boolean" },
|
|
51
|
-
},
|
|
52
|
-
isLoading: {
|
|
53
|
-
control: { type: "boolean" },
|
|
54
|
-
},
|
|
55
|
-
isFullWidth: {
|
|
56
|
-
control: { type: "boolean" },
|
|
57
|
-
},
|
|
58
|
-
disabled: {
|
|
59
|
-
control: { type: "boolean" },
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export default meta;
|
|
65
|
-
type Story = StoryObj<typeof meta>;
|
|
66
|
-
|
|
67
|
-
// Default story
|
|
68
|
-
export const Default: Story = {
|
|
69
|
-
args: {
|
|
70
|
-
children: "Button",
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
// Variant stories
|
|
75
|
-
export const Primary: Story = {
|
|
76
|
-
args: {
|
|
77
|
-
variant: "primary",
|
|
78
|
-
children: "Primary Button",
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export const Secondary: Story = {
|
|
83
|
-
args: {
|
|
84
|
-
variant: "secondary",
|
|
85
|
-
children: "Secondary Button",
|
|
86
|
-
},
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
export const Tertiary: Story = {
|
|
90
|
-
args: {
|
|
91
|
-
variant: "tertiary",
|
|
92
|
-
children: "Tertiary Button",
|
|
93
|
-
},
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
// Color stories
|
|
97
|
-
export const Colors: Story = {
|
|
98
|
-
render: () => (
|
|
99
|
-
<div className="flex flex-col gap-4">
|
|
100
|
-
<div className="flex gap-2 flex-wrap">
|
|
101
|
-
<Button variant="primary" color="primary">
|
|
102
|
-
Primary
|
|
103
|
-
</Button>
|
|
104
|
-
<Button variant="primary" color="positive">
|
|
105
|
-
Positive
|
|
106
|
-
</Button>
|
|
107
|
-
<Button variant="primary" color="negative">
|
|
108
|
-
Negative
|
|
109
|
-
</Button>
|
|
110
|
-
<Button variant="primary" color="notice">
|
|
111
|
-
Notice
|
|
112
|
-
</Button>
|
|
113
|
-
<Button variant="primary" color="info">
|
|
114
|
-
Info
|
|
115
|
-
</Button>
|
|
116
|
-
<Button variant="primary" color="neutral">
|
|
117
|
-
Neutral
|
|
118
|
-
</Button>
|
|
119
|
-
</div>
|
|
120
|
-
<div className="flex gap-2 flex-wrap">
|
|
121
|
-
<Button variant="secondary" color="primary">
|
|
122
|
-
Primary
|
|
123
|
-
</Button>
|
|
124
|
-
<Button variant="secondary" color="positive">
|
|
125
|
-
Positive
|
|
126
|
-
</Button>
|
|
127
|
-
<Button variant="secondary" color="negative">
|
|
128
|
-
Negative
|
|
129
|
-
</Button>
|
|
130
|
-
<Button variant="secondary" color="notice">
|
|
131
|
-
Notice
|
|
132
|
-
</Button>
|
|
133
|
-
<Button variant="secondary" color="info">
|
|
134
|
-
Info
|
|
135
|
-
</Button>
|
|
136
|
-
<Button variant="secondary" color="neutral">
|
|
137
|
-
Neutral
|
|
138
|
-
</Button>
|
|
139
|
-
</div>
|
|
140
|
-
<div className="flex gap-2 flex-wrap">
|
|
141
|
-
<Button variant="tertiary" color="primary">
|
|
142
|
-
Primary
|
|
143
|
-
</Button>
|
|
144
|
-
<Button variant="tertiary" color="positive">
|
|
145
|
-
Positive
|
|
146
|
-
</Button>
|
|
147
|
-
<Button variant="tertiary" color="negative">
|
|
148
|
-
Negative
|
|
149
|
-
</Button>
|
|
150
|
-
<Button variant="tertiary" color="notice">
|
|
151
|
-
Notice
|
|
152
|
-
</Button>
|
|
153
|
-
<Button variant="tertiary" color="info">
|
|
154
|
-
Info
|
|
155
|
-
</Button>
|
|
156
|
-
<Button variant="tertiary" color="neutral">
|
|
157
|
-
Neutral
|
|
158
|
-
</Button>
|
|
159
|
-
</div>
|
|
160
|
-
</div>
|
|
161
|
-
),
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
// Size stories
|
|
165
|
-
export const Sizes: Story = {
|
|
166
|
-
render: () => (
|
|
167
|
-
<div className="flex items-center gap-4">
|
|
168
|
-
<Button size="xsmall">XSmall</Button>
|
|
169
|
-
<Button size="small">Small</Button>
|
|
170
|
-
<Button size="medium">Medium</Button>
|
|
171
|
-
<Button size="large">Large</Button>
|
|
172
|
-
</div>
|
|
173
|
-
),
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
// Icon stories
|
|
177
|
-
export const WithIcons: Story = {
|
|
178
|
-
render: () => (
|
|
179
|
-
<div className="flex flex-col gap-4">
|
|
180
|
-
<div className="flex gap-2 flex-wrap">
|
|
181
|
-
<Button leadingIcon={<Download className="h-4 w-4" />}>Download</Button>
|
|
182
|
-
<Button trailingIcon={<ArrowRight className="h-4 w-4" />}>
|
|
183
|
-
Continue
|
|
184
|
-
</Button>
|
|
185
|
-
<Button
|
|
186
|
-
leadingIcon={<Plus className="h-4 w-4" />}
|
|
187
|
-
trailingIcon={<ArrowRight className="h-4 w-4" />}
|
|
188
|
-
>
|
|
189
|
-
Add Item
|
|
190
|
-
</Button>
|
|
191
|
-
</div>
|
|
192
|
-
</div>
|
|
193
|
-
),
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
// Icon only stories
|
|
197
|
-
export const IconOnly: Story = {
|
|
198
|
-
render: () => (
|
|
199
|
-
<div className="flex items-center gap-4">
|
|
200
|
-
<Button isIconOnly size="xsmall">
|
|
201
|
-
<Settings className="h-3 w-3" />
|
|
202
|
-
</Button>
|
|
203
|
-
<Button isIconOnly size="small">
|
|
204
|
-
<Settings className="h-4 w-4" />
|
|
205
|
-
</Button>
|
|
206
|
-
<Button isIconOnly size="medium">
|
|
207
|
-
<Settings className="h-4 w-4" />
|
|
208
|
-
</Button>
|
|
209
|
-
<Button isIconOnly size="large">
|
|
210
|
-
<Settings className="h-5 w-5" />
|
|
211
|
-
</Button>
|
|
212
|
-
</div>
|
|
213
|
-
),
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
// Loading states
|
|
217
|
-
export const Loading: Story = {
|
|
218
|
-
render: () => (
|
|
219
|
-
<div className="flex flex-col gap-4">
|
|
220
|
-
<div className="flex gap-2 flex-wrap">
|
|
221
|
-
<Button isLoading>Loading...</Button>
|
|
222
|
-
<Button isLoading leadingIcon={<Download className="h-4 w-4" />}>
|
|
223
|
-
Downloading...
|
|
224
|
-
</Button>
|
|
225
|
-
<Button isLoading isIconOnly>
|
|
226
|
-
<Settings className="h-4 w-4" />
|
|
227
|
-
</Button>
|
|
228
|
-
</div>
|
|
229
|
-
</div>
|
|
230
|
-
),
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
// Disabled states
|
|
234
|
-
export const Disabled: Story = {
|
|
235
|
-
render: () => (
|
|
236
|
-
<div className="flex flex-col gap-4">
|
|
237
|
-
<div className="flex gap-2 flex-wrap">
|
|
238
|
-
<Button disabled>Disabled</Button>
|
|
239
|
-
<Button disabled variant="secondary">
|
|
240
|
-
Disabled Secondary
|
|
241
|
-
</Button>
|
|
242
|
-
<Button disabled variant="tertiary">
|
|
243
|
-
Disabled Tertiary
|
|
244
|
-
</Button>
|
|
245
|
-
</div>
|
|
246
|
-
<div className="flex gap-2 flex-wrap">
|
|
247
|
-
<Button disabled leadingIcon={<Download className="h-4 w-4" />}>
|
|
248
|
-
Disabled with Icon
|
|
249
|
-
</Button>
|
|
250
|
-
<Button disabled isIconOnly>
|
|
251
|
-
<Settings className="h-4 w-4" />
|
|
252
|
-
</Button>
|
|
253
|
-
</div>
|
|
254
|
-
</div>
|
|
255
|
-
),
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
// Full width
|
|
259
|
-
export const FullWidth: Story = {
|
|
260
|
-
render: () => (
|
|
261
|
-
<div className="flex flex-col gap-4 w-[500px]">
|
|
262
|
-
<Button isFullWidth>Full Width Button</Button>
|
|
263
|
-
<Button>Normal Width Button</Button>
|
|
264
|
-
<Button isFullWidth leadingIcon={<Plus className="h-4 w-4" />}>
|
|
265
|
-
Full Width with Icon
|
|
266
|
-
</Button>
|
|
267
|
-
</div>
|
|
268
|
-
),
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
// Interactive playground
|
|
272
|
-
export const Playground: Story = {
|
|
273
|
-
args: {
|
|
274
|
-
children: "Playground Button",
|
|
275
|
-
variant: "primary",
|
|
276
|
-
color: "primary",
|
|
277
|
-
size: "medium",
|
|
278
|
-
isIconOnly: false,
|
|
279
|
-
isLoading: false,
|
|
280
|
-
isFullWidth: false,
|
|
281
|
-
disabled: false,
|
|
282
|
-
},
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
// Real-world examples
|
|
286
|
-
export const RealWorldExamples: Story = {
|
|
287
|
-
render: () => (
|
|
288
|
-
<div className="flex flex-col gap-6 p-6 bg-gray-50 rounded-lg">
|
|
289
|
-
<div>
|
|
290
|
-
<h3 className="text-lg font-semibold mb-3">E-commerce Actions</h3>
|
|
291
|
-
<div className="flex gap-2 flex-wrap">
|
|
292
|
-
<Button
|
|
293
|
-
variant="primary"
|
|
294
|
-
color="positive"
|
|
295
|
-
leadingIcon={<Plus className="h-4 w-4" />}
|
|
296
|
-
>
|
|
297
|
-
Add to Cart
|
|
298
|
-
</Button>
|
|
299
|
-
<Button
|
|
300
|
-
variant="secondary"
|
|
301
|
-
color="primary"
|
|
302
|
-
leadingIcon={<Heart className="h-4 w-4" />}
|
|
303
|
-
>
|
|
304
|
-
Add to Wishlist
|
|
305
|
-
</Button>
|
|
306
|
-
<Button variant="tertiary" color="primary">
|
|
307
|
-
View Details
|
|
308
|
-
</Button>
|
|
309
|
-
</div>
|
|
310
|
-
</div>
|
|
311
|
-
|
|
312
|
-
<div>
|
|
313
|
-
<h3 className="text-lg font-semibold mb-3">Form Actions</h3>
|
|
314
|
-
<div className="flex gap-2 flex-wrap">
|
|
315
|
-
<Button variant="primary" color="primary">
|
|
316
|
-
Save Changes
|
|
317
|
-
</Button>
|
|
318
|
-
<Button variant="secondary" color="neutral">
|
|
319
|
-
Cancel
|
|
320
|
-
</Button>
|
|
321
|
-
<Button variant="tertiary" color="negative">
|
|
322
|
-
Delete
|
|
323
|
-
</Button>
|
|
324
|
-
</div>
|
|
325
|
-
</div>
|
|
326
|
-
|
|
327
|
-
<div>
|
|
328
|
-
<h3 className="text-lg font-semibold mb-3">Status Actions</h3>
|
|
329
|
-
<div className="flex gap-2 flex-wrap">
|
|
330
|
-
<Button variant="primary" color="positive" isLoading>
|
|
331
|
-
Processing...
|
|
332
|
-
</Button>
|
|
333
|
-
<Button
|
|
334
|
-
variant="secondary"
|
|
335
|
-
color="notice"
|
|
336
|
-
leadingIcon={<Star className="h-4 w-4" />}
|
|
337
|
-
>
|
|
338
|
-
Rate Product
|
|
339
|
-
</Button>
|
|
340
|
-
<Button variant="tertiary" color="info">
|
|
341
|
-
Learn More
|
|
342
|
-
</Button>
|
|
343
|
-
</div>
|
|
344
|
-
</div>
|
|
345
|
-
|
|
346
|
-
<div>
|
|
347
|
-
<h3 className="text-lg font-semibold mb-3">Toolbar Actions</h3>
|
|
348
|
-
<div className="flex gap-2 flex-wrap">
|
|
349
|
-
<Button isIconOnly variant="secondary" color="primary">
|
|
350
|
-
<Settings className="h-4 w-4" />
|
|
351
|
-
</Button>
|
|
352
|
-
<Button isIconOnly variant="secondary" color="primary">
|
|
353
|
-
<Download className="h-4 w-4" />
|
|
354
|
-
</Button>
|
|
355
|
-
</div>
|
|
356
|
-
</div>
|
|
357
|
-
</div>
|
|
358
|
-
),
|
|
359
|
-
};
|
|
360
|
-
|
|
361
|
-
// Accessibility-focused stories
|
|
362
|
-
export const AccessibilityExamples: Story = {
|
|
363
|
-
render: () => (
|
|
364
|
-
<div className="flex flex-col gap-6 p-6">
|
|
365
|
-
<div>
|
|
366
|
-
<h3 className="text-lg font-semibold mb-3">
|
|
367
|
-
Accessible Button Examples
|
|
368
|
-
</h3>
|
|
369
|
-
<div className="flex flex-col gap-4">
|
|
370
|
-
{/* Button with proper accessible name */}
|
|
371
|
-
<Button>Save Changes</Button>
|
|
372
|
-
|
|
373
|
-
{/* Button with icon and accessible name */}
|
|
374
|
-
<Button leadingIcon={<Download className="h-4 w-4" />}>
|
|
375
|
-
Download File
|
|
376
|
-
</Button>
|
|
377
|
-
|
|
378
|
-
{/* Icon-only button with aria-label */}
|
|
379
|
-
<Button isIconOnly aria-label="Settings">
|
|
380
|
-
<Settings className="h-4 w-4" />
|
|
381
|
-
</Button>
|
|
382
|
-
|
|
383
|
-
{/* Loading button with proper state */}
|
|
384
|
-
<Button isLoading aria-label="Saving changes...">
|
|
385
|
-
Save Changes
|
|
386
|
-
</Button>
|
|
387
|
-
|
|
388
|
-
{/* Disabled button with proper state */}
|
|
389
|
-
<Button disabled aria-label="Save Changes (disabled)">
|
|
390
|
-
Save Changes
|
|
391
|
-
</Button>
|
|
392
|
-
</div>
|
|
393
|
-
</div>
|
|
394
|
-
</div>
|
|
395
|
-
),
|
|
396
|
-
parameters: {
|
|
397
|
-
a11y: {
|
|
398
|
-
// Focus on accessibility rules for this story
|
|
399
|
-
config: {
|
|
400
|
-
rules: [
|
|
401
|
-
{
|
|
402
|
-
id: "button-name",
|
|
403
|
-
enabled: true,
|
|
404
|
-
},
|
|
405
|
-
{
|
|
406
|
-
id: "aria-allowed-attr",
|
|
407
|
-
enabled: true,
|
|
408
|
-
},
|
|
409
|
-
{
|
|
410
|
-
id: "aria-required-attr",
|
|
411
|
-
enabled: true,
|
|
412
|
-
},
|
|
413
|
-
],
|
|
414
|
-
},
|
|
415
|
-
},
|
|
416
|
-
},
|
|
417
|
-
};
|
|
418
|
-
|
|
419
|
-
// Accessibility violations examples (for testing)
|
|
420
|
-
export const AccessibilityViolations: Story = {
|
|
421
|
-
render: () => (
|
|
422
|
-
<div className="flex flex-col gap-6 p-6">
|
|
423
|
-
<div>
|
|
424
|
-
<h3 className="text-lg font-semibold mb-3">
|
|
425
|
-
Accessibility Violations (for testing)
|
|
426
|
-
</h3>
|
|
427
|
-
<div className="flex flex-col gap-4">
|
|
428
|
-
{/* Icon-only button without aria-label - should fail */}
|
|
429
|
-
<Button isIconOnly>
|
|
430
|
-
<Settings className="h-4 w-4" />
|
|
431
|
-
</Button>
|
|
432
|
-
|
|
433
|
-
{/* Button with insufficient contrast (if using custom colors) */}
|
|
434
|
-
<Button style={{ backgroundColor: "#ccc", color: "#ddd" }}>
|
|
435
|
-
Low Contrast Button
|
|
436
|
-
</Button>
|
|
437
|
-
</div>
|
|
438
|
-
</div>
|
|
439
|
-
</div>
|
|
440
|
-
),
|
|
441
|
-
parameters: {
|
|
442
|
-
a11y: {
|
|
443
|
-
// Enable all accessibility checks for violation testing
|
|
444
|
-
config: {
|
|
445
|
-
rules: [
|
|
446
|
-
{
|
|
447
|
-
id: "button-name",
|
|
448
|
-
enabled: true,
|
|
449
|
-
},
|
|
450
|
-
{
|
|
451
|
-
id: "color-contrast",
|
|
452
|
-
enabled: true,
|
|
453
|
-
},
|
|
454
|
-
],
|
|
455
|
-
},
|
|
456
|
-
},
|
|
457
|
-
},
|
|
458
|
-
};
|