@shopify/shop-minis-react 0.0.17 → 0.0.19
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/index3.js +6 -0
- package/dist/_virtual/index3.js.map +1 -0
- package/dist/_virtual/index4.js +5 -0
- package/dist/_virtual/index4.js.map +1 -0
- package/dist/_virtual/use-sync-external-store-shim.development.js +5 -0
- package/dist/_virtual/use-sync-external-store-shim.development.js.map +1 -0
- package/dist/_virtual/use-sync-external-store-shim.production.js +5 -0
- package/dist/_virtual/use-sync-external-store-shim.production.js.map +1 -0
- package/dist/components/atoms/alert-dialog.js +41 -0
- package/dist/components/atoms/alert-dialog.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/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/avatar.js +54 -0
- package/dist/components/ui/avatar.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 +215 -192
- package/dist/index.js.map +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/@radix-ui_react-avatar@1.1.10_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react@19.1._hkz57sehyui4ndfh3rsqwxftli/node_modules/@radix-ui/react-avatar/dist/index.js +77 -0
- package/dist/shop-minis-react/node_modules/.pnpm/@radix-ui_react-avatar@1.1.10_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react@19.1._hkz57sehyui4ndfh3rsqwxftli/node_modules/@radix-ui/react-avatar/dist/index.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 +16 -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.map +1 -0
- 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/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/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/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.1.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +68 -0
- package/dist/shop-minis-react/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.1.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.1.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +56 -0
- package/dist/shop-minis-react/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.1.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.1.0/node_modules/use-sync-external-store/shim/index.js +11 -0
- package/dist/shop-minis-react/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.1.0/node_modules/use-sync-external-store/shim/index.js.map +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 +13 -3
- package/src/components/atoms/alert-dialog.tsx +67 -0
- package/src/components/atoms/thumbhash-image.tsx +66 -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 +1 -0
- package/src/mocks.ts +8 -2
- 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/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/types/index.ts +7 -1
- package/src/utils/image.ts +18 -0
|
@@ -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,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
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
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', 'Product 1', '100', '120'),
|
|
24
|
+
},
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const WithDiscount: Story = {
|
|
28
|
+
args: {
|
|
29
|
+
product: createProduct('2', 'Product with Discount', '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', 'Product 1', '100', '120'),
|
|
45
|
+
},
|
|
46
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
}
|