@utilitywarehouse/hearth-react-native 0.1.0 → 0.3.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/.storybook/preview.tsx +5 -0
- package/.storybook/prism-setup.ts +104 -0
- package/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-lint.log +1 -1
- package/CHANGELOG.md +42 -0
- package/build/components/Accordion/Accordion.d.ts +1 -1
- package/build/components/Accordion/Accordion.js +7 -7
- package/build/components/Accordion/Accordion.props.d.ts +2 -2
- package/build/components/Accordion/AccordionIcon.js +2 -2
- package/build/components/Accordion/AccordionItemRoot.js +2 -2
- package/build/components/Accordion/AccordionTrigger.js +4 -4
- package/build/components/Accordion/index.d.ts +1 -2
- package/build/components/Accordion/index.js +1 -2
- package/build/components/Alert/Alert.js +21 -21
- package/build/components/Alert/Alert.props.d.ts +3 -3
- package/build/components/Alert/AlertCloseButton.js +2 -2
- package/build/components/Alert/AlertIcon.js +5 -5
- package/build/components/Badge/Badge.context.d.ts +4 -0
- package/build/components/Badge/Badge.js +179 -33
- package/build/components/Badge/Badge.props.d.ts +3 -2
- package/build/components/Badge/BadgeIcon.js +29 -19
- package/build/components/Badge/BadgeText.js +30 -19
- package/build/components/BodyText/BodyText.js +2 -2
- package/build/components/BottomSheet/BottomSheet.d.ts +1 -1
- package/build/components/BottomSheet/BottomSheet.js +3 -3
- package/build/components/BottomSheet/BottomSheetHandle.js +1 -1
- package/build/components/BottomSheet/BottomSheetModal.js +1 -1
- package/build/components/BottomSheet/BottomSheetScrollView.js +3 -1
- package/build/components/BottomSheet/BottomSheetView.js +1 -1
- package/build/components/Button/Button.d.ts +2 -2
- package/build/components/Button/Button.props.d.ts +7 -7
- package/build/components/Button/ButtonGroupRoot.d.ts +3 -2
- package/build/components/Button/ButtonGroupRoot.js +9 -0
- package/build/components/Button/ButtonIcon.js +29 -29
- package/build/components/Button/ButtonRoot.js +79 -88
- package/build/components/Button/ButtonSpinner.js +28 -31
- package/build/components/Button/ButtonText.js +40 -26
- package/build/components/Card/Card.props.d.ts +3 -3
- package/build/components/Card/CardRoot.js +56 -56
- package/build/components/Checkbox/CheckboxIcon.js +3 -3
- package/build/components/Checkbox/CheckboxIndicator.js +3 -3
- package/build/components/Checkbox/CheckboxTileRoot.js +3 -3
- package/build/components/CurrencyInput/CurrencyInput.d.ts +6 -0
- package/build/components/CurrencyInput/CurrencyInput.js +47 -0
- package/build/components/CurrencyInput/CurrencyInput.props.d.ts +14 -0
- package/build/components/CurrencyInput/index.d.ts +1 -0
- package/build/components/CurrencyInput/index.js +1 -0
- package/build/components/DescriptionList/DescriptionList.context.d.ts +6 -0
- package/build/components/DescriptionList/DescriptionList.context.js +9 -0
- package/build/components/DescriptionList/DescriptionList.d.ts +6 -0
- package/build/components/DescriptionList/DescriptionList.js +25 -0
- package/build/components/DescriptionList/DescriptionList.props.d.ts +18 -0
- package/build/components/DescriptionList/DescriptionListItem.d.ts +6 -0
- package/build/components/DescriptionList/DescriptionListItem.js +49 -0
- package/build/components/DescriptionList/DescriptionListItem.props.d.ts +17 -0
- package/build/components/DescriptionList/DescriptionListItem.props.js +1 -0
- package/build/components/DescriptionList/index.d.ts +4 -0
- package/build/components/DescriptionList/index.js +2 -0
- package/build/components/DetailText/DetailText.js +2 -2
- package/build/components/Divider/Divider.js +47 -1
- package/build/components/Divider/Divider.props.d.ts +2 -2
- package/build/components/Flex/Flex.props.d.ts +3 -2
- package/build/components/Grid/Grid.props.d.ts +2 -2
- package/build/components/Heading/Heading.js +2 -2
- package/build/components/Heading/Heading.props.d.ts +3 -1
- package/build/components/Helper/HelperIcon.js +3 -3
- package/build/components/Helper/HelperText.js +4 -4
- package/build/components/IconButton/IconButtonIcon.js +29 -29
- package/build/components/IconButton/IconButtonRoot.js +94 -88
- package/build/components/IconButton/IconButtonSpinner.js +27 -30
- package/build/components/IconContainer/IconContainer.d.ts +5 -0
- package/build/components/IconContainer/IconContainer.js +161 -0
- package/build/components/IconContainer/IconContainer.props.d.ts +15 -0
- package/build/components/IconContainer/IconContainer.props.js +1 -0
- package/build/components/IconContainer/index.d.ts +2 -0
- package/build/components/IconContainer/index.js +1 -0
- package/build/components/Icons/CircleIcon.js +3 -3
- package/build/components/InlineLink/InlineLinkRoot.js +2 -2
- package/build/components/Input/Input.d.ts +9 -3
- package/build/components/Input/Input.js +11 -43
- package/build/components/Input/Input.props.d.ts +2 -17
- package/build/components/Input/InputField.d.ts +3 -1
- package/build/components/Input/InputField.js +9 -46
- package/build/components/Input/InputIcon.js +1 -1
- package/build/components/Input/InputRoot.js +9 -9
- package/build/components/Label/Label.js +1 -1
- package/build/components/Link/LinkRoot.js +2 -2
- package/build/components/List/List.d.ts +1 -1
- package/build/components/List/List.js +6 -4
- package/build/components/List/List.props.d.ts +9 -10
- package/build/components/List/ListItem/ListItemHelperText.js +1 -1
- package/build/components/List/ListItem/ListItemIcon.js +1 -1
- package/build/components/List/ListItem/ListItemRoot.js +15 -6
- package/build/components/List/ListItem/ListItemTrailingIcon.js +1 -1
- package/build/components/List/index.d.ts +0 -1
- package/build/components/List/index.js +0 -1
- package/build/components/Modal/Modal.d.ts +7 -0
- package/build/components/Modal/Modal.js +180 -0
- package/build/components/Modal/Modal.props.d.ts +24 -0
- package/build/components/Modal/Modal.props.js +1 -0
- package/build/components/Modal/Modal.web.d.ts +7 -0
- package/build/components/Modal/Modal.web.js +164 -0
- package/build/components/Modal/index.d.ts +2 -0
- package/build/components/Modal/index.js +1 -0
- package/build/components/Radio/RadioIndicator.js +2 -2
- package/build/components/Radio/RadioTileRoot.js +3 -3
- package/build/components/RadioCard/RadioCardIndicator.js +2 -2
- package/build/components/RadioCard/RadioCardRoot.js +3 -3
- package/build/components/SectionHeader/SectionHeader.d.ts +6 -0
- package/build/components/SectionHeader/SectionHeader.js +20 -0
- package/build/components/{List/ListHeading/ListHeading.props.d.ts → SectionHeader/SectionHeader.props.d.ts} +7 -9
- package/build/components/SectionHeader/SectionHeader.props.js +1 -0
- package/build/components/SectionHeader/SectionHeaderHeading.d.ts +6 -0
- package/build/components/SectionHeader/SectionHeaderHeading.js +7 -0
- package/build/components/SectionHeader/SectionHeaderHelperText.d.ts +6 -0
- package/build/components/{List/ListHeading/ListHeadingHelperText.js → SectionHeader/SectionHeaderHelperText.js} +5 -5
- package/build/components/{List/ListHeading/ListHeadingTextContent.d.ts → SectionHeader/SectionHeaderTextContent.d.ts} +2 -2
- package/build/components/{List/ListHeading/ListHeadingTextContent.js → SectionHeader/SectionHeaderTextContent.js} +4 -4
- package/build/components/SectionHeader/index.d.ts +4 -0
- package/build/components/SectionHeader/index.js +4 -0
- package/build/components/Select/Select.js +10 -10
- package/build/components/Select/SelectOption.js +6 -6
- package/build/components/Spinner/Spinner.web.js +3 -3
- package/build/components/Switch/Switch.js +10 -7
- package/build/components/Switch/Switch.web.js +10 -8
- package/build/components/Tabs/Tab.d.ts +18 -0
- package/build/components/Tabs/Tab.js +74 -0
- package/build/components/Tabs/Tab.props.d.ts +14 -0
- package/build/components/Tabs/Tab.props.js +1 -0
- package/build/components/Tabs/TabPanel.d.ts +3 -0
- package/build/components/Tabs/TabPanel.js +34 -0
- package/build/components/Tabs/TabPanel.props.d.ts +8 -0
- package/build/components/Tabs/TabPanel.props.js +1 -0
- package/build/components/Tabs/Tabs.context.d.ts +23 -0
- package/build/components/Tabs/Tabs.context.js +8 -0
- package/build/components/Tabs/Tabs.d.ts +6 -0
- package/build/components/Tabs/Tabs.js +114 -0
- package/build/components/Tabs/Tabs.props.d.ts +19 -0
- package/build/components/Tabs/Tabs.props.js +1 -0
- package/build/components/Tabs/TabsList.d.ts +6 -0
- package/build/components/Tabs/TabsList.js +112 -0
- package/build/components/Tabs/TabsList.props.d.ts +6 -0
- package/build/components/Tabs/TabsList.props.js +1 -0
- package/build/components/Tabs/index.d.ts +8 -0
- package/build/components/Tabs/index.js +4 -0
- package/build/components/Textarea/TextareaField.js +5 -5
- package/build/components/Textarea/TextareaRoot.js +9 -9
- package/build/components/ToggleButton/ToggleButtonIcon.js +3 -3
- package/build/components/ToggleButton/ToggleButtonRoot.js +9 -9
- package/build/components/ToggleButton/ToggleButtonText.js +2 -2
- package/build/components/ToggleButtonCard/ToggleButtonCardRoot.js +3 -3
- package/build/components/index.d.ts +9 -3
- package/build/components/index.js +9 -3
- package/build/core/themes.d.ts +1442 -258
- package/build/core/themes.js +59 -3
- package/build/tokens/color.d.ts +1010 -86
- package/build/tokens/color.js +505 -43
- package/build/tokens/components/dark/accordion.d.ts +0 -2
- package/build/tokens/components/dark/accordion.js +0 -2
- package/build/tokens/components/dark/alert.d.ts +0 -16
- package/build/tokens/components/dark/alert.js +0 -16
- package/build/tokens/components/dark/avatar.d.ts +19 -0
- package/build/tokens/components/dark/avatar.js +18 -0
- package/build/tokens/components/dark/badge.d.ts +7 -34
- package/build/tokens/components/dark/badge.js +7 -34
- package/build/tokens/components/dark/banner.d.ts +1 -10
- package/build/tokens/components/dark/banner.js +1 -10
- package/build/tokens/components/dark/bottom-navigation.d.ts +2 -7
- package/build/tokens/components/dark/bottom-navigation.js +2 -7
- package/build/tokens/components/dark/bottom-sheet.d.ts +1 -2
- package/build/tokens/components/dark/bottom-sheet.js +1 -2
- package/build/tokens/components/dark/breadcrumb.d.ts +0 -1
- package/build/tokens/components/dark/breadcrumb.js +0 -1
- package/build/tokens/components/dark/button.d.ts +1 -86
- package/build/tokens/components/dark/button.js +1 -86
- package/build/tokens/components/dark/card.d.ts +0 -28
- package/build/tokens/components/dark/card.js +0 -28
- package/build/tokens/components/dark/carousel-control.d.ts +0 -8
- package/build/tokens/components/dark/carousel-control.js +0 -8
- package/build/tokens/components/dark/checkbox.d.ts +2 -11
- package/build/tokens/components/dark/checkbox.js +2 -11
- package/build/tokens/components/dark/date-picker.d.ts +0 -12
- package/build/tokens/components/dark/date-picker.js +0 -12
- package/build/tokens/components/dark/description-list.d.ts +20 -0
- package/build/tokens/components/dark/description-list.js +19 -0
- package/build/tokens/components/dark/dialog.d.ts +0 -1
- package/build/tokens/components/dark/dialog.js +0 -1
- package/build/tokens/components/dark/divider.d.ts +4 -1
- package/build/tokens/components/dark/divider.js +4 -1
- package/build/tokens/components/dark/expandable-card.d.ts +11 -0
- package/build/tokens/components/dark/expandable-card.js +10 -0
- package/build/tokens/components/dark/icon-button.d.ts +5 -5
- package/build/tokens/components/dark/icon-button.js +5 -5
- package/build/tokens/components/dark/icon-container.d.ts +0 -17
- package/build/tokens/components/dark/icon-container.js +0 -17
- package/build/tokens/components/dark/index.d.ts +10 -4
- package/build/tokens/components/dark/index.js +10 -4
- package/build/tokens/components/dark/indicator-icon-button.d.ts +11 -0
- package/build/tokens/components/dark/indicator-icon-button.js +10 -0
- package/build/tokens/components/dark/inline-link.d.ts +1 -1
- package/build/tokens/components/dark/inline-link.js +1 -1
- package/build/tokens/components/dark/input.d.ts +1 -9
- package/build/tokens/components/dark/input.js +1 -9
- package/build/tokens/components/dark/link.d.ts +2 -2
- package/build/tokens/components/dark/link.js +2 -2
- package/build/tokens/components/dark/list.d.ts +20 -20
- package/build/tokens/components/dark/list.js +20 -20
- package/build/tokens/components/dark/menu.d.ts +0 -12
- package/build/tokens/components/dark/menu.js +0 -12
- package/build/tokens/components/dark/modal.d.ts +0 -1
- package/build/tokens/components/dark/modal.js +0 -1
- package/build/tokens/components/dark/navigation.d.ts +1 -6
- package/build/tokens/components/dark/navigation.js +1 -6
- package/build/tokens/components/dark/pagination.d.ts +12 -0
- package/build/tokens/components/dark/pagination.js +11 -0
- package/build/tokens/components/dark/parts.d.ts +14 -4
- package/build/tokens/components/dark/parts.js +14 -4
- package/build/tokens/components/dark/pill.d.ts +0 -10
- package/build/tokens/components/dark/pill.js +0 -10
- package/build/tokens/components/dark/progress-stepper.d.ts +0 -8
- package/build/tokens/components/dark/progress-stepper.js +0 -8
- package/build/tokens/components/dark/radio.d.ts +2 -9
- package/build/tokens/components/dark/radio.js +2 -9
- package/build/tokens/components/dark/{focus.d.ts → section-header.d.ts} +4 -2
- package/build/tokens/components/dark/{focus.js → section-header.js} +4 -2
- package/build/tokens/components/dark/segmented-control.d.ts +0 -8
- package/build/tokens/components/dark/segmented-control.js +0 -8
- package/build/tokens/components/dark/select.d.ts +0 -10
- package/build/tokens/components/dark/select.js +0 -10
- package/build/tokens/components/dark/spinner.d.ts +1 -1
- package/build/tokens/components/dark/spinner.js +1 -1
- package/build/tokens/components/dark/switch.d.ts +1 -11
- package/build/tokens/components/dark/switch.js +1 -11
- package/build/tokens/components/dark/table.d.ts +23 -0
- package/build/tokens/components/dark/table.js +22 -0
- package/build/tokens/components/dark/tabs.d.ts +26 -0
- package/build/tokens/components/dark/tabs.js +25 -0
- package/build/tokens/components/dark/toast.d.ts +10 -0
- package/build/tokens/components/dark/toast.js +9 -0
- package/build/tokens/components/dark/toggle-button.d.ts +0 -11
- package/build/tokens/components/dark/toggle-button.js +0 -11
- package/build/tokens/components/dark/tooltip.d.ts +12 -0
- package/build/tokens/components/dark/tooltip.js +11 -0
- package/build/tokens/components/dark/top-navigation.d.ts +0 -8
- package/build/tokens/components/dark/top-navigation.js +0 -8
- package/build/tokens/components/light/accordion.d.ts +0 -2
- package/build/tokens/components/light/accordion.js +0 -2
- package/build/tokens/components/light/alert.d.ts +0 -16
- package/build/tokens/components/light/alert.js +0 -16
- package/build/tokens/components/light/avatar.d.ts +19 -0
- package/build/tokens/components/light/avatar.js +18 -0
- package/build/tokens/components/light/badge.d.ts +7 -34
- package/build/tokens/components/light/badge.js +7 -34
- package/build/tokens/components/light/banner.d.ts +2 -11
- package/build/tokens/components/light/banner.js +2 -11
- package/build/tokens/components/light/bottom-navigation.d.ts +0 -5
- package/build/tokens/components/light/bottom-navigation.js +0 -5
- package/build/tokens/components/light/bottom-sheet.d.ts +1 -2
- package/build/tokens/components/light/bottom-sheet.js +1 -2
- package/build/tokens/components/light/breadcrumb.d.ts +0 -1
- package/build/tokens/components/light/breadcrumb.js +0 -1
- package/build/tokens/components/light/button.d.ts +1 -86
- package/build/tokens/components/light/button.js +1 -86
- package/build/tokens/components/light/card.d.ts +0 -28
- package/build/tokens/components/light/card.js +0 -28
- package/build/tokens/components/light/carousel-control.d.ts +0 -8
- package/build/tokens/components/light/carousel-control.js +0 -8
- package/build/tokens/components/light/checkbox.d.ts +3 -12
- package/build/tokens/components/light/checkbox.js +3 -12
- package/build/tokens/components/light/date-picker.d.ts +0 -12
- package/build/tokens/components/light/date-picker.js +0 -12
- package/build/tokens/components/light/description-list.d.ts +20 -0
- package/build/tokens/components/light/description-list.js +19 -0
- package/build/tokens/components/light/dialog.d.ts +0 -1
- package/build/tokens/components/light/dialog.js +0 -1
- package/build/tokens/components/light/divider.d.ts +4 -1
- package/build/tokens/components/light/divider.js +4 -1
- package/build/tokens/components/light/expandable-card.d.ts +11 -0
- package/build/tokens/components/light/expandable-card.js +10 -0
- package/build/tokens/components/light/icon-button.d.ts +5 -5
- package/build/tokens/components/light/icon-button.js +5 -5
- package/build/tokens/components/light/icon-container.d.ts +0 -17
- package/build/tokens/components/light/icon-container.js +0 -17
- package/build/tokens/components/light/index.d.ts +10 -4
- package/build/tokens/components/light/index.js +10 -4
- package/build/tokens/components/light/indicator-icon-button.d.ts +11 -0
- package/build/tokens/components/light/indicator-icon-button.js +10 -0
- package/build/tokens/components/light/input.d.ts +1 -9
- package/build/tokens/components/light/input.js +1 -9
- package/build/tokens/components/light/link.d.ts +2 -2
- package/build/tokens/components/light/link.js +2 -2
- package/build/tokens/components/light/list.d.ts +20 -20
- package/build/tokens/components/light/list.js +20 -20
- package/build/tokens/components/light/menu.d.ts +0 -12
- package/build/tokens/components/light/menu.js +0 -12
- package/build/tokens/components/light/modal.d.ts +0 -1
- package/build/tokens/components/light/modal.js +0 -1
- package/build/tokens/components/light/navigation.d.ts +1 -6
- package/build/tokens/components/light/navigation.js +1 -6
- package/build/tokens/components/light/pagination.d.ts +12 -0
- package/build/tokens/components/light/pagination.js +11 -0
- package/build/tokens/components/light/parts.d.ts +11 -1
- package/build/tokens/components/light/parts.js +11 -1
- package/build/tokens/components/light/pill.d.ts +0 -10
- package/build/tokens/components/light/pill.js +0 -10
- package/build/tokens/components/light/progress-stepper.d.ts +0 -8
- package/build/tokens/components/light/progress-stepper.js +0 -8
- package/build/tokens/components/light/radio.d.ts +3 -10
- package/build/tokens/components/light/radio.js +3 -10
- package/build/tokens/components/light/section-header.d.ts +10 -0
- package/build/tokens/components/light/section-header.js +9 -0
- package/build/tokens/components/light/segmented-control.d.ts +0 -8
- package/build/tokens/components/light/segmented-control.js +0 -8
- package/build/tokens/components/light/select.d.ts +0 -10
- package/build/tokens/components/light/select.js +0 -10
- package/build/tokens/components/light/switch.d.ts +1 -11
- package/build/tokens/components/light/switch.js +1 -11
- package/build/tokens/components/light/table.d.ts +23 -0
- package/build/tokens/components/light/table.js +22 -0
- package/build/tokens/components/light/tabs.d.ts +26 -0
- package/build/tokens/components/light/tabs.js +25 -0
- package/build/tokens/components/light/toast.d.ts +10 -0
- package/build/tokens/components/light/toast.js +9 -0
- package/build/tokens/components/light/toggle-button.d.ts +0 -11
- package/build/tokens/components/light/toggle-button.js +0 -11
- package/build/tokens/components/light/tooltip.d.ts +12 -0
- package/build/tokens/components/light/tooltip.js +11 -0
- package/build/tokens/components/light/top-navigation.d.ts +0 -8
- package/build/tokens/components/light/top-navigation.js +0 -8
- package/build/tokens/index.d.ts +1 -0
- package/build/tokens/index.js +1 -0
- package/build/tokens/layout.d.ts +48 -30
- package/build/tokens/layout.js +24 -15
- package/build/tokens/semantic-dark.d.ts +242 -13
- package/build/tokens/semantic-dark.js +242 -13
- package/build/tokens/semantic-light.d.ts +242 -13
- package/build/tokens/semantic-light.js +242 -13
- package/build/tokens/{components/light/focus.d.ts → semantic.d.ts} +3 -2
- package/build/tokens/{components/light/focus.js → semantic.js} +3 -2
- package/build/types/values.d.ts +12 -7
- package/build/utils/coloursAsArray.d.ts +8 -0
- package/build/utils/coloursAsArray.js +37 -2
- package/build/utils/formatThousands.d.ts +2 -0
- package/build/utils/formatThousands.js +16 -0
- package/build/utils/getFlattenedColorValue.d.ts +3 -1
- package/build/utils/hexWithOpacity.d.ts +2 -0
- package/build/utils/hexWithOpacity.js +15 -0
- package/build/utils/index.d.ts +3 -1
- package/build/utils/index.js +3 -1
- package/build/utils/styleUtils.js +33 -1
- package/docs/assets/modal-android.mp4 +0 -0
- package/docs/assets/modal-ios.mp4 +0 -0
- package/docs/assets/pigs.png +0 -0
- package/docs/components/AllComponents.web.tsx +135 -9
- package/docs/components/BadgeList.tsx +8 -8
- package/docs/components/NextPrevPage.tsx +11 -3
- package/docs/components/UsageWrap.tsx +2 -2
- package/docs/components/ViewFigmaButton.tsx +3 -3
- package/docs/heplers/addReactNativePrefix.ts +8 -0
- package/docs/heplers/index.ts +1 -0
- package/docs/introduction.mdx +2 -2
- package/docs/llm-docs/unistyles-llms-full.txt +1 -1
- package/docs/theme-tokens.mdx +91 -26
- package/package.json +21 -19
- package/src/components/Accordion/Accordion.docs.mdx +25 -39
- package/src/components/Accordion/Accordion.props.ts +2 -2
- package/src/components/Accordion/Accordion.stories.tsx +10 -10
- package/src/components/Accordion/Accordion.tsx +14 -14
- package/src/components/Accordion/AccordionIcon.tsx +2 -2
- package/src/components/Accordion/AccordionItemRoot.tsx +3 -3
- package/src/components/Accordion/AccordionTrigger.tsx +4 -4
- package/src/components/Accordion/index.ts +3 -4
- package/src/components/Alert/Alert.docs.mdx +25 -25
- package/src/components/Alert/Alert.props.ts +3 -3
- package/src/components/Alert/Alert.stories.tsx +11 -11
- package/src/components/Alert/Alert.tsx +22 -22
- package/src/components/Alert/AlertCloseButton.tsx +3 -3
- package/src/components/Alert/AlertIcon.tsx +7 -7
- package/src/components/Badge/Badge.context.ts +2 -0
- package/src/components/Badge/Badge.docs.mdx +16 -15
- package/src/components/Badge/Badge.props.ts +15 -2
- package/src/components/Badge/Badge.stories.tsx +101 -54
- package/src/components/Badge/Badge.tsx +189 -35
- package/src/components/Badge/BadgeIcon.tsx +29 -19
- package/src/components/Badge/BadgeText.tsx +30 -19
- package/src/components/BodyText/BodyText.tsx +4 -4
- package/src/components/BottomSheet/BottomSheet.docs.mdx +23 -5
- package/src/components/BottomSheet/BottomSheet.stories.tsx +9 -9
- package/src/components/BottomSheet/BottomSheet.tsx +5 -5
- package/src/components/BottomSheet/BottomSheetHandle.tsx +1 -1
- package/src/components/BottomSheet/BottomSheetModal.tsx +1 -1
- package/src/components/BottomSheet/BottomSheetScrollView.tsx +4 -2
- package/src/components/BottomSheet/BottomSheetView.tsx +1 -1
- package/src/components/Box/Box.stories.tsx +3 -3
- package/src/components/Button/Button.docs.mdx +35 -35
- package/src/components/Button/Button.props.tsx +7 -7
- package/src/components/Button/Button.stories.tsx +16 -16
- package/src/components/Button/ButtonGroupRoot.tsx +12 -2
- package/src/components/Button/ButtonIcon.tsx +29 -29
- package/src/components/Button/ButtonRoot.tsx +79 -89
- package/src/components/Button/ButtonSpinner.tsx +30 -33
- package/src/components/Button/ButtonText.tsx +40 -26
- package/src/components/Card/Card.docs.mdx +22 -22
- package/src/components/Card/Card.props.ts +11 -11
- package/src/components/Card/Card.stories.tsx +34 -34
- package/src/components/Card/CardRoot.tsx +56 -56
- package/src/components/Checkbox/CheckboxIcon.tsx +4 -4
- package/src/components/Checkbox/CheckboxIndicator.tsx +3 -3
- package/src/components/Checkbox/CheckboxTileRoot.tsx +3 -3
- package/src/components/CurrencyInput/CurrencyInput.docs.mdx +120 -0
- package/src/components/CurrencyInput/CurrencyInput.props.ts +19 -0
- package/src/components/CurrencyInput/CurrencyInput.stories.tsx +116 -0
- package/src/components/CurrencyInput/CurrencyInput.tsx +91 -0
- package/src/components/CurrencyInput/index.ts +1 -0
- package/src/components/DescriptionList/DescriptionList.context.ts +18 -0
- package/src/components/DescriptionList/DescriptionList.docs.mdx +98 -0
- package/src/components/DescriptionList/DescriptionList.props.ts +20 -0
- package/src/components/DescriptionList/DescriptionList.stories.tsx +154 -0
- package/src/components/DescriptionList/DescriptionList.tsx +64 -0
- package/src/components/DescriptionList/DescriptionListItem.props.ts +19 -0
- package/src/components/DescriptionList/DescriptionListItem.tsx +101 -0
- package/src/components/DescriptionList/index.ts +4 -0
- package/src/components/DetailText/DetailText.tsx +3 -3
- package/src/components/Divider/Divider.props.ts +2 -2
- package/src/components/Divider/Divider.stories.tsx +3 -3
- package/src/components/Divider/Divider.tsx +47 -1
- package/src/components/Flex/Flex.docs.mdx +4 -4
- package/src/components/Flex/Flex.props.ts +3 -2
- package/src/components/Flex/Flex.stories.tsx +1 -1
- package/src/components/Grid/Grid.docs.mdx +12 -12
- package/src/components/Grid/Grid.props.ts +2 -2
- package/src/components/Grid/Grid.stories.tsx +2 -2
- package/src/components/Heading/Heading.props.ts +3 -1
- package/src/components/Heading/Heading.tsx +2 -2
- package/src/components/Helper/HelperIcon.tsx +3 -3
- package/src/components/Helper/HelperText.tsx +4 -4
- package/src/components/Icon/Icon.stories.tsx +2 -2
- package/src/components/IconButton/IconButton.docs.mdx +21 -16
- package/src/components/IconButton/IconButton.figma.tsx +1 -1
- package/src/components/IconButton/IconButton.stories.tsx +14 -14
- package/src/components/IconButton/IconButtonIcon.tsx +29 -29
- package/src/components/IconButton/IconButtonRoot.tsx +94 -88
- package/src/components/IconButton/IconButtonSpinner.tsx +27 -30
- package/src/components/IconContainer/IconContainer.docs.mdx +90 -0
- package/src/components/IconContainer/IconContainer.props.ts +17 -0
- package/src/components/IconContainer/IconContainer.stories.tsx +130 -0
- package/src/components/IconContainer/IconContainer.tsx +180 -0
- package/src/components/IconContainer/index.tsx +2 -0
- package/src/components/Icons/CircleIcon.tsx +9 -11
- package/src/components/InlineLink/InlineLinkRoot.tsx +2 -2
- package/src/components/Input/Input.docs.mdx +19 -17
- package/src/components/Input/Input.props.ts +1 -20
- package/src/components/Input/Input.stories.tsx +5 -10
- package/src/components/Input/Input.tsx +16 -61
- package/src/components/Input/InputField.tsx +25 -59
- package/src/components/Input/InputIcon.tsx +1 -1
- package/src/components/Input/InputRoot.tsx +10 -10
- package/src/components/Label/Label.tsx +2 -2
- package/src/components/Link/LinkRoot.tsx +2 -2
- package/src/components/List/List.docs.mdx +35 -56
- package/src/components/List/List.props.ts +9 -10
- package/src/components/List/List.stories.tsx +8 -8
- package/src/components/List/List.tsx +25 -25
- package/src/components/List/ListItem/ListItemHelperText.tsx +1 -1
- package/src/components/List/ListItem/ListItemIcon.tsx +1 -1
- package/src/components/List/ListItem/ListItemRoot.tsx +15 -6
- package/src/components/List/ListItem/ListItemTrailingIcon.tsx +1 -1
- package/src/components/List/index.ts +0 -1
- package/src/components/Modal/Modal.docs.mdx +547 -0
- package/src/components/Modal/Modal.props.ts +26 -0
- package/src/components/Modal/Modal.stories.tsx +222 -0
- package/src/components/Modal/Modal.tsx +351 -0
- package/src/components/Modal/Modal.web.tsx +333 -0
- package/src/components/Modal/index.ts +2 -0
- package/src/components/Radio/RadioIndicator.tsx +2 -2
- package/src/components/Radio/RadioTileRoot.tsx +3 -3
- package/src/components/RadioCard/RadioCardIndicator.tsx +2 -2
- package/src/components/RadioCard/RadioCardRoot.tsx +3 -3
- package/src/components/{List/ListHeading/ListHeading.figma.tsx → SectionHeader/SectionHeader.figma.tsx} +3 -3
- package/src/components/{List/ListHeading/ListHeading.props.ts → SectionHeader/SectionHeader.props.ts} +7 -9
- package/src/components/SectionHeader/SectionHeader.stories.tsx +76 -0
- package/src/components/{List/ListHeading/ListHeading.tsx → SectionHeader/SectionHeader.tsx} +17 -19
- package/src/components/SectionHeader/SectionHeaderHeading.tsx +14 -0
- package/src/components/SectionHeader/SectionHeaderHelperText.tsx +21 -0
- package/src/components/{List/ListHeading/ListHeadingTextContent.tsx → SectionHeader/SectionHeaderTextContent.tsx} +4 -4
- package/src/components/SectionHeader/Sectionheader.docs.mdx +83 -0
- package/src/components/SectionHeader/index.ts +4 -0
- package/src/components/Select/Select.tsx +10 -10
- package/src/components/Select/SelectOption.tsx +7 -7
- package/src/components/Spinner/Spinner.tsx +3 -3
- package/src/components/Spinner/Spinner.web.tsx +12 -12
- package/src/components/Switch/Switch.tsx +10 -7
- package/src/components/Switch/Switch.web.tsx +10 -12
- package/src/components/Tabs/Tab.props.ts +16 -0
- package/src/components/Tabs/Tab.tsx +113 -0
- package/src/components/Tabs/TabPanel.props.ts +10 -0
- package/src/components/Tabs/TabPanel.tsx +46 -0
- package/src/components/Tabs/Tabs.context.ts +26 -0
- package/src/components/Tabs/Tabs.docs.mdx +214 -0
- package/src/components/Tabs/Tabs.props.ts +21 -0
- package/src/components/Tabs/Tabs.stories.tsx +270 -0
- package/src/components/Tabs/Tabs.tsx +139 -0
- package/src/components/Tabs/TabsList.props.ts +8 -0
- package/src/components/Tabs/TabsList.tsx +194 -0
- package/src/components/Tabs/index.ts +8 -0
- package/src/components/Textarea/TextareaField.tsx +5 -5
- package/src/components/Textarea/TextareaRoot.tsx +10 -10
- package/src/components/ToggleButton/ToggleButtonIcon.tsx +3 -3
- package/src/components/ToggleButton/ToggleButtonRoot.tsx +11 -11
- package/src/components/ToggleButton/ToggleButtonText.tsx +2 -2
- package/src/components/ToggleButtonCard/ToggleButtonCardRoot.tsx +3 -3
- package/src/components/index.ts +11 -5
- package/src/core/themes.ts +59 -3
- package/src/tokens/color.ts +505 -43
- package/src/tokens/components/dark/accordion.ts +0 -2
- package/src/tokens/components/dark/alert.ts +0 -16
- package/src/tokens/components/dark/avatar.ts +19 -0
- package/src/tokens/components/dark/badge.ts +7 -34
- package/src/tokens/components/dark/banner.ts +1 -10
- package/src/tokens/components/dark/bottom-navigation.ts +2 -7
- package/src/tokens/components/dark/bottom-sheet.ts +1 -2
- package/src/tokens/components/dark/breadcrumb.ts +0 -1
- package/src/tokens/components/dark/button.ts +1 -86
- package/src/tokens/components/dark/card.ts +0 -28
- package/src/tokens/components/dark/carousel-control.ts +0 -8
- package/src/tokens/components/dark/checkbox.ts +2 -11
- package/src/tokens/components/dark/date-picker.ts +0 -12
- package/src/tokens/components/dark/description-list.ts +20 -0
- package/src/tokens/components/dark/dialog.ts +0 -1
- package/src/tokens/components/dark/divider.ts +4 -1
- package/src/tokens/components/{light/footer.ts → dark/expandable-card.ts} +4 -5
- package/src/tokens/components/dark/icon-button.ts +5 -5
- package/src/tokens/components/dark/icon-container.ts +0 -17
- package/src/tokens/components/dark/index.ts +10 -4
- package/src/tokens/components/dark/{footer.ts → indicator-icon-button.ts} +4 -5
- package/src/tokens/components/dark/inline-link.ts +1 -1
- package/src/tokens/components/dark/input.ts +1 -9
- package/src/tokens/components/dark/link.ts +2 -2
- package/src/tokens/components/dark/list.ts +20 -20
- package/src/tokens/components/dark/menu.ts +0 -12
- package/src/tokens/components/dark/modal.ts +0 -1
- package/src/tokens/components/dark/navigation.ts +1 -6
- package/src/tokens/components/dark/pagination.ts +12 -0
- package/src/tokens/components/dark/parts.ts +14 -4
- package/src/tokens/components/dark/pill.ts +0 -10
- package/src/tokens/components/dark/progress-stepper.ts +0 -8
- package/src/tokens/components/dark/radio.ts +2 -9
- package/src/tokens/components/dark/{focus.ts → section-header.ts} +4 -2
- package/src/tokens/components/dark/segmented-control.ts +0 -8
- package/src/tokens/components/dark/select.ts +0 -10
- package/src/tokens/components/dark/spinner.ts +1 -1
- package/src/tokens/components/dark/switch.ts +1 -11
- package/src/tokens/components/dark/table.ts +23 -0
- package/src/tokens/components/dark/tabs.ts +26 -0
- package/src/tokens/components/dark/toast.ts +10 -0
- package/src/tokens/components/dark/toggle-button.ts +0 -11
- package/src/tokens/components/dark/tooltip.ts +12 -0
- package/src/tokens/components/dark/top-navigation.ts +0 -8
- package/src/tokens/components/light/accordion.ts +0 -2
- package/src/tokens/components/light/alert.ts +0 -16
- package/src/tokens/components/light/avatar.ts +19 -0
- package/src/tokens/components/light/badge.ts +7 -34
- package/src/tokens/components/light/banner.ts +2 -11
- package/src/tokens/components/light/bottom-navigation.ts +0 -5
- package/src/tokens/components/light/bottom-sheet.ts +1 -2
- package/src/tokens/components/light/breadcrumb.ts +0 -1
- package/src/tokens/components/light/button.ts +1 -86
- package/src/tokens/components/light/card.ts +0 -28
- package/src/tokens/components/light/carousel-control.ts +0 -8
- package/src/tokens/components/light/checkbox.ts +3 -12
- package/src/tokens/components/light/date-picker.ts +0 -12
- package/src/tokens/components/light/description-list.ts +20 -0
- package/src/tokens/components/light/dialog.ts +0 -1
- package/src/tokens/components/light/divider.ts +4 -1
- package/src/tokens/components/light/expandable-card.ts +11 -0
- package/src/tokens/components/light/icon-button.ts +5 -5
- package/src/tokens/components/light/icon-container.ts +0 -17
- package/src/tokens/components/light/index.ts +10 -4
- package/src/tokens/components/light/indicator-icon-button.ts +11 -0
- package/src/tokens/components/light/input.ts +1 -9
- package/src/tokens/components/light/link.ts +2 -2
- package/src/tokens/components/light/list.ts +20 -20
- package/src/tokens/components/light/menu.ts +0 -12
- package/src/tokens/components/light/modal.ts +0 -1
- package/src/tokens/components/light/navigation.ts +1 -6
- package/src/tokens/components/light/pagination.ts +12 -0
- package/src/tokens/components/light/parts.ts +11 -1
- package/src/tokens/components/light/pill.ts +0 -10
- package/src/tokens/components/light/progress-stepper.ts +0 -8
- package/src/tokens/components/light/radio.ts +3 -10
- package/src/tokens/components/light/{focus.ts → section-header.ts} +4 -2
- package/src/tokens/components/light/segmented-control.ts +0 -8
- package/src/tokens/components/light/select.ts +0 -10
- package/src/tokens/components/light/switch.ts +1 -11
- package/src/tokens/components/light/table.ts +23 -0
- package/src/tokens/components/light/tabs.ts +26 -0
- package/src/tokens/components/light/toast.ts +10 -0
- package/src/tokens/components/light/toggle-button.ts +0 -11
- package/src/tokens/components/light/tooltip.ts +12 -0
- package/src/tokens/components/light/top-navigation.ts +0 -8
- package/src/tokens/index.ts +1 -0
- package/src/tokens/layout.ts +24 -15
- package/src/tokens/semantic-dark.ts +242 -13
- package/src/tokens/semantic-light.ts +242 -13
- package/src/tokens/semantic.ts +9 -0
- package/src/types/values.ts +31 -7
- package/src/utils/coloursAsArray.ts +44 -2
- package/src/utils/formatThousands.ts +14 -0
- package/src/utils/getFlattenedColorValue.ts +1 -1
- package/src/utils/hexWithOpacity.ts +19 -0
- package/src/utils/index.ts +3 -1
- package/src/utils/styleUtils.ts +39 -1
- package/src/vite-env.d.ts +5 -0
- package/build/components/Accordion/AccordionHeading/AccordionHeading.d.ts +0 -6
- package/build/components/Accordion/AccordionHeading/AccordionHeading.js +0 -16
- package/build/components/Accordion/AccordionHeading/AccordionHeading.props.d.ts +0 -14
- package/build/components/Accordion/AccordionHeading/AccordionHeadingHelperText.d.ts +0 -6
- package/build/components/Accordion/AccordionHeading/AccordionHeadingHelperText.js +0 -13
- package/build/components/Accordion/AccordionHeading/AccordionHeadingTextContent.d.ts +0 -6
- package/build/components/Accordion/AccordionHeading/AccordionHeadingTextContent.js +0 -14
- package/build/components/Accordion/AccordionHeading/AccordionHeadingTitle.d.ts +0 -6
- package/build/components/Accordion/AccordionHeading/AccordionHeadingTitle.js +0 -7
- package/build/components/Accordion/AccordionHeading/index.d.ts +0 -4
- package/build/components/Accordion/AccordionHeading/index.js +0 -4
- package/build/components/List/ListHeading/ListHeading.d.ts +0 -6
- package/build/components/List/ListHeading/ListHeading.js +0 -20
- package/build/components/List/ListHeading/ListHeadingHelperText.d.ts +0 -6
- package/build/components/List/ListHeading/ListHeadingTitle.d.ts +0 -6
- package/build/components/List/ListHeading/ListHeadingTitle.js +0 -7
- package/build/components/List/ListHeading/index.d.ts +0 -4
- package/build/components/List/ListHeading/index.js +0 -4
- package/build/tokens/components/dark/footer.d.ts +0 -12
- package/build/tokens/components/dark/footer.js +0 -11
- package/build/tokens/components/dark/icon.d.ts +0 -15
- package/build/tokens/components/dark/icon.js +0 -14
- package/build/tokens/components/dark/text.d.ts +0 -11
- package/build/tokens/components/dark/text.js +0 -10
- package/build/tokens/components/light/footer.d.ts +0 -12
- package/build/tokens/components/light/footer.js +0 -11
- package/build/tokens/components/light/icon.d.ts +0 -15
- package/build/tokens/components/light/icon.js +0 -14
- package/build/tokens/components/light/text.d.ts +0 -11
- package/build/tokens/components/light/text.js +0 -10
- package/src/components/Accordion/AccordionHeading/AccordionHeading.props.ts +0 -19
- package/src/components/Accordion/AccordionHeading/AccordionHeading.tsx +0 -38
- package/src/components/Accordion/AccordionHeading/AccordionHeadingHelperText.tsx +0 -22
- package/src/components/Accordion/AccordionHeading/AccordionHeadingTextContent.tsx +0 -21
- package/src/components/Accordion/AccordionHeading/AccordionHeadingTitle.tsx +0 -14
- package/src/components/Accordion/AccordionHeading/index.ts +0 -4
- package/src/components/List/ListHeading/ListHeadingHelperText.tsx +0 -21
- package/src/components/List/ListHeading/ListHeadingTitle.tsx +0 -14
- package/src/components/List/ListHeading/index.ts +0 -4
- package/src/tokens/components/dark/icon.ts +0 -15
- package/src/tokens/components/dark/text.ts +0 -11
- package/src/tokens/components/light/icon.ts +0 -15
- package/src/tokens/components/light/text.ts +0 -11
- /package/build/components/{Accordion/AccordionHeading/AccordionHeading.props.js → CurrencyInput/CurrencyInput.props.js} +0 -0
- /package/build/components/{List/ListHeading/ListHeading.props.js → DescriptionList/DescriptionList.props.js} +0 -0
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { Dimensions, ImageSourcePropType, Platform, View, ViewProps } from 'react-native';
|
|
4
|
+
import { UnistylesRuntime } from 'react-native-unistyles';
|
|
5
|
+
import { Modal } from '.';
|
|
6
|
+
import pigs from '../../../docs/assets/pigs.png';
|
|
7
|
+
import { BodyText } from '../BodyText';
|
|
8
|
+
import { BottomSheetModal } from '../BottomSheet';
|
|
9
|
+
import { Box } from '../Box';
|
|
10
|
+
import { Button } from '../Button';
|
|
11
|
+
|
|
12
|
+
const meta = {
|
|
13
|
+
title: 'Stories / Modal',
|
|
14
|
+
component: Modal,
|
|
15
|
+
parameters: {
|
|
16
|
+
layout: 'centered',
|
|
17
|
+
noScroll: true,
|
|
18
|
+
},
|
|
19
|
+
argTypes: {
|
|
20
|
+
heading: {
|
|
21
|
+
control: 'text',
|
|
22
|
+
description: 'The heading text to be displayed.',
|
|
23
|
+
},
|
|
24
|
+
description: {
|
|
25
|
+
control: 'text',
|
|
26
|
+
description: 'The description text to be displayed.',
|
|
27
|
+
},
|
|
28
|
+
showCloseButton: {
|
|
29
|
+
control: 'boolean',
|
|
30
|
+
description: 'Whether to show the close button.',
|
|
31
|
+
},
|
|
32
|
+
primaryButtonText: {
|
|
33
|
+
control: 'text',
|
|
34
|
+
description: 'Text for the primary button.',
|
|
35
|
+
},
|
|
36
|
+
secondaryButtonText: {
|
|
37
|
+
control: 'text',
|
|
38
|
+
description: 'Text for the secondary button.',
|
|
39
|
+
},
|
|
40
|
+
loading: {
|
|
41
|
+
control: 'boolean',
|
|
42
|
+
description: 'Whether the modal is in a loading state.',
|
|
43
|
+
},
|
|
44
|
+
onPressPrimaryButton: { action: () => null },
|
|
45
|
+
onPressSecondaryButton: { action: () => null },
|
|
46
|
+
onPressCloseButton: { action: () => null },
|
|
47
|
+
},
|
|
48
|
+
args: {
|
|
49
|
+
heading: 'Modal Heading',
|
|
50
|
+
description: 'This is a modal description',
|
|
51
|
+
showCloseButton: true,
|
|
52
|
+
primaryButtonText: 'Primary',
|
|
53
|
+
secondaryButtonText: 'Cancel',
|
|
54
|
+
loading: false,
|
|
55
|
+
onPressCloseButton: () => null,
|
|
56
|
+
onPressPrimaryButton: () => null,
|
|
57
|
+
onPressSecondaryButton: () => null,
|
|
58
|
+
},
|
|
59
|
+
} satisfies Meta<typeof Modal>;
|
|
60
|
+
|
|
61
|
+
export default meta;
|
|
62
|
+
type Story = StoryObj<typeof meta>;
|
|
63
|
+
|
|
64
|
+
const ViewWrap = ({ children }: { children: ViewProps['children'] }) => (
|
|
65
|
+
<View
|
|
66
|
+
style={{
|
|
67
|
+
width: Platform.OS === 'web' ? '100%' : Dimensions.get('window').width,
|
|
68
|
+
height:
|
|
69
|
+
Platform.OS === 'web'
|
|
70
|
+
? '100%'
|
|
71
|
+
: Dimensions.get('window').height -
|
|
72
|
+
UnistylesRuntime.insets.top -
|
|
73
|
+
UnistylesRuntime.insets.bottom -
|
|
74
|
+
33,
|
|
75
|
+
|
|
76
|
+
position: 'absolute',
|
|
77
|
+
top: 0,
|
|
78
|
+
left: 0,
|
|
79
|
+
right: 0,
|
|
80
|
+
bottom: 0,
|
|
81
|
+
flex: 1,
|
|
82
|
+
marginVertical: Platform.OS === 'web' ? 0 : -8,
|
|
83
|
+
justifyContent: 'center',
|
|
84
|
+
alignItems: 'center',
|
|
85
|
+
padding: 16,
|
|
86
|
+
}}
|
|
87
|
+
>
|
|
88
|
+
{children}
|
|
89
|
+
</View>
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
export const Playground: Story = {
|
|
93
|
+
args: {
|
|
94
|
+
children: [],
|
|
95
|
+
},
|
|
96
|
+
render: ({ ...args }) => {
|
|
97
|
+
const modalRef = useRef<BottomSheetModal>(null);
|
|
98
|
+
|
|
99
|
+
const openModal = () => {
|
|
100
|
+
modalRef.current?.present();
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<View style={Platform.OS === 'web' ? { width: 400, height: 400 } : {}}>
|
|
105
|
+
<ViewWrap>
|
|
106
|
+
<Button onPress={openModal}>Open Modal</Button>
|
|
107
|
+
|
|
108
|
+
<Modal ref={modalRef} {...args} />
|
|
109
|
+
</ViewWrap>
|
|
110
|
+
</View>
|
|
111
|
+
);
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export const WithImage = () => {
|
|
116
|
+
const modalRef = useRef<BottomSheetModal>(null);
|
|
117
|
+
|
|
118
|
+
const openModal = () => {
|
|
119
|
+
modalRef.current?.present();
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const closeModal = () => {
|
|
123
|
+
modalRef.current?.dismiss();
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<View style={Platform.OS === 'web' ? { width: 400, height: 400 } : {}}>
|
|
128
|
+
<ViewWrap>
|
|
129
|
+
<Button onPress={openModal}>Open Modal</Button>
|
|
130
|
+
|
|
131
|
+
<Modal
|
|
132
|
+
ref={modalRef}
|
|
133
|
+
heading="Modal Heading"
|
|
134
|
+
description="This is a modal description"
|
|
135
|
+
onPressCloseButton={closeModal}
|
|
136
|
+
primaryButtonText="Primary"
|
|
137
|
+
onPressPrimaryButton={closeModal}
|
|
138
|
+
secondaryButtonText="Cancel"
|
|
139
|
+
onPressSecondaryButton={closeModal}
|
|
140
|
+
index={1}
|
|
141
|
+
image={{
|
|
142
|
+
source: pigs as ImageSourcePropType,
|
|
143
|
+
resizeMode: 'contain',
|
|
144
|
+
}}
|
|
145
|
+
/>
|
|
146
|
+
</ViewWrap>
|
|
147
|
+
</View>
|
|
148
|
+
);
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
export const WithCustomContent = () => {
|
|
152
|
+
const modalRef = useRef<BottomSheetModal>(null);
|
|
153
|
+
|
|
154
|
+
const openModal = () => {
|
|
155
|
+
modalRef.current?.present();
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const closeModal = () => {
|
|
159
|
+
modalRef.current?.dismiss();
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
return (
|
|
163
|
+
<View style={Platform.OS === 'web' ? { width: 400, height: 400 } : {}}>
|
|
164
|
+
<ViewWrap>
|
|
165
|
+
<Button onPress={openModal}>Open Modal</Button>
|
|
166
|
+
|
|
167
|
+
<Modal
|
|
168
|
+
ref={modalRef}
|
|
169
|
+
heading="Modal Heading"
|
|
170
|
+
description="This is a modal description"
|
|
171
|
+
onPressCloseButton={closeModal}
|
|
172
|
+
primaryButtonText="Primary"
|
|
173
|
+
onPressPrimaryButton={closeModal}
|
|
174
|
+
secondaryButtonText="Cancel"
|
|
175
|
+
onPressSecondaryButton={closeModal}
|
|
176
|
+
>
|
|
177
|
+
<Box gap="200">
|
|
178
|
+
<BodyText>This is a modal with content.</BodyText>
|
|
179
|
+
<BodyText>You can swipe it up and down to close.</BodyText>
|
|
180
|
+
</Box>
|
|
181
|
+
</Modal>
|
|
182
|
+
</ViewWrap>
|
|
183
|
+
</View>
|
|
184
|
+
);
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export const Loading = () => {
|
|
188
|
+
const modalRef = useRef<BottomSheetModal>(null);
|
|
189
|
+
|
|
190
|
+
const openModal = () => {
|
|
191
|
+
modalRef.current?.present();
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const closeModal = () => {
|
|
195
|
+
modalRef.current?.dismiss();
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
return (
|
|
199
|
+
<View style={Platform.OS === 'web' ? { width: 400, height: 400 } : {}}>
|
|
200
|
+
<ViewWrap>
|
|
201
|
+
<Button onPress={openModal}>Open Modal</Button>
|
|
202
|
+
|
|
203
|
+
<Modal
|
|
204
|
+
ref={modalRef}
|
|
205
|
+
heading="Modal Heading"
|
|
206
|
+
description="This is a modal description"
|
|
207
|
+
onPressCloseButton={closeModal}
|
|
208
|
+
primaryButtonText="Primary"
|
|
209
|
+
onPressPrimaryButton={closeModal}
|
|
210
|
+
secondaryButtonText="Cancel"
|
|
211
|
+
onPressSecondaryButton={closeModal}
|
|
212
|
+
loading
|
|
213
|
+
>
|
|
214
|
+
<Box gap="200">
|
|
215
|
+
<BodyText>This is a modal with content.</BodyText>
|
|
216
|
+
<BodyText>You can swipe it up and down to close.</BodyText>
|
|
217
|
+
</Box>
|
|
218
|
+
</Modal>
|
|
219
|
+
</ViewWrap>
|
|
220
|
+
</View>
|
|
221
|
+
);
|
|
222
|
+
};
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import { BottomSheetScrollViewMethods, SNAP_POINT_TYPE } from '@gorhom/bottom-sheet';
|
|
2
|
+
import { BottomSheetModalMethods } from '@gorhom/bottom-sheet/lib/typescript/types';
|
|
3
|
+
import { CloseMediumIcon } from '@utilitywarehouse/hearth-react-native-icons';
|
|
4
|
+
import { useCallback, useEffect, useImperativeHandle, useRef } from 'react';
|
|
5
|
+
import { AccessibilityInfo, Image, Platform, View, findNodeHandle } from 'react-native';
|
|
6
|
+
import Animated, {
|
|
7
|
+
Easing,
|
|
8
|
+
useAnimatedStyle,
|
|
9
|
+
useSharedValue,
|
|
10
|
+
withDelay,
|
|
11
|
+
withTiming,
|
|
12
|
+
} from 'react-native-reanimated';
|
|
13
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
14
|
+
import { useTheme } from '../../hooks';
|
|
15
|
+
import { hexWithOpacity } from '../../utils';
|
|
16
|
+
import { BodyText } from '../BodyText';
|
|
17
|
+
import { BottomSheetModal, BottomSheetScrollView } from '../BottomSheet';
|
|
18
|
+
import { Button } from '../Button';
|
|
19
|
+
import { Heading } from '../Heading';
|
|
20
|
+
import { Spinner } from '../Spinner';
|
|
21
|
+
import { UnstyledIconButton } from '../UnstyledIconButton';
|
|
22
|
+
import ModalProps from './Modal.props';
|
|
23
|
+
|
|
24
|
+
type Modal<T = any> = BottomSheetModalMethods<T> & { triggerCloseAnimation?: () => void };
|
|
25
|
+
|
|
26
|
+
const Modal = ({
|
|
27
|
+
ref,
|
|
28
|
+
children,
|
|
29
|
+
heading,
|
|
30
|
+
description,
|
|
31
|
+
showCloseButton = true,
|
|
32
|
+
primaryButtonText,
|
|
33
|
+
secondaryButtonText,
|
|
34
|
+
onPressPrimaryButton,
|
|
35
|
+
onPressCloseButton,
|
|
36
|
+
onPressSecondaryButton,
|
|
37
|
+
closeOnPrimaryButtonPress = true,
|
|
38
|
+
closeOnSecondaryButtonPress = true,
|
|
39
|
+
loading,
|
|
40
|
+
image,
|
|
41
|
+
primaryButtonProps,
|
|
42
|
+
secondaryButtonProps,
|
|
43
|
+
closeButtonProps,
|
|
44
|
+
fullscreen = false,
|
|
45
|
+
...props
|
|
46
|
+
}: ModalProps) => {
|
|
47
|
+
const bottomSheetModalRef = useRef<BottomSheetModal>(null);
|
|
48
|
+
const viewRef = useRef<View>(null);
|
|
49
|
+
const scrollViewRef = useRef<BottomSheetScrollViewMethods>(null);
|
|
50
|
+
const theme = useTheme();
|
|
51
|
+
const backgroundOpacity = useSharedValue(0);
|
|
52
|
+
const pretendContentTranslateY = useSharedValue(20);
|
|
53
|
+
|
|
54
|
+
const triggerCloseAnimation = useCallback(() => {
|
|
55
|
+
if (Platform.OS === 'android' && fullscreen) {
|
|
56
|
+
pretendContentTranslateY.value = withTiming(20, {
|
|
57
|
+
duration: 50,
|
|
58
|
+
easing: Easing.in(Easing.quad),
|
|
59
|
+
});
|
|
60
|
+
backgroundOpacity.value = withTiming(0, {
|
|
61
|
+
duration: 100,
|
|
62
|
+
easing: Easing.in(Easing.quad),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}, [Platform.OS, fullscreen, pretendContentTranslateY, backgroundOpacity]);
|
|
66
|
+
|
|
67
|
+
useImperativeHandle(ref, () => ({
|
|
68
|
+
...(bottomSheetModalRef.current as BottomSheetModal),
|
|
69
|
+
triggerCloseAnimation,
|
|
70
|
+
}));
|
|
71
|
+
|
|
72
|
+
// Trigger animations on render for fullscreen Android modal
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (Platform.OS === 'android' && fullscreen) {
|
|
75
|
+
backgroundOpacity.value = withDelay(
|
|
76
|
+
300,
|
|
77
|
+
withTiming(1, {
|
|
78
|
+
duration: 200,
|
|
79
|
+
easing: Easing.out(Easing.quad),
|
|
80
|
+
})
|
|
81
|
+
);
|
|
82
|
+
pretendContentTranslateY.value = withDelay(
|
|
83
|
+
500,
|
|
84
|
+
withTiming(0, {
|
|
85
|
+
duration: 300,
|
|
86
|
+
easing: Easing.out(Easing.quad),
|
|
87
|
+
})
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
}, [fullscreen, backgroundOpacity, pretendContentTranslateY]);
|
|
91
|
+
|
|
92
|
+
const animatedBackgroundStyle = useAnimatedStyle(() => ({
|
|
93
|
+
backgroundColor: hexWithOpacity(
|
|
94
|
+
theme.components.overlay.backgroundColor,
|
|
95
|
+
backgroundOpacity.value * (theme.components.overlay.opacity / 100)
|
|
96
|
+
),
|
|
97
|
+
}));
|
|
98
|
+
|
|
99
|
+
const animatedFullscreenStyle = useAnimatedStyle(() => ({
|
|
100
|
+
backgroundColor: hexWithOpacity(
|
|
101
|
+
theme.components.overlay.backgroundColor,
|
|
102
|
+
backgroundOpacity.value * (theme.components.overlay.opacity / 100)
|
|
103
|
+
),
|
|
104
|
+
}));
|
|
105
|
+
|
|
106
|
+
const animatedPretendContentStyle = useAnimatedStyle(() => ({
|
|
107
|
+
transform: [{ translateY: pretendContentTranslateY.value }],
|
|
108
|
+
}));
|
|
109
|
+
|
|
110
|
+
const handleChange = (index: number, position: number, type: SNAP_POINT_TYPE) => {
|
|
111
|
+
if (index > -1) {
|
|
112
|
+
// Add a small delay to ensure the modal is fully rendered
|
|
113
|
+
setTimeout(() => {
|
|
114
|
+
// Announce the modal opening to screen readers
|
|
115
|
+
AccessibilityInfo.announceForAccessibility('Modal opened.');
|
|
116
|
+
|
|
117
|
+
const scrollViewTargetRef = scrollViewRef.current?.getInnerViewNode();
|
|
118
|
+
const targetRef = viewRef.current;
|
|
119
|
+
if ((Platform.OS === 'android' && targetRef) || scrollViewTargetRef) {
|
|
120
|
+
const nodeHandle = findNodeHandle(
|
|
121
|
+
Platform.OS === 'android' ? targetRef : scrollViewTargetRef
|
|
122
|
+
);
|
|
123
|
+
if (nodeHandle) {
|
|
124
|
+
AccessibilityInfo.setAccessibilityFocus(nodeHandle);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}, 100);
|
|
128
|
+
}
|
|
129
|
+
props.onChange?.(index, position, type);
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const handleCloseButtonPress = () => {
|
|
133
|
+
bottomSheetModalRef.current?.dismiss();
|
|
134
|
+
if (onPressCloseButton) {
|
|
135
|
+
onPressCloseButton();
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const handlePrimaryButtonPress = () => {
|
|
140
|
+
if (onPressPrimaryButton) {
|
|
141
|
+
onPressPrimaryButton();
|
|
142
|
+
}
|
|
143
|
+
if (closeOnPrimaryButtonPress) {
|
|
144
|
+
bottomSheetModalRef.current?.dismiss();
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
const handleSecondaryButtonPress = () => {
|
|
149
|
+
if (onPressSecondaryButton) {
|
|
150
|
+
onPressSecondaryButton();
|
|
151
|
+
}
|
|
152
|
+
if (closeOnSecondaryButtonPress) {
|
|
153
|
+
bottomSheetModalRef.current?.dismiss();
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
styles.useVariants({ loading });
|
|
158
|
+
|
|
159
|
+
const content = (
|
|
160
|
+
<>
|
|
161
|
+
{loading ? (
|
|
162
|
+
<View
|
|
163
|
+
style={styles.loadingContainer}
|
|
164
|
+
accessible={Platform.OS === 'android' ? true : undefined}
|
|
165
|
+
accessibilityLabel={Platform.OS === 'android' ? 'Loading' : undefined}
|
|
166
|
+
screenReaderFocusable
|
|
167
|
+
ref={viewRef}
|
|
168
|
+
>
|
|
169
|
+
<Spinner size="lg" />
|
|
170
|
+
<Heading size="lg" textAlign="center">
|
|
171
|
+
Loading...
|
|
172
|
+
</Heading>
|
|
173
|
+
</View>
|
|
174
|
+
) : (
|
|
175
|
+
<View
|
|
176
|
+
style={styles.container}
|
|
177
|
+
accessible={Platform.OS === 'android' ? true : undefined}
|
|
178
|
+
accessibilityLabel={Platform.OS === 'android' ? 'Modal content' : undefined}
|
|
179
|
+
screenReaderFocusable
|
|
180
|
+
ref={viewRef}
|
|
181
|
+
>
|
|
182
|
+
<View style={styles.header}>
|
|
183
|
+
<View style={styles.headerTextContent}>
|
|
184
|
+
{heading && !image ? (
|
|
185
|
+
<Heading size="lg" accessible>
|
|
186
|
+
{heading}
|
|
187
|
+
</Heading>
|
|
188
|
+
) : null}
|
|
189
|
+
{description && !image ? <BodyText accessible>{description}</BodyText> : null}
|
|
190
|
+
</View>
|
|
191
|
+
{showCloseButton ? (
|
|
192
|
+
<UnstyledIconButton
|
|
193
|
+
icon={CloseMediumIcon}
|
|
194
|
+
onPress={handleCloseButtonPress}
|
|
195
|
+
accessibilityLabel="Close modal"
|
|
196
|
+
{...closeButtonProps}
|
|
197
|
+
/>
|
|
198
|
+
) : null}
|
|
199
|
+
</View>
|
|
200
|
+
{image ? (
|
|
201
|
+
<View style={styles.imageContainer}>
|
|
202
|
+
<Image style={styles.image} {...image} />
|
|
203
|
+
<View style={styles.textContent}>
|
|
204
|
+
{heading ? (
|
|
205
|
+
<Heading size="lg" textAlign="center" accessible>
|
|
206
|
+
{heading}
|
|
207
|
+
</Heading>
|
|
208
|
+
) : null}
|
|
209
|
+
{description ? (
|
|
210
|
+
<BodyText textAlign="center" accessible>
|
|
211
|
+
{description}
|
|
212
|
+
</BodyText>
|
|
213
|
+
) : null}
|
|
214
|
+
</View>
|
|
215
|
+
</View>
|
|
216
|
+
) : null}
|
|
217
|
+
{children}
|
|
218
|
+
<View style={styles.footer}>
|
|
219
|
+
{onPressPrimaryButton && primaryButtonText ? (
|
|
220
|
+
<Button
|
|
221
|
+
onPress={handlePrimaryButtonPress}
|
|
222
|
+
text={primaryButtonText}
|
|
223
|
+
{...primaryButtonProps}
|
|
224
|
+
variant={(primaryButtonProps?.variant as 'solid') ?? 'solid'}
|
|
225
|
+
colorScheme={(primaryButtonProps?.colorScheme as 'highlight') ?? 'highlight'}
|
|
226
|
+
/>
|
|
227
|
+
) : null}
|
|
228
|
+
{onPressSecondaryButton && secondaryButtonText ? (
|
|
229
|
+
<Button
|
|
230
|
+
onPress={handleSecondaryButtonPress}
|
|
231
|
+
text={secondaryButtonText}
|
|
232
|
+
{...secondaryButtonProps}
|
|
233
|
+
variant={(secondaryButtonProps?.variant as 'outline') ?? 'outline'}
|
|
234
|
+
colorScheme={(secondaryButtonProps?.colorScheme as 'functional') ?? 'functional'}
|
|
235
|
+
/>
|
|
236
|
+
) : null}
|
|
237
|
+
</View>
|
|
238
|
+
</View>
|
|
239
|
+
)}
|
|
240
|
+
</>
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
return fullscreen ? (
|
|
244
|
+
<View style={{ flex: 1, backgroundColor: theme.color.background.primary }}>
|
|
245
|
+
{Platform.OS === 'android' ? (
|
|
246
|
+
<Animated.View style={[styles.androidContainer, animatedBackgroundStyle]}>
|
|
247
|
+
<Animated.View style={[styles.pretendContent, animatedPretendContentStyle]} />
|
|
248
|
+
</Animated.View>
|
|
249
|
+
) : null}
|
|
250
|
+
<Animated.View
|
|
251
|
+
style={[styles.fullscreenContainer, Platform.OS === 'android' && animatedFullscreenStyle]}
|
|
252
|
+
>
|
|
253
|
+
<View style={styles.fullscreenContent}>{content}</View>
|
|
254
|
+
</Animated.View>
|
|
255
|
+
</View>
|
|
256
|
+
) : (
|
|
257
|
+
<BottomSheetModal
|
|
258
|
+
ref={bottomSheetModalRef}
|
|
259
|
+
enableDynamicSizing={true}
|
|
260
|
+
snapPoints={image ? ['90%'] : props.snapPoints}
|
|
261
|
+
showHandle={typeof loading !== 'undefined' && loading ? false : props.showHandle}
|
|
262
|
+
accessible={false}
|
|
263
|
+
{...props}
|
|
264
|
+
onChange={handleChange}
|
|
265
|
+
>
|
|
266
|
+
{loading ? <View style={styles.loadingTop} /> : null}
|
|
267
|
+
<BottomSheetScrollView contentContainerStyle={styles.container} ref={scrollViewRef}>
|
|
268
|
+
{content}
|
|
269
|
+
</BottomSheetScrollView>
|
|
270
|
+
</BottomSheetModal>
|
|
271
|
+
);
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
const styles = StyleSheet.create((theme, rt) => ({
|
|
275
|
+
container: {
|
|
276
|
+
flex: 1,
|
|
277
|
+
gap: theme.components.dialog.gap,
|
|
278
|
+
variants: {
|
|
279
|
+
loading: {
|
|
280
|
+
true: {
|
|
281
|
+
paddingTop: 0,
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
header: {
|
|
287
|
+
flexDirection: 'row',
|
|
288
|
+
gap: theme.components.dialog.gap,
|
|
289
|
+
},
|
|
290
|
+
headerTextContent: {
|
|
291
|
+
flex: 1,
|
|
292
|
+
gap: theme.components.dialog.content.gap,
|
|
293
|
+
},
|
|
294
|
+
image: {
|
|
295
|
+
width: 260,
|
|
296
|
+
height: 260,
|
|
297
|
+
},
|
|
298
|
+
imageContainer: {
|
|
299
|
+
alignItems: 'center',
|
|
300
|
+
justifyContent: 'center',
|
|
301
|
+
flex: 1,
|
|
302
|
+
},
|
|
303
|
+
textContent: {
|
|
304
|
+
gap: theme.components.dialog.content.gap,
|
|
305
|
+
},
|
|
306
|
+
loadingTop: {
|
|
307
|
+
borderTopLeftRadius: theme.components.dialog.borderRadius,
|
|
308
|
+
borderTopRightRadius: theme.components.dialog.borderRadius,
|
|
309
|
+
height: 16,
|
|
310
|
+
backgroundColor: theme.color.surface.neutral.strong,
|
|
311
|
+
},
|
|
312
|
+
loadingContainer: {
|
|
313
|
+
borderTopLeftRadius: theme.components.dialog.borderRadius,
|
|
314
|
+
borderTopRightRadius: theme.components.dialog.borderRadius,
|
|
315
|
+
flex: 1,
|
|
316
|
+
alignItems: 'center',
|
|
317
|
+
justifyContent: 'center',
|
|
318
|
+
minHeight: 140,
|
|
319
|
+
gap: theme.components.dialog.content.gap,
|
|
320
|
+
},
|
|
321
|
+
footer: {
|
|
322
|
+
gap: theme.components.dialog.action.gap,
|
|
323
|
+
},
|
|
324
|
+
fullscreenContainer: {
|
|
325
|
+
flex: 1,
|
|
326
|
+
...(Platform.OS === 'ios' ? { backgroundColor: theme.components.overlay.backgroundColor } : {}),
|
|
327
|
+
},
|
|
328
|
+
fullscreenContent: {
|
|
329
|
+
flex: 1,
|
|
330
|
+
borderTopLeftRadius: theme.components.dialog.borderRadius,
|
|
331
|
+
borderTopRightRadius: theme.components.dialog.borderRadius,
|
|
332
|
+
backgroundColor: theme.color.surface.neutral.strong,
|
|
333
|
+
gap: theme.components.dialog.gap,
|
|
334
|
+
padding: theme.components.dialog.padding,
|
|
335
|
+
paddingBottom: theme.components.dialog.padding + rt.insets.bottom,
|
|
336
|
+
},
|
|
337
|
+
androidContainer: {
|
|
338
|
+
height: rt.insets.top + 18,
|
|
339
|
+
paddingLeft: theme.components.dialog.padding,
|
|
340
|
+
paddingRight: theme.components.dialog.padding,
|
|
341
|
+
justifyContent: 'flex-end',
|
|
342
|
+
},
|
|
343
|
+
pretendContent: {
|
|
344
|
+
borderTopLeftRadius: theme.components.dialog.borderRadius,
|
|
345
|
+
borderTopRightRadius: theme.components.dialog.borderRadius,
|
|
346
|
+
height: 12,
|
|
347
|
+
backgroundColor: theme.components.parts.modalStack.backgroundColorCardTop,
|
|
348
|
+
},
|
|
349
|
+
}));
|
|
350
|
+
|
|
351
|
+
export default Modal;
|