@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,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
|
+
}
|