@razorpay/blade 11.39.0 → 12.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lib/native/components/Accordion/Accordion.js +2 -2
- package/build/lib/native/components/Accordion/Accordion.js.map +1 -1
- package/build/lib/native/components/Accordion/AccordionButton.native.js +8 -10
- package/build/lib/native/components/Accordion/AccordionButton.native.js.map +1 -1
- package/build/lib/native/components/Accordion/AccordionItemBody.js +7 -8
- package/build/lib/native/components/Accordion/AccordionItemBody.js.map +1 -1
- package/build/lib/native/components/Accordion/AccordionItemHeader.js +3 -8
- package/build/lib/native/components/Accordion/AccordionItemHeader.js.map +1 -1
- package/build/lib/native/components/Accordion/commonStyles.js +1 -1
- package/build/lib/native/components/Accordion/commonStyles.js.map +1 -1
- package/build/lib/native/components/ActionList/ActionList.js +1 -1
- package/build/lib/native/components/ActionList/ActionList.js.map +1 -1
- package/build/lib/native/components/ActionList/ActionListItem.js +9 -8
- package/build/lib/native/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/native/components/ActionList/ActionListNoResults.js +2 -1
- package/build/lib/native/components/ActionList/ActionListNoResults.js.map +1 -1
- package/build/lib/native/components/Alert/Alert.js +4 -3
- package/build/lib/native/components/Alert/Alert.js.map +1 -1
- package/build/lib/native/components/Amount/Amount.js +4 -2
- package/build/lib/native/components/Amount/Amount.js.map +1 -1
- package/build/lib/native/components/Badge/Badge.js +10 -9
- package/build/lib/native/components/Badge/Badge.js.map +1 -1
- package/build/lib/native/components/BaseHeaderFooter/BaseHeader.js +11 -10
- package/build/lib/native/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
- package/build/lib/native/components/BaseMenu/BaseMenuItem/BaseMenuItem.js +8 -6
- package/build/lib/native/components/BaseMenu/BaseMenuItem/BaseMenuItem.js.map +1 -1
- package/build/lib/native/components/BottomNav/BottomNav.native.js +4 -10
- package/build/lib/native/components/BottomNav/BottomNav.native.js.map +1 -1
- package/build/lib/native/components/Box/BaseBox/types/propsTypes.js.map +1 -1
- package/build/lib/native/components/Box/Box.js +1 -1
- package/build/lib/native/components/Box/Box.js.map +1 -1
- package/build/lib/native/components/Button/BaseButton/BaseButton.js +1 -1
- package/build/lib/native/components/Button/BaseButton/BaseButton.js.map +1 -1
- package/build/lib/native/components/Card/Card.js +1 -1
- package/build/lib/native/components/Card/Card.js.map +1 -1
- package/build/lib/native/components/Card/CardFooter.js +4 -8
- package/build/lib/native/components/Card/CardFooter.js.map +1 -1
- package/build/lib/native/components/Card/CardHeader.js +5 -9
- package/build/lib/native/components/Card/CardHeader.js.map +1 -1
- package/build/lib/native/components/Card/CardRoot.native.js +1 -1
- package/build/lib/native/components/Card/CardRoot.native.js.map +1 -1
- package/build/lib/native/components/Carousel/Carousel.native.js +1 -1
- package/build/lib/native/components/Carousel/Carousel.native.js.map +1 -1
- package/build/lib/native/components/Carousel/Indicators/StyledIndicatorButton.native.js +1 -1
- package/build/lib/native/components/Carousel/Indicators/StyledIndicatorButton.native.js.map +1 -1
- package/build/lib/native/components/Carousel/Indicators/getIndicatorButtonStyles.js +1 -1
- package/build/lib/native/components/Carousel/Indicators/getIndicatorButtonStyles.js.map +1 -1
- package/build/lib/native/components/Carousel/NavigationButton/getNavigationButtonStyles.js +1 -1
- package/build/lib/native/components/Carousel/NavigationButton/getNavigationButtonStyles.js.map +1 -1
- package/build/lib/native/components/Checkbox/Checkbox.js +6 -4
- package/build/lib/native/components/Checkbox/Checkbox.js.map +1 -1
- package/build/lib/native/components/Checkbox/CheckboxIcon/Fade.native.js +1 -1
- package/build/lib/native/components/Checkbox/CheckboxIcon/Fade.native.js.map +1 -1
- package/build/lib/native/components/Chip/Chip.js +5 -3
- package/build/lib/native/components/Chip/Chip.js.map +1 -1
- package/build/lib/native/components/Chip/ChipGroup.js +4 -3
- package/build/lib/native/components/Chip/ChipGroup.js.map +1 -1
- package/build/lib/native/components/Chip/chipTokens.js +1 -1
- package/build/lib/native/components/Chip/chipTokens.js.map +1 -1
- package/build/lib/native/components/Collapsible/Collapsible.js +2 -2
- package/build/lib/native/components/Collapsible/Collapsible.js.map +1 -1
- package/build/lib/native/components/Collapsible/commonStyles.js +1 -1
- package/build/lib/native/components/Collapsible/commonStyles.js.map +1 -1
- package/build/lib/native/components/Counter/Counter.js +13 -12
- package/build/lib/native/components/Counter/Counter.js.map +1 -1
- package/build/lib/native/components/Divider/Divider.js +2 -2
- package/build/lib/native/components/Divider/Divider.js.map +1 -1
- package/build/lib/native/components/Drawer/Drawer.native.js +4 -10
- package/build/lib/native/components/Drawer/Drawer.native.js.map +1 -1
- package/build/lib/native/components/Drawer/DrawerSubcomponents.native.js +4 -9
- package/build/lib/native/components/Drawer/DrawerSubcomponents.native.js.map +1 -1
- package/build/lib/native/components/Dropdown/Dropdown.js +2 -1
- package/build/lib/native/components/Dropdown/Dropdown.js.map +1 -1
- package/build/lib/native/components/Fade/Fade.native.js +11 -0
- package/build/lib/native/components/Fade/Fade.native.js.map +1 -0
- package/build/lib/native/components/Form/CharacterCounter/CharacterCounter.js +3 -9
- package/build/lib/native/components/Form/CharacterCounter/CharacterCounter.js.map +1 -1
- package/build/lib/native/components/Form/FormLabel.js +10 -10
- package/build/lib/native/components/Indicator/Indicator.js +7 -6
- package/build/lib/native/components/Indicator/Indicator.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/AnimatedBaseInputWrapper.native.js +1 -1
- package/build/lib/native/components/Input/BaseInput/AnimatedBaseInputWrapper.native.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/BaseInput.js +2 -1
- package/build/lib/native/components/Input/BaseInput/BaseInput.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/BaseInputTagSlot.native.js +3 -3
- package/build/lib/native/components/Input/BaseInput/BaseInputVisuals.js +8 -10
- package/build/lib/native/components/Input/BaseInput/BaseInputVisuals.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/StyledBaseInput.native.js +9 -8
- package/build/lib/native/components/Input/BaseInput/StyledBaseInput.native.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/baseInputTokens.js +1 -1
- package/build/lib/native/components/Input/BaseInput/baseInputTokens.js.map +1 -1
- package/build/lib/native/components/Link/BaseLink/BaseLink.js +1 -1
- package/build/lib/native/components/Link/BaseLink/BaseLink.js.map +1 -1
- package/build/lib/native/components/List/List.js +1 -1
- package/build/lib/native/components/List/List.js.map +1 -1
- package/build/lib/native/components/List/ListItem.js +8 -10
- package/build/lib/native/components/List/ListItem.js.map +1 -1
- package/build/lib/native/components/List/ListItemCode.js +3 -9
- package/build/lib/native/components/List/ListItemCode.js.map +1 -1
- package/build/lib/native/components/List/ListItemText.js +3 -8
- package/build/lib/native/components/List/ListItemText.js.map +1 -1
- package/build/lib/native/components/Menu/Menu.native.js +4 -10
- package/build/lib/native/components/Menu/Menu.native.js.map +1 -1
- package/build/lib/native/components/Menu/MenuItem.native.js +4 -10
- package/build/lib/native/components/Menu/MenuItem.native.js.map +1 -1
- package/build/lib/native/components/Menu/MenuOverlay.native.js +4 -10
- package/build/lib/native/components/Menu/MenuOverlay.native.js.map +1 -1
- package/build/lib/native/components/Menu/VisualSubComponents/MenuDivider.native.js +4 -10
- package/build/lib/native/components/Menu/VisualSubComponents/MenuDivider.native.js.map +1 -1
- package/build/lib/native/components/Menu/VisualSubComponents/MenuHeaderFooter.native.js +4 -10
- package/build/lib/native/components/Menu/VisualSubComponents/MenuHeaderFooter.native.js.map +1 -1
- package/build/lib/native/components/Modal/Modal.native.js +4 -9
- package/build/lib/native/components/Modal/Modal.native.js.map +1 -1
- package/build/lib/native/components/Modal/ModalBody.native.js +3 -8
- package/build/lib/native/components/Modal/ModalBody.native.js.map +1 -1
- package/build/lib/native/components/Modal/ModalFooter.native.js +3 -8
- package/build/lib/native/components/Modal/ModalFooter.native.js.map +1 -1
- package/build/lib/native/components/Modal/ModalHeader.native.js +3 -8
- package/build/lib/native/components/Modal/ModalHeader.native.js.map +1 -1
- package/build/lib/native/components/Morph/Morph.native.js +11 -0
- package/build/lib/native/components/Morph/Morph.native.js.map +1 -0
- package/build/lib/native/components/Move/Move.native.js +11 -0
- package/build/lib/native/components/Move/Move.native.js.map +1 -0
- package/build/lib/native/components/Popover/PopoverContent.js +6 -8
- package/build/lib/native/components/Popover/PopoverContent.js.map +1 -1
- package/build/lib/native/components/Popover/PopoverContentWrapper.native.js +1 -1
- package/build/lib/native/components/Popover/PopoverContentWrapper.native.js.map +1 -1
- package/build/lib/native/components/ProgressBar/CircularProgressBar.native.js +7 -9
- package/build/lib/native/components/ProgressBar/CircularProgressBar.native.js.map +1 -1
- package/build/lib/native/components/ProgressBar/CircularProgressLabel.js +3 -8
- package/build/lib/native/components/ProgressBar/CircularProgressLabel.js.map +1 -1
- package/build/lib/native/components/ProgressBar/ProgressBar.js +2 -2
- package/build/lib/native/components/ProgressBar/ProgressBar.js.map +1 -1
- package/build/lib/native/components/Radio/Radio.js +2 -1
- package/build/lib/native/components/Radio/Radio.js.map +1 -1
- package/build/lib/native/components/Radio/RadioIcon/Fade.native.js +1 -1
- package/build/lib/native/components/Radio/RadioIcon/Fade.native.js.map +1 -1
- package/build/lib/native/components/Radio/RadioIcon/RadioIconWrapperStyles.js +1 -1
- package/build/lib/native/components/Radio/RadioIcon/RadioIconWrapperStyles.js.map +1 -1
- package/build/lib/native/components/Scale/Scale.native.js +11 -0
- package/build/lib/native/components/Scale/Scale.native.js.map +1 -0
- package/build/lib/native/components/SideNav/SideNav.native.js +4 -10
- package/build/lib/native/components/SideNav/SideNav.native.js.map +1 -1
- package/build/lib/native/components/SideNav/SideNavBody.native.js +4 -10
- package/build/lib/native/components/SideNav/SideNavBody.native.js.map +1 -1
- package/build/lib/native/components/SideNav/SideNavFooter.native.js +4 -10
- package/build/lib/native/components/SideNav/SideNavFooter.native.js.map +1 -1
- package/build/lib/native/components/SideNav/SideNavItems/SideNavItem.native.js +4 -10
- package/build/lib/native/components/SideNav/SideNavItems/SideNavItem.native.js.map +1 -1
- package/build/lib/native/components/SideNav/SideNavItems/SideNavLink.native.js +4 -10
- package/build/lib/native/components/SideNav/SideNavItems/SideNavLink.native.js.map +1 -1
- package/build/lib/native/components/SideNav/SideNavLevel.native.js +4 -10
- package/build/lib/native/components/SideNav/SideNavLevel.native.js.map +1 -1
- package/build/lib/native/components/SideNav/SideNavSection.native.js +4 -10
- package/build/lib/native/components/SideNav/SideNavSection.native.js.map +1 -1
- package/build/lib/native/components/SideNav/tokens.js.map +1 -1
- package/build/lib/native/components/Skeleton/PulseAnimation.native.js +1 -1
- package/build/lib/native/components/Skeleton/PulseAnimation.native.js.map +1 -1
- package/build/lib/native/components/Skeleton/Skeleton.js +2 -2
- package/build/lib/native/components/Skeleton/Skeleton.js.map +1 -1
- package/build/lib/native/components/Slide/Slide.native.js +11 -0
- package/build/lib/native/components/Slide/Slide.native.js.map +1 -0
- package/build/lib/native/components/Spinner/BaseSpinner/BaseSpinner.js +4 -3
- package/build/lib/native/components/Spinner/BaseSpinner/BaseSpinner.js.map +1 -1
- package/build/lib/native/components/Spinner/BaseSpinner/spinnerTokens.js +1 -1
- package/build/lib/native/components/Spinner/BaseSpinner/spinnerTokens.js.map +1 -1
- package/build/lib/native/components/Spinner/Spinner/Spinner.js +2 -1
- package/build/lib/native/components/Spinner/Spinner/Spinner.js.map +1 -1
- package/build/lib/native/components/StepGroup/StepGroup.native.js +4 -10
- package/build/lib/native/components/StepGroup/StepGroup.native.js.map +1 -1
- package/build/lib/native/components/StepGroup/StepItem.native.js +4 -10
- package/build/lib/native/components/StepGroup/StepItem.native.js.map +1 -1
- package/build/lib/native/components/Switch/Switch.js +2 -1
- package/build/lib/native/components/Switch/Switch.js.map +1 -1
- package/build/lib/native/components/Switch/getTrackStyles.js +1 -1
- package/build/lib/native/components/Switch/getTrackStyles.js.map +1 -1
- package/build/lib/native/components/Switch/switchTokens.js +1 -1
- package/build/lib/native/components/Switch/switchTokens.js.map +1 -1
- package/build/lib/native/components/Table/Table.native.js +4 -9
- package/build/lib/native/components/Table/Table.native.js.map +1 -1
- package/build/lib/native/components/Table/TableBody.native.js +3 -8
- package/build/lib/native/components/Table/TableBody.native.js.map +1 -1
- package/build/lib/native/components/Table/TableEditableCell.native.js +3 -9
- package/build/lib/native/components/Table/TableEditableCell.native.js.map +1 -1
- package/build/lib/native/components/Table/TableFooter.native.js +3 -8
- package/build/lib/native/components/Table/TableFooter.native.js.map +1 -1
- package/build/lib/native/components/Table/TableHeader.native.js +3 -8
- package/build/lib/native/components/Table/TableHeader.native.js.map +1 -1
- package/build/lib/native/components/Table/TablePagination.native.js +3 -8
- package/build/lib/native/components/Table/TablePagination.native.js.map +1 -1
- package/build/lib/native/components/Table/TableToolbar.native.js +3 -8
- package/build/lib/native/components/Table/TableToolbar.native.js.map +1 -1
- package/build/lib/native/components/Table/tokens.js.map +1 -1
- package/build/lib/native/components/Tabs/Tabs.native.js +6 -8
- package/build/lib/native/components/Tabs/Tabs.native.js.map +1 -1
- package/build/lib/native/components/Tag/AnimatedTag.native.js +1 -1
- package/build/lib/native/components/Tag/AnimatedTag.native.js.map +1 -1
- package/build/lib/native/components/Tag/Tag.js +3 -2
- package/build/lib/native/components/Tag/Tag.js.map +1 -1
- package/build/lib/native/components/Tooltip/TooltipContent.js +8 -8
- package/build/lib/native/components/Tooltip/TooltipContentWrapper.native.js +1 -1
- package/build/lib/native/components/Tooltip/TooltipContentWrapper.native.js.map +1 -1
- package/build/lib/native/components/TopNav/TabNav/TabNav.native.js +4 -10
- package/build/lib/native/components/TopNav/TabNav/TabNav.native.js.map +1 -1
- package/build/lib/native/components/TopNav/TabNav/TabNavItem.native.js +4 -10
- package/build/lib/native/components/TopNav/TabNav/TabNavItem.native.js.map +1 -1
- package/build/lib/native/components/TopNav/TopNav.native.js +4 -10
- package/build/lib/native/components/TopNav/TopNav.native.js.map +1 -1
- package/build/lib/native/components/Typography/Code/Code.js +1 -1
- package/build/lib/native/components/Typography/Code/Code.js.map +1 -1
- package/build/lib/native/components/Typography/Display/Display.js +2 -2
- package/build/lib/native/components/Typography/Display/Display.js.map +1 -1
- package/build/lib/native/components/Typography/Heading/Heading.js +2 -2
- package/build/lib/native/components/Typography/Heading/Heading.js.map +1 -1
- package/build/lib/native/components/Typography/Text/Text.js +2 -2
- package/build/lib/native/components/Typography/Text/Text.js.map +1 -1
- package/build/lib/native/components/index.js +5 -0
- package/build/lib/native/components/index.js.map +1 -1
- package/build/lib/native/tokens/global/motion.js +1 -1
- package/build/lib/native/tokens/global/motion.js.map +1 -1
- package/build/lib/native/utils/getMotionRefs.js +4 -0
- package/build/lib/native/utils/getMotionRefs.js.map +1 -0
- package/build/lib/web/development/components/Accordion/Accordion.js +6 -3
- package/build/lib/web/development/components/Accordion/Accordion.js.map +1 -1
- package/build/lib/web/development/components/Accordion/commonStyles.js +1 -1
- package/build/lib/web/development/components/Accordion/commonStyles.js.map +1 -1
- package/build/lib/web/development/components/ActionList/ActionList.js +3 -0
- package/build/lib/web/development/components/ActionList/ActionList.js.map +1 -1
- package/build/lib/web/development/components/Alert/Alert.js +6 -3
- package/build/lib/web/development/components/Alert/Alert.js.map +1 -1
- package/build/lib/web/development/components/Amount/Amount.js +3 -2
- package/build/lib/web/development/components/Amount/Amount.js.map +1 -1
- package/build/lib/web/development/components/AnimateInteractions/AnimateInteractionsProvider.js +12 -0
- package/build/lib/web/development/components/AnimateInteractions/AnimateInteractionsProvider.js.map +1 -0
- package/build/lib/web/development/components/Badge/Badge.js +4 -2
- package/build/lib/web/development/components/Badge/Badge.js.map +1 -1
- package/build/lib/web/development/components/BaseMotion/BaseMotion.js +123 -0
- package/build/lib/web/development/components/BaseMotion/BaseMotion.js.map +1 -0
- package/build/lib/web/development/components/BaseMotion/baseMotionUtils.js +60 -0
- package/build/lib/web/development/components/BaseMotion/baseMotionUtils.js.map +1 -0
- package/build/lib/web/development/components/BaseMotion/index.js +3 -0
- package/build/lib/web/development/components/BaseMotion/index.js.map +1 -0
- package/build/lib/web/development/components/BaseMotion/types.js +2 -0
- package/build/lib/web/development/components/BaseMotion/types.js.map +1 -0
- package/build/lib/web/development/components/BottomNav/BottomNav.web.js +4 -2
- package/build/lib/web/development/components/BottomNav/BottomNav.web.js.map +1 -1
- package/build/lib/web/development/components/BottomSheet/BottomSheet.web.js +1 -1
- package/build/lib/web/development/components/BottomSheet/BottomSheet.web.js.map +1 -1
- package/build/lib/web/development/components/BottomSheet/BottomSheetBackdrop.web.js +1 -1
- package/build/lib/web/development/components/BottomSheet/BottomSheetBackdrop.web.js.map +1 -1
- package/build/lib/web/development/components/Box/BaseBox/types/propsTypes.js.map +1 -1
- package/build/lib/web/development/components/Box/Box.js +2 -2
- package/build/lib/web/development/components/Box/Box.js.map +1 -1
- package/build/lib/web/development/components/Breadcrumb/Breadcrumb.web.js +3 -1
- package/build/lib/web/development/components/Breadcrumb/Breadcrumb.web.js.map +1 -1
- package/build/lib/web/development/components/Button/BaseButton/BaseButton.js +1 -1
- package/build/lib/web/development/components/Button/BaseButton/BaseButton.js.map +1 -1
- package/build/lib/web/development/components/Button/IconButton/StyledIconButton.web.js +1 -1
- package/build/lib/web/development/components/Button/IconButton/StyledIconButton.web.js.map +1 -1
- package/build/lib/web/development/components/ButtonGroup/ButtonGroup.web.js +3 -2
- package/build/lib/web/development/components/ButtonGroup/ButtonGroup.web.js.map +1 -1
- package/build/lib/web/development/components/Card/Card.js +3 -1
- package/build/lib/web/development/components/Card/Card.js.map +1 -1
- package/build/lib/web/development/components/Card/CardRoot.web.js +6 -4
- package/build/lib/web/development/components/Card/CardRoot.web.js.map +1 -1
- package/build/lib/web/development/components/Carousel/Carousel.web.js +6 -3
- package/build/lib/web/development/components/Carousel/Carousel.web.js.map +1 -1
- package/build/lib/web/development/components/Carousel/Indicators/getIndicatorButtonStyles.js +1 -1
- package/build/lib/web/development/components/Carousel/Indicators/getIndicatorButtonStyles.js.map +1 -1
- package/build/lib/web/development/components/Carousel/NavigationButton/getNavigationButtonStyles.js +1 -1
- package/build/lib/web/development/components/Carousel/NavigationButton/getNavigationButtonStyles.js.map +1 -1
- package/build/lib/web/development/components/Checkbox/Checkbox.js +13 -3
- package/build/lib/web/development/components/Checkbox/Checkbox.js.map +1 -1
- package/build/lib/web/development/components/Checkbox/CheckboxIcon/Fade.web.js +2 -2
- package/build/lib/web/development/components/Checkbox/CheckboxIcon/Fade.web.js.map +1 -1
- package/build/lib/web/development/components/Chip/Chip.js +11 -2
- package/build/lib/web/development/components/Chip/Chip.js.map +1 -1
- package/build/lib/web/development/components/Chip/ChipGroup.js +5 -2
- package/build/lib/web/development/components/Chip/ChipGroup.js.map +1 -1
- package/build/lib/web/development/components/Chip/chipTokens.js +1 -1
- package/build/lib/web/development/components/Chip/chipTokens.js.map +1 -1
- package/build/lib/web/development/components/Collapsible/Collapsible.js +6 -3
- package/build/lib/web/development/components/Collapsible/Collapsible.js.map +1 -1
- package/build/lib/web/development/components/Collapsible/commonStyles.js +2 -2
- package/build/lib/web/development/components/Collapsible/commonStyles.js.map +1 -1
- package/build/lib/web/development/components/Counter/Counter.js +4 -2
- package/build/lib/web/development/components/Counter/Counter.js.map +1 -1
- package/build/lib/web/development/components/Divider/Divider.js +4 -2
- package/build/lib/web/development/components/Divider/Divider.js.map +1 -1
- package/build/lib/web/development/components/Drawer/Drawer.web.js +4 -4
- package/build/lib/web/development/components/Drawer/Drawer.web.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/Dropdown.js +4 -3
- package/build/lib/web/development/components/Dropdown/Dropdown.js.map +1 -1
- package/build/lib/web/development/components/Fade/Fade.web.js +62 -0
- package/build/lib/web/development/components/Fade/Fade.web.js.map +1 -0
- package/build/lib/web/development/components/Fade/index.js +2 -0
- package/build/lib/web/development/components/Fade/index.js.map +1 -0
- package/build/lib/web/development/components/FileUpload/FileUpload.web.js +11 -2
- package/build/lib/web/development/components/FileUpload/FileUpload.web.js.map +1 -1
- package/build/lib/web/development/components/FileUpload/fileUploadTokens.js +1 -1
- package/build/lib/web/development/components/FileUpload/fileUploadTokens.js.map +1 -1
- package/build/lib/web/development/components/Form/Selector/SelectorInput.web.js +1 -1
- package/build/lib/web/development/components/Form/Selector/SelectorInput.web.js.map +1 -1
- package/build/lib/web/development/components/Indicator/Indicator.js +4 -2
- package/build/lib/web/development/components/Indicator/Indicator.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/AnimatedBaseInputWrapper.web.js +3 -3
- package/build/lib/web/development/components/Input/BaseInput/AnimatedBaseInputWrapper.web.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/BaseInput.js +21 -7
- package/build/lib/web/development/components/Input/BaseInput/BaseInput.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/baseInputTokens.js +2 -2
- package/build/lib/web/development/components/Input/BaseInput/baseInputTokens.js.map +1 -1
- package/build/lib/web/development/components/Link/BaseLink/BaseLink.js +1 -1
- package/build/lib/web/development/components/Link/BaseLink/BaseLink.js.map +1 -1
- package/build/lib/web/development/components/List/List.js +5 -3
- package/build/lib/web/development/components/List/List.js.map +1 -1
- package/build/lib/web/development/components/Modal/Modal.web.js +2 -2
- package/build/lib/web/development/components/Modal/Modal.web.js.map +1 -1
- package/build/lib/web/development/components/Modal/ModalBackdrop.js +2 -2
- package/build/lib/web/development/components/Modal/ModalBackdrop.js.map +1 -1
- package/build/lib/web/development/components/Morph/Morph.web.js +48 -0
- package/build/lib/web/development/components/Morph/Morph.web.js.map +1 -0
- package/build/lib/web/development/components/Morph/index.js +2 -0
- package/build/lib/web/development/components/Morph/index.js.map +1 -0
- package/build/lib/web/development/components/Move/Move.web.js +66 -0
- package/build/lib/web/development/components/Move/Move.web.js.map +1 -0
- package/build/lib/web/development/components/Move/index.js +2 -0
- package/build/lib/web/development/components/Move/index.js.map +1 -0
- package/build/lib/web/development/components/ProgressBar/CircularProgressBar.web.js +1 -1
- package/build/lib/web/development/components/ProgressBar/CircularProgressBar.web.js.map +1 -1
- package/build/lib/web/development/components/ProgressBar/ProgressBar.js +8 -4
- package/build/lib/web/development/components/ProgressBar/ProgressBar.js.map +1 -1
- package/build/lib/web/development/components/Radio/Radio.js +13 -3
- package/build/lib/web/development/components/Radio/Radio.js.map +1 -1
- package/build/lib/web/development/components/Radio/RadioIcon/Fade.web.js +3 -3
- package/build/lib/web/development/components/Radio/RadioIcon/Fade.web.js.map +1 -1
- package/build/lib/web/development/components/Radio/RadioIcon/RadioIconWrapperStyles.js +1 -1
- package/build/lib/web/development/components/Radio/RadioIcon/RadioIconWrapperStyles.js.map +1 -1
- package/build/lib/web/development/components/Scale/Scale.web.js +47 -0
- package/build/lib/web/development/components/Scale/Scale.web.js.map +1 -0
- package/build/lib/web/development/components/Scale/index.js +2 -0
- package/build/lib/web/development/components/Scale/index.js.map +1 -0
- package/build/lib/web/development/components/SideNav/SideNav.web.js +7 -5
- package/build/lib/web/development/components/SideNav/SideNav.web.js.map +1 -1
- package/build/lib/web/development/components/SideNav/tokens.js +1 -1
- package/build/lib/web/development/components/SideNav/tokens.js.map +1 -1
- package/build/lib/web/development/components/Skeleton/PulseAnimation.web.js +1 -1
- package/build/lib/web/development/components/Skeleton/PulseAnimation.web.js.map +1 -1
- package/build/lib/web/development/components/Skeleton/Skeleton.js +4 -1
- package/build/lib/web/development/components/Skeleton/Skeleton.js.map +1 -1
- package/build/lib/web/development/components/Slide/Slide.web.js +119 -0
- package/build/lib/web/development/components/Slide/Slide.web.js.map +1 -0
- package/build/lib/web/development/components/Slide/index.js +2 -0
- package/build/lib/web/development/components/Slide/index.js.map +1 -0
- package/build/lib/web/development/components/Spinner/BaseSpinner/BaseSpinner.js +6 -3
- package/build/lib/web/development/components/Spinner/BaseSpinner/BaseSpinner.js.map +1 -1
- package/build/lib/web/development/components/Spinner/BaseSpinner/spinnerTokens.js +1 -1
- package/build/lib/web/development/components/Spinner/BaseSpinner/spinnerTokens.js.map +1 -1
- package/build/lib/web/development/components/Spinner/Spinner/Spinner.js +4 -1
- package/build/lib/web/development/components/Spinner/Spinner/Spinner.js.map +1 -1
- package/build/lib/web/development/components/SpotlightPopoverTour/TourMask.web.js +2 -2
- package/build/lib/web/development/components/SpotlightPopoverTour/TourMask.web.js.map +1 -1
- package/build/lib/web/development/components/Stagger/StaggerProvider.js +13 -0
- package/build/lib/web/development/components/Stagger/StaggerProvider.js.map +1 -0
- package/build/lib/web/development/components/StepGroup/StepGroup.web.js +5 -3
- package/build/lib/web/development/components/StepGroup/StepGroup.web.js.map +1 -1
- package/build/lib/web/development/components/StepGroup/StepItem.web.js +1 -1
- package/build/lib/web/development/components/StepGroup/StepItem.web.js.map +1 -1
- package/build/lib/web/development/components/Switch/AnimatedThumbIcon.web.js +1 -1
- package/build/lib/web/development/components/Switch/AnimatedThumbIcon.web.js.map +1 -1
- package/build/lib/web/development/components/Switch/Switch.js +13 -3
- package/build/lib/web/development/components/Switch/Switch.js.map +1 -1
- package/build/lib/web/development/components/Switch/getTrackStyles.js +1 -1
- package/build/lib/web/development/components/Switch/getTrackStyles.js.map +1 -1
- package/build/lib/web/development/components/Switch/switchTokens.js +6 -6
- package/build/lib/web/development/components/Switch/switchTokens.js.map +1 -1
- package/build/lib/web/development/components/Table/Table.web.js +4 -2
- package/build/lib/web/development/components/Table/Table.web.js.map +1 -1
- package/build/lib/web/development/components/Table/tokens.js +2 -2
- package/build/lib/web/development/components/Table/tokens.js.map +1 -1
- package/build/lib/web/development/components/Tabs/TabIndicator.web.js +1 -1
- package/build/lib/web/development/components/Tabs/TabIndicator.web.js.map +1 -1
- package/build/lib/web/development/components/Tabs/TabItem.web.js +2 -2
- package/build/lib/web/development/components/Tabs/TabItem.web.js.map +1 -1
- package/build/lib/web/development/components/Tabs/Tabs.web.js +34 -1
- package/build/lib/web/development/components/Tabs/Tabs.web.js.map +1 -1
- package/build/lib/web/development/components/Tag/AnimatedTag.web.js +2 -2
- package/build/lib/web/development/components/Tag/AnimatedTag.web.js.map +1 -1
- package/build/lib/web/development/components/Tag/Tag.js +31 -29
- package/build/lib/web/development/components/Tag/Tag.js.map +1 -1
- package/build/lib/web/development/components/Toast/Toast.web.js +2 -2
- package/build/lib/web/development/components/Toast/Toast.web.js.map +1 -1
- package/build/lib/web/development/components/Toast/ToastContainer.web.js +1 -1
- package/build/lib/web/development/components/Toast/ToastContainer.web.js.map +1 -1
- package/build/lib/web/development/components/TopNav/TabNav/TabNavItem.web.js +2 -2
- package/build/lib/web/development/components/TopNav/TabNav/TabNavItem.web.js.map +1 -1
- package/build/lib/web/development/components/TopNav/TopNav.web.js +4 -2
- package/build/lib/web/development/components/TopNav/TopNav.web.js.map +1 -1
- package/build/lib/web/development/components/Typography/Code/Code.js +30 -27
- package/build/lib/web/development/components/Typography/Code/Code.js.map +1 -1
- package/build/lib/web/development/components/Typography/Display/Display.js +6 -2
- package/build/lib/web/development/components/Typography/Display/Display.js.map +1 -1
- package/build/lib/web/development/components/Typography/Heading/Heading.js +4 -1
- package/build/lib/web/development/components/Typography/Heading/Heading.js.map +1 -1
- package/build/lib/web/development/components/Typography/Text/Text.js +6 -10
- package/build/lib/web/development/components/Typography/Text/Text.js.map +1 -1
- package/build/lib/web/development/components/index.js +10 -0
- package/build/lib/web/development/components/index.js.map +1 -1
- package/build/lib/web/development/tokens/global/motion.js +22 -28
- package/build/lib/web/development/tokens/global/motion.js.map +1 -1
- package/build/lib/web/development/utils/cssBezierToArray.js +12 -0
- package/build/lib/web/development/utils/cssBezierToArray.js.map +1 -0
- package/build/lib/web/development/utils/getFocusRingStyles/getFocusRingStyles.web.js +1 -1
- package/build/lib/web/development/utils/getFocusRingStyles/getFocusRingStyles.web.js.map +1 -1
- package/build/lib/web/development/utils/getMotionRefs.js +86 -0
- package/build/lib/web/development/utils/getMotionRefs.js.map +1 -0
- package/build/lib/web/development/utils/msToSeconds.js +6 -0
- package/build/lib/web/development/utils/msToSeconds.js.map +1 -0
- package/build/lib/web/production/components/Accordion/Accordion.js +6 -3
- package/build/lib/web/production/components/Accordion/Accordion.js.map +1 -1
- package/build/lib/web/production/components/Accordion/commonStyles.js +1 -1
- package/build/lib/web/production/components/Accordion/commonStyles.js.map +1 -1
- package/build/lib/web/production/components/ActionList/ActionList.js +3 -0
- package/build/lib/web/production/components/ActionList/ActionList.js.map +1 -1
- package/build/lib/web/production/components/Alert/Alert.js +6 -3
- package/build/lib/web/production/components/Alert/Alert.js.map +1 -1
- package/build/lib/web/production/components/Amount/Amount.js +3 -2
- package/build/lib/web/production/components/Amount/Amount.js.map +1 -1
- package/build/lib/web/production/components/AnimateInteractions/AnimateInteractionsProvider.js +12 -0
- package/build/lib/web/production/components/AnimateInteractions/AnimateInteractionsProvider.js.map +1 -0
- package/build/lib/web/production/components/Badge/Badge.js +4 -2
- package/build/lib/web/production/components/Badge/Badge.js.map +1 -1
- package/build/lib/web/production/components/BaseMotion/BaseMotion.js +123 -0
- package/build/lib/web/production/components/BaseMotion/BaseMotion.js.map +1 -0
- package/build/lib/web/production/components/BaseMotion/baseMotionUtils.js +60 -0
- package/build/lib/web/production/components/BaseMotion/baseMotionUtils.js.map +1 -0
- package/build/lib/web/production/components/BaseMotion/index.js +3 -0
- package/build/lib/web/production/components/BaseMotion/index.js.map +1 -0
- package/build/lib/web/production/components/BaseMotion/types.js +2 -0
- package/build/lib/web/production/components/BaseMotion/types.js.map +1 -0
- package/build/lib/web/production/components/BottomNav/BottomNav.web.js +4 -2
- package/build/lib/web/production/components/BottomNav/BottomNav.web.js.map +1 -1
- package/build/lib/web/production/components/BottomSheet/BottomSheet.web.js +1 -1
- package/build/lib/web/production/components/BottomSheet/BottomSheet.web.js.map +1 -1
- package/build/lib/web/production/components/BottomSheet/BottomSheetBackdrop.web.js +1 -1
- package/build/lib/web/production/components/BottomSheet/BottomSheetBackdrop.web.js.map +1 -1
- package/build/lib/web/production/components/Box/BaseBox/types/propsTypes.js.map +1 -1
- package/build/lib/web/production/components/Box/Box.js +2 -2
- package/build/lib/web/production/components/Box/Box.js.map +1 -1
- package/build/lib/web/production/components/Breadcrumb/Breadcrumb.web.js +3 -1
- package/build/lib/web/production/components/Breadcrumb/Breadcrumb.web.js.map +1 -1
- package/build/lib/web/production/components/Button/BaseButton/BaseButton.js +1 -1
- package/build/lib/web/production/components/Button/BaseButton/BaseButton.js.map +1 -1
- package/build/lib/web/production/components/Button/IconButton/StyledIconButton.web.js +1 -1
- package/build/lib/web/production/components/Button/IconButton/StyledIconButton.web.js.map +1 -1
- package/build/lib/web/production/components/ButtonGroup/ButtonGroup.web.js +3 -2
- package/build/lib/web/production/components/ButtonGroup/ButtonGroup.web.js.map +1 -1
- package/build/lib/web/production/components/Card/Card.js +3 -1
- package/build/lib/web/production/components/Card/Card.js.map +1 -1
- package/build/lib/web/production/components/Card/CardRoot.web.js +6 -4
- package/build/lib/web/production/components/Card/CardRoot.web.js.map +1 -1
- package/build/lib/web/production/components/Carousel/Carousel.web.js +6 -3
- package/build/lib/web/production/components/Carousel/Carousel.web.js.map +1 -1
- package/build/lib/web/production/components/Carousel/Indicators/getIndicatorButtonStyles.js +1 -1
- package/build/lib/web/production/components/Carousel/Indicators/getIndicatorButtonStyles.js.map +1 -1
- package/build/lib/web/production/components/Carousel/NavigationButton/getNavigationButtonStyles.js +1 -1
- package/build/lib/web/production/components/Carousel/NavigationButton/getNavigationButtonStyles.js.map +1 -1
- package/build/lib/web/production/components/Checkbox/Checkbox.js +13 -3
- package/build/lib/web/production/components/Checkbox/Checkbox.js.map +1 -1
- package/build/lib/web/production/components/Checkbox/CheckboxIcon/Fade.web.js +2 -2
- package/build/lib/web/production/components/Checkbox/CheckboxIcon/Fade.web.js.map +1 -1
- package/build/lib/web/production/components/Chip/Chip.js +11 -2
- package/build/lib/web/production/components/Chip/Chip.js.map +1 -1
- package/build/lib/web/production/components/Chip/ChipGroup.js +5 -2
- package/build/lib/web/production/components/Chip/ChipGroup.js.map +1 -1
- package/build/lib/web/production/components/Chip/chipTokens.js +1 -1
- package/build/lib/web/production/components/Chip/chipTokens.js.map +1 -1
- package/build/lib/web/production/components/Collapsible/Collapsible.js +6 -3
- package/build/lib/web/production/components/Collapsible/Collapsible.js.map +1 -1
- package/build/lib/web/production/components/Collapsible/commonStyles.js +2 -2
- package/build/lib/web/production/components/Collapsible/commonStyles.js.map +1 -1
- package/build/lib/web/production/components/Counter/Counter.js +4 -2
- package/build/lib/web/production/components/Counter/Counter.js.map +1 -1
- package/build/lib/web/production/components/Divider/Divider.js +4 -2
- package/build/lib/web/production/components/Divider/Divider.js.map +1 -1
- package/build/lib/web/production/components/Drawer/Drawer.web.js +4 -4
- package/build/lib/web/production/components/Drawer/Drawer.web.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/Dropdown.js +4 -3
- package/build/lib/web/production/components/Dropdown/Dropdown.js.map +1 -1
- package/build/lib/web/production/components/Fade/Fade.web.js +62 -0
- package/build/lib/web/production/components/Fade/Fade.web.js.map +1 -0
- package/build/lib/web/production/components/Fade/index.js +2 -0
- package/build/lib/web/production/components/Fade/index.js.map +1 -0
- package/build/lib/web/production/components/FileUpload/FileUpload.web.js +11 -2
- package/build/lib/web/production/components/FileUpload/FileUpload.web.js.map +1 -1
- package/build/lib/web/production/components/FileUpload/fileUploadTokens.js +1 -1
- package/build/lib/web/production/components/FileUpload/fileUploadTokens.js.map +1 -1
- package/build/lib/web/production/components/Form/Selector/SelectorInput.web.js +1 -1
- package/build/lib/web/production/components/Form/Selector/SelectorInput.web.js.map +1 -1
- package/build/lib/web/production/components/Indicator/Indicator.js +4 -2
- package/build/lib/web/production/components/Indicator/Indicator.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/AnimatedBaseInputWrapper.web.js +3 -3
- package/build/lib/web/production/components/Input/BaseInput/AnimatedBaseInputWrapper.web.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/BaseInput.js +21 -7
- package/build/lib/web/production/components/Input/BaseInput/BaseInput.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/baseInputTokens.js +2 -2
- package/build/lib/web/production/components/Input/BaseInput/baseInputTokens.js.map +1 -1
- package/build/lib/web/production/components/Link/BaseLink/BaseLink.js +1 -1
- package/build/lib/web/production/components/Link/BaseLink/BaseLink.js.map +1 -1
- package/build/lib/web/production/components/List/List.js +5 -3
- package/build/lib/web/production/components/List/List.js.map +1 -1
- package/build/lib/web/production/components/Modal/Modal.web.js +2 -2
- package/build/lib/web/production/components/Modal/Modal.web.js.map +1 -1
- package/build/lib/web/production/components/Modal/ModalBackdrop.js +2 -2
- package/build/lib/web/production/components/Modal/ModalBackdrop.js.map +1 -1
- package/build/lib/web/production/components/Morph/Morph.web.js +48 -0
- package/build/lib/web/production/components/Morph/Morph.web.js.map +1 -0
- package/build/lib/web/production/components/Morph/index.js +2 -0
- package/build/lib/web/production/components/Morph/index.js.map +1 -0
- package/build/lib/web/production/components/Move/Move.web.js +66 -0
- package/build/lib/web/production/components/Move/Move.web.js.map +1 -0
- package/build/lib/web/production/components/Move/index.js +2 -0
- package/build/lib/web/production/components/Move/index.js.map +1 -0
- package/build/lib/web/production/components/ProgressBar/CircularProgressBar.web.js +1 -1
- package/build/lib/web/production/components/ProgressBar/CircularProgressBar.web.js.map +1 -1
- package/build/lib/web/production/components/ProgressBar/ProgressBar.js +8 -4
- package/build/lib/web/production/components/ProgressBar/ProgressBar.js.map +1 -1
- package/build/lib/web/production/components/Radio/Radio.js +13 -3
- package/build/lib/web/production/components/Radio/Radio.js.map +1 -1
- package/build/lib/web/production/components/Radio/RadioIcon/Fade.web.js +3 -3
- package/build/lib/web/production/components/Radio/RadioIcon/Fade.web.js.map +1 -1
- package/build/lib/web/production/components/Radio/RadioIcon/RadioIconWrapperStyles.js +1 -1
- package/build/lib/web/production/components/Radio/RadioIcon/RadioIconWrapperStyles.js.map +1 -1
- package/build/lib/web/production/components/Scale/Scale.web.js +47 -0
- package/build/lib/web/production/components/Scale/Scale.web.js.map +1 -0
- package/build/lib/web/production/components/Scale/index.js +2 -0
- package/build/lib/web/production/components/Scale/index.js.map +1 -0
- package/build/lib/web/production/components/SideNav/SideNav.web.js +7 -5
- package/build/lib/web/production/components/SideNav/SideNav.web.js.map +1 -1
- package/build/lib/web/production/components/SideNav/tokens.js +1 -1
- package/build/lib/web/production/components/SideNav/tokens.js.map +1 -1
- package/build/lib/web/production/components/Skeleton/PulseAnimation.web.js +1 -1
- package/build/lib/web/production/components/Skeleton/PulseAnimation.web.js.map +1 -1
- package/build/lib/web/production/components/Skeleton/Skeleton.js +4 -1
- package/build/lib/web/production/components/Skeleton/Skeleton.js.map +1 -1
- package/build/lib/web/production/components/Slide/Slide.web.js +119 -0
- package/build/lib/web/production/components/Slide/Slide.web.js.map +1 -0
- package/build/lib/web/production/components/Slide/index.js +2 -0
- package/build/lib/web/production/components/Slide/index.js.map +1 -0
- package/build/lib/web/production/components/Spinner/BaseSpinner/BaseSpinner.js +6 -3
- package/build/lib/web/production/components/Spinner/BaseSpinner/BaseSpinner.js.map +1 -1
- package/build/lib/web/production/components/Spinner/BaseSpinner/spinnerTokens.js +1 -1
- package/build/lib/web/production/components/Spinner/BaseSpinner/spinnerTokens.js.map +1 -1
- package/build/lib/web/production/components/Spinner/Spinner/Spinner.js +4 -1
- package/build/lib/web/production/components/Spinner/Spinner/Spinner.js.map +1 -1
- package/build/lib/web/production/components/SpotlightPopoverTour/TourMask.web.js +2 -2
- package/build/lib/web/production/components/SpotlightPopoverTour/TourMask.web.js.map +1 -1
- package/build/lib/web/production/components/Stagger/StaggerProvider.js +13 -0
- package/build/lib/web/production/components/Stagger/StaggerProvider.js.map +1 -0
- package/build/lib/web/production/components/StepGroup/StepGroup.web.js +5 -3
- package/build/lib/web/production/components/StepGroup/StepGroup.web.js.map +1 -1
- package/build/lib/web/production/components/StepGroup/StepItem.web.js +1 -1
- package/build/lib/web/production/components/StepGroup/StepItem.web.js.map +1 -1
- package/build/lib/web/production/components/Switch/AnimatedThumbIcon.web.js +1 -1
- package/build/lib/web/production/components/Switch/AnimatedThumbIcon.web.js.map +1 -1
- package/build/lib/web/production/components/Switch/Switch.js +13 -3
- package/build/lib/web/production/components/Switch/Switch.js.map +1 -1
- package/build/lib/web/production/components/Switch/getTrackStyles.js +1 -1
- package/build/lib/web/production/components/Switch/getTrackStyles.js.map +1 -1
- package/build/lib/web/production/components/Switch/switchTokens.js +6 -6
- package/build/lib/web/production/components/Switch/switchTokens.js.map +1 -1
- package/build/lib/web/production/components/Table/Table.web.js +4 -2
- package/build/lib/web/production/components/Table/Table.web.js.map +1 -1
- package/build/lib/web/production/components/Table/tokens.js +2 -2
- package/build/lib/web/production/components/Table/tokens.js.map +1 -1
- package/build/lib/web/production/components/Tabs/TabIndicator.web.js +1 -1
- package/build/lib/web/production/components/Tabs/TabIndicator.web.js.map +1 -1
- package/build/lib/web/production/components/Tabs/TabItem.web.js +2 -2
- package/build/lib/web/production/components/Tabs/TabItem.web.js.map +1 -1
- package/build/lib/web/production/components/Tabs/Tabs.web.js +34 -1
- package/build/lib/web/production/components/Tabs/Tabs.web.js.map +1 -1
- package/build/lib/web/production/components/Tag/AnimatedTag.web.js +2 -2
- package/build/lib/web/production/components/Tag/AnimatedTag.web.js.map +1 -1
- package/build/lib/web/production/components/Tag/Tag.js +31 -29
- package/build/lib/web/production/components/Tag/Tag.js.map +1 -1
- package/build/lib/web/production/components/Toast/Toast.web.js +2 -2
- package/build/lib/web/production/components/Toast/Toast.web.js.map +1 -1
- package/build/lib/web/production/components/Toast/ToastContainer.web.js +1 -1
- package/build/lib/web/production/components/Toast/ToastContainer.web.js.map +1 -1
- package/build/lib/web/production/components/TopNav/TabNav/TabNavItem.web.js +2 -2
- package/build/lib/web/production/components/TopNav/TabNav/TabNavItem.web.js.map +1 -1
- package/build/lib/web/production/components/TopNav/TopNav.web.js +4 -2
- package/build/lib/web/production/components/TopNav/TopNav.web.js.map +1 -1
- package/build/lib/web/production/components/Typography/Code/Code.js +30 -27
- package/build/lib/web/production/components/Typography/Code/Code.js.map +1 -1
- package/build/lib/web/production/components/Typography/Display/Display.js +6 -2
- package/build/lib/web/production/components/Typography/Display/Display.js.map +1 -1
- package/build/lib/web/production/components/Typography/Heading/Heading.js +4 -1
- package/build/lib/web/production/components/Typography/Heading/Heading.js.map +1 -1
- package/build/lib/web/production/components/Typography/Text/Text.js +6 -10
- package/build/lib/web/production/components/Typography/Text/Text.js.map +1 -1
- package/build/lib/web/production/components/index.js +10 -0
- package/build/lib/web/production/components/index.js.map +1 -1
- package/build/lib/web/production/tokens/global/motion.js +22 -28
- package/build/lib/web/production/tokens/global/motion.js.map +1 -1
- package/build/lib/web/production/utils/cssBezierToArray.js +12 -0
- package/build/lib/web/production/utils/cssBezierToArray.js.map +1 -0
- package/build/lib/web/production/utils/getFocusRingStyles/getFocusRingStyles.web.js +1 -1
- package/build/lib/web/production/utils/getFocusRingStyles/getFocusRingStyles.web.js.map +1 -1
- package/build/lib/web/production/utils/getMotionRefs.js +86 -0
- package/build/lib/web/production/utils/getMotionRefs.js.map +1 -0
- package/build/lib/web/production/utils/msToSeconds.js +6 -0
- package/build/lib/web/production/utils/msToSeconds.js.map +1 -0
- package/build/types/components/index.d.ts +17967 -5488
- package/build/types/components/index.native.d.ts +7923 -2158
- package/build/types/tokens/index.d.ts +103 -93
- package/build/types/tokens/index.native.d.ts +103 -93
- package/build/types/utils/index.d.ts +84 -71
- package/build/types/utils/index.native.d.ts +84 -71
- package/codemods/migrate-motion-tokens/transformers/__tests__/migrate-motion-tokens.test.ts +130 -0
- package/codemods/migrate-motion-tokens/transformers/index.ts +1 -0
- package/codemods/migrate-motion-tokens/transformers/migrate-motion.ts +24 -0
- package/codemods/migrate-motion-tokens/transformers/motionTokenMapping.json +11 -0
- package/package.json +3 -1
|
@@ -181,7 +181,7 @@ var getAmountByParts = function getAmountByParts(_ref7) {
|
|
|
181
181
|
};
|
|
182
182
|
}
|
|
183
183
|
};
|
|
184
|
-
var _Amount = function _Amount(_ref8) {
|
|
184
|
+
var _Amount = function _Amount(_ref8, ref) {
|
|
185
185
|
var _renderedValue$isPref, _renderedValue$curren;
|
|
186
186
|
var value = _ref8.value,
|
|
187
187
|
_ref8$suffix = _ref8.suffix,
|
|
@@ -255,6 +255,7 @@ var _Amount = function _Amount(_ref8) {
|
|
|
255
255
|
var currencyFontSize = isAffixSubtle ? subtleFontSizes[type][size] : normalAmountSizes[type][size];
|
|
256
256
|
var isReactNative = getPlatformType() === 'react-native';
|
|
257
257
|
return /*#__PURE__*/jsx(BaseBox, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
258
|
+
ref: ref,
|
|
258
259
|
display: isReactNative ? 'flex' : 'inline-flex',
|
|
259
260
|
flexDirection: "row"
|
|
260
261
|
}, metaAttribute({
|
|
@@ -317,7 +318,7 @@ var _Amount = function _Amount(_ref8) {
|
|
|
317
318
|
})
|
|
318
319
|
}));
|
|
319
320
|
};
|
|
320
|
-
var Amount = /*#__PURE__*/assignWithoutSideEffects(_Amount, {
|
|
321
|
+
var Amount = /*#__PURE__*/assignWithoutSideEffects( /*#__PURE__*/React__default.forwardRef(_Amount), {
|
|
321
322
|
displayName: 'Amount',
|
|
322
323
|
componentId: 'Amount'
|
|
323
324
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Amount.js","sources":["../../../../../../src/components/Amount/Amount.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport React from 'react';\nimport type { CurrencyCodeType } from '@razorpay/i18nify-js/currency';\nimport { formatNumberByParts } from '@razorpay/i18nify-js/currency';\nimport type { AmountTypeProps } from './amountTokens';\nimport { normalAmountSizes, subtleFontSizes, amountLineHeights } from './amountTokens';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { DataAnalyticsAttribute, TestID } from '~utils/types';\nimport { getPlatformType } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { throwBladeError } from '~utils/logger';\nimport { objectKeysWithType } from '~utils/objectKeysWithType';\nimport { BaseText } from '~components/Typography/BaseText';\nimport { Text } from '~components/Typography';\nimport { opacity } from '~tokens/global';\nimport type { FontFamily } from '~tokens/global';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\n/**\n * Pollyfill function to get around the node 18 error\n *\n * This function is maintained by i18nify team. Reach out to them for any change regarding this.\n */\nconst stripTrailingZerosFromParts = (\n parts: ReturnType<typeof formatNumberByParts>,\n): ReturnType<typeof formatNumberByParts> => {\n const decimalPart = parts.rawParts\n .filter(({ type }) => type === 'fraction')\n .map(({ value }) => value)\n .join('');\n\n const hasFraction = parts.rawParts.some(({ type }) => type === 'fraction');\n\n if (hasFraction && /^0+$/.test(decimalPart)) {\n delete parts.decimal;\n delete parts.fraction;\n parts.rawParts = parts.rawParts.filter(({ type }) => type !== 'decimal' && type !== 'fraction');\n }\n\n return parts;\n};\n\n/**\n * Wrapper that uses pollyfill of i18nify team\n */\nconst pollyfilledFormatNumberByParts: typeof formatNumberByParts = (value, options) => {\n const parts = formatNumberByParts(value, options);\n\n if (options?.intlOptions?.trailingZeroDisplay === 'stripIfInteger') {\n return stripTrailingZerosFromParts(parts);\n }\n\n return parts;\n};\n\ntype AmountCommonProps = {\n /**\n * The value to be rendered within the component.\n *\n */\n value: number;\n /**\n * Sets the color of the amount.\n *\n * @default undefined\n */\n color?: BaseTextProps['color'];\n /**\n * Indicates what the suffix of amount should be\n *\n * @default 'decimals'\n */\n suffix?: 'decimals' | 'none' | 'humanize';\n /**\n * Makes the currency indicator(currency symbol/code) and decimal digits small and faded\n *\n * @default true\n */\n isAffixSubtle?: true | false;\n /**\n * Determines the visual representation of the currency, choose between displaying the currency symbol or code.\n *\n * Note: Currency symbol and code is determined by the locale set in user's browser or set via @razorpay/i18nify-react library.\n *\n * @default 'currency-symbol'\n */\n currencyIndicator?: 'currency-symbol' | 'currency-code';\n /**\n * The currency of the amount. Note that this component\n * only displays the provided value in the specified currency, it does not perform any currency conversion.\n *\n * @default 'INR'\n * */\n currency?: CurrencyCodeType;\n /**\n * If true, the amount text will have a line through it.\n *\n * @default false\n */\n isStrikethrough?: boolean;\n} & TestID &\n DataAnalyticsAttribute &\n StyledPropsBlade;\n\ntype ColorProps = {\n amountValueColor: BaseTextProps['color'];\n};\n\ntype AmountProps = AmountTypeProps & AmountCommonProps;\n\nconst getTextColorProps = ({ color }: { color: AmountProps['color'] }): ColorProps => {\n const props: ColorProps = {\n amountValueColor: 'surface.text.gray.normal',\n };\n if (!color) return props;\n props.amountValueColor = color;\n return props;\n};\n\ntype AmountType = Partial<ReturnType<typeof formatNumberByParts>>;\n\ninterface AmountValue extends Omit<AmountProps, 'value'> {\n amountValueColor: BaseTextProps['color'];\n amount: AmountType;\n size: Exclude<AmountProps['size'], undefined>;\n}\n\nconst AmountValue = ({\n amount,\n size = 'medium',\n type = 'body',\n weight = 'regular',\n amountValueColor,\n isAffixSubtle,\n suffix,\n}: AmountValue): ReactElement => {\n const isReactNative = getPlatformType() === 'react-native';\n const affixFontSize = isAffixSubtle ? subtleFontSizes[type][size] : normalAmountSizes[type][size];\n const numberFontFamily: keyof FontFamily = type === 'body' ? 'text' : 'heading';\n if (suffix === 'decimals' && isAffixSubtle) {\n // Native does not support alignItems of Text inside a div, instead we need to wrap is in a Text\n const AmountWrapper = isReactNative ? Text : React.Fragment;\n\n return (\n <AmountWrapper>\n <BaseText\n fontSize={normalAmountSizes[type][size]}\n fontWeight={weight}\n lineHeight={amountLineHeights[type][size]}\n color={amountValueColor}\n fontFamily={numberFontFamily}\n as={isReactNative ? undefined : 'span'}\n >\n {amount.integer}\n </BaseText>\n <BaseText\n fontWeight={weight}\n fontSize={affixFontSize}\n fontFamily={numberFontFamily}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n opacity={isAffixSubtle ? opacity[800] : 1}\n >\n {amount.decimal}\n {amount.fraction}\n </BaseText>\n </AmountWrapper>\n );\n }\n\n return (\n <BaseText\n fontSize={normalAmountSizes[type][size]}\n fontWeight={weight}\n fontFamily={numberFontFamily}\n color={amountValueColor}\n lineHeight={amountLineHeights[type][size]}\n >\n {amount.integer}\n {amount.decimal}\n {amount.fraction}\n {amount.compact}\n </BaseText>\n );\n};\n\ntype FormatAmountWithSuffixType = {\n suffix: AmountProps['suffix'];\n value: number;\n currency: AmountProps['currency'];\n};\n\n/**\n * Returns a parsed object based on the suffix passed in parameters\n * === Logic ===\n * value = 12500.45 \n * if suffix === 'decimals' => {\n \"integer\": \"12,500\",\n \"decimal\": \".\",\n \"fraction\": \"45\",\n \"compact\": \"K\",\n \"isPrefixSymbol\": false,\n \"rawParts\": [{\"type\": \"integer\",\"value\": \"12\"},{\"type\": \"group\",\"value\": \",\"},{\"type\": \"integer\",\"value\": \"500\"},{\"type\": \"decimal\",\"value\": \".\"},{\"type\": \"fraction\",\"value\": \"45\"}]\n}\n * @returns {AmountType}\n */\nexport const getAmountByParts = ({\n suffix,\n value,\n currency,\n}: FormatAmountWithSuffixType): AmountType => {\n try {\n switch (suffix) {\n case 'decimals': {\n const options = {\n intlOptions: {\n maximumFractionDigits: 2,\n minimumFractionDigits: 2,\n },\n currency,\n } as const;\n return pollyfilledFormatNumberByParts(value, options);\n }\n case 'humanize': {\n const options = {\n intlOptions: {\n notation: 'compact',\n maximumFractionDigits: 2,\n trailingZeroDisplay: 'stripIfInteger',\n },\n currency,\n } as const;\n return pollyfilledFormatNumberByParts(value, options);\n }\n\n default: {\n const options = {\n intlOptions: {\n maximumFractionDigits: 0,\n roundingMode: 'floor',\n },\n currency,\n } as const;\n return pollyfilledFormatNumberByParts(value, options);\n }\n }\n } catch (err: unknown) {\n return {\n integer: `${value}`,\n currency,\n };\n }\n};\n\nconst _Amount = ({\n value,\n suffix = 'decimals',\n type = 'body',\n size = 'medium',\n weight = 'regular',\n isAffixSubtle = true,\n isStrikethrough = false,\n color,\n currencyIndicator = 'currency-symbol',\n currency = 'INR',\n testID,\n ...rest\n}: AmountProps): ReactElement => {\n if (__DEV__) {\n if (typeof value !== 'number') {\n throwBladeError({\n message: '`value` prop must be of type `number` for Amount.',\n moduleName: 'Amount',\n });\n }\n // @ts-expect-error neutral color should throw error\n if (color === 'neutral') {\n throwBladeError({\n message: '`neutral` color is not supported.',\n moduleName: 'Amount',\n });\n }\n\n const bodySizes = objectKeysWithType(normalAmountSizes.body);\n if ((type === 'body' || !type) && !bodySizes.includes(size)) {\n throwBladeError({\n message: `size=\"${size}\" is not allowed with type=\"body\"`,\n moduleName: 'Amount',\n });\n }\n\n const displaySizes = objectKeysWithType(normalAmountSizes.display);\n if (type === 'display' && !displaySizes.includes(size)) {\n throwBladeError({\n message: `size=\"${size}\" is not allowed with type=\"display\"`,\n moduleName: 'Amount',\n });\n }\n\n const headingSizes = objectKeysWithType(normalAmountSizes.heading);\n if (type === 'heading' && !headingSizes.includes(size)) {\n throwBladeError({\n message: `size=\"${size}\" is not allowed with type=\"heading\"`,\n moduleName: 'Amount',\n });\n }\n }\n\n const { amountValueColor } = getTextColorProps({\n color,\n });\n\n const renderedValue = getAmountByParts({ suffix, value, currency });\n const isPrefixSymbol = renderedValue.isPrefixSymbol ?? true;\n const currencySymbol = renderedValue.currency ?? currency;\n\n const currencyPosition = isPrefixSymbol ? 'left' : 'right';\n const currencySymbolOrCode = currencyIndicator === 'currency-symbol' ? currencySymbol : currency;\n\n const currencyFontSize = isAffixSubtle\n ? subtleFontSizes[type][size]\n : normalAmountSizes[type][size];\n const isReactNative = getPlatformType() === 'react-native';\n\n return (\n <BaseBox\n display={(isReactNative ? 'flex' : 'inline-flex') as never}\n flexDirection=\"row\"\n {...metaAttribute({ name: MetaConstants.Amount, testID })}\n {...getStyledProps(rest)}\n {...makeAnalyticsAttribute(rest)}\n >\n <BaseBox\n display={(isReactNative ? 'flex' : 'inline-flex') as never}\n alignItems=\"baseline\"\n flexDirection=\"row\"\n position=\"relative\"\n >\n {renderedValue.minusSign ? (\n <BaseText\n fontSize={normalAmountSizes[type][size]}\n fontWeight={weight}\n lineHeight={amountLineHeights[type][size]}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n marginX=\"spacing.2\"\n >\n {renderedValue.minusSign}\n </BaseText>\n ) : null}\n {currencyPosition === 'left' && (\n <BaseText\n marginRight=\"spacing.1\"\n fontWeight={weight}\n fontSize={currencyFontSize}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n opacity={isAffixSubtle ? opacity[800] : 1}\n >\n {currencySymbolOrCode}\n </BaseText>\n )}\n <AmountValue\n amount={renderedValue}\n amountValueColor={amountValueColor}\n type={type}\n weight={weight}\n size={size}\n isAffixSubtle={isAffixSubtle}\n suffix={suffix}\n currency={currency}\n />\n {currencyPosition === 'right' && (\n <BaseText\n marginLeft=\"spacing.1\"\n fontWeight={weight}\n fontSize={currencyFontSize}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n opacity={isAffixSubtle ? opacity[800] : 1}\n >\n {currencySymbolOrCode}\n </BaseText>\n )}\n {isStrikethrough && (\n // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error\n // @ts-ignore: the borderBottomColor error below is thrown here as well\n <BaseBox\n // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error\n // @ts-ignore- intentionally setting the border color to the color prop for this hacky strikethrough\n borderBottomColor={amountValueColor}\n borderBottomWidth={type === 'body' ? 'thin' : 'thicker'}\n borderBottomStyle=\"solid\"\n position=\"absolute\"\n width=\"100%\"\n top=\"50%\"\n />\n )}\n </BaseBox>\n </BaseBox>\n );\n};\n\nconst Amount = assignWithoutSideEffects(_Amount, {\n displayName: 'Amount',\n componentId: 'Amount',\n});\n\nexport type { AmountProps };\nexport { Amount };\n"],"names":["stripTrailingZerosFromParts","parts","decimalPart","rawParts","filter","_ref","type","map","_ref2","value","join","hasFraction","some","_ref3","test","decimal","fraction","_ref4","pollyfilledFormatNumberByParts","options","_options$intlOptions","formatNumberByParts","intlOptions","trailingZeroDisplay","getTextColorProps","_ref5","color","props","amountValueColor","AmountValue","_ref6","amount","_ref6$size","size","_ref6$type","_ref6$weight","weight","isAffixSubtle","suffix","isReactNative","getPlatformType","affixFontSize","subtleFontSizes","normalAmountSizes","numberFontFamily","AmountWrapper","Text","React","Fragment","_jsxs","children","_jsx","BaseText","fontSize","fontWeight","lineHeight","amountLineHeights","fontFamily","as","undefined","integer","opacity","compact","getAmountByParts","_ref7","currency","maximumFractionDigits","minimumFractionDigits","notation","roundingMode","err","concat","_Amount","_ref8","_renderedValue$isPref","_renderedValue$curren","_ref8$suffix","_ref8$type","_ref8$size","_ref8$weight","_ref8$isAffixSubtle","_ref8$isStrikethrough","isStrikethrough","_ref8$currencyIndicat","currencyIndicator","_ref8$currency","testID","rest","_objectWithoutProperties","_excluded","throwBladeError","message","moduleName","bodySizes","objectKeysWithType","body","includes","displaySizes","display","headingSizes","heading","_getTextColorProps","renderedValue","isPrefixSymbol","currencySymbol","currencyPosition","currencySymbolOrCode","currencyFontSize","BaseBox","_objectSpread","flexDirection","metaAttribute","name","MetaConstants","Amount","getStyledProps","makeAnalyticsAttribute","alignItems","position","minusSign","marginX","marginRight","marginLeft","borderBottomColor","borderBottomWidth","borderBottomStyle","width","top","assignWithoutSideEffects","displayName","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,IAAMA,2BAA2B,GAAG,SAA9BA,2BAA2BA,CAC/BC,KAA6C,EACF;EAC3C,IAAMC,WAAW,GAAGD,KAAK,CAACE,QAAQ,CAC/BC,MAAM,CAAC,UAAAC,IAAA,EAAA;AAAA,IAAA,IAAGC,IAAI,GAAAD,IAAA,CAAJC,IAAI,CAAA;IAAA,OAAOA,IAAI,KAAK,UAAU,CAAA;AAAA,GAAA,CAAC,CACzCC,GAAG,CAAC,UAAAC,KAAA,EAAA;AAAA,IAAA,IAAGC,KAAK,GAAAD,KAAA,CAALC,KAAK,CAAA;AAAA,IAAA,OAAOA,KAAK,CAAA;AAAA,GAAA,CAAC,CACzBC,IAAI,CAAC,EAAE,CAAC,CAAA;EAEX,IAAMC,WAAW,GAAGV,KAAK,CAACE,QAAQ,CAACS,IAAI,CAAC,UAAAC,KAAA,EAAA;AAAA,I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AiB;AAC3BjF,QAAAA,KAAK,EAAEE,gBAAiB;AACxB8B,QAAAA,EAAE,EAAEnB,aAAa,GAAGoB,SAAS,GAAG,MAAO;QACvCE,OAAO,EAAExB,aAAa,GAAGwB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAE;AAAAX,QAAAA,QAAA,EAEzCwD,oBAAAA;OACO,CACX,EACAxB,eAAe;AAAA;AACd;AACA;AACA/B,MAAAA,GAAA,CAACyD,OAAAA;AACC;AACA;AAAA,QAAA;AACAe,QAAAA,iBAAiB,EAAE/F,gBAAiB;AACpCgG,QAAAA,iBAAiB,EAAEtH,IAAI,KAAK,MAAM,GAAG,MAAM,GAAG,SAAU;AACxDuH,QAAAA,iBAAiB,EAAC,OAAO;AACzBP,QAAAA,QAAQ,EAAC,UAAU;AACnBQ,QAAAA,KAAK,EAAC,MAAM;AACZC,QAAAA,GAAG,EAAC,KAAA;AAAK,OACV,CACF,CAAA;KACM,CAAA;AAAC,GAAA,CACH,CAAC,CAAA;AAEd,CAAC,CAAA;AAED,IAAMb,MAAM,gBAAGc,wBAAwB,CAACxD,OAAO,EAAE;AAC/CyD,EAAAA,WAAW,EAAE,QAAQ;AACrBC,EAAAA,WAAW,EAAE,QAAA;AACf,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"Amount.js","sources":["../../../../../../src/components/Amount/Amount.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport React from 'react';\nimport type { CurrencyCodeType } from '@razorpay/i18nify-js/currency';\nimport { formatNumberByParts } from '@razorpay/i18nify-js/currency';\nimport type { AmountTypeProps } from './amountTokens';\nimport { normalAmountSizes, subtleFontSizes, amountLineHeights } from './amountTokens';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { DataAnalyticsAttribute, BladeElementRef, TestID } from '~utils/types';\nimport { getPlatformType } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { throwBladeError } from '~utils/logger';\nimport { objectKeysWithType } from '~utils/objectKeysWithType';\nimport { BaseText } from '~components/Typography/BaseText';\nimport { Text } from '~components/Typography';\nimport { opacity } from '~tokens/global';\nimport type { FontFamily } from '~tokens/global';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\n/**\n * Pollyfill function to get around the node 18 error\n *\n * This function is maintained by i18nify team. Reach out to them for any change regarding this.\n */\nconst stripTrailingZerosFromParts = (\n parts: ReturnType<typeof formatNumberByParts>,\n): ReturnType<typeof formatNumberByParts> => {\n const decimalPart = parts.rawParts\n .filter(({ type }) => type === 'fraction')\n .map(({ value }) => value)\n .join('');\n\n const hasFraction = parts.rawParts.some(({ type }) => type === 'fraction');\n\n if (hasFraction && /^0+$/.test(decimalPart)) {\n delete parts.decimal;\n delete parts.fraction;\n parts.rawParts = parts.rawParts.filter(({ type }) => type !== 'decimal' && type !== 'fraction');\n }\n\n return parts;\n};\n\n/**\n * Wrapper that uses pollyfill of i18nify team\n */\nconst pollyfilledFormatNumberByParts: typeof formatNumberByParts = (value, options) => {\n const parts = formatNumberByParts(value, options);\n\n if (options?.intlOptions?.trailingZeroDisplay === 'stripIfInteger') {\n return stripTrailingZerosFromParts(parts);\n }\n\n return parts;\n};\n\ntype AmountCommonProps = {\n /**\n * The value to be rendered within the component.\n *\n */\n value: number;\n /**\n * Sets the color of the amount.\n *\n * @default undefined\n */\n color?: BaseTextProps['color'];\n /**\n * Indicates what the suffix of amount should be\n *\n * @default 'decimals'\n */\n suffix?: 'decimals' | 'none' | 'humanize';\n /**\n * Makes the currency indicator(currency symbol/code) and decimal digits small and faded\n *\n * @default true\n */\n isAffixSubtle?: true | false;\n /**\n * Determines the visual representation of the currency, choose between displaying the currency symbol or code.\n *\n * Note: Currency symbol and code is determined by the locale set in user's browser or set via @razorpay/i18nify-react library.\n *\n * @default 'currency-symbol'\n */\n currencyIndicator?: 'currency-symbol' | 'currency-code';\n /**\n * The currency of the amount. Note that this component\n * only displays the provided value in the specified currency, it does not perform any currency conversion.\n *\n * @default 'INR'\n * */\n currency?: CurrencyCodeType;\n /**\n * If true, the amount text will have a line through it.\n *\n * @default false\n */\n isStrikethrough?: boolean;\n} & TestID &\n DataAnalyticsAttribute &\n StyledPropsBlade;\n\ntype ColorProps = {\n amountValueColor: BaseTextProps['color'];\n};\n\ntype AmountProps = AmountTypeProps & AmountCommonProps;\n\nconst getTextColorProps = ({ color }: { color: AmountProps['color'] }): ColorProps => {\n const props: ColorProps = {\n amountValueColor: 'surface.text.gray.normal',\n };\n if (!color) return props;\n props.amountValueColor = color;\n return props;\n};\n\ntype AmountType = Partial<ReturnType<typeof formatNumberByParts>>;\n\ninterface AmountValue extends Omit<AmountProps, 'value'> {\n amountValueColor: BaseTextProps['color'];\n amount: AmountType;\n size: Exclude<AmountProps['size'], undefined>;\n}\n\nconst AmountValue = ({\n amount,\n size = 'medium',\n type = 'body',\n weight = 'regular',\n amountValueColor,\n isAffixSubtle,\n suffix,\n}: AmountValue): ReactElement => {\n const isReactNative = getPlatformType() === 'react-native';\n const affixFontSize = isAffixSubtle ? subtleFontSizes[type][size] : normalAmountSizes[type][size];\n const numberFontFamily: keyof FontFamily = type === 'body' ? 'text' : 'heading';\n if (suffix === 'decimals' && isAffixSubtle) {\n // Native does not support alignItems of Text inside a div, instead we need to wrap is in a Text\n const AmountWrapper = isReactNative ? Text : React.Fragment;\n\n return (\n <AmountWrapper>\n <BaseText\n fontSize={normalAmountSizes[type][size]}\n fontWeight={weight}\n lineHeight={amountLineHeights[type][size]}\n color={amountValueColor}\n fontFamily={numberFontFamily}\n as={isReactNative ? undefined : 'span'}\n >\n {amount.integer}\n </BaseText>\n <BaseText\n fontWeight={weight}\n fontSize={affixFontSize}\n fontFamily={numberFontFamily}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n opacity={isAffixSubtle ? opacity[800] : 1}\n >\n {amount.decimal}\n {amount.fraction}\n </BaseText>\n </AmountWrapper>\n );\n }\n\n return (\n <BaseText\n fontSize={normalAmountSizes[type][size]}\n fontWeight={weight}\n fontFamily={numberFontFamily}\n color={amountValueColor}\n lineHeight={amountLineHeights[type][size]}\n >\n {amount.integer}\n {amount.decimal}\n {amount.fraction}\n {amount.compact}\n </BaseText>\n );\n};\n\ntype FormatAmountWithSuffixType = {\n suffix: AmountProps['suffix'];\n value: number;\n currency: AmountProps['currency'];\n};\n\n/**\n * Returns a parsed object based on the suffix passed in parameters\n * === Logic ===\n * value = 12500.45 \n * if suffix === 'decimals' => {\n \"integer\": \"12,500\",\n \"decimal\": \".\",\n \"fraction\": \"45\",\n \"compact\": \"K\",\n \"isPrefixSymbol\": false,\n \"rawParts\": [{\"type\": \"integer\",\"value\": \"12\"},{\"type\": \"group\",\"value\": \",\"},{\"type\": \"integer\",\"value\": \"500\"},{\"type\": \"decimal\",\"value\": \".\"},{\"type\": \"fraction\",\"value\": \"45\"}]\n}\n * @returns {AmountType}\n */\nexport const getAmountByParts = ({\n suffix,\n value,\n currency,\n}: FormatAmountWithSuffixType): AmountType => {\n try {\n switch (suffix) {\n case 'decimals': {\n const options = {\n intlOptions: {\n maximumFractionDigits: 2,\n minimumFractionDigits: 2,\n },\n currency,\n } as const;\n return pollyfilledFormatNumberByParts(value, options);\n }\n case 'humanize': {\n const options = {\n intlOptions: {\n notation: 'compact',\n maximumFractionDigits: 2,\n trailingZeroDisplay: 'stripIfInteger',\n },\n currency,\n } as const;\n return pollyfilledFormatNumberByParts(value, options);\n }\n\n default: {\n const options = {\n intlOptions: {\n maximumFractionDigits: 0,\n roundingMode: 'floor',\n },\n currency,\n } as const;\n return pollyfilledFormatNumberByParts(value, options);\n }\n }\n } catch (err: unknown) {\n return {\n integer: `${value}`,\n currency,\n };\n }\n};\n\nconst _Amount = (\n {\n value,\n suffix = 'decimals',\n type = 'body',\n size = 'medium',\n weight = 'regular',\n isAffixSubtle = true,\n isStrikethrough = false,\n color,\n currencyIndicator = 'currency-symbol',\n currency = 'INR',\n testID,\n ...rest\n }: AmountProps,\n ref: React.Ref<BladeElementRef>,\n): ReactElement => {\n if (__DEV__) {\n if (typeof value !== 'number') {\n throwBladeError({\n message: '`value` prop must be of type `number` for Amount.',\n moduleName: 'Amount',\n });\n }\n // @ts-expect-error neutral color should throw error\n if (color === 'neutral') {\n throwBladeError({\n message: '`neutral` color is not supported.',\n moduleName: 'Amount',\n });\n }\n\n const bodySizes = objectKeysWithType(normalAmountSizes.body);\n if ((type === 'body' || !type) && !bodySizes.includes(size)) {\n throwBladeError({\n message: `size=\"${size}\" is not allowed with type=\"body\"`,\n moduleName: 'Amount',\n });\n }\n\n const displaySizes = objectKeysWithType(normalAmountSizes.display);\n if (type === 'display' && !displaySizes.includes(size)) {\n throwBladeError({\n message: `size=\"${size}\" is not allowed with type=\"display\"`,\n moduleName: 'Amount',\n });\n }\n\n const headingSizes = objectKeysWithType(normalAmountSizes.heading);\n if (type === 'heading' && !headingSizes.includes(size)) {\n throwBladeError({\n message: `size=\"${size}\" is not allowed with type=\"heading\"`,\n moduleName: 'Amount',\n });\n }\n }\n\n const { amountValueColor } = getTextColorProps({\n color,\n });\n\n const renderedValue = getAmountByParts({ suffix, value, currency });\n const isPrefixSymbol = renderedValue.isPrefixSymbol ?? true;\n const currencySymbol = renderedValue.currency ?? currency;\n\n const currencyPosition = isPrefixSymbol ? 'left' : 'right';\n const currencySymbolOrCode = currencyIndicator === 'currency-symbol' ? currencySymbol : currency;\n\n const currencyFontSize = isAffixSubtle\n ? subtleFontSizes[type][size]\n : normalAmountSizes[type][size];\n const isReactNative = getPlatformType() === 'react-native';\n\n return (\n <BaseBox\n ref={ref as never}\n display={(isReactNative ? 'flex' : 'inline-flex') as never}\n flexDirection=\"row\"\n {...metaAttribute({ name: MetaConstants.Amount, testID })}\n {...getStyledProps(rest)}\n {...makeAnalyticsAttribute(rest)}\n >\n <BaseBox\n display={(isReactNative ? 'flex' : 'inline-flex') as never}\n alignItems=\"baseline\"\n flexDirection=\"row\"\n position=\"relative\"\n >\n {renderedValue.minusSign ? (\n <BaseText\n fontSize={normalAmountSizes[type][size]}\n fontWeight={weight}\n lineHeight={amountLineHeights[type][size]}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n marginX=\"spacing.2\"\n >\n {renderedValue.minusSign}\n </BaseText>\n ) : null}\n {currencyPosition === 'left' && (\n <BaseText\n marginRight=\"spacing.1\"\n fontWeight={weight}\n fontSize={currencyFontSize}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n opacity={isAffixSubtle ? opacity[800] : 1}\n >\n {currencySymbolOrCode}\n </BaseText>\n )}\n <AmountValue\n amount={renderedValue}\n amountValueColor={amountValueColor}\n type={type}\n weight={weight}\n size={size}\n isAffixSubtle={isAffixSubtle}\n suffix={suffix}\n currency={currency}\n />\n {currencyPosition === 'right' && (\n <BaseText\n marginLeft=\"spacing.1\"\n fontWeight={weight}\n fontSize={currencyFontSize}\n color={amountValueColor}\n as={isReactNative ? undefined : 'span'}\n opacity={isAffixSubtle ? opacity[800] : 1}\n >\n {currencySymbolOrCode}\n </BaseText>\n )}\n {isStrikethrough && (\n // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error\n // @ts-ignore: the borderBottomColor error below is thrown here as well\n <BaseBox\n // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error\n // @ts-ignore- intentionally setting the border color to the color prop for this hacky strikethrough\n borderBottomColor={amountValueColor}\n borderBottomWidth={type === 'body' ? 'thin' : 'thicker'}\n borderBottomStyle=\"solid\"\n position=\"absolute\"\n width=\"100%\"\n top=\"50%\"\n />\n )}\n </BaseBox>\n </BaseBox>\n );\n};\n\nconst Amount = assignWithoutSideEffects(React.forwardRef(_Amount), {\n displayName: 'Amount',\n componentId: 'Amount',\n});\n\nexport type { AmountProps };\nexport { Amount };\n"],"names":["stripTrailingZerosFromParts","parts","decimalPart","rawParts","filter","_ref","type","map","_ref2","value","join","hasFraction","some","_ref3","test","decimal","fraction","_ref4","pollyfilledFormatNumberByParts","options","_options$intlOptions","formatNumberByParts","intlOptions","trailingZeroDisplay","getTextColorProps","_ref5","color","props","amountValueColor","AmountValue","_ref6","amount","_ref6$size","size","_ref6$type","_ref6$weight","weight","isAffixSubtle","suffix","isReactNative","getPlatformType","affixFontSize","subtleFontSizes","normalAmountSizes","numberFontFamily","AmountWrapper","Text","React","Fragment","_jsxs","children","_jsx","BaseText","fontSize","fontWeight","lineHeight","amountLineHeights","fontFamily","as","undefined","integer","opacity","compact","getAmountByParts","_ref7","currency","maximumFractionDigits","minimumFractionDigits","notation","roundingMode","err","concat","_Amount","_ref8","ref","_renderedValue$isPref","_renderedValue$curren","_ref8$suffix","_ref8$type","_ref8$size","_ref8$weight","_ref8$isAffixSubtle","_ref8$isStrikethrough","isStrikethrough","_ref8$currencyIndicat","currencyIndicator","_ref8$currency","testID","rest","_objectWithoutProperties","_excluded","throwBladeError","message","moduleName","bodySizes","objectKeysWithType","body","includes","displaySizes","display","headingSizes","heading","_getTextColorProps","renderedValue","isPrefixSymbol","currencySymbol","currencyPosition","currencySymbolOrCode","currencyFontSize","BaseBox","_objectSpread","flexDirection","metaAttribute","name","MetaConstants","Amount","getStyledProps","makeAnalyticsAttribute","alignItems","position","minusSign","marginX","marginRight","marginLeft","borderBottomColor","borderBottomWidth","borderBottomStyle","width","top","assignWithoutSideEffects","forwardRef","displayName","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,IAAMA,2BAA2B,GAAG,SAA9BA,2BAA2BA,CAC/BC,KAA6C,EACF;EAC3C,IAAMC,WAAW,GAAGD,KAAK,CAACE,QAAQ,CAC/BC,MAAM,CAAC,UAAAC,IAAA,EAAA;AAAA,IAAA,IAAGC,IAAI,GAAAD,IAAA,CAAJC,IAAI,CAAA;IAAA,OAAOA,IAAI,KAAK,UAAU,CAAA;AAAA,GAAA,CAAC,CACzCC,G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,QAAAA,IAAI,EAAEA,IAAK;AACXI,QAAAA,aAAa,EAAEA,aAAc;AAC7BC,QAAAA,MAAM,EAAEA,MAAO;AACf2B,QAAAA,QAAQ,EAAEA,QAAAA;OACX,CAAC,EACDyC,gBAAgB,KAAK,OAAO,iBAC3BvD,GAAA,CAACC,QAAQ,EAAA;AACPuE,QAAAA,UAAU,EAAC,WAAW;AACtBrE,QAAAA,UAAU,EAAElB,MAAO;AACnBiB,QAAAA,QAAQ,EAAEuD,gBAAiB;AAC3BlF,QAAAA,KAAK,EAAEE,gBAAiB;AACxB8B,QAAAA,EAAE,EAAEnB,aAAa,GAAGoB,SAAS,GAAG,MAAO;QACvCE,OAAO,EAAExB,aAAa,GAAGwB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAE;AAAAX,QAAAA,QAAA,EAEzCyD,oBAAAA;OACO,CACX,EACAxB,eAAe;AAAA;AACd;AACA;AACAhC,MAAAA,GAAA,CAAC0D,OAAAA;AACC;AACA;AAAA,QAAA;AACAe,QAAAA,iBAAiB,EAAEhG,gBAAiB;AACpCiG,QAAAA,iBAAiB,EAAEvH,IAAI,KAAK,MAAM,GAAG,MAAM,GAAG,SAAU;AACxDwH,QAAAA,iBAAiB,EAAC,OAAO;AACzBP,QAAAA,QAAQ,EAAC,UAAU;AACnBQ,QAAAA,KAAK,EAAC,MAAM;AACZC,QAAAA,GAAG,EAAC,KAAA;AAAK,OACV,CACF,CAAA;KACM,CAAA;AAAC,GAAA,CACH,CAAC,CAAA;AAEd,CAAC,CAAA;AAEKb,IAAAA,MAAM,gBAAGc,wBAAwB,eAAClF,cAAK,CAACmF,UAAU,CAAC1D,OAAO,CAAC,EAAE;AACjE2D,EAAAA,WAAW,EAAE,QAAQ;AACrBC,EAAAA,WAAW,EAAE,QAAA;AACf,CAAC;;;;"}
|
package/build/lib/web/production/components/AnimateInteractions/AnimateInteractionsProvider.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
var AnimateInteractionsContext = /*#__PURE__*/React__default.createContext({
|
|
4
|
+
isInsideAnimateInteractionsContainer: false
|
|
5
|
+
});
|
|
6
|
+
var useAnimateInteractions = function useAnimateInteractions() {
|
|
7
|
+
var animateInteractionsContextValue = React__default.useContext(AnimateInteractionsContext);
|
|
8
|
+
return animateInteractionsContextValue;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { AnimateInteractionsContext, useAnimateInteractions };
|
|
12
|
+
//# sourceMappingURL=AnimateInteractionsProvider.js.map
|
package/build/lib/web/production/components/AnimateInteractions/AnimateInteractionsProvider.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimateInteractionsProvider.js","sources":["../../../../../../src/components/AnimateInteractions/AnimateInteractionsProvider.tsx"],"sourcesContent":["import React from 'react';\n\ntype AnimateInteractionsContextType = {\n isInsideAnimateInteractionsContainer: boolean;\n};\n\nconst AnimateInteractionsContext = React.createContext<AnimateInteractionsContextType>({\n isInsideAnimateInteractionsContainer: false,\n});\n\nconst useAnimateInteractions = (): AnimateInteractionsContextType => {\n const animateInteractionsContextValue = React.useContext(AnimateInteractionsContext);\n return animateInteractionsContextValue;\n};\n\nexport { useAnimateInteractions, AnimateInteractionsContext };\n"],"names":["AnimateInteractionsContext","React","createContext","isInsideAnimateInteractionsContainer","useAnimateInteractions","animateInteractionsContextValue","useContext"],"mappings":";;AAMA,IAAMA,0BAA0B,gBAAGC,cAAK,CAACC,aAAa,CAAiC;AACrFC,EAAAA,oCAAoC,EAAE,KAAA;AACxC,CAAC,EAAC;AAEF,IAAMC,sBAAsB,GAAG,SAAzBA,sBAAsBA,GAAyC;AACnE,EAAA,IAAMC,+BAA+B,GAAGJ,cAAK,CAACK,UAAU,CAACN,0BAA0B,CAAC,CAAA;AACpF,EAAA,OAAOK,+BAA+B,CAAA;AACxC;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
|
+
import React__default from 'react';
|
|
3
4
|
import { StyledBadge } from './StyledBadge.web.js';
|
|
4
5
|
import { badgeHeight, horizontalPadding, iconPadding, iconSize } from './badgeTokens.js';
|
|
5
6
|
import '../Box/BaseBox/index.js';
|
|
@@ -48,7 +49,7 @@ var getColorProps = function getColorProps(_ref) {
|
|
|
48
49
|
}
|
|
49
50
|
return props;
|
|
50
51
|
};
|
|
51
|
-
var _Badge = function _Badge(_ref2) {
|
|
52
|
+
var _Badge = function _Badge(_ref2, ref) {
|
|
52
53
|
var children = _ref2.children,
|
|
53
54
|
_ref2$emphasis = _ref2.emphasis,
|
|
54
55
|
emphasis = _ref2$emphasis === void 0 ? 'subtle' : _ref2$emphasis,
|
|
@@ -90,6 +91,7 @@ var _Badge = function _Badge(_ref2) {
|
|
|
90
91
|
}
|
|
91
92
|
};
|
|
92
93
|
return /*#__PURE__*/jsx(BaseBox, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
94
|
+
ref: ref,
|
|
93
95
|
display: isReactNative() ? 'flex' : 'inline-flex'
|
|
94
96
|
}, metaAttribute({
|
|
95
97
|
name: MetaConstants.Badge,
|
|
@@ -124,7 +126,7 @@ var _Badge = function _Badge(_ref2) {
|
|
|
124
126
|
})
|
|
125
127
|
}));
|
|
126
128
|
};
|
|
127
|
-
var Badge = /*#__PURE__*/assignWithoutSideEffects(_Badge, {
|
|
129
|
+
var Badge = /*#__PURE__*/assignWithoutSideEffects( /*#__PURE__*/React__default.forwardRef(_Badge), {
|
|
128
130
|
displayName: 'Badge',
|
|
129
131
|
componentId: 'Badge'
|
|
130
132
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","sources":["../../../../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport type { StyledBadgeProps } from './types';\nimport { StyledBadge } from './StyledBadge';\nimport { iconPadding, iconSize, horizontalPadding, badgeHeight } from './badgeTokens';\nimport type { IconComponent, IconProps } from '~components/Icons';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { FeedbackColors, SubtleOrIntense } from '~tokens/theme/theme';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\nimport { Text } from '~components/Typography';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport type { DataAnalyticsAttribute, StringChildrenType, TestID } from '~utils/types';\nimport { getStringFromReactText } from '~src/utils/getStringChildren';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { isReactNative, makeSize } from '~utils';\nimport { throwBladeError } from '~utils/logger';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype BadgeProps = {\n /**\n * Sets the label for the badge.\n *\n */\n children: StringChildrenType;\n /**\n * Sets the color of the badge.\n *\n * @default 'neutral'\n */\n color?: FeedbackColors | 'primary';\n /**\n * Sets the contrast of the badge.\n *\n * @default 'subtle'\n */\n emphasis?: SubtleOrIntense;\n /**\n * Sets the size of the badge.\n *\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n /**\n * Icon to be displayed in the badge.\n * Accepts a component of type `IconComponent` from Blade.\n *\n */\n icon?: IconComponent;\n} & TestID &\n StyledPropsBlade &\n DataAnalyticsAttribute;\n\ntype ColorProps = {\n iconColor: IconProps['color'];\n textColor: BaseTextProps['color'];\n backgroundColor: StyledBadgeProps['backgroundColor'];\n};\n\nconst getColorProps = ({\n color,\n emphasis,\n}: {\n color: NonNullable<BadgeProps['color']>;\n emphasis: NonNullable<BadgeProps['emphasis']>;\n}): ColorProps => {\n const props: ColorProps = {\n iconColor: 'feedback.icon.neutral.intense',\n textColor: 'feedback.text.neutral.intense',\n backgroundColor: 'feedback.background.neutral.subtle',\n };\n\n if (color === 'primary') {\n // primary color badge\n props.textColor =\n emphasis === 'intense' ? `surface.text.staticWhite.normal` : `surface.text.primary.normal`;\n props.iconColor =\n emphasis === 'intense' ? `surface.icon.staticWhite.normal` : `surface.icon.primary.normal`;\n props.backgroundColor = `surface.background.primary.${emphasis}`;\n } else {\n // feedback colors badge\n props.textColor =\n emphasis === 'intense' ? `surface.text.staticWhite.normal` : `feedback.text.${color}.intense`;\n props.iconColor =\n emphasis === 'intense' ? `surface.icon.staticWhite.normal` : `feedback.icon.${color}.intense`;\n props.backgroundColor = `feedback.background.${color}.${emphasis}`;\n }\n\n return props;\n};\n\nconst _Badge = ({\n children,\n emphasis = 'subtle',\n icon: Icon,\n size = 'medium',\n color = 'neutral',\n testID,\n ...props\n}: BadgeProps): ReactElement => {\n const childrenString = getStringFromReactText(children);\n if (__DEV__) {\n if (!childrenString?.trim()) {\n throwBladeError({\n message: 'Text as children is required for Badge.',\n moduleName: 'Badge',\n });\n }\n }\n\n const { backgroundColor, iconColor, textColor } = getColorProps({\n color,\n emphasis,\n });\n\n const badgeTextSizes = {\n small: {\n variant: 'body',\n size: 'xsmall',\n },\n medium: {\n variant: 'body',\n size: 'small',\n },\n large: {\n variant: 'body',\n size: 'small',\n },\n } as const;\n\n return (\n <BaseBox\n display={(isReactNative() ? 'flex' : 'inline-flex') as never}\n {...metaAttribute({ name: MetaConstants.Badge, testID })}\n {...getStyledProps(props)}\n {...makeAnalyticsAttribute(props)}\n >\n <StyledBadge\n height={makeSize(badgeHeight[size])}\n backgroundColor={backgroundColor}\n size={size}\n textAlign={'left' as never}\n >\n <BaseBox\n paddingX={horizontalPadding[size]}\n display=\"flex\"\n flexDirection=\"row\"\n justifyContent=\"center\"\n alignItems=\"center\"\n overflow=\"hidden\"\n >\n {Icon ? (\n <BaseBox paddingRight={Boolean(Icon) ? iconPadding[size] : 'spacing.0'} display=\"flex\">\n <Icon color={iconColor} size={iconSize[size]} />\n </BaseBox>\n ) : null}\n <Text {...badgeTextSizes[size]} weight=\"medium\" truncateAfterLines={1} color={textColor}>\n {children}\n </Text>\n </BaseBox>\n </StyledBadge>\n </BaseBox>\n );\n};\n\nconst Badge = assignWithoutSideEffects(_Badge, {\n displayName: 'Badge',\n componentId: 'Badge',\n});\n\nexport type { BadgeProps };\nexport { Badge };\n"],"names":["getColorProps","_ref","color","emphasis","props","iconColor","textColor","backgroundColor","concat","_Badge","_ref2","children","_ref2$emphasis","Icon","icon","_ref2$size","size","_ref2$color","testID","_objectWithoutProperties","_excluded","childrenString","getStringFromReactText","trim","throwBladeError","message","moduleName","_getColorProps","badgeTextSizes","small","variant","medium","large","_jsx","BaseBox","_objectSpread","display","isReactNative","metaAttribute","name","MetaConstants","Badge","getStyledProps","makeAnalyticsAttribute","StyledBadge","height","makeSize","badgeHeight","textAlign","_jsxs","paddingX","horizontalPadding","flexDirection","justifyContent","alignItems","overflow","paddingRight","Boolean","iconPadding","iconSize","Text","weight","truncateAfterLines","assignWithoutSideEffects","displayName","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAAC,IAAA,EAMD;AAAA,EAAA,IALhBC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,QAAQ,GAAAF,IAAA,CAARE,QAAQ,CAAA;AAKR,EAAA,IAAMC,KAAiB,GAAG;AACxBC,IAAAA,SAAS,EAAE,+BAA+B;AAC1CC,IAAAA,SAAS,EAAE,+BAA+B;AAC1CC,IAAAA,eAAe,EAAE,oCAAA;GAClB,CAAA;EAED,IAAIL,KAAK,KAAK,SAAS,EAAE;AACvB;AACAE,IAAAA,KAAK,CAACE,SAAS,GACbH,QAAQ,KAAK,SAAS,GAAoE,iCAAA,GAAA,6BAAA,CAAA;AAC5FC,IAAAA,KAAK,CAACC,SAAS,GACbF,QAAQ,KAAK,SAAS,GAAoE,iCAAA,GAAA,6BAAA,CAAA;AAC5FC,IAAAA,KAAK,CAACG,eAAe,GAAA,6BAAA,CAAAC,MAAA,CAAiCL,QAA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AAE;AAC7CuD,EAAAA,WAAW,EAAE,OAAO;AACpBC,EAAAA,WAAW,EAAE,OAAA;AACf,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"Badge.js","sources":["../../../../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import React from 'react';\nimport type { ReactElement } from 'react';\nimport type { StyledBadgeProps } from './types';\nimport { StyledBadge } from './StyledBadge';\nimport { iconPadding, iconSize, horizontalPadding, badgeHeight } from './badgeTokens';\nimport type { IconComponent, IconProps } from '~components/Icons';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { FeedbackColors, SubtleOrIntense } from '~tokens/theme/theme';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\nimport { Text } from '~components/Typography';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport type {\n DataAnalyticsAttribute,\n BladeElementRef,\n StringChildrenType,\n TestID,\n} from '~utils/types';\nimport { getStringFromReactText } from '~src/utils/getStringChildren';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { isReactNative, makeSize } from '~utils';\nimport { throwBladeError } from '~utils/logger';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype BadgeProps = {\n /**\n * Sets the label for the badge.\n *\n */\n children: StringChildrenType;\n /**\n * Sets the color of the badge.\n *\n * @default 'neutral'\n */\n color?: FeedbackColors | 'primary';\n /**\n * Sets the contrast of the badge.\n *\n * @default 'subtle'\n */\n emphasis?: SubtleOrIntense;\n /**\n * Sets the size of the badge.\n *\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n /**\n * Icon to be displayed in the badge.\n * Accepts a component of type `IconComponent` from Blade.\n *\n */\n icon?: IconComponent;\n} & TestID &\n StyledPropsBlade &\n DataAnalyticsAttribute;\n\ntype ColorProps = {\n iconColor: IconProps['color'];\n textColor: BaseTextProps['color'];\n backgroundColor: StyledBadgeProps['backgroundColor'];\n};\n\nconst getColorProps = ({\n color,\n emphasis,\n}: {\n color: NonNullable<BadgeProps['color']>;\n emphasis: NonNullable<BadgeProps['emphasis']>;\n}): ColorProps => {\n const props: ColorProps = {\n iconColor: 'feedback.icon.neutral.intense',\n textColor: 'feedback.text.neutral.intense',\n backgroundColor: 'feedback.background.neutral.subtle',\n };\n\n if (color === 'primary') {\n // primary color badge\n props.textColor =\n emphasis === 'intense' ? `surface.text.staticWhite.normal` : `surface.text.primary.normal`;\n props.iconColor =\n emphasis === 'intense' ? `surface.icon.staticWhite.normal` : `surface.icon.primary.normal`;\n props.backgroundColor = `surface.background.primary.${emphasis}`;\n } else {\n // feedback colors badge\n props.textColor =\n emphasis === 'intense' ? `surface.text.staticWhite.normal` : `feedback.text.${color}.intense`;\n props.iconColor =\n emphasis === 'intense' ? `surface.icon.staticWhite.normal` : `feedback.icon.${color}.intense`;\n props.backgroundColor = `feedback.background.${color}.${emphasis}`;\n }\n\n return props;\n};\n\nconst _Badge = (\n {\n children,\n emphasis = 'subtle',\n icon: Icon,\n size = 'medium',\n color = 'neutral',\n testID,\n ...props\n }: BadgeProps,\n ref: React.Ref<BladeElementRef>,\n): ReactElement => {\n const childrenString = getStringFromReactText(children);\n if (__DEV__) {\n if (!childrenString?.trim()) {\n throwBladeError({\n message: 'Text as children is required for Badge.',\n moduleName: 'Badge',\n });\n }\n }\n\n const { backgroundColor, iconColor, textColor } = getColorProps({\n color,\n emphasis,\n });\n\n const badgeTextSizes = {\n small: {\n variant: 'body',\n size: 'xsmall',\n },\n medium: {\n variant: 'body',\n size: 'small',\n },\n large: {\n variant: 'body',\n size: 'small',\n },\n } as const;\n\n return (\n <BaseBox\n ref={ref as never}\n display={(isReactNative() ? 'flex' : 'inline-flex') as never}\n {...metaAttribute({ name: MetaConstants.Badge, testID })}\n {...getStyledProps(props)}\n {...makeAnalyticsAttribute(props)}\n >\n <StyledBadge\n height={makeSize(badgeHeight[size])}\n backgroundColor={backgroundColor}\n size={size}\n textAlign={'left' as never}\n >\n <BaseBox\n paddingX={horizontalPadding[size]}\n display=\"flex\"\n flexDirection=\"row\"\n justifyContent=\"center\"\n alignItems=\"center\"\n overflow=\"hidden\"\n >\n {Icon ? (\n <BaseBox paddingRight={Boolean(Icon) ? iconPadding[size] : 'spacing.0'} display=\"flex\">\n <Icon color={iconColor} size={iconSize[size]} />\n </BaseBox>\n ) : null}\n <Text {...badgeTextSizes[size]} weight=\"medium\" truncateAfterLines={1} color={textColor}>\n {children}\n </Text>\n </BaseBox>\n </StyledBadge>\n </BaseBox>\n );\n};\n\nconst Badge = assignWithoutSideEffects(React.forwardRef(_Badge), {\n displayName: 'Badge',\n componentId: 'Badge',\n});\n\nexport type { BadgeProps };\nexport { Badge };\n"],"names":["getColorProps","_ref","color","emphasis","props","iconColor","textColor","backgroundColor","concat","_Badge","_ref2","ref","children","_ref2$emphasis","Icon","icon","_ref2$size","size","_ref2$color","testID","_objectWithoutProperties","_excluded","childrenString","getStringFromReactText","trim","throwBladeError","message","moduleName","_getColorProps","badgeTextSizes","small","variant","medium","large","_jsx","BaseBox","_objectSpread","display","isReactNative","metaAttribute","name","MetaConstants","Badge","getStyledProps","makeAnalyticsAttribute","StyledBadge","height","makeSize","badgeHeight","textAlign","_jsxs","paddingX","horizontalPadding","flexDirection","justifyContent","alignItems","overflow","paddingRight","Boolean","iconPadding","iconSize","Text","weight","truncateAfterLines","assignWithoutSideEffects","React","forwardRef","displayName","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAAC,IAAA,EAMD;AAAA,EAAA,IALhBC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,QAAQ,GAAAF,IAAA,CAARE,QAAQ,CAAA;AAKR,EAAA,IAAMC,KAAiB,GAAG;AACxBC,IAAAA,SAAS,EAAE,+BAA+B;AAC1CC,IAAAA,SAAS,EAAE,+BAA+B;AAC1CC,IAAAA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AzB,aAAA,CAAAA,aAAA,CAAA,EAAA,EAAKP,cAAc,CAACZ,IAAI,CAAC,CAAA,EAAA,EAAA,EAAA;AAAE6C,UAAAA,MAAM,EAAC,QAAQ;AAACC,UAAAA,kBAAkB,EAAE,CAAE;AAAC7D,UAAAA,KAAK,EAAEI,SAAU;AAAAM,UAAAA,QAAA,EACrFA,QAAAA;AAAQ,SAAA,CACL,CAAC,CAAA;OACA,CAAA;KACE,CAAA;AAAC,GAAA,CACP,CAAC,CAAA;AAEd,CAAC,CAAA;AAEK8B,IAAAA,KAAK,gBAAGsB,wBAAwB,eAACC,cAAK,CAACC,UAAU,CAACzD,MAAM,CAAC,EAAE;AAC/D0D,EAAAA,WAAW,EAAE,OAAO;AACpBC,EAAAA,WAAW,EAAE,OAAA;AACf,CAAC;;;;"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
import { m, AnimatePresence } from 'framer-motion';
|
|
5
|
+
import styled from 'styled-components';
|
|
6
|
+
import { mergeRefs } from '@mantine/hooks';
|
|
7
|
+
import { makeAnimationVariables, useMotionVariants } from './baseMotionUtils.js';
|
|
8
|
+
import { useAnimateInteractions } from '../AnimateInteractions/AnimateInteractionsProvider.js';
|
|
9
|
+
import { useStagger } from '../Stagger/StaggerProvider.js';
|
|
10
|
+
import { useMemoizedStyles } from '../Box/BaseBox/useMemoizedStyles.web.js';
|
|
11
|
+
import { jsx } from 'react/jsx-runtime';
|
|
12
|
+
|
|
13
|
+
var _excluded = ["children", "motionVariants", "type", "motionTriggers", "animateVisibility"],
|
|
14
|
+
_excluded2 = ["children"];
|
|
15
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
|
+
// Creating empty styled component so that the final component supports `as` prop
|
|
18
|
+
var StyledDiv = /*#__PURE__*/styled.div.withConfig({
|
|
19
|
+
displayName: "BaseMotion__StyledDiv",
|
|
20
|
+
componentId: "sc-6hsu2h-0"
|
|
21
|
+
})(function (props) {
|
|
22
|
+
// We're turning normal div into Box here because our BaseBox does not forward the props to next component which is needed for enhancer component wrapper
|
|
23
|
+
var boxStyles = useMemoizedStyles(props);
|
|
24
|
+
return boxStyles;
|
|
25
|
+
});
|
|
26
|
+
var MotionDiv = m(StyledDiv);
|
|
27
|
+
var _BaseMotionBox = function _BaseMotionBox(_ref, ref) {
|
|
28
|
+
var children = _ref.children,
|
|
29
|
+
userMotionVariants = _ref.motionVariants,
|
|
30
|
+
_ref$type = _ref.type,
|
|
31
|
+
type = _ref$type === void 0 ? 'inout' : _ref$type,
|
|
32
|
+
_ref$motionTriggers = _ref.motionTriggers,
|
|
33
|
+
motionTriggers = _ref$motionTriggers === void 0 ? ['mount'] : _ref$motionTriggers,
|
|
34
|
+
animateVisibility = _ref.animateVisibility,
|
|
35
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
36
|
+
var _useAnimateInteractio = useAnimateInteractions(),
|
|
37
|
+
isInsideAnimateInteractionsContainer = _useAnimateInteractio.isInsideAnimateInteractionsContainer;
|
|
38
|
+
var _useStagger = useStagger(),
|
|
39
|
+
isInsideStaggerContainer = _useStagger.isInsideStaggerContainer,
|
|
40
|
+
staggerType = _useStagger.staggerType;
|
|
41
|
+
var shouldSkipAnimationVariables = isInsideAnimateInteractionsContainer && motionTriggers.includes('on-animate-interactions') || isInsideStaggerContainer;
|
|
42
|
+
var animationVariables = shouldSkipAnimationVariables ? {} : makeAnimationVariables(motionTriggers, {
|
|
43
|
+
animateVisibility: animateVisibility
|
|
44
|
+
});
|
|
45
|
+
var motionVariants = useMotionVariants(userMotionVariants, isInsideStaggerContainer ? staggerType : type);
|
|
46
|
+
return /*#__PURE__*/jsx(MotionDiv, _objectSpread(_objectSpread(_objectSpread({
|
|
47
|
+
ref: ref,
|
|
48
|
+
viewport: {
|
|
49
|
+
amount: 0.8,
|
|
50
|
+
once: true
|
|
51
|
+
},
|
|
52
|
+
variants: motionVariants
|
|
53
|
+
}, animationVariables), rest), {}, {
|
|
54
|
+
children: children
|
|
55
|
+
}));
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Base motion component that handles animation variables, reduced motion, type and motionTriggers prop, etc
|
|
60
|
+
*/
|
|
61
|
+
var BaseMotionBox = /*#__PURE__*/React__default.forwardRef(_BaseMotionBox);
|
|
62
|
+
var _BaseMotionEnhancerBox = function _BaseMotionEnhancerBox(_ref2, ref) {
|
|
63
|
+
var children = _ref2.children,
|
|
64
|
+
motionBoxArgs = _objectWithoutProperties(_ref2, _excluded2);
|
|
65
|
+
return /*#__PURE__*/jsx(BaseMotionBox
|
|
66
|
+
// we need the ref of this item in AnimateInteractions to pass down ref that adds focusWithin logic
|
|
67
|
+
, _objectSpread(_objectSpread({
|
|
68
|
+
ref: mergeRefs(children.props.ref, ref),
|
|
69
|
+
as: children.type
|
|
70
|
+
}, motionBoxArgs), children.props));
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Used in AnimateInteraction, Scale, etc
|
|
75
|
+
*
|
|
76
|
+
* Enhances the child to add motion support
|
|
77
|
+
*/
|
|
78
|
+
var BaseMotionEnhancerBox = /*#__PURE__*/React__default.forwardRef(_BaseMotionEnhancerBox);
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Base component for entry / exit animations
|
|
82
|
+
*
|
|
83
|
+
* Handles states, entry exit controls, animation variables, mount / unmount, etc
|
|
84
|
+
*/
|
|
85
|
+
var BaseMotionEntryExit = function BaseMotionEntryExit(_ref3) {
|
|
86
|
+
var children = _ref3.children,
|
|
87
|
+
motionVariants = _ref3.motionVariants,
|
|
88
|
+
_ref3$isVisible = _ref3.isVisible,
|
|
89
|
+
isVisible = _ref3$isVisible === void 0 ? true : _ref3$isVisible,
|
|
90
|
+
_ref3$type = _ref3.type,
|
|
91
|
+
type = _ref3$type === void 0 ? 'inout' : _ref3$type,
|
|
92
|
+
_ref3$motionTriggers = _ref3.motionTriggers,
|
|
93
|
+
motionTriggers = _ref3$motionTriggers === void 0 ? ['mount'] : _ref3$motionTriggers,
|
|
94
|
+
_ref3$shouldUnmountWh = _ref3.shouldUnmountWhenHidden,
|
|
95
|
+
shouldUnmountWhenHidden = _ref3$shouldUnmountWh === void 0 ? false : _ref3$shouldUnmountWh;
|
|
96
|
+
// Only need AnimatePresence when we have to unmount the component
|
|
97
|
+
var AnimateWrapper = shouldUnmountWhenHidden ? AnimatePresence : React__default.Fragment;
|
|
98
|
+
// keep it always mounted when shouldUnmountWhenHidden is false
|
|
99
|
+
var isMounted = shouldUnmountWhenHidden ? isVisible : true;
|
|
100
|
+
var motionMeta = React__default.useMemo(function () {
|
|
101
|
+
return {
|
|
102
|
+
isEnhanced: true,
|
|
103
|
+
// @ts-expect-error: ref does exist on children prop
|
|
104
|
+
innerRef: children.ref
|
|
105
|
+
};
|
|
106
|
+
// @ts-expect-error: ref does exist on children prop
|
|
107
|
+
}, [children.ref]);
|
|
108
|
+
return /*#__PURE__*/jsx(AnimateWrapper, {
|
|
109
|
+
children: isMounted ? /*#__PURE__*/jsx(BaseMotionBox, _objectSpread(_objectSpread(_objectSpread({
|
|
110
|
+
as: children.type,
|
|
111
|
+
motionVariants: motionVariants,
|
|
112
|
+
motionTriggers: motionTriggers,
|
|
113
|
+
type: type
|
|
114
|
+
}, shouldUnmountWhenHidden ? {} : {
|
|
115
|
+
animateVisibility: isVisible ? 'animate' : 'exit'
|
|
116
|
+
}), children.props), {}, {
|
|
117
|
+
_motionMeta: motionMeta
|
|
118
|
+
})) : null
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export { BaseMotionBox, BaseMotionEnhancerBox, BaseMotionEntryExit, MotionDiv };
|
|
123
|
+
//# sourceMappingURL=BaseMotion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseMotion.js","sources":["../../../../../../src/components/BaseMotion/BaseMotion.tsx"],"sourcesContent":["import React from 'react';\nimport { m as motion, AnimatePresence } from 'framer-motion';\nimport styled from 'styled-components';\nimport { mergeRefs } from '@mantine/hooks';\nimport type { BaseMotionBoxProps, MotionMeta, BaseMotionEntryExitProps } from './types';\nimport { makeAnimationVariables, useMotionVariants } from './baseMotionUtils';\nimport { useAnimateInteractions } from '~components/AnimateInteractions/AnimateInteractionsProvider';\nimport { useStagger } from '~components/Stagger/StaggerProvider';\nimport type { BladeElementRef } from '~utils/types';\nimport { useMemoizedStyles } from '~components/Box/BaseBox/useMemoizedStyles';\nimport type { BoxProps } from '~components/Box';\nimport type { Theme } from '~components/BladeProvider';\n\n// Creating empty styled component so that the final component supports `as` prop\nconst StyledDiv = styled.div((props: BoxProps & { theme: Theme }) => {\n // We're turning normal div into Box here because our BaseBox does not forward the props to next component which is needed for enhancer component wrapper\n const boxStyles = useMemoizedStyles(props);\n return boxStyles;\n});\n\nconst MotionDiv = motion(StyledDiv);\n\nconst _BaseMotionBox = (\n {\n children,\n motionVariants: userMotionVariants,\n type = 'inout',\n motionTriggers = ['mount'],\n animateVisibility,\n ...rest\n }: BaseMotionBoxProps,\n ref: React.Ref<BladeElementRef>,\n): React.ReactElement => {\n const { isInsideAnimateInteractionsContainer } = useAnimateInteractions();\n const { isInsideStaggerContainer, staggerType } = useStagger();\n const shouldSkipAnimationVariables =\n (isInsideAnimateInteractionsContainer && motionTriggers.includes('on-animate-interactions')) ||\n isInsideStaggerContainer;\n\n const animationVariables = shouldSkipAnimationVariables\n ? {}\n : makeAnimationVariables(motionTriggers, {\n animateVisibility,\n });\n\n const motionVariants = useMotionVariants(\n userMotionVariants,\n isInsideStaggerContainer ? staggerType : type,\n );\n\n return (\n <MotionDiv\n ref={ref as never}\n viewport={{ amount: 0.8, once: true }}\n variants={motionVariants}\n {...animationVariables}\n {...rest}\n >\n {children}\n </MotionDiv>\n );\n};\n\n/**\n * Base motion component that handles animation variables, reduced motion, type and motionTriggers prop, etc\n */\nconst BaseMotionBox = React.forwardRef(_BaseMotionBox);\n\nconst _BaseMotionEnhancerBox: React.ForwardRefRenderFunction<HTMLDivElement, BaseMotionBoxProps> = (\n { children, ...motionBoxArgs },\n ref,\n) => {\n return (\n <BaseMotionBox\n // we need the ref of this item in AnimateInteractions to pass down ref that adds focusWithin logic\n ref={mergeRefs(children.props.ref, ref)}\n as={children.type}\n {...motionBoxArgs}\n // We pass the props of children and not pass the children itself since the `as` prop already renders the children and we don't want to re-render it inside\n {...children.props}\n />\n );\n};\n\n/**\n * Used in AnimateInteraction, Scale, etc\n *\n * Enhances the child to add motion support\n */\nconst BaseMotionEnhancerBox = React.forwardRef(_BaseMotionEnhancerBox);\n\n/**\n * Base component for entry / exit animations\n *\n * Handles states, entry exit controls, animation variables, mount / unmount, etc\n */\nconst BaseMotionEntryExit = ({\n children,\n motionVariants,\n isVisible = true,\n type = 'inout',\n motionTriggers = ['mount'],\n shouldUnmountWhenHidden = false,\n}: BaseMotionEntryExitProps): React.ReactElement => {\n // Only need AnimatePresence when we have to unmount the component\n const AnimateWrapper = shouldUnmountWhenHidden ? AnimatePresence : React.Fragment;\n // keep it always mounted when shouldUnmountWhenHidden is false\n const isMounted = shouldUnmountWhenHidden ? isVisible : true;\n\n const motionMeta: MotionMeta = React.useMemo(() => {\n return {\n isEnhanced: true,\n // @ts-expect-error: ref does exist on children prop\n innerRef: children.ref,\n };\n // @ts-expect-error: ref does exist on children prop\n }, [children.ref]);\n\n return (\n <AnimateWrapper>\n {isMounted ? (\n <BaseMotionBox\n as={children.type}\n motionVariants={motionVariants}\n motionTriggers={motionTriggers}\n type={type}\n {...(shouldUnmountWhenHidden\n ? {}\n : { animateVisibility: isVisible ? 'animate' : 'exit' })}\n // We pass the props of children and not pass the children itself since the `as` prop already renders the children and we don't want to re-render it inside\n {...children.props}\n _motionMeta={motionMeta}\n />\n ) : null}\n </AnimateWrapper>\n );\n};\n\nexport { MotionDiv, BaseMotionBox, BaseMotionEnhancerBox, BaseMotionEntryExit };\n"],"names":["StyledDiv","styled","div","withConfig","displayName","componentId","props","boxStyles","useMemoizedStyles","MotionDiv","motion","_BaseMotionBox","_ref","ref","children","userMotionVariants","motionVariants","_ref$type","type","_ref$motionTriggers","motionTriggers","animateVisibility","rest","_objectWithoutProperties","_excluded","_useAnimateInteractio","useAnimateInteractions","isInsideAnimateInteractionsContainer","_useStagger","useStagger","isInsideStaggerContainer","staggerType","shouldSkipAnimationVariables","includes","animationVariables","makeAnimationVariables","useMotionVariants","_jsx","_objectSpread","viewport","amount","once","variants","BaseMotionBox","React","forwardRef","_BaseMotionEnhancerBox","_ref2","motionBoxArgs","_excluded2","mergeRefs","as","BaseMotionEnhancerBox","BaseMotionEntryExit","_ref3","_ref3$isVisible","isVisible","_ref3$type","_ref3$motionTriggers","_ref3$shouldUnmountWh","shouldUnmountWhenHidden","AnimateWrapper","AnimatePresence","Fragment","isMounted","motionMeta","useMemo","isEnhanced","innerRef","_motionMeta"],"mappings":";;;;;;;;;;;;;;;;AAaA;AACA,IAAMA,SAAS,gBAAGC,MAAM,CAACC,GAAG,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,uBAAA;EAAAC,WAAA,EAAA,aAAA;AAAA,CAAC,CAAA,CAAA,UAACC,KAAkC,EAAK;AACnE;AACA,EAAA,IAAMC,SA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AA,cAAc,EAAEA,cAAe;AAC/BF,MAAAA,IAAI,EAAEA,IAAAA;AAAK,KAAA,EACN0C,uBAAuB,GACxB,EAAE,GACF;AAAEvC,MAAAA,iBAAiB,EAAEmC,SAAS,GAAG,SAAS,GAAG,MAAA;KAAQ,CAAA,EAErD1C,QAAQ,CAACR,KAAK,CAAA,EAAA,EAAA,EAAA;AAClB+D,MAAAA,WAAW,EAAEJ,UAAAA;AAAW,KAAA,CACzB,CAAC,GACA,IAAA;AAAI,GACM,CAAC,CAAA;AAErB;;;;"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
// This type is exported in new framer-motion versions but does not exist in earlier versions so adding it manually here
|
|
6
|
+
|
|
7
|
+
var motionTriggersArrayToGesturePropsMap = {
|
|
8
|
+
mount: 'animate',
|
|
9
|
+
hover: 'whileHover',
|
|
10
|
+
'in-view': 'whileInView',
|
|
11
|
+
tap: 'whileTap',
|
|
12
|
+
focus: 'whileFocus'
|
|
13
|
+
};
|
|
14
|
+
var makeAnimationVariables = function makeAnimationVariables(motionTriggers, _ref) {
|
|
15
|
+
var animateVisibility = _ref.animateVisibility;
|
|
16
|
+
var interactionVariables = motionTriggers.reduce(function (prevProps, currentTrigger) {
|
|
17
|
+
if (currentTrigger === 'on-animate-interactions') {
|
|
18
|
+
return prevProps;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Sometimes animations are conditional. In those cases we use those conditional values in animate
|
|
22
|
+
if (currentTrigger === 'mount' && animateVisibility) {
|
|
23
|
+
prevProps.animate = animateVisibility;
|
|
24
|
+
return prevProps;
|
|
25
|
+
}
|
|
26
|
+
prevProps[motionTriggersArrayToGesturePropsMap[currentTrigger]] = 'animate';
|
|
27
|
+
return prevProps;
|
|
28
|
+
}, {});
|
|
29
|
+
return _objectSpread({
|
|
30
|
+
initial: 'initial',
|
|
31
|
+
exit: 'exit'
|
|
32
|
+
}, interactionVariables);
|
|
33
|
+
};
|
|
34
|
+
var useMotionVariants = function useMotionVariants(motionVariants, type) {
|
|
35
|
+
var _motionVariants$anima, _motionVariants$anima2, _motionVariants$anima3, _motionVariants$exit$;
|
|
36
|
+
if (!motionVariants) {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
var shouldSkipEntryAnimation = type === 'out';
|
|
40
|
+
var shouldSkipExitAnimation = type === 'in';
|
|
41
|
+
|
|
42
|
+
// We override durations to stop animations but still continue with the expected position changes
|
|
43
|
+
var newMotionVariants = {
|
|
44
|
+
initial: _objectSpread({}, motionVariants.initial),
|
|
45
|
+
animate: _objectSpread(_objectSpread({}, motionVariants.animate), {}, {
|
|
46
|
+
transition: _objectSpread(_objectSpread({}, (_motionVariants$anima = motionVariants.animate) === null || _motionVariants$anima === void 0 ? void 0 : _motionVariants$anima.transition), {}, {
|
|
47
|
+
duration: shouldSkipEntryAnimation ? 0.0001 : (_motionVariants$anima2 = motionVariants.animate) === null || _motionVariants$anima2 === void 0 ? void 0 : (_motionVariants$anima3 = _motionVariants$anima2.transition) === null || _motionVariants$anima3 === void 0 ? void 0 : _motionVariants$anima3.duration
|
|
48
|
+
})
|
|
49
|
+
}),
|
|
50
|
+
exit: _objectSpread(_objectSpread({}, motionVariants.exit), {}, {
|
|
51
|
+
transition: _objectSpread(_objectSpread({}, motionVariants.exit.transition), {}, {
|
|
52
|
+
duration: shouldSkipExitAnimation ? 0.0001 : (_motionVariants$exit$ = motionVariants.exit.transition) === null || _motionVariants$exit$ === void 0 ? void 0 : _motionVariants$exit$.duration
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
};
|
|
56
|
+
return newMotionVariants;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export { makeAnimationVariables, useMotionVariants };
|
|
60
|
+
//# sourceMappingURL=baseMotionUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseMotionUtils.js","sources":["../../../../../../src/components/BaseMotion/baseMotionUtils.ts"],"sourcesContent":["import type { BaseMotionBoxProps, MotionTriggersType, MotionVariantsType } from './types';\n\n// This type is exported in new framer-motion versions but does not exist in earlier versions so adding it manually here\ntype AnimationType = 'animate' | 'whileHover' | 'whileInView' | 'whileTap' | 'whileFocus';\n\nconst motionTriggersArrayToGesturePropsMap: Record<\n Exclude<MotionTriggersType, 'on-animate-interactions'>,\n AnimationType\n> = {\n mount: 'animate',\n hover: 'whileHover',\n 'in-view': 'whileInView',\n tap: 'whileTap',\n focus: 'whileFocus',\n};\n\ntype AnimationVariablesType = Partial<\n Record<Exclude<AnimationType, 'animate'>, keyof MotionVariantsType>\n> & {\n animate?: BaseMotionBoxProps['animateVisibility'] | BaseMotionBoxProps['animate'];\n};\n\nconst makeAnimationVariables = (\n motionTriggers: MotionTriggersType[],\n { animateVisibility }: { animateVisibility: BaseMotionBoxProps['animateVisibility'] },\n): AnimationVariablesType & {\n initial: string;\n exit: string;\n} => {\n const interactionVariables = motionTriggers.reduce<AnimationVariablesType>(\n (prevProps, currentTrigger) => {\n if (currentTrigger === 'on-animate-interactions') {\n return prevProps;\n }\n\n // Sometimes animations are conditional. In those cases we use those conditional values in animate\n if (currentTrigger === 'mount' && animateVisibility) {\n prevProps.animate = animateVisibility;\n return prevProps;\n }\n\n prevProps[motionTriggersArrayToGesturePropsMap[currentTrigger]] = 'animate';\n return prevProps;\n },\n {},\n );\n\n return { initial: 'initial', exit: 'exit', ...interactionVariables };\n};\n\nconst useMotionVariants = (\n motionVariants: BaseMotionBoxProps['motionVariants'],\n type: BaseMotionBoxProps['type'],\n): BaseMotionBoxProps['motionVariants'] => {\n if (!motionVariants) {\n return undefined;\n }\n\n const shouldSkipEntryAnimation = type === 'out';\n const shouldSkipExitAnimation = type === 'in';\n\n // We override durations to stop animations but still continue with the expected position changes\n const newMotionVariants: BaseMotionBoxProps['motionVariants'] = {\n initial: {\n ...motionVariants.initial,\n },\n animate: {\n ...motionVariants.animate,\n transition: {\n ...motionVariants.animate?.transition,\n duration: shouldSkipEntryAnimation ? 0.0001 : motionVariants.animate?.transition?.duration,\n },\n },\n exit: {\n ...motionVariants.exit,\n transition: {\n ...motionVariants.exit.transition,\n duration: shouldSkipExitAnimation ? 0.0001 : motionVariants.exit.transition?.duration,\n },\n },\n };\n\n return newMotionVariants;\n};\n\nexport { makeAnimationVariables, useMotionVariants };\n"],"names":["motionTriggersArrayToGesturePropsMap","mount","hover","tap","focus","makeAnimationVariables","motionTriggers","_ref","animateVisibility","interactionVariables","reduce","prevProps","currentTrigger","animate","_objectSpread","initial","exit","useMotionVariants","motionVariants","type","_motionVariants$anima","_motionVariants$anima2","_motionVariants$anima3","_motionVariants$exit$","undefined","shouldSkipEntryAnimation","shouldSkipExitAnimation","newMotionVariants","transition","duration"],"mappings":";;;;AAEA;;AAGA,IAAMA,oCAGL,GAAG;AACFC,EAAAA,KAAK,EAAE,SAAS;AAChBC,EAAAA,KAAK,EAAE,YAAY;AACnB,EAAA,SAAS,EAAE,aAAa;AACxBC,EAAAA,GAAG,EAAE,UAAU;AACfC,EAAAA,KAAK,EAAE,YAAA;AACT,CAAC,CAAA;AAQKC,IAAAA,sBAAsB,GAAG,SAAzBA,sBAAsBA,CAC1BC,cAAoC,EAAAC,IAAA,EAKjC;AAAA,EA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"names":[],"mappings":""}
|
|
@@ -29,7 +29,7 @@ var _excluded = ["children", "zIndex", "testID"],
|
|
|
29
29
|
_excluded2 = ["title", "href", "rel", "target", "as", "isActive", "onClick", "icon", "testID"];
|
|
30
30
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
31
31
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
32
|
-
var
|
|
32
|
+
var _BottomNav = function _BottomNav(_ref, ref) {
|
|
33
33
|
var children = _ref.children,
|
|
34
34
|
_ref$zIndex = _ref.zIndex,
|
|
35
35
|
zIndex = _ref$zIndex === void 0 ? componentZIndices.bottomNav : _ref$zIndex,
|
|
@@ -45,6 +45,7 @@ var BottomNav = function BottomNav(_ref) {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
return /*#__PURE__*/jsx(BaseBox, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
48
|
+
ref: ref,
|
|
48
49
|
role: "navigation",
|
|
49
50
|
position: "fixed",
|
|
50
51
|
bottom: "spacing.0",
|
|
@@ -77,7 +78,7 @@ var StyledBottomNavItem = /*#__PURE__*/styled(BaseBox).withConfig({
|
|
|
77
78
|
border: 'none',
|
|
78
79
|
paddingLeft: makeSpace(props.theme.spacing[0]),
|
|
79
80
|
paddingRight: makeSpace(props.theme.spacing[0]),
|
|
80
|
-
transition: "color ".concat(makeMotionTime(props.theme.motion.duration['2xquick']), " ").concat(props.theme.motion.easing.standard
|
|
81
|
+
transition: "color ".concat(makeMotionTime(props.theme.motion.duration['2xquick']), " ").concat(props.theme.motion.easing.standard),
|
|
81
82
|
'&[aria-current="page"]': {
|
|
82
83
|
color: props.theme.colors.interactive.text.primary.subtle
|
|
83
84
|
},
|
|
@@ -135,6 +136,7 @@ var BottomNavItem = function BottomNavItem(_ref2) {
|
|
|
135
136
|
})]
|
|
136
137
|
}));
|
|
137
138
|
};
|
|
139
|
+
var BottomNav = /*#__PURE__*/React__default.forwardRef(_BottomNav);
|
|
138
140
|
|
|
139
141
|
export { BottomNav, BottomNavItem };
|
|
140
142
|
//# sourceMappingURL=BottomNav.web.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomNav.web.js","sources":["../../../../../../src/components/BottomNav/BottomNav.web.tsx"],"sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\nimport type { BottomNavItemProps, BottomNavProps } from './types';\nimport BaseBox from '~components/Box/BaseBox';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport { Text } from '~components/Typography';\nimport { makeMotionTime, makeSpace } from '~utils';\nimport { componentZIndices } from '~utils/componentZIndices';\nimport { getFocusRingStyles } from '~utils/getFocusRingStyles';\nimport { throwBladeError } from '~utils/logger';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\n/**\n * ### BottomNav component\n *\n * Bottom navigation component is a persistent user interface element at the bottom of a mobile app screen, providing quick access to core functionalities through icons and labels.\n *\n * ---\n *\n * #### Usage\n *\n * ```jsx\n * import { NavLink } from 'react-router-dom';\n *\n * <BottomNav>\n * <BottomNavItem\n * as={NavLink}\n * isActive={true}\n * title=\"Payments\"\n * icon={WalletIcon}\n * href=\"/payments\"\n * />\n * <BottomNavItem\n * as={NavLink}\n * title=\"Transactions\"\n * icon={TransactionsIcon}\n * href=\"/transactions\"\n * />\n * <BottomNavItem\n * title=\"More\"\n * icon={MoreIcon}\n * onClick={() => {\n * // This can be used to open SideNav drawer\n * setIsSideNavOpen(true)\n * }}\n * />\n * </BottomNav>\n * ```\n *\n * Checkout {@link https://blade.razorpay.com/??path=/docs/components-bottomnav--doc BottomNav Documentation}\n\n */\nconst BottomNav = ({\n children,\n zIndex = componentZIndices.bottomNav,\n testID,\n ...rest\n}: BottomNavProps): React.ReactElement => {\n if (__DEV__) {\n const childrenCount = React.Children.count(children);\n if (childrenCount > 5 && childrenCount < 2) {\n throwBladeError({\n moduleName: 'BottomNav',\n message: 'children cannot be less than 2 and more than 5',\n });\n }\n }\n\n return (\n <BaseBox\n role=\"navigation\"\n position=\"fixed\"\n bottom=\"spacing.0\"\n left=\"spacing.0\"\n elevation=\"midRaised\"\n width=\"100%\"\n backgroundColor=\"surface.background.gray.intense\"\n borderTopWidth=\"thin\"\n borderTopColor=\"surface.border.gray.muted\"\n paddingX=\"spacing.2\"\n display=\"flex\"\n flexDirection=\"row\"\n {...getStyledProps(rest)}\n zIndex={zIndex}\n {...metaAttribute({\n testID,\n name: MetaConstants.BottomNav,\n })}\n {...makeAnalyticsAttribute(rest)}\n >\n {children}\n </BaseBox>\n );\n};\n\nconst StyledBottomNavItem = styled(BaseBox)<{ to?: string }>((props) => {\n return {\n textDecoration: 'none',\n color: props.theme.colors.interactive.text.gray.subtle,\n backgroundColor: 'transparent',\n border: 'none',\n paddingLeft: makeSpace(props.theme.spacing[0]),\n paddingRight: makeSpace(props.theme.spacing[0]),\n transition: `color ${makeMotionTime(props.theme.motion.duration['2xquick'])} ${\n props.theme.motion.easing.standard.effective\n }`,\n '&[aria-current=\"page\"]': {\n color: props.theme.colors.interactive.text.primary.subtle,\n },\n '&:focus-visible': {\n ...getFocusRingStyles({ theme: props.theme }),\n },\n };\n});\n\nconst BottomNavItem = ({\n title,\n href,\n rel,\n target,\n as,\n isActive,\n onClick,\n icon: Icon,\n testID,\n ...rest\n}: BottomNavItemProps): React.ReactElement => {\n const isRouterLink = as && href;\n const defaultRenderElement = href ? 'a' : 'button';\n const defaultRel = target === '_blank' ? 'noreferrer noopener' : undefined;\n\n return (\n <StyledBottomNavItem\n as={isRouterLink ? as : defaultRenderElement}\n href={as ? undefined : href}\n to={href} // for react router\n rel={rel ?? defaultRel}\n target={target}\n paddingTop=\"spacing.5\"\n paddingBottom=\"spacing.4\"\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n flexDirection=\"column\"\n flex=\"1\"\n cursor=\"pointer\"\n onClick={onClick}\n gap=\"spacing.1\"\n {...makeAccessible({\n current: isActive ? 'page' : undefined,\n })}\n {...metaAttribute({\n name: MetaConstants.BottomNavItem,\n testID,\n })}\n {...makeAnalyticsAttribute(rest)}\n >\n <Icon color=\"currentColor\" size=\"large\" />\n <Text truncateAfterLines={1} color=\"currentColor\" size=\"xsmall\" weight=\"semibold\">\n {title}\n </Text>\n </StyledBottomNavItem>\n );\n};\n\nexport { BottomNav, BottomNavItem };\n"],"names":["BottomNav","_ref","children","_ref$zIndex","zIndex","componentZIndices","bottomNav","testID","rest","_objectWithoutProperties","_excluded","childrenCount","React","Children","count","throwBladeError","moduleName","message","_jsx","BaseBox","_objectSpread","role","position","bottom","left","elevation","width","backgroundColor","borderTopWidth","borderTopColor","paddingX","display","flexDirection","getStyledProps","metaAttribute","name","MetaConstants","makeAnalyticsAttribute","StyledBottomNavItem","styled","withConfig","displayName","componentId","props","textDecoration","color","theme","colors","interactive","text","gray","subtle","border","paddingLeft","makeSpace","spacing","paddingRight","transition","concat","makeMotionTime","motion","duration","easing","standard","effective","primary","getFocusRingStyles","BottomNavItem","_ref2","title","href","rel","target","as","isActive","onClick","Icon","icon","_excluded2","isRouterLink","defaultRenderElement","defaultRel","undefined","_jsxs","to","paddingTop","paddingBottom","alignItems","justifyContent","flex","cursor","gap","makeAccessible","current","size","Text","truncateAfterLines","weight"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,IAAMA,SAAS,GA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U,UAAW;AACvBT,IAAAA,MAAM,EAAEA,MAAO;AACfa,IAAAA,UAAU,EAAC,WAAW;AACtBC,IAAAA,aAAa,EAAC,WAAW;AACzBvD,IAAAA,OAAO,EAAC,MAAM;AACdwD,IAAAA,UAAU,EAAC,QAAQ;AACnBC,IAAAA,cAAc,EAAC,QAAQ;AACvBxD,IAAAA,aAAa,EAAC,QAAQ;AACtByD,IAAAA,IAAI,EAAC,GAAG;AACRC,IAAAA,MAAM,EAAC,SAAS;AAChBf,IAAAA,OAAO,EAAEA,OAAQ;AACjBgB,IAAAA,GAAG,EAAC,WAAA;AAAW,GAAA,EACXC,cAAc,CAAC;AACjBC,IAAAA,OAAO,EAAEnB,QAAQ,GAAG,MAAM,GAAGQ,SAAAA;GAC9B,CAAC,CACEhD,EAAAA,aAAa,CAAC;IAChBC,IAAI,EAAEC,aAAa,CAAC+B,aAAa;AACjC5D,IAAAA,MAAM,EAANA,MAAAA;AACF,GAAC,CAAC,CAAA,EACE8B,sBAAsB,CAAC7B,IAAI,CAAC,CAAA,EAAA,EAAA,EAAA;IAAAN,QAAA,EAAA,cAEhCgB,GAAA,CAAC0D,IAAI,EAAA;AAAC/B,MAAAA,KAAK,EAAC,cAAc;AAACiD,MAAAA,IAAI,EAAC,OAAA;AAAO,KAAE,CAAC,eAC1C5E,GAAA,CAAC6E,IAAI,EAAA;AAACC,MAAAA,kBAAkB,EAAE,CAAE;AAACnD,MAAAA,KAAK,EAAC,cAAc;AAACiD,MAAAA,IAAI,EAAC,QAAQ;AAACG,MAAAA,MAAM,EAAC,UAAU;AAAA/F,MAAAA,QAAA,EAC9EmE,KAAAA;AAAK,KACF,CAAC,CAAA;AAAA,GAAA,CACY,CAAC,CAAA;AAE1B;;;;"}
|
|
1
|
+
{"version":3,"file":"BottomNav.web.js","sources":["../../../../../../src/components/BottomNav/BottomNav.web.tsx"],"sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\nimport type { BottomNavItemProps, BottomNavProps } from './types';\nimport BaseBox from '~components/Box/BaseBox';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport { Text } from '~components/Typography';\nimport { makeMotionTime, makeSpace } from '~utils';\nimport { componentZIndices } from '~utils/componentZIndices';\nimport { getFocusRingStyles } from '~utils/getFocusRingStyles';\nimport { throwBladeError } from '~utils/logger';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { BladeElementRef } from '~utils/types';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\n/**\n * ### BottomNav component\n *\n * Bottom navigation component is a persistent user interface element at the bottom of a mobile app screen, providing quick access to core functionalities through icons and labels.\n *\n * ---\n *\n * #### Usage\n *\n * ```jsx\n * import { NavLink } from 'react-router-dom';\n *\n * <BottomNav>\n * <BottomNavItem\n * as={NavLink}\n * isActive={true}\n * title=\"Payments\"\n * icon={WalletIcon}\n * href=\"/payments\"\n * />\n * <BottomNavItem\n * as={NavLink}\n * title=\"Transactions\"\n * icon={TransactionsIcon}\n * href=\"/transactions\"\n * />\n * <BottomNavItem\n * title=\"More\"\n * icon={MoreIcon}\n * onClick={() => {\n * // This can be used to open SideNav drawer\n * setIsSideNavOpen(true)\n * }}\n * />\n * </BottomNav>\n * ```\n *\n * Checkout {@link https://blade.razorpay.com/??path=/docs/components-bottomnav--doc BottomNav Documentation}\n\n */\nconst _BottomNav = (\n { children, zIndex = componentZIndices.bottomNav, testID, ...rest }: BottomNavProps,\n ref: React.Ref<BladeElementRef>,\n): React.ReactElement => {\n if (__DEV__) {\n const childrenCount = React.Children.count(children);\n if (childrenCount > 5 && childrenCount < 2) {\n throwBladeError({\n moduleName: 'BottomNav',\n message: 'children cannot be less than 2 and more than 5',\n });\n }\n }\n\n return (\n <BaseBox\n ref={ref as never}\n role=\"navigation\"\n position=\"fixed\"\n bottom=\"spacing.0\"\n left=\"spacing.0\"\n elevation=\"midRaised\"\n width=\"100%\"\n backgroundColor=\"surface.background.gray.intense\"\n borderTopWidth=\"thin\"\n borderTopColor=\"surface.border.gray.muted\"\n paddingX=\"spacing.2\"\n display=\"flex\"\n flexDirection=\"row\"\n {...getStyledProps(rest)}\n zIndex={zIndex}\n {...metaAttribute({\n testID,\n name: MetaConstants.BottomNav,\n })}\n {...makeAnalyticsAttribute(rest)}\n >\n {children}\n </BaseBox>\n );\n};\n\nconst StyledBottomNavItem = styled(BaseBox)<{ to?: string }>((props) => {\n return {\n textDecoration: 'none',\n color: props.theme.colors.interactive.text.gray.subtle,\n backgroundColor: 'transparent',\n border: 'none',\n paddingLeft: makeSpace(props.theme.spacing[0]),\n paddingRight: makeSpace(props.theme.spacing[0]),\n transition: `color ${makeMotionTime(props.theme.motion.duration['2xquick'])} ${\n props.theme.motion.easing.standard\n }`,\n '&[aria-current=\"page\"]': {\n color: props.theme.colors.interactive.text.primary.subtle,\n },\n '&:focus-visible': {\n ...getFocusRingStyles({ theme: props.theme }),\n },\n };\n});\n\nconst BottomNavItem = ({\n title,\n href,\n rel,\n target,\n as,\n isActive,\n onClick,\n icon: Icon,\n testID,\n ...rest\n}: BottomNavItemProps): React.ReactElement => {\n const isRouterLink = as && href;\n const defaultRenderElement = href ? 'a' : 'button';\n const defaultRel = target === '_blank' ? 'noreferrer noopener' : undefined;\n\n return (\n <StyledBottomNavItem\n as={isRouterLink ? as : defaultRenderElement}\n href={as ? undefined : href}\n to={href} // for react router\n rel={rel ?? defaultRel}\n target={target}\n paddingTop=\"spacing.5\"\n paddingBottom=\"spacing.4\"\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n flexDirection=\"column\"\n flex=\"1\"\n cursor=\"pointer\"\n onClick={onClick}\n gap=\"spacing.1\"\n {...makeAccessible({\n current: isActive ? 'page' : undefined,\n })}\n {...metaAttribute({\n name: MetaConstants.BottomNavItem,\n testID,\n })}\n {...makeAnalyticsAttribute(rest)}\n >\n <Icon color=\"currentColor\" size=\"large\" />\n <Text truncateAfterLines={1} color=\"currentColor\" size=\"xsmall\" weight=\"semibold\">\n {title}\n </Text>\n </StyledBottomNavItem>\n );\n};\n\nconst BottomNav = React.forwardRef(_BottomNav);\n\nexport { BottomNav, BottomNavItem };\n"],"names":["_BottomNav","_ref","ref","children","_ref$zIndex","zIndex","componentZIndices","bottomNav","testID","rest","_objectWithoutProperties","_excluded","childrenCount","React","Children","count","throwBladeError","moduleName","message","_jsx","BaseBox","_objectSpread","role","position","bottom","left","elevation","width","backgroundColor","borderTopWidth","borderTopColor","paddingX","display","flexDirection","getStyledProps","metaAttribute","name","MetaConstants","BottomNav","makeAnalyticsAttribute","StyledBottomNavItem","styled","withConfig","displayName","componentId","props","textDecoration","color","theme","colors","interactive","text","gray","subtle","border","paddingLeft","makeSpace","spacing","paddingRight","transition","concat","makeMotionTime","motion","duration","easing","standard","primary","getFocusRingStyles","BottomNavItem","_ref2","title","href","rel","target","as","isActive","onClick","Icon","icon","_excluded2","isRouterLink","defaultRenderElement","defaultRel","undefined","_jsxs","to","paddingTop","paddingBottom","alignItems","justifyContent","flex","cursor","gap","makeAccessible","current","size","Text","truncateAfterLines","weight","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDA,IAAMA,UAAU,GAAG,SAAbA,UAAUA,CAAAC,IAAA,EAEdC,GAA+B,EACR;AAAA,EAAA,IAFrBC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IAAAC,WAAA,GAAAH,IAAA,CAAEI,MAAM;AAANA,IAAAA,MAAM,GAAAD,WAAA,KAAA,KAAA,CAAA,GAAGE,iBAAiB,CAACC,SAAS,GAAAH,WAAA;IAAEI,MAAM,GAAAP,IAAA,CAANO,MAAM;AAAKC,IAAAA,IAAI,GAAAC,wBAAA,CAAAT,IAAA,EAAAU,SAAA,CAAA,CAAA;AAGjE,EAAA,IAAI,KAAO,EAAE;IACX,IAAMC,aAAa,GAAGC,cAAK,CAACC,QAAQ,CAACC,KAAK,CAACZ,QAAQ,CAAC,CAAA;AACpD,IAAA,IAAIS,aAAa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