@razorpay/blade 11.25.0 → 11.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/README.md +3 -4
  2. package/build/lib/native/components/BaseMenu/BaseMenuItem/BaseMenuItem.js +1 -1
  3. package/build/lib/native/components/BaseMenu/BaseMenuItem/BaseMenuItem.js.map +1 -1
  4. package/build/lib/native/components/Button/BaseButton/BaseButton.js +1 -1
  5. package/build/lib/native/components/Button/BaseButton/BaseButton.js.map +1 -1
  6. package/build/lib/native/components/Dropdown/Dropdown.js +1 -1
  7. package/build/lib/native/components/Dropdown/Dropdown.js.map +1 -1
  8. package/build/lib/native/components/Input/BaseInput/BaseInput.js +1 -1
  9. package/build/lib/native/components/Input/BaseInput/BaseInput.js.map +1 -1
  10. package/build/lib/native/components/Input/BaseInput/BaseInputVisuals.js +1 -1
  11. package/build/lib/native/components/Input/BaseInput/BaseInputVisuals.js.map +1 -1
  12. package/build/lib/native/components/Input/BaseInput/baseInputStyles.js +1 -1
  13. package/build/lib/native/components/Input/BaseInput/baseInputStyles.js.map +1 -1
  14. package/build/lib/native/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +4 -1
  15. package/build/lib/native/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
  16. package/build/lib/native/components/Radio/RadioIcon/RadioIconWrapperStyles.js +1 -1
  17. package/build/lib/native/components/Radio/RadioIcon/RadioIconWrapperStyles.js.map +1 -1
  18. package/build/lib/native/components/Spinner/BaseSpinner/BaseSpinner.js +1 -1
  19. package/build/lib/native/components/Spinner/BaseSpinner/BaseSpinner.js.map +1 -1
  20. package/build/lib/native/components/Table/TableBody.native.js +2 -2
  21. package/build/lib/native/components/Table/TableBody.native.js.map +1 -1
  22. package/build/lib/native/components/Table/TableContext.js +6 -0
  23. package/build/lib/native/components/Table/TableContext.js.map +1 -0
  24. package/build/lib/native/components/Table/TableEditableCell.native.js +16 -0
  25. package/build/lib/native/components/Table/TableEditableCell.native.js.map +1 -0
  26. package/build/lib/native/components/Table/TableEditableCellContext.js +6 -0
  27. package/build/lib/native/components/Table/TableEditableCellContext.js.map +1 -0
  28. package/build/lib/native/components/Table/TablePagination.native.js +2 -2
  29. package/build/lib/native/components/Table/TablePagination.native.js.map +1 -1
  30. package/build/lib/native/components/Table/TableToolbar.native.js +2 -2
  31. package/build/lib/native/components/Table/TableToolbar.native.js.map +1 -1
  32. package/build/lib/native/components/Table/tokens.js +22 -0
  33. package/build/lib/native/components/Table/tokens.js.map +1 -0
  34. package/build/lib/native/components/index.js +4 -3
  35. package/build/lib/native/components/index.js.map +1 -1
  36. package/build/lib/native/tokens/theme/createTheme.js +1 -1
  37. package/build/lib/native/tokens/theme/createTheme.js.map +1 -1
  38. package/build/lib/web/development/components/BaseMenu/BaseMenuItem/BaseMenuItem.js +1 -1
  39. package/build/lib/web/development/components/BaseMenu/BaseMenuItem/BaseMenuItem.js.map +1 -1
  40. package/build/lib/web/development/components/Button/BaseButton/BaseButton.js +1 -2
  41. package/build/lib/web/development/components/Button/BaseButton/BaseButton.js.map +1 -1
  42. package/build/lib/web/development/components/Dropdown/Dropdown.js +3 -1
  43. package/build/lib/web/development/components/Dropdown/Dropdown.js.map +1 -1
  44. package/build/lib/web/development/components/Input/BaseInput/AnimatedBaseInputWrapper.web.js +1 -1
  45. package/build/lib/web/development/components/Input/BaseInput/AnimatedBaseInputWrapper.web.js.map +1 -1
  46. package/build/lib/web/development/components/Input/BaseInput/BaseInput.js +5 -3
  47. package/build/lib/web/development/components/Input/BaseInput/BaseInput.js.map +1 -1
  48. package/build/lib/web/development/components/Input/BaseInput/BaseInputTagSlot.web.js +55 -33
  49. package/build/lib/web/development/components/Input/BaseInput/BaseInputTagSlot.web.js.map +1 -1
  50. package/build/lib/web/development/components/Input/BaseInput/BaseInputVisuals.js +4 -4
  51. package/build/lib/web/development/components/Input/BaseInput/BaseInputVisuals.js.map +1 -1
  52. package/build/lib/web/development/components/Input/BaseInput/baseInputStyles.js +4 -2
  53. package/build/lib/web/development/components/Input/BaseInput/baseInputStyles.js.map +1 -1
  54. package/build/lib/web/development/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +22 -4
  55. package/build/lib/web/development/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
  56. package/build/lib/web/development/components/Radio/RadioIcon/RadioIconWrapperStyles.js +1 -0
  57. package/build/lib/web/development/components/Radio/RadioIcon/RadioIconWrapperStyles.js.map +1 -1
  58. package/build/lib/web/development/components/Spinner/BaseSpinner/BaseSpinner.js +3 -3
  59. package/build/lib/web/development/components/Spinner/BaseSpinner/BaseSpinner.js.map +1 -1
  60. package/build/lib/web/development/components/Table/TableBody.web.js +26 -166
  61. package/build/lib/web/development/components/Table/TableBody.web.js.map +1 -1
  62. package/build/lib/web/development/components/Table/TableEditableCell.web.js +194 -0
  63. package/build/lib/web/development/components/Table/TableEditableCell.web.js.map +1 -0
  64. package/build/lib/web/development/components/Table/TableEditableCellContext.js +12 -0
  65. package/build/lib/web/development/components/Table/TableEditableCellContext.js.map +1 -0
  66. package/build/lib/web/development/components/Table/TablePagination.web.js +3 -2
  67. package/build/lib/web/development/components/Table/TablePagination.web.js.map +1 -1
  68. package/build/lib/web/development/components/Table/index.js +2 -2
  69. package/build/lib/web/development/components/Table/tokens.js +14 -2
  70. package/build/lib/web/development/components/Table/tokens.js.map +1 -1
  71. package/build/lib/web/development/components/index.js +2 -1
  72. package/build/lib/web/development/components/index.js.map +1 -1
  73. package/build/lib/web/development/tokens/theme/createTheme.js +5 -2
  74. package/build/lib/web/development/tokens/theme/createTheme.js.map +1 -1
  75. package/build/lib/web/production/components/BaseMenu/BaseMenuItem/BaseMenuItem.js +1 -1
  76. package/build/lib/web/production/components/BaseMenu/BaseMenuItem/BaseMenuItem.js.map +1 -1
  77. package/build/lib/web/production/components/Button/BaseButton/BaseButton.js +1 -2
  78. package/build/lib/web/production/components/Button/BaseButton/BaseButton.js.map +1 -1
  79. package/build/lib/web/production/components/Dropdown/Dropdown.js +3 -1
  80. package/build/lib/web/production/components/Dropdown/Dropdown.js.map +1 -1
  81. package/build/lib/web/production/components/Input/BaseInput/AnimatedBaseInputWrapper.web.js +1 -1
  82. package/build/lib/web/production/components/Input/BaseInput/AnimatedBaseInputWrapper.web.js.map +1 -1
  83. package/build/lib/web/production/components/Input/BaseInput/BaseInput.js +5 -3
  84. package/build/lib/web/production/components/Input/BaseInput/BaseInput.js.map +1 -1
  85. package/build/lib/web/production/components/Input/BaseInput/BaseInputTagSlot.web.js +55 -33
  86. package/build/lib/web/production/components/Input/BaseInput/BaseInputTagSlot.web.js.map +1 -1
  87. package/build/lib/web/production/components/Input/BaseInput/BaseInputVisuals.js +4 -4
  88. package/build/lib/web/production/components/Input/BaseInput/BaseInputVisuals.js.map +1 -1
  89. package/build/lib/web/production/components/Input/BaseInput/baseInputStyles.js +4 -2
  90. package/build/lib/web/production/components/Input/BaseInput/baseInputStyles.js.map +1 -1
  91. package/build/lib/web/production/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js +22 -4
  92. package/build/lib/web/production/components/Input/DropdownInputTriggers/BaseDropdownInputTrigger.js.map +1 -1
  93. package/build/lib/web/production/components/Radio/RadioIcon/RadioIconWrapperStyles.js +1 -0
  94. package/build/lib/web/production/components/Radio/RadioIcon/RadioIconWrapperStyles.js.map +1 -1
  95. package/build/lib/web/production/components/Spinner/BaseSpinner/BaseSpinner.js +3 -3
  96. package/build/lib/web/production/components/Spinner/BaseSpinner/BaseSpinner.js.map +1 -1
  97. package/build/lib/web/production/components/Table/TableBody.web.js +26 -166
  98. package/build/lib/web/production/components/Table/TableBody.web.js.map +1 -1
  99. package/build/lib/web/production/components/Table/TableEditableCell.web.js +194 -0
  100. package/build/lib/web/production/components/Table/TableEditableCell.web.js.map +1 -0
  101. package/build/lib/web/production/components/Table/TableEditableCellContext.js +12 -0
  102. package/build/lib/web/production/components/Table/TableEditableCellContext.js.map +1 -0
  103. package/build/lib/web/production/components/Table/TablePagination.web.js +3 -2
  104. package/build/lib/web/production/components/Table/TablePagination.web.js.map +1 -1
  105. package/build/lib/web/production/components/Table/index.js +2 -2
  106. package/build/lib/web/production/components/Table/tokens.js +14 -2
  107. package/build/lib/web/production/components/Table/tokens.js.map +1 -1
  108. package/build/lib/web/production/components/index.js +2 -1
  109. package/build/lib/web/production/components/index.js.map +1 -1
  110. package/build/lib/web/production/tokens/theme/createTheme.js +5 -2
  111. package/build/lib/web/production/tokens/theme/createTheme.js.map +1 -1
  112. package/build/types/components/index.d.ts +16 -4
  113. package/build/types/components/index.native.d.ts +18 -6
  114. package/build/types/tokens/index.d.ts +6 -3
  115. package/build/types/tokens/index.native.d.ts +6 -3
  116. package/package.json +1 -1
  117. package/build/lib/web/development/components/Table/types.js +0 -2
  118. package/build/lib/web/development/components/Table/types.js.map +0 -1
  119. package/build/lib/web/production/components/Table/types.js +0 -2
  120. package/build/lib/web/production/components/Table/types.js.map +0 -1
package/README.md CHANGED
@@ -25,11 +25,10 @@ Blade is the Design System that powers [Razorpay](https://razorpay.com/).
25
25
  - [@razorpay/blade-old](https://github.com/razorpay/blade-old) (Deprecated, Private)
26
26
 
27
27
  ## ✨ Features
28
- - Cross-Platform (Works Natively on [React Web](https://blade.razorpay.com/?path=/docs/guides-installation--page#%EF%B8%8F-installation) and [React Native](https://blade.razorpay.com/?path=/docs/guides-installation--page#react-native-projects))
29
- - [White Labelling](https://blade.razorpay.com/?path=/docs/guides-theming-theme-playground--page)
30
- - [CSS Variables for non-React Projects](https://blade.razorpay.com/?path=/docs/tokens-css-variables--page)
28
+ - Cross-Platform (Works Natively on [React Web and React Native](https://blade.razorpay.com/?path=/docs/guides-installation--docs))
29
+ - [White Labelling](https://blade.razorpay.com/?path=/docs/guides-theming-theme-playground--docs)
31
30
  - [Accessible](https://github.com/razorpay/blade/blob/master/rfcs/2022-04-09-accessibility.md#manual-testing)
32
- - Documented [RFCs](https://github.com/razorpay/blade/tree/docs/make-docs-pretty/rfcs) and [API Decisions](https://github.com/razorpay/blade/blob/master/packages/blade/src/components/Alert/_decisions/decisions.md)
31
+ - Documented [RFCs](https://github.com/razorpay/blade/tree/master/rfcs) and [API Decisions](https://github.com/razorpay/blade/blob/master/packages/blade/src/components/Alert/_decisions/decisions.md)
33
32
 
34
33
  ## 📝 License
35
34
 
@@ -17,7 +17,7 @@ import '../../Typography/Code/Code.js';
17
17
  import { makeAccessible } from '../../../utils/makeAccessible/makeAccessible.native.js';
18
18
  import { useTruncationTitle } from '../../../utils/useTruncationTitle/useTruncationTitle.native.js';
19
19
 
20
- var _excluded=["title","description","as","leading","trailing","titleSuffix","isDisabled","selectionType","isSelected","isVisible","color","role","children"];var menuItemTitleColor={negative:{default:'feedback.text.negative.intense',disabled:'interactive.text.gray.disabled'},normal:{default:'interactive.text.gray.normal',disabled:'interactive.text.gray.disabled'}};var menuItemDescriptionColor={default:'interactive.text.gray.muted',disabled:'interactive.text.gray.disabled'};var itemFirstRowHeight=makeSize(size[20]);var _BaseMenuItem=function _BaseMenuItem(_ref,ref){var title=_ref.title,description=_ref.description,as=_ref.as,leading=_ref.leading,trailing=_ref.trailing,titleSuffix=_ref.titleSuffix,isDisabled=_ref.isDisabled,_ref$selectionType=_ref.selectionType,selectionType=_ref$selectionType===void 0?'single':_ref$selectionType,isSelected=_ref.isSelected,_ref$isVisible=_ref.isVisible,isVisible=_ref$isVisible===void 0?true:_ref$isVisible,color=_ref.color,_ref$role=_ref.role,role=_ref$role===void 0?'menuitem':_ref$role,children=_ref.children,props=_objectWithoutProperties(_ref,_excluded);var _useTruncationTitle=useTruncationTitle({content:title}),containerRef=_useTruncationTitle.containerRef,textRef=_useTruncationTitle.textRef;return jsx(BaseMenuItemContext.Provider,{value:{color:color,isDisabled:isDisabled},children:jsx(StyledMenuItemContainer,Object.assign({ref:ref,as:as,type:"button",disabled:isDisabled},makeAccessible({role:role,current:role==='menuitem'||role==='menuitemcheckbox'?isSelected:undefined,disabled:isDisabled,selected:isSelected}),{color:color,isVisible:isVisible,isSelected:isSelected,isDisabled:isDisabled,selectionType:selectionType},props,{children:children?children:jsxs(Box,{display:"flex",alignItems:"flex-start",width:"100%",justifyContent:"center",children:[jsx(Box,{display:"flex",justifyContent:"center",alignItems:"center",height:itemFirstRowHeight,children:leading}),jsxs(Box,{paddingLeft:leading?'spacing.3':'spacing.0',paddingRight:"spacing.3",display:"flex",flexDirection:"column",children:[jsxs(Box,{display:"flex",alignItems:"center",flexDirection:"row",height:itemFirstRowHeight,ref:containerRef,children:[jsx(BaseText,Object.assign({as:"p",ref:textRef,truncateAfterLines:1,wordBreak:"break-all"},getTextProps({size:'medium',color:menuItemTitleColor[color==='negative'?'negative':'normal'][isDisabled?'disabled':'default'],weight:'regular'}),{children:title})),titleSuffix]}),jsx(Box,{children:description?jsx(Text,{color:menuItemDescriptionColor[isDisabled?'disabled':'default'],size:"small",children:description}):null})]}),jsx(Box,{marginLeft:"auto",children:trailing})]})}))});};var BaseMenuItem=React__default.forwardRef(_BaseMenuItem);
20
+ var _excluded=["title","description","as","leading","trailing","titleSuffix","isDisabled","selectionType","isSelected","isVisible","color","role","children"];var menuItemTitleColor={negative:{default:'feedback.text.negative.intense',disabled:'interactive.text.gray.disabled'},normal:{default:'interactive.text.gray.normal',disabled:'interactive.text.gray.disabled'}};var menuItemDescriptionColor={default:'interactive.text.gray.muted',disabled:'interactive.text.gray.disabled'};var itemFirstRowHeight=makeSize(size[20]);var _BaseMenuItem=function _BaseMenuItem(_ref,ref){var title=_ref.title,description=_ref.description,as=_ref.as,leading=_ref.leading,trailing=_ref.trailing,titleSuffix=_ref.titleSuffix,isDisabled=_ref.isDisabled,_ref$selectionType=_ref.selectionType,selectionType=_ref$selectionType===void 0?'single':_ref$selectionType,isSelected=_ref.isSelected,_ref$isVisible=_ref.isVisible,isVisible=_ref$isVisible===void 0?true:_ref$isVisible,color=_ref.color,_ref$role=_ref.role,role=_ref$role===void 0?'menuitem':_ref$role,children=_ref.children,props=_objectWithoutProperties(_ref,_excluded);var _useTruncationTitle=useTruncationTitle({content:title}),containerRef=_useTruncationTitle.containerRef,textRef=_useTruncationTitle.textRef;return jsx(BaseMenuItemContext.Provider,{value:{color:color,isDisabled:isDisabled},children:jsx(StyledMenuItemContainer,Object.assign({ref:ref,as:as,type:"button",disabled:isDisabled},makeAccessible({role:role,current:role==='menuitem'||role==='menuitemcheckbox'?isSelected:undefined,disabled:isDisabled,selected:isSelected}),{color:color,isVisible:isVisible,isSelected:isSelected,isDisabled:isDisabled,selectionType:selectionType},props,{children:children?children:jsxs(Box,{display:"flex",alignItems:"flex-start",width:"100%",justifyContent:"flex-start",children:[jsx(Box,{display:"flex",justifyContent:"center",alignItems:"center",height:itemFirstRowHeight,children:leading}),jsxs(Box,{paddingLeft:leading?'spacing.3':'spacing.0',paddingRight:"spacing.3",display:"flex",flexDirection:"column",children:[jsxs(Box,{display:"flex",alignItems:"center",flexDirection:"row",height:itemFirstRowHeight,ref:containerRef,children:[jsx(BaseText,Object.assign({as:"p",ref:textRef,truncateAfterLines:1,wordBreak:"break-all"},getTextProps({size:'medium',color:menuItemTitleColor[color==='negative'?'negative':'normal'][isDisabled?'disabled':'default'],weight:'regular'}),{children:title})),titleSuffix]}),jsx(Box,{children:description?jsx(Text,{color:menuItemDescriptionColor[isDisabled?'disabled':'default'],size:"small",children:description}):null})]}),jsx(Box,{marginLeft:"auto",children:trailing})]})}))});};var BaseMenuItem=React__default.forwardRef(_BaseMenuItem);
21
21
 
22
22
  export { BaseMenuItem };
23
23
  //# sourceMappingURL=BaseMenuItem.js.map
@@ -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 { Box } from '~components/Box';\nimport { getTextProps, Text } from '~components/Typography';\nimport { size } from '~tokens/global';\nimport { makeSize } from '~utils';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport type { BladeElementRef } from '~utils/types';\nimport { BaseText } from '~components/Typography/BaseText';\nimport { useTruncationTitle } from '~utils/useTruncationTitle';\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\nconst itemFirstRowHeight = makeSize(size[20]);\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=\"center\">\n <Box\n display=\"flex\"\n justifyContent=\"center\"\n alignItems=\"center\"\n height={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={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","default","disabled","normal","menuItemDescriptionColor","itemFirstRowHeight","makeSize","size","_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","Object","assign","type","makeAccessible","current","undefined","selected","_jsxs","Box","display","alignItems","width","justifyContent","height","paddingLeft","paddingRight","flexDirection","BaseText","truncateAfterLines","wordBreak","getTextProps","weight","Text","marginLeft","BaseMenuItem","React","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,OAAA,CAAA,aAAA,CAAA,IAAA,CAAA,SAAA,CAAA,UAAA,CAAA,aAAA,CAAA,YAAA,CAAA,eAAA,CAAA,YAAA,CAAA,WAAA,CAAA,OAAA,CAAA,MAAA,CAAA,UAAA,CAAA,CAaA,IAAMA,kBAAkB,CAAG,CACzBC,Q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cAAK,CAACC,UAAU,CAAC1D,aAAa;;;;"}
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 { Box } from '~components/Box';\nimport { getTextProps, Text } from '~components/Typography';\nimport { size } from '~tokens/global';\nimport { makeSize } from '~utils';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport type { BladeElementRef } from '~utils/types';\nimport { BaseText } from '~components/Typography/BaseText';\nimport { useTruncationTitle } from '~utils/useTruncationTitle';\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\nconst itemFirstRowHeight = makeSize(size[20]);\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={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={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","default","disabled","normal","menuItemDescriptionColor","itemFirstRowHeight","makeSize","size","_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","Object","assign","type","makeAccessible","current","undefined","selected","_jsxs","Box","display","alignItems","width","justifyContent","height","paddingLeft","paddingRight","flexDirection","BaseText","truncateAfterLines","wordBreak","getTextProps","weight","Text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V,IAAI,CAAC,OAAO,CAAAmB,QAAA,CAEXd,WAAW,CACR,CAAC,CACL,IAAI,CACL,CAAC,CAAA,CACH,CAAC,CACNuB,GAAA,CAACa,GAAG,CAAA,CAACe,UAAU,CAAC,MAAM,CAAArC,QAAA,CAAEX,QAAQ,CAAM,CAAC,CAAA,CACpC,CACN,CACsB,CAAA,CAAC,CACE,CAAC,CAEnC,CAAC,CAEK,IAAAiD,YAAY,CAAGC,cAAK,CAACC,UAAU,CAAC1D,aAAa;;;;"}
@@ -32,7 +32,7 @@ import { metaAttribute } from '../../../utils/metaAttribute/metaAttribute.native
32
32
  import { MetaConstants } from '../../../utils/metaAttribute/metaConstants.js';
33
33
  import { getStringFromReactText } from '../../../utils/getStringChildren/getStringChildren.js';
34
34
 
35
- var _excluded=["href","target","rel","tabIndex","id","variant","color","size","icon","iconPosition","isDisabled","isFullWidth","isLoading","onClick","onBlur","onKeyDown","type","children","testID","onFocus","onMouseLeave","onMouseMove","onMouseDown","onPointerDown","onPointerEnter","accessibilityProps","onTouchEnd","onTouchStart"];var getRenderElement=function getRenderElement(href){if(isReactNative()){return undefined;}if(href){return 'a';}return 'button';};var getBackgroundColorToken=function getBackgroundColorToken(_ref){var property=_ref.property,variant=_ref.variant,state=_ref.state,color=_ref.color;var _state=state==='focus'||state==='hover'?'highlighted':state;var tokens=backgroundColor(property);if(color==='white'){return tokens.white[variant][_state];}if(color&&color!=='primary'){if(variant==='tertiary'){throw new Error(`Tertiary variant can only be used with color: "primary" or "white" but received "${color}"`);}return tokens.color(color)[variant][_state];}return tokens.base[variant][_state];};var getTextColorToken=function getTextColorToken(_ref2){var property=_ref2.property,variant=_ref2.variant,state=_ref2.state,color=_ref2.color;var tokens=textColor(property);var _state=state==='focus'||state==='hover'?'highlighted':state;if(color==='white'){return tokens.white[variant][_state];}if(color&&color!=='primary'){if(variant==='tertiary'){throw new Error(`Tertiary variant can only be used with color: "primary" or "white" but received "${color}"`);}return tokens.color(color)[variant][_state];}return tokens.base[variant][_state];};var getProps=function getProps(_ref3){var buttonTypographyTokens=_ref3.buttonTypographyTokens,childrenString=_ref3.childrenString,isDisabled=_ref3.isDisabled,size=_ref3.size,theme=_ref3.theme,variant=_ref3.variant,color=_ref3.color,hasIcon=_ref3.hasIcon;if(variant==='tertiary'&&color!=='primary'&&color!=='white'){throwBladeError({moduleName:'BaseButton',message:`Tertiary variant can only be used with color: "primary" or "white" but received "${color}"`});}var isIconOnly=hasIcon&&(!childrenString||(childrenString==null?void 0:childrenString.trim().length)===0);var props={iconSize:isIconOnly?buttonIconOnlySizeToIconSizeMap[size]:buttonSizeToIconSizeMap[size],spinnerSize:buttonSizeToSpinnerSizeMap[size],fontSize:buttonTypographyTokens.fonts.size[size],lineHeight:buttonTypographyTokens.lineHeights[size],minHeight:makeSize(minHeight[size]),height:isIconOnly?buttonIconOnlyHeightWidth[size]:undefined,width:isIconOnly?buttonIconOnlyHeightWidth[size]:undefined,iconPadding:hasIcon&&childrenString!=null&&childrenString.trim()?`spacing.${buttonIconPadding[size]}`:undefined,iconColor:getTextColorToken({property:'icon',variant:variant,color:color,state:'default'}),textColor:getTextColorToken({property:'text',variant:variant,color:color,state:'default'}),buttonPaddingTop:isIconOnly?makeSpace(0):makeSpace(theme.spacing[buttonPadding[size].top]),buttonPaddingBottom:isIconOnly?makeSpace(0):makeSpace(theme.spacing[buttonPadding[size].bottom]),buttonPaddingLeft:isIconOnly?makeSpace(0):makeSpace(theme.spacing[buttonPadding[size].left]),buttonPaddingRight:isIconOnly?makeSpace(0):makeSpace(theme.spacing[buttonPadding[size].right]),text:childrenString==null?void 0:childrenString.trim(),defaultBackgroundColor:getIn(theme.colors,getBackgroundColorToken({property:'background',variant:variant,color:color,state:'default'})),defaultBorderColor:getIn(theme.colors,getBackgroundColorToken({property:'border',variant:variant,color:color,state:'default'})),hoverBackgroundColor:getIn(theme.colors,getBackgroundColorToken({property:'background',variant:variant,color:color,state:'hover'})),hoverBorderColor:getIn(theme.colors,getBackgroundColorToken({property:'border',variant:variant,color:color,state:'hover'})),focusBackgroundColor:getIn(theme.colors,getBackgroundColorToken({property:'background',variant:variant,color:color,state:'focus'})),focusBorderColor:getIn(theme.colors,getBackgroundColorToken({property:'border',variant:variant,color:color,state:'focus'})),focusRingColor:getIn(theme.colors,'surface.border.primary.muted'),borderWidth:variant=='secondary'?makeBorderSize(theme.border.width.thin):'0px',borderRadius:makeBorderSize(theme.border.radius.medium),motionDuration:'duration.xquick',motionEasing:'easing.standard.effective'};if(isDisabled){var disabledBackgroundColor=getIn(theme.colors,getBackgroundColorToken({property:'background',variant:variant,color:color,state:'disabled'}));var disabledBorderColor=getIn(theme.colors,getBackgroundColorToken({property:'border',variant:variant,color:color,state:'disabled'}));props.iconColor=getTextColorToken({property:'icon',variant:variant,color:color,state:'disabled'});props.textColor=getTextColorToken({property:'text',variant:variant,color:color,state:'disabled'});props.defaultBackgroundColor=disabledBackgroundColor;props.defaultBorderColor=disabledBorderColor;props.hoverBackgroundColor=disabledBackgroundColor;props.hoverBorderColor=disabledBorderColor;props.focusBackgroundColor=disabledBackgroundColor;props.focusBorderColor=disabledBorderColor;}return props;};var ButtonContent=styled(BaseBox)(function(_ref4){var isHidden=_ref4.isHidden;return {opacity:isHidden?0:1};});var _BaseButton=function _BaseButton(_ref5,ref){var _buttonGroupProps$isD,_buttonGroupProps$siz,_buttonGroupProps$var,_buttonGroupProps$col,_accessibilityProps$r,_buttonGroupProps$isF;var href=_ref5.href,target=_ref5.target,rel=_ref5.rel,tabIndex=_ref5.tabIndex,id=_ref5.id,_ref5$variant=_ref5.variant,variant=_ref5$variant===void 0?'primary':_ref5$variant,_ref5$color=_ref5.color,color=_ref5$color===void 0?'primary':_ref5$color,_ref5$size=_ref5.size,size=_ref5$size===void 0?'medium':_ref5$size,Icon=_ref5.icon,_ref5$iconPosition=_ref5.iconPosition,iconPosition=_ref5$iconPosition===void 0?'left':_ref5$iconPosition,_ref5$isDisabled=_ref5.isDisabled,isDisabled=_ref5$isDisabled===void 0?false:_ref5$isDisabled,_ref5$isFullWidth=_ref5.isFullWidth,isFullWidth=_ref5$isFullWidth===void 0?false:_ref5$isFullWidth,_ref5$isLoading=_ref5.isLoading,isLoading=_ref5$isLoading===void 0?false:_ref5$isLoading,onClick=_ref5.onClick,onBlur=_ref5.onBlur,_onKeyDown=_ref5.onKeyDown,_ref5$type=_ref5.type,type=_ref5$type===void 0?'button':_ref5$type,children=_ref5.children,testID=_ref5.testID,onFocus=_ref5.onFocus,onMouseLeave=_ref5.onMouseLeave,onMouseMove=_ref5.onMouseMove,_onMouseDown=_ref5.onMouseDown,onPointerDown=_ref5.onPointerDown,onPointerEnter=_ref5.onPointerEnter,accessibilityProps=_ref5.accessibilityProps,_onTouchEnd=_ref5.onTouchEnd,_onTouchStart=_ref5.onTouchStart,rest=_objectWithoutProperties(_ref5,_excluded);var _useTheme=useTheme(),theme=_useTheme.theme;var buttonGroupProps=useButtonGroupContext();var _React$useState=React__default.useState(false),_React$useState2=_slicedToArray(_React$useState,2),isPressed=_React$useState2[0],setIsPressed=_React$useState2[1];var isLink=Boolean(href);var childrenString=getStringFromReactText(children);var isChildrenComponent=React__default.isValidElement(children);var disabled=(_buttonGroupProps$isD=buttonGroupProps.isDisabled)!=null?_buttonGroupProps$isD:isLoading||isDisabled&&!isLink;if(__DEV__){if(!Icon&&!(childrenString!=null&&childrenString.trim())){throwBladeError({message:'At least one of icon or text is required to render a button.',moduleName:'BaseButton'});}}var prevLoading=usePrevious(isLoading);React__default.useEffect(function(){if(isLoading)announce('Started loading');if(!isLoading&&prevLoading)announce('Stopped loading');},[isLoading,prevLoading]);var _getProps=getProps({buttonTypographyTokens:typography,childrenString:childrenString,isDisabled:disabled,size:(_buttonGroupProps$siz=buttonGroupProps.size)!=null?_buttonGroupProps$siz:size,variant:(_buttonGroupProps$var=buttonGroupProps.variant)!=null?_buttonGroupProps$var:variant,theme:theme,color:(_buttonGroupProps$col=buttonGroupProps.color)!=null?_buttonGroupProps$col:color,hasIcon:Boolean(Icon)}),defaultBorderColor=_getProps.defaultBorderColor,defaultBackgroundColor=_getProps.defaultBackgroundColor,minHeight=_getProps.minHeight,height=_getProps.height,width=_getProps.width,buttonPaddingTop=_getProps.buttonPaddingTop,buttonPaddingBottom=_getProps.buttonPaddingBottom,buttonPaddingLeft=_getProps.buttonPaddingLeft,buttonPaddingRight=_getProps.buttonPaddingRight,focusBorderColor=_getProps.focusBorderColor,focusBackgroundColor=_getProps.focusBackgroundColor,focusRingColor=_getProps.focusRingColor,fontSize=_getProps.fontSize,hoverBorderColor=_getProps.hoverBorderColor,hoverBackgroundColor=_getProps.hoverBackgroundColor,iconColor=_getProps.iconColor,iconSize=_getProps.iconSize,iconPadding=_getProps.iconPadding,spinnerSize=_getProps.spinnerSize,lineHeight=_getProps.lineHeight,text=_getProps.text,textColor=_getProps.textColor,borderWidth=_getProps.borderWidth,borderRadius=_getProps.borderRadius,motionDuration=_getProps.motionDuration,motionEasing=_getProps.motionEasing;var renderElement=React__default.useMemo(function(){return getRenderElement(href);},[href]);var defaultRel=target==='_blank'?'noreferrer noopener':undefined;var defaultRole=isLink?'link':'button';var handlePointerPressedIn=React__default.useCallback(function(){if(disabled)return;setIsPressed(true);},[disabled]);var handlePointerPressedOut=React__default.useCallback(function(){if(disabled)return;setIsPressed(false);},[disabled]);var handleKeyboardPressedIn=React__default.useCallback(function(e){if(disabled)return;if(e.key===' '||e.key==='Enter'){setIsPressed(true);}},[disabled]);var handleKeyboardPressedOut=React__default.useCallback(function(e){if(disabled)return;if(e.key===' '||e.key==='Enter'){setIsPressed(false);}},[disabled]);return jsx(StyledBaseButton,Object.assign({ref:ref,id:id,as:renderElement,href:href,target:target,rel:rel!=null?rel:defaultRel,accessibilityProps:Object.assign({},makeAccessible(Object.assign({},accessibilityProps,{role:(_accessibilityProps$r=accessibilityProps==null?void 0:accessibilityProps.role)!=null?_accessibilityProps$r:defaultRole}))),variant:variant,isLoading:isLoading,disabled:disabled,defaultBorderColor:defaultBorderColor,minHeight:minHeight,buttonPaddingTop:buttonPaddingTop,buttonPaddingBottom:buttonPaddingBottom,buttonPaddingLeft:buttonPaddingLeft,buttonPaddingRight:buttonPaddingRight,defaultBackgroundColor:defaultBackgroundColor,focusBorderColor:focusBorderColor,focusBackgroundColor:focusBackgroundColor,focusRingColor:focusRingColor,hoverBorderColor:hoverBorderColor,hoverBackgroundColor:hoverBackgroundColor,isFullWidth:(_buttonGroupProps$isF=buttonGroupProps.isFullWidth)!=null?_buttonGroupProps$isF:isFullWidth,onClick:onClick,onBlur:onBlur,onFocus:onFocus,onMouseLeave:onMouseLeave,onMouseMove:onMouseMove,tabIndex:tabIndex,onPointerDown:onPointerDown,onPointerEnter:onPointerEnter,onKeyDown:function onKeyDown(event){handleKeyboardPressedIn(event);_onKeyDown==null?void 0:_onKeyDown(event);},onTouchStart:function onTouchStart(event){handlePointerPressedIn();_onTouchStart==null?void 0:_onTouchStart(event);},onTouchEnd:function onTouchEnd(event){handlePointerPressedOut();_onTouchEnd==null?void 0:_onTouchEnd(event);},type:type,borderWidth:borderWidth,borderRadius:borderRadius,motionDuration:motionDuration,motionEasing:motionEasing,height:height,width:width,isPressed:isPressed,onMouseDown:function onMouseDown(event){handlePointerPressedIn();_onMouseDown==null?void 0:_onMouseDown(event);},onMouseUp:handlePointerPressedOut,onMouseOut:handlePointerPressedOut,onKeyUp:handleKeyboardPressedOut},metaAttribute({name:MetaConstants.Button,testID:testID}),getStyledProps(rest),{children:jsxs(AnimatedButtonContent,{motionDuration:motionDuration,motionEasing:motionEasing,isPressed:isPressed,children:[isLoading?jsx(BaseBox,{display:"flex",justifyContent:"center",alignItems:"center",position:"absolute",top:"0px",left:"0px",bottom:"0px",right:"0px",zIndex:1,children:jsx(BaseSpinner,{accessibilityLabel:"Loading",size:spinnerSize,color:color})}):null,jsxs(ButtonContent,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",flex:1,isHidden:isLoading,zIndex:1,children:[Icon&&iconPosition=='left'?jsx(BaseBox,{paddingRight:iconPadding,display:"flex",justifyContent:"center",alignItems:"center",children:jsx(Icon,{size:iconSize,color:iconColor})}):null,text?isChildrenComponent?children:jsx(BaseText,{lineHeight:lineHeight,fontSize:fontSize,fontWeight:"medium",textAlign:"center",color:textColor,children:text}):null,Icon&&iconPosition=='right'?jsx(BaseBox,{paddingLeft:iconPadding,display:"flex",justifyContent:"center",alignItems:"center",children:jsx(Icon,{size:iconSize,color:iconColor})}):null]})]})}));};var BaseButton=assignWithoutSideEffects(React__default.forwardRef(_BaseButton),{displayName:'BaseButton'});
35
+ var _excluded=["href","target","rel","tabIndex","id","variant","color","size","icon","iconPosition","isDisabled","isFullWidth","isLoading","onClick","onBlur","onKeyDown","type","children","testID","onFocus","onMouseLeave","onMouseMove","onMouseDown","onPointerDown","onPointerEnter","accessibilityProps","onTouchEnd","onTouchStart"];var getRenderElement=function getRenderElement(href){if(isReactNative()){return undefined;}if(href){return 'a';}return 'button';};var getBackgroundColorToken=function getBackgroundColorToken(_ref){var property=_ref.property,variant=_ref.variant,state=_ref.state,color=_ref.color;var _state=state==='focus'||state==='hover'?'highlighted':state;var tokens=backgroundColor(property);if(color==='white'){return tokens.white[variant][_state];}if(color&&color!=='primary'){if(variant==='tertiary'){throw new Error(`Tertiary variant can only be used with color: "primary" or "white" but received "${color}"`);}return tokens.color(color)[variant][_state];}return tokens.base[variant][_state];};var getTextColorToken=function getTextColorToken(_ref2){var property=_ref2.property,variant=_ref2.variant,state=_ref2.state,color=_ref2.color;var tokens=textColor(property);var _state=state==='focus'||state==='hover'?'highlighted':state;if(color==='white'){return tokens.white[variant][_state];}if(color&&color!=='primary'){if(variant==='tertiary'){throw new Error(`Tertiary variant can only be used with color: "primary" or "white" but received "${color}"`);}return tokens.color(color)[variant][_state];}return tokens.base[variant][_state];};var getProps=function getProps(_ref3){var buttonTypographyTokens=_ref3.buttonTypographyTokens,childrenString=_ref3.childrenString,isDisabled=_ref3.isDisabled,size=_ref3.size,theme=_ref3.theme,variant=_ref3.variant,color=_ref3.color,hasIcon=_ref3.hasIcon;if(variant==='tertiary'&&color!=='primary'&&color!=='white'){throwBladeError({moduleName:'BaseButton',message:`Tertiary variant can only be used with color: "primary" or "white" but received "${color}"`});}var isIconOnly=hasIcon&&(!childrenString||(childrenString==null?void 0:childrenString.trim().length)===0);var props={iconSize:isIconOnly?buttonIconOnlySizeToIconSizeMap[size]:buttonSizeToIconSizeMap[size],spinnerSize:buttonSizeToSpinnerSizeMap[size],fontSize:buttonTypographyTokens.fonts.size[size],lineHeight:buttonTypographyTokens.lineHeights[size],minHeight:makeSize(minHeight[size]),height:isIconOnly?buttonIconOnlyHeightWidth[size]:undefined,width:isIconOnly?buttonIconOnlyHeightWidth[size]:undefined,iconPadding:hasIcon&&childrenString!=null&&childrenString.trim()?`spacing.${buttonIconPadding[size]}`:undefined,iconColor:getTextColorToken({property:'icon',variant:variant,color:color,state:'default'}),textColor:getTextColorToken({property:'text',variant:variant,color:color,state:'default'}),buttonPaddingTop:isIconOnly?makeSpace(0):makeSpace(theme.spacing[buttonPadding[size].top]),buttonPaddingBottom:isIconOnly?makeSpace(0):makeSpace(theme.spacing[buttonPadding[size].bottom]),buttonPaddingLeft:isIconOnly?makeSpace(0):makeSpace(theme.spacing[buttonPadding[size].left]),buttonPaddingRight:isIconOnly?makeSpace(0):makeSpace(theme.spacing[buttonPadding[size].right]),text:childrenString==null?void 0:childrenString.trim(),defaultBackgroundColor:getIn(theme.colors,getBackgroundColorToken({property:'background',variant:variant,color:color,state:'default'})),defaultBorderColor:getIn(theme.colors,getBackgroundColorToken({property:'border',variant:variant,color:color,state:'default'})),hoverBackgroundColor:getIn(theme.colors,getBackgroundColorToken({property:'background',variant:variant,color:color,state:'hover'})),hoverBorderColor:getIn(theme.colors,getBackgroundColorToken({property:'border',variant:variant,color:color,state:'hover'})),focusBackgroundColor:getIn(theme.colors,getBackgroundColorToken({property:'background',variant:variant,color:color,state:'focus'})),focusBorderColor:getIn(theme.colors,getBackgroundColorToken({property:'border',variant:variant,color:color,state:'focus'})),focusRingColor:getIn(theme.colors,'surface.border.primary.muted'),borderWidth:variant=='secondary'?makeBorderSize(theme.border.width.thin):'0px',borderRadius:makeBorderSize(theme.border.radius.medium),motionDuration:'duration.xquick',motionEasing:'easing.standard.effective'};if(isDisabled){var disabledBackgroundColor=getIn(theme.colors,getBackgroundColorToken({property:'background',variant:variant,color:color,state:'disabled'}));var disabledBorderColor=getIn(theme.colors,getBackgroundColorToken({property:'border',variant:variant,color:color,state:'disabled'}));props.iconColor=getTextColorToken({property:'icon',variant:variant,color:color,state:'disabled'});props.textColor=getTextColorToken({property:'text',variant:variant,color:color,state:'disabled'});props.defaultBackgroundColor=disabledBackgroundColor;props.defaultBorderColor=disabledBorderColor;props.hoverBackgroundColor=disabledBackgroundColor;props.hoverBorderColor=disabledBorderColor;props.focusBackgroundColor=disabledBackgroundColor;props.focusBorderColor=disabledBorderColor;}return props;};var ButtonContent=styled(BaseBox)(function(_ref4){var isHidden=_ref4.isHidden;return {opacity:isHidden?0:1};});var _BaseButton=function _BaseButton(_ref5,ref){var _buttonGroupProps$isD,_buttonGroupProps$siz,_buttonGroupProps$var,_buttonGroupProps$col,_accessibilityProps$r,_buttonGroupProps$isF;var href=_ref5.href,target=_ref5.target,rel=_ref5.rel,tabIndex=_ref5.tabIndex,id=_ref5.id,_ref5$variant=_ref5.variant,variant=_ref5$variant===void 0?'primary':_ref5$variant,_ref5$color=_ref5.color,color=_ref5$color===void 0?'primary':_ref5$color,_ref5$size=_ref5.size,size=_ref5$size===void 0?'medium':_ref5$size,Icon=_ref5.icon,_ref5$iconPosition=_ref5.iconPosition,iconPosition=_ref5$iconPosition===void 0?'left':_ref5$iconPosition,_ref5$isDisabled=_ref5.isDisabled,isDisabled=_ref5$isDisabled===void 0?false:_ref5$isDisabled,_ref5$isFullWidth=_ref5.isFullWidth,isFullWidth=_ref5$isFullWidth===void 0?false:_ref5$isFullWidth,_ref5$isLoading=_ref5.isLoading,isLoading=_ref5$isLoading===void 0?false:_ref5$isLoading,onClick=_ref5.onClick,onBlur=_ref5.onBlur,_onKeyDown=_ref5.onKeyDown,_ref5$type=_ref5.type,type=_ref5$type===void 0?'button':_ref5$type,children=_ref5.children,testID=_ref5.testID,onFocus=_ref5.onFocus,onMouseLeave=_ref5.onMouseLeave,onMouseMove=_ref5.onMouseMove,_onMouseDown=_ref5.onMouseDown,onPointerDown=_ref5.onPointerDown,onPointerEnter=_ref5.onPointerEnter,accessibilityProps=_ref5.accessibilityProps,_onTouchEnd=_ref5.onTouchEnd,_onTouchStart=_ref5.onTouchStart,rest=_objectWithoutProperties(_ref5,_excluded);var _useTheme=useTheme(),theme=_useTheme.theme;var buttonGroupProps=useButtonGroupContext();var _React$useState=React__default.useState(false),_React$useState2=_slicedToArray(_React$useState,2),isPressed=_React$useState2[0],setIsPressed=_React$useState2[1];var isLink=Boolean(href);var childrenString=getStringFromReactText(children);var isChildrenComponent=React__default.isValidElement(children);var disabled=(_buttonGroupProps$isD=buttonGroupProps.isDisabled)!=null?_buttonGroupProps$isD:isLoading||isDisabled&&!isLink;if(__DEV__){if(!Icon&&!(childrenString!=null&&childrenString.trim())){throwBladeError({message:'At least one of icon or text is required to render a button.',moduleName:'BaseButton'});}}var prevLoading=usePrevious(isLoading);React__default.useEffect(function(){if(isLoading)announce('Started loading');if(!isLoading&&prevLoading)announce('Stopped loading');},[isLoading,prevLoading]);var _getProps=getProps({buttonTypographyTokens:typography,childrenString:childrenString,isDisabled:disabled,size:(_buttonGroupProps$siz=buttonGroupProps.size)!=null?_buttonGroupProps$siz:size,variant:(_buttonGroupProps$var=buttonGroupProps.variant)!=null?_buttonGroupProps$var:variant,theme:theme,color:(_buttonGroupProps$col=buttonGroupProps.color)!=null?_buttonGroupProps$col:color,hasIcon:Boolean(Icon)}),defaultBorderColor=_getProps.defaultBorderColor,defaultBackgroundColor=_getProps.defaultBackgroundColor,minHeight=_getProps.minHeight,height=_getProps.height,width=_getProps.width,buttonPaddingTop=_getProps.buttonPaddingTop,buttonPaddingBottom=_getProps.buttonPaddingBottom,buttonPaddingLeft=_getProps.buttonPaddingLeft,buttonPaddingRight=_getProps.buttonPaddingRight,focusBorderColor=_getProps.focusBorderColor,focusBackgroundColor=_getProps.focusBackgroundColor,focusRingColor=_getProps.focusRingColor,fontSize=_getProps.fontSize,hoverBorderColor=_getProps.hoverBorderColor,hoverBackgroundColor=_getProps.hoverBackgroundColor,iconColor=_getProps.iconColor,iconSize=_getProps.iconSize,iconPadding=_getProps.iconPadding,spinnerSize=_getProps.spinnerSize,lineHeight=_getProps.lineHeight,text=_getProps.text,textColor=_getProps.textColor,borderWidth=_getProps.borderWidth,borderRadius=_getProps.borderRadius,motionDuration=_getProps.motionDuration,motionEasing=_getProps.motionEasing;var renderElement=React__default.useMemo(function(){return getRenderElement(href);},[href]);var defaultRole=isLink?'link':'button';var handlePointerPressedIn=React__default.useCallback(function(){if(disabled)return;setIsPressed(true);},[disabled]);var handlePointerPressedOut=React__default.useCallback(function(){if(disabled)return;setIsPressed(false);},[disabled]);var handleKeyboardPressedIn=React__default.useCallback(function(e){if(disabled)return;if(e.key===' '||e.key==='Enter'){setIsPressed(true);}},[disabled]);var handleKeyboardPressedOut=React__default.useCallback(function(e){if(disabled)return;if(e.key===' '||e.key==='Enter'){setIsPressed(false);}},[disabled]);return jsx(StyledBaseButton,Object.assign({ref:ref,id:id,as:renderElement,href:href,target:target,rel:rel,accessibilityProps:Object.assign({},makeAccessible(Object.assign({},accessibilityProps,{role:(_accessibilityProps$r=accessibilityProps==null?void 0:accessibilityProps.role)!=null?_accessibilityProps$r:defaultRole}))),variant:variant,isLoading:isLoading,disabled:disabled,defaultBorderColor:defaultBorderColor,minHeight:minHeight,buttonPaddingTop:buttonPaddingTop,buttonPaddingBottom:buttonPaddingBottom,buttonPaddingLeft:buttonPaddingLeft,buttonPaddingRight:buttonPaddingRight,defaultBackgroundColor:defaultBackgroundColor,focusBorderColor:focusBorderColor,focusBackgroundColor:focusBackgroundColor,focusRingColor:focusRingColor,hoverBorderColor:hoverBorderColor,hoverBackgroundColor:hoverBackgroundColor,isFullWidth:(_buttonGroupProps$isF=buttonGroupProps.isFullWidth)!=null?_buttonGroupProps$isF:isFullWidth,onClick:onClick,onBlur:onBlur,onFocus:onFocus,onMouseLeave:onMouseLeave,onMouseMove:onMouseMove,tabIndex:tabIndex,onPointerDown:onPointerDown,onPointerEnter:onPointerEnter,onKeyDown:function onKeyDown(event){handleKeyboardPressedIn(event);_onKeyDown==null?void 0:_onKeyDown(event);},onTouchStart:function onTouchStart(event){handlePointerPressedIn();_onTouchStart==null?void 0:_onTouchStart(event);},onTouchEnd:function onTouchEnd(event){handlePointerPressedOut();_onTouchEnd==null?void 0:_onTouchEnd(event);},type:type,borderWidth:borderWidth,borderRadius:borderRadius,motionDuration:motionDuration,motionEasing:motionEasing,height:height,width:width,isPressed:isPressed,onMouseDown:function onMouseDown(event){handlePointerPressedIn();_onMouseDown==null?void 0:_onMouseDown(event);},onMouseUp:handlePointerPressedOut,onMouseOut:handlePointerPressedOut,onKeyUp:handleKeyboardPressedOut},metaAttribute({name:MetaConstants.Button,testID:testID}),getStyledProps(rest),{children:jsxs(AnimatedButtonContent,{motionDuration:motionDuration,motionEasing:motionEasing,isPressed:isPressed,children:[isLoading?jsx(BaseBox,{display:"flex",justifyContent:"center",alignItems:"center",position:"absolute",top:"0px",left:"0px",bottom:"0px",right:"0px",zIndex:1,children:jsx(BaseSpinner,{accessibilityLabel:"Loading",size:spinnerSize,color:color})}):null,jsxs(ButtonContent,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",flex:1,isHidden:isLoading,zIndex:1,children:[Icon&&iconPosition=='left'?jsx(BaseBox,{paddingRight:iconPadding,display:"flex",justifyContent:"center",alignItems:"center",children:jsx(Icon,{size:iconSize,color:iconColor})}):null,text?isChildrenComponent?children:jsx(BaseText,{lineHeight:lineHeight,fontSize:fontSize,fontWeight:"medium",textAlign:"center",color:textColor,children:text}):null,Icon&&iconPosition=='right'?jsx(BaseBox,{paddingLeft:iconPadding,display:"flex",justifyContent:"center",alignItems:"center",children:jsx(Icon,{size:iconSize,color:iconColor})}):null]})]})}));};var BaseButton=assignWithoutSideEffects(React__default.forwardRef(_BaseButton),{displayName:'BaseButton'});
36
36
 
37
37
  export { BaseButton as default, getBackgroundColorToken, getTextColorToken };
38
38
  //# sourceMappingURL=BaseButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BaseButton.js","sources":["../../../../../../src/components/Button/BaseButton/BaseButton.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/explicit-function-return-type */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react';\nimport styled from 'styled-components';\nimport type { GestureResponderEvent } from 'react-native';\nimport StyledBaseButton from './StyledBaseButton';\nimport type { ButtonTypography } from './buttonTokens';\nimport {\n textColor,\n backgroundColor,\n buttonIconOnlySizeToIconSizeMap,\n typography as buttonTypography,\n minHeight as buttonMinHeight,\n buttonSizeToIconSizeMap,\n buttonSizeToSpinnerSizeMap,\n buttonIconPadding,\n buttonPadding,\n buttonIconOnlyHeightWidth,\n} from './buttonTokens';\nimport type { BaseButtonStyleProps, IconColor } from './types';\nimport AnimatedButtonContent from './AnimatedButtonContent';\nimport type { DotNotationToken } from '~utils/lodashButBetter/get';\nimport getIn from '~utils/lodashButBetter/get';\nimport type { BaseLinkProps } from '~components/Link/BaseLink';\nimport type { Theme } from '~components/BladeProvider';\nimport type { IconComponent } from '~components/Icons';\nimport type { Platform } from '~utils';\nimport { isReactNative } from '~utils';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { useButtonGroupContext } from '~components/ButtonGroup/ButtonGroupContext';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport { BaseText } from '~components/Typography/BaseText';\nimport { useTheme } from '~components/BladeProvider';\nimport { announce } from '~components/LiveAnnouncer';\nimport { BaseSpinner } from '~components/Spinner/BaseSpinner';\nimport type { BaseBoxProps } from '~components/Box/BaseBox';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { BladeElementRef, StringChildrenType, TestID } from '~utils/types';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { usePrevious } from '~utils/usePrevious';\nimport { makeSize } from '~utils/makeSize';\nimport { makeBorderSize } from '~utils/makeBorderSize';\nimport type { AccessibilityProps } from '~utils/makeAccessible';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { makeSpace } from '~utils/makeSpace';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { getStringFromReactText } from '~src/utils/getStringChildren';\nimport type { BladeCommonEvents } from '~components/types';\nimport { throwBladeError } from '~utils/logger';\n\ntype BaseButtonCommonProps = {\n href?: BaseLinkProps['href'];\n target?: BaseLinkProps['target'];\n rel?: BaseLinkProps['rel'];\n size?: 'xsmall' | 'small' | 'medium' | 'large';\n id?: string;\n tabIndex?: BaseBoxProps['tabIndex'];\n iconPosition?: 'left' | 'right';\n isDisabled?: boolean;\n isFullWidth?: boolean;\n onKeyDown?: Platform.Select<{\n native: (event: GestureResponderEvent) => void;\n web: (event: React.KeyboardEvent<HTMLButtonElement>) => void;\n }>;\n onClick?: Platform.Select<{\n native: (event: GestureResponderEvent) => void;\n web: (event: React.MouseEvent<HTMLButtonElement>) => void;\n }>;\n type?: 'button' | 'reset' | 'submit';\n isLoading?: boolean;\n accessibilityProps?: Partial<AccessibilityProps>;\n variant?: 'primary' | 'secondary' | 'tertiary';\n color?: 'primary' | 'white' | 'positive' | 'negative' | 'notice' | 'information' | 'neutral';\n} & TestID &\n StyledPropsBlade &\n BladeCommonEvents;\n\n/*\nMandatory children prop when icon is not provided\n*/\ntype BaseButtonWithoutIconProps = BaseButtonCommonProps & {\n icon?: undefined;\n children: StringChildrenType;\n};\n\n/*\n Optional children prop when icon is provided\n*/\ntype BaseButtonWithIconProps = BaseButtonCommonProps & {\n icon: IconComponent;\n children?: StringChildrenType;\n};\n\n/*\n With or without icon prop. We need at least an icon or a children prop present.\n*/\nexport type BaseButtonProps = BaseButtonWithIconProps | BaseButtonWithoutIconProps;\n\ntype BaseButtonColorTokenModifiers = {\n variant: NonNullable<BaseButtonProps['variant']>;\n state: 'default' | 'hover' | 'focus' | 'disabled';\n color: BaseButtonProps['color'];\n};\n\nconst getRenderElement = (href?: string): 'a' | 'button' | undefined => {\n if (isReactNative()) {\n return undefined; // as property doesn't work with react native\n }\n\n if (href) {\n return 'a';\n }\n\n return 'button';\n};\n\nexport const getBackgroundColorToken = ({\n property,\n variant,\n state,\n color,\n}: BaseButtonColorTokenModifiers & {\n property: 'background' | 'border';\n}): DotNotationToken<Theme['colors']> => {\n const _state = state === 'focus' || state === 'hover' ? 'highlighted' : state;\n const tokens = backgroundColor(property);\n\n if (color === 'white') {\n return tokens.white[variant][_state];\n }\n\n if (color && color !== 'primary') {\n if (variant === 'tertiary') {\n throw new Error(\n `Tertiary variant can only be used with color: \"primary\" or \"white\" but received \"${color}\"`,\n );\n }\n return tokens.color(color)[variant][_state];\n }\n\n return tokens.base[variant][_state];\n};\n\nexport const getTextColorToken = ({\n property,\n variant,\n state,\n color,\n}: BaseButtonColorTokenModifiers & {\n property: 'icon' | 'text';\n}): DotNotationToken<Theme['colors']> => {\n const tokens = textColor(property);\n const _state = state === 'focus' || state === 'hover' ? 'highlighted' : state;\n\n if (color === 'white') {\n return tokens.white[variant][_state];\n }\n\n if (color && color !== 'primary') {\n if (variant === 'tertiary') {\n throw new Error(\n `Tertiary variant can only be used with color: \"primary\" or \"white\" but received \"${color}\"`,\n );\n }\n return tokens.color(color)[variant][_state];\n }\n\n return tokens.base[variant][_state];\n};\n\nconst getProps = ({\n buttonTypographyTokens,\n childrenString,\n isDisabled,\n size,\n theme,\n variant,\n color,\n hasIcon,\n}: {\n buttonTypographyTokens: ButtonTypography;\n childrenString?: string;\n isDisabled: boolean;\n hasIcon: boolean;\n theme: Theme;\n size: NonNullable<BaseButtonProps['size']>;\n variant: NonNullable<BaseButtonProps['variant']>;\n color: BaseButtonProps['color'];\n}): BaseButtonStyleProps => {\n if (variant === 'tertiary' && color !== 'primary' && color !== 'white') {\n throwBladeError({\n moduleName: 'BaseButton',\n message: `Tertiary variant can only be used with color: \"primary\" or \"white\" but received \"${color}\"`,\n });\n }\n\n const isIconOnly = hasIcon && (!childrenString || childrenString?.trim().length === 0);\n const props: BaseButtonStyleProps = {\n iconSize: isIconOnly ? buttonIconOnlySizeToIconSizeMap[size] : buttonSizeToIconSizeMap[size],\n spinnerSize: buttonSizeToSpinnerSizeMap[size],\n fontSize: buttonTypographyTokens.fonts.size[size],\n lineHeight: buttonTypographyTokens.lineHeights[size],\n minHeight: makeSize(buttonMinHeight[size]),\n height: isIconOnly ? buttonIconOnlyHeightWidth[size] : undefined,\n width: isIconOnly ? buttonIconOnlyHeightWidth[size] : undefined,\n iconPadding:\n hasIcon && childrenString?.trim() ? `spacing.${buttonIconPadding[size]}` : undefined,\n iconColor: getTextColorToken({\n property: 'icon',\n variant,\n color,\n state: 'default',\n }) as IconColor,\n textColor: getTextColorToken({\n property: 'text',\n variant,\n color,\n state: 'default',\n }) as BaseTextProps['color'],\n buttonPaddingTop: isIconOnly ? makeSpace(0) : makeSpace(theme.spacing[buttonPadding[size].top]),\n buttonPaddingBottom: isIconOnly\n ? makeSpace(0)\n : makeSpace(theme.spacing[buttonPadding[size].bottom]),\n buttonPaddingLeft: isIconOnly\n ? makeSpace(0)\n : makeSpace(theme.spacing[buttonPadding[size].left]),\n buttonPaddingRight: isIconOnly\n ? makeSpace(0)\n : makeSpace(theme.spacing[buttonPadding[size].right]),\n text: childrenString?.trim(),\n defaultBackgroundColor: getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'background', variant, color, state: 'default' }),\n ),\n defaultBorderColor: getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'border', variant, color, state: 'default' }),\n ),\n hoverBackgroundColor: getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'background', variant, color, state: 'hover' }),\n ),\n hoverBorderColor: getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'border', variant, color, state: 'hover' }),\n ),\n focusBackgroundColor: getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'background', variant, color, state: 'focus' }),\n ),\n focusBorderColor: getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'border', variant, color, state: 'focus' }),\n ),\n focusRingColor: getIn(theme.colors, 'surface.border.primary.muted'),\n borderWidth: variant == 'secondary' ? makeBorderSize(theme.border.width.thin) : '0px',\n borderRadius: makeBorderSize(theme.border.radius.medium),\n motionDuration: 'duration.xquick',\n motionEasing: 'easing.standard.effective',\n };\n\n if (isDisabled) {\n const disabledBackgroundColor = getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'background', variant, color, state: 'disabled' }),\n );\n const disabledBorderColor = getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'border', variant, color, state: 'disabled' }),\n );\n props.iconColor = getTextColorToken({\n property: 'icon',\n variant,\n color,\n state: 'disabled',\n }) as IconColor;\n props.textColor = getTextColorToken({\n property: 'text',\n variant,\n color,\n state: 'disabled',\n }) as BaseTextProps['color'];\n props.defaultBackgroundColor = disabledBackgroundColor;\n props.defaultBorderColor = disabledBorderColor;\n props.hoverBackgroundColor = disabledBackgroundColor;\n props.hoverBorderColor = disabledBorderColor;\n props.focusBackgroundColor = disabledBackgroundColor;\n props.focusBorderColor = disabledBorderColor;\n }\n\n return props;\n};\n\nconst ButtonContent = styled(BaseBox)<{ isHidden: boolean }>(({ isHidden }) => ({\n opacity: isHidden ? 0 : 1,\n}));\n\nconst _BaseButton: React.ForwardRefRenderFunction<BladeElementRef, BaseButtonProps> = (\n {\n href,\n target,\n rel,\n tabIndex,\n id,\n variant = 'primary',\n color = 'primary',\n size = 'medium',\n icon: Icon,\n iconPosition = 'left',\n isDisabled = false,\n isFullWidth = false,\n isLoading = false,\n onClick,\n onBlur,\n onKeyDown,\n type = 'button',\n children,\n testID,\n onFocus,\n onMouseLeave,\n onMouseMove,\n onMouseDown,\n onPointerDown,\n onPointerEnter,\n accessibilityProps,\n onTouchEnd,\n onTouchStart,\n ...rest\n },\n ref,\n) => {\n const { theme } = useTheme();\n const buttonGroupProps = useButtonGroupContext();\n const [isPressed, setIsPressed] = React.useState(false);\n const isLink = Boolean(href);\n const childrenString = getStringFromReactText(children);\n const isChildrenComponent = React.isValidElement(children);\n\n // Button cannot be disabled when its rendered as Link\n const disabled = buttonGroupProps.isDisabled ?? (isLoading || (isDisabled && !isLink));\n\n if (__DEV__) {\n if (!Icon && !childrenString?.trim()) {\n throwBladeError({\n message: 'At least one of icon or text is required to render a button.',\n moduleName: 'BaseButton',\n });\n }\n }\n\n const prevLoading = usePrevious(isLoading);\n\n React.useEffect(() => {\n if (isLoading) announce('Started loading');\n\n if (!isLoading && prevLoading) announce('Stopped loading');\n }, [isLoading, prevLoading]);\n\n const {\n defaultBorderColor,\n defaultBackgroundColor,\n minHeight,\n height,\n width,\n buttonPaddingTop,\n buttonPaddingBottom,\n buttonPaddingLeft,\n buttonPaddingRight,\n focusBorderColor,\n focusBackgroundColor,\n focusRingColor,\n fontSize,\n hoverBorderColor,\n hoverBackgroundColor,\n iconColor,\n iconSize,\n iconPadding,\n spinnerSize,\n lineHeight,\n text,\n textColor,\n borderWidth,\n borderRadius,\n motionDuration,\n motionEasing,\n } = getProps({\n buttonTypographyTokens: buttonTypography,\n childrenString,\n isDisabled: disabled,\n size: buttonGroupProps.size ?? size,\n variant: buttonGroupProps.variant ?? variant,\n theme,\n color: buttonGroupProps.color ?? color,\n hasIcon: Boolean(Icon),\n });\n\n const renderElement = React.useMemo(() => getRenderElement(href), [href]);\n const defaultRel = target === '_blank' ? 'noreferrer noopener' : undefined;\n const defaultRole = isLink ? 'link' : 'button';\n\n const handlePointerPressedIn = React.useCallback(() => {\n if (disabled) return;\n setIsPressed(true);\n }, [disabled]);\n\n const handlePointerPressedOut = React.useCallback(() => {\n if (disabled) return;\n setIsPressed(false);\n }, [disabled]);\n\n const handleKeyboardPressedIn = React.useCallback(\n (e: React.KeyboardEvent) => {\n if (disabled) return;\n if (e.key === ' ' || e.key === 'Enter') {\n setIsPressed(true);\n }\n },\n [disabled],\n );\n\n const handleKeyboardPressedOut = React.useCallback(\n (e: React.KeyboardEvent) => {\n if (disabled) return;\n if (e.key === ' ' || e.key === 'Enter') {\n setIsPressed(false);\n }\n },\n [disabled],\n );\n\n return (\n <StyledBaseButton\n ref={ref as any}\n id={id}\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment, @typescript-eslint/prefer-ts-expect-error\n // @ts-ignore: On React Native it will always be undefined but TS doesn't understand that\n as={renderElement}\n href={href}\n target={target}\n rel={rel ?? defaultRel}\n accessibilityProps={{\n ...makeAccessible({\n ...accessibilityProps,\n role: accessibilityProps?.role ?? defaultRole,\n }),\n }}\n variant={variant}\n isLoading={isLoading}\n disabled={disabled}\n defaultBorderColor={defaultBorderColor}\n minHeight={minHeight}\n buttonPaddingTop={buttonPaddingTop}\n buttonPaddingBottom={buttonPaddingBottom}\n buttonPaddingLeft={buttonPaddingLeft}\n buttonPaddingRight={buttonPaddingRight}\n defaultBackgroundColor={defaultBackgroundColor}\n focusBorderColor={focusBorderColor}\n focusBackgroundColor={focusBackgroundColor}\n focusRingColor={focusRingColor}\n hoverBorderColor={hoverBorderColor}\n hoverBackgroundColor={hoverBackgroundColor}\n isFullWidth={buttonGroupProps.isFullWidth ?? isFullWidth}\n onClick={onClick}\n onBlur={onBlur}\n onFocus={onFocus}\n onMouseLeave={onMouseLeave}\n onMouseMove={onMouseMove}\n tabIndex={tabIndex}\n onPointerDown={onPointerDown}\n onPointerEnter={onPointerEnter}\n // Setting type for web fails it on native typecheck and vice versa\n onKeyDown={(event: any) => {\n handleKeyboardPressedIn(event);\n onKeyDown?.(event);\n }}\n onTouchStart={(event: React.TouchEvent) => {\n handlePointerPressedIn();\n onTouchStart?.(event);\n }}\n onTouchEnd={(event: React.TouchEvent) => {\n handlePointerPressedOut();\n onTouchEnd?.(event);\n }}\n type={type}\n borderWidth={borderWidth}\n borderRadius={borderRadius}\n motionDuration={motionDuration}\n motionEasing={motionEasing}\n height={height}\n width={width}\n isPressed={isPressed}\n onMouseDown={(event: React.MouseEvent) => {\n handlePointerPressedIn();\n onMouseDown?.(event);\n }}\n onMouseUp={handlePointerPressedOut}\n onMouseOut={handlePointerPressedOut}\n onKeyUp={handleKeyboardPressedOut}\n {...metaAttribute({ name: MetaConstants.Button, testID })}\n {...getStyledProps(rest)}\n >\n <AnimatedButtonContent\n motionDuration={motionDuration}\n motionEasing={motionEasing}\n isPressed={isPressed}\n >\n {isLoading ? (\n <BaseBox\n display=\"flex\"\n justifyContent=\"center\"\n alignItems=\"center\"\n position=\"absolute\"\n top=\"0px\"\n left=\"0px\"\n bottom=\"0px\"\n right=\"0px\"\n zIndex={1}\n >\n <BaseSpinner accessibilityLabel=\"Loading\" size={spinnerSize} color={color} />\n </BaseBox>\n ) : null}\n <ButtonContent\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n flex={1}\n isHidden={isLoading}\n zIndex={1}\n >\n {Icon && iconPosition == 'left' ? (\n <BaseBox\n paddingRight={iconPadding}\n display=\"flex\"\n justifyContent=\"center\"\n alignItems=\"center\"\n >\n <Icon size={iconSize} color={iconColor} />\n </BaseBox>\n ) : null}\n {text ? (\n isChildrenComponent ? (\n children\n ) : (\n <BaseText\n lineHeight={lineHeight}\n fontSize={fontSize}\n // figma and web have different font-smoothing properties\n // which causes web version of button text to look much bolder\n // than figma version. To fix this we are changing font-weight from 600 to 500\n // https://forum.figma.com/t/why-does-a-font-weight-in-figma-seem-lighter-than-the-same-weight-in-the-browser/2207\n fontWeight=\"medium\"\n textAlign=\"center\"\n color={textColor}\n >\n {text}\n </BaseText>\n )\n ) : null}\n {Icon && iconPosition == 'right' ? (\n <BaseBox\n paddingLeft={iconPadding}\n display=\"flex\"\n justifyContent=\"center\"\n alignItems=\"center\"\n >\n <Icon size={iconSize} color={iconColor} />\n </BaseBox>\n ) : null}\n </ButtonContent>\n </AnimatedButtonContent>\n </StyledBaseButton>\n );\n};\n\nconst BaseButton = assignWithoutSideEffects(React.forwardRef(_BaseButton), {\n displayName: 'BaseButton',\n});\n\nexport default BaseButton;\n"],"names":["getRenderElement","href","isReactNative","undefined","getBackgroundColorToken","_ref","property","variant","state","color","_state","tokens","backgroundColor","white","Error","base","getTextColorToken","_ref2","textColor","getProps","_ref3","buttonTypographyTokens","childrenString","isDisabled","size","theme","hasIcon","throwBladeError","moduleName","message","isIconOnly","trim","length","props","iconSize","buttonIconOnlySizeToIconSizeMap","buttonSizeToIconSizeMap","spinnerSize","buttonSizeToSpinnerSizeMap","fontSize","fonts","lineHeight","lineHeights","minHeight","makeSize","buttonMinHeight","height","buttonIconOnlyHeightWidth","width","iconPadding","buttonIconPadding","iconColor","buttonPaddingTop","makeSpace","spacing","buttonPadding","top","buttonPaddingBottom","bottom","buttonPaddingLeft","left","buttonPaddingRight","right","text","defaultBackgroundColor","getIn","colors","defaultBorderColor","hoverBackgroundColor","hoverBorderColor","focusBackgroundColor","focusBorderColor","focusRingColor","borderWidth","makeBorderSize","border","thin","borderRadius","radius","medium","motionDuration","motionEasing","disabledBackgroundColor","disabledBorderColor","ButtonContent","styled","BaseBox","_ref4","isHidden","opacity","_BaseButton","_ref5","ref","_buttonGroupProps$isD","_buttonGroupProps$siz","_buttonGroupProps$var","_buttonGroupProps$col","_accessibilityProps$r","_buttonGroupProps$isF","target","rel","tabIndex","id","_ref5$variant","_ref5$color","_ref5$size","Icon","icon","_ref5$iconPosition","iconPosition","_ref5$isDisabled","_ref5$isFullWidth","isFullWidth","_ref5$isLoading","isLoading","onClick","onBlur","onKeyDown","_ref5$type","type","children","testID","onFocus","onMouseLeave","onMouseMove","onMouseDown","onPointerDown","onPointerEnter","accessibilityProps","onTouchEnd","onTouchStart","rest","_objectWithoutProperties","_excluded","_useTheme","useTheme","buttonGroupProps","useButtonGroupContext","_React$useState","React","useState","_React$useState2","_slicedToArray","isPressed","setIsPressed","isLink","Boolean","getStringFromReactText","isChildrenComponent","isValidElement","disabled","__DEV__","prevLoading","usePrevious","useEffect","announce","_getProps","buttonTypography","renderElement","useMemo","defaultRel","defaultRole","handlePointerPressedIn","useCallback","handlePointerPressedOut","handleKeyboardPressedIn","e","key","handleKeyboardPressedOut","_jsx","StyledBaseButton","Object","assign","as","makeAccessible","role","event","onMouseUp","onMouseOut","onKeyUp","metaAttribute","name","MetaConstants","Button","getStyledProps","_jsxs","AnimatedButtonContent","display","justifyContent","alignItems","position","zIndex","BaseSpinner","accessibilityLabel","flexDirection","flex","paddingRight","BaseText","fontWeight","textAlign","paddingLeft","BaseButton","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAA,SAAA,CAAA,CAAA,MAAA,CAAA,QAAA,CAAA,KAAA,CAAA,UAAA,CAAA,IAAA,CAAA,SAAA,CAAA,OAAA,CAAA,MAAA,CAAA,MAAA,CAAA,cAAA,CAAA,YAAA,CAAA,aAAA,CAAA,WAAA,CAAA,SAAA,CAAA,QAAA,CAAA,WAAA,CAAA,MAAA,CAAA,UAAA,CAAA,QAAA,CAAA,SAAA,CAAA,cAAA,CAAA,aAAA,CAAA,aAAA,CAAA,eAAA,CAAA,gBAAA,CAAA,oBAAA,CAAA,YAAA,CAAA,cAAA,CAAA,CAuGA,IAAMA,gBAAgB,CAAG,SAAnBA,gBAAgBA,CAAIC,IAAa,CAAiC,CACtE,GAAIC,aAAa,EAAE,CAAE,CACnB,OAAOC,SAAS,CAClB,CAEA,GAAIF,IAAI,CAAE,CACR,OAAO,GAAG,CACZ,CAEA,OAAO,QAAQ,CACjB,CAAC,CAEY,IAAAG,uBAAuB,CAAG,SAA1BA,uBAAuBA,CAAAC,IAAA,CAOK,KANvCC,QAAQ,CAAAD,IAAA,CAARC,QAAQ,CACRC,OAAO,CAAAF,IAAA,CAAPE,OAAO,CACPC,KAAK,CAAAH,IAAA,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ETd,CAAAA,IAAI,EAAIG,YAAY,EAAI,MAAM,CAC7B4D,GAAA,CAACnF,OAAO,CACN8G,CAAAA,YAAY,CAAEnJ,WAAY,CAC1B0I,OAAO,CAAC,MAAM,CACdC,cAAc,CAAC,QAAQ,CACvBC,UAAU,CAAC,QAAQ,CAAArE,QAAA,CAEnBiD,GAAA,CAAC/D,IAAI,EAAClF,IAAI,CAAEU,QAAS,CAACzB,KAAK,CAAE0C,SAAU,CAAE,CAAC,CACnC,CAAC,CACR,IAAI,CACPY,IAAI,CACHqF,mBAAmB,CACjB5B,QAAQ,CAERiD,GAAA,CAAC4B,QAAQ,EACP5J,UAAU,CAAEA,UAAW,CACvBF,QAAQ,CAAEA,QAAS,CAKnB+J,UAAU,CAAC,QAAQ,CACnBC,SAAS,CAAC,QAAQ,CAClB9L,KAAK,CAAES,SAAU,CAAAsG,QAAA,CAEhBzD,IAAI,CACG,CACX,CACC,IAAI,CACP2C,IAAI,EAAIG,YAAY,EAAI,OAAO,CAC9B4D,GAAA,CAACnF,OAAO,CAAA,CACNkH,WAAW,CAAEvJ,WAAY,CACzB0I,OAAO,CAAC,MAAM,CACdC,cAAc,CAAC,QAAQ,CACvBC,UAAU,CAAC,QAAQ,CAAArE,QAAA,CAEnBiD,GAAA,CAAC/D,IAAI,CAAClF,CAAAA,IAAI,CAAEU,QAAS,CAACzB,KAAK,CAAE0C,SAAU,CAAE,CAAC,CACnC,CAAC,CACR,IAAI,CAAA,CACK,CAAC,CAAA,CACK,CAAC,CACR,CAAA,CAAC,CAEvB,CAAC,CAEK,IAAAsJ,UAAU,CAAGC,wBAAwB,CAAC/D,cAAK,CAACgE,UAAU,CAACjH,WAAW,CAAC,CAAE,CACzEkH,WAAW,CAAE,YACf,CAAC;;;;"}
1
+ {"version":3,"file":"BaseButton.js","sources":["../../../../../../src/components/Button/BaseButton/BaseButton.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/explicit-function-return-type */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react';\nimport styled from 'styled-components';\nimport type { GestureResponderEvent } from 'react-native';\nimport StyledBaseButton from './StyledBaseButton';\nimport type { ButtonTypography } from './buttonTokens';\nimport {\n textColor,\n backgroundColor,\n buttonIconOnlySizeToIconSizeMap,\n typography as buttonTypography,\n minHeight as buttonMinHeight,\n buttonSizeToIconSizeMap,\n buttonSizeToSpinnerSizeMap,\n buttonIconPadding,\n buttonPadding,\n buttonIconOnlyHeightWidth,\n} from './buttonTokens';\nimport type { BaseButtonStyleProps, IconColor } from './types';\nimport AnimatedButtonContent from './AnimatedButtonContent';\nimport type { DotNotationToken } from '~utils/lodashButBetter/get';\nimport getIn from '~utils/lodashButBetter/get';\nimport type { BaseLinkProps } from '~components/Link/BaseLink';\nimport type { Theme } from '~components/BladeProvider';\nimport type { IconComponent } from '~components/Icons';\nimport type { Platform } from '~utils';\nimport { isReactNative } from '~utils';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { useButtonGroupContext } from '~components/ButtonGroup/ButtonGroupContext';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport { BaseText } from '~components/Typography/BaseText';\nimport { useTheme } from '~components/BladeProvider';\nimport { announce } from '~components/LiveAnnouncer';\nimport { BaseSpinner } from '~components/Spinner/BaseSpinner';\nimport type { BaseBoxProps } from '~components/Box/BaseBox';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { BladeElementRef, StringChildrenType, TestID } from '~utils/types';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { usePrevious } from '~utils/usePrevious';\nimport { makeSize } from '~utils/makeSize';\nimport { makeBorderSize } from '~utils/makeBorderSize';\nimport type { AccessibilityProps } from '~utils/makeAccessible';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { makeSpace } from '~utils/makeSpace';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { getStringFromReactText } from '~src/utils/getStringChildren';\nimport type { BladeCommonEvents } from '~components/types';\nimport { throwBladeError } from '~utils/logger';\n\ntype BaseButtonCommonProps = {\n href?: BaseLinkProps['href'];\n target?: BaseLinkProps['target'];\n rel?: BaseLinkProps['rel'];\n size?: 'xsmall' | 'small' | 'medium' | 'large';\n id?: string;\n tabIndex?: BaseBoxProps['tabIndex'];\n iconPosition?: 'left' | 'right';\n isDisabled?: boolean;\n isFullWidth?: boolean;\n onKeyDown?: Platform.Select<{\n native: (event: GestureResponderEvent) => void;\n web: (event: React.KeyboardEvent<HTMLButtonElement>) => void;\n }>;\n onClick?: Platform.Select<{\n native: (event: GestureResponderEvent) => void;\n web: (event: React.MouseEvent<HTMLButtonElement>) => void;\n }>;\n type?: 'button' | 'reset' | 'submit';\n isLoading?: boolean;\n accessibilityProps?: Partial<AccessibilityProps>;\n variant?: 'primary' | 'secondary' | 'tertiary';\n color?: 'primary' | 'white' | 'positive' | 'negative' | 'notice' | 'information' | 'neutral';\n} & TestID &\n StyledPropsBlade &\n BladeCommonEvents;\n\n/*\nMandatory children prop when icon is not provided\n*/\ntype BaseButtonWithoutIconProps = BaseButtonCommonProps & {\n icon?: undefined;\n children: StringChildrenType;\n};\n\n/*\n Optional children prop when icon is provided\n*/\ntype BaseButtonWithIconProps = BaseButtonCommonProps & {\n icon: IconComponent;\n children?: StringChildrenType;\n};\n\n/*\n With or without icon prop. We need at least an icon or a children prop present.\n*/\nexport type BaseButtonProps = BaseButtonWithIconProps | BaseButtonWithoutIconProps;\n\ntype BaseButtonColorTokenModifiers = {\n variant: NonNullable<BaseButtonProps['variant']>;\n state: 'default' | 'hover' | 'focus' | 'disabled';\n color: BaseButtonProps['color'];\n};\n\nconst getRenderElement = (href?: string): 'a' | 'button' | undefined => {\n if (isReactNative()) {\n return undefined; // as property doesn't work with react native\n }\n\n if (href) {\n return 'a';\n }\n\n return 'button';\n};\n\nexport const getBackgroundColorToken = ({\n property,\n variant,\n state,\n color,\n}: BaseButtonColorTokenModifiers & {\n property: 'background' | 'border';\n}): DotNotationToken<Theme['colors']> => {\n const _state = state === 'focus' || state === 'hover' ? 'highlighted' : state;\n const tokens = backgroundColor(property);\n\n if (color === 'white') {\n return tokens.white[variant][_state];\n }\n\n if (color && color !== 'primary') {\n if (variant === 'tertiary') {\n throw new Error(\n `Tertiary variant can only be used with color: \"primary\" or \"white\" but received \"${color}\"`,\n );\n }\n return tokens.color(color)[variant][_state];\n }\n\n return tokens.base[variant][_state];\n};\n\nexport const getTextColorToken = ({\n property,\n variant,\n state,\n color,\n}: BaseButtonColorTokenModifiers & {\n property: 'icon' | 'text';\n}): DotNotationToken<Theme['colors']> => {\n const tokens = textColor(property);\n const _state = state === 'focus' || state === 'hover' ? 'highlighted' : state;\n\n if (color === 'white') {\n return tokens.white[variant][_state];\n }\n\n if (color && color !== 'primary') {\n if (variant === 'tertiary') {\n throw new Error(\n `Tertiary variant can only be used with color: \"primary\" or \"white\" but received \"${color}\"`,\n );\n }\n return tokens.color(color)[variant][_state];\n }\n\n return tokens.base[variant][_state];\n};\n\nconst getProps = ({\n buttonTypographyTokens,\n childrenString,\n isDisabled,\n size,\n theme,\n variant,\n color,\n hasIcon,\n}: {\n buttonTypographyTokens: ButtonTypography;\n childrenString?: string;\n isDisabled: boolean;\n hasIcon: boolean;\n theme: Theme;\n size: NonNullable<BaseButtonProps['size']>;\n variant: NonNullable<BaseButtonProps['variant']>;\n color: BaseButtonProps['color'];\n}): BaseButtonStyleProps => {\n if (variant === 'tertiary' && color !== 'primary' && color !== 'white') {\n throwBladeError({\n moduleName: 'BaseButton',\n message: `Tertiary variant can only be used with color: \"primary\" or \"white\" but received \"${color}\"`,\n });\n }\n\n const isIconOnly = hasIcon && (!childrenString || childrenString?.trim().length === 0);\n const props: BaseButtonStyleProps = {\n iconSize: isIconOnly ? buttonIconOnlySizeToIconSizeMap[size] : buttonSizeToIconSizeMap[size],\n spinnerSize: buttonSizeToSpinnerSizeMap[size],\n fontSize: buttonTypographyTokens.fonts.size[size],\n lineHeight: buttonTypographyTokens.lineHeights[size],\n minHeight: makeSize(buttonMinHeight[size]),\n height: isIconOnly ? buttonIconOnlyHeightWidth[size] : undefined,\n width: isIconOnly ? buttonIconOnlyHeightWidth[size] : undefined,\n iconPadding:\n hasIcon && childrenString?.trim() ? `spacing.${buttonIconPadding[size]}` : undefined,\n iconColor: getTextColorToken({\n property: 'icon',\n variant,\n color,\n state: 'default',\n }) as IconColor,\n textColor: getTextColorToken({\n property: 'text',\n variant,\n color,\n state: 'default',\n }) as BaseTextProps['color'],\n buttonPaddingTop: isIconOnly ? makeSpace(0) : makeSpace(theme.spacing[buttonPadding[size].top]),\n buttonPaddingBottom: isIconOnly\n ? makeSpace(0)\n : makeSpace(theme.spacing[buttonPadding[size].bottom]),\n buttonPaddingLeft: isIconOnly\n ? makeSpace(0)\n : makeSpace(theme.spacing[buttonPadding[size].left]),\n buttonPaddingRight: isIconOnly\n ? makeSpace(0)\n : makeSpace(theme.spacing[buttonPadding[size].right]),\n text: childrenString?.trim(),\n defaultBackgroundColor: getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'background', variant, color, state: 'default' }),\n ),\n defaultBorderColor: getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'border', variant, color, state: 'default' }),\n ),\n hoverBackgroundColor: getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'background', variant, color, state: 'hover' }),\n ),\n hoverBorderColor: getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'border', variant, color, state: 'hover' }),\n ),\n focusBackgroundColor: getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'background', variant, color, state: 'focus' }),\n ),\n focusBorderColor: getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'border', variant, color, state: 'focus' }),\n ),\n focusRingColor: getIn(theme.colors, 'surface.border.primary.muted'),\n borderWidth: variant == 'secondary' ? makeBorderSize(theme.border.width.thin) : '0px',\n borderRadius: makeBorderSize(theme.border.radius.medium),\n motionDuration: 'duration.xquick',\n motionEasing: 'easing.standard.effective',\n };\n\n if (isDisabled) {\n const disabledBackgroundColor = getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'background', variant, color, state: 'disabled' }),\n );\n const disabledBorderColor = getIn(\n theme.colors,\n getBackgroundColorToken({ property: 'border', variant, color, state: 'disabled' }),\n );\n props.iconColor = getTextColorToken({\n property: 'icon',\n variant,\n color,\n state: 'disabled',\n }) as IconColor;\n props.textColor = getTextColorToken({\n property: 'text',\n variant,\n color,\n state: 'disabled',\n }) as BaseTextProps['color'];\n props.defaultBackgroundColor = disabledBackgroundColor;\n props.defaultBorderColor = disabledBorderColor;\n props.hoverBackgroundColor = disabledBackgroundColor;\n props.hoverBorderColor = disabledBorderColor;\n props.focusBackgroundColor = disabledBackgroundColor;\n props.focusBorderColor = disabledBorderColor;\n }\n\n return props;\n};\n\nconst ButtonContent = styled(BaseBox)<{ isHidden: boolean }>(({ isHidden }) => ({\n opacity: isHidden ? 0 : 1,\n}));\n\nconst _BaseButton: React.ForwardRefRenderFunction<BladeElementRef, BaseButtonProps> = (\n {\n href,\n target,\n rel,\n tabIndex,\n id,\n variant = 'primary',\n color = 'primary',\n size = 'medium',\n icon: Icon,\n iconPosition = 'left',\n isDisabled = false,\n isFullWidth = false,\n isLoading = false,\n onClick,\n onBlur,\n onKeyDown,\n type = 'button',\n children,\n testID,\n onFocus,\n onMouseLeave,\n onMouseMove,\n onMouseDown,\n onPointerDown,\n onPointerEnter,\n accessibilityProps,\n onTouchEnd,\n onTouchStart,\n ...rest\n },\n ref,\n) => {\n const { theme } = useTheme();\n const buttonGroupProps = useButtonGroupContext();\n const [isPressed, setIsPressed] = React.useState(false);\n const isLink = Boolean(href);\n const childrenString = getStringFromReactText(children);\n const isChildrenComponent = React.isValidElement(children);\n\n // Button cannot be disabled when its rendered as Link\n const disabled = buttonGroupProps.isDisabled ?? (isLoading || (isDisabled && !isLink));\n\n if (__DEV__) {\n if (!Icon && !childrenString?.trim()) {\n throwBladeError({\n message: 'At least one of icon or text is required to render a button.',\n moduleName: 'BaseButton',\n });\n }\n }\n\n const prevLoading = usePrevious(isLoading);\n\n React.useEffect(() => {\n if (isLoading) announce('Started loading');\n\n if (!isLoading && prevLoading) announce('Stopped loading');\n }, [isLoading, prevLoading]);\n\n const {\n defaultBorderColor,\n defaultBackgroundColor,\n minHeight,\n height,\n width,\n buttonPaddingTop,\n buttonPaddingBottom,\n buttonPaddingLeft,\n buttonPaddingRight,\n focusBorderColor,\n focusBackgroundColor,\n focusRingColor,\n fontSize,\n hoverBorderColor,\n hoverBackgroundColor,\n iconColor,\n iconSize,\n iconPadding,\n spinnerSize,\n lineHeight,\n text,\n textColor,\n borderWidth,\n borderRadius,\n motionDuration,\n motionEasing,\n } = getProps({\n buttonTypographyTokens: buttonTypography,\n childrenString,\n isDisabled: disabled,\n size: buttonGroupProps.size ?? size,\n variant: buttonGroupProps.variant ?? variant,\n theme,\n color: buttonGroupProps.color ?? color,\n hasIcon: Boolean(Icon),\n });\n\n const renderElement = React.useMemo(() => getRenderElement(href), [href]);\n const defaultRole = isLink ? 'link' : 'button';\n\n const handlePointerPressedIn = React.useCallback(() => {\n if (disabled) return;\n setIsPressed(true);\n }, [disabled]);\n\n const handlePointerPressedOut = React.useCallback(() => {\n if (disabled) return;\n setIsPressed(false);\n }, [disabled]);\n\n const handleKeyboardPressedIn = React.useCallback(\n (e: React.KeyboardEvent) => {\n if (disabled) return;\n if (e.key === ' ' || e.key === 'Enter') {\n setIsPressed(true);\n }\n },\n [disabled],\n );\n\n const handleKeyboardPressedOut = React.useCallback(\n (e: React.KeyboardEvent) => {\n if (disabled) return;\n if (e.key === ' ' || e.key === 'Enter') {\n setIsPressed(false);\n }\n },\n [disabled],\n );\n\n return (\n <StyledBaseButton\n ref={ref as any}\n id={id}\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment, @typescript-eslint/prefer-ts-expect-error\n // @ts-ignore: On React Native it will always be undefined but TS doesn't understand that\n as={renderElement}\n href={href}\n target={target}\n rel={rel}\n accessibilityProps={{\n ...makeAccessible({\n ...accessibilityProps,\n role: accessibilityProps?.role ?? defaultRole,\n }),\n }}\n variant={variant}\n isLoading={isLoading}\n disabled={disabled}\n defaultBorderColor={defaultBorderColor}\n minHeight={minHeight}\n buttonPaddingTop={buttonPaddingTop}\n buttonPaddingBottom={buttonPaddingBottom}\n buttonPaddingLeft={buttonPaddingLeft}\n buttonPaddingRight={buttonPaddingRight}\n defaultBackgroundColor={defaultBackgroundColor}\n focusBorderColor={focusBorderColor}\n focusBackgroundColor={focusBackgroundColor}\n focusRingColor={focusRingColor}\n hoverBorderColor={hoverBorderColor}\n hoverBackgroundColor={hoverBackgroundColor}\n isFullWidth={buttonGroupProps.isFullWidth ?? isFullWidth}\n onClick={onClick}\n onBlur={onBlur}\n onFocus={onFocus}\n onMouseLeave={onMouseLeave}\n onMouseMove={onMouseMove}\n tabIndex={tabIndex}\n onPointerDown={onPointerDown}\n onPointerEnter={onPointerEnter}\n // Setting type for web fails it on native typecheck and vice versa\n onKeyDown={(event: any) => {\n handleKeyboardPressedIn(event);\n onKeyDown?.(event);\n }}\n onTouchStart={(event: React.TouchEvent) => {\n handlePointerPressedIn();\n onTouchStart?.(event);\n }}\n onTouchEnd={(event: React.TouchEvent) => {\n handlePointerPressedOut();\n onTouchEnd?.(event);\n }}\n type={type}\n borderWidth={borderWidth}\n borderRadius={borderRadius}\n motionDuration={motionDuration}\n motionEasing={motionEasing}\n height={height}\n width={width}\n isPressed={isPressed}\n onMouseDown={(event: React.MouseEvent) => {\n handlePointerPressedIn();\n onMouseDown?.(event);\n }}\n onMouseUp={handlePointerPressedOut}\n onMouseOut={handlePointerPressedOut}\n onKeyUp={handleKeyboardPressedOut}\n {...metaAttribute({ name: MetaConstants.Button, testID })}\n {...getStyledProps(rest)}\n >\n <AnimatedButtonContent\n motionDuration={motionDuration}\n motionEasing={motionEasing}\n isPressed={isPressed}\n >\n {isLoading ? (\n <BaseBox\n display=\"flex\"\n justifyContent=\"center\"\n alignItems=\"center\"\n position=\"absolute\"\n top=\"0px\"\n left=\"0px\"\n bottom=\"0px\"\n right=\"0px\"\n zIndex={1}\n >\n <BaseSpinner accessibilityLabel=\"Loading\" size={spinnerSize} color={color} />\n </BaseBox>\n ) : null}\n <ButtonContent\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n flex={1}\n isHidden={isLoading}\n zIndex={1}\n >\n {Icon && iconPosition == 'left' ? (\n <BaseBox\n paddingRight={iconPadding}\n display=\"flex\"\n justifyContent=\"center\"\n alignItems=\"center\"\n >\n <Icon size={iconSize} color={iconColor} />\n </BaseBox>\n ) : null}\n {text ? (\n isChildrenComponent ? (\n children\n ) : (\n <BaseText\n lineHeight={lineHeight}\n fontSize={fontSize}\n // figma and web have different font-smoothing properties\n // which causes web version of button text to look much bolder\n // than figma version. To fix this we are changing font-weight from 600 to 500\n // https://forum.figma.com/t/why-does-a-font-weight-in-figma-seem-lighter-than-the-same-weight-in-the-browser/2207\n fontWeight=\"medium\"\n textAlign=\"center\"\n color={textColor}\n >\n {text}\n </BaseText>\n )\n ) : null}\n {Icon && iconPosition == 'right' ? (\n <BaseBox\n paddingLeft={iconPadding}\n display=\"flex\"\n justifyContent=\"center\"\n alignItems=\"center\"\n >\n <Icon size={iconSize} color={iconColor} />\n </BaseBox>\n ) : null}\n </ButtonContent>\n </AnimatedButtonContent>\n </StyledBaseButton>\n );\n};\n\nconst BaseButton = assignWithoutSideEffects(React.forwardRef(_BaseButton), {\n displayName: 'BaseButton',\n});\n\nexport default BaseButton;\n"],"names":["getRenderElement","href","isReactNative","undefined","getBackgroundColorToken","_ref","property","variant","state","color","_state","tokens","backgroundColor","white","Error","base","getTextColorToken","_ref2","textColor","getProps","_ref3","buttonTypographyTokens","childrenString","isDisabled","size","theme","hasIcon","throwBladeError","moduleName","message","isIconOnly","trim","length","props","iconSize","buttonIconOnlySizeToIconSizeMap","buttonSizeToIconSizeMap","spinnerSize","buttonSizeToSpinnerSizeMap","fontSize","fonts","lineHeight","lineHeights","minHeight","makeSize","buttonMinHeight","height","buttonIconOnlyHeightWidth","width","iconPadding","buttonIconPadding","iconColor","buttonPaddingTop","makeSpace","spacing","buttonPadding","top","buttonPaddingBottom","bottom","buttonPaddingLeft","left","buttonPaddingRight","right","text","defaultBackgroundColor","getIn","colors","defaultBorderColor","hoverBackgroundColor","hoverBorderColor","focusBackgroundColor","focusBorderColor","focusRingColor","borderWidth","makeBorderSize","border","thin","borderRadius","radius","medium","motionDuration","motionEasing","disabledBackgroundColor","disabledBorderColor","ButtonContent","styled","BaseBox","_ref4","isHidden","opacity","_BaseButton","_ref5","ref","_buttonGroupProps$isD","_buttonGroupProps$siz","_buttonGroupProps$var","_buttonGroupProps$col","_accessibilityProps$r","_buttonGroupProps$isF","target","rel","tabIndex","id","_ref5$variant","_ref5$color","_ref5$size","Icon","icon","_ref5$iconPosition","iconPosition","_ref5$isDisabled","_ref5$isFullWidth","isFullWidth","_ref5$isLoading","isLoading","onClick","onBlur","onKeyDown","_ref5$type","type","children","testID","onFocus","onMouseLeave","onMouseMove","onMouseDown","onPointerDown","onPointerEnter","accessibilityProps","onTouchEnd","onTouchStart","rest","_objectWithoutProperties","_excluded","_useTheme","useTheme","buttonGroupProps","useButtonGroupContext","_React$useState","React","useState","_React$useState2","_slicedToArray","isPressed","setIsPressed","isLink","Boolean","getStringFromReactText","isChildrenComponent","isValidElement","disabled","__DEV__","prevLoading","usePrevious","useEffect","announce","_getProps","buttonTypography","renderElement","useMemo","defaultRole","handlePointerPressedIn","useCallback","handlePointerPressedOut","handleKeyboardPressedIn","e","key","handleKeyboardPressedOut","_jsx","StyledBaseButton","Object","assign","as","makeAccessible","role","event","onMouseUp","onMouseOut","onKeyUp","metaAttribute","name","MetaConstants","Button","getStyledProps","_jsxs","AnimatedButtonContent","display","justifyContent","alignItems","position","zIndex","BaseSpinner","accessibilityLabel","flexDirection","flex","paddingRight","BaseText","fontWeight","textAlign","paddingLeft","BaseButton","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;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AAW,CAAEtJ,WAAY,CACzByI,OAAO,CAAC,MAAM,CACdC,cAAc,CAAC,QAAQ,CACvBC,UAAU,CAAC,QAAQ,CAAApE,QAAA,CAEnBgD,GAAA,CAAC9D,IAAI,CAAClF,CAAAA,IAAI,CAAEU,QAAS,CAACzB,KAAK,CAAE0C,SAAU,CAAE,CAAC,CACnC,CAAC,CACR,IAAI,CAAA,CACK,CAAC,CAAA,CACK,CAAC,CACR,CAAA,CAAC,CAEvB,CAAC,CAEK,IAAAqJ,UAAU,CAAGC,wBAAwB,CAAC9D,cAAK,CAAC+D,UAAU,CAAChH,WAAW,CAAC,CAAE,CACzEiH,WAAW,CAAE,YACf,CAAC;;;;"}
@@ -20,7 +20,7 @@ import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
20
20
  import { useControllableState } from '../../utils/useControllable.js';
21
21
  import { jsx } from 'react/jsx-runtime';
22
22
 
23
- var _excluded=["children","isOpen","onOpenChange","selectionType","testID"];var validDropdownChildren=[dropdownComponentIds.BaseBox,dropdownComponentIds.triggers.SelectInput,dropdownComponentIds.triggers.SearchInput,dropdownComponentIds.triggers.DropdownButton,dropdownComponentIds.triggers.DropdownLink,dropdownComponentIds.DropdownOverlay,dropdownComponentIds.triggers.AutoComplete,ComponentIds.BottomSheet];var _Dropdown=function _Dropdown(_ref){var children=_ref.children,isOpenControlled=_ref.isOpen,onOpenChange=_ref.onOpenChange,_ref$selectionType=_ref.selectionType,selectionType=_ref$selectionType===void 0?'single':_ref$selectionType,testID=_ref.testID,styledProps=_objectWithoutProperties(_ref,_excluded);var _React$useState=React__default.useState([]),_React$useState2=_slicedToArray(_React$useState,2),options=_React$useState2[0],setOptions=_React$useState2[1];var _React$useState3=React__default.useState([]),_React$useState4=_slicedToArray(_React$useState3,2),filteredValues=_React$useState4[0],setFilteredValues=_React$useState4[1];var _React$useState5=React__default.useState([]),_React$useState6=_slicedToArray(_React$useState5,2),selectedIndices=_React$useState6[0],setSelectedIndices=_React$useState6[1];var _React$useState7=React__default.useState([]),_React$useState8=_slicedToArray(_React$useState7,2),controlledValueIndices=_React$useState8[0],setControlledValueIndices=_React$useState8[1];var _React$useState9=React__default.useState(-1),_React$useState10=_slicedToArray(_React$useState9,2),activeIndex=_React$useState10[0],setActiveIndex=_React$useState10[1];var _React$useState11=React__default.useState(-1),_React$useState12=_slicedToArray(_React$useState11,2),activeTagIndex=_React$useState12[0],setActiveTagIndex=_React$useState12[1];var _React$useState13=React__default.useState(false),_React$useState14=_slicedToArray(_React$useState13,2),shouldIgnoreBlurAnimation=_React$useState14[0],setShouldIgnoreBlurAnimation=_React$useState14[1];var _React$useState15=React__default.useState(false),_React$useState16=_slicedToArray(_React$useState15,2),hasFooterAction=_React$useState16[0],setHasFooterAction=_React$useState16[1];var _React$useState17=React__default.useState(false),_React$useState18=_slicedToArray(_React$useState17,2),hasAutoCompleteInBottomSheetHeader=_React$useState18[0],setHasAutoCompleteInBottomSheetHeader=_React$useState18[1];var _React$useState19=React__default.useState(false),_React$useState20=_slicedToArray(_React$useState19,2),isKeydownPressed=_React$useState20[0],setIsKeydownPressed=_React$useState20[1];var _React$useState21=React__default.useState(0),_React$useState22=_slicedToArray(_React$useState21,2),changeCallbackTriggerer=_React$useState22[0],setChangeCallbackTriggerer=_React$useState22[1];var _React$useState23=React__default.useState(false),_React$useState24=_slicedToArray(_React$useState23,2),isControlled=_React$useState24[0],setIsControlled=_React$useState24[1];var _React$useState25=React__default.useState(false),_React$useState26=_slicedToArray(_React$useState25,2),dropdownHasBottomSheet=_React$useState26[0],setDropdownHasBottomSheet=_React$useState26[1];var triggererWrapperRef=React__default.useRef(null);var triggererRef=React__default.useRef(null);var actionListItemRef=React__default.useRef(null);var dropdownTriggerer=React__default.useRef();var isTagDismissedRef=React__default.useRef({value:false});var visibleTagsCountRef=React__default.useRef({value:0});var dropdownContainerRef=React__default.useRef(null);var dropdownBaseId=useId('dropdown');var isDropdownOpenRef=React__default.useRef(isOpenControlled);var _useControllableState=useControllableState({value:isOpenControlled,defaultValue:false,onChange:function onChange(isOpenControlledValue){isDropdownOpenRef.current=isOpenControlledValue;onOpenChange==null?void 0:onOpenChange(isOpenControlledValue);}}),_useControllableState2=_slicedToArray(_useControllableState,2),isDropdownOpen=_useControllableState2[0],setIsDropdownOpen=_useControllableState2[1];isDropdownOpenRef.current=isDropdownOpen;var setIsOpen=function setIsOpen(isOpenValue){isDropdownOpenRef.current=isOpenValue;setIsDropdownOpen(function(){return isOpenValue;});};var close=React__default.useCallback(function(){setActiveTagIndex(-1);setIsOpen(false);},[]);React__default.Children.map(children,function(child){if(React__default.isValidElement(child)){if(__DEV__){var _getComponentId;if(!validDropdownChildren.includes((_getComponentId=getComponentId(child))!=null?_getComponentId:'')){throwBladeError({message:`Dropdown can only have one of following elements as children - \n\n ${validDropdownChildren.join(', ')} \n\n Check out: https://blade.razorpay.com/?path=/story/components-dropdown`,moduleName:'Dropdown'});}}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.SelectInput)){dropdownTriggerer.current='SelectInput';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.SearchInput)){dropdownTriggerer.current='SearchInput';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.DropdownButton)){dropdownTriggerer.current='DropdownButton';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.AutoComplete)){dropdownTriggerer.current='AutoComplete';}}});var contextValue=React__default.useMemo(function(){return {isOpen:isDropdownOpen,setIsOpen:setIsOpen,close:close,selectedIndices:selectedIndices,setSelectedIndices:setSelectedIndices,controlledValueIndices:controlledValueIndices,setControlledValueIndices:setControlledValueIndices,options:options,setOptions:setOptions,filteredValues:filteredValues,setFilteredValues:setFilteredValues,activeIndex:activeIndex,setActiveIndex:setActiveIndex,activeTagIndex:activeTagIndex,setActiveTagIndex:setActiveTagIndex,visibleTagsCountRef:visibleTagsCountRef,shouldIgnoreBlurAnimation:shouldIgnoreBlurAnimation,setShouldIgnoreBlurAnimation:setShouldIgnoreBlurAnimation,isKeydownPressed:isKeydownPressed,setIsKeydownPressed:setIsKeydownPressed,dropdownBaseId:dropdownBaseId,triggererRef:triggererRef,triggererWrapperRef:triggererWrapperRef,actionListItemRef:actionListItemRef,selectionType:selectionType,hasFooterAction:hasFooterAction,setHasFooterAction:setHasFooterAction,hasAutoCompleteInBottomSheetHeader:hasAutoCompleteInBottomSheetHeader,setHasAutoCompleteInBottomSheetHeader:setHasAutoCompleteInBottomSheetHeader,dropdownTriggerer:dropdownTriggerer.current,changeCallbackTriggerer:changeCallbackTriggerer,setChangeCallbackTriggerer:setChangeCallbackTriggerer,isControlled:isControlled,setIsControlled:setIsControlled,isTagDismissedRef:isTagDismissedRef};},[isDropdownOpen,isOpenControlled,selectedIndices,controlledValueIndices,options,filteredValues,activeIndex,activeTagIndex,shouldIgnoreBlurAnimation,selectionType,hasFooterAction,isKeydownPressed,changeCallbackTriggerer,isControlled]);var BottomSheetAndDropdownGlueContextValue=React__default.useMemo(function(){return {isOpen:isDropdownOpen,dropdownHasBottomSheet:dropdownHasBottomSheet,hasAutoCompleteInBottomSheetHeader:hasAutoCompleteInBottomSheetHeader,setDropdownHasBottomSheet:setDropdownHasBottomSheet,onBottomSheetDismiss:close};},[dropdownHasBottomSheet,hasAutoCompleteInBottomSheetHeader,isDropdownOpen,close]);return jsx(BottomSheetAndDropdownGlueContext.Provider,{value:BottomSheetAndDropdownGlueContextValue,children:jsx(DropdownContext.Provider,{value:contextValue,children:jsx(BaseBox,Object.assign({ref:dropdownContainerRef},metaAttribute({name:MetaConstants.Dropdown,testID:testID}),getStyledProps(styledProps),{children:jsx(BaseBox,{position:"relative",textAlign:'left',children:children})}))})});};var Dropdown=assignWithoutSideEffects(_Dropdown,{componentId:dropdownComponentIds.Dropdown});
23
+ var _excluded=["children","isOpen","onOpenChange","selectionType","testID","_width"];var validDropdownChildren=[dropdownComponentIds.BaseBox,dropdownComponentIds.triggers.SelectInput,dropdownComponentIds.triggers.SearchInput,dropdownComponentIds.triggers.DropdownButton,dropdownComponentIds.triggers.DropdownLink,dropdownComponentIds.DropdownOverlay,dropdownComponentIds.triggers.AutoComplete,ComponentIds.BottomSheet];var _Dropdown=function _Dropdown(_ref){var children=_ref.children,isOpenControlled=_ref.isOpen,onOpenChange=_ref.onOpenChange,_ref$selectionType=_ref.selectionType,selectionType=_ref$selectionType===void 0?'single':_ref$selectionType,testID=_ref.testID,_width=_ref._width,styledProps=_objectWithoutProperties(_ref,_excluded);var _React$useState=React__default.useState([]),_React$useState2=_slicedToArray(_React$useState,2),options=_React$useState2[0],setOptions=_React$useState2[1];var _React$useState3=React__default.useState([]),_React$useState4=_slicedToArray(_React$useState3,2),filteredValues=_React$useState4[0],setFilteredValues=_React$useState4[1];var _React$useState5=React__default.useState([]),_React$useState6=_slicedToArray(_React$useState5,2),selectedIndices=_React$useState6[0],setSelectedIndices=_React$useState6[1];var _React$useState7=React__default.useState([]),_React$useState8=_slicedToArray(_React$useState7,2),controlledValueIndices=_React$useState8[0],setControlledValueIndices=_React$useState8[1];var _React$useState9=React__default.useState(-1),_React$useState10=_slicedToArray(_React$useState9,2),activeIndex=_React$useState10[0],setActiveIndex=_React$useState10[1];var _React$useState11=React__default.useState(-1),_React$useState12=_slicedToArray(_React$useState11,2),activeTagIndex=_React$useState12[0],setActiveTagIndex=_React$useState12[1];var _React$useState13=React__default.useState(false),_React$useState14=_slicedToArray(_React$useState13,2),shouldIgnoreBlurAnimation=_React$useState14[0],setShouldIgnoreBlurAnimation=_React$useState14[1];var _React$useState15=React__default.useState(false),_React$useState16=_slicedToArray(_React$useState15,2),hasFooterAction=_React$useState16[0],setHasFooterAction=_React$useState16[1];var _React$useState17=React__default.useState(false),_React$useState18=_slicedToArray(_React$useState17,2),hasAutoCompleteInBottomSheetHeader=_React$useState18[0],setHasAutoCompleteInBottomSheetHeader=_React$useState18[1];var _React$useState19=React__default.useState(false),_React$useState20=_slicedToArray(_React$useState19,2),isKeydownPressed=_React$useState20[0],setIsKeydownPressed=_React$useState20[1];var _React$useState21=React__default.useState(0),_React$useState22=_slicedToArray(_React$useState21,2),changeCallbackTriggerer=_React$useState22[0],setChangeCallbackTriggerer=_React$useState22[1];var _React$useState23=React__default.useState(false),_React$useState24=_slicedToArray(_React$useState23,2),isControlled=_React$useState24[0],setIsControlled=_React$useState24[1];var _React$useState25=React__default.useState(false),_React$useState26=_slicedToArray(_React$useState25,2),dropdownHasBottomSheet=_React$useState26[0],setDropdownHasBottomSheet=_React$useState26[1];var triggererWrapperRef=React__default.useRef(null);var triggererRef=React__default.useRef(null);var actionListItemRef=React__default.useRef(null);var dropdownTriggerer=React__default.useRef();var isTagDismissedRef=React__default.useRef({value:false});var visibleTagsCountRef=React__default.useRef({value:0});var dropdownContainerRef=React__default.useRef(null);var dropdownBaseId=useId('dropdown');var isDropdownOpenRef=React__default.useRef(isOpenControlled);var _useControllableState=useControllableState({value:isOpenControlled,defaultValue:false,onChange:function onChange(isOpenControlledValue){isDropdownOpenRef.current=isOpenControlledValue;onOpenChange==null?void 0:onOpenChange(isOpenControlledValue);}}),_useControllableState2=_slicedToArray(_useControllableState,2),isDropdownOpen=_useControllableState2[0],setIsDropdownOpen=_useControllableState2[1];isDropdownOpenRef.current=isDropdownOpen;var setIsOpen=function setIsOpen(isOpenValue){isDropdownOpenRef.current=isOpenValue;setIsDropdownOpen(function(){return isOpenValue;});};var close=React__default.useCallback(function(){setActiveTagIndex(-1);setIsOpen(false);},[]);React__default.Children.map(children,function(child){if(React__default.isValidElement(child)){if(__DEV__){var _getComponentId;if(!validDropdownChildren.includes((_getComponentId=getComponentId(child))!=null?_getComponentId:'')){throwBladeError({message:`Dropdown can only have one of following elements as children - \n\n ${validDropdownChildren.join(', ')} \n\n Check out: https://blade.razorpay.com/?path=/story/components-dropdown`,moduleName:'Dropdown'});}}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.SelectInput)){dropdownTriggerer.current='SelectInput';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.SearchInput)){dropdownTriggerer.current='SearchInput';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.DropdownButton)){dropdownTriggerer.current='DropdownButton';}if(isValidAllowedChildren(child,dropdownComponentIds.triggers.AutoComplete)){dropdownTriggerer.current='AutoComplete';}}});var contextValue=React__default.useMemo(function(){return {isOpen:isDropdownOpen,setIsOpen:setIsOpen,close:close,selectedIndices:selectedIndices,setSelectedIndices:setSelectedIndices,controlledValueIndices:controlledValueIndices,setControlledValueIndices:setControlledValueIndices,options:options,setOptions:setOptions,filteredValues:filteredValues,setFilteredValues:setFilteredValues,activeIndex:activeIndex,setActiveIndex:setActiveIndex,activeTagIndex:activeTagIndex,setActiveTagIndex:setActiveTagIndex,visibleTagsCountRef:visibleTagsCountRef,shouldIgnoreBlurAnimation:shouldIgnoreBlurAnimation,setShouldIgnoreBlurAnimation:setShouldIgnoreBlurAnimation,isKeydownPressed:isKeydownPressed,setIsKeydownPressed:setIsKeydownPressed,dropdownBaseId:dropdownBaseId,triggererRef:triggererRef,triggererWrapperRef:triggererWrapperRef,actionListItemRef:actionListItemRef,selectionType:selectionType,hasFooterAction:hasFooterAction,setHasFooterAction:setHasFooterAction,hasAutoCompleteInBottomSheetHeader:hasAutoCompleteInBottomSheetHeader,setHasAutoCompleteInBottomSheetHeader:setHasAutoCompleteInBottomSheetHeader,dropdownTriggerer:dropdownTriggerer.current,changeCallbackTriggerer:changeCallbackTriggerer,setChangeCallbackTriggerer:setChangeCallbackTriggerer,isControlled:isControlled,setIsControlled:setIsControlled,isTagDismissedRef:isTagDismissedRef};},[isDropdownOpen,isOpenControlled,selectedIndices,controlledValueIndices,options,filteredValues,activeIndex,activeTagIndex,shouldIgnoreBlurAnimation,selectionType,hasFooterAction,isKeydownPressed,changeCallbackTriggerer,isControlled]);var BottomSheetAndDropdownGlueContextValue=React__default.useMemo(function(){return {isOpen:isDropdownOpen,dropdownHasBottomSheet:dropdownHasBottomSheet,hasAutoCompleteInBottomSheetHeader:hasAutoCompleteInBottomSheetHeader,setDropdownHasBottomSheet:setDropdownHasBottomSheet,onBottomSheetDismiss:close};},[dropdownHasBottomSheet,hasAutoCompleteInBottomSheetHeader,isDropdownOpen,close]);return jsx(BottomSheetAndDropdownGlueContext.Provider,{value:BottomSheetAndDropdownGlueContextValue,children:jsx(DropdownContext.Provider,{value:contextValue,children:jsx(BaseBox,Object.assign({ref:dropdownContainerRef},metaAttribute({name:MetaConstants.Dropdown,testID:testID}),getStyledProps(styledProps),{width:_width,children:jsx(BaseBox,{position:"relative",textAlign:'left',children:children})}))})});};var Dropdown=assignWithoutSideEffects(_Dropdown,{componentId:dropdownComponentIds.Dropdown});
24
24
 
25
25
  export { Dropdown };
26
26
  //# sourceMappingURL=Dropdown.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Dropdown.js","sources":["../../../../../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["import React from 'react';\nimport { DropdownContext } from './useDropdown';\nimport type { DropdownContextType } from './useDropdown';\nimport type { DropdownProps } from './types';\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport { useId } from '~utils/useId';\nimport { ComponentIds as bottomSheetComponentIds } from '~components/BottomSheet/componentIds';\nimport { BottomSheetAndDropdownGlueContext } from '~components/BottomSheet/BottomSheetContext';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport BaseBox from '~components/Box/BaseBox';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId, isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { MetaConstants, metaAttribute } from '~utils/metaAttribute';\nimport { throwBladeError } from '~utils/logger';\nimport type { ContainerElementType } from '~utils/types';\nimport { useControllableState } from '~utils/useControllable';\n\nconst validDropdownChildren = [\n // TODO: Remove Box once CountrySelector's button sizing is fixed\n dropdownComponentIds.BaseBox,\n dropdownComponentIds.triggers.SelectInput,\n dropdownComponentIds.triggers.SearchInput,\n dropdownComponentIds.triggers.DropdownButton,\n dropdownComponentIds.triggers.DropdownLink,\n dropdownComponentIds.DropdownOverlay,\n dropdownComponentIds.triggers.AutoComplete,\n bottomSheetComponentIds.BottomSheet,\n];\n\n/**\n * ### Dropdown component\n *\n * Dropdown component is generic component that controls the dropdown functionality.\n * It can be used with multiple triggers and mostly contains ActionList component inside it\n *\n * ---\n *\n * #### Usage\n *\n * ```jsx\n * <Dropdown selectionType=\"single\">\n * <SelectInput />\n * <DropdownOverlay>\n * <ActionList>\n * <ActionListItem />\n * <ActionListItem />\n * </ActionList>\n * </DropdownOverlay>\n * </Dropdown>\n * ```\n *\n * ---\n *\n * Checkout {@link https://blade.razorpay.com/?path=/docs/components-dropdown-with-select--with-single-select Dropdown Documentation}\n */\nconst _Dropdown = ({\n children,\n isOpen: isOpenControlled,\n onOpenChange,\n selectionType = 'single',\n testID,\n ...styledProps\n}: DropdownProps): React.ReactElement => {\n const [options, setOptions] = React.useState<DropdownContextType['options']>([]);\n const [filteredValues, setFilteredValues] = React.useState<string[]>([]);\n const [selectedIndices, setSelectedIndices] = React.useState<\n DropdownContextType['selectedIndices']\n >([]);\n const [controlledValueIndices, setControlledValueIndices] = React.useState<\n DropdownContextType['selectedIndices']\n >([]);\n const [activeIndex, setActiveIndex] = React.useState(-1);\n const [activeTagIndex, setActiveTagIndex] = React.useState(-1);\n const [shouldIgnoreBlurAnimation, setShouldIgnoreBlurAnimation] = React.useState(false);\n const [hasFooterAction, setHasFooterAction] = React.useState(false);\n const [\n hasAutoCompleteInBottomSheetHeader,\n setHasAutoCompleteInBottomSheetHeader,\n ] = React.useState(false);\n const [isKeydownPressed, setIsKeydownPressed] = React.useState(false);\n const [changeCallbackTriggerer, setChangeCallbackTriggerer] = React.useState<\n DropdownContextType['changeCallbackTriggerer']\n >(0);\n const [isControlled, setIsControlled] = React.useState(false);\n // keep track if dropdown contains bottomsheet\n const [dropdownHasBottomSheet, setDropdownHasBottomSheet] = React.useState(false);\n\n /**\n * In inputs, actual input is smaller than the visible input wrapper.\n * You can set this reference in such cases so floating ui calculations happen correctly\n * */\n const triggererWrapperRef = React.useRef<ContainerElementType>(null);\n const triggererRef = React.useRef<HTMLButtonElement>(null);\n const actionListItemRef = React.useRef<HTMLDivElement>(null);\n const dropdownTriggerer = React.useRef<DropdownContextType['dropdownTriggerer']>();\n const isTagDismissedRef = React.useRef<{ value: boolean } | null>({ value: false });\n const visibleTagsCountRef = React.useRef<{ value: number }>({ value: 0 });\n const dropdownContainerRef = React.useRef<HTMLDivElement>(null);\n\n const dropdownBaseId = useId('dropdown');\n const isDropdownOpenRef = React.useRef(isOpenControlled);\n\n const [isDropdownOpen, setIsDropdownOpen] = useControllableState({\n value: isOpenControlled,\n defaultValue: false,\n onChange: (isOpenControlledValue) => {\n isDropdownOpenRef.current = isOpenControlledValue;\n onOpenChange?.(isOpenControlledValue);\n },\n });\n\n isDropdownOpenRef.current = isDropdownOpen;\n\n const setIsOpen = (isOpenValue: boolean): void => {\n isDropdownOpenRef.current = isOpenValue;\n setIsDropdownOpen(() => isOpenValue);\n };\n\n const close = React.useCallback(() => {\n setActiveTagIndex(-1);\n setIsOpen(false);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n if (__DEV__) {\n if (!validDropdownChildren.includes(getComponentId(child) ?? '')) {\n throwBladeError({\n message: `Dropdown can only have one of following elements as children - \\n\\n ${validDropdownChildren.join(\n ', ',\n )} \\n\\n Check out: https://blade.razorpay.com/?path=/story/components-dropdown`,\n moduleName: 'Dropdown',\n });\n }\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.SelectInput)) {\n dropdownTriggerer.current = 'SelectInput';\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.SearchInput)) {\n dropdownTriggerer.current = 'SearchInput';\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.DropdownButton)) {\n dropdownTriggerer.current = 'DropdownButton';\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.AutoComplete)) {\n dropdownTriggerer.current = 'AutoComplete';\n }\n }\n });\n\n const contextValue = React.useMemo<DropdownContextType>(\n () => ({\n isOpen: isDropdownOpen,\n setIsOpen,\n close,\n selectedIndices,\n setSelectedIndices,\n controlledValueIndices,\n setControlledValueIndices,\n options,\n setOptions,\n filteredValues,\n setFilteredValues,\n activeIndex,\n setActiveIndex,\n activeTagIndex,\n setActiveTagIndex,\n visibleTagsCountRef,\n shouldIgnoreBlurAnimation,\n setShouldIgnoreBlurAnimation,\n isKeydownPressed,\n setIsKeydownPressed,\n dropdownBaseId,\n triggererRef,\n triggererWrapperRef,\n actionListItemRef,\n selectionType,\n hasFooterAction,\n setHasFooterAction,\n hasAutoCompleteInBottomSheetHeader,\n setHasAutoCompleteInBottomSheetHeader,\n dropdownTriggerer: dropdownTriggerer.current,\n changeCallbackTriggerer,\n setChangeCallbackTriggerer,\n isControlled,\n setIsControlled,\n isTagDismissedRef,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n isDropdownOpen,\n isOpenControlled,\n selectedIndices,\n controlledValueIndices,\n options,\n filteredValues,\n activeIndex,\n activeTagIndex,\n shouldIgnoreBlurAnimation,\n selectionType,\n hasFooterAction,\n isKeydownPressed,\n changeCallbackTriggerer,\n isControlled,\n ],\n );\n\n const BottomSheetAndDropdownGlueContextValue = React.useMemo((): BottomSheetAndDropdownGlueContext => {\n return {\n isOpen: isDropdownOpen,\n dropdownHasBottomSheet,\n hasAutoCompleteInBottomSheetHeader,\n setDropdownHasBottomSheet,\n // This is the dismiss function which will be injected into the BottomSheet\n // Basically <BottomSheet onDismiss={onBottomSheetDismiss} />\n onBottomSheetDismiss: close,\n };\n }, [dropdownHasBottomSheet, hasAutoCompleteInBottomSheetHeader, isDropdownOpen, close]);\n\n return (\n <BottomSheetAndDropdownGlueContext.Provider value={BottomSheetAndDropdownGlueContextValue}>\n <DropdownContext.Provider value={contextValue}>\n <BaseBox\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref={dropdownContainerRef as any}\n {...metaAttribute({ name: MetaConstants.Dropdown, testID })}\n {...getStyledProps(styledProps)}\n >\n <BaseBox position=\"relative\" textAlign={'left' as never}>\n {children}\n </BaseBox>\n </BaseBox>\n </DropdownContext.Provider>\n </BottomSheetAndDropdownGlueContext.Provider>\n );\n};\n\nconst Dropdown = assignWithoutSideEffects(_Dropdown, {\n componentId: dropdownComponentIds.Dropdown,\n});\n\nexport { Dropdown };\n"],"names":["validDropdownChildren","dropdownComponentIds","BaseBox","triggers","SelectInput","SearchInput","DropdownButton","DropdownLink","DropdownOverlay","AutoComplete","bottomSheetComponentIds","BottomSheet","_Dropdown","_ref","children","isOpenControlled","isOpen","onOpenChange","_ref$selectionType","selectionType","testID","styledProps","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","options","setOptions","_React$useState3","_React$useState4","filteredValues","setFilteredValues","_React$useState5","_React$useState6","selectedIndices","setSelectedIndices","_React$useState7","_React$useState8","controlledValueIndices","setControlledValueIndices","_React$useState9","_React$useState10","activeIndex","setActiveIndex","_React$useState11","_React$useState12","activeTagIndex","setActiveTagIndex","_React$useState13","_React$useState14","shouldIgnoreBlurAnimation","setShouldIgnoreBlurAnimation","_React$useState15","_React$useState16","hasFooterAction","setHasFooterAction","_React$useState17","_React$useState18","hasAutoCompleteInBottomSheetHeader","setHasAutoCompleteInBottomSheetHeader","_React$useState19","_React$useState20","isKeydownPressed","setIsKeydownPressed","_React$useState21","_React$useState22","changeCallbackTriggerer","setChangeCallbackTriggerer","_React$useState23","_React$useState24","isControlled","setIsControlled","_React$useState25","_React$useState26","dropdownHasBottomSheet","setDropdownHasBottomSheet","triggererWrapperRef","useRef","triggererRef","actionListItemRef","dropdownTriggerer","isTagDismissedRef","value","visibleTagsCountRef","dropdownContainerRef","dropdownBaseId","useId","isDropdownOpenRef","_useControllableState","useControllableState","defaultValue","onChange","isOpenControlledValue","current","_useControllableState2","isDropdownOpen","setIsDropdownOpen","setIsOpen","isOpenValue","close","useCallback","Children","map","child","isValidElement","__DEV__","_getComponentId","includes","getComponentId","throwBladeError","message","join","moduleName","isValidAllowedChildren","contextValue","useMemo","BottomSheetAndDropdownGlueContextValue","onBottomSheetDismiss","_jsx","BottomSheetAndDropdownGlueContext","Provider","DropdownContext","Object","assign","ref","metaAttribute","name","MetaConstants","Dropdown","getStyledProps","position","textAlign","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,UAAA,CAAA,QAAA,CAAA,cAAA,CAAA,eAAA,CAAA,QAAA,CAAA,CAiBA,IAAMA,qBAAqB,CAAG,CAE5BC,oBAAoB,CAACC,OAAO,CAC5BD,oBAAoB,CAACE,QAAQ,CAACC,WAAW,CACzCH,oBAAoB,CAACE,QAAQ,CAACE,WAAW,CACzCJ,oBAAoB,CAACE,QAAQ,CAACG,cAAc,CAC5CL,oBAAoB,CAACE,QAAQ,CAACI,YAAY,CAC1CN,oBAAoB,CAACO,eAAe,CACpCP,oBAAoB,CAACE,QAAQ,CAACM,YAAY,CAC1CC,YAAuB,CAACC,WAAW,CACpC,CA4BD,IAAMC,SAAS,CAAG,SAAZA,SAASA,CAAAC,IAAA,CAO0B,CANvC,IAAAC,QAAQ,CAAAD,IAAA,CAARC,QAAQ,CACAC,gBAAgB,CAAAF,IAAA,CAAxBG,MAAM,CACNC,YAAY,CAAAJ,IAAA,CAAZI,YAAY,CAAAC,kBAAA,CAAAL,IAAA,CACZM,aAAa,CAAbA,aAAa,CAAAD,kBAAA,GAAA,KAAA,CAAA,CAAG,QAAQ,CAAAA,kBAAA,CACxBE,MAAM,CAAAP,IAAA,CAANO,MAAM,CACHC,WAAW,CAAAC,wBAAA,CAAAT,IAAA,CAAAU,SAAA,CAAA,CAEd,IAAAC,eAAA,CAA8BC,cAAK,CAACC,QAAQ,CAAiC,EAAE,CAAC,CAAAC,gBAAA,CAAAC,cAAA,CAAAJ,eAAA,CAAA,CAAA,CAAA,CAAzEK,OAAO,CAAAF,gBAAA,CAAEG,CAAAA,CAAAA,CAA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AAA,CAACmI,QAAQ,CAAC,UAAU,CAACC,SAAS,CAAE,MAAgB,CAAAxH,QAAA,CACrDA,QAAQ,CACF,CAAC,CAAA,CACH,CAAC,CACc,CAAC,CACe,CAAC,CAEjD,CAAC,CAEK,IAAAqH,QAAQ,CAAGI,wBAAwB,CAAC3H,SAAS,CAAE,CACnD4H,WAAW,CAAEvI,oBAAoB,CAACkI,QACpC,CAAC;;;;"}
1
+ {"version":3,"file":"Dropdown.js","sources":["../../../../../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["import React from 'react';\nimport { DropdownContext } from './useDropdown';\nimport type { DropdownContextType } from './useDropdown';\nimport type { DropdownProps } from './types';\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport { useId } from '~utils/useId';\nimport { ComponentIds as bottomSheetComponentIds } from '~components/BottomSheet/componentIds';\nimport { BottomSheetAndDropdownGlueContext } from '~components/BottomSheet/BottomSheetContext';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport BaseBox from '~components/Box/BaseBox';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId, isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { MetaConstants, metaAttribute } from '~utils/metaAttribute';\nimport { throwBladeError } from '~utils/logger';\nimport type { ContainerElementType } from '~utils/types';\nimport { useControllableState } from '~utils/useControllable';\n\nconst validDropdownChildren = [\n // TODO: Remove Box once CountrySelector's button sizing is fixed\n dropdownComponentIds.BaseBox,\n dropdownComponentIds.triggers.SelectInput,\n dropdownComponentIds.triggers.SearchInput,\n dropdownComponentIds.triggers.DropdownButton,\n dropdownComponentIds.triggers.DropdownLink,\n dropdownComponentIds.DropdownOverlay,\n dropdownComponentIds.triggers.AutoComplete,\n bottomSheetComponentIds.BottomSheet,\n];\n\n/**\n * ### Dropdown component\n *\n * Dropdown component is generic component that controls the dropdown functionality.\n * It can be used with multiple triggers and mostly contains ActionList component inside it\n *\n * ---\n *\n * #### Usage\n *\n * ```jsx\n * <Dropdown selectionType=\"single\">\n * <SelectInput />\n * <DropdownOverlay>\n * <ActionList>\n * <ActionListItem />\n * <ActionListItem />\n * </ActionList>\n * </DropdownOverlay>\n * </Dropdown>\n * ```\n *\n * ---\n *\n * Checkout {@link https://blade.razorpay.com/?path=/docs/components-dropdown-with-select--with-single-select Dropdown Documentation}\n */\nconst _Dropdown = ({\n children,\n isOpen: isOpenControlled,\n onOpenChange,\n selectionType = 'single',\n testID,\n _width,\n ...styledProps\n}: DropdownProps): React.ReactElement => {\n const [options, setOptions] = React.useState<DropdownContextType['options']>([]);\n const [filteredValues, setFilteredValues] = React.useState<string[]>([]);\n const [selectedIndices, setSelectedIndices] = React.useState<\n DropdownContextType['selectedIndices']\n >([]);\n const [controlledValueIndices, setControlledValueIndices] = React.useState<\n DropdownContextType['selectedIndices']\n >([]);\n const [activeIndex, setActiveIndex] = React.useState(-1);\n const [activeTagIndex, setActiveTagIndex] = React.useState(-1);\n const [shouldIgnoreBlurAnimation, setShouldIgnoreBlurAnimation] = React.useState(false);\n const [hasFooterAction, setHasFooterAction] = React.useState(false);\n const [\n hasAutoCompleteInBottomSheetHeader,\n setHasAutoCompleteInBottomSheetHeader,\n ] = React.useState(false);\n const [isKeydownPressed, setIsKeydownPressed] = React.useState(false);\n const [changeCallbackTriggerer, setChangeCallbackTriggerer] = React.useState<\n DropdownContextType['changeCallbackTriggerer']\n >(0);\n const [isControlled, setIsControlled] = React.useState(false);\n // keep track if dropdown contains bottomsheet\n const [dropdownHasBottomSheet, setDropdownHasBottomSheet] = React.useState(false);\n\n /**\n * In inputs, actual input is smaller than the visible input wrapper.\n * You can set this reference in such cases so floating ui calculations happen correctly\n * */\n const triggererWrapperRef = React.useRef<ContainerElementType>(null);\n const triggererRef = React.useRef<HTMLButtonElement>(null);\n const actionListItemRef = React.useRef<HTMLDivElement>(null);\n const dropdownTriggerer = React.useRef<DropdownContextType['dropdownTriggerer']>();\n const isTagDismissedRef = React.useRef<{ value: boolean } | null>({ value: false });\n const visibleTagsCountRef = React.useRef<{ value: number }>({ value: 0 });\n const dropdownContainerRef = React.useRef<HTMLDivElement>(null);\n\n const dropdownBaseId = useId('dropdown');\n const isDropdownOpenRef = React.useRef(isOpenControlled);\n\n const [isDropdownOpen, setIsDropdownOpen] = useControllableState({\n value: isOpenControlled,\n defaultValue: false,\n onChange: (isOpenControlledValue) => {\n isDropdownOpenRef.current = isOpenControlledValue;\n onOpenChange?.(isOpenControlledValue);\n },\n });\n\n isDropdownOpenRef.current = isDropdownOpen;\n\n const setIsOpen = (isOpenValue: boolean): void => {\n isDropdownOpenRef.current = isOpenValue;\n setIsDropdownOpen(() => isOpenValue);\n };\n\n const close = React.useCallback(() => {\n setActiveTagIndex(-1);\n setIsOpen(false);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n if (__DEV__) {\n if (!validDropdownChildren.includes(getComponentId(child) ?? '')) {\n throwBladeError({\n message: `Dropdown can only have one of following elements as children - \\n\\n ${validDropdownChildren.join(\n ', ',\n )} \\n\\n Check out: https://blade.razorpay.com/?path=/story/components-dropdown`,\n moduleName: 'Dropdown',\n });\n }\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.SelectInput)) {\n dropdownTriggerer.current = 'SelectInput';\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.SearchInput)) {\n dropdownTriggerer.current = 'SearchInput';\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.DropdownButton)) {\n dropdownTriggerer.current = 'DropdownButton';\n }\n\n if (isValidAllowedChildren(child, dropdownComponentIds.triggers.AutoComplete)) {\n dropdownTriggerer.current = 'AutoComplete';\n }\n }\n });\n\n const contextValue = React.useMemo<DropdownContextType>(\n () => ({\n isOpen: isDropdownOpen,\n setIsOpen,\n close,\n selectedIndices,\n setSelectedIndices,\n controlledValueIndices,\n setControlledValueIndices,\n options,\n setOptions,\n filteredValues,\n setFilteredValues,\n activeIndex,\n setActiveIndex,\n activeTagIndex,\n setActiveTagIndex,\n visibleTagsCountRef,\n shouldIgnoreBlurAnimation,\n setShouldIgnoreBlurAnimation,\n isKeydownPressed,\n setIsKeydownPressed,\n dropdownBaseId,\n triggererRef,\n triggererWrapperRef,\n actionListItemRef,\n selectionType,\n hasFooterAction,\n setHasFooterAction,\n hasAutoCompleteInBottomSheetHeader,\n setHasAutoCompleteInBottomSheetHeader,\n dropdownTriggerer: dropdownTriggerer.current,\n changeCallbackTriggerer,\n setChangeCallbackTriggerer,\n isControlled,\n setIsControlled,\n isTagDismissedRef,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n isDropdownOpen,\n isOpenControlled,\n selectedIndices,\n controlledValueIndices,\n options,\n filteredValues,\n activeIndex,\n activeTagIndex,\n shouldIgnoreBlurAnimation,\n selectionType,\n hasFooterAction,\n isKeydownPressed,\n changeCallbackTriggerer,\n isControlled,\n ],\n );\n\n const BottomSheetAndDropdownGlueContextValue = React.useMemo((): BottomSheetAndDropdownGlueContext => {\n return {\n isOpen: isDropdownOpen,\n dropdownHasBottomSheet,\n hasAutoCompleteInBottomSheetHeader,\n setDropdownHasBottomSheet,\n // This is the dismiss function which will be injected into the BottomSheet\n // Basically <BottomSheet onDismiss={onBottomSheetDismiss} />\n onBottomSheetDismiss: close,\n };\n }, [dropdownHasBottomSheet, hasAutoCompleteInBottomSheetHeader, isDropdownOpen, close]);\n\n return (\n <BottomSheetAndDropdownGlueContext.Provider value={BottomSheetAndDropdownGlueContextValue}>\n <DropdownContext.Provider value={contextValue}>\n <BaseBox\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref={dropdownContainerRef as any}\n {...metaAttribute({ name: MetaConstants.Dropdown, testID })}\n {...getStyledProps(styledProps)}\n width={_width}\n >\n <BaseBox position=\"relative\" textAlign={'left' as never}>\n {children}\n </BaseBox>\n </BaseBox>\n </DropdownContext.Provider>\n </BottomSheetAndDropdownGlueContext.Provider>\n );\n};\n\nconst Dropdown = assignWithoutSideEffects(_Dropdown, {\n componentId: dropdownComponentIds.Dropdown,\n});\n\nexport { Dropdown };\n"],"names":["validDropdownChildren","dropdownComponentIds","BaseBox","triggers","SelectInput","SearchInput","DropdownButton","DropdownLink","DropdownOverlay","AutoComplete","bottomSheetComponentIds","BottomSheet","_Dropdown","_ref","children","isOpenControlled","isOpen","onOpenChange","_ref$selectionType","selectionType","testID","_width","styledProps","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","options","setOptions","_React$useState3","_React$useState4","filteredValues","setFilteredValues","_React$useState5","_React$useState6","selectedIndices","setSelectedIndices","_React$useState7","_React$useState8","controlledValueIndices","setControlledValueIndices","_React$useState9","_React$useState10","activeIndex","setActiveIndex","_React$useState11","_React$useState12","activeTagIndex","setActiveTagIndex","_React$useState13","_React$useState14","shouldIgnoreBlurAnimation","setShouldIgnoreBlurAnimation","_React$useState15","_React$useState16","hasFooterAction","setHasFooterAction","_React$useState17","_React$useState18","hasAutoCompleteInBottomSheetHeader","setHasAutoCompleteInBottomSheetHeader","_React$useState19","_React$useState20","isKeydownPressed","setIsKeydownPressed","_React$useState21","_React$useState22","changeCallbackTriggerer","setChangeCallbackTriggerer","_React$useState23","_React$useState24","isControlled","setIsControlled","_React$useState25","_React$useState26","dropdownHasBottomSheet","setDropdownHasBottomSheet","triggererWrapperRef","useRef","triggererRef","actionListItemRef","dropdownTriggerer","isTagDismissedRef","value","visibleTagsCountRef","dropdownContainerRef","dropdownBaseId","useId","isDropdownOpenRef","_useControllableState","useControllableState","defaultValue","onChange","isOpenControlledValue","current","_useControllableState2","isDropdownOpen","setIsDropdownOpen","setIsOpen","isOpenValue","close","useCallback","Children","map","child","isValidElement","__DEV__","_getComponentId","includes","getComponentId","throwBladeError","message","join","moduleName","isValidAllowedChildren","contextValue","useMemo","BottomSheetAndDropdownGlueContextValue","onBottomSheetDismiss","_jsx","BottomSheetAndDropdownGlueContext","Provider","DropdownContext","Object","assign","ref","metaAttribute","name","M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