@razorpay/blade 11.2.0 → 11.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lib/native/components/Dropdown/Dropdown.js +1 -1
- package/build/lib/native/components/Dropdown/Dropdown.js.map +1 -1
- package/build/lib/native/components/Toast/Toast.native.js +7 -0
- package/build/lib/native/components/Toast/Toast.native.js.map +1 -0
- package/build/lib/native/components/Toast/ToastContainer.native.js +7 -0
- package/build/lib/native/components/Toast/ToastContainer.native.js.map +1 -0
- package/build/lib/native/components/Toast/useToast.js +9 -0
- package/build/lib/native/components/Toast/useToast.js.map +1 -0
- package/build/lib/native/components/index.js +2 -0
- package/build/lib/native/components/index.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/Dropdown.js +1 -1
- package/build/lib/web/development/components/Dropdown/Dropdown.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/BaseInputTagSlot.web.js +15 -1
- package/build/lib/web/development/components/Input/BaseInput/BaseInputTagSlot.web.js.map +1 -1
- package/build/lib/web/development/components/Toast/Toast.web.js +144 -0
- package/build/lib/web/development/components/Toast/Toast.web.js.map +1 -0
- package/build/lib/web/development/components/Toast/ToastContainer.web.js +305 -0
- package/build/lib/web/development/components/Toast/ToastContainer.web.js.map +1 -0
- package/build/lib/web/development/components/Toast/constants.js +26 -0
- package/build/lib/web/development/components/Toast/constants.js.map +1 -0
- package/build/lib/web/development/components/Toast/index.js +4 -0
- package/build/lib/web/development/components/Toast/index.js.map +1 -0
- package/build/lib/web/development/components/Toast/types.js +2 -0
- package/build/lib/web/development/components/Toast/types.js.map +1 -0
- package/build/lib/web/development/components/Toast/useToast.js +66 -0
- package/build/lib/web/development/components/Toast/useToast.js.map +1 -0
- package/build/lib/web/development/components/index.js +3 -0
- package/build/lib/web/development/components/index.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/Dropdown.js +1 -1
- package/build/lib/web/production/components/Dropdown/Dropdown.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/BaseInputTagSlot.web.js +15 -1
- package/build/lib/web/production/components/Input/BaseInput/BaseInputTagSlot.web.js.map +1 -1
- package/build/lib/web/production/components/Toast/Toast.web.js +144 -0
- package/build/lib/web/production/components/Toast/Toast.web.js.map +1 -0
- package/build/lib/web/production/components/Toast/ToastContainer.web.js +305 -0
- package/build/lib/web/production/components/Toast/ToastContainer.web.js.map +1 -0
- package/build/lib/web/production/components/Toast/constants.js +26 -0
- package/build/lib/web/production/components/Toast/constants.js.map +1 -0
- package/build/lib/web/production/components/Toast/index.js +4 -0
- package/build/lib/web/production/components/Toast/index.js.map +1 -0
- package/build/lib/web/production/components/Toast/types.js +2 -0
- package/build/lib/web/production/components/Toast/types.js.map +1 -0
- package/build/lib/web/production/components/Toast/useToast.js +66 -0
- package/build/lib/web/production/components/Toast/useToast.js.map +1 -0
- package/build/lib/web/production/components/index.js +3 -0
- package/build/lib/web/production/components/index.js.map +1 -1
- package/build/types/components/index.d.ts +71 -1
- package/build/types/components/index.native.d.ts +71 -1
- package/package.json +3 -1
|
@@ -21,7 +21,7 @@ import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
|
|
|
21
21
|
import { useControllableState } from '../../utils/useControllable.js';
|
|
22
22
|
import { jsx } from 'react/jsx-runtime';
|
|
23
23
|
|
|
24
|
-
var _excluded=["children","isOpen","onOpenChange","selectionType","testID"];var validDropdownChildren=[dropdownComponentIds.triggers.SelectInput,dropdownComponentIds.triggers.DropdownButton,dropdownComponentIds.triggers.DropdownLink,dropdownComponentIds.DropdownOverlay,dropdownComponentIds.triggers.AutoComplete,ComponentIds.BottomSheet];var _Dropdown=function _Dropdown(_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,styledProps=_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),hasAutoCompleteInBottomSheetHeader=_React$useState18[0],setHasAutoCompleteInBottomSheetHeader=_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 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.DropdownButton)){dropdownTriggerer.current='DropdownButton';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.AutoComplete)){dropdownTriggerer.current='AutoComplete';}}});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,triggererWrapperRef:triggererWrapperRef,actionListItemRef:actionListItemRef,selectionType:selectionType,hasFooterAction:hasFooterAction,setHasFooterAction:setHasFooterAction,hasAutoCompleteInBottomSheetHeader:hasAutoCompleteInBottomSheetHeader,setHasAutoCompleteInBottomSheetHeader:setHasAutoCompleteInBottomSheetHeader,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,hasAutoCompleteInBottomSheetHeader:hasAutoCompleteInBottomSheetHeader,setDropdownHasBottomSheet:setDropdownHasBottomSheet,onBottomSheetDismiss:close};},[dropdownHasBottomSheet,hasAutoCompleteInBottomSheetHeader,isDropdownOpen,close]);React__default.useEffect(function(){if(!isReactNative()){var dropdown=dropdownContainerRef.current;var documentClickHandler=function documentClickHandler(e){var _isTagDismissedRef$cu,_isTagDismissedRef$cu2;var target=e.target;if(!target||!dropdown){return;}var isOutsideClick=!dropdown.contains(target)&&!((_isTagDismissedRef$cu=isTagDismissedRef.current)!=null&&_isTagDismissedRef$cu.value);var isDropdownOpenState=isDropdownOpenRef.current;if(isOutsideClick&&isDropdownOpenState){close();}if((_isTagDismissedRef$cu2=isTagDismissedRef.current)!=null&&_isTagDismissedRef$cu2.value){isTagDismissedRef.current.value=false;}};var documentFocusHandler=function documentFocusHandler(e){var target=e.relatedTarget;setActiveIndex(-1);if(!dropdown||!target){return;}if(!dropdown.contains(target)){close();}};document.addEventListener('click',documentClickHandler);document.addEventListener('focusout',documentFocusHandler);return function(){document.removeEventListener('click',documentClickHandler);document.removeEventListener('focusout',documentFocusHandler);};}return undefined;},[]);return jsx(BottomSheetAndDropdownGlueContext.Provider,{value:BottomSheetAndDropdownGlueContextValue,children:jsx(DropdownContext.Provider,{value:contextValue,children:jsx(BaseBox,Object.assign({ref:dropdownContainerRef},metaAttribute({name:MetaConstants.Dropdown,testID:testID}),getStyledProps(styledProps),{children:jsx(BaseBox,{position:"relative",textAlign:'left',children:children})}))})});};var Dropdown=assignWithoutSideEffects(_Dropdown,{componentId:dropdownComponentIds.Dropdown});
|
|
24
|
+
var _excluded=["children","isOpen","onOpenChange","selectionType","testID"];var validDropdownChildren=[dropdownComponentIds.triggers.SelectInput,dropdownComponentIds.triggers.DropdownButton,dropdownComponentIds.triggers.DropdownLink,dropdownComponentIds.DropdownOverlay,dropdownComponentIds.triggers.AutoComplete,ComponentIds.BottomSheet];var _Dropdown=function _Dropdown(_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,styledProps=_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),hasAutoCompleteInBottomSheetHeader=_React$useState18[0],setHasAutoCompleteInBottomSheetHeader=_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 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.DropdownButton)){dropdownTriggerer.current='DropdownButton';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.AutoComplete)){dropdownTriggerer.current='AutoComplete';}}});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,triggererWrapperRef:triggererWrapperRef,actionListItemRef:actionListItemRef,selectionType:selectionType,hasFooterAction:hasFooterAction,setHasFooterAction:setHasFooterAction,hasAutoCompleteInBottomSheetHeader:hasAutoCompleteInBottomSheetHeader,setHasAutoCompleteInBottomSheetHeader:setHasAutoCompleteInBottomSheetHeader,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,hasAutoCompleteInBottomSheetHeader:hasAutoCompleteInBottomSheetHeader,setDropdownHasBottomSheet:setDropdownHasBottomSheet,onBottomSheetDismiss:close};},[dropdownHasBottomSheet,hasAutoCompleteInBottomSheetHeader,isDropdownOpen,close]);React__default.useEffect(function(){if(!isReactNative()){var dropdown=dropdownContainerRef.current;var documentClickHandler=function documentClickHandler(e){var _isTagDismissedRef$cu,_isTagDismissedRef$cu2;var target=e.target;if(!target||!dropdown){return;}var isOutsideClick=!dropdown.contains(target)&&!((_isTagDismissedRef$cu=isTagDismissedRef.current)!=null&&_isTagDismissedRef$cu.value)&&document.body.contains(target);var isDropdownOpenState=isDropdownOpenRef.current;if(isOutsideClick&&isDropdownOpenState){close();}if((_isTagDismissedRef$cu2=isTagDismissedRef.current)!=null&&_isTagDismissedRef$cu2.value){isTagDismissedRef.current.value=false;}};var documentFocusHandler=function documentFocusHandler(e){var target=e.relatedTarget;setActiveIndex(-1);if(!dropdown||!target){return;}if(!dropdown.contains(target)){close();}};document.addEventListener('click',documentClickHandler);document.addEventListener('focusout',documentFocusHandler);return function(){document.removeEventListener('click',documentClickHandler);document.removeEventListener('focusout',documentFocusHandler);};}return undefined;},[]);return jsx(BottomSheetAndDropdownGlueContext.Provider,{value:BottomSheetAndDropdownGlueContextValue,children:jsx(DropdownContext.Provider,{value:contextValue,children:jsx(BaseBox,Object.assign({ref:dropdownContainerRef},metaAttribute({name:MetaConstants.Dropdown,testID:testID}),getStyledProps(styledProps),{children:jsx(BaseBox,{position:"relative",textAlign:'left',children:children})}))})});};var Dropdown=assignWithoutSideEffects(_Dropdown,{componentId:dropdownComponentIds.Dropdown});
|
|
25
25
|
|
|
26
26
|
export { Dropdown };
|
|
27
27
|
//# 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 { isReactNative } from '~utils';\nimport { MetaConstants, metaAttribute } from '~utils/metaAttribute';\nimport { throwBladeError } from '~utils/logger';\nimport type { ContainerElementType } from '~utils/types';\nimport { useControllableState } from '~utils/useControllable';\n\nconst validDropdownChildren = [\n dropdownComponentIds.triggers.SelectInput,\n dropdownComponentIds.triggers.DropdownButton,\n dropdownComponentIds.triggers.DropdownLink,\n dropdownComponentIds.DropdownOverlay,\n dropdownComponentIds.triggers.AutoComplete,\n bottomSheetComponentIds.BottomSheet,\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 children,\n isOpen: isOpenControlled,\n onOpenChange,\n selectionType = 'single',\n testID,\n ...styledProps\n}: DropdownProps): 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 [\n hasAutoCompleteInBottomSheetHeader,\n setHasAutoCompleteInBottomSheetHeader,\n ] = 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 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.DropdownButton)) {\n dropdownTriggerer.current = 'DropdownButton';\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.AutoComplete)) {\n dropdownTriggerer.current = 'AutoComplete';\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 triggererWrapperRef,\n actionListItemRef,\n selectionType,\n hasFooterAction,\n setHasFooterAction,\n hasAutoCompleteInBottomSheetHeader,\n setHasAutoCompleteInBottomSheetHeader,\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 hasAutoCompleteInBottomSheetHeader,\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, hasAutoCompleteInBottomSheetHeader, isDropdownOpen, close]);\n\n React.useEffect((): (() => void) | undefined => {\n if (!isReactNative()) {\n const dropdown = dropdownContainerRef.current;\n\n const documentClickHandler = (e: MouseEvent): void => {\n const target = e.target as HTMLDivElement;\n\n if (!target || !dropdown) {\n return;\n }\n\n const isOutsideClick = !dropdown.contains(target) && !isTagDismissedRef.current?.value;\n\n const isDropdownOpenState = isDropdownOpenRef.current;\n if (isOutsideClick && isDropdownOpenState) {\n close();\n }\n\n if (isTagDismissedRef.current?.value) {\n isTagDismissedRef.current.value = false;\n }\n };\n\n const documentFocusHandler = (e: FocusEvent): void => {\n const target = e.relatedTarget as HTMLDivElement;\n setActiveIndex(-1);\n\n if (!dropdown || !target) {\n return;\n }\n\n if (!dropdown.contains(target)) {\n close();\n }\n };\n\n document.addEventListener('click', documentClickHandler);\n document.addEventListener('focusout', documentFocusHandler);\n\n return (): void => {\n document.removeEventListener('click', documentClickHandler);\n document.removeEventListener('focusout', documentFocusHandler);\n };\n }\n\n return undefined;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\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={dropdownContainerRef as any}\n {...metaAttribute({ name: MetaConstants.Dropdown, testID })}\n {...getStyledProps(styledProps)}\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(_Dropdown, {\n componentId: dropdownComponentIds.Dropdown,\n});\n\nexport { Dropdown };\n"],"names":["validDropdownChildren","dropdownComponentIds","triggers","SelectInput","DropdownButton","DropdownLink","DropdownOverlay","AutoComplete","bottomSheetComponentIds","BottomSheet","_Dropdown","_ref","children","isOpenControlled","isOpen","onOpenChange","_ref$selectionType","selectionType","testID","styledProps","_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","hasAutoCompleteInBottomSheetHeader","setHasAutoCompleteInBottomSheetHeader","_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","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","useEffect","isReactNative","dropdown","documentClickHandler","e","_isTagDismissedRef$cu","_isTagDismissedRef$cu2","target","isOutsideClick","contains","isDropdownOpenState","documentFocusHandler","relatedTarget","document","addEventListener","removeEventListener","undefined","_jsx","BottomSheetAndDropdownGlueContext","Provider","DropdownContext","BaseBox","Object","assign","ref","metaAttribute","name","MetaConstants","Dropdown","getStyledProps","position","textAlign","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,UAAA,CAAA,QAAA,CAAA,cAAA,CAAA,eAAA,CAAA,QAAA,CAAA,CAkBA,IAAMA,qBAAqB,CAAG,CAC5BC,oBAAoB,CAACC,QAAQ,CAACC,WAAW,CACzCF,oBAAoB,CAACC,QAAQ,CAACE,cAAc,CAC5CH,oBAAoB,CAACC,QAAQ,CAACG,YAAY,CAC1CJ,oBAAoB,CAACK,eAAe,CACpCL,oBAAoB,CAACC,QAAQ,CAACK,YAAY,CAC1CC,YAAuB,CAACC,WAAW,CACpC,CA4BD,IAAMC,SAAS,CAAG,SAAZA,SAASA,CAAAC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N,OACEC,GAAA,CAACC,iCAAiC,CAACC,QAAQ,CAACvD,CAAAA,KAAK,CAAEkC,sCAAuC,CAAAzG,QAAA,CACxF4H,GAAA,CAACG,eAAe,CAACD,QAAQ,CAAA,CAACvD,KAAK,CAAEgC,YAAa,CAAAvG,QAAA,CAC5C4H,GAAA,CAACI,OAAO,CAAAC,MAAA,CAAAC,MAAA,CAENC,CAAAA,GAAG,CAAE1D,oBAA4B,CAAA,CAC7B2D,aAAa,CAAC,CAAEC,IAAI,CAAEC,aAAa,CAACC,QAAQ,CAAEjI,MAAM,CAANA,MAAO,CAAC,CAAC,CACvDkI,cAAc,CAACjI,WAAW,CAAC,EAAAP,QAAA,CAE/B4H,GAAA,CAACI,OAAO,CAACS,CAAAA,QAAQ,CAAC,UAAU,CAACC,SAAS,CAAE,MAAgB,CAAA1I,QAAA,CACrDA,QAAQ,CACF,CAAC,CAAA,CACH,CAAC,CACc,CAAC,CACe,CAAC,CAEjD,CAAC,CAEK,IAAAuI,QAAQ,CAAGI,wBAAwB,CAAC7I,SAAS,CAAE,CACnD8I,WAAW,CAAEvJ,oBAAoB,CAACkJ,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 { isReactNative } from '~utils';\nimport { MetaConstants, metaAttribute } from '~utils/metaAttribute';\nimport { throwBladeError } from '~utils/logger';\nimport type { ContainerElementType } from '~utils/types';\nimport { useControllableState } from '~utils/useControllable';\n\nconst validDropdownChildren = [\n dropdownComponentIds.triggers.SelectInput,\n dropdownComponentIds.triggers.DropdownButton,\n dropdownComponentIds.triggers.DropdownLink,\n dropdownComponentIds.DropdownOverlay,\n dropdownComponentIds.triggers.AutoComplete,\n bottomSheetComponentIds.BottomSheet,\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 children,\n isOpen: isOpenControlled,\n onOpenChange,\n selectionType = 'single',\n testID,\n ...styledProps\n}: DropdownProps): 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 [\n hasAutoCompleteInBottomSheetHeader,\n setHasAutoCompleteInBottomSheetHeader,\n ] = 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 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.DropdownButton)) {\n dropdownTriggerer.current = 'DropdownButton';\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.AutoComplete)) {\n dropdownTriggerer.current = 'AutoComplete';\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 triggererWrapperRef,\n actionListItemRef,\n selectionType,\n hasFooterAction,\n setHasFooterAction,\n hasAutoCompleteInBottomSheetHeader,\n setHasAutoCompleteInBottomSheetHeader,\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 hasAutoCompleteInBottomSheetHeader,\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, hasAutoCompleteInBottomSheetHeader, isDropdownOpen, close]);\n\n React.useEffect((): (() => void) | undefined => {\n if (!isReactNative()) {\n const dropdown = dropdownContainerRef.current;\n\n const documentClickHandler = (e: MouseEvent): void => {\n const target = e.target as HTMLDivElement;\n\n if (!target || !dropdown) {\n return;\n }\n\n const isOutsideClick =\n !dropdown.contains(target) &&\n !isTagDismissedRef.current?.value &&\n document.body.contains(target);\n\n const isDropdownOpenState = isDropdownOpenRef.current;\n if (isOutsideClick && isDropdownOpenState) {\n close();\n }\n\n if (isTagDismissedRef.current?.value) {\n isTagDismissedRef.current.value = false;\n }\n };\n\n const documentFocusHandler = (e: FocusEvent): void => {\n const target = e.relatedTarget as HTMLDivElement;\n setActiveIndex(-1);\n\n if (!dropdown || !target) {\n return;\n }\n\n if (!dropdown.contains(target)) {\n close();\n }\n };\n\n document.addEventListener('click', documentClickHandler);\n document.addEventListener('focusout', documentFocusHandler);\n\n return (): void => {\n document.removeEventListener('click', documentClickHandler);\n document.removeEventListener('focusout', documentFocusHandler);\n };\n }\n\n return undefined;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\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={dropdownContainerRef as any}\n {...metaAttribute({ name: MetaConstants.Dropdown, testID })}\n {...getStyledProps(styledProps)}\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(_Dropdown, {\n componentId: dropdownComponentIds.Dropdown,\n});\n\nexport { Dropdown };\n"],"names":["validDropdownChildren","dropdownComponentIds","triggers","SelectInput","DropdownButton","DropdownLink","DropdownOverlay","AutoComplete","bottomSheetComponentIds","BottomSheet","_Dropdown","_ref","children","isOpenControlled","isOpen","onOpenChange","_ref$selectionType","selectionType","testID","styledProps","_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","hasAutoCompleteInBottomSheetHeader","setHasAutoCompleteInBottomSheetHeader","_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","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","useEffect","isReactNative","dropdown","documentClickHandler","e","_isTagDismissedRef$cu","_isTagDismissedRef$cu2","target","isOutsideClick","contains","document","body","isDropdownOpenState","documentFocusHandler","relatedTarget","addEventListener","removeEventListener","undefined","_jsx","BottomSheetAndDropdownGlueContext","Provider","DropdownContext","BaseBox","Object","assign","ref","metaAttribute","name","MetaConstants","Dropdown","getStyledProps","position","textAlign","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,UAAA,CAAA,QAAA,CAA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import { jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
var Toast=function Toast(_props){throwBladeError({message:'Toast is not yet implemented for native',moduleName:'Toast'});return jsx(Fragment,{});};
|
|
5
|
+
|
|
6
|
+
export { Toast };
|
|
7
|
+
//# sourceMappingURL=Toast.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.native.js","sources":["../../../../../src/components/Toast/Toast.native.tsx"],"sourcesContent":["import type { ToastProps } from './types';\nimport { throwBladeError } from '~utils/logger';\n\nconst Toast = (\n _props: ToastProps & {\n isVisible?: boolean;\n },\n): React.ReactElement => {\n throwBladeError({\n message: 'Toast is not yet implemented for native',\n moduleName: 'Toast',\n });\n\n return <></>;\n};\n\nexport { Toast };\n"],"names":["Toast","_props","throwBladeError","message","moduleName","_jsx","_Fragment"],"mappings":";;;AAGM,IAAAA,KAAK,CAAG,SAARA,KAAKA,CACTC,MAEC,CACsB,CACvBC,eAAe,CAAC,CACdC,OAAO,CAAE,yCAAyC,CAClDC,UAAU,CAAE,OACd,CAAC,CAAC,CAEF,OAAOC,GAAA,CAAAC,QAAA,CAAA,EAAI,CAAC,CACd;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { throwBladeError } from '../../utils/logger/logger.js';
|
|
2
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
var ToastContainer=function ToastContainer(){throwBladeError({message:'ToastContainer is not yet implemented for native',moduleName:'ToastContainer'});return jsx(Fragment,{});};
|
|
5
|
+
|
|
6
|
+
export { ToastContainer };
|
|
7
|
+
//# sourceMappingURL=ToastContainer.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastContainer.native.js","sources":["../../../../../src/components/Toast/ToastContainer.native.tsx"],"sourcesContent":["import { throwBladeError } from '~utils/logger';\n\nconst ToastContainer = (): React.ReactElement => {\n throwBladeError({\n message: 'ToastContainer is not yet implemented for native',\n moduleName: 'ToastContainer',\n });\n\n return <></>;\n};\n\nexport { ToastContainer };\n"],"names":["ToastContainer","throwBladeError","message","moduleName","_jsx","_Fragment"],"mappings":";;;AAEM,IAAAA,cAAc,CAAG,SAAjBA,cAAcA,EAA6B,CAC/CC,eAAe,CAAC,CACdC,OAAO,CAAE,kDAAkD,CAC3DC,UAAU,CAAE,gBACd,CAAC,CAAC,CAEF,OAAOC,GAAA,CAAAC,QAAA,CAAA,EAAI,CAAC,CACd;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import toast, { useToasterStore } from 'react-hot-toast';
|
|
2
|
+
import { Toast } from './Toast.native.js';
|
|
3
|
+
import { logger } from '../../utils/logger/logger.js';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var useToast=function useToast(){var _useToasterStore=useToasterStore(),toasts=_useToasterStore.toasts;var show=function show(props){var _props$type;props.type=(_props$type=props.type)!=null?_props$type:'informational';if(toasts.find(function(t){return t.type==='promotional';})&&props.type==='promotional'){if(__DEV__){logger({message:'There can only be one promotional toast at a time',type:'warn',moduleName:'Toast'});}return '';}var isPromoToast=props.type==='promotional';if(props.autoDismiss===undefined){props.autoDismiss=!isPromoToast;}if(props.duration===undefined){if(isPromoToast){props.duration=8000;}else {props.duration=4000;}}if(!props.autoDismiss){props.duration=Infinity;}return toast.custom(function(_ref){var visible=_ref.visible,id=_ref.id;return jsx(Toast,Object.assign({},props,{id:id,isVisible:visible}));},props);};return {toasts:toasts,show:show,dismiss:toast.dismiss};};
|
|
7
|
+
|
|
8
|
+
export { useToast };
|
|
9
|
+
//# sourceMappingURL=useToast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useToast.js","sources":["../../../../../src/components/Toast/useToast.tsx"],"sourcesContent":["import type { Toast } from 'react-hot-toast';\nimport toast, { useToasterStore } from 'react-hot-toast';\nimport type { ToastProps } from './types';\nimport { Toast as ToastComponent } from './Toast';\nimport { logger } from '~utils/logger';\n\ntype BladeToast = Omit<Toast, 'type'> & ToastProps;\ntype UseToastReturn = {\n toasts: BladeToast[];\n show: (props: ToastProps) => string;\n dismiss: (id?: string) => void;\n};\n\nconst useToast = (): UseToastReturn => {\n const { toasts } = useToasterStore();\n const show = (props: ToastProps): string => {\n props.type = props.type ?? 'informational';\n\n // Do not show promotional toasts if there is already one\n if (\n toasts.find((t) => {\n // @ts-expect-error - react-hot-toast doesn't recognize our promotional type\n return t.type === 'promotional';\n }) &&\n props.type === 'promotional'\n ) {\n if (__DEV__) {\n logger({\n message: 'There can only be one promotional toast at a time',\n type: 'warn',\n moduleName: 'Toast',\n });\n }\n return '';\n }\n\n const isPromoToast = props.type === 'promotional';\n if (props.autoDismiss === undefined) {\n // Promotional toasts should not auto dismiss\n props.autoDismiss = !isPromoToast;\n }\n\n if (props.duration === undefined) {\n // Set default durations\n if (isPromoToast) {\n props.duration = 8000;\n } else {\n props.duration = 4000;\n }\n }\n\n // If autoDismiss is false, set duration to infinity\n if (!props.autoDismiss) {\n props.duration = Infinity;\n }\n\n return toast.custom(({ visible, id }) => {\n return <ToastComponent {...props} id={id} isVisible={visible} />;\n }, props);\n };\n\n return {\n toasts: (toasts as unknown) as BladeToast[],\n show,\n dismiss: toast.dismiss,\n };\n};\n\nexport type { UseToastReturn };\nexport { useToast };\n"],"names":["useToast","_useToasterStore","useToasterStore","toasts","show","props","_props$type","type","find","t","__DEV__","logger","message","moduleName","isPromoToast","autoDismiss","undefined","duration","Infinity","toast","custom","_ref","visible","id","_jsx","ToastComponent","Object","assign","isVisible","dismiss"],"mappings":";;;;;AAaM,IAAAA,QAAQ,CAAG,SAAXA,QAAQA,EAAyB,CACrC,IAAAC,gBAAA,CAAmBC,eAAe,EAAE,CAA5BC,MAAM,CAAAF,gBAAA,CAANE,MAAM,CACd,IAAMC,IAAI,CAAG,SAAPA,IAAIA,CAAIC,KAAiB,CAAa,CAAAC,IAAAA,WAAA,CAC1CD,KAAK,CA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CAC3CC,IAAI,CAAJA,IAAI,CACJyB,OAAO,CAAEV,KAAK,CAACU,OACjB,CAAC,CACH;;;;"}
|
|
@@ -344,6 +344,8 @@ export { TabPanel } from './Tabs/TabPanel.native.js';
|
|
|
344
344
|
export { Tag } from './Tag/Tag.js';
|
|
345
345
|
export { Tooltip } from './Tooltip/Tooltip.native.js';
|
|
346
346
|
export { TooltipInteractiveWrapper } from './Tooltip/TooltipInteractiveWrapper.native.js';
|
|
347
|
+
export { ToastContainer } from './Toast/ToastContainer.native.js';
|
|
348
|
+
export { useToast } from './Toast/useToast.js';
|
|
347
349
|
export { Heading } from './Typography/Heading/Heading.js';
|
|
348
350
|
export { Text, getTextProps } from './Typography/Text/Text.js';
|
|
349
351
|
export { Code } from './Typography/Code/Code.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -241,7 +241,7 @@ var _Dropdown = function _Dropdown(_ref) {
|
|
|
241
241
|
if (!target || !dropdown) {
|
|
242
242
|
return;
|
|
243
243
|
}
|
|
244
|
-
var isOutsideClick = !dropdown.contains(target) && !((_isTagDismissedRef$cu = isTagDismissedRef.current) !== null && _isTagDismissedRef$cu !== void 0 && _isTagDismissedRef$cu.value);
|
|
244
|
+
var isOutsideClick = !dropdown.contains(target) && !((_isTagDismissedRef$cu = isTagDismissedRef.current) !== null && _isTagDismissedRef$cu !== void 0 && _isTagDismissedRef$cu.value) && document.body.contains(target);
|
|
245
245
|
var isDropdownOpenState = isDropdownOpenRef.current;
|
|
246
246
|
if (isOutsideClick && isDropdownOpenState) {
|
|
247
247
|
close();
|
|
@@ -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 { isReactNative } from '~utils';\nimport { MetaConstants, metaAttribute } from '~utils/metaAttribute';\nimport { throwBladeError } from '~utils/logger';\nimport type { ContainerElementType } from '~utils/types';\nimport { useControllableState } from '~utils/useControllable';\n\nconst validDropdownChildren = [\n dropdownComponentIds.triggers.SelectInput,\n dropdownComponentIds.triggers.DropdownButton,\n dropdownComponentIds.triggers.DropdownLink,\n dropdownComponentIds.DropdownOverlay,\n dropdownComponentIds.triggers.AutoComplete,\n bottomSheetComponentIds.BottomSheet,\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 children,\n isOpen: isOpenControlled,\n onOpenChange,\n selectionType = 'single',\n testID,\n ...styledProps\n}: DropdownProps): 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 [\n hasAutoCompleteInBottomSheetHeader,\n setHasAutoCompleteInBottomSheetHeader,\n ] = 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 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.DropdownButton)) {\n dropdownTriggerer.current = 'DropdownButton';\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.AutoComplete)) {\n dropdownTriggerer.current = 'AutoComplete';\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 triggererWrapperRef,\n actionListItemRef,\n selectionType,\n hasFooterAction,\n setHasFooterAction,\n hasAutoCompleteInBottomSheetHeader,\n setHasAutoCompleteInBottomSheetHeader,\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 hasAutoCompleteInBottomSheetHeader,\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, hasAutoCompleteInBottomSheetHeader, isDropdownOpen, close]);\n\n React.useEffect((): (() => void) | undefined => {\n if (!isReactNative()) {\n const dropdown = dropdownContainerRef.current;\n\n const documentClickHandler = (e: MouseEvent): void => {\n const target = e.target as HTMLDivElement;\n\n if (!target || !dropdown) {\n return;\n }\n\n const isOutsideClick = !dropdown.contains(target) && !isTagDismissedRef.current?.value;\n\n const isDropdownOpenState = isDropdownOpenRef.current;\n if (isOutsideClick && isDropdownOpenState) {\n close();\n }\n\n if (isTagDismissedRef.current?.value) {\n isTagDismissedRef.current.value = false;\n }\n };\n\n const documentFocusHandler = (e: FocusEvent): void => {\n const target = e.relatedTarget as HTMLDivElement;\n setActiveIndex(-1);\n\n if (!dropdown || !target) {\n return;\n }\n\n if (!dropdown.contains(target)) {\n close();\n }\n };\n\n document.addEventListener('click', documentClickHandler);\n document.addEventListener('focusout', documentFocusHandler);\n\n return (): void => {\n document.removeEventListener('click', documentClickHandler);\n document.removeEventListener('focusout', documentFocusHandler);\n };\n }\n\n return undefined;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\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={dropdownContainerRef as any}\n {...metaAttribute({ name: MetaConstants.Dropdown, testID })}\n {...getStyledProps(styledProps)}\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(_Dropdown, {\n componentId: dropdownComponentIds.Dropdown,\n});\n\nexport { Dropdown };\n"],"names":["validDropdownChildren","dropdownComponentIds","triggers","SelectInput","DropdownButton","DropdownLink","DropdownOverlay","AutoComplete","bottomSheetComponentIds","BottomSheet","_Dropdown","_ref","children","isOpenControlled","isOpen","onOpenChange","_ref$selectionType","selectionType","testID","styledProps","_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","hasAutoCompleteInBottomSheetHeader","setHasAutoCompleteInBottomSheetHeader","_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","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","_getComponentId","includes","getComponentId","throwBladeError","message","concat","join","moduleName","isValidAllowedChildren","contextValue","useMemo","BottomSheetAndDropdownGlueContextValue","onBottomSheetDismiss","useEffect","isReactNative","dropdown","documentClickHandler","e","_isTagDismissedRef$cu","_isTagDismissedRef$cu2","target","isOutsideClick","contains","isDropdownOpenState","documentFocusHandler","relatedTarget","document","addEventListener","removeEventListener","undefined","_jsx","BottomSheetAndDropdownGlueContext","Provider","DropdownContext","BaseBox","_objectSpread","ref","metaAttribute","name","MetaConstants","Dropdown","getStyledProps","position","textAlign","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,IAAMA,qBAAqB,GAAG,CAC5BC,oBAAoB,CAACC,QAAQ,CAACC,WAAW,EACzCF,oBAAoB,CAACC,QAAQ,CAACE,cAAc,EAC5CH,oBAAoB,CAACC,QAAQ,CAACG,YAAY,EAC1CJ,oBAAoB,CAACK,eAAe,EACpCL,oBAAoB,CAACC,QAAQ,CAACK,YAAY,EAC1CC,YAAuB,CAACC,WAAW,CACpC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMC,SAAS,GAAG,SAAZA,SAASA,CAAAC,IAAA,EAO0B;AAAA,EAAA,IANvCC,QAAQ,G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,EAAE;EACnD6I,WAAW,EAAEtJ,oBAAoB,CAACiJ,QAAAA;AACpC,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 { isReactNative } from '~utils';\nimport { MetaConstants, metaAttribute } from '~utils/metaAttribute';\nimport { throwBladeError } from '~utils/logger';\nimport type { ContainerElementType } from '~utils/types';\nimport { useControllableState } from '~utils/useControllable';\n\nconst validDropdownChildren = [\n dropdownComponentIds.triggers.SelectInput,\n dropdownComponentIds.triggers.DropdownButton,\n dropdownComponentIds.triggers.DropdownLink,\n dropdownComponentIds.DropdownOverlay,\n dropdownComponentIds.triggers.AutoComplete,\n bottomSheetComponentIds.BottomSheet,\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 children,\n isOpen: isOpenControlled,\n onOpenChange,\n selectionType = 'single',\n testID,\n ...styledProps\n}: DropdownProps): 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 [\n hasAutoCompleteInBottomSheetHeader,\n setHasAutoCompleteInBottomSheetHeader,\n ] = 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 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.DropdownButton)) {\n dropdownTriggerer.current = 'DropdownButton';\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.AutoComplete)) {\n dropdownTriggerer.current = 'AutoComplete';\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 triggererWrapperRef,\n actionListItemRef,\n selectionType,\n hasFooterAction,\n setHasFooterAction,\n hasAutoCompleteInBottomSheetHeader,\n setHasAutoCompleteInBottomSheetHeader,\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 hasAutoCompleteInBottomSheetHeader,\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, hasAutoCompleteInBottomSheetHeader, isDropdownOpen, close]);\n\n React.useEffect((): (() => void) | undefined => {\n if (!isReactNative()) {\n const dropdown = dropdownContainerRef.current;\n\n const documentClickHandler = (e: MouseEvent): void => {\n const target = e.target as HTMLDivElement;\n\n if (!target || !dropdown) {\n return;\n }\n\n const isOutsideClick =\n !dropdown.contains(target) &&\n !isTagDismissedRef.current?.value &&\n document.body.contains(target);\n\n const isDropdownOpenState = isDropdownOpenRef.current;\n if (isOutsideClick && isDropdownOpenState) {\n close();\n }\n\n if (isTagDismissedRef.current?.value) {\n isTagDismissedRef.current.value = false;\n }\n };\n\n const documentFocusHandler = (e: FocusEvent): void => {\n const target = e.relatedTarget as HTMLDivElement;\n setActiveIndex(-1);\n\n if (!dropdown || !target) {\n return;\n }\n\n if (!dropdown.contains(target)) {\n close();\n }\n };\n\n document.addEventListener('click', documentClickHandler);\n document.addEventListener('focusout', documentFocusHandler);\n\n return (): void => {\n document.removeEventListener('click', documentClickHandler);\n document.removeEventListener('focusout', documentFocusHandler);\n };\n }\n\n return undefined;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\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={dropdownContainerRef as any}\n {...metaAttribute({ name: MetaConstants.Dropdown, testID })}\n {...getStyledProps(styledProps)}\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(_Dropdown, {\n componentId: dropdownComponentIds.Dropdown,\n});\n\nexport { Dropdown };\n"],"names":["validDropdownChildren","dropdownComponentIds","triggers","SelectInput","DropdownButton","DropdownLink","DropdownOverlay","AutoComplete","bottomSheetComponentIds","BottomSheet","_Dropdown","_ref","children","isOpenControlled","isOpen","onOpenChange","_ref$selectionType","selectionType","testID","styledProps","_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","hasAutoCompleteInBottomSheetHeader","setHasAutoCompleteInBottomSheetHeader","_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","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","_getComponentId","includes","getComponentId","throwBladeError","message","concat","join","moduleName","isValidAllowedChildren","contextValue","useMemo","BottomSheetAndDropdownGlueContextValue","onBottomSheetDismiss","useEffect","isReactNative","dropdown","documentClickHandler","e","_isTagDismissedRef$cu","_isTagDismissedRef$cu2","target","isOutsideClick","contains","document","body","isDropdownOpenState","documentFocusHandler","relatedTarget","addEventListener","removeEventListener","undefined","_jsx","BottomSheetAndDropdownGlueContext","Provider","DropdownContext","BaseBox","_objectSpread","ref","metaAttribute","name","MetaConstants","Dropdown","getStyledProps","position","textAlign","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,IAAMA,qBAAqB,GAAG,CAC5BC,oBAAoB,CAACC,QAAQ,CAACC,WAAW,EACzCF,oBAAoB,CAACC,QAAQ,CAACE,cAAc,EAC5CH,oBAAoB,CAACC,QAAQ,CAACG,YAAY,EAC1CJ,oBAAoB,CAACK,eAAe,EACpCL,oBAAoB,CAACC,QAAQ,CAACK,YAAY,EAC1CC,YAAuB,CAACC,WAAW,CACpC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMC,SAAS,GAAG,SAAZA,SAASA,CAAAC,IAAA,EAO0B;AAAA,EAAA,IANvCC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACAC,gBAAgB,GAAAF,IAAA,CAAxBG,MAAM;IACNC,YAAY,GAAAJ,IAAA,CAAZI,YAAY;IAAAC,kBAAA,GAAAL,IAAA,CACZM,aAAa;AAAbA,IAAAA,aAAa,GAAAD,kBAAA,KAAG,KAAA,CAAA,GAAA,QAAQ,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/helpers/slicedToArray';
|
|
2
2
|
import React__default from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
3
4
|
import { BASEINPUT_DEFAULT_HEIGHT } from './baseInputConfig.js';
|
|
4
5
|
import '../../Box/BaseBox/index.js';
|
|
5
6
|
import '../../Typography/index.js';
|
|
@@ -91,6 +92,19 @@ var getSelectedTextWithoutTags = function getSelectedTextWithoutTags(_ref2) {
|
|
|
91
92
|
}
|
|
92
93
|
return "".concat(items, " Selected");
|
|
93
94
|
};
|
|
95
|
+
var TagSlotContainer = /*#__PURE__*/styled(BaseBox).withConfig({
|
|
96
|
+
displayName: "BaseInputTagSlotweb__TagSlotContainer",
|
|
97
|
+
componentId: "sc-1bt1h3t-0"
|
|
98
|
+
})(function () {
|
|
99
|
+
return {
|
|
100
|
+
// hides the scrollbar of tagslot
|
|
101
|
+
'::-webkit-scrollbar': {
|
|
102
|
+
display: 'none'
|
|
103
|
+
},
|
|
104
|
+
'-ms-overflow-style': 'none',
|
|
105
|
+
'scrollbar-width': 'none'
|
|
106
|
+
};
|
|
107
|
+
});
|
|
94
108
|
var BaseInputTagSlot = function BaseInputTagSlot(_ref3) {
|
|
95
109
|
var renderAs = _ref3.renderAs,
|
|
96
110
|
children = _ref3.children,
|
|
@@ -150,7 +164,7 @@ var BaseInputTagSlot = function BaseInputTagSlot(_ref3) {
|
|
|
150
164
|
|
|
151
165
|
// tag height changes in mobile and desktop so we keep different paddings to make it look as expected
|
|
152
166
|
var paddingYWithTags = isMobile ? 'spacing.1' : 'spacing.2';
|
|
153
|
-
return /*#__PURE__*/jsxs(
|
|
167
|
+
return /*#__PURE__*/jsxs(TagSlotContainer, {
|
|
154
168
|
ref: slotRef,
|
|
155
169
|
className: "tags-slot",
|
|
156
170
|
paddingY: paddingYWithTags,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInputTagSlot.web.js","sources":["../../../../../../../src/components/Input/BaseInput/BaseInputTagSlot.web.tsx"],"sourcesContent":["import React from 'react';\nimport type { BaseInputTagSlotProps } from './types';\nimport { BASEINPUT_DEFAULT_HEIGHT } from './baseInputConfig';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\nimport { castWebType, makeSize } from '~utils';\nimport { useIsomorphicLayoutEffect } from '~utils/useIsomorphicLayoutEffect';\nimport { useIsMobile } from '~utils/useIsMobile';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport { size } from '~tokens/global';\n\nconst MINUMUM_INPUT_SPACE = 30;\nconst PLUS_X_MORE_TEXT_WIDTH = 60;\nconst TAG_MAX_WIDTH: number = size['140'];\n\nconst useVisibleTagsCount = ({\n slotRef,\n tags,\n maxTagRows,\n visibleTagsCountRef,\n showAllTags,\n labelPrefix,\n}: {\n slotRef: React.RefObject<HTMLDivElement>;\n tags: BaseInputTagSlotProps['tags'];\n maxTagRows: BaseInputTagSlotProps['maxTagRows'];\n visibleTagsCountRef: BaseInputTagSlotProps['visibleTagsCountRef'];\n showAllTags: BaseInputTagSlotProps['showAllTags'];\n labelPrefix: BaseInputTagSlotProps['labelPrefix'];\n}): number => {\n const [visibleTagsCount, setVisibleTagsCount] = React.useState(0);\n const visibleTagsCountStateRef = React.useRef<number>(0);\n\n useIsomorphicLayoutEffect(() => {\n if (!tags || labelPrefix) {\n setVisibleTagsCount(0);\n return;\n }\n\n if (maxTagRows === 'multiple' || showAllTags) {\n visibleTagsCountRef.current = tags.length;\n setVisibleTagsCount(tags.length);\n return;\n }\n\n const inputTagsSlotWidth = slotRef.current?.clientWidth;\n visibleTagsCountStateRef.current = 0;\n let totalTagsWidth = 0;\n\n if (!inputTagsSlotWidth) {\n return;\n }\n\n const allTagsEl = slotRef.current?.querySelectorAll(\n `[data-blade-component=\"${MetaConstants.Tag}\"]`,\n );\n\n const totalAvailableSpaceForTags =\n inputTagsSlotWidth - (MINUMUM_INPUT_SPACE + PLUS_X_MORE_TEXT_WIDTH);\n\n if (allTagsEl.length !== tags.length) {\n // some weird edge cases in controlled select where tags are not rendered in children\n // we assume 140px (max-width of tag as width of all tags)\n const tagsCount = Math.floor((totalAvailableSpaceForTags / TAG_MAX_WIDTH) * tags.length);\n visibleTagsCountRef.current = tagsCount;\n setVisibleTagsCount(tagsCount);\n return;\n }\n\n for (const tagEl of allTagsEl) {\n totalTagsWidth += tagEl.clientWidth;\n if (totalTagsWidth >= totalAvailableSpaceForTags) {\n break;\n } else {\n visibleTagsCountStateRef.current++;\n }\n }\n\n visibleTagsCountRef.current = visibleTagsCountStateRef.current;\n setVisibleTagsCount(visibleTagsCountStateRef.current);\n }, [tags?.length, showAllTags]);\n\n return visibleTagsCount;\n};\n\nconst getSelectedTextWithoutTags = ({\n items,\n labelPrefix,\n}: {\n items: number;\n labelPrefix?: string;\n}): string => {\n if (labelPrefix) {\n return `${labelPrefix} (${items} Selected)`;\n }\n\n return `${items} Selected`;\n};\n\nconst BaseInputTagSlot = ({\n renderAs,\n children,\n tags,\n maxTagRows,\n showAllTags,\n setShouldIgnoreBlurAnimation,\n handleOnInputClick,\n isDropdownTrigger,\n visibleTagsCountRef,\n labelPrefix,\n isDisabled,\n}: BaseInputTagSlotProps): React.ReactElement => {\n const hasTags = tags && tags.length > 0;\n const slotRef = React.useRef<HTMLDivElement>(null);\n const visibleTagsCount = useVisibleTagsCount({\n slotRef,\n tags,\n maxTagRows,\n visibleTagsCountRef,\n showAllTags,\n labelPrefix,\n });\n\n React.useEffect(() => {\n slotRef.current?.scrollTo?.({\n top:\n maxTagRows === 'multiple' || maxTagRows === 'expandable' ? slotRef.current.scrollHeight : 0,\n left: maxTagRows === 'single' ? slotRef.current.scrollWidth : 0,\n behavior: 'smooth',\n });\n }, [tags?.length, maxTagRows]);\n\n React.useEffect(() => {\n if (!showAllTags) {\n slotRef.current?.scrollTo?.({\n top: 0,\n left: 0,\n behavior: 'smooth',\n });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [showAllTags]);\n\n const visibleTags = React.useMemo(() => {\n return showAllTags ? tags : tags?.slice(0, visibleTagsCount);\n }, [showAllTags, tags, visibleTagsCount]);\n\n const invisibleTagsCount = React.useMemo(() => {\n if (tags && visibleTags) {\n return tags.length - visibleTags.length;\n }\n\n return 0;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [tags?.length, visibleTags?.length]);\n\n const isMobile = useIsMobile();\n\n if (!isDropdownTrigger) {\n // If its not dropdown trigger, we don't need to render tag containers\n return children;\n }\n\n // tag height changes in mobile and desktop so we keep different paddings to make it look as expected\n const paddingYWithTags = isMobile ? 'spacing.1' : 'spacing.2';\n\n return (\n <BaseBox\n ref={slotRef}\n className=\"tags-slot\"\n paddingY={paddingYWithTags}\n paddingLeft=\"spacing.4\"\n display=\"flex\"\n flex=\"1\"\n flexWrap={maxTagRows === 'single' ? 'nowrap' : 'wrap'}\n overflowX=\"auto\"\n overflowY={showAllTags || maxTagRows === 'multiple' ? 'auto' : 'hidden'}\n minHeight={makeSize(BASEINPUT_DEFAULT_HEIGHT)}\n onMouseDown={() => {\n setShouldIgnoreBlurAnimation?.(true);\n }}\n onClick={(e) => {\n handleOnInputClick(castWebType(e));\n }}\n onMouseUp={() => {\n setShouldIgnoreBlurAnimation?.(false);\n }}\n >\n {visibleTags}\n {tags && !showAllTags && invisibleTagsCount ? (\n <Text\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.subtle'}\n alignSelf=\"center\"\n marginY=\"spacing.2\"\n marginRight=\"spacing.4\"\n variant=\"body\"\n size=\"small\"\n weight=\"regular\"\n >\n <BaseBox as=\"span\" whiteSpace=\"nowrap\">\n {visibleTags?.length === 0\n ? getSelectedTextWithoutTags({\n items: invisibleTagsCount,\n labelPrefix,\n })\n : `+${invisibleTagsCount} More`}\n </BaseBox>\n </Text>\n ) : null}\n <BaseBox\n marginTop=\"-4px\"\n minWidth={hasTags && renderAs === 'button' ? undefined : makeSize(MINUMUM_INPUT_SPACE)}\n width={hasTags && renderAs === 'button' ? makeSize(size['1']) : '100%'}\n >\n {children}\n </BaseBox>\n </BaseBox>\n );\n};\n\nexport { BaseInputTagSlot };\n"],"names":["MINUMUM_INPUT_SPACE","PLUS_X_MORE_TEXT_WIDTH","TAG_MAX_WIDTH","size","useVisibleTagsCount","_ref","slotRef","tags","maxTagRows","visibleTagsCountRef","showAllTags","labelPrefix","_React$useState","React","useState","_React$useState2","_slicedToArray","visibleTagsCount","setVisibleTagsCount","visibleTagsCountStateRef","useRef","useIsomorphicLayoutEffect","_slotRef$current","_slotRef$current2","current","length","inputTagsSlotWidth","clientWidth","totalTagsWidth","allTagsEl","querySelectorAll","concat","MetaConstants","Tag","totalAvailableSpaceForTags","tagsCount","Math","floor","_iterator","_createForOfIteratorHelper","_step","s","n","done","tagEl","value","err","e","f","getSelectedTextWithoutTags","_ref2","items","BaseInputTagSlot","_ref3","renderAs","children","setShouldIgnoreBlurAnimation","handleOnInputClick","isDropdownTrigger","isDisabled","hasTags","useEffect","_slotRef$current3","_slotRef$current3$scr","scrollTo","call","top","scrollHeight","left","scrollWidth","behavior","_slotRef$current4","_slotRef$current4$scr","visibleTags","useMemo","slice","invisibleTagsCount","isMobile","useIsMobile","paddingYWithTags","_jsxs","BaseBox","ref","className","paddingY","paddingLeft","display","flex","flexWrap","overflowX","overflowY","minHeight","makeSize","BASEINPUT_DEFAULT_HEIGHT","onMouseDown","onClick","castWebType","onMouseUp","_jsx","Text","color","alignSelf","marginY","marginRight","variant","weight","as","whiteSpace","marginTop","minWidth","undefined","width"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAWA,IAAMA,mBAAmB,GAAG,EAAE,CAAA;AAC9B,IAAMC,sBAAsB,GAAG,EAAE,CAAA;AACjC,IAAMC,aAAqB,GAAGC,IAAI,CAAC,KAAK,CAAC,CAAA;AAEzC,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAAC,IAAA,EAcX;AAAA,EAAA,IAbZC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IACPC,IAAI,GAAAF,IAAA,CAAJE,IAAI;IACJC,U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,CAAC,CAAA;AAAA,GACH,CAAC,CAAA;AAEd;;;;"}
|
|
1
|
+
{"version":3,"file":"BaseInputTagSlot.web.js","sources":["../../../../../../../src/components/Input/BaseInput/BaseInputTagSlot.web.tsx"],"sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\nimport type { BaseInputTagSlotProps } from './types';\nimport { BASEINPUT_DEFAULT_HEIGHT } from './baseInputConfig';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\nimport { castWebType, makeSize } from '~utils';\nimport { useIsomorphicLayoutEffect } from '~utils/useIsomorphicLayoutEffect';\nimport { useIsMobile } from '~utils/useIsMobile';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport { size } from '~tokens/global';\n\nconst MINUMUM_INPUT_SPACE = 30;\nconst PLUS_X_MORE_TEXT_WIDTH = 60;\nconst TAG_MAX_WIDTH: number = size['140'];\n\nconst useVisibleTagsCount = ({\n slotRef,\n tags,\n maxTagRows,\n visibleTagsCountRef,\n showAllTags,\n labelPrefix,\n}: {\n slotRef: React.RefObject<HTMLDivElement>;\n tags: BaseInputTagSlotProps['tags'];\n maxTagRows: BaseInputTagSlotProps['maxTagRows'];\n visibleTagsCountRef: BaseInputTagSlotProps['visibleTagsCountRef'];\n showAllTags: BaseInputTagSlotProps['showAllTags'];\n labelPrefix: BaseInputTagSlotProps['labelPrefix'];\n}): number => {\n const [visibleTagsCount, setVisibleTagsCount] = React.useState(0);\n const visibleTagsCountStateRef = React.useRef<number>(0);\n\n useIsomorphicLayoutEffect(() => {\n if (!tags || labelPrefix) {\n setVisibleTagsCount(0);\n return;\n }\n\n if (maxTagRows === 'multiple' || showAllTags) {\n visibleTagsCountRef.current = tags.length;\n setVisibleTagsCount(tags.length);\n return;\n }\n\n const inputTagsSlotWidth = slotRef.current?.clientWidth;\n visibleTagsCountStateRef.current = 0;\n let totalTagsWidth = 0;\n\n if (!inputTagsSlotWidth) {\n return;\n }\n\n const allTagsEl = slotRef.current?.querySelectorAll(\n `[data-blade-component=\"${MetaConstants.Tag}\"]`,\n );\n\n const totalAvailableSpaceForTags =\n inputTagsSlotWidth - (MINUMUM_INPUT_SPACE + PLUS_X_MORE_TEXT_WIDTH);\n\n if (allTagsEl.length !== tags.length) {\n // some weird edge cases in controlled select where tags are not rendered in children\n // we assume 140px (max-width of tag as width of all tags)\n const tagsCount = Math.floor((totalAvailableSpaceForTags / TAG_MAX_WIDTH) * tags.length);\n visibleTagsCountRef.current = tagsCount;\n setVisibleTagsCount(tagsCount);\n return;\n }\n\n for (const tagEl of allTagsEl) {\n totalTagsWidth += tagEl.clientWidth;\n if (totalTagsWidth >= totalAvailableSpaceForTags) {\n break;\n } else {\n visibleTagsCountStateRef.current++;\n }\n }\n\n visibleTagsCountRef.current = visibleTagsCountStateRef.current;\n setVisibleTagsCount(visibleTagsCountStateRef.current);\n }, [tags?.length, showAllTags]);\n\n return visibleTagsCount;\n};\n\nconst getSelectedTextWithoutTags = ({\n items,\n labelPrefix,\n}: {\n items: number;\n labelPrefix?: string;\n}): string => {\n if (labelPrefix) {\n return `${labelPrefix} (${items} Selected)`;\n }\n\n return `${items} Selected`;\n};\n\nconst TagSlotContainer = styled(BaseBox)(() => {\n return {\n // hides the scrollbar of tagslot\n '::-webkit-scrollbar': {\n display: 'none',\n },\n '-ms-overflow-style': 'none',\n 'scrollbar-width': 'none',\n };\n});\n\nconst BaseInputTagSlot = ({\n renderAs,\n children,\n tags,\n maxTagRows,\n showAllTags,\n setShouldIgnoreBlurAnimation,\n handleOnInputClick,\n isDropdownTrigger,\n visibleTagsCountRef,\n labelPrefix,\n isDisabled,\n}: BaseInputTagSlotProps): React.ReactElement => {\n const hasTags = tags && tags.length > 0;\n const slotRef = React.useRef<HTMLDivElement>(null);\n const visibleTagsCount = useVisibleTagsCount({\n slotRef,\n tags,\n maxTagRows,\n visibleTagsCountRef,\n showAllTags,\n labelPrefix,\n });\n\n React.useEffect(() => {\n slotRef.current?.scrollTo?.({\n top:\n maxTagRows === 'multiple' || maxTagRows === 'expandable' ? slotRef.current.scrollHeight : 0,\n left: maxTagRows === 'single' ? slotRef.current.scrollWidth : 0,\n behavior: 'smooth',\n });\n }, [tags?.length, maxTagRows]);\n\n React.useEffect(() => {\n if (!showAllTags) {\n slotRef.current?.scrollTo?.({\n top: 0,\n left: 0,\n behavior: 'smooth',\n });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [showAllTags]);\n\n const visibleTags = React.useMemo(() => {\n return showAllTags ? tags : tags?.slice(0, visibleTagsCount);\n }, [showAllTags, tags, visibleTagsCount]);\n\n const invisibleTagsCount = React.useMemo(() => {\n if (tags && visibleTags) {\n return tags.length - visibleTags.length;\n }\n\n return 0;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [tags?.length, visibleTags?.length]);\n\n const isMobile = useIsMobile();\n\n if (!isDropdownTrigger) {\n // If its not dropdown trigger, we don't need to render tag containers\n return children;\n }\n\n // tag height changes in mobile and desktop so we keep different paddings to make it look as expected\n const paddingYWithTags = isMobile ? 'spacing.1' : 'spacing.2';\n\n return (\n <TagSlotContainer\n ref={slotRef}\n className=\"tags-slot\"\n paddingY={paddingYWithTags}\n paddingLeft=\"spacing.4\"\n display=\"flex\"\n flex=\"1\"\n flexWrap={maxTagRows === 'single' ? 'nowrap' : 'wrap'}\n overflowX=\"auto\"\n overflowY={showAllTags || maxTagRows === 'multiple' ? 'auto' : 'hidden'}\n minHeight={makeSize(BASEINPUT_DEFAULT_HEIGHT)}\n onMouseDown={() => {\n setShouldIgnoreBlurAnimation?.(true);\n }}\n onClick={(e) => {\n handleOnInputClick(castWebType(e));\n }}\n onMouseUp={() => {\n setShouldIgnoreBlurAnimation?.(false);\n }}\n >\n {visibleTags}\n {tags && !showAllTags && invisibleTagsCount ? (\n <Text\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.subtle'}\n alignSelf=\"center\"\n marginY=\"spacing.2\"\n marginRight=\"spacing.4\"\n variant=\"body\"\n size=\"small\"\n weight=\"regular\"\n >\n <BaseBox as=\"span\" whiteSpace=\"nowrap\">\n {visibleTags?.length === 0\n ? getSelectedTextWithoutTags({\n items: invisibleTagsCount,\n labelPrefix,\n })\n : `+${invisibleTagsCount} More`}\n </BaseBox>\n </Text>\n ) : null}\n <BaseBox\n marginTop=\"-4px\"\n minWidth={hasTags && renderAs === 'button' ? undefined : makeSize(MINUMUM_INPUT_SPACE)}\n width={hasTags && renderAs === 'button' ? makeSize(size['1']) : '100%'}\n >\n {children}\n </BaseBox>\n </TagSlotContainer>\n );\n};\n\nexport { BaseInputTagSlot };\n"],"names":["MINUMUM_INPUT_SPACE","PLUS_X_MORE_TEXT_WIDTH","TAG_MAX_WIDTH","size","useVisibleTagsCount","_ref","slotRef","tags","maxTagRows","visibleTagsCountRef","showAllTags","labelPrefix","_React$useState","React","useState","_React$useState2","_slicedToArray","visibleTagsCount","setVisibleTagsCount","visibleTagsCountStateRef","useRef","useIsomorphicLayoutEffect","_slotRef$current","_slotRef$current2","current","length","inputTagsSlotWidth","clientWidth","totalTagsWidth","allTagsEl","querySelectorAll","concat","MetaConstants","Tag","totalAvailableSpaceForTags","tagsCount","Math","floor","_iterator","_createForOfIteratorHelper","_step","s","n","done","tagEl","value","err","e","f","getSelectedTextWithoutTags","_ref2","items","TagSlotContainer","styled","BaseBox","withConfig","displayName","componentId","display","BaseInputTagSlot","_ref3","renderAs","children","setShouldIgnoreBlurAnimation","handleOnInputClick","isDropdownTrigger","isDisabled","hasTags","useEffect","_slotRef$current3","_slotRef$current3$scr","scrollTo","call","top","scrollHeight","left","scrollWidth","behavior","_slotRef$current4","_slotRef$current4$scr","visibleTags","useMemo","slice","invisibleTagsCount","isMobile","useIsMobile","paddingYWithTags","_jsxs","ref","className","paddingY","paddingLeft","flex","flexWrap","overflowX","overflowY","minHeight","makeSize","BASEINPUT_DEFAULT_HEIGHT","onMouseDown","onClick","castWebType","onMouseUp","_jsx","Text","color","alignSelf","marginY","marginRight","variant","weight","as","whiteSpace","marginTop","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