@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.
Files changed (82) hide show
  1. package/dist/_virtual/index2.js +2 -3
  2. package/dist/_virtual/index2.js.map +1 -1
  3. package/dist/_virtual/index3.js +3 -2
  4. package/dist/_virtual/index3.js.map +1 -1
  5. package/dist/components/atoms/alert-dialog.js +41 -0
  6. package/dist/components/atoms/alert-dialog.js.map +1 -0
  7. package/dist/components/atoms/thumbhash-image.js +54 -0
  8. package/dist/components/atoms/thumbhash-image.js.map +1 -0
  9. package/dist/components/commerce/merchant-card-skeleton.js +29 -0
  10. package/dist/components/commerce/merchant-card-skeleton.js.map +1 -0
  11. package/dist/components/commerce/merchant-card.js +28 -22
  12. package/dist/components/commerce/merchant-card.js.map +1 -1
  13. package/dist/components/commerce/product-card-skeleton.js +20 -0
  14. package/dist/components/commerce/product-card-skeleton.js.map +1 -0
  15. package/dist/components/commerce/product-card.js +105 -78
  16. package/dist/components/commerce/product-card.js.map +1 -1
  17. package/dist/components/navigation/transition-container.js +8 -0
  18. package/dist/components/navigation/transition-container.js.map +1 -0
  19. package/dist/components/navigation/transition-link.js +27 -0
  20. package/dist/components/navigation/transition-link.js.map +1 -0
  21. package/dist/components/ui/skeleton.js +16 -0
  22. package/dist/components/ui/skeleton.js.map +1 -0
  23. package/dist/hooks/navigation/useNavigateWithTransition.js +43 -0
  24. package/dist/hooks/navigation/useNavigateWithTransition.js.map +1 -0
  25. package/dist/hooks/navigation/useViewTransitions.js +45 -0
  26. package/dist/hooks/navigation/useViewTransitions.js.map +1 -0
  27. package/dist/index.js +215 -196
  28. package/dist/index.js.map +1 -1
  29. 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
  30. package/dist/shop-minis-react/node_modules/.pnpm/js-base64@3.7.7/node_modules/js-base64/base64.js +21 -0
  31. package/dist/shop-minis-react/node_modules/.pnpm/js-base64@3.7.7/node_modules/js-base64/base64.js.map +1 -0
  32. package/dist/shop-minis-react/node_modules/.pnpm/querystringify@2.2.0/node_modules/querystringify/index.js +1 -1
  33. 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
  34. 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
  35. package/dist/shop-minis-react/node_modules/.pnpm/thumbhash@0.1.1/node_modules/thumbhash/thumbhash.js +145 -0
  36. package/dist/shop-minis-react/node_modules/.pnpm/thumbhash@0.1.1/node_modules/thumbhash/thumbhash.js.map +1 -0
  37. package/dist/types/index.js +10 -0
  38. package/dist/types/index.js.map +1 -0
  39. package/dist/utils/image.js +15 -0
  40. package/dist/utils/image.js.map +1 -0
  41. package/package.json +13 -3
  42. package/src/components/atoms/alert-dialog.tsx +67 -0
  43. package/src/components/atoms/thumbhash-image.tsx +66 -0
  44. package/src/components/commerce/merchant-card-skeleton.tsx +31 -0
  45. package/src/components/commerce/merchant-card.tsx +5 -2
  46. package/src/components/commerce/product-card-skeleton.tsx +30 -0
  47. package/src/components/commerce/product-card.tsx +49 -8
  48. package/src/components/index.ts +8 -0
  49. package/src/components/navigation/transition-container.tsx +7 -0
  50. package/src/components/navigation/transition-link.tsx +48 -0
  51. package/src/components/ui/skeleton.tsx +13 -0
  52. package/src/hooks/index.ts +1 -0
  53. package/src/hooks/navigation/useNavigateWithTransition.ts +62 -0
  54. package/src/hooks/navigation/useViewTransitions.ts +79 -0
  55. package/src/index.css +1 -0
  56. package/src/mocks.ts +8 -2
  57. package/src/stories/Accordion.stories.tsx +124 -0
  58. package/src/stories/Alert.stories.tsx +38 -0
  59. package/src/stories/AlertDialog.stories.tsx +48 -0
  60. package/src/stories/Avatar.stories.tsx +29 -0
  61. package/src/stories/Badge.stories.tsx +46 -0
  62. package/src/stories/Button.stories.tsx +81 -0
  63. package/src/stories/Card.stories.tsx +40 -0
  64. package/src/stories/Checkbox.stories.tsx +44 -0
  65. package/src/stories/FavoriteButton.stories.tsx +58 -0
  66. package/src/stories/IconButton.stories.tsx +68 -0
  67. package/src/stories/Input.stories.tsx +44 -0
  68. package/src/stories/Label.stories.tsx +19 -0
  69. package/src/stories/MerchantCard.stories.tsx +55 -0
  70. package/src/stories/ProductCard.stories.tsx +85 -0
  71. package/src/stories/ProductLink.stories.tsx +46 -0
  72. package/src/stories/Progress.stories.tsx +30 -0
  73. package/src/stories/RadioGroup.stories.tsx +51 -0
  74. package/src/stories/Select.stories.tsx +85 -0
  75. package/src/stories/Skeleton.stories.tsx +19 -0
  76. package/src/stories/Toaster.stories.tsx +46 -0
  77. package/src/stories/Touchable.stories.tsx +40 -0
  78. package/src/styles/animations.css +90 -0
  79. package/src/styles/globals.css +8 -0
  80. package/src/styles/theme.css +1 -1
  81. package/src/types/index.ts +7 -1
  82. 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
+ }
@@ -16,6 +16,14 @@ body {
16
16
  touch-action: manipulation;
17
17
  }
18
18
 
19
+ html {
20
+ position: relative;
21
+ width: 100vw;
22
+ min-height: 100vh;
23
+ overflow-y: auto;
24
+ overflow-x: hidden;
25
+ }
26
+
19
27
  /* Disable text selection */
20
28
  body {
21
29
  -webkit-user-select: none;
@@ -97,6 +97,6 @@
97
97
  }
98
98
 
99
99
  /* Dark mode overrides - only the palette colors that change */
100
- .dark {
100
+ @theme dark {
101
101
  /* TBD */
102
102
  }
@@ -12,4 +12,10 @@ export interface ThemeConfig {
12
12
  typography?: {[key: string]: string}
13
13
  }
14
14
 
15
- // Export other types as needed
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
+ }