@razorpay/blade 11.21.9 → 11.23.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/ActionListItem.js +12 -12
- package/build/lib/native/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/native/components/BaseHeaderFooter/BaseFooter.js +1 -1
- package/build/lib/native/components/BaseHeaderFooter/BaseFooter.js.map +1 -1
- package/build/lib/native/components/BaseHeaderFooter/BaseHeader.js +1 -1
- package/build/lib/native/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
- package/build/lib/native/components/BaseMenu/BaseMenuContext.js +6 -0
- package/build/lib/native/components/BaseMenu/BaseMenuContext.js.map +1 -0
- package/build/lib/native/components/BaseMenu/BaseMenuItem/BaseMenuItem.js +22 -0
- package/build/lib/native/components/BaseMenu/BaseMenuItem/BaseMenuItem.js.map +1 -0
- package/build/lib/native/components/BaseMenu/BaseMenuItem/StyledMenuItemContainer.native.js +12 -0
- package/build/lib/native/components/BaseMenu/BaseMenuItem/StyledMenuItemContainer.native.js.map +1 -0
- package/build/lib/native/components/BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js +12 -0
- package/build/lib/native/components/BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js.map +1 -0
- package/build/lib/native/components/Button/BaseButton/BaseButton.js +1 -1
- package/build/lib/native/components/Button/BaseButton/BaseButton.js.map +1 -1
- package/build/lib/native/components/Button/Button/Button.js +1 -1
- package/build/lib/native/components/Button/Button/Button.js.map +1 -1
- package/build/lib/native/components/Link/BaseLink/BaseLink.js +1 -1
- package/build/lib/native/components/Link/BaseLink/BaseLink.js.map +1 -1
- package/build/lib/native/components/Link/Link/Link.js +1 -1
- package/build/lib/native/components/Link/Link/Link.js.map +1 -1
- package/build/lib/native/components/Menu/Menu.native.js +17 -0
- package/build/lib/native/components/Menu/Menu.native.js.map +1 -0
- package/build/lib/native/components/Menu/MenuItem.native.js +17 -0
- package/build/lib/native/components/Menu/MenuItem.native.js.map +1 -0
- package/build/lib/native/components/Menu/MenuOverlay.native.js +17 -0
- package/build/lib/native/components/Menu/MenuOverlay.native.js.map +1 -0
- package/build/lib/native/components/Menu/VisualSubComponents/MenuDivider.native.js +17 -0
- package/build/lib/native/components/Menu/VisualSubComponents/MenuDivider.native.js.map +1 -0
- package/build/lib/native/components/Menu/VisualSubComponents/MenuHeaderFooter.native.js +17 -0
- package/build/lib/native/components/Menu/VisualSubComponents/MenuHeaderFooter.native.js.map +1 -0
- package/build/lib/native/components/SideNav/tokens.js +12 -0
- package/build/lib/native/components/SideNav/tokens.js.map +1 -0
- package/build/lib/native/components/TopNav/TabNav/TabNav.native.js +17 -0
- package/build/lib/native/components/TopNav/TabNav/TabNav.native.js.map +1 -0
- package/build/lib/native/components/TopNav/TabNav/TabNavItem.native.js +17 -0
- package/build/lib/native/components/TopNav/TabNav/TabNavItem.native.js.map +1 -0
- package/build/lib/native/components/TopNav/TopNav.native.js +17 -0
- package/build/lib/native/components/TopNav/TopNav.native.js.map +1 -0
- package/build/lib/native/components/index.js +9 -0
- package/build/lib/native/components/index.js.map +1 -1
- package/build/lib/native/tokens/global/size.js +1 -1
- package/build/lib/native/tokens/global/size.js.map +1 -1
- package/build/lib/native/utils/metaAttribute/metaConstants.js +1 -1
- package/build/lib/native/utils/metaAttribute/metaConstants.js.map +1 -1
- package/build/lib/web/development/components/ActionList/ActionListItem.js +43 -118
- package/build/lib/web/development/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/web/development/components/Avatar/Avatar.web.js +29 -6
- package/build/lib/web/development/components/Avatar/Avatar.web.js.map +1 -1
- package/build/lib/web/development/components/Avatar/AvatarButton.js +25 -3
- package/build/lib/web/development/components/Avatar/AvatarButton.js.map +1 -1
- package/build/lib/web/development/components/BaseHeaderFooter/BaseFooter.js +2 -1
- package/build/lib/web/development/components/BaseHeaderFooter/BaseFooter.js.map +1 -1
- package/build/lib/web/development/components/BaseHeaderFooter/BaseHeader.js +4 -0
- package/build/lib/web/development/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
- package/build/lib/web/development/components/BaseMenu/BaseMenuContext.js +10 -0
- package/build/lib/web/development/components/BaseMenu/BaseMenuContext.js.map +1 -0
- package/build/lib/web/development/components/BaseMenu/BaseMenuItem/BaseMenuItem.js +124 -0
- package/build/lib/web/development/components/BaseMenu/BaseMenuItem/BaseMenuItem.js.map +1 -0
- package/build/lib/web/development/components/BaseMenu/BaseMenuItem/StyledMenuItemContainer.web.js +41 -0
- package/build/lib/web/development/components/BaseMenu/BaseMenuItem/StyledMenuItemContainer.web.js.map +1 -0
- package/build/lib/web/development/components/{ActionList/styles/getBaseActionListItemStyles.js → BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js} +10 -9
- package/build/lib/web/development/components/BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js.map +1 -0
- package/build/lib/web/development/components/BaseMenu/index.js +3 -0
- package/build/lib/web/development/components/BaseMenu/index.js.map +1 -0
- package/build/lib/web/development/components/BaseMenu/tokens.js +8 -0
- package/build/lib/web/development/components/BaseMenu/tokens.js.map +1 -0
- package/build/lib/web/development/components/Button/BaseButton/BaseButton.js +16 -7
- package/build/lib/web/development/components/Button/BaseButton/BaseButton.js.map +1 -1
- package/build/lib/web/development/components/Button/Button/Button.js +8 -2
- package/build/lib/web/development/components/Button/Button/Button.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/QuickSelection/QuickSelectionItem.web.js +6 -27
- package/build/lib/web/development/components/DatePicker/QuickSelection/QuickSelectionItem.web.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/DropdownOverlay.web.js +3 -2
- package/build/lib/web/development/components/Dropdown/DropdownOverlay.web.js.map +1 -1
- package/build/lib/web/development/components/Link/BaseLink/BaseLink.js +5 -1
- package/build/lib/web/development/components/Link/BaseLink/BaseLink.js.map +1 -1
- package/build/lib/web/development/components/Link/Link/Link.js +6 -2
- package/build/lib/web/development/components/Link/Link/Link.js.map +1 -1
- package/build/lib/web/development/components/Menu/Menu.web.js +99 -0
- package/build/lib/web/development/components/Menu/Menu.web.js.map +1 -0
- package/build/lib/web/development/components/Menu/MenuItem.web.js +63 -0
- package/build/lib/web/development/components/Menu/MenuItem.web.js.map +1 -0
- package/build/lib/web/development/components/Menu/MenuOverlay.web.js +59 -0
- package/build/lib/web/development/components/Menu/MenuOverlay.web.js.map +1 -0
- package/build/lib/web/development/components/Menu/VisualSubComponents/MenuDivider.web.js +18 -0
- package/build/lib/web/development/components/Menu/VisualSubComponents/MenuDivider.web.js.map +1 -0
- package/build/lib/web/development/components/Menu/VisualSubComponents/MenuHeaderFooter.web.js +65 -0
- package/build/lib/web/development/components/Menu/VisualSubComponents/MenuHeaderFooter.web.js.map +1 -0
- package/build/lib/web/development/components/Menu/index.js +6 -0
- package/build/lib/web/development/components/Menu/index.js.map +1 -0
- package/build/lib/web/development/components/Menu/tokens.js +26 -0
- package/build/lib/web/development/components/Menu/tokens.js.map +1 -0
- package/build/lib/web/development/components/Menu/useMenu.js +178 -0
- package/build/lib/web/development/components/Menu/useMenu.js.map +1 -0
- package/build/lib/web/development/components/SideNav/SideNav.web.js +5 -2
- package/build/lib/web/development/components/SideNav/SideNav.web.js.map +1 -1
- package/build/lib/web/development/components/SideNav/index.js +1 -0
- package/build/lib/web/development/components/SideNav/index.js.map +1 -1
- package/build/lib/web/development/components/SideNav/tokens.js +3 -2
- package/build/lib/web/development/components/SideNav/tokens.js.map +1 -1
- package/build/lib/web/development/components/Tooltip/Tooltip.web.js +1 -3
- package/build/lib/web/development/components/Tooltip/Tooltip.web.js.map +1 -1
- package/build/lib/web/development/components/TopNav/TabNav/TabNav.web.js +172 -0
- package/build/lib/web/development/components/TopNav/TabNav/TabNav.web.js.map +1 -0
- package/build/lib/web/development/components/TopNav/TabNav/TabNavContext.js +18 -0
- package/build/lib/web/development/components/TopNav/TabNav/TabNavContext.js.map +1 -0
- package/build/lib/web/development/components/TopNav/TabNav/TabNavItem.web.js +198 -0
- package/build/lib/web/development/components/TopNav/TabNav/TabNavItem.web.js.map +1 -0
- package/build/lib/web/development/components/TopNav/TabNav/index.js +4 -0
- package/build/lib/web/development/components/TopNav/TabNav/index.js.map +1 -0
- package/build/lib/web/development/components/TopNav/TabNav/types.js +2 -0
- package/build/lib/web/development/components/TopNav/TabNav/types.js.map +1 -0
- package/build/lib/web/development/components/TopNav/TabNav/utils.js +48 -0
- package/build/lib/web/development/components/TopNav/TabNav/utils.js.map +1 -0
- package/build/lib/web/development/components/TopNav/TopNav.web.js +158 -0
- package/build/lib/web/development/components/TopNav/TopNav.web.js.map +1 -0
- package/build/lib/web/development/components/TopNav/TopNavContext.js +13 -0
- package/build/lib/web/development/components/TopNav/TopNavContext.js.map +1 -0
- package/build/lib/web/development/components/TopNav/index.js +3 -0
- package/build/lib/web/development/components/TopNav/index.js.map +1 -0
- package/build/lib/web/development/components/index.js +11 -0
- package/build/lib/web/development/components/index.js.map +1 -1
- package/build/lib/web/development/tokens/global/size.js +4 -0
- package/build/lib/web/development/tokens/global/size.js.map +1 -1
- package/build/lib/web/development/utils/metaAttribute/metaConstants.js +9 -0
- package/build/lib/web/development/utils/metaAttribute/metaConstants.js.map +1 -1
- package/build/lib/web/production/components/ActionList/ActionListItem.js +43 -118
- package/build/lib/web/production/components/ActionList/ActionListItem.js.map +1 -1
- package/build/lib/web/production/components/Avatar/Avatar.web.js +29 -6
- package/build/lib/web/production/components/Avatar/Avatar.web.js.map +1 -1
- package/build/lib/web/production/components/Avatar/AvatarButton.js +25 -3
- package/build/lib/web/production/components/Avatar/AvatarButton.js.map +1 -1
- package/build/lib/web/production/components/BaseHeaderFooter/BaseFooter.js +2 -1
- package/build/lib/web/production/components/BaseHeaderFooter/BaseFooter.js.map +1 -1
- package/build/lib/web/production/components/BaseHeaderFooter/BaseHeader.js +4 -0
- package/build/lib/web/production/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
- package/build/lib/web/production/components/BaseMenu/BaseMenuContext.js +10 -0
- package/build/lib/web/production/components/BaseMenu/BaseMenuContext.js.map +1 -0
- package/build/lib/web/production/components/BaseMenu/BaseMenuItem/BaseMenuItem.js +124 -0
- package/build/lib/web/production/components/BaseMenu/BaseMenuItem/BaseMenuItem.js.map +1 -0
- package/build/lib/web/production/components/BaseMenu/BaseMenuItem/StyledMenuItemContainer.web.js +41 -0
- package/build/lib/web/production/components/BaseMenu/BaseMenuItem/StyledMenuItemContainer.web.js.map +1 -0
- package/build/lib/web/production/components/{ActionList/styles/getBaseActionListItemStyles.js → BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js} +10 -9
- package/build/lib/web/production/components/BaseMenu/BaseMenuItem/getBaseMenuItemStyles.js.map +1 -0
- package/build/lib/web/production/components/BaseMenu/index.js +3 -0
- package/build/lib/web/production/components/BaseMenu/index.js.map +1 -0
- package/build/lib/web/production/components/BaseMenu/tokens.js +8 -0
- package/build/lib/web/production/components/BaseMenu/tokens.js.map +1 -0
- package/build/lib/web/production/components/Button/BaseButton/BaseButton.js +16 -7
- package/build/lib/web/production/components/Button/BaseButton/BaseButton.js.map +1 -1
- package/build/lib/web/production/components/Button/Button/Button.js +8 -2
- package/build/lib/web/production/components/Button/Button/Button.js.map +1 -1
- package/build/lib/web/production/components/DatePicker/QuickSelection/QuickSelectionItem.web.js +6 -27
- package/build/lib/web/production/components/DatePicker/QuickSelection/QuickSelectionItem.web.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/DropdownOverlay.web.js +3 -2
- package/build/lib/web/production/components/Dropdown/DropdownOverlay.web.js.map +1 -1
- package/build/lib/web/production/components/Link/BaseLink/BaseLink.js +5 -1
- package/build/lib/web/production/components/Link/BaseLink/BaseLink.js.map +1 -1
- package/build/lib/web/production/components/Link/Link/Link.js +6 -2
- package/build/lib/web/production/components/Link/Link/Link.js.map +1 -1
- package/build/lib/web/production/components/Menu/Menu.web.js +99 -0
- package/build/lib/web/production/components/Menu/Menu.web.js.map +1 -0
- package/build/lib/web/production/components/Menu/MenuItem.web.js +63 -0
- package/build/lib/web/production/components/Menu/MenuItem.web.js.map +1 -0
- package/build/lib/web/production/components/Menu/MenuOverlay.web.js +59 -0
- package/build/lib/web/production/components/Menu/MenuOverlay.web.js.map +1 -0
- package/build/lib/web/production/components/Menu/VisualSubComponents/MenuDivider.web.js +18 -0
- package/build/lib/web/production/components/Menu/VisualSubComponents/MenuDivider.web.js.map +1 -0
- package/build/lib/web/production/components/Menu/VisualSubComponents/MenuHeaderFooter.web.js +65 -0
- package/build/lib/web/production/components/Menu/VisualSubComponents/MenuHeaderFooter.web.js.map +1 -0
- package/build/lib/web/production/components/Menu/index.js +6 -0
- package/build/lib/web/production/components/Menu/index.js.map +1 -0
- package/build/lib/web/production/components/Menu/tokens.js +26 -0
- package/build/lib/web/production/components/Menu/tokens.js.map +1 -0
- package/build/lib/web/production/components/Menu/useMenu.js +178 -0
- package/build/lib/web/production/components/Menu/useMenu.js.map +1 -0
- package/build/lib/web/production/components/SideNav/SideNav.web.js +5 -2
- package/build/lib/web/production/components/SideNav/SideNav.web.js.map +1 -1
- package/build/lib/web/production/components/SideNav/index.js +1 -0
- package/build/lib/web/production/components/SideNav/index.js.map +1 -1
- package/build/lib/web/production/components/SideNav/tokens.js +3 -2
- package/build/lib/web/production/components/SideNav/tokens.js.map +1 -1
- package/build/lib/web/production/components/Tooltip/Tooltip.web.js +1 -3
- package/build/lib/web/production/components/Tooltip/Tooltip.web.js.map +1 -1
- package/build/lib/web/production/components/TopNav/TabNav/TabNav.web.js +172 -0
- package/build/lib/web/production/components/TopNav/TabNav/TabNav.web.js.map +1 -0
- package/build/lib/web/production/components/TopNav/TabNav/TabNavContext.js +18 -0
- package/build/lib/web/production/components/TopNav/TabNav/TabNavContext.js.map +1 -0
- package/build/lib/web/production/components/TopNav/TabNav/TabNavItem.web.js +198 -0
- package/build/lib/web/production/components/TopNav/TabNav/TabNavItem.web.js.map +1 -0
- package/build/lib/web/production/components/TopNav/TabNav/index.js +4 -0
- package/build/lib/web/production/components/TopNav/TabNav/index.js.map +1 -0
- package/build/lib/web/production/components/TopNav/TabNav/types.js +2 -0
- package/build/lib/web/production/components/TopNav/TabNav/types.js.map +1 -0
- package/build/lib/web/production/components/TopNav/TabNav/utils.js +48 -0
- package/build/lib/web/production/components/TopNav/TabNav/utils.js.map +1 -0
- package/build/lib/web/production/components/TopNav/TopNav.web.js +158 -0
- package/build/lib/web/production/components/TopNav/TopNav.web.js.map +1 -0
- package/build/lib/web/production/components/TopNav/TopNavContext.js +13 -0
- package/build/lib/web/production/components/TopNav/TopNavContext.js.map +1 -0
- package/build/lib/web/production/components/TopNav/index.js +3 -0
- package/build/lib/web/production/components/TopNav/index.js.map +1 -0
- package/build/lib/web/production/components/index.js +11 -0
- package/build/lib/web/production/components/index.js.map +1 -1
- package/build/lib/web/production/tokens/global/size.js +4 -0
- package/build/lib/web/production/tokens/global/size.js.map +1 -1
- package/build/lib/web/production/utils/metaAttribute/metaConstants.js +9 -0
- package/build/lib/web/production/utils/metaAttribute/metaConstants.js.map +1 -1
- package/build/types/components/index.d.ts +883 -3
- package/build/types/components/index.native.d.ts +253 -2
- package/build/types/tokens/index.d.ts +4 -0
- package/build/types/tokens/index.native.d.ts +4 -0
- package/package.json +1 -1
- package/build/lib/native/components/ActionList/styles/StyledActionListItem.native.js +0 -8
- package/build/lib/native/components/ActionList/styles/StyledActionListItem.native.js.map +0 -1
- package/build/lib/native/components/ActionList/styles/getBaseActionListItemStyles.js +0 -11
- package/build/lib/native/components/ActionList/styles/getBaseActionListItemStyles.js.map +0 -1
- package/build/lib/web/development/components/ActionList/styles/StyledActionListItem.web.js +0 -33
- package/build/lib/web/development/components/ActionList/styles/StyledActionListItem.web.js.map +0 -1
- package/build/lib/web/development/components/ActionList/styles/getBaseActionListItemStyles.js.map +0 -1
- package/build/lib/web/production/components/ActionList/styles/StyledActionListItem.web.js +0 -33
- package/build/lib/web/production/components/ActionList/styles/StyledActionListItem.web.js.map +0 -1
- package/build/lib/web/production/components/ActionList/styles/getBaseActionListItemStyles.js.map +0 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
|
+
import { useListItem, useFloatingTree, useMergeRefs } from '@floating-ui/react';
|
|
4
|
+
import React__default from 'react';
|
|
5
|
+
import { useMenu } from './useMenu.js';
|
|
6
|
+
import '../BaseMenu/index.js';
|
|
7
|
+
import '../Icons/index.js';
|
|
8
|
+
import { jsx } from 'react/jsx-runtime';
|
|
9
|
+
import { BaseMenuItem } from '../BaseMenu/BaseMenuItem/BaseMenuItem.js';
|
|
10
|
+
import ChevronRightIcon from '../Icons/ChevronRightIcon/ChevronRightIcon.js';
|
|
11
|
+
|
|
12
|
+
var _excluded = ["title", "isDisabled", "description", "leading", "trailing", "_isMenuTrigger", "_hasFocusInside", "href", "target", "children", "as"];
|
|
13
|
+
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; }
|
|
14
|
+
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; }
|
|
15
|
+
var MenuItem = /*#__PURE__*/React__default.forwardRef(function (_ref, forwardedRef) {
|
|
16
|
+
var title = _ref.title,
|
|
17
|
+
isDisabled = _ref.isDisabled,
|
|
18
|
+
description = _ref.description,
|
|
19
|
+
leading = _ref.leading,
|
|
20
|
+
trailing = _ref.trailing,
|
|
21
|
+
_isMenuTrigger = _ref._isMenuTrigger,
|
|
22
|
+
_hasFocusInside = _ref._hasFocusInside,
|
|
23
|
+
href = _ref.href,
|
|
24
|
+
target = _ref.target,
|
|
25
|
+
children = _ref.children,
|
|
26
|
+
as = _ref.as,
|
|
27
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
28
|
+
var menu = useMenu();
|
|
29
|
+
var item = useListItem({
|
|
30
|
+
label: isDisabled && Boolean(children) ? null : title
|
|
31
|
+
});
|
|
32
|
+
var tree = useFloatingTree();
|
|
33
|
+
var isLink = Boolean(href);
|
|
34
|
+
var defaultAs = isLink ? 'a' : 'button';
|
|
35
|
+
return /*#__PURE__*/jsx(BaseMenuItem, _objectSpread(_objectSpread(_objectSpread({
|
|
36
|
+
title: title,
|
|
37
|
+
description: description,
|
|
38
|
+
leading: leading,
|
|
39
|
+
trailing: _isMenuTrigger ? /*#__PURE__*/jsx(ChevronRightIcon, {
|
|
40
|
+
color: "interactive.icon.gray.muted"
|
|
41
|
+
}) : trailing,
|
|
42
|
+
as: as !== null && as !== void 0 ? as : defaultAs,
|
|
43
|
+
href: href,
|
|
44
|
+
ref: useMergeRefs([item.ref, forwardedRef]),
|
|
45
|
+
isDisabled: isDisabled
|
|
46
|
+
}, props), _isMenuTrigger ? {} : menu.getItemProps({
|
|
47
|
+
onClick: function onClick(event) {
|
|
48
|
+
var _props$onClick;
|
|
49
|
+
(_props$onClick = props.onClick) === null || _props$onClick === void 0 ? void 0 : _props$onClick.call(props, event);
|
|
50
|
+
tree === null || tree === void 0 ? void 0 : tree.events.emit('click');
|
|
51
|
+
},
|
|
52
|
+
onFocus: function onFocus(event) {
|
|
53
|
+
var _props$onFocus;
|
|
54
|
+
(_props$onFocus = props.onFocus) === null || _props$onFocus === void 0 ? void 0 : _props$onFocus.call(props, event);
|
|
55
|
+
menu.setHasFocusInside(true);
|
|
56
|
+
}
|
|
57
|
+
})), {}, {
|
|
58
|
+
children: children
|
|
59
|
+
}));
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export { MenuItem };
|
|
63
|
+
//# sourceMappingURL=MenuItem.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MenuItem.web.js","sources":["../../../../../../src/components/Menu/MenuItem.web.tsx"],"sourcesContent":["import { useFloatingTree, useListItem, useMergeRefs } from '@floating-ui/react';\nimport React from 'react';\nimport type { MenuItemProps } from './types';\nimport { useMenu } from './useMenu';\nimport { BaseMenuItem } from '~components/BaseMenu';\nimport { ChevronRightIcon } from '~components/Icons';\n\nconst MenuItem = React.forwardRef<HTMLButtonElement, MenuItemProps>(\n (\n {\n title,\n isDisabled,\n description,\n leading,\n trailing,\n _isMenuTrigger,\n _hasFocusInside,\n href,\n target,\n children,\n as,\n ...props\n },\n forwardedRef,\n ) => {\n const menu = useMenu();\n const item = useListItem({ label: isDisabled && Boolean(children) ? null : title });\n const tree = useFloatingTree();\n\n const isLink = Boolean(href);\n\n const defaultAs = isLink ? 'a' : 'button';\n\n return (\n <BaseMenuItem\n title={title}\n description={description}\n leading={leading}\n trailing={\n _isMenuTrigger ? <ChevronRightIcon color=\"interactive.icon.gray.muted\" /> : trailing\n }\n as={as ?? defaultAs}\n href={href}\n ref={useMergeRefs([item.ref, forwardedRef])}\n isDisabled={isDisabled}\n {...props}\n {...(_isMenuTrigger\n ? {}\n : menu.getItemProps({\n onClick(event: React.MouseEvent<HTMLButtonElement>) {\n props.onClick?.(event);\n tree?.events.emit('click');\n },\n onFocus(event: React.FocusEvent<HTMLButtonElement>) {\n props.onFocus?.(event);\n menu.setHasFocusInside(true);\n },\n }))}\n >\n {children}\n </BaseMenuItem>\n );\n },\n);\n\nexport { MenuItem };\n"],"names":["MenuItem","React","forwardRef","_ref","forwardedRef","title","isDisabled","description","leading","trailing","_isMenuTrigger","_hasFocusInside","href","target","children","as","props","_objectWithoutProperties","_excluded","menu","useMenu","item","useListItem","label","Boolean","tree","useFloatingTree","isLink","defaultAs","_jsx","BaseMenuItem","_objectSpread","ChevronRightIcon","color","ref","useMergeRefs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,IAAI,CAAC,CAAA;AAC9B,KAAA;AACF,GAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AAAA/B,IAAAA,QAAA,EAELA,QAAAA;AAAQ,GAAA,CACG,CAAC,CAAA;AAEnB,CACF;;;;"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { MENU_MIN_WIDTH, overlayPaddingX, overlayPaddingY } from './tokens.js';
|
|
6
|
+
import '../Box/BaseBox/index.js';
|
|
7
|
+
import { componentZIndices } from '../../utils/componentZIndices.js';
|
|
8
|
+
import '../../utils/metaAttribute/index.js';
|
|
9
|
+
import { jsx } from 'react/jsx-runtime';
|
|
10
|
+
import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
|
|
11
|
+
import { metaAttribute } from '../../utils/metaAttribute/metaAttribute.web.js';
|
|
12
|
+
import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
|
|
13
|
+
|
|
14
|
+
var _excluded = ["children", "zIndex", "_transitionStyle", "testID"];
|
|
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
|
+
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 UnfocussableOverlay = /*#__PURE__*/styled(BaseBox).withConfig({
|
|
18
|
+
displayName: "MenuOverlayweb__UnfocussableOverlay",
|
|
19
|
+
componentId: "sc-1nhzg4x-0"
|
|
20
|
+
})(function (_props) {
|
|
21
|
+
return {
|
|
22
|
+
'&:focus-visible': {
|
|
23
|
+
outline: 'none'
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
var _MenuOverlay = function _MenuOverlay(_ref, ref) {
|
|
28
|
+
var children = _ref.children,
|
|
29
|
+
_ref$zIndex = _ref.zIndex,
|
|
30
|
+
zIndex = _ref$zIndex === void 0 ? componentZIndices.dropdownOverlay : _ref$zIndex,
|
|
31
|
+
_transitionStyle = _ref._transitionStyle,
|
|
32
|
+
testID = _ref.testID,
|
|
33
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
34
|
+
return /*#__PURE__*/jsx(UnfocussableOverlay, _objectSpread(_objectSpread(_objectSpread({
|
|
35
|
+
ref: ref
|
|
36
|
+
}, props), {}, {
|
|
37
|
+
minWidth: MENU_MIN_WIDTH,
|
|
38
|
+
zIndex: zIndex
|
|
39
|
+
}, metaAttribute({
|
|
40
|
+
name: MetaConstants.Menu,
|
|
41
|
+
testID: testID
|
|
42
|
+
})), {}, {
|
|
43
|
+
children: /*#__PURE__*/jsx(BaseBox, {
|
|
44
|
+
backgroundColor: "popup.background.subtle",
|
|
45
|
+
paddingX: overlayPaddingX,
|
|
46
|
+
paddingY: overlayPaddingY,
|
|
47
|
+
elevation: "midRaised",
|
|
48
|
+
borderWidth: "thin",
|
|
49
|
+
borderColor: "surface.border.gray.muted",
|
|
50
|
+
borderRadius: "medium",
|
|
51
|
+
style: _transitionStyle,
|
|
52
|
+
children: children
|
|
53
|
+
})
|
|
54
|
+
}));
|
|
55
|
+
};
|
|
56
|
+
var MenuOverlay = /*#__PURE__*/React__default.forwardRef(_MenuOverlay);
|
|
57
|
+
|
|
58
|
+
export { MenuOverlay };
|
|
59
|
+
//# sourceMappingURL=MenuOverlay.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MenuOverlay.web.js","sources":["../../../../../../src/components/Menu/MenuOverlay.web.tsx"],"sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\nimport type { MenuOverlayProps } from './types';\nimport { MENU_MIN_WIDTH, overlayPaddingX, overlayPaddingY } from './tokens';\nimport BaseBox from '~components/Box/BaseBox';\nimport { componentZIndices } from '~utils/componentZIndices';\nimport type { BladeElementRef } from '~utils/types';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\n\nconst UnfocussableOverlay = styled(BaseBox)((_props) => {\n return {\n '&:focus-visible': {\n outline: 'none',\n },\n };\n});\n\nconst _MenuOverlay: React.ForwardRefRenderFunction<BladeElementRef, MenuOverlayProps> = (\n { children, zIndex = componentZIndices.dropdownOverlay, _transitionStyle, testID, ...props },\n ref,\n): React.ReactElement => {\n return (\n <UnfocussableOverlay\n ref={ref as never}\n {...props}\n minWidth={MENU_MIN_WIDTH}\n zIndex={zIndex}\n {...metaAttribute({ name: MetaConstants.Menu, testID })}\n >\n {/* \n Requires another nested div since floatingStyles clash with floatingTransitionStyles \n\n https://floating-ui.com/docs/usetransition#usetransitionstyles\n */}\n <BaseBox\n backgroundColor=\"popup.background.subtle\"\n paddingX={overlayPaddingX}\n paddingY={overlayPaddingY}\n elevation=\"midRaised\"\n borderWidth=\"thin\"\n borderColor=\"surface.border.gray.muted\"\n borderRadius=\"medium\"\n style={_transitionStyle}\n >\n {children}\n </BaseBox>\n </UnfocussableOverlay>\n );\n};\n\nconst MenuOverlay = React.forwardRef(_MenuOverlay);\n\nexport { MenuOverlay };\n"],"names":["UnfocussableOverlay","styled","BaseBox","withConfig","displayName","componentId","_props","outline","_MenuOverlay","_ref","ref","children","_ref$zIndex","zIndex","componentZIndices","dropdownOverlay","_transitionStyle","testID","props","_objectWithoutProperties","_excluded","_jsx","_objectSpread","minWidth","MENU_MIN_WIDTH","metaAttribute","name","MetaConstants","Menu","backgroundColor","paddingX","overlayPaddingX","paddingY","overlayPaddingY","elevation","borderWidth","borderColor","borderRadius","style","MenuOverlay","React","forwardRef"],"mappings":";;;;;;;;;;;;;;;;AASA,IAAMA,mBAAmB,gBAAGC,MAAM,CAACC,OAAO,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,qCAAA;EAAAC,WAAA,EAAA,cAAA;AAAA,CAAC,CAAA,CAAA,UAACC,MAAM,EAAK;EACtD,OAAO;AACL,IAAA,iBAAiB,EAAE;AACjBC,MAAAA,OAAO,EAAE,MAAA;AACX,KAAA;GACD,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,IAAMC,YAA+E,GAAG,SAAlFA,YAA+EA,CAAAC,IAAA,EAEnFC,GAAG,EACoB;AAAA,EAAA,IAFrBC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IAAAC,WAAA,GAAAH,IAAA,CAAEI,MAAM;AAANA,IAAAA,MAAM,GAAAD,WAAA,KAAA,KAAA,CAAA,GAAGE,iBAAiB,CAACC,eAAe,GAAAH,WAAA;IAAEI,gBAAgB,GAAAP,IAAA,CAAhBO,gBAAgB;IAAEC,MAAM,GAAAR,IAAA,CAANQ,MAAM;AAAKC,IAAAA,KAAK,GAAAC,wBAAA,CAAAV,IAAA,EAAAW,SAAA,CAAA,CAAA;EAG1F,oBACEC,GAAA,CAACrB,mBAAmB,EAAAsB,aAAA,CAAAA,aAAA,CAAAA,aAAA,CAAA;AAClBZ,IAAAA,GAAG,EAAEA,GAAAA;AAAa,GAAA,EACdQ,KAAK,CAAA,EAAA,EAAA,EAAA;AACTK,IAAAA,QAAQ,EAAEC,cAAe;AACzBX,IAAAA,MAAM,EAAEA,MAAAA;AAAO,GAAA,EACXY,aAAa,CAAC;IAAEC,IAAI,EAAEC,aAAa,CAACC,IAAI;AAAEX,IAAAA,MAAM,EAANA,MAAAA;AAAO,GAAC,CAAC,CAAA,EAAA,EAAA,EAAA;IAAAN,QAAA,eAOvDU,GAAA,CAACnB,OAAO,EAAA;AACN2B,MAAAA,eAAe,EAAC,yBAAyB;AACzCC,MAAAA,QAAQ,EAAEC,eAAgB;AAC1BC,MAAAA,QAAQ,EAAEC,eAAgB;AAC1BC,MAAAA,SAAS,EAAC,WAAW;AACrBC,MAAAA,WAAW,EAAC,MAAM;AAClBC,MAAAA,WAAW,EAAC,2BAA2B;AACvCC,MAAAA,YAAY,EAAC,QAAQ;AACrBC,MAAAA,KAAK,EAAEtB,gBAAiB;AAAAL,MAAAA,QAAA,EAEvBA,QAAAA;KACM,CAAA;AAAC,GAAA,CACS,CAAC,CAAA;AAE1B,CAAC,CAAA;AAED,IAAM4B,WAAW,gBAAGC,cAAK,CAACC,UAAU,CAACjC,YAAY;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import { getDividerMarginTokens } from '../tokens.js';
|
|
3
|
+
import '../../Divider/index.js';
|
|
4
|
+
import '../../../utils/index.js';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
import useTheme from '../../BladeProvider/useTheme.js';
|
|
7
|
+
import { Divider } from '../../Divider/Divider.js';
|
|
8
|
+
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
|
+
var MenuDivider = function MenuDivider(styledProps) {
|
|
12
|
+
var _useTheme = useTheme(),
|
|
13
|
+
theme = _useTheme.theme;
|
|
14
|
+
return /*#__PURE__*/jsx(Divider, _objectSpread(_objectSpread({}, getDividerMarginTokens(theme)), styledProps));
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { MenuDivider };
|
|
18
|
+
//# sourceMappingURL=MenuDivider.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MenuDivider.web.js","sources":["../../../../../../../src/components/Menu/VisualSubComponents/MenuDivider.web.tsx"],"sourcesContent":["import { getDividerMarginTokens } from '../tokens';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { Divider } from '~components/Divider';\nimport { useTheme } from '~utils';\n\nconst MenuDivider = (styledProps: StyledPropsBlade): React.ReactElement => {\n const { theme } = useTheme();\n return <Divider {...getDividerMarginTokens(theme)} {...styledProps} />;\n};\n\nexport { MenuDivider };\n"],"names":["MenuDivider","styledProps","_useTheme","useTheme","theme","_jsx","Divider","_objectSpread","getDividerMarginTokens"],"mappings":";;;;;;;;;;AAKA,IAAMA,WAAW,GAAG,SAAdA,WAAWA,CAAIC,WAA6B,EAAyB;AACzE,EAAA,IAAAC,SAAA,GAAkBC,QAAQ,EAAE;IAApBC,KAAK,GAAAF,SAAA,CAALE,KAAK,CAAA;AACb,EAAA,oBAAOC,GAAA,CAACC,OAAO,EAAAC,aAAA,CAAAA,aAAA,CAAKC,EAAAA,EAAAA,sBAAsB,CAACJ,KAAK,CAAC,CAAMH,EAAAA,WAAW,CAAG,CAAC,CAAA;AACxE;;;;"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
import { overlayPaddingX, headerMarginBottom, footerPaddingTop } from '../tokens.js';
|
|
3
|
+
import { MenuDivider } from './MenuDivider.web.js';
|
|
4
|
+
import { BaseFooter } from '../../BaseHeaderFooter/BaseFooter.js';
|
|
5
|
+
import { BaseHeader } from '../../BaseHeaderFooter/BaseHeader.js';
|
|
6
|
+
import '../../../utils/assignWithoutSideEffects/index.js';
|
|
7
|
+
import { MetaConstants } from '../../../utils/metaAttribute/metaConstants.js';
|
|
8
|
+
import '../../Box/index.js';
|
|
9
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
10
|
+
import { assignWithoutSideEffects } from '../../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
|
|
11
|
+
import { Box } from '../../Box/Box.js';
|
|
12
|
+
|
|
13
|
+
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
|
14
|
+
var _MenuHeader = function _MenuHeader(_ref) {
|
|
15
|
+
var title = _ref.title,
|
|
16
|
+
subtitle = _ref.subtitle,
|
|
17
|
+
leading = _ref.leading,
|
|
18
|
+
titleSuffix = _ref.titleSuffix,
|
|
19
|
+
trailing = _ref.trailing,
|
|
20
|
+
testID = _ref.testID;
|
|
21
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
22
|
+
children: [/*#__PURE__*/jsx(BaseHeader, {
|
|
23
|
+
title: title,
|
|
24
|
+
subtitle: subtitle,
|
|
25
|
+
leading: leading,
|
|
26
|
+
trailing: trailing,
|
|
27
|
+
titleSuffix: titleSuffix,
|
|
28
|
+
metaComponentName: MetaConstants.MenuHeader,
|
|
29
|
+
testID: testID
|
|
30
|
+
// back button
|
|
31
|
+
,
|
|
32
|
+
showBackButton: false
|
|
33
|
+
// close button
|
|
34
|
+
,
|
|
35
|
+
showCloseButton: false,
|
|
36
|
+
paddingX: overlayPaddingX,
|
|
37
|
+
marginTop: "spacing.0",
|
|
38
|
+
marginBottom: headerMarginBottom,
|
|
39
|
+
showDivider: false
|
|
40
|
+
}), /*#__PURE__*/jsx(MenuDivider, {})]
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
var MenuHeader = /*#__PURE__*/assignWithoutSideEffects(_MenuHeader, {
|
|
44
|
+
componentId: 'MenuHeader'
|
|
45
|
+
});
|
|
46
|
+
var _MenuFooter = function _MenuFooter(_ref2) {
|
|
47
|
+
var children = _ref2.children,
|
|
48
|
+
testID = _ref2.testID;
|
|
49
|
+
return /*#__PURE__*/jsxs(Box, {
|
|
50
|
+
marginTop: "spacing.2",
|
|
51
|
+
children: [/*#__PURE__*/jsx(MenuDivider, {}), /*#__PURE__*/jsx(BaseFooter, {
|
|
52
|
+
metaComponentName: MetaConstants.MenuFooter,
|
|
53
|
+
showDivider: false,
|
|
54
|
+
padding: [footerPaddingTop, overlayPaddingX, 'spacing.0', overlayPaddingX],
|
|
55
|
+
testID: testID,
|
|
56
|
+
children: children
|
|
57
|
+
})]
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
var MenuFooter = /*#__PURE__*/assignWithoutSideEffects(_MenuFooter, {
|
|
61
|
+
componentId: 'MenuFooter'
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export { MenuFooter, MenuHeader };
|
|
65
|
+
//# sourceMappingURL=MenuHeaderFooter.web.js.map
|
package/build/lib/web/development/components/Menu/VisualSubComponents/MenuHeaderFooter.web.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MenuHeaderFooter.web.js","sources":["../../../../../../../src/components/Menu/VisualSubComponents/MenuHeaderFooter.web.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */\nimport React from 'react';\nimport { footerPaddingTop, headerMarginBottom, overlayPaddingX } from '../tokens';\nimport type { MenuFooterProps, MenuHeaderProps } from '../types';\nimport { MenuDivider } from './MenuDivider';\nimport { BaseFooter } from '~components/BaseHeaderFooter/BaseFooter';\nimport { BaseHeader } from '~components/BaseHeaderFooter/BaseHeader';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { MetaConstants } from '~utils/metaAttribute/metaConstants';\nimport { Box } from '~components/Box';\n\nconst _MenuHeader = ({\n title,\n subtitle,\n leading,\n titleSuffix,\n trailing,\n testID,\n}: MenuHeaderProps): React.ReactElement => {\n return (\n <>\n <BaseHeader\n title={title}\n subtitle={subtitle}\n leading={leading}\n trailing={trailing}\n titleSuffix={titleSuffix}\n metaComponentName={MetaConstants.MenuHeader}\n testID={testID}\n // back button\n showBackButton={false}\n // close button\n showCloseButton={false}\n paddingX={overlayPaddingX}\n marginTop=\"spacing.0\"\n marginBottom={headerMarginBottom}\n showDivider={false}\n />\n <MenuDivider />\n </>\n );\n};\n\nconst MenuHeader = assignWithoutSideEffects(_MenuHeader, {\n componentId: 'MenuHeader',\n});\n\nconst _MenuFooter = ({ children, testID }: MenuFooterProps): React.ReactElement => {\n return (\n <Box marginTop=\"spacing.2\">\n <MenuDivider />\n <BaseFooter\n metaComponentName={MetaConstants.MenuFooter}\n showDivider={false}\n padding={[footerPaddingTop, overlayPaddingX, 'spacing.0', overlayPaddingX]}\n testID={testID}\n >\n {children}\n </BaseFooter>\n </Box>\n );\n};\n\nconst MenuFooter = assignWithoutSideEffects(_MenuFooter, {\n componentId: 'MenuFooter',\n});\n\nexport { MenuHeader, MenuFooter };\n"],"names":["_MenuHeader","_ref","title","subtitle","leading","titleSuffix","trailing","testID","_jsxs","_Fragment","children","_jsx","BaseHeader","metaComponentName","MetaConstants","MenuHeader","showBackButton","showCloseButton","paddingX","overlayPaddingX","marginTop","marginBottom","headerMarginBottom","showDivider","MenuDivider","assignWithoutSideEffects","componentId","_MenuFooter","_ref2","Box","BaseFooter","MenuFooter","padding","footerPaddingTop"],"mappings":";;;;;;;;;;;;AAAA;AAWA,IAAMA,WAAW,GAAG,SAAdA,WAAWA,CAAAC,IAAA,EAO0B;AAAA,EAAA,IANzCC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,OAAO,GAAAH,IAAA,CAAPG,OAAO;IACPC,WAAW,GAAAJ,IAAA,CAAXI,WAAW;IACXC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;IACRC,MAAM,GAAAN,IAAA,CAANM,MAAM,CAAA;EAEN,oBACEC,IAAA,CAAAC,QAAA,EAAA;IAAAC,Q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AAAAG,MAAAA,QAAA,EAEdA,QAAAA;AAAQ,KACC,CAAC,CAAA;AAAA,GACV,CAAC,CAAA;AAEV,CAAC,CAAA;AAED,IAAMqB,UAAU,gBAAGN,wBAAwB,CAACE,WAAW,EAAE;AACvDD,EAAAA,WAAW,EAAE,YAAA;AACf,CAAC;;;;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Menu } from './Menu.web.js';
|
|
2
|
+
export { MenuItem } from './MenuItem.web.js';
|
|
3
|
+
export { MenuOverlay } from './MenuOverlay.web.js';
|
|
4
|
+
export { MenuDivider } from './VisualSubComponents/MenuDivider.web.js';
|
|
5
|
+
export { MenuFooter, MenuHeader } from './VisualSubComponents/MenuHeaderFooter.web.js';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import '../../tokens/global/index.js';
|
|
2
|
+
import '../../utils/index.js';
|
|
3
|
+
import getIn from '../../utils/lodashButBetter/get.js';
|
|
4
|
+
import { makeSpace } from '../../utils/makeSpace/makeSpace.js';
|
|
5
|
+
import { makeSize } from '../../utils/makeSize/makeSize.js';
|
|
6
|
+
import { size } from '../../tokens/global/size.js';
|
|
7
|
+
|
|
8
|
+
var overlayPaddingX = 'spacing.3';
|
|
9
|
+
var overlayPaddingY = 'spacing.4';
|
|
10
|
+
var headerMarginBottom = 'spacing.3';
|
|
11
|
+
var footerPaddingTop = 'spacing.3';
|
|
12
|
+
var getDividerMarginTokens = function getDividerMarginTokens(theme) {
|
|
13
|
+
var overlayPaddingXValue = getIn(theme, overlayPaddingX);
|
|
14
|
+
return {
|
|
15
|
+
marginLeft: "-".concat(makeSpace(overlayPaddingXValue)),
|
|
16
|
+
marginRight: "-".concat(makeSpace(overlayPaddingXValue)),
|
|
17
|
+
marginY: 'spacing.1'
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
var MENU_MIN_WIDTH = {
|
|
21
|
+
base: makeSize(size['200']),
|
|
22
|
+
s: makeSize(size['240'])
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { MENU_MIN_WIDTH, footerPaddingTop, getDividerMarginTokens, headerMarginBottom, overlayPaddingX, overlayPaddingY };
|
|
26
|
+
//# sourceMappingURL=tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","sources":["../../../../../../src/components/Menu/tokens.ts"],"sourcesContent":["import type { Theme } from '~components/BladeProvider';\nimport type { SpacingValueType } from '~components/Box/BaseBox';\nimport { size } from '~tokens/global';\nimport { makeSize, makeSpace } from '~utils';\nimport getIn from '~utils/lodashButBetter/get';\n\nconst overlayPaddingX = 'spacing.3';\nconst overlayPaddingY = 'spacing.4';\nconst headerMarginBottom = 'spacing.3';\nconst footerPaddingTop = 'spacing.3';\n\ntype GetDividerMarginTokensReturnType = {\n marginLeft: SpacingValueType;\n marginRight: SpacingValueType;\n marginY: SpacingValueType;\n};\n\nconst getDividerMarginTokens = (theme: Theme): GetDividerMarginTokensReturnType => {\n const overlayPaddingXValue = getIn(theme, overlayPaddingX);\n return {\n marginLeft: `-${makeSpace(overlayPaddingXValue)}`,\n marginRight: `-${makeSpace(overlayPaddingXValue)}`,\n marginY: 'spacing.1',\n };\n};\n\nconst MENU_MIN_WIDTH = {\n base: makeSize(size['200']),\n s: makeSize(size['240']),\n} as const;\n\nexport {\n overlayPaddingX,\n overlayPaddingY,\n MENU_MIN_WIDTH,\n getDividerMarginTokens,\n headerMarginBottom,\n footerPaddingTop,\n};\n"],"names":["overlayPaddingX","overlayPaddingY","headerMarginBottom","footerPaddingTop","getDividerMarginTokens","theme","overlayPaddingXValue","getIn","marginLeft","concat","makeSpace","marginRight","marginY","MENU_MIN_WIDTH","base","makeSize","size","s"],"mappings":";;;;;;;AAMMA,IAAAA,eAAe,GAAG,YAAW;AAC7BC,IAAAA,eAAe,GAAG,YAAW;AAC7BC,IAAAA,kBAAkB,GAAG,YAAW;AAChCC,IAAAA,gBAAgB,GAAG,YAAW;AAQpC,IAAMC,sBAAsB,GAAG,SAAzBA,sBAAsBA,CAAIC,KAAY,EAAuC;AACjF,EAAA,IAAMC,oBAAoB,GAAGC,KAAK,CAACF,KAAK,EAAEL,eAAe,CAAC,CAAA;EAC1D,OAAO;AACLQ,IAAAA,UAAU,MAAAC,MAAA,CAAMC,SAAS,CAACJ,oBAAoB,CAAC,CAAE;AACjDK,IAAAA,WAAW,MAAAF,MAAA,CAAMC,SAAS,CAACJ,oBAAoB,CAAC,CAAE;AAClDM,IAAAA,OAAO,EAAE,WAAA;GACV,CAAA;AACH,EAAC;AAED,IAAMC,cAAc,GAAG;AACrBC,EAAAA,IAAI,EAAEC,QAAQ,CAACC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC3BC,EAAAA,CAAC,EAAEF,QAAQ,CAACC,IAAI,CAAC,KAAK,CAAC,CAAA;AACzB;;;;"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import { useFloatingTree, useFloatingNodeId, useFloatingParentNodeId, useListItem, useFloating, offset, flip, shift, size, autoUpdate, useHover, safePolygon, useClick, useRole, useDismiss, useListNavigation, useInteractions, useTransitionStyles } from '@floating-ui/react';
|
|
4
|
+
import { useControllableState } from '../../utils/useControllable.js';
|
|
5
|
+
import { OVERLAY_OFFSET, OVERLAY_TRANSITION_OFFSET } from '../BaseMenu/tokens.js';
|
|
6
|
+
import '../../utils/index.js';
|
|
7
|
+
import useTheme from '../BladeProvider/useTheme.js';
|
|
8
|
+
import { makeSize } from '../../utils/makeSize/makeSize.js';
|
|
9
|
+
|
|
10
|
+
var MenuContext = /*#__PURE__*/React__default.createContext({
|
|
11
|
+
getItemProps: function getItemProps() {
|
|
12
|
+
return {};
|
|
13
|
+
},
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
15
|
+
setHasFocusInside: function setHasFocusInside() {},
|
|
16
|
+
isOpen: false
|
|
17
|
+
});
|
|
18
|
+
var useMenu = function useMenu() {
|
|
19
|
+
var contextValue = React__default.useContext(MenuContext);
|
|
20
|
+
return contextValue;
|
|
21
|
+
};
|
|
22
|
+
var useFloatingMenuSetup = function useFloatingMenuSetup(_ref) {
|
|
23
|
+
var elementsRef = _ref.elementsRef,
|
|
24
|
+
openInteraction = _ref.openInteraction,
|
|
25
|
+
onOpenChange = _ref.onOpenChange,
|
|
26
|
+
isOpen = _ref.isOpen;
|
|
27
|
+
var _useControllableState = useControllableState({
|
|
28
|
+
value: isOpen,
|
|
29
|
+
defaultValue: false,
|
|
30
|
+
onChange: function onChange(isOpen) {
|
|
31
|
+
return onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange({
|
|
32
|
+
isOpen: isOpen
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}),
|
|
36
|
+
_useControllableState2 = _slicedToArray(_useControllableState, 2),
|
|
37
|
+
isControllableOpen = _useControllableState2[0],
|
|
38
|
+
setIsControllableOpen = _useControllableState2[1];
|
|
39
|
+
var _React$useState = React__default.useState(null),
|
|
40
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
41
|
+
activeIndex = _React$useState2[0],
|
|
42
|
+
setActiveIndex = _React$useState2[1];
|
|
43
|
+
var tree = useFloatingTree();
|
|
44
|
+
var nodeId = useFloatingNodeId();
|
|
45
|
+
var parentId = useFloatingParentNodeId();
|
|
46
|
+
var item = useListItem();
|
|
47
|
+
var _useTheme = useTheme(),
|
|
48
|
+
theme = _useTheme.theme;
|
|
49
|
+
var isNested = parentId != null;
|
|
50
|
+
var _useFloating = useFloating({
|
|
51
|
+
nodeId: nodeId,
|
|
52
|
+
open: isControllableOpen,
|
|
53
|
+
onOpenChange: function onOpenChange(_isOpen) {
|
|
54
|
+
return setIsControllableOpen(function () {
|
|
55
|
+
return _isOpen;
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
placement: isNested ? 'right-start' : 'bottom-start',
|
|
59
|
+
middleware: [offset({
|
|
60
|
+
mainAxis: isNested ? 12 : OVERLAY_OFFSET,
|
|
61
|
+
alignmentAxis: isNested ? -16 : 0
|
|
62
|
+
}), flip(), shift(), size({
|
|
63
|
+
apply: function apply(_ref2) {
|
|
64
|
+
var availableHeight = _ref2.availableHeight,
|
|
65
|
+
elements = _ref2.elements;
|
|
66
|
+
elements.floating.style.maxHeight = "".concat(availableHeight, "px");
|
|
67
|
+
}
|
|
68
|
+
})],
|
|
69
|
+
whileElementsMounted: autoUpdate
|
|
70
|
+
}),
|
|
71
|
+
floatingStyles = _useFloating.floatingStyles,
|
|
72
|
+
refs = _useFloating.refs,
|
|
73
|
+
context = _useFloating.context;
|
|
74
|
+
var hover = useHover(context, {
|
|
75
|
+
enabled: isNested || openInteraction === 'hover',
|
|
76
|
+
delay: {
|
|
77
|
+
open: 75
|
|
78
|
+
},
|
|
79
|
+
handleClose: safePolygon({
|
|
80
|
+
blockPointerEvents: true
|
|
81
|
+
})
|
|
82
|
+
});
|
|
83
|
+
var click = useClick(context, {
|
|
84
|
+
event: 'mousedown',
|
|
85
|
+
toggle: !isNested,
|
|
86
|
+
ignoreMouse: isNested
|
|
87
|
+
});
|
|
88
|
+
var role = useRole(context, {
|
|
89
|
+
role: 'menu'
|
|
90
|
+
});
|
|
91
|
+
var dismiss = useDismiss(context, {
|
|
92
|
+
bubbles: true
|
|
93
|
+
});
|
|
94
|
+
var listNavigation = useListNavigation(context, {
|
|
95
|
+
listRef: elementsRef,
|
|
96
|
+
activeIndex: activeIndex,
|
|
97
|
+
nested: isNested,
|
|
98
|
+
onNavigate: setActiveIndex,
|
|
99
|
+
focusItemOnHover: false
|
|
100
|
+
});
|
|
101
|
+
var _useInteractions = useInteractions([hover, click, role, dismiss, listNavigation]),
|
|
102
|
+
getReferenceProps = _useInteractions.getReferenceProps,
|
|
103
|
+
getFloatingProps = _useInteractions.getFloatingProps,
|
|
104
|
+
getItemProps = _useInteractions.getItemProps;
|
|
105
|
+
var _useTransitionStyles = useTransitionStyles(context, {
|
|
106
|
+
duration: theme.motion.duration.quick,
|
|
107
|
+
initial: function initial(_ref3) {
|
|
108
|
+
var side = _ref3.side;
|
|
109
|
+
var transitionOffset = makeSize(OVERLAY_TRANSITION_OFFSET);
|
|
110
|
+
var transformMap = {
|
|
111
|
+
top: "translateY(".concat(transitionOffset, ")"),
|
|
112
|
+
right: "translateX(-".concat(transitionOffset, ")"),
|
|
113
|
+
left: "translateX(".concat(transitionOffset, ")"),
|
|
114
|
+
bottom: "translateY(-".concat(transitionOffset, ")")
|
|
115
|
+
};
|
|
116
|
+
return {
|
|
117
|
+
transform: transformMap[side !== null && side !== void 0 ? side : 'bottom'],
|
|
118
|
+
opacity: 0
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
}),
|
|
122
|
+
isMounted = _useTransitionStyles.isMounted,
|
|
123
|
+
floatingTransitionStyles = _useTransitionStyles.styles;
|
|
124
|
+
|
|
125
|
+
// Event emitter allows you to communicate across tree components.
|
|
126
|
+
// This effect closes all menus when an item gets clicked anywhere
|
|
127
|
+
// in the tree.
|
|
128
|
+
React__default.useEffect(function () {
|
|
129
|
+
if (!tree) return;
|
|
130
|
+
var handleTreeClick = function handleTreeClick() {
|
|
131
|
+
setIsControllableOpen(function () {
|
|
132
|
+
return false;
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
var onSubMenuOpen = function onSubMenuOpen(event) {
|
|
136
|
+
if (event.nodeId !== nodeId && event.parentId === parentId) {
|
|
137
|
+
setIsControllableOpen(function () {
|
|
138
|
+
return false;
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
tree.events.on('click', handleTreeClick);
|
|
143
|
+
tree.events.on('menuopen', onSubMenuOpen);
|
|
144
|
+
|
|
145
|
+
// eslint-disable-next-line consistent-return
|
|
146
|
+
return function () {
|
|
147
|
+
// Cleanup
|
|
148
|
+
tree.events.off('click', handleTreeClick);
|
|
149
|
+
tree.events.off('menuopen', onSubMenuOpen);
|
|
150
|
+
};
|
|
151
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
152
|
+
}, [tree, nodeId, parentId]);
|
|
153
|
+
React__default.useEffect(function () {
|
|
154
|
+
if (isOpen && tree) {
|
|
155
|
+
tree.events.emit('menuopen', {
|
|
156
|
+
parentId: parentId,
|
|
157
|
+
nodeId: nodeId
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}, [tree, isOpen, nodeId, parentId]);
|
|
161
|
+
return {
|
|
162
|
+
getReferenceProps: getReferenceProps,
|
|
163
|
+
getFloatingProps: getFloatingProps,
|
|
164
|
+
getItemProps: getItemProps,
|
|
165
|
+
item: item,
|
|
166
|
+
context: context,
|
|
167
|
+
nodeId: nodeId,
|
|
168
|
+
isOpen: isControllableOpen,
|
|
169
|
+
floatingStyles: floatingStyles,
|
|
170
|
+
refs: refs,
|
|
171
|
+
isNested: isNested,
|
|
172
|
+
isMounted: isMounted,
|
|
173
|
+
floatingTransitionStyles: floatingTransitionStyles
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export { MenuContext, useFloatingMenuSetup, useMenu };
|
|
178
|
+
//# sourceMappingURL=useMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMenu.js","sources":["../../../../../../src/components/Menu/useMenu.ts"],"sourcesContent":["import React from 'react';\nimport {\n autoUpdate,\n flip,\n offset,\n safePolygon,\n shift,\n size,\n useClick,\n useDismiss,\n useFloating,\n useFloatingNodeId,\n useFloatingParentNodeId,\n useFloatingTree,\n useHover,\n useInteractions,\n useListNavigation,\n useListItem,\n useRole,\n useTransitionStyles,\n} from '@floating-ui/react';\nimport type { MenuContextType, UseFloatingMenuProps, UseFloatingMenuReturnType } from './types';\nimport { useControllableState } from '~utils/useControllable';\nimport { OVERLAY_OFFSET, OVERLAY_TRANSITION_OFFSET } from '~components/BaseMenu/tokens';\nimport { makeSize, useTheme } from '~utils';\n\nconst MenuContext = React.createContext<MenuContextType>({\n getItemProps: () => ({}),\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n setHasFocusInside: () => {},\n isOpen: false,\n});\n\nconst useMenu = (): MenuContextType => {\n const contextValue = React.useContext(MenuContext);\n return contextValue;\n};\n\nconst useFloatingMenuSetup = ({\n elementsRef,\n openInteraction,\n onOpenChange,\n isOpen,\n}: UseFloatingMenuProps): UseFloatingMenuReturnType => {\n const [isControllableOpen, setIsControllableOpen] = useControllableState({\n value: isOpen,\n defaultValue: false,\n onChange: (isOpen) => onOpenChange?.({ isOpen }),\n });\n const [activeIndex, setActiveIndex] = React.useState<number | null>(null);\n\n const tree = useFloatingTree();\n const nodeId = useFloatingNodeId();\n const parentId = useFloatingParentNodeId();\n const item = useListItem();\n const { theme } = useTheme();\n\n const isNested = parentId != null;\n\n const { floatingStyles, refs, context } = useFloating<HTMLButtonElement>({\n nodeId,\n open: isControllableOpen,\n onOpenChange: (_isOpen) => setIsControllableOpen(() => _isOpen),\n placement: isNested ? 'right-start' : 'bottom-start',\n middleware: [\n offset({ mainAxis: isNested ? 12 : OVERLAY_OFFSET, alignmentAxis: isNested ? -16 : 0 }),\n flip(),\n shift(),\n size({\n apply({ availableHeight, elements }) {\n elements.floating.style.maxHeight = `${availableHeight}px`;\n },\n }),\n ],\n whileElementsMounted: autoUpdate,\n });\n\n const hover = useHover(context, {\n enabled: isNested || openInteraction === 'hover',\n delay: { open: 75 },\n handleClose: safePolygon({ blockPointerEvents: true }),\n });\n const click = useClick(context, {\n event: 'mousedown',\n toggle: !isNested,\n ignoreMouse: isNested,\n });\n const role = useRole(context, { role: 'menu' });\n const dismiss = useDismiss(context, { bubbles: true });\n const listNavigation = useListNavigation(context, {\n listRef: elementsRef,\n activeIndex,\n nested: isNested,\n onNavigate: setActiveIndex,\n focusItemOnHover: false,\n });\n\n const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([\n hover,\n click,\n role,\n dismiss,\n listNavigation,\n ]);\n\n const { isMounted, styles: floatingTransitionStyles } = useTransitionStyles(context, {\n duration: theme.motion.duration.quick,\n initial: ({ side }) => {\n const transitionOffset = makeSize(OVERLAY_TRANSITION_OFFSET);\n const transformMap = {\n top: `translateY(${transitionOffset})`,\n right: `translateX(-${transitionOffset})`,\n left: `translateX(${transitionOffset})`,\n bottom: `translateY(-${transitionOffset})`,\n } as const;\n\n return {\n transform: transformMap[side ?? 'bottom'],\n opacity: 0,\n };\n },\n });\n\n // Event emitter allows you to communicate across tree components.\n // This effect closes all menus when an item gets clicked anywhere\n // in the tree.\n React.useEffect(() => {\n if (!tree) return;\n\n const handleTreeClick = (): void => {\n setIsControllableOpen(() => false);\n };\n\n const onSubMenuOpen = (event: { nodeId: string; parentId: string }): void => {\n if (event.nodeId !== nodeId && event.parentId === parentId) {\n setIsControllableOpen(() => false);\n }\n };\n\n tree.events.on('click', handleTreeClick);\n tree.events.on('menuopen', onSubMenuOpen);\n\n // eslint-disable-next-line consistent-return\n return () => {\n // Cleanup\n tree.events.off('click', handleTreeClick);\n tree.events.off('menuopen', onSubMenuOpen);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [tree, nodeId, parentId]);\n\n React.useEffect(() => {\n if (isOpen && tree) {\n tree.events.emit('menuopen', { parentId, nodeId });\n }\n }, [tree, isOpen, nodeId, parentId]);\n\n return {\n getReferenceProps,\n getFloatingProps,\n getItemProps,\n item,\n context,\n nodeId,\n isOpen: isControllableOpen,\n floatingStyles,\n refs,\n isNested,\n isMounted,\n floatingTransitionStyles,\n };\n};\n\nexport { MenuContext, useMenu, useFloatingMenuSetup };\n"],"names":["MenuContext","React","createContext","getItemProps","setHasFocusInside","isOpen","useMenu","contextValue","useContext","useFloatingMenuSetup","_ref","elementsRef","openInteraction","onOpenChange","_useControllableState","useControllableState","value","defaultValue","onChange","_useControllableState2","_slicedToArray","isControllableOpen","setIsControllableOpen","_React$useState","useState","_React$useState2","activeIndex","setActiveIndex","tree","useFloatingTree","nodeId","useFloatingNodeId","parentId","useFloatingParentNodeId","item","useListItem","_useTheme","useTheme","theme","isNested","_useFloating","useFloating","open","_isOpen","placement","middleware","offset","mainAxis","OVERLAY_OFFSET","alignmentAxis","flip","shift","size","apply","_ref2","availableHeight","elements","floating","style","maxHeight","concat","whileElementsMounted","autoUpdate","floatingStyles","refs","context","hover","useHover","enabled","delay","handleClose","safePolygon","blockPointerEvents","click","useClick","event","toggle","ignoreMouse","role","useRole","dismiss","useDismiss","bubbles","listNavigation","useListNavigation","listRef","nested","onNavigate","focusItemOnHover","_useInteractions","useInteractions","getReferenceProps","getFloatingProps","_useTransitionStyles","useTransitionStyles","duration","motion","quick","initial","_ref3","side","transitionOffset","makeSize","OVERLAY_TRANSITION_OFFSET","transformMap","top","right","left","bottom","transform","opacity","isMounted","floatingTransitionStyles","styles","useEffect","handleTreeClick","onSubMenuOpen","events","on","off","emit"],"mappings":";;;;;;;;;AA0BA,IAAMA,WAAW,gBAAGC,cAAK,CAACC,aAAa,CAAkB;EACvDC,YAAY,EAAE,SAAAA,YAAA,GAAA;AAAA,IAAA,OAAO,EAAE,CAAA;GAAC;AACxB;AACAC,EAAAA,iBAAiB,EAAE,SAAAA,iBAAA,GAAM,EAAE;AAC3BC,EAAAA,MAAM,EAAE,KAAA;AACV,CAAC,EAAC;AAEF,IAAMC,OAAO,GAAG,SAAVA,OAAOA,GAA0B;AACrC,EAAA,IAAMC,YAAY,GAAGN,cAAK,CAACO,UAAU,CAACR,WAAW,CAAC,CAAA;AAClD,EAAA,OAAOO,YAAY,CAAA;AACrB,EAAC;AAED,IAAME,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAAAC,IAAA,EAK6B;AAAA,EAAA,IAJrDC,WAAW,GAAAD,IAAA,CAAXC,WAAW;IACXC,eAAe,GAAAF,IAAA,CAAfE,eAAe;IACfC,YAAY,GA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AAAA,SAAS,EAATA,SAAS;AACTC,IAAAA,wBAAwB,EAAxBA,wBAAAA;GACD,CAAA;AACH;;;;"}
|
|
@@ -4,7 +4,7 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
|
4
4
|
import React__default from 'react';
|
|
5
5
|
import styled from 'styled-components';
|
|
6
6
|
import { SideNavContext } from './SideNavContext.js';
|
|
7
|
-
import { classes, COLLAPSED_L1_WIDTH, TRANSITION_CLEANUP_DELAY, HOVER_AGAIN_DELAY,
|
|
7
|
+
import { classes, COLLAPSED_L1_WIDTH, TRANSITION_CLEANUP_DELAY, HOVER_AGAIN_DELAY, SIDE_NAV_EXPANDED_L1_WIDTH_BASE, SIDE_NAV_EXPANDED_L1_WIDTH_XL, L1_EXIT_HOVER_DELAY, SKIP_NAV_ID } from './tokens.js';
|
|
8
8
|
import '../Box/BaseBox/index.js';
|
|
9
9
|
import '../../utils/index.js';
|
|
10
10
|
import '../Drawer/index.js';
|
|
@@ -259,7 +259,10 @@ var SideNav = function SideNav(_ref4) {
|
|
|
259
259
|
m: 'flex'
|
|
260
260
|
},
|
|
261
261
|
flexDirection: "column",
|
|
262
|
-
width:
|
|
262
|
+
width: {
|
|
263
|
+
base: makeSize(SIDE_NAV_EXPANDED_L1_WIDTH_BASE),
|
|
264
|
+
xl: makeSize(SIDE_NAV_EXPANDED_L1_WIDTH_XL)
|
|
265
|
+
},
|
|
263
266
|
as: "nav"
|
|
264
267
|
}, metaAttribute({
|
|
265
268
|
name: MetaConstants.SideNav,
|