@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.
- package/build/lib/native/components/Button/IconButton/IconButton.js +1 -1
- package/build/lib/native/components/Button/IconButton/IconButton.js.map +1 -1
- package/build/lib/native/components/Radio/Radio.js +1 -1
- package/build/lib/native/components/Radio/Radio.js.map +1 -1
- package/build/lib/native/components/Radio/RadioGroup/RadioGroup.js.map +1 -1
- package/build/lib/native/components/Radio/RadioGroup/useRadioGroup.js +1 -1
- package/build/lib/native/components/Radio/RadioGroup/useRadioGroup.js.map +1 -1
- package/build/lib/native/components/Radio/useRadio.js.map +1 -1
- package/build/lib/native/utils/useControllable.js +1 -1
- package/build/lib/native/utils/useControllable.js.map +1 -1
- package/build/lib/web/development/components/BottomSheet/BottomSheet.web.js +17 -1
- package/build/lib/web/development/components/BottomSheet/BottomSheet.web.js.map +1 -1
- package/build/lib/web/development/components/Button/IconButton/IconButton.js +2 -2
- package/build/lib/web/development/components/Button/IconButton/IconButton.js.map +1 -1
- package/build/lib/web/development/components/Button/IconButton/StyledIconButton.web.js +7 -4
- package/build/lib/web/development/components/Button/IconButton/StyledIconButton.web.js.map +1 -1
- package/build/lib/web/development/components/ButtonGroup/ButtonGroup.web.js +7 -17
- package/build/lib/web/development/components/ButtonGroup/ButtonGroup.web.js.map +1 -1
- package/build/lib/web/development/components/Drawer/Drawer.web.js +6 -4
- package/build/lib/web/development/components/Drawer/Drawer.web.js.map +1 -1
- package/build/lib/web/development/components/Radio/Radio.js +3 -2
- package/build/lib/web/development/components/Radio/Radio.js.map +1 -1
- package/build/lib/web/development/components/Radio/RadioGroup/RadioGroup.js.map +1 -1
- package/build/lib/web/development/components/Radio/RadioGroup/useRadioGroup.js +7 -6
- package/build/lib/web/development/components/Radio/RadioGroup/useRadioGroup.js.map +1 -1
- package/build/lib/web/development/components/Radio/useRadio.js.map +1 -1
- package/build/lib/web/development/components/SideNav/SideNav.web.js +22 -8
- package/build/lib/web/development/components/SideNav/SideNav.web.js.map +1 -1
- package/build/lib/web/development/components/SideNav/SideNavItems/SideNavLink.web.js +14 -7
- package/build/lib/web/development/components/SideNav/SideNavItems/SideNavLink.web.js.map +1 -1
- package/build/lib/web/development/components/Tooltip/Tooltip.web.js +7 -1
- package/build/lib/web/development/components/Tooltip/Tooltip.web.js.map +1 -1
- package/build/lib/web/development/components/Tooltip/componentIds.js +6 -0
- package/build/lib/web/development/components/Tooltip/componentIds.js.map +1 -0
- package/build/lib/web/development/components/TopNav/TabNav/TabNavItem.web.js +1 -1
- package/build/lib/web/development/components/TopNav/TabNav/TabNavItem.web.js.map +1 -1
- package/build/lib/web/development/components/TopNav/TopNav.web.js +1 -1
- package/build/lib/web/development/components/TopNav/TopNav.web.js.map +1 -1
- package/build/lib/web/development/utils/useControllable.js +2 -1
- package/build/lib/web/development/utils/useControllable.js.map +1 -1
- package/build/lib/web/production/components/BottomSheet/BottomSheet.web.js +17 -1
- package/build/lib/web/production/components/BottomSheet/BottomSheet.web.js.map +1 -1
- package/build/lib/web/production/components/Button/IconButton/IconButton.js +2 -2
- package/build/lib/web/production/components/Button/IconButton/IconButton.js.map +1 -1
- package/build/lib/web/production/components/Button/IconButton/StyledIconButton.web.js +7 -4
- package/build/lib/web/production/components/Button/IconButton/StyledIconButton.web.js.map +1 -1
- package/build/lib/web/production/components/ButtonGroup/ButtonGroup.web.js +7 -17
- package/build/lib/web/production/components/ButtonGroup/ButtonGroup.web.js.map +1 -1
- package/build/lib/web/production/components/Drawer/Drawer.web.js +6 -4
- package/build/lib/web/production/components/Drawer/Drawer.web.js.map +1 -1
- package/build/lib/web/production/components/Radio/Radio.js +3 -2
- package/build/lib/web/production/components/Radio/Radio.js.map +1 -1
- package/build/lib/web/production/components/Radio/RadioGroup/RadioGroup.js.map +1 -1
- package/build/lib/web/production/components/Radio/RadioGroup/useRadioGroup.js +7 -6
- package/build/lib/web/production/components/Radio/RadioGroup/useRadioGroup.js.map +1 -1
- package/build/lib/web/production/components/Radio/useRadio.js.map +1 -1
- package/build/lib/web/production/components/SideNav/SideNav.web.js +22 -8
- package/build/lib/web/production/components/SideNav/SideNav.web.js.map +1 -1
- package/build/lib/web/production/components/SideNav/SideNavItems/SideNavLink.web.js +14 -7
- package/build/lib/web/production/components/SideNav/SideNavItems/SideNavLink.web.js.map +1 -1
- package/build/lib/web/production/components/Tooltip/Tooltip.web.js +7 -1
- package/build/lib/web/production/components/Tooltip/Tooltip.web.js.map +1 -1
- package/build/lib/web/production/components/Tooltip/componentIds.js +6 -0
- package/build/lib/web/production/components/Tooltip/componentIds.js.map +1 -0
- package/build/lib/web/production/components/TopNav/TabNav/TabNavItem.web.js +1 -1
- package/build/lib/web/production/components/TopNav/TabNav/TabNavItem.web.js.map +1 -1
- package/build/lib/web/production/components/TopNav/TopNav.web.js +1 -1
- package/build/lib/web/production/components/TopNav/TopNav.web.js.map +1 -1
- package/build/lib/web/production/utils/useControllable.js +2 -1
- package/build/lib/web/production/utils/useControllable.js.map +1 -1
- package/build/types/components/index.d.ts +1168 -45
- package/build/types/components/index.native.d.ts +345 -4
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabNavItem.web.js","sources":["../../../../../../../src/components/TopNav/TabNav/TabNavItem.web.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */\n/* eslint-disable @typescript-eslint/explicit-function-return-type */\n/* eslint-disable consistent-return */\nimport React from 'react';\nimport styled from 'styled-components';\nimport type { TabNavItemProps } from './types';\nimport { useTabNavContext } from './TabNavContext';\nimport { MIXED_BG_COLOR } from './utils';\nimport BaseBox from '~components/Box/BaseBox';\nimport getTextStyles from '~components/Typography/Text/getTextStyles';\nimport { makeBorderSize, makeMotionTime, makeSize, makeSpace } from '~utils';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { size } from '~tokens/global';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { useIsomorphicLayoutEffect } from '~utils/useIsomorphicLayoutEffect';\n\nconst StyledTabNavItem = styled.a<{ $isActive?: boolean }>(({ theme, $isActive }) => {\n return {\n ...getTextStyles({\n theme,\n size: 'medium',\n weight: 'medium',\n color: $isActive ? 'interactive.text.gray.normal' : 'interactive.text.gray.subtle',\n }),\n flex: 1,\n display: 'flex',\n gap: makeSpace(theme.spacing[2]),\n alignItems: 'center',\n justifyContent: 'center',\n height: '100%',\n textDecoration: 'none',\n whiteSpace: 'nowrap',\n paddingTop: makeSpace(theme.spacing[3]),\n paddingBottom: makeSpace(theme.spacing[3]),\n paddingLeft: makeSpace(theme.spacing[4]),\n paddingRight: makeSpace(theme.spacing[4]),\n borderRadius: makeBorderSize(theme.border.radius.medium),\n // reset button styles\n border: 'none',\n background: 'none',\n '&[aria-expanded=\"true\"]': $isActive\n ? {}\n : {\n backgroundColor: theme.colors.interactive.background.gray.default,\n },\n '&:hover': $isActive\n ? {}\n : {\n backgroundColor: theme.colors.interactive.background.gray.default,\n },\n };\n});\n\nconst StyledTabNavItemWrapper = styled(BaseBox)<{\n isActive?: boolean;\n}>(({ theme, isActive }) => {\n const dividerHiderStyle = {\n content: '\"\"',\n position: 'absolute',\n top: '50%',\n transform: 'translateY(-50%)',\n width: makeSize(size[1]),\n height: makeSize(size[16]),\n backgroundColor: MIXED_BG_COLOR,\n } as const;\n\n return {\n position: 'relative',\n flexShrink: 0,\n padding: `${makeSpace(theme.spacing[2])} ${makeSpace(theme.spacing[1])}`,\n backgroundColor: isActive ? theme.colors.surface.background.gray.intense : 'transparent',\n borderColor: isActive ? theme.colors.surface.border.gray.muted : 'transparent',\n borderStyle: 'solid',\n borderWidth: makeBorderSize(theme.border.width.thin),\n borderBottomWidth: 0,\n borderTopLeftRadius: makeBorderSize(theme.border.radius.medium),\n borderTopRightRadius: makeBorderSize(theme.border.radius.medium),\n transition: `${makeMotionTime(theme.motion.duration.moderate)} ${theme.motion.easing.standard}`,\n transitionProperty: 'background',\n\n // Hide the left and right divider by overlaying them with a pseudo element as same color as the background\n ...(isActive\n ? {\n ':before, :after': dividerHiderStyle,\n ':before': {\n left: -2,\n },\n ':after': {\n right: -2,\n },\n }\n : {}),\n };\n});\n\nconst SelectedBar = styled(BaseBox)<{ isActive?: boolean }>(({ theme, isActive }) => {\n return {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n height: makeSpace(theme.spacing[1]),\n borderTopLeftRadius: makeBorderSize(theme.border.radius.medium),\n borderTopRightRadius: makeBorderSize(theme.border.radius.medium),\n backgroundColor: theme.colors.interactive.icon.gray.normal,\n pointerEvents: 'none',\n // Animation\n opacity: isActive ? 1 : 0,\n transition: `${makeMotionTime(theme.motion.duration.moderate)} ${theme.motion.easing.standard}`,\n transitionProperty: 'opacity',\n };\n});\n\nconst _TabNavItem: React.ForwardRefRenderFunction<HTMLAnchorElement, TabNavItemProps> = (\n {\n as,\n title,\n isActive,\n icon: Icon,\n trailing,\n accessibilityLabel,\n href,\n target,\n // @ts-expect-error - This prop is only used internally\n __isInsideTabNavItems,\n // @ts-expect-error - This prop is only used internally\n __index,\n ...props\n },\n ref,\n): React.ReactElement => {\n const { setControlledItems } = useTabNavContext();\n const bodyRef = React.useRef<HTMLDivElement>(null);\n\n // Update the controlledItems with the tabWidth and offsetX\n useIsomorphicLayoutEffect(() => {\n if (!bodyRef.current) return;\n if (!__isInsideTabNavItems) return;\n setControlledItems((prev) => {\n return prev.map((item, index) => {\n if (index !== __index) return item;\n const bounds = bodyRef?.current?.getBoundingClientRect()!;\n const tabWidth = bounds.width;\n const offsetX = bounds.right;\n return {\n ...item,\n tabWidth,\n offsetX,\n };\n });\n });\n }, [__isInsideTabNavItems, __index, setControlledItems]);\n\n return (\n <StyledTabNavItemWrapper\n ref={bodyRef}\n isActive={isActive}\n {...metaAttribute({ name: MetaConstants.TabNavItem })}\n >\n <SelectedBar isActive={isActive} />\n <StyledTabNavItem\n ref={ref}\n as={as ?? (href ? 'a' : 'button')}\n to={href}\n href={as ? undefined : href}\n target={target}\n $isActive={isActive}\n {...props}\n {...makeAccessible({ label: accessibilityLabel, current: isActive })}\n >\n {Icon ? (\n <Icon\n size=\"large\"\n color={isActive ? 'interactive.icon.gray.normal' : 'surface.icon.gray.subtle'}\n />\n ) : null}\n {title}\n {trailing ? trailing : null}\n </StyledTabNavItem>\n </StyledTabNavItemWrapper>\n );\n};\n\nconst TabNavItem = assignWithoutSideEffects(React.forwardRef(_TabNavItem), {\n displayName: 'TabNavItem',\n});\n\nexport { TabNavItem };\n"],"names":["StyledTabNavItem","styled","a","withConfig","displayName","componentId","_ref","theme","$isActive","_objectSpread","getTextStyles","size","weight","color","flex","display","gap","makeSpace","spacing","alignItems","justifyContent","height","textDecoration","whiteSpace","paddingTop","paddingBottom","paddingLeft","paddingRight","borderRadius","makeBorderSize","border","radius","medium","background","backgroundColor","colors","interactive","gray","StyledTabNavItemWrapper","BaseBox","_ref2","isActive","dividerHiderStyle","content","position","top","transform","width","makeSize","MIXED_BG_COLOR","flexShrink","padding","concat","surface","intense","borderColor","muted","borderStyle","borderWidth","thin","borderBottomWidth","borderTopLeftRadius","borderTopRightRadius","transition","makeMotionTime","motion","duration","moderate","easing","standard","transitionProperty","left","right","SelectedBar","_ref3","icon","normal","pointerEvents","opacity","_TabNavItem","_ref4","ref","as","title","Icon","trailing","accessibilityLabel","href","target","__isInsideTabNavItems","__index","props","_objectWithoutProperties","_excluded","_useTabNavContext","useTabNavContext","setControlledItems","bodyRef","React","useRef","useIsomorphicLayoutEffect","current","prev","map","item","index","_bodyRef$current","bounds","getBoundingClientRect","tabWidth","offsetX","_jsxs","metaAttribute","name","MetaConstants","TabNavItem","children","_jsx","to","undefined","makeAccessible","label","assignWithoutSideEffects","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,IAAMA,gBAAgB,gBAAGC,MAAM,CAACC,CAAC,CAAAC,UAAA,CAAA;E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2E,MAAAA,QAAA,EAEnEhC,CAAAA,IAAI,gBACHiC,GAAA,CAACjC,IAAI,EAAA;AACHzE,QAAAA,IAAI,EAAC,OAAO;AACZE,QAAAA,KAAK,EAAE4B,QAAQ,GAAG,8BAA8B,GAAG,0BAAA;OACpD,CAAC,GACA,IAAI,EACP0C,KAAK,EACLE,QAAQ,GAAGA,QAAQ,GAAG,IAAI,CAAA;AAAA,KAAA,CACX,CAAC,CAAA;AAAA,GAAA,CACI,CAAC,CAAA;AAE9B,CAAC,CAAA;AAEK8B,IAAAA,UAAU,gBAAGO,wBAAwB,eAACxB,cAAK,CAACyB,UAAU,CAAC5C,WAAW,CAAC,EAAE;AACzE3E,EAAAA,WAAW,EAAE,YAAA;AACf,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"TabNavItem.web.js","sources":["../../../../../../../src/components/TopNav/TabNav/TabNavItem.web.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */\n/* eslint-disable @typescript-eslint/explicit-function-return-type */\n/* eslint-disable consistent-return */\nimport React from 'react';\nimport styled from 'styled-components';\nimport type { TabNavItemProps } from './types';\nimport { useTabNavContext } from './TabNavContext';\nimport { MIXED_BG_COLOR } from './utils';\nimport BaseBox from '~components/Box/BaseBox';\nimport getTextStyles from '~components/Typography/Text/getTextStyles';\nimport { makeBorderSize, makeMotionTime, makeSize, makeSpace } from '~utils';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { size } from '~tokens/global';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { useIsomorphicLayoutEffect } from '~utils/useIsomorphicLayoutEffect';\n\nconst StyledTabNavItem = styled.a<{ $isActive?: boolean }>(({ theme, $isActive }) => {\n return {\n ...getTextStyles({\n theme,\n size: 'medium',\n weight: 'medium',\n color: $isActive ? 'interactive.text.gray.normal' : 'interactive.text.gray.subtle',\n }),\n flex: 1,\n display: 'flex',\n gap: makeSpace(theme.spacing[2]),\n alignItems: 'center',\n justifyContent: 'center',\n height: '100%',\n textDecoration: 'none',\n whiteSpace: 'nowrap',\n paddingTop: makeSpace(theme.spacing[3]),\n paddingBottom: makeSpace(theme.spacing[3]),\n paddingLeft: makeSpace(theme.spacing[4]),\n paddingRight: makeSpace(theme.spacing[4]),\n borderRadius: makeBorderSize(theme.border.radius.medium),\n // reset button styles\n border: 'none',\n background: 'none',\n '&[aria-expanded=\"true\"]': $isActive\n ? {}\n : {\n backgroundColor: theme.colors.interactive.background.gray.default,\n },\n '&:hover': $isActive\n ? {}\n : {\n backgroundColor: theme.colors.interactive.background.gray.default,\n },\n };\n});\n\nconst StyledTabNavItemWrapper = styled(BaseBox)<{\n isActive?: boolean;\n}>(({ theme, isActive }) => {\n const dividerHiderStyle = {\n content: '\"\"',\n position: 'absolute',\n top: '50%',\n transform: 'translateY(-50%)',\n width: makeSize(size[1]),\n height: makeSize(size[16]),\n backgroundColor: MIXED_BG_COLOR,\n } as const;\n\n return {\n position: 'relative',\n flexShrink: 0,\n padding: `${makeSpace(theme.spacing[2])} ${makeSpace(theme.spacing[1])}`,\n backgroundColor: isActive ? theme.colors.surface.background.gray.moderate : 'transparent',\n borderColor: isActive ? theme.colors.surface.border.gray.muted : 'transparent',\n borderStyle: 'solid',\n borderWidth: makeBorderSize(theme.border.width.thin),\n borderBottomWidth: 0,\n borderTopLeftRadius: makeBorderSize(theme.border.radius.medium),\n borderTopRightRadius: makeBorderSize(theme.border.radius.medium),\n transition: `${makeMotionTime(theme.motion.duration.moderate)} ${theme.motion.easing.standard}`,\n transitionProperty: 'background',\n\n // Hide the left and right divider by overlaying them with a pseudo element as same color as the background\n ...(isActive\n ? {\n ':before, :after': dividerHiderStyle,\n ':before': {\n left: -2,\n },\n ':after': {\n right: -2,\n },\n }\n : {}),\n };\n});\n\nconst SelectedBar = styled(BaseBox)<{ isActive?: boolean }>(({ theme, isActive }) => {\n return {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n height: makeSpace(theme.spacing[1]),\n borderTopLeftRadius: makeBorderSize(theme.border.radius.medium),\n borderTopRightRadius: makeBorderSize(theme.border.radius.medium),\n backgroundColor: theme.colors.interactive.icon.gray.normal,\n pointerEvents: 'none',\n // Animation\n opacity: isActive ? 1 : 0,\n transition: `${makeMotionTime(theme.motion.duration.moderate)} ${theme.motion.easing.standard}`,\n transitionProperty: 'opacity',\n };\n});\n\nconst _TabNavItem: React.ForwardRefRenderFunction<HTMLAnchorElement, TabNavItemProps> = (\n {\n as,\n title,\n isActive,\n icon: Icon,\n trailing,\n accessibilityLabel,\n href,\n target,\n // @ts-expect-error - This prop is only used internally\n __isInsideTabNavItems,\n // @ts-expect-error - This prop is only used internally\n __index,\n ...props\n },\n ref,\n): React.ReactElement => {\n const { setControlledItems } = useTabNavContext();\n const bodyRef = React.useRef<HTMLDivElement>(null);\n\n // Update the controlledItems with the tabWidth and offsetX\n useIsomorphicLayoutEffect(() => {\n if (!bodyRef.current) return;\n if (!__isInsideTabNavItems) return;\n setControlledItems((prev) => {\n return prev.map((item, index) => {\n if (index !== __index) return item;\n const bounds = bodyRef?.current?.getBoundingClientRect()!;\n const tabWidth = bounds.width;\n const offsetX = bounds.right;\n return {\n ...item,\n tabWidth,\n offsetX,\n };\n });\n });\n }, [__isInsideTabNavItems, __index, setControlledItems]);\n\n return (\n <StyledTabNavItemWrapper\n ref={bodyRef}\n isActive={isActive}\n {...metaAttribute({ name: MetaConstants.TabNavItem })}\n >\n <SelectedBar isActive={isActive} />\n <StyledTabNavItem\n ref={ref}\n as={as ?? (href ? 'a' : 'button')}\n to={href}\n href={as ? undefined : href}\n target={target}\n $isActive={isActive}\n {...props}\n {...makeAccessible({ label: accessibilityLabel, current: isActive })}\n >\n {Icon ? (\n <Icon\n size=\"large\"\n color={isActive ? 'interactive.icon.gray.normal' : 'surface.icon.gray.subtle'}\n />\n ) : null}\n {title}\n {trailing ? trailing : null}\n </StyledTabNavItem>\n </StyledTabNavItemWrapper>\n );\n};\n\nconst TabNavItem = assignWithoutSideEffects(React.forwardRef(_TabNavItem), {\n displayName: 'TabNavItem',\n});\n\nexport { TabNavItem };\n"],"names":["StyledTabNavItem","styled","a","withConfig","displayName","componentId","_ref","theme","$isActive","_objectSpread","getTextStyles","size","weight","color","flex","display","gap","makeSpace","spacing","alignItems","justifyContent","height","textDecoration","whiteSpace","paddingTop","paddingBottom","paddingLeft","paddingRight","borderRadius","makeBorderSize","border","radius","medium","background","backgroundColor","colors","interactive","gray","StyledTabNavItemWrapper","BaseBox","_ref2","isActive","dividerHiderStyle","content","position","top","transform","width","makeSize","MIXED_BG_COLOR","flexShrink","padding","concat","surface","moderate","borderColor","muted","borderStyle","borderWidth","thin","borderBottomWidth","borderTopLeftRadius","borderTopRightRadius","transition","makeMotionTime","motion","duration","easing","standard","transitionProperty","left","right","SelectedBar","_ref3","icon","normal","pointerEvents","opacity","_TabNavItem","_ref4","ref","as","title","Icon","trailing","accessibilityLabel","href","target","__isInsideTabNavItems","__index","props","_objectWithoutProperties","_excluded","_useTabNavContext","useTabNavContext","setControlledItems","bodyRef","React","useRef","useIsomorphicLayoutEffect","current","prev","map","item","index","_bodyRef$current","bounds","getBoundingClientRect","tabWidth","offsetX","_jsxs","metaAttribute","name","MetaConstants","TabNavItem","children","_jsx","to","undefined","makeAccessible","label","assignWithoutSideEffects","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,IAAMA,gBAAgB,gBAAGC,MAAM,CAACC,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,iCAAA;EAAAC,WAAA,EAAA,cAAA;AAAA,CAA0B,CAAA,CAAA,UAAAC,IAAA,EAA0B;AAAA,EAAA,IAAvBC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,SAAS,GAAAF,IAAA,CAATE,SAAS,CAAA;AAC5E,EAAA,OAAAC,aAAA,CAAAA,aAAA,CAAA,EAAA,EACKC,aAAa,CAAC;AACfH,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CACX,CAAC,CAAA;AAAA,GAAA,CACI,CAAC,CAAA;AAE9B,CAAC,CAAA;AAEK8B,IAAAA,UAAU,gBAAGO,wBAAwB,eAACxB,cAAK,CAACyB,UAAU,CAAC5C,WAAW,CAAC,EAAE;AACzE1E,EAAAA,WAAW,EAAE,YAAA;AACf,CAAC;;;;"}
|
|
@@ -96,7 +96,7 @@ var TopNavActions = function TopNavActions(_ref4) {
|
|
|
96
96
|
alignItems: "center",
|
|
97
97
|
marginTop: "spacing.1",
|
|
98
98
|
padding: "spacing.3",
|
|
99
|
-
backgroundColor: "surface.background.gray.
|
|
99
|
+
backgroundColor: "surface.background.gray.moderate",
|
|
100
100
|
borderTopLeftRadius: "medium",
|
|
101
101
|
borderTopRightRadius: "medium"
|
|
102
102
|
}, metaAttribute({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TopNav.web.js","sources":["../../../../../../src/components/TopNav/TopNav.web.tsx"],"sourcesContent":["import React from 'react';\nimport type { BoxProps } from '~components/Box';\nimport { Box } from '~components/Box';\nimport BaseBox from '~components/Box/BaseBox';\nimport {\n SIDE_NAV_EXPANDED_L1_WIDTH_XL,\n SIDE_NAV_EXPANDED_L1_WIDTH_BASE,\n} from '~components/SideNav/tokens';\nimport { size } from '~tokens/global';\nimport { makeSize } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { componentZIndices } from '~utils/componentZIndices';\nimport type { DataAnalyticsAttribute, BladeElementRef, TestID } from '~utils/types';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\nconst TOP_NAV_HEIGHT = size[56];\nconst CONTENT_RIGHT_GAP = size[80];\n\ntype TopNavProps = {\n children: React.ReactNode;\n} & Pick<\n BoxProps,\n | 'padding'\n | 'paddingTop'\n | 'paddingBottom'\n | 'paddingLeft'\n | 'paddingRight'\n | 'paddingX'\n | 'paddingY'\n | 'backgroundColor'\n | 'position'\n | 'top'\n | 'bottom'\n | 'left'\n | 'right'\n | 'width'\n | 'zIndex'\n | keyof DataAnalyticsAttribute\n> &\n TestID &\n StyledPropsBlade;\n\nconst _TopNav = (\n { children, ...rest }: TopNavProps,\n ref: React.Ref<BladeElementRef>,\n): React.ReactElement => {\n return (\n <Box\n ref={ref as never}\n display=\"grid\"\n gridTemplateColumns=\"auto minmax(0, 1fr) auto\"\n alignItems=\"center\"\n position=\"sticky\"\n top=\"0px\"\n width=\"100%\"\n paddingY={{ base: 'spacing.3', m: 'spacing.0' }}\n paddingX={{ base: 'spacing.4', m: 'spacing.3' }}\n height={makeSize(TOP_NAV_HEIGHT)}\n zIndex={componentZIndices.topnav}\n {...rest}\n {...metaAttribute({ name: MetaConstants.TopNav, testID: rest.testID })}\n {...makeAnalyticsAttribute(rest)}\n >\n {children}\n </Box>\n );\n};\n\nconst TopNav = React.forwardRef(_TopNav);\n\nconst TopNavBrand = ({ children }: { children: React.ReactNode }): React.ReactElement => {\n return (\n <Box\n flexDirection=\"row\"\n marginTop=\"spacing.4\"\n width={{\n base: makeSize(SIDE_NAV_EXPANDED_L1_WIDTH_BASE),\n xl: makeSize(SIDE_NAV_EXPANDED_L1_WIDTH_XL),\n }}\n {...metaAttribute({ name: MetaConstants.TopNavBrand })}\n >\n <BaseBox width=\"100%\" textAlign=\"center\">\n {children}\n </BaseBox>\n </Box>\n );\n};\n\nconst TopNavContent = ({ children }: { children: React.ReactNode }): React.ReactElement => {\n return (\n <BaseBox\n display=\"flex\"\n alignItems=\"center\"\n alignSelf=\"end\"\n paddingRight={{ base: 'spacing.0', m: makeSize(CONTENT_RIGHT_GAP) }}\n {...metaAttribute({ name: MetaConstants.TopNavContent })}\n >\n {children}\n </BaseBox>\n );\n};\n\nconst TopNavActions = ({ children }: { children: React.ReactNode }): React.ReactElement => {\n return (\n <BaseBox\n alignSelf=\"end\"\n display=\"flex\"\n gap=\"spacing.3\"\n alignItems=\"center\"\n marginTop=\"spacing.1\"\n padding=\"spacing.3\"\n backgroundColor=\"surface.background.gray.
|
|
1
|
+
{"version":3,"file":"TopNav.web.js","sources":["../../../../../../src/components/TopNav/TopNav.web.tsx"],"sourcesContent":["import React from 'react';\nimport type { BoxProps } from '~components/Box';\nimport { Box } from '~components/Box';\nimport BaseBox from '~components/Box/BaseBox';\nimport {\n SIDE_NAV_EXPANDED_L1_WIDTH_XL,\n SIDE_NAV_EXPANDED_L1_WIDTH_BASE,\n} from '~components/SideNav/tokens';\nimport { size } from '~tokens/global';\nimport { makeSize } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { componentZIndices } from '~utils/componentZIndices';\nimport type { DataAnalyticsAttribute, BladeElementRef, TestID } from '~utils/types';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\nconst TOP_NAV_HEIGHT = size[56];\nconst CONTENT_RIGHT_GAP = size[80];\n\ntype TopNavProps = {\n children: React.ReactNode;\n} & Pick<\n BoxProps,\n | 'padding'\n | 'paddingTop'\n | 'paddingBottom'\n | 'paddingLeft'\n | 'paddingRight'\n | 'paddingX'\n | 'paddingY'\n | 'backgroundColor'\n | 'position'\n | 'top'\n | 'bottom'\n | 'left'\n | 'right'\n | 'width'\n | 'zIndex'\n | keyof DataAnalyticsAttribute\n> &\n TestID &\n StyledPropsBlade;\n\nconst _TopNav = (\n { children, ...rest }: TopNavProps,\n ref: React.Ref<BladeElementRef>,\n): React.ReactElement => {\n return (\n <Box\n ref={ref as never}\n display=\"grid\"\n gridTemplateColumns=\"auto minmax(0, 1fr) auto\"\n alignItems=\"center\"\n position=\"sticky\"\n top=\"0px\"\n width=\"100%\"\n paddingY={{ base: 'spacing.3', m: 'spacing.0' }}\n paddingX={{ base: 'spacing.4', m: 'spacing.3' }}\n height={makeSize(TOP_NAV_HEIGHT)}\n zIndex={componentZIndices.topnav}\n {...rest}\n {...metaAttribute({ name: MetaConstants.TopNav, testID: rest.testID })}\n {...makeAnalyticsAttribute(rest)}\n >\n {children}\n </Box>\n );\n};\n\nconst TopNav = React.forwardRef(_TopNav);\n\nconst TopNavBrand = ({ children }: { children: React.ReactNode }): React.ReactElement => {\n return (\n <Box\n flexDirection=\"row\"\n marginTop=\"spacing.4\"\n width={{\n base: makeSize(SIDE_NAV_EXPANDED_L1_WIDTH_BASE),\n xl: makeSize(SIDE_NAV_EXPANDED_L1_WIDTH_XL),\n }}\n {...metaAttribute({ name: MetaConstants.TopNavBrand })}\n >\n <BaseBox width=\"100%\" textAlign=\"center\">\n {children}\n </BaseBox>\n </Box>\n );\n};\n\nconst TopNavContent = ({ children }: { children: React.ReactNode }): React.ReactElement => {\n return (\n <BaseBox\n display=\"flex\"\n alignItems=\"center\"\n alignSelf=\"end\"\n paddingRight={{ base: 'spacing.0', m: makeSize(CONTENT_RIGHT_GAP) }}\n {...metaAttribute({ name: MetaConstants.TopNavContent })}\n >\n {children}\n </BaseBox>\n );\n};\n\nconst TopNavActions = ({ children }: { children: React.ReactNode }): React.ReactElement => {\n return (\n <BaseBox\n alignSelf=\"end\"\n display=\"flex\"\n gap=\"spacing.3\"\n alignItems=\"center\"\n marginTop=\"spacing.1\"\n padding=\"spacing.3\"\n backgroundColor=\"surface.background.gray.moderate\"\n borderTopLeftRadius=\"medium\"\n borderTopRightRadius=\"medium\"\n {...metaAttribute({ name: MetaConstants.TopNavActions })}\n >\n {children}\n </BaseBox>\n );\n};\n\nexport { TopNav, TopNavBrand, TopNavContent, TopNavActions };\nexport type { TopNavProps };\n"],"names":["TOP_NAV_HEIGHT","size","CONTENT_RIGHT_GAP","_TopNav","_ref","ref","children","rest","_objectWithoutProperties","_excluded","_jsx","Box","_objectSpread","display","gridTemplateColumns","alignItems","position","top","width","paddingY","base","m","paddingX","height","makeSize","zIndex","componentZIndices","topnav","metaAttribute","name","MetaConstants","TopNav","testID","makeAnalyticsAttribute","React","forwardRef","TopNavBrand","_ref2","flexDirection","marginTop","SIDE_NAV_EXPANDED_L1_WIDTH_BASE","xl","SIDE_NAV_EXPANDED_L1_WIDTH_XL","BaseBox","textAlign","TopNavContent","_ref3","alignSelf","paddingRight","TopNavActions","_ref4","gap","padding","backgroundColor","borderTopLeftRadius","borderTopRightRadius"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgBA,IAAMA,cAAc,GAAGC,IAAI,CAAC,EAAE,CAAC,CAAA;AAC/B,IAAMC,iBAAiB,GAAGD,IAAI,CAAC,EAAE,CAAC,CAAA;AA0BlC,IAAME,OAAO,GAAG,SAAVA,OAAOA,CAAAC,IAAA,EAEXC,GAA+B,EACR;AAAA,EAAA,IAFrBC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;AAAKC,IAAAA,IAAI,GAAAC,wBAAA,CAAAJ,IAAA,EAAAK,SAAA,CAAA,CAAA;EAGnB,oBACEC,GAAA,CAACC,GAAG,EAAAC,aAAA,CAAAA,aAAA,CAAAA,aAAA,CAAAA,aAAA,CAAA;AACFP,IAAAA,GAAG,EAAEA,GAAa;AAClBQ,IAAAA,OAAO,EAAC,MAAM;AACdC,IAAAA,mBAAmB,EAAC,0BAA0B;AAC9CC,IAAAA,UAAU,EAAC,QAAQ;AACnBC,IAAAA,QAAQ,EAAC,QAAQ;AACjBC,IAAAA,GAAG,EAAC,KAAK;AACTC,IAAAA,KAAK,EAAC,MAAM;AACZC,IAAAA,QAAQ,EAAE;AAAEC,MAAAA,IAAI,EAAE,WAAW;AAAEC,MAAAA,CAAC,EAAE,WAAA;KAAc;AAChDC,IAAAA,QAAQ,EAAE;AAAEF,MAAAA,IAAI,EAAE,WAAW;AAAEC,MAAAA,CAAC,EAAE,WAAA;KAAc;AAChDE,IAAAA,MAAM,EAAEC,QAAQ,CAACxB,cAAc,CAAE;IACjCyB,MAAM,EAAEC,iBAAiB,CAACC,MAAAA;GACtBpB,EAAAA,IAAI,CACJqB,EAAAA,aAAa,CAAC;IAAEC,IAAI,EAAEC,aAAa,CAACC,MAAM;IAAEC,MAAM,EAAE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AAC,QAAQ;AACnBgC,IAAAA,SAAS,EAAC,KAAK;AACfC,IAAAA,YAAY,EAAE;AAAE5B,MAAAA,IAAI,EAAE,WAAW;MAAEC,CAAC,EAAEG,QAAQ,CAACtB,iBAAiB,CAAA;AAAE,KAAA;AAAE,GAAA,EAChE0B,aAAa,CAAC;IAAEC,IAAI,EAAEC,aAAa,CAACe,aAAAA;AAAc,GAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AAAAvC,IAAAA,QAAA,EAEvDA,QAAAA;AAAQ,GAAA,CACF,CAAC,CAAA;AAEd,EAAC;AAED,IAAM2C,aAAa,GAAG,SAAhBA,aAAaA,CAAAC,KAAA,EAAwE;AAAA,EAAA,IAAlE5C,QAAQ,GAAA4C,KAAA,CAAR5C,QAAQ,CAAA;AAC/B,EAAA,oBACEI,GAAA,CAACiC,OAAO,EAAA/B,aAAA,CAAAA,aAAA,CAAA;AACNmC,IAAAA,SAAS,EAAC,KAAK;AACflC,IAAAA,OAAO,EAAC,MAAM;AACdsC,IAAAA,GAAG,EAAC,WAAW;AACfpC,IAAAA,UAAU,EAAC,QAAQ;AACnBwB,IAAAA,SAAS,EAAC,WAAW;AACrBa,IAAAA,OAAO,EAAC,WAAW;AACnBC,IAAAA,eAAe,EAAC,kCAAkC;AAClDC,IAAAA,mBAAmB,EAAC,QAAQ;AAC5BC,IAAAA,oBAAoB,EAAC,QAAA;AAAQ,GAAA,EACzB3B,aAAa,CAAC;IAAEC,IAAI,EAAEC,aAAa,CAACmB,aAAAA;AAAc,GAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AAAA3C,IAAAA,QAAA,EAEvDA,QAAAA;AAAQ,GAAA,CACF,CAAC,CAAA;AAEd;;;;"}
|
|
@@ -31,12 +31,13 @@ function useControllableState(props) {
|
|
|
31
31
|
var value = isControlled && typeof valueProp !== 'undefined' ? valueProp : valueState;
|
|
32
32
|
var updateValue = useCallbackRef(function (next) {
|
|
33
33
|
var skipUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
34
|
+
var extraData = arguments.length > 2 ? arguments[2] : undefined;
|
|
34
35
|
var nextValue = next(value);
|
|
35
36
|
if (!isControlled) setValue(nextValue);
|
|
36
37
|
// We don't want to call onChange if skipUpdate is true or if the value is not changed
|
|
37
38
|
if (!shouldUpdateProp(value, nextValue)) return;
|
|
38
39
|
if (skipUpdate) return;
|
|
39
|
-
onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp(nextValue);
|
|
40
|
+
onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp(nextValue, extraData);
|
|
40
41
|
}, [isControlled, onChangeProp, value, shouldUpdateProp]);
|
|
41
42
|
return [value, updateValue];
|
|
42
43
|
}
|
|
@@ -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":";;;;
|
|
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":";;;;AAuCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,oBAAoBA,CAAIC,KAAmC,EAAE;AACpE,EAAA,IACSC,SAAS,GAIdD,KAAK,CAJPE,KAAK;IACLC,YAAY,GAGVH,KAAK,CAHPG,YAAY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;AAC7B,IAAA,IAAI,CAACoB,YAAY,EAAEJ,QAAQ,CAACW,SAAS,CAAC,CAAA;AACtC;AACA,IAAA,IAAI,CAAClB,gBAAgB,CAACT,KAAK,EAAE2B,SAAS,CAAC,EAAE,OAAA;AACzC,IAAA,IAAIJ,UAAU,EAAE,OAAA;IAChBhB,YAAY,KAAA,IAAA,IAAZA,YAAY,KAAZA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,YAAY,CAAGoB,SAAS,EAAED,SAAS,CAAC,CAAA;GACrC,EACD,CAACN,YAAY,EAAEb,YAAY,EAAEP,KAAK,EAAES,gBAAgB,CACtD,CAAC,CAAA;AAED,EAAA,OAAO,CAACT,KAAK,EAAEsB,WAAW,CAAC,CAAA;AAC7B;;;;"}
|
|
@@ -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,CA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aAAa,EAAE+M,SAAS,GAAG,KAAK,GAAG,MAAM;AACzCrF,QAAAA,MAAM,EAAEnD,SAAS;AACjBzD,QAAAA,MAAM,EAAE,CAAC;AACTC,QAAAA,GAAG,EAAE,MAAM;AACXe,QAAAA,MAAM,EAAEmE,iBAAAA;AACV,OAAA;KACImI,EAAAA,sBAAsB,CAACnM,kBAAkB,CAAC,CAAA,EAAA,EAAA,EAAA;MAAAR,QAAA,eAE9C6L,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,E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O,EAAEgN,SAAS,GAAG,CAAC,GAAG,CAAC;AAC1B/M,QAAAA,aAAa,EAAE+M,SAAS,GAAG,KAAK,GAAG,MAAM;AACzCrF,QAAAA,MAAM,EAAEnD,SAAS;AACjBzD,QAAAA,MAAM,EAAE,CAAC;AACTC,QAAAA,GAAG,EAAE,MAAM;AACXe,QAAAA,MAAM,EAAEmE,iBAAAA;AACV,OAAA;KACIqI,EAAAA,sBAAsB,CAACrM,kBAAkB,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
|
|
|
@@ -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","_objectSpread","tabIndex","makeAnalyticsAttribute","IconButton","React","forwardRef"],"mappings":";;;;;;;;;;;
|
|
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","_objectSpread","tabIndex","makeAnalyticsAttribute","IconButton","React","forwardRef"],"mappings":";;;;;;;;;;;AAkEA;AACA;AACA;AACA;AACA,IAAMA,WAA6E,GAAG,SAAhFA,WAA6EA,CAAAC,IAAA,EAoBjFC,GAAG,EACA;AAAA,EAAA,IAnBDC,IAAI,GAAAF,IAAA,CAAJE,IAAI;IACJC,OAAO,GAAAH,IAAA,CAAPG,OAAO;IAAAC,SAAA,GAAAJ,IAAA,CACPK,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,QAAQ,GAAAA,SAAA;IAAAE,aAAA,GAAAN,IAAA,CACfO,QAAQ;AAARA,IAAAA,QAAQ,GAAAD,aAAA,KAAG,KAAA,CAAA,GAAA,SAAS,GAAAA,aAAA;IACpBE,kBAAkB,GAAAR,IAAA,CAAlBQ,kBAAkB;IAClBC,UAAU,GAAAT,IAAA,CAAVS,UAAU;IACVC,MAAM,GAAAV,IAAA,CAANU,MAAM;IACNC,OAAO,GAAAX,IAAA,CAAPW,OAAO;IACPC,YAAY,GAAAZ,IAAA,CAAZY,YAAY;IACZC,W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11
|
import '../../../utils/logger/index.js';
|
|
12
12
|
import getIn from '../../../utils/lodashButBetter/get.js';
|
|
13
13
|
import '../../../utils/makeAnalyticsAttribute/index.js';
|
|
14
|
+
import '../../Box/styledProps/index.js';
|
|
14
15
|
import { jsx } from 'react/jsx-runtime';
|
|
16
|
+
import { useStyledProps } from '../../Box/styledProps/useStyledProps.js';
|
|
15
17
|
import { throwBladeError } from '../../../utils/logger/logger.js';
|
|
16
18
|
import { makeSize } from '../../../utils/makeSize/makeSize.js';
|
|
17
19
|
import { castWebType } from '../../../utils/platform/castUtils.js';
|
|
@@ -32,6 +34,7 @@ var StyledButton = /*#__PURE__*/styled.button.withConfig({
|
|
|
32
34
|
var theme = props.theme,
|
|
33
35
|
emphasis = props.emphasis;
|
|
34
36
|
var motionToken = theme.motion;
|
|
37
|
+
var styledPropsCSSObject = useStyledProps(props);
|
|
35
38
|
var emphasisColor = emphasis === 'intense' ? 'gray' : 'staticWhite';
|
|
36
39
|
if (false) {
|
|
37
40
|
if (props.$size === 'large' && props.$isHighlighted) {
|
|
@@ -42,7 +45,7 @@ var StyledButton = /*#__PURE__*/styled.button.withConfig({
|
|
|
42
45
|
return null;
|
|
43
46
|
}
|
|
44
47
|
}
|
|
45
|
-
return {
|
|
48
|
+
return _objectSpread({
|
|
46
49
|
border: 'none',
|
|
47
50
|
cursor: props.disabled ? 'not-allowed' : 'pointer',
|
|
48
51
|
padding: 0,
|
|
@@ -71,7 +74,7 @@ var StyledButton = /*#__PURE__*/styled.button.withConfig({
|
|
|
71
74
|
'&:active': {
|
|
72
75
|
color: theme.colors.interactive.icon[emphasisColor].subtle
|
|
73
76
|
}
|
|
74
|
-
};
|
|
77
|
+
}, styledPropsCSSObject);
|
|
75
78
|
});
|
|
76
79
|
var StyledIconButton = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
77
80
|
var Icon = _ref.icon,
|
|
@@ -92,7 +95,7 @@ var StyledIconButton = /*#__PURE__*/React__default.forwardRef(function (_ref, re
|
|
|
92
95
|
onTouchStart = _ref.onTouchStart,
|
|
93
96
|
tabIndex = _ref.tabIndex,
|
|
94
97
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
95
|
-
return /*#__PURE__*/jsx(StyledButton, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
98
|
+
return /*#__PURE__*/jsx(StyledButton, _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
96
99
|
ref: ref,
|
|
97
100
|
onClick: castWebType(onClick),
|
|
98
101
|
emphasis: emphasis,
|
|
@@ -114,7 +117,7 @@ var StyledIconButton = /*#__PURE__*/React__default.forwardRef(function (_ref, re
|
|
|
114
117
|
})), metaAttribute({
|
|
115
118
|
name: MetaConstants.IconButton,
|
|
116
119
|
testID: testID
|
|
117
|
-
})), makeAnalyticsAttribute(rest)), {}, {
|
|
120
|
+
})), makeAnalyticsAttribute(rest)), rest), {}, {
|
|
118
121
|
children: /*#__PURE__*/jsx(Icon, {
|
|
119
122
|
size: size,
|
|
120
123
|
color: isDisabled ? 'interactive.icon.gray.disabled' : 'currentColor'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StyledIconButton.web.js","sources":["../../../../../../../src/components/Button/IconButton/StyledIconButton.web.tsx"],"sourcesContent":["/* eslint-disable react/display-name */\nimport styled from 'styled-components';\nimport type { ReactElement } from 'react';\nimport React from 'react';\nimport type { StyledIconButtonProps } from './types';\nimport { highlightedButtonSizeMap, highlightedHoverColorMap } from './tokens';\nimport { castWebType, makeSize } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { SubtleOrIntense } from '~tokens/theme/theme';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { makeMotionTime } from '~utils/makeMotionTime';\nimport { getFocusRingStyles } from '~utils/getFocusRingStyles';\nimport { throwBladeError } from '~utils/logger';\nimport getIn from '~utils/lodashButBetter/get';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype StyledButtonProps = {\n emphasis: SubtleOrIntense;\n $isHighlighted: StyledIconButtonProps['isHighlighted'];\n $size: StyledIconButtonProps['size'];\n};\n\nconst StyledButton = styled.button<StyledButtonProps>((props) => {\n const { theme, emphasis } = props;\n const motionToken = theme.motion;\n
|
|
1
|
+
{"version":3,"file":"StyledIconButton.web.js","sources":["../../../../../../../src/components/Button/IconButton/StyledIconButton.web.tsx"],"sourcesContent":["/* eslint-disable react/display-name */\nimport styled from 'styled-components';\nimport type { ReactElement } from 'react';\nimport React from 'react';\nimport type { StyledIconButtonProps } from './types';\nimport { highlightedButtonSizeMap, highlightedHoverColorMap } from './tokens';\nimport { castWebType, makeSize } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { SubtleOrIntense } from '~tokens/theme/theme';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { makeMotionTime } from '~utils/makeMotionTime';\nimport { getFocusRingStyles } from '~utils/getFocusRingStyles';\nimport { throwBladeError } from '~utils/logger';\nimport getIn from '~utils/lodashButBetter/get';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport { useStyledProps } from '~components/Box/styledProps';\n\ntype StyledButtonProps = {\n emphasis: SubtleOrIntense;\n $isHighlighted: StyledIconButtonProps['isHighlighted'];\n $size: StyledIconButtonProps['size'];\n};\n\nconst StyledButton = styled.button<StyledButtonProps>((props) => {\n const { theme, emphasis } = props;\n const motionToken = theme.motion;\n const styledPropsCSSObject = useStyledProps(props);\n const emphasisColor = emphasis === 'intense' ? 'gray' : 'staticWhite';\n\n if (__DEV__) {\n if (props.$size === 'large' && props.$isHighlighted) {\n throwBladeError({\n moduleName: 'IconButton',\n message: 'size large is not allowed with isHighlighted true',\n });\n return null;\n }\n }\n\n return {\n border: 'none',\n cursor: props.disabled ? 'not-allowed' : 'pointer',\n padding: 0,\n height: props.$isHighlighted\n ? // We throw error for size large on top\n makeSize(highlightedButtonSizeMap[props.$size as 'small' | 'medium'])\n : undefined,\n width: props.$isHighlighted\n ? makeSize(highlightedButtonSizeMap[props.$size as 'small' | 'medium'])\n : undefined,\n borderRadius: props.$isHighlighted ? theme.border.radius.round : theme.border.radius.small,\n background: 'transparent',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n color: props.disabled\n ? theme.colors.interactive.icon[emphasisColor].disabled\n : theme.colors.interactive.icon[emphasisColor].muted,\n transitionProperty: 'color, box-shadow',\n transitionDuration: castWebType(makeMotionTime(motionToken.duration.xquick)),\n transitionTimingFunction: motionToken.easing.standard as string,\n\n '&:hover:not([disabled])': {\n color: theme.colors.interactive.icon[emphasisColor].subtle,\n backgroundColor: props.$isHighlighted\n ? getIn(theme.colors, highlightedHoverColorMap[emphasis])\n : 'transparent',\n },\n\n '&:focus-visible': {\n ...getFocusRingStyles({ theme }),\n color: theme.colors.interactive.icon[emphasisColor].subtle,\n },\n\n '&:active': {\n color: theme.colors.interactive.icon[emphasisColor].subtle,\n },\n ...styledPropsCSSObject,\n };\n});\n\nconst StyledIconButton = React.forwardRef<HTMLButtonElement, StyledIconButtonProps>(\n (\n {\n icon: Icon,\n onClick,\n size,\n emphasis,\n accessibilityLabel,\n isDisabled,\n isHighlighted,\n testID,\n onBlur,\n onFocus,\n onMouseLeave,\n onMouseMove,\n onPointerDown,\n onPointerEnter,\n onTouchEnd,\n onTouchStart,\n tabIndex,\n ...rest\n },\n ref,\n ): ReactElement => (\n <StyledButton\n ref={ref}\n onClick={castWebType(onClick)}\n emphasis={emphasis}\n type=\"button\"\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 disabled={isDisabled}\n $isHighlighted={isHighlighted}\n $size={size}\n tabIndex={tabIndex}\n {...makeAccessible({ label: accessibilityLabel })}\n {...metaAttribute({ name: MetaConstants.IconButton, testID })}\n {...makeAnalyticsAttribute(rest)}\n {...rest}\n >\n <Icon size={size} color={isDisabled ? 'interactive.icon.gray.disabled' : 'currentColor'} />\n </StyledButton>\n ),\n);\n\nexport default StyledIconButton;\n"],"names":["StyledButton","styled","button","withConfig","displayName","componentId","props","theme","emphasis","motionToken","motion","styledPropsCSSObject","useStyledProps","emphasisColor","$size","$isHighlighted","throwBladeError","moduleName","message","_objectSpread","border","cursor","disabled","padding","height","makeSize","highlightedButtonSizeMap","undefined","width","borderRadius","radius","round","small","background","display","alignItems","justifyContent","color","colors","interactive","icon","muted","transitionProperty","transitionDuration","castWebType","makeMotionTime","duration","xquick","transitionTimingFunction","easing","standard","subtle","backgroundColor","getIn","highlightedHoverColorMap","getFocusRingStyles","StyledIconButton","React","forwardRef","_ref","ref","Icon","onClick","size","accessibilityLabel","isDisabled","isHighlighted","testID","onBlur","onFocus","onMouseLeave","onMouseMove","onPointerDown","onPointerEnter","onTouchEnd","onTouchStart","tabIndex","rest","_objectWithoutProperties","_excluded","_jsx","type","makeAccessible","label","metaAttribute","name","MetaConstants","IconButton","makeAnalyticsAttribute","children"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,IAAMA,YAAY,gBAAGC,MAAM,CAACC,MAAM,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,mCAAA;EAAAC,WAAA,EAAA,cAAA;AAAA,CAAoB,CAAA,CAAA,UAACC,KAAK,EAAK;AAC/D,EAAA,IAAQC,KAAK,GAAeD,KAAK,CAAzBC,KAAK;IAAEC,QAAQ,GAAKF,KAAK,CAAlBE,QAAQ,CAAA;AACvB,EAAA,IAAMC,WAAW,GAAGF,KAAK,CAACG,MAAM,CAAA;AAChC,EAAA,IAAMC,oBAAoB,GAAGC,cAAc,CAACN,KAAK,CAAC,CAAA;EAClD,IAAMO,aAAa,GAAGL,QAAQ,KAAK,SAAS,GAAG,MAAM,GAAG,aAAa,CAAA;AAErE,EAAA,IAAI,KAAO,EAAE;IACX,IAAIF,KAAK,CAACQ,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