@shopify/shop-minis-react 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.
Files changed (93) hide show
  1. package/dist/_virtual/debounce.js +8 -0
  2. package/dist/_virtual/debounce.js.map +1 -0
  3. package/dist/components/commerce/merchant-card.js +201 -0
  4. package/dist/components/commerce/merchant-card.js.map +1 -0
  5. package/dist/components/commerce/product-card.js +11 -9
  6. package/dist/components/commerce/product-card.js.map +1 -1
  7. package/dist/hooks/product/useCuratedProducts.js +20 -0
  8. package/dist/hooks/product/useCuratedProducts.js.map +1 -0
  9. package/dist/hooks/product/useProduct.js +24 -0
  10. package/dist/hooks/product/useProduct.js.map +1 -0
  11. package/dist/hooks/product/useProductMedia.js +24 -0
  12. package/dist/hooks/product/useProductMedia.js.map +1 -0
  13. package/dist/hooks/product/useProductSearch.js +44 -0
  14. package/dist/hooks/product/useProductSearch.js.map +1 -0
  15. package/dist/hooks/product/useProductVariants.js +21 -0
  16. package/dist/hooks/product/useProductVariants.js.map +1 -0
  17. package/dist/hooks/product/useProducts.js +17 -0
  18. package/dist/hooks/product/useProducts.js.map +1 -0
  19. package/dist/hooks/shop/useShop.js +17 -0
  20. package/dist/hooks/shop/useShop.js.map +1 -0
  21. package/dist/hooks/user/useFollowedShops.js +21 -0
  22. package/dist/hooks/user/useFollowedShops.js.map +1 -0
  23. package/dist/hooks/user/useRecentProducts.js +21 -0
  24. package/dist/hooks/user/useRecentProducts.js.map +1 -0
  25. package/dist/hooks/user/useRecentShops.js +21 -0
  26. package/dist/hooks/user/useRecentShops.js.map +1 -0
  27. package/dist/hooks/user/useSavedProducts.js +21 -0
  28. package/dist/hooks/user/useSavedProducts.js.map +1 -0
  29. package/dist/index.js +210 -178
  30. package/dist/index.js.map +1 -1
  31. package/dist/internal/useShopActionsPaginatedDataFetching.js +24 -24
  32. package/dist/internal/useShopActionsPaginatedDataFetching.js.map +1 -1
  33. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Symbol.js +12 -0
  34. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Symbol.js.map +1 -0
  35. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.js +17 -0
  36. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.js.map +1 -0
  37. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseTrim.js +15 -0
  38. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseTrim.js.map +1 -0
  39. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_freeGlobal.js +12 -0
  40. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_freeGlobal.js.map +1 -0
  41. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getRawTag.js +22 -0
  42. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getRawTag.js.map +1 -0
  43. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_objectToString.js +14 -0
  44. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_objectToString.js.map +1 -0
  45. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.js +12 -0
  46. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.js.map +1 -0
  47. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_trimmedEndIndex.js +16 -0
  48. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_trimmedEndIndex.js.map +1 -0
  49. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/debounce.js +61 -0
  50. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/debounce.js.map +1 -0
  51. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObject.js +14 -0
  52. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObject.js.map +1 -0
  53. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObjectLike.js +13 -0
  54. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObjectLike.js.map +1 -0
  55. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isSymbol.js +16 -0
  56. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isSymbol.js.map +1 -0
  57. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/now.js +14 -0
  58. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/now.js.map +1 -0
  59. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toNumber.js +29 -0
  60. package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toNumber.js.map +1 -0
  61. package/dist/types/minisSDK.generated.d.js.map +1 -1
  62. package/package.json +18 -17
  63. package/src/base.css +264 -0
  64. package/src/components/commerce/merchant-card.tsx +262 -0
  65. package/src/components/commerce/product-card.tsx +3 -1
  66. package/src/components/index.ts +1 -0
  67. package/src/hooks/index.ts +11 -0
  68. package/src/hooks/product/useCuratedProducts.doc.ts +32 -0
  69. package/src/hooks/product/useCuratedProducts.example.tsx +10 -0
  70. package/src/hooks/product/useCuratedProducts.ts +41 -0
  71. package/src/hooks/product/useProduct.ts +45 -0
  72. package/src/hooks/product/useProductMedia.ts +51 -0
  73. package/src/hooks/product/useProductSearch.doc.ts +32 -0
  74. package/src/hooks/product/useProductSearch.example.tsx +13 -0
  75. package/src/hooks/product/useProductSearch.ts +95 -0
  76. package/src/hooks/product/useProductVariants.ts +48 -0
  77. package/src/hooks/product/useProducts.ts +38 -0
  78. package/src/hooks/shop/useShop.doc.ts +31 -0
  79. package/src/hooks/shop/useShop.example.tsx +7 -0
  80. package/src/hooks/shop/useShop.ts +38 -0
  81. package/src/hooks/user/useFollowedShops.ts +43 -0
  82. package/src/hooks/user/useRecentProducts.doc.ts +32 -0
  83. package/src/hooks/user/useRecentProducts.example.tsx +13 -0
  84. package/src/hooks/user/useRecentProducts.ts +46 -0
  85. package/src/hooks/user/useRecentShops.ts +43 -0
  86. package/src/hooks/user/useSavedProducts.doc.ts +32 -0
  87. package/src/hooks/user/useSavedProducts.example.tsx +13 -0
  88. package/src/hooks/user/useSavedProducts.ts +46 -0
  89. package/src/index.css +1 -221
  90. package/src/internal/useShopActionsPaginatedDataFetching.ts +8 -8
  91. package/src/types/minisSDK.generated.d.ts +239 -4
  92. package/src/dev.tsx +0 -868
  93. package/src/mockActions.ts +0 -237
package/src/dev.tsx DELETED
@@ -1,868 +0,0 @@
1
- import React, {useState} from 'react'
2
-
3
- import ReactDOM from 'react-dom/client'
4
- import {toast} from 'sonner'
5
-
6
- import './index.css'
7
- import {
8
- Accordion,
9
- AccordionContent,
10
- AccordionItem,
11
- AccordionTrigger,
12
- } from './components/atoms/accordion'
13
- import {Alert, AlertDescription, AlertTitle} from './components/atoms/alert'
14
- import {
15
- AlertDialog,
16
- AlertDialogAction,
17
- AlertDialogCancel,
18
- AlertDialogContent,
19
- AlertDialogDescription,
20
- AlertDialogFooter,
21
- AlertDialogHeader,
22
- AlertDialogTitle,
23
- AlertDialogTrigger,
24
- } from './components/atoms/alert-dialog'
25
- import {Avatar, AvatarFallback, AvatarImage} from './components/atoms/avatar'
26
- import {Badge} from './components/atoms/badge'
27
- import {Button} from './components/atoms/button'
28
- import {
29
- Card,
30
- CardHeader,
31
- CardTitle,
32
- CardDescription,
33
- CardContent,
34
- CardAction,
35
- CardFooter,
36
- } from './components/atoms/card'
37
- import {
38
- Carousel,
39
- CarouselContent,
40
- CarouselItem,
41
- CarouselNext,
42
- CarouselPrevious,
43
- } from './components/atoms/carousel'
44
- import {Checkbox} from './components/atoms/checkbox'
45
- import {
46
- Dialog,
47
- DialogContent,
48
- DialogDescription,
49
- DialogFooter,
50
- DialogHeader,
51
- DialogTitle,
52
- DialogTrigger,
53
- } from './components/atoms/dialog'
54
- import {
55
- Drawer,
56
- DrawerClose,
57
- DrawerContent,
58
- DrawerDescription,
59
- DrawerFooter,
60
- DrawerHeader,
61
- DrawerTitle,
62
- DrawerTrigger,
63
- } from './components/atoms/drawer'
64
- import {Input} from './components/atoms/input'
65
- import {Label} from './components/atoms/label'
66
- import {Progress} from './components/atoms/progress'
67
- import {RadioGroup, RadioGroupItem} from './components/atoms/radio-group'
68
- import {
69
- ResizableHandle,
70
- ResizablePanel,
71
- ResizablePanelGroup,
72
- } from './components/atoms/resizable'
73
- import {ScrollArea} from './components/atoms/scroll-area'
74
- import {
75
- Select,
76
- SelectContent,
77
- SelectItem,
78
- SelectTrigger,
79
- SelectValue,
80
- } from './components/atoms/select'
81
- import {Separator} from './components/atoms/separator'
82
- import {
83
- Sheet,
84
- SheetClose,
85
- SheetContent,
86
- SheetDescription,
87
- SheetFooter,
88
- SheetHeader,
89
- SheetTitle,
90
- SheetTrigger,
91
- } from './components/atoms/sheet'
92
- import {Toaster} from './components/atoms/sonner'
93
- import {ProductCard} from './components/commerce/product-card'
94
- import {ProductLink} from './components/commerce/product-link'
95
- import {CurrencyCode} from './types/minisSDK.generated.d'
96
- import './mockActions'
97
-
98
- function App() {
99
- const [alertOpen, setAlertOpen] = useState(false)
100
- const [dialogOpen, setDialogOpen] = useState(false)
101
- const [progress, setProgress] = useState(13)
102
-
103
- React.useEffect(() => {
104
- const timer = setTimeout(() => setProgress(66), 500)
105
- return () => clearTimeout(timer)
106
- }, [])
107
-
108
- return (
109
- <div className="min-h-screen bg-gray-50 p-8">
110
- <div className="space-y-12 w-full max-w-6xl mx-auto">
111
- {/* Commerce Components Section */}
112
- <section className="space-y-8">
113
- <div className="border-b pb-4">
114
- <h2 className="text-3xl font-bold text-gray-800">
115
- Commerce Components
116
- </h2>
117
- <p className="text-gray-600 mt-2">Shop app specific components</p>
118
- </div>
119
-
120
- {/* ProductCard Examples */}
121
- <div className="space-y-4">
122
- <h3 className="text-2xl font-semibold">ProductCard</h3>
123
- <div className="space-y-6">
124
- {/* Default Variant - Full Size */}
125
- <div className="space-y-2">
126
- <h4 className="text-lg font-medium">Default</h4>
127
-
128
- <ProductCard
129
- product={{
130
- id: '1',
131
- title: 'The Hero Snowboard',
132
- price: {amount: '702.95', currencyCode: CurrencyCode.USD},
133
- featuredImage: {
134
- url: 'https://images.unsplash.com/photo-1551524164-687a55dd1126?w=400&h=400&fit=crop&crop=center',
135
- altText: 'The Hero Snowboard',
136
- },
137
- shop: {id: 'shop1', name: 'Snow Sports Co.'},
138
- defaultVariantId: 'variant1',
139
- isFavorited: false,
140
- reviewAnalytics: {},
141
- }}
142
- variant="default"
143
- />
144
- </div>
145
-
146
- {/* Grid Layout for Variants */}
147
- <div className="grid grid-cols-2 md:grid-cols-4 gap-4 max-w-4xl">
148
- {/* Default with discount */}
149
- <div className="space-y-2">
150
- <h4 className="text-sm font-medium">
151
- Default (with discount)
152
- </h4>
153
- <ProductCard
154
- product={{
155
- id: '2',
156
- title: 'The Hero Snowboard',
157
- price: {amount: '605.95', currencyCode: CurrencyCode.USD},
158
- compareAtPrice: {
159
- amount: '702.95',
160
- currencyCode: CurrencyCode.USD,
161
- },
162
- featuredImage: {
163
- url: 'https://images.unsplash.com/photo-1551524164-687a55dd1126?w=400&h=400&fit=crop&crop=center',
164
- altText: 'The Hero Snowboard',
165
- },
166
- shop: {id: 'shop1', name: 'Snow Sports Co.'},
167
- defaultVariantId: 'variant2',
168
- isFavorited: true,
169
- reviewAnalytics: {},
170
- }}
171
- variant="default"
172
- />
173
- </div>
174
-
175
- {/* Price Overlay */}
176
- <div className="space-y-2">
177
- <h4 className="text-sm font-medium">Price Overlay</h4>
178
- <ProductCard
179
- product={{
180
- id: '3',
181
- title: 'The Hero Snowboard',
182
- price: {amount: '702.95', currencyCode: CurrencyCode.USD},
183
- featuredImage: {
184
- url: 'https://images.unsplash.com/photo-1551524164-687a55dd1126?w=400&h=400&fit=crop&crop=center',
185
- altText: 'The Hero Snowboard',
186
- },
187
- shop: {id: 'shop1', name: 'Snow Sports Co.'},
188
- defaultVariantId: 'variant3',
189
- isFavorited: false,
190
- reviewAnalytics: {},
191
- }}
192
- variant="priceOverlay"
193
- />
194
- </div>
195
-
196
- {/* With Badge */}
197
- <div className="space-y-2">
198
- <h4 className="text-sm font-medium">With Badge</h4>
199
- <ProductCard
200
- product={{
201
- id: '4',
202
- title: 'The Hero Snowboard',
203
- price: {amount: '702.95', currencyCode: CurrencyCode.USD},
204
- featuredImage: {
205
- url: 'https://images.unsplash.com/photo-1551524164-687a55dd1126?w=400&h=400&fit=crop&crop=center',
206
- altText: 'The Hero Snowboard',
207
- },
208
- shop: {id: 'shop1', name: 'Snow Sports Co.'},
209
- defaultVariantId: 'variant4',
210
- isFavorited: true,
211
- reviewAnalytics: {},
212
- }}
213
- variant="default"
214
- badgeText="Sponsored"
215
- badgeVariant="secondary"
216
- />
217
- </div>
218
-
219
- {/* Compact */}
220
- <div className="space-y-2">
221
- <h4 className="text-sm font-medium">Compact</h4>
222
- <ProductCard
223
- product={{
224
- id: '5',
225
- title: 'The Hero Snowboard',
226
- price: {amount: '702.95', currencyCode: CurrencyCode.USD},
227
- featuredImage: {
228
- url: 'https://images.unsplash.com/photo-1551524164-687a55dd1126?w=400&h=400&fit=crop&crop=center',
229
- altText: 'The Hero Snowboard',
230
- },
231
- shop: {id: 'shop1', name: 'Snow Sports Co.'},
232
- defaultVariantId: 'variant5',
233
- isFavorited: false,
234
- reviewAnalytics: {},
235
- }}
236
- variant="compact"
237
- />
238
- </div>
239
- </div>
240
- </div>
241
- </div>
242
-
243
- {/* ProductLink Examples */}
244
- <div className="space-y-4">
245
- <h3 className="text-2xl font-semibold">ProductLink</h3>
246
- <div className="grid grid-cols-1 md:grid-cols-2 gap-4 max-w-4xl">
247
- {/* Default */}
248
- <ProductLink
249
- product={{
250
- id: '1',
251
- title: 'The Hero Snowboard',
252
- price: {amount: '702.95', currencyCode: CurrencyCode.USD},
253
- reviewAnalytics: {},
254
- shop: {id: 'shop1', name: 'Snow Sports Co.'},
255
- defaultVariantId: 'variant1',
256
- isFavorited: false,
257
- }}
258
- />
259
-
260
- {/* With discount and action */}
261
- <ProductLink
262
- product={{
263
- id: '2',
264
- title: 'Mr. Huebert Hydroxy Snow...',
265
- price: {amount: '605.95', currencyCode: CurrencyCode.USD},
266
- compareAtPrice: {
267
- amount: '702.00',
268
- currencyCode: CurrencyCode.USD,
269
- },
270
- reviewAnalytics: {},
271
- shop: {id: 'shop1', name: 'Snow Sports Co.'},
272
- defaultVariantId: 'variant2',
273
- isFavorited: false,
274
- }}
275
- />
276
-
277
- {/* With rating and action (liked) */}
278
- <ProductLink
279
- product={{
280
- id: '3',
281
- title: 'The Hero Snowboard',
282
- price: {amount: '702.95', currencyCode: CurrencyCode.USD},
283
- reviewAnalytics: {averageRating: 4.5, reviewCount: 2},
284
- shop: {id: 'shop1', name: 'Snow Sports Co.'},
285
- defaultVariantId: 'variant3',
286
- isFavorited: true,
287
- }}
288
- />
289
-
290
- {/* Large discount */}
291
- <ProductLink
292
- product={{
293
- id: '4',
294
- title: 'Mr. Huebert Hydroxy Snow...',
295
- price: {amount: '16005.95', currencyCode: CurrencyCode.USD},
296
- compareAtPrice: {
297
- amount: '17000.00',
298
- currencyCode: CurrencyCode.USD,
299
- },
300
- reviewAnalytics: {averageRating: 4, reviewCount: 12},
301
- shop: {id: 'shop1', name: 'Snow Sports Co.'},
302
- defaultVariantId: 'variant4',
303
- isFavorited: false,
304
- }}
305
- />
306
- </div>
307
- </div>
308
- </section>
309
-
310
- {/* Core UI Components Section */}
311
- <section className="space-y-8">
312
- <div className="border-b pb-4">
313
- <h2 className="text-3xl font-bold text-gray-800">
314
- Core UI Components
315
- </h2>
316
- <p className="text-gray-600 mt-2">
317
- Reusable UI components for building interfaces
318
- </p>
319
- </div>
320
-
321
- <div className="grid grid-cols-1 lg:grid-cols-2 gap-8">
322
- {/* Accordion */}
323
- <div className="space-y-4">
324
- <h3 className="text-2xl font-semibold">Accordion</h3>
325
- <Accordion type="single" collapsible className="w-full max-w-md">
326
- <AccordionItem value="item-1">
327
- <AccordionTrigger>Is it accessible?</AccordionTrigger>
328
- <AccordionContent>
329
- Yes. It adheres to the WAI-ARIA design pattern.
330
- </AccordionContent>
331
- </AccordionItem>
332
- <AccordionItem value="item-2">
333
- <AccordionTrigger>Is it styled?</AccordionTrigger>
334
- <AccordionContent>
335
- Yes. It comes with default styles that matches the other
336
- components&apos; aesthetic.
337
- </AccordionContent>
338
- </AccordionItem>
339
- </Accordion>
340
- </div>
341
-
342
- {/* Alert */}
343
- <div className="space-y-4">
344
- <h3 className="text-2xl font-semibold">Alert</h3>
345
- <div className="space-y-4 max-w-md">
346
- <Alert>
347
- <AlertTitle>Heads up!</AlertTitle>
348
- <AlertDescription>
349
- You can add components and dependencies to your app using
350
- the cli.
351
- </AlertDescription>
352
- </Alert>
353
- <Alert variant="destructive">
354
- <AlertTitle>Error</AlertTitle>
355
- <AlertDescription>
356
- Your session has expired. Please log in again.
357
- </AlertDescription>
358
- </Alert>
359
- </div>
360
- </div>
361
-
362
- {/* AlertDialog */}
363
- <div className="space-y-4">
364
- <h3 className="text-2xl font-semibold">Alert Dialog</h3>
365
- <AlertDialog open={alertOpen} onOpenChange={setAlertOpen}>
366
- <AlertDialogTrigger asChild>
367
- <Button variant="outlined">Show Alert Dialog</Button>
368
- </AlertDialogTrigger>
369
- <AlertDialogContent>
370
- <AlertDialogHeader>
371
- <AlertDialogTitle>
372
- Are you absolutely sure?
373
- </AlertDialogTitle>
374
- <AlertDialogDescription>
375
- This action cannot be undone. This will permanently delete
376
- your account and remove your data from our servers.
377
- </AlertDialogDescription>
378
- </AlertDialogHeader>
379
- <AlertDialogFooter>
380
- <AlertDialogCancel>Cancel</AlertDialogCancel>
381
- <AlertDialogAction
382
- onClick={() => toast.success('Action confirmed!')}
383
- >
384
- Continue
385
- </AlertDialogAction>
386
- </AlertDialogFooter>
387
- </AlertDialogContent>
388
- </AlertDialog>
389
- </div>
390
-
391
- {/* Avatar */}
392
- <div className="space-y-4">
393
- <h3 className="text-2xl font-semibold">Avatar</h3>
394
- <div className="flex items-center space-x-4">
395
- <Avatar>
396
- <AvatarImage
397
- src="https://github.com/shadcn.png"
398
- alt="@shadcn"
399
- />
400
- <AvatarFallback>CN</AvatarFallback>
401
- </Avatar>
402
- <Avatar>
403
- <AvatarFallback>JD</AvatarFallback>
404
- </Avatar>
405
- </div>
406
- </div>
407
-
408
- {/* Badge */}
409
- <div className="space-y-4">
410
- <h3 className="text-2xl font-semibold">Badge</h3>
411
- <div className="flex flex-wrap gap-2">
412
- <Badge>Default</Badge>
413
- <Badge variant="secondary">Secondary</Badge>
414
- <Badge variant="destructive">Destructive</Badge>
415
- <Badge variant="outline">Outline</Badge>
416
- </div>
417
- </div>
418
-
419
- {/* Button */}
420
- <div className="space-y-4">
421
- <h3 className="text-2xl font-semibold">Button</h3>
422
- <div className="space-y-4">
423
- {/* Core Variants */}
424
- <>
425
- <h4 className="text-lg font-medium mb-2">Core Variants</h4>
426
- <div className="flex flex-wrap gap-2">
427
- <Button
428
- variant="primary"
429
- onClick={() => console.log('primary')}
430
- >
431
- Primary
432
- </Button>
433
- <Button
434
- variant="secondary"
435
- onClick={() => console.log('secondary')}
436
- >
437
- Secondary
438
- </Button>
439
- <Button
440
- variant="tertiary"
441
- onClick={() => console.log('tertiary')}
442
- >
443
- Tertiary
444
- </Button>
445
- <Button
446
- variant="outlined"
447
- onClick={() => console.log('outlined')}
448
- >
449
- Outlined
450
- </Button>
451
- <Button variant="text" onClick={() => console.log('text')}>
452
- Text
453
- </Button>
454
- <Button
455
- variant="borderless"
456
- onClick={() => console.log('borderless')}
457
- >
458
- Borderless
459
- </Button>
460
- <Button
461
- variant="borderlessUnbranded"
462
- onClick={() => console.log('borderlessUnbranded')}
463
- >
464
- Borderless Unbranded
465
- </Button>
466
- </div>
467
- </>
468
-
469
- {/* Special Variants */}
470
- <>
471
- <h4 className="text-lg font-medium mb-2">Special Variants</h4>
472
- <div className="flex flex-wrap gap-2">
473
- <Button variant="blurred">Blurred</Button>
474
- <Button variant="dangerous">Dangerous</Button>
475
- <Button variant="outlined-dangerous">
476
- Outlined Dangerous
477
- </Button>
478
- </div>
479
- </>
480
-
481
- {/* Sizes */}
482
- <>
483
- <h4 className="text-lg font-medium mb-2">Sizes</h4>
484
- <div className="flex flex-wrap items-center gap-2">
485
- <Button size="sm">Small</Button>
486
- <Button size="default">Default</Button>
487
- <Button size="lg">Large</Button>
488
- <Button size="icon">
489
- <span role="img" aria-label="Target">
490
- 🎯
491
- </span>
492
- </Button>
493
- </div>
494
- </>
495
- </div>
496
- </div>
497
-
498
- {/* Card */}
499
- <div className="space-y-4">
500
- <h3 className="text-2xl font-semibold">Card</h3>
501
- <Card className="w-full max-w-md">
502
- <CardHeader>
503
- <CardTitle>Card Title</CardTitle>
504
- <CardDescription>
505
- This is a card description that explains what the card
506
- contains.
507
- </CardDescription>
508
- <CardAction>
509
- <Button size="sm" variant="outlined">
510
- Action
511
- </Button>
512
- </CardAction>
513
- </CardHeader>
514
- <CardContent>
515
- <p>
516
- This is the main content of the card. You can put any
517
- content here.
518
- </p>
519
- </CardContent>
520
- <CardFooter>
521
- <Button className="w-full">Footer Button</Button>
522
- </CardFooter>
523
- </Card>
524
- </div>
525
-
526
- {/* Carousel */}
527
- <div className="space-y-4">
528
- <h3 className="text-2xl font-semibold">Carousel</h3>
529
- <Carousel className="w-full max-w-xs">
530
- <CarouselContent>
531
- {Array.from({length: 5}).map((_, index) => (
532
- // eslint-disable-next-line react/no-array-index-key
533
- <CarouselItem key={`carousel-item-${index}`}>
534
- <div className="p-1">
535
- <Card>
536
- <CardContent className="flex aspect-square items-center justify-center p-6">
537
- <span className="text-4xl font-semibold">
538
- {index + 1}
539
- </span>
540
- </CardContent>
541
- </Card>
542
- </div>
543
- </CarouselItem>
544
- ))}
545
- </CarouselContent>
546
- <CarouselPrevious />
547
- <CarouselNext />
548
- </Carousel>
549
- </div>
550
-
551
- {/* Checkbox */}
552
- <div className="space-y-4">
553
- <h3 className="text-2xl font-semibold">Checkbox</h3>
554
- <div className="flex items-center space-x-2">
555
- <Checkbox id="terms" />
556
- <Label htmlFor="terms">Accept terms and conditions</Label>
557
- </div>
558
- </div>
559
-
560
- {/* Dialog */}
561
- <div className="space-y-4">
562
- <h3 className="text-2xl font-semibold">Dialog</h3>
563
- <Dialog open={dialogOpen} onOpenChange={setDialogOpen}>
564
- <DialogTrigger asChild>
565
- <Button variant="outlined">Open Dialog</Button>
566
- </DialogTrigger>
567
- <DialogContent className="sm:max-w-[425px]">
568
- <DialogHeader>
569
- <DialogTitle>Edit profile</DialogTitle>
570
- <DialogDescription>
571
- Make changes to your profile here. Click save when
572
- you&apos;re done.
573
- </DialogDescription>
574
- </DialogHeader>
575
- <div className="grid gap-4 py-4">
576
- <div className="grid grid-cols-4 items-center gap-4">
577
- <Label htmlFor="name" className="text-right">
578
- Name
579
- </Label>
580
- <Input
581
- id="name"
582
- defaultValue="Pedro Duarte"
583
- className="col-span-3"
584
- />
585
- </div>
586
- <div className="grid grid-cols-4 items-center gap-4">
587
- <Label htmlFor="username" className="text-right">
588
- Username
589
- </Label>
590
- <Input
591
- id="username"
592
- defaultValue="@peduarte"
593
- className="col-span-3"
594
- />
595
- </div>
596
- </div>
597
- <DialogFooter>
598
- <Button type="submit">Save changes</Button>
599
- </DialogFooter>
600
- </DialogContent>
601
- </Dialog>
602
- </div>
603
-
604
- {/* Drawer */}
605
- <div className="space-y-4">
606
- <h3 className="text-2xl font-semibold">Drawer</h3>
607
- <Drawer>
608
- <DrawerTrigger asChild>
609
- <Button variant="outlined">Open Drawer</Button>
610
- </DrawerTrigger>
611
- <DrawerContent>
612
- <div className="mx-auto w-full max-w-sm">
613
- <DrawerHeader>
614
- <DrawerTitle>Move Goal</DrawerTitle>
615
- <DrawerDescription>
616
- Set your daily activity goal.
617
- </DrawerDescription>
618
- </DrawerHeader>
619
- <div className="p-4 pb-0">
620
- <div className="flex items-center justify-center space-x-2">
621
- <Button
622
- variant="outlined"
623
- size="icon"
624
- className="h-8 w-8 shrink-0 rounded-full"
625
- onClick={() =>
626
- setProgress(Math.max(0, progress - 10))
627
- }
628
- >
629
- -
630
- </Button>
631
- <div className="flex-1 text-center">
632
- <div className="text-7xl font-bold tracking-tighter">
633
- {progress}
634
- </div>
635
- <div className="text-[0.70rem] uppercase text-muted-foreground">
636
- Goals/day
637
- </div>
638
- </div>
639
- <Button
640
- variant="outlined"
641
- size="icon"
642
- className="h-8 w-8 shrink-0 rounded-full"
643
- onClick={() =>
644
- setProgress(Math.min(100, progress + 10))
645
- }
646
- >
647
- +
648
- </Button>
649
- </div>
650
- </div>
651
- <DrawerFooter>
652
- <Button>Submit</Button>
653
- <DrawerClose asChild>
654
- <Button variant="outlined">Cancel</Button>
655
- </DrawerClose>
656
- </DrawerFooter>
657
- </div>
658
- </DrawerContent>
659
- </Drawer>
660
- </div>
661
-
662
- {/* Input & Label */}
663
- <div className="space-y-4">
664
- <h3 className="text-2xl font-semibold">Input & Label</h3>
665
- <div className="grid w-full max-w-sm items-center gap-1.5">
666
- <Label htmlFor="email">Email</Label>
667
- <Input type="email" id="email" placeholder="Email" />
668
- </div>
669
- </div>
670
-
671
- {/* Progress */}
672
- <div className="space-y-4">
673
- <h3 className="text-2xl font-semibold">Progress</h3>
674
- <Progress value={progress} className="w-[60%]" />
675
- </div>
676
-
677
- {/* Radio Group */}
678
- <div className="space-y-4">
679
- <h3 className="text-2xl font-semibold">Radio Group</h3>
680
- <RadioGroup defaultValue="comfortable">
681
- <div className="flex items-center space-x-2">
682
- <RadioGroupItem value="default" id="r1" />
683
- <Label htmlFor="r1">Default</Label>
684
- </div>
685
- <div className="flex items-center space-x-2">
686
- <RadioGroupItem value="comfortable" id="r2" />
687
- <Label htmlFor="r2">Comfortable</Label>
688
- </div>
689
- <div className="flex items-center space-x-2">
690
- <RadioGroupItem value="compact" id="r3" />
691
- <Label htmlFor="r3">Compact</Label>
692
- </div>
693
- </RadioGroup>
694
- </div>
695
-
696
- {/* Resizable */}
697
- <div className="space-y-4">
698
- <h3 className="text-2xl font-semibold">Resizable</h3>
699
-
700
- {/* Horizontal Layout */}
701
- <div className="space-y-2">
702
- <h4 className="text-lg font-medium">Horizontal</h4>
703
- <ResizablePanelGroup
704
- direction="horizontal"
705
- className="max-w-md rounded-lg border"
706
- >
707
- <ResizablePanel defaultSize={50}>
708
- <div className="flex h-[120px] items-center justify-center p-6">
709
- <span className="font-semibold">Left</span>
710
- </div>
711
- </ResizablePanel>
712
- <ResizableHandle />
713
- <ResizablePanel defaultSize={50}>
714
- <div className="flex h-[120px] items-center justify-center p-6">
715
- <span className="font-semibold">Right</span>
716
- </div>
717
- </ResizablePanel>
718
- </ResizablePanelGroup>
719
- </div>
720
-
721
- {/* Vertical Layout */}
722
- <div className="space-y-2">
723
- <h4 className="text-lg font-medium">Vertical</h4>
724
- <div className="max-w-md h-[200px] rounded-lg border overflow-hidden">
725
- <ResizablePanelGroup
726
- direction="vertical"
727
- className="h-full w-full"
728
- >
729
- <ResizablePanel defaultSize={40} minSize={20}>
730
- <div className="flex h-full items-center justify-center p-6">
731
- <span className="font-semibold">Top</span>
732
- </div>
733
- </ResizablePanel>
734
- <ResizableHandle />
735
- <ResizablePanel defaultSize={60} minSize={20}>
736
- <div className="flex h-full items-center justify-center p-6">
737
- <span className="font-semibold">Bottom</span>
738
- </div>
739
- </ResizablePanel>
740
- </ResizablePanelGroup>
741
- </div>
742
- </div>
743
- </div>
744
-
745
- {/* Scroll Area */}
746
- <div className="space-y-4">
747
- <h3 className="text-2xl font-semibold">Scroll Area</h3>
748
- <ScrollArea className="h-72 w-48 rounded-md border">
749
- <div className="p-4">
750
- <h4 className="mb-4 text-sm font-medium leading-none">
751
- Tags
752
- </h4>
753
- {Array.from({length: 50}).map((_, i) => (
754
- // eslint-disable-next-line react/no-array-index-key
755
- <div key={`tag-v1.2.0-beta.${i}`} className="text-sm">
756
- v1.2.0-beta.{i}
757
- </div>
758
- ))}
759
- </div>
760
- </ScrollArea>
761
- </div>
762
-
763
- {/* Select */}
764
- <div className="space-y-4">
765
- <h3 className="text-2xl font-semibold">Select</h3>
766
- <Select>
767
- <SelectTrigger className="w-[180px]">
768
- <SelectValue placeholder="Select a fruit" />
769
- </SelectTrigger>
770
- <SelectContent>
771
- <SelectItem value="apple">Apple</SelectItem>
772
- <SelectItem value="banana">Banana</SelectItem>
773
- <SelectItem value="blueberry">Blueberry</SelectItem>
774
- <SelectItem value="grapes">Grapes</SelectItem>
775
- <SelectItem value="pineapple">Pineapple</SelectItem>
776
- </SelectContent>
777
- </Select>
778
- </div>
779
-
780
- {/* Separator */}
781
- <div className="space-y-4">
782
- <h3 className="text-2xl font-semibold">Separator</h3>
783
- <div className="space-y-1">
784
- <div className="text-sm">Above separator</div>
785
- <Separator className="my-4" />
786
- <div className="text-sm">Below separator</div>
787
- </div>
788
- </div>
789
-
790
- {/* Sheet */}
791
- <div className="space-y-4">
792
- <h3 className="text-2xl font-semibold">Sheet</h3>
793
- <Sheet>
794
- <SheetTrigger asChild>
795
- <Button variant="outlined">Open Sheet</Button>
796
- </SheetTrigger>
797
- <SheetContent>
798
- <SheetHeader>
799
- <SheetTitle>Edit profile</SheetTitle>
800
- <SheetDescription>
801
- Make changes to your profile here. Click save when
802
- you&apos;re done.
803
- </SheetDescription>
804
- </SheetHeader>
805
- <div className="grid gap-4 py-4">
806
- <div className="grid grid-cols-4 items-center gap-4">
807
- <Label htmlFor="name" className="text-right">
808
- Name
809
- </Label>
810
- <Input
811
- id="name"
812
- defaultValue="Pedro Duarte"
813
- className="col-span-3"
814
- />
815
- </div>
816
- <div className="grid grid-cols-4 items-center gap-4">
817
- <Label htmlFor="username" className="text-right">
818
- Username
819
- </Label>
820
- <Input
821
- id="username"
822
- defaultValue="@peduarte"
823
- className="col-span-3"
824
- />
825
- </div>
826
- </div>
827
- <SheetFooter>
828
- <SheetClose asChild>
829
- <Button type="submit">Save changes</Button>
830
- </SheetClose>
831
- </SheetFooter>
832
- </SheetContent>
833
- </Sheet>
834
- </div>
835
-
836
- {/* Toaster (Sonner) */}
837
- <div className="space-y-4">
838
- <h3 className="text-2xl font-semibold">Toaster (Sonner)</h3>
839
- <div className="flex flex-wrap gap-4">
840
- <Button onClick={() => toast.success('Success toast!')}>
841
- Success Toast
842
- </Button>
843
- <Button onClick={() => toast.error('Error toast!')}>
844
- Error Toast
845
- </Button>
846
- <Button onClick={() => toast('Default toast!')}>
847
- Default Toast
848
- </Button>
849
- <Button onClick={() => toast.info('Info toast!')}>
850
- Info Toast
851
- </Button>
852
- </div>
853
- </div>
854
- </div>
855
- </section>
856
- </div>
857
-
858
- {/* Toaster component for displaying notifications */}
859
- <Toaster />
860
- </div>
861
- )
862
- }
863
-
864
- ReactDOM.createRoot(document.getElementById('root')!).render(
865
- <React.StrictMode>
866
- <App />
867
- </React.StrictMode>
868
- )