@razorpay/blade 11.21.9 → 11.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/build/lib/native/components/ActionList/ActionListItem.js +12 -12
  2. package/build/lib/native/components/ActionList/ActionListItem.js.map +1 -1
  3. package/build/lib/native/components/BaseHeaderFooter/BaseFooter.js +1 -1
  4. package/build/lib/native/components/BaseHeaderFooter/BaseFooter.js.map +1 -1
  5. package/build/lib/native/components/BaseHeaderFooter/BaseHeader.js +1 -1
  6. package/build/lib/native/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
  7. package/build/lib/native/components/BaseMenu/BaseMenuContext.js +6 -0
  8. package/build/lib/native/components/BaseMenu/BaseMenuContext.js.map +1 -0
  9. package/build/lib/native/components/BaseMenu/BaseMenuItem/BaseMenuItem.js +22 -0
  10. package/build/lib/native/components/BaseMenu/BaseMenuItem/BaseMenuItem.js.map +1 -0
  11. package/build/lib/native/components/BaseMenu/BaseMenuItem/StyledMenuItemContainer.native.js +12 -0
  12. package/build/lib/native/components/BaseMenu/BaseMenuItem/StyledMenuItemContainer.native.js.map +1 -0
  13. package/build/lib/native/components/BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js +12 -0
  14. package/build/lib/native/components/BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js.map +1 -0
  15. package/build/lib/native/components/Button/BaseButton/BaseButton.js +1 -1
  16. package/build/lib/native/components/Button/BaseButton/BaseButton.js.map +1 -1
  17. package/build/lib/native/components/Button/Button/Button.js +1 -1
  18. package/build/lib/native/components/Button/Button/Button.js.map +1 -1
  19. package/build/lib/native/components/Link/BaseLink/BaseLink.js +1 -1
  20. package/build/lib/native/components/Link/BaseLink/BaseLink.js.map +1 -1
  21. package/build/lib/native/components/Link/Link/Link.js +1 -1
  22. package/build/lib/native/components/Link/Link/Link.js.map +1 -1
  23. package/build/lib/native/components/Menu/Menu.native.js +17 -0
  24. package/build/lib/native/components/Menu/Menu.native.js.map +1 -0
  25. package/build/lib/native/components/Menu/MenuItem.native.js +17 -0
  26. package/build/lib/native/components/Menu/MenuItem.native.js.map +1 -0
  27. package/build/lib/native/components/Menu/MenuOverlay.native.js +17 -0
  28. package/build/lib/native/components/Menu/MenuOverlay.native.js.map +1 -0
  29. package/build/lib/native/components/Menu/VisualSubComponents/MenuDivider.native.js +17 -0
  30. package/build/lib/native/components/Menu/VisualSubComponents/MenuDivider.native.js.map +1 -0
  31. package/build/lib/native/components/Menu/VisualSubComponents/MenuHeaderFooter.native.js +17 -0
  32. package/build/lib/native/components/Menu/VisualSubComponents/MenuHeaderFooter.native.js.map +1 -0
  33. package/build/lib/native/components/index.js +5 -0
  34. package/build/lib/native/components/index.js.map +1 -1
  35. package/build/lib/native/utils/metaAttribute/metaConstants.js +1 -1
  36. package/build/lib/native/utils/metaAttribute/metaConstants.js.map +1 -1
  37. package/build/lib/web/development/components/ActionList/ActionListItem.js +43 -118
  38. package/build/lib/web/development/components/ActionList/ActionListItem.js.map +1 -1
  39. package/build/lib/web/development/components/Avatar/Avatar.web.js +29 -6
  40. package/build/lib/web/development/components/Avatar/Avatar.web.js.map +1 -1
  41. package/build/lib/web/development/components/Avatar/AvatarButton.js +25 -3
  42. package/build/lib/web/development/components/Avatar/AvatarButton.js.map +1 -1
  43. package/build/lib/web/development/components/BaseHeaderFooter/BaseFooter.js +2 -1
  44. package/build/lib/web/development/components/BaseHeaderFooter/BaseFooter.js.map +1 -1
  45. package/build/lib/web/development/components/BaseHeaderFooter/BaseHeader.js +4 -0
  46. package/build/lib/web/development/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
  47. package/build/lib/web/development/components/BaseMenu/BaseMenuContext.js +10 -0
  48. package/build/lib/web/development/components/BaseMenu/BaseMenuContext.js.map +1 -0
  49. package/build/lib/web/development/components/BaseMenu/BaseMenuItem/BaseMenuItem.js +124 -0
  50. package/build/lib/web/development/components/BaseMenu/BaseMenuItem/BaseMenuItem.js.map +1 -0
  51. package/build/lib/web/development/components/BaseMenu/BaseMenuItem/StyledMenuItemContainer.web.js +41 -0
  52. package/build/lib/web/development/components/BaseMenu/BaseMenuItem/StyledMenuItemContainer.web.js.map +1 -0
  53. package/build/lib/web/development/components/{ActionList/styles/getBaseActionListItemStyles.js → BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js} +10 -9
  54. package/build/lib/web/development/components/BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js.map +1 -0
  55. package/build/lib/web/development/components/BaseMenu/index.js +3 -0
  56. package/build/lib/web/development/components/BaseMenu/index.js.map +1 -0
  57. package/build/lib/web/development/components/BaseMenu/tokens.js +8 -0
  58. package/build/lib/web/development/components/BaseMenu/tokens.js.map +1 -0
  59. package/build/lib/web/development/components/Button/BaseButton/BaseButton.js +16 -7
  60. package/build/lib/web/development/components/Button/BaseButton/BaseButton.js.map +1 -1
  61. package/build/lib/web/development/components/Button/Button/Button.js +8 -2
  62. package/build/lib/web/development/components/Button/Button/Button.js.map +1 -1
  63. package/build/lib/web/development/components/DatePicker/QuickSelection/QuickSelectionItem.web.js +6 -27
  64. package/build/lib/web/development/components/DatePicker/QuickSelection/QuickSelectionItem.web.js.map +1 -1
  65. package/build/lib/web/development/components/Dropdown/DropdownOverlay.web.js +3 -2
  66. package/build/lib/web/development/components/Dropdown/DropdownOverlay.web.js.map +1 -1
  67. package/build/lib/web/development/components/Link/BaseLink/BaseLink.js +5 -1
  68. package/build/lib/web/development/components/Link/BaseLink/BaseLink.js.map +1 -1
  69. package/build/lib/web/development/components/Link/Link/Link.js +6 -2
  70. package/build/lib/web/development/components/Link/Link/Link.js.map +1 -1
  71. package/build/lib/web/development/components/Menu/Menu.web.js +99 -0
  72. package/build/lib/web/development/components/Menu/Menu.web.js.map +1 -0
  73. package/build/lib/web/development/components/Menu/MenuItem.web.js +63 -0
  74. package/build/lib/web/development/components/Menu/MenuItem.web.js.map +1 -0
  75. package/build/lib/web/development/components/Menu/MenuOverlay.web.js +59 -0
  76. package/build/lib/web/development/components/Menu/MenuOverlay.web.js.map +1 -0
  77. package/build/lib/web/development/components/Menu/VisualSubComponents/MenuDivider.web.js +18 -0
  78. package/build/lib/web/development/components/Menu/VisualSubComponents/MenuDivider.web.js.map +1 -0
  79. package/build/lib/web/development/components/Menu/VisualSubComponents/MenuHeaderFooter.web.js +65 -0
  80. package/build/lib/web/development/components/Menu/VisualSubComponents/MenuHeaderFooter.web.js.map +1 -0
  81. package/build/lib/web/development/components/Menu/index.js +6 -0
  82. package/build/lib/web/development/components/Menu/index.js.map +1 -0
  83. package/build/lib/web/development/components/Menu/tokens.js +26 -0
  84. package/build/lib/web/development/components/Menu/tokens.js.map +1 -0
  85. package/build/lib/web/development/components/Menu/useMenu.js +178 -0
  86. package/build/lib/web/development/components/Menu/useMenu.js.map +1 -0
  87. package/build/lib/web/development/components/Tooltip/Tooltip.web.js +1 -3
  88. package/build/lib/web/development/components/Tooltip/Tooltip.web.js.map +1 -1
  89. package/build/lib/web/development/components/index.js +6 -0
  90. package/build/lib/web/development/components/index.js.map +1 -1
  91. package/build/lib/web/development/utils/metaAttribute/metaConstants.js +3 -0
  92. package/build/lib/web/development/utils/metaAttribute/metaConstants.js.map +1 -1
  93. package/build/lib/web/production/components/ActionList/ActionListItem.js +43 -118
  94. package/build/lib/web/production/components/ActionList/ActionListItem.js.map +1 -1
  95. package/build/lib/web/production/components/Avatar/Avatar.web.js +29 -6
  96. package/build/lib/web/production/components/Avatar/Avatar.web.js.map +1 -1
  97. package/build/lib/web/production/components/Avatar/AvatarButton.js +25 -3
  98. package/build/lib/web/production/components/Avatar/AvatarButton.js.map +1 -1
  99. package/build/lib/web/production/components/BaseHeaderFooter/BaseFooter.js +2 -1
  100. package/build/lib/web/production/components/BaseHeaderFooter/BaseFooter.js.map +1 -1
  101. package/build/lib/web/production/components/BaseHeaderFooter/BaseHeader.js +4 -0
  102. package/build/lib/web/production/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
  103. package/build/lib/web/production/components/BaseMenu/BaseMenuContext.js +10 -0
  104. package/build/lib/web/production/components/BaseMenu/BaseMenuContext.js.map +1 -0
  105. package/build/lib/web/production/components/BaseMenu/BaseMenuItem/BaseMenuItem.js +124 -0
  106. package/build/lib/web/production/components/BaseMenu/BaseMenuItem/BaseMenuItem.js.map +1 -0
  107. package/build/lib/web/production/components/BaseMenu/BaseMenuItem/StyledMenuItemContainer.web.js +41 -0
  108. package/build/lib/web/production/components/BaseMenu/BaseMenuItem/StyledMenuItemContainer.web.js.map +1 -0
  109. package/build/lib/web/production/components/{ActionList/styles/getBaseActionListItemStyles.js → BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js} +10 -9
  110. package/build/lib/web/production/components/BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js.map +1 -0
  111. package/build/lib/web/production/components/BaseMenu/index.js +3 -0
  112. package/build/lib/web/production/components/BaseMenu/index.js.map +1 -0
  113. package/build/lib/web/production/components/BaseMenu/tokens.js +8 -0
  114. package/build/lib/web/production/components/BaseMenu/tokens.js.map +1 -0
  115. package/build/lib/web/production/components/Button/BaseButton/BaseButton.js +16 -7
  116. package/build/lib/web/production/components/Button/BaseButton/BaseButton.js.map +1 -1
  117. package/build/lib/web/production/components/Button/Button/Button.js +8 -2
  118. package/build/lib/web/production/components/Button/Button/Button.js.map +1 -1
  119. package/build/lib/web/production/components/DatePicker/QuickSelection/QuickSelectionItem.web.js +6 -27
  120. package/build/lib/web/production/components/DatePicker/QuickSelection/QuickSelectionItem.web.js.map +1 -1
  121. package/build/lib/web/production/components/Dropdown/DropdownOverlay.web.js +3 -2
  122. package/build/lib/web/production/components/Dropdown/DropdownOverlay.web.js.map +1 -1
  123. package/build/lib/web/production/components/Link/BaseLink/BaseLink.js +5 -1
  124. package/build/lib/web/production/components/Link/BaseLink/BaseLink.js.map +1 -1
  125. package/build/lib/web/production/components/Link/Link/Link.js +6 -2
  126. package/build/lib/web/production/components/Link/Link/Link.js.map +1 -1
  127. package/build/lib/web/production/components/Menu/Menu.web.js +99 -0
  128. package/build/lib/web/production/components/Menu/Menu.web.js.map +1 -0
  129. package/build/lib/web/production/components/Menu/MenuItem.web.js +63 -0
  130. package/build/lib/web/production/components/Menu/MenuItem.web.js.map +1 -0
  131. package/build/lib/web/production/components/Menu/MenuOverlay.web.js +59 -0
  132. package/build/lib/web/production/components/Menu/MenuOverlay.web.js.map +1 -0
  133. package/build/lib/web/production/components/Menu/VisualSubComponents/MenuDivider.web.js +18 -0
  134. package/build/lib/web/production/components/Menu/VisualSubComponents/MenuDivider.web.js.map +1 -0
  135. package/build/lib/web/production/components/Menu/VisualSubComponents/MenuHeaderFooter.web.js +65 -0
  136. package/build/lib/web/production/components/Menu/VisualSubComponents/MenuHeaderFooter.web.js.map +1 -0
  137. package/build/lib/web/production/components/Menu/index.js +6 -0
  138. package/build/lib/web/production/components/Menu/index.js.map +1 -0
  139. package/build/lib/web/production/components/Menu/tokens.js +26 -0
  140. package/build/lib/web/production/components/Menu/tokens.js.map +1 -0
  141. package/build/lib/web/production/components/Menu/useMenu.js +178 -0
  142. package/build/lib/web/production/components/Menu/useMenu.js.map +1 -0
  143. package/build/lib/web/production/components/Tooltip/Tooltip.web.js +1 -3
  144. package/build/lib/web/production/components/Tooltip/Tooltip.web.js.map +1 -1
  145. package/build/lib/web/production/components/index.js +6 -0
  146. package/build/lib/web/production/components/index.js.map +1 -1
  147. package/build/lib/web/production/utils/metaAttribute/metaConstants.js +3 -0
  148. package/build/lib/web/production/utils/metaAttribute/metaConstants.js.map +1 -1
  149. package/build/types/components/index.d.ts +755 -3
  150. package/build/types/components/index.native.d.ts +170 -2
  151. package/package.json +1 -1
  152. package/build/lib/native/components/ActionList/styles/StyledActionListItem.native.js +0 -8
  153. package/build/lib/native/components/ActionList/styles/StyledActionListItem.native.js.map +0 -1
  154. package/build/lib/native/components/ActionList/styles/getBaseActionListItemStyles.js +0 -11
  155. package/build/lib/native/components/ActionList/styles/getBaseActionListItemStyles.js.map +0 -1
  156. package/build/lib/web/development/components/ActionList/styles/StyledActionListItem.web.js +0 -33
  157. package/build/lib/web/development/components/ActionList/styles/StyledActionListItem.web.js.map +0 -1
  158. package/build/lib/web/development/components/ActionList/styles/getBaseActionListItemStyles.js.map +0 -1
  159. package/build/lib/web/production/components/ActionList/styles/StyledActionListItem.web.js +0 -33
  160. package/build/lib/web/production/components/ActionList/styles/StyledActionListItem.web.js.map +0 -1
  161. package/build/lib/web/production/components/ActionList/styles/getBaseActionListItemStyles.js.map +0 -1
@@ -1,19 +1,15 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
2
  import React__default from 'react';
3
3
  import styled from 'styled-components';
4
- import { StyledActionListItem } from './styles/StyledActionListItem.web.js';
5
4
  import { componentIds } from './componentIds.js';
6
5
  import { getNormalTextColor, validateActionListItemProps } from './actionListUtils.js';
7
- import { getActionListSectionRole, isRoleMenu, getActionListItemRole } from './getA11yRoles.js';
6
+ import { getActionListSectionRole, getActionListItemRole } from './getA11yRoles.js';
8
7
  import '../Divider/index.js';
9
8
  import '../Box/BaseBox/index.js';
10
9
  import { useDropdown } from '../Dropdown/useDropdown.js';
11
10
  import '../Typography/index.js';
12
11
  import '../../utils/index.js';
13
12
  import '../../utils/metaAttribute/index.js';
14
- import '../Checkbox/index.js';
15
- import '../../tokens/global/index.js';
16
- import '../BladeProvider/index.js';
17
13
  import '../../utils/assignWithoutSideEffects/index.js';
18
14
  import '../../utils/makeSize/index.js';
19
15
  import '../../utils/makeAccessible/index.js';
@@ -21,7 +17,9 @@ import '../../utils/logger/index.js';
21
17
  import '../Badge/index.js';
22
18
  import '../Box/index.js';
23
19
  import { dropdownComponentIds } from '../Dropdown/dropdownComponentIds.js';
24
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
20
+ import '../BaseMenu/index.js';
21
+ import '../Checkbox/index.js';
22
+ import { jsxs, jsx } from 'react/jsx-runtime';
25
23
  import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
26
24
  import { makeSize } from '../../utils/makeSize/makeSize.js';
27
25
  import { isReactNative } from '../../utils/platform/isReactNative.js';
@@ -31,17 +29,16 @@ import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
31
29
  import { Text } from '../Typography/Text/Text.js';
32
30
  import { Divider } from '../Divider/Divider.js';
33
31
  import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
32
+ import { useBaseMenuItem } from '../BaseMenu/BaseMenuContext.js';
34
33
  import { Box } from '../Box/Box.js';
35
34
  import { Badge } from '../Badge/Badge.js';
36
- import { size } from '../../tokens/global/size.js';
37
- import { Checkbox } from '../Checkbox/Checkbox.js';
38
- import useTheme from '../BladeProvider/useTheme.js';
39
35
  import { throwBladeError } from '../../utils/logger/logger.js';
36
+ import { BaseMenuItem } from '../BaseMenu/BaseMenuItem/BaseMenuItem.js';
37
+ import { Checkbox } from '../Checkbox/Checkbox.js';
40
38
  import { castWebType } from '../../utils/platform/castUtils.js';
41
39
 
42
40
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
43
41
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
44
- var ActionListItemContext = /*#__PURE__*/React__default.createContext({});
45
42
  var StyledActionListSectionTitle = /*#__PURE__*/styled(BaseBox).withConfig({
46
43
  displayName: "ActionListItem__StyledActionListSectionTitle",
47
44
  componentId: "m6qdwa-0"
@@ -107,12 +104,12 @@ var ActionListSection = /*#__PURE__*/assignWithoutSideEffects(_ActionListSection
107
104
  var _ActionListItemIcon = function _ActionListItemIcon(_ref2) {
108
105
  var icon = _ref2.icon;
109
106
  var Icon = icon;
110
- var _React$useContext = React__default.useContext(ActionListItemContext),
111
- intent = _React$useContext.intent,
112
- isDisabled = _React$useContext.isDisabled;
107
+ var _useBaseMenuItem = useBaseMenuItem(),
108
+ color = _useBaseMenuItem.color,
109
+ isDisabled = _useBaseMenuItem.isDisabled;
113
110
  var iconState = isDisabled ? 'disabled' : 'muted';
114
111
  return /*#__PURE__*/jsx(Icon, {
115
- color: intent === 'negative' ? 'feedback.icon.negative.intense' : "interactive.icon.gray.".concat(iconState),
112
+ color: color === 'negative' ? 'feedback.icon.negative.intense' : "interactive.icon.gray.".concat(iconState),
116
113
  size: "medium"
117
114
  });
118
115
  };
@@ -142,8 +139,8 @@ var ActionListItemBadge = /*#__PURE__*/assignWithoutSideEffects(_ActionListItemB
142
139
  });
143
140
  var _ActionListItemText = function _ActionListItemText(_ref4) {
144
141
  var children = _ref4.children;
145
- var _React$useContext2 = React__default.useContext(ActionListItemContext),
146
- isDisabled = _React$useContext2.isDisabled;
142
+ var _useBaseMenuItem2 = useBaseMenuItem(),
143
+ isDisabled = _useBaseMenuItem2.isDisabled;
147
144
  return /*#__PURE__*/jsx(Text, {
148
145
  variant: "caption",
149
146
  color: getNormalTextColor(isDisabled, {
@@ -167,71 +164,6 @@ var makeActionListItemClickable = function makeActionListItemClickable(clickHand
167
164
  onClick: clickHandler
168
165
  };
169
166
  };
170
- var _ActionListItemBody = function _ActionListItemBody(_ref5) {
171
- var selectionType = _ref5.selectionType,
172
- intent = _ref5.intent,
173
- description = _ref5.description,
174
- isDisabled = _ref5.isDisabled,
175
- leading = _ref5.leading,
176
- trailing = _ref5.trailing,
177
- title = _ref5.title,
178
- titleSuffix = _ref5.titleSuffix,
179
- isSelected = _ref5.isSelected;
180
- return /*#__PURE__*/jsxs(Fragment, {
181
- children: [/*#__PURE__*/jsxs(BaseBox, {
182
- display: "flex",
183
- justifyContent: "center",
184
- flexDirection: "row",
185
- alignItems: "center",
186
- maxHeight: isReactNative() ? undefined : makeSize(size[20]),
187
- children: [/*#__PURE__*/jsx(BaseBox, {
188
- display: "flex",
189
- justifyContent: "center",
190
- alignItems: "center",
191
- children: selectionType === 'multiple' ?
192
- /*#__PURE__*/
193
- // Adding aria-hidden because the listbox item in multiselect in itself explains the behaviour so announcing checkbox is unneccesary and just a nice UI tweak for us
194
- jsx(BaseBox, _objectSpread(_objectSpread({
195
- pointerEvents: "none",
196
- paddingRight: "spacing.2"
197
- }, makeAccessible({
198
- hidden: true
199
- })), {}, {
200
- children: /*#__PURE__*/jsx(Checkbox, {
201
- isChecked: isSelected,
202
- tabIndex: -1,
203
- isDisabled: isDisabled,
204
- children: null
205
- })
206
- })) : leading
207
- }), /*#__PURE__*/jsxs(BaseBox, {
208
- paddingLeft: selectionType === 'multiple' || !leading ? 'spacing.0' : 'spacing.3',
209
- paddingRight: "spacing.3",
210
- display: "flex",
211
- alignItems: "center",
212
- flexDirection: "row",
213
- children: [/*#__PURE__*/jsx(Text, {
214
- truncateAfterLines: 1,
215
- color: intent === 'negative' ? 'feedback.text.negative.intense' : getNormalTextColor(isDisabled),
216
- children: title
217
- }), titleSuffix]
218
- }), /*#__PURE__*/jsx(BaseBox, {
219
- marginLeft: "auto",
220
- children: trailing
221
- })]
222
- }), /*#__PURE__*/jsx(BaseBox, {
223
- paddingLeft: leading || selectionType === 'multiple' ? 'spacing.7' : undefined,
224
- children: description ? /*#__PURE__*/jsx(Text, {
225
- color: getNormalTextColor(isDisabled, {
226
- isMuted: true
227
- }),
228
- size: "small",
229
- children: description
230
- }) : null
231
- })]
232
- });
233
- };
234
- var ActionListItemBody = /*#__PURE__*/React__default.memo(_ActionListItemBody);
235
167
 
236
168
  /**
237
169
  * ### ActionListItem
@@ -263,9 +195,6 @@ var _ActionListItem = function _ActionListItem(props) {
263
195
  isKeydownPressed = _useDropdown2.isKeydownPressed,
264
196
  filteredValues = _useDropdown2.filteredValues,
265
197
  hasAutoCompleteInBottomSheetHeader = _useDropdown2.hasAutoCompleteInBottomSheetHeader;
266
- var _useTheme = useTheme(),
267
- platform = _useTheme.platform;
268
- var isMobile = platform === 'onMobile';
269
198
  var hasAutoComplete = hasAutoCompleteInBottomSheetHeader || dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;
270
199
  var renderOnWebAs = props.href ? 'a' : 'button';
271
200
 
@@ -302,26 +231,38 @@ var _ActionListItem = function _ActionListItem(props) {
302
231
  }
303
232
  }
304
233
  }, [props.intent, dropdownTriggerer]);
305
- return /*#__PURE__*/jsx(ActionListItemContext.Provider, {
306
- value: {
307
- intent: props.intent,
308
- isDisabled: props.isDisabled
309
- },
310
- children: /*#__PURE__*/jsx(StyledActionListItem, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
234
+ return (
235
+ /*#__PURE__*/
236
+ // We use this context to change the color of subcomponents like ActionListItemIcon, ActionListItemText, etc
237
+ jsx(BaseMenuItem, _objectSpread(_objectSpread(_objectSpread({
311
238
  isVisible: hasAutoComplete && filteredValues ? filteredValues.includes(props.value) : true,
312
239
  as: !isReactNative() ? renderOnWebAs : undefined,
313
240
  id: "".concat(dropdownBaseId, "-").concat(props._index),
314
- type: "button",
315
241
  tabIndex: -1,
242
+ title: props.title,
243
+ description: props.description,
244
+ leading: selectionType === 'multiple' ? /*#__PURE__*/jsx(BaseBox, _objectSpread(_objectSpread({
245
+ pointerEvents: "none"
246
+ // Adding aria-hidden because the listbox item in multiselect in itself explains the behaviour so announcing checkbox is unneccesary and just a nice UI tweak for us
247
+ }, makeAccessible({
248
+ hidden: true
249
+ })), {}, {
250
+ children: /*#__PURE__*/jsx(Checkbox, {
251
+ isChecked: isSelected,
252
+ tabIndex: -1,
253
+ isDisabled: props.isDisabled,
254
+ children: null
255
+ })
256
+ })) : props.leading,
257
+ trailing: props.trailing,
258
+ titleSuffix: props.titleSuffix,
316
259
  href: props.href,
317
260
  target: props.target,
318
- className: activeIndex === props._index ? 'active-focus' : ''
319
- }, makeAccessible({
320
- selected: isSelected,
321
- current: isRoleMenu(dropdownTriggerer) ? isSelected : undefined,
322
- role: getActionListItemRole(dropdownTriggerer, props.href),
323
- disabled: props.isDisabled
324
- })), makeActionListItemClickable(function (e) {
261
+ className: activeIndex === props._index ? 'active-focus' : '',
262
+ isSelected: isSelected,
263
+ isDisabled: props.isDisabled,
264
+ role: getActionListItemRole(dropdownTriggerer, props.href)
265
+ }, makeActionListItemClickable(function (e) {
325
266
  if (typeof props._index === 'number') {
326
267
  var _props$onClick;
327
268
  onOptionClick(e, props._index);
@@ -345,28 +286,12 @@ var _ActionListItem = function _ActionListItem(props) {
345
286
  setShouldIgnoreBlurAnimation(false);
346
287
  },
347
288
  "data-value": props.value,
348
- "data-index": props._index
349
- // Custom props for changes in styles
350
- ,
289
+ "data-index": props._index,
351
290
  selectionType: selectionType,
352
- hasDescription: Boolean(props.description),
353
- intent: props.intent,
354
- isSelected: isSelected,
355
- isKeydownPressed: isKeydownPressed,
356
- isMobile: isMobile,
357
- children: /*#__PURE__*/jsx(ActionListItemBody, {
358
- selectionType: selectionType,
359
- intent: props.intent,
360
- description: props.description,
361
- isDisabled: props.isDisabled,
362
- leading: props.leading,
363
- trailing: props.trailing,
364
- title: props.title,
365
- titleSuffix: props.titleSuffix,
366
- isSelected: isSelected
367
- })
291
+ color: props.intent,
292
+ isKeydownPressed: isKeydownPressed
368
293
  }))
369
- });
294
+ );
370
295
  };
371
296
  var ActionListItem = /*#__PURE__*/assignWithoutSideEffects( /*#__PURE__*/React__default.memo(_ActionListItem), {
372
297
  componentId: componentIds.ActionListItem,
@@ -1 +1 @@
1
- {"version":3,"file":"ActionListItem.js","sources":["../../../../../../src/components/ActionList/ActionListItem.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-ts-comment */\nimport React from 'react';\nimport styled from 'styled-components';\nimport type { TouchableOpacity } from 'react-native';\nimport { StyledActionListItem } from './styles/StyledActionListItem';\nimport { componentIds } from './componentIds';\nimport type { StyledActionListItemProps } from './styles/getBaseActionListItemStyles';\nimport { validateActionListItemProps, getNormalTextColor } from './actionListUtils';\nimport { getActionListItemRole, getActionListSectionRole, isRoleMenu } from './getA11yRoles';\nimport { Divider } from '~components/Divider';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { IconComponent } from '~components/Icons';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\nimport type { FeedbackColors } from '~tokens/theme/theme';\nimport { Text } from '~components/Typography';\nimport type { Platform } from '~utils';\nimport { castWebType, isReactNative } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { Checkbox } from '~components/Checkbox';\nimport { size } from '~tokens/global';\nimport type { DropdownProps } from '~components/Dropdown';\nimport type { StringChildrenType, TestID } from '~utils/types';\nimport { useTheme } from '~components/BladeProvider';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeSize } from '~utils/makeSize';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { throwBladeError } from '~utils/logger';\nimport type { BadgeProps } from '~components/Badge';\nimport { Badge } from '~components/Badge';\nimport { Box } from '~components/Box';\nimport { dropdownComponentIds } from '~components/Dropdown/dropdownComponentIds';\n\ntype ActionListItemProps = {\n title: string;\n description?: string;\n onClick?: (clickProps: {\n name: string;\n value?: boolean;\n event: Platform.Select<{\n web: React.MouseEvent;\n native: React.TouchEvent<TouchableOpacity>;\n }>;\n }) => void;\n /**\n * value that you get from `onChange` event on SelectInput or in form submissions.\n */\n value: string;\n /**\n * Link to open when item is clicked.\n */\n href?: string;\n /**\n * HTML target of the link\n */\n target?: string;\n /**\n * Item that goes on left-side of item.\n *\n * Valid elements - `<ActionListItemIcon />`, `<ActionListItemAsset />`\n *\n * Will be overriden in multiselect\n */\n leading?: React.ReactNode;\n /**\n * Item that goes on right-side of item.\n *\n * Valid elements - `<ActionListItemText />`, `<ActionListItemIcon />`\n */\n trailing?: React.ReactNode;\n /**\n * Item that goes immediately next to the title.\n *\n * Valid elements - `<ActionListItemBadge />`, `<ActionListItemBadgeGroup />`\n *\n */\n titleSuffix?: React.ReactElement;\n isDisabled?: boolean;\n intent?: Extract<FeedbackColors, 'negative'>;\n /**\n * Can be used in combination of `onClick` to highlight item as selected in Button Triggers.\n *\n * When trigger is SelectInput, Use `value` prop on SelectInput instead to make dropdown controlled.\n */\n isSelected?: boolean;\n /**\n * Internally passed from ActionList. No need to pass it explicitly\n *\n * @private\n */\n _index?: number;\n} & TestID;\n\nconst ActionListItemContext = React.createContext<{\n intent?: ActionListItemProps['intent'];\n isDisabled?: ActionListItemProps['isDisabled'];\n}>({});\n\nconst StyledActionListSectionTitle = styled(BaseBox)((props) => ({\n // @TODO: replace this styled-component with new layout box when we have padding shorthand\n padding: makeSize(props.theme.spacing[3]),\n}));\n\ntype ActionListSectionProps = {\n title: string;\n children: React.ReactNode[] | React.ReactNode;\n /**\n * Internally used to hide the divider on final item in React Native.\n *\n * Should not be used by consumers (also won't work on web)\n *\n * @private\n */\n _hideDivider?: boolean;\n /**\n * Internally used to hide / show section in AutoComplete\n *\n * @private\n */\n _sectionChildValues?: string[];\n} & TestID;\nconst _ActionListSection = ({\n title,\n children,\n testID,\n _hideDivider,\n _sectionChildValues,\n}: ActionListSectionProps): React.ReactElement => {\n const { hasAutoCompleteInBottomSheetHeader, dropdownTriggerer, filteredValues } = useDropdown();\n const hasAutoComplete =\n hasAutoCompleteInBottomSheetHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n\n const isSectionVisible = React.useMemo(() => {\n if (hasAutoComplete) {\n const visibleActionListItemInSection = _sectionChildValues?.find((actionItemValue) =>\n filteredValues.includes(actionItemValue),\n );\n\n return Boolean(visibleActionListItemInSection);\n }\n\n return true;\n }, [_sectionChildValues, hasAutoComplete, filteredValues]);\n\n const showDividerInRN = !(_hideDivider && isReactNative());\n const showDividerInAutoComplete = hasAutoComplete\n ? isSectionVisible && filteredValues.length > 1\n : true;\n\n return (\n <BaseBox\n {...makeAccessible({\n role: getActionListSectionRole(),\n label: title,\n })}\n {...metaAttribute({ name: MetaConstants.ActionListSection, testID })}\n >\n {/* We're announcing title as group label so we can hide this */}\n {isSectionVisible ? (\n <StyledActionListSectionTitle {...makeAccessible({ hidden: true })}>\n <Text color=\"surface.text.gray.muted\" size=\"small\" weight=\"semibold\">\n {title}\n </Text>\n </StyledActionListSectionTitle>\n ) : null}\n <BaseBox\n {...makeAccessible({\n // On web, we just wrap it in another listbox to announce item count properly for particular group.\n // On React Native, we ignore it since `menu` + `group` role will take care of accessibility\n role: isReactNative() ? undefined : 'listbox',\n })}\n >\n {children}\n </BaseBox>\n {showDividerInAutoComplete && showDividerInRN ? (\n <Divider marginX=\"spacing.3\" marginY=\"spacing.1\" />\n ) : null}\n </BaseBox>\n );\n};\n\nconst ActionListSection = assignWithoutSideEffects(_ActionListSection, {\n componentId: componentIds.ActionListSection,\n});\n\nconst _ActionListItemIcon = ({ icon }: { icon: IconComponent }): React.ReactElement => {\n const Icon = icon;\n const { intent, isDisabled } = React.useContext(ActionListItemContext);\n const iconState = isDisabled ? 'disabled' : 'muted';\n return (\n <Icon\n color={\n intent === 'negative'\n ? 'feedback.icon.negative.intense'\n : `interactive.icon.gray.${iconState}`\n }\n size=\"medium\"\n />\n );\n};\n\nconst ActionListItemIcon = assignWithoutSideEffects(_ActionListItemIcon, {\n componentId: componentIds.ActionListItemIcon,\n});\n\nconst _ActionListItemBadgeGroup = ({\n children,\n}: {\n children: React.ReactElement[] | React.ReactElement;\n}): React.ReactElement => {\n return (\n <Box display=\"flex\" alignItems=\"center\" flexDirection=\"row\">\n {children}\n </Box>\n );\n};\n\nconst ActionListItemBadgeGroup = assignWithoutSideEffects(_ActionListItemBadgeGroup, {\n componentId: componentIds.ActionListItemBadgeGroup,\n});\n\nconst _ActionListItemBadge = (props: BadgeProps): React.ReactElement => {\n return <Badge size=\"medium\" marginLeft=\"spacing.3\" {...props} />;\n};\n\nconst ActionListItemBadge = assignWithoutSideEffects(_ActionListItemBadge, {\n componentId: componentIds.ActionListItemBadge,\n});\n\nconst _ActionListItemText = ({\n children,\n}: {\n children: StringChildrenType;\n}): React.ReactElement => {\n const { isDisabled } = React.useContext(ActionListItemContext);\n\n return (\n <Text variant=\"caption\" color={getNormalTextColor(isDisabled, { isMuted: true })}>\n {children}\n </Text>\n );\n};\n\nconst ActionListItemText = assignWithoutSideEffects(_ActionListItemText, {\n componentId: componentIds.ActionListItemText,\n});\n\ntype ClickHandlerType = (e: React.MouseEvent<HTMLButtonElement>) => void;\n\nconst makeActionListItemClickable = (\n clickHandler: ClickHandlerType,\n): { onPress?: StyledActionListItemProps['onPress']; onClick?: ClickHandlerType } => {\n if (isReactNative()) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment, @typescript-eslint/prefer-ts-expect-error\n // @ts-ignore: ignoring ReactNative press type for the peace of mind\n return { onPress: clickHandler };\n }\n\n return {\n onClick: clickHandler,\n };\n};\n\nconst _ActionListItemBody = ({\n selectionType,\n intent,\n description,\n isDisabled,\n leading,\n trailing,\n title,\n titleSuffix,\n isSelected,\n}: Pick<\n ActionListItemProps,\n 'intent' | 'isDisabled' | 'description' | 'trailing' | 'leading' | 'title' | 'titleSuffix'\n> & {\n selectionType: DropdownProps['selectionType'];\n isSelected?: boolean;\n}): React.ReactElement => {\n return (\n <>\n <BaseBox\n display=\"flex\"\n justifyContent=\"center\"\n flexDirection=\"row\"\n alignItems=\"center\"\n maxHeight={isReactNative() ? undefined : makeSize(size[20])}\n >\n <BaseBox display=\"flex\" justifyContent=\"center\" alignItems=\"center\">\n {selectionType === 'multiple' ? (\n // Adding aria-hidden because the listbox item in multiselect in itself explains the behaviour so announcing checkbox is unneccesary and just a nice UI tweak for us\n <BaseBox\n pointerEvents=\"none\"\n paddingRight=\"spacing.2\"\n {...makeAccessible({\n hidden: true,\n })}\n >\n <Checkbox isChecked={isSelected} tabIndex={-1} isDisabled={isDisabled}>\n {/* \n Checkbox requires children. Didn't want to make it optional because its helpful for consumers\n But for this case in particular, we just want to use Text separately so that we can control spacing and color and keep it consistent with non-multiselect dropdowns\n */}\n {null}\n </Checkbox>\n </BaseBox>\n ) : (\n leading\n )}\n </BaseBox>\n <BaseBox\n paddingLeft={selectionType === 'multiple' || !leading ? 'spacing.0' : 'spacing.3'}\n paddingRight=\"spacing.3\"\n display=\"flex\"\n alignItems=\"center\"\n flexDirection=\"row\"\n >\n <Text\n truncateAfterLines={1}\n color={\n intent === 'negative'\n ? 'feedback.text.negative.intense'\n : getNormalTextColor(isDisabled)\n }\n >\n {title}\n </Text>\n {titleSuffix}\n </BaseBox>\n <BaseBox marginLeft=\"auto\">{trailing}</BaseBox>\n </BaseBox>\n <BaseBox paddingLeft={leading || selectionType === 'multiple' ? 'spacing.7' : undefined}>\n {description ? (\n <Text color={getNormalTextColor(isDisabled, { isMuted: true })} size=\"small\">\n {description}\n </Text>\n ) : null}\n </BaseBox>\n </>\n );\n};\n\nconst ActionListItemBody = React.memo(_ActionListItemBody);\n\n/**\n * ### ActionListItem\n *\n * Creates option inside `ActionList`.\n *\n * #### Usage\n *\n * ```jsx\n * <ActionList>\n * <ActionListItem\n * title=\"Home\"\n * value=\"home\"\n * leading={<ActionListItemIcon icon={HomeIcon} />}\n * trailing={<ActionListItemText>⌘ + S</ActionListItemText>}\n * />\n * </ActionList>\n * ```\n */\nconst _ActionListItem = (props: ActionListItemProps): React.ReactElement => {\n const {\n activeIndex,\n dropdownBaseId,\n onOptionClick,\n selectedIndices,\n setShouldIgnoreBlurAnimation,\n selectionType,\n dropdownTriggerer,\n isKeydownPressed,\n filteredValues,\n hasAutoCompleteInBottomSheetHeader,\n } = useDropdown();\n\n const { platform } = useTheme();\n const isMobile = platform === 'onMobile';\n const hasAutoComplete =\n hasAutoCompleteInBottomSheetHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n\n const renderOnWebAs = props.href ? 'a' : 'button';\n\n /**\n * In SelectInput, returns the isSelected according to selected indexes in the state\n *\n * In Other Triggers (Menu Usecase), returns `props.isSelected` since passing the\n * isSelected prop explicitly is the only way to select item in menu\n */\n const getIsSelected = (): boolean | undefined => {\n if (dropdownTriggerer === dropdownComponentIds.triggers.SelectInput || hasAutoComplete) {\n if (typeof props._index === 'number') {\n return selectedIndices.includes(props._index);\n }\n\n return undefined;\n }\n\n return props.isSelected;\n };\n\n const isSelected = getIsSelected();\n\n React.useEffect(() => {\n validateActionListItemProps({\n leading: props.leading,\n trailing: props.trailing,\n titleSuffix: props.titleSuffix,\n });\n }, [props.leading, props.trailing, props.titleSuffix]);\n\n React.useEffect(() => {\n if (__DEV__) {\n if (\n dropdownTriggerer === dropdownComponentIds.triggers.SelectInput &&\n props.intent === 'negative'\n ) {\n throwBladeError({\n message:\n 'negative intent ActionListItem cannot be used inside Dropdown with SelectInput trigger',\n moduleName: 'ActionListItem',\n });\n }\n }\n }, [props.intent, dropdownTriggerer]);\n\n return (\n <ActionListItemContext.Provider value={{ intent: props.intent, isDisabled: props.isDisabled }}>\n <StyledActionListItem\n isVisible={hasAutoComplete && filteredValues ? filteredValues.includes(props.value) : true}\n as={!isReactNative() ? renderOnWebAs : undefined}\n id={`${dropdownBaseId}-${props._index}`}\n type=\"button\"\n tabIndex={-1}\n href={props.href}\n target={props.target}\n className={activeIndex === props._index ? 'active-focus' : ''}\n {...makeAccessible({\n selected: isSelected,\n current: isRoleMenu(dropdownTriggerer) ? isSelected : undefined,\n role: getActionListItemRole(dropdownTriggerer, props.href),\n disabled: props.isDisabled,\n })}\n {...makeActionListItemClickable((e: React.MouseEvent<HTMLButtonElement>): void => {\n if (typeof props._index === 'number') {\n onOptionClick(e, props._index);\n props.onClick?.({ name: props.value, value: isSelected, event: castWebType(e) });\n }\n })}\n {...metaAttribute({ name: MetaConstants.ActionListItem, testID: props.testID })}\n onMouseDown={() => {\n // We want to keep focus on Dropdown's trigger while option is being clicked\n // So We set this flag that ignores the blur animation to avoid the flicker between focus out + focus in\n setShouldIgnoreBlurAnimation(true);\n }}\n onMouseUp={() => {\n // (Contd from above comment...) We set this flag back to false since blur of SelectInput is done calling by this time\n setShouldIgnoreBlurAnimation(false);\n }}\n data-value={props.value}\n data-index={props._index}\n // Custom props for changes in styles\n selectionType={selectionType}\n hasDescription={Boolean(props.description)}\n intent={props.intent}\n isSelected={isSelected}\n isKeydownPressed={isKeydownPressed}\n isMobile={isMobile}\n >\n <ActionListItemBody\n selectionType={selectionType}\n intent={props.intent}\n description={props.description}\n isDisabled={props.isDisabled}\n leading={props.leading}\n trailing={props.trailing}\n title={props.title}\n titleSuffix={props.titleSuffix}\n isSelected={isSelected}\n />\n </StyledActionListItem>\n </ActionListItemContext.Provider>\n );\n};\n\nconst ActionListItem = assignWithoutSideEffects(React.memo(_ActionListItem), {\n componentId: componentIds.ActionListItem,\n displayName: componentIds.ActionListItem,\n});\n\nexport type { ActionListItemProps, ActionListSectionProps };\nexport {\n ActionListItem,\n ActionListItemIcon,\n ActionListItemText,\n ActionListItemBadge,\n ActionListItemBadgeGroup,\n ActionListSection,\n};\n"],"names":["ActionListItemContext","React","createContext","StyledActionListSectionTitle","styled","BaseBox","withConfig","displayName","componentId","props","padding","makeSize","theme","spacing","_ActionListSection","_ref","title","children","testID","_hideDivider","_sectionChildValues","_useDropdown","useDropdown","hasAutoCompleteInBottomSheetHeader","dropdownTriggerer","filteredValues","hasAutoComplete","dropdownComponentIds","triggers","AutoComplete","isSectionVisible","useMemo","visibleActionListItemInSection","find","actionItemValue","includes","Boolean","showDividerInRN","isReactNative","showDividerInAutoComplete","length","_jsxs","_objectSpread","makeAccessible","role","getActionListSectionRole","label","metaAttribute","name","MetaConstants","ActionListSection","_jsx","hidden","Text","color","size","weight","undefined","Divider","marginX","marginY","assignWithoutSideEffects","componentIds","_ActionListItemIcon","_ref2","icon","Icon","_React$useContext","useContext","intent","isDisabled","iconState","concat","ActionListItemIcon","_ActionListItemBadgeGroup","_ref3","Box","display","alignItems","flexDirection","ActionListItemBadgeGroup","_ActionListItemBadge","Badge","marginLeft","ActionListItemBadge","_ActionListItemText","_ref4","_React$useContext2","variant","getNormalTextColor","isMuted","ActionListItemText","makeActionListItemClickable","clickHandler","onPress","onClick","_ActionListItemBody","_ref5","selectionType","description","leading","trailing","titleSuffix","isSelected","_Fragment","justifyContent","maxHeight","pointerEvents","paddingRight","Checkbox","isChecked","tabIndex","paddingLeft","truncateAfterLines","ActionListItemBody","memo","_ActionListItem","_useDropdown2","activeIndex","dropdownBaseId","onOptionClick","selectedIndices","setShouldIgnoreBlurAnimation","isKeydownPressed","_useTheme","useTheme","platform","isMobile","renderOnWebAs","href","getIsSelected","SelectInput","_index","useEffect","validateActionListItemProps","throwBladeError","message","moduleName","Provider","value","StyledActionListItem","isVisible","as","id","type","target","className","selected","current","isRoleMenu","getActionListItemRole","disabled","e","_props$onClick","call","event","castWebType","ActionListItem","onMouseDown","onMouseUp","hasDescription"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4FA,IAAMA,qBAAqB,gBAAGC,cAAK,CAACC,aAAa,CAG9C,EAAE,CAAC,CAAA;AAEN,IAAMC,4BAA4B,gBAAGC,MAAM,CAACC,OAAO,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,8CAAA;EAAAC,WAAA,EAAA,UAAA;AAAA,CAAA,CAAA,CAAC,UAACC,KAAK,EAAA;EAAA,OAAM;AAC/D;IACAC,OAAO,EAAEC,QAAQ,CAACF,KAAK,CAACG,KAAK,CAACC,OAAO,CAAC,CAAC,CAAC,CAAA;GACzC,CAAA;AAAA,CAAC,CAAC,CAAA;AAoBH,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAAC,IAAA,EAM0B;AAAA,EAAA,IALhDC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,MAAM,GAAAH,IAAA,CAANG,MAAM;IACNC,YAAY,GAAAJ,IAAA,CAAZI,YAAY;IACZC,mBAAmB,GAAAL,IAAA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8B,OAAO,EAAE3F,KAAK,CAAC2F,OAAQ;QACvBC,QAAQ,EAAE5F,KAAK,CAAC4F,QAAS;QACzBrF,KAAK,EAAEP,KAAK,CAACO,KAAM;QACnBsF,WAAW,EAAE7F,KAAK,CAAC6F,WAAY;AAC/BC,QAAAA,UAAU,EAAEA,UAAAA;OACb,CAAA;KACmB,CAAA,CAAA;AAAC,GACO,CAAC,CAAA;AAErC,CAAC,CAAA;AAEKsD,IAAAA,cAAc,gBAAGhG,wBAAwB,eAAC5D,cAAK,CAACkH,IAAI,CAACC,eAAe,CAAC,EAAE;EAC3E5G,WAAW,EAAEsD,YAAY,CAAC+F,cAAc;EACxCtJ,WAAW,EAAEuD,YAAY,CAAC+F,cAAAA;AAC5B,CAAC;;;;"}
1
+ {"version":3,"file":"ActionListItem.js","sources":["../../../../../../src/components/ActionList/ActionListItem.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-ts-comment */\nimport React from 'react';\nimport styled from 'styled-components';\nimport type { TouchableOpacity } from 'react-native';\nimport { componentIds } from './componentIds';\nimport { validateActionListItemProps, getNormalTextColor } from './actionListUtils';\nimport { getActionListItemRole, getActionListSectionRole } from './getA11yRoles';\nimport { Divider } from '~components/Divider';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { IconComponent } from '~components/Icons';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\nimport type { FeedbackColors } from '~tokens/theme/theme';\nimport { Text } from '~components/Typography';\nimport type { Platform } from '~utils';\nimport { castWebType, isReactNative } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { StringChildrenType, TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeSize } from '~utils/makeSize';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { throwBladeError } from '~utils/logger';\nimport type { BadgeProps } from '~components/Badge';\nimport { Badge } from '~components/Badge';\nimport { Box } from '~components/Box';\nimport { dropdownComponentIds } from '~components/Dropdown/dropdownComponentIds';\nimport { BaseMenuItem, useBaseMenuItem } from '~components/BaseMenu';\nimport { Checkbox } from '~components/Checkbox';\n\ntype ActionListItemProps = {\n title: string;\n description?: string;\n onClick?: (clickProps: {\n name: string;\n value?: boolean;\n event: Platform.Select<{\n web: React.MouseEvent;\n native: React.TouchEvent<TouchableOpacity>;\n }>;\n }) => void;\n /**\n * value that you get from `onChange` event on SelectInput or in form submissions.\n */\n value: string;\n /**\n * Link to open when item is clicked.\n */\n href?: string;\n /**\n * HTML target of the link\n */\n target?: string;\n /**\n * Item that goes on left-side of item.\n *\n * Valid elements - `<ActionListItemIcon />`, `<ActionListItemAsset />`\n *\n * Will be overriden in multiselect\n */\n leading?: React.ReactNode;\n /**\n * Item that goes on right-side of item.\n *\n * Valid elements - `<ActionListItemText />`, `<ActionListItemIcon />`\n */\n trailing?: React.ReactNode;\n /**\n * Item that goes immediately next to the title.\n *\n * Valid elements - `<ActionListItemBadge />`, `<ActionListItemBadgeGroup />`\n *\n */\n titleSuffix?: React.ReactElement;\n isDisabled?: boolean;\n intent?: Extract<FeedbackColors, 'negative'>;\n /**\n * Can be used in combination of `onClick` to highlight item as selected in Button Triggers.\n *\n * When trigger is SelectInput, Use `value` prop on SelectInput instead to make dropdown controlled.\n */\n isSelected?: boolean;\n /**\n * Internally passed from ActionList. No need to pass it explicitly\n *\n * @private\n */\n _index?: number;\n} & TestID;\n\nconst StyledActionListSectionTitle = styled(BaseBox)((props) => ({\n // @TODO: replace this styled-component with new layout box when we have padding shorthand\n padding: makeSize(props.theme.spacing[3]),\n}));\n\ntype ActionListSectionProps = {\n title: string;\n children: React.ReactNode[] | React.ReactNode;\n /**\n * Internally used to hide the divider on final item in React Native.\n *\n * Should not be used by consumers (also won't work on web)\n *\n * @private\n */\n _hideDivider?: boolean;\n /**\n * Internally used to hide / show section in AutoComplete\n *\n * @private\n */\n _sectionChildValues?: string[];\n} & TestID;\nconst _ActionListSection = ({\n title,\n children,\n testID,\n _hideDivider,\n _sectionChildValues,\n}: ActionListSectionProps): React.ReactElement => {\n const { hasAutoCompleteInBottomSheetHeader, dropdownTriggerer, filteredValues } = useDropdown();\n const hasAutoComplete =\n hasAutoCompleteInBottomSheetHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n\n const isSectionVisible = React.useMemo(() => {\n if (hasAutoComplete) {\n const visibleActionListItemInSection = _sectionChildValues?.find((actionItemValue) =>\n filteredValues.includes(actionItemValue),\n );\n\n return Boolean(visibleActionListItemInSection);\n }\n\n return true;\n }, [_sectionChildValues, hasAutoComplete, filteredValues]);\n\n const showDividerInRN = !(_hideDivider && isReactNative());\n const showDividerInAutoComplete = hasAutoComplete\n ? isSectionVisible && filteredValues.length > 1\n : true;\n\n return (\n <BaseBox\n {...makeAccessible({\n role: getActionListSectionRole(),\n label: title,\n })}\n {...metaAttribute({ name: MetaConstants.ActionListSection, testID })}\n >\n {/* We're announcing title as group label so we can hide this */}\n {isSectionVisible ? (\n <StyledActionListSectionTitle {...makeAccessible({ hidden: true })}>\n <Text color=\"surface.text.gray.muted\" size=\"small\" weight=\"semibold\">\n {title}\n </Text>\n </StyledActionListSectionTitle>\n ) : null}\n <BaseBox\n {...makeAccessible({\n // On web, we just wrap it in another listbox to announce item count properly for particular group.\n // On React Native, we ignore it since `menu` + `group` role will take care of accessibility\n role: isReactNative() ? undefined : 'listbox',\n })}\n >\n {children}\n </BaseBox>\n {showDividerInAutoComplete && showDividerInRN ? (\n <Divider marginX=\"spacing.3\" marginY=\"spacing.1\" />\n ) : null}\n </BaseBox>\n );\n};\n\nconst ActionListSection = assignWithoutSideEffects(_ActionListSection, {\n componentId: componentIds.ActionListSection,\n});\n\nconst _ActionListItemIcon = ({ icon }: { icon: IconComponent }): React.ReactElement => {\n const Icon = icon;\n const { color, isDisabled } = useBaseMenuItem();\n const iconState = isDisabled ? 'disabled' : 'muted';\n return (\n <Icon\n color={\n color === 'negative'\n ? 'feedback.icon.negative.intense'\n : `interactive.icon.gray.${iconState}`\n }\n size=\"medium\"\n />\n );\n};\n\nconst ActionListItemIcon = assignWithoutSideEffects(_ActionListItemIcon, {\n componentId: componentIds.ActionListItemIcon,\n});\n\nconst _ActionListItemBadgeGroup = ({\n children,\n}: {\n children: React.ReactElement[] | React.ReactElement;\n}): React.ReactElement => {\n return (\n <Box display=\"flex\" alignItems=\"center\" flexDirection=\"row\">\n {children}\n </Box>\n );\n};\n\nconst ActionListItemBadgeGroup = assignWithoutSideEffects(_ActionListItemBadgeGroup, {\n componentId: componentIds.ActionListItemBadgeGroup,\n});\n\nconst _ActionListItemBadge = (props: BadgeProps): React.ReactElement => {\n return <Badge size=\"medium\" marginLeft=\"spacing.3\" {...props} />;\n};\n\nconst ActionListItemBadge = assignWithoutSideEffects(_ActionListItemBadge, {\n componentId: componentIds.ActionListItemBadge,\n});\n\nconst _ActionListItemText = ({\n children,\n}: {\n children: StringChildrenType;\n}): React.ReactElement => {\n const { isDisabled } = useBaseMenuItem();\n\n return (\n <Text variant=\"caption\" color={getNormalTextColor(isDisabled, { isMuted: true })}>\n {children}\n </Text>\n );\n};\n\nconst ActionListItemText = assignWithoutSideEffects(_ActionListItemText, {\n componentId: componentIds.ActionListItemText,\n});\n\ntype ClickHandlerType = (e: React.MouseEvent<HTMLButtonElement>) => void;\n\nconst makeActionListItemClickable = (\n clickHandler: ClickHandlerType,\n): { onPress?: (e: React.TouchEvent<TouchableOpacity>) => void; onClick?: ClickHandlerType } => {\n if (isReactNative()) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment, @typescript-eslint/prefer-ts-expect-error\n // @ts-ignore: ignoring ReactNative press type for the peace of mind\n return { onPress: clickHandler };\n }\n\n return {\n onClick: clickHandler,\n };\n};\n\n/**\n * ### ActionListItem\n *\n * Creates option inside `ActionList`.\n *\n * #### Usage\n *\n * ```jsx\n * <ActionList>\n * <ActionListItem\n * title=\"Home\"\n * value=\"home\"\n * leading={<ActionListItemIcon icon={HomeIcon} />}\n * trailing={<ActionListItemText>⌘ + S</ActionListItemText>}\n * />\n * </ActionList>\n * ```\n */\nconst _ActionListItem = (props: ActionListItemProps): React.ReactElement => {\n const {\n activeIndex,\n dropdownBaseId,\n onOptionClick,\n selectedIndices,\n setShouldIgnoreBlurAnimation,\n selectionType,\n dropdownTriggerer,\n isKeydownPressed,\n filteredValues,\n hasAutoCompleteInBottomSheetHeader,\n } = useDropdown();\n\n const hasAutoComplete =\n hasAutoCompleteInBottomSheetHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n\n const renderOnWebAs = props.href ? 'a' : 'button';\n\n /**\n * In SelectInput, returns the isSelected according to selected indexes in the state\n *\n * In Other Triggers (Menu Usecase), returns `props.isSelected` since passing the\n * isSelected prop explicitly is the only way to select item in menu\n */\n const getIsSelected = (): boolean | undefined => {\n if (dropdownTriggerer === dropdownComponentIds.triggers.SelectInput || hasAutoComplete) {\n if (typeof props._index === 'number') {\n return selectedIndices.includes(props._index);\n }\n\n return undefined;\n }\n\n return props.isSelected;\n };\n\n const isSelected = getIsSelected();\n\n React.useEffect(() => {\n validateActionListItemProps({\n leading: props.leading,\n trailing: props.trailing,\n titleSuffix: props.titleSuffix,\n });\n }, [props.leading, props.trailing, props.titleSuffix]);\n\n React.useEffect(() => {\n if (__DEV__) {\n if (\n dropdownTriggerer === dropdownComponentIds.triggers.SelectInput &&\n props.intent === 'negative'\n ) {\n throwBladeError({\n message:\n 'negative intent ActionListItem cannot be used inside Dropdown with SelectInput trigger',\n moduleName: 'ActionListItem',\n });\n }\n }\n }, [props.intent, dropdownTriggerer]);\n\n return (\n // We use this context to change the color of subcomponents like ActionListItemIcon, ActionListItemText, etc\n <BaseMenuItem\n isVisible={hasAutoComplete && filteredValues ? filteredValues.includes(props.value) : true}\n as={!isReactNative() ? renderOnWebAs : undefined}\n id={`${dropdownBaseId}-${props._index}`}\n tabIndex={-1}\n title={props.title}\n description={props.description}\n leading={\n selectionType === 'multiple' ? (\n <BaseBox\n pointerEvents=\"none\"\n // Adding aria-hidden because the listbox item in multiselect in itself explains the behaviour so announcing checkbox is unneccesary and just a nice UI tweak for us\n {...makeAccessible({\n hidden: true,\n })}\n >\n <Checkbox isChecked={isSelected} tabIndex={-1} isDisabled={props.isDisabled}>\n {/* \n Checkbox requires children. Didn't want to make it optional because its helpful for consumers\n But for this case in particular, we just want to use Text separately so that we can control spacing and color and keep it consistent with non-multiselect dropdowns\n */}\n {null}\n </Checkbox>\n </BaseBox>\n ) : (\n props.leading\n )\n }\n trailing={props.trailing}\n titleSuffix={props.titleSuffix}\n href={props.href}\n target={props.target}\n className={activeIndex === props._index ? 'active-focus' : ''}\n isSelected={isSelected}\n isDisabled={props.isDisabled}\n role={getActionListItemRole(dropdownTriggerer, props.href)}\n {...makeActionListItemClickable((e: React.MouseEvent<HTMLButtonElement>): void => {\n if (typeof props._index === 'number') {\n onOptionClick(e, props._index);\n props.onClick?.({ name: props.value, value: isSelected, event: castWebType(e) });\n }\n })}\n {...metaAttribute({ name: MetaConstants.ActionListItem, testID: props.testID })}\n onMouseDown={() => {\n // We want to keep focus on Dropdown's trigger while option is being clicked\n // So We set this flag that ignores the blur animation to avoid the flicker between focus out + focus in\n setShouldIgnoreBlurAnimation(true);\n }}\n onMouseUp={() => {\n // (Contd from above comment...) We set this flag back to false since blur of SelectInput is done calling by this time\n setShouldIgnoreBlurAnimation(false);\n }}\n data-value={props.value}\n data-index={props._index}\n selectionType={selectionType}\n color={props.intent}\n isKeydownPressed={isKeydownPressed}\n />\n );\n};\n\nconst ActionListItem = assignWithoutSideEffects(React.memo(_ActionListItem), {\n componentId: componentIds.ActionListItem,\n displayName: componentIds.ActionListItem,\n});\n\nexport type { ActionListItemProps, ActionListSectionProps };\nexport {\n ActionListItem,\n ActionListItemIcon,\n ActionListItemText,\n ActionListItemBadge,\n ActionListItemBadgeGroup,\n ActionListSection,\n};\n"],"names":["StyledActionListSectionTitle","styled","BaseBox","withConfig","displayName","componentId","props","padding","makeSize","theme","spacing","_ActionListSection","_ref","title","children","testID","_hideDivider","_sectionChildValues","_useDropdown","useDropdown","hasAutoCompleteInBottomSheetHeader","dropdownTriggerer","filteredValues","hasAutoComplete","dropdownComponentIds","triggers","AutoComplete","isSectionVisible","React","useMemo","visibleActionListItemInSection","find","actionItemValue","includes","Boolean","showDividerInRN","isReactNative","showDividerInAutoComplete","length","_jsxs","_objectSpread","makeAccessible","role","getActionListSectionRole","label","metaAttribute","name","MetaConstants","ActionListSection","_jsx","hidden","Text","color","size","weight","undefined","Divider","marginX","marginY","assignWithoutSideEffects","componentIds","_ActionListItemIcon","_ref2","icon","Icon","_useBaseMenuItem","useBaseMenuItem","isDisabled","iconState","concat","ActionListItemIcon","_ActionListItemBadgeGroup","_ref3","Box","display","alignItems","flexDirection","ActionListItemBadgeGroup","_ActionListItemBadge","Badge","marginLeft","ActionListItemBadge","_ActionListItemText","_ref4","_useBaseMenuItem2","variant","getNormalTextColor","isMuted","ActionListItemText","makeActionListItemClickable","clickHandler","onPress","onClick","_ActionListItem","_useDropdown2","activeIndex","dropdownBaseId","onOptionClick","selectedIndices","setShouldIgnoreBlurAnimation","selectionType","isKeydownPressed","renderOnWebAs","href","getIsSelected","SelectInput","_index","isSelected","useEffect","validateActionListItemProps","leading","trailing","titleSuffix","intent","throwBladeError","message","moduleName","BaseMenuItem","isVisible","value","as","id","tabIndex","description","pointerEvents","Checkbox","isChecked","target","className","getActionListItemRole","e","_props$onClick","call","event","castWebType","ActionListItem","onMouseDown","onMouseUp","memo"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwFA,IAAMA,4BAA4B,gBAAGC,MAAM,CAACC,OAAO,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,8CAAA;EAAAC,WAAA,EAAA,UAAA;AAAA,CAAA,CAAA,CAAC,UAACC,KAAK,EAAA;EAAA,OAAM;AAC/D;IACAC,OAAO,EAAEC,QAAQ,CAACF,KAAK,CAACG,KAAK,CAACC,OAAO,CAAC,CAAC,C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AA;AAC5B,CAAC;;;;"}
@@ -1,6 +1,6 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
2
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
3
- import 'react';
3
+ import React__default from 'react';
4
4
  import { StyledAvatar } from './StyledAvatar.js';
5
5
  import { useAvatarGroupContext } from './AvatarGroupContext.js';
6
6
  import { AvatarButton } from './AvatarButton.js';
@@ -17,7 +17,7 @@ import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
17
17
  import { getStyledProps } from '../Box/styledProps/getStyledProps.js';
18
18
  import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
19
19
 
20
- var _excluded = ["name", "color", "size", "variant", "icon", "href", "target", "rel", "src", "alt", "srcSet", "crossOrigin", "referrerPolicy", "testID"];
20
+ var _excluded = ["name", "color", "size", "variant", "icon", "href", "target", "rel", "src", "alt", "srcSet", "crossOrigin", "referrerPolicy", "testID", "onBlur", "onFocus", "onClick", "onMouseLeave", "onMouseMove", "onMouseDown", "onPointerDown", "onPointerEnter", "onTouchStart", "onTouchEnd"];
21
21
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
22
22
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
23
23
  var getInitials = function getInitials(name) {
@@ -28,7 +28,7 @@ var getInitials = function getInitials(name) {
28
28
  }
29
29
  return names[0][0] + names[names.length - 1][0];
30
30
  };
31
- var _Avatar = function _Avatar(_ref) {
31
+ var _Avatar = function _Avatar(_ref, ref) {
32
32
  var _groupProps$size;
33
33
  var name = _ref.name,
34
34
  _ref$color = _ref.color,
@@ -47,6 +47,16 @@ var _Avatar = function _Avatar(_ref) {
47
47
  crossOrigin = _ref.crossOrigin,
48
48
  referrerPolicy = _ref.referrerPolicy,
49
49
  testID = _ref.testID,
50
+ onBlur = _ref.onBlur,
51
+ onFocus = _ref.onFocus,
52
+ onClick = _ref.onClick,
53
+ onMouseLeave = _ref.onMouseLeave,
54
+ onMouseMove = _ref.onMouseMove,
55
+ onMouseDown = _ref.onMouseDown,
56
+ onPointerDown = _ref.onPointerDown,
57
+ onPointerEnter = _ref.onPointerEnter,
58
+ onTouchStart = _ref.onTouchStart,
59
+ onTouchEnd = _ref.onTouchEnd,
50
60
  styledProps = _objectWithoutProperties(_ref, _excluded);
51
61
  if (false) {
52
62
  if (src && !alt && !name) {
@@ -64,11 +74,22 @@ var _Avatar = function _Avatar(_ref) {
64
74
  size: avatarSize,
65
75
  href: href,
66
76
  target: target,
67
- rel: rel
77
+ rel: rel,
78
+ onBlur: onBlur,
79
+ onFocus: onFocus,
80
+ onClick: onClick,
81
+ onMouseLeave: onMouseLeave,
82
+ onMouseMove: onMouseMove,
83
+ onMouseDown: onMouseDown,
84
+ onPointerDown: onPointerDown,
85
+ onPointerEnter: onPointerEnter,
86
+ onTouchStart: onTouchStart,
87
+ onTouchEnd: onTouchEnd
68
88
  };
69
89
  var getChildrenToRender = function getChildrenToRender() {
70
90
  if (src) {
71
91
  return /*#__PURE__*/jsx(AvatarButton, _objectSpread(_objectSpread({}, commonButtonProps), {}, {
92
+ ref: ref,
72
93
  imgProps: {
73
94
  src: src,
74
95
  alt: alt !== null && alt !== void 0 ? alt : name,
@@ -79,7 +100,9 @@ var _Avatar = function _Avatar(_ref) {
79
100
  }));
80
101
  }
81
102
  if (name && !src) {
82
- return /*#__PURE__*/jsx(AvatarButton, _objectSpread(_objectSpread({}, commonButtonProps), {}, {
103
+ return /*#__PURE__*/jsx(AvatarButton, _objectSpread(_objectSpread({
104
+ ref: ref
105
+ }, commonButtonProps), {}, {
83
106
  children: getInitials(name)
84
107
  }));
85
108
  }
@@ -116,7 +139,7 @@ var _Avatar = function _Avatar(_ref) {
116
139
  * Checkout {@link https://blade.razorpay.com/?path=/docs/components-avatar-avatar Avatar Documentation}
117
140
  *
118
141
  */
119
- var Avatar = /*#__PURE__*/assignWithoutSideEffects(_Avatar, {
142
+ var Avatar = /*#__PURE__*/assignWithoutSideEffects( /*#__PURE__*/React__default.forwardRef(_Avatar), {
120
143
  displayName: 'Avatar',
121
144
  componentId: 'Avatar'
122
145
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Avatar.web.js","sources":["../../../../../../src/components/Avatar/Avatar.web.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport React from 'react';\nimport type { AvatarProps } from './types';\nimport { StyledAvatar } from './StyledAvatar';\nimport { useAvatarGroupContext } from './AvatarGroupContext';\nimport { AvatarButton } from './AvatarButton';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { throwBladeError } from '~utils/logger';\nimport { UserIcon } from '~components/Icons';\n\nconst getInitials = (name: string): string => {\n // Combine first and last name initials\n const names = name.trim().toUpperCase().split(' ');\n\n if (names.length === 1) {\n return names[0].substring(0, 2);\n }\n return names[0][0] + names[names.length - 1][0];\n};\n\nconst _Avatar = ({\n name,\n color = 'neutral',\n size = 'medium',\n variant = 'circle',\n icon,\n href,\n target,\n rel,\n // Image Props\n src,\n alt,\n srcSet,\n crossOrigin,\n referrerPolicy,\n testID,\n ...styledProps\n}: AvatarProps): ReactElement => {\n if (__DEV__) {\n if (src && !alt && !name) {\n throwBladeError({\n moduleName: 'Avatar',\n message: '\"alt\" or \"name\" prop is required when the \"src\" prop is provided.',\n });\n }\n }\n\n const groupProps = useAvatarGroupContext();\n const avatarSize = groupProps?.size ?? size;\n\n const commonButtonProps = {\n variant,\n color,\n size: avatarSize,\n href,\n target,\n rel,\n };\n\n const getChildrenToRender = (): React.ReactElement => {\n if (src) {\n return (\n <AvatarButton\n {...commonButtonProps}\n imgProps={{\n src,\n alt: alt ?? name,\n srcSet,\n crossOrigin,\n referrerPolicy,\n }}\n />\n );\n }\n\n if (name && !src) {\n return <AvatarButton {...commonButtonProps}>{getInitials(name)}</AvatarButton>;\n }\n\n return <AvatarButton {...commonButtonProps} icon={icon ?? UserIcon} />;\n };\n\n return (\n <StyledAvatar\n {...metaAttribute({ name: MetaConstants.Avatar, testID })}\n {...getStyledProps(styledProps)}\n backgroundColor=\"surface.background.gray.intense\"\n variant={variant}\n size={avatarSize}\n >\n {getChildrenToRender()}\n </StyledAvatar>\n );\n};\n\n/**\n * ### Avatar Component\n * \n * An avatar component is a standardized visual representation of a user or entity.\n * \n * ---\n * \n * #### Usage\n * \n * ```jsx\n <Avatar name=\"Nitin Kumar\" src=\"https://avatars.githubusercontent.com/u/46647141?v=4\" /> \n * ```\n *\n * ---\n *\n * Checkout {@link https://blade.razorpay.com/?path=/docs/components-avatar-avatar Avatar Documentation}\n * \n */\nconst Avatar = assignWithoutSideEffects(_Avatar, {\n displayName: 'Avatar',\n componentId: 'Avatar',\n});\n\nexport { Avatar };\nexport type { AvatarProps };\n"],"names":["getInitials","name","names","trim","toUpperCase","split","length","substring","_Avatar","_ref","_groupProps$size","_ref$color","color","_ref$size","size","_ref$variant","variant","icon","href","target","rel","src","alt","srcSet","crossOrigin","referrerPolicy","testID","styledProps","_objectWithoutProperties","_excluded","throwBladeError","moduleName","message","groupProps","useAvatarGroupContext","avatarSize","commonButtonProps","getChildrenToRender","_jsx","AvatarButton","_objectSpread","imgProps","children","UserIcon","StyledAvatar","metaAttribute","MetaConstants","Avatar","getStyledProps","backgroundColor","assignWithoutSideEffects","displayName","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMU,MAAM,gBAAGG,wBAAwB,CAAC1C,OAAO,EAAE;AAC/C2C,EAAAA,WAAW,EAAE,QAAQ;AACrBC,EAAAA,WAAW,EAAE,QAAA;AACf,CAAC;;;;"}
1
+ {"version":3,"file":"Avatar.web.js","sources":["../../../../../../src/components/Avatar/Avatar.web.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport React from 'react';\nimport type { AvatarProps } from './types';\nimport { StyledAvatar } from './StyledAvatar';\nimport { useAvatarGroupContext } from './AvatarGroupContext';\nimport { AvatarButton } from './AvatarButton';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { throwBladeError } from '~utils/logger';\nimport { UserIcon } from '~components/Icons';\nimport type { BladeElementRef } from '~utils/types';\n\nconst getInitials = (name: string): string => {\n // Combine first and last name initials\n const names = name.trim().toUpperCase().split(' ');\n\n if (names.length === 1) {\n return names[0].substring(0, 2);\n }\n return names[0][0] + names[names.length - 1][0];\n};\n\nconst _Avatar: React.ForwardRefRenderFunction<BladeElementRef, AvatarProps> = (\n {\n name,\n color = 'neutral',\n size = 'medium',\n variant = 'circle',\n icon,\n href,\n target,\n rel,\n // Image Props\n src,\n alt,\n srcSet,\n crossOrigin,\n referrerPolicy,\n testID,\n // interaction props\n onBlur,\n onFocus,\n onClick,\n onMouseLeave,\n onMouseMove,\n onMouseDown,\n onPointerDown,\n onPointerEnter,\n onTouchStart,\n onTouchEnd,\n ...styledProps\n },\n ref,\n): ReactElement => {\n if (__DEV__) {\n if (src && !alt && !name) {\n throwBladeError({\n moduleName: 'Avatar',\n message: '\"alt\" or \"name\" prop is required when the \"src\" prop is provided.',\n });\n }\n }\n\n const groupProps = useAvatarGroupContext();\n const avatarSize = groupProps?.size ?? size;\n\n const commonButtonProps = {\n variant,\n color,\n size: avatarSize,\n href,\n target,\n rel,\n onBlur,\n onFocus,\n onClick,\n onMouseLeave,\n onMouseMove,\n onMouseDown,\n onPointerDown,\n onPointerEnter,\n onTouchStart,\n onTouchEnd,\n };\n\n const getChildrenToRender = (): React.ReactElement => {\n if (src) {\n return (\n <AvatarButton\n {...commonButtonProps}\n ref={ref as never}\n imgProps={{\n src,\n alt: alt ?? name,\n srcSet,\n crossOrigin,\n referrerPolicy,\n }}\n />\n );\n }\n\n if (name && !src) {\n return (\n <AvatarButton ref={ref as never} {...commonButtonProps}>\n {getInitials(name)}\n </AvatarButton>\n );\n }\n\n return <AvatarButton {...commonButtonProps} icon={icon ?? UserIcon} />;\n };\n\n return (\n <StyledAvatar\n {...metaAttribute({ name: MetaConstants.Avatar, testID })}\n {...getStyledProps(styledProps)}\n backgroundColor=\"surface.background.gray.intense\"\n variant={variant}\n size={avatarSize}\n >\n {getChildrenToRender()}\n </StyledAvatar>\n );\n};\n\n/**\n * ### Avatar Component\n * \n * An avatar component is a standardized visual representation of a user or entity.\n * \n * ---\n * \n * #### Usage\n * \n * ```jsx\n <Avatar name=\"Nitin Kumar\" src=\"https://avatars.githubusercontent.com/u/46647141?v=4\" /> \n * ```\n *\n * ---\n *\n * Checkout {@link https://blade.razorpay.com/?path=/docs/components-avatar-avatar Avatar Documentation}\n * \n */\nconst Avatar = assignWithoutSideEffects(React.forwardRef(_Avatar), {\n displayName: 'Avatar',\n componentId: 'Avatar',\n});\n\nexport { Avatar };\nexport type { AvatarProps };\n"],"names":["getInitials","name","names","trim","toUpperCase","split","length","substring","_Avatar","_ref","ref","_groupProps$size","_ref$color","color","_ref$size","size","_ref$variant","variant","icon","href","target","rel","src","alt","srcSet","crossOrigin","referrerPolicy","testID","onBlur","onFocus","onClick","onMouseLeave","onMouseMove","onMouseDown","onPointerDown","onPointerEnter","onTouchStart","onTouchEnd","styledProps","_objectWithoutProperties","_excluded","throwBladeError","moduleName","message","groupProps","useAvatarGroupContext","avatarSize","commonButtonProps","getChildrenToRender","_jsx","AvatarButton","_objectSpread","imgProps","children","UserIcon","StyledAvatar","metaAttribute","MetaConstants","Avatar","getStyledProps","backgroundColor","assignWithoutSideEffects","React","forwardRef","displayName","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAaA,IAAMA,WAAW,GAAG,SAAdA,WAAWA,CAAIC,IAAY,EAAa;AAC5C;AACA,EAAA,IAAMC,KAAK,GAAGD,IAAI,CAACE,IAAI,EAAE,CAACC,WAAW,EAAE,CAACC,KAAK,CAAC,GAAG,CAAC,CAAA;AAElD,EAAA,IAAIH,KAAK,CAACI,MAAM,KAAK,CAAC,EAAE;IACtB,OAAOJ,KAAK,CAAC,CAAC,CAAC,CAACK,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AACjC,GAAA;AACA,EAAA,OAAOL,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAGA,KAAK,CAACA,KAAK,CAACI,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AACjD,CAAC,CAAA;AAED,IAAME,OAAqE,GAAG,SAAxEA,OAAqEA,CAAAC,IAAA,EA8BzEC,GAAG,EACc;AAAA,EAAA,IAAAC,gBAAA,CAAA;AAAA,EAAA,IA7BfV,IAAI,GAAAQ,IAAA,CAAJR,IAAI;IAAAW,UAAA,GAAAH,IAAA,CACJI,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAG,KAAA,CAAA,GAAA,SAAS,GAAAA,UAAA;IAAAE,SAAA,GAAAL,IAAA,CACjBM,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,QAAQ,GAAAA,SAAA;IAAAE,YAAA,GAAAP,IAAA,CACfQ,OAAO;AAAPA,IAAAA,OAAO,GAAAD,YAAA,KAAG,KAAA,CAAA,GAAA,QAAQ,GAAAA,YAAA;IAClBE,IAAI,GAAAT,IAAA,CAAJS,IAAI;IACJC,IAAI,GAAAV,IAAA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;;"}
@@ -1,5 +1,5 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
- import 'react';
2
+ import React__default from 'react';
3
3
  import { StyledAvatarButton } from './StyledAvatarButton.js';
4
4
  import { avatarIconSizeTokens, avatarTextSizeMapping } from './avatarTokens.js';
5
5
  import '../Box/BaseBox/index.js';
@@ -14,7 +14,7 @@ import { Text } from '../Typography/Text/Text.js';
14
14
 
15
15
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
16
16
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
17
- var AvatarButton = function AvatarButton(_ref) {
17
+ var _AvatarButton = function _AvatarButton(_ref, ref) {
18
18
  var href = _ref.href,
19
19
  target = _ref.target,
20
20
  rel = _ref.rel,
@@ -26,7 +26,17 @@ var AvatarButton = function AvatarButton(_ref) {
26
26
  size = _ref$size === void 0 ? 'medium' : _ref$size,
27
27
  Icon = _ref.icon,
28
28
  imgProps = _ref.imgProps,
29
- children = _ref.children;
29
+ children = _ref.children,
30
+ onBlur = _ref.onBlur,
31
+ onFocus = _ref.onFocus,
32
+ onClick = _ref.onClick,
33
+ onMouseLeave = _ref.onMouseLeave,
34
+ onMouseMove = _ref.onMouseMove,
35
+ onMouseDown = _ref.onMouseDown,
36
+ onPointerDown = _ref.onPointerDown,
37
+ onPointerEnter = _ref.onPointerEnter,
38
+ onTouchStart = _ref.onTouchStart,
39
+ onTouchEnd = _ref.onTouchEnd;
30
40
  var isLink = Boolean(href);
31
41
  var defaultRel = target === '_blank' ? 'noreferrer noopener' : undefined;
32
42
  var iconColor = getTextColorToken({
@@ -42,6 +52,7 @@ var AvatarButton = function AvatarButton(_ref) {
42
52
  state: 'default'
43
53
  });
44
54
  return /*#__PURE__*/jsx(StyledAvatarButton, {
55
+ ref: ref,
45
56
  as: href ? 'a' : 'button',
46
57
  size: size,
47
58
  color: color,
@@ -52,6 +63,16 @@ var AvatarButton = function AvatarButton(_ref) {
52
63
  accessibilityProps: _objectSpread({}, makeAccessible({
53
64
  role: isLink ? 'link' : 'button'
54
65
  })),
66
+ onBlur: onBlur,
67
+ onFocus: onFocus,
68
+ onClick: onClick,
69
+ onMouseLeave: onMouseLeave,
70
+ onMouseMove: onMouseMove,
71
+ onMouseDown: onMouseDown,
72
+ onPointerDown: onPointerDown,
73
+ onPointerEnter: onPointerEnter,
74
+ onTouchStart: onTouchStart,
75
+ onTouchEnd: onTouchEnd,
55
76
  children: /*#__PURE__*/jsxs(BaseBox, {
56
77
  display: "flex",
57
78
  flexDirection: "row",
@@ -81,6 +102,7 @@ var AvatarButton = function AvatarButton(_ref) {
81
102
  })
82
103
  });
83
104
  };
105
+ var AvatarButton = /*#__PURE__*/React__default.forwardRef(_AvatarButton);
84
106
 
85
107
  export { AvatarButton };
86
108
  //# sourceMappingURL=AvatarButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AvatarButton.js","sources":["../../../../../../src/components/Avatar/AvatarButton.tsx"],"sourcesContent":["import React from 'react';\nimport { StyledAvatarButton } from './StyledAvatarButton';\nimport type { AvatarButtonProps } from './types';\nimport { avatarTextSizeMapping, avatarIconSizeTokens } from './avatarTokens';\nimport BaseBox from '~components/Box/BaseBox';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { Heading, Text } from '~components/Typography';\nimport { getTextColorToken } from '~components/Button/BaseButton/BaseButton';\nimport type { IconColor } from '~components/Button/BaseButton/types';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\n\nconst AvatarButton = ({\n href,\n target,\n rel,\n variant = 'circle',\n color = 'neutral',\n size = 'medium',\n icon: Icon,\n imgProps,\n children,\n}: AvatarButtonProps): React.ReactElement => {\n const isLink = Boolean(href);\n const defaultRel = target === '_blank' ? 'noreferrer noopener' : undefined;\n const iconColor = getTextColorToken({\n property: 'icon',\n variant: 'secondary',\n color,\n state: 'default',\n }) as IconColor;\n const textColor = getTextColorToken({\n property: 'text',\n variant: 'secondary',\n color,\n state: 'default',\n }) as BaseTextProps['color'];\n\n return (\n <StyledAvatarButton\n as={href ? 'a' : 'button'}\n size={size}\n color={color}\n href={href}\n variant={variant}\n target={target}\n rel={rel ?? defaultRel}\n accessibilityProps={{\n ...makeAccessible({\n role: isLink ? 'link' : 'button',\n }),\n }}\n >\n <BaseBox\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n zIndex={1}\n height=\"100%\"\n >\n {Icon ? (\n <BaseBox display=\"flex\" justifyContent=\"center\" alignItems=\"center\">\n <Icon size={avatarIconSizeTokens[size]} color={iconColor} />\n </BaseBox>\n ) : null}\n\n {/* eslint-disable-next-line jsx-a11y/alt-text -- alt text is provided in imgProps */}\n {imgProps?.src ? <img {...imgProps} /> : null}\n\n {size === 'xlarge' ? (\n <Heading size={avatarTextSizeMapping[size]} weight=\"semibold\" color={textColor}>\n {children}\n </Heading>\n ) : (\n <Text size={avatarTextSizeMapping[size]} weight=\"semibold\" color={textColor}>\n {children}\n </Text>\n )}\n </BaseBox>\n </StyledAvatarButton>\n );\n};\n\nexport { AvatarButton };\n"],"names":["AvatarButton","_ref","href","target","rel","_ref$variant","variant","_ref$color","color","_ref$size","size","Icon","icon","imgProps","children","isLink","Boolean","defaultRel","undefined","iconColor","getTextColorToken","property","state","textColor","_jsx","StyledAvatarButton","as","accessibilityProps","_objectSpread","makeAccessible","role","_jsxs","BaseBox","display","flexDirection","alignItems","justifyContent","zIndex","height","avatarIconSizeTokens","src","Heading","avatarTextSize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aAAA,CAAA,EAAA,EAASf,QAAQ,CAAG,CAAC,GAAG,IAAI,EAE5CH,IAAI,KAAK,QAAQ,gBAChBc,GAAA,CAACiB,OAAO,EAAA;AAAC/B,QAAAA,IAAI,EAAEgC,qBAAqB,CAAChC,IAAI,CAAE;AAACiC,QAAAA,MAAM,EAAC,UAAU;AAACnC,QAAAA,KAAK,EAAEe,SAAU;AAAAT,QAAAA,QAAA,EAC5EA,QAAAA;AAAQ,OACF,CAAC,gBAEVU,GAAA,CAACoB,IAAI,EAAA;AAAClC,QAAAA,IAAI,EAAEgC,qBAAqB,CAAChC,IAAI,CAAE;AAACiC,QAAAA,MAAM,EAAC,UAAU;AAACnC,QAAAA,KAAK,EAAEe,SAAU;AAAAT,QAAAA,QAAA,EACzEA,QAAAA;AAAQ,OACL,CACP,CAAA;KACM,CAAA;AAAC,GACQ,CAAC,CAAA;AAEzB;;;;"}
1
+ {"version":3,"file":"AvatarButton.js","sources":["../../../../../../src/components/Avatar/AvatarButton.tsx"],"sourcesContent":["import React from 'react';\nimport { StyledAvatarButton } from './StyledAvatarButton';\nimport type { AvatarButtonProps } from './types';\nimport { avatarTextSizeMapping, avatarIconSizeTokens } from './avatarTokens';\nimport BaseBox from '~components/Box/BaseBox';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { Heading, Text } from '~components/Typography';\nimport { getTextColorToken } from '~components/Button/BaseButton/BaseButton';\nimport type { IconColor } from '~components/Button/BaseButton/types';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\nimport type { BladeElementRef } from '~utils/types';\n\nconst _AvatarButton: React.ForwardRefRenderFunction<BladeElementRef, AvatarButtonProps> = (\n {\n href,\n target,\n rel,\n variant = 'circle',\n color = 'neutral',\n size = 'medium',\n icon: Icon,\n imgProps,\n children,\n onBlur,\n onFocus,\n onClick,\n onMouseLeave,\n onMouseMove,\n onMouseDown,\n onPointerDown,\n onPointerEnter,\n onTouchStart,\n onTouchEnd,\n },\n ref,\n): React.ReactElement => {\n const isLink = Boolean(href);\n const defaultRel = target === '_blank' ? 'noreferrer noopener' : undefined;\n const iconColor = getTextColorToken({\n property: 'icon',\n variant: 'secondary',\n color,\n state: 'default',\n }) as IconColor;\n const textColor = getTextColorToken({\n property: 'text',\n variant: 'secondary',\n color,\n state: 'default',\n }) as BaseTextProps['color'];\n\n return (\n <StyledAvatarButton\n ref={ref as never}\n as={href ? 'a' : 'button'}\n size={size}\n color={color}\n href={href}\n variant={variant}\n target={target}\n rel={rel ?? defaultRel}\n accessibilityProps={{\n ...makeAccessible({\n role: isLink ? 'link' : 'button',\n }),\n }}\n onBlur={onBlur}\n onFocus={onFocus}\n onClick={onClick}\n onMouseLeave={onMouseLeave}\n onMouseMove={onMouseMove}\n onMouseDown={onMouseDown}\n onPointerDown={onPointerDown}\n onPointerEnter={onPointerEnter}\n onTouchStart={onTouchStart}\n onTouchEnd={onTouchEnd}\n >\n <BaseBox\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n zIndex={1}\n height=\"100%\"\n >\n {Icon ? (\n <BaseBox display=\"flex\" justifyContent=\"center\" alignItems=\"center\">\n <Icon size={avatarIconSizeTokens[size]} color={iconColor} />\n </BaseBox>\n ) : null}\n\n {/* eslint-disable-next-line jsx-a11y/alt-text -- alt text is provided in imgProps */}\n {imgProps?.src ? <img {...imgProps} /> : null}\n\n {size === 'xlarge' ? (\n <Heading size={avatarTextSizeMapping[size]} weight=\"semibold\" color={textColor}>\n {children}\n </Heading>\n ) : (\n <Text size={avatarTextSizeMapping[size]} weight=\"semibold\" color={textColor}>\n {children}\n </Text>\n )}\n </BaseBox>\n </StyledAvatarButton>\n );\n};\n\nconst AvatarButton = React.forwardRef(_AvatarButton);\n\nexport { AvatarButton };\n"],"names":["_AvatarButton","_ref","ref","href","target","rel","_ref$variant","variant","_ref$color","color","_ref$size","size","Icon","icon","imgProps","children","onBlur","onFocus","onClick","onMouseLeave","onMouseMove","onMouseDown","onPointerDown","onPointerEnter","onTouchStart","onTouchEnd","isLink","Boolean","defaultRel","undefined","iconColor","getTextColorToken","property","state","textColor","_jsx","StyledAvatarButton","as","accessibilityProps","_objectSpread","makeAccessible","role","_jsxs","BaseBox","display","flexDirection","alignItems","justifyContent","zIndex","height","avatarIconSizeTokens","src","Heading","avatarTextSizeMapping","weight","Text","AvatarButton","React","forwardRef"],"mappings":";;;;;;;;;;;;;;;;AAYA,IAAMA,aAAiF,GAAG,SAApFA,aAAiFA,CAAAC,IAAA,EAsBrFC,GAAG,EACoB;AAAA,EAAA,IArBrBC,IAAI,GAAAF,IAAA,CAAJE,IAAI;IACJC,MAAM,GAAAH,IAAA,CAANG,MAAM;IACNC,GAAG,GAAAJ,IAAA,CAAHI,GAAG;IAAAC,YAAA,GAAAL,IAAA,CACHM,OAAO;AAAPA,IAAAA,OAAO,GAAAD,YAAA,KAAG,KAAA,CAAA,GAAA,QAAQ,GAAAA,YAAA;IAAAE,UAAA,GAAAP,IAAA,CAClBQ,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAG,KAAA,CAAA,GAAA,SAAS,GAAAA,UAAA;IAAAE,SAAA,GAAAT,IAAA,CACjBU,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,QAAQ,GAAAA,SAAA;IACTE,IAAI,GAAAX,IAAA,CAAVY,IAAI;IACJC,QAAQ,GAAAb,IAAA,CAARa,QAAQ;IACRC,QAAQ,GAAAd,IAAA,CAARc,QAAQ;IACRC,MAAM,GAAAf,IAAA,CAANe,MAAM;IACNC,OAAO,GAAAhB,IAAA,CAAPgB,OAAO;IACPC,OAAO,GAAAjB,IAAA,CAAPiB,OAAO;IACPC,YAAY,GAAAlB,IAAA,CAAZkB,YAAY;IACZC,WAAW,GAAAnB,IAAA,CAAXmB,WAAW;IACXC,WAAW,GAAApB,IAAA,CAAXoB,WAAW;IACXC,aAAa,GAAArB,IAAA,CAAbqB,aAAa;IACbC,cAAc,GAAAtB,IAAA,CA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