@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,246 @@
|
|
|
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, {
|
|
34
|
+
forwardRef,
|
|
35
|
+
useEffect,
|
|
36
|
+
useImperativeHandle,
|
|
37
|
+
useRef,
|
|
38
|
+
useState
|
|
39
|
+
} from "react";
|
|
40
|
+
import styled from "styled-components";
|
|
41
|
+
import { string, oneOf, func, elementType, number } from "prop-types";
|
|
42
|
+
import { PanResponder } from "react-native";
|
|
43
|
+
import Box from "../../Box";
|
|
44
|
+
import Button from "../../Button";
|
|
45
|
+
import Icon from "../../Icon";
|
|
46
|
+
import Text from "../../Text";
|
|
47
|
+
import SnackbarAnimationWrapper from "./SnackbarAnimationWrapper";
|
|
48
|
+
const SWIPE_THRESHOLD = 32;
|
|
49
|
+
const SnackbarContainer = styled.View`
|
|
50
|
+
${({
|
|
51
|
+
bottomOffset,
|
|
52
|
+
variant,
|
|
53
|
+
theme: {
|
|
54
|
+
yoga: {
|
|
55
|
+
colors: { feedback },
|
|
56
|
+
components: {
|
|
57
|
+
snackbar: {
|
|
58
|
+
padding,
|
|
59
|
+
margin,
|
|
60
|
+
variant: {
|
|
61
|
+
color: { [variant]: backgroundColor = feedback.success.light }
|
|
62
|
+
},
|
|
63
|
+
border
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}) => `
|
|
69
|
+
padding: ${padding.vertical}px ${padding.horizontal}px;
|
|
70
|
+
margin-horizontal: ${margin.horizontal}px
|
|
71
|
+
margin-bottom: ${margin.bottom + bottomOffset}px;
|
|
72
|
+
background-color: ${backgroundColor};
|
|
73
|
+
border-radius: ${border.radius}px;
|
|
74
|
+
flex-direction: row;
|
|
75
|
+
align-items: center;
|
|
76
|
+
`}
|
|
77
|
+
`;
|
|
78
|
+
const Snackbar = forwardRef((props, ref) => {
|
|
79
|
+
const _a = props, {
|
|
80
|
+
icon,
|
|
81
|
+
message,
|
|
82
|
+
actionLabel,
|
|
83
|
+
onAction,
|
|
84
|
+
variant,
|
|
85
|
+
onSnackbarClose,
|
|
86
|
+
duration,
|
|
87
|
+
bottomOffset
|
|
88
|
+
} = _a, rest = __objRest(_a, [
|
|
89
|
+
"icon",
|
|
90
|
+
"message",
|
|
91
|
+
"actionLabel",
|
|
92
|
+
"onAction",
|
|
93
|
+
"variant",
|
|
94
|
+
"onSnackbarClose",
|
|
95
|
+
"duration",
|
|
96
|
+
"bottomOffset"
|
|
97
|
+
]);
|
|
98
|
+
const wrapperRef = useRef();
|
|
99
|
+
const [currentProps, setCurrentProps] = useState({
|
|
100
|
+
icon,
|
|
101
|
+
message,
|
|
102
|
+
actionLabel,
|
|
103
|
+
onAction,
|
|
104
|
+
variant
|
|
105
|
+
});
|
|
106
|
+
useImperativeHandle(ref, () => ({
|
|
107
|
+
open: () => {
|
|
108
|
+
wrapperRef.current.open();
|
|
109
|
+
},
|
|
110
|
+
close: () => {
|
|
111
|
+
wrapperRef.current.close();
|
|
112
|
+
}
|
|
113
|
+
}));
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
if (wrapperRef.current && currentProps.message) {
|
|
116
|
+
wrapperRef.current.close(() => {
|
|
117
|
+
setCurrentProps({
|
|
118
|
+
icon,
|
|
119
|
+
message,
|
|
120
|
+
actionLabel,
|
|
121
|
+
onAction,
|
|
122
|
+
variant
|
|
123
|
+
});
|
|
124
|
+
wrapperRef.current.open();
|
|
125
|
+
});
|
|
126
|
+
} else {
|
|
127
|
+
setCurrentProps({
|
|
128
|
+
icon,
|
|
129
|
+
message,
|
|
130
|
+
actionLabel,
|
|
131
|
+
onAction,
|
|
132
|
+
variant
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}, [icon, message, actionLabel, onAction, variant]);
|
|
136
|
+
const handlePanResponderRelease = (_evt, gestureState) => {
|
|
137
|
+
if (gestureState.dy > SWIPE_THRESHOLD) {
|
|
138
|
+
wrapperRef.current.close();
|
|
139
|
+
} else {
|
|
140
|
+
wrapperRef.current.open();
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
const panResponder = PanResponder.create({
|
|
144
|
+
onPanResponderMove: (_, gestureState) => {
|
|
145
|
+
if (gestureState.dy > 0) {
|
|
146
|
+
wrapperRef.current.translateY(gestureState.dy);
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
onPanResponderRelease: handlePanResponderRelease,
|
|
150
|
+
onPanResponderTerminate: handlePanResponderRelease,
|
|
151
|
+
onStartShouldSetPanResponder: () => true,
|
|
152
|
+
onMoveShouldSetPanResponder: (_, gestureState) => {
|
|
153
|
+
return !(gestureState.dy <= 2 && gestureState.dy >= -2);
|
|
154
|
+
},
|
|
155
|
+
onMoveShouldSetPanResponderCapture: () => true,
|
|
156
|
+
onPanResponderTerminationRequest: () => true,
|
|
157
|
+
onShouldBlockNativeResponder: () => true
|
|
158
|
+
});
|
|
159
|
+
const handleOnAction = () => {
|
|
160
|
+
wrapperRef.current.close();
|
|
161
|
+
if (currentProps.onAction) {
|
|
162
|
+
currentProps.onAction();
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
return /* @__PURE__ */ jsx(
|
|
166
|
+
SnackbarAnimationWrapper,
|
|
167
|
+
{
|
|
168
|
+
onSnackbarClose,
|
|
169
|
+
duration,
|
|
170
|
+
ref: wrapperRef,
|
|
171
|
+
children: /* @__PURE__ */ jsxs(
|
|
172
|
+
SnackbarContainer,
|
|
173
|
+
__spreadProps(__spreadValues(__spreadValues({
|
|
174
|
+
variant: currentProps.variant,
|
|
175
|
+
bottomOffset
|
|
176
|
+
}, rest), panResponder.panHandlers), {
|
|
177
|
+
children: [
|
|
178
|
+
currentProps.icon && /* @__PURE__ */ jsx(
|
|
179
|
+
Icon,
|
|
180
|
+
{
|
|
181
|
+
as: currentProps.icon,
|
|
182
|
+
fill: "secondary",
|
|
183
|
+
size: "large",
|
|
184
|
+
marginRight: "xxsmall"
|
|
185
|
+
}
|
|
186
|
+
),
|
|
187
|
+
/* @__PURE__ */ jsx(
|
|
188
|
+
Text,
|
|
189
|
+
{
|
|
190
|
+
flex: 1,
|
|
191
|
+
fontSize: "small",
|
|
192
|
+
marginTop: "xxxsmall",
|
|
193
|
+
marginBottom: "xxxsmall",
|
|
194
|
+
numberOfLines: 2,
|
|
195
|
+
children: currentProps.message
|
|
196
|
+
}
|
|
197
|
+
),
|
|
198
|
+
currentProps.actionLabel && /* @__PURE__ */ jsx(
|
|
199
|
+
Box,
|
|
200
|
+
{
|
|
201
|
+
as: Button.Text,
|
|
202
|
+
small: true,
|
|
203
|
+
secondary: true,
|
|
204
|
+
marginLeft: "xxsmall",
|
|
205
|
+
onPress: handleOnAction,
|
|
206
|
+
children: currentProps.actionLabel
|
|
207
|
+
}
|
|
208
|
+
)
|
|
209
|
+
]
|
|
210
|
+
})
|
|
211
|
+
)
|
|
212
|
+
}
|
|
213
|
+
);
|
|
214
|
+
});
|
|
215
|
+
Snackbar.propTypes = {
|
|
216
|
+
/** The style variant change the color of the component, it may be "success", "informative" or "attention". */
|
|
217
|
+
variant: oneOf(["success", "informative", "attention"]),
|
|
218
|
+
/** Can be any icon of yoga-icons. */
|
|
219
|
+
icon: elementType,
|
|
220
|
+
/** The message shown when snackbar is opened. The maximum number of lines is two. */
|
|
221
|
+
message: string,
|
|
222
|
+
/** Label for a custom action. */
|
|
223
|
+
actionLabel: string,
|
|
224
|
+
/** Function for the custom action. The `actionLabel` becomes required when passing this function. */
|
|
225
|
+
onAction: func,
|
|
226
|
+
/** Callback function triggered by the Snackbar close action. Can be used for events, for example. */
|
|
227
|
+
onSnackbarClose: func,
|
|
228
|
+
/** The duration sets how long it will take to close snackbar automatically, it may be "fast" (4 seconds), "default" (8 seconds), "slow" (10 seconds) or "indefinite" (it doesn't close automatically). */
|
|
229
|
+
duration: oneOf(["fast", "default", "slow", "indefinite"]),
|
|
230
|
+
/** Add extra margin to Snackbar. Can be useful for SafeAreaView or button cases. */
|
|
231
|
+
bottomOffset: number
|
|
232
|
+
};
|
|
233
|
+
Snackbar.defaultProps = {
|
|
234
|
+
variant: "success",
|
|
235
|
+
icon: void 0,
|
|
236
|
+
message: "",
|
|
237
|
+
actionLabel: void 0,
|
|
238
|
+
onAction: void 0,
|
|
239
|
+
onSnackbarClose: void 0,
|
|
240
|
+
duration: "default",
|
|
241
|
+
bottomOffset: 0
|
|
242
|
+
};
|
|
243
|
+
var Snackbar_default = Snackbar;
|
|
244
|
+
export {
|
|
245
|
+
Snackbar_default as default
|
|
246
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
+
import React, { useRef } from "react";
|
|
19
|
+
import { render, fireEvent } from "@testing-library/react-native";
|
|
20
|
+
import * as RN from "react-native";
|
|
21
|
+
import { CheckedFull } from "@gympass/yoga-icons";
|
|
22
|
+
import { ThemeProvider, Snackbar } from "../..";
|
|
23
|
+
import Button from "../../Button";
|
|
24
|
+
RN.Animated.spring = jest.fn().mockReturnValue({
|
|
25
|
+
start: jest.fn()
|
|
26
|
+
});
|
|
27
|
+
const Component = (overrideProps) => {
|
|
28
|
+
const snackbarRef = useRef();
|
|
29
|
+
return /* @__PURE__ */ jsxs(ThemeProvider, { children: [
|
|
30
|
+
/* @__PURE__ */ jsx(
|
|
31
|
+
Button,
|
|
32
|
+
{
|
|
33
|
+
full: true,
|
|
34
|
+
small: true,
|
|
35
|
+
onPress: () => {
|
|
36
|
+
snackbarRef.current.open();
|
|
37
|
+
},
|
|
38
|
+
children: "Tap to open snackbar"
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
/* @__PURE__ */ jsx(
|
|
42
|
+
Snackbar,
|
|
43
|
+
__spreadValues({
|
|
44
|
+
ref: snackbarRef,
|
|
45
|
+
message: "Feedback Message"
|
|
46
|
+
}, overrideProps)
|
|
47
|
+
)
|
|
48
|
+
] });
|
|
49
|
+
};
|
|
50
|
+
describe("<Snackbar />", () => {
|
|
51
|
+
it("should match snapshot when snackbar is default", () => {
|
|
52
|
+
const { toJSON } = render(/* @__PURE__ */ jsx(Component, {}));
|
|
53
|
+
expect(toJSON()).toMatchSnapshot();
|
|
54
|
+
});
|
|
55
|
+
it("should match snapshot when have an icon and action", () => {
|
|
56
|
+
const overrideProps = {
|
|
57
|
+
icon: CheckedFull,
|
|
58
|
+
actionLabel: "Action",
|
|
59
|
+
onAction: () => {
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const { toJSON } = render(/* @__PURE__ */ jsx(Component, __spreadValues({}, overrideProps)));
|
|
63
|
+
expect(toJSON()).toMatchSnapshot();
|
|
64
|
+
});
|
|
65
|
+
it("should match snapshot when have a long text", () => {
|
|
66
|
+
const overrideProps = {
|
|
67
|
+
message: "Lorem Ipsum is simply dummy text of the printing and types.",
|
|
68
|
+
icon: CheckedFull,
|
|
69
|
+
actionLabel: "Action",
|
|
70
|
+
onAction: () => {
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const { toJSON } = render(/* @__PURE__ */ jsx(Component, __spreadValues({}, overrideProps)));
|
|
74
|
+
expect(toJSON()).toMatchSnapshot();
|
|
75
|
+
});
|
|
76
|
+
it("should match snapshot when have a variant informative or attention prop", () => {
|
|
77
|
+
const overrideProps = {
|
|
78
|
+
variant: "informative"
|
|
79
|
+
};
|
|
80
|
+
const { toJSON } = render(/* @__PURE__ */ jsx(Component, __spreadValues({}, overrideProps)));
|
|
81
|
+
expect(toJSON()).toMatchSnapshot();
|
|
82
|
+
});
|
|
83
|
+
it("should show and hide snackbar when the open and close Animation function is called", () => {
|
|
84
|
+
const overrideProps = {
|
|
85
|
+
onSnackbarClose: jest.fn(),
|
|
86
|
+
actionLabel: "Action",
|
|
87
|
+
onAction: jest.fn()
|
|
88
|
+
};
|
|
89
|
+
const { getByText, getByTestId } = render(/* @__PURE__ */ jsx(Component, __spreadValues({}, overrideProps)));
|
|
90
|
+
fireEvent(getByTestId("wrapper"), "layout", {
|
|
91
|
+
nativeEvent: {
|
|
92
|
+
layout: { height: 200 }
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
fireEvent.press(getByText("Tap to open snackbar"));
|
|
96
|
+
expect(RN.Animated.spring.mock.calls[0][1]).toEqual({
|
|
97
|
+
toValue: 0,
|
|
98
|
+
bounciness: 0,
|
|
99
|
+
useNativeDriver: true
|
|
100
|
+
});
|
|
101
|
+
fireEvent.press(getByText("Action"));
|
|
102
|
+
expect(RN.Animated.spring.mock.calls[1][1]).toEqual({
|
|
103
|
+
toValue: 200,
|
|
104
|
+
bounciness: 0,
|
|
105
|
+
useNativeDriver: true
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
});
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import React, {
|
|
3
|
+
forwardRef,
|
|
4
|
+
useEffect,
|
|
5
|
+
useImperativeHandle,
|
|
6
|
+
useRef,
|
|
7
|
+
useState
|
|
8
|
+
} from "react";
|
|
9
|
+
import { Animated, useWindowDimensions, View } from "react-native";
|
|
10
|
+
import { func, node, oneOf } from "prop-types";
|
|
11
|
+
import styled from "styled-components";
|
|
12
|
+
const durationDictionary = {
|
|
13
|
+
fast: 4e3,
|
|
14
|
+
default: 8e3,
|
|
15
|
+
slow: 1e4,
|
|
16
|
+
indefinite: -1
|
|
17
|
+
};
|
|
18
|
+
const Wrapper = styled(Animated.View)(
|
|
19
|
+
() => `
|
|
20
|
+
position: absolute;
|
|
21
|
+
width: 100%;
|
|
22
|
+
bottom: 0px;
|
|
23
|
+
`
|
|
24
|
+
);
|
|
25
|
+
const SnackbarAnimationWrapper = forwardRef(
|
|
26
|
+
({ onSnackbarClose, children, duration }, ref) => {
|
|
27
|
+
const { height: windowHeight } = useWindowDimensions();
|
|
28
|
+
const [childrenHeight, setChildrenHeight] = useState();
|
|
29
|
+
const translateY = useRef(new Animated.Value(windowHeight)).current;
|
|
30
|
+
const timeoutRef = useRef();
|
|
31
|
+
const childrenRef = useRef();
|
|
32
|
+
const openAnimation = () => {
|
|
33
|
+
Animated.spring(translateY, {
|
|
34
|
+
toValue: 0,
|
|
35
|
+
bounciness: 0,
|
|
36
|
+
useNativeDriver: true
|
|
37
|
+
}).start();
|
|
38
|
+
};
|
|
39
|
+
const closeAnimation = (callback) => {
|
|
40
|
+
if (childrenHeight) {
|
|
41
|
+
Animated.spring(translateY, {
|
|
42
|
+
toValue: childrenHeight,
|
|
43
|
+
bounciness: 0,
|
|
44
|
+
useNativeDriver: true
|
|
45
|
+
}).start(({ finished }) => {
|
|
46
|
+
if (finished && callback) {
|
|
47
|
+
callback();
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
if (onSnackbarClose) {
|
|
51
|
+
onSnackbarClose();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const setupSnackbarTimeout = () => {
|
|
56
|
+
const timeoutDuration = durationDictionary[duration];
|
|
57
|
+
const shouldCloseOnTimer = childrenHeight && timeoutDuration > 0;
|
|
58
|
+
if (shouldCloseOnTimer) {
|
|
59
|
+
timeoutRef.current = setTimeout(() => {
|
|
60
|
+
clearTimeout(timeoutRef.current);
|
|
61
|
+
closeAnimation();
|
|
62
|
+
}, timeoutDuration);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const openSnackbar = () => {
|
|
66
|
+
openAnimation();
|
|
67
|
+
setupSnackbarTimeout();
|
|
68
|
+
};
|
|
69
|
+
const closeSnackbar = (callback) => {
|
|
70
|
+
clearTimeout(timeoutRef.current);
|
|
71
|
+
closeAnimation(callback);
|
|
72
|
+
};
|
|
73
|
+
useImperativeHandle(ref, () => ({
|
|
74
|
+
open: () => {
|
|
75
|
+
openSnackbar();
|
|
76
|
+
},
|
|
77
|
+
close: (callback) => {
|
|
78
|
+
closeSnackbar(callback);
|
|
79
|
+
},
|
|
80
|
+
translateY: (dy) => {
|
|
81
|
+
translateY.setValue(dy);
|
|
82
|
+
}
|
|
83
|
+
}));
|
|
84
|
+
useEffect(() => () => clearTimeout(timeoutRef.current), []);
|
|
85
|
+
return /* @__PURE__ */ jsx(Wrapper, { style: { zIndex: 10, transform: [{ translateY }] }, children: /* @__PURE__ */ jsx(
|
|
86
|
+
View,
|
|
87
|
+
{
|
|
88
|
+
testID: "wrapper",
|
|
89
|
+
ref: childrenRef,
|
|
90
|
+
onLayout: ({
|
|
91
|
+
nativeEvent: {
|
|
92
|
+
layout: { height }
|
|
93
|
+
}
|
|
94
|
+
}) => {
|
|
95
|
+
setChildrenHeight(height);
|
|
96
|
+
translateY.setValue(height);
|
|
97
|
+
},
|
|
98
|
+
children
|
|
99
|
+
}
|
|
100
|
+
) });
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
SnackbarAnimationWrapper.propTypes = {
|
|
104
|
+
onSnackbarClose: func,
|
|
105
|
+
children: node.isRequired,
|
|
106
|
+
duration: oneOf(["fast", "default", "slow", "indefinite"]).isRequired
|
|
107
|
+
};
|
|
108
|
+
SnackbarAnimationWrapper.defaultProps = {
|
|
109
|
+
onSnackbarClose: void 0
|
|
110
|
+
};
|
|
111
|
+
var SnackbarAnimationWrapper_default = SnackbarAnimationWrapper;
|
|
112
|
+
export {
|
|
113
|
+
SnackbarAnimationWrapper_default as default
|
|
114
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const Stepper = ({ colors, spacing, fontSizes, fontWeights, radii }) => ({
|
|
2
|
+
padding: {
|
|
3
|
+
left: spacing.xxlarge,
|
|
4
|
+
right: spacing.xxlarge
|
|
5
|
+
},
|
|
6
|
+
line: {
|
|
7
|
+
backgroundColor: {
|
|
8
|
+
active: colors.primary,
|
|
9
|
+
inactive: colors.elements.backgroundAndDisabled,
|
|
10
|
+
secondary: colors.medium
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
dot: {
|
|
14
|
+
radius: radii.circle,
|
|
15
|
+
backgroundColor: {
|
|
16
|
+
active: colors.primary,
|
|
17
|
+
inactive: colors.elements.backgroundAndDisabled,
|
|
18
|
+
secondary: colors.medium
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
label: {
|
|
22
|
+
font: {
|
|
23
|
+
weight: fontWeights.bold,
|
|
24
|
+
size: fontSizes.xsmall
|
|
25
|
+
},
|
|
26
|
+
color: {
|
|
27
|
+
active: colors.primary,
|
|
28
|
+
inactive: colors.elements.selectionAndIcons,
|
|
29
|
+
secondary: colors.medium
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
var Stepper_theme_default = Stepper;
|
|
34
|
+
export {
|
|
35
|
+
Stepper_theme_default as default
|
|
36
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { arrayOf, bool, number, string } from "prop-types";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import styled, { css } from "styled-components";
|
|
5
|
+
import Text from "../../Text";
|
|
6
|
+
import activeDot from "../activeDot";
|
|
7
|
+
const Wrapper = styled.View`
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
justify-content: space-between;
|
|
10
|
+
`;
|
|
11
|
+
const DotWrapper = styled.View`
|
|
12
|
+
width: 15px;
|
|
13
|
+
`;
|
|
14
|
+
const Dot = styled.View(
|
|
15
|
+
({
|
|
16
|
+
active,
|
|
17
|
+
secondary,
|
|
18
|
+
theme: {
|
|
19
|
+
yoga: {
|
|
20
|
+
components: { stepper }
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}) => {
|
|
24
|
+
const state = secondary ? "secondary" : "active";
|
|
25
|
+
return css`
|
|
26
|
+
width: 15px;
|
|
27
|
+
height: 15px;
|
|
28
|
+
margin-top: -6px;
|
|
29
|
+
|
|
30
|
+
border-radius: ${stepper.dot.radius}px;
|
|
31
|
+
background-color: ${active ? stepper.dot.backgroundColor[state] : stepper.dot.backgroundColor.inactive};
|
|
32
|
+
`;
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
const Label = styled(Text.Bold)(
|
|
36
|
+
({
|
|
37
|
+
active,
|
|
38
|
+
secondary,
|
|
39
|
+
theme: {
|
|
40
|
+
yoga: {
|
|
41
|
+
components: { stepper }
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}) => {
|
|
45
|
+
const state = secondary ? "secondary" : "active";
|
|
46
|
+
return css`
|
|
47
|
+
width: 95px;
|
|
48
|
+
margin-top: 10px;
|
|
49
|
+
margin-left: -40px;
|
|
50
|
+
color: ${active ? stepper.label.color[state] : stepper.label.color.inactive};
|
|
51
|
+
font-size: ${stepper.label.font.size}px;
|
|
52
|
+
text-align: center;
|
|
53
|
+
`;
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
function Dots({ activeStep, labels, secondary }) {
|
|
57
|
+
return /* @__PURE__ */ jsx(Wrapper, { children: labels.map((label, index) => /* @__PURE__ */ jsxs(DotWrapper, { children: [
|
|
58
|
+
/* @__PURE__ */ jsx(Dot, { active: activeDot(index, activeStep), secondary }),
|
|
59
|
+
/* @__PURE__ */ jsx(Label, { active: activeDot(index, activeStep), secondary, children: label })
|
|
60
|
+
] }, label)) });
|
|
61
|
+
}
|
|
62
|
+
Dots.propTypes = {
|
|
63
|
+
activeStep: number,
|
|
64
|
+
labels: arrayOf(string),
|
|
65
|
+
secondary: bool
|
|
66
|
+
};
|
|
67
|
+
Dots.defaultProps = {
|
|
68
|
+
activeStep: 0,
|
|
69
|
+
labels: [],
|
|
70
|
+
secondary: false
|
|
71
|
+
};
|
|
72
|
+
var Dots_default = Dots;
|
|
73
|
+
export {
|
|
74
|
+
Dots_default as default
|
|
75
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { bool, number } from "prop-types";
|
|
4
|
+
import styled from "styled-components";
|
|
5
|
+
const Wrapper = styled.View`
|
|
6
|
+
position: relative;
|
|
7
|
+
`;
|
|
8
|
+
const InactiveLine = styled.View(
|
|
9
|
+
({
|
|
10
|
+
theme: {
|
|
11
|
+
yoga: {
|
|
12
|
+
components: { stepper }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}) => `
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 4px;
|
|
18
|
+
|
|
19
|
+
position: absolute;
|
|
20
|
+
top: 0;
|
|
21
|
+
|
|
22
|
+
background-color: ${stepper.line.backgroundColor.inactive};
|
|
23
|
+
`
|
|
24
|
+
);
|
|
25
|
+
const ActiveLine = styled.View(
|
|
26
|
+
({
|
|
27
|
+
width,
|
|
28
|
+
secondary,
|
|
29
|
+
theme: {
|
|
30
|
+
yoga: {
|
|
31
|
+
components: { stepper }
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}) => `
|
|
35
|
+
position: absolute;
|
|
36
|
+
top: 0;
|
|
37
|
+
|
|
38
|
+
background-color: ${secondary ? stepper.line.backgroundColor.secondary : stepper.line.backgroundColor.active};
|
|
39
|
+
width: ${width}%;
|
|
40
|
+
height: 4px;
|
|
41
|
+
`
|
|
42
|
+
);
|
|
43
|
+
function Line({ activeStep, totalSteps, secondary }) {
|
|
44
|
+
return /* @__PURE__ */ jsxs(Wrapper, { children: [
|
|
45
|
+
/* @__PURE__ */ jsx(InactiveLine, {}),
|
|
46
|
+
/* @__PURE__ */ jsx(
|
|
47
|
+
ActiveLine,
|
|
48
|
+
{
|
|
49
|
+
width: activeStep <= 0 ? 0 : activeStep / totalSteps * 100,
|
|
50
|
+
secondary
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
] });
|
|
54
|
+
}
|
|
55
|
+
Line.propTypes = {
|
|
56
|
+
activeStep: number,
|
|
57
|
+
totalSteps: number,
|
|
58
|
+
secondary: bool
|
|
59
|
+
};
|
|
60
|
+
Line.defaultProps = {
|
|
61
|
+
activeStep: 0,
|
|
62
|
+
totalSteps: 0,
|
|
63
|
+
secondary: false
|
|
64
|
+
};
|
|
65
|
+
var Line_default = Line;
|
|
66
|
+
export {
|
|
67
|
+
Line_default as default
|
|
68
|
+
};
|