@razorpay/blade 11.38.1 → 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/Icons/RayIcon/RayIcon.js +12 -0
- package/build/lib/native/components/Icons/RayIcon/RayIcon.js.map +1 -0
- 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 +6 -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/Icons/RayIcon/RayIcon.js +37 -0
- package/build/lib/web/development/components/Icons/RayIcon/RayIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/RayIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/RayIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/index.js +1 -0
- package/build/lib/web/development/components/Icons/index.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 +11 -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/Icons/RayIcon/RayIcon.js +37 -0
- package/build/lib/web/production/components/Icons/RayIcon/RayIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/RayIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/RayIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/index.js +1 -0
- package/build/lib/web/production/components/Icons/index.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 +11 -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 +17969 -5488
- package/build/types/components/index.native.d.ts +7924 -2157
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseHeader.js","sources":["../../../../../src/components/BaseHeaderFooter/BaseHeader.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react';\nimport type { ReactDOMAttributes } from '@use-gesture/react/dist/declarations/src/types';\nimport { Divider } from '~components/Divider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\nimport { IconButton } from '~components/Button/IconButton';\nimport { ChevronLeftIcon, CloseIcon } from '~components/Icons';\nimport type { DataAnalyticsAttribute, TestID } from '~utils/types';\nimport type { BoxProps } from '~components/Box';\nimport { Box } from '~components/Box';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { isReactNative, makeSize } from '~utils';\nimport { metaAttribute } from '~utils/metaAttribute';\nimport { logger, throwBladeError } from '~utils/logger';\nimport { size as sizeToken } from '~tokens/global';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype BaseHeaderProps = {\n title?: string;\n subtitle?: string;\n /**\n * Leading part of the header placed at the left most side of the header\n */\n leading?: React.ReactNode;\n /**\n * Trailing part of the header placed at the right most side of the header\n */\n trailing?: React.ReactNode;\n /**\n * Placed adjacent to the title text\n */\n titleSuffix?: React.ReactNode;\n /**\n * @default true\n */\n showDivider?: boolean;\n /**\n * @default false\n */\n showBackButton?: boolean;\n\n /**\n * Slot for rendering any trailing interaction element into BaseHeader.\n *\n * E.g. Used in accordion to render CollapsibleChevronIcon\n */\n trailingInteractionElement?: React.ReactNode;\n\n /**\n * Decides size of the Header\n */\n size?: 'large' | 'medium';\n /**\n * @default true\n */\n showCloseButton?: boolean;\n\n /**\n * Disabled state of BaseHeader\n *\n * @default false\n */\n isDisabled?: boolean;\n\n paddingX?: BoxProps['paddingX'];\n marginY?: BoxProps['marginY'];\n marginTop?: BoxProps['marginTop'];\n marginBottom?: BoxProps['marginBottom'];\n onCloseButtonClick?: () => void;\n onBackButtonClick?: () => void;\n closeButtonRef?: React.MutableRefObject<any>;\n backButtonRef?: React.MutableRefObject<any>;\n metaComponentName?: string;\n /**\n * inner child of BottomSheetHeader. Meant to be used for AutoComplete only\n */\n children?: React.ReactElement | React.ReactElement[];\n} & Pick<\n ReactDOMAttributes,\n | 'onClickCapture'\n | 'onKeyDown'\n | 'onKeyUp'\n | 'onLostPointerCapture'\n | 'onPointerCancel'\n | 'onPointerDown'\n | 'onPointerMove'\n | 'onPointerUp'\n> &\n TestID &\n DataAnalyticsAttribute;\n\ntype TrailingComponents = 'Button' | 'Badge' | 'Link' | 'Text' | 'Amount';\n\nconst commonCenterBoxProps: BoxProps = {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n};\n\nconst centerBoxProps: { large: BoxProps; medium: BoxProps } = {\n large: {\n ...commonCenterBoxProps,\n // We want to align title, icon, titleSuffix, trailing, closeButton to baseline\n // But we also want to keep them center aligned to each other\n // So we add a virtual Box around these slots with 28px and center align them to that box\n // We have done similar thing in figma as well (which is where this 28px comes from)\n height: '28px',\n },\n medium: {\n ...commonCenterBoxProps,\n height: '20px',\n },\n};\n\nconst sizeTokensMapping = {\n large: {\n title: 'large',\n },\n medium: {\n title: 'medium',\n },\n} as const;\n\n// prop restriction map for corresponding sub components\nconst propRestrictionMap = {\n large: {\n Button: {\n size: 'xsmall',\n variant: 'tertiary',\n },\n Badge: {\n size: 'medium',\n },\n Link: {\n size: 'medium',\n },\n Text: {\n size: 'medium',\n variant: 'body',\n },\n Amount: {\n type: 'body',\n size: 'medium',\n },\n },\n medium: {\n Button: {\n size: 'xsmall',\n variant: 'tertiary',\n },\n Badge: {\n size: 'small',\n },\n Link: {\n size: 'small',\n },\n Text: {\n size: 'small',\n variant: 'body',\n },\n Amount: {\n type: 'body',\n size: 'small',\n },\n },\n} as const;\n\nconst useTrailingRestriction = ({\n trailing,\n size,\n}: {\n size: NonNullable<BaseHeaderProps['size']>;\n trailing: BaseHeaderProps['trailing'];\n}): React.ReactNode => {\n const [\n validatedTrailingComponent,\n setValidatedTrailingComponent,\n ] = React.useState<React.ReactElement | null>(null);\n\n // validate and restrict sub component props in trailing prop\n React.useEffect(() => {\n if (React.isValidElement(trailing)) {\n const trailingComponentType = getComponentId(trailing) as TrailingComponents;\n const restrictedProps = propRestrictionMap[size][trailingComponentType];\n const allowedComponents = Object.keys(propRestrictionMap[size]);\n if (__DEV__) {\n if (!restrictedProps) {\n throwBladeError({\n message: `Only one of \\`${allowedComponents.join(\n ', ',\n )}\\` component is accepted as trailing`,\n moduleName: 'Header',\n });\n }\n }\n\n const restrictedPropKeys = Object.keys(propRestrictionMap[size][trailingComponentType]);\n for (const prop of restrictedPropKeys) {\n if (trailing?.props?.hasOwnProperty(prop)) {\n logger({\n message: `Do not pass \"${prop}\" to \"${trailingComponentType}\" while inside Header trailing, because we override it.`,\n moduleName: 'Header',\n type: 'warn',\n });\n }\n }\n setValidatedTrailingComponent(\n React.cloneElement(trailing as React.ReactElement, restrictedProps),\n );\n }\n }, [trailing, size]);\n\n return validatedTrailingComponent;\n};\n\nconst _BaseHeader = ({\n title,\n subtitle,\n leading,\n titleSuffix,\n trailing,\n showDivider = true,\n showBackButton = false,\n showCloseButton = true,\n onBackButtonClick,\n onCloseButtonClick,\n closeButtonRef,\n backButtonRef,\n testID,\n onClickCapture,\n onKeyDown,\n onKeyUp,\n onLostPointerCapture,\n onPointerCancel,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n metaComponentName,\n paddingX,\n marginY,\n marginBottom,\n marginTop,\n size = 'large',\n isDisabled,\n children,\n trailingInteractionElement,\n ...rest\n}: BaseHeaderProps): React.ReactElement => {\n const validatedTrailingComponent = useTrailingRestriction({ trailing, size });\n const shouldWrapTitle = titleSuffix && trailing && showBackButton && showCloseButton;\n\n const webOnlyEventHandlers: Record<string, any> = isReactNative()\n ? {}\n : {\n onClickCapture,\n onKeyDown,\n onKeyUp,\n onLostPointerCapture,\n onPointerCancel,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n };\n\n return (\n <BaseBox\n {...metaAttribute({ name: metaComponentName, testID })}\n {...makeAnalyticsAttribute(rest)}\n >\n <BaseBox\n marginY={marginY ?? { base: 'spacing.5', m: 'spacing.6' }}\n paddingX={paddingX ?? { base: 'spacing.5', m: 'spacing.6' }}\n marginTop={marginTop}\n marginBottom={marginBottom}\n touchAction=\"none\"\n {...webOnlyEventHandlers}\n >\n <BaseBox display=\"flex\" flexDirection=\"row\" userSelect=\"none\">\n {showBackButton ? (\n <BaseBox overflow=\"visible\" marginRight=\"spacing.5\">\n <Box {...centerBoxProps[size]}>\n <IconButton\n ref={backButtonRef}\n size=\"large\"\n icon={ChevronLeftIcon}\n onClick={() => onBackButtonClick?.()}\n accessibilityLabel=\"Back\"\n />\n </Box>\n </BaseBox>\n ) : null}\n <BaseBox\n paddingRight=\"spacing.5\"\n marginRight=\"auto\"\n flex=\"auto\"\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"flex-start\"\n >\n {leading ? (\n <BaseBox marginRight=\"spacing.3\" {...centerBoxProps[size]}>\n {leading}\n </BaseBox>\n ) : null}\n <BaseBox flex=\"auto\">\n <BaseBox\n // Explicitly setting maxWidth in React Native because text is not being wrapped properly when multiple fix width components are rendered in header\n // In web, flex containers seem to work a expected\n // @todo: resolve this if we figure out some better solution later\n maxWidth={isReactNative() && shouldWrapTitle ? '100px' : undefined}\n flexShrink={0}\n display=\"flex\"\n flexDirection=\"row\"\n >\n {title ? (\n <Text\n size={sizeTokensMapping[size].title}\n marginTop={makeSize(sizeToken['1'])}\n weight=\"semibold\"\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.normal'}\n wordBreak=\"break-word\"\n >\n {title}\n </Text>\n ) : null}\n {titleSuffix && (\n <BaseBox marginLeft=\"spacing.3\">\n <Box {...centerBoxProps[size]}>{titleSuffix}</Box>\n </BaseBox>\n )}\n </BaseBox>\n {subtitle ? (\n <Text\n variant=\"body\"\n size=\"small\"\n weight=\"regular\"\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.muted'}\n >\n {subtitle}\n </Text>\n ) : null}\n </BaseBox>\n </BaseBox>\n {validatedTrailingComponent ? (\n <BaseBox marginRight=\"spacing.5\">\n <Box {...centerBoxProps[size]}>{validatedTrailingComponent}</Box>\n </BaseBox>\n ) : null}\n {showCloseButton ? (\n <Box {...centerBoxProps[size]}>\n <IconButton\n ref={closeButtonRef}\n size=\"large\"\n icon={CloseIcon}\n accessibilityLabel=\"Close\"\n onClick={() => onCloseButtonClick?.()}\n />\n </Box>\n ) : null}\n {trailingInteractionElement && !children ? (\n <Box {...centerBoxProps[size]}>{trailingInteractionElement}</Box>\n ) : null}\n </BaseBox>\n <BaseBox\n display=\"flex\"\n width=\"100%\"\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n >\n <Box width=\"100%\">{children}</Box>\n {trailingInteractionElement && children ? (\n <Box alignSelf=\"flex-start\" {...centerBoxProps[size]}>\n {trailingInteractionElement}\n </Box>\n ) : null}\n </BaseBox>\n </BaseBox>\n {showDivider ? <Divider /> : null}\n </BaseBox>\n );\n};\n\nconst BaseHeader = assignWithoutSideEffects(_BaseHeader, {\n componentId: 'BaseHeader',\n});\n\nexport type { BaseHeaderProps };\nexport { BaseHeader };\n"],"names":["commonCenterBoxProps","display","alignItems","justifyContent","centerBoxProps","large","Object","assign","height","medium","sizeTokensMapping","title","propRestrictionMap","Button","size","variant","Badge","Link","Text","Amount","type","useTrailingRestriction","_ref","trailing","_React$useState","React","useState","_React$useState2","_slicedToArray","validatedTrailingComponent","setValidatedTrailingComponent","useEffect","isValidElement","trailingComponentType","getComponentId","restrictedProps","allowedComponents","keys","__DEV__","throwBladeError","message","join","moduleName","restrictedPropKeys","prop","_trailing$props","props","hasOwnProperty","logger","cloneElement","_BaseHeader","_ref2","subtitle","leading","titleSuffix","_ref2$showDivider","showDivider","_ref2$showBackButton","showBackButton","_ref2$showCloseButton","showCloseButton","onBackButtonClick","onCloseButtonClick","closeButtonRef","backButtonRef","testID","onClickCapture","onKeyDown","onKeyUp","onLostPointerCapture","onPointerCancel","onPointerDown","onPointerMove","onPointerUp","metaComponentName","paddingX","marginY","marginBottom","marginTop","_ref2$size","isDisabled","children","trailingInteractionElement","rest","_objectWithoutProperties","_excluded","shouldWrapTitle","webOnlyEventHandlers","isReactNative","_jsxs","BaseBox","metaAttribute","name","makeAnalyticsAttribute","base","m","touchAction","flexDirection","userSelect","_jsx","overflow","marginRight","Box","IconButton","ref","icon","ChevronLeftIcon","onClick","accessibilityLabel","paddingRight","flex","maxWidth","undefined","flexShrink","makeSize","sizeToken","weight","color","wordBreak","marginLeft","CloseIcon","width","alignSelf","Divider","BaseHeader","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAA,SAAA,CAAA,CAAA,OAAA,CAAA,UAAA,CAAA,SAAA,CAAA,aAAA,CAAA,UAAA,CAAA,aAAA,CAAA,gBAAA,CAAA,iBAAA,CAAA,mBAAA,CAAA,oBAAA,CAAA,gBAAA,CAAA,eAAA,CAAA,QAAA,CAAA,gBAAA,CAAA,WAAA,CAAA,SAAA,CAAA,sBAAA,CAAA,iBAAA,CAAA,eAAA,CAAA,eAAA,CAAA,aAAA,CAAA,mBAAA,CAAA,UAAA,CAAA,SAAA,CAAA,cAAA,CAAA,WAAA,CAAA,MAAA,CAAA,YAAA,CAAA,UAAA,CAAA,4BAAA,CAAA,CA8FA,IAAMA,oBAA8B,CAAG,CACrCC,OAAO,CAAE,MAAM,CACfC,UAA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A,CAACG,GAAG,CAAA,CAACmB,KAAK,CAAC,MAAM,CAAAxC,QAAA,CAAEA,QAAQ,CAAM,CAAC,CACjCC,0BAA0B,EAAID,QAAQ,CACrCkB,GAAA,CAACG,GAAG,CAAAhG,MAAA,CAAAC,MAAA,CAAA,CAACmH,SAAS,CAAC,YAAY,EAAKtH,cAAc,CAACU,MAAI,CAAC,CAAA,CAAAmE,QAAA,CACjDC,0BAA0B,CACxB,CAAA,CAAC,CACJ,IAAI,CAAA,CACD,CAAC,CACH,CAAA,CAAA,CAAC,CACT1B,WAAW,CAAG2C,GAAA,CAACwB,OAAO,CAAE,EAAA,CAAC,CAAG,IAAI,CAAA,CAAA,CAC1B,CAAC,CAEd,CAAC,CAEK,IAAAC,UAAU,CAAGC,wBAAwB,CAAC3E,WAAW,CAAE,CACvD4E,WAAW,CAAE,YACf,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"BaseHeader.js","sources":["../../../../../src/components/BaseHeaderFooter/BaseHeader.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react';\nimport type { ReactDOMAttributes } from '@use-gesture/react/dist/declarations/src/types';\nimport { Divider } from '~components/Divider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\nimport { IconButton } from '~components/Button/IconButton';\nimport { ChevronLeftIcon, CloseIcon } from '~components/Icons';\nimport type { DataAnalyticsAttribute, TestID } from '~utils/types';\nimport type { BoxProps } from '~components/Box';\nimport { Box } from '~components/Box';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { isReactNative, makeSize } from '~utils';\nimport { metaAttribute } from '~utils/metaAttribute';\nimport { logger, throwBladeError } from '~utils/logger';\nimport { size as sizeToken } from '~tokens/global';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype BaseHeaderProps = {\n title?: string;\n subtitle?: string;\n /**\n * Leading part of the header placed at the left most side of the header\n */\n leading?: React.ReactNode;\n /**\n * Trailing part of the header placed at the right most side of the header\n */\n trailing?: React.ReactNode;\n /**\n * Placed adjacent to the title text\n */\n titleSuffix?: React.ReactNode;\n /**\n * @default true\n */\n showDivider?: boolean;\n /**\n * @default false\n */\n showBackButton?: boolean;\n\n /**\n * Slot for rendering any trailing interaction element into BaseHeader.\n *\n * E.g. Used in accordion to render CollapsibleChevronIcon\n */\n trailingInteractionElement?: React.ReactNode;\n\n /**\n * Decides size of the Header\n */\n size?: 'large' | 'medium';\n /**\n * @default true\n */\n showCloseButton?: boolean;\n\n /**\n * Disabled state of BaseHeader\n *\n * @default false\n */\n isDisabled?: boolean;\n\n paddingX?: BoxProps['paddingX'];\n marginY?: BoxProps['marginY'];\n marginTop?: BoxProps['marginTop'];\n marginBottom?: BoxProps['marginBottom'];\n onCloseButtonClick?: () => void;\n onBackButtonClick?: () => void;\n closeButtonRef?: React.MutableRefObject<any>;\n backButtonRef?: React.MutableRefObject<any>;\n metaComponentName?: string;\n /**\n * inner child of BottomSheetHeader. Meant to be used for AutoComplete only\n */\n children?: React.ReactElement | React.ReactElement[];\n} & Pick<\n ReactDOMAttributes,\n | 'onClickCapture'\n | 'onKeyDown'\n | 'onKeyUp'\n | 'onLostPointerCapture'\n | 'onPointerCancel'\n | 'onPointerDown'\n | 'onPointerMove'\n | 'onPointerUp'\n> &\n TestID &\n DataAnalyticsAttribute;\n\ntype TrailingComponents = 'Button' | 'Badge' | 'Link' | 'Text' | 'Amount';\n\nconst commonCenterBoxProps: BoxProps = {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n};\n\nconst centerBoxProps: { large: BoxProps; medium: BoxProps } = {\n large: {\n ...commonCenterBoxProps,\n // We want to align title, icon, titleSuffix, trailing, closeButton to baseline\n // But we also want to keep them center aligned to each other\n // So we add a virtual Box around these slots with 28px and center align them to that box\n // We have done similar thing in figma as well (which is where this 28px comes from)\n height: '28px',\n },\n medium: {\n ...commonCenterBoxProps,\n height: '20px',\n },\n};\n\nconst sizeTokensMapping = {\n large: {\n title: 'large',\n },\n medium: {\n title: 'medium',\n },\n} as const;\n\n// prop restriction map for corresponding sub components\nconst propRestrictionMap = {\n large: {\n Button: {\n size: 'xsmall',\n variant: 'tertiary',\n },\n Badge: {\n size: 'medium',\n },\n Link: {\n size: 'medium',\n },\n Text: {\n size: 'medium',\n variant: 'body',\n },\n Amount: {\n type: 'body',\n size: 'medium',\n },\n },\n medium: {\n Button: {\n size: 'xsmall',\n variant: 'tertiary',\n },\n Badge: {\n size: 'small',\n },\n Link: {\n size: 'small',\n },\n Text: {\n size: 'small',\n variant: 'body',\n },\n Amount: {\n type: 'body',\n size: 'small',\n },\n },\n} as const;\n\nconst useTrailingRestriction = ({\n trailing,\n size,\n}: {\n size: NonNullable<BaseHeaderProps['size']>;\n trailing: BaseHeaderProps['trailing'];\n}): React.ReactNode => {\n const [\n validatedTrailingComponent,\n setValidatedTrailingComponent,\n ] = React.useState<React.ReactElement | null>(null);\n\n // validate and restrict sub component props in trailing prop\n React.useEffect(() => {\n if (React.isValidElement(trailing)) {\n const trailingComponentType = getComponentId(trailing) as TrailingComponents;\n const restrictedProps = propRestrictionMap[size][trailingComponentType];\n const allowedComponents = Object.keys(propRestrictionMap[size]);\n if (__DEV__) {\n if (!restrictedProps) {\n throwBladeError({\n message: `Only one of \\`${allowedComponents.join(\n ', ',\n )}\\` component is accepted as trailing`,\n moduleName: 'Header',\n });\n }\n }\n\n const restrictedPropKeys = Object.keys(propRestrictionMap[size][trailingComponentType]);\n for (const prop of restrictedPropKeys) {\n if (trailing?.props?.hasOwnProperty(prop)) {\n logger({\n message: `Do not pass \"${prop}\" to \"${trailingComponentType}\" while inside Header trailing, because we override it.`,\n moduleName: 'Header',\n type: 'warn',\n });\n }\n }\n setValidatedTrailingComponent(\n React.cloneElement(trailing as React.ReactElement, restrictedProps),\n );\n }\n }, [trailing, size]);\n\n return validatedTrailingComponent;\n};\n\nconst _BaseHeader = ({\n title,\n subtitle,\n leading,\n titleSuffix,\n trailing,\n showDivider = true,\n showBackButton = false,\n showCloseButton = true,\n onBackButtonClick,\n onCloseButtonClick,\n closeButtonRef,\n backButtonRef,\n testID,\n onClickCapture,\n onKeyDown,\n onKeyUp,\n onLostPointerCapture,\n onPointerCancel,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n metaComponentName,\n paddingX,\n marginY,\n marginBottom,\n marginTop,\n size = 'large',\n isDisabled,\n children,\n trailingInteractionElement,\n ...rest\n}: BaseHeaderProps): React.ReactElement => {\n const validatedTrailingComponent = useTrailingRestriction({ trailing, size });\n const shouldWrapTitle = titleSuffix && trailing && showBackButton && showCloseButton;\n\n const webOnlyEventHandlers: Record<string, any> = isReactNative()\n ? {}\n : {\n onClickCapture,\n onKeyDown,\n onKeyUp,\n onLostPointerCapture,\n onPointerCancel,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n };\n\n return (\n <BaseBox\n {...metaAttribute({ name: metaComponentName, testID })}\n {...makeAnalyticsAttribute(rest)}\n >\n <BaseBox\n marginY={marginY ?? { base: 'spacing.5', m: 'spacing.6' }}\n paddingX={paddingX ?? { base: 'spacing.5', m: 'spacing.6' }}\n marginTop={marginTop}\n marginBottom={marginBottom}\n touchAction=\"none\"\n {...webOnlyEventHandlers}\n >\n <BaseBox display=\"flex\" flexDirection=\"row\" userSelect=\"none\">\n {showBackButton ? (\n <BaseBox overflow=\"visible\" marginRight=\"spacing.5\">\n <Box {...centerBoxProps[size]}>\n <IconButton\n ref={backButtonRef}\n size=\"large\"\n icon={ChevronLeftIcon}\n onClick={() => onBackButtonClick?.()}\n accessibilityLabel=\"Back\"\n />\n </Box>\n </BaseBox>\n ) : null}\n <BaseBox\n paddingRight=\"spacing.5\"\n marginRight=\"auto\"\n flex=\"auto\"\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"flex-start\"\n >\n {leading ? (\n <BaseBox marginRight=\"spacing.3\" {...centerBoxProps[size]}>\n {leading}\n </BaseBox>\n ) : null}\n <BaseBox flex=\"auto\">\n <BaseBox\n // Explicitly setting maxWidth in React Native because text is not being wrapped properly when multiple fix width components are rendered in header\n // In web, flex containers seem to work a expected\n // @todo: resolve this if we figure out some better solution later\n maxWidth={isReactNative() && shouldWrapTitle ? '100px' : undefined}\n flexShrink={0}\n display=\"flex\"\n flexDirection=\"row\"\n >\n {title ? (\n <Text\n size={sizeTokensMapping[size].title}\n marginTop={makeSize(sizeToken['1'])}\n weight=\"semibold\"\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.normal'}\n wordBreak=\"break-word\"\n >\n {title}\n </Text>\n ) : null}\n {titleSuffix && (\n <BaseBox marginLeft=\"spacing.3\">\n <Box {...centerBoxProps[size]}>{titleSuffix}</Box>\n </BaseBox>\n )}\n </BaseBox>\n {subtitle ? (\n <Text\n variant=\"body\"\n size=\"small\"\n weight=\"regular\"\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.muted'}\n >\n {subtitle}\n </Text>\n ) : null}\n </BaseBox>\n </BaseBox>\n {validatedTrailingComponent ? (\n <BaseBox marginRight=\"spacing.5\">\n <Box {...centerBoxProps[size]}>{validatedTrailingComponent}</Box>\n </BaseBox>\n ) : null}\n {showCloseButton ? (\n <Box {...centerBoxProps[size]}>\n <IconButton\n ref={closeButtonRef}\n size=\"large\"\n icon={CloseIcon}\n accessibilityLabel=\"Close\"\n onClick={() => onCloseButtonClick?.()}\n />\n </Box>\n ) : null}\n {trailingInteractionElement && !children ? (\n <Box {...centerBoxProps[size]}>{trailingInteractionElement}</Box>\n ) : null}\n </BaseBox>\n <BaseBox\n display=\"flex\"\n width=\"100%\"\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n >\n <Box width=\"100%\">{children}</Box>\n {trailingInteractionElement && children ? (\n <Box alignSelf=\"flex-start\" {...centerBoxProps[size]}>\n {trailingInteractionElement}\n </Box>\n ) : null}\n </BaseBox>\n </BaseBox>\n {showDivider ? <Divider /> : null}\n </BaseBox>\n );\n};\n\nconst BaseHeader = assignWithoutSideEffects(_BaseHeader, {\n componentId: 'BaseHeader',\n});\n\nexport type { BaseHeaderProps };\nexport { BaseHeader };\n"],"names":["commonCenterBoxProps","display","alignItems","justifyContent","centerBoxProps","large","Object","assign","height","medium","sizeTokensMapping","title","propRestrictionMap","Button","size","variant","Badge","Link","Text","Amount","type","useTrailingRestriction","_ref","trailing","_React$useState","React","useState","_React$useState2","_slicedToArray","validatedTrailingComponent","setValidatedTrailingComponent","useEffect","isValidElement","trailingComponentType","getComponentId","restrictedProps","allowedComponents","keys","__DEV__","throwBladeError","message","join","moduleName","restrictedPropKeys","prop","_trailing$props","props","hasOwnProperty","logger","cloneElement","_BaseHeader","_ref2","subtitle","leading","titleSuffix","_ref2$showDivider","showDivider","_ref2$showBackButton","showBackButton","_ref2$showCloseButton","showCloseButton","onBackButtonClick","onCloseButtonClick","closeButtonRef","backButtonRef","testID","onClickCapture","onKeyDown","onKeyUp","onLostPointerCapture","onPointerCancel","onPointerDown","onPointerMove","onPointerUp","metaComponentName","paddingX","marginY","marginBottom","marginTop","_ref2$size","isDisabled","children","trailingInteractionElement","rest","_objectWithoutProperties","_excluded","shouldWrapTitle","webOnlyEventHandlers","isReactNative","_jsxs","BaseBox","metaAttribute","name","makeAnalyticsAttribute","base","m","touchAction","flexDirection","userSelect","_jsx","overflow","marginRight","Box","IconButton","ref","icon","ChevronLeftIcon","onClick","accessibilityLabel","paddingRight","flex","maxWidth","undefined","flexShrink","makeSize","sizeToken","weight","color","wordBreak","marginLeft","CloseIcon","width","alignSelf","Divider","BaseHeader","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAA,SAAA,CAAA,CAAA,OAAA,CAAA,UAAA,CAAA,SAAA,CAAA,aAAA,CAAA,UAAA,CAAA,aAAA,CAAA,gBAAA,CAAA,iBAAA,CAAA,mBAAA,CAAA,oBAAA,CAAA,gBAAA,CAAA,eAAA,CAAA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AA,CAAAA,cAAc,CAACU,MAAI,CAAC,EAAAmE,QAAA,CAAGC,0BAA0B,CAAM,CAAA,CAAC,CAC/D,IAAI,EACD,CAAC,CACVO,IAAA,CAACC,OAAO,EACNzF,OAAO,CAAC,MAAM,CACdwH,KAAK,CAAC,MAAM,CACZxB,aAAa,CAAC,KAAK,CACnB/F,UAAU,CAAC,QAAQ,CACnBC,cAAc,CAAC,eAAe,CAAA8E,QAAA,EAE9BkB,GAAA,CAACG,GAAG,CAAA,CAACmB,KAAK,CAAC,MAAM,CAAAxC,QAAA,CAAEA,QAAQ,CAAM,CAAC,CACjCC,0BAA0B,EAAID,QAAQ,CACrCkB,GAAA,CAACG,GAAG,CAAAhG,MAAA,CAAAC,MAAA,CAAA,CAACmH,SAAS,CAAC,YAAY,EAAKtH,cAAc,CAACU,MAAI,CAAC,CAAA,CAAAmE,QAAA,CACjDC,0BAA0B,CACxB,CAAA,CAAC,CACJ,IAAI,CAAA,CACD,CAAC,CACH,CAAA,CAAA,CAAC,CACT1B,WAAW,CAAG2C,GAAA,CAACwB,OAAO,CAAE,EAAA,CAAC,CAAG,IAAI,CAAA,CAAA,CAC1B,CAAC,CAEd,CAAC,CAEK,IAAAC,UAAU,CAAGC,wBAAwB,CAAC3E,WAAW,CAAE,CACvD4E,WAAW,CAAE,YACf,CAAC;;;;"}
|
|
@@ -3,19 +3,21 @@ import React__default from 'react';
|
|
|
3
3
|
import { BaseMenuItemContext } from '../BaseMenuContext.js';
|
|
4
4
|
import { StyledMenuItemContainer } from './StyledMenuItemContainer.native.js';
|
|
5
5
|
import { Box } from '../../Box/Box.js';
|
|
6
|
-
import
|
|
7
|
-
import '
|
|
8
|
-
import '
|
|
6
|
+
import '../../Typography/Heading/Heading.js';
|
|
7
|
+
import { getTextProps, Text } from '../../Typography/Text/Text.js';
|
|
8
|
+
import '../../Typography/Code/Code.js';
|
|
9
|
+
import '../../Typography/Display/Display.js';
|
|
9
10
|
import '../../../tokens/global/typography.js';
|
|
10
11
|
import '../../../tokens/global/motion.js';
|
|
11
12
|
import { size } from '../../../tokens/global/size.js';
|
|
13
|
+
import 'react-native';
|
|
14
|
+
import '@babel/runtime/helpers/slicedToArray';
|
|
12
15
|
import { makeSize } from '../../../utils/makeSize/makeSize.js';
|
|
13
16
|
import '../../BladeProvider/useTheme.js';
|
|
14
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
15
|
-
import { getTextProps, Text } from '../../Typography/Text/Text.js';
|
|
16
|
-
import '../../Typography/Code/Code.js';
|
|
17
17
|
import { makeAccessible } from '../../../utils/makeAccessible/makeAccessible.native.js';
|
|
18
|
+
import { BaseText } from '../../Typography/BaseText/BaseText.native.js';
|
|
18
19
|
import { useTruncationTitle } from '../../../utils/useTruncationTitle/useTruncationTitle.native.js';
|
|
20
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
19
21
|
|
|
20
22
|
var _excluded=["title","description","as","leading","trailing","titleSuffix","isDisabled","selectionType","isSelected","isVisible","color","role","children"];var menuItemTitleColor={negative:{default:'feedback.text.negative.intense',disabled:'interactive.text.gray.disabled'},normal:{default:'interactive.text.gray.normal',disabled:'interactive.text.gray.disabled'}};var menuItemDescriptionColor={default:'interactive.text.gray.muted',disabled:'interactive.text.gray.disabled'};var itemFirstRowHeight=makeSize(size[20]);var _BaseMenuItem=function _BaseMenuItem(_ref,ref){var title=_ref.title,description=_ref.description,as=_ref.as,leading=_ref.leading,trailing=_ref.trailing,titleSuffix=_ref.titleSuffix,isDisabled=_ref.isDisabled,_ref$selectionType=_ref.selectionType,selectionType=_ref$selectionType===void 0?'single':_ref$selectionType,isSelected=_ref.isSelected,_ref$isVisible=_ref.isVisible,isVisible=_ref$isVisible===void 0?true:_ref$isVisible,color=_ref.color,_ref$role=_ref.role,role=_ref$role===void 0?'menuitem':_ref$role,children=_ref.children,props=_objectWithoutProperties(_ref,_excluded);var _useTruncationTitle=useTruncationTitle({content:title}),containerRef=_useTruncationTitle.containerRef,textRef=_useTruncationTitle.textRef;return jsx(BaseMenuItemContext.Provider,{value:{color:color,isDisabled:isDisabled},children:jsx(StyledMenuItemContainer,Object.assign({ref:ref,as:as,type:"button",disabled:isDisabled},makeAccessible({role:role,current:role==='menuitem'||role==='menuitemcheckbox'?isSelected:undefined,disabled:isDisabled,selected:isSelected}),{color:color,isVisible:isVisible,isSelected:isSelected,isDisabled:isDisabled,selectionType:selectionType},props,{children:children?children:jsxs(Box,{display:"flex",alignItems:"flex-start",width:"100%",justifyContent:"flex-start",children:[jsx(Box,{display:"flex",justifyContent:"center",alignItems:"center",height:itemFirstRowHeight,children:leading}),jsxs(Box,{paddingLeft:leading?'spacing.3':'spacing.0',paddingRight:"spacing.3",display:"flex",flexDirection:"column",children:[jsxs(Box,{display:"flex",alignItems:"center",flexDirection:"row",height:itemFirstRowHeight,ref:containerRef,children:[jsx(BaseText,Object.assign({as:"p",ref:textRef,truncateAfterLines:1,wordBreak:"break-all"},getTextProps({size:'medium',color:menuItemTitleColor[color==='negative'?'negative':'normal'][isDisabled?'disabled':'default'],weight:'regular'}),{children:title})),titleSuffix]}),jsx(Box,{children:description?jsx(Text,{color:menuItemDescriptionColor[isDisabled?'disabled':'default'],size:"small",children:description}):null})]}),jsx(Box,{marginLeft:"auto",children:trailing})]})}))});};var BaseMenuItem=React__default.forwardRef(_BaseMenuItem);
|
|
21
23
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseMenuItem.js","sources":["../../../../../../src/components/BaseMenu/BaseMenuItem/BaseMenuItem.tsx"],"sourcesContent":["import React from 'react';\nimport type { BaseMenuItemProps } from '../types';\nimport { BaseMenuItemContext } from '../BaseMenuContext';\nimport { StyledMenuItemContainer } from './StyledMenuItemContainer';\nimport { Box } from '~components/Box';\nimport { getTextProps, Text } from '~components/Typography';\nimport { size } from '~tokens/global';\nimport { makeSize } from '~utils';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport type { BladeElementRef } from '~utils/types';\nimport { BaseText } from '~components/Typography/BaseText';\nimport { useTruncationTitle } from '~utils/useTruncationTitle';\n\nconst menuItemTitleColor = {\n negative: {\n default: 'feedback.text.negative.intense',\n disabled: 'interactive.text.gray.disabled',\n },\n normal: { default: 'interactive.text.gray.normal', disabled: 'interactive.text.gray.disabled' },\n} as const;\n\nconst menuItemDescriptionColor = {\n default: 'interactive.text.gray.muted',\n disabled: 'interactive.text.gray.disabled',\n} as const;\n\n// This is the height of item excluding the description to make sure description comes at the bottom and other first row items are center aligned\nconst itemFirstRowHeight = makeSize(size[20]);\n\nconst _BaseMenuItem: React.ForwardRefRenderFunction<BladeElementRef, BaseMenuItemProps> = (\n {\n title,\n description,\n as,\n leading,\n trailing,\n titleSuffix,\n isDisabled,\n selectionType = 'single',\n isSelected,\n isVisible = true,\n color,\n role = 'menuitem',\n children,\n ...props\n },\n ref,\n): React.ReactElement => {\n const { containerRef, textRef } = useTruncationTitle({ content: title });\n return (\n <BaseMenuItemContext.Provider value={{ color, isDisabled }}>\n <StyledMenuItemContainer\n ref={ref as never}\n as={as}\n type=\"button\"\n disabled={isDisabled}\n {...makeAccessible({\n role,\n current: role === 'menuitem' || role === 'menuitemcheckbox' ? isSelected : undefined,\n disabled: isDisabled,\n selected: isSelected,\n })}\n color={color}\n isVisible={isVisible}\n isSelected={isSelected}\n isDisabled={isDisabled}\n selectionType={selectionType}\n {...props}\n >\n {children ? (\n children\n ) : (\n <Box display=\"flex\" alignItems=\"flex-start\" width=\"100%\" justifyContent=\"flex-start\">\n <Box\n display=\"flex\"\n justifyContent=\"center\"\n alignItems=\"center\"\n height={itemFirstRowHeight}\n >\n {leading}\n </Box>\n <Box\n paddingLeft={leading ? 'spacing.3' : 'spacing.0'}\n paddingRight=\"spacing.3\"\n display=\"flex\"\n flexDirection=\"column\"\n >\n <Box\n display=\"flex\"\n alignItems=\"center\"\n flexDirection=\"row\"\n height={itemFirstRowHeight}\n ref={containerRef as never}\n >\n <BaseText\n as=\"p\"\n ref={textRef as never}\n truncateAfterLines={1}\n wordBreak=\"break-all\"\n {...getTextProps({\n size: 'medium',\n color:\n menuItemTitleColor[color === 'negative' ? 'negative' : 'normal'][\n isDisabled ? 'disabled' : 'default'\n ],\n weight: 'regular',\n })}\n >\n {title}\n </BaseText>\n {titleSuffix}\n </Box>\n <Box>\n {description ? (\n <Text\n color={menuItemDescriptionColor[isDisabled ? 'disabled' : 'default']}\n size=\"small\"\n >\n {description}\n </Text>\n ) : null}\n </Box>\n </Box>\n <Box marginLeft=\"auto\">{trailing}</Box>\n </Box>\n )}\n </StyledMenuItemContainer>\n </BaseMenuItemContext.Provider>\n );\n};\n\nconst BaseMenuItem = React.forwardRef(_BaseMenuItem);\n\nexport { BaseMenuItem };\n"],"names":["menuItemTitleColor","negative","default","disabled","normal","menuItemDescriptionColor","itemFirstRowHeight","makeSize","size","_BaseMenuItem","_ref","ref","title","description","as","leading","trailing","titleSuffix","isDisabled","_ref$selectionType","selectionType","isSelected","_ref$isVisible","isVisible","color","_ref$role","role","children","props","_objectWithoutProperties","_excluded","_useTruncationTitle","useTruncationTitle","content","containerRef","textRef","_jsx","BaseMenuItemContext","Provider","value","StyledMenuItemContainer","Object","assign","type","makeAccessible","current","undefined","selected","_jsxs","Box","display","alignItems","width","justifyContent","height","paddingLeft","paddingRight","flexDirection","BaseText","truncateAfterLines","wordBreak","getTextProps","weight","Text","marginLeft","BaseMenuItem","React","forwardRef"],"mappings":"
|
|
1
|
+
{"version":3,"file":"BaseMenuItem.js","sources":["../../../../../../src/components/BaseMenu/BaseMenuItem/BaseMenuItem.tsx"],"sourcesContent":["import React from 'react';\nimport type { BaseMenuItemProps } from '../types';\nimport { BaseMenuItemContext } from '../BaseMenuContext';\nimport { StyledMenuItemContainer } from './StyledMenuItemContainer';\nimport { Box } from '~components/Box';\nimport { getTextProps, Text } from '~components/Typography';\nimport { size } from '~tokens/global';\nimport { makeSize } from '~utils';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport type { BladeElementRef } from '~utils/types';\nimport { BaseText } from '~components/Typography/BaseText';\nimport { useTruncationTitle } from '~utils/useTruncationTitle';\n\nconst menuItemTitleColor = {\n negative: {\n default: 'feedback.text.negative.intense',\n disabled: 'interactive.text.gray.disabled',\n },\n normal: { default: 'interactive.text.gray.normal', disabled: 'interactive.text.gray.disabled' },\n} as const;\n\nconst menuItemDescriptionColor = {\n default: 'interactive.text.gray.muted',\n disabled: 'interactive.text.gray.disabled',\n} as const;\n\n// This is the height of item excluding the description to make sure description comes at the bottom and other first row items are center aligned\nconst itemFirstRowHeight = makeSize(size[20]);\n\nconst _BaseMenuItem: React.ForwardRefRenderFunction<BladeElementRef, BaseMenuItemProps> = (\n {\n title,\n description,\n as,\n leading,\n trailing,\n titleSuffix,\n isDisabled,\n selectionType = 'single',\n isSelected,\n isVisible = true,\n color,\n role = 'menuitem',\n children,\n ...props\n },\n ref,\n): React.ReactElement => {\n const { containerRef, textRef } = useTruncationTitle({ content: title });\n return (\n <BaseMenuItemContext.Provider value={{ color, isDisabled }}>\n <StyledMenuItemContainer\n ref={ref as never}\n as={as}\n type=\"button\"\n disabled={isDisabled}\n {...makeAccessible({\n role,\n current: role === 'menuitem' || role === 'menuitemcheckbox' ? isSelected : undefined,\n disabled: isDisabled,\n selected: isSelected,\n })}\n color={color}\n isVisible={isVisible}\n isSelected={isSelected}\n isDisabled={isDisabled}\n selectionType={selectionType}\n {...props}\n >\n {children ? (\n children\n ) : (\n <Box display=\"flex\" alignItems=\"flex-start\" width=\"100%\" justifyContent=\"flex-start\">\n <Box\n display=\"flex\"\n justifyContent=\"center\"\n alignItems=\"center\"\n height={itemFirstRowHeight}\n >\n {leading}\n </Box>\n <Box\n paddingLeft={leading ? 'spacing.3' : 'spacing.0'}\n paddingRight=\"spacing.3\"\n display=\"flex\"\n flexDirection=\"column\"\n >\n <Box\n display=\"flex\"\n alignItems=\"center\"\n flexDirection=\"row\"\n height={itemFirstRowHeight}\n ref={containerRef as never}\n >\n <BaseText\n as=\"p\"\n ref={textRef as never}\n truncateAfterLines={1}\n wordBreak=\"break-all\"\n {...getTextProps({\n size: 'medium',\n color:\n menuItemTitleColor[color === 'negative' ? 'negative' : 'normal'][\n isDisabled ? 'disabled' : 'default'\n ],\n weight: 'regular',\n })}\n >\n {title}\n </BaseText>\n {titleSuffix}\n </Box>\n <Box>\n {description ? (\n <Text\n color={menuItemDescriptionColor[isDisabled ? 'disabled' : 'default']}\n size=\"small\"\n >\n {description}\n </Text>\n ) : null}\n </Box>\n </Box>\n <Box marginLeft=\"auto\">{trailing}</Box>\n </Box>\n )}\n </StyledMenuItemContainer>\n </BaseMenuItemContext.Provider>\n );\n};\n\nconst BaseMenuItem = React.forwardRef(_BaseMenuItem);\n\nexport { BaseMenuItem };\n"],"names":["menuItemTitleColor","negative","default","disabled","normal","menuItemDescriptionColor","itemFirstRowHeight","makeSize","size","_BaseMenuItem","_ref","ref","title","description","as","leading","trailing","titleSuffix","isDisabled","_ref$selectionType","selectionType","isSelected","_ref$isVisible","isVisible","color","_ref$role","role","children","props","_objectWithoutProperties","_excluded","_useTruncationTitle","useTruncationTitle","content","containerRef","textRef","_jsx","BaseMenuItemContext","Provider","value","StyledMenuItemContainer","Object","assign","type","makeAccessible","current","undefined","selected","_jsxs","Box","display","alignItems","width","justifyContent","height","paddingLeft","paddingRight","flexDirection","BaseText","truncateAfterLines","wordBreak","getTextProps","weight","Text","marginLeft","BaseMenuItem","React","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,OAAA,CAAA,aAAA,CAAA,IAAA,CAAA,SAAA,CAAA,UAAA,CAAA,aAAA,CAAA,YAAA,CAAA,eAAA,CAAA,YAAA,CAAA,WAAA,CAAA,OAAA,CAAA,MAAA,CAAA,UAAA,CAAA,CAaA,IAAMA,kBAAkB,CAAG,CACzBC,QAAQ,CAAE,CACRC,OAAO,CAAE,gCAAgC,CACzCC,QAAQ,CAAE,gCACZ,CAAC,CACDC,MAAM,CAAE,CAAEF,OAAO,CAAE,8BAA8B,C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
|
3
|
-
import 'react';
|
|
4
|
-
import { throwBladeError } from '../../utils/logger/logger.js';
|
|
5
|
-
import '@babel/runtime/helpers/slicedToArray';
|
|
6
|
-
import 'react-native';
|
|
7
|
-
import '../../tokens/global/typography.js';
|
|
8
|
-
import '../../tokens/global/motion.js';
|
|
9
|
-
import '../BladeProvider/useTheme.js';
|
|
10
|
-
import { jsx } from 'react/jsx-runtime';
|
|
1
|
+
import '../Typography/Heading/Heading.js';
|
|
11
2
|
import { Text } from '../Typography/Text/Text.js';
|
|
12
3
|
import '../Typography/Code/Code.js';
|
|
4
|
+
import '../Typography/Display/Display.js';
|
|
5
|
+
import { throwBladeError } from '../../utils/logger/logger.js';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
13
7
|
|
|
14
8
|
var BottomNav=function BottomNav(_props){throwBladeError({message:'BottomNav is not yet implemented for native',moduleName:'BottomNav'});return jsx(Text,{children:"BottomNav Component is not available for Native mobile apps."});};var BottomNavItem=function BottomNavItem(_props){throwBladeError({message:'BottomNavItem is not yet implemented for native',moduleName:'BottomNavItem'});return jsx(Text,{children:"BottomNav Component is not available for Native mobile apps."});};
|
|
15
9
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomNav.native.js","sources":["../../../../../src/components/BottomNav/BottomNav.native.tsx"],"sourcesContent":["import type { BottomNavProps, BottomNavItemProps } from './types';\nimport { Text } from '~components/Typography';\nimport { throwBladeError } from '~utils/logger';\n\nconst BottomNav = (_props: BottomNavProps): React.ReactElement => {\n throwBladeError({\n message: 'BottomNav is not yet implemented for native',\n moduleName: 'BottomNav',\n });\n\n return <Text>BottomNav Component is not available for Native mobile apps.</Text>;\n};\n\nconst BottomNavItem = (_props: BottomNavItemProps): React.ReactElement => {\n throwBladeError({\n message: 'BottomNavItem is not yet implemented for native',\n moduleName: 'BottomNavItem',\n });\n\n return <Text>BottomNav Component is not available for Native mobile apps.</Text>;\n};\n\nexport { BottomNav, BottomNavItem };\n"],"names":["BottomNav","_props","throwBladeError","message","moduleName","_jsx","Text","children","BottomNavItem"],"mappings":"
|
|
1
|
+
{"version":3,"file":"BottomNav.native.js","sources":["../../../../../src/components/BottomNav/BottomNav.native.tsx"],"sourcesContent":["import type { BottomNavProps, BottomNavItemProps } from './types';\nimport { Text } from '~components/Typography';\nimport { throwBladeError } from '~utils/logger';\n\nconst BottomNav = (_props: BottomNavProps): React.ReactElement => {\n throwBladeError({\n message: 'BottomNav is not yet implemented for native',\n moduleName: 'BottomNav',\n });\n\n return <Text>BottomNav Component is not available for Native mobile apps.</Text>;\n};\n\nconst BottomNavItem = (_props: BottomNavItemProps): React.ReactElement => {\n throwBladeError({\n message: 'BottomNavItem is not yet implemented for native',\n moduleName: 'BottomNavItem',\n });\n\n return <Text>BottomNav Component is not available for Native mobile apps.</Text>;\n};\n\nexport { BottomNav, BottomNavItem };\n"],"names":["BottomNav","_props","throwBladeError","message","moduleName","_jsx","Text","children","BottomNavItem"],"mappings":";;;;;;;AAIM,IAAAA,SAAS,CAAG,SAAZA,SAASA,CAAIC,MAAsB,CAAyB,CAChEC,eAAe,CAAC,CACdC,OAAO,CAAE,6CAA6C,CACtDC,UAAU,CAAE,WACd,CAAC,CAAC,CAEF,OAAOC,GAAA,CAACC,IAAI,CAAAC,CAAAA,QAAA,CAAC,8DAA4D,CAAM,CAAC,CAClF,EAEM,IAAAC,aAAa,CAAG,SAAhBA,aAAaA,CAAIP,MAA0B,CAAyB,CACxEC,eAAe,CAAC,CACdC,OAAO,CAAE,iDAAiD,CAC1DC,UAAU,CAAE,eACd,CAAC,CAAC,CAEF,OAAOC,GAAA,CAACC,IAAI,CAAAC,CAAAA,QAAA,CAAC,8DAA4D,CAAM,CAAC,CAClF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propsTypes.js","sources":["../../../../../../../src/components/Box/BaseBox/types/propsTypes.ts"],"sourcesContent":["import type { View } from 'react-native';\nimport type { CSSObject } from 'styled-components';\nimport type { MarginProps, PaddingProps, SpacingValueType } from './spacingTypes';\nimport type { MakeObjectResponsive } from './responsiveTypes';\nimport type { Theme } from '~components/BladeProvider';\nimport type { Border, Elevation } from '~tokens/global';\nimport type { DataAnalyticsAttribute, PickCSSByPlatform, TestID } from '~utils/types';\nimport type { Platform } from '~utils';\nimport type { BladeCommonEvents } from '~components/types';\nimport type { DotNotationToken } from '~utils/lodashButBetter/get';\n\ntype LayoutProps = MakeObjectResponsive<\n {\n height: SpacingValueType;\n minHeight: SpacingValueType;\n maxHeight: SpacingValueType;\n width: SpacingValueType;\n minWidth: SpacingValueType;\n maxWidth: SpacingValueType;\n } & PickCSSByPlatform<\n 'display' | 'overflow' | 'overflowX' | 'overflowY' | 'textAlign' | 'whiteSpace'\n >\n>;\n\ntype FlexboxProps = MakeObjectResponsive<\n {\n /**\n * This uses the native gap property which might not work on older browsers.\n * If you want to support older browsers, you might want to use `margin` instead.\n *\n * @see https://caniuse.com/?search=gap\n */\n gap: SpacingValueType;\n /**\n * This uses the native row-gap property which might not work on older browsers.\n * If you want to support older browsers, you might want to use `margin` instead.\n *\n * @see https://caniuse.com/?search=row-gap\n */\n rowGap: SpacingValueType;\n /**\n * This uses the native column-gap property which might not work on older browsers.\n * If you want to support older browsers, you might want to use `margin` instead.\n *\n * @see https://caniuse.com/?search=column-gap\n */\n columnGap: SpacingValueType;\n /**\n * The **`flex`** CSS shorthand property sets how a flex _item_ will grow or shrink to fit the space available in its flex container.\n *\n * @see https://developer.mozilla.org/docs/Web/CSS/flex\n */\n flex: string | number;\n } & PickCSSByPlatform<\n | 'flexWrap'\n | 'flexDirection'\n | 'flexGrow'\n | 'flexShrink'\n | 'flexBasis'\n | 'alignItems'\n | 'alignContent'\n | 'alignSelf'\n | 'justifyItems'\n | 'justifyContent'\n | 'justifySelf'\n | 'placeSelf'\n | 'placeItems'\n | 'order'\n >\n>;\n\ntype PositionProps = MakeObjectResponsive<\n {\n top: SpacingValueType;\n right: SpacingValueType;\n bottom: SpacingValueType;\n left: SpacingValueType;\n } & PickCSSByPlatform<'position' | 'zIndex'>\n>;\n\ntype GridProps = MakeObjectResponsive<\n PickCSSByPlatform<\n | 'grid'\n | 'gridColumn'\n | 'gridRow'\n | 'gridRowStart'\n | 'gridRowEnd'\n | 'gridColumnStart'\n | 'gridColumnEnd'\n | 'gridArea'\n | 'gridAutoFlow'\n | 'gridAutoRows'\n | 'gridAutoColumns'\n | 'gridTemplate'\n | 'gridTemplateAreas'\n | 'gridTemplateColumns'\n | 'gridTemplateRows'\n >\n>;\n\ntype ColorObjects = 'feedback' | 'surface' | 'interactive';\ntype BackgroundOnlyColorObjects = 'popup' | 'overlay';\ntype BackgroundColorString<\n T extends ColorObjects | BackgroundOnlyColorObjects\n> = `${T}.background.${DotNotationToken<Theme['colors'][T]['background']>}`;\ntype BorderColorString<T extends ColorObjects> = `${T}.border.${DotNotationToken<\n Theme['colors'][T]['border']\n>}`;\n\n// Created this as an array so I can reuse it for runtime validation\nconst validBoxAsValues = [\n 'div',\n 'section',\n 'footer',\n 'header',\n 'main',\n 'aside',\n 'nav',\n 'span',\n 'label',\n] as const;\n\ntype BoxAsType = typeof validBoxAsValues[number];\n\n// Visual props that are common for both Box and BaseBox\ntype CommonBoxVisualProps = MakeObjectResponsive<\n {\n borderRadius: keyof Border['radius'];\n borderWidth: keyof Border['width'];\n borderColor: BorderColorString<'surface'>;\n borderTopWidth: keyof Border['width'];\n borderTopColor: BorderColorString<'surface'>;\n borderRightWidth: keyof Border['width'];\n borderRightColor: BorderColorString<'surface'>;\n borderBottomWidth: keyof Border['width'];\n borderBottomColor: BorderColorString<'surface'>;\n borderLeftWidth: keyof Border['width'];\n borderLeftColor: BorderColorString<'surface'>;\n borderTopLeftRadius: keyof Border['radius'];\n borderTopRightRadius: keyof Border['radius'];\n borderBottomRightRadius: keyof Border['radius'];\n borderBottomLeftRadius: keyof Border['radius'];\n } & PickCSSByPlatform<\n | 'backgroundImage'\n | 'backgroundSize'\n | 'backgroundPosition'\n | 'backgroundOrigin'\n | 'backgroundRepeat'\n | 'pointerEvents'\n | 'opacity'\n | 'visibility'\n | 'transform'\n | 'transformOrigin'\n | 'clipPath'\n | 'borderStyle'\n | 'borderTopStyle'\n | 'borderBottomStyle'\n | 'borderLeftStyle'\n | 'borderRightStyle'\n > & {\n /**\n * Sets the elevation for Box\n *\n * eg: `theme.elevation.midRaised`\n *\n * @default `theme.elevation.lowRaised`\n *\n * **Links:**\n * - Docs: https://blade.razorpay.com/?path=/docs/tokens-elevation--docs\n */\n elevation?: keyof Elevation;\n }\n>;\n\n// Visual props that are specific BaseBox\n// This is used to ensure some of the more flexible BaseBox props are not passed to Box\ntype BaseBoxVisualProps = MakeObjectResponsive<\n {\n backgroundColor:\n | BackgroundColorString<'feedback'>\n | BackgroundColorString<'surface'>\n | BackgroundColorString<'interactive'>\n | BackgroundColorString<'overlay'>\n | BackgroundColorString<'popup'>\n | 'transparent'\n | (string & Record<never, never>);\n lineHeight: SpacingValueType;\n touchAction: CSSObject['touchAction'];\n userSelect: CSSObject['userSelect'];\n } & PickCSSByPlatform<\n | 'border'\n | 'borderLeft'\n | 'borderRight'\n | 'borderTop'\n | 'borderBottom'\n | 'opacity'\n | 'pointerEvents'\n | 'cursor'\n >\n>;\n\n// Visual props that are specific to Box\ntype BoxVisualProps = MakeObjectResponsive<{\n backgroundColor: BackgroundColorString<'surface'> | 'transparent';\n}> & {\n // Intentionally keeping this outside of MakeObjectResponsive since we only want as to be string and not responsive object\n // styled-components do not support passing `as` prop as an object\n as: BoxAsType;\n};\n\ntype StyledPropsBlade = Partial<\n Omit<\n MarginProps &\n Pick<FlexboxProps, 'alignSelf' | 'justifySelf' | 'placeSelf' | 'order'> &\n PositionProps &\n Pick<\n GridProps,\n | 'gridColumn'\n | 'gridRow'\n | 'gridRowStart'\n | 'gridRowEnd'\n | 'gridColumnStart'\n | 'gridColumnEnd'\n | 'gridArea'\n > &\n Pick<LayoutProps, 'display'> &\n Pick<CommonBoxVisualProps, 'visibility'>,\n '__brand__'\n >\n>;\n\ntype BoxCallbackProps = Omit<\n Platform.Select<{\n web: {\n /**\n * **Warning**\n *\n * Make sure to not use Box when you want to create a trigger that performs action on hover.\n * You would probably want to render it as `button` using `styled.button` instead.\n *\n * Use this for hoverable containers in cases like custom menus.\n */\n onMouseOver: React.MouseEventHandler<HTMLElement>;\n /**\n * **Warning**\n *\n * Make sure to not use Box when you want to create a trigger that performs action on hover.\n * You would probably want to render it as `button` using `styled.button` instead.\n *\n * Use this for hoverable containers in cases like custom menus.\n */\n onMouseEnter: React.MouseEventHandler<HTMLElement>;\n /**\n * **Warning**\n *\n * Make sure to not use Box when you want to create a trigger that performs action on hover.\n * You would probably want to render it as `button` using `styled.button` instead.\n *\n * Use this for hoverable containers in cases like custom menus.\n */\n onMouseLeave: React.MouseEventHandler<HTMLElement>;\n onScroll: React.UIEventHandler<HTMLElement>;\n };\n native: Record<'onMouseOver' | 'onMouseEnter' | 'onMouseLeave' | 'onScroll', undefined>;\n }>,\n '__brand__'\n>;\n\ntype BoxDragAndDropProps = Omit<\n Platform.Select<{\n web: {\n draggable: boolean;\n onDragStart: React.DragEventHandler<HTMLElement>;\n onDragEnter: React.DragEventHandler<HTMLElement>;\n onDragLeave: React.DragEventHandler<HTMLElement>;\n onDragOver: React.DragEventHandler<HTMLElement>;\n onDragEnd: React.DragEventHandler<HTMLElement>;\n onDrop: React.DragEventHandler<HTMLElement>;\n };\n native: Record<\n | 'draggable'\n | 'onDragStart'\n | 'onDragEnter'\n | 'onDragLeave'\n | 'onDragOver'\n | 'onDragEnd'\n | 'onDrop',\n undefined\n >;\n }>,\n '__brand__'\n>;\n\ntype BoxProps = Partial<\n PaddingProps &\n MarginProps &\n LayoutProps &\n FlexboxProps &\n PositionProps &\n GridProps &\n BoxCallbackProps &\n BoxDragAndDropProps &\n CommonBoxVisualProps &\n BoxVisualProps & {\n children?: React.ReactNode | React.ReactNode[];\n tabIndex?: number;\n id?: string;\n } & TestID &\n DataAnalyticsAttribute\n>;\n\n// Visual props have different types for BaseBox and Box. BaseBox has more flexible types and more props exposed.\n// So first we Omit Visual props of Box\n// Then we append BaseBoxVisualProps and some other props for styled-components like class and id\ntype BaseBoxProps = Omit<BoxProps, keyof BoxVisualProps> &\n Partial<\n DataAnalyticsAttribute &\n BaseBoxVisualProps & {\n className?: string;\n id?: string;\n tabIndex?: number;\n }\n > &\n BladeCommonEvents;\n\n// ref prop type\ntype BoxRefType = Platform.Select<{\n web: Omit<HTMLElement, 'style'>;\n native: View;\n}>;\n\nexport type { BaseBoxProps, BoxProps, BoxRefType, StyledPropsBlade, FlexboxProps };\nexport { validBoxAsValues };\n"],"names":["validBoxAsValues"],"mappings":"AA8GM,IAAAA,gBAAgB,CAAG,CACvB,KAAK,CACL,SAAS,CACT,QAAQ,CACR,QAAQ,CACR,MAAM,CACN,OAAO,CACP,KAAK,CACL,MAAM,CACN,OAAO;;;;"}
|
|
1
|
+
{"version":3,"file":"propsTypes.js","sources":["../../../../../../../src/components/Box/BaseBox/types/propsTypes.ts"],"sourcesContent":["import type { View } from 'react-native';\nimport type { CSSObject } from 'styled-components';\nimport type { MarginProps, PaddingProps, SpacingValueType } from './spacingTypes';\nimport type { MakeObjectResponsive } from './responsiveTypes';\nimport type { Theme } from '~components/BladeProvider';\nimport type { Border, Elevation } from '~tokens/global';\nimport type { DataAnalyticsAttribute, PickCSSByPlatform, TestID } from '~utils/types';\nimport type { Platform } from '~utils';\nimport type { BladeCommonEvents } from '~components/types';\nimport type { DotNotationToken } from '~utils/lodashButBetter/get';\n\ntype LayoutProps = MakeObjectResponsive<\n {\n height: SpacingValueType;\n minHeight: SpacingValueType;\n maxHeight: SpacingValueType;\n width: SpacingValueType;\n minWidth: SpacingValueType;\n maxWidth: SpacingValueType;\n } & PickCSSByPlatform<\n 'display' | 'overflow' | 'overflowX' | 'overflowY' | 'textAlign' | 'whiteSpace'\n >\n>;\n\ntype FlexboxProps = MakeObjectResponsive<\n {\n /**\n * This uses the native gap property which might not work on older browsers.\n * If you want to support older browsers, you might want to use `margin` instead.\n *\n * @see https://caniuse.com/?search=gap\n */\n gap: SpacingValueType;\n /**\n * This uses the native row-gap property which might not work on older browsers.\n * If you want to support older browsers, you might want to use `margin` instead.\n *\n * @see https://caniuse.com/?search=row-gap\n */\n rowGap: SpacingValueType;\n /**\n * This uses the native column-gap property which might not work on older browsers.\n * If you want to support older browsers, you might want to use `margin` instead.\n *\n * @see https://caniuse.com/?search=column-gap\n */\n columnGap: SpacingValueType;\n /**\n * The **`flex`** CSS shorthand property sets how a flex _item_ will grow or shrink to fit the space available in its flex container.\n *\n * @see https://developer.mozilla.org/docs/Web/CSS/flex\n */\n flex: string | number;\n } & PickCSSByPlatform<\n | 'flexWrap'\n | 'flexDirection'\n | 'flexGrow'\n | 'flexShrink'\n | 'flexBasis'\n | 'alignItems'\n | 'alignContent'\n | 'alignSelf'\n | 'justifyItems'\n | 'justifyContent'\n | 'justifySelf'\n | 'placeSelf'\n | 'placeItems'\n | 'order'\n >\n>;\n\ntype PositionProps = MakeObjectResponsive<\n {\n top: SpacingValueType;\n right: SpacingValueType;\n bottom: SpacingValueType;\n left: SpacingValueType;\n } & PickCSSByPlatform<'position' | 'zIndex'>\n>;\n\ntype GridProps = MakeObjectResponsive<\n PickCSSByPlatform<\n | 'grid'\n | 'gridColumn'\n | 'gridRow'\n | 'gridRowStart'\n | 'gridRowEnd'\n | 'gridColumnStart'\n | 'gridColumnEnd'\n | 'gridArea'\n | 'gridAutoFlow'\n | 'gridAutoRows'\n | 'gridAutoColumns'\n | 'gridTemplate'\n | 'gridTemplateAreas'\n | 'gridTemplateColumns'\n | 'gridTemplateRows'\n >\n>;\n\ntype ColorObjects = 'feedback' | 'surface' | 'interactive';\ntype BackgroundOnlyColorObjects = 'popup' | 'overlay';\ntype BackgroundColorString<\n T extends ColorObjects | BackgroundOnlyColorObjects\n> = `${T}.background.${DotNotationToken<Theme['colors'][T]['background']>}`;\ntype BorderColorString<T extends ColorObjects> = `${T}.border.${DotNotationToken<\n Theme['colors'][T]['border']\n>}`;\n\n// Created this as an array so I can reuse it for runtime validation\nconst validBoxAsValues = [\n 'div',\n 'section',\n 'footer',\n 'header',\n 'main',\n 'aside',\n 'nav',\n 'span',\n 'label',\n] as const;\n\ntype BoxAsType = typeof validBoxAsValues[number];\n\n// Visual props that are common for both Box and BaseBox\ntype CommonBoxVisualProps = MakeObjectResponsive<\n {\n borderRadius: keyof Border['radius'];\n borderWidth: keyof Border['width'];\n borderColor: BorderColorString<'surface'>;\n borderTopWidth: keyof Border['width'];\n borderTopColor: BorderColorString<'surface'>;\n borderRightWidth: keyof Border['width'];\n borderRightColor: BorderColorString<'surface'>;\n borderBottomWidth: keyof Border['width'];\n borderBottomColor: BorderColorString<'surface'>;\n borderLeftWidth: keyof Border['width'];\n borderLeftColor: BorderColorString<'surface'>;\n borderTopLeftRadius: keyof Border['radius'];\n borderTopRightRadius: keyof Border['radius'];\n borderBottomRightRadius: keyof Border['radius'];\n borderBottomLeftRadius: keyof Border['radius'];\n } & PickCSSByPlatform<\n | 'backgroundImage'\n | 'backgroundSize'\n | 'backgroundPosition'\n | 'backgroundOrigin'\n | 'backgroundRepeat'\n | 'pointerEvents'\n | 'opacity'\n | 'visibility'\n | 'transform'\n | 'transformOrigin'\n | 'clipPath'\n | 'borderStyle'\n | 'borderTopStyle'\n | 'borderBottomStyle'\n | 'borderLeftStyle'\n | 'borderRightStyle'\n > & {\n /**\n * Sets the elevation for Box\n *\n * eg: `theme.elevation.midRaised`\n *\n * @default `theme.elevation.lowRaised`\n *\n * **Links:**\n * - Docs: https://blade.razorpay.com/?path=/docs/tokens-elevation--docs\n */\n elevation?: keyof Elevation;\n }\n>;\n\n// Visual props that are specific BaseBox\n// This is used to ensure some of the more flexible BaseBox props are not passed to Box\ntype BaseBoxVisualProps = MakeObjectResponsive<\n {\n backgroundColor:\n | BackgroundColorString<'feedback'>\n | BackgroundColorString<'surface'>\n | BackgroundColorString<'interactive'>\n | BackgroundColorString<'overlay'>\n | BackgroundColorString<'popup'>\n | 'transparent'\n | (string & Record<never, never>);\n lineHeight: SpacingValueType;\n touchAction: CSSObject['touchAction'];\n userSelect: CSSObject['userSelect'];\n } & PickCSSByPlatform<\n | 'border'\n | 'borderLeft'\n | 'borderRight'\n | 'borderTop'\n | 'borderBottom'\n | 'opacity'\n | 'pointerEvents'\n | 'cursor'\n >\n>;\n\n// Visual props that are specific to Box\ntype BoxVisualProps = MakeObjectResponsive<{\n backgroundColor:\n | BackgroundColorString<'surface'>\n | BackgroundColorString<'overlay'>\n | 'transparent';\n}> & {\n // Intentionally keeping this outside of MakeObjectResponsive since we only want as to be string and not responsive object\n // styled-components do not support passing `as` prop as an object\n as: BoxAsType;\n};\n\ntype StyledPropsBlade = Partial<\n Omit<\n MarginProps &\n Pick<FlexboxProps, 'alignSelf' | 'justifySelf' | 'placeSelf' | 'order'> &\n PositionProps &\n Pick<\n GridProps,\n | 'gridColumn'\n | 'gridRow'\n | 'gridRowStart'\n | 'gridRowEnd'\n | 'gridColumnStart'\n | 'gridColumnEnd'\n | 'gridArea'\n > &\n Pick<LayoutProps, 'display'> &\n Pick<CommonBoxVisualProps, 'visibility'>,\n '__brand__'\n >\n>;\n\ntype BoxCallbackProps = Omit<\n Platform.Select<{\n web: {\n /**\n * **Warning**\n *\n * Make sure to not use Box when you want to create a trigger that performs action on hover.\n * You would probably want to render it as `button` using `styled.button` instead.\n *\n * Use this for hoverable containers in cases like custom menus.\n */\n onMouseOver: React.MouseEventHandler<HTMLElement>;\n /**\n * **Warning**\n *\n * Make sure to not use Box when you want to create a trigger that performs action on hover.\n * You would probably want to render it as `button` using `styled.button` instead.\n *\n * Use this for hoverable containers in cases like custom menus.\n */\n onMouseEnter: React.MouseEventHandler<HTMLElement>;\n /**\n * **Warning**\n *\n * Make sure to not use Box when you want to create a trigger that performs action on hover.\n * You would probably want to render it as `button` using `styled.button` instead.\n *\n * Use this for hoverable containers in cases like custom menus.\n */\n onMouseLeave: React.MouseEventHandler<HTMLElement>;\n onScroll: React.UIEventHandler<HTMLElement>;\n };\n native: Record<'onMouseOver' | 'onMouseEnter' | 'onMouseLeave' | 'onScroll', undefined>;\n }>,\n '__brand__'\n>;\n\ntype BoxDragAndDropProps = Omit<\n Platform.Select<{\n web: {\n draggable: boolean;\n onDragStart: React.DragEventHandler<HTMLElement>;\n onDragEnter: React.DragEventHandler<HTMLElement>;\n onDragLeave: React.DragEventHandler<HTMLElement>;\n onDragOver: React.DragEventHandler<HTMLElement>;\n onDragEnd: React.DragEventHandler<HTMLElement>;\n onDrop: React.DragEventHandler<HTMLElement>;\n };\n native: Record<\n | 'draggable'\n | 'onDragStart'\n | 'onDragEnter'\n | 'onDragLeave'\n | 'onDragOver'\n | 'onDragEnd'\n | 'onDrop',\n undefined\n >;\n }>,\n '__brand__'\n>;\n\ntype BoxProps = Partial<\n PaddingProps &\n MarginProps &\n LayoutProps &\n FlexboxProps &\n PositionProps &\n GridProps &\n BoxCallbackProps &\n BoxDragAndDropProps &\n CommonBoxVisualProps &\n BoxVisualProps & {\n children?: React.ReactNode | React.ReactNode[];\n tabIndex?: number;\n id?: string;\n } & TestID &\n DataAnalyticsAttribute\n>;\n\n// Visual props have different types for BaseBox and Box. BaseBox has more flexible types and more props exposed.\n// So first we Omit Visual props of Box\n// Then we append BaseBoxVisualProps and some other props for styled-components like class and id\ntype BaseBoxProps = Omit<BoxProps, keyof BoxVisualProps> &\n Partial<\n DataAnalyticsAttribute &\n BaseBoxVisualProps & {\n className?: string;\n id?: string;\n tabIndex?: number;\n }\n > &\n BladeCommonEvents;\n\n// ref prop type\ntype BoxRefType = Platform.Select<{\n web: Omit<HTMLElement, 'style'>;\n native: View;\n}>;\n\nexport type { BaseBoxProps, BoxProps, BoxRefType, StyledPropsBlade, FlexboxProps };\nexport { validBoxAsValues };\n"],"names":["validBoxAsValues"],"mappings":"AA8GM,IAAAA,gBAAgB,CAAG,CACvB,KAAK,CACL,SAAS,CACT,QAAQ,CACR,QAAQ,CACR,MAAM,CACN,OAAO,CACP,KAAK,CACL,MAAM,CACN,OAAO;;;;"}
|
|
@@ -12,7 +12,7 @@ import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/a
|
|
|
12
12
|
import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
|
|
13
13
|
import { jsx } from 'react/jsx-runtime';
|
|
14
14
|
|
|
15
|
-
var validateBackgroundString=function validateBackgroundString(stringBackgroundColorValue){if(__DEV__){if(!stringBackgroundColorValue.startsWith('surface.background')&&!stringBackgroundColorValue.startsWith('brand.')&&stringBackgroundColorValue!=='transparent'){throwBladeError({message:`Oops! Currently you can only use \`transparent\`, \`surface.background.*\`, and \`brand.*\` tokens with backgroundColor property but we received \`${stringBackgroundColorValue}\` instead.\n\n Do you have a usecase of using other values? Create an issue on https://github.com/razorpay/blade repo to let us know and we can discuss ✨`,moduleName:'Box'});}}};var validateBackgroundProp=function validateBackgroundProp(responsiveBackgroundColor){if(__DEV__){if(responsiveBackgroundColor){if(typeof responsiveBackgroundColor==='string'){validateBackgroundString(responsiveBackgroundColor);return;}Object.values(responsiveBackgroundColor).forEach(function(backgroundColor){if(typeof backgroundColor==='string'){validateBackgroundString(backgroundColor);}});}}};var makeBoxProps=function makeBoxProps(props){return {display:props.display,overflow:props.overflow,overflowX:props.overflowX,overflowY:props.overflowY,whiteSpace:props.whiteSpace,height:props.height,minHeight:props.minHeight,maxHeight:props.maxHeight,width:props.width,minWidth:props.minWidth,maxWidth:props.maxWidth,textAlign:props.textAlign,flex:props.flex,flexWrap:props.flexWrap,flexDirection:props.flexDirection,flexGrow:props.flexGrow,flexShrink:props.flexShrink,flexBasis:props.flexBasis,alignItems:props.alignItems,alignContent:props.alignContent,alignSelf:props.alignSelf,justifyItems:props.justifyItems,justifyContent:props.justifyContent,justifySelf:props.justifySelf,placeSelf:props.placeSelf,placeItems:props.placeItems,order:props.order,grid:props.grid,gridColumn:props.gridColumn,gridRow:props.gridRow,gridRowStart:props.gridRowStart,gridRowEnd:props.gridRowEnd,gridColumnStart:props.gridColumnStart,gridColumnEnd:props.gridColumnEnd,gridArea:props.gridArea,gridAutoFlow:props.gridAutoFlow,gridAutoRows:props.gridAutoRows,gridAutoColumns:props.gridAutoColumns,gridTemplate:props.gridTemplate,gridTemplateAreas:props.gridTemplateAreas,gridTemplateColumns:props.gridTemplateColumns,gridTemplateRows:props.gridTemplateRows,padding:props.padding,paddingTop:props.paddingTop,paddingBottom:props.paddingBottom,paddingRight:props.paddingRight,paddingLeft:props.paddingLeft,paddingX:props.paddingX,paddingY:props.paddingY,margin:props.margin,marginBottom:props.marginBottom,marginTop:props.marginTop,marginRight:props.marginRight,marginLeft:props.marginLeft,marginX:props.marginX,marginY:props.marginY,gap:props.gap,rowGap:props.rowGap,columnGap:props.columnGap,position:props.position,zIndex:props.zIndex,top:props.top,right:props.right,bottom:props.bottom,left:props.left,backgroundColor:props.backgroundColor,backgroundImage:props.backgroundImage,backgroundSize:props.backgroundSize,backgroundPosition:props.backgroundPosition,backgroundOrigin:props.backgroundOrigin,backgroundRepeat:props.backgroundRepeat,elevation:props.elevation,opacity:props.opacity,visibility:props.visibility,borderWidth:props.borderWidth,borderColor:props.borderColor,borderStyle:props.borderStyle,borderTopWidth:props.borderTopWidth,borderTopColor:props.borderTopColor,borderTopStyle:props.borderTopStyle,borderRightWidth:props.borderRightWidth,borderRightColor:props.borderRightColor,borderRightStyle:props.borderRightStyle,borderBottomWidth:props.borderBottomWidth,borderBottomColor:props.borderBottomColor,borderBottomStyle:props.borderBottomStyle,borderLeftWidth:props.borderLeftWidth,borderLeftColor:props.borderLeftColor,borderLeftStyle:props.borderLeftStyle,borderRadius:props.borderRadius,borderTopLeftRadius:props.borderTopLeftRadius,borderTopRightRadius:props.borderTopRightRadius,borderBottomRightRadius:props.borderBottomRightRadius,borderBottomLeftRadius:props.borderBottomLeftRadius,transform:props.transform,transformOrigin:props.transformOrigin,clipPath:props.clipPath,onMouseEnter:props.onMouseEnter,onMouseLeave:props.onMouseLeave,onMouseOver:props.onMouseOver,onScroll:props.onScroll,draggable:props.draggable,onDragStart:props.onDragStart,onDragEnd:props.onDragEnd,onDragEnter:props.onDragEnter,onDragLeave:props.onDragLeave,onDragOver:props.onDragOver,onDrop:props.onDrop,pointerEvents:props.pointerEvents,children:props.children,tabIndex:props.tabIndex,as:isReactNative()?undefined:props.as};};var _Box=function _Box(props,ref){React__default.useEffect(function(){if(__DEV__){validateBackgroundProp(props.backgroundColor);}},[props.backgroundColor]);React__default.useEffect(function(){if(__DEV__){if(props.as){if(isReactNative()){throwBladeError({message:'`as` prop is not supported on React Native',moduleName:'Box'});}if(!validBoxAsValues.includes(props.as)){throwBladeError({message:`Invalid \`as\` prop value - ${props.as}. Only ${validBoxAsValues.join(', ')} are valid values`,moduleName:'Box'});}}}},[props.as]);return jsx(BaseBox,Object.assign({ref:ref,id:props.id},metaAttribute({name:MetaConstants.Box,testID:props.testID}),makeBoxProps(props),makeAnalyticsAttribute(props)));};var Box=assignWithoutSideEffects(React__default.forwardRef(_Box),{displayName:'Box',componentId:'Box'});
|
|
15
|
+
var validateBackgroundString=function validateBackgroundString(stringBackgroundColorValue){if(__DEV__){if(!stringBackgroundColorValue.startsWith('surface.background')&&!stringBackgroundColorValue.startsWith('brand.')&&!stringBackgroundColorValue.startsWith('overlay.')&&stringBackgroundColorValue!=='transparent'){throwBladeError({message:`Oops! Currently you can only use \`transparent\`, \`surface.background.*\`, \`overlay.*\` and \`brand.*\` tokens with backgroundColor property but we received \`${stringBackgroundColorValue}\` instead.\n\n Do you have a usecase of using other values? Create an issue on https://github.com/razorpay/blade repo to let us know and we can discuss ✨`,moduleName:'Box'});}}};var validateBackgroundProp=function validateBackgroundProp(responsiveBackgroundColor){if(__DEV__){if(responsiveBackgroundColor){if(typeof responsiveBackgroundColor==='string'){validateBackgroundString(responsiveBackgroundColor);return;}Object.values(responsiveBackgroundColor).forEach(function(backgroundColor){if(typeof backgroundColor==='string'){validateBackgroundString(backgroundColor);}});}}};var makeBoxProps=function makeBoxProps(props){return {display:props.display,overflow:props.overflow,overflowX:props.overflowX,overflowY:props.overflowY,whiteSpace:props.whiteSpace,height:props.height,minHeight:props.minHeight,maxHeight:props.maxHeight,width:props.width,minWidth:props.minWidth,maxWidth:props.maxWidth,textAlign:props.textAlign,flex:props.flex,flexWrap:props.flexWrap,flexDirection:props.flexDirection,flexGrow:props.flexGrow,flexShrink:props.flexShrink,flexBasis:props.flexBasis,alignItems:props.alignItems,alignContent:props.alignContent,alignSelf:props.alignSelf,justifyItems:props.justifyItems,justifyContent:props.justifyContent,justifySelf:props.justifySelf,placeSelf:props.placeSelf,placeItems:props.placeItems,order:props.order,grid:props.grid,gridColumn:props.gridColumn,gridRow:props.gridRow,gridRowStart:props.gridRowStart,gridRowEnd:props.gridRowEnd,gridColumnStart:props.gridColumnStart,gridColumnEnd:props.gridColumnEnd,gridArea:props.gridArea,gridAutoFlow:props.gridAutoFlow,gridAutoRows:props.gridAutoRows,gridAutoColumns:props.gridAutoColumns,gridTemplate:props.gridTemplate,gridTemplateAreas:props.gridTemplateAreas,gridTemplateColumns:props.gridTemplateColumns,gridTemplateRows:props.gridTemplateRows,padding:props.padding,paddingTop:props.paddingTop,paddingBottom:props.paddingBottom,paddingRight:props.paddingRight,paddingLeft:props.paddingLeft,paddingX:props.paddingX,paddingY:props.paddingY,margin:props.margin,marginBottom:props.marginBottom,marginTop:props.marginTop,marginRight:props.marginRight,marginLeft:props.marginLeft,marginX:props.marginX,marginY:props.marginY,gap:props.gap,rowGap:props.rowGap,columnGap:props.columnGap,position:props.position,zIndex:props.zIndex,top:props.top,right:props.right,bottom:props.bottom,left:props.left,backgroundColor:props.backgroundColor,backgroundImage:props.backgroundImage,backgroundSize:props.backgroundSize,backgroundPosition:props.backgroundPosition,backgroundOrigin:props.backgroundOrigin,backgroundRepeat:props.backgroundRepeat,elevation:props.elevation,opacity:props.opacity,visibility:props.visibility,borderWidth:props.borderWidth,borderColor:props.borderColor,borderStyle:props.borderStyle,borderTopWidth:props.borderTopWidth,borderTopColor:props.borderTopColor,borderTopStyle:props.borderTopStyle,borderRightWidth:props.borderRightWidth,borderRightColor:props.borderRightColor,borderRightStyle:props.borderRightStyle,borderBottomWidth:props.borderBottomWidth,borderBottomColor:props.borderBottomColor,borderBottomStyle:props.borderBottomStyle,borderLeftWidth:props.borderLeftWidth,borderLeftColor:props.borderLeftColor,borderLeftStyle:props.borderLeftStyle,borderRadius:props.borderRadius,borderTopLeftRadius:props.borderTopLeftRadius,borderTopRightRadius:props.borderTopRightRadius,borderBottomRightRadius:props.borderBottomRightRadius,borderBottomLeftRadius:props.borderBottomLeftRadius,transform:props.transform,transformOrigin:props.transformOrigin,clipPath:props.clipPath,onMouseEnter:props.onMouseEnter,onMouseLeave:props.onMouseLeave,onMouseOver:props.onMouseOver,onScroll:props.onScroll,draggable:props.draggable,onDragStart:props.onDragStart,onDragEnd:props.onDragEnd,onDragEnter:props.onDragEnter,onDragLeave:props.onDragLeave,onDragOver:props.onDragOver,onDrop:props.onDrop,pointerEvents:props.pointerEvents,children:props.children,tabIndex:props.tabIndex,as:isReactNative()?undefined:props.as};};var _Box=function _Box(props,ref){React__default.useEffect(function(){if(__DEV__){validateBackgroundProp(props.backgroundColor);}},[props.backgroundColor]);React__default.useEffect(function(){if(__DEV__){if(props.as){if(isReactNative()){throwBladeError({message:'`as` prop is not supported on React Native',moduleName:'Box'});}if(!validBoxAsValues.includes(props.as)){throwBladeError({message:`Invalid \`as\` prop value - ${props.as}. Only ${validBoxAsValues.join(', ')} are valid values`,moduleName:'Box'});}}}},[props.as]);return jsx(BaseBox,Object.assign({ref:ref,id:props.id},metaAttribute({name:MetaConstants.Box,testID:props.testID}),makeBoxProps(props),makeAnalyticsAttribute(props)));};var Box=assignWithoutSideEffects(React__default.forwardRef(_Box),{displayName:'Box',componentId:'Box'});
|
|
16
16
|
|
|
17
17
|
export { Box, makeBoxProps };
|
|
18
18
|
//# sourceMappingURL=Box.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Box.js","sources":["../../../../../src/components/Box/Box.tsx"],"sourcesContent":["import React from 'react';\nimport BaseBox from './BaseBox';\nimport type { BoxProps, BoxRefType, MakeValueResponsive } from './BaseBox/types';\nimport { validBoxAsValues } from './BaseBox/types/propsTypes';\nimport type { KeysRequired } from '~utils/types';\nimport { isReactNative } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { throwBladeError } from '~utils/logger';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\nconst validateBackgroundString = (stringBackgroundColorValue: string): void => {\n if (__DEV__) {\n if (\n !stringBackgroundColorValue.startsWith('surface.background') &&\n !stringBackgroundColorValue.startsWith('brand.') &&\n stringBackgroundColorValue !== 'transparent'\n ) {\n throwBladeError({\n message: `Oops! Currently you can only use \\`transparent\\`, \\`surface.background.*\\`, and \\`brand.*\\` tokens with backgroundColor property but we received \\`${stringBackgroundColorValue}\\` instead.\\n\\n Do you have a usecase of using other values? Create an issue on https://github.com/razorpay/blade repo to let us know and we can discuss ✨`,\n moduleName: 'Box',\n });\n }\n }\n};\n\nconst validateBackgroundProp = (\n responsiveBackgroundColor: MakeValueResponsive<string | undefined>,\n): void => {\n if (__DEV__) {\n if (responsiveBackgroundColor) {\n if (typeof responsiveBackgroundColor === 'string') {\n validateBackgroundString(responsiveBackgroundColor);\n return;\n }\n\n Object.values(responsiveBackgroundColor).forEach((backgroundColor) => {\n if (typeof backgroundColor === 'string') {\n validateBackgroundString(backgroundColor);\n }\n });\n }\n }\n};\n\n/**\n * This function is to filter out any unexpected props passed by the user\n */\nconst makeBoxProps = (\n props: BoxProps,\n): KeysRequired<Omit<BoxProps, 'testID' | 'id' | '__brand__'>> => {\n return {\n // Layout\n display: props.display,\n overflow: props.overflow,\n overflowX: props.overflowX,\n overflowY: props.overflowY,\n whiteSpace: props.whiteSpace,\n height: props.height,\n minHeight: props.minHeight,\n maxHeight: props.maxHeight,\n width: props.width,\n minWidth: props.minWidth,\n maxWidth: props.maxWidth,\n textAlign: props.textAlign,\n\n // Flex\n flex: props.flex,\n flexWrap: props.flexWrap,\n flexDirection: props.flexDirection,\n flexGrow: props.flexGrow,\n flexShrink: props.flexShrink,\n flexBasis: props.flexBasis,\n alignItems: props.alignItems,\n alignContent: props.alignContent,\n alignSelf: props.alignSelf,\n justifyItems: props.justifyItems,\n justifyContent: props.justifyContent,\n justifySelf: props.justifySelf,\n placeSelf: props.placeSelf,\n placeItems: props.placeItems,\n order: props.order,\n\n // Grid\n grid: props.grid,\n gridColumn: props.gridColumn,\n gridRow: props.gridRow,\n gridRowStart: props.gridRowStart,\n gridRowEnd: props.gridRowEnd,\n gridColumnStart: props.gridColumnStart,\n gridColumnEnd: props.gridColumnEnd,\n gridArea: props.gridArea,\n gridAutoFlow: props.gridAutoFlow,\n gridAutoRows: props.gridAutoRows,\n gridAutoColumns: props.gridAutoColumns,\n gridTemplate: props.gridTemplate,\n gridTemplateAreas: props.gridTemplateAreas,\n gridTemplateColumns: props.gridTemplateColumns,\n gridTemplateRows: props.gridTemplateRows,\n\n // Spacing\n padding: props.padding,\n paddingTop: props.paddingTop,\n paddingBottom: props.paddingBottom,\n paddingRight: props.paddingRight,\n paddingLeft: props.paddingLeft,\n paddingX: props.paddingX,\n paddingY: props.paddingY,\n margin: props.margin,\n marginBottom: props.marginBottom,\n marginTop: props.marginTop,\n marginRight: props.marginRight,\n marginLeft: props.marginLeft,\n marginX: props.marginX,\n marginY: props.marginY,\n gap: props.gap,\n rowGap: props.rowGap,\n columnGap: props.columnGap,\n\n // Position\n position: props.position,\n zIndex: props.zIndex,\n top: props.top,\n right: props.right,\n bottom: props.bottom,\n left: props.left,\n\n // Visual\n backgroundColor: props.backgroundColor,\n backgroundImage: props.backgroundImage,\n backgroundSize: props.backgroundSize,\n backgroundPosition: props.backgroundPosition,\n backgroundOrigin: props.backgroundOrigin,\n backgroundRepeat: props.backgroundRepeat,\n elevation: props.elevation,\n opacity: props.opacity,\n visibility: props.visibility,\n\n // Border\n borderWidth: props.borderWidth,\n borderColor: props.borderColor,\n borderStyle: props.borderStyle,\n borderTopWidth: props.borderTopWidth,\n borderTopColor: props.borderTopColor,\n borderTopStyle: props.borderTopStyle,\n borderRightWidth: props.borderRightWidth,\n borderRightColor: props.borderRightColor,\n borderRightStyle: props.borderRightStyle,\n borderBottomWidth: props.borderBottomWidth,\n borderBottomColor: props.borderBottomColor,\n borderBottomStyle: props.borderBottomStyle,\n borderLeftWidth: props.borderLeftWidth,\n borderLeftColor: props.borderLeftColor,\n borderLeftStyle: props.borderLeftStyle,\n borderRadius: props.borderRadius,\n borderTopLeftRadius: props.borderTopLeftRadius,\n borderTopRightRadius: props.borderTopRightRadius,\n borderBottomRightRadius: props.borderBottomRightRadius,\n borderBottomLeftRadius: props.borderBottomLeftRadius,\n\n // Polygon Support\n transform: props.transform,\n transformOrigin: props.transformOrigin,\n clipPath: props.clipPath,\n\n // callbacks\n onMouseEnter: props.onMouseEnter,\n onMouseLeave: props.onMouseLeave,\n onMouseOver: props.onMouseOver,\n onScroll: props.onScroll,\n\n // Drag and Drop\n draggable: props.draggable,\n onDragStart: props.onDragStart,\n onDragEnd: props.onDragEnd,\n onDragEnter: props.onDragEnter,\n onDragLeave: props.onDragLeave,\n onDragOver: props.onDragOver,\n onDrop: props.onDrop,\n\n pointerEvents: props.pointerEvents,\n children: props.children,\n tabIndex: props.tabIndex,\n as: isReactNative() ? undefined : props.as, // as is not supported on react-native\n };\n};\n\n/**\n * ## Box\n * \n * Box is the basic Layout component.\n *\n *\n * Box components supports most spacing CSS properties like `display`, `padding*`, `flex*`, `height`, `width`, etc.\n *\n * Check out {@linkcode BoxProps BoxPropsType} for complete list of props and [Layout RFC](https://github.com/razorpay/blade/blob/master/rfcs/2023-01-06-layout.md) for more details on API decision.\n * \n * ----\n * \n * ### Usage\n * \n * ```jsx\n * <Box display=\"flex\">\n * ```\n\n * #### Responsive Props\n *\n * ```jsx\n * <Box padding={{ base: 'spacing.3', m: 'spacing.10' }} />\n * ```\n * \n * #### Margin and Padding Shorthands\n * \n * ```jsx\n * <Box padding={[\"spacing.3\", \"spacing.10\"]} />\n * ```\n *\n * ---\n * \n * Checkout {@link https://blade.razorpay.com/?path=/docs/components-box Box Documentation}\n * \n */\nconst _Box: React.ForwardRefRenderFunction<BoxRefType, BoxProps> = (props, ref) => {\n React.useEffect(() => {\n if (__DEV__) {\n validateBackgroundProp(props.backgroundColor);\n }\n }, [props.backgroundColor]);\n\n React.useEffect(() => {\n if (__DEV__) {\n if (props.as) {\n if (isReactNative()) {\n throwBladeError({\n message: '`as` prop is not supported on React Native',\n moduleName: 'Box',\n });\n }\n\n if (!validBoxAsValues.includes(props.as)) {\n throwBladeError({\n message: `Invalid \\`as\\` prop value - ${props.as}. Only ${validBoxAsValues.join(\n ', ',\n )} are valid values`,\n moduleName: 'Box',\n });\n }\n }\n }\n }, [props.as]);\n\n return (\n <BaseBox\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref={ref as any}\n id={props.id}\n {...metaAttribute({ name: MetaConstants.Box, testID: props.testID })}\n {...makeBoxProps(props)}\n {...makeAnalyticsAttribute(props)}\n />\n );\n};\n\nconst Box = assignWithoutSideEffects(React.forwardRef(_Box), {\n displayName: 'Box',\n componentId: 'Box',\n});\n\nexport { Box, makeBoxProps };\n"],"names":["validateBackgroundString","stringBackgroundColorValue","__DEV__","startsWith","throwBladeError","message","moduleName","validateBackgroundProp","responsiveBackgroundColor","Object","values","forEach","backgroundColor","makeBoxProps","props","display","overflow","overflowX","overflowY","whiteSpace","height","minHeight","maxHeight","width","minWidth","maxWidth","textAlign","flex","flexWrap","flexDirection","flexGrow","flexShrink","flexBasis","alignItems","alignContent","alignSelf","justifyItems","justifyContent","justifySelf","placeSelf","placeItems","order","grid","gridColumn","gridRow","gridRowStart","gridRowEnd","gridColumnStart","gridColumnEnd","gridArea","gridAutoFlow","gridAutoRows","gridAutoColumns","gridTemplate","gridTemplateAreas","gridTemplateColumns","gridTemplateRows","padding","paddingTop","paddingBottom","paddingRight","paddingLeft","paddingX","paddingY","margin","marginBottom","marginTop","marginRight","marginLeft","marginX","marginY","gap","rowGap","columnGap","position","zIndex","top","right","bottom","left","backgroundImage","backgroundSize","backgroundPosition","backgroundOrigin","backgroundRepeat","elevation","opacity","visibility","borderWidth","borderColor","borderStyle","borderTopWidth","borderTopColor","borderTopStyle","borderRightWidth","borderRightColor","borderRightStyle","borderBottomWidth","borderBottomColor","borderBottomStyle","borderLeftWidth","borderLeftColor","borderLeftStyle","borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","transform","transformOrigin","clipPath","onMouseEnter","onMouseLeave","onMouseOver","onScroll","draggable","onDragStart","onDragEnd","onDragEnter","onDragLeave","onDragOver","onDrop","pointerEvents","children","tabIndex","as","isReactNative","undefined","_Box","ref","React","useEffect","validBoxAsValues","includes","join","_jsx","BaseBox","assign","id","metaAttribute","name","MetaConstants","Box","testID","makeAnalyticsAttribute","assignWithoutSideEffects","forwardRef","displayName","componentId"],"mappings":";;;;;;;;;;;;;;AAWA,IAAMA,wBAAwB,CAAG,SAA3BA,wBAAwBA,CAAIC,0BAAkC,CAAW,CAC7E,GAAIC,OAAO,CAAE,CACX,GACE,CAACD,0BAA0B,CAACE,UAAU,CAAC,oBAAoB,CAAC,EAC5D,CAACF,0BAA0B,CAACE,UAAU,CAAC,QAAQ,CAAC,EAChDF,0BAA0B,GAAK,aAAa,CAC5C,CACAG,eAAe,CAAC,CACdC,OAAO,CAAG,CAAqJJ,mJAAAA,EAAAA,0BAA2B,CAA2J,0JAAA,CAAA,CACrVK,UAAU,CAAE,KACd,CAAC,CAAC,CACJ,CACF,CACF,CAAC,CAED,IAAMC,sBAAsB,CAAG,SAAzBA,sBAAsBA,CAC1BC,yBAAkE,CACzD,CACT,GAAIN,OAAO,CAAE,CACX,GAAIM,yBA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EC,aAAa,CAACC,GAAG,CAAEC,MAAM,CAAEjI,KAAK,CAACiI,MAAO,CAAC,CAAC,CAChElI,YAAY,CAACC,KAAK,CAAC,CACnBkI,sBAAsB,CAAClI,KAAK,CAAC,CAClC,CAAC,CAEN,CAAC,CAEK,IAAAgI,GAAG,CAAGG,wBAAwB,CAACf,cAAK,CAACgB,UAAU,CAAClB,IAAI,CAAC,CAAE,CAC3DmB,WAAW,CAAE,KAAK,CAClBC,WAAW,CAAE,KACf,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"Box.js","sources":["../../../../../src/components/Box/Box.tsx"],"sourcesContent":["import React from 'react';\nimport BaseBox from './BaseBox';\nimport type { BoxProps, BoxRefType, MakeValueResponsive } from './BaseBox/types';\nimport { validBoxAsValues } from './BaseBox/types/propsTypes';\nimport type { KeysRequired } from '~utils/types';\nimport { isReactNative } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { throwBladeError } from '~utils/logger';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\nconst validateBackgroundString = (stringBackgroundColorValue: string): void => {\n if (__DEV__) {\n if (\n !stringBackgroundColorValue.startsWith('surface.background') &&\n !stringBackgroundColorValue.startsWith('brand.') &&\n !stringBackgroundColorValue.startsWith('overlay.') &&\n stringBackgroundColorValue !== 'transparent'\n ) {\n throwBladeError({\n message: `Oops! Currently you can only use \\`transparent\\`, \\`surface.background.*\\`, \\`overlay.*\\` and \\`brand.*\\` tokens with backgroundColor property but we received \\`${stringBackgroundColorValue}\\` instead.\\n\\n Do you have a usecase of using other values? Create an issue on https://github.com/razorpay/blade repo to let us know and we can discuss ✨`,\n moduleName: 'Box',\n });\n }\n }\n};\n\nconst validateBackgroundProp = (\n responsiveBackgroundColor: MakeValueResponsive<string | undefined>,\n): void => {\n if (__DEV__) {\n if (responsiveBackgroundColor) {\n if (typeof responsiveBackgroundColor === 'string') {\n validateBackgroundString(responsiveBackgroundColor);\n return;\n }\n\n Object.values(responsiveBackgroundColor).forEach((backgroundColor) => {\n if (typeof backgroundColor === 'string') {\n validateBackgroundString(backgroundColor);\n }\n });\n }\n }\n};\n\n/**\n * This function is to filter out any unexpected props passed by the user\n */\nconst makeBoxProps = (\n props: BoxProps,\n): KeysRequired<Omit<BoxProps, 'testID' | 'id' | '__brand__'>> => {\n return {\n // Layout\n display: props.display,\n overflow: props.overflow,\n overflowX: props.overflowX,\n overflowY: props.overflowY,\n whiteSpace: props.whiteSpace,\n height: props.height,\n minHeight: props.minHeight,\n maxHeight: props.maxHeight,\n width: props.width,\n minWidth: props.minWidth,\n maxWidth: props.maxWidth,\n textAlign: props.textAlign,\n\n // Flex\n flex: props.flex,\n flexWrap: props.flexWrap,\n flexDirection: props.flexDirection,\n flexGrow: props.flexGrow,\n flexShrink: props.flexShrink,\n flexBasis: props.flexBasis,\n alignItems: props.alignItems,\n alignContent: props.alignContent,\n alignSelf: props.alignSelf,\n justifyItems: props.justifyItems,\n justifyContent: props.justifyContent,\n justifySelf: props.justifySelf,\n placeSelf: props.placeSelf,\n placeItems: props.placeItems,\n order: props.order,\n\n // Grid\n grid: props.grid,\n gridColumn: props.gridColumn,\n gridRow: props.gridRow,\n gridRowStart: props.gridRowStart,\n gridRowEnd: props.gridRowEnd,\n gridColumnStart: props.gridColumnStart,\n gridColumnEnd: props.gridColumnEnd,\n gridArea: props.gridArea,\n gridAutoFlow: props.gridAutoFlow,\n gridAutoRows: props.gridAutoRows,\n gridAutoColumns: props.gridAutoColumns,\n gridTemplate: props.gridTemplate,\n gridTemplateAreas: props.gridTemplateAreas,\n gridTemplateColumns: props.gridTemplateColumns,\n gridTemplateRows: props.gridTemplateRows,\n\n // Spacing\n padding: props.padding,\n paddingTop: props.paddingTop,\n paddingBottom: props.paddingBottom,\n paddingRight: props.paddingRight,\n paddingLeft: props.paddingLeft,\n paddingX: props.paddingX,\n paddingY: props.paddingY,\n margin: props.margin,\n marginBottom: props.marginBottom,\n marginTop: props.marginTop,\n marginRight: props.marginRight,\n marginLeft: props.marginLeft,\n marginX: props.marginX,\n marginY: props.marginY,\n gap: props.gap,\n rowGap: props.rowGap,\n columnGap: props.columnGap,\n\n // Position\n position: props.position,\n zIndex: props.zIndex,\n top: props.top,\n right: props.right,\n bottom: props.bottom,\n left: props.left,\n\n // Visual\n backgroundColor: props.backgroundColor,\n backgroundImage: props.backgroundImage,\n backgroundSize: props.backgroundSize,\n backgroundPosition: props.backgroundPosition,\n backgroundOrigin: props.backgroundOrigin,\n backgroundRepeat: props.backgroundRepeat,\n elevation: props.elevation,\n opacity: props.opacity,\n visibility: props.visibility,\n\n // Border\n borderWidth: props.borderWidth,\n borderColor: props.borderColor,\n borderStyle: props.borderStyle,\n borderTopWidth: props.borderTopWidth,\n borderTopColor: props.borderTopColor,\n borderTopStyle: props.borderTopStyle,\n borderRightWidth: props.borderRightWidth,\n borderRightColor: props.borderRightColor,\n borderRightStyle: props.borderRightStyle,\n borderBottomWidth: props.borderBottomWidth,\n borderBottomColor: props.borderBottomColor,\n borderBottomStyle: props.borderBottomStyle,\n borderLeftWidth: props.borderLeftWidth,\n borderLeftColor: props.borderLeftColor,\n borderLeftStyle: props.borderLeftStyle,\n borderRadius: props.borderRadius,\n borderTopLeftRadius: props.borderTopLeftRadius,\n borderTopRightRadius: props.borderTopRightRadius,\n borderBottomRightRadius: props.borderBottomRightRadius,\n borderBottomLeftRadius: props.borderBottomLeftRadius,\n\n // Polygon Support\n transform: props.transform,\n transformOrigin: props.transformOrigin,\n clipPath: props.clipPath,\n\n // callbacks\n onMouseEnter: props.onMouseEnter,\n onMouseLeave: props.onMouseLeave,\n onMouseOver: props.onMouseOver,\n onScroll: props.onScroll,\n\n // Drag and Drop\n draggable: props.draggable,\n onDragStart: props.onDragStart,\n onDragEnd: props.onDragEnd,\n onDragEnter: props.onDragEnter,\n onDragLeave: props.onDragLeave,\n onDragOver: props.onDragOver,\n onDrop: props.onDrop,\n\n pointerEvents: props.pointerEvents,\n children: props.children,\n tabIndex: props.tabIndex,\n as: isReactNative() ? undefined : props.as, // as is not supported on react-native\n };\n};\n\n/**\n * ## Box\n * \n * Box is the basic Layout component.\n *\n *\n * Box components supports most spacing CSS properties like `display`, `padding*`, `flex*`, `height`, `width`, etc.\n *\n * Check out {@linkcode BoxProps BoxPropsType} for complete list of props and [Layout RFC](https://github.com/razorpay/blade/blob/master/rfcs/2023-01-06-layout.md) for more details on API decision.\n * \n * ----\n * \n * ### Usage\n * \n * ```jsx\n * <Box display=\"flex\">\n * ```\n\n * #### Responsive Props\n *\n * ```jsx\n * <Box padding={{ base: 'spacing.3', m: 'spacing.10' }} />\n * ```\n * \n * #### Margin and Padding Shorthands\n * \n * ```jsx\n * <Box padding={[\"spacing.3\", \"spacing.10\"]} />\n * ```\n *\n * ---\n * \n * Checkout {@link https://blade.razorpay.com/?path=/docs/components-box Box Documentation}\n * \n */\nconst _Box: React.ForwardRefRenderFunction<BoxRefType, BoxProps> = (props, ref) => {\n React.useEffect(() => {\n if (__DEV__) {\n validateBackgroundProp(props.backgroundColor);\n }\n }, [props.backgroundColor]);\n\n React.useEffect(() => {\n if (__DEV__) {\n if (props.as) {\n if (isReactNative()) {\n throwBladeError({\n message: '`as` prop is not supported on React Native',\n moduleName: 'Box',\n });\n }\n\n if (!validBoxAsValues.includes(props.as)) {\n throwBladeError({\n message: `Invalid \\`as\\` prop value - ${props.as}. Only ${validBoxAsValues.join(\n ', ',\n )} are valid values`,\n moduleName: 'Box',\n });\n }\n }\n }\n }, [props.as]);\n\n return (\n <BaseBox\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref={ref as any}\n id={props.id}\n {...metaAttribute({ name: MetaConstants.Box, testID: props.testID })}\n {...makeBoxProps(props)}\n {...makeAnalyticsAttribute(props)}\n />\n );\n};\n\nconst Box = assignWithoutSideEffects(React.forwardRef(_Box), {\n displayName: 'Box',\n componentId: 'Box',\n});\n\nexport { Box, makeBoxProps };\n"],"names":["validateBackgroundString","stringBackgroundColorValue","__DEV__","startsWith","throwBladeError","message","moduleName","validateBackgroundProp","responsiveBackgroundColor","Object","values","forEach","backgroundColor","makeBoxProps","props","display","overflow","overflowX","overflowY","whiteSpace","height","minHeight","maxHeight","width","minWidth","maxWidth","textAlign","flex","flexWrap","flexDirection","flexGrow","flexShrink","flexBasis","alignItems","alignContent","alignSelf","justifyItems","justifyContent","justifySelf","placeSelf","placeItems","order","grid","gridColumn","gridRow","gridRowStart","gridRowEnd","gridColumnStart","gridColumnEnd","gridArea","gridAutoFlow","gridAutoRows","gridAutoColumns","gridTemplate","gridTemplateAreas","gridTemplateColumns","gridTemplateRows","padding","paddingTop","paddingBottom","paddingRight","paddingLeft","paddingX","paddingY","margin","marginBottom","marginTop","marginRight","marginLeft","marginX","marginY","gap","rowGap","columnGap","position","zIndex","top","right","bottom","left","backgroundImage","backgroundSize","backgroundPosition","backgroundOrigin","backgroundRepeat","elevation","opacity","visibility","borderWidth","borderColor","borderStyle","borderTopWidth","borderTopColor","borderTopStyle","borderRightWidth","borderRightColor","borderRightStyle","borderBottomWidth","borderBottomColor","borderBottomStyle","borderLeftWidth","borderLeftColor","borderLeftStyle","borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","transform","transformOrigin","clipPath","onMouseEnter","onMouseLeave","onMouseOver","onScroll","draggable","onDragStart","onDragEnd","onDragEnter","onDragLeave","onDragOver","onDrop","pointerEvents","children","tabIndex","as","isReactNative","undefined","_Box","ref","React","useEffect","validBoxAsValues","includes","join","_jsx","BaseBox","assign","id","metaAttribute","name","MetaConstants","Box","testID","makeAnalyticsAttribute","assignWithoutSideEffects","forwardRef","displayName","componentId"],"mappings":";;;;;;;;;;;;;;AAWA,IAAMA,wBAAwB,CAAG,SAA3BA,wBAAwBA,CAAIC,0BAAkC,CAAW,CAC7E,GAAIC,OAAO,CAAE,CACX,GACE,CAACD,0BAA0B,CAACE,UAAU,CAAC,oBAAoB,CA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A,EAA8BS,KAAK,CAAC+G,EAAG,CAAA,OAAA,EAASO,gBAAgB,CAACE,IAAI,CAC7E,IACF,CAAE,CAAA,iBAAA,CAAkB,CACpBhI,UAAU,CAAE,KACd,CAAC,CAAC,CACJ,CACF,CACF,CACF,CAAC,CAAE,CAACQ,KAAK,CAAC+G,EAAE,CAAC,CAAC,CAEd,OACEU,GAAA,CAACC,OAAO,CAAA/H,MAAA,CAAAgI,MAAA,CAAA,CAENR,GAAG,CAAEA,GAAW,CAChBS,EAAE,CAAE5H,KAAK,CAAC4H,EAAG,CACTC,CAAAA,aAAa,CAAC,CAAEC,IAAI,CAAEC,aAAa,CAACC,GAAG,CAAEC,MAAM,CAAEjI,KAAK,CAACiI,MAAO,CAAC,CAAC,CAChElI,YAAY,CAACC,KAAK,CAAC,CACnBkI,sBAAsB,CAAClI,KAAK,CAAC,CAClC,CAAC,CAEN,CAAC,CAEK,IAAAgI,GAAG,CAAGG,wBAAwB,CAACf,cAAK,CAACgB,UAAU,CAAClB,IAAI,CAAC,CAAE,CAC3DmB,WAAW,CAAE,KAAK,CAClBC,WAAW,CAAE,KACf,CAAC;;;;"}
|
|
@@ -33,7 +33,7 @@ import { MetaConstants } from '../../../utils/metaAttribute/metaConstants.js';
|
|
|
33
33
|
import { getStringFromReactText } from '../../../utils/getStringChildren/getStringChildren.js';
|
|
34
34
|
import { makeAnalyticsAttribute } from '../../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
|
|
35
35
|
|
|
36
|
-
var _excluded=["href","target","rel","tabIndex","id","variant","color","size","icon","iconPosition","isDisabled","isFullWidth","isLoading","onClick","onBlur","onKeyDown","type","children","testID","onFocus","onMouseLeave","onMouseMove","onMouseDown","onPointerDown","onPointerEnter","accessibilityProps","onTouchEnd","onTouchStart"];var getRenderElement=function getRenderElement(href){if(isReactNative()){return undefined;}if(href){return 'a';}return 'button';};var getBackgroundColorToken=function getBackgroundColorToken(_ref){var property=_ref.property,variant=_ref.variant,state=_ref.state,color=_ref.color;var _state=state==='focus'||state==='hover'?'highlighted':state;var tokens=backgroundColor(property);if(color==='white'){return tokens.white[variant][_state];}if(color&&color!=='primary'){if(variant==='tertiary'){throw new Error(`Tertiary variant can only be used with color: "primary" or "white" but received "${color}"`);}return tokens.color(color)[variant][_state];}return tokens.base[variant][_state];};var getTextColorToken=function getTextColorToken(_ref2){var property=_ref2.property,variant=_ref2.variant,state=_ref2.state,color=_ref2.color;var tokens=textColor(property);var _state=state==='focus'||state==='hover'?'highlighted':state;if(color==='white'){return tokens.white[variant][_state];}if(color&&color!=='primary'){if(variant==='tertiary'){throw new Error(`Tertiary variant can only be used with color: "primary" or "white" but received "${color}"`);}return tokens.color(color)[variant][_state];}return tokens.base[variant][_state];};var getProps=function getProps(_ref3){var buttonTypographyTokens=_ref3.buttonTypographyTokens,childrenString=_ref3.childrenString,isDisabled=_ref3.isDisabled,size=_ref3.size,theme=_ref3.theme,variant=_ref3.variant,color=_ref3.color,hasIcon=_ref3.hasIcon;if(variant==='tertiary'&&color!=='primary'&&color!=='white'){throwBladeError({moduleName:'BaseButton',message:`Tertiary variant can only be used with color: "primary" or "white" but received "${color}"`});}var isIconOnly=hasIcon&&(!childrenString||(childrenString==null?void 0:childrenString.trim().length)===0);var props={iconSize:isIconOnly?buttonIconOnlySizeToIconSizeMap[size]:buttonSizeToIconSizeMap[size],spinnerSize:buttonSizeToSpinnerSizeMap[size],fontSize:buttonTypographyTokens.fonts.size[size],lineHeight:buttonTypographyTokens.lineHeights[size],minHeight:makeSize(minHeight[size]),height:isIconOnly?buttonIconOnlyHeightWidth[size]:undefined,width:isIconOnly?buttonIconOnlyHeightWidth[size]:undefined,iconPadding:hasIcon&&childrenString!=null&&childrenString.trim()?`spacing.${buttonIconPadding[size]}`:undefined,iconColor:getTextColorToken({property:'icon',variant:variant,color:color,state:'default'}),textColor:getTextColorToken({property:'text',variant:variant,color:color,state:'default'}),buttonPaddingTop:isIconOnly?makeSpace(0):makeSpace(theme.spacing[buttonPadding[size].top]),buttonPaddingBottom:isIconOnly?makeSpace(0):makeSpace(theme.spacing[buttonPadding[size].bottom]),buttonPaddingLeft:isIconOnly?makeSpace(0):makeSpace(theme.spacing[buttonPadding[size].left]),buttonPaddingRight:isIconOnly?makeSpace(0):makeSpace(theme.spacing[buttonPadding[size].right]),text:childrenString==null?void 0:childrenString.trim(),defaultBackgroundColor:getIn(theme.colors,getBackgroundColorToken({property:'background',variant:variant,color:color,state:'default'})),defaultBorderColor:getIn(theme.colors,getBackgroundColorToken({property:'border',variant:variant,color:color,state:'default'})),hoverBackgroundColor:getIn(theme.colors,getBackgroundColorToken({property:'background',variant:variant,color:color,state:'hover'})),hoverBorderColor:getIn(theme.colors,getBackgroundColorToken({property:'border',variant:variant,color:color,state:'hover'})),focusBackgroundColor:getIn(theme.colors,getBackgroundColorToken({property:'background',variant:variant,color:color,state:'focus'})),focusBorderColor:getIn(theme.colors,getBackgroundColorToken({property:'border',variant:variant,color:color,state:'focus'})),focusRingColor:getIn(theme.colors,'surface.border.primary.muted'),borderWidth:variant=='secondary'?makeBorderSize(theme.border.width.thin):'0px',borderRadius:makeBorderSize(theme.border.radius.medium),motionDuration:'duration.xquick',motionEasing:'easing.standard.effective'};if(isDisabled){var disabledBackgroundColor=getIn(theme.colors,getBackgroundColorToken({property:'background',variant:variant,color:color,state:'disabled'}));var disabledBorderColor=getIn(theme.colors,getBackgroundColorToken({property:'border',variant:variant,color:color,state:'disabled'}));props.iconColor=getTextColorToken({property:'icon',variant:variant,color:color,state:'disabled'});props.textColor=getTextColorToken({property:'text',variant:variant,color:color,state:'disabled'});props.defaultBackgroundColor=disabledBackgroundColor;props.defaultBorderColor=disabledBorderColor;props.hoverBackgroundColor=disabledBackgroundColor;props.hoverBorderColor=disabledBorderColor;props.focusBackgroundColor=disabledBackgroundColor;props.focusBorderColor=disabledBorderColor;}return props;};var ButtonContent=styled(BaseBox)(function(_ref4){var isHidden=_ref4.isHidden;return {opacity:isHidden?0:1};});var _BaseButton=function _BaseButton(_ref5,ref){var _buttonGroupProps$isD,_buttonGroupProps$siz,_buttonGroupProps$var,_buttonGroupProps$col,_accessibilityProps$r,_buttonGroupProps$isF;var href=_ref5.href,target=_ref5.target,rel=_ref5.rel,tabIndex=_ref5.tabIndex,id=_ref5.id,_ref5$variant=_ref5.variant,variant=_ref5$variant===void 0?'primary':_ref5$variant,_ref5$color=_ref5.color,color=_ref5$color===void 0?'primary':_ref5$color,_ref5$size=_ref5.size,size=_ref5$size===void 0?'medium':_ref5$size,Icon=_ref5.icon,_ref5$iconPosition=_ref5.iconPosition,iconPosition=_ref5$iconPosition===void 0?'left':_ref5$iconPosition,_ref5$isDisabled=_ref5.isDisabled,isDisabled=_ref5$isDisabled===void 0?false:_ref5$isDisabled,_ref5$isFullWidth=_ref5.isFullWidth,isFullWidth=_ref5$isFullWidth===void 0?false:_ref5$isFullWidth,_ref5$isLoading=_ref5.isLoading,isLoading=_ref5$isLoading===void 0?false:_ref5$isLoading,onClick=_ref5.onClick,onBlur=_ref5.onBlur,_onKeyDown=_ref5.onKeyDown,_ref5$type=_ref5.type,type=_ref5$type===void 0?'button':_ref5$type,children=_ref5.children,testID=_ref5.testID,onFocus=_ref5.onFocus,onMouseLeave=_ref5.onMouseLeave,onMouseMove=_ref5.onMouseMove,_onMouseDown=_ref5.onMouseDown,onPointerDown=_ref5.onPointerDown,onPointerEnter=_ref5.onPointerEnter,accessibilityProps=_ref5.accessibilityProps,_onTouchEnd=_ref5.onTouchEnd,_onTouchStart=_ref5.onTouchStart,rest=_objectWithoutProperties(_ref5,_excluded);var _useTheme=useTheme(),theme=_useTheme.theme;var buttonGroupProps=useButtonGroupContext();var _React$useState=React__default.useState(false),_React$useState2=_slicedToArray(_React$useState,2),isPressed=_React$useState2[0],setIsPressed=_React$useState2[1];var isLink=Boolean(href);var childrenString=getStringFromReactText(children);var isChildrenComponent=React__default.isValidElement(children);var disabled=(_buttonGroupProps$isD=buttonGroupProps.isDisabled)!=null?_buttonGroupProps$isD:isLoading||isDisabled&&!isLink;if(__DEV__){if(!Icon&&!(childrenString!=null&&childrenString.trim())){throwBladeError({message:'At least one of icon or text is required to render a button.',moduleName:'BaseButton'});}}var prevLoading=usePrevious(isLoading);React__default.useEffect(function(){if(isLoading)announce('Started loading');if(!isLoading&&prevLoading)announce('Stopped loading');},[isLoading,prevLoading]);var _getProps=getProps({buttonTypographyTokens:typography,childrenString:childrenString,isDisabled:disabled,size:(_buttonGroupProps$siz=buttonGroupProps.size)!=null?_buttonGroupProps$siz:size,variant:(_buttonGroupProps$var=buttonGroupProps.variant)!=null?_buttonGroupProps$var:variant,theme:theme,color:(_buttonGroupProps$col=buttonGroupProps.color)!=null?_buttonGroupProps$col:color,hasIcon:Boolean(Icon)}),defaultBorderColor=_getProps.defaultBorderColor,defaultBackgroundColor=_getProps.defaultBackgroundColor,minHeight=_getProps.minHeight,height=_getProps.height,width=_getProps.width,buttonPaddingTop=_getProps.buttonPaddingTop,buttonPaddingBottom=_getProps.buttonPaddingBottom,buttonPaddingLeft=_getProps.buttonPaddingLeft,buttonPaddingRight=_getProps.buttonPaddingRight,focusBorderColor=_getProps.focusBorderColor,focusBackgroundColor=_getProps.focusBackgroundColor,focusRingColor=_getProps.focusRingColor,fontSize=_getProps.fontSize,hoverBorderColor=_getProps.hoverBorderColor,hoverBackgroundColor=_getProps.hoverBackgroundColor,iconColor=_getProps.iconColor,iconSize=_getProps.iconSize,iconPadding=_getProps.iconPadding,spinnerSize=_getProps.spinnerSize,lineHeight=_getProps.lineHeight,text=_getProps.text,textColor=_getProps.textColor,borderWidth=_getProps.borderWidth,borderRadius=_getProps.borderRadius,motionDuration=_getProps.motionDuration,motionEasing=_getProps.motionEasing;var renderElement=React__default.useMemo(function(){return getRenderElement(href);},[href]);var defaultRole=isLink?'link':'button';var handlePointerPressedIn=React__default.useCallback(function(){if(disabled)return;setIsPressed(true);},[disabled]);var handlePointerPressedOut=React__default.useCallback(function(){if(disabled)return;setIsPressed(false);},[disabled]);var handleKeyboardPressedIn=React__default.useCallback(function(e){if(disabled)return;if(e.key===' '||e.key==='Enter'){setIsPressed(true);}},[disabled]);var handleKeyboardPressedOut=React__default.useCallback(function(e){if(disabled)return;if(e.key===' '||e.key==='Enter'){setIsPressed(false);}},[disabled]);return jsx(StyledBaseButton,Object.assign({ref:ref,id:id,as:renderElement,href:href,target:target,rel:rel,accessibilityProps:Object.assign({},makeAccessible(Object.assign({},accessibilityProps,{role:(_accessibilityProps$r=accessibilityProps==null?void 0:accessibilityProps.role)!=null?_accessibilityProps$r:defaultRole}))),variant:variant,isLoading:isLoading,disabled:disabled,defaultBorderColor:defaultBorderColor,minHeight:minHeight,buttonPaddingTop:buttonPaddingTop,buttonPaddingBottom:buttonPaddingBottom,buttonPaddingLeft:buttonPaddingLeft,buttonPaddingRight:buttonPaddingRight,defaultBackgroundColor:defaultBackgroundColor,focusBorderColor:focusBorderColor,focusBackgroundColor:focusBackgroundColor,focusRingColor:focusRingColor,hoverBorderColor:hoverBorderColor,hoverBackgroundColor:hoverBackgroundColor,isFullWidth:(_buttonGroupProps$isF=buttonGroupProps.isFullWidth)!=null?_buttonGroupProps$isF:isFullWidth,onClick:onClick,onBlur:onBlur,onFocus:onFocus,onMouseLeave:onMouseLeave,onMouseMove:onMouseMove,tabIndex:tabIndex,onPointerDown:onPointerDown,onPointerEnter:onPointerEnter,onKeyDown:function onKeyDown(event){handleKeyboardPressedIn(event);_onKeyDown==null?void 0:_onKeyDown(event);},onTouchStart:function onTouchStart(event){handlePointerPressedIn();_onTouchStart==null?void 0:_onTouchStart(event);},onTouchEnd:function onTouchEnd(event){handlePointerPressedOut();_onTouchEnd==null?void 0:_onTouchEnd(event);},type:type,borderWidth:borderWidth,borderRadius:borderRadius,motionDuration:motionDuration,motionEasing:motionEasing,height:height,width:width,isPressed:isPressed,onMouseDown:function onMouseDown(event){handlePointerPressedIn();_onMouseDown==null?void 0:_onMouseDown(event);},onMouseUp:handlePointerPressedOut,onMouseOut:handlePointerPressedOut,onKeyUp:handleKeyboardPressedOut},metaAttribute({name:MetaConstants.Button,testID:testID}),getStyledProps(rest),makeAnalyticsAttribute(rest),{children:jsxs(AnimatedButtonContent,{motionDuration:motionDuration,motionEasing:motionEasing,isPressed:isPressed,children:[isLoading?jsx(BaseBox,{display:"flex",justifyContent:"center",alignItems:"center",position:"absolute",top:"0px",left:"0px",bottom:"0px",right:"0px",zIndex:1,children:jsx(BaseSpinner,{accessibilityLabel:"Loading",size:spinnerSize,color:color})}):null,jsxs(ButtonContent,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",flex:1,isHidden:isLoading,zIndex:1,children:[Icon&&iconPosition=='left'?jsx(BaseBox,{paddingRight:iconPadding,display:"flex",justifyContent:"center",alignItems:"center",children:jsx(Icon,{size:iconSize,color:iconColor})}):null,text?isChildrenComponent?children:jsx(BaseText,{lineHeight:lineHeight,fontSize:fontSize,fontWeight:"medium",textAlign:"center",color:textColor,children:text}):null,Icon&&iconPosition=='right'?jsx(BaseBox,{paddingLeft:iconPadding,display:"flex",justifyContent:"center",alignItems:"center",children:jsx(Icon,{size:iconSize,color:iconColor})}):null]})]})}));};var BaseButton=assignWithoutSideEffects(React__default.forwardRef(_BaseButton),{displayName:'BaseButton'});
|
|
36
|
+
var _excluded=["href","target","rel","tabIndex","id","variant","color","size","icon","iconPosition","isDisabled","isFullWidth","isLoading","onClick","onBlur","onKeyDown","type","children","testID","onFocus","onMouseLeave","onMouseMove","onMouseDown","onPointerDown","onPointerEnter","accessibilityProps","onTouchEnd","onTouchStart"];var getRenderElement=function getRenderElement(href){if(isReactNative()){return undefined;}if(href){return 'a';}return 'button';};var getBackgroundColorToken=function getBackgroundColorToken(_ref){var property=_ref.property,variant=_ref.variant,state=_ref.state,color=_ref.color;var _state=state==='focus'||state==='hover'?'highlighted':state;var tokens=backgroundColor(property);if(color==='white'){return tokens.white[variant][_state];}if(color&&color!=='primary'){if(variant==='tertiary'){throw new Error(`Tertiary variant can only be used with color: "primary" or "white" but received "${color}"`);}return tokens.color(color)[variant][_state];}return tokens.base[variant][_state];};var getTextColorToken=function getTextColorToken(_ref2){var property=_ref2.property,variant=_ref2.variant,state=_ref2.state,color=_ref2.color;var tokens=textColor(property);var _state=state==='focus'||state==='hover'?'highlighted':state;if(color==='white'){return tokens.white[variant][_state];}if(color&&color!=='primary'){if(variant==='tertiary'){throw new Error(`Tertiary variant can only be used with color: "primary" or "white" but received "${color}"`);}return tokens.color(color)[variant][_state];}return tokens.base[variant][_state];};var getProps=function getProps(_ref3){var buttonTypographyTokens=_ref3.buttonTypographyTokens,childrenString=_ref3.childrenString,isDisabled=_ref3.isDisabled,size=_ref3.size,theme=_ref3.theme,variant=_ref3.variant,color=_ref3.color,hasIcon=_ref3.hasIcon;if(variant==='tertiary'&&color!=='primary'&&color!=='white'){throwBladeError({moduleName:'BaseButton',message:`Tertiary variant can only be used with color: "primary" or "white" but received "${color}"`});}var isIconOnly=hasIcon&&(!childrenString||(childrenString==null?void 0:childrenString.trim().length)===0);var props={iconSize:isIconOnly?buttonIconOnlySizeToIconSizeMap[size]:buttonSizeToIconSizeMap[size],spinnerSize:buttonSizeToSpinnerSizeMap[size],fontSize:buttonTypographyTokens.fonts.size[size],lineHeight:buttonTypographyTokens.lineHeights[size],minHeight:makeSize(minHeight[size]),height:isIconOnly?buttonIconOnlyHeightWidth[size]:undefined,width:isIconOnly?buttonIconOnlyHeightWidth[size]:undefined,iconPadding:hasIcon&&childrenString!=null&&childrenString.trim()?`spacing.${buttonIconPadding[size]}`:undefined,iconColor:getTextColorToken({property:'icon',variant:variant,color:color,state:'default'}),textColor:getTextColorToken({property:'text',variant:variant,color:color,state:'default'}),buttonPaddingTop:isIconOnly?makeSpace(0):makeSpace(theme.spacing[buttonPadding[size].top]),buttonPaddingBottom:isIconOnly?makeSpace(0):makeSpace(theme.spacing[buttonPadding[size].bottom]),buttonPaddingLeft:isIconOnly?makeSpace(0):makeSpace(theme.spacing[buttonPadding[size].left]),buttonPaddingRight:isIconOnly?makeSpace(0):makeSpace(theme.spacing[buttonPadding[size].right]),text:childrenString==null?void 0:childrenString.trim(),defaultBackgroundColor:getIn(theme.colors,getBackgroundColorToken({property:'background',variant:variant,color:color,state:'default'})),defaultBorderColor:getIn(theme.colors,getBackgroundColorToken({property:'border',variant:variant,color:color,state:'default'})),hoverBackgroundColor:getIn(theme.colors,getBackgroundColorToken({property:'background',variant:variant,color:color,state:'hover'})),hoverBorderColor:getIn(theme.colors,getBackgroundColorToken({property:'border',variant:variant,color:color,state:'hover'})),focusBackgroundColor:getIn(theme.colors,getBackgroundColorToken({property:'background',variant:variant,color:color,state:'focus'})),focusBorderColor:getIn(theme.colors,getBackgroundColorToken({property:'border',variant:variant,color:color,state:'focus'})),focusRingColor:getIn(theme.colors,'surface.border.primary.muted'),borderWidth:variant=='secondary'?makeBorderSize(theme.border.width.thin):'0px',borderRadius:makeBorderSize(theme.border.radius.medium),motionDuration:'duration.xquick',motionEasing:'easing.standard'};if(isDisabled){var disabledBackgroundColor=getIn(theme.colors,getBackgroundColorToken({property:'background',variant:variant,color:color,state:'disabled'}));var disabledBorderColor=getIn(theme.colors,getBackgroundColorToken({property:'border',variant:variant,color:color,state:'disabled'}));props.iconColor=getTextColorToken({property:'icon',variant:variant,color:color,state:'disabled'});props.textColor=getTextColorToken({property:'text',variant:variant,color:color,state:'disabled'});props.defaultBackgroundColor=disabledBackgroundColor;props.defaultBorderColor=disabledBorderColor;props.hoverBackgroundColor=disabledBackgroundColor;props.hoverBorderColor=disabledBorderColor;props.focusBackgroundColor=disabledBackgroundColor;props.focusBorderColor=disabledBorderColor;}return props;};var ButtonContent=styled(BaseBox)(function(_ref4){var isHidden=_ref4.isHidden;return {opacity:isHidden?0:1};});var _BaseButton=function _BaseButton(_ref5,ref){var _buttonGroupProps$isD,_buttonGroupProps$siz,_buttonGroupProps$var,_buttonGroupProps$col,_accessibilityProps$r,_buttonGroupProps$isF;var href=_ref5.href,target=_ref5.target,rel=_ref5.rel,tabIndex=_ref5.tabIndex,id=_ref5.id,_ref5$variant=_ref5.variant,variant=_ref5$variant===void 0?'primary':_ref5$variant,_ref5$color=_ref5.color,color=_ref5$color===void 0?'primary':_ref5$color,_ref5$size=_ref5.size,size=_ref5$size===void 0?'medium':_ref5$size,Icon=_ref5.icon,_ref5$iconPosition=_ref5.iconPosition,iconPosition=_ref5$iconPosition===void 0?'left':_ref5$iconPosition,_ref5$isDisabled=_ref5.isDisabled,isDisabled=_ref5$isDisabled===void 0?false:_ref5$isDisabled,_ref5$isFullWidth=_ref5.isFullWidth,isFullWidth=_ref5$isFullWidth===void 0?false:_ref5$isFullWidth,_ref5$isLoading=_ref5.isLoading,isLoading=_ref5$isLoading===void 0?false:_ref5$isLoading,onClick=_ref5.onClick,onBlur=_ref5.onBlur,_onKeyDown=_ref5.onKeyDown,_ref5$type=_ref5.type,type=_ref5$type===void 0?'button':_ref5$type,children=_ref5.children,testID=_ref5.testID,onFocus=_ref5.onFocus,onMouseLeave=_ref5.onMouseLeave,onMouseMove=_ref5.onMouseMove,_onMouseDown=_ref5.onMouseDown,onPointerDown=_ref5.onPointerDown,onPointerEnter=_ref5.onPointerEnter,accessibilityProps=_ref5.accessibilityProps,_onTouchEnd=_ref5.onTouchEnd,_onTouchStart=_ref5.onTouchStart,rest=_objectWithoutProperties(_ref5,_excluded);var _useTheme=useTheme(),theme=_useTheme.theme;var buttonGroupProps=useButtonGroupContext();var _React$useState=React__default.useState(false),_React$useState2=_slicedToArray(_React$useState,2),isPressed=_React$useState2[0],setIsPressed=_React$useState2[1];var isLink=Boolean(href);var childrenString=getStringFromReactText(children);var isChildrenComponent=React__default.isValidElement(children);var disabled=(_buttonGroupProps$isD=buttonGroupProps.isDisabled)!=null?_buttonGroupProps$isD:isLoading||isDisabled&&!isLink;if(__DEV__){if(!Icon&&!(childrenString!=null&&childrenString.trim())){throwBladeError({message:'At least one of icon or text is required to render a button.',moduleName:'BaseButton'});}}var prevLoading=usePrevious(isLoading);React__default.useEffect(function(){if(isLoading)announce('Started loading');if(!isLoading&&prevLoading)announce('Stopped loading');},[isLoading,prevLoading]);var _getProps=getProps({buttonTypographyTokens:typography,childrenString:childrenString,isDisabled:disabled,size:(_buttonGroupProps$siz=buttonGroupProps.size)!=null?_buttonGroupProps$siz:size,variant:(_buttonGroupProps$var=buttonGroupProps.variant)!=null?_buttonGroupProps$var:variant,theme:theme,color:(_buttonGroupProps$col=buttonGroupProps.color)!=null?_buttonGroupProps$col:color,hasIcon:Boolean(Icon)}),defaultBorderColor=_getProps.defaultBorderColor,defaultBackgroundColor=_getProps.defaultBackgroundColor,minHeight=_getProps.minHeight,height=_getProps.height,width=_getProps.width,buttonPaddingTop=_getProps.buttonPaddingTop,buttonPaddingBottom=_getProps.buttonPaddingBottom,buttonPaddingLeft=_getProps.buttonPaddingLeft,buttonPaddingRight=_getProps.buttonPaddingRight,focusBorderColor=_getProps.focusBorderColor,focusBackgroundColor=_getProps.focusBackgroundColor,focusRingColor=_getProps.focusRingColor,fontSize=_getProps.fontSize,hoverBorderColor=_getProps.hoverBorderColor,hoverBackgroundColor=_getProps.hoverBackgroundColor,iconColor=_getProps.iconColor,iconSize=_getProps.iconSize,iconPadding=_getProps.iconPadding,spinnerSize=_getProps.spinnerSize,lineHeight=_getProps.lineHeight,text=_getProps.text,textColor=_getProps.textColor,borderWidth=_getProps.borderWidth,borderRadius=_getProps.borderRadius,motionDuration=_getProps.motionDuration,motionEasing=_getProps.motionEasing;var renderElement=React__default.useMemo(function(){return getRenderElement(href);},[href]);var defaultRole=isLink?'link':'button';var handlePointerPressedIn=React__default.useCallback(function(){if(disabled)return;setIsPressed(true);},[disabled]);var handlePointerPressedOut=React__default.useCallback(function(){if(disabled)return;setIsPressed(false);},[disabled]);var handleKeyboardPressedIn=React__default.useCallback(function(e){if(disabled)return;if(e.key===' '||e.key==='Enter'){setIsPressed(true);}},[disabled]);var handleKeyboardPressedOut=React__default.useCallback(function(e){if(disabled)return;if(e.key===' '||e.key==='Enter'){setIsPressed(false);}},[disabled]);return jsx(StyledBaseButton,Object.assign({ref:ref,id:id,as:renderElement,href:href,target:target,rel:rel,accessibilityProps:Object.assign({},makeAccessible(Object.assign({},accessibilityProps,{role:(_accessibilityProps$r=accessibilityProps==null?void 0:accessibilityProps.role)!=null?_accessibilityProps$r:defaultRole}))),variant:variant,isLoading:isLoading,disabled:disabled,defaultBorderColor:defaultBorderColor,minHeight:minHeight,buttonPaddingTop:buttonPaddingTop,buttonPaddingBottom:buttonPaddingBottom,buttonPaddingLeft:buttonPaddingLeft,buttonPaddingRight:buttonPaddingRight,defaultBackgroundColor:defaultBackgroundColor,focusBorderColor:focusBorderColor,focusBackgroundColor:focusBackgroundColor,focusRingColor:focusRingColor,hoverBorderColor:hoverBorderColor,hoverBackgroundColor:hoverBackgroundColor,isFullWidth:(_buttonGroupProps$isF=buttonGroupProps.isFullWidth)!=null?_buttonGroupProps$isF:isFullWidth,onClick:onClick,onBlur:onBlur,onFocus:onFocus,onMouseLeave:onMouseLeave,onMouseMove:onMouseMove,tabIndex:tabIndex,onPointerDown:onPointerDown,onPointerEnter:onPointerEnter,onKeyDown:function onKeyDown(event){handleKeyboardPressedIn(event);_onKeyDown==null?void 0:_onKeyDown(event);},onTouchStart:function onTouchStart(event){handlePointerPressedIn();_onTouchStart==null?void 0:_onTouchStart(event);},onTouchEnd:function onTouchEnd(event){handlePointerPressedOut();_onTouchEnd==null?void 0:_onTouchEnd(event);},type:type,borderWidth:borderWidth,borderRadius:borderRadius,motionDuration:motionDuration,motionEasing:motionEasing,height:height,width:width,isPressed:isPressed,onMouseDown:function onMouseDown(event){handlePointerPressedIn();_onMouseDown==null?void 0:_onMouseDown(event);},onMouseUp:handlePointerPressedOut,onMouseOut:handlePointerPressedOut,onKeyUp:handleKeyboardPressedOut},metaAttribute({name:MetaConstants.Button,testID:testID}),getStyledProps(rest),makeAnalyticsAttribute(rest),{children:jsxs(AnimatedButtonContent,{motionDuration:motionDuration,motionEasing:motionEasing,isPressed:isPressed,children:[isLoading?jsx(BaseBox,{display:"flex",justifyContent:"center",alignItems:"center",position:"absolute",top:"0px",left:"0px",bottom:"0px",right:"0px",zIndex:1,children:jsx(BaseSpinner,{accessibilityLabel:"Loading",size:spinnerSize,color:color})}):null,jsxs(ButtonContent,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",flex:1,isHidden:isLoading,zIndex:1,children:[Icon&&iconPosition=='left'?jsx(BaseBox,{paddingRight:iconPadding,display:"flex",justifyContent:"center",alignItems:"center",children:jsx(Icon,{size:iconSize,color:iconColor})}):null,text?isChildrenComponent?children:jsx(BaseText,{lineHeight:lineHeight,fontSize:fontSize,fontWeight:"medium",textAlign:"center",color:textColor,children:text}):null,Icon&&iconPosition=='right'?jsx(BaseBox,{paddingLeft:iconPadding,display:"flex",justifyContent:"center",alignItems:"center",children:jsx(Icon,{size:iconSize,color:iconColor})}):null]})]})}));};var BaseButton=assignWithoutSideEffects(React__default.forwardRef(_BaseButton),{displayName:'BaseButton'});
|
|
37
37
|
|
|
38
38
|
export { BaseButton as default, getBackgroundColorToken, getTextColorToken };
|
|
39
39
|
//# sourceMappingURL=BaseButton.js.map
|