@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
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import figma from '@figma/code-connect';
|
|
2
|
+
import MenuItem from './MenuItem';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* -- This file was auto-generated by Code Connect --
|
|
6
|
+
* `props` includes a mapping from your code props to Figma properties.
|
|
7
|
+
* You should check this is correct, and update the `example` function
|
|
8
|
+
* to return the code example you'd like to see in Figma
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
figma.connect(
|
|
12
|
+
MenuItem,
|
|
13
|
+
'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=6416%3A11142',
|
|
14
|
+
{
|
|
15
|
+
props: {
|
|
16
|
+
// These props were automatically mapped based on your linked code:
|
|
17
|
+
disabled: figma.enum('State', {
|
|
18
|
+
Active: true,
|
|
19
|
+
}),
|
|
20
|
+
focusable: figma.enum('State', {
|
|
21
|
+
Focus: true,
|
|
22
|
+
}),
|
|
23
|
+
// No matching props could be found for these Figma properties:
|
|
24
|
+
// "number": figma.string('Number'),
|
|
25
|
+
// "selected": figma.boolean('Selected?')
|
|
26
|
+
},
|
|
27
|
+
example: props => (
|
|
28
|
+
<MenuItem text={null} disabled={props.disabled} focusable={props.focusable} />
|
|
29
|
+
),
|
|
30
|
+
}
|
|
31
|
+
);
|
|
@@ -108,6 +108,19 @@ The Modal component extends the `BottomSheetModal` component and accepts all of
|
|
|
108
108
|
| `fullscreen` | `boolean` | Whether the modal should take up the full screen height | `false` |
|
|
109
109
|
| `inNavModal` | `boolean` | Renders the modal correctly when used inside a navigation modal | `false` |
|
|
110
110
|
|
|
111
|
+
### `ModalImage` Props
|
|
112
|
+
|
|
113
|
+
The `ModalImage` component can be used to display an image within the Modal. It accepts the following props:
|
|
114
|
+
|
|
115
|
+
| Property | Type | Description |
|
|
116
|
+
| --------- | --------------------- | ------------------------------------------------------------------------ |
|
|
117
|
+
| `source` | `ImageSourcePropType` | The source of the image to display |
|
|
118
|
+
| `light` | `ImageSourcePropType` | The source of the image to display in light mode (use instead of source) |
|
|
119
|
+
| `dark` | `ImageSourcePropType` | The source of the image to display in dark mode (use instead of source) |
|
|
120
|
+
| `...rest` | `ImageProps` | Additional props to pass to the underlying Image component |
|
|
121
|
+
|
|
122
|
+
For more details about the ThemedImage component used internally, refer to the [`ThemedImage` documentation](/docs/utility-components-themed-image--docs).
|
|
123
|
+
|
|
111
124
|
## Features
|
|
112
125
|
|
|
113
126
|
### Automatic Layout Management
|
|
@@ -269,6 +282,8 @@ Use the `image` prop to display an image-centric modal with centered content:
|
|
|
269
282
|
<Canvas of={Stories.WithImage} />
|
|
270
283
|
|
|
271
284
|
```tsx
|
|
285
|
+
import { Modal, ModalImage, Button } from '@utilitywarehouse/hearth-react-native';
|
|
286
|
+
|
|
272
287
|
const ImageModal = () => {
|
|
273
288
|
const modalRef = useRef<BottomSheetModal>(null);
|
|
274
289
|
|
|
@@ -282,10 +297,7 @@ const ImageModal = () => {
|
|
|
282
297
|
description="Thanks for joining our community"
|
|
283
298
|
primaryButtonText="Get Started"
|
|
284
299
|
secondaryButtonText="Maybe Later"
|
|
285
|
-
image={{
|
|
286
|
-
source: require('./path/to/image.png'),
|
|
287
|
-
resizeMode: 'contain',
|
|
288
|
-
}}
|
|
300
|
+
image={<ModalImage source={require('./path/to/image.png')} resizeMode="contain" />}
|
|
289
301
|
onPressPrimaryButton={() => modalRef.current?.dismiss()}
|
|
290
302
|
onPressSecondaryButton={() => modalRef.current?.dismiss()}
|
|
291
303
|
/>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import Modal from "./Modal"
|
|
3
|
+
import figma from "@figma/code-connect"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* -- This file was auto-generated by Code Connect --
|
|
7
|
+
* `props` includes a mapping from your code props to Figma properties.
|
|
8
|
+
* You should check this is correct, and update the `example` function
|
|
9
|
+
* to return the code example you'd like to see in Figma
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
figma.connect(
|
|
13
|
+
Modal,
|
|
14
|
+
"https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=6300%3A2825",
|
|
15
|
+
{
|
|
16
|
+
props: {
|
|
17
|
+
// These props were automatically mapped based on your linked code:
|
|
18
|
+
loading: figma.enum("State", {
|
|
19
|
+
Loading: true,
|
|
20
|
+
}),
|
|
21
|
+
image: figma.enum("Image?", {
|
|
22
|
+
False: false,
|
|
23
|
+
True: true,
|
|
24
|
+
}),
|
|
25
|
+
heading: figma.string("Heading"),
|
|
26
|
+
description: figma.string("Description"),
|
|
27
|
+
fullscreen: figma.boolean("Full screen?"),
|
|
28
|
+
showHandle: figma.boolean("Handle?"),
|
|
29
|
+
// No matching props could be found for these Figma properties:
|
|
30
|
+
// "heading": figma.string('Heading'),
|
|
31
|
+
// "description": figma.string('Description'),
|
|
32
|
+
// "customContent": figma.boolean('Custom content?'),
|
|
33
|
+
// "buttons": figma.boolean('Buttons?'),
|
|
34
|
+
// "close": figma.boolean('Close?'),
|
|
35
|
+
// "customContent": figma.instance('Custom content'),
|
|
36
|
+
// "homeIndicator": figma.boolean('Home indicator?'),
|
|
37
|
+
// "handle": figma.boolean('Handle?'),
|
|
38
|
+
// "loadingHeading": figma.string('Loading heading'),
|
|
39
|
+
// "deviceType": figma.enum('Device type', {
|
|
40
|
+
// "Desktop": "desktop",
|
|
41
|
+
// "Tablet": "tablet",
|
|
42
|
+
// "Mobile": "mobile"
|
|
43
|
+
// })
|
|
44
|
+
},
|
|
45
|
+
example: (props) => (
|
|
46
|
+
<Modal
|
|
47
|
+
loading={props.loading}
|
|
48
|
+
image={props.image}
|
|
49
|
+
heading={props.heading}
|
|
50
|
+
description={props.description}
|
|
51
|
+
fullscreen={props.fullscreen}
|
|
52
|
+
showHandle={props.showHandle}
|
|
53
|
+
/>
|
|
54
|
+
),
|
|
55
|
+
},
|
|
56
|
+
)
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ViewProps } from 'react-native';
|
|
2
3
|
import { BottomSheetProps } from '../BottomSheet';
|
|
3
4
|
import { ButtonWithoutChildrenProps } from '../Button/Button.props';
|
|
4
5
|
import { UnstyledIconButtonProps } from '../UnstyledIconButton';
|
|
5
6
|
|
|
6
7
|
interface ModalProps extends Omit<BottomSheetProps, 'children'> {
|
|
7
8
|
loading?: boolean;
|
|
8
|
-
image?:
|
|
9
|
+
image?: ReactNode;
|
|
9
10
|
showCloseButton?: boolean;
|
|
10
11
|
heading?: string;
|
|
11
12
|
description?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import { useRef } from 'react';
|
|
3
3
|
import { ImageSourcePropType, Platform, View } from 'react-native';
|
|
4
|
-
import { Modal } from '.';
|
|
4
|
+
import { Modal, ModalImage } from '.';
|
|
5
5
|
import pigs from '../../../docs/assets/pigs.png';
|
|
6
6
|
import { ViewWrap } from '../../../docs/components';
|
|
7
7
|
import { BodyText } from '../BodyText';
|
|
@@ -117,10 +117,7 @@ export const WithImage = () => {
|
|
|
117
117
|
secondaryButtonText="Cancel"
|
|
118
118
|
onPressSecondaryButton={closeModal}
|
|
119
119
|
index={1}
|
|
120
|
-
image={{
|
|
121
|
-
source: pigs as ImageSourcePropType,
|
|
122
|
-
resizeMode: 'contain',
|
|
123
|
-
}}
|
|
120
|
+
image={<ModalImage source={pigs as ImageSourcePropType} resizeMode="contain" />}
|
|
124
121
|
/>
|
|
125
122
|
</ViewWrap>
|
|
126
123
|
</View>
|
|
@@ -2,7 +2,7 @@ import { BottomSheetScrollViewMethods, SNAP_POINT_TYPE } from '@gorhom/bottom-sh
|
|
|
2
2
|
import { BottomSheetModalMethods } from '@gorhom/bottom-sheet/lib/typescript/types';
|
|
3
3
|
import { CloseMediumIcon } from '@utilitywarehouse/hearth-react-native-icons';
|
|
4
4
|
import { useCallback, useEffect, useImperativeHandle, useRef } from 'react';
|
|
5
|
-
import { AccessibilityInfo,
|
|
5
|
+
import { AccessibilityInfo, Platform, View, findNodeHandle } from 'react-native';
|
|
6
6
|
import Animated, {
|
|
7
7
|
Easing,
|
|
8
8
|
useAnimatedStyle,
|
|
@@ -200,7 +200,7 @@ const Modal = ({
|
|
|
200
200
|
</View>
|
|
201
201
|
{image ? (
|
|
202
202
|
<View style={styles.imageContainer}>
|
|
203
|
-
|
|
203
|
+
{image}
|
|
204
204
|
<View style={styles.textContent}>
|
|
205
205
|
{heading ? (
|
|
206
206
|
<Heading size="lg" textAlign="center" accessible>
|
|
@@ -296,10 +296,6 @@ const styles = StyleSheet.create((theme, rt) => ({
|
|
|
296
296
|
flex: 1,
|
|
297
297
|
gap: theme.components.modal.content.gap,
|
|
298
298
|
},
|
|
299
|
-
image: {
|
|
300
|
-
width: 260,
|
|
301
|
-
height: 260,
|
|
302
|
-
},
|
|
303
299
|
imageContainer: {
|
|
304
300
|
alignItems: 'center',
|
|
305
301
|
flex: 1,
|
|
@@ -2,7 +2,7 @@ import { BottomSheetScrollViewMethods, SNAP_POINT_TYPE } from '@gorhom/bottom-sh
|
|
|
2
2
|
import { BottomSheetModalMethods } from '@gorhom/bottom-sheet/lib/typescript/types';
|
|
3
3
|
import { CloseMediumIcon } from '@utilitywarehouse/hearth-react-native-icons';
|
|
4
4
|
import { useCallback, useEffect, useImperativeHandle, useRef } from 'react';
|
|
5
|
-
import { AccessibilityInfo,
|
|
5
|
+
import { AccessibilityInfo, Platform, View, findNodeHandle } from 'react-native';
|
|
6
6
|
import Animated, {
|
|
7
7
|
Easing,
|
|
8
8
|
useAnimatedStyle,
|
|
@@ -197,7 +197,7 @@ const Modal = ({
|
|
|
197
197
|
</View>
|
|
198
198
|
{image ? (
|
|
199
199
|
<View style={styles.imageContainer}>
|
|
200
|
-
|
|
200
|
+
{image}
|
|
201
201
|
<View style={styles.textContent}>
|
|
202
202
|
{heading ? (
|
|
203
203
|
<Heading size="lg" textAlign="center" accessible>
|
|
@@ -281,10 +281,6 @@ const styles = StyleSheet.create((theme, rt) => ({
|
|
|
281
281
|
flex: 1,
|
|
282
282
|
gap: theme.components.modal.content.gap,
|
|
283
283
|
},
|
|
284
|
-
image: {
|
|
285
|
-
width: 260,
|
|
286
|
-
height: 260,
|
|
287
|
-
},
|
|
288
284
|
imageContainer: {
|
|
289
285
|
alignItems: 'center',
|
|
290
286
|
justifyContent: 'center',
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Image, ImageProps } from 'react-native';
|
|
2
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
3
|
+
import { isThemedImageProps } from '../../utils';
|
|
4
|
+
import { ThemedImage, ThemedImageProps } from '../ThemedImage';
|
|
5
|
+
|
|
6
|
+
const ModalImage = (props: ImageProps | ThemedImageProps) => {
|
|
7
|
+
if (isThemedImageProps(props)) {
|
|
8
|
+
return <ThemedImage {...props} style={[styles.image, props.style]} />;
|
|
9
|
+
}
|
|
10
|
+
return <Image resizeMode="cover" {...props} style={[styles.image, props.style]} />;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const styles = StyleSheet.create({
|
|
14
|
+
image: {
|
|
15
|
+
width: 260,
|
|
16
|
+
height: 260,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export default ModalImage;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import figma from '@figma/code-connect';
|
|
2
|
+
import { Pill } from './Pill';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* -- This file was auto-generated by Code Connect --
|
|
6
|
+
* `props` includes a mapping from your code props to Figma properties.
|
|
7
|
+
* You should check this is correct, and update the `example` function
|
|
8
|
+
* to return the code example you'd like to see in Figma
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
figma.connect(Pill, 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=4348%3A15595', {
|
|
12
|
+
props: {
|
|
13
|
+
// These props were automatically mapped based on your linked code:
|
|
14
|
+
label: figma.string('Label'),
|
|
15
|
+
focusable: figma.enum('State', {
|
|
16
|
+
Focus: true,
|
|
17
|
+
}),
|
|
18
|
+
// No matching props could be found for these Figma properties:
|
|
19
|
+
// "label": figma.string('Label'),
|
|
20
|
+
// "icon": figma.boolean('Icon?'),
|
|
21
|
+
// "icon20": figma.instance('Icon-20'),
|
|
22
|
+
// "selected": figma.boolean('Selected?')
|
|
23
|
+
},
|
|
24
|
+
example: props => <Pill value={null} label={props.label} focusable={props.focusable} />,
|
|
25
|
+
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createPressable } from '@gluestack-ui/pressable';
|
|
2
2
|
import { Pressable } from 'react-native';
|
|
3
3
|
import { StyleSheet } from 'react-native-unistyles';
|
|
4
|
-
import { Icon } from '../Icon';
|
|
5
4
|
import { BodyText } from '../BodyText';
|
|
6
|
-
import {
|
|
5
|
+
import { Icon } from '../Icon';
|
|
7
6
|
import type { PillProps } from './Pill.props';
|
|
7
|
+
import { usePillGroupContext } from './PillGroup.context';
|
|
8
8
|
|
|
9
9
|
const PillRoot = ({
|
|
10
10
|
value,
|
|
@@ -61,7 +61,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
61
61
|
_hover: {
|
|
62
62
|
backgroundColor: theme.color.interactive.neutral.surface.subtle.hover,
|
|
63
63
|
},
|
|
64
|
-
'_focus-visible': theme.helpers.focusVisible,
|
|
64
|
+
// '_focus-visible': theme.helpers.focusVisible,
|
|
65
65
|
},
|
|
66
66
|
variants: {
|
|
67
67
|
active: {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import figma from '@figma/code-connect';
|
|
2
|
+
import { PillGroup } from './PillGroup';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* -- This file was auto-generated by Code Connect --
|
|
6
|
+
* `props` includes a mapping from your code props to Figma properties.
|
|
7
|
+
* You should check this is correct, and update the `example` function
|
|
8
|
+
* to return the code example you'd like to see in Figma
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
figma.connect(
|
|
12
|
+
PillGroup,
|
|
13
|
+
'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=4348%3A15988',
|
|
14
|
+
{
|
|
15
|
+
props: {
|
|
16
|
+
// These props were automatically mapped based on your linked code:
|
|
17
|
+
wrap: figma.boolean('Wrap?'),
|
|
18
|
+
},
|
|
19
|
+
example: props => <PillGroup value={null} wrap={props.wrap} />,
|
|
20
|
+
}
|
|
21
|
+
);
|
|
@@ -142,7 +142,7 @@ export const Multiple: Story = {
|
|
|
142
142
|
return (
|
|
143
143
|
<Flex space="lg" direction="column" align="center" style={{ maxWidth: 400 }}>
|
|
144
144
|
<PillGroup wrap={true} multiple value={selectedCategories} onChange={v => setSelectedCategories(v as string[])}>
|
|
145
|
-
<Pill value="
|
|
145
|
+
<Pill value="unread" label="Unread" />
|
|
146
146
|
<Pill value="new" label="New" icon={HeartMediumIcon} />
|
|
147
147
|
<Pill value="favourites" label="My favourites" icon={HeartMediumIcon} />
|
|
148
148
|
<Pill value="read" label="Read" />
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import figma from '@figma/code-connect';
|
|
2
|
+
import ProgressStep from './ProgressStep';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* -- This file was auto-generated by Code Connect --
|
|
6
|
+
* `props` includes a mapping from your code props to Figma properties.
|
|
7
|
+
* You should check this is correct, and update the `example` function
|
|
8
|
+
* to return the code example you'd like to see in Figma
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
figma.connect(
|
|
12
|
+
ProgressStep,
|
|
13
|
+
'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=6056%3A1987',
|
|
14
|
+
{
|
|
15
|
+
props: {
|
|
16
|
+
// These props were automatically mapped based on your linked code:
|
|
17
|
+
status: figma.enum('State', {
|
|
18
|
+
Complete: 'complete',
|
|
19
|
+
Active: 'active',
|
|
20
|
+
Incomplete: 'incomplete',
|
|
21
|
+
}),
|
|
22
|
+
// No matching props could be found for these Figma properties:
|
|
23
|
+
// "label": figma.string('Label'),
|
|
24
|
+
// "label": figma.boolean('Label?'),
|
|
25
|
+
// "stepNumber": figma.string('Step number'),
|
|
26
|
+
// "interactive": figma.boolean('Interactive?')
|
|
27
|
+
},
|
|
28
|
+
example: props => <ProgressStep id={null} status={props.status} />,
|
|
29
|
+
}
|
|
30
|
+
);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import ProgressStepper from "./ProgressStepper"
|
|
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
|
+
ProgressStepper,
|
|
15
|
+
"https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=6056%3A2000",
|
|
16
|
+
{
|
|
17
|
+
props: {},
|
|
18
|
+
example: (props) => <ProgressStepper />,
|
|
19
|
+
},
|
|
20
|
+
)
|
|
@@ -104,7 +104,7 @@ const MyComponent = () => {
|
|
|
104
104
|
| `validText` | `string` | - | The valid text to be displayed below the radio. |
|
|
105
105
|
| `showValidationIcon` | `boolean` | `true` | Whether to show the validation icon. |
|
|
106
106
|
| `type` | `'default' \| 'tile'` | `default` | The type of the radio. |
|
|
107
|
-
| `image` | `
|
|
107
|
+
| `image` | `ReactNode` | - | The image to be displayed next to the label. |
|
|
108
108
|
|
|
109
109
|
## Components
|
|
110
110
|
|
|
@@ -150,6 +150,15 @@ Contains all Group related layout style props and actions. It inherits all the p
|
|
|
150
150
|
|
|
151
151
|
### `RadioImage`
|
|
152
152
|
|
|
153
|
+
| Property | Type | Description |
|
|
154
|
+
| --------- | --------------------- | ------------------------------------------------------------------------ |
|
|
155
|
+
| `source` | `ImageSourcePropType` | The source of the image to display |
|
|
156
|
+
| `light` | `ImageSourcePropType` | The source of the image to display in light mode (use instead of source) |
|
|
157
|
+
| `dark` | `ImageSourcePropType` | The source of the image to display in dark mode (use instead of source) |
|
|
158
|
+
| `...rest` | `ImageProps` | Additional props to pass to the underlying Image component |
|
|
159
|
+
|
|
160
|
+
For more details about the ThemedImage component used internally, refer to the [`ThemedImage` documentation](/docs/utility-components-themed-image--docs).
|
|
161
|
+
|
|
153
162
|
Contains all Image related layout style props and actions. It inherits all the properties of React Native's [Image component](https://reactnative.dev/docs/image).
|
|
154
163
|
|
|
155
164
|
## Variants
|
|
@@ -261,9 +270,9 @@ The `RadioImage` component is used to display an image next to the radio button.
|
|
|
261
270
|
<Canvas of={Stories.WithImage} />
|
|
262
271
|
|
|
263
272
|
```tsx
|
|
264
|
-
import { Radio, RadioGroup } from '@utilitywarehouse/native-ui';
|
|
273
|
+
import { Radio, RadioGroup, RadioImage } from '@utilitywarehouse/native-ui';
|
|
265
274
|
import visaLogo from './visa-logo.png';
|
|
266
|
-
import
|
|
275
|
+
import mastercardLogo from './mastercard-logo.png';
|
|
267
276
|
|
|
268
277
|
const MyComponent = () => {
|
|
269
278
|
const [value, setValue] = React.useState('Option 1');
|
|
@@ -273,16 +282,20 @@ const MyComponent = () => {
|
|
|
273
282
|
value="visa"
|
|
274
283
|
aria-label="Visa"
|
|
275
284
|
label="Visa"
|
|
276
|
-
image={
|
|
285
|
+
image={
|
|
286
|
+
<RadioImage source={visaLogo} style={{ width: 40, height: 24, resizeMode: 'contain' }} />
|
|
287
|
+
}
|
|
277
288
|
/>
|
|
278
289
|
<Radio
|
|
279
290
|
value="mastercard"
|
|
280
291
|
aria-label="Mastercard"
|
|
281
292
|
label="Mastercard"
|
|
282
|
-
image={
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
293
|
+
image={
|
|
294
|
+
<RadioImage
|
|
295
|
+
source={mastercardLogo}
|
|
296
|
+
style={{ width: 40, height: 24, resizeMode: 'contain' }}
|
|
297
|
+
/>
|
|
298
|
+
}
|
|
286
299
|
/>
|
|
287
300
|
</RadioGroup>
|
|
288
301
|
);
|
|
@@ -1,45 +1,25 @@
|
|
|
1
1
|
import figma from '@figma/code-connect';
|
|
2
|
-
import
|
|
2
|
+
import Radio from './Radio';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* -- This file was auto-generated by Code Connect --
|
|
6
|
+
* None of your props could be automatically mapped to Figma properties.
|
|
7
|
+
* You should update the `props` object to include a mapping from your
|
|
8
|
+
* code props to Figma properties, and update the `example` function to
|
|
9
|
+
* return the code example you'd like to see in Figma
|
|
10
|
+
*/
|
|
6
11
|
|
|
7
|
-
figma.connect(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
text: figma.string('Text'),
|
|
22
|
-
showIcon: figma.boolean('showIcon?'),
|
|
23
|
-
}),
|
|
24
|
-
false: {
|
|
25
|
-
text: undefined,
|
|
26
|
-
showIcon: undefined,
|
|
27
|
-
},
|
|
28
|
-
}),
|
|
29
|
-
},
|
|
30
|
-
example: ({ disabled, label, helperText, invalidText }) => (
|
|
31
|
-
<RadioGroup value={value} onChange={setValue}>
|
|
32
|
-
<Radio
|
|
33
|
-
value="someValue"
|
|
34
|
-
disabled={disabled}
|
|
35
|
-
label={label.text}
|
|
36
|
-
helperText={helperText.text}
|
|
37
|
-
invalidText={invalidText.text}
|
|
38
|
-
showValidationIcon={invalidText.showIcon}
|
|
39
|
-
/>
|
|
40
|
-
</RadioGroup>
|
|
41
|
-
),
|
|
42
|
-
}
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
// TODO: Add variants with helperText when it's implemented
|
|
12
|
+
figma.connect(Radio, 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=7428%3A12685', {
|
|
13
|
+
props: {
|
|
14
|
+
// No matching props could be found for these Figma properties:
|
|
15
|
+
// "helperText": figma.boolean('Helper text?'),
|
|
16
|
+
// "helperText": figma.string('Helper text'),
|
|
17
|
+
// "label": figma.string('Label'),
|
|
18
|
+
// "image": figma.boolean('Image?'),
|
|
19
|
+
// "state": figma.enum('State', {
|
|
20
|
+
// "Default": "default"
|
|
21
|
+
// }),
|
|
22
|
+
// "checked": figma.boolean('Checked?')
|
|
23
|
+
},
|
|
24
|
+
example: props => <Radio value={null} />,
|
|
25
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ComponentType } from 'react';
|
|
2
|
-
import type {
|
|
1
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
2
|
+
import type { PressableProps, ViewProps } from 'react-native';
|
|
3
3
|
|
|
4
4
|
interface RadioBaseProps extends Omit<PressableProps, 'children'> {
|
|
5
5
|
value: string;
|
|
@@ -28,7 +28,7 @@ interface RadioWithoutChildrenProps extends RadioBaseProps {
|
|
|
28
28
|
invalidText?: string;
|
|
29
29
|
validText?: string;
|
|
30
30
|
showValidationIcon?: boolean;
|
|
31
|
-
image?:
|
|
31
|
+
image?: ReactNode;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
type RadioProps = RadioWithChildrenProps | RadioWithoutChildrenProps;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { ImageSourcePropType } from 'react-native';
|
|
4
|
-
import { Radio, RadioGroup } from '.';
|
|
4
|
+
import { Radio, RadioGroup, RadioImage } from '.';
|
|
5
5
|
import bankLogo from '../../../docs/assets/bank-logo.png';
|
|
6
6
|
import bankLogo1 from '../../../docs/assets/bank-logo1.png';
|
|
7
7
|
import { VariantTitle } from '../../../docs/components';
|
|
@@ -106,11 +106,13 @@ export const WithImage: Story = {
|
|
|
106
106
|
{...args}
|
|
107
107
|
label="Visa"
|
|
108
108
|
value="Option 1"
|
|
109
|
-
image={
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
109
|
+
image={
|
|
110
|
+
<RadioImage
|
|
111
|
+
source={bankLogo1 as ImageSourcePropType}
|
|
112
|
+
style={{ width: 48, height: 32 }}
|
|
113
|
+
resizeMode="cover"
|
|
114
|
+
/>
|
|
115
|
+
}
|
|
114
116
|
/>
|
|
115
117
|
<Radio
|
|
116
118
|
aria-label="Label 2"
|
|
@@ -121,11 +123,13 @@ export const WithImage: Story = {
|
|
|
121
123
|
{...args}
|
|
122
124
|
label="Mastercard"
|
|
123
125
|
value="Option 2"
|
|
124
|
-
image={
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
image={
|
|
127
|
+
<RadioImage
|
|
128
|
+
source={bankLogo as ImageSourcePropType}
|
|
129
|
+
style={{ width: 48, height: 32 }}
|
|
130
|
+
resizeMode="cover"
|
|
131
|
+
/>
|
|
132
|
+
}
|
|
129
133
|
/>
|
|
130
134
|
</RadioGroup>
|
|
131
135
|
),
|
|
@@ -9,7 +9,6 @@ import StyledRadio from './RadioRoot';
|
|
|
9
9
|
import { useFormFieldContext } from '../FormField';
|
|
10
10
|
import { Helper } from '../Helper';
|
|
11
11
|
import { useRadioGroupContext } from './RadioGroup.context';
|
|
12
|
-
import RadioImage from './RadioImage';
|
|
13
12
|
import RadioTextContent from './RadioTextContent';
|
|
14
13
|
import RadioTileRoot from './RadioTileRoot';
|
|
15
14
|
|
|
@@ -57,7 +56,7 @@ const Radio = ({
|
|
|
57
56
|
<RadioIndicator>
|
|
58
57
|
<RadioIcon />
|
|
59
58
|
</RadioIndicator>
|
|
60
|
-
{image ?
|
|
59
|
+
{image ? image : null}
|
|
61
60
|
<RadioTextContent>
|
|
62
61
|
{!!label && <RadioLabel>{label}</RadioLabel>}
|
|
63
62
|
{!!helperText && <Helper disabled={disabled} icon={helperIcon} text={helperText} />}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import RadioGroup from "./RadioGroup"
|
|
3
|
+
import figma from "@figma/code-connect"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* -- This file was auto-generated by Code Connect --
|
|
7
|
+
* `props` includes a mapping from your code props to Figma properties.
|
|
8
|
+
* You should check this is correct, and update the `example` function
|
|
9
|
+
* to return the code example you'd like to see in Figma
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
figma.connect(
|
|
13
|
+
RadioGroup,
|
|
14
|
+
"https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=3138%3A13254",
|
|
15
|
+
{
|
|
16
|
+
props: {
|
|
17
|
+
// These props were automatically mapped based on your linked code:
|
|
18
|
+
label: figma.string("Group label"),
|
|
19
|
+
helperText: figma.string("Helper text"),
|
|
20
|
+
invalidText: figma.string("Helper text"),
|
|
21
|
+
validText: figma.string("Validation text"),
|
|
22
|
+
direction: figma.enum("Direction", {
|
|
23
|
+
Row: "row",
|
|
24
|
+
Column: "column",
|
|
25
|
+
}),
|
|
26
|
+
// No matching props could be found for these Figma properties:
|
|
27
|
+
// "groupLabel": figma.string('Group label'),
|
|
28
|
+
// "helperText": figma.boolean('Helper text?'),
|
|
29
|
+
// "helperText": figma.string('Helper text'),
|
|
30
|
+
// "validationText": figma.string('Validation text'),
|
|
31
|
+
// "state": figma.enum('State', {
|
|
32
|
+
// "Default": "default",
|
|
33
|
+
// "Invalid": "invalid"
|
|
34
|
+
// }),
|
|
35
|
+
// "labelVariant": figma.enum('Label variant', {
|
|
36
|
+
// "Body": "body",
|
|
37
|
+
// "Heading": "heading"
|
|
38
|
+
// }),
|
|
39
|
+
// "content": figma.enum('Content', {
|
|
40
|
+
// "Radio": "radio",
|
|
41
|
+
// "Radio Tile": "radio-tile"
|
|
42
|
+
// })
|
|
43
|
+
},
|
|
44
|
+
example: (props) => (
|
|
45
|
+
<RadioGroup
|
|
46
|
+
label={props.label}
|
|
47
|
+
helperText={props.helperText}
|
|
48
|
+
invalidText={props.invalidText}
|
|
49
|
+
validText={props.validText}
|
|
50
|
+
direction={props.direction}
|
|
51
|
+
/>
|
|
52
|
+
),
|
|
53
|
+
},
|
|
54
|
+
)
|