@semcore/dropdown-menu 16.2.2 → 17.0.0-prerelease.18
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/CHANGELOG.md +6 -0
- package/lib/cjs/DropdownMenu.js +394 -467
- package/lib/cjs/DropdownMenu.js.map +1 -1
- package/lib/cjs/components/Context.js +8 -8
- package/lib/cjs/components/Context.js.map +1 -1
- package/lib/cjs/components/VirtualList.js +98 -115
- package/lib/cjs/components/VirtualList.js.map +1 -1
- package/lib/cjs/index.d.js.map +1 -1
- package/lib/cjs/index.js +3 -3
- package/lib/cjs/style/dropdown-menu.shadow.css +1 -1
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +16 -16
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/DropdownMenu.js +378 -455
- package/lib/es6/DropdownMenu.js.map +1 -1
- package/lib/es6/components/Context.js +6 -7
- package/lib/es6/components/Context.js.map +1 -1
- package/lib/es6/components/VirtualList.js +95 -112
- package/lib/es6/components/VirtualList.js.map +1 -1
- package/lib/es6/index.d.js.map +1 -1
- package/lib/es6/style/dropdown-menu.shadow.css +1 -1
- package/lib/es6/translations/__intergalactic-dynamic-locales.js +15 -15
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/esm/DropdownMenu.mjs +363 -374
- package/lib/esm/components/Context.mjs +6 -7
- package/lib/esm/components/VirtualList.mjs +97 -99
- package/lib/esm/style/dropdown-menu.shadow.css +1 -1
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +1 -1
- package/lib/types/index.d.ts +3 -79
- package/package.json +11 -13
package/lib/esm/DropdownMenu.mjs
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
5
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
6
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
7
|
-
import _callSuper from "@babel/runtime/helpers/esm/callSuper";
|
|
8
|
-
import _superPropGet from "@babel/runtime/helpers/esm/superPropGet";
|
|
9
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
10
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
11
3
|
import { createComponent, sstyled, assignProps, lastInteraction } from "@semcore/core";
|
|
4
|
+
import { Flex, Box, ScrollArea } from "@semcore/base-components";
|
|
12
5
|
import ButtonComponent from "@semcore/button";
|
|
13
6
|
import { callAllEventHandlers } from "@semcore/core/lib/utils/assignProps";
|
|
14
7
|
import { isAdvanceMode } from "@semcore/core/lib/utils/findComponent";
|
|
@@ -17,279 +10,265 @@ import { setFocus } from "@semcore/core/lib/utils/focus-lock/setFocus";
|
|
|
17
10
|
import { forkRef } from "@semcore/core/lib/utils/ref";
|
|
18
11
|
import { useUID } from "@semcore/core/lib/utils/uniqueID";
|
|
19
12
|
import Dropdown, { enhance, selectedIndexContext, AbstractDropdown } from "@semcore/dropdown";
|
|
20
|
-
import { Box, Flex } from "@semcore/flex-box";
|
|
21
|
-
import ScrollAreaComponent from "@semcore/scroll-area";
|
|
22
13
|
import { Text } from "@semcore/typography";
|
|
23
14
|
import React from "react";
|
|
24
15
|
import { ListBoxContextProvider } from "./components/Context.mjs";
|
|
25
16
|
import { VirtualList } from "./components/VirtualList.mjs";
|
|
26
17
|
import { localizedMessages } from "./translations/__intergalactic-dynamic-locales.mjs";
|
|
27
18
|
/*!__reshadow-styles__:"./style/dropdown-menu.shadow.css"*/
|
|
28
|
-
|
|
19
|
+
const style = (
|
|
29
20
|
/*__reshadow_css_start__*/
|
|
30
21
|
(sstyled.insert(
|
|
31
22
|
/*__inner_css_start__*/
|
|
32
|
-
".
|
|
23
|
+
".___SDropdownMenuList_1r615_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, #191b23)}.___SDropdownMenuList_1r615_gg_ .___SBar_1r615_gg_{z-index:3}.___SDropdownMenuList_1r615_gg_ .___SShadowHorizontal_1r615_gg_:after,.___SDropdownMenuList_1r615_gg_ .___SShadowHorizontal_1r615_gg_:before,.___SDropdownMenuList_1r615_gg_ .___SShadowVertical_1r615_gg_:after,.___SDropdownMenuList_1r615_gg_ .___SShadowVertical_1r615_gg_:before{border-radius:var(--intergalactic-control-rounded, 6px)}.___SDropdownMenuItemContainer_1r615_gg_ .___SItemContent_1r615_gg_:focus-visible{outline:0}.___SDropdownMenuItemContainer_1r615_gg_.__nesting-trigger_1r615_gg_{justify-content:space-between}.___SDropdownMenuItemAddon_1r615_gg_,.___SItemContentText_1r615_gg_{display:inline-flex;margin-left:var(--intergalactic-spacing-1x, 4px);margin-right:var(--intergalactic-spacing-1x, 4px)}.___SDropdownMenuItemAddon_1r615_gg_:first-child,.___SItemContentText_1r615_gg_:first-child{margin-left:0}.___SDropdownMenuItemAddon_1r615_gg_:last-child,.___SItemContentText_1r615_gg_:last-child{margin-right:0}.___SDropdownMenuNesting_1r615_gg_,.___SDropdownMenuNesting_1r615_gg_._size_l_1r615_gg_,.___SDropdownMenuNesting_1r615_gg_._size_m_1r615_gg_{padding:0}.___SDropdownMenuNesting_1r615_gg_.__highlighted_1r615_gg_{z-index:1;outline-color:var(--intergalactic-keyboard-focus-outline, #008ff8);outline-style:solid;outline-width:2px;outline-offset:-2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;transition-property:outline-color,outline-width,outline-offset}.___SDropdownNestingItem_1r615_gg_._size_l_1r615_gg_,.___SDropdownNestingItem_1r615_gg_._size_m_1r615_gg_{padding-right:0}.___SDropdownNestingItem_1r615_gg_ .___SDropdownMenuItemContainer_1r615_gg_{width:auto;padding-top:0;padding-bottom:0;padding-left:0;min-height:auto}.___SItemHint_1r615_gg_{color:var(--intergalactic-text-secondary, #6c6e79)}",
|
|
33
24
|
/*__inner_css_end__*/
|
|
34
|
-
"
|
|
25
|
+
"1r615_gg_"
|
|
35
26
|
), /*__reshadow_css_end__*/
|
|
36
27
|
{
|
|
37
|
-
"__SDropdownMenuItemContainer": "
|
|
38
|
-
"_nesting-trigger": "__nesting-
|
|
39
|
-
"__SDropdownMenuNesting": "
|
|
40
|
-
"_size_l": "
|
|
41
|
-
"_size_m": "
|
|
42
|
-
"_highlighted": "
|
|
43
|
-
"__SDropdownNestingItem": "
|
|
44
|
-
"__SItemHint": "
|
|
45
|
-
"__SDropdownMenuList": "
|
|
46
|
-
"__SBar": "
|
|
47
|
-
"__SShadowHorizontal": "
|
|
48
|
-
"__SShadowVertical": "
|
|
49
|
-
"__SItemContent": "
|
|
50
|
-
"__SDropdownMenuItemAddon": "
|
|
51
|
-
"__SItemContentText": "
|
|
28
|
+
"__SDropdownMenuItemContainer": "___SDropdownMenuItemContainer_1r615_gg_",
|
|
29
|
+
"_nesting-trigger": "__nesting-trigger_1r615_gg_",
|
|
30
|
+
"__SDropdownMenuNesting": "___SDropdownMenuNesting_1r615_gg_",
|
|
31
|
+
"_size_l": "_size_l_1r615_gg_",
|
|
32
|
+
"_size_m": "_size_m_1r615_gg_",
|
|
33
|
+
"_highlighted": "__highlighted_1r615_gg_",
|
|
34
|
+
"__SDropdownNestingItem": "___SDropdownNestingItem_1r615_gg_",
|
|
35
|
+
"__SItemHint": "___SItemHint_1r615_gg_",
|
|
36
|
+
"__SDropdownMenuList": "___SDropdownMenuList_1r615_gg_",
|
|
37
|
+
"__SBar": "___SBar_1r615_gg_",
|
|
38
|
+
"__SShadowHorizontal": "___SShadowHorizontal_1r615_gg_",
|
|
39
|
+
"__SShadowVertical": "___SShadowVertical_1r615_gg_",
|
|
40
|
+
"__SItemContent": "___SItemContent_1r615_gg_",
|
|
41
|
+
"__SDropdownMenuItemAddon": "___SDropdownMenuItemAddon_1r615_gg_",
|
|
42
|
+
"__SItemContentText": "___SItemContentText_1r615_gg_"
|
|
52
43
|
})
|
|
53
44
|
);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
_this = _callSuper(this, DropdownMenuRoot2, [].concat(args));
|
|
63
|
-
_defineProperty(_this, "actionsRef", /* @__PURE__ */ React.createRef());
|
|
64
|
-
_defineProperty(_this, "role", "menu");
|
|
65
|
-
_defineProperty(_this, "shouldRecalculateItemTabIndex", false);
|
|
66
|
-
return _this;
|
|
45
|
+
const menuItemContext = /* @__PURE__ */ React.createContext({});
|
|
46
|
+
class DropdownMenuRoot extends AbstractDropdown {
|
|
47
|
+
constructor(...args) {
|
|
48
|
+
super(...args);
|
|
49
|
+
_defineProperty(this, "actionsRef", /* @__PURE__ */ React.createRef());
|
|
50
|
+
_defineProperty(this, "role", "menu");
|
|
51
|
+
_defineProperty(this, "shouldRecalculateItemTabIndex", false);
|
|
67
52
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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])');
|
|
53
|
+
uncontrolledProps() {
|
|
54
|
+
return {
|
|
55
|
+
...super.uncontrolledProps(),
|
|
56
|
+
visible: [null, (visible) => {
|
|
57
|
+
if (visible === true) {
|
|
58
|
+
setTimeout(() => {
|
|
59
|
+
this.focusAndScrollToSelected();
|
|
60
|
+
}, 50);
|
|
61
|
+
}
|
|
62
|
+
}]
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
get menuElements() {
|
|
66
|
+
const menuElement = this.menuRef.current;
|
|
67
|
+
if (!menuElement) {
|
|
95
68
|
return {
|
|
96
|
-
selected,
|
|
97
|
-
options
|
|
69
|
+
selected: null,
|
|
70
|
+
options: null
|
|
98
71
|
};
|
|
99
72
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
73
|
+
const options = menuElement.querySelectorAll('[role="menuitemcheckbox"], [role="menuitemradio"]');
|
|
74
|
+
const selected = menuElement.querySelector('[aria-checked="true"]:not([disabled])');
|
|
75
|
+
return {
|
|
76
|
+
selected,
|
|
77
|
+
options
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
focusAndScrollToSelected() {
|
|
81
|
+
var _a;
|
|
82
|
+
let {
|
|
83
|
+
selected,
|
|
84
|
+
options
|
|
85
|
+
} = this.menuElements;
|
|
86
|
+
const isFocusAlreadyInPopper = isFocusInside(this.popperRef.current);
|
|
87
|
+
if (!selected || !options || ((_a = this.menuRef.current) == null ? void 0 : _a.dataset.isVirtual) || isFocusAlreadyInPopper) return;
|
|
88
|
+
this.scrollToNodeAsync(selected, true).then(() => {
|
|
89
|
+
if (this.asProps.visible) {
|
|
90
|
+
selected.focus({
|
|
91
|
+
preventScroll: true
|
|
92
|
+
});
|
|
117
93
|
}
|
|
94
|
+
});
|
|
95
|
+
const selectedIndex = Array.from(options).indexOf(selected);
|
|
96
|
+
if (selectedIndex !== -1) {
|
|
97
|
+
this.handlers.highlightedIndex(selectedIndex);
|
|
118
98
|
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
99
|
+
}
|
|
100
|
+
afterOpenPopper() {
|
|
101
|
+
var _a;
|
|
102
|
+
const {
|
|
103
|
+
selected,
|
|
104
|
+
options
|
|
105
|
+
} = this.menuElements;
|
|
106
|
+
if (selected && options && !((_a = this.menuRef.current) == null ? void 0 : _a.dataset.isVirtual)) return;
|
|
107
|
+
super.afterOpenPopper();
|
|
108
|
+
}
|
|
109
|
+
itemRef(props, index, node) {
|
|
110
|
+
super.itemRef(props, index, node);
|
|
111
|
+
if (node === document.activeElement) {
|
|
112
|
+
super.scrollToNode(node);
|
|
134
113
|
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
114
|
+
}
|
|
115
|
+
getTriggerProps() {
|
|
116
|
+
const {
|
|
117
|
+
Children,
|
|
118
|
+
uid,
|
|
119
|
+
visible
|
|
120
|
+
} = this.asProps;
|
|
121
|
+
const hasMenu = isAdvanceMode(Children, [DropdownMenu.Menu.displayName]);
|
|
122
|
+
const ariaControls = hasMenu ? `igc-${uid}-list` : `igc-${uid}-popper`;
|
|
123
|
+
return {
|
|
124
|
+
...super.getTriggerProps(),
|
|
125
|
+
"onKeyDown": callAllEventHandlers(this.handlePreventCommonKeyDown.bind(this), this.handleOpenKeyDown.bind(this), this.handleKeyDownForMenu("trigger")),
|
|
126
|
+
"aria-controls": visible ? ariaControls : void 0,
|
|
127
|
+
"aria-haspopup": hasMenu ? "true" : "dialog"
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
getListProps() {
|
|
131
|
+
return {
|
|
132
|
+
...super.getListProps(),
|
|
133
|
+
onKeyDown: callAllEventHandlers(this.handlePreventCommonKeyDown.bind(this), this.handleKeyDownForMenu("list"), this.handleArrowKeyDown.bind(this))
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
getVirtualListProps() {
|
|
137
|
+
return {
|
|
138
|
+
...super.getListProps(),
|
|
139
|
+
onKeyDown: callAllEventHandlers(this.handlePreventCommonKeyDown.bind(this), this.handleKeyDownForMenu("list"), this.handleArrowKeyDown.bind(this))
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
getPopperProps() {
|
|
143
|
+
return {
|
|
144
|
+
...super.getPopperProps(),
|
|
145
|
+
onKeyDown: callAllEventHandlers(this.handlePreventCommonKeyDown.bind(this), this.handlePreventPopperKeyDown.bind(this))
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
getActionsProps() {
|
|
149
|
+
return {
|
|
150
|
+
...this.getListProps(),
|
|
151
|
+
ref: this.actionsRef,
|
|
152
|
+
onKeyDown: callAllEventHandlers(this.handlePreventTabOnActions.bind(this), this.handlePreventCommonKeyDown.bind(this), this.handleKeyDownForMenu("list"), this.handleArrowKeyDown.bind(this))
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
getItemTabIndex(props, itemIndex) {
|
|
156
|
+
const {
|
|
157
|
+
disabled,
|
|
158
|
+
index
|
|
159
|
+
} = props;
|
|
160
|
+
const {
|
|
161
|
+
highlightedIndex,
|
|
162
|
+
visible
|
|
163
|
+
} = this.asProps;
|
|
164
|
+
if (!visible) return -1;
|
|
165
|
+
const isHighlighted = (index ?? itemIndex) === highlightedIndex;
|
|
166
|
+
if (isHighlighted && !disabled) {
|
|
167
|
+
return 0;
|
|
146
168
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
value: function getListProps() {
|
|
150
|
-
return _objectSpread(_objectSpread({}, _superPropGet(DropdownMenuRoot2, "getListProps", this, 3)([])), {}, {
|
|
151
|
-
onKeyDown: callAllEventHandlers(this.handlePreventCommonKeyDown.bind(this), this.handleKeyDownForMenu("list"), this.handleArrowKeyDown.bind(this))
|
|
152
|
-
});
|
|
169
|
+
if (disabled && isHighlighted) {
|
|
170
|
+
this.shouldRecalculateItemTabIndex = true;
|
|
153
171
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
return _objectSpread(_objectSpread({}, _superPropGet(DropdownMenuRoot2, "getListProps", this, 3)([])), {}, {
|
|
158
|
-
onKeyDown: callAllEventHandlers(this.handlePreventCommonKeyDown.bind(this), this.handleKeyDownForMenu("list"), this.handleArrowKeyDown.bind(this))
|
|
159
|
-
});
|
|
172
|
+
if (!isHighlighted && !disabled && this.shouldRecalculateItemTabIndex) {
|
|
173
|
+
this.shouldRecalculateItemTabIndex = false;
|
|
174
|
+
return 0;
|
|
160
175
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
176
|
+
return -1;
|
|
177
|
+
}
|
|
178
|
+
getItemProps(props, index) {
|
|
179
|
+
const realIndex = props.index ?? index;
|
|
180
|
+
const itemProps = {
|
|
181
|
+
...super.getItemProps(props, realIndex),
|
|
182
|
+
tabIndex: this.getItemTabIndex(props, index),
|
|
183
|
+
ref: (node) => this.itemRef(props, realIndex, node),
|
|
184
|
+
actionsRef: this.actionsRef
|
|
185
|
+
};
|
|
186
|
+
if (props.tag === ButtonComponent) {
|
|
187
|
+
itemProps.use = props.use ?? "tertiary";
|
|
188
|
+
itemProps.theme = props.theme ?? "muted";
|
|
189
|
+
itemProps.size = props.size ?? "s";
|
|
190
|
+
itemProps.innerOutline = false;
|
|
167
191
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
value: function getActionsProps() {
|
|
171
|
-
return _objectSpread(_objectSpread({}, this.getListProps()), {}, {
|
|
172
|
-
ref: this.actionsRef,
|
|
173
|
-
onKeyDown: callAllEventHandlers(this.handlePreventTabOnActions.bind(this), this.handlePreventCommonKeyDown.bind(this), this.handleKeyDownForMenu("list"), this.handleArrowKeyDown.bind(this))
|
|
174
|
-
});
|
|
192
|
+
if (props.selected) {
|
|
193
|
+
itemProps["aria-checked"] = true;
|
|
175
194
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
var _this$asProps2 = this.asProps, highlightedIndex = _this$asProps2.highlightedIndex, visible = _this$asProps2.visible;
|
|
181
|
-
if (!visible) return -1;
|
|
182
|
-
var isHighlighted = (index !== null && index !== void 0 ? index : itemIndex) === highlightedIndex;
|
|
183
|
-
if (isHighlighted && !disabled) {
|
|
184
|
-
return 0;
|
|
185
|
-
}
|
|
186
|
-
if (disabled && isHighlighted) {
|
|
187
|
-
this.shouldRecalculateItemTabIndex = true;
|
|
188
|
-
}
|
|
189
|
-
if (!isHighlighted && !disabled && this.shouldRecalculateItemTabIndex) {
|
|
190
|
-
this.shouldRecalculateItemTabIndex = false;
|
|
191
|
-
return 0;
|
|
192
|
-
}
|
|
193
|
-
return -1;
|
|
195
|
+
if (super.childRole === "menuitemradio") {
|
|
196
|
+
itemProps.onClick = () => {
|
|
197
|
+
this.handlers.visible(false);
|
|
198
|
+
};
|
|
194
199
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
var
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
var _props$use, _props$theme, _props$size;
|
|
209
|
-
itemProps.use = (_props$use = props.use) !== null && _props$use !== void 0 ? _props$use : "tertiary";
|
|
210
|
-
itemProps.theme = (_props$theme = props.theme) !== null && _props$theme !== void 0 ? _props$theme : "muted";
|
|
211
|
-
itemProps.size = (_props$size = props.size) !== null && _props$size !== void 0 ? _props$size : "s";
|
|
212
|
-
itemProps.innerOutline = false;
|
|
213
|
-
}
|
|
214
|
-
if (props.selected) {
|
|
215
|
-
itemProps["aria-checked"] = true;
|
|
200
|
+
return itemProps;
|
|
201
|
+
}
|
|
202
|
+
handleKeyDownForMenu(place) {
|
|
203
|
+
return (e) => {
|
|
204
|
+
var _a, _b;
|
|
205
|
+
const {
|
|
206
|
+
visible,
|
|
207
|
+
placement,
|
|
208
|
+
inlineActions
|
|
209
|
+
} = this.asProps;
|
|
210
|
+
if (place === "list" && !((_a = this.menuRef.current) == null ? void 0 : _a.contains(e.target)) && !inlineActions) {
|
|
211
|
+
e.stopPropagation();
|
|
212
|
+
return false;
|
|
216
213
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
214
|
+
const show = e.key === "ArrowRight" && (placement == null ? void 0 : placement.startsWith("right")) || e.key === "ArrowLeft" && (placement == null ? void 0 : placement.startsWith("left")) || (e.key === "Enter" || e.key === " ") && !inlineActions;
|
|
215
|
+
const hide = e.key === "ArrowLeft" && (placement == null ? void 0 : placement.startsWith("right")) || e.key === "ArrowRight" && (placement == null ? void 0 : placement.startsWith("left")) || e.key === "Escape";
|
|
216
|
+
const isMenuItem = (_b = e.target.getAttribute("role")) == null ? void 0 : _b.startsWith(super.childRole);
|
|
217
|
+
if (place === "trigger" && show && isMenuItem) {
|
|
218
|
+
this.handlers.visible(true);
|
|
219
|
+
this.handlers.highlightedIndex(0);
|
|
220
|
+
setTimeout(() => {
|
|
221
|
+
var _a2;
|
|
222
|
+
let {
|
|
223
|
+
highlightedIndex
|
|
224
|
+
} = this.asProps;
|
|
225
|
+
const highlightedIndexProps = this.itemProps[highlightedIndex];
|
|
226
|
+
if (highlightedIndexProps == null ? void 0 : highlightedIndexProps.disabled) {
|
|
227
|
+
highlightedIndex = this.itemProps.findIndex((p) => !p.disabled);
|
|
228
|
+
}
|
|
229
|
+
if (highlightedIndex === -1) return;
|
|
230
|
+
(_a2 = this.itemRefs[highlightedIndex]) == null ? void 0 : _a2.focus();
|
|
231
|
+
}, 0);
|
|
232
|
+
e.preventDefault();
|
|
233
|
+
e.stopPropagation();
|
|
234
|
+
return false;
|
|
221
235
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
return function(e) {
|
|
229
|
-
var _this5$menuRef$curren, _e$target$getAttribut;
|
|
230
|
-
var _this5$asProps = _this5.asProps, visible = _this5$asProps.visible, placement = _this5$asProps.placement, inlineActions = _this5$asProps.inlineActions;
|
|
231
|
-
if (place === "list" && !((_this5$menuRef$curren = _this5.menuRef.current) !== null && _this5$menuRef$curren !== void 0 && _this5$menuRef$curren.contains(e.target)) && !inlineActions) {
|
|
232
|
-
e.stopPropagation();
|
|
233
|
-
return false;
|
|
234
|
-
}
|
|
235
|
-
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")) || (e.key === "Enter" || e.key === " ") && !inlineActions;
|
|
236
|
-
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";
|
|
237
|
-
var isMenuItem = (_e$target$getAttribut = e.target.getAttribute("role")) === null || _e$target$getAttribut === void 0 ? void 0 : _e$target$getAttribut.startsWith(_superPropGet(DropdownMenuRoot2, "childRole", _this5, 1));
|
|
238
|
-
if (place === "trigger" && show && isMenuItem) {
|
|
239
|
-
_this5.handlers.visible(true);
|
|
240
|
-
_this5.handlers.highlightedIndex(0);
|
|
241
|
-
setTimeout(function() {
|
|
242
|
-
var _this5$itemRefs$highl;
|
|
243
|
-
var highlightedIndex = _this5.asProps.highlightedIndex;
|
|
244
|
-
var highlightedIndexProps = _this5.itemProps[highlightedIndex];
|
|
245
|
-
if (highlightedIndexProps !== null && highlightedIndexProps !== void 0 && highlightedIndexProps.disabled) {
|
|
246
|
-
highlightedIndex = _this5.itemProps.findIndex(function(p) {
|
|
247
|
-
return !p.disabled;
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
if (highlightedIndex === -1) return;
|
|
251
|
-
(_this5$itemRefs$highl = _this5.itemRefs[highlightedIndex]) === null || _this5$itemRefs$highl === void 0 || _this5$itemRefs$highl.focus();
|
|
252
|
-
}, 0);
|
|
236
|
+
if (place === "list" && visible && hide && isMenuItem) {
|
|
237
|
+
if (!inlineActions || inlineActions && (e.key === "Escape" || this.asProps.highlightedIndex === 0)) {
|
|
238
|
+
this.handlers.visible(false);
|
|
239
|
+
if (this.triggerRef.current) {
|
|
240
|
+
setFocus(this.triggerRef.current);
|
|
241
|
+
}
|
|
253
242
|
e.preventDefault();
|
|
254
243
|
e.stopPropagation();
|
|
255
244
|
return false;
|
|
256
245
|
}
|
|
257
|
-
if (place === "list" && visible && hide && isMenuItem) {
|
|
258
|
-
if (!inlineActions || inlineActions && (e.key === "Escape" || _this5.asProps.highlightedIndex === 0)) {
|
|
259
|
-
_this5.handlers.visible(false);
|
|
260
|
-
if (_this5.triggerRef.current) {
|
|
261
|
-
setFocus(_this5.triggerRef.current);
|
|
262
|
-
}
|
|
263
|
-
e.preventDefault();
|
|
264
|
-
e.stopPropagation();
|
|
265
|
-
return false;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
|
-
}
|
|
270
|
-
}, {
|
|
271
|
-
key: "handlePreventTabOnActions",
|
|
272
|
-
value: function handlePreventTabOnActions(e) {
|
|
273
|
-
if (e.key === "Tab") {
|
|
274
|
-
e.stopPropagation();
|
|
275
|
-
e.preventDefault();
|
|
276
|
-
return false;
|
|
277
246
|
}
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
handlePreventTabOnActions(e) {
|
|
250
|
+
if (e.key === "Tab") {
|
|
251
|
+
e.stopPropagation();
|
|
252
|
+
e.preventDefault();
|
|
253
|
+
return false;
|
|
278
254
|
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
255
|
+
}
|
|
256
|
+
render() {
|
|
257
|
+
var _ref = this.asProps;
|
|
258
|
+
const {
|
|
259
|
+
Children,
|
|
260
|
+
selectedIndex,
|
|
261
|
+
interaction,
|
|
262
|
+
timeout
|
|
263
|
+
} = this.asProps;
|
|
264
|
+
this.itemProps = [];
|
|
265
|
+
return /* @__PURE__ */ React.createElement(selectedIndexContext.Provider, {
|
|
266
|
+
value: selectedIndex
|
|
267
|
+
}, /* @__PURE__ */ React.createElement(Dropdown, assignProps({
|
|
268
|
+
"timeout": timeout || (interaction === "hover" ? [0, 100] : void 0)
|
|
269
|
+
}, _ref), /* @__PURE__ */ React.createElement(Children, null)));
|
|
270
|
+
}
|
|
271
|
+
}
|
|
293
272
|
_defineProperty(DropdownMenuRoot, "displayName", "DropdownMenu");
|
|
294
273
|
_defineProperty(DropdownMenuRoot, "style", style);
|
|
295
274
|
_defineProperty(DropdownMenuRoot, "enhance", Object.values(enhance));
|
|
@@ -309,33 +288,48 @@ _defineProperty(DropdownMenuRoot, "nestedMenuInteraction", {
|
|
|
309
288
|
trigger: [["onClick", "onMouseEnter"], ["onClick", "onMouseLeave"]],
|
|
310
289
|
popper: [["onMouseEnter"], ["onMouseLeave"]]
|
|
311
290
|
});
|
|
312
|
-
function List(
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
var
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
291
|
+
function List({
|
|
292
|
+
styles,
|
|
293
|
+
Children
|
|
294
|
+
}) {
|
|
295
|
+
var _ref2 = arguments[0], _ref1;
|
|
296
|
+
const SDropdownMenuList = ScrollArea;
|
|
297
|
+
const SBar = ScrollArea.Bar;
|
|
298
|
+
return _ref1 = sstyled(styles), /* @__PURE__ */ React.createElement(ListBoxContextProvider, _ref1.cn("ListBoxContextProvider", {}), /* @__PURE__ */ React.createElement(SDropdownMenuList, _ref1.cn("SDropdownMenuList", {
|
|
299
|
+
...assignProps({
|
|
300
|
+
"shadow": true,
|
|
301
|
+
"shadowSize": 16,
|
|
302
|
+
"shadowTheme": "light"
|
|
303
|
+
}, _ref2)
|
|
304
|
+
}), /* @__PURE__ */ React.createElement(ScrollArea.Container, {
|
|
322
305
|
tabIndex: void 0
|
|
323
|
-
}, /* @__PURE__ */ React.createElement(Children,
|
|
306
|
+
}, /* @__PURE__ */ React.createElement(Children, _ref1.cn("Children", {}))), /* @__PURE__ */ React.createElement(SBar, _ref1.cn("SBar", {
|
|
324
307
|
"orientation": "horizontal"
|
|
325
|
-
})), /* @__PURE__ */ React.createElement(SBar,
|
|
308
|
+
})), /* @__PURE__ */ React.createElement(SBar, _ref1.cn("SBar", {
|
|
326
309
|
"orientation": "vertical"
|
|
327
310
|
}))));
|
|
328
311
|
}
|
|
329
|
-
function Actions(
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
var
|
|
333
|
-
|
|
312
|
+
function Actions({
|
|
313
|
+
styles
|
|
314
|
+
}) {
|
|
315
|
+
var _ref3 = arguments[0], _ref10;
|
|
316
|
+
const SDropdownMenuActions = Flex;
|
|
317
|
+
return _ref10 = sstyled(styles), /* @__PURE__ */ React.createElement(SDropdownMenuActions, _ref10.cn("SDropdownMenuActions", {
|
|
318
|
+
...assignProps({}, _ref3)
|
|
319
|
+
}));
|
|
334
320
|
}
|
|
335
321
|
function Menu(props) {
|
|
336
322
|
var _ref4 = arguments[0];
|
|
337
|
-
|
|
338
|
-
|
|
323
|
+
const {
|
|
324
|
+
visible,
|
|
325
|
+
disablePortal,
|
|
326
|
+
ignorePortalsStacking,
|
|
327
|
+
disableEnforceFocus,
|
|
328
|
+
interaction,
|
|
329
|
+
autoFocus,
|
|
330
|
+
animationsDisabled
|
|
331
|
+
} = props;
|
|
332
|
+
const popperProps = {
|
|
339
333
|
visible,
|
|
340
334
|
disablePortal,
|
|
341
335
|
ignorePortalsStacking,
|
|
@@ -348,26 +342,36 @@ function Menu(props) {
|
|
|
348
342
|
role: null
|
|
349
343
|
}), /* @__PURE__ */ React.createElement(DropdownMenu.List, assignProps({}, _ref4))));
|
|
350
344
|
}
|
|
351
|
-
function Item(
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
345
|
+
function Item({
|
|
346
|
+
id,
|
|
347
|
+
styles,
|
|
348
|
+
disabled,
|
|
349
|
+
Children,
|
|
350
|
+
forwardRef,
|
|
351
|
+
role,
|
|
352
|
+
tabIndex,
|
|
353
|
+
actionsRef,
|
|
354
|
+
"aria-checked": ariaChecked
|
|
355
|
+
}) {
|
|
356
|
+
var _ref5 = arguments[0], _ref11;
|
|
357
|
+
const SDropdownMenuItemContainer = Dropdown.Item;
|
|
358
|
+
const itemRef = React.useRef();
|
|
359
|
+
const [highlighted, setHighlighted] = React.useState(false);
|
|
360
|
+
const menuItemContextValue = {
|
|
358
361
|
contentId: id,
|
|
359
|
-
ref:
|
|
362
|
+
ref: itemRef,
|
|
363
|
+
forwardRef,
|
|
360
364
|
role,
|
|
361
365
|
tabIndex,
|
|
362
366
|
ariaChecked,
|
|
363
367
|
disabled
|
|
364
368
|
};
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
+
const ariaDescribes = [];
|
|
370
|
+
const hasSubMenu = isAdvanceMode(Children, [DropdownMenu.displayName], true);
|
|
371
|
+
const hasHint = isAdvanceMode(Children, [DropdownMenu.Item.Hint.displayName], true);
|
|
372
|
+
const advancedMode = isAdvanceMode(Children, [DropdownMenu.Item.Content.displayName], true) || hasSubMenu || hasHint;
|
|
369
373
|
if (hasHint) {
|
|
370
|
-
|
|
374
|
+
const hintId = `igc-${useUID()}-option-hint`;
|
|
371
375
|
menuItemContextValue.hintId = hintId;
|
|
372
376
|
ariaDescribes.push(hintId);
|
|
373
377
|
}
|
|
@@ -375,8 +379,8 @@ function Item(_ref24) {
|
|
|
375
379
|
menuItemContextValue.hasSubMenu = true;
|
|
376
380
|
}
|
|
377
381
|
menuItemContextValue.ariaDescribes = ariaDescribes;
|
|
378
|
-
React.useEffect(
|
|
379
|
-
|
|
382
|
+
React.useEffect(() => {
|
|
383
|
+
const onFocus = (e) => {
|
|
380
384
|
if (e.target === itemRef.current) {
|
|
381
385
|
setHighlighted(true);
|
|
382
386
|
if (hasSubMenu) {
|
|
@@ -384,7 +388,7 @@ function Item(_ref24) {
|
|
|
384
388
|
}
|
|
385
389
|
}
|
|
386
390
|
};
|
|
387
|
-
|
|
391
|
+
const onBlur = (e) => {
|
|
388
392
|
if (e.target === itemRef.current) {
|
|
389
393
|
setHighlighted(false);
|
|
390
394
|
if (actionsRef.current) {
|
|
@@ -398,7 +402,7 @@ function Item(_ref24) {
|
|
|
398
402
|
document.addEventListener("blur", onBlur, {
|
|
399
403
|
capture: true
|
|
400
404
|
});
|
|
401
|
-
return
|
|
405
|
+
return () => {
|
|
402
406
|
document.removeEventListener("focus", onFocus, {
|
|
403
407
|
capture: true
|
|
404
408
|
});
|
|
@@ -406,109 +410,103 @@ function Item(_ref24) {
|
|
|
406
410
|
capture: true
|
|
407
411
|
});
|
|
408
412
|
};
|
|
409
|
-
}
|
|
410
|
-
return
|
|
413
|
+
});
|
|
414
|
+
return _ref11 = sstyled(styles), /* @__PURE__ */ React.createElement(menuItemContext.Provider, {
|
|
411
415
|
value: menuItemContextValue
|
|
412
|
-
}, /* @__PURE__ */ React.createElement(SDropdownMenuItemContainer,
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
416
|
+
}, /* @__PURE__ */ React.createElement(SDropdownMenuItemContainer, _ref11.cn("SDropdownMenuItemContainer", {
|
|
417
|
+
...assignProps({
|
|
418
|
+
"ref": advancedMode ? void 0 : forkRef(itemRef, forwardRef),
|
|
419
|
+
"use:highlighted": !disabled && highlighted && lastInteraction.isKeyboard(),
|
|
420
|
+
"use:role": advancedMode ? void 0 : role,
|
|
421
|
+
"use:id": advancedMode ? void 0 : id,
|
|
422
|
+
"use:tabIndex": advancedMode ? void 0 : tabIndex,
|
|
423
|
+
"use:aria-checked": advancedMode ? void 0 : ariaChecked
|
|
424
|
+
}, _ref5)
|
|
425
|
+
}), /* @__PURE__ */ React.createElement(Children, _ref11.cn("Children", {}))));
|
|
420
426
|
}
|
|
421
427
|
function Addon(props) {
|
|
422
|
-
var _ref6 = arguments[0],
|
|
423
|
-
|
|
424
|
-
return
|
|
428
|
+
var _ref6 = arguments[0], _ref12;
|
|
429
|
+
const SDropdownMenuItemAddon = Box;
|
|
430
|
+
return _ref12 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SDropdownMenuItemAddon, _ref12.cn("SDropdownMenuItemAddon", {
|
|
431
|
+
...assignProps({}, _ref6)
|
|
432
|
+
}));
|
|
425
433
|
}
|
|
426
434
|
function Trigger() {
|
|
427
435
|
var _ref7 = arguments[0];
|
|
428
436
|
return /* @__PURE__ */ React.createElement(Dropdown.Trigger, assignProps({}, _ref7));
|
|
429
437
|
}
|
|
430
|
-
function ItemContent(
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
var
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
438
|
+
function ItemContent({
|
|
439
|
+
styles
|
|
440
|
+
}) {
|
|
441
|
+
var _ref8 = arguments[0], _ref13;
|
|
442
|
+
const SItemContent = Flex;
|
|
443
|
+
const ref = React.useRef();
|
|
444
|
+
const menuItemCtxValue = React.useContext(menuItemContext);
|
|
445
|
+
let subMenu = void 0;
|
|
437
446
|
if (menuItemCtxValue.hasSubMenu) {
|
|
438
447
|
subMenu = "true";
|
|
439
448
|
}
|
|
440
|
-
|
|
441
|
-
React.useEffect(
|
|
442
|
-
|
|
443
|
-
|
|
449
|
+
const [describedby, setDescribedby] = React.useState(new Set(menuItemCtxValue.ariaDescribes));
|
|
450
|
+
React.useEffect(() => {
|
|
451
|
+
const element = ref.current;
|
|
452
|
+
const parent = element == null ? void 0 : element.parentElement;
|
|
444
453
|
if (parent.getAttribute("aria-haspopup") === "true" && parent.getAttribute("aria-describedby")) {
|
|
445
|
-
setDescribedby(
|
|
454
|
+
setDescribedby((prev) => {
|
|
446
455
|
prev.add(parent.getAttribute("aria-describedby"));
|
|
447
456
|
return new Set(prev);
|
|
448
457
|
});
|
|
449
458
|
}
|
|
450
459
|
}, [menuItemCtxValue.ariaDescribes]);
|
|
451
|
-
return
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
var _ref9 = arguments[0], _ref18;
|
|
467
|
-
var styles = _ref26.styles;
|
|
468
|
-
var SItemContentText = Text;
|
|
469
|
-
return _ref18 = sstyled(styles), /* @__PURE__ */ React.createElement(SItemContentText, _ref18.cn("SItemContentText", _objectSpread({}, assignProps({}, _ref9))));
|
|
470
|
-
}
|
|
471
|
-
function ItemHint(_ref27) {
|
|
472
|
-
var _ref0 = arguments[0], _ref19;
|
|
473
|
-
var styles = _ref27.styles;
|
|
474
|
-
var SItemHint = Flex;
|
|
475
|
-
var _React$useContext = React.useContext(menuItemContext), hintId = _React$useContext.hintId;
|
|
476
|
-
return _ref19 = sstyled(styles), /* @__PURE__ */ React.createElement(SItemHint, _ref19.cn("SItemHint", _objectSpread({}, assignProps({
|
|
477
|
-
"id": hintId,
|
|
478
|
-
"aria-hidden": "true"
|
|
479
|
-
}, _ref0))));
|
|
460
|
+
return _ref13 = sstyled(styles), /* @__PURE__ */ React.createElement(SItemContent, _ref13.cn("SItemContent", {
|
|
461
|
+
...assignProps({
|
|
462
|
+
"role": menuItemCtxValue.role,
|
|
463
|
+
"id": menuItemCtxValue.contentId,
|
|
464
|
+
"tabIndex": menuItemCtxValue.tabIndex,
|
|
465
|
+
"ref": forkRef(menuItemCtxValue.ref, menuItemCtxValue.forwardRef, ref),
|
|
466
|
+
"use:aria-describedby": [...describedby].join(" "),
|
|
467
|
+
"aria-haspopup": menuItemCtxValue.hasSubMenu ? "true" : void 0,
|
|
468
|
+
"aria-expanded": subMenu,
|
|
469
|
+
"aria-checked": menuItemCtxValue.ariaChecked,
|
|
470
|
+
"alignItems": "center",
|
|
471
|
+
"justifyContent": menuItemCtxValue.hasSubMenu ? "space-between" : void 0,
|
|
472
|
+
"disabled": menuItemCtxValue.disabled
|
|
473
|
+
}, _ref8)
|
|
474
|
+
}));
|
|
480
475
|
}
|
|
481
|
-
function
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
return /* @__PURE__ */ React.createElement(DropdownMenu.Item, assignProps({
|
|
499
|
-
"ref": forwardRef
|
|
500
|
-
}, _ref11));
|
|
476
|
+
function ItemContentText({
|
|
477
|
+
styles,
|
|
478
|
+
ellipsis = false,
|
|
479
|
+
hintProps = {}
|
|
480
|
+
}) {
|
|
481
|
+
var _ref9 = arguments[0], _ref14;
|
|
482
|
+
const SItemContentText = Text;
|
|
483
|
+
const menuItemCtxValue = React.useContext(menuItemContext);
|
|
484
|
+
if (menuItemCtxValue.ref) {
|
|
485
|
+
hintProps.triggerRef = menuItemCtxValue.ref;
|
|
486
|
+
}
|
|
487
|
+
return _ref14 = sstyled(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SItemContentText, _ref14.cn("SItemContentText", {
|
|
488
|
+
...assignProps({
|
|
489
|
+
"ellipsis": ellipsis,
|
|
490
|
+
"hintProps": hintProps
|
|
491
|
+
}, _ref9)
|
|
492
|
+
})));
|
|
501
493
|
}
|
|
502
|
-
function
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
}
|
|
494
|
+
function ItemHint({
|
|
495
|
+
styles
|
|
496
|
+
}) {
|
|
497
|
+
var _ref0 = arguments[0], _ref15;
|
|
498
|
+
const SItemHint = Flex;
|
|
499
|
+
const {
|
|
500
|
+
hintId
|
|
501
|
+
} = React.useContext(menuItemContext);
|
|
502
|
+
return _ref15 = sstyled(styles), /* @__PURE__ */ React.createElement(SItemHint, _ref15.cn("SItemHint", {
|
|
503
|
+
...assignProps({
|
|
504
|
+
"id": hintId,
|
|
505
|
+
"aria-hidden": "true"
|
|
506
|
+
}, _ref0)
|
|
507
|
+
}));
|
|
510
508
|
}
|
|
511
|
-
|
|
509
|
+
const DropdownMenu = createComponent(DropdownMenuRoot, {
|
|
512
510
|
Trigger,
|
|
513
511
|
Popper: Dropdown.Popper,
|
|
514
512
|
List,
|
|
@@ -521,15 +519,6 @@ var DropdownMenu = createComponent(DropdownMenuRoot, {
|
|
|
521
519
|
Text: ItemContentText,
|
|
522
520
|
Hint: ItemHint
|
|
523
521
|
}],
|
|
524
|
-
/**
|
|
525
|
-
* @deprecated. Use just Item. See examples on
|
|
526
|
-
*/
|
|
527
|
-
Nesting: [Nesting, {
|
|
528
|
-
Trigger: NestingTrigger,
|
|
529
|
-
Addon
|
|
530
|
-
}],
|
|
531
|
-
ItemTitle: Title,
|
|
532
|
-
ItemHint: Hint,
|
|
533
522
|
Group: Dropdown.Group
|
|
534
523
|
}, {
|
|
535
524
|
parent: [Dropdown]
|