@razorpay/blade 11.37.0 → 11.38.1
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/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/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/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/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/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/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 +221 -189
- package/build/types/components/index.native.d.ts +145 -131
- package/build/types/tokens/index.d.ts +3 -1
- package/build/types/tokens/index.native.d.ts +3 -1
- package/package.json +3 -3
|
@@ -7,10 +7,12 @@ import '../../VisuallyHidden/index.web.js';
|
|
|
7
7
|
import '../../../utils/index.js';
|
|
8
8
|
import '../../../utils/assignWithoutSideEffects/index.js';
|
|
9
9
|
import { dropdownComponentIds } from '../../Dropdown/dropdownComponentIds.js';
|
|
10
|
+
import '../../../utils/makeAnalyticsAttribute/index.js';
|
|
10
11
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
11
12
|
import { BaseBox } from '../../Box/BaseBox/BaseBox.web.js';
|
|
12
13
|
import { isReactNative } from '../../../utils/platform/isReactNative.js';
|
|
13
14
|
import { VisuallyHidden } from '../../VisuallyHidden/VisuallyHidden.web.js';
|
|
15
|
+
import { makeAnalyticsAttribute } from '../../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
|
|
14
16
|
import { assignWithoutSideEffects } from '../../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
|
|
15
17
|
|
|
16
18
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -27,7 +29,7 @@ var _SelectInput = function _SelectInput(props, ref) {
|
|
|
27
29
|
jsxs(BaseBox, {
|
|
28
30
|
position: "relative",
|
|
29
31
|
children: [!isReactNative() ? /*#__PURE__*/jsx(VisuallyHidden, {
|
|
30
|
-
children: /*#__PURE__*/jsx("input", {
|
|
32
|
+
children: /*#__PURE__*/jsx("input", _objectSpread(_objectSpread({
|
|
31
33
|
onFocus: function onFocus() {
|
|
32
34
|
var _triggererRef$current;
|
|
33
35
|
(_triggererRef$current = triggererRef.current) === null || _triggererRef$current === void 0 ? void 0 : _triggererRef$current.focus();
|
|
@@ -37,14 +39,14 @@ var _SelectInput = function _SelectInput(props, ref) {
|
|
|
37
39
|
required: props.isRequired,
|
|
38
40
|
name: props.name,
|
|
39
41
|
value: value
|
|
42
|
+
}, makeAnalyticsAttribute(props)), {}, {
|
|
40
43
|
// Adding onChange to surpass no onChange on controlled component warning
|
|
41
44
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
42
|
-
,
|
|
43
45
|
onChange: function onChange() {}
|
|
44
46
|
// Accessibility is covered in the select input itself so we hide this field from a11y tree
|
|
45
47
|
,
|
|
46
48
|
"aria-hidden": true
|
|
47
|
-
})
|
|
49
|
+
}))
|
|
48
50
|
}) : null, /*#__PURE__*/jsx(BaseDropdownInputTrigger, _objectSpread(_objectSpread({}, props), {}, {
|
|
49
51
|
isSelectInput: true,
|
|
50
52
|
onTriggerKeydown: onTriggerKeydown,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectInput.js","sources":["../../../../../../../src/components/Input/DropdownInputTriggers/SelectInput.tsx"],"sourcesContent":["import React from 'react';\nimport type { SelectInputProps } from './types';\nimport { BaseDropdownInputTrigger } from './BaseDropdownInputTrigger';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\nimport BaseBox from '~components/Box/BaseBox';\nimport { VisuallyHidden } from '~components/VisuallyHidden';\nimport { isReactNative } from '~utils';\nimport type { BladeElementRef } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { dropdownComponentIds } from '~components/Dropdown/dropdownComponentIds';\n\nconst _SelectInput = (\n props: SelectInputProps,\n ref: React.ForwardedRef<BladeElementRef>,\n): React.ReactElement => {\n const { value, triggererRef, onTriggerKeydown, onTriggerClick } = useDropdown();\n\n return (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n <BaseBox position=\"relative\">\n {!isReactNative() ? (\n <VisuallyHidden>\n <input\n onFocus={() => {\n triggererRef.current?.focus();\n }}\n ref={ref as React.Ref<HTMLInputElement>}\n tabIndex={-1}\n required={props.isRequired}\n name={props.name}\n value={value}\n // Adding onChange to surpass no onChange on controlled component warning\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onChange={() => {}}\n // Accessibility is covered in the select input itself so we hide this field from a11y tree\n aria-hidden={true}\n />\n </VisuallyHidden>\n ) : null}\n <BaseDropdownInputTrigger\n {...props}\n isSelectInput={true}\n onTriggerKeydown={onTriggerKeydown}\n onTriggerClick={(e) => {\n onTriggerClick();\n props?.onClick?.(e);\n }}\n />\n </BaseBox>\n );\n};\n\n/**\n * ### SelectInput\n *\n * Our equivalent of `<select>` tag. Lets you select items from given options.\n *\n * To be used in combination of `Dropdown` and `ActionList` component\n *\n * ---\n *\n * #### Usage\n *\n * ```diff\n * <Dropdown>\n * + <SelectInput label=\"Select Fruits\" />\n * <DropdownOverlay>\n * <ActionList>\n * <ActionListItem title=\"Mango\" value=\"mango\" />\n * <ActionListItem title=\"Apple\" value=\"apple\" />\n * </ActionList>\n * </DropdownOverlay>\n * </Dropdown>\n * ```\n *\n * ---\n *\n * Checkout {@link https://blade.razorpay.com/?path=/docs/components-dropdown-with-select--with-single-select SelectInput Documentation}.\n */\n\nconst SelectInput = assignWithoutSideEffects(React.forwardRef(_SelectInput), {\n componentId: dropdownComponentIds.triggers.SelectInput,\n});\n\nexport { SelectInput };\n"],"names":["_SelectInput","props","ref","_useDropdown","useDropdown","value","triggererRef","onTriggerKeydown","onTriggerClick","_jsxs","BaseBox","position","children","isReactNative","_jsx","VisuallyHidden","onFocus","_triggererRef$current","current","focus","tabIndex","required","isRequired","name","
|
|
1
|
+
{"version":3,"file":"SelectInput.js","sources":["../../../../../../../src/components/Input/DropdownInputTriggers/SelectInput.tsx"],"sourcesContent":["import React from 'react';\nimport type { SelectInputProps } from './types';\nimport { BaseDropdownInputTrigger } from './BaseDropdownInputTrigger';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\nimport BaseBox from '~components/Box/BaseBox';\nimport { VisuallyHidden } from '~components/VisuallyHidden';\nimport { isReactNative } from '~utils';\nimport type { BladeElementRef } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { dropdownComponentIds } from '~components/Dropdown/dropdownComponentIds';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\nconst _SelectInput = (\n props: SelectInputProps,\n ref: React.ForwardedRef<BladeElementRef>,\n): React.ReactElement => {\n const { value, triggererRef, onTriggerKeydown, onTriggerClick } = useDropdown();\n\n return (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n <BaseBox position=\"relative\">\n {!isReactNative() ? (\n <VisuallyHidden>\n <input\n onFocus={() => {\n triggererRef.current?.focus();\n }}\n ref={ref as React.Ref<HTMLInputElement>}\n tabIndex={-1}\n required={props.isRequired}\n name={props.name}\n value={value}\n {...makeAnalyticsAttribute(props)}\n // Adding onChange to surpass no onChange on controlled component warning\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onChange={() => {}}\n // Accessibility is covered in the select input itself so we hide this field from a11y tree\n aria-hidden={true}\n />\n </VisuallyHidden>\n ) : null}\n <BaseDropdownInputTrigger\n {...props}\n isSelectInput={true}\n onTriggerKeydown={onTriggerKeydown}\n onTriggerClick={(e) => {\n onTriggerClick();\n props?.onClick?.(e);\n }}\n />\n </BaseBox>\n );\n};\n\n/**\n * ### SelectInput\n *\n * Our equivalent of `<select>` tag. Lets you select items from given options.\n *\n * To be used in combination of `Dropdown` and `ActionList` component\n *\n * ---\n *\n * #### Usage\n *\n * ```diff\n * <Dropdown>\n * + <SelectInput label=\"Select Fruits\" />\n * <DropdownOverlay>\n * <ActionList>\n * <ActionListItem title=\"Mango\" value=\"mango\" />\n * <ActionListItem title=\"Apple\" value=\"apple\" />\n * </ActionList>\n * </DropdownOverlay>\n * </Dropdown>\n * ```\n *\n * ---\n *\n * Checkout {@link https://blade.razorpay.com/?path=/docs/components-dropdown-with-select--with-single-select SelectInput Documentation}.\n */\n\nconst SelectInput = assignWithoutSideEffects(React.forwardRef(_SelectInput), {\n componentId: dropdownComponentIds.triggers.SelectInput,\n});\n\nexport { SelectInput };\n"],"names":["_SelectInput","props","ref","_useDropdown","useDropdown","value","triggererRef","onTriggerKeydown","onTriggerClick","_jsxs","BaseBox","position","children","isReactNative","_jsx","VisuallyHidden","_objectSpread","onFocus","_triggererRef$current","current","focus","tabIndex","required","isRequired","name","makeAnalyticsAttribute","onChange","BaseDropdownInputTrigger","isSelectInput","e","_props$onClick","onClick","call","SelectInput","assignWithoutSideEffects","React","forwardRef","componentId","dropdownComponentIds","triggers"],"mappings":";;;;;;;;;;;;;;;;;;;AAYA,IAAMA,YAAY,GAAG,SAAfA,YAAYA,CAChBC,KAAuB,EACvBC,GAAwC,EACjB;AACvB,EAAA,IAAAC,YAAA,GAAkEC,WAAW,EAAE;IAAvEC,KAAK,GAAAF,YAAA,CAALE,KAAK;IAAEC,YAAY,GAAAH,YAAA,CAAZG,YAAY;IAAEC,gBAAgB,GAAAJ,YAAA,CAAhBI,gBAAgB;IAAEC,eAAc,GAAAL,YAAA,CAAdK,cAAc,CAAA;AAE7D,EAAA;AAAA;AACE;AACAC,IAAAA,IAAA,CAACC,OAAO,EAAA;AAACC,MAAAA,QAAQ,EAAC,UAAU;MAAAC,QAAA,EAAA,CACzB,CAACC,aAAa,EAAE,gBACfC,GAAA,CAACC,cAAc,EAAA;AAAAH,QAAAA,QAAA,eACbE,GAAA,CAAAE,OAAAA,EAAAA,aAAA,CAAAA,aAAA,CAAA;UACEC,OAAO,EAAE,SAAAA,OAAAA,GAAM;AAAA,YAAA,IAAAC,qBAAA,CAAA;AACb,YAAA,CAAAA,qBAAA,GAAAZ,YAAY,CAACa,OAAO,MAAA,IAAA,IAAAD,qBAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAApBA,qBAAA,CAAsBE,KAAK,EAAE,CAAA;WAC7B;AACFlB,UAAAA,GAAG,EAAEA,GAAmC;UACxCmB,QAAQ,EAAE,CAAC,CAAE;UACbC,QAAQ,EAAErB,KAAK,CAACsB,UAAW;UAC3BC,IAAI,EAAEvB,KAAK,CAACuB,IAAK;AACjBnB,UAAAA,KAAK,EAAEA,KAAAA;SACHoB,EAAAA,sBAAsB,CAACxB,KAAK,CAAC,CAAA,EAAA,EAAA,EAAA;AACjC;AACA;AACAyB,UAAAA,QAAQ,EAAE,SAAAA,QAAA,GAAM,EAAC;AACjB;AAAA;UACA,aAAa,EAAA,IAAA;SACd,CAAA,CAAA;AAAC,OACY,CAAC,GACf,IAAI,eACRZ,GAAA,CAACa,wBAAwB,EAAAX,aAAA,CAAAA,aAAA,CAAA,EAAA,EACnBf,KAAK,CAAA,EAAA,EAAA,EAAA;AACT2B,QAAAA,aAAa,EAAE,IAAK;AACpBrB,QAAAA,gBAAgB,EAAEA,gBAAiB;AACnCC,QAAAA,cAAc,EAAE,SAAAA,cAACqB,CAAAA,CAAC,EAAK;AAAA,UAAA,IAAAC,cAAA,CAAA;AACrBtB,UAAAA,eAAc,EAAE,CAAA;AAChBP,UAAAA,KAAK,aAALA,KAAK,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,CAAA6B,cAAA,GAAL7B,KAAK,CAAE8B,OAAO,MAAA,IAAA,IAAAD,cAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAdA,cAAA,CAAAE,IAAA,CAAA/B,KAAK,EAAY4B,CAAC,CAAC,CAAA;AACrB,SAAA;AAAE,OAAA,CACH,CAAC,CAAA;KACK,CAAA;AAAC,IAAA;AAEd,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEMI,IAAAA,WAAW,gBAAGC,wBAAwB,eAACC,cAAK,CAACC,UAAU,CAACpC,YAAY,CAAC,EAAE;AAC3EqC,EAAAA,WAAW,EAAEC,oBAAoB,CAACC,QAAQ,CAACN,WAAAA;AAC7C,CAAC;;;;"}
|
|
@@ -12,9 +12,11 @@ import '../../Box/styledProps/index.js';
|
|
|
12
12
|
import '../../../utils/index.js';
|
|
13
13
|
import '../../../utils/metaAttribute/index.js';
|
|
14
14
|
import '../../../utils/makeSize/index.js';
|
|
15
|
+
import '../../../utils/makeAnalyticsAttribute/index.js';
|
|
15
16
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
16
17
|
import { getPlatformType } from '../../../utils/getPlatformType/getPlatformType.js';
|
|
17
18
|
import { BaseBox } from '../../Box/BaseBox/BaseBox.web.js';
|
|
19
|
+
import { makeAnalyticsAttribute } from '../../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
|
|
18
20
|
import { metaAttribute } from '../../../utils/metaAttribute/metaAttribute.web.js';
|
|
19
21
|
import { MetaConstants } from '../../../utils/metaAttribute/metaConstants.js';
|
|
20
22
|
import { getStyledProps } from '../../Box/styledProps/getStyledProps.js';
|
|
@@ -77,7 +79,7 @@ var _OTPInput = function _OTPInput(_ref, incomingRef) {
|
|
|
77
79
|
testID = _ref.testID,
|
|
78
80
|
_ref$size = _ref.size,
|
|
79
81
|
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
80
|
-
|
|
82
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
81
83
|
var inputRefs = [];
|
|
82
84
|
var _useState = useState(otpToArray(inputValue)),
|
|
83
85
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -268,7 +270,7 @@ var _OTPInput = function _OTPInput(_ref, incomingRef) {
|
|
|
268
270
|
marginLeft: index == 0 ? 'spacing.0' : 'spacing.3',
|
|
269
271
|
children: /*#__PURE__*/jsx(BaseInput
|
|
270
272
|
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
271
|
-
, {
|
|
273
|
+
, _objectSpread({
|
|
272
274
|
autoFocus: autoFocus && index === 0,
|
|
273
275
|
accessibilityLabel: "".concat(index === 0 ? label || accessibilityLabel : '', " character ").concat(index + 1),
|
|
274
276
|
label: label,
|
|
@@ -318,7 +320,7 @@ var _OTPInput = function _OTPInput(_ref, incomingRef) {
|
|
|
318
320
|
type: currentInputType,
|
|
319
321
|
size: size,
|
|
320
322
|
valueComponentType: "heading"
|
|
321
|
-
})
|
|
323
|
+
}, makeAnalyticsAttribute(rest)))
|
|
322
324
|
}, "".concat(inputId, "-").concat(index)));
|
|
323
325
|
};
|
|
324
326
|
for (var index = 0; index < otpLength; index++) {
|
|
@@ -329,7 +331,7 @@ var _OTPInput = function _OTPInput(_ref, incomingRef) {
|
|
|
329
331
|
return /*#__PURE__*/jsxs(BaseBox, _objectSpread(_objectSpread(_objectSpread({}, metaAttribute({
|
|
330
332
|
name: MetaConstants.OTPInput,
|
|
331
333
|
testID: testID
|
|
332
|
-
})), getStyledProps(
|
|
334
|
+
})), getStyledProps(rest)), {}, {
|
|
333
335
|
children: [/*#__PURE__*/jsxs(BaseBox, {
|
|
334
336
|
display: "flex",
|
|
335
337
|
flexDirection: isLabelLeftPositioned ? 'row' : 'column',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OTPInput.js","sources":["../../../../../../../src/components/Input/OTPInput/OTPInput.tsx"],"sourcesContent":["import React, { useEffect, useImperativeHandle, useState } from 'react';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { getHintType } from '../BaseInput/BaseInput';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport type { FormInputOnEvent } from '~components/Form';\nimport { FormHint, FormLabel } from '~components/Form';\nimport { useFormId } from '~components/Form/useFormId';\nimport type { FormInputOnKeyDownEvent } from '~components/Form/FormTypes';\nimport BaseBox from '~components/Box/BaseBox';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { getPlatformType } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { makeSize } from '~utils/makeSize';\n\ntype FormInputOnEventWithIndex = ({\n name,\n value,\n inputIndex,\n}: {\n name?: string;\n value?: string;\n inputIndex: number;\n}) => void;\n\nexport type OTPInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'validationState'\n | 'helpText'\n | 'errorText'\n | 'successText'\n | 'name'\n | 'onChange'\n | 'value'\n | 'isDisabled'\n | 'autoFocus'\n | 'keyboardReturnKeyType'\n | 'keyboardType'\n | 'placeholder'\n | 'testID'\n | 'size'\n> & {\n /**\n * Determines the number of input fields to show for the OTP\n * @default 6\n */\n otpLength?: 4 | 6;\n /**\n * The callback function to be invoked when all the values of the OTPInput are filled\n */\n onOTPFilled?: FormInputOnEvent;\n /**\n * Masks input characters in all the fields\n */\n isMasked?: boolean;\n /**\n * Determines what autoComplete suggestion type to show. Defaults to `oneTimeCode`.\n *\n * It's not recommended to turn this off in favor of otp input practices.\n *\n *\n * Internally it'll render platform specific attributes:\n *\n * - web: `autocomplete`\n * - iOS: `textContentType`\n * - android: `autoComplete`\n *\n */\n autoCompleteSuggestionType?: Extract<\n BaseInputProps['autoCompleteSuggestionType'],\n 'none' | 'oneTimeCode'\n >;\n /**\n * The callback function to be invoked when one of the input fields gets focus\n */\n onFocus?: FormInputOnEventWithIndex;\n /**\n * The callback function to be invoked when one of the input fields is blurred\n */\n onBlur?: FormInputOnEventWithIndex;\n} & StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype OTPInputPropsWithA11yLabel = {\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 OTPInputPropsWithLabel = {\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 OTPInputProps = (OTPInputPropsWithA11yLabel | OTPInputPropsWithLabel) & OTPInputCommonProps;\n\nconst isReactNative = getPlatformType() === 'react-native';\n\n/**\n * Converts a string value of otp to array if passed otherwise returns an array of 6 empty strings\n */\nconst otpToArray = (code?: string): string[] => code?.split('') ?? Array(6).fill('');\n\n/**\n * OTPInput component can be used for accepting OTPs sent to users for authentication/verification purposes.\n *\n * ## Usage\n *\n * ```tsx\n * <OTPInput\n * label=\"Enter OTP\"\n * name=\"otpInput\"\n * onChange={({ name, value }): void => console.log({ name, value })}\n * onOTPFilled={({ name, value }): void => console.log({ name, value })}\n * />\n * ```\n */\nconst _OTPInput: React.ForwardRefRenderFunction<HTMLInputElement[], OTPInputProps> = (\n {\n autoFocus,\n errorText,\n helpText,\n isDisabled,\n keyboardReturnKeyType,\n keyboardType = 'decimal',\n label,\n accessibilityLabel,\n labelPosition,\n name,\n onChange,\n onFocus,\n onBlur,\n onOTPFilled,\n otpLength = 6,\n placeholder,\n successText,\n validationState,\n value: inputValue,\n isMasked,\n autoCompleteSuggestionType = 'oneTimeCode',\n testID,\n size = 'medium',\n ...styledProps\n },\n incomingRef,\n) => {\n const inputRefs: React.RefObject<HTMLInputElement>[] = [];\n const [otpValue, setOtpValue] = useState<string[]>(otpToArray(inputValue));\n const [inputType, setInputType] = useState<('password' | undefined)[]>([]);\n const isLabelLeftPositioned = labelPosition === 'left';\n const { inputId, helpTextId, errorTextId, successTextId } = useFormId('otp');\n\n useImperativeHandle(\n incomingRef,\n () => {\n return inputRefs.map((ref) => ref.current!);\n },\n [inputRefs],\n );\n\n useEffect(() => {\n // Effect for calling `onOTPFilled` callback\n if (inputValue && inputValue.length >= otpLength) {\n // callback for when the OTPInput is controlled and inputValue reaches the same or greater length as the otpLength\n onOTPFilled?.({ value: inputValue.slice(0, otpLength), name });\n } else if (!inputValue && otpValue.join('').length >= otpLength) {\n // callback for when the OTPInput is uncontrolled and otpValue stored in state reaches the same or greater length as the otpLength\n onOTPFilled?.({ value: otpValue.slice(0, otpLength).join(''), name });\n }\n }, [otpValue, otpLength, name, inputValue, onOTPFilled]);\n\n useEffect(() => {\n /* We want to disable the password managers for OTPInput when isMasked is set.\n The issue with only setting autocomplete='off' is that its not an enforcement but a suggestion to the browser to follow.\n This workaround unsets type on first render and sets it to `password` only once a value is entered by the user.\n */\n otpValue.forEach((otp, index) => {\n // Set inputType as 'password' only when a value is entered when isMasked is set\n if (!isEmpty(otp) && !inputType[index] && isMasked) {\n const newInputType = Array.from(inputType);\n newInputType[index] = 'password';\n setInputType(newInputType);\n }\n // Cleanup the inputType array whenever the value is empty but inputType[index] is set\n if (isEmpty(otp) && inputType[index]) {\n const newInputType = Array.from(inputType);\n newInputType[index] = undefined;\n setInputType(newInputType);\n }\n });\n }, [otpValue, inputType, isMasked]);\n\n /**\n * Changes the value of the otp at a given index and updates the otpValue stored in state\n *\n * @param {{ value: string; index: number }} { value, index }\n * @returns {string} updated otpValue\n */\n const setOtpValueByIndex = ({ value, index }: { value: string; index: number }): string => {\n const newOtpValue = Array.from(otpValue);\n newOtpValue[index] = value;\n setOtpValue(newOtpValue);\n return newOtpValue.join('');\n };\n\n /**\n * Sets focus to the desired otp input by index\n *\n * @param {number} index the index of the otp input to be focused\n */\n const focusOnOtpByIndex = (index: number): void => {\n inputRefs[index]?.current?.focus();\n if (!isReactNative) {\n // React Native doesn't support imperatively selecting the value of input\n inputRefs[index]?.current?.select();\n }\n };\n\n const handleOnChange = ({\n value,\n currentOtpIndex,\n }: {\n value?: string;\n currentOtpIndex: number;\n }): void => {\n if (value && value === ' ') {\n // React native doesn't support `event.preventDefault()` hence have to add this check to ensure that empty space is not allowed\n return;\n }\n if (inputValue && inputValue.length > 0) {\n // When OTPInput is controlled, set the otpValue as the consumer passed `inputValue` and append the value on current index based on user's input.\n // User's input will not reflect on the otp but will trigger `onChange` callback with the user's input appended so that the consumer can take appropriate action.\n const newOtpValue = Array.from(inputValue);\n newOtpValue[currentOtpIndex] = value ?? '';\n setOtpValue(newOtpValue);\n onChange?.({ name, value: newOtpValue.join('') });\n } else if (value && value.trim().length > 1) {\n // When the entered value is more that 1 character (when value is pasted), set the otpValue to the newly received value.\n // Could have used `onPaste` for web to achieve this but 1. React Native doesn't support onPaste and 2. Safari's autofill on web doesn't trigger onPaste\n setOtpValue(Array.from(value));\n onChange?.({ name, value: value.trim().slice(0, otpLength) });\n } else if (otpValue[currentOtpIndex] !== value?.trim()) {\n // Set the value at the current index to the entered value\n // only as long as its not the same as the already existing value (this prevents `onChange` being triggered unnecessarily)\n const newValue = setOtpValueByIndex({\n value: value?.trim() ?? '',\n index: currentOtpIndex,\n });\n onChange?.({ name, value: newValue });\n }\n };\n\n const handleOnInput = ({\n value,\n currentOtpIndex,\n }: {\n value?: string;\n currentOtpIndex: number;\n }): void => {\n // Moves focus to next input whenever a value is entered in the current input\n if (value && value.trim().length === 1) {\n focusOnOtpByIndex(++currentOtpIndex);\n }\n };\n\n const handleOnKeyDown = ({\n key,\n code,\n event,\n currentOtpIndex,\n }: FormInputOnKeyDownEvent & { currentOtpIndex: number }): void => {\n if (key === 'Backspace' || code === 'Backspace' || code === 'Delete' || key === 'Delete') {\n event.preventDefault?.();\n handleOnChange({ value: '', currentOtpIndex });\n focusOnOtpByIndex(--currentOtpIndex);\n } else if (key === 'ArrowLeft' || code === 'ArrowLeft') {\n event.preventDefault?.();\n focusOnOtpByIndex(--currentOtpIndex);\n } else if (key === 'ArrowRight' || code === 'ArrowRight') {\n event.preventDefault?.();\n focusOnOtpByIndex(++currentOtpIndex);\n } else if (key === ' ' || code === 'Space') {\n event.preventDefault?.();\n }\n };\n\n const getHiddenInput = (): React.ReactNode => {\n if (!isReactNative) {\n return (\n <input\n hidden={true}\n id={inputId}\n name={name}\n value={inputValue ?? otpValue.join('') ?? ''}\n readOnly\n />\n );\n }\n return null;\n };\n\n const getOTPInputFields = (): React.ReactNode => {\n const inputs = [];\n for (let index = 0; index < otpLength; index++) {\n const currentValue = inputValue ? otpToArray(inputValue)[index] || '' : otpValue[index] || '';\n const ref = React.createRef<HTMLInputElement>();\n // if an inputValue is passed (controlled) and isMasked is set, inputType will always be password\n let currentInputType: 'password' | undefined;\n if (isMasked) {\n // if inputValue is passed (controlled component) then the inputType will always be password\n currentInputType = inputValue ? 'password' : inputType[index];\n }\n inputRefs.push(ref);\n inputs.push(\n <BaseBox\n flex={1}\n marginLeft={index == 0 ? 'spacing.0' : 'spacing.3'}\n key={`${inputId}-${index}`}\n >\n <BaseInput\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus && index === 0}\n accessibilityLabel={`${index === 0 ? label || accessibilityLabel : ''} character ${\n index + 1\n }`}\n label={label}\n hideLabelText={true}\n id={`${inputId}-${index}`}\n textAlign=\"center\"\n ref={ref as never}\n name={name}\n value={currentValue}\n maxCharacters={otpValue[index]?.length > 0 ? 1 : undefined}\n onChange={(formEvent) => handleOnChange({ ...formEvent, currentOtpIndex: index })}\n onFocus={(formEvent) => onFocus?.({ ...formEvent, inputIndex: index })}\n onBlur={(formEvent) => onBlur?.({ ...formEvent, inputIndex: index })}\n onInput={(formEvent) => handleOnInput({ ...formEvent, currentOtpIndex: index })}\n onKeyDown={(keyboardEvent) =>\n handleOnKeyDown({ ...keyboardEvent, currentOtpIndex: index })\n }\n isDisabled={isDisabled}\n placeholder={Array.from(placeholder ?? '')[index] ?? ''}\n isRequired={true}\n autoCompleteSuggestionType={autoCompleteSuggestionType}\n keyboardType={keyboardType}\n keyboardReturnKeyType={keyboardReturnKeyType}\n validationState={validationState}\n successText={successText}\n errorText={errorText}\n helpText={helpText}\n hideFormHint={true}\n type={currentInputType}\n size={size}\n valueComponentType=\"heading\"\n />\n </BaseBox>,\n );\n }\n return inputs;\n };\n\n return (\n <BaseBox\n {...metaAttribute({ name: MetaConstants.OTPInput, testID })}\n {...getStyledProps(styledProps)}\n >\n <BaseBox\n display=\"flex\"\n flexDirection={isLabelLeftPositioned ? 'row' : 'column'}\n alignItems={isLabelLeftPositioned ? 'center' : undefined}\n position=\"relative\"\n >\n {Boolean(label) && (\n <FormLabel as=\"label\" position={labelPosition} htmlFor={inputId} size={size}>\n {label}\n </FormLabel>\n )}\n <BaseBox display=\"flex\" flexDirection=\"row\">\n {getHiddenInput()}\n {getOTPInputFields()}\n </BaseBox>\n </BaseBox>\n {/* the magic number 136 is basically max-width of label i.e 120 and then right margin i.e 16 which is the spacing between label and input field */}\n {/*Refer `BaseInput`'s implementation of FormHint which uses similar logic */}\n <BaseBox marginLeft={makeSize(isLabelLeftPositioned ? 136 : 0)}>\n <FormHint\n type={getHintType({ validationState, hasHelpText: Boolean(helpText) })}\n helpText={helpText}\n errorText={errorText}\n successText={successText}\n helpTextId={helpTextId}\n errorTextId={errorTextId}\n successTextId={successTextId}\n size={size}\n />\n </BaseBox>\n </BaseBox>\n );\n};\n\nconst OTPInput = React.forwardRef<HTMLInputElement[], OTPInputProps>(_OTPInput);\n\nexport type { OTPInputProps };\nexport { OTPInput };\n"],"names":["isReactNative","getPlatformType","otpToArray","code","_code$split","split","Array","fill","_OTPInput","_ref","incomingRef","autoFocus","errorText","helpText","isDisabled","keyboardReturnKeyType","_ref$keyboardType","keyboardType","label","accessibilityLabel","labelPosition","name","onChange","onFocus","onBlur","onOTPFilled","_ref$otpLength","otpLength","placeholder","successText","validationState","inputValue","value","isMasked","_ref$autoCompleteSugg","autoCompleteSuggestionType","testID","_ref$size","size","styledProps","_objectWithoutProperties","_excluded","inputRefs","_useState","useState","_useState2","_slicedToArray","otpValue","setOtpValue","_useState3","_useState4","inputType","setInputType","isLabelLeftPositioned","_useFormId","useFormId","inputId","helpTextId","errorTextId","successTextId","useImperativeHandle","map","ref","current","useEffect","length","slice","join","forEach","otp","index","isEmpty","newInputType","from","undefined","setOtpValueByIndex","_ref2","newOtpValue","focusOnOtpByIndex","_inputRefs$index","_inputRefs$index$curr","focus","_inputRefs$index2","_inputRefs$index2$cur","select","handleOnChange","_ref3","currentOtpIndex","trim","_value$trim","newValue","handleOnInput","_ref4","handleOnKeyDown","_ref5","key","event","_event$preventDefault","preventDefault","call","_event$preventDefault2","_event$preventDefault3","_event$preventDefault4","getHiddenInput","_ref6","_jsx","hidden","id","readOnly","getOTPInputFields","inputs","_loop","_otpValue$index","_Array$from$index","currentValue","React","createRef","currentInputType","push","BaseBox","flex","marginLeft","children","BaseInput","concat","hideLabelText","textAlign","maxCharacters","formEvent","_objectSpread","inputIndex","onInput","onKeyDown","keyboardEvent","isRequired","hideFormHint","type","valueComponentType","_jsxs","metaAttribute","MetaConstants","OTPInput","getStyledProps","display","flexDirection","alignItems","position","Boolean","FormLabel","as","htmlFor","makeSize","FormHint","getHintType","hasHelpText","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAoHA,IAAMA,aAAa,GAAGC,eAAe,EAAE,KAAK,cAAc,CAAA;;AAE1D;AACA;AACA;AACA,IAAMC,UAAU,GAAG,SAAbA,UAAUA,CAAIC,IAAa,EAAA;AAAA,EAAA,IAAAC,WAAA,CAAA;EAAA,OAAAA,CAAAA,WAAA,GAAeD,IAAI,KAAJA,IAAAA,IAAAA,IAAI,uBAAJA,IAAI,CAAEE,KAAK,CAAC,EAAE,CAAC,cAAAD,WAAA,KAAA,KAAA,CAAA,GAAAA,WAAA,GAAIE,KAAK,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC,EAAE,CAAC,CAAA;AAAA,CAAA,CAAA;;AAEpF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMC,SAA4E,GAAG,SAA/EA,SAA4EA,CAAAC,IAAA,EA2BhFC,WAAW,EACR;AAAA,EAAA,IA1BDC,SAAS,GAAAF,IAAA,CAATE,SAAS;IACTC,SAAS,GAAAH,IAAA,CAATG,SAAS;IACTC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;IACRC,UAAU,GAAAL,IAAA,CAAVK,UAAU;IACVC,qBAAqB,GAAAN,IAAA,CAArBM,qBAAqB;IAAAC,iBAAA,GAAAP,IAAA,CACrBQ,YAAY;AAAZA,IAAAA,YAAY,GAAAD,iBAAA,KAAG,KAAA,CAAA,GAAA,SAAS,GAAAA,iBAAA;IACxBE,KAAK,GAAAT,IAAA,CAALS,KAAK;IACLC,kBAAkB,GAAAV,IAAA,CAAlBU,kBAAkB;IAClBC,aAAa,GAAAX,IAAA,CAAbW,aAAa;IACbC,IAAI,GAAAZ,IAAA,CAAJY,IAAI;IACJC,QAAQ,GAAAb,IAAA,CAARa,QAAQ;IACRC,QA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;AAEd,CAAC,CAAA;AAED,IAAMuG,QAAQ,gBAAG1B,cAAK,CAACwC,UAAU,CAAoCnJ,SAAS;;;;"}
|
|
1
|
+
{"version":3,"file":"OTPInput.js","sources":["../../../../../../../src/components/Input/OTPInput/OTPInput.tsx"],"sourcesContent":["import React, { useEffect, useImperativeHandle, useState } from 'react';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { getHintType } from '../BaseInput/BaseInput';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport type { FormInputOnEvent } from '~components/Form';\nimport { FormHint, FormLabel } from '~components/Form';\nimport { useFormId } from '~components/Form/useFormId';\nimport type { FormInputOnKeyDownEvent } from '~components/Form/FormTypes';\nimport BaseBox from '~components/Box/BaseBox';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { getPlatformType } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { makeSize } from '~utils/makeSize';\nimport type { DataAnalyticsAttribute } from '~utils/types';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype FormInputOnEventWithIndex = ({\n name,\n value,\n inputIndex,\n}: {\n name?: string;\n value?: string;\n inputIndex: number;\n}) => void;\n\nexport type OTPInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'validationState'\n | 'helpText'\n | 'errorText'\n | 'successText'\n | 'name'\n | 'onChange'\n | 'value'\n | 'isDisabled'\n | 'autoFocus'\n | 'keyboardReturnKeyType'\n | 'keyboardType'\n | 'placeholder'\n | 'testID'\n | 'size'\n | keyof DataAnalyticsAttribute\n> & {\n /**\n * Determines the number of input fields to show for the OTP\n * @default 6\n */\n otpLength?: 4 | 6;\n /**\n * The callback function to be invoked when all the values of the OTPInput are filled\n */\n onOTPFilled?: FormInputOnEvent;\n /**\n * Masks input characters in all the fields\n */\n isMasked?: boolean;\n /**\n * Determines what autoComplete suggestion type to show. Defaults to `oneTimeCode`.\n *\n * It's not recommended to turn this off in favor of otp input practices.\n *\n *\n * Internally it'll render platform specific attributes:\n *\n * - web: `autocomplete`\n * - iOS: `textContentType`\n * - android: `autoComplete`\n *\n */\n autoCompleteSuggestionType?: Extract<\n BaseInputProps['autoCompleteSuggestionType'],\n 'none' | 'oneTimeCode'\n >;\n /**\n * The callback function to be invoked when one of the input fields gets focus\n */\n onFocus?: FormInputOnEventWithIndex;\n /**\n * The callback function to be invoked when one of the input fields is blurred\n */\n onBlur?: FormInputOnEventWithIndex;\n} & StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype OTPInputPropsWithA11yLabel = {\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 OTPInputPropsWithLabel = {\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 OTPInputProps = (OTPInputPropsWithA11yLabel | OTPInputPropsWithLabel) & OTPInputCommonProps;\n\nconst isReactNative = getPlatformType() === 'react-native';\n\n/**\n * Converts a string value of otp to array if passed otherwise returns an array of 6 empty strings\n */\nconst otpToArray = (code?: string): string[] => code?.split('') ?? Array(6).fill('');\n\n/**\n * OTPInput component can be used for accepting OTPs sent to users for authentication/verification purposes.\n *\n * ## Usage\n *\n * ```tsx\n * <OTPInput\n * label=\"Enter OTP\"\n * name=\"otpInput\"\n * onChange={({ name, value }): void => console.log({ name, value })}\n * onOTPFilled={({ name, value }): void => console.log({ name, value })}\n * />\n * ```\n */\nconst _OTPInput: React.ForwardRefRenderFunction<HTMLInputElement[], OTPInputProps> = (\n {\n autoFocus,\n errorText,\n helpText,\n isDisabled,\n keyboardReturnKeyType,\n keyboardType = 'decimal',\n label,\n accessibilityLabel,\n labelPosition,\n name,\n onChange,\n onFocus,\n onBlur,\n onOTPFilled,\n otpLength = 6,\n placeholder,\n successText,\n validationState,\n value: inputValue,\n isMasked,\n autoCompleteSuggestionType = 'oneTimeCode',\n testID,\n size = 'medium',\n ...rest\n },\n incomingRef,\n) => {\n const inputRefs: React.RefObject<HTMLInputElement>[] = [];\n const [otpValue, setOtpValue] = useState<string[]>(otpToArray(inputValue));\n const [inputType, setInputType] = useState<('password' | undefined)[]>([]);\n const isLabelLeftPositioned = labelPosition === 'left';\n const { inputId, helpTextId, errorTextId, successTextId } = useFormId('otp');\n\n useImperativeHandle(\n incomingRef,\n () => {\n return inputRefs.map((ref) => ref.current!);\n },\n [inputRefs],\n );\n\n useEffect(() => {\n // Effect for calling `onOTPFilled` callback\n if (inputValue && inputValue.length >= otpLength) {\n // callback for when the OTPInput is controlled and inputValue reaches the same or greater length as the otpLength\n onOTPFilled?.({ value: inputValue.slice(0, otpLength), name });\n } else if (!inputValue && otpValue.join('').length >= otpLength) {\n // callback for when the OTPInput is uncontrolled and otpValue stored in state reaches the same or greater length as the otpLength\n onOTPFilled?.({ value: otpValue.slice(0, otpLength).join(''), name });\n }\n }, [otpValue, otpLength, name, inputValue, onOTPFilled]);\n\n useEffect(() => {\n /* We want to disable the password managers for OTPInput when isMasked is set.\n The issue with only setting autocomplete='off' is that its not an enforcement but a suggestion to the browser to follow.\n This workaround unsets type on first render and sets it to `password` only once a value is entered by the user.\n */\n otpValue.forEach((otp, index) => {\n // Set inputType as 'password' only when a value is entered when isMasked is set\n if (!isEmpty(otp) && !inputType[index] && isMasked) {\n const newInputType = Array.from(inputType);\n newInputType[index] = 'password';\n setInputType(newInputType);\n }\n // Cleanup the inputType array whenever the value is empty but inputType[index] is set\n if (isEmpty(otp) && inputType[index]) {\n const newInputType = Array.from(inputType);\n newInputType[index] = undefined;\n setInputType(newInputType);\n }\n });\n }, [otpValue, inputType, isMasked]);\n\n /**\n * Changes the value of the otp at a given index and updates the otpValue stored in state\n *\n * @param {{ value: string; index: number }} { value, index }\n * @returns {string} updated otpValue\n */\n const setOtpValueByIndex = ({ value, index }: { value: string; index: number }): string => {\n const newOtpValue = Array.from(otpValue);\n newOtpValue[index] = value;\n setOtpValue(newOtpValue);\n return newOtpValue.join('');\n };\n\n /**\n * Sets focus to the desired otp input by index\n *\n * @param {number} index the index of the otp input to be focused\n */\n const focusOnOtpByIndex = (index: number): void => {\n inputRefs[index]?.current?.focus();\n if (!isReactNative) {\n // React Native doesn't support imperatively selecting the value of input\n inputRefs[index]?.current?.select();\n }\n };\n\n const handleOnChange = ({\n value,\n currentOtpIndex,\n }: {\n value?: string;\n currentOtpIndex: number;\n }): void => {\n if (value && value === ' ') {\n // React native doesn't support `event.preventDefault()` hence have to add this check to ensure that empty space is not allowed\n return;\n }\n if (inputValue && inputValue.length > 0) {\n // When OTPInput is controlled, set the otpValue as the consumer passed `inputValue` and append the value on current index based on user's input.\n // User's input will not reflect on the otp but will trigger `onChange` callback with the user's input appended so that the consumer can take appropriate action.\n const newOtpValue = Array.from(inputValue);\n newOtpValue[currentOtpIndex] = value ?? '';\n setOtpValue(newOtpValue);\n onChange?.({ name, value: newOtpValue.join('') });\n } else if (value && value.trim().length > 1) {\n // When the entered value is more that 1 character (when value is pasted), set the otpValue to the newly received value.\n // Could have used `onPaste` for web to achieve this but 1. React Native doesn't support onPaste and 2. Safari's autofill on web doesn't trigger onPaste\n setOtpValue(Array.from(value));\n onChange?.({ name, value: value.trim().slice(0, otpLength) });\n } else if (otpValue[currentOtpIndex] !== value?.trim()) {\n // Set the value at the current index to the entered value\n // only as long as its not the same as the already existing value (this prevents `onChange` being triggered unnecessarily)\n const newValue = setOtpValueByIndex({\n value: value?.trim() ?? '',\n index: currentOtpIndex,\n });\n onChange?.({ name, value: newValue });\n }\n };\n\n const handleOnInput = ({\n value,\n currentOtpIndex,\n }: {\n value?: string;\n currentOtpIndex: number;\n }): void => {\n // Moves focus to next input whenever a value is entered in the current input\n if (value && value.trim().length === 1) {\n focusOnOtpByIndex(++currentOtpIndex);\n }\n };\n\n const handleOnKeyDown = ({\n key,\n code,\n event,\n currentOtpIndex,\n }: FormInputOnKeyDownEvent & { currentOtpIndex: number }): void => {\n if (key === 'Backspace' || code === 'Backspace' || code === 'Delete' || key === 'Delete') {\n event.preventDefault?.();\n handleOnChange({ value: '', currentOtpIndex });\n focusOnOtpByIndex(--currentOtpIndex);\n } else if (key === 'ArrowLeft' || code === 'ArrowLeft') {\n event.preventDefault?.();\n focusOnOtpByIndex(--currentOtpIndex);\n } else if (key === 'ArrowRight' || code === 'ArrowRight') {\n event.preventDefault?.();\n focusOnOtpByIndex(++currentOtpIndex);\n } else if (key === ' ' || code === 'Space') {\n event.preventDefault?.();\n }\n };\n\n const getHiddenInput = (): React.ReactNode => {\n if (!isReactNative) {\n return (\n <input\n hidden={true}\n id={inputId}\n name={name}\n value={inputValue ?? otpValue.join('') ?? ''}\n readOnly\n />\n );\n }\n return null;\n };\n\n const getOTPInputFields = (): React.ReactNode => {\n const inputs = [];\n for (let index = 0; index < otpLength; index++) {\n const currentValue = inputValue ? otpToArray(inputValue)[index] || '' : otpValue[index] || '';\n const ref = React.createRef<HTMLInputElement>();\n // if an inputValue is passed (controlled) and isMasked is set, inputType will always be password\n let currentInputType: 'password' | undefined;\n if (isMasked) {\n // if inputValue is passed (controlled component) then the inputType will always be password\n currentInputType = inputValue ? 'password' : inputType[index];\n }\n inputRefs.push(ref);\n inputs.push(\n <BaseBox\n flex={1}\n marginLeft={index == 0 ? 'spacing.0' : 'spacing.3'}\n key={`${inputId}-${index}`}\n >\n <BaseInput\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus && index === 0}\n accessibilityLabel={`${index === 0 ? label || accessibilityLabel : ''} character ${\n index + 1\n }`}\n label={label}\n hideLabelText={true}\n id={`${inputId}-${index}`}\n textAlign=\"center\"\n ref={ref as never}\n name={name}\n value={currentValue}\n maxCharacters={otpValue[index]?.length > 0 ? 1 : undefined}\n onChange={(formEvent) => handleOnChange({ ...formEvent, currentOtpIndex: index })}\n onFocus={(formEvent) => onFocus?.({ ...formEvent, inputIndex: index })}\n onBlur={(formEvent) => onBlur?.({ ...formEvent, inputIndex: index })}\n onInput={(formEvent) => handleOnInput({ ...formEvent, currentOtpIndex: index })}\n onKeyDown={(keyboardEvent) =>\n handleOnKeyDown({ ...keyboardEvent, currentOtpIndex: index })\n }\n isDisabled={isDisabled}\n placeholder={Array.from(placeholder ?? '')[index] ?? ''}\n isRequired={true}\n autoCompleteSuggestionType={autoCompleteSuggestionType}\n keyboardType={keyboardType}\n keyboardReturnKeyType={keyboardReturnKeyType}\n validationState={validationState}\n successText={successText}\n errorText={errorText}\n helpText={helpText}\n hideFormHint={true}\n type={currentInputType}\n size={size}\n valueComponentType=\"heading\"\n {...makeAnalyticsAttribute(rest)}\n />\n </BaseBox>,\n );\n }\n return inputs;\n };\n\n return (\n <BaseBox {...metaAttribute({ name: MetaConstants.OTPInput, testID })} {...getStyledProps(rest)}>\n <BaseBox\n display=\"flex\"\n flexDirection={isLabelLeftPositioned ? 'row' : 'column'}\n alignItems={isLabelLeftPositioned ? 'center' : undefined}\n position=\"relative\"\n >\n {Boolean(label) && (\n <FormLabel as=\"label\" position={labelPosition} htmlFor={inputId} size={size}>\n {label}\n </FormLabel>\n )}\n <BaseBox display=\"flex\" flexDirection=\"row\">\n {getHiddenInput()}\n {getOTPInputFields()}\n </BaseBox>\n </BaseBox>\n {/* the magic number 136 is basically max-width of label i.e 120 and then right margin i.e 16 which is the spacing between label and input field */}\n {/*Refer `BaseInput`'s implementation of FormHint which uses similar logic */}\n <BaseBox marginLeft={makeSize(isLabelLeftPositioned ? 136 : 0)}>\n <FormHint\n type={getHintType({ validationState, hasHelpText: Boolean(helpText) })}\n helpText={helpText}\n errorText={errorText}\n successText={successText}\n helpTextId={helpTextId}\n errorTextId={errorTextId}\n successTextId={successTextId}\n size={size}\n />\n </BaseBox>\n </BaseBox>\n );\n};\n\nconst OTPInput = React.forwardRef<HTMLInputElement[], OTPInputProps>(_OTPInput);\n\nexport type { OTPInputProps };\nexport { OTPInput };\n"],"names":["isReactNative","getPlatformType","otpToArray","code","_code$split","split","Array","fill","_OTPInput","_ref","incomingRef","autoFocus","errorText","helpText","isDisabled","keyboardReturnKeyType","_ref$keyboardType","keyboardType","label","accessibilityLabel","labelPosition","name","onChange","onFocus","onBlur","onOTPFilled","_ref$otpLength","otpLength","placeholder","successText","validationState","inputValue","value","isMasked","_ref$autoCompleteSugg","autoCompleteSuggestionType","testID","_ref$size","size","rest","_objectWithoutProperties","_excluded","inputRefs","_useState","useState","_useState2","_slicedToArray","otpValue","setOtpValue","_useState3","_useState4","inputType","setInputType","isLabelLeftPositioned","_useFormId","useFormId","inputId","helpTextId","errorTextId","successTextId","useImperativeHandle","map","ref","current","useEffect","length","slice","join","forEach","otp","index","isEmpty","newInputType","from","undefined","setOtpValueByIndex","_ref2","newOtpValue","focusOnOtpByIndex","_inputRefs$index","_inputRefs$index$curr","focus","_inputRefs$index2","_inputRefs$index2$cur","select","handleOnChange","_ref3","currentOtpIndex","trim","_value$trim","newValue","handleOnInput","_ref4","handleOnKeyDown","_ref5","key","event","_event$preventDefault","preventDefault","call","_event$preventDefault2","_event$preventDefault3","_event$preventDefault4","getHiddenInput","_ref6","_jsx","hidden","id","readOnly","getOTPInputFields","inputs","_loop","_otpValue$index","_Array$from$index","currentValue","React","createRef","currentInputType","push","BaseBox","flex","marginLeft","children","BaseInput","_objectSpread","concat","hideLabelText","textAlign","maxCharacters","formEvent","inputIndex","onInput","onKeyDown","keyboardEvent","isRequired","hideFormHint","type","valueComponentType","makeAnalyticsAttribute","_jsxs","metaAttribute","MetaConstants","OTPInput","getStyledProps","display","flexDirection","alignItems","position","Boolean","FormLabel","as","htmlFor","makeSize","FormHint","getHintType","hasHelpText","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuHA,IAAMA,aAAa,GAAGC,eAAe,EAAE,KAAK,cAAc,CAAA;;AAE1D;AACA;AACA;AACA,I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{
|
|
|
56
56
|
testID = _ref.testID,
|
|
57
57
|
_ref$size = _ref.size,
|
|
58
58
|
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
59
|
-
|
|
59
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
60
60
|
var _React$useState = React__default.useState(false),
|
|
61
61
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
62
62
|
isRevealed = _React$useState2[0],
|
|
@@ -125,7 +125,7 @@ var _PasswordInput = function _PasswordInput(_ref, ref) {
|
|
|
125
125
|
autoCapitalize: "none",
|
|
126
126
|
testID: testID,
|
|
127
127
|
size: size
|
|
128
|
-
},
|
|
128
|
+
}, rest));
|
|
129
129
|
};
|
|
130
130
|
|
|
131
131
|
// nosemgrep
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasswordInput.js","sources":["../../../../../../../src/components/Input/PasswordInput/PasswordInput.tsx"],"sourcesContent":["import React from 'react';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { EyeIcon, EyeOffIcon } from '~components/Icons';\nimport BaseBox from '~components/Box/BaseBox';\nimport { CharacterCounter } from '~components/Form/CharacterCounter';\nimport { IconButton } from '~components/Button/IconButton';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport type { BladeElementRef } from '~utils/types';\n\ntype PasswordInputExtraProps = {\n /**\n * Shows a reveal button to toggle password visibility\n *\n * @default true\n */\n showRevealButton?: boolean;\n\n /**\n * Displays asterisk (`*`) when `isRequired` is enabled\n *\n * @default none\n */\n necessityIndicator?: Exclude<BaseInputProps['necessityIndicator'], 'optional'>;\n\n /**\n * Determines what autoComplete suggestion type to show. Defaults to using platform heuristics.\n *\n * It's not recommended to turn this off in favor of safe password practices.\n * Providing `password` or `newPassword` is more informative to the platform for browser autofill or password managers.\n *\n * **Note**: Using `newPassword` on iOS has some [known issue](https://github.com/facebook/react-native/issues/21911) on React Native\n *\n * Internally it'll render platform specific attributes:\n *\n * - web: `autocomplete`\n * - iOS: `textContentType`\n * - android: `autoComplete`\n *\n */\n autoCompleteSuggestionType?: Extract<\n BaseInputProps['autoCompleteSuggestionType'],\n 'none' | 'password' | 'newPassword'\n >;\n};\n\ntype PasswordInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'maxCharacters'\n | 'validationState'\n | 'errorText'\n | 'successText'\n | 'helpText'\n | 'isDisabled'\n | 'defaultValue'\n | 'placeholder'\n | 'isRequired'\n | 'value'\n | 'onChange'\n | 'onBlur'\n | 'onSubmit'\n | 'onFocus'\n | 'name'\n | 'autoFocus'\n | 'keyboardReturnKeyType'\n | 'autoCompleteSuggestionType'\n | 'testID'\n | 'size'\n> &\n PasswordInputExtraProps &\n StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype PasswordInputPropsWithA11yLabel = {\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 PasswordInputPropsWithLabel = {\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 PasswordInputProps = (PasswordInputPropsWithA11yLabel | PasswordInputPropsWithLabel) &\n PasswordInputCommonProps;\n\nconst _PasswordInput: React.ForwardRefRenderFunction<BladeElementRef, PasswordInputProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition = 'top',\n showRevealButton = true,\n maxCharacters,\n validationState,\n errorText,\n successText,\n helpText,\n isDisabled = false,\n defaultValue,\n placeholder,\n isRequired = false,\n necessityIndicator = 'none',\n value,\n onChange,\n onFocus,\n onBlur,\n onSubmit,\n name,\n autoFocus = false,\n keyboardReturnKeyType = 'done',\n autoCompleteSuggestionType,\n testID,\n size = 'medium',\n ...styledProps\n },\n ref,\n) => {\n const [isRevealed, setIsRevealed] = React.useState(false);\n const isEnabled = !isDisabled;\n\n // If input is disabled reveal button shouldn't be present and input should be masked\n const isRevealedAndEnabled = isRevealed && isEnabled;\n\n const toggleIsRevealed = (): void => setIsRevealed((revealed) => !revealed);\n const iconAccessibilityLabel = isRevealedAndEnabled ? 'Hide password' : 'Show password';\n const type = isRevealedAndEnabled ? 'text' : 'password';\n\n const revealButtonIcon = isRevealedAndEnabled ? EyeOffIcon : EyeIcon;\n const revealButton =\n showRevealButton && !isDisabled ? (\n <IconButton\n size=\"medium\"\n icon={revealButtonIcon}\n onClick={toggleIsRevealed}\n accessibilityLabel={iconAccessibilityLabel}\n />\n ) : null;\n\n const trailingFooterSlot = (value?: string): React.ReactNode =>\n maxCharacters ? (\n <BaseBox marginTop=\"spacing.2\" marginRight=\"spacing.1\">\n <CharacterCounter currentCount={value?.length ?? 0} maxCount={maxCharacters} />\n </BaseBox>\n ) : null;\n\n return (\n <BaseInput\n ref={ref}\n componentName={MetaConstants.PasswordInput}\n id=\"password-field\"\n label={label as string}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n type={type}\n trailingInteractionElement={revealButton}\n trailingFooterSlot={trailingFooterSlot}\n maxCharacters={maxCharacters}\n validationState={validationState}\n errorText={errorText}\n successText={successText}\n helpText={helpText}\n isDisabled={isDisabled}\n defaultValue={defaultValue}\n placeholder={placeholder}\n isRequired={isRequired}\n necessityIndicator={necessityIndicator}\n value={value}\n onChange={onChange}\n onBlur={onBlur}\n onSubmit={onSubmit}\n onFocus={onFocus}\n name={name}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n autoCompleteSuggestionType={autoCompleteSuggestionType}\n keyboardReturnKeyType={keyboardReturnKeyType}\n autoCapitalize=\"none\"\n testID={testID}\n size={size}\n {...styledProps}\n />\n );\n};\n\n// nosemgrep\nconst PasswordInput = assignWithoutSideEffects(React.forwardRef(_PasswordInput), {\n displayName: 'PasswordInput',\n});\n\nexport type { PasswordInputProps };\nexport { PasswordInput };\n"],"names":["_PasswordInput","_ref","ref","label","accessibilityLabel","_ref$labelPosition","labelPosition","_ref$showRevealButton","showRevealButton","maxCharacters","validationState","errorText","successText","helpText","_ref$isDisabled","isDisabled","defaultValue","placeholder","_ref$isRequired","isRequired","_ref$necessityIndicat","necessityIndicator","value","onChange","onFocus","onBlur","onSubmit","name","_ref$autoFocus","autoFocus","_ref$keyboardReturnKe","keyboardReturnKeyType","autoCompleteSuggestionType","testID","_ref$size","size","styledProps","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","isRevealed","setIsRevealed","isEnabled","isRevealedAndEnabled","toggleIsRevealed","revealed","iconAccessibilityLabel","type","revealButtonIcon","EyeOffIcon","EyeIcon","revealButton","_jsx","IconButton","icon","onClick","trailingFooterSlot","_value$length","BaseBox","marginTop","marginRight","children","CharacterCounter","currentCount","length","maxCount","BaseInput","_objectSpread","componentName","MetaConstants","PasswordInput","id","hideLabelText","Boolean","trailingInteractionElement","autoCapitalize","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA4GA,IAAMA,cAAmF,GAAG,SAAtFA,cAAmFA,CAAAC,IAAA,EA6BvFC,GAAG,EACA;AAAA,EAAA,IA5BDC,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;IAAAE,qBAAA,GAAAN,IAAA,CACrBO,gBAAgB;AAAhBA,IAAAA,gBAAgB,GAAAD,qBAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,qBAAA;IACvBE,aAAa,GAAAR,IAAA,CAAbQ,aAAa;IACbC,eAAe,GA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AAU,EAAEA,UAAW;AACvBE,IAAAA,kBAAkB,EAAEA,kBAAmB;AACvCC,IAAAA,KAAK,EAAEA,KAAM;AACbC,IAAAA,QAAQ,EAAEA,QAAS;AACnBE,IAAAA,MAAM,EAAEA,MAAO;AACfC,IAAAA,QAAQ,EAAEA,QAAS;AACnBF,IAAAA,OAAO,EAAEA,OAAQ;AACjBG,IAAAA,IAAI,EAAEA,IAAAA;AACN;AAAA;AACAE,IAAAA,SAAS,EAAEA,SAAU;AACrBG,IAAAA,0BAA0B,EAAEA,0BAA2B;AACvDD,IAAAA,qBAAqB,EAAEA,qBAAsB;AAC7CgD,IAAAA,cAAc,EAAC,MAAM;AACrB9C,IAAAA,MAAM,EAAEA,MAAO;AACfE,IAAAA,IAAI,EAAEA,IAAAA;GACFC,EAAAA,WAAW,CAChB,CAAC,CAAA;AAEN,CAAC,CAAA;;AAED;AACMsC,IAAAA,aAAa,gBAAGM,wBAAwB,eAACxC,cAAK,CAACyC,UAAU,CAACjF,cAAc,CAAC,EAAE;AAC/EkF,EAAAA,WAAW,EAAE,eAAA;AACf,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"PasswordInput.js","sources":["../../../../../../../src/components/Input/PasswordInput/PasswordInput.tsx"],"sourcesContent":["import React from 'react';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { EyeIcon, EyeOffIcon } from '~components/Icons';\nimport BaseBox from '~components/Box/BaseBox';\nimport { CharacterCounter } from '~components/Form/CharacterCounter';\nimport { IconButton } from '~components/Button/IconButton';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport type { DataAnalyticsAttribute, BladeElementRef } from '~utils/types';\n\ntype PasswordInputExtraProps = {\n /**\n * Shows a reveal button to toggle password visibility\n *\n * @default true\n */\n showRevealButton?: boolean;\n\n /**\n * Displays asterisk (`*`) when `isRequired` is enabled\n *\n * @default none\n */\n necessityIndicator?: Exclude<BaseInputProps['necessityIndicator'], 'optional'>;\n\n /**\n * Determines what autoComplete suggestion type to show. Defaults to using platform heuristics.\n *\n * It's not recommended to turn this off in favor of safe password practices.\n * Providing `password` or `newPassword` is more informative to the platform for browser autofill or password managers.\n *\n * **Note**: Using `newPassword` on iOS has some [known issue](https://github.com/facebook/react-native/issues/21911) on React Native\n *\n * Internally it'll render platform specific attributes:\n *\n * - web: `autocomplete`\n * - iOS: `textContentType`\n * - android: `autoComplete`\n *\n */\n autoCompleteSuggestionType?: Extract<\n BaseInputProps['autoCompleteSuggestionType'],\n 'none' | 'password' | 'newPassword'\n >;\n};\n\ntype PasswordInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'maxCharacters'\n | 'validationState'\n | 'errorText'\n | 'successText'\n | 'helpText'\n | 'isDisabled'\n | 'defaultValue'\n | 'placeholder'\n | 'isRequired'\n | 'value'\n | 'onChange'\n | 'onBlur'\n | 'onSubmit'\n | 'onFocus'\n | 'name'\n | 'autoFocus'\n | 'keyboardReturnKeyType'\n | 'autoCompleteSuggestionType'\n | 'testID'\n | 'size'\n | keyof DataAnalyticsAttribute\n> &\n PasswordInputExtraProps &\n StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype PasswordInputPropsWithA11yLabel = {\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 PasswordInputPropsWithLabel = {\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 PasswordInputProps = (PasswordInputPropsWithA11yLabel | PasswordInputPropsWithLabel) &\n PasswordInputCommonProps;\n\nconst _PasswordInput: React.ForwardRefRenderFunction<BladeElementRef, PasswordInputProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition = 'top',\n showRevealButton = true,\n maxCharacters,\n validationState,\n errorText,\n successText,\n helpText,\n isDisabled = false,\n defaultValue,\n placeholder,\n isRequired = false,\n necessityIndicator = 'none',\n value,\n onChange,\n onFocus,\n onBlur,\n onSubmit,\n name,\n autoFocus = false,\n keyboardReturnKeyType = 'done',\n autoCompleteSuggestionType,\n testID,\n size = 'medium',\n ...rest\n },\n ref,\n) => {\n const [isRevealed, setIsRevealed] = React.useState(false);\n const isEnabled = !isDisabled;\n\n // If input is disabled reveal button shouldn't be present and input should be masked\n const isRevealedAndEnabled = isRevealed && isEnabled;\n\n const toggleIsRevealed = (): void => setIsRevealed((revealed) => !revealed);\n const iconAccessibilityLabel = isRevealedAndEnabled ? 'Hide password' : 'Show password';\n const type = isRevealedAndEnabled ? 'text' : 'password';\n\n const revealButtonIcon = isRevealedAndEnabled ? EyeOffIcon : EyeIcon;\n const revealButton =\n showRevealButton && !isDisabled ? (\n <IconButton\n size=\"medium\"\n icon={revealButtonIcon}\n onClick={toggleIsRevealed}\n accessibilityLabel={iconAccessibilityLabel}\n />\n ) : null;\n\n const trailingFooterSlot = (value?: string): React.ReactNode =>\n maxCharacters ? (\n <BaseBox marginTop=\"spacing.2\" marginRight=\"spacing.1\">\n <CharacterCounter currentCount={value?.length ?? 0} maxCount={maxCharacters} />\n </BaseBox>\n ) : null;\n\n return (\n <BaseInput\n ref={ref}\n componentName={MetaConstants.PasswordInput}\n id=\"password-field\"\n label={label as string}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n type={type}\n trailingInteractionElement={revealButton}\n trailingFooterSlot={trailingFooterSlot}\n maxCharacters={maxCharacters}\n validationState={validationState}\n errorText={errorText}\n successText={successText}\n helpText={helpText}\n isDisabled={isDisabled}\n defaultValue={defaultValue}\n placeholder={placeholder}\n isRequired={isRequired}\n necessityIndicator={necessityIndicator}\n value={value}\n onChange={onChange}\n onBlur={onBlur}\n onSubmit={onSubmit}\n onFocus={onFocus}\n name={name}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n autoCompleteSuggestionType={autoCompleteSuggestionType}\n keyboardReturnKeyType={keyboardReturnKeyType}\n autoCapitalize=\"none\"\n testID={testID}\n size={size}\n {...rest}\n />\n );\n};\n\n// nosemgrep\nconst PasswordInput = assignWithoutSideEffects(React.forwardRef(_PasswordInput), {\n displayName: 'PasswordInput',\n});\n\nexport type { PasswordInputProps };\nexport { PasswordInput };\n"],"names":["_PasswordInput","_ref","ref","label","accessibilityLabel","_ref$labelPosition","labelPosition","_ref$showRevealButton","showRevealButton","maxCharacters","validationState","errorText","successText","helpText","_ref$isDisabled","isDisabled","defaultValue","placeholder","_ref$isRequired","isRequired","_ref$necessityIndicat","necessityIndicator","value","onChange","onFocus","onBlur","onSubmit","name","_ref$autoFocus","autoFocus","_ref$keyboardReturnKe","keyboardReturnKeyType","autoCompleteSuggestionType","testID","_ref$size","size","rest","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","isRevealed","setIsRevealed","isEnabled","isRevealedAndEnabled","toggleIsRevealed","revealed","iconAccessibilityLabel","type","revealButtonIcon","EyeOffIcon","EyeIcon","revealButton","_jsx","IconButton","icon","onClick","trailingFooterSlot","_value$length","BaseBox","marginTop","marginRight","children","CharacterCounter","currentCount","length","maxCount","BaseInput","_objectSpread","componentName","MetaConstants","PasswordInput","id","hideLabelText","Boolean","trailingInteractionElement","autoCapitalize","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA6GA,IAAMA,cAAmF,GAAG,SAAtFA,cAAmFA,CAAAC,IAAA,EA6BvFC,GAAG,EACA;AAAA,EAAA,IA5BDC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,kBAAkB,GAAAH,IAAA,CAAlBG,kBAAkB;IAAAC,kBAAA,GAAAJ,IAAA,CAClBK,aAAa;AAAbA,IAAAA,aAAa,GAAAD,kBA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,eAAgB;AACjCC,IAAAA,SAAS,EAAEA,SAAU;AACrBC,IAAAA,WAAW,EAAEA,WAAY;AACzBC,IAAAA,QAAQ,EAAEA,QAAS;AACnBE,IAAAA,UAAU,EAAEA,UAAW;AACvBC,IAAAA,YAAY,EAAEA,YAAa;AAC3BC,IAAAA,WAAW,EAAEA,WAAY;AACzBE,IAAAA,UAAU,EAAEA,UAAW;AACvBE,IAAAA,kBAAkB,EAAEA,kBAAmB;AACvCC,IAAAA,KAAK,EAAEA,KAAM;AACbC,IAAAA,QAAQ,EAAEA,QAAS;AACnBE,IAAAA,MAAM,EAAEA,MAAO;AACfC,IAAAA,QAAQ,EAAEA,QAAS;AACnBF,IAAAA,OAAO,EAAEA,OAAQ;AACjBG,IAAAA,IAAI,EAAEA,IAAAA;AACN;AAAA;AACAE,IAAAA,SAAS,EAAEA,SAAU;AACrBG,IAAAA,0BAA0B,EAAEA,0BAA2B;AACvDD,IAAAA,qBAAqB,EAAEA,qBAAsB;AAC7CgD,IAAAA,cAAc,EAAC,MAAM;AACrB9C,IAAAA,MAAM,EAAEA,MAAO;AACfE,IAAAA,IAAI,EAAEA,IAAAA;GACFC,EAAAA,IAAI,CACT,CAAC,CAAA;AAEN,CAAC,CAAA;;AAED;AACMsC,IAAAA,aAAa,gBAAGM,wBAAwB,eAACxC,cAAK,CAACyC,UAAU,CAACjF,cAAc,CAAC,EAAE;AAC/EkF,EAAAA,WAAW,EAAE,eAAA;AACf,CAAC;;;;"}
|
|
@@ -62,7 +62,7 @@ var _PhoneNumberInput = function _PhoneNumberInput(_ref, ref) {
|
|
|
62
62
|
autoCompleteSuggestionType = _ref.autoCompleteSuggestionType,
|
|
63
63
|
allowedCountries = _ref.allowedCountries,
|
|
64
64
|
placeholder = _ref.placeholder,
|
|
65
|
-
|
|
65
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
66
66
|
var inputRef = React__default.useRef(null);
|
|
67
67
|
var mergedRef = useMergeRefs(ref, inputRef);
|
|
68
68
|
var inputWrapperRef = React__default.useRef(null);
|
|
@@ -225,7 +225,7 @@ var _PhoneNumberInput = function _PhoneNumberInput(_ref, ref) {
|
|
|
225
225
|
autoCapitalize: 'none'
|
|
226
226
|
})), {}, {
|
|
227
227
|
type: "telephone"
|
|
228
|
-
},
|
|
228
|
+
}, rest));
|
|
229
229
|
};
|
|
230
230
|
|
|
231
231
|
/**
|
package/build/lib/web/production/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,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,GAAAvB,IAAA,CAAlBuB,kBAAkB;IAAAC,qBAAA,GAAAxB,IAAA,CAClByB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K,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,E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QAAAA,KAAK,EAALA,KAAK;AAAEiD,QAAAA,eAAe,EAAfA,eAAAA;AAAgB,OAAC,CAAC,CAAA;KAChD;AACF9B,IAAAA,OAAO,EAAEA,OAAQ;AACjBE,IAAAA,OAAO,EAAEA,OAAQ;AACjBD,IAAAA,MAAM,EAAEA,MAAO;AACff,IAAAA,UAAU,EAAEA,UAAW;AACvBkB,IAAAA,kBAAkB,EAAEA,kBAAmB;AACvCpB,IAAAA,kBAAkB,EAAEA,kBAAmB;AACvCC,IAAAA,UAAU,EAAEA,UAAW;AACvBI,IAAAA,eAAe,EAAEA,eAAgB;AACjCC,IAAAA,SAAS,EAAEA,SAAU;AACrBC,IAAAA,QAAQ,EAAEA,QAAS;AACnBC,IAAAA,WAAW,EAAEA,WAAAA;AACb;AAAA;AACAa,IAAAA,SAAS,EAAEA,SAAU;AACrBC,IAAAA,MAAM,EAAEA,MAAO;AACfZ,IAAAA,IAAI,EAAEA,IAAAA;AAAK,GAAA,EACP8F,+BAA+B,CAAC;AAClCC,IAAAA,IAAI,EAAE,QAAQ;AACdjF,IAAAA,qBAAqB,EAArBA,qBAAqB;AACrBC,IAAAA,0BAA0B,EAA1BA,0BAA0B;AAC1BiF,IAAAA,cAAc,EAAE,MAAA;AAClB,GAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AACFD,IAAAA,IAAI,EAAC,WAAA;GACD7E,EAAAA,IAAI,CACT,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;;;;"}
|
|
@@ -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":";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;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,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D,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'
|