@razorpay/blade 12.0.3 → 12.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/build/lib/native/components/Button/IconButton/IconButton.js +1 -1
  2. package/build/lib/native/components/Button/IconButton/IconButton.js.map +1 -1
  3. package/build/lib/native/components/Radio/Radio.js +1 -1
  4. package/build/lib/native/components/Radio/Radio.js.map +1 -1
  5. package/build/lib/native/components/Radio/RadioGroup/RadioGroup.js.map +1 -1
  6. package/build/lib/native/components/Radio/RadioGroup/useRadioGroup.js +1 -1
  7. package/build/lib/native/components/Radio/RadioGroup/useRadioGroup.js.map +1 -1
  8. package/build/lib/native/components/Radio/useRadio.js.map +1 -1
  9. package/build/lib/native/utils/useControllable.js +1 -1
  10. package/build/lib/native/utils/useControllable.js.map +1 -1
  11. package/build/lib/web/development/components/BottomSheet/BottomSheet.web.js +17 -1
  12. package/build/lib/web/development/components/BottomSheet/BottomSheet.web.js.map +1 -1
  13. package/build/lib/web/development/components/Button/IconButton/IconButton.js +2 -2
  14. package/build/lib/web/development/components/Button/IconButton/IconButton.js.map +1 -1
  15. package/build/lib/web/development/components/Button/IconButton/StyledIconButton.web.js +7 -4
  16. package/build/lib/web/development/components/Button/IconButton/StyledIconButton.web.js.map +1 -1
  17. package/build/lib/web/development/components/ButtonGroup/ButtonGroup.web.js +7 -17
  18. package/build/lib/web/development/components/ButtonGroup/ButtonGroup.web.js.map +1 -1
  19. package/build/lib/web/development/components/Drawer/Drawer.web.js +6 -4
  20. package/build/lib/web/development/components/Drawer/Drawer.web.js.map +1 -1
  21. package/build/lib/web/development/components/Radio/Radio.js +3 -2
  22. package/build/lib/web/development/components/Radio/Radio.js.map +1 -1
  23. package/build/lib/web/development/components/Radio/RadioGroup/RadioGroup.js.map +1 -1
  24. package/build/lib/web/development/components/Radio/RadioGroup/useRadioGroup.js +7 -6
  25. package/build/lib/web/development/components/Radio/RadioGroup/useRadioGroup.js.map +1 -1
  26. package/build/lib/web/development/components/Radio/useRadio.js.map +1 -1
  27. package/build/lib/web/development/components/SideNav/SideNav.web.js +22 -8
  28. package/build/lib/web/development/components/SideNav/SideNav.web.js.map +1 -1
  29. package/build/lib/web/development/components/SideNav/SideNavItems/SideNavLink.web.js +14 -7
  30. package/build/lib/web/development/components/SideNav/SideNavItems/SideNavLink.web.js.map +1 -1
  31. package/build/lib/web/development/components/Tooltip/Tooltip.web.js +7 -1
  32. package/build/lib/web/development/components/Tooltip/Tooltip.web.js.map +1 -1
  33. package/build/lib/web/development/components/Tooltip/componentIds.js +6 -0
  34. package/build/lib/web/development/components/Tooltip/componentIds.js.map +1 -0
  35. package/build/lib/web/development/components/TopNav/TabNav/TabNavItem.web.js +1 -1
  36. package/build/lib/web/development/components/TopNav/TabNav/TabNavItem.web.js.map +1 -1
  37. package/build/lib/web/development/components/TopNav/TopNav.web.js +1 -1
  38. package/build/lib/web/development/components/TopNav/TopNav.web.js.map +1 -1
  39. package/build/lib/web/development/utils/useControllable.js +2 -1
  40. package/build/lib/web/development/utils/useControllable.js.map +1 -1
  41. package/build/lib/web/production/components/BottomSheet/BottomSheet.web.js +17 -1
  42. package/build/lib/web/production/components/BottomSheet/BottomSheet.web.js.map +1 -1
  43. package/build/lib/web/production/components/Button/IconButton/IconButton.js +2 -2
  44. package/build/lib/web/production/components/Button/IconButton/IconButton.js.map +1 -1
  45. package/build/lib/web/production/components/Button/IconButton/StyledIconButton.web.js +7 -4
  46. package/build/lib/web/production/components/Button/IconButton/StyledIconButton.web.js.map +1 -1
  47. package/build/lib/web/production/components/ButtonGroup/ButtonGroup.web.js +7 -17
  48. package/build/lib/web/production/components/ButtonGroup/ButtonGroup.web.js.map +1 -1
  49. package/build/lib/web/production/components/Drawer/Drawer.web.js +6 -4
  50. package/build/lib/web/production/components/Drawer/Drawer.web.js.map +1 -1
  51. package/build/lib/web/production/components/Radio/Radio.js +3 -2
  52. package/build/lib/web/production/components/Radio/Radio.js.map +1 -1
  53. package/build/lib/web/production/components/Radio/RadioGroup/RadioGroup.js.map +1 -1
  54. package/build/lib/web/production/components/Radio/RadioGroup/useRadioGroup.js +7 -6
  55. package/build/lib/web/production/components/Radio/RadioGroup/useRadioGroup.js.map +1 -1
  56. package/build/lib/web/production/components/Radio/useRadio.js.map +1 -1
  57. package/build/lib/web/production/components/SideNav/SideNav.web.js +22 -8
  58. package/build/lib/web/production/components/SideNav/SideNav.web.js.map +1 -1
  59. package/build/lib/web/production/components/SideNav/SideNavItems/SideNavLink.web.js +14 -7
  60. package/build/lib/web/production/components/SideNav/SideNavItems/SideNavLink.web.js.map +1 -1
  61. package/build/lib/web/production/components/Tooltip/Tooltip.web.js +7 -1
  62. package/build/lib/web/production/components/Tooltip/Tooltip.web.js.map +1 -1
  63. package/build/lib/web/production/components/Tooltip/componentIds.js +6 -0
  64. package/build/lib/web/production/components/Tooltip/componentIds.js.map +1 -0
  65. package/build/lib/web/production/components/TopNav/TabNav/TabNavItem.web.js +1 -1
  66. package/build/lib/web/production/components/TopNav/TabNav/TabNavItem.web.js.map +1 -1
  67. package/build/lib/web/production/components/TopNav/TopNav.web.js +1 -1
  68. package/build/lib/web/production/components/TopNav/TopNav.web.js.map +1 -1
  69. package/build/lib/web/production/utils/useControllable.js +2 -1
  70. package/build/lib/web/production/utils/useControllable.js.map +1 -1
  71. package/build/types/components/index.d.ts +1168 -45
  72. package/build/types/components/index.native.d.ts +345 -4
  73. package/package.json +1 -1
@@ -4,7 +4,7 @@ import StyledIconButton from './StyledIconButton.native.js';
4
4
  import { makeAnalyticsAttribute } from '../../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
5
5
  import { jsx } from 'react/jsx-runtime';
6
6
 
7
- var _excluded=["icon","onClick","size","emphasis","accessibilityLabel","isDisabled","onBlur","onFocus","onMouseLeave","onMouseMove","onPointerDown","onPointerEnter","onTouchEnd","onTouchStart","isHighlighted","_tabIndex"];var _IconButton=function _IconButton(_ref,ref){var icon=_ref.icon,onClick=_ref.onClick,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,_ref$emphasis=_ref.emphasis,emphasis=_ref$emphasis===void 0?'intense':_ref$emphasis,accessibilityLabel=_ref.accessibilityLabel,isDisabled=_ref.isDisabled,onBlur=_ref.onBlur,onFocus=_ref.onFocus,onMouseLeave=_ref.onMouseLeave,onMouseMove=_ref.onMouseMove,onPointerDown=_ref.onPointerDown,onPointerEnter=_ref.onPointerEnter,onTouchEnd=_ref.onTouchEnd,onTouchStart=_ref.onTouchStart,isHighlighted=_ref.isHighlighted,_tabIndex=_ref._tabIndex,rest=_objectWithoutProperties(_ref,_excluded);return jsx(StyledIconButton,Object.assign({ref:ref,onClick:onClick,emphasis:emphasis,size:size,icon:icon,tabIndex:_tabIndex,accessibilityLabel:accessibilityLabel,isDisabled:isDisabled,isHighlighted:isHighlighted,onBlur:onBlur,onFocus:onFocus,onMouseLeave:onMouseLeave,onMouseMove:onMouseMove,onPointerDown:onPointerDown,onPointerEnter:onPointerEnter,onTouchEnd:onTouchEnd,onTouchStart:onTouchStart},makeAnalyticsAttribute(rest)));};var IconButton=React__default.forwardRef(_IconButton);
7
+ var _excluded=["icon","onClick","size","emphasis","accessibilityLabel","isDisabled","onBlur","onFocus","onMouseLeave","onMouseMove","onPointerDown","onPointerEnter","onTouchEnd","onTouchStart","isHighlighted","_tabIndex"];var _IconButton=function _IconButton(_ref,ref){var icon=_ref.icon,onClick=_ref.onClick,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,_ref$emphasis=_ref.emphasis,emphasis=_ref$emphasis===void 0?'intense':_ref$emphasis,accessibilityLabel=_ref.accessibilityLabel,isDisabled=_ref.isDisabled,onBlur=_ref.onBlur,onFocus=_ref.onFocus,onMouseLeave=_ref.onMouseLeave,onMouseMove=_ref.onMouseMove,onPointerDown=_ref.onPointerDown,onPointerEnter=_ref.onPointerEnter,onTouchEnd=_ref.onTouchEnd,onTouchStart=_ref.onTouchStart,isHighlighted=_ref.isHighlighted,_tabIndex=_ref._tabIndex,rest=_objectWithoutProperties(_ref,_excluded);return jsx(StyledIconButton,Object.assign({ref:ref,onClick:onClick,emphasis:emphasis,size:size,icon:icon,tabIndex:_tabIndex,accessibilityLabel:accessibilityLabel,isDisabled:isDisabled,isHighlighted:isHighlighted,onBlur:onBlur,onFocus:onFocus,onMouseLeave:onMouseLeave,onMouseMove:onMouseMove,onPointerDown:onPointerDown,onPointerEnter:onPointerEnter,onTouchEnd:onTouchEnd,onTouchStart:onTouchStart},makeAnalyticsAttribute(rest),rest));};var IconButton=React__default.forwardRef(_IconButton);
8
8
 
9
9
  export { IconButton };
10
10
  //# sourceMappingURL=IconButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IconButton.js","sources":["../../../../../../src/components/Button/IconButton/IconButton.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable react/display-name */\nimport React from 'react';\nimport type { GestureResponderEvent } from 'react-native';\nimport StyledIconButton from './StyledIconButton';\nimport type { IconComponent } from '~components/Icons';\nimport type { BladeElementRef, DataAnalyticsAttribute } from '~utils/types';\nimport type { BladeCommonEvents } from '~components/types';\nimport type { Platform } from '~utils';\nimport type { SubtleOrIntense } from '~tokens/theme/theme';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype IconButtonProps = {\n /**\n * Icon component to be rendered, eg. `CloseIcon`\n */\n icon: IconComponent;\n\n /**\n * Icon size\n *\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * Icon contrast\n *\n * @default 'intense'\n */\n emphasis?: SubtleOrIntense;\n\n /**\n * Sets aria-label to help users know what the action does, eg 'Dismiss alert'\n */\n accessibilityLabel: string;\n\n /**\n * Disabled state for IconButton\n */\n isDisabled?: boolean;\n\n /**\n * Sets tabindex property on button element\n */\n _tabIndex?: number;\n} & DataAnalyticsAttribute &\n BladeCommonEvents &\n Platform.Select<{\n web: {\n onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;\n /**\n * This changes the hover interaction to highlight icon more\n *\n * **Only available on web currently**\n */\n isHighlighted?: boolean;\n };\n native: {\n onClick: (event: GestureResponderEvent) => void;\n isHighlighted?: undefined;\n };\n }>;\n\n/**\n * Component for making clickable icons with transparent background.\n * For other cases please use `Button` component with `icon` prop.\n */\nconst _IconButton: React.ForwardRefRenderFunction<BladeElementRef, IconButtonProps> = (\n {\n icon,\n onClick,\n size = 'medium',\n emphasis = 'intense',\n accessibilityLabel,\n isDisabled,\n onBlur,\n onFocus,\n onMouseLeave,\n onMouseMove,\n onPointerDown,\n onPointerEnter,\n onTouchEnd,\n onTouchStart,\n isHighlighted,\n _tabIndex,\n ...rest\n },\n ref,\n) => {\n return (\n <StyledIconButton\n ref={ref as any}\n onClick={onClick}\n emphasis={emphasis}\n size={size}\n icon={icon}\n tabIndex={_tabIndex}\n accessibilityLabel={accessibilityLabel}\n isDisabled={isDisabled}\n isHighlighted={isHighlighted}\n onBlur={onBlur}\n onFocus={onFocus}\n onMouseLeave={onMouseLeave}\n onMouseMove={onMouseMove}\n onPointerDown={onPointerDown}\n onPointerEnter={onPointerEnter}\n onTouchEnd={onTouchEnd}\n onTouchStart={onTouchStart}\n {...makeAnalyticsAttribute(rest)}\n />\n );\n};\n\nconst IconButton = React.forwardRef(_IconButton);\n\nexport type { IconButtonProps };\nexport { IconButton };\n"],"names":["_IconButton","_ref","ref","icon","onClick","_ref$size","size","_ref$emphasis","emphasis","accessibilityLabel","isDisabled","onBlur","onFocus","onMouseLeave","onMouseMove","onPointerDown","onPointerEnter","onTouchEnd","onTouchStart","isHighlighted","_tabIndex","rest","_objectWithoutProperties","_excluded","_jsx","StyledIconButton","Object","assign","tabIndex","makeAnalyticsAttribute","IconButton","React","forwardRef"],"mappings":";;;;;;8NAoEA,IAAMA,WAA6E,CAAG,SAAhFA,WAA6EA,CAAAC,IAAA,CAoBjFC,GAAG,CACA,CAnBD,IAAAC,IAAI,CAAAF,IAAA,CAAJE,IAAI,CAC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A,aAAc,CAC7BC,cAAc,CAAEA,cAAe,CAC/BC,UAAU,CAAEA,UAAW,CACvBC,YAAY,CAAEA,YAAa,CACvBW,CAAAA,sBAAsB,CAACR,IAAI,CAAC,CACjC,CAAC,CAEN,CAAC,CAEK,IAAAS,UAAU,CAAGC,cAAK,CAACC,UAAU,CAAChC,WAAW;;;;"}
1
+ {"version":3,"file":"IconButton.js","sources":["../../../../../../src/components/Button/IconButton/IconButton.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable react/display-name */\nimport React from 'react';\nimport type { GestureResponderEvent } from 'react-native';\nimport StyledIconButton from './StyledIconButton';\nimport type { IconComponent } from '~components/Icons';\nimport type { BladeElementRef, DataAnalyticsAttribute } from '~utils/types';\nimport type { BladeCommonEvents } from '~components/types';\nimport type { Platform } from '~utils';\nimport type { SubtleOrIntense } from '~tokens/theme/theme';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\n\ntype IconButtonProps = {\n /**\n * Icon component to be rendered, eg. `CloseIcon`\n */\n icon: IconComponent;\n\n /**\n * Icon size\n *\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * Icon contrast\n *\n * @default 'intense'\n */\n emphasis?: SubtleOrIntense;\n\n /**\n * Sets aria-label to help users know what the action does, eg 'Dismiss alert'\n */\n accessibilityLabel: string;\n\n /**\n * Disabled state for IconButton\n */\n isDisabled?: boolean;\n\n /**\n * Sets tabindex property on button element\n */\n _tabIndex?: number;\n} & DataAnalyticsAttribute &\n BladeCommonEvents &\n StyledPropsBlade &\n Platform.Select<{\n web: {\n onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;\n /**\n * This changes the hover interaction to highlight icon more\n *\n * **Only available on web currently**\n */\n isHighlighted?: boolean;\n };\n native: {\n onClick: (event: GestureResponderEvent) => void;\n isHighlighted?: undefined;\n };\n }>;\n\n/**\n * Component for making clickable icons with transparent background.\n * For other cases please use `Button` component with `icon` prop.\n */\nconst _IconButton: React.ForwardRefRenderFunction<BladeElementRef, IconButtonProps> = (\n {\n icon,\n onClick,\n size = 'medium',\n emphasis = 'intense',\n accessibilityLabel,\n isDisabled,\n onBlur,\n onFocus,\n onMouseLeave,\n onMouseMove,\n onPointerDown,\n onPointerEnter,\n onTouchEnd,\n onTouchStart,\n isHighlighted,\n _tabIndex,\n ...rest\n },\n ref,\n) => {\n return (\n <StyledIconButton\n ref={ref as any}\n onClick={onClick}\n emphasis={emphasis}\n size={size}\n icon={icon}\n tabIndex={_tabIndex}\n accessibilityLabel={accessibilityLabel}\n isDisabled={isDisabled}\n isHighlighted={isHighlighted}\n onBlur={onBlur}\n onFocus={onFocus}\n onMouseLeave={onMouseLeave}\n onMouseMove={onMouseMove}\n onPointerDown={onPointerDown}\n onPointerEnter={onPointerEnter}\n onTouchEnd={onTouchEnd}\n onTouchStart={onTouchStart}\n {...makeAnalyticsAttribute(rest)}\n {...rest}\n />\n );\n};\n\nconst IconButton = React.forwardRef(_IconButton);\n\nexport type { IconButtonProps };\nexport { IconButton };\n"],"names":["_IconButton","_ref","ref","icon","onClick","_ref$size","size","_ref$emphasis","emphasis","accessibilityLabel","isDisabled","onBlur","onFocus","onMouseLeave","onMouseMove","onPointerDown","onPointerEnter","onTouchEnd","onTouchStart","isHighlighted","_tabIndex","rest","_objectWithoutProperties","_excluded","_jsx","StyledIconButton","Object","assign","tabIndex","makeAnalyticsAttribute","IconButton","React","forwardRef"],"mappings":";;;;;;AAEA,IAAA,SAAA,CAAA,CAAA,MAAA,CAAA,SAAA,CAAA,MAAA,CAAA,UAAA,CAAA,oBAAA,CAAA,YAAA,CAAA,QAAA,CAAA,SAAA,CAAA,cAAA,CAAA,aAAA,CAAA,eAAA,CAAA,gBAAA,CAAA,YAAA,CAAA,cAAA,CAAA,eAAA,CAAA,WAAA,CAAA,CAoEA,IAAMA,WAA6E,CAAG,SAAhFA,WAA6EA,CAAAC,IAAA,C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BC,YAAY,CAAEA,YAAa,CAC3BC,WAAW,CAAEA,WAAY,CACzBC,aAAa,CAAEA,aAAc,CAC7BC,cAAc,CAAEA,cAAe,CAC/BC,UAAU,CAAEA,UAAW,CACvBC,YAAY,CAAEA,YAAa,CACvBW,CAAAA,sBAAsB,CAACR,IAAI,CAAC,CAC5BA,IAAI,CACT,CAAC,CAEN,CAAC,CAEK,IAAAS,UAAU,CAAGC,cAAK,CAACC,UAAU,CAAChC,WAAW;;;;"}
@@ -26,7 +26,7 @@ import { getOuterMotionRef, getInnerMotionRef } from '../../utils/getMotionRefs.
26
26
  import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
27
27
  import { jsx, jsxs } from 'react/jsx-runtime';
28
28
 
29
- var _excluded=["value","children","helpText","isDisabled","size","testID","_motionMeta"];var _Radio=function _Radio(_ref,ref){var _groupProps$state,_groupProps$size;var value=_ref.value,children=_ref.children,helpText=_ref.helpText,isDisabled=_ref.isDisabled,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,testID=_ref.testID,_motionMeta=_ref._motionMeta,rest=_objectWithoutProperties(_ref,_excluded);var _useTheme=useTheme(),theme=_useTheme.theme;var groupProps=useRadioGroupContext();var isInsideGroup=!isEmpty(groupProps);if(__DEV__){if(!isInsideGroup){throwBladeError({moduleName:'Radio',message:'Cannot use <Radio /> outside of <RadioGroup />'});}}var isChecked=groupProps==null?void 0:(_groupProps$state=groupProps.state)==null?void 0:_groupProps$state.isChecked(value);var defaultChecked=(groupProps==null?void 0:groupProps.defaultValue)===undefined?undefined:(groupProps==null?void 0:groupProps.defaultValue)===value;var validationState=groupProps==null?void 0:groupProps.validationState;var hasError=validationState==='error';var _isDisabled=isDisabled!=null?isDisabled:groupProps==null?void 0:groupProps.isDisabled;var _isRequired=(groupProps==null?void 0:groupProps.isRequired)||(groupProps==null?void 0:groupProps.necessityIndicator)==='required';var name=groupProps==null?void 0:groupProps.name;var showHelpText=helpText;var isReactNative=getPlatformType()==='react-native';var _size=(_groupProps$size=groupProps.size)!=null?_groupProps$size:size;var handleChange=function handleChange(_ref2){var isChecked=_ref2.isChecked,value=_ref2.value;if(isChecked){var _groupProps$state2;groupProps==null?void 0:(_groupProps$state2=groupProps.state)==null?void 0:_groupProps$state2.setValue(value);}else {var _groupProps$state3;groupProps==null?void 0:(_groupProps$state3=groupProps.state)==null?void 0:_groupProps$state3.removeValue();}};var _useRadio=useRadio({defaultChecked:defaultChecked,isChecked:isChecked,hasError:hasError,isDisabled:_isDisabled,isRequired:_isRequired,name:name,value:value,onChange:handleChange}),state=_useRadio.state,ids=_useRadio.ids,inputProps=_useRadio.inputProps;var helpTextLeftSpacing=makeSize(radioSizes.icon[size].width+theme.spacing[3]);return jsx(BaseBox,Object.assign({ref:getOuterMotionRef({_motionMeta:_motionMeta,ref:ref})},getStyledProps(rest),{children:jsx(SelectorLabel,{componentName:MetaConstants.RadioLabel,inputProps:isReactNative?inputProps:{},testID:testID,children:jsxs(BaseBox,{display:"flex",flexDirection:"column",children:[jsxs(BaseBox,{display:"flex",alignItems:"center",flexDirection:"row",children:[jsx(SelectorInput,Object.assign({hoverTokens:radioHoverTokens,isChecked:state.isChecked,isDisabled:_isDisabled,hasError:hasError,inputProps:inputProps,ref:getInnerMotionRef({_motionMeta:_motionMeta,ref:ref})},makeAnalyticsAttribute(rest))),jsx(RadioIcon,{size:_size,isChecked:state.isChecked,isDisabled:_isDisabled,isNegative:hasError}),children?jsx(SelectorTitle,{size:_size,isDisabled:_isDisabled,children:children}):null]}),showHelpText&&jsx(BaseBox,{marginLeft:helpTextLeftSpacing,children:jsx(SelectorSupportText,{size:_size,id:ids==null?void 0:ids.helpTextId,children:helpText})})]})})}));};var Radio=assignWithoutSideEffects(React__default.forwardRef(_Radio),{displayName:'Radio'});
29
+ var _excluded=["value","children","helpText","isDisabled","size","testID","_motionMeta"];var _Radio=function _Radio(_ref,ref){var _groupProps$state,_groupProps$size;var value=_ref.value,children=_ref.children,helpText=_ref.helpText,isDisabled=_ref.isDisabled,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,testID=_ref.testID,_motionMeta=_ref._motionMeta,rest=_objectWithoutProperties(_ref,_excluded);var _useTheme=useTheme(),theme=_useTheme.theme;var groupProps=useRadioGroupContext();var isInsideGroup=!isEmpty(groupProps);if(__DEV__){if(!isInsideGroup){throwBladeError({moduleName:'Radio',message:'Cannot use <Radio /> outside of <RadioGroup />'});}}var isChecked=groupProps==null?void 0:(_groupProps$state=groupProps.state)==null?void 0:_groupProps$state.isChecked(value);var defaultChecked=(groupProps==null?void 0:groupProps.defaultValue)===undefined?undefined:(groupProps==null?void 0:groupProps.defaultValue)===value;var validationState=groupProps==null?void 0:groupProps.validationState;var hasError=validationState==='error';var _isDisabled=isDisabled!=null?isDisabled:groupProps==null?void 0:groupProps.isDisabled;var _isRequired=(groupProps==null?void 0:groupProps.isRequired)||(groupProps==null?void 0:groupProps.necessityIndicator)==='required';var name=groupProps==null?void 0:groupProps.name;var showHelpText=helpText;var isReactNative=getPlatformType()==='react-native';var _size=(_groupProps$size=groupProps.size)!=null?_groupProps$size:size;var handleChange=function handleChange(_ref2){var isChecked=_ref2.isChecked,value=_ref2.value,event=_ref2.event;if(isChecked){var _groupProps$state2;groupProps==null?void 0:(_groupProps$state2=groupProps.state)==null?void 0:_groupProps$state2.setValue(value,event);}else {var _groupProps$state3;groupProps==null?void 0:(_groupProps$state3=groupProps.state)==null?void 0:_groupProps$state3.removeValue();}};var _useRadio=useRadio({defaultChecked:defaultChecked,isChecked:isChecked,hasError:hasError,isDisabled:_isDisabled,isRequired:_isRequired,name:name,value:value,onChange:handleChange}),state=_useRadio.state,ids=_useRadio.ids,inputProps=_useRadio.inputProps;var helpTextLeftSpacing=makeSize(radioSizes.icon[size].width+theme.spacing[3]);return jsx(BaseBox,Object.assign({ref:getOuterMotionRef({_motionMeta:_motionMeta,ref:ref})},getStyledProps(rest),{children:jsx(SelectorLabel,{componentName:MetaConstants.RadioLabel,inputProps:isReactNative?inputProps:{},testID:testID,children:jsxs(BaseBox,{display:"flex",flexDirection:"column",children:[jsxs(BaseBox,{display:"flex",alignItems:"center",flexDirection:"row",children:[jsx(SelectorInput,Object.assign({hoverTokens:radioHoverTokens,isChecked:state.isChecked,isDisabled:_isDisabled,hasError:hasError,inputProps:inputProps,ref:getInnerMotionRef({_motionMeta:_motionMeta,ref:ref})},makeAnalyticsAttribute(rest))),jsx(RadioIcon,{size:_size,isChecked:state.isChecked,isDisabled:_isDisabled,isNegative:hasError}),children?jsx(SelectorTitle,{size:_size,isDisabled:_isDisabled,children:children}):null]}),showHelpText&&jsx(BaseBox,{marginLeft:helpTextLeftSpacing,children:jsx(SelectorSupportText,{size:_size,id:ids==null?void 0:ids.helpTextId,children:helpText})})]})})}));};var Radio=assignWithoutSideEffects(React__default.forwardRef(_Radio),{displayName:'Radio'});
30
30
 
31
31
  export { Radio };
32
32
  //# sourceMappingURL=Radio.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Radio.js","sources":["../../../../../src/components/Radio/Radio.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/restrict-plus-operands */\n/* eslint-disable @typescript-eslint/no-shadow */\nimport React from 'react';\nimport type { OnChange } from './useRadio';\nimport { useRadio } from './useRadio';\nimport { RadioIcon } from './RadioIcon/RadioIcon';\nimport { useRadioGroupContext } from './RadioGroup/RadioContext';\nimport { radioHoverTokens, radioSizes } from './radioTokens';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport { SelectorLabel } from '~components/Form/Selector/SelectorLabel';\nimport BaseBox from '~components/Box/BaseBox';\nimport { SelectorTitle } from '~components/Form/Selector/SelectorTitle';\nimport { SelectorSupportText } from '~components/Form/Selector/SelectorSupportText';\nimport { SelectorInput } from '~components/Form/Selector/SelectorInput';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport type {\n BladeElementRef,\n DataAnalyticsAttribute,\n StringChildrenType,\n TestID,\n} from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType, makeSize, useTheme } from '~utils';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport { throwBladeError } from '~utils/logger';\nimport type { MotionMetaProp } from '~components/BaseMotion';\nimport { getInnerMotionRef, getOuterMotionRef } from '~utils/getMotionRefs';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype RadioProps = {\n /**\n * Sets the label text of the Radio\n */\n children?: StringChildrenType;\n /**\n * Help text for the Radio\n */\n helpText?: string;\n /**\n * The value to be used in the Radio input.\n * This is the value that will be returned on form submission.\n */\n value: string;\n /**\n * If `true`, the Radio will be disabled\n *\n * @default false\n */\n isDisabled?: boolean;\n /**\n * Size of the radios\n *\n * @default \"medium\"\n */\n size?: 'small' | 'medium' | 'large';\n} & TestID &\n DataAnalyticsAttribute &\n StyledPropsBlade &\n MotionMetaProp;\n\nconst _Radio: React.ForwardRefRenderFunction<BladeElementRef, RadioProps> = (\n { value, children, helpText, isDisabled, size = 'medium', testID, _motionMeta, ...rest },\n ref,\n) => {\n const { theme } = useTheme();\n const groupProps = useRadioGroupContext();\n const isInsideGroup = !isEmpty(groupProps);\n\n if (__DEV__) {\n if (!isInsideGroup) {\n throwBladeError({\n moduleName: 'Radio',\n message: 'Cannot use <Radio /> outside of <RadioGroup />',\n });\n }\n }\n\n const isChecked = groupProps?.state?.isChecked(value);\n const defaultChecked =\n groupProps?.defaultValue === undefined ? undefined : groupProps?.defaultValue === value;\n const validationState = groupProps?.validationState;\n const hasError = validationState === 'error';\n const _isDisabled = isDisabled ?? groupProps?.isDisabled;\n const _isRequired = groupProps?.isRequired || groupProps?.necessityIndicator === 'required';\n const name = groupProps?.name;\n const showHelpText = helpText;\n const isReactNative = getPlatformType() === 'react-native';\n const _size = groupProps.size ?? size;\n\n const handleChange: OnChange = ({ isChecked, value }) => {\n if (isChecked) {\n groupProps?.state?.setValue(value!);\n } else {\n groupProps?.state?.removeValue();\n }\n };\n\n const { state, ids, inputProps } = useRadio({\n defaultChecked,\n isChecked,\n hasError,\n isDisabled: _isDisabled,\n isRequired: _isRequired,\n name,\n value,\n onChange: handleChange,\n });\n\n // radio icon's size & margin + margin-left of SelectorTitle which is 2\n const helpTextLeftSpacing = makeSize(radioSizes.icon[size].width + theme.spacing[3]);\n\n return (\n <BaseBox ref={getOuterMotionRef({ _motionMeta, ref })} {...getStyledProps(rest)}>\n <SelectorLabel\n componentName={MetaConstants.RadioLabel}\n inputProps={isReactNative ? inputProps : {}}\n testID={testID}\n >\n <BaseBox display=\"flex\" flexDirection=\"column\">\n <BaseBox display=\"flex\" alignItems=\"center\" flexDirection=\"row\">\n <SelectorInput\n hoverTokens={radioHoverTokens}\n isChecked={state.isChecked}\n isDisabled={_isDisabled}\n hasError={hasError}\n inputProps={inputProps}\n ref={getInnerMotionRef({ _motionMeta, ref })}\n {...makeAnalyticsAttribute(rest)}\n />\n <RadioIcon\n size={_size}\n isChecked={state.isChecked}\n isDisabled={_isDisabled}\n isNegative={hasError}\n />\n {children ? (\n <SelectorTitle size={_size} isDisabled={_isDisabled}>\n {children}\n </SelectorTitle>\n ) : null}\n </BaseBox>\n {showHelpText && (\n <BaseBox marginLeft={helpTextLeftSpacing}>\n <SelectorSupportText size={_size} id={ids?.helpTextId}>\n {helpText}\n </SelectorSupportText>\n </BaseBox>\n )}\n </BaseBox>\n </SelectorLabel>\n </BaseBox>\n );\n};\n\nconst Radio = assignWithoutSideEffects(React.forwardRef(_Radio), { displayName: 'Radio' });\n\nexport type { RadioProps };\nexport { Radio };\n"],"names":["_Radio","_ref","ref","_groupProps$state","_groupProps$size","value","children","helpText","isDisabled","_ref$size","size","testID","_motionMeta","rest","_objectWithoutProperties","_excluded","_useTheme","useTheme","theme","groupProps","useRadioGroupContext","isInsideGroup","isEmpty","__DEV__","throwBladeError","moduleName","message","isChecked","state","defaultChecked","defaultValue","undefined","validationState","hasError","_isDisabled","_isRequired","isRequired","necessityIndicator","name","showHelpText","isReactNative","getPlatformType","_size","handleChange","_ref2","_groupProps$state2","setValue","_groupProps$state3","removeValue","_useRadio","useRadio","onChange","ids","inputProps","helpTextLeftSpacing","makeSize","radioSizes","icon","width","spacing","_jsx","BaseBox","Object","assign","getOuterMotionRef","getStyledProps","SelectorLabel","componentName","MetaConstants","RadioLabel","_jsxs","display","flexDirection","alignItems","SelectorInput","hoverTokens","radioHoverTokens","getInnerMotionRef","makeAnalyticsAttribute","RadioIcon","isNegative","SelectorTitle","marginLeft","SelectorSupportText","id","helpTextId","Radio","assignWithoutSideEffects","React","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAA,SAAA,CAAA,CAAA,OAAA,CAAA,UAAA,CAAA,UAAA,CAAA,YAAA,CAAA,MAAA,CAAA,QAAA,CAAA,aAAA,CAAA,CA2DA,IAAMA,MAAmE,CAAG,SAAtEA,MAAmEA,CAAAC,IAAA,CAEvEC,GAAG,CACA,CAAA,IAAAC,iBAAA,CAAAC,gBAAA,CAFD,IAAAC,KAAK,CAAAJ,IAAA,CAALI,KAAK,CAAEC,QAAQ,CAAAL,IAAA,CAARK,QAAQ,CAAEC,QAAQ,CAAAN,IAAA,CAARM,QAAQ,CAAEC,UAAU,CAAAP,IAAA,CAAVO,UAAU,CAAAC,SAAA,CAAAR,IAAA,CAAES,IAAI,CAAJA,IAAI,CAAAD,SAAA,GAAG,KAAA,CAAA,CAAA,QAAQ,CAAAA,SAAA,CAAEE,MAAM,CAAAV,IAAA,CAANU,MAAM,CAAEC,WAAW,CAAAX,IAAA,CAAXW,WAAW,CAAKC,IAAI,CAAAC,wBAAA,CAAAb,IAAA,CAAAc,SAAA,CAAA,CAGtF,IAAAC,SAAA,CAAkBC,QAAQ,EAAE,CAApBC,KAAK,CAAAF,SAAA,CAALE,KAAK,CACb,IAAMC,UAAU,CAAGC,oBAAoB,EAAE,CACzC,IAAMC,aAAa,CAAG,CAACC,OAAO,CA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iC,YAAY,EACXqB,GAAA,CAACC,OAAO,EAACqB,UAAU,CAAE5B,mBAAoB,CAAAhD,QAAA,CACvCsD,GAAA,CAACuB,mBAAmB,CAACzE,CAAAA,IAAI,CAAEgC,KAAM,CAAC0C,EAAE,CAAEhC,GAAG,EAAHA,IAAAA,CAAAA,KAAAA,CAAAA,CAAAA,GAAG,CAAEiC,UAAW,CAAA/E,QAAA,CACnDC,QAAQ,CACU,CAAC,CACf,CACV,CACM,CAAA,CAAC,CACG,CAAC,CAAA,CACT,CAAC,CAEd,CAAC,CAEK,IAAA+E,KAAK,CAAGC,wBAAwB,CAACC,cAAK,CAACC,UAAU,CAACzF,MAAM,CAAC,CAAE,CAAE0F,WAAW,CAAE,OAAQ,CAAC;;;;"}
1
+ {"version":3,"file":"Radio.js","sources":["../../../../../src/components/Radio/Radio.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/restrict-plus-operands */\n/* eslint-disable @typescript-eslint/no-shadow */\nimport React from 'react';\nimport type { OnChange } from './useRadio';\nimport { useRadio } from './useRadio';\nimport { RadioIcon } from './RadioIcon/RadioIcon';\nimport { useRadioGroupContext } from './RadioGroup/RadioContext';\nimport { radioHoverTokens, radioSizes } from './radioTokens';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport { SelectorLabel } from '~components/Form/Selector/SelectorLabel';\nimport BaseBox from '~components/Box/BaseBox';\nimport { SelectorTitle } from '~components/Form/Selector/SelectorTitle';\nimport { SelectorSupportText } from '~components/Form/Selector/SelectorSupportText';\nimport { SelectorInput } from '~components/Form/Selector/SelectorInput';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport type {\n BladeElementRef,\n DataAnalyticsAttribute,\n StringChildrenType,\n TestID,\n} from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType, makeSize, useTheme } from '~utils';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport { throwBladeError } from '~utils/logger';\nimport type { MotionMetaProp } from '~components/BaseMotion';\nimport { getInnerMotionRef, getOuterMotionRef } from '~utils/getMotionRefs';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype RadioProps = {\n /**\n * Sets the label text of the Radio\n */\n children?: StringChildrenType;\n /**\n * Help text for the Radio\n */\n helpText?: string;\n /**\n * The value to be used in the Radio input.\n * This is the value that will be returned on form submission.\n */\n value: string;\n /**\n * If `true`, the Radio will be disabled\n *\n * @default false\n */\n isDisabled?: boolean;\n /**\n * Size of the radios\n *\n * @default \"medium\"\n */\n size?: 'small' | 'medium' | 'large';\n} & TestID &\n DataAnalyticsAttribute &\n StyledPropsBlade &\n MotionMetaProp;\n\nconst _Radio: React.ForwardRefRenderFunction<BladeElementRef, RadioProps> = (\n { value, children, helpText, isDisabled, size = 'medium', testID, _motionMeta, ...rest },\n ref,\n) => {\n const { theme } = useTheme();\n const groupProps = useRadioGroupContext();\n const isInsideGroup = !isEmpty(groupProps);\n\n if (__DEV__) {\n if (!isInsideGroup) {\n throwBladeError({\n moduleName: 'Radio',\n message: 'Cannot use <Radio /> outside of <RadioGroup />',\n });\n }\n }\n\n const isChecked = groupProps?.state?.isChecked(value);\n const defaultChecked =\n groupProps?.defaultValue === undefined ? undefined : groupProps?.defaultValue === value;\n const validationState = groupProps?.validationState;\n const hasError = validationState === 'error';\n const _isDisabled = isDisabled ?? groupProps?.isDisabled;\n const _isRequired = groupProps?.isRequired || groupProps?.necessityIndicator === 'required';\n const name = groupProps?.name;\n const showHelpText = helpText;\n const isReactNative = getPlatformType() === 'react-native';\n const _size = groupProps.size ?? size;\n\n const handleChange: OnChange = ({ isChecked, value, event }) => {\n if (isChecked) {\n groupProps?.state?.setValue(value!, event);\n } else {\n groupProps?.state?.removeValue();\n }\n };\n\n const { state, ids, inputProps } = useRadio({\n defaultChecked,\n isChecked,\n hasError,\n isDisabled: _isDisabled,\n isRequired: _isRequired,\n name,\n value,\n onChange: handleChange,\n });\n\n // radio icon's size & margin + margin-left of SelectorTitle which is 2\n const helpTextLeftSpacing = makeSize(radioSizes.icon[size].width + theme.spacing[3]);\n\n return (\n <BaseBox ref={getOuterMotionRef({ _motionMeta, ref })} {...getStyledProps(rest)}>\n <SelectorLabel\n componentName={MetaConstants.RadioLabel}\n inputProps={isReactNative ? inputProps : {}}\n testID={testID}\n >\n <BaseBox display=\"flex\" flexDirection=\"column\">\n <BaseBox display=\"flex\" alignItems=\"center\" flexDirection=\"row\">\n <SelectorInput\n hoverTokens={radioHoverTokens}\n isChecked={state.isChecked}\n isDisabled={_isDisabled}\n hasError={hasError}\n inputProps={inputProps}\n ref={getInnerMotionRef({ _motionMeta, ref })}\n {...makeAnalyticsAttribute(rest)}\n />\n <RadioIcon\n size={_size}\n isChecked={state.isChecked}\n isDisabled={_isDisabled}\n isNegative={hasError}\n />\n {children ? (\n <SelectorTitle size={_size} isDisabled={_isDisabled}>\n {children}\n </SelectorTitle>\n ) : null}\n </BaseBox>\n {showHelpText && (\n <BaseBox marginLeft={helpTextLeftSpacing}>\n <SelectorSupportText size={_size} id={ids?.helpTextId}>\n {helpText}\n </SelectorSupportText>\n </BaseBox>\n )}\n </BaseBox>\n </SelectorLabel>\n </BaseBox>\n );\n};\n\nconst Radio = assignWithoutSideEffects(React.forwardRef(_Radio), { displayName: 'Radio' });\n\nexport type { RadioProps };\nexport { Radio };\n"],"names":["_Radio","_ref","ref","_groupProps$state","_groupProps$size","value","children","helpText","isDisabled","_ref$size","size","testID","_motionMeta","rest","_objectWithoutProperties","_excluded","_useTheme","useTheme","theme","groupProps","useRadioGroupContext","isInsideGroup","isEmpty","__DEV__","throwBladeError","moduleName","message","isChecked","state","defaultChecked","defaultValue","undefined","validationState","hasError","_isDisabled","_isRequired","isRequired","necessityIndicator","name","showHelpText","isReactNative","getPlatformType","_size","handleChange","_ref2","event","_groupProps$state2","setValue","_groupProps$state3","removeValue","_useRadio","useRadio","onChange","ids","inputProps","helpTextLeftSpacing","makeSize","radioSizes","icon","width","spacing","_jsx","BaseBox","Object","assign","getOuterMotionRef","getStyledProps","SelectorLabel","componentName","MetaConstants","RadioLabel","_jsxs","display","flexDirection","alignItems","SelectorInput","hoverTokens","radioHoverTokens","getInnerMotionRef","makeAnalyticsAttribute","RadioIcon","isNegative","SelectorTitle","marginLeft","SelectorSupportText","id","helpTextId","Radio","assignWithoutSideEffects","React","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAA,SAAA,CAAA,CAAA,OAAA,CAAA,UAAA,CAAA,UAAA,CAAA,YAAA,CAAA,MAAA,CAAA,QAAA,CAAA,aAAA,CAAA,CA2DA,IAAMA,MAAmE,CAAG,SAAtEA,MAAmEA,CAAAC,IAAA,CAEvEC,GAAG,CACA,CAAAC,IAAAA,iBAAA,CAAAC,gBAAA,CAAA,IAFDC,KAAK,CAAAJ,IAAA,CAALI,KAAK,CAAEC,QAAQ,CAAAL,IAAA,CAARK,QAAQ,CAAEC,QAAQ,CAAAN,IAAA,CAARM,QAAQ,CAAEC,UAAU,CAAAP,IAAA,CAAVO,UAAU,CAAAC,SAAA,CAAAR,IAAA,CAAES,IAAI,CAAJA,IAAI,CAAAD,SAAA,GAAA,KAAA,CAAA,CAAG,QAAQ,CAAAA,SAAA,CAAEE,MAAM,CAAAV,IAAA,CAANU,MAAM,CAAEC,WAAW,CAAAX,IAAA,CAAXW,WAAW,CAAKC,IAAI,CAAAC,wBAAA,CAAAb,IAAA,CAAAc,SAAA,EAGtF,IAAAC,SAAA,CAAkBC,QAAQ,EAAE,CAApBC,KAAK,CAAAF,SAAA,CAALE,KAAK,CACb,IAAMC,UAAU,CAAGC,oBAAoB,EAAE,CACzC,IAAMC,aAAa,CAAG,CAACC,OAAO,CAACH,UAAU,CAAC,CAE1C,GAAII,OAAO,CAAE,CACX,GAAI,CAACF,aAAa,CAAE,CAClBG,eAAe,CAAC,CACdC,UAAU,CAAE,OAAO,CACnBC,OAAO,CAAE,gDACX,C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E5B,mBAAoB,CAAAjD,QAAA,CACvCuD,GAAA,CAACuB,mBAAmB,CAAA,CAAC1E,IAAI,CAAEgC,KAAM,CAAC2C,EAAE,CAAEhC,GAAG,EAAHA,IAAAA,CAAAA,KAAAA,CAAAA,CAAAA,GAAG,CAAEiC,UAAW,CAAAhF,QAAA,CACnDC,QAAQ,CACU,CAAC,CACf,CACV,CACM,CAAA,CAAC,CACG,CAAC,CAAA,CACT,CAAC,CAEd,CAAC,CAEK,IAAAgF,KAAK,CAAGC,wBAAwB,CAACC,cAAK,CAACC,UAAU,CAAC1F,MAAM,CAAC,CAAE,CAAE2F,WAAW,CAAE,OAAQ,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"RadioGroup.js","sources":["../../../../../../src/components/Radio/RadioGroup/RadioGroup.tsx"],"sourcesContent":["import React from 'react';\nimport { radioSizes } from '../radioTokens';\nimport { RadioGroupProvider } from './RadioContext';\nimport { useRadioGroup } from './useRadioGroup';\nimport BaseBox from '~components/Box/BaseBox';\nimport { FormHint, FormLabel } from '~components/Form';\nimport { SelectorGroupField } from '~components/Form/Selector/SelectorGroupField';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { useBreakpoint } from '~utils';\nimport { useTheme } from '~components/BladeProvider';\nimport type { DataAnalyticsAttribute, TestID } from '~utils/types';\nimport { makeSize } from '~utils/makeSize';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype RadioGroupProps = {\n /**\n * Accepts multiple radios as children\n */\n children: React.ReactNode;\n /**\n * Help text of the radio group\n */\n helpText?: string;\n /**\n * Error text of the radio group\n * Renders when `validationState` is set to 'error'\n *\n * Overrides helpText\n */\n errorText?: string;\n /**\n * Sets the error state of the radioGroup\n * If set to `error` it will render the `errorText` of the group,\n * and propagate `invalid` prop to every radio\n */\n validationState?: 'error' | 'none';\n /**\n * Renders a necessity indicator after radioGroup label\n *\n * If set to `undefined` it renders nothing.\n */\n necessityIndicator?: 'required' | 'optional' | 'none';\n /**\n * Sets the disabled state of the radioGroup\n * If set to `true` it propagate down to all the radios\n *\n * @default false\n */\n isDisabled?: boolean;\n /**\n * Sets the required state of the radioGroup\n * @default false\n */\n isRequired?: boolean;\n /**\n * Renders the label of the radio group\n */\n label?: string;\n /**\n * Sets the position of the label\n *\n * @default 'top'\n */\n labelPosition?: 'top' | 'left';\n /**\n * Initial value of the radio group\n */\n defaultValue?: string;\n /**\n * value of the radio group\n *\n * Use `onChange` to update its value\n */\n value?: string;\n /**\n * The callback invoked when any of the radio's state changes\n */\n onChange?: ({ name, value }: { name: string | undefined; value: string }) => void;\n /**\n * The name of the input field in a radio\n * (Useful for form submission).\n */\n name?: string;\n /**\n * Size of the radios\n *\n * @default \"medium\"\n */\n size?: 'small' | 'medium' | 'large';\n} & TestID &\n DataAnalyticsAttribute &\n StyledPropsBlade;\n\nconst RadioGroup = ({\n children,\n label,\n helpText,\n isDisabled = false,\n isRequired = false,\n necessityIndicator = 'none',\n labelPosition = 'top',\n validationState = 'none',\n errorText,\n name,\n defaultValue,\n onChange,\n value,\n size = 'medium',\n testID,\n ...rest\n}: RadioGroupProps): React.ReactElement => {\n const { contextValue, ids } = useRadioGroup({\n defaultValue,\n isDisabled,\n isRequired,\n labelPosition,\n name,\n necessityIndicator,\n onChange,\n validationState,\n value,\n size,\n });\n\n const { theme } = useTheme();\n const { matchedDeviceType } = useBreakpoint({ breakpoints: theme.breakpoints });\n const showError = validationState === 'error' && errorText;\n const showHelpText = !showError && helpText;\n const accessibilityText = `${showError ? errorText : ''} ${showHelpText ? helpText : ''}`.trim();\n const gap = radioSizes.group.gap[size][matchedDeviceType];\n const childCount = React.Children.count(children);\n\n return (\n <RadioGroupProvider value={contextValue}>\n <BaseBox {...getStyledProps(rest)}>\n <SelectorGroupField\n position={labelPosition}\n labelledBy={ids.labelId}\n accessibilityRole=\"radiogroup\"\n componentName=\"radio-group\"\n testID={testID}\n {...makeAnalyticsAttribute(rest)}\n >\n {label ? (\n <FormLabel\n as=\"span\"\n necessityIndicator={necessityIndicator}\n position={labelPosition}\n id={ids.labelId}\n accessibilityText={accessibilityText && `,${accessibilityText}`}\n size={size}\n >\n {label}\n </FormLabel>\n ) : null}\n <BaseBox>\n <BaseBox display=\"flex\" flexDirection=\"column\">\n {React.Children.map(children, (child, index) => {\n return (\n <BaseBox\n key={index}\n {...{ marginBottom: index === childCount - 1 ? makeSize(0) : gap }}\n >\n {child}\n </BaseBox>\n );\n })}\n </BaseBox>\n <FormHint\n size={size}\n type={validationState === 'error' ? 'error' : 'help'}\n errorText={errorText}\n helpText={helpText}\n />\n </BaseBox>\n </SelectorGroupField>\n </BaseBox>\n </RadioGroupProvider>\n );\n};\n\nexport type { RadioGroupProps };\nexport { RadioGroup };\n"],"names":["RadioGroup","_ref","children","label","helpText","_ref$isDisabled","isDisabled","_ref$isRequired","isRequired","_ref$necessityIndicat","necessityIndicator","_ref$labelPosition","labelPosition","_ref$validationState","validationState","errorText","name","defaultValue","onChange","value","_ref$size","size","testID","rest","_objectWithoutProperties","_excluded","_useRadioGroup","useRadioGroup","contextValue","ids","_useTheme","useTheme","theme","_useBreakpoint","useBreakpoint","breakpoints","matchedDeviceType","showError","showHelpText","accessibilityText","trim","gap","radioSizes","group","childCount","React","Children","count","_jsx","RadioGroupProvider","BaseBox","Object","assign","getStyledProps","_jsxs","SelectorGroupField","position","labelledBy","labelId","accessibilityRole","componentName","makeAnalyticsAttribute","FormLabel","as","id","display","flexDirection","map","child","index","marginBottom","makeSize","FormHint","type"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,UAAA,CAAA,OAAA,CAAA,UAAA,CAAA,YAAA,CAAA,YAAA,CAAA,oBAAA,CAAA,eAAA,CAAA,iBAAA,CAAA,WAAA,CAAA,MAAA,CAAA,cAAA,CAAA,UAAA,CAAA,OAAA,CAAA,MAAA,CAAA,QAAA,CAAA,CA8FM,IAAAA,UA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AAA,CAAA,CAAC,CACd,CAAA,CAAC,CACQ,CAAC,CAEzB;;;;"}
1
+ {"version":3,"file":"RadioGroup.js","sources":["../../../../../../src/components/Radio/RadioGroup/RadioGroup.tsx"],"sourcesContent":["import React from 'react';\nimport { radioSizes } from '../radioTokens';\nimport { RadioGroupProvider } from './RadioContext';\nimport { useRadioGroup } from './useRadioGroup';\nimport BaseBox from '~components/Box/BaseBox';\nimport { FormHint, FormLabel } from '~components/Form';\nimport { SelectorGroupField } from '~components/Form/Selector/SelectorGroupField';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { useBreakpoint } from '~utils';\nimport { useTheme } from '~components/BladeProvider';\nimport type { DataAnalyticsAttribute, TestID } from '~utils/types';\nimport { makeSize } from '~utils/makeSize';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype RadioGroupProps = {\n /**\n * Accepts multiple radios as children\n */\n children: React.ReactNode;\n /**\n * Help text of the radio group\n */\n helpText?: string;\n /**\n * Error text of the radio group\n * Renders when `validationState` is set to 'error'\n *\n * Overrides helpText\n */\n errorText?: string;\n /**\n * Sets the error state of the radioGroup\n * If set to `error` it will render the `errorText` of the group,\n * and propagate `invalid` prop to every radio\n */\n validationState?: 'error' | 'none';\n /**\n * Renders a necessity indicator after radioGroup label\n *\n * If set to `undefined` it renders nothing.\n */\n necessityIndicator?: 'required' | 'optional' | 'none';\n /**\n * Sets the disabled state of the radioGroup\n * If set to `true` it propagate down to all the radios\n *\n * @default false\n */\n isDisabled?: boolean;\n /**\n * Sets the required state of the radioGroup\n * @default false\n */\n isRequired?: boolean;\n /**\n * Renders the label of the radio group\n */\n label?: string;\n /**\n * Sets the position of the label\n *\n * @default 'top'\n */\n labelPosition?: 'top' | 'left';\n /**\n * Initial value of the radio group\n */\n defaultValue?: string;\n /**\n * value of the radio group\n *\n * Use `onChange` to update its value\n */\n value?: string;\n /**\n * The callback invoked when any of the radio's state changes\n */\n onChange?: ({\n name,\n value,\n event,\n }: {\n name: string | undefined;\n value: string;\n event: React.ChangeEvent<HTMLInputElement>;\n }) => void;\n /**\n * The name of the input field in a radio\n * (Useful for form submission).\n */\n name?: string;\n /**\n * Size of the radios\n *\n * @default \"medium\"\n */\n size?: 'small' | 'medium' | 'large';\n} & TestID &\n DataAnalyticsAttribute &\n StyledPropsBlade;\n\nconst RadioGroup = ({\n children,\n label,\n helpText,\n isDisabled = false,\n isRequired = false,\n necessityIndicator = 'none',\n labelPosition = 'top',\n validationState = 'none',\n errorText,\n name,\n defaultValue,\n onChange,\n value,\n size = 'medium',\n testID,\n ...rest\n}: RadioGroupProps): React.ReactElement => {\n const { contextValue, ids } = useRadioGroup({\n defaultValue,\n isDisabled,\n isRequired,\n labelPosition,\n name,\n necessityIndicator,\n onChange,\n validationState,\n value,\n size,\n });\n\n const { theme } = useTheme();\n const { matchedDeviceType } = useBreakpoint({ breakpoints: theme.breakpoints });\n const showError = validationState === 'error' && errorText;\n const showHelpText = !showError && helpText;\n const accessibilityText = `${showError ? errorText : ''} ${showHelpText ? helpText : ''}`.trim();\n const gap = radioSizes.group.gap[size][matchedDeviceType];\n const childCount = React.Children.count(children);\n\n return (\n <RadioGroupProvider value={contextValue}>\n <BaseBox {...getStyledProps(rest)}>\n <SelectorGroupField\n position={labelPosition}\n labelledBy={ids.labelId}\n accessibilityRole=\"radiogroup\"\n componentName=\"radio-group\"\n testID={testID}\n {...makeAnalyticsAttribute(rest)}\n >\n {label ? (\n <FormLabel\n as=\"span\"\n necessityIndicator={necessityIndicator}\n position={labelPosition}\n id={ids.labelId}\n accessibilityText={accessibilityText && `,${accessibilityText}`}\n size={size}\n >\n {label}\n </FormLabel>\n ) : null}\n <BaseBox>\n <BaseBox display=\"flex\" flexDirection=\"column\">\n {React.Children.map(children, (child, index) => {\n return (\n <BaseBox\n key={index}\n {...{ marginBottom: index === childCount - 1 ? makeSize(0) : gap }}\n >\n {child}\n </BaseBox>\n );\n })}\n </BaseBox>\n <FormHint\n size={size}\n type={validationState === 'error' ? 'error' : 'help'}\n errorText={errorText}\n helpText={helpText}\n />\n </BaseBox>\n </SelectorGroupField>\n </BaseBox>\n </RadioGroupProvider>\n );\n};\n\nexport type { RadioGroupProps };\nexport { RadioGroup };\n"],"names":["RadioGroup","_ref","children","label","helpText","_ref$isDisabled","isDisabled","_ref$isRequired","isRequired","_ref$necessityIndicat","necessityIndicator","_ref$labelPosition","labelPosition","_ref$validationState","validationState","errorText","name","defaultValue","onChange","value","_ref$size","size","testID","rest","_objectWithoutProperties","_excluded","_useRadioGroup","useRadioGroup","contextValue","ids","_useTheme","useTheme","theme","_useBreakpoint","useBreakpoint","breakpoints","matchedDeviceType","showError","showHelpText","accessibilityText","trim","gap","radioSizes","group","childCount","React","Children","count","_jsx","RadioGroupProvider","BaseBox","Object","assign","getStyledProps","_jsxs","SelectorGroupField","position","labelledBy","labelId","accessibilityRole","componentName","makeAnalyticsAttribute","FormLabel","as","id","display","flexDirection","map","child","index","marginBottom","makeSize","FormHint","type"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,UAAA,CAAA,OAAA,CAAA,UAAA,CAAA,YAAA,CAAA,YAAA,CAAA,oBAAA,CAAA,eAAA,CAAA,iBAAA,CAAA,WAAA,CAAA,MAAA,CAAA,cAAA,CAAA,UAAA,CAAA,OAAA,CAAA,MAAA,CAAA,QAAA,CAAA,CAsGM,IAAAA,UAAU,CAAG,SAAbA,UAAUA,CAAAC,IAAA,CAiB2B,CAAA,IAhBzCC,QAAQ,CAAAD,IAAA,CAARC,QAAQ,CACRC,KAAK,CAAAF,IAAA,CAALE,KAAK,CACLC,QAAQ,CAAAH,IAAA,CAARG,QAAQ,CAAAC,eAAA,CAAAJ,IAAA,CACRK,UAAU,CAAVA,UAAU,CAAAD,eAAA,GAAG,KAAA,CAAA,CAAA,KAAK,CAAAA,eAAA,CAAAE,eAAA,CAAAN,IAAA,CAClBO,UAAU,C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,kBAAkB,CAAEA,kBAAmB,CACvC8C,QAAQ,CAAE5C,aAAc,CACxBoD,EAAE,CAAEnC,GAAG,CAAC6B,OAAQ,CAChBnB,iBAAiB,CAAEA,iBAAiB,EAAK,IAAGA,iBAAkB,CAAA,CAAE,CAChElB,IAAI,CAAEA,IAAK,CAAAnB,QAAA,CAEVC,KAAK,CACG,CAAC,CACV,IAAI,CACRmD,IAAA,CAACJ,OAAO,EAAAhD,QAAA,CAAA,CACN8C,GAAA,CAACE,OAAO,CAAA,CAACe,OAAO,CAAC,MAAM,CAACC,aAAa,CAAC,QAAQ,CAAAhE,QAAA,CAC3C2C,cAAK,CAACC,QAAQ,CAACqB,GAAG,CAACjE,QAAQ,CAAE,SAACkE,KAAK,CAAEC,KAAK,CAAK,CAC9C,OACErB,GAAA,CAACE,OAAO,CAAA,CAEAoB,YAAY,CAAED,KAAK,GAAKzB,UAAU,CAAG,CAAC,CAAG2B,QAAQ,CAAC,CAAC,CAAC,CAAG9B,GAAG,CAAAvC,QAAA,CAE/DkE,KAAK,EAHDC,KAIE,CAAC,CAEd,CAAC,CAAC,CACK,CAAC,CACVrB,GAAA,CAACwB,QAAQ,CAAA,CACPnD,IAAI,CAAEA,IAAK,CACXoD,IAAI,CAAE3D,eAAe,GAAK,OAAO,CAAG,OAAO,CAAG,MAAO,CACrDC,SAAS,CAAEA,SAAU,CACrBX,QAAQ,CAAEA,QAAS,CACpB,CAAC,CAAA,CACK,CAAC,CACQ,CAAA,CAAA,CAAC,CACd,CAAA,CAAC,CACQ,CAAC,CAEzB;;;;"}
@@ -11,7 +11,7 @@ import '../../BottomSheet/BottomSheetStack.js';
11
11
  import 'react/jsx-runtime';
12
12
  import { useId } from '../../../utils/useId.js';
13
13
 
14
- var useRadioGroup=function useRadioGroup(_ref){var value=_ref.value,defaultValue=_ref.defaultValue,isDisabled=_ref.isDisabled,isRequired=_ref.isRequired,labelPosition=_ref.labelPosition,_onChange=_ref.onChange,validationState=_ref.validationState,necessityIndicator=_ref.necessityIndicator,name=_ref.name,size=_ref.size;var _useTheme=useTheme(),platform=_useTheme.platform;var idBase=useId('radio-group');var labelId=`${idBase}-label`;var fallbackName=name!=null?name:idBase;var _useControllableState=useControllableState({value:value,defaultValue:defaultValue,onChange:function onChange(v){return _onChange==null?void 0:_onChange({value:v,name:fallbackName});}}),_useControllableState2=_slicedToArray(_useControllableState,2),checkedValue=_useControllableState2[0],setValue=_useControllableState2[1];var state=React__default.useMemo(function(){return {value:checkedValue,setValue:function(_setValue){function setValue(_x){return _setValue.apply(this,arguments);}setValue.toString=function(){return _setValue.toString();};return setValue;}(function(v){if(isDisabled){return;}setValue(function(){return v;});}),removeValue:function removeValue(){if(isDisabled){return;}setValue(undefined);},isChecked:function isChecked(v){if(isUndefined(v)||isUndefined(checkedValue))return false;return checkedValue===v;}};},[checkedValue,isDisabled,setValue]);var contextValue=React__default.useMemo(function(){return {necessityIndicator:necessityIndicator,validationState:validationState,isDisabled:isDisabled,isRequired:isRequired,labelPosition:platform==='onMobile'?'top':labelPosition,name:fallbackName,state:state,size:size};},[validationState,isDisabled,isRequired,platform,labelPosition,state,fallbackName,necessityIndicator,size]);return {state:state,contextValue:contextValue,ids:{labelId:labelId}};};
14
+ var useRadioGroup=function useRadioGroup(_ref){var value=_ref.value,defaultValue=_ref.defaultValue,isDisabled=_ref.isDisabled,isRequired=_ref.isRequired,labelPosition=_ref.labelPosition,_onChange=_ref.onChange,validationState=_ref.validationState,necessityIndicator=_ref.necessityIndicator,name=_ref.name,size=_ref.size;var _useTheme=useTheme(),platform=_useTheme.platform;var idBase=useId('radio-group');var labelId=`${idBase}-label`;var fallbackName=name!=null?name:idBase;var _useControllableState=useControllableState({value:value,defaultValue:defaultValue,onChange:function onChange(v,event){_onChange==null?void 0:_onChange({value:v,name:fallbackName,event:event});}}),_useControllableState2=_slicedToArray(_useControllableState,2),checkedValue=_useControllableState2[0],setValue=_useControllableState2[1];var state=React__default.useMemo(function(){return {value:checkedValue,setValue:function(_setValue){function setValue(_x,_x2){return _setValue.apply(this,arguments);}setValue.toString=function(){return _setValue.toString();};return setValue;}(function(v,event){if(isDisabled){return;}setValue(function(){return v;},false,event);}),removeValue:function removeValue(){if(isDisabled){return;}setValue(undefined);},isChecked:function isChecked(v){if(isUndefined(v)||isUndefined(checkedValue))return false;return checkedValue===v;}};},[checkedValue,isDisabled,setValue]);var contextValue=React__default.useMemo(function(){return {necessityIndicator:necessityIndicator,validationState:validationState,isDisabled:isDisabled,isRequired:isRequired,labelPosition:platform==='onMobile'?'top':labelPosition,name:fallbackName,state:state,size:size};},[validationState,isDisabled,isRequired,platform,labelPosition,state,fallbackName,necessityIndicator,size]);return {state:state,contextValue:contextValue,ids:{labelId:labelId}};};
15
15
 
16
16
  export { useRadioGroup };
17
17
  //# sourceMappingURL=useRadioGroup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useRadioGroup.js","sources":["../../../../../../src/components/Radio/RadioGroup/useRadioGroup.ts"],"sourcesContent":["import React from 'react';\nimport type { RadioGroupProps } from './RadioGroup';\nimport type { RadioGroupContextType } from './RadioContext';\nimport isUndefined from '~utils/lodashButBetter/isUndefined';\nimport { useControllableState } from '~utils/useControllable';\nimport { useTheme } from '~components/BladeProvider';\nimport { useId } from '~utils/useId';\n\ntype UseRadioGroupProps = Pick<\n RadioGroupProps,\n | 'isDisabled'\n | 'isRequired'\n | 'labelPosition'\n | 'validationState'\n | 'name'\n | 'value'\n | 'defaultValue'\n | 'onChange'\n | 'necessityIndicator'\n | 'size'\n>;\n\nexport type State = {\n value: string;\n setValue(value: string): void;\n removeValue(): void;\n isChecked(value: string): boolean;\n};\n\ntype UseRadioGroupReturn = {\n state: State;\n contextValue: RadioGroupContextType;\n ids: { labelId: string };\n};\n\nconst useRadioGroup = ({\n value,\n defaultValue,\n isDisabled,\n isRequired,\n labelPosition,\n onChange,\n validationState,\n necessityIndicator,\n name,\n size,\n}: UseRadioGroupProps): UseRadioGroupReturn => {\n const { platform } = useTheme();\n const idBase = useId('radio-group');\n const labelId = `${idBase}-label`;\n const fallbackName = name ?? idBase;\n const [checkedValue, setValue] = useControllableState({\n value,\n defaultValue,\n onChange: (v: string) => onChange?.({ value: v, name: fallbackName }),\n });\n\n const state = React.useMemo<State>(() => {\n return {\n value: checkedValue,\n setValue(v: string): void {\n if (isDisabled) {\n return;\n }\n\n setValue(() => v);\n },\n removeValue(): void {\n if (isDisabled) {\n return;\n }\n\n setValue(undefined!);\n },\n isChecked(v: string): boolean {\n if (isUndefined(v) || isUndefined(checkedValue)) return false;\n return checkedValue === v;\n },\n };\n }, [checkedValue, isDisabled, setValue]);\n\n const contextValue = React.useMemo<RadioGroupContextType>(() => {\n return {\n necessityIndicator,\n validationState,\n isDisabled,\n isRequired,\n labelPosition: platform === 'onMobile' ? 'top' : labelPosition,\n name: fallbackName,\n state,\n size,\n };\n }, [\n validationState,\n isDisabled,\n isRequired,\n platform,\n labelPosition,\n state,\n fallbackName,\n necessityIndicator,\n size,\n ]);\n\n return { state, contextValue, ids: { labelId } };\n};\n\nexport { useRadioGroup };\n"],"names":["useRadioGroup","_ref","value","defaultValue","isDisabled","isRequired","labelPosition","onChange","validationState","necessityIndicator","name","size","_useTheme","useTheme","platform","idBase","useId","labelId","fallbackName","_useControllableState","useControllableState","v","_useControllableState2","_slicedToArray","checkedValue","setValue","state","React","useMemo","_setValue","_x","apply","arguments","toString","removeValue","undefined","isChecked","isUndefined","contextValue","ids"],"mappings":";;;;;;;;;;;;;AAmCM,IAAAA,aAAa,CAAG,SAAhBA,aAAaA,CAAAC,IAAA,CAW4B,KAV7CC,KAAK,CAAAD,IAAA,CAALC,KAAK,CACLC,YAAY,CAAAF,IAAA,CAAZE,YAAY,CACZC,UAAU,CAAAH,IAAA,CAAVG,UAAU,CACVC,UAAU,CAAAJ,IAAA,CAAVI,UAAU,CACVC,aAAa,CAAAL,IAAA,CAAbK,aAAa,CACbC,SAAQ,CAAAN,IAAA,CAARM,QAAQ,CACRC,eAAe,CAAAP,IAAA,CAAf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AAC,GAAC,CACnB,CAAC,EACDa,WAAW,CAAA,SAAAA,WAAA,EAAS,CAClB,GAAI9B,UAAU,CAAE,CACd,OACF,CAEAqB,QAAQ,CAACU,SAAU,CAAC,CACtB,CAAC,CACDC,SAAS,CAAAA,SAAAA,SAAAA,CAACf,CAAS,CAAW,CAC5B,GAAIgB,WAAW,CAAChB,CAAC,CAAC,EAAIgB,WAAW,CAACb,YAAY,CAAC,CAAE,OAAO,KAAK,CAC7D,OAAOA,YAAY,GAAKH,CAAC,CAC3B,CACF,CAAC,CACH,CAAC,CAAE,CAACG,YAAY,CAAEpB,UAAU,CAAEqB,QAAQ,CAAC,CAAC,CAExC,IAAMa,YAAY,CAAGX,cAAK,CAACC,OAAO,CAAwB,UAAM,CAC9D,OAAO,CACLnB,kBAAkB,CAAlBA,kBAAkB,CAClBD,eAAe,CAAfA,eAAe,CACfJ,UAAU,CAAVA,UAAU,CACVC,UAAU,CAAVA,UAAU,CACVC,aAAa,CAAEQ,QAAQ,GAAK,UAAU,CAAG,KAAK,CAAGR,aAAa,CAC9DI,IAAI,CAAEQ,YAAY,CAClBQ,KAAK,CAALA,KAAK,CACLf,IAAI,CAAJA,IACF,CAAC,CACH,CAAC,CAAE,CACDH,eAAe,CACfJ,UAAU,CACVC,UAAU,CACVS,QAAQ,CACRR,aAAa,CACboB,KAAK,CACLR,YAAY,CACZT,kBAAkB,CAClBE,IAAI,CACL,CAAC,CAEF,OAAO,CAAEe,KAAK,CAALA,KAAK,CAAEY,YAAY,CAAZA,YAAY,CAAEC,GAAG,CAAE,CAAEtB,OAAO,CAAPA,OAAQ,CAAE,CAAC,CAClD;;;;"}
1
+ {"version":3,"file":"useRadioGroup.js","sources":["../../../../../../src/components/Radio/RadioGroup/useRadioGroup.ts"],"sourcesContent":["import React from 'react';\nimport type { RadioGroupProps } from './RadioGroup';\nimport type { RadioGroupContextType } from './RadioContext';\nimport isUndefined from '~utils/lodashButBetter/isUndefined';\nimport { useControllableState } from '~utils/useControllable';\nimport { useTheme } from '~components/BladeProvider';\nimport { useId } from '~utils/useId';\n\ntype UseRadioGroupProps = Pick<\n RadioGroupProps,\n | 'isDisabled'\n | 'isRequired'\n | 'labelPosition'\n | 'validationState'\n | 'name'\n | 'value'\n | 'defaultValue'\n | 'onChange'\n | 'necessityIndicator'\n | 'size'\n>;\n\nexport type State = {\n value: string;\n setValue(value: string, event: React.ChangeEvent<Element>): void;\n removeValue(): void;\n isChecked(value: string): boolean;\n};\n\ntype UseRadioGroupReturn = {\n state: State;\n contextValue: RadioGroupContextType;\n ids: { labelId: string };\n};\n\nconst useRadioGroup = ({\n value,\n defaultValue,\n isDisabled,\n isRequired,\n labelPosition,\n onChange,\n validationState,\n necessityIndicator,\n name,\n size,\n}: UseRadioGroupProps): UseRadioGroupReturn => {\n const { platform } = useTheme();\n const idBase = useId('radio-group');\n const labelId = `${idBase}-label`;\n const fallbackName = name ?? idBase;\n const [checkedValue, setValue] = useControllableState({\n value,\n defaultValue,\n onChange: (v, event) => {\n onChange?.({ value: v, name: fallbackName, event });\n },\n });\n\n const state = React.useMemo<State>(() => {\n return {\n value: checkedValue,\n setValue(v, event): void {\n if (isDisabled) {\n return;\n }\n\n setValue(() => v, false, event);\n },\n removeValue(): void {\n if (isDisabled) {\n return;\n }\n\n setValue(undefined!);\n },\n isChecked(v: string): boolean {\n if (isUndefined(v) || isUndefined(checkedValue)) return false;\n return checkedValue === v;\n },\n };\n }, [checkedValue, isDisabled, setValue]);\n\n const contextValue = React.useMemo<RadioGroupContextType>(() => {\n return {\n necessityIndicator,\n validationState,\n isDisabled,\n isRequired,\n labelPosition: platform === 'onMobile' ? 'top' : labelPosition,\n name: fallbackName,\n state,\n size,\n };\n }, [\n validationState,\n isDisabled,\n isRequired,\n platform,\n labelPosition,\n state,\n fallbackName,\n necessityIndicator,\n size,\n ]);\n\n return { state, contextValue, ids: { labelId } };\n};\n\nexport { useRadioGroup };\n"],"names":["useRadioGroup","_ref","value","defaultValue","isDisabled","isRequired","labelPosition","onChange","validationState","necessityIndicator","name","size","_useTheme","useTheme","platform","idBase","useId","labelId","fallbackName","_useControllableState","useControllableState","v","event","_useControllableState2","_slicedToArray","checkedValue","setValue","state","React","useMemo","_setValue","_x","_x2","apply","arguments","toString","removeValue","undefined","isChecked","isUndefined","contextValue","ids"],"mappings":";;;;;;;;;;;;;AAmCM,IAAAA,aAAa,CAAG,SAAhBA,aAAaA,CAAAC,IAAA,CAW4B,CAAA,IAV7CC,KAAK,CAAAD,IAAA,CAALC,KAAK,CACLC,YAAY,CAAAF,IAAA,CAAZE,YAAY,CACZC,UAAU,CAAAH,IAAA,CAAVG,UAAU,CACVC,UAAU,CAAAJ,IAAA,CAAVI,UAAU,CACVC,aAAa,CAAAL,IAAA,CAAbK,aAAa,CACbC,SAAQ,CAAAN,IAAA,CAARM,QAAQ,CACRC,eAAe,CAAAP,IAAA,CAAfO,eAAe,CACfC,kBAAkB,CAAAR,IAAA,CAAlBQ,kBAAkB,CAClBC,IAAI,CAAAT,IAAA,CAAJS,IAAI,CACJC,IAAI,CAAAV,IAAA,CAAJU,IAAI,CAEJ,IAAAC,SAAA,CAAqBC,QAAQ,EAAE,CAAvBC,QAAQ,CAAAF,SAAA,CAARE,QAAQ,CAChB,IAAMC,MAAM,CAAGC,KAAK,CAAC,aAAa,CAAC,CACnC,IAAMC,OAAO,CAAI,GAAEF,MAAO,CAAA,MAAA,CAAO,CACjC,IAAMG,YAAY,CAAGR,IAAI,EAAA,IAAA,CAAJA,IAAI,CAAIK,MAAM,CACnC,IAAAI,qBAAA,CAAiCC,oBAAoB,CAAC,CACpDlB,KAAK,CAALA,KAAK,CACLC,YAAY,CAAZA,YAAY,CACZI,QAAQ,CAAE,SAAAA,QAAAA,CAACc,CAAC,CAAEC,KAAK,CAAK,CACtBf,SAAQ,EAAA,IAAA,CAAA,KAAA,CAAA,CAARA,SAAQ,CAAG,CAAEL,KAAK,CAAEmB,CAAC,CAAEX,IAAI,CAAEQ,YAAY,CAAEI,KAAK,C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ClBD,eAAe,CAAfA,eAAe,CACfJ,UAAU,CAAVA,UAAU,CACVC,UAAU,CAAVA,UAAU,CACVC,aAAa,CAAEQ,QAAQ,GAAK,UAAU,CAAG,KAAK,CAAGR,aAAa,CAC9DI,IAAI,CAAEQ,YAAY,CAClBS,KAAK,CAALA,KAAK,CACLhB,IAAI,CAAJA,IACF,CAAC,CACH,CAAC,CAAE,CACDH,eAAe,CACfJ,UAAU,CACVC,UAAU,CACVS,QAAQ,CACRR,aAAa,CACbqB,KAAK,CACLT,YAAY,CACZT,kBAAkB,CAClBE,IAAI,CACL,CAAC,CAEF,OAAO,CAAEgB,KAAK,CAALA,KAAK,CAAEa,YAAY,CAAZA,YAAY,CAAEC,GAAG,CAAE,CAAExB,OAAO,CAAPA,OAAQ,CAAE,CAAC,CAClD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useRadio.js","sources":["../../../../../src/components/Radio/useRadio.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/explicit-function-return-type */\n/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\nimport React from 'react';\nimport type { GestureResponderEvent } from 'react-native';\nimport { useControllableState } from '~utils/useControllable';\nimport { useId } from '~utils/useId';\nimport { getPlatformType } from '~src/utils';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { throwBladeError } from '~utils/logger';\n\nexport type OnChange = ({\n isChecked,\n event,\n value,\n}: {\n isChecked: boolean;\n event?: React.ChangeEvent;\n value?: string;\n}) => void;\n\ntype UseRadioProps = {\n hasError?: boolean;\n /**\n * If `true`, The Radio will be checked. This also makes the Radio controlled\n * Use `onChange` to update its value\n *\n * @default false\n */\n isChecked?: boolean;\n /**\n * If `true`, the Radio will be initially checked. This also makes the Radio uncontrolled\n *\n * @default false\n */\n defaultChecked?: boolean;\n /**\n * The callback invoked when the checked state of the `Radio` changes.\n */\n onChange?: OnChange;\n /**\n * The name of the input field in a Radio\n * (Useful for form submission).\n */\n name?: string;\n /**\n * The value to be used in the Radio input.\n * This is the value that will be returned on form submission.\n */\n value?: string;\n /**\n * If `true`, the Radio will be disabled\n *\n * @default false\n */\n isDisabled?: boolean;\n /**\n * If `true`, the Radio input is marked as required,\n * and `required` attribute will be added\n *\n * @default false\n */\n isRequired?: boolean;\n};\n\nconst useRadio = ({\n isChecked,\n defaultChecked,\n isDisabled,\n isRequired,\n hasError,\n onChange,\n name,\n value,\n}: UseRadioProps) => {\n const inputRef = React.useRef<HTMLInputElement>(null);\n\n const isReactNative = getPlatformType() === 'react-native';\n if (__DEV__) {\n if (isChecked && defaultChecked) {\n throwBladeError({\n message: `Do not provide both 'isChecked' and 'defaultChecked' to useRadio. Consider if you want this component to be controlled or uncontrolled.`,\n moduleName: 'Radio',\n });\n }\n }\n\n const [radioState, setRadioState] = useControllableState({\n value: isChecked,\n defaultValue: defaultChecked ?? false,\n });\n\n const handleOnChange = (event: React.ChangeEvent<HTMLInputElement> | GestureResponderEvent) => {\n if (isDisabled) {\n event.stopPropagation();\n event.preventDefault();\n return;\n }\n\n setRadioState((checked) => {\n // Prevent radio to be unchecked when clicked again\n // Once checked radios don't act as toggle buttons\n if (checked === false) {\n onChange?.({\n isChecked: true,\n event: event as React.ChangeEvent,\n value,\n });\n return true;\n }\n return checked;\n });\n };\n\n const state = {\n isChecked: radioState,\n setChecked: setRadioState,\n };\n\n const idBase = useId('radio');\n const helpTextId = useId(`${idBase}-helptext`);\n\n const accessibilityProps = makeAccessible({\n role: 'radio',\n required: Boolean(isRequired),\n invalid: Boolean(hasError),\n disabled: Boolean(isDisabled),\n checked: radioState,\n describedBy: helpTextId,\n });\n\n if (isReactNative) {\n return {\n state,\n inputProps: {\n onPress: handleOnChange,\n name,\n value,\n ...accessibilityProps,\n },\n };\n }\n\n return {\n state,\n ids: { helpTextId },\n inputProps: {\n ref: inputRef,\n onChange: handleOnChange,\n type: 'radio',\n name,\n value,\n checked: radioState,\n disabled: isDisabled,\n required: isRequired,\n ...accessibilityProps,\n },\n };\n};\n\nexport type InputProps = ReturnType<typeof useRadio>['inputProps'];\n\nexport { useRadio };\n"],"names":["useRadio","_ref","isChecked","defaultChecked","isDisabled","isRequired","hasError","onChange","name","value","inputRef","React","useRef","isReactNative","getPlatformType","__DEV__","throwBladeError","message","moduleName","_useControllableState","useControllableState","defaultValue","_useControllableState2","_slicedToArray","radioState","setRadioState","handleOnChange","event","stopPropagation","preventDefault","checked","state","setChecked","idBase","useId","helpTextId","accessibilityProps","makeAccessible","role","required","Boolean","invalid","disabled","describedBy","inputProps","Object","assign","onPress","ids","ref","type"],"mappings":";;;;;;;;;;AAgEM,IAAAA,QAAQ,CAAG,SAAXA,QAAQA,CAAAC,IAAA,CASO,CARnB,IAAAC,SAAS,CAAAD,IAAA,CAATC,SAAS,CACTC,cAAc,CAAAF,IAAA,CAAdE,cAAc,CACdC,UAAU,CAAAH,IAAA,CAAVG,UAAU,CACVC,UAAU,CAAAJ,IAAA,CAAVI,UAAU,CACVC,QAAQ,CAAAL,IAAA,CAARK,QAAQ,CACRC,QAAQ,CAAAN,IAAA,CAARM,QAAQ,CACRC,IAAI,CAAAP,IAAA,CAAJO,IAAI,CACJC,KAAK,CAAAR,IAAA,CAALQ,KAAK,CAEL,IAAMC,QAAQ,CAAGC,cAAK,CAACC,MAAM,CAAmB,IAAI,CAAC,CAErD,IAAMC,aAAa,CAAGC,eAAe,EAAE,GAAK,cAAc,CAC1D,GAAIC,OAAO,CAAE,CACX,GAAIb,SAAS,EAAIC,cAAc,CAAE,CAC/Ba,eAAe,CAAC,CACdC,OAAO,CAAG,CAAA,uIAAA,CAAwI,CAClJC,UAAU,CAAE,OACd,CAAC,CAAC,CACJ,CACF,CAEA,IAAAC,qBAAA,CAAoCC,oBAAoB,CAAC,CACvDX,KAAK,CAAEP,SAAS,CAChBmB,YAAY,CAAElB,cAAc,OAAdA,cAAc,CAAI,KAClC,CAAC,CAAC,CAAAmB,sBAAA,CAAAC,cAAA,CAAAJ,qBAAA,CAAA,CAAA,CAAA,CAHKK,UAAU,CAAAF,sB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,OAAO,CACLL,KAAK,CAALA,KAAK,CACLiB,GAAG,CAAE,CAAEb,UAAU,CAAVA,UAAW,CAAC,CACnBS,UAAU,CAAAC,MAAA,CAAAC,MAAA,EACRG,GAAG,CAAEvC,QAAQ,CACbH,QAAQ,CAAEmB,cAAc,CACxBwB,IAAI,CAAE,OAAO,CACb1C,IAAI,CAAJA,IAAI,CACJC,KAAK,CAALA,KAAK,CACLqB,OAAO,CAAEN,UAAU,CACnBkB,QAAQ,CAAEtC,UAAU,CACpBmC,QAAQ,CAAElC,UAAU,EACjB+B,kBAAkB,CAEzB,CAAC,CACH;;;;"}
1
+ {"version":3,"file":"useRadio.js","sources":["../../../../../src/components/Radio/useRadio.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/explicit-function-return-type */\n/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\nimport React from 'react';\nimport type { GestureResponderEvent } from 'react-native';\nimport { useControllableState } from '~utils/useControllable';\nimport { useId } from '~utils/useId';\nimport { getPlatformType } from '~src/utils';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { throwBladeError } from '~utils/logger';\n\nexport type OnChange = ({\n isChecked,\n event,\n value,\n}: {\n isChecked: boolean;\n event: React.ChangeEvent;\n value?: string;\n}) => void;\n\ntype UseRadioProps = {\n hasError?: boolean;\n /**\n * If `true`, The Radio will be checked. This also makes the Radio controlled\n * Use `onChange` to update its value\n *\n * @default false\n */\n isChecked?: boolean;\n /**\n * If `true`, the Radio will be initially checked. This also makes the Radio uncontrolled\n *\n * @default false\n */\n defaultChecked?: boolean;\n /**\n * The callback invoked when the checked state of the `Radio` changes.\n */\n onChange?: OnChange;\n /**\n * The name of the input field in a Radio\n * (Useful for form submission).\n */\n name?: string;\n /**\n * The value to be used in the Radio input.\n * This is the value that will be returned on form submission.\n */\n value?: string;\n /**\n * If `true`, the Radio will be disabled\n *\n * @default false\n */\n isDisabled?: boolean;\n /**\n * If `true`, the Radio input is marked as required,\n * and `required` attribute will be added\n *\n * @default false\n */\n isRequired?: boolean;\n};\n\nconst useRadio = ({\n isChecked,\n defaultChecked,\n isDisabled,\n isRequired,\n hasError,\n onChange,\n name,\n value,\n}: UseRadioProps) => {\n const inputRef = React.useRef<HTMLInputElement>(null);\n\n const isReactNative = getPlatformType() === 'react-native';\n if (__DEV__) {\n if (isChecked && defaultChecked) {\n throwBladeError({\n message: `Do not provide both 'isChecked' and 'defaultChecked' to useRadio. Consider if you want this component to be controlled or uncontrolled.`,\n moduleName: 'Radio',\n });\n }\n }\n\n const [radioState, setRadioState] = useControllableState({\n value: isChecked,\n defaultValue: defaultChecked ?? false,\n });\n\n const handleOnChange = (event: React.ChangeEvent<HTMLInputElement> | GestureResponderEvent) => {\n if (isDisabled) {\n event.stopPropagation();\n event.preventDefault();\n return;\n }\n\n setRadioState((checked) => {\n // Prevent radio to be unchecked when clicked again\n // Once checked radios don't act as toggle buttons\n if (checked === false) {\n onChange?.({\n isChecked: true,\n event: event as React.ChangeEvent,\n value,\n });\n return true;\n }\n return checked;\n });\n };\n\n const state = {\n isChecked: radioState,\n setChecked: setRadioState,\n };\n\n const idBase = useId('radio');\n const helpTextId = useId(`${idBase}-helptext`);\n\n const accessibilityProps = makeAccessible({\n role: 'radio',\n required: Boolean(isRequired),\n invalid: Boolean(hasError),\n disabled: Boolean(isDisabled),\n checked: radioState,\n describedBy: helpTextId,\n });\n\n if (isReactNative) {\n return {\n state,\n inputProps: {\n onPress: handleOnChange,\n name,\n value,\n ...accessibilityProps,\n },\n };\n }\n\n return {\n state,\n ids: { helpTextId },\n inputProps: {\n ref: inputRef,\n onChange: handleOnChange,\n type: 'radio',\n name,\n value,\n checked: radioState,\n disabled: isDisabled,\n required: isRequired,\n ...accessibilityProps,\n },\n };\n};\n\nexport type InputProps = ReturnType<typeof useRadio>['inputProps'];\n\nexport { useRadio };\n"],"names":["useRadio","_ref","isChecked","defaultChecked","isDisabled","isRequired","hasError","onChange","name","value","inputRef","React","useRef","isReactNative","getPlatformType","__DEV__","throwBladeError","message","moduleName","_useControllableState","useControllableState","defaultValue","_useControllableState2","_slicedToArray","radioState","setRadioState","handleOnChange","event","stopPropagation","preventDefault","checked","state","setChecked","idBase","useId","helpTextId","accessibilityProps","makeAccessible","role","required","Boolean","invalid","disabled","describedBy","inputProps","Object","assign","onPress","ids","ref","type"],"mappings":";;;;;;;;;;AAgEM,IAAAA,QAAQ,CAAG,SAAXA,QAAQA,CAAAC,IAAA,CASO,CARnB,IAAAC,SAAS,CAAAD,IAAA,CAATC,SAAS,CACTC,cAAc,CAAAF,IAAA,CAAdE,cAAc,CACdC,UAAU,CAAAH,IAAA,CAAVG,UAAU,CACVC,UAAU,CAAAJ,IAAA,CAAVI,UAAU,CACVC,QAAQ,CAAAL,IAAA,CAARK,QAAQ,CACRC,QAAQ,CAAAN,IAAA,CAARM,QAAQ,CACRC,IAAI,CAAAP,IAAA,CAAJO,IAAI,CACJC,KAAK,CAAAR,IAAA,CAALQ,KAAK,CAEL,IAAMC,QAAQ,CAAGC,cAAK,CAACC,MAAM,CAAmB,IAAI,CAAC,CAErD,IAAMC,aAAa,CAAGC,eAAe,EAAE,GAAK,cAAc,CAC1D,GAAIC,OAAO,CAAE,CACX,GAAIb,SAAS,EAAIC,cAAc,CAAE,CAC/Ba,eAAe,CAAC,CACdC,OAAO,CAAG,CAAA,uIAAA,CAAwI,CAClJC,UAAU,CAAE,OACd,CAAC,CAAC,CACJ,CACF,CAEA,IAAAC,qBAAA,CAAoCC,oBAAoB,CAAC,CACvDX,KAAK,CAAEP,SAAS,CAChBmB,YAAY,CAAElB,cAAc,OAAdA,cAAc,CAAI,KAClC,CAAC,CAAC,CAAAmB,sBAAA,CAAAC,cAAA,CAAAJ,qBAAA,CAAA,CAAA,CAAA,CAHKK,UAAU,CAAAF,sBAAA,IAAEG,aAAa,CAAAH,sBAAA,CAKhC,CAAA,CAAA,CAAA,IAAMI,cAAc,CAAG,SAAjBA,cAAcA,CAAIC,KAAkE,CAAK,CAC7F,GAAIvB,UAAU,CAA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EvC,QAAQ,CACbH,QAAQ,CAAEmB,cAAc,CACxBwB,IAAI,CAAE,OAAO,CACb1C,IAAI,CAAJA,IAAI,CACJC,KAAK,CAALA,KAAK,CACLqB,OAAO,CAAEN,UAAU,CACnBkB,QAAQ,CAAEtC,UAAU,CACpBmC,QAAQ,CAAElC,UAAU,EACjB+B,kBAAkB,CAEzB,CAAC,CACH;;;;"}
@@ -2,7 +2,7 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
2
2
  import * as React from 'react';
3
3
  import { useCallbackRef } from './useCallbackRef.js';
4
4
 
5
- function useControllableState(props){var valueProp=props.value,defaultValue=props.defaultValue,onChange=props.onChange,_props$shouldUpdate=props.shouldUpdate,shouldUpdate=_props$shouldUpdate===void 0?function(prev,next){return prev!==next;}:_props$shouldUpdate;var onChangeProp=useCallbackRef(onChange);var shouldUpdateProp=useCallbackRef(shouldUpdate);var _React$useState=React.useState(defaultValue),_React$useState2=_slicedToArray(_React$useState,2),valueState=_React$useState2[0],setValue=_React$useState2[1];var _React$useRef=React.useRef(valueProp!==undefined),isControlled=_React$useRef.current;var value=isControlled&&typeof valueProp!=='undefined'?valueProp:valueState;var updateValue=useCallbackRef(function(next){var skipUpdate=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var nextValue=next(value);if(!isControlled)setValue(nextValue);if(!shouldUpdateProp(value,nextValue))return;if(skipUpdate)return;onChangeProp==null?void 0:onChangeProp(nextValue);},[isControlled,onChangeProp,value,shouldUpdateProp]);return [value,updateValue];}
5
+ function useControllableState(props){var valueProp=props.value,defaultValue=props.defaultValue,onChange=props.onChange,_props$shouldUpdate=props.shouldUpdate,shouldUpdate=_props$shouldUpdate===void 0?function(prev,next){return prev!==next;}:_props$shouldUpdate;var onChangeProp=useCallbackRef(onChange);var shouldUpdateProp=useCallbackRef(shouldUpdate);var _React$useState=React.useState(defaultValue),_React$useState2=_slicedToArray(_React$useState,2),valueState=_React$useState2[0],setValue=_React$useState2[1];var _React$useRef=React.useRef(valueProp!==undefined),isControlled=_React$useRef.current;var value=isControlled&&typeof valueProp!=='undefined'?valueProp:valueState;var updateValue=useCallbackRef(function(next){var skipUpdate=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var extraData=arguments.length>2?arguments[2]:undefined;var nextValue=next(value);if(!isControlled)setValue(nextValue);if(!shouldUpdateProp(value,nextValue))return;if(skipUpdate)return;onChangeProp==null?void 0:onChangeProp(nextValue,extraData);},[isControlled,onChangeProp,value,shouldUpdateProp]);return [value,updateValue];}
6
6
 
7
7
  export { useControllableState };
8
8
  //# sourceMappingURL=useControllable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useControllable.js","sources":["../../../../src/utils/useControllable.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n/* eslint-disable @typescript-eslint/explicit-function-return-type */\n/* eslint-disable react-hooks/exhaustive-deps */\nimport * as React from 'react';\nimport { useCallbackRef } from './useCallbackRef';\n\ntype ControllableStateSetter<T> = (\n /**\n * Sets the state to the given value\n */\n next: (prevState: T) => T,\n /**\n * If `true`, `onChange` won't be called\n */\n skipUpdate?: boolean,\n) => void;\n\ntype UseControllableStateProps<T> = {\n /**\n * The value to used in controlled mode\n */\n value?: T;\n /**\n * The initial value to be used, in uncontrolled mode\n */\n defaultValue?: T | (() => T);\n /**\n * The callback fired when the value changes\n */\n onChange?: (value: T) => void;\n shouldUpdate?: (prev: T, next: T) => boolean;\n};\n\n/**\n * React hook for using controlling component state.\n *\n * It automatically handles controlled and uncontrolled state,\n * while internally giving us the state value so that we can react to the changes.\n *\n * @example\n * In checkbox we want to internally track the checked state to be able to render the correct Icon\n * but also want to provide controlled and uncontrolled behavior to user\n */\nfunction useControllableState<T>(props: UseControllableStateProps<T>) {\n const {\n value: valueProp,\n defaultValue,\n onChange,\n shouldUpdate = (prev, next) => prev !== next,\n } = props;\n\n const onChangeProp = useCallbackRef(onChange);\n const shouldUpdateProp = useCallbackRef(shouldUpdate);\n\n const [valueState, setValue] = React.useState(defaultValue as T);\n const { current: isControlled } = React.useRef(valueProp !== undefined);\n const value = isControlled && typeof valueProp !== 'undefined' ? valueProp : valueState;\n\n const updateValue: ControllableStateSetter<T> = useCallbackRef(\n (next, skipUpdate = false) => {\n const nextValue = next(value);\n if (!isControlled) setValue(nextValue);\n // We don't want to call onChange if skipUpdate is true or if the value is not changed\n if (!shouldUpdateProp(value, nextValue)) return;\n if (skipUpdate) return;\n onChangeProp?.(nextValue);\n },\n [isControlled, onChangeProp, value, shouldUpdateProp],\n );\n\n return [value, updateValue] as [T, ControllableStateSetter<T>];\n}\n\nexport { useControllableState };\nexport type { ControllableStateSetter };\n"],"names":["useControllableState","props","valueProp","value","defaultValue","onChange","_props$shouldUpdate","shouldUpdate","prev","next","onChangeProp","useCallbackRef","shouldUpdateProp","_React$useState","React","useState","_React$useState2","_slicedToArray","valueState","setValue","_React$useRef","useRef","undefined","isControlled","current","updateValue","skipUpdate","arguments","length","nextValue"],"mappings":";;;;AA2CA,SAASA,oBAAoBA,CAAIC,KAAmC,CAAE,CACpE,IACSC,SAAS,CAIdD,KAAK,CAJPE,KAAK,CACLC,YAAY,CAGVH,KAAK,CAHPG,YAAY,CACZC,QAAQ,CAENJ,KAAK,CAFPI,QAAQ,CAAAC,mBAAA,CAENL,KAAK,CADPM,YAAY,CAAZA,YAAY,CAAAD,mBAAA,GAAG,KAAA,CAAA,CAAA,SAACE,IAAI,CAAEC,IAAI,CAAK,CAAA,OAAAD,IAAI,GAAKC,IAAI,CAAAH,CAAAA,CAAAA,mBAAA,CAG9C,IAAMI,YAAY,CAAGC,cAAc,CAACN,QAAQ,CAAC,CAC7C,IAAMO,gBAAgB,CAAGD,cAAc,CAACJ,YAAY,CAAC,CAErD,IAAAM,eAAA,CAA+BC,KAAK,CAACC,QAAQ,CAACX,YAAiB,CAAC,CAAAY,gBAAA,CAAAC,cAAA,CAAAJ,eAAA,CAAA,CAAA,CAAA,CAAzDK,UAAU,CAAAF,gBAAA,CAAA,CAAA,CAAA,CAAEG,QAAQ,CAAAH,gBAAA,CAC3B,CAAA,CAAA,CAAA,IAAAI,aAAA,CAAkCN,KAAK,CAACO,MAAM,CAACnB,SAAS,GAAKoB,SAAS,CAAC,CAAtDC,YAAY,CAAAH,aAAA,CAArBI,OAAO,CACf,IAAMrB,KAAK,CAAGoB,YAAY,EAAI,OAAOrB,SAAS,GAAK,WAAW,CAAGA,SAAS,CAAGgB,UAAU,CAEvF,IAAMO,WAAuC,CAAGd,cAAc,CAC5D,SAACF,IAAI,CAAyB,CAAvB,IAAAiB,UAAU,CAAAC,SAAA,CAAAC,MAAA,CAAAD,CAAAA,EAAAA,SAAA,MAAAL,SAAA,CAAAK,SAAA,CAAA,CAAA,CAAA,CAAG,KAAK,CACvB,IAAME,SAAS,CAAGpB,IAAI,CAACN,KAAK,CAAC,CAC7B,GAAI,CAACoB,YAAY,CAAEJ,QAAQ,CAACU,SAAS,CAAC,CAEtC,GAAI,CAACjB,gBAAgB,CAACT,KAAK,CAAE0B,SAAS,CAAC,CAAE,OACzC,GAAIH,UAAU,CAAE,OAChBhB,YAAY,EAAZA,IAAAA,CAAAA,KAAAA,CAAAA,CAAAA,YAAY,CAAGmB,SAAS,CAAC,CAC3B,CAAC,CACD,CAACN,YAAY,CAAEb,YAAY,CAAEP,KAAK,CAAES,gBAAgB,CACtD,CAAC,CAED,OAAO,CAACT,KAAK,CAAEsB,WAAW,CAAC,CAC7B;;;;"}
1
+ {"version":3,"file":"useControllable.js","sources":["../../../../src/utils/useControllable.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n/* eslint-disable @typescript-eslint/explicit-function-return-type */\n/* eslint-disable react-hooks/exhaustive-deps */\nimport * as React from 'react';\nimport { useCallbackRef } from './useCallbackRef';\n\ntype ControllableStateSetter<T> = (\n /**\n * Sets the state to the given value\n */\n next: (prevState: T) => T,\n /**\n * If `true`, `onChange` won't be called\n */\n skipUpdate?: boolean,\n /**\n * Extra data to be passed to `onChange` callback\n * Example use case: passing event object to `onChange` callback\n */\n extraData?: any,\n) => void;\n\ntype UseControllableStateProps<T> = {\n /**\n * The value to used in controlled mode\n */\n value?: T;\n /**\n * The initial value to be used, in uncontrolled mode\n */\n defaultValue?: T | (() => T);\n /**\n * The callback fired when the value changes\n */\n onChange?: (value: T, extraData: any) => void;\n shouldUpdate?: (prev: T, next: T) => boolean;\n};\n\n/**\n * React hook for using controlling component state.\n *\n * It automatically handles controlled and uncontrolled state,\n * while internally giving us the state value so that we can react to the changes.\n *\n * @example\n * In checkbox we want to internally track the checked state to be able to render the correct Icon\n * but also want to provide controlled and uncontrolled behavior to user\n */\nfunction useControllableState<T>(props: UseControllableStateProps<T>) {\n const {\n value: valueProp,\n defaultValue,\n onChange,\n shouldUpdate = (prev, next) => prev !== next,\n } = props;\n\n const onChangeProp = useCallbackRef(onChange);\n const shouldUpdateProp = useCallbackRef(shouldUpdate);\n\n const [valueState, setValue] = React.useState(defaultValue as T);\n const { current: isControlled } = React.useRef(valueProp !== undefined);\n const value = isControlled && typeof valueProp !== 'undefined' ? valueProp : valueState;\n\n const updateValue: ControllableStateSetter<T> = useCallbackRef(\n (next, skipUpdate = false, extraData) => {\n const nextValue = next(value);\n if (!isControlled) setValue(nextValue);\n // We don't want to call onChange if skipUpdate is true or if the value is not changed\n if (!shouldUpdateProp(value, nextValue)) return;\n if (skipUpdate) return;\n onChangeProp?.(nextValue, extraData);\n },\n [isControlled, onChangeProp, value, shouldUpdateProp],\n );\n\n return [value, updateValue] as [T, ControllableStateSetter<T>];\n}\n\nexport { useControllableState };\nexport type { ControllableStateSetter };\n"],"names":["useControllableState","props","valueProp","value","defaultValue","onChange","_props$shouldUpdate","shouldUpdate","prev","next","onChangeProp","useCallbackRef","shouldUpdateProp","_React$useState","React","useState","_React$useState2","_slicedToArray","valueState","setValue","_React$useRef","useRef","undefined","isControlled","current","updateValue","skipUpdate","arguments","length","extraData","nextValue"],"mappings":";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C,IAAMQ,SAAS,CAAGrB,IAAI,CAACN,KAAK,CAAC,CAC7B,GAAI,CAACoB,YAAY,CAAEJ,QAAQ,CAACW,SAAS,CAAC,CAEtC,GAAI,CAAClB,gBAAgB,CAACT,KAAK,CAAE2B,SAAS,CAAC,CAAE,OACzC,GAAIJ,UAAU,CAAE,OAChBhB,YAAY,EAAZA,IAAAA,CAAAA,KAAAA,CAAAA,CAAAA,YAAY,CAAGoB,SAAS,CAAED,SAAS,CAAC,CACtC,CAAC,CACD,CAACN,YAAY,CAAEb,YAAY,CAAEP,KAAK,CAAES,gBAAgB,CACtD,CAAC,CAED,OAAO,CAACT,KAAK,CAAEsB,WAAW,CAAC,CAC7B;;;;"}
@@ -5,7 +5,7 @@ import React__default from 'react';
5
5
  import styled from 'styled-components';
6
6
  import { useDrag, rubberbandIfOutOfBounds } from '@use-gesture/react';
7
7
  import usePresence from 'use-presence';
8
- import { clearAllBodyScrollLocks } from 'body-scroll-lock-upgrade';
8
+ import { clearAllBodyScrollLocks, enableBodyScroll } from 'body-scroll-lock-upgrade';
9
9
  export { BottomSheetHeader } from './BottomSheetHeader.web.js';
10
10
  export { BottomSheetFooter } from './BottomSheetFooter.web.js';
11
11
  export { BottomSheetBody } from './BottomSheetBody.web.js';
@@ -429,6 +429,22 @@ var _BottomSheet = function _BottomSheet(_ref2) {
429
429
  }
430
430
  }, [addBottomSheetToStack, id, isMounted, removeBottomSheetFromStack]);
431
431
 
432
+ // Remove the bottomsheet from the stack, if it's unmounted forcefully
433
+ React__default.useEffect(function () {
434
+ return function () {
435
+ if (id === undefined) return;
436
+ removeBottomSheetFromStack(id);
437
+ };
438
+ }, [id, removeBottomSheetFromStack]);
439
+
440
+ // Disable body scroll lock when the component is unmounted forcefully
441
+ React__default.useEffect(function () {
442
+ var lockTarget = scrollRef.current;
443
+ return function () {
444
+ enableBodyScroll(lockTarget);
445
+ };
446
+ }, []);
447
+
432
448
  // We will need to reset these values otherwise the next time the bottomsheet opens
433
449
  // this will be populated and the animations won't run
434
450
  // why?: because how the usePresence hook works, we actually just unmount the
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheet.web.js","sources":["../../../../../../src/components/BottomSheet/BottomSheet.web.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable react/jsx-no-useless-fragment */\n/* eslint-disable consistent-return */\n/* eslint-disable @typescript-eslint/explicit-function-return-type */\nimport React from 'react';\nimport styled from 'styled-components';\nimport { rubberbandIfOutOfBounds, useDrag } from '@use-gesture/react';\nimport usePresence from 'use-presence';\nimport { clearAllBodyScrollLocks } from 'body-scroll-lock-upgrade';\nimport { BottomSheetHeader } from './BottomSheetHeader';\nimport { BottomSheetFooter } from './BottomSheetFooter';\nimport { BottomSheetBody } from './BottomSheetBody';\nimport type { SnapPoints } from './utils';\nimport { computeMaxContent, computeSnapPointBounds } from './utils';\nimport { BottomSheetBackdrop } from './BottomSheetBackdrop';\nimport type { BottomSheetContextProps } from './BottomSheetContext';\nimport { BottomSheetContext, useBottomSheetAndDropdownGlue } from './BottomSheetContext';\nimport { ComponentIds } from './componentIds';\nimport type { BottomSheetProps } from './types';\nimport { BottomSheetGrabHandle } from './BottomSheetGrabHandle';\nimport { useBottomSheetStack } from './BottomSheetStack';\nimport BaseBox from '~components/Box/BaseBox';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { useScrollLock } from '~utils/useScrollLock';\nimport { useWindowSize } from '~utils/useWindowSize';\nimport { useIsomorphicLayoutEffect } from '~utils/useIsomorphicLayoutEffect';\nimport { useTheme } from '~components/BladeProvider';\nimport { useId } from '~utils/useId';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeSize } from '~utils/makeSize';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { size } from '~tokens/global';\nimport { makeMotionTime } from '~utils/makeMotionTime';\nimport { componentZIndices } from '~utils/componentZIndices';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\nexport const BOTTOM_SHEET_EASING = 'cubic-bezier(.15,0,.24,.97)';\nconst AUTOCOMPLETE_DEFAULT_SNAPPOINT = 0.85;\n\nconst BottomSheetSurface = styled.div<{\n windowHeight: number;\n isDragging: boolean;\n}>(({ theme, windowHeight, isDragging }) => {\n return {\n background: theme.colors.popup.background.subtle,\n borderTopLeftRadius: makeSize(size[16]),\n borderTopRightRadius: makeSize(size[16]),\n borderColor: theme.colors.popup.border.subtle,\n // this is reverse top elevation of highRaised elevation token\n boxShadow: '0px -24px 48px -12px hsla(217, 56%, 17%, 0.18)',\n opacity: 0,\n pointerEvents: 'none',\n transitionDuration: isDragging\n ? undefined\n : `${makeMotionTime(theme.motion.duration.moderate)}`,\n transitionTimingFunction: BOTTOM_SHEET_EASING,\n willChange: 'transform, opacity, height',\n transitionProperty: 'transform, opacity, height',\n position: 'fixed',\n left: 0,\n right: 0,\n bottom: 0,\n top: windowHeight,\n backgroundColor: theme.colors.popup.background.subtle,\n justifyContent: 'center',\n alignItems: 'center',\n touchAction: 'none',\n overflow: 'hidden',\n };\n});\n\nconst _BottomSheet = ({\n isOpen,\n onDismiss,\n children,\n initialFocusRef,\n snapPoints = [0.35, 0.5, 0.85],\n zIndex = componentZIndices.bottomSheet,\n ...dataAnalyticsProps\n}: BottomSheetProps): React.ReactElement => {\n const { theme } = useTheme();\n const dimensions = useWindowSize();\n const [contentHeight, setContentHeight] = React.useState(0);\n const [headerHeight, setHeaderHeight] = React.useState(0);\n const [footerHeight, setFooterHeight] = React.useState(0);\n const [grabHandleHeight, setGrabHandleHeight] = React.useState(0);\n const [hasBodyPadding, setHasBodyPadding] = React.useState(true);\n const [isHeaderEmpty, setIsHeaderEmpty] = React.useState(false);\n\n const bottomSheetAndDropdownGlue = useBottomSheetAndDropdownGlue();\n const [positionY, _setPositionY] = React.useState(0);\n const _isOpen = isOpen ?? bottomSheetAndDropdownGlue?.isOpen;\n const [isDragging, setIsDragging] = React.useState(false);\n\n const preventScrollingRef = React.useRef(true);\n const scrollRef = React.useRef<HTMLDivElement>(null);\n const grabHandleRef = React.useRef<HTMLDivElement>(null);\n const defaultInitialFocusRef = React.useRef<any>(null);\n const originalFocusElement = React.useRef<HTMLElement | null>(null);\n const initialSnapPoint = React.useRef<number>(snapPoints[1]);\n const totalHeight = React.useMemo(() => {\n return grabHandleHeight + headerHeight + footerHeight + contentHeight;\n }, [contentHeight, footerHeight, grabHandleHeight, headerHeight]);\n\n const id = useId();\n const {\n stack,\n addBottomSheetToStack,\n removeBottomSheetFromStack,\n getTopOfTheStack,\n getCurrentStackIndexById,\n } = useBottomSheetStack();\n const currentStackIndex = getCurrentStackIndexById(id);\n const isOnTopOfStack = getTopOfTheStack() === id;\n const bottomSheetZIndex = zIndex - currentStackIndex;\n\n const setPositionY = React.useCallback(\n (value: number, limit = true) => {\n // In AutoComplete, we want BottomSheet to be docked to top snappoint so we remove the limits\n const shouldLimitPositionY =\n limit && !bottomSheetAndDropdownGlue?.hasAutoCompleteInBottomSheetHeader;\n\n const maxValue = computeMaxContent({\n contentHeight,\n footerHeight,\n headerHeight: headerHeight + grabHandleHeight,\n maxHeight: value,\n });\n _setPositionY(shouldLimitPositionY ? maxValue : value);\n },\n [\n bottomSheetAndDropdownGlue?.hasAutoCompleteInBottomSheetHeader,\n contentHeight,\n footerHeight,\n grabHandleHeight,\n headerHeight,\n ],\n );\n\n // locks the body scroll to prevent accidental scrolling of content when we drag the sheet\n // We are ready when we calculated the height of the content\n const isReady = contentHeight > 0;\n // only lock the body when we atleast have 1 bottomsheet open\n const shouldLock = isReady && stack.length > 0;\n const scrollLockRef = useScrollLock({\n enabled: shouldLock,\n targetRef: scrollRef,\n reserveScrollBarGap: true,\n });\n\n // clear all body locks to avoid memory leaks & accidental body locking\n React.useEffect(() => {\n const hasNoBottomSheets = stack.length < 1;\n if (hasNoBottomSheets) {\n clearAllBodyScrollLocks();\n }\n }, [stack]);\n\n // take the grabHandle's height into headerHeight too\n useIsomorphicLayoutEffect(() => {\n if (!grabHandleRef.current) return;\n setGrabHandleHeight(grabHandleRef.current.getBoundingClientRect().height);\n }, [grabHandleRef.current, _isOpen]);\n\n // if bottomSheet height is >35% & <50% then set initial snapPoint to 35%\n useIsomorphicLayoutEffect(() => {\n if (bottomSheetAndDropdownGlue?.hasAutoCompleteInBottomSheetHeader) {\n initialSnapPoint.current = AUTOCOMPLETE_DEFAULT_SNAPPOINT;\n } else {\n const middleSnapPoint = snapPoints[1] * dimensions.height;\n const lowerSnapPoint = snapPoints[0] * dimensions.height;\n if (totalHeight > lowerSnapPoint && totalHeight < middleSnapPoint) {\n initialSnapPoint.current = snapPoints[0];\n }\n }\n }, [dimensions.height, snapPoints, totalHeight]);\n\n const returnFocus = React.useCallback(() => {\n if (!originalFocusElement.current) return;\n originalFocusElement.current.focus();\n // After returning focus we will clear the original focus\n // Because if sheet can be opened up via multiple triggers\n // We want to ensure the focus returns back to the most recent triggerer\n originalFocusElement.current = null;\n }, [originalFocusElement]);\n\n const focusOnInitialRef = React.useCallback(() => {\n if (!initialFocusRef) {\n // focus on close button\n defaultInitialFocusRef.current?.focus();\n } else {\n // focus on the initialRef passed by the user\n initialFocusRef.current?.focus();\n }\n }, [initialFocusRef]);\n\n // focus on the initial ref when the sheet is opened\n React.useLayoutEffect(() => {\n if (_isOpen) {\n focusOnInitialRef();\n }\n }, [_isOpen, focusOnInitialRef]);\n\n const handleOnOpen = React.useCallback(() => {\n setPositionY(dimensions.height * initialSnapPoint.current);\n scrollLockRef.current.activate();\n // initialize the original focused element\n // On first render it will be the activeElement, eg: the button trigger or select input\n // On Subsequent open operations it won't further update the original focus\n originalFocusElement.current =\n originalFocusElement.current ?? (document.activeElement as HTMLElement);\n }, [dimensions.height, scrollLockRef, setPositionY]);\n\n const handleOnClose = React.useCallback(() => {\n setPositionY(0);\n }, [setPositionY]);\n\n const close = React.useCallback(() => {\n onDismiss?.();\n bottomSheetAndDropdownGlue?.onBottomSheetDismiss();\n returnFocus();\n }, [bottomSheetAndDropdownGlue, onDismiss, returnFocus]);\n\n // sync controlled state to our actions\n React.useEffect(() => {\n if (_isOpen) {\n // open on the next frame, otherwise the animations will not run on first render\n window.setTimeout(() => {\n handleOnOpen();\n });\n } else {\n handleOnClose();\n }\n }, [_isOpen, handleOnClose, handleOnOpen]);\n\n // let the Dropdown component know that it's rendering a bottomsheet\n React.useEffect(() => {\n if (!bottomSheetAndDropdownGlue) return;\n bottomSheetAndDropdownGlue.setDropdownHasBottomSheet(true);\n }, [bottomSheetAndDropdownGlue]);\n\n const bind = useDrag(\n ({\n active,\n last,\n cancel,\n tap,\n movement: [_movementX, movementY],\n velocity: [_velocityX, velocityY],\n lastOffset: [_, lastOffsetY],\n down,\n dragging,\n args: [{ isContentDragging = false } = {}] = [],\n }) => {\n setIsDragging(Boolean(dragging));\n // lastOffsetY is the previous position user stopped dragging the sheet\n // movementY is the drag amount from the bottom of the screen, so as you drag up the movementY goes into negatives\n // and rawY is the calculated offset from the last position of the bottomsheet to current drag amount.\n const rawY = lastOffsetY - movementY;\n\n const lowerSnapPoint = dimensions.height * snapPoints[0];\n const upperSnapPoint = dimensions.height * snapPoints[snapPoints.length - 1];\n\n // predictedY is used to create velocity driven swipe\n // the faster you swipe the more distance you cover\n // this enables users to reach upper & lower snappoint with a single swipe\n const predictedDistance = movementY * (velocityY / 2);\n const predictedY = Math.max(\n lowerSnapPoint,\n Math.min(upperSnapPoint, rawY - predictedDistance * 2),\n );\n\n let newY = rawY;\n\n if (down) {\n // Ensure that users aren't able to drag the sheet\n // more than the upperSnapPoint or maximum height of the sheet\n // this is basically a clamp() function but creates a nice rubberband effect\n const dampening = 0.55;\n if (totalHeight < upperSnapPoint) {\n newY = rubberbandIfOutOfBounds(rawY, 0, totalHeight, dampening);\n } else {\n newY = rubberbandIfOutOfBounds(rawY, 0, upperSnapPoint, dampening);\n }\n } else {\n newY = predictedY;\n }\n\n const isPosAtUpperSnapPoint = newY >= upperSnapPoint;\n\n if (isContentDragging) {\n if (isPosAtUpperSnapPoint) {\n newY = upperSnapPoint;\n }\n\n // keep the newY at upper snap point\n // until the scrollable content is not at top\n // and previously saved Y position is greater than or equal to upper snap point\n // Note: how using newY won't work here since we need the previous value of the newY\n // since we always keep updating the newY,\n // this is cruicial in making the scroll feel natural\n const isContentScrolledAtTop = scrollRef.current && scrollRef.current.scrollTop <= 0;\n if (lastOffsetY === upperSnapPoint && !isContentScrolledAtTop) {\n newY = upperSnapPoint;\n }\n preventScrollingRef.current = newY < upperSnapPoint;\n }\n\n if (last) {\n // calculate the nearest snapPoint\n const [nearest, lower] = computeSnapPointBounds(\n newY,\n snapPoints.map((point) => dimensions.height * point) as SnapPoints,\n );\n\n // This ensure that the lower snapPoint will always have atleast some buffer\n // When the bottomsheet total height is less than the lower snapPoint\n // Video walkthrough: https://www.loom.com/share/a9a8db7688d64194b13df8b3e25859ae\n const lowerPointBuffer = 60;\n const lowerestSnap = Math.min(lower, totalHeight) - lowerPointBuffer;\n\n const shouldClose = rawY < lowerestSnap;\n if (shouldClose) {\n setIsDragging(false);\n cancel();\n close();\n return;\n }\n\n // if we stop dragging assign snap to the nearest point\n if (!active && !tap) {\n newY = nearest;\n }\n }\n\n setPositionY(newY, !down);\n },\n {\n from: [0, positionY],\n filterTaps: true,\n enabled: isOnTopOfStack && _isOpen,\n },\n );\n\n // Here we are preventing the scrolling of the content, until the preventScrollingRef value is true\n useIsomorphicLayoutEffect(() => {\n const scrollElement = scrollRef.current;\n if (!scrollElement) return;\n\n const preventScrolling = (e: Event) => {\n if (preventScrollingRef?.current) {\n e.preventDefault();\n }\n };\n\n // https://www.bram.us/2016/05/02/prevent-overscroll-bounce-in-ios-mobilesafari-pure-css/\n const preventSafariOverscroll = (e: Event) => {\n if (scrollElement.scrollTop < 0) {\n // TODO: figure this out, it doesn't seem to work >iOS12\n // requestAnimationFrame(() => {\n // elem.style.overflow = 'hidden';\n // elem.scrollTop = 0;\n // elem.style.removeProperty('overflow');\n // });\n e.preventDefault();\n }\n };\n\n scrollElement.addEventListener('scroll', preventScrolling);\n scrollElement.addEventListener('touchmove', preventScrolling);\n scrollElement.addEventListener('touchstart', preventSafariOverscroll);\n return () => {\n scrollElement.removeEventListener('scroll', preventScrolling);\n scrollElement.removeEventListener('touchmove', preventScrolling);\n scrollElement.removeEventListener('touchstart', preventSafariOverscroll);\n };\n // Only run this hook when we know all the layout calculations are done,\n // Otherwise the scrollRef.current will be null.\n // isReady prop will ensure that we are done measuring the content height\n }, [isReady]);\n\n // usePresence hook waits for the animation to finish before unmounting the component\n // It's similar to motion/react's usePresence hook\n // https://www.framer.com/docs/animate-presence/#usepresence\n const { isMounted, isVisible } = usePresence(Boolean(_isOpen), {\n transitionDuration: theme.motion.duration.moderate,\n });\n\n const isHeaderFloating = !hasBodyPadding && isHeaderEmpty;\n const contextValue: BottomSheetContextProps = React.useMemo(\n () => ({\n isInBottomSheet: true,\n isOpen: Boolean(isVisible),\n close,\n positionY,\n headerHeight,\n contentHeight,\n footerHeight,\n setContentHeight,\n setFooterHeight,\n setHeaderHeight,\n setHasBodyPadding,\n setIsHeaderEmpty,\n scrollRef,\n bind,\n defaultInitialFocusRef,\n isHeaderFloating,\n }),\n [\n isVisible,\n close,\n positionY,\n headerHeight,\n contentHeight,\n footerHeight,\n setContentHeight,\n setFooterHeight,\n setHeaderHeight,\n setHasBodyPadding,\n setIsHeaderEmpty,\n scrollRef,\n bind,\n defaultInitialFocusRef,\n isHeaderFloating,\n ],\n );\n\n React.useEffect(() => {\n if (isMounted) {\n addBottomSheetToStack(id);\n } else {\n removeBottomSheetFromStack(id);\n }\n }, [addBottomSheetToStack, id, isMounted, removeBottomSheetFromStack]);\n\n // We will need to reset these values otherwise the next time the bottomsheet opens\n // this will be populated and the animations won't run\n // why?: because how the usePresence hook works, we actually just unmount the\n // html contents not the whole <BottomSheet /> react component\n React.useEffect(() => {\n if (!isMounted) {\n setHeaderHeight(0);\n setFooterHeight(0);\n setContentHeight(0);\n setGrabHandleHeight(0);\n _setPositionY(0);\n }\n }, [isMounted, scrollLockRef]);\n\n // We don't want to destroy the react tree when we are rendering inside Dropdown\n // Because if we bail out early then ActionList won't render,\n // and Dropdown manages it's state based on the rendered JSX of ActionList\n // If we don't render ActionList Dropdown state will reset each time we open/close BottomSheet\n const isInsideDropdown = Boolean(bottomSheetAndDropdownGlue);\n if (!isMounted && !isInsideDropdown) {\n return <></>;\n }\n\n return (\n <BottomSheetContext.Provider value={contextValue}>\n <BottomSheetBackdrop zIndex={bottomSheetZIndex} />\n <BottomSheetSurface\n {...metaAttribute({\n name: MetaConstants.BottomSheet,\n testID: 'bottomsheet-surface',\n })}\n {...makeAccessible({ modal: true, role: 'dialog' })}\n windowHeight={dimensions.height}\n isDragging={isDragging}\n style={{\n opacity: isVisible ? 1 : 0,\n pointerEvents: isVisible ? 'all' : 'none',\n height: positionY,\n bottom: 0,\n top: 'auto',\n zIndex: bottomSheetZIndex,\n }}\n {...makeAnalyticsAttribute(dataAnalyticsProps)}\n >\n <BaseBox height=\"100%\" display=\"flex\" flexDirection=\"column\">\n <BottomSheetGrabHandle\n ref={grabHandleRef}\n isHeaderFloating={isHeaderFloating}\n {...metaAttribute({ name: ComponentIds.BottomSheetGrabHandle })}\n {...bind()}\n />\n {children}\n </BaseBox>\n </BottomSheetSurface>\n </BottomSheetContext.Provider>\n );\n};\n\nconst BottomSheet = assignWithoutSideEffects(_BottomSheet, {\n componentId: ComponentIds.BottomSheet,\n});\n\nexport { BottomSheet, BottomSheetBody, BottomSheetHeader, BottomSheetFooter };\nexport type { BottomSheetProps };\n"],"names":["BOTTOM_SHEET_EASING","AUTOCOMPLETE_DEFAULT_SNAPPOINT","BottomSheetSurface","styled","div","withConfig","displayName","componentId","_ref","theme","windowHeight","isDragging","background","colors","popup","subtle","borderTopLeftRadius","makeSize","size","borderTopRightRadius","borderColor","border","boxShadow","opacity","pointerEvents","transitionDuration","undefined","concat","makeMotionTime","motion","duration","moderate","transitionTimingFunction","willChange","transitionProperty","position","left","right","bottom","top","backgroundColor","justifyContent","alignItems","touchAction","overflow","_BottomSheet","_ref2","isOpen","onDismiss","children","initialFocusRef","_ref2$snapPoints","snapPoints","_ref2$zIndex","zIndex","componentZIndices","bottomSheet","dataAnalyticsProps","_objectWithoutProperties","_excluded","_useTheme","useTheme","dimensions","useWindowSize","_React$useState","React","useState","_React$useState2","_slicedToArray","contentHeight","setContentHeight","_React$useState3","_React$useState4","headerHeight","setHeaderHeight","_React$useState5","_React$useState6","footerHeight","setFooterHeight","_React$useState7","_React$useState8","grabHandleHeight","setGrabHandleHeight","_React$useState9","_React$useState10","hasBodyPadding","setHasBodyPadding","_React$useState11","_React$useState12","isHeaderEmpty","setIsHeaderEmpty","bottomSheetAndDropdownGlue","useBottomSheetAndDropdownGlue","_React$useState13","_React$useState14","positionY","_setPositionY","_isOpen","_React$useState15","_React$useState16","setIsDragging","preventScrollingRef","useRef","scrollRef","grabHandleRef","defaultInitialFocusRef","originalFocusElement","initialSnapPoint","totalHeight","useMemo","id","useId","_useBottomSheetStack","useBottomSheetStack","stack","addBottomSheetToStack","removeBottomSheetFromStack","getTopOfTheStack","getCurrentStackIndexById","currentStackIndex","isOnTopOfStack","bottomSheetZIndex","setPositionY","useCallback","value","limit","arguments","length","shouldLimitPositionY","hasAutoCompleteInBottomSheetHeader","maxValue","computeMaxContent","maxHeight","isReady","shouldLock","scrollLockRef","useScrollLock","enabled","targetRef","reserveScrollBarGap","useEffect","hasNoBottomSheets","clearAllBodyScrollLocks","useIsomorphicLayoutEffect","current","getBoundingClientRect","height","middleSnapPoint","lowerSnapPoint","returnFocus","focus","focusOnInitialRef","_defaultInitialFocusR","_initialFocusRef$curr","useLayoutEffect","handleOnOpen","_originalFocusElement","activate","document","activeElement","handleOnClose","close","onBottomSheetDismiss","window","setTimeout","setDropdownHasBottomSheet","bind","useDrag","_ref3","active","last","cancel","tap","_ref3$movement","movement","_movementX","movementY","_ref3$velocity","velocity","_velocityX","velocityY","_ref3$lastOffset","lastOffset","_","lastOffsetY","down","dragging","_ref3$args","args","_ref3$args2","_ref3$args3","_ref3$args3$","_ref3$args3$2","_ref3$args3$2$isConte","isContentDragging","Boolean","rawY","upperSnapPoint","predictedDistance","predictedY","Math","max","min","newY","dampening","rubberbandIfOutOfBounds","isPosAtUpperSnapPoint","isContentScrolledAtTop","scrollTop","_computeSnapPointBoun","computeSnapPointBounds","map","point","_computeSnapPointBoun2","nearest","lower","lowerPointBuffer","lowerestSnap","shouldClose","from","filterTaps","scrollElement","preventScrolling","e","preventDefault","preventSafariOverscroll","addEventListener","removeEventListener","_usePresence","usePresence","isMounted","isVisible","isHeaderFloating","contextValue","isInBottomSheet","isInsideDropdown","_jsx","_Fragment","_jsxs","BottomSheetContext","Provider","BottomSheetBackdrop","_objectSpread","metaAttribute","name","MetaConstants","BottomSheet","testID","makeAccessible","modal","role","style","makeAnalyticsAttribute","BaseBox","display","flexDirection","BottomSheetGrabHandle","ref","ComponentIds","assignWithoutSideEffects"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCO,IAAMA,mBAAmB,GAAG,8BAA6B;AAChE,IAAMC,8BAA8B,GAAG,IAAI,CAAA;AAE3C,IAAMC,kBAAkB,gBAAGC,MAAM,CAACC,GAAG,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,oCAAA;EAAAC,WAAA,EAAA,UAAA;AAAA,CAGlC,CAAA,CAAA,UAAAC,IAAA,EAAyC;AAAA,EAAA,IAAtCC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,YAAY,GAAAF,IAAA,CAAZE,YAAY;IAAEC,UAAU,GAAAH,IAAA,CAAVG,UAAU,CAAA;EACnC,OAAO;IACLC,UAAU,EAAEH,KAAK,CAACI,MAAM,CAACC,KAAK,CAACF,UAAU,CAACG,MAAM;AAChDC,IAAAA,mBAAmB,EAAEC,QAAQ,CAACC,IAAI,CAAC,EAAE,CAAC,CAAC;AACvCC,IAAAA,oBAAoB,EAAEF,QAAQ,CAACC,IAAI,CAAC,EAA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AE9C6L,IAAA,CAACe,OAAO,EAAA;AAAC3G,QAAAA,MAAM,EAAC,MAAM;AAAC4G,QAAAA,OAAO,EAAC,MAAM;AAACC,QAAAA,aAAa,EAAC,QAAQ;AAAA9M,QAAAA,QAAA,gBAC1D2L,GAAA,CAACoB,qBAAqB,EAAAd,aAAA,CAAAA,aAAA,CAAA;AACpBe,UAAAA,GAAG,EAAEzJ,aAAc;AACnBgI,UAAAA,gBAAgB,EAAEA,gBAAAA;AAAiB,SAAA,EAC/BW,aAAa,CAAC;UAAEC,IAAI,EAAEc,YAAY,CAACF,qBAAAA;SAAuB,CAAC,GAC3D1F,IAAI,EAAE,CACX,CAAC,EACDrH,QAAQ,CAAA;OACF,CAAA;AAAC,KAAA,CACQ,CAAC,CAAA;AAAA,GACM,CAAC,CAAA;AAElC,CAAC,CAAA;AAED,IAAMqM,WAAW,gBAAGa,wBAAwB,CAACtN,YAAY,EAAE;EACzDtC,WAAW,EAAE2P,YAAY,CAACZ,WAAAA;AAC5B,CAAC;;;;"}
1
+ {"version":3,"file":"BottomSheet.web.js","sources":["../../../../../../src/components/BottomSheet/BottomSheet.web.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable react/jsx-no-useless-fragment */\n/* eslint-disable consistent-return */\n/* eslint-disable @typescript-eslint/explicit-function-return-type */\nimport React from 'react';\nimport styled from 'styled-components';\nimport { rubberbandIfOutOfBounds, useDrag } from '@use-gesture/react';\nimport usePresence from 'use-presence';\nimport { clearAllBodyScrollLocks, enableBodyScroll } from 'body-scroll-lock-upgrade';\nimport { BottomSheetHeader } from './BottomSheetHeader';\nimport { BottomSheetFooter } from './BottomSheetFooter';\nimport { BottomSheetBody } from './BottomSheetBody';\nimport type { SnapPoints } from './utils';\nimport { computeMaxContent, computeSnapPointBounds } from './utils';\nimport { BottomSheetBackdrop } from './BottomSheetBackdrop';\nimport type { BottomSheetContextProps } from './BottomSheetContext';\nimport { BottomSheetContext, useBottomSheetAndDropdownGlue } from './BottomSheetContext';\nimport { ComponentIds } from './componentIds';\nimport type { BottomSheetProps } from './types';\nimport { BottomSheetGrabHandle } from './BottomSheetGrabHandle';\nimport { useBottomSheetStack } from './BottomSheetStack';\nimport BaseBox from '~components/Box/BaseBox';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { useScrollLock } from '~utils/useScrollLock';\nimport { useWindowSize } from '~utils/useWindowSize';\nimport { useIsomorphicLayoutEffect } from '~utils/useIsomorphicLayoutEffect';\nimport { useTheme } from '~components/BladeProvider';\nimport { useId } from '~utils/useId';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeSize } from '~utils/makeSize';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { size } from '~tokens/global';\nimport { makeMotionTime } from '~utils/makeMotionTime';\nimport { componentZIndices } from '~utils/componentZIndices';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\nexport const BOTTOM_SHEET_EASING = 'cubic-bezier(.15,0,.24,.97)';\nconst AUTOCOMPLETE_DEFAULT_SNAPPOINT = 0.85;\n\nconst BottomSheetSurface = styled.div<{\n windowHeight: number;\n isDragging: boolean;\n}>(({ theme, windowHeight, isDragging }) => {\n return {\n background: theme.colors.popup.background.subtle,\n borderTopLeftRadius: makeSize(size[16]),\n borderTopRightRadius: makeSize(size[16]),\n borderColor: theme.colors.popup.border.subtle,\n // this is reverse top elevation of highRaised elevation token\n boxShadow: '0px -24px 48px -12px hsla(217, 56%, 17%, 0.18)',\n opacity: 0,\n pointerEvents: 'none',\n transitionDuration: isDragging\n ? undefined\n : `${makeMotionTime(theme.motion.duration.moderate)}`,\n transitionTimingFunction: BOTTOM_SHEET_EASING,\n willChange: 'transform, opacity, height',\n transitionProperty: 'transform, opacity, height',\n position: 'fixed',\n left: 0,\n right: 0,\n bottom: 0,\n top: windowHeight,\n backgroundColor: theme.colors.popup.background.subtle,\n justifyContent: 'center',\n alignItems: 'center',\n touchAction: 'none',\n overflow: 'hidden',\n };\n});\n\nconst _BottomSheet = ({\n isOpen,\n onDismiss,\n children,\n initialFocusRef,\n snapPoints = [0.35, 0.5, 0.85],\n zIndex = componentZIndices.bottomSheet,\n ...dataAnalyticsProps\n}: BottomSheetProps): React.ReactElement => {\n const { theme } = useTheme();\n const dimensions = useWindowSize();\n const [contentHeight, setContentHeight] = React.useState(0);\n const [headerHeight, setHeaderHeight] = React.useState(0);\n const [footerHeight, setFooterHeight] = React.useState(0);\n const [grabHandleHeight, setGrabHandleHeight] = React.useState(0);\n const [hasBodyPadding, setHasBodyPadding] = React.useState(true);\n const [isHeaderEmpty, setIsHeaderEmpty] = React.useState(false);\n\n const bottomSheetAndDropdownGlue = useBottomSheetAndDropdownGlue();\n const [positionY, _setPositionY] = React.useState(0);\n const _isOpen = isOpen ?? bottomSheetAndDropdownGlue?.isOpen;\n const [isDragging, setIsDragging] = React.useState(false);\n\n const preventScrollingRef = React.useRef(true);\n const scrollRef = React.useRef<HTMLDivElement>(null);\n const grabHandleRef = React.useRef<HTMLDivElement>(null);\n const defaultInitialFocusRef = React.useRef<any>(null);\n const originalFocusElement = React.useRef<HTMLElement | null>(null);\n const initialSnapPoint = React.useRef<number>(snapPoints[1]);\n const totalHeight = React.useMemo(() => {\n return grabHandleHeight + headerHeight + footerHeight + contentHeight;\n }, [contentHeight, footerHeight, grabHandleHeight, headerHeight]);\n\n const id = useId();\n const {\n stack,\n addBottomSheetToStack,\n removeBottomSheetFromStack,\n getTopOfTheStack,\n getCurrentStackIndexById,\n } = useBottomSheetStack();\n const currentStackIndex = getCurrentStackIndexById(id);\n const isOnTopOfStack = getTopOfTheStack() === id;\n const bottomSheetZIndex = zIndex - currentStackIndex;\n\n const setPositionY = React.useCallback(\n (value: number, limit = true) => {\n // In AutoComplete, we want BottomSheet to be docked to top snappoint so we remove the limits\n const shouldLimitPositionY =\n limit && !bottomSheetAndDropdownGlue?.hasAutoCompleteInBottomSheetHeader;\n\n const maxValue = computeMaxContent({\n contentHeight,\n footerHeight,\n headerHeight: headerHeight + grabHandleHeight,\n maxHeight: value,\n });\n _setPositionY(shouldLimitPositionY ? maxValue : value);\n },\n [\n bottomSheetAndDropdownGlue?.hasAutoCompleteInBottomSheetHeader,\n contentHeight,\n footerHeight,\n grabHandleHeight,\n headerHeight,\n ],\n );\n\n // locks the body scroll to prevent accidental scrolling of content when we drag the sheet\n // We are ready when we calculated the height of the content\n const isReady = contentHeight > 0;\n // only lock the body when we atleast have 1 bottomsheet open\n const shouldLock = isReady && stack.length > 0;\n const scrollLockRef = useScrollLock({\n enabled: shouldLock,\n targetRef: scrollRef,\n reserveScrollBarGap: true,\n });\n\n // clear all body locks to avoid memory leaks & accidental body locking\n React.useEffect(() => {\n const hasNoBottomSheets = stack.length < 1;\n if (hasNoBottomSheets) {\n clearAllBodyScrollLocks();\n }\n }, [stack]);\n\n // take the grabHandle's height into headerHeight too\n useIsomorphicLayoutEffect(() => {\n if (!grabHandleRef.current) return;\n setGrabHandleHeight(grabHandleRef.current.getBoundingClientRect().height);\n }, [grabHandleRef.current, _isOpen]);\n\n // if bottomSheet height is >35% & <50% then set initial snapPoint to 35%\n useIsomorphicLayoutEffect(() => {\n if (bottomSheetAndDropdownGlue?.hasAutoCompleteInBottomSheetHeader) {\n initialSnapPoint.current = AUTOCOMPLETE_DEFAULT_SNAPPOINT;\n } else {\n const middleSnapPoint = snapPoints[1] * dimensions.height;\n const lowerSnapPoint = snapPoints[0] * dimensions.height;\n if (totalHeight > lowerSnapPoint && totalHeight < middleSnapPoint) {\n initialSnapPoint.current = snapPoints[0];\n }\n }\n }, [dimensions.height, snapPoints, totalHeight]);\n\n const returnFocus = React.useCallback(() => {\n if (!originalFocusElement.current) return;\n originalFocusElement.current.focus();\n // After returning focus we will clear the original focus\n // Because if sheet can be opened up via multiple triggers\n // We want to ensure the focus returns back to the most recent triggerer\n originalFocusElement.current = null;\n }, [originalFocusElement]);\n\n const focusOnInitialRef = React.useCallback(() => {\n if (!initialFocusRef) {\n // focus on close button\n defaultInitialFocusRef.current?.focus();\n } else {\n // focus on the initialRef passed by the user\n initialFocusRef.current?.focus();\n }\n }, [initialFocusRef]);\n\n // focus on the initial ref when the sheet is opened\n React.useLayoutEffect(() => {\n if (_isOpen) {\n focusOnInitialRef();\n }\n }, [_isOpen, focusOnInitialRef]);\n\n const handleOnOpen = React.useCallback(() => {\n setPositionY(dimensions.height * initialSnapPoint.current);\n scrollLockRef.current.activate();\n // initialize the original focused element\n // On first render it will be the activeElement, eg: the button trigger or select input\n // On Subsequent open operations it won't further update the original focus\n originalFocusElement.current =\n originalFocusElement.current ?? (document.activeElement as HTMLElement);\n }, [dimensions.height, scrollLockRef, setPositionY]);\n\n const handleOnClose = React.useCallback(() => {\n setPositionY(0);\n }, [setPositionY]);\n\n const close = React.useCallback(() => {\n onDismiss?.();\n bottomSheetAndDropdownGlue?.onBottomSheetDismiss();\n returnFocus();\n }, [bottomSheetAndDropdownGlue, onDismiss, returnFocus]);\n\n // sync controlled state to our actions\n React.useEffect(() => {\n if (_isOpen) {\n // open on the next frame, otherwise the animations will not run on first render\n window.setTimeout(() => {\n handleOnOpen();\n });\n } else {\n handleOnClose();\n }\n }, [_isOpen, handleOnClose, handleOnOpen]);\n\n // let the Dropdown component know that it's rendering a bottomsheet\n React.useEffect(() => {\n if (!bottomSheetAndDropdownGlue) return;\n bottomSheetAndDropdownGlue.setDropdownHasBottomSheet(true);\n }, [bottomSheetAndDropdownGlue]);\n\n const bind = useDrag(\n ({\n active,\n last,\n cancel,\n tap,\n movement: [_movementX, movementY],\n velocity: [_velocityX, velocityY],\n lastOffset: [_, lastOffsetY],\n down,\n dragging,\n args: [{ isContentDragging = false } = {}] = [],\n }) => {\n setIsDragging(Boolean(dragging));\n // lastOffsetY is the previous position user stopped dragging the sheet\n // movementY is the drag amount from the bottom of the screen, so as you drag up the movementY goes into negatives\n // and rawY is the calculated offset from the last position of the bottomsheet to current drag amount.\n const rawY = lastOffsetY - movementY;\n\n const lowerSnapPoint = dimensions.height * snapPoints[0];\n const upperSnapPoint = dimensions.height * snapPoints[snapPoints.length - 1];\n\n // predictedY is used to create velocity driven swipe\n // the faster you swipe the more distance you cover\n // this enables users to reach upper & lower snappoint with a single swipe\n const predictedDistance = movementY * (velocityY / 2);\n const predictedY = Math.max(\n lowerSnapPoint,\n Math.min(upperSnapPoint, rawY - predictedDistance * 2),\n );\n\n let newY = rawY;\n\n if (down) {\n // Ensure that users aren't able to drag the sheet\n // more than the upperSnapPoint or maximum height of the sheet\n // this is basically a clamp() function but creates a nice rubberband effect\n const dampening = 0.55;\n if (totalHeight < upperSnapPoint) {\n newY = rubberbandIfOutOfBounds(rawY, 0, totalHeight, dampening);\n } else {\n newY = rubberbandIfOutOfBounds(rawY, 0, upperSnapPoint, dampening);\n }\n } else {\n newY = predictedY;\n }\n\n const isPosAtUpperSnapPoint = newY >= upperSnapPoint;\n\n if (isContentDragging) {\n if (isPosAtUpperSnapPoint) {\n newY = upperSnapPoint;\n }\n\n // keep the newY at upper snap point\n // until the scrollable content is not at top\n // and previously saved Y position is greater than or equal to upper snap point\n // Note: how using newY won't work here since we need the previous value of the newY\n // since we always keep updating the newY,\n // this is cruicial in making the scroll feel natural\n const isContentScrolledAtTop = scrollRef.current && scrollRef.current.scrollTop <= 0;\n if (lastOffsetY === upperSnapPoint && !isContentScrolledAtTop) {\n newY = upperSnapPoint;\n }\n preventScrollingRef.current = newY < upperSnapPoint;\n }\n\n if (last) {\n // calculate the nearest snapPoint\n const [nearest, lower] = computeSnapPointBounds(\n newY,\n snapPoints.map((point) => dimensions.height * point) as SnapPoints,\n );\n\n // This ensure that the lower snapPoint will always have atleast some buffer\n // When the bottomsheet total height is less than the lower snapPoint\n // Video walkthrough: https://www.loom.com/share/a9a8db7688d64194b13df8b3e25859ae\n const lowerPointBuffer = 60;\n const lowerestSnap = Math.min(lower, totalHeight) - lowerPointBuffer;\n\n const shouldClose = rawY < lowerestSnap;\n if (shouldClose) {\n setIsDragging(false);\n cancel();\n close();\n return;\n }\n\n // if we stop dragging assign snap to the nearest point\n if (!active && !tap) {\n newY = nearest;\n }\n }\n\n setPositionY(newY, !down);\n },\n {\n from: [0, positionY],\n filterTaps: true,\n enabled: isOnTopOfStack && _isOpen,\n },\n );\n\n // Here we are preventing the scrolling of the content, until the preventScrollingRef value is true\n useIsomorphicLayoutEffect(() => {\n const scrollElement = scrollRef.current;\n if (!scrollElement) return;\n\n const preventScrolling = (e: Event) => {\n if (preventScrollingRef?.current) {\n e.preventDefault();\n }\n };\n\n // https://www.bram.us/2016/05/02/prevent-overscroll-bounce-in-ios-mobilesafari-pure-css/\n const preventSafariOverscroll = (e: Event) => {\n if (scrollElement.scrollTop < 0) {\n // TODO: figure this out, it doesn't seem to work >iOS12\n // requestAnimationFrame(() => {\n // elem.style.overflow = 'hidden';\n // elem.scrollTop = 0;\n // elem.style.removeProperty('overflow');\n // });\n e.preventDefault();\n }\n };\n\n scrollElement.addEventListener('scroll', preventScrolling);\n scrollElement.addEventListener('touchmove', preventScrolling);\n scrollElement.addEventListener('touchstart', preventSafariOverscroll);\n return () => {\n scrollElement.removeEventListener('scroll', preventScrolling);\n scrollElement.removeEventListener('touchmove', preventScrolling);\n scrollElement.removeEventListener('touchstart', preventSafariOverscroll);\n };\n // Only run this hook when we know all the layout calculations are done,\n // Otherwise the scrollRef.current will be null.\n // isReady prop will ensure that we are done measuring the content height\n }, [isReady]);\n\n // usePresence hook waits for the animation to finish before unmounting the component\n // It's similar to motion/react's usePresence hook\n // https://www.framer.com/docs/animate-presence/#usepresence\n const { isMounted, isVisible } = usePresence(Boolean(_isOpen), {\n transitionDuration: theme.motion.duration.moderate,\n });\n\n const isHeaderFloating = !hasBodyPadding && isHeaderEmpty;\n const contextValue: BottomSheetContextProps = React.useMemo(\n () => ({\n isInBottomSheet: true,\n isOpen: Boolean(isVisible),\n close,\n positionY,\n headerHeight,\n contentHeight,\n footerHeight,\n setContentHeight,\n setFooterHeight,\n setHeaderHeight,\n setHasBodyPadding,\n setIsHeaderEmpty,\n scrollRef,\n bind,\n defaultInitialFocusRef,\n isHeaderFloating,\n }),\n [\n isVisible,\n close,\n positionY,\n headerHeight,\n contentHeight,\n footerHeight,\n setContentHeight,\n setFooterHeight,\n setHeaderHeight,\n setHasBodyPadding,\n setIsHeaderEmpty,\n scrollRef,\n bind,\n defaultInitialFocusRef,\n isHeaderFloating,\n ],\n );\n\n React.useEffect(() => {\n if (isMounted) {\n addBottomSheetToStack(id);\n } else {\n removeBottomSheetFromStack(id);\n }\n }, [addBottomSheetToStack, id, isMounted, removeBottomSheetFromStack]);\n\n // Remove the bottomsheet from the stack, if it's unmounted forcefully\n React.useEffect(() => {\n return () => {\n if (id === undefined) return;\n removeBottomSheetFromStack(id);\n };\n }, [id, removeBottomSheetFromStack]);\n\n // Disable body scroll lock when the component is unmounted forcefully\n React.useEffect(() => {\n const lockTarget = scrollRef.current!;\n return () => {\n enableBodyScroll(lockTarget);\n };\n }, []);\n\n // We will need to reset these values otherwise the next time the bottomsheet opens\n // this will be populated and the animations won't run\n // why?: because how the usePresence hook works, we actually just unmount the\n // html contents not the whole <BottomSheet /> react component\n React.useEffect(() => {\n if (!isMounted) {\n setHeaderHeight(0);\n setFooterHeight(0);\n setContentHeight(0);\n setGrabHandleHeight(0);\n _setPositionY(0);\n }\n }, [isMounted, scrollLockRef]);\n\n // We don't want to destroy the react tree when we are rendering inside Dropdown\n // Because if we bail out early then ActionList won't render,\n // and Dropdown manages it's state based on the rendered JSX of ActionList\n // If we don't render ActionList Dropdown state will reset each time we open/close BottomSheet\n const isInsideDropdown = Boolean(bottomSheetAndDropdownGlue);\n if (!isMounted && !isInsideDropdown) {\n return <></>;\n }\n\n return (\n <BottomSheetContext.Provider value={contextValue}>\n <BottomSheetBackdrop zIndex={bottomSheetZIndex} />\n <BottomSheetSurface\n {...metaAttribute({\n name: MetaConstants.BottomSheet,\n testID: 'bottomsheet-surface',\n })}\n {...makeAccessible({ modal: true, role: 'dialog' })}\n windowHeight={dimensions.height}\n isDragging={isDragging}\n style={{\n opacity: isVisible ? 1 : 0,\n pointerEvents: isVisible ? 'all' : 'none',\n height: positionY,\n bottom: 0,\n top: 'auto',\n zIndex: bottomSheetZIndex,\n }}\n {...makeAnalyticsAttribute(dataAnalyticsProps)}\n >\n <BaseBox height=\"100%\" display=\"flex\" flexDirection=\"column\">\n <BottomSheetGrabHandle\n ref={grabHandleRef}\n isHeaderFloating={isHeaderFloating}\n {...metaAttribute({ name: ComponentIds.BottomSheetGrabHandle })}\n {...bind()}\n />\n {children}\n </BaseBox>\n </BottomSheetSurface>\n </BottomSheetContext.Provider>\n );\n};\n\nconst BottomSheet = assignWithoutSideEffects(_BottomSheet, {\n componentId: ComponentIds.BottomSheet,\n});\n\nexport { BottomSheet, BottomSheetBody, BottomSheetHeader, BottomSheetFooter };\nexport type { BottomSheetProps };\n"],"names":["BOTTOM_SHEET_EASING","AUTOCOMPLETE_DEFAULT_SNAPPOINT","BottomSheetSurface","styled","div","withConfig","displayName","componentId","_ref","theme","windowHeight","isDragging","background","colors","popup","subtle","borderTopLeftRadius","makeSize","size","borderTopRightRadius","borderColor","border","boxShadow","opacity","pointerEvents","transitionDuration","undefined","concat","makeMotionTime","motion","duration","moderate","transitionTimingFunction","willChange","transitionProperty","position","left","right","bottom","top","backgroundColor","justifyContent","alignItems","touchAction","overflow","_BottomSheet","_ref2","isOpen","onDismiss","children","initialFocusRef","_ref2$snapPoints","snapPoints","_ref2$zIndex","zIndex","componentZIndices","bottomSheet","dataAnalyticsProps","_objectWithoutProperties","_excluded","_useTheme","useTheme","dimensions","useWindowSize","_React$useState","React","useState","_React$useState2","_slicedToArray","contentHeight","setContentHeight","_React$useState3","_React$useState4","headerHeight","setHeaderHeight","_React$useState5","_React$useState6","footerHeight","setFooterHeight","_React$useState7","_React$useState8","grabHandleHeight","setGrabHandleHeight","_React$useState9","_React$useState10","hasBodyPadding","setHasBodyPadding","_React$useState11","_React$useState12","isHeaderEmpty","setIsHeaderEmpty","bottomSheetAndDropdownGlue","useBottomSheetAndDropdownGlue","_React$useState13","_React$useState14","positionY","_setPositionY","_isOpen","_React$useState15","_React$useState16","setIsDragging","preventScrollingRef","useRef","scrollRef","grabHandleRef","defaultInitialFocusRef","originalFocusElement","initialSnapPoint","totalHeight","useMemo","id","useId","_useBottomSheetStack","useBottomSheetStack","stack","addBottomSheetToStack","removeBottomSheetFromStack","getTopOfTheStack","getCurrentStackIndexById","currentStackIndex","isOnTopOfStack","bottomSheetZIndex","setPositionY","useCallback","value","limit","arguments","length","shouldLimitPositionY","hasAutoCompleteInBottomSheetHeader","maxValue","computeMaxContent","maxHeight","isReady","shouldLock","scrollLockRef","useScrollLock","enabled","targetRef","reserveScrollBarGap","useEffect","hasNoBottomSheets","clearAllBodyScrollLocks","useIsomorphicLayoutEffect","current","getBoundingClientRect","height","middleSnapPoint","lowerSnapPoint","returnFocus","focus","focusOnInitialRef","_defaultInitialFocusR","_initialFocusRef$curr","useLayoutEffect","handleOnOpen","_originalFocusElement","activate","document","activeElement","handleOnClose","close","onBottomSheetDismiss","window","setTimeout","setDropdownHasBottomSheet","bind","useDrag","_ref3","active","last","cancel","tap","_ref3$movement","movement","_movementX","movementY","_ref3$velocity","velocity","_velocityX","velocityY","_ref3$lastOffset","lastOffset","_","lastOffsetY","down","dragging","_ref3$args","args","_ref3$args2","_ref3$args3","_ref3$args3$","_ref3$args3$2","_ref3$args3$2$isConte","isContentDragging","Boolean","rawY","upperSnapPoint","predictedDistance","predictedY","Math","max","min","newY","dampening","rubberbandIfOutOfBounds","isPosAtUpperSnapPoint","isContentScrolledAtTop","scrollTop","_computeSnapPointBoun","computeSnapPointBounds","map","point","_computeSnapPointBoun2","nearest","lower","lowerPointBuffer","lowerestSnap","shouldClose","from","filterTaps","scrollElement","preventScrolling","e","preventDefault","preventSafariOverscroll","addEventListener","removeEventListener","_usePresence","usePresence","isMounted","isVisible","isHeaderFloating","contextValue","isInBottomSheet","lockTarget","enableBodyScroll","isInsideDropdown","_jsx","_Fragment","_jsxs","BottomSheetContext","Provider","BottomSheetBackdrop","_objectSpread","metaAttribute","name","MetaConstants","BottomSheet","testID","makeAccessible","modal","role","style","makeAnalyticsAttribute","BaseBox","display","flexDirection","BottomSheetGrabHandle","ref","ComponentIds","assignWithoutSideEffects"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCO,IAAMA,mBAAmB,GAAG,8BAA6B;AAChE,IAAMC,8BAA8B,GAAG,IAAI,CAAA;AAE3C,IAAMC,kBAAkB,gBAAGC,MAAM,CAACC,GAAG,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,oCAAA;EAAAC,WAAA,EAAA,UAAA;AAAA,CAGlC,CAAA,CAAA,UAAAC,IAAA,EAAyC;AAAA,EAAA,IAAtCC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,YAAY,GAAAF,IAAA,CAAZE,YAAY;IAAEC,UAAU,GAAAH,IAAA,CAAVG,UAAU,CAAA;EACnC,OAAO;IACLC,UAAU,EAAEH,KAAK,CAACI,MAAM,CAACC,KAAK,CAACF,UAAU,CAACG,MAAM;AAChDC,IAAAA,mBAAmB,EAAEC,QAAQ,CAACC,IAAI,CAAC,EAAE,CAAC,CAAC;AACvCC,IAAAA,oBAAoB,EAAEF,QAAQ,CAACC,IAAI,CAAC,EAAE,CAAC,CAAC;IACxCE,WAAW,EAAEX,KAAK,CAACI,MAAM,CAACC,KAAK,CAACO,MAAM,CAACN,MAAM;AAC7C;AACAO,IAAAA,SAAS,EAAE,gDAAgD;AAC3DC,IAAAA,OAAO,EAAE,CAAC;AACVC,IAAAA,aAAa,EAAE,MAAM;AACrBC,IAAAA,kBAAkB,EAAEd,UAAU,GAC1Be,SAAS,GAAA,EAAA,CAAAC,MAAA,CACNC,cAAc,CAACnB,KAAK,CAACoB,MAAM,CAACC,QAAQ,CAACC,QAAQ,CAAC,CAAE;AACvDC,IAAAA,wBAAwB,EAAEhC,mBAAmB;AAC7CiC,I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BAAkB,CAAC,CAAA,EAAA,EAAA,EAAA;MAAAR,QAAA,eAE9C+L,IAAA,CAACe,OAAO,EAAA;AAAC7G,QAAAA,MAAM,EAAC,MAAM;AAAC8G,QAAAA,OAAO,EAAC,MAAM;AAACC,QAAAA,aAAa,EAAC,QAAQ;AAAAhN,QAAAA,QAAA,gBAC1D6L,GAAA,CAACoB,qBAAqB,EAAAd,aAAA,CAAAA,aAAA,CAAA;AACpBe,UAAAA,GAAG,EAAE3J,aAAc;AACnBgI,UAAAA,gBAAgB,EAAEA,gBAAAA;AAAiB,SAAA,EAC/Ba,aAAa,CAAC;UAAEC,IAAI,EAAEc,YAAY,CAACF,qBAAAA;SAAuB,CAAC,GAC3D5F,IAAI,EAAE,CACX,CAAC,EACDrH,QAAQ,CAAA;OACF,CAAA;AAAC,KAAA,CACQ,CAAC,CAAA;AAAA,GACM,CAAC,CAAA;AAElC,CAAC,CAAA;AAED,IAAMuM,WAAW,gBAAGa,wBAAwB,CAACxN,YAAY,EAAE;EACzDtC,WAAW,EAAE6P,YAAY,CAACZ,WAAAA;AAC5B,CAAC;;;;"}
@@ -33,7 +33,7 @@ var _IconButton = function _IconButton(_ref, ref) {
33
33
  isHighlighted = _ref.isHighlighted,
34
34
  _tabIndex = _ref._tabIndex,
35
35
  rest = _objectWithoutProperties(_ref, _excluded);
36
- return /*#__PURE__*/jsx(StyledIconButton, _objectSpread({
36
+ return /*#__PURE__*/jsx(StyledIconButton, _objectSpread(_objectSpread({
37
37
  ref: ref,
38
38
  onClick: onClick,
39
39
  emphasis: emphasis,
@@ -51,7 +51,7 @@ var _IconButton = function _IconButton(_ref, ref) {
51
51
  onPointerEnter: onPointerEnter,
52
52
  onTouchEnd: onTouchEnd,
53
53
  onTouchStart: onTouchStart
54
- }, makeAnalyticsAttribute(rest)));
54
+ }, makeAnalyticsAttribute(rest)), rest));
55
55
  };
56
56
  var IconButton = /*#__PURE__*/React__default.forwardRef(_IconButton);
57
57