@razorpay/blade 12.54.0 → 12.55.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lib/native/components/BottomSheet/BottomSheet.native.js +1 -1
- package/build/lib/native/components/BottomSheet/BottomSheet.native.js.map +1 -1
- package/build/lib/native/components/BottomSheet/BottomSheetBackdrop.native.js +1 -1
- package/build/lib/native/components/BottomSheet/BottomSheetBackdrop.native.js.map +1 -1
- package/build/lib/native/components/BottomSheet/BottomSheetCommon.js +1 -1
- package/build/lib/native/components/BottomSheet/BottomSheetCommon.js.map +1 -1
- package/build/lib/native/components/BottomSheet/BottomSheetContext.js +1 -1
- package/build/lib/native/components/BottomSheet/BottomSheetContext.js.map +1 -1
- package/build/lib/native/components/BottomSheet/BottomSheetHeader.native.js +1 -1
- package/build/lib/native/components/BottomSheet/BottomSheetHeader.native.js.map +1 -1
- package/build/lib/web/development/components/BottomSheet/BottomSheet.web.js +26 -10
- package/build/lib/web/development/components/BottomSheet/BottomSheet.web.js.map +1 -1
- package/build/lib/web/development/components/BottomSheet/BottomSheetBackdrop.web.js +5 -2
- package/build/lib/web/development/components/BottomSheet/BottomSheetBackdrop.web.js.map +1 -1
- package/build/lib/web/development/components/BottomSheet/BottomSheetCommon.js +5 -2
- package/build/lib/web/development/components/BottomSheet/BottomSheetCommon.js.map +1 -1
- package/build/lib/web/development/components/BottomSheet/BottomSheetContext.js +1 -0
- package/build/lib/web/development/components/BottomSheet/BottomSheetContext.js.map +1 -1
- package/build/lib/web/development/components/BottomSheet/BottomSheetHeader.web.js +4 -3
- package/build/lib/web/development/components/BottomSheet/BottomSheetHeader.web.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/BaseDatePicker.web.js +1 -0
- package/build/lib/web/development/components/DatePicker/BaseDatePicker.web.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/DropdownOverlay.web.js +8 -3
- package/build/lib/web/development/components/Dropdown/DropdownOverlay.web.js.map +1 -1
- package/build/lib/web/development/components/Modal/Modal.web.js +8 -5
- package/build/lib/web/development/components/Modal/Modal.web.js.map +1 -1
- package/build/lib/web/development/components/Modal/ModalBackdrop.js +5 -2
- package/build/lib/web/development/components/Modal/ModalBackdrop.js.map +1 -1
- package/build/lib/web/development/components/Modal/ModalContext.js +1 -0
- package/build/lib/web/development/components/Modal/ModalContext.js.map +1 -1
- package/build/lib/web/development/components/Modal/ModalHeader.web.js +7 -4
- package/build/lib/web/development/components/Modal/ModalHeader.web.js.map +1 -1
- package/build/lib/web/production/components/BottomSheet/BottomSheet.web.js +26 -10
- package/build/lib/web/production/components/BottomSheet/BottomSheet.web.js.map +1 -1
- package/build/lib/web/production/components/BottomSheet/BottomSheetBackdrop.web.js +5 -2
- package/build/lib/web/production/components/BottomSheet/BottomSheetBackdrop.web.js.map +1 -1
- package/build/lib/web/production/components/BottomSheet/BottomSheetCommon.js +5 -2
- package/build/lib/web/production/components/BottomSheet/BottomSheetCommon.js.map +1 -1
- package/build/lib/web/production/components/BottomSheet/BottomSheetContext.js +1 -0
- package/build/lib/web/production/components/BottomSheet/BottomSheetContext.js.map +1 -1
- package/build/lib/web/production/components/BottomSheet/BottomSheetHeader.web.js +4 -3
- package/build/lib/web/production/components/BottomSheet/BottomSheetHeader.web.js.map +1 -1
- package/build/lib/web/production/components/DatePicker/BaseDatePicker.web.js +1 -0
- package/build/lib/web/production/components/DatePicker/BaseDatePicker.web.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/DropdownOverlay.web.js +8 -3
- package/build/lib/web/production/components/Dropdown/DropdownOverlay.web.js.map +1 -1
- package/build/lib/web/production/components/Modal/Modal.web.js +8 -5
- package/build/lib/web/production/components/Modal/Modal.web.js.map +1 -1
- package/build/lib/web/production/components/Modal/ModalBackdrop.js +5 -2
- package/build/lib/web/production/components/Modal/ModalBackdrop.js.map +1 -1
- package/build/lib/web/production/components/Modal/ModalContext.js +1 -0
- package/build/lib/web/production/components/Modal/ModalContext.js.map +1 -1
- package/build/lib/web/production/components/Modal/ModalHeader.web.js +7 -4
- package/build/lib/web/production/components/Modal/ModalHeader.web.js.map +1 -1
- package/build/types/components/index.d.ts +15 -5
- package/build/types/components/index.native.d.ts +12 -2
- package/package.json +1 -1
|
@@ -22,7 +22,7 @@ import { getComponentId } from '../../utils/isValidAllowedChildren/isValidAllowe
|
|
|
22
22
|
import { componentZIndices } from '../../utils/componentZIndices.js';
|
|
23
23
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
24
24
|
|
|
25
|
-
var BottomSheetSurface=styled(BaseBox)(function(_ref){var theme=_ref.theme;return {borderTopLeftRadius:makeSpace(theme.spacing[5]),borderTopRightRadius:makeSpace(theme.spacing[5]),backgroundColor:theme.colors.popup.background.subtle,justifyContent:'center',alignItems:'center',position:'relative'};});var focusOnElement=function focusOnElement(element){var reactTag=findNodeHandle(element);if(reactTag){AccessibilityInfo.setAccessibilityFocus(reactTag);}};var _BottomSheet=function _BottomSheet(_ref2){var children=_ref2.children,_ref2$snapPoints=_ref2.snapPoints,snapPoints=_ref2$snapPoints===void 0?[0.35,0.5,0.85]:_ref2$snapPoints,isOpen=_ref2.isOpen,onDismiss=_ref2.onDismiss,initialFocusRef=_ref2.initialFocusRef,_ref2$zIndex=_ref2.zIndex,zIndex=_ref2$zIndex===void 0?componentZIndices.bottomSheet:_ref2$zIndex;var bottomSheetAndDropdownGlue=useBottomSheetAndDropdownGlue();var defaultInitialFocusRef=React__default.useRef(null);var sheetRef=React__default.useRef(null);var _React$useState=React__default.useState(),_React$useState2=_slicedToArray(_React$useState,2),header=_React$useState2[0],setHeader=_React$useState2[1];var _React$useState3=React__default.useState(),_React$useState4=_slicedToArray(_React$useState3,2),footer=_React$useState4[0],setFooter=_React$useState4[1];var _React$useState5=React__default.useState(),_React$useState6=_slicedToArray(_React$useState5,2),body=_React$useState6[0],setBody=_React$useState6[1];var _isOpen=isOpen!=null?isOpen:bottomSheetAndDropdownGlue==null?void 0:bottomSheetAndDropdownGlue.isOpen;var _React$useState7=React__default.useState(0),_React$useState8=_slicedToArray(_React$useState7,2),headerHeight=_React$useState8[0],setHeaderHeight=_React$useState8[1];var _React$useState9=React__default.useState(0),_React$useState0=_slicedToArray(_React$useState9,2),footerHeight=_React$useState0[0],setFooterHeight=_React$useState0[1];var _React$useState1=React__default.useState(0),_React$useState10=_slicedToArray(_React$useState1,2),contentHeight=_React$useState10[0],setContentHeight=_React$useState10[1];var _React$useState11=React__default.useState(true),_React$useState12=_slicedToArray(_React$useState11,2),hasBodyPadding=_React$useState12[0],setHasBodyPadding=_React$useState12[1];var _React$useState13=React__default.useState(false),_React$useState14=_slicedToArray(_React$useState13,2),isHeaderEmpty=_React$useState14[0],setIsHeaderEmpty=_React$useState14[1];var initialSnapPoint=React__default.useRef(0);var totalHeight=React__default.useMemo(function(){return headerHeight+footerHeight+contentHeight;},[contentHeight,footerHeight,headerHeight]);var id=useId();var _useBottomSheetStack=useBottomSheetStack(),addBottomSheetToStack=_useBottomSheetStack.addBottomSheetToStack,removeBottomSheetFromStack=_useBottomSheetStack.removeBottomSheetFromStack,getCurrentStackIndexById=_useBottomSheetStack.getCurrentStackIndexById,getTopOfTheStack=_useBottomSheetStack.getTopOfTheStack;var currentStackIndex=getCurrentStackIndexById(id);var bottomSheetZIndex=zIndex-currentStackIndex;useIsomorphicLayoutEffect(function(){if(bottomSheetAndDropdownGlue!=null&&bottomSheetAndDropdownGlue.hasAutoCompleteInHeader){initialSnapPoint.current=2;}else {var height=Dimensions.get('window').height;var middleSnapPoint=snapPoints[1]*height;if(totalHeight>middleSnapPoint){initialSnapPoint.current=1;}}},[snapPoints,totalHeight]);var _snapPoints=React__default.useMemo(function(){return snapPoints.map(function(point){return `${point*100}%`;});},[snapPoints]);var close=React__default.useCallback(function(){onDismiss==null?void 0:onDismiss();bottomSheetAndDropdownGlue==null?void 0:bottomSheetAndDropdownGlue.onBottomSheetDismiss();},[
|
|
25
|
+
var BottomSheetSurface=styled(BaseBox)(function(_ref){var theme=_ref.theme;return {borderTopLeftRadius:makeSpace(theme.spacing[5]),borderTopRightRadius:makeSpace(theme.spacing[5]),backgroundColor:theme.colors.popup.background.subtle,justifyContent:'center',alignItems:'center',position:'relative'};});var focusOnElement=function focusOnElement(element){var reactTag=findNodeHandle(element);if(reactTag){AccessibilityInfo.setAccessibilityFocus(reactTag);}};var _BottomSheet=function _BottomSheet(_ref2){var children=_ref2.children,_ref2$snapPoints=_ref2.snapPoints,snapPoints=_ref2$snapPoints===void 0?[0.35,0.5,0.85]:_ref2$snapPoints,isOpen=_ref2.isOpen,onDismiss=_ref2.onDismiss,_ref2$isDismissible=_ref2.isDismissible,isDismissible=_ref2$isDismissible===void 0?true:_ref2$isDismissible,initialFocusRef=_ref2.initialFocusRef,_ref2$zIndex=_ref2.zIndex,zIndex=_ref2$zIndex===void 0?componentZIndices.bottomSheet:_ref2$zIndex;var bottomSheetAndDropdownGlue=useBottomSheetAndDropdownGlue();var defaultInitialFocusRef=React__default.useRef(null);var sheetRef=React__default.useRef(null);var _React$useState=React__default.useState(),_React$useState2=_slicedToArray(_React$useState,2),header=_React$useState2[0],setHeader=_React$useState2[1];var _React$useState3=React__default.useState(),_React$useState4=_slicedToArray(_React$useState3,2),footer=_React$useState4[0],setFooter=_React$useState4[1];var _React$useState5=React__default.useState(),_React$useState6=_slicedToArray(_React$useState5,2),body=_React$useState6[0],setBody=_React$useState6[1];var _isOpen=isOpen!=null?isOpen:bottomSheetAndDropdownGlue==null?void 0:bottomSheetAndDropdownGlue.isOpen;var _React$useState7=React__default.useState(0),_React$useState8=_slicedToArray(_React$useState7,2),headerHeight=_React$useState8[0],setHeaderHeight=_React$useState8[1];var _React$useState9=React__default.useState(0),_React$useState0=_slicedToArray(_React$useState9,2),footerHeight=_React$useState0[0],setFooterHeight=_React$useState0[1];var _React$useState1=React__default.useState(0),_React$useState10=_slicedToArray(_React$useState1,2),contentHeight=_React$useState10[0],setContentHeight=_React$useState10[1];var _React$useState11=React__default.useState(true),_React$useState12=_slicedToArray(_React$useState11,2),hasBodyPadding=_React$useState12[0],setHasBodyPadding=_React$useState12[1];var _React$useState13=React__default.useState(false),_React$useState14=_slicedToArray(_React$useState13,2),isHeaderEmpty=_React$useState14[0],setIsHeaderEmpty=_React$useState14[1];var initialSnapPoint=React__default.useRef(0);var totalHeight=React__default.useMemo(function(){return headerHeight+footerHeight+contentHeight;},[contentHeight,footerHeight,headerHeight]);var id=useId();var _useBottomSheetStack=useBottomSheetStack(),addBottomSheetToStack=_useBottomSheetStack.addBottomSheetToStack,removeBottomSheetFromStack=_useBottomSheetStack.removeBottomSheetFromStack,getCurrentStackIndexById=_useBottomSheetStack.getCurrentStackIndexById,getTopOfTheStack=_useBottomSheetStack.getTopOfTheStack;var currentStackIndex=getCurrentStackIndexById(id);var bottomSheetZIndex=zIndex-currentStackIndex;useIsomorphicLayoutEffect(function(){if(bottomSheetAndDropdownGlue!=null&&bottomSheetAndDropdownGlue.hasAutoCompleteInHeader){initialSnapPoint.current=2;}else {var height=Dimensions.get('window').height;var middleSnapPoint=snapPoints[1]*height;if(totalHeight>middleSnapPoint){initialSnapPoint.current=1;}}},[snapPoints,totalHeight]);var _snapPoints=React__default.useMemo(function(){return snapPoints.map(function(point){return `${point*100}%`;});},[snapPoints]);var close=React__default.useCallback(function(){if(isDismissible){onDismiss==null?void 0:onDismiss();bottomSheetAndDropdownGlue==null?void 0:bottomSheetAndDropdownGlue.onBottomSheetDismiss==null?void 0:bottomSheetAndDropdownGlue.onBottomSheetDismiss();}},[isDismissible,onDismiss,bottomSheetAndDropdownGlue]);var handleOnOpen=React__default.useCallback(function(){var _sheetRef$current;(_sheetRef$current=sheetRef.current)==null?void 0:_sheetRef$current.snapToIndex(initialSnapPoint.current);},[]);var handleOnClose=React__default.useCallback(function(){var _sheetRef$current2;(_sheetRef$current2=sheetRef.current)==null?void 0:_sheetRef$current2.close();Keyboard.dismiss();},[sheetRef]);React__default.useEffect(function(){if(_isOpen){handleOnOpen();if(!initialFocusRef){focusOnElement(defaultInitialFocusRef.current);}else {focusOnElement(initialFocusRef.current);}}else {handleOnClose();}},[_isOpen,handleOnClose,handleOnOpen,initialFocusRef]);React__default.useEffect(function(){if(!bottomSheetAndDropdownGlue)return;bottomSheetAndDropdownGlue.setDropdownHasBottomSheet(true);},[bottomSheetAndDropdownGlue]);React__default.useLayoutEffect(function(){React__default.Children.forEach(children,function(child){if(getComponentId(child)===ComponentIds.BottomSheetHeader){setHeader(child);}if(getComponentId(child)===ComponentIds.BottomSheetFooter){setFooter(child);}if(getComponentId(child)===ComponentIds.BottomSheetBody){setBody(child);}});},[children]);var renderFooter=React__default.useCallback(function(props){return jsx(BottomSheetFooter,Object.assign({},props,{children:jsx(View,{onLayout:function onLayout(event){setFooterHeight(event.nativeEvent.layout.height);},children:footer})}));},[footer]);var renderBackdrop=React__default.useCallback(function(props){return jsx(BottomSheetBackdrop,Object.assign({},props,{zIndex:bottomSheetZIndex}));},[bottomSheetZIndex]);var renderHandle=React__default.useCallback(function(){return jsxs(BaseBox,{position:isHeaderEmpty?'absolute':'relative',top:"spacing.0",left:"spacing.0",right:"spacing.0",onLayout:function onLayout(_ref3){var nativeEvent=_ref3.nativeEvent;setHeaderHeight(nativeEvent.layout.height);},children:[jsx(BaseBox,{zIndex:bottomSheetZIndex,children:jsx(BottomSheetGrabHandle,{})}),header]});},[isHeaderEmpty,bottomSheetZIndex,header]);var isHeaderFloating=!hasBodyPadding&&isHeaderEmpty;var contextValue=React__default.useMemo(function(){return {isInBottomSheet:true,isOpen:Boolean(_isOpen),close:handleOnClose,positionY:0,headerHeight:headerHeight,contentHeight:contentHeight,footerHeight:footerHeight,setContentHeight:setContentHeight,setFooterHeight:setFooterHeight,setHeaderHeight:setHeaderHeight,isDismissible:isDismissible,scrollRef:function scrollRef(){},bind:{},defaultInitialFocusRef:defaultInitialFocusRef,isHeaderFloating:isHeaderFloating,setHasBodyPadding:setHasBodyPadding,setIsHeaderEmpty:setIsHeaderEmpty};},[_isOpen,contentHeight,footerHeight,handleOnClose,headerHeight,isHeaderFloating,isDismissible]);var dropdownProps=useDropdown();React__default.useEffect(function(){if(_isOpen){addBottomSheetToStack(id);}else {removeBottomSheetFromStack(id);}},[addBottomSheetToStack,_isOpen,id,removeBottomSheetFromStack]);React__default.useEffect(function(){var showSubscription=Keyboard.addListener('keyboardDidShow',function(){if(id&&id===getTopOfTheStack()){var _sheetRef$current3;(_sheetRef$current3=sheetRef.current)==null?void 0:_sheetRef$current3.expand();}});return function(){showSubscription.remove();};},[getTopOfTheStack,id]);return jsx(Portal,{hostName:"BladeBottomSheetPortal",children:jsx(DropdownContext.Provider,{value:dropdownProps,children:jsx(BottomSheetContext.Provider,{value:contextValue,children:jsx(GorhomBottomSheet,{style:isOpen?{shadowColor:'hsla(217,56%,17%,0.64)',shadowOffset:{width:0,height:-18},shadowOpacity:0.2,shadowRadius:12}:{},enablePanDownToClose:isDismissible,enableOverDrag:true,enableContentPanningGesture:true,ref:sheetRef,index:_isOpen?initialSnapPoint.current:-1,containerStyle:{zIndex:bottomSheetZIndex},animateOnMount:true,handleComponent:renderHandle,backgroundComponent:BottomSheetSurface,footerComponent:renderFooter,backdropComponent:renderBackdrop,onClose:close,snapPoints:_snapPoints,children:body})})})});};var BottomSheet=assignWithoutSideEffects(_BottomSheet,{componentId:ComponentIds.BottomSheet});
|
|
26
26
|
|
|
27
27
|
export { BottomSheet };
|
|
28
28
|
//# sourceMappingURL=BottomSheet.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.native.js","sources":["../../../../../src/components/BottomSheet/BottomSheet.native.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */\n/* eslint-disable @typescript-eslint/no-empty-function */\nimport GorhomBottomSheet, {\n BottomSheetFooter as GorhomBottomSheetFooter,\n} from '@gorhom/bottom-sheet';\nimport React from 'react';\nimport { Portal } from '@gorhom/portal';\nimport styled from 'styled-components/native';\nimport { Dimensions, AccessibilityInfo, findNodeHandle, View, Keyboard } from 'react-native';\nimport { BottomSheetHeader } from './BottomSheetHeader';\nimport { BottomSheetGrabHandle } from './BottomSheetGrabHandle';\nimport { BottomSheetBody } from './BottomSheetBody';\nimport { BottomSheetFooter } from './BottomSheetFooter';\nimport type { BottomSheetProps } from './types';\nimport { ComponentIds } from './componentIds';\nimport type { BottomSheetContextProps } from './BottomSheetContext';\nimport { BottomSheetContext, useBottomSheetAndDropdownGlue } from './BottomSheetContext';\nimport { BottomSheetBackdrop } from './BottomSheetBackdrop';\nimport { useBottomSheetStack } from './BottomSheetStack';\nimport { DropdownContext, useDropdown } from '~components/Dropdown/useDropdown';\nimport BaseBox from '~components/Box/BaseBox';\nimport { useId } from '~utils/useId';\nimport { useIsomorphicLayoutEffect } from '~utils/useIsomorphicLayoutEffect';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeSpace } from '~utils/makeSpace';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { componentZIndices } from '~utils/componentZIndices';\n\nconst BottomSheetSurface = styled(BaseBox)(({ theme }) => {\n return {\n // TODO: we do not have 16px radius token\n borderTopLeftRadius: makeSpace(theme.spacing[5]),\n borderTopRightRadius: makeSpace(theme.spacing[5]),\n backgroundColor: theme.colors.popup.background.subtle,\n justifyContent: 'center',\n alignItems: 'center',\n position: 'relative',\n };\n});\n\nconst focusOnElement = (element: React.Component<any, any>): void => {\n const reactTag = findNodeHandle(element);\n if (reactTag) {\n AccessibilityInfo.setAccessibilityFocus(reactTag);\n }\n};\n\nconst _BottomSheet = ({\n children,\n snapPoints = [0.35, 0.5, 0.85],\n isOpen,\n onDismiss,\n initialFocusRef,\n zIndex = componentZIndices.bottomSheet,\n}: BottomSheetProps): React.ReactElement => {\n const bottomSheetAndDropdownGlue = useBottomSheetAndDropdownGlue();\n const defaultInitialFocusRef = React.useRef<any>(null);\n const sheetRef = React.useRef<GorhomBottomSheet>(null);\n const [header, setHeader] = React.useState<React.ReactNode>();\n const [footer, setFooter] = React.useState<React.ReactNode>();\n const [body, setBody] = React.useState<React.ReactNode>();\n const _isOpen = isOpen ?? bottomSheetAndDropdownGlue?.isOpen;\n const [headerHeight, setHeaderHeight] = React.useState(0);\n const [footerHeight, setFooterHeight] = React.useState(0);\n const [contentHeight, setContentHeight] = React.useState(0);\n const [hasBodyPadding, setHasBodyPadding] = React.useState(true);\n const [isHeaderEmpty, setIsHeaderEmpty] = React.useState(false);\n const initialSnapPoint = React.useRef<number>(0);\n const totalHeight = React.useMemo(() => {\n return headerHeight + footerHeight + contentHeight;\n }, [contentHeight, footerHeight, headerHeight]);\n\n const id = useId();\n const {\n addBottomSheetToStack,\n removeBottomSheetFromStack,\n getCurrentStackIndexById,\n getTopOfTheStack,\n } = useBottomSheetStack();\n const currentStackIndex = getCurrentStackIndexById(id);\n const bottomSheetZIndex = zIndex - currentStackIndex;\n\n // if bottomSheet height is >35% & <50% then set initial snapPoint to 35%\n useIsomorphicLayoutEffect(() => {\n if (bottomSheetAndDropdownGlue?.hasAutoCompleteInHeader) {\n // In AutoComplete, we want to open BottomSheet with max height so we set this to last index\n initialSnapPoint.current = 2;\n } else {\n const height = Dimensions.get('window').height;\n const middleSnapPoint = snapPoints[1] * height;\n if (totalHeight > middleSnapPoint) {\n initialSnapPoint.current = 1;\n }\n }\n }, [snapPoints, totalHeight]);\n\n const _snapPoints = React.useMemo(() => snapPoints.map((point) => `${point * 100}%`), [\n snapPoints,\n ]);\n\n const close = React.useCallback(() => {\n onDismiss?.();\n bottomSheetAndDropdownGlue?.onBottomSheetDismiss();\n }, [bottomSheetAndDropdownGlue, onDismiss]);\n\n const handleOnOpen = React.useCallback(() => {\n sheetRef.current?.snapToIndex(initialSnapPoint.current);\n }, []);\n\n const handleOnClose = React.useCallback(() => {\n sheetRef.current?.close();\n // We need this because if inside the BottomSheet there is a input which is focused\n // and user dragged down to close the sheet, even after closing the sheet the input will remain focused\n Keyboard.dismiss();\n }, [sheetRef]);\n\n // sync controlled state to our actions\n React.useEffect(() => {\n if (_isOpen) {\n handleOnOpen();\n if (!initialFocusRef) {\n // focus on close button\n focusOnElement(defaultInitialFocusRef.current);\n } else {\n // focus on the initialRef\n focusOnElement(initialFocusRef.current);\n }\n } else {\n handleOnClose();\n }\n }, [_isOpen, handleOnClose, handleOnOpen, initialFocusRef]);\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 React.useLayoutEffect(() => {\n React.Children.forEach(children, (child) => {\n if (getComponentId(child) === ComponentIds.BottomSheetHeader) {\n setHeader(child);\n }\n if (getComponentId(child) === ComponentIds.BottomSheetFooter) {\n setFooter(child);\n }\n if (getComponentId(child) === ComponentIds.BottomSheetBody) {\n setBody(child);\n }\n });\n }, [children]);\n\n const renderFooter = React.useCallback(\n (props: any): React.ReactElement => {\n return (\n <GorhomBottomSheetFooter {...props}>\n <View\n onLayout={(event) => {\n // save footer height so that later we can offset the marginBottom from body content\n // otherwise few elements gets hidden under the footer\n setFooterHeight(event.nativeEvent.layout.height);\n }}\n >\n {footer}\n </View>\n </GorhomBottomSheetFooter>\n );\n },\n [footer],\n );\n\n const renderBackdrop = React.useCallback(\n (props: any): React.ReactElement => {\n return <BottomSheetBackdrop {...props} zIndex={bottomSheetZIndex} />;\n },\n [bottomSheetZIndex],\n );\n\n const renderHandle = React.useCallback((): React.ReactElement => {\n return (\n <BaseBox\n position={isHeaderEmpty ? 'absolute' : 'relative'}\n top=\"spacing.0\"\n left=\"spacing.0\"\n right=\"spacing.0\"\n onLayout={({ nativeEvent }) => {\n setHeaderHeight(nativeEvent.layout.height);\n }}\n >\n <BaseBox zIndex={bottomSheetZIndex}>\n <BottomSheetGrabHandle />\n </BaseBox>\n {header}\n </BaseBox>\n );\n }, [isHeaderEmpty, bottomSheetZIndex, header]);\n\n const isHeaderFloating = !hasBodyPadding && isHeaderEmpty;\n const contextValue = React.useMemo<BottomSheetContextProps>(\n () => ({\n isInBottomSheet: true,\n isOpen: Boolean(_isOpen),\n close: handleOnClose,\n positionY: 0,\n headerHeight,\n contentHeight,\n footerHeight,\n setContentHeight,\n setFooterHeight,\n setHeaderHeight,\n scrollRef: () => {},\n bind: {} as never,\n defaultInitialFocusRef,\n isHeaderFloating,\n setHasBodyPadding,\n setIsHeaderEmpty,\n }),\n [_isOpen, contentHeight, footerHeight, handleOnClose, headerHeight, isHeaderFloating],\n );\n\n // Hack: We need to <Portal> the GorhomBottomSheet to the root of the react-native app\n // But the portalled component will no longer be able to access the parent contexts (Dropdown Context)\n // To workaround this, I'm portalling both the DropdownContext & BotomSheetContext along with the component\n const dropdownProps = useDropdown();\n\n // register and deregister in the stack\n React.useEffect(() => {\n if (_isOpen) {\n addBottomSheetToStack(id);\n } else {\n removeBottomSheetFromStack(id);\n }\n }, [addBottomSheetToStack, _isOpen, id, removeBottomSheetFromStack]);\n\n // Handle TextInput inside BottomSheet\n // We expand the BottomSheet to the max snapPoint so that when the keyboard opens\n // the body content will be visible\n // There is a standard way to do this:\n // https://gorhom.github.io/react-native-bottom-sheet/keyboard-handling\n // But this didn't worked because:\n // https://github.com/gorhom/react-native-bottom-sheet/issues/618\n React.useEffect(() => {\n const showSubscription = Keyboard.addListener('keyboardDidShow', () => {\n if (id && id === getTopOfTheStack()) {\n sheetRef.current?.expand();\n }\n });\n return () => {\n showSubscription.remove();\n };\n }, [getTopOfTheStack, id]);\n\n return (\n <Portal hostName=\"BladeBottomSheetPortal\">\n {/* Portalling both the context */}\n <DropdownContext.Provider value={dropdownProps}>\n <BottomSheetContext.Provider value={contextValue}>\n <GorhomBottomSheet\n style={\n // only render shadow when the sheet is open,\n // otherwise there is visible shadow leak from the bottom edge of the screen\n isOpen\n ? {\n // this is reverse top elevation of highRaised elevation token\n shadowColor: 'hsla(217,56%,17%,0.64)',\n shadowOffset: {\n width: 0,\n height: -18,\n },\n shadowOpacity: 0.2,\n shadowRadius: 12,\n // this fails on andorid because its not handled on GorhomBottomSheet internally, hence tradeoff but its fine because visually this barely makes any difference its that nice design detail\n // elevation: 40,\n }\n : {}\n }\n enablePanDownToClose\n enableOverDrag\n enableContentPanningGesture\n ref={sheetRef}\n // on initial render if _isOpen is true we want to render the sheet at initialSnapPoint\n // otherwise we want to render it at -1 so that it is not visible\n index={_isOpen ? initialSnapPoint.current : -1}\n containerStyle={{ zIndex: bottomSheetZIndex }}\n animateOnMount={true}\n handleComponent={renderHandle}\n backgroundComponent={BottomSheetSurface}\n footerComponent={renderFooter}\n backdropComponent={renderBackdrop}\n onClose={close}\n snapPoints={_snapPoints}\n >\n {body}\n </GorhomBottomSheet>\n </BottomSheetContext.Provider>\n </DropdownContext.Provider>\n </Portal>\n );\n};\n\nconst BottomSheet = assignWithoutSideEffects(_BottomSheet, {\n componentId: ComponentIds.BottomSheet,\n});\n\nexport { BottomSheet, BottomSheetBody, BottomSheetFooter, BottomSheetHeader };\n"],"names":["BottomSheetSurface","styled","BaseBox","_ref","theme","borderTopLeftRadius","makeSpace","spacing","borderTopRightRadius","backgroundColor","colors","popup","background","subtle","justifyContent","alignItems","position","focusOnElement","element","reactTag","findNodeHandle","AccessibilityInfo","setAccessibilityFocus","_BottomSheet","_ref2","children","_ref2$snapPoints","snapPoints","isOpen","onDismiss","initialFocusRef","_ref2$zIndex","zIndex","componentZIndices","bottomSheet","bottomSheetAndDropdownGlue","useBottomSheetAndDropdownGlue","defaultInitialFocusRef","React","useRef","sheetRef","_React$useState","useState","_React$useState2","_slicedToArray","header","setHeader","_React$useState3","_React$useState4","footer","setFooter","_React$useState5","_React$useState6","body","setBody","_isOpen","_React$useState7","_React$useState8","headerHeight","setHeaderHeight","_React$useState9","_React$useState0","footerHeight","setFooterHeight","_React$useState1","_React$useState10","contentHeight","setContentHeight","_React$useState11","_React$useState12","hasBodyPadding","setHasBodyPadding","_React$useState13","_React$useState14","isHeaderEmpty","setIsHeaderEmpty","initialSnapPoint","totalHeight","useMemo","id","useId","_useBottomSheetStack","useBottomSheetStack","addBottomSheetToStack","removeBottomSheetFromStack","getCurrentStackIndexById","getTopOfTheStack","currentStackIndex","bottomSheetZIndex","useIsomorphicLayoutEffect","hasAutoCompleteInHeader","current","height","Dimensions","get","middleSnapPoint","_snapPoints","map","point","close","useCallback","onBottomSheetDismiss","handleOnOpen","_sheetRef$current","snapToIndex","handleOnClose","_sheetRef$current2","Keyboard","dismiss","useEffect","setDropdownHasBottomSheet","useLayoutEffect","Children","forEach","child","getComponentId","ComponentIds","BottomSheetHeader","BottomSheetFooter","BottomSheetBody","renderFooter","props","_jsx","GorhomBottomSheetFooter","Object","assign","View","onLayout","event","nativeEvent","layout","renderBackdrop","BottomSheetBackdrop","renderHandle","_jsxs","top","left","right","_ref3","BottomSheetGrabHandle","isHeaderFloating","contextValue","isInBottomSheet","Boolean","positionY","scrollRef","bind","dropdownProps","useDropdown","showSubscription","addListener","_sheetRef$current3","expand","remove","Portal","hostName","DropdownContext","Provider","value","BottomSheetContext","GorhomBottomSheet","style","shadowColor","shadowOffset","width","shadowOpacity","shadowRadius","enablePanDownToClose","enableOverDrag","enableContentPanningGesture","ref","index","containerStyle","animateOnMount","handleComponent","backgroundComponent","footerComponent","backdropComponent","onClose","BottomSheet","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA6BA,IAAMA,kBAAkB,CAAGC,MAAM,CAACC,OAAO,CAAC,CAAC,SAAAC,IAAA,CAAe,CAAZ,IAAAC,KAAK,CAAAD,IAAA,CAALC,KAAK,CACjD,OAAO,CAELC,mBAAmB,CAAEC,SAAS,CAACF,KAAK,CAACG,OAAO,CAAC,CAAC,CAAC,CAAC,CAChDC,oBAAoB,CAAEF,SAAS,CAACF,KAAK,CAACG,OAAO,CAAC,CAAC,CAAC,CAAC,CACjDE,eAAe,CAAEL,KAAK,CAACM,MAAM,CAACC,KAAK,CAACC,UAAU,CAACC,MA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BottomSheet.native.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */\n/* eslint-disable @typescript-eslint/no-empty-function */\nimport GorhomBottomSheet, {\n BottomSheetFooter as GorhomBottomSheetFooter,\n} from '@gorhom/bottom-sheet';\nimport React from 'react';\nimport { Portal } from '@gorhom/portal';\nimport styled from 'styled-components/native';\nimport { Dimensions, AccessibilityInfo, findNodeHandle, View, Keyboard } from 'react-native';\nimport { BottomSheetHeader } from './BottomSheetHeader';\nimport { BottomSheetGrabHandle } from './BottomSheetGrabHandle';\nimport { BottomSheetBody } from './BottomSheetBody';\nimport { BottomSheetFooter } from './BottomSheetFooter';\nimport type { BottomSheetProps } from './types';\nimport { ComponentIds } from './componentIds';\nimport type { BottomSheetContextProps } from './BottomSheetContext';\nimport { BottomSheetContext, useBottomSheetAndDropdownGlue } from './BottomSheetContext';\nimport { BottomSheetBackdrop } from './BottomSheetBackdrop';\nimport { useBottomSheetStack } from './BottomSheetStack';\nimport { DropdownContext, useDropdown } from '~components/Dropdown/useDropdown';\nimport BaseBox from '~components/Box/BaseBox';\nimport { useId } from '~utils/useId';\nimport { useIsomorphicLayoutEffect } from '~utils/useIsomorphicLayoutEffect';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeSpace } from '~utils/makeSpace';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { componentZIndices } from '~utils/componentZIndices';\n\nconst BottomSheetSurface = styled(BaseBox)(({ theme }) => {\n return {\n // TODO: we do not have 16px radius token\n borderTopLeftRadius: makeSpace(theme.spacing[5]),\n borderTopRightRadius: makeSpace(theme.spacing[5]),\n backgroundColor: theme.colors.popup.background.subtle,\n justifyContent: 'center',\n alignItems: 'center',\n position: 'relative',\n };\n});\n\nconst focusOnElement = (element: React.Component<any, any>): void => {\n const reactTag = findNodeHandle(element);\n if (reactTag) {\n AccessibilityInfo.setAccessibilityFocus(reactTag);\n }\n};\n\nconst _BottomSheet = ({\n children,\n snapPoints = [0.35, 0.5, 0.85],\n isOpen,\n onDismiss,\n isDismissible = true,\n initialFocusRef,\n zIndex = componentZIndices.bottomSheet,\n}: BottomSheetProps): React.ReactElement => {\n const bottomSheetAndDropdownGlue = useBottomSheetAndDropdownGlue();\n const defaultInitialFocusRef = React.useRef<any>(null);\n const sheetRef = React.useRef<GorhomBottomSheet>(null);\n const [header, setHeader] = React.useState<React.ReactNode>();\n const [footer, setFooter] = React.useState<React.ReactNode>();\n const [body, setBody] = React.useState<React.ReactNode>();\n const _isOpen = isOpen ?? bottomSheetAndDropdownGlue?.isOpen;\n const [headerHeight, setHeaderHeight] = React.useState(0);\n const [footerHeight, setFooterHeight] = React.useState(0);\n const [contentHeight, setContentHeight] = React.useState(0);\n const [hasBodyPadding, setHasBodyPadding] = React.useState(true);\n const [isHeaderEmpty, setIsHeaderEmpty] = React.useState(false);\n const initialSnapPoint = React.useRef<number>(0);\n const totalHeight = React.useMemo(() => {\n return headerHeight + footerHeight + contentHeight;\n }, [contentHeight, footerHeight, headerHeight]);\n\n const id = useId();\n const {\n addBottomSheetToStack,\n removeBottomSheetFromStack,\n getCurrentStackIndexById,\n getTopOfTheStack,\n } = useBottomSheetStack();\n const currentStackIndex = getCurrentStackIndexById(id);\n const bottomSheetZIndex = zIndex - currentStackIndex;\n\n // if bottomSheet height is >35% & <50% then set initial snapPoint to 35%\n useIsomorphicLayoutEffect(() => {\n if (bottomSheetAndDropdownGlue?.hasAutoCompleteInHeader) {\n // In AutoComplete, we want to open BottomSheet with max height so we set this to last index\n initialSnapPoint.current = 2;\n } else {\n const height = Dimensions.get('window').height;\n const middleSnapPoint = snapPoints[1] * height;\n if (totalHeight > middleSnapPoint) {\n initialSnapPoint.current = 1;\n }\n }\n }, [snapPoints, totalHeight]);\n\n const _snapPoints = React.useMemo(() => snapPoints.map((point) => `${point * 100}%`), [\n snapPoints,\n ]);\n\n const close = React.useCallback(() => {\n if (isDismissible) {\n onDismiss?.();\n bottomSheetAndDropdownGlue?.onBottomSheetDismiss?.();\n }\n }, [isDismissible, onDismiss, bottomSheetAndDropdownGlue]);\n\n const handleOnOpen = React.useCallback(() => {\n sheetRef.current?.snapToIndex(initialSnapPoint.current);\n }, []);\n\n const handleOnClose = React.useCallback(() => {\n sheetRef.current?.close();\n // We need this because if inside the BottomSheet there is a input which is focused\n // and user dragged down to close the sheet, even after closing the sheet the input will remain focused\n Keyboard.dismiss();\n }, [sheetRef]);\n\n // sync controlled state to our actions\n React.useEffect(() => {\n if (_isOpen) {\n handleOnOpen();\n if (!initialFocusRef) {\n // focus on close button\n focusOnElement(defaultInitialFocusRef.current);\n } else {\n // focus on the initialRef\n focusOnElement(initialFocusRef.current);\n }\n } else {\n handleOnClose();\n }\n }, [_isOpen, handleOnClose, handleOnOpen, initialFocusRef]);\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 React.useLayoutEffect(() => {\n React.Children.forEach(children, (child) => {\n if (getComponentId(child) === ComponentIds.BottomSheetHeader) {\n setHeader(child);\n }\n if (getComponentId(child) === ComponentIds.BottomSheetFooter) {\n setFooter(child);\n }\n if (getComponentId(child) === ComponentIds.BottomSheetBody) {\n setBody(child);\n }\n });\n }, [children]);\n\n const renderFooter = React.useCallback(\n (props: any): React.ReactElement => {\n return (\n <GorhomBottomSheetFooter {...props}>\n <View\n onLayout={(event) => {\n // save footer height so that later we can offset the marginBottom from body content\n // otherwise few elements gets hidden under the footer\n setFooterHeight(event.nativeEvent.layout.height);\n }}\n >\n {footer}\n </View>\n </GorhomBottomSheetFooter>\n );\n },\n [footer],\n );\n\n const renderBackdrop = React.useCallback(\n (props: any): React.ReactElement => {\n return <BottomSheetBackdrop {...props} zIndex={bottomSheetZIndex} />;\n },\n [bottomSheetZIndex],\n );\n\n const renderHandle = React.useCallback((): React.ReactElement => {\n return (\n <BaseBox\n position={isHeaderEmpty ? 'absolute' : 'relative'}\n top=\"spacing.0\"\n left=\"spacing.0\"\n right=\"spacing.0\"\n onLayout={({ nativeEvent }) => {\n setHeaderHeight(nativeEvent.layout.height);\n }}\n >\n <BaseBox zIndex={bottomSheetZIndex}>\n <BottomSheetGrabHandle />\n </BaseBox>\n {header}\n </BaseBox>\n );\n }, [isHeaderEmpty, bottomSheetZIndex, header]);\n\n const isHeaderFloating = !hasBodyPadding && isHeaderEmpty;\n const contextValue = React.useMemo<BottomSheetContextProps>(\n () => ({\n isInBottomSheet: true,\n isOpen: Boolean(_isOpen),\n close: handleOnClose,\n positionY: 0,\n headerHeight,\n contentHeight,\n footerHeight,\n setContentHeight,\n setFooterHeight,\n setHeaderHeight,\n isDismissible,\n scrollRef: () => {},\n bind: {} as never,\n defaultInitialFocusRef,\n isHeaderFloating,\n setHasBodyPadding,\n setIsHeaderEmpty,\n }),\n [\n _isOpen,\n contentHeight,\n footerHeight,\n handleOnClose,\n headerHeight,\n isHeaderFloating,\n isDismissible,\n ],\n );\n\n // Hack: We need to <Portal> the GorhomBottomSheet to the root of the react-native app\n // But the portalled component will no longer be able to access the parent contexts (Dropdown Context)\n // To workaround this, I'm portalling both the DropdownContext & BotomSheetContext along with the component\n const dropdownProps = useDropdown();\n\n // register and deregister in the stack\n React.useEffect(() => {\n if (_isOpen) {\n addBottomSheetToStack(id);\n } else {\n removeBottomSheetFromStack(id);\n }\n }, [addBottomSheetToStack, _isOpen, id, removeBottomSheetFromStack]);\n\n // Handle TextInput inside BottomSheet\n // We expand the BottomSheet to the max snapPoint so that when the keyboard opens\n // the body content will be visible\n // There is a standard way to do this:\n // https://gorhom.github.io/react-native-bottom-sheet/keyboard-handling\n // But this didn't worked because:\n // https://github.com/gorhom/react-native-bottom-sheet/issues/618\n React.useEffect(() => {\n const showSubscription = Keyboard.addListener('keyboardDidShow', () => {\n if (id && id === getTopOfTheStack()) {\n sheetRef.current?.expand();\n }\n });\n return () => {\n showSubscription.remove();\n };\n }, [getTopOfTheStack, id]);\n\n return (\n <Portal hostName=\"BladeBottomSheetPortal\">\n {/* Portalling both the context */}\n <DropdownContext.Provider value={dropdownProps}>\n <BottomSheetContext.Provider value={contextValue}>\n <GorhomBottomSheet\n style={\n // only render shadow when the sheet is open,\n // otherwise there is visible shadow leak from the bottom edge of the screen\n isOpen\n ? {\n // this is reverse top elevation of highRaised elevation token\n shadowColor: 'hsla(217,56%,17%,0.64)',\n shadowOffset: {\n width: 0,\n height: -18,\n },\n shadowOpacity: 0.2,\n shadowRadius: 12,\n // this fails on andorid because its not handled on GorhomBottomSheet internally, hence tradeoff but its fine because visually this barely makes any difference its that nice design detail\n // elevation: 40,\n }\n : {}\n }\n enablePanDownToClose={isDismissible}\n enableOverDrag\n enableContentPanningGesture\n ref={sheetRef}\n // on initial render if _isOpen is true we want to render the sheet at initialSnapPoint\n // otherwise we want to render it at -1 so that it is not visible\n index={_isOpen ? initialSnapPoint.current : -1}\n containerStyle={{ zIndex: bottomSheetZIndex }}\n animateOnMount={true}\n handleComponent={renderHandle}\n backgroundComponent={BottomSheetSurface}\n footerComponent={renderFooter}\n backdropComponent={renderBackdrop}\n onClose={close}\n snapPoints={_snapPoints}\n >\n {body}\n </GorhomBottomSheet>\n </BottomSheetContext.Provider>\n </DropdownContext.Provider>\n </Portal>\n );\n};\n\nconst BottomSheet = assignWithoutSideEffects(_BottomSheet, {\n componentId: ComponentIds.BottomSheet,\n});\n\nexport { BottomSheet, BottomSheetBody, BottomSheetFooter, BottomSheetHeader };\n"],"names":["BottomSheetSurface","styled","BaseBox","_ref","theme","borderTopLeftRadius","makeSpace","spacing","borderTopRightRadius","backgroundColor","colors","popup","background","subtle","justifyContent","alignItems","position","focusOnElement","element","reactTag","findNodeHandle","AccessibilityInfo","setAccessibilityFocus","_BottomSheet","_ref2","children","_ref2$snapPoints","snapPoints","isOpen","onDismiss","_ref2$isDismissible","isDismissible","initialFocusRef","_ref2$zIndex","zIndex","componentZIndices","bottomSheet","bottomSheetAndDropdownGlue","useBottomSheetAndDropdownGlue","defaultInitialFocusRef","React","useRef","sheetRef","_React$useState","useState","_React$useState2","_slicedToArray","header","setHeader","_React$useState3","_React$useState4","footer","setFooter","_React$useState5","_React$useState6","body","setBody","_isOpen","_React$useState7","_React$useState8","headerHeight","setHeaderHeight","_React$useState9","_React$useState0","footerHeight","setFooterHeight","_React$useState1","_React$useState10","contentHeight","setContentHeight","_React$useState11","_React$useState12","hasBodyPadding","setHasBodyPadding","_React$useState13","_React$useState14","isHeaderEmpty","setIsHeaderEmpty","initialSnapPoint","totalHeight","useMemo","id","useId","_useBottomSheetStack","useBottomSheetStack","addBottomSheetToStack","removeBottomSheetFromStack","getCurrentStackIndexById","getTopOfTheStack","currentStackIndex","bottomSheetZIndex","useIsomorphicLayoutEffect","hasAutoCompleteInHeader","current","height","Dimensions","get","middleSnapPoint","_snapPoints","map","point","close","useCallback","onBottomSheetDismiss","handleOnOpen","_sheetRef$current","snapToIndex","handleOnClose","_sheetRef$current2","Keyboard","dismiss","useEffect","setDropdownHasBottomSheet","useLayoutEffect","Children","forEach","child","getComponentId","ComponentIds","BottomSheetHeader","BottomSheetFooter","BottomSheetBody","renderFooter","props","_jsx","GorhomBottomSheetFooter","Object","assign","View","onLayout","event","nativeEvent","layout","renderBackdrop","BottomSheetBackdrop","renderHandle","_jsxs","top","left","right","_ref3","BottomSheetGrabHandle","isHeaderFloating","contextValue","isInBottomSheet","Boolean","positionY","scrollRef","bind","dropdownProps","useDropdown","showSubscription","addListener","_sheetRef$current3","expand","remove","Portal","hostName","DropdownContext","Provider","value","BottomSheetContext","GorhomBottomSheet","style","shadowColor","shadowOffset","width","shadowOpacity","shadowRadius","enablePanDownToClose","enableOverDrag","enableContentPanningGesture","ref","index","containerStyle","animateOnMount","handleComponent","backgroundComponent","footerComponent","backdropComponent","onClose","BottomSheet","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;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AAK,CAAEpH,OAAO,CAAGqB,gBAAgB,CAACe,OAAO,CAAG,CAAC,CAAE,CAC/CiF,cAAc,CAAE,CAAE5I,MAAM,CAAEwD,iBAAkB,CAAE,CAC9CqF,cAAc,CAAE,IAAK,CACrBC,eAAe,CAAEzC,YAAa,CAC9B0C,mBAAmB,CAAEjL,kBAAmB,CACxCkL,eAAe,CAAExD,YAAa,CAC9ByD,iBAAiB,CAAE9C,cAAe,CAClC+C,OAAO,CAAE/E,KAAM,CACf1E,UAAU,CAAEuE,WAAY,CAAAzE,QAAA,CAEvB8B,IAAI,CACY,CAAC,CACO,CAAC,CACN,CAAC,CACrB,CAAC,CAEb,CAAC,CAEK,IAAA8H,WAAW,CAAGC,wBAAwB,CAAC/J,YAAY,CAAE,CACzDgK,WAAW,CAAEjE,YAAY,CAAC+D,WAC5B,CAAC;;;;"}
|
|
@@ -9,7 +9,7 @@ import '@babel/runtime/helpers/slicedToArray';
|
|
|
9
9
|
import './BottomSheetStack.js';
|
|
10
10
|
import { jsx } from 'react/jsx-runtime';
|
|
11
11
|
|
|
12
|
-
var BottomSheetBackdrop=function BottomSheetBackdrop(props){var _useTheme=useTheme(),theme=_useTheme.theme;return jsx(BottomSheetBackdrop$1,Object.assign({},props,{appearsOnIndex:0,disappearsOnIndex:-1,pressBehavior:
|
|
12
|
+
var BottomSheetBackdrop=function BottomSheetBackdrop(props){var _useTheme=useTheme(),theme=_useTheme.theme;return jsx(BottomSheetBackdrop$1,Object.assign({},props,{appearsOnIndex:0,disappearsOnIndex:-1,pressBehavior:props.isDismissible?'close':'none',opacity:1,style:[props.style,{backgroundColor:theme.colors.overlay.background.subtle,zIndex:props.zIndex}]}));};
|
|
13
13
|
|
|
14
14
|
export { BottomSheetBackdrop };
|
|
15
15
|
//# sourceMappingURL=BottomSheetBackdrop.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetBackdrop.native.js","sources":["../../../../../src/components/BottomSheet/BottomSheetBackdrop.native.tsx"],"sourcesContent":["import React from 'react';\nimport type { BottomSheetBackdropProps } from '@gorhom/bottom-sheet';\nimport { BottomSheetBackdrop as GorhomBottomSheetBackdrop } from '@gorhom/bottom-sheet';\nimport { useTheme } from '~components/BladeProvider';\n\nconst BottomSheetBackdrop = (\n props: BottomSheetBackdropProps & { zIndex: number },\n): React.ReactElement => {\n const { theme } = useTheme();\n\n return (\n <GorhomBottomSheetBackdrop\n {...props}\n appearsOnIndex={0}\n disappearsOnIndex={-1}\n pressBehavior
|
|
1
|
+
{"version":3,"file":"BottomSheetBackdrop.native.js","sources":["../../../../../src/components/BottomSheet/BottomSheetBackdrop.native.tsx"],"sourcesContent":["import React from 'react';\nimport type { BottomSheetBackdropProps } from '@gorhom/bottom-sheet';\nimport { BottomSheetBackdrop as GorhomBottomSheetBackdrop } from '@gorhom/bottom-sheet';\nimport { useTheme } from '~components/BladeProvider';\n\nconst BottomSheetBackdrop = (\n props: BottomSheetBackdropProps & { zIndex: number; isDismissible: boolean },\n): React.ReactElement => {\n const { theme } = useTheme();\n\n return (\n <GorhomBottomSheetBackdrop\n {...props}\n appearsOnIndex={0}\n disappearsOnIndex={-1}\n pressBehavior={props.isDismissible ? 'close' : 'none'}\n opacity={1}\n style={[\n props.style,\n { backgroundColor: theme.colors.overlay.background.subtle, zIndex: props.zIndex },\n ]}\n />\n );\n};\n\nexport { BottomSheetBackdrop };\n"],"names":["BottomSheetBackdrop","props","_useTheme","useTheme","theme","_jsx","GorhomBottomSheetBackdrop","Object","assign","appearsOnIndex","disappearsOnIndex","pressBehavior","isDismissible","opacity","style","backgroundColor","colors","overlay","background","subtle","zIndex"],"mappings":";;;;;;;;;;;AAKM,IAAAA,mBAAmB,CAAG,SAAtBA,mBAAmBA,CACvBC,KAA4E,CACrD,CACvB,IAAAC,SAAA,CAAkBC,QAAQ,EAAE,CAApBC,KAAK,CAAAF,SAAA,CAALE,KAAK,CAEb,OACEC,GAAA,CAACC,qBAAyB,CAAAC,MAAA,CAAAC,MAAA,CACpBP,EAAAA,CAAAA,KAAK,EACTQ,cAAc,CAAE,CAAE,CAClBC,iBAAiB,CAAE,CAAC,CAAE,CACtBC,aAAa,CAAEV,KAAK,CAACW,aAAa,CAAG,OAAO,CAAG,MAAO,CACtDC,OAAO,CAAE,CAAE,CACXC,KAAK,CAAE,CACLb,KAAK,CAACa,KAAK,CACX,CAAEC,eAAe,CAAEX,KAAK,CAACY,MAAM,CAACC,OAAO,CAACC,UAAU,CAACC,MAAM,CAAEC,MAAM,CAAEnB,KAAK,CAACmB,MAAO,CAAC,CACjF,CACH,CAAA,CAAC,CAEN;;;;"}
|
|
@@ -452,7 +452,7 @@ import '../../tokens/global/motion.js';
|
|
|
452
452
|
import { size } from '../../tokens/global/size.js';
|
|
453
453
|
import { jsx } from 'react/jsx-runtime';
|
|
454
454
|
|
|
455
|
-
var BottomSheetEmptyHeader=React__default.forwardRef(function(_ref,ref){var onClickCapture=_ref.onClickCapture,onKeyDown=_ref.onKeyDown,onKeyUp=_ref.onKeyUp,onLostPointerCapture=_ref.onLostPointerCapture,onPointerCancel=_ref.onPointerCancel,onPointerDown=_ref.onPointerDown,onPointerMove=_ref.onPointerMove,onPointerUp=_ref.onPointerUp;var _useBottomSheetContex=useBottomSheetContext(),close=_useBottomSheetContex.close,isHeaderFloating=_useBottomSheetContex.isHeaderFloating;var webOnlyEventHandlers=isReactNative()?{}:{onClickCapture:onClickCapture,onKeyDown:onKeyDown,onKeyUp:onKeyUp,onLostPointerCapture:onLostPointerCapture,onPointerCancel:onPointerCancel,onPointerDown:onPointerDown,onPointerMove:onPointerMove,onPointerUp:onPointerUp};var topOffset=isHeaderFloating?'spacing.5':undefined;if(isReactNative()){topOffset='spacing.0';}return jsx(BaseBox,Object.assign({position:isHeaderFloating?'absolute':'relative',height:makeSize(size[8]),touchAction:"none",top:topOffset,right:"spacing.0"},webOnlyEventHandlers,{children:jsx(BaseBox,{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:isHeaderFloating?'spacing.0':makeSpace(-size[4]),right:"spacing.5",width:makeSize(size[28]),height:makeSize(size[28]),flexShrink:0,backgroundColor:"popup.background.subtle",borderRadius:"max",zIndex:100,children:jsx(IconButton,{ref:ref,size:"large",icon:CloseIcon,accessibilityLabel:"Close",onClick:close})})}));});
|
|
455
|
+
var BottomSheetEmptyHeader=React__default.forwardRef(function(_ref,ref){var onClickCapture=_ref.onClickCapture,onKeyDown=_ref.onKeyDown,onKeyUp=_ref.onKeyUp,onLostPointerCapture=_ref.onLostPointerCapture,onPointerCancel=_ref.onPointerCancel,onPointerDown=_ref.onPointerDown,onPointerMove=_ref.onPointerMove,onPointerUp=_ref.onPointerUp;var _useBottomSheetContex=useBottomSheetContext(),close=_useBottomSheetContex.close,isDismissible=_useBottomSheetContex.isDismissible,isHeaderFloating=_useBottomSheetContex.isHeaderFloating;var webOnlyEventHandlers=isReactNative()?{}:{onClickCapture:onClickCapture,onKeyDown:onKeyDown,onKeyUp:onKeyUp,onLostPointerCapture:onLostPointerCapture,onPointerCancel:onPointerCancel,onPointerDown:onPointerDown,onPointerMove:onPointerMove,onPointerUp:onPointerUp};var topOffset=isHeaderFloating?'spacing.5':undefined;if(isReactNative()){topOffset='spacing.0';}return jsx(BaseBox,Object.assign({position:isHeaderFloating?'absolute':'relative',height:makeSize(size[8]),touchAction:"none",top:topOffset,right:"spacing.0"},webOnlyEventHandlers,{children:isDismissible&&jsx(BaseBox,{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:isHeaderFloating?'spacing.0':makeSpace(-size[4]),right:"spacing.5",width:makeSize(size[28]),height:makeSize(size[28]),flexShrink:0,backgroundColor:"popup.background.subtle",borderRadius:"max",zIndex:100,children:jsx(IconButton,{ref:ref,size:"large",icon:CloseIcon,accessibilityLabel:"Close",onClick:function onClick(){return close==null?void 0:close();}})})}));});
|
|
456
456
|
|
|
457
457
|
export { BottomSheetEmptyHeader };
|
|
458
458
|
//# sourceMappingURL=BottomSheetCommon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetCommon.js","sources":["../../../../../src/components/BottomSheet/BottomSheetCommon.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable react/display-name */\nimport React from 'react';\nimport type { ReactDOMAttributes } from '@use-gesture/react/dist/declarations/src/types';\nimport { useBottomSheetContext } from './BottomSheetContext';\nimport BaseBox from '~components/Box/BaseBox';\nimport { IconButton } from '~components/Button/IconButton';\nimport { CloseIcon } from '~components/Icons';\nimport type { BladeElementRef } from '~utils/types';\nimport { isReactNative } from '~utils';\nimport { size } from '~tokens/global';\nimport { makeSpace } from '~utils/makeSpace';\nimport { makeSize } from '~utils/makeSize';\n\ntype BottomSheetEmptyHeaderProps = Pick<\n ReactDOMAttributes,\n | 'onClickCapture'\n | 'onKeyDown'\n | 'onKeyUp'\n | 'onLostPointerCapture'\n | 'onPointerCancel'\n | 'onPointerDown'\n | 'onPointerMove'\n | 'onPointerUp'\n>;\n\nconst BottomSheetEmptyHeader = React.forwardRef<BladeElementRef, BottomSheetEmptyHeaderProps>(\n (\n {\n onClickCapture,\n onKeyDown,\n onKeyUp,\n onLostPointerCapture,\n onPointerCancel,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n },\n ref,\n ) => {\n const { close, isHeaderFloating } = useBottomSheetContext();\n const webOnlyEventHandlers: Record<string, any> = isReactNative()\n ? {}\n : {\n onClickCapture,\n onKeyDown,\n onKeyUp,\n onLostPointerCapture,\n onPointerCancel,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n };\n\n let topOffset: 'spacing.5' | 'spacing.0' | undefined = isHeaderFloating\n ? 'spacing.5'\n : undefined;\n if (isReactNative()) {\n topOffset = 'spacing.0';\n }\n\n return (\n <BaseBox\n position={isHeaderFloating ? 'absolute' : 'relative'}\n // bottomsheet empty header suppose to be 28px in height\n // the grab handle height is 20px & here we are adding 8px\n // total = 28px\n height={makeSize(size[8])}\n touchAction=\"none\"\n top={topOffset}\n right=\"spacing.0\"\n {...webOnlyEventHandlers}\n >\n <BaseBox\n
|
|
1
|
+
{"version":3,"file":"BottomSheetCommon.js","sources":["../../../../../src/components/BottomSheet/BottomSheetCommon.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable react/display-name */\nimport React from 'react';\nimport type { ReactDOMAttributes } from '@use-gesture/react/dist/declarations/src/types';\nimport { useBottomSheetContext } from './BottomSheetContext';\nimport BaseBox from '~components/Box/BaseBox';\nimport { IconButton } from '~components/Button/IconButton';\nimport { CloseIcon } from '~components/Icons';\nimport type { BladeElementRef } from '~utils/types';\nimport { isReactNative } from '~utils';\nimport { size } from '~tokens/global';\nimport { makeSpace } from '~utils/makeSpace';\nimport { makeSize } from '~utils/makeSize';\n\ntype BottomSheetEmptyHeaderProps = Pick<\n ReactDOMAttributes,\n | 'onClickCapture'\n | 'onKeyDown'\n | 'onKeyUp'\n | 'onLostPointerCapture'\n | 'onPointerCancel'\n | 'onPointerDown'\n | 'onPointerMove'\n | 'onPointerUp'\n>;\n\nconst BottomSheetEmptyHeader = React.forwardRef<BladeElementRef, BottomSheetEmptyHeaderProps>(\n (\n {\n onClickCapture,\n onKeyDown,\n onKeyUp,\n onLostPointerCapture,\n onPointerCancel,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n },\n ref,\n ) => {\n const { close, isDismissible, isHeaderFloating } = useBottomSheetContext();\n const webOnlyEventHandlers: Record<string, any> = isReactNative()\n ? {}\n : {\n onClickCapture,\n onKeyDown,\n onKeyUp,\n onLostPointerCapture,\n onPointerCancel,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n };\n\n let topOffset: 'spacing.5' | 'spacing.0' | undefined = isHeaderFloating\n ? 'spacing.5'\n : undefined;\n if (isReactNative()) {\n topOffset = 'spacing.0';\n }\n\n return (\n <BaseBox\n position={isHeaderFloating ? 'absolute' : 'relative'}\n // bottomsheet empty header suppose to be 28px in height\n // the grab handle height is 20px & here we are adding 8px\n // total = 28px\n height={makeSize(size[8])}\n touchAction=\"none\"\n top={topOffset}\n right=\"spacing.0\"\n {...webOnlyEventHandlers}\n >\n {isDismissible && (\n <BaseBox\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n position=\"absolute\"\n // the bottomsheet handle has a height of 16px + 4px padding\n // we need to make put the close button at 16px from top so adjusting the 4px\n // cannot use position=fixed because RN won't support it\n top={isHeaderFloating ? 'spacing.0' : makeSpace(-size[4])}\n right=\"spacing.5\"\n width={makeSize(size[28])}\n height={makeSize(size[28])}\n flexShrink={0}\n backgroundColor=\"popup.background.subtle\"\n borderRadius=\"max\"\n zIndex={100}\n >\n <IconButton\n ref={ref}\n size=\"large\"\n icon={CloseIcon}\n accessibilityLabel=\"Close\"\n onClick={() => close?.()}\n />\n </BaseBox>\n )}\n </BaseBox>\n );\n },\n);\n\nexport { BottomSheetEmptyHeader };\n"],"names":["BottomSheetEmptyHeader","React","forwardRef","_ref","ref","onClickCapture","onKeyDown","onKeyUp","onLostPointerCapture","onPointerCancel","onPointerDown","onPointerMove","onPointerUp","_useBottomSheetContex","useBottomSheetContext","close","isDismissible","isHeaderFloating","webOnlyEventHandlers","isReactNative","topOffset","undefined","_jsx","BaseBox","Object","assign","position","height","makeSize","size","touchAction","top","right","children","display","alignItems","justifyContent","makeSpace","width","flexShrink","backgroundColor","borderRadius","zIndex","IconButton","icon","CloseIcon","accessibilityLabel","onClick"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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A,CAAA,CACNC,QAAQ,CAAET,gBAAgB,CAAG,UAAU,CAAG,UAAW,CAIrDU,MAAM,CAAEC,QAAQ,CAACC,IAAI,CAAC,CAAC,CAAC,CAAE,CAC1BC,WAAW,CAAC,MAAM,CAClBC,GAAG,CAAEX,SAAU,CACfY,KAAK,CAAC,WAAW,CACbd,CAAAA,oBAAoB,EAAAe,QAAA,CAEvBjB,aAAa,EACZM,GAAA,CAACC,OAAO,EACNW,OAAO,CAAC,MAAM,CACdC,UAAU,CAAC,QAAQ,CACnBC,cAAc,CAAC,QAAQ,CACvBV,QAAQ,CAAC,UAAU,CAInBK,GAAG,CAAEd,gBAAgB,CAAG,WAAW,CAAGoB,SAAS,CAAC,CAACR,IAAI,CAAC,CAAC,CAAC,CAAE,CAC1DG,KAAK,CAAC,WAAW,CACjBM,KAAK,CAAEV,QAAQ,CAACC,IAAI,CAAC,EAAE,CAAC,CAAE,CAC1BF,MAAM,CAAEC,QAAQ,CAACC,IAAI,CAAC,EAAE,CAAC,CAAE,CAC3BU,UAAU,CAAE,CAAE,CACdC,eAAe,CAAC,yBAAyB,CACzCC,YAAY,CAAC,KAAK,CAClBC,MAAM,CAAE,GAAI,CAAAT,QAAA,CAEZX,GAAA,CAACqB,UAAU,CACTvC,CAAAA,GAAG,CAAEA,GAAI,CACTyB,IAAI,CAAC,OAAO,CACZe,IAAI,CAAEC,SAAU,CAChBC,kBAAkB,CAAC,OAAO,CAC1BC,OAAO,CAAE,SAAAA,OAAAA,UAAMhC,KAAK,cAALA,KAAK,EAAI,CAAC,CAAA,CAC1B,CAAC,CACK,CACV,EACM,CAAC,CAEd,CACF;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
|
|
3
|
-
var BottomSheetContext=React__default.createContext({headerHeight:0,contentHeight:0,footerHeight:0,isHeaderFloating:false,setContentHeight:function setContentHeight(){},setHeaderHeight:function setHeaderHeight(){},setFooterHeight:function setFooterHeight(){},setHasBodyPadding:function setHasBodyPadding(){},setIsHeaderEmpty:function setIsHeaderEmpty(){},close:function close(){},scrollRef:null,bind:null,isOpen:false,positionY:0,isInBottomSheet:false,defaultInitialFocusRef:{current:null}});var useBottomSheetContext=function useBottomSheetContext(){var state=React__default.useContext(BottomSheetContext);return state;};var BottomSheetAndDropdownGlueContext=React__default.createContext(null);var useBottomSheetAndDropdownGlue=function useBottomSheetAndDropdownGlue(){var state=React__default.useContext(BottomSheetAndDropdownGlueContext);return state;};
|
|
3
|
+
var BottomSheetContext=React__default.createContext({headerHeight:0,contentHeight:0,footerHeight:0,isHeaderFloating:false,setContentHeight:function setContentHeight(){},setHeaderHeight:function setHeaderHeight(){},setFooterHeight:function setFooterHeight(){},setHasBodyPadding:function setHasBodyPadding(){},setIsHeaderEmpty:function setIsHeaderEmpty(){},close:function close(){},isDismissible:true,scrollRef:null,bind:null,isOpen:false,positionY:0,isInBottomSheet:false,defaultInitialFocusRef:{current:null}});var useBottomSheetContext=function useBottomSheetContext(){var state=React__default.useContext(BottomSheetContext);return state;};var BottomSheetAndDropdownGlueContext=React__default.createContext(null);var useBottomSheetAndDropdownGlue=function useBottomSheetAndDropdownGlue(){var state=React__default.useContext(BottomSheetAndDropdownGlueContext);return state;};
|
|
4
4
|
|
|
5
5
|
export { BottomSheetAndDropdownGlueContext, BottomSheetContext, useBottomSheetAndDropdownGlue, useBottomSheetContext };
|
|
6
6
|
//# sourceMappingURL=BottomSheetContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetContext.js","sources":["../../../../../src/components/BottomSheet/BottomSheetContext.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { ReactDOMAttributes } from '@use-gesture/react/dist/declarations/src/types';\nimport React from 'react';\n\ntype BottomSheetContextProps = {\n headerHeight: number;\n contentHeight: number;\n footerHeight: number;\n isHeaderFloating: boolean;\n setContentHeight: React.Dispatch<React.SetStateAction<number>>;\n setHeaderHeight: React.Dispatch<React.SetStateAction<number>>;\n setFooterHeight: React.Dispatch<React.SetStateAction<number>>;\n setHasBodyPadding: React.Dispatch<React.SetStateAction<boolean>>;\n setIsHeaderEmpty: React.Dispatch<React.SetStateAction<boolean>>;\n /**\n * Closes the bottomsheet\n */\n close
|
|
1
|
+
{"version":3,"file":"BottomSheetContext.js","sources":["../../../../../src/components/BottomSheet/BottomSheetContext.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { ReactDOMAttributes } from '@use-gesture/react/dist/declarations/src/types';\nimport React from 'react';\n\ntype BottomSheetContextProps = {\n headerHeight: number;\n contentHeight: number;\n footerHeight: number;\n isHeaderFloating: boolean;\n setContentHeight: React.Dispatch<React.SetStateAction<number>>;\n setHeaderHeight: React.Dispatch<React.SetStateAction<number>>;\n setFooterHeight: React.Dispatch<React.SetStateAction<number>>;\n setHasBodyPadding: React.Dispatch<React.SetStateAction<boolean>>;\n setIsHeaderEmpty: React.Dispatch<React.SetStateAction<boolean>>;\n /**\n * Closes the bottomsheet\n */\n close?: () => void;\n /**\n * Whether the bottom sheet can be dismissed by tapping backdrop, swiping down.\n * @default true\n * If isDismissible is false, the bottom sheet will not be dismissed when the user clicks outside the bottom sheet\n * and the close button will not be shown, it will also not call the onDismiss callback. Consumers will need to handle the\n * closing of the bottom sheet manually.\n */\n isDismissible: boolean;\n /**\n * scrollRef is the ref to the BottomSheetBody's scrollable content\n *\n * We use this for two purposes:\n *\n * 1. Preventing the scrolling of the content, until the top snap point is reached\n * 2. We use it as the target for body scroll locking, so even when the body is locked this will remain scrollable\n */\n scrollRef: React.Ref<any>;\n /**\n * bind() function comes from useDrag hook\n * https://use-gesture.netlify.app/docs/gestures\n *\n * We spread this function's return values into the element which needs to be draggable\n */\n bind: ((...args: any[]) => ReactDOMAttributes) | null;\n /**\n * Indicates open state of bottomsheet\n */\n isOpen: boolean;\n /**\n * Vertical position of bottomsheet surface\n */\n positionY: number;\n /**\n * This flag is true whenever we access useBottomSheetContext inside BottomSheetContext provider\n */\n isInBottomSheet: boolean;\n /**\n * The element that will get focused when the bottomsheet first opens\n */\n defaultInitialFocusRef: React.MutableRefObject<any>;\n};\n\nconst BottomSheetContext = React.createContext<BottomSheetContextProps>({\n headerHeight: 0,\n contentHeight: 0,\n footerHeight: 0,\n isHeaderFloating: false,\n setContentHeight: () => {},\n setHeaderHeight: () => {},\n setFooterHeight: () => {},\n setHasBodyPadding: () => {},\n setIsHeaderEmpty: () => {},\n close: () => {},\n isDismissible: true,\n scrollRef: null,\n bind: null,\n isOpen: false,\n positionY: 0,\n isInBottomSheet: false,\n defaultInitialFocusRef: { current: null },\n});\n\nconst useBottomSheetContext = (): BottomSheetContextProps => {\n const state = React.useContext(BottomSheetContext);\n return state;\n};\n\ntype BottomSheetAndDropdownGlueContext = {\n isOpen: boolean;\n hasAutoCompleteInHeader: boolean;\n /**\n * This flag is true when <Dropdown> contains or renders <BottomSheet> inside of it\n * We can use this flag to alter behavior or styles of Dropdown\n */\n dropdownHasBottomSheet: boolean;\n /**\n * This is the setter for the flag, we set this flag to true inside <BottomSheet>\n */\n setDropdownHasBottomSheet: React.Dispatch<React.SetStateAction<boolean>>;\n onBottomSheetDismiss: () => void;\n} | null;\n\nconst BottomSheetAndDropdownGlueContext = React.createContext<BottomSheetAndDropdownGlueContext>(\n null,\n);\n\n/**\n * This hook provides the bridge between Dropdown And BottomSheet\n *\n * You can hover over the return types to get jsdoc and more information about each\n */\nconst useBottomSheetAndDropdownGlue = (): BottomSheetAndDropdownGlueContext => {\n const state = React.useContext(BottomSheetAndDropdownGlueContext);\n\n return state;\n};\n\nexport type { BottomSheetContextProps };\nexport {\n BottomSheetContext,\n useBottomSheetContext,\n BottomSheetAndDropdownGlueContext,\n useBottomSheetAndDropdownGlue,\n};\n"],"names":["BottomSheetContext","React","createContext","headerHeight","contentHeight","footerHeight","isHeaderFloating","setContentHeight","setHeaderHeight","setFooterHeight","setHasBodyPadding","setIsHeaderEmpty","close","isDismissible","scrollRef","bind","isOpen","positionY","isInBottomSheet","defaultInitialFocusRef","current","useBottomSheetContext","state","useContext","BottomSheetAndDropdownGlueContext","useBottomSheetAndDropdownGlue"],"mappings":";;AA6DM,IAAAA,kBAAkB,CAAGC,cAAK,CAACC,aAAa,CAA0B,CACtEC,YAAY,CAAE,CAAC,CACfC,aAAa,CAAE,CAAC,CAChBC,YAAY,CAAE,CAAC,CACfC,gBAAgB,CAAE,KAAK,CACvBC,gBAAgB,CAAE,SAAAA,kBAAM,EAAE,CAC1BC,eAAe,CAAE,SAAAA,eAAAA,EAAM,EAAE,CACzBC,eAAe,CAAE,SAAAA,eAAAA,EAAM,EAAE,CACzBC,iBAAiB,CAAE,SAAAA,iBAAA,EAAM,EAAE,CAC3BC,gBAAgB,CAAE,SAAAA,kBAAM,EAAE,CAC1BC,KAAK,CAAE,SAAAA,KAAAA,EAAM,EAAE,CACfC,aAAa,CAAE,IAAI,CACnBC,SAAS,CAAE,IAAI,CACfC,IAAI,CAAE,IAAI,CACVC,MAAM,CAAE,KAAK,CACbC,SAAS,CAAE,CAAC,CACZC,eAAe,CAAE,KAAK,CACtBC,sBAAsB,CAAE,CAAEC,OAAO,CAAE,IAAK,CAC1C,CAAC,EAEK,IAAAC,qBAAqB,CAAG,SAAxBA,qBAAqBA,EAAkC,CAC3D,IAAMC,KAAK,CAAGrB,cAAK,CAACsB,UAAU,CAACvB,kBAAkB,CAAC,CAClD,OAAOsB,KAAK,CACd,EAiBM,IAAAE,iCAAiC,CAAGvB,cAAK,CAACC,aAAa,CAC3D,IACF,EAOM,IAAAuB,6BAA6B,CAAG,SAAhCA,6BAA6BA,EAA4C,CAC7E,IAAMH,KAAK,CAAGrB,cAAK,CAACsB,UAAU,CAACC,iCAAiC,CAAC,CAEjE,OAAOF,KAAK,CACd;;;;"}
|
|
@@ -7,7 +7,7 @@ import { BaseBox } from '../Box/BaseBox/BaseBox.native.js';
|
|
|
7
7
|
import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
|
|
8
8
|
import { jsx } from 'react/jsx-runtime';
|
|
9
9
|
|
|
10
|
-
var _BottomSheetHeader=function _BottomSheetHeader(_ref){var title=_ref.title,subtitle=_ref.subtitle,leading=_ref.leading,trailing=_ref.trailing,titleSuffix=_ref.titleSuffix,_ref$showBackButton=_ref.showBackButton,showBackButton=_ref$showBackButton===void 0?false:_ref$showBackButton,onBackButtonClick=_ref.onBackButtonClick,children=_ref.children;var _useBottomSheetContex=useBottomSheetContext(),close=_useBottomSheetContex.close,setIsHeaderEmpty=_useBottomSheetContex.setIsHeaderEmpty,defaultInitialFocusRef=_useBottomSheetContex.defaultInitialFocusRef;var isHeaderEmpty=!(title||subtitle||leading||trailing||showBackButton||children);React__default.useEffect(function(){setIsHeaderEmpty(isHeaderEmpty);},[isHeaderEmpty]);return jsx(BaseBox,{overflow:"visible",flexShrink:0,children:isHeaderEmpty?jsx(BottomSheetEmptyHeader,{ref:defaultInitialFocusRef}):jsx(BaseHeader,{title:title,subtitle:subtitle,leading:leading,trailing:trailing,titleSuffix:titleSuffix,closeButtonRef:defaultInitialFocusRef,showBackButton:showBackButton,onBackButtonClick:onBackButtonClick,showCloseButton:
|
|
10
|
+
var _BottomSheetHeader=function _BottomSheetHeader(_ref){var title=_ref.title,subtitle=_ref.subtitle,leading=_ref.leading,trailing=_ref.trailing,titleSuffix=_ref.titleSuffix,_ref$showBackButton=_ref.showBackButton,showBackButton=_ref$showBackButton===void 0?false:_ref$showBackButton,onBackButtonClick=_ref.onBackButtonClick,children=_ref.children;var _useBottomSheetContex=useBottomSheetContext(),close=_useBottomSheetContex.close,isDismissible=_useBottomSheetContex.isDismissible,setIsHeaderEmpty=_useBottomSheetContex.setIsHeaderEmpty,defaultInitialFocusRef=_useBottomSheetContex.defaultInitialFocusRef;var isHeaderEmpty=!(title||subtitle||leading||trailing||showBackButton||children);React__default.useEffect(function(){setIsHeaderEmpty(isHeaderEmpty);},[isHeaderEmpty]);return jsx(BaseBox,{overflow:"visible",flexShrink:0,children:isHeaderEmpty?jsx(BottomSheetEmptyHeader,{ref:defaultInitialFocusRef}):jsx(BaseHeader,{title:title,subtitle:subtitle,leading:leading,trailing:trailing,titleSuffix:titleSuffix,closeButtonRef:defaultInitialFocusRef,showBackButton:showBackButton,onBackButtonClick:onBackButtonClick,showCloseButton:isDismissible,onCloseButtonClick:close,children:children})});};var BottomSheetHeader=assignWithoutSideEffects(_BottomSheetHeader,{componentId:ComponentIds.BottomSheetHeader});
|
|
11
11
|
|
|
12
12
|
export { BottomSheetHeader };
|
|
13
13
|
//# sourceMappingURL=BottomSheetHeader.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetHeader.native.js","sources":["../../../../../src/components/BottomSheet/BottomSheetHeader.native.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */\nimport React from 'react';\nimport { ComponentIds } from './componentIds';\nimport { useBottomSheetContext } from './BottomSheetContext';\nimport type { BottomSheetHeaderProps } from './types';\nimport { BottomSheetEmptyHeader } from './BottomSheetCommon';\nimport { BaseHeader } from '~components/BaseHeaderFooter/BaseHeader';\nimport BaseBox from '~components/Box/BaseBox';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\n\nconst _BottomSheetHeader = ({\n title,\n subtitle,\n leading,\n trailing,\n titleSuffix,\n showBackButton = false,\n onBackButtonClick,\n children,\n}: BottomSheetHeaderProps): React.ReactElement => {\n const {
|
|
1
|
+
{"version":3,"file":"BottomSheetHeader.native.js","sources":["../../../../../src/components/BottomSheet/BottomSheetHeader.native.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */\nimport React from 'react';\nimport { ComponentIds } from './componentIds';\nimport { useBottomSheetContext } from './BottomSheetContext';\nimport type { BottomSheetHeaderProps } from './types';\nimport { BottomSheetEmptyHeader } from './BottomSheetCommon';\nimport { BaseHeader } from '~components/BaseHeaderFooter/BaseHeader';\nimport BaseBox from '~components/Box/BaseBox';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\n\nconst _BottomSheetHeader = ({\n title,\n subtitle,\n leading,\n trailing,\n titleSuffix,\n showBackButton = false,\n onBackButtonClick,\n children,\n}: BottomSheetHeaderProps): React.ReactElement => {\n const {\n close,\n isDismissible,\n setIsHeaderEmpty,\n defaultInitialFocusRef,\n } = useBottomSheetContext();\n const isHeaderEmpty = !(title || subtitle || leading || trailing || showBackButton || children);\n\n React.useEffect(() => {\n setIsHeaderEmpty(isHeaderEmpty);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isHeaderEmpty]);\n\n return (\n <BaseBox overflow=\"visible\" flexShrink={0}>\n {isHeaderEmpty ? (\n <BottomSheetEmptyHeader ref={defaultInitialFocusRef} />\n ) : (\n <BaseHeader\n title={title}\n subtitle={subtitle}\n leading={leading}\n trailing={trailing}\n titleSuffix={titleSuffix}\n // back button\n closeButtonRef={defaultInitialFocusRef}\n showBackButton={showBackButton}\n onBackButtonClick={onBackButtonClick}\n // close button\n showCloseButton={isDismissible}\n onCloseButtonClick={close}\n >\n {children}\n </BaseHeader>\n )}\n </BaseBox>\n );\n};\n\nconst BottomSheetHeader = assignWithoutSideEffects(_BottomSheetHeader, {\n componentId: ComponentIds.BottomSheetHeader,\n});\n\nexport type { BottomSheetHeaderProps };\nexport { BottomSheetHeader };\n"],"names":["_BottomSheetHeader","_ref","title","subtitle","leading","trailing","titleSuffix","_ref$showBackButton","showBackButton","onBackButtonClick","children","_useBottomSheetContex","useBottomSheetContext","close","isDismissible","setIsHeaderEmpty","defaultInitialFocusRef","isHeaderEmpty","React","useEffect","_jsx","BaseBox","overflow","flexShrink","BottomSheetEmptyHeader","ref","BaseHeader","closeButtonRef","showCloseButton","onCloseButtonClick","BottomSheetHeader","assignWithoutSideEffects","componentId","ComponentIds"],"mappings":";;;;;;;;;AAUA,IAA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ACnBC,WAAW,CAAEA,WAAY,CAEzBqB,cAAc,CAAEX,sBAAuB,CACvCR,cAAc,CAAEA,cAAe,CAC/BC,iBAAiB,CAAEA,iBAAkB,CAErCmB,eAAe,CAAEd,aAAc,CAC/Be,kBAAkB,CAAEhB,KAAM,CAAAH,QAAA,CAEzBA,QAAQ,CACC,CACb,CACM,CAAC,CAEd,CAAC,CAEK,IAAAoB,iBAAiB,CAAGC,wBAAwB,CAAC/B,kBAAkB,CAAE,CACrEgC,WAAW,CAAEC,YAAY,CAACH,iBAC5B,CAAC;;;;"}
|
|
@@ -41,7 +41,7 @@ import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeA
|
|
|
41
41
|
import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
|
|
42
42
|
import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
|
|
43
43
|
|
|
44
|
-
var _excluded = ["isOpen", "onDismiss", "children", "initialFocusRef", "snapPoints", "zIndex"];
|
|
44
|
+
var _excluded = ["isOpen", "onDismiss", "children", "initialFocusRef", "snapPoints", "isDismissible", "zIndex"];
|
|
45
45
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
46
46
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
47
47
|
var BOTTOM_SHEET_EASING = 'cubic-bezier(.15,0,.24,.97)';
|
|
@@ -85,6 +85,8 @@ var _BottomSheet = function _BottomSheet(_ref2) {
|
|
|
85
85
|
initialFocusRef = _ref2.initialFocusRef,
|
|
86
86
|
_ref2$snapPoints = _ref2.snapPoints,
|
|
87
87
|
snapPoints = _ref2$snapPoints === void 0 ? [0.35, 0.5, 0.85] : _ref2$snapPoints,
|
|
88
|
+
_ref2$isDismissible = _ref2.isDismissible,
|
|
89
|
+
isDismissible = _ref2$isDismissible === void 0 ? true : _ref2$isDismissible,
|
|
88
90
|
_ref2$zIndex = _ref2.zIndex,
|
|
89
91
|
zIndex = _ref2$zIndex === void 0 ? componentZIndices.bottomSheet : _ref2$zIndex,
|
|
90
92
|
dataAnalyticsProps = _objectWithoutProperties(_ref2, _excluded);
|
|
@@ -234,10 +236,13 @@ var _BottomSheet = function _BottomSheet(_ref2) {
|
|
|
234
236
|
setPositionY(0);
|
|
235
237
|
}, [setPositionY]);
|
|
236
238
|
var close = React__default.useCallback(function () {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
+
if (isDismissible) {
|
|
240
|
+
var _bottomSheetAndDropdo;
|
|
241
|
+
onDismiss === null || onDismiss === void 0 || onDismiss();
|
|
242
|
+
bottomSheetAndDropdownGlue === null || bottomSheetAndDropdownGlue === void 0 || (_bottomSheetAndDropdo = bottomSheetAndDropdownGlue.onBottomSheetDismiss) === null || _bottomSheetAndDropdo === void 0 || _bottomSheetAndDropdo.call(bottomSheetAndDropdownGlue);
|
|
243
|
+
}
|
|
239
244
|
returnFocus();
|
|
240
|
-
}, [
|
|
245
|
+
}, [isDismissible, onDismiss, bottomSheetAndDropdownGlue, returnFocus]);
|
|
241
246
|
|
|
242
247
|
// sync controlled state to our actions
|
|
243
248
|
React__default.useEffect(function () {
|
|
@@ -348,10 +353,20 @@ var _BottomSheet = function _BottomSheet(_ref2) {
|
|
|
348
353
|
var lowerestSnap = Math.min(lower, totalHeight) - lowerPointBuffer;
|
|
349
354
|
var shouldClose = rawY < lowerestSnap;
|
|
350
355
|
if (shouldClose) {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
356
|
+
if (isDismissible) {
|
|
357
|
+
// Allow closing if dismissible
|
|
358
|
+
setIsDragging(false);
|
|
359
|
+
cancel();
|
|
360
|
+
close();
|
|
361
|
+
return;
|
|
362
|
+
} else {
|
|
363
|
+
// If not dismissible, snap back to first snap point instead of closing
|
|
364
|
+
setIsDragging(false);
|
|
365
|
+
cancel();
|
|
366
|
+
var firstSnapPoint = dimensions.height * snapPoints[0];
|
|
367
|
+
setPositionY(firstSnapPoint, true);
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
355
370
|
}
|
|
356
371
|
|
|
357
372
|
// if we stop dragging assign snap to the nearest point
|
|
@@ -432,9 +447,10 @@ var _BottomSheet = function _BottomSheet(_ref2) {
|
|
|
432
447
|
scrollRef: scrollRef,
|
|
433
448
|
bind: bind,
|
|
434
449
|
defaultInitialFocusRef: defaultInitialFocusRef,
|
|
435
|
-
isHeaderFloating: isHeaderFloating
|
|
450
|
+
isHeaderFloating: isHeaderFloating,
|
|
451
|
+
isDismissible: isDismissible
|
|
436
452
|
};
|
|
437
|
-
}, [isVisible, close, positionY, headerHeight, contentHeight, footerHeight, setContentHeight, setFooterHeight, setHeaderHeight, setHasBodyPadding, setIsHeaderEmpty, scrollRef, bind, defaultInitialFocusRef, isHeaderFloating]);
|
|
453
|
+
}, [isVisible, close, positionY, headerHeight, contentHeight, footerHeight, setContentHeight, setFooterHeight, setHeaderHeight, setHasBodyPadding, setIsHeaderEmpty, scrollRef, bind, defaultInitialFocusRef, isHeaderFloating, isDismissible]);
|
|
438
454
|
React__default.useEffect(function () {
|
|
439
455
|
if (isMounted) {
|
|
440
456
|
addBottomSheetToStack(id);
|