@gympass/yoga 7.88.0 → 7.88.2
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/componentThemes.js +112 -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/componentThemes.js +82 -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,56 @@
|
|
|
1
|
+
const RadioGroup = ({
|
|
2
|
+
radii,
|
|
3
|
+
colors,
|
|
4
|
+
fontWeights,
|
|
5
|
+
spacing,
|
|
6
|
+
borders,
|
|
7
|
+
fontSizes
|
|
8
|
+
}) => ({
|
|
9
|
+
button: {
|
|
10
|
+
border: {
|
|
11
|
+
radius: radii.circle,
|
|
12
|
+
width: borders.small,
|
|
13
|
+
color: colors.elements.backgroundAndDisabled
|
|
14
|
+
},
|
|
15
|
+
backgroundColor: "transparent",
|
|
16
|
+
padding: {
|
|
17
|
+
right: spacing.large,
|
|
18
|
+
left: spacing.large
|
|
19
|
+
},
|
|
20
|
+
height: {
|
|
21
|
+
normal: 40,
|
|
22
|
+
small: 32
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
radio: {
|
|
26
|
+
size: 20,
|
|
27
|
+
backgroundColor: colors.elements.selectionAndIcons,
|
|
28
|
+
border: {
|
|
29
|
+
radius: radii.circle
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
font: {
|
|
33
|
+
size: fontSizes.small,
|
|
34
|
+
color: colors.text.primary
|
|
35
|
+
},
|
|
36
|
+
hover: {
|
|
37
|
+
backgroundColor: colors.elements.backgroundAndDisabled
|
|
38
|
+
},
|
|
39
|
+
disabled: {
|
|
40
|
+
backgroundColor: colors.elements.backgroundAndDisabled
|
|
41
|
+
},
|
|
42
|
+
checked: {
|
|
43
|
+
backgroundColor: colors.primary,
|
|
44
|
+
font: {
|
|
45
|
+
color: colors.white,
|
|
46
|
+
weight: fontWeights.bold
|
|
47
|
+
},
|
|
48
|
+
hover: {
|
|
49
|
+
backgroundColor: colors.primary
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
var RadioGroup_theme_default = RadioGroup;
|
|
54
|
+
export {
|
|
55
|
+
RadioGroup_theme_default as default
|
|
56
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
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, { useContext } from "react";
|
|
34
|
+
import { string, oneOfType, number, node } from "prop-types";
|
|
35
|
+
import { TouchableWithoutFeedback } from "react-native";
|
|
36
|
+
import styled from "styled-components";
|
|
37
|
+
import RadioGroupContext from "../../RadioGroupContext";
|
|
38
|
+
const RadioMark = styled.View(
|
|
39
|
+
({
|
|
40
|
+
theme: {
|
|
41
|
+
yoga: {
|
|
42
|
+
components: { radiogroup }
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
small,
|
|
46
|
+
checked
|
|
47
|
+
}) => `
|
|
48
|
+
align-items: center;
|
|
49
|
+
justify-content: center;
|
|
50
|
+
|
|
51
|
+
height: ${small ? radiogroup.button.height.small : radiogroup.button.height.normal}px;
|
|
52
|
+
padding-left: ${radiogroup.button.padding.left}px;
|
|
53
|
+
padding-right: ${radiogroup.button.padding.right}px;
|
|
54
|
+
|
|
55
|
+
background-color: ${radiogroup.button.backgroundColor};
|
|
56
|
+
border-radius: ${radiogroup.button.border.radius}px;
|
|
57
|
+
|
|
58
|
+
font-size: ${radiogroup.font.size}px;
|
|
59
|
+
|
|
60
|
+
${checked ? `
|
|
61
|
+
background-color: ${radiogroup.checked.backgroundColor};
|
|
62
|
+
` : ``}
|
|
63
|
+
`
|
|
64
|
+
);
|
|
65
|
+
const Text = styled.Text(
|
|
66
|
+
({
|
|
67
|
+
theme: {
|
|
68
|
+
yoga: {
|
|
69
|
+
baseFont,
|
|
70
|
+
components: { radiogroup }
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
checked
|
|
74
|
+
}) => `
|
|
75
|
+
font-family: ${baseFont.family};
|
|
76
|
+
color: ${radiogroup.font.color};
|
|
77
|
+
|
|
78
|
+
${checked ? `
|
|
79
|
+
color: ${radiogroup.checked.font.color};
|
|
80
|
+
font-weight: ${radiogroup.checked.font.weight};
|
|
81
|
+
` : ""}
|
|
82
|
+
`
|
|
83
|
+
);
|
|
84
|
+
const RadioGroupButton = React.forwardRef(
|
|
85
|
+
(_a, ref) => {
|
|
86
|
+
var _b = _a, { value, children } = _b, rest = __objRest(_b, ["value", "children"]);
|
|
87
|
+
const _a2 = useContext(RadioGroupContext), { onChange, small, selectedValue } = _a2, context = __objRest(_a2, ["onChange", "small", "selectedValue"]);
|
|
88
|
+
const inputValue = value || children;
|
|
89
|
+
const checked = inputValue === selectedValue;
|
|
90
|
+
return /* @__PURE__ */ jsx(
|
|
91
|
+
TouchableWithoutFeedback,
|
|
92
|
+
__spreadProps(__spreadValues({
|
|
93
|
+
onPress: () => {
|
|
94
|
+
onChange({ value: inputValue });
|
|
95
|
+
}
|
|
96
|
+
}, context), {
|
|
97
|
+
children: /* @__PURE__ */ jsx(RadioMark, __spreadProps(__spreadValues({ small, checked, ref }, rest), { children: /* @__PURE__ */ jsx(Text, { checked, children }) }))
|
|
98
|
+
})
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
RadioGroupButton.displayName = "RadioGroup.Button";
|
|
103
|
+
RadioGroupButton.propTypes = {
|
|
104
|
+
value: oneOfType([string, number]),
|
|
105
|
+
children: node.isRequired
|
|
106
|
+
};
|
|
107
|
+
RadioGroupButton.defaultProps = {
|
|
108
|
+
value: ""
|
|
109
|
+
};
|
|
110
|
+
var RadioButton_default = RadioGroupButton;
|
|
111
|
+
export {
|
|
112
|
+
RadioButton_default as default
|
|
113
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { render, fireEvent } from "@testing-library/react-native";
|
|
4
|
+
import RadioGroup from "../..";
|
|
5
|
+
import ThemeProvider from "../../../Theme";
|
|
6
|
+
import RadioGroupContext from "../../RadioGroupContext";
|
|
7
|
+
describe("<RadioGroup />", () => {
|
|
8
|
+
describe("<RadioGroup.Button />", () => {
|
|
9
|
+
describe("Snapshots", () => {
|
|
10
|
+
it("should match snapshot with default radio button", () => {
|
|
11
|
+
const { root, toJSON } = render(
|
|
12
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(RadioGroup.Button, { children: "Radio 1" }) })
|
|
13
|
+
);
|
|
14
|
+
expect(toJSON(root)).toMatchSnapshot();
|
|
15
|
+
});
|
|
16
|
+
it("should match snapshot with small radio button", () => {
|
|
17
|
+
const { root, toJSON } = render(
|
|
18
|
+
/* @__PURE__ */ jsx(RadioGroupContext.Provider, { value: { small: true }, children: /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(RadioGroup.Button, { children: "Radio 1" }) }) })
|
|
19
|
+
);
|
|
20
|
+
expect(toJSON(root)).toMatchSnapshot();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
describe("Props", () => {
|
|
24
|
+
it("checked should be the selectedValue provided from Context", () => {
|
|
25
|
+
const { getAllByText } = render(
|
|
26
|
+
/* @__PURE__ */ jsx(RadioGroupContext.Provider, { value: { selectedValue: "Radio 2" }, children: /* @__PURE__ */ jsxs(ThemeProvider, { children: [
|
|
27
|
+
/* @__PURE__ */ jsx(RadioGroup.Button, { children: "Radio 1" }),
|
|
28
|
+
/* @__PURE__ */ jsx(RadioGroup.Button, { children: "Radio 2" })
|
|
29
|
+
] }) })
|
|
30
|
+
);
|
|
31
|
+
const [radio, radio2] = getAllByText(/^Radio/);
|
|
32
|
+
expect(radio.props.checked).toBe(false);
|
|
33
|
+
expect(radio2.props.checked).toBe(true);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
describe("Events", () => {
|
|
37
|
+
it("should call onchange from Context", () => {
|
|
38
|
+
const onChangeMock = jest.fn();
|
|
39
|
+
const { getByText } = render(
|
|
40
|
+
/* @__PURE__ */ jsx(RadioGroupContext.Provider, { value: { onChange: onChangeMock }, children: /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(RadioGroup.Button, { children: "Radio 1" }) }) })
|
|
41
|
+
);
|
|
42
|
+
const radio = getByText(/^Radio/);
|
|
43
|
+
fireEvent.press(radio);
|
|
44
|
+
expect(onChangeMock).toHaveBeenCalled();
|
|
45
|
+
});
|
|
46
|
+
it("value should be as prop value", () => {
|
|
47
|
+
const onChangeMock = jest.fn();
|
|
48
|
+
const { getByText } = render(
|
|
49
|
+
/* @__PURE__ */ jsx(RadioGroupContext.Provider, { value: { onChange: onChangeMock }, children: /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(RadioGroup.Button, { value: "radio1", children: "Radio 1" }) }) })
|
|
50
|
+
);
|
|
51
|
+
const radio = getByText(/^Radio/);
|
|
52
|
+
fireEvent.press(radio);
|
|
53
|
+
expect(onChangeMock).toHaveBeenCalledWith({
|
|
54
|
+
value: "radio1"
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
it("value should be children if prop value is ommited", () => {
|
|
58
|
+
const onChangeMock = jest.fn();
|
|
59
|
+
const { getByText } = render(
|
|
60
|
+
/* @__PURE__ */ jsx(RadioGroupContext.Provider, { value: { onChange: onChangeMock }, children: /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(RadioGroup.Button, { children: "Radio 1" }) }) })
|
|
61
|
+
);
|
|
62
|
+
const radio = getByText(/^Radio/);
|
|
63
|
+
fireEvent.press(radio);
|
|
64
|
+
expect(onChangeMock).toHaveBeenCalledWith({
|
|
65
|
+
value: "Radio 1"
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
});
|
|
@@ -0,0 +1,171 @@
|
|
|
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, { useContext, useState } from "react";
|
|
34
|
+
import styled from "styled-components";
|
|
35
|
+
import { string, oneOfType, number, bool } from "prop-types";
|
|
36
|
+
import { TouchableWithoutFeedback } from "react-native";
|
|
37
|
+
import { hexToRgb } from "@gympass/yoga-common";
|
|
38
|
+
import RadioGroupContext from "../../RadioGroupContext";
|
|
39
|
+
const RadioMark = styled.View(
|
|
40
|
+
({
|
|
41
|
+
theme: {
|
|
42
|
+
yoga: {
|
|
43
|
+
colors: { white },
|
|
44
|
+
components: { radiogroup }
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
checked,
|
|
48
|
+
disabled,
|
|
49
|
+
pressed
|
|
50
|
+
}) => `
|
|
51
|
+
justify-content: center;
|
|
52
|
+
align-items: center;
|
|
53
|
+
|
|
54
|
+
height: ${radiogroup.radio.size}px;
|
|
55
|
+
width: ${radiogroup.radio.size}px;
|
|
56
|
+
|
|
57
|
+
background-color: ${pressed ? hexToRgb(radiogroup.hover.backgroundColor, 0.75) : white};
|
|
58
|
+
|
|
59
|
+
border-width: ${radiogroup.radio.size * 0.1}px;
|
|
60
|
+
border-style: solid;
|
|
61
|
+
border-color: ${radiogroup.radio.backgroundColor};
|
|
62
|
+
border-radius: ${radiogroup.radio.border.radius}px;
|
|
63
|
+
|
|
64
|
+
${checked ? `
|
|
65
|
+
border-color: ${radiogroup.checked.backgroundColor};
|
|
66
|
+
background-color: ${pressed ? hexToRgb(radiogroup.checked.hover.backgroundColor, 0.75) : white}
|
|
67
|
+
` : ``}
|
|
68
|
+
|
|
69
|
+
${disabled ? `
|
|
70
|
+
border-color: ${radiogroup.disabled.backgroundColor};
|
|
71
|
+
` : ``}
|
|
72
|
+
`
|
|
73
|
+
);
|
|
74
|
+
const Dot = styled.View(
|
|
75
|
+
({
|
|
76
|
+
theme: {
|
|
77
|
+
yoga: {
|
|
78
|
+
components: { radiogroup }
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
checked,
|
|
82
|
+
disabled
|
|
83
|
+
}) => `
|
|
84
|
+
height: ${radiogroup.radio.size * 0.5}px;
|
|
85
|
+
width: ${radiogroup.radio.size * 0.5}px;
|
|
86
|
+
|
|
87
|
+
background-color: ${radiogroup.radio.backgroundColor};
|
|
88
|
+
border-radius: ${radiogroup.radio.border.radius}px;
|
|
89
|
+
|
|
90
|
+
${checked ? `
|
|
91
|
+
background-color: ${radiogroup.checked.backgroundColor};
|
|
92
|
+
` : ``}
|
|
93
|
+
|
|
94
|
+
${disabled ? `
|
|
95
|
+
background-color: ${radiogroup.disabled.backgroundColor};
|
|
96
|
+
` : ``}
|
|
97
|
+
`
|
|
98
|
+
);
|
|
99
|
+
const Shadow = styled.View(
|
|
100
|
+
({
|
|
101
|
+
checked,
|
|
102
|
+
theme: {
|
|
103
|
+
yoga: {
|
|
104
|
+
components: { radiogroup }
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}) => `
|
|
108
|
+
position: absolute;
|
|
109
|
+
height: ${radiogroup.radio.size + radiogroup.radio.size * 0.4 * 2}px;
|
|
110
|
+
width: ${radiogroup.radio.size + radiogroup.radio.size * 0.4 * 2}px;
|
|
111
|
+
|
|
112
|
+
border-width: ${radiogroup.radio.size * 0.4}px;
|
|
113
|
+
border-style: solid;
|
|
114
|
+
border-color: ${checked ? hexToRgb(radiogroup.checked.hover.backgroundColor, 0.75) : hexToRgb(radiogroup.hover.backgroundColor, 0.75)};
|
|
115
|
+
border-radius: ${radiogroup.radio.border.radius}px;
|
|
116
|
+
|
|
117
|
+
opacity: 0.75;
|
|
118
|
+
`
|
|
119
|
+
);
|
|
120
|
+
const RadioGroupRadio = React.forwardRef(
|
|
121
|
+
(_a, ref) => {
|
|
122
|
+
var _b = _a, { value, disabled } = _b, rest = __objRest(_b, ["value", "disabled"]);
|
|
123
|
+
const _a2 = useContext(RadioGroupContext), { onChange, small, selectedValue } = _a2, context = __objRest(_a2, ["onChange", "small", "selectedValue"]);
|
|
124
|
+
const [pressing, togglePressing] = useState(false);
|
|
125
|
+
const inputValue = value;
|
|
126
|
+
const checked = inputValue === selectedValue;
|
|
127
|
+
return /* @__PURE__ */ jsx(
|
|
128
|
+
TouchableWithoutFeedback,
|
|
129
|
+
__spreadProps(__spreadValues({
|
|
130
|
+
onPressIn: () => {
|
|
131
|
+
togglePressing(true);
|
|
132
|
+
},
|
|
133
|
+
onPress: () => {
|
|
134
|
+
onChange({ value: inputValue });
|
|
135
|
+
},
|
|
136
|
+
onPressOut: () => {
|
|
137
|
+
togglePressing(false);
|
|
138
|
+
},
|
|
139
|
+
disabled
|
|
140
|
+
}, context), {
|
|
141
|
+
children: /* @__PURE__ */ jsxs(
|
|
142
|
+
RadioMark,
|
|
143
|
+
__spreadProps(__spreadValues({
|
|
144
|
+
checked,
|
|
145
|
+
disabled,
|
|
146
|
+
pressed: pressing,
|
|
147
|
+
ref
|
|
148
|
+
}, rest), {
|
|
149
|
+
children: [
|
|
150
|
+
checked && /* @__PURE__ */ jsx(Dot, { checked, disabled }),
|
|
151
|
+
pressing && /* @__PURE__ */ jsx(Shadow, { checked })
|
|
152
|
+
]
|
|
153
|
+
})
|
|
154
|
+
)
|
|
155
|
+
})
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
RadioGroupRadio.displayName = "RadioGroup.Radio";
|
|
160
|
+
RadioGroupRadio.propTypes = {
|
|
161
|
+
disabled: bool,
|
|
162
|
+
value: oneOfType([string, number])
|
|
163
|
+
};
|
|
164
|
+
RadioGroupRadio.defaultProps = {
|
|
165
|
+
disabled: false,
|
|
166
|
+
value: ""
|
|
167
|
+
};
|
|
168
|
+
var Radio_default = RadioGroupRadio;
|
|
169
|
+
export {
|
|
170
|
+
Radio_default as default
|
|
171
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { render, fireEvent } from "@testing-library/react-native";
|
|
4
|
+
import RadioGroup from "../..";
|
|
5
|
+
import ThemeProvider from "../../../Theme";
|
|
6
|
+
import RadioGroupContext from "../../RadioGroupContext";
|
|
7
|
+
describe("<RadioGroup />", () => {
|
|
8
|
+
describe("<RadioGroup.Radio />", () => {
|
|
9
|
+
describe("Snapshots", () => {
|
|
10
|
+
it("should match snapshot with default radio", () => {
|
|
11
|
+
const { root, toJSON } = render(
|
|
12
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(RadioGroup.Radio, {}) })
|
|
13
|
+
);
|
|
14
|
+
expect(toJSON(root)).toMatchSnapshot();
|
|
15
|
+
});
|
|
16
|
+
it("should match snapshot with disabled radio", () => {
|
|
17
|
+
const { root, toJSON } = render(
|
|
18
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(RadioGroup.Radio, { disabled: true }) })
|
|
19
|
+
);
|
|
20
|
+
expect(toJSON(root)).toMatchSnapshot();
|
|
21
|
+
});
|
|
22
|
+
it("should match snapshot with default radio", () => {
|
|
23
|
+
const { root, toJSON } = render(
|
|
24
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(RadioGroup.Radio, {}) })
|
|
25
|
+
);
|
|
26
|
+
expect(toJSON(root)).toMatchSnapshot();
|
|
27
|
+
});
|
|
28
|
+
it("should match snapshot with default radio pressed", () => {
|
|
29
|
+
const onChangeMock = jest.fn();
|
|
30
|
+
const { root, getByTestId, toJSON } = render(
|
|
31
|
+
/* @__PURE__ */ jsx(RadioGroupContext.Provider, { value: { onChange: onChangeMock }, children: /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(RadioGroup.Radio, { testID: "radio" }) }) })
|
|
32
|
+
);
|
|
33
|
+
const radio = getByTestId(/^radio/);
|
|
34
|
+
fireEvent.press(radio);
|
|
35
|
+
expect(toJSON(root)).toMatchSnapshot();
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
describe("Props", () => {
|
|
39
|
+
it("checked should be the selectedValue provided from Context", () => {
|
|
40
|
+
const { getAllByTestId } = render(
|
|
41
|
+
/* @__PURE__ */ jsx(RadioGroupContext.Provider, { value: { selectedValue: "Radio 2" }, children: /* @__PURE__ */ jsxs(ThemeProvider, { children: [
|
|
42
|
+
/* @__PURE__ */ jsx(RadioGroup.Radio, { testID: "radio", value: "Radio 1" }),
|
|
43
|
+
/* @__PURE__ */ jsx(RadioGroup.Radio, { testID: "radio", value: "Radio 2" })
|
|
44
|
+
] }) })
|
|
45
|
+
);
|
|
46
|
+
const [radio, radio2] = getAllByTestId(/^radio/);
|
|
47
|
+
expect(radio.props.checked).toBe(false);
|
|
48
|
+
expect(radio2.props.checked).toBe(true);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
describe("Events", () => {
|
|
52
|
+
it("should call onchange from Context", () => {
|
|
53
|
+
const onChangeMock = jest.fn();
|
|
54
|
+
const { getByTestId } = render(
|
|
55
|
+
/* @__PURE__ */ jsx(RadioGroupContext.Provider, { value: { onChange: onChangeMock }, children: /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(RadioGroup.Radio, { testID: "radio" }) }) })
|
|
56
|
+
);
|
|
57
|
+
const radio = getByTestId(/^radio/);
|
|
58
|
+
fireEvent.press(radio);
|
|
59
|
+
expect(onChangeMock).toHaveBeenCalled();
|
|
60
|
+
});
|
|
61
|
+
it("value should be as prop value", () => {
|
|
62
|
+
const onChangeMock = jest.fn();
|
|
63
|
+
const { getByTestId } = render(
|
|
64
|
+
/* @__PURE__ */ jsx(RadioGroupContext.Provider, { value: { onChange: onChangeMock }, children: /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(RadioGroup.Radio, { value: "radio1", testID: "radio" }) }) })
|
|
65
|
+
);
|
|
66
|
+
const radio = getByTestId(/^radio/);
|
|
67
|
+
fireEvent.press(radio);
|
|
68
|
+
expect(onChangeMock).toHaveBeenCalledWith({
|
|
69
|
+
value: "radio1"
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
});
|
|
@@ -0,0 +1,107 @@
|
|
|
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, { useState } from "react";
|
|
34
|
+
import { View } from "react-native";
|
|
35
|
+
import { string, func, oneOfType, number, bool, node } from "prop-types";
|
|
36
|
+
import styled from "styled-components";
|
|
37
|
+
import RadioGroupContext from "../RadioGroupContext";
|
|
38
|
+
import RadioButton from "./Button/RadioButton";
|
|
39
|
+
const Group = styled.View(
|
|
40
|
+
() => `
|
|
41
|
+
align-self: center;
|
|
42
|
+
position: relative;
|
|
43
|
+
flex-direction: row;
|
|
44
|
+
`
|
|
45
|
+
);
|
|
46
|
+
const GrayLine = styled.View(
|
|
47
|
+
({
|
|
48
|
+
theme: {
|
|
49
|
+
yoga: {
|
|
50
|
+
components: { radiogroup }
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}) => `
|
|
54
|
+
position: absolute;
|
|
55
|
+
height: 100%;
|
|
56
|
+
border-radius: ${radiogroup.button.border.radius}px;
|
|
57
|
+
border-width: ${radiogroup.button.border.width}px;
|
|
58
|
+
border-color: ${radiogroup.button.border.color};
|
|
59
|
+
`
|
|
60
|
+
);
|
|
61
|
+
const RadioGroup = (_a) => {
|
|
62
|
+
var _b = _a, { onChange, selectedValue, small, children } = _b, rest = __objRest(_b, ["onChange", "selectedValue", "small", "children"]);
|
|
63
|
+
const [groupSize, setGroupSize] = useState(0);
|
|
64
|
+
const isButton = React.Children.map(children, (child) => child.type).every(
|
|
65
|
+
(child) => child === RadioButton
|
|
66
|
+
);
|
|
67
|
+
return /* @__PURE__ */ jsx(
|
|
68
|
+
RadioGroupContext.Provider,
|
|
69
|
+
{
|
|
70
|
+
value: __spreadValues({
|
|
71
|
+
selectedValue,
|
|
72
|
+
onChange,
|
|
73
|
+
small
|
|
74
|
+
}, rest),
|
|
75
|
+
children: /* @__PURE__ */ jsx(View, { children: /* @__PURE__ */ jsxs(
|
|
76
|
+
Group,
|
|
77
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
78
|
+
onLayout: ({
|
|
79
|
+
nativeEvent: {
|
|
80
|
+
layout: { width }
|
|
81
|
+
}
|
|
82
|
+
}) => setGroupSize(width),
|
|
83
|
+
children: [
|
|
84
|
+
Boolean(isButton && groupSize) && /* @__PURE__ */ jsx(GrayLine, { style: { width: groupSize } }),
|
|
85
|
+
children
|
|
86
|
+
]
|
|
87
|
+
})
|
|
88
|
+
) })
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
};
|
|
92
|
+
RadioGroup.propTypes = {
|
|
93
|
+
onChange: func,
|
|
94
|
+
selectedValue: oneOfType([string, number]),
|
|
95
|
+
small: bool,
|
|
96
|
+
children: node.isRequired
|
|
97
|
+
};
|
|
98
|
+
RadioGroup.defaultProps = {
|
|
99
|
+
onChange: () => {
|
|
100
|
+
},
|
|
101
|
+
selectedValue: "",
|
|
102
|
+
small: false
|
|
103
|
+
};
|
|
104
|
+
var RadioGroup_default = RadioGroup;
|
|
105
|
+
export {
|
|
106
|
+
RadioGroup_default as default
|
|
107
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { render, fireEvent } from "@testing-library/react-native";
|
|
4
|
+
import RadioGroup from "..";
|
|
5
|
+
import ThemeProvider from "../../Theme";
|
|
6
|
+
describe("<RadioGroup />", () => {
|
|
7
|
+
describe("Snapshots", () => {
|
|
8
|
+
it("should match snapshot with radio button as children", () => {
|
|
9
|
+
const { root, getAllByText, toJSON } = render(
|
|
10
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsxs(RadioGroup, { children: [
|
|
11
|
+
/* @__PURE__ */ jsx(RadioGroup.Button, { children: "Option 1" }),
|
|
12
|
+
/* @__PURE__ */ jsx(RadioGroup.Button, { children: "Option 2" }),
|
|
13
|
+
/* @__PURE__ */ jsx(RadioGroup.Button, { children: "Option 3" })
|
|
14
|
+
] }) })
|
|
15
|
+
);
|
|
16
|
+
expect(toJSON(root)).toMatchSnapshot();
|
|
17
|
+
expect(getAllByText(/^Option/)).toHaveLength(3);
|
|
18
|
+
});
|
|
19
|
+
it("should match snapshot with small radios", () => {
|
|
20
|
+
const { root, toJSON } = render(
|
|
21
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsxs(RadioGroup, { small: true, children: [
|
|
22
|
+
/* @__PURE__ */ jsx(RadioGroup.Button, { children: "Option 1" }),
|
|
23
|
+
/* @__PURE__ */ jsx(RadioGroup.Button, { children: "Option 2" }),
|
|
24
|
+
/* @__PURE__ */ jsx(RadioGroup.Button, { children: "Option 3" })
|
|
25
|
+
] }) })
|
|
26
|
+
);
|
|
27
|
+
expect(toJSON(root)).toMatchSnapshot();
|
|
28
|
+
});
|
|
29
|
+
it("should has setted the selected value", () => {
|
|
30
|
+
const { toJSON, getByText } = render(
|
|
31
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsxs(RadioGroup, { selectedValue: "Option 2", children: [
|
|
32
|
+
/* @__PURE__ */ jsx(RadioGroup.Button, { children: "Option 1" }),
|
|
33
|
+
/* @__PURE__ */ jsx(RadioGroup.Button, { children: "Option 2" }),
|
|
34
|
+
/* @__PURE__ */ jsx(RadioGroup.Button, { children: "Option 3" })
|
|
35
|
+
] }) })
|
|
36
|
+
);
|
|
37
|
+
expect(toJSON()).toMatchSnapshot();
|
|
38
|
+
expect(getByText("Option 2").props.checked).toBe(true);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
describe("Events", () => {
|
|
43
|
+
it("should set the onchange for its children", () => {
|
|
44
|
+
const onChangeMock = jest.fn();
|
|
45
|
+
const { getByText } = render(
|
|
46
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsxs(RadioGroup, { onChange: onChangeMock, children: [
|
|
47
|
+
/* @__PURE__ */ jsx(RadioGroup.Button, { children: "Option 1" }),
|
|
48
|
+
/* @__PURE__ */ jsx(RadioGroup.Button, { children: "Option 2" }),
|
|
49
|
+
/* @__PURE__ */ jsx(RadioGroup.Button, { children: "Option 3" })
|
|
50
|
+
] }) })
|
|
51
|
+
);
|
|
52
|
+
const firstOption = getByText("Option 1");
|
|
53
|
+
fireEvent.press(firstOption);
|
|
54
|
+
expect(onChangeMock).toHaveBeenCalled();
|
|
55
|
+
});
|
|
56
|
+
});
|