@semcore/dropdown-menu 16.0.0-prerelease.2 → 16.0.0-prerelease.21

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