@razorpay/blade 12.1.1 → 12.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lib/native/components/ActionList/ActionList.js +1 -1
- package/build/lib/native/components/ActionList/ActionList.js.map +1 -1
- package/build/lib/native/components/ActionList/ActionListBox.native.js +1 -1
- package/build/lib/native/components/ActionList/ActionListBox.native.js.map +1 -1
- package/build/lib/native/components/ActionList/ActionListItem.js +1 -1
- package/build/lib/native/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/native/components/ActionList/styles/getBaseListBoxWrapperStyles.js +2 -2
- package/build/lib/native/components/ActionList/styles/getBaseListBoxWrapperStyles.js.map +1 -1
- package/build/lib/native/components/BaseMenu/BaseMenuItem/BaseMenuItem.js +5 -7
- package/build/lib/native/components/BaseMenu/BaseMenuItem/BaseMenuItem.js.map +1 -1
- package/build/lib/native/components/BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js +2 -1
- package/build/lib/native/components/BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js.map +1 -1
- package/build/lib/native/components/BaseMenu/BaseMenuItem/tokens.js +8 -0
- package/build/lib/native/components/BaseMenu/BaseMenuItem/tokens.js.map +1 -0
- package/build/lib/web/development/components/ActionList/ActionList.js +6 -7
- package/build/lib/web/development/components/ActionList/ActionList.js.map +1 -1
- package/build/lib/web/development/components/ActionList/ActionListBox.web.js +114 -3
- package/build/lib/web/development/components/ActionList/ActionListBox.web.js.map +1 -1
- package/build/lib/web/development/components/ActionList/ActionListItem.js +57 -60
- package/build/lib/web/development/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/web/development/components/ActionList/styles/getBaseListBoxWrapperStyles.js +8 -4
- package/build/lib/web/development/components/ActionList/styles/getBaseListBoxWrapperStyles.js.map +1 -1
- package/build/lib/web/development/components/BaseMenu/BaseMenuItem/BaseMenuItem.js +6 -7
- package/build/lib/web/development/components/BaseMenu/BaseMenuItem/BaseMenuItem.js.map +1 -1
- package/build/lib/web/development/components/BaseMenu/BaseMenuItem/StyledMenuItemContainer.web.js +3 -2
- package/build/lib/web/development/components/BaseMenu/BaseMenuItem/StyledMenuItemContainer.web.js.map +1 -1
- package/build/lib/web/development/components/BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js +3 -2
- package/build/lib/web/development/components/BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js.map +1 -1
- package/build/lib/web/development/components/BaseMenu/BaseMenuItem/tokens.js +26 -0
- package/build/lib/web/development/components/BaseMenu/BaseMenuItem/tokens.js.map +1 -0
- package/build/lib/web/development/components/DatePicker/Calendar.web.js +4 -2
- package/build/lib/web/development/components/DatePicker/Calendar.web.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/CalendarHeader.web.js +45 -31
- package/build/lib/web/development/components/DatePicker/CalendarHeader.web.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/DateInput.web.js +6 -5
- package/build/lib/web/development/components/DatePicker/DateInput.web.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/DatePicker.web.js +32 -2
- package/build/lib/web/development/components/DatePicker/DatePicker.web.js.map +1 -1
- package/build/lib/web/production/components/ActionList/ActionList.js +6 -7
- package/build/lib/web/production/components/ActionList/ActionList.js.map +1 -1
- package/build/lib/web/production/components/ActionList/ActionListBox.web.js +114 -3
- package/build/lib/web/production/components/ActionList/ActionListBox.web.js.map +1 -1
- package/build/lib/web/production/components/ActionList/ActionListItem.js +57 -60
- package/build/lib/web/production/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/web/production/components/ActionList/styles/getBaseListBoxWrapperStyles.js +8 -4
- package/build/lib/web/production/components/ActionList/styles/getBaseListBoxWrapperStyles.js.map +1 -1
- package/build/lib/web/production/components/BaseMenu/BaseMenuItem/BaseMenuItem.js +6 -7
- package/build/lib/web/production/components/BaseMenu/BaseMenuItem/BaseMenuItem.js.map +1 -1
- package/build/lib/web/production/components/BaseMenu/BaseMenuItem/StyledMenuItemContainer.web.js +3 -2
- package/build/lib/web/production/components/BaseMenu/BaseMenuItem/StyledMenuItemContainer.web.js.map +1 -1
- package/build/lib/web/production/components/BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js +3 -2
- package/build/lib/web/production/components/BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js.map +1 -1
- package/build/lib/web/production/components/BaseMenu/BaseMenuItem/tokens.js +26 -0
- package/build/lib/web/production/components/BaseMenu/BaseMenuItem/tokens.js.map +1 -0
- package/build/lib/web/production/components/DatePicker/Calendar.web.js +4 -2
- package/build/lib/web/production/components/DatePicker/Calendar.web.js.map +1 -1
- package/build/lib/web/production/components/DatePicker/CalendarHeader.web.js +45 -31
- package/build/lib/web/production/components/DatePicker/CalendarHeader.web.js.map +1 -1
- package/build/lib/web/production/components/DatePicker/DateInput.web.js +6 -5
- package/build/lib/web/production/components/DatePicker/DateInput.web.js.map +1 -1
- package/build/lib/web/production/components/DatePicker/DatePicker.web.js +32 -2
- package/build/lib/web/production/components/DatePicker/DatePicker.web.js.map +1 -1
- package/build/types/components/index.d.ts +15 -2
- package/build/types/components/index.native.d.ts +12 -1
- package/package.json +4 -2
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
3
|
import React__default from 'react';
|
|
4
|
+
import { FixedSizeList } from 'react-window';
|
|
4
5
|
import { StyledListBoxWrapper } from './styles/StyledListBoxWrapper.web.js';
|
|
6
|
+
import { getActionListPadding, actionListMaxHeight } from './styles/getBaseListBoxWrapperStyles.js';
|
|
5
7
|
import { useBottomSheetContext } from '../BottomSheet/BottomSheetContext.js';
|
|
6
8
|
import '../../utils/assignWithoutSideEffects/index.js';
|
|
7
9
|
import '../../utils/makeAccessible/index.js';
|
|
8
10
|
import '../../utils/makeAnalyticsAttribute/index.js';
|
|
11
|
+
import { useIsMobile } from '../../utils/useIsMobile.js';
|
|
12
|
+
import { getItemHeight } from '../BaseMenu/BaseMenuItem/tokens.js';
|
|
13
|
+
import '../../utils/index.js';
|
|
14
|
+
import { useDropdown } from '../Dropdown/useDropdown.js';
|
|
15
|
+
import { dropdownComponentIds } from '../Dropdown/dropdownComponentIds.js';
|
|
9
16
|
import { jsx } from 'react/jsx-runtime';
|
|
10
17
|
import { makeAccessible } from '../../utils/makeAccessible/makeAccessible.web.js';
|
|
11
18
|
import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
|
|
12
19
|
import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
|
|
20
|
+
import useTheme from '../BladeProvider/useTheme.js';
|
|
13
21
|
|
|
14
|
-
var _excluded = ["childrenWithId", "actionListItemWrapperRole", "isMultiSelectable"]
|
|
22
|
+
var _excluded = ["childrenWithId", "actionListItemWrapperRole", "isMultiSelectable"],
|
|
23
|
+
_excluded2 = ["childrenWithId", "actionListItemWrapperRole", "isMultiSelectable"];
|
|
15
24
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
25
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
26
|
var _ActionListBox = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
@@ -31,9 +40,111 @@ var _ActionListBox = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
|
31
40
|
children: childrenWithId
|
|
32
41
|
}));
|
|
33
42
|
});
|
|
34
|
-
var ActionListBox = /*#__PURE__*/assignWithoutSideEffects(_ActionListBox, {
|
|
43
|
+
var ActionListBox = /*#__PURE__*/assignWithoutSideEffects( /*#__PURE__*/React__default.memo(_ActionListBox), {
|
|
35
44
|
displayName: 'ActionListBox'
|
|
36
45
|
});
|
|
37
46
|
|
|
38
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Returns the height of item and height of container based on theme and device
|
|
49
|
+
*/
|
|
50
|
+
var getVirtualItemParams = function getVirtualItemParams(_ref2) {
|
|
51
|
+
var theme = _ref2.theme,
|
|
52
|
+
isMobile = _ref2.isMobile;
|
|
53
|
+
var itemHeightResponsive = getItemHeight(theme);
|
|
54
|
+
var actionListPadding = getActionListPadding(theme);
|
|
55
|
+
var actionListBoxHeight = actionListMaxHeight - actionListPadding * 2;
|
|
56
|
+
return {
|
|
57
|
+
itemHeight: isMobile ? itemHeightResponsive.itemHeightMobile : itemHeightResponsive.itemHeightDesktop,
|
|
58
|
+
actionListBoxHeight: actionListBoxHeight
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Takes the children (ActionListItem) and returns the filtered items based on `filteredValues` state
|
|
64
|
+
*/
|
|
65
|
+
var useFilteredItems = function useFilteredItems(children) {
|
|
66
|
+
var childrenArray = React__default.Children.toArray(children); // Convert children to an array
|
|
67
|
+
|
|
68
|
+
var _useDropdown = useDropdown(),
|
|
69
|
+
filteredValues = _useDropdown.filteredValues,
|
|
70
|
+
hasAutoCompleteInBottomSheetHeader = _useDropdown.hasAutoCompleteInBottomSheetHeader,
|
|
71
|
+
dropdownTriggerer = _useDropdown.dropdownTriggerer;
|
|
72
|
+
var items = React__default.useMemo(function () {
|
|
73
|
+
var hasAutoComplete = hasAutoCompleteInBottomSheetHeader || dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;
|
|
74
|
+
if (!hasAutoComplete) {
|
|
75
|
+
return childrenArray;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// @ts-expect-error: props does exist
|
|
79
|
+
var filteredItems = childrenArray.filter(function (item) {
|
|
80
|
+
return filteredValues.includes(item.props.value);
|
|
81
|
+
});
|
|
82
|
+
return filteredItems;
|
|
83
|
+
}, [filteredValues, hasAutoCompleteInBottomSheetHeader, dropdownTriggerer, childrenArray]);
|
|
84
|
+
return {
|
|
85
|
+
itemData: items,
|
|
86
|
+
itemCount: items.length
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
var VirtualListItem = function VirtualListItem(_ref3) {
|
|
90
|
+
var index = _ref3.index,
|
|
91
|
+
style = _ref3.style,
|
|
92
|
+
data = _ref3.data;
|
|
93
|
+
return /*#__PURE__*/jsx("div", {
|
|
94
|
+
style: style,
|
|
95
|
+
children: data[index]
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
var _ActionListVirtualizedBox = /*#__PURE__*/React__default.forwardRef(function (_ref4, ref) {
|
|
99
|
+
var childrenWithId = _ref4.childrenWithId,
|
|
100
|
+
actionListItemWrapperRole = _ref4.actionListItemWrapperRole,
|
|
101
|
+
isMultiSelectable = _ref4.isMultiSelectable,
|
|
102
|
+
rest = _objectWithoutProperties(_ref4, _excluded2);
|
|
103
|
+
var items = React__default.Children.toArray(childrenWithId); // Convert children to an array
|
|
104
|
+
var _useBottomSheetContex2 = useBottomSheetContext(),
|
|
105
|
+
isInBottomSheet = _useBottomSheetContex2.isInBottomSheet;
|
|
106
|
+
var _useFilteredItems = useFilteredItems(items),
|
|
107
|
+
itemData = _useFilteredItems.itemData,
|
|
108
|
+
itemCount = _useFilteredItems.itemCount;
|
|
109
|
+
var isMobile = useIsMobile();
|
|
110
|
+
var _useTheme = useTheme(),
|
|
111
|
+
theme = _useTheme.theme;
|
|
112
|
+
var _React$useMemo = React__default.useMemo(function () {
|
|
113
|
+
return getVirtualItemParams({
|
|
114
|
+
theme: theme,
|
|
115
|
+
isMobile: isMobile
|
|
116
|
+
});
|
|
117
|
+
},
|
|
118
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
119
|
+
[theme.name, isMobile]),
|
|
120
|
+
itemHeight = _React$useMemo.itemHeight,
|
|
121
|
+
actionListBoxHeight = _React$useMemo.actionListBoxHeight;
|
|
122
|
+
return /*#__PURE__*/jsx(StyledListBoxWrapper, _objectSpread(_objectSpread(_objectSpread({
|
|
123
|
+
isInBottomSheet: isInBottomSheet,
|
|
124
|
+
ref: ref
|
|
125
|
+
}, makeAccessible({
|
|
126
|
+
role: actionListItemWrapperRole,
|
|
127
|
+
multiSelectable: actionListItemWrapperRole === 'listbox' ? isMultiSelectable : undefined
|
|
128
|
+
})), makeAnalyticsAttribute(rest)), {}, {
|
|
129
|
+
children: itemCount < 10 ? childrenWithId : /*#__PURE__*/jsx(FixedSizeList, {
|
|
130
|
+
height: actionListBoxHeight,
|
|
131
|
+
width: "100%",
|
|
132
|
+
itemSize: itemHeight,
|
|
133
|
+
itemCount: itemCount,
|
|
134
|
+
itemData: itemData
|
|
135
|
+
// @ts-expect-error: props does exist
|
|
136
|
+
,
|
|
137
|
+
itemKey: function itemKey(index) {
|
|
138
|
+
var _itemData$index;
|
|
139
|
+
return (_itemData$index = itemData[index]) === null || _itemData$index === void 0 ? void 0 : _itemData$index.props.value;
|
|
140
|
+
},
|
|
141
|
+
children: VirtualListItem
|
|
142
|
+
})
|
|
143
|
+
}));
|
|
144
|
+
});
|
|
145
|
+
var ActionListVirtualizedBox = /*#__PURE__*/assignWithoutSideEffects( /*#__PURE__*/React__default.memo(_ActionListVirtualizedBox), {
|
|
146
|
+
displayName: 'ActionListVirtualizedBox'
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
export { ActionListBox, ActionListVirtualizedBox };
|
|
39
150
|
//# sourceMappingURL=ActionListBox.web.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionListBox.web.js","sources":["../../../../../../src/components/ActionList/ActionListBox.web.tsx"],"sourcesContent":["/* eslint-disable react/display-name */\nimport React from 'react';\nimport { StyledListBoxWrapper } from './styles/StyledListBoxWrapper';\nimport type { SectionData } from './actionListUtils';\nimport { useBottomSheetContext } from '~components/BottomSheet/BottomSheetContext';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport type { DataAnalyticsAttribute } from '~utils/types';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype ActionListBoxProps = {\n childrenWithId?: React.ReactNode[] | null;\n sectionData: SectionData;\n actionListItemWrapperRole: 'listbox' | 'menu' | undefined;\n isMultiSelectable: boolean;\n isInBottomSheet: boolean;\n} & DataAnalyticsAttribute;\n\nconst _ActionListBox = React.forwardRef<HTMLDivElement, ActionListBoxProps>(\n ({ childrenWithId, actionListItemWrapperRole, isMultiSelectable, ...rest }, ref) => {\n const { isInBottomSheet } = useBottomSheetContext();\n\n return (\n <StyledListBoxWrapper\n isInBottomSheet={isInBottomSheet}\n ref={ref}\n {...makeAccessible({\n role: actionListItemWrapperRole,\n multiSelectable: actionListItemWrapperRole === 'listbox' ? isMultiSelectable : undefined,\n })}\n {...makeAnalyticsAttribute(rest)}\n >\n {childrenWithId}\n </StyledListBoxWrapper>\n );\n },\n);\n\nconst ActionListBox = assignWithoutSideEffects(_ActionListBox, { displayName: 'ActionListBox' });\n\nexport { ActionListBox };\n"],"names":["_ActionListBox","React","forwardRef","_ref","ref","childrenWithId","actionListItemWrapperRole","isMultiSelectable","rest","_objectWithoutProperties","_excluded","_useBottomSheetContex","useBottomSheetContext","isInBottomSheet","_jsx","StyledListBoxWrapper","_objectSpread","makeAccessible","role","multiSelectable","undefined","makeAnalyticsAttribute","children","ActionListBox","assignWithoutSideEffects","displayName"],"mappings":";;;;;;;;;;;;;;;;AAkBA,IAAMA,cAAc,gBAAGC,cAAK,CAACC,UAAU,CACrC,UAAAC,IAAA,EAA4EC,GAAG,EAAK;AAAA,EAAA,IAAjFC,cAAc,GAAAF,IAAA,CAAdE,cAAc;IAAEC,yBAAyB,GAAAH,IAAA,CAAzBG,yBAAyB;IAAEC,iBAAiB,GAAAJ,IAAA,CAAjBI,iBAAiB;AAAKC,IAAAA,IAAI,GAAAC,wBAAA,CAAAN,IAAA,EAAAO,SAAA,CAAA,CAAA;AACtE,EAAA,IAAAC,qBAAA,GAA4BC,qBAAqB,EAAE;IAA3CC,eAAe,GAAAF,qBAAA,CAAfE,eAAe,CAAA;EAEvB,oBACEC,GAAA,CAACC,oBAAoB,EAAAC,aAAA,CAAAA,aAAA,CAAAA,aAAA,CAAA;AACnBH,IAAAA,eAAe,EAAEA,eAAgB;AACjCT,IAAAA,GAAG,EAAEA,GAAAA;AAAI,GAAA,EACLa,cAAc,CAAC;AACjBC,IAAAA,IAAI,EAAEZ,yBAAyB;AAC/Ba,IAAAA,eAAe,EAAEb,yBAAyB,KAAK,SAAS,GAAGC,iBAAiB,GAAGa,SAAAA;AACjF,GAAC,CAAC,CAAA,EACEC,sBAAsB,CAACb,IAAI,CAAC,CAAA,EAAA,EAAA,EAAA;AAAAc,IAAAA,QAAA,EAE/BjB,cAAAA;AAAc,GAAA,CACK,CAAC,CAAA;AAE3B,CACF,CAAC,CAAA;AAED,IAAMkB,aAAa,gBAAGC,wBAAwB,CAACxB,cAAc,EAAE;AAAEyB,EAAAA,WAAW,EAAE,eAAA;AAAgB,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"ActionListBox.web.js","sources":["../../../../../../src/components/ActionList/ActionListBox.web.tsx"],"sourcesContent":["/* eslint-disable react/display-name */\nimport React from 'react';\nimport { FixedSizeList as VirtualizedList } from 'react-window';\nimport { StyledListBoxWrapper } from './styles/StyledListBoxWrapper';\nimport type { SectionData } from './actionListUtils';\nimport { actionListMaxHeight, getActionListPadding } from './styles/getBaseListBoxWrapperStyles';\nimport { useBottomSheetContext } from '~components/BottomSheet/BottomSheetContext';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport type { DataAnalyticsAttribute } from '~utils/types';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport { useIsMobile } from '~utils/useIsMobile';\nimport { getItemHeight } from '~components/BaseMenu/BaseMenuItem/tokens';\nimport { useTheme } from '~utils';\nimport type { Theme } from '~components/BladeProvider';\nimport { useDropdown } from '~components/Dropdown/useDropdown';\nimport { dropdownComponentIds } from '~components/Dropdown/dropdownComponentIds';\n\ntype ActionListBoxProps = {\n childrenWithId?: React.ReactNode[] | null;\n sectionData: SectionData;\n actionListItemWrapperRole: 'listbox' | 'menu' | undefined;\n isMultiSelectable: boolean;\n isInBottomSheet: boolean;\n} & DataAnalyticsAttribute;\n\nconst _ActionListBox = React.forwardRef<HTMLDivElement, ActionListBoxProps>(\n ({ childrenWithId, actionListItemWrapperRole, isMultiSelectable, ...rest }, ref) => {\n const { isInBottomSheet } = useBottomSheetContext();\n\n return (\n <StyledListBoxWrapper\n isInBottomSheet={isInBottomSheet}\n ref={ref}\n {...makeAccessible({\n role: actionListItemWrapperRole,\n multiSelectable: actionListItemWrapperRole === 'listbox' ? isMultiSelectable : undefined,\n })}\n {...makeAnalyticsAttribute(rest)}\n >\n {childrenWithId}\n </StyledListBoxWrapper>\n );\n },\n);\n\nconst ActionListBox = assignWithoutSideEffects(React.memo(_ActionListBox), {\n displayName: 'ActionListBox',\n});\n\n/**\n * Returns the height of item and height of container based on theme and device\n */\nconst getVirtualItemParams = ({\n theme,\n isMobile,\n}: {\n theme: Theme;\n isMobile: boolean;\n}): {\n itemHeight: number;\n actionListBoxHeight: number;\n} => {\n const itemHeightResponsive = getItemHeight(theme);\n const actionListPadding = getActionListPadding(theme);\n const actionListBoxHeight = actionListMaxHeight - actionListPadding * 2;\n\n return {\n itemHeight: isMobile\n ? itemHeightResponsive.itemHeightMobile\n : itemHeightResponsive.itemHeightDesktop,\n actionListBoxHeight,\n };\n};\n\n/**\n * Takes the children (ActionListItem) and returns the filtered items based on `filteredValues` state\n */\nconst useFilteredItems = (\n children: React.ReactNode[],\n): {\n itemData: React.ReactNode[];\n itemCount: number;\n} => {\n const childrenArray = React.Children.toArray(children); // Convert children to an array\n\n const { filteredValues, hasAutoCompleteInBottomSheetHeader, dropdownTriggerer } = useDropdown();\n\n const items = React.useMemo(() => {\n const hasAutoComplete =\n hasAutoCompleteInBottomSheetHeader ||\n dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;\n\n if (!hasAutoComplete) {\n return childrenArray;\n }\n\n // @ts-expect-error: props does exist\n const filteredItems = childrenArray.filter((item) => filteredValues.includes(item.props.value));\n return filteredItems;\n }, [filteredValues, hasAutoCompleteInBottomSheetHeader, dropdownTriggerer, childrenArray]);\n\n return {\n itemData: items,\n itemCount: items.length,\n };\n};\n\nconst VirtualListItem = ({\n index,\n style,\n data,\n}: {\n index: number;\n style: React.CSSProperties;\n data: React.ReactNode[];\n}): React.ReactElement => {\n return <div style={style}>{data[index]}</div>;\n};\n\nconst _ActionListVirtualizedBox = React.forwardRef<HTMLDivElement, ActionListBoxProps>(\n ({ childrenWithId, actionListItemWrapperRole, isMultiSelectable, ...rest }, ref) => {\n const items = React.Children.toArray(childrenWithId); // Convert children to an array\n const { isInBottomSheet } = useBottomSheetContext();\n const { itemData, itemCount } = useFilteredItems(items);\n\n const isMobile = useIsMobile();\n const { theme } = useTheme();\n const { itemHeight, actionListBoxHeight } = React.useMemo(\n () => getVirtualItemParams({ theme, isMobile }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [theme.name, isMobile],\n );\n\n return (\n <StyledListBoxWrapper\n isInBottomSheet={isInBottomSheet}\n ref={ref}\n {...makeAccessible({\n role: actionListItemWrapperRole,\n multiSelectable: actionListItemWrapperRole === 'listbox' ? isMultiSelectable : undefined,\n })}\n {...makeAnalyticsAttribute(rest)}\n >\n {itemCount < 10 ? (\n childrenWithId\n ) : (\n <VirtualizedList\n height={actionListBoxHeight}\n width=\"100%\"\n itemSize={itemHeight}\n itemCount={itemCount}\n itemData={itemData}\n // @ts-expect-error: props does exist\n itemKey={(index) => itemData[index]?.props.value}\n >\n {VirtualListItem}\n </VirtualizedList>\n )}\n </StyledListBoxWrapper>\n );\n },\n);\n\nconst ActionListVirtualizedBox = assignWithoutSideEffects(React.memo(_ActionListVirtualizedBox), {\n displayName: 'ActionListVirtualizedBox',\n});\n\nexport { ActionListBox, ActionListVirtualizedBox };\n"],"names":["_ActionListBox","React","forwardRef","_ref","ref","childrenWithId","actionListItemWrapperRole","isMultiSelectable","rest","_objectWithoutProperties","_excluded","_useBottomSheetContex","useBottomSheetContext","isInBottomSheet","_jsx","StyledListBoxWrapper","_objectSpread","makeAccessible","role","multiSelectable","undefined","makeAnalyticsAttribute","children","ActionListBox","assignWithoutSideEffects","memo","displayName","getVirtualItemParams","_ref2","theme","isMobile","itemHeightResponsive","getItemHeight","actionListPadding","getActionListPadding","actionListBoxHeight","actionListMaxHeight","itemHeight","itemHeightMobile","itemHeightDesktop","useFilteredItems","childrenArray","Children","toArray","_useDropdown","useDropdown","filteredValues","hasAutoCompleteInBottomSheetHeader","dropdownTriggerer","items","useMemo","hasAutoComplete","dropdownComponentIds","triggers","AutoComplete","filteredItems","filter","item","includes","props","value","itemData","itemCount","length","VirtualListItem","_ref3","index","style","data","_ActionListVirtualizedBox","_ref4","_excluded2","_useBottomSheetContex2","_useFilteredItems","useIsMobile","_useTheme","useTheme","_React$useMemo","name","VirtualizedList","height","width","itemSize","itemKey","_itemData$index","ActionListVirtualizedBox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,IAAMA,cAAc,gBAAGC,cAAK,CAACC,UAAU,CACrC,UAAAC,IAAA,EAA4EC,GAAG,EAAK;AAAA,EAAA,IAAjFC,cAAc,GAAAF,IAAA,CAAdE,cAAc;IAAEC,yBAAyB,GAAAH,IAAA,CAAzBG,yBAAyB;IAAEC,iBAAiB,GAAAJ,IAAA,CAAjBI,iBAAiB;AAAKC,IAAAA,IAAI,GAAAC,wBAAA,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wBAAwB,eAACvB,cAAK,CAACwB,IAAI,CAAC4C,yBAAyB,CAAC,EAAE;AAC/F3C,EAAAA,WAAW,EAAE,0BAAA;AACf,CAAC;;;;"}
|
|
@@ -246,67 +246,64 @@ var _ActionListItem = function _ActionListItem(props) {
|
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
}, [props.intent, dropdownTriggerer]);
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}, makeAccessible({
|
|
263
|
-
hidden: true
|
|
264
|
-
})), {}, {
|
|
265
|
-
children: /*#__PURE__*/jsx(Checkbox, {
|
|
266
|
-
isChecked: isSelected,
|
|
267
|
-
tabIndex: -1,
|
|
268
|
-
isDisabled: props.isDisabled,
|
|
269
|
-
children: null
|
|
270
|
-
})
|
|
271
|
-
})) : props.leading,
|
|
272
|
-
trailing: props.trailing,
|
|
273
|
-
titleSuffix: props.titleSuffix,
|
|
274
|
-
href: props.href,
|
|
275
|
-
target: props.target,
|
|
276
|
-
className: activeIndex === props._index ? 'active-focus' : '',
|
|
277
|
-
isSelected: isSelected,
|
|
278
|
-
isDisabled: props.isDisabled,
|
|
279
|
-
role: getActionListItemRole(dropdownTriggerer, props.href)
|
|
280
|
-
}, makeActionListItemClickable(function (e) {
|
|
281
|
-
if (typeof props._index === 'number') {
|
|
282
|
-
var _props$onClick;
|
|
283
|
-
onOptionClick(e, props._index);
|
|
284
|
-
(_props$onClick = props.onClick) === null || _props$onClick === void 0 ? void 0 : _props$onClick.call(props, {
|
|
285
|
-
name: props.value,
|
|
286
|
-
value: isSelected,
|
|
287
|
-
event: castWebType(e)
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
})), makeAnalyticsAttribute(_objectSpread({}, props))), metaAttribute({
|
|
291
|
-
name: MetaConstants.ActionListItem,
|
|
292
|
-
testID: props.testID
|
|
249
|
+
var isVisible = hasAutoComplete && filteredValues ? filteredValues.includes(props.value) : true;
|
|
250
|
+
return /*#__PURE__*/jsx(BaseMenuItem, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
251
|
+
isVisible: isVisible,
|
|
252
|
+
as: !isReactNative() ? renderOnWebAs : undefined,
|
|
253
|
+
id: "".concat(dropdownBaseId, "-").concat(props._index),
|
|
254
|
+
tabIndex: -1,
|
|
255
|
+
title: props.title,
|
|
256
|
+
description: props.description,
|
|
257
|
+
leading: selectionType === 'multiple' ? /*#__PURE__*/jsx(BaseBox, _objectSpread(_objectSpread({
|
|
258
|
+
pointerEvents: "none"
|
|
259
|
+
// 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
|
|
260
|
+
}, makeAccessible({
|
|
261
|
+
hidden: true
|
|
293
262
|
})), {}, {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
)
|
|
263
|
+
children: /*#__PURE__*/jsx(Checkbox, {
|
|
264
|
+
isChecked: isSelected,
|
|
265
|
+
tabIndex: -1,
|
|
266
|
+
isDisabled: props.isDisabled,
|
|
267
|
+
children: null
|
|
268
|
+
})
|
|
269
|
+
})) : props.leading,
|
|
270
|
+
trailing: props.trailing,
|
|
271
|
+
titleSuffix: props.titleSuffix,
|
|
272
|
+
href: props.href,
|
|
273
|
+
target: props.target,
|
|
274
|
+
className: activeIndex === props._index ? 'active-focus' : '',
|
|
275
|
+
isSelected: isSelected,
|
|
276
|
+
isDisabled: props.isDisabled,
|
|
277
|
+
role: getActionListItemRole(dropdownTriggerer, props.href)
|
|
278
|
+
}, makeActionListItemClickable(function (e) {
|
|
279
|
+
if (typeof props._index === 'number') {
|
|
280
|
+
var _props$onClick;
|
|
281
|
+
onOptionClick(e, props._index);
|
|
282
|
+
(_props$onClick = props.onClick) === null || _props$onClick === void 0 ? void 0 : _props$onClick.call(props, {
|
|
283
|
+
name: props.value,
|
|
284
|
+
value: isSelected,
|
|
285
|
+
event: castWebType(e)
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
})), makeAnalyticsAttribute(_objectSpread({}, props))), metaAttribute({
|
|
289
|
+
name: MetaConstants.ActionListItem,
|
|
290
|
+
testID: props.testID
|
|
291
|
+
})), {}, {
|
|
292
|
+
onMouseDown: function onMouseDown() {
|
|
293
|
+
// We want to keep focus on Dropdown's trigger while option is being clicked
|
|
294
|
+
// So We set this flag that ignores the blur animation to avoid the flicker between focus out + focus in
|
|
295
|
+
setShouldIgnoreBlurAnimation(true);
|
|
296
|
+
},
|
|
297
|
+
onMouseUp: function onMouseUp() {
|
|
298
|
+
// (Contd from above comment...) We set this flag back to false since blur of SelectInput is done calling by this time
|
|
299
|
+
setShouldIgnoreBlurAnimation(false);
|
|
300
|
+
},
|
|
301
|
+
"data-value": props.value,
|
|
302
|
+
"data-index": props._index,
|
|
303
|
+
selectionType: selectionType,
|
|
304
|
+
color: props.intent,
|
|
305
|
+
isKeydownPressed: isKeydownPressed
|
|
306
|
+
}));
|
|
310
307
|
};
|
|
311
308
|
var ActionListItem = /*#__PURE__*/assignWithoutSideEffects( /*#__PURE__*/React__default.memo(_ActionListItem), {
|
|
312
309
|
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 { 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 { DataAnalyticsAttribute, 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';\nimport type { AvatarProps } from '~components/Avatar/types';\nimport { Avatar } from '~components/Avatar';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\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 DataAnalyticsAttribute;\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 &\n DataAnalyticsAttribute;\nconst _ActionListSection = ({\n title,\n children,\n testID,\n _hideDivider,\n _sectionChildValues,\n ...rest\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 {...makeAnalyticsAttribute(rest as Record<string, unknown>)}\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 _ActionListItemAvatar = (avatarProps: Omit<AvatarProps, 'size' | ''>): React.ReactElement => {\n return <Avatar size=\"xsmall\" {...avatarProps} />;\n};\n\nconst ActionListItemAvatar = assignWithoutSideEffects(_ActionListItemAvatar, {\n componentId: componentIds.ActionListItemAvatar,\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 {...makeAnalyticsAttribute({ ...props })}\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 ActionListItemAvatar,\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","rest","_objectWithoutProperties","_excluded","_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","makeAnalyticsAttribute","_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","_ActionListItemAvatar","avatarProps","Avatar","ActionListItemAvatar","_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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4FA,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,CAAC,CAAA;GACzC,CAAA;AAAA,CAAC,CAAC,CAAA;AAqBH,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAAC,IAAA,EAO0B;AAAA,EAAA,IANhDC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,MAA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G,MAAO;AACzBN,MAAAA,aAAa,EAAEA,aAAc;MAC7BpD,KAAK,EAAElD,KAAK,CAACmH,MAAO;AACpBZ,MAAAA,gBAAgB,EAAEA,gBAAAA;KACnB,CAAA,CAAA;AAAC,IAAA;AAEN,CAAC,CAAA;AAEKkC,IAAAA,cAAc,gBAAGhF,wBAAwB,eAAChC,cAAK,CAACmH,IAAI,CAAC7C,eAAe,CAAC,EAAE;EAC3EhG,WAAW,EAAE2D,YAAY,CAAC+E,cAAc;EACxC3I,WAAW,EAAE4D,YAAY,CAAC+E,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 { DataAnalyticsAttribute, 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';\nimport type { AvatarProps } from '~components/Avatar/types';\nimport { Avatar } from '~components/Avatar';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\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 DataAnalyticsAttribute;\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 &\n DataAnalyticsAttribute;\nconst _ActionListSection = ({\n title,\n children,\n testID,\n _hideDivider,\n _sectionChildValues,\n ...rest\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 {...makeAnalyticsAttribute(rest as Record<string, unknown>)}\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 _ActionListItemAvatar = (avatarProps: Omit<AvatarProps, 'size' | ''>): React.ReactElement => {\n return <Avatar size=\"xsmall\" {...avatarProps} />;\n};\n\nconst ActionListItemAvatar = assignWithoutSideEffects(_ActionListItemAvatar, {\n componentId: componentIds.ActionListItemAvatar,\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 const isVisible = hasAutoComplete && filteredValues ? filteredValues.includes(props.value) : true;\n\n return (\n <BaseMenuItem\n isVisible={isVisible}\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 {...makeAnalyticsAttribute({ ...props })}\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 ActionListItemAvatar,\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","rest","_objectWithoutProperties","_excluded","_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","makeAnalyticsAttribute","_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","_ActionListItemAvatar","avatarProps","Avatar","ActionListItemAvatar","_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","isVisible","value","BaseMenuItem","as","id","tabIndex","description","pointerEvents","Checkbox","isChecked","target","className","get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CAACwH,KAAK;AAAEA,QAAAA,KAAK,EAAEX,UAAU;QAAE0B,KAAK,EAAEC,WAAW,CAACJ,CAAC,CAAA;AAAE,OAAC,CAAC,CAAA;AAClF,KAAA;GACD,CAAC,CACEtF,EAAAA,sBAAsB,CAAAT,aAAA,CAAMrC,EAAAA,EAAAA,KAAK,CAAE,CAAC,CACpC0C,EAAAA,aAAa,CAAC;IAAEC,IAAI,EAAEC,aAAa,CAAC6F,cAAc;IAAEhI,MAAM,EAAET,KAAK,CAACS,MAAAA;AAAO,GAAC,CAAC,CAAA,EAAA,EAAA,EAAA;IAC/EiI,WAAW,EAAE,SAAAA,WAAAA,GAAM;AACjB;AACA;MACArC,4BAA4B,CAAC,IAAI,CAAC,CAAA;KAClC;IACFsC,SAAS,EAAE,SAAAA,SAAAA,GAAM;AACf;MACAtC,4BAA4B,CAAC,KAAK,CAAC,CAAA;KACnC;IACF,YAAYrG,EAAAA,KAAK,CAACwH,KAAM;IACxB,YAAYxH,EAAAA,KAAK,CAAC4G,MAAO;AACzBN,IAAAA,aAAa,EAAEA,aAAc;IAC7BpD,KAAK,EAAElD,KAAK,CAACmH,MAAO;AACpBZ,IAAAA,gBAAgB,EAAEA,gBAAAA;AAAiB,GAAA,CACpC,CAAC,CAAA;AAEN,CAAC,CAAA;AAEKkC,IAAAA,cAAc,gBAAGhF,wBAAwB,eAAChC,cAAK,CAACmH,IAAI,CAAC7C,eAAe,CAAC,EAAE;EAC3EhG,WAAW,EAAE2D,YAAY,CAAC+E,cAAc;EACxC3I,WAAW,EAAE4D,YAAY,CAAC+E,cAAAA;AAC5B,CAAC;;;;"}
|
package/build/lib/web/development/components/ActionList/styles/getBaseListBoxWrapperStyles.js
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import '../../../utils/makeSize/index.js';
|
|
2
2
|
import '../../../tokens/global/index.js';
|
|
3
|
-
import { makeSize } from '../../../utils/makeSize/makeSize.js';
|
|
4
3
|
import { size } from '../../../tokens/global/size.js';
|
|
4
|
+
import { makeSize } from '../../../utils/makeSize/makeSize.js';
|
|
5
5
|
|
|
6
|
+
var actionListMaxHeight = size[300];
|
|
7
|
+
var getActionListPadding = function getActionListPadding(theme) {
|
|
8
|
+
return theme.spacing[3];
|
|
9
|
+
};
|
|
6
10
|
var getBaseListBoxWrapperStyles = function getBaseListBoxWrapperStyles(props) {
|
|
7
11
|
return {
|
|
8
|
-
maxHeight: props.isInBottomSheet ? undefined : makeSize(
|
|
9
|
-
padding: props.isInBottomSheet ? undefined : makeSize(props.theme
|
|
12
|
+
maxHeight: props.isInBottomSheet ? undefined : makeSize(actionListMaxHeight),
|
|
13
|
+
padding: props.isInBottomSheet ? undefined : makeSize(getActionListPadding(props.theme))
|
|
10
14
|
};
|
|
11
15
|
};
|
|
12
16
|
|
|
13
|
-
export { getBaseListBoxWrapperStyles };
|
|
17
|
+
export { actionListMaxHeight, getActionListPadding, getBaseListBoxWrapperStyles };
|
|
14
18
|
//# sourceMappingURL=getBaseListBoxWrapperStyles.js.map
|
package/build/lib/web/development/components/ActionList/styles/getBaseListBoxWrapperStyles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBaseListBoxWrapperStyles.js","sources":["../../../../../../../src/components/ActionList/styles/getBaseListBoxWrapperStyles.ts"],"sourcesContent":["import type { CSSObject } from 'styled-components';\nimport type { Theme } from '~components/BladeProvider';\nimport { makeSize } from '~utils/makeSize';\nimport { size } from '~tokens/global';\n\nconst getBaseListBoxWrapperStyles = (props: {\n theme: Theme;\n isInBottomSheet: boolean;\n}): CSSObject => {\n return {\n maxHeight: props.isInBottomSheet ? undefined : makeSize(
|
|
1
|
+
{"version":3,"file":"getBaseListBoxWrapperStyles.js","sources":["../../../../../../../src/components/ActionList/styles/getBaseListBoxWrapperStyles.ts"],"sourcesContent":["import type { CSSObject } from 'styled-components';\nimport type { Theme } from '~components/BladeProvider';\nimport { makeSize } from '~utils/makeSize';\nimport { size } from '~tokens/global';\n\nconst actionListMaxHeight = size[300];\n\nconst getActionListPadding = (theme: Theme): number => {\n return theme.spacing[3];\n};\n\nconst getBaseListBoxWrapperStyles = (props: {\n theme: Theme;\n isInBottomSheet: boolean;\n}): CSSObject => {\n return {\n maxHeight: props.isInBottomSheet ? undefined : makeSize(actionListMaxHeight),\n padding: props.isInBottomSheet ? undefined : makeSize(getActionListPadding(props.theme)),\n };\n};\n\nexport { getBaseListBoxWrapperStyles, actionListMaxHeight, getActionListPadding };\n"],"names":["actionListMaxHeight","size","getActionListPadding","theme","spacing","getBaseListBoxWrapperStyles","props","maxHeight","isInBottomSheet","undefined","makeSize","padding"],"mappings":";;;;;AAKA,IAAMA,mBAAmB,GAAGC,IAAI,CAAC,GAAG,EAAC;AAErC,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAAIC,KAAY,EAAa;AACrD,EAAA,OAAOA,KAAK,CAACC,OAAO,CAAC,CAAC,CAAC,CAAA;AACzB,EAAC;AAED,IAAMC,2BAA2B,GAAG,SAA9BA,2BAA2BA,CAAIC,KAGpC,EAAgB;EACf,OAAO;IACLC,SAAS,EAAED,KAAK,CAACE,eAAe,GAAGC,SAAS,GAAGC,QAAQ,CAACV,mBAAmB,CAAC;AAC5EW,IAAAA,OAAO,EAAEL,KAAK,CAACE,eAAe,GAAGC,SAAS,GAAGC,QAAQ,CAACR,oBAAoB,CAACI,KAAK,CAACH,KAAK,CAAC,CAAA;GACxF,CAAA;AACH;;;;"}
|
|
@@ -3,19 +3,18 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
|
|
|
3
3
|
import React__default from 'react';
|
|
4
4
|
import { BaseMenuItemContext } from '../BaseMenuContext.js';
|
|
5
5
|
import { StyledMenuItemContainer } from './StyledMenuItemContainer.web.js';
|
|
6
|
+
import { itemFirstRowHeight } from './tokens.js';
|
|
6
7
|
import '../../Box/index.js';
|
|
7
8
|
import '../../Typography/index.js';
|
|
8
|
-
import '../../../tokens/global/index.js';
|
|
9
|
-
import '../../../utils/index.js';
|
|
10
9
|
import '../../../utils/makeAccessible/index.js';
|
|
11
10
|
import '../../Typography/BaseText/index.js';
|
|
12
11
|
import '../../../utils/useTruncationTitle/index.js';
|
|
12
|
+
import '../../../utils/index.js';
|
|
13
13
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
14
|
-
import { makeSize } from '../../../utils/makeSize/makeSize.js';
|
|
15
|
-
import { size } from '../../../tokens/global/size.js';
|
|
16
14
|
import { useTruncationTitle } from '../../../utils/useTruncationTitle/useTruncationTitle.web.js';
|
|
17
15
|
import { makeAccessible } from '../../../utils/makeAccessible/makeAccessible.web.js';
|
|
18
16
|
import { Box } from '../../Box/Box.js';
|
|
17
|
+
import { makeSize } from '../../../utils/makeSize/makeSize.js';
|
|
19
18
|
import { BaseText } from '../../Typography/BaseText/BaseText.web.js';
|
|
20
19
|
import { getTextProps, Text } from '../../Typography/Text/Text.js';
|
|
21
20
|
|
|
@@ -38,7 +37,7 @@ var menuItemDescriptionColor = {
|
|
|
38
37
|
};
|
|
39
38
|
|
|
40
39
|
// 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
|
|
41
|
-
|
|
40
|
+
|
|
42
41
|
var _BaseMenuItem = function _BaseMenuItem(_ref, ref) {
|
|
43
42
|
var title = _ref.title,
|
|
44
43
|
description = _ref.description,
|
|
@@ -93,7 +92,7 @@ var _BaseMenuItem = function _BaseMenuItem(_ref, ref) {
|
|
|
93
92
|
display: "flex",
|
|
94
93
|
justifyContent: "center",
|
|
95
94
|
alignItems: "center",
|
|
96
|
-
height: itemFirstRowHeight,
|
|
95
|
+
height: makeSize(itemFirstRowHeight),
|
|
97
96
|
children: leading
|
|
98
97
|
}), /*#__PURE__*/jsxs(Box, {
|
|
99
98
|
paddingLeft: leading ? 'spacing.3' : 'spacing.0',
|
|
@@ -104,7 +103,7 @@ var _BaseMenuItem = function _BaseMenuItem(_ref, ref) {
|
|
|
104
103
|
display: "flex",
|
|
105
104
|
alignItems: "center",
|
|
106
105
|
flexDirection: "row",
|
|
107
|
-
height: itemFirstRowHeight,
|
|
106
|
+
height: makeSize(itemFirstRowHeight),
|
|
108
107
|
ref: containerRef,
|
|
109
108
|
children: [/*#__PURE__*/jsx(BaseText, _objectSpread(_objectSpread({
|
|
110
109
|
as: "p",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseMenuItem.js","sources":["../../../../../../../src/components/BaseMenu/BaseMenuItem/BaseMenuItem.tsx"],"sourcesContent":["import React from 'react';\nimport type { BaseMenuItemProps } from '../types';\nimport { BaseMenuItemContext } from '../BaseMenuContext';\nimport { StyledMenuItemContainer } from './StyledMenuItemContainer';\nimport {
|
|
1
|
+
{"version":3,"file":"BaseMenuItem.js","sources":["../../../../../../../src/components/BaseMenu/BaseMenuItem/BaseMenuItem.tsx"],"sourcesContent":["import React from 'react';\nimport type { BaseMenuItemProps } from '../types';\nimport { BaseMenuItemContext } from '../BaseMenuContext';\nimport { StyledMenuItemContainer } from './StyledMenuItemContainer';\nimport { itemFirstRowHeight } from './tokens';\nimport { Box } from '~components/Box';\nimport { getTextProps, Text } from '~components/Typography';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport type { BladeElementRef } from '~utils/types';\nimport { BaseText } from '~components/Typography/BaseText';\nimport { useTruncationTitle } from '~utils/useTruncationTitle';\nimport { makeSize } from '~utils';\n\nconst menuItemTitleColor = {\n negative: {\n default: 'feedback.text.negative.intense',\n disabled: 'interactive.text.gray.disabled',\n },\n normal: { default: 'interactive.text.gray.normal', disabled: 'interactive.text.gray.disabled' },\n} as const;\n\nconst menuItemDescriptionColor = {\n default: 'interactive.text.gray.muted',\n disabled: 'interactive.text.gray.disabled',\n} as const;\n\n// This is the height of item excluding the description to make sure description comes at the bottom and other first row items are center aligned\n\nconst _BaseMenuItem: React.ForwardRefRenderFunction<BladeElementRef, BaseMenuItemProps> = (\n {\n title,\n description,\n as,\n leading,\n trailing,\n titleSuffix,\n isDisabled,\n selectionType = 'single',\n isSelected,\n isVisible = true,\n color,\n role = 'menuitem',\n children,\n ...props\n },\n ref,\n): React.ReactElement => {\n const { containerRef, textRef } = useTruncationTitle({ content: title });\n return (\n <BaseMenuItemContext.Provider value={{ color, isDisabled }}>\n <StyledMenuItemContainer\n ref={ref as never}\n as={as}\n type=\"button\"\n disabled={isDisabled}\n {...makeAccessible({\n role,\n current: role === 'menuitem' || role === 'menuitemcheckbox' ? isSelected : undefined,\n disabled: isDisabled,\n selected: isSelected,\n })}\n color={color}\n isVisible={isVisible}\n isSelected={isSelected}\n isDisabled={isDisabled}\n selectionType={selectionType}\n {...props}\n >\n {children ? (\n children\n ) : (\n <Box display=\"flex\" alignItems=\"flex-start\" width=\"100%\" justifyContent=\"flex-start\">\n <Box\n display=\"flex\"\n justifyContent=\"center\"\n alignItems=\"center\"\n height={makeSize(itemFirstRowHeight)}\n >\n {leading}\n </Box>\n <Box\n paddingLeft={leading ? 'spacing.3' : 'spacing.0'}\n paddingRight=\"spacing.3\"\n display=\"flex\"\n flexDirection=\"column\"\n >\n <Box\n display=\"flex\"\n alignItems=\"center\"\n flexDirection=\"row\"\n height={makeSize(itemFirstRowHeight)}\n ref={containerRef as never}\n >\n <BaseText\n as=\"p\"\n ref={textRef as never}\n truncateAfterLines={1}\n wordBreak=\"break-all\"\n {...getTextProps({\n size: 'medium',\n color:\n menuItemTitleColor[color === 'negative' ? 'negative' : 'normal'][\n isDisabled ? 'disabled' : 'default'\n ],\n weight: 'regular',\n })}\n >\n {title}\n </BaseText>\n {titleSuffix}\n </Box>\n <Box>\n {description ? (\n <Text\n color={menuItemDescriptionColor[isDisabled ? 'disabled' : 'default']}\n size=\"small\"\n >\n {description}\n </Text>\n ) : null}\n </Box>\n </Box>\n <Box marginLeft=\"auto\">{trailing}</Box>\n </Box>\n )}\n </StyledMenuItemContainer>\n </BaseMenuItemContext.Provider>\n );\n};\n\nconst BaseMenuItem = React.forwardRef(_BaseMenuItem);\n\nexport { BaseMenuItem };\n"],"names":["menuItemTitleColor","negative","disabled","normal","menuItemDescriptionColor","_BaseMenuItem","_ref","ref","title","description","as","leading","trailing","titleSuffix","isDisabled","_ref$selectionType","selectionType","isSelected","_ref$isVisible","isVisible","color","_ref$role","role","children","props","_objectWithoutProperties","_excluded","_useTruncationTitle","useTruncationTitle","content","containerRef","textRef","_jsx","BaseMenuItemContext","Provider","value","StyledMenuItemContainer","_objectSpread","type","makeAccessible","current","undefined","selected","_jsxs","Box","display","alignItems","width","justifyContent","height","makeSize","itemFirstRowHeight","paddingLeft","paddingRight","flexDirection","BaseText","truncateAfterLines","wordBreak","getTextProps","size","weight","Text","marginLeft","BaseMenuItem","React","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAaA,IAAMA,kBAAkB,GAAG;AACzBC,EAAAA,QAAQ,EAAE;AACR,IAAA,SAAA,EAAS,gCAAgC;AACzCC,IAAAA,QAAQ,EAAE,gCAAA;GACX;AACDC,EAAAA,MAAM,EAAE;AAAE,IAAA,SAAA,EAAS,8BAA8B;AAAED,IAAAA,QAAQ,EAAE,gCAAA;AAAiC,GAAA;AAChG,CAAU,CAAA;AAEV,IAAME,wBAAwB,GAAG;AAC/B,EAAA,SAAA,EAAS,6BAA6B;AACtCF,EAAAA,QAAQ,EAAE,gCAAA;AACZ,CAAU,CAAA;;AAEV;;AAEA,IAAMG,aAAiF,GAAG,SAApFA,aAAiFA,CAAAC,IAAA,EAiBrFC,GAAG,EACoB;AAAA,EAAA,IAhBrBC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,WAAW,GAAAH,IAAA,CAAXG,WAAW;IACXC,EAAE,GAAAJ,IAAA,CAAFI,EAAE;IACFC,OAAO,GAAAL,IAAA,CAAPK,OAAO;IACPC,QAAQ,GAAAN,IAAA,CAARM,QAAQ;IACRC,WAAW,GAAAP,IAAA,CAAXO,WAAW;IACXC,UAAU,GAAAR,IAAA,CAAVQ,UAAU;IAAAC,kBAAA,GAAAT,IAAA,CACVU,aAAa;AAAbA,IAAAA,a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
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { getBaseMenuItemStyles } from './getBaseMenuItemStyles.js';
|
|
4
|
+
import { getItemPadding } from './tokens.js';
|
|
4
5
|
import '../../../utils/index.js';
|
|
5
6
|
import '../../../utils/getFocusRingStyles/index.js';
|
|
6
7
|
import '../../Box/BaseBox/index.js';
|
|
@@ -18,12 +19,12 @@ var StyledMenuItemContainer = /*#__PURE__*/styled(BaseBox).withConfig({
|
|
|
18
19
|
return _objectSpread(_objectSpread({}, getBaseMenuItemStyles({
|
|
19
20
|
theme: props.theme
|
|
20
21
|
})), {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
21
|
-
padding: makeSize(props.theme.
|
|
22
|
+
padding: makeSize(getItemPadding(props.theme).itemPaddingMobile),
|
|
22
23
|
display: props.isVisible ? 'flex' : 'none'
|
|
23
24
|
}, "@media ".concat(getMediaQuery({
|
|
24
25
|
min: props.theme.breakpoints.m
|
|
25
26
|
})), {
|
|
26
|
-
padding: makeSize(props.theme.
|
|
27
|
+
padding: makeSize(getItemPadding(props.theme).itemPaddingDesktop)
|
|
27
28
|
}), '&:hover:not([aria-disabled=true]), &[aria-expanded="true"]', {
|
|
28
29
|
backgroundColor: props.color === 'negative' ? props.theme.colors.interactive.background.negative.faded : props.theme.colors.interactive.background.gray["default"]
|
|
29
30
|
}), '&:focus-visible', getFocusRingStyles({
|