@utilitywarehouse/hearth-react-native 0.36.1 → 0.36.3
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/SKILL.md +27 -16
- package/build/components/Accordion/Accordion.d.ts +4 -0
- package/build/components/Accordion/Accordion.js +4 -0
- package/build/components/Accordion/Accordion.props.d.ts +2 -0
- package/build/components/Alert/Alert.d.ts +4 -0
- package/build/components/Alert/Alert.js +4 -0
- package/build/components/Avatar/Avatar.d.ts +4 -0
- package/build/components/Avatar/Avatar.js +4 -0
- package/build/components/Badge/Badge.d.ts +4 -0
- package/build/components/Badge/Badge.js +4 -0
- package/build/components/Badge/Badge.props.d.ts +19 -0
- package/build/components/Banner/Banner.d.ts +5 -0
- package/build/components/Banner/Banner.js +5 -0
- package/build/components/Banner/BannerIllustration.d.ts +4 -0
- package/build/components/Banner/BannerIllustration.js +4 -0
- package/build/components/Banner/BannerImage.d.ts +4 -0
- package/build/components/Banner/BannerImage.js +4 -0
- package/build/components/BodyText/BodyText.d.ts +4 -0
- package/build/components/BodyText/BodyText.js +4 -0
- package/build/components/BottomSheet/BottomSheet.d.ts +6 -0
- package/build/components/BottomSheet/BottomSheet.js +6 -0
- package/build/components/BottomSheet/BottomSheet.props.d.ts +2 -0
- package/build/components/Box/Box.d.ts +4 -0
- package/build/components/Box/Box.js +4 -0
- package/build/components/Box/Box.props.d.ts +2 -0
- package/build/components/Button/Button.d.ts +4 -0
- package/build/components/Button/Button.js +4 -0
- package/build/components/Button/Button.props.d.ts +129 -0
- package/build/components/Card/Card.d.ts +4 -0
- package/build/components/Card/Card.js +4 -0
- package/build/components/Card/Card.props.d.ts +19 -1
- package/build/components/Card/CardAction/CardAction.d.ts +4 -0
- package/build/components/Card/CardAction/CardAction.js +4 -0
- package/build/components/Card/CardAction/CardAction.props.d.ts +23 -0
- package/build/components/Card/CardPressHandler.d.ts +8 -3
- package/build/components/Card/CardPressHandler.js +3 -0
- package/build/components/Carousel/Carousel.d.ts +3 -0
- package/build/components/Carousel/Carousel.js +3 -0
- package/build/components/Carousel/Carousel.props.d.ts +37 -0
- package/build/components/Center/Center.d.ts +3 -0
- package/build/components/Center/Center.js +3 -0
- package/build/components/Checkbox/Checkbox.d.ts +3 -0
- package/build/components/Checkbox/Checkbox.js +3 -0
- package/build/components/Checkbox/Checkbox.props.d.ts +20 -0
- package/build/components/Checkbox/CheckboxGroup.d.ts +3 -0
- package/build/components/Checkbox/CheckboxGroup.js +3 -0
- package/build/components/Checkbox/CheckboxGroup.props.d.ts +24 -0
- package/build/components/Combobox/Combobox.d.ts +3 -0
- package/build/components/Combobox/Combobox.js +3 -0
- package/build/components/Container/Container.d.ts +3 -0
- package/build/components/Container/Container.js +3 -0
- package/build/components/CurrencyInput/CurrencyInput.d.ts +3 -0
- package/build/components/CurrencyInput/CurrencyInput.js +3 -0
- package/build/components/CurrencyInput/CurrencyInput.props.d.ts +25 -0
- package/build/components/DateInput/DateInput.d.ts +4 -0
- package/build/components/DateInput/DateInput.js +4 -0
- package/build/components/DateInput/DateInput.props.d.ts +3 -0
- package/build/components/DatePicker/DatePicker.context.d.ts +1 -0
- package/build/components/DatePicker/DatePicker.d.ts +14 -0
- package/build/components/DatePicker/DatePicker.js +31 -0
- package/build/components/DatePicker/DatePicker.props.d.ts +78 -0
- package/build/components/DatePicker/DatePickerFooter.js +6 -2
- package/build/components/DatePickerInput/DatePickerInput.d.ts +5 -1
- package/build/components/DatePickerInput/DatePickerInput.js +15 -5
- package/build/components/DatePickerInput/DatePickerInput.props.d.ts +28 -0
- package/build/components/DescriptionList/DescriptionList.d.ts +4 -0
- package/build/components/DescriptionList/DescriptionList.js +4 -0
- package/build/components/DescriptionList/DescriptionList.props.d.ts +4 -0
- package/build/components/DetailText/DetailText.d.ts +4 -0
- package/build/components/DetailText/DetailText.js +4 -0
- package/build/components/Divider/Divider.d.ts +4 -0
- package/build/components/Divider/Divider.js +4 -0
- package/build/components/Divider/Divider.props.d.ts +10 -0
- package/build/components/Expandable/Expandable.d.ts +5 -0
- package/build/components/Expandable/Expandable.js +5 -0
- package/build/components/ExpandableCard/ExpandableCard.d.ts +4 -0
- package/build/components/ExpandableCard/ExpandableCard.js +4 -0
- package/build/components/Flex/Flex.d.ts +4 -0
- package/build/components/Flex/Flex.js +4 -0
- package/build/components/Flex/Flex.props.d.ts +20 -0
- package/build/components/FormField/FormField.d.ts +5 -0
- package/build/components/FormField/FormField.js +5 -0
- package/build/components/FormField/FormField.props.d.ts +24 -0
- package/build/components/Grid/Grid.d.ts +4 -0
- package/build/components/Grid/Grid.js +4 -0
- package/build/components/HTMLElements/ListItem.d.ts +5 -0
- package/build/components/HTMLElements/OrderedList.d.ts +10 -0
- package/build/components/HTMLElements/OrderedList.js +4 -0
- package/build/components/HTMLElements/UnorderedList.d.ts +10 -0
- package/build/components/HTMLElements/UnorderedList.js +4 -0
- package/build/components/Heading/Heading.d.ts +4 -0
- package/build/components/Heading/Heading.js +4 -0
- package/build/components/HighlightBanner/HighlightBanner.d.ts +5 -0
- package/build/components/HighlightBanner/HighlightBanner.js +5 -0
- package/build/components/HighlightBanner/HighlightBanner.props.d.ts +14 -0
- package/build/components/HighlightBanner/HighlightBannerImage.d.ts +4 -0
- package/build/components/HighlightBanner/HighlightBannerImage.js +4 -0
- package/build/components/Icon/Icon.d.ts +4 -0
- package/build/components/Icon/Icon.js +4 -0
- package/build/components/Icon/Icon.props.d.ts +8 -0
- package/build/components/IconButton/IconButton.d.ts +5 -0
- package/build/components/IconButton/IconButton.js +5 -0
- package/build/components/IconButton/IconButton.props.d.ts +9 -0
- package/build/components/IconContainer/IconContainer.d.ts +4 -0
- package/build/components/IconContainer/IconContainer.js +4 -0
- package/build/components/IndicatorIconButton/IndicatorIconButton.d.ts +6 -0
- package/build/components/IndicatorIconButton/IndicatorIconButton.js +6 -0
- package/build/components/InlineLink/InlineLink.d.ts +1 -0
- package/build/components/InlineLink/InlineLink.js +1 -0
- package/build/components/InlineLink/InlineLink.props.d.ts +4 -0
- package/build/components/Input/Input.d.ts +5 -0
- package/build/components/Input/Input.js +5 -0
- package/build/components/Input/Input.props.d.ts +54 -0
- package/build/components/Link/Link.d.ts +5 -0
- package/build/components/Link/Link.js +5 -0
- package/build/components/Link/Link.props.d.ts +15 -0
- package/build/components/List/List.d.ts +1 -0
- package/build/components/List/List.js +1 -0
- package/build/components/List/List.props.d.ts +8 -0
- package/build/components/Menu/Menu.d.ts +1 -0
- package/build/components/Menu/Menu.js +1 -0
- package/build/components/Modal/Modal.d.ts +5 -0
- package/build/components/Modal/Modal.js +5 -0
- package/build/components/Modal/Modal.props.d.ts +6 -0
- package/build/components/Modal/Modal.shared.types.d.ts +32 -0
- package/build/components/Modal/ModalImage.d.ts +1 -0
- package/build/components/Modal/ModalImage.js +1 -0
- package/build/components/NavModal/NavModal.d.ts +8 -0
- package/build/components/NavModal/NavModal.js +8 -0
- package/build/components/NavModal/NavModal.props.d.ts +10 -0
- package/build/components/Pagination/Pagination.d.ts +5 -0
- package/build/components/Pagination/Pagination.js +5 -0
- package/build/components/PillGroup/Pill.d.ts +1 -0
- package/build/components/PillGroup/Pill.js +1 -0
- package/build/components/PillGroup/PillGroup.d.ts +5 -0
- package/build/components/PillGroup/PillGroup.js +5 -0
- package/build/components/ProgressBar/ProgressBar.d.ts +5 -0
- package/build/components/ProgressBar/ProgressBar.js +5 -0
- package/build/components/ProgressBar/ProgressBar.props.d.ts +4 -0
- package/build/components/ProgressStepper/ProgressStep.d.ts +13 -0
- package/build/components/ProgressStepper/ProgressStep.js +5 -0
- package/build/components/ProgressStepper/ProgressStepper.d.ts +5 -0
- package/build/components/ProgressStepper/ProgressStepper.js +5 -0
- package/build/components/Radio/Radio.d.ts +5 -0
- package/build/components/Radio/Radio.js +5 -0
- package/build/components/Radio/Radio.props.d.ts +17 -0
- package/build/components/Radio/RadioGroup.d.ts +5 -0
- package/build/components/Radio/RadioGroup.js +5 -0
- package/build/components/Radio/RadioGroup.props.d.ts +25 -0
- package/build/components/RadioCard/RadioCard.d.ts +10 -0
- package/build/components/RadioCard/RadioCard.js +10 -0
- package/build/components/RadioCard/RadioCard.props.d.ts +14 -0
- package/build/components/RadioCard/RadioCardGroup.d.ts +4 -0
- package/build/components/RadioCard/RadioCardGroup.js +4 -0
- package/build/components/RadioCard/RadioCardGroup.props.d.ts +17 -0
- package/build/components/Rating/Rating.d.ts +5 -0
- package/build/components/Rating/Rating.js +5 -0
- package/build/components/Roundel/Roundel.d.ts +1 -0
- package/build/components/Roundel/Roundel.js +1 -0
- package/build/components/SectionHeader/SectionHeader.d.ts +1 -0
- package/build/components/SectionHeader/SectionHeader.js +1 -0
- package/build/components/SectionHeader/SectionHeader.props.d.ts +7 -0
- package/build/components/SegmentedControl/SegmentedControl.d.ts +5 -0
- package/build/components/SegmentedControl/SegmentedControl.js +5 -0
- package/build/components/Select/Select.d.ts +5 -0
- package/build/components/Select/Select.js +5 -0
- package/build/components/Skeleton/Skeleton.d.ts +1 -0
- package/build/components/Skeleton/Skeleton.js +1 -0
- package/build/components/Skeleton/Skeleton.props.d.ts +4 -0
- package/build/components/Spinner/Spinner.d.ts +4 -0
- package/build/components/Spinner/Spinner.js +8 -0
- package/build/components/Spinner/Spinner.props.d.ts +5 -0
- package/build/components/Spinner/Spinner.web.d.ts +4 -0
- package/build/components/Spinner/Spinner.web.js +8 -0
- package/build/components/StepperInput/StepperInput.d.ts +4 -0
- package/build/components/StepperInput/StepperInput.js +4 -0
- package/build/components/StepperInput/StepperInput.props.d.ts +44 -0
- package/build/components/Switch/Switch.d.ts +4 -0
- package/build/components/Switch/Switch.js +4 -0
- package/build/components/Switch/Switch.props.d.ts +5 -0
- package/build/components/Table/Table.d.ts +4 -0
- package/build/components/Table/Table.js +4 -0
- package/build/components/Table/Table.props.d.ts +6 -0
- package/build/components/Table/TableHeader.d.ts +3 -0
- package/build/components/Table/TableHeader.js +3 -0
- package/build/components/Table/TableHeaderCell.d.ts +6 -0
- package/build/components/Table/TableHeaderCell.js +3 -0
- package/build/components/Tabs/Tabs.d.ts +5 -0
- package/build/components/Tabs/Tabs.js +5 -0
- package/build/components/Textarea/Textarea.d.ts +6 -0
- package/build/components/Textarea/Textarea.js +6 -0
- package/build/components/Textarea/Textarea.props.d.ts +14 -0
- package/build/components/TimePicker/TimePicker.d.ts +5 -0
- package/build/components/TimePicker/TimePicker.js +14 -1
- package/build/components/TimePicker/TimePickerView.js +5 -19
- package/build/components/TimePicker/TimePickerWheel.web.js +11 -2
- package/build/components/TimePicker/utils.d.ts +9 -0
- package/build/components/TimePicker/utils.js +30 -0
- package/build/components/TimePicker/utils.test.d.ts +1 -0
- package/build/components/TimePicker/utils.test.js +31 -0
- package/build/components/TimePickerInput/TimePickerInput.d.ts +6 -1
- package/build/components/TimePickerInput/TimePickerInput.js +16 -5
- package/build/components/TimePickerInput/TimePickerInput.props.d.ts +35 -0
- package/build/components/Timeline/Timeline.d.ts +5 -0
- package/build/components/Timeline/Timeline.js +5 -0
- package/build/components/Timeline/TimelineItem.d.ts +4 -0
- package/build/components/Timeline/TimelineItem.js +4 -0
- package/build/components/Toast/Toast.context.d.ts +4 -0
- package/build/components/Toast/Toast.context.js +4 -0
- package/build/components/Toast/Toast.props.d.ts +7 -0
- package/build/components/ToggleButton/ToggleButton.d.ts +4 -0
- package/build/components/ToggleButton/ToggleButton.js +4 -0
- package/build/components/ToggleButton/ToggleButton.props.d.ts +6 -0
- package/build/components/ToggleButtonCard/ToggleButtonCard.d.ts +8 -0
- package/build/components/ToggleButtonCard/ToggleButtonCard.js +8 -0
- package/build/components/ToggleButtonCard/ToggleButtonCard.props.d.ts +9 -0
- package/build/components/ToggleButtonCard/ToggleButtonCardGroup.props.d.ts +15 -0
- package/build/components/UnstyledIconButton/UnstyledIconButton.d.ts +5 -0
- package/build/components/UnstyledIconButton/UnstyledIconButton.js +5 -0
- package/build/components/UnstyledIconButton/UnstyledIconButton.props.d.ts +17 -0
- package/build/components/VerificationInput/VerificationInput.d.ts +4 -0
- package/build/components/VerificationInput/VerificationInput.js +4 -0
- package/package.json +8 -5
- package/public/llms/components/date-picker.md +7 -1
- package/public/llms/components/time-picker.md +1 -0
- package/public/llms/docs/introduction.md +1 -1
|
@@ -3,37 +3,69 @@ import { StyleProp, ViewProps, ViewStyle } from 'react-native';
|
|
|
3
3
|
import { ButtonWithoutChildrenProps } from '../Button/Button.props';
|
|
4
4
|
import { UnstyledIconButtonProps } from '../UnstyledIconButton';
|
|
5
5
|
export interface ModalCommonBaseProps {
|
|
6
|
+
/** Applied to the modal content container, useful for locating the modal in e2e tests. */
|
|
6
7
|
testID?: string;
|
|
8
|
+
/** Whether to show a loading state with a spinner.
|
|
9
|
+
* @default false */
|
|
7
10
|
loading?: boolean;
|
|
11
|
+
/** Image to display in the modal, shown as centered content with text below. */
|
|
8
12
|
image?: ReactNode;
|
|
13
|
+
/** Whether to show the close button in the top-right corner.
|
|
14
|
+
* @default true */
|
|
9
15
|
showCloseButton?: boolean;
|
|
16
|
+
/** The heading text displayed at the top of the modal. */
|
|
10
17
|
heading?: string;
|
|
18
|
+
/** The heading text shown while `loading` is true, instead of the regular heading.
|
|
19
|
+
* @default 'Loading...' */
|
|
11
20
|
loadingHeading?: string;
|
|
21
|
+
/** The description text shown while `loading` is true, instead of the regular description. */
|
|
12
22
|
loadingDescription?: string;
|
|
23
|
+
/** The description content displayed below the heading; pass a string for the default styling, or JSX for custom content. */
|
|
13
24
|
description?: ReactNode;
|
|
25
|
+
/** Whether the footer stays fixed to the bottom of the modal while content scrolls.
|
|
26
|
+
* @default true */
|
|
14
27
|
stickyFooter?: boolean;
|
|
28
|
+
/** Custom content to display in the modal body. */
|
|
15
29
|
children?: ViewProps['children'];
|
|
30
|
+
/** Called when the close button is pressed. */
|
|
16
31
|
onPressCloseButton?: () => void;
|
|
32
|
+
/** Additional props passed to the close button. */
|
|
17
33
|
closeButtonProps?: Omit<UnstyledIconButtonProps, 'children'>;
|
|
18
34
|
}
|
|
19
35
|
export interface ModalButtonFooterProps {
|
|
36
|
+
/** Called when the primary button is pressed. */
|
|
20
37
|
onPressPrimaryButton?: () => void;
|
|
38
|
+
/** Text for the primary action button. */
|
|
21
39
|
primaryButtonText?: string;
|
|
40
|
+
/** Called when the secondary button is pressed. */
|
|
22
41
|
onPressSecondaryButton?: () => void;
|
|
42
|
+
/** Text for the secondary action button. */
|
|
23
43
|
secondaryButtonText?: string;
|
|
44
|
+
/** Additional props passed to the primary button; `colorScheme` defaults to `highlight`, `variant` to `solid`. */
|
|
24
45
|
primaryButtonProps?: Omit<ButtonWithoutChildrenProps, 'children'>;
|
|
46
|
+
/** Additional props passed to the secondary button; `colorScheme` defaults to `functional`, `variant` to `outline`. */
|
|
25
47
|
secondaryButtonProps?: Omit<ButtonWithoutChildrenProps, 'children'>;
|
|
48
|
+
/** Not applicable when using the built-in primary/secondary action buttons. */
|
|
26
49
|
footer?: never;
|
|
50
|
+
/** Styles applied to the footer container, useful for sticky footer shadows or custom spacing. */
|
|
27
51
|
footerStyle?: StyleProp<ViewStyle>;
|
|
28
52
|
}
|
|
29
53
|
export interface ModalCustomFooterProps {
|
|
54
|
+
/** Custom footer content that replaces the built-in action buttons. */
|
|
30
55
|
footer: ReactNode;
|
|
56
|
+
/** Styles applied to the footer container, useful for sticky footer shadows or custom spacing. */
|
|
31
57
|
footerStyle?: StyleProp<ViewStyle>;
|
|
58
|
+
/** Not applicable when a custom `footer` is provided. */
|
|
32
59
|
onPressPrimaryButton?: never;
|
|
60
|
+
/** Not applicable when a custom `footer` is provided. */
|
|
33
61
|
primaryButtonText?: never;
|
|
62
|
+
/** Not applicable when a custom `footer` is provided. */
|
|
34
63
|
onPressSecondaryButton?: never;
|
|
64
|
+
/** Not applicable when a custom `footer` is provided. */
|
|
35
65
|
secondaryButtonText?: never;
|
|
66
|
+
/** Not applicable when a custom `footer` is provided. */
|
|
36
67
|
primaryButtonProps?: never;
|
|
68
|
+
/** Not applicable when a custom `footer` is provided. */
|
|
37
69
|
secondaryButtonProps?: never;
|
|
38
70
|
}
|
|
39
71
|
export type ModalCommonProps = ModalCommonBaseProps & (ModalButtonFooterProps | ModalCustomFooterProps);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ImageProps } from 'react-native';
|
|
2
2
|
import { ThemedImageProps } from '../ThemedImage';
|
|
3
|
+
/** Use ModalImage to display an image within a `Modal`, with support for separate light and dark mode sources via `ThemedImage`. */
|
|
3
4
|
declare const ModalImage: (props: ImageProps | ThemedImageProps) => import("react").JSX.Element;
|
|
4
5
|
export default ModalImage;
|
|
@@ -3,6 +3,7 @@ import { Image } from 'react-native';
|
|
|
3
3
|
import { StyleSheet } from 'react-native-unistyles';
|
|
4
4
|
import { isThemedImageProps } from '../../utils';
|
|
5
5
|
import { ThemedImage } from '../ThemedImage';
|
|
6
|
+
/** Use ModalImage to display an image within a `Modal`, with support for separate light and dark mode sources via `ThemedImage`. */
|
|
6
7
|
const ModalImage = (props) => {
|
|
7
8
|
if (isThemedImageProps(props)) {
|
|
8
9
|
return _jsx(ThemedImage, { ...props, style: [styles.image, props.style] });
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import NavModalProps from './NavModal.props';
|
|
2
|
+
/**
|
|
3
|
+
* Use NavModal for the screen-based modal layout for React Navigation flows, when a screen
|
|
4
|
+
* is already presented with `presentation: 'modal'` or `presentation: 'fullScreenModal'`.
|
|
5
|
+
* Provides Hearth's modal structure and action buttons plus the Android close animation, but
|
|
6
|
+
* does not manage its own dismissal: your screen or navigator owns closing behavior. Use
|
|
7
|
+
* `Modal` instead for a bottom-sheet modal presented via a ref.
|
|
8
|
+
* @summary The screen-based modal layout for navigation flows.
|
|
9
|
+
*/
|
|
2
10
|
declare const NavModal: ({ ref, children, heading, description, showCloseButton, primaryButtonText, secondaryButtonText, onPressPrimaryButton, onPressCloseButton, onPressSecondaryButton, loading, loadingHeading, loadingDescription, image, footer, footerStyle, primaryButtonProps, secondaryButtonProps, closeButtonProps, stickyFooter, background, scrollable, presentation, scrollViewProps, useSafeAreaInsets, ...props }: NavModalProps) => import("react").JSX.Element;
|
|
3
11
|
export default NavModal;
|
|
@@ -11,6 +11,14 @@ import { Button } from '../Button';
|
|
|
11
11
|
import { Heading } from '../Heading';
|
|
12
12
|
import { Spinner } from '../Spinner';
|
|
13
13
|
import { UnstyledIconButton } from '../UnstyledIconButton';
|
|
14
|
+
/**
|
|
15
|
+
* Use NavModal for the screen-based modal layout for React Navigation flows, when a screen
|
|
16
|
+
* is already presented with `presentation: 'modal'` or `presentation: 'fullScreenModal'`.
|
|
17
|
+
* Provides Hearth's modal structure and action buttons plus the Android close animation, but
|
|
18
|
+
* does not manage its own dismissal: your screen or navigator owns closing behavior. Use
|
|
19
|
+
* `Modal` instead for a bottom-sheet modal presented via a ref.
|
|
20
|
+
* @summary The screen-based modal layout for navigation flows.
|
|
21
|
+
*/
|
|
14
22
|
const NavModal = ({ ref, children, heading, description, showCloseButton = true, primaryButtonText, secondaryButtonText, onPressPrimaryButton, onPressCloseButton, onPressSecondaryButton, loading, loadingHeading = 'Loading...', loadingDescription, image, footer, footerStyle, primaryButtonProps, secondaryButtonProps, closeButtonProps, stickyFooter = true, background = 'default', scrollable = true, presentation = 'modal', scrollViewProps, useSafeAreaInsets = true, ...props }) => {
|
|
15
23
|
const theme = useTheme();
|
|
16
24
|
const backgroundOpacity = useSharedValue(0);
|
|
@@ -5,11 +5,21 @@ export interface NavModalRef {
|
|
|
5
5
|
triggerCloseAnimation?: () => void;
|
|
6
6
|
}
|
|
7
7
|
type NavModalBaseProps = ModalCommonBaseProps & {
|
|
8
|
+
/** Ref exposing `triggerCloseAnimation`, used to play the Android close animation before dismissal. */
|
|
8
9
|
ref?: Ref<NavModalRef>;
|
|
10
|
+
/** Switches between the default surface background, the brand background, and the primary background treatment.
|
|
11
|
+
* @default 'default' */
|
|
9
12
|
background?: 'default' | 'brand' | 'primary';
|
|
13
|
+
/** Wraps the content area in a `ScrollView`; set to `false` for custom layouts that should not scroll.
|
|
14
|
+
* @default true */
|
|
10
15
|
scrollable?: boolean;
|
|
16
|
+
/** Matches the React Navigation screen presentation; `fullScreenModal` uses the full-screen layout, the other values use the sheet-style layout.
|
|
17
|
+
* @default 'modal' */
|
|
11
18
|
presentation?: 'fullScreenModal' | 'modal' | 'transparentModal' | 'containedModal' | 'containedTransparentModal';
|
|
19
|
+
/** Whether to apply safe area insets as padding within the component.
|
|
20
|
+
* @default true */
|
|
12
21
|
useSafeAreaInsets?: boolean;
|
|
22
|
+
/** Extra props forwarded to the `ScrollView` wrapping the modal content when `scrollable` is true. */
|
|
13
23
|
scrollViewProps?: Omit<ScrollViewProps, 'children'>;
|
|
14
24
|
};
|
|
15
25
|
type NavModalProps = (NavModalBaseProps & ModalButtonFooterProps) | (NavModalBaseProps & ModalCustomFooterProps);
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type PaginationProps from './Pagination.props';
|
|
2
|
+
/**
|
|
3
|
+
* Lets a user move between pages of content, rendering numbered page controls with next/previous
|
|
4
|
+
* (and optional first/last) buttons, or a condensed "Page X of Y" summary.
|
|
5
|
+
* @summary Page navigation controls for paged content.
|
|
6
|
+
*/
|
|
2
7
|
declare const Pagination: {
|
|
3
8
|
({ currentPage, totalPages, onPageChange, condensed, hideSkipButtons, style, ...props }: PaginationProps): import("react").JSX.Element;
|
|
4
9
|
displayName: string;
|
|
@@ -18,6 +18,11 @@ const PaginationItem = ({ label, selected = false, onPress }) => {
|
|
|
18
18
|
const PaginationArrowButton = ({ accessibilityLabel, disabled, icon, onPress, }) => {
|
|
19
19
|
return (_jsx(UnstyledIconButton, { accessibilityLabel: accessibilityLabel, disabled: disabled, icon: icon, onPress: onPress, size: "sm", style: styles.arrowButton }));
|
|
20
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* Lets a user move between pages of content, rendering numbered page controls with next/previous
|
|
23
|
+
* (and optional first/last) buttons, or a condensed "Page X of Y" summary.
|
|
24
|
+
* @summary Page navigation controls for paged content.
|
|
25
|
+
*/
|
|
21
26
|
const Pagination = ({ currentPage, totalPages, onPageChange, condensed = false, hideSkipButtons = false, style, ...props }) => {
|
|
22
27
|
const pages = generatePageNumbers(currentPage, totalPages);
|
|
23
28
|
const handleFirst = () => {
|
|
@@ -15,6 +15,7 @@ const PillRoot = ({ value, label, icon, states = {}, ...props }) => {
|
|
|
15
15
|
};
|
|
16
16
|
return (_jsxs(Pressable, { ...props, style: styles.pill, accessibilityRole: "button", accessibilityState: { selected: isSelected }, onPress: handlePress, children: [icon && _jsx(Icon, { as: icon, size: "sm", style: styles.icon }), _jsx(BodyText, { weight: "semibold", style: styles.text, children: label })] }));
|
|
17
17
|
};
|
|
18
|
+
/** A selectable, pressable tag used inside a `PillGroup` for filtering or categorization. */
|
|
18
19
|
export const Pill = createPressable({ Root: PillRoot });
|
|
19
20
|
Pill.displayName = 'Pill';
|
|
20
21
|
const styles = StyleSheet.create(theme => ({
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { PillGroupProps } from './PillGroup.props';
|
|
2
|
+
/**
|
|
3
|
+
* Groups multiple `Pill` components together for filtering and categorization, controlling their
|
|
4
|
+
* layout and managing single- or multi-select state.
|
|
5
|
+
* @summary A container that groups and manages selection for `Pill` components.
|
|
6
|
+
*/
|
|
2
7
|
export declare const PillGroup: {
|
|
3
8
|
({ children, value, multiple, wrap, onChange, onValueChange, style, ...props }: PillGroupProps): import("react").JSX.Element;
|
|
4
9
|
displayName: string;
|
|
@@ -4,6 +4,11 @@ import { ScrollView } from 'react-native';
|
|
|
4
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
5
5
|
import { Box } from '../Box';
|
|
6
6
|
import { PillGroupContext } from './PillGroup.context';
|
|
7
|
+
/**
|
|
8
|
+
* Groups multiple `Pill` components together for filtering and categorization, controlling their
|
|
9
|
+
* layout and managing single- or multi-select state.
|
|
10
|
+
* @summary A container that groups and manages selection for `Pill` components.
|
|
11
|
+
*/
|
|
7
12
|
export const PillGroup = ({ children, value, multiple = false, wrap = true, onChange, onValueChange, style, ...props }) => {
|
|
8
13
|
const normalizedValue = Array.isArray(value) ? value : [value];
|
|
9
14
|
const contextValue = useMemo(() => ({
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type ProgressBarProps from './ProgressBar.props';
|
|
2
|
+
/**
|
|
3
|
+
* Communicates task completion for linear flows and bounded operations. Use the
|
|
4
|
+
* linear variant for inline layouts and the circular variant when space is tighter
|
|
5
|
+
* or when progress needs more emphasis.
|
|
6
|
+
*/
|
|
2
7
|
declare const ProgressBar: {
|
|
3
8
|
({ variant, colorScheme, size, value, min, max, label, hideLabel, formatValueText, "aria-valuetext": ariaValueText, accessibilityLabel, ...rest }: ProgressBarProps): import("react").JSX.Element;
|
|
4
9
|
displayName: string;
|
|
@@ -13,6 +13,11 @@ const valueToPercent = (value, min, max) => {
|
|
|
13
13
|
return 0;
|
|
14
14
|
return ((value - min) / range) * 100;
|
|
15
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Communicates task completion for linear flows and bounded operations. Use the
|
|
18
|
+
* linear variant for inline layouts and the circular variant when space is tighter
|
|
19
|
+
* or when progress needs more emphasis.
|
|
20
|
+
*/
|
|
16
21
|
const ProgressBar = ({ variant = 'linear', colorScheme = 'default', size = 'md', value, min = 0, max = 100, label, hideLabel, formatValueText, 'aria-valuetext': ariaValueText, accessibilityLabel, ...rest }) => {
|
|
17
22
|
const effectiveValue = colorScheme === 'success' && !formatValueText ? max : clampValue(value, min, max);
|
|
18
23
|
const percentValue = valueToPercent(effectiveValue, min, max);
|
|
@@ -3,6 +3,10 @@ export type ProgressBarVariant = 'linear' | 'circular';
|
|
|
3
3
|
export type ProgressBarColorScheme = 'default' | 'success' | 'danger';
|
|
4
4
|
export type ProgressBarSize = 'sm' | 'md';
|
|
5
5
|
export interface ProgressBarProps extends ViewProps {
|
|
6
|
+
/**
|
|
7
|
+
* The progress bar variant.
|
|
8
|
+
* @default 'linear'
|
|
9
|
+
*/
|
|
6
10
|
variant?: ProgressBarVariant;
|
|
7
11
|
/**
|
|
8
12
|
* Set the visual appearance.
|
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ProgressStepProps } from './ProgressStepper.props';
|
|
3
3
|
interface ProgressStepInternalProps extends ProgressStepProps {
|
|
4
|
+
/**
|
|
5
|
+
* Zero-based position of the step within the sequence.
|
|
6
|
+
* @default 0
|
|
7
|
+
*/
|
|
4
8
|
index?: number;
|
|
9
|
+
/**
|
|
10
|
+
* Whether the step is the last one in the sequence.
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
5
13
|
isLast?: boolean;
|
|
6
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Represents a single step within a ProgressStepper, showing whether it is
|
|
17
|
+
* complete, active, or incomplete. Rendered as a child of ProgressStepper
|
|
18
|
+
* rather than used on its own.
|
|
19
|
+
*/
|
|
7
20
|
declare const ProgressStep: {
|
|
8
21
|
({ status, index, isLast, ...rest }: ProgressStepInternalProps): React.JSX.Element;
|
|
9
22
|
displayName: string;
|
|
@@ -4,6 +4,11 @@ import { StyleSheet } from 'react-native-unistyles';
|
|
|
4
4
|
import { TickSmallIcon } from '@utilitywarehouse/hearth-react-native-icons';
|
|
5
5
|
import { Icon } from '../Icon';
|
|
6
6
|
import { BodyText } from '../BodyText';
|
|
7
|
+
/**
|
|
8
|
+
* Represents a single step within a ProgressStepper, showing whether it is
|
|
9
|
+
* complete, active, or incomplete. Rendered as a child of ProgressStepper
|
|
10
|
+
* rather than used on its own.
|
|
11
|
+
*/
|
|
7
12
|
const ProgressStep = ({ status, index = 0, isLast = false, ...rest }) => {
|
|
8
13
|
styles.useVariants({ status, isLast });
|
|
9
14
|
const renderStepNumber = () => {
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import ProgressStepperProps from './ProgressStepper.props';
|
|
3
|
+
/**
|
|
4
|
+
* Displays a series of steps connected by lines, showing progress through a
|
|
5
|
+
* multi-step process. Use it to show which steps in a flow are complete,
|
|
6
|
+
* active, or still to come.
|
|
7
|
+
*/
|
|
3
8
|
declare const ProgressStepper: {
|
|
4
9
|
({ children, ...rest }: ProgressStepperProps): React.JSX.Element;
|
|
5
10
|
displayName: string;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, Children, cloneElement, isValidElement } from 'react';
|
|
3
3
|
import ProgressStepperRoot from './ProgressStepperRoot';
|
|
4
|
+
/**
|
|
5
|
+
* Displays a series of steps connected by lines, showing progress through a
|
|
6
|
+
* multi-step process. Use it to show which steps in a flow are complete,
|
|
7
|
+
* active, or still to come.
|
|
8
|
+
*/
|
|
4
9
|
const ProgressStepper = ({ children, ...rest }) => {
|
|
5
10
|
// Process children to add index and isLast props
|
|
6
11
|
const processedChildren = useMemo(() => {
|
|
@@ -9,6 +9,11 @@ declare const RadioIcon: import("react").ForwardRefExoticComponent<import("react
|
|
|
9
9
|
forceMount?: boolean;
|
|
10
10
|
}>;
|
|
11
11
|
declare const RadioLabel: import("react").ForwardRefExoticComponent<import("react").RefAttributes<import("../Label/Label.props").default> & Omit<import("../Label/Label.props").default, "ref">>;
|
|
12
|
+
/**
|
|
13
|
+
* Lets a user pick a single option from a set of mutually exclusive choices, rendered inside a
|
|
14
|
+
* `RadioGroup`. Use it for single-choice selection in forms or surveys.
|
|
15
|
+
* @summary A single-choice selection control for use inside a RadioGroup.
|
|
16
|
+
*/
|
|
12
17
|
declare const Radio: {
|
|
13
18
|
({ children, label, disabled, helperIcon, helperText, badge, invalidText, validText, validationStatus: validation, showValidationIcon, type, image, ...props }: RadioProps): import("react").JSX.Element;
|
|
14
19
|
displayName: string;
|
|
@@ -25,6 +25,11 @@ RadioGroup.displayName = 'RadioGroup';
|
|
|
25
25
|
RadioIndicator.displayName = 'RadioIndicator';
|
|
26
26
|
RadioIcon.displayName = 'RadioIcon';
|
|
27
27
|
RadioLabel.displayName = 'RadioLabel';
|
|
28
|
+
/**
|
|
29
|
+
* Lets a user pick a single option from a set of mutually exclusive choices, rendered inside a
|
|
30
|
+
* `RadioGroup`. Use it for single-choice selection in forms or surveys.
|
|
31
|
+
* @summary A single-choice selection control for use inside a RadioGroup.
|
|
32
|
+
*/
|
|
28
33
|
const Radio = ({ children, label, disabled, helperIcon, helperText, badge, invalidText, validText, validationStatus: validation, showValidationIcon, type = 'default', image, ...props }) => {
|
|
29
34
|
const { validationStatus: fieldValidationStatus } = useFormFieldContext();
|
|
30
35
|
const { validationStatus: groupValidationStatus, type: groupType } = useRadioGroupContext();
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import type { ComponentType, ReactNode } from 'react';
|
|
2
2
|
import type { PressableProps, ViewProps } from 'react-native';
|
|
3
3
|
interface RadioBaseProps extends Omit<PressableProps, 'children'> {
|
|
4
|
+
/** The value to be used in the radio input, returned on form submission. */
|
|
4
5
|
value: string;
|
|
6
|
+
/** Called when the state of the radio changes. */
|
|
5
7
|
onChange?: (isSelected: boolean) => void;
|
|
8
|
+
/** Whether the radio is disabled. */
|
|
6
9
|
disabled?: boolean;
|
|
10
|
+
/** The validation status of the radio. */
|
|
7
11
|
validationStatus?: 'valid' | 'invalid' | 'initial';
|
|
12
|
+
/**
|
|
13
|
+
* The type of the radio.
|
|
14
|
+
* @default 'default'
|
|
15
|
+
*/
|
|
8
16
|
type?: 'default' | 'tile';
|
|
9
17
|
}
|
|
10
18
|
interface RadioWithChildrenProps extends RadioBaseProps {
|
|
19
|
+
/** Custom content rendered in place of the default label, helper text and validation content. */
|
|
11
20
|
children: ViewProps['children'];
|
|
12
21
|
label?: never;
|
|
13
22
|
helperText?: never;
|
|
@@ -20,13 +29,21 @@ interface RadioWithChildrenProps extends RadioBaseProps {
|
|
|
20
29
|
}
|
|
21
30
|
interface RadioWithoutChildrenProps extends RadioBaseProps {
|
|
22
31
|
children?: never;
|
|
32
|
+
/** The label to be displayed next to the radio. */
|
|
23
33
|
label?: string;
|
|
34
|
+
/** The helper text to be displayed below the radio. */
|
|
24
35
|
helperText?: string;
|
|
36
|
+
/** The icon to be displayed next to the helper text. */
|
|
25
37
|
helperIcon?: ComponentType;
|
|
38
|
+
/** The badge to be displayed below the helper text. */
|
|
26
39
|
badge?: ReactNode;
|
|
40
|
+
/** The invalid text to be displayed below the radio when `validationStatus` is `'invalid'`. */
|
|
27
41
|
invalidText?: string;
|
|
42
|
+
/** The valid text to be displayed below the radio when `validationStatus` is `'valid'`. */
|
|
28
43
|
validText?: string;
|
|
44
|
+
/** Whether to show the validation icon alongside the valid/invalid text. */
|
|
29
45
|
showValidationIcon?: boolean;
|
|
46
|
+
/** The image to be displayed next to the label. */
|
|
30
47
|
image?: ReactNode;
|
|
31
48
|
}
|
|
32
49
|
type RadioProps = RadioWithChildrenProps | RadioWithoutChildrenProps;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import RadioGroupProps from './RadioGroup.props';
|
|
3
|
+
/**
|
|
4
|
+
* Groups a set of `Radio` (or `RadioTile`) options so only one can be selected at a time, and
|
|
5
|
+
* provides shared label, helper text and validation messaging for the group.
|
|
6
|
+
* @summary Groups Radio options into a single-choice set with shared validation.
|
|
7
|
+
*/
|
|
3
8
|
declare const RadioGroup: {
|
|
4
9
|
({ children, disabled, readonly, onChange, onValueChange, validationStatus, label, labelVariant, helperText, invalidText, validText, showValidationIcon, helperIcon, type, direction, gap, ...props }: RadioGroupProps): React.JSX.Element;
|
|
5
10
|
displayName: string;
|
|
@@ -7,6 +7,11 @@ import { Label } from '../Label';
|
|
|
7
7
|
import { RadioGroup as RadioGroupComponent } from './Radio';
|
|
8
8
|
import { RadioGroupContext } from './RadioGroup.context';
|
|
9
9
|
import RadioGroupTextContent from './RadioGroupTextContent';
|
|
10
|
+
/**
|
|
11
|
+
* Groups a set of `Radio` (or `RadioTile`) options so only one can be selected at a time, and
|
|
12
|
+
* provides shared label, helper text and validation messaging for the group.
|
|
13
|
+
* @summary Groups Radio options into a single-choice set with shared validation.
|
|
14
|
+
*/
|
|
10
15
|
const RadioGroup = ({ children, disabled, readonly, onChange, onValueChange, validationStatus, label, labelVariant = 'body', helperText, invalidText, validText, showValidationIcon = true, helperIcon, type, direction = 'column', gap, ...props }) => {
|
|
11
16
|
const value = useMemo(() => ({ disabled, validationStatus, type, direction }), [disabled, validationStatus, type, direction]);
|
|
12
17
|
const showHeader = !!label || !!helperText || !!invalidText || !!validText;
|
|
@@ -2,24 +2,49 @@ import { ComponentType } from 'react';
|
|
|
2
2
|
import { ViewProps } from 'react-native';
|
|
3
3
|
import { space } from '../../tokens';
|
|
4
4
|
interface RadioGroupProps extends ViewProps {
|
|
5
|
+
/** Whether to manually disable the radio group. */
|
|
5
6
|
disabled?: boolean;
|
|
7
|
+
/** The value of the radio group. */
|
|
6
8
|
value?: string;
|
|
9
|
+
/** Called when any child Radio is checked or unchecked. */
|
|
7
10
|
onValueChange?: (value: string) => void;
|
|
8
11
|
/**
|
|
12
|
+
* Called when any child Radio is checked or unchecked.
|
|
9
13
|
* @deprecated Use `onValueChange` instead.
|
|
10
14
|
*/
|
|
11
15
|
onChange?: (value: string) => void;
|
|
16
|
+
/** Whether the radio group is read-only. */
|
|
12
17
|
readonly?: boolean;
|
|
18
|
+
/** The validation status of the radio group. */
|
|
13
19
|
validationStatus?: 'valid' | 'invalid' | 'initial';
|
|
20
|
+
/** The label to be displayed above the radio group. */
|
|
14
21
|
label?: string;
|
|
22
|
+
/**
|
|
23
|
+
* The variant of the label text.
|
|
24
|
+
* @default 'body'
|
|
25
|
+
*/
|
|
15
26
|
labelVariant?: 'heading' | 'body';
|
|
27
|
+
/** The helper text to be displayed below the radio group. */
|
|
16
28
|
helperText?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Whether to show the validation icon alongside the valid/invalid text.
|
|
31
|
+
* @default true
|
|
32
|
+
*/
|
|
17
33
|
showValidationIcon?: boolean;
|
|
34
|
+
/** The invalid text to be displayed below the radio group when `validationStatus` is `'invalid'`. */
|
|
18
35
|
invalidText?: string;
|
|
36
|
+
/** The valid text to be displayed below the radio group when `validationStatus` is `'valid'`. */
|
|
19
37
|
validText?: string;
|
|
38
|
+
/** The icon to be displayed next to the helper text. */
|
|
20
39
|
helperIcon?: ComponentType;
|
|
40
|
+
/** The type of radio rendered by children of the group. */
|
|
21
41
|
type?: 'default' | 'tile';
|
|
42
|
+
/**
|
|
43
|
+
* The layout direction of the radio group's children.
|
|
44
|
+
* @default 'column'
|
|
45
|
+
*/
|
|
22
46
|
direction?: 'row' | 'column';
|
|
47
|
+
/** The gap between the radio group items. */
|
|
23
48
|
gap?: keyof typeof space;
|
|
24
49
|
}
|
|
25
50
|
export default RadioGroupProps;
|
|
@@ -5,10 +5,20 @@ declare const RadioCardIcon: import("react").ForwardRefExoticComponent<import("r
|
|
|
5
5
|
forceMount?: boolean;
|
|
6
6
|
}>;
|
|
7
7
|
declare const RadioCardLabel: import("react").ForwardRefExoticComponent<import("react").RefAttributes<import("../Label/Label.props").default> & Omit<import("../Label/Label.props").default, "ref">>;
|
|
8
|
+
/**
|
|
9
|
+
* Groups a set of `RadioCard` options so only one can be selected at a time, laid out as a
|
|
10
|
+
* flexbox row/column or, when `columns` is set, a grid.
|
|
11
|
+
* @summary Groups RadioCard options into a single-choice set.
|
|
12
|
+
*/
|
|
8
13
|
declare const RadioCardGroup: {
|
|
9
14
|
({ onChange, onValueChange, disabled, ...props }: RadioCardGroupProps): import("react").JSX.Element;
|
|
10
15
|
displayName: string;
|
|
11
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* A card-style single-choice selection control, rendered inside a `RadioCardGroup`. Use it when
|
|
19
|
+
* options need more visual weight or supporting content than a plain `Radio`.
|
|
20
|
+
* @summary A card-style single-choice selection control for use inside a RadioCardGroup.
|
|
21
|
+
*/
|
|
12
22
|
declare const RadioCard: {
|
|
13
23
|
({ children, label, labelVariant, contentStyle, ...props }: RadioCardProps): import("react").JSX.Element;
|
|
14
24
|
displayName: string;
|
|
@@ -19,6 +19,11 @@ const RadioCardGroupComponent = RadioCardComponent.Group;
|
|
|
19
19
|
const RadioCardIndicator = RadioCardComponent.Indicator;
|
|
20
20
|
const RadioCardIcon = RadioCardComponent.Icon;
|
|
21
21
|
const RadioCardLabel = RadioCardComponent.Label;
|
|
22
|
+
/**
|
|
23
|
+
* Groups a set of `RadioCard` options so only one can be selected at a time, laid out as a
|
|
24
|
+
* flexbox row/column or, when `columns` is set, a grid.
|
|
25
|
+
* @summary Groups RadioCard options into a single-choice set.
|
|
26
|
+
*/
|
|
22
27
|
const RadioCardGroup = ({ onChange, onValueChange, disabled, ...props }) => (_jsx(RadioCardGroupComponent, { ...props, disabled: disabled, isDisabled: disabled, onChange: (value) => {
|
|
23
28
|
onChange?.(value);
|
|
24
29
|
onValueChange?.(value);
|
|
@@ -27,6 +32,11 @@ RadioCardGroup.displayName = 'RadioCardGroup';
|
|
|
27
32
|
RadioCardIndicator.displayName = 'RadioCardIndicator';
|
|
28
33
|
RadioCardIcon.displayName = 'RadioCardIcon';
|
|
29
34
|
RadioCardLabel.displayName = 'RadioCardLabel';
|
|
35
|
+
/**
|
|
36
|
+
* A card-style single-choice selection control, rendered inside a `RadioCardGroup`. Use it when
|
|
37
|
+
* options need more visual weight or supporting content than a plain `Radio`.
|
|
38
|
+
* @summary A card-style single-choice selection control for use inside a RadioCardGroup.
|
|
39
|
+
*/
|
|
30
40
|
const RadioCard = ({ children, label, labelVariant = 'body', contentStyle, ...props }) => {
|
|
31
41
|
const { computedStyles } = useStyleProps(props);
|
|
32
42
|
return (_jsxs(RadioCardComponent, { ...props, children: [_jsxs(View, { style: styles.radioContainer, children: [_jsx(RadioCardIndicator, { children: _jsx(RadioCardIcon, {}) }), !!label && _jsx(RadioCardLabel, { variant: labelVariant, children: label })] }), !!children && _jsx(View, { style: [computedStyles, contentStyle], children: children })] }));
|
|
@@ -2,16 +2,30 @@ import type { PressableProps, ViewStyle } from 'react-native';
|
|
|
2
2
|
import { ViewProps } from 'react-native';
|
|
3
3
|
import { SpaceValue } from '../../types';
|
|
4
4
|
interface RadioCardProps extends Omit<PressableProps, 'children'> {
|
|
5
|
+
/** The value to be used in the radio card input, returned on form submission. */
|
|
5
6
|
value: string;
|
|
7
|
+
/** Called when the state of the radio card changes. */
|
|
6
8
|
onChange?: (isSelected: boolean) => void;
|
|
9
|
+
/** The content to be displayed inside the radio card. */
|
|
7
10
|
children?: ViewProps['children'];
|
|
11
|
+
/** The label to be displayed next to the radio card. */
|
|
8
12
|
label?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The variant of the label text.
|
|
15
|
+
* @default 'body'
|
|
16
|
+
*/
|
|
9
17
|
labelVariant?: 'heading' | 'body';
|
|
18
|
+
/** Sets the direction of the flex items. */
|
|
10
19
|
flexDirection?: ViewStyle['flexDirection'];
|
|
20
|
+
/** Sets whether flex items are forced onto one line or can wrap. */
|
|
11
21
|
flexWrap?: ViewStyle['flexWrap'];
|
|
22
|
+
/** Sets the alignment of flex items on the cross axis. */
|
|
12
23
|
alignItems?: ViewStyle['alignItems'];
|
|
24
|
+
/** Sets the alignment of flex items on the main axis. */
|
|
13
25
|
justifyContent?: ViewStyle['justifyContent'];
|
|
26
|
+
/** Additional style applied to the `children` content wrapper. */
|
|
14
27
|
contentStyle?: ViewStyle;
|
|
28
|
+
/** The gap between the indicator/label row and the `children` content. */
|
|
15
29
|
gap?: SpaceValue;
|
|
16
30
|
}
|
|
17
31
|
export default RadioCardProps;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import RadioCardGroupProps from './RadioCardGroup.props';
|
|
2
|
+
/**
|
|
3
|
+
* Groups a set of `RadioCard` options so only one can be selected at a time, laid
|
|
4
|
+
* out as a flexbox row/column or, when `columns` is set, a grid.
|
|
5
|
+
*/
|
|
2
6
|
declare const RadioCardGroup: {
|
|
3
7
|
({ children, gap, style, flexDirection, flexWrap, justifyContent, alignItems, columns, disabled, isDisabled, ...props }: RadioCardGroupProps & {
|
|
4
8
|
isDisabled?: boolean;
|
|
@@ -4,6 +4,10 @@ import { View } from 'react-native';
|
|
|
4
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
5
5
|
import { Grid } from '../Grid';
|
|
6
6
|
import { RadioCardGroupContext } from './RadioCardGroup.context';
|
|
7
|
+
/**
|
|
8
|
+
* Groups a set of `RadioCard` options so only one can be selected at a time, laid
|
|
9
|
+
* out as a flexbox row/column or, when `columns` is set, a grid.
|
|
10
|
+
*/
|
|
7
11
|
const RadioCardGroup = ({ children, gap = '200', style, flexDirection = 'row', flexWrap, justifyContent, alignItems, columns, disabled,
|
|
8
12
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
9
13
|
isDisabled, ...props }) => {
|
|
@@ -3,24 +3,41 @@ import { space } from '../../tokens';
|
|
|
3
3
|
import { GridProps } from '../Grid';
|
|
4
4
|
import { Ref } from 'react';
|
|
5
5
|
type RadioCardGroupBaseProps = {
|
|
6
|
+
/** The value of the currently selected `RadioCard`. */
|
|
6
7
|
value?: string;
|
|
8
|
+
/** Called when the selected `RadioCard` changes. */
|
|
7
9
|
onValueChange?: (value: string) => void;
|
|
8
10
|
/**
|
|
11
|
+
* Called when any child RadioCard is checked or unchecked.
|
|
9
12
|
* @deprecated Use `onValueChange` instead.
|
|
10
13
|
*/
|
|
11
14
|
onChange?: (value: string) => void;
|
|
15
|
+
/** The gap between the `RadioCard` items. */
|
|
12
16
|
gap?: keyof typeof space;
|
|
17
|
+
/** If `true`, disables all `RadioCard`s in the group. */
|
|
13
18
|
disabled?: boolean;
|
|
19
|
+
/** Forwarded ref to the underlying view. */
|
|
14
20
|
ref?: Ref<View>;
|
|
15
21
|
} & ViewProps;
|
|
16
22
|
type RadioCardGroupFlexProps = {
|
|
17
23
|
columns?: never;
|
|
24
|
+
/**
|
|
25
|
+
* (Flexbox only) Sets the direction of the flex items.
|
|
26
|
+
* @default 'row'
|
|
27
|
+
*/
|
|
18
28
|
flexDirection?: ViewStyle['flexDirection'];
|
|
29
|
+
/**
|
|
30
|
+
* (Flexbox only) Sets whether flex items are forced onto one line or can wrap.
|
|
31
|
+
* @default 'wrap'
|
|
32
|
+
*/
|
|
19
33
|
flexWrap?: ViewStyle['flexWrap'];
|
|
34
|
+
/** (Flexbox only) Sets the alignment of flex items on the cross axis. */
|
|
20
35
|
alignItems?: ViewStyle['alignItems'];
|
|
36
|
+
/** (Flexbox only) Sets the alignment of flex items on the main axis. */
|
|
21
37
|
justifyContent?: ViewStyle['justifyContent'];
|
|
22
38
|
};
|
|
23
39
|
type RadioCardGroupGridProps = {
|
|
40
|
+
/** If set, uses a grid layout with this many columns instead of flexbox. */
|
|
24
41
|
columns: GridProps['columns'];
|
|
25
42
|
flexDirection?: never;
|
|
26
43
|
flexWrap?: never;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type RatingProps from './Rating.props';
|
|
2
|
+
/**
|
|
3
|
+
* Lets a user give a star or emoji rating, and shows a label describing the currently selected
|
|
4
|
+
* value. Use it to collect quick feedback such as a satisfaction or experience score.
|
|
5
|
+
* @summary A star or emoji rating input.
|
|
6
|
+
*/
|
|
2
7
|
declare const Rating: {
|
|
3
8
|
({ variant, value, defaultValue, onChange, onValueChange, disabled, labels, rangeLabels, hideLabel, style, accessibilityLabel, ...props }: RatingProps): import("react").JSX.Element;
|
|
4
9
|
displayName: string;
|
|
@@ -27,6 +27,11 @@ const DEFAULT_LABELS = {
|
|
|
27
27
|
5: 'Great!',
|
|
28
28
|
};
|
|
29
29
|
const clampRating = (value) => Math.min(MAX_RATING, Math.max(0, Math.round(value)));
|
|
30
|
+
/**
|
|
31
|
+
* Lets a user give a star or emoji rating, and shows a label describing the currently selected
|
|
32
|
+
* value. Use it to collect quick feedback such as a satisfaction or experience score.
|
|
33
|
+
* @summary A star or emoji rating input.
|
|
34
|
+
*/
|
|
30
35
|
const Rating = ({ variant = 'stars', value, defaultValue = 0, onChange, onValueChange, disabled = false, labels, rangeLabels = DEFAULT_RANGE_LABELS, hideLabel = false, style, accessibilityLabel, ...props }) => {
|
|
31
36
|
const isControlled = value !== undefined;
|
|
32
37
|
const [internalValue, setInternalValue] = useState(clampRating(defaultValue));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type RoundelProps from './Roundel.props';
|
|
2
|
+
/** A small status indicator icon, used to show success, pending or error state next to related content. */
|
|
2
3
|
declare const Roundel: {
|
|
3
4
|
({ variant, style, ...props }: RoundelProps): import("react").JSX.Element;
|
|
4
5
|
displayName: string;
|
|
@@ -3,6 +3,7 @@ import { CloseSmallIcon, TickSmallIcon } from '@utilitywarehouse/hearth-react-na
|
|
|
3
3
|
import { View } from 'react-native';
|
|
4
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
5
5
|
import { Icon } from '../Icon';
|
|
6
|
+
/** A small status indicator icon, used to show success, pending or error state next to related content. */
|
|
6
7
|
const Roundel = ({ variant = 'success', style, ...props }) => {
|
|
7
8
|
styles.useVariants({ variant });
|
|
8
9
|
const icon = variant === 'error' ? CloseSmallIcon : variant === 'success' ? TickSmallIcon : undefined;
|