@gympass/yoga 7.88.0 → 7.88.1
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/cjs/Accordion/Accordion.theme.js +46 -0
- package/cjs/Accordion/index.js +35 -0
- package/cjs/ActionRequirement/ActionRequirement.theme.js +25 -0
- package/cjs/ActionRequirement/index.js +35 -0
- package/cjs/ActionRequirement/index.native.js +35 -0
- package/cjs/AutoComplete/AutoComplete.theme.js +77 -0
- package/cjs/AutoComplete/index.js +35 -0
- package/cjs/Avatar/Avatar.theme.js +25 -0
- package/cjs/Avatar/index.js +37 -0
- package/cjs/Avatar/index.native.js +37 -0
- package/cjs/Banner/Banner.theme.js +30 -0
- package/cjs/Banner/index.js +35 -0
- package/cjs/Banner/index.native.js +35 -0
- package/cjs/BottomSheet/BottomSheet.theme.js +44 -0
- package/cjs/BottomSheet/index.js +35 -0
- package/cjs/Box/index.js +35 -0
- package/cjs/Box/index.native.js +35 -0
- package/cjs/Button/Button.theme.js +157 -0
- package/cjs/Button/index.js +43 -0
- package/cjs/Button/index.native.js +41 -0
- package/cjs/Card/Card.native.theme.js +64 -0
- package/cjs/Card/Card.theme.js +177 -0
- package/cjs/Card/Card.web.theme.js +61 -0
- package/cjs/Card/index.js +32 -0
- package/cjs/Card/index.native.js +34 -0
- package/cjs/Checkbox/CheckIcon.js +25 -0
- package/cjs/Checkbox/Checkbox.theme.js +68 -0
- package/cjs/Checkbox/CheckboxSwitch.theme.js +90 -0
- package/cjs/Checkbox/index.js +26 -0
- package/cjs/Checkbox/index.native.js +26 -0
- package/cjs/Chips/index.js +35 -0
- package/cjs/Chips/index.native.js +35 -0
- package/cjs/Datepicker/Datepicker.theme.js +32 -0
- package/cjs/Datepicker/index.js +35 -0
- package/cjs/Dialog/Dialog.theme.js +43 -0
- package/cjs/Dialog/index.js +35 -0
- package/cjs/Divider/Divider.theme.js +25 -0
- package/cjs/Divider/index.js +35 -0
- package/cjs/Divider/index.native.js +35 -0
- package/cjs/Drawer/Drawer.theme.js +35 -0
- package/cjs/Drawer/index.js +35 -0
- package/cjs/Dropdown/Dropdown.theme.js +205 -0
- package/cjs/Dropdown/index.js +35 -0
- package/cjs/Dropdown/index.native.js +35 -0
- package/cjs/Feedback/Feedback.theme.js +29 -0
- package/cjs/Feedback/index.js +35 -0
- package/cjs/Grid/Grid.theme.js +43 -0
- package/cjs/Grid/index.js +34 -0
- package/cjs/Header/Header.theme.js +34 -0
- package/cjs/Header/index.js +35 -0
- package/cjs/Heading/Heading.theme.js +38 -0
- package/cjs/Heading/index.js +35 -0
- package/cjs/Icon/Icon.js +193 -0
- package/cjs/Icon/Icon.theme.js +25 -0
- package/cjs/Icon/index.js +35 -0
- package/cjs/Icon/index.native.js +35 -0
- package/cjs/Input/Input.theme.js +86 -0
- package/cjs/Input/index.js +30 -0
- package/cjs/Input/index.native.js +29 -0
- package/cjs/List/List.theme.js +49 -0
- package/cjs/List/index.js +27 -0
- package/cjs/List/index.native.js +26 -0
- package/cjs/Menu/Menu.theme.js +63 -0
- package/cjs/Menu/index.js +41 -0
- package/cjs/Popover/Popover.theme.js +25 -0
- package/cjs/Popover/index.js +35 -0
- package/cjs/Progress/Progress.theme.js +38 -0
- package/cjs/Progress/index.js +35 -0
- package/cjs/Progress/index.native.js +35 -0
- package/cjs/RadioGroup/RadioGroup.theme.js +76 -0
- package/cjs/RadioGroup/RadioGroupContext.js +26 -0
- package/cjs/RadioGroup/index.js +27 -0
- package/cjs/RadioGroup/index.native.js +27 -0
- package/cjs/Rating/Rating.theme.js +31 -0
- package/cjs/Rating/index.js +35 -0
- package/cjs/Rating/index.native.js +35 -0
- package/cjs/Result/Result.theme.js +25 -0
- package/cjs/Result/index.native.js +41 -0
- package/cjs/Skeleton/Skeleton.theme.js +42 -0
- package/cjs/Skeleton/index.js +35 -0
- package/cjs/Skeleton/index.native.js +35 -0
- package/cjs/Slider/Slider.theme.js +95 -0
- package/cjs/Slider/index.js +35 -0
- package/cjs/Slider/index.native.js +35 -0
- package/cjs/Snackbar/Snackbar.theme.js +81 -0
- package/cjs/Snackbar/index.js +35 -0
- package/cjs/Snackbar/index.native.js +35 -0
- package/cjs/Spinner/Spinner.theme.js +25 -0
- package/cjs/Spinner/index.js +35 -0
- package/cjs/Stepper/Stepper.theme.js +56 -0
- package/cjs/Stepper/activeDot.js +25 -0
- package/cjs/Stepper/index.js +26 -0
- package/cjs/Stepper/index.native.js +26 -0
- package/cjs/Tag/Tag.theme.js +58 -0
- package/cjs/Tag/index.js +37 -0
- package/cjs/Tag/index.native.js +37 -0
- package/cjs/Text/Text.theme.js +93 -0
- package/cjs/Text/index.js +39 -0
- package/cjs/Text/index.native.js +39 -0
- package/cjs/Text/sharedTextStyle.js +64 -0
- package/cjs/Text/textStyle.android.js +57 -0
- package/cjs/Text/textStyle.ios.js +39 -0
- package/cjs/Text/textStyle.web.js +47 -0
- package/cjs/TextArea/TextArea.theme.js +36 -0
- package/cjs/TextArea/index.js +35 -0
- package/cjs/TextArea/index.native.js +35 -0
- package/cjs/Theme/Provider/Provider.js +103 -0
- package/cjs/Theme/Provider/index.js +30 -0
- package/cjs/Theme/Provider/index.native.js +35 -0
- package/cjs/Theme/Provider/native/index.js +35 -0
- package/cjs/Theme/Provider/web/FontLoader.js +51 -0
- package/cjs/Theme/Provider/web/FontLoader.test.js +39 -0
- package/cjs/Theme/Provider/web/GlobalStyle.js +38 -0
- package/cjs/Theme/Provider/web/GlobalStyle.test.js +44 -0
- package/cjs/Theme/Provider/web/ThemeProvider.js +78 -0
- package/cjs/Theme/Provider/web/expectCssMatches.js +34 -0
- package/cjs/Theme/Provider/web/index.js +41 -0
- package/cjs/Theme/helpers/themeGenerator/index.js +35 -0
- package/cjs/Theme/helpers/themeGenerator/themeGenerator.js +33 -0
- package/cjs/Theme/helpers/themeGenerator/themeGenerator.test.js +43 -0
- package/cjs/Theme/helpers/themeReader/base.test.js +96 -0
- package/cjs/Theme/helpers/themeReader/index.js +56 -0
- package/cjs/Theme/helpers/themeReader/native/native.test.js +61 -0
- package/cjs/Theme/helpers/themeReader/web/web.test.js +55 -0
- package/cjs/Theme/index.js +48 -0
- package/cjs/Theme/index.native.js +46 -0
- package/cjs/Theme/theme/index.js +35 -0
- package/cjs/Theme/theme/theme.js +109 -0
- package/cjs/hooks/index.js +26 -0
- package/cjs/hooks/useCombinedRefs.js +44 -0
- package/cjs/hooks/useKeyPress.js +50 -0
- package/cjs/hooks/usePortal.js +63 -0
- package/cjs/index.js +164 -0
- package/cjs/index.native.js +122 -0
- package/cjs/shared/HiddenInput.js +45 -0
- package/cjs/shared/index.js +49 -0
- package/cjs/shared/index.native.js +36 -0
- package/cjs/shared/propTypes/charLength.js +36 -0
- package/cjs/shared/propTypes/deprecated.js +34 -0
- package/cjs/shared/propTypes/index.js +50 -0
- package/cjs/shared/propTypes/limitChildren.js +35 -0
- package/cjs/shared/propTypes/max.js +35 -0
- package/cjs/shared/propTypes/typeof.js +47 -0
- package/esm/Accordion/Accordion.theme.js +26 -0
- package/esm/Accordion/index.js +5 -0
- package/esm/ActionRequirement/ActionRequirement.theme.js +5 -0
- package/esm/ActionRequirement/index.js +5 -0
- package/esm/ActionRequirement/index.native.js +5 -0
- package/esm/ActionRequirement/native/ActionRequirement.js +57 -0
- package/esm/ActionRequirement/native/ActionRequirement.test.js +49 -0
- package/esm/ActionRequirement/native/ActionRequirementStyles.js +69 -0
- package/esm/ActionRequirement/native/index.js +13 -0
- package/esm/AutoComplete/AutoComplete.theme.js +49 -0
- package/esm/AutoComplete/index.js +5 -0
- package/esm/Avatar/Avatar.theme.js +5 -0
- package/esm/Avatar/index.js +7 -0
- package/esm/Avatar/index.native.js +7 -0
- package/esm/Avatar/native/Avatar.js +141 -0
- package/esm/Avatar/native/Avatar.test.js +39 -0
- package/esm/Avatar/native/AvatarCircle.js +54 -0
- package/esm/Banner/Banner.theme.js +10 -0
- package/esm/Banner/index.js +5 -0
- package/esm/Banner/index.native.js +5 -0
- package/esm/Banner/native/Banner.js +160 -0
- package/esm/Banner/native/Banner.test.js +113 -0
- package/esm/Banner/native/index.js +5 -0
- package/esm/BottomSheet/BottomSheet.theme.js +24 -0
- package/esm/BottomSheet/index.js +5 -0
- package/esm/Box/index.js +5 -0
- package/esm/Box/index.native.js +5 -0
- package/esm/Box/native/Box.js +7 -0
- package/esm/Box/native/Box.test.js +21 -0
- package/esm/Box/native/index.js +5 -0
- package/esm/Button/Button.theme.js +137 -0
- package/esm/Button/index.js +13 -0
- package/esm/Button/index.native.js +11 -0
- package/esm/Button/native/Button.js +198 -0
- package/esm/Button/native/Button.test.js +342 -0
- package/esm/Button/native/Icon.js +156 -0
- package/esm/Button/native/Link.js +64 -0
- package/esm/Button/native/Text.js +130 -0
- package/esm/Button/native/withTouchable.js +89 -0
- package/esm/Card/Card.native.theme.js +44 -0
- package/esm/Card/Card.theme.js +157 -0
- package/esm/Card/Card.web.theme.js +41 -0
- package/esm/Card/index.js +6 -0
- package/esm/Card/index.native.js +7 -0
- package/esm/Card/native/Card/Actions.js +11 -0
- package/esm/Card/native/Card/Card.js +181 -0
- package/esm/Card/native/Card/Card.test.js +20 -0
- package/esm/Card/native/Card/Content.js +7 -0
- package/esm/Card/native/Card/Header.js +7 -0
- package/esm/Card/native/Card/index.js +11 -0
- package/esm/Card/native/EventCard/EventCard.js +212 -0
- package/esm/Card/native/EventCard/EventCard.test.js +73 -0
- package/esm/Card/native/EventCard/index.js +5 -0
- package/esm/Card/native/GymCard/CheckIn/Avatar.js +47 -0
- package/esm/Card/native/GymCard/CheckIn/CheckIn.js +113 -0
- package/esm/Card/native/GymCard/CheckIn/CheckIn.test.js +46 -0
- package/esm/Card/native/GymCard/CheckIn/Content.js +21 -0
- package/esm/Card/native/GymCard/CheckIn/Header.js +24 -0
- package/esm/Card/native/GymCard/CheckIn/index.js +5 -0
- package/esm/Card/native/GymCard/index.js +8 -0
- package/esm/Card/native/PlanCard/Actions.js +27 -0
- package/esm/Card/native/PlanCard/Content.js +134 -0
- package/esm/Card/native/PlanCard/List.js +113 -0
- package/esm/Card/native/PlanCard/PlanCard.js +114 -0
- package/esm/Card/native/PlanCard/PlanCard.test.js +100 -0
- package/esm/Card/native/PlanCard/Subtitle.js +25 -0
- package/esm/Card/native/PlanCard/Tag.js +62 -0
- package/esm/Card/native/PlanCard/index.js +18 -0
- package/esm/Card/native/index.js +10 -0
- package/esm/Checkbox/CheckIcon.js +5 -0
- package/esm/Checkbox/Checkbox.theme.js +48 -0
- package/esm/Checkbox/CheckboxSwitch.theme.js +70 -0
- package/esm/Checkbox/index.js +6 -0
- package/esm/Checkbox/index.native.js +6 -0
- package/esm/Checkbox/native/Checkbox.js +276 -0
- package/esm/Checkbox/native/Checkbox.test.js +108 -0
- package/esm/Checkbox/native/Switch.js +166 -0
- package/esm/Checkbox/native/Switch.test.js +50 -0
- package/esm/Checkbox/native/index.js +6 -0
- package/esm/Chips/index.js +5 -0
- package/esm/Chips/index.native.js +5 -0
- package/esm/Chips/native/Chips.js +182 -0
- package/esm/Chips/native/Chips.test.js +108 -0
- package/esm/Chips/native/Counter.js +36 -0
- package/esm/Chips/native/index.js +5 -0
- package/esm/Datepicker/Datepicker.theme.js +12 -0
- package/esm/Datepicker/index.js +5 -0
- package/esm/Dialog/Dialog.theme.js +23 -0
- package/esm/Dialog/index.js +5 -0
- package/esm/Divider/Divider.theme.js +5 -0
- package/esm/Divider/index.js +5 -0
- package/esm/Divider/index.native.js +5 -0
- package/esm/Divider/native/Divider.js +33 -0
- package/esm/Divider/native/Divider.test.js +44 -0
- package/esm/Divider/native/index.js +5 -0
- package/esm/Drawer/Drawer.theme.js +15 -0
- package/esm/Drawer/index.js +5 -0
- package/esm/Dropdown/Dropdown.theme.js +185 -0
- package/esm/Dropdown/index.js +5 -0
- package/esm/Dropdown/index.native.js +5 -0
- package/esm/Dropdown/native/Backdrop.js +157 -0
- package/esm/Dropdown/native/Backdrop.test.js +22 -0
- package/esm/Dropdown/native/Dropdown.js +220 -0
- package/esm/Dropdown/native/Dropdown.test.js +76 -0
- package/esm/Dropdown/native/Options.android.js +81 -0
- package/esm/Dropdown/native/Options.ios.js +97 -0
- package/esm/Dropdown/native/index.js +5 -0
- package/esm/Feedback/Feedback.theme.js +9 -0
- package/esm/Feedback/index.js +5 -0
- package/esm/Grid/Grid.theme.js +23 -0
- package/esm/Grid/index.js +7 -0
- package/esm/Header/Header.theme.js +14 -0
- package/esm/Header/index.js +5 -0
- package/esm/Heading/Heading.theme.js +18 -0
- package/esm/Heading/index.js +5 -0
- package/esm/Icon/Icon.js +172 -0
- package/esm/Icon/Icon.theme.js +5 -0
- package/esm/Icon/index.js +5 -0
- package/esm/Icon/index.native.js +5 -0
- package/esm/Icon/native/Icon.test.js +69 -0
- package/esm/Icon/native/index.js +5 -0
- package/esm/Input/Input.theme.js +66 -0
- package/esm/Input/index.js +10 -0
- package/esm/Input/index.native.js +9 -0
- package/esm/Input/native/Email.js +37 -0
- package/esm/Input/native/Email.test.js +14 -0
- package/esm/Input/native/Helper.js +87 -0
- package/esm/Input/native/Input.js +365 -0
- package/esm/Input/native/Input.test.js +132 -0
- package/esm/Input/native/Number.js +29 -0
- package/esm/Input/native/Number.test.js +14 -0
- package/esm/Input/native/Password.js +166 -0
- package/esm/Input/native/Password.test.js +109 -0
- package/esm/Input/native/Tel.js +36 -0
- package/esm/Input/native/Tel.test.js +14 -0
- package/esm/Input/native/index.js +12 -0
- package/esm/List/List.theme.js +29 -0
- package/esm/List/index.js +7 -0
- package/esm/List/index.native.js +6 -0
- package/esm/List/native/List.js +43 -0
- package/esm/List/native/List.test.js +88 -0
- package/esm/List/native/ListItem.js +109 -0
- package/esm/List/native/index.js +6 -0
- package/esm/Menu/Menu.theme.js +43 -0
- package/esm/Menu/index.js +11 -0
- package/esm/Popover/Popover.theme.js +5 -0
- package/esm/Popover/index.js +5 -0
- package/esm/Progress/Progress.theme.js +18 -0
- package/esm/Progress/index.js +5 -0
- package/esm/Progress/index.native.js +5 -0
- package/esm/Progress/native/Progress.js +198 -0
- package/esm/Progress/native/Progress.test.js +134 -0
- package/esm/Progress/native/index.js +5 -0
- package/esm/RadioGroup/RadioGroup.theme.js +56 -0
- package/esm/RadioGroup/RadioGroupContext.js +6 -0
- package/esm/RadioGroup/index.js +7 -0
- package/esm/RadioGroup/index.native.js +7 -0
- package/esm/RadioGroup/native/Button/RadioButton.js +113 -0
- package/esm/RadioGroup/native/Button/RadioButton.test.js +70 -0
- package/esm/RadioGroup/native/Radio/Radio.js +171 -0
- package/esm/RadioGroup/native/Radio/Radio.test.js +74 -0
- package/esm/RadioGroup/native/RadioGroup.js +107 -0
- package/esm/RadioGroup/native/RadioGroup.test.js +56 -0
- package/esm/RadioGroup/native/index.js +8 -0
- package/esm/Rating/Rating.theme.js +11 -0
- package/esm/Rating/index.js +5 -0
- package/esm/Rating/index.native.js +5 -0
- package/esm/Rating/native/Rating.js +197 -0
- package/esm/Rating/native/Rating.test.js +91 -0
- package/esm/Rating/native/index.js +5 -0
- package/esm/Result/Result.theme.js +5 -0
- package/esm/Result/index.native.js +11 -0
- package/esm/Result/native/Attendances.js +54 -0
- package/esm/Result/native/Details.js +130 -0
- package/esm/Result/native/Rate.js +39 -0
- package/esm/Result/native/Result.js +98 -0
- package/esm/Result/native/Result.test.js +128 -0
- package/esm/Result/native/ResultButton.js +20 -0
- package/esm/Result/native/Tags.js +65 -0
- package/esm/Result/native/TinyTextIcon.js +29 -0
- package/esm/Result/native/index.js +5 -0
- package/esm/Skeleton/Skeleton.theme.js +22 -0
- package/esm/Skeleton/index.js +5 -0
- package/esm/Skeleton/index.native.js +5 -0
- package/esm/Skeleton/native/Skeleton.js +142 -0
- package/esm/Skeleton/native/Skeleton.test.js +40 -0
- package/esm/Skeleton/native/index.js +5 -0
- package/esm/Slider/Slider.theme.js +75 -0
- package/esm/Slider/index.js +5 -0
- package/esm/Slider/index.native.js +5 -0
- package/esm/Slider/native/Label.js +33 -0
- package/esm/Slider/native/Marker.js +84 -0
- package/esm/Slider/native/Slider.js +169 -0
- package/esm/Slider/native/Slider.test.js +105 -0
- package/esm/Slider/native/Step.js +27 -0
- package/esm/Slider/native/Tooltip.js +177 -0
- package/esm/Snackbar/Snackbar.theme.js +61 -0
- package/esm/Snackbar/index.js +5 -0
- package/esm/Snackbar/index.native.js +5 -0
- package/esm/Snackbar/native/Snackbar.js +246 -0
- package/esm/Snackbar/native/Snackbar.test.js +108 -0
- package/esm/Snackbar/native/SnackbarAnimationWrapper.js +114 -0
- package/esm/Snackbar/native/index.js +5 -0
- package/esm/Spinner/Spinner.theme.js +5 -0
- package/esm/Spinner/index.js +5 -0
- package/esm/Stepper/Stepper.theme.js +36 -0
- package/esm/Stepper/activeDot.js +5 -0
- package/esm/Stepper/index.js +6 -0
- package/esm/Stepper/index.native.js +6 -0
- package/esm/Stepper/native/Dots.js +75 -0
- package/esm/Stepper/native/Line.js +68 -0
- package/esm/Stepper/native/Step.js +33 -0
- package/esm/Stepper/native/Stepper.js +97 -0
- package/esm/Stepper/native/Stepper.test.js +64 -0
- package/esm/Stepper/native/index.js +6 -0
- package/esm/Tag/Tag.theme.js +38 -0
- package/esm/Tag/index.js +7 -0
- package/esm/Tag/index.native.js +7 -0
- package/esm/Tag/native/Informative.js +127 -0
- package/esm/Tag/native/Tag.js +121 -0
- package/esm/Tag/native/Tag.test.js +74 -0
- package/esm/Tag/native/index.js +5 -0
- package/esm/Text/Text.theme.js +73 -0
- package/esm/Text/index.js +35 -0
- package/esm/Text/index.native.js +35 -0
- package/esm/Text/native/Text.js +123 -0
- package/esm/Text/native/Text.test.js +150 -0
- package/esm/Text/native/index.js +34 -0
- package/esm/Text/sharedTextStyle.js +44 -0
- package/esm/Text/textStyle.android.js +27 -0
- package/esm/Text/textStyle.ios.js +9 -0
- package/esm/Text/textStyle.web.js +17 -0
- package/esm/TextArea/TextArea.theme.js +6 -0
- package/esm/TextArea/index.js +5 -0
- package/esm/TextArea/index.native.js +5 -0
- package/esm/TextArea/native/TextArea.js +64 -0
- package/esm/TextArea/native/TextArea.test.js +12 -0
- package/esm/TextArea/native/index.js +5 -0
- package/esm/Theme/Provider/Provider.js +75 -0
- package/esm/Theme/Provider/index.js +5 -0
- package/esm/Theme/Provider/index.native.js +5 -0
- package/esm/Theme/Provider/native/index.js +5 -0
- package/esm/Theme/Provider/web/FontLoader.js +21 -0
- package/esm/Theme/Provider/web/FontLoader.test.js +16 -0
- package/esm/Theme/Provider/web/GlobalStyle.js +18 -0
- package/esm/Theme/Provider/web/GlobalStyle.test.js +21 -0
- package/esm/Theme/Provider/web/ThemeProvider.js +50 -0
- package/esm/Theme/Provider/web/expectCssMatches.js +14 -0
- package/esm/Theme/Provider/web/index.js +6 -0
- package/esm/Theme/helpers/themeGenerator/index.js +5 -0
- package/esm/Theme/helpers/themeGenerator/themeGenerator.js +13 -0
- package/esm/Theme/helpers/themeGenerator/themeGenerator.test.js +20 -0
- package/esm/Theme/helpers/themeReader/base.test.js +73 -0
- package/esm/Theme/helpers/themeReader/index.js +26 -0
- package/esm/Theme/helpers/themeReader/native/native.test.js +38 -0
- package/esm/Theme/helpers/themeReader/web/web.test.js +32 -0
- package/esm/Theme/index.js +11 -0
- package/esm/Theme/index.native.js +10 -0
- package/esm/Theme/theme/index.js +5 -0
- package/esm/Theme/theme/theme.js +81 -0
- package/esm/hooks/index.js +3 -0
- package/esm/hooks/useCombinedRefs.js +20 -0
- package/esm/hooks/useKeyPress.js +26 -0
- package/esm/hooks/usePortal.js +39 -0
- package/esm/index.js +90 -0
- package/esm/index.native.js +58 -0
- package/esm/shared/HiddenInput.js +15 -0
- package/esm/shared/index.js +16 -0
- package/esm/shared/index.native.js +14 -0
- package/esm/shared/propTypes/charLength.js +16 -0
- package/esm/shared/propTypes/deprecated.js +14 -0
- package/esm/shared/propTypes/index.js +12 -0
- package/esm/shared/propTypes/limitChildren.js +15 -0
- package/esm/shared/propTypes/max.js +15 -0
- package/esm/shared/propTypes/typeof.js +17 -0
- package/package.json +2 -2
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
33
|
+
import React, { forwardRef } from "react";
|
|
34
|
+
import styled, { withTheme } from "styled-components";
|
|
35
|
+
import { node, oneOfType, func, bool } from "prop-types";
|
|
36
|
+
import withTouchable from "./withTouchable";
|
|
37
|
+
import Text from "../../Text";
|
|
38
|
+
const Label = styled(Text.Medium)`
|
|
39
|
+
text-align: center;
|
|
40
|
+
${({
|
|
41
|
+
small,
|
|
42
|
+
color,
|
|
43
|
+
theme: {
|
|
44
|
+
yoga: {
|
|
45
|
+
components: { button }
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}) => `
|
|
49
|
+
font-size: ${small ? button.font.size.small : button.font.size.default}px;
|
|
50
|
+
color: ${color};
|
|
51
|
+
`}
|
|
52
|
+
`;
|
|
53
|
+
const ButtonContainer = styled.View`
|
|
54
|
+
${({
|
|
55
|
+
pressed,
|
|
56
|
+
disabled,
|
|
57
|
+
full,
|
|
58
|
+
small,
|
|
59
|
+
inverted,
|
|
60
|
+
secondary,
|
|
61
|
+
theme: {
|
|
62
|
+
yoga: {
|
|
63
|
+
components: { button }
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}) => {
|
|
67
|
+
const state = secondary ? "secondary" : "primary";
|
|
68
|
+
return `
|
|
69
|
+
flex-direction: row;
|
|
70
|
+
align-items: center;
|
|
71
|
+
justify-content: center;
|
|
72
|
+
|
|
73
|
+
background-color: ${button.types.contained.backgroundColor[state].default};
|
|
74
|
+
border-radius: ${button.border.radius}px;
|
|
75
|
+
height: ${small ? button.height.small : button.height.default};
|
|
76
|
+
justify-content: center;
|
|
77
|
+
padding-left: ${small ? button.padding.small.left : button.padding.default.left}px;
|
|
78
|
+
padding-right: ${small ? button.padding.small.right : button.padding.default.right}px;
|
|
79
|
+
${full ? "width: 100%;" : ""}
|
|
80
|
+
|
|
81
|
+
${!disabled && pressed ? `
|
|
82
|
+
background-color: ${button.types.contained.backgroundColor[state].pressed};
|
|
83
|
+
` : ""}
|
|
84
|
+
|
|
85
|
+
${disabled ? `
|
|
86
|
+
background-color: ${button.types.contained.backgroundColor.disabled};
|
|
87
|
+
` : ""}
|
|
88
|
+
|
|
89
|
+
${inverted && !disabled ? `
|
|
90
|
+
background-color: ${button.types.contained.font.default.color};
|
|
91
|
+
` : ""}
|
|
92
|
+
`;
|
|
93
|
+
}}
|
|
94
|
+
`;
|
|
95
|
+
const Button = forwardRef(
|
|
96
|
+
(_a, ref) => {
|
|
97
|
+
var _b = _a, {
|
|
98
|
+
children,
|
|
99
|
+
full,
|
|
100
|
+
disabled,
|
|
101
|
+
small,
|
|
102
|
+
pressed,
|
|
103
|
+
inverted,
|
|
104
|
+
secondary,
|
|
105
|
+
icon: Icon,
|
|
106
|
+
theme: {
|
|
107
|
+
yoga: {
|
|
108
|
+
components: { button }
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
} = _b, rest = __objRest(_b, [
|
|
112
|
+
"children",
|
|
113
|
+
"full",
|
|
114
|
+
"disabled",
|
|
115
|
+
"small",
|
|
116
|
+
"pressed",
|
|
117
|
+
"inverted",
|
|
118
|
+
"secondary",
|
|
119
|
+
"icon",
|
|
120
|
+
"theme"
|
|
121
|
+
]);
|
|
122
|
+
const state = secondary ? "secondary" : "primary";
|
|
123
|
+
let textColor = button.types.contained.font.default.color;
|
|
124
|
+
if (disabled) {
|
|
125
|
+
textColor = button.types.contained.font.disabled.color;
|
|
126
|
+
} else if (inverted) {
|
|
127
|
+
textColor = button.types.contained.backgroundColor[state].default;
|
|
128
|
+
if (pressed) {
|
|
129
|
+
textColor = button.types.contained.backgroundColor[state].pressed;
|
|
130
|
+
}
|
|
131
|
+
} else if (pressed) {
|
|
132
|
+
textColor = button.types.contained.font.pressed.color;
|
|
133
|
+
}
|
|
134
|
+
return /* @__PURE__ */ jsxs(
|
|
135
|
+
ButtonContainer,
|
|
136
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
137
|
+
full,
|
|
138
|
+
pressed,
|
|
139
|
+
disabled,
|
|
140
|
+
small,
|
|
141
|
+
inverted,
|
|
142
|
+
secondary,
|
|
143
|
+
ref,
|
|
144
|
+
children: [
|
|
145
|
+
Icon && /* @__PURE__ */ jsx(
|
|
146
|
+
Icon,
|
|
147
|
+
{
|
|
148
|
+
width: small ? button.icon.size.small : button.icon.size.default,
|
|
149
|
+
height: small ? button.icon.size.small : button.icon.size.default,
|
|
150
|
+
fill: textColor,
|
|
151
|
+
style: {
|
|
152
|
+
marginRight: button.icon.margin.right
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
),
|
|
156
|
+
/* @__PURE__ */ jsx(
|
|
157
|
+
Label,
|
|
158
|
+
{
|
|
159
|
+
disabled,
|
|
160
|
+
pressed,
|
|
161
|
+
inverted,
|
|
162
|
+
small,
|
|
163
|
+
color: textColor,
|
|
164
|
+
children
|
|
165
|
+
}
|
|
166
|
+
)
|
|
167
|
+
]
|
|
168
|
+
})
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
Button.propTypes = {
|
|
173
|
+
children: node,
|
|
174
|
+
full: bool,
|
|
175
|
+
disabled: bool,
|
|
176
|
+
small: bool,
|
|
177
|
+
pressed: bool,
|
|
178
|
+
inverted: bool,
|
|
179
|
+
secondary: bool,
|
|
180
|
+
/** an Icon from yoga-icons package */
|
|
181
|
+
icon: oneOfType([bool, func])
|
|
182
|
+
};
|
|
183
|
+
Button.defaultProps = {
|
|
184
|
+
children: "Button",
|
|
185
|
+
full: false,
|
|
186
|
+
disabled: false,
|
|
187
|
+
small: false,
|
|
188
|
+
pressed: false,
|
|
189
|
+
inverted: false,
|
|
190
|
+
secondary: false,
|
|
191
|
+
icon: void 0
|
|
192
|
+
};
|
|
193
|
+
const ButtonWithTouchable = withTouchable(withTheme(Button));
|
|
194
|
+
export {
|
|
195
|
+
ButtonContainer,
|
|
196
|
+
Label,
|
|
197
|
+
ButtonWithTouchable as default
|
|
198
|
+
};
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { render, fireEvent } from "@testing-library/react-native";
|
|
4
|
+
import { Booking } from "@gympass/yoga-icons";
|
|
5
|
+
import ThemeProvider from "../../Theme";
|
|
6
|
+
import Button from "..";
|
|
7
|
+
describe("<Button />", () => {
|
|
8
|
+
describe("Snapshots", () => {
|
|
9
|
+
describe("primary buttons", () => {
|
|
10
|
+
describe("Without props", () => {
|
|
11
|
+
it("should match snapshot with default Button", () => {
|
|
12
|
+
const { toJSON } = render(
|
|
13
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button, {}) })
|
|
14
|
+
);
|
|
15
|
+
expect(toJSON()).toMatchSnapshot();
|
|
16
|
+
});
|
|
17
|
+
it("should match snapshot with text Button", () => {
|
|
18
|
+
const { toJSON } = render(
|
|
19
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Text, {}) })
|
|
20
|
+
);
|
|
21
|
+
expect(toJSON()).toMatchSnapshot();
|
|
22
|
+
});
|
|
23
|
+
it("should match snapshot with link Button", () => {
|
|
24
|
+
const { toJSON } = render(
|
|
25
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Link, {}) })
|
|
26
|
+
);
|
|
27
|
+
expect(toJSON()).toMatchSnapshot();
|
|
28
|
+
});
|
|
29
|
+
it("should match snapshot with default Button with Icon", () => {
|
|
30
|
+
const { toJSON } = render(
|
|
31
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button, { icon: Booking }) })
|
|
32
|
+
);
|
|
33
|
+
expect(toJSON()).toMatchSnapshot();
|
|
34
|
+
});
|
|
35
|
+
it("should match snapshot with text Button with Icon", () => {
|
|
36
|
+
const { toJSON } = render(
|
|
37
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Text, { icon: Booking }) })
|
|
38
|
+
);
|
|
39
|
+
expect(toJSON()).toMatchSnapshot();
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
describe("With inverted prop", () => {
|
|
43
|
+
it("should match snapshot with default Button", () => {
|
|
44
|
+
const { toJSON } = render(
|
|
45
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button, { inverted: true }) })
|
|
46
|
+
);
|
|
47
|
+
expect(toJSON()).toMatchSnapshot();
|
|
48
|
+
});
|
|
49
|
+
it("should match snapshot with text Button", () => {
|
|
50
|
+
const { toJSON } = render(
|
|
51
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Text, { inverted: true }) })
|
|
52
|
+
);
|
|
53
|
+
expect(toJSON()).toMatchSnapshot();
|
|
54
|
+
});
|
|
55
|
+
it("should match snapshot with default Button with Icon", () => {
|
|
56
|
+
const { toJSON } = render(
|
|
57
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button, { inverted: true, icon: Booking }) })
|
|
58
|
+
);
|
|
59
|
+
expect(toJSON()).toMatchSnapshot();
|
|
60
|
+
});
|
|
61
|
+
it("should match snapshot with text Button with Icon", () => {
|
|
62
|
+
const { toJSON } = render(
|
|
63
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Text, { inverted: true, icon: Booking }) })
|
|
64
|
+
);
|
|
65
|
+
expect(toJSON()).toMatchSnapshot();
|
|
66
|
+
});
|
|
67
|
+
it("should match snapshot with icon Button", () => {
|
|
68
|
+
const { toJSON } = render(
|
|
69
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Icon, { icon: Booking, inverted: true }) })
|
|
70
|
+
);
|
|
71
|
+
expect(toJSON()).toMatchSnapshot();
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
describe("With small prop", () => {
|
|
75
|
+
it("should match snapshot with default Button", () => {
|
|
76
|
+
const { toJSON } = render(
|
|
77
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button, { small: true }) })
|
|
78
|
+
);
|
|
79
|
+
expect(toJSON()).toMatchSnapshot();
|
|
80
|
+
});
|
|
81
|
+
it("should match snapshot with text Button", () => {
|
|
82
|
+
const { toJSON } = render(
|
|
83
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Text, { small: true }) })
|
|
84
|
+
);
|
|
85
|
+
expect(toJSON()).toMatchSnapshot();
|
|
86
|
+
});
|
|
87
|
+
it("should match snapshot with default Button with Icon", () => {
|
|
88
|
+
const { toJSON } = render(
|
|
89
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button, { small: true, icon: Booking }) })
|
|
90
|
+
);
|
|
91
|
+
expect(toJSON()).toMatchSnapshot();
|
|
92
|
+
});
|
|
93
|
+
it("should match snapshot with text Button with Icon", () => {
|
|
94
|
+
const { toJSON } = render(
|
|
95
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Text, { small: true, icon: Booking }) })
|
|
96
|
+
);
|
|
97
|
+
expect(toJSON()).toMatchSnapshot();
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
describe("With full prop", () => {
|
|
101
|
+
it("should match snapshot with default Button", () => {
|
|
102
|
+
const { toJSON } = render(
|
|
103
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button, { full: true }) })
|
|
104
|
+
);
|
|
105
|
+
expect(toJSON()).toMatchSnapshot();
|
|
106
|
+
});
|
|
107
|
+
it("should match snapshot with text Button", () => {
|
|
108
|
+
const { toJSON } = render(
|
|
109
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Text, { full: true }) })
|
|
110
|
+
);
|
|
111
|
+
expect(toJSON()).toMatchSnapshot();
|
|
112
|
+
});
|
|
113
|
+
it("should match snapshot with default Button with Icon", () => {
|
|
114
|
+
const { toJSON } = render(
|
|
115
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button, { full: true, icon: Booking }) })
|
|
116
|
+
);
|
|
117
|
+
expect(toJSON()).toMatchSnapshot();
|
|
118
|
+
});
|
|
119
|
+
it("should match snapshot with text Button with Icon", () => {
|
|
120
|
+
const { toJSON } = render(
|
|
121
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Text, { full: true, icon: Booking }) })
|
|
122
|
+
);
|
|
123
|
+
expect(toJSON()).toMatchSnapshot();
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
describe("With large prop", () => {
|
|
127
|
+
it("should match snapshot icon Button with large prop", () => {
|
|
128
|
+
const { toJSON } = render(
|
|
129
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Icon, { icon: Booking, large: true }) })
|
|
130
|
+
);
|
|
131
|
+
expect(toJSON()).toMatchSnapshot();
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
describe("secondary buttons", () => {
|
|
136
|
+
describe("Without props", () => {
|
|
137
|
+
it("should match snapshot with default Button", () => {
|
|
138
|
+
const { toJSON } = render(
|
|
139
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button, { secondary: true }) })
|
|
140
|
+
);
|
|
141
|
+
expect(toJSON()).toMatchSnapshot();
|
|
142
|
+
});
|
|
143
|
+
it("should match snapshot with text Button", () => {
|
|
144
|
+
const { toJSON } = render(
|
|
145
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Text, { secondary: true }) })
|
|
146
|
+
);
|
|
147
|
+
expect(toJSON()).toMatchSnapshot();
|
|
148
|
+
});
|
|
149
|
+
it("should match snapshot with link Button", () => {
|
|
150
|
+
const { toJSON } = render(
|
|
151
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Link, { secondary: true }) })
|
|
152
|
+
);
|
|
153
|
+
expect(toJSON()).toMatchSnapshot();
|
|
154
|
+
});
|
|
155
|
+
it("should match snapshot with default Button with Icon", () => {
|
|
156
|
+
const { toJSON } = render(
|
|
157
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button, { icon: Booking, secondary: true }) })
|
|
158
|
+
);
|
|
159
|
+
expect(toJSON()).toMatchSnapshot();
|
|
160
|
+
});
|
|
161
|
+
it("should match snapshot with text Button with Icon", () => {
|
|
162
|
+
const { toJSON } = render(
|
|
163
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Text, { icon: Booking, secondary: true }) })
|
|
164
|
+
);
|
|
165
|
+
expect(toJSON()).toMatchSnapshot();
|
|
166
|
+
});
|
|
167
|
+
it("should match snapshot with icon Button with Icon", () => {
|
|
168
|
+
const { toJSON } = render(
|
|
169
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Icon, { icon: Booking, secondary: true }) })
|
|
170
|
+
);
|
|
171
|
+
expect(toJSON()).toMatchSnapshot();
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
describe("With inverted prop", () => {
|
|
175
|
+
it("should match snapshot with default Button", () => {
|
|
176
|
+
const { toJSON } = render(
|
|
177
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button, { inverted: true, secondary: true }) })
|
|
178
|
+
);
|
|
179
|
+
expect(toJSON()).toMatchSnapshot();
|
|
180
|
+
});
|
|
181
|
+
it("should match snapshot with text Button", () => {
|
|
182
|
+
const { toJSON } = render(
|
|
183
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Text, { inverted: true, secondary: true }) })
|
|
184
|
+
);
|
|
185
|
+
expect(toJSON()).toMatchSnapshot();
|
|
186
|
+
});
|
|
187
|
+
it("should match snapshot with default Button with Icon", () => {
|
|
188
|
+
const { toJSON } = render(
|
|
189
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button, { inverted: true, icon: Booking, secondary: true }) })
|
|
190
|
+
);
|
|
191
|
+
expect(toJSON()).toMatchSnapshot();
|
|
192
|
+
});
|
|
193
|
+
it("should match snapshot with text Button with Icon", () => {
|
|
194
|
+
const { toJSON } = render(
|
|
195
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Text, { inverted: true, icon: Booking, secondary: true }) })
|
|
196
|
+
);
|
|
197
|
+
expect(toJSON()).toMatchSnapshot();
|
|
198
|
+
});
|
|
199
|
+
it("should match snapshot with icon Button with Icon", () => {
|
|
200
|
+
const { toJSON } = render(
|
|
201
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Icon, { inverted: true, icon: Booking, secondary: true }) })
|
|
202
|
+
);
|
|
203
|
+
expect(toJSON()).toMatchSnapshot();
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
describe("With small prop", () => {
|
|
207
|
+
it("should match snapshot with default Button", () => {
|
|
208
|
+
const { toJSON } = render(
|
|
209
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button, { small: true, secondary: true }) })
|
|
210
|
+
);
|
|
211
|
+
expect(toJSON()).toMatchSnapshot();
|
|
212
|
+
});
|
|
213
|
+
it("should match snapshot with text Button", () => {
|
|
214
|
+
const { toJSON } = render(
|
|
215
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Text, { small: true, secondary: true }) })
|
|
216
|
+
);
|
|
217
|
+
expect(toJSON()).toMatchSnapshot();
|
|
218
|
+
});
|
|
219
|
+
it("should match snapshot with default Button with Icon", () => {
|
|
220
|
+
const { toJSON } = render(
|
|
221
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button, { small: true, icon: Booking, secondary: true }) })
|
|
222
|
+
);
|
|
223
|
+
expect(toJSON()).toMatchSnapshot();
|
|
224
|
+
});
|
|
225
|
+
it("should match snapshot with text Button with Icon", () => {
|
|
226
|
+
const { toJSON } = render(
|
|
227
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Text, { small: true, icon: Booking, secondary: true }) })
|
|
228
|
+
);
|
|
229
|
+
expect(toJSON()).toMatchSnapshot();
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
describe("With full prop", () => {
|
|
233
|
+
it("should match snapshot with default Button", () => {
|
|
234
|
+
const { toJSON } = render(
|
|
235
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button, { full: true, secondary: true }) })
|
|
236
|
+
);
|
|
237
|
+
expect(toJSON()).toMatchSnapshot();
|
|
238
|
+
});
|
|
239
|
+
it("should match snapshot with text Button", () => {
|
|
240
|
+
const { toJSON } = render(
|
|
241
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Text, { full: true, secondary: true }) })
|
|
242
|
+
);
|
|
243
|
+
expect(toJSON()).toMatchSnapshot();
|
|
244
|
+
});
|
|
245
|
+
it("should match snapshot with default Button with Icon", () => {
|
|
246
|
+
const { toJSON } = render(
|
|
247
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button, { full: true, icon: Booking, secondary: true }) })
|
|
248
|
+
);
|
|
249
|
+
expect(toJSON()).toMatchSnapshot();
|
|
250
|
+
});
|
|
251
|
+
it("should match snapshot with text Button with Icon", () => {
|
|
252
|
+
const { toJSON } = render(
|
|
253
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Text, { full: true, icon: Booking, secondary: true }) })
|
|
254
|
+
);
|
|
255
|
+
expect(toJSON()).toMatchSnapshot();
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
describe("With large prop", () => {
|
|
259
|
+
it("should match snapshot icon Button with large prop", () => {
|
|
260
|
+
const { toJSON } = render(
|
|
261
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Icon, { large: true, icon: Booking, secondary: true }) })
|
|
262
|
+
);
|
|
263
|
+
expect(toJSON()).toMatchSnapshot();
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
});
|
|
267
|
+
describe("disabled buttons", () => {
|
|
268
|
+
describe("With disabled prop", () => {
|
|
269
|
+
it("should match snapshot with default Button", () => {
|
|
270
|
+
const { toJSON } = render(
|
|
271
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button, { disabled: true }) })
|
|
272
|
+
);
|
|
273
|
+
expect(toJSON()).toMatchSnapshot();
|
|
274
|
+
});
|
|
275
|
+
it("should match snapshot with text Button", () => {
|
|
276
|
+
const { toJSON } = render(
|
|
277
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Text, { disabled: true }) })
|
|
278
|
+
);
|
|
279
|
+
expect(toJSON()).toMatchSnapshot();
|
|
280
|
+
});
|
|
281
|
+
it("should match snapshot with link Button", () => {
|
|
282
|
+
const { toJSON } = render(
|
|
283
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Link, { disabled: true }) })
|
|
284
|
+
);
|
|
285
|
+
expect(toJSON()).toMatchSnapshot();
|
|
286
|
+
});
|
|
287
|
+
it("should match snapshot with default Button with Icon", () => {
|
|
288
|
+
const { toJSON } = render(
|
|
289
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button, { disabled: true, icon: Booking }) })
|
|
290
|
+
);
|
|
291
|
+
expect(toJSON()).toMatchSnapshot();
|
|
292
|
+
});
|
|
293
|
+
it("should match snapshot with text Button with Icon", () => {
|
|
294
|
+
const { toJSON } = render(
|
|
295
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Text, { disabled: true, icon: Booking }) })
|
|
296
|
+
);
|
|
297
|
+
expect(toJSON()).toMatchSnapshot();
|
|
298
|
+
});
|
|
299
|
+
it("should match snapshot with icon Button with Icon", () => {
|
|
300
|
+
const { toJSON } = render(
|
|
301
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Icon, { disabled: true, icon: Booking }) })
|
|
302
|
+
);
|
|
303
|
+
expect(toJSON()).toMatchSnapshot();
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
});
|
|
307
|
+
});
|
|
308
|
+
describe("onPress prop", () => {
|
|
309
|
+
it("should call onPress function when click on Button", () => {
|
|
310
|
+
const onPressMock = jest.fn();
|
|
311
|
+
const { getByText } = render(
|
|
312
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button, { onPress: onPressMock, children: "Button" }) })
|
|
313
|
+
);
|
|
314
|
+
fireEvent.press(getByText("Button"));
|
|
315
|
+
expect(onPressMock).toHaveBeenCalled();
|
|
316
|
+
});
|
|
317
|
+
it("should call onPress function when press on Button.Text", () => {
|
|
318
|
+
const onPressMock = jest.fn();
|
|
319
|
+
const { getByText } = render(
|
|
320
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Text, { onPress: onPressMock, children: "Button.Text" }) })
|
|
321
|
+
);
|
|
322
|
+
fireEvent.press(getByText("Button.Text"));
|
|
323
|
+
expect(onPressMock).toHaveBeenCalled();
|
|
324
|
+
});
|
|
325
|
+
it("should call onPress function when press on Button.Icon", () => {
|
|
326
|
+
const onPressMock = jest.fn();
|
|
327
|
+
const { getByRole } = render(
|
|
328
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Icon, { onPress: onPressMock, icon: Booking }) })
|
|
329
|
+
);
|
|
330
|
+
fireEvent.press(getByRole("button"));
|
|
331
|
+
expect(onPressMock).toHaveBeenCalled();
|
|
332
|
+
});
|
|
333
|
+
it("should not call onPress function when press on Button disabled", () => {
|
|
334
|
+
const onPressMock = jest.fn();
|
|
335
|
+
const { getByText } = render(
|
|
336
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button, { disabled: true, onPress: onPressMock, children: "Button" }) })
|
|
337
|
+
);
|
|
338
|
+
fireEvent.press(getByText("Button"));
|
|
339
|
+
expect(onPressMock).not.toHaveBeenCalled();
|
|
340
|
+
});
|
|
341
|
+
});
|
|
342
|
+
});
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
import { jsx } from "react/jsx-runtime";
|
|
33
|
+
import React, { forwardRef } from "react";
|
|
34
|
+
import styled, { withTheme } from "styled-components";
|
|
35
|
+
import { node, oneOfType, func, bool } from "prop-types";
|
|
36
|
+
import Icon from "../../Icon";
|
|
37
|
+
import withTouchable from "./withTouchable";
|
|
38
|
+
const ButtonContainer = styled.View`
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
|
|
43
|
+
${({
|
|
44
|
+
small,
|
|
45
|
+
secondary,
|
|
46
|
+
theme: {
|
|
47
|
+
yoga: {
|
|
48
|
+
components: { button }
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
disabled,
|
|
52
|
+
inverted,
|
|
53
|
+
pressed
|
|
54
|
+
}) => {
|
|
55
|
+
const state = secondary ? "secondary" : "primary";
|
|
56
|
+
return `
|
|
57
|
+
border-radius: ${button.border.radius}px;
|
|
58
|
+
|
|
59
|
+
background-color: ${button.types.contained.backgroundColor[state].default};
|
|
60
|
+
|
|
61
|
+
width: ${small ? button.height.small : button.height.default}px;
|
|
62
|
+
height: ${small ? button.height.small : button.height.default}px;
|
|
63
|
+
|
|
64
|
+
${!disabled && pressed ? `
|
|
65
|
+
background-color: ${button.types.contained.backgroundColor[state].pressed};
|
|
66
|
+
` : ""}
|
|
67
|
+
|
|
68
|
+
${disabled ? `
|
|
69
|
+
background-color: ${button.types.contained.backgroundColor.disabled};
|
|
70
|
+
` : ""}
|
|
71
|
+
|
|
72
|
+
${inverted && !disabled ? `
|
|
73
|
+
background-color: ${button.types.contained.font.default.color};
|
|
74
|
+
` : ""}
|
|
75
|
+
`;
|
|
76
|
+
}}
|
|
77
|
+
`;
|
|
78
|
+
const ButtonIcon = forwardRef(
|
|
79
|
+
(_a, ref) => {
|
|
80
|
+
var _b = _a, {
|
|
81
|
+
icon,
|
|
82
|
+
theme: {
|
|
83
|
+
yoga: {
|
|
84
|
+
components: { button }
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
small,
|
|
88
|
+
pressed,
|
|
89
|
+
disabled,
|
|
90
|
+
inverted,
|
|
91
|
+
secondary
|
|
92
|
+
} = _b, props = __objRest(_b, [
|
|
93
|
+
"icon",
|
|
94
|
+
"theme",
|
|
95
|
+
"small",
|
|
96
|
+
"pressed",
|
|
97
|
+
"disabled",
|
|
98
|
+
"inverted",
|
|
99
|
+
"secondary"
|
|
100
|
+
]);
|
|
101
|
+
const state = secondary ? "secondary" : "primary";
|
|
102
|
+
let textColor = button.types.contained.font.default.color;
|
|
103
|
+
if (disabled) {
|
|
104
|
+
textColor = button.types.contained.font.disabled.color;
|
|
105
|
+
} else if (inverted) {
|
|
106
|
+
textColor = button.types.contained.backgroundColor[state].default;
|
|
107
|
+
if (pressed) {
|
|
108
|
+
textColor = button.types.contained.backgroundColor[state].pressed;
|
|
109
|
+
}
|
|
110
|
+
} else if (pressed) {
|
|
111
|
+
textColor = button.types.contained.font.pressed.color;
|
|
112
|
+
}
|
|
113
|
+
return /* @__PURE__ */ jsx(
|
|
114
|
+
ButtonContainer,
|
|
115
|
+
__spreadProps(__spreadValues({}, props), {
|
|
116
|
+
ref,
|
|
117
|
+
small,
|
|
118
|
+
pressed,
|
|
119
|
+
disabled,
|
|
120
|
+
inverted,
|
|
121
|
+
secondary,
|
|
122
|
+
accessible: true,
|
|
123
|
+
accessibilityRole: "button",
|
|
124
|
+
children: /* @__PURE__ */ jsx(
|
|
125
|
+
Icon,
|
|
126
|
+
{
|
|
127
|
+
as: icon,
|
|
128
|
+
fill: textColor,
|
|
129
|
+
size: small ? button.icon.size.small : button.icon.size.default
|
|
130
|
+
}
|
|
131
|
+
)
|
|
132
|
+
})
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
ButtonIcon.propTypes = {
|
|
137
|
+
small: bool,
|
|
138
|
+
disabled: bool,
|
|
139
|
+
pressed: bool,
|
|
140
|
+
inverted: bool,
|
|
141
|
+
secondary: bool,
|
|
142
|
+
icon: oneOfType([node, func])
|
|
143
|
+
};
|
|
144
|
+
ButtonIcon.defaultProps = {
|
|
145
|
+
small: false,
|
|
146
|
+
disabled: false,
|
|
147
|
+
pressed: false,
|
|
148
|
+
inverted: false,
|
|
149
|
+
secondary: false,
|
|
150
|
+
icon: void 0
|
|
151
|
+
};
|
|
152
|
+
ButtonIcon.displayName = "Button.Icon";
|
|
153
|
+
var Icon_default = withTouchable(withTheme(ButtonIcon));
|
|
154
|
+
export {
|
|
155
|
+
Icon_default as default
|
|
156
|
+
};
|