@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.
- package/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-lint.log +1 -1
- package/CHANGELOG.md +16 -0
- package/build/components/Accordion/AccordionTrigger.js +1 -1
- package/build/components/Banner/Banner.context.d.ts +7 -0
- package/build/components/Banner/Banner.context.js +8 -0
- package/build/components/Banner/Banner.js +10 -40
- package/build/components/Banner/Banner.props.d.ts +3 -5
- package/build/components/Banner/BannerIllustration.d.ts +4 -0
- package/build/components/Banner/BannerIllustration.js +53 -0
- package/build/components/Banner/BannerImage.d.ts +4 -0
- package/build/components/Banner/BannerImage.js +53 -0
- package/build/components/Banner/index.d.ts +2 -0
- package/build/components/Banner/index.js +2 -0
- package/build/components/Card/CardAction/CardAction.props.d.ts +2 -3
- package/build/components/Card/CardAction/CardActionRoot.js +1 -2
- package/build/components/Checkbox/Checkbox.js +1 -2
- package/build/components/Checkbox/Checkbox.props.d.ts +3 -3
- package/build/components/Checkbox/CheckboxImage.d.ts +2 -1
- package/build/components/Checkbox/CheckboxImage.js +8 -1
- package/build/components/Checkbox/CheckboxIndicator.js +3 -3
- package/build/components/DatePicker/DatePickerDay.js +3 -3
- package/build/components/ExpandableCard/ExpandableCard.props.d.ts +1 -2
- package/build/components/ExpandableCard/ExpandableCardTrigger.props.d.ts +4 -5
- package/build/components/ExpandableCard/ExpandableCardTriggerRoot.js +1 -14
- package/build/components/HighlightBanner/HighlightBanner.js +2 -6
- package/build/components/HighlightBanner/HighlightBanner.props.d.ts +2 -3
- package/build/components/HighlightBanner/HighlightBannerImage.d.ts +4 -0
- package/build/components/HighlightBanner/HighlightBannerImage.js +18 -0
- package/build/components/HighlightBanner/index.d.ts +1 -0
- package/build/components/HighlightBanner/index.js +1 -0
- package/build/components/Input/Input.d.ts +5 -7
- package/build/components/Input/Input.js +11 -4
- package/build/components/Input/InputField.d.ts +4 -7
- package/build/components/Input/InputField.js +6 -5
- package/build/components/List/ListItem/ListItem.props.d.ts +2 -2
- package/build/components/List/ListItem/ListItemRoot.js +1 -2
- package/build/components/Modal/Modal.js +2 -6
- package/build/components/Modal/Modal.props.d.ts +3 -2
- package/build/components/Modal/Modal.web.js +2 -6
- package/build/components/Modal/ModalImage.d.ts +4 -0
- package/build/components/Modal/ModalImage.js +18 -0
- package/build/components/Modal/index.d.ts +1 -0
- package/build/components/Modal/index.js +1 -0
- package/build/components/PillGroup/Pill.js +2 -2
- package/build/components/Radio/Radio.js +1 -2
- package/build/components/Radio/Radio.props.d.ts +3 -3
- package/build/components/Radio/RadioImage.d.ts +2 -1
- package/build/components/Radio/RadioImage.js +8 -1
- package/build/components/Radio/RadioIndicator.js +3 -3
- package/build/components/RadioCard/RadioCardIndicator.js +3 -3
- package/build/components/RadioCard/RadioCardRoot.js +3 -3
- package/build/components/Tabs/Tab.js +5 -5
- package/build/components/ToggleButton/ToggleButtonRoot.js +2 -2
- package/build/components/ToggleButtonCard/ToggleButtonCardRoot.js +3 -3
- package/build/components/UnstyledIconButton/UnstyledIconButtonRoot.js +1 -1
- package/build/components/VerificationInput/VerificationInput.d.ts +6 -0
- package/build/components/VerificationInput/VerificationInput.js +35 -0
- package/build/components/VerificationInput/VerificationInput.props.d.ts +49 -0
- package/build/components/VerificationInput/VerificationInput.props.js +1 -0
- package/build/components/VerificationInput/VerificationInputSlot.d.ts +9 -0
- package/build/components/VerificationInput/VerificationInputSlot.js +72 -0
- package/build/components/VerificationInput/index.d.ts +4 -0
- package/build/components/VerificationInput/index.js +3 -0
- package/build/components/VerificationInput/useVerificationInput.d.ts +14 -0
- package/build/components/VerificationInput/useVerificationInput.js +58 -0
- package/build/components/index.d.ts +1 -0
- package/build/components/index.js +1 -0
- package/build/utils/index.d.ts +2 -1
- package/build/utils/index.js +2 -1
- package/build/utils/isThemedImageProps.d.ts +4 -0
- package/build/utils/isThemedImageProps.js +4 -0
- package/docs/components/AllComponents.web.tsx +9 -0
- package/package.json +11 -12
- package/src/components/Accordion/Accordion.figma.tsx +23 -0
- package/src/components/Accordion/AccordionItemRoot.figma.tsx +47 -0
- package/src/components/Accordion/AccordionTrigger.tsx +1 -1
- package/src/components/Alert/Alert.figma.tsx +47 -0
- package/src/components/Avatar/Avatar.figma.tsx +33 -0
- package/src/components/Badge/Badge.figma.tsx +48 -24
- package/src/components/Banner/Banner.context.ts +11 -0
- package/src/components/Banner/Banner.docs.mdx +55 -37
- package/src/components/Banner/Banner.figma.tsx +15 -0
- package/src/components/Banner/Banner.props.ts +3 -5
- package/src/components/Banner/Banner.stories.tsx +86 -57
- package/src/components/Banner/Banner.tsx +24 -67
- package/src/components/Banner/BannerIllustration.figma.tsx +30 -0
- package/src/components/Banner/BannerIllustration.tsx +63 -0
- package/src/components/Banner/BannerImage.tsx +63 -0
- package/src/components/Banner/index.ts +2 -0
- package/src/components/BottomSheet/BottomSheetModal.figma.tsx +20 -0
- package/src/components/Button/Button.figma.tsx +60 -229
- package/src/components/Card/Card.docs.mdx +4 -4
- package/src/components/Card/Card.figma.tsx +43 -71
- package/src/components/Card/CardAction/CardAction.figma.tsx +44 -0
- package/src/components/Card/CardAction/CardAction.props.ts +2 -3
- package/src/components/Card/CardAction/CardAction.stories.tsx +5 -4
- package/src/components/Card/CardAction/CardActionRoot.tsx +4 -5
- package/src/components/Carousel/Carousel.figma.tsx +19 -0
- package/src/components/Checkbox/Checkbox.docs.mdx +23 -4
- package/src/components/Checkbox/Checkbox.figma.tsx +26 -41
- package/src/components/Checkbox/Checkbox.props.ts +3 -3
- package/src/components/Checkbox/Checkbox.stories.tsx +14 -8
- package/src/components/Checkbox/Checkbox.tsx +1 -2
- package/src/components/Checkbox/CheckboxGroup.figma.tsx +20 -0
- package/src/components/Checkbox/CheckboxImage.figma.tsx +27 -0
- package/src/components/Checkbox/CheckboxImage.tsx +8 -3
- package/src/components/Checkbox/CheckboxIndicator.tsx +3 -3
- package/src/components/Checkbox/CheckboxTileRoot.figma.tsx +32 -0
- package/src/components/CurrencyInput/CurrencyInput.figma.tsx +56 -0
- package/src/components/DateInput/DateInput.figma.tsx +75 -0
- package/src/components/DatePicker/DatePickerCalendar.figma.tsx +34 -0
- package/src/components/DatePicker/DatePickerDay.tsx +3 -3
- package/src/components/DatePickerInput/DatePickerInput.figma.tsx +62 -0
- package/src/components/DescriptionList/DescriptionList.figma.tsx +23 -0
- package/src/components/Divider/Divider.figma.tsx +23 -18
- package/src/components/ExpandableCard/ExpandableCard.docs.mdx +2 -2
- package/src/components/ExpandableCard/ExpandableCard.figma.tsx +54 -0
- package/src/components/ExpandableCard/ExpandableCard.props.ts +1 -2
- package/src/components/ExpandableCard/ExpandableCard.stories.tsx +3 -3
- package/src/components/ExpandableCard/ExpandableCardGroup.figma.tsx +23 -0
- package/src/components/ExpandableCard/ExpandableCardTrigger.props.ts +4 -5
- package/src/components/ExpandableCard/ExpandableCardTriggerRoot.tsx +2 -17
- package/src/components/FormField/FormField.figma.tsx +23 -0
- package/src/components/Helper/HelperText.figma.tsx +23 -0
- package/src/components/HighlightBanner/HighlightBanner.docs.mdx +73 -42
- package/src/components/HighlightBanner/HighlightBanner.props.ts +2 -3
- package/src/components/HighlightBanner/HighlightBanner.stories.tsx +85 -60
- package/src/components/HighlightBanner/HighlightBanner.tsx +3 -10
- package/src/components/HighlightBanner/HighlightBannerImage.tsx +20 -0
- package/src/components/HighlightBanner/index.ts +1 -0
- package/src/components/IconButton/IconButton.figma.tsx +55 -161
- package/src/components/IconContainer/IconContainer.figma.tsx +50 -0
- package/src/components/InlineLink/InlineLink.figma.tsx +33 -0
- package/src/components/Input/Input.figma.tsx +52 -110
- package/src/components/Input/Input.stories.tsx +76 -3
- package/src/components/Input/Input.tsx +110 -98
- package/src/components/Input/InputField.tsx +27 -26
- package/src/components/Label/Label.figma.tsx +24 -0
- package/src/components/Link/Link.figma.tsx +42 -0
- package/src/components/List/List.docs.mdx +15 -9
- package/src/components/List/List.figma.tsx +29 -108
- package/src/components/List/List.stories.tsx +2 -2
- package/src/components/List/ListAction/ListAction.figma.tsx +29 -0
- package/src/components/List/ListItem/ListItem.figma.tsx +40 -220
- package/src/components/List/ListItem/ListItem.props.ts +2 -2
- package/src/components/List/ListItem/ListItemLeadingContent.figma.tsx +29 -0
- package/src/components/List/ListItem/ListItemRoot.tsx +2 -3
- package/src/components/List/ListItem/ListItemTrailingContent.figma.tsx +27 -0
- package/src/components/Menu/Menu.figma.tsx +30 -0
- package/src/components/Menu/MenuItem.figma.tsx +31 -0
- package/src/components/Modal/Modal.docs.mdx +16 -4
- package/src/components/Modal/Modal.figma.tsx +56 -0
- package/src/components/Modal/Modal.props.ts +3 -2
- package/src/components/Modal/Modal.stories.tsx +2 -5
- package/src/components/Modal/Modal.tsx +2 -6
- package/src/components/Modal/Modal.web.tsx +2 -6
- package/src/components/Modal/ModalImage.tsx +20 -0
- package/src/components/Modal/index.ts +1 -0
- package/src/components/PillGroup/Pill.figma.tsx +25 -0
- package/src/components/PillGroup/Pill.tsx +3 -3
- package/src/components/PillGroup/PillGroup.figma.tsx +21 -0
- package/src/components/PillGroup/PillGroup.stories.tsx +1 -1
- package/src/components/ProgressStepper/ProgressStep.figma.tsx +30 -0
- package/src/components/ProgressStepper/ProgressStepper.figma.tsx +20 -0
- package/src/components/Radio/Radio.docs.mdx +21 -8
- package/src/components/Radio/Radio.figma.tsx +22 -42
- package/src/components/Radio/Radio.props.ts +3 -3
- package/src/components/Radio/Radio.stories.tsx +15 -11
- package/src/components/Radio/Radio.tsx +1 -2
- package/src/components/Radio/RadioGroup.figma.tsx +54 -0
- package/src/components/Radio/RadioImage.figma.tsx +27 -0
- package/src/components/Radio/RadioImage.tsx +8 -3
- package/src/components/Radio/RadioIndicator.tsx +3 -3
- package/src/components/Radio/RadioTileRoot.figma.tsx +31 -0
- package/src/components/RadioCard/RadioCardIndicator.tsx +3 -3
- package/src/components/RadioCard/RadioCardRoot.tsx +3 -3
- package/src/components/SectionHeader/SectionHeader.figma.tsx +30 -16
- package/src/components/Select/Select.figma.tsx +55 -0
- package/src/components/Select/SelectOption.figma.tsx +36 -0
- package/src/components/Spinner/Spinner.figma.tsx +20 -12
- package/src/components/Switch/Switch.figma.tsx +31 -23
- package/src/components/Tabs/Tab.tsx +5 -5
- package/src/components/Tabs/Tabs.figma.tsx +29 -0
- package/src/components/ThemedImage/ThemedImage.stories.tsx +1 -1
- package/src/components/Toast/ToastItem.figma.tsx +22 -0
- package/src/components/ToggleButton/ToggleButtonRoot.tsx +2 -2
- package/src/components/ToggleButtonCard/ToggleButtonCardRoot.tsx +3 -3
- package/src/components/UnstyledIconButton/UnstyledIconButton.figma.tsx +49 -0
- package/src/components/UnstyledIconButton/UnstyledIconButtonRoot.tsx +1 -1
- package/src/components/VerificationInput/VerificationInput.docs.mdx +68 -0
- package/src/components/VerificationInput/VerificationInput.props.ts +52 -0
- package/src/components/VerificationInput/VerificationInput.stories.tsx +140 -0
- package/src/components/VerificationInput/VerificationInput.tsx +89 -0
- package/src/components/VerificationInput/VerificationInputSlot.tsx +94 -0
- package/src/components/VerificationInput/index.ts +5 -0
- package/src/components/VerificationInput/useVerificationInput.ts +72 -0
- package/src/components/index.ts +1 -0
- package/src/utils/index.ts +2 -1
- package/src/utils/isThemedImageProps.ts +8 -0
- package/src/components/Checkbox/CheckboxIndicator.figma.tsx +0 -19
- 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?:
|
|
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?:
|
|
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
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
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
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
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
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
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
|
-
|
|
330
|
-
|
|
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
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
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
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
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 {
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
<
|
|
153
|
-
<
|
|
154
|
-
{
|
|
155
|
-
|
|
156
|
-
|
|
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
|
-
<
|
|
162
|
-
{
|
|
163
|
-
|
|
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;
|
|
@@ -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
|
+
)
|