@semcore/dropdown-menu 4.39.1 → 4.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/lib/cjs/DropdownMenu.js +167 -418
- package/lib/cjs/DropdownMenu.js.map +1 -1
- package/lib/cjs/index.d.js.map +1 -1
- package/lib/cjs/index.js +0 -7
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/style/dropdown-menu.shadow.css +3 -91
- package/lib/cjs/translations/en.json +1 -3
- package/lib/es6/DropdownMenu.js +167 -419
- package/lib/es6/DropdownMenu.js.map +1 -1
- package/lib/es6/index.d.js.map +1 -1
- package/lib/es6/index.js +0 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/style/dropdown-menu.shadow.css +3 -91
- package/lib/es6/translations/en.json +1 -3
- package/lib/types/index.d.ts +3 -11
- package/package.json +7 -7
- package/lib/cjs/DropdownMenuOld.js +0 -682
- package/lib/cjs/DropdownMenuOld.js.map +0 -1
- package/lib/cjs/style/dropdown-menu-old.shadow.css +0 -224
- package/lib/es6/DropdownMenuOld.js +0 -683
- package/lib/es6/DropdownMenuOld.js.map +0 -1
- package/lib/es6/style/dropdown-menu-old.shadow.css +0 -224
|
@@ -1,683 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
-
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
5
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
6
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
7
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
8
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
9
|
-
import _createSuper from "@babel/runtime/helpers/createSuper";
|
|
10
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
11
|
-
import { sstyled as _sstyled } from "@semcore/utils/lib/core/index";
|
|
12
|
-
import { assignProps as _assignProps10 } from "@semcore/core";
|
|
13
|
-
import { assignProps as _assignProps9 } from "@semcore/core";
|
|
14
|
-
import { assignProps as _assignProps8 } from "@semcore/core";
|
|
15
|
-
import { assignProps as _assignProps7 } from "@semcore/core";
|
|
16
|
-
import { assignProps as _assignProps6 } from "@semcore/core";
|
|
17
|
-
import { assignProps as _assignProps5 } from "@semcore/core";
|
|
18
|
-
import { assignProps as _assignProps4 } from "@semcore/core";
|
|
19
|
-
import { assignProps as _assignProps3 } from "@semcore/core";
|
|
20
|
-
import { assignProps as _assignProps2 } from "@semcore/core";
|
|
21
|
-
import { assignProps as _assignProps } from "@semcore/core";
|
|
22
|
-
var _excluded = ["className"];
|
|
23
|
-
import React from 'react';
|
|
24
|
-
import cn from 'classnames';
|
|
25
|
-
import createComponent, { Component, sstyled, Root } from '@semcore/core';
|
|
26
|
-
import Dropdown from '@semcore/dropdown';
|
|
27
|
-
import { Flex, useBox } from '@semcore/flex-box';
|
|
28
|
-
import ScrollAreaComponent, { hideScrollBarsFromScreenReadersContext } from '@semcore/scroll-area';
|
|
29
|
-
import uniqueIDEnhancement from '@semcore/utils/lib/uniqueID';
|
|
30
|
-
import i18nEnhance from '@semcore/utils/lib/enhances/i18nEnhance';
|
|
31
|
-
import { localizedMessages } from './translations/__intergalactic-dynamic-locales';
|
|
32
|
-
import { useFocusLock } from '@semcore/utils/lib/use/useFocusLock';
|
|
33
|
-
import { hasParent } from '@semcore/utils/lib/hasParent';
|
|
34
|
-
/*__reshadow-styles__:"./style/dropdown-menu-old.shadow.css"*/
|
|
35
|
-
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SDropdownMenuItem_l0ig1_gg_,.___SDropdownMenuList_l0ig1_gg_{position:relative;color:var(--intergalactic-text-primary, #191b23)}.___SDropdownMenuList_l0ig1_gg_{max-height:240px;padding:var(--intergalactic-spacing-1x, 4px)0;min-height:26px;min-width:32px;box-sizing:content-box;z-index:0}.___SDropdownMenuList_l0ig1_gg_ .___SShadowHorizontal_l0ig1_gg_:after,.___SDropdownMenuList_l0ig1_gg_ .___SShadowHorizontal_l0ig1_gg_:before{width:16px;height:100%;border-radius:var(--intergalactic-control-rounded, 6px)}.___SDropdownMenuList_l0ig1_gg_ .___SShadowHorizontal_l0ig1_gg_._position_median_l0ig1_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_l0ig1_gg_ .___SShadowHorizontal_l0ig1_gg_._position_median_l0ig1_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_l0ig1_gg_ .___SShadowHorizontal_l0ig1_gg_._position_start_l0ig1_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_l0ig1_gg_ .___SShadowHorizontal_l0ig1_gg_._position_end_l0ig1_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_l0ig1_gg_ .___SShadowVertical_l0ig1_gg_:after,.___SDropdownMenuList_l0ig1_gg_ .___SShadowVertical_l0ig1_gg_:before{width:100%;height:16px;border-radius:var(--intergalactic-control-rounded, 6px)}.___SDropdownMenuList_l0ig1_gg_ .___SShadowVertical_l0ig1_gg_._position_median_l0ig1_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_l0ig1_gg_ .___SShadowVertical_l0ig1_gg_._position_median_l0ig1_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_l0ig1_gg_ .___SShadowVertical_l0ig1_gg_._position_start_l0ig1_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_l0ig1_gg_ .___SShadowVertical_l0ig1_gg_._position_end_l0ig1_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 )}.___SDropdownMenuItem_l0ig1_gg_{display:flex;align-items:center;-webkit-text-decoration:none;text-decoration:none;box-sizing:border-box;cursor:pointer;width:100%;text-align:left;line-height:normal}@media (hover:hover){.___SDropdownMenuItem_l0ig1_gg_:hover{background-color:var(--intergalactic-dropdown-menu-item-hover, #f4f5f9)}}.___SDropdownMenuItem_l0ig1_gg_:focus{outline:0}.___SDropdownMenuItem_l0ig1_gg_.__selected_l0ig1_gg_{background-color:var(--intergalactic-dropdown-menu-item-selected, rgba(196, 229, 254, 0.7));box-shadow:2px 0 0 0 var(--intergalactic-control-primary-info, #008ff8) inset}@media (hover:hover){.___SDropdownMenuItem_l0ig1_gg_.__selected_l0ig1_gg_:hover{background-color:var(--intergalactic-dropdown-menu-item-selected-hover, #c4e5fe)}}.___SDropdownMenuItem_l0ig1_gg_.__highlighted_l0ig1_gg_:not(:focus-within){z-index:1;box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5)) inset}.___SDropdownMenuItem_l0ig1_gg_.__disabled_l0ig1_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SDropdownMenuItem_l0ig1_gg_._size_l_l0ig1_gg_{font-size:var(--intergalactic-fs-300, 16px);line-height:var(--intergalactic-lh-300, 150%);padding:var(--intergalactic-spacing-2x, 8px) var(--intergalactic-spacing-3x, 12px);min-height:40px}.___SDropdownMenuItem_l0ig1_gg_._size_m_l0ig1_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%);padding:calc(var(--intergalactic-spacing-1x, 4px) + var(--intergalactic-spacing-05x, 2px)) var(--intergalactic-spacing-2x, 8px);min-height:32px}.___SDropdownMenuItem_l0ig1_gg_.__notInteractive_l0ig1_gg_{cursor:default}@media (hover:hover){.___SDropdownMenuItem_l0ig1_gg_.__notInteractive_l0ig1_gg_:hover{background:0 0}}.___SDropdownMenuItem_l0ig1_gg_._variant_hint_l0ig1_gg_{color:var(--intergalactic-text-secondary, #6c6e79);cursor:default}@media (hover:hover){.___SDropdownMenuItem_l0ig1_gg_._variant_hint_l0ig1_gg_:hover{background:0 0}}.___SDropdownMenuItem_l0ig1_gg_._variant_title_l0ig1_gg_{font-weight:var(--intergalactic-bold, 700);cursor:default}@media (hover:hover){.___SDropdownMenuItem_l0ig1_gg_._variant_title_l0ig1_gg_:hover{background:0 0}}.___SDropdownMenuItem_l0ig1_gg_.__visible_l0ig1_gg_{background-color:var(--intergalactic-dropdown-menu-item-hover, #f4f5f9)}.___SDropdownMenuItem_l0ig1_gg_.__nesting-trigger_l0ig1_gg_{justify-content:space-between}.___SDropdownMenuItemAddon_l0ig1_gg_{display:inline-flex;margin-left:var(--intergalactic-spacing-2x, 8px);margin-right:var(--intergalactic-spacing-2x, 8px)}.___SDropdownMenuItemAddon_l0ig1_gg_:first-child{margin-left:0}.___SDropdownMenuItemAddon_l0ig1_gg_:last-child{margin-right:0}.___SDropdownMenuNesting_l0ig1_gg_,.___SDropdownMenuNesting_l0ig1_gg_._size_l_l0ig1_gg_,.___SDropdownMenuNesting_l0ig1_gg_._size_m_l0ig1_gg_{padding:0}.___SDropdownMenuNesting_l0ig1_gg_.__highlighted_l0ig1_gg_{z-index:1;box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5)) inset}.___SDropdownNestingItem_l0ig1_gg_._size_l_l0ig1_gg_,.___SDropdownNestingItem_l0ig1_gg_._size_m_l0ig1_gg_{padding-right:0}.___SDropdownNestingItem_l0ig1_gg_ .___SDropdownMenuItem_l0ig1_gg_{width:auto;padding-top:0;padding-bottom:0;padding-left:0;min-height:auto}" /*__inner_css_end__*/, "l0ig1_gg_") /*__reshadow_css_end__*/, {
|
|
36
|
-
"__SDropdownMenuItem": "___SDropdownMenuItem_l0ig1_gg_",
|
|
37
|
-
"_highlighted": "__highlighted_l0ig1_gg_",
|
|
38
|
-
"_disabled": "__disabled_l0ig1_gg_",
|
|
39
|
-
"_size_l": "_size_l_l0ig1_gg_",
|
|
40
|
-
"_size_m": "_size_m_l0ig1_gg_",
|
|
41
|
-
"_visible": "__visible_l0ig1_gg_",
|
|
42
|
-
"_nesting-trigger": "__nesting-trigger_l0ig1_gg_",
|
|
43
|
-
"__SDropdownMenuNesting": "___SDropdownMenuNesting_l0ig1_gg_",
|
|
44
|
-
"__SDropdownNestingItem": "___SDropdownNestingItem_l0ig1_gg_",
|
|
45
|
-
"__SDropdownMenuList": "___SDropdownMenuList_l0ig1_gg_",
|
|
46
|
-
"__SShadowHorizontal": "___SShadowHorizontal_l0ig1_gg_",
|
|
47
|
-
"_position_median": "_position_median_l0ig1_gg_",
|
|
48
|
-
"_position_start": "_position_start_l0ig1_gg_",
|
|
49
|
-
"_position_end": "_position_end_l0ig1_gg_",
|
|
50
|
-
"__SShadowVertical": "___SShadowVertical_l0ig1_gg_",
|
|
51
|
-
"_selected": "__selected_l0ig1_gg_",
|
|
52
|
-
"_notInteractive": "__notInteractive_l0ig1_gg_",
|
|
53
|
-
"_variant_hint": "_variant_hint_l0ig1_gg_",
|
|
54
|
-
"_variant_title": "_variant_title_l0ig1_gg_",
|
|
55
|
-
"__SDropdownMenuItemAddon": "___SDropdownMenuItemAddon_l0ig1_gg_"
|
|
56
|
-
});
|
|
57
|
-
import { setFocus } from '@semcore/utils/lib/focus-lock/setFocus';
|
|
58
|
-
import { isFocusInside } from '@semcore/utils/lib/focus-lock/isFocusInside';
|
|
59
|
-
import { getFocusableIn } from '@semcore/utils/lib/focus-lock/getFocusableIn';
|
|
60
|
-
import keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';
|
|
61
|
-
var ListBoxContextProvider = function ListBoxContextProvider(_ref18) {
|
|
62
|
-
var children = _ref18.children;
|
|
63
|
-
return /*#__PURE__*/React.createElement(hideScrollBarsFromScreenReadersContext.Provider, {
|
|
64
|
-
value: true
|
|
65
|
-
}, children);
|
|
66
|
-
};
|
|
67
|
-
var DropdownMenuRoot = /*#__PURE__*/function (_Component) {
|
|
68
|
-
_inherits(DropdownMenuRoot, _Component);
|
|
69
|
-
var _super = _createSuper(DropdownMenuRoot);
|
|
70
|
-
function DropdownMenuRoot() {
|
|
71
|
-
var _this;
|
|
72
|
-
_classCallCheck(this, DropdownMenuRoot);
|
|
73
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
74
|
-
args[_key] = arguments[_key];
|
|
75
|
-
}
|
|
76
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
77
|
-
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
78
|
-
focusLockItemIndex: null,
|
|
79
|
-
keyboardFocused: false
|
|
80
|
-
});
|
|
81
|
-
_defineProperty(_assertThisInitialized(_this), "popperRef", /*#__PURE__*/React.createRef());
|
|
82
|
-
_defineProperty(_assertThisInitialized(_this), "triggerRef", /*#__PURE__*/React.createRef());
|
|
83
|
-
_defineProperty(_assertThisInitialized(_this), "itemProps", []);
|
|
84
|
-
_defineProperty(_assertThisInitialized(_this), "itemRefs", []);
|
|
85
|
-
_defineProperty(_assertThisInitialized(_this), "highlightedItemRef", /*#__PURE__*/React.createRef());
|
|
86
|
-
_defineProperty(_assertThisInitialized(_this), "ignoreTriggerKeyboardFocusUntil", 0);
|
|
87
|
-
_defineProperty(_assertThisInitialized(_this), "prevHighlightedIndex", null);
|
|
88
|
-
_defineProperty(_assertThisInitialized(_this), "focusTrigger", function () {
|
|
89
|
-
var trigger = _this.triggerRef.current;
|
|
90
|
-
if (!trigger) return;
|
|
91
|
-
if (isFocusInside(trigger)) return;
|
|
92
|
-
setFocus(trigger);
|
|
93
|
-
});
|
|
94
|
-
_defineProperty(_assertThisInitialized(_this), "bindHandlerKeyDown", function (place) {
|
|
95
|
-
return function (e) {
|
|
96
|
-
var amount = e.shiftKey ? 5 : 1;
|
|
97
|
-
var targetTagName = e.target.tagName;
|
|
98
|
-
var _this$asProps = _this.asProps,
|
|
99
|
-
visible = _this$asProps.visible,
|
|
100
|
-
highlightedIndex = _this$asProps.highlightedIndex,
|
|
101
|
-
placement = _this$asProps.placement;
|
|
102
|
-
if (e.key === ' ' && ['INPUT', 'TEXTAREA'].includes(targetTagName)) return;
|
|
103
|
-
if (e.key === 'Enter' && targetTagName === 'TEXTAREA') return;
|
|
104
|
-
if (place === 'popper' && (e.key === ' ' || e.key === 'Enter') && (targetTagName === 'BUTTON' || targetTagName === 'A')) return;
|
|
105
|
-
if (visible && e.key === 'Tab') {
|
|
106
|
-
var item = highlightedIndex !== null && _this.itemRefs[highlightedIndex];
|
|
107
|
-
if (item && getFocusableIn(item).length !== 0) {
|
|
108
|
-
_this.setState({
|
|
109
|
-
focusLockItemIndex: highlightedIndex
|
|
110
|
-
});
|
|
111
|
-
} else {
|
|
112
|
-
_this.handlers.highlightedIndex(null);
|
|
113
|
-
}
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
if (e.key === 'Escape' && _this.state.focusLockItemIndex !== null) {
|
|
117
|
-
_this.setState({
|
|
118
|
-
focusLockItemIndex: null
|
|
119
|
-
});
|
|
120
|
-
return false;
|
|
121
|
-
}
|
|
122
|
-
var verticalPlacement = !placement || placement.startsWith('top') || placement.startsWith('bottom');
|
|
123
|
-
if (['ArrowDown', 'ArrowUp'].includes(e.key) && verticalPlacement) {
|
|
124
|
-
e.preventDefault();
|
|
125
|
-
_this.handlers.visible(true);
|
|
126
|
-
}
|
|
127
|
-
if (['ArrowLeft', 'ArrowRight'].includes(e.key) && !verticalPlacement) {
|
|
128
|
-
var show = e.key === 'ArrowRight' && placement.startsWith('right') || e.key === 'ArrowLeft' && placement.startsWith('left');
|
|
129
|
-
var hide = e.key === 'ArrowLeft' && placement.startsWith('right') || e.key === 'ArrowRight' && placement.startsWith('left');
|
|
130
|
-
var visibleChanged = visible && hide || !visible && show;
|
|
131
|
-
if (show) {
|
|
132
|
-
_this.handlers.visible(true);
|
|
133
|
-
} else if (hide) {
|
|
134
|
-
_this.handlers.visible(false);
|
|
135
|
-
}
|
|
136
|
-
if (visibleChanged) {
|
|
137
|
-
e.preventDefault();
|
|
138
|
-
e.stopPropagation();
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
if (e.key.startsWith('Arrow') && !_this.state.keyboardFocused) {
|
|
143
|
-
_this.setState({
|
|
144
|
-
keyboardFocused: true
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
if (['ArrowLeft', 'ArrowRight'].includes(e.key)) {
|
|
148
|
-
var _item = highlightedIndex !== null && _this.itemRefs[highlightedIndex];
|
|
149
|
-
var focusable = getFocusableIn(_item);
|
|
150
|
-
if (focusable.length > 0 && _item) {
|
|
151
|
-
var focusedIndex = focusable.indexOf(document.activeElement);
|
|
152
|
-
if (e.key === 'ArrowRight') {
|
|
153
|
-
if (focusedIndex === -1) {
|
|
154
|
-
_this.setState({
|
|
155
|
-
focusLockItemIndex: highlightedIndex
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
var nextFocused = focusable[focusedIndex + 1];
|
|
159
|
-
if (nextFocused) {
|
|
160
|
-
e.preventDefault();
|
|
161
|
-
e.stopPropagation();
|
|
162
|
-
nextFocused.focus();
|
|
163
|
-
}
|
|
164
|
-
} else if (e.key === 'ArrowLeft') {
|
|
165
|
-
if (focusedIndex === 0) {
|
|
166
|
-
_this.setState({
|
|
167
|
-
focusLockItemIndex: null
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
var prevFocused = focusable[focusedIndex - 1];
|
|
171
|
-
if (prevFocused) {
|
|
172
|
-
e.preventDefault();
|
|
173
|
-
e.stopPropagation();
|
|
174
|
-
prevFocused.focus();
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
switch (e.key) {
|
|
180
|
-
case 'ArrowDown':
|
|
181
|
-
{
|
|
182
|
-
if (visible) {
|
|
183
|
-
_this.moveHighlightedIndex(amount, e);
|
|
184
|
-
if (isFocusInside(_this.popperRef.current)) {
|
|
185
|
-
_this.focusTrigger();
|
|
186
|
-
}
|
|
187
|
-
e.preventDefault();
|
|
188
|
-
e.stopPropagation();
|
|
189
|
-
}
|
|
190
|
-
break;
|
|
191
|
-
}
|
|
192
|
-
case 'ArrowUp':
|
|
193
|
-
{
|
|
194
|
-
if (visible) {
|
|
195
|
-
_this.moveHighlightedIndex(-amount, e);
|
|
196
|
-
if (isFocusInside(_this.popperRef.current)) {
|
|
197
|
-
_this.focusTrigger();
|
|
198
|
-
}
|
|
199
|
-
e.preventDefault();
|
|
200
|
-
e.stopPropagation();
|
|
201
|
-
}
|
|
202
|
-
break;
|
|
203
|
-
}
|
|
204
|
-
case ' ':
|
|
205
|
-
case 'Enter':
|
|
206
|
-
if (_this.highlightedItemRef.current && highlightedIndex !== null) {
|
|
207
|
-
e.stopPropagation();
|
|
208
|
-
e.preventDefault();
|
|
209
|
-
_this.highlightedItemRef.current.click();
|
|
210
|
-
} else {
|
|
211
|
-
if (place === 'trigger') {
|
|
212
|
-
_this.handlers.visible(false);
|
|
213
|
-
e.preventDefault();
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
break;
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
|
-
});
|
|
220
|
-
_defineProperty(_assertThisInitialized(_this), "handleTriggerKeyboardFocus", function () {
|
|
221
|
-
if (_this.ignoreTriggerKeyboardFocusUntil > Date.now()) return false;
|
|
222
|
-
});
|
|
223
|
-
_defineProperty(_assertThisInitialized(_this), "handleTriggerKeyboardFocusedStateChange", function (keyboardFocused) {
|
|
224
|
-
_this.setState({
|
|
225
|
-
keyboardFocused: keyboardFocused
|
|
226
|
-
});
|
|
227
|
-
});
|
|
228
|
-
_defineProperty(_assertThisInitialized(_this), "handleItemFocusOut", function (event) {
|
|
229
|
-
if (event.relatedTarget === _this.popperRef.current) return;
|
|
230
|
-
var focused = event.relatedTarget;
|
|
231
|
-
if (hasParent(focused, _this.popperRef.current)) {
|
|
232
|
-
_this.handlers.highlightedIndex(null);
|
|
233
|
-
_this.setState({
|
|
234
|
-
focusLockItemIndex: null
|
|
235
|
-
});
|
|
236
|
-
focused.focus();
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
_defineProperty(_assertThisInitialized(_this), "handleNestingClick", function (event) {
|
|
240
|
-
var _focusable$;
|
|
241
|
-
var itemIndex = _this.itemRefs.indexOf(event.currentTarget);
|
|
242
|
-
if (itemIndex === -1) return;
|
|
243
|
-
var focusable = getFocusableIn(event.currentTarget);
|
|
244
|
-
(_focusable$ = focusable[0]) === null || _focusable$ === void 0 ? void 0 : _focusable$.focus();
|
|
245
|
-
if (focusable[0] && _this.state.focusLockItemIndex === null) {
|
|
246
|
-
_this.setState({
|
|
247
|
-
focusLockItemIndex: null
|
|
248
|
-
});
|
|
249
|
-
event.preventDefault();
|
|
250
|
-
event.stopPropagation();
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
_defineProperty(_assertThisInitialized(_this), "handleNestingKeyDown", function (event) {
|
|
254
|
-
if (event.key === ' ') {
|
|
255
|
-
_this.handleNestingClick(event);
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
_defineProperty(_assertThisInitialized(_this), "getNestingProps", function () {
|
|
259
|
-
var size = _this.asProps.size;
|
|
260
|
-
return {
|
|
261
|
-
size: size,
|
|
262
|
-
onClick: _this.handleNestingClick,
|
|
263
|
-
onKeyDown: _this.handleNestingKeyDown
|
|
264
|
-
};
|
|
265
|
-
});
|
|
266
|
-
_defineProperty(_assertThisInitialized(_this), "handleNestedVisibleChange", function (lastUserInteraction) {
|
|
267
|
-
if (_this.asProps.visible && _this.asProps.highlightedIndex === null && lastUserInteraction === 'keyboard') {
|
|
268
|
-
_this.handlers.highlightedIndex(0);
|
|
269
|
-
}
|
|
270
|
-
});
|
|
271
|
-
_defineProperty(_assertThisInitialized(_this), "getNestingTriggerProps", function () {
|
|
272
|
-
var _this$asProps2 = _this.asProps,
|
|
273
|
-
size = _this$asProps2.size,
|
|
274
|
-
visible = _this$asProps2.visible;
|
|
275
|
-
return {
|
|
276
|
-
size: size,
|
|
277
|
-
visible: visible,
|
|
278
|
-
onNestedVisibleChange: _this.handleNestedVisibleChange
|
|
279
|
-
};
|
|
280
|
-
});
|
|
281
|
-
_defineProperty(_assertThisInitialized(_this), "getNestingItemProps", function () {
|
|
282
|
-
return _this.getNestingTriggerProps();
|
|
283
|
-
});
|
|
284
|
-
_defineProperty(_assertThisInitialized(_this), "scrollToNode", function (node) {
|
|
285
|
-
if (node) {
|
|
286
|
-
_this.highlightedItemRef.current = node;
|
|
287
|
-
}
|
|
288
|
-
setTimeout(function () {
|
|
289
|
-
if (node !== null && node !== void 0 && node.scrollIntoView) {
|
|
290
|
-
if (_this.asProps.highlightedIndex !== _this.prevHighlightedIndex) {
|
|
291
|
-
_this.prevHighlightedIndex = _this.asProps.highlightedIndex;
|
|
292
|
-
node.scrollIntoView({
|
|
293
|
-
block: 'nearest',
|
|
294
|
-
inline: 'nearest'
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
}, 0);
|
|
299
|
-
});
|
|
300
|
-
return _this;
|
|
301
|
-
}
|
|
302
|
-
_createClass(DropdownMenuRoot, [{
|
|
303
|
-
key: "uncontrolledProps",
|
|
304
|
-
value: function uncontrolledProps() {
|
|
305
|
-
return {
|
|
306
|
-
highlightedIndex: null,
|
|
307
|
-
visible: null
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
|
-
}, {
|
|
311
|
-
key: "getTriggerProps",
|
|
312
|
-
value: function getTriggerProps() {
|
|
313
|
-
var _this$asProps3 = this.asProps,
|
|
314
|
-
size = _this$asProps3.size,
|
|
315
|
-
uid = _this$asProps3.uid,
|
|
316
|
-
disablePortal = _this$asProps3.disablePortal,
|
|
317
|
-
visible = _this$asProps3.visible,
|
|
318
|
-
getI18nText = _this$asProps3.getI18nText,
|
|
319
|
-
highlightedIndex = _this$asProps3.highlightedIndex;
|
|
320
|
-
return {
|
|
321
|
-
size: size,
|
|
322
|
-
id: "igc-".concat(uid, "-trigger"),
|
|
323
|
-
'aria-controls': "igc-".concat(uid, "-popper"),
|
|
324
|
-
focusHint: visible && !disablePortal ? getI18nText('triggerHint') : undefined,
|
|
325
|
-
'aria-expanded': visible ? 'true' : 'false',
|
|
326
|
-
'aria-activedescendant': visible && highlightedIndex !== null ? "igc-".concat(uid, "-option-").concat(highlightedIndex) : undefined,
|
|
327
|
-
onKeyDown: this.bindHandlerKeyDown('trigger'),
|
|
328
|
-
ref: this.triggerRef,
|
|
329
|
-
onKeyboardFocus: this.handleTriggerKeyboardFocus,
|
|
330
|
-
onKeyboardFocusedStateChange: this.handleTriggerKeyboardFocusedStateChange
|
|
331
|
-
};
|
|
332
|
-
}
|
|
333
|
-
}, {
|
|
334
|
-
key: "getListProps",
|
|
335
|
-
value: function getListProps() {
|
|
336
|
-
var _this$asProps4 = this.asProps,
|
|
337
|
-
size = _this$asProps4.size,
|
|
338
|
-
uid = _this$asProps4.uid;
|
|
339
|
-
return {
|
|
340
|
-
size: size,
|
|
341
|
-
uid: uid,
|
|
342
|
-
index: this.asProps.highlightedIndex
|
|
343
|
-
};
|
|
344
|
-
}
|
|
345
|
-
}, {
|
|
346
|
-
key: "getPopperProps",
|
|
347
|
-
value: function getPopperProps() {
|
|
348
|
-
var _this$asProps5 = this.asProps,
|
|
349
|
-
uid = _this$asProps5.uid,
|
|
350
|
-
disablePortal = _this$asProps5.disablePortal,
|
|
351
|
-
ignorePortalsStacking = _this$asProps5.ignorePortalsStacking,
|
|
352
|
-
interaction = _this$asProps5.interaction,
|
|
353
|
-
highlightedIndex = _this$asProps5.highlightedIndex;
|
|
354
|
-
return {
|
|
355
|
-
ref: this.popperRef,
|
|
356
|
-
tabIndex: 0,
|
|
357
|
-
onKeyDown: this.bindHandlerKeyDown('popper'),
|
|
358
|
-
id: "igc-".concat(uid, "-popper"),
|
|
359
|
-
disablePortal: disablePortal,
|
|
360
|
-
ignorePortalsStacking: ignorePortalsStacking,
|
|
361
|
-
focusMaster: interaction === 'click',
|
|
362
|
-
hideFocus: highlightedIndex !== null,
|
|
363
|
-
'use:role': null,
|
|
364
|
-
'use:autoFocus': false
|
|
365
|
-
};
|
|
366
|
-
}
|
|
367
|
-
}, {
|
|
368
|
-
key: "getItemProps",
|
|
369
|
-
value: function getItemProps(props, index) {
|
|
370
|
-
var _this2 = this;
|
|
371
|
-
var _this$asProps6 = this.asProps,
|
|
372
|
-
size = _this$asProps6.size,
|
|
373
|
-
highlightedIndex = _this$asProps6.highlightedIndex,
|
|
374
|
-
uid = _this$asProps6.uid;
|
|
375
|
-
var highlighted = index === highlightedIndex;
|
|
376
|
-
var ref = function ref(node) {
|
|
377
|
-
_this2.itemRefs[index] = node;
|
|
378
|
-
};
|
|
379
|
-
this.itemProps[index] = props;
|
|
380
|
-
if (highlighted) {
|
|
381
|
-
ref = function ref(node) {
|
|
382
|
-
_this2.itemRefs[index] = node;
|
|
383
|
-
_this2.scrollToNode(node);
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
|
-
return {
|
|
387
|
-
id: "igc-".concat(uid, "-option-").concat(index),
|
|
388
|
-
size: size,
|
|
389
|
-
highlighted: highlighted,
|
|
390
|
-
focusLock: this.state.focusLockItemIndex === index,
|
|
391
|
-
triggerRef: this.triggerRef,
|
|
392
|
-
ref: ref,
|
|
393
|
-
index: index,
|
|
394
|
-
handleFocusOut: this.handleItemFocusOut,
|
|
395
|
-
triggerKeyboardFocused: this.state.keyboardFocused
|
|
396
|
-
};
|
|
397
|
-
}
|
|
398
|
-
}, {
|
|
399
|
-
key: "getItemHintProps",
|
|
400
|
-
value: function getItemHintProps() {
|
|
401
|
-
var size = this.asProps.size;
|
|
402
|
-
return {
|
|
403
|
-
size: size
|
|
404
|
-
};
|
|
405
|
-
}
|
|
406
|
-
}, {
|
|
407
|
-
key: "getItemTitleProps",
|
|
408
|
-
value: function getItemTitleProps() {
|
|
409
|
-
var size = this.asProps.size;
|
|
410
|
-
return {
|
|
411
|
-
size: size
|
|
412
|
-
};
|
|
413
|
-
}
|
|
414
|
-
}, {
|
|
415
|
-
key: "moveHighlightedIndex",
|
|
416
|
-
value: function moveHighlightedIndex(amount, e) {
|
|
417
|
-
var _this$itemProps$newIn;
|
|
418
|
-
var highlightedIndex = this.asProps.highlightedIndex;
|
|
419
|
-
var itemsLastIndex = this.itemProps.length - 1;
|
|
420
|
-
var selectedIndex = this.itemProps.findIndex(function (item) {
|
|
421
|
-
return item.selected;
|
|
422
|
-
});
|
|
423
|
-
if (itemsLastIndex < 0) return;
|
|
424
|
-
if (highlightedIndex == null) {
|
|
425
|
-
if (selectedIndex !== -1) {
|
|
426
|
-
highlightedIndex = selectedIndex;
|
|
427
|
-
} else if (this.highlightedItemRef.current) {
|
|
428
|
-
highlightedIndex = this.prevHighlightedIndex;
|
|
429
|
-
} else {
|
|
430
|
-
highlightedIndex = amount < 0 ? 0 : itemsLastIndex;
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
var newIndex = highlightedIndex + amount;
|
|
434
|
-
if (newIndex < 0) {
|
|
435
|
-
newIndex = amount + itemsLastIndex + 1;
|
|
436
|
-
} else if (newIndex > itemsLastIndex) {
|
|
437
|
-
newIndex = newIndex - itemsLastIndex - 1;
|
|
438
|
-
}
|
|
439
|
-
if ((_this$itemProps$newIn = this.itemProps[newIndex]) !== null && _this$itemProps$newIn !== void 0 && _this$itemProps$newIn.disabled) {
|
|
440
|
-
this.moveHighlightedIndex(amount < 0 ? amount - 1 : amount + 1, e);
|
|
441
|
-
} else if (!this.itemProps[newIndex]) {
|
|
442
|
-
this.handlers.highlightedIndex(0, e);
|
|
443
|
-
} else {
|
|
444
|
-
this.handlers.highlightedIndex(newIndex, e);
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
}, {
|
|
448
|
-
key: "componentDidUpdate",
|
|
449
|
-
value: function componentDidUpdate(prevProps) {
|
|
450
|
-
var _this3 = this;
|
|
451
|
-
var visibilityChanged = this.asProps.visible !== prevProps.visible;
|
|
452
|
-
if (visibilityChanged && prevProps.visible !== undefined) {
|
|
453
|
-
if (!this.asProps.visible) {
|
|
454
|
-
this.handlers.highlightedIndex(null);
|
|
455
|
-
this.highlightedItemRef.current = null;
|
|
456
|
-
this.ignoreTriggerKeyboardFocusUntil = Date.now() + 100;
|
|
457
|
-
if (document.activeElement === document.body || isFocusInside(this.popperRef.current)) {
|
|
458
|
-
setFocus(this.triggerRef.current);
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
if (visibilityChanged && this.asProps.visible) {
|
|
463
|
-
setTimeout(function () {
|
|
464
|
-
var selectedItemIndex = _this3.itemProps.findIndex(function (item) {
|
|
465
|
-
return item.selected;
|
|
466
|
-
});
|
|
467
|
-
if (selectedItemIndex === -1 || _this3.asProps.highlightedIndex !== null) return;
|
|
468
|
-
_this3.handlers.highlightedIndex(selectedItemIndex);
|
|
469
|
-
}, 0);
|
|
470
|
-
}
|
|
471
|
-
if ((this.state.focusLockItemIndex !== this.asProps.highlightedIndex || !this.asProps.visible) && this.state.focusLockItemIndex !== null) {
|
|
472
|
-
setTimeout(function () {
|
|
473
|
-
_this3.setState({
|
|
474
|
-
focusLockItemIndex: null
|
|
475
|
-
});
|
|
476
|
-
}, 0);
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
}, {
|
|
480
|
-
key: "render",
|
|
481
|
-
value: function render() {
|
|
482
|
-
var _ref = this.asProps;
|
|
483
|
-
var Children = this.asProps.Children;
|
|
484
|
-
this.itemProps = [];
|
|
485
|
-
return /*#__PURE__*/React.createElement(Dropdown, _assignProps({}, _ref), /*#__PURE__*/React.createElement(Children, null));
|
|
486
|
-
}
|
|
487
|
-
}]);
|
|
488
|
-
return DropdownMenuRoot;
|
|
489
|
-
}(Component);
|
|
490
|
-
_defineProperty(DropdownMenuRoot, "displayName", 'DropdownMenu');
|
|
491
|
-
_defineProperty(DropdownMenuRoot, "style", style);
|
|
492
|
-
_defineProperty(DropdownMenuRoot, "enhance", [uniqueIDEnhancement(), i18nEnhance(localizedMessages)]);
|
|
493
|
-
_defineProperty(DropdownMenuRoot, "defaultProps", {
|
|
494
|
-
size: 'm',
|
|
495
|
-
defaultVisible: false,
|
|
496
|
-
defaultHighlightedIndex: null,
|
|
497
|
-
i18n: localizedMessages,
|
|
498
|
-
locale: 'en',
|
|
499
|
-
interaction: 'click'
|
|
500
|
-
});
|
|
501
|
-
function List(props) {
|
|
502
|
-
var _ref2 = arguments[0],
|
|
503
|
-
_ref11;
|
|
504
|
-
var SDropdownMenuList = ScrollAreaComponent;
|
|
505
|
-
var uid = props.uid;
|
|
506
|
-
return _ref11 = sstyled(props.styles), /*#__PURE__*/React.createElement(ListBoxContextProvider, _ref11.cn("ListBoxContextProvider", {}), /*#__PURE__*/React.createElement(SDropdownMenuList, _ref11.cn("SDropdownMenuList", _objectSpread({}, _assignProps2({
|
|
507
|
-
"tabIndex": null,
|
|
508
|
-
"role": 'menu',
|
|
509
|
-
"aria-labelledby": "igc-".concat(uid, "-trigger"),
|
|
510
|
-
"shadow": true
|
|
511
|
-
}, _ref2)))));
|
|
512
|
-
}
|
|
513
|
-
function Menu(props) {
|
|
514
|
-
var _ref3 = arguments[0];
|
|
515
|
-
var visible = props.visible,
|
|
516
|
-
disablePortal = props.disablePortal,
|
|
517
|
-
ignorePortalsStacking = props.ignorePortalsStacking,
|
|
518
|
-
disableEnforceFocus = props.disableEnforceFocus,
|
|
519
|
-
interaction = props.interaction,
|
|
520
|
-
autoFocus = props.autoFocus,
|
|
521
|
-
animationsDisabled = props.animationsDisabled;
|
|
522
|
-
var popperProps = {
|
|
523
|
-
visible: visible,
|
|
524
|
-
disablePortal: disablePortal,
|
|
525
|
-
ignorePortalsStacking: ignorePortalsStacking,
|
|
526
|
-
disableEnforceFocus: disableEnforceFocus,
|
|
527
|
-
interaction: interaction,
|
|
528
|
-
autoFocus: autoFocus,
|
|
529
|
-
animationsDisabled: animationsDisabled
|
|
530
|
-
};
|
|
531
|
-
return /*#__PURE__*/React.createElement(ListBoxContextProvider, null, /*#__PURE__*/React.createElement(DropdownMenu.Popper, popperProps, /*#__PURE__*/React.createElement(DropdownMenu.List, _assignProps3({}, _ref3))));
|
|
532
|
-
}
|
|
533
|
-
function Item(_ref19) {
|
|
534
|
-
var _ref4 = arguments[0],
|
|
535
|
-
_ref12;
|
|
536
|
-
var styles = _ref19.styles,
|
|
537
|
-
label = _ref19.label,
|
|
538
|
-
triggerRef = _ref19.triggerRef,
|
|
539
|
-
focusLock = _ref19.focusLock,
|
|
540
|
-
disabled = _ref19.disabled,
|
|
541
|
-
highlighted = _ref19.highlighted,
|
|
542
|
-
handleFocusOut = _ref19.handleFocusOut,
|
|
543
|
-
triggerKeyboardFocused = _ref19.triggerKeyboardFocused;
|
|
544
|
-
var SDropdownMenuItem = Flex;
|
|
545
|
-
var ref = React.useRef();
|
|
546
|
-
useFocusLock(ref, false, triggerRef, !focusLock || disabled, true, handleFocusOut);
|
|
547
|
-
return _ref12 = sstyled(styles), /*#__PURE__*/React.createElement(SDropdownMenuItem, _ref12.cn("SDropdownMenuItem", _objectSpread({}, _assignProps4({
|
|
548
|
-
"ref": ref,
|
|
549
|
-
"role": 'menuitem',
|
|
550
|
-
"tabIndex": -1,
|
|
551
|
-
"id": label,
|
|
552
|
-
"use:highlighted": !disabled && highlighted && triggerKeyboardFocused
|
|
553
|
-
}, _ref4))));
|
|
554
|
-
}
|
|
555
|
-
var NestingContext = /*#__PURE__*/React.createContext(null);
|
|
556
|
-
function Nesting(_ref20) {
|
|
557
|
-
var _ref5 = arguments[0],
|
|
558
|
-
_ref13;
|
|
559
|
-
var styles = _ref20.styles,
|
|
560
|
-
disabled = _ref20.disabled;
|
|
561
|
-
var SDropdownMenuNesting = DropdownMenu.Item;
|
|
562
|
-
var contextValue = React.useMemo(function () {
|
|
563
|
-
return {
|
|
564
|
-
disabled: disabled
|
|
565
|
-
};
|
|
566
|
-
}, [disabled]);
|
|
567
|
-
return /*#__PURE__*/React.createElement(NestingContext.Provider, {
|
|
568
|
-
value: contextValue
|
|
569
|
-
}, (_ref13 = sstyled(styles), /*#__PURE__*/React.createElement(SDropdownMenuNesting, _ref13.cn("SDropdownMenuNesting", _objectSpread({}, _assignProps5({
|
|
570
|
-
"aria-haspopup": 'true'
|
|
571
|
-
}, _ref5))))));
|
|
572
|
-
}
|
|
573
|
-
function NestingTrigger(props) {
|
|
574
|
-
var _ref6 = arguments[0],
|
|
575
|
-
_ref14;
|
|
576
|
-
var styles = props.styles,
|
|
577
|
-
visible = props.visible,
|
|
578
|
-
onNestedVisibleChange = props.onNestedVisibleChange;
|
|
579
|
-
var SDropdownMenuItem = Flex;
|
|
580
|
-
var nestingContext = React.useContext(NestingContext);
|
|
581
|
-
var disabled = props.disabled || (nestingContext === null || nestingContext === void 0 ? void 0 : nestingContext.disabled);
|
|
582
|
-
var lastUserInteractionRef = React.useRef(undefined);
|
|
583
|
-
React.useEffect(function () {
|
|
584
|
-
onNestedVisibleChange(lastUserInteractionRef.current);
|
|
585
|
-
}, [visible]);
|
|
586
|
-
var handleMouseEvent = React.useCallback(function () {
|
|
587
|
-
lastUserInteractionRef.current = 'mouse';
|
|
588
|
-
}, []);
|
|
589
|
-
var handleKeyboardEvent = React.useCallback(function () {
|
|
590
|
-
lastUserInteractionRef.current = 'keyboard';
|
|
591
|
-
}, []);
|
|
592
|
-
React.useEffect(function () {
|
|
593
|
-
document.addEventListener('mouseover', handleMouseEvent, {
|
|
594
|
-
capture: true
|
|
595
|
-
});
|
|
596
|
-
document.addEventListener('keydown', handleKeyboardEvent, {
|
|
597
|
-
capture: true
|
|
598
|
-
});
|
|
599
|
-
return function () {
|
|
600
|
-
document.removeEventListener('mouseover', handleMouseEvent, {
|
|
601
|
-
capture: true
|
|
602
|
-
});
|
|
603
|
-
document.removeEventListener('keydown', handleKeyboardEvent, {
|
|
604
|
-
capture: true
|
|
605
|
-
});
|
|
606
|
-
};
|
|
607
|
-
}, []);
|
|
608
|
-
return /*#__PURE__*/React.createElement(NestingContext.Provider, {
|
|
609
|
-
value: null
|
|
610
|
-
}, (_ref14 = sstyled(styles), /*#__PURE__*/React.createElement(SDropdownMenuItem, _ref14.cn("SDropdownMenuItem", _objectSpread({}, _assignProps6({
|
|
611
|
-
"nesting-trigger": true,
|
|
612
|
-
"use:tabIndex": !disabled ? 0 : undefined
|
|
613
|
-
}, _ref6))))));
|
|
614
|
-
}
|
|
615
|
-
function NestingItem(props) {
|
|
616
|
-
var _ref7 = arguments[0],
|
|
617
|
-
_ref15;
|
|
618
|
-
var styles = props.styles;
|
|
619
|
-
var SDropdownNestingItem = NestingTrigger;
|
|
620
|
-
return _ref15 = sstyled(styles), /*#__PURE__*/React.createElement(SDropdownNestingItem, _ref15.cn("SDropdownNestingItem", _objectSpread({}, _assignProps7({
|
|
621
|
-
"use:tabIndex": -1
|
|
622
|
-
}, _ref7))));
|
|
623
|
-
}
|
|
624
|
-
function Addon(props) {
|
|
625
|
-
var _useBox = useBox(props, props.forwardRef),
|
|
626
|
-
_useBox2 = _slicedToArray(_useBox, 2),
|
|
627
|
-
SDropdownMenuItemAddon = _useBox2[0],
|
|
628
|
-
_useBox2$ = _useBox2[1],
|
|
629
|
-
className = _useBox2$.className,
|
|
630
|
-
other = _objectWithoutProperties(_useBox2$, _excluded);
|
|
631
|
-
var styles = sstyled(props.styles);
|
|
632
|
-
return /*#__PURE__*/React.createElement(SDropdownMenuItemAddon, _extends({
|
|
633
|
-
className: cn(styles.cn('SDropdownMenuItemAddon', props).className, className) || undefined
|
|
634
|
-
}, other));
|
|
635
|
-
}
|
|
636
|
-
function Hint(props) {
|
|
637
|
-
var _ref8 = arguments[0],
|
|
638
|
-
_ref16;
|
|
639
|
-
var SDropdownMenuItem = Flex;
|
|
640
|
-
return _ref16 = sstyled(props.styles), /*#__PURE__*/React.createElement(SDropdownMenuItem, _ref16.cn("SDropdownMenuItem", _objectSpread({}, _assignProps8({
|
|
641
|
-
"variant": 'hint'
|
|
642
|
-
}, _ref8))));
|
|
643
|
-
}
|
|
644
|
-
function Title(props) {
|
|
645
|
-
var _ref9 = arguments[0],
|
|
646
|
-
_ref17;
|
|
647
|
-
var SDropdownMenuItem = Flex;
|
|
648
|
-
return _ref17 = sstyled(props.styles), /*#__PURE__*/React.createElement(SDropdownMenuItem, _ref17.cn("SDropdownMenuItem", _objectSpread({}, _assignProps9({
|
|
649
|
-
"variant": 'title'
|
|
650
|
-
}, _ref9))));
|
|
651
|
-
}
|
|
652
|
-
function Trigger(_ref21) {
|
|
653
|
-
var _ref10 = arguments[0];
|
|
654
|
-
var keyboardFocused = _ref21.keyboardFocused,
|
|
655
|
-
onKeyboardFocusedStateChange = _ref21.onKeyboardFocusedStateChange;
|
|
656
|
-
React.useEffect(function () {
|
|
657
|
-
onKeyboardFocusedStateChange(keyboardFocused);
|
|
658
|
-
}, [keyboardFocused, onKeyboardFocusedStateChange]);
|
|
659
|
-
return /*#__PURE__*/React.createElement(Dropdown.Trigger, _assignProps10({
|
|
660
|
-
"aria-haspopup": 'true'
|
|
661
|
-
}, _ref10));
|
|
662
|
-
}
|
|
663
|
-
Trigger.enhance = [keyboardFocusEnhance(false)];
|
|
664
|
-
var DropdownMenu = createComponent(DropdownMenuRoot, {
|
|
665
|
-
Trigger: Trigger,
|
|
666
|
-
Popper: Dropdown.Popper,
|
|
667
|
-
List: List,
|
|
668
|
-
Menu: Menu,
|
|
669
|
-
Item: [Item, {
|
|
670
|
-
Addon: Addon
|
|
671
|
-
}],
|
|
672
|
-
Nesting: [Nesting, {
|
|
673
|
-
Trigger: NestingTrigger,
|
|
674
|
-
Addon: Addon,
|
|
675
|
-
Item: NestingItem
|
|
676
|
-
}],
|
|
677
|
-
ItemTitle: Title,
|
|
678
|
-
ItemHint: Hint
|
|
679
|
-
}, {
|
|
680
|
-
parent: [Dropdown]
|
|
681
|
-
});
|
|
682
|
-
export default DropdownMenu;
|
|
683
|
-
//# sourceMappingURL=DropdownMenuOld.js.map
|