@razorpay/blade 11.39.0 → 11.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lib/native/components/ActionList/ActionList.js +1 -1
- package/build/lib/native/components/ActionList/ActionList.js.map +1 -1
- package/build/lib/native/components/ActionList/ActionListBox.native.js +1 -1
- package/build/lib/native/components/ActionList/ActionListBox.native.js.map +1 -1
- package/build/lib/native/components/ActionList/ActionListItem.js +2 -1
- package/build/lib/native/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/native/components/ActionList/styles/getBaseListBoxWrapperStyles.js +2 -2
- package/build/lib/native/components/ActionList/styles/getBaseListBoxWrapperStyles.js.map +1 -1
- package/build/lib/native/components/BaseMenu/BaseMenuItem/BaseMenuItem.js +2 -2
- package/build/lib/native/components/BaseMenu/BaseMenuItem/BaseMenuItem.js.map +1 -1
- package/build/lib/native/components/BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js +2 -1
- package/build/lib/native/components/BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js.map +1 -1
- package/build/lib/native/components/BaseMenu/BaseMenuItem/tokens.js +8 -0
- package/build/lib/native/components/BaseMenu/BaseMenuItem/tokens.js.map +1 -0
- package/build/lib/native/utils/useCallbackRef.js +3 -2
- package/build/lib/native/utils/useCallbackRef.js.map +1 -1
- package/build/lib/web/development/components/ActionList/ActionList.js +6 -4
- package/build/lib/web/development/components/ActionList/ActionList.js.map +1 -1
- package/build/lib/web/development/components/ActionList/ActionListBox.web.js +114 -3
- package/build/lib/web/development/components/ActionList/ActionListBox.web.js.map +1 -1
- package/build/lib/web/development/components/ActionList/ActionListItem.js +57 -60
- package/build/lib/web/development/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/web/development/components/ActionList/styles/getBaseListBoxWrapperStyles.js +8 -4
- package/build/lib/web/development/components/ActionList/styles/getBaseListBoxWrapperStyles.js.map +1 -1
- package/build/lib/web/development/components/BaseMenu/BaseMenuItem/BaseMenuItem.js +6 -7
- package/build/lib/web/development/components/BaseMenu/BaseMenuItem/BaseMenuItem.js.map +1 -1
- package/build/lib/web/development/components/BaseMenu/BaseMenuItem/StyledMenuItemContainer.web.js +3 -2
- package/build/lib/web/development/components/BaseMenu/BaseMenuItem/StyledMenuItemContainer.web.js.map +1 -1
- package/build/lib/web/development/components/BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js +3 -2
- package/build/lib/web/development/components/BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js.map +1 -1
- package/build/lib/web/development/components/BaseMenu/BaseMenuItem/tokens.js +26 -0
- package/build/lib/web/development/components/BaseMenu/BaseMenuItem/tokens.js.map +1 -0
- package/build/lib/web/development/utils/useCallbackRef.js +11 -5
- package/build/lib/web/development/utils/useCallbackRef.js.map +1 -1
- package/build/lib/web/production/components/ActionList/ActionList.js +6 -4
- package/build/lib/web/production/components/ActionList/ActionList.js.map +1 -1
- package/build/lib/web/production/components/ActionList/ActionListBox.web.js +114 -3
- package/build/lib/web/production/components/ActionList/ActionListBox.web.js.map +1 -1
- package/build/lib/web/production/components/ActionList/ActionListItem.js +57 -60
- package/build/lib/web/production/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/web/production/components/ActionList/styles/getBaseListBoxWrapperStyles.js +8 -4
- package/build/lib/web/production/components/ActionList/styles/getBaseListBoxWrapperStyles.js.map +1 -1
- package/build/lib/web/production/components/BaseMenu/BaseMenuItem/BaseMenuItem.js +6 -7
- package/build/lib/web/production/components/BaseMenu/BaseMenuItem/BaseMenuItem.js.map +1 -1
- package/build/lib/web/production/components/BaseMenu/BaseMenuItem/StyledMenuItemContainer.web.js +3 -2
- package/build/lib/web/production/components/BaseMenu/BaseMenuItem/StyledMenuItemContainer.web.js.map +1 -1
- package/build/lib/web/production/components/BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js +3 -2
- package/build/lib/web/production/components/BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js.map +1 -1
- package/build/lib/web/production/components/BaseMenu/BaseMenuItem/tokens.js +26 -0
- package/build/lib/web/production/components/BaseMenu/BaseMenuItem/tokens.js.map +1 -0
- package/build/lib/web/production/utils/useCallbackRef.js +11 -5
- package/build/lib/web/production/utils/useCallbackRef.js.map +1 -1
- package/build/types/components/index.d.ts +2 -1
- package/build/types/components/index.native.d.ts +2 -1
- package/package.json +4 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseMenuItem.js","sources":["../../../../../../../src/components/BaseMenu/BaseMenuItem/BaseMenuItem.tsx"],"sourcesContent":["import React from 'react';\nimport type { BaseMenuItemProps } from '../types';\nimport { BaseMenuItemContext } from '../BaseMenuContext';\nimport { StyledMenuItemContainer } from './StyledMenuItemContainer';\nimport {
|
|
1
|
+
{"version":3,"file":"BaseMenuItem.js","sources":["../../../../../../../src/components/BaseMenu/BaseMenuItem/BaseMenuItem.tsx"],"sourcesContent":["import React from 'react';\nimport type { BaseMenuItemProps } from '../types';\nimport { BaseMenuItemContext } from '../BaseMenuContext';\nimport { StyledMenuItemContainer } from './StyledMenuItemContainer';\nimport { itemFirstRowHeight } from './tokens';\nimport { Box } from '~components/Box';\nimport { getTextProps, Text } from '~components/Typography';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport type { BladeElementRef } from '~utils/types';\nimport { BaseText } from '~components/Typography/BaseText';\nimport { useTruncationTitle } from '~utils/useTruncationTitle';\nimport { makeSize } from '~utils';\n\nconst menuItemTitleColor = {\n negative: {\n default: 'feedback.text.negative.intense',\n disabled: 'interactive.text.gray.disabled',\n },\n normal: { default: 'interactive.text.gray.normal', disabled: 'interactive.text.gray.disabled' },\n} as const;\n\nconst menuItemDescriptionColor = {\n default: 'interactive.text.gray.muted',\n disabled: 'interactive.text.gray.disabled',\n} as const;\n\n// This is the height of item excluding the description to make sure description comes at the bottom and other first row items are center aligned\n\nconst _BaseMenuItem: React.ForwardRefRenderFunction<BladeElementRef, BaseMenuItemProps> = (\n {\n title,\n description,\n as,\n leading,\n trailing,\n titleSuffix,\n isDisabled,\n selectionType = 'single',\n isSelected,\n isVisible = true,\n color,\n role = 'menuitem',\n children,\n ...props\n },\n ref,\n): React.ReactElement => {\n const { containerRef, textRef } = useTruncationTitle({ content: title });\n return (\n <BaseMenuItemContext.Provider value={{ color, isDisabled }}>\n <StyledMenuItemContainer\n ref={ref as never}\n as={as}\n type=\"button\"\n disabled={isDisabled}\n {...makeAccessible({\n role,\n current: role === 'menuitem' || role === 'menuitemcheckbox' ? isSelected : undefined,\n disabled: isDisabled,\n selected: isSelected,\n })}\n color={color}\n isVisible={isVisible}\n isSelected={isSelected}\n isDisabled={isDisabled}\n selectionType={selectionType}\n {...props}\n >\n {children ? (\n children\n ) : (\n <Box display=\"flex\" alignItems=\"flex-start\" width=\"100%\" justifyContent=\"flex-start\">\n <Box\n display=\"flex\"\n justifyContent=\"center\"\n alignItems=\"center\"\n height={makeSize(itemFirstRowHeight)}\n >\n {leading}\n </Box>\n <Box\n paddingLeft={leading ? 'spacing.3' : 'spacing.0'}\n paddingRight=\"spacing.3\"\n display=\"flex\"\n flexDirection=\"column\"\n >\n <Box\n display=\"flex\"\n alignItems=\"center\"\n flexDirection=\"row\"\n height={makeSize(itemFirstRowHeight)}\n ref={containerRef as never}\n >\n <BaseText\n as=\"p\"\n ref={textRef as never}\n truncateAfterLines={1}\n wordBreak=\"break-all\"\n {...getTextProps({\n size: 'medium',\n color:\n menuItemTitleColor[color === 'negative' ? 'negative' : 'normal'][\n isDisabled ? 'disabled' : 'default'\n ],\n weight: 'regular',\n })}\n >\n {title}\n </BaseText>\n {titleSuffix}\n </Box>\n <Box>\n {description ? (\n <Text\n color={menuItemDescriptionColor[isDisabled ? 'disabled' : 'default']}\n size=\"small\"\n >\n {description}\n </Text>\n ) : null}\n </Box>\n </Box>\n <Box marginLeft=\"auto\">{trailing}</Box>\n </Box>\n )}\n </StyledMenuItemContainer>\n </BaseMenuItemContext.Provider>\n );\n};\n\nconst BaseMenuItem = React.forwardRef(_BaseMenuItem);\n\nexport { BaseMenuItem };\n"],"names":["menuItemTitleColor","negative","disabled","normal","menuItemDescriptionColor","_BaseMenuItem","_ref","ref","title","description","as","leading","trailing","titleSuffix","isDisabled","_ref$selectionType","selectionType","isSelected","_ref$isVisible","isVisible","color","_ref$role","role","children","props","_objectWithoutProperties","_excluded","_useTruncationTitle","useTruncationTitle","content","containerRef","textRef","_jsx","BaseMenuItemContext","Provider","value","StyledMenuItemContainer","_objectSpread","type","makeAccessible","current","undefined","selected","_jsxs","Box","display","alignItems","width","justifyContent","height","makeSize","itemFirstRowHeight","paddingLeft","paddingRight","flexDirection","BaseText","truncateAfterLines","wordBreak","getTextProps","size","weight","Text","marginLeft","BaseMenuItem","React","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAaA,IAAMA,kBAAkB,GAAG;AACzBC,EAAAA,QAAQ,EAAE;AACR,IAAA,SAAA,EAAS,gCAAgC;AACzCC,IAAAA,QAAQ,EAAE,gCAAA;GACX;AACDC,EAAAA,MAAM,EAAE;AAAE,IAAA,SAAA,EAAS,8BAA8B;AAAED,IAAAA,QAAQ,EAAE,gCAAA;AAAiC,GAAA;AAChG,CAAU,CAAA;AAEV,IAAME,wBAAwB,GAAG;AAC/B,EAAA,SAAA,EAAS,6BAA6B;AACtCF,EAAAA,QAAQ,EAAE,gCAAA;AACZ,CAAU,CAAA;;AAEV;;AAEA,IAAMG,aAAiF,GAAG,SAApFA,aAAiFA,CAAAC,IAAA,EAiBrFC,GAAG,EACoB;AAAA,EAAA,IAhBrBC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,WAAW,GAAAH,IAAA,CAAXG,WAAW;IACXC,EAAE,GAAAJ,IAAA,CAAFI,EAAE;IACFC,OAAO,GAAAL,IAAA,CAAPK,OAAO;IACPC,QAAQ,GAAAN,IAAA,CAARM,QAAQ;IACRC,WAAW,GAAAP,IAAA,CAAXO,WAAW;IACXC,UAAU,GAAAR,IAAA,CAAVQ,UAAU;IAAAC,kBA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enuItemContainer.web.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { getBaseMenuItemStyles } from './getBaseMenuItemStyles.js';
|
|
4
|
+
import { getItemPadding } from './tokens.js';
|
|
4
5
|
import '../../../utils/index.js';
|
|
5
6
|
import '../../../utils/getFocusRingStyles/index.js';
|
|
6
7
|
import '../../Box/BaseBox/index.js';
|
|
@@ -18,12 +19,12 @@ var StyledMenuItemContainer = /*#__PURE__*/styled(BaseBox).withConfig({
|
|
|
18
19
|
return _objectSpread(_objectSpread({}, getBaseMenuItemStyles({
|
|
19
20
|
theme: props.theme
|
|
20
21
|
})), {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
21
|
-
padding: makeSize(props.theme.
|
|
22
|
+
padding: makeSize(getItemPadding(props.theme).itemPaddingMobile),
|
|
22
23
|
display: props.isVisible ? 'flex' : 'none'
|
|
23
24
|
}, "@media ".concat(getMediaQuery({
|
|
24
25
|
min: props.theme.breakpoints.m
|
|
25
26
|
})), {
|
|
26
|
-
padding: makeSize(props.theme.
|
|
27
|
+
padding: makeSize(getItemPadding(props.theme).itemPaddingDesktop)
|
|
27
28
|
}), '&:hover:not([aria-disabled=true]), &[aria-expanded="true"]', {
|
|
28
29
|
backgroundColor: props.color === 'negative' ? props.theme.colors.interactive.background.negative.faded : props.theme.colors.interactive.background.gray["default"]
|
|
29
30
|
}), '&:focus-visible', getFocusRingStyles({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StyledMenuItemContainer.web.js","sources":["../../../../../../../src/components/BaseMenu/BaseMenuItem/StyledMenuItemContainer.web.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport type { StyledBaseMenuItemContainerProps } from '../types';\nimport { getBaseMenuItemStyles } from './getBaseMenuItemStyles';\nimport { getMediaQuery, makeSize } from '~utils';\nimport { getFocusRingStyles } from '~utils/getFocusRingStyles';\nimport BaseBox from '~components/Box/BaseBox';\n\nconst StyledMenuItemContainer = styled(BaseBox)<StyledBaseMenuItemContainerProps>((props) => {\n return {\n ...getBaseMenuItemStyles({ theme: props.theme }),\n padding: makeSize(props.theme.
|
|
1
|
+
{"version":3,"file":"StyledMenuItemContainer.web.js","sources":["../../../../../../../src/components/BaseMenu/BaseMenuItem/StyledMenuItemContainer.web.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport type { StyledBaseMenuItemContainerProps } from '../types';\nimport { getBaseMenuItemStyles } from './getBaseMenuItemStyles';\nimport { getItemPadding } from './tokens';\nimport { getMediaQuery, makeSize } from '~utils';\nimport { getFocusRingStyles } from '~utils/getFocusRingStyles';\nimport BaseBox from '~components/Box/BaseBox';\n\nconst StyledMenuItemContainer = styled(BaseBox)<StyledBaseMenuItemContainerProps>((props) => {\n return {\n ...getBaseMenuItemStyles({ theme: props.theme }),\n padding: makeSize(getItemPadding(props.theme).itemPaddingMobile),\n display: props.isVisible ? 'flex' : 'none',\n [`@media ${getMediaQuery({ min: props.theme.breakpoints.m })}`]: {\n padding: makeSize(getItemPadding(props.theme).itemPaddingDesktop),\n },\n '&:hover:not([aria-disabled=true]), &[aria-expanded=\"true\"]': {\n backgroundColor:\n props.color === 'negative'\n ? props.theme.colors.interactive.background.negative.faded\n : props.theme.colors.interactive.background.gray.default,\n },\n '&:focus-visible': getFocusRingStyles({ theme: props.theme }),\n '&.active-focus': props.isKeydownPressed\n ? getFocusRingStyles({ theme: props.theme })\n : undefined,\n '&[aria-selected=true]': {\n backgroundColor:\n props.selectionType === 'single'\n ? props.theme.colors.interactive.background.primary.faded\n : undefined,\n },\n '&[aria-selected=true]:hover': {\n backgroundColor: props.theme.colors.interactive.background.primary.fadedHighlighted,\n },\n };\n});\n\nexport { StyledMenuItemContainer };\n"],"names":["StyledMenuItemContainer","styled","BaseBox","withConfig","displayName","componentId","props","_objectSpread","getBaseMenuItemStyles","theme","_defineProperty","padding","makeSize","getItemPadding","itemPaddingMobile","display","isVisible","concat","getMediaQuery","min","breakpoints","m","itemPaddingDesktop","backgroundColor","color","colors","interactive","background","negative","faded","gray","getFocusRingStyles","isKeydownPressed","undefined","selectionType","primary","fadedHighlighted"],"mappings":";;;;;;;;;;;;;;AAQA,IAAMA,uBAAuB,gBAAGC,MAAM,CAACC,OAAO,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,qDAAA;EAAAC,WAAA,EAAA,UAAA;AAAA,CAAmC,CAAA,CAAA,UAACC,KAAK,EAAK;AAC3F,EAAA,OAAAC,aAAA,CAAAA,aAAA,CAAA,EAAA,EACKC,qBAAqB,CAAC;IAAEC,KAAK,EAAEH,KAAK,CAACG,KAAAA;AAAM,GAAC,CAAC,CAAA,EAAA,EAAA,EAAAC,eAAA,CAAAA,eAAA,CAAAA,eAAA,CAAAA,eAAA,CAAAA,eAAA,CAAAA,eAAA,CAAA;IAChDC,OAAO,EAAEC,QAAQ,CAACC,cAAc,CAACP,KAAK,CAACG,KAAK,CAAC,CAACK,iBAAiB,CAAC;AAChEC,IAAAA,OAAO,EAAET,KAAK,CAACU,SAAS,GAAG,MAAM,GAAG,MAAA;GAAMC,EAAAA,SAAAA,CAAAA,MAAA,CAC/BC,aAAa,CAAC;AAAEC,IAAAA,GAAG,EAAEb,KAAK,CAACG,KAAK,CAACW,WAAW,CAACC,CAAAA;AAAE,GAAC,CAAC,CAAK,EAAA;IAC/DV,OAAO,EAAEC,QAAQ,CAACC,cAAc,CAACP,KAAK,CAACG,KAAK,CAAC,CAACa,kBAAkB,CAAA;GACjE,CAAA,EACD,4DAA4D,EAAE;AAC5DC,IAAAA,eAAe,EACbjB,KAAK,CAACkB,KAAK,KAAK,UAAU,GACtBlB,KAAK,CAACG,KAAK,CAACgB,MAAM,CAACC,WAAW,CAACC,UAAU,CAACC,QAAQ,CAACC,KAAK,GACxDvB,KAAK,CAACG,KAAK,CAACgB,MAAM,CAACC,WAAW,CAACC,UAAU,CAACG,IAAI,CAAA,SAAA,CAAA;AACtD,GAAC,CACD,EAAA,iBAAiB,EAAEC,kBAAkB,CAAC;IAAEtB,KAAK,EAAEH,KAAK,CAACG,KAAAA;GAAO,CAAC,GAC7D,gBAAgB,EAAEH,KAAK,CAAC0B,gBAAgB,GACpCD,kBAAkB,CAAC;IAAEtB,KAAK,EAAEH,KAAK,CAACG,KAAAA;AAAM,GAAC,CAAC,GAC1CwB,SAAS,CAAA,EACb,uBAAuB,EAAE;IACvBV,eAAe,EACbjB,KAAK,CAAC4B,aAAa,KAAK,QAAQ,GAC5B5B,KAAK,CAACG,KAAK,CAACgB,MAAM,CAACC,WAAW,CAACC,UAAU,CAACQ,OAAO,CAACN,KAAK,GACvDI,SAAAA;GACP,CAAA,EACD,6BAA6B,EAAE;AAC7BV,IAAAA,eAAe,EAAEjB,KAAK,CAACG,KAAK,CAACgB,MAAM,CAACC,WAAW,CAACC,UAAU,CAACQ,OAAO,CAACC,gBAAAA;GACpE,CAAA,CAAA,CAAA;AAEL,CAAC;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getItemMargin } from './tokens.js';
|
|
1
2
|
import '../../../utils/index.js';
|
|
2
3
|
import '../../../utils/makeSize/index.js';
|
|
3
4
|
import { makeBorderSize } from '../../../utils/makeBorderSize/makeBorderSize.js';
|
|
@@ -12,8 +13,8 @@ var getBaseMenuItemStyles = function getBaseMenuItemStyles(props) {
|
|
|
12
13
|
textAlign: isReactNative() ? undefined : 'left',
|
|
13
14
|
backgroundColor: 'transparent',
|
|
14
15
|
borderRadius: makeSize(props.theme.border.radius.medium),
|
|
15
|
-
marginTop: makeSize(props.theme
|
|
16
|
-
marginBottom: makeSize(props.theme
|
|
16
|
+
marginTop: makeSize(getItemMargin(props.theme)),
|
|
17
|
+
marginBottom: makeSize(getItemMargin(props.theme)),
|
|
17
18
|
textDecoration: 'none',
|
|
18
19
|
cursor: 'pointer',
|
|
19
20
|
width: '100%'
|
package/build/lib/web/development/components/BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBaseMenuItemStyles.js","sources":["../../../../../../../src/components/BaseMenu/BaseMenuItem/getBaseMenuItemStyles.ts"],"sourcesContent":["import type { CSSObject } from 'styled-components';\nimport type { Theme } from '~components/BladeProvider';\nimport { isReactNative, makeBorderSize } from '~utils';\nimport { makeSize } from '~utils/makeSize';\n\nconst getBaseMenuItemStyles = (props: { theme: Theme }): CSSObject => {\n return {\n borderWidth: makeBorderSize(props.theme.border.width.none),\n display: 'flex',\n flexDirection: 'column',\n textAlign: isReactNative() ? undefined : 'left',\n backgroundColor: 'transparent',\n borderRadius: makeSize(props.theme.border.radius.medium),\n marginTop: makeSize(props.theme
|
|
1
|
+
{"version":3,"file":"getBaseMenuItemStyles.js","sources":["../../../../../../../src/components/BaseMenu/BaseMenuItem/getBaseMenuItemStyles.ts"],"sourcesContent":["import type { CSSObject } from 'styled-components';\nimport { getItemMargin } from './tokens';\nimport type { Theme } from '~components/BladeProvider';\nimport { isReactNative, makeBorderSize } from '~utils';\nimport { makeSize } from '~utils/makeSize';\n\nconst getBaseMenuItemStyles = (props: { theme: Theme }): CSSObject => {\n return {\n borderWidth: makeBorderSize(props.theme.border.width.none),\n display: 'flex',\n flexDirection: 'column',\n textAlign: isReactNative() ? undefined : 'left',\n backgroundColor: 'transparent',\n borderRadius: makeSize(props.theme.border.radius.medium),\n marginTop: makeSize(getItemMargin(props.theme)),\n marginBottom: makeSize(getItemMargin(props.theme)),\n textDecoration: 'none',\n cursor: 'pointer',\n width: '100%',\n };\n};\n\nexport { getBaseMenuItemStyles };\n"],"names":["getBaseMenuItemStyles","props","borderWidth","makeBorderSize","theme","border","width","none","display","flexDirection","textAlign","isReactNative","undefined","backgroundColor","borderRadius","makeSize","radius","medium","marginTop","getItemMargin","marginBottom","textDecoration","cursor"],"mappings":";;;;;;;AAMA,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAIC,KAAuB,EAAgB;EACpE,OAAO;AACLC,IAAAA,WAAW,EAAEC,cAAc,CAACF,KAAK,CAACG,KAAK,CAACC,MAAM,CAACC,KAAK,CAACC,IAAI,CAAC;AAC1DC,IAAAA,OAAO,EAAE,MAAM;AACfC,IAAAA,aAAa,EAAE,QAAQ;AACvBC,IAAAA,SAAS,EAAEC,aAAa,EAAE,GAAGC,SAAS,GAAG,MAAM;AAC/CC,IAAAA,eAAe,EAAE,aAAa;AAC9BC,IAAAA,YAAY,EAAEC,QAAQ,CAACd,KAAK,CAACG,KAAK,CAACC,MAAM,CAACW,MAAM,CAACC,MAAM,CAAC;IACxDC,SAAS,EAAEH,QAAQ,CAACI,aAAa,CAAClB,KAAK,CAACG,KAAK,CAAC,CAAC;IAC/CgB,YAAY,EAAEL,QAAQ,CAACI,aAAa,CAAClB,KAAK,CAACG,KAAK,CAAC,CAAC;AAClDiB,IAAAA,cAAc,EAAE,MAAM;AACtBC,IAAAA,MAAM,EAAE,SAAS;AACjBhB,IAAAA,KAAK,EAAE,MAAA;GACR,CAAA;AACH;;;;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import '../../../tokens/global/index.js';
|
|
2
|
+
import { size } from '../../../tokens/global/size.js';
|
|
3
|
+
|
|
4
|
+
var itemFirstRowHeight = size[20];
|
|
5
|
+
var getItemPadding = function getItemPadding(theme) {
|
|
6
|
+
return {
|
|
7
|
+
itemPaddingMobile: theme.spacing[2],
|
|
8
|
+
itemPaddingDesktop: theme.spacing[3]
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
var getItemMargin = function getItemMargin(theme) {
|
|
12
|
+
return theme.spacing[1];
|
|
13
|
+
};
|
|
14
|
+
var getItemHeight = function getItemHeight(theme) {
|
|
15
|
+
return {
|
|
16
|
+
itemHeightMobile:
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
|
18
|
+
itemFirstRowHeight + getItemPadding(theme).itemPaddingMobile * 2 + getItemMargin(theme) * 2,
|
|
19
|
+
itemHeightDesktop:
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
|
21
|
+
itemFirstRowHeight + getItemPadding(theme).itemPaddingDesktop * 2 + getItemMargin(theme) * 2
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { getItemHeight, getItemMargin, getItemPadding, itemFirstRowHeight };
|
|
26
|
+
//# sourceMappingURL=tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","sources":["../../../../../../../src/components/BaseMenu/BaseMenuItem/tokens.ts"],"sourcesContent":["import type { Theme } from '~components/BladeProvider';\nimport { size } from '~tokens/global';\n\nconst itemFirstRowHeight = size[20];\n\nconst getItemPadding = (\n theme: Theme,\n): {\n itemPaddingMobile: 4;\n itemPaddingDesktop: 8;\n} => {\n return {\n itemPaddingMobile: theme.spacing[2],\n itemPaddingDesktop: theme.spacing[3],\n };\n};\n\nconst getItemMargin = (theme: Theme): number => {\n return theme.spacing[1];\n};\n\nconst getItemHeight = (\n theme: Theme,\n): {\n itemHeightMobile: number;\n itemHeightDesktop: number;\n} => {\n return {\n itemHeightMobile:\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands\n itemFirstRowHeight + getItemPadding(theme).itemPaddingMobile * 2 + getItemMargin(theme) * 2,\n itemHeightDesktop:\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands\n itemFirstRowHeight + getItemPadding(theme).itemPaddingDesktop * 2 + getItemMargin(theme) * 2,\n };\n};\n\nexport { itemFirstRowHeight, getItemPadding, getItemMargin, getItemHeight };\n"],"names":["itemFirstRowHeight","size","getItemPadding","theme","itemPaddingMobile","spacing","itemPaddingDesktop","getItemMargin","getItemHeight","itemHeightMobile","itemHeightDesktop"],"mappings":";;;AAGA,IAAMA,kBAAkB,GAAGC,IAAI,CAAC,EAAE,EAAC;AAEnC,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAClBC,KAAY,EAIT;EACH,OAAO;AACLC,IAAAA,iBAAiB,EAAED,KAAK,CAACE,OAAO,CAAC,CAAC,CAAC;AACnCC,IAAAA,kBAAkB,EAAEH,KAAK,CAACE,OAAO,CAAC,CAAC,CAAA;GACpC,CAAA;AACH,EAAC;AAED,IAAME,aAAa,GAAG,SAAhBA,aAAaA,CAAIJ,KAAY,EAAa;AAC9C,EAAA,OAAOA,KAAK,CAACE,OAAO,CAAC,CAAC,CAAC,CAAA;AACzB,EAAC;AAED,IAAMG,aAAa,GAAG,SAAhBA,aAAaA,CACjBL,KAAY,EAIT;EACH,OAAO;IACLM,gBAAgB;AACd;AACAT,IAAAA,kBAAkB,GAAGE,cAAc,CAACC,KAAK,CAAC,CAACC,iBAAiB,GAAG,CAAC,GAAGG,aAAa,CAACJ,KAAK,CAAC,GAAG,CAAC;IAC7FO,iBAAiB;AACf;AACAV,IAAAA,kBAAkB,GAAGE,cAAc,CAACC,KAAK,CAAC,CAACG,kBAAkB,GAAG,CAAC,GAAGC,aAAa,CAACJ,KAAK,CAAC,GAAG,CAAA;GAC9F,CAAA;AACH;;;;"}
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import { useRef,
|
|
1
|
+
import React__default, { useRef, useCallback } from 'react';
|
|
2
|
+
import { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect.js';
|
|
2
3
|
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
5
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
4
6
|
|
|
7
|
+
// Prevent webpack from importing this:
|
|
8
|
+
// https://github.com/webpack/webpack/issues/14814#issuecomment-1536757985
|
|
9
|
+
// https://github.com/radix-ui/primitives/issues/2796
|
|
10
|
+
var useReactInsertionEffect = React__default[' useInsertionEffect '.trim().toString()];
|
|
11
|
+
var useInsertionEffectFallback = useReactInsertionEffect || useIsomorphicLayoutEffect;
|
|
12
|
+
|
|
5
13
|
/**
|
|
6
14
|
* This hook is user-land implementation of the experimental `useEffectEvent` hook.
|
|
7
15
|
* React docs: https://react.dev/learn/separating-events-from-effects#declaring-an-effect-event
|
|
@@ -10,10 +18,8 @@ import { useRef, useInsertionEffect, useCallback } from 'react';
|
|
|
10
18
|
*/
|
|
11
19
|
function useCallbackRef(callback) {
|
|
12
20
|
var deps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
13
|
-
var callbackRef = useRef(
|
|
14
|
-
|
|
15
|
-
});
|
|
16
|
-
useInsertionEffect(function () {
|
|
21
|
+
var callbackRef = useRef(callback);
|
|
22
|
+
useInsertionEffectFallback(function () {
|
|
17
23
|
callbackRef.current = callback;
|
|
18
24
|
});
|
|
19
25
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCallbackRef.js","sources":["../../../../../src/utils/useCallbackRef.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/explicit-function-return-type */\nimport { useCallback,
|
|
1
|
+
{"version":3,"file":"useCallbackRef.js","sources":["../../../../../src/utils/useCallbackRef.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/explicit-function-return-type */\nimport React, { useCallback, useRef } from 'react';\nimport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';\n\n// Prevent webpack from importing this:\n// https://github.com/webpack/webpack/issues/14814#issuecomment-1536757985\n// https://github.com/radix-ui/primitives/issues/2796\nconst useReactInsertionEffect = (React as any)[' useInsertionEffect '.trim().toString()];\nconst useInsertionEffectFallback = useReactInsertionEffect || useIsomorphicLayoutEffect;\n\n/**\n * This hook is user-land implementation of the experimental `useEffectEvent` hook.\n * React docs: https://react.dev/learn/separating-events-from-effects#declaring-an-effect-event\n *\n * This hook is useful when you want to use a callback function inside a useEffect while keeping it \"fresh\" but you don't want to add it to the dependency array.\n */\nfunction useCallbackRef<Args extends unknown[], Return>(\n callback: ((...args: Args) => Return) | undefined,\n deps: React.DependencyList = [],\n) {\n const callbackRef = useRef<typeof callback>(callback);\n\n useInsertionEffectFallback(() => {\n callbackRef.current = callback;\n });\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return useCallback((...args: Args) => callbackRef.current?.(...args), deps);\n}\n\nexport { useCallbackRef };\n"],"names":["useReactInsertionEffect","React","trim","toString","useInsertionEffectFallback","useIsomorphicLayoutEffect","useCallbackRef","callback","deps","arguments","length","undefined","callbackRef","useRef","current","useCallback","_callbackRef$current","_len","args","Array","_key","call","apply","concat"],"mappings":";;;AAAA;AACA;;AAIA;AACA;AACA;AACA,IAAMA,uBAAuB,GAAIC,cAAK,CAAS,sBAAsB,CAACC,IAAI,EAAE,CAACC,QAAQ,EAAE,CAAC,CAAA;AACxF,IAAMC,0BAA0B,GAAGJ,uBAAuB,IAAIK,yBAAyB,CAAA;;AAEvF;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,cAAcA,CACrBC,QAAiD,EAEjD;AAAA,EAAA,IADAC,IAA0B,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,EAAE,CAAA;AAE/B,EAAA,IAAMG,WAAW,GAAGC,MAAM,CAAkBN,QAAQ,CAAC,CAAA;AAErDH,EAAAA,0BAA0B,CAAC,YAAM;IAC/BQ,WAAW,CAACE,OAAO,GAAGP,QAAQ,CAAA;AAChC,GAAC,CAAC,CAAA;;AAEF;AACA,EAAA,OAAOQ,WAAW,CAAC,YAAA;AAAA,IAAA,IAAAC,oBAAA,CAAA;AAAA,IAAA,KAAA,IAAAC,IAAA,GAAAR,SAAA,CAAAC,MAAA,EAAIQ,IAAI,GAAAC,IAAAA,KAAA,CAAAF,IAAA,GAAAG,IAAA,GAAA,CAAA,EAAAA,IAAA,GAAAH,IAAA,EAAAG,IAAA,EAAA,EAAA;AAAJF,MAAAA,IAAI,CAAAE,IAAA,CAAAX,GAAAA,SAAA,CAAAW,IAAA,CAAA,CAAA;AAAA,KAAA;IAAA,OAAAJ,CAAAA,oBAAA,GAAWJ,WAAW,CAACE,OAAO,MAAAE,IAAAA,IAAAA,oBAAA,uBAAnBA,oBAAA,CAAAK,IAAA,CAAAC,KAAA,CAAAN,oBAAA,EAAA,CAAAJ,WAAW,CAAAW,CAAAA,MAAA,CAAcL,IAAI,CAAC,CAAA,CAAA;AAAA,GAAA,EAAEV,IAAI,CAAC,CAAA;AAC7E;;;;"}
|
|
@@ -3,7 +3,7 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
|
|
|
3
3
|
import React__default from 'react';
|
|
4
4
|
import { getActionListContainerRole, getActionListItemWrapperRole } from './getA11yRoles.js';
|
|
5
5
|
import { getActionListProperties } from './actionListUtils.js';
|
|
6
|
-
import { ActionListBox } from './ActionListBox.web.js';
|
|
6
|
+
import { ActionListVirtualizedBox, ActionListBox } from './ActionListBox.web.js';
|
|
7
7
|
import { componentIds } from './componentIds.js';
|
|
8
8
|
import { ActionListNoResults } from './ActionListNoResults.js';
|
|
9
9
|
import { useDropdown } from '../Dropdown/useDropdown.js';
|
|
@@ -22,12 +22,13 @@ import { metaAttribute } from '../../utils/metaAttribute/metaAttribute.web.js';
|
|
|
22
22
|
import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
|
|
23
23
|
import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
|
|
24
24
|
|
|
25
|
-
var _excluded = ["children", "testID"];
|
|
25
|
+
var _excluded = ["children", "testID", "isVirtualized"];
|
|
26
26
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
27
27
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
28
28
|
var _ActionList = function _ActionList(_ref) {
|
|
29
29
|
var children = _ref.children,
|
|
30
30
|
testID = _ref.testID,
|
|
31
|
+
isVirtualized = _ref.isVirtualized,
|
|
31
32
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
32
33
|
var _useDropdown = useDropdown(),
|
|
33
34
|
setOptions = _useDropdown.setOptions,
|
|
@@ -37,6 +38,7 @@ var _ActionList = function _ActionList(_ref) {
|
|
|
37
38
|
dropdownTriggerer = _useDropdown.dropdownTriggerer,
|
|
38
39
|
hasFooterAction = _useDropdown.hasFooterAction,
|
|
39
40
|
filteredValues = _useDropdown.filteredValues;
|
|
41
|
+
var ActionListBox$1 = isVirtualized ? ActionListVirtualizedBox : ActionListBox;
|
|
40
42
|
var _useBottomSheetContex = useBottomSheetContext(),
|
|
41
43
|
isInBottomSheet = _useBottomSheetContex.isInBottomSheet;
|
|
42
44
|
var _React$useMemo = React__default.useMemo(function () {
|
|
@@ -61,7 +63,7 @@ var _ActionList = function _ActionList(_ref) {
|
|
|
61
63
|
// 1. We don't render the box wrapper styles which includes shadows, padding, border etc
|
|
62
64
|
// 2. to ensure GorhomBottomSheetSectionList works as expected, if we add extra wrappers GorhomBottomSheet won't render the content inside
|
|
63
65
|
// NOTE: That this also means inside BottomSheet, ActionList won't render any ActionListHeader or Footer.
|
|
64
|
-
return isInBottomSheet ? /*#__PURE__*/jsx(ActionListBox, _objectSpread({
|
|
66
|
+
return isInBottomSheet ? /*#__PURE__*/jsx(ActionListBox$1, _objectSpread({
|
|
65
67
|
isInBottomSheet: isInBottomSheet,
|
|
66
68
|
actionListItemWrapperRole: actionListItemWrapperRole,
|
|
67
69
|
childrenWithId: childrenWithId,
|
|
@@ -78,7 +80,7 @@ var _ActionList = function _ActionList(_ref) {
|
|
|
78
80
|
name: MetaConstants.ActionList,
|
|
79
81
|
testID: testID
|
|
80
82
|
})), makeAnalyticsAttribute(rest)), {}, {
|
|
81
|
-
children: /*#__PURE__*/jsx(ActionListBox, {
|
|
83
|
+
children: /*#__PURE__*/jsx(ActionListBox$1, {
|
|
82
84
|
isInBottomSheet: isInBottomSheet,
|
|
83
85
|
actionListItemWrapperRole: actionListItemWrapperRole,
|
|
84
86
|
childrenWithId: childrenWithId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionList.js","sources":["../../../../../../src/components/ActionList/ActionList.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react';\nimport { getActionListContainerRole, getActionListItemWrapperRole } from './getA11yRoles';\nimport { getActionListProperties } from './actionListUtils';\nimport { ActionListBox } from './ActionListBox';\nimport { componentIds } from './componentIds';\nimport { ActionListNoResults } from './ActionListNoResults';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\nimport { useBottomSheetContext } from '~components/BottomSheet/BottomSheetContext';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport type { DataAnalyticsAttribute, TestID } from '~utils/types';\nimport BaseBox from '~components/Box/BaseBox';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { dropdownComponentIds } from '~components/Dropdown/dropdownComponentIds';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype ActionListProps = {\n children: React.ReactNode[];\n} & TestID &\n DataAnalyticsAttribute;\n\nconst _ActionList = ({
|
|
1
|
+
{"version":3,"file":"ActionList.js","sources":["../../../../../../src/components/ActionList/ActionList.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react';\nimport { getActionListContainerRole, getActionListItemWrapperRole } from './getA11yRoles';\nimport { getActionListProperties } from './actionListUtils';\nimport { ActionListBox as ActionListNormalBox, ActionListVirtualizedBox } from './ActionListBox';\nimport { componentIds } from './componentIds';\nimport { ActionListNoResults } from './ActionListNoResults';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\nimport { useBottomSheetContext } from '~components/BottomSheet/BottomSheetContext';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport type { DataAnalyticsAttribute, TestID } from '~utils/types';\nimport BaseBox from '~components/Box/BaseBox';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { dropdownComponentIds } from '~components/Dropdown/dropdownComponentIds';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype ActionListProps = {\n children: React.ReactNode[];\n isVirtualized?: boolean;\n} & TestID &\n DataAnalyticsAttribute;\n\nconst _ActionList = ({\n children,\n testID,\n isVirtualized,\n ...rest\n}: ActionListProps): React.ReactElement => {\n const {\n setOptions,\n actionListItemRef,\n selectionType,\n dropdownBaseId,\n dropdownTriggerer,\n hasFooterAction,\n filteredValues,\n } = useDropdown();\n\n const ActionListBox = isVirtualized ? ActionListVirtualizedBox : ActionListNormalBox;\n\n const { isInBottomSheet } = useBottomSheetContext();\n\n const { sectionData, childrenWithId, actionListOptions } = React.useMemo(\n () => getActionListProperties(children),\n [children],\n );\n\n React.useEffect(() => {\n setOptions(actionListOptions);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [actionListOptions]);\n\n if (\n filteredValues.length <= 0 &&\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete\n ) {\n return <ActionListNoResults />;\n }\n\n const actionListContainerRole = getActionListContainerRole(hasFooterAction, dropdownTriggerer);\n const actionListItemWrapperRole = getActionListItemWrapperRole(\n hasFooterAction,\n dropdownTriggerer,\n );\n const isMultiSelectable = selectionType === 'multiple';\n\n // If we are inside BottomSheet, we don't render The StyledActionList wrapper\n // This is to ensure:\n // 1. We don't render the box wrapper styles which includes shadows, padding, border etc\n // 2. to ensure GorhomBottomSheetSectionList works as expected, if we add extra wrappers GorhomBottomSheet won't render the content inside\n // NOTE: That this also means inside BottomSheet, ActionList won't render any ActionListHeader or Footer.\n return isInBottomSheet ? (\n <ActionListBox\n isInBottomSheet={isInBottomSheet}\n actionListItemWrapperRole={actionListItemWrapperRole}\n childrenWithId={childrenWithId}\n sectionData={sectionData}\n isMultiSelectable={isMultiSelectable}\n ref={actionListItemRef as any}\n {...makeAnalyticsAttribute(rest)}\n />\n ) : (\n <BaseBox\n id={`${dropdownBaseId}-actionlist`}\n {...makeAccessible({\n role: actionListContainerRole,\n multiSelectable: actionListContainerRole === 'listbox' ? isMultiSelectable : undefined,\n labelledBy: `${dropdownBaseId}-label`,\n })}\n {...metaAttribute({ name: MetaConstants.ActionList, testID })}\n {...makeAnalyticsAttribute(rest)}\n >\n <ActionListBox\n isInBottomSheet={isInBottomSheet}\n actionListItemWrapperRole={actionListItemWrapperRole}\n childrenWithId={childrenWithId}\n sectionData={sectionData}\n isMultiSelectable={isMultiSelectable}\n ref={actionListItemRef as any}\n />\n </BaseBox>\n );\n};\n\n/**\n * ### ActionList\n *\n * List of multiple actionable items. Can be used as menu items inside `Dropdown`,\n * `BottomSheet` and as selectable items when combined with `SelectInput`\n *\n * #### Usage\n *\n * ```jsx\n * <Dropdown>\n * <SelectInput label=\"Select Action\" />\n * <DropdownOverlay>\n * <DropdownHeader title=\"Header Title\" />\n * <ActionList>\n * <ActionListItem\n * title=\"Home\"\n * value=\"home\"\n * leading={<ActionListItemIcon icon={HomeIcon} />}\n * />\n * <ActionListItem\n * title=\"Pricing\"\n * value=\"pricing\"\n * leading={<ActionListItemAsset src=\"https://flagcdn.com/w20/in.png\" alt=\"India Flag\" />}\n * />\n * </ActionList>\n * <DropdownFooter><Button>Apply</Button></DropdownFooter>\n * </DropdownOverlay>\n * </Dropdown>\n * ```\n *\n */\nconst ActionList = assignWithoutSideEffects(React.memo(_ActionList), {\n displayName: componentIds.ActionList,\n componentId: componentIds.ActionList,\n});\n\nexport type { ActionListProps };\nexport { ActionList };\n"],"names":["_ActionList","_ref","children","testID","isVirtualized","rest","_objectWithoutProperties","_excluded","_useDropdown","useDropdown","setOptions","actionListItemRef","selectionType","dropdownBaseId","dropdownTriggerer","hasFooterAction","filteredValues","ActionListBox","ActionListVirtualizedBox","ActionListNormalBox","_useBottomSheetContex","useBottomSheetContext","isInBottomSheet","_React$useMemo","React","useMemo","getActionListProperties","sectionData","childrenWithId","actionListOptions","useEffect","length","dropdownComponentIds","triggers","AutoComplete","_jsx","ActionListNoResults","actionListContainerRole","getActionListContainerRole","actionListItemWrapperRole","getActionListItemWrapperRole","isMultiSelectable","_objectSpread","ref","makeAnalyticsAttribute","BaseBox","id","concat","makeAccessible","role","multiSelectable","undefined","labelledBy","metaAttribute","name","MetaConstants","ActionList","assignWithoutSideEffects","memo","displayName","componentIds","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,IAAMA,WAAW,GAAG,SAAdA,WAAWA,CAAAC,IAAA,EAK0B;AAAA,EAAA,IAJzCC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,MAAM,GAAAF,IAAA,CAANE,MAAM;IACNC,aAAa,GAAAH,IAAA,CAAbG,aAAa;AACVC,IAAAA,IAAI,GAAAC,wBAAA,CAAAL,IAAA,EAAAM,SAAA,CAAA,CAAA;AAEP,EAAA,IAAAC,YAAA,GAQIC,WAAW,EAAE;IAPfC,UAAU,GAAAF,YAAA,CAAVE,UAAU;IACVC,iBAAiB,GAAAH,YAAA,CAAjBG,iBAAiB;IACjBC,aAAa,GAAAJ,YAAA,CAAbI,aAAa;IACbC,cAAc,GAAAL,YAAA,CAAdK,cAAc;IACdC,iBAAiB,GAAAN,YAAA,CAAjBM,iBAAiB;IACjBC,eAAe,GAAAP,YAAA,CAAfO,eAAe;IACfC,cAAc,GAAAR,YAAA,CAAdQ,cAAc,CAAA;AAGhB,EAAA,IAAMC,eAAa,GAAGb,aAAa,GA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AAC1D,WAAW,CAAC,EAAE;EACnE2D,WAAW,EAAEC,YAAY,CAACJ,UAAU;EACpCK,WAAW,EAAED,YAAY,CAACJ,UAAAA;AAC5B,CAAC;;;;"}
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
3
|
import React__default from 'react';
|
|
4
|
+
import { FixedSizeList } from 'react-window';
|
|
4
5
|
import { StyledListBoxWrapper } from './styles/StyledListBoxWrapper.web.js';
|
|
6
|
+
import { getActionListPadding, actionListMaxHeight } from './styles/getBaseListBoxWrapperStyles.js';
|
|
5
7
|
import { useBottomSheetContext } from '../BottomSheet/BottomSheetContext.js';
|
|
6
8
|
import '../../utils/assignWithoutSideEffects/index.js';
|
|
7
9
|
import '../../utils/makeAccessible/index.js';
|
|
8
10
|
import '../../utils/makeAnalyticsAttribute/index.js';
|
|
11
|
+
import { useIsMobile } from '../../utils/useIsMobile.js';
|
|
12
|
+
import { getItemHeight } from '../BaseMenu/BaseMenuItem/tokens.js';
|
|
13
|
+
import '../../utils/index.js';
|
|
14
|
+
import { useDropdown } from '../Dropdown/useDropdown.js';
|
|
15
|
+
import { dropdownComponentIds } from '../Dropdown/dropdownComponentIds.js';
|
|
9
16
|
import { jsx } from 'react/jsx-runtime';
|
|
10
17
|
import { makeAccessible } from '../../utils/makeAccessible/makeAccessible.web.js';
|
|
11
18
|
import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
|
|
12
19
|
import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
|
|
20
|
+
import useTheme from '../BladeProvider/useTheme.js';
|
|
13
21
|
|
|
14
|
-
var _excluded = ["childrenWithId", "actionListItemWrapperRole", "isMultiSelectable"]
|
|
22
|
+
var _excluded = ["childrenWithId", "actionListItemWrapperRole", "isMultiSelectable"],
|
|
23
|
+
_excluded2 = ["childrenWithId", "actionListItemWrapperRole", "isMultiSelectable"];
|
|
15
24
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
25
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
26
|
var _ActionListBox = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
@@ -31,9 +40,111 @@ var _ActionListBox = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
|
31
40
|
children: childrenWithId
|
|
32
41
|
}));
|
|
33
42
|
});
|
|
34
|
-
var ActionListBox = /*#__PURE__*/assignWithoutSideEffects(_ActionListBox, {
|
|
43
|
+
var ActionListBox = /*#__PURE__*/assignWithoutSideEffects( /*#__PURE__*/React__default.memo(_ActionListBox), {
|
|
35
44
|
displayName: 'ActionListBox'
|
|
36
45
|
});
|
|
37
46
|
|
|
38
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Returns the height of item and height of container based on theme and device
|
|
49
|
+
*/
|
|
50
|
+
var getVirtualItemParams = function getVirtualItemParams(_ref2) {
|
|
51
|
+
var theme = _ref2.theme,
|
|
52
|
+
isMobile = _ref2.isMobile;
|
|
53
|
+
var itemHeightResponsive = getItemHeight(theme);
|
|
54
|
+
var actionListPadding = getActionListPadding(theme);
|
|
55
|
+
var actionListBoxHeight = actionListMaxHeight - actionListPadding * 2;
|
|
56
|
+
return {
|
|
57
|
+
itemHeight: isMobile ? itemHeightResponsive.itemHeightMobile : itemHeightResponsive.itemHeightDesktop,
|
|
58
|
+
actionListBoxHeight: actionListBoxHeight
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Takes the children (ActionListItem) and returns the filtered items based on `filteredValues` state
|
|
64
|
+
*/
|
|
65
|
+
var useFilteredItems = function useFilteredItems(children) {
|
|
66
|
+
var childrenArray = React__default.Children.toArray(children); // Convert children to an array
|
|
67
|
+
|
|
68
|
+
var _useDropdown = useDropdown(),
|
|
69
|
+
filteredValues = _useDropdown.filteredValues,
|
|
70
|
+
hasAutoCompleteInBottomSheetHeader = _useDropdown.hasAutoCompleteInBottomSheetHeader,
|
|
71
|
+
dropdownTriggerer = _useDropdown.dropdownTriggerer;
|
|
72
|
+
var items = React__default.useMemo(function () {
|
|
73
|
+
var hasAutoComplete = hasAutoCompleteInBottomSheetHeader || dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;
|
|
74
|
+
if (!hasAutoComplete) {
|
|
75
|
+
return childrenArray;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// @ts-expect-error: props does exist
|
|
79
|
+
var filteredItems = childrenArray.filter(function (item) {
|
|
80
|
+
return filteredValues.includes(item.props.value);
|
|
81
|
+
});
|
|
82
|
+
return filteredItems;
|
|
83
|
+
}, [filteredValues, hasAutoCompleteInBottomSheetHeader, dropdownTriggerer, childrenArray]);
|
|
84
|
+
return {
|
|
85
|
+
itemData: items,
|
|
86
|
+
itemCount: items.length
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
var VirtualListItem = function VirtualListItem(_ref3) {
|
|
90
|
+
var index = _ref3.index,
|
|
91
|
+
style = _ref3.style,
|
|
92
|
+
data = _ref3.data;
|
|
93
|
+
return /*#__PURE__*/jsx("div", {
|
|
94
|
+
style: style,
|
|
95
|
+
children: data[index]
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
var _ActionListVirtualizedBox = /*#__PURE__*/React__default.forwardRef(function (_ref4, ref) {
|
|
99
|
+
var childrenWithId = _ref4.childrenWithId,
|
|
100
|
+
actionListItemWrapperRole = _ref4.actionListItemWrapperRole,
|
|
101
|
+
isMultiSelectable = _ref4.isMultiSelectable,
|
|
102
|
+
rest = _objectWithoutProperties(_ref4, _excluded2);
|
|
103
|
+
var items = React__default.Children.toArray(childrenWithId); // Convert children to an array
|
|
104
|
+
var _useBottomSheetContex2 = useBottomSheetContext(),
|
|
105
|
+
isInBottomSheet = _useBottomSheetContex2.isInBottomSheet;
|
|
106
|
+
var _useFilteredItems = useFilteredItems(items),
|
|
107
|
+
itemData = _useFilteredItems.itemData,
|
|
108
|
+
itemCount = _useFilteredItems.itemCount;
|
|
109
|
+
var isMobile = useIsMobile();
|
|
110
|
+
var _useTheme = useTheme(),
|
|
111
|
+
theme = _useTheme.theme;
|
|
112
|
+
var _React$useMemo = React__default.useMemo(function () {
|
|
113
|
+
return getVirtualItemParams({
|
|
114
|
+
theme: theme,
|
|
115
|
+
isMobile: isMobile
|
|
116
|
+
});
|
|
117
|
+
},
|
|
118
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
119
|
+
[theme.name, isMobile]),
|
|
120
|
+
itemHeight = _React$useMemo.itemHeight,
|
|
121
|
+
actionListBoxHeight = _React$useMemo.actionListBoxHeight;
|
|
122
|
+
return /*#__PURE__*/jsx(StyledListBoxWrapper, _objectSpread(_objectSpread(_objectSpread({
|
|
123
|
+
isInBottomSheet: isInBottomSheet,
|
|
124
|
+
ref: ref
|
|
125
|
+
}, makeAccessible({
|
|
126
|
+
role: actionListItemWrapperRole,
|
|
127
|
+
multiSelectable: actionListItemWrapperRole === 'listbox' ? isMultiSelectable : undefined
|
|
128
|
+
})), makeAnalyticsAttribute(rest)), {}, {
|
|
129
|
+
children: itemCount < 10 ? childrenWithId : /*#__PURE__*/jsx(FixedSizeList, {
|
|
130
|
+
height: actionListBoxHeight,
|
|
131
|
+
width: "100%",
|
|
132
|
+
itemSize: itemHeight,
|
|
133
|
+
itemCount: itemCount,
|
|
134
|
+
itemData: itemData
|
|
135
|
+
// @ts-expect-error: props does exist
|
|
136
|
+
,
|
|
137
|
+
itemKey: function itemKey(index) {
|
|
138
|
+
var _itemData$index;
|
|
139
|
+
return (_itemData$index = itemData[index]) === null || _itemData$index === void 0 ? void 0 : _itemData$index.props.value;
|
|
140
|
+
},
|
|
141
|
+
children: VirtualListItem
|
|
142
|
+
})
|
|
143
|
+
}));
|
|
144
|
+
});
|
|
145
|
+
var ActionListVirtualizedBox = /*#__PURE__*/assignWithoutSideEffects( /*#__PURE__*/React__default.memo(_ActionListVirtualizedBox), {
|
|
146
|
+
displayName: 'ActionListVirtualizedBox'
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
export { ActionListBox, ActionListVirtualizedBox };
|
|
39
150
|
//# sourceMappingURL=ActionListBox.web.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionListBox.web.js","sources":["../../../../../../src/components/ActionList/ActionListBox.web.tsx"],"sourcesContent":["/* eslint-disable react/display-name */\nimport React from 'react';\nimport { StyledListBoxWrapper } from './styles/StyledListBoxWrapper';\nimport type { SectionData } from './actionListUtils';\nimport { useBottomSheetContext } from '~components/BottomSheet/BottomSheetContext';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport type { DataAnalyticsAttribute } from '~utils/types';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype ActionListBoxProps = {\n childrenWithId?: React.ReactNode[] | null;\n sectionData: SectionData;\n actionListItemWrapperRole: 'listbox' | 'menu' | undefined;\n isMultiSelectable: boolean;\n isInBottomSheet: boolean;\n} & DataAnalyticsAttribute;\n\nconst _ActionListBox = React.forwardRef<HTMLDivElement, ActionListBoxProps>(\n ({ childrenWithId, actionListItemWrapperRole, isMultiSelectable, ...rest }, ref) => {\n const { isInBottomSheet } = useBottomSheetContext();\n\n return (\n <StyledListBoxWrapper\n isInBottomSheet={isInBottomSheet}\n ref={ref}\n {...makeAccessible({\n role: actionListItemWrapperRole,\n multiSelectable: actionListItemWrapperRole === 'listbox' ? isMultiSelectable : undefined,\n })}\n {...makeAnalyticsAttribute(rest)}\n >\n {childrenWithId}\n </StyledListBoxWrapper>\n );\n },\n);\n\nconst ActionListBox = assignWithoutSideEffects(_ActionListBox, { displayName: 'ActionListBox' });\n\nexport { ActionListBox };\n"],"names":["_ActionListBox","React","forwardRef","_ref","ref","childrenWithId","actionListItemWrapperRole","isMultiSelectable","rest","_objectWithoutProperties","_excluded","_useBottomSheetContex","useBottomSheetContext","isInBottomSheet","_jsx","StyledListBoxWrapper","_objectSpread","makeAccessible","role","multiSelectable","undefined","makeAnalyticsAttribute","children","ActionListBox","assignWithoutSideEffects","displayName"],"mappings":";;;;;;;;;;;;;;;;AAkBA,IAAMA,cAAc,gBAAGC,cAAK,CAACC,UAAU,CACrC,UAAAC,IAAA,EAA4EC,GAAG,EAAK;AAAA,EAAA,IAAjFC,cAAc,GAAAF,IAAA,CAAdE,cAAc;IAAEC,yBAAyB,GAAAH,IAAA,CAAzBG,yBAAyB;IAAEC,iBAAiB,GAAAJ,IAAA,CAAjBI,iBAAiB;AAAKC,IAAAA,IAAI,GAAAC,wBAAA,CAAAN,IAAA,EAAAO,SAAA,CAAA,CAAA;AACtE,EAAA,IAAAC,qBAAA,GAA4BC,qBAAqB,EAAE;IAA3CC,eAAe,GAAAF,qBAAA,CAAfE,eAAe,CAAA;EAEvB,oBACEC,GAAA,CAACC,oBAAoB,EAAAC,aAAA,CAAAA,aAAA,CAAAA,aAAA,CAAA;AACnBH,IAAAA,eAAe,EAAEA,eAAgB;AACjCT,IAAAA,GAAG,EAAEA,GAAAA;AAAI,GAAA,EACLa,cAAc,CAAC;AACjBC,IAAAA,IAAI,EAAEZ,yBAAyB;AAC/Ba,IAAAA,eAAe,EAAEb,yBAAyB,KAAK,SAAS,GAAGC,iBAAiB,GAAGa,SAAAA;AACjF,GAAC,CAAC,CAAA,EACEC,sBAAsB,CAACb,IAAI,CAAC,CAAA,EAAA,EAAA,EAAA;AAAAc,IAAAA,QAAA,EAE/BjB,cAAAA;AAAc,GAAA,CACK,CAAC,CAAA;AAE3B,CACF,CAAC,CAAA;AAED,IAAMkB,aAAa,gBAAGC,wBAAwB,CAACxB,cAAc,EAAE;AAAEyB,EAAAA,WAAW,EAAE,eAAA;AAAgB,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"ActionListBox.web.js","sources":["../../../../../../src/components/ActionList/ActionListBox.web.tsx"],"sourcesContent":["/* eslint-disable react/display-name */\nimport React from 'react';\nimport { FixedSizeList as VirtualizedList } from 'react-window';\nimport { StyledListBoxWrapper } from './styles/StyledListBoxWrapper';\nimport type { SectionData } from './actionListUtils';\nimport { actionListMaxHeight, getActionListPadding } from './styles/getBaseListBoxWrapperStyles';\nimport { useBottomSheetContext } from '~components/BottomSheet/BottomSheetContext';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport type { DataAnalyticsAttribute } from '~utils/types';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport { useIsMobile } from '~utils/useIsMobile';\nimport { getItemHeight } from '~components/BaseMenu/BaseMenuItem/tokens';\nimport { useTheme } from '~utils';\nimport type { Theme } from '~components/BladeProvider';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\nimport { dropdownComponentIds } from '~components/Dropdown/dropdownComponentIds';\n\ntype ActionListBoxProps = {\n childrenWithId?: React.ReactNode[] | null;\n sectionData: SectionData;\n actionListItemWrapperRole: 'listbox' | 'menu' | undefined;\n isMultiSelectable: boolean;\n isInBottomSheet: boolean;\n} & DataAnalyticsAttribute;\n\nconst _ActionListBox = React.forwardRef<HTMLDivElement, ActionListBoxProps>(\n ({ childrenWithId, actionListItemWrapperRole, isMultiSelectable, ...rest }, ref) => {\n const { isInBottomSheet } = useBottomSheetContext();\n\n return (\n <StyledListBoxWrapper\n isInBottomSheet={isInBottomSheet}\n ref={ref}\n {...makeAccessible({\n role: actionListItemWrapperRole,\n multiSelectable: actionListItemWrapperRole === 'listbox' ? isMultiSelectable : undefined,\n })}\n {...makeAnalyticsAttribute(rest)}\n >\n {childrenWithId}\n </StyledListBoxWrapper>\n );\n },\n);\n\nconst ActionListBox = assignWithoutSideEffects(React.memo(_ActionListBox), {\n displayName: 'ActionListBox',\n});\n\n/**\n * Returns the height of item and height of container based on theme and device\n */\nconst getVirtualItemParams = ({\n theme,\n isMobile,\n}: {\n theme: Theme;\n isMobile: boolean;\n}): {\n itemHeight: number;\n actionListBoxHeight: number;\n} => {\n const itemHeightResponsive = getItemHeight(theme);\n const actionListPadding = getActionListPadding(theme);\n const actionListBoxHeight = actionListMaxHeight - actionListPadding * 2;\n\n return {\n itemHeight: isMobile\n ? itemHeightResponsive.itemHeightMobile\n : itemHeightResponsive.itemHeightDesktop,\n actionListBoxHeight,\n };\n};\n\n/**\n * Takes the children (ActionListItem) and returns the filtered items based on `filteredValues` state\n */\nconst useFilteredItems = (\n children: React.ReactNode[],\n): {\n itemData: React.ReactNode[];\n itemCount: number;\n} => {\n const childrenArray = React.Children.toArray(children); // Convert children to an array\n\n const { filteredValues, hasAutoCompleteInBottomSheetHeader, dropdownTriggerer } = useDropdown();\n\n const items = React.useMemo(() => {\n const hasAutoComplete =\n hasAutoCompleteInBottomSheetHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n\n if (!hasAutoComplete) {\n return childrenArray;\n }\n\n // @ts-expect-error: props does exist\n const filteredItems = childrenArray.filter((item) => filteredValues.includes(item.props.value));\n return filteredItems;\n }, [filteredValues, hasAutoCompleteInBottomSheetHeader, dropdownTriggerer, childrenArray]);\n\n return {\n itemData: items,\n itemCount: items.length,\n };\n};\n\nconst VirtualListItem = ({\n index,\n style,\n data,\n}: {\n index: number;\n style: React.CSSProperties;\n data: React.ReactNode[];\n}): React.ReactElement => {\n return <div style={style}>{data[index]}</div>;\n};\n\nconst _ActionListVirtualizedBox = React.forwardRef<HTMLDivElement, ActionListBoxProps>(\n ({ childrenWithId, actionListItemWrapperRole, isMultiSelectable, ...rest }, ref) => {\n const items = React.Children.toArray(childrenWithId); // Convert children to an array\n const { isInBottomSheet } = useBottomSheetContext();\n const { itemData, itemCount } = useFilteredItems(items);\n\n const isMobile = useIsMobile();\n const { theme } = useTheme();\n const { itemHeight, actionListBoxHeight } = React.useMemo(\n () => getVirtualItemParams({ theme, isMobile }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [theme.name, isMobile],\n );\n\n return (\n <StyledListBoxWrapper\n isInBottomSheet={isInBottomSheet}\n ref={ref}\n {...makeAccessible({\n role: actionListItemWrapperRole,\n multiSelectable: actionListItemWrapperRole === 'listbox' ? isMultiSelectable : undefined,\n })}\n {...makeAnalyticsAttribute(rest)}\n >\n {itemCount < 10 ? (\n childrenWithId\n ) : (\n <VirtualizedList\n height={actionListBoxHeight}\n width=\"100%\"\n itemSize={itemHeight}\n itemCount={itemCount}\n itemData={itemData}\n // @ts-expect-error: props does exist\n itemKey={(index) => itemData[index]?.props.value}\n >\n {VirtualListItem}\n </VirtualizedList>\n )}\n </StyledListBoxWrapper>\n );\n },\n);\n\nconst ActionListVirtualizedBox = assignWithoutSideEffects(React.memo(_ActionListVirtualizedBox), {\n displayName: 'ActionListVirtualizedBox',\n});\n\nexport { ActionListBox, ActionListVirtualizedBox };\n"],"names":["_ActionListBox","React","forwardRef","_ref","ref","childrenWithId","actionListItemWrapperRole","isMultiSelectable","rest","_objectWithoutProperties","_excluded","_useBottomSheetContex","useBottomSheetContext","isInBottomSheet","_jsx","StyledListBoxWrapper","_objectSpread","makeAccessible","role","multiSelectable","undefined","makeAnalyticsAttribute","children","ActionListBox","assignWithoutSideEffects","memo","displayName","getVirtualItemParams","_ref2","theme","isMobile","itemHeightResponsive","getItemHeight","actionListPadding","getActionListPadding","actionListBoxHeight","actionListMaxHeight","itemHeight","itemHeightMobile","itemHeightDesktop","useFilteredItems","childrenArray","Children","toArray","_useDropdown","useDropdown","filteredValues","hasAutoCompleteInBottomSheetHeader","dropdownTriggerer","items","useMemo","hasAutoComplete","dropdownComponentIds","triggers","AutoComplete","filteredItems","filter","item","includes","props","value","itemData","itemCount","length","VirtualListItem","_ref3","index","style","data","_ActionListVirtualizedBox","_ref4","_excluded2","_useBottomSheetContex2","_useFilteredItems","useIsMobile","_useTheme","useTheme","_React$useMemo","name","VirtualizedList","height","width","itemSize","itemKey","_itemData$index","ActionListVirtualizedBox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,IAAMA,cAAc,gBAAGC,cAAK,CAACC,UAAU,CACrC,UAAAC,IAAA,EAA4EC,GAAG,EAAK;AAAA,EAAA,IAAjFC,cAAc,GAAAF,IAAA,CAAdE,cAAc;IAAEC,yBAAyB,GAAAH,IAAA,CAAzBG,yBAAyB;IAAEC,iBAAiB,GAAAJ,IAAA,CAAjBI,iBAAiB;AAAKC,IAAAA,IAAI,GAAAC,wBAAA,CAAAN,IAAA,EAAAO,SAAA,CAAA,CAAA;AACtE,EAAA,IAAAC,qBAAA,GAA4BC,qBAAqB,EAAE;IAA3CC,eAAe,GAAAF,qBAAA,CAAfE,eAAe,CAAA;EAEvB,oBACEC,GAAA,CAACC,oBAAoB,EAAAC,aAAA,CAAAA,aAAA,CAAAA,aAAA,CAAA;AACnBH,IAAAA,eAAe,EAAEA,eAAgB;AACjCT,IAAAA,GAAG,EAAEA,GAAAA;AAAI,GAAA,EACLa,cAAc,CAAC;AACjBC,IAAAA,IAAI,EAAEZ,yBAAyB;AAC/Ba,IAAAA,eAAe,EAAEb,yBAAyB,KAAK,SAAS,GAAGC,iBAAiB,GAAGa,SAAAA;AACjF,GAAC,CAAC,CAAA,EACEC,sBAAsB,CAACb,IAAI,CAAC,CAAA,EAAA,EAAA,EAAA;AAAAc,IAAAA,QAAA,EAE/BjB,cAAAA;AAAc,GAAA,CACK,CAAC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