@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.
@@ -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
- var style = (
19
+ const style = (
29
20
  /*__reshadow_css_start__*/
30
21
  (sstyled.insert(
31
22
  /*__inner_css_start__*/
32
- ".___SDropdownMenuList_1ulzv_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_1ulzv_gg_ .___SBar_1ulzv_gg_{z-index:3}.___SDropdownMenuList_1ulzv_gg_ .___SShadowHorizontal_1ulzv_gg_:after,.___SDropdownMenuList_1ulzv_gg_ .___SShadowHorizontal_1ulzv_gg_:before,.___SDropdownMenuList_1ulzv_gg_ .___SShadowVertical_1ulzv_gg_:after,.___SDropdownMenuList_1ulzv_gg_ .___SShadowVertical_1ulzv_gg_:before{border-radius:var(--intergalactic-control-rounded, 6px)}.___SDropdownMenuItemContainer_1ulzv_gg_ .___SItemContent_1ulzv_gg_:focus-visible{outline:0}.___SDropdownMenuItemContainer_1ulzv_gg_.__nesting-trigger_1ulzv_gg_{justify-content:space-between}.___SDropdownMenuItemAddon_1ulzv_gg_,.___SItemContentText_1ulzv_gg_{display:inline-flex;margin-left:var(--intergalactic-spacing-1x, 4px);margin-right:var(--intergalactic-spacing-1x, 4px)}.___SDropdownMenuItemAddon_1ulzv_gg_:first-child,.___SItemContentText_1ulzv_gg_:first-child{margin-left:0}.___SDropdownMenuItemAddon_1ulzv_gg_:last-child,.___SItemContentText_1ulzv_gg_:last-child{margin-right:0}.___SDropdownMenuNesting_1ulzv_gg_,.___SDropdownMenuNesting_1ulzv_gg_._size_l_1ulzv_gg_,.___SDropdownMenuNesting_1ulzv_gg_._size_m_1ulzv_gg_{padding:0}.___SDropdownMenuNesting_1ulzv_gg_.__highlighted_1ulzv_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_1ulzv_gg_._size_l_1ulzv_gg_,.___SDropdownNestingItem_1ulzv_gg_._size_m_1ulzv_gg_{padding-right:0}.___SDropdownNestingItem_1ulzv_gg_ .___SDropdownMenuItemContainer_1ulzv_gg_{width:auto;padding-top:0;padding-bottom:0;padding-left:0;min-height:auto}.___SItemHint_1ulzv_gg_{color:var(--intergalactic-text-secondary, #6c6e79)}",
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
- "1ulzv_gg_"
25
+ "1r615_gg_"
35
26
  ), /*__reshadow_css_end__*/
36
27
  {
37
- "__SDropdownMenuItemContainer": "___SDropdownMenuItemContainer_1ulzv_gg_",
38
- "_nesting-trigger": "__nesting-trigger_1ulzv_gg_",
39
- "__SDropdownMenuNesting": "___SDropdownMenuNesting_1ulzv_gg_",
40
- "_size_l": "_size_l_1ulzv_gg_",
41
- "_size_m": "_size_m_1ulzv_gg_",
42
- "_highlighted": "__highlighted_1ulzv_gg_",
43
- "__SDropdownNestingItem": "___SDropdownNestingItem_1ulzv_gg_",
44
- "__SItemHint": "___SItemHint_1ulzv_gg_",
45
- "__SDropdownMenuList": "___SDropdownMenuList_1ulzv_gg_",
46
- "__SBar": "___SBar_1ulzv_gg_",
47
- "__SShadowHorizontal": "___SShadowHorizontal_1ulzv_gg_",
48
- "__SShadowVertical": "___SShadowVertical_1ulzv_gg_",
49
- "__SItemContent": "___SItemContent_1ulzv_gg_",
50
- "__SDropdownMenuItemAddon": "___SDropdownMenuItemAddon_1ulzv_gg_",
51
- "__SItemContentText": "___SItemContentText_1ulzv_gg_"
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
- var menuItemContext = /* @__PURE__ */ React.createContext({});
55
- var DropdownMenuRoot = /* @__PURE__ */ (function(_AbstractDropdown) {
56
- function DropdownMenuRoot2() {
57
- var _this;
58
- _classCallCheck(this, DropdownMenuRoot2);
59
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
60
- args[_key] = arguments[_key];
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
- _inherits(DropdownMenuRoot2, _AbstractDropdown);
69
- return _createClass(DropdownMenuRoot2, [{
70
- key: "uncontrolledProps",
71
- value: function uncontrolledProps() {
72
- var _this2 = this;
73
- return _objectSpread(_objectSpread({}, _superPropGet(DropdownMenuRoot2, "uncontrolledProps", this, 3)([])), {}, {
74
- visible: [null, function(visible) {
75
- if (visible === true) {
76
- setTimeout(function() {
77
- _this2.focusAndScrollToSelected();
78
- }, 50);
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
- 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);
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
- 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
- if (selected && options && !((_this$menuRef$current2 = this.menuRef.current) !== null && _this$menuRef$current2 !== void 0 && _this$menuRef$current2.dataset.isVirtual)) return;
125
- _superPropGet(DropdownMenuRoot2, "afterOpenPopper", this, 3)([]);
126
- }
127
- }, {
128
- key: "itemRef",
129
- value: function itemRef(props, index, node) {
130
- _superPropGet(DropdownMenuRoot2, "itemRef", this, 3)([props, index, node]);
131
- if (node === document.activeElement) {
132
- _superPropGet(DropdownMenuRoot2, "scrollToNode", this, 3)([node]);
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
- key: "getTriggerProps",
137
- value: function getTriggerProps() {
138
- var _this$asProps = this.asProps, Children = _this$asProps.Children, uid = _this$asProps.uid, visible = _this$asProps.visible;
139
- var hasMenu = isAdvanceMode(Children, [DropdownMenu.Menu.displayName]);
140
- var ariaControls = hasMenu ? "igc-".concat(uid, "-list") : "igc-".concat(uid, "-popper");
141
- return _objectSpread(_objectSpread({}, _superPropGet(DropdownMenuRoot2, "getTriggerProps", this, 3)([])), {}, {
142
- "onKeyDown": callAllEventHandlers(this.handlePreventCommonKeyDown.bind(this), this.handleOpenKeyDown.bind(this), this.handleKeyDownForMenu("trigger")),
143
- "aria-controls": visible ? ariaControls : void 0,
144
- "aria-haspopup": hasMenu ? "true" : "dialog"
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
- key: "getListProps",
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
- key: "getVirtualListProps",
156
- value: function getVirtualListProps() {
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
- key: "getPopperProps",
163
- value: function getPopperProps() {
164
- return _objectSpread(_objectSpread({}, _superPropGet(DropdownMenuRoot2, "getPopperProps", this, 3)([])), {}, {
165
- onKeyDown: callAllEventHandlers(this.handlePreventCommonKeyDown.bind(this), this.handlePreventPopperKeyDown.bind(this))
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
- key: "getActionsProps",
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
- key: "getItemTabIndex",
178
- value: function getItemTabIndex(props, itemIndex) {
179
- var disabled = props.disabled, index = props.index;
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
- key: "getItemProps",
197
- value: function getItemProps(props, index) {
198
- var _props$index, _this4 = this;
199
- var realIndex = (_props$index = props.index) !== null && _props$index !== void 0 ? _props$index : index;
200
- var itemProps = _objectSpread(_objectSpread({}, _superPropGet(DropdownMenuRoot2, "getItemProps", this, 3)([props, realIndex])), {}, {
201
- tabIndex: this.getItemTabIndex(props, index),
202
- ref: function ref(node) {
203
- return _this4.itemRef(props, realIndex, node);
204
- },
205
- actionsRef: this.actionsRef
206
- });
207
- if (props.tag === ButtonComponent) {
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
- if (_superPropGet(DropdownMenuRoot2, "childRole", this, 1) === "menuitemradio") {
218
- itemProps.onClick = function() {
219
- _this4.handlers.visible(false);
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
- return itemProps;
223
- }
224
- }, {
225
- key: "handleKeyDownForMenu",
226
- value: function handleKeyDownForMenu(place) {
227
- var _this5 = this;
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
- key: "render",
281
- value: function render() {
282
- var _ref = this.asProps;
283
- var _this$asProps3 = this.asProps, Children = _this$asProps3.Children, selectedIndex = _this$asProps3.selectedIndex, interaction = _this$asProps3.interaction, timeout = _this$asProps3.timeout;
284
- this.itemProps = [];
285
- return /* @__PURE__ */ React.createElement(selectedIndexContext.Provider, {
286
- value: selectedIndex
287
- }, /* @__PURE__ */ React.createElement(Dropdown, assignProps({
288
- "timeout": timeout || (interaction === "hover" ? [0, 100] : void 0)
289
- }, _ref), /* @__PURE__ */ React.createElement(Children, null)));
290
- }
291
- }]);
292
- })(AbstractDropdown);
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(_ref22) {
313
- var _ref2 = arguments[0], _ref13;
314
- var styles = _ref22.styles, Children = _ref22.Children;
315
- var SDropdownMenuList = ScrollAreaComponent;
316
- var SBar = ScrollAreaComponent.Bar;
317
- return _ref13 = sstyled(styles), /* @__PURE__ */ React.createElement(ListBoxContextProvider, _ref13.cn("ListBoxContextProvider", {}), /* @__PURE__ */ React.createElement(SDropdownMenuList, _ref13.cn("SDropdownMenuList", _objectSpread({}, assignProps({
318
- "shadow": true,
319
- "shadowSize": 16,
320
- "shadowTheme": "light"
321
- }, _ref2))), /* @__PURE__ */ React.createElement(ScrollAreaComponent.Container, {
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, _ref13.cn("Children", {}))), /* @__PURE__ */ React.createElement(SBar, _ref13.cn("SBar", {
306
+ }, /* @__PURE__ */ React.createElement(Children, _ref1.cn("Children", {}))), /* @__PURE__ */ React.createElement(SBar, _ref1.cn("SBar", {
324
307
  "orientation": "horizontal"
325
- })), /* @__PURE__ */ React.createElement(SBar, _ref13.cn("SBar", {
308
+ })), /* @__PURE__ */ React.createElement(SBar, _ref1.cn("SBar", {
326
309
  "orientation": "vertical"
327
310
  }))));
328
311
  }
329
- function Actions(_ref23) {
330
- var _ref3 = arguments[0], _ref14;
331
- var styles = _ref23.styles;
332
- var SDropdownMenuActions = Flex;
333
- return _ref14 = sstyled(styles), /* @__PURE__ */ React.createElement(SDropdownMenuActions, _ref14.cn("SDropdownMenuActions", _objectSpread({}, assignProps({}, _ref3))));
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
- var visible = props.visible, disablePortal = props.disablePortal, ignorePortalsStacking = props.ignorePortalsStacking, disableEnforceFocus = props.disableEnforceFocus, interaction = props.interaction, autoFocus = props.autoFocus, animationsDisabled = props.animationsDisabled;
338
- var popperProps = {
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(_ref24) {
352
- var _ref5 = arguments[0], _ref15;
353
- var id = _ref24.id, styles = _ref24.styles, disabled = _ref24.disabled, Children = _ref24.Children, forwardRef = _ref24.forwardRef, role = _ref24.role, tabIndex = _ref24.tabIndex, actionsRef = _ref24.actionsRef, ariaChecked = _ref24["aria-checked"];
354
- var SDropdownMenuItemContainer = Dropdown.Item;
355
- var itemRef = React.useRef();
356
- var _React$useState = React.useState(false), _React$useState2 = _slicedToArray(_React$useState, 2), highlighted = _React$useState2[0], setHighlighted = _React$useState2[1];
357
- var menuItemContextValue = {
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: forkRef(forwardRef, itemRef),
362
+ ref: itemRef,
363
+ forwardRef,
360
364
  role,
361
365
  tabIndex,
362
366
  ariaChecked,
363
367
  disabled
364
368
  };
365
- var ariaDescribes = [];
366
- var hasSubMenu = isAdvanceMode(Children, [DropdownMenu.displayName], true);
367
- var hasHint = isAdvanceMode(Children, [DropdownMenu.Item.Hint.displayName], true);
368
- var advancedMode = isAdvanceMode(Children, [DropdownMenu.Item.Content.displayName], true) || hasSubMenu || hasHint;
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
- var hintId = "igc-".concat(useUID(), "-option-hint");
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(function() {
379
- var onFocus = function onFocus2(e) {
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
- var onBlur = function onBlur2(e) {
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 function() {
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
- }, [itemRef.current]);
410
- return _ref15 = sstyled(styles), /* @__PURE__ */ React.createElement(menuItemContext.Provider, {
413
+ });
414
+ return _ref11 = sstyled(styles), /* @__PURE__ */ React.createElement(menuItemContext.Provider, {
411
415
  value: menuItemContextValue
412
- }, /* @__PURE__ */ React.createElement(SDropdownMenuItemContainer, _ref15.cn("SDropdownMenuItemContainer", _objectSpread({}, assignProps({
413
- "ref": advancedMode ? void 0 : menuItemContextValue.ref,
414
- "use:highlighted": !disabled && highlighted && lastInteraction.isKeyboard(),
415
- "use:role": advancedMode ? void 0 : role,
416
- "use:id": advancedMode ? void 0 : id,
417
- "use:tabIndex": advancedMode ? void 0 : tabIndex,
418
- "use:aria-checked": advancedMode ? void 0 : ariaChecked
419
- }, _ref5))), /* @__PURE__ */ React.createElement(Children, _ref15.cn("Children", {}))));
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], _ref16;
423
- var SDropdownMenuItemAddon = Box;
424
- return _ref16 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SDropdownMenuItemAddon, _ref16.cn("SDropdownMenuItemAddon", _objectSpread({}, assignProps({}, _ref6))));
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(_ref25) {
431
- var _ref8 = arguments[0], _ref17;
432
- var styles = _ref25.styles;
433
- var SItemContent = Flex;
434
- var ref = React.useRef();
435
- var menuItemCtxValue = React.useContext(menuItemContext);
436
- var subMenu = void 0;
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
- var _React$useState3 = React.useState(new Set(menuItemCtxValue.ariaDescribes)), _React$useState4 = _slicedToArray(_React$useState3, 2), describedby = _React$useState4[0], setDescribedby = _React$useState4[1];
441
- React.useEffect(function() {
442
- var element = ref.current;
443
- var parent = element === null || element === void 0 ? void 0 : element.parentElement;
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(function(prev) {
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 _ref17 = sstyled(styles), /* @__PURE__ */ React.createElement(SItemContent, _ref17.cn("SItemContent", _objectSpread({}, assignProps({
452
- "role": menuItemCtxValue.role,
453
- "id": menuItemCtxValue.contentId,
454
- "tabIndex": menuItemCtxValue.tabIndex,
455
- "ref": forkRef(menuItemCtxValue.ref, ref),
456
- "use:aria-describedby": _toConsumableArray(describedby).join(" "),
457
- "aria-haspopup": menuItemCtxValue.hasSubMenu ? "true" : void 0,
458
- "aria-expanded": subMenu,
459
- "aria-checked": menuItemCtxValue.ariaChecked,
460
- "alignItems": "center",
461
- "justifyContent": menuItemCtxValue.hasSubMenu ? "space-between" : void 0,
462
- "disabled": menuItemCtxValue.disabled
463
- }, _ref8))));
464
- }
465
- function ItemContentText(_ref26) {
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 Hint(props) {
482
- var _ref1 = arguments[0], _ref20;
483
- var SDropdownMenuItemContainer = Dropdown.Item;
484
- return _ref20 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SDropdownMenuItemContainer, _ref20.cn("SDropdownMenuItemContainer", _objectSpread({}, assignProps({
485
- "variant": "hint"
486
- }, _ref1))));
487
- }
488
- function Title(props) {
489
- var _ref10 = arguments[0], _ref21;
490
- var SDropdownMenuItemContainer = Dropdown.Item;
491
- return _ref21 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SDropdownMenuItemContainer, _ref21.cn("SDropdownMenuItemContainer", _objectSpread({}, assignProps({
492
- "variant": "title"
493
- }, _ref10))));
494
- }
495
- function Nesting(_ref28) {
496
- var _ref11 = arguments[0];
497
- var forwardRef = _ref28.forwardRef;
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 NestingTrigger(_ref29) {
503
- var _ref12 = arguments[0];
504
- var forwardRef = _ref29.forwardRef;
505
- return /* @__PURE__ */ React.createElement(DropdownMenu.Item.Content, assignProps({
506
- "tag": DropdownMenu.Trigger,
507
- "ref": forwardRef,
508
- "use:role": "menuitem"
509
- }, _ref12));
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
- var DropdownMenu = createComponent(DropdownMenuRoot, {
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]