@utilitywarehouse/hearth-react-native 0.11.0 → 0.13.0

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 (202) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-lint.log +1 -1
  3. package/CHANGELOG.md +16 -0
  4. package/build/components/Accordion/AccordionTrigger.js +1 -1
  5. package/build/components/Banner/Banner.context.d.ts +7 -0
  6. package/build/components/Banner/Banner.context.js +8 -0
  7. package/build/components/Banner/Banner.js +10 -40
  8. package/build/components/Banner/Banner.props.d.ts +3 -5
  9. package/build/components/Banner/BannerIllustration.d.ts +4 -0
  10. package/build/components/Banner/BannerIllustration.js +53 -0
  11. package/build/components/Banner/BannerImage.d.ts +4 -0
  12. package/build/components/Banner/BannerImage.js +53 -0
  13. package/build/components/Banner/index.d.ts +2 -0
  14. package/build/components/Banner/index.js +2 -0
  15. package/build/components/Card/CardAction/CardAction.props.d.ts +2 -3
  16. package/build/components/Card/CardAction/CardActionRoot.js +1 -2
  17. package/build/components/Checkbox/Checkbox.js +1 -2
  18. package/build/components/Checkbox/Checkbox.props.d.ts +3 -3
  19. package/build/components/Checkbox/CheckboxImage.d.ts +2 -1
  20. package/build/components/Checkbox/CheckboxImage.js +8 -1
  21. package/build/components/Checkbox/CheckboxIndicator.js +3 -3
  22. package/build/components/DatePicker/DatePickerDay.js +3 -3
  23. package/build/components/ExpandableCard/ExpandableCard.props.d.ts +1 -2
  24. package/build/components/ExpandableCard/ExpandableCardTrigger.props.d.ts +4 -5
  25. package/build/components/ExpandableCard/ExpandableCardTriggerRoot.js +1 -14
  26. package/build/components/HighlightBanner/HighlightBanner.js +2 -6
  27. package/build/components/HighlightBanner/HighlightBanner.props.d.ts +2 -3
  28. package/build/components/HighlightBanner/HighlightBannerImage.d.ts +4 -0
  29. package/build/components/HighlightBanner/HighlightBannerImage.js +18 -0
  30. package/build/components/HighlightBanner/index.d.ts +1 -0
  31. package/build/components/HighlightBanner/index.js +1 -0
  32. package/build/components/Input/Input.d.ts +5 -7
  33. package/build/components/Input/Input.js +11 -4
  34. package/build/components/Input/InputField.d.ts +4 -7
  35. package/build/components/Input/InputField.js +6 -5
  36. package/build/components/List/ListItem/ListItem.props.d.ts +2 -2
  37. package/build/components/List/ListItem/ListItemRoot.js +1 -2
  38. package/build/components/Modal/Modal.js +2 -6
  39. package/build/components/Modal/Modal.props.d.ts +3 -2
  40. package/build/components/Modal/Modal.web.js +2 -6
  41. package/build/components/Modal/ModalImage.d.ts +4 -0
  42. package/build/components/Modal/ModalImage.js +18 -0
  43. package/build/components/Modal/index.d.ts +1 -0
  44. package/build/components/Modal/index.js +1 -0
  45. package/build/components/PillGroup/Pill.js +2 -2
  46. package/build/components/Radio/Radio.js +1 -2
  47. package/build/components/Radio/Radio.props.d.ts +3 -3
  48. package/build/components/Radio/RadioImage.d.ts +2 -1
  49. package/build/components/Radio/RadioImage.js +8 -1
  50. package/build/components/Radio/RadioIndicator.js +3 -3
  51. package/build/components/RadioCard/RadioCardIndicator.js +3 -3
  52. package/build/components/RadioCard/RadioCardRoot.js +3 -3
  53. package/build/components/Tabs/Tab.js +5 -5
  54. package/build/components/ToggleButton/ToggleButtonRoot.js +2 -2
  55. package/build/components/ToggleButtonCard/ToggleButtonCardRoot.js +3 -3
  56. package/build/components/UnstyledIconButton/UnstyledIconButtonRoot.js +1 -1
  57. package/build/components/VerificationInput/VerificationInput.d.ts +6 -0
  58. package/build/components/VerificationInput/VerificationInput.js +35 -0
  59. package/build/components/VerificationInput/VerificationInput.props.d.ts +49 -0
  60. package/build/components/VerificationInput/VerificationInput.props.js +1 -0
  61. package/build/components/VerificationInput/VerificationInputSlot.d.ts +9 -0
  62. package/build/components/VerificationInput/VerificationInputSlot.js +72 -0
  63. package/build/components/VerificationInput/index.d.ts +4 -0
  64. package/build/components/VerificationInput/index.js +3 -0
  65. package/build/components/VerificationInput/useVerificationInput.d.ts +14 -0
  66. package/build/components/VerificationInput/useVerificationInput.js +58 -0
  67. package/build/components/index.d.ts +1 -0
  68. package/build/components/index.js +1 -0
  69. package/build/utils/index.d.ts +2 -1
  70. package/build/utils/index.js +2 -1
  71. package/build/utils/isThemedImageProps.d.ts +4 -0
  72. package/build/utils/isThemedImageProps.js +4 -0
  73. package/docs/components/AllComponents.web.tsx +9 -0
  74. package/package.json +11 -12
  75. package/src/components/Accordion/Accordion.figma.tsx +23 -0
  76. package/src/components/Accordion/AccordionItemRoot.figma.tsx +47 -0
  77. package/src/components/Accordion/AccordionTrigger.tsx +1 -1
  78. package/src/components/Alert/Alert.figma.tsx +47 -0
  79. package/src/components/Avatar/Avatar.figma.tsx +33 -0
  80. package/src/components/Badge/Badge.figma.tsx +48 -24
  81. package/src/components/Banner/Banner.context.ts +11 -0
  82. package/src/components/Banner/Banner.docs.mdx +55 -37
  83. package/src/components/Banner/Banner.figma.tsx +15 -0
  84. package/src/components/Banner/Banner.props.ts +3 -5
  85. package/src/components/Banner/Banner.stories.tsx +86 -57
  86. package/src/components/Banner/Banner.tsx +24 -67
  87. package/src/components/Banner/BannerIllustration.figma.tsx +30 -0
  88. package/src/components/Banner/BannerIllustration.tsx +63 -0
  89. package/src/components/Banner/BannerImage.tsx +63 -0
  90. package/src/components/Banner/index.ts +2 -0
  91. package/src/components/BottomSheet/BottomSheetModal.figma.tsx +20 -0
  92. package/src/components/Button/Button.figma.tsx +60 -229
  93. package/src/components/Card/Card.docs.mdx +4 -4
  94. package/src/components/Card/Card.figma.tsx +43 -71
  95. package/src/components/Card/CardAction/CardAction.figma.tsx +44 -0
  96. package/src/components/Card/CardAction/CardAction.props.ts +2 -3
  97. package/src/components/Card/CardAction/CardAction.stories.tsx +5 -4
  98. package/src/components/Card/CardAction/CardActionRoot.tsx +4 -5
  99. package/src/components/Carousel/Carousel.figma.tsx +19 -0
  100. package/src/components/Checkbox/Checkbox.docs.mdx +23 -4
  101. package/src/components/Checkbox/Checkbox.figma.tsx +26 -41
  102. package/src/components/Checkbox/Checkbox.props.ts +3 -3
  103. package/src/components/Checkbox/Checkbox.stories.tsx +14 -8
  104. package/src/components/Checkbox/Checkbox.tsx +1 -2
  105. package/src/components/Checkbox/CheckboxGroup.figma.tsx +20 -0
  106. package/src/components/Checkbox/CheckboxImage.figma.tsx +27 -0
  107. package/src/components/Checkbox/CheckboxImage.tsx +8 -3
  108. package/src/components/Checkbox/CheckboxIndicator.tsx +3 -3
  109. package/src/components/Checkbox/CheckboxTileRoot.figma.tsx +32 -0
  110. package/src/components/CurrencyInput/CurrencyInput.figma.tsx +56 -0
  111. package/src/components/DateInput/DateInput.figma.tsx +75 -0
  112. package/src/components/DatePicker/DatePickerCalendar.figma.tsx +34 -0
  113. package/src/components/DatePicker/DatePickerDay.tsx +3 -3
  114. package/src/components/DatePickerInput/DatePickerInput.figma.tsx +62 -0
  115. package/src/components/DescriptionList/DescriptionList.figma.tsx +23 -0
  116. package/src/components/Divider/Divider.figma.tsx +23 -18
  117. package/src/components/ExpandableCard/ExpandableCard.docs.mdx +2 -2
  118. package/src/components/ExpandableCard/ExpandableCard.figma.tsx +54 -0
  119. package/src/components/ExpandableCard/ExpandableCard.props.ts +1 -2
  120. package/src/components/ExpandableCard/ExpandableCard.stories.tsx +3 -3
  121. package/src/components/ExpandableCard/ExpandableCardGroup.figma.tsx +23 -0
  122. package/src/components/ExpandableCard/ExpandableCardTrigger.props.ts +4 -5
  123. package/src/components/ExpandableCard/ExpandableCardTriggerRoot.tsx +2 -17
  124. package/src/components/FormField/FormField.figma.tsx +23 -0
  125. package/src/components/Helper/HelperText.figma.tsx +23 -0
  126. package/src/components/HighlightBanner/HighlightBanner.docs.mdx +73 -42
  127. package/src/components/HighlightBanner/HighlightBanner.props.ts +2 -3
  128. package/src/components/HighlightBanner/HighlightBanner.stories.tsx +85 -60
  129. package/src/components/HighlightBanner/HighlightBanner.tsx +3 -10
  130. package/src/components/HighlightBanner/HighlightBannerImage.tsx +20 -0
  131. package/src/components/HighlightBanner/index.ts +1 -0
  132. package/src/components/IconButton/IconButton.figma.tsx +55 -161
  133. package/src/components/IconContainer/IconContainer.figma.tsx +50 -0
  134. package/src/components/InlineLink/InlineLink.figma.tsx +33 -0
  135. package/src/components/Input/Input.figma.tsx +52 -110
  136. package/src/components/Input/Input.stories.tsx +76 -3
  137. package/src/components/Input/Input.tsx +110 -98
  138. package/src/components/Input/InputField.tsx +27 -26
  139. package/src/components/Label/Label.figma.tsx +24 -0
  140. package/src/components/Link/Link.figma.tsx +42 -0
  141. package/src/components/List/List.docs.mdx +15 -9
  142. package/src/components/List/List.figma.tsx +29 -108
  143. package/src/components/List/List.stories.tsx +2 -2
  144. package/src/components/List/ListAction/ListAction.figma.tsx +29 -0
  145. package/src/components/List/ListItem/ListItem.figma.tsx +40 -220
  146. package/src/components/List/ListItem/ListItem.props.ts +2 -2
  147. package/src/components/List/ListItem/ListItemLeadingContent.figma.tsx +29 -0
  148. package/src/components/List/ListItem/ListItemRoot.tsx +2 -3
  149. package/src/components/List/ListItem/ListItemTrailingContent.figma.tsx +27 -0
  150. package/src/components/Menu/Menu.figma.tsx +30 -0
  151. package/src/components/Menu/MenuItem.figma.tsx +31 -0
  152. package/src/components/Modal/Modal.docs.mdx +16 -4
  153. package/src/components/Modal/Modal.figma.tsx +56 -0
  154. package/src/components/Modal/Modal.props.ts +3 -2
  155. package/src/components/Modal/Modal.stories.tsx +2 -5
  156. package/src/components/Modal/Modal.tsx +2 -6
  157. package/src/components/Modal/Modal.web.tsx +2 -6
  158. package/src/components/Modal/ModalImage.tsx +20 -0
  159. package/src/components/Modal/index.ts +1 -0
  160. package/src/components/PillGroup/Pill.figma.tsx +25 -0
  161. package/src/components/PillGroup/Pill.tsx +3 -3
  162. package/src/components/PillGroup/PillGroup.figma.tsx +21 -0
  163. package/src/components/PillGroup/PillGroup.stories.tsx +1 -1
  164. package/src/components/ProgressStepper/ProgressStep.figma.tsx +30 -0
  165. package/src/components/ProgressStepper/ProgressStepper.figma.tsx +20 -0
  166. package/src/components/Radio/Radio.docs.mdx +21 -8
  167. package/src/components/Radio/Radio.figma.tsx +22 -42
  168. package/src/components/Radio/Radio.props.ts +3 -3
  169. package/src/components/Radio/Radio.stories.tsx +15 -11
  170. package/src/components/Radio/Radio.tsx +1 -2
  171. package/src/components/Radio/RadioGroup.figma.tsx +54 -0
  172. package/src/components/Radio/RadioImage.figma.tsx +27 -0
  173. package/src/components/Radio/RadioImage.tsx +8 -3
  174. package/src/components/Radio/RadioIndicator.tsx +3 -3
  175. package/src/components/Radio/RadioTileRoot.figma.tsx +31 -0
  176. package/src/components/RadioCard/RadioCardIndicator.tsx +3 -3
  177. package/src/components/RadioCard/RadioCardRoot.tsx +3 -3
  178. package/src/components/SectionHeader/SectionHeader.figma.tsx +30 -16
  179. package/src/components/Select/Select.figma.tsx +55 -0
  180. package/src/components/Select/SelectOption.figma.tsx +36 -0
  181. package/src/components/Spinner/Spinner.figma.tsx +20 -12
  182. package/src/components/Switch/Switch.figma.tsx +31 -23
  183. package/src/components/Tabs/Tab.tsx +5 -5
  184. package/src/components/Tabs/Tabs.figma.tsx +29 -0
  185. package/src/components/ThemedImage/ThemedImage.stories.tsx +1 -1
  186. package/src/components/Toast/ToastItem.figma.tsx +22 -0
  187. package/src/components/ToggleButton/ToggleButtonRoot.tsx +2 -2
  188. package/src/components/ToggleButtonCard/ToggleButtonCardRoot.tsx +3 -3
  189. package/src/components/UnstyledIconButton/UnstyledIconButton.figma.tsx +49 -0
  190. package/src/components/UnstyledIconButton/UnstyledIconButtonRoot.tsx +1 -1
  191. package/src/components/VerificationInput/VerificationInput.docs.mdx +68 -0
  192. package/src/components/VerificationInput/VerificationInput.props.ts +52 -0
  193. package/src/components/VerificationInput/VerificationInput.stories.tsx +140 -0
  194. package/src/components/VerificationInput/VerificationInput.tsx +89 -0
  195. package/src/components/VerificationInput/VerificationInputSlot.tsx +94 -0
  196. package/src/components/VerificationInput/index.ts +5 -0
  197. package/src/components/VerificationInput/useVerificationInput.ts +72 -0
  198. package/src/components/index.ts +1 -0
  199. package/src/utils/index.ts +2 -1
  200. package/src/utils/isThemedImageProps.ts +8 -0
  201. package/src/components/Checkbox/CheckboxIndicator.figma.tsx +0 -19
  202. package/src/components/Radio/RadioIndicator.figma.tsx +0 -21
@@ -1,7 +1,5 @@
1
- import type { ComponentType, ReactElement } from 'react';
2
- import { ImageProps } from 'react-native';
1
+ import type { ComponentType, ReactElement, ReactNode } from 'react';
3
2
  import type CardProps from '../Card/Card.props';
4
- import { ThemedImageProps } from '../ThemedImage';
5
3
 
6
4
  export type BannerDirection = 'horizontal' | 'vertical';
7
5
 
@@ -51,12 +49,12 @@ export interface BannerProps
51
49
  * Illustration to display in the banner
52
50
  * Mutually exclusive with icon and image
53
51
  */
54
- illustration?: ThemedImageProps | ImageProps;
52
+ illustration?: ReactNode;
55
53
  /**
56
54
  * Image to display in the banner
57
55
  * Mutually exclusive with icon and illustration
58
56
  */
59
- image?: ThemedImageProps | ImageProps;
57
+ image?: ReactNode;
60
58
  /**
61
59
  * Heading text
62
60
  */
@@ -13,6 +13,8 @@ import { Button } from '../Button';
13
13
  import { Flex } from '../Flex';
14
14
  import { Link } from '../Link';
15
15
  import Banner from './Banner';
16
+ import BannerIllustration from './BannerIllustration';
17
+ import BannerImage from './BannerImage';
16
18
 
17
19
  const meta = {
18
20
  title: 'Stories / Banner',
@@ -128,23 +130,35 @@ export const WithIllustration: Story = {
128
130
  <View style={{ width: 400 }}>
129
131
  <Flex space="lg" direction="column">
130
132
  <Banner
131
- illustration={{
132
- // @ts-ignore
133
- light: <SpotBillingLight width={80} height={80} />,
134
- // @ts-ignore
135
- dark: <SpotBillingDark width={80} height={80} />,
136
- }}
133
+ illustration={
134
+ <BannerIllustration
135
+ light={
136
+ // @ts-ignore
137
+ <SpotBillingLight width={80} height={80} />
138
+ }
139
+ dark={
140
+ // @ts-ignore
141
+ <SpotBillingDark width={80} height={80} />
142
+ }
143
+ />
144
+ }
137
145
  heading="Featured Content"
138
146
  description="Discover amazing content curated just for you."
139
147
  />
140
148
  <Banner
141
149
  direction="vertical"
142
- illustration={{
143
- // @ts-ignore
144
- light: <SpotBillingLight width={120} height={120} />,
145
- // @ts-ignore
146
- dark: <SpotBillingDark width={120} height={120} />,
147
- }}
150
+ illustration={
151
+ <BannerIllustration
152
+ light={
153
+ // @ts-ignore
154
+ <SpotBillingLight width={120} height={120} />
155
+ }
156
+ dark={
157
+ // @ts-ignore
158
+ <SpotBillingDark width={120} height={120} />
159
+ }
160
+ />
161
+ }
148
162
  heading="Special Offer"
149
163
  description="Limited time offer on selected services."
150
164
  />
@@ -160,27 +174,31 @@ export const WithImage: Story = {
160
174
  <View style={{ width: 400 }}>
161
175
  <Flex space="lg" direction="column">
162
176
  <Banner
163
- image={{
164
- light: {
165
- uri: 'https://images.unsplash.com/photo-1506126613408-eca07ce68773?w=200&q=80',
166
- },
167
- dark: {
168
- uri: 'https://images.unsplash.com/photo-1506126613408-eca07ce68773?w=200&q=80',
169
- },
170
- }}
177
+ image={
178
+ <BannerImage
179
+ light={{
180
+ uri: 'https://images.unsplash.com/photo-1506126613408-eca07ce68773?w=200&q=80',
181
+ }}
182
+ dark={{
183
+ uri: 'https://images.unsplash.com/photo-1506126613408-eca07ce68773?w=200&q=80',
184
+ }}
185
+ />
186
+ }
171
187
  heading="Featured Content"
172
188
  description="Discover amazing content curated just for you."
173
189
  />
174
190
  <Banner
175
191
  direction="vertical"
176
- image={{
177
- light: {
178
- uri: 'https://images.unsplash.com/photo-1473186578172-c141e6798cf4?w=200&q=80',
179
- },
180
- dark: {
181
- uri: 'https://images.unsplash.com/photo-1473186578172-c141e6798cf4?w=200&q=80',
182
- },
183
- }}
192
+ image={
193
+ <BannerImage
194
+ light={{
195
+ uri: 'https://images.unsplash.com/photo-1473186578172-c141e6798cf4?w=200&q=80',
196
+ }}
197
+ dark={{
198
+ uri: 'https://images.unsplash.com/photo-1473186578172-c141e6798cf4?w=200&q=80',
199
+ }}
200
+ />
201
+ }
184
202
  heading="Special Offer"
185
203
  description="Limited time offer on selected services."
186
204
  />
@@ -262,14 +280,16 @@ export const Pressable: Story = {
262
280
  onPress={() => console.log('Banner pressed')}
263
281
  />
264
282
  <Banner
265
- image={{
266
- light: {
267
- uri: 'https://images.unsplash.com/photo-1506126613408-eca07ce68773?w=200&q=80',
268
- },
269
- dark: {
270
- uri: 'https://images.unsplash.com/photo-1506126613408-eca07ce68773?w=200&q=80',
271
- },
272
- }}
283
+ image={
284
+ <BannerImage
285
+ light={{
286
+ uri: 'https://images.unsplash.com/photo-1506126613408-eca07ce68773?w=200&q=80',
287
+ }}
288
+ dark={{
289
+ uri: 'https://images.unsplash.com/photo-1506126613408-eca07ce68773?w=200&q=80',
290
+ }}
291
+ />
292
+ }
273
293
  heading="Account Settings"
274
294
  description="Manage your account preferences."
275
295
  onPress={() => console.log('Banner pressed')}
@@ -325,11 +345,16 @@ export const VerticalLayout: Story = {
325
345
  />
326
346
  <Banner
327
347
  variant="emphasis"
328
- image={{
329
- source: {
330
- uri: 'https://images.unsplash.com/photo-1506126613408-eca07ce68773?w=200&q=80',
331
- },
332
- }}
348
+ image={
349
+ <BannerImage
350
+ light={{
351
+ uri: 'https://images.unsplash.com/photo-1506126613408-eca07ce68773?w=200&q=80',
352
+ }}
353
+ dark={{
354
+ uri: 'https://images.unsplash.com/photo-1506126613408-eca07ce68773?w=200&q=80',
355
+ }}
356
+ />
357
+ }
333
358
  heading="Featured Content"
334
359
  description="Discover amazing content curated just for you."
335
360
  shadowColor="brand"
@@ -443,14 +468,16 @@ export const EmphasisVariant: Story = {
443
468
  variant="emphasis"
444
469
  />
445
470
  <Banner
446
- image={{
447
- light: {
448
- uri: 'https://images.unsplash.com/photo-1473186578172-c141e6798cf4?w=200&q=80',
449
- },
450
- dark: {
451
- uri: 'https://images.unsplash.com/photo-1473186578172-c141e6798cf4?w=200&q=80',
452
- },
453
- }}
471
+ image={
472
+ <BannerImage
473
+ light={{
474
+ uri: 'https://images.unsplash.com/photo-1473186578172-c141e6798cf4?w=200&q=80',
475
+ }}
476
+ dark={{
477
+ uri: 'https://images.unsplash.com/photo-1473186578172-c141e6798cf4?w=200&q=80',
478
+ }}
479
+ />
480
+ }
454
481
  heading="Featured Offer"
455
482
  description="Limited time deal on premium services."
456
483
  variant="emphasis"
@@ -486,14 +513,16 @@ export const ComplexExample: Story = {
486
513
  onPress={() => console.log('Banner pressed')}
487
514
  />
488
515
  <Banner
489
- image={{
490
- light: {
491
- uri: 'https://images.unsplash.com/photo-1501594907352-04cda38ebc29?w=200&q=80',
492
- },
493
- dark: {
494
- uri: 'https://images.unsplash.com/photo-1501594907352-04cda38ebc29?w=200&q=80',
495
- },
496
- }}
516
+ image={
517
+ <BannerImage
518
+ light={{
519
+ uri: 'https://images.unsplash.com/photo-1501594907352-04cda38ebc29?w=200&q=80',
520
+ }}
521
+ dark={{
522
+ uri: 'https://images.unsplash.com/photo-1501594907352-04cda38ebc29?w=200&q=80',
523
+ }}
524
+ />
525
+ }
497
526
  heading="Exclusive Member Benefit"
498
527
  description="As a valued member, you now have access to premium features at no extra cost."
499
528
  variant="emphasis"
@@ -1,18 +1,15 @@
1
1
  import { ChevronRightSmallIcon, CloseSmallIcon } from '@utilitywarehouse/hearth-react-native-icons';
2
- import { Image, ImageProps, Pressable, View } from 'react-native';
2
+ import { useMemo } from 'react';
3
+ import { Pressable, View } from 'react-native';
3
4
  import { StyleSheet } from 'react-native-unistyles';
4
5
  import { BodyText } from '../BodyText';
5
6
  import { Card } from '../Card';
6
7
  import { Heading } from '../Heading';
7
8
  import { IconContainer } from '../IconContainer';
8
- import { ThemedImage, ThemedImageProps } from '../ThemedImage';
9
9
  import { UnstyledIconButton } from '../UnstyledIconButton';
10
+ import BannerContext from './Banner.context';
10
11
  import type BannerProps from './Banner.props';
11
12
 
12
- const isThemedImageProps = (props: ThemedImageProps | ImageProps): props is ThemedImageProps => {
13
- return 'light' in props && 'dark' in props;
14
- };
15
-
16
13
  const Banner = ({
17
14
  icon,
18
15
  iconContainerVariant = 'subtle',
@@ -35,6 +32,13 @@ const Banner = ({
35
32
  const hasIllustration = Boolean(illustration);
36
33
  styles.useVariants({ direction, hasIllustration });
37
34
 
35
+ const context = useMemo(
36
+ () => ({
37
+ direction,
38
+ }),
39
+ [direction]
40
+ );
41
+
38
42
  const renderIconOrImage = () => {
39
43
  if (icon) {
40
44
  return (
@@ -48,36 +52,10 @@ const Banner = ({
48
52
  );
49
53
  }
50
54
  if (illustration) {
51
- if (isThemedImageProps(illustration)) {
52
- return (
53
- <ThemedImage
54
- {...illustration}
55
- resizeMode="cover"
56
- style={[styles.media, styles.imageWrapper, illustration.style]}
57
- />
58
- );
59
- }
60
- return (
61
- <Image
62
- {...illustration}
63
- resizeMode="cover"
64
- style={[styles.media, styles.imageWrapper, illustration.style]}
65
- />
66
- );
55
+ return illustration;
67
56
  }
68
57
  if (image) {
69
- if (isThemedImageProps(image)) {
70
- return (
71
- <View style={[styles.media, styles.imageWrapper]}>
72
- <ThemedImage {...image} style={[styles.image, image.style]} />
73
- </View>
74
- );
75
- }
76
- return (
77
- <View style={[styles.media, styles.imageWrapper]}>
78
- <Image {...image} style={[styles.image, image.style]} />
79
- </View>
80
- );
58
+ return image;
81
59
  }
82
60
  return null;
83
61
  };
@@ -149,18 +127,22 @@ const Banner = ({
149
127
 
150
128
  if (onPress) {
151
129
  return (
152
- <Card variant={variant} style={[styles.card, style]} {...props}>
153
- <Pressable onPress={onPress} accessibilityRole="button" style={styles.pressable}>
154
- {content}
155
- </Pressable>
156
- </Card>
130
+ <BannerContext.Provider value={context}>
131
+ <Card variant={variant} style={[styles.card, style]} {...props}>
132
+ <Pressable onPress={onPress} accessibilityRole="button" style={styles.pressable}>
133
+ {content}
134
+ </Pressable>
135
+ </Card>
136
+ </BannerContext.Provider>
157
137
  );
158
138
  }
159
139
 
160
140
  return (
161
- <Card variant={variant} style={[styles.card, style]} {...props}>
162
- {content}
163
- </Card>
141
+ <BannerContext.Provider value={context}>
142
+ <Card variant={variant} style={[styles.card, style]} {...props}>
143
+ {content}
144
+ </Card>
145
+ </BannerContext.Provider>
164
146
  );
165
147
  };
166
148
 
@@ -218,31 +200,6 @@ const styles = StyleSheet.create(theme => ({
218
200
  },
219
201
  },
220
202
  },
221
- imageWrapper: {
222
- flexDirection: 'row',
223
- variants: {
224
- direction: {
225
- horizontal: {},
226
- vertical: {
227
- width: '100%',
228
- },
229
- },
230
- },
231
- },
232
- image: {
233
- borderRadius: theme.borderRadius.md,
234
- borderColor: theme.color.border.strong,
235
- borderWidth: theme.borderWidth[1],
236
- variants: {
237
- direction: {
238
- horizontal: { width: 160, height: 95 },
239
- vertical: {
240
- width: '100%',
241
- height: 160,
242
- },
243
- },
244
- },
245
- },
246
203
  contentContainer: {
247
204
  alignItems: 'flex-start',
248
205
  justifyContent: 'space-between',
@@ -0,0 +1,30 @@
1
+ import React from "react"
2
+ import BannerIllustration from "./BannerIllustration"
3
+ import figma from "@figma/code-connect"
4
+
5
+ /**
6
+ * -- This file was auto-generated by Code Connect --
7
+ * None of your props could be automatically mapped to Figma properties.
8
+ * You should update the `props` object to include a mapping from your
9
+ * code props to Figma properties, and update the `example` function to
10
+ * return the code example you'd like to see in Figma
11
+ */
12
+
13
+ figma.connect(
14
+ BannerIllustration,
15
+ "https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=10145%3A4877",
16
+ {
17
+ props: {
18
+ // No matching props could be found for these Figma properties:
19
+ // "illustration": figma.instance('Illustration'),
20
+ // "size": figma.enum('Size', {
21
+ // "XL-120": "xl-120",
22
+ // "LG-100": "lg-100",
23
+ // "MD-80": "md-80",
24
+ // "SM-60": "sm-60",
25
+ // "XS-40": "xs-40"
26
+ // })
27
+ },
28
+ example: (props) => <BannerIllustration />,
29
+ },
30
+ )
@@ -0,0 +1,63 @@
1
+ import { Image, ImageProps, View } from 'react-native';
2
+ import { StyleSheet } from 'react-native-unistyles';
3
+ import { isThemedImageProps } from '../../utils';
4
+ import { ThemedImage, ThemedImageProps } from '../ThemedImage';
5
+ import { useBannerContext } from './Banner.context';
6
+
7
+ const BannerIllustration = (props: ImageProps | ThemedImageProps) => {
8
+ const { direction } = useBannerContext();
9
+ styles.useVariants({ direction });
10
+ if (isThemedImageProps(props)) {
11
+ return (
12
+ <View style={[styles.media, styles.imageWrapper]}>
13
+ <ThemedImage {...props} style={[styles.image, props.style]} />
14
+ </View>
15
+ );
16
+ }
17
+ return (
18
+ <View style={[styles.media, styles.imageWrapper]}>
19
+ <Image {...props} style={[styles.image, props.style]} />
20
+ </View>
21
+ );
22
+ };
23
+
24
+ const styles = StyleSheet.create(theme => ({
25
+ media: {
26
+ flexShrink: 0,
27
+ variants: {
28
+ direction: {
29
+ horizontal: {},
30
+ vertical: {
31
+ alignSelf: 'flex-start',
32
+ },
33
+ },
34
+ },
35
+ },
36
+ imageWrapper: {
37
+ flexDirection: 'row',
38
+ variants: {
39
+ direction: {
40
+ horizontal: {},
41
+ vertical: {
42
+ width: '100%',
43
+ },
44
+ },
45
+ },
46
+ },
47
+ image: {
48
+ borderRadius: theme.borderRadius.md,
49
+ borderColor: theme.color.border.strong,
50
+ borderWidth: theme.borderWidth[1],
51
+ variants: {
52
+ direction: {
53
+ horizontal: { width: 160, height: 95 },
54
+ vertical: {
55
+ width: '100%',
56
+ height: 160,
57
+ },
58
+ },
59
+ },
60
+ },
61
+ }));
62
+
63
+ export default BannerIllustration;
@@ -0,0 +1,63 @@
1
+ import { Image, ImageProps, View } from 'react-native';
2
+ import { StyleSheet } from 'react-native-unistyles';
3
+ import { isThemedImageProps } from '../../utils';
4
+ import { ThemedImage, ThemedImageProps } from '../ThemedImage';
5
+ import { useBannerContext } from './Banner.context';
6
+
7
+ const BannerImage = (props: ImageProps | ThemedImageProps) => {
8
+ const { direction } = useBannerContext();
9
+ styles.useVariants({ direction });
10
+ if (isThemedImageProps(props)) {
11
+ return (
12
+ <View style={[styles.media, styles.imageWrapper]}>
13
+ <ThemedImage {...props} style={[styles.image, props.style]} />
14
+ </View>
15
+ );
16
+ }
17
+ return (
18
+ <View style={[styles.media, styles.imageWrapper]}>
19
+ <Image {...props} style={[styles.image, props.style]} />
20
+ </View>
21
+ );
22
+ };
23
+
24
+ const styles = StyleSheet.create(theme => ({
25
+ media: {
26
+ flexShrink: 0,
27
+ variants: {
28
+ direction: {
29
+ horizontal: {},
30
+ vertical: {
31
+ alignSelf: 'flex-start',
32
+ },
33
+ },
34
+ },
35
+ },
36
+ imageWrapper: {
37
+ flexDirection: 'row',
38
+ variants: {
39
+ direction: {
40
+ horizontal: {},
41
+ vertical: {
42
+ width: '100%',
43
+ },
44
+ },
45
+ },
46
+ },
47
+ image: {
48
+ borderRadius: theme.borderRadius.md,
49
+ borderColor: theme.color.border.strong,
50
+ borderWidth: theme.borderWidth[1],
51
+ variants: {
52
+ direction: {
53
+ horizontal: { width: 160, height: 95 },
54
+ vertical: {
55
+ width: '100%',
56
+ height: 160,
57
+ },
58
+ },
59
+ },
60
+ },
61
+ }));
62
+
63
+ export default BannerImage;
@@ -1,2 +1,4 @@
1
1
  export { default as Banner } from './Banner';
2
2
  export type { default as BannerProps } from './Banner.props';
3
+ export { default as BannerIllustration } from './BannerIllustration';
4
+ export { default as BannerImage } from './BannerImage';
@@ -0,0 +1,20 @@
1
+ import React from "react"
2
+ import BottomSheetModal from "./BottomSheetModal"
3
+ import figma from "@figma/code-connect"
4
+
5
+ /**
6
+ * -- This file was auto-generated by Code Connect --
7
+ * None of your props could be automatically mapped to Figma properties.
8
+ * You should update the `props` object to include a mapping from your
9
+ * code props to Figma properties, and update the `example` function to
10
+ * return the code example you'd like to see in Figma
11
+ */
12
+
13
+ figma.connect(
14
+ BottomSheetModal,
15
+ "https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=4084%3A33378",
16
+ {
17
+ props: {},
18
+ example: (props) => <BottomSheetModal />,
19
+ },
20
+ )