@shopify/shop-minis-react 0.0.18 → 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.
- package/dist/_virtual/index2.js +2 -3
- package/dist/_virtual/index2.js.map +1 -1
- package/dist/_virtual/index3.js +3 -2
- package/dist/_virtual/index3.js.map +1 -1
- package/dist/components/MinisContainer.js +13 -11
- package/dist/components/MinisContainer.js.map +1 -1
- package/dist/components/atoms/alert-dialog.js +41 -0
- package/dist/components/atoms/alert-dialog.js.map +1 -0
- 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/thumbhash-image.js +54 -0
- package/dist/components/atoms/thumbhash-image.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/components/commerce/merchant-card-skeleton.js +29 -0
- package/dist/components/commerce/merchant-card-skeleton.js.map +1 -0
- package/dist/components/commerce/merchant-card.js +28 -22
- package/dist/components/commerce/merchant-card.js.map +1 -1
- package/dist/components/commerce/product-card-skeleton.js +20 -0
- package/dist/components/commerce/product-card-skeleton.js.map +1 -0
- package/dist/components/commerce/product-card.js +105 -78
- package/dist/components/commerce/product-card.js.map +1 -1
- package/dist/components/navigation/transition-container.js +8 -0
- package/dist/components/navigation/transition-container.js.map +1 -0
- package/dist/components/navigation/transition-link.js +27 -0
- package/dist/components/navigation/transition-link.js.map +1 -0
- package/dist/components/ui/skeleton.js +16 -0
- package/dist/components/ui/skeleton.js.map +1 -0
- package/dist/hooks/navigation/useNavigateWithTransition.js +43 -0
- package/dist/hooks/navigation/useNavigateWithTransition.js.map +1 -0
- package/dist/hooks/navigation/useViewTransitions.js +45 -0
- package/dist/hooks/navigation/useViewTransitions.js.map +1 -0
- package/dist/index.js +217 -196
- 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/@radix-ui_react-use-is-hydrated@0.1.0_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/js-base64@3.7.7/node_modules/js-base64/base64.js +21 -0
- package/dist/shop-minis-react/node_modules/.pnpm/js-base64@3.7.7/node_modules/js-base64/base64.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/querystringify@2.2.0/node_modules/querystringify/index.js +1 -1
- 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-router@7.7.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/react-router/dist/development/chunk-EF7DTUVF.js +1298 -0
- package/dist/shop-minis-react/node_modules/.pnpm/react-router@7.7.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/react-router/dist/development/chunk-EF7DTUVF.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/node_modules/.pnpm/thumbhash@0.1.1/node_modules/thumbhash/thumbhash.js +145 -0
- package/dist/shop-minis-react/node_modules/.pnpm/thumbhash@0.1.1/node_modules/thumbhash/thumbhash.js.map +1 -0
- package/dist/shop-minis-react.css +1 -0
- package/dist/types/index.js +10 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/image.js +15 -0
- package/dist/utils/image.js.map +1 -0
- package/package.json +18 -3
- package/src/components/MinisContainer.tsx +4 -1
- package/src/components/atoms/alert-dialog.tsx +67 -0
- package/src/components/atoms/list.tsx +101 -0
- package/src/components/atoms/pagination.tsx +19 -0
- package/src/components/atoms/thumbhash-image.tsx +66 -0
- package/src/components/atoms/tracking-pixel.tsx +40 -0
- package/src/components/commerce/merchant-card-skeleton.tsx +31 -0
- package/src/components/commerce/merchant-card.tsx +5 -2
- package/src/components/commerce/product-card-skeleton.tsx +30 -0
- package/src/components/commerce/product-card.tsx +49 -8
- package/src/components/index.ts +9 -0
- package/src/components/navigation/transition-container.tsx +7 -0
- package/src/components/navigation/transition-link.tsx +48 -0
- package/src/components/ui/skeleton.tsx +13 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/navigation/useNavigateWithTransition.ts +62 -0
- package/src/hooks/navigation/useViewTransitions.ts +79 -0
- package/src/index.css +2 -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 +27 -9
- package/src/stories/Accordion.stories.tsx +124 -0
- package/src/stories/Alert.stories.tsx +38 -0
- package/src/stories/AlertDialog.stories.tsx +48 -0
- package/src/stories/Avatar.stories.tsx +29 -0
- package/src/stories/Badge.stories.tsx +46 -0
- package/src/stories/Button.stories.tsx +81 -0
- package/src/stories/Card.stories.tsx +40 -0
- package/src/stories/Checkbox.stories.tsx +44 -0
- package/src/stories/FavoriteButton.stories.tsx +58 -0
- package/src/stories/IconButton.stories.tsx +68 -0
- package/src/stories/Input.stories.tsx +44 -0
- package/src/stories/Label.stories.tsx +19 -0
- package/src/stories/List.stories.tsx +68 -0
- package/src/stories/MerchantCard.stories.tsx +55 -0
- package/src/stories/ProductCard.stories.tsx +85 -0
- package/src/stories/ProductLink.stories.tsx +46 -0
- package/src/stories/Progress.stories.tsx +30 -0
- package/src/stories/RadioGroup.stories.tsx +51 -0
- package/src/stories/Select.stories.tsx +85 -0
- package/src/stories/Skeleton.stories.tsx +19 -0
- package/src/stories/Toaster.stories.tsx +46 -0
- package/src/stories/Touchable.stories.tsx +40 -0
- package/src/styles/animations.css +90 -0
- package/src/styles/globals.css +8 -0
- package/src/styles/theme.css +1 -1
- package/src/styles/utilities.css +22 -0
- package/src/types/index.ts +7 -1
- package/src/utils/image.ts +18 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {fn} from 'storybook/test'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
AlertDialog,
|
|
5
|
+
AlertDialogAction,
|
|
6
|
+
AlertDialogCancel,
|
|
7
|
+
AlertDialogContent,
|
|
8
|
+
AlertDialogDescription,
|
|
9
|
+
AlertDialogFooter,
|
|
10
|
+
AlertDialogHeader,
|
|
11
|
+
AlertDialogTitle,
|
|
12
|
+
AlertDialogTrigger,
|
|
13
|
+
Button,
|
|
14
|
+
} from '../components'
|
|
15
|
+
|
|
16
|
+
import type {Meta, StoryObj} from '@storybook/react-vite'
|
|
17
|
+
|
|
18
|
+
const meta = {
|
|
19
|
+
title: 'Ui/AlertDialog',
|
|
20
|
+
render: () => (
|
|
21
|
+
<AlertDialog>
|
|
22
|
+
<AlertDialogTrigger asChild>
|
|
23
|
+
<Button variant="outline">Open Alert Dialog</Button>
|
|
24
|
+
</AlertDialogTrigger>
|
|
25
|
+
<AlertDialogContent>
|
|
26
|
+
<AlertDialogHeader>
|
|
27
|
+
<AlertDialogTitle>Are you sure?</AlertDialogTitle>
|
|
28
|
+
<AlertDialogDescription>
|
|
29
|
+
This action cannot be undone.
|
|
30
|
+
</AlertDialogDescription>
|
|
31
|
+
</AlertDialogHeader>
|
|
32
|
+
<AlertDialogFooter>
|
|
33
|
+
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
|
34
|
+
<AlertDialogAction onClick={() => fn()}>Continue</AlertDialogAction>
|
|
35
|
+
</AlertDialogFooter>
|
|
36
|
+
</AlertDialogContent>
|
|
37
|
+
</AlertDialog>
|
|
38
|
+
),
|
|
39
|
+
parameters: {},
|
|
40
|
+
tags: ['autodocs'],
|
|
41
|
+
argTypes: {},
|
|
42
|
+
args: {},
|
|
43
|
+
} satisfies Meta<typeof AlertDialog>
|
|
44
|
+
|
|
45
|
+
export default meta
|
|
46
|
+
type Story = StoryObj<typeof meta>
|
|
47
|
+
|
|
48
|
+
export const Default: Story = {}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {Avatar, AvatarFallback, AvatarImage} from '../components/ui/avatar'
|
|
2
|
+
|
|
3
|
+
import type {StoryObj} from '@storybook/react-vite'
|
|
4
|
+
|
|
5
|
+
interface AvatarProps {
|
|
6
|
+
src: 'https://github.com/shadcn.png'
|
|
7
|
+
userInitials: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const meta = {
|
|
11
|
+
title: 'UI/Avatar',
|
|
12
|
+
render: ({userInitials}: AvatarProps) => (
|
|
13
|
+
<Avatar>
|
|
14
|
+
<AvatarImage src="https://github.com/shadcn.png" />
|
|
15
|
+
<AvatarFallback>{userInitials}</AvatarFallback>
|
|
16
|
+
</Avatar>
|
|
17
|
+
),
|
|
18
|
+
args: {
|
|
19
|
+
className: 'size-12',
|
|
20
|
+
src: 'https://github.com/shadcn.png',
|
|
21
|
+
userInitials: 'CN',
|
|
22
|
+
},
|
|
23
|
+
tags: ['autodocs'],
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default meta
|
|
27
|
+
type Story = StoryObj<typeof meta>
|
|
28
|
+
|
|
29
|
+
export const Default: Story = {}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {Badge} from '../components/ui/badge'
|
|
2
|
+
|
|
3
|
+
import type {Meta, StoryObj} from '@storybook/react-vite'
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'UI/Badge',
|
|
7
|
+
component: Badge,
|
|
8
|
+
parameters: {},
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
variant: {
|
|
12
|
+
control: 'radio',
|
|
13
|
+
options: ['default', 'secondary', 'destructive', 'outline'],
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
} satisfies Meta<typeof Badge>
|
|
17
|
+
|
|
18
|
+
export default meta
|
|
19
|
+
type Story = StoryObj<typeof meta>
|
|
20
|
+
|
|
21
|
+
export const Default: Story = {
|
|
22
|
+
args: {
|
|
23
|
+
children: 'Badge',
|
|
24
|
+
},
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const Secondary: Story = {
|
|
28
|
+
args: {
|
|
29
|
+
variant: 'secondary',
|
|
30
|
+
children: 'Badge',
|
|
31
|
+
},
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const Destructive: Story = {
|
|
35
|
+
args: {
|
|
36
|
+
variant: 'destructive',
|
|
37
|
+
children: 'Badge',
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const Outline: Story = {
|
|
42
|
+
args: {
|
|
43
|
+
variant: 'outline',
|
|
44
|
+
children: 'Badge',
|
|
45
|
+
},
|
|
46
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import {fn} from 'storybook/test'
|
|
2
|
+
|
|
3
|
+
import {Button} from '../components/atoms/button'
|
|
4
|
+
|
|
5
|
+
import type {Meta, StoryObj} from '@storybook/react-vite'
|
|
6
|
+
|
|
7
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
8
|
+
const meta = {
|
|
9
|
+
title: 'Atoms/Button',
|
|
10
|
+
component: Button,
|
|
11
|
+
parameters: {},
|
|
12
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
13
|
+
tags: ['autodocs'],
|
|
14
|
+
argTypes: {
|
|
15
|
+
variant: {
|
|
16
|
+
control: 'radio',
|
|
17
|
+
options: [
|
|
18
|
+
'default',
|
|
19
|
+
'secondary',
|
|
20
|
+
'tertiary',
|
|
21
|
+
'outline',
|
|
22
|
+
'ghost',
|
|
23
|
+
'link',
|
|
24
|
+
'destructive',
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
args: {onClick: fn()},
|
|
29
|
+
} satisfies Meta<typeof Button>
|
|
30
|
+
|
|
31
|
+
export default meta
|
|
32
|
+
type Story = StoryObj<typeof meta>
|
|
33
|
+
|
|
34
|
+
export const Default: Story = {
|
|
35
|
+
args: {
|
|
36
|
+
variant: 'default',
|
|
37
|
+
children: 'Button',
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const Secondary: Story = {
|
|
42
|
+
args: {
|
|
43
|
+
variant: 'secondary',
|
|
44
|
+
children: 'Button',
|
|
45
|
+
},
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const Tertiary: Story = {
|
|
49
|
+
args: {
|
|
50
|
+
variant: 'tertiary',
|
|
51
|
+
children: 'Button',
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const Outline: Story = {
|
|
56
|
+
args: {
|
|
57
|
+
variant: 'outline',
|
|
58
|
+
children: 'Button',
|
|
59
|
+
},
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const Ghost: Story = {
|
|
63
|
+
args: {
|
|
64
|
+
variant: 'ghost',
|
|
65
|
+
children: 'Button',
|
|
66
|
+
},
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export const Link: Story = {
|
|
70
|
+
args: {
|
|
71
|
+
variant: 'link',
|
|
72
|
+
children: 'Button',
|
|
73
|
+
},
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const Destructive: Story = {
|
|
77
|
+
args: {
|
|
78
|
+
variant: 'destructive',
|
|
79
|
+
children: 'Button',
|
|
80
|
+
},
|
|
81
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {Button} from '../components/atoms/button'
|
|
2
|
+
import {
|
|
3
|
+
Card,
|
|
4
|
+
CardHeader,
|
|
5
|
+
CardFooter,
|
|
6
|
+
CardTitle,
|
|
7
|
+
CardAction,
|
|
8
|
+
CardDescription,
|
|
9
|
+
CardContent,
|
|
10
|
+
} from '../components/ui/card'
|
|
11
|
+
|
|
12
|
+
import type {Meta, StoryObj} from '@storybook/react-vite'
|
|
13
|
+
|
|
14
|
+
const meta = {
|
|
15
|
+
title: 'UI/Card',
|
|
16
|
+
render: () => (
|
|
17
|
+
<Card>
|
|
18
|
+
<CardHeader>
|
|
19
|
+
<CardTitle>Card Title</CardTitle>
|
|
20
|
+
<CardDescription>Card description goes here</CardDescription>
|
|
21
|
+
<CardAction>
|
|
22
|
+
<Button>Action</Button>
|
|
23
|
+
</CardAction>
|
|
24
|
+
</CardHeader>
|
|
25
|
+
<CardContent>
|
|
26
|
+
<p>This is the main content of the card.</p>
|
|
27
|
+
</CardContent>
|
|
28
|
+
<CardFooter>
|
|
29
|
+
<p>Card footer content</p>
|
|
30
|
+
</CardFooter>
|
|
31
|
+
</Card>
|
|
32
|
+
),
|
|
33
|
+
parameters: {},
|
|
34
|
+
tags: ['autodocs'],
|
|
35
|
+
} satisfies Meta<typeof Card>
|
|
36
|
+
|
|
37
|
+
export default meta
|
|
38
|
+
type Story = StoryObj<typeof meta>
|
|
39
|
+
|
|
40
|
+
export const Default: Story = {}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {Checkbox} from '../components/ui/checkbox'
|
|
2
|
+
|
|
3
|
+
import type {Meta, StoryObj} from '@storybook/react-vite'
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'UI/Checkbox',
|
|
7
|
+
component: Checkbox,
|
|
8
|
+
parameters: {},
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
checked: {
|
|
12
|
+
control: 'boolean',
|
|
13
|
+
},
|
|
14
|
+
disabled: {
|
|
15
|
+
control: 'boolean',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
} satisfies Meta<typeof Checkbox>
|
|
19
|
+
|
|
20
|
+
export default meta
|
|
21
|
+
type Story = StoryObj<typeof meta>
|
|
22
|
+
|
|
23
|
+
export const Default: Story = {
|
|
24
|
+
args: {},
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const Checked: Story = {
|
|
28
|
+
args: {
|
|
29
|
+
checked: true,
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const Disabled: Story = {
|
|
34
|
+
args: {
|
|
35
|
+
disabled: true,
|
|
36
|
+
},
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const DisabledChecked: Story = {
|
|
40
|
+
args: {
|
|
41
|
+
disabled: true,
|
|
42
|
+
checked: true,
|
|
43
|
+
},
|
|
44
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {fn} from 'storybook/test'
|
|
2
|
+
|
|
3
|
+
import {FavoriteButton} from '../components/atoms/favorite-button'
|
|
4
|
+
|
|
5
|
+
import type {Meta, StoryObj} from '@storybook/react-vite'
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Atoms/FavoriteButton',
|
|
9
|
+
component: FavoriteButton,
|
|
10
|
+
parameters: {},
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
argTypes: {
|
|
13
|
+
filled: {
|
|
14
|
+
control: 'boolean',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
args: {
|
|
18
|
+
onClick: fn(),
|
|
19
|
+
filled: false,
|
|
20
|
+
},
|
|
21
|
+
} satisfies Meta<typeof FavoriteButton>
|
|
22
|
+
|
|
23
|
+
export default meta
|
|
24
|
+
type Story = StoryObj<typeof meta>
|
|
25
|
+
|
|
26
|
+
export const Favorited: Story = {
|
|
27
|
+
args: {
|
|
28
|
+
filled: true,
|
|
29
|
+
onClick: fn(),
|
|
30
|
+
},
|
|
31
|
+
render: ({onClick, filled}) => {
|
|
32
|
+
return (
|
|
33
|
+
<FavoriteButton
|
|
34
|
+
filled={filled}
|
|
35
|
+
onClick={() => {
|
|
36
|
+
onClick?.()
|
|
37
|
+
}}
|
|
38
|
+
/>
|
|
39
|
+
)
|
|
40
|
+
},
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const Unfavorited: Story = {
|
|
44
|
+
args: {
|
|
45
|
+
filled: false,
|
|
46
|
+
onClick: fn(),
|
|
47
|
+
},
|
|
48
|
+
render: ({onClick, filled}) => {
|
|
49
|
+
return (
|
|
50
|
+
<FavoriteButton
|
|
51
|
+
filled={filled}
|
|
52
|
+
onClick={() => {
|
|
53
|
+
onClick?.()
|
|
54
|
+
}}
|
|
55
|
+
/>
|
|
56
|
+
)
|
|
57
|
+
},
|
|
58
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import {Heart, Star, Settings, Home} from 'lucide-react'
|
|
2
|
+
import {fn} from 'storybook/test'
|
|
3
|
+
|
|
4
|
+
import {IconButton} from '../components/atoms/icon-button'
|
|
5
|
+
|
|
6
|
+
import type {Meta, StoryObj} from '@storybook/react-vite'
|
|
7
|
+
|
|
8
|
+
const meta = {
|
|
9
|
+
title: 'Atoms/IconButton',
|
|
10
|
+
component: IconButton,
|
|
11
|
+
parameters: {},
|
|
12
|
+
tags: ['autodocs'],
|
|
13
|
+
argTypes: {
|
|
14
|
+
size: {
|
|
15
|
+
control: 'radio',
|
|
16
|
+
options: ['sm', 'default', 'lg'],
|
|
17
|
+
},
|
|
18
|
+
filled: {
|
|
19
|
+
control: 'boolean',
|
|
20
|
+
},
|
|
21
|
+
Icon: {
|
|
22
|
+
control: 'select',
|
|
23
|
+
options: ['Heart', 'Star', 'Settings', 'Home'],
|
|
24
|
+
mapping: {
|
|
25
|
+
Heart,
|
|
26
|
+
Star,
|
|
27
|
+
Settings,
|
|
28
|
+
Home,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
args: {
|
|
33
|
+
onClick: fn(),
|
|
34
|
+
filled: false,
|
|
35
|
+
size: 'default',
|
|
36
|
+
Icon: Heart,
|
|
37
|
+
},
|
|
38
|
+
} satisfies Meta<typeof IconButton>
|
|
39
|
+
|
|
40
|
+
export default meta
|
|
41
|
+
type Story = StoryObj<typeof meta>
|
|
42
|
+
|
|
43
|
+
export const Default: Story = {
|
|
44
|
+
args: {
|
|
45
|
+
Icon: Heart,
|
|
46
|
+
},
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const Filled: Story = {
|
|
50
|
+
args: {
|
|
51
|
+
Icon: Heart,
|
|
52
|
+
filled: true,
|
|
53
|
+
},
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export const Small: Story = {
|
|
57
|
+
args: {
|
|
58
|
+
Icon: Star,
|
|
59
|
+
size: 'sm',
|
|
60
|
+
},
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const Large: Story = {
|
|
64
|
+
args: {
|
|
65
|
+
Icon: Settings,
|
|
66
|
+
size: 'lg',
|
|
67
|
+
},
|
|
68
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {Input} from '../components/ui/input'
|
|
2
|
+
|
|
3
|
+
import type {Meta, StoryObj} from '@storybook/react-vite'
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'UI/Input',
|
|
7
|
+
component: Input,
|
|
8
|
+
parameters: {},
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
type: {
|
|
12
|
+
control: 'select',
|
|
13
|
+
options: ['text', 'email', 'password', 'number', 'search', 'tel', 'url'],
|
|
14
|
+
},
|
|
15
|
+
placeholder: {
|
|
16
|
+
control: 'text',
|
|
17
|
+
},
|
|
18
|
+
disabled: {
|
|
19
|
+
control: 'boolean',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
} satisfies Meta<typeof Input>
|
|
23
|
+
|
|
24
|
+
export default meta
|
|
25
|
+
type Story = StoryObj<typeof meta>
|
|
26
|
+
|
|
27
|
+
export const Default: Story = {
|
|
28
|
+
args: {
|
|
29
|
+
placeholder: 'Enter text...',
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const WithValue: Story = {
|
|
34
|
+
args: {
|
|
35
|
+
value: 'This is an input',
|
|
36
|
+
},
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const Disabled: Story = {
|
|
40
|
+
args: {
|
|
41
|
+
disabled: true,
|
|
42
|
+
value: 'Disabled input',
|
|
43
|
+
},
|
|
44
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {Label} from '../components/ui/label'
|
|
2
|
+
|
|
3
|
+
import type {Meta, StoryObj} from '@storybook/react-vite'
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'UI/Label',
|
|
7
|
+
component: Label,
|
|
8
|
+
parameters: {},
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
} satisfies Meta<typeof Label>
|
|
11
|
+
|
|
12
|
+
export default meta
|
|
13
|
+
type Story = StoryObj<typeof meta>
|
|
14
|
+
|
|
15
|
+
export const Default: Story = {
|
|
16
|
+
args: {
|
|
17
|
+
children: 'This is a text label',
|
|
18
|
+
},
|
|
19
|
+
}
|
|
@@ -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,55 @@
|
|
|
1
|
+
import {MerchantCard} from '../components/commerce/merchant-card'
|
|
2
|
+
import {createShop, injectMocks} from '../mocks'
|
|
3
|
+
|
|
4
|
+
import type {Meta, StoryObj} from '@storybook/react-vite'
|
|
5
|
+
|
|
6
|
+
type MerchantCardProps = React.ComponentProps<typeof MerchantCard>
|
|
7
|
+
|
|
8
|
+
const meta = {
|
|
9
|
+
title: 'Commerce/MerchantCard',
|
|
10
|
+
component: MerchantCard,
|
|
11
|
+
parameters: {
|
|
12
|
+
layout: 'padded',
|
|
13
|
+
},
|
|
14
|
+
argTypes: {
|
|
15
|
+
touchable: {
|
|
16
|
+
control: 'boolean',
|
|
17
|
+
},
|
|
18
|
+
variant: {
|
|
19
|
+
control: 'radio',
|
|
20
|
+
options: ['default', 'compact'],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
tags: ['autodocs'],
|
|
24
|
+
} satisfies Meta<MerchantCardProps>
|
|
25
|
+
|
|
26
|
+
export default meta
|
|
27
|
+
type Story = StoryObj<typeof meta>
|
|
28
|
+
|
|
29
|
+
injectMocks()
|
|
30
|
+
|
|
31
|
+
export const Default: Story = {
|
|
32
|
+
args: {
|
|
33
|
+
shop: {
|
|
34
|
+
...createShop('shop1', 'Amazing Store'),
|
|
35
|
+
reviewAnalytics: {averageRating: 4.8, reviewCount: 1250},
|
|
36
|
+
},
|
|
37
|
+
variant: 'default',
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const Grid: Story = {
|
|
42
|
+
decorators: [
|
|
43
|
+
Story => (
|
|
44
|
+
<div className="grid grid-cols-2 gap-4">
|
|
45
|
+
<Story />
|
|
46
|
+
<Story />
|
|
47
|
+
<Story />
|
|
48
|
+
<Story />
|
|
49
|
+
</div>
|
|
50
|
+
),
|
|
51
|
+
],
|
|
52
|
+
args: {
|
|
53
|
+
shop: createShop('shop1', 'Amazing Store'),
|
|
54
|
+
},
|
|
55
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
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
|
+
args: {
|
|
38
|
+
product: {
|
|
39
|
+
id: '1',
|
|
40
|
+
title: 'Product 1',
|
|
41
|
+
|
|
42
|
+
price: {
|
|
43
|
+
amount: '100',
|
|
44
|
+
currencyCode: 'USD',
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
compareAtPrice: {
|
|
48
|
+
amount: '120',
|
|
49
|
+
currencyCode: 'USD',
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
reviewAnalytics: {
|
|
53
|
+
averageRating: 4.5,
|
|
54
|
+
reviewCount: 10,
|
|
55
|
+
},
|
|
56
|
+
shop: {
|
|
57
|
+
id: 'shop1',
|
|
58
|
+
name: 'Mock Shop',
|
|
59
|
+
},
|
|
60
|
+
defaultVariantId: 'variant-1',
|
|
61
|
+
isFavorited: true,
|
|
62
|
+
|
|
63
|
+
featuredImage: {
|
|
64
|
+
url: 'https://picsum.photos/400/400',
|
|
65
|
+
altText: 'Product 1',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export const Grid: Story = {
|
|
72
|
+
decorators: [
|
|
73
|
+
Story => (
|
|
74
|
+
<div className="grid grid-cols-2 gap-4">
|
|
75
|
+
<Story />
|
|
76
|
+
<Story />
|
|
77
|
+
<Story />
|
|
78
|
+
<Story />
|
|
79
|
+
</div>
|
|
80
|
+
),
|
|
81
|
+
],
|
|
82
|
+
args: {
|
|
83
|
+
product: createProduct('1', 'Product 1', '100', '120'),
|
|
84
|
+
},
|
|
85
|
+
}
|