@razorpay/blade 12.32.3 → 12.33.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lib/native/components/Accordion/AccordionButton.native.js +1 -1
- package/build/lib/native/components/Accordion/AccordionButton.native.js.map +1 -1
- package/build/lib/native/components/Accordion/AccordionItemHeader.js +2 -1
- package/build/lib/native/components/Accordion/AccordionItemHeader.js.map +1 -1
- package/build/lib/native/components/Accordion/commonStyles.js +1 -1
- package/build/lib/native/components/Accordion/commonStyles.js.map +1 -1
- package/build/lib/native/components/ActionList/ActionListItem.js +1 -1
- package/build/lib/native/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/native/components/ActionList/ActionListNoResults.js +2 -2
- package/build/lib/native/components/Alert/Alert.js +2 -2
- package/build/lib/native/components/BaseHeaderFooter/BaseHeader.js +4 -4
- package/build/lib/native/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
- package/build/lib/native/components/BottomSheet/BottomSheetCommon.js +3 -3
- package/build/lib/native/components/Button/BaseButton/BaseButton.js +1 -1
- package/build/lib/native/components/Button/BaseButton/BaseButton.js.map +1 -1
- package/build/lib/native/components/Button/BaseButton/buttonTokens.js +1 -1
- package/build/lib/native/components/Button/BaseButton/buttonTokens.js.map +1 -1
- package/build/lib/native/components/Carousel/NavigationButton/NavigationButton.js +2 -2
- package/build/lib/native/components/Collapsible/CollapsibleChevronIcon.native.js +2 -2
- package/build/lib/native/components/Dropdown/Dropdown.js +1 -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/InputDropdownButton.native.js +7 -0
- package/build/lib/native/components/Dropdown/InputDropdownButton.native.js.map +1 -0
- package/build/lib/native/components/Dropdown/dropdownComponentIds.js +1 -1
- package/build/lib/native/components/Dropdown/dropdownComponentIds.js.map +1 -1
- package/build/lib/native/components/Dropdown/useDropdown.js.map +1 -1
- package/build/lib/native/components/Form/FormHint.js +2 -2
- package/build/lib/native/components/Icons/ChevronUpDownIcon/ChevronUpDownIcon.js +12 -0
- package/build/lib/native/components/Icons/ChevronUpDownIcon/ChevronUpDownIcon.js.map +1 -0
- package/build/lib/native/components/Icons/useIconProps/iconSizeMap.js +8 -0
- package/build/lib/native/components/Icons/useIconProps/iconSizeMap.js.map +1 -0
- package/build/lib/native/components/Icons/useIconProps/useIconProps.js +2 -4
- package/build/lib/native/components/Icons/useIconProps/useIconProps.js.map +1 -1
- package/build/lib/native/components/InfoGroup/InfoGroup.native.js +7 -0
- package/build/lib/native/components/InfoGroup/InfoGroup.native.js.map +1 -0
- package/build/lib/native/components/Input/BaseInput/BaseInput.js +1 -1
- package/build/lib/native/components/Input/BaseInput/BaseInput.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/BaseInputVisuals.js +1 -1
- package/build/lib/native/components/Input/BaseInput/BaseInputVisuals.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/baseInputStyles.js +1 -1
- package/build/lib/native/components/Input/BaseInput/baseInputStyles.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/baseInputTokens.js +1 -1
- package/build/lib/native/components/Input/BaseInput/baseInputTokens.js.map +1 -1
- package/build/lib/native/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +2 -5
- package/build/lib/native/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
- package/build/lib/native/components/Input/DropdownInputTriggers/Chevron.js +2 -2
- package/build/lib/native/components/Input/PasswordInput/PasswordInput.js +2 -2
- package/build/lib/native/components/Input/SearchInput/SearchInput.js +14 -5
- package/build/lib/native/components/Input/SearchInput/SearchInput.js.map +1 -1
- package/build/lib/native/components/Input/TextArea/TextArea.js +2 -2
- package/build/lib/native/components/Input/TextInput/TextInput.js +13 -5
- package/build/lib/native/components/Input/TextInput/TextInput.js.map +1 -1
- package/build/lib/native/components/Popover/PopoverCloseButton.js +2 -2
- package/build/lib/native/components/Table/tokens.js +2 -2
- package/build/lib/native/components/Typography/Text/Text.js +1 -1
- package/build/lib/native/components/Typography/Text/Text.js.map +1 -1
- package/build/lib/native/components/index.js +3 -0
- package/build/lib/native/components/index.js.map +1 -1
- package/build/lib/native/utils/metaAttribute/metaConstants.js +1 -1
- package/build/lib/native/utils/metaAttribute/metaConstants.js.map +1 -1
- package/build/lib/native/utils/useControlledDropdownInput/useControlledDropdownInput.js +14 -0
- package/build/lib/native/utils/useControlledDropdownInput/useControlledDropdownInput.js.map +1 -0
- package/build/lib/web/development/components/Accordion/AccordionItemHeader.js +18 -2
- package/build/lib/web/development/components/Accordion/AccordionItemHeader.js.map +1 -1
- package/build/lib/web/development/components/Accordion/StyledAccordionButton.web.js +4 -3
- package/build/lib/web/development/components/Accordion/StyledAccordionButton.web.js.map +1 -1
- package/build/lib/web/development/components/Accordion/commonStyles.js +1 -11
- package/build/lib/web/development/components/Accordion/commonStyles.js.map +1 -1
- package/build/lib/web/development/components/ActionList/ActionListItem.js +2 -1
- package/build/lib/web/development/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/web/development/components/BaseHeaderFooter/BaseHeader.js +6 -3
- package/build/lib/web/development/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
- package/build/lib/web/development/components/Button/BaseButton/BaseButton.js +24 -3
- package/build/lib/web/development/components/Button/BaseButton/BaseButton.js.map +1 -1
- package/build/lib/web/development/components/Button/BaseButton/StyledBaseButton.web.js +14 -2
- package/build/lib/web/development/components/Button/BaseButton/StyledBaseButton.web.js.map +1 -1
- package/build/lib/web/development/components/Button/BaseButton/buttonTokens.js +19 -0
- package/build/lib/web/development/components/Button/BaseButton/buttonTokens.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/Dropdown.js +4 -1
- package/build/lib/web/development/components/Dropdown/Dropdown.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/DropdownButton.js +4 -1
- package/build/lib/web/development/components/Dropdown/DropdownButton.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/DropdownOverlay.web.js +4 -2
- package/build/lib/web/development/components/Dropdown/DropdownOverlay.web.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/InputDropdownButton.web.js +180 -0
- package/build/lib/web/development/components/Dropdown/InputDropdownButton.web.js.map +1 -0
- package/build/lib/web/development/components/Dropdown/dropdownComponentIds.js +2 -1
- package/build/lib/web/development/components/Dropdown/dropdownComponentIds.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/index.js +1 -0
- package/build/lib/web/development/components/Dropdown/index.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/useDropdown.js.map +1 -1
- package/build/lib/web/development/components/Icons/ChevronUpDownIcon/ChevronUpDownIcon.js +40 -0
- package/build/lib/web/development/components/Icons/ChevronUpDownIcon/ChevronUpDownIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/ChevronUpDownIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/ChevronUpDownIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/index.js +1 -0
- package/build/lib/web/development/components/Icons/index.js.map +1 -1
- package/build/lib/web/development/components/Icons/useIconProps/iconSizeMap.js +14 -0
- package/build/lib/web/development/components/Icons/useIconProps/iconSizeMap.js.map +1 -0
- package/build/lib/web/development/components/Icons/useIconProps/useIconProps.js +3 -12
- package/build/lib/web/development/components/Icons/useIconProps/useIconProps.js.map +1 -1
- package/build/lib/web/development/components/InfoGroup/InfoGroup.web.js +448 -0
- package/build/lib/web/development/components/InfoGroup/InfoGroup.web.js.map +1 -0
- package/build/lib/web/development/components/InfoGroup/InfoGroupContext.js +26 -0
- package/build/lib/web/development/components/InfoGroup/InfoGroupContext.js.map +1 -0
- package/build/lib/web/development/components/InfoGroup/index.js +3 -0
- package/build/lib/web/development/components/InfoGroup/index.js.map +1 -0
- package/build/lib/web/development/components/InfoGroup/infoGroupTokens.js +49 -0
- package/build/lib/web/development/components/InfoGroup/infoGroupTokens.js.map +1 -0
- package/build/lib/web/development/components/InfoGroup/types.js +2 -0
- package/build/lib/web/development/components/InfoGroup/types.js.map +1 -0
- package/build/lib/web/development/components/Input/BaseInput/BaseInput.js +10 -4
- package/build/lib/web/development/components/Input/BaseInput/BaseInput.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/BaseInputVisuals.js +32 -8
- package/build/lib/web/development/components/Input/BaseInput/BaseInputVisuals.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/StyledBaseInput.web.js +2 -1
- package/build/lib/web/development/components/Input/BaseInput/StyledBaseInput.web.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/baseInputStyles.js +8 -4
- package/build/lib/web/development/components/Input/BaseInput/baseInputStyles.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/baseInputTokens.js +1 -1
- package/build/lib/web/development/components/Input/BaseInput/baseInputTokens.js.map +1 -1
- package/build/lib/web/development/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +25 -124
- package/build/lib/web/development/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
- package/build/lib/web/development/components/Input/PhoneNumberInput/CountrySelector.web.js +6 -4
- package/build/lib/web/development/components/Input/PhoneNumberInput/CountrySelector.web.js.map +1 -1
- package/build/lib/web/development/components/Input/SearchInput/SearchInput.js +97 -30
- package/build/lib/web/development/components/Input/SearchInput/SearchInput.js.map +1 -1
- package/build/lib/web/development/components/Input/TextInput/TextInput.js +123 -31
- package/build/lib/web/development/components/Input/TextInput/TextInput.js.map +1 -1
- package/build/lib/web/development/components/Typography/Text/Text.js +0 -1
- package/build/lib/web/development/components/Typography/Text/Text.js.map +1 -1
- package/build/lib/web/development/components/index.js +4 -0
- package/build/lib/web/development/components/index.js.map +1 -1
- package/build/lib/web/development/utils/metaAttribute/metaConstants.js +5 -0
- package/build/lib/web/development/utils/metaAttribute/metaConstants.js.map +1 -1
- package/build/lib/web/development/utils/useControlledDropdownInput/index.js +2 -0
- package/build/lib/web/development/utils/useControlledDropdownInput/index.js.map +1 -0
- package/build/lib/web/development/utils/useControlledDropdownInput/useControlledDropdownInput.js +108 -0
- package/build/lib/web/development/utils/useControlledDropdownInput/useControlledDropdownInput.js.map +1 -0
- package/build/lib/web/production/components/Accordion/AccordionItemHeader.js +18 -2
- package/build/lib/web/production/components/Accordion/AccordionItemHeader.js.map +1 -1
- package/build/lib/web/production/components/Accordion/StyledAccordionButton.web.js +4 -3
- package/build/lib/web/production/components/Accordion/StyledAccordionButton.web.js.map +1 -1
- package/build/lib/web/production/components/Accordion/commonStyles.js +1 -11
- package/build/lib/web/production/components/Accordion/commonStyles.js.map +1 -1
- package/build/lib/web/production/components/ActionList/ActionListItem.js +2 -1
- package/build/lib/web/production/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/web/production/components/BaseHeaderFooter/BaseHeader.js +6 -3
- package/build/lib/web/production/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
- package/build/lib/web/production/components/Button/BaseButton/BaseButton.js +24 -3
- package/build/lib/web/production/components/Button/BaseButton/BaseButton.js.map +1 -1
- package/build/lib/web/production/components/Button/BaseButton/StyledBaseButton.web.js +14 -2
- package/build/lib/web/production/components/Button/BaseButton/StyledBaseButton.web.js.map +1 -1
- package/build/lib/web/production/components/Button/BaseButton/buttonTokens.js +19 -0
- package/build/lib/web/production/components/Button/BaseButton/buttonTokens.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/Dropdown.js +4 -1
- package/build/lib/web/production/components/Dropdown/Dropdown.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/DropdownButton.js +4 -1
- package/build/lib/web/production/components/Dropdown/DropdownButton.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/DropdownOverlay.web.js +4 -2
- package/build/lib/web/production/components/Dropdown/DropdownOverlay.web.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/InputDropdownButton.web.js +180 -0
- package/build/lib/web/production/components/Dropdown/InputDropdownButton.web.js.map +1 -0
- package/build/lib/web/production/components/Dropdown/dropdownComponentIds.js +2 -1
- package/build/lib/web/production/components/Dropdown/dropdownComponentIds.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/index.js +1 -0
- package/build/lib/web/production/components/Dropdown/index.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/useDropdown.js.map +1 -1
- package/build/lib/web/production/components/Icons/ChevronUpDownIcon/ChevronUpDownIcon.js +40 -0
- package/build/lib/web/production/components/Icons/ChevronUpDownIcon/ChevronUpDownIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/ChevronUpDownIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/ChevronUpDownIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/index.js +1 -0
- package/build/lib/web/production/components/Icons/index.js.map +1 -1
- package/build/lib/web/production/components/Icons/useIconProps/iconSizeMap.js +14 -0
- package/build/lib/web/production/components/Icons/useIconProps/iconSizeMap.js.map +1 -0
- package/build/lib/web/production/components/Icons/useIconProps/useIconProps.js +3 -12
- package/build/lib/web/production/components/Icons/useIconProps/useIconProps.js.map +1 -1
- package/build/lib/web/production/components/InfoGroup/InfoGroup.web.js +448 -0
- package/build/lib/web/production/components/InfoGroup/InfoGroup.web.js.map +1 -0
- package/build/lib/web/production/components/InfoGroup/InfoGroupContext.js +26 -0
- package/build/lib/web/production/components/InfoGroup/InfoGroupContext.js.map +1 -0
- package/build/lib/web/production/components/InfoGroup/index.js +3 -0
- package/build/lib/web/production/components/InfoGroup/index.js.map +1 -0
- package/build/lib/web/production/components/InfoGroup/infoGroupTokens.js +49 -0
- package/build/lib/web/production/components/InfoGroup/infoGroupTokens.js.map +1 -0
- package/build/lib/web/production/components/InfoGroup/types.js +2 -0
- package/build/lib/web/production/components/InfoGroup/types.js.map +1 -0
- package/build/lib/web/production/components/Input/BaseInput/BaseInput.js +10 -4
- package/build/lib/web/production/components/Input/BaseInput/BaseInput.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/BaseInputVisuals.js +32 -8
- package/build/lib/web/production/components/Input/BaseInput/BaseInputVisuals.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/StyledBaseInput.web.js +2 -1
- package/build/lib/web/production/components/Input/BaseInput/StyledBaseInput.web.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/baseInputStyles.js +8 -4
- package/build/lib/web/production/components/Input/BaseInput/baseInputStyles.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/baseInputTokens.js +1 -1
- package/build/lib/web/production/components/Input/BaseInput/baseInputTokens.js.map +1 -1
- package/build/lib/web/production/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +25 -124
- package/build/lib/web/production/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
- package/build/lib/web/production/components/Input/PhoneNumberInput/CountrySelector.web.js +6 -4
- package/build/lib/web/production/components/Input/PhoneNumberInput/CountrySelector.web.js.map +1 -1
- package/build/lib/web/production/components/Input/SearchInput/SearchInput.js +97 -30
- package/build/lib/web/production/components/Input/SearchInput/SearchInput.js.map +1 -1
- package/build/lib/web/production/components/Input/TextInput/TextInput.js +123 -31
- package/build/lib/web/production/components/Input/TextInput/TextInput.js.map +1 -1
- package/build/lib/web/production/components/Typography/Text/Text.js +0 -1
- package/build/lib/web/production/components/Typography/Text/Text.js.map +1 -1
- package/build/lib/web/production/components/index.js +4 -0
- package/build/lib/web/production/components/index.js.map +1 -1
- package/build/lib/web/production/utils/metaAttribute/metaConstants.js +5 -0
- package/build/lib/web/production/utils/metaAttribute/metaConstants.js.map +1 -1
- package/build/lib/web/production/utils/useControlledDropdownInput/index.js +2 -0
- package/build/lib/web/production/utils/useControlledDropdownInput/index.js.map +1 -0
- package/build/lib/web/production/utils/useControlledDropdownInput/useControlledDropdownInput.js +108 -0
- package/build/lib/web/production/utils/useControlledDropdownInput/useControlledDropdownInput.js.map +1 -0
- package/build/types/components/index.d.ts +4446 -3019
- package/build/types/components/index.native.d.ts +2782 -2661
- package/package.json +2 -2
|
@@ -22,7 +22,7 @@ import { mergeRefs } from '../../utils/useMergeRefs.js';
|
|
|
22
22
|
import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
|
|
23
23
|
import { jsx } from 'react/jsx-runtime';
|
|
24
24
|
|
|
25
|
-
var _excluded=["children","isOpen","onOpenChange","selectionType","testID","_width"];var validDropdownChildren=[dropdownComponentIds.BaseBox,dropdownComponentIds.triggers.SelectInput,dropdownComponentIds.triggers.SearchInput,dropdownComponentIds.triggers.DropdownButton,dropdownComponentIds.triggers.DropdownIconButton,dropdownComponentIds.triggers.DropdownLink,dropdownComponentIds.DropdownOverlay,dropdownComponentIds.triggers.AutoComplete,ComponentIds.BottomSheet,dropdownComponentIds.triggers.FilterChipSelectInput];var _Dropdown=function _Dropdown(_ref,ref){var children=_ref.children,isOpenControlled=_ref.isOpen,onOpenChange=_ref.onOpenChange,_ref$selectionType=_ref.selectionType,selectionType=_ref$selectionType===void 0?'single':_ref$selectionType,testID=_ref.testID,_width=_ref._width,rest=_objectWithoutProperties(_ref,_excluded);var _React$useState=React__default.useState([]),_React$useState2=_slicedToArray(_React$useState,2),options=_React$useState2[0],setOptions=_React$useState2[1];var _React$useState3=React__default.useState([]),_React$useState4=_slicedToArray(_React$useState3,2),filteredValues=_React$useState4[0],setFilteredValues=_React$useState4[1];var _React$useState5=React__default.useState([]),_React$useState6=_slicedToArray(_React$useState5,2),selectedIndices=_React$useState6[0],setSelectedIndices=_React$useState6[1];var _React$useState7=React__default.useState([]),_React$useState8=_slicedToArray(_React$useState7,2),controlledValueIndices=_React$useState8[0],setControlledValueIndices=_React$useState8[1];var _React$useState9=React__default.useState(-1),_React$useState10=_slicedToArray(_React$useState9,2),activeIndex=_React$useState10[0],setActiveIndex=_React$useState10[1];var _React$useState11=React__default.useState(-1),_React$useState12=_slicedToArray(_React$useState11,2),activeTagIndex=_React$useState12[0],setActiveTagIndex=_React$useState12[1];var _React$useState13=React__default.useState(false),_React$useState14=_slicedToArray(_React$useState13,2),shouldIgnoreBlurAnimation=_React$useState14[0],setShouldIgnoreBlurAnimation=_React$useState14[1];var _React$useState15=React__default.useState(false),_React$useState16=_slicedToArray(_React$useState15,2),hasFooterAction=_React$useState16[0],setHasFooterAction=_React$useState16[1];var _React$useState17=React__default.useState(false),_React$useState18=_slicedToArray(_React$useState17,2),hasAutoCompleteInHeader=_React$useState18[0],setHasAutoCompleteInHeader=_React$useState18[1];var _React$useState19=React__default.useState(false),_React$useState20=_slicedToArray(_React$useState19,2),isKeydownPressed=_React$useState20[0],setIsKeydownPressed=_React$useState20[1];var _React$useState21=React__default.useState(0),_React$useState22=_slicedToArray(_React$useState21,2),changeCallbackTriggerer=_React$useState22[0],setChangeCallbackTriggerer=_React$useState22[1];var _React$useState23=React__default.useState(false),_React$useState24=_slicedToArray(_React$useState23,2),isControlled=_React$useState24[0],setIsControlled=_React$useState24[1];var _React$useState25=React__default.useState(false),_React$useState26=_slicedToArray(_React$useState25,2),dropdownHasBottomSheet=_React$useState26[0],setDropdownHasBottomSheet=_React$useState26[1];var triggererWrapperRef=React__default.useRef(null);var triggererRef=React__default.useRef(null);var headerAutoCompleteRef=React__default.useRef(null);var actionListItemRef=React__default.useRef(null);var dropdownTriggerer=React__default.useRef();var isTagDismissedRef=React__default.useRef({value:false});var visibleTagsCountRef=React__default.useRef({value:0});var dropdownContainerRef=React__default.useRef(null);var dropdownBaseId=useId('dropdown');var isDropdownOpenRef=React__default.useRef(isOpenControlled);var _useControllableState=useControllableState({value:isOpenControlled,defaultValue:false,onChange:function onChange(isOpenControlledValue){isDropdownOpenRef.current=isOpenControlledValue;onOpenChange==null?void 0:onOpenChange(isOpenControlledValue);}}),_useControllableState2=_slicedToArray(_useControllableState,2),isDropdownOpen=_useControllableState2[0],setIsDropdownOpen=_useControllableState2[1];isDropdownOpenRef.current=isDropdownOpen;var setIsOpen=function setIsOpen(isOpenValue){isDropdownOpenRef.current=isOpenValue;setIsDropdownOpen(function(){return isOpenValue;});};var close=React__default.useCallback(function(){setActiveTagIndex(-1);setIsOpen(false);},[]);React__default.Children.map(children,function(child){if(React__default.isValidElement(child)){if(__DEV__){var _getComponentId;if(!validDropdownChildren.includes((_getComponentId=getComponentId(child))!=null?_getComponentId:'')){throwBladeError({message:`Dropdown can only have one of following elements as children - \n\n ${validDropdownChildren.join(', ')} \n\n Check out: https://blade.razorpay.com/?path=/story/components-dropdown`,moduleName:'Dropdown'});}}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.SelectInput)){dropdownTriggerer.current='SelectInput';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.SearchInput)){dropdownTriggerer.current='SearchInput';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.DropdownButton)){dropdownTriggerer.current='DropdownButton';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.DropdownIconButton)){dropdownTriggerer.current='DropdownIconButton';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.AutoComplete)){dropdownTriggerer.current='AutoComplete';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.FilterChipSelectInput)){dropdownTriggerer.current='FilterChipSelectInput';}}});var contextValue=React__default.useMemo(function(){return {isOpen:isDropdownOpen,setIsOpen:setIsOpen,close:close,selectedIndices:selectedIndices,setSelectedIndices:setSelectedIndices,controlledValueIndices:controlledValueIndices,setControlledValueIndices:setControlledValueIndices,options:options,setOptions:setOptions,filteredValues:filteredValues,setFilteredValues:setFilteredValues,activeIndex:activeIndex,setActiveIndex:setActiveIndex,activeTagIndex:activeTagIndex,setActiveTagIndex:setActiveTagIndex,visibleTagsCountRef:visibleTagsCountRef,shouldIgnoreBlurAnimation:shouldIgnoreBlurAnimation,setShouldIgnoreBlurAnimation:setShouldIgnoreBlurAnimation,isKeydownPressed:isKeydownPressed,setIsKeydownPressed:setIsKeydownPressed,dropdownBaseId:dropdownBaseId,triggererRef:triggererRef,headerAutoCompleteRef:headerAutoCompleteRef,triggererWrapperRef:triggererWrapperRef,actionListItemRef:actionListItemRef,selectionType:selectionType,hasFooterAction:hasFooterAction,setHasFooterAction:setHasFooterAction,hasAutoCompleteInHeader:hasAutoCompleteInHeader,setHasAutoCompleteInHeader:setHasAutoCompleteInHeader,dropdownTriggerer:dropdownTriggerer.current,changeCallbackTriggerer:changeCallbackTriggerer,setChangeCallbackTriggerer:setChangeCallbackTriggerer,isControlled:isControlled,setIsControlled:setIsControlled,isTagDismissedRef:isTagDismissedRef};},[isDropdownOpen,isOpenControlled,selectedIndices,controlledValueIndices,options,filteredValues,activeIndex,activeTagIndex,shouldIgnoreBlurAnimation,selectionType,hasFooterAction,isKeydownPressed,changeCallbackTriggerer,isControlled]);var BottomSheetAndDropdownGlueContextValue=React__default.useMemo(function(){return {isOpen:isDropdownOpen,dropdownHasBottomSheet:dropdownHasBottomSheet,hasAutoCompleteInHeader:hasAutoCompleteInHeader,setDropdownHasBottomSheet:setDropdownHasBottomSheet,onBottomSheetDismiss:close};},[dropdownHasBottomSheet,hasAutoCompleteInHeader,isDropdownOpen,close]);return jsx(BottomSheetAndDropdownGlueContext.Provider,{value:BottomSheetAndDropdownGlueContextValue,children:jsx(DropdownContext.Provider,{value:contextValue,children:jsx(BaseBox,Object.assign({ref:mergeRefs(ref,dropdownContainerRef)},metaAttribute({name:MetaConstants.Dropdown,testID:testID}),getStyledProps(rest),makeAnalyticsAttribute(rest),{width:_width,children:jsx(BaseBox,{position:"relative",textAlign:'left',children:children})}))})});};var Dropdown=assignWithoutSideEffects(React__default.forwardRef(_Dropdown),{componentId:dropdownComponentIds.Dropdown});
|
|
25
|
+
var _excluded=["children","isOpen","onOpenChange","selectionType","testID","_width"];var validDropdownChildren=[dropdownComponentIds.BaseBox,dropdownComponentIds.triggers.SelectInput,dropdownComponentIds.triggers.SearchInput,dropdownComponentIds.triggers.DropdownButton,dropdownComponentIds.triggers.DropdownIconButton,dropdownComponentIds.triggers.DropdownLink,dropdownComponentIds.DropdownOverlay,dropdownComponentIds.triggers.AutoComplete,ComponentIds.BottomSheet,dropdownComponentIds.triggers.FilterChipSelectInput,dropdownComponentIds.triggers.InputDropdownButton];var _Dropdown=function _Dropdown(_ref,ref){var children=_ref.children,isOpenControlled=_ref.isOpen,onOpenChange=_ref.onOpenChange,_ref$selectionType=_ref.selectionType,selectionType=_ref$selectionType===void 0?'single':_ref$selectionType,testID=_ref.testID,_width=_ref._width,rest=_objectWithoutProperties(_ref,_excluded);var _React$useState=React__default.useState([]),_React$useState2=_slicedToArray(_React$useState,2),options=_React$useState2[0],setOptions=_React$useState2[1];var _React$useState3=React__default.useState([]),_React$useState4=_slicedToArray(_React$useState3,2),filteredValues=_React$useState4[0],setFilteredValues=_React$useState4[1];var _React$useState5=React__default.useState([]),_React$useState6=_slicedToArray(_React$useState5,2),selectedIndices=_React$useState6[0],setSelectedIndices=_React$useState6[1];var _React$useState7=React__default.useState([]),_React$useState8=_slicedToArray(_React$useState7,2),controlledValueIndices=_React$useState8[0],setControlledValueIndices=_React$useState8[1];var _React$useState9=React__default.useState(-1),_React$useState10=_slicedToArray(_React$useState9,2),activeIndex=_React$useState10[0],setActiveIndex=_React$useState10[1];var _React$useState11=React__default.useState(-1),_React$useState12=_slicedToArray(_React$useState11,2),activeTagIndex=_React$useState12[0],setActiveTagIndex=_React$useState12[1];var _React$useState13=React__default.useState(false),_React$useState14=_slicedToArray(_React$useState13,2),shouldIgnoreBlurAnimation=_React$useState14[0],setShouldIgnoreBlurAnimation=_React$useState14[1];var _React$useState15=React__default.useState(false),_React$useState16=_slicedToArray(_React$useState15,2),hasFooterAction=_React$useState16[0],setHasFooterAction=_React$useState16[1];var _React$useState17=React__default.useState(false),_React$useState18=_slicedToArray(_React$useState17,2),hasAutoCompleteInHeader=_React$useState18[0],setHasAutoCompleteInHeader=_React$useState18[1];var _React$useState19=React__default.useState(false),_React$useState20=_slicedToArray(_React$useState19,2),isKeydownPressed=_React$useState20[0],setIsKeydownPressed=_React$useState20[1];var _React$useState21=React__default.useState(0),_React$useState22=_slicedToArray(_React$useState21,2),changeCallbackTriggerer=_React$useState22[0],setChangeCallbackTriggerer=_React$useState22[1];var _React$useState23=React__default.useState(false),_React$useState24=_slicedToArray(_React$useState23,2),isControlled=_React$useState24[0],setIsControlled=_React$useState24[1];var _React$useState25=React__default.useState(false),_React$useState26=_slicedToArray(_React$useState25,2),dropdownHasBottomSheet=_React$useState26[0],setDropdownHasBottomSheet=_React$useState26[1];var triggererWrapperRef=React__default.useRef(null);var triggererRef=React__default.useRef(null);var headerAutoCompleteRef=React__default.useRef(null);var actionListItemRef=React__default.useRef(null);var dropdownTriggerer=React__default.useRef();var isTagDismissedRef=React__default.useRef({value:false});var visibleTagsCountRef=React__default.useRef({value:0});var dropdownContainerRef=React__default.useRef(null);var dropdownBaseId=useId('dropdown');var isDropdownOpenRef=React__default.useRef(isOpenControlled);var _useControllableState=useControllableState({value:isOpenControlled,defaultValue:false,onChange:function onChange(isOpenControlledValue){isDropdownOpenRef.current=isOpenControlledValue;onOpenChange==null?void 0:onOpenChange(isOpenControlledValue);}}),_useControllableState2=_slicedToArray(_useControllableState,2),isDropdownOpen=_useControllableState2[0],setIsDropdownOpen=_useControllableState2[1];isDropdownOpenRef.current=isDropdownOpen;var setIsOpen=function setIsOpen(isOpenValue){isDropdownOpenRef.current=isOpenValue;setIsDropdownOpen(function(){return isOpenValue;});};var close=React__default.useCallback(function(){setActiveTagIndex(-1);setIsOpen(false);},[]);React__default.Children.map(children,function(child){if(React__default.isValidElement(child)){if(__DEV__){var _getComponentId;if(!validDropdownChildren.includes((_getComponentId=getComponentId(child))!=null?_getComponentId:'')){throwBladeError({message:`Dropdown can only have one of following elements as children - \n\n ${validDropdownChildren.join(', ')} \n\n Check out: https://blade.razorpay.com/?path=/story/components-dropdown`,moduleName:'Dropdown'});}}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.SelectInput)){dropdownTriggerer.current='SelectInput';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.SearchInput)){dropdownTriggerer.current='SearchInput';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.DropdownButton)){dropdownTriggerer.current='DropdownButton';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.DropdownIconButton)){dropdownTriggerer.current='DropdownIconButton';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.AutoComplete)){dropdownTriggerer.current='AutoComplete';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.FilterChipSelectInput)){dropdownTriggerer.current='FilterChipSelectInput';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.InputDropdownButton)){dropdownTriggerer.current='InputDropdownButton';}}});var contextValue=React__default.useMemo(function(){return {isOpen:isDropdownOpen,setIsOpen:setIsOpen,close:close,selectedIndices:selectedIndices,setSelectedIndices:setSelectedIndices,controlledValueIndices:controlledValueIndices,setControlledValueIndices:setControlledValueIndices,options:options,setOptions:setOptions,filteredValues:filteredValues,setFilteredValues:setFilteredValues,activeIndex:activeIndex,setActiveIndex:setActiveIndex,activeTagIndex:activeTagIndex,setActiveTagIndex:setActiveTagIndex,visibleTagsCountRef:visibleTagsCountRef,shouldIgnoreBlurAnimation:shouldIgnoreBlurAnimation,setShouldIgnoreBlurAnimation:setShouldIgnoreBlurAnimation,isKeydownPressed:isKeydownPressed,setIsKeydownPressed:setIsKeydownPressed,dropdownBaseId:dropdownBaseId,triggererRef:triggererRef,headerAutoCompleteRef:headerAutoCompleteRef,triggererWrapperRef:triggererWrapperRef,actionListItemRef:actionListItemRef,selectionType:selectionType,hasFooterAction:hasFooterAction,setHasFooterAction:setHasFooterAction,hasAutoCompleteInHeader:hasAutoCompleteInHeader,setHasAutoCompleteInHeader:setHasAutoCompleteInHeader,dropdownTriggerer:dropdownTriggerer.current,changeCallbackTriggerer:changeCallbackTriggerer,setChangeCallbackTriggerer:setChangeCallbackTriggerer,isControlled:isControlled,setIsControlled:setIsControlled,isTagDismissedRef:isTagDismissedRef};},[isDropdownOpen,isOpenControlled,selectedIndices,controlledValueIndices,options,filteredValues,activeIndex,activeTagIndex,shouldIgnoreBlurAnimation,selectionType,hasFooterAction,isKeydownPressed,changeCallbackTriggerer,isControlled]);var BottomSheetAndDropdownGlueContextValue=React__default.useMemo(function(){return {isOpen:isDropdownOpen,dropdownHasBottomSheet:dropdownHasBottomSheet,hasAutoCompleteInHeader:hasAutoCompleteInHeader,setDropdownHasBottomSheet:setDropdownHasBottomSheet,onBottomSheetDismiss:close};},[dropdownHasBottomSheet,hasAutoCompleteInHeader,isDropdownOpen,close]);return jsx(BottomSheetAndDropdownGlueContext.Provider,{value:BottomSheetAndDropdownGlueContextValue,children:jsx(DropdownContext.Provider,{value:contextValue,children:jsx(BaseBox,Object.assign({ref:mergeRefs(ref,dropdownContainerRef)},metaAttribute({name:MetaConstants.Dropdown,testID:testID}),getStyledProps(rest),makeAnalyticsAttribute(rest),{width:_width,children:jsx(BaseBox,{position:"relative",textAlign:'left',children:children})}))})});};var Dropdown=assignWithoutSideEffects(React__default.forwardRef(_Dropdown),{componentId:dropdownComponentIds.Dropdown});
|
|
26
26
|
|
|
27
27
|
export { Dropdown };
|
|
28
28
|
//# sourceMappingURL=Dropdown.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown.js","sources":["../../../../../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["import React from 'react';\nimport { DropdownContext } from './useDropdown';\nimport type { DropdownContextType } from './useDropdown';\nimport type { DropdownProps } from './types';\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport { useId } from '~utils/useId';\nimport { ComponentIds as bottomSheetComponentIds } from '~components/BottomSheet/componentIds';\nimport { BottomSheetAndDropdownGlueContext } from '~components/BottomSheet/BottomSheetContext';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport BaseBox from '~components/Box/BaseBox';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId, isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { MetaConstants, metaAttribute } from '~utils/metaAttribute';\nimport { throwBladeError } from '~utils/logger';\nimport type { BladeElementRef, ContainerElementType } from '~utils/types';\nimport { useControllableState } from '~utils/useControllable';\nimport { mergeRefs } from '~utils/useMergeRefs';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\nconst validDropdownChildren = [\n // TODO: Remove Box once CountrySelector's button sizing is fixed\n dropdownComponentIds.BaseBox,\n dropdownComponentIds.triggers.SelectInput,\n dropdownComponentIds.triggers.SearchInput,\n dropdownComponentIds.triggers.DropdownButton,\n dropdownComponentIds.triggers.DropdownIconButton,\n dropdownComponentIds.triggers.DropdownLink,\n dropdownComponentIds.DropdownOverlay,\n dropdownComponentIds.triggers.AutoComplete,\n bottomSheetComponentIds.BottomSheet,\n dropdownComponentIds.triggers.FilterChipSelectInput,\n];\n\n/**\n * ### Dropdown component\n *\n * Dropdown component is generic component that controls the dropdown functionality.\n * It can be used with multiple triggers and mostly contains ActionList component inside it\n *\n * ---\n *\n * #### Usage\n *\n * ```jsx\n * <Dropdown selectionType=\"single\">\n * <SelectInput />\n * <DropdownOverlay>\n * <ActionList>\n * <ActionListItem />\n * <ActionListItem />\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 Dropdown Documentation}\n */\nconst _Dropdown = (\n {\n children,\n isOpen: isOpenControlled,\n onOpenChange,\n selectionType = 'single',\n testID,\n _width,\n ...rest\n }: DropdownProps,\n ref: React.Ref<BladeElementRef>,\n): React.ReactElement => {\n const [options, setOptions] = React.useState<DropdownContextType['options']>([]);\n const [filteredValues, setFilteredValues] = React.useState<string[]>([]);\n const [selectedIndices, setSelectedIndices] = React.useState<\n DropdownContextType['selectedIndices']\n >([]);\n const [controlledValueIndices, setControlledValueIndices] = React.useState<\n DropdownContextType['selectedIndices']\n >([]);\n const [activeIndex, setActiveIndex] = React.useState(-1);\n const [activeTagIndex, setActiveTagIndex] = React.useState(-1);\n const [shouldIgnoreBlurAnimation, setShouldIgnoreBlurAnimation] = React.useState(false);\n const [hasFooterAction, setHasFooterAction] = React.useState(false);\n const [hasAutoCompleteInHeader, setHasAutoCompleteInHeader] = React.useState(false);\n const [isKeydownPressed, setIsKeydownPressed] = React.useState(false);\n const [changeCallbackTriggerer, setChangeCallbackTriggerer] = React.useState<\n DropdownContextType['changeCallbackTriggerer']\n >(0);\n const [isControlled, setIsControlled] = React.useState(false);\n // keep track if dropdown contains bottomsheet\n const [dropdownHasBottomSheet, setDropdownHasBottomSheet] = React.useState(false);\n\n /**\n * In inputs, actual input is smaller than the visible input wrapper.\n * You can set this reference in such cases so floating ui calculations happen correctly\n * */\n const triggererWrapperRef = React.useRef<ContainerElementType>(null);\n const triggererRef = React.useRef<HTMLButtonElement>(null);\n const headerAutoCompleteRef = React.useRef<HTMLButtonElement>(null);\n const actionListItemRef = React.useRef<HTMLDivElement>(null);\n const dropdownTriggerer = React.useRef<DropdownContextType['dropdownTriggerer']>();\n const isTagDismissedRef = React.useRef<{ value: boolean } | null>({ value: false });\n const visibleTagsCountRef = React.useRef<{ value: number }>({ value: 0 });\n const dropdownContainerRef = React.useRef<HTMLDivElement>(null);\n\n const dropdownBaseId = useId('dropdown');\n const isDropdownOpenRef = React.useRef(isOpenControlled);\n\n const [isDropdownOpen, setIsDropdownOpen] = useControllableState({\n value: isOpenControlled,\n defaultValue: false,\n onChange: (isOpenControlledValue) => {\n isDropdownOpenRef.current = isOpenControlledValue;\n onOpenChange?.(isOpenControlledValue);\n },\n });\n\n isDropdownOpenRef.current = isDropdownOpen;\n\n const setIsOpen = (isOpenValue: boolean): void => {\n isDropdownOpenRef.current = isOpenValue;\n setIsDropdownOpen(() => isOpenValue);\n };\n\n const close = React.useCallback(() => {\n setActiveTagIndex(-1);\n setIsOpen(false);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n if (__DEV__) {\n if (!validDropdownChildren.includes(getComponentId(child) ?? '')) {\n throwBladeError({\n message: `Dropdown can only have one of following elements as children - \\n\\n ${validDropdownChildren.join(\n ', ',\n )} \\n\\n Check out: https://blade.razorpay.com/?path=/story/components-dropdown`,\n moduleName: 'Dropdown',\n });\n }\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.SelectInput)) {\n dropdownTriggerer.current = 'SelectInput';\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.SearchInput)) {\n dropdownTriggerer.current = 'SearchInput';\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.DropdownButton)) {\n dropdownTriggerer.current = 'DropdownButton';\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.DropdownIconButton)) {\n dropdownTriggerer.current = 'DropdownIconButton';\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.AutoComplete)) {\n dropdownTriggerer.current = 'AutoComplete';\n }\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.FilterChipSelectInput)) {\n dropdownTriggerer.current = 'FilterChipSelectInput';\n }\n }\n });\n\n const contextValue = React.useMemo<DropdownContextType>(\n () => ({\n isOpen: isDropdownOpen,\n setIsOpen,\n close,\n selectedIndices,\n setSelectedIndices,\n controlledValueIndices,\n setControlledValueIndices,\n options,\n setOptions,\n filteredValues,\n setFilteredValues,\n activeIndex,\n setActiveIndex,\n activeTagIndex,\n setActiveTagIndex,\n visibleTagsCountRef,\n shouldIgnoreBlurAnimation,\n setShouldIgnoreBlurAnimation,\n isKeydownPressed,\n setIsKeydownPressed,\n dropdownBaseId,\n triggererRef,\n headerAutoCompleteRef,\n triggererWrapperRef,\n actionListItemRef,\n selectionType,\n hasFooterAction,\n setHasFooterAction,\n hasAutoCompleteInHeader,\n setHasAutoCompleteInHeader,\n dropdownTriggerer: dropdownTriggerer.current,\n changeCallbackTriggerer,\n setChangeCallbackTriggerer,\n isControlled,\n setIsControlled,\n isTagDismissedRef,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n isDropdownOpen,\n isOpenControlled,\n selectedIndices,\n controlledValueIndices,\n options,\n filteredValues,\n activeIndex,\n activeTagIndex,\n shouldIgnoreBlurAnimation,\n selectionType,\n hasFooterAction,\n isKeydownPressed,\n changeCallbackTriggerer,\n isControlled,\n ],\n );\n\n const BottomSheetAndDropdownGlueContextValue = React.useMemo((): BottomSheetAndDropdownGlueContext => {\n return {\n isOpen: isDropdownOpen,\n dropdownHasBottomSheet,\n hasAutoCompleteInHeader,\n setDropdownHasBottomSheet,\n // This is the dismiss function which will be injected into the BottomSheet\n // Basically <BottomSheet onDismiss={onBottomSheetDismiss} />\n onBottomSheetDismiss: close,\n };\n }, [dropdownHasBottomSheet, hasAutoCompleteInHeader, isDropdownOpen, close]);\n\n return (\n <BottomSheetAndDropdownGlueContext.Provider value={BottomSheetAndDropdownGlueContextValue}>\n <DropdownContext.Provider value={contextValue}>\n <BaseBox\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref={mergeRefs(ref, dropdownContainerRef as any)}\n {...metaAttribute({ name: MetaConstants.Dropdown, testID })}\n {...getStyledProps(rest)}\n {...makeAnalyticsAttribute(rest)}\n width={_width}\n >\n <BaseBox position=\"relative\" textAlign={'left' as never}>\n {children}\n </BaseBox>\n </BaseBox>\n </DropdownContext.Provider>\n </BottomSheetAndDropdownGlueContext.Provider>\n );\n};\n\nconst Dropdown = assignWithoutSideEffects(React.forwardRef(_Dropdown), {\n componentId: dropdownComponentIds.Dropdown,\n});\n\nexport { Dropdown };\n"],"names":["validDropdownChildren","dropdownComponentIds","BaseBox","triggers","SelectInput","SearchInput","DropdownButton","DropdownIconButton","DropdownLink","DropdownOverlay","AutoComplete","bottomSheetComponentIds","BottomSheet","FilterChipSelectInput","_Dropdown","_ref","ref","children","isOpenControlled","isOpen","onOpenChange","_ref$selectionType","selectionType","testID","_width","rest","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","options","setOptions","_React$useState3","_React$useState4","filteredValues","setFilteredValues","_React$useState5","_React$useState6","selectedIndices","setSelectedIndices","_React$useState7","_React$useState8","controlledValueIndices","setControlledValueIndices","_React$useState9","_React$useState10","activeIndex","setActiveIndex","_React$useState11","_React$useState12","activeTagIndex","setActiveTagIndex","_React$useState13","_React$useState14","shouldIgnoreBlurAnimation","setShouldIgnoreBlurAnimation","_React$useState15","_React$useState16","hasFooterAction","setHasFooterAction","_React$useState17","_React$useState18","hasAutoCompleteInHeader","setHasAutoCompleteInHeader","_React$useState19","_React$useState20","isKeydownPressed","setIsKeydownPressed","_React$useState21","_React$useState22","changeCallbackTriggerer","setChangeCallbackTriggerer","_React$useState23","_React$useState24","isControlled","setIsControlled","_React$useState25","_React$useState26","dropdownHasBottomSheet","setDropdownHasBottomSheet","triggererWrapperRef","useRef","triggererRef","headerAutoCompleteRef","actionListItemRef","dropdownTriggerer","isTagDismissedRef","value","visibleTagsCountRef","dropdownContainerRef","dropdownBaseId","useId","isDropdownOpenRef","_useControllableState","useControllableState","defaultValue","onChange","isOpenControlledValue","current","_useControllableState2","isDropdownOpen","setIsDropdownOpen","setIsOpen","isOpenValue","close","useCallback","Children","map","child","isValidElement","__DEV__","_getComponentId","includes","getComponentId","throwBladeError","message","join","moduleName","isValidAllowedChildren","contextValue","useMemo","BottomSheetAndDropdownGlueContextValue","onBottomSheetDismiss","_jsx","BottomSheetAndDropdownGlueContext","Provider","DropdownContext","Object","assign","mergeRefs","metaAttribute","name","MetaConstants","Dropdown","getStyledProps","makeAnalyticsAttribute","width","position","textAlign","assignWithoutSideEffects","forwardRef","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,UAAA,CAAA,QAAA,CAAA,cAAA,CAAA,eAAA,CAAA,QAAA,CAAA,QAAA,CAAA,CAmBA,IAAMA,qBAAqB,CAAG,CAE5BC,oBAAoB,CAACC,OAAO,CAC5BD,oBAAoB,CAACE,QAAQ,CAACC,WAAW,CACzCH,oBAAoB,CAACE,QAAQ,CAACE,WAAW,CACzCJ,oBAAoB,CA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CAACjH,IAAI,CAAC,EAChCkH,KAAK,CAAEnH,MAAO,CAAAP,QAAA,CAEd6G,GAAA,CAAC5H,OAAO,EAAC0I,QAAQ,CAAC,UAAU,CAACC,SAAS,CAAE,MAAgB,CAAA5H,QAAA,CACrDA,QAAQ,CACF,CAAC,CAAA,CACH,CAAC,CACc,CAAC,CACe,CAAC,CAEjD,CAAC,CAEK,IAAAuH,QAAQ,CAAGM,wBAAwB,CAACjH,cAAK,CAACkH,UAAU,CAACjI,SAAS,CAAC,CAAE,CACrEkI,WAAW,CAAE/I,oBAAoB,CAACuI,QACpC,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"Dropdown.js","sources":["../../../../../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["import React from 'react';\nimport { DropdownContext } from './useDropdown';\nimport type { DropdownContextType } from './useDropdown';\nimport type { DropdownProps } from './types';\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport { useId } from '~utils/useId';\nimport { ComponentIds as bottomSheetComponentIds } from '~components/BottomSheet/componentIds';\nimport { BottomSheetAndDropdownGlueContext } from '~components/BottomSheet/BottomSheetContext';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport BaseBox from '~components/Box/BaseBox';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId, isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { MetaConstants, metaAttribute } from '~utils/metaAttribute';\nimport { throwBladeError } from '~utils/logger';\nimport type { BladeElementRef, ContainerElementType } from '~utils/types';\nimport { useControllableState } from '~utils/useControllable';\nimport { mergeRefs } from '~utils/useMergeRefs';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\nconst validDropdownChildren = [\n // TODO: Remove Box once CountrySelector's button sizing is fixed\n dropdownComponentIds.BaseBox,\n dropdownComponentIds.triggers.SelectInput,\n dropdownComponentIds.triggers.SearchInput,\n dropdownComponentIds.triggers.DropdownButton,\n dropdownComponentIds.triggers.DropdownIconButton,\n dropdownComponentIds.triggers.DropdownLink,\n dropdownComponentIds.DropdownOverlay,\n dropdownComponentIds.triggers.AutoComplete,\n bottomSheetComponentIds.BottomSheet,\n dropdownComponentIds.triggers.FilterChipSelectInput,\n dropdownComponentIds.triggers.InputDropdownButton,\n];\n\n/**\n * ### Dropdown component\n *\n * Dropdown component is generic component that controls the dropdown functionality.\n * It can be used with multiple triggers and mostly contains ActionList component inside it\n *\n * ---\n *\n * #### Usage\n *\n * ```jsx\n * <Dropdown selectionType=\"single\">\n * <SelectInput />\n * <DropdownOverlay>\n * <ActionList>\n * <ActionListItem />\n * <ActionListItem />\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 Dropdown Documentation}\n */\nconst _Dropdown = (\n {\n children,\n isOpen: isOpenControlled,\n onOpenChange,\n selectionType = 'single',\n testID,\n _width,\n ...rest\n }: DropdownProps,\n ref: React.Ref<BladeElementRef>,\n): React.ReactElement => {\n const [options, setOptions] = React.useState<DropdownContextType['options']>([]);\n const [filteredValues, setFilteredValues] = React.useState<string[]>([]);\n const [selectedIndices, setSelectedIndices] = React.useState<\n DropdownContextType['selectedIndices']\n >([]);\n const [controlledValueIndices, setControlledValueIndices] = React.useState<\n DropdownContextType['selectedIndices']\n >([]);\n const [activeIndex, setActiveIndex] = React.useState(-1);\n const [activeTagIndex, setActiveTagIndex] = React.useState(-1);\n const [shouldIgnoreBlurAnimation, setShouldIgnoreBlurAnimation] = React.useState(false);\n const [hasFooterAction, setHasFooterAction] = React.useState(false);\n const [hasAutoCompleteInHeader, setHasAutoCompleteInHeader] = React.useState(false);\n const [isKeydownPressed, setIsKeydownPressed] = React.useState(false);\n const [changeCallbackTriggerer, setChangeCallbackTriggerer] = React.useState<\n DropdownContextType['changeCallbackTriggerer']\n >(0);\n const [isControlled, setIsControlled] = React.useState(false);\n // keep track if dropdown contains bottomsheet\n const [dropdownHasBottomSheet, setDropdownHasBottomSheet] = React.useState(false);\n\n /**\n * In inputs, actual input is smaller than the visible input wrapper.\n * You can set this reference in such cases so floating ui calculations happen correctly\n * */\n const triggererWrapperRef = React.useRef<ContainerElementType>(null);\n const triggererRef = React.useRef<HTMLButtonElement>(null);\n const headerAutoCompleteRef = React.useRef<HTMLButtonElement>(null);\n const actionListItemRef = React.useRef<HTMLDivElement>(null);\n const dropdownTriggerer = React.useRef<DropdownContextType['dropdownTriggerer']>();\n const isTagDismissedRef = React.useRef<{ value: boolean } | null>({ value: false });\n const visibleTagsCountRef = React.useRef<{ value: number }>({ value: 0 });\n const dropdownContainerRef = React.useRef<HTMLDivElement>(null);\n\n const dropdownBaseId = useId('dropdown');\n const isDropdownOpenRef = React.useRef(isOpenControlled);\n\n const [isDropdownOpen, setIsDropdownOpen] = useControllableState({\n value: isOpenControlled,\n defaultValue: false,\n onChange: (isOpenControlledValue) => {\n isDropdownOpenRef.current = isOpenControlledValue;\n onOpenChange?.(isOpenControlledValue);\n },\n });\n\n isDropdownOpenRef.current = isDropdownOpen;\n\n const setIsOpen = (isOpenValue: boolean): void => {\n isDropdownOpenRef.current = isOpenValue;\n setIsDropdownOpen(() => isOpenValue);\n };\n\n const close = React.useCallback(() => {\n setActiveTagIndex(-1);\n setIsOpen(false);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n if (__DEV__) {\n if (!validDropdownChildren.includes(getComponentId(child) ?? '')) {\n throwBladeError({\n message: `Dropdown can only have one of following elements as children - \\n\\n ${validDropdownChildren.join(\n ', ',\n )} \\n\\n Check out: https://blade.razorpay.com/?path=/story/components-dropdown`,\n moduleName: 'Dropdown',\n });\n }\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.SelectInput)) {\n dropdownTriggerer.current = 'SelectInput';\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.SearchInput)) {\n dropdownTriggerer.current = 'SearchInput';\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.DropdownButton)) {\n dropdownTriggerer.current = 'DropdownButton';\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.DropdownIconButton)) {\n dropdownTriggerer.current = 'DropdownIconButton';\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.AutoComplete)) {\n dropdownTriggerer.current = 'AutoComplete';\n }\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.FilterChipSelectInput)) {\n dropdownTriggerer.current = 'FilterChipSelectInput';\n }\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.InputDropdownButton)) {\n dropdownTriggerer.current = 'InputDropdownButton';\n }\n }\n });\n\n const contextValue = React.useMemo<DropdownContextType>(\n () => ({\n isOpen: isDropdownOpen,\n setIsOpen,\n close,\n selectedIndices,\n setSelectedIndices,\n controlledValueIndices,\n setControlledValueIndices,\n options,\n setOptions,\n filteredValues,\n setFilteredValues,\n activeIndex,\n setActiveIndex,\n activeTagIndex,\n setActiveTagIndex,\n visibleTagsCountRef,\n shouldIgnoreBlurAnimation,\n setShouldIgnoreBlurAnimation,\n isKeydownPressed,\n setIsKeydownPressed,\n dropdownBaseId,\n triggererRef,\n headerAutoCompleteRef,\n triggererWrapperRef,\n actionListItemRef,\n selectionType,\n hasFooterAction,\n setHasFooterAction,\n hasAutoCompleteInHeader,\n setHasAutoCompleteInHeader,\n dropdownTriggerer: dropdownTriggerer.current,\n changeCallbackTriggerer,\n setChangeCallbackTriggerer,\n isControlled,\n setIsControlled,\n isTagDismissedRef,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n isDropdownOpen,\n isOpenControlled,\n selectedIndices,\n controlledValueIndices,\n options,\n filteredValues,\n activeIndex,\n activeTagIndex,\n shouldIgnoreBlurAnimation,\n selectionType,\n hasFooterAction,\n isKeydownPressed,\n changeCallbackTriggerer,\n isControlled,\n ],\n );\n\n const BottomSheetAndDropdownGlueContextValue = React.useMemo((): BottomSheetAndDropdownGlueContext => {\n return {\n isOpen: isDropdownOpen,\n dropdownHasBottomSheet,\n hasAutoCompleteInHeader,\n setDropdownHasBottomSheet,\n // This is the dismiss function which will be injected into the BottomSheet\n // Basically <BottomSheet onDismiss={onBottomSheetDismiss} />\n onBottomSheetDismiss: close,\n };\n }, [dropdownHasBottomSheet, hasAutoCompleteInHeader, isDropdownOpen, close]);\n\n return (\n <BottomSheetAndDropdownGlueContext.Provider value={BottomSheetAndDropdownGlueContextValue}>\n <DropdownContext.Provider value={contextValue}>\n <BaseBox\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref={mergeRefs(ref, dropdownContainerRef as any)}\n {...metaAttribute({ name: MetaConstants.Dropdown, testID })}\n {...getStyledProps(rest)}\n {...makeAnalyticsAttribute(rest)}\n width={_width}\n >\n <BaseBox position=\"relative\" textAlign={'left' as never}>\n {children}\n </BaseBox>\n </BaseBox>\n </DropdownContext.Provider>\n </BottomSheetAndDropdownGlueContext.Provider>\n );\n};\n\nconst Dropdown = assignWithoutSideEffects(React.forwardRef(_Dropdown), {\n componentId: dropdownComponentIds.Dropdown,\n});\n\nexport { Dropdown };\n"],"names":["validDropdownChildren","dropdownComponentIds","BaseBox","triggers","SelectInput","SearchInput","DropdownButton","DropdownIconButton","DropdownLink","DropdownOverlay","AutoComplete","bottomSheetComponentIds","BottomSheet","FilterChipSelectInput","InputDropdownButton","_Dropdown","_ref","ref","children","isOpenControlled","isOpen","onOpenChange","_ref$selectionType","selectionType","testID","_width","rest","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","options","setOptions","_React$useState3","_React$useState4","filteredValues","setFilteredValues","_React$useState5","_React$useState6","selectedIndices","setSelectedIndices","_React$useState7","_React$useState8","controlledValueIndices","setControlledValueIndices","_React$useState9","_React$useState10","activeIndex","setActiveIndex","_React$useState11","_React$useState12","activeTagIndex","setActiveTagIndex","_React$useState13","_React$useState14","shouldIgnoreBlurAnimation","setShouldIgnoreBlurAnimation","_React$useState15","_React$useState16","hasFooterAction","setHasFooterAction","_React$useState17","_React$useState18","hasAutoCompleteInHeader","setHasAutoCompleteInHeader","_React$useState19","_React$useState20","isKeydownPressed","setIsKeydownPressed","_React$useState21","_React$useState22","changeCallbackTriggerer","setChangeCallbackTriggerer","_React$useState23","_React$useState24","isControlled","setIsControlled","_React$useState25","_React$useState26","dropdownHasBottomSheet","setDropdownHasBottomSheet","triggererWrapperRef","useRef","triggererRef","headerAutoCompleteRef","actionListItemRef","dropdownTriggerer","isTagDismissedRef","value","visibleTagsCountRef","dropdownContainerRef","dropdownBaseId","useId","isDropdownOpenRef","_useControllableState","useControllableState","defaultValue","onChange","isOpenControlledValue","current","_useControllableState2","isDropdownOpen","setIsDropdownOpen","setIsOpen","isOpenValue","close","useCallback","Children","map","child","isValidElement","__DEV__","_getComponentId","includes","getComponentId","throwBladeError","message","join","moduleName","isValidAllowedChildren","contextValue","useMemo","BottomSheetAndDropdownGlueContextValue","onBottomSheetDismiss","_jsx","BottomSheetAndDropdownGlueContext","Provider","DropdownContext","Object","assign","mergeRefs","metaAttribute","name","MetaConstants","Dropdown","getStyledProps","makeAnalyticsAttribute","width","position","textAlign","assignWithoutSideEffects","forwardRef","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,UAAA,CAAA,QAAA,CAAA,cAAA,CAAA,eAAA,CAAA,QAAA,CAAA,QAAA,CAAA,CAmBA,IAAMA,qBAAqB,CAAG,CAE5BC,oBAAoB,CAACC,OAAO,CAC5BD,oBAAoB,CAACE,QAAQ,CAACC,WAAW,CACzCH,oBAAoB,CAACE,QAAQ,CAACE,WAAW,CACzCJ,oBAAoB,CAACE,QAAQ,CAACG,cAAc,CAC5CL,oBAAoB,CAACE,QAAQ,CAACI,kBAAkB,CAChDN,oBAAoB,CAACE,QAAQ,CAACK,YAAY,CAC1CP,oBAAoB,CAACQ,eAAe,CACpCR,oBAAoB,CAACE,QAAQ,CAACO,YA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sB,CAACjH,IAAI,CAAC,CAAA,CAChCkH,KAAK,CAAEnH,MAAO,CAAAP,QAAA,CAEd6G,GAAA,CAAC7H,OAAO,CAAA,CAAC2I,QAAQ,CAAC,UAAU,CAACC,SAAS,CAAE,MAAgB,CAAA5H,QAAA,CACrDA,QAAQ,CACF,CAAC,EACH,CAAC,CACc,CAAC,CACe,CAAC,CAEjD,CAAC,CAEK,IAAAuH,QAAQ,CAAGM,wBAAwB,CAACjH,cAAK,CAACkH,UAAU,CAACjI,SAAS,CAAC,CAAE,CACrEkI,WAAW,CAAEhJ,oBAAoB,CAACwI,QACpC,CAAC;;;;"}
|
|
@@ -7,7 +7,7 @@ import { getActionListContainerRole } from '../ActionList/getA11yRoles.js';
|
|
|
7
7
|
import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
|
|
8
8
|
import { jsx } from 'react/jsx-runtime';
|
|
9
9
|
|
|
10
|
-
var _excluded=["children","icon","iconPosition","isDisabled","isFullWidth","isLoading","onClick","onBlur","onKeyDown","size","type","variant","accessibilityLabel","testID"];var _DropdownButton=function _DropdownButton(_ref){var children=_ref.children,icon=_ref.icon,_ref$iconPosition=_ref.iconPosition,iconPosition=_ref$iconPosition===void 0?'left':_ref$iconPosition,_ref$isDisabled=_ref.isDisabled,isDisabled=_ref$isDisabled===void 0?false:_ref$isDisabled,_ref$isFullWidth=_ref.isFullWidth,isFullWidth=_ref$isFullWidth===void 0?false:_ref$isFullWidth,_ref$isLoading=_ref.isLoading,isLoading=_ref$isLoading===void 0?false:_ref$isLoading,_onClick=_ref.onClick,_onBlur=_ref.onBlur,_onKeyDown=_ref.onKeyDown,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,_ref$type=_ref.type,type=_ref$type===void 0?'button':_ref$type,_ref$variant=_ref.variant,variant=_ref$variant===void 0?'primary':_ref$variant,accessibilityLabel=_ref.accessibilityLabel,testID=_ref.testID,rest=_objectWithoutProperties(_ref,_excluded);var _useDropdown=useDropdown(),onTriggerClick=_useDropdown.onTriggerClick,onTriggerKeydown=_useDropdown.onTriggerKeydown,dropdownBaseId=_useDropdown.dropdownBaseId,isOpen=_useDropdown.isOpen,activeIndex=_useDropdown.activeIndex,hasFooterAction=_useDropdown.hasFooterAction,triggererRef=_useDropdown.triggererRef;return jsx(BaseButton,Object.assign({},rest,icon?{icon:icon,children:children}:{children:children},{iconPosition:iconPosition,isDisabled:isDisabled,isFullWidth:isFullWidth,isLoading:isLoading,size:size,type:type,variant:variant,testID:testID,ref:triggererRef,accessibilityProps:{label:accessibilityLabel,hasPopup:getActionListContainerRole(hasFooterAction,'DropdownButton'),expanded:isOpen,controls:`${dropdownBaseId}-actionlist`,activeDescendant:activeIndex>=0?`${dropdownBaseId}-${activeIndex}`:undefined},onClick:function onClick(e){onTriggerClick();_onClick==null?void 0:_onClick(e);},onBlur:function onBlur(e){_onBlur==null?void 0:_onBlur(e);},onKeyDown:function onKeyDown(e){onTriggerKeydown==null?void 0:onTriggerKeydown({event:e});_onKeyDown==null?void 0:_onKeyDown(e);}}));};var DropdownButton=assignWithoutSideEffects(_DropdownButton,{componentId:dropdownComponentIds.triggers.DropdownButton});
|
|
10
|
+
var _excluded=["children","icon","iconPosition","isDisabled","isFullWidth","isLoading","onClick","onBlur","onKeyDown","size","type","variant","color","accessibilityLabel","testID"];var _DropdownButton=function _DropdownButton(_ref){var children=_ref.children,icon=_ref.icon,_ref$iconPosition=_ref.iconPosition,iconPosition=_ref$iconPosition===void 0?'left':_ref$iconPosition,_ref$isDisabled=_ref.isDisabled,isDisabled=_ref$isDisabled===void 0?false:_ref$isDisabled,_ref$isFullWidth=_ref.isFullWidth,isFullWidth=_ref$isFullWidth===void 0?false:_ref$isFullWidth,_ref$isLoading=_ref.isLoading,isLoading=_ref$isLoading===void 0?false:_ref$isLoading,_onClick=_ref.onClick,_onBlur=_ref.onBlur,_onKeyDown=_ref.onKeyDown,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,_ref$type=_ref.type,type=_ref$type===void 0?'button':_ref$type,_ref$variant=_ref.variant,variant=_ref$variant===void 0?'primary':_ref$variant,_ref$color=_ref.color,color=_ref$color===void 0?'primary':_ref$color,accessibilityLabel=_ref.accessibilityLabel,testID=_ref.testID,rest=_objectWithoutProperties(_ref,_excluded);var _useDropdown=useDropdown(),onTriggerClick=_useDropdown.onTriggerClick,onTriggerKeydown=_useDropdown.onTriggerKeydown,dropdownBaseId=_useDropdown.dropdownBaseId,isOpen=_useDropdown.isOpen,activeIndex=_useDropdown.activeIndex,hasFooterAction=_useDropdown.hasFooterAction,triggererRef=_useDropdown.triggererRef;return jsx(BaseButton,Object.assign({},rest,icon?{icon:icon,children:children}:{children:children},{iconPosition:iconPosition,isDisabled:isDisabled,isFullWidth:isFullWidth,isLoading:isLoading,size:size,type:type,variant:variant,testID:testID,ref:triggererRef,color:color,accessibilityProps:{label:accessibilityLabel,hasPopup:getActionListContainerRole(hasFooterAction,'DropdownButton'),expanded:isOpen,controls:`${dropdownBaseId}-actionlist`,activeDescendant:activeIndex>=0?`${dropdownBaseId}-${activeIndex}`:undefined},onClick:function onClick(e){onTriggerClick();_onClick==null?void 0:_onClick(e);},onBlur:function onBlur(e){_onBlur==null?void 0:_onBlur(e);},onKeyDown:function onKeyDown(e){onTriggerKeydown==null?void 0:onTriggerKeydown({event:e});_onKeyDown==null?void 0:_onKeyDown(e);}}));};var DropdownButton=assignWithoutSideEffects(_DropdownButton,{componentId:dropdownComponentIds.triggers.DropdownButton});
|
|
11
11
|
|
|
12
12
|
export { DropdownButton };
|
|
13
13
|
//# sourceMappingURL=DropdownButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownButton.js","sources":["../../../../../src/components/Dropdown/DropdownButton.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */\n\nimport React from 'react';\nimport { useDropdown } from './useDropdown';\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport BaseButton from '~components/Button/BaseButton';\nimport type { ButtonProps } from '~components/Button';\nimport { getActionListContainerRole } from '~components/ActionList/getA11yRoles';\nimport type { BaseButtonProps } from '~components/Button/BaseButton/BaseButton';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\n\ntype DropdownButtonProps = ButtonProps & {\n onBlur?: BaseButtonProps['onBlur'];\n onKeyDown?: BaseButtonProps['onKeyDown'];\n};\n\nconst _DropdownButton = ({\n children,\n icon,\n iconPosition = 'left',\n isDisabled = false,\n isFullWidth = false,\n isLoading = false,\n onClick,\n onBlur,\n onKeyDown,\n size = 'medium',\n type = 'button',\n variant = 'primary',\n accessibilityLabel,\n testID,\n ...rest\n}: DropdownButtonProps): React.ReactElement => {\n const {\n onTriggerClick,\n onTriggerKeydown,\n dropdownBaseId,\n isOpen,\n activeIndex,\n hasFooterAction,\n triggererRef,\n } = useDropdown();\n\n return (\n // Using BaseButton here to avoid exporting onBlur and onKeyDown from Button\n // If in future we decide to export onBlur and onKeyDown on Button, this can be replaced with Button\n <BaseButton\n {...rest}\n {...(icon ? { icon, children } : { children })}\n iconPosition={iconPosition}\n isDisabled={isDisabled}\n isFullWidth={isFullWidth}\n isLoading={isLoading}\n size={size}\n type={type}\n variant={variant}\n testID={testID}\n ref={triggererRef as any}\n accessibilityProps={{\n label: accessibilityLabel,\n hasPopup: getActionListContainerRole(hasFooterAction, 'DropdownButton'),\n expanded: isOpen,\n controls: `${dropdownBaseId}-actionlist`,\n activeDescendant: activeIndex >= 0 ? `${dropdownBaseId}-${activeIndex}` : undefined,\n }}\n onClick={(e) => {\n onTriggerClick();\n // Setting it for web fails it on native typecheck and vice versa\n onClick?.(e as any);\n }}\n onBlur={(e) => {\n // With button trigger, there is no \"value\" as such. It's just clickable items\n // Setting it for web fails it on native typecheck and vice versa\n onBlur?.(e as any);\n }}\n onKeyDown={(e) => {\n onTriggerKeydown?.({ event: e as any });\n // Setting it for web fails it on native typecheck and vice versa\n onKeyDown?.(e as any);\n }}\n />\n );\n};\n\nconst DropdownButton = assignWithoutSideEffects(_DropdownButton, {\n componentId: dropdownComponentIds.triggers.DropdownButton,\n});\n\nexport { DropdownButton };\n"],"names":["_DropdownButton","_ref","children","icon","_ref$iconPosition","iconPosition","_ref$isDisabled","isDisabled","_ref$isFullWidth","isFullWidth","_ref$isLoading","isLoading","onClick","onBlur","onKeyDown","_ref$size","size","_ref$type","type","_ref$variant","variant","accessibilityLabel","testID","rest","_objectWithoutProperties","_excluded","_useDropdown","useDropdown","onTriggerClick","onTriggerKeydown","dropdownBaseId","isOpen","activeIndex","hasFooterAction","triggererRef","_jsx","BaseButton","Object","assign","ref","accessibilityProps","label","hasPopup","getActionListContainerRole","expanded","controls","activeDescendant","undefined","e","event","DropdownButton","assignWithoutSideEffects","componentId","dropdownComponentIds","triggers"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"DropdownButton.js","sources":["../../../../../src/components/Dropdown/DropdownButton.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */\n\nimport React from 'react';\nimport { useDropdown } from './useDropdown';\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport BaseButton from '~components/Button/BaseButton';\nimport type { ButtonProps } from '~components/Button';\nimport { getActionListContainerRole } from '~components/ActionList/getA11yRoles';\nimport type { BaseButtonProps } from '~components/Button/BaseButton/BaseButton';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\n\ntype DropdownButtonProps = ButtonProps & {\n onBlur?: BaseButtonProps['onBlur'];\n onKeyDown?: BaseButtonProps['onKeyDown'];\n};\n\nconst _DropdownButton = ({\n children,\n icon,\n iconPosition = 'left',\n isDisabled = false,\n isFullWidth = false,\n isLoading = false,\n onClick,\n onBlur,\n onKeyDown,\n size = 'medium',\n type = 'button',\n variant = 'primary',\n color = 'primary',\n accessibilityLabel,\n testID,\n ...rest\n}: DropdownButtonProps): React.ReactElement => {\n const {\n onTriggerClick,\n onTriggerKeydown,\n dropdownBaseId,\n isOpen,\n activeIndex,\n hasFooterAction,\n triggererRef,\n } = useDropdown();\n\n return (\n // Using BaseButton here to avoid exporting onBlur and onKeyDown from Button\n // If in future we decide to export onBlur and onKeyDown on Button, this can be replaced with Button\n <BaseButton\n {...rest}\n {...(icon ? { icon, children } : { children })}\n iconPosition={iconPosition}\n isDisabled={isDisabled}\n isFullWidth={isFullWidth}\n isLoading={isLoading}\n size={size}\n type={type}\n variant={variant}\n testID={testID}\n ref={triggererRef as any}\n color={color}\n accessibilityProps={{\n label: accessibilityLabel,\n hasPopup: getActionListContainerRole(hasFooterAction, 'DropdownButton'),\n expanded: isOpen,\n controls: `${dropdownBaseId}-actionlist`,\n activeDescendant: activeIndex >= 0 ? `${dropdownBaseId}-${activeIndex}` : undefined,\n }}\n onClick={(e) => {\n onTriggerClick();\n // Setting it for web fails it on native typecheck and vice versa\n onClick?.(e as any);\n }}\n onBlur={(e) => {\n // With button trigger, there is no \"value\" as such. It's just clickable items\n // Setting it for web fails it on native typecheck and vice versa\n onBlur?.(e as any);\n }}\n onKeyDown={(e) => {\n onTriggerKeydown?.({ event: e as any });\n // Setting it for web fails it on native typecheck and vice versa\n onKeyDown?.(e as any);\n }}\n />\n );\n};\n\nconst DropdownButton = assignWithoutSideEffects(_DropdownButton, {\n componentId: dropdownComponentIds.triggers.DropdownButton,\n});\n\nexport { DropdownButton };\n"],"names":["_DropdownButton","_ref","children","icon","_ref$iconPosition","iconPosition","_ref$isDisabled","isDisabled","_ref$isFullWidth","isFullWidth","_ref$isLoading","isLoading","onClick","onBlur","onKeyDown","_ref$size","size","_ref$type","type","_ref$variant","variant","_ref$color","color","accessibilityLabel","testID","rest","_objectWithoutProperties","_excluded","_useDropdown","useDropdown","onTriggerClick","onTriggerKeydown","dropdownBaseId","isOpen","activeIndex","hasFooterAction","triggererRef","_jsx","BaseButton","Object","assign","ref","accessibilityProps","label","hasPopup","getActionListContainerRole","expanded","controls","activeDescendant","undefined","e","event","DropdownButton","assignWithoutSideEffects","componentId","dropdownComponentIds","triggers"],"mappings":";;;;;;;;;qLAiBA,IAAMA,eAAe,CAAG,SAAlBA,eAAeA,CAAAC,IAAA,CAiB0B,CAhB7C,IAAAC,QAAQ,CAAAD,IAAA,CAARC,QAAQ,CACRC,IAAI,CAAAF,IAAA,CAAJE,IAAI,CAAAC,iBAAA,CAAAH,IAAA,CACJI,YAAY,CAAZA,YAAY,CAAAD,iBAAA,GAAG,KAAA,CAAA,CAAA,MAAM,CAAAA,iBAAA,CAAAE,eAAA,CAAAL,IAAA,CACrBM,UAAU,CAAVA,UAAU,CAAAD,eAAA,GAAG,KAAA,CAAA,CAAA,KAAK,CAAAA,eAAA,CAAAE,gBAAA,CAAAP,IAAA,CAClBQ,WAAW,CAAXA,WAAW,CAAAD,gBAAA,GAAG,KAAA,CAAA,CAAA,KAAK,CAAAA,gBAAA,CAAAE,cAAA,CAAAT,IAAA,CACnBU,SAAS,CAATA,SAAS,CAAAD,cAAA,GAAG,KAAA,CAAA,CAAA,KAAK,CAAAA,cAAA,CACjBE,QAAO,CAAAX,IAAA,CAAPW,OAAO,CACPC,OAAM,CAAAZ,IAAA,CAANY,MAAM,CACNC,UAAS,CAAAb,IAAA,CAATa,SAAS,CAAAC,SAAA,CAAAd,IAAA,CACTe,IAAI,CAAJA,IAAI,CAAAD,SAAA,GAAA,KAAA,CAAA,CAAG,QAAQ,CAAAA,SAAA,CAAAE,SAAA,CAAAhB,IAAA,CACfiB,IAAI,CAAJA,IAAI,CAAAD,SAAA,GAAA,KAAA,CAAA,CAAG,QAAQ,CAAAA,SAAA,CAAAE,YAAA,CAAAlB,IAAA,CACfmB,OAAO,CAAPA,OAAO,CAAAD,YAAA,GAAA,KAAA,CAAA,CAAG,SAAS,CAAAA,YAAA,CAAAE,UAAA,CAAApB,IAAA,CACnBqB,KAAK,CAALA,KAAK,CAAAD,UAAA,GAAA,KAAA,CAAA,CAAG,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AAC,CAAA,CAAGe,SAC5E,CAAE,CACFrC,OAAO,CAAE,SAAAA,OAAAA,CAACsC,CAAC,CAAK,CACdpB,cAAc,EAAE,CAEhBlB,QAAO,EAAPA,IAAAA,CAAAA,KAAAA,CAAAA,CAAAA,QAAO,CAAGsC,CAAQ,CAAC,CACrB,CAAE,CACFrC,MAAM,CAAE,SAAAA,MAACqC,CAAAA,CAAC,CAAK,CAGbrC,OAAM,EAANA,IAAAA,CAAAA,KAAAA,CAAAA,CAAAA,OAAM,CAAGqC,CAAQ,CAAC,CACpB,CAAE,CACFpC,SAAS,CAAE,SAAAA,UAACoC,CAAC,CAAK,CAChBnB,gBAAgB,EAAhBA,IAAAA,CAAAA,KAAAA,CAAAA,CAAAA,gBAAgB,CAAG,CAAEoB,KAAK,CAAED,CAAS,CAAC,CAAC,CAEvCpC,UAAS,EAAA,IAAA,CAAA,KAAA,CAAA,CAATA,UAAS,CAAGoC,CAAQ,CAAC,CACvB,CAAE,CAAA,CACH,CAAC,CAEN,CAAC,CAEK,IAAAE,cAAc,CAAGC,wBAAwB,CAACrD,eAAe,CAAE,CAC/DsD,WAAW,CAAEC,oBAAoB,CAACC,QAAQ,CAACJ,cAC7C,CAAC;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { throwBladeError } from '../../utils/logger/logger.js';
|
|
2
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
var InputDropdownButton=function InputDropdownButton(_props){throwBladeError({message:'InputDropdownButton is not yet implemented for native',moduleName:'InputDropdownButton'});return jsx(Fragment,{});};
|
|
5
|
+
|
|
6
|
+
export { InputDropdownButton };
|
|
7
|
+
//# sourceMappingURL=InputDropdownButton.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputDropdownButton.native.js","sources":["../../../../../src/components/Dropdown/InputDropdownButton.native.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { throwBladeError } from '~utils/logger';\n\nconst InputDropdownButton = (_props: any): React.ReactElement => {\n throwBladeError({\n message: 'InputDropdownButton is not yet implemented for native',\n moduleName: 'InputDropdownButton',\n });\n\n return <></>;\n};\n\nexport { InputDropdownButton };\n"],"names":["InputDropdownButton","_props","throwBladeError","message","moduleName","_jsx","_Fragment"],"mappings":";;;AAGM,IAAAA,mBAAmB,CAAG,SAAtBA,mBAAmBA,CAAIC,MAAW,CAAyB,CAC/DC,eAAe,CAAC,CACdC,OAAO,CAAE,uDAAuD,CAChEC,UAAU,CAAE,qBACd,CAAC,CAAC,CAEF,OAAOC,GAAA,CAAAC,QAAA,CAAA,EAAI,CAAC,CACd;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var dropdownComponentIds={DropdownOverlay:'DropdownOverlay',Dropdown:'Dropdown',BaseBox:'BaseBox',triggers:{SelectInput:'SelectInput',DropdownButton:'DropdownButton',DropdownLink:'DropdownLink',AutoComplete:'AutoComplete',SearchInput:'SearchInput',DropdownIconButton:'DropdownIconButton',FilterChipSelectInput:'FilterChipSelectInput'}};
|
|
1
|
+
var dropdownComponentIds={DropdownOverlay:'DropdownOverlay',Dropdown:'Dropdown',BaseBox:'BaseBox',triggers:{SelectInput:'SelectInput',DropdownButton:'DropdownButton',DropdownLink:'DropdownLink',AutoComplete:'AutoComplete',SearchInput:'SearchInput',DropdownIconButton:'DropdownIconButton',FilterChipSelectInput:'FilterChipSelectInput',InputDropdownButton:'InputDropdownButton'}};
|
|
2
2
|
|
|
3
3
|
export { dropdownComponentIds };
|
|
4
4
|
//# sourceMappingURL=dropdownComponentIds.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdownComponentIds.js","sources":["../../../../../src/components/Dropdown/dropdownComponentIds.ts"],"sourcesContent":["export const dropdownComponentIds = {\n DropdownOverlay: 'DropdownOverlay',\n Dropdown: 'Dropdown',\n BaseBox: 'BaseBox',\n triggers: {\n SelectInput: 'SelectInput',\n DropdownButton: 'DropdownButton',\n DropdownLink: 'DropdownLink',\n AutoComplete: 'AutoComplete',\n SearchInput: 'SearchInput',\n DropdownIconButton: 'DropdownIconButton',\n FilterChipSelectInput: 'FilterChipSelectInput',\n },\n};\n"],"names":["dropdownComponentIds","DropdownOverlay","Dropdown","BaseBox","triggers","SelectInput","DropdownButton","DropdownLink","AutoComplete","SearchInput","DropdownIconButton","FilterChipSelectInput"],"mappings":"AAAa,IAAAA,oBAAoB,CAAG,CAClCC,eAAe,CAAE,iBAAiB,CAClCC,QAAQ,CAAE,UAAU,CACpBC,OAAO,CAAE,SAAS,CAClBC,QAAQ,CAAE,CACRC,WAAW,CAAE,aAAa,CAC1BC,cAAc,CAAE,gBAAgB,CAChCC,YAAY,CAAE,cAAc,CAC5BC,YAAY,CAAE,cAAc,CAC5BC,WAAW,CAAE,aAAa,CAC1BC,kBAAkB,CAAE,oBAAoB,CACxCC,qBAAqB,CAAE,
|
|
1
|
+
{"version":3,"file":"dropdownComponentIds.js","sources":["../../../../../src/components/Dropdown/dropdownComponentIds.ts"],"sourcesContent":["export const dropdownComponentIds = {\n DropdownOverlay: 'DropdownOverlay',\n Dropdown: 'Dropdown',\n BaseBox: 'BaseBox',\n triggers: {\n SelectInput: 'SelectInput',\n DropdownButton: 'DropdownButton',\n DropdownLink: 'DropdownLink',\n AutoComplete: 'AutoComplete',\n SearchInput: 'SearchInput',\n DropdownIconButton: 'DropdownIconButton',\n FilterChipSelectInput: 'FilterChipSelectInput',\n InputDropdownButton: 'InputDropdownButton',\n },\n};\n"],"names":["dropdownComponentIds","DropdownOverlay","Dropdown","BaseBox","triggers","SelectInput","DropdownButton","DropdownLink","AutoComplete","SearchInput","DropdownIconButton","FilterChipSelectInput","InputDropdownButton"],"mappings":"AAAa,IAAAA,oBAAoB,CAAG,CAClCC,eAAe,CAAE,iBAAiB,CAClCC,QAAQ,CAAE,UAAU,CACpBC,OAAO,CAAE,SAAS,CAClBC,QAAQ,CAAE,CACRC,WAAW,CAAE,aAAa,CAC1BC,cAAc,CAAE,gBAAgB,CAChCC,YAAY,CAAE,cAAc,CAC5BC,YAAY,CAAE,cAAc,CAC5BC,WAAW,CAAE,aAAa,CAC1BC,kBAAkB,CAAE,oBAAoB,CACxCC,qBAAqB,CAAE,uBAAuB,CAC9CC,mBAAmB,CAAE,qBACvB,CACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDropdown.js","sources":["../../../../../src/components/Dropdown/useDropdown.ts"],"sourcesContent":["import React from 'react';\n\nimport {\n ensureScrollVisiblity,\n getActionFromKey,\n getIndexByLetter,\n getUpdatedIndex,\n makeInputDisplayValue,\n makeInputValue,\n performAction,\n} from './dropdownUtils';\nimport type { SelectActionsType } from './dropdownUtils';\nimport type { DropdownProps } from './types';\n\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport type { FormInputHandleOnKeyDownEvent } from '~components/Form/FormTypes';\nimport { isReactNative, isBrowser } from '~utils';\nimport type { ContainerElementType } from '~utils/types';\nimport { fireNativeEvent } from '~utils/fireNativeEvent';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = (): void => {};\n\ntype OptionsType = {\n title: string;\n value: string;\n onClickTrigger?: (isSelected: boolean) => void;\n}[];\n\ntype DropdownContextType = {\n isOpen: boolean;\n setIsOpen: (isOpen: boolean) => void;\n close: () => void;\n /**\n * contains the indexes of selected items\n */\n selectedIndices: number[];\n setSelectedIndices: (value: number[]) => void;\n /**\n * contains the indexes of selected items during controlled selection\n */\n controlledValueIndices: number[];\n setControlledValueIndices: (value: number[]) => void;\n /**\n * contains information about all the options inside actionlist\n */\n options: OptionsType;\n setOptions: (value: OptionsType) => void;\n\n /**\n * Filtered values for AutoComplete Inputs\n */\n filteredValues: string[];\n setFilteredValues: (values: string[]) => void;\n\n /** Currently active (focussed) index */\n activeIndex: number;\n setActiveIndex: (value: number) => void;\n\n /** Currently active (focussed) tag */\n activeTagIndex: number;\n setActiveTagIndex: (value: number) => void;\n\n /**\n * Sometimes we want to ignore the blur event to keep dropdown open but not ignore the blur animation from selectinput\n * E.g. When someone clicks on Footer, we just want to ignore the blur event and not the blur animation\n */\n shouldIgnoreBlurAnimation: boolean;\n setShouldIgnoreBlurAnimation: (value: boolean) => void;\n /** Tells you if keyboard was used. Its false by default and turns into true when keydown is called */\n isKeydownPressed: boolean;\n setIsKeydownPressed: (value: boolean) => void;\n /** common baseId which is prepended to multiple other ids inside this dropdown */\n dropdownBaseId: string;\n /** Which element has triggered the dropdown */\n dropdownTriggerer?:\n | 'SelectInput'\n | 'DropdownButton'\n | 'DropdownIconButton'\n | 'AutoComplete'\n | 'DropdownLink'\n | 'SearchInput'\n | 'FilterChipSelectInput';\n\n /** ref of triggerer. Used to call focus in certain places */\n triggererRef: React.MutableRefObject<HTMLButtonElement | null>;\n headerAutoCompleteRef: React.MutableRefObject<HTMLButtonElement | null>;\n triggererWrapperRef: React.MutableRefObject<ContainerElementType | null>;\n actionListItemRef: React.RefObject<HTMLDivElement | null>;\n isTagDismissedRef: React.RefObject<{ value: boolean } | null>;\n visibleTagsCountRef: React.RefObject<{ value: number } | null>;\n\n selectionType?: DropdownProps['selectionType'];\n /** whether footer has an action item.\n * certain a11y behaviour changes happen here\n * E.g. tabbing moves focus to that action instead of outside\n */\n hasFooterAction: boolean;\n setHasFooterAction: (value: boolean) => void;\n\n /**\n * Apart from dropdownTriggerer prop, we also set this boolean because in BottomSheetHeader and DropdownHeader, the trigger can be Select but they can also have autocomplete inside of header\n */\n hasAutoCompleteInHeader: boolean;\n setHasAutoCompleteInHeader: (value: boolean) => void;\n\n /**\n * A value that can be used in dependency array to know when Dropdown value is changed.\n *\n * E.g.\n * ```ts\n * useEffect(() => {\n * console.log('Uncontrolled value change');\n * }, [changeCallbackTriggerer])\n * ```\n */\n changeCallbackTriggerer: number;\n setChangeCallbackTriggerer: (changeCallbackTriggerer: number) => void;\n\n /**\n * true when SelectInput has `value` prop (when it is controlled)\n */\n isControlled: boolean;\n setIsControlled: (isControlled: boolean) => void;\n};\n\nconst DropdownContext = React.createContext<DropdownContextType>({\n isOpen: false,\n setIsOpen: noop,\n close: noop,\n selectedIndices: [],\n setSelectedIndices: noop,\n controlledValueIndices: [],\n setControlledValueIndices: noop,\n options: [],\n setOptions: noop,\n filteredValues: [],\n setFilteredValues: noop,\n activeIndex: -1,\n setActiveIndex: noop,\n activeTagIndex: -1,\n setActiveTagIndex: noop,\n shouldIgnoreBlurAnimation: false,\n setShouldIgnoreBlurAnimation: noop,\n hasFooterAction: false,\n setHasFooterAction: noop,\n hasAutoCompleteInHeader: false,\n setHasAutoCompleteInHeader: noop,\n isKeydownPressed: false,\n setIsKeydownPressed: noop,\n changeCallbackTriggerer: 0,\n setChangeCallbackTriggerer: noop,\n isControlled: false,\n setIsControlled: noop,\n dropdownBaseId: '',\n actionListItemRef: {\n current: null,\n },\n triggererRef: {\n current: null,\n },\n headerAutoCompleteRef: {\n current: null,\n },\n isTagDismissedRef: {\n current: null,\n },\n visibleTagsCountRef: {\n current: null,\n },\n triggererWrapperRef: {\n current: null,\n },\n});\n\nlet searchTimeout: number;\nlet searchString = '';\n\ntype UseDropdownReturnValue = DropdownContextType & {\n /**\n * Click event on combobox. Toggles the dropdown\n */\n onTriggerClick: () => void;\n\n /**\n * Keydown event of combobox. Handles most of the keyboard accessibility of dropdown\n */\n onTriggerKeydown: FormInputHandleOnKeyDownEvent | undefined;\n\n /**\n * Handles the click even on option.\n *\n * Contains the logic that selects the option, moves the focus, etc\n */\n onOptionClick: (\n e: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLInputElement>,\n index: number,\n ) => void;\n\n /**\n * Removes the option with given optionsIndex\n */\n removeOption: (index: number) => void;\n\n /**\n * value that is used during form submissions\n */\n value: string;\n /**\n * This is the value that is displayed inside select after selection\n */\n displayValue: string;\n};\n\n/**\n * Handles almost all the functionality of dropdown.\n *\n * Returns the values from DropdownContext along with some helper functions and event handlers\n *\n */\nconst useDropdown = (): UseDropdownReturnValue => {\n const {\n isOpen,\n setIsOpen,\n close,\n selectedIndices,\n setSelectedIndices,\n activeIndex,\n setActiveIndex,\n activeTagIndex,\n setActiveTagIndex,\n visibleTagsCountRef,\n isKeydownPressed,\n setIsKeydownPressed,\n options,\n selectionType,\n changeCallbackTriggerer,\n setChangeCallbackTriggerer,\n isControlled,\n setControlledValueIndices,\n filteredValues,\n dropdownTriggerer,\n ...rest\n } = React.useContext(DropdownContext);\n\n type SelectOptionType = (\n index: number,\n properties?: {\n closeOnSelection?: boolean;\n },\n ) => boolean;\n\n const setIndices = (indices: number[]): void => {\n if (isControlled) {\n setControlledValueIndices(indices);\n } else {\n setSelectedIndices(indices);\n }\n };\n\n const removeOption = (index: number): void => {\n // remove existing item\n const existingItemIndex = selectedIndices.indexOf(index);\n if (existingItemIndex < 0) {\n return;\n }\n\n setIndices([\n ...selectedIndices.slice(0, existingItemIndex),\n ...selectedIndices.slice(existingItemIndex + 1),\n ]);\n };\n\n /**\n * Marks the given index as selected.\n *\n * In single select, it also closes the menu.\n * In multiselect, it keeps the menu open for more selections\n */\n const selectOption: SelectOptionType = (\n index,\n properties = {\n closeOnSelection: true,\n },\n ) => {\n let isSelected = false;\n\n if (index < 0 || index > options.length - 1) {\n return isSelected;\n }\n\n if (selectionType === 'multiple') {\n if (selectedIndices.includes(index)) {\n removeOption(index);\n isSelected = false;\n } else {\n setIndices([...selectedIndices, index]);\n isSelected = true;\n }\n } else {\n setIndices([index]);\n isSelected = true;\n }\n\n // Triggers `onChange` on SelectInput\n setChangeCallbackTriggerer(changeCallbackTriggerer + 1);\n\n if (activeIndex !== index) {\n setActiveIndex(index);\n }\n\n if (properties?.closeOnSelection && selectionType !== 'multiple') {\n close();\n }\n\n return isSelected;\n };\n\n /**\n * Click listener for combobox (or any triggerer of the dropdown)\n */\n const onTriggerClick = (): void => {\n if (isOpen) {\n close();\n } else {\n setIsOpen(true);\n }\n };\n\n /**\n * Function that we call when we want to move focus from one option to other\n */\n const onOptionChange = (actionType: SelectActionsType, index?: number): void => {\n setActiveTagIndex(-1);\n const newIndex = index ?? activeIndex;\n let updatedIndex: number;\n const hasAutoComplete =\n rest.hasAutoCompleteInHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n if (hasAutoComplete && filteredValues.length > 0) {\n // When its autocomplete, we don't loop over all options. We only loop on filtered options\n\n const filteredIndexes = filteredValues\n .map((filteredValue) => options.findIndex((option) => option.value === filteredValue))\n .sort((a, b) => a - b);\n\n updatedIndex =\n filteredIndexes[\n getUpdatedIndex({\n currentIndex: filteredIndexes.indexOf(newIndex),\n maxIndex: filteredIndexes.length - 1,\n actionType,\n })\n ];\n } else {\n updatedIndex = getUpdatedIndex({\n currentIndex: newIndex,\n maxIndex: options.length - 1,\n actionType,\n });\n }\n setActiveIndex(updatedIndex);\n\n const optionValues = options.map((option) => option.value);\n ensureScrollVisiblity(updatedIndex, rest.actionListItemRef.current, optionValues);\n if (isBrowser()) {\n fireNativeEvent(rest.actionListItemRef as React.RefObject<HTMLElement>, ['change', 'input']);\n }\n };\n\n /**\n * Click handler when user clicks on any particular option.\n *\n * It\n * - changes the option focus\n * - selects that option\n * - moves focus to combobox\n */\n const onOptionClick = (\n e: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLInputElement>,\n index: number,\n ): void => {\n setIsKeydownPressed(false);\n const actionType = getActionFromKey(e, isOpen, dropdownTriggerer);\n if (typeof actionType === 'number') {\n onOptionChange(actionType, index);\n }\n selectOption(index);\n\n if (!isReactNative()) {\n if (rest.hasAutoCompleteInHeader) {\n // move focus to autocomplete\n rest.headerAutoCompleteRef.current?.focus();\n } else {\n rest.triggererRef.current?.focus();\n }\n }\n };\n\n /**\n * Function we call to handle the typeahead.\n *\n * It takes a letter, stores that letter in searchString (and clears it after timeout) to maintain a word\n *\n * Then searches for that word in options and moves focus there.\n */\n const onComboType = (letter: string, actionType: SelectActionsType): void => {\n // open the listbox if it is closed\n setIsOpen(true);\n\n if (\n rest.hasAutoCompleteInHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete\n ) {\n return;\n }\n\n if (typeof searchTimeout === 'number') {\n window.clearTimeout(searchTimeout);\n }\n\n searchTimeout = window.setTimeout(() => {\n searchString = '';\n }, 500);\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands\n searchString = searchString + letter;\n const optionTitles = options.map((option) => option.title);\n const searchIndex = getIndexByLetter(optionTitles, searchString, activeIndex + 1);\n\n // if a match was found, go to it\n if (searchIndex >= 0) {\n onOptionChange(actionType, searchIndex);\n }\n // if no matches, clear the timeout and search string\n else {\n window.clearTimeout(searchTimeout);\n searchString = '';\n }\n };\n\n /**\n * Keydown event of combobox. Handles most of the keyboard accessibility of dropdown\n */\n const onTriggerKeydown = (e: {\n event: React.KeyboardEvent<HTMLInputElement | HTMLButtonElement>;\n }): void => {\n if (!isKeydownPressed && ![' ', 'Enter', 'Escape', 'Meta'].includes(e.event.key)) {\n // When keydown is not already pressed and its not Enter, Space, Command, or Escape key (those are generic keys and we only want to handle arrow keys or home buttons etc)\n setIsKeydownPressed(true);\n }\n\n const actionType = getActionFromKey(e.event, isOpen, dropdownTriggerer);\n\n if (actionType) {\n performAction(actionType, e, {\n setIsOpen,\n close,\n onOptionChange,\n onComboType,\n selectCurrentOption: () => {\n if (activeIndex < 0) {\n return;\n }\n\n const isSelected = selectOption(activeIndex);\n if (rest.hasFooterAction && !isReactNative()) {\n rest.triggererRef.current?.focus();\n }\n\n options[activeIndex].onClickTrigger?.(isSelected);\n },\n });\n }\n };\n\n return {\n isOpen,\n setIsOpen,\n close,\n selectedIndices,\n setSelectedIndices,\n filteredValues,\n removeOption,\n setControlledValueIndices,\n onTriggerClick,\n onTriggerKeydown,\n onOptionClick,\n activeIndex,\n setActiveIndex,\n activeTagIndex,\n setActiveTagIndex,\n visibleTagsCountRef,\n isKeydownPressed,\n setIsKeydownPressed,\n changeCallbackTriggerer,\n setChangeCallbackTriggerer,\n isControlled,\n options,\n value: makeInputValue(selectedIndices, options),\n displayValue: makeInputDisplayValue(selectedIndices, options),\n selectionType,\n dropdownTriggerer,\n ...rest,\n };\n};\n\nexport type { DropdownContextType, OptionsType };\nexport { useDropdown, DropdownContext };\n"],"names":["noop","DropdownContext","React","createContext","isOpen","setIsOpen","close","selectedIndices","setSelectedIndices","controlledValueIndices","setControlledValueIndices","options","setOptions","filteredValues","setFilteredValues","activeIndex","setActiveIndex","activeTagIndex","setActiveTagIndex","shouldIgnoreBlurAnimation","setShouldIgnoreBlurAnimation","hasFooterAction","setHasFooterAction","hasAutoCompleteInHeader","setHasAutoCompleteInHeader","isKeydownPressed","setIsKeydownPressed","changeCallbackTriggerer","setChangeCallbackTriggerer","isControlled","setIsControlled","dropdownBaseId","actionListItemRef","current","triggererRef","headerAutoCompleteRef","isTagDismissedRef","visibleTagsCountRef","triggererWrapperRef","searchTimeout","searchString","useDropdown","_React$useContext","useContext","selectionType","dropdownTriggerer","rest","_objectWithoutProperties","_excluded","setIndices","indices","removeOption","index","existingItemIndex","indexOf","concat","_toConsumableArray","slice","selectOption","properties","arguments","length","undefined","closeOnSelection","isSelected","includes","onTriggerClick","onOptionChange","actionType","newIndex","updatedIndex","hasAutoComplete","dropdownComponentIds","triggers","AutoComplete","filteredIndexes","map","filteredValue","findIndex","option","value","sort","a","b","getUpdatedIndex","currentIndex","maxIndex","optionValues","ensureScrollVisiblity","isBrowser","fireNativeEvent","onOptionClick","e","getActionFromKey","isReactNative","_rest$headerAutoCompl","focus","_rest$triggererRef$cu","onComboType","letter","window","clearTimeout","setTimeout","optionTitles","title","searchIndex","getIndexByLetter","onTriggerKeydown","event","key","performAction","selectCurrentOption","_options$activeIndex$","_options$activeIndex","_rest$triggererRef$cu2","onClickTrigger","call","Object","assign","makeInputValue","displayValue","makeInputDisplayValue"],"mappings":";;;;;;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,QAAA,CAAA,WAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,oBAAA,CAAA,aAAA,CAA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A,YAAY,CACZzC,yBAAyB,CAAzBA,yBAAyB,CACzBwD,cAAc,CAAdA,cAAc,CACdyC,gBAAgB,CAAhBA,gBAAgB,CAChBhB,aAAa,CAAbA,aAAa,CACb5E,WAAW,CAAXA,WAAW,CACXC,cAAc,CAAdA,cAAc,CACdC,cAAc,CAAdA,cAAc,CACdC,iBAAiB,CAAjBA,iBAAiB,CACjBmB,mBAAmB,CAAnBA,mBAAmB,CACnBZ,gBAAgB,CAAhBA,gBAAgB,CAChBC,mBAAmB,CAAnBA,mBAAmB,CACnBC,uBAAuB,CAAvBA,uBAAuB,CACvBC,0BAA0B,CAA1BA,0BAA0B,CAC1BC,YAAY,CAAZA,YAAY,CACZlB,OAAO,CAAPA,OAAO,CACPqE,KAAK,CAAEuC,cAAc,CAAChH,eAAe,CAAEI,OAAO,CAAC,CAC/C6G,YAAY,CAAEC,qBAAqB,CAAClH,eAAe,CAAEI,OAAO,CAAC,CAC7DiC,aAAa,CAAbA,aAAa,CACbC,iBAAiB,CAAjBA,iBAAiB,CAAA,CACdC,IAAI,CAEX,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"useDropdown.js","sources":["../../../../../src/components/Dropdown/useDropdown.ts"],"sourcesContent":["import React from 'react';\n\nimport {\n ensureScrollVisiblity,\n getActionFromKey,\n getIndexByLetter,\n getUpdatedIndex,\n makeInputDisplayValue,\n makeInputValue,\n performAction,\n} from './dropdownUtils';\nimport type { SelectActionsType } from './dropdownUtils';\nimport type { DropdownProps } from './types';\n\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport type { FormInputHandleOnKeyDownEvent } from '~components/Form/FormTypes';\nimport { isReactNative, isBrowser } from '~utils';\nimport type { ContainerElementType } from '~utils/types';\nimport { fireNativeEvent } from '~utils/fireNativeEvent';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = (): void => {};\n\ntype OptionsType = {\n title: string;\n value: string;\n onClickTrigger?: (isSelected: boolean) => void;\n}[];\n\ntype DropdownContextType = {\n isOpen: boolean;\n setIsOpen: (isOpen: boolean) => void;\n close: () => void;\n /**\n * contains the indexes of selected items\n */\n selectedIndices: number[];\n setSelectedIndices: (value: number[]) => void;\n /**\n * contains the indexes of selected items during controlled selection\n */\n controlledValueIndices: number[];\n setControlledValueIndices: (value: number[]) => void;\n /**\n * contains information about all the options inside actionlist\n */\n options: OptionsType;\n setOptions: (value: OptionsType) => void;\n\n /**\n * Filtered values for AutoComplete Inputs\n */\n filteredValues: string[];\n setFilteredValues: (values: string[]) => void;\n\n /** Currently active (focussed) index */\n activeIndex: number;\n setActiveIndex: (value: number) => void;\n\n /** Currently active (focussed) tag */\n activeTagIndex: number;\n setActiveTagIndex: (value: number) => void;\n\n /**\n * Sometimes we want to ignore the blur event to keep dropdown open but not ignore the blur animation from selectinput\n * E.g. When someone clicks on Footer, we just want to ignore the blur event and not the blur animation\n */\n shouldIgnoreBlurAnimation: boolean;\n setShouldIgnoreBlurAnimation: (value: boolean) => void;\n /** Tells you if keyboard was used. Its false by default and turns into true when keydown is called */\n isKeydownPressed: boolean;\n setIsKeydownPressed: (value: boolean) => void;\n /** common baseId which is prepended to multiple other ids inside this dropdown */\n dropdownBaseId: string;\n /** Which element has triggered the dropdown */\n dropdownTriggerer?:\n | 'SelectInput'\n | 'DropdownButton'\n | 'DropdownIconButton'\n | 'AutoComplete'\n | 'DropdownLink'\n | 'SearchInput'\n | 'FilterChipSelectInput'\n | 'InputDropdownButton';\n\n /** ref of triggerer. Used to call focus in certain places */\n triggererRef: React.MutableRefObject<HTMLButtonElement | null>;\n headerAutoCompleteRef: React.MutableRefObject<HTMLButtonElement | null>;\n triggererWrapperRef: React.MutableRefObject<ContainerElementType | null>;\n actionListItemRef: React.RefObject<HTMLDivElement | null>;\n isTagDismissedRef: React.RefObject<{ value: boolean } | null>;\n visibleTagsCountRef: React.RefObject<{ value: number } | null>;\n\n selectionType?: DropdownProps['selectionType'];\n /** whether footer has an action item.\n * certain a11y behaviour changes happen here\n * E.g. tabbing moves focus to that action instead of outside\n */\n hasFooterAction: boolean;\n setHasFooterAction: (value: boolean) => void;\n\n /**\n * Apart from dropdownTriggerer prop, we also set this boolean because in BottomSheetHeader and DropdownHeader, the trigger can be Select but they can also have autocomplete inside of header\n */\n hasAutoCompleteInHeader: boolean;\n setHasAutoCompleteInHeader: (value: boolean) => void;\n\n /**\n * A value that can be used in dependency array to know when Dropdown value is changed.\n *\n * E.g.\n * ```ts\n * useEffect(() => {\n * console.log('Uncontrolled value change');\n * }, [changeCallbackTriggerer])\n * ```\n */\n changeCallbackTriggerer: number;\n setChangeCallbackTriggerer: (changeCallbackTriggerer: number) => void;\n\n /**\n * true when SelectInput has `value` prop (when it is controlled)\n */\n isControlled: boolean;\n setIsControlled: (isControlled: boolean) => void;\n};\n\nconst DropdownContext = React.createContext<DropdownContextType>({\n isOpen: false,\n setIsOpen: noop,\n close: noop,\n selectedIndices: [],\n setSelectedIndices: noop,\n controlledValueIndices: [],\n setControlledValueIndices: noop,\n options: [],\n setOptions: noop,\n filteredValues: [],\n setFilteredValues: noop,\n activeIndex: -1,\n setActiveIndex: noop,\n activeTagIndex: -1,\n setActiveTagIndex: noop,\n shouldIgnoreBlurAnimation: false,\n setShouldIgnoreBlurAnimation: noop,\n hasFooterAction: false,\n setHasFooterAction: noop,\n hasAutoCompleteInHeader: false,\n setHasAutoCompleteInHeader: noop,\n isKeydownPressed: false,\n setIsKeydownPressed: noop,\n changeCallbackTriggerer: 0,\n setChangeCallbackTriggerer: noop,\n isControlled: false,\n setIsControlled: noop,\n dropdownBaseId: '',\n actionListItemRef: {\n current: null,\n },\n triggererRef: {\n current: null,\n },\n headerAutoCompleteRef: {\n current: null,\n },\n isTagDismissedRef: {\n current: null,\n },\n visibleTagsCountRef: {\n current: null,\n },\n triggererWrapperRef: {\n current: null,\n },\n});\n\nlet searchTimeout: number;\nlet searchString = '';\n\ntype UseDropdownReturnValue = DropdownContextType & {\n /**\n * Click event on combobox. Toggles the dropdown\n */\n onTriggerClick: () => void;\n\n /**\n * Keydown event of combobox. Handles most of the keyboard accessibility of dropdown\n */\n onTriggerKeydown: FormInputHandleOnKeyDownEvent | undefined;\n\n /**\n * Handles the click even on option.\n *\n * Contains the logic that selects the option, moves the focus, etc\n */\n onOptionClick: (\n e: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLInputElement>,\n index: number,\n ) => void;\n\n /**\n * Removes the option with given optionsIndex\n */\n removeOption: (index: number) => void;\n\n /**\n * value that is used during form submissions\n */\n value: string;\n /**\n * This is the value that is displayed inside select after selection\n */\n displayValue: string;\n};\n\n/**\n * Handles almost all the functionality of dropdown.\n *\n * Returns the values from DropdownContext along with some helper functions and event handlers\n *\n */\nconst useDropdown = (): UseDropdownReturnValue => {\n const {\n isOpen,\n setIsOpen,\n close,\n selectedIndices,\n setSelectedIndices,\n activeIndex,\n setActiveIndex,\n activeTagIndex,\n setActiveTagIndex,\n visibleTagsCountRef,\n isKeydownPressed,\n setIsKeydownPressed,\n options,\n selectionType,\n changeCallbackTriggerer,\n setChangeCallbackTriggerer,\n isControlled,\n setControlledValueIndices,\n filteredValues,\n dropdownTriggerer,\n ...rest\n } = React.useContext(DropdownContext);\n\n type SelectOptionType = (\n index: number,\n properties?: {\n closeOnSelection?: boolean;\n },\n ) => boolean;\n\n const setIndices = (indices: number[]): void => {\n if (isControlled) {\n setControlledValueIndices(indices);\n } else {\n setSelectedIndices(indices);\n }\n };\n\n const removeOption = (index: number): void => {\n // remove existing item\n const existingItemIndex = selectedIndices.indexOf(index);\n if (existingItemIndex < 0) {\n return;\n }\n\n setIndices([\n ...selectedIndices.slice(0, existingItemIndex),\n ...selectedIndices.slice(existingItemIndex + 1),\n ]);\n };\n\n /**\n * Marks the given index as selected.\n *\n * In single select, it also closes the menu.\n * In multiselect, it keeps the menu open for more selections\n */\n const selectOption: SelectOptionType = (\n index,\n properties = {\n closeOnSelection: true,\n },\n ) => {\n let isSelected = false;\n\n if (index < 0 || index > options.length - 1) {\n return isSelected;\n }\n\n if (selectionType === 'multiple') {\n if (selectedIndices.includes(index)) {\n removeOption(index);\n isSelected = false;\n } else {\n setIndices([...selectedIndices, index]);\n isSelected = true;\n }\n } else {\n setIndices([index]);\n isSelected = true;\n }\n\n // Triggers `onChange` on SelectInput\n setChangeCallbackTriggerer(changeCallbackTriggerer + 1);\n\n if (activeIndex !== index) {\n setActiveIndex(index);\n }\n\n if (properties?.closeOnSelection && selectionType !== 'multiple') {\n close();\n }\n\n return isSelected;\n };\n\n /**\n * Click listener for combobox (or any triggerer of the dropdown)\n */\n const onTriggerClick = (): void => {\n if (isOpen) {\n close();\n } else {\n setIsOpen(true);\n }\n };\n\n /**\n * Function that we call when we want to move focus from one option to other\n */\n const onOptionChange = (actionType: SelectActionsType, index?: number): void => {\n setActiveTagIndex(-1);\n const newIndex = index ?? activeIndex;\n let updatedIndex: number;\n const hasAutoComplete =\n rest.hasAutoCompleteInHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n if (hasAutoComplete && filteredValues.length > 0) {\n // When its autocomplete, we don't loop over all options. We only loop on filtered options\n\n const filteredIndexes = filteredValues\n .map((filteredValue) => options.findIndex((option) => option.value === filteredValue))\n .sort((a, b) => a - b);\n\n updatedIndex =\n filteredIndexes[\n getUpdatedIndex({\n currentIndex: filteredIndexes.indexOf(newIndex),\n maxIndex: filteredIndexes.length - 1,\n actionType,\n })\n ];\n } else {\n updatedIndex = getUpdatedIndex({\n currentIndex: newIndex,\n maxIndex: options.length - 1,\n actionType,\n });\n }\n setActiveIndex(updatedIndex);\n\n const optionValues = options.map((option) => option.value);\n ensureScrollVisiblity(updatedIndex, rest.actionListItemRef.current, optionValues);\n if (isBrowser()) {\n fireNativeEvent(rest.actionListItemRef as React.RefObject<HTMLElement>, ['change', 'input']);\n }\n };\n\n /**\n * Click handler when user clicks on any particular option.\n *\n * It\n * - changes the option focus\n * - selects that option\n * - moves focus to combobox\n */\n const onOptionClick = (\n e: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLInputElement>,\n index: number,\n ): void => {\n setIsKeydownPressed(false);\n const actionType = getActionFromKey(e, isOpen, dropdownTriggerer);\n if (typeof actionType === 'number') {\n onOptionChange(actionType, index);\n }\n selectOption(index);\n\n if (!isReactNative()) {\n if (rest.hasAutoCompleteInHeader) {\n // move focus to autocomplete\n rest.headerAutoCompleteRef.current?.focus();\n } else {\n rest.triggererRef.current?.focus();\n }\n }\n };\n\n /**\n * Function we call to handle the typeahead.\n *\n * It takes a letter, stores that letter in searchString (and clears it after timeout) to maintain a word\n *\n * Then searches for that word in options and moves focus there.\n */\n const onComboType = (letter: string, actionType: SelectActionsType): void => {\n // open the listbox if it is closed\n setIsOpen(true);\n\n if (\n rest.hasAutoCompleteInHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete\n ) {\n return;\n }\n\n if (typeof searchTimeout === 'number') {\n window.clearTimeout(searchTimeout);\n }\n\n searchTimeout = window.setTimeout(() => {\n searchString = '';\n }, 500);\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands\n searchString = searchString + letter;\n const optionTitles = options.map((option) => option.title);\n const searchIndex = getIndexByLetter(optionTitles, searchString, activeIndex + 1);\n\n // if a match was found, go to it\n if (searchIndex >= 0) {\n onOptionChange(actionType, searchIndex);\n }\n // if no matches, clear the timeout and search string\n else {\n window.clearTimeout(searchTimeout);\n searchString = '';\n }\n };\n\n /**\n * Keydown event of combobox. Handles most of the keyboard accessibility of dropdown\n */\n const onTriggerKeydown = (e: {\n event: React.KeyboardEvent<HTMLInputElement | HTMLButtonElement>;\n }): void => {\n if (!isKeydownPressed && ![' ', 'Enter', 'Escape', 'Meta'].includes(e.event.key)) {\n // When keydown is not already pressed and its not Enter, Space, Command, or Escape key (those are generic keys and we only want to handle arrow keys or home buttons etc)\n setIsKeydownPressed(true);\n }\n\n const actionType = getActionFromKey(e.event, isOpen, dropdownTriggerer);\n\n if (actionType) {\n performAction(actionType, e, {\n setIsOpen,\n close,\n onOptionChange,\n onComboType,\n selectCurrentOption: () => {\n if (activeIndex < 0) {\n return;\n }\n\n const isSelected = selectOption(activeIndex);\n if (rest.hasFooterAction && !isReactNative()) {\n rest.triggererRef.current?.focus();\n }\n\n options[activeIndex].onClickTrigger?.(isSelected);\n },\n });\n }\n };\n\n return {\n isOpen,\n setIsOpen,\n close,\n selectedIndices,\n setSelectedIndices,\n filteredValues,\n removeOption,\n setControlledValueIndices,\n onTriggerClick,\n onTriggerKeydown,\n onOptionClick,\n activeIndex,\n setActiveIndex,\n activeTagIndex,\n setActiveTagIndex,\n visibleTagsCountRef,\n isKeydownPressed,\n setIsKeydownPressed,\n changeCallbackTriggerer,\n setChangeCallbackTriggerer,\n isControlled,\n options,\n value: makeInputValue(selectedIndices, options),\n displayValue: makeInputDisplayValue(selectedIndices, options),\n selectionType,\n dropdownTriggerer,\n ...rest,\n };\n};\n\nexport type { DropdownContextType, OptionsType };\nexport { useDropdown, DropdownContext };\n"],"names":["noop","DropdownContext","React","createContext","isOpen","setIsOpen","close","selectedIndices","setSelectedIndices","controlledValueIndices","setControlledValueIndices","options","setOptions","filteredValues","setFilteredValues","activeIndex","setActiveIndex","activeTagIndex","setActiveTagIndex","shouldIgnoreBlurAnimation","setShouldIgnoreBlurAnimation","hasFooterAction","setHasFooterAction","hasAutoCompleteInHeader","setHasAutoCompleteInHeader","isKeydownPressed","setIsKeydownPressed","changeCallbackTriggerer","setChangeCallbackTriggerer","isControlled","setIsControlled","dropdownBaseId","actionListItemRef","current","triggererRef","headerAutoCompleteRef","isTagDismissedRef","visibleTagsCountRef","triggererWrapperRef","searchTimeout","searchString","useDropdown","_React$useContext","useContext","selectionType","dropdownTriggerer","rest","_objectWithoutProperties","_excluded","setIndices","indices","removeOption","index","existingItemIndex","indexOf","concat","_toConsumableArray","slice","selectOption","properties","arguments","length","undefined","closeOnSelection","isSelected","includes","onTriggerClick","onOptionChange","actionType","newIndex","updatedIndex","hasAutoComplete","dropdownComponentIds","triggers","AutoComplete","filteredIndexes","map","filteredValue","findIndex","option","value","sort","a","b","getUpdatedIndex","currentIndex","maxIndex","optionValues","ensureScrollVisiblity","isBrowser","fireNativeEvent","onOptionClick","e","getActionFromKey","isReactNative","_rest$headerAutoCompl","focus","_rest$triggererRef$cu","onComboType","letter","window","clearTimeout","setTimeout","optionTitles","title","searchIndex","getIndexByLetter","onTriggerKeydown","event","key","performAction","selectCurrentOption","_options$activeIndex$","_options$activeIndex","_rest$triggererRef$cu2","onClickTrigger","call","Object","assign","makeInputValue","displayValue","makeInputDisplayValue"],"mappings":";;;;;;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,QAAA,CAAA,WAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,oBAAA,CAAA,aAAA,CAAA,gBAAA,CAAA,gBAAA,CAAA,mBAAA,CAAA,qBAAA,CAAA,kBAAA,CAAA,qBAAA,CAAA,SAAA,CAAA,eAAA,CAAA,yBAAA,CAAA,4BAAA,CAAA,cAAA,CAAA,2BAAA,CAAA,gBAAA,CAAA,mBAAA,CAAA,CAqBA,IAAMA,IAAI,CAAG,SAAPA,IAAIA,EAAe,EAAE,CA0GrB,IAAAC,eAAe,CAAGC,cAAK,CAACC,aAAa,CAAsB,CAC/DC,MAAM,CAAE,KAAK,CACbC,SAAS,CAAEL,IAAI,CACfM,KAAK,CAAEN,IAAI,CACXO,eAAe,CAAE,EAAE,CACnBC,kBAAkB,CAAER,IAAI,CACxBS,sBAAsB,CAAE,EAAE,CAC1BC,yBAAyB,CAAEV,IAAI,CAC/BW,OAAO,CAAE,EAAE,CACXC,UAAU,CAAEZ,IAAI,CAChBa,cAAc,CAAE,EAAE,CAClBC,iBAAiB,CAAEd,IAAI,CACvBe,WAAW,CAAE,CAAC,CAAC,CACfC,cAAc,CAAEhB,IAAI,CACpBiB,cAAc,CAAE,CAAC,CAAC,CAClBC,iBAAiB,CAAElB,IAAI,CACvBmB,yBAAyB,CAAE,KAAK,CAChCC,4BAA4B,CAAEpB,IAAI,CAClCqB,eAAe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fragment, jsx } from 'react/jsx-runtime';
|
|
10
10
|
import '../Icons/_Svg/Svg/Svg.native.js';
|
|
11
|
+
import '../../tokens/global/typography.js';
|
|
12
|
+
import '../../tokens/global/motion.js';
|
|
11
13
|
import 'styled-components/native';
|
|
12
14
|
import '@gorhom/portal';
|
|
13
15
|
import 'react-native-gesture-handler';
|
|
@@ -16,8 +18,6 @@ import 'react-native';
|
|
|
16
18
|
import { getPlatformType } from '../../utils/getPlatformType/getPlatformType.js';
|
|
17
19
|
import '@babel/runtime/helpers/slicedToArray';
|
|
18
20
|
import '../BottomSheet/BottomSheetStack.js';
|
|
19
|
-
import '../../tokens/global/typography.js';
|
|
20
|
-
import '../../tokens/global/motion.js';
|
|
21
21
|
import CheckIcon from '../Icons/CheckIcon/CheckIcon.js';
|
|
22
22
|
import InfoIcon from '../Icons/InfoIcon/InfoIcon.js';
|
|
23
23
|
import { Box } from '../Box/Box.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
2
|
+
import 'react-native-svg';
|
|
3
|
+
import '@babel/runtime/helpers/defineProperty';
|
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
+
import Path from '../_Svg/Path/Path.native.js';
|
|
6
|
+
import Svg from '../_Svg/Svg/Svg.native.js';
|
|
7
|
+
import useIconProps from '../useIconProps/useIconProps.js';
|
|
8
|
+
|
|
9
|
+
var _excluded=["size","color"];var ChevronUpDownIcon=function ChevronUpDownIcon(_ref){var size=_ref.size,color=_ref.color,styledProps=_objectWithoutProperties(_ref,_excluded);var _useIconProps=useIconProps({size:size,color:color}),height=_useIconProps.height,width=_useIconProps.width,iconColor=_useIconProps.iconColor;return jsxs(Svg,Object.assign({},styledProps,{width:width,height:height,viewBox:"0 0 24 24",fill:"none",children:[jsx(Path,{d:"M12.7071 3.29289C12.3166 2.90237 11.6834 2.90237 11.2929 3.29289L7.29289 7.29289C6.90237 7.68342 6.90237 8.31658 7.29289 8.70711C7.68342 9.09763 8.31658 9.09763 8.70711 8.70711L12 5.41421L15.2929 8.70711C15.6834 9.09763 16.3166 9.09763 16.7071 8.70711C17.0976 8.31658 17.0976 7.68342 16.7071 7.29289L12.7071 3.29289Z",fill:iconColor}),jsx(Path,{d:"M8.70711 15.2929C8.31658 14.9024 7.68342 14.9024 7.29289 15.2929C6.90237 15.6834 6.90237 16.3166 7.29289 16.7071L11.2929 20.7071C11.6834 21.0976 12.3166 21.0976 12.7071 20.7071L16.7071 16.7071C17.0976 16.3166 17.0976 15.6834 16.7071 15.2929C16.3166 14.9024 15.6834 14.9024 15.2929 15.2929L12 18.5858L8.70711 15.2929Z",fill:iconColor})]}));};
|
|
10
|
+
|
|
11
|
+
export { ChevronUpDownIcon as default };
|
|
12
|
+
//# sourceMappingURL=ChevronUpDownIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChevronUpDownIcon.js","sources":["../../../../../../src/components/Icons/ChevronUpDownIcon/ChevronUpDownIcon.tsx"],"sourcesContent":["import { Svg, Path } from '../_Svg';\nimport type { IconComponent } from '..';\nimport useIconProps from '../useIconProps';\n\nconst ChevronUpDownIcon: IconComponent = ({ size, color, ...styledProps }) => {\n const { height, width, iconColor } = useIconProps({ size, color });\n\n return (\n <Svg {...styledProps} width={width} height={height} viewBox=\"0 0 24 24\" fill=\"none\">\n <Path\n d=\"M12.7071 3.29289C12.3166 2.90237 11.6834 2.90237 11.2929 3.29289L7.29289 7.29289C6.90237 7.68342 6.90237 8.31658 7.29289 8.70711C7.68342 9.09763 8.31658 9.09763 8.70711 8.70711L12 5.41421L15.2929 8.70711C15.6834 9.09763 16.3166 9.09763 16.7071 8.70711C17.0976 8.31658 17.0976 7.68342 16.7071 7.29289L12.7071 3.29289Z\"\n fill={iconColor}\n />\n <Path\n d=\"M8.70711 15.2929C8.31658 14.9024 7.68342 14.9024 7.29289 15.2929C6.90237 15.6834 6.90237 16.3166 7.29289 16.7071L11.2929 20.7071C11.6834 21.0976 12.3166 21.0976 12.7071 20.7071L16.7071 16.7071C17.0976 16.3166 17.0976 15.6834 16.7071 15.2929C16.3166 14.9024 15.6834 14.9024 15.2929 15.2929L12 18.5858L8.70711 15.2929Z\"\n fill={iconColor}\n />\n </Svg>\n );\n};\n\nexport default ChevronUpDownIcon;\n"],"names":["ChevronUpDownIcon","_ref","size","color","styledProps","_objectWithoutProperties","_excluded","_useIconProps","useIconProps","height","width","iconColor","_jsxs","Svg","Object","assign","viewBox","fill","children","_jsx","Path","d"],"mappings":";;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,MAAA,CAAA,OAAA,CAAA,CAIM,IAAAA,iBAAgC,CAAG,SAAnCA,iBAAgCA,CAAAC,IAAA,CAAwC,KAAlCC,IAAI,CAAAD,IAAA,CAAJC,IAAI,CAAEC,KAAK,CAAAF,IAAA,CAALE,KAAK,CAAKC,WAAW,CAAAC,wBAAA,CAAAJ,IAAA,CAAAK,SAAA,CAAA,CACrE,IAAAC,aAAA,CAAqCC,YAAY,CAAC,CAAEN,IAAI,CAAJA,IAAI,CAAEC,KAAK,CAALA,KAAM,CAAC,CAAC,CAA1DM,MAAM,CAAAF,aAAA,CAANE,MAAM,CAAEC,KAAK,CAAAH,aAAA,CAALG,KAAK,CAAEC,SAAS,CAAAJ,aAAA,CAATI,SAAS,CAEhC,OACEC,IAAA,CAACC,GAAG,CAAAC,MAAA,CAAAC,MAAA,CAAKX,EAAAA,CAAAA,WAAW,CAAEM,CAAAA,KAAK,CAAEA,KAAM,CAACD,MAAM,CAAEA,MAAO,CAACO,OAAO,CAAC,WAAW,CAACC,IAAI,CAAC,MAAM,CAAAC,QAAA,CAAA,CACjFC,GAAA,CAACC,IAAI,CAAA,CACHC,CAAC,CAAC,8TAA8T,CAChUJ,IAAI,CAAEN,SAAU,CACjB,CAAC,CACFQ,GAAA,CAACC,IAAI,CACHC,CAAAA,CAAC,CAAC,8TAA8T,CAChUJ,IAAI,CAAEN,SAAU,CACjB,CAAC,CAAA,CAAA,CACC,CAAC,CAEV;;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import '../../../tokens/global/typography.js';
|
|
2
|
+
import '../../../tokens/global/motion.js';
|
|
3
|
+
import { size } from '../../../tokens/global/size.js';
|
|
4
|
+
|
|
5
|
+
var iconSizeMap={xsmall:size[8],small:size[12],medium:size[16],large:size[20],xlarge:size[24],'2xlarge':size[32]};
|
|
6
|
+
|
|
7
|
+
export { iconSizeMap };
|
|
8
|
+
//# sourceMappingURL=iconSizeMap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iconSizeMap.js","sources":["../../../../../../src/components/Icons/useIconProps/iconSizeMap.ts"],"sourcesContent":["import { size } from '~tokens/global';\n\nconst iconSizeMap = {\n xsmall: size[8],\n small: size[12],\n medium: size[16],\n large: size[20],\n xlarge: size[24],\n '2xlarge': size[32],\n} as const;\n\nexport { iconSizeMap };\n"],"names":["iconSizeMap","xsmall","size","small","medium","large","xlarge"],"mappings":";;;;AAEM,IAAAA,WAAW,CAAG,CAClBC,MAAM,CAAEC,IAAI,CAAC,CAAC,CAAC,CACfC,KAAK,CAAED,IAAI,CAAC,EAAE,CAAC,CACfE,MAAM,CAAEF,IAAI,CAAC,EAAE,CAAC,CAChBG,KAAK,CAAEH,IAAI,CAAC,EAAE,CAAC,CACfI,MAAM,CAAEJ,IAAI,CAAC,EAAE,CAAC,CAChB,SAAS,CAAEA,IAAI,CAAC,EAAE,CACpB;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { iconSizeMap } from './iconSizeMap.js';
|
|
1
2
|
import getIn from '../../../utils/lodashButBetter/get.js';
|
|
2
3
|
import 'styled-components/native';
|
|
3
4
|
import '@gorhom/portal';
|
|
@@ -9,11 +10,8 @@ import 'react';
|
|
|
9
10
|
import { makeSize } from '../../../utils/makeSize/makeSize.js';
|
|
10
11
|
import '../../BottomSheet/BottomSheetStack.js';
|
|
11
12
|
import 'react/jsx-runtime';
|
|
12
|
-
import '../../../tokens/global/typography.js';
|
|
13
|
-
import '../../../tokens/global/motion.js';
|
|
14
|
-
import { size } from '../../../tokens/global/size.js';
|
|
15
13
|
|
|
16
|
-
|
|
14
|
+
function useIconProps(_ref){var _ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,_ref$color=_ref.color,color=_ref$color===void 0?'surface.icon.gray.normal':_ref$color;var _useTheme=useTheme(),theme=_useTheme.theme;var height=makeSize(iconSizeMap[size]);var width=makeSize(iconSizeMap[size]);var iconColor=color==='currentColor'?'currentColor':getIn(theme.colors,color,'');return {height:height,width:width,iconColor:iconColor};}
|
|
17
15
|
|
|
18
16
|
export { useIconProps as default };
|
|
19
17
|
//# sourceMappingURL=useIconProps.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIconProps.js","sources":["../../../../../../src/components/Icons/useIconProps/useIconProps.tsx"],"sourcesContent":["import type { IconProps } from '..';\nimport get from '~utils/lodashButBetter/get';\nimport { useTheme } from '~components/BladeProvider';\nimport {
|
|
1
|
+
{"version":3,"file":"useIconProps.js","sources":["../../../../../../src/components/Icons/useIconProps/useIconProps.tsx"],"sourcesContent":["import type { IconProps } from '..';\nimport { iconSizeMap } from './iconSizeMap';\nimport get from '~utils/lodashButBetter/get';\nimport { useTheme } from '~components/BladeProvider';\nimport { makeSize } from '~utils/makeSize';\n\nfunction useIconProps({\n size = 'medium',\n color = 'surface.icon.gray.normal',\n}: IconProps): {\n height: `${typeof iconSizeMap[keyof typeof iconSizeMap]}px`;\n width: `${typeof iconSizeMap[keyof typeof iconSizeMap]}px`;\n iconColor: string;\n} {\n const { theme } = useTheme();\n const height = makeSize(iconSizeMap[size]);\n const width = makeSize(iconSizeMap[size]);\n const iconColor = color === 'currentColor' ? 'currentColor' : get(theme.colors, color, '');\n\n return { height, width, iconColor };\n}\n\nexport default useIconProps;\n"],"names":["useIconProps","_ref","_ref$size","size","_ref$color","color","_useTheme","useTheme","theme","height","makeSize","iconSizeMap","width","iconColor","get","colors"],"mappings":";;;;;;;;;;;;;AAMA,SAASA,YAAYA,CAAAC,IAAA,CAOnB,CAAA,IAAAC,SAAA,CAAAD,IAAA,CANAE,IAAI,CAAJA,IAAI,CAAAD,SAAA,GAAA,KAAA,CAAA,CAAG,QAAQ,CAAAA,SAAA,CAAAE,UAAA,CAAAH,IAAA,CACfI,KAAK,CAALA,KAAK,CAAAD,UAAA,GAAA,KAAA,CAAA,CAAG,0BAA0B,CAAAA,UAAA,CAMlC,IAAAE,SAAA,CAAkBC,QAAQ,EAAE,CAApBC,KAAK,CAAAF,SAAA,CAALE,KAAK,CACb,IAAMC,MAAM,CAAGC,QAAQ,CAACC,WAAW,CAACR,IAAI,CAAC,CAAC,CAC1C,IAAMS,KAAK,CAAGF,QAAQ,CAACC,WAAW,CAACR,IAAI,CAAC,CAAC,CACzC,IAAMU,SAAS,CAAGR,KAAK,GAAK,cAAc,CAAG,cAAc,CAAGS,KAAG,CAACN,KAAK,CAACO,MAAM,CAAEV,KAAK,CAAE,EAAE,CAAC,CAE1F,OAAO,CAAEI,MAAM,CAANA,MAAM,CAAEG,KAAK,CAALA,KAAK,CAAEC,SAAS,CAATA,SAAU,CAAC,CACrC;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { throwBladeError } from '../../utils/logger/logger.js';
|
|
2
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
var InfoGroup=function InfoGroup(_props){throwBladeError({message:'InfoGroup is not yet implemented for React Native',moduleName:'InfoGroup'});return jsx(Fragment,{});};var InfoItem=function InfoItem(_props){throwBladeError({message:'InfoItem is not yet implemented for React Native',moduleName:'InfoItem'});return jsx(Fragment,{});};var InfoItemKey=function InfoItemKey(_props){throwBladeError({message:'InfoItemKey is not yet implemented for React Native',moduleName:'InfoItemKey'});return jsx(Fragment,{});};var InfoItemValue=function InfoItemValue(_props){throwBladeError({message:'InfoItemValue is not yet implemented for React Native',moduleName:'InfoItemValue'});return jsx(Fragment,{});};
|
|
5
|
+
|
|
6
|
+
export { InfoGroup, InfoItem, InfoItemKey, InfoItemValue };
|
|
7
|
+
//# sourceMappingURL=InfoGroup.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InfoGroup.native.js","sources":["../../../../../src/components/InfoGroup/InfoGroup.native.tsx"],"sourcesContent":["/* eslint-disable react/jsx-no-useless-fragment */\nimport type { InfoGroupProps, InfoItemProps, InfoItemKeyProps, InfoItemValueProps } from './types';\nimport { throwBladeError } from '~utils/logger';\n\nconst InfoGroup = (_props: InfoGroupProps): React.ReactElement => {\n throwBladeError({\n message: 'InfoGroup is not yet implemented for React Native',\n moduleName: 'InfoGroup',\n });\n\n return <></>;\n};\n\nconst InfoItem = (_props: InfoItemProps): React.ReactElement => {\n throwBladeError({\n message: 'InfoItem is not yet implemented for React Native',\n moduleName: 'InfoItem',\n });\n\n return <></>;\n};\n\nconst InfoItemKey = (_props: InfoItemKeyProps): React.ReactElement => {\n throwBladeError({\n message: 'InfoItemKey is not yet implemented for React Native',\n moduleName: 'InfoItemKey',\n });\n\n return <></>;\n};\n\nconst InfoItemValue = (_props: InfoItemValueProps): React.ReactElement => {\n throwBladeError({\n message: 'InfoItemValue is not yet implemented for React Native',\n moduleName: 'InfoItemValue',\n });\n\n return <></>;\n};\n\nexport { InfoGroup, InfoItem, InfoItemKey, InfoItemValue };\n"],"names":["InfoGroup","_props","throwBladeError","message","moduleName","_jsx","_Fragment","InfoItem","InfoItemKey","InfoItemValue"],"mappings":";;;AAIM,IAAAA,SAAS,CAAG,SAAZA,SAASA,CAAIC,MAAsB,CAAyB,CAChEC,eAAe,CAAC,CACdC,OAAO,CAAE,mDAAmD,CAC5DC,UAAU,CAAE,WACd,CAAC,CAAC,CAEF,OAAOC,GAAA,CAAAC,QAAA,CAAI,EAAA,CAAC,CACd,EAEM,IAAAC,QAAQ,CAAG,SAAXA,QAAQA,CAAIN,MAAqB,CAAyB,CAC9DC,eAAe,CAAC,CACdC,OAAO,CAAE,kDAAkD,CAC3DC,UAAU,CAAE,UACd,CAAC,CAAC,CAEF,OAAOC,GAAA,CAAAC,QAAA,GAAI,CAAC,CACd,EAEM,IAAAE,WAAW,CAAG,SAAdA,WAAWA,CAAIP,MAAwB,CAAyB,CACpEC,eAAe,CAAC,CACdC,OAAO,CAAE,qDAAqD,CAC9DC,UAAU,CAAE,aACd,CAAC,CAAC,CAEF,OAAOC,GAAA,CAAAC,QAAA,GAAI,CAAC,CACd,EAEM,IAAAG,aAAa,CAAG,SAAhBA,aAAaA,CAAIR,MAA0B,CAAyB,CACxEC,eAAe,CAAC,CACdC,OAAO,CAAE,uDAAuD,CAChEC,UAAU,CAAE,eACd,CAAC,CAAC,CAEF,OAAOC,GAAA,CAAAC,QAAA,CAAA,EAAI,CAAC,CACd;;;;"}
|