@shopify/shop-minis-react 0.0.19 → 0.0.21
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/MinisContainer.js +13 -11
- package/dist/components/MinisContainer.js.map +1 -1
- package/dist/components/atoms/list.js +52 -0
- package/dist/components/atoms/list.js.map +1 -0
- package/dist/components/atoms/pagination.js +10 -0
- package/dist/components/atoms/pagination.js.map +1 -0
- package/dist/components/atoms/tracking-pixel.js +32 -0
- package/dist/components/atoms/tracking-pixel.js.map +1 -0
- package/dist/hooks/storage/useImageUpload.js.map +1 -1
- package/dist/hooks/util/useErrorScreen.js.map +1 -1
- package/dist/hooks/util/useErrorToast.js.map +1 -1
- package/dist/index.js +194 -189
- package/dist/index.js.map +1 -1
- package/dist/internal/useShopActions.js.map +1 -1
- package/dist/internal/useShopActionsDataFetching.js +26 -26
- package/dist/internal/useShopActionsDataFetching.js.map +1 -1
- package/dist/internal/useShopActionsPaginatedDataFetching.js.map +1 -1
- package/dist/mocks.js +267 -0
- package/dist/mocks.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +8 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/extends.js +13 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/extends.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +8 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +9 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@babel_runtime@7.27.6/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/memoize-one@5.2.1/node_modules/memoize-one/dist/memoize-one.esm.js +28 -0
- 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
- 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
- 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
- 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
- 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
- package/dist/shop-minis-react.css +1 -0
- package/package.json +9 -4
- package/src/components/MinisContainer.tsx +4 -1
- package/src/components/atoms/list.tsx +101 -0
- package/src/components/atoms/pagination.tsx +19 -0
- package/src/components/atoms/tracking-pixel.tsx +40 -0
- package/src/components/index.ts +2 -0
- package/src/hooks/navigation/useCloseMini.example.tsx +1 -1
- package/src/hooks/navigation/useShopNavigation.example.tsx +12 -9
- package/src/hooks/product/useProductListActions.example.tsx +19 -16
- package/src/hooks/shop/useShopCartActions.example.tsx +2 -2
- package/src/hooks/storage/useImageUpload.example.tsx +1 -1
- package/src/hooks/storage/useImageUpload.ts +3 -2
- package/src/hooks/user/useFollowedShopsActions.example.tsx +6 -8
- package/src/hooks/user/useSavedProductsActions.example.tsx +8 -6
- package/src/hooks/util/useErrorScreen.example.tsx +1 -2
- package/src/hooks/util/useErrorScreen.ts +2 -1
- package/src/hooks/util/useErrorToast.example.tsx +1 -1
- package/src/hooks/util/useErrorToast.ts +2 -1
- package/src/hooks/util/useImagePicker.example.tsx +4 -12
- package/src/index.css +1 -0
- package/src/internal/useShopActions.ts +1 -1
- package/src/internal/useShopActionsDataFetching.ts +6 -7
- package/src/internal/useShopActionsPaginatedDataFetching.ts +3 -6
- package/src/mocks.ts +20 -8
- package/src/stories/List.stories.tsx +68 -0
- 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
|
+
}
|