@razorpay/blade 12.96.1 → 12.96.3
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/Input/SearchInput/SearchInput.js +2 -1
- package/build/lib/native/components/Input/SearchInput/SearchInput.js.map +1 -1
- package/build/lib/native/components/Modal/ModalContext.js +6 -0
- package/build/lib/native/components/Modal/ModalContext.js.map +1 -0
- package/build/lib/native/utils/makeSurfaceStyles/makeSurfaceStyles.js +10 -1
- package/build/lib/native/utils/makeSurfaceStyles/makeSurfaceStyles.js.map +1 -1
- package/build/lib/web/development/_virtual/cloneDeep.js +1 -1
- package/build/lib/web/development/_virtual/cloneDeep3.js +1 -1
- package/build/lib/web/development/components/Input/SearchInput/SearchInput.js +3 -1
- package/build/lib/web/development/components/Input/SearchInput/SearchInput.js.map +1 -1
- package/build/lib/web/development/components/ListView/ListView.web.js +1 -3
- package/build/lib/web/development/components/ListView/ListView.web.js.map +1 -1
- package/build/lib/web/development/components/ListView/ListViewFilters.web.js +0 -1
- package/build/lib/web/development/components/ListView/ListViewFilters.web.js.map +1 -1
- package/build/lib/web/development/components/Modal/Modal.web.js +2 -1
- package/build/lib/web/development/components/Modal/Modal.web.js.map +1 -1
- package/build/lib/web/development/components/Modal/ModalContext.js +2 -1
- package/build/lib/web/development/components/Modal/ModalContext.js.map +1 -1
- package/build/lib/web/development/components/Table/TableBody.web.js +3 -3
- package/build/lib/web/development/components/Table/TableBody.web.js.map +1 -1
- package/build/lib/web/development/components/Table/TableFooter.web.js +3 -3
- package/build/lib/web/development/components/Table/TableFooter.web.js.map +1 -1
- package/build/lib/web/development/components/Table/TableHeader.web.js +3 -3
- package/build/lib/web/development/components/Table/TableHeader.web.js.map +1 -1
- package/build/lib/web/development/node_modules/es-toolkit/dist/compat/object/cloneDeep.js +1 -1
- package/build/lib/web/development/node_modules/es-toolkit/dist/compat/predicate/matches.js +2 -2
- package/build/lib/web/development/node_modules/es-toolkit/dist/compat/predicate/matchesProperty.js +2 -2
- package/build/lib/web/development/node_modules/es-toolkit/dist/object/cloneDeep.js +1 -1
- package/build/lib/web/development/utils/makeSurfaceStyles/makeSurfaceStyles.js +7 -32
- package/build/lib/web/development/utils/makeSurfaceStyles/makeSurfaceStyles.js.map +1 -1
- package/build/lib/web/production/components/Input/SearchInput/SearchInput.js +3 -1
- package/build/lib/web/production/components/Input/SearchInput/SearchInput.js.map +1 -1
- package/build/lib/web/production/components/ListView/ListView.web.js +1 -3
- package/build/lib/web/production/components/ListView/ListView.web.js.map +1 -1
- package/build/lib/web/production/components/ListView/ListViewFilters.web.js +0 -1
- package/build/lib/web/production/components/ListView/ListViewFilters.web.js.map +1 -1
- package/build/lib/web/production/components/Modal/Modal.web.js +2 -1
- package/build/lib/web/production/components/Modal/Modal.web.js.map +1 -1
- package/build/lib/web/production/components/Modal/ModalContext.js +2 -1
- package/build/lib/web/production/components/Modal/ModalContext.js.map +1 -1
- package/build/lib/web/production/components/Table/TableBody.web.js +3 -3
- package/build/lib/web/production/components/Table/TableBody.web.js.map +1 -1
- package/build/lib/web/production/components/Table/TableFooter.web.js +3 -3
- package/build/lib/web/production/components/Table/TableFooter.web.js.map +1 -1
- package/build/lib/web/production/components/Table/TableHeader.web.js +3 -3
- package/build/lib/web/production/components/Table/TableHeader.web.js.map +1 -1
- package/build/lib/web/production/utils/makeSurfaceStyles/makeSurfaceStyles.js +7 -32
- package/build/lib/web/production/utils/makeSurfaceStyles/makeSurfaceStyles.js.map +1 -1
- package/build/types/components/index.d.ts +1124 -1124
- package/build/types/components/index.native.d.ts +84 -84
- package/build/types/utils/index.d.ts +0 -2
- package/build/types/utils/index.native.d.ts +0 -2
- package/package.json +1 -1
|
@@ -468,8 +468,9 @@ import { InputDropdownButton } from '../../Dropdown/InputDropdownButton.native.j
|
|
|
468
468
|
import { Divider } from '../../Divider/Divider.js';
|
|
469
469
|
import { getComponentId } from '../../../utils/isValidAllowedChildren/isValidAllowedChildren.js';
|
|
470
470
|
import { TopNavOverlayThemeOverride } from '../../TopNav/TopNavOverlayThemeOverride.js';
|
|
471
|
+
import { useModalContext } from '../../Modal/ModalContext.js';
|
|
471
472
|
|
|
472
|
-
var _excluded=["label","accessibilityLabel","labelPosition","placeholder","defaultValue","name","value","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","labelSuffix","labelTrailing","helpText","onClearButtonClick","isLoading","autoCapitalize","autoFocus","testID","size","showSearchIcon","trailing"];var isReactNative=function isReactNative(_textInputRef){return getPlatformType()==='react-native';};var _SearchInput=function _SearchInput(_ref,ref){var label=_ref.label,accessibilityLabel=_ref.accessibilityLabel,_ref$labelPosition=_ref.labelPosition,labelPosition=_ref$labelPosition===void 0?'top':_ref$labelPosition,placeholder=_ref.placeholder,defaultValue=_ref.defaultValue,name=_ref.name,value=_ref.value,_onChange=_ref.onChange,_onClick=_ref.onClick,_onFocus=_ref.onFocus,_onBlur=_ref.onBlur,onSubmit=_ref.onSubmit,isDisabled=_ref.isDisabled,labelSuffix=_ref.labelSuffix,labelTrailing=_ref.labelTrailing,helpText=_ref.helpText,onClearButtonClick=_ref.onClearButtonClick,isLoading=_ref.isLoading,autoCapitalize=_ref.autoCapitalize,autoFocus=_ref.autoFocus,testID=_ref.testID,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,_ref$showSearchIcon=_ref.showSearchIcon,showSearchIcon=_ref$showSearchIcon===void 0?true:_ref$showSearchIcon,trailing=_ref.trailing,rest=_objectWithoutProperties(_ref,_excluded);var textInputRef=React__default.useRef(null);var mergedRef=useMergeRefs(ref,textInputRef);var _useState=useState(false),_useState2=_slicedToArray(_useState,2),shouldShowClearButton=_useState2[0],setShouldShowClearButton=_useState2[1];var _useState3=useState(false),_useState4=_slicedToArray(_useState3,2),isTrailingDropDownOpen=_useState4[0],setIsTrailingDropDownOpen=_useState4[1];var _useDropdown=useDropdown(),triggererWrapperRef=_useDropdown.triggererWrapperRef,onTriggerKeydown=_useDropdown.onTriggerKeydown,onTriggerClick=_useDropdown.onTriggerClick,dropdownTriggerer=_useDropdown.dropdownTriggerer,closeParentDropDown=_useDropdown.close,isParentDropDownOpen=_useDropdown.isOpen;var isInsideDropdown=dropdownTriggerer==='SearchInput';var _useState5=useState(false),_useState6=_slicedToArray(_useState5,2),isSearchFocused=_useState6[0],setIsSearchFocused=_useState6[1];React__default.useEffect(function(){setShouldShowClearButton(Boolean(defaultValue!=null?defaultValue:value));},[defaultValue,value]);useEffect(function(){if(isParentDropDownOpen&&isTrailingDropDownOpen){setIsTrailingDropDownOpen(false);}},[closeParentDropDown,isParentDropDownOpen]);useEffect(function(){if(isTrailingDropDownOpen&&isParentDropDownOpen){closeParentDropDown();}},[setIsTrailingDropDownOpen,isTrailingDropDownOpen]);var trailingDropdown=trailing&&getComponentId(trailing)==='Dropdown'?trailing:null;var renderTrailingDropDown=function renderTrailingDropDown(){if(!trailingDropdown){return null;}return React__default.cloneElement(trailingDropdown,{selectionType:'single',isOpen:isTrailingDropDownOpen,height:'100%',onOpenChange:function onOpenChange(isOpen){setIsTrailingDropDownOpen(isOpen);},children:React__default.Children.map(trailingDropdown.props.children,function(child){if(child.type===InputDropdownButton){return React__default.cloneElement(child,{_isInsideSearchInput:true,size:size});}if(child.type===DropdownOverlay){return React__default.cloneElement(child,{referenceRef:triggererWrapperRef,_isNestedDropdown:true,defaultPlacement:'bottom-end'});}return child;})});};var renderClearButton=function renderClearButton(){return jsx(IconButton,{size:"medium",icon:CloseIcon,onClick:function onClick(){var _textInputRef$current;if(isEmpty(value)&&textInputRef.current){if(isReactNative(textInputRef.current)){textInputRef.current.clear();textInputRef.current.focus();}else if(textInputRef.current instanceof HTMLInputElement){textInputRef.current.value='';textInputRef.current.focus();}}onClearButtonClick==null?void 0:onClearButtonClick();textInputRef==null?void 0:(_textInputRef$current=textInputRef.current)==null?void 0:_textInputRef$current.focus();setShouldShowClearButton(false);},isDisabled:isDisabled,accessibilityLabel:"Clear Input Content"});};var renderInteractionElement=function renderInteractionElement(){if(isLoading){return jsx(Spinner,{accessibilityLabel:"Loading Content",color:"primary"});}if(shouldShowClearButton&&trailingDropdown){return jsxs(BaseBox,{display:"flex",gap:"spacing.3",children:[renderClearButton()," ",jsx(Divider,{orientation:"vertical"})]});}if(shouldShowClearButton){return renderClearButton();}return null;};var searchContent=jsx(BaseBox,{position:"relative",children:jsx(BaseInput,Object.assign({id:"searchinput",componentName:MetaConstants.SearchInput,ref:mergedRef,isDropdownTrigger:true,setInputWrapperRef:isInsideDropdown||isTrailingDropDownOpen?function(wrapperNode){triggererWrapperRef.current=wrapperNode;}:undefined,label:label,accessibilityLabel:accessibilityLabel,hideLabelText:!Boolean(label),labelPosition:labelPosition,labelSuffix:labelSuffix,labelTrailing:labelTrailing,placeholder:placeholder,defaultValue:defaultValue,value:value,name:name,onKeyDown:isInsideDropdown?onTriggerKeydown:undefined,onChange:function onChange(_ref2){var name=_ref2.name,value=_ref2.value;if(value!=null&&value.length){setShouldShowClearButton(true);}if(shouldShowClearButton&&!(value!=null&&value.length)){setShouldShowClearButton(false);}_onChange==null?void 0:_onChange({name:name,value:value});},onClick:function onClick(e){if(isDisabled)return;if(isInsideDropdown){onTriggerClick();}_onClick==null?void 0:_onClick(e);},onFocus:function onFocus(e){setIsSearchFocused(true);_onFocus==null?void 0:_onFocus(e);},onBlur:function onBlur(e){setIsSearchFocused(false);_onBlur==null?void 0:_onBlur(e);},onSubmit:onSubmit,isDisabled:isDisabled,leadingIcon:showSearchIcon?SearchIcon:undefined,trailingInteractionElement:renderInteractionElement(),trailingDropDown:renderTrailingDropDown(),helpText:helpText,autoFocus:autoFocus,testID:testID},getKeyboardAndAutocompleteProps({type:'search',autoCapitalize:autoCapitalize}),{size:size},rest))});return jsx(TopNavOverlayThemeOverride,{shouldOverrideTheme:isSearchFocused,children:searchContent});};var SearchInput=assignWithoutSideEffects(React__default.forwardRef(_SearchInput),{displayName:'SearchInput',componentId:dropdownComponentIds.triggers.SearchInput});
|
|
473
|
+
var _excluded=["label","accessibilityLabel","labelPosition","placeholder","defaultValue","name","value","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","labelSuffix","labelTrailing","helpText","onClearButtonClick","isLoading","autoCapitalize","autoFocus","testID","size","showSearchIcon","trailing"];var isReactNative=function isReactNative(_textInputRef){return getPlatformType()==='react-native';};var _SearchInput=function _SearchInput(_ref,ref){var label=_ref.label,accessibilityLabel=_ref.accessibilityLabel,_ref$labelPosition=_ref.labelPosition,labelPosition=_ref$labelPosition===void 0?'top':_ref$labelPosition,placeholder=_ref.placeholder,defaultValue=_ref.defaultValue,name=_ref.name,value=_ref.value,_onChange=_ref.onChange,_onClick=_ref.onClick,_onFocus=_ref.onFocus,_onBlur=_ref.onBlur,onSubmit=_ref.onSubmit,isDisabled=_ref.isDisabled,labelSuffix=_ref.labelSuffix,labelTrailing=_ref.labelTrailing,helpText=_ref.helpText,onClearButtonClick=_ref.onClearButtonClick,isLoading=_ref.isLoading,autoCapitalize=_ref.autoCapitalize,autoFocus=_ref.autoFocus,testID=_ref.testID,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,_ref$showSearchIcon=_ref.showSearchIcon,showSearchIcon=_ref$showSearchIcon===void 0?true:_ref$showSearchIcon,trailing=_ref.trailing,rest=_objectWithoutProperties(_ref,_excluded);var textInputRef=React__default.useRef(null);var mergedRef=useMergeRefs(ref,textInputRef);var _useState=useState(false),_useState2=_slicedToArray(_useState,2),shouldShowClearButton=_useState2[0],setShouldShowClearButton=_useState2[1];var _useState3=useState(false),_useState4=_slicedToArray(_useState3,2),isTrailingDropDownOpen=_useState4[0],setIsTrailingDropDownOpen=_useState4[1];var _useDropdown=useDropdown(),triggererWrapperRef=_useDropdown.triggererWrapperRef,onTriggerKeydown=_useDropdown.onTriggerKeydown,onTriggerClick=_useDropdown.onTriggerClick,dropdownTriggerer=_useDropdown.dropdownTriggerer,closeParentDropDown=_useDropdown.close,isParentDropDownOpen=_useDropdown.isOpen;var isInsideDropdown=dropdownTriggerer==='SearchInput';var _useState5=useState(false),_useState6=_slicedToArray(_useState5,2),isSearchFocused=_useState6[0],setIsSearchFocused=_useState6[1];var modalContext=useModalContext();React__default.useEffect(function(){setShouldShowClearButton(Boolean(defaultValue!=null?defaultValue:value));},[defaultValue,value]);useEffect(function(){if(isParentDropDownOpen&&isTrailingDropDownOpen){setIsTrailingDropDownOpen(false);}},[closeParentDropDown,isParentDropDownOpen]);useEffect(function(){if(isTrailingDropDownOpen&&isParentDropDownOpen){closeParentDropDown();}},[setIsTrailingDropDownOpen,isTrailingDropDownOpen]);var trailingDropdown=trailing&&getComponentId(trailing)==='Dropdown'?trailing:null;var renderTrailingDropDown=function renderTrailingDropDown(){if(!trailingDropdown){return null;}return React__default.cloneElement(trailingDropdown,{selectionType:'single',isOpen:isTrailingDropDownOpen,height:'100%',onOpenChange:function onOpenChange(isOpen){setIsTrailingDropDownOpen(isOpen);},children:React__default.Children.map(trailingDropdown.props.children,function(child){if(child.type===InputDropdownButton){return React__default.cloneElement(child,{_isInsideSearchInput:true,size:size});}if(child.type===DropdownOverlay){return React__default.cloneElement(child,{referenceRef:triggererWrapperRef,_isNestedDropdown:true,defaultPlacement:'bottom-end'});}return child;})});};var renderClearButton=function renderClearButton(){return jsx(IconButton,{size:"medium",icon:CloseIcon,onClick:function onClick(){var _textInputRef$current;if(isEmpty(value)&&textInputRef.current){if(isReactNative(textInputRef.current)){textInputRef.current.clear();textInputRef.current.focus();}else if(textInputRef.current instanceof HTMLInputElement){textInputRef.current.value='';textInputRef.current.focus();}}onClearButtonClick==null?void 0:onClearButtonClick();textInputRef==null?void 0:(_textInputRef$current=textInputRef.current)==null?void 0:_textInputRef$current.focus();setShouldShowClearButton(false);},isDisabled:isDisabled,accessibilityLabel:"Clear Input Content"});};var renderInteractionElement=function renderInteractionElement(){if(isLoading){return jsx(Spinner,{accessibilityLabel:"Loading Content",color:"primary"});}if(shouldShowClearButton&&trailingDropdown){return jsxs(BaseBox,{display:"flex",gap:"spacing.3",children:[renderClearButton()," ",jsx(Divider,{orientation:"vertical"})]});}if(shouldShowClearButton){return renderClearButton();}return null;};var searchContent=jsx(BaseBox,{position:"relative",children:jsx(BaseInput,Object.assign({id:"searchinput",componentName:MetaConstants.SearchInput,ref:mergedRef,isDropdownTrigger:true,setInputWrapperRef:isInsideDropdown||isTrailingDropDownOpen?function(wrapperNode){triggererWrapperRef.current=wrapperNode;}:undefined,label:label,accessibilityLabel:accessibilityLabel,hideLabelText:!Boolean(label),labelPosition:labelPosition,labelSuffix:labelSuffix,labelTrailing:labelTrailing,placeholder:placeholder,defaultValue:defaultValue,value:value,name:name,onKeyDown:isInsideDropdown?onTriggerKeydown:undefined,onChange:function onChange(_ref2){var name=_ref2.name,value=_ref2.value;if(value!=null&&value.length){setShouldShowClearButton(true);}if(shouldShowClearButton&&!(value!=null&&value.length)){setShouldShowClearButton(false);}_onChange==null?void 0:_onChange({name:name,value:value});},onClick:function onClick(e){if(isDisabled)return;if(isInsideDropdown){onTriggerClick();}_onClick==null?void 0:_onClick(e);},onFocus:function onFocus(e){setIsSearchFocused(true);_onFocus==null?void 0:_onFocus(e);},onBlur:function onBlur(e){setIsSearchFocused(false);_onBlur==null?void 0:_onBlur(e);},onSubmit:onSubmit,isDisabled:isDisabled,leadingIcon:showSearchIcon?SearchIcon:undefined,trailingInteractionElement:renderInteractionElement(),trailingDropDown:renderTrailingDropDown(),helpText:helpText,autoFocus:autoFocus,testID:testID},getKeyboardAndAutocompleteProps({type:'search',autoCapitalize:autoCapitalize}),{size:size},rest))});return jsx(TopNavOverlayThemeOverride,{shouldOverrideTheme:modalContext.isInsideModal?true:isSearchFocused,children:searchContent});};var SearchInput=assignWithoutSideEffects(React__default.forwardRef(_SearchInput),{displayName:'SearchInput',componentId:dropdownComponentIds.triggers.SearchInput});
|
|
473
474
|
|
|
474
475
|
export { SearchInput };
|
|
475
476
|
//# sourceMappingURL=SearchInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchInput.js","sources":["../../../../../../src/components/Input/SearchInput/SearchInput.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport type { ReactElement, ReactNode } from 'react';\nimport type { TextInput as TextInputReactNative } from 'react-native';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { getKeyboardAndAutocompleteProps } from '../BaseInput/utils';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport { CloseIcon, SearchIcon } from '~components/Icons';\nimport { IconButton } from '~components/Button/IconButton';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Spinner } from '~components/Spinner';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType } from '~utils';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport type {\n BladeElementRef,\n BladeElementRefWithValue,\n DataAnalyticsAttribute,\n} from '~utils/types';\nimport { dropdownComponentIds } from '~components/Dropdown/dropdownComponentIds';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\nimport { DropdownOverlay, InputDropdownButton } from '~components/Dropdown';\nimport { Divider } from '~components/Divider';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { TopNavOverlayThemeOverride } from '~components/TopNav/TopNavOverlayThemeOverride';\n\ntype SearchInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'labelSuffix'\n | 'labelTrailing'\n | 'helpText'\n | 'placeholder'\n | 'defaultValue'\n | 'name'\n | 'onChange'\n | 'onFocus'\n | 'onBlur'\n | 'value'\n | 'isDisabled'\n | 'autoFocus'\n | 'onSubmit'\n | 'autoCapitalize'\n | 'testID'\n | 'onClick'\n | 'size'\n | keyof DataAnalyticsAttribute\n> & {\n /**\n * Event handler to handle the onClick event for clear button.\n */\n onClearButtonClick?: () => void;\n\n /**\n * Decides whether to show a loading spinner for the input field.\n */\n isLoading?: boolean;\n /**\n * Toggle the visibility of the search icon.\n *\n * @default true\n */\n showSearchIcon?: boolean;\n /**\n * Optional trailing to be shown at the end of the input.\n */\n trailing?: React.ReactNode;\n} & StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype SearchInputPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype SearchInputPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype SearchInputProps = (SearchInputPropsWithA11yLabel | SearchInputPropsWithLabel) &\n SearchInputCommonProps;\n\n// need to do this to tell TS to infer type as SearchInput of React Native and make it believe that `ref.current.clear()` exists\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isReactNative = (_textInputRef?: any): _textInputRef is TextInputReactNative => {\n return getPlatformType() === 'react-native';\n};\n\nconst _SearchInput: React.ForwardRefRenderFunction<BladeElementRef, SearchInputProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition = 'top',\n placeholder,\n defaultValue,\n name,\n value,\n onChange,\n onClick,\n onFocus,\n onBlur,\n onSubmit,\n isDisabled,\n labelSuffix,\n labelTrailing,\n helpText,\n onClearButtonClick,\n isLoading,\n autoCapitalize,\n autoFocus,\n testID,\n size = 'medium',\n showSearchIcon = true,\n trailing,\n ...rest\n },\n ref,\n): ReactElement => {\n const textInputRef = React.useRef<BladeElementRefWithValue>(null);\n const mergedRef = useMergeRefs(ref, textInputRef);\n const [shouldShowClearButton, setShouldShowClearButton] = useState(false);\n const [isTrailingDropDownOpen, setIsTrailingDropDownOpen] = useState(false);\n const {\n triggererWrapperRef,\n onTriggerKeydown,\n onTriggerClick,\n dropdownTriggerer,\n close: closeParentDropDown,\n isOpen: isParentDropDownOpen,\n } = useDropdown();\n const isInsideDropdown = dropdownTriggerer === 'SearchInput';\n\n const [isSearchFocused, setIsSearchFocused] = useState(false);\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(defaultValue ?? value));\n }, [defaultValue, value]);\n\n useEffect(() => {\n if (isParentDropDownOpen && isTrailingDropDownOpen) {\n setIsTrailingDropDownOpen(false);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [closeParentDropDown, isParentDropDownOpen]);\n\n useEffect(() => {\n if (isTrailingDropDownOpen && isParentDropDownOpen) {\n closeParentDropDown();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [setIsTrailingDropDownOpen, isTrailingDropDownOpen]);\n\n const trailingDropdown =\n trailing && getComponentId(trailing as React.ReactElement) === 'Dropdown' ? trailing : null;\n\n const renderTrailingDropDown = (): React.ReactElement | null => {\n if (!trailingDropdown) {\n return null;\n }\n return React.cloneElement(trailingDropdown as React.ReactElement, {\n selectionType: 'single',\n isOpen: isTrailingDropDownOpen,\n height: '100%',\n onOpenChange: (isOpen: boolean) => {\n setIsTrailingDropDownOpen(isOpen);\n },\n children: React.Children.map(\n (trailingDropdown as React.ReactElement).props.children,\n (child) => {\n if (child.type === InputDropdownButton) {\n return React.cloneElement(child, {\n _isInsideSearchInput: true,\n size,\n });\n }\n if (child.type === DropdownOverlay) {\n return React.cloneElement(child, {\n referenceRef: triggererWrapperRef,\n _isNestedDropdown: true,\n defaultPlacement: 'bottom-end',\n });\n }\n return child;\n },\n ),\n });\n };\n\n const renderClearButton = (): React.ReactElement => {\n return (\n <IconButton\n size=\"medium\"\n icon={CloseIcon}\n onClick={() => {\n if (isEmpty(value) && textInputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (isReactNative(textInputRef.current)) {\n textInputRef.current.clear();\n textInputRef.current.focus();\n } else if (textInputRef.current instanceof HTMLInputElement) {\n textInputRef.current.value = '';\n textInputRef.current.focus();\n }\n }\n\n // if the input field is controlled just call the click handler and the value change shall be left upto the consumer\n onClearButtonClick?.();\n textInputRef?.current?.focus();\n setShouldShowClearButton(false);\n }}\n isDisabled={isDisabled}\n accessibilityLabel=\"Clear Input Content\"\n />\n );\n };\n\n const renderInteractionElement = (): ReactNode => {\n if (isLoading) {\n return <Spinner accessibilityLabel=\"Loading Content\" color=\"primary\" />;\n }\n\n if (shouldShowClearButton && trailingDropdown) {\n return (\n <BaseBox display=\"flex\" gap=\"spacing.3\">\n {renderClearButton()} <Divider orientation=\"vertical\" />\n </BaseBox>\n );\n }\n if (shouldShowClearButton) {\n return renderClearButton();\n }\n\n return null;\n };\n\n const searchContent = (\n <BaseBox position=\"relative\">\n <BaseInput\n id=\"searchinput\"\n componentName={MetaConstants.SearchInput}\n ref={mergedRef}\n isDropdownTrigger={true}\n setInputWrapperRef={\n isInsideDropdown || isTrailingDropDownOpen\n ? (wrapperNode) => {\n triggererWrapperRef.current = wrapperNode;\n }\n : undefined\n }\n label={label as string}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n labelSuffix={labelSuffix}\n labelTrailing={labelTrailing}\n placeholder={placeholder}\n defaultValue={defaultValue}\n value={value}\n name={name}\n onKeyDown={isInsideDropdown ? onTriggerKeydown : undefined}\n onChange={({ name, value }) => {\n if (value?.length) {\n // show the clear button when the user starts typing in\n setShouldShowClearButton(true);\n }\n\n if (shouldShowClearButton && !value?.length) {\n // hide the clear button when the input field is empty\n setShouldShowClearButton(false);\n }\n\n onChange?.({ name, value });\n }}\n onClick={(e) => {\n if (isDisabled) return;\n if (isInsideDropdown) {\n onTriggerClick();\n }\n onClick?.(e);\n }}\n onFocus={(e) => {\n setIsSearchFocused(true);\n onFocus?.(e);\n }}\n onBlur={(e) => {\n setIsSearchFocused(false);\n onBlur?.(e);\n }}\n onSubmit={onSubmit}\n isDisabled={isDisabled}\n leadingIcon={showSearchIcon ? SearchIcon : undefined}\n trailingInteractionElement={renderInteractionElement()}\n trailingDropDown={renderTrailingDropDown()}\n helpText={helpText}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n testID={testID}\n {...getKeyboardAndAutocompleteProps({\n type: 'search',\n autoCapitalize,\n })}\n size={size}\n {...rest}\n />\n </BaseBox>\n );\n\n return (\n <TopNavOverlayThemeOverride shouldOverrideTheme={isSearchFocused}>\n {searchContent}\n </TopNavOverlayThemeOverride>\n );\n};\n\nconst SearchInput = assignWithoutSideEffects(React.forwardRef(_SearchInput), {\n displayName: 'SearchInput',\n componentId: dropdownComponentIds.triggers.SearchInput,\n});\n\nexport type { SearchInputProps };\nexport { SearchInput };\n"],"names":["isReactNative","_textInputRef","getPlatformType","_SearchInput","_ref","ref","label","accessibilityLabel","_ref$labelPosition","labelPosition","placeholder","defaultValue","name","value","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","labelSuffix","labelTrailing","helpText","onClearButtonClick","isLoading","autoCapitalize","autoFocus","testID","_ref$size","size","_ref$showSearchIcon","showSearchIcon","trailing","rest","_objectWithoutProperties","_excluded","textInputRef","React","useRef","mergedRef","useMergeRefs","_useState","useState","_useState2","_slicedToArray","shouldShowClearButton","setShouldShowClearButton","_useState3","_useState4","isTrailingDropDownOpen","setIsTrailingDropDownOpen","_useDropdown","useDropdown","triggererWrapperRef","onTriggerKeydown","onTriggerClick","dropdownTriggerer","closeParentDropDown","close","isParentDropDownOpen","isOpen","isInsideDropdown","_useState5","_useState6","isSearchFocused","setIsSearchFocused","useEffect","Boolean","trailingDropdown","getComponentId","renderTrailingDropDown","cloneElement","selectionType","height","onOpenChange","children","Children","map","props","child","type","InputDropdownButton","_isInsideSearchInput","DropdownOverlay","referenceRef","_isNestedDropdown","defaultPlacement","renderClearButton","_jsx","IconButton","icon","CloseIcon","_textInputRef$current","isEmpty","current","clear","focus","HTMLInputElement","renderInteractionElement","Spinner","color","_jsxs","BaseBox","display","gap","Divider","orientation","searchContent","position","BaseInput","Object","assign","id","componentName","MetaConstants","SearchInput","isDropdownTrigger","setInputWrapperRef","wrapperNode","undefined","hideLabelText","onKeyDown","_ref2","length","e","leadingIcon","SearchIcon","trailingInteractionElement","trailingDropDown","getKeyboardAndAutocompleteProps","TopNavOverlayThemeOverride","shouldOverrideTheme","assignWithoutSideEffects","forwardRef","displayName","componentId","dropdownComponentIds","triggers"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,eAAA,CAAA,aAAA,CAAA,cAAA,CAAA,MAAA,CAAA,OAAA,CAAA,UAAA,CAAA,SAAA,CAAA,SAAA,CAAA,QAAA,CAAA,UAAA,CAAA,YAAA,CAAA,aAAA,CAAA,eAAA,CAAA,UAAA,CAAA,oBAAA,CAAA,WAAA,CAAA,gBAAA,CAAA,WAAA,CAAA,QAAA,CAAA,MAAA,CAAA,gBAAA,CAAA,UAAA,CAAA,CA0GA,IAAMA,aAAa,CAAG,SAAhBA,aAAaA,CAAIC,aAAmB,CAA4C,CACpF,OAAOC,eAAe,EAAE,GAAK,cAAc,CAC7C,CAAC,CAED,IAAMC,YAA+E,CAAG,SAAlFA,YAA+EA,CAAAC,IAAA,CA4BnFC,G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AA0B,CAAE7B,wBAAwB,EAAG,CACvD8B,gBAAgB,CAAE1D,sBAAsB,EAAG,CAC3ChD,QAAQ,CAAEA,QAAS,CAEnBI,SAAS,CAAEA,SAAU,CACrBC,MAAM,CAAEA,MAAO,EACXsG,+BAA+B,CAAC,CAClCjD,IAAI,CAAE,QAAQ,CACdvD,cAAc,CAAdA,cACF,CAAC,CAAC,CACFI,CAAAA,IAAI,CAAEA,IAAK,CAAA,CACPI,IAAI,CACT,CAAC,CACK,CACV,CAED,OACEuD,GAAA,CAAC0C,0BAA0B,CAAA,CAACC,mBAAmB,CAAEnE,eAAgB,CAAAW,QAAA,CAC9DgC,aAAa,CACY,CAAC,CAEjC,CAAC,CAEK,IAAAQ,WAAW,CAAGiB,wBAAwB,CAAC/F,cAAK,CAACgG,UAAU,CAAClI,YAAY,CAAC,CAAE,CAC3EmI,WAAW,CAAE,aAAa,CAC1BC,WAAW,CAAEC,oBAAoB,CAACC,QAAQ,CAACtB,WAC7C,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"SearchInput.js","sources":["../../../../../../src/components/Input/SearchInput/SearchInput.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport type { ReactElement, ReactNode } from 'react';\nimport type { TextInput as TextInputReactNative } from 'react-native';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { getKeyboardAndAutocompleteProps } from '../BaseInput/utils';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport { CloseIcon, SearchIcon } from '~components/Icons';\nimport { IconButton } from '~components/Button/IconButton';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Spinner } from '~components/Spinner';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType } from '~utils';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport type {\n BladeElementRef,\n BladeElementRefWithValue,\n DataAnalyticsAttribute,\n} from '~utils/types';\nimport { dropdownComponentIds } from '~components/Dropdown/dropdownComponentIds';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\nimport { DropdownOverlay, InputDropdownButton } from '~components/Dropdown';\nimport { Divider } from '~components/Divider';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { TopNavOverlayThemeOverride } from '~components/TopNav/TopNavOverlayThemeOverride';\nimport { useModalContext } from '~components/Modal/ModalContext';\n\ntype SearchInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'labelSuffix'\n | 'labelTrailing'\n | 'helpText'\n | 'placeholder'\n | 'defaultValue'\n | 'name'\n | 'onChange'\n | 'onFocus'\n | 'onBlur'\n | 'value'\n | 'isDisabled'\n | 'autoFocus'\n | 'onSubmit'\n | 'autoCapitalize'\n | 'testID'\n | 'onClick'\n | 'size'\n | keyof DataAnalyticsAttribute\n> & {\n /**\n * Event handler to handle the onClick event for clear button.\n */\n onClearButtonClick?: () => void;\n\n /**\n * Decides whether to show a loading spinner for the input field.\n */\n isLoading?: boolean;\n /**\n * Toggle the visibility of the search icon.\n *\n * @default true\n */\n showSearchIcon?: boolean;\n /**\n * Optional trailing to be shown at the end of the input.\n */\n trailing?: React.ReactNode;\n} & StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype SearchInputPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype SearchInputPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype SearchInputProps = (SearchInputPropsWithA11yLabel | SearchInputPropsWithLabel) &\n SearchInputCommonProps;\n\n// need to do this to tell TS to infer type as SearchInput of React Native and make it believe that `ref.current.clear()` exists\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isReactNative = (_textInputRef?: any): _textInputRef is TextInputReactNative => {\n return getPlatformType() === 'react-native';\n};\n\nconst _SearchInput: React.ForwardRefRenderFunction<BladeElementRef, SearchInputProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition = 'top',\n placeholder,\n defaultValue,\n name,\n value,\n onChange,\n onClick,\n onFocus,\n onBlur,\n onSubmit,\n isDisabled,\n labelSuffix,\n labelTrailing,\n helpText,\n onClearButtonClick,\n isLoading,\n autoCapitalize,\n autoFocus,\n testID,\n size = 'medium',\n showSearchIcon = true,\n trailing,\n ...rest\n },\n ref,\n): ReactElement => {\n const textInputRef = React.useRef<BladeElementRefWithValue>(null);\n const mergedRef = useMergeRefs(ref, textInputRef);\n const [shouldShowClearButton, setShouldShowClearButton] = useState(false);\n const [isTrailingDropDownOpen, setIsTrailingDropDownOpen] = useState(false);\n const {\n triggererWrapperRef,\n onTriggerKeydown,\n onTriggerClick,\n dropdownTriggerer,\n close: closeParentDropDown,\n isOpen: isParentDropDownOpen,\n } = useDropdown();\n const isInsideDropdown = dropdownTriggerer === 'SearchInput';\n\n const [isSearchFocused, setIsSearchFocused] = useState(false);\n\n const modalContext = useModalContext();\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(defaultValue ?? value));\n }, [defaultValue, value]);\n\n useEffect(() => {\n if (isParentDropDownOpen && isTrailingDropDownOpen) {\n setIsTrailingDropDownOpen(false);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [closeParentDropDown, isParentDropDownOpen]);\n\n useEffect(() => {\n if (isTrailingDropDownOpen && isParentDropDownOpen) {\n closeParentDropDown();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [setIsTrailingDropDownOpen, isTrailingDropDownOpen]);\n\n const trailingDropdown =\n trailing && getComponentId(trailing as React.ReactElement) === 'Dropdown' ? trailing : null;\n\n const renderTrailingDropDown = (): React.ReactElement | null => {\n if (!trailingDropdown) {\n return null;\n }\n return React.cloneElement(trailingDropdown as React.ReactElement, {\n selectionType: 'single',\n isOpen: isTrailingDropDownOpen,\n height: '100%',\n onOpenChange: (isOpen: boolean) => {\n setIsTrailingDropDownOpen(isOpen);\n },\n children: React.Children.map(\n (trailingDropdown as React.ReactElement).props.children,\n (child) => {\n if (child.type === InputDropdownButton) {\n return React.cloneElement(child, {\n _isInsideSearchInput: true,\n size,\n });\n }\n if (child.type === DropdownOverlay) {\n return React.cloneElement(child, {\n referenceRef: triggererWrapperRef,\n _isNestedDropdown: true,\n defaultPlacement: 'bottom-end',\n });\n }\n return child;\n },\n ),\n });\n };\n\n const renderClearButton = (): React.ReactElement => {\n return (\n <IconButton\n size=\"medium\"\n icon={CloseIcon}\n onClick={() => {\n if (isEmpty(value) && textInputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (isReactNative(textInputRef.current)) {\n textInputRef.current.clear();\n textInputRef.current.focus();\n } else if (textInputRef.current instanceof HTMLInputElement) {\n textInputRef.current.value = '';\n textInputRef.current.focus();\n }\n }\n\n // if the input field is controlled just call the click handler and the value change shall be left upto the consumer\n onClearButtonClick?.();\n textInputRef?.current?.focus();\n setShouldShowClearButton(false);\n }}\n isDisabled={isDisabled}\n accessibilityLabel=\"Clear Input Content\"\n />\n );\n };\n\n const renderInteractionElement = (): ReactNode => {\n if (isLoading) {\n return <Spinner accessibilityLabel=\"Loading Content\" color=\"primary\" />;\n }\n\n if (shouldShowClearButton && trailingDropdown) {\n return (\n <BaseBox display=\"flex\" gap=\"spacing.3\">\n {renderClearButton()} <Divider orientation=\"vertical\" />\n </BaseBox>\n );\n }\n if (shouldShowClearButton) {\n return renderClearButton();\n }\n\n return null;\n };\n\n const searchContent = (\n <BaseBox position=\"relative\">\n <BaseInput\n id=\"searchinput\"\n componentName={MetaConstants.SearchInput}\n ref={mergedRef}\n isDropdownTrigger={true}\n setInputWrapperRef={\n isInsideDropdown || isTrailingDropDownOpen\n ? (wrapperNode) => {\n triggererWrapperRef.current = wrapperNode;\n }\n : undefined\n }\n label={label as string}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n labelSuffix={labelSuffix}\n labelTrailing={labelTrailing}\n placeholder={placeholder}\n defaultValue={defaultValue}\n value={value}\n name={name}\n onKeyDown={isInsideDropdown ? onTriggerKeydown : undefined}\n onChange={({ name, value }) => {\n if (value?.length) {\n // show the clear button when the user starts typing in\n setShouldShowClearButton(true);\n }\n\n if (shouldShowClearButton && !value?.length) {\n // hide the clear button when the input field is empty\n setShouldShowClearButton(false);\n }\n\n onChange?.({ name, value });\n }}\n onClick={(e) => {\n if (isDisabled) return;\n if (isInsideDropdown) {\n onTriggerClick();\n }\n onClick?.(e);\n }}\n onFocus={(e) => {\n setIsSearchFocused(true);\n onFocus?.(e);\n }}\n onBlur={(e) => {\n setIsSearchFocused(false);\n onBlur?.(e);\n }}\n onSubmit={onSubmit}\n isDisabled={isDisabled}\n leadingIcon={showSearchIcon ? SearchIcon : undefined}\n trailingInteractionElement={renderInteractionElement()}\n trailingDropDown={renderTrailingDropDown()}\n helpText={helpText}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n testID={testID}\n {...getKeyboardAndAutocompleteProps({\n type: 'search',\n autoCapitalize,\n })}\n size={size}\n {...rest}\n />\n </BaseBox>\n );\n\n return (\n <TopNavOverlayThemeOverride\n shouldOverrideTheme={modalContext.isInsideModal ? true : isSearchFocused}\n >\n {searchContent}\n </TopNavOverlayThemeOverride>\n );\n};\n\nconst SearchInput = assignWithoutSideEffects(React.forwardRef(_SearchInput), {\n displayName: 'SearchInput',\n componentId: dropdownComponentIds.triggers.SearchInput,\n});\n\nexport type { SearchInputProps };\nexport { SearchInput };\n"],"names":["isReactNative","_textInputRef","getPlatformType","_SearchInput","_ref","ref","label","accessibilityLabel","_ref$labelPosition","labelPosition","placeholder","defaultValue","name","value","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","labelSuffix","labelTrailing","helpText","onClearButtonClick","isLoading","autoCapitalize","autoFocus","testID","_ref$size","size","_ref$showSearchIcon","showSearchIcon","trailing","rest","_objectWithoutProperties","_excluded","textInputRef","React","useRef","mergedRef","useMergeRefs","_useState","useState","_useState2","_slicedToArray","shouldShowClearButton","setShouldShowClearButton","_useState3","_useState4","isTrailingDropDownOpen","setIsTrailingDropDownOpen","_useDropdown","useDropdown","triggererWrapperRef","onTriggerKeydown","onTriggerClick","dropdownTriggerer","closeParentDropDown","close","isParentDropDownOpen","isOpen","isInsideDropdown","_useState5","_useState6","isSearchFocused","setIsSearchFocused","modalContext","useModalContext","useEffect","Boolean","trailingDropdown","getComponentId","renderTrailingDropDown","cloneElement","selectionType","height","onOpenChange","children","Children","map","props","child","type","InputDropdownButton","_isInsideSearchInput","DropdownOverlay","referenceRef","_isNestedDropdown","defaultPlacement","renderClearButton","_jsx","IconButton","icon","CloseIcon","_textInputRef$current","isEmpty","current","clear","focus","HTMLInputElement","renderInteractionElement","Spinner","color","_jsxs","BaseBox","display","gap","Divider","orientation","searchContent","position","BaseInput","Object","assign","id","componentName","MetaConstants","SearchInput","isDropdownTrigger","setInputWrapperRef","wrapperNode","undefined","hideLabelText","onKeyDown","_ref2","length","e","leadingIcon","SearchIcon","trailingInteractionElement","trailingDropDown","getKeyboardAndAutocompleteProps","TopNavOverlayThemeOverride","shouldOverrideTheme","isInsideModal","assignWithoutSideEffects","forwardRef","displayName","componentId","dropdownComponentIds","triggers"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,CAEK,IAAAQ,WAAW,CAAGkB,wBAAwB,CAAClG,cAAK,CAACmG,UAAU,CAACrI,YAAY,CAAC,CAAE,CAC3EsI,WAAW,CAAE,aAAa,CAC1BC,WAAW,CAAEC,oBAAoB,CAACC,QAAQ,CAACvB,WAC7C,CAAC;;;;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
var ModalContext=React__default.createContext({close:function close(){},isDismissible:true,defaultInitialFocusRef:{current:null},isOpen:false,isVisible:false,isInsideModal:false});var useModalContext=function useModalContext(){var state=React__default.useContext(ModalContext);return state;};
|
|
4
|
+
|
|
5
|
+
export { ModalContext, useModalContext };
|
|
6
|
+
//# sourceMappingURL=ModalContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModalContext.js","sources":["../../../../../src/components/Modal/ModalContext.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react';\n\ntype ModalContextProps = {\n /**\n * Indicates open state of Modal\n */\n isOpen: boolean;\n /**\n * Function to close the Modal\n */\n close?: () => void;\n /**\n * Whether the modal can be dismissed\n */\n isDismissible: boolean;\n /**\n * The element that will get focused when the Modal first opens\n */\n defaultInitialFocusRef: React.MutableRefObject<any>;\n /**\n * Indicates if the Modal is visible according to the usePresence hook\n */\n isVisible: boolean;\n /**\n * Indicates if the Modal is inside a Modal\n */\n isInsideModal: boolean;\n};\n\nconst ModalContext = React.createContext<ModalContextProps>({\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n close: () => {},\n isDismissible: true,\n defaultInitialFocusRef: { current: null },\n isOpen: false,\n isVisible: false,\n isInsideModal: false,\n});\n\nconst useModalContext = (): ModalContextProps => {\n const state = React.useContext(ModalContext);\n return state;\n};\n\nexport { ModalContext, useModalContext };\n"],"names":["ModalContext","React","createContext","close","isDismissible","defaultInitialFocusRef","current","isOpen","isVisible","isInsideModal","useModalContext","state","useContext"],"mappings":";;AA8BM,IAAAA,YAAY,CAAGC,cAAK,CAACC,aAAa,CAAoB,CAE1DC,KAAK,CAAE,SAAPA,KAAKA,EAAQ,EAAE,CACfC,aAAa,CAAE,IAAI,CACnBC,sBAAsB,CAAE,CAAEC,OAAO,CAAE,IAAK,CAAC,CACzCC,MAAM,CAAE,KAAK,CACbC,SAAS,CAAE,KAAK,CAChBC,aAAa,CAAE,KACjB,CAAC,EAEK,IAAAC,eAAe,CAAG,SAAlBA,eAAeA,EAA4B,CAC/C,IAAMC,KAAK,CAAGV,cAAK,CAACW,UAAU,CAACZ,YAAY,CAAC,CAC5C,OAAOW,KAAK,CACd;;;;"}
|
|
@@ -4,7 +4,16 @@ import '../../tokens/global/motion.js';
|
|
|
4
4
|
import { size } from '../../tokens/global/size.js';
|
|
5
5
|
import { makeSpace } from '../makeSpace/makeSpace.js';
|
|
6
6
|
|
|
7
|
-
var getSurfaceBoxShadow=function getSurfaceBoxShadow(theme,colorScheme){var boxShadow={light:{elevation:`0px 6px 32px 4px ${colors.neutral.blueGrayLight.a406}`,border:`inset 0px 0px 0px 1px ${theme.colors.interactive.border.gray.disabled}`,top:`inset 0px -1.5px 0px 1px ${theme.colors.surface.background.gray.intense}`},dark:{elevation:`0px 6px 12px 4px ${colors.neutral.black[5]}`,border:`inset 0px 0px 0px 1px ${theme.colors.interactive.border.gray.disabled}`,top:`inset 0px 0px 0px 1px ${theme.colors.surface.background.gray.intense}`}};return boxShadow[colorScheme];};var getSurfaceBoxShadowString=function getSurfaceBoxShadowString(theme,colorScheme){var _getSurfaceBoxShadow=getSurfaceBoxShadow(theme,colorScheme),border=_getSurfaceBoxShadow.border,elevation=_getSurfaceBoxShadow.elevation,top=_getSurfaceBoxShadow.top;return `${border}, ${elevation}, ${top}`;};var surfaceGradientsByScheme={light:{top:{start:colors.neutral.blueGrayLight[0],end:colors.neutral.blueGrayLight[0]},bottom:{start:colors.neutral.blueGrayLight[0],end:colors.neutral.blueGrayLight[50]}},dark:{top:{start:colors.neutral.blueGrayDark[1000],end:colors.neutral.blueGrayDark[1100]},bottom:{start:colors.neutral.blueGrayDark[1100],end:colors.neutral.blueGrayDark[1100]}}};var getSurfaceGradients=function getSurfaceGradients(colorScheme){return surfaceGradientsByScheme[colorScheme];};var getSurfaceStyles=function getSurfaceStyles(theme,colorScheme,options){var
|
|
7
|
+
var getSurfaceBoxShadow=function getSurfaceBoxShadow(theme,colorScheme){var boxShadow={light:{elevation:`0px 6px 32px 4px ${colors.neutral.blueGrayLight.a406}`,border:`inset 0px 0px 0px 1px ${theme.colors.interactive.border.gray.disabled}`,top:`inset 0px -1.5px 0px 1px ${theme.colors.surface.background.gray.intense}`},dark:{elevation:`0px 6px 12px 4px ${colors.neutral.black[5]}`,border:`inset 0px 0px 0px 1px ${theme.colors.interactive.border.gray.disabled}`,top:`inset 0px 0px 0px 1px ${theme.colors.surface.background.gray.intense}`}};return boxShadow[colorScheme];};var getSurfaceBoxShadowString=function getSurfaceBoxShadowString(theme,colorScheme){var _getSurfaceBoxShadow=getSurfaceBoxShadow(theme,colorScheme),border=_getSurfaceBoxShadow.border,elevation=_getSurfaceBoxShadow.elevation,top=_getSurfaceBoxShadow.top;return `${border}, ${elevation}, ${top}`;};var surfaceGradientsByScheme={light:{top:{start:colors.neutral.blueGrayLight[0],end:colors.neutral.blueGrayLight[0]},bottom:{start:colors.neutral.blueGrayLight[0],end:colors.neutral.blueGrayLight[50]}},dark:{top:{start:colors.neutral.blueGrayDark[1000],end:colors.neutral.blueGrayDark[1100]},bottom:{start:colors.neutral.blueGrayDark[1100],end:colors.neutral.blueGrayDark[1100]}}};var getSurfaceGradients=function getSurfaceGradients(colorScheme){return surfaceGradientsByScheme[colorScheme];};var getSurfaceStyles=function getSurfaceStyles(theme,colorScheme,options){var isDarkMode=colorScheme==='dark';var _getSurfaceBoxShadow2=getSurfaceBoxShadow(theme,colorScheme),border=_getSurfaceBoxShadow2.border,elevation=_getSurfaceBoxShadow2.elevation,top=_getSurfaceBoxShadow2.top;var boxShadow=options!=null&&options.hideBorder?`${elevation}, ${top}`:`${border}, ${elevation}, ${top}`;var _getSurfaceGradients=getSurfaceGradients(colorScheme),topGradientColor=_getSurfaceGradients.top,bottomGradientColor=_getSurfaceGradients.bottom;var gradientHeight=makeSpace(size[16]);var bottomInset=isDarkMode?1:2;var xInset=2;return {boxShadow:boxShadow,border:'none',borderTop:isDarkMode?`1px solid ${theme.colors.surface.border.gray.subtle}`:'',backgroundImage:`
|
|
8
|
+
linear-gradient(to bottom, ${topGradientColor.start} 0%, ${topGradientColor.end} 100%),
|
|
9
|
+
linear-gradient(to bottom, ${bottomGradientColor.start} 0%, ${bottomGradientColor.end} 100%)
|
|
10
|
+
`,backgroundPosition:`
|
|
11
|
+
center top,
|
|
12
|
+
center calc(100% - ${bottomInset}px)
|
|
13
|
+
`,backgroundSize:`
|
|
14
|
+
calc(100% - ${xInset}px) ${gradientHeight},
|
|
15
|
+
calc(100% - ${xInset}px) ${gradientHeight}
|
|
16
|
+
`,backgroundRepeat:'no-repeat'};};
|
|
8
17
|
|
|
9
18
|
export { getSurfaceBoxShadow, getSurfaceBoxShadowString, getSurfaceGradients, getSurfaceStyles };
|
|
10
19
|
//# sourceMappingURL=makeSurfaceStyles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeSurfaceStyles.js","sources":["../../../../../src/utils/makeSurfaceStyles/makeSurfaceStyles.ts"],"sourcesContent":["import { colors, size } from '~tokens/global';\nimport type { ColorSchemeNames } from '~tokens/theme';\nimport type { Theme } from '~components/BladeProvider';\nimport { makeSpace } from '~utils/makeSpace';\n\nexport type SurfaceBoxShadow = {\n elevation: string;\n border: string;\n top: string;\n};\n\n/**\n * Returns the surface-style box shadow layers (elevation, border, top inner shadow)\n * for use in Card, Table, and other elevated surfaces. Use the same shadow in both\n * places for visual consistency.\n *\n * @param theme - Blade theme (from useTheme())\n * @param colorScheme - 'light' | 'dark'\n * @returns Object with elevation, border, and top shadow CSS strings\n */\nexport const getSurfaceBoxShadow = (\n theme: Theme,\n colorScheme: ColorSchemeNames,\n): SurfaceBoxShadow => {\n const boxShadow = {\n light: {\n elevation: `0px 6px 32px 4px ${colors.neutral.blueGrayLight.a406}`,\n border: `inset 0px 0px 0px 1px ${theme.colors.interactive.border.gray.disabled}`,\n top: `inset 0px -1.5px 0px 1px ${theme.colors.surface.background.gray.intense}`,\n },\n dark: {\n elevation: `0px 6px 12px 4px ${colors.neutral.black[5]}`,\n border: `inset 0px 0px 0px 1px ${theme.colors.interactive.border.gray.disabled}`,\n top: `inset 0px 0px 0px 1px ${theme.colors.surface.background.gray.intense}`,\n },\n };\n return boxShadow[colorScheme];\n};\n\n/**\n * Returns a single CSS box-shadow string combining border, elevation, and top inner shadow.\n * Use when applying the full surface shadow to an element.\n */\nexport const getSurfaceBoxShadowString = (theme: Theme, colorScheme: ColorSchemeNames): string => {\n const { border, elevation, top } = getSurfaceBoxShadow(theme, colorScheme);\n return `${border}, ${elevation}, ${top}`;\n};\n\nexport type SurfaceGradientColors = {\n start: string;\n end: string;\n};\n\nexport type SurfaceGradients = {\n top: SurfaceGradientColors;\n bottom: SurfaceGradientColors;\n};\n\nconst surfaceGradientsByScheme: Record<ColorSchemeNames, SurfaceGradients> = {\n light: {\n top: {\n start: colors.neutral.blueGrayLight[0],\n end: colors.neutral.blueGrayLight[0],\n },\n bottom: {\n start: colors.neutral.blueGrayLight[0],\n end: colors.neutral.blueGrayLight[50],\n },\n },\n dark: {\n top: {\n start: colors.neutral.blueGrayDark[1000],\n end: colors.neutral.blueGrayDark[1100],\n },\n bottom: {\n start: colors.neutral.blueGrayDark[1100],\n end: colors.neutral.blueGrayDark[1100],\n },\n },\n};\n\n/**\n * Returns the surface gradient colors (top and bottom) for Card-style overlays.\n *\n * @param colorScheme - 'light' | 'dark'\n * @returns Object with top and bottom gradient { start, end } colors\n */\nexport const getSurfaceGradients = (colorScheme: ColorSchemeNames): SurfaceGradients =>\n surfaceGradientsByScheme[colorScheme];\n\n/**\n * Returns the common surface decoration styles (box-shadow, border, gradients)\n * for use in Card, Table, ListView, and other elevated surfaces.\n * Spread this into a styled-component's return object alongside layout styles.\n */\nexport const getSurfaceStyles = (\n theme: Theme,\n colorScheme: ColorSchemeNames,\n options?: {
|
|
1
|
+
{"version":3,"file":"makeSurfaceStyles.js","sources":["../../../../../src/utils/makeSurfaceStyles/makeSurfaceStyles.ts"],"sourcesContent":["import { colors, size } from '~tokens/global';\nimport type { ColorSchemeNames } from '~tokens/theme';\nimport type { Theme } from '~components/BladeProvider';\nimport { makeSpace } from '~utils/makeSpace';\n\nexport type SurfaceBoxShadow = {\n elevation: string;\n border: string;\n top: string;\n};\n\n/**\n * Returns the surface-style box shadow layers (elevation, border, top inner shadow)\n * for use in Card, Table, and other elevated surfaces. Use the same shadow in both\n * places for visual consistency.\n *\n * @param theme - Blade theme (from useTheme())\n * @param colorScheme - 'light' | 'dark'\n * @returns Object with elevation, border, and top shadow CSS strings\n */\nexport const getSurfaceBoxShadow = (\n theme: Theme,\n colorScheme: ColorSchemeNames,\n): SurfaceBoxShadow => {\n const boxShadow = {\n light: {\n elevation: `0px 6px 32px 4px ${colors.neutral.blueGrayLight.a406}`,\n border: `inset 0px 0px 0px 1px ${theme.colors.interactive.border.gray.disabled}`,\n top: `inset 0px -1.5px 0px 1px ${theme.colors.surface.background.gray.intense}`,\n },\n dark: {\n elevation: `0px 6px 12px 4px ${colors.neutral.black[5]}`,\n border: `inset 0px 0px 0px 1px ${theme.colors.interactive.border.gray.disabled}`,\n top: `inset 0px 0px 0px 1px ${theme.colors.surface.background.gray.intense}`,\n },\n };\n return boxShadow[colorScheme];\n};\n\n/**\n * Returns a single CSS box-shadow string combining border, elevation, and top inner shadow.\n * Use when applying the full surface shadow to an element.\n */\nexport const getSurfaceBoxShadowString = (theme: Theme, colorScheme: ColorSchemeNames): string => {\n const { border, elevation, top } = getSurfaceBoxShadow(theme, colorScheme);\n return `${border}, ${elevation}, ${top}`;\n};\n\nexport type SurfaceGradientColors = {\n start: string;\n end: string;\n};\n\nexport type SurfaceGradients = {\n top: SurfaceGradientColors;\n bottom: SurfaceGradientColors;\n};\n\nconst surfaceGradientsByScheme: Record<ColorSchemeNames, SurfaceGradients> = {\n light: {\n top: {\n start: colors.neutral.blueGrayLight[0],\n end: colors.neutral.blueGrayLight[0],\n },\n bottom: {\n start: colors.neutral.blueGrayLight[0],\n end: colors.neutral.blueGrayLight[50],\n },\n },\n dark: {\n top: {\n start: colors.neutral.blueGrayDark[1000],\n end: colors.neutral.blueGrayDark[1100],\n },\n bottom: {\n start: colors.neutral.blueGrayDark[1100],\n end: colors.neutral.blueGrayDark[1100],\n },\n },\n};\n\n/**\n * Returns the surface gradient colors (top and bottom) for Card-style overlays.\n *\n * @param colorScheme - 'light' | 'dark'\n * @returns Object with top and bottom gradient { start, end } colors\n */\nexport const getSurfaceGradients = (colorScheme: ColorSchemeNames): SurfaceGradients =>\n surfaceGradientsByScheme[colorScheme];\n\n/**\n * Returns the common surface decoration styles (box-shadow, border, gradients)\n * for use in Card, Table, ListView, and other elevated surfaces.\n * Spread this into a styled-component's return object alongside layout styles.\n */\nexport const getSurfaceStyles = (\n theme: Theme,\n colorScheme: ColorSchemeNames,\n options?: { hideBorder?: boolean },\n): Record<string, unknown> => {\n const isDarkMode = colorScheme === 'dark';\n const { border, elevation, top } = getSurfaceBoxShadow(theme, colorScheme);\n const boxShadow = options?.hideBorder\n ? `${elevation}, ${top}`\n : `${border}, ${elevation}, ${top}`;\n const { top: topGradientColor, bottom: bottomGradientColor } = getSurfaceGradients(colorScheme);\n\n const gradientHeight = makeSpace(size[16]);\n const bottomInset = isDarkMode ? 1 : 2;\n const xInset = 2;\n\n return {\n boxShadow,\n border: 'none',\n borderTop: isDarkMode ? `1px solid ${theme.colors.surface.border.gray.subtle}` : '',\n backgroundImage: `\n linear-gradient(to bottom, ${topGradientColor.start} 0%, ${topGradientColor.end} 100%),\n linear-gradient(to bottom, ${bottomGradientColor.start} 0%, ${bottomGradientColor.end} 100%)\n `,\n backgroundPosition: `\n center top,\n center calc(100% - ${bottomInset}px)\n `,\n backgroundSize: `\n calc(100% - ${xInset}px) ${gradientHeight},\n calc(100% - ${xInset}px) ${gradientHeight}\n `,\n backgroundRepeat: 'no-repeat',\n };\n};\n"],"names":["getSurfaceBoxShadow","theme","colorScheme","boxShadow","light","elevation","colors","neutral","blueGrayLight","a406","border","interactive","gray","disabled","top","surface","background","intense","dark","black","getSurfaceBoxShadowString","_getSurfaceBoxShadow","surfaceGradientsByScheme","start","end","bottom","blueGrayDark","getSurfaceGradients","getSurfaceStyles","options","isDarkMode","_getSurfaceBoxShadow2","hideBorder","_getSurfaceGradients","topGradientColor","bottomGradientColor","gradientHeight","makeSpace","size","bottomInset","xInset","borderTop","subtle","backgroundImage","backgroundPosition","backgroundSize","backgroundRepeat"],"mappings":";;;;;;AAoBa,IAAAA,mBAAmB,CAAG,SAAtBA,mBAAmBA,CAC9BC,KAAY,CACZC,WAA6B,CACR,CACrB,IAAMC,SAAS,CAAG,CAChBC,KAAK,CAAE,CACLC,SAAS,CAAE,CAAoBC,iBAAAA,EAAAA,MAAM,CAACC,OAAO,CAACC,aAAa,CAACC,IAAI,CAAE,CAAA,CAClEC,MAAM,CAAE,yBAAyBT,KAAK,CAACK,MAAM,CAACK,WAAW,CAACD,MAAM,CAACE,IAAI,CAACC,QAAQ,CAAA,CAAE,CAChFC,GAAG,CAAE,CAA4Bb,yBAAAA,EAAAA,KAAK,CAACK,MAAM,CAACS,OAAO,CAACC,UAAU,CAACJ,IAAI,CAACK,OAAO,CAC/E,CAAA,CAAC,CACDC,IAAI,CAAE,CACJb,SAAS,CAAE,CAAA,iBAAA,EAAoBC,MAAM,CAACC,OAAO,CAACY,KAAK,CAAC,CAAC,CAAC,EAAE,CACxDT,MAAM,CAAE,CAAA,sBAAA,EAAyBT,KAAK,CAACK,MAAM,CAACK,WAAW,CAACD,MAAM,CAACE,IAAI,CAACC,QAAQ,CAAE,CAAA,CAChFC,GAAG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,CAAA,CAAE,CAAG,EAAE,CACnFC,eAAe,CAAE,CAAA;AACrB,iCAAA,EAAmCT,gBAAgB,CAACX,KAAK,CAAQW,KAAAA,EAAAA,gBAAgB,CAACV,GAAG,CAAA;AACrF,iCAAA,EAAmCW,mBAAmB,CAACZ,KAAK,CAAQY,KAAAA,EAAAA,mBAAmB,CAACX,GAAG,CAAA;AAC3F,IAAK,CAAA,CACDoB,kBAAkB,CAAE,CAAA;AACxB;AACA,yBAAA,EAA2BL,WAAW,CAAA;AACtC,IAAK,CAAA,CACDM,cAAc,CAAE,CAAA;AACpB,kBAAoBL,EAAAA,MAAM,OAAOJ,cAAc,CAAA;AAC/C,kBAAoBI,EAAAA,MAAM,OAAOJ,cAAc,CAAA;AAC/C,IAAA,CAAK,CACDU,gBAAgB,CAAE,WACpB,CAAC,CACH;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import '../node_modules/es-toolkit/dist/
|
|
1
|
+
import '../node_modules/es-toolkit/dist/object/cloneDeep.js';
|
|
2
2
|
//# sourceMappingURL=cloneDeep.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import '../node_modules/es-toolkit/dist/object/cloneDeep.js';
|
|
1
|
+
import '../node_modules/es-toolkit/dist/compat/object/cloneDeep.js';
|
|
2
2
|
//# sourceMappingURL=cloneDeep3.js.map
|
|
@@ -19,6 +19,7 @@ import '../../Dropdown/index.js';
|
|
|
19
19
|
import '../../Divider/index.js';
|
|
20
20
|
import '../../../utils/isValidAllowedChildren/index.js';
|
|
21
21
|
import { TopNavOverlayThemeOverride } from '../../TopNav/TopNavOverlayThemeOverride.js';
|
|
22
|
+
import { useModalContext } from '../../Modal/ModalContext.js';
|
|
22
23
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
23
24
|
import { getPlatformType } from '../../../utils/getPlatformType/getPlatformType.js';
|
|
24
25
|
import { getComponentId } from '../../../utils/isValidAllowedChildren/isValidAllowedChildren.js';
|
|
@@ -93,6 +94,7 @@ var _SearchInput = function _SearchInput(_ref, ref) {
|
|
|
93
94
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
94
95
|
isSearchFocused = _useState6[0],
|
|
95
96
|
setIsSearchFocused = _useState6[1];
|
|
97
|
+
var modalContext = useModalContext();
|
|
96
98
|
React__default.useEffect(function () {
|
|
97
99
|
setShouldShowClearButton(Boolean(defaultValue !== null && defaultValue !== void 0 ? defaultValue : value));
|
|
98
100
|
}, [defaultValue, value]);
|
|
@@ -255,7 +257,7 @@ var _SearchInput = function _SearchInput(_ref, ref) {
|
|
|
255
257
|
}, rest))
|
|
256
258
|
});
|
|
257
259
|
return /*#__PURE__*/jsx(TopNavOverlayThemeOverride, {
|
|
258
|
-
shouldOverrideTheme: isSearchFocused,
|
|
260
|
+
shouldOverrideTheme: modalContext.isInsideModal ? true : isSearchFocused,
|
|
259
261
|
children: searchContent
|
|
260
262
|
});
|
|
261
263
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchInput.js","sources":["../../../../../../../src/components/Input/SearchInput/SearchInput.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport type { ReactElement, ReactNode } from 'react';\nimport type { TextInput as TextInputReactNative } from 'react-native';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { getKeyboardAndAutocompleteProps } from '../BaseInput/utils';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport { CloseIcon, SearchIcon } from '~components/Icons';\nimport { IconButton } from '~components/Button/IconButton';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Spinner } from '~components/Spinner';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType } from '~utils';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport type {\n BladeElementRef,\n BladeElementRefWithValue,\n DataAnalyticsAttribute,\n} from '~utils/types';\nimport { dropdownComponentIds } from '~components/Dropdown/dropdownComponentIds';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\nimport { DropdownOverlay, InputDropdownButton } from '~components/Dropdown';\nimport { Divider } from '~components/Divider';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { TopNavOverlayThemeOverride } from '~components/TopNav/TopNavOverlayThemeOverride';\n\ntype SearchInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'labelSuffix'\n | 'labelTrailing'\n | 'helpText'\n | 'placeholder'\n | 'defaultValue'\n | 'name'\n | 'onChange'\n | 'onFocus'\n | 'onBlur'\n | 'value'\n | 'isDisabled'\n | 'autoFocus'\n | 'onSubmit'\n | 'autoCapitalize'\n | 'testID'\n | 'onClick'\n | 'size'\n | keyof DataAnalyticsAttribute\n> & {\n /**\n * Event handler to handle the onClick event for clear button.\n */\n onClearButtonClick?: () => void;\n\n /**\n * Decides whether to show a loading spinner for the input field.\n */\n isLoading?: boolean;\n /**\n * Toggle the visibility of the search icon.\n *\n * @default true\n */\n showSearchIcon?: boolean;\n /**\n * Optional trailing to be shown at the end of the input.\n */\n trailing?: React.ReactNode;\n} & StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype SearchInputPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype SearchInputPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype SearchInputProps = (SearchInputPropsWithA11yLabel | SearchInputPropsWithLabel) &\n SearchInputCommonProps;\n\n// need to do this to tell TS to infer type as SearchInput of React Native and make it believe that `ref.current.clear()` exists\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isReactNative = (_textInputRef?: any): _textInputRef is TextInputReactNative => {\n return getPlatformType() === 'react-native';\n};\n\nconst _SearchInput: React.ForwardRefRenderFunction<BladeElementRef, SearchInputProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition = 'top',\n placeholder,\n defaultValue,\n name,\n value,\n onChange,\n onClick,\n onFocus,\n onBlur,\n onSubmit,\n isDisabled,\n labelSuffix,\n labelTrailing,\n helpText,\n onClearButtonClick,\n isLoading,\n autoCapitalize,\n autoFocus,\n testID,\n size = 'medium',\n showSearchIcon = true,\n trailing,\n ...rest\n },\n ref,\n): ReactElement => {\n const textInputRef = React.useRef<BladeElementRefWithValue>(null);\n const mergedRef = useMergeRefs(ref, textInputRef);\n const [shouldShowClearButton, setShouldShowClearButton] = useState(false);\n const [isTrailingDropDownOpen, setIsTrailingDropDownOpen] = useState(false);\n const {\n triggererWrapperRef,\n onTriggerKeydown,\n onTriggerClick,\n dropdownTriggerer,\n close: closeParentDropDown,\n isOpen: isParentDropDownOpen,\n } = useDropdown();\n const isInsideDropdown = dropdownTriggerer === 'SearchInput';\n\n const [isSearchFocused, setIsSearchFocused] = useState(false);\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(defaultValue ?? value));\n }, [defaultValue, value]);\n\n useEffect(() => {\n if (isParentDropDownOpen && isTrailingDropDownOpen) {\n setIsTrailingDropDownOpen(false);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [closeParentDropDown, isParentDropDownOpen]);\n\n useEffect(() => {\n if (isTrailingDropDownOpen && isParentDropDownOpen) {\n closeParentDropDown();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [setIsTrailingDropDownOpen, isTrailingDropDownOpen]);\n\n const trailingDropdown =\n trailing && getComponentId(trailing as React.ReactElement) === 'Dropdown' ? trailing : null;\n\n const renderTrailingDropDown = (): React.ReactElement | null => {\n if (!trailingDropdown) {\n return null;\n }\n return React.cloneElement(trailingDropdown as React.ReactElement, {\n selectionType: 'single',\n isOpen: isTrailingDropDownOpen,\n height: '100%',\n onOpenChange: (isOpen: boolean) => {\n setIsTrailingDropDownOpen(isOpen);\n },\n children: React.Children.map(\n (trailingDropdown as React.ReactElement).props.children,\n (child) => {\n if (child.type === InputDropdownButton) {\n return React.cloneElement(child, {\n _isInsideSearchInput: true,\n size,\n });\n }\n if (child.type === DropdownOverlay) {\n return React.cloneElement(child, {\n referenceRef: triggererWrapperRef,\n _isNestedDropdown: true,\n defaultPlacement: 'bottom-end',\n });\n }\n return child;\n },\n ),\n });\n };\n\n const renderClearButton = (): React.ReactElement => {\n return (\n <IconButton\n size=\"medium\"\n icon={CloseIcon}\n onClick={() => {\n if (isEmpty(value) && textInputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (isReactNative(textInputRef.current)) {\n textInputRef.current.clear();\n textInputRef.current.focus();\n } else if (textInputRef.current instanceof HTMLInputElement) {\n textInputRef.current.value = '';\n textInputRef.current.focus();\n }\n }\n\n // if the input field is controlled just call the click handler and the value change shall be left upto the consumer\n onClearButtonClick?.();\n textInputRef?.current?.focus();\n setShouldShowClearButton(false);\n }}\n isDisabled={isDisabled}\n accessibilityLabel=\"Clear Input Content\"\n />\n );\n };\n\n const renderInteractionElement = (): ReactNode => {\n if (isLoading) {\n return <Spinner accessibilityLabel=\"Loading Content\" color=\"primary\" />;\n }\n\n if (shouldShowClearButton && trailingDropdown) {\n return (\n <BaseBox display=\"flex\" gap=\"spacing.3\">\n {renderClearButton()} <Divider orientation=\"vertical\" />\n </BaseBox>\n );\n }\n if (shouldShowClearButton) {\n return renderClearButton();\n }\n\n return null;\n };\n\n const searchContent = (\n <BaseBox position=\"relative\">\n <BaseInput\n id=\"searchinput\"\n componentName={MetaConstants.SearchInput}\n ref={mergedRef}\n isDropdownTrigger={true}\n setInputWrapperRef={\n isInsideDropdown || isTrailingDropDownOpen\n ? (wrapperNode) => {\n triggererWrapperRef.current = wrapperNode;\n }\n : undefined\n }\n label={label as string}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n labelSuffix={labelSuffix}\n labelTrailing={labelTrailing}\n placeholder={placeholder}\n defaultValue={defaultValue}\n value={value}\n name={name}\n onKeyDown={isInsideDropdown ? onTriggerKeydown : undefined}\n onChange={({ name, value }) => {\n if (value?.length) {\n // show the clear button when the user starts typing in\n setShouldShowClearButton(true);\n }\n\n if (shouldShowClearButton && !value?.length) {\n // hide the clear button when the input field is empty\n setShouldShowClearButton(false);\n }\n\n onChange?.({ name, value });\n }}\n onClick={(e) => {\n if (isDisabled) return;\n if (isInsideDropdown) {\n onTriggerClick();\n }\n onClick?.(e);\n }}\n onFocus={(e) => {\n setIsSearchFocused(true);\n onFocus?.(e);\n }}\n onBlur={(e) => {\n setIsSearchFocused(false);\n onBlur?.(e);\n }}\n onSubmit={onSubmit}\n isDisabled={isDisabled}\n leadingIcon={showSearchIcon ? SearchIcon : undefined}\n trailingInteractionElement={renderInteractionElement()}\n trailingDropDown={renderTrailingDropDown()}\n helpText={helpText}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n testID={testID}\n {...getKeyboardAndAutocompleteProps({\n type: 'search',\n autoCapitalize,\n })}\n size={size}\n {...rest}\n />\n </BaseBox>\n );\n\n return (\n <TopNavOverlayThemeOverride shouldOverrideTheme={isSearchFocused}>\n {searchContent}\n </TopNavOverlayThemeOverride>\n );\n};\n\nconst SearchInput = assignWithoutSideEffects(React.forwardRef(_SearchInput), {\n displayName: 'SearchInput',\n componentId: dropdownComponentIds.triggers.SearchInput,\n});\n\nexport type { SearchInputProps };\nexport { SearchInput };\n"],"names":["isReactNative","_textInputRef","getPlatformType","_SearchInput","_ref","ref","label","accessibilityLabel","_ref$labelPosition","labelPosition","placeholder","defaultValue","name","value","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","labelSuffix","labelTrailing","helpText","onClearButtonClick","isLoading","autoCapitalize","autoFocus","testID","_ref$size","size","_ref$showSearchIcon","showSearchIcon","trailing","rest","_objectWithoutProperties","_excluded","textInputRef","React","useRef","mergedRef","useMergeRefs","_useState","useState","_useState2","_slicedToArray","shouldShowClearButton","setShouldShowClearButton","_useState3","_useState4","isTrailingDropDownOpen","setIsTrailingDropDownOpen","_useDropdown","useDropdown","triggererWrapperRef","onTriggerKeydown","onTriggerClick","dropdownTriggerer","closeParentDropDown","close","isParentDropDownOpen","isOpen","isInsideDropdown","_useState5","_useState6","isSearchFocused","setIsSearchFocused","useEffect","Boolean","trailingDropdown","getComponentId","renderTrailingDropDown","cloneElement","selectionType","height","onOpenChange","children","Children","map","props","child","type","InputDropdownButton","_isInsideSearchInput","DropdownOverlay","referenceRef","_isNestedDropdown","defaultPlacement","renderClearButton","_jsx","IconButton","icon","CloseIcon","_textInputRef$current","isEmpty","current","clear","focus","HTMLInputElement","renderInteractionElement","Spinner","color","_jsxs","BaseBox","display","gap","Divider","orientation","searchContent","position","BaseInput","_objectSpread","id","componentName","MetaConstants","SearchInput","isDropdownTrigger","setInputWrapperRef","wrapperNode","undefined","hideLabelText","onKeyDown","_ref2","length","e","leadingIcon","SearchIcon","trailingInteractionElement","trailingDropDown","getKeyboardAndAutocompleteProps","TopNavOverlayThemeOverride","shouldOverrideTheme","assignWithoutSideEffects","forwardRef","displayName","componentId","dropdownComponentIds","triggers"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwGA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,aAAmB,EAA4C;AACpF,EAAA,OAAOC,eAAe,EAAE,KAAK,cAAc,CAAA;AAC7C,CAAC,CAAA;AAED,IAAMC,YAA+E,GAAG,SAAlFA,YAA+EA,CAAAC,IAAA,EA4BnFC,GAAG,EACc;AAAA,EAAA,IA3BfC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,kBAAkB,GAAAH,IAAA,CAAlBG,kBAAkB;IAAAC,kBAAA,GAAAJ,IAAA,CAClBK,aAAa;AAAbA,IAAAA,aAAa,GAAAD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A;AACV;AAAA;AACAI,MAAAA,SAAS,EAAEA,SAAU;AACrBC,MAAAA,MAAM,EAAEA,MAAAA;AAAO,KAAA,EACXqG,+BAA+B,CAAC;AAClChD,MAAAA,IAAI,EAAE,QAAQ;AACdvD,MAAAA,cAAc,EAAdA,cAAAA;AACF,KAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AACFI,MAAAA,IAAI,EAAEA,IAAAA;AAAK,KAAA,EACPI,IAAI,CACT,CAAA;AAAC,GACK,CACV,CAAA;EAED,oBACEuD,GAAA,CAACyC,0BAA0B,EAAA;AAACC,IAAAA,mBAAmB,EAAElE,eAAgB;AAAAW,IAAAA,QAAA,EAC9DgC,aAAAA;AAAa,GACY,CAAC,CAAA;AAEjC,CAAC,CAAA;AAEKO,IAAAA,WAAW,gBAAGiB,wBAAwB,cAAC9F,cAAK,CAAC+F,UAAU,CAACjI,YAAY,CAAC,EAAE;AAC3EkI,EAAAA,WAAW,EAAE,aAAa;AAC1BC,EAAAA,WAAW,EAAEC,oBAAoB,CAACC,QAAQ,CAACtB,WAAAA;AAC7C,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"SearchInput.js","sources":["../../../../../../../src/components/Input/SearchInput/SearchInput.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport type { ReactElement, ReactNode } from 'react';\nimport type { TextInput as TextInputReactNative } from 'react-native';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { getKeyboardAndAutocompleteProps } from '../BaseInput/utils';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport { CloseIcon, SearchIcon } from '~components/Icons';\nimport { IconButton } from '~components/Button/IconButton';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Spinner } from '~components/Spinner';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType } from '~utils';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport type {\n BladeElementRef,\n BladeElementRefWithValue,\n DataAnalyticsAttribute,\n} from '~utils/types';\nimport { dropdownComponentIds } from '~components/Dropdown/dropdownComponentIds';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\nimport { DropdownOverlay, InputDropdownButton } from '~components/Dropdown';\nimport { Divider } from '~components/Divider';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { TopNavOverlayThemeOverride } from '~components/TopNav/TopNavOverlayThemeOverride';\nimport { useModalContext } from '~components/Modal/ModalContext';\n\ntype SearchInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'labelSuffix'\n | 'labelTrailing'\n | 'helpText'\n | 'placeholder'\n | 'defaultValue'\n | 'name'\n | 'onChange'\n | 'onFocus'\n | 'onBlur'\n | 'value'\n | 'isDisabled'\n | 'autoFocus'\n | 'onSubmit'\n | 'autoCapitalize'\n | 'testID'\n | 'onClick'\n | 'size'\n | keyof DataAnalyticsAttribute\n> & {\n /**\n * Event handler to handle the onClick event for clear button.\n */\n onClearButtonClick?: () => void;\n\n /**\n * Decides whether to show a loading spinner for the input field.\n */\n isLoading?: boolean;\n /**\n * Toggle the visibility of the search icon.\n *\n * @default true\n */\n showSearchIcon?: boolean;\n /**\n * Optional trailing to be shown at the end of the input.\n */\n trailing?: React.ReactNode;\n} & StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype SearchInputPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype SearchInputPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype SearchInputProps = (SearchInputPropsWithA11yLabel | SearchInputPropsWithLabel) &\n SearchInputCommonProps;\n\n// need to do this to tell TS to infer type as SearchInput of React Native and make it believe that `ref.current.clear()` exists\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isReactNative = (_textInputRef?: any): _textInputRef is TextInputReactNative => {\n return getPlatformType() === 'react-native';\n};\n\nconst _SearchInput: React.ForwardRefRenderFunction<BladeElementRef, SearchInputProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition = 'top',\n placeholder,\n defaultValue,\n name,\n value,\n onChange,\n onClick,\n onFocus,\n onBlur,\n onSubmit,\n isDisabled,\n labelSuffix,\n labelTrailing,\n helpText,\n onClearButtonClick,\n isLoading,\n autoCapitalize,\n autoFocus,\n testID,\n size = 'medium',\n showSearchIcon = true,\n trailing,\n ...rest\n },\n ref,\n): ReactElement => {\n const textInputRef = React.useRef<BladeElementRefWithValue>(null);\n const mergedRef = useMergeRefs(ref, textInputRef);\n const [shouldShowClearButton, setShouldShowClearButton] = useState(false);\n const [isTrailingDropDownOpen, setIsTrailingDropDownOpen] = useState(false);\n const {\n triggererWrapperRef,\n onTriggerKeydown,\n onTriggerClick,\n dropdownTriggerer,\n close: closeParentDropDown,\n isOpen: isParentDropDownOpen,\n } = useDropdown();\n const isInsideDropdown = dropdownTriggerer === 'SearchInput';\n\n const [isSearchFocused, setIsSearchFocused] = useState(false);\n\n const modalContext = useModalContext();\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(defaultValue ?? value));\n }, [defaultValue, value]);\n\n useEffect(() => {\n if (isParentDropDownOpen && isTrailingDropDownOpen) {\n setIsTrailingDropDownOpen(false);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [closeParentDropDown, isParentDropDownOpen]);\n\n useEffect(() => {\n if (isTrailingDropDownOpen && isParentDropDownOpen) {\n closeParentDropDown();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [setIsTrailingDropDownOpen, isTrailingDropDownOpen]);\n\n const trailingDropdown =\n trailing && getComponentId(trailing as React.ReactElement) === 'Dropdown' ? trailing : null;\n\n const renderTrailingDropDown = (): React.ReactElement | null => {\n if (!trailingDropdown) {\n return null;\n }\n return React.cloneElement(trailingDropdown as React.ReactElement, {\n selectionType: 'single',\n isOpen: isTrailingDropDownOpen,\n height: '100%',\n onOpenChange: (isOpen: boolean) => {\n setIsTrailingDropDownOpen(isOpen);\n },\n children: React.Children.map(\n (trailingDropdown as React.ReactElement).props.children,\n (child) => {\n if (child.type === InputDropdownButton) {\n return React.cloneElement(child, {\n _isInsideSearchInput: true,\n size,\n });\n }\n if (child.type === DropdownOverlay) {\n return React.cloneElement(child, {\n referenceRef: triggererWrapperRef,\n _isNestedDropdown: true,\n defaultPlacement: 'bottom-end',\n });\n }\n return child;\n },\n ),\n });\n };\n\n const renderClearButton = (): React.ReactElement => {\n return (\n <IconButton\n size=\"medium\"\n icon={CloseIcon}\n onClick={() => {\n if (isEmpty(value) && textInputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (isReactNative(textInputRef.current)) {\n textInputRef.current.clear();\n textInputRef.current.focus();\n } else if (textInputRef.current instanceof HTMLInputElement) {\n textInputRef.current.value = '';\n textInputRef.current.focus();\n }\n }\n\n // if the input field is controlled just call the click handler and the value change shall be left upto the consumer\n onClearButtonClick?.();\n textInputRef?.current?.focus();\n setShouldShowClearButton(false);\n }}\n isDisabled={isDisabled}\n accessibilityLabel=\"Clear Input Content\"\n />\n );\n };\n\n const renderInteractionElement = (): ReactNode => {\n if (isLoading) {\n return <Spinner accessibilityLabel=\"Loading Content\" color=\"primary\" />;\n }\n\n if (shouldShowClearButton && trailingDropdown) {\n return (\n <BaseBox display=\"flex\" gap=\"spacing.3\">\n {renderClearButton()} <Divider orientation=\"vertical\" />\n </BaseBox>\n );\n }\n if (shouldShowClearButton) {\n return renderClearButton();\n }\n\n return null;\n };\n\n const searchContent = (\n <BaseBox position=\"relative\">\n <BaseInput\n id=\"searchinput\"\n componentName={MetaConstants.SearchInput}\n ref={mergedRef}\n isDropdownTrigger={true}\n setInputWrapperRef={\n isInsideDropdown || isTrailingDropDownOpen\n ? (wrapperNode) => {\n triggererWrapperRef.current = wrapperNode;\n }\n : undefined\n }\n label={label as string}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n labelSuffix={labelSuffix}\n labelTrailing={labelTrailing}\n placeholder={placeholder}\n defaultValue={defaultValue}\n value={value}\n name={name}\n onKeyDown={isInsideDropdown ? onTriggerKeydown : undefined}\n onChange={({ name, value }) => {\n if (value?.length) {\n // show the clear button when the user starts typing in\n setShouldShowClearButton(true);\n }\n\n if (shouldShowClearButton && !value?.length) {\n // hide the clear button when the input field is empty\n setShouldShowClearButton(false);\n }\n\n onChange?.({ name, value });\n }}\n onClick={(e) => {\n if (isDisabled) return;\n if (isInsideDropdown) {\n onTriggerClick();\n }\n onClick?.(e);\n }}\n onFocus={(e) => {\n setIsSearchFocused(true);\n onFocus?.(e);\n }}\n onBlur={(e) => {\n setIsSearchFocused(false);\n onBlur?.(e);\n }}\n onSubmit={onSubmit}\n isDisabled={isDisabled}\n leadingIcon={showSearchIcon ? SearchIcon : undefined}\n trailingInteractionElement={renderInteractionElement()}\n trailingDropDown={renderTrailingDropDown()}\n helpText={helpText}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n testID={testID}\n {...getKeyboardAndAutocompleteProps({\n type: 'search',\n autoCapitalize,\n })}\n size={size}\n {...rest}\n />\n </BaseBox>\n );\n\n return (\n <TopNavOverlayThemeOverride\n shouldOverrideTheme={modalContext.isInsideModal ? true : isSearchFocused}\n >\n {searchContent}\n </TopNavOverlayThemeOverride>\n );\n};\n\nconst SearchInput = assignWithoutSideEffects(React.forwardRef(_SearchInput), {\n displayName: 'SearchInput',\n componentId: dropdownComponentIds.triggers.SearchInput,\n});\n\nexport type { SearchInputProps };\nexport { SearchInput };\n"],"names":["isReactNative","_textInputRef","getPlatformType","_SearchInput","_ref","ref","label","accessibilityLabel","_ref$labelPosition","labelPosition","placeholder","defaultValue","name","value","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","labelSuffix","labelTrailing","helpText","onClearButtonClick","isLoading","autoCapitalize","autoFocus","testID","_ref$size","size","_ref$showSearchIcon","showSearchIcon","trailing","rest","_objectWithoutProperties","_excluded","textInputRef","React","useRef","mergedRef","useMergeRefs","_useState","useState","_useState2","_slicedToArray","shouldShowClearButton","setShouldShowClearButton","_useState3","_useState4","isTrailingDropDownOpen","setIsTrailingDropDownOpen","_useDropdown","useDropdown","triggererWrapperRef","onTriggerKeydown","onTriggerClick","dropdownTriggerer","closeParentDropDown","close","isParentDropDownOpen","isOpen","isInsideDropdown","_useState5","_useState6","isSearchFocused","setIsSearchFocused","modalContext","useModalContext","useEffect","Boolean","trailingDropdown","getComponentId","renderTrailingDropDown","cloneElement","selectionType","height","onOpenChange","children","Children","map","props","child","type","InputDropdownButton","_isInsideSearchInput","DropdownOverlay","referenceRef","_isNestedDropdown","defaultPlacement","renderClearButton","_jsx","IconButton","icon","CloseIcon","_textInputRef$current","isEmpty","current","clear","focus","HTMLInputElement","renderInteractionElement","Spinner","color","_jsxs","BaseBox","display","gap","Divider","orientation","searchContent","position","BaseInput","_objectSpread","id","componentName","MetaConstants","SearchInput","isDropdownTrigger","setInputWrapperRef","wrapperNode","undefined","hideLabelText","onKeyDown","_ref2","length","e","leadingIcon","SearchIcon","trailingInteractionElement","trailingDropDown","getKeyboardAndAutocompleteProps","TopNavOverlayThemeOverride","shouldOverrideTheme","isInsideModal","assignWithoutSideEffects","forwardRef","displayName","componentId","dropdownComponentIds","triggers"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyGA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,aAAmB,EAA4C;AACpF,EAAA,OAAOC,eAAe,EAAE,KAAK,cAAc,CAAA;AAC7C,CAAC,CAAA;AAED,IAAMC,YAA+E,GAAG,SAAlFA,YAA+EA,CAAAC,IAAA,EA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AA,QAAQ,EAAEA,QAAS;AACnBC,MAAAA,UAAU,EAAEA,UAAW;AACvB2G,MAAAA,WAAW,EAAE/F,cAAc,GAAGgG,UAAU,GAAGP,SAAU;MACrDQ,0BAA0B,EAAE5B,wBAAwB,EAAG;MACvD6B,gBAAgB,EAAEzD,sBAAsB,EAAG;AAC3ClD,MAAAA,QAAQ,EAAEA,QAAAA;AACV;AAAA;AACAI,MAAAA,SAAS,EAAEA,SAAU;AACrBC,MAAAA,MAAM,EAAEA,MAAAA;AAAO,KAAA,EACXuG,+BAA+B,CAAC;AAClChD,MAAAA,IAAI,EAAE,QAAQ;AACdzD,MAAAA,cAAc,EAAdA,cAAAA;AACF,KAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AACFI,MAAAA,IAAI,EAAEA,IAAAA;AAAK,KAAA,EACPI,IAAI,CACT,CAAA;AAAC,GACK,CACV,CAAA;EAED,oBACEyD,GAAA,CAACyC,0BAA0B,EAAA;AACzBC,IAAAA,mBAAmB,EAAElE,YAAY,CAACmE,aAAa,GAAG,IAAI,GAAGrE,eAAgB;AAAAa,IAAAA,QAAA,EAExEgC,aAAAA;AAAa,GACY,CAAC,CAAA;AAEjC,CAAC,CAAA;AAEKO,IAAAA,WAAW,gBAAGkB,wBAAwB,cAACjG,cAAK,CAACkG,UAAU,CAACpI,YAAY,CAAC,EAAE;AAC3EqI,EAAAA,WAAW,EAAE,aAAa;AAC1BC,EAAAA,WAAW,EAAEC,oBAAoB,CAACC,QAAQ,CAACvB,WAAAA;AAC7C,CAAC;;;;"}
|
|
@@ -34,9 +34,7 @@ var ListViewSurface = /*#__PURE__*/styled(BaseBox).withConfig({
|
|
|
34
34
|
position: 'relative',
|
|
35
35
|
flexDirection: 'column',
|
|
36
36
|
boxSizing: 'border-box'
|
|
37
|
-
}, getSurfaceStyles(theme, colorScheme, {
|
|
38
|
-
beforeGradientZIndex: 0
|
|
39
|
-
})), {}, {
|
|
37
|
+
}, getSurfaceStyles(theme, colorScheme)), {}, {
|
|
40
38
|
boxShadow: "".concat(elevation, ", ").concat(top),
|
|
41
39
|
borderLeft: "1px solid ".concat(borderColor),
|
|
42
40
|
borderRight: "1px solid ".concat(borderColor),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListView.web.js","sources":["../../../../../../src/components/ListView/ListView.web.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport type { ListViewProps } from './types';\nimport { ListViewProvider } from './ListViewContext';\nimport type { ColorSchemeNames } from '~tokens/theme';\nimport { getSurfaceBoxShadow, getSurfaceStyles } from '~utils/makeSurfaceStyles';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport { MetaConstants, metaAttribute } from '~utils/metaAttribute';\nimport BaseBox from '~components/Box/BaseBox';\nimport useTheme from '~components/BladeProvider/useTheme';\n\nconst ListViewSurface = styled(BaseBox)<{ colorScheme: ColorSchemeNames }>(\n ({ theme, colorScheme }) => {\n const isDarkMode = colorScheme === 'dark';\n const { elevation, top } = getSurfaceBoxShadow(theme, colorScheme);\n const borderColor = theme.colors.interactive.border.gray.disabled;\n\n return {\n width: '100%',\n display: 'flex',\n position: 'relative',\n flexDirection: 'column',\n boxSizing: 'border-box',\n ...getSurfaceStyles(theme, colorScheme
|
|
1
|
+
{"version":3,"file":"ListView.web.js","sources":["../../../../../../src/components/ListView/ListView.web.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport type { ListViewProps } from './types';\nimport { ListViewProvider } from './ListViewContext';\nimport type { ColorSchemeNames } from '~tokens/theme';\nimport { getSurfaceBoxShadow, getSurfaceStyles } from '~utils/makeSurfaceStyles';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport { MetaConstants, metaAttribute } from '~utils/metaAttribute';\nimport BaseBox from '~components/Box/BaseBox';\nimport useTheme from '~components/BladeProvider/useTheme';\n\nconst ListViewSurface = styled(BaseBox)<{ colorScheme: ColorSchemeNames }>(\n ({ theme, colorScheme }) => {\n const isDarkMode = colorScheme === 'dark';\n const { elevation, top } = getSurfaceBoxShadow(theme, colorScheme);\n const borderColor = theme.colors.interactive.border.gray.disabled;\n\n return {\n width: '100%',\n display: 'flex',\n position: 'relative',\n flexDirection: 'column',\n boxSizing: 'border-box',\n ...getSurfaceStyles(theme, colorScheme),\n boxShadow: `${elevation}, ${top}`,\n borderLeft: `1px solid ${borderColor}`,\n borderRight: `1px solid ${borderColor}`,\n borderBottom: `1px solid ${borderColor}`,\n ...(!isDarkMode && {\n borderTop: `1px solid ${borderColor}`,\n }),\n };\n },\n);\n\nconst ListView = ({ testID, children, ...rest }: ListViewProps): React.ReactElement => {\n const { colorScheme } = useTheme();\n return (\n <ListViewProvider value={{ isInsideListView: true }}>\n <ListViewSurface\n colorScheme={colorScheme}\n borderRadius=\"medium\"\n overflow=\"hidden\"\n backgroundColor=\"surface.background.gray.intense\"\n {...metaAttribute({ name: MetaConstants.ListView, testID })}\n {...makeAnalyticsAttribute(rest)}\n >\n {children}\n </ListViewSurface>\n </ListViewProvider>\n );\n};\n\nexport { ListView };\n"],"names":["ListViewSurface","styled","BaseBox","withConfig","displayName","componentId","_ref","theme","colorScheme","isDarkMode","_getSurfaceBoxShadow","getSurfaceBoxShadow","elevation","top","borderColor","colors","interactive","border","gray","disabled","_objectSpread","width","display","position","flexDirection","boxSizing","getSurfaceStyles","boxShadow","concat","borderLeft","borderRight","borderBottom","borderTop","ListView","_ref2","testID","children","rest","_objectWithoutProperties","_excluded","_useTheme","useTheme","_jsx","ListViewProvider","value","isInsideListView","borderRadius","overflow","backgroundColor","metaAttribute","name","MetaConstants","makeAnalyticsAttribute"],"mappings":";;;;;;;;;;;;;;;;;;;AAUA,IAAMA,eAAe,gBAAGC,MAAM,CAACC,OAAO,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,8BAAA;EAAAC,WAAA,EAAA,aAAA;AAAA,CACrC,CAAA,CAAA,UAAAC,IAAA,EAA4B;AAAA,EAAA,IAAzBC,KAAK,GAAAD,IAAA,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;AAAKC,IAAAA,IAAI,GAAAC,wBAAA,CAAAJ,KAAA,EAAAK,SAAA,CAAA,CAAA;AAC3C,EAAA,IAAAC,SAAA,GAAwBC,QAAQ,EAAE;IAA1BjC,WAAW,GAAAgC,SAAA,CAAXhC,WAAW,CAAA;EACnB,oBACEkC,GAAA,CAACC,gBAAgB,EAAA;AAACC,IAAAA,KAAK,EAAE;AAAEC,MAAAA,gBAAgB,EAAE,IAAA;KAAO;IAAAT,QAAA,eAClDM,GAAA,CAAC1C,eAAe,EAAAoB,aAAA,CAAAA,aAAA,CAAAA,aAAA,CAAA;AACdZ,MAAAA,WAAW,EAAEA,WAAY;AACzBsC,MAAAA,YAAY,EAAC,QAAQ;AACrBC,MAAAA,QAAQ,EAAC,QAAQ;AACjBC,MAAAA,eAAe,EAAC,iCAAA;AAAiC,KAAA,EAC7CC,aAAa,CAAC;MAAEC,IAAI,EAAEC,aAAa,CAAClB,QAAQ;AAAEE,MAAAA,MAAM,EAANA,MAAAA;AAAO,KAAC,CAAC,CAAA,EACvDiB,sBAAsB,CAACf,IAAI,CAAC,CAAA,EAAA,EAAA,EAAA;AAAAD,MAAAA,QAAA,EAE/BA,QAAAA;KACc,CAAA,CAAA;AAAC,GACF,CAAC,CAAA;AAEvB;;;;"}
|
|
@@ -71,7 +71,6 @@ var ListViewFilters = function ListViewFilters(_ref) {
|
|
|
71
71
|
selectedFiltersCount: selectedFiltersCount
|
|
72
72
|
},
|
|
73
73
|
children: /*#__PURE__*/jsxs(BaseBox, {
|
|
74
|
-
backgroundColor: "surface.background.gray.intense",
|
|
75
74
|
paddingX: "spacing.3",
|
|
76
75
|
paddingTop: "spacing.3",
|
|
77
76
|
paddingBottom: children ? 'spacing.0' : 'spacing.3',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListViewFilters.web.js","sources":["../../../../../../src/components/ListView/ListViewFilters.web.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport styled from 'styled-components';\nimport type { ListViewFilterProps, ListViewSelectedFiltersType } from './types';\nimport { ListViewFiltersProvider } from './ListViewFiltersContext.web';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport BaseBox from '~components/Box/BaseBox';\nimport { MetaConstants, metaAttribute } from '~utils/metaAttribute';\nimport { Box } from '~components/Box';\nimport { SearchInput } from '~components/Input/SearchInput';\nimport { useId } from '~utils/useId';\nimport { useIsMobile } from '~utils/useIsMobile';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\n\nconst StyledQuickFilterContainer = styled(BaseBox)({\n /* For Webkit (Chrome, Safari) */\n '::-webkit-scrollbar': {\n display: 'none',\n },\n /* For Firefox */\n scrollbarWidth: 'none',\n /* For Edge */\n msOverflowStyle: 'none',\n});\n\nconst ListViewFilters = ({\n testID,\n children,\n quickFilters,\n onSearchChange,\n searchValue,\n searchValuePlaceholder,\n searchName,\n showQuickFilters,\n onShowQuickFiltersChange,\n showFilters: showFiltersProp,\n onShowFiltersChange,\n onSearchClear,\n selectedFiltersCount = 0,\n searchTrailing,\n actions,\n ...rest\n}: ListViewFilterProps): React.ReactElement => {\n const [\n listViewSelectedFilters,\n setListViewSelectedFilters,\n ] = useState<ListViewSelectedFiltersType>({});\n const searchId = useId('search-input');\n const searchNameValue = searchName || searchId;\n const isMobile = useIsMobile();\n const showSearchInput = onSearchChange || onSearchClear || searchValuePlaceholder || searchName;\n const isSearchTrailingDropDown =\n React.isValidElement(searchTrailing) && getComponentId(searchTrailing) === 'Dropdown';\n\n return (\n <ListViewFiltersProvider\n value={{\n listViewSelectedFilters,\n setListViewSelectedFilters,\n selectedFiltersCount,\n }}\n >\n <BaseBox\n backgroundColor=\"surface.background.gray.intense\"\n paddingX=\"spacing.3\"\n paddingTop=\"spacing.3\"\n paddingBottom={children ? 'spacing.0' : 'spacing.3'}\n borderBottomWidth=\"thin\"\n borderBottomColor=\"surface.border.gray.muted\"\n borderBottomStyle=\"solid\"\n >\n {isMobile && showSearchInput && (\n <SearchInput\n label=\"\"\n value={searchValue}\n placeholder={searchValuePlaceholder}\n name={searchNameValue || searchId}\n onChange={({ name, value }) => onSearchChange?.({ name, value })}\n onClearButtonClick={onSearchClear}\n trailing={searchTrailing}\n />\n )}\n <BaseBox>\n <BaseBox\n {...metaAttribute({ name: MetaConstants.ListViewFilter, testID })}\n {...makeAnalyticsAttribute(rest)}\n display=\"flex\"\n justifyContent=\"space-between\"\n >\n <Box\n position=\"relative\"\n display=\"flex\"\n flexDirection=\"column\"\n marginRight=\"spacing.3\"\n flex=\"1\"\n minWidth=\"0px\"\n >\n <StyledQuickFilterContainer\n overflow=\"scroll\"\n width=\"100%\"\n paddingTop={isMobile ? 'spacing.4' : 'spacing.1'}\n paddingBottom=\"spacing.1\"\n paddingLeft=\"spacing.1\"\n >\n {quickFilters}\n </StyledQuickFilterContainer>\n </Box>\n\n <BaseBox display=\"flex\" alignItems=\"center\" flexShrink=\"0\">\n {!isMobile && showSearchInput && (\n <Box width={isSearchTrailingDropDown ? '280px' : '208px'}>\n <SearchInput\n label=\"\"\n value={searchValue}\n placeholder={searchValuePlaceholder}\n name={searchNameValue || searchId}\n onChange={({ name, value }) => onSearchChange?.({ name, value })}\n onClearButtonClick={onSearchClear}\n size=\"medium\"\n trailing={searchTrailing}\n />\n </Box>\n )}\n {actions}\n </BaseBox>\n </BaseBox>\n <BaseBox display=\"flex\">{children}</BaseBox>\n </BaseBox>\n </BaseBox>\n </ListViewFiltersProvider>\n );\n};\n\nexport { ListViewFilters };\n"],"names":["StyledQuickFilterContainer","styled","BaseBox","withConfig","displayName","componentId","display","scrollbarWidth","msOverflowStyle","ListViewFilters","_ref","testID","children","quickFilters","onSearchChange","searchValue","searchValuePlaceholder","searchName","showQuickFilters","onShowQuickFiltersChange","showFiltersProp","showFilters","onShowFiltersChange","onSearchClear","_ref$selectedFiltersC","selectedFiltersCount","searchTrailing","actions","rest","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","listViewSelectedFilters","setListViewSelectedFilters","searchId","useId","searchNameValue","isMobile","useIsMobile","showSearchInput","isSearchTrailingDropDown","React","isValidElement","getComponentId","_jsx","ListViewFiltersProvider","value","_jsxs","backgroundColor","paddingX","paddingTop","paddingBottom","borderBottomWidth","borderBottomColor","borderBottomStyle","SearchInput","label","placeholder","name","onChange","_ref2","onClearButtonClick","trailing","_objectSpread","metaAttribute","MetaConstants","ListViewFilter","makeAnalyticsAttribute","justifyContent","Box","position","flexDirection","marginRight","flex","minWidth","overflow","width","paddingLeft","alignItems","flexShrink","_ref3","size"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,IAAMA,0BAA0B,gBAAGC,MAAM,CAACC,OAAO,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,gDAAA;EAAAC,WAAA,EAAA,UAAA;AAAA,CAAC,CAAA,CAAA;AACjD;AACA,EAAA,qBAAqB,EAAE;AACrBC,IAAAA,OAAO,EAAE,MAAA;GACV;AACD;AACAC,EAAAA,cAAc,EAAE,MAAM;AACtB;AACAC,EAAAA,eAAe,EAAE,MAAA;AACnB,CAAC,CAAC,CAAA;AAEF,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,CAAAC,IAAA,EAiB0B;AAAA,EAAA,IAhB7CC,MAAM,GAAAD,IAAA,CAANC,MAAM;IACNC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,YAAY,GAAAH,IAAA,CAAZG,YAAY;IACZC,cAAc,GAAAJ,IAAA,CAAdI,cAAc;IACdC,WAAW,GAAAL,IAAA,CAAXK,WAAW;IACXC,sBAAsB,GAAAN,IAAA,CAAtBM,sBAAsB;IACtBC,UAAU,GAAAP,IAAA,CAAVO,UAAU;IACVC,gBAAgB,GAAAR,IAAA,CAAhBQ,gBAAgB;IAChBC,wBAAwB,GAAAT,IAAA,CAAxBS,wBAAwB;IACXC,eAAe,GAAAV,IAAA,CAA5BW,WAAW;IACXC,mBAAmB,GAAAZ,IAAA,CAAnBY,mBAAmB;IACnBC,aAAa,G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AAAkC,KAAA,CAALlC,KAAK,CAAA;AAAA,kBAAA,OAAOnC,cAAc,KAAA,IAAA,IAAdA,cAAc,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAdA,cAAc,CAAG;AAAE+C,oBAAAA,IAAI,EAAJA,IAAI;AAAEZ,oBAAAA,KAAK,EAALA,KAAAA;AAAM,mBAAC,CAAC,CAAA;iBAAC;AACjEe,gBAAAA,kBAAkB,EAAEzC,aAAc;AAClC6D,gBAAAA,IAAI,EAAC,QAAQ;AACbnB,gBAAAA,QAAQ,EAAEvC,cAAAA;eACX,CAAA;aACE,CACN,EACAC,OAAO,CAAA;AAAA,WACD,CAAC,CAAA;AAAA,SAAA,CACH,CAAC,eACVoB,GAAA,CAAC7C,OAAO,EAAA;AAACI,UAAAA,OAAO,EAAC,MAAM;AAAAM,UAAAA,QAAA,EAAEA,QAAAA;AAAQ,SAAU,CAAC,CAAA;AAAA,OACrC,CAAC,CAAA;KACH,CAAA;AAAC,GACa,CAAC,CAAA;AAE9B;;;;"}
|
|
1
|
+
{"version":3,"file":"ListViewFilters.web.js","sources":["../../../../../../src/components/ListView/ListViewFilters.web.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport styled from 'styled-components';\nimport type { ListViewFilterProps, ListViewSelectedFiltersType } from './types';\nimport { ListViewFiltersProvider } from './ListViewFiltersContext.web';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport BaseBox from '~components/Box/BaseBox';\nimport { MetaConstants, metaAttribute } from '~utils/metaAttribute';\nimport { Box } from '~components/Box';\nimport { SearchInput } from '~components/Input/SearchInput';\nimport { useId } from '~utils/useId';\nimport { useIsMobile } from '~utils/useIsMobile';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\n\nconst StyledQuickFilterContainer = styled(BaseBox)({\n /* For Webkit (Chrome, Safari) */\n '::-webkit-scrollbar': {\n display: 'none',\n },\n /* For Firefox */\n scrollbarWidth: 'none',\n /* For Edge */\n msOverflowStyle: 'none',\n});\n\nconst ListViewFilters = ({\n testID,\n children,\n quickFilters,\n onSearchChange,\n searchValue,\n searchValuePlaceholder,\n searchName,\n showQuickFilters,\n onShowQuickFiltersChange,\n showFilters: showFiltersProp,\n onShowFiltersChange,\n onSearchClear,\n selectedFiltersCount = 0,\n searchTrailing,\n actions,\n ...rest\n}: ListViewFilterProps): React.ReactElement => {\n const [\n listViewSelectedFilters,\n setListViewSelectedFilters,\n ] = useState<ListViewSelectedFiltersType>({});\n const searchId = useId('search-input');\n const searchNameValue = searchName || searchId;\n const isMobile = useIsMobile();\n const showSearchInput = onSearchChange || onSearchClear || searchValuePlaceholder || searchName;\n const isSearchTrailingDropDown =\n React.isValidElement(searchTrailing) && getComponentId(searchTrailing) === 'Dropdown';\n\n return (\n <ListViewFiltersProvider\n value={{\n listViewSelectedFilters,\n setListViewSelectedFilters,\n selectedFiltersCount,\n }}\n >\n <BaseBox\n paddingX=\"spacing.3\"\n paddingTop=\"spacing.3\"\n paddingBottom={children ? 'spacing.0' : 'spacing.3'}\n borderBottomWidth=\"thin\"\n borderBottomColor=\"surface.border.gray.muted\"\n borderBottomStyle=\"solid\"\n >\n {isMobile && showSearchInput && (\n <SearchInput\n label=\"\"\n value={searchValue}\n placeholder={searchValuePlaceholder}\n name={searchNameValue || searchId}\n onChange={({ name, value }) => onSearchChange?.({ name, value })}\n onClearButtonClick={onSearchClear}\n trailing={searchTrailing}\n />\n )}\n <BaseBox>\n <BaseBox\n {...metaAttribute({ name: MetaConstants.ListViewFilter, testID })}\n {...makeAnalyticsAttribute(rest)}\n display=\"flex\"\n justifyContent=\"space-between\"\n >\n <Box\n position=\"relative\"\n display=\"flex\"\n flexDirection=\"column\"\n marginRight=\"spacing.3\"\n flex=\"1\"\n minWidth=\"0px\"\n >\n <StyledQuickFilterContainer\n overflow=\"scroll\"\n width=\"100%\"\n paddingTop={isMobile ? 'spacing.4' : 'spacing.1'}\n paddingBottom=\"spacing.1\"\n paddingLeft=\"spacing.1\"\n >\n {quickFilters}\n </StyledQuickFilterContainer>\n </Box>\n\n <BaseBox display=\"flex\" alignItems=\"center\" flexShrink=\"0\">\n {!isMobile && showSearchInput && (\n <Box width={isSearchTrailingDropDown ? '280px' : '208px'}>\n <SearchInput\n label=\"\"\n value={searchValue}\n placeholder={searchValuePlaceholder}\n name={searchNameValue || searchId}\n onChange={({ name, value }) => onSearchChange?.({ name, value })}\n onClearButtonClick={onSearchClear}\n size=\"medium\"\n trailing={searchTrailing}\n />\n </Box>\n )}\n {actions}\n </BaseBox>\n </BaseBox>\n <BaseBox display=\"flex\">{children}</BaseBox>\n </BaseBox>\n </BaseBox>\n </ListViewFiltersProvider>\n );\n};\n\nexport { ListViewFilters };\n"],"names":["StyledQuickFilterContainer","styled","BaseBox","withConfig","displayName","componentId","display","scrollbarWidth","msOverflowStyle","ListViewFilters","_ref","testID","children","quickFilters","onSearchChange","searchValue","searchValuePlaceholder","searchName","showQuickFilters","onShowQuickFiltersChange","showFiltersProp","showFilters","onShowFiltersChange","onSearchClear","_ref$selectedFiltersC","selectedFiltersCount","searchTrailing","actions","rest","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","listViewSelectedFilters","setListViewSelectedFilters","searchId","useId","searchNameValue","isMobile","useIsMobile","showSearchInput","isSearchTrailingDropDown","React","isValidElement","getComponentId","_jsx","ListViewFiltersProvider","value","_jsxs","paddingX","paddingTop","paddingBottom","borderBottomWidth","borderBottomColor","borderBottomStyle","SearchInput","label","placeholder","name","onChange","_ref2","onClearButtonClick","trailing","_objectSpread","metaAttribute","MetaConstants","ListViewFilter","makeAnalyticsAttribute","justifyContent","Box","position","flexDirection","marginRight","flex","minWidth","overflow","width","paddingLeft","alignItems","flexShrink","_ref3","size"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,IAAMA,0BAA0B,gBAAGC,MAAM,CAACC,OAAO,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,gDAAA;EAAAC,WAAA,EAAA,UAAA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AAA;AAAQ,SAAU,CAAC,CAAA;AAAA,OACrC,CAAC,CAAA;KACH,CAAA;AAAC,GACa,CAAC,CAAA;AAE9B;;;;"}
|
|
@@ -97,7 +97,8 @@ var Modal = function Modal(_ref2) {
|
|
|
97
97
|
close: onDismiss,
|
|
98
98
|
isDismissible: isDismissible,
|
|
99
99
|
defaultInitialFocusRef: defaultInitialFocusRef,
|
|
100
|
-
isVisible: isVisible
|
|
100
|
+
isVisible: isVisible,
|
|
101
|
+
isInsideModal: true
|
|
101
102
|
};
|
|
102
103
|
}, [isOpen, onDismiss, isDismissible, defaultInitialFocusRef, isVisible]);
|
|
103
104
|
var handleKeyDown = function handleKeyDown(event) {
|