@razorpay/blade 11.36.2 → 11.38.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 -1
- package/build/lib/native/components/Accordion/Accordion.js.map +1 -1
- package/build/lib/native/components/Accordion/AccordionItem.js +3 -1
- package/build/lib/native/components/Accordion/AccordionItem.js.map +1 -1
- package/build/lib/native/components/Accordion/AccordionItemBody.js +3 -2
- package/build/lib/native/components/Accordion/AccordionItemBody.js.map +1 -1
- package/build/lib/native/components/Accordion/AccordionItemHeader.js +3 -2
- package/build/lib/native/components/Accordion/AccordionItemHeader.js.map +1 -1
- package/build/lib/native/components/ActionList/ActionList.js +3 -1
- package/build/lib/native/components/ActionList/ActionList.js.map +1 -1
- package/build/lib/native/components/ActionList/ActionListItem.js +3 -2
- package/build/lib/native/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/native/components/Alert/Alert.js +2 -1
- package/build/lib/native/components/Alert/Alert.js.map +1 -1
- package/build/lib/native/components/Amount/Amount.js +2 -1
- package/build/lib/native/components/Amount/Amount.js.map +1 -1
- package/build/lib/native/components/Badge/Badge.js +2 -1
- package/build/lib/native/components/Badge/Badge.js.map +1 -1
- package/build/lib/native/components/BaseHeaderFooter/BaseFooter.js +3 -1
- package/build/lib/native/components/BaseHeaderFooter/BaseFooter.js.map +1 -1
- package/build/lib/native/components/BaseHeaderFooter/BaseHeader.js +3 -2
- package/build/lib/native/components/BaseHeaderFooter/BaseHeader.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 +2 -1
- package/build/lib/native/components/Box/Box.js.map +1 -1
- package/build/lib/native/components/Button/BaseButton/BaseButton.js +2 -1
- package/build/lib/native/components/Button/BaseButton/BaseButton.js.map +1 -1
- package/build/lib/native/components/Button/Button/Button.js +2 -1
- package/build/lib/native/components/Button/Button/Button.js.map +1 -1
- package/build/lib/native/components/Button/IconButton/IconButton.js +3 -1
- package/build/lib/native/components/Button/IconButton/IconButton.js.map +1 -1
- package/build/lib/native/components/Card/Card.js +2 -1
- package/build/lib/native/components/Card/Card.js.map +1 -1
- package/build/lib/native/components/Card/CardFooter.js +3 -2
- package/build/lib/native/components/Card/CardFooter.js.map +1 -1
- package/build/lib/native/components/Card/CardHeader.js +3 -2
- package/build/lib/native/components/Card/CardHeader.js.map +1 -1
- package/build/lib/native/components/Checkbox/Checkbox.js +3 -2
- package/build/lib/native/components/Checkbox/Checkbox.js.map +1 -1
- package/build/lib/native/components/Checkbox/CheckboxGroup/CheckboxGroup.js +2 -1
- package/build/lib/native/components/Checkbox/CheckboxGroup/CheckboxGroup.js.map +1 -1
- package/build/lib/native/components/Chip/Chip.js +2 -1
- package/build/lib/native/components/Chip/Chip.js.map +1 -1
- package/build/lib/native/components/Chip/ChipGroup.js +2 -1
- package/build/lib/native/components/Chip/ChipGroup.js.map +1 -1
- package/build/lib/native/components/Collapsible/Collapsible.js +2 -1
- package/build/lib/native/components/Collapsible/Collapsible.js.map +1 -1
- package/build/lib/native/components/Collapsible/CollapsibleBody.js +3 -1
- package/build/lib/native/components/Collapsible/CollapsibleBody.js.map +1 -1
- package/build/lib/native/components/Collapsible/CollapsibleButton.js +3 -1
- package/build/lib/native/components/Collapsible/CollapsibleButton.js.map +1 -1
- package/build/lib/native/components/Collapsible/CollapsibleLink.js +2 -1
- package/build/lib/native/components/Collapsible/CollapsibleLink.js.map +1 -1
- package/build/lib/native/components/Counter/Counter.js +2 -1
- package/build/lib/native/components/Counter/Counter.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/Dropdown/DropdownButton.js +1 -1
- package/build/lib/native/components/Dropdown/DropdownButton.js.map +1 -1
- package/build/lib/native/components/Dropdown/DropdownHeaderFooter.js +3 -1
- package/build/lib/native/components/Dropdown/DropdownHeaderFooter.js.map +1 -1
- package/build/lib/native/components/Dropdown/DropdownLink.js +2 -1
- package/build/lib/native/components/Dropdown/DropdownLink.js.map +1 -1
- package/build/lib/native/components/Form/Selector/SelectorGroupField.js +3 -1
- package/build/lib/native/components/Form/Selector/SelectorGroupField.js.map +1 -1
- package/build/lib/native/components/Icons/IndiaFlagIcon/IndiaFlagIcon.js +12 -0
- package/build/lib/native/components/Icons/IndiaFlagIcon/IndiaFlagIcon.js.map +1 -0
- package/build/lib/native/components/Icons/MagicKonnectIcon/MagicKonnectIcon.js +12 -0
- package/build/lib/native/components/Icons/MagicKonnectIcon/MagicKonnectIcon.js.map +1 -0
- package/build/lib/native/components/Icons/WorldwideIcon/WorldwideIcon.js +12 -0
- package/build/lib/native/components/Icons/WorldwideIcon/WorldwideIcon.js.map +1 -0
- package/build/lib/native/components/Indicator/Indicator.js +2 -1
- package/build/lib/native/components/Indicator/Indicator.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/DropdownInputTriggers/BaseDropdownInputTrigger.js +2 -1
- package/build/lib/native/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
- package/build/lib/native/components/Input/DropdownInputTriggers/SelectInput.js +2 -1
- package/build/lib/native/components/Input/DropdownInputTriggers/SelectInput.js.map +1 -1
- package/build/lib/native/components/Input/OTPInput/OTPInput.js +2 -1
- package/build/lib/native/components/Input/OTPInput/OTPInput.js.map +1 -1
- package/build/lib/native/components/Input/PasswordInput/PasswordInput.js +1 -1
- package/build/lib/native/components/Input/PasswordInput/PasswordInput.js.map +1 -1
- package/build/lib/native/components/Input/SearchInput/SearchInput.js +1 -1
- package/build/lib/native/components/Input/SearchInput/SearchInput.js.map +1 -1
- package/build/lib/native/components/Input/TextArea/TextArea.js +1 -1
- package/build/lib/native/components/Input/TextArea/TextArea.js.map +1 -1
- package/build/lib/native/components/Input/TextInput/TextInput.js +1 -1
- package/build/lib/native/components/Input/TextInput/TextInput.js.map +1 -1
- package/build/lib/native/components/Link/BaseLink/BaseLink.js +2 -1
- package/build/lib/native/components/Link/BaseLink/BaseLink.js.map +1 -1
- package/build/lib/native/components/Link/Link/Link.js +2 -1
- package/build/lib/native/components/Link/Link/Link.js.map +1 -1
- package/build/lib/native/components/ProgressBar/ProgressBar.js +2 -1
- 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/RadioGroup/RadioGroup.js +2 -1
- package/build/lib/native/components/Radio/RadioGroup/RadioGroup.js.map +1 -1
- package/build/lib/native/components/StepGroup/tokens.js +1 -1
- package/build/lib/native/components/StepGroup/tokens.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/Tag/Tag.js +2 -1
- package/build/lib/native/components/Tag/Tag.js.map +1 -1
- package/build/lib/native/components/index.js +3 -0
- package/build/lib/native/components/index.js.map +1 -1
- package/build/lib/native/tokens/global/size.js +1 -1
- package/build/lib/native/tokens/global/size.js.map +1 -1
- package/build/lib/native/utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js +7 -0
- package/build/lib/native/utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js.map +1 -0
- package/build/lib/web/development/components/Accordion/Accordion.js +5 -3
- package/build/lib/web/development/components/Accordion/Accordion.js.map +1 -1
- package/build/lib/web/development/components/Accordion/AccordionButton.web.js +8 -3
- package/build/lib/web/development/components/Accordion/AccordionButton.web.js.map +1 -1
- package/build/lib/web/development/components/Accordion/AccordionItem.js +8 -3
- package/build/lib/web/development/components/Accordion/AccordionItem.js.map +1 -1
- package/build/lib/web/development/components/Accordion/AccordionItemBody.js +8 -3
- package/build/lib/web/development/components/Accordion/AccordionItemBody.js.map +1 -1
- package/build/lib/web/development/components/Accordion/AccordionItemHeader.js +10 -4
- package/build/lib/web/development/components/Accordion/AccordionItemHeader.js.map +1 -1
- package/build/lib/web/development/components/ActionList/ActionList.js +9 -4
- package/build/lib/web/development/components/ActionList/ActionList.js.map +1 -1
- package/build/lib/web/development/components/ActionList/ActionListBox.web.js +8 -3
- package/build/lib/web/development/components/ActionList/ActionListBox.web.js.map +1 -1
- package/build/lib/web/development/components/ActionList/ActionListItem.js +10 -5
- package/build/lib/web/development/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/web/development/components/Alert/Alert.js +5 -3
- package/build/lib/web/development/components/Alert/Alert.js.map +1 -1
- package/build/lib/web/development/components/Amount/Amount.js +5 -8
- package/build/lib/web/development/components/Amount/Amount.js.map +1 -1
- package/build/lib/web/development/components/Avatar/Avatar.web.js +5 -3
- package/build/lib/web/development/components/Avatar/Avatar.web.js.map +1 -1
- package/build/lib/web/development/components/Avatar/AvatarGroup.web.js +5 -3
- package/build/lib/web/development/components/Avatar/AvatarGroup.web.js.map +1 -1
- package/build/lib/web/development/components/Badge/Badge.js +5 -3
- package/build/lib/web/development/components/Badge/Badge.js.map +1 -1
- package/build/lib/web/development/components/BaseHeaderFooter/BaseFooter.js +8 -3
- package/build/lib/web/development/components/BaseHeaderFooter/BaseFooter.js.map +1 -1
- package/build/lib/web/development/components/BaseHeaderFooter/BaseHeader.js +8 -3
- package/build/lib/web/development/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
- package/build/lib/web/development/components/BottomNav/BottomNav.web.js +12 -8
- package/build/lib/web/development/components/BottomNav/BottomNav.web.js.map +1 -1
- package/build/lib/web/development/components/BottomSheet/BottomSheet.web.js +9 -3
- package/build/lib/web/development/components/BottomSheet/BottomSheet.web.js.map +1 -1
- package/build/lib/web/development/components/BottomSheet/BottomSheetBody.web.js +8 -3
- package/build/lib/web/development/components/BottomSheet/BottomSheetBody.web.js.map +1 -1
- package/build/lib/web/development/components/BottomSheet/BottomSheetFooter.web.js +8 -3
- package/build/lib/web/development/components/BottomSheet/BottomSheetFooter.web.js.map +1 -1
- package/build/lib/web/development/components/BottomSheet/BottomSheetHeader.web.js +8 -3
- package/build/lib/web/development/components/BottomSheet/BottomSheetHeader.web.js.map +1 -1
- package/build/lib/web/development/components/Box/BaseBox/BaseBox.web.js +4 -2
- package/build/lib/web/development/components/Box/BaseBox/BaseBox.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 +4 -2
- package/build/lib/web/development/components/Box/Box.js.map +1 -1
- package/build/lib/web/development/components/Breadcrumb/Breadcrumb.web.js +6 -4
- package/build/lib/web/development/components/Breadcrumb/Breadcrumb.web.js.map +1 -1
- package/build/lib/web/development/components/Breadcrumb/BreadcrumbItem.web.js +13 -4
- package/build/lib/web/development/components/Breadcrumb/BreadcrumbItem.web.js.map +1 -1
- package/build/lib/web/development/components/Button/BaseButton/BaseButton.js +4 -2
- package/build/lib/web/development/components/Button/BaseButton/BaseButton.js.map +1 -1
- package/build/lib/web/development/components/Button/Button/Button.js +4 -2
- package/build/lib/web/development/components/Button/Button/Button.js.map +1 -1
- package/build/lib/web/development/components/Button/IconButton/IconButton.js +11 -5
- package/build/lib/web/development/components/Button/IconButton/IconButton.js.map +1 -1
- package/build/lib/web/development/components/Button/IconButton/StyledIconButton.web.js +8 -3
- package/build/lib/web/development/components/Button/IconButton/StyledIconButton.web.js.map +1 -1
- package/build/lib/web/development/components/ButtonGroup/ButtonGroup.web.js +5 -3
- package/build/lib/web/development/components/ButtonGroup/ButtonGroup.web.js.map +1 -1
- package/build/lib/web/development/components/Card/Card.js +11 -7
- package/build/lib/web/development/components/Card/Card.js.map +1 -1
- package/build/lib/web/development/components/Card/CardFooter.js +22 -11
- package/build/lib/web/development/components/Card/CardFooter.js.map +1 -1
- package/build/lib/web/development/components/Card/CardHeader.js +13 -6
- package/build/lib/web/development/components/Card/CardHeader.js.map +1 -1
- package/build/lib/web/development/components/Carousel/Carousel.web.js +5 -3
- package/build/lib/web/development/components/Carousel/Carousel.web.js.map +1 -1
- package/build/lib/web/development/components/Carousel/CarouselItem.web.js +9 -3
- package/build/lib/web/development/components/Carousel/CarouselItem.web.js.map +1 -1
- package/build/lib/web/development/components/Checkbox/Checkbox.js +6 -4
- package/build/lib/web/development/components/Checkbox/Checkbox.js.map +1 -1
- package/build/lib/web/development/components/Checkbox/CheckboxGroup/CheckboxGroup.js +8 -5
- package/build/lib/web/development/components/Checkbox/CheckboxGroup/CheckboxGroup.js.map +1 -1
- package/build/lib/web/development/components/Chip/Chip.js +5 -3
- package/build/lib/web/development/components/Chip/Chip.js.map +1 -1
- package/build/lib/web/development/components/Chip/ChipGroup.js +8 -5
- package/build/lib/web/development/components/Chip/ChipGroup.js.map +1 -1
- package/build/lib/web/development/components/Collapsible/Collapsible.js +5 -3
- package/build/lib/web/development/components/Collapsible/Collapsible.js.map +1 -1
- package/build/lib/web/development/components/Collapsible/CollapsibleBody.js +8 -3
- package/build/lib/web/development/components/Collapsible/CollapsibleBody.js.map +1 -1
- package/build/lib/web/development/components/Collapsible/CollapsibleButton.js +13 -4
- package/build/lib/web/development/components/Collapsible/CollapsibleButton.js.map +1 -1
- package/build/lib/web/development/components/Collapsible/CollapsibleLink.js +5 -3
- package/build/lib/web/development/components/Collapsible/CollapsibleLink.js.map +1 -1
- package/build/lib/web/development/components/Counter/Counter.js +5 -3
- package/build/lib/web/development/components/Counter/Counter.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/DateInput.web.js +11 -7
- package/build/lib/web/development/components/DatePicker/DateInput.web.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/DatePicker.web.js +4 -2
- package/build/lib/web/development/components/DatePicker/DatePicker.web.js.map +1 -1
- package/build/lib/web/development/components/Drawer/Drawer.web.js +8 -3
- package/build/lib/web/development/components/Drawer/Drawer.web.js.map +1 -1
- package/build/lib/web/development/components/Drawer/DrawerSubcomponents.web.js +11 -3
- package/build/lib/web/development/components/Drawer/DrawerSubcomponents.web.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/Dropdown.js +5 -3
- package/build/lib/web/development/components/Dropdown/Dropdown.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/DropdownButton.js +2 -2
- package/build/lib/web/development/components/Dropdown/DropdownButton.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/DropdownHeaderFooter.js +8 -3
- package/build/lib/web/development/components/Dropdown/DropdownHeaderFooter.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/DropdownLink.js +5 -3
- package/build/lib/web/development/components/Dropdown/DropdownLink.js.map +1 -1
- package/build/lib/web/development/components/FileUpload/FileUpload.web.js +6 -4
- package/build/lib/web/development/components/FileUpload/FileUpload.web.js.map +1 -1
- package/build/lib/web/development/components/Form/Selector/SelectorGroupField.js +8 -3
- package/build/lib/web/development/components/Form/Selector/SelectorGroupField.js.map +1 -1
- package/build/lib/web/development/components/Form/Selector/SelectorInput.web.js +8 -3
- package/build/lib/web/development/components/Form/Selector/SelectorInput.web.js.map +1 -1
- package/build/lib/web/development/components/Icons/IndiaFlagIcon/IndiaFlagIcon.js +39 -0
- package/build/lib/web/development/components/Icons/IndiaFlagIcon/IndiaFlagIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/IndiaFlagIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/IndiaFlagIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/MagicKonnectIcon/MagicKonnectIcon.js +49 -0
- package/build/lib/web/development/components/Icons/MagicKonnectIcon/MagicKonnectIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/MagicKonnectIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/MagicKonnectIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/WorldwideIcon/WorldwideIcon.js +39 -0
- package/build/lib/web/development/components/Icons/WorldwideIcon/WorldwideIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/WorldwideIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/WorldwideIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/index.js +3 -0
- package/build/lib/web/development/components/Icons/index.js.map +1 -1
- package/build/lib/web/development/components/Indicator/Indicator.js +5 -3
- package/build/lib/web/development/components/Indicator/Indicator.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/BaseInput.js +6 -4
- package/build/lib/web/development/components/Input/BaseInput/BaseInput.js.map +1 -1
- package/build/lib/web/development/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +5 -2
- package/build/lib/web/development/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
- package/build/lib/web/development/components/Input/DropdownInputTriggers/SelectInput.js +5 -3
- package/build/lib/web/development/components/Input/DropdownInputTriggers/SelectInput.js.map +1 -1
- package/build/lib/web/development/components/Input/OTPInput/OTPInput.js +6 -4
- package/build/lib/web/development/components/Input/OTPInput/OTPInput.js.map +1 -1
- package/build/lib/web/development/components/Input/PasswordInput/PasswordInput.js +2 -2
- package/build/lib/web/development/components/Input/PasswordInput/PasswordInput.js.map +1 -1
- package/build/lib/web/development/components/Input/PhoneNumberInput/PhoneNumberInput.web.js +2 -2
- package/build/lib/web/development/components/Input/PhoneNumberInput/PhoneNumberInput.web.js.map +1 -1
- package/build/lib/web/development/components/Input/SearchInput/SearchInput.js +2 -2
- package/build/lib/web/development/components/Input/SearchInput/SearchInput.js.map +1 -1
- package/build/lib/web/development/components/Input/TextArea/TextArea.js +2 -2
- package/build/lib/web/development/components/Input/TextArea/TextArea.js.map +1 -1
- package/build/lib/web/development/components/Input/TextInput/TextInput.js +2 -2
- package/build/lib/web/development/components/Input/TextInput/TextInput.js.map +1 -1
- package/build/lib/web/development/components/Link/BaseLink/BaseLink.js +5 -3
- package/build/lib/web/development/components/Link/BaseLink/BaseLink.js.map +1 -1
- package/build/lib/web/development/components/Link/Link/Link.js +4 -2
- package/build/lib/web/development/components/Link/Link/Link.js.map +1 -1
- package/build/lib/web/development/components/Menu/VisualSubComponents/MenuHeaderFooter.web.js +18 -8
- package/build/lib/web/development/components/Menu/VisualSubComponents/MenuHeaderFooter.web.js.map +1 -1
- package/build/lib/web/development/components/Modal/Modal.web.js +10 -4
- package/build/lib/web/development/components/Modal/Modal.web.js.map +1 -1
- package/build/lib/web/development/components/Modal/ModalBody.web.js +9 -3
- package/build/lib/web/development/components/Modal/ModalBody.web.js.map +1 -1
- package/build/lib/web/development/components/Modal/ModalFooter.web.js +7 -2
- package/build/lib/web/development/components/Modal/ModalFooter.web.js.map +1 -1
- package/build/lib/web/development/components/Modal/ModalHeader.web.js +14 -6
- package/build/lib/web/development/components/Modal/ModalHeader.web.js.map +1 -1
- package/build/lib/web/development/components/Popover/Popover.web.js +8 -3
- package/build/lib/web/development/components/Popover/Popover.web.js.map +1 -1
- package/build/lib/web/development/components/Popover/PopoverInteractiveWrapper.web.js.map +1 -1
- package/build/lib/web/development/components/ProgressBar/ProgressBar.js +5 -3
- package/build/lib/web/development/components/ProgressBar/ProgressBar.js.map +1 -1
- package/build/lib/web/development/components/Radio/Radio.js +6 -4
- package/build/lib/web/development/components/Radio/Radio.js.map +1 -1
- package/build/lib/web/development/components/Radio/RadioGroup/RadioGroup.js +8 -5
- package/build/lib/web/development/components/Radio/RadioGroup/RadioGroup.js.map +1 -1
- package/build/lib/web/development/components/SideNav/SideNav.web.js +5 -3
- package/build/lib/web/development/components/SideNav/SideNav.web.js.map +1 -1
- package/build/lib/web/development/components/SideNav/SideNavItems/SideNavItem.web.js +13 -4
- package/build/lib/web/development/components/SideNav/SideNavItems/SideNavItem.web.js.map +1 -1
- package/build/lib/web/development/components/SideNav/SideNavItems/SideNavLink.web.js +10 -4
- package/build/lib/web/development/components/SideNav/SideNavItems/SideNavLink.web.js.map +1 -1
- package/build/lib/web/development/components/SideNav/SideNavSection.web.js +10 -4
- package/build/lib/web/development/components/SideNav/SideNavSection.web.js.map +1 -1
- 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 +13 -7
- package/build/lib/web/development/components/StepGroup/StepItem.web.js.map +1 -1
- package/build/lib/web/development/components/StepGroup/StepLine.web.js +79 -42
- package/build/lib/web/development/components/StepGroup/StepLine.web.js.map +1 -1
- package/build/lib/web/development/components/StepGroup/tokens.js +6 -6
- package/build/lib/web/development/components/StepGroup/tokens.js.map +1 -1
- package/build/lib/web/development/components/Switch/Switch.js +5 -3
- package/build/lib/web/development/components/Switch/Switch.js.map +1 -1
- package/build/lib/web/development/components/Table/Table.web.js +9 -7
- package/build/lib/web/development/components/Table/Table.web.js.map +1 -1
- package/build/lib/web/development/components/Table/TableBody.web.js +18 -9
- package/build/lib/web/development/components/Table/TableBody.web.js.map +1 -1
- package/build/lib/web/development/components/Table/TableFooter.web.js +18 -9
- package/build/lib/web/development/components/Table/TableFooter.web.js.map +1 -1
- package/build/lib/web/development/components/Table/TableHeader.web.js +18 -9
- package/build/lib/web/development/components/Table/TableHeader.web.js.map +1 -1
- package/build/lib/web/development/components/Table/TablePagination.web.js +10 -4
- package/build/lib/web/development/components/Table/TablePagination.web.js.map +1 -1
- package/build/lib/web/development/components/Table/TableToolbar.web.js +13 -8
- package/build/lib/web/development/components/Table/TableToolbar.web.js.map +1 -1
- package/build/lib/web/development/components/Tabs/TabItem.web.js +9 -5
- package/build/lib/web/development/components/Tabs/TabItem.web.js.map +1 -1
- package/build/lib/web/development/components/Tabs/TabList.web.js +5 -3
- package/build/lib/web/development/components/Tabs/TabList.web.js.map +1 -1
- package/build/lib/web/development/components/Tabs/TabPanel.web.js +10 -5
- package/build/lib/web/development/components/Tabs/TabPanel.web.js.map +1 -1
- package/build/lib/web/development/components/Tabs/Tabs.web.js +8 -3
- package/build/lib/web/development/components/Tabs/Tabs.web.js.map +1 -1
- package/build/lib/web/development/components/Tag/Tag.js +6 -4
- package/build/lib/web/development/components/Tag/Tag.js.map +1 -1
- package/build/lib/web/development/components/Toast/ToastContainer.web.js +8 -3
- package/build/lib/web/development/components/Toast/ToastContainer.web.js.map +1 -1
- package/build/lib/web/development/components/Tooltip/Tooltip.web.js +8 -3
- package/build/lib/web/development/components/Tooltip/Tooltip.web.js.map +1 -1
- package/build/lib/web/development/components/TopNav/TabNav/TabNav.web.js +6 -3
- package/build/lib/web/development/components/TopNav/TabNav/TabNav.web.js.map +1 -1
- package/build/lib/web/development/components/TopNav/TopNav.web.js +8 -5
- package/build/lib/web/development/components/TopNav/TopNav.web.js.map +1 -1
- package/build/lib/web/development/components/index.js +3 -0
- package/build/lib/web/development/components/index.js.map +1 -1
- package/build/lib/web/development/tokens/global/size.js +3 -1
- package/build/lib/web/development/tokens/global/size.js.map +1 -1
- package/build/lib/web/development/utils/makeAnalyticsAttribute/index.js +2 -0
- package/build/lib/web/development/utils/makeAnalyticsAttribute/index.js.map +1 -0
- package/build/lib/web/development/utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js +20 -0
- package/build/lib/web/development/utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js.map +1 -0
- package/build/lib/web/production/components/Accordion/Accordion.js +5 -3
- package/build/lib/web/production/components/Accordion/Accordion.js.map +1 -1
- package/build/lib/web/production/components/Accordion/AccordionButton.web.js +8 -3
- package/build/lib/web/production/components/Accordion/AccordionButton.web.js.map +1 -1
- package/build/lib/web/production/components/Accordion/AccordionItem.js +8 -3
- package/build/lib/web/production/components/Accordion/AccordionItem.js.map +1 -1
- package/build/lib/web/production/components/Accordion/AccordionItemBody.js +8 -3
- package/build/lib/web/production/components/Accordion/AccordionItemBody.js.map +1 -1
- package/build/lib/web/production/components/Accordion/AccordionItemHeader.js +10 -4
- package/build/lib/web/production/components/Accordion/AccordionItemHeader.js.map +1 -1
- package/build/lib/web/production/components/ActionList/ActionList.js +9 -4
- package/build/lib/web/production/components/ActionList/ActionList.js.map +1 -1
- package/build/lib/web/production/components/ActionList/ActionListBox.web.js +8 -3
- package/build/lib/web/production/components/ActionList/ActionListBox.web.js.map +1 -1
- package/build/lib/web/production/components/ActionList/ActionListItem.js +10 -5
- package/build/lib/web/production/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/web/production/components/Alert/Alert.js +5 -3
- package/build/lib/web/production/components/Alert/Alert.js.map +1 -1
- package/build/lib/web/production/components/Amount/Amount.js +5 -8
- package/build/lib/web/production/components/Amount/Amount.js.map +1 -1
- package/build/lib/web/production/components/Avatar/Avatar.web.js +5 -3
- package/build/lib/web/production/components/Avatar/Avatar.web.js.map +1 -1
- package/build/lib/web/production/components/Avatar/AvatarGroup.web.js +5 -3
- package/build/lib/web/production/components/Avatar/AvatarGroup.web.js.map +1 -1
- package/build/lib/web/production/components/Badge/Badge.js +5 -3
- package/build/lib/web/production/components/Badge/Badge.js.map +1 -1
- package/build/lib/web/production/components/BaseHeaderFooter/BaseFooter.js +8 -3
- package/build/lib/web/production/components/BaseHeaderFooter/BaseFooter.js.map +1 -1
- package/build/lib/web/production/components/BaseHeaderFooter/BaseHeader.js +8 -3
- package/build/lib/web/production/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
- package/build/lib/web/production/components/BottomNav/BottomNav.web.js +12 -8
- package/build/lib/web/production/components/BottomNav/BottomNav.web.js.map +1 -1
- package/build/lib/web/production/components/BottomSheet/BottomSheet.web.js +9 -3
- package/build/lib/web/production/components/BottomSheet/BottomSheet.web.js.map +1 -1
- package/build/lib/web/production/components/BottomSheet/BottomSheetBody.web.js +8 -3
- package/build/lib/web/production/components/BottomSheet/BottomSheetBody.web.js.map +1 -1
- package/build/lib/web/production/components/BottomSheet/BottomSheetFooter.web.js +8 -3
- package/build/lib/web/production/components/BottomSheet/BottomSheetFooter.web.js.map +1 -1
- package/build/lib/web/production/components/BottomSheet/BottomSheetHeader.web.js +8 -3
- package/build/lib/web/production/components/BottomSheet/BottomSheetHeader.web.js.map +1 -1
- package/build/lib/web/production/components/Box/BaseBox/BaseBox.web.js +4 -2
- package/build/lib/web/production/components/Box/BaseBox/BaseBox.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 +4 -2
- package/build/lib/web/production/components/Box/Box.js.map +1 -1
- package/build/lib/web/production/components/Breadcrumb/Breadcrumb.web.js +6 -4
- package/build/lib/web/production/components/Breadcrumb/Breadcrumb.web.js.map +1 -1
- package/build/lib/web/production/components/Breadcrumb/BreadcrumbItem.web.js +13 -4
- package/build/lib/web/production/components/Breadcrumb/BreadcrumbItem.web.js.map +1 -1
- package/build/lib/web/production/components/Button/BaseButton/BaseButton.js +4 -2
- package/build/lib/web/production/components/Button/BaseButton/BaseButton.js.map +1 -1
- package/build/lib/web/production/components/Button/Button/Button.js +4 -2
- package/build/lib/web/production/components/Button/Button/Button.js.map +1 -1
- package/build/lib/web/production/components/Button/IconButton/IconButton.js +11 -5
- package/build/lib/web/production/components/Button/IconButton/IconButton.js.map +1 -1
- package/build/lib/web/production/components/Button/IconButton/StyledIconButton.web.js +8 -3
- package/build/lib/web/production/components/Button/IconButton/StyledIconButton.web.js.map +1 -1
- package/build/lib/web/production/components/ButtonGroup/ButtonGroup.web.js +5 -3
- package/build/lib/web/production/components/ButtonGroup/ButtonGroup.web.js.map +1 -1
- package/build/lib/web/production/components/Card/Card.js +11 -7
- package/build/lib/web/production/components/Card/Card.js.map +1 -1
- package/build/lib/web/production/components/Card/CardFooter.js +22 -11
- package/build/lib/web/production/components/Card/CardFooter.js.map +1 -1
- package/build/lib/web/production/components/Card/CardHeader.js +13 -6
- package/build/lib/web/production/components/Card/CardHeader.js.map +1 -1
- package/build/lib/web/production/components/Carousel/Carousel.web.js +5 -3
- package/build/lib/web/production/components/Carousel/Carousel.web.js.map +1 -1
- package/build/lib/web/production/components/Carousel/CarouselItem.web.js +9 -3
- package/build/lib/web/production/components/Carousel/CarouselItem.web.js.map +1 -1
- package/build/lib/web/production/components/Checkbox/Checkbox.js +6 -4
- package/build/lib/web/production/components/Checkbox/Checkbox.js.map +1 -1
- package/build/lib/web/production/components/Checkbox/CheckboxGroup/CheckboxGroup.js +8 -5
- package/build/lib/web/production/components/Checkbox/CheckboxGroup/CheckboxGroup.js.map +1 -1
- package/build/lib/web/production/components/Chip/Chip.js +5 -3
- package/build/lib/web/production/components/Chip/Chip.js.map +1 -1
- package/build/lib/web/production/components/Chip/ChipGroup.js +8 -5
- package/build/lib/web/production/components/Chip/ChipGroup.js.map +1 -1
- package/build/lib/web/production/components/Collapsible/Collapsible.js +5 -3
- package/build/lib/web/production/components/Collapsible/Collapsible.js.map +1 -1
- package/build/lib/web/production/components/Collapsible/CollapsibleBody.js +8 -3
- package/build/lib/web/production/components/Collapsible/CollapsibleBody.js.map +1 -1
- package/build/lib/web/production/components/Collapsible/CollapsibleButton.js +13 -4
- package/build/lib/web/production/components/Collapsible/CollapsibleButton.js.map +1 -1
- package/build/lib/web/production/components/Collapsible/CollapsibleLink.js +5 -3
- package/build/lib/web/production/components/Collapsible/CollapsibleLink.js.map +1 -1
- package/build/lib/web/production/components/Counter/Counter.js +5 -3
- package/build/lib/web/production/components/Counter/Counter.js.map +1 -1
- package/build/lib/web/production/components/DatePicker/DateInput.web.js +11 -7
- package/build/lib/web/production/components/DatePicker/DateInput.web.js.map +1 -1
- package/build/lib/web/production/components/DatePicker/DatePicker.web.js +4 -2
- package/build/lib/web/production/components/DatePicker/DatePicker.web.js.map +1 -1
- package/build/lib/web/production/components/Drawer/Drawer.web.js +8 -3
- package/build/lib/web/production/components/Drawer/Drawer.web.js.map +1 -1
- package/build/lib/web/production/components/Drawer/DrawerSubcomponents.web.js +11 -3
- package/build/lib/web/production/components/Drawer/DrawerSubcomponents.web.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/Dropdown.js +5 -3
- package/build/lib/web/production/components/Dropdown/Dropdown.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/DropdownButton.js +2 -2
- package/build/lib/web/production/components/Dropdown/DropdownButton.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/DropdownHeaderFooter.js +8 -3
- package/build/lib/web/production/components/Dropdown/DropdownHeaderFooter.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/DropdownLink.js +5 -3
- package/build/lib/web/production/components/Dropdown/DropdownLink.js.map +1 -1
- package/build/lib/web/production/components/FileUpload/FileUpload.web.js +6 -4
- package/build/lib/web/production/components/FileUpload/FileUpload.web.js.map +1 -1
- package/build/lib/web/production/components/Form/Selector/SelectorGroupField.js +8 -3
- package/build/lib/web/production/components/Form/Selector/SelectorGroupField.js.map +1 -1
- package/build/lib/web/production/components/Form/Selector/SelectorInput.web.js +8 -3
- package/build/lib/web/production/components/Form/Selector/SelectorInput.web.js.map +1 -1
- package/build/lib/web/production/components/Icons/IndiaFlagIcon/IndiaFlagIcon.js +39 -0
- package/build/lib/web/production/components/Icons/IndiaFlagIcon/IndiaFlagIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/IndiaFlagIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/IndiaFlagIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/MagicKonnectIcon/MagicKonnectIcon.js +49 -0
- package/build/lib/web/production/components/Icons/MagicKonnectIcon/MagicKonnectIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/MagicKonnectIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/MagicKonnectIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/WorldwideIcon/WorldwideIcon.js +39 -0
- package/build/lib/web/production/components/Icons/WorldwideIcon/WorldwideIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/WorldwideIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/WorldwideIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/index.js +3 -0
- package/build/lib/web/production/components/Icons/index.js.map +1 -1
- package/build/lib/web/production/components/Indicator/Indicator.js +5 -3
- package/build/lib/web/production/components/Indicator/Indicator.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/BaseInput.js +6 -4
- package/build/lib/web/production/components/Input/BaseInput/BaseInput.js.map +1 -1
- package/build/lib/web/production/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +5 -2
- package/build/lib/web/production/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
- package/build/lib/web/production/components/Input/DropdownInputTriggers/SelectInput.js +5 -3
- package/build/lib/web/production/components/Input/DropdownInputTriggers/SelectInput.js.map +1 -1
- package/build/lib/web/production/components/Input/OTPInput/OTPInput.js +6 -4
- package/build/lib/web/production/components/Input/OTPInput/OTPInput.js.map +1 -1
- package/build/lib/web/production/components/Input/PasswordInput/PasswordInput.js +2 -2
- package/build/lib/web/production/components/Input/PasswordInput/PasswordInput.js.map +1 -1
- package/build/lib/web/production/components/Input/PhoneNumberInput/PhoneNumberInput.web.js +2 -2
- package/build/lib/web/production/components/Input/PhoneNumberInput/PhoneNumberInput.web.js.map +1 -1
- package/build/lib/web/production/components/Input/SearchInput/SearchInput.js +2 -2
- package/build/lib/web/production/components/Input/SearchInput/SearchInput.js.map +1 -1
- package/build/lib/web/production/components/Input/TextArea/TextArea.js +2 -2
- package/build/lib/web/production/components/Input/TextArea/TextArea.js.map +1 -1
- package/build/lib/web/production/components/Input/TextInput/TextInput.js +2 -2
- package/build/lib/web/production/components/Input/TextInput/TextInput.js.map +1 -1
- package/build/lib/web/production/components/Link/BaseLink/BaseLink.js +5 -3
- package/build/lib/web/production/components/Link/BaseLink/BaseLink.js.map +1 -1
- package/build/lib/web/production/components/Link/Link/Link.js +4 -2
- package/build/lib/web/production/components/Link/Link/Link.js.map +1 -1
- package/build/lib/web/production/components/Menu/VisualSubComponents/MenuHeaderFooter.web.js +18 -8
- package/build/lib/web/production/components/Menu/VisualSubComponents/MenuHeaderFooter.web.js.map +1 -1
- package/build/lib/web/production/components/Modal/Modal.web.js +10 -4
- package/build/lib/web/production/components/Modal/Modal.web.js.map +1 -1
- package/build/lib/web/production/components/Modal/ModalBody.web.js +9 -3
- package/build/lib/web/production/components/Modal/ModalBody.web.js.map +1 -1
- package/build/lib/web/production/components/Modal/ModalFooter.web.js +7 -2
- package/build/lib/web/production/components/Modal/ModalFooter.web.js.map +1 -1
- package/build/lib/web/production/components/Modal/ModalHeader.web.js +14 -6
- package/build/lib/web/production/components/Modal/ModalHeader.web.js.map +1 -1
- package/build/lib/web/production/components/Popover/Popover.web.js +8 -3
- package/build/lib/web/production/components/Popover/Popover.web.js.map +1 -1
- package/build/lib/web/production/components/Popover/PopoverInteractiveWrapper.web.js.map +1 -1
- package/build/lib/web/production/components/ProgressBar/ProgressBar.js +5 -3
- package/build/lib/web/production/components/ProgressBar/ProgressBar.js.map +1 -1
- package/build/lib/web/production/components/Radio/Radio.js +6 -4
- package/build/lib/web/production/components/Radio/Radio.js.map +1 -1
- package/build/lib/web/production/components/Radio/RadioGroup/RadioGroup.js +8 -5
- package/build/lib/web/production/components/Radio/RadioGroup/RadioGroup.js.map +1 -1
- package/build/lib/web/production/components/SideNav/SideNav.web.js +5 -3
- package/build/lib/web/production/components/SideNav/SideNav.web.js.map +1 -1
- package/build/lib/web/production/components/SideNav/SideNavItems/SideNavItem.web.js +13 -4
- package/build/lib/web/production/components/SideNav/SideNavItems/SideNavItem.web.js.map +1 -1
- package/build/lib/web/production/components/SideNav/SideNavItems/SideNavLink.web.js +10 -4
- package/build/lib/web/production/components/SideNav/SideNavItems/SideNavLink.web.js.map +1 -1
- package/build/lib/web/production/components/SideNav/SideNavSection.web.js +10 -4
- package/build/lib/web/production/components/SideNav/SideNavSection.web.js.map +1 -1
- 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 +13 -7
- package/build/lib/web/production/components/StepGroup/StepItem.web.js.map +1 -1
- package/build/lib/web/production/components/StepGroup/StepLine.web.js +79 -42
- package/build/lib/web/production/components/StepGroup/StepLine.web.js.map +1 -1
- package/build/lib/web/production/components/StepGroup/tokens.js +6 -6
- package/build/lib/web/production/components/StepGroup/tokens.js.map +1 -1
- package/build/lib/web/production/components/Switch/Switch.js +5 -3
- package/build/lib/web/production/components/Switch/Switch.js.map +1 -1
- package/build/lib/web/production/components/Table/Table.web.js +9 -7
- package/build/lib/web/production/components/Table/Table.web.js.map +1 -1
- package/build/lib/web/production/components/Table/TableBody.web.js +18 -9
- package/build/lib/web/production/components/Table/TableBody.web.js.map +1 -1
- package/build/lib/web/production/components/Table/TableFooter.web.js +18 -9
- package/build/lib/web/production/components/Table/TableFooter.web.js.map +1 -1
- package/build/lib/web/production/components/Table/TableHeader.web.js +18 -9
- package/build/lib/web/production/components/Table/TableHeader.web.js.map +1 -1
- package/build/lib/web/production/components/Table/TablePagination.web.js +10 -4
- package/build/lib/web/production/components/Table/TablePagination.web.js.map +1 -1
- package/build/lib/web/production/components/Table/TableToolbar.web.js +13 -8
- package/build/lib/web/production/components/Table/TableToolbar.web.js.map +1 -1
- package/build/lib/web/production/components/Tabs/TabItem.web.js +9 -5
- package/build/lib/web/production/components/Tabs/TabItem.web.js.map +1 -1
- package/build/lib/web/production/components/Tabs/TabList.web.js +5 -3
- package/build/lib/web/production/components/Tabs/TabList.web.js.map +1 -1
- package/build/lib/web/production/components/Tabs/TabPanel.web.js +10 -5
- package/build/lib/web/production/components/Tabs/TabPanel.web.js.map +1 -1
- package/build/lib/web/production/components/Tabs/Tabs.web.js +8 -3
- package/build/lib/web/production/components/Tabs/Tabs.web.js.map +1 -1
- package/build/lib/web/production/components/Tag/Tag.js +6 -4
- package/build/lib/web/production/components/Tag/Tag.js.map +1 -1
- package/build/lib/web/production/components/Toast/ToastContainer.web.js +8 -3
- package/build/lib/web/production/components/Toast/ToastContainer.web.js.map +1 -1
- package/build/lib/web/production/components/Tooltip/Tooltip.web.js +8 -3
- package/build/lib/web/production/components/Tooltip/Tooltip.web.js.map +1 -1
- package/build/lib/web/production/components/TopNav/TabNav/TabNav.web.js +6 -3
- package/build/lib/web/production/components/TopNav/TabNav/TabNav.web.js.map +1 -1
- package/build/lib/web/production/components/TopNav/TopNav.web.js +8 -5
- package/build/lib/web/production/components/TopNav/TopNav.web.js.map +1 -1
- package/build/lib/web/production/components/index.js +3 -0
- package/build/lib/web/production/components/index.js.map +1 -1
- package/build/lib/web/production/tokens/global/size.js +3 -1
- package/build/lib/web/production/tokens/global/size.js.map +1 -1
- package/build/lib/web/production/utils/makeAnalyticsAttribute/index.js +2 -0
- package/build/lib/web/production/utils/makeAnalyticsAttribute/index.js.map +1 -0
- package/build/lib/web/production/utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js +20 -0
- package/build/lib/web/production/utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js.map +1 -0
- package/build/types/components/index.d.ts +228 -190
- package/build/types/components/index.native.d.ts +152 -132
- package/build/types/tokens/index.d.ts +3 -1
- package/build/types/tokens/index.native.d.ts +3 -1
- package/package.json +1 -1
package/build/lib/web/development/components/Input/PhoneNumberInput/PhoneNumberInput.web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhoneNumberInput.web.js","sources":["../../../../../../../src/components/Input/PhoneNumberInput/PhoneNumberInput.web.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */\nimport type { CountryCodeType } from '@razorpay/i18nify-js';\nimport {\n formatPhoneNumber,\n getDialCodeByCountryCode,\n getFlagsForAllCountries,\n} from '@razorpay/i18nify-js';\nimport React from 'react';\nimport type { PhoneNumberInputProps } from './types';\nimport { countryNameFormatter, CountrySelector } from './CountrySelector';\nimport { BaseInput } from '~components/Input/BaseInput';\nimport { IconButton } from '~components/Button/IconButton';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport { getKeyboardAndAutocompleteProps } from '~components/Input/BaseInput/utils';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport type { BladeElementRef } from '~utils/types';\nimport { CloseIcon } from '~components/Icons';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport { useControllableState } from '~utils/useControllable';\n\nconst _PhoneNumberInput: React.ForwardRefRenderFunction<BladeElementRef, PhoneNumberInputProps> = (\n {\n defaultCountry = 'IN',\n country,\n onCountryChange,\n label,\n labelPosition,\n defaultValue,\n value,\n name,\n onChange,\n necessityIndicator,\n isRequired,\n isDisabled,\n leadingIcon,\n trailingIcon,\n validationState,\n errorText,\n helpText,\n successText,\n size = 'medium',\n onClearButtonClick,\n showCountrySelector = true,\n showDialCode = true,\n onClick,\n onBlur,\n onFocus,\n accessibilityLabel = 'Enter phone number',\n autoFocus,\n testID,\n keyboardReturnKeyType = 'done',\n autoCompleteSuggestionType,\n allowedCountries,\n placeholder,\n ...styledProps\n },\n ref,\n): React.ReactElement => {\n const inputRef = React.useRef<HTMLInputElement | null>(null);\n const mergedRef = useMergeRefs(ref, inputRef);\n\n const inputWrapperRef = React.useRef<HTMLDivElement | null>(null);\n const [shouldShowClearButton, setShouldShowClearButton] = React.useState(false);\n const [selectedCountry, setSelectedCountry] = useControllableState<CountryCodeType>({\n defaultValue: defaultCountry as CountryCodeType,\n value: country,\n onChange: (country) => onCountryChange?.({ country }),\n });\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(defaultValue ?? value));\n }, [defaultValue, value]);\n\n const renderTrailingInteractionElement = (): React.ReactNode => {\n if (!shouldShowClearButton) return null;\n return (\n <IconButton\n size=\"medium\"\n icon={CloseIcon}\n onClick={() => {\n if (isEmpty(value) && inputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (inputRef.current instanceof HTMLInputElement) {\n inputRef.current.value = '';\n inputRef.current.focus();\n }\n }\n // if the input field is controlled just call the click handler and the value change shall be left upto the consumer\n onClearButtonClick?.();\n inputRef?.current?.focus();\n setShouldShowClearButton(false);\n }}\n isDisabled={isDisabled}\n accessibilityLabel=\"Clear Input Content\"\n />\n );\n };\n\n const flags = React.useMemo(() => getFlagsForAllCountries(), []);\n const countryData = React.useMemo(() => {\n if (allowedCountries) {\n return allowedCountries.map((countryCode) => {\n return {\n code: countryCode,\n name: countryNameFormatter.of(countryCode)!,\n };\n });\n }\n\n return (Object.keys(flags) as CountryCodeType[])\n .filter((countryCode) => !countryCode.includes('-')) // remove the non ISO 3166-1 alpha-2 country codes\n .map((countryCode) => {\n return {\n code: countryCode,\n name: countryNameFormatter.of(countryCode)!,\n };\n })\n .sort((a, b) => a.name.localeCompare(b.name));\n }, [allowedCountries, flags]);\n\n const handleOnChange = ({\n name,\n value,\n selectedCountry,\n }: {\n name?: string;\n value?: string;\n selectedCountry: CountryCodeType;\n }): void => {\n onChange?.({\n name: name!,\n value: value!,\n phoneNumber: value ? formatPhoneNumber(value, selectedCountry) : undefined!,\n dialCode: getDialCodeByCountryCode(selectedCountry),\n country: selectedCountry,\n });\n };\n\n const onItemClick = ({ name }: { name: string }): void => {\n const selectedCountry = name as CountryCodeType;\n setSelectedCountry(() => selectedCountry);\n handleOnChange({\n selectedCountry,\n name: inputRef.current?.name,\n value: inputRef.current?.value,\n });\n inputRef.current?.focus();\n };\n\n return (\n <BaseInput\n setInputWrapperRef={(node) => {\n inputWrapperRef.current = node as HTMLInputElement;\n }}\n ref={mergedRef}\n id=\"phone-number-input\"\n componentName={MetaConstants.PhoneNumberInput}\n label={label as string}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n defaultValue={defaultValue}\n value={value}\n name={name}\n placeholder={placeholder ?? formatPhoneNumber('1234567890', selectedCountry)}\n trailingIcon={trailingIcon}\n leadingIcon={leadingIcon}\n prefix={showDialCode ? getDialCodeByCountryCode(selectedCountry) : undefined}\n trailingInteractionElement={renderTrailingInteractionElement()}\n leadingInteractionElement={\n showCountrySelector ? (\n <CountrySelector\n size={size}\n countryData={countryData}\n flags={flags}\n inputWrapperRef={inputWrapperRef}\n isDisabled={isDisabled}\n selectedCountry={selectedCountry}\n onItemClick={onItemClick}\n />\n ) : null\n }\n onChange={({ name, value }) => {\n if (value?.length) {\n // show the clear button when the user starts typing in\n setShouldShowClearButton(true);\n }\n if (shouldShowClearButton && !value?.length) {\n // hide the clear button when the input field is empty\n setShouldShowClearButton(false);\n }\n handleOnChange({ name, value, selectedCountry });\n }}\n onClick={onClick}\n onFocus={onFocus}\n onBlur={onBlur}\n isDisabled={isDisabled}\n accessibilityLabel={accessibilityLabel}\n necessityIndicator={necessityIndicator}\n isRequired={isRequired}\n validationState={validationState}\n errorText={errorText}\n helpText={helpText}\n successText={successText}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n testID={testID}\n size={size}\n {...getKeyboardAndAutocompleteProps({\n type: 'number',\n keyboardReturnKeyType,\n autoCompleteSuggestionType,\n autoCapitalize: 'none',\n })}\n type=\"telephone\"\n {...styledProps}\n />\n );\n};\n\n/**\n * PhoneNumberInput is a component that allows users to input phone numbers.\n * It provides a country selector dropdown to select the country code.\n *\n * @example\n *\n * ```ts\n * <PhoneNumberInput />\n * ```\n */\nconst PhoneNumberInput = assignWithoutSideEffects(React.forwardRef(_PhoneNumberInput), {\n displayName: 'PhoneNumberInput',\n});\n\nexport { PhoneNumberInput };\n"],"names":["_PhoneNumberInput","_ref","ref","_ref$defaultCountry","defaultCountry","country","onCountryChange","label","labelPosition","defaultValue","value","name","onChange","necessityIndicator","isRequired","isDisabled","leadingIcon","trailingIcon","validationState","errorText","helpText","successText","_ref$size","size","onClearButtonClick","_ref$showCountrySelec","showCountrySelector","_ref$showDialCode","showDialCode","onClick","onBlur","onFocus","_ref$accessibilityLab","accessibilityLabel","autoFocus","testID","_ref$keyboardReturnKe","keyboardReturnKeyType","autoCompleteSuggestionType","allowedCountries","placeholder","styledProps","_objectWithoutProperties","_excluded","inputRef","React","useRef","mergedRef","useMergeRefs","inputWrapperRef","_React$useState","useState","_React$useState2","_slicedToArray","shouldShowClearButton","setShouldShowClearButton","_useControllableState","useControllableState","_useControllableState2","selectedCountry","setSelectedCountry","useEffect","Boolean","renderTrailingInteractionElement","_jsx","IconButton","icon","CloseIcon","_inputRef$current","isEmpty","current","HTMLInputElement","focus","flags","useMemo","getFlagsForAllCountries","countryData","map","countryCode","code","countryNameFormatter","of","Object","keys","filter","includes","sort","a","b","localeCompare","handleOnChange","_ref2","phoneNumber","formatPhoneNumber","undefined","dialCode","getDialCodeByCountryCode","onItemClick","_ref3","_inputRef$current2","_inputRef$current3","_inputRef$current4","BaseInput","_objectSpread","setInputWrapperRef","node","id","componentName","MetaConstants","PhoneNumberInput","hideLabelText","prefix","trailingInteractionElement","leadingInteractionElement","CountrySelector","_ref4","length","getKeyboardAndAutocompleteProps","type","autoCapitalize","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,IAAMA,iBAAyF,GAAG,SAA5FA,iBAAyFA,CAAAC,IAAA,EAoC7FC,GAAG,EACoB;AAAA,EAAA,IAAAC,mBAAA,GAAAF,IAAA,CAnCrBG,cAAc;AAAdA,IAAAA,cAAc,GAAAD,mBAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,mBAAA;IACrBE,OAAO,GAAAJ,IAAA,CAAPI,OAAO;IACPC,eAAe,GAAAL,IAAA,CAAfK,eAAe;IACfC,KAAK,GAAAN,IAAA,CAALM,KAAK;IACLC,aAAa,GAAAP,IAAA,CAAbO,aAAa;IACbC,YAAY,GAAAR,IAAA,CAAZQ,YAAY;IACZC,KAAK,GAAAT,IAAA,CAALS,KAAK;IACLC,IAAI,GAAAV,IAAA,CAAJU,IAAI;IACJC,QAAQ,GAAAX,IAAA,CAARW,QAAQ;IACRC,kBAAkB,GAAAZ,IAAA,CAAlBY,kBAAkB;IAClBC,UAAU,GAAAb,IAAA,CAAVa,UAAU;IACVC,UAAU,GAAAd,IAAA,CAAVc,UAAU;IACVC,WAAW,GAAAf,IAAA,CAAXe,WAAW;IACXC,YAAY,GAAAhB,IAAA,CAAZgB,YAAY;IACZC,eAAe,GAAAjB,IAAA,CAAfiB,eAAe;IACfC,SAAS,GAAAlB,IAAA,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AA,0BAA0B,EAA1BA,0BAA0B;AAC1BiF,IAAAA,cAAc,EAAE,MAAA;AAClB,GAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AACFD,IAAAA,IAAI,EAAC,WAAA;GACD7E,EAAAA,WAAW,CAChB,CAAC,CAAA;AAEN,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACMoE,IAAAA,gBAAgB,gBAAGW,wBAAwB,eAAC3E,cAAK,CAAC4E,UAAU,CAACzH,iBAAiB,CAAC,EAAE;AACrF0H,EAAAA,WAAW,EAAE,kBAAA;AACf,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"PhoneNumberInput.web.js","sources":["../../../../../../../src/components/Input/PhoneNumberInput/PhoneNumberInput.web.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */\nimport type { CountryCodeType } from '@razorpay/i18nify-js';\nimport {\n formatPhoneNumber,\n getDialCodeByCountryCode,\n getFlagsForAllCountries,\n} from '@razorpay/i18nify-js';\nimport React from 'react';\nimport type { PhoneNumberInputProps } from './types';\nimport { countryNameFormatter, CountrySelector } from './CountrySelector';\nimport { BaseInput } from '~components/Input/BaseInput';\nimport { IconButton } from '~components/Button/IconButton';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport { getKeyboardAndAutocompleteProps } from '~components/Input/BaseInput/utils';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport type { BladeElementRef } from '~utils/types';\nimport { CloseIcon } from '~components/Icons';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport { useControllableState } from '~utils/useControllable';\n\nconst _PhoneNumberInput: React.ForwardRefRenderFunction<BladeElementRef, PhoneNumberInputProps> = (\n {\n defaultCountry = 'IN',\n country,\n onCountryChange,\n label,\n labelPosition,\n defaultValue,\n value,\n name,\n onChange,\n necessityIndicator,\n isRequired,\n isDisabled,\n leadingIcon,\n trailingIcon,\n validationState,\n errorText,\n helpText,\n successText,\n size = 'medium',\n onClearButtonClick,\n showCountrySelector = true,\n showDialCode = true,\n onClick,\n onBlur,\n onFocus,\n accessibilityLabel = 'Enter phone number',\n autoFocus,\n testID,\n keyboardReturnKeyType = 'done',\n autoCompleteSuggestionType,\n allowedCountries,\n placeholder,\n ...rest\n },\n ref,\n): React.ReactElement => {\n const inputRef = React.useRef<HTMLInputElement | null>(null);\n const mergedRef = useMergeRefs(ref, inputRef);\n\n const inputWrapperRef = React.useRef<HTMLDivElement | null>(null);\n const [shouldShowClearButton, setShouldShowClearButton] = React.useState(false);\n const [selectedCountry, setSelectedCountry] = useControllableState<CountryCodeType>({\n defaultValue: defaultCountry as CountryCodeType,\n value: country,\n onChange: (country) => onCountryChange?.({ country }),\n });\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(defaultValue ?? value));\n }, [defaultValue, value]);\n\n const renderTrailingInteractionElement = (): React.ReactNode => {\n if (!shouldShowClearButton) return null;\n return (\n <IconButton\n size=\"medium\"\n icon={CloseIcon}\n onClick={() => {\n if (isEmpty(value) && inputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (inputRef.current instanceof HTMLInputElement) {\n inputRef.current.value = '';\n inputRef.current.focus();\n }\n }\n // if the input field is controlled just call the click handler and the value change shall be left upto the consumer\n onClearButtonClick?.();\n inputRef?.current?.focus();\n setShouldShowClearButton(false);\n }}\n isDisabled={isDisabled}\n accessibilityLabel=\"Clear Input Content\"\n />\n );\n };\n\n const flags = React.useMemo(() => getFlagsForAllCountries(), []);\n const countryData = React.useMemo(() => {\n if (allowedCountries) {\n return allowedCountries.map((countryCode) => {\n return {\n code: countryCode,\n name: countryNameFormatter.of(countryCode)!,\n };\n });\n }\n\n return (Object.keys(flags) as CountryCodeType[])\n .filter((countryCode) => !countryCode.includes('-')) // remove the non ISO 3166-1 alpha-2 country codes\n .map((countryCode) => {\n return {\n code: countryCode,\n name: countryNameFormatter.of(countryCode)!,\n };\n })\n .sort((a, b) => a.name.localeCompare(b.name));\n }, [allowedCountries, flags]);\n\n const handleOnChange = ({\n name,\n value,\n selectedCountry,\n }: {\n name?: string;\n value?: string;\n selectedCountry: CountryCodeType;\n }): void => {\n onChange?.({\n name: name!,\n value: value!,\n phoneNumber: value ? formatPhoneNumber(value, selectedCountry) : undefined!,\n dialCode: getDialCodeByCountryCode(selectedCountry),\n country: selectedCountry,\n });\n };\n\n const onItemClick = ({ name }: { name: string }): void => {\n const selectedCountry = name as CountryCodeType;\n setSelectedCountry(() => selectedCountry);\n handleOnChange({\n selectedCountry,\n name: inputRef.current?.name,\n value: inputRef.current?.value,\n });\n inputRef.current?.focus();\n };\n\n return (\n <BaseInput\n setInputWrapperRef={(node) => {\n inputWrapperRef.current = node as HTMLInputElement;\n }}\n ref={mergedRef}\n id=\"phone-number-input\"\n componentName={MetaConstants.PhoneNumberInput}\n label={label as string}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n defaultValue={defaultValue}\n value={value}\n name={name}\n placeholder={placeholder ?? formatPhoneNumber('1234567890', selectedCountry)}\n trailingIcon={trailingIcon}\n leadingIcon={leadingIcon}\n prefix={showDialCode ? getDialCodeByCountryCode(selectedCountry) : undefined}\n trailingInteractionElement={renderTrailingInteractionElement()}\n leadingInteractionElement={\n showCountrySelector ? (\n <CountrySelector\n size={size}\n countryData={countryData}\n flags={flags}\n inputWrapperRef={inputWrapperRef}\n isDisabled={isDisabled}\n selectedCountry={selectedCountry}\n onItemClick={onItemClick}\n />\n ) : null\n }\n onChange={({ name, value }) => {\n if (value?.length) {\n // show the clear button when the user starts typing in\n setShouldShowClearButton(true);\n }\n if (shouldShowClearButton && !value?.length) {\n // hide the clear button when the input field is empty\n setShouldShowClearButton(false);\n }\n handleOnChange({ name, value, selectedCountry });\n }}\n onClick={onClick}\n onFocus={onFocus}\n onBlur={onBlur}\n isDisabled={isDisabled}\n accessibilityLabel={accessibilityLabel}\n necessityIndicator={necessityIndicator}\n isRequired={isRequired}\n validationState={validationState}\n errorText={errorText}\n helpText={helpText}\n successText={successText}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n testID={testID}\n size={size}\n {...getKeyboardAndAutocompleteProps({\n type: 'number',\n keyboardReturnKeyType,\n autoCompleteSuggestionType,\n autoCapitalize: 'none',\n })}\n type=\"telephone\"\n {...rest}\n />\n );\n};\n\n/**\n * PhoneNumberInput is a component that allows users to input phone numbers.\n * It provides a country selector dropdown to select the country code.\n *\n * @example\n *\n * ```ts\n * <PhoneNumberInput />\n * ```\n */\nconst PhoneNumberInput = assignWithoutSideEffects(React.forwardRef(_PhoneNumberInput), {\n displayName: 'PhoneNumberInput',\n});\n\nexport { PhoneNumberInput };\n"],"names":["_PhoneNumberInput","_ref","ref","_ref$defaultCountry","defaultCountry","country","onCountryChange","label","labelPosition","defaultValue","value","name","onChange","necessityIndicator","isRequired","isDisabled","leadingIcon","trailingIcon","validationState","errorText","helpText","successText","_ref$size","size","onClearButtonClick","_ref$showCountrySelec","showCountrySelector","_ref$showDialCode","showDialCode","onClick","onBlur","onFocus","_ref$accessibilityLab","accessibilityLabel","autoFocus","testID","_ref$keyboardReturnKe","keyboardReturnKeyType","autoCompleteSuggestionType","allowedCountries","placeholder","rest","_objectWithoutProperties","_excluded","inputRef","React","useRef","mergedRef","useMergeRefs","inputWrapperRef","_React$useState","useState","_React$useState2","_slicedToArray","shouldShowClearButton","setShouldShowClearButton","_useControllableState","useControllableState","_useControllableState2","selectedCountry","setSelectedCountry","useEffect","Boolean","renderTrailingInteractionElement","_jsx","IconButton","icon","CloseIcon","_inputRef$current","isEmpty","current","HTMLInputElement","focus","flags","useMemo","getFlagsForAllCountries","countryData","map","countryCode","code","countryNameFormatter","of","Object","keys","filter","includes","sort","a","b","localeCompare","handleOnChange","_ref2","phoneNumber","formatPhoneNumber","undefined","dialCode","getDialCodeByCountryCode","onItemClick","_ref3","_inputRef$current2","_inputRef$current3","_inputRef$current4","BaseInput","_objectSpread","setInputWrapperRef","node","id","componentName","MetaConstants","PhoneNumberInput","hideLabelText","prefix","trailingInteractionElement","leadingInteractionElement","CountrySelector","_ref4","length","getKeyboardAndAutocompleteProps","type","autoCapitalize","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,IAAMA,iBAAyF,GAAG,SAA5FA,iBAAyFA,CAAAC,IAAA,EAoC7FC,GAAG,EACoB;AAAA,EAAA,IAAAC,mBAAA,GAAAF,IAAA,CAnCrBG,cAAc;AAAdA,IAAAA,cAAc,GAAAD,mBAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,mBAAA;IACrBE,OAAO,GAAAJ,IAAA,CAAPI,OAAO;IACPC,eAAe,GAAAL,IAAA,CAAfK,eAAe;IACfC,KAAK,GAAAN,IAAA,CAALM,KAAK;IACLC,aAAa,GAAAP,IAAA,CAAbO,aAAa;IACbC,YAAY,GAAAR,IAAA,CAAZQ,YAAY;IACZC,KAAK,GAAAT,IAAA,CAALS,KAAK;IACLC,IAAI,GAAAV,IAAA,CAAJU,IAAI;IACJC,QAAQ,GAAAX,IAAA,CAARW,QAAQ;IACRC,kBAAkB,GAAAZ,IAAA,CAAlBY,kBAAkB;IAClBC,UAAU,GAAAb,IAAA,CAAVa,UAAU;IACVC,UAAU,GAAAd,IAAA,CAAVc,UAAU;IACVC,WAAW,GAAAf,IAAA,CAAXe,WAAW;IACXC,YAAY,GAAAhB,IAAA,CAAZgB,YAAY;IACZC,eAAe,GAAAjB,IAAA,CAAfiB,eAAe;IACfC,SAAS,GAAAlB,IAAA,CAATkB,SAAS;IACTC,QAAQ,GAAAnB,IAAA,CAARmB,QAAQ;IACRC,WAAW,GAAApB,IAAA,CAAXoB,WAAW;IAAAC,SAAA,GAAArB,IAAA,CACXsB,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,QAAQ,GAAAA,SAAA;IACfE,kBAAkB,G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A;AACA;AACA;AACMoE,IAAAA,gBAAgB,gBAAGW,wBAAwB,eAAC3E,cAAK,CAAC4E,UAAU,CAACzH,iBAAiB,CAAC,EAAE;AACrF0H,EAAAA,WAAW,EAAE,kBAAA;AACf,CAAC;;;;"}
|
|
@@ -59,7 +59,7 @@ var _SearchInput = function _SearchInput(_ref, ref) {
|
|
|
59
59
|
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
60
60
|
_ref$showSearchIcon = _ref.showSearchIcon,
|
|
61
61
|
showSearchIcon = _ref$showSearchIcon === void 0 ? true : _ref$showSearchIcon,
|
|
62
|
-
|
|
62
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
63
63
|
var textInputRef = React__default.useRef(null);
|
|
64
64
|
var mergedRef = useMergeRefs(ref, textInputRef);
|
|
65
65
|
var _useState = useState(false),
|
|
@@ -168,7 +168,7 @@ var _SearchInput = function _SearchInput(_ref, ref) {
|
|
|
168
168
|
autoCapitalize: autoCapitalize
|
|
169
169
|
})), {}, {
|
|
170
170
|
size: size
|
|
171
|
-
},
|
|
171
|
+
}, rest))
|
|
172
172
|
});
|
|
173
173
|
};
|
|
174
174
|
var SearchInput = /*#__PURE__*/assignWithoutSideEffects( /*#__PURE__*/React__default.forwardRef(_SearchInput), {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchInput.js","sources":["../../../../../../../src/components/Input/SearchInput/SearchInput.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport type { ReactElement, ReactNode } from 'react';\nimport type { TextInput as TextInputReactNative } from 'react-native';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { getKeyboardAndAutocompleteProps } from '../BaseInput/utils';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport { CloseIcon, SearchIcon } from '~components/Icons';\nimport { IconButton } from '~components/Button/IconButton';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Spinner } from '~components/Spinner';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType } from '~utils';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport type { BladeElementRef, BladeElementRefWithValue } from '~utils/types';\nimport { dropdownComponentIds } from '~components/Dropdown/dropdownComponentIds';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\n\ntype SearchInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'helpText'\n | 'placeholder'\n | 'defaultValue'\n | 'name'\n | 'onChange'\n | 'onFocus'\n | 'onBlur'\n | 'value'\n | 'isDisabled'\n | 'autoFocus'\n | 'onSubmit'\n | 'autoCapitalize'\n | 'testID'\n | 'onClick'\n | 'size'\n> & {\n /**\n * Event handler to handle the onClick event for clear button.\n */\n onClearButtonClick?: () => void;\n\n /**\n * Decides whether to show a loading spinner for the input field.\n */\n isLoading?: boolean;\n /**\n * Toggle the visibility of the search icon.\n *\n * @default true\n */\n showSearchIcon?: boolean;\n} & StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype SearchInputPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype SearchInputPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype SearchInputProps = (SearchInputPropsWithA11yLabel | SearchInputPropsWithLabel) &\n SearchInputCommonProps;\n\n// need to do this to tell TS to infer type as SearchInput of React Native and make it believe that `ref.current.clear()` exists\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isReactNative = (_textInputRef?: any): _textInputRef is TextInputReactNative => {\n return getPlatformType() === 'react-native';\n};\n\nconst _SearchInput: React.ForwardRefRenderFunction<BladeElementRef, SearchInputProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition = 'top',\n placeholder,\n defaultValue,\n name,\n value,\n onChange,\n onClick,\n onFocus,\n onBlur,\n onSubmit,\n isDisabled,\n helpText,\n onClearButtonClick,\n isLoading,\n autoCapitalize,\n autoFocus,\n testID,\n size = 'medium',\n showSearchIcon = true,\n ...styledProps\n },\n ref,\n): ReactElement => {\n const textInputRef = React.useRef<BladeElementRefWithValue>(null);\n const mergedRef = useMergeRefs(ref, textInputRef);\n const [shouldShowClearButton, setShouldShowClearButton] = useState(false);\n const {\n triggererWrapperRef,\n onTriggerKeydown,\n onTriggerClick,\n dropdownTriggerer,\n } = useDropdown();\n const isInsideDropdown = dropdownTriggerer === 'SearchInput';\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(defaultValue ?? value));\n }, [defaultValue, value]);\n\n const renderInteractionElement = (): ReactNode => {\n if (isLoading) {\n return <Spinner accessibilityLabel=\"Loading Content\" color=\"primary\" />;\n }\n\n if (shouldShowClearButton) {\n return (\n <IconButton\n size=\"medium\"\n icon={CloseIcon}\n onClick={() => {\n if (isEmpty(value) && textInputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (isReactNative(textInputRef.current)) {\n textInputRef.current.clear();\n textInputRef.current.focus();\n } else if (textInputRef.current instanceof HTMLInputElement) {\n textInputRef.current.value = '';\n textInputRef.current.focus();\n }\n }\n\n // if the input field is controlled just call the click handler and the value change shall be left upto the consumer\n onClearButtonClick?.();\n textInputRef?.current?.focus();\n setShouldShowClearButton(false);\n }}\n isDisabled={isDisabled}\n accessibilityLabel=\"Clear Input Content\"\n />\n );\n }\n\n return null;\n };\n\n return (\n <BaseBox position=\"relative\">\n <BaseInput\n id=\"searchinput\"\n componentName={MetaConstants.SearchInput}\n ref={mergedRef}\n isDropdownTrigger={true}\n setInputWrapperRef={\n isInsideDropdown\n ? (wrapperNode) => {\n triggererWrapperRef.current = wrapperNode;\n }\n : undefined\n }\n label={label as string}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n placeholder={placeholder}\n defaultValue={defaultValue}\n value={value}\n name={name}\n onKeyDown={isInsideDropdown ? onTriggerKeydown : undefined}\n onChange={({ name, value }) => {\n if (value?.length) {\n // show the clear button when the user starts typing in\n setShouldShowClearButton(true);\n }\n\n if (shouldShowClearButton && !value?.length) {\n // hide the clear button when the input field is empty\n setShouldShowClearButton(false);\n }\n\n onChange?.({ name, value });\n }}\n onClick={(e) => {\n if (isDisabled) return;\n if (isInsideDropdown) {\n onTriggerClick();\n }\n onClick?.(e);\n }}\n onFocus={onFocus}\n onBlur={onBlur}\n onSubmit={onSubmit}\n isDisabled={isDisabled}\n leadingIcon={showSearchIcon ? SearchIcon : undefined}\n trailingInteractionElement={renderInteractionElement()}\n helpText={helpText}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n testID={testID}\n {...getKeyboardAndAutocompleteProps({\n type: 'search',\n autoCapitalize,\n })}\n size={size}\n {...styledProps}\n />\n </BaseBox>\n );\n};\n\nconst SearchInput = assignWithoutSideEffects(React.forwardRef(_SearchInput), {\n displayName: 'SearchInput',\n componentId: dropdownComponentIds.triggers.SearchInput,\n});\n\nexport type { SearchInputProps };\nexport { SearchInput };\n"],"names":["isReactNative","_textInputRef","getPlatformType","_SearchInput","_ref","ref","label","accessibilityLabel","_ref$labelPosition","labelPosition","placeholder","defaultValue","name","value","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","helpText","onClearButtonClick","isLoading","autoCapitalize","autoFocus","testID","_ref$size","size","_ref$showSearchIcon","showSearchIcon","styledProps","_objectWithoutProperties","_excluded","textInputRef","React","useRef","mergedRef","useMergeRefs","_useState","useState","_useState2","_slicedToArray","shouldShowClearButton","setShouldShowClearButton","_useDropdown","useDropdown","triggererWrapperRef","onTriggerKeydown","onTriggerClick","dropdownTriggerer","isInsideDropdown","useEffect","Boolean","renderInteractionElement","_jsx","Spinner","color","IconButton","icon","CloseIcon","_textInputRef$current","isEmpty","current","clear","focus","HTMLInputElement","BaseBox","position","children","BaseInput","_objectSpread","id","componentName","MetaConstants","SearchInput","isDropdownTrigger","setInputWrapperRef","wrapperNode","undefined","hideLabelText","onKeyDown","_ref2","length","e","leadingIcon","SearchIcon","trailingInteractionElement","getKeyboardAndAutocompleteProps","type","assignWithoutSideEffects","forwardRef","displayName","componentId","dropdownComponentIds","triggers"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyFA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,aAAmB,EAA4C;AACpF,EAAA,OAAOC,eAAe,EAAE,KAAK,cAAc,CAAA;AAC7C,CAAC,CAAA;AAED,IAAMC,YAA+E,GAAG,SAAlFA,YAA+EA,CAAAC,IAAA,EAyBnFC,GAAG,EACc;AAAA,EAAA,IAxBfC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,kBAAkB,GAAAH,IAAA,CAAlBG,kBAAkB;IAAAC,kBAAA,GAAAJ,IAAA,CAClBK,aAAa;AAAbA,IAAAA,aAAa,GAAAD,kBAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,kBAAA;IACrBE,WAAW,GAAAN,IAAA,CAAXM,WAAW;IACXC,YAAY,GAAAP,IAAA,CAAZO,YAAY;IACZC,IAAI,GAAAR,IAAA,CAAJQ,IAAI;IACJC,KAAK,GAAAT,IAAA,CAALS,KAAK;IACLC,SAAQ,GAAAV,IAAA,CAARU,QAAQ;IACRC,QAAO,GAAAX,IAAA,CAAPW,OAAO;IACPC,OAAO,GAAAZ,IAAA,CAAPY,OAAO;IACPC,MAAM,GAAAb,IAAA,CAANa,MAAM;IACNC,QAAQ,GAAAd,IAAA,CAARc,QAAQ;IACRC,UAAU,GAAAf,IAAA,CAAVe,UAAU;IACVC,QAAQ,GAAAhB,IAAA,CAARgB,QAAQ;IACRC,kBAAkB,GAAAjB,IAAA,CAAlB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rDQ,0BAA0B,EAAEjC,wBAAwB,EAAG;AACvDjC,MAAAA,QAAQ,EAAEA,QAAAA;AACV;AAAA;AACAI,MAAAA,SAAS,EAAEA,SAAU;AACrBC,MAAAA,MAAM,EAAEA,MAAAA;AAAO,KAAA,EACX8D,+BAA+B,CAAC;AAClCC,MAAAA,IAAI,EAAE,QAAQ;AACdjE,MAAAA,cAAc,EAAdA,cAAAA;AACF,KAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AACFI,MAAAA,IAAI,EAAEA,IAAAA;AAAK,KAAA,EACPG,WAAW,CAChB,CAAA;AAAC,GACK,CAAC,CAAA;AAEd,CAAC,CAAA;AAEK4C,IAAAA,WAAW,gBAAGe,wBAAwB,eAACvD,cAAK,CAACwD,UAAU,CAACvF,YAAY,CAAC,EAAE;AAC3EwF,EAAAA,WAAW,EAAE,aAAa;AAC1BC,EAAAA,WAAW,EAAEC,oBAAoB,CAACC,QAAQ,CAACpB,WAAAA;AAC7C,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"SearchInput.js","sources":["../../../../../../../src/components/Input/SearchInput/SearchInput.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport type { ReactElement, ReactNode } from 'react';\nimport type { TextInput as TextInputReactNative } from 'react-native';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { getKeyboardAndAutocompleteProps } from '../BaseInput/utils';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport { CloseIcon, SearchIcon } from '~components/Icons';\nimport { IconButton } from '~components/Button/IconButton';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Spinner } from '~components/Spinner';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType } from '~utils';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport type {\n BladeElementRef,\n BladeElementRefWithValue,\n DataAnalyticsAttribute,\n} from '~utils/types';\nimport { dropdownComponentIds } from '~components/Dropdown/dropdownComponentIds';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\n\ntype SearchInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'helpText'\n | 'placeholder'\n | 'defaultValue'\n | 'name'\n | 'onChange'\n | 'onFocus'\n | 'onBlur'\n | 'value'\n | 'isDisabled'\n | 'autoFocus'\n | 'onSubmit'\n | 'autoCapitalize'\n | 'testID'\n | 'onClick'\n | 'size'\n | keyof DataAnalyticsAttribute\n> & {\n /**\n * Event handler to handle the onClick event for clear button.\n */\n onClearButtonClick?: () => void;\n\n /**\n * Decides whether to show a loading spinner for the input field.\n */\n isLoading?: boolean;\n /**\n * Toggle the visibility of the search icon.\n *\n * @default true\n */\n showSearchIcon?: boolean;\n} & StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype SearchInputPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype SearchInputPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype SearchInputProps = (SearchInputPropsWithA11yLabel | SearchInputPropsWithLabel) &\n SearchInputCommonProps;\n\n// need to do this to tell TS to infer type as SearchInput of React Native and make it believe that `ref.current.clear()` exists\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isReactNative = (_textInputRef?: any): _textInputRef is TextInputReactNative => {\n return getPlatformType() === 'react-native';\n};\n\nconst _SearchInput: React.ForwardRefRenderFunction<BladeElementRef, SearchInputProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition = 'top',\n placeholder,\n defaultValue,\n name,\n value,\n onChange,\n onClick,\n onFocus,\n onBlur,\n onSubmit,\n isDisabled,\n helpText,\n onClearButtonClick,\n isLoading,\n autoCapitalize,\n autoFocus,\n testID,\n size = 'medium',\n showSearchIcon = true,\n ...rest\n },\n ref,\n): ReactElement => {\n const textInputRef = React.useRef<BladeElementRefWithValue>(null);\n const mergedRef = useMergeRefs(ref, textInputRef);\n const [shouldShowClearButton, setShouldShowClearButton] = useState(false);\n const {\n triggererWrapperRef,\n onTriggerKeydown,\n onTriggerClick,\n dropdownTriggerer,\n } = useDropdown();\n const isInsideDropdown = dropdownTriggerer === 'SearchInput';\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(defaultValue ?? value));\n }, [defaultValue, value]);\n\n const renderInteractionElement = (): ReactNode => {\n if (isLoading) {\n return <Spinner accessibilityLabel=\"Loading Content\" color=\"primary\" />;\n }\n\n if (shouldShowClearButton) {\n return (\n <IconButton\n size=\"medium\"\n icon={CloseIcon}\n onClick={() => {\n if (isEmpty(value) && textInputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (isReactNative(textInputRef.current)) {\n textInputRef.current.clear();\n textInputRef.current.focus();\n } else if (textInputRef.current instanceof HTMLInputElement) {\n textInputRef.current.value = '';\n textInputRef.current.focus();\n }\n }\n\n // if the input field is controlled just call the click handler and the value change shall be left upto the consumer\n onClearButtonClick?.();\n textInputRef?.current?.focus();\n setShouldShowClearButton(false);\n }}\n isDisabled={isDisabled}\n accessibilityLabel=\"Clear Input Content\"\n />\n );\n }\n\n return null;\n };\n\n return (\n <BaseBox position=\"relative\">\n <BaseInput\n id=\"searchinput\"\n componentName={MetaConstants.SearchInput}\n ref={mergedRef}\n isDropdownTrigger={true}\n setInputWrapperRef={\n isInsideDropdown\n ? (wrapperNode) => {\n triggererWrapperRef.current = wrapperNode;\n }\n : undefined\n }\n label={label as string}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n placeholder={placeholder}\n defaultValue={defaultValue}\n value={value}\n name={name}\n onKeyDown={isInsideDropdown ? onTriggerKeydown : undefined}\n onChange={({ name, value }) => {\n if (value?.length) {\n // show the clear button when the user starts typing in\n setShouldShowClearButton(true);\n }\n\n if (shouldShowClearButton && !value?.length) {\n // hide the clear button when the input field is empty\n setShouldShowClearButton(false);\n }\n\n onChange?.({ name, value });\n }}\n onClick={(e) => {\n if (isDisabled) return;\n if (isInsideDropdown) {\n onTriggerClick();\n }\n onClick?.(e);\n }}\n onFocus={onFocus}\n onBlur={onBlur}\n onSubmit={onSubmit}\n isDisabled={isDisabled}\n leadingIcon={showSearchIcon ? SearchIcon : undefined}\n trailingInteractionElement={renderInteractionElement()}\n helpText={helpText}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n testID={testID}\n {...getKeyboardAndAutocompleteProps({\n type: 'search',\n autoCapitalize,\n })}\n size={size}\n {...rest}\n />\n </BaseBox>\n );\n};\n\nconst SearchInput = assignWithoutSideEffects(React.forwardRef(_SearchInput), {\n displayName: 'SearchInput',\n componentId: dropdownComponentIds.triggers.SearchInput,\n});\n\nexport type { SearchInputProps };\nexport { SearchInput };\n"],"names":["isReactNative","_textInputRef","getPlatformType","_SearchInput","_ref","ref","label","accessibilityLabel","_ref$labelPosition","labelPosition","placeholder","defaultValue","name","value","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","helpText","onClearButtonClick","isLoading","autoCapitalize","autoFocus","testID","_ref$size","size","_ref$showSearchIcon","showSearchIcon","rest","_objectWithoutProperties","_excluded","textInputRef","React","useRef","mergedRef","useMergeRefs","_useState","useState","_useState2","_slicedToArray","shouldShowClearButton","setShouldShowClearButton","_useDropdown","useDropdown","triggererWrapperRef","onTriggerKeydown","onTriggerClick","dropdownTriggerer","isInsideDropdown","useEffect","Boolean","renderInteractionElement","_jsx","Spinner","color","IconButton","icon","CloseIcon","_textInputRef$current","isEmpty","current","clear","focus","HTMLInputElement","BaseBox","position","children","BaseInput","_objectSpread","id","componentName","MetaConstants","SearchInput","isDropdownTrigger","setInputWrapperRef","wrapperNode","undefined","hideLabelText","onKeyDown","_ref2","length","e","leadingIcon","SearchIcon","trailingInteractionElement","getKeyboardAndAutocompleteProps","type","assignWithoutSideEffects","forwardRef","displayName","componentId","dropdownComponentIds","triggers"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8FA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,aAAmB,EAA4C;AACpF,EAAA,OAAOC,eAAe,EAAE,KAAK,cAAc,CAAA;AAC7C,CAAC,CAAA;AAED,IAAMC,YAA+E,GAAG,SAAlFA,YAA+EA,CAAAC,IAAA,EAyBnFC,GAAG,EACc;AAAA,EAAA,IAxBfC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,kBAAkB,GAAAH,IAAA,CAAlBG,kBAAkB;IAAAC,kBAAA,GAAAJ,IAAA,CAClBK,aAAa;AAAbA,IAAAA,aAAa,GAAAD,kBAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,kBAAA;IACrBE,WAAW,GAAAN,IAAA,CAAXM,WAAW;IACXC,YAAY,GAAAP,IAAA,CAAZO,YAAY;IACZC,IAAI,GAAAR,IAAA,CAAJQ,IAAI;IACJC,KAAK,GAAAT,IAAA,CAALS,KAAK;IACLC,SAAQ,GAAAV,IAAA,CAARU,QAAQ;IACRC,QAAO,GAAAX,IAAA,CAAPW,OAAO;IACPC,OAAO,GAAAZ,IAAA,CAAPY,OAAO;IACPC,MAAM,GAAAb,IAAA,CAANa,MAAM;IACNC,QAAQ,GAAAd,IAAA,CAARc,QAAQ;IACRC,UAAU,GAAAf,IAAA,CAAVe,UAAU;IACVC,QAAQ,GAAAhB,IAAA,CAARgB,QAAQ;IACRC,kBAAkB,GAAAjB,IAAA,CAAlBiB,kBAAkB;IAClBC,SAAS,GAAAlB,IAAA,CAATkB,SAAS;IACTC,cAAc,GAAAnB,IAAA,CAAdmB,cAAc;IACdC,SAAS,GAAApB,IAAA,CAAToB,SAAS;IACTC,MAAM,GAAArB,I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AAO,KAAA,EACX8D,+BAA+B,CAAC;AAClCC,MAAAA,IAAI,EAAE,QAAQ;AACdjE,MAAAA,cAAc,EAAdA,cAAAA;AACF,KAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AACFI,MAAAA,IAAI,EAAEA,IAAAA;AAAK,KAAA,EACPG,IAAI,CACT,CAAA;AAAC,GACK,CAAC,CAAA;AAEd,CAAC,CAAA;AAEK4C,IAAAA,WAAW,gBAAGe,wBAAwB,eAACvD,cAAK,CAACwD,UAAU,CAACvF,YAAY,CAAC,EAAE;AAC3EwF,EAAAA,WAAW,EAAE,aAAa;AAC1BC,EAAAA,WAAW,EAAEC,oBAAoB,CAACC,QAAQ,CAACpB,WAAAA;AAC7C,CAAC;;;;"}
|
|
@@ -63,7 +63,7 @@ var _TextArea = function _TextArea(_ref, ref) {
|
|
|
63
63
|
isTaggedInput = _ref.isTaggedInput,
|
|
64
64
|
tags = _ref.tags,
|
|
65
65
|
onTagChange = _ref.onTagChange,
|
|
66
|
-
|
|
66
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
67
67
|
var inputRef = React__default.useRef(null);
|
|
68
68
|
var mergedRef = useMergeRefs(ref, inputRef);
|
|
69
69
|
var _React$useState = React__default.useState(autoFocus !== null && autoFocus !== void 0 ? autoFocus : false),
|
|
@@ -201,7 +201,7 @@ var _TextArea = function _TextArea(_ref, ref) {
|
|
|
201
201
|
},
|
|
202
202
|
testID: testID,
|
|
203
203
|
size: size
|
|
204
|
-
},
|
|
204
|
+
}, rest));
|
|
205
205
|
};
|
|
206
206
|
var TextArea = /*#__PURE__*/assignWithoutSideEffects( /*#__PURE__*/React__default.forwardRef(_TextArea), {
|
|
207
207
|
displayName: 'TextArea'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.js","sources":["../../../../../../../src/components/Input/TextArea/TextArea.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/no-autofocus */\nimport React from 'react';\nimport type { TextInput as TextInputReactNative } from 'react-native';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport type { TaggedInputProps } from '../BaseInput/useTaggedInput';\nimport { useTaggedInput } from '../BaseInput/useTaggedInput';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport { CloseIcon } from '~components/Icons';\nimport { IconButton } from '~components/Button/IconButton';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport { CharacterCounter } from '~components/Form/CharacterCounter';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType } from '~utils';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport type { BladeElementRef, BladeElementRefWithValue } from '~utils/types';\nimport { hintMarginTop } from '~components/Form/formTokens';\n\ntype TextAreaCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'necessityIndicator'\n | 'validationState'\n | 'helpText'\n | 'errorText'\n | 'successText'\n | 'placeholder'\n | 'defaultValue'\n | 'name'\n | 'onChange'\n | 'onFocus'\n | 'onBlur'\n | 'onSubmit'\n | 'value'\n | 'isDisabled'\n | 'isRequired'\n | 'maxCharacters'\n | 'autoFocus'\n | 'numberOfLines'\n | 'testID'\n | 'size'\n> & {\n /**\n * Decides whether to render a clear icon button\n */\n showClearButton?: boolean;\n /**\n * Event handler to handle the onClick event for clear button. Used when `showClearButton` is `true`\n */\n onClearButtonClick?: () => void;\n} & TaggedInputProps &\n StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype TextAreaPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype TextAreaPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype TextAreaProps = (TextAreaPropsWithA11yLabel | TextAreaPropsWithLabel) & TextAreaCommonProps;\n\n// need to do this to tell TS to infer type as TextInput of React Native and make it believe that `ref.current.clear()` exists\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isReactNative = (_textInputRef: any): _textInputRef is TextInputReactNative => {\n return getPlatformType() === 'react-native';\n};\n\nconst _TextArea: React.ForwardRefRenderFunction<BladeElementRef, TextAreaProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition,\n necessityIndicator,\n errorText,\n helpText,\n successText,\n validationState,\n defaultValue,\n isDisabled,\n isRequired,\n name,\n onChange,\n onFocus,\n onBlur,\n onSubmit,\n placeholder,\n value,\n maxCharacters,\n showClearButton,\n onClearButtonClick,\n autoFocus,\n numberOfLines = 2,\n testID,\n size = 'medium',\n isTaggedInput,\n tags,\n onTagChange,\n ...styledProps\n },\n ref,\n) => {\n const inputRef = React.useRef<BladeElementRefWithValue>(null);\n const mergedRef = useMergeRefs(ref, inputRef);\n const [isInputFocussed, setIsInputFocussed] = React.useState(autoFocus ?? false);\n const {\n activeTagIndex,\n setActiveTagIndex,\n getTags,\n handleTaggedInputKeydown,\n handleTaggedInputChange,\n handleTagsClear,\n } = useTaggedInput({\n tags,\n onTagChange,\n isDisabled,\n inputRef,\n isTaggedInput,\n name,\n value,\n onChange,\n });\n\n const [shouldShowClearButton, setShouldShowClearButton] = React.useState(false);\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(showClearButton && (value?.length || defaultValue?.length)));\n }, [showClearButton, defaultValue, value]);\n\n const renderInteractionElement = (): React.ReactNode => {\n if (shouldShowClearButton) {\n return (\n <BaseBox paddingTop=\"spacing.3\" marginTop=\"spacing.1\">\n <IconButton\n icon={CloseIcon}\n accessibilityLabel=\"Clear textarea content\"\n onClick={() => {\n if (isEmpty(value) && inputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (isReactNative(inputRef.current)) {\n inputRef.current.clear();\n inputRef.current.focus();\n } else if (inputRef.current instanceof HTMLTextAreaElement) {\n inputRef.current.value = '';\n inputRef.current.focus();\n }\n }\n handleTagsClear();\n // if the input field is controlled just call the click handler and the value change shall be left upto the consumer\n onClearButtonClick?.();\n inputRef?.current?.focus();\n setShouldShowClearButton(false);\n }}\n />\n </BaseBox>\n );\n }\n\n return null;\n };\n\n return (\n <BaseInput\n as=\"textarea\"\n id=\"textarea\"\n maxTagRows=\"multiple\"\n componentName={MetaConstants.TextArea}\n autoFocus={autoFocus}\n ref={mergedRef}\n label={label as string}\n tags={isTaggedInput ? getTags({ size }) : undefined}\n activeTagIndex={activeTagIndex}\n setActiveTagIndex={setActiveTagIndex}\n isDropdownTrigger={isTaggedInput}\n showAllTags={isInputFocussed}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n necessityIndicator={necessityIndicator}\n errorText={errorText}\n helpText={helpText}\n successText={successText}\n validationState={validationState}\n isDisabled={isDisabled}\n isRequired={isRequired}\n name={name}\n maxCharacters={maxCharacters}\n placeholder={placeholder}\n trailingInteractionElement={renderInteractionElement()}\n defaultValue={defaultValue}\n value={value}\n numberOfLines={numberOfLines}\n onChange={({ name, value }) => {\n if (showClearButton && value?.length) {\n // show the clear button when the user starts typing in\n setShouldShowClearButton(true);\n }\n\n if (shouldShowClearButton && !value?.length) {\n // hide the clear button when the input field is empty\n setShouldShowClearButton(false);\n }\n\n handleTaggedInputChange({ name, value });\n onChange?.({ name, value });\n }}\n onFocus={(e) => {\n setIsInputFocussed(true);\n onFocus?.(e);\n }}\n onBlur={(e) => {\n setIsInputFocussed(false);\n onBlur?.(e);\n }}\n onKeyDown={(e) => {\n handleTaggedInputKeydown(e);\n }}\n onSubmit={onSubmit}\n trailingFooterSlot={(value) => {\n return maxCharacters ? (\n <BaseBox marginTop={hintMarginTop[size]} marginRight=\"spacing.1\">\n <CharacterCounter currentCount={value?.length ?? 0} maxCount={maxCharacters} />\n </BaseBox>\n ) : null;\n }}\n testID={testID}\n size={size}\n {...styledProps}\n />\n );\n};\n\nconst TextArea = assignWithoutSideEffects(React.forwardRef(_TextArea), {\n displayName: 'TextArea',\n});\n\nexport type { TextAreaProps };\nexport { TextArea };\n"],"names":["isReactNative","_textInputRef","getPlatformType","_TextArea","_ref","ref","label","accessibilityLabel","labelPosition","necessityIndicator","errorText","helpText","successText","validationState","defaultValue","isDisabled","isRequired","name","onChange","onFocus","onBlur","onSubmit","placeholder","value","maxCharacters","showClearButton","onClearButtonClick","autoFocus","_ref$numberOfLines","numberOfLines","testID","_ref$size","size","isTaggedInput","tags","onTagChange","styledProps","_objectWithoutProperties","_excluded","inputRef","React","useRef","mergedRef","useMergeRefs","_React$useState","useState","_React$useState2","_slicedToArray","isInputFocussed","setIsInputFocussed","_useTaggedInput","useTaggedInput","activeTagIndex","setActiveTagIndex","getTags","handleTaggedInputKeydown","handleTaggedInputChange","handleTagsClear","_React$useState3","_React$useState4","shouldShowClearButton","setShouldShowClearButton","useEffect","Boolean","length","renderInteractionElement","_jsx","BaseBox","paddingTop","marginTop","children","IconButton","icon","CloseIcon","onClick","_inputRef$current","isEmpty","current","clear","focus","HTMLTextAreaElement","BaseInput","_objectSpread","as","id","maxTagRows","componentName","MetaConstants","TextArea","undefined","isDropdownTrigger","showAllTags","hideLabelText","trailingInteractionElement","_ref2","e","onKeyDown","trailingFooterSlot","_value$length","hintMarginTop","marginRight","CharacterCounter","currentCount","maxCount","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuFA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,aAAkB,EAA4C;AACnF,EAAA,OAAOC,eAAe,EAAE,KAAK,cAAc,CAAA;AAC7C,CAAC,CAAA;AAED,IAAMC,SAAyE,GAAG,SAA5EA,SAAyEA,CAAAC,IAAA,EAgC7EC,GAAG,EACA;AAAA,EAAA,IA/BDC,KA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,GAAA,CAACmC,gBAAgB,EAAA;AAACC,UAAAA,YAAY,EAAAJ,CAAAA,aAAA,GAAE3E,KAAK,aAALA,KAAK,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAALA,KAAK,CAAEyC,MAAM,MAAAkC,IAAAA,IAAAA,aAAA,KAAAA,KAAAA,CAAAA,GAAAA,aAAA,GAAI,CAAE;AAACK,UAAAA,QAAQ,EAAE/E,aAAAA;SAAgB,CAAA;OACvE,CAAC,GACR,IAAI,CAAA;KACR;AACFM,IAAAA,MAAM,EAAEA,MAAO;AACfE,IAAAA,IAAI,EAAEA,IAAAA;GACFI,EAAAA,WAAW,CAChB,CAAC,CAAA;AAEN,CAAC,CAAA;AAEKoD,IAAAA,QAAQ,gBAAGgB,wBAAwB,eAAChE,cAAK,CAACiE,UAAU,CAACtG,SAAS,CAAC,EAAE;AACrEuG,EAAAA,WAAW,EAAE,UAAA;AACf,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"TextArea.js","sources":["../../../../../../../src/components/Input/TextArea/TextArea.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/no-autofocus */\nimport React from 'react';\nimport type { TextInput as TextInputReactNative } from 'react-native';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport type { TaggedInputProps } from '../BaseInput/useTaggedInput';\nimport { useTaggedInput } from '../BaseInput/useTaggedInput';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport { CloseIcon } from '~components/Icons';\nimport { IconButton } from '~components/Button/IconButton';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport { CharacterCounter } from '~components/Form/CharacterCounter';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType } from '~utils';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport type {\n BladeElementRef,\n BladeElementRefWithValue,\n DataAnalyticsAttribute,\n} from '~utils/types';\nimport { hintMarginTop } from '~components/Form/formTokens';\n\ntype TextAreaCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'necessityIndicator'\n | 'validationState'\n | 'helpText'\n | 'errorText'\n | 'successText'\n | 'placeholder'\n | 'defaultValue'\n | 'name'\n | 'onChange'\n | 'onFocus'\n | 'onBlur'\n | 'onSubmit'\n | 'value'\n | 'isDisabled'\n | 'isRequired'\n | 'maxCharacters'\n | 'autoFocus'\n | 'numberOfLines'\n | 'testID'\n | 'size'\n | keyof DataAnalyticsAttribute\n> & {\n /**\n * Decides whether to render a clear icon button\n */\n showClearButton?: boolean;\n /**\n * Event handler to handle the onClick event for clear button. Used when `showClearButton` is `true`\n */\n onClearButtonClick?: () => void;\n} & TaggedInputProps &\n StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype TextAreaPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype TextAreaPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype TextAreaProps = (TextAreaPropsWithA11yLabel | TextAreaPropsWithLabel) & TextAreaCommonProps;\n\n// need to do this to tell TS to infer type as TextInput of React Native and make it believe that `ref.current.clear()` exists\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isReactNative = (_textInputRef: any): _textInputRef is TextInputReactNative => {\n return getPlatformType() === 'react-native';\n};\n\nconst _TextArea: React.ForwardRefRenderFunction<BladeElementRef, TextAreaProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition,\n necessityIndicator,\n errorText,\n helpText,\n successText,\n validationState,\n defaultValue,\n isDisabled,\n isRequired,\n name,\n onChange,\n onFocus,\n onBlur,\n onSubmit,\n placeholder,\n value,\n maxCharacters,\n showClearButton,\n onClearButtonClick,\n autoFocus,\n numberOfLines = 2,\n testID,\n size = 'medium',\n isTaggedInput,\n tags,\n onTagChange,\n ...rest\n },\n ref,\n) => {\n const inputRef = React.useRef<BladeElementRefWithValue>(null);\n const mergedRef = useMergeRefs(ref, inputRef);\n const [isInputFocussed, setIsInputFocussed] = React.useState(autoFocus ?? false);\n const {\n activeTagIndex,\n setActiveTagIndex,\n getTags,\n handleTaggedInputKeydown,\n handleTaggedInputChange,\n handleTagsClear,\n } = useTaggedInput({\n tags,\n onTagChange,\n isDisabled,\n inputRef,\n isTaggedInput,\n name,\n value,\n onChange,\n });\n\n const [shouldShowClearButton, setShouldShowClearButton] = React.useState(false);\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(showClearButton && (value?.length || defaultValue?.length)));\n }, [showClearButton, defaultValue, value]);\n\n const renderInteractionElement = (): React.ReactNode => {\n if (shouldShowClearButton) {\n return (\n <BaseBox paddingTop=\"spacing.3\" marginTop=\"spacing.1\">\n <IconButton\n icon={CloseIcon}\n accessibilityLabel=\"Clear textarea content\"\n onClick={() => {\n if (isEmpty(value) && inputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (isReactNative(inputRef.current)) {\n inputRef.current.clear();\n inputRef.current.focus();\n } else if (inputRef.current instanceof HTMLTextAreaElement) {\n inputRef.current.value = '';\n inputRef.current.focus();\n }\n }\n handleTagsClear();\n // if the input field is controlled just call the click handler and the value change shall be left upto the consumer\n onClearButtonClick?.();\n inputRef?.current?.focus();\n setShouldShowClearButton(false);\n }}\n />\n </BaseBox>\n );\n }\n\n return null;\n };\n\n return (\n <BaseInput\n as=\"textarea\"\n id=\"textarea\"\n maxTagRows=\"multiple\"\n componentName={MetaConstants.TextArea}\n autoFocus={autoFocus}\n ref={mergedRef}\n label={label as string}\n tags={isTaggedInput ? getTags({ size }) : undefined}\n activeTagIndex={activeTagIndex}\n setActiveTagIndex={setActiveTagIndex}\n isDropdownTrigger={isTaggedInput}\n showAllTags={isInputFocussed}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n necessityIndicator={necessityIndicator}\n errorText={errorText}\n helpText={helpText}\n successText={successText}\n validationState={validationState}\n isDisabled={isDisabled}\n isRequired={isRequired}\n name={name}\n maxCharacters={maxCharacters}\n placeholder={placeholder}\n trailingInteractionElement={renderInteractionElement()}\n defaultValue={defaultValue}\n value={value}\n numberOfLines={numberOfLines}\n onChange={({ name, value }) => {\n if (showClearButton && value?.length) {\n // show the clear button when the user starts typing in\n setShouldShowClearButton(true);\n }\n\n if (shouldShowClearButton && !value?.length) {\n // hide the clear button when the input field is empty\n setShouldShowClearButton(false);\n }\n\n handleTaggedInputChange({ name, value });\n onChange?.({ name, value });\n }}\n onFocus={(e) => {\n setIsInputFocussed(true);\n onFocus?.(e);\n }}\n onBlur={(e) => {\n setIsInputFocussed(false);\n onBlur?.(e);\n }}\n onKeyDown={(e) => {\n handleTaggedInputKeydown(e);\n }}\n onSubmit={onSubmit}\n trailingFooterSlot={(value) => {\n return maxCharacters ? (\n <BaseBox marginTop={hintMarginTop[size]} marginRight=\"spacing.1\">\n <CharacterCounter currentCount={value?.length ?? 0} maxCount={maxCharacters} />\n </BaseBox>\n ) : null;\n }}\n testID={testID}\n size={size}\n {...rest}\n />\n );\n};\n\nconst TextArea = assignWithoutSideEffects(React.forwardRef(_TextArea), {\n displayName: 'TextArea',\n});\n\nexport type { TextAreaProps };\nexport { TextArea };\n"],"names":["isReactNative","_textInputRef","getPlatformType","_TextArea","_ref","ref","label","accessibilityLabel","labelPosition","necessityIndicator","errorText","helpText","successText","validationState","defaultValue","isDisabled","isRequired","name","onChange","onFocus","onBlur","onSubmit","placeholder","value","maxCharacters","showClearButton","onClearButtonClick","autoFocus","_ref$numberOfLines","numberOfLines","testID","_ref$size","size","isTaggedInput","tags","onTagChange","rest","_objectWithoutProperties","_excluded","inputRef","React","useRef","mergedRef","useMergeRefs","_React$useState","useState","_React$useState2","_slicedToArray","isInputFocussed","setIsInputFocussed","_useTaggedInput","useTaggedInput","activeTagIndex","setActiveTagIndex","getTags","handleTaggedInputKeydown","handleTaggedInputChange","handleTagsClear","_React$useState3","_React$useState4","shouldShowClearButton","setShouldShowClearButton","useEffect","Boolean","length","renderInteractionElement","_jsx","BaseBox","paddingTop","marginTop","children","IconButton","icon","CloseIcon","onClick","_inputRef$current","isEmpty","current","clear","focus","HTMLTextAreaElement","BaseInput","_objectSpread","as","id","maxTagRows","componentName","MetaConstants","TextArea","undefined","isDropdownTrigger","showAllTags","hideLabelText","trailingInteractionElement","_ref2","e","onKeyDown","trailingFooterSlot","_value$length","hintMarginTop","marginRight","CharacterCounter","currentCount","maxCount","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4FA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,aAAkB,EAA4C;AACnF,EAAA,OAAOC,eAAe,EAAE,KAAK,cAAc,CAAA;AAC7C,CAAC,CAAA;AAED,IAAMC,SAAyE,GAAG,SAA5EA,SAAyEA,CAAAC,IAAA,EAgC7EC,GAAG,EACA;AAAA,EAAA,IA/BDC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,kBAAkB,GAAAH,IAAA,CAAlBG,kBAAkB;IAClBC,aAAa,GAAAJ,IAAA,CAAbI,aAAa;IACbC,kBAAkB,GAAAL,IAAA,CAAlBK,kBAAkB;IAClBC,SAAS,GAAAN,IAAA,CAATM,SAAS;IACTC,QAAQ,GAAAP,IAAA,CAARO,QAAQ;IACRC,WAAW,GAAAR,IAAA,CAAXQ,WAAW;IACXC,eAAe,GAAAT,IAAA,CAAfS,eAAe;IACfC,YAAY,GAAAV,IAAA,CAAZU,YAAY;IACZC,UAAU,GAAAX,IAAA,CAAVW,UAAU;IACVC,UAAU,GAAAZ,IAAA,CAAVY,UAAU;IACVC,IAAI,GAAAb,IAAA,CAA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BAAGgB,wBAAwB,eAAChE,cAAK,CAACiE,UAAU,CAACtG,SAAS,CAAC,EAAE;AACrEuG,EAAAA,WAAW,EAAE,UAAA;AACf,CAAC;;;;"}
|
|
@@ -77,7 +77,7 @@ var _TextInput = function _TextInput(_ref, ref) {
|
|
|
77
77
|
isTaggedInput = _ref.isTaggedInput,
|
|
78
78
|
tags = _ref.tags,
|
|
79
79
|
onTagChange = _ref.onTagChange,
|
|
80
|
-
|
|
80
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
81
81
|
var textInputRef = React__default.useRef(null);
|
|
82
82
|
var mergedRef = useMergeRefs(ref, textInputRef);
|
|
83
83
|
var _useState = useState(false),
|
|
@@ -231,7 +231,7 @@ var _TextInput = function _TextInput(_ref, ref) {
|
|
|
231
231
|
autoCapitalize: autoCapitalize
|
|
232
232
|
})), {}, {
|
|
233
233
|
size: size
|
|
234
|
-
},
|
|
234
|
+
}, rest));
|
|
235
235
|
};
|
|
236
236
|
var TextInput = /*#__PURE__*/assignWithoutSideEffects( /*#__PURE__*/React__default.forwardRef(_TextInput), {
|
|
237
237
|
displayName: 'TextInput'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.js","sources":["../../../../../../../src/components/Input/TextInput/TextInput.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport type { ReactElement, ReactNode } from 'react';\nimport type { TextInput as TextInputReactNative } from 'react-native';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { getKeyboardAndAutocompleteProps } from '../BaseInput/utils';\nimport type { TaggedInputProps } from '../BaseInput/useTaggedInput';\nimport { useTaggedInput } from '../BaseInput/useTaggedInput';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport type { IconComponent } from '~components/Icons';\nimport { CloseIcon } from '~components/Icons';\nimport { IconButton } from '~components/Button/IconButton';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport { CharacterCounter } from '~components/Form/CharacterCounter';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Spinner } from '~components/Spinner';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType } from '~utils';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport type { BladeElementRef, BladeElementRefWithValue } from '~utils/types';\nimport { hintMarginTop } from '~components/Form/formTokens';\n\n// Users should use PasswordInput for input type password\ntype Type = Exclude<BaseInputProps['type'], 'password'>;\n\ntype TextInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'necessityIndicator'\n | 'validationState'\n | 'helpText'\n | 'errorText'\n | 'successText'\n | 'placeholder'\n | 'defaultValue'\n | 'name'\n | 'onChange'\n | 'onFocus'\n | 'onBlur'\n | 'value'\n | 'isDisabled'\n | 'isRequired'\n | 'prefix'\n | 'suffix'\n | 'maxCharacters'\n | 'autoFocus'\n | 'keyboardReturnKeyType'\n | 'autoCompleteSuggestionType'\n | 'onSubmit'\n | 'autoCapitalize'\n | 'testID'\n | 'onClick'\n | 'size'\n | 'leadingIcon'\n | 'trailingButton'\n | 'trailingIcon'\n | 'textAlign'\n> & {\n /**\n * Decides whether to render a clear icon button\n */\n showClearButton?: boolean;\n\n /**\n * Event handler to handle the onClick event for clear button. Used when `showClearButton` is `true`\n */\n onClearButtonClick?: () => void;\n\n /**\n * Decides whether to show a loading spinner for the input field.\n */\n isLoading?: boolean;\n\n /**\n * Icon that will be rendered at the beginning of the input field\n * @deprecated Use `leadingIcon` instead. This prop will be removed in the next major version.\n */\n icon?: IconComponent;\n /**\n * Type of Input Field to be rendered. Use `PasswordInput` for type `password`\n *\n *\n * **Note on number type**\n *\n * `type=\"number\"` internally uses `inputMode=\"numeric\"` instead of HTML's `type=\"number\"` which also allows text characters.\n * If you have a usecase where you only want to support number input, you can handle it on validations end.\n *\n * Check out [Why the GOV.UK Design System team changed the input type for numbers](https://technology.blog.gov.uk/2020/02/24/why-the-gov-uk-design-system-team-changed-the-input-type-for-numbers/) for reasoning\n *\n * @default text\n */\n type?: Type;\n} & TaggedInputProps &\n StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype TextInputPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype TextInputPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype TextInputProps = (TextInputPropsWithA11yLabel | TextInputPropsWithLabel) &\n TextInputCommonProps;\n\n// need to do this to tell TS to infer type as TextInput of React Native and make it believe that `ref.current.clear()` exists\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isReactNative = (_textInputRef: any): _textInputRef is TextInputReactNative => {\n return getPlatformType() === 'react-native';\n};\n\nconst _TextInput: React.ForwardRefRenderFunction<BladeElementRef, TextInputProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition = 'top',\n placeholder,\n type = 'text',\n defaultValue,\n name,\n value,\n maxCharacters,\n onChange,\n onClick,\n onFocus,\n onBlur,\n onSubmit,\n isDisabled,\n necessityIndicator,\n validationState,\n errorText,\n helpText,\n successText,\n isRequired,\n icon,\n prefix,\n showClearButton,\n onClearButtonClick,\n isLoading,\n suffix,\n autoFocus,\n keyboardReturnKeyType,\n autoCompleteSuggestionType,\n autoCapitalize,\n testID,\n size = 'medium',\n leadingIcon,\n trailingIcon,\n isTaggedInput,\n tags,\n onTagChange,\n ...styledProps\n },\n ref,\n): ReactElement => {\n const textInputRef = React.useRef<BladeElementRefWithValue>(null);\n const mergedRef = useMergeRefs(ref, textInputRef);\n const [shouldShowClearButton, setShouldShowClearButton] = useState(false);\n const [isInputFocussed, setIsInputFocussed] = useState(autoFocus ?? false);\n const {\n activeTagIndex,\n setActiveTagIndex,\n getTags,\n handleTaggedInputKeydown,\n handleTaggedInputChange,\n handleTagsClear,\n } = useTaggedInput({\n isTaggedInput,\n tags,\n onTagChange,\n isDisabled,\n onChange,\n name,\n value,\n inputRef: textInputRef,\n });\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(showClearButton && (defaultValue ?? value)));\n }, [showClearButton, defaultValue, value]);\n\n const renderInteractionElement = (): ReactNode => {\n if (isLoading) {\n return <Spinner accessibilityLabel=\"Loading Content\" color=\"primary\" />;\n }\n\n if (shouldShowClearButton) {\n return (\n <IconButton\n size=\"medium\"\n icon={CloseIcon}\n onClick={() => {\n if (isEmpty(value) && textInputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (isReactNative(textInputRef.current)) {\n textInputRef.current.clear();\n textInputRef.current.focus();\n } else if (textInputRef.current instanceof HTMLInputElement) {\n textInputRef.current.value = '';\n textInputRef.current.focus();\n }\n }\n handleTagsClear();\n // if the input field is controlled just call the click handler and the value change shall be left upto the consumer\n onClearButtonClick?.();\n textInputRef?.current?.focus();\n setShouldShowClearButton(false);\n }}\n isDisabled={isDisabled}\n accessibilityLabel=\"Clear Input Content\"\n />\n );\n }\n\n return null;\n };\n\n return (\n <BaseInput\n id=\"textinput\"\n componentName={MetaConstants.TextInput}\n ref={mergedRef}\n label={label as string}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n placeholder={placeholder}\n defaultValue={defaultValue}\n value={value}\n name={name}\n maxCharacters={maxCharacters}\n isDropdownTrigger={isTaggedInput}\n tags={isTaggedInput ? getTags({ size }) : undefined}\n showAllTags={isInputFocussed}\n maxTagRows=\"single\"\n activeTagIndex={activeTagIndex}\n setActiveTagIndex={setActiveTagIndex}\n onChange={({ name, value }) => {\n if (showClearButton && value?.length) {\n // show the clear button when the user starts typing in\n setShouldShowClearButton(true);\n }\n\n if (shouldShowClearButton && !value?.length) {\n // hide the clear button when the input field is empty\n setShouldShowClearButton(false);\n }\n\n handleTaggedInputChange({ name, value });\n onChange?.({ name, value });\n }}\n onClick={onClick}\n onFocus={(e) => {\n setIsInputFocussed(true);\n onFocus?.(e);\n }}\n onBlur={(e) => {\n setIsInputFocussed(false);\n onBlur?.(e);\n }}\n onKeyDown={(e) => {\n handleTaggedInputKeydown(e);\n }}\n onSubmit={onSubmit}\n isDisabled={isDisabled}\n necessityIndicator={necessityIndicator}\n isRequired={isRequired}\n leadingIcon={leadingIcon ?? icon}\n prefix={prefix}\n trailingInteractionElement={renderInteractionElement()}\n trailingIcon={trailingIcon}\n suffix={suffix}\n validationState={validationState}\n errorText={errorText}\n helpText={helpText}\n successText={successText}\n trailingFooterSlot={(value) => {\n return maxCharacters ? (\n <BaseBox marginTop={hintMarginTop[size]} marginRight=\"spacing.1\">\n <CharacterCounter\n currentCount={value?.length ?? 0}\n maxCount={maxCharacters}\n size={size}\n />\n </BaseBox>\n ) : null;\n }}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n testID={testID}\n {...getKeyboardAndAutocompleteProps({\n type,\n keyboardReturnKeyType,\n autoCompleteSuggestionType,\n autoCapitalize,\n })}\n size={size}\n {...styledProps}\n />\n );\n};\n\nconst TextInput = assignWithoutSideEffects(React.forwardRef(_TextInput), {\n displayName: 'TextInput',\n});\n\nexport type { TextInputProps };\nexport { TextInput };\n"],"names":["isReactNative","_textInputRef","getPlatformType","_TextInput","_ref","ref","label","accessibilityLabel","_ref$labelPosition","labelPosition","placeholder","_ref$type","type","defaultValue","name","value","maxCharacters","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","necessityIndicator","validationState","errorText","helpText","successText","isRequired","icon","prefix","showClearButton","onClearButtonClick","isLoading","suffix","autoFocus","keyboardReturnKeyType","autoCompleteSuggestionType","autoCapitalize","testID","_ref$size","size","leadingIcon","trailingIcon","isTaggedInput","tags","onTagChange","styledProps","_objectWithoutProperties","_excluded","textInputRef","React","useRef","mergedRef","useMergeRefs","_useState","useState","_useState2","_slicedToArray","shouldShowClearButton","setShouldShowClearButton","_useState3","_useState4","isInputFocussed","setIsInputFocussed","_useTaggedInput","useTaggedInput","inputRef","activeTagIndex","setActiveTagIndex","getTags","handleTaggedInputKeydown","handleTaggedInputChange","handleTagsClear","useEffect","Boolean","renderInteractionElement","_jsx","Spinner","color","IconButton","CloseIcon","_textInputRef$current","isEmpty","current","clear","focus","HTMLInputElement","BaseInput","_objectSpread","id","componentName","MetaConstants","TextInput","hideLabelText","isDropdownTrigger","undefined","showAllTags","maxTagRows","_ref2","length","e","onKeyDown","trailingInteractionElement","trailingFooterSlot","_value$length","BaseBox","marginTop","hintMarginTop","marginRight","children","CharacterCounter","currentCount","maxCount","getKeyboardAndAutocompleteProps","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiIA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,aAAkB,EAA4C;AACnF,EAAA,OAAOC,eAAe,EAAE,KAAK,cAAc,CAAA;AAC7C,CAAC,CAAA;AAED,IAAMC,UAA2E,GAAG,SAA9EA,UAA2EA,CAAAC,IAAA,EA0C/EC,GAAG,EACc;AAAA,EAAA,IAzCfC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,kBAAkB,GAAAH,IAAA,CAAlBG,kBAAkB;IAAAC,kBAAA,GAAAJ,IAAA,CAClBK,aAAa;AAAbA,IAAAA,aAAa,GAAAD,kBAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,kBAAA;IACrBE,WAAW,GAAAN,IAAA,CAAXM,WAAW;IAAAC,SAAA,GAAAP,IAAA,CACXQ,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,MAAM,GAAAA,SAAA;IACbE,YAAY,GAAAT,IAAA,CAAZS,YAAY;IACZC,IAAI,GAAAV,IAAA,CAAJU,IAAI;IACJC,KAAK,GAAAX,IAAA,CAALW,KAAK;IACL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AA,CAAC6B,OAAO,EAAA;AAACC,QAAAA,SAAS,EAAEC,aAAa,CAACnE,IAAI,CAAE;AAACoE,QAAAA,WAAW,EAAC,WAAW;QAAAC,QAAA,eAC9DjC,GAAA,CAACkC,gBAAgB,EAAA;AACfC,UAAAA,YAAY,EAAAP,CAAAA,aAAA,GAAE1F,KAAK,aAALA,KAAK,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAALA,KAAK,CAAEqF,MAAM,MAAAK,IAAAA,IAAAA,aAAA,KAAAA,KAAAA,CAAAA,GAAAA,aAAA,GAAI,CAAE;AACjCQ,UAAAA,QAAQ,EAAEjG,aAAc;AACxByB,UAAAA,IAAI,EAAEA,IAAAA;SACP,CAAA;OACM,CAAC,GACR,IAAI,CAAA;AACV,KAAA;AACA;AAAA;AACAN,IAAAA,SAAS,EAAEA,SAAU;AACrBI,IAAAA,MAAM,EAAEA,MAAAA;AAAO,GAAA,EACX2E,+BAA+B,CAAC;AAClCtG,IAAAA,IAAI,EAAJA,IAAI;AACJwB,IAAAA,qBAAqB,EAArBA,qBAAqB;AACrBC,IAAAA,0BAA0B,EAA1BA,0BAA0B;AAC1BC,IAAAA,cAAc,EAAdA,cAAAA;AACF,GAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AACFG,IAAAA,IAAI,EAAEA,IAAAA;GACFM,EAAAA,WAAW,CAChB,CAAC,CAAA;AAEN,CAAC,CAAA;AAEK8C,IAAAA,SAAS,gBAAGsB,wBAAwB,eAAChE,cAAK,CAACiE,UAAU,CAACjH,UAAU,CAAC,EAAE;AACvEkH,EAAAA,WAAW,EAAE,WAAA;AACf,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"TextInput.js","sources":["../../../../../../../src/components/Input/TextInput/TextInput.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport type { ReactElement, ReactNode } from 'react';\nimport type { TextInput as TextInputReactNative } from 'react-native';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { getKeyboardAndAutocompleteProps } from '../BaseInput/utils';\nimport type { TaggedInputProps } from '../BaseInput/useTaggedInput';\nimport { useTaggedInput } from '../BaseInput/useTaggedInput';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport type { IconComponent } from '~components/Icons';\nimport { CloseIcon } from '~components/Icons';\nimport { IconButton } from '~components/Button/IconButton';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport { CharacterCounter } from '~components/Form/CharacterCounter';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Spinner } from '~components/Spinner';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType } from '~utils';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport type {\n BladeElementRef,\n BladeElementRefWithValue,\n DataAnalyticsAttribute,\n} from '~utils/types';\nimport { hintMarginTop } from '~components/Form/formTokens';\n\n// Users should use PasswordInput for input type password\ntype Type = Exclude<BaseInputProps['type'], 'password'>;\n\ntype TextInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'necessityIndicator'\n | 'validationState'\n | 'helpText'\n | 'errorText'\n | 'successText'\n | 'placeholder'\n | 'defaultValue'\n | 'name'\n | 'onChange'\n | 'onFocus'\n | 'onBlur'\n | 'value'\n | 'isDisabled'\n | 'isRequired'\n | 'prefix'\n | 'suffix'\n | 'maxCharacters'\n | 'autoFocus'\n | 'keyboardReturnKeyType'\n | 'autoCompleteSuggestionType'\n | 'onSubmit'\n | 'autoCapitalize'\n | 'testID'\n | 'onClick'\n | 'size'\n | 'leadingIcon'\n | 'trailingButton'\n | 'trailingIcon'\n | 'textAlign'\n | keyof DataAnalyticsAttribute\n> & {\n /**\n * Decides whether to render a clear icon button\n */\n showClearButton?: boolean;\n\n /**\n * Event handler to handle the onClick event for clear button. Used when `showClearButton` is `true`\n */\n onClearButtonClick?: () => void;\n\n /**\n * Decides whether to show a loading spinner for the input field.\n */\n isLoading?: boolean;\n\n /**\n * Icon that will be rendered at the beginning of the input field\n * @deprecated Use `leadingIcon` instead. This prop will be removed in the next major version.\n */\n icon?: IconComponent;\n /**\n * Type of Input Field to be rendered. Use `PasswordInput` for type `password`\n *\n *\n * **Note on number type**\n *\n * `type=\"number\"` internally uses `inputMode=\"numeric\"` instead of HTML's `type=\"number\"` which also allows text characters.\n * If you have a usecase where you only want to support number input, you can handle it on validations end.\n *\n * Check out [Why the GOV.UK Design System team changed the input type for numbers](https://technology.blog.gov.uk/2020/02/24/why-the-gov-uk-design-system-team-changed-the-input-type-for-numbers/) for reasoning\n *\n * @default text\n */\n type?: Type;\n} & TaggedInputProps &\n StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype TextInputPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype TextInputPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype TextInputProps = (TextInputPropsWithA11yLabel | TextInputPropsWithLabel) &\n TextInputCommonProps;\n\n// need to do this to tell TS to infer type as TextInput of React Native and make it believe that `ref.current.clear()` exists\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isReactNative = (_textInputRef: any): _textInputRef is TextInputReactNative => {\n return getPlatformType() === 'react-native';\n};\n\nconst _TextInput: React.ForwardRefRenderFunction<BladeElementRef, TextInputProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition = 'top',\n placeholder,\n type = 'text',\n defaultValue,\n name,\n value,\n maxCharacters,\n onChange,\n onClick,\n onFocus,\n onBlur,\n onSubmit,\n isDisabled,\n necessityIndicator,\n validationState,\n errorText,\n helpText,\n successText,\n isRequired,\n icon,\n prefix,\n showClearButton,\n onClearButtonClick,\n isLoading,\n suffix,\n autoFocus,\n keyboardReturnKeyType,\n autoCompleteSuggestionType,\n autoCapitalize,\n testID,\n size = 'medium',\n leadingIcon,\n trailingIcon,\n isTaggedInput,\n tags,\n onTagChange,\n ...rest\n },\n ref,\n): ReactElement => {\n const textInputRef = React.useRef<BladeElementRefWithValue>(null);\n const mergedRef = useMergeRefs(ref, textInputRef);\n const [shouldShowClearButton, setShouldShowClearButton] = useState(false);\n const [isInputFocussed, setIsInputFocussed] = useState(autoFocus ?? false);\n const {\n activeTagIndex,\n setActiveTagIndex,\n getTags,\n handleTaggedInputKeydown,\n handleTaggedInputChange,\n handleTagsClear,\n } = useTaggedInput({\n isTaggedInput,\n tags,\n onTagChange,\n isDisabled,\n onChange,\n name,\n value,\n inputRef: textInputRef,\n });\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(showClearButton && (defaultValue ?? value)));\n }, [showClearButton, defaultValue, value]);\n\n const renderInteractionElement = (): ReactNode => {\n if (isLoading) {\n return <Spinner accessibilityLabel=\"Loading Content\" color=\"primary\" />;\n }\n\n if (shouldShowClearButton) {\n return (\n <IconButton\n size=\"medium\"\n icon={CloseIcon}\n onClick={() => {\n if (isEmpty(value) && textInputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (isReactNative(textInputRef.current)) {\n textInputRef.current.clear();\n textInputRef.current.focus();\n } else if (textInputRef.current instanceof HTMLInputElement) {\n textInputRef.current.value = '';\n textInputRef.current.focus();\n }\n }\n handleTagsClear();\n // if the input field is controlled just call the click handler and the value change shall be left upto the consumer\n onClearButtonClick?.();\n textInputRef?.current?.focus();\n setShouldShowClearButton(false);\n }}\n isDisabled={isDisabled}\n accessibilityLabel=\"Clear Input Content\"\n />\n );\n }\n\n return null;\n };\n\n return (\n <BaseInput\n id=\"textinput\"\n componentName={MetaConstants.TextInput}\n ref={mergedRef}\n label={label as string}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n placeholder={placeholder}\n defaultValue={defaultValue}\n value={value}\n name={name}\n maxCharacters={maxCharacters}\n isDropdownTrigger={isTaggedInput}\n tags={isTaggedInput ? getTags({ size }) : undefined}\n showAllTags={isInputFocussed}\n maxTagRows=\"single\"\n activeTagIndex={activeTagIndex}\n setActiveTagIndex={setActiveTagIndex}\n onChange={({ name, value }) => {\n if (showClearButton && value?.length) {\n // show the clear button when the user starts typing in\n setShouldShowClearButton(true);\n }\n\n if (shouldShowClearButton && !value?.length) {\n // hide the clear button when the input field is empty\n setShouldShowClearButton(false);\n }\n\n handleTaggedInputChange({ name, value });\n onChange?.({ name, value });\n }}\n onClick={onClick}\n onFocus={(e) => {\n setIsInputFocussed(true);\n onFocus?.(e);\n }}\n onBlur={(e) => {\n setIsInputFocussed(false);\n onBlur?.(e);\n }}\n onKeyDown={(e) => {\n handleTaggedInputKeydown(e);\n }}\n onSubmit={onSubmit}\n isDisabled={isDisabled}\n necessityIndicator={necessityIndicator}\n isRequired={isRequired}\n leadingIcon={leadingIcon ?? icon}\n prefix={prefix}\n trailingInteractionElement={renderInteractionElement()}\n trailingIcon={trailingIcon}\n suffix={suffix}\n validationState={validationState}\n errorText={errorText}\n helpText={helpText}\n successText={successText}\n trailingFooterSlot={(value) => {\n return maxCharacters ? (\n <BaseBox marginTop={hintMarginTop[size]} marginRight=\"spacing.1\">\n <CharacterCounter\n currentCount={value?.length ?? 0}\n maxCount={maxCharacters}\n size={size}\n />\n </BaseBox>\n ) : null;\n }}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n testID={testID}\n {...getKeyboardAndAutocompleteProps({\n type,\n keyboardReturnKeyType,\n autoCompleteSuggestionType,\n autoCapitalize,\n })}\n size={size}\n {...rest}\n />\n );\n};\n\nconst TextInput = assignWithoutSideEffects(React.forwardRef(_TextInput), {\n displayName: 'TextInput',\n});\n\nexport type { TextInputProps };\nexport { TextInput };\n"],"names":["isReactNative","_textInputRef","getPlatformType","_TextInput","_ref","ref","label","accessibilityLabel","_ref$labelPosition","labelPosition","placeholder","_ref$type","type","defaultValue","name","value","maxCharacters","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","necessityIndicator","validationState","errorText","helpText","successText","isRequired","icon","prefix","showClearButton","onClearButtonClick","isLoading","suffix","autoFocus","keyboardReturnKeyType","autoCompleteSuggestionType","autoCapitalize","testID","_ref$size","size","leadingIcon","trailingIcon","isTaggedInput","tags","onTagChange","rest","_objectWithoutProperties","_excluded","textInputRef","React","useRef","mergedRef","useMergeRefs","_useState","useState","_useState2","_slicedToArray","shouldShowClearButton","setShouldShowClearButton","_useState3","_useState4","isInputFocussed","setIsInputFocussed","_useTaggedInput","useTaggedInput","inputRef","activeTagIndex","setActiveTagIndex","getTags","handleTaggedInputKeydown","handleTaggedInputChange","handleTagsClear","useEffect","Boolean","renderInteractionElement","_jsx","Spinner","color","IconButton","CloseIcon","_textInputRef$current","isEmpty","current","clear","focus","HTMLInputElement","BaseInput","_objectSpread","id","componentName","MetaConstants","TextInput","hideLabelText","isDropdownTrigger","undefined","showAllTags","maxTagRows","_ref2","length","e","onKeyDown","trailingInteractionElement","trailingFooterSlot","_value$length","BaseBox","marginTop","hintMarginTop","marginRight","children","CharacterCounter","currentCount","maxCount","getKeyboardAndAutocompleteProps","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsIA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,aAAkB,EAA4C;AACnF,EAAA,OAAOC,eAAe,EAAE,KAAK,cAAc,CAAA;AAC7C,CAAC,CAAA;AAED,IAAMC,UAA2E,GAAG,SAA9EA,UAA2EA,CAAAC,IAAA,EA0C/EC,GAAG,EACc;AAAA,EAAA,IAzCfC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,kBAAkB,GAAAH,IAAA,CAAlBG,kBAAkB;IAAAC,kBAAA,GAAAJ,IAAA,CAClBK,aAAa;AAAbA,IAAAA,aA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BAAGsB,wBAAwB,eAAChE,cAAK,CAACiE,UAAU,CAACjH,UAAU,CAAC,EAAE;AACvEkH,EAAAA,WAAW,EAAE,WAAA;AACf,CAAC;;;;"}
|
|
@@ -14,6 +14,7 @@ import '../../Box/styledProps/index.js';
|
|
|
14
14
|
import '../../../utils/makeAccessible/index.js';
|
|
15
15
|
import '../../../utils/assignWithoutSideEffects/index.js';
|
|
16
16
|
import '../../../utils/logger/index.js';
|
|
17
|
+
import '../../../utils/makeAnalyticsAttribute/index.js';
|
|
17
18
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
18
19
|
import { getStringFromReactText } from '../../../utils/getStringChildren/getStringChildren.js';
|
|
19
20
|
import useTheme from '../../BladeProvider/useTheme.js';
|
|
@@ -23,6 +24,7 @@ import { metaAttribute } from '../../../utils/metaAttribute/metaAttribute.web.js
|
|
|
23
24
|
import { MetaConstants } from '../../../utils/metaAttribute/metaConstants.js';
|
|
24
25
|
import { makeAccessible } from '../../../utils/makeAccessible/makeAccessible.web.js';
|
|
25
26
|
import { getStyledProps } from '../../Box/styledProps/getStyledProps.js';
|
|
27
|
+
import { makeAnalyticsAttribute } from '../../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
|
|
26
28
|
import { BaseBox } from '../../Box/BaseBox/BaseBox.web.js';
|
|
27
29
|
import { BaseText } from '../../Typography/BaseText/BaseText.web.js';
|
|
28
30
|
import { assignWithoutSideEffects } from '../../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
|
|
@@ -146,7 +148,7 @@ var _BaseLink = function _BaseLink(_ref3, ref) {
|
|
|
146
148
|
onTouchEnd = _ref3.onTouchEnd,
|
|
147
149
|
onMouseDown = _ref3.onMouseDown,
|
|
148
150
|
onMouseUp = _ref3.onMouseUp,
|
|
149
|
-
|
|
151
|
+
rest = _objectWithoutProperties(_ref3, _excluded);
|
|
150
152
|
var childrenString = getStringFromReactText(children);
|
|
151
153
|
var _useInteraction = useInteraction(),
|
|
152
154
|
currentInteraction = _useInteraction.currentInteraction,
|
|
@@ -194,7 +196,7 @@ var _BaseLink = function _BaseLink(_ref3, ref) {
|
|
|
194
196
|
}
|
|
195
197
|
};
|
|
196
198
|
var asProp = isReactNative() ? undefined : 'span';
|
|
197
|
-
return /*#__PURE__*/jsx(StyledLink, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
199
|
+
return /*#__PURE__*/jsx(StyledLink, _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
198
200
|
ref: ref
|
|
199
201
|
}, metaAttribute({
|
|
200
202
|
name: MetaConstants.Link,
|
|
@@ -240,7 +242,7 @@ var _BaseLink = function _BaseLink(_ref3, ref) {
|
|
|
240
242
|
motionDuration: motionDuration,
|
|
241
243
|
motionEasing: motionEasing,
|
|
242
244
|
setCurrentInteraction: setCurrentInteraction
|
|
243
|
-
}, getStyledProps(
|
|
245
|
+
}, getStyledProps(rest)), makeAnalyticsAttribute(rest)), {}, {
|
|
244
246
|
// @ts-ignore Because we avoided exposing className to public
|
|
245
247
|
className: className,
|
|
246
248
|
style: style,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseLink.js","sources":["../../../../../../../src/components/Link/BaseLink/BaseLink.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/prefer-ts-expect-error */\n/* eslint-disable @typescript-eslint/ban-ts-comment */\nimport type { SyntheticEvent } from 'react';\nimport React from 'react';\nimport type { CSSObject } from 'styled-components';\nimport type { GestureResponderEvent } from 'react-native';\nimport StyledBaseLink from './StyledBaseLink';\nimport getIn from '~utils/lodashButBetter/get';\nimport useInteraction from '~utils/useInteraction';\nimport type { IconColors, IconComponent, IconProps } from '~components/Icons';\nimport type { Theme } from '~components/BladeProvider';\nimport { useTheme } from '~components/BladeProvider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { BaseText } from '~components/Typography/BaseText';\nimport type {\n DotNotationSpacingStringToken,\n StringChildrenType,\n TestID,\n BladeElementRef,\n} from '~utils/types';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { Platform } from '~utils';\nimport { isReactNative } from '~utils';\nimport type { DurationString, EasingString, FontSize, Typography } from '~tokens/global';\nimport type {\n BaseTextProps,\n BaseTextSizes,\n TextColors,\n} from '~components/Typography/BaseText/types';\nimport { getStringFromReactText } from '~src/utils/getStringChildren';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { AccessibilityProps } from '~utils/makeAccessible';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport type { BladeCommonEvents } from '~components/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { throwBladeError } from '~utils/logger';\nimport type { ActionStates } from '~utils/useInteraction';\n\ntype BaseLinkCommonProps = {\n color?: 'primary' | 'white' | 'positive' | 'negative' | 'notice' | 'information' | 'neutral';\n icon?: IconComponent;\n iconPosition?: 'left' | 'right';\n onClick?: (event: SyntheticEvent) => void;\n onBlur?: Platform.Select<{\n native: (event: GestureResponderEvent) => void;\n web: (event: React.FocusEvent<HTMLButtonElement>) => void;\n }>;\n onMouseLeave?: Platform.Select<{\n native: (event: GestureResponderEvent) => void;\n web: (event: React.MouseEvent<HTMLButtonElement>) => void;\n }>;\n onKeyDown?: Platform.Select<{\n native: (event: GestureResponderEvent) => void;\n web: (event: React.KeyboardEvent<HTMLButtonElement>) => void;\n }>;\n accessibilityProps?: Partial<AccessibilityProps>;\n\n /**\n * Sets the size of the link\n *\n * @default medium\n */\n size?: Extract<BaseTextSizes, 'xsmall' | 'small' | 'medium' | 'large'>;\n /**\n * Defines how far your touch can start away from the link. This is a react-native only prop and has no effect on web.\n */\n hitSlop?:\n | {\n top?: number;\n right?: number;\n bottom?: number;\n left?: number;\n }\n | number;\n /**\n * The title of the link which is displayed as a tooltip. This is a web only prop and has no effect on react-native.\n */\n htmlTitle?: string;\n opacity?: number;\n} & TestID &\n StyledPropsBlade &\n Omit<BladeCommonEvents, 'onBlur' | 'onMouseLeave'>;\n\n/*\n Mandatory children prop when icon is not provided\n*/\ntype BaseLinkWithoutIconProps = BaseLinkCommonProps & {\n icon?: undefined;\n children: StringChildrenType;\n};\n\n/*\n Optional children prop when icon is provided\n*/\ntype BaseLinkWithIconProps = BaseLinkCommonProps & {\n icon: IconComponent;\n children?: StringChildrenType;\n};\n\n/*\n BaseLink Props with or without an icon\n*/\ntype BaseLinkPropsWithOrWithoutIcon = BaseLinkWithIconProps | BaseLinkWithoutIconProps;\n\n/*\n BaseLink Props when variant is anchor\n*/\ntype BaseLinkAnchorVariantProps = BaseLinkPropsWithOrWithoutIcon & {\n variant?: 'anchor';\n href?: string;\n target?: string;\n rel?: string;\n isDisabled?: undefined;\n};\n\n/*\n BaseLink Props when variant is button\n*/\ntype BaseLinkButtonVariantProps = BaseLinkPropsWithOrWithoutIcon & {\n variant?: 'button';\n isDisabled?: boolean;\n href?: undefined;\n target?: undefined;\n rel?: undefined;\n};\n\n/*\n BaseLink Props when variant is anchor or button\n*/\nexport type BaseLinkProps = BaseLinkAnchorVariantProps | BaseLinkButtonVariantProps;\n\ntype BaseLinkStyleProps = {\n as: 'a' | 'button';\n textDecorationLine: 'underline' | 'none';\n iconColor: IconProps['color'];\n iconSize: IconProps['size'];\n iconPadding: DotNotationSpacingStringToken;\n textColor: BaseTextProps['color'];\n focusRingColor: string;\n motionDuration: DurationString;\n motionEasing: EasingString;\n cursor: CSSObject['cursor'];\n disabled: boolean;\n role: 'button' | 'link';\n defaultRel: BaseLinkProps['rel'];\n type?: 'button';\n fontSize: BaseTextProps['fontSize'];\n lineHeight: BaseTextProps['lineHeight'];\n};\n\ntype LinkActionStates = ActionStates;\nconst getColorToken = ({\n variant,\n color,\n currentInteraction,\n isDisabled,\n element,\n}: {\n variant: BaseLinkProps['variant'];\n color: BaseLinkProps['color'];\n element: 'icon' | 'text';\n currentInteraction: LinkActionStates;\n isDisabled: boolean;\n}): IconColors | TextColors => {\n let state = currentInteraction;\n const map = {\n default: 'normal',\n hover: 'subtle',\n focus: 'normal',\n disabled: 'disabled',\n } as const;\n\n if (isDisabled && variant == 'button') {\n state = 'disabled';\n }\n\n if (color && color !== 'primary') {\n if (color !== 'white') {\n return `interactive.${element}.${color}.${map[state]}`;\n }\n return `interactive.${element}.staticWhite.${map[state]}`;\n }\n return `interactive.${element}.primary.${map[state]}`;\n};\n\nconst getProps = ({\n theme,\n variant,\n currentInteraction,\n children,\n isDisabled,\n color,\n target,\n size,\n}: {\n theme: Theme;\n variant: NonNullable<BaseLinkProps['variant']>;\n currentInteraction: LinkActionStates;\n children?: string;\n isDisabled: boolean;\n color: BaseLinkProps['color'];\n target: BaseLinkProps['target'];\n size: NonNullable<BaseLinkProps['size']>;\n}): BaseLinkStyleProps => {\n const isButton = variant === 'button';\n const textSizes: {\n fontSize: Record<NonNullable<BaseLinkProps['size']>, keyof FontSize>;\n lineHeight: Record<NonNullable<BaseLinkProps['size']>, keyof Typography['lineHeights']>;\n } = {\n fontSize: {\n xsmall: 25,\n small: 75,\n medium: 100,\n large: 200,\n },\n lineHeight: {\n xsmall: 25,\n small: 75,\n medium: 100,\n large: 200,\n },\n };\n\n const props: BaseLinkStyleProps = {\n as: isButton ? 'button' : 'a',\n textDecorationLine: !isButton && currentInteraction !== 'default' ? 'underline' : 'none',\n iconColor: getColorToken({\n variant,\n color,\n element: 'icon',\n currentInteraction,\n isDisabled,\n }) as IconProps['color'],\n fontSize: textSizes.fontSize[size],\n lineHeight: textSizes.lineHeight[size],\n iconSize: size,\n iconPadding: children?.trim() ? 'spacing.2' : 'spacing.0',\n textColor: getColorToken({\n variant,\n color,\n element: 'text',\n currentInteraction,\n isDisabled,\n }) as BaseTextProps['color'],\n focusRingColor: getIn(theme.colors, 'interactive.background.primary.faded'),\n motionDuration: 'duration.2xquick',\n motionEasing: 'easing.standard.effective',\n cursor: isButton && isDisabled ? 'not-allowed' : 'pointer',\n disabled: isButton && isDisabled,\n role: isButton ? 'button' : 'link',\n defaultRel: target && target === '_blank' ? 'noreferrer noopener' : undefined,\n type: isButton ? 'button' : undefined,\n };\n\n return props;\n};\n\nconst _BaseLink: React.ForwardRefRenderFunction<BladeElementRef, BaseLinkProps> = (\n {\n children,\n icon: Icon,\n iconPosition = 'left',\n isDisabled = false,\n onClick,\n onKeyDown,\n variant = 'anchor',\n href,\n target,\n rel,\n color = 'primary',\n opacity,\n accessibilityProps,\n // @ts-expect-error avoiding exposing to public\n className,\n // @ts-expect-error avoiding exposing to public\n style,\n size = 'medium',\n testID,\n hitSlop,\n htmlTitle,\n onBlur,\n onFocus,\n onMouseLeave,\n onMouseMove,\n onPointerDown,\n onPointerEnter,\n onTouchStart,\n onTouchEnd,\n onMouseDown,\n onMouseUp,\n ...styledProps\n },\n ref,\n) => {\n const childrenString = getStringFromReactText(children);\n const { currentInteraction, setCurrentInteraction, ...syntheticEvents } = useInteraction();\n const { theme } = useTheme();\n if (__DEV__) {\n if (!Icon && !childrenString?.trim()) {\n throwBladeError({\n message: `At least one of icon or text is required to render a link.`,\n moduleName: 'BaseLink',\n });\n }\n }\n const {\n as,\n textDecorationLine,\n iconColor,\n iconPadding,\n iconSize,\n fontSize,\n textColor,\n focusRingColor,\n motionDuration,\n motionEasing,\n cursor,\n disabled,\n role,\n defaultRel,\n type,\n lineHeight,\n } = getProps({\n theme,\n variant,\n currentInteraction,\n children: childrenString,\n isDisabled,\n color,\n target,\n size,\n });\n\n const handleOnClick = (event: SyntheticEvent): void => {\n if (onClick) {\n onClick(event);\n }\n };\n\n const asProp = isReactNative() ? undefined : 'span';\n return (\n <StyledBaseLink\n ref={ref as never}\n {...metaAttribute({ name: MetaConstants.Link, testID })}\n accessibilityProps={{\n ...makeAccessible({\n role,\n disabled,\n ...accessibilityProps,\n }),\n }}\n variant={variant}\n as={as}\n href={href}\n target={target}\n rel={rel ?? defaultRel}\n onClick={handleOnClick}\n {...syntheticEvents}\n onBlur={(event: any) => {\n onBlur?.(event);\n syntheticEvents.onBlur();\n }}\n onFocus={(event: any) => {\n onFocus?.(event);\n syntheticEvents.onFocus();\n }}\n onMouseLeave={(event: any) => {\n if (onMouseLeave) {\n onMouseLeave(event);\n }\n syntheticEvents.onMouseLeave();\n }}\n onMouseMove={onMouseMove}\n onPointerDown={onPointerDown}\n onPointerEnter={onPointerEnter}\n onTouchStart={onTouchStart}\n onTouchEnd={onTouchEnd}\n onKeyDown={onKeyDown}\n onMouseDown={onMouseDown}\n onMouseUp={onMouseUp}\n disabled={disabled}\n type={type}\n cursor={cursor}\n focusRingColor={focusRingColor}\n motionDuration={motionDuration}\n motionEasing={motionEasing}\n setCurrentInteraction={setCurrentInteraction}\n {...getStyledProps(styledProps)}\n // @ts-ignore Because we avoided exposing className to public\n className={className}\n style={style}\n hitSlop={hitSlop}\n title={htmlTitle}\n >\n <BaseBox\n as={asProp}\n display=\"flex\"\n flexDirection=\"row\"\n className=\"content-container\"\n alignItems=\"center\"\n opacity={opacity}\n >\n {Icon && iconPosition == 'left' ? (\n <BaseBox as={asProp} paddingRight={iconPadding} display=\"flex\" alignItems=\"center\">\n <Icon color={iconColor} size={iconSize} />\n </BaseBox>\n ) : null}\n <BaseText\n as={asProp}\n textDecorationLine={textDecorationLine}\n color={textColor}\n fontSize={fontSize}\n lineHeight={lineHeight}\n textAlign=\"center\"\n fontWeight=\"medium\"\n >\n {children}\n </BaseText>\n {Icon && iconPosition == 'right' ? (\n <BaseBox as={asProp} paddingLeft={iconPadding} display=\"flex\" alignItems=\"center\">\n <Icon color={iconColor} size={iconSize} />\n </BaseBox>\n ) : null}\n </BaseBox>\n </StyledBaseLink>\n );\n};\n\nconst BaseLink = assignWithoutSideEffects(React.forwardRef(_BaseLink), {\n displayName: 'BaseLink',\n componentId: 'BaseLink',\n});\n\nexport default BaseLink;\n"],"names":["getColorToken","_ref","variant","color","currentInteraction","isDisabled","element","state","map","hover","focus","disabled","concat","getProps","_ref2","theme","children","target","size","isButton","textSizes","fontSize","xsmall","small","medium","large","lineHeight","props","as","textDecorationLine","iconColor","iconSize","iconPadding","trim","textColor","focusRingColor","getIn","colors","motionDuration","motionEasing","cursor","role","defaultRel","undefined","type","_BaseLink","_ref3","ref","Icon","icon","_ref3$iconPosition","iconPosition","_ref3$isDisabled","onClick","onKeyDown","_ref3$variant","href","rel","_ref3$color","opacity","accessibilityProps","className","style","_ref3$size","testID","hitSlop","htmlTitle","onBlur","onFocus","onMouseLeave","onMouseMove","onPointerDown","onPointerEnter","onTouchStart","onTouchEnd","onMouseDown","onMouseUp","styledProps","_objectWithoutProperties","_excluded","childrenString","getStringFromReactText","_useInteraction","useInteraction","setCurrentInteraction","syntheticEvents","_excluded2","_useTheme","useTheme","throwBladeError","message","moduleName","_getProps","handleOnClick","event","asProp","isReactNative","_jsx","StyledBaseLink","_objectSpread","metaAttribute","name","MetaConstants","Link","makeAccessible","getStyledProps","title","_jsxs","BaseBox","display","flexDirection","alignItems","paddingRight","BaseText","textAlign","fontWeight","paddingLeft","BaseLink","assignWithoutSideEffects","React","forwardRef","displayName","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyJA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAAC,IAAA,EAYY;AAAA,EAAA,IAX7BC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IACPC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,kBAAkB,GAAAH,IAAA,CAAlBG,kBAAkB;IAClBC,UAAU,GAAAJ,IAAA,CAAVI,UAAU;IACVC,OAAO,GAAAL,IAAA,CAAPK,OAAO,CAAA;EAQP,IAAIC,KAAK,GAAGH,kBAAkB,CAAA;AAC9B,EAAA,IAAMI,GAAG,GAAG;AACV,IAAA,SAAA,EAAS,QAAQ;AACjBC,IAAAA,KAAK,EAAE,QAAQ;AACfC,IAAAA,KAAK,EAAE,QAAQ;AACfC,IAAAA,QAAQ,EAAE,UAAA;GACF,CAAA;AAEV,EAAA,IAAIN,UAAU,IAAIH,OAAO,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AAC,MAAM;AAACE,QAAAA,UAAU,EAAC,QAAQ;QAAA/F,QAAA,eAC/EiF,GAAA,CAACjD,IAAI,EAAA;AAAC7C,UAAAA,KAAK,EAAE2B,SAAU;AAACZ,UAAAA,IAAI,EAAEa,QAAAA;SAAW,CAAA;OAClC,CAAC,GACR,IAAI,CAAA;KACD,CAAA;AAAC,GAAA,CACI,CAAC,CAAA;AAErB,CAAC,CAAA;AAEKsF,IAAAA,QAAQ,gBAAGC,wBAAwB,eAACC,cAAK,CAACC,UAAU,CAAC3E,SAAS,CAAC,EAAE;AACrE4E,EAAAA,WAAW,EAAE,UAAU;AACvBC,EAAAA,WAAW,EAAE,UAAA;AACf,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"BaseLink.js","sources":["../../../../../../../src/components/Link/BaseLink/BaseLink.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/prefer-ts-expect-error */\n/* eslint-disable @typescript-eslint/ban-ts-comment */\nimport type { SyntheticEvent } from 'react';\nimport React from 'react';\nimport type { CSSObject } from 'styled-components';\nimport type { GestureResponderEvent } from 'react-native';\nimport StyledBaseLink from './StyledBaseLink';\nimport getIn from '~utils/lodashButBetter/get';\nimport useInteraction from '~utils/useInteraction';\nimport type { IconColors, IconComponent, IconProps } from '~components/Icons';\nimport type { Theme } from '~components/BladeProvider';\nimport { useTheme } from '~components/BladeProvider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { BaseText } from '~components/Typography/BaseText';\nimport type {\n DotNotationSpacingStringToken,\n StringChildrenType,\n TestID,\n BladeElementRef,\n} from '~utils/types';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { Platform } from '~utils';\nimport { isReactNative } from '~utils';\nimport type { DurationString, EasingString, FontSize, Typography } from '~tokens/global';\nimport type {\n BaseTextProps,\n BaseTextSizes,\n TextColors,\n} from '~components/Typography/BaseText/types';\nimport { getStringFromReactText } from '~src/utils/getStringChildren';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { AccessibilityProps } from '~utils/makeAccessible';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport type { BladeCommonEvents } from '~components/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { throwBladeError } from '~utils/logger';\nimport type { ActionStates } from '~utils/useInteraction';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype BaseLinkCommonProps = {\n color?: 'primary' | 'white' | 'positive' | 'negative' | 'notice' | 'information' | 'neutral';\n icon?: IconComponent;\n iconPosition?: 'left' | 'right';\n onClick?: (event: SyntheticEvent) => void;\n onBlur?: Platform.Select<{\n native: (event: GestureResponderEvent) => void;\n web: (event: React.FocusEvent<HTMLButtonElement>) => void;\n }>;\n onMouseLeave?: Platform.Select<{\n native: (event: GestureResponderEvent) => void;\n web: (event: React.MouseEvent<HTMLButtonElement>) => void;\n }>;\n onKeyDown?: Platform.Select<{\n native: (event: GestureResponderEvent) => void;\n web: (event: React.KeyboardEvent<HTMLButtonElement>) => void;\n }>;\n accessibilityProps?: Partial<AccessibilityProps>;\n\n /**\n * Sets the size of the link\n *\n * @default medium\n */\n size?: Extract<BaseTextSizes, 'xsmall' | 'small' | 'medium' | 'large'>;\n /**\n * Defines how far your touch can start away from the link. This is a react-native only prop and has no effect on web.\n */\n hitSlop?:\n | {\n top?: number;\n right?: number;\n bottom?: number;\n left?: number;\n }\n | number;\n /**\n * The title of the link which is displayed as a tooltip. This is a web only prop and has no effect on react-native.\n */\n htmlTitle?: string;\n opacity?: number;\n} & TestID &\n StyledPropsBlade &\n Omit<BladeCommonEvents, 'onBlur' | 'onMouseLeave'>;\n\n/*\n Mandatory children prop when icon is not provided\n*/\ntype BaseLinkWithoutIconProps = BaseLinkCommonProps & {\n icon?: undefined;\n children: StringChildrenType;\n};\n\n/*\n Optional children prop when icon is provided\n*/\ntype BaseLinkWithIconProps = BaseLinkCommonProps & {\n icon: IconComponent;\n children?: StringChildrenType;\n};\n\n/*\n BaseLink Props with or without an icon\n*/\ntype BaseLinkPropsWithOrWithoutIcon = BaseLinkWithIconProps | BaseLinkWithoutIconProps;\n\n/*\n BaseLink Props when variant is anchor\n*/\ntype BaseLinkAnchorVariantProps = BaseLinkPropsWithOrWithoutIcon & {\n variant?: 'anchor';\n href?: string;\n target?: string;\n rel?: string;\n isDisabled?: undefined;\n};\n\n/*\n BaseLink Props when variant is button\n*/\ntype BaseLinkButtonVariantProps = BaseLinkPropsWithOrWithoutIcon & {\n variant?: 'button';\n isDisabled?: boolean;\n href?: undefined;\n target?: undefined;\n rel?: undefined;\n};\n\n/*\n BaseLink Props when variant is anchor or button\n*/\nexport type BaseLinkProps = BaseLinkAnchorVariantProps | BaseLinkButtonVariantProps;\n\ntype BaseLinkStyleProps = {\n as: 'a' | 'button';\n textDecorationLine: 'underline' | 'none';\n iconColor: IconProps['color'];\n iconSize: IconProps['size'];\n iconPadding: DotNotationSpacingStringToken;\n textColor: BaseTextProps['color'];\n focusRingColor: string;\n motionDuration: DurationString;\n motionEasing: EasingString;\n cursor: CSSObject['cursor'];\n disabled: boolean;\n role: 'button' | 'link';\n defaultRel: BaseLinkProps['rel'];\n type?: 'button';\n fontSize: BaseTextProps['fontSize'];\n lineHeight: BaseTextProps['lineHeight'];\n};\n\ntype LinkActionStates = ActionStates;\nconst getColorToken = ({\n variant,\n color,\n currentInteraction,\n isDisabled,\n element,\n}: {\n variant: BaseLinkProps['variant'];\n color: BaseLinkProps['color'];\n element: 'icon' | 'text';\n currentInteraction: LinkActionStates;\n isDisabled: boolean;\n}): IconColors | TextColors => {\n let state = currentInteraction;\n const map = {\n default: 'normal',\n hover: 'subtle',\n focus: 'normal',\n disabled: 'disabled',\n } as const;\n\n if (isDisabled && variant == 'button') {\n state = 'disabled';\n }\n\n if (color && color !== 'primary') {\n if (color !== 'white') {\n return `interactive.${element}.${color}.${map[state]}`;\n }\n return `interactive.${element}.staticWhite.${map[state]}`;\n }\n return `interactive.${element}.primary.${map[state]}`;\n};\n\nconst getProps = ({\n theme,\n variant,\n currentInteraction,\n children,\n isDisabled,\n color,\n target,\n size,\n}: {\n theme: Theme;\n variant: NonNullable<BaseLinkProps['variant']>;\n currentInteraction: LinkActionStates;\n children?: string;\n isDisabled: boolean;\n color: BaseLinkProps['color'];\n target: BaseLinkProps['target'];\n size: NonNullable<BaseLinkProps['size']>;\n}): BaseLinkStyleProps => {\n const isButton = variant === 'button';\n const textSizes: {\n fontSize: Record<NonNullable<BaseLinkProps['size']>, keyof FontSize>;\n lineHeight: Record<NonNullable<BaseLinkProps['size']>, keyof Typography['lineHeights']>;\n } = {\n fontSize: {\n xsmall: 25,\n small: 75,\n medium: 100,\n large: 200,\n },\n lineHeight: {\n xsmall: 25,\n small: 75,\n medium: 100,\n large: 200,\n },\n };\n\n const props: BaseLinkStyleProps = {\n as: isButton ? 'button' : 'a',\n textDecorationLine: !isButton && currentInteraction !== 'default' ? 'underline' : 'none',\n iconColor: getColorToken({\n variant,\n color,\n element: 'icon',\n currentInteraction,\n isDisabled,\n }) as IconProps['color'],\n fontSize: textSizes.fontSize[size],\n lineHeight: textSizes.lineHeight[size],\n iconSize: size,\n iconPadding: children?.trim() ? 'spacing.2' : 'spacing.0',\n textColor: getColorToken({\n variant,\n color,\n element: 'text',\n currentInteraction,\n isDisabled,\n }) as BaseTextProps['color'],\n focusRingColor: getIn(theme.colors, 'interactive.background.primary.faded'),\n motionDuration: 'duration.2xquick',\n motionEasing: 'easing.standard.effective',\n cursor: isButton && isDisabled ? 'not-allowed' : 'pointer',\n disabled: isButton && isDisabled,\n role: isButton ? 'button' : 'link',\n defaultRel: target && target === '_blank' ? 'noreferrer noopener' : undefined,\n type: isButton ? 'button' : undefined,\n };\n\n return props;\n};\n\nconst _BaseLink: React.ForwardRefRenderFunction<BladeElementRef, BaseLinkProps> = (\n {\n children,\n icon: Icon,\n iconPosition = 'left',\n isDisabled = false,\n onClick,\n onKeyDown,\n variant = 'anchor',\n href,\n target,\n rel,\n color = 'primary',\n opacity,\n accessibilityProps,\n // @ts-expect-error avoiding exposing to public\n className,\n // @ts-expect-error avoiding exposing to public\n style,\n size = 'medium',\n testID,\n hitSlop,\n htmlTitle,\n onBlur,\n onFocus,\n onMouseLeave,\n onMouseMove,\n onPointerDown,\n onPointerEnter,\n onTouchStart,\n onTouchEnd,\n onMouseDown,\n onMouseUp,\n ...rest\n },\n ref,\n) => {\n const childrenString = getStringFromReactText(children);\n const { currentInteraction, setCurrentInteraction, ...syntheticEvents } = useInteraction();\n const { theme } = useTheme();\n if (__DEV__) {\n if (!Icon && !childrenString?.trim()) {\n throwBladeError({\n message: `At least one of icon or text is required to render a link.`,\n moduleName: 'BaseLink',\n });\n }\n }\n const {\n as,\n textDecorationLine,\n iconColor,\n iconPadding,\n iconSize,\n fontSize,\n textColor,\n focusRingColor,\n motionDuration,\n motionEasing,\n cursor,\n disabled,\n role,\n defaultRel,\n type,\n lineHeight,\n } = getProps({\n theme,\n variant,\n currentInteraction,\n children: childrenString,\n isDisabled,\n color,\n target,\n size,\n });\n\n const handleOnClick = (event: SyntheticEvent): void => {\n if (onClick) {\n onClick(event);\n }\n };\n\n const asProp = isReactNative() ? undefined : 'span';\n return (\n <StyledBaseLink\n ref={ref as never}\n {...metaAttribute({ name: MetaConstants.Link, testID })}\n accessibilityProps={{\n ...makeAccessible({\n role,\n disabled,\n ...accessibilityProps,\n }),\n }}\n variant={variant}\n as={as}\n href={href}\n target={target}\n rel={rel ?? defaultRel}\n onClick={handleOnClick}\n {...syntheticEvents}\n onBlur={(event: any) => {\n onBlur?.(event);\n syntheticEvents.onBlur();\n }}\n onFocus={(event: any) => {\n onFocus?.(event);\n syntheticEvents.onFocus();\n }}\n onMouseLeave={(event: any) => {\n if (onMouseLeave) {\n onMouseLeave(event);\n }\n syntheticEvents.onMouseLeave();\n }}\n onMouseMove={onMouseMove}\n onPointerDown={onPointerDown}\n onPointerEnter={onPointerEnter}\n onTouchStart={onTouchStart}\n onTouchEnd={onTouchEnd}\n onKeyDown={onKeyDown}\n onMouseDown={onMouseDown}\n onMouseUp={onMouseUp}\n disabled={disabled}\n type={type}\n cursor={cursor}\n focusRingColor={focusRingColor}\n motionDuration={motionDuration}\n motionEasing={motionEasing}\n setCurrentInteraction={setCurrentInteraction}\n {...getStyledProps(rest)}\n {...makeAnalyticsAttribute(rest)}\n // @ts-ignore Because we avoided exposing className to public\n className={className}\n style={style}\n hitSlop={hitSlop}\n title={htmlTitle}\n >\n <BaseBox\n as={asProp}\n display=\"flex\"\n flexDirection=\"row\"\n className=\"content-container\"\n alignItems=\"center\"\n opacity={opacity}\n >\n {Icon && iconPosition == 'left' ? (\n <BaseBox as={asProp} paddingRight={iconPadding} display=\"flex\" alignItems=\"center\">\n <Icon color={iconColor} size={iconSize} />\n </BaseBox>\n ) : null}\n <BaseText\n as={asProp}\n textDecorationLine={textDecorationLine}\n color={textColor}\n fontSize={fontSize}\n lineHeight={lineHeight}\n textAlign=\"center\"\n fontWeight=\"medium\"\n >\n {children}\n </BaseText>\n {Icon && iconPosition == 'right' ? (\n <BaseBox as={asProp} paddingLeft={iconPadding} display=\"flex\" alignItems=\"center\">\n <Icon color={iconColor} size={iconSize} />\n </BaseBox>\n ) : null}\n </BaseBox>\n </StyledBaseLink>\n );\n};\n\nconst BaseLink = assignWithoutSideEffects(React.forwardRef(_BaseLink), {\n displayName: 'BaseLink',\n componentId: 'BaseLink',\n});\n\nexport default BaseLink;\n"],"names":["getColorToken","_ref","variant","color","currentInteraction","isDisabled","element","state","map","hover","focus","disabled","concat","getProps","_ref2","theme","children","target","size","isButton","textSizes","fontSize","xsmall","small","medium","large","lineHeight","props","as","textDecorationLine","iconColor","iconSize","iconPadding","trim","textColor","focusRingColor","getIn","colors","motionDuration","motionEasing","cursor","role","defaultRel","undefined","type","_BaseLink","_ref3","ref","Icon","icon","_ref3$iconPosition","iconPosition","_ref3$isDisabled","onClick","onKeyDown","_ref3$variant","href","rel","_ref3$color","opacity","accessibilityProps","className","style","_ref3$size","testID","hitSlop","htmlTitle","onBlur","onFocus","onMouseLeave","onMouseMove","onPointerDown","onPointerEnter","onTouchStart","onTouchEnd","onMouseDown","onMouseUp","rest","_objectWithoutProperties","_excluded","childrenString","getStringFromReactText","_useInteraction","useInteraction","setCurrentInteraction","syntheticEvents","_excluded2","_useTheme","useTheme","throwBladeError","message","moduleName","_getProps","handleOnClick","event","asProp","isReactNative","_jsx","StyledBaseLink","_objectSpread","metaAttribute","name","MetaConstants","Link","makeAccessible","getStyledProps","makeAnalyticsAttribute","title","_jsxs","BaseBox","display","flexDirection","alignItems","paddingRight","BaseText","textAlign","fontWeight","paddingLeft","BaseLink","assignWithoutSideEffects","React","forwardRef","displayName","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0JA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAAC,IAAA,EAYY;AAAA,EAAA,IAX7BC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IACPC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,kBAAkB,GAAAH,IAAA,CAAlBG,kBAAkB;IAClBC,UAAU,GAAAJ,IAAA,CAAVI,UAAU;IACVC,OAAO,GAAAL,IAAA,CAAPK,OAAO,CAAA;EAQP,IAAIC,KAAK,GAAGH,kBAAkB,CAAA;AAC9B,EAAA,IAAMI,GAAG,GAAG;AACV,IAAA,SAAA,EAAS,QAAQ;AACjBC,IAAAA,KAAK,EAAE,QAAQ;AACfC,IAAAA,KAAK,EAAE,QAAQ;AACfC,IAAAA,QAAQ,EAAE,UAAA;GACF,CAAA;AAEV,EAAA,IAAIN,UAAU,IAAIH,OAAO,IAAI,QAAQ,EAAE;AACrCK,IAAAA,KAAK,GAAG,UAAU,CAAA;AACpB,GAAA;AAEA,EAAA,IAAIJ,KAAK,IAAIA,KAAK,KAAK,SAAS,EAAE;IAChC,IAAIA,KAAK,KAAK,OAAO,EAAE;AACrB,MAAA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