@shopify/shop-minis-react 0.3.2 → 0.4.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.
Files changed (205) hide show
  1. package/dist/components/MinisContainer.js +11 -10
  2. package/dist/components/MinisContainer.js.map +1 -1
  3. package/dist/components/atoms/content-wrapper.js.map +1 -1
  4. package/dist/components/atoms/video-player.js +28 -26
  5. package/dist/components/atoms/video-player.js.map +1 -1
  6. package/dist/components/commerce/product-card.js +106 -79
  7. package/dist/components/commerce/product-card.js.map +1 -1
  8. package/dist/components/commerce/product-link.js +124 -137
  9. package/dist/components/commerce/product-link.js.map +1 -1
  10. package/dist/components/commerce/search.js +20 -20
  11. package/dist/components/commerce/search.js.map +1 -1
  12. package/dist/components/ui/sonner.js +3 -1
  13. package/dist/components/ui/sonner.js.map +1 -1
  14. package/dist/hooks/content/useContent.js +12 -18
  15. package/dist/hooks/content/useContent.js.map +1 -1
  16. package/dist/hooks/navigation/useNavigateWithTransition.js +10 -11
  17. package/dist/hooks/navigation/useNavigateWithTransition.js.map +1 -1
  18. package/dist/hooks/product/useCuratedProducts.js +9 -11
  19. package/dist/hooks/product/useCuratedProducts.js.map +1 -1
  20. package/dist/hooks/product/usePopularProducts.js +9 -11
  21. package/dist/hooks/product/usePopularProducts.js.map +1 -1
  22. package/dist/hooks/product/useProduct.js +11 -17
  23. package/dist/hooks/product/useProduct.js.map +1 -1
  24. package/dist/hooks/product/useProductList.js +10 -21
  25. package/dist/hooks/product/useProductList.js.map +1 -1
  26. package/dist/hooks/product/useProductLists.js +11 -13
  27. package/dist/hooks/product/useProductLists.js.map +1 -1
  28. package/dist/hooks/product/useProductMedia.js +12 -18
  29. package/dist/hooks/product/useProductMedia.js.map +1 -1
  30. package/dist/hooks/product/useProductSearch.js +34 -27
  31. package/dist/hooks/product/useProductSearch.js.map +1 -1
  32. package/dist/hooks/product/useProductVariants.js +11 -14
  33. package/dist/hooks/product/useProductVariants.js.map +1 -1
  34. package/dist/hooks/product/useProducts.js +12 -11
  35. package/dist/hooks/product/useProducts.js.map +1 -1
  36. package/dist/hooks/product/useRecommendedProducts.js +11 -13
  37. package/dist/hooks/product/useRecommendedProducts.js.map +1 -1
  38. package/dist/hooks/shop/useRecommendedShops.js +11 -13
  39. package/dist/hooks/shop/useRecommendedShops.js.map +1 -1
  40. package/dist/hooks/shop/useShop.js +12 -11
  41. package/dist/hooks/shop/useShop.js.map +1 -1
  42. package/dist/hooks/user/useBuyerAttributes.js +8 -10
  43. package/dist/hooks/user/useBuyerAttributes.js.map +1 -1
  44. package/dist/hooks/user/useCurrentUser.js +7 -9
  45. package/dist/hooks/user/useCurrentUser.js.map +1 -1
  46. package/dist/hooks/user/useFollowedShops.js +11 -14
  47. package/dist/hooks/user/useFollowedShops.js.map +1 -1
  48. package/dist/hooks/user/useOrders.js +7 -9
  49. package/dist/hooks/user/useOrders.js.map +1 -1
  50. package/dist/hooks/user/useRecentProducts.js +11 -13
  51. package/dist/hooks/user/useRecentProducts.js.map +1 -1
  52. package/dist/hooks/user/useRecentShops.js +10 -13
  53. package/dist/hooks/user/useRecentShops.js.map +1 -1
  54. package/dist/hooks/user/useSavedProducts.js +10 -13
  55. package/dist/hooks/user/useSavedProducts.js.map +1 -1
  56. package/dist/index.js +269 -264
  57. package/dist/index.js.map +1 -1
  58. package/dist/internal/components/product-review-stars.js +78 -0
  59. package/dist/internal/components/product-review-stars.js.map +1 -0
  60. package/dist/internal/reactQuery/MinisQueryProvider.js +11 -0
  61. package/dist/internal/reactQuery/MinisQueryProvider.js.map +1 -0
  62. package/dist/internal/reactQuery/queryClient.js +33 -0
  63. package/dist/internal/reactQuery/queryClient.js.map +1 -0
  64. package/dist/internal/reactQuery/useShopActionInfiniteQuery.js +52 -0
  65. package/dist/internal/reactQuery/useShopActionInfiniteQuery.js.map +1 -0
  66. package/dist/internal/reactQuery/useShopActionQuery.js +37 -0
  67. package/dist/internal/reactQuery/useShopActionQuery.js.map +1 -0
  68. package/dist/mocks.js +178 -107
  69. package/dist/mocks.js.map +1 -1
  70. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/focusManager.js +45 -0
  71. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/focusManager.js.map +1 -0
  72. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.js +89 -0
  73. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.js.map +1 -0
  74. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/infiniteQueryObserver.js +55 -0
  75. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/infiniteQueryObserver.js.map +1 -0
  76. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/mutation.js +198 -0
  77. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/mutation.js.map +1 -0
  78. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/mutationCache.js +99 -0
  79. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/mutationCache.js.map +1 -0
  80. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/notifyManager.js +67 -0
  81. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/notifyManager.js.map +1 -0
  82. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/onlineManager.js +39 -0
  83. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/onlineManager.js.map +1 -0
  84. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/query.js +299 -0
  85. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/query.js.map +1 -0
  86. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/queryCache.js +80 -0
  87. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/queryCache.js.map +1 -0
  88. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/queryClient.js +215 -0
  89. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/queryClient.js.map +1 -0
  90. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/queryObserver.js +300 -0
  91. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/queryObserver.js.map +1 -0
  92. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/removable.js +25 -0
  93. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/removable.js.map +1 -0
  94. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/retryer.js +76 -0
  95. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/retryer.js.map +1 -0
  96. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/subscribable.js +21 -0
  97. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/subscribable.js.map +1 -0
  98. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/thenable.js +26 -0
  99. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/thenable.js.map +1 -0
  100. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/utils.js +176 -0
  101. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/utils.js.map +1 -0
  102. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js +7 -0
  103. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js.map +1 -0
  104. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js +17 -0
  105. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js.map +1 -0
  106. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js +19 -0
  107. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js.map +1 -0
  108. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js +21 -0
  109. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js.map +1 -0
  110. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/suspense.js +18 -0
  111. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/suspense.js.map +1 -0
  112. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js +64 -0
  113. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js.map +1 -0
  114. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/useInfiniteQuery.js +13 -0
  115. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/useInfiniteQuery.js.map +1 -0
  116. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/useQuery.js +9 -0
  117. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/useQuery.js.map +1 -0
  118. package/dist/shop-minis-react/node_modules/.pnpm/lucide-react@0.513.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/star-half.js +21 -0
  119. package/dist/shop-minis-react/node_modules/.pnpm/lucide-react@0.513.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/star-half.js.map +1 -0
  120. package/dist/shop-minis-react/node_modules/.pnpm/sonner@2.0.5_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/sonner/dist/index.js +4 -4
  121. package/dist/shop-minis-react/node_modules/.pnpm/sonner@2.0.5_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/sonner/dist/index.js.map +1 -1
  122. package/package.json +2 -7
  123. package/src/components/MinisContainer.tsx +6 -3
  124. package/src/components/atoms/content-wrapper.tsx +1 -1
  125. package/src/components/atoms/video-player.tsx +7 -0
  126. package/src/components/commerce/product-card.test.tsx +135 -0
  127. package/src/components/commerce/product-card.tsx +39 -5
  128. package/src/components/commerce/product-link.test.tsx +15 -3
  129. package/src/components/commerce/product-link.tsx +9 -25
  130. package/src/components/commerce/search.tsx +2 -2
  131. package/src/components/index.ts +1 -0
  132. package/src/components/ui/sonner.tsx +2 -2
  133. package/src/hooks/content/useContent.ts +6 -17
  134. package/src/hooks/navigation/useNavigateWithTransition.test.ts +46 -7
  135. package/src/hooks/navigation/useNavigateWithTransition.ts +4 -1
  136. package/src/hooks/product/useCuratedProducts.ts +4 -6
  137. package/src/hooks/product/usePopularProducts.ts +4 -6
  138. package/src/hooks/product/useProduct.ts +6 -17
  139. package/src/hooks/product/useProductList.ts +4 -19
  140. package/src/hooks/product/useProductLists.ts +4 -6
  141. package/src/hooks/product/useProductMedia.ts +6 -17
  142. package/src/hooks/product/useProductSearch.ts +19 -15
  143. package/src/hooks/product/useProductVariants.ts +5 -13
  144. package/src/hooks/product/useProducts.ts +8 -12
  145. package/src/hooks/product/useRecommendedProducts.ts +4 -6
  146. package/src/hooks/shop/useRecommendedShops.ts +4 -6
  147. package/src/hooks/shop/useShop.ts +8 -12
  148. package/src/hooks/user/useBuyerAttributes.ts +4 -6
  149. package/src/hooks/user/useCurrentUser.ts +4 -6
  150. package/src/hooks/user/useFollowedShops.ts +5 -13
  151. package/src/hooks/user/useOrders.ts +4 -6
  152. package/src/hooks/user/useRecentProducts.ts +4 -6
  153. package/src/hooks/user/useRecentShops.ts +5 -13
  154. package/src/hooks/user/useSavedProducts.ts +5 -13
  155. package/src/internal/components/product-review-stars.test.tsx +90 -0
  156. package/src/internal/components/product-review-stars.tsx +113 -0
  157. package/src/internal/reactQuery/MinisQueryProvider.test.tsx +38 -0
  158. package/src/internal/reactQuery/MinisQueryProvider.tsx +16 -0
  159. package/src/internal/reactQuery/index.ts +8 -0
  160. package/src/internal/reactQuery/queryClient.test.tsx +91 -0
  161. package/src/internal/reactQuery/queryClient.ts +43 -0
  162. package/src/internal/reactQuery/useShopActionInfiniteQuery.test.tsx +357 -0
  163. package/src/internal/reactQuery/useShopActionInfiniteQuery.ts +129 -0
  164. package/src/internal/reactQuery/useShopActionQuery.test.tsx +184 -0
  165. package/src/internal/reactQuery/useShopActionQuery.ts +74 -0
  166. package/src/mocks.ts +10 -2
  167. package/src/providers/ImagePickerProvider.test.tsx +3 -9
  168. package/dist/internal/useShopActionsDataFetching.js +0 -79
  169. package/dist/internal/useShopActionsDataFetching.js.map +0 -1
  170. package/dist/internal/useShopActionsPaginatedDataFetching.js +0 -96
  171. package/dist/internal/useShopActionsPaginatedDataFetching.js.map +0 -1
  172. package/src/hooks/product/useProductSearch.test.ts +0 -470
  173. package/src/internal/useShopActionsDataFetching.test.ts +0 -465
  174. package/src/internal/useShopActionsDataFetching.ts +0 -150
  175. package/src/internal/useShopActionsPaginatedDataFetching.ts +0 -188
  176. package/src/stories/Accordion.stories.tsx +0 -124
  177. package/src/stories/AddToCart.stories.tsx +0 -251
  178. package/src/stories/Alert.stories.tsx +0 -38
  179. package/src/stories/AlertDialog.stories.tsx +0 -48
  180. package/src/stories/Avatar.stories.tsx +0 -29
  181. package/src/stories/Badge.stories.tsx +0 -46
  182. package/src/stories/Button.stories.tsx +0 -81
  183. package/src/stories/Card.stories.tsx +0 -40
  184. package/src/stories/Checkbox.stories.tsx +0 -44
  185. package/src/stories/FavoriteButton.stories.tsx +0 -58
  186. package/src/stories/IconButton.stories.tsx +0 -68
  187. package/src/stories/ImageContentWrapper.stories.tsx +0 -65
  188. package/src/stories/Input.stories.tsx +0 -44
  189. package/src/stories/Label.stories.tsx +0 -19
  190. package/src/stories/List.stories.tsx +0 -64
  191. package/src/stories/MerchantCard.stories.tsx +0 -127
  192. package/src/stories/ProductCard.stories.tsx +0 -92
  193. package/src/stories/ProductLink.stories.tsx +0 -46
  194. package/src/stories/ProductVariantPrice.stories.tsx +0 -70
  195. package/src/stories/Progress.stories.tsx +0 -30
  196. package/src/stories/PullToRefreshList.stories.tsx +0 -122
  197. package/src/stories/QuantitySelector.stories.tsx +0 -78
  198. package/src/stories/RadioGroup.stories.tsx +0 -51
  199. package/src/stories/Search.stories.tsx +0 -37
  200. package/src/stories/Select.stories.tsx +0 -85
  201. package/src/stories/Skeleton.stories.tsx +0 -19
  202. package/src/stories/TextInput.stories.tsx +0 -26
  203. package/src/stories/Toaster.stories.tsx +0 -46
  204. package/src/stories/Touchable.stories.tsx +0 -40
  205. package/src/stories/VideoPlayer.stories.tsx +0 -129
@@ -1,92 +0,0 @@
1
- import {fn} from 'storybook/test'
2
-
3
- import {ProductCard} from '../components/commerce/product-card'
4
- import {createProduct, injectMocks} from '../mocks'
5
-
6
- import type {Meta, StoryObj} from '@storybook/react-vite'
7
-
8
- const meta = {
9
- title: 'Commerce/ProductCard',
10
- component: ProductCard,
11
- parameters: {
12
- layout: 'padded',
13
- },
14
- args: {onFavoriteToggled: fn()},
15
- argTypes: {
16
- variant: {
17
- control: 'radio',
18
- options: ['default', 'priceOverlay', 'compact'],
19
- },
20
- badgeVariant: {
21
- control: 'radio',
22
- options: ['default', 'secondary', 'destructive', 'outline'],
23
- },
24
- touchable: {
25
- control: 'boolean',
26
- },
27
- },
28
- tags: ['autodocs'],
29
- } satisfies Meta<typeof ProductCard>
30
-
31
- export default meta
32
- type Story = StoryObj<typeof meta>
33
-
34
- injectMocks()
35
-
36
- export const Single: Story = {
37
- decorators: [
38
- Story => (
39
- <div style={{maxWidth: 150}}>
40
- <Story />
41
- </div>
42
- ),
43
- ],
44
- args: {
45
- product: {
46
- id: '1',
47
- title: 'Teapot',
48
-
49
- price: {
50
- amount: '100',
51
- currencyCode: 'USD',
52
- },
53
-
54
- compareAtPrice: {
55
- amount: '120',
56
- currencyCode: 'USD',
57
- },
58
-
59
- reviewAnalytics: {
60
- averageRating: 4.5,
61
- reviewCount: 10,
62
- },
63
- shop: {
64
- id: 'shop1',
65
- name: 'Mock Shop',
66
- },
67
- defaultVariantId: 'variant-1',
68
- isFavorited: true,
69
-
70
- featuredImage: {
71
- url: 'https://cdn.shopify.com/static/sample-images/teapot.jpg',
72
- altText: 'Teapot',
73
- },
74
- },
75
- },
76
- }
77
-
78
- export const Grid: Story = {
79
- decorators: [
80
- Story => (
81
- <div className="grid grid-cols-2 gap-4">
82
- <Story />
83
- <Story />
84
- <Story />
85
- <Story />
86
- </div>
87
- ),
88
- ],
89
- args: {
90
- product: createProduct('1', 'Teapot', '100', '120'),
91
- },
92
- }
@@ -1,46 +0,0 @@
1
- import {ProductLink} from '../components/commerce/product-link'
2
- import {createProduct, injectMocks} from '../mocks'
3
-
4
- import type {Meta, StoryObj} from '@storybook/react-vite'
5
-
6
- const meta = {
7
- title: 'Commerce/ProductLink',
8
- component: ProductLink,
9
- parameters: {
10
- layout: 'padded',
11
- },
12
- args: {},
13
- tags: ['autodocs'],
14
- } satisfies Meta<typeof ProductLink>
15
-
16
- export default meta
17
- type Story = StoryObj<typeof meta>
18
-
19
- injectMocks()
20
-
21
- export const Default: Story = {
22
- args: {
23
- product: createProduct('1', 'Teapot', '100', '120'),
24
- },
25
- }
26
-
27
- export const WithDiscount: Story = {
28
- args: {
29
- product: createProduct('2', 'Discounted Teapot', '80', '120'),
30
- },
31
- }
32
-
33
- export const List: Story = {
34
- decorators: [
35
- Story => (
36
- <div className="grid grid-cols-1 gap-4 max-w-md">
37
- <Story />
38
- <Story />
39
- <Story />
40
- </div>
41
- ),
42
- ],
43
- args: {
44
- product: createProduct('1', 'Teapot', '100', '120'),
45
- },
46
- }
@@ -1,70 +0,0 @@
1
- import {ProductVariantPrice} from '../components/atoms/product-variant-price'
2
-
3
- import type {Meta, StoryObj} from '@storybook/react-vite'
4
-
5
- type ProductVariantPriceProps = React.ComponentProps<typeof ProductVariantPrice>
6
-
7
- const meta = {
8
- title: 'Atoms/ProductVariantPrice',
9
- component: ProductVariantPrice,
10
- parameters: {
11
- layout: 'padded',
12
- },
13
- argTypes: {
14
- amount: {
15
- control: 'text',
16
- },
17
- currencyCode: {
18
- control: 'select',
19
- options: ['USD', 'CAD', 'EUR', 'GBP', 'JPY'],
20
- },
21
- compareAtPriceAmount: {
22
- control: 'text',
23
- },
24
- compareAtPriceCurrencyCode: {
25
- control: 'select',
26
- options: ['USD', 'CAD', 'EUR', 'GBP', 'JPY'],
27
- },
28
- className: {
29
- control: 'text',
30
- },
31
- currentPriceClassName: {
32
- control: 'text',
33
- },
34
- originalPriceClassName: {
35
- control: 'text',
36
- },
37
- },
38
- tags: ['autodocs'],
39
- } satisfies Meta<ProductVariantPriceProps>
40
-
41
- export default meta
42
- type Story = StoryObj<typeof meta>
43
-
44
- export const Default: Story = {
45
- args: {
46
- amount: '29.99',
47
- currencyCode: 'USD',
48
- },
49
- }
50
-
51
- export const WithDiscount: Story = {
52
- name: 'With Discount',
53
- args: {
54
- amount: '24.99',
55
- currencyCode: 'USD',
56
- compareAtPriceAmount: '39.99',
57
- },
58
- }
59
-
60
- export const CustomStyling: Story = {
61
- name: 'Custom Styling',
62
- args: {
63
- amount: '89.99',
64
- currencyCode: 'USD',
65
- compareAtPriceAmount: '119.99',
66
- currentPriceClassName: 'text-2xl font-bold text-green-600',
67
- originalPriceClassName: 'text-lg text-red-500 line-through',
68
- className: 'gap-3 p-4 bg-gray-50 rounded-lg',
69
- },
70
- }
@@ -1,30 +0,0 @@
1
- import {Progress} from '../components/ui/progress'
2
-
3
- import type {Meta, StoryObj} from '@storybook/react-vite'
4
-
5
- const meta = {
6
- title: 'UI/Progress',
7
- component: Progress,
8
- parameters: {},
9
- tags: ['autodocs'],
10
- argTypes: {
11
- value: {
12
- control: {type: 'range', min: 0, max: 100, step: 1},
13
- },
14
- },
15
- } satisfies Meta<typeof Progress>
16
-
17
- export default meta
18
- type Story = StoryObj<typeof meta>
19
-
20
- export const FiftyPercent: Story = {
21
- args: {
22
- value: 50,
23
- },
24
- }
25
-
26
- export const OneHundredPercent: Story = {
27
- args: {
28
- value: 100,
29
- },
30
- }
@@ -1,122 +0,0 @@
1
- import {useState, useCallback} from 'react'
2
-
3
- import {fn} from 'storybook/test'
4
-
5
- import {List} from '../components/atoms/list'
6
- import {ProductCard} from '../components/commerce/product-card'
7
- import {ProductLink} from '../components/commerce/product-link'
8
- import {createProduct, injectMocks} from '../mocks'
9
-
10
- import type {Product} from '@shopify/shop-minis-platform'
11
- import type {Meta, StoryObj} from '@storybook/react-vite'
12
-
13
- const meta = {
14
- title: 'Atoms/PullToRefreshList',
15
- component: List as any,
16
- parameters: {
17
- layout: 'padded',
18
- },
19
- argTypes: {
20
- height: {
21
- control: 'number',
22
- description: 'Height of the virtualized list container',
23
- },
24
- enablePullToRefresh: {
25
- control: 'boolean',
26
- description: 'Enable pull-to-refresh functionality',
27
- defaultValue: true,
28
- },
29
- },
30
- tags: ['autodocs'],
31
- } satisfies Meta<typeof List>
32
-
33
- export default meta
34
- type Story = StoryObj<typeof meta>
35
-
36
- injectMocks()
37
-
38
- const createProductList = (count: number) => {
39
- return Array.from({length: count}, (_, index) =>
40
- createProduct(`product-${index + 1}`, `Product ${index + 1}`, '9.99')
41
- )
42
- }
43
-
44
- const PullToRefreshListWrapper = ({
45
- initialItems,
46
- renderItem,
47
- ...props
48
- }: any) => {
49
- const [items, setItems] = useState(initialItems)
50
- const [refreshing, setRefreshing] = useState(false)
51
-
52
- const handleRefresh = useCallback(async () => {
53
- setRefreshing(true)
54
-
55
- await new Promise(resolve => setTimeout(resolve, 2000))
56
-
57
- const newItems = Array.from({length: 5}, (_, index) =>
58
- createProduct(
59
- `fresh-${Date.now()}-${index}`,
60
- `Fresh Product ${index + 1}`,
61
- '12.99'
62
- )
63
- )
64
-
65
- setItems([...newItems, ...initialItems])
66
- setRefreshing(false)
67
- }, [initialItems])
68
-
69
- return (
70
- <List
71
- {...props}
72
- items={items}
73
- renderItem={renderItem}
74
- onRefresh={handleRefresh}
75
- refreshing={refreshing}
76
- enablePullToRefresh
77
- />
78
- )
79
- }
80
-
81
- const ProductLinkWithRefreshComponent = (args: any) => (
82
- <PullToRefreshListWrapper
83
- {...args}
84
- initialItems={createProductList(20)}
85
- renderItem={(product: Product) => (
86
- <div className="p-4">
87
- <ProductLink product={product} />
88
- </div>
89
- )}
90
- />
91
- )
92
-
93
- export const ProductLinkWithRefresh: Story = {
94
- render: ProductLinkWithRefreshComponent,
95
- args: {
96
- height: 600,
97
- itemSizeForRow: () => 100,
98
- showScrollbar: true,
99
- },
100
- }
101
-
102
- const ProductGridWithRefreshComponent = (args: any) => (
103
- <PullToRefreshListWrapper
104
- {...args}
105
- initialItems={createProductList(15)}
106
- renderItem={(product: Product) => (
107
- <div className="grid grid-cols-2 gap-4">
108
- <ProductCard product={product} onFavoriteToggled={fn()} />
109
- <ProductCard product={product} onFavoriteToggled={fn()} />
110
- </div>
111
- )}
112
- />
113
- )
114
-
115
- export const ProductGridWithRefresh: Story = {
116
- render: ProductGridWithRefreshComponent,
117
- args: {
118
- height: 600,
119
- itemSizeForRow: () => 220,
120
- showScrollbar: true,
121
- },
122
- }
@@ -1,78 +0,0 @@
1
- import {fn} from 'storybook/test'
2
-
3
- import {QuantitySelector} from '../components/commerce/quantity-selector'
4
-
5
- import type {Meta, StoryObj} from '@storybook/react-vite'
6
-
7
- type QuantitySelectorProps = React.ComponentProps<typeof QuantitySelector>
8
-
9
- const meta: Meta<QuantitySelectorProps> = {
10
- title: 'Commerce/QuantitySelector',
11
- component: QuantitySelector,
12
- parameters: {},
13
- tags: ['autodocs'],
14
- argTypes: {
15
- quantity: {
16
- control: 'number',
17
- description: 'Current quantity value',
18
- },
19
- onQuantityChange: {
20
- action: 'quantity changed',
21
- description: 'Callback fired when quantity changes',
22
- },
23
- maxQuantity: {
24
- control: 'number',
25
- description: 'Maximum allowed quantity',
26
- },
27
- minQuantity: {
28
- control: 'number',
29
- description: 'Minimum allowed quantity',
30
- },
31
- disabled: {
32
- control: 'boolean',
33
- description: 'Whether the selector is disabled',
34
- },
35
- },
36
- args: {
37
- onQuantityChange: fn(),
38
- },
39
- } satisfies Meta<QuantitySelectorProps>
40
-
41
- export default meta
42
- type Story = StoryObj<typeof meta>
43
-
44
- export const Default: Story = {
45
- args: {
46
- quantity: 2,
47
- maxQuantity: 10,
48
- minQuantity: 1,
49
- disabled: false,
50
- },
51
- }
52
-
53
- export const AtMinimum: Story = {
54
- args: {
55
- quantity: 1,
56
- maxQuantity: 10,
57
- minQuantity: 1,
58
- disabled: false,
59
- },
60
- }
61
-
62
- export const AtMaximum: Story = {
63
- args: {
64
- quantity: 10,
65
- maxQuantity: 10,
66
- minQuantity: 1,
67
- disabled: false,
68
- },
69
- }
70
-
71
- export const Disabled: Story = {
72
- args: {
73
- quantity: 3,
74
- maxQuantity: 10,
75
- minQuantity: 1,
76
- disabled: true,
77
- },
78
- }
@@ -1,51 +0,0 @@
1
- import {Label} from '../components/ui/label'
2
- import {RadioGroup, RadioGroupItem} from '../components/ui/radio-group'
3
-
4
- import type {Meta, StoryObj} from '@storybook/react-vite'
5
-
6
- const meta = {
7
- title: 'UI/RadioGroup',
8
- component: RadioGroup,
9
- parameters: {},
10
- args: {
11
- defaultValue: 'option-1',
12
- disabled: false,
13
- },
14
- tags: ['autodocs'],
15
- } satisfies Meta<typeof RadioGroup>
16
-
17
- export default meta
18
- type Story = StoryObj<typeof meta>
19
-
20
- export const Default: Story = {
21
- render: () => (
22
- <RadioGroup defaultValue="option-1">
23
- <div className="flex items-center space-x-2">
24
- <RadioGroupItem value="option-1" id="option-1" />
25
- <Label>Option 1</Label>
26
- </div>
27
- <div className="flex items-center space-x-2">
28
- <RadioGroupItem value="option-2" id="option-2" />
29
- <Label>Option 2</Label>
30
- </div>
31
- </RadioGroup>
32
- ),
33
- }
34
-
35
- export const Disabled: Story = {
36
- args: {
37
- disabled: true,
38
- },
39
- render: ({disabled}) => (
40
- <RadioGroup defaultValue="option-1" disabled={disabled}>
41
- <div className="flex items-center space-x-2">
42
- <RadioGroupItem value="option-1" id="disabled-option-1" />
43
- <Label>Option 1</Label>
44
- </div>
45
- <div className="flex items-center space-x-2">
46
- <RadioGroupItem value="option-2" id="disabled-option-2" />
47
- <Label>Option 2</Label>
48
- </div>
49
- </RadioGroup>
50
- ),
51
- }
@@ -1,37 +0,0 @@
1
- import {fn} from 'storybook/test'
2
-
3
- import {
4
- Search,
5
- SearchInput,
6
- SearchProvider,
7
- SearchResultsList,
8
- } from '../components'
9
-
10
- import type {Meta, StoryObj} from '@storybook/react-vite'
11
-
12
- const meta = {
13
- title: 'Commerce/Search',
14
- component: Search,
15
- parameters: {
16
- layout: 'padded',
17
- },
18
- tags: ['autodocs'],
19
- } satisfies Meta<typeof Search>
20
-
21
- export default meta
22
- type Story = StoryObj<typeof meta>
23
-
24
- export const Default: Story = {
25
- args: {
26
- onProductClick: fn(),
27
- },
28
- }
29
-
30
- export const Composite: Story = {
31
- render: args => (
32
- <SearchProvider {...args}>
33
- <SearchInput placeholder="Search..." />
34
- <SearchResultsList />
35
- </SearchProvider>
36
- ),
37
- }
@@ -1,85 +0,0 @@
1
- import {
2
- Select,
3
- SelectContent,
4
- SelectGroup,
5
- SelectItem,
6
- SelectLabel,
7
- SelectTrigger,
8
- SelectValue,
9
- } from '../components/ui/select'
10
-
11
- import type {Meta, StoryObj} from '@storybook/react-vite'
12
-
13
- const meta = {
14
- title: 'UI/Select',
15
- component: Select,
16
- parameters: {},
17
- tags: ['autodocs'],
18
- } satisfies Meta<typeof Select>
19
-
20
- export default meta
21
- type Story = StoryObj<typeof meta>
22
-
23
- export const Default: Story = {
24
- args: {
25
- defaultValue: 'option-1',
26
- disabled: false,
27
- },
28
- render: args => (
29
- <Select {...args}>
30
- <SelectTrigger>
31
- <SelectValue placeholder="Select an option" />
32
- </SelectTrigger>
33
- <SelectContent>
34
- <SelectItem value="option-1">Option 1</SelectItem>
35
- <SelectItem value="option-2">Option 2</SelectItem>
36
- <SelectItem value="option-3">Option 3</SelectItem>
37
- </SelectContent>
38
- </Select>
39
- ),
40
- }
41
-
42
- export const WithGroups: Story = {
43
- args: {
44
- defaultValue: 'option-1',
45
- disabled: false,
46
- },
47
- render: args => (
48
- <Select {...args}>
49
- <SelectTrigger>
50
- <SelectValue placeholder="Select an option" />
51
- </SelectTrigger>
52
- <SelectContent>
53
- <SelectGroup>
54
- <SelectLabel>Group 1</SelectLabel>
55
- <SelectItem value="option-1">Option 1</SelectItem>
56
- <SelectItem value="option-2">Option 2</SelectItem>
57
- </SelectGroup>
58
- <SelectGroup>
59
- <SelectLabel>Group 2</SelectLabel>
60
- <SelectItem value="option-3">Option 3</SelectItem>
61
- <SelectItem value="option-4">Option 4</SelectItem>
62
- </SelectGroup>
63
- </SelectContent>
64
- </Select>
65
- ),
66
- }
67
-
68
- export const Disabled: Story = {
69
- args: {
70
- defaultValue: 'option-1',
71
- disabled: true,
72
- },
73
- render: args => (
74
- <Select {...args}>
75
- <SelectTrigger>
76
- <SelectValue placeholder="Select an option" />
77
- </SelectTrigger>
78
- <SelectContent>
79
- <SelectItem value="option-1">Option 1</SelectItem>
80
- <SelectItem value="option-2">Option 2</SelectItem>
81
- <SelectItem value="option-3">Option 3</SelectItem>
82
- </SelectContent>
83
- </Select>
84
- ),
85
- }
@@ -1,19 +0,0 @@
1
- import {Skeleton} from '../components/ui/skeleton'
2
-
3
- import type {Meta, StoryObj} from '@storybook/react-vite'
4
-
5
- const meta = {
6
- title: 'UI/Skeleton',
7
- component: Skeleton,
8
- parameters: {},
9
- tags: ['autodocs'],
10
- } satisfies Meta<typeof Skeleton>
11
-
12
- export default meta
13
- type Story = StoryObj<typeof meta>
14
-
15
- export const Default: Story = {
16
- args: {
17
- className: 'h-4 w-20',
18
- },
19
- }
@@ -1,26 +0,0 @@
1
- import {fn} from 'storybook/test'
2
-
3
- import {TextInput} from '../components'
4
-
5
- import type {Meta, StoryObj} from '@storybook/react-vite'
6
-
7
- const meta = {
8
- title: 'Atoms/TextInput',
9
- component: TextInput,
10
- parameters: {
11
- layout: 'padded',
12
- },
13
- tags: ['autodocs'],
14
- } satisfies Meta<typeof TextInput>
15
-
16
- export default meta
17
- type Story = StoryObj<typeof meta>
18
-
19
- export const Default: Story = {
20
- args: {
21
- placeholder: 'Search...',
22
- onFocus: fn(),
23
- onBlur: fn(),
24
- onChange: fn(),
25
- },
26
- }
@@ -1,46 +0,0 @@
1
- import {toast} from 'sonner'
2
-
3
- import {Button} from '../components/atoms/button'
4
- import {Toaster} from '../components/ui/sonner'
5
-
6
- import type {Meta, StoryObj} from '@storybook/react-vite'
7
-
8
- const meta = {
9
- title: 'Ui/Toaster',
10
- component: Toaster,
11
- decorators: [
12
- Story => (
13
- <>
14
- <Story />
15
- <Toaster />
16
- </>
17
- ),
18
- ],
19
- tags: ['autodocs'],
20
- parameters: {},
21
- args: {},
22
- } satisfies Meta
23
-
24
- export default meta
25
- type Story = StoryObj<typeof meta>
26
-
27
- export const SuccessToast: Story = {
28
- decorators: [
29
- () => (
30
- <Button onClick={() => toast.success('Success toast!')}>
31
- Show success Toast
32
- </Button>
33
- ),
34
- ],
35
- args: {},
36
- }
37
-
38
- export const ErrorToast: Story = {
39
- decorators: [
40
- () => (
41
- <Button onClick={() => toast.error('Error toast!')}>
42
- Show error Toast
43
- </Button>
44
- ),
45
- ],
46
- }