@shopify/shop-minis-react 0.0.18 → 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/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/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/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 -196
- package/dist/index.js.map +1 -1
- 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/querystringify@2.2.0/node_modules/querystringify/index.js +1 -1
- 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/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 +8 -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,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
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
Story => (
|
|
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
|
+
Story => (
|
|
41
|
+
<Button onClick={() => toast.error('Error toast!')}>
|
|
42
|
+
Show error Toast
|
|
43
|
+
</Button>
|
|
44
|
+
),
|
|
45
|
+
],
|
|
46
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {fn} from 'storybook/test'
|
|
2
|
+
|
|
3
|
+
import {Touchable} from '../components/atoms/touchable'
|
|
4
|
+
|
|
5
|
+
import type {Meta, StoryObj} from '@storybook/react-vite'
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Atoms/Touchable',
|
|
9
|
+
component: Touchable,
|
|
10
|
+
parameters: {},
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
argTypes: {
|
|
13
|
+
stopPropagation: {
|
|
14
|
+
control: 'boolean',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
args: {
|
|
18
|
+
onClick: fn(),
|
|
19
|
+
stopPropagation: false,
|
|
20
|
+
},
|
|
21
|
+
} satisfies Meta<typeof Touchable>
|
|
22
|
+
|
|
23
|
+
export default meta
|
|
24
|
+
type Story = StoryObj<typeof meta>
|
|
25
|
+
|
|
26
|
+
export const Default: Story = {
|
|
27
|
+
args: {
|
|
28
|
+
children: <div>Click me</div>,
|
|
29
|
+
},
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const WithStyledChild: Story = {
|
|
33
|
+
args: {
|
|
34
|
+
children: (
|
|
35
|
+
<div className="bg-secondary text-white p-4 rounded-md cursor-pointer hover:bg-secondary/90 transition-colors">
|
|
36
|
+
Custom styled touchable
|
|
37
|
+
</div>
|
|
38
|
+
),
|
|
39
|
+
},
|
|
40
|
+
}
|