@shopify/shop-minis-cli 0.0.35

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 (152) hide show
  1. package/README.md +8 -0
  2. package/build/commands/create-mini/index.d.ts +2 -0
  3. package/build/commands/create-mini/index.js +116 -0
  4. package/build/commands/create-mini/index.js.map +1 -0
  5. package/build/commands/create-mini/utils/template-app.d.ts +1 -0
  6. package/build/commands/create-mini/utils/template-app.js +44 -0
  7. package/build/commands/create-mini/utils/template-app.js.map +1 -0
  8. package/build/commands/dev/index.d.ts +6 -0
  9. package/build/commands/dev/index.js +31 -0
  10. package/build/commands/dev/index.js.map +1 -0
  11. package/build/commands/dev/utils/android.d.ts +16 -0
  12. package/build/commands/dev/utils/android.js +165 -0
  13. package/build/commands/dev/utils/android.js.map +1 -0
  14. package/build/commands/dev/utils/binaries.d.ts +83 -0
  15. package/build/commands/dev/utils/binaries.js +173 -0
  16. package/build/commands/dev/utils/binaries.js.map +1 -0
  17. package/build/commands/dev/utils/binaries.test.d.ts +1 -0
  18. package/build/commands/dev/utils/binaries.test.js +275 -0
  19. package/build/commands/dev/utils/binaries.test.js.map +1 -0
  20. package/build/commands/dev/utils/deeplink.d.ts +3 -0
  21. package/build/commands/dev/utils/deeplink.js +30 -0
  22. package/build/commands/dev/utils/deeplink.js.map +1 -0
  23. package/build/commands/dev/utils/interactive-terminal.d.ts +23 -0
  24. package/build/commands/dev/utils/interactive-terminal.js +252 -0
  25. package/build/commands/dev/utils/interactive-terminal.js.map +1 -0
  26. package/build/commands/dev/utils/metro/metro-config.d.ts +2 -0
  27. package/build/commands/dev/utils/metro/metro-config.js +31 -0
  28. package/build/commands/dev/utils/metro/metro-config.js.map +1 -0
  29. package/build/commands/dev/utils/metro/metro-reporter.d.ts +14 -0
  30. package/build/commands/dev/utils/metro/metro-reporter.js +34 -0
  31. package/build/commands/dev/utils/metro/metro-reporter.js.map +1 -0
  32. package/build/commands/dev/utils/metro/metro-server-middleware.d.ts +6 -0
  33. package/build/commands/dev/utils/metro/metro-server-middleware.js +45 -0
  34. package/build/commands/dev/utils/metro/metro-server-middleware.js.map +1 -0
  35. package/build/commands/dev/utils/metro/metro-server.d.ts +2 -0
  36. package/build/commands/dev/utils/metro/metro-server.js +24 -0
  37. package/build/commands/dev/utils/metro/metro-server.js.map +1 -0
  38. package/build/commands/dev/utils/minis-manifest.d.ts +1 -0
  39. package/build/commands/dev/utils/minis-manifest.js +24 -0
  40. package/build/commands/dev/utils/minis-manifest.js.map +1 -0
  41. package/build/commands/dev/utils/qr-code.d.ts +1 -0
  42. package/build/commands/dev/utils/qr-code.js +12 -0
  43. package/build/commands/dev/utils/qr-code.js.map +1 -0
  44. package/build/commands/dev/utils/simulator.d.ts +19 -0
  45. package/build/commands/dev/utils/simulator.js +89 -0
  46. package/build/commands/dev/utils/simulator.js.map +1 -0
  47. package/build/commands/dev/utils/with-retries.d.ts +4 -0
  48. package/build/commands/dev/utils/with-retries.js +28 -0
  49. package/build/commands/dev/utils/with-retries.js.map +1 -0
  50. package/build/commands/generate-graphql-types/index.d.ts +5 -0
  51. package/build/commands/generate-graphql-types/index.js +90 -0
  52. package/build/commands/generate-graphql-types/index.js.map +1 -0
  53. package/build/commands/utils/exec-async-child-process.d.ts +18 -0
  54. package/build/commands/utils/exec-async-child-process.js +48 -0
  55. package/build/commands/utils/exec-async-child-process.js.map +1 -0
  56. package/build/commands/utils/wrap-with-loading-indicator.d.ts +9 -0
  57. package/build/commands/utils/wrap-with-loading-indicator.js +23 -0
  58. package/build/commands/utils/wrap-with-loading-indicator.js.map +1 -0
  59. package/build/dev-panel/images/bottomsheet.png +0 -0
  60. package/build/dev-panel/images/checkmark.svg +3 -0
  61. package/build/dev-panel/images/chevron.svg +3 -0
  62. package/build/dev-panel/images/copy.svg +4 -0
  63. package/build/dev-panel/images/get-started.svg +3 -0
  64. package/build/dev-panel/images/how-to.svg +3 -0
  65. package/build/dev-panel/images/navigation.png +0 -0
  66. package/build/dev-panel/images/references.svg +3 -0
  67. package/build/dev-panel/images/shop-minis-logo-inverse.svg +5 -0
  68. package/build/dev-panel/images/shop-minis-logo.svg +5 -0
  69. package/build/dev-panel/images/stories.png +0 -0
  70. package/build/dev-panel/images/topics.svg +3 -0
  71. package/build/dev-panel/index.html +302 -0
  72. package/build/dev-panel/middleware.d.ts +4 -0
  73. package/build/dev-panel/middleware.js +11 -0
  74. package/build/dev-panel/middleware.js.map +1 -0
  75. package/build/dev-panel/middleware.ts +6 -0
  76. package/build/dev-panel/styles.css +507 -0
  77. package/build/index.d.ts +2 -0
  78. package/build/index.js +26 -0
  79. package/build/index.js.map +1 -0
  80. package/package.json +83 -0
  81. package/templates/__template_blank/src/custom.d.ts +4 -0
  82. package/templates/__template_blank/src/index.tsx +9 -0
  83. package/templates/__template_blank/src/screens/HomeScreen.tsx +12 -0
  84. package/templates/__template_blank/src/types.ts +5 -0
  85. package/templates/__template_common/.eslintignore +1 -0
  86. package/templates/__template_common/.eslintrc.json +132 -0
  87. package/templates/__template_common/.prettierrc.json +8 -0
  88. package/templates/__template_common/babel.config.js +19 -0
  89. package/templates/__template_common/gitignore +3 -0
  90. package/templates/__template_common/index.tsx +43 -0
  91. package/templates/__template_common/metro.config.js +31 -0
  92. package/templates/__template_common/package.json +68 -0
  93. package/templates/__template_common/patches/react-native+0.68.5.patch +173 -0
  94. package/templates/__template_common/src/manifest.json +29 -0
  95. package/templates/__template_common/tsconfig.json +36 -0
  96. package/templates/__template_hello_world/src/assets/Modal-component-thumbnail.png +0 -0
  97. package/templates/__template_hello_world/src/assets/ProductCard-component-thumbnail.png +0 -0
  98. package/templates/__template_hello_world/src/assets/ProductLink-component-thumbnail.png +0 -0
  99. package/templates/__template_hello_world/src/assets/assets.d.ts +4 -0
  100. package/templates/__template_hello_world/src/assets/figma-logo.svg +14 -0
  101. package/templates/__template_hello_world/src/assets/shop-minis-logo.svg +7 -0
  102. package/templates/__template_hello_world/src/components/ButtonCTA.tsx +31 -0
  103. package/templates/__template_hello_world/src/components/ComponentLink.ts +70 -0
  104. package/templates/__template_hello_world/src/components/ComponentListItem.tsx +38 -0
  105. package/templates/__template_hello_world/src/components/FeaturedComponents.tsx +108 -0
  106. package/templates/__template_hello_world/src/components/Header.tsx +40 -0
  107. package/templates/__template_hello_world/src/data/Test.graphql +33 -0
  108. package/templates/__template_hello_world/src/data/Test.graphql.d.ts +114 -0
  109. package/templates/__template_hello_world/src/data/TestProducts.graphql +34 -0
  110. package/templates/__template_hello_world/src/data/TestProducts.graphql.d.ts +119 -0
  111. package/templates/__template_hello_world/src/index.tsx +9 -0
  112. package/templates/__template_hello_world/src/routes.tsx +107 -0
  113. package/templates/__template_hello_world/src/screens/AvatarScreen.tsx +95 -0
  114. package/templates/__template_hello_world/src/screens/BottomSheetScreen.tsx +711 -0
  115. package/templates/__template_hello_world/src/screens/ButtonsScreen.tsx +90 -0
  116. package/templates/__template_hello_world/src/screens/GridScreen.tsx +74 -0
  117. package/templates/__template_hello_world/src/screens/HomeScreen.tsx +70 -0
  118. package/templates/__template_hello_world/src/screens/IconsScreen.tsx +181 -0
  119. package/templates/__template_hello_world/src/screens/MediaScreen.tsx +130 -0
  120. package/templates/__template_hello_world/src/screens/ModalScreen.tsx +379 -0
  121. package/templates/__template_hello_world/src/screens/ProductCardGridScreen.tsx +68 -0
  122. package/templates/__template_hello_world/src/screens/ProductCardScreen.tsx +62 -0
  123. package/templates/__template_hello_world/src/screens/ProductLinkScreen.tsx +215 -0
  124. package/templates/__template_hello_world/src/screens/ProgressIndicatorScreen.tsx +77 -0
  125. package/templates/__template_hello_world/src/screens/QuantityPickerScreen.tsx +76 -0
  126. package/templates/__template_hello_world/src/screens/SpinnerScreen.tsx +63 -0
  127. package/templates/__template_hello_world/src/screens/TypographyScreen.tsx +274 -0
  128. package/templates/__template_hello_world/src/screens/WebViewScreen.tsx +42 -0
  129. package/templates/__template_hello_world/src/types.ts +25 -0
  130. package/templates/__template_snowboardz/src/assets/assets.d.ts +4 -0
  131. package/templates/__template_snowboardz/src/assets/circle-blue.svg +9 -0
  132. package/templates/__template_snowboardz/src/assets/circle-green.svg +9 -0
  133. package/templates/__template_snowboardz/src/assets/circle-purple.svg +9 -0
  134. package/templates/__template_snowboardz/src/assets/circle-rainbow.svg +34 -0
  135. package/templates/__template_snowboardz/src/assets/circle-red.svg +9 -0
  136. package/templates/__template_snowboardz/src/assets/circle-yellow.svg +9 -0
  137. package/templates/__template_snowboardz/src/assets/skill-level-icon-advanced.svg +3 -0
  138. package/templates/__template_snowboardz/src/assets/skill-level-icon-beginner.svg +3 -0
  139. package/templates/__template_snowboardz/src/assets/skill-level-icon-intermediate.svg +3 -0
  140. package/templates/__template_snowboardz/src/components/ColorButton.tsx +79 -0
  141. package/templates/__template_snowboardz/src/components/ColorPicker.tsx +40 -0
  142. package/templates/__template_snowboardz/src/components/EmptyResult.tsx +52 -0
  143. package/templates/__template_snowboardz/src/components/SkillLevelIcon.tsx +44 -0
  144. package/templates/__template_snowboardz/src/components/SkillLevelPicker.tsx +86 -0
  145. package/templates/__template_snowboardz/src/data/TestProducts.graphql +34 -0
  146. package/templates/__template_snowboardz/src/data/TestProducts.graphql.d.ts +108 -0
  147. package/templates/__template_snowboardz/src/hooks/useSnowboardData.tsx +37 -0
  148. package/templates/__template_snowboardz/src/index.tsx +9 -0
  149. package/templates/__template_snowboardz/src/routes.tsx +17 -0
  150. package/templates/__template_snowboardz/src/screens/HomeScreen.tsx +126 -0
  151. package/templates/__template_snowboardz/src/types.ts +12 -0
  152. package/templates/__template_snowboardz/src/utils.ts +17 -0
@@ -0,0 +1,215 @@
1
+ import {
2
+ Box,
3
+ CurrencyCode,
4
+ ProductLink,
5
+ ProductLinkProps,
6
+ Text,
7
+ useTheme,
8
+ } from '@shopify/shop-minis-platform-sdk'
9
+ import {SafeAreaView} from 'react-native'
10
+
11
+ import {Header} from '../components/Header'
12
+
13
+ const FIXTURE: ProductLinkProps['product'] = {
14
+ __typename: 'Product',
15
+ id: 'gid://shopify/Product/7982547763222',
16
+ title: 'The Hero Snowboard',
17
+ featuredImage: {
18
+ __typename: 'Image',
19
+ id: 'gid://shopify/ProductImage/39774118445078',
20
+ altText: null,
21
+ url: 'https://cdn.shopify.com/s/files/1/0688/2233/5510/products/Main_52f8e304-92d9-4a36-82af-50df8fe31c69.jpg?v=1674664826',
22
+ },
23
+ variants: {
24
+ __typename: 'ProductVariantConnection',
25
+ nodes: [
26
+ {
27
+ __typename: 'ProductVariant',
28
+ id: 'gid://shopify/ProductVariant/43695288975382',
29
+ title: 'Default Title',
30
+ price: {
31
+ __typename: 'Money',
32
+ amount: '605.95',
33
+ currencyCode: CurrencyCode.USD,
34
+ },
35
+ image: {
36
+ __typename: 'Image',
37
+ id: 'gid://shopify/ProductImage/39774118445078',
38
+ altText: null,
39
+ url: 'https://cdn.shopify.com/s/files/1/0688/2233/5510/products/Main_52f8e304-92d9-4a36-82af-50df8fe31c69.jpg?v=1674664826',
40
+ },
41
+ },
42
+ ],
43
+ },
44
+ }
45
+
46
+ const FIXTURE_WITH_DISCOUNT: ProductLinkProps['product'] = {
47
+ __typename: 'Product',
48
+ id: 'gid://shopify/Product/7982547763222',
49
+ title: 'The Hero Snowboard',
50
+ featuredImage: {
51
+ __typename: 'Image',
52
+ id: 'gid://shopify/ProductImage/39774118445078',
53
+ altText: null,
54
+ url: 'https://cdn.shopify.com/s/files/1/0688/2233/5510/products/Main_52f8e304-92d9-4a36-82af-50df8fe31c69.jpg?v=1674664826',
55
+ },
56
+ variants: {
57
+ __typename: 'ProductVariantConnection',
58
+ nodes: [
59
+ {
60
+ __typename: 'ProductVariant',
61
+ id: 'gid://shopify/ProductVariant/43695288975382',
62
+ title: 'Default Title',
63
+ compareAtPrice: {
64
+ __typename: 'Money',
65
+ amount: '605.95',
66
+ currencyCode: CurrencyCode.USD,
67
+ },
68
+ price: {
69
+ __typename: 'Money',
70
+ amount: '555.95',
71
+ currencyCode: CurrencyCode.USD,
72
+ },
73
+ image: {
74
+ __typename: 'Image',
75
+ id: 'gid://shopify/ProductImage/39774118445078',
76
+ altText: null,
77
+ url: 'https://cdn.shopify.com/s/files/1/0688/2233/5510/products/Main_52f8e304-92d9-4a36-82af-50df8fe31c69.jpg?v=1674664826',
78
+ },
79
+ },
80
+ ],
81
+ },
82
+ }
83
+
84
+ const FIXTURE_WITH_DISCOUNT_BIG_MONEY: ProductLinkProps['product'] = {
85
+ __typename: 'Product',
86
+ id: 'gid://shopify/Product/7982547763222',
87
+ title: 'The Hero Snowboard',
88
+ featuredImage: {
89
+ __typename: 'Image',
90
+ id: 'gid://shopify/ProductImage/39774118445078',
91
+ altText: null,
92
+ url: 'https://cdn.shopify.com/s/files/1/0688/2233/5510/products/Main_52f8e304-92d9-4a36-82af-50df8fe31c69.jpg?v=1674664826',
93
+ },
94
+ variants: {
95
+ __typename: 'ProductVariantConnection',
96
+ nodes: [
97
+ {
98
+ __typename: 'ProductVariant',
99
+ id: 'gid://shopify/ProductVariant/43695288975382',
100
+ title: 'Default Title',
101
+ compareAtPrice: {
102
+ __typename: 'Money',
103
+ amount: '22605.95',
104
+ currencyCode: CurrencyCode.USD,
105
+ },
106
+ price: {
107
+ __typename: 'Money',
108
+ amount: '12555.95',
109
+ currencyCode: CurrencyCode.USD,
110
+ },
111
+ image: {
112
+ __typename: 'Image',
113
+ id: 'gid://shopify/ProductImage/39774118445078',
114
+ altText: null,
115
+ url: 'https://cdn.shopify.com/s/files/1/0688/2233/5510/products/Main_52f8e304-92d9-4a36-82af-50df8fe31c69.jpg?v=1674664826',
116
+ },
117
+ },
118
+ ],
119
+ },
120
+ }
121
+
122
+ const FIXTURE_WITH_MULTIPLE_VARIANTS: ProductLinkProps['product'] = {
123
+ __typename: 'Product',
124
+ id: 'gid://shopify/Product/7982547763222',
125
+ title: 'The Hero Snowboard',
126
+ featuredImage: {
127
+ __typename: 'Image',
128
+ id: 'gid://shopify/ProductImage/39774118445078',
129
+ altText: null,
130
+ url: 'https://cdn.shopify.com/s/files/1/0688/2233/5510/products/Main_52f8e304-92d9-4a36-82af-50df8fe31c69.jpg?v=1674664826',
131
+ },
132
+ variants: {
133
+ __typename: 'ProductVariantConnection',
134
+ nodes: [
135
+ {
136
+ __typename: 'ProductVariant',
137
+ id: 'gid://shopify/ProductVariant/43695288975382',
138
+ title: 'Default Title',
139
+ price: {
140
+ __typename: 'Money',
141
+ amount: '605.95',
142
+ currencyCode: CurrencyCode.USD,
143
+ },
144
+ image: {
145
+ __typename: 'Image',
146
+ id: 'gid://shopify/ProductImage/39774118445078',
147
+ altText: null,
148
+ url: 'https://cdn.shopify.com/s/files/1/0688/2233/5510/products/Main_52f8e304-92d9-4a36-82af-50df8fe31c69.jpg?v=1674664826',
149
+ },
150
+ },
151
+ {
152
+ __typename: 'ProductVariant',
153
+ id: 'gid://shopify/ProductVariant/43695281569814',
154
+ title: 'Default Title',
155
+ price: {
156
+ __typename: 'Money',
157
+ amount: '577.95',
158
+ currencyCode: CurrencyCode.USD,
159
+ },
160
+ image: {
161
+ __typename: 'Image',
162
+ id: 'gid://shopify/ProductImage/39774117986326',
163
+ altText: null,
164
+ url: 'https://cdn.shopify.com/s/files/1/0688/2233/5510/products/Main.jpg?v=1674664528',
165
+ },
166
+ },
167
+ ],
168
+ },
169
+ }
170
+
171
+ export const ProductLinkScreen = () => {
172
+ const theme = useTheme()
173
+ return (
174
+ <SafeAreaView
175
+ style={{flex: 1, backgroundColor: theme.colors['backgrounds-regular']}}
176
+ >
177
+ <Header />
178
+ <Box px="gutter">
179
+ <Text variant="headerBold" mb="xs">
180
+ ProductLink
181
+ </Text>
182
+ <Box marginBottom="m">
183
+ <Text variant="bodyLarge" mb="xs">
184
+ Default
185
+ </Text>
186
+ <ProductLink product={FIXTURE} />
187
+ </Box>
188
+
189
+ <Box marginBottom="m">
190
+ <Text variant="bodyLarge" mb="xs">
191
+ With discount
192
+ </Text>
193
+ <ProductLink product={FIXTURE_WITH_DISCOUNT} />
194
+ </Box>
195
+
196
+ <Box marginBottom="m">
197
+ <Text variant="bodyLarge" mb="xs">
198
+ With large discount
199
+ </Text>
200
+ <ProductLink product={FIXTURE_WITH_DISCOUNT_BIG_MONEY} />
201
+ </Box>
202
+
203
+ <Box marginBottom="m">
204
+ <Text variant="bodyLarge" mb="xs">
205
+ With variant selection
206
+ </Text>
207
+ <ProductLink
208
+ product={FIXTURE_WITH_MULTIPLE_VARIANTS}
209
+ productVariantId="gid://shopify/ProductVariant/43695281569814"
210
+ />
211
+ </Box>
212
+ </Box>
213
+ </SafeAreaView>
214
+ )
215
+ }
@@ -0,0 +1,77 @@
1
+ import {useCallback, useState} from 'react'
2
+ import {SafeAreaView} from 'react-native'
3
+ import {
4
+ Box,
5
+ Text,
6
+ ProgressIndicators,
7
+ Button,
8
+ useTheme,
9
+ } from '@shopify/shop-minis-platform-sdk'
10
+ import {runOnJS, useSharedValue, withTiming} from 'react-native-reanimated'
11
+
12
+ import {Header} from '../components/Header'
13
+
14
+ const PROGRESS_INDICATORS = 10
15
+
16
+ export const ProgressIndicatorScreen = () => {
17
+ const theme = useTheme()
18
+ const currentActiveAnimatedIndicator = useSharedValue(0)
19
+ const progress = useSharedValue(0)
20
+
21
+ const [currentActive, setCurrentActive] = useState(
22
+ currentActiveAnimatedIndicator.value
23
+ )
24
+
25
+ const startProgressIndicator = useCallback(() => {
26
+ progress.value = withTiming(1, {duration: 5000}, finished => {
27
+ if (
28
+ finished &&
29
+ currentActiveAnimatedIndicator.value < PROGRESS_INDICATORS - 1
30
+ ) {
31
+ currentActiveAnimatedIndicator.value += 1
32
+ progress.value = 0
33
+ runOnJS(setCurrentActive)(currentActiveAnimatedIndicator.value)
34
+
35
+ runOnJS(startProgressIndicator)()
36
+ }
37
+ })
38
+ }, [progress, currentActiveAnimatedIndicator])
39
+
40
+ const reset = useCallback(() => {
41
+ currentActiveAnimatedIndicator.value = 0
42
+ progress.value = 0
43
+ setCurrentActive(0)
44
+ }, [currentActiveAnimatedIndicator, progress])
45
+
46
+ return (
47
+ <SafeAreaView
48
+ style={{flex: 1, backgroundColor: theme.colors['backgrounds-regular']}}
49
+ >
50
+ <Header />
51
+ <Box flex={1} px="gutter">
52
+ <Text variant="headerBold">ProgressIndicators</Text>
53
+
54
+ <Box
55
+ my="s"
56
+ padding="m"
57
+ backgroundColor="backgrounds-overlay"
58
+ borderRadius={16}
59
+ flex={1}
60
+ >
61
+ <ProgressIndicators
62
+ numberOfIndicators={PROGRESS_INDICATORS}
63
+ currentStep={currentActive}
64
+ progress={progress}
65
+ width="100%"
66
+ />
67
+ <Box marginTop="s">
68
+ <Button onPress={startProgressIndicator} text="Start" />
69
+ </Box>
70
+ <Box marginTop="s">
71
+ <Button onPress={reset} text="Stop and reset" variant="secondary" />
72
+ </Box>
73
+ </Box>
74
+ </Box>
75
+ </SafeAreaView>
76
+ )
77
+ }
@@ -0,0 +1,76 @@
1
+ import {useState} from 'react'
2
+ import {SafeAreaView, ScrollView} from 'react-native'
3
+ import {
4
+ Box,
5
+ QuantityPicker,
6
+ QuantityPickerProps,
7
+ Text,
8
+ } from '@shopify/shop-minis-platform-sdk'
9
+
10
+ import {Header} from '../components/Header'
11
+
12
+ export const QuantityPickerScreen = () => {
13
+ return (
14
+ <SafeAreaView style={{flex: 1}}>
15
+ <ScrollView style={{flex: 1}}>
16
+ <Header />
17
+ <Box px="gutter">
18
+ <Text variant="heroBold">QuantityPicker</Text>
19
+
20
+ <Box paddingTop="m">
21
+ <Text>No limits</Text>
22
+ </Box>
23
+
24
+ <Box paddingTop="xs">
25
+ <StatefulQuantityPicker quantity={1} disabled={false} />
26
+ </Box>
27
+
28
+ <Box paddingTop="m">
29
+ <Text>Maximum 10 items</Text>
30
+ </Box>
31
+
32
+ <Box paddingTop="xs">
33
+ <StatefulQuantityPicker
34
+ quantity={1}
35
+ maxQuantity={10}
36
+ disabled={false}
37
+ />
38
+ </Box>
39
+
40
+ <Box paddingTop="m">
41
+ <Text>Disabled</Text>
42
+ </Box>
43
+
44
+ <Box paddingTop="xs">
45
+ <StatefulQuantityPicker quantity={5} disabled />
46
+ </Box>
47
+
48
+ <Box paddingTop="m">
49
+ <Text>With Label</Text>
50
+ </Box>
51
+
52
+ <Box paddingTop="xs">
53
+ <StatefulQuantityPicker label="Quantity" quantity={5} />
54
+ </Box>
55
+ </Box>
56
+ </ScrollView>
57
+ </SafeAreaView>
58
+ )
59
+ }
60
+
61
+ type StatefulQuantityPickerProps = Omit<QuantityPickerProps, 'onQuantityChange'>
62
+
63
+ function StatefulQuantityPicker({
64
+ quantity: initialQuantity,
65
+ ...props
66
+ }: StatefulQuantityPickerProps) {
67
+ const [quantity, setQuantity] = useState<number>(initialQuantity)
68
+
69
+ return (
70
+ <QuantityPicker
71
+ {...props}
72
+ quantity={quantity}
73
+ onQuantityChange={setQuantity}
74
+ />
75
+ )
76
+ }
@@ -0,0 +1,63 @@
1
+ import {SafeAreaView, ScrollView} from 'react-native'
2
+ import {Box, Spinner, Text, useTheme} from '@shopify/shop-minis-platform-sdk'
3
+
4
+ import {Header} from '../components/Header'
5
+
6
+ export const SpinnerScreen = () => {
7
+ const theme = useTheme()
8
+ return (
9
+ <SafeAreaView
10
+ style={{flex: 1, backgroundColor: theme.colors['backgrounds-regular']}}
11
+ >
12
+ <ScrollView style={{flex: 1}}>
13
+ <Header />
14
+ <Box px="gutter">
15
+ <Text variant="headerBold" mb="xs">
16
+ Spinner
17
+ </Text>
18
+ </Box>
19
+ <Box px="gutter" py="m">
20
+ <Text>Large (default)</Text>
21
+ <Box
22
+ flex={1}
23
+ justifyContent="center"
24
+ alignItems="center"
25
+ px="xs"
26
+ py="m"
27
+ mt="s"
28
+ >
29
+ <Spinner />
30
+ </Box>
31
+ </Box>
32
+ <Box px="gutter" py="m">
33
+ <Text>Small</Text>
34
+ <Box
35
+ flex={1}
36
+ justifyContent="center"
37
+ alignItems="center"
38
+ px="xs"
39
+ py="m"
40
+ mt="s"
41
+ >
42
+ <Spinner size="small" />
43
+ </Box>
44
+ </Box>
45
+ <Box px="gutter" py="m">
46
+ <Text>For dark backgrounds</Text>
47
+ <Box
48
+ flex={1}
49
+ justifyContent="center"
50
+ alignItems="center"
51
+ px="xs"
52
+ py="m"
53
+ mt="s"
54
+ backgroundColor="foregrounds-contrasting-inverted"
55
+ borderRadius={16}
56
+ >
57
+ <Spinner dark />
58
+ </Box>
59
+ </Box>
60
+ </ScrollView>
61
+ </SafeAreaView>
62
+ )
63
+ }