@shopify/shop-minis-react 0.0.19 → 0.0.20

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 (44) hide show
  1. package/dist/components/MinisContainer.js +13 -11
  2. package/dist/components/MinisContainer.js.map +1 -1
  3. package/dist/components/atoms/list.js +52 -0
  4. package/dist/components/atoms/list.js.map +1 -0
  5. package/dist/components/atoms/pagination.js +10 -0
  6. package/dist/components/atoms/pagination.js.map +1 -0
  7. package/dist/components/atoms/tracking-pixel.js +32 -0
  8. package/dist/components/atoms/tracking-pixel.js.map +1 -0
  9. package/dist/index.js +187 -185
  10. package/dist/index.js.map +1 -1
  11. package/dist/internal/useShopActions.js.map +1 -1
  12. package/dist/internal/useShopActionsDataFetching.js +26 -26
  13. package/dist/internal/useShopActionsDataFetching.js.map +1 -1
  14. package/dist/internal/useShopActionsPaginatedDataFetching.js.map +1 -1
  15. package/dist/mocks.js +267 -0
  16. package/dist/mocks.js.map +1 -0
  17. package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +8 -0
  18. package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js.map +1 -0
  19. package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/extends.js +13 -0
  20. package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/extends.js.map +1 -0
  21. package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +8 -0
  22. package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js.map +1 -0
  23. package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +9 -0
  24. package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js.map +1 -0
  25. package/dist/shop-minis-react/node_modules/.pnpm/memoize-one@5.2.1/node_modules/memoize-one/dist/memoize-one.esm.js +28 -0
  26. package/dist/shop-minis-react/node_modules/.pnpm/memoize-one@5.2.1/node_modules/memoize-one/dist/memoize-one.esm.js.map +1 -0
  27. package/dist/shop-minis-react/node_modules/.pnpm/react-intersection-observer@9.16.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/react-intersection-observer/dist/index.js +135 -0
  28. package/dist/shop-minis-react/node_modules/.pnpm/react-intersection-observer@9.16.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/react-intersection-observer/dist/index.js.map +1 -0
  29. package/dist/shop-minis-react/node_modules/.pnpm/react-window@1.8.11_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/react-window/dist/index.esm.js +375 -0
  30. package/dist/shop-minis-react/node_modules/.pnpm/react-window@1.8.11_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/react-window/dist/index.esm.js.map +1 -0
  31. package/dist/shop-minis-react.css +1 -0
  32. package/package.json +9 -4
  33. package/src/components/MinisContainer.tsx +4 -1
  34. package/src/components/atoms/list.tsx +101 -0
  35. package/src/components/atoms/pagination.tsx +19 -0
  36. package/src/components/atoms/tracking-pixel.tsx +40 -0
  37. package/src/components/index.ts +1 -0
  38. package/src/index.css +1 -0
  39. package/src/internal/useShopActions.ts +1 -1
  40. package/src/internal/useShopActionsDataFetching.ts +6 -7
  41. package/src/internal/useShopActionsPaginatedDataFetching.ts +3 -6
  42. package/src/mocks.ts +20 -8
  43. package/src/stories/List.stories.tsx +68 -0
  44. package/src/styles/utilities.css +22 -0
@@ -0,0 +1,68 @@
1
+ import {fn} from 'storybook/test'
2
+
3
+ import {List} from '../components/atoms/list'
4
+ import {ProductCard} from '../components/commerce/product-card'
5
+ import {ProductLink} from '../components/commerce/product-link'
6
+ import {createProduct, injectMocks} from '../mocks'
7
+
8
+ import type {Product} from '@shopify/shop-minis-platform'
9
+ import type {Meta, StoryObj} from '@storybook/react-vite'
10
+
11
+ const meta = {
12
+ title: 'Atoms/List',
13
+ component: List as any,
14
+ parameters: {
15
+ layout: 'padded',
16
+ },
17
+ argTypes: {
18
+ height: {
19
+ control: 'number',
20
+ description: 'Height of the virtualized list container',
21
+ },
22
+ itemSizeForRow: {
23
+ control: 'number',
24
+ description: 'Height of each item in the list',
25
+ },
26
+ },
27
+ tags: ['autodocs'],
28
+ } satisfies Meta<typeof List>
29
+
30
+ export default meta
31
+ type Story = StoryObj<typeof meta>
32
+
33
+ injectMocks()
34
+
35
+ const createProductList = (count: number) => {
36
+ return Array.from({length: count}, (_, index) =>
37
+ createProduct(`product-${index + 1}`, `Product ${index + 1}`, '9.99')
38
+ )
39
+ }
40
+
41
+ export const ProductLinkList: Story = {
42
+ args: {
43
+ items: createProductList(50),
44
+ height: 600,
45
+ itemSizeForRow: () => 100,
46
+ showScrollbar: true,
47
+ renderItem: (product: Product) => (
48
+ <div className="p-4">
49
+ <ProductLink product={product} />
50
+ </div>
51
+ ),
52
+ },
53
+ }
54
+
55
+ export const ProductGridList: Story = {
56
+ args: {
57
+ items: createProductList(20),
58
+ height: 600,
59
+ itemSizeForRow: () => 220,
60
+ showScrollbar: true,
61
+ renderItem: (product: Product) => (
62
+ <div className="grid grid-cols-2 gap-4">
63
+ <ProductCard product={product} onFavoriteToggled={fn()} />
64
+ <ProductCard product={product} onFavoriteToggled={fn()} />
65
+ </div>
66
+ ),
67
+ },
68
+ }
@@ -0,0 +1,22 @@
1
+ /* Scrollbar utilities */
2
+
3
+ .no-scrollbars {
4
+ scrollbar-width: thin;
5
+ scrollbar-color: transparent transparent;
6
+
7
+ &::-webkit-scrollbar {
8
+ width: 1px;
9
+ }
10
+
11
+ &::-webkit-scrollbar-track {
12
+ background: transparent;
13
+ }
14
+
15
+ &::-webkit-scrollbar-thumb {
16
+ background-color: transparent;
17
+ }
18
+ }
19
+
20
+ .no-scrollbars::-webkit-scrollbar {
21
+ display: none; /* Safari and Chrome */
22
+ }