@shopify/shop-minis-react 0.0.28 → 0.0.30

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 (57) hide show
  1. package/dist/_virtual/index10.js +2 -2
  2. package/dist/_virtual/index2.js +4 -4
  3. package/dist/_virtual/index3.js +4 -4
  4. package/dist/_virtual/index5.js +3 -2
  5. package/dist/_virtual/index5.js.map +1 -1
  6. package/dist/_virtual/index6.js +2 -3
  7. package/dist/_virtual/index6.js.map +1 -1
  8. package/dist/_virtual/index7.js +2 -2
  9. package/dist/_virtual/index9.js +2 -2
  10. package/dist/components/atoms/list.js +37 -31
  11. package/dist/components/atoms/list.js.map +1 -1
  12. package/dist/components/commerce/product-link.js +117 -113
  13. package/dist/components/commerce/product-link.js.map +1 -1
  14. package/dist/components/commerce/search.js +26 -17
  15. package/dist/components/commerce/search.js.map +1 -1
  16. package/dist/components/navigation/minis-router.js +14 -0
  17. package/dist/components/navigation/minis-router.js.map +1 -0
  18. package/dist/hooks/navigation/useNavigateWithTransition.js.map +1 -1
  19. package/dist/hooks/navigation/useShopNavigation.js.map +1 -1
  20. package/dist/hooks/user/useCurrentUser.js.map +1 -1
  21. package/dist/hooks/user/useFollowedShopsActions.js.map +1 -1
  22. package/dist/hooks/util/useImagePicker.js.map +1 -1
  23. package/dist/index.js +2 -2
  24. package/dist/mocks.js +9 -9
  25. package/dist/mocks.js.map +1 -1
  26. 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
  27. package/dist/shop-minis-react/node_modules/.pnpm/@videojs_xhr@2.7.0/node_modules/@videojs/xhr/lib/index.js +1 -1
  28. package/dist/shop-minis-react/node_modules/.pnpm/@xmldom_xmldom@0.8.10/node_modules/@xmldom/xmldom/lib/index.js +1 -1
  29. package/dist/shop-minis-react/node_modules/.pnpm/mpd-parser@1.3.1/node_modules/mpd-parser/dist/mpd-parser.es.js +1 -1
  30. 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 +764 -567
  31. 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 -1
  32. 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 +1 -1
  33. package/dist/shop-minis-react/node_modules/.pnpm/video.js@8.23.3/node_modules/video.js/dist/video.es.js +1 -1
  34. package/dist/utils/colors.js +1 -1
  35. package/package.json +1 -1
  36. package/src/components/atoms/list.tsx +24 -4
  37. package/src/components/commerce/product-link.tsx +10 -4
  38. package/src/components/commerce/search.tsx +9 -2
  39. package/src/components/index.ts +1 -1
  40. package/src/components/navigation/minis-router.tsx +23 -0
  41. package/src/hooks/navigation/useNavigateWithTransition.ts +6 -1
  42. package/src/hooks/navigation/useShopNavigation.ts +3 -1
  43. package/src/hooks/user/useCurrentUser.ts +3 -0
  44. package/src/hooks/user/useFollowedShopsActions.ts +2 -2
  45. package/src/hooks/util/{useImagePicker.tsx → useImagePicker.ts} +8 -2
  46. package/src/index.css +1 -0
  47. package/src/mocks.ts +3 -3
  48. package/src/stories/ImageContentWrapper.stories.tsx +68 -0
  49. package/src/stories/MerchantCard.stories.tsx +21 -0
  50. package/src/stories/ProductCard.stories.tsx +10 -3
  51. package/src/stories/ProductLink.stories.tsx +3 -3
  52. package/src/stories/QuantitySelector.stories.tsx +78 -0
  53. package/src/stories/Search.stories.tsx +37 -0
  54. package/src/stories/VideoPlayer.stories.tsx +129 -0
  55. package/src/styles/fonts.css +26 -0
  56. package/src/styles/theme.css +26 -0
  57. package/src/hooks/util/useImagePicker.doc.tsx +0 -41
@@ -0,0 +1,129 @@
1
+ import {useRef} from 'react'
2
+
3
+ import {fn} from 'storybook/test'
4
+
5
+ import {VideoPlayer, VideoPlayerRef} from '../components/atoms/video-player'
6
+
7
+ import type {Meta, StoryObj} from '@storybook/react-vite'
8
+
9
+ const meta: Meta<typeof VideoPlayer> = {
10
+ title: 'Atoms/VideoPlayer',
11
+ component: VideoPlayer,
12
+ parameters: {
13
+ layout: 'padded',
14
+ },
15
+ args: {
16
+ onPlay: fn(),
17
+ onPause: fn(),
18
+ onEnded: fn(),
19
+ onReady: fn(),
20
+ },
21
+ argTypes: {
22
+ src: {
23
+ control: 'text',
24
+ },
25
+ format: {
26
+ control: 'select',
27
+ options: ['video/mp4', 'video/webm', 'video/ogg'],
28
+ },
29
+ poster: {
30
+ control: 'text',
31
+ },
32
+ width: {
33
+ control: 'number',
34
+ },
35
+ height: {
36
+ control: 'number',
37
+ },
38
+ muted: {
39
+ control: 'boolean',
40
+ },
41
+ autoplay: {
42
+ control: 'boolean',
43
+ },
44
+ playButtonComponent: {
45
+ control: 'text',
46
+ },
47
+ },
48
+ tags: ['autodocs'],
49
+ }
50
+
51
+ export default meta
52
+ type Story = StoryObj<typeof meta>
53
+
54
+ const SAMPLE_VIDEO_MP4 =
55
+ 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4'
56
+ const SAMPLE_POSTER =
57
+ 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/images/BigBuckBunny.jpg'
58
+
59
+ export const FixedWidth: Story = {
60
+ args: {
61
+ src: SAMPLE_VIDEO_MP4,
62
+ width: 300,
63
+ },
64
+ }
65
+
66
+ export const FixedHeight: Story = {
67
+ args: {
68
+ src: SAMPLE_VIDEO_MP4,
69
+ height: 200,
70
+ },
71
+ }
72
+
73
+ export const WithPoster: Story = {
74
+ args: {
75
+ src: SAMPLE_VIDEO_MP4,
76
+ poster: SAMPLE_POSTER,
77
+ width: 300,
78
+ },
79
+ }
80
+
81
+ export const WithCustomPlayButton: Story = {
82
+ args: {
83
+ src: SAMPLE_VIDEO_MP4,
84
+ poster: SAMPLE_POSTER,
85
+ width: 300,
86
+ playButtonComponent: (
87
+ <div className="bg-blue-500 text-white rounded-full p-4 shadow-lg">
88
+ <svg viewBox="0 0 24 24" className="w-8 h-8" fill="currentColor">
89
+ <path d="M8 5v14l11-7z" />
90
+ </svg>
91
+ </div>
92
+ ),
93
+ },
94
+ }
95
+
96
+ const WithImperativeControlsComponent = (args: any) => {
97
+ const videoRef = useRef<VideoPlayerRef>(null)
98
+
99
+ return (
100
+ <div className="space-y-4 flex flex-col items-center">
101
+ <VideoPlayer ref={videoRef} {...args} />
102
+ <div className="flex gap-2">
103
+ <button
104
+ type="button"
105
+ className="px-4 py-2 bg-primary text-white rounded"
106
+ onClick={() => videoRef.current?.play()}
107
+ >
108
+ Play
109
+ </button>
110
+ <button
111
+ type="button"
112
+ className="px-4 py-2 bg-red-400 text-white rounded"
113
+ onClick={() => videoRef.current?.pause()}
114
+ >
115
+ Pause
116
+ </button>
117
+ </div>
118
+ </div>
119
+ )
120
+ }
121
+
122
+ export const WithImperativeControls: Story = {
123
+ render: WithImperativeControlsComponent,
124
+ args: {
125
+ src: SAMPLE_VIDEO_MP4,
126
+ poster: SAMPLE_POSTER,
127
+ width: 300,
128
+ },
129
+ }
@@ -0,0 +1,26 @@
1
+ @font-face {
2
+ font-family: 'Suisse Intl';
3
+ font-style: normal;
4
+ font-weight: 400;
5
+ font-display: swap;
6
+ src: url('https://cdn.shopify.com/shop-assets/static_uploads/shoplift/SuisseIntl-Book.woff2')
7
+ format('woff2');
8
+ }
9
+
10
+ @font-face {
11
+ font-family: 'Suisse Intl';
12
+ font-style: normal;
13
+ font-weight: 500;
14
+ font-display: swap;
15
+ src: url('https://cdn.shopify.com/shop-assets/static_uploads/shoplift/SuisseIntl-Medium.woff2')
16
+ format('woff2');
17
+ }
18
+
19
+ @font-face {
20
+ font-family: 'Suisse Intl';
21
+ font-style: normal;
22
+ font-weight: 600 700;
23
+ font-display: swap;
24
+ src: url('https://cdn.shopify.com/shop-assets/static_uploads/shoplift/SuisseIntl-SemiBold.woff2')
25
+ format('woff2');
26
+ }
@@ -94,6 +94,32 @@
94
94
 
95
95
  /* Button theme colors */
96
96
  --color-button-overlay: var(--grayscale-d70);
97
+
98
+ /* Default fonts */
99
+ --font-sans: 'Suisse Intl', ui-sans-serif, system-ui, sans-serif,
100
+ 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
101
+ --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
102
+ 'Liberation Mono', 'Courier New', monospace;
103
+
104
+ /* Default Tailwind spacing scale (0.25rem = 4px base) */
105
+ --spacing: 0.25rem;
106
+
107
+ /* Semantic spacing aliases */
108
+ --spacing-shop-screen-margin: 20px;
109
+ --spacing--shop-screen-margin: -20px;
110
+ --spacing-shop-section-gap: 36px;
111
+ --spacing--shop-section-gap: -36px;
112
+ --spacing-shop-card-row-gutter: 8px;
113
+ --spacing--shop-card-row-gutter: -8px;
114
+ --spacing-shop-card-padding: 16px;
115
+ --spacing--shop-card-padding: -16px;
116
+
117
+ /* Shop shadow values */
118
+ --shadow-shop-xs: 0px 2px 4px 0px rgba(0, 0, 0, 0.06);
119
+ --shadow-shop-xs-surface: 0px -1px 4px 0px rgba(0, 0, 0, 0.06);
120
+ --shadow-shop-s: 0px 4px 8px 0px rgba(0, 0, 0, 0.1);
121
+ --shadow-shop-m: 0px 4px 12px 0px rgba(0, 0, 0, 0.16);
122
+ --shadow-shop-l: 0px 8px 24px 0px rgba(0, 0, 0, 0.24);
97
123
  }
98
124
 
99
125
  /* Dark mode overrides - only the palette colors that change */
@@ -1,41 +0,0 @@
1
- export const useImagePickerDoc = {
2
- name: 'useImagePicker',
3
- category: 'Utility',
4
- description:
5
- 'Hook for selecting images from camera or gallery in web-based mini apps',
6
- params: [
7
- {
8
- name: 'options',
9
- type: 'UseImagePickerOptions',
10
- description: 'Configuration options for the image picker',
11
- optional: true,
12
- properties: [
13
- {
14
- name: 'cameraFacing',
15
- type: "'user' | 'environment'",
16
- description: 'Which camera to use when opening camera',
17
- optional: true,
18
- default: "'environment'",
19
- },
20
- ],
21
- },
22
- ],
23
- returns: [
24
- {
25
- name: 'openCamera',
26
- type: '() => Promise<File>',
27
- description: 'Function to open the camera for capturing an image',
28
- },
29
- {
30
- name: 'openGallery',
31
- type: '() => Promise<File>',
32
- description: 'Function to open the gallery for selecting an image',
33
- },
34
- {
35
- name: 'ImagePickerInputs',
36
- type: 'React.FC',
37
- description:
38
- 'Component that renders hidden file inputs. Must be rendered in your component for the picker to work',
39
- },
40
- ],
41
- }