@semcore/dropdown-menu 4.49.0-prerelease.0 → 4.49.0-prerelease.4
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/lib/cjs/DropdownMenu.js +236 -257
- package/lib/cjs/DropdownMenu.js.map +1 -1
- package/lib/cjs/index.d.js.map +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/style/dropdown-menu.shadow.css +84 -27
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +5 -4
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/cjs/translations/de.json +3 -1
- package/lib/cjs/translations/es.json +3 -1
- package/lib/cjs/translations/fr.json +3 -1
- package/lib/cjs/translations/it.json +3 -1
- package/lib/cjs/translations/ja.json +3 -1
- package/lib/cjs/translations/ko.json +3 -1
- package/lib/cjs/translations/nl.json +3 -1
- package/lib/cjs/translations/pl.json +3 -1
- package/lib/cjs/translations/pt.json +3 -1
- package/lib/cjs/translations/sv.json +3 -1
- package/lib/cjs/translations/tr.json +3 -1
- package/lib/cjs/translations/vi.json +3 -1
- package/lib/cjs/translations/zh.json +3 -1
- package/lib/es6/DropdownMenu.js +228 -248
- package/lib/es6/DropdownMenu.js.map +1 -1
- package/lib/es6/index.d.js.map +1 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/style/dropdown-menu.shadow.css +84 -27
- package/lib/es6/translations/__intergalactic-dynamic-locales.js +2 -2
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/translations/de.json +3 -1
- package/lib/es6/translations/es.json +3 -1
- package/lib/es6/translations/fr.json +3 -1
- package/lib/es6/translations/it.json +3 -1
- package/lib/es6/translations/ja.json +3 -1
- package/lib/es6/translations/ko.json +3 -1
- package/lib/es6/translations/nl.json +3 -1
- package/lib/es6/translations/pl.json +3 -1
- package/lib/es6/translations/pt.json +3 -1
- package/lib/es6/translations/sv.json +3 -1
- package/lib/es6/translations/tr.json +3 -1
- package/lib/es6/translations/vi.json +3 -1
- package/lib/es6/translations/zh.json +3 -1
- package/lib/esm/DropdownMenu.mjs +188 -215
- package/lib/esm/style/dropdown-menu.shadow.css +84 -27
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +2 -2
- package/lib/esm/translations/de.json.mjs +6 -2
- package/lib/esm/translations/es.json.mjs +6 -2
- package/lib/esm/translations/fr.json.mjs +6 -2
- package/lib/esm/translations/it.json.mjs +6 -2
- package/lib/esm/translations/ja.json.mjs +6 -2
- package/lib/esm/translations/ko.json.mjs +6 -2
- package/lib/esm/translations/nl.json.mjs +6 -2
- package/lib/esm/translations/pl.json.mjs +6 -2
- package/lib/esm/translations/pt.json.mjs +6 -2
- package/lib/esm/translations/sv.json.mjs +6 -2
- package/lib/esm/translations/tr.json.mjs +6 -2
- package/lib/esm/translations/vi.json.mjs +6 -2
- package/lib/esm/translations/zh.json.mjs +6 -2
- package/lib/types/index.d.ts +79 -30
- package/package.json +12 -12
- package/lib/cjs/components/Context.js +0 -16
- package/lib/cjs/components/Context.js.map +0 -1
- package/lib/cjs/components/VirtualList.js +0 -148
- package/lib/cjs/components/VirtualList.js.map +0 -1
- package/lib/es6/components/Context.js +0 -9
- package/lib/es6/components/Context.js.map +0 -1
- package/lib/es6/components/VirtualList.js +0 -143
- package/lib/es6/components/VirtualList.js.map +0 -1
- package/lib/esm/components/Context.mjs +0 -11
- package/lib/esm/components/VirtualList.mjs +0 -135
- package/lib/types/components/Context.d.ts +0 -2
- package/lib/types/components/VirtualList.d.ts +0 -28
- package/lib/types/translations/__intergalactic-dynamic-locales.d.ts +0 -16
package/lib/esm/DropdownMenu.mjs
CHANGED
|
@@ -1,137 +1,113 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
5
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
5
6
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
6
7
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
8
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
9
|
+
import _get from "@babel/runtime/helpers/esm/get";
|
|
10
|
+
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
9
11
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
12
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
10
13
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
11
|
-
import { sstyled
|
|
12
|
-
import {
|
|
13
|
-
import ButtonComponent from "@semcore/button";
|
|
14
|
-
import { callAllEventHandlers } from "@semcore/core/lib/utils/assignProps";
|
|
15
|
-
import { isAdvanceMode } from "@semcore/core/lib/utils/findComponent";
|
|
16
|
-
import { isFocusInside } from "@semcore/core/lib/utils/focus-lock/isFocusInside";
|
|
17
|
-
import { setFocus } from "@semcore/core/lib/utils/focus-lock/setFocus";
|
|
18
|
-
import { forkRef } from "@semcore/core/lib/utils/ref";
|
|
19
|
-
import { useUID } from "@semcore/core/lib/utils/uniqueID";
|
|
20
|
-
import Dropdown, { selectedIndexContext, AbstractDropdown, enhance } from "@semcore/dropdown";
|
|
21
|
-
import { Text } from "@semcore/typography";
|
|
14
|
+
import { sstyled } from "@semcore/utils/lib/core/index";
|
|
15
|
+
import createComponent, { assignProps, sstyled as sstyled$1 } from "@semcore/core";
|
|
22
16
|
import React from "react";
|
|
23
|
-
import
|
|
24
|
-
import {
|
|
17
|
+
import cn from "classnames";
|
|
18
|
+
import Dropdown, { enhance, selectedIndexContext, AbstractDropdown } from "@semcore/dropdown";
|
|
19
|
+
import { useBox, Flex } from "@semcore/flex-box";
|
|
20
|
+
import ScrollAreaComponent, { hideScrollBarsFromScreenReadersContext } from "@semcore/scroll-area";
|
|
21
|
+
import { useUID } from "@semcore/utils/lib/uniqueID";
|
|
25
22
|
import { localizedMessages } from "./translations/__intergalactic-dynamic-locales.mjs";
|
|
23
|
+
import { useFocusSource } from "@semcore/utils/lib/enhances/keyboardFocusEnhance";
|
|
24
|
+
import { isAdvanceMode } from "@semcore/utils/lib/findComponent";
|
|
25
|
+
import { forkRef } from "@semcore/utils/lib/ref";
|
|
26
|
+
import { callAllEventHandlers } from "@semcore/utils/lib/assignProps";
|
|
27
|
+
import ButtonComponent from "@semcore/button";
|
|
28
|
+
import { Text } from "@semcore/typography";
|
|
29
|
+
var _excluded = ["className"];
|
|
26
30
|
/*!__reshadow-styles__:"./style/dropdown-menu.shadow.css"*/
|
|
27
31
|
var style = (
|
|
28
32
|
/*__reshadow_css_start__*/
|
|
29
33
|
(sstyled.insert(
|
|
30
34
|
/*__inner_css_start__*/
|
|
31
|
-
|
|
35
|
+
".___SDropdownMenuList_m7yca_gg_{max-height:240px;padding:var(--intergalactic-spacing-1x, 4px)0;position:relative;min-height:26px;min-width:32px;box-sizing:content-box;z-index:0;color:var(--intergalactic-text-primary, rgba(1, 5, 0, 0.899))}.___SDropdownMenuList_m7yca_gg_ .___SShadowHorizontal_m7yca_gg_:after,.___SDropdownMenuList_m7yca_gg_ .___SShadowHorizontal_m7yca_gg_:before{width:16px;height:100%;border-radius:var(--intergalactic-control-rounded, 6px)}.___SDropdownMenuList_m7yca_gg_ .___SShadowHorizontal_m7yca_gg_._position_median_m7yca_gg_:before{background:var(--intergalactic-scroll-area-dropdown-menu-left,\n linear-gradient(to right, #fff 34.38%, transparent 100%)\n )}.___SDropdownMenuList_m7yca_gg_ .___SShadowHorizontal_m7yca_gg_._position_median_m7yca_gg_:after{background:var(--intergalactic-scroll-area-dropdown-menu-right,\n linear-gradient(to left, #fff 34.38%, transparent 100%)\n )}.___SDropdownMenuList_m7yca_gg_ .___SShadowHorizontal_m7yca_gg_._position_start_m7yca_gg_:before{background:var(--intergalactic-scroll-area-dropdown-menu-left,\n linear-gradient(to right, #fff 34.38%, transparent 100%)\n )}.___SDropdownMenuList_m7yca_gg_ .___SShadowHorizontal_m7yca_gg_._position_end_m7yca_gg_:after{background:var(--intergalactic-scroll-area-dropdown-menu-right,\n linear-gradient(to left, #fff 34.38%, transparent 100%)\n )}.___SDropdownMenuList_m7yca_gg_ .___SShadowVertical_m7yca_gg_:after,.___SDropdownMenuList_m7yca_gg_ .___SShadowVertical_m7yca_gg_:before{width:100%;height:16px;border-radius:var(--intergalactic-control-rounded, 6px)}.___SDropdownMenuList_m7yca_gg_ .___SShadowVertical_m7yca_gg_._position_median_m7yca_gg_:before{background:var(--intergalactic-scroll-area-dropdown-menu-top,\n linear-gradient(to bottom, #fff 34.38%, transparent 100%)\n )}.___SDropdownMenuList_m7yca_gg_ .___SShadowVertical_m7yca_gg_._position_median_m7yca_gg_:after{background:var(--intergalactic-scroll-area-dropdown-menu-bottom,\n linear-gradient(to top, #fff 34.38%, transparent 100%)\n )}.___SDropdownMenuList_m7yca_gg_ .___SShadowVertical_m7yca_gg_._position_start_m7yca_gg_:before{background:var(--intergalactic-scroll-area-dropdown-menu-top,\n linear-gradient(to bottom, #fff 34.38%, transparent 100%)\n )}.___SDropdownMenuList_m7yca_gg_ .___SShadowVertical_m7yca_gg_._position_end_m7yca_gg_:after{background:var(--intergalactic-scroll-area-dropdown-menu-bottom,\n linear-gradient(to top, #fff 34.38%, transparent 100%)\n )}.___SDropdownMenuItemContainer_m7yca_gg_.__nesting-trigger_m7yca_gg_{justify-content:space-between}.___SDropdownMenuItemAddon_m7yca_gg_,.___SItemContentText_m7yca_gg_{display:inline-flex;margin-left:var(--intergalactic-spacing-1x, 4px);margin-right:var(--intergalactic-spacing-1x, 4px)}.___SDropdownMenuItemAddon_m7yca_gg_:first-child,.___SItemContentText_m7yca_gg_:first-child{margin-left:0}.___SDropdownMenuItemAddon_m7yca_gg_:last-child,.___SItemContentText_m7yca_gg_:last-child{margin-right:0}.___SDropdownMenuNesting_m7yca_gg_,.___SDropdownMenuNesting_m7yca_gg_._size_l_m7yca_gg_,.___SDropdownMenuNesting_m7yca_gg_._size_m_m7yca_gg_{padding:0}.___SDropdownMenuNesting_m7yca_gg_.__highlighted_m7yca_gg_{z-index:1;box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 33, 220, 0.469)) inset}@supports (color:color(display-p3 0 0 0)){.___SDropdownMenuNesting_m7yca_gg_.__highlighted_m7yca_gg_{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 33, 220, 0.469)) inset}@media (color-gamut:p3){.___SDropdownMenuNesting_m7yca_gg_.__highlighted_m7yca_gg_{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px color(display-p3 0.03256 0.12227 0.83249 / 0.469)) inset}}}.___SDropdownNestingItem_m7yca_gg_._size_l_m7yca_gg_,.___SDropdownNestingItem_m7yca_gg_._size_m_m7yca_gg_{padding-right:0}.___SDropdownNestingItem_m7yca_gg_ .___SDropdownMenuItemContainer_m7yca_gg_{width:auto;padding-top:0;padding-bottom:0;padding-left:0;min-height:auto}.___SItemContent_m7yca_gg_:focus{outline:0}.___SItemHint_m7yca_gg_{color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583))}@supports (color:color(display-p3 0 0 0)){.___SItemHint_m7yca_gg_{color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583))}@media (color-gamut:p3){.___SItemHint_m7yca_gg_{color:var(--intergalactic-text-secondary, color(display-p3 0.00228 0.01289 0.00252 / 0.583))}}}",
|
|
32
36
|
/*__inner_css_end__*/
|
|
33
|
-
"
|
|
37
|
+
"m7yca_gg_"
|
|
34
38
|
), /*__reshadow_css_end__*/
|
|
35
39
|
{
|
|
36
|
-
"__SDropdownMenuItemContainer": "
|
|
37
|
-
"_nesting-trigger": "__nesting-
|
|
38
|
-
"__SDropdownMenuNesting": "
|
|
39
|
-
"_size_l": "
|
|
40
|
-
"_size_m": "
|
|
41
|
-
"_highlighted": "
|
|
42
|
-
"__SDropdownNestingItem": "
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"__SShadowHorizontal": "
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
40
|
+
"__SDropdownMenuItemContainer": "___SDropdownMenuItemContainer_m7yca_gg_",
|
|
41
|
+
"_nesting-trigger": "__nesting-trigger_m7yca_gg_",
|
|
42
|
+
"__SDropdownMenuNesting": "___SDropdownMenuNesting_m7yca_gg_",
|
|
43
|
+
"_size_l": "_size_l_m7yca_gg_",
|
|
44
|
+
"_size_m": "_size_m_m7yca_gg_",
|
|
45
|
+
"_highlighted": "__highlighted_m7yca_gg_",
|
|
46
|
+
"__SDropdownNestingItem": "___SDropdownNestingItem_m7yca_gg_",
|
|
47
|
+
"__SItemContent": "___SItemContent_m7yca_gg_",
|
|
48
|
+
"__SItemHint": "___SItemHint_m7yca_gg_",
|
|
49
|
+
"__SDropdownMenuList": "___SDropdownMenuList_m7yca_gg_",
|
|
50
|
+
"__SShadowHorizontal": "___SShadowHorizontal_m7yca_gg_",
|
|
51
|
+
"_position_median": "_position_median_m7yca_gg_",
|
|
52
|
+
"_position_start": "_position_start_m7yca_gg_",
|
|
53
|
+
"_position_end": "_position_end_m7yca_gg_",
|
|
54
|
+
"__SShadowVertical": "___SShadowVertical_m7yca_gg_",
|
|
55
|
+
"__SDropdownMenuItemAddon": "___SDropdownMenuItemAddon_m7yca_gg_",
|
|
56
|
+
"__SItemContentText": "___SItemContentText_m7yca_gg_"
|
|
52
57
|
})
|
|
53
58
|
);
|
|
59
|
+
var ListBoxContextProvider = function ListBoxContextProvider2(_ref22) {
|
|
60
|
+
var children = _ref22.children;
|
|
61
|
+
return /* @__PURE__ */ React.createElement(hideScrollBarsFromScreenReadersContext.Provider, {
|
|
62
|
+
value: true
|
|
63
|
+
}, children);
|
|
64
|
+
};
|
|
54
65
|
var menuItemContext = /* @__PURE__ */ React.createContext({});
|
|
55
|
-
var DropdownMenuRoot = /* @__PURE__ */
|
|
66
|
+
var DropdownMenuRoot = /* @__PURE__ */ function(_AbstractDropdown) {
|
|
67
|
+
_inherits(DropdownMenuRoot2, _AbstractDropdown);
|
|
68
|
+
var _super = _createSuper(DropdownMenuRoot2);
|
|
56
69
|
function DropdownMenuRoot2() {
|
|
57
70
|
var _this;
|
|
58
71
|
_classCallCheck(this, DropdownMenuRoot2);
|
|
59
72
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
60
73
|
args[_key] = arguments[_key];
|
|
61
74
|
}
|
|
62
|
-
_this =
|
|
63
|
-
_defineProperty(_this, "actionsRef", /* @__PURE__ */ React.createRef());
|
|
64
|
-
_defineProperty(_this, "role", "menu");
|
|
65
|
-
_defineProperty(_this, "shouldRecalculateItemTabIndex", false);
|
|
75
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
76
|
+
_defineProperty(_assertThisInitialized(_this), "actionsRef", /* @__PURE__ */ React.createRef());
|
|
77
|
+
_defineProperty(_assertThisInitialized(_this), "role", "menu");
|
|
66
78
|
return _this;
|
|
67
79
|
}
|
|
68
|
-
|
|
69
|
-
return _createClass(DropdownMenuRoot2, [{
|
|
80
|
+
_createClass(DropdownMenuRoot2, [{
|
|
70
81
|
key: "uncontrolledProps",
|
|
71
82
|
value: function uncontrolledProps() {
|
|
72
83
|
var _this2 = this;
|
|
73
|
-
return _objectSpread(_objectSpread({},
|
|
84
|
+
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(DropdownMenuRoot2.prototype), "uncontrolledProps", this).call(this)), {}, {
|
|
74
85
|
visible: [null, function(visible) {
|
|
75
86
|
if (visible === true) {
|
|
76
87
|
setTimeout(function() {
|
|
77
|
-
_this2
|
|
78
|
-
|
|
88
|
+
var _this2$menuRef$curren, _this2$menuRef$curren2;
|
|
89
|
+
var options = (_this2$menuRef$curren = _this2.menuRef.current) === null || _this2$menuRef$curren === void 0 ? void 0 : _this2$menuRef$curren.querySelectorAll('[role="menuitemcheckbox"], [role="menuitemradio"]');
|
|
90
|
+
var selected = (_this2$menuRef$curren2 = _this2.menuRef.current) === null || _this2$menuRef$curren2 === void 0 ? void 0 : _this2$menuRef$curren2.querySelector('[aria-checked="true"]');
|
|
91
|
+
if (selected && options && _this2.asProps.itemsCount === void 0) {
|
|
92
|
+
_this2.scrollToNode(selected, true);
|
|
93
|
+
for (var i = 0; i < options.length; i++) {
|
|
94
|
+
if (options[i] === selected) {
|
|
95
|
+
_this2.handlers.highlightedIndex(i);
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}, 30);
|
|
79
101
|
}
|
|
80
102
|
}]
|
|
81
103
|
});
|
|
82
104
|
}
|
|
83
|
-
}, {
|
|
84
|
-
key: "menuElements",
|
|
85
|
-
get: function get() {
|
|
86
|
-
var menuElement = this.menuRef.current;
|
|
87
|
-
if (!menuElement) {
|
|
88
|
-
return {
|
|
89
|
-
selected: null,
|
|
90
|
-
options: null
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
var options = menuElement.querySelectorAll('[role="menuitemcheckbox"], [role="menuitemradio"]');
|
|
94
|
-
var selected = menuElement.querySelector('[aria-checked="true"]:not([disabled])');
|
|
95
|
-
return {
|
|
96
|
-
selected,
|
|
97
|
-
options
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
}, {
|
|
101
|
-
key: "focusAndScrollToSelected",
|
|
102
|
-
value: function focusAndScrollToSelected() {
|
|
103
|
-
var _this$menuRef$current, _this3 = this;
|
|
104
|
-
var _this$menuElements = this.menuElements, selected = _this$menuElements.selected, options = _this$menuElements.options;
|
|
105
|
-
var isFocusAlreadyInPopper = isFocusInside(this.popperRef.current);
|
|
106
|
-
if (!selected || !options || (_this$menuRef$current = this.menuRef.current) !== null && _this$menuRef$current !== void 0 && _this$menuRef$current.dataset.isVirtual || isFocusAlreadyInPopper) return;
|
|
107
|
-
this.scrollToNodeAsync(selected, true).then(function() {
|
|
108
|
-
if (_this3.asProps.visible) {
|
|
109
|
-
selected.focus({
|
|
110
|
-
preventScroll: true
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
var selectedIndex = Array.from(options).indexOf(selected);
|
|
115
|
-
if (selectedIndex !== -1) {
|
|
116
|
-
this.handlers.highlightedIndex(selectedIndex);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}, {
|
|
120
|
-
key: "afterOpenPopper",
|
|
121
|
-
value: function afterOpenPopper() {
|
|
122
|
-
var _this$menuRef$current2;
|
|
123
|
-
var _this$menuElements2 = this.menuElements, selected = _this$menuElements2.selected, options = _this$menuElements2.options;
|
|
124
|
-
var isFocusAlreadyInPopper = isFocusInside(this.popperRef.current);
|
|
125
|
-
if (isFocusAlreadyInPopper) return;
|
|
126
|
-
if (selected && options && !((_this$menuRef$current2 = this.menuRef.current) !== null && _this$menuRef$current2 !== void 0 && _this$menuRef$current2.dataset.isVirtual)) return;
|
|
127
|
-
_superPropGet(DropdownMenuRoot2, "afterOpenPopper", this, 3)([]);
|
|
128
|
-
}
|
|
129
105
|
}, {
|
|
130
106
|
key: "itemRef",
|
|
131
107
|
value: function itemRef(props, index, node) {
|
|
132
|
-
|
|
108
|
+
_get(_getPrototypeOf(DropdownMenuRoot2.prototype), "itemRef", this).call(this, props, index, node);
|
|
133
109
|
if (node === document.activeElement) {
|
|
134
|
-
|
|
110
|
+
_get(_getPrototypeOf(DropdownMenuRoot2.prototype), "scrollToNode", this).call(this, node);
|
|
135
111
|
}
|
|
136
112
|
}
|
|
137
113
|
}, {
|
|
@@ -140,8 +116,8 @@ var DropdownMenuRoot = /* @__PURE__ */ (function(_AbstractDropdown) {
|
|
|
140
116
|
var _this$asProps = this.asProps, Children = _this$asProps.Children, uid = _this$asProps.uid, visible = _this$asProps.visible;
|
|
141
117
|
var hasMenu = isAdvanceMode(Children, [DropdownMenu.Menu.displayName]);
|
|
142
118
|
var ariaControls = hasMenu ? "igc-".concat(uid, "-list") : "igc-".concat(uid, "-popper");
|
|
143
|
-
return _objectSpread(_objectSpread({},
|
|
144
|
-
|
|
119
|
+
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(DropdownMenuRoot2.prototype), "getTriggerProps", this).call(this)), {}, {
|
|
120
|
+
onKeyDown: callAllEventHandlers(this.handlePreventCommonKeyDown.bind(this), this.handleOpenKeyDown.bind(this), this.handleKeyDownForMenu("trigger")),
|
|
145
121
|
"aria-controls": visible ? ariaControls : void 0,
|
|
146
122
|
"aria-haspopup": hasMenu ? "true" : "dialog"
|
|
147
123
|
});
|
|
@@ -149,21 +125,14 @@ var DropdownMenuRoot = /* @__PURE__ */ (function(_AbstractDropdown) {
|
|
|
149
125
|
}, {
|
|
150
126
|
key: "getListProps",
|
|
151
127
|
value: function getListProps() {
|
|
152
|
-
return _objectSpread(_objectSpread({},
|
|
153
|
-
onKeyDown: callAllEventHandlers(this.handlePreventCommonKeyDown.bind(this), this.handleKeyDownForMenu("list"), this.handleArrowKeyDown.bind(this))
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
}, {
|
|
157
|
-
key: "getVirtualListProps",
|
|
158
|
-
value: function getVirtualListProps() {
|
|
159
|
-
return _objectSpread(_objectSpread({}, _superPropGet(DropdownMenuRoot2, "getListProps", this, 3)([])), {}, {
|
|
128
|
+
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(DropdownMenuRoot2.prototype), "getListProps", this).call(this)), {}, {
|
|
160
129
|
onKeyDown: callAllEventHandlers(this.handlePreventCommonKeyDown.bind(this), this.handleKeyDownForMenu("list"), this.handleArrowKeyDown.bind(this))
|
|
161
130
|
});
|
|
162
131
|
}
|
|
163
132
|
}, {
|
|
164
133
|
key: "getPopperProps",
|
|
165
134
|
value: function getPopperProps() {
|
|
166
|
-
return _objectSpread(_objectSpread({},
|
|
135
|
+
return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(DropdownMenuRoot2.prototype), "getPopperProps", this).call(this)), {}, {
|
|
167
136
|
onKeyDown: callAllEventHandlers(this.handlePreventCommonKeyDown.bind(this), this.handlePreventPopperKeyDown.bind(this))
|
|
168
137
|
});
|
|
169
138
|
}
|
|
@@ -175,34 +144,17 @@ var DropdownMenuRoot = /* @__PURE__ */ (function(_AbstractDropdown) {
|
|
|
175
144
|
onKeyDown: callAllEventHandlers(this.handlePreventTabOnActions.bind(this), this.handlePreventCommonKeyDown.bind(this), this.handleKeyDownForMenu("list"), this.handleArrowKeyDown.bind(this))
|
|
176
145
|
});
|
|
177
146
|
}
|
|
178
|
-
}, {
|
|
179
|
-
key: "getItemTabIndex",
|
|
180
|
-
value: function getItemTabIndex(props, itemIndex) {
|
|
181
|
-
var disabled = props.disabled, index = props.index;
|
|
182
|
-
var _this$asProps2 = this.asProps, highlightedIndex = _this$asProps2.highlightedIndex, visible = _this$asProps2.visible;
|
|
183
|
-
if (!visible) return -1;
|
|
184
|
-
var isHighlighted = (index !== null && index !== void 0 ? index : itemIndex) === highlightedIndex;
|
|
185
|
-
if (isHighlighted && !disabled) {
|
|
186
|
-
return 0;
|
|
187
|
-
}
|
|
188
|
-
if (disabled && isHighlighted) {
|
|
189
|
-
this.shouldRecalculateItemTabIndex = true;
|
|
190
|
-
}
|
|
191
|
-
if (!isHighlighted && !disabled && this.shouldRecalculateItemTabIndex) {
|
|
192
|
-
this.shouldRecalculateItemTabIndex = false;
|
|
193
|
-
return 0;
|
|
194
|
-
}
|
|
195
|
-
return -1;
|
|
196
|
-
}
|
|
197
147
|
}, {
|
|
198
148
|
key: "getItemProps",
|
|
199
149
|
value: function getItemProps(props, index) {
|
|
200
|
-
var _props$index,
|
|
150
|
+
var _props$index, _this3 = this;
|
|
151
|
+
var _this$asProps2 = this.asProps, highlightedIndex = _this$asProps2.highlightedIndex, visible = _this$asProps2.visible;
|
|
201
152
|
var realIndex = (_props$index = props.index) !== null && _props$index !== void 0 ? _props$index : index;
|
|
202
|
-
var
|
|
203
|
-
|
|
153
|
+
var isHighlighted = realIndex === highlightedIndex;
|
|
154
|
+
var itemProps = _objectSpread(_objectSpread({}, _get(_getPrototypeOf(DropdownMenuRoot2.prototype), "getItemProps", this).call(this, props, realIndex)), {}, {
|
|
155
|
+
tabIndex: isHighlighted && visible ? 0 : -1,
|
|
204
156
|
ref: function ref(node) {
|
|
205
|
-
return
|
|
157
|
+
return _this3.itemRef(props, realIndex, node);
|
|
206
158
|
},
|
|
207
159
|
actionsRef: this.actionsRef
|
|
208
160
|
});
|
|
@@ -211,14 +163,13 @@ var DropdownMenuRoot = /* @__PURE__ */ (function(_AbstractDropdown) {
|
|
|
211
163
|
itemProps.use = (_props$use = props.use) !== null && _props$use !== void 0 ? _props$use : "tertiary";
|
|
212
164
|
itemProps.theme = (_props$theme = props.theme) !== null && _props$theme !== void 0 ? _props$theme : "muted";
|
|
213
165
|
itemProps.size = (_props$size = props.size) !== null && _props$size !== void 0 ? _props$size : "s";
|
|
214
|
-
itemProps.innerOutline = false;
|
|
215
166
|
}
|
|
216
167
|
if (props.selected) {
|
|
217
168
|
itemProps["aria-checked"] = true;
|
|
218
169
|
}
|
|
219
|
-
if (
|
|
170
|
+
if (_get(_getPrototypeOf(DropdownMenuRoot2.prototype), "childRole", this) === "menuitemradio") {
|
|
220
171
|
itemProps.onClick = function() {
|
|
221
|
-
|
|
172
|
+
_this3.handlers.visible(false);
|
|
222
173
|
};
|
|
223
174
|
}
|
|
224
175
|
return itemProps;
|
|
@@ -226,42 +177,34 @@ var DropdownMenuRoot = /* @__PURE__ */ (function(_AbstractDropdown) {
|
|
|
226
177
|
}, {
|
|
227
178
|
key: "handleKeyDownForMenu",
|
|
228
179
|
value: function handleKeyDownForMenu(place) {
|
|
229
|
-
var
|
|
180
|
+
var _this4 = this;
|
|
230
181
|
return function(e) {
|
|
231
|
-
var
|
|
232
|
-
var
|
|
233
|
-
if (place === "list" && !((
|
|
182
|
+
var _this4$menuRef$curren, _e$target$getAttribut;
|
|
183
|
+
var _this4$asProps = _this4.asProps, visible = _this4$asProps.visible, placement = _this4$asProps.placement, inlineActions = _this4$asProps.inlineActions;
|
|
184
|
+
if (place === "list" && !((_this4$menuRef$curren = _this4.menuRef.current) !== null && _this4$menuRef$curren !== void 0 && _this4$menuRef$curren.contains(e.target)) && !inlineActions) {
|
|
234
185
|
e.stopPropagation();
|
|
235
186
|
return false;
|
|
236
187
|
}
|
|
237
|
-
var show = e.key === "ArrowRight" && (placement === null || placement === void 0 ? void 0 : placement.startsWith("right")) || e.key === "ArrowLeft" && (placement === null || placement === void 0 ? void 0 : placement.startsWith("left"))
|
|
188
|
+
var show = e.key === "ArrowRight" && (placement === null || placement === void 0 ? void 0 : placement.startsWith("right")) || e.key === "ArrowLeft" && (placement === null || placement === void 0 ? void 0 : placement.startsWith("left"));
|
|
238
189
|
var hide = e.key === "ArrowLeft" && (placement === null || placement === void 0 ? void 0 : placement.startsWith("right")) || e.key === "ArrowRight" && (placement === null || placement === void 0 ? void 0 : placement.startsWith("left")) || e.key === "Escape";
|
|
239
|
-
var isMenuItem = (_e$target$getAttribut = e.target.getAttribute("role")) === null || _e$target$getAttribut === void 0 ? void 0 : _e$target$getAttribut.startsWith(
|
|
240
|
-
if (place === "trigger" && show && isMenuItem) {
|
|
241
|
-
|
|
242
|
-
|
|
190
|
+
var isMenuItem = (_e$target$getAttribut = e.target.getAttribute("role")) === null || _e$target$getAttribut === void 0 ? void 0 : _e$target$getAttribut.startsWith(_get(_getPrototypeOf(DropdownMenuRoot2.prototype), "childRole", _this4));
|
|
191
|
+
if (place === "trigger" && (!visible || inlineActions) && show && isMenuItem) {
|
|
192
|
+
_this4.handlers.visible(true);
|
|
193
|
+
_this4.handlers.highlightedIndex(0);
|
|
243
194
|
setTimeout(function() {
|
|
244
|
-
var
|
|
245
|
-
var highlightedIndex =
|
|
246
|
-
|
|
247
|
-
if (highlightedIndexProps !== null && highlightedIndexProps !== void 0 && highlightedIndexProps.disabled) {
|
|
248
|
-
highlightedIndex = _this5.itemProps.findIndex(function(p) {
|
|
249
|
-
return !p.disabled;
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
if (highlightedIndex === -1) return;
|
|
253
|
-
(_this5$itemRefs$highl = _this5.itemRefs[highlightedIndex]) === null || _this5$itemRefs$highl === void 0 || _this5$itemRefs$highl.focus();
|
|
195
|
+
var _this4$itemRefs$highl;
|
|
196
|
+
var highlightedIndex = _this4.asProps.highlightedIndex;
|
|
197
|
+
(_this4$itemRefs$highl = _this4.itemRefs[highlightedIndex]) === null || _this4$itemRefs$highl === void 0 ? void 0 : _this4$itemRefs$highl.focus();
|
|
254
198
|
}, 0);
|
|
255
199
|
e.preventDefault();
|
|
256
200
|
e.stopPropagation();
|
|
257
201
|
return false;
|
|
258
202
|
}
|
|
259
203
|
if (place === "list" && visible && hide && isMenuItem) {
|
|
260
|
-
if (!inlineActions || inlineActions && (e.key === "Escape" ||
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
}
|
|
204
|
+
if (!inlineActions || inlineActions && (e.key === "Escape" || _this4.asProps.highlightedIndex === 0)) {
|
|
205
|
+
var _this4$triggerRef$cur;
|
|
206
|
+
_this4.handlers.visible(false);
|
|
207
|
+
(_this4$triggerRef$cur = _this4.triggerRef.current) === null || _this4$triggerRef$cur === void 0 ? void 0 : _this4$triggerRef$cur.focus();
|
|
265
208
|
e.preventDefault();
|
|
266
209
|
e.stopPropagation();
|
|
267
210
|
return false;
|
|
@@ -291,7 +234,8 @@ var DropdownMenuRoot = /* @__PURE__ */ (function(_AbstractDropdown) {
|
|
|
291
234
|
}, _ref), /* @__PURE__ */ React.createElement(Children, null)));
|
|
292
235
|
}
|
|
293
236
|
}]);
|
|
294
|
-
|
|
237
|
+
return DropdownMenuRoot2;
|
|
238
|
+
}(AbstractDropdown);
|
|
295
239
|
_defineProperty(DropdownMenuRoot, "displayName", "DropdownMenu");
|
|
296
240
|
_defineProperty(DropdownMenuRoot, "style", style);
|
|
297
241
|
_defineProperty(DropdownMenuRoot, "enhance", Object.values(enhance));
|
|
@@ -311,29 +255,25 @@ _defineProperty(DropdownMenuRoot, "nestedMenuInteraction", {
|
|
|
311
255
|
trigger: [["onClick", "onMouseEnter"], ["onClick", "onMouseLeave"]],
|
|
312
256
|
popper: [["onMouseEnter"], ["onMouseLeave"]]
|
|
313
257
|
});
|
|
314
|
-
function List(
|
|
315
|
-
var _ref2 = arguments[0],
|
|
316
|
-
var styles =
|
|
317
|
-
var SDropdownMenuList =
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
}
|
|
325
|
-
"
|
|
326
|
-
})
|
|
327
|
-
"orientation": "horizontal"
|
|
328
|
-
})), /* @__PURE__ */ React.createElement(SBar, _ref1.cn("SBar", {
|
|
329
|
-
"orientation": "vertical"
|
|
330
|
-
}))));
|
|
258
|
+
function List(_ref23) {
|
|
259
|
+
var _ref2 = arguments[0], _ref14;
|
|
260
|
+
var styles = _ref23.styles, Children = _ref23.Children;
|
|
261
|
+
var SDropdownMenuList = ScrollAreaComponent;
|
|
262
|
+
return _ref14 = sstyled$1(styles), /* @__PURE__ */ React.createElement(ListBoxContextProvider, _ref14.cn("ListBoxContextProvider", {}), /* @__PURE__ */ React.createElement(SDropdownMenuList, _ref14.cn("SDropdownMenuList", _objectSpread({}, assignProps({
|
|
263
|
+
"shadow": true
|
|
264
|
+
}, _ref2))), /* @__PURE__ */ React.createElement(ScrollAreaComponent.Container, {
|
|
265
|
+
tabIndex: void 0
|
|
266
|
+
}, /* @__PURE__ */ React.createElement(Children, _ref14.cn("Children", {}))), /* @__PURE__ */ React.createElement(ScrollAreaComponent.Bar, {
|
|
267
|
+
orientation: "horizontal"
|
|
268
|
+
}), /* @__PURE__ */ React.createElement(ScrollAreaComponent.Bar, {
|
|
269
|
+
orientation: "vertical"
|
|
270
|
+
})));
|
|
331
271
|
}
|
|
332
|
-
function Actions(
|
|
333
|
-
var _ref3 = arguments[0],
|
|
334
|
-
var styles =
|
|
272
|
+
function Actions(_ref24) {
|
|
273
|
+
var _ref3 = arguments[0], _ref15;
|
|
274
|
+
var styles = _ref24.styles;
|
|
335
275
|
var SDropdownMenuActions = Flex;
|
|
336
|
-
return
|
|
276
|
+
return _ref15 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SDropdownMenuActions, _ref15.cn("SDropdownMenuActions", _objectSpread({}, assignProps({}, _ref3))));
|
|
337
277
|
}
|
|
338
278
|
function Menu(props) {
|
|
339
279
|
var _ref4 = arguments[0];
|
|
@@ -351,20 +291,18 @@ function Menu(props) {
|
|
|
351
291
|
role: null
|
|
352
292
|
}), /* @__PURE__ */ React.createElement(DropdownMenu.List, assignProps({}, _ref4))));
|
|
353
293
|
}
|
|
354
|
-
function Item(
|
|
355
|
-
var _ref5 = arguments[0],
|
|
356
|
-
var id =
|
|
294
|
+
function Item(_ref25) {
|
|
295
|
+
var _ref5 = arguments[0], _ref16;
|
|
296
|
+
var id = _ref25.id, styles = _ref25.styles, disabled = _ref25.disabled, Children = _ref25.Children, forwardRef = _ref25.forwardRef, role = _ref25.role, tabIndex = _ref25.tabIndex, actionsRef = _ref25.actionsRef, ariaChecked = _ref25["aria-checked"];
|
|
357
297
|
var SDropdownMenuItemContainer = Dropdown.Item;
|
|
358
298
|
var itemRef = React.useRef();
|
|
359
299
|
var _React$useState = React.useState(false), _React$useState2 = _slicedToArray(_React$useState, 2), highlighted = _React$useState2[0], setHighlighted = _React$useState2[1];
|
|
360
300
|
var menuItemContextValue = {
|
|
361
301
|
contentId: id,
|
|
362
|
-
ref: itemRef,
|
|
363
|
-
forwardRef,
|
|
302
|
+
ref: forkRef(forwardRef, itemRef),
|
|
364
303
|
role,
|
|
365
304
|
tabIndex,
|
|
366
|
-
ariaChecked
|
|
367
|
-
disabled
|
|
305
|
+
ariaChecked
|
|
368
306
|
};
|
|
369
307
|
var ariaDescribes = [];
|
|
370
308
|
var hasSubMenu = isAdvanceMode(Children, [DropdownMenu.displayName], true);
|
|
@@ -410,30 +348,33 @@ function Item(_ref18) {
|
|
|
410
348
|
capture: true
|
|
411
349
|
});
|
|
412
350
|
};
|
|
413
|
-
});
|
|
414
|
-
|
|
351
|
+
}, [itemRef.current]);
|
|
352
|
+
var focusSourceRef = useFocusSource();
|
|
353
|
+
return _ref16 = sstyled$1(styles), /* @__PURE__ */ React.createElement(menuItemContext.Provider, {
|
|
415
354
|
value: menuItemContextValue
|
|
416
|
-
}, /* @__PURE__ */ React.createElement(SDropdownMenuItemContainer,
|
|
417
|
-
"ref": advancedMode ? void 0 :
|
|
418
|
-
"use:highlighted": !disabled && highlighted &&
|
|
355
|
+
}, /* @__PURE__ */ React.createElement(SDropdownMenuItemContainer, _ref16.cn("SDropdownMenuItemContainer", _objectSpread({}, assignProps({
|
|
356
|
+
"ref": advancedMode ? void 0 : menuItemContextValue.ref,
|
|
357
|
+
"use:highlighted": !disabled && highlighted && focusSourceRef.current === "keyboard",
|
|
419
358
|
"use:role": advancedMode ? void 0 : role,
|
|
420
359
|
"use:id": advancedMode ? void 0 : id,
|
|
421
360
|
"use:tabIndex": advancedMode ? void 0 : tabIndex,
|
|
422
361
|
"use:aria-checked": advancedMode ? void 0 : ariaChecked
|
|
423
|
-
}, _ref5))), /* @__PURE__ */ React.createElement(Children,
|
|
362
|
+
}, _ref5))), /* @__PURE__ */ React.createElement(Children, _ref16.cn("Children", {}))));
|
|
424
363
|
}
|
|
425
364
|
function Addon(props) {
|
|
426
|
-
var
|
|
427
|
-
var
|
|
428
|
-
return
|
|
365
|
+
var _useBox = useBox(props, props.forwardRef), _useBox2 = _slicedToArray(_useBox, 2), SDropdownMenuItemAddon = _useBox2[0], _useBox2$ = _useBox2[1], className = _useBox2$.className, other = _objectWithoutProperties(_useBox2$, _excluded);
|
|
366
|
+
var styles = sstyled$1(props.styles);
|
|
367
|
+
return /* @__PURE__ */ React.createElement(SDropdownMenuItemAddon, _extends({
|
|
368
|
+
className: cn(styles.cn("SDropdownMenuItemAddon", props).className, className) || void 0
|
|
369
|
+
}, other));
|
|
429
370
|
}
|
|
430
371
|
function Trigger() {
|
|
431
|
-
var
|
|
432
|
-
return /* @__PURE__ */ React.createElement(Dropdown.Trigger, assignProps({},
|
|
372
|
+
var _ref6 = arguments[0];
|
|
373
|
+
return /* @__PURE__ */ React.createElement(Dropdown.Trigger, assignProps({}, _ref6));
|
|
433
374
|
}
|
|
434
|
-
function ItemContent(
|
|
435
|
-
var
|
|
436
|
-
var styles =
|
|
375
|
+
function ItemContent(_ref26) {
|
|
376
|
+
var _ref7 = arguments[0], _ref17;
|
|
377
|
+
var styles = _ref26.styles;
|
|
437
378
|
var SItemContent = Flex;
|
|
438
379
|
var ref = React.useRef();
|
|
439
380
|
var menuItemCtxValue = React.useContext(menuItemContext);
|
|
@@ -452,46 +393,69 @@ function ItemContent(_ref19) {
|
|
|
452
393
|
});
|
|
453
394
|
}
|
|
454
395
|
}, [menuItemCtxValue.ariaDescribes]);
|
|
455
|
-
return
|
|
396
|
+
return _ref17 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SItemContent, _ref17.cn("SItemContent", _objectSpread({}, assignProps({
|
|
456
397
|
"role": menuItemCtxValue.role,
|
|
457
398
|
"id": menuItemCtxValue.contentId,
|
|
458
399
|
"tabIndex": menuItemCtxValue.tabIndex,
|
|
459
|
-
"ref": forkRef(menuItemCtxValue.ref,
|
|
400
|
+
"ref": forkRef(menuItemCtxValue.ref, ref),
|
|
460
401
|
"use:aria-describedby": _toConsumableArray(describedby).join(" "),
|
|
461
402
|
"aria-haspopup": menuItemCtxValue.hasSubMenu ? "true" : void 0,
|
|
462
403
|
"aria-expanded": subMenu,
|
|
463
404
|
"aria-checked": menuItemCtxValue.ariaChecked,
|
|
464
405
|
"alignItems": "center",
|
|
465
|
-
"justifyContent": menuItemCtxValue.hasSubMenu ? "space-between" : void 0
|
|
466
|
-
|
|
467
|
-
}, _ref8))));
|
|
406
|
+
"justifyContent": menuItemCtxValue.hasSubMenu ? "space-between" : void 0
|
|
407
|
+
}, _ref7))));
|
|
468
408
|
}
|
|
469
|
-
function ItemContentText(
|
|
470
|
-
var
|
|
471
|
-
var styles =
|
|
409
|
+
function ItemContentText(_ref27) {
|
|
410
|
+
var _ref8 = arguments[0], _ref18;
|
|
411
|
+
var styles = _ref27.styles;
|
|
472
412
|
var SItemContentText = Text;
|
|
473
|
-
|
|
474
|
-
return _ref14 = sstyled(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SItemContentText, _ref14.cn("SItemContentText", _objectSpread({}, assignProps({
|
|
475
|
-
"ellipsis": ellipsis,
|
|
476
|
-
"hint:triggerRef": menuItemCtxValue.ref,
|
|
477
|
-
"hint:placement": "right"
|
|
478
|
-
}, _ref9)))));
|
|
413
|
+
return _ref18 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SItemContentText, _ref18.cn("SItemContentText", _objectSpread({}, assignProps({}, _ref8))));
|
|
479
414
|
}
|
|
480
|
-
function ItemHint(
|
|
481
|
-
var
|
|
482
|
-
var styles =
|
|
415
|
+
function ItemHint(_ref28) {
|
|
416
|
+
var _ref9 = arguments[0], _ref19;
|
|
417
|
+
var styles = _ref28.styles;
|
|
483
418
|
var SItemHint = Flex;
|
|
484
419
|
var _React$useContext = React.useContext(menuItemContext), hintId = _React$useContext.hintId;
|
|
485
|
-
return
|
|
420
|
+
return _ref19 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SItemHint, _ref19.cn("SItemHint", _objectSpread({}, assignProps({
|
|
486
421
|
"id": hintId,
|
|
487
422
|
"aria-hidden": "true"
|
|
488
|
-
},
|
|
423
|
+
}, _ref9))));
|
|
424
|
+
}
|
|
425
|
+
function Hint(props) {
|
|
426
|
+
var _ref10 = arguments[0], _ref20;
|
|
427
|
+
var SDropdownMenuItemContainer = Dropdown.Item;
|
|
428
|
+
return _ref20 = sstyled$1(props.styles), /* @__PURE__ */ React.createElement(SDropdownMenuItemContainer, _ref20.cn("SDropdownMenuItemContainer", _objectSpread({}, assignProps({
|
|
429
|
+
"variant": "hint"
|
|
430
|
+
}, _ref10))));
|
|
431
|
+
}
|
|
432
|
+
function Title(props) {
|
|
433
|
+
var _ref11 = arguments[0], _ref21;
|
|
434
|
+
var SDropdownMenuItemContainer = Dropdown.Item;
|
|
435
|
+
return _ref21 = sstyled$1(props.styles), /* @__PURE__ */ React.createElement(SDropdownMenuItemContainer, _ref21.cn("SDropdownMenuItemContainer", _objectSpread({}, assignProps({
|
|
436
|
+
"variant": "title"
|
|
437
|
+
}, _ref11))));
|
|
438
|
+
}
|
|
439
|
+
function Nesting(_ref29) {
|
|
440
|
+
var _ref12 = arguments[0];
|
|
441
|
+
var forwardRef = _ref29.forwardRef;
|
|
442
|
+
return /* @__PURE__ */ React.createElement(DropdownMenu.Item, assignProps({
|
|
443
|
+
"ref": forwardRef
|
|
444
|
+
}, _ref12));
|
|
445
|
+
}
|
|
446
|
+
function NestingTrigger(_ref30) {
|
|
447
|
+
var _ref13 = arguments[0];
|
|
448
|
+
var forwardRef = _ref30.forwardRef;
|
|
449
|
+
return /* @__PURE__ */ React.createElement(DropdownMenu.Item.Content, assignProps({
|
|
450
|
+
"tag": DropdownMenu.Trigger,
|
|
451
|
+
"ref": forwardRef,
|
|
452
|
+
"use:role": "menuitem"
|
|
453
|
+
}, _ref13));
|
|
489
454
|
}
|
|
490
455
|
var DropdownMenu = createComponent(DropdownMenuRoot, {
|
|
491
456
|
Trigger,
|
|
492
457
|
Popper: Dropdown.Popper,
|
|
493
458
|
List,
|
|
494
|
-
VirtualList,
|
|
495
459
|
Actions,
|
|
496
460
|
Menu,
|
|
497
461
|
Item: [Item, {
|
|
@@ -500,6 +464,15 @@ var DropdownMenu = createComponent(DropdownMenuRoot, {
|
|
|
500
464
|
Text: ItemContentText,
|
|
501
465
|
Hint: ItemHint
|
|
502
466
|
}],
|
|
467
|
+
/**
|
|
468
|
+
* @deprecated. Use just Item. See examples on
|
|
469
|
+
*/
|
|
470
|
+
Nesting: [Nesting, {
|
|
471
|
+
Trigger: NestingTrigger,
|
|
472
|
+
Addon
|
|
473
|
+
}],
|
|
474
|
+
ItemTitle: Title,
|
|
475
|
+
ItemHint: Hint,
|
|
503
476
|
Group: Dropdown.Group
|
|
504
477
|
}, {
|
|
505
478
|
parent: [Dropdown]
|