@razorpay/blade 12.47.0 → 12.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lib/native/components/Input/TextInput/TextInput.js +1 -1
- package/build/lib/native/components/Input/TextInput/TextInput.js.map +1 -1
- package/build/lib/native/components/Input/TextInput/useFormattedInput.js +1 -1
- package/build/lib/native/components/Input/TextInput/useFormattedInput.js.map +1 -1
- package/build/lib/web/development/components/BottomSheet/BottomSheet.web.js +2 -1
- package/build/lib/web/development/components/BottomSheet/BottomSheet.web.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/BaseDatePicker.web.js +162 -113
- package/build/lib/web/development/components/DatePicker/BaseDatePicker.web.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/CalendarFooter.web.js +1 -1
- package/build/lib/web/development/components/DatePicker/CalendarFooter.web.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/DateInput.web.js +202 -147
- package/build/lib/web/development/components/DatePicker/DateInput.web.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/QuickSelection/PresetContext.js +122 -0
- package/build/lib/web/development/components/DatePicker/QuickSelection/PresetContext.js.map +1 -0
- package/build/lib/web/development/components/DatePicker/QuickSelection/PresetDropdown.web.js +46 -0
- package/build/lib/web/development/components/DatePicker/QuickSelection/PresetDropdown.web.js.map +1 -0
- package/build/lib/web/development/components/DatePicker/QuickSelection/PresetSideBar.web.js +19 -19
- package/build/lib/web/development/components/DatePicker/QuickSelection/PresetSideBar.web.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/QuickSelection/utils.js +9 -0
- package/build/lib/web/development/components/DatePicker/QuickSelection/utils.js.map +1 -0
- package/build/lib/web/development/components/DatePicker/usePopup.js +10 -2
- package/build/lib/web/development/components/DatePicker/usePopup.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/utils.js +419 -1
- package/build/lib/web/development/components/DatePicker/utils.js.map +1 -1
- package/build/lib/web/development/components/Input/TextInput/TextInput.js +3 -1
- package/build/lib/web/development/components/Input/TextInput/TextInput.js.map +1 -1
- package/build/lib/web/development/components/Input/TextInput/useFormattedInput.js +21 -0
- package/build/lib/web/development/components/Input/TextInput/useFormattedInput.js.map +1 -1
- package/build/lib/web/production/components/BottomSheet/BottomSheet.web.js +2 -1
- package/build/lib/web/production/components/BottomSheet/BottomSheet.web.js.map +1 -1
- package/build/lib/web/production/components/DatePicker/BaseDatePicker.web.js +162 -113
- package/build/lib/web/production/components/DatePicker/BaseDatePicker.web.js.map +1 -1
- package/build/lib/web/production/components/DatePicker/CalendarFooter.web.js +1 -1
- package/build/lib/web/production/components/DatePicker/CalendarFooter.web.js.map +1 -1
- package/build/lib/web/production/components/DatePicker/DateInput.web.js +202 -147
- package/build/lib/web/production/components/DatePicker/DateInput.web.js.map +1 -1
- package/build/lib/web/production/components/DatePicker/QuickSelection/PresetContext.js +122 -0
- package/build/lib/web/production/components/DatePicker/QuickSelection/PresetContext.js.map +1 -0
- package/build/lib/web/production/components/DatePicker/QuickSelection/PresetDropdown.web.js +46 -0
- package/build/lib/web/production/components/DatePicker/QuickSelection/PresetDropdown.web.js.map +1 -0
- package/build/lib/web/production/components/DatePicker/QuickSelection/PresetSideBar.web.js +19 -19
- package/build/lib/web/production/components/DatePicker/QuickSelection/PresetSideBar.web.js.map +1 -1
- package/build/lib/web/production/components/DatePicker/QuickSelection/utils.js +9 -0
- package/build/lib/web/production/components/DatePicker/QuickSelection/utils.js.map +1 -0
- package/build/lib/web/production/components/DatePicker/usePopup.js +10 -2
- package/build/lib/web/production/components/DatePicker/usePopup.js.map +1 -1
- package/build/lib/web/production/components/DatePicker/utils.js +419 -1
- package/build/lib/web/production/components/DatePicker/utils.js.map +1 -1
- package/build/lib/web/production/components/Input/TextInput/TextInput.js +3 -1
- package/build/lib/web/production/components/Input/TextInput/TextInput.js.map +1 -1
- package/build/lib/web/production/components/Input/TextInput/useFormattedInput.js +21 -0
- package/build/lib/web/production/components/Input/TextInput/useFormattedInput.js.map +1 -1
- package/build/types/components/index.d.ts +10 -5
- package/build/types/components/index.native.d.ts +10 -5
- package/package.json +1 -1
|
@@ -417,7 +417,7 @@ import '../../Dropdown/DropdownHeaderFooter.js';
|
|
|
417
417
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
418
418
|
import { isIconComponent } from '../../../utils/isIconComponent/isIconComponent.js';
|
|
419
419
|
|
|
420
|
-
var _excluded=["label","accessibilityLabel","labelPosition","placeholder","type","defaultValue","name","value","maxCharacters","format","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","necessityIndicator","validationState","errorText","helpText","successText","isRequired","icon","prefix","showClearButton","onClearButtonClick","isLoading","suffix","autoFocus","keyboardReturnKeyType","autoCompleteSuggestionType","autoCapitalize","testID","size","leadingIcon","trailingIcon","isTaggedInput","tags","onTagChange","trailing","leading","labelSuffix","labelTrailing"];var isReactNative=function isReactNative(_textInputRef){return getPlatformType()==='react-native';};var _TextInput=function _TextInput(_ref,ref){var _ref4;var label=_ref.label,accessibilityLabel=_ref.accessibilityLabel,_ref$labelPosition=_ref.labelPosition,labelPosition=_ref$labelPosition===void 0?'top':_ref$labelPosition,placeholder=_ref.placeholder,_ref$type=_ref.type,type=_ref$type===void 0?'text':_ref$type,defaultValue=_ref.defaultValue,name=_ref.name,value=_ref.value,maxCharacters=_ref.maxCharacters,format=_ref.format,onChange=_ref.onChange,onClick=_ref.onClick,_onFocus=_ref.onFocus,_onBlur=_ref.onBlur,onSubmit=_ref.onSubmit,isDisabled=_ref.isDisabled,necessityIndicator=_ref.necessityIndicator,validationState=_ref.validationState,errorText=_ref.errorText,helpText=_ref.helpText,successText=_ref.successText,isRequired=_ref.isRequired,icon=_ref.icon,prefix=_ref.prefix,showClearButton=_ref.showClearButton,onClearButtonClick=_ref.onClearButtonClick,isLoading=_ref.isLoading,suffix=_ref.suffix,autoFocus=_ref.autoFocus,keyboardReturnKeyType=_ref.keyboardReturnKeyType,autoCompleteSuggestionType=_ref.autoCompleteSuggestionType,autoCapitalize=_ref.autoCapitalize,testID=_ref.testID,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,leadingIcon=_ref.leadingIcon,trailingIcon=_ref.trailingIcon,isTaggedInput=_ref.isTaggedInput,tags=_ref.tags,onTagChange=_ref.onTagChange,trailing=_ref.trailing,leading=_ref.leading,labelSuffix=_ref.labelSuffix,labelTrailing=_ref.labelTrailing,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(autoFocus!=null?autoFocus:false),_useState4=_slicedToArray(_useState3,2),isInputFocussed=_useState4[0],setIsInputFocussed=_useState4[1];if(__DEV__){if(format){var hasAlphanumeric=/[a-zA-Z0-9]/.test(format);if(hasAlphanumeric){throw new Error(`[Blade: TextInput] Invalid format "${format}". Only # and special characters allowed, no letters/numbers.`);}}}var formattingResult=useFormattedInput({format:format,onChange:onChange,value:value,defaultValue:defaultValue});var inputValue=format?formattingResult.formattedValue:value;var effectiveMaxCharacters=format?formattingResult.maxLength:maxCharacters;var handleOnChange=React__default.useCallback(function(_ref2){var name=_ref2.name,inputValue=_ref2.value;if(format){formattingResult.handleChange({name:name,value:inputValue});}else {onChange==null?void 0:onChange({name:name,value:inputValue});}},[format,formattingResult.handleChange,onChange]);var _useTaggedInput=useTaggedInput({isTaggedInput:isTaggedInput,tags:tags,onTagChange:onTagChange,isDisabled:isDisabled,onChange:handleOnChange,name:name,value:inputValue,inputRef:textInputRef}),activeTagIndex=_useTaggedInput.activeTagIndex,setActiveTagIndex=_useTaggedInput.setActiveTagIndex,getTags=_useTaggedInput.getTags,handleTaggedInputKeydown=_useTaggedInput.handleTaggedInputKeydown,handleTaggedInputChange=_useTaggedInput.handleTaggedInputChange,handleTagsClear=_useTaggedInput.handleTagsClear;var _React$useState=React__default.useState(false),_React$useState2=_slicedToArray(_React$useState,2),isTrailingDropDownOpen=_React$useState2[0],setIsTrailingDropDownOpen=_React$useState2[1];var _React$useState3=React__default.useState(false),_React$useState4=_slicedToArray(_React$useState3,2),isLeadingDropDownOpen=_React$useState4[0],setIsLeadingDropDownOpen=_React$useState4[1];var textInputWrapperRef=useRef(null);useEffect(function(){if(isTrailingDropDownOpen&&isLeadingDropDownOpen){setIsLeadingDropDownOpen(false);}},[isTrailingDropDownOpen]);useEffect(function(){if(isLeadingDropDownOpen&&isTrailingDropDownOpen){setIsTrailingDropDownOpen(false);}},[isLeadingDropDownOpen]);var leadingDropDown=leading&&getComponentId(leading)==='Dropdown'?leading:null;var trailingDropdown=trailing&&getComponentId(trailing)==='Dropdown'?trailing:null;var _leadingIcon=isIconComponent(leading)?leading:undefined;var _trailingIcon=isIconComponent(trailing)?trailing:undefined;var hasLeadingInteractionElement=!_leadingIcon&&!leadingDropDown&&leading;var hasTrailingInteractionElement=!_trailingIcon&&!trailingDropdown&&trailing;var renderDropdown=function renderDropdown(dropdown,isOpen,setIsOpen,defaultPlacement){if(!dropdown){return null;}return React__default.cloneElement(dropdown,{selectionType:'single',isOpen:isOpen,onOpenChange:function onOpenChange(isOpen){setIsOpen(isOpen);},children:React__default.Children.map(dropdown.props.children,function(child){if(child.type===DropdownOverlay){return React__default.cloneElement(child,{referenceRef:textInputWrapperRef,_isNestedDropdown:true,defaultPlacement:defaultPlacement});}return child;})});};var renderLeadingDropDown=renderDropdown(leadingDropDown,isLeadingDropDownOpen,setIsLeadingDropDownOpen,'bottom-start');var renderTrailingDropDown=renderDropdown(trailingDropdown,isTrailingDropDownOpen,setIsTrailingDropDownOpen,'bottom-end');React__default.useEffect(function(){setShouldShowClearButton(Boolean(showClearButton&&(defaultValue!=null?defaultValue:inputValue)));},[showClearButton,defaultValue,inputValue]);var renderClearButton=function renderClearButton(){return jsx(IconButton,{size:"medium",icon:CloseIcon,onClick:function onClick(){var _textInputRef$current;if(isEmpty(inputValue)&&textInputRef.current){if(isReactNative(textInputRef.current)){textInputRef.current.clear();textInputRef.current.focus();}else if(textInputRef.current instanceof HTMLInputElement){textInputRef.current.value='';textInputRef.current.focus();}}handleTagsClear();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 hasTrailingDropDown=Boolean(trailingDropdown);var renderInteractionElement=function renderInteractionElement(){if(isLoading){return jsx(Spinner,{accessibilityLabel:"Loading Content",color:"primary"});}if(shouldShowClearButton&&hasTrailingDropDown){return jsxs(BaseBox,{display:"flex",gap:"spacing.3",children:[renderClearButton()," ",jsx(Divider,{orientation:"vertical"})]});}if(showClearButton&&hasTrailingInteractionElement){return jsxs(BaseBox,{display:"flex",gap:"spacing.3",children:[renderClearButton()," ",jsx(Divider,{orientation:"vertical"})," ",trailing]});}if(shouldShowClearButton){return renderClearButton();}if(hasTrailingInteractionElement){return trailing;}return null;};return jsx(BaseInput,Object.assign({id:"textinput",componentName:MetaConstants.TextInput,ref:mergedRef,setInputWrapperRef:function setInputWrapperRef(wrapperNode){textInputWrapperRef.current=wrapperNode;},label:label,labelSuffix:labelSuffix,labelTrailing:labelTrailing,accessibilityLabel:accessibilityLabel,hideLabelText:!Boolean(label),labelPosition:labelPosition,placeholder:placeholder,defaultValue:format?value!==undefined&&defaultValue!==undefined?defaultValue:undefined:defaultValue,value:format?inputValue:value,name:name,maxCharacters:effectiveMaxCharacters,isDropdownTrigger:isTaggedInput,tags:isTaggedInput?getTags({size:size}):undefined,showAllTags:isInputFocussed,maxTagRows:"single",activeTagIndex:activeTagIndex,setActiveTagIndex:setActiveTagIndex,leadingDropDown:renderLeadingDropDown,trailingDropDown:renderTrailingDropDown,leadingInteractionElement:hasLeadingInteractionElement?leading:null,onChange:function onChange(_ref3){var name=_ref3.name,value=_ref3.value;if(showClearButton&&value!=null&&value.length){setShouldShowClearButton(true);}if(shouldShowClearButton&&!(value!=null&&value.length)){setShouldShowClearButton(false);}handleTaggedInputChange({name:name,value:value});handleOnChange({name:name,value:value});},onClick:onClick,onFocus:function onFocus(e){setIsInputFocussed(true);_onFocus==null?void 0:_onFocus(e);},onBlur:function onBlur(e){setIsInputFocussed(false);_onBlur==null?void 0:_onBlur(e);},onKeyDown:function onKeyDown(e){handleTaggedInputKeydown(e);if(format){formattingResult.handleKeyDown(e.event);}},onSubmit:onSubmit,isDisabled:isDisabled,necessityIndicator:necessityIndicator,isRequired:isRequired,leadingIcon:(_ref4=_leadingIcon!=null?_leadingIcon:leadingIcon)!=null?_ref4:icon,prefix:prefix,trailingInteractionElement:renderInteractionElement(),trailingIcon:_trailingIcon!=null?_trailingIcon:trailingIcon,suffix:suffix,validationState:validationState,errorText:errorText,helpText:helpText,successText:successText,trailingFooterSlot:function trailingFooterSlot(value){var _value$length;return format?null:effectiveMaxCharacters?jsx(BaseBox,{marginTop:hintMarginTop[size],marginRight:"spacing.1",children:jsx(CharacterCounter,{currentCount:(_value$length=value==null?void 0:value.length)!=null?_value$length:0,maxCount:effectiveMaxCharacters,size:size})}):null;},autoFocus:autoFocus,testID:testID},getKeyboardAndAutocompleteProps({type:type,keyboardReturnKeyType:keyboardReturnKeyType,autoCompleteSuggestionType:autoCompleteSuggestionType,autoCapitalize:autoCapitalize}),{size:size},rest));};var TextInput=assignWithoutSideEffects(React__default.forwardRef(_TextInput),{displayName:'TextInput'});
|
|
420
|
+
var _excluded=["label","accessibilityLabel","labelPosition","placeholder","type","defaultValue","name","value","maxCharacters","format","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","necessityIndicator","validationState","errorText","helpText","successText","isRequired","icon","prefix","showClearButton","onClearButtonClick","isLoading","suffix","autoFocus","keyboardReturnKeyType","autoCompleteSuggestionType","autoCapitalize","testID","size","leadingIcon","trailingIcon","isTaggedInput","tags","onTagChange","trailing","leading","labelSuffix","labelTrailing","onKeyDown"];var isReactNative=function isReactNative(_textInputRef){return getPlatformType()==='react-native';};var _TextInput=function _TextInput(_ref,ref){var _ref4;var label=_ref.label,accessibilityLabel=_ref.accessibilityLabel,_ref$labelPosition=_ref.labelPosition,labelPosition=_ref$labelPosition===void 0?'top':_ref$labelPosition,placeholder=_ref.placeholder,_ref$type=_ref.type,type=_ref$type===void 0?'text':_ref$type,defaultValue=_ref.defaultValue,name=_ref.name,value=_ref.value,maxCharacters=_ref.maxCharacters,format=_ref.format,onChange=_ref.onChange,onClick=_ref.onClick,_onFocus=_ref.onFocus,_onBlur=_ref.onBlur,onSubmit=_ref.onSubmit,isDisabled=_ref.isDisabled,necessityIndicator=_ref.necessityIndicator,validationState=_ref.validationState,errorText=_ref.errorText,helpText=_ref.helpText,successText=_ref.successText,isRequired=_ref.isRequired,icon=_ref.icon,prefix=_ref.prefix,showClearButton=_ref.showClearButton,onClearButtonClick=_ref.onClearButtonClick,isLoading=_ref.isLoading,suffix=_ref.suffix,autoFocus=_ref.autoFocus,keyboardReturnKeyType=_ref.keyboardReturnKeyType,autoCompleteSuggestionType=_ref.autoCompleteSuggestionType,autoCapitalize=_ref.autoCapitalize,testID=_ref.testID,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,leadingIcon=_ref.leadingIcon,trailingIcon=_ref.trailingIcon,isTaggedInput=_ref.isTaggedInput,tags=_ref.tags,onTagChange=_ref.onTagChange,trailing=_ref.trailing,leading=_ref.leading,labelSuffix=_ref.labelSuffix,labelTrailing=_ref.labelTrailing,_onKeyDown=_ref.onKeyDown,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(autoFocus!=null?autoFocus:false),_useState4=_slicedToArray(_useState3,2),isInputFocussed=_useState4[0],setIsInputFocussed=_useState4[1];if(__DEV__){if(format){var hasAlphanumeric=/[a-zA-Z0-9]/.test(format);if(hasAlphanumeric){throw new Error(`[Blade: TextInput] Invalid format "${format}". Only # and special characters allowed, no letters/numbers.`);}}}var formattingResult=useFormattedInput({format:format,onChange:onChange,value:value,defaultValue:defaultValue});var inputValue=format?formattingResult.formattedValue:value;var effectiveMaxCharacters=format?formattingResult.maxLength:maxCharacters;var handleOnChange=React__default.useCallback(function(_ref2){var name=_ref2.name,inputValue=_ref2.value;if(format){formattingResult.handleChange({name:name,value:inputValue});}else {onChange==null?void 0:onChange({name:name,value:inputValue});}},[format,formattingResult.handleChange,onChange]);var _useTaggedInput=useTaggedInput({isTaggedInput:isTaggedInput,tags:tags,onTagChange:onTagChange,isDisabled:isDisabled,onChange:handleOnChange,name:name,value:inputValue,inputRef:textInputRef}),activeTagIndex=_useTaggedInput.activeTagIndex,setActiveTagIndex=_useTaggedInput.setActiveTagIndex,getTags=_useTaggedInput.getTags,handleTaggedInputKeydown=_useTaggedInput.handleTaggedInputKeydown,handleTaggedInputChange=_useTaggedInput.handleTaggedInputChange,handleTagsClear=_useTaggedInput.handleTagsClear;var _React$useState=React__default.useState(false),_React$useState2=_slicedToArray(_React$useState,2),isTrailingDropDownOpen=_React$useState2[0],setIsTrailingDropDownOpen=_React$useState2[1];var _React$useState3=React__default.useState(false),_React$useState4=_slicedToArray(_React$useState3,2),isLeadingDropDownOpen=_React$useState4[0],setIsLeadingDropDownOpen=_React$useState4[1];var textInputWrapperRef=useRef(null);useEffect(function(){if(isTrailingDropDownOpen&&isLeadingDropDownOpen){setIsLeadingDropDownOpen(false);}},[isTrailingDropDownOpen]);useEffect(function(){if(isLeadingDropDownOpen&&isTrailingDropDownOpen){setIsTrailingDropDownOpen(false);}},[isLeadingDropDownOpen]);var leadingDropDown=leading&&getComponentId(leading)==='Dropdown'?leading:null;var trailingDropdown=trailing&&getComponentId(trailing)==='Dropdown'?trailing:null;var _leadingIcon=isIconComponent(leading)?leading:undefined;var _trailingIcon=isIconComponent(trailing)?trailing:undefined;var hasLeadingInteractionElement=!_leadingIcon&&!leadingDropDown&&leading;var hasTrailingInteractionElement=!_trailingIcon&&!trailingDropdown&&trailing;var renderDropdown=function renderDropdown(dropdown,isOpen,setIsOpen,defaultPlacement){if(!dropdown){return null;}return React__default.cloneElement(dropdown,{selectionType:'single',isOpen:isOpen,onOpenChange:function onOpenChange(isOpen){setIsOpen(isOpen);},children:React__default.Children.map(dropdown.props.children,function(child){if(child.type===DropdownOverlay){return React__default.cloneElement(child,{referenceRef:textInputWrapperRef,_isNestedDropdown:true,defaultPlacement:defaultPlacement});}return child;})});};var renderLeadingDropDown=renderDropdown(leadingDropDown,isLeadingDropDownOpen,setIsLeadingDropDownOpen,'bottom-start');var renderTrailingDropDown=renderDropdown(trailingDropdown,isTrailingDropDownOpen,setIsTrailingDropDownOpen,'bottom-end');React__default.useEffect(function(){setShouldShowClearButton(Boolean(showClearButton&&(defaultValue!=null?defaultValue:inputValue)));},[showClearButton,defaultValue,inputValue]);var renderClearButton=function renderClearButton(){return jsx(IconButton,{size:"medium",icon:CloseIcon,onClick:function onClick(){var _textInputRef$current;if(isEmpty(inputValue)&&textInputRef.current){if(isReactNative(textInputRef.current)){textInputRef.current.clear();textInputRef.current.focus();}else if(textInputRef.current instanceof HTMLInputElement){textInputRef.current.value='';textInputRef.current.focus();}}handleTagsClear();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 hasTrailingDropDown=Boolean(trailingDropdown);var renderInteractionElement=function renderInteractionElement(){if(isLoading){return jsx(Spinner,{accessibilityLabel:"Loading Content",color:"primary"});}if(shouldShowClearButton&&hasTrailingDropDown){return jsxs(BaseBox,{display:"flex",gap:"spacing.3",children:[renderClearButton()," ",jsx(Divider,{orientation:"vertical"})]});}if(showClearButton&&hasTrailingInteractionElement){return jsxs(BaseBox,{display:"flex",gap:"spacing.3",children:[renderClearButton()," ",jsx(Divider,{orientation:"vertical"})," ",trailing]});}if(shouldShowClearButton){return renderClearButton();}if(hasTrailingInteractionElement){return trailing;}return null;};return jsx(BaseInput,Object.assign({id:"textinput",componentName:MetaConstants.TextInput,ref:mergedRef,setInputWrapperRef:function setInputWrapperRef(wrapperNode){textInputWrapperRef.current=wrapperNode;},label:label,labelSuffix:labelSuffix,labelTrailing:labelTrailing,accessibilityLabel:accessibilityLabel,hideLabelText:!Boolean(label),labelPosition:labelPosition,placeholder:placeholder,defaultValue:format?value!==undefined&&defaultValue!==undefined?defaultValue:undefined:defaultValue,value:format?inputValue:value,name:name,maxCharacters:effectiveMaxCharacters,isDropdownTrigger:isTaggedInput,tags:isTaggedInput?getTags({size:size}):undefined,showAllTags:isInputFocussed,maxTagRows:"single",activeTagIndex:activeTagIndex,setActiveTagIndex:setActiveTagIndex,leadingDropDown:renderLeadingDropDown,trailingDropDown:renderTrailingDropDown,leadingInteractionElement:hasLeadingInteractionElement?leading:null,onChange:function onChange(_ref3){var name=_ref3.name,value=_ref3.value;if(showClearButton&&value!=null&&value.length){setShouldShowClearButton(true);}if(shouldShowClearButton&&!(value!=null&&value.length)){setShouldShowClearButton(false);}handleTaggedInputChange({name:name,value:value});handleOnChange({name:name,value:value});},onClick:onClick,onFocus:function onFocus(e){setIsInputFocussed(true);_onFocus==null?void 0:_onFocus(e);},onBlur:function onBlur(e){setIsInputFocussed(false);_onBlur==null?void 0:_onBlur(e);},onKeyDown:function onKeyDown(e){handleTaggedInputKeydown(e);_onKeyDown==null?void 0:_onKeyDown(e);if(format){formattingResult.handleKeyDown(e.event);}},onSubmit:onSubmit,isDisabled:isDisabled,necessityIndicator:necessityIndicator,isRequired:isRequired,leadingIcon:(_ref4=_leadingIcon!=null?_leadingIcon:leadingIcon)!=null?_ref4:icon,prefix:prefix,trailingInteractionElement:renderInteractionElement(),trailingIcon:_trailingIcon!=null?_trailingIcon:trailingIcon,suffix:suffix,validationState:validationState,errorText:errorText,helpText:helpText,successText:successText,trailingFooterSlot:function trailingFooterSlot(value){var _value$length;return format?null:effectiveMaxCharacters?jsx(BaseBox,{marginTop:hintMarginTop[size],marginRight:"spacing.1",children:jsx(CharacterCounter,{currentCount:(_value$length=value==null?void 0:value.length)!=null?_value$length:0,maxCount:effectiveMaxCharacters,size:size})}):null;},autoFocus:autoFocus,testID:testID},getKeyboardAndAutocompleteProps({type:type,keyboardReturnKeyType:keyboardReturnKeyType,autoCompleteSuggestionType:autoCompleteSuggestionType,autoCapitalize:autoCapitalize}),{size:size},rest));};var TextInput=assignWithoutSideEffects(React__default.forwardRef(_TextInput),{displayName:'TextInput'});
|
|
421
421
|
|
|
422
422
|
export { TextInput };
|
|
423
423
|
//# sourceMappingURL=TextInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.js","sources":["../../../../../../src/components/Input/TextInput/TextInput.tsx"],"sourcesContent":["import React, { useEffect, useState, useRef } from 'react';\nimport type { ReactElement, ReactNode } from 'react';\nimport type { TextInput as TextInputReactNative } from 'react-native';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { getKeyboardAndAutocompleteProps } from '../BaseInput/utils';\nimport type { TaggedInputProps } from '../BaseInput/useTaggedInput';\nimport { useTaggedInput } from '../BaseInput/useTaggedInput';\nimport { useFormattedInput } from './useFormattedInput';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport type { IconComponent } from '~components/Icons';\nimport { CloseIcon } from '~components/Icons';\nimport { IconButton } from '~components/Button/IconButton';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport { CharacterCounter } from '~components/Form/CharacterCounter';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Spinner } from '~components/Spinner';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType } from '~utils';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport type {\n BladeElementRef,\n BladeElementRefWithValue,\n ContainerElementType,\n DataAnalyticsAttribute,\n} from '~utils/types';\nimport { hintMarginTop } from '~components/Form/formTokens';\nimport { Divider } from '~components/Divider';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { DropdownOverlay } from '~components/Dropdown';\nimport type { FormInputOnEvent } from '~components/Form/FormTypes';\nimport { isIconComponent } from '~utils/isIconComponent';\n\n// Users should use PasswordInput for input type password\ntype Type = Exclude<BaseInputProps['type'], 'password'>;\n\ntype TextInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'labelSuffix'\n | 'labelTrailing'\n | 'necessityIndicator'\n | 'validationState'\n | 'helpText'\n | 'errorText'\n | 'successText'\n | 'placeholder'\n | 'defaultValue'\n | 'name'\n | 'onChange'\n | 'onFocus'\n | 'onBlur'\n | 'value'\n | 'isDisabled'\n | 'isRequired'\n | 'prefix'\n | 'suffix'\n | 'maxCharacters'\n | 'autoFocus'\n | 'keyboardReturnKeyType'\n | 'autoCompleteSuggestionType'\n | 'onSubmit'\n | 'autoCapitalize'\n | 'testID'\n | 'onClick'\n | 'size'\n | 'leadingIcon'\n | 'trailingButton'\n | 'trailingIcon'\n | 'textAlign'\n | keyof DataAnalyticsAttribute\n> & {\n /**\n * Decides whether to render a clear icon button\n */\n showClearButton?: boolean;\n\n /**\n * Event handler to handle the onClick event for clear button. Used when `showClearButton` is `true`\n */\n onClearButtonClick?: () => void;\n\n /**\n * Decides whether to show a loading spinner for the input field.\n */\n isLoading?: boolean;\n\n /**\n * Icon that will be rendered at the beginning of the input field\n * @deprecated Use `leading` instead. This prop will be removed in the next major version.\n */\n icon?: IconComponent;\n /**\n * Type of Input Field to be rendered. Use `PasswordInput` for type `password`\n *\n *\n * **Note on number type**\n *\n * `type=\"number\"` internally uses `inputMode=\"numeric\"` instead of HTML's `type=\"number\"` which also allows text characters.\n * If you have a usecase where you only want to support number input, you can handle it on validations end.\n *\n * Check out [Why the GOV.UK Design System team changed the input type for numbers](https://technology.blog.gov.uk/2020/02/24/why-the-gov-uk-design-system-team-changed-the-input-type-for-numbers/) for reasoning\n *\n * @default text\n */\n type?: Type;\n /**\n *\n * Icon or React Element to be rendered at the end of the input field\n */\n trailing?: React.ReactElement | IconComponent;\n /**\n * Icon or React Element to be rendered at the beginning of the input field\n */\n leading?: React.ReactElement | IconComponent;\n /**\n * Format pattern where # represents input characters and other symbols act as delimiters\n * When provided, input will be automatically formatted and onChange will include rawValue\n *\n * **Note:**\n * 1. Format pattern should only contain # symbols and special characters as delimiters.\n * Alphanumeric characters (letters and numbers) are not allowed in the format pattern.\n * 2. When format is provided, user input is restricted to alphanumeric characters only.\n * Special characters and symbols will be filtered out automatically from user input.\n *\n * @example \"#### #### #### ####\" for card numbers\n * @example \"##/##\" for expiry dates\n * @example \"(###) ###-####\" for phone numbers\n */\n format?:\n | '#### #### #### ####'\n | '##/##'\n | '##/##/####'\n | '(###) ###-####'\n | '###-##-####'\n | '##:##'\n | '##:##:##'\n | '#### #### ####'\n | '###.###.###.###'\n | '## ## ####'\n | '##-###-##'\n // eslint-disable-next-line @typescript-eslint/ban-types\n | (string & {});\n} & TaggedInputProps &\n StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype TextInputPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype TextInputPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype TextInputProps = (TextInputPropsWithA11yLabel | TextInputPropsWithLabel) &\n TextInputCommonProps;\n\n// need to do this to tell TS to infer type as TextInput of React Native and make it believe that `ref.current.clear()` exists\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isReactNative = (_textInputRef: any): _textInputRef is TextInputReactNative => {\n return getPlatformType() === 'react-native';\n};\n\nconst _TextInput: React.ForwardRefRenderFunction<BladeElementRef, TextInputProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition = 'top',\n placeholder,\n type = 'text',\n defaultValue,\n name,\n value,\n maxCharacters,\n format,\n onChange,\n onClick,\n onFocus,\n onBlur,\n onSubmit,\n isDisabled,\n necessityIndicator,\n validationState,\n errorText,\n helpText,\n successText,\n isRequired,\n icon,\n prefix,\n showClearButton,\n onClearButtonClick,\n isLoading,\n suffix,\n autoFocus,\n keyboardReturnKeyType,\n autoCompleteSuggestionType,\n autoCapitalize,\n testID,\n size = 'medium',\n leadingIcon,\n trailingIcon,\n isTaggedInput,\n tags,\n onTagChange,\n trailing,\n leading,\n labelSuffix,\n labelTrailing,\n ...rest\n },\n ref,\n): ReactElement => {\n const textInputRef = React.useRef<BladeElementRefWithValue>(null);\n const mergedRef = useMergeRefs(ref, textInputRef);\n const [shouldShowClearButton, setShouldShowClearButton] = useState(false);\n const [isInputFocussed, setIsInputFocussed] = useState(autoFocus ?? false);\n\n if (__DEV__) {\n if (format) {\n const hasAlphanumeric = /[a-zA-Z0-9]/.test(format);\n if (hasAlphanumeric) {\n throw new Error(\n `[Blade: TextInput] Invalid format \"${format}\". Only # and special characters allowed, no letters/numbers.`,\n );\n }\n }\n }\n\n const formattingResult = useFormattedInput({\n format,\n onChange,\n value,\n defaultValue,\n });\n\n const inputValue = format ? formattingResult.formattedValue : value;\n const effectiveMaxCharacters = format ? formattingResult.maxLength : maxCharacters;\n\n const handleOnChange: FormInputOnEvent = React.useCallback(\n ({ name, value: inputValue }) => {\n if (format) {\n formattingResult.handleChange({ name, value: inputValue });\n } else {\n onChange?.({ name, value: inputValue });\n }\n },\n [format, formattingResult.handleChange, onChange],\n );\n\n const {\n activeTagIndex,\n setActiveTagIndex,\n getTags,\n handleTaggedInputKeydown,\n handleTaggedInputChange,\n handleTagsClear,\n } = useTaggedInput({\n isTaggedInput,\n tags,\n onTagChange,\n isDisabled,\n onChange: handleOnChange,\n name,\n value: inputValue,\n inputRef: textInputRef,\n });\n const [isTrailingDropDownOpen, setIsTrailingDropDownOpen] = React.useState(false);\n const [isLeadingDropDownOpen, setIsLeadingDropDownOpen] = React.useState(false);\n const textInputWrapperRef = useRef<ContainerElementType | null>(null);\n\n useEffect(() => {\n if (isTrailingDropDownOpen && isLeadingDropDownOpen) {\n setIsLeadingDropDownOpen(false);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isTrailingDropDownOpen]);\n\n useEffect(() => {\n if (isLeadingDropDownOpen && isTrailingDropDownOpen) {\n setIsTrailingDropDownOpen(false);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isLeadingDropDownOpen]);\n\n const leadingDropDown =\n leading && getComponentId(leading as React.ReactElement) === 'Dropdown' ? leading : null;\n\n const trailingDropdown =\n trailing && getComponentId(trailing as React.ReactElement) === 'Dropdown' ? trailing : null;\n // we need to look into name of component and check if it 's and icon or a dropdown\n const _leadingIcon: IconComponent | undefined = isIconComponent(leading)\n ? (leading as IconComponent)\n : undefined;\n\n const _trailingIcon: IconComponent | undefined = isIconComponent(trailing)\n ? (trailing as IconComponent)\n : undefined;\n const hasLeadingInteractionElement = !_leadingIcon && !leadingDropDown && leading;\n\n const hasTrailingInteractionElement = !_trailingIcon && !trailingDropdown && trailing;\n\n const renderDropdown = (\n dropdown: React.ReactElement,\n isOpen: boolean,\n setIsOpen: (isOpen: boolean) => void,\n defaultPlacement: 'bottom-start' | 'bottom-end',\n ): React.ReactElement | null => {\n if (!dropdown) {\n return null;\n }\n return React.cloneElement(dropdown, {\n selectionType: 'single',\n isOpen,\n onOpenChange: (isOpen: boolean) => {\n setIsOpen(isOpen);\n },\n children: React.Children.map(dropdown.props.children, (child) => {\n if (child.type === DropdownOverlay) {\n return React.cloneElement(child, {\n referenceRef: textInputWrapperRef,\n _isNestedDropdown: true,\n defaultPlacement,\n });\n }\n return child;\n }),\n });\n };\n\n const renderLeadingDropDown = renderDropdown(\n leadingDropDown as React.ReactElement,\n isLeadingDropDownOpen,\n setIsLeadingDropDownOpen,\n 'bottom-start',\n );\n const renderTrailingDropDown = renderDropdown(\n trailingDropdown as React.ReactElement,\n isTrailingDropDownOpen,\n setIsTrailingDropDownOpen,\n 'bottom-end',\n );\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(showClearButton && (defaultValue ?? inputValue)));\n }, [showClearButton, defaultValue, inputValue]);\n\n const renderClearButton = (): React.ReactElement => {\n return (\n <IconButton\n size=\"medium\"\n icon={CloseIcon}\n onClick={() => {\n if (isEmpty(inputValue) && textInputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (isReactNative(textInputRef.current)) {\n textInputRef.current.clear();\n textInputRef.current.focus();\n } else if (textInputRef.current instanceof HTMLInputElement) {\n textInputRef.current.value = '';\n textInputRef.current.focus();\n }\n }\n handleTagsClear();\n // if the input field is controlled just call the click handler and the value change shall be left upto the consumer\n onClearButtonClick?.();\n textInputRef?.current?.focus();\n setShouldShowClearButton(false);\n }}\n isDisabled={isDisabled}\n accessibilityLabel=\"Clear Input Content\"\n />\n );\n };\n const hasTrailingDropDown = Boolean(trailingDropdown);\n\n const renderInteractionElement = (): ReactNode => {\n if (isLoading) {\n return <Spinner accessibilityLabel=\"Loading Content\" color=\"primary\" />;\n }\n\n if (shouldShowClearButton && hasTrailingDropDown) {\n return (\n <BaseBox display=\"flex\" gap=\"spacing.3\">\n {renderClearButton()} <Divider orientation=\"vertical\" />\n </BaseBox>\n );\n }\n\n if (showClearButton && hasTrailingInteractionElement) {\n return (\n <BaseBox display=\"flex\" gap=\"spacing.3\">\n {renderClearButton()} <Divider orientation=\"vertical\" /> {trailing as React.ReactElement}\n </BaseBox>\n );\n }\n\n if (shouldShowClearButton) {\n return renderClearButton();\n }\n\n if (hasTrailingInteractionElement) {\n return trailing as React.ReactElement;\n }\n return null;\n };\n return (\n <BaseInput\n id=\"textinput\"\n componentName={MetaConstants.TextInput}\n ref={mergedRef}\n setInputWrapperRef={(wrapperNode) => {\n textInputWrapperRef.current = wrapperNode;\n }}\n label={label as string}\n labelSuffix={labelSuffix}\n labelTrailing={labelTrailing}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n placeholder={placeholder}\n // CONTROLLED/UNCONTROLLED INPUT LOGIC:\n // For inputs WITHOUT format:\n // - Use standard React controlled/uncontrolled logic\n // - Controlled: user provides `value` prop → use `value` prop\n // - Uncontrolled: user provides `defaultValue` prop → use `defaultValue` prop\n //\n // For inputs WITH format:\n // - Formatting requires controlled mode to re-render and show formatted values\n // - Case 1: Only `value` provided → defaultValue: undefined, value: formattedValue (normal controlled)\n // - Case 2: Only `defaultValue` provided → defaultValue: undefined, value: formattedValue (convert to controlled)\n // - Case 3: Both `value` and `defaultValue` provided → defaultValue: defaultValue, value: formattedValue (let BaseInput detect conflict and throw error)\n //\n defaultValue={\n format\n ? value !== undefined && defaultValue !== undefined\n ? defaultValue\n : undefined\n : defaultValue\n }\n value={format ? inputValue : value}\n name={name}\n maxCharacters={effectiveMaxCharacters}\n isDropdownTrigger={isTaggedInput}\n tags={isTaggedInput ? getTags({ size }) : undefined}\n showAllTags={isInputFocussed}\n maxTagRows=\"single\"\n activeTagIndex={activeTagIndex}\n setActiveTagIndex={setActiveTagIndex}\n leadingDropDown={renderLeadingDropDown}\n trailingDropDown={renderTrailingDropDown}\n leadingInteractionElement={\n hasLeadingInteractionElement ? (leading as React.ReactElement) : null\n }\n onChange={({ name, value }: { name?: string; value?: string }) => {\n if (showClearButton && value?.length) {\n // show the clear button when the user starts typing in\n setShouldShowClearButton(true);\n }\n\n if (shouldShowClearButton && !value?.length) {\n // hide the clear button when the input field is empty\n setShouldShowClearButton(false);\n }\n\n handleTaggedInputChange({ name, value });\n handleOnChange({ name, value });\n }}\n onClick={onClick}\n onFocus={(e) => {\n setIsInputFocussed(true);\n onFocus?.(e);\n }}\n onBlur={(e) => {\n setIsInputFocussed(false);\n onBlur?.(e);\n }}\n onKeyDown={(e) => {\n handleTaggedInputKeydown(e);\n if (format) {\n formattingResult.handleKeyDown(e.event);\n }\n }}\n onSubmit={onSubmit}\n isDisabled={isDisabled}\n necessityIndicator={necessityIndicator}\n isRequired={isRequired}\n leadingIcon={_leadingIcon ?? leadingIcon ?? icon}\n prefix={prefix}\n trailingInteractionElement={renderInteractionElement()}\n trailingIcon={_trailingIcon ?? trailingIcon}\n suffix={suffix}\n validationState={validationState}\n errorText={errorText}\n helpText={helpText}\n successText={successText}\n trailingFooterSlot={(value) => {\n return format ? null : effectiveMaxCharacters ? (\n <BaseBox marginTop={hintMarginTop[size]} marginRight=\"spacing.1\">\n <CharacterCounter\n currentCount={value?.length ?? 0}\n maxCount={effectiveMaxCharacters}\n size={size}\n />\n </BaseBox>\n ) : null;\n }}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n testID={testID}\n {...getKeyboardAndAutocompleteProps({\n type,\n keyboardReturnKeyType,\n autoCompleteSuggestionType,\n autoCapitalize,\n })}\n size={size}\n {...rest}\n />\n );\n};\n\nconst TextInput = assignWithoutSideEffects(React.forwardRef(_TextInput), {\n displayName: 'TextInput',\n});\n\nexport type { TextInputProps };\nexport { TextInput };\n"],"names":["isReactNative","_textInputRef","getPlatformType","_TextInput","_ref","ref","_ref4","label","accessibilityLabel","_ref$labelPosition","labelPosition","placeholder","_ref$type","type","defaultValue","name","value","maxCharacters","format","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","necessityIndicator","validationState","errorText","helpText","successText","isRequired","icon","prefix","showClearButton","onClearButtonClick","isLoading","suffix","autoFocus","keyboardReturnKeyType","autoCompleteSuggestionType","autoCapitalize","testID","_ref$size","size","leadingIcon","trailingIcon","isTaggedInput","tags","onTagChange","trailing","leading","labelSuffix","labelTrailing","rest","_objectWithoutProperties","_excluded","textInputRef","React","useRef","mergedRef","useMergeRefs","_useState","useState","_useState2","_slicedToArray","shouldShowClearButton","setShouldShowClearButton","_useState3","_useState4","isInputFocussed","setIsInputFocussed","__DEV__","hasAlphanumeric","test","Error","formattingResult","useFormattedInput","inputValue","formattedValue","effectiveMaxCharacters","maxLength","handleOnChange","useCallback","_ref2","handleChange","_useTaggedInput","useTaggedInput","inputRef","activeTagIndex","setActiveTagIndex","getTags","handleTaggedInputKeydown","handleTaggedInputChange","handleTagsClear","_React$useState","_React$useState2","isTrailingDropDownOpen","setIsTrailingDropDownOpen","_React$useState3","_React$useState4","isLeadingDropDownOpen","setIsLeadingDropDownOpen","textInputWrapperRef","useEffect","leadingDropDown","getComponentId","trailingDropdown","_leadingIcon","isIconComponent","undefined","_trailingIcon","hasLeadingInteractionElement","hasTrailingInteractionElement","renderDropdown","dropdown","isOpen","setIsOpen","defaultPlacement","cloneElement","selectionType","onOpenChange","children","Children","map","props","child","DropdownOverlay","referenceRef","_isNestedDropdown","renderLeadingDropDown","renderTrailingDropDown","Boolean","renderClearButton","_jsx","IconButton","CloseIcon","_textInputRef$current","isEmpty","current","clear","focus","HTMLInputElement","hasTrailingDropDown","renderInteractionElement","Spinner","color","_jsxs","BaseBox","display","gap","Divider","orientation","BaseInput","Object","assign","id","componentName","MetaConstants","TextInput","setInputWrapperRef","wrapperNode","hideLabelText","isDropdownTrigger","showAllTags","maxTagRows","trailingDropDown","leadingInteractionElement","_ref3","length","e","onKeyDown","handleKeyDown","event","trailingInteractionElement","trailingFooterSlot","_value$length","marginTop","hintMarginTop","marginRight","CharacterCounter","currentCount","maxCount","getKeyboardAndAutocompleteProps","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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A,CAALA,KAAK,CAAEwJ,MAAM,GAAA,IAAA,CAAAO,aAAA,CAAI,CAAE,CACjCM,QAAQ,CAAEtG,sBAAuB,CACjCpC,IAAI,CAAEA,IAAK,CACZ,CAAC,CACK,CAAC,CACR,IAAI,CACV,CAAE,CAEFN,SAAS,CAAEA,SAAU,CACrBI,MAAM,CAAEA,MAAO,CAAA,CACX6I,+BAA+B,CAAC,CAClCzK,IAAI,CAAJA,IAAI,CACJyB,qBAAqB,CAArBA,qBAAqB,CACrBC,0BAA0B,CAA1BA,0BAA0B,CAC1BC,cAAc,CAAdA,cACF,CAAC,CAAC,CACFG,CAAAA,IAAI,CAAEA,IAAK,EACPU,IAAI,CACT,CAAC,CAEN,CAAC,CAEK,IAAAyG,SAAS,CAAGyB,wBAAwB,CAAC9H,cAAK,CAAC+H,UAAU,CAACrL,UAAU,CAAC,CAAE,CACvEsL,WAAW,CAAE,WACf,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"TextInput.js","sources":["../../../../../../src/components/Input/TextInput/TextInput.tsx"],"sourcesContent":["import React, { useEffect, useState, useRef } from 'react';\nimport type { ReactElement, ReactNode } from 'react';\nimport type { TextInput as TextInputReactNative } from 'react-native';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { getKeyboardAndAutocompleteProps } from '../BaseInput/utils';\nimport type { TaggedInputProps } from '../BaseInput/useTaggedInput';\nimport { useTaggedInput } from '../BaseInput/useTaggedInput';\nimport { useFormattedInput } from './useFormattedInput';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport type { IconComponent } from '~components/Icons';\nimport { CloseIcon } from '~components/Icons';\nimport { IconButton } from '~components/Button/IconButton';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport { CharacterCounter } from '~components/Form/CharacterCounter';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Spinner } from '~components/Spinner';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType } from '~utils';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport type {\n BladeElementRef,\n BladeElementRefWithValue,\n ContainerElementType,\n DataAnalyticsAttribute,\n} from '~utils/types';\nimport { hintMarginTop } from '~components/Form/formTokens';\nimport { Divider } from '~components/Divider';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { DropdownOverlay } from '~components/Dropdown';\nimport type { FormInputOnEvent } from '~components/Form/FormTypes';\nimport { isIconComponent } from '~utils/isIconComponent';\n\n// Users should use PasswordInput for input type password\ntype Type = Exclude<BaseInputProps['type'], 'password'>;\n\ntype TextInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'labelSuffix'\n | 'labelTrailing'\n | 'necessityIndicator'\n | 'validationState'\n | 'helpText'\n | 'errorText'\n | 'successText'\n | 'placeholder'\n | 'defaultValue'\n | 'name'\n | 'onChange'\n | 'onFocus'\n | 'onBlur'\n | 'value'\n | 'isDisabled'\n | 'isRequired'\n | 'prefix'\n | 'suffix'\n | 'maxCharacters'\n | 'autoFocus'\n | 'keyboardReturnKeyType'\n | 'autoCompleteSuggestionType'\n | 'onSubmit'\n | 'autoCapitalize'\n | 'testID'\n | 'onClick'\n | 'size'\n | 'leadingIcon'\n | 'trailingButton'\n | 'trailingIcon'\n | 'textAlign'\n | 'popupId'\n | 'isPopupExpanded'\n | 'hasPopup'\n | 'componentName'\n | 'onKeyDown'\n | keyof DataAnalyticsAttribute\n> & {\n /**\n * Decides whether to render a clear icon button\n */\n showClearButton?: boolean;\n\n /**\n * Event handler to handle the onClick event for clear button. Used when `showClearButton` is `true`\n */\n onClearButtonClick?: () => void;\n\n /**\n * Decides whether to show a loading spinner for the input field.\n */\n isLoading?: boolean;\n\n /**\n * Icon that will be rendered at the beginning of the input field\n * @deprecated Use `leading` instead. This prop will be removed in the next major version.\n */\n icon?: IconComponent;\n /**\n * Type of Input Field to be rendered. Use `PasswordInput` for type `password`\n *\n *\n * **Note on number type**\n *\n * `type=\"number\"` internally uses `inputMode=\"numeric\"` instead of HTML's `type=\"number\"` which also allows text characters.\n * If you have a usecase where you only want to support number input, you can handle it on validations end.\n *\n * Check out [Why the GOV.UK Design System team changed the input type for numbers](https://technology.blog.gov.uk/2020/02/24/why-the-gov-uk-design-system-team-changed-the-input-type-for-numbers/) for reasoning\n *\n * @default text\n */\n type?: Type;\n /**\n *\n * Icon or React Element to be rendered at the end of the input field\n */\n trailing?: React.ReactElement | IconComponent;\n /**\n * Icon or React Element to be rendered at the beginning of the input field\n */\n leading?: React.ReactElement | IconComponent;\n /**\n * Format pattern where # represents input characters and other symbols act as delimiters\n * When provided, input will be automatically formatted and onChange will include rawValue\n *\n * **Note:**\n * 1. Format pattern should only contain # symbols and special characters as delimiters.\n * Alphanumeric characters (letters and numbers) are not allowed in the format pattern.\n * 2. When format is provided, user input is restricted to alphanumeric characters only.\n * Special characters and symbols will be filtered out automatically from user input.\n *\n * @example \"#### #### #### ####\" for card numbers\n * @example \"##/##\" for expiry dates\n * @example \"(###) ###-####\" for phone numbers\n */\n format?:\n | '#### #### #### ####'\n | '##/##'\n | '##/##/####'\n | '(###) ###-####'\n | '###-##-####'\n | '##:##'\n | '##:##:##'\n | '#### #### ####'\n | '###.###.###.###'\n | '## ## ####'\n | '##-###-##'\n // eslint-disable-next-line @typescript-eslint/ban-types\n | (string & {});\n} & TaggedInputProps &\n StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype TextInputPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype TextInputPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype TextInputProps = (TextInputPropsWithA11yLabel | TextInputPropsWithLabel) &\n TextInputCommonProps;\n\n// need to do this to tell TS to infer type as TextInput of React Native and make it believe that `ref.current.clear()` exists\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isReactNative = (_textInputRef: any): _textInputRef is TextInputReactNative => {\n return getPlatformType() === 'react-native';\n};\n\nconst _TextInput: React.ForwardRefRenderFunction<BladeElementRef, TextInputProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition = 'top',\n placeholder,\n type = 'text',\n defaultValue,\n name,\n value,\n maxCharacters,\n format,\n onChange,\n onClick,\n onFocus,\n onBlur,\n onSubmit,\n isDisabled,\n necessityIndicator,\n validationState,\n errorText,\n helpText,\n successText,\n isRequired,\n icon,\n prefix,\n showClearButton,\n onClearButtonClick,\n isLoading,\n suffix,\n autoFocus,\n keyboardReturnKeyType,\n autoCompleteSuggestionType,\n autoCapitalize,\n testID,\n size = 'medium',\n leadingIcon,\n trailingIcon,\n isTaggedInput,\n tags,\n onTagChange,\n trailing,\n leading,\n labelSuffix,\n labelTrailing,\n onKeyDown,\n ...rest\n },\n ref,\n): ReactElement => {\n const textInputRef = React.useRef<BladeElementRefWithValue>(null);\n const mergedRef = useMergeRefs(ref, textInputRef);\n const [shouldShowClearButton, setShouldShowClearButton] = useState(false);\n const [isInputFocussed, setIsInputFocussed] = useState(autoFocus ?? false);\n\n if (__DEV__) {\n if (format) {\n const hasAlphanumeric = /[a-zA-Z0-9]/.test(format);\n if (hasAlphanumeric) {\n throw new Error(\n `[Blade: TextInput] Invalid format \"${format}\". Only # and special characters allowed, no letters/numbers.`,\n );\n }\n }\n }\n\n const formattingResult = useFormattedInput({\n format,\n onChange,\n value,\n defaultValue,\n });\n\n const inputValue = format ? formattingResult.formattedValue : value;\n const effectiveMaxCharacters = format ? formattingResult.maxLength : maxCharacters;\n\n const handleOnChange: FormInputOnEvent = React.useCallback(\n ({ name, value: inputValue }) => {\n if (format) {\n formattingResult.handleChange({ name, value: inputValue });\n } else {\n onChange?.({ name, value: inputValue });\n }\n },\n [format, formattingResult.handleChange, onChange],\n );\n\n const {\n activeTagIndex,\n setActiveTagIndex,\n getTags,\n handleTaggedInputKeydown,\n handleTaggedInputChange,\n handleTagsClear,\n } = useTaggedInput({\n isTaggedInput,\n tags,\n onTagChange,\n isDisabled,\n onChange: handleOnChange,\n name,\n value: inputValue,\n inputRef: textInputRef,\n });\n const [isTrailingDropDownOpen, setIsTrailingDropDownOpen] = React.useState(false);\n const [isLeadingDropDownOpen, setIsLeadingDropDownOpen] = React.useState(false);\n const textInputWrapperRef = useRef<ContainerElementType | null>(null);\n\n useEffect(() => {\n if (isTrailingDropDownOpen && isLeadingDropDownOpen) {\n setIsLeadingDropDownOpen(false);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isTrailingDropDownOpen]);\n\n useEffect(() => {\n if (isLeadingDropDownOpen && isTrailingDropDownOpen) {\n setIsTrailingDropDownOpen(false);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isLeadingDropDownOpen]);\n\n const leadingDropDown =\n leading && getComponentId(leading as React.ReactElement) === 'Dropdown' ? leading : null;\n\n const trailingDropdown =\n trailing && getComponentId(trailing as React.ReactElement) === 'Dropdown' ? trailing : null;\n // we need to look into name of component and check if it 's and icon or a dropdown\n const _leadingIcon: IconComponent | undefined = isIconComponent(leading)\n ? (leading as IconComponent)\n : undefined;\n\n const _trailingIcon: IconComponent | undefined = isIconComponent(trailing)\n ? (trailing as IconComponent)\n : undefined;\n const hasLeadingInteractionElement = !_leadingIcon && !leadingDropDown && leading;\n\n const hasTrailingInteractionElement = !_trailingIcon && !trailingDropdown && trailing;\n\n const renderDropdown = (\n dropdown: React.ReactElement,\n isOpen: boolean,\n setIsOpen: (isOpen: boolean) => void,\n defaultPlacement: 'bottom-start' | 'bottom-end',\n ): React.ReactElement | null => {\n if (!dropdown) {\n return null;\n }\n return React.cloneElement(dropdown, {\n selectionType: 'single',\n isOpen,\n onOpenChange: (isOpen: boolean) => {\n setIsOpen(isOpen);\n },\n children: React.Children.map(dropdown.props.children, (child) => {\n if (child.type === DropdownOverlay) {\n return React.cloneElement(child, {\n referenceRef: textInputWrapperRef,\n _isNestedDropdown: true,\n defaultPlacement,\n });\n }\n return child;\n }),\n });\n };\n\n const renderLeadingDropDown = renderDropdown(\n leadingDropDown as React.ReactElement,\n isLeadingDropDownOpen,\n setIsLeadingDropDownOpen,\n 'bottom-start',\n );\n const renderTrailingDropDown = renderDropdown(\n trailingDropdown as React.ReactElement,\n isTrailingDropDownOpen,\n setIsTrailingDropDownOpen,\n 'bottom-end',\n );\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(showClearButton && (defaultValue ?? inputValue)));\n }, [showClearButton, defaultValue, inputValue]);\n\n const renderClearButton = (): React.ReactElement => {\n return (\n <IconButton\n size=\"medium\"\n icon={CloseIcon}\n onClick={() => {\n if (isEmpty(inputValue) && textInputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (isReactNative(textInputRef.current)) {\n textInputRef.current.clear();\n textInputRef.current.focus();\n } else if (textInputRef.current instanceof HTMLInputElement) {\n textInputRef.current.value = '';\n textInputRef.current.focus();\n }\n }\n handleTagsClear();\n // if the input field is controlled just call the click handler and the value change shall be left upto the consumer\n onClearButtonClick?.();\n textInputRef?.current?.focus();\n setShouldShowClearButton(false);\n }}\n isDisabled={isDisabled}\n accessibilityLabel=\"Clear Input Content\"\n />\n );\n };\n const hasTrailingDropDown = Boolean(trailingDropdown);\n\n const renderInteractionElement = (): ReactNode => {\n if (isLoading) {\n return <Spinner accessibilityLabel=\"Loading Content\" color=\"primary\" />;\n }\n\n if (shouldShowClearButton && hasTrailingDropDown) {\n return (\n <BaseBox display=\"flex\" gap=\"spacing.3\">\n {renderClearButton()} <Divider orientation=\"vertical\" />\n </BaseBox>\n );\n }\n\n if (showClearButton && hasTrailingInteractionElement) {\n return (\n <BaseBox display=\"flex\" gap=\"spacing.3\">\n {renderClearButton()} <Divider orientation=\"vertical\" /> {trailing as React.ReactElement}\n </BaseBox>\n );\n }\n\n if (shouldShowClearButton) {\n return renderClearButton();\n }\n\n if (hasTrailingInteractionElement) {\n return trailing as React.ReactElement;\n }\n return null;\n };\n return (\n <BaseInput\n id=\"textinput\"\n componentName={MetaConstants.TextInput}\n ref={mergedRef}\n setInputWrapperRef={(wrapperNode) => {\n textInputWrapperRef.current = wrapperNode;\n }}\n label={label as string}\n labelSuffix={labelSuffix}\n labelTrailing={labelTrailing}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n placeholder={placeholder}\n // CONTROLLED/UNCONTROLLED INPUT LOGIC:\n // For inputs WITHOUT format:\n // - Use standard React controlled/uncontrolled logic\n // - Controlled: user provides `value` prop → use `value` prop\n // - Uncontrolled: user provides `defaultValue` prop → use `defaultValue` prop\n //\n // For inputs WITH format:\n // - Formatting requires controlled mode to re-render and show formatted values\n // - Case 1: Only `value` provided → defaultValue: undefined, value: formattedValue (normal controlled)\n // - Case 2: Only `defaultValue` provided → defaultValue: undefined, value: formattedValue (convert to controlled)\n // - Case 3: Both `value` and `defaultValue` provided → defaultValue: defaultValue, value: formattedValue (let BaseInput detect conflict and throw error)\n //\n defaultValue={\n format\n ? value !== undefined && defaultValue !== undefined\n ? defaultValue\n : undefined\n : defaultValue\n }\n value={format ? inputValue : value}\n name={name}\n maxCharacters={effectiveMaxCharacters}\n isDropdownTrigger={isTaggedInput}\n tags={isTaggedInput ? getTags({ size }) : undefined}\n showAllTags={isInputFocussed}\n maxTagRows=\"single\"\n activeTagIndex={activeTagIndex}\n setActiveTagIndex={setActiveTagIndex}\n leadingDropDown={renderLeadingDropDown}\n trailingDropDown={renderTrailingDropDown}\n leadingInteractionElement={\n hasLeadingInteractionElement ? (leading as React.ReactElement) : null\n }\n onChange={({ name, value }: { name?: string; value?: string }) => {\n if (showClearButton && value?.length) {\n // show the clear button when the user starts typing in\n setShouldShowClearButton(true);\n }\n\n if (shouldShowClearButton && !value?.length) {\n // hide the clear button when the input field is empty\n setShouldShowClearButton(false);\n }\n\n handleTaggedInputChange({ name, value });\n handleOnChange({ name, value });\n }}\n onClick={onClick}\n onFocus={(e) => {\n setIsInputFocussed(true);\n onFocus?.(e);\n }}\n onBlur={(e) => {\n setIsInputFocussed(false);\n onBlur?.(e);\n }}\n onKeyDown={(e) => {\n handleTaggedInputKeydown(e);\n onKeyDown?.(e);\n if (format) {\n formattingResult.handleKeyDown(e.event);\n }\n }}\n onSubmit={onSubmit}\n isDisabled={isDisabled}\n necessityIndicator={necessityIndicator}\n isRequired={isRequired}\n leadingIcon={_leadingIcon ?? leadingIcon ?? icon}\n prefix={prefix}\n trailingInteractionElement={renderInteractionElement()}\n trailingIcon={_trailingIcon ?? trailingIcon}\n suffix={suffix}\n validationState={validationState}\n errorText={errorText}\n helpText={helpText}\n successText={successText}\n trailingFooterSlot={(value) => {\n return format ? null : effectiveMaxCharacters ? (\n <BaseBox marginTop={hintMarginTop[size]} marginRight=\"spacing.1\">\n <CharacterCounter\n currentCount={value?.length ?? 0}\n maxCount={effectiveMaxCharacters}\n size={size}\n />\n </BaseBox>\n ) : null;\n }}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n testID={testID}\n {...getKeyboardAndAutocompleteProps({\n type,\n keyboardReturnKeyType,\n autoCompleteSuggestionType,\n autoCapitalize,\n })}\n size={size}\n {...rest}\n />\n );\n};\n\nconst TextInput = assignWithoutSideEffects(React.forwardRef(_TextInput), {\n displayName: 'TextInput',\n});\n\nexport type { TextInputProps };\nexport { TextInput };\n"],"names":["isReactNative","_textInputRef","getPlatformType","_TextInput","_ref","ref","_ref4","label","accessibilityLabel","_ref$labelPosition","labelPosition","placeholder","_ref$type","type","defaultValue","name","value","maxCharacters","format","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","necessityIndicator","validationState","errorText","helpText","successText","isRequired","icon","prefix","showClearButton","onClearButtonClick","isLoading","suffix","autoFocus","keyboardReturnKeyType","autoCompleteSuggestionType","autoCapitalize","testID","_ref$size","size","leadingIcon","trailingIcon","isTaggedInput","tags","onTagChange","trailing","leading","labelSuffix","labelTrailing","onKeyDown","rest","_objectWithoutProperties","_excluded","textInputRef","React","useRef","mergedRef","useMergeRefs","_useState","useState","_useState2","_slicedToArray","shouldShowClearButton","setShouldShowClearButton","_useState3","_useState4","isInputFocussed","setIsInputFocussed","__DEV__","hasAlphanumeric","test","Error","formattingResult","useFormattedInput","inputValue","formattedValue","effectiveMaxCharacters","maxLength","handleOnChange","useCallback","_ref2","handleChange","_useTaggedInput","useTaggedInput","inputRef","activeTagIndex","setActiveTagIndex","getTags","handleTaggedInputKeydown","handleTaggedInputChange","handleTagsClear","_React$useState","_React$useState2","isTrailingDropDownOpen","setIsTrailingDropDownOpen","_React$useState3","_React$useState4","isLeadingDropDownOpen","setIsLeadingDropDownOpen","textInputWrapperRef","useEffect","leadingDropDown","getComponentId","trailingDropdown","_leadingIcon","isIconComponent","undefined","_trailingIcon","hasLeadingInteractionElement","hasTrailingInteractionElement","renderDropdown","dropdown","isOpen","setIsOpen","defaultPlacement","cloneElement","selectionType","onOpenChange","children","Children","map","props","child","DropdownOverlay","referenceRef","_isNestedDropdown","renderLeadingDropDown","renderTrailingDropDown","Boolean","renderClearButton","_jsx","IconButton","CloseIcon","_textInputRef$current","isEmpty","current","clear","focus","HTMLInputElement","hasTrailingDropDown","renderInteractionElement","Spinner","color","_jsxs","BaseBox","display","gap","Divider","orientation","BaseInput","Object","assign","id","componentName","MetaConstants","TextInput","setInputWrapperRef","wrapperNode","hideLabelText","isDropdownTrigger","showAllTags","maxTagRows","trailingDropDown","leadingInteractionElement","_ref3","length","e","handleKeyDown","event","trailingInteractionElement","trailingFooterSlot","_value$length","marginTop","hintMarginTop","marginRight","CharacterCounter","currentCount","maxCount","getKeyboardAndAutocompleteProps","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAK,CAAK,CAAA,IAAA+J,aAAA,CAC7B,OAAO7J,MAAM,CAAG,IAAI,CAAG8D,sBAAsB,CAC3CsD,GAAA,CAACc,OAAO,CAAA,CAAC4B,SAAS,CAAEC,aAAa,CAACtI,IAAI,CAAE,CAACuI,WAAW,CAAC,WAAW,CAAAxD,QAAA,CAC9DY,GAAA,CAAC6C,gBAAgB,CAAA,CACfC,YAAY,CAAA,CAAAL,aAAA,CAAE/J,KAAK,EAALA,IAAAA,CAAAA,KAAAA,CAAAA,CAAAA,KAAK,CAAEyJ,MAAM,GAAAM,IAAAA,CAAAA,aAAA,CAAI,CAAE,CACjCM,QAAQ,CAAErG,sBAAuB,CACjCrC,IAAI,CAAEA,IAAK,CACZ,CAAC,CACK,CAAC,CACR,IAAI,CACV,CAAE,CAEFN,SAAS,CAAEA,SAAU,CACrBI,MAAM,CAAEA,MAAO,CACX6I,CAAAA,+BAA+B,CAAC,CAClCzK,IAAI,CAAJA,IAAI,CACJyB,qBAAqB,CAArBA,qBAAqB,CACrBC,0BAA0B,CAA1BA,0BAA0B,CAC1BC,cAAc,CAAdA,cACF,CAAC,CAAC,CACFG,CAAAA,IAAI,CAAEA,IAAK,EACPW,IAAI,CACT,CAAC,CAEN,CAAC,CAEK,IAAAyG,SAAS,CAAGwB,wBAAwB,CAAC7H,cAAK,CAAC8H,UAAU,CAACrL,UAAU,CAAC,CAAE,CACvEsL,WAAW,CAAE,WACf,CAAC;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
2
|
import { useMemo, useState, useRef, useEffect, useCallback } from 'react';
|
|
3
3
|
|
|
4
|
-
var format=function format(value,pattern){if(!pattern)return value;var result='';var valueIndex=0;for(var i=0;i<pattern.length;i++){var patternChar=pattern[i];if(patternChar==='#'){if(valueIndex<value.length){result+=value[valueIndex];valueIndex++;}else {break;}}else {result+=patternChar;}}return result;};var stripPatternCharacters=function stripPatternCharacters(value){return value.replace(/[^\dA-z]/g,'');};var isUserCharacter=function isUserCharacter(character){return /[\dA-z]/.test(character);};var useFormattedInput=function useFormattedInput(_ref){var pattern=_ref.format,onChange=_ref.onChange,userValue=_ref.value,_ref$defaultValue=_ref.defaultValue,defaultValue=_ref$defaultValue===void 0?'':_ref$defaultValue;var initialValue=useMemo(function(){return format(userValue!=null?userValue:defaultValue,pattern!=null?pattern:'');},[userValue,defaultValue,pattern]);var _useState=useState(initialValue),_useState2=_slicedToArray(_useState,2),internalValue=_useState2[0],setInternalValue=_useState2[1];var inputRef=useRef(null);var infoRef=useRef({});var maxLength=useMemo(function(){return pattern==null?void 0:pattern.length;},[pattern]);useEffect(function(){if((userValue===''||userValue===undefined)&&defaultValue===''){var emptyFormatted=format('',pattern!=null?pattern:'');setInternalValue(emptyFormatted);}},[userValue,pattern]);useEffect(function(){var _infoRef$current=infoRef.current,cursorPosition=_infoRef$current.cursorPosition,endOfSection=_infoRef$current.endOfSection;if(endOfSection||cursorPosition===undefined)return;if(inputRef.current){inputRef.current.setSelectionRange(cursorPosition,cursorPosition);}},[internalValue]);var handleChange=useCallback(function(_ref2){var _inputRef$current$sel,_inputRef$current;var name=_ref2.name,inputValue=_ref2.value;if(!pattern){var cleanValue=inputValue!=null?inputValue:'';onChange==null?void 0:onChange({name:name,value:cleanValue});setInternalValue(cleanValue);return;}var currentValue=internalValue;var newInputValue=inputValue!=null?inputValue:'';var cursorPosition=(_inputRef$current$sel=(_inputRef$current=inputRef.current)==null?void 0:_inputRef$current.selectionStart)!=null?_inputRef$current$sel:0;var didDelete=newInputValue.length<currentValue.length;infoRef.current.cursorPosition=cursorPosition;var rawValue=stripPatternCharacters(newInputValue);if(didDelete){var _currentValue$cursorP;var deletedChar=(_currentValue$cursorP=currentValue[cursorPosition])!=null?_currentValue$cursorP:'';var deletedDelimiter=!isUserCharacter(deletedChar);if(deletedDelimiter){var beforeCursor=newInputValue.substring(0,cursorPosition);var afterCursor=newInputValue.substring(cursorPosition);var rawBefore=stripPatternCharacters(beforeCursor);var rawAfter=stripPatternCharacters(afterCursor);rawValue=rawBefore.slice(0,-1)+rawAfter;infoRef.current.cursorPosition=beforeCursor.replace(/([\d\w]+)[^\dA-z]+$/,'$1').length-1;}}var formattedValue=format(rawValue,pattern);infoRef.current.endOfSection=false;if(!didDelete){var nextChar=formattedValue[cursorPosition];var nextIsDelimiter=nextChar?!isUserCharacter(nextChar):false;var remainingText=formattedValue.substring(cursorPosition);var nextUserCharIndex=remainingText.search(/[\dA-z]/);var hasMoreUserChars=nextUserCharIndex!==-1;infoRef.current.endOfSection=nextIsDelimiter&&!hasMoreUserChars;if(nextIsDelimiter&&hasMoreUserChars){var _formattedValue;var prevChar=(_formattedValue=formattedValue[cursorPosition-1])!=null?_formattedValue:'';var prevIsDelimiter=!isUserCharacter(prevChar);if(prevIsDelimiter){infoRef.current.cursorPosition=cursorPosition+nextUserCharIndex+1;}}}onChange==null?void 0:onChange({name:name,value:formattedValue,rawValue:rawValue});setInternalValue(formattedValue);},[pattern,onChange,internalValue]);var handleKeyDown=useCallback(function(event){if(event.currentTarget&&inputRef.current!==event.currentTarget){inputRef.current=event.currentTarget;}},[]);return {formattedValue:internalValue,handleChange:handleChange,handleKeyDown:handleKeyDown,maxLength:maxLength};};
|
|
4
|
+
var format=function format(value,pattern){if(!pattern)return value;var result='';var valueIndex=0;for(var i=0;i<pattern.length;i++){var patternChar=pattern[i];if(patternChar==='#'){if(valueIndex<value.length){result+=value[valueIndex];valueIndex++;}else {break;}}else {result+=patternChar;}}return result;};var stripPatternCharacters=function stripPatternCharacters(value){return value.replace(/[^\dA-z]/g,'');};var isUserCharacter=function isUserCharacter(character){return /[\dA-z]/.test(character);};var useFormattedInput=function useFormattedInput(_ref){var pattern=_ref.format,onChange=_ref.onChange,userValue=_ref.value,_ref$defaultValue=_ref.defaultValue,defaultValue=_ref$defaultValue===void 0?'':_ref$defaultValue;var initialValue=useMemo(function(){return format(userValue!=null?userValue:defaultValue,pattern!=null?pattern:'');},[userValue,defaultValue,pattern]);var _useState=useState(initialValue),_useState2=_slicedToArray(_useState,2),internalValue=_useState2[0],setInternalValue=_useState2[1];var inputRef=useRef(null);var infoRef=useRef({});var maxLength=useMemo(function(){return pattern==null?void 0:pattern.length;},[pattern]);useEffect(function(){if((userValue===''||userValue===undefined)&&defaultValue===''){var emptyFormatted=format('',pattern!=null?pattern:'');setInternalValue(emptyFormatted);}if(userValue!==undefined&&userValue!==''&&pattern){var rawValue=stripPatternCharacters(userValue);var newFormatted=format(rawValue,pattern);if(newFormatted!==internalValue){setInternalValue(newFormatted);}}},[userValue,pattern]);useEffect(function(){var _infoRef$current=infoRef.current,cursorPosition=_infoRef$current.cursorPosition,endOfSection=_infoRef$current.endOfSection;if(endOfSection||cursorPosition===undefined)return;if(inputRef.current){inputRef.current.setSelectionRange(cursorPosition,cursorPosition);}},[internalValue]);var handleChange=useCallback(function(_ref2){var _inputRef$current$sel,_inputRef$current;var name=_ref2.name,inputValue=_ref2.value;if(!pattern){var cleanValue=inputValue!=null?inputValue:'';onChange==null?void 0:onChange({name:name,value:cleanValue});setInternalValue(cleanValue);return;}var currentValue=internalValue;var newInputValue=inputValue!=null?inputValue:'';var cursorPosition=(_inputRef$current$sel=(_inputRef$current=inputRef.current)==null?void 0:_inputRef$current.selectionStart)!=null?_inputRef$current$sel:0;var didDelete=newInputValue.length<currentValue.length;infoRef.current.cursorPosition=cursorPosition;var rawValue=stripPatternCharacters(newInputValue);if(didDelete){var _currentValue$cursorP;var deletedChar=(_currentValue$cursorP=currentValue[cursorPosition])!=null?_currentValue$cursorP:'';var deletedDelimiter=!isUserCharacter(deletedChar);if(deletedDelimiter){var beforeCursor=newInputValue.substring(0,cursorPosition);var afterCursor=newInputValue.substring(cursorPosition);var rawBefore=stripPatternCharacters(beforeCursor);var rawAfter=stripPatternCharacters(afterCursor);rawValue=rawBefore.slice(0,-1)+rawAfter;infoRef.current.cursorPosition=beforeCursor.replace(/([\d\w]+)[^\dA-z]+$/,'$1').length-1;}}var formattedValue=format(rawValue,pattern);infoRef.current.endOfSection=false;if(!didDelete){var nextChar=formattedValue[cursorPosition];var nextIsDelimiter=nextChar?!isUserCharacter(nextChar):false;var remainingText=formattedValue.substring(cursorPosition);var nextUserCharIndex=remainingText.search(/[\dA-z]/);var hasMoreUserChars=nextUserCharIndex!==-1;infoRef.current.endOfSection=nextIsDelimiter&&!hasMoreUserChars;if(nextIsDelimiter&&hasMoreUserChars){var _formattedValue;var prevChar=(_formattedValue=formattedValue[cursorPosition-1])!=null?_formattedValue:'';var prevIsDelimiter=!isUserCharacter(prevChar);if(prevIsDelimiter){infoRef.current.cursorPosition=cursorPosition+nextUserCharIndex+1;}else {var delimiterExistedBefore=currentValue[cursorPosition]===formattedValue[cursorPosition];if(delimiterExistedBefore){infoRef.current.cursorPosition=cursorPosition+1;}}}}onChange==null?void 0:onChange({name:name,value:formattedValue,rawValue:rawValue});setInternalValue(formattedValue);},[pattern,onChange,internalValue]);var handleKeyDown=useCallback(function(event){if(event.currentTarget&&inputRef.current!==event.currentTarget){inputRef.current=event.currentTarget;}},[]);return {formattedValue:internalValue,handleChange:handleChange,handleKeyDown:handleKeyDown,maxLength:maxLength};};
|
|
5
5
|
|
|
6
6
|
export { useFormattedInput };
|
|
7
7
|
//# sourceMappingURL=useFormattedInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFormattedInput.js","sources":["../../../../../../src/components/Input/TextInput/useFormattedInput.ts"],"sourcesContent":["import type React from 'react';\nimport { useCallback, useRef, useState, useEffect, useMemo } from 'react';\nimport type { FormInputOnEvent } from '~components/Form/FormTypes';\n\n/**\n * Formats user input according to pattern. format(\"1234\", \"##/##\") → \"12/34\"\n */\nconst format = (value: string, pattern: string): string => {\n if (!pattern) return value;\n\n let result = '';\n let valueIndex = 0;\n\n for (let i = 0; i < pattern.length; i++) {\n const patternChar = pattern[i]; // \"#\" or \"/\"\n\n if (patternChar === '#') {\n if (valueIndex < value.length) {\n result += value[valueIndex]; // add \"1\" from \"1234\"\n valueIndex++;\n } else {\n break; // No more input chars, stop\n }\n } else {\n result += patternChar; // add \"/\" delimiter\n }\n }\n\n return result; // \"12/34\"\n};\n\n/**\n * Removes delimiters, keeps only user input. stripPatternCharacters(\"12/34\") → \"1234\"\n */\nconst stripPatternCharacters = (value: string): string => {\n return value.replace(/[^\\dA-z]/g, ''); // \"12/34\" → \"1234\" (removes \"/\")\n};\n\n/**\n * Checks if character is user input vs delimiter. isUserCharacter('1') → true, isUserCharacter('/') → false\n */\nconst isUserCharacter = (character: string): boolean => {\n return /[\\dA-z]/.test(character); // \"1\" → true, \"/\" → false\n};\n\ntype UseFormattedInputProps = {\n format?: string;\n onChange?: (params: { name?: string; value?: string; rawValue?: string }) => void;\n value?: string;\n defaultValue?: string;\n};\n\ntype UseFormattedInputReturn = {\n formattedValue: string;\n handleChange: FormInputOnEvent;\n handleKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => void;\n maxLength?: number;\n};\n\n/**\n * Hook for pattern-based input formatting with smart cursor positioning.\n * useFormattedInput({ format: \"##/##\" }) transforms \"1234\" → \"12/34\"\n */\nexport const useFormattedInput = ({\n format: pattern,\n onChange,\n value: userValue,\n defaultValue = '',\n}: UseFormattedInputProps): UseFormattedInputReturn => {\n const initialValue = useMemo(() => {\n return format(userValue ?? defaultValue, pattern ?? '');\n }, [userValue, defaultValue, pattern]);\n\n const [internalValue, setInternalValue] = useState(initialValue);\n const inputRef = useRef<HTMLInputElement | null>(null);\n const infoRef = useRef<{\n cursorPosition?: number;\n endOfSection?: boolean;\n }>({});\n\n const maxLength = useMemo(() => pattern?.length, [pattern]);\n\n // Reset internal state when parent clears value (form resets, external state changes)\n // Preserves format delimiters for visual guidance. Example: \"(###)\" → \"( )\" when cleared\n useEffect(() => {\n if ((userValue === '' || userValue === undefined) && defaultValue === '') {\n const emptyFormatted = format('', pattern ?? '');\n setInternalValue(emptyFormatted);\n }\n }, [userValue, pattern]);\n\n // Apply calculated cursor position after value updates\n useEffect(() => {\n const { cursorPosition, endOfSection } = infoRef.current;\n\n if (endOfSection || cursorPosition === undefined) return; // Skip if no position or end section\n\n if (inputRef.current) {\n inputRef.current.setSelectionRange(cursorPosition, cursorPosition);\n }\n }, [internalValue]);\n\n const handleChange: FormInputOnEvent = useCallback(\n ({ name, value: inputValue }) => {\n if (!pattern) {\n // No pattern = regular input\n const cleanValue = inputValue ?? '';\n onChange?.({ name, value: cleanValue });\n setInternalValue(cleanValue);\n return;\n }\n\n const currentValue = internalValue; // \"12/34\" (user wants to delete \"/\")\n const newInputValue = inputValue ?? ''; // \"1234\" (after deleting \"/\")\n const cursorPosition = inputRef.current?.selectionStart ?? 0; // 2 (cursor where \"/\" was)\n const didDelete = newInputValue.length < currentValue.length; // 4 < 5 → true\n\n infoRef.current.cursorPosition = cursorPosition;\n\n let rawValue = stripPatternCharacters(newInputValue); // \"1234\" → \"1234\"\n\n // Handle special case: user deleted a delimiter (like deleting \"/\" in \"12/|34\")\n if (didDelete) {\n const deletedChar = currentValue[cursorPosition] ?? ''; // \"12/34\"[2] → \"/\"\n const deletedDelimiter = !isUserCharacter(deletedChar); // \"/\" → true (is delimiter)\n\n if (deletedDelimiter) {\n // true (will execute for \"/\" deletion)\n const beforeCursor = newInputValue.substring(0, cursorPosition); // \"12\" (before cursor)\n const afterCursor = newInputValue.substring(cursorPosition); // \"34\" (after cursor)\n const rawBefore = stripPatternCharacters(beforeCursor); // \"12\" → \"12\"\n const rawAfter = stripPatternCharacters(afterCursor); // \"34\" → \"34\"\n\n rawValue = rawBefore.slice(0, -1) + rawAfter; // \"12\".slice(0,-1) + \"34\" → \"1\" + \"34\" → \"134\"\n\n // Removes trailing non-alphanumeric characters from the end of the string, preserving the last alphanumeric word before them.\n infoRef.current.cursorPosition =\n beforeCursor.replace(/([\\d\\w]+)[^\\dA-z]+$/, '$1').length - 1;\n }\n }\n\n const formattedValue = format(rawValue, pattern); // format(\"134\", \"##/##\") → \"13/4\"\n infoRef.current.endOfSection = false;\n\n // Handle cursor positioning when typing (not deleting)\n if (!didDelete) {\n // User types \"2\" in \"1|\" → becomes \"12|/\" → should jump to \"12/|\"\n const nextChar = formattedValue[cursorPosition]; // \"12/\"[2] → \"/\" (delimiter)\n const nextIsDelimiter = nextChar ? !isUserCharacter(nextChar) : false; // \"/\" → true\n\n const remainingText = formattedValue.substring(cursorPosition); // \"12/\".substring(2) → \"/\"\n const nextUserCharIndex = remainingText.search(/[\\dA-z]/); // \"/\".search() → -1 (no user chars)\n const hasMoreUserChars = nextUserCharIndex !== -1; // -1 !== -1 → false\n\n infoRef.current.endOfSection = nextIsDelimiter && !hasMoreUserChars; // true && false → false\n\n // Move cursor past auto-inserted delimiters for smooth typing\n if (nextIsDelimiter && hasMoreUserChars) {\n const prevChar = formattedValue[cursorPosition - 1] ?? '';\n const prevIsDelimiter = !isUserCharacter(prevChar);\n\n if (prevIsDelimiter) {\n infoRef.current.cursorPosition = cursorPosition + nextUserCharIndex + 1;\n }\n }\n }\n\n onChange?.({ name, value: formattedValue, rawValue });\n setInternalValue(formattedValue);\n },\n [pattern, onChange, internalValue],\n );\n\n const handleKeyDown = useCallback((event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.currentTarget && inputRef.current !== event.currentTarget) {\n inputRef.current = event.currentTarget;\n }\n }, []);\n\n return {\n formattedValue: internalValue,\n handleChange,\n handleKeyDown,\n maxLength,\n };\n};\n"],"names":["format","value","pattern","result","valueIndex","i","length","patternChar","stripPatternCharacters","replace","isUserCharacter","character","test","useFormattedInput","_ref","onChange","userValue","_ref$defaultValue","defaultValue","initialValue","useMemo","_useState","useState","_useState2","_slicedToArray","internalValue","setInternalValue","inputRef","useRef","infoRef","maxLength","useEffect","undefined","emptyFormatted","_infoRef$current","current","cursorPosition","endOfSection","setSelectionRange","handleChange","useCallback","_ref2","_inputRef$current$sel","_inputRef$current","name","inputValue","cleanValue","currentValue","newInputValue","selectionStart","didDelete","rawValue","_currentValue$cursorP","deletedChar","deletedDelimiter","beforeCursor","substring","afterCursor","rawBefore","rawAfter","slice","formattedValue","nextChar","nextIsDelimiter","remainingText","nextUserCharIndex","search","hasMoreUserChars","_formattedValue","prevChar","prevIsDelimiter","handleKeyDown","event","currentTarget"],"mappings":";;;AAOA,IAAMA,MAAM,CAAG,SAATA,MAAMA,CAAIC,KAAa,CAAEC,OAAe,CAAa,CACzD,GAAI,CAACA,OAAO,CAAE,OAAOD,KAAK,CAE1B,IAAIE,MAAM,CAAG,EAAE,CACf,IAAIC,UAAU,CAAG,CAAC,CAElB,IAAK,IAAIC,CAAC,CAAG,CAAC,CAAEA,CAAC,CAAGH,OAAO,CAACI,MAAM,CAAED,CAAC,EAAE,CAAE,CACvC,IAAME,WAAW,CAAGL,OAAO,CAACG,CAAC,CAAC,CAE9B,GAAIE,WAAW,GAAK,GAAG,CAAE,CACvB,GAAIH,UAAU,CAAGH,KAAK,CAACK,MAAM,CAAE,CAC7BH,MAAM,EAAIF,KAAK,CAACG,UAAU,CAAC,CAC3BA,UAAU,EAAE,CACd,CAAC,KAAM,CACL,MACF,CACF,CAAC,KAAM,CACLD,MAAM,EAAII,WAAW,CACvB,CACF,CAEA,OAAOJ,MAAM,CACf,CAAC,CAKD,IAAMK,sBAAsB,CAAG,SAAzBA,sBAAsBA,CAAIP,KAAa,CAAa,CACxD,OAAOA,KAAK,CAACQ,OAAO,CAAC,WAAW,CAAE,EAAE,CAAC,CACvC,CAAC,CAKD,IAAMC,eAAe,CAAG,SAAlBA,eAAeA,CAAIC,SAAiB,CAAc,CACtD,OAAO,SAAS,CAACC,IAAI,CAACD,SAAS,CAAC,CAClC,CAAC,CAoBY,IAAAE,iBAAiB,CAAG,SAApBA,iBAAiBA,CAAAC,IAAA,CAKyB,CAJ7C,IAAAZ,OAAO,CAAAY,IAAA,CAAfd,MAAM,CACNe,QAAQ,CAAAD,IAAA,CAARC,QAAQ,CACDC,SAAS,CAAAF,IAAA,CAAhBb,KAAK,CAAAgB,iBAAA,CAAAH,IAAA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,gBAAgB,CAGnE,GAAIJ,eAAe,EAAII,gBAAgB,CAAE,CAAAC,IAAAA,eAAA,CACvC,IAAMC,QAAQ,CAAA,CAAAD,eAAA,CAAGP,cAAc,CAACzB,cAAc,CAAG,CAAC,CAAC,GAAA,IAAA,CAAAgC,eAAA,CAAI,EAAE,CACzD,IAAME,eAAe,CAAG,CAAC5D,eAAe,CAAC2D,QAAQ,CAAC,CAElD,GAAIC,eAAe,CAAE,CACnBzC,OAAO,CAACM,OAAO,CAACC,cAAc,CAAGA,cAAc,CAAG6B,iBAAiB,CAAG,CAAC,CACzE,CACF,CACF,CAEAlD,QAAQ,EAARA,IAAAA,CAAAA,KAAAA,CAAAA,CAAAA,QAAQ,CAAG,CAAE6B,IAAI,CAAJA,IAAI,CAAE3C,KAAK,CAAE4D,cAAc,CAAEV,QAAQ,CAARA,QAAS,CAAC,CAAC,CACrDzB,gBAAgB,CAACmC,cAAc,CAAC,CAClC,CAAC,CACD,CAAC3D,OAAO,CAAEa,QAAQ,CAAEU,aAAa,CACnC,CAAC,CAED,IAAM8C,aAAa,CAAG/B,WAAW,CAAC,SAACgC,KAA4C,CAAK,CAClF,GAAIA,KAAK,CAACC,aAAa,EAAI9C,QAAQ,CAACQ,OAAO,GAAKqC,KAAK,CAACC,aAAa,CAAE,CACnE9C,QAAQ,CAACQ,OAAO,CAAGqC,KAAK,CAACC,aAAa,CACxC,CACF,CAAC,CAAE,EAAE,CAAC,CAEN,OAAO,CACLZ,cAAc,CAAEpC,aAAa,CAC7Bc,YAAY,CAAZA,YAAY,CACZgC,aAAa,CAAbA,aAAa,CACbzC,SAAS,CAATA,SACF,CAAC,CACH;;;;"}
|
|
1
|
+
{"version":3,"file":"useFormattedInput.js","sources":["../../../../../../src/components/Input/TextInput/useFormattedInput.ts"],"sourcesContent":["import type React from 'react';\nimport { useCallback, useRef, useState, useEffect, useMemo } from 'react';\nimport type { FormInputOnEvent } from '~components/Form/FormTypes';\n\n/**\n * Formats user input according to pattern. format(\"1234\", \"##/##\") → \"12/34\"\n */\nconst format = (value: string, pattern: string): string => {\n if (!pattern) return value;\n\n let result = '';\n let valueIndex = 0;\n\n for (let i = 0; i < pattern.length; i++) {\n const patternChar = pattern[i]; // \"#\" or \"/\"\n\n if (patternChar === '#') {\n if (valueIndex < value.length) {\n result += value[valueIndex]; // add \"1\" from \"1234\"\n valueIndex++;\n } else {\n break; // No more input chars, stop\n }\n } else {\n result += patternChar; // add \"/\" delimiter\n }\n }\n\n return result; // \"12/34\"\n};\n\n/**\n * Removes delimiters, keeps only user input. stripPatternCharacters(\"12/34\") → \"1234\"\n */\nconst stripPatternCharacters = (value: string): string => {\n return value.replace(/[^\\dA-z]/g, ''); // \"12/34\" → \"1234\" (removes \"/\")\n};\n\n/**\n * Checks if character is user input vs delimiter. isUserCharacter('1') → true, isUserCharacter('/') → false\n */\nconst isUserCharacter = (character: string): boolean => {\n return /[\\dA-z]/.test(character); // \"1\" → true, \"/\" → false\n};\n\ntype UseFormattedInputProps = {\n format?: string;\n onChange?: (params: { name?: string; value?: string; rawValue?: string }) => void;\n value?: string;\n defaultValue?: string;\n};\n\ntype UseFormattedInputReturn = {\n formattedValue: string;\n handleChange: FormInputOnEvent;\n handleKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => void;\n maxLength?: number;\n};\n\n/**\n * Hook for pattern-based input formatting with smart cursor positioning.\n * useFormattedInput({ format: \"##/##\" }) transforms \"1234\" → \"12/34\"\n */\nexport const useFormattedInput = ({\n format: pattern,\n onChange,\n value: userValue,\n defaultValue = '',\n}: UseFormattedInputProps): UseFormattedInputReturn => {\n const initialValue = useMemo(() => {\n return format(userValue ?? defaultValue, pattern ?? '');\n }, [userValue, defaultValue, pattern]);\n\n const [internalValue, setInternalValue] = useState(initialValue);\n const inputRef = useRef<HTMLInputElement | null>(null);\n const infoRef = useRef<{\n cursorPosition?: number;\n endOfSection?: boolean;\n }>({});\n\n const maxLength = useMemo(() => pattern?.length, [pattern]);\n\n // Reset internal state when parent clears value (form resets, external state changes)\n // Preserves format delimiters for visual guidance. Example: \"(###)\" → \"( )\" when cleared\n useEffect(() => {\n if ((userValue === '' || userValue === undefined) && defaultValue === '') {\n const emptyFormatted = format('', pattern ?? '');\n setInternalValue(emptyFormatted);\n }\n // DATEPICKER FIX: Sync internal state when external value changes\n // This addresses the issue where DatePicker programmatically updates the value prop\n // (e.g., when user selects date from calendar), but the formatted input's internal\n // state doesn't update, causing the input to not reflect the new value.\n // Without this, only user typing and empty resets were handled.\n if (userValue !== undefined && userValue !== '' && pattern) {\n const rawValue = stripPatternCharacters(userValue);\n const newFormatted = format(rawValue, pattern);\n\n // Only update if the formatted value actually changed to avoid unnecessary re-renders\n if (newFormatted !== internalValue) {\n setInternalValue(newFormatted);\n }\n }\n }, [userValue, pattern]);\n\n // Apply calculated cursor position after value updates\n useEffect(() => {\n const { cursorPosition, endOfSection } = infoRef.current;\n\n if (endOfSection || cursorPosition === undefined) return; // Skip if no position or end section\n\n if (inputRef.current) {\n inputRef.current.setSelectionRange(cursorPosition, cursorPosition);\n }\n }, [internalValue]);\n\n const handleChange: FormInputOnEvent = useCallback(\n ({ name, value: inputValue }) => {\n if (!pattern) {\n // No pattern = regular input\n const cleanValue = inputValue ?? '';\n onChange?.({ name, value: cleanValue });\n setInternalValue(cleanValue);\n return;\n }\n\n const currentValue = internalValue; // \"12/34\" (user wants to delete \"/\")\n const newInputValue = inputValue ?? ''; // \"1234\" (after deleting \"/\")\n const cursorPosition = inputRef.current?.selectionStart ?? 0; // 2 (cursor where \"/\" was)\n const didDelete = newInputValue.length < currentValue.length; // 4 < 5 → true\n\n infoRef.current.cursorPosition = cursorPosition;\n\n let rawValue = stripPatternCharacters(newInputValue); // \"1234\" → \"1234\"\n\n // Handle special case: user deleted a delimiter (like deleting \"/\" in \"12/|34\")\n if (didDelete) {\n const deletedChar = currentValue[cursorPosition] ?? ''; // \"12/34\"[2] → \"/\"\n const deletedDelimiter = !isUserCharacter(deletedChar); // \"/\" → true (is delimiter)\n\n if (deletedDelimiter) {\n // true (will execute for \"/\" deletion)\n const beforeCursor = newInputValue.substring(0, cursorPosition); // \"12\" (before cursor)\n const afterCursor = newInputValue.substring(cursorPosition); // \"34\" (after cursor)\n const rawBefore = stripPatternCharacters(beforeCursor); // \"12\" → \"12\"\n const rawAfter = stripPatternCharacters(afterCursor); // \"34\" → \"34\"\n\n rawValue = rawBefore.slice(0, -1) + rawAfter; // \"12\".slice(0,-1) + \"34\" → \"1\" + \"34\" → \"134\"\n\n // Removes trailing non-alphanumeric characters from the end of the string, preserving the last alphanumeric word before them.\n infoRef.current.cursorPosition =\n beforeCursor.replace(/([\\d\\w]+)[^\\dA-z]+$/, '$1').length - 1;\n }\n }\n\n const formattedValue = format(rawValue, pattern); // format(\"134\", \"##/##\") → \"13/4\"\n infoRef.current.endOfSection = false;\n\n // Handle cursor positioning when typing (not deleting)\n if (!didDelete) {\n // User types \"2\" in \"1|\" → becomes \"12|/\" → should jump to \"12/|\"\n const nextChar = formattedValue[cursorPosition]; // \"12/\"[2] → \"/\" (delimiter)\n const nextIsDelimiter = nextChar ? !isUserCharacter(nextChar) : false; // \"/\" → true\n\n const remainingText = formattedValue.substring(cursorPosition); // \"12/\".substring(2) → \"/\"\n const nextUserCharIndex = remainingText.search(/[\\dA-z]/); // \"/\".search() → -1 (no user chars)\n const hasMoreUserChars = nextUserCharIndex !== -1; // -1 !== -1 → false\n\n infoRef.current.endOfSection = nextIsDelimiter && !hasMoreUserChars; // true && false → false\n\n // Move cursor past auto-inserted delimiters for smooth typing\n if (nextIsDelimiter && hasMoreUserChars) {\n const prevChar = formattedValue[cursorPosition - 1] ?? '';\n const prevIsDelimiter = !isUserCharacter(prevChar);\n\n if (prevIsDelimiter) {\n infoRef.current.cursorPosition = cursorPosition + nextUserCharIndex + 1;\n } else {\n // If we're at a delimiter after typing (not deleting), and there are more chars,\n // we probably need to move past it unless it's a brand new delimiter\n const delimiterExistedBefore =\n currentValue[cursorPosition] === formattedValue[cursorPosition];\n if (delimiterExistedBefore) {\n infoRef.current.cursorPosition = cursorPosition + 1;\n }\n }\n }\n }\n\n onChange?.({ name, value: formattedValue, rawValue });\n setInternalValue(formattedValue);\n },\n [pattern, onChange, internalValue],\n );\n\n const handleKeyDown = useCallback((event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.currentTarget && inputRef.current !== event.currentTarget) {\n inputRef.current = event.currentTarget;\n }\n }, []);\n\n return {\n formattedValue: internalValue,\n handleChange,\n handleKeyDown,\n maxLength,\n };\n};\n"],"names":["format","value","pattern","result","valueIndex","i","length","patternChar","stripPatternCharacters","replace","isUserCharacter","character","test","useFormattedInput","_ref","onChange","userValue","_ref$defaultValue","defaultValue","initialValue","useMemo","_useState","useState","_useState2","_slicedToArray","internalValue","setInternalValue","inputRef","useRef","infoRef","maxLength","useEffect","undefined","emptyFormatted","rawValue","newFormatted","_infoRef$current","current","cursorPosition","endOfSection","setSelectionRange","handleChange","useCallback","_ref2","_inputRef$current$sel","_inputRef$current","name","inputValue","cleanValue","currentValue","newInputValue","selectionStart","didDelete","_currentValue$cursorP","deletedChar","deletedDelimiter","beforeCursor","substring","afterCursor","rawBefore","rawAfter","slice","formattedValue","nextChar","nextIsDelimiter","remainingText","nextUserCharIndex","search","hasMoreUserChars","_formattedValue","prevChar","prevIsDelimiter","delimiterExistedBefore","handleKeyDown","event","currentTarget"],"mappings":";;;AAOA,IAAMA,MAAM,CAAG,SAATA,MAAMA,CAAIC,KAAa,CAAEC,OAAe,CAAa,CACzD,GAAI,CAACA,OAAO,CAAE,OAAOD,KAAK,CAE1B,IAAIE,MAAM,CAAG,EAAE,CACf,IAAIC,UAAU,CAAG,CAAC,CAElB,IAAK,IAAIC,CAAC,CAAG,CAAC,CAAEA,CAAC,CAAGH,OAAO,CAACI,MAAM,CAAED,CAAC,EAAE,CAAE,CACvC,IAAME,WAAW,CAAGL,OAAO,CAACG,CAAC,CAAC,CAE9B,GAAIE,WAAW,GAAK,GAAG,CAAE,CACvB,GAAIH,UA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AAC7D,eAAe,CAAC4D,QAAQ,CAAC,CAElD,GAAIC,eAAe,CAAE,CACnB1C,OAAO,CAACQ,OAAO,CAACC,cAAc,CAAGA,cAAc,CAAG4B,iBAAiB,CAAG,CAAC,CACzE,CAAC,KAAM,CAGL,IAAMM,sBAAsB,CAC1BvB,YAAY,CAACX,cAAc,CAAC,GAAKwB,cAAc,CAACxB,cAAc,CAAC,CACjE,GAAIkC,sBAAsB,CAAE,CAC1B3C,OAAO,CAACQ,OAAO,CAACC,cAAc,CAAGA,cAAc,CAAG,CAAC,CACrD,CACF,CACF,CACF,CAEAvB,QAAQ,EAARA,IAAAA,CAAAA,KAAAA,CAAAA,CAAAA,QAAQ,CAAG,CAAE+B,IAAI,CAAJA,IAAI,CAAE7C,KAAK,CAAE6D,cAAc,CAAE5B,QAAQ,CAARA,QAAS,CAAC,CAAC,CACrDR,gBAAgB,CAACoC,cAAc,CAAC,CAClC,CAAC,CACD,CAAC5D,OAAO,CAAEa,QAAQ,CAAEU,aAAa,CACnC,CAAC,CAED,IAAMgD,aAAa,CAAG/B,WAAW,CAAC,SAACgC,KAA4C,CAAK,CAClF,GAAIA,KAAK,CAACC,aAAa,EAAIhD,QAAQ,CAACU,OAAO,GAAKqC,KAAK,CAACC,aAAa,CAAE,CACnEhD,QAAQ,CAACU,OAAO,CAAGqC,KAAK,CAACC,aAAa,CACxC,CACF,CAAC,CAAE,EAAE,CAAC,CAEN,OAAO,CACLb,cAAc,CAAErC,aAAa,CAC7BgB,YAAY,CAAZA,YAAY,CACZgC,aAAa,CAAbA,aAAa,CACb3C,SAAS,CAATA,SACF,CAAC,CACH;;;;"}
|
|
@@ -151,7 +151,8 @@ var _BottomSheet = function _BottomSheet(_ref2) {
|
|
|
151
151
|
var maxValue = computeMaxContent({
|
|
152
152
|
contentHeight: contentHeight,
|
|
153
153
|
footerHeight: footerHeight,
|
|
154
|
-
|
|
154
|
+
// If headerHeight is zero no need to add height of grabHandleHeight.
|
|
155
|
+
headerHeight: headerHeight > 0 ? headerHeight + grabHandleHeight : 0,
|
|
155
156
|
maxHeight: value
|
|
156
157
|
});
|
|
157
158
|
_setPositionY(shouldLimitPositionY ? maxValue : value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.web.js","sources":["../../../../../../src/components/BottomSheet/BottomSheet.web.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable react/jsx-no-useless-fragment */\n/* eslint-disable consistent-return */\n/* eslint-disable @typescript-eslint/explicit-function-return-type */\nimport React from 'react';\nimport styled from 'styled-components';\nimport { rubberbandIfOutOfBounds, useDrag } from '@use-gesture/react';\nimport usePresence from 'use-presence';\nimport { clearAllBodyScrollLocks, enableBodyScroll } from 'body-scroll-lock-upgrade';\nimport { BottomSheetHeader } from './BottomSheetHeader';\nimport { BottomSheetFooter } from './BottomSheetFooter';\nimport { BottomSheetBody } from './BottomSheetBody';\nimport type { SnapPoints } from './utils';\nimport { computeMaxContent, computeSnapPointBounds } from './utils';\nimport { BottomSheetBackdrop } from './BottomSheetBackdrop';\nimport type { BottomSheetContextProps } from './BottomSheetContext';\nimport { BottomSheetContext, useBottomSheetAndDropdownGlue } from './BottomSheetContext';\nimport { ComponentIds } from './componentIds';\nimport type { BottomSheetProps } from './types';\nimport { BottomSheetGrabHandle } from './BottomSheetGrabHandle';\nimport { useBottomSheetStack } from './BottomSheetStack';\nimport BaseBox from '~components/Box/BaseBox';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { useScrollLock } from '~utils/useScrollLock';\nimport { useWindowSize } from '~utils/useWindowSize';\nimport { useIsomorphicLayoutEffect } from '~utils/useIsomorphicLayoutEffect';\nimport { useTheme } from '~components/BladeProvider';\nimport { useId } from '~utils/useId';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeSize } from '~utils/makeSize';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { size } from '~tokens/global';\nimport { makeMotionTime } from '~utils/makeMotionTime';\nimport { componentZIndices } from '~utils/componentZIndices';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\nexport const BOTTOM_SHEET_EASING = 'cubic-bezier(.15,0,.24,.97)';\nconst AUTOCOMPLETE_DEFAULT_SNAPPOINT = 0.85;\n\nconst BottomSheetSurface = styled.div<{\n windowHeight: number;\n isDragging: boolean;\n}>(({ theme, windowHeight, isDragging }) => {\n return {\n background: theme.colors.popup.background.subtle,\n borderTopLeftRadius: makeSize(size[16]),\n borderTopRightRadius: makeSize(size[16]),\n borderColor: theme.colors.popup.border.subtle,\n // this is reverse top elevation of highRaised elevation token\n boxShadow: '0px -24px 48px -12px hsla(217, 56%, 17%, 0.18)',\n opacity: 0,\n pointerEvents: 'none',\n transitionDuration: isDragging\n ? undefined\n : `${makeMotionTime(theme.motion.duration.moderate)}`,\n transitionTimingFunction: BOTTOM_SHEET_EASING,\n willChange: 'transform, opacity, height',\n transitionProperty: 'transform, opacity, height',\n position: 'fixed',\n left: 0,\n right: 0,\n bottom: 0,\n top: windowHeight,\n backgroundColor: theme.colors.popup.background.subtle,\n justifyContent: 'center',\n alignItems: 'center',\n touchAction: 'none',\n overflow: 'hidden',\n };\n});\n\nconst _BottomSheet = ({\n isOpen,\n onDismiss,\n children,\n initialFocusRef,\n snapPoints = [0.35, 0.5, 0.85],\n zIndex = componentZIndices.bottomSheet,\n ...dataAnalyticsProps\n}: BottomSheetProps): React.ReactElement => {\n const { theme } = useTheme();\n const dimensions = useWindowSize();\n const [contentHeight, setContentHeight] = React.useState(0);\n const [headerHeight, setHeaderHeight] = React.useState(0);\n const [footerHeight, setFooterHeight] = React.useState(0);\n const [grabHandleHeight, setGrabHandleHeight] = React.useState(0);\n const [hasBodyPadding, setHasBodyPadding] = React.useState(true);\n const [isHeaderEmpty, setIsHeaderEmpty] = React.useState(false);\n\n const bottomSheetAndDropdownGlue = useBottomSheetAndDropdownGlue();\n const [positionY, _setPositionY] = React.useState(0);\n const _isOpen = isOpen ?? bottomSheetAndDropdownGlue?.isOpen;\n const [isDragging, setIsDragging] = React.useState(false);\n\n const preventScrollingRef = React.useRef(true);\n const scrollRef = React.useRef<HTMLDivElement>(null);\n const grabHandleRef = React.useRef<HTMLDivElement>(null);\n const defaultInitialFocusRef = React.useRef<any>(null);\n const originalFocusElement = React.useRef<HTMLElement | null>(null);\n const initialSnapPoint = React.useRef<number>(snapPoints[1]);\n const totalHeight = React.useMemo(() => {\n return grabHandleHeight + headerHeight + footerHeight + contentHeight;\n }, [contentHeight, footerHeight, grabHandleHeight, headerHeight]);\n\n const id = useId();\n const {\n stack,\n addBottomSheetToStack,\n removeBottomSheetFromStack,\n getTopOfTheStack,\n getCurrentStackIndexById,\n } = useBottomSheetStack();\n const currentStackIndex = getCurrentStackIndexById(id);\n const isOnTopOfStack = getTopOfTheStack() === id;\n const bottomSheetZIndex = zIndex - currentStackIndex;\n\n const setPositionY = React.useCallback(\n (value: number, limit = true) => {\n // In AutoComplete, we want BottomSheet to be docked to top snappoint so we remove the limits\n const shouldLimitPositionY = limit && !bottomSheetAndDropdownGlue?.hasAutoCompleteInHeader;\n\n const maxValue = computeMaxContent({\n contentHeight,\n footerHeight,\n headerHeight: headerHeight + headerHeight > 0 ? grabHandleHeight : 0,\n maxHeight: value,\n });\n _setPositionY(shouldLimitPositionY ? maxValue : value);\n },\n [\n bottomSheetAndDropdownGlue?.hasAutoCompleteInHeader,\n contentHeight,\n footerHeight,\n grabHandleHeight,\n headerHeight,\n ],\n );\n\n // locks the body scroll to prevent accidental scrolling of content when we drag the sheet\n // We are ready when we calculated the height of the content\n const isReady = contentHeight > 0;\n // only lock the body when we atleast have 1 bottomsheet open\n const shouldLock = isReady && stack.length > 0;\n const scrollLockRef = useScrollLock({\n enabled: shouldLock,\n targetRef: scrollRef,\n reserveScrollBarGap: true,\n });\n\n // clear all body locks to avoid memory leaks & accidental body locking\n React.useEffect(() => {\n const hasNoBottomSheets = stack.length < 1;\n if (hasNoBottomSheets) {\n clearAllBodyScrollLocks();\n }\n }, [stack]);\n\n // take the grabHandle's height into headerHeight too\n useIsomorphicLayoutEffect(() => {\n if (!grabHandleRef.current) return;\n setGrabHandleHeight(grabHandleRef.current.getBoundingClientRect().height);\n }, [grabHandleRef.current, _isOpen]);\n\n // if bottomSheet height is >35% & <50% then set initial snapPoint to 35%\n useIsomorphicLayoutEffect(() => {\n if (bottomSheetAndDropdownGlue?.hasAutoCompleteInHeader) {\n initialSnapPoint.current = AUTOCOMPLETE_DEFAULT_SNAPPOINT;\n } else {\n const middleSnapPoint = snapPoints[1] * dimensions.height;\n const lowerSnapPoint = snapPoints[0] * dimensions.height;\n if (totalHeight > lowerSnapPoint && totalHeight < middleSnapPoint) {\n initialSnapPoint.current = snapPoints[0];\n }\n }\n }, [dimensions.height, snapPoints, totalHeight]);\n\n const returnFocus = React.useCallback(() => {\n if (!originalFocusElement.current) return;\n originalFocusElement.current.focus();\n // After returning focus we will clear the original focus\n // Because if sheet can be opened up via multiple triggers\n // We want to ensure the focus returns back to the most recent triggerer\n originalFocusElement.current = null;\n }, [originalFocusElement]);\n\n const focusOnInitialRef = React.useCallback(() => {\n if (!initialFocusRef) {\n // focus on close button\n defaultInitialFocusRef.current?.focus();\n } else {\n // focus on the initialRef passed by the user\n initialFocusRef.current?.focus();\n }\n }, [initialFocusRef]);\n\n // focus on the initial ref when the sheet is opened\n React.useLayoutEffect(() => {\n if (_isOpen) {\n focusOnInitialRef();\n }\n }, [_isOpen, focusOnInitialRef]);\n\n const handleOnOpen = React.useCallback(() => {\n setPositionY(dimensions.height * initialSnapPoint.current);\n scrollLockRef.current.activate();\n // initialize the original focused element\n // On first render it will be the activeElement, eg: the button trigger or select input\n // On Subsequent open operations it won't further update the original focus\n originalFocusElement.current =\n originalFocusElement.current ?? (document.activeElement as HTMLElement);\n }, [dimensions.height, scrollLockRef, setPositionY]);\n\n const handleOnClose = React.useCallback(() => {\n setPositionY(0);\n }, [setPositionY]);\n\n const close = React.useCallback(() => {\n onDismiss?.();\n bottomSheetAndDropdownGlue?.onBottomSheetDismiss();\n returnFocus();\n }, [bottomSheetAndDropdownGlue, onDismiss, returnFocus]);\n\n // sync controlled state to our actions\n React.useEffect(() => {\n if (_isOpen) {\n // open on the next frame, otherwise the animations will not run on first render\n window.setTimeout(() => {\n handleOnOpen();\n });\n } else {\n handleOnClose();\n }\n }, [_isOpen, handleOnClose, handleOnOpen]);\n\n // let the Dropdown component know that it's rendering a bottomsheet\n React.useEffect(() => {\n if (!bottomSheetAndDropdownGlue) return;\n bottomSheetAndDropdownGlue.setDropdownHasBottomSheet(true);\n }, [bottomSheetAndDropdownGlue]);\n\n const bind = useDrag(\n ({\n active,\n last,\n cancel,\n tap,\n movement: [_movementX, movementY],\n velocity: [_velocityX, velocityY],\n lastOffset: [_, lastOffsetY],\n down,\n dragging,\n args: [{ isContentDragging = false } = {}] = [],\n }) => {\n setIsDragging(Boolean(dragging));\n // lastOffsetY is the previous position user stopped dragging the sheet\n // movementY is the drag amount from the bottom of the screen, so as you drag up the movementY goes into negatives\n // and rawY is the calculated offset from the last position of the bottomsheet to current drag amount.\n const rawY = lastOffsetY - movementY;\n\n const lowerSnapPoint = dimensions.height * snapPoints[0];\n const upperSnapPoint = dimensions.height * snapPoints[snapPoints.length - 1];\n\n // predictedY is used to create velocity driven swipe\n // the faster you swipe the more distance you cover\n // this enables users to reach upper & lower snappoint with a single swipe\n const predictedDistance = movementY * (velocityY / 2);\n const predictedY = Math.max(\n lowerSnapPoint,\n Math.min(upperSnapPoint, rawY - predictedDistance * 2),\n );\n\n let newY = rawY;\n\n if (down) {\n // Ensure that users aren't able to drag the sheet\n // more than the upperSnapPoint or maximum height of the sheet\n // this is basically a clamp() function but creates a nice rubberband effect\n const dampening = 0.55;\n if (totalHeight < upperSnapPoint) {\n newY = rubberbandIfOutOfBounds(rawY, 0, totalHeight, dampening);\n } else {\n newY = rubberbandIfOutOfBounds(rawY, 0, upperSnapPoint, dampening);\n }\n } else {\n newY = predictedY;\n }\n\n const isPosAtUpperSnapPoint = newY >= upperSnapPoint;\n\n if (isContentDragging) {\n if (isPosAtUpperSnapPoint) {\n newY = upperSnapPoint;\n }\n\n // keep the newY at upper snap point\n // until the scrollable content is not at top\n // and previously saved Y position is greater than or equal to upper snap point\n // Note: how using newY won't work here since we need the previous value of the newY\n // since we always keep updating the newY,\n // this is cruicial in making the scroll feel natural\n const isContentScrolledAtTop = scrollRef.current && scrollRef.current.scrollTop <= 0;\n if (lastOffsetY === upperSnapPoint && !isContentScrolledAtTop) {\n newY = upperSnapPoint;\n }\n preventScrollingRef.current = newY < upperSnapPoint;\n }\n\n if (last) {\n // calculate the nearest snapPoint\n const [nearest, lower] = computeSnapPointBounds(\n newY,\n snapPoints.map((point) => dimensions.height * point) as SnapPoints,\n );\n\n // This ensure that the lower snapPoint will always have atleast some buffer\n // When the bottomsheet total height is less than the lower snapPoint\n // Video walkthrough: https://www.loom.com/share/a9a8db7688d64194b13df8b3e25859ae\n const lowerPointBuffer = 60;\n const lowerestSnap = Math.min(lower, totalHeight) - lowerPointBuffer;\n\n const shouldClose = rawY < lowerestSnap;\n if (shouldClose) {\n setIsDragging(false);\n cancel();\n close();\n return;\n }\n\n // if we stop dragging assign snap to the nearest point\n if (!active && !tap) {\n newY = nearest;\n }\n }\n\n setPositionY(newY, !down);\n },\n {\n from: [0, positionY],\n filterTaps: true,\n enabled: isOnTopOfStack && _isOpen,\n },\n );\n\n // Here we are preventing the scrolling of the content, until the preventScrollingRef value is true\n useIsomorphicLayoutEffect(() => {\n const scrollElement = scrollRef.current;\n if (!scrollElement) return;\n\n const preventScrolling = (e: Event) => {\n if (preventScrollingRef?.current) {\n e.preventDefault();\n }\n };\n\n // https://www.bram.us/2016/05/02/prevent-overscroll-bounce-in-ios-mobilesafari-pure-css/\n const preventSafariOverscroll = (e: Event) => {\n if (scrollElement.scrollTop < 0) {\n // TODO: figure this out, it doesn't seem to work >iOS12\n // requestAnimationFrame(() => {\n // elem.style.overflow = 'hidden';\n // elem.scrollTop = 0;\n // elem.style.removeProperty('overflow');\n // });\n e.preventDefault();\n }\n };\n\n scrollElement.addEventListener('scroll', preventScrolling);\n scrollElement.addEventListener('touchmove', preventScrolling);\n scrollElement.addEventListener('touchstart', preventSafariOverscroll);\n return () => {\n scrollElement.removeEventListener('scroll', preventScrolling);\n scrollElement.removeEventListener('touchmove', preventScrolling);\n scrollElement.removeEventListener('touchstart', preventSafariOverscroll);\n };\n // Only run this hook when we know all the layout calculations are done,\n // Otherwise the scrollRef.current will be null.\n // isReady prop will ensure that we are done measuring the content height\n }, [isReady]);\n\n // usePresence hook waits for the animation to finish before unmounting the component\n // It's similar to motion/react's usePresence hook\n // https://www.framer.com/docs/animate-presence/#usepresence\n const { isMounted, isVisible } = usePresence(Boolean(_isOpen), {\n transitionDuration: theme.motion.duration.moderate,\n });\n\n const isHeaderFloating = !hasBodyPadding && isHeaderEmpty;\n const contextValue: BottomSheetContextProps = React.useMemo(\n () => ({\n isInBottomSheet: true,\n isOpen: Boolean(isVisible),\n close,\n positionY,\n headerHeight,\n contentHeight,\n footerHeight,\n setContentHeight,\n setFooterHeight,\n setHeaderHeight,\n setHasBodyPadding,\n setIsHeaderEmpty,\n scrollRef,\n bind,\n defaultInitialFocusRef,\n isHeaderFloating,\n }),\n [\n isVisible,\n close,\n positionY,\n headerHeight,\n contentHeight,\n footerHeight,\n setContentHeight,\n setFooterHeight,\n setHeaderHeight,\n setHasBodyPadding,\n setIsHeaderEmpty,\n scrollRef,\n bind,\n defaultInitialFocusRef,\n isHeaderFloating,\n ],\n );\n\n React.useEffect(() => {\n if (isMounted) {\n addBottomSheetToStack(id);\n } else {\n removeBottomSheetFromStack(id);\n }\n }, [addBottomSheetToStack, id, isMounted, removeBottomSheetFromStack]);\n\n // Remove the bottomsheet from the stack, if it's unmounted forcefully\n React.useEffect(() => {\n return () => {\n if (id === undefined) return;\n removeBottomSheetFromStack(id);\n };\n }, [id, removeBottomSheetFromStack]);\n\n // Disable body scroll lock when the component is unmounted forcefully\n React.useEffect(() => {\n const lockTarget = scrollRef.current;\n return () => {\n if (lockTarget) {\n enableBodyScroll(lockTarget);\n }\n };\n // when BottomSheet is mounted with isOpen={false}, then BottomSheetBody does not set scrollRef\n // so, we added scrollRef to dependencies array to ensure that we update lockTarget when scrollRef is updated\n // which will avoid passing null to enableBodyScroll\n }, [scrollRef]);\n\n // We will need to reset these values otherwise the next time the bottomsheet opens\n // this will be populated and the animations won't run\n // why?: because how the usePresence hook works, we actually just unmount the\n // html contents not the whole <BottomSheet /> react component\n React.useEffect(() => {\n if (!isMounted) {\n setHeaderHeight(0);\n setFooterHeight(0);\n setContentHeight(0);\n setGrabHandleHeight(0);\n _setPositionY(0);\n }\n }, [isMounted, scrollLockRef]);\n\n // We don't want to destroy the react tree when we are rendering inside Dropdown\n // Because if we bail out early then ActionList won't render,\n // and Dropdown manages it's state based on the rendered JSX of ActionList\n // If we don't render ActionList Dropdown state will reset each time we open/close BottomSheet\n const isInsideDropdown = Boolean(bottomSheetAndDropdownGlue);\n if (!isMounted && !isInsideDropdown) {\n return <></>;\n }\n\n return (\n <BottomSheetContext.Provider value={contextValue}>\n <BottomSheetBackdrop zIndex={bottomSheetZIndex} />\n <BottomSheetSurface\n {...metaAttribute({\n name: MetaConstants.BottomSheet,\n testID: 'bottomsheet-surface',\n })}\n {...makeAccessible({ modal: true, role: 'dialog' })}\n windowHeight={dimensions.height}\n isDragging={isDragging}\n style={{\n opacity: isVisible ? 1 : 0,\n pointerEvents: isVisible ? 'all' : 'none',\n height: positionY,\n bottom: 0,\n top: 'auto',\n zIndex: bottomSheetZIndex,\n }}\n {...makeAnalyticsAttribute(dataAnalyticsProps)}\n >\n <BaseBox height=\"100%\" display=\"flex\" flexDirection=\"column\">\n <BottomSheetGrabHandle\n ref={grabHandleRef}\n isHeaderFloating={isHeaderFloating}\n {...metaAttribute({ name: ComponentIds.BottomSheetGrabHandle })}\n {...bind()}\n />\n {children}\n </BaseBox>\n </BottomSheetSurface>\n </BottomSheetContext.Provider>\n );\n};\n\nconst BottomSheet = assignWithoutSideEffects(_BottomSheet, {\n componentId: ComponentIds.BottomSheet,\n});\n\nexport { BottomSheet, BottomSheetBody, BottomSheetHeader, BottomSheetFooter };\nexport type { BottomSheetProps };\n"],"names":["BOTTOM_SHEET_EASING","AUTOCOMPLETE_DEFAULT_SNAPPOINT","BottomSheetSurface","styled","div","withConfig","displayName","componentId","_ref","theme","windowHeight","isDragging","background","colors","popup","subtle","borderTopLeftRadius","makeSize","size","borderTopRightRadius","borderColor","border","boxShadow","opacity","pointerEvents","transitionDuration","undefined","concat","makeMotionTime","motion","duration","moderate","transitionTimingFunction","willChange","transitionProperty","position","left","right","bottom","top","backgroundColor","justifyContent","alignItems","touchAction","overflow","_BottomSheet","_ref2","isOpen","onDismiss","children","initialFocusRef","_ref2$snapPoints","snapPoints","_ref2$zIndex","zIndex","componentZIndices","bottomSheet","dataAnalyticsProps","_objectWithoutProperties","_excluded","_useTheme","useTheme","dimensions","useWindowSize","_React$useState","React","useState","_React$useState2","_slicedToArray","contentHeight","setContentHeight","_React$useState3","_React$useState4","headerHeight","setHeaderHeight","_React$useState5","_React$useState6","footerHeight","setFooterHeight","_React$useState7","_React$useState8","grabHandleHeight","setGrabHandleHeight","_React$useState9","_React$useState10","hasBodyPadding","setHasBodyPadding","_React$useState11","_React$useState12","isHeaderEmpty","setIsHeaderEmpty","bottomSheetAndDropdownGlue","useBottomSheetAndDropdownGlue","_React$useState13","_React$useState14","positionY","_setPositionY","_isOpen","_React$useState15","_React$useState16","setIsDragging","preventScrollingRef","useRef","scrollRef","grabHandleRef","defaultInitialFocusRef","originalFocusElement","initialSnapPoint","totalHeight","useMemo","id","useId","_useBottomSheetStack","useBottomSheetStack","stack","addBottomSheetToStack","removeBottomSheetFromStack","getTopOfTheStack","getCurrentStackIndexById","currentStackIndex","isOnTopOfStack","bottomSheetZIndex","setPositionY","useCallback","value","limit","arguments","length","shouldLimitPositionY","hasAutoCompleteInHeader","maxValue","computeMaxContent","maxHeight","isReady","shouldLock","scrollLockRef","useScrollLock","enabled","targetRef","reserveScrollBarGap","useEffect","hasNoBottomSheets","clearAllBodyScrollLocks","useIsomorphicLayoutEffect","current","getBoundingClientRect","height","middleSnapPoint","lowerSnapPoint","returnFocus","focus","focusOnInitialRef","_defaultInitialFocusR","_initialFocusRef$curr","useLayoutEffect","handleOnOpen","_originalFocusElement","activate","document","activeElement","handleOnClose","close","onBottomSheetDismiss","window","setTimeout","setDropdownHasBottomSheet","bind","useDrag","_ref3","active","last","cancel","tap","_ref3$movement","movement","_movementX","movementY","_ref3$velocity","velocity","_velocityX","velocityY","_ref3$lastOffset","lastOffset","_","lastOffsetY","down","dragging","_ref3$args","args","_ref3$args2","_ref3$args3","_ref3$args3$","_ref3$args3$2","_ref3$args3$2$isConte","isContentDragging","Boolean","rawY","upperSnapPoint","predictedDistance","predictedY","Math","max","min","newY","dampening","rubberbandIfOutOfBounds","isPosAtUpperSnapPoint","isContentScrolledAtTop","scrollTop","_computeSnapPointBoun","computeSnapPointBounds","map","point","_computeSnapPointBoun2","nearest","lower","lowerPointBuffer","lowerestSnap","shouldClose","from","filterTaps","scrollElement","preventScrolling","e","preventDefault","preventSafariOverscroll","addEventListener","removeEventListener","_usePresence","usePresence","isMounted","isVisible","isHeaderFloating","contextValue","isInBottomSheet","lockTarget","enableBodyScroll","isInsideDropdown","_jsx","_Fragment","_jsxs","BottomSheetContext","Provider","BottomSheetBackdrop","_objectSpread","metaAttribute","name","MetaConstants","BottomSheet","testID","makeAccessible","modal","role","style","makeAnalyticsAttribute","BaseBox","display","flexDirection","BottomSheetGrabHandle","ref","ComponentIds","assignWithoutSideEffects"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCO,IAAMA,mBAAmB,GAAG,8BAA6B;AAChE,IAAMC,8BAA8B,GAAG,IAAI,CAAA;AAE3C,IAAMC,kBAAkB,gBAAGC,MAAM,CAACC,GAAG,CAA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,aAAA,CAAA;AACpBe,UAAAA,GAAG,EAAE3J,aAAc;AACnBgI,UAAAA,gBAAgB,EAAEA,gBAAAA;AAAiB,SAAA,EAC/Ba,aAAa,CAAC;UAAEC,IAAI,EAAEc,YAAY,CAACF,qBAAAA;SAAuB,CAAC,GAC3D5F,IAAI,EAAE,CACX,CAAC,EACDrH,QAAQ,CAAA;OACF,CAAA;AAAC,KAAA,CACQ,CAAC,CAAA;AAAA,GACM,CAAC,CAAA;AAElC,CAAC,CAAA;AAED,IAAMuM,WAAW,gBAAGa,wBAAwB,CAACxN,YAAY,EAAE;EACzDtC,WAAW,EAAE6P,YAAY,CAACZ,WAAAA;AAC5B,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"BottomSheet.web.js","sources":["../../../../../../src/components/BottomSheet/BottomSheet.web.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable react/jsx-no-useless-fragment */\n/* eslint-disable consistent-return */\n/* eslint-disable @typescript-eslint/explicit-function-return-type */\nimport React from 'react';\nimport styled from 'styled-components';\nimport { rubberbandIfOutOfBounds, useDrag } from '@use-gesture/react';\nimport usePresence from 'use-presence';\nimport { clearAllBodyScrollLocks, enableBodyScroll } from 'body-scroll-lock-upgrade';\nimport { BottomSheetHeader } from './BottomSheetHeader';\nimport { BottomSheetFooter } from './BottomSheetFooter';\nimport { BottomSheetBody } from './BottomSheetBody';\nimport type { SnapPoints } from './utils';\nimport { computeMaxContent, computeSnapPointBounds } from './utils';\nimport { BottomSheetBackdrop } from './BottomSheetBackdrop';\nimport type { BottomSheetContextProps } from './BottomSheetContext';\nimport { BottomSheetContext, useBottomSheetAndDropdownGlue } from './BottomSheetContext';\nimport { ComponentIds } from './componentIds';\nimport type { BottomSheetProps } from './types';\nimport { BottomSheetGrabHandle } from './BottomSheetGrabHandle';\nimport { useBottomSheetStack } from './BottomSheetStack';\nimport BaseBox from '~components/Box/BaseBox';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { useScrollLock } from '~utils/useScrollLock';\nimport { useWindowSize } from '~utils/useWindowSize';\nimport { useIsomorphicLayoutEffect } from '~utils/useIsomorphicLayoutEffect';\nimport { useTheme } from '~components/BladeProvider';\nimport { useId } from '~utils/useId';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeSize } from '~utils/makeSize';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { size } from '~tokens/global';\nimport { makeMotionTime } from '~utils/makeMotionTime';\nimport { componentZIndices } from '~utils/componentZIndices';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\nexport const BOTTOM_SHEET_EASING = 'cubic-bezier(.15,0,.24,.97)';\nconst AUTOCOMPLETE_DEFAULT_SNAPPOINT = 0.85;\n\nconst BottomSheetSurface = styled.div<{\n windowHeight: number;\n isDragging: boolean;\n}>(({ theme, windowHeight, isDragging }) => {\n return {\n background: theme.colors.popup.background.subtle,\n borderTopLeftRadius: makeSize(size[16]),\n borderTopRightRadius: makeSize(size[16]),\n borderColor: theme.colors.popup.border.subtle,\n // this is reverse top elevation of highRaised elevation token\n boxShadow: '0px -24px 48px -12px hsla(217, 56%, 17%, 0.18)',\n opacity: 0,\n pointerEvents: 'none',\n transitionDuration: isDragging\n ? undefined\n : `${makeMotionTime(theme.motion.duration.moderate)}`,\n transitionTimingFunction: BOTTOM_SHEET_EASING,\n willChange: 'transform, opacity, height',\n transitionProperty: 'transform, opacity, height',\n position: 'fixed',\n left: 0,\n right: 0,\n bottom: 0,\n top: windowHeight,\n backgroundColor: theme.colors.popup.background.subtle,\n justifyContent: 'center',\n alignItems: 'center',\n touchAction: 'none',\n overflow: 'hidden',\n };\n});\n\nconst _BottomSheet = ({\n isOpen,\n onDismiss,\n children,\n initialFocusRef,\n snapPoints = [0.35, 0.5, 0.85],\n zIndex = componentZIndices.bottomSheet,\n ...dataAnalyticsProps\n}: BottomSheetProps): React.ReactElement => {\n const { theme } = useTheme();\n const dimensions = useWindowSize();\n const [contentHeight, setContentHeight] = React.useState(0);\n const [headerHeight, setHeaderHeight] = React.useState(0);\n const [footerHeight, setFooterHeight] = React.useState(0);\n const [grabHandleHeight, setGrabHandleHeight] = React.useState(0);\n const [hasBodyPadding, setHasBodyPadding] = React.useState(true);\n const [isHeaderEmpty, setIsHeaderEmpty] = React.useState(false);\n\n const bottomSheetAndDropdownGlue = useBottomSheetAndDropdownGlue();\n const [positionY, _setPositionY] = React.useState(0);\n const _isOpen = isOpen ?? bottomSheetAndDropdownGlue?.isOpen;\n const [isDragging, setIsDragging] = React.useState(false);\n\n const preventScrollingRef = React.useRef(true);\n const scrollRef = React.useRef<HTMLDivElement>(null);\n const grabHandleRef = React.useRef<HTMLDivElement>(null);\n const defaultInitialFocusRef = React.useRef<any>(null);\n const originalFocusElement = React.useRef<HTMLElement | null>(null);\n const initialSnapPoint = React.useRef<number>(snapPoints[1]);\n const totalHeight = React.useMemo(() => {\n return grabHandleHeight + headerHeight + footerHeight + contentHeight;\n }, [contentHeight, footerHeight, grabHandleHeight, headerHeight]);\n\n const id = useId();\n const {\n stack,\n addBottomSheetToStack,\n removeBottomSheetFromStack,\n getTopOfTheStack,\n getCurrentStackIndexById,\n } = useBottomSheetStack();\n const currentStackIndex = getCurrentStackIndexById(id);\n const isOnTopOfStack = getTopOfTheStack() === id;\n const bottomSheetZIndex = zIndex - currentStackIndex;\n\n const setPositionY = React.useCallback(\n (value: number, limit = true) => {\n // In AutoComplete, we want BottomSheet to be docked to top snappoint so we remove the limits\n const shouldLimitPositionY = limit && !bottomSheetAndDropdownGlue?.hasAutoCompleteInHeader;\n\n const maxValue = computeMaxContent({\n contentHeight,\n footerHeight,\n // If headerHeight is zero no need to add height of grabHandleHeight.\n headerHeight: headerHeight > 0 ? headerHeight + grabHandleHeight : 0,\n maxHeight: value,\n });\n _setPositionY(shouldLimitPositionY ? maxValue : value);\n },\n [\n bottomSheetAndDropdownGlue?.hasAutoCompleteInHeader,\n contentHeight,\n footerHeight,\n grabHandleHeight,\n headerHeight,\n ],\n );\n\n // locks the body scroll to prevent accidental scrolling of content when we drag the sheet\n // We are ready when we calculated the height of the content\n const isReady = contentHeight > 0;\n // only lock the body when we atleast have 1 bottomsheet open\n const shouldLock = isReady && stack.length > 0;\n const scrollLockRef = useScrollLock({\n enabled: shouldLock,\n targetRef: scrollRef,\n reserveScrollBarGap: true,\n });\n\n // clear all body locks to avoid memory leaks & accidental body locking\n React.useEffect(() => {\n const hasNoBottomSheets = stack.length < 1;\n if (hasNoBottomSheets) {\n clearAllBodyScrollLocks();\n }\n }, [stack]);\n\n // take the grabHandle's height into headerHeight too\n useIsomorphicLayoutEffect(() => {\n if (!grabHandleRef.current) return;\n setGrabHandleHeight(grabHandleRef.current.getBoundingClientRect().height);\n }, [grabHandleRef.current, _isOpen]);\n\n // if bottomSheet height is >35% & <50% then set initial snapPoint to 35%\n useIsomorphicLayoutEffect(() => {\n if (bottomSheetAndDropdownGlue?.hasAutoCompleteInHeader) {\n initialSnapPoint.current = AUTOCOMPLETE_DEFAULT_SNAPPOINT;\n } else {\n const middleSnapPoint = snapPoints[1] * dimensions.height;\n const lowerSnapPoint = snapPoints[0] * dimensions.height;\n if (totalHeight > lowerSnapPoint && totalHeight < middleSnapPoint) {\n initialSnapPoint.current = snapPoints[0];\n }\n }\n }, [dimensions.height, snapPoints, totalHeight]);\n\n const returnFocus = React.useCallback(() => {\n if (!originalFocusElement.current) return;\n originalFocusElement.current.focus();\n // After returning focus we will clear the original focus\n // Because if sheet can be opened up via multiple triggers\n // We want to ensure the focus returns back to the most recent triggerer\n originalFocusElement.current = null;\n }, [originalFocusElement]);\n\n const focusOnInitialRef = React.useCallback(() => {\n if (!initialFocusRef) {\n // focus on close button\n defaultInitialFocusRef.current?.focus();\n } else {\n // focus on the initialRef passed by the user\n initialFocusRef.current?.focus();\n }\n }, [initialFocusRef]);\n\n // focus on the initial ref when the sheet is opened\n React.useLayoutEffect(() => {\n if (_isOpen) {\n focusOnInitialRef();\n }\n }, [_isOpen, focusOnInitialRef]);\n\n const handleOnOpen = React.useCallback(() => {\n setPositionY(dimensions.height * initialSnapPoint.current);\n scrollLockRef.current.activate();\n // initialize the original focused element\n // On first render it will be the activeElement, eg: the button trigger or select input\n // On Subsequent open operations it won't further update the original focus\n originalFocusElement.current =\n originalFocusElement.current ?? (document.activeElement as HTMLElement);\n }, [dimensions.height, scrollLockRef, setPositionY]);\n\n const handleOnClose = React.useCallback(() => {\n setPositionY(0);\n }, [setPositionY]);\n\n const close = React.useCallback(() => {\n onDismiss?.();\n bottomSheetAndDropdownGlue?.onBottomSheetDismiss();\n returnFocus();\n }, [bottomSheetAndDropdownGlue, onDismiss, returnFocus]);\n\n // sync controlled state to our actions\n React.useEffect(() => {\n if (_isOpen) {\n // open on the next frame, otherwise the animations will not run on first render\n window.setTimeout(() => {\n handleOnOpen();\n });\n } else {\n handleOnClose();\n }\n }, [_isOpen, handleOnClose, handleOnOpen]);\n\n // let the Dropdown component know that it's rendering a bottomsheet\n React.useEffect(() => {\n if (!bottomSheetAndDropdownGlue) return;\n bottomSheetAndDropdownGlue.setDropdownHasBottomSheet(true);\n }, [bottomSheetAndDropdownGlue]);\n\n const bind = useDrag(\n ({\n active,\n last,\n cancel,\n tap,\n movement: [_movementX, movementY],\n velocity: [_velocityX, velocityY],\n lastOffset: [_, lastOffsetY],\n down,\n dragging,\n args: [{ isContentDragging = false } = {}] = [],\n }) => {\n setIsDragging(Boolean(dragging));\n // lastOffsetY is the previous position user stopped dragging the sheet\n // movementY is the drag amount from the bottom of the screen, so as you drag up the movementY goes into negatives\n // and rawY is the calculated offset from the last position of the bottomsheet to current drag amount.\n const rawY = lastOffsetY - movementY;\n\n const lowerSnapPoint = dimensions.height * snapPoints[0];\n const upperSnapPoint = dimensions.height * snapPoints[snapPoints.length - 1];\n\n // predictedY is used to create velocity driven swipe\n // the faster you swipe the more distance you cover\n // this enables users to reach upper & lower snappoint with a single swipe\n const predictedDistance = movementY * (velocityY / 2);\n const predictedY = Math.max(\n lowerSnapPoint,\n Math.min(upperSnapPoint, rawY - predictedDistance * 2),\n );\n\n let newY = rawY;\n\n if (down) {\n // Ensure that users aren't able to drag the sheet\n // more than the upperSnapPoint or maximum height of the sheet\n // this is basically a clamp() function but creates a nice rubberband effect\n const dampening = 0.55;\n if (totalHeight < upperSnapPoint) {\n newY = rubberbandIfOutOfBounds(rawY, 0, totalHeight, dampening);\n } else {\n newY = rubberbandIfOutOfBounds(rawY, 0, upperSnapPoint, dampening);\n }\n } else {\n newY = predictedY;\n }\n\n const isPosAtUpperSnapPoint = newY >= upperSnapPoint;\n\n if (isContentDragging) {\n if (isPosAtUpperSnapPoint) {\n newY = upperSnapPoint;\n }\n\n // keep the newY at upper snap point\n // until the scrollable content is not at top\n // and previously saved Y position is greater than or equal to upper snap point\n // Note: how using newY won't work here since we need the previous value of the newY\n // since we always keep updating the newY,\n // this is cruicial in making the scroll feel natural\n const isContentScrolledAtTop = scrollRef.current && scrollRef.current.scrollTop <= 0;\n if (lastOffsetY === upperSnapPoint && !isContentScrolledAtTop) {\n newY = upperSnapPoint;\n }\n preventScrollingRef.current = newY < upperSnapPoint;\n }\n\n if (last) {\n // calculate the nearest snapPoint\n const [nearest, lower] = computeSnapPointBounds(\n newY,\n snapPoints.map((point) => dimensions.height * point) as SnapPoints,\n );\n\n // This ensure that the lower snapPoint will always have atleast some buffer\n // When the bottomsheet total height is less than the lower snapPoint\n // Video walkthrough: https://www.loom.com/share/a9a8db7688d64194b13df8b3e25859ae\n const lowerPointBuffer = 60;\n const lowerestSnap = Math.min(lower, totalHeight) - lowerPointBuffer;\n\n const shouldClose = rawY < lowerestSnap;\n if (shouldClose) {\n setIsDragging(false);\n cancel();\n close();\n return;\n }\n\n // if we stop dragging assign snap to the nearest point\n if (!active && !tap) {\n newY = nearest;\n }\n }\n\n setPositionY(newY, !down);\n },\n {\n from: [0, positionY],\n filterTaps: true,\n enabled: isOnTopOfStack && _isOpen,\n },\n );\n\n // Here we are preventing the scrolling of the content, until the preventScrollingRef value is true\n useIsomorphicLayoutEffect(() => {\n const scrollElement = scrollRef.current;\n if (!scrollElement) return;\n\n const preventScrolling = (e: Event) => {\n if (preventScrollingRef?.current) {\n e.preventDefault();\n }\n };\n\n // https://www.bram.us/2016/05/02/prevent-overscroll-bounce-in-ios-mobilesafari-pure-css/\n const preventSafariOverscroll = (e: Event) => {\n if (scrollElement.scrollTop < 0) {\n // TODO: figure this out, it doesn't seem to work >iOS12\n // requestAnimationFrame(() => {\n // elem.style.overflow = 'hidden';\n // elem.scrollTop = 0;\n // elem.style.removeProperty('overflow');\n // });\n e.preventDefault();\n }\n };\n\n scrollElement.addEventListener('scroll', preventScrolling);\n scrollElement.addEventListener('touchmove', preventScrolling);\n scrollElement.addEventListener('touchstart', preventSafariOverscroll);\n return () => {\n scrollElement.removeEventListener('scroll', preventScrolling);\n scrollElement.removeEventListener('touchmove', preventScrolling);\n scrollElement.removeEventListener('touchstart', preventSafariOverscroll);\n };\n // Only run this hook when we know all the layout calculations are done,\n // Otherwise the scrollRef.current will be null.\n // isReady prop will ensure that we are done measuring the content height\n }, [isReady]);\n\n // usePresence hook waits for the animation to finish before unmounting the component\n // It's similar to motion/react's usePresence hook\n // https://www.framer.com/docs/animate-presence/#usepresence\n const { isMounted, isVisible } = usePresence(Boolean(_isOpen), {\n transitionDuration: theme.motion.duration.moderate,\n });\n\n const isHeaderFloating = !hasBodyPadding && isHeaderEmpty;\n const contextValue: BottomSheetContextProps = React.useMemo(\n () => ({\n isInBottomSheet: true,\n isOpen: Boolean(isVisible),\n close,\n positionY,\n headerHeight,\n contentHeight,\n footerHeight,\n setContentHeight,\n setFooterHeight,\n setHeaderHeight,\n setHasBodyPadding,\n setIsHeaderEmpty,\n scrollRef,\n bind,\n defaultInitialFocusRef,\n isHeaderFloating,\n }),\n [\n isVisible,\n close,\n positionY,\n headerHeight,\n contentHeight,\n footerHeight,\n setContentHeight,\n setFooterHeight,\n setHeaderHeight,\n setHasBodyPadding,\n setIsHeaderEmpty,\n scrollRef,\n bind,\n defaultInitialFocusRef,\n isHeaderFloating,\n ],\n );\n\n React.useEffect(() => {\n if (isMounted) {\n addBottomSheetToStack(id);\n } else {\n removeBottomSheetFromStack(id);\n }\n }, [addBottomSheetToStack, id, isMounted, removeBottomSheetFromStack]);\n\n // Remove the bottomsheet from the stack, if it's unmounted forcefully\n React.useEffect(() => {\n return () => {\n if (id === undefined) return;\n removeBottomSheetFromStack(id);\n };\n }, [id, removeBottomSheetFromStack]);\n\n // Disable body scroll lock when the component is unmounted forcefully\n React.useEffect(() => {\n const lockTarget = scrollRef.current;\n return () => {\n if (lockTarget) {\n enableBodyScroll(lockTarget);\n }\n };\n // when BottomSheet is mounted with isOpen={false}, then BottomSheetBody does not set scrollRef\n // so, we added scrollRef to dependencies array to ensure that we update lockTarget when scrollRef is updated\n // which will avoid passing null to enableBodyScroll\n }, [scrollRef]);\n\n // We will need to reset these values otherwise the next time the bottomsheet opens\n // this will be populated and the animations won't run\n // why?: because how the usePresence hook works, we actually just unmount the\n // html contents not the whole <BottomSheet /> react component\n React.useEffect(() => {\n if (!isMounted) {\n setHeaderHeight(0);\n setFooterHeight(0);\n setContentHeight(0);\n setGrabHandleHeight(0);\n _setPositionY(0);\n }\n }, [isMounted, scrollLockRef]);\n\n // We don't want to destroy the react tree when we are rendering inside Dropdown\n // Because if we bail out early then ActionList won't render,\n // and Dropdown manages it's state based on the rendered JSX of ActionList\n // If we don't render ActionList Dropdown state will reset each time we open/close BottomSheet\n const isInsideDropdown = Boolean(bottomSheetAndDropdownGlue);\n if (!isMounted && !isInsideDropdown) {\n return <></>;\n }\n\n return (\n <BottomSheetContext.Provider value={contextValue}>\n <BottomSheetBackdrop zIndex={bottomSheetZIndex} />\n <BottomSheetSurface\n {...metaAttribute({\n name: MetaConstants.BottomSheet,\n testID: 'bottomsheet-surface',\n })}\n {...makeAccessible({ modal: true, role: 'dialog' })}\n windowHeight={dimensions.height}\n isDragging={isDragging}\n style={{\n opacity: isVisible ? 1 : 0,\n pointerEvents: isVisible ? 'all' : 'none',\n height: positionY,\n bottom: 0,\n top: 'auto',\n zIndex: bottomSheetZIndex,\n }}\n {...makeAnalyticsAttribute(dataAnalyticsProps)}\n >\n <BaseBox height=\"100%\" display=\"flex\" flexDirection=\"column\">\n <BottomSheetGrabHandle\n ref={grabHandleRef}\n isHeaderFloating={isHeaderFloating}\n {...metaAttribute({ name: ComponentIds.BottomSheetGrabHandle })}\n {...bind()}\n />\n {children}\n </BaseBox>\n </BottomSheetSurface>\n </BottomSheetContext.Provider>\n );\n};\n\nconst BottomSheet = assignWithoutSideEffects(_BottomSheet, {\n componentId: ComponentIds.BottomSheet,\n});\n\nexport { BottomSheet, BottomSheetBody, BottomSheetHeader, BottomSheetFooter };\nexport type { BottomSheetProps };\n"],"names":["BOTTOM_SHEET_EASING","AUTOCOMPLETE_DEFAULT_SNAPPOINT","BottomSheetSurface","styled","div","withConfig","displayName","componentId","_ref","theme","windowHeight","isDragging","background","colors","popup","subtle","borderTopLeftRadius","makeSize","size","borderTopRightRadius","borderColor","border","boxShadow","opacity","pointerEvents","transitionDuration","undefined","concat","makeMotionTime","motion","duration","moderate","transitionTimingFunction","willChange","transitionProperty","position","left","right","bottom","top","backgroundColor","justifyContent","alignItems","touchAction","overflow","_BottomSheet","_ref2","isOpen","onDismiss","children","initialFocusRef","_ref2$snapPoints","snapPoints","_ref2$zIndex","zIndex","componentZIndices","bottomSheet","dataAnalyticsProps","_objectWithoutProperties","_excluded","_useTheme","useTheme","dimensions","useWindowSize","_React$useState","React","useState","_React$useState2","_slicedToArray","contentHeight","setContentHeight","_React$useState3","_React$useState4","headerHeight","setHeaderHeight","_React$useState5","_React$useState6","footerHeight","setFooterHeight","_React$useState7","_React$useState8","grabHandleHeight","setGrabHandleHeight","_React$useState9","_React$useState10","hasBodyPadding","setHasBodyPadding","_React$useState11","_React$useState12","isHeaderEmpty","setIsHeaderEmpty","bottomSheetAndDropdownGlue","useBottomSheetAndDropdownGlue","_React$useState13","_React$useState14","positionY","_setPositionY","_isOpen","_React$useState15","_React$useState16","setIsDragging","preventScrollingRef","useRef","scrollRef","grabHandleRef","defaultInitialFocusRef","originalFocusElement","initialSnapPoint","totalHeight","useMemo","id","useId","_useBottomSheetStack","useBottomSheetStack","stack","addBottomSheetToStack","removeBottomSheetFromStack","getTopOfTheStack","getCurrentStackIndexById","currentStackIndex","isOnTopOfStack","bottomSheetZIndex","setPositionY","useCallback","value","limit","arguments","length","shouldLimitPositionY","hasAutoCompleteInHeader","maxValue","computeMaxContent","maxHeight","isReady","shouldLock","scrollLockRef","useScrollLock","enabled","targetRef","reserveScrollBarGap","useEffect","hasNoBottomSheets","clearAllBodyScrollLocks","useIsomorphicLayoutEffect","current","getBoundingClientRect","height","middleSnapPoint","lowerSnapPoint","returnFocus","focus","focusOnInitialRef","_defaultInitialFocusR","_initialFocusRef$curr","useLayoutEffect","handleOnOpen","_originalFocusElement","activate","document","activeElement","handleOnClose","close","onBottomSheetDismiss","window","setTimeout","setDropdownHasBottomSheet","bind","useDrag","_ref3","active","last","cancel","tap","_ref3$movement","movement","_movementX","movementY","_ref3$velocity","velocity","_velocityX","velocityY","_ref3$lastOffset","lastOffset","_","lastOffsetY","down","dragging","_ref3$args","args","_ref3$args2","_ref3$args3","_ref3$args3$","_ref3$args3$2","_ref3$args3$2$isConte","isContentDragging","Boolean","rawY","upperSnapPoint","predictedDistance","predictedY","Math","max","min","newY","dampening","rubberbandIfOutOfBounds","isPosAtUpperSnapPoint","isContentScrolledAtTop","scrollTop","_computeSnapPointBoun","computeSnapPointBounds","map","point","_computeSnapPointBoun2","nearest","lower","lowerPointBuffer","lowerestSnap","shouldClose","from","filterTaps","scrollElement","preventScrolling","e","preventDefault","preventSafariOverscroll","addEventListener","removeEventListener","_usePresence","usePresence","isMounted","isVisible","isHeaderFloating","contextValue","isInBottomSheet","lockTarget","enableBodyScroll","isInsideDropdown","_jsx","_Fragment","_jsxs","BottomSheetContext","Provider","BottomSheetBackdrop","_objectSpread","metaAttribute","name","MetaConstants","BottomSheet","testID","makeAccessible","modal","role","style","makeAnalyticsAttribute","BaseBox","display","flexDirection","BottomSheetGrabHandle","ref","ComponentIds","assignWithoutSideEffects"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCO,IAAMA,mBAAmB,GAAG,8BAA6B;AAChE,IAAMC,8BAA8B,GAAG,IAAI,CAAA;AAE3C,IAAMC,kBAAkB,gBAAGC,MAAM,CAACC,GAAG,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,oCAAA;EAAAC,WAAA,EAAA,UAAA;AAAA,CAGlC,CAAA,CAAA,UAAAC,IAAA,EAAyC;AAAA,EAAA,IAAtCC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,YAAY,GAAAF,IAAA,CAAZE,YAAY;IAAEC,UAAU,GAAAH,IAAA,CAAVG,UAAU,CAAA;EACnC,OAAO;IACLC,UAAU,EAAEH,KAAK,CAACI,MAAM,CAACC,KAAK,CAACF,UAAU,CAACG,MAAM;AAChDC,IAAAA,mBAAmB,EAAEC,QAAQ,CAACC,IAAI,CAAC,EAAE,CAAC,CAAC;AACvCC,IAAAA,oBAAoB,EAAEF,QAAQ,CAACC,IAAI,CAAC,EAAE,CAAC,CAAC;IACxCE,WAAW,EAAEX,KAAK,CAACI,MAAM,CAACC,KAAK,CAACO,MAAM,CAACN,MAAM;AAC7C;AACAO,IAAAA,SAAS,EAAE,gDAAgD;AAC3DC,IAAAA,OAAO,EAAE,CAAC;AACVC,IAAAA,aAAa,EAAE,MAAM;AACrBC,IAAAA,kBAAkB,EAAEd,UAAU,GAC1Be,SAAS,GAAA,EAAA,CAAAC,MAAA,CACNC,cAAc,CAACnB,KAAK,CAACoB,MAAM,CAACC,QAAQ,CAACC,QAAQ,CAAC,CAAE;AACvDC,IAAAA,wBAAwB,EAAEhC,mBAAmB;AAC7CiC,IAAAA,UAAU,EAAE,4BAA4B;AACxCC,IAAA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