@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,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
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/* --- Keyframe Definitions --- */
|
|
2
|
+
@keyframes slide-in-from-right {
|
|
3
|
+
from {
|
|
4
|
+
transform: translateX(100%);
|
|
5
|
+
}
|
|
6
|
+
to {
|
|
7
|
+
transform: translateX(0);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@keyframes slide-out-to-left {
|
|
12
|
+
from {
|
|
13
|
+
transform: translateX(0);
|
|
14
|
+
filter: brightness(1);
|
|
15
|
+
}
|
|
16
|
+
to {
|
|
17
|
+
transform: translateX(-30%);
|
|
18
|
+
filter: brightness(0.7);
|
|
19
|
+
} /* Slight parallax effect */
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@keyframes slide-in-from-left {
|
|
23
|
+
from {
|
|
24
|
+
transform: translateX(-30%);
|
|
25
|
+
filter: brightness(0.7);
|
|
26
|
+
}
|
|
27
|
+
to {
|
|
28
|
+
transform: translateX(0);
|
|
29
|
+
filter: brightness(1);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@keyframes slide-out-to-right {
|
|
34
|
+
from {
|
|
35
|
+
transform: translateX(0);
|
|
36
|
+
}
|
|
37
|
+
to {
|
|
38
|
+
transform: translateX(100%);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@keyframes fade-in {
|
|
43
|
+
from {
|
|
44
|
+
opacity: 0;
|
|
45
|
+
}
|
|
46
|
+
to {
|
|
47
|
+
opacity: 1;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* --- View Transition Animations --- */
|
|
52
|
+
@media not (prefers-reduced-motion: reduce) {
|
|
53
|
+
/* FORWARD navigation animation */
|
|
54
|
+
html[data-navigation-type='forward']::view-transition-old(root) {
|
|
55
|
+
animation: 0.4s cubic-bezier(0.4, 0, 0.2, 1) both slide-out-to-left;
|
|
56
|
+
z-index: 1;
|
|
57
|
+
}
|
|
58
|
+
html[data-navigation-type='forward']::view-transition-new(root) {
|
|
59
|
+
animation: 0.4s cubic-bezier(0.4, 0, 0.2, 1) both slide-in-from-right;
|
|
60
|
+
z-index: 2; /* New view slides on top */
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* BACKWARD navigation animation */
|
|
64
|
+
html[data-navigation-type='backward']::view-transition-old(root) {
|
|
65
|
+
animation: 0.4s cubic-bezier(0.4, 0, 0.2, 1) both slide-out-to-right;
|
|
66
|
+
z-index: 2; /* Old view slides away from on top */
|
|
67
|
+
}
|
|
68
|
+
html[data-navigation-type='backward']::view-transition-new(root) {
|
|
69
|
+
animation: 0.4s cubic-bezier(0.4, 0, 0.2, 1) both slide-in-from-left;
|
|
70
|
+
z-index: 1;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* Android backward navigation animation */
|
|
74
|
+
html[data-navigation-type='android-backward']::view-transition-old(root) {
|
|
75
|
+
animation: 0.4s cubic-bezier(0.4, 0, 0.2, 1) both slide-out-to-right;
|
|
76
|
+
z-index: 2; /* Old view slides away from on top */
|
|
77
|
+
}
|
|
78
|
+
html[data-navigation-type='android-backward']::view-transition-new(root) {
|
|
79
|
+
animation: 0.4s cubic-bezier(0.4, 0, 0.2, 1) both slide-in-from-left;
|
|
80
|
+
z-index: 1;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* NONE navigation animation */
|
|
84
|
+
html[data-navigation-type='none']::view-transition-group(root),
|
|
85
|
+
html[data-navigation-type='none']::view-transition-old(root),
|
|
86
|
+
html[data-navigation-type='none']::view-transition-new(root) {
|
|
87
|
+
animation: 0 !important;
|
|
88
|
+
opacity: 0 !important;
|
|
89
|
+
}
|
|
90
|
+
}
|
package/src/styles/globals.css
CHANGED
package/src/styles/theme.css
CHANGED
package/src/types/index.ts
CHANGED
|
@@ -12,4 +12,10 @@ export interface ThemeConfig {
|
|
|
12
12
|
typography?: {[key: string]: string}
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
//
|
|
15
|
+
// Navigation
|
|
16
|
+
export const DATA_NAVIGATION_TYPE_ATTRIBUTE = 'data-navigation-type' as const
|
|
17
|
+
export const NAVIGATION_TYPES = {
|
|
18
|
+
forward: 'forward',
|
|
19
|
+
backward: 'backward',
|
|
20
|
+
none: 'none',
|
|
21
|
+
} as const
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {toUint8Array} from 'js-base64'
|
|
2
|
+
import {thumbHashToDataURL} from 'thumbhash'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Converts a thumbhash string to a data URL for use as an image placeholder
|
|
6
|
+
* @param thumbhash Base64 encoded thumbhash string
|
|
7
|
+
* @returns Data URL that can be used as image source or undefined if conversion fails
|
|
8
|
+
*/
|
|
9
|
+
export function getThumbhashDataURL(thumbhash?: string): string | undefined {
|
|
10
|
+
if (!thumbhash) return
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
const thumbhashArray = toUint8Array(thumbhash)
|
|
14
|
+
return thumbHashToDataURL(thumbhashArray)
|
|
15
|
+
} catch (error) {
|
|
16
|
+
console.warn('Failed to decode thumbhash to data URL', error)
|
|
17
|
+
}
|
|
18
|
+
}
|