@semcore/dropdown-menu 4.47.0 → 16.0.0-prerelease.11

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,386 +1,478 @@
1
- import X from "@babel/runtime/helpers/esm/toConsumableArray";
2
- import Y from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- import N from "@babel/runtime/helpers/esm/slicedToArray";
4
- import W from "@babel/runtime/helpers/esm/extends";
5
- import g from "@babel/runtime/helpers/esm/objectSpread2";
6
- import Z from "@babel/runtime/helpers/esm/classCallCheck";
7
- import ee from "@babel/runtime/helpers/esm/createClass";
8
- import j from "@babel/runtime/helpers/esm/assertThisInitialized";
9
- import I from "@babel/runtime/helpers/esm/get";
10
- import y from "@babel/runtime/helpers/esm/getPrototypeOf";
11
- import te from "@babel/runtime/helpers/esm/inherits";
12
- import re from "@babel/runtime/helpers/esm/createSuper";
13
- import M from "@babel/runtime/helpers/esm/defineProperty";
14
- import { sstyled as ne } from "@semcore/utils/lib/core/index";
15
- import oe, { assignProps as m, sstyled as x } from "@semcore/core";
16
- import i from "react";
17
- import ie from "classnames";
18
- import D, { enhance as ae, selectedIndexContext as q, AbstractDropdown as _e } from "@semcore/dropdown";
19
- import { useBox as se, Flex as z } from "@semcore/flex-box";
20
- import E, { hideScrollBarsFromScreenReadersContext as ue } from "@semcore/scroll-area";
21
- import { useUID as de } from "@semcore/utils/lib/uniqueID";
22
- import { localizedMessages as le } from "./translations/__intergalactic-dynamic-locales.mjs";
23
- import { useFocusSource as ge } from "@semcore/utils/lib/enhances/keyboardFocusEnhance";
24
- import { isAdvanceMode as L } from "@semcore/utils/lib/findComponent";
25
- import { forkRef as G } from "@semcore/utils/lib/ref";
26
- import { callAllEventHandlers as A } from "@semcore/utils/lib/assignProps";
27
- import ce from "@semcore/button";
28
- import { Text as he } from "@semcore/typography";
29
- var me = ["className"], pe = (
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
+ import _extends from "@babel/runtime/helpers/esm/extends";
5
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
6
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
7
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
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";
11
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
12
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
13
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
14
+ import { sstyled, createComponent, assignProps, lastInteraction } from "@semcore/core";
15
+ import React from "react";
16
+ import cn from "classnames";
17
+ import Dropdown, { enhance, selectedIndexContext, AbstractDropdown } from "@semcore/dropdown";
18
+ import { useBox, Flex } from "@semcore/flex-box";
19
+ import ScrollAreaComponent, { hideScrollBarsFromScreenReadersContext } from "@semcore/scroll-area";
20
+ import { useUID } from "@semcore/core/lib/utils/uniqueID";
21
+ import { localizedMessages } from "./translations/__intergalactic-dynamic-locales.mjs";
22
+ import { isAdvanceMode } from "@semcore/core/lib/utils/findComponent";
23
+ import { forkRef } from "@semcore/core/lib/utils/ref";
24
+ import { callAllEventHandlers } from "@semcore/core/lib/utils/assignProps";
25
+ import ButtonComponent from "@semcore/button";
26
+ import { Text } from "@semcore/typography";
27
+ var _excluded = ["className"];
28
+ var style = (
30
29
  /*__reshadow_css_start__*/
31
- (ne.insert(
30
+ (sstyled.insert(
32
31
  /*__inner_css_start__*/
33
- `.___SDropdownMenuList_5h0u9_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_5h0u9_gg_ .___SShadowHorizontal_5h0u9_gg_:after,.___SDropdownMenuList_5h0u9_gg_ .___SShadowHorizontal_5h0u9_gg_:before{width:16px;height:100%;border-radius:var(--intergalactic-control-rounded, 6px)}.___SDropdownMenuList_5h0u9_gg_ .___SShadowHorizontal_5h0u9_gg_._position_median_5h0u9_gg_:before{background:var(--intergalactic-scroll-area-dropdown-menu-left,
34
- linear-gradient(to right, rgba(255, 255, 255, 1) 34.38%, rgba(255, 255, 255, 0) 100%)
35
- )}.___SDropdownMenuList_5h0u9_gg_ .___SShadowHorizontal_5h0u9_gg_._position_median_5h0u9_gg_:after{background:var(--intergalactic-scroll-area-dropdown-menu-right,
36
- linear-gradient(to left, rgba(255, 255, 255, 1) 34.38%, rgba(255, 255, 255, 0) 100%)
37
- )}.___SDropdownMenuList_5h0u9_gg_ .___SShadowHorizontal_5h0u9_gg_._position_start_5h0u9_gg_:before{background:var(--intergalactic-scroll-area-dropdown-menu-left,
38
- linear-gradient(to right, rgba(255, 255, 255, 1) 34.38%, rgba(255, 255, 255, 0) 100%)
39
- )}.___SDropdownMenuList_5h0u9_gg_ .___SShadowHorizontal_5h0u9_gg_._position_end_5h0u9_gg_:after{background:var(--intergalactic-scroll-area-dropdown-menu-right,
40
- linear-gradient(to left, rgba(255, 255, 255, 1) 34.38%, rgba(255, 255, 255, 0) 100%)
41
- )}.___SDropdownMenuList_5h0u9_gg_ .___SShadowVertical_5h0u9_gg_:after,.___SDropdownMenuList_5h0u9_gg_ .___SShadowVertical_5h0u9_gg_:before{width:100%;height:16px;border-radius:var(--intergalactic-control-rounded, 6px)}.___SDropdownMenuList_5h0u9_gg_ .___SShadowVertical_5h0u9_gg_._position_median_5h0u9_gg_:before{background:var(--intergalactic-scroll-area-dropdown-menu-top,
42
- linear-gradient(to bottom, rgba(255, 255, 255, 1) 34.38%, rgba(255, 255, 255, 0) 100%)
43
- )}.___SDropdownMenuList_5h0u9_gg_ .___SShadowVertical_5h0u9_gg_._position_median_5h0u9_gg_:after{background:var(--intergalactic-scroll-area-dropdown-menu-bottom,
44
- linear-gradient(to top, rgba(255, 255, 255, 1) 34.38%, rgba(255, 255, 255, 0) 100%)
45
- )}.___SDropdownMenuList_5h0u9_gg_ .___SShadowVertical_5h0u9_gg_._position_start_5h0u9_gg_:before{background:var(--intergalactic-scroll-area-dropdown-menu-top,
46
- linear-gradient(to bottom, rgba(255, 255, 255, 1) 34.38%, rgba(255, 255, 255, 0) 100%)
47
- )}.___SDropdownMenuList_5h0u9_gg_ .___SShadowVertical_5h0u9_gg_._position_end_5h0u9_gg_:after{background:var(--intergalactic-scroll-area-dropdown-menu-bottom,
48
- linear-gradient(to top, rgba(255, 255, 255, 1) 34.38%, rgba(255, 255, 255, 0) 100%)
49
- )}.___SDropdownMenuItemContainer_5h0u9_gg_.__nesting-trigger_5h0u9_gg_{justify-content:space-between}.___SDropdownMenuItemAddon_5h0u9_gg_,.___SItemContentText_5h0u9_gg_{display:inline-flex;margin-left:var(--intergalactic-spacing-1x, 4px);margin-right:var(--intergalactic-spacing-1x, 4px)}.___SDropdownMenuItemAddon_5h0u9_gg_:first-child,.___SItemContentText_5h0u9_gg_:first-child{margin-left:0}.___SDropdownMenuItemAddon_5h0u9_gg_:last-child,.___SItemContentText_5h0u9_gg_:last-child{margin-right:0}.___SDropdownMenuNesting_5h0u9_gg_,.___SDropdownMenuNesting_5h0u9_gg_._size_l_5h0u9_gg_,.___SDropdownMenuNesting_5h0u9_gg_._size_m_5h0u9_gg_{padding:0}.___SDropdownMenuNesting_5h0u9_gg_.__highlighted_5h0u9_gg_{z-index:1;box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5)) inset}.___SDropdownNestingItem_5h0u9_gg_._size_l_5h0u9_gg_,.___SDropdownNestingItem_5h0u9_gg_._size_m_5h0u9_gg_{padding-right:0}.___SDropdownNestingItem_5h0u9_gg_ .___SDropdownMenuItemContainer_5h0u9_gg_{width:auto;padding-top:0;padding-bottom:0;padding-left:0;min-height:auto}.___SItemContent_5h0u9_gg_:focus{outline:0}.___SItemHint_5h0u9_gg_{color:var(--intergalactic-text-secondary, #6c6e79)}`,
50
- "5h0u9_gg_"
32
+ ".___SDropdownMenuList_g9pft_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_g9pft_gg_ .___SShadowHorizontal_g9pft_gg_:after,.___SDropdownMenuList_g9pft_gg_ .___SShadowHorizontal_g9pft_gg_:before{width:16px;height:100%;border-radius:var(--intergalactic-control-rounded, 6px)}.___SDropdownMenuList_g9pft_gg_ .___SShadowHorizontal_g9pft_gg_._position_median_g9pft_gg_:before{background:var(--intergalactic-scroll-area-dropdown-menu-left,\n linear-gradient(to right, rgba(255, 255, 255, 1) 34.38%, rgba(255, 255, 255, 0) 100%)\n )}.___SDropdownMenuList_g9pft_gg_ .___SShadowHorizontal_g9pft_gg_._position_median_g9pft_gg_:after{background:var(--intergalactic-scroll-area-dropdown-menu-right,\n linear-gradient(to left, rgba(255, 255, 255, 1) 34.38%, rgba(255, 255, 255, 0) 100%)\n )}.___SDropdownMenuList_g9pft_gg_ .___SShadowHorizontal_g9pft_gg_._position_start_g9pft_gg_:before{background:var(--intergalactic-scroll-area-dropdown-menu-left,\n linear-gradient(to right, rgba(255, 255, 255, 1) 34.38%, rgba(255, 255, 255, 0) 100%)\n )}.___SDropdownMenuList_g9pft_gg_ .___SShadowHorizontal_g9pft_gg_._position_end_g9pft_gg_:after{background:var(--intergalactic-scroll-area-dropdown-menu-right,\n linear-gradient(to left, rgba(255, 255, 255, 1) 34.38%, rgba(255, 255, 255, 0) 100%)\n )}.___SDropdownMenuList_g9pft_gg_ .___SShadowVertical_g9pft_gg_:after,.___SDropdownMenuList_g9pft_gg_ .___SShadowVertical_g9pft_gg_:before{width:100%;height:16px;border-radius:var(--intergalactic-control-rounded, 6px)}.___SDropdownMenuList_g9pft_gg_ .___SShadowVertical_g9pft_gg_._position_median_g9pft_gg_:before{background:var(--intergalactic-scroll-area-dropdown-menu-top,\n linear-gradient(to bottom, rgba(255, 255, 255, 1) 34.38%, rgba(255, 255, 255, 0) 100%)\n )}.___SDropdownMenuList_g9pft_gg_ .___SShadowVertical_g9pft_gg_._position_median_g9pft_gg_:after{background:var(--intergalactic-scroll-area-dropdown-menu-bottom,\n linear-gradient(to top, rgba(255, 255, 255, 1) 34.38%, rgba(255, 255, 255, 0) 100%)\n )}.___SDropdownMenuList_g9pft_gg_ .___SShadowVertical_g9pft_gg_._position_start_g9pft_gg_:before{background:var(--intergalactic-scroll-area-dropdown-menu-top,\n linear-gradient(to bottom, rgba(255, 255, 255, 1) 34.38%, rgba(255, 255, 255, 0) 100%)\n )}.___SDropdownMenuList_g9pft_gg_ .___SShadowVertical_g9pft_gg_._position_end_g9pft_gg_:after{background:var(--intergalactic-scroll-area-dropdown-menu-bottom,\n linear-gradient(to top, rgba(255, 255, 255, 1) 34.38%, rgba(255, 255, 255, 0) 100%)\n )}.___SDropdownMenuItemContainer_g9pft_gg_.__nesting-trigger_g9pft_gg_{justify-content:space-between}.___SDropdownMenuItemAddon_g9pft_gg_,.___SItemContentText_g9pft_gg_{display:inline-flex;margin-left:var(--intergalactic-spacing-1x, 4px);margin-right:var(--intergalactic-spacing-1x, 4px)}.___SDropdownMenuItemAddon_g9pft_gg_:first-child,.___SItemContentText_g9pft_gg_:first-child{margin-left:0}.___SDropdownMenuItemAddon_g9pft_gg_:last-child,.___SItemContentText_g9pft_gg_:last-child{margin-right:0}.___SDropdownMenuNesting_g9pft_gg_,.___SDropdownMenuNesting_g9pft_gg_._size_l_g9pft_gg_,.___SDropdownMenuNesting_g9pft_gg_._size_m_g9pft_gg_{padding:0}.___SDropdownMenuNesting_g9pft_gg_.__highlighted_g9pft_gg_{z-index:1;box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5)) inset}.___SDropdownNestingItem_g9pft_gg_._size_l_g9pft_gg_,.___SDropdownNestingItem_g9pft_gg_._size_m_g9pft_gg_{padding-right:0}.___SDropdownNestingItem_g9pft_gg_ .___SDropdownMenuItemContainer_g9pft_gg_{width:auto;padding-top:0;padding-bottom:0;padding-left:0;min-height:auto}.___SItemContent_g9pft_gg_:focus{outline:0}.___SItemHint_g9pft_gg_{color:var(--intergalactic-text-secondary, #6c6e79)}",
33
+ "g9pft_gg_"
51
34
  ), {
52
- __SDropdownMenuItemContainer: "___SDropdownMenuItemContainer_5h0u9_gg_",
53
- "_nesting-trigger": "__nesting-trigger_5h0u9_gg_",
54
- __SDropdownMenuNesting: "___SDropdownMenuNesting_5h0u9_gg_",
55
- _size_l: "_size_l_5h0u9_gg_",
56
- _size_m: "_size_m_5h0u9_gg_",
57
- _highlighted: "__highlighted_5h0u9_gg_",
58
- __SDropdownNestingItem: "___SDropdownNestingItem_5h0u9_gg_",
59
- __SItemContent: "___SItemContent_5h0u9_gg_",
60
- __SItemHint: "___SItemHint_5h0u9_gg_",
61
- __SDropdownMenuList: "___SDropdownMenuList_5h0u9_gg_",
62
- __SShadowHorizontal: "___SShadowHorizontal_5h0u9_gg_",
63
- _position_median: "_position_median_5h0u9_gg_",
64
- _position_start: "_position_start_5h0u9_gg_",
65
- _position_end: "_position_end_5h0u9_gg_",
66
- __SShadowVertical: "___SShadowVertical_5h0u9_gg_",
67
- __SDropdownMenuItemAddon: "___SDropdownMenuItemAddon_5h0u9_gg_",
68
- __SItemContentText: "___SItemContentText_5h0u9_gg_"
35
+ "__SDropdownMenuItemContainer": "___SDropdownMenuItemContainer_g9pft_gg_",
36
+ "_nesting-trigger": "__nesting-trigger_g9pft_gg_",
37
+ "__SDropdownMenuNesting": "___SDropdownMenuNesting_g9pft_gg_",
38
+ "_size_l": "_size_l_g9pft_gg_",
39
+ "_size_m": "_size_m_g9pft_gg_",
40
+ "_highlighted": "__highlighted_g9pft_gg_",
41
+ "__SDropdownNestingItem": "___SDropdownNestingItem_g9pft_gg_",
42
+ "__SItemContent": "___SItemContent_g9pft_gg_",
43
+ "__SItemHint": "___SItemHint_g9pft_gg_",
44
+ "__SDropdownMenuList": "___SDropdownMenuList_g9pft_gg_",
45
+ "__SShadowHorizontal": "___SShadowHorizontal_g9pft_gg_",
46
+ "_position_median": "_position_median_g9pft_gg_",
47
+ "_position_start": "_position_start_g9pft_gg_",
48
+ "_position_end": "_position_end_g9pft_gg_",
49
+ "__SShadowVertical": "___SShadowVertical_g9pft_gg_",
50
+ "__SDropdownMenuItemAddon": "___SDropdownMenuItemAddon_g9pft_gg_",
51
+ "__SItemContentText": "___SItemContentText_g9pft_gg_"
69
52
  })
70
- ), U = function(_) {
71
- var t = _.children;
72
- return /* @__PURE__ */ i.createElement(ue.Provider, {
73
- value: !0
74
- }, t);
75
- }, H = /* @__PURE__ */ i.createContext({}), P = /* @__PURE__ */ function(n) {
76
- te(t, n);
77
- var _ = re(t);
78
- function t() {
79
- var a;
80
- Z(this, t);
81
- for (var r = arguments.length, o = new Array(r), e = 0; e < r; e++)
82
- o[e] = arguments[e];
83
- return a = _.call.apply(_, [this].concat(o)), M(j(a), "actionsRef", /* @__PURE__ */ i.createRef()), M(j(a), "role", "menu"), a;
53
+ );
54
+ var ListBoxContextProvider = function ListBoxContextProvider2(_ref22) {
55
+ var children = _ref22.children;
56
+ return /* @__PURE__ */ React.createElement(hideScrollBarsFromScreenReadersContext.Provider, {
57
+ value: true
58
+ }, children);
59
+ };
60
+ var menuItemContext = /* @__PURE__ */ React.createContext({});
61
+ var DropdownMenuRoot = /* @__PURE__ */ function(_AbstractDropdown) {
62
+ _inherits(DropdownMenuRoot2, _AbstractDropdown);
63
+ var _super = _createSuper(DropdownMenuRoot2);
64
+ function DropdownMenuRoot2() {
65
+ var _this;
66
+ _classCallCheck(this, DropdownMenuRoot2);
67
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
68
+ args[_key] = arguments[_key];
69
+ }
70
+ _this = _super.call.apply(_super, [this].concat(args));
71
+ _defineProperty(_assertThisInitialized(_this), "actionsRef", /* @__PURE__ */ React.createRef());
72
+ _defineProperty(_assertThisInitialized(_this), "role", "menu");
73
+ return _this;
84
74
  }
85
- return ee(t, [{
75
+ _createClass(DropdownMenuRoot2, [{
86
76
  key: "uncontrolledProps",
87
- value: function() {
88
- var r = this;
89
- return g(g({}, I(y(t.prototype), "uncontrolledProps", this).call(this)), {}, {
90
- visible: [null, function(o) {
91
- o === !0 && setTimeout(function() {
92
- var e, s, u = (e = r.menuRef.current) === null || e === void 0 ? void 0 : e.querySelectorAll('[role="menuitemcheckbox"], [role="menuitemradio"]'), d = (s = r.menuRef.current) === null || s === void 0 ? void 0 : s.querySelector('[aria-checked="true"]');
93
- if (d && u && r.asProps.itemsCount === void 0) {
94
- r.scrollToNode(d, !0);
95
- for (var h = 0; h < u.length; h++)
96
- if (u[h] === d) {
97
- r.handlers.highlightedIndex(h);
98
- break;
77
+ value: function uncontrolledProps() {
78
+ var _this2 = this;
79
+ return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(DropdownMenuRoot2.prototype), "uncontrolledProps", this).call(this)), {}, {
80
+ visible: [null, function(visible) {
81
+ if (visible === true) {
82
+ setTimeout(function() {
83
+ var _this2$menuRef$curren, _this2$menuRef$curren2;
84
+ var options = (_this2$menuRef$curren = _this2.menuRef.current) === null || _this2$menuRef$curren === void 0 ? void 0 : _this2$menuRef$curren.querySelectorAll('[role="menuitemcheckbox"], [role="menuitemradio"]');
85
+ var selected = (_this2$menuRef$curren2 = _this2.menuRef.current) === null || _this2$menuRef$curren2 === void 0 ? void 0 : _this2$menuRef$curren2.querySelector('[aria-checked="true"]');
86
+ if (selected && options && _this2.asProps.itemsCount === void 0) {
87
+ _this2.scrollToNode(selected, true);
88
+ for (var i = 0; i < options.length; i++) {
89
+ if (options[i] === selected) {
90
+ _this2.handlers.highlightedIndex(i);
91
+ break;
92
+ }
99
93
  }
100
- }
101
- }, 30);
94
+ }
95
+ }, 30);
96
+ }
102
97
  }]
103
98
  });
104
99
  }
105
100
  }, {
106
101
  key: "itemRef",
107
- value: function(r, o, e) {
108
- I(y(t.prototype), "itemRef", this).call(this, r, o, e), e === document.activeElement && I(y(t.prototype), "scrollToNode", this).call(this, e);
102
+ value: function itemRef(props, index, node) {
103
+ _get(_getPrototypeOf(DropdownMenuRoot2.prototype), "itemRef", this).call(this, props, index, node);
104
+ if (node === document.activeElement) {
105
+ _get(_getPrototypeOf(DropdownMenuRoot2.prototype), "scrollToNode", this).call(this, node);
106
+ }
109
107
  }
110
108
  }, {
111
109
  key: "getTriggerProps",
112
- value: function() {
113
- var r = this.asProps, o = r.Children, e = r.uid, s = r.visible, u = L(o, [v.Menu.displayName]), d = u ? "igc-".concat(e, "-list") : "igc-".concat(e, "-popper");
114
- return g(g({}, I(y(t.prototype), "getTriggerProps", this).call(this)), {}, {
115
- onKeyDown: A(this.handlePreventCommonKeyDown.bind(this), this.handleOpenKeyDown.bind(this), this.handleKeyDownForMenu("trigger")),
116
- "aria-controls": s ? d : void 0,
117
- "aria-haspopup": u ? "true" : "dialog"
110
+ value: function getTriggerProps() {
111
+ var _this$asProps = this.asProps, Children = _this$asProps.Children, uid = _this$asProps.uid, visible = _this$asProps.visible;
112
+ var hasMenu = isAdvanceMode(Children, [DropdownMenu.Menu.displayName]);
113
+ var ariaControls = hasMenu ? "igc-".concat(uid, "-list") : "igc-".concat(uid, "-popper");
114
+ return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(DropdownMenuRoot2.prototype), "getTriggerProps", this).call(this)), {}, {
115
+ onKeyDown: callAllEventHandlers(this.handlePreventCommonKeyDown.bind(this), this.handleOpenKeyDown.bind(this), this.handleKeyDownForMenu("trigger")),
116
+ "aria-controls": visible ? ariaControls : void 0,
117
+ "aria-haspopup": hasMenu ? "true" : "dialog"
118
118
  });
119
119
  }
120
120
  }, {
121
121
  key: "getListProps",
122
- value: function() {
123
- return g(g({}, I(y(t.prototype), "getListProps", this).call(this)), {}, {
124
- onKeyDown: A(this.handlePreventCommonKeyDown.bind(this), this.handleKeyDownForMenu("list"), this.handleArrowKeyDown.bind(this))
122
+ value: function getListProps() {
123
+ return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(DropdownMenuRoot2.prototype), "getListProps", this).call(this)), {}, {
124
+ onKeyDown: callAllEventHandlers(this.handlePreventCommonKeyDown.bind(this), this.handleKeyDownForMenu("list"), this.handleArrowKeyDown.bind(this))
125
125
  });
126
126
  }
127
127
  }, {
128
128
  key: "getPopperProps",
129
- value: function() {
130
- return g(g({}, I(y(t.prototype), "getPopperProps", this).call(this)), {}, {
131
- onKeyDown: A(this.handlePreventCommonKeyDown.bind(this), this.handlePreventPopperKeyDown.bind(this))
129
+ value: function getPopperProps() {
130
+ return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(DropdownMenuRoot2.prototype), "getPopperProps", this).call(this)), {}, {
131
+ onKeyDown: callAllEventHandlers(this.handlePreventCommonKeyDown.bind(this), this.handlePreventPopperKeyDown.bind(this))
132
132
  });
133
133
  }
134
134
  }, {
135
135
  key: "getActionsProps",
136
- value: function() {
137
- return g(g({}, this.getListProps()), {}, {
136
+ value: function getActionsProps() {
137
+ return _objectSpread(_objectSpread({}, this.getListProps()), {}, {
138
138
  ref: this.actionsRef,
139
- onKeyDown: A(this.handlePreventTabOnActions.bind(this), this.handlePreventCommonKeyDown.bind(this), this.handleKeyDownForMenu("list"), this.handleArrowKeyDown.bind(this))
139
+ onKeyDown: callAllEventHandlers(this.handlePreventTabOnActions.bind(this), this.handlePreventCommonKeyDown.bind(this), this.handleKeyDownForMenu("list"), this.handleArrowKeyDown.bind(this))
140
140
  });
141
141
  }
142
142
  }, {
143
143
  key: "getItemProps",
144
- value: function(r, o) {
145
- var e, s = this, u = this.asProps, d = u.highlightedIndex, h = u.visible, l = (e = r.index) !== null && e !== void 0 ? e : o, p = l === d, c = g(g({}, I(y(t.prototype), "getItemProps", this).call(this, r, l)), {}, {
146
- tabIndex: p && h ? 0 : -1,
147
- ref: function(w) {
148
- return s.itemRef(r, l, w);
144
+ value: function getItemProps(props, index) {
145
+ var _props$index, _this3 = this;
146
+ var _this$asProps2 = this.asProps, highlightedIndex = _this$asProps2.highlightedIndex, visible = _this$asProps2.visible;
147
+ var realIndex = (_props$index = props.index) !== null && _props$index !== void 0 ? _props$index : index;
148
+ var isHighlighted = realIndex === highlightedIndex;
149
+ var itemProps = _objectSpread(_objectSpread({}, _get(_getPrototypeOf(DropdownMenuRoot2.prototype), "getItemProps", this).call(this, props, realIndex)), {}, {
150
+ tabIndex: isHighlighted && visible ? 0 : -1,
151
+ ref: function ref(node) {
152
+ return _this3.itemRef(props, realIndex, node);
149
153
  },
150
154
  actionsRef: this.actionsRef
151
155
  });
152
- if (r.tag === ce) {
153
- var f, b, S;
154
- c.use = (f = r.use) !== null && f !== void 0 ? f : "tertiary", c.theme = (b = r.theme) !== null && b !== void 0 ? b : "muted", c.size = (S = r.size) !== null && S !== void 0 ? S : "s";
156
+ if (props.tag === ButtonComponent) {
157
+ var _props$use, _props$theme, _props$size;
158
+ itemProps.use = (_props$use = props.use) !== null && _props$use !== void 0 ? _props$use : "tertiary";
159
+ itemProps.theme = (_props$theme = props.theme) !== null && _props$theme !== void 0 ? _props$theme : "muted";
160
+ itemProps.size = (_props$size = props.size) !== null && _props$size !== void 0 ? _props$size : "s";
161
+ itemProps.innerOutline = false;
155
162
  }
156
- return r.selected && (c["aria-checked"] = !0), I(y(t.prototype), "childRole", this) === "menuitemradio" && (c.onClick = function() {
157
- s.handlers.visible(!1);
158
- }), c;
163
+ if (props.selected) {
164
+ itemProps["aria-checked"] = true;
165
+ }
166
+ if (_get(_getPrototypeOf(DropdownMenuRoot2.prototype), "childRole", this) === "menuitemradio") {
167
+ itemProps.onClick = function() {
168
+ _this3.handlers.visible(false);
169
+ };
170
+ }
171
+ return itemProps;
159
172
  }
160
173
  }, {
161
174
  key: "handleKeyDownForMenu",
162
- value: function(r) {
163
- var o = this;
175
+ value: function handleKeyDownForMenu(place) {
176
+ var _this4 = this;
164
177
  return function(e) {
165
- var s, u, d = o.asProps, h = d.visible, l = d.placement, p = d.inlineActions;
166
- if (r === "list" && !((s = o.menuRef.current) !== null && s !== void 0 && s.contains(e.target)) && !p)
167
- return e.stopPropagation(), !1;
168
- var c = e.key === "ArrowRight" && (l == null ? void 0 : l.startsWith("right")) || e.key === "ArrowLeft" && (l == null ? void 0 : l.startsWith("left")), f = e.key === "ArrowLeft" && (l == null ? void 0 : l.startsWith("right")) || e.key === "ArrowRight" && (l == null ? void 0 : l.startsWith("left")) || e.key === "Escape", b = (u = e.target.getAttribute("role")) === null || u === void 0 ? void 0 : u.startsWith(I(y(t.prototype), "childRole", o));
169
- if (r === "trigger" && (!h || p) && c && b)
170
- return o.handlers.visible(!0), o.handlers.highlightedIndex(0), setTimeout(function() {
171
- var C, w = o.asProps.highlightedIndex;
172
- (C = o.itemRefs[w]) === null || C === void 0 || C.focus();
173
- }, 0), e.preventDefault(), e.stopPropagation(), !1;
174
- if (r === "list" && h && f && b && (!p || p && (e.key === "Escape" || o.asProps.highlightedIndex === 0))) {
175
- var S;
176
- return o.handlers.visible(!1), (S = o.triggerRef.current) === null || S === void 0 || S.focus(), e.preventDefault(), e.stopPropagation(), !1;
178
+ var _this4$menuRef$curren, _e$target$getAttribut;
179
+ var _this4$asProps = _this4.asProps, visible = _this4$asProps.visible, placement = _this4$asProps.placement, inlineActions = _this4$asProps.inlineActions;
180
+ if (place === "list" && !((_this4$menuRef$curren = _this4.menuRef.current) !== null && _this4$menuRef$curren !== void 0 && _this4$menuRef$curren.contains(e.target)) && !inlineActions) {
181
+ e.stopPropagation();
182
+ return false;
183
+ }
184
+ 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"));
185
+ 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";
186
+ 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));
187
+ if (place === "trigger" && (!visible || inlineActions) && show && isMenuItem) {
188
+ _this4.handlers.visible(true);
189
+ _this4.handlers.highlightedIndex(0);
190
+ setTimeout(function() {
191
+ var _this4$itemRefs$highl;
192
+ var highlightedIndex = _this4.asProps.highlightedIndex;
193
+ (_this4$itemRefs$highl = _this4.itemRefs[highlightedIndex]) === null || _this4$itemRefs$highl === void 0 ? void 0 : _this4$itemRefs$highl.focus();
194
+ }, 0);
195
+ e.preventDefault();
196
+ e.stopPropagation();
197
+ return false;
198
+ }
199
+ if (place === "list" && visible && hide && isMenuItem) {
200
+ if (!inlineActions || inlineActions && (e.key === "Escape" || _this4.asProps.highlightedIndex === 0)) {
201
+ var _this4$triggerRef$cur;
202
+ _this4.handlers.visible(false);
203
+ (_this4$triggerRef$cur = _this4.triggerRef.current) === null || _this4$triggerRef$cur === void 0 ? void 0 : _this4$triggerRef$cur.focus();
204
+ e.preventDefault();
205
+ e.stopPropagation();
206
+ return false;
207
+ }
177
208
  }
178
209
  };
179
210
  }
180
211
  }, {
181
212
  key: "handlePreventTabOnActions",
182
- value: function(r) {
183
- if (r.key === "Tab")
184
- return r.stopPropagation(), r.preventDefault(), !1;
213
+ value: function handlePreventTabOnActions(e) {
214
+ if (e.key === "Tab") {
215
+ e.stopPropagation();
216
+ e.preventDefault();
217
+ return false;
218
+ }
185
219
  }
186
220
  }, {
187
221
  key: "render",
188
- value: function() {
189
- var r = this.asProps, o = this.asProps, e = o.Children, s = o.selectedIndex, u = o.interaction, d = o.timeout;
190
- return this.itemProps = [], /* @__PURE__ */ i.createElement(q.Provider, {
191
- value: s
192
- }, /* @__PURE__ */ i.createElement(D, m({
193
- timeout: d || (u === "hover" ? [0, 100] : void 0)
194
- }, r), /* @__PURE__ */ i.createElement(e, null)));
222
+ value: function render() {
223
+ var _ref = this.asProps;
224
+ var _this$asProps3 = this.asProps, Children = _this$asProps3.Children, selectedIndex = _this$asProps3.selectedIndex, interaction = _this$asProps3.interaction, timeout = _this$asProps3.timeout;
225
+ this.itemProps = [];
226
+ return /* @__PURE__ */ React.createElement(selectedIndexContext.Provider, {
227
+ value: selectedIndex
228
+ }, /* @__PURE__ */ React.createElement(Dropdown, assignProps({
229
+ "timeout": timeout || (interaction === "hover" ? [0, 100] : void 0)
230
+ }, _ref), /* @__PURE__ */ React.createElement(Children, null)));
195
231
  }
196
- }]), t;
197
- }(_e);
198
- M(P, "displayName", "DropdownMenu");
199
- M(P, "style", pe);
200
- M(P, "enhance", Object.values(ae));
201
- M(P, "defaultProps", {
232
+ }]);
233
+ return DropdownMenuRoot2;
234
+ }(AbstractDropdown);
235
+ _defineProperty(DropdownMenuRoot, "displayName", "DropdownMenu");
236
+ _defineProperty(DropdownMenuRoot, "style", style);
237
+ _defineProperty(DropdownMenuRoot, "enhance", Object.values(enhance));
238
+ _defineProperty(DropdownMenuRoot, "defaultProps", {
202
239
  size: "m",
203
- defaultVisible: !1,
240
+ defaultVisible: false,
204
241
  defaultHighlightedIndex: 0,
205
242
  defaultSelectedIndex: 0,
206
- i18n: le,
243
+ i18n: localizedMessages,
207
244
  locale: "en",
208
245
  interaction: "click",
209
- inlineActions: !1,
246
+ inlineActions: false,
210
247
  placement: "bottom-start",
211
248
  timeout: 0
212
249
  });
213
- M(P, "nestedMenuInteraction", {
250
+ _defineProperty(DropdownMenuRoot, "nestedMenuInteraction", {
214
251
  trigger: [["onClick", "onMouseEnter"], ["onClick", "onMouseLeave"]],
215
252
  popper: [["onMouseEnter"], ["onMouseLeave"]]
216
253
  });
217
- function fe(n) {
218
- var _ = arguments[0], t, a = n.styles, r = n.Children, o = E;
219
- return t = x(a), /* @__PURE__ */ i.createElement(U, t.cn("ListBoxContextProvider", {}), /* @__PURE__ */ i.createElement(o, t.cn("SDropdownMenuList", g({}, m({
220
- shadow: !0
221
- }, _))), /* @__PURE__ */ i.createElement(E.Container, {
254
+ function List(_ref23) {
255
+ var _ref2 = arguments[0], _ref14;
256
+ var styles = _ref23.styles, Children = _ref23.Children;
257
+ var SDropdownMenuList = ScrollAreaComponent;
258
+ return _ref14 = sstyled(styles), /* @__PURE__ */ React.createElement(ListBoxContextProvider, _ref14.cn("ListBoxContextProvider", {}), /* @__PURE__ */ React.createElement(SDropdownMenuList, _ref14.cn("SDropdownMenuList", _objectSpread({}, assignProps({
259
+ "shadow": true
260
+ }, _ref2))), /* @__PURE__ */ React.createElement(ScrollAreaComponent.Container, {
222
261
  tabIndex: void 0
223
- }, /* @__PURE__ */ i.createElement(r, t.cn("Children", {}))), /* @__PURE__ */ i.createElement(E.Bar, {
262
+ }, /* @__PURE__ */ React.createElement(Children, _ref14.cn("Children", {}))), /* @__PURE__ */ React.createElement(ScrollAreaComponent.Bar, {
224
263
  orientation: "horizontal"
225
- }), /* @__PURE__ */ i.createElement(E.Bar, {
264
+ }), /* @__PURE__ */ React.createElement(ScrollAreaComponent.Bar, {
226
265
  orientation: "vertical"
227
266
  })));
228
267
  }
229
- function ve(n) {
230
- var _ = arguments[0], t, a = n.styles, r = z;
231
- return t = x(a), /* @__PURE__ */ i.createElement(r, t.cn("SDropdownMenuActions", g({}, m({}, _))));
268
+ function Actions(_ref24) {
269
+ var _ref3 = arguments[0], _ref15;
270
+ var styles = _ref24.styles;
271
+ var SDropdownMenuActions = Flex;
272
+ return _ref15 = sstyled(styles), /* @__PURE__ */ React.createElement(SDropdownMenuActions, _ref15.cn("SDropdownMenuActions", _objectSpread({}, assignProps({}, _ref3))));
232
273
  }
233
- function be(n) {
234
- var _ = arguments[0], t = n.visible, a = n.disablePortal, r = n.ignorePortalsStacking, o = n.disableEnforceFocus, e = n.interaction, s = n.autoFocus, u = n.animationsDisabled, d = {
235
- visible: t,
236
- disablePortal: a,
237
- ignorePortalsStacking: r,
238
- disableEnforceFocus: o,
239
- interaction: e,
240
- autoFocus: s,
241
- animationsDisabled: u
274
+ function Menu(props) {
275
+ var _ref4 = arguments[0];
276
+ var visible = props.visible, disablePortal = props.disablePortal, ignorePortalsStacking = props.ignorePortalsStacking, disableEnforceFocus = props.disableEnforceFocus, interaction = props.interaction, autoFocus = props.autoFocus, animationsDisabled = props.animationsDisabled;
277
+ var popperProps = {
278
+ visible,
279
+ disablePortal,
280
+ ignorePortalsStacking,
281
+ disableEnforceFocus,
282
+ interaction,
283
+ autoFocus,
284
+ animationsDisabled
242
285
  };
243
- return /* @__PURE__ */ i.createElement(U, null, /* @__PURE__ */ i.createElement(v.Popper, W({}, d, {
286
+ return /* @__PURE__ */ React.createElement(ListBoxContextProvider, null, /* @__PURE__ */ React.createElement(DropdownMenu.Popper, _extends({}, popperProps, {
244
287
  role: null
245
- }), /* @__PURE__ */ i.createElement(v.List, m({}, _))));
288
+ }), /* @__PURE__ */ React.createElement(DropdownMenu.List, assignProps({}, _ref4))));
246
289
  }
247
- function Se(n) {
248
- var _ = arguments[0], t, a = n.id, r = n.styles, o = n.disabled, e = n.Children, s = n.forwardRef, u = n.role, d = n.tabIndex, h = n.actionsRef, l = n["aria-checked"], p = D.Item, c = i.useRef(), f = i.useState(!1), b = N(f, 2), S = b[0], C = b[1], w = {
249
- contentId: a,
250
- ref: G(s, c),
251
- role: u,
252
- tabIndex: d,
253
- ariaChecked: l
254
- }, K = [], T = L(e, [v.displayName], !0), F = L(e, [v.Item.Hint.displayName], !0), R = L(e, [v.Item.Content.displayName], !0) || T || F;
255
- if (F) {
256
- var B = "igc-".concat(de(), "-option-hint");
257
- w.hintId = B, K.push(B);
290
+ function Item(_ref25) {
291
+ var _ref5 = arguments[0], _ref16;
292
+ 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"];
293
+ var SDropdownMenuItemContainer = Dropdown.Item;
294
+ var itemRef = React.useRef();
295
+ var _React$useState = React.useState(false), _React$useState2 = _slicedToArray(_React$useState, 2), highlighted = _React$useState2[0], setHighlighted = _React$useState2[1];
296
+ var menuItemContextValue = {
297
+ contentId: id,
298
+ ref: forkRef(forwardRef, itemRef),
299
+ role,
300
+ tabIndex,
301
+ ariaChecked
302
+ };
303
+ var ariaDescribes = [];
304
+ var hasSubMenu = isAdvanceMode(Children, [DropdownMenu.displayName], true);
305
+ var hasHint = isAdvanceMode(Children, [DropdownMenu.Item.Hint.displayName], true);
306
+ var advancedMode = isAdvanceMode(Children, [DropdownMenu.Item.Content.displayName], true) || hasSubMenu || hasHint;
307
+ if (hasHint) {
308
+ var hintId = "igc-".concat(useUID(), "-option-hint");
309
+ menuItemContextValue.hintId = hintId;
310
+ ariaDescribes.push(hintId);
258
311
  }
259
- T && (w.hasSubMenu = !0), w.ariaDescribes = K, i.useEffect(function() {
260
- var $ = function(k) {
261
- k.target === c.current && (C(!0), T && k.stopPropagation());
262
- }, V = function(k) {
263
- k.target === c.current && (C(!1), h.current && (c.current.tabIndex = -1));
312
+ if (hasSubMenu) {
313
+ menuItemContextValue.hasSubMenu = true;
314
+ }
315
+ menuItemContextValue.ariaDescribes = ariaDescribes;
316
+ React.useEffect(function() {
317
+ var onFocus = function onFocus2(e) {
318
+ if (e.target === itemRef.current) {
319
+ setHighlighted(true);
320
+ if (hasSubMenu) {
321
+ e.stopPropagation();
322
+ }
323
+ }
324
+ };
325
+ var onBlur = function onBlur2(e) {
326
+ if (e.target === itemRef.current) {
327
+ setHighlighted(false);
328
+ if (actionsRef.current) {
329
+ itemRef.current.tabIndex = -1;
330
+ }
331
+ }
264
332
  };
265
- return document.addEventListener("focus", $, {
266
- capture: !0
267
- }), document.addEventListener("blur", V, {
268
- capture: !0
269
- }), function() {
270
- document.removeEventListener("focus", $, {
271
- capture: !0
272
- }), document.removeEventListener("blur", V, {
273
- capture: !0
333
+ document.addEventListener("focus", onFocus, {
334
+ capture: true
335
+ });
336
+ document.addEventListener("blur", onBlur, {
337
+ capture: true
338
+ });
339
+ return function() {
340
+ document.removeEventListener("focus", onFocus, {
341
+ capture: true
342
+ });
343
+ document.removeEventListener("blur", onBlur, {
344
+ capture: true
274
345
  });
275
346
  };
276
- }, [c.current]);
277
- var J = ge();
278
- return t = x(r), /* @__PURE__ */ i.createElement(H.Provider, {
279
- value: w
280
- }, /* @__PURE__ */ i.createElement(p, t.cn("SDropdownMenuItemContainer", g({}, m({
281
- ref: R ? void 0 : w.ref,
282
- "use:highlighted": !o && S && J.current === "keyboard",
283
- "use:role": R ? void 0 : u,
284
- "use:id": R ? void 0 : a,
285
- "use:tabIndex": R ? void 0 : d,
286
- "use:aria-checked": R ? void 0 : l
287
- }, _))), /* @__PURE__ */ i.createElement(e, t.cn("Children", {}))));
347
+ }, [itemRef.current]);
348
+ return _ref16 = sstyled(styles), /* @__PURE__ */ React.createElement(menuItemContext.Provider, {
349
+ value: menuItemContextValue
350
+ }, /* @__PURE__ */ React.createElement(SDropdownMenuItemContainer, _ref16.cn("SDropdownMenuItemContainer", _objectSpread({}, assignProps({
351
+ "ref": advancedMode ? void 0 : menuItemContextValue.ref,
352
+ "use:highlighted": !disabled && highlighted && lastInteraction.isKeyboard(),
353
+ "use:role": advancedMode ? void 0 : role,
354
+ "use:id": advancedMode ? void 0 : id,
355
+ "use:tabIndex": advancedMode ? void 0 : tabIndex,
356
+ "use:aria-checked": advancedMode ? void 0 : ariaChecked
357
+ }, _ref5))), /* @__PURE__ */ React.createElement(Children, _ref16.cn("Children", {}))));
288
358
  }
289
- function O(n) {
290
- var _ = se(n, n.forwardRef), t = N(_, 2), a = t[0], r = t[1], o = r.className, e = Y(r, me), s = x(n.styles);
291
- return /* @__PURE__ */ i.createElement(a, W({
292
- className: ie(s.cn("SDropdownMenuItemAddon", n).className, o) || void 0
293
- }, e));
359
+ function Addon(props) {
360
+ var _useBox = useBox(props, props.forwardRef), _useBox2 = _slicedToArray(_useBox, 2), SDropdownMenuItemAddon = _useBox2[0], _useBox2$ = _useBox2[1], className = _useBox2$.className, other = _objectWithoutProperties(_useBox2$, _excluded);
361
+ var styles = sstyled(props.styles);
362
+ return /* @__PURE__ */ React.createElement(SDropdownMenuItemAddon, _extends({
363
+ className: cn(styles.cn("SDropdownMenuItemAddon", props).className, className) || void 0
364
+ }, other));
294
365
  }
295
- function we() {
296
- var n = arguments[0];
297
- return /* @__PURE__ */ i.createElement(D.Trigger, m({}, n));
366
+ function Trigger() {
367
+ var _ref6 = arguments[0];
368
+ return /* @__PURE__ */ React.createElement(Dropdown.Trigger, assignProps({}, _ref6));
298
369
  }
299
- function Ie(n) {
300
- var _ = arguments[0], t, a = n.styles, r = z, o = i.useRef(), e = i.useContext(H), s = void 0;
301
- e.hasSubMenu && (s = "true");
302
- var u = i.useState(new Set(e.ariaDescribes)), d = N(u, 2), h = d[0], l = d[1];
303
- return i.useEffect(function() {
304
- var p = o.current, c = p == null ? void 0 : p.parentElement;
305
- c.getAttribute("aria-haspopup") === "true" && c.getAttribute("aria-describedby") && l(function(f) {
306
- return f.add(c.getAttribute("aria-describedby")), new Set(f);
307
- });
308
- }, [e.ariaDescribes]), t = x(a), /* @__PURE__ */ i.createElement(r, t.cn("SItemContent", g({}, m({
309
- role: e.role,
310
- id: e.contentId,
311
- tabIndex: e.tabIndex,
312
- ref: G(e.ref, o),
313
- "use:aria-describedby": X(h).join(" "),
314
- "aria-haspopup": e.hasSubMenu ? "true" : void 0,
315
- "aria-expanded": s,
316
- "aria-checked": e.ariaChecked,
317
- alignItems: "center",
318
- justifyContent: e.hasSubMenu ? "space-between" : void 0
319
- }, _))));
370
+ function ItemContent(_ref26) {
371
+ var _ref7 = arguments[0], _ref17;
372
+ var styles = _ref26.styles;
373
+ var SItemContent = Flex;
374
+ var ref = React.useRef();
375
+ var menuItemCtxValue = React.useContext(menuItemContext);
376
+ var subMenu = void 0;
377
+ if (menuItemCtxValue.hasSubMenu) {
378
+ subMenu = "true";
379
+ }
380
+ var _React$useState3 = React.useState(new Set(menuItemCtxValue.ariaDescribes)), _React$useState4 = _slicedToArray(_React$useState3, 2), describedby = _React$useState4[0], setDescribedby = _React$useState4[1];
381
+ React.useEffect(function() {
382
+ var element = ref.current;
383
+ var parent = element === null || element === void 0 ? void 0 : element.parentElement;
384
+ if (parent.getAttribute("aria-haspopup") === "true" && parent.getAttribute("aria-describedby")) {
385
+ setDescribedby(function(prev) {
386
+ prev.add(parent.getAttribute("aria-describedby"));
387
+ return new Set(prev);
388
+ });
389
+ }
390
+ }, [menuItemCtxValue.ariaDescribes]);
391
+ return _ref17 = sstyled(styles), /* @__PURE__ */ React.createElement(SItemContent, _ref17.cn("SItemContent", _objectSpread({}, assignProps({
392
+ "role": menuItemCtxValue.role,
393
+ "id": menuItemCtxValue.contentId,
394
+ "tabIndex": menuItemCtxValue.tabIndex,
395
+ "ref": forkRef(menuItemCtxValue.ref, ref),
396
+ "use:aria-describedby": _toConsumableArray(describedby).join(" "),
397
+ "aria-haspopup": menuItemCtxValue.hasSubMenu ? "true" : void 0,
398
+ "aria-expanded": subMenu,
399
+ "aria-checked": menuItemCtxValue.ariaChecked,
400
+ "alignItems": "center",
401
+ "justifyContent": menuItemCtxValue.hasSubMenu ? "space-between" : void 0
402
+ }, _ref7))));
320
403
  }
321
- function ye(n) {
322
- var _ = arguments[0], t, a = n.styles, r = he;
323
- return t = x(a), /* @__PURE__ */ i.createElement(r, t.cn("SItemContentText", g({}, m({}, _))));
404
+ function ItemContentText(_ref27) {
405
+ var _ref8 = arguments[0], _ref18;
406
+ var styles = _ref27.styles;
407
+ var SItemContentText = Text;
408
+ return _ref18 = sstyled(styles), /* @__PURE__ */ React.createElement(SItemContentText, _ref18.cn("SItemContentText", _objectSpread({}, assignProps({}, _ref8))));
324
409
  }
325
- function xe(n) {
326
- var _ = arguments[0], t, a = n.styles, r = z, o = i.useContext(H), e = o.hintId;
327
- return t = x(a), /* @__PURE__ */ i.createElement(r, t.cn("SItemHint", g({}, m({
328
- id: e,
410
+ function ItemHint(_ref28) {
411
+ var _ref9 = arguments[0], _ref19;
412
+ var styles = _ref28.styles;
413
+ var SItemHint = Flex;
414
+ var _React$useContext = React.useContext(menuItemContext), hintId = _React$useContext.hintId;
415
+ return _ref19 = sstyled(styles), /* @__PURE__ */ React.createElement(SItemHint, _ref19.cn("SItemHint", _objectSpread({}, assignProps({
416
+ "id": hintId,
329
417
  "aria-hidden": "true"
330
- }, _))));
418
+ }, _ref9))));
331
419
  }
332
- function De(n) {
333
- var _ = arguments[0], t, a = D.Item;
334
- return t = x(n.styles), /* @__PURE__ */ i.createElement(a, t.cn("SDropdownMenuItemContainer", g({}, m({
335
- variant: "hint"
336
- }, _))));
420
+ function Hint(props) {
421
+ var _ref10 = arguments[0], _ref20;
422
+ var SDropdownMenuItemContainer = Dropdown.Item;
423
+ return _ref20 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SDropdownMenuItemContainer, _ref20.cn("SDropdownMenuItemContainer", _objectSpread({}, assignProps({
424
+ "variant": "hint"
425
+ }, _ref10))));
337
426
  }
338
- function Ce(n) {
339
- var _ = arguments[0], t, a = D.Item;
340
- return t = x(n.styles), /* @__PURE__ */ i.createElement(a, t.cn("SDropdownMenuItemContainer", g({}, m({
341
- variant: "title"
342
- }, _))));
427
+ function Title(props) {
428
+ var _ref11 = arguments[0], _ref21;
429
+ var SDropdownMenuItemContainer = Dropdown.Item;
430
+ return _ref21 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SDropdownMenuItemContainer, _ref21.cn("SDropdownMenuItemContainer", _objectSpread({}, assignProps({
431
+ "variant": "title"
432
+ }, _ref11))));
343
433
  }
344
- function Me(n) {
345
- var _ = arguments[0], t = n.forwardRef;
346
- return /* @__PURE__ */ i.createElement(v.Item, m({
347
- ref: t
348
- }, _));
434
+ function Nesting(_ref29) {
435
+ var _ref12 = arguments[0];
436
+ var forwardRef = _ref29.forwardRef;
437
+ return /* @__PURE__ */ React.createElement(DropdownMenu.Item, assignProps({
438
+ "ref": forwardRef
439
+ }, _ref12));
349
440
  }
350
- function Pe(n) {
351
- var _ = arguments[0], t = n.forwardRef;
352
- return /* @__PURE__ */ i.createElement(v.Item.Content, m({
353
- tag: v.Trigger,
354
- ref: t,
441
+ function NestingTrigger(_ref30) {
442
+ var _ref13 = arguments[0];
443
+ var forwardRef = _ref30.forwardRef;
444
+ return /* @__PURE__ */ React.createElement(DropdownMenu.Item.Content, assignProps({
445
+ "tag": DropdownMenu.Trigger,
446
+ "ref": forwardRef,
355
447
  "use:role": "menuitem"
356
- }, _));
448
+ }, _ref13));
357
449
  }
358
- var v = oe(P, {
359
- Trigger: we,
360
- Popper: D.Popper,
361
- List: fe,
362
- Actions: ve,
363
- Menu: be,
364
- Item: [Se, {
365
- Addon: O,
366
- Content: Ie,
367
- Text: ye,
368
- Hint: xe
450
+ var DropdownMenu = createComponent(DropdownMenuRoot, {
451
+ Trigger,
452
+ Popper: Dropdown.Popper,
453
+ List,
454
+ Actions,
455
+ Menu,
456
+ Item: [Item, {
457
+ Addon,
458
+ Content: ItemContent,
459
+ Text: ItemContentText,
460
+ Hint: ItemHint
369
461
  }],
370
462
  /**
371
463
  * @deprecated. Use just Item. See examples on
372
464
  */
373
- Nesting: [Me, {
374
- Trigger: Pe,
375
- Addon: O
465
+ Nesting: [Nesting, {
466
+ Trigger: NestingTrigger,
467
+ Addon
376
468
  }],
377
- ItemTitle: Ce,
378
- ItemHint: De,
379
- Group: D.Group
469
+ ItemTitle: Title,
470
+ ItemHint: Hint,
471
+ Group: Dropdown.Group
380
472
  }, {
381
- parent: [D]
473
+ parent: [Dropdown]
382
474
  });
383
- v.selectedIndexContext = q;
475
+ DropdownMenu.selectedIndexContext = selectedIndexContext;
384
476
  export {
385
- v as default
477
+ DropdownMenu as default
386
478
  };