@razorpay/blade 11.3.1 → 11.5.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.
Files changed (180) hide show
  1. package/build/lib/native/components/BaseHeaderFooter/BaseHeader.js +3 -1
  2. package/build/lib/native/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
  3. package/build/lib/native/components/BottomSheet/BottomSheet.native.js +2 -1
  4. package/build/lib/native/components/BottomSheet/BottomSheet.native.js.map +1 -1
  5. package/build/lib/native/components/Breadcrumb/Breadcrumb.native.js +7 -0
  6. package/build/lib/native/components/Breadcrumb/Breadcrumb.native.js.map +1 -0
  7. package/build/lib/native/components/Breadcrumb/BreadcrumbItem.native.js +7 -0
  8. package/build/lib/native/components/Breadcrumb/BreadcrumbItem.native.js.map +1 -0
  9. package/build/lib/native/components/Button/BaseButton/buttonTokens.js +1 -1
  10. package/build/lib/native/components/Button/BaseButton/buttonTokens.js.map +1 -1
  11. package/build/lib/native/components/Drawer/Drawer.native.js +17 -0
  12. package/build/lib/native/components/Drawer/Drawer.native.js.map +1 -0
  13. package/build/lib/native/components/Drawer/DrawerSubcomponents.native.js +17 -0
  14. package/build/lib/native/components/Drawer/DrawerSubcomponents.native.js.map +1 -0
  15. package/build/lib/native/components/Link/BaseLink/BaseLink.js +1 -1
  16. package/build/lib/native/components/Link/BaseLink/BaseLink.js.map +1 -1
  17. package/build/lib/native/components/Popover/Popover.native.js +3 -2
  18. package/build/lib/native/components/Popover/Popover.native.js.map +1 -1
  19. package/build/lib/native/components/Popover/constants.js +2 -2
  20. package/build/lib/native/components/Popover/constants.js.map +1 -1
  21. package/build/lib/native/components/Tag/Tag.js +1 -1
  22. package/build/lib/native/components/Tag/Tag.js.map +1 -1
  23. package/build/lib/native/components/Tooltip/Tooltip.native.js +3 -2
  24. package/build/lib/native/components/Tooltip/Tooltip.native.js.map +1 -1
  25. package/build/lib/native/components/Tooltip/constants.js +2 -2
  26. package/build/lib/native/components/Tooltip/constants.js.map +1 -1
  27. package/build/lib/native/components/index.js +4 -0
  28. package/build/lib/native/components/index.js.map +1 -1
  29. package/build/lib/native/utils/componentZIndices.js +4 -0
  30. package/build/lib/native/utils/componentZIndices.js.map +1 -0
  31. package/build/lib/native/utils/lodashButBetter/get.js.map +1 -1
  32. package/build/lib/native/utils/metaAttribute/metaConstants.js +1 -1
  33. package/build/lib/native/utils/metaAttribute/metaConstants.js.map +1 -1
  34. package/build/lib/web/development/components/BaseHeaderFooter/BaseHeader.js +6 -2
  35. package/build/lib/web/development/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
  36. package/build/lib/web/development/components/BladeProvider/BladeProvider.web.js +5 -2
  37. package/build/lib/web/development/components/BladeProvider/BladeProvider.web.js.map +1 -1
  38. package/build/lib/web/development/components/BottomSheet/BottomSheet.web.js +2 -1
  39. package/build/lib/web/development/components/BottomSheet/BottomSheet.web.js.map +1 -1
  40. package/build/lib/web/development/components/Breadcrumb/Breadcrumb.web.js +104 -0
  41. package/build/lib/web/development/components/Breadcrumb/Breadcrumb.web.js.map +1 -0
  42. package/build/lib/web/development/components/Breadcrumb/BreadcrumbContext.js +9 -0
  43. package/build/lib/web/development/components/Breadcrumb/BreadcrumbContext.js.map +1 -0
  44. package/build/lib/web/development/components/Breadcrumb/BreadcrumbItem.web.js +55 -0
  45. package/build/lib/web/development/components/Breadcrumb/BreadcrumbItem.web.js.map +1 -0
  46. package/build/lib/web/development/components/Breadcrumb/index.js +4 -0
  47. package/build/lib/web/development/components/Breadcrumb/index.js.map +1 -0
  48. package/build/lib/web/development/components/Breadcrumb/types.js +2 -0
  49. package/build/lib/web/development/components/Breadcrumb/types.js.map +1 -0
  50. package/build/lib/web/development/components/Button/BaseButton/buttonTokens.js +2 -2
  51. package/build/lib/web/development/components/Button/BaseButton/buttonTokens.js.map +1 -1
  52. package/build/lib/web/development/components/Button/Button/index.js +1 -1
  53. package/build/lib/web/development/components/Drawer/Drawer.web.js +229 -0
  54. package/build/lib/web/development/components/Drawer/Drawer.web.js.map +1 -0
  55. package/build/lib/web/development/components/Drawer/DrawerContext.js +9 -0
  56. package/build/lib/web/development/components/Drawer/DrawerContext.js.map +1 -0
  57. package/build/lib/web/development/components/Drawer/DrawerSubcomponents.web.js +65 -0
  58. package/build/lib/web/development/components/Drawer/DrawerSubcomponents.web.js.map +1 -0
  59. package/build/lib/web/development/components/Drawer/StackProvider.js +57 -0
  60. package/build/lib/web/development/components/Drawer/StackProvider.js.map +1 -0
  61. package/build/lib/web/development/components/Drawer/drawerComponentIds.js +8 -0
  62. package/build/lib/web/development/components/Drawer/drawerComponentIds.js.map +1 -0
  63. package/build/lib/web/development/components/Drawer/index.js +4 -0
  64. package/build/lib/web/development/components/Drawer/index.js.map +1 -0
  65. package/build/lib/web/development/components/Drawer/types.js +2 -0
  66. package/build/lib/web/development/components/Drawer/types.js.map +1 -0
  67. package/build/lib/web/development/components/Dropdown/DropdownOverlay.web.js +2 -2
  68. package/build/lib/web/development/components/Dropdown/DropdownOverlay.web.js.map +1 -1
  69. package/build/lib/web/development/components/Link/BaseLink/BaseLink.js +3 -1
  70. package/build/lib/web/development/components/Link/BaseLink/BaseLink.js.map +1 -1
  71. package/build/lib/web/development/components/Link/Link/index.js +1 -1
  72. package/build/lib/web/development/components/Modal/Modal.web.js +3 -2
  73. package/build/lib/web/development/components/Modal/Modal.web.js.map +1 -1
  74. package/build/lib/web/development/components/Modal/ModalHeader.web.js +2 -2
  75. package/build/lib/web/development/components/Modal/ModalHeader.web.js.map +1 -1
  76. package/build/lib/web/development/components/Modal/modalTokens.js +1 -2
  77. package/build/lib/web/development/components/Modal/modalTokens.js.map +1 -1
  78. package/build/lib/web/development/components/Popover/Popover.web.js +3 -2
  79. package/build/lib/web/development/components/Popover/Popover.web.js.map +1 -1
  80. package/build/lib/web/development/components/Popover/constants.js +1 -2
  81. package/build/lib/web/development/components/Popover/constants.js.map +1 -1
  82. package/build/lib/web/development/components/SpotlightPopoverTour/TourMask.web.js +2 -2
  83. package/build/lib/web/development/components/SpotlightPopoverTour/TourMask.web.js.map +1 -1
  84. package/build/lib/web/development/components/SpotlightPopoverTour/TourPopover.web.js +3 -2
  85. package/build/lib/web/development/components/SpotlightPopoverTour/TourPopover.web.js.map +1 -1
  86. package/build/lib/web/development/components/SpotlightPopoverTour/tourTokens.js +1 -3
  87. package/build/lib/web/development/components/SpotlightPopoverTour/tourTokens.js.map +1 -1
  88. package/build/lib/web/development/components/Tag/AnimatedTag.web.js +1 -1
  89. package/build/lib/web/development/components/Tag/AnimatedTag.web.js.map +1 -1
  90. package/build/lib/web/development/components/Tag/Tag.js +1 -0
  91. package/build/lib/web/development/components/Tag/Tag.js.map +1 -1
  92. package/build/lib/web/development/components/Tooltip/Tooltip.web.js +3 -2
  93. package/build/lib/web/development/components/Tooltip/Tooltip.web.js.map +1 -1
  94. package/build/lib/web/development/components/Tooltip/constants.js +1 -2
  95. package/build/lib/web/development/components/Tooltip/constants.js.map +1 -1
  96. package/build/lib/web/development/components/index.js +6 -0
  97. package/build/lib/web/development/components/index.js.map +1 -1
  98. package/build/lib/web/development/utils/componentZIndices.js +13 -0
  99. package/build/lib/web/development/utils/componentZIndices.js.map +1 -0
  100. package/build/lib/web/development/utils/lodashButBetter/get.js +1 -1
  101. package/build/lib/web/development/utils/lodashButBetter/get.js.map +1 -1
  102. package/build/lib/web/development/utils/metaAttribute/metaConstants.js +3 -0
  103. package/build/lib/web/development/utils/metaAttribute/metaConstants.js.map +1 -1
  104. package/build/lib/web/development/utils/useVerifyAllowedChildren/index.js +2 -0
  105. package/build/lib/web/development/utils/useVerifyAllowedChildren/index.js.map +1 -0
  106. package/build/lib/web/production/components/BaseHeaderFooter/BaseHeader.js +6 -2
  107. package/build/lib/web/production/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
  108. package/build/lib/web/production/components/BladeProvider/BladeProvider.web.js +5 -2
  109. package/build/lib/web/production/components/BladeProvider/BladeProvider.web.js.map +1 -1
  110. package/build/lib/web/production/components/BottomSheet/BottomSheet.web.js +2 -1
  111. package/build/lib/web/production/components/BottomSheet/BottomSheet.web.js.map +1 -1
  112. package/build/lib/web/production/components/Breadcrumb/Breadcrumb.web.js +104 -0
  113. package/build/lib/web/production/components/Breadcrumb/Breadcrumb.web.js.map +1 -0
  114. package/build/lib/web/production/components/Breadcrumb/BreadcrumbContext.js +9 -0
  115. package/build/lib/web/production/components/Breadcrumb/BreadcrumbContext.js.map +1 -0
  116. package/build/lib/web/production/components/Breadcrumb/BreadcrumbItem.web.js +55 -0
  117. package/build/lib/web/production/components/Breadcrumb/BreadcrumbItem.web.js.map +1 -0
  118. package/build/lib/web/production/components/Breadcrumb/index.js +4 -0
  119. package/build/lib/web/production/components/Breadcrumb/index.js.map +1 -0
  120. package/build/lib/web/production/components/Breadcrumb/types.js +2 -0
  121. package/build/lib/web/production/components/Breadcrumb/types.js.map +1 -0
  122. package/build/lib/web/production/components/Button/BaseButton/buttonTokens.js +2 -2
  123. package/build/lib/web/production/components/Button/BaseButton/buttonTokens.js.map +1 -1
  124. package/build/lib/web/production/components/Button/Button/index.js +1 -1
  125. package/build/lib/web/production/components/Drawer/Drawer.web.js +229 -0
  126. package/build/lib/web/production/components/Drawer/Drawer.web.js.map +1 -0
  127. package/build/lib/web/production/components/Drawer/DrawerContext.js +9 -0
  128. package/build/lib/web/production/components/Drawer/DrawerContext.js.map +1 -0
  129. package/build/lib/web/production/components/Drawer/DrawerSubcomponents.web.js +65 -0
  130. package/build/lib/web/production/components/Drawer/DrawerSubcomponents.web.js.map +1 -0
  131. package/build/lib/web/production/components/Drawer/StackProvider.js +57 -0
  132. package/build/lib/web/production/components/Drawer/StackProvider.js.map +1 -0
  133. package/build/lib/web/production/components/Drawer/drawerComponentIds.js +8 -0
  134. package/build/lib/web/production/components/Drawer/drawerComponentIds.js.map +1 -0
  135. package/build/lib/web/production/components/Drawer/index.js +4 -0
  136. package/build/lib/web/production/components/Drawer/index.js.map +1 -0
  137. package/build/lib/web/production/components/Drawer/types.js +2 -0
  138. package/build/lib/web/production/components/Drawer/types.js.map +1 -0
  139. package/build/lib/web/production/components/Dropdown/DropdownOverlay.web.js +2 -2
  140. package/build/lib/web/production/components/Dropdown/DropdownOverlay.web.js.map +1 -1
  141. package/build/lib/web/production/components/Link/BaseLink/BaseLink.js +3 -1
  142. package/build/lib/web/production/components/Link/BaseLink/BaseLink.js.map +1 -1
  143. package/build/lib/web/production/components/Link/Link/index.js +1 -1
  144. package/build/lib/web/production/components/Modal/Modal.web.js +3 -2
  145. package/build/lib/web/production/components/Modal/Modal.web.js.map +1 -1
  146. package/build/lib/web/production/components/Modal/ModalHeader.web.js +2 -2
  147. package/build/lib/web/production/components/Modal/ModalHeader.web.js.map +1 -1
  148. package/build/lib/web/production/components/Modal/modalTokens.js +1 -2
  149. package/build/lib/web/production/components/Modal/modalTokens.js.map +1 -1
  150. package/build/lib/web/production/components/Popover/Popover.web.js +3 -2
  151. package/build/lib/web/production/components/Popover/Popover.web.js.map +1 -1
  152. package/build/lib/web/production/components/Popover/constants.js +1 -2
  153. package/build/lib/web/production/components/Popover/constants.js.map +1 -1
  154. package/build/lib/web/production/components/SpotlightPopoverTour/TourMask.web.js +2 -2
  155. package/build/lib/web/production/components/SpotlightPopoverTour/TourMask.web.js.map +1 -1
  156. package/build/lib/web/production/components/SpotlightPopoverTour/TourPopover.web.js +3 -2
  157. package/build/lib/web/production/components/SpotlightPopoverTour/TourPopover.web.js.map +1 -1
  158. package/build/lib/web/production/components/SpotlightPopoverTour/tourTokens.js +1 -3
  159. package/build/lib/web/production/components/SpotlightPopoverTour/tourTokens.js.map +1 -1
  160. package/build/lib/web/production/components/Tag/AnimatedTag.web.js +1 -1
  161. package/build/lib/web/production/components/Tag/AnimatedTag.web.js.map +1 -1
  162. package/build/lib/web/production/components/Tag/Tag.js +1 -0
  163. package/build/lib/web/production/components/Tag/Tag.js.map +1 -1
  164. package/build/lib/web/production/components/Tooltip/Tooltip.web.js +3 -2
  165. package/build/lib/web/production/components/Tooltip/Tooltip.web.js.map +1 -1
  166. package/build/lib/web/production/components/Tooltip/constants.js +1 -2
  167. package/build/lib/web/production/components/Tooltip/constants.js.map +1 -1
  168. package/build/lib/web/production/components/index.js +6 -0
  169. package/build/lib/web/production/components/index.js.map +1 -1
  170. package/build/lib/web/production/utils/componentZIndices.js +13 -0
  171. package/build/lib/web/production/utils/componentZIndices.js.map +1 -0
  172. package/build/lib/web/production/utils/lodashButBetter/get.js +1 -1
  173. package/build/lib/web/production/utils/lodashButBetter/get.js.map +1 -1
  174. package/build/lib/web/production/utils/metaAttribute/metaConstants.js +3 -0
  175. package/build/lib/web/production/utils/metaAttribute/metaConstants.js.map +1 -1
  176. package/build/lib/web/production/utils/useVerifyAllowedChildren/index.js +2 -0
  177. package/build/lib/web/production/utils/useVerifyAllowedChildren/index.js.map +1 -0
  178. package/build/types/components/index.d.ts +332 -140
  179. package/build/types/components/index.native.d.ts +282 -141
  180. package/package.json +9 -57
@@ -8,7 +8,9 @@ import { throwBladeError, logger } from '../../utils/logger/logger.js';
8
8
  import 'react-native';
9
9
  import '../../tokens/global/typography.js';
10
10
  import '../../tokens/global/motion.js';
11
+ import { size } from '../../tokens/global/size.js';
11
12
  import { isReactNative } from '../../utils/platform/isReactNative.js';
13
+ import { makeSize } from '../../utils/makeSize/makeSize.js';
12
14
  import '../BladeProvider/useTheme.js';
13
15
  import { jsxs, jsx } from 'react/jsx-runtime';
14
16
  import { Text } from '../Typography/Text/Text.js';
@@ -27,7 +29,7 @@ import { Box } from '../Box/Box.js';
27
29
  import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
28
30
  import { getComponentId } from '../../utils/isValidAllowedChildren/isValidAllowedChildren.js';
29
31
 
30
- var centerBoxProps={display:'flex',alignItems:'center',justifyContent:'center',height:'28px'};var propRestrictionMap={Button:{size:'xsmall',variant:'tertiary'},Badge:{size:'medium'},Link:{size:'medium'},Text:{size:'medium',variant:'body'},Amount:{type:'body',size:'medium'}};var useTrailingRestriction=function useTrailingRestriction(trailing){var _React$useState=React__default.useState(null),_React$useState2=_slicedToArray(_React$useState,2),validatedTrailingComponent=_React$useState2[0],setValidatedTrailingComponent=_React$useState2[1];React__default.useEffect(function(){if(React__default.isValidElement(trailing)){var trailingComponentType=getComponentId(trailing);var restrictedProps=propRestrictionMap[trailingComponentType];var allowedComponents=Object.keys(propRestrictionMap);if(__DEV__){if(!restrictedProps){throwBladeError({message:`Only one of \`${allowedComponents.join(', ')}\` component is accepted as trailing`,moduleName:'Header'});}}var restrictedPropKeys=Object.keys(propRestrictionMap[trailingComponentType]);for(var prop of restrictedPropKeys){var _trailing$props;if(trailing!=null&&(_trailing$props=trailing.props)!=null&&_trailing$props.hasOwnProperty(prop)){logger({message:`Do not pass "${prop}" to "${trailingComponentType}" while inside Header trailing, because we override it.`,moduleName:'Header',type:'warn'});}}setValidatedTrailingComponent(React__default.cloneElement(trailing,restrictedProps));}},[trailing]);return validatedTrailingComponent;};var _BaseHeader=function _BaseHeader(_ref){var title=_ref.title,subtitle=_ref.subtitle,leading=_ref.leading,titleSuffix=_ref.titleSuffix,trailing=_ref.trailing,_ref$showDivider=_ref.showDivider,showDivider=_ref$showDivider===void 0?true:_ref$showDivider,_ref$showBackButton=_ref.showBackButton,showBackButton=_ref$showBackButton===void 0?false:_ref$showBackButton,_ref$showCloseButton=_ref.showCloseButton,showCloseButton=_ref$showCloseButton===void 0?true:_ref$showCloseButton,onBackButtonClick=_ref.onBackButtonClick,onCloseButtonClick=_ref.onCloseButtonClick,closeButtonRef=_ref.closeButtonRef,testID=_ref.testID,onClickCapture=_ref.onClickCapture,onKeyDown=_ref.onKeyDown,onKeyUp=_ref.onKeyUp,onLostPointerCapture=_ref.onLostPointerCapture,onPointerCancel=_ref.onPointerCancel,onPointerDown=_ref.onPointerDown,onPointerMove=_ref.onPointerMove,onPointerUp=_ref.onPointerUp,metaComponentName=_ref.metaComponentName,children=_ref.children;var validatedTrailingComponent=useTrailingRestriction(trailing);var shouldWrapTitle=titleSuffix&&trailing&&showBackButton&&showCloseButton;var webOnlyEventHandlers=isReactNative()?{}:{onClickCapture:onClickCapture,onKeyDown:onKeyDown,onKeyUp:onKeyUp,onLostPointerCapture:onLostPointerCapture,onPointerCancel:onPointerCancel,onPointerDown:onPointerDown,onPointerMove:onPointerMove,onPointerUp:onPointerUp};return jsxs(BaseBox,Object.assign({},metaAttribute({name:metaComponentName,testID:testID}),{children:[jsxs(BaseBox,Object.assign({marginY:{base:'spacing.5',m:'spacing.6'},paddingX:{base:'spacing.5',m:'spacing.6'},touchAction:"none"},webOnlyEventHandlers,{children:[jsxs(BaseBox,{display:"flex",flexDirection:"row",userSelect:"none",children:[showBackButton?jsx(BaseBox,{overflow:"visible",marginRight:"spacing.5",children:jsx(Box,Object.assign({},centerBoxProps,{children:jsx(IconButton,{size:"large",icon:ChevronLeftIcon,onClick:function onClick(){return onBackButtonClick==null?void 0:onBackButtonClick();},accessibilityLabel:"Back"})}))}):null,jsxs(BaseBox,{paddingRight:"spacing.5",marginRight:"auto",flex:"auto",display:"flex",flexDirection:"row",alignItems:"flex-start",children:[leading?jsx(BaseBox,Object.assign({width:"spacing.8",height:"spacing.8",marginRight:"spacing.3"},centerBoxProps,{children:leading})):null,jsxs(BaseBox,{flex:"auto",children:[jsxs(BaseBox,{maxWidth:isReactNative()&&shouldWrapTitle?'100px':undefined,flexShrink:0,display:"flex",flexDirection:"row",children:[title?jsx(Text,{size:"large",weight:"semibold",color:"surface.text.gray.normal",children:title}):null,titleSuffix&&jsx(BaseBox,{marginLeft:"spacing.3",children:jsx(Box,Object.assign({},centerBoxProps,{children:titleSuffix}))})]}),subtitle?jsx(Text,{variant:"body",size:"small",weight:"regular",color:"surface.text.gray.muted",children:subtitle}):null]})]}),validatedTrailingComponent?jsx(BaseBox,{marginRight:"spacing.5",children:jsx(Box,Object.assign({},centerBoxProps,{children:validatedTrailingComponent}))}):null,showCloseButton?jsx(Box,Object.assign({},centerBoxProps,{children:jsx(IconButton,{ref:closeButtonRef,size:"large",icon:CloseIcon,accessibilityLabel:"Close",onClick:function onClick(){return onCloseButtonClick==null?void 0:onCloseButtonClick();}})})):null]}),children]})),showDivider?jsx(Divider,{}):null]}));};var BaseHeader=assignWithoutSideEffects(_BaseHeader,{componentId:'BaseHeader'});
32
+ var centerBoxProps={display:'flex',alignItems:'center',justifyContent:'center',height:'28px'};var propRestrictionMap={Button:{size:'xsmall',variant:'tertiary'},Badge:{size:'medium'},Link:{size:'medium'},Text:{size:'medium',variant:'body'},Amount:{type:'body',size:'medium'}};var useTrailingRestriction=function useTrailingRestriction(trailing){var _React$useState=React__default.useState(null),_React$useState2=_slicedToArray(_React$useState,2),validatedTrailingComponent=_React$useState2[0],setValidatedTrailingComponent=_React$useState2[1];React__default.useEffect(function(){if(React__default.isValidElement(trailing)){var trailingComponentType=getComponentId(trailing);var restrictedProps=propRestrictionMap[trailingComponentType];var allowedComponents=Object.keys(propRestrictionMap);if(__DEV__){if(!restrictedProps){throwBladeError({message:`Only one of \`${allowedComponents.join(', ')}\` component is accepted as trailing`,moduleName:'Header'});}}var restrictedPropKeys=Object.keys(propRestrictionMap[trailingComponentType]);for(var prop of restrictedPropKeys){var _trailing$props;if(trailing!=null&&(_trailing$props=trailing.props)!=null&&_trailing$props.hasOwnProperty(prop)){logger({message:`Do not pass "${prop}" to "${trailingComponentType}" while inside Header trailing, because we override it.`,moduleName:'Header',type:'warn'});}}setValidatedTrailingComponent(React__default.cloneElement(trailing,restrictedProps));}},[trailing]);return validatedTrailingComponent;};var _BaseHeader=function _BaseHeader(_ref){var title=_ref.title,subtitle=_ref.subtitle,leading=_ref.leading,titleSuffix=_ref.titleSuffix,trailing=_ref.trailing,_ref$showDivider=_ref.showDivider,showDivider=_ref$showDivider===void 0?true:_ref$showDivider,_ref$showBackButton=_ref.showBackButton,showBackButton=_ref$showBackButton===void 0?false:_ref$showBackButton,_ref$showCloseButton=_ref.showCloseButton,showCloseButton=_ref$showCloseButton===void 0?true:_ref$showCloseButton,onBackButtonClick=_ref.onBackButtonClick,onCloseButtonClick=_ref.onCloseButtonClick,closeButtonRef=_ref.closeButtonRef,backButtonRef=_ref.backButtonRef,testID=_ref.testID,onClickCapture=_ref.onClickCapture,onKeyDown=_ref.onKeyDown,onKeyUp=_ref.onKeyUp,onLostPointerCapture=_ref.onLostPointerCapture,onPointerCancel=_ref.onPointerCancel,onPointerDown=_ref.onPointerDown,onPointerMove=_ref.onPointerMove,onPointerUp=_ref.onPointerUp,metaComponentName=_ref.metaComponentName,children=_ref.children;var validatedTrailingComponent=useTrailingRestriction(trailing);var shouldWrapTitle=titleSuffix&&trailing&&showBackButton&&showCloseButton;var webOnlyEventHandlers=isReactNative()?{}:{onClickCapture:onClickCapture,onKeyDown:onKeyDown,onKeyUp:onKeyUp,onLostPointerCapture:onLostPointerCapture,onPointerCancel:onPointerCancel,onPointerDown:onPointerDown,onPointerMove:onPointerMove,onPointerUp:onPointerUp};return jsxs(BaseBox,Object.assign({},metaAttribute({name:metaComponentName,testID:testID}),{children:[jsxs(BaseBox,Object.assign({marginY:{base:'spacing.5',m:'spacing.6'},paddingX:{base:'spacing.5',m:'spacing.6'},touchAction:"none"},webOnlyEventHandlers,{children:[jsxs(BaseBox,{display:"flex",flexDirection:"row",userSelect:"none",children:[showBackButton?jsx(BaseBox,{overflow:"visible",marginRight:"spacing.5",children:jsx(Box,Object.assign({},centerBoxProps,{children:jsx(IconButton,{ref:backButtonRef,size:"large",icon:ChevronLeftIcon,onClick:function onClick(){return onBackButtonClick==null?void 0:onBackButtonClick();},accessibilityLabel:"Back"})}))}):null,jsxs(BaseBox,{paddingRight:"spacing.5",marginRight:"auto",flex:"auto",display:"flex",flexDirection:"row",alignItems:"flex-start",children:[leading?jsx(BaseBox,Object.assign({marginRight:"spacing.3"},centerBoxProps,{children:leading})):null,jsxs(BaseBox,{flex:"auto",children:[jsxs(BaseBox,{maxWidth:isReactNative()&&shouldWrapTitle?'100px':undefined,flexShrink:0,display:"flex",flexDirection:"row",children:[title?jsx(Text,{size:"large",marginTop:makeSize(size['1']),weight:"semibold",color:"surface.text.gray.normal",children:title}):null,titleSuffix&&jsx(BaseBox,{marginLeft:"spacing.3",children:jsx(Box,Object.assign({},centerBoxProps,{children:titleSuffix}))})]}),subtitle?jsx(Text,{variant:"body",size:"small",weight:"regular",color:"surface.text.gray.muted",children:subtitle}):null]})]}),validatedTrailingComponent?jsx(BaseBox,{marginRight:"spacing.5",children:jsx(Box,Object.assign({},centerBoxProps,{children:validatedTrailingComponent}))}):null,showCloseButton?jsx(Box,Object.assign({},centerBoxProps,{children:jsx(IconButton,{ref:closeButtonRef,size:"large",icon:CloseIcon,accessibilityLabel:"Close",onClick:function onClick(){return onCloseButtonClick==null?void 0:onCloseButtonClick();}})})):null]}),children]})),showDivider?jsx(Divider,{}):null]}));};var BaseHeader=assignWithoutSideEffects(_BaseHeader,{componentId:'BaseHeader'});
31
33
 
32
34
  export { BaseHeader };
33
35
  //# sourceMappingURL=BaseHeader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BaseHeader.js","sources":["../../../../../src/components/BaseHeaderFooter/BaseHeader.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react';\nimport type { ReactDOMAttributes } from '@use-gesture/react/dist/declarations/src/types';\nimport { Divider } from '~components/Divider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\nimport { IconButton } from '~components/Button/IconButton';\nimport { ChevronLeftIcon, CloseIcon } from '~components/Icons';\nimport type { TestID } from '~utils/types';\nimport type { BoxProps } from '~components/Box';\nimport { Box } from '~components/Box';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { isReactNative } from '~utils';\nimport { metaAttribute } from '~utils/metaAttribute';\nimport { logger, throwBladeError } from '~utils/logger';\n\ntype BaseHeaderProps = {\n title?: string;\n subtitle?: string;\n /**\n * Leading part of the header placed at the left most side of the header\n */\n leading?: React.ReactNode;\n /**\n * Trailing part of the header placed at the right most side of the header\n */\n trailing?: React.ReactNode;\n /**\n * Placed adjacent to the title text\n */\n titleSuffix?: React.ReactNode;\n /**\n * @default true\n */\n showDivider?: boolean;\n /**\n * @default false\n */\n showBackButton?: boolean;\n /**\n * @default true\n */\n showCloseButton?: boolean;\n onCloseButtonClick?: () => void;\n onBackButtonClick?: () => void;\n closeButtonRef?: React.MutableRefObject<any>;\n metaComponentName?: string;\n /**\n * inner child of BottomSheetHeader. Meant to be used for AutoComplete only\n */\n children?: React.ReactElement;\n} & Pick<\n ReactDOMAttributes,\n | 'onClickCapture'\n | 'onKeyDown'\n | 'onKeyUp'\n | 'onLostPointerCapture'\n | 'onPointerCancel'\n | 'onPointerDown'\n | 'onPointerMove'\n | 'onPointerUp'\n> &\n TestID;\n\ntype TrailingComponents = 'Button' | 'Badge' | 'Link' | 'Text' | 'Amount';\n\nconst centerBoxProps: BoxProps = {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n // We want to align title, icon, titleSuffix, trailing, closeButton to baseline\n // But we also want to keep them center aligned to each other\n // So we add a virtual Box around these slots with 28px and center align them to that box\n // We have done similar thing in figma as well (which is where this 28px comes from)\n height: '28px',\n};\n\n// prop restriction map for corresponding sub components\nconst propRestrictionMap = {\n Button: {\n size: 'xsmall',\n variant: 'tertiary',\n },\n Badge: {\n size: 'medium',\n },\n Link: {\n size: 'medium',\n },\n Text: {\n size: 'medium',\n variant: 'body',\n },\n Amount: {\n type: 'body',\n size: 'medium',\n },\n} as const;\n\nconst useTrailingRestriction = (trailing: React.ReactNode): React.ReactNode => {\n const [\n validatedTrailingComponent,\n setValidatedTrailingComponent,\n ] = React.useState<React.ReactElement | null>(null);\n\n // validate and restrict sub component props in trailing prop\n React.useEffect(() => {\n if (React.isValidElement(trailing)) {\n const trailingComponentType = getComponentId(trailing) as TrailingComponents;\n const restrictedProps = propRestrictionMap[trailingComponentType];\n const allowedComponents = Object.keys(propRestrictionMap);\n if (__DEV__) {\n if (!restrictedProps) {\n throwBladeError({\n message: `Only one of \\`${allowedComponents.join(\n ', ',\n )}\\` component is accepted as trailing`,\n moduleName: 'Header',\n });\n }\n }\n\n const restrictedPropKeys = Object.keys(propRestrictionMap[trailingComponentType]);\n for (const prop of restrictedPropKeys) {\n if (trailing?.props?.hasOwnProperty(prop)) {\n logger({\n message: `Do not pass \"${prop}\" to \"${trailingComponentType}\" while inside Header trailing, because we override it.`,\n moduleName: 'Header',\n type: 'warn',\n });\n }\n }\n setValidatedTrailingComponent(\n React.cloneElement(trailing as React.ReactElement, restrictedProps),\n );\n }\n }, [trailing]);\n\n return validatedTrailingComponent;\n};\n\nconst _BaseHeader = ({\n title,\n subtitle,\n leading,\n titleSuffix,\n trailing,\n showDivider = true,\n showBackButton = false,\n showCloseButton = true,\n onBackButtonClick,\n onCloseButtonClick,\n closeButtonRef,\n testID,\n onClickCapture,\n onKeyDown,\n onKeyUp,\n onLostPointerCapture,\n onPointerCancel,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n metaComponentName,\n children,\n}: BaseHeaderProps): React.ReactElement => {\n const validatedTrailingComponent = useTrailingRestriction(trailing);\n const shouldWrapTitle = titleSuffix && trailing && showBackButton && showCloseButton;\n\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 return (\n <BaseBox {...metaAttribute({ name: metaComponentName, testID })}>\n <BaseBox\n marginY={{ base: 'spacing.5', m: 'spacing.6' }}\n paddingX={{ base: 'spacing.5', m: 'spacing.6' }}\n touchAction=\"none\"\n {...webOnlyEventHandlers}\n >\n <BaseBox display=\"flex\" flexDirection=\"row\" userSelect=\"none\">\n {showBackButton ? (\n <BaseBox overflow=\"visible\" marginRight=\"spacing.5\">\n <Box {...centerBoxProps}>\n <IconButton\n size=\"large\"\n icon={ChevronLeftIcon}\n onClick={() => onBackButtonClick?.()}\n accessibilityLabel=\"Back\"\n />\n </Box>\n </BaseBox>\n ) : null}\n <BaseBox\n paddingRight=\"spacing.5\"\n marginRight=\"auto\"\n flex=\"auto\"\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"flex-start\"\n >\n {leading ? (\n <BaseBox\n width=\"spacing.8\"\n height=\"spacing.8\"\n marginRight=\"spacing.3\"\n {...centerBoxProps}\n >\n {leading}\n </BaseBox>\n ) : null}\n <BaseBox flex=\"auto\">\n <BaseBox\n // Explicitly setting maxWidth in React Native because text is not being wrapped properly when multiple fix width components are rendered in header\n // In web, flex containers seem to work a expected\n // @todo: resolve this if we figure out some better solution later\n maxWidth={isReactNative() && shouldWrapTitle ? '100px' : undefined}\n flexShrink={0}\n display=\"flex\"\n flexDirection=\"row\"\n >\n {title ? (\n <Text size=\"large\" weight=\"semibold\" color=\"surface.text.gray.normal\">\n {title}\n </Text>\n ) : null}\n {titleSuffix && (\n <BaseBox marginLeft=\"spacing.3\">\n <Box {...centerBoxProps}>{titleSuffix}</Box>\n </BaseBox>\n )}\n </BaseBox>\n {subtitle ? (\n <Text variant=\"body\" size=\"small\" weight=\"regular\" color=\"surface.text.gray.muted\">\n {subtitle}\n </Text>\n ) : null}\n </BaseBox>\n </BaseBox>\n {validatedTrailingComponent ? (\n <BaseBox marginRight=\"spacing.5\">\n <Box {...centerBoxProps}>{validatedTrailingComponent}</Box>\n </BaseBox>\n ) : null}\n {showCloseButton ? (\n <Box {...centerBoxProps}>\n <IconButton\n ref={closeButtonRef}\n size=\"large\"\n icon={CloseIcon}\n accessibilityLabel=\"Close\"\n onClick={() => onCloseButtonClick?.()}\n />\n </Box>\n ) : null}\n </BaseBox>\n {children}\n </BaseBox>\n {showDivider ? <Divider /> : null}\n </BaseBox>\n );\n};\n\nconst BaseHeader = assignWithoutSideEffects(_BaseHeader, {\n componentId: 'BaseHeader',\n});\n\nexport type { BaseHeaderProps };\nexport { BaseHeader };\n"],"names":["centerBoxProps","display","alignItems","justifyContent","height","propRestrictionMap","Button","size","variant","Badge","Link","Text","Amount","type","useTrailingRestriction","trailing","_React$useState","React","useState","_React$useState2","_slicedToArray","validatedTrailingComponent","setValidatedTrailingComponent","useEffect","isValidElement","trailingComponentType","getComponentId","restrictedProps","allowedComponents","Object","keys","__DEV__","throwBladeError","message","join","moduleName","restrictedPropKeys","prop","_trailing$props","props","hasOwnProperty","logger","cloneElement","_BaseHeader","_ref","title","subtitle","leading","titleSuffix","_ref$showDivider","showDivider","_ref$showBackButton","showBackButton","_ref$showCloseButton","showCloseButton","onBackButtonClick","onCloseButtonClick","closeButtonRef","testID","onClickCapture","onKeyDown","onKeyUp","onLostPointerCapture","onPointerCancel","onPointerDown","onPointerMove","onPointerUp","metaComponentName","children","shouldWrapTitle","webOnlyEventHandlers","isReactNative","_jsxs","BaseBox","assign","metaAttribute","name","marginY","base","m","paddingX","touchAction","flexDirection","userSelect","_jsx","overflow","marginRight","Box","IconButton","icon","ChevronLeftIcon","onClick","accessibilityLabel","paddingRight","flex","width","maxWidth","undefined","flexShrink","weight","color","marginLeft","ref","CloseIcon","Divider","BaseHeader","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmEA,IAAMA,cAAwB,CAAG,CAC/BC,OAAO,CAAE,MAAM,CACfC,UAAU,CAAE,QAAQ,CACpBC,cAAc,CAAE,QAAQ,CAKxBC,MAAM,CAAE,MACV,CAAC,CAGD,IAAMC,kBAAkB,CAAG,CACzBC,MAAM,CAAE,CACNC,IAAI,CAAE,QAAQ,CACdC,OAAO,CAAE,UACX,CAAC,CACDC,KAAK,CAAE,CACLF,IAAI,CAAE,QACR,CAAC,CACDG,IAAI,CAAE,CACJH,IAAI,CAAE,QACR,CAAC,CACDI,IAAI,CAAE,CACJJ,IAAI,CAAE,QAAQ,CACdC,OAAO,CAAE,MACX,CAAC,CACDI,MAAM,CAAE,CACNC,IAAI,CAAE,MAAM,CACZN,IAAI,CAAE,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,CAAlBA,kBAAkB,EAAI,CAAA,CAAC,CACvC,CAAC,CACC,CAAA,CAAC,CACJ,IAAI,CACD,CAAA,CAAC,CACTY,QAAQ,CACF,CAAA,CAAA,CAAC,CACTlB,WAAW,CAAGkC,GAAA,CAACoB,OAAO,CAAE,EAAA,CAAC,CAAG,IAAI,CAC1B,CAAA,CAAA,CAAC,CAEd,CAAC,CAEK,IAAAC,UAAU,CAAGC,wBAAwB,CAAC/D,WAAW,CAAE,CACvDgE,WAAW,CAAE,YACf,CAAC;;;;"}
1
+ {"version":3,"file":"BaseHeader.js","sources":["../../../../../src/components/BaseHeaderFooter/BaseHeader.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react';\nimport type { ReactDOMAttributes } from '@use-gesture/react/dist/declarations/src/types';\nimport { Divider } from '~components/Divider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\nimport { IconButton } from '~components/Button/IconButton';\nimport { ChevronLeftIcon, CloseIcon } from '~components/Icons';\nimport type { TestID } from '~utils/types';\nimport type { BoxProps } from '~components/Box';\nimport { Box } from '~components/Box';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { isReactNative, makeSize } from '~utils';\nimport { metaAttribute } from '~utils/metaAttribute';\nimport { logger, throwBladeError } from '~utils/logger';\nimport { size } from '~tokens/global';\n\ntype BaseHeaderProps = {\n title?: string;\n subtitle?: string;\n /**\n * Leading part of the header placed at the left most side of the header\n */\n leading?: React.ReactNode;\n /**\n * Trailing part of the header placed at the right most side of the header\n */\n trailing?: React.ReactNode;\n /**\n * Placed adjacent to the title text\n */\n titleSuffix?: React.ReactNode;\n /**\n * @default true\n */\n showDivider?: boolean;\n /**\n * @default false\n */\n showBackButton?: boolean;\n /**\n * @default true\n */\n showCloseButton?: boolean;\n onCloseButtonClick?: () => void;\n onBackButtonClick?: () => void;\n closeButtonRef?: React.MutableRefObject<any>;\n backButtonRef?: React.MutableRefObject<any>;\n metaComponentName?: string;\n /**\n * inner child of BottomSheetHeader. Meant to be used for AutoComplete only\n */\n children?: React.ReactElement;\n} & Pick<\n ReactDOMAttributes,\n | 'onClickCapture'\n | 'onKeyDown'\n | 'onKeyUp'\n | 'onLostPointerCapture'\n | 'onPointerCancel'\n | 'onPointerDown'\n | 'onPointerMove'\n | 'onPointerUp'\n> &\n TestID;\n\ntype TrailingComponents = 'Button' | 'Badge' | 'Link' | 'Text' | 'Amount';\n\nconst centerBoxProps: BoxProps = {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n // We want to align title, icon, titleSuffix, trailing, closeButton to baseline\n // But we also want to keep them center aligned to each other\n // So we add a virtual Box around these slots with 28px and center align them to that box\n // We have done similar thing in figma as well (which is where this 28px comes from)\n height: '28px',\n};\n\n// prop restriction map for corresponding sub components\nconst propRestrictionMap = {\n Button: {\n size: 'xsmall',\n variant: 'tertiary',\n },\n Badge: {\n size: 'medium',\n },\n Link: {\n size: 'medium',\n },\n Text: {\n size: 'medium',\n variant: 'body',\n },\n Amount: {\n type: 'body',\n size: 'medium',\n },\n} as const;\n\nconst useTrailingRestriction = (trailing: React.ReactNode): React.ReactNode => {\n const [\n validatedTrailingComponent,\n setValidatedTrailingComponent,\n ] = React.useState<React.ReactElement | null>(null);\n\n // validate and restrict sub component props in trailing prop\n React.useEffect(() => {\n if (React.isValidElement(trailing)) {\n const trailingComponentType = getComponentId(trailing) as TrailingComponents;\n const restrictedProps = propRestrictionMap[trailingComponentType];\n const allowedComponents = Object.keys(propRestrictionMap);\n if (__DEV__) {\n if (!restrictedProps) {\n throwBladeError({\n message: `Only one of \\`${allowedComponents.join(\n ', ',\n )}\\` component is accepted as trailing`,\n moduleName: 'Header',\n });\n }\n }\n\n const restrictedPropKeys = Object.keys(propRestrictionMap[trailingComponentType]);\n for (const prop of restrictedPropKeys) {\n if (trailing?.props?.hasOwnProperty(prop)) {\n logger({\n message: `Do not pass \"${prop}\" to \"${trailingComponentType}\" while inside Header trailing, because we override it.`,\n moduleName: 'Header',\n type: 'warn',\n });\n }\n }\n setValidatedTrailingComponent(\n React.cloneElement(trailing as React.ReactElement, restrictedProps),\n );\n }\n }, [trailing]);\n\n return validatedTrailingComponent;\n};\n\nconst _BaseHeader = ({\n title,\n subtitle,\n leading,\n titleSuffix,\n trailing,\n showDivider = true,\n showBackButton = false,\n showCloseButton = true,\n onBackButtonClick,\n onCloseButtonClick,\n closeButtonRef,\n backButtonRef,\n testID,\n onClickCapture,\n onKeyDown,\n onKeyUp,\n onLostPointerCapture,\n onPointerCancel,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n metaComponentName,\n children,\n}: BaseHeaderProps): React.ReactElement => {\n const validatedTrailingComponent = useTrailingRestriction(trailing);\n const shouldWrapTitle = titleSuffix && trailing && showBackButton && showCloseButton;\n\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 return (\n <BaseBox {...metaAttribute({ name: metaComponentName, testID })}>\n <BaseBox\n marginY={{ base: 'spacing.5', m: 'spacing.6' }}\n paddingX={{ base: 'spacing.5', m: 'spacing.6' }}\n touchAction=\"none\"\n {...webOnlyEventHandlers}\n >\n <BaseBox display=\"flex\" flexDirection=\"row\" userSelect=\"none\">\n {showBackButton ? (\n <BaseBox overflow=\"visible\" marginRight=\"spacing.5\">\n <Box {...centerBoxProps}>\n <IconButton\n ref={backButtonRef}\n size=\"large\"\n icon={ChevronLeftIcon}\n onClick={() => onBackButtonClick?.()}\n accessibilityLabel=\"Back\"\n />\n </Box>\n </BaseBox>\n ) : null}\n <BaseBox\n paddingRight=\"spacing.5\"\n marginRight=\"auto\"\n flex=\"auto\"\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"flex-start\"\n >\n {leading ? (\n <BaseBox marginRight=\"spacing.3\" {...centerBoxProps}>\n {leading}\n </BaseBox>\n ) : null}\n <BaseBox flex=\"auto\">\n <BaseBox\n // Explicitly setting maxWidth in React Native because text is not being wrapped properly when multiple fix width components are rendered in header\n // In web, flex containers seem to work a expected\n // @todo: resolve this if we figure out some better solution later\n maxWidth={isReactNative() && shouldWrapTitle ? '100px' : undefined}\n flexShrink={0}\n display=\"flex\"\n flexDirection=\"row\"\n >\n {title ? (\n <Text\n size=\"large\"\n marginTop={makeSize(size['1'])}\n weight=\"semibold\"\n color=\"surface.text.gray.normal\"\n >\n {title}\n </Text>\n ) : null}\n {titleSuffix && (\n <BaseBox marginLeft=\"spacing.3\">\n <Box {...centerBoxProps}>{titleSuffix}</Box>\n </BaseBox>\n )}\n </BaseBox>\n {subtitle ? (\n <Text variant=\"body\" size=\"small\" weight=\"regular\" color=\"surface.text.gray.muted\">\n {subtitle}\n </Text>\n ) : null}\n </BaseBox>\n </BaseBox>\n {validatedTrailingComponent ? (\n <BaseBox marginRight=\"spacing.5\">\n <Box {...centerBoxProps}>{validatedTrailingComponent}</Box>\n </BaseBox>\n ) : null}\n {showCloseButton ? (\n <Box {...centerBoxProps}>\n <IconButton\n ref={closeButtonRef}\n size=\"large\"\n icon={CloseIcon}\n accessibilityLabel=\"Close\"\n onClick={() => onCloseButtonClick?.()}\n />\n </Box>\n ) : null}\n </BaseBox>\n {children}\n </BaseBox>\n {showDivider ? <Divider /> : null}\n </BaseBox>\n );\n};\n\nconst BaseHeader = assignWithoutSideEffects(_BaseHeader, {\n componentId: 'BaseHeader',\n});\n\nexport type { BaseHeaderProps };\nexport { BaseHeader };\n"],"names":["centerBoxProps","display","alignItems","justifyContent","height","propRestrictionMap","Button","size","variant","Badge","Link","Text","Amount","type","useTrailingRestriction","trailing","_React$useState","React","useState","_React$useState2","_slicedToArray","validatedTrailingComponent","setValidatedTrailingComponent","useEffect","isValidElement","trailingComponentType","getComponentId","restrictedProps","allowedComponents","Object","keys","__DEV__","throwBladeError","message","join","moduleName","restrictedPropKeys","prop","_trailing$props","props","hasOwnProperty","logger","cloneElement","_BaseHeader","_ref","title","subtitle","leading","titleSuffix","_ref$showDivider","showDivider","_ref$showBackButton","showBackButton","_ref$showCloseButton","showCloseButton","onBackButtonClick","onCloseButtonClick","closeButtonRef","backButtonRef","testID","onClickCapture","onKeyDown","onKeyUp","onLostPointerCapture","onPointerCancel","onPointerDown","onPointerMove","onPointerUp","metaComponentName","children","shouldWrapTitle","webOnlyEventHandlers","isReactNative","_jsxs","BaseBox","assign","metaAttribute","name","marginY","base","m","paddingX","touchAction","flexDirection","userSelect","_jsx","overflow","marginRight","Box","IconButton","ref","icon","ChevronLeftIcon","onClick","accessibilityLabel","paddingRight","flex","maxWidth","undefined","flexShrink","marginTop","makeSize","weight","color","marginLeft","CloseIcon","Divider","BaseHeader","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqEA,IAAMA,cAAwB,CAAG,CAC/BC,OAAO,CAAE,MAAM,CACfC,UAAU,CAAE,QAAQ,CACpBC,cAAc,CAAE,QAAQ,CAKxBC,MAAM,CAAE,MACV,CAAC,CAGD,IAAMC,kBAAkB,CAAG,CACzBC,MAAM,CAAE,CACNC,IAAI,CAAE,QAAQ,CACdC,OAAO,CAAE,UACX,CAAC,CACDC,KAAK,CAAE,CACLF,IAAI,CAAE,QACR,CAAC,CACDG,IAAI,CAAE,CACJH,IAAI,CAAE,QACR,CAAC,CACDI,IAAI,CAAE,CACJJ,IAAI,CAAE,QAAQ,CACdC,OAAO,CAAE,MACX,CAAC,CACDI,MAAM,CAAE,CACNC,IAAI,CAAE,MAAM,CACZN,IAAI,CAAE,QACR,CACF,CAAU,CAEV,IAAMO,sBAAsB,CAAG,SAAzBA,sBAAsBA,CAAIC,QAAyB,CAAsB,CAC7E,IAAAC,eAAA,CAGIC,cAAK,CAACC,QAAQ,CAA4B,IAAI,CAAC,CAAAC,gBAAA,CAAAC,cAAA,CAAAJ,eAAA,CAFjDK,CA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AA,CAAC,CACTnB,WAAW,CAAGmC,GAAA,CAACqB,OAAO,CAAE,EAAA,CAAC,CAAG,IAAI,CAC1B,CAAA,CAAA,CAAC,CAEd,CAAC,CAEK,IAAAC,UAAU,CAAGC,wBAAwB,CAACjE,WAAW,CAAE,CACvDkE,WAAW,CAAE,YACf,CAAC;;;;"}
@@ -19,9 +19,10 @@ import { useIsomorphicLayoutEffect } from '../../utils/useIsomorphicLayoutEffect
19
19
  import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
20
20
  import { makeSpace } from '../../utils/makeSpace/makeSpace.js';
21
21
  import { getComponentId } from '../../utils/isValidAllowedChildren/isValidAllowedChildren.js';
22
+ import { componentZIndices } from '../../utils/componentZIndices.js';
22
23
  import { jsx, jsxs } from 'react/jsx-runtime';
23
24
 
24
- 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;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$useState10=_slicedToArray(_React$useState9,2),footerHeight=_React$useState10[0],setFooterHeight=_React$useState10[1];var _React$useState11=React__default.useState(0),_React$useState12=_slicedToArray(_React$useState11,2),contentHeight=_React$useState12[0],setContentHeight=_React$useState12[1];var _React$useState13=React__default.useState(true),_React$useState14=_slicedToArray(_React$useState13,2),hasBodyPadding=_React$useState14[0],setHasBodyPadding=_React$useState14[1];var _React$useState15=React__default.useState(false),_React$useState16=_slicedToArray(_React$useState15,2),isHeaderEmpty=_React$useState16[0],setIsHeaderEmpty=_React$useState16[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 zIndex=100-currentStackIndex;useIsomorphicLayoutEffect(function(){if(bottomSheetAndDropdownGlue!=null&&bottomSheetAndDropdownGlue.hasAutoCompleteInBottomSheetHeader){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();},[bottomSheetAndDropdownGlue,onDismiss]);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:zIndex}));},[zIndex]);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:zIndex,children:jsx(BottomSheetGrabHandle,{})}),header]});},[isHeaderEmpty,zIndex,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,scrollRef:function scrollRef(){},bind:{},defaultInitialFocusRef:defaultInitialFocusRef,isHeaderFloating:isHeaderFloating,setHasBodyPadding:setHasBodyPadding,setIsHeaderEmpty:setIsHeaderEmpty};},[_isOpen,contentHeight,footerHeight,handleOnClose,headerHeight,isHeaderFloating]);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:true,enableOverDrag:true,enableContentPanningGesture:true,ref:sheetRef,index:_isOpen?initialSnapPoint.current:-1,containerStyle:{zIndex:zIndex},animateOnMount:true,handleComponent:renderHandle,backgroundComponent:BottomSheetSurface,footerComponent:renderFooter,backdropComponent:renderBackdrop,onClose:close,snapPoints:_snapPoints,children:body})})})});};var BottomSheet=assignWithoutSideEffects(_BottomSheet,{componentId:ComponentIds.BottomSheet});
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$useState10=_slicedToArray(_React$useState9,2),footerHeight=_React$useState10[0],setFooterHeight=_React$useState10[1];var _React$useState11=React__default.useState(0),_React$useState12=_slicedToArray(_React$useState11,2),contentHeight=_React$useState12[0],setContentHeight=_React$useState12[1];var _React$useState13=React__default.useState(true),_React$useState14=_slicedToArray(_React$useState13,2),hasBodyPadding=_React$useState14[0],setHasBodyPadding=_React$useState14[1];var _React$useState15=React__default.useState(false),_React$useState16=_slicedToArray(_React$useState15,2),isHeaderEmpty=_React$useState16[0],setIsHeaderEmpty=_React$useState16[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.hasAutoCompleteInBottomSheetHeader){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();},[bottomSheetAndDropdownGlue,onDismiss]);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,scrollRef:function scrollRef(){},bind:{},defaultInitialFocusRef:defaultInitialFocusRef,isHeaderFloating:isHeaderFloating,setHasBodyPadding:setHasBodyPadding,setIsHeaderEmpty:setIsHeaderEmpty};},[_isOpen,contentHeight,footerHeight,handleOnClose,headerHeight,isHeaderFloating]);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:true,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});
25
26
 
26
27
  export { BottomSheet };
27
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';\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}: 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 zIndex = 100 - currentStackIndex;\n\n // if bottomSheet height is >35% & <50% then set initial snapPoint to 35%\n useIsomorphicLayoutEffect(() => {\n if (bottomSheetAndDropdownGlue?.hasAutoCompleteInBottomSheetHeader) {\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): 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): React.ReactElement => {\n return <BottomSheetBackdrop {...props} zIndex={zIndex} />;\n },\n [zIndex],\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={zIndex}>\n <BottomSheetGrabHandle />\n </BaseBox>\n {header}\n </BaseBox>\n );\n }, [isHeaderEmpty, zIndex, 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 }}\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","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$useState10","footerHeight","setFooterHeight","_React$useState11","_React$useState12","contentHeight","setContentHeight","_React$useState13","_React$useState14","hasBodyPadding","setHasBodyPadding","_React$useState15","_React$useState16","isHeaderEmpty","setIsHeaderEmpty","initialSnapPoint","totalHeight","useMemo","id","useId","_useBottomSheetStack","useBottomSheetStack","addBottomSheetToStack","removeBottomSheetFromStack","getCurrentStackIndexById","getTopOfTheStack","currentStackIndex","zIndex","useIsomorphicLayoutEffect","hasAutoCompleteInBottomSheetHeader","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":";;;;;;;;;;;;;;;;;;;;;;;AA4BA,IAAMA,kBAAkB,CAAGC,MAAM,CAACC,OAAO,CAAC,CAAC,SAAAC,IAAA,CAAe,CAAA,IAAZC,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,MAAM,CACrDC,cAAc,CAAE,QAAQ,CACxBC,UAAU,CAAE,QAAQ,CACpBC,QAAQ,CAAE,UACZ,CAAC,CACH,CAAC,CAAC,CAEF,IAAMC,cAAc,CAAG,SAAjBA,cAAcA,CAAIC,OAAkC,CAAW,CACnE,IAAMC,QAAQ,CAAGC,cAAc,CAACF,OAAO,CAAC,CACxC,GAAIC,QAAQ,CAAE,CACZE,iBAAiB,CAACC,qBAAqB,CAACH,QAAQ,CAAC,CACnD,CACF,CAAC,CAED,IAAMI,YAAY,CAAG,SAAfA,YAAYA,CAAAC,KAAA,CAM0B,CAAA,IAL1CC,QAAQ,C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,IAAAA,CAAAA,cAAc,MACdC,2BAA2B,CAAA,IAAA,CAC3BC,GAAG,CAAElI,QAAS,CAGdmI,KAAK,CAAEpH,OAAO,CAAGqB,gBAAgB,CAACe,OAAO,CAAG,CAAC,CAAE,CAC/CiF,cAAc,CAAE,CAAEpF,MAAM,CAANA,MAAO,CAAE,CAC3BqF,cAAc,CAAE,IAAK,CACrBC,eAAe,CAAEzC,YAAa,CAC9B0C,mBAAmB,CAAE3K,kBAAmB,CACxC4K,eAAe,CAAExD,YAAa,CAC9ByD,iBAAiB,CAAE9C,cAAe,CAClC+C,OAAO,CAAE/E,KAAM,CACfpE,UAAU,CAAEiE,WAAY,CAAAnE,QAAA,CAEvBwB,IAAI,CACY,CAAC,CACO,CAAC,CACN,CAAC,CACrB,CAAC,CAEb,CAAC,CAEK,IAAA8H,WAAW,CAAGC,wBAAwB,CAACzJ,YAAY,CAAE,CACzD0J,WAAW,CAAEjE,YAAY,CAAC+D,WAC5B,CAAC;;;;"}
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?.hasAutoCompleteInBottomSheetHeader) {\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): 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): 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$useState10","footerHeight","setFooterHeight","_React$useState11","_React$useState12","contentHeight","setContentHeight","_React$useState13","_React$useState14","hasBodyPadding","setHasBodyPadding","_React$useState15","_React$useState16","isHeaderEmpty","setIsHeaderEmpty","initialSnapPoint","totalHeight","useMemo","id","useId","_useBottomSheetStack","useBottomSheetStack","addBottomSheetToStack","removeBottomSheetFromStack","getCurrentStackIndexById","getTopOfTheStack","currentStackIndex","bottomSheetZIndex","useIsomorphicLayoutEffect","hasAutoCompleteInBottomSheetHeader","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,MAAM,CACrDC,cAAc,CAAE,QAAQ,CACxBC,UAAU,CAAE,QAAQ,CACpBC,QAAQ,CAAE,UACZ,CAAC,CACH,CAAC,CAAC,CAEF,IAAMC,cAAc,CAAG,SAAjBA,cAAcA,CAAIC,OAAkC,CAAW,CACnE,IAAMC,QAAQ,CAAGC,cAAc,CAACF,OAAO,CAAC,CACxC,GAAIC,QAAQ,CAAE,CACZE,iBAAiB,CAACC,qBAAqB,CAACH,QAAQ,CAAC,CAC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C/CiG,GAAA,CAACsC,iBAAiB,EAChBC,KAAK,CAGHrI,MAAM,CACF,CAEEsI,WAAW,CAAE,wBAAwB,CACrCC,YAAY,CAAE,CACZC,KAAK,CAAE,CAAC,CACRxE,MAAM,CAAE,CAAC,EACX,CAAC,CACDyE,aAAa,CAAE,GAAG,CAClBC,YAAY,CAAE,EAGhB,CAAC,CACD,EACL,CACDC,oBAAoB,CAAA,IAAA,CACpBC,cAAc,CACdC,IAAAA,CAAAA,2BAA2B,MAC3BC,GAAG,CAAElI,QAAS,CAGdmI,KAAK,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,CAAE/K,kBAAmB,CACxCgL,eAAe,CAAExD,YAAa,CAC9ByD,iBAAiB,CAAE9C,cAAe,CAClC+C,OAAO,CAAE/E,KAAM,CACfxE,UAAU,CAAEqE,WAAY,CAAAvE,QAAA,CAEvB4B,IAAI,CACY,CAAC,CACO,CAAC,CACN,CAAC,CACrB,CAAC,CAEb,CAAC,CAEK,IAAA8H,WAAW,CAAGC,wBAAwB,CAAC7J,YAAY,CAAE,CACzD8J,WAAW,CAAEjE,YAAY,CAAC+D,WAC5B,CAAC;;;;"}
@@ -0,0 +1,7 @@
1
+ import { throwBladeError } from '../../utils/logger/logger.js';
2
+ import { jsx, Fragment } from 'react/jsx-runtime';
3
+
4
+ var Breadcrumb=function Breadcrumb(_){throwBladeError({message:'Breadcrumb is not yet implemented for native',moduleName:'Breadcrumb'});return jsx(Fragment,{});};
5
+
6
+ export { Breadcrumb };
7
+ //# sourceMappingURL=Breadcrumb.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Breadcrumb.native.js","sources":["../../../../../src/components/Breadcrumb/Breadcrumb.native.tsx"],"sourcesContent":["import type { BreadcrumbProps } from './types';\nimport { throwBladeError } from '~utils/logger';\n\nconst Breadcrumb = (_: BreadcrumbProps): React.ReactElement => {\n throwBladeError({\n message: 'Breadcrumb is not yet implemented for native',\n moduleName: 'Breadcrumb',\n });\n\n return <></>;\n};\n\nexport { Breadcrumb };\n"],"names":["Breadcrumb","_","throwBladeError","message","moduleName","_jsx","_Fragment"],"mappings":";;;AAGM,IAAAA,UAAU,CAAG,SAAbA,UAAUA,CAAIC,CAAkB,CAAyB,CAC7DC,eAAe,CAAC,CACdC,OAAO,CAAE,8CAA8C,CACvDC,UAAU,CAAE,YACd,CAAC,CAAC,CAEF,OAAOC,GAAA,CAAAC,QAAA,CAAA,EAAI,CAAC,CACd;;;;"}
@@ -0,0 +1,7 @@
1
+ import { throwBladeError } from '../../utils/logger/logger.js';
2
+ import { jsx, Fragment } from 'react/jsx-runtime';
3
+
4
+ var BreadcrumbItem=function BreadcrumbItem(_){throwBladeError({message:'BreadcrumbItem is not yet implemented for native',moduleName:'BreadcrumbItem'});return jsx(Fragment,{});};
5
+
6
+ export { BreadcrumbItem };
7
+ //# sourceMappingURL=BreadcrumbItem.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BreadcrumbItem.native.js","sources":["../../../../../src/components/Breadcrumb/BreadcrumbItem.native.tsx"],"sourcesContent":["import type { BreadcrumbItemProps } from './types';\nimport { throwBladeError } from '~utils/logger';\n\nconst BreadcrumbItem = (_: BreadcrumbItemProps): React.ReactElement => {\n throwBladeError({\n message: 'BreadcrumbItem is not yet implemented for native',\n moduleName: 'BreadcrumbItem',\n });\n\n return <></>;\n};\n\nexport { BreadcrumbItem };\n"],"names":["BreadcrumbItem","_","throwBladeError","message","moduleName","_jsx","_Fragment"],"mappings":";;;AAGM,IAAAA,cAAc,CAAG,SAAjBA,cAAcA,CAAIC,CAAsB,CAAyB,CACrEC,eAAe,CAAC,CACdC,OAAO,CAAE,kDAAkD,CAC3DC,UAAU,CAAE,gBACd,CAAC,CAAC,CAEF,OAAOC,GAAA,CAAAC,QAAA,CAAA,EAAI,CAAC,CACd;;;;"}
@@ -2,7 +2,7 @@ import '../../../tokens/global/typography.js';
2
2
  import '../../../tokens/global/motion.js';
3
3
  import { size } from '../../../tokens/global/size.js';
4
4
 
5
- var backgroundColor=function backgroundColor(property){var isBorder=property==='border';return {base:{primary:{default:`interactive.${property}.primary.default`,highlighted:`interactive.${property}.primary.highlighted`,disabled:`interactive.${property}.primary.disabled`},secondary:{default:isBorder?'interactive.border.primary.default':'transparent',highlighted:isBorder?`interactive.border.primary.default`:`interactive.background.primary.faded`,disabled:isBorder?`interactive.border.primary.disabled`:`transparent`},tertiary:{default:`interactive.${property}.gray.default`,highlighted:`interactive.${property}.gray.highlighted`,disabled:`interactive.${property}.gray.disabled`}},white:{primary:{default:`interactive.${property}.staticWhite.default`,highlighted:`interactive.${property}.staticWhite.highlighted`,disabled:`interactive.${property}.staticWhite.disabled`},secondary:{default:isBorder?'interactive.border.staticWhite.highlighted':'transparent',highlighted:isBorder?'interactive.border.staticWhite.highlighted':'interactive.background.staticWhite.faded',disabled:isBorder?`interactive.border.staticWhite.disabled`:'transparent'},tertiary:{default:`interactive.background.staticWhite.faded`,highlighted:`interactive.background.staticWhite.fadedHighlighted`,disabled:`interactive.background.staticWhite.disabled`}},color:function color(_color){return {primary:{default:`interactive.${property}.${_color}.default`,highlighted:`interactive.${property}.${_color}.highlighted`,disabled:`interactive.${property}.${_color}.disabled`},secondary:{default:isBorder?`interactive.border.${_color}.default`:`interactive.background.${_color}.faded`,highlighted:isBorder?`interactive.border.${_color}.default`:`interactive.background.${_color}.fadedHighlighted`,disabled:`interactive.${property}.${_color}.disabled`}};}};};var textColor=function textColor(property){return {base:{primary:{default:`interactive.${property}.onPrimary.normal`,highlighted:`interactive.${property}.onPrimary.normal`,disabled:`interactive.${property}.primary.disabled`},secondary:{default:`interactive.${property}.primary.subtle`,highlighted:`interactive.${property}.primary.subtle`,disabled:`interactive.${property}.primary.disabled`},tertiary:{default:`interactive.${property}.gray.normal`,highlighted:`interactive.${property}.gray.normal`,disabled:`interactive.${property}.gray.disabled`}},white:{primary:{default:`interactive.${property}.staticBlack.muted`,highlighted:`interactive.${property}.staticBlack.muted`,disabled:`interactive.${property}.staticBlack.disabled`},secondary:{default:`interactive.${property}.staticWhite.normal`,highlighted:`interactive.${property}.staticWhite.normal`,disabled:`interactive.${property}.staticWhite.disabled`},tertiary:{default:`interactive.${property}.staticWhite.normal`,highlighted:`interactive.${property}.staticWhite.normal`,disabled:`interactive.${property}.staticWhite.disabled`}},color:function color(_color2){return {primary:{default:`interactive.${property}.staticWhite.normal`,highlighted:`interactive.${property}.staticWhite.normal`,disabled:`interactive.${property}.${_color2}.disabled`},secondary:{default:`interactive.${property}.${_color2}.normal`,highlighted:`interactive.${property}.${_color2}.normal`,disabled:`interactive.${property}.${_color2}.disabled`}};}};};var typography={fonts:{size:{xsmall:50,small:50,medium:100,large:200}},lineHeights:{xsmall:75,small:75,medium:100,large:200}};var minHeight={xsmall:size[28],small:size[32],medium:size[36],large:size[48]};var buttonPadding={xsmall:{top:0,bottom:0,left:3,right:3},small:{top:0,bottom:0,left:4,right:4},medium:{top:0,bottom:0,left:6,right:6},large:{top:0,bottom:0,left:6,right:6}};var buttonIconOnlyPadding={xsmall:{top:0,bottom:0,left:4,right:4},small:{top:0,bottom:0,left:3,right:3},medium:{top:0,bottom:0,left:3,right:3},large:{top:0,bottom:0,left:2,right:2}};var buttonSizeToIconSizeMap={xsmall:'small',small:'small',medium:'medium',large:'medium'};var buttonIconOnlySizeToIconSizeMap={xsmall:'small',small:'small',medium:'medium',large:'medium'};var buttonSizeToSpinnerSizeMap={xsmall:'medium',small:'large',medium:'large',large:'xlarge'};var buttonIconPadding={xsmall:1,small:1,medium:2,large:2};
5
+ var backgroundColor=function backgroundColor(property){var isBorder=property==='border';return {base:{primary:{default:`interactive.${property}.primary.default`,highlighted:`interactive.${property}.primary.highlighted`,disabled:`interactive.${property}.primary.disabled`},secondary:{default:isBorder?'interactive.border.primary.default':'transparent',highlighted:isBorder?`interactive.border.primary.default`:`interactive.background.primary.faded`,disabled:isBorder?`interactive.border.primary.disabled`:`transparent`},tertiary:{default:`interactive.${property}.gray.default`,highlighted:`interactive.${property}.gray.highlighted`,disabled:`interactive.${property}.gray.disabled`}},white:{primary:{default:`interactive.${property}.staticWhite.default`,highlighted:`interactive.${property}.staticWhite.highlighted`,disabled:`interactive.${property}.staticWhite.disabled`},secondary:{default:isBorder?'interactive.border.staticWhite.highlighted':'transparent',highlighted:isBorder?'interactive.border.staticWhite.highlighted':'interactive.background.staticWhite.faded',disabled:isBorder?`interactive.border.staticWhite.disabled`:'transparent'},tertiary:{default:`interactive.background.staticWhite.faded`,highlighted:`interactive.background.staticWhite.fadedHighlighted`,disabled:`interactive.background.staticWhite.disabled`}},color:function color(_color){return {primary:{default:`interactive.${property}.${_color}.default`,highlighted:`interactive.${property}.${_color}.highlighted`,disabled:`interactive.${property}.${_color}.disabled`},secondary:{default:isBorder?`interactive.border.${_color}.default`:`interactive.background.${_color}.faded`,highlighted:isBorder?`interactive.border.${_color}.default`:`interactive.background.${_color}.fadedHighlighted`,disabled:`interactive.${property}.${_color}.disabled`}};}};};var textColor=function textColor(property){return {base:{primary:{default:`interactive.${property}.onPrimary.normal`,highlighted:`interactive.${property}.onPrimary.normal`,disabled:`interactive.${property}.primary.disabled`},secondary:{default:`interactive.${property}.primary.subtle`,highlighted:`interactive.${property}.primary.subtle`,disabled:`interactive.${property}.primary.disabled`},tertiary:{default:`interactive.${property}.gray.normal`,highlighted:`interactive.${property}.gray.normal`,disabled:`interactive.${property}.gray.disabled`}},white:{primary:{default:`interactive.${property}.staticBlack.muted`,highlighted:`interactive.${property}.staticBlack.muted`,disabled:`interactive.${property}.staticBlack.disabled`},secondary:{default:`interactive.${property}.staticWhite.normal`,highlighted:`interactive.${property}.staticWhite.normal`,disabled:`interactive.${property}.staticWhite.disabled`},tertiary:{default:`interactive.${property}.staticWhite.normal`,highlighted:`interactive.${property}.staticWhite.normal`,disabled:`interactive.${property}.staticWhite.disabled`}},color:function color(_color2){return {primary:{default:`interactive.${property}.staticWhite.normal`,highlighted:`interactive.${property}.staticWhite.normal`,disabled:`interactive.${property}.${_color2}.disabled`},secondary:{default:`interactive.${property}.${_color2}.normal`,highlighted:`interactive.${property}.${_color2}.normal`,disabled:`interactive.${property}.${_color2}.disabled`}};}};};var typography={fonts:{size:{xsmall:50,small:50,medium:100,large:200}},lineHeights:{xsmall:75,small:75,medium:100,large:200}};var minHeight={xsmall:size[28],small:size[32],medium:size[36],large:size[48]};var buttonPadding={xsmall:{top:0,bottom:0,left:3,right:3},small:{top:0,bottom:0,left:4,right:4},medium:{top:0,bottom:0,left:6,right:6},large:{top:0,bottom:0,left:6,right:6}};var buttonIconOnlyPadding={xsmall:{top:0,bottom:0,left:3,right:3},small:{top:0,bottom:0,left:3,right:3},medium:{top:0,bottom:0,left:3,right:3},large:{top:0,bottom:0,left:2,right:2}};var buttonSizeToIconSizeMap={xsmall:'small',small:'small',medium:'medium',large:'medium'};var buttonIconOnlySizeToIconSizeMap={xsmall:'small',small:'small',medium:'medium',large:'medium'};var buttonSizeToSpinnerSizeMap={xsmall:'medium',small:'large',medium:'large',large:'xlarge'};var buttonIconPadding={xsmall:1,small:1,medium:2,large:2};
6
6
 
7
7
  export { backgroundColor, buttonIconOnlyPadding, buttonIconOnlySizeToIconSizeMap, buttonIconPadding, buttonPadding, buttonSizeToIconSizeMap, buttonSizeToSpinnerSizeMap, minHeight, textColor, typography };
8
8
  //# sourceMappingURL=buttonTokens.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"buttonTokens.js","sources":["../../../../../../src/components/Button/BaseButton/buttonTokens.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/explicit-function-return-type */\nimport type { BaseButtonProps } from './BaseButton';\nimport type { Theme } from '~components/BladeProvider';\nimport type { IconSize } from '~components/Icons';\nimport type { SpinnerProps } from '~components/Spinner';\nimport type { Size } from '~tokens/global';\nimport { size } from '~tokens/global';\nimport type { FeedbackColors } from '~tokens/theme/theme';\n\nexport type ButtonMinHeight = Size[28] | Size[32] | Size[36] | Size[48];\n\nexport type ButtonTypography = {\n fonts: {\n size: Record<NonNullable<BaseButtonProps['size']>, keyof Theme['typography']['fonts']['size']>;\n };\n lineHeights: Record<\n NonNullable<BaseButtonProps['size']>,\n keyof Theme['typography']['lineHeights']\n >;\n};\n\nconst backgroundColor = (property: 'background' | 'border') => {\n const isBorder = property === 'border';\n return {\n base: {\n primary: {\n default: `interactive.${property}.primary.default`,\n highlighted: `interactive.${property}.primary.highlighted`,\n disabled: `interactive.${property}.primary.disabled`,\n },\n secondary: {\n default: isBorder ? 'interactive.border.primary.default' : 'transparent',\n highlighted: isBorder\n ? `interactive.border.primary.default`\n : `interactive.background.primary.faded`,\n disabled: isBorder ? `interactive.border.primary.disabled` : `transparent`,\n },\n tertiary: {\n default: `interactive.${property}.gray.default`,\n highlighted: `interactive.${property}.gray.highlighted`,\n disabled: `interactive.${property}.gray.disabled`,\n },\n },\n white: {\n primary: {\n default: `interactive.${property}.staticWhite.default`,\n highlighted: `interactive.${property}.staticWhite.highlighted`,\n disabled: `interactive.${property}.staticWhite.disabled`,\n },\n secondary: {\n default: isBorder ? 'interactive.border.staticWhite.highlighted' : 'transparent',\n highlighted: isBorder\n ? 'interactive.border.staticWhite.highlighted'\n : 'interactive.background.staticWhite.faded',\n disabled: isBorder ? `interactive.border.staticWhite.disabled` : 'transparent',\n },\n tertiary: {\n default: `interactive.background.staticWhite.faded`,\n highlighted: `interactive.background.staticWhite.fadedHighlighted`,\n disabled: `interactive.background.staticWhite.disabled`,\n },\n },\n color: (color: FeedbackColors) => {\n return {\n primary: {\n default: `interactive.${property}.${color}.default`,\n highlighted: `interactive.${property}.${color}.highlighted`,\n disabled: `interactive.${property}.${color}.disabled`,\n },\n secondary: {\n default: isBorder\n ? (`interactive.border.${color}.default` as const)\n : (`interactive.background.${color}.faded` as const),\n highlighted: isBorder\n ? (`interactive.border.${color}.default` as const)\n : (`interactive.background.${color}.fadedHighlighted` as const),\n disabled: `interactive.${property}.${color}.disabled`,\n },\n } as const;\n },\n } as const;\n};\n\nconst textColor = (property: 'icon' | 'text') => {\n return {\n base: {\n primary: {\n default: `interactive.${property}.onPrimary.normal`,\n highlighted: `interactive.${property}.onPrimary.normal`,\n disabled: `interactive.${property}.primary.disabled`,\n },\n secondary: {\n default: `interactive.${property}.primary.subtle`,\n highlighted: `interactive.${property}.primary.subtle`,\n disabled: `interactive.${property}.primary.disabled`,\n },\n tertiary: {\n default: `interactive.${property}.gray.normal`,\n highlighted: `interactive.${property}.gray.normal`,\n disabled: `interactive.${property}.gray.disabled`,\n },\n },\n white: {\n primary: {\n default: `interactive.${property}.staticBlack.muted`,\n highlighted: `interactive.${property}.staticBlack.muted`,\n disabled: `interactive.${property}.staticBlack.disabled`,\n },\n secondary: {\n default: `interactive.${property}.staticWhite.normal`,\n highlighted: `interactive.${property}.staticWhite.normal`,\n disabled: `interactive.${property}.staticWhite.disabled`,\n },\n tertiary: {\n default: `interactive.${property}.staticWhite.normal`,\n highlighted: `interactive.${property}.staticWhite.normal`,\n disabled: `interactive.${property}.staticWhite.disabled`,\n },\n },\n color: (color: FeedbackColors) => {\n return {\n primary: {\n default: `interactive.${property}.staticWhite.normal`,\n highlighted: `interactive.${property}.staticWhite.normal`,\n disabled: `interactive.${property}.${color}.disabled`,\n },\n secondary: {\n default: `interactive.${property}.${color}.normal`,\n highlighted: `interactive.${property}.${color}.normal`,\n disabled: `interactive.${property}.${color}.disabled`,\n },\n } as const;\n },\n } as const;\n};\n\nconst typography: ButtonTypography = {\n fonts: {\n size: {\n xsmall: 50,\n small: 50,\n medium: 100,\n large: 200,\n },\n },\n lineHeights: {\n xsmall: 75,\n small: 75,\n medium: 100,\n large: 200,\n },\n};\n\nconst minHeight: Record<NonNullable<BaseButtonProps['size']>, ButtonMinHeight> = {\n xsmall: size[28],\n small: size[32],\n medium: size[36],\n large: size[48],\n};\n\nconst buttonPadding: Record<\n NonNullable<BaseButtonProps['size']>,\n Record<'top' | 'bottom' | 'left' | 'right', keyof Theme['spacing']>\n> = {\n xsmall: {\n top: 0,\n bottom: 0,\n left: 3,\n right: 3,\n },\n small: {\n top: 0,\n bottom: 0,\n left: 4,\n right: 4,\n },\n medium: {\n top: 0,\n bottom: 0,\n left: 6,\n right: 6,\n },\n large: {\n top: 0,\n bottom: 0,\n left: 6,\n right: 6,\n },\n};\n\nconst buttonIconOnlyPadding: Record<\n NonNullable<BaseButtonProps['size']>,\n Record<'top' | 'bottom' | 'left' | 'right', keyof Theme['spacing']>\n> = {\n xsmall: {\n top: 0,\n bottom: 0,\n left: 4, // should be `6px` as per design but we're making it `8px` since `6px` is not available as a spacing token\n right: 4, // should be `6px` as per design but we're making it `8px` since `6px` is not available as a spacing token\n },\n small: {\n top: 0,\n bottom: 0,\n left: 3,\n right: 3,\n },\n medium: {\n top: 0,\n bottom: 0,\n left: 3,\n right: 3,\n },\n large: {\n top: 0,\n bottom: 0,\n left: 2,\n right: 2,\n },\n};\n\nconst buttonSizeToIconSizeMap: Record<NonNullable<BaseButtonProps['size']>, IconSize> = {\n xsmall: 'small',\n small: 'small',\n medium: 'medium',\n large: 'medium',\n};\n\nconst buttonIconOnlySizeToIconSizeMap: Record<NonNullable<BaseButtonProps['size']>, IconSize> = {\n xsmall: 'small',\n small: 'small',\n medium: 'medium',\n large: 'medium',\n};\n\nconst buttonSizeToSpinnerSizeMap: Record<\n NonNullable<BaseButtonProps['size']>,\n SpinnerProps['size']\n> = {\n xsmall: 'medium',\n small: 'large',\n medium: 'large',\n large: 'xlarge',\n};\n\nconst buttonIconPadding: Record<NonNullable<BaseButtonProps['size']>, keyof Theme['spacing']> = {\n xsmall: 1,\n small: 1,\n medium: 2,\n large: 2,\n};\n\nexport {\n backgroundColor,\n textColor,\n typography,\n minHeight,\n buttonSizeToIconSizeMap,\n buttonIconOnlySizeToIconSizeMap,\n buttonSizeToSpinnerSizeMap,\n buttonIconPadding,\n buttonPadding,\n buttonIconOnlyPadding,\n};\n"],"names":["backgroundColor","property","isBorder","base","primary","default","highlighted","disabled","secondary","tertiary","white","color","textColor","typography","fonts","size","xsmall","small","medium","large","lineHeights","minHeight","buttonPadding","top","bottom","left","right","buttonIconOnlyPadding","buttonSizeToIconSizeMap","buttonIconOnlySizeToIconSizeMap","buttonSizeToSpinnerSizeMap","buttonIconPadding"],"mappings":";;;;AAqBM,IAAAA,eAAe,CAAG,SAAlBA,eAAeA,CAAIC,QAAiC,CAAK,CAC7D,IAAMC,QAAQ,CAAGD,QAAQ,GAAK,QAAQ,CACtC,OAAO,CACLE,IAAI,CAAE,CACJC,OAAO,CAAE,CACPC,OAAO,CAAG,CAAcJ,YAAAA,EAAAA,QAAS,CAAiB,gBAAA,CAAA,CAClDK,WAAW,CAAG,eAAcL,QAAS,CAAA,oBAAA,CAAqB,CAC1DM,QAAQ,CAAG,eAAcN,QAAS,CAAA,iBAAA,CACpC,CAAC,CACDO,SAAS,CAAE,CACTH,OAAO,CAAEH,QAAQ,CAAG,oCAAoC,CAAG,aAAa,CACxEI,WAAW,CAAEJ,QAAQ,CAChB,oCAAmC,CACnC,CAAA,oCAAA,CAAqC,CAC1CK,QAAQ,CAAEL,QAAQ,CAAI,CAAA,mCAAA,CAAoC,CAAI,CAAA,WAAA,CAChE,CAAC,CACDO,QAAQ,CAAE,CACRJ,OAAO,CAAG,CAAA,YAAA,EAAcJ,QAAS,CAAc,aAAA,CAAA,CAC/CK,WAAW,CAAG,CAAcL,YAAAA,EAAAA,QAAS,mBAAkB,CACvDM,QAAQ,CAAG,CAAcN,YAAAA,EAAAA,QAAS,gBACpC,CACF,CAAC,CACDS,KAAK,CAAE,CACLN,OAAO,CAAE,CACPC,OAAO,CAAG,CAAA,YAAA,EAAcJ,QAAS,CAAqB,oBAAA,CAAA,CACtDK,WAAW,CAAG,CAAcL,YAAAA,EAAAA,QAAS,0BAAyB,CAC9DM,QAAQ,CAAG,CAAcN,YA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ACRC,MAAM,CAAE,CAAC,CACTC,KAAK,CAAE,CACT;;;;"}
1
+ {"version":3,"file":"buttonTokens.js","sources":["../../../../../../src/components/Button/BaseButton/buttonTokens.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/explicit-function-return-type */\nimport type { BaseButtonProps } from './BaseButton';\nimport type { Theme } from '~components/BladeProvider';\nimport type { IconSize } from '~components/Icons';\nimport type { SpinnerProps } from '~components/Spinner';\nimport type { Size } from '~tokens/global';\nimport { size } from '~tokens/global';\nimport type { FeedbackColors } from '~tokens/theme/theme';\n\nexport type ButtonMinHeight = Size[28] | Size[32] | Size[36] | Size[48];\n\nexport type ButtonTypography = {\n fonts: {\n size: Record<NonNullable<BaseButtonProps['size']>, keyof Theme['typography']['fonts']['size']>;\n };\n lineHeights: Record<\n NonNullable<BaseButtonProps['size']>,\n keyof Theme['typography']['lineHeights']\n >;\n};\n\nconst backgroundColor = (property: 'background' | 'border') => {\n const isBorder = property === 'border';\n return {\n base: {\n primary: {\n default: `interactive.${property}.primary.default`,\n highlighted: `interactive.${property}.primary.highlighted`,\n disabled: `interactive.${property}.primary.disabled`,\n },\n secondary: {\n default: isBorder ? 'interactive.border.primary.default' : 'transparent',\n highlighted: isBorder\n ? `interactive.border.primary.default`\n : `interactive.background.primary.faded`,\n disabled: isBorder ? `interactive.border.primary.disabled` : `transparent`,\n },\n tertiary: {\n default: `interactive.${property}.gray.default`,\n highlighted: `interactive.${property}.gray.highlighted`,\n disabled: `interactive.${property}.gray.disabled`,\n },\n },\n white: {\n primary: {\n default: `interactive.${property}.staticWhite.default`,\n highlighted: `interactive.${property}.staticWhite.highlighted`,\n disabled: `interactive.${property}.staticWhite.disabled`,\n },\n secondary: {\n default: isBorder ? 'interactive.border.staticWhite.highlighted' : 'transparent',\n highlighted: isBorder\n ? 'interactive.border.staticWhite.highlighted'\n : 'interactive.background.staticWhite.faded',\n disabled: isBorder ? `interactive.border.staticWhite.disabled` : 'transparent',\n },\n tertiary: {\n default: `interactive.background.staticWhite.faded`,\n highlighted: `interactive.background.staticWhite.fadedHighlighted`,\n disabled: `interactive.background.staticWhite.disabled`,\n },\n },\n color: (color: FeedbackColors) => {\n return {\n primary: {\n default: `interactive.${property}.${color}.default`,\n highlighted: `interactive.${property}.${color}.highlighted`,\n disabled: `interactive.${property}.${color}.disabled`,\n },\n secondary: {\n default: isBorder\n ? (`interactive.border.${color}.default` as const)\n : (`interactive.background.${color}.faded` as const),\n highlighted: isBorder\n ? (`interactive.border.${color}.default` as const)\n : (`interactive.background.${color}.fadedHighlighted` as const),\n disabled: `interactive.${property}.${color}.disabled`,\n },\n } as const;\n },\n } as const;\n};\n\nconst textColor = (property: 'icon' | 'text') => {\n return {\n base: {\n primary: {\n default: `interactive.${property}.onPrimary.normal`,\n highlighted: `interactive.${property}.onPrimary.normal`,\n disabled: `interactive.${property}.primary.disabled`,\n },\n secondary: {\n default: `interactive.${property}.primary.subtle`,\n highlighted: `interactive.${property}.primary.subtle`,\n disabled: `interactive.${property}.primary.disabled`,\n },\n tertiary: {\n default: `interactive.${property}.gray.normal`,\n highlighted: `interactive.${property}.gray.normal`,\n disabled: `interactive.${property}.gray.disabled`,\n },\n },\n white: {\n primary: {\n default: `interactive.${property}.staticBlack.muted`,\n highlighted: `interactive.${property}.staticBlack.muted`,\n disabled: `interactive.${property}.staticBlack.disabled`,\n },\n secondary: {\n default: `interactive.${property}.staticWhite.normal`,\n highlighted: `interactive.${property}.staticWhite.normal`,\n disabled: `interactive.${property}.staticWhite.disabled`,\n },\n tertiary: {\n default: `interactive.${property}.staticWhite.normal`,\n highlighted: `interactive.${property}.staticWhite.normal`,\n disabled: `interactive.${property}.staticWhite.disabled`,\n },\n },\n color: (color: FeedbackColors) => {\n return {\n primary: {\n default: `interactive.${property}.staticWhite.normal`,\n highlighted: `interactive.${property}.staticWhite.normal`,\n disabled: `interactive.${property}.${color}.disabled`,\n },\n secondary: {\n default: `interactive.${property}.${color}.normal`,\n highlighted: `interactive.${property}.${color}.normal`,\n disabled: `interactive.${property}.${color}.disabled`,\n },\n } as const;\n },\n } as const;\n};\n\nconst typography: ButtonTypography = {\n fonts: {\n size: {\n xsmall: 50,\n small: 50,\n medium: 100,\n large: 200,\n },\n },\n lineHeights: {\n xsmall: 75,\n small: 75,\n medium: 100,\n large: 200,\n },\n};\n\nconst minHeight: Record<NonNullable<BaseButtonProps['size']>, ButtonMinHeight> = {\n xsmall: size[28],\n small: size[32],\n medium: size[36],\n large: size[48],\n};\n\nconst buttonPadding: Record<\n NonNullable<BaseButtonProps['size']>,\n Record<'top' | 'bottom' | 'left' | 'right', keyof Theme['spacing']>\n> = {\n xsmall: {\n top: 0,\n bottom: 0,\n left: 3,\n right: 3,\n },\n small: {\n top: 0,\n bottom: 0,\n left: 4,\n right: 4,\n },\n medium: {\n top: 0,\n bottom: 0,\n left: 6,\n right: 6,\n },\n large: {\n top: 0,\n bottom: 0,\n left: 6,\n right: 6,\n },\n};\n\nconst buttonIconOnlyPadding: Record<\n NonNullable<BaseButtonProps['size']>,\n Record<'top' | 'bottom' | 'left' | 'right', keyof Theme['spacing']>\n> = {\n xsmall: {\n top: 0,\n bottom: 0,\n left: 3, // should be `6px` as per design but we're making it `8px` since `6px` is not available as a spacing token\n right: 3, // should be `6px` as per design but we're making it `8px` since `6px` is not available as a spacing token\n },\n small: {\n top: 0,\n bottom: 0,\n left: 3,\n right: 3,\n },\n medium: {\n top: 0,\n bottom: 0,\n left: 3,\n right: 3,\n },\n large: {\n top: 0,\n bottom: 0,\n left: 2,\n right: 2,\n },\n};\n\nconst buttonSizeToIconSizeMap: Record<NonNullable<BaseButtonProps['size']>, IconSize> = {\n xsmall: 'small',\n small: 'small',\n medium: 'medium',\n large: 'medium',\n};\n\nconst buttonIconOnlySizeToIconSizeMap: Record<NonNullable<BaseButtonProps['size']>, IconSize> = {\n xsmall: 'small',\n small: 'small',\n medium: 'medium',\n large: 'medium',\n};\n\nconst buttonSizeToSpinnerSizeMap: Record<\n NonNullable<BaseButtonProps['size']>,\n SpinnerProps['size']\n> = {\n xsmall: 'medium',\n small: 'large',\n medium: 'large',\n large: 'xlarge',\n};\n\nconst buttonIconPadding: Record<NonNullable<BaseButtonProps['size']>, keyof Theme['spacing']> = {\n xsmall: 1,\n small: 1,\n medium: 2,\n large: 2,\n};\n\nexport {\n backgroundColor,\n textColor,\n typography,\n minHeight,\n buttonSizeToIconSizeMap,\n buttonIconOnlySizeToIconSizeMap,\n buttonSizeToSpinnerSizeMap,\n buttonIconPadding,\n buttonPadding,\n buttonIconOnlyPadding,\n};\n"],"names":["backgroundColor","property","isBorder","base","primary","default","highlighted","disabled","secondary","tertiary","white","color","textColor","typography","fonts","size","xsmall","small","medium","large","lineHeights","minHeight","buttonPadding","top","bottom","left","right","buttonIconOnlyPadding","buttonSizeToIconSizeMap","buttonIconOnlySizeToIconSizeMap","buttonSizeToSpinnerSizeMap","buttonIconPadding"],"mappings":";;;;AAqBM,IAAAA,eAAe,CAAG,SAAlBA,eAAeA,CAAIC,QAAiC,CAAK,CAC7D,IAAMC,QAAQ,CAAGD,QAAQ,GAAK,QAAQ,CACtC,OAAO,CACLE,IAAI,CAAE,CACJC,OAAO,CAAE,CACPC,OAAO,CAAG,CAAcJ,YAAAA,EAAAA,QAAS,CAAiB,gBAAA,CAAA,CAClDK,WAAW,CAAG,eAAcL,QAAS,CAAA,oBAAA,CAAqB,CAC1DM,QAAQ,CAAG,eAAcN,QAAS,CAAA,iBAAA,CACpC,CAAC,CACDO,SAAS,CAAE,CACTH,OAAO,CAAEH,QAAQ,CAAG,oCAAoC,CAAG,aAAa,CACxEI,WAAW,CAAEJ,QAAQ,CAChB,oCAAmC,CACnC,CAAA,oCAAA,CAAqC,CAC1CK,QAAQ,CAAEL,QAAQ,CAAI,CAAA,mCAAA,CAAoC,CAAI,CAAA,WAAA,CAChE,CAAC,CACDO,QAAQ,CAAE,CACRJ,OAAO,CAAG,CAAA,YAAA,EAAcJ,QAAS,CAAc,aAAA,CAAA,CAC/CK,WAAW,CA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AM,CAAE,OAAO,CACfC,KAAK,CAAE,OAAO,CACdC,MAAM,CAAE,QAAQ,CAChBC,KAAK,CAAE,QACT,EAEM,IAAAW,0BAGL,CAAG,CACFd,MAAM,CAAE,QAAQ,CAChBC,KAAK,CAAE,OAAO,CACdC,MAAM,CAAE,OAAO,CACfC,KAAK,CAAE,QACT,EAEM,IAAAY,iBAAuF,CAAG,CAC9Ff,MAAM,CAAE,CAAC,CACTC,KAAK,CAAE,CAAC,CACRC,MAAM,CAAE,CAAC,CACTC,KAAK,CAAE,CACT;;;;"}
@@ -0,0 +1,17 @@
1
+ import '@babel/runtime/helpers/objectWithoutProperties';
2
+ import '../Typography/BaseText/BaseText.native.js';
3
+ import 'react';
4
+ import { throwBladeError } from '../../utils/logger/logger.js';
5
+ import '@babel/runtime/helpers/slicedToArray';
6
+ import 'react-native';
7
+ import '../../tokens/global/typography.js';
8
+ import '../../tokens/global/motion.js';
9
+ import '../BladeProvider/useTheme.js';
10
+ import { jsx } from 'react/jsx-runtime';
11
+ import { Text } from '../Typography/Text/Text.js';
12
+ import '../Typography/Code/Code.js';
13
+
14
+ var Drawer=function Drawer(_props){throwBladeError({message:'Drawer is not yet implemented for native',moduleName:'Drawer'});return jsx(Text,{children:"Drawer Component is not available for Native mobile apps."});};
15
+
16
+ export { Drawer };
17
+ //# sourceMappingURL=Drawer.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Drawer.native.js","sources":["../../../../../src/components/Drawer/Drawer.native.tsx"],"sourcesContent":["import type { DrawerProps } from './types';\nimport { Text } from '~components/Typography';\nimport { throwBladeError } from '~utils/logger';\n\nconst Drawer = (_props: DrawerProps): React.ReactElement => {\n throwBladeError({\n message: 'Drawer is not yet implemented for native',\n moduleName: 'Drawer',\n });\n\n return <Text>Drawer Component is not available for Native mobile apps.</Text>;\n};\n\nexport { Drawer };\n"],"names":["Drawer","_props","throwBladeError","message","moduleName","_jsx","Text","children"],"mappings":";;;;;;;;;;;;;AAIM,IAAAA,MAAM,CAAG,SAATA,MAAMA,CAAIC,MAAmB,CAAyB,CAC1DC,eAAe,CAAC,CACdC,OAAO,CAAE,0CAA0C,CACnDC,UAAU,CAAE,QACd,CAAC,CAAC,CAEF,OAAOC,GAAA,CAACC,IAAI,CAAA,CAAAC,QAAA,CAAC,2DAAyD,CAAM,CAAC,CAC/E;;;;"}
@@ -0,0 +1,17 @@
1
+ import 'react';
2
+ import '@babel/runtime/helpers/objectWithoutProperties';
3
+ import '../Typography/BaseText/BaseText.native.js';
4
+ import { throwBladeError } from '../../utils/logger/logger.js';
5
+ import '@babel/runtime/helpers/slicedToArray';
6
+ import 'react-native';
7
+ import '../../tokens/global/typography.js';
8
+ import '../../tokens/global/motion.js';
9
+ import '../BladeProvider/useTheme.js';
10
+ import { jsx } from 'react/jsx-runtime';
11
+ import { Text } from '../Typography/Text/Text.js';
12
+ import '../Typography/Code/Code.js';
13
+
14
+ var DrawerHeader=function DrawerHeader(_props){throwBladeError({message:'DrawerHeader is not yet implemented for native',moduleName:'DrawerHeader'});return jsx(Text,{children:"Drawer Component is not available for Native mobile apps."});};var DrawerBody=function DrawerBody(_props){throwBladeError({message:'DrawerBody is not yet implemented for native',moduleName:'DrawerBody'});return jsx(Text,{children:"Drawer Component is not available for Native mobile apps."});};
15
+
16
+ export { DrawerBody, DrawerHeader };
17
+ //# sourceMappingURL=DrawerSubcomponents.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DrawerSubcomponents.native.js","sources":["../../../../../src/components/Drawer/DrawerSubcomponents.native.tsx"],"sourcesContent":["import React from 'react';\nimport type { DrawerHeaderProps } from './types';\nimport { Text } from '~components/Typography';\nimport { throwBladeError } from '~utils/logger';\n\nconst DrawerHeader = (_props: DrawerHeaderProps): React.ReactElement => {\n throwBladeError({\n message: 'DrawerHeader is not yet implemented for native',\n moduleName: 'DrawerHeader',\n });\n\n return <Text>Drawer Component is not available for Native mobile apps.</Text>;\n};\n\nconst DrawerBody = (_props: { children: React.ReactNode }): React.ReactElement => {\n throwBladeError({\n message: 'DrawerBody is not yet implemented for native',\n moduleName: 'DrawerBody',\n });\n\n return <Text>Drawer Component is not available for Native mobile apps.</Text>;\n};\nexport { DrawerHeader, DrawerBody };\n"],"names":["DrawerHeader","_props","throwBladeError","message","moduleName","_jsx","Text","children","DrawerBody"],"mappings":";;;;;;;;;;;;;AAKM,IAAAA,YAAY,CAAG,SAAfA,YAAYA,CAAIC,MAAyB,CAAyB,CACtEC,eAAe,CAAC,CACdC,OAAO,CAAE,gDAAgD,CACzDC,UAAU,CAAE,cACd,CAAC,CAAC,CAEF,OAAOC,GAAA,CAACC,IAAI,CAAAC,CAAAA,QAAA,CAAC,2DAAyD,CAAM,CAAC,CAC/E,EAEM,IAAAC,UAAU,CAAG,SAAbA,UAAUA,CAAIP,MAAqC,CAAyB,CAChFC,eAAe,CAAC,CACdC,OAAO,CAAE,8CAA8C,CACvDC,UAAU,CAAE,YACd,CAAC,CAAC,CAEF,OAAOC,GAAA,CAACC,IAAI,CAAA,CAAAC,QAAA,CAAC,2DAAyD,CAAM,CAAC,CAC/E;;;;"}
@@ -24,7 +24,7 @@ import '../../../tokens/global/motion.js';
24
24
  import { makeAccessible } from '../../../utils/makeAccessible/makeAccessible.native.js';
25
25
  import { assignWithoutSideEffects } from '../../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
26
26
 
27
- var _excluded=["children","icon","iconPosition","isDisabled","onClick","onKeyDown","variant","href","target","rel","color","accessibilityProps","className","style","size","testID","hitSlop","htmlTitle","onBlur","onFocus","onMouseLeave","onMouseMove","onPointerDown","onPointerEnter","onTouchStart","onTouchEnd"],_excluded2=["currentInteraction","setCurrentInteraction"];var getColorToken=function getColorToken(_ref){var variant=_ref.variant,color=_ref.color,currentInteraction=_ref.currentInteraction,isDisabled=_ref.isDisabled,element=_ref.element;var state=currentInteraction;var map={default:'normal',hover:'subtle',focus:'normal',disabled:'disabled'};if(isDisabled&&variant=='button'){state='disabled';}if(color&&color!=='primary'){if(color!=='white'){return `interactive.${element}.${color}.${map[state]}`;}return `interactive.${element}.staticWhite.${map[state]}`;}return `interactive.${element}.primary.${map[state]}`;};var getProps=function getProps(_ref2){var theme=_ref2.theme,variant=_ref2.variant,currentInteraction=_ref2.currentInteraction,children=_ref2.children,isDisabled=_ref2.isDisabled,color=_ref2.color,target=_ref2.target,size=_ref2.size;var isButton=variant==='button';var textSizes={fontSize:{xsmall:25,small:75,medium:100,large:200},lineHeight:{xsmall:25,small:75,medium:100,large:200}};var props={as:isButton?'button':'a',textDecorationLine:!isButton&&currentInteraction!=='default'?'underline':'none',iconColor:getColorToken({variant:variant,color:color,element:'icon',currentInteraction:currentInteraction,isDisabled:isDisabled}),fontSize:textSizes.fontSize[size],lineHeight:textSizes.lineHeight[size],iconSize:size,iconPadding:children!=null&&children.trim()?'spacing.2':'spacing.0',textColor:getColorToken({variant:variant,color:color,element:'text',currentInteraction:currentInteraction,isDisabled:isDisabled}),focusRingColor:getIn(theme.colors,'interactive.background.primary.faded'),motionDuration:'duration.2xquick',motionEasing:'easing.standard.effective',cursor:isButton&&isDisabled?'not-allowed':'pointer',disabled:isButton&&isDisabled,role:isButton?'button':'link',defaultRel:target&&target==='_blank'?'noreferrer noopener':undefined,type:isButton?'button':undefined};return props;};var _BaseLink=function _BaseLink(_ref3,ref){var children=_ref3.children,Icon=_ref3.icon,_ref3$iconPosition=_ref3.iconPosition,iconPosition=_ref3$iconPosition===void 0?'left':_ref3$iconPosition,_ref3$isDisabled=_ref3.isDisabled,isDisabled=_ref3$isDisabled===void 0?false:_ref3$isDisabled,onClick=_ref3.onClick,onKeyDown=_ref3.onKeyDown,_ref3$variant=_ref3.variant,variant=_ref3$variant===void 0?'anchor':_ref3$variant,href=_ref3.href,target=_ref3.target,rel=_ref3.rel,_ref3$color=_ref3.color,color=_ref3$color===void 0?'primary':_ref3$color,accessibilityProps=_ref3.accessibilityProps,className=_ref3.className,style=_ref3.style,_ref3$size=_ref3.size,size=_ref3$size===void 0?'medium':_ref3$size,testID=_ref3.testID,hitSlop=_ref3.hitSlop,htmlTitle=_ref3.htmlTitle,_onBlur=_ref3.onBlur,_onFocus=_ref3.onFocus,_onMouseLeave=_ref3.onMouseLeave,onMouseMove=_ref3.onMouseMove,onPointerDown=_ref3.onPointerDown,onPointerEnter=_ref3.onPointerEnter,onTouchStart=_ref3.onTouchStart,onTouchEnd=_ref3.onTouchEnd,styledProps=_objectWithoutProperties(_ref3,_excluded);var childrenString=getStringFromReactText(children);var _useInteraction=useInteraction(),currentInteraction=_useInteraction.currentInteraction,setCurrentInteraction=_useInteraction.setCurrentInteraction,syntheticEvents=_objectWithoutProperties(_useInteraction,_excluded2);var _useTheme=useTheme(),theme=_useTheme.theme;if(__DEV__){if(!Icon&&!(childrenString!=null&&childrenString.trim())){throwBladeError({message:`At least one of icon or text is required to render a link.`,moduleName:'BaseLink'});}}var _getProps=getProps({theme:theme,variant:variant,currentInteraction:currentInteraction,children:childrenString,isDisabled:isDisabled,color:color,target:target,size:size}),as=_getProps.as,textDecorationLine=_getProps.textDecorationLine,iconColor=_getProps.iconColor,iconPadding=_getProps.iconPadding,iconSize=_getProps.iconSize,fontSize=_getProps.fontSize,textColor=_getProps.textColor,focusRingColor=_getProps.focusRingColor,motionDuration=_getProps.motionDuration,motionEasing=_getProps.motionEasing,cursor=_getProps.cursor,disabled=_getProps.disabled,role=_getProps.role,defaultRel=_getProps.defaultRel,type=_getProps.type,lineHeight=_getProps.lineHeight;var handleOnClick=function handleOnClick(event){if(onClick){onClick(event);}};var asProp=isReactNative()?undefined:'span';return jsx(StyledLink,Object.assign({ref:ref},metaAttribute({name:MetaConstants.Link,testID:testID}),{accessibilityProps:Object.assign({},makeAccessible(Object.assign({role:role,disabled:disabled},accessibilityProps))),variant:variant,as:as,href:href,target:target,rel:rel!=null?rel:defaultRel,onClick:handleOnClick},syntheticEvents,{onBlur:function onBlur(event){_onBlur==null?void 0:_onBlur(event);syntheticEvents.onBlur();},onFocus:function onFocus(event){_onFocus==null?void 0:_onFocus(event);syntheticEvents.onFocus();},onMouseLeave:function onMouseLeave(event){if(_onMouseLeave){_onMouseLeave(event);}syntheticEvents.onMouseLeave();},onMouseMove:onMouseMove,onPointerDown:onPointerDown,onPointerEnter:onPointerEnter,onTouchStart:onTouchStart,onTouchEnd:onTouchEnd,onKeyDown:onKeyDown,disabled:disabled,type:type,cursor:cursor,focusRingColor:focusRingColor,motionDuration:motionDuration,motionEasing:motionEasing,setCurrentInteraction:setCurrentInteraction},getStyledProps(styledProps),{className:className,style:style,hitSlop:hitSlop,title:htmlTitle,children:jsxs(BaseBox,{as:asProp,display:"flex",flexDirection:"row",className:"content-container",alignItems:"center",children:[Icon&&iconPosition=='left'?jsx(BaseBox,{as:asProp,paddingRight:iconPadding,display:"flex",alignItems:"center",children:jsx(Icon,{color:iconColor,size:iconSize})}):null,jsx(BaseText,{as:asProp,textDecorationLine:textDecorationLine,color:textColor,fontSize:fontSize,lineHeight:lineHeight,textAlign:"center",fontWeight:"medium",children:children}),Icon&&iconPosition=='right'?jsx(BaseBox,{as:asProp,paddingLeft:iconPadding,display:"flex",alignItems:"center",children:jsx(Icon,{color:iconColor,size:iconSize})}):null]})}));};var BaseLink=assignWithoutSideEffects(React__default.forwardRef(_BaseLink),{displayName:'BaseLink',componentId:'BaseLink'});
27
+ var _excluded=["children","icon","iconPosition","isDisabled","onClick","onKeyDown","variant","href","target","rel","color","opacity","accessibilityProps","className","style","size","testID","hitSlop","htmlTitle","onBlur","onFocus","onMouseLeave","onMouseMove","onPointerDown","onPointerEnter","onTouchStart","onTouchEnd"],_excluded2=["currentInteraction","setCurrentInteraction"];var getColorToken=function getColorToken(_ref){var variant=_ref.variant,color=_ref.color,currentInteraction=_ref.currentInteraction,isDisabled=_ref.isDisabled,element=_ref.element;var state=currentInteraction;var map={default:'normal',hover:'subtle',focus:'normal',disabled:'disabled'};if(isDisabled&&variant=='button'){state='disabled';}if(color&&color!=='primary'){if(color!=='white'){return `interactive.${element}.${color}.${map[state]}`;}return `interactive.${element}.staticWhite.${map[state]}`;}return `interactive.${element}.primary.${map[state]}`;};var getProps=function getProps(_ref2){var theme=_ref2.theme,variant=_ref2.variant,currentInteraction=_ref2.currentInteraction,children=_ref2.children,isDisabled=_ref2.isDisabled,color=_ref2.color,target=_ref2.target,size=_ref2.size;var isButton=variant==='button';var textSizes={fontSize:{xsmall:25,small:75,medium:100,large:200},lineHeight:{xsmall:25,small:75,medium:100,large:200}};var props={as:isButton?'button':'a',textDecorationLine:!isButton&&currentInteraction!=='default'?'underline':'none',iconColor:getColorToken({variant:variant,color:color,element:'icon',currentInteraction:currentInteraction,isDisabled:isDisabled}),fontSize:textSizes.fontSize[size],lineHeight:textSizes.lineHeight[size],iconSize:size,iconPadding:children!=null&&children.trim()?'spacing.2':'spacing.0',textColor:getColorToken({variant:variant,color:color,element:'text',currentInteraction:currentInteraction,isDisabled:isDisabled}),focusRingColor:getIn(theme.colors,'interactive.background.primary.faded'),motionDuration:'duration.2xquick',motionEasing:'easing.standard.effective',cursor:isButton&&isDisabled?'not-allowed':'pointer',disabled:isButton&&isDisabled,role:isButton?'button':'link',defaultRel:target&&target==='_blank'?'noreferrer noopener':undefined,type:isButton?'button':undefined};return props;};var _BaseLink=function _BaseLink(_ref3,ref){var children=_ref3.children,Icon=_ref3.icon,_ref3$iconPosition=_ref3.iconPosition,iconPosition=_ref3$iconPosition===void 0?'left':_ref3$iconPosition,_ref3$isDisabled=_ref3.isDisabled,isDisabled=_ref3$isDisabled===void 0?false:_ref3$isDisabled,onClick=_ref3.onClick,onKeyDown=_ref3.onKeyDown,_ref3$variant=_ref3.variant,variant=_ref3$variant===void 0?'anchor':_ref3$variant,href=_ref3.href,target=_ref3.target,rel=_ref3.rel,_ref3$color=_ref3.color,color=_ref3$color===void 0?'primary':_ref3$color,opacity=_ref3.opacity,accessibilityProps=_ref3.accessibilityProps,className=_ref3.className,style=_ref3.style,_ref3$size=_ref3.size,size=_ref3$size===void 0?'medium':_ref3$size,testID=_ref3.testID,hitSlop=_ref3.hitSlop,htmlTitle=_ref3.htmlTitle,_onBlur=_ref3.onBlur,_onFocus=_ref3.onFocus,_onMouseLeave=_ref3.onMouseLeave,onMouseMove=_ref3.onMouseMove,onPointerDown=_ref3.onPointerDown,onPointerEnter=_ref3.onPointerEnter,onTouchStart=_ref3.onTouchStart,onTouchEnd=_ref3.onTouchEnd,styledProps=_objectWithoutProperties(_ref3,_excluded);var childrenString=getStringFromReactText(children);var _useInteraction=useInteraction(),currentInteraction=_useInteraction.currentInteraction,setCurrentInteraction=_useInteraction.setCurrentInteraction,syntheticEvents=_objectWithoutProperties(_useInteraction,_excluded2);var _useTheme=useTheme(),theme=_useTheme.theme;if(__DEV__){if(!Icon&&!(childrenString!=null&&childrenString.trim())){throwBladeError({message:`At least one of icon or text is required to render a link.`,moduleName:'BaseLink'});}}var _getProps=getProps({theme:theme,variant:variant,currentInteraction:currentInteraction,children:childrenString,isDisabled:isDisabled,color:color,target:target,size:size}),as=_getProps.as,textDecorationLine=_getProps.textDecorationLine,iconColor=_getProps.iconColor,iconPadding=_getProps.iconPadding,iconSize=_getProps.iconSize,fontSize=_getProps.fontSize,textColor=_getProps.textColor,focusRingColor=_getProps.focusRingColor,motionDuration=_getProps.motionDuration,motionEasing=_getProps.motionEasing,cursor=_getProps.cursor,disabled=_getProps.disabled,role=_getProps.role,defaultRel=_getProps.defaultRel,type=_getProps.type,lineHeight=_getProps.lineHeight;var handleOnClick=function handleOnClick(event){if(onClick){onClick(event);}};var asProp=isReactNative()?undefined:'span';return jsx(StyledLink,Object.assign({ref:ref},metaAttribute({name:MetaConstants.Link,testID:testID}),{accessibilityProps:Object.assign({},makeAccessible(Object.assign({role:role,disabled:disabled},accessibilityProps))),variant:variant,as:as,href:href,target:target,rel:rel!=null?rel:defaultRel,onClick:handleOnClick},syntheticEvents,{onBlur:function onBlur(event){_onBlur==null?void 0:_onBlur(event);syntheticEvents.onBlur();},onFocus:function onFocus(event){_onFocus==null?void 0:_onFocus(event);syntheticEvents.onFocus();},onMouseLeave:function onMouseLeave(event){if(_onMouseLeave){_onMouseLeave(event);}syntheticEvents.onMouseLeave();},onMouseMove:onMouseMove,onPointerDown:onPointerDown,onPointerEnter:onPointerEnter,onTouchStart:onTouchStart,onTouchEnd:onTouchEnd,onKeyDown:onKeyDown,disabled:disabled,type:type,cursor:cursor,focusRingColor:focusRingColor,motionDuration:motionDuration,motionEasing:motionEasing,setCurrentInteraction:setCurrentInteraction},getStyledProps(styledProps),{className:className,style:style,hitSlop:hitSlop,title:htmlTitle,children:jsxs(BaseBox,{as:asProp,display:"flex",flexDirection:"row",className:"content-container",alignItems:"center",opacity:opacity,children:[Icon&&iconPosition=='left'?jsx(BaseBox,{as:asProp,paddingRight:iconPadding,display:"flex",alignItems:"center",children:jsx(Icon,{color:iconColor,size:iconSize})}):null,jsx(BaseText,{as:asProp,textDecorationLine:textDecorationLine,color:textColor,fontSize:fontSize,lineHeight:lineHeight,textAlign:"center",fontWeight:"medium",children:children}),Icon&&iconPosition=='right'?jsx(BaseBox,{as:asProp,paddingLeft:iconPadding,display:"flex",alignItems:"center",children:jsx(Icon,{color:iconColor,size:iconSize})}):null]})}));};var BaseLink=assignWithoutSideEffects(React__default.forwardRef(_BaseLink),{displayName:'BaseLink',componentId:'BaseLink'});
28
28
 
29
29
  export { BaseLink as default };
30
30
  //# sourceMappingURL=BaseLink.js.map