@splunk/react-ui 4.21.0 → 4.21.1

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.
Files changed (83) hide show
  1. package/Accordion.js +425 -325
  2. package/Anchor.js +147 -117
  3. package/Animation.js +142 -94
  4. package/AnimationToggle.js +197 -193
  5. package/Box.js +145 -118
  6. package/Breadcrumbs.js +288 -206
  7. package/Button.js +488 -465
  8. package/ButtonGroup.js +160 -128
  9. package/ButtonSimple.js +543 -462
  10. package/CHANGELOG.md +7 -2
  11. package/Calendar.js +1111 -1001
  12. package/Card.js +771 -598
  13. package/CardLayout.js +205 -147
  14. package/Chip.js +509 -488
  15. package/Clickable.js +414 -352
  16. package/CloseButton.js +165 -142
  17. package/Code.js +1808 -2084
  18. package/Code.js.LICENSE.txt +8 -0
  19. package/CollapsiblePanel.js +586 -519
  20. package/Color.js +1066 -1069
  21. package/ColumnLayout.js +402 -363
  22. package/ComboBox.js +891 -794
  23. package/Concertina.js +997 -802
  24. package/ControlGroup.js +687 -594
  25. package/Date.js +567 -547
  26. package/DefinitionList.js +308 -234
  27. package/Divider.js +149 -118
  28. package/Dropdown.js +459 -416
  29. package/DualListbox.js +1479 -1541
  30. package/EventListener.js +94 -97
  31. package/File.js +1051 -969
  32. package/FormRows.js +883 -696
  33. package/Heading.js +216 -193
  34. package/Image.js +446 -402
  35. package/JSONTree.js +690 -551
  36. package/Layer.js +437 -410
  37. package/Link.js +336 -255
  38. package/List.js +213 -161
  39. package/Markdown.js +509 -487
  40. package/Menu.js +1105 -1056
  41. package/Message.js +475 -441
  42. package/MessageBar.js +387 -373
  43. package/Modal.js +810 -634
  44. package/ModalLayer.js +326 -243
  45. package/Monogram.js +308 -276
  46. package/Multiselect.js +3550 -3364
  47. package/Number.js +729 -687
  48. package/Paginator.js +510 -449
  49. package/Paragraph.js +145 -112
  50. package/Popover.js +1459 -1432
  51. package/Progress.js +301 -246
  52. package/RadioBar.js +610 -527
  53. package/RadioList.js +483 -444
  54. package/Resize.js +530 -489
  55. package/ResultsMenu.js +494 -455
  56. package/ScreenReaderContent.js +142 -111
  57. package/Scroll.js +595 -456
  58. package/ScrollContainerContext.js +197 -206
  59. package/Search.js +744 -650
  60. package/Select.js +2442 -2345
  61. package/SidePanel.js +390 -284
  62. package/Slider.js +669 -676
  63. package/SlidingPanels.js +639 -503
  64. package/SplitButton.js +464 -367
  65. package/StaticContent.js +161 -133
  66. package/StepBar.js +386 -358
  67. package/Switch.js +710 -640
  68. package/TabBar.js +726 -680
  69. package/TabLayout.js +406 -322
  70. package/Table.js +4842 -4616
  71. package/Text.js +1170 -1138
  72. package/TextArea.js +1102 -1090
  73. package/Tooltip.js +624 -581
  74. package/TransitionOpen.js +489 -422
  75. package/Typography.js +176 -153
  76. package/WaitSpinner.js +230 -206
  77. package/package.json +5 -5
  78. package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
  79. package/types/src/JSONTree/TreeNode.d.ts +5 -0
  80. package/useForceUpdate.js +112 -82
  81. package/useKeyPress.js +74 -71
  82. package/usePrevious.js +65 -65
  83. package/useRovingFocus.js +122 -138
package/Menu.js CHANGED
@@ -1,1082 +1,1131 @@
1
- /******/ (() => { // webpackBootstrap
2
- /******/ "use strict";
3
- /******/ // The require scope
4
- /******/ var __webpack_require__ = {};
5
- /******/
6
- /************************************************************************/
7
- /******/ /* webpack/runtime/compat get default export */
8
- /******/ (() => {
9
- /******/ // getDefaultExport function for compatibility with non-harmony modules
10
- /******/ __webpack_require__.n = (module) => {
11
- /******/ var getter = module && module.__esModule ?
12
- /******/ () => (module['default']) :
13
- /******/ () => (module);
14
- /******/ __webpack_require__.d(getter, { a: getter });
15
- /******/ return getter;
16
- /******/ };
17
- /******/ })();
18
- /******/
19
- /******/ /* webpack/runtime/define property getters */
20
- /******/ (() => {
21
- /******/ // define getter functions for harmony exports
22
- /******/ __webpack_require__.d = (exports, definition) => {
23
- /******/ for(var key in definition) {
24
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
25
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
26
- /******/ }
27
- /******/ }
28
- /******/ };
29
- /******/ })();
30
- /******/
31
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
32
- /******/ (() => {
33
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
34
- /******/ })();
35
- /******/
36
- /******/ /* webpack/runtime/make namespace object */
37
- /******/ (() => {
38
- /******/ // define __esModule on exports
39
- /******/ __webpack_require__.r = (exports) => {
40
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
41
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
42
- /******/ }
43
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
44
- /******/ };
45
- /******/ })();
46
- /******/
47
- /************************************************************************/
48
- var __webpack_exports__ = {};
49
- // ESM COMPAT FLAG
50
- __webpack_require__.r(__webpack_exports__);
51
-
52
- // EXPORTS
53
- __webpack_require__.d(__webpack_exports__, {
54
- Divider: () => (/* reexport */ Menu_Divider),
55
- Heading: () => (/* reexport */ Menu_Heading),
56
- Item: () => (/* reexport */ Menu_Item),
57
- MenuContext: () => (/* reexport */ MenuContext),
58
- "default": () => (/* reexport */ Menu_Menu)
59
- });
60
-
61
- ;// CONCATENATED MODULE: external "react"
62
- const external_react_namespaceObject = require("react");
63
- var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_namespaceObject);
64
- ;// CONCATENATED MODULE: external "prop-types"
65
- const external_prop_types_namespaceObject = require("prop-types");
66
- var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_namespaceObject);
67
- ;// CONCATENATED MODULE: external "lodash/omit"
68
- const omit_namespaceObject = require("lodash/omit");
69
- var omit_default = /*#__PURE__*/__webpack_require__.n(omit_namespaceObject);
70
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Popover"
71
- const Popover_namespaceObject = require("@splunk/react-ui/Popover");
72
- ;// CONCATENATED MODULE: external "@splunk/ui-utils/focus"
73
- const focus_namespaceObject = require("@splunk/ui-utils/focus");
74
- ;// CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
75
- const keyboard_namespaceObject = require("@splunk/ui-utils/keyboard");
76
- ;// CONCATENATED MODULE: external "@splunk/react-ui/useForceUpdate"
77
- const useForceUpdate_namespaceObject = require("@splunk/react-ui/useForceUpdate");
78
- var useForceUpdate_default = /*#__PURE__*/__webpack_require__.n(useForceUpdate_namespaceObject);
79
- ;// CONCATENATED MODULE: external "styled-components"
80
- const external_styled_components_namespaceObject = require("styled-components");
81
- var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_namespaceObject);
82
- ;// CONCATENATED MODULE: external "@splunk/themes"
83
- const themes_namespaceObject = require("@splunk/themes");
84
- ;// CONCATENATED MODULE: ./src/Menu/DividerStyles.ts
85
-
86
-
87
- var Styled = external_styled_components_default().div.withConfig({
88
- displayName: "DividerStyles__Styled",
89
- componentId: "l3zfh3-0"
90
- })(["border-top:1px solid ", ";", ""], (0,themes_namespaceObject.pick)({
91
- enterprise: themes_namespaceObject.variables.borderColor,
92
- prisma: themes_namespaceObject.variables.neutral200
93
- }), (0,themes_namespaceObject.pick)({
94
- prisma: {
95
- comfortable: (0,external_styled_components_namespaceObject.css)(["margin:8px 0;"]),
96
- compact: (0,external_styled_components_namespaceObject.css)(["margin:6px 0;"])
97
- }
98
- }));
99
-
100
- ;// CONCATENATED MODULE: ./src/Menu/MenuContext.tsx
101
-
102
- var MenuContext = /*#__PURE__*/(0,external_react_namespaceObject.createContext)({
103
- role: 'menu'
104
- });
105
-
106
- ;// CONCATENATED MODULE: ./src/Menu/Divider.tsx
107
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
108
-
109
-
110
-
111
-
112
- var propTypes = {};
113
-
114
- /**
1
+ /******/ (() => {
2
+ // webpackBootstrap
3
+ /******/ "use strict";
4
+ /******/ // The require scope
5
+ /******/ var e = {};
6
+ /******/
7
+ /************************************************************************/
8
+ /******/ /* webpack/runtime/compat get default export */
9
+ /******/ (() => {
10
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
11
+ /******/ e.n = t => {
12
+ /******/ var r = t && t.__esModule ?
13
+ /******/ () => t["default"]
14
+ /******/ : () => t
15
+ /******/;
16
+ e.d(r, {
17
+ a: r
18
+ });
19
+ /******/ return r;
20
+ /******/ };
21
+ /******/ })();
22
+ /******/
23
+ /******/ /* webpack/runtime/define property getters */
24
+ /******/ (() => {
25
+ /******/ // define getter functions for harmony exports
26
+ /******/ e.d = (t, r) => {
27
+ /******/ for (var n in r) {
28
+ /******/ if (e.o(r, n) && !e.o(t, n)) {
29
+ /******/ Object.defineProperty(t, n, {
30
+ enumerable: true,
31
+ get: r[n]
32
+ });
33
+ /******/ }
34
+ /******/ }
35
+ /******/ };
36
+ /******/ })();
37
+ /******/
38
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
39
+ /******/ (() => {
40
+ /******/ e.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t)
41
+ /******/;
42
+ })();
43
+ /******/
44
+ /******/ /* webpack/runtime/make namespace object */
45
+ /******/ (() => {
46
+ /******/ // define __esModule on exports
47
+ /******/ e.r = e => {
48
+ /******/ if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
49
+ /******/ Object.defineProperty(e, Symbol.toStringTag, {
50
+ value: "Module"
51
+ });
52
+ /******/ }
53
+ /******/ Object.defineProperty(e, "__esModule", {
54
+ value: true
55
+ });
56
+ /******/ };
57
+ /******/ })();
58
+ /******/
59
+ /************************************************************************/ var t = {};
60
+ // ESM COMPAT FLAG
61
+ e.r(t);
62
+ // EXPORTS
63
+ e.d(t, {
64
+ Divider: () => /* reexport */ x,
65
+ Heading: () => /* reexport */ H,
66
+ Item: () => /* reexport */ ze,
67
+ MenuContext: () => /* reexport */ h,
68
+ default: () => /* reexport */ rt
69
+ });
70
+ // CONCATENATED MODULE: external "react"
71
+ const r = require("react");
72
+ var n = e.n(r);
73
+ // CONCATENATED MODULE: external "prop-types"
74
+ const i = require("prop-types");
75
+ var a = e.n(i);
76
+ // CONCATENATED MODULE: external "lodash/omit"
77
+ const o = require("lodash/omit");
78
+ var l = e.n(o);
79
+ // CONCATENATED MODULE: external "@splunk/react-ui/Popover"
80
+ const s = require("@splunk/react-ui/Popover");
81
+ // CONCATENATED MODULE: external "@splunk/ui-utils/focus"
82
+ const c = require("@splunk/ui-utils/focus");
83
+ // CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
84
+ const p = require("@splunk/ui-utils/keyboard");
85
+ // CONCATENATED MODULE: external "@splunk/react-ui/useForceUpdate"
86
+ const u = require("@splunk/react-ui/useForceUpdate");
87
+ var d = e.n(u);
88
+ // CONCATENATED MODULE: external "styled-components"
89
+ const f = require("styled-components");
90
+ var v = e.n(f);
91
+ // CONCATENATED MODULE: external "@splunk/themes"
92
+ const b = require("@splunk/themes");
93
+ // CONCATENATED MODULE: ./src/Menu/DividerStyles.ts
94
+ var m = v().div.withConfig({
95
+ displayName: "DividerStyles__Styled",
96
+ componentId: "l3zfh3-0"
97
+ })([ "border-top:1px solid ", ";", "" ], (0, b.pick)({
98
+ enterprise: b.variables.borderColor,
99
+ prisma: b.variables.neutral200
100
+ }), (0, b.pick)({
101
+ prisma: {
102
+ comfortable: (0, f.css)([ "margin:8px 0;" ]),
103
+ compact: (0, f.css)([ "margin:6px 0;" ])
104
+ }
105
+ }));
106
+ // CONCATENATED MODULE: ./src/Menu/MenuContext.tsx
107
+ var h = (0, r.createContext)({
108
+ role: "menu"
109
+ });
110
+ // CONCATENATED MODULE: ./src/Menu/Divider.tsx
111
+ function y() {
112
+ y = Object.assign || function(e) {
113
+ for (var t = 1; t < arguments.length; t++) {
114
+ var r = arguments[t];
115
+ for (var n in r) {
116
+ if (Object.prototype.hasOwnProperty.call(r, n)) {
117
+ e[n] = r[n];
118
+ }
119
+ }
120
+ }
121
+ return e;
122
+ };
123
+ return y.apply(this, arguments);
124
+ }
125
+ var g = {};
126
+ /**
115
127
  * A non-interactive menu item used to visually separate groups of items in the menu.
116
- */
117
- function Divider(_ref) {
118
- var otherProps = _extends({}, _ref);
119
-
120
- // @docs-props-type DividerPropsBase
121
- var _useContext = (0,external_react_namespaceObject.useContext)(MenuContext),
122
- role = _useContext.role;
123
-
124
- return /*#__PURE__*/external_react_default().createElement(Styled // dividers are not supported in role="listbox"
125
- // this causes Firefox to incorrectly read the total number
126
- // of items in the list if it contains a heading or divider
127
- // so we set them to aria-hidden to prevent that
128
- , _extends({
129
- "aria-hidden": role === 'listbox',
130
- "data-test": "divider",
131
- role: "separator"
132
- }, otherProps));
133
- }
134
-
135
- Divider.propTypes = propTypes;
136
- /* Remove the item if it is the first item after filtering */
137
-
138
- Divider.filterFirst = true;
139
- /* Remove consecutive items with filterConsecutive = true (Dividers and Headings) */
140
-
141
- Divider.filterConsecutive = true;
142
- /* Remove the item if it is the last item after filtering. */
143
-
144
- Divider.filterLast = true;
145
- /* Tag the item as Divider */
146
-
147
- Divider.as = 'Divider';
148
- /* harmony default export */ const Menu_Divider = (Divider);
149
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Heading"
150
- const Heading_namespaceObject = require("@splunk/react-ui/Heading");
151
- var Heading_default = /*#__PURE__*/__webpack_require__.n(Heading_namespaceObject);
152
- ;// CONCATENATED MODULE: external "@splunk/themes/useSplunkTheme"
153
- const useSplunkTheme_namespaceObject = require("@splunk/themes/useSplunkTheme");
154
- var useSplunkTheme_default = /*#__PURE__*/__webpack_require__.n(useSplunkTheme_namespaceObject);
155
- ;// CONCATENATED MODULE: ./src/Menu/HeadingStyles.ts
156
-
157
-
158
- var HeadingStyles_Styled = external_styled_components_default().div.withConfig({
159
- displayName: "HeadingStyles__Styled",
160
- componentId: "mcd2ws-0"
161
- })(["", " border-top:1px solid transparent;padding:", ";&:not(:first-child){", ";}"], themes_namespaceObject.mixins.reset('block'), (0,themes_namespaceObject.pick)({
162
- enterprise: (0,external_styled_components_namespaceObject.css)(["", " ", " 6px"], themes_namespaceObject.variables.spacingQuarter, themes_namespaceObject.variables.spacingHalf),
163
- prisma: {
164
- comfortable: '13px 16px 10px 16px',
165
- compact: '9px 16px 6px 16px'
166
- }
167
- }), (0,themes_namespaceObject.pick)({
168
- enterprise: (0,external_styled_components_namespaceObject.css)(["border-top:", ";"], themes_namespaceObject.variables.border),
169
- prisma: {
170
- comfortable: (0,external_styled_components_namespaceObject.css)(["border-top:1px solid ", ";margin-top:6px;padding-top:19px;"], themes_namespaceObject.variables.neutral200),
171
- compact: (0,external_styled_components_namespaceObject.css)(["border-top:1px solid ", ";margin-top:6px;padding-top:15px;"], themes_namespaceObject.variables.neutral200)
172
- }
173
- }));
174
- var PrismaSectionTitle = external_styled_components_default().h5.withConfig({
175
- displayName: "HeadingStyles__PrismaSectionTitle",
176
- componentId: "mcd2ws-1"
177
- })(["", " font-size:", ";line-height:", ";font-weight:", ";letter-spacing:0.02em;"], themes_namespaceObject.mixins.reset('block'), themes_namespaceObject.variables.fontSizeSmall, themes_namespaceObject.variables.lineHeight, themes_namespaceObject.variables.fontWeightBold);
178
-
179
- ;// CONCATENATED MODULE: ./src/Menu/Heading.tsx
180
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
181
-
182
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
183
-
184
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
185
-
186
- function Heading_extends() { Heading_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Heading_extends.apply(this, arguments); }
187
-
188
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
189
-
190
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
191
-
192
-
193
-
194
-
195
-
196
-
197
-
198
- var Heading_propTypes = {
199
- children: (external_prop_types_default()).node,
200
- title: (external_prop_types_default()).bool,
201
- outerStyle: (external_prop_types_default()).object
202
- };
203
-
204
- /**
128
+ */ function k(e) {
129
+ var t = y({}, e);
130
+ // @docs-props-type DividerPropsBase
131
+ var i = (0, r.useContext)(h), a = i.role;
132
+
133
+ return n().createElement(m, y({
134
+ "aria-hidden": a === "listbox",
135
+ "data-test": "divider",
136
+ role: "separator"
137
+ }, t));
138
+ }
139
+ k.propTypes = g;
140
+ /* Remove the item if it is the first item after filtering */ k.filterFirst = true;
141
+ /* Remove consecutive items with filterConsecutive = true (Dividers and Headings) */ k.filterConsecutive = true;
142
+ /* Remove the item if it is the last item after filtering. */ k.filterLast = true;
143
+ /* Tag the item as Divider */ k.as = "Divider";
144
+ /* harmony default export */ const x = k;
145
+ // CONCATENATED MODULE: external "@splunk/react-ui/Heading"
146
+ const w = require("@splunk/react-ui/Heading");
147
+ var S = e.n(w);
148
+ // CONCATENATED MODULE: external "@splunk/themes/useSplunkTheme"
149
+ const O = require("@splunk/themes/useSplunkTheme");
150
+ var C = e.n(O);
151
+ // CONCATENATED MODULE: ./src/Menu/HeadingStyles.ts
152
+ var I = v().div.withConfig({
153
+ displayName: "HeadingStyles__Styled",
154
+ componentId: "mcd2ws-0"
155
+ })([ "", " border-top:1px solid transparent;padding:", ";&:not(:first-child){", ";}" ], b.mixins.reset("block"), (0,
156
+ b.pick)({
157
+ enterprise: (0, f.css)([ "", " ", " 6px" ], b.variables.spacingQuarter, b.variables.spacingHalf),
158
+ prisma: {
159
+ comfortable: "13px 16px 10px 16px",
160
+ compact: "9px 16px 6px 16px"
161
+ }
162
+ }), (0, b.pick)({
163
+ enterprise: (0, f.css)([ "border-top:", ";" ], b.variables.border),
164
+ prisma: {
165
+ comfortable: (0, f.css)([ "border-top:1px solid ", ";margin-top:6px;padding-top:19px;" ], b.variables.neutral200),
166
+ compact: (0, f.css)([ "border-top:1px solid ", ";margin-top:6px;padding-top:15px;" ], b.variables.neutral200)
167
+ }
168
+ }));
169
+ var P = v().h5.withConfig({
170
+ displayName: "HeadingStyles__PrismaSectionTitle",
171
+ componentId: "mcd2ws-1"
172
+ })([ "", " font-size:", ";line-height:", ";font-weight:", ";letter-spacing:0.02em;" ], b.mixins.reset("block"), b.variables.fontSizeSmall, b.variables.lineHeight, b.variables.fontWeightBold);
173
+ // CONCATENATED MODULE: ./src/Menu/Heading.tsx
174
+ function _(e, t) {
175
+ var r = Object.keys(e);
176
+ if (Object.getOwnPropertySymbols) {
177
+ var n = Object.getOwnPropertySymbols(e);
178
+ if (t) n = n.filter((function(t) {
179
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
180
+ }));
181
+ r.push.apply(r, n);
182
+ }
183
+ return r;
184
+ }
185
+ function j(e) {
186
+ for (var t = 1; t < arguments.length; t++) {
187
+ var r = arguments[t] != null ? arguments[t] : {};
188
+ if (t % 2) {
189
+ _(Object(r), true).forEach((function(t) {
190
+ E(e, t, r[t]);
191
+ }));
192
+ } else if (Object.getOwnPropertyDescriptors) {
193
+ Object.defineProperties(e, Object.getOwnPropertyDescriptors(r));
194
+ } else {
195
+ _(Object(r)).forEach((function(t) {
196
+ Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t));
197
+ }));
198
+ }
199
+ }
200
+ return e;
201
+ }
202
+ function E(e, t, r) {
203
+ if (t in e) {
204
+ Object.defineProperty(e, t, {
205
+ value: r,
206
+ enumerable: true,
207
+ configurable: true,
208
+ writable: true
209
+ });
210
+ } else {
211
+ e[t] = r;
212
+ }
213
+ return e;
214
+ }
215
+ function T() {
216
+ T = Object.assign || function(e) {
217
+ for (var t = 1; t < arguments.length; t++) {
218
+ var r = arguments[t];
219
+ for (var n in r) {
220
+ if (Object.prototype.hasOwnProperty.call(r, n)) {
221
+ e[n] = r[n];
222
+ }
223
+ }
224
+ }
225
+ return e;
226
+ };
227
+ return T.apply(this, arguments);
228
+ }
229
+ function D(e, t) {
230
+ if (e == null) return {};
231
+ var r = R(e, t);
232
+ var n, i;
233
+ if (Object.getOwnPropertySymbols) {
234
+ var a = Object.getOwnPropertySymbols(e);
235
+ for (i = 0; i < a.length; i++) {
236
+ n = a[i];
237
+ if (t.indexOf(n) >= 0) continue;
238
+ if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
239
+ r[n] = e[n];
240
+ }
241
+ }
242
+ return r;
243
+ }
244
+ function R(e, t) {
245
+ if (e == null) return {};
246
+ var r = {};
247
+ var n = Object.keys(e);
248
+ var i, a;
249
+ for (a = 0; a < n.length; a++) {
250
+ i = n[a];
251
+ if (t.indexOf(i) >= 0) continue;
252
+ r[i] = e[i];
253
+ }
254
+ return r;
255
+ }
256
+ var q = {
257
+ children: a().node,
258
+ title: a().bool,
259
+ outerStyle: a().object
260
+ };
261
+ /**
205
262
  * A non-interactive `Menu` item used to separate and label groups of `Menu` items.
206
- */
207
- function Heading(_ref) {
208
- var children = _ref.children,
209
- title = _ref.title,
210
- outerStyle = _ref.outerStyle,
211
- otherProps = _objectWithoutProperties(_ref, ["children", "title", "outerStyle"]);
212
-
213
- var _useContext = (0,external_react_namespaceObject.useContext)(MenuContext),
214
- role = _useContext.role;
215
-
216
- var _useSplunkTheme = useSplunkTheme_default()(),
217
- family = _useSplunkTheme.family;
218
-
219
- var inner = family === 'prisma' ? /*#__PURE__*/external_react_default().createElement(PrismaSectionTitle, Heading_extends({
220
- as: title ? 'h4' : 'h5',
221
- style: outerStyle,
222
- "data-test": "heading"
223
- }, otherProps), children) : /*#__PURE__*/external_react_default().createElement((Heading_default()), Heading_extends({
224
- style: _objectSpread(_objectSpread({}, outerStyle), {}, {
225
- margin: 0
226
- }),
227
- level: title ? 4 : 'ss',
228
- "data-test": "heading"
229
- }, otherProps), children); // headings are not supported in role="listbox"
230
- // this causes Firefox to incorrectly read the total number
231
- // of items in the list if it contains a heading or divider
232
- // so we set them to aria-hidden to prevent that
233
-
234
- return /*#__PURE__*/external_react_default().createElement(HeadingStyles_Styled, {
235
- "aria-hidden": role === 'listbox'
236
- }, inner);
237
- }
238
-
239
- Heading.propTypes = Heading_propTypes;
240
- /* Remove consecutive items with filterConsecutive = true (Dividers and Headings) */
241
-
242
- Heading.filterConsecutive = true;
243
- /* Remove the item if it is the last item after filtering. */
244
-
245
- Heading.filterLast = true;
246
- /* Tag the item as a Heading */
247
-
248
- Heading.as = 'Heading';
249
- /* harmony default export */ const Menu_Heading = (Heading);
250
- ;// CONCATENATED MODULE: external "lodash/isString"
251
- const isString_namespaceObject = require("lodash/isString");
252
- var isString_default = /*#__PURE__*/__webpack_require__.n(isString_namespaceObject);
253
- ;// CONCATENATED MODULE: external "@splunk/react-icons/CaretSmallRight"
254
- const CaretSmallRight_namespaceObject = require("@splunk/react-icons/CaretSmallRight");
255
- var CaretSmallRight_default = /*#__PURE__*/__webpack_require__.n(CaretSmallRight_namespaceObject);
256
- ;// CONCATENATED MODULE: external "@splunk/react-icons/Checkmark"
257
- const Checkmark_namespaceObject = require("@splunk/react-icons/Checkmark");
258
- var Checkmark_default = /*#__PURE__*/__webpack_require__.n(Checkmark_namespaceObject);
259
- ;// CONCATENATED MODULE: external "@splunk/react-icons/enterprise/Check"
260
- const Check_namespaceObject = require("@splunk/react-icons/enterprise/Check");
261
- var Check_default = /*#__PURE__*/__webpack_require__.n(Check_namespaceObject);
262
- ;// CONCATENATED MODULE: external "@splunk/react-icons/enterprise/ChevronRight"
263
- const ChevronRight_namespaceObject = require("@splunk/react-icons/enterprise/ChevronRight");
264
- var ChevronRight_default = /*#__PURE__*/__webpack_require__.n(ChevronRight_namespaceObject);
265
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
266
- const Clickable_namespaceObject = require("@splunk/react-ui/Clickable");
267
- var Clickable_default = /*#__PURE__*/__webpack_require__.n(Clickable_namespaceObject);
268
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Switch"
269
- const Switch_namespaceObject = require("@splunk/react-ui/Switch");
270
- var Switch_default = /*#__PURE__*/__webpack_require__.n(Switch_namespaceObject);
271
- ;// CONCATENATED MODULE: ./src/Menu/ItemStyles.ts
272
-
273
-
274
-
275
-
276
- var itemDescription = (0,external_styled_components_namespaceObject.css)(["color:", ";font-size:", ";line-height:", ";overflow:inherit;white-space:inherit;text-overflow:inherit;"], (0,themes_namespaceObject.pick)({
277
- prisma: themes_namespaceObject.variables.contentColorDefault,
278
- enterprise: themes_namespaceObject.variables.textGray
279
- }), themes_namespaceObject.variables.fontSizeSmall, (0,themes_namespaceObject.pick)({
280
- prisma: '16px'
281
- }));
282
- var StyledItemDescriptionBottom = external_styled_components_default().span.withConfig({
283
- displayName: "ItemStyles__StyledItemDescriptionBottom",
284
- componentId: "sc-4kc053-0"
285
- })(["", ";display:block;"], itemDescription);
286
- var StyledItemDescriptionRight = external_styled_components_default().span.withConfig({
287
- displayName: "ItemStyles__StyledItemDescriptionRight",
288
- componentId: "sc-4kc053-1"
289
- })(["", ";float:right;padding-left:", ";max-width:50%;text-align:right;box-sizing:border-box;"], itemDescription, themes_namespaceObject.variables.spacing);
290
- var StyledItemSelectedIcon = external_styled_components_default().div.withConfig({
291
- displayName: "ItemStyles__StyledItemSelectedIcon",
292
- componentId: "sc-4kc053-2"
293
- })(["position:absolute;", " color:", ";"], (0,themes_namespaceObject.pick)({
294
- prisma: (0,external_styled_components_namespaceObject.css)(["right:16px;"]),
295
- enterprise: (0,external_styled_components_namespaceObject.css)(["top:5px;right:3px;left:8px;"])
296
- }), (0,themes_namespaceObject.pick)({
297
- prisma: themes_namespaceObject.variables.contentColorActive,
298
- enterprise: themes_namespaceObject.variables.accentColorL10
299
- }));
300
- var StyledItemIcon = external_styled_components_default().span.withConfig({
301
- displayName: "ItemStyles__StyledItemIcon",
302
- componentId: "sc-4kc053-3"
303
- })(["flex:0 0 auto;padding-right:", ";min-width:10px;display:inline-block;text-align:center;vertical-align:", ";", ""], (0,themes_namespaceObject.pick)({
304
- prisma: '8px',
305
- enterprise: '3px'
306
- }), (0,themes_namespaceObject.pick)({
307
- prisma: 'initial',
308
- enterprise: 'middle'
309
- }), (0,themes_namespaceObject.pick)({
310
- prisma: (0,external_styled_components_namespaceObject.css)(["color:", ";display:inline-flex;align-items:center;min-width:20px;min-height:20px;& > svg{width:20px;height:20px;}"], themes_namespaceObject.variables.contentColorMuted),
311
- enterprise: (0,external_styled_components_namespaceObject.css)(["transform:translateY(-1px);"])
312
- }));
313
- var StyledClickable = external_styled_components_default()((Clickable_default())).withConfig({
314
- displayName: "ItemStyles__StyledClickable",
315
- componentId: "sc-4kc053-4"
316
- })(["display:block;position:relative;cursor:pointer;color:", ";word-wrap:break-word;max-width:100%;width:100%;padding:", ";", " ", " ", " &:not([disabled]){&:hover{background:", ";", "}&:focus{outline:0;box-shadow:", ";", "}", " ", "}&[disabled]{color:", ";cursor:not-allowed;", ",", "{color:inherit;}", "{cursor:not-allowed;color:", ";}", "}", ""], (0,themes_namespaceObject.pick)({
317
- prisma: themes_namespaceObject.variables.contentColorActive,
318
- enterprise: {
319
- dark: themes_namespaceObject.variables.gray96,
320
- light: themes_namespaceObject.variables.gray22
321
- }
322
- }), (0,themes_namespaceObject.pick)({
323
- prisma: {
324
- comfortable: '10px 16px',
325
- compact: '6px 16px'
326
- },
327
- enterprise: '6px 10px'
328
- }), function (_ref) {
329
- var $isSelectable = _ref.$isSelectable,
330
- $selectableAppearance = _ref.$selectableAppearance;
331
- return $isSelectable && (0,themes_namespaceObject.pick)({
332
- prisma: (0,external_styled_components_namespaceObject.css)(["padding-right:44px;", ""], function () {
333
- return $selectableAppearance === 'checkbox' && 'padding-left: 42px;';
334
- }),
335
- enterprise: (0,external_styled_components_namespaceObject.css)(["padding-right:10px;padding-left:", ";"], function () {
336
- return $selectableAppearance === 'checkbox' ? '32px' : '28px';
337
- })
338
- });
339
- }, function (_ref2) {
340
- var $active = _ref2.$active,
341
- $preventFocus = _ref2.$preventFocus;
342
- return $active && !$preventFocus && (0,external_styled_components_namespaceObject.css)(["box-shadow:", ";"], themes_namespaceObject.variables.focusShadowInset);
343
- }, function (_ref3) {
344
- var $active = _ref3.$active;
345
- return $active && (0,external_styled_components_namespaceObject.css)(["background:", ";font-weight:", ";"], (0,themes_namespaceObject.pick)({
346
- enterprise: {
347
- light: themes_namespaceObject.variables.gray92,
348
- dark: themes_namespaceObject.variables.gray22
349
- },
350
- prisma: themes_namespaceObject.variables.neutral100
351
- }), themes_namespaceObject.variables.fontWeightBold);
352
- }, (0,themes_namespaceObject.pick)({
353
- prisma: themes_namespaceObject.variables.interactiveColorOverlayHover,
354
- enterprise: themes_namespaceObject.variables.backgroundColorHover
355
- }), function (_ref4) {
356
- var $selected = _ref4.$selected;
357
- return $selected && (0,themes_namespaceObject.pick)({
358
- prisma: (0,external_styled_components_namespaceObject.css)(["background:", ";"], themes_namespaceObject.mixins.overlayColors(themes_namespaceObject.variables.interactiveColorOverlaySelected, themes_namespaceObject.variables.interactiveColorOverlayHover))
359
- });
360
- }, themes_namespaceObject.variables.focusShadowInset, (0,themes_namespaceObject.pick)({
361
- prisma: (0,external_styled_components_namespaceObject.css)(["background:", ";"], themes_namespaceObject.variables.interactiveColorOverlayHover)
362
- }), (0,themes_namespaceObject.pick)({
363
- prisma: (0,external_styled_components_namespaceObject.css)(["&:active{background:", ";}"], themes_namespaceObject.variables.interactiveColorOverlayActive)
364
- }), function (_ref5) {
365
- var $selected = _ref5.$selected;
366
- return $selected && (0,themes_namespaceObject.pick)({
367
- prisma: (0,external_styled_components_namespaceObject.css)(["background:", ";&:active{background:", ";}"], themes_namespaceObject.variables.interactiveColorOverlaySelected, themes_namespaceObject.mixins.overlayColors(themes_namespaceObject.variables.interactiveColorOverlaySelected, themes_namespaceObject.variables.interactiveColorOverlayActive))
368
- });
369
- }, (0,themes_namespaceObject.pick)({
370
- enterprise: {
371
- light: themes_namespaceObject.variables.gray45,
372
- dark: themes_namespaceObject.variables.contentColorDisabled
373
- },
374
- prisma: themes_namespaceObject.variables.contentColorDisabled
375
- }),
376
- /* sc-sel */
377
- StyledItemDescriptionBottom,
378
- /* sc-sel */
379
- StyledItemDescriptionRight,
380
- /* sc-sel */
381
- StyledItemSelectedIcon, (0,themes_namespaceObject.pick)({
382
- prisma: themes_namespaceObject.variables.contentColorDisabled,
383
- enterprise: themes_namespaceObject.variables.gray80
384
- }), (0,themes_namespaceObject.pick)({
385
- prisma: (0,external_styled_components_namespaceObject.css)(["& > * > ", "{color:", ";}"],
386
- /* sc-sel */
387
- StyledItemIcon, themes_namespaceObject.variables.contentColorDisabled)
388
- }), function (_ref6) {
389
- var $selected = _ref6.$selected;
390
- return $selected && (0,themes_namespaceObject.pick)({
391
- prisma: (0,external_styled_components_namespaceObject.css)(["", "{color:", ";}"],
263
+ */ function N(e) {
264
+ var t = e.children, i = e.title, a = e.outerStyle, o = D(e, [ "children", "title", "outerStyle" ]);
265
+ var l = (0, r.useContext)(h), s = l.role;
266
+ var c = C()(), p = c.family;
267
+ var u = p === "prisma" ? n().createElement(P, T({
268
+ as: i ? "h4" : "h5",
269
+ style: a,
270
+ "data-test": "heading"
271
+ }, o), t) : n().createElement(S(), T({
272
+ style: j(j({}, a), {}, {
273
+ margin: 0
274
+ }),
275
+ level: i ? 4 : "ss",
276
+ "data-test": "heading"
277
+ }, o), t);
278
+ // headings are not supported in role="listbox"
279
+ // this causes Firefox to incorrectly read the total number
280
+ // of items in the list if it contains a heading or divider
281
+ // so we set them to aria-hidden to prevent that
282
+
283
+ return n().createElement(I, {
284
+ "aria-hidden": s === "listbox"
285
+ }, u);
286
+ }
287
+ N.propTypes = q;
288
+ /* Remove consecutive items with filterConsecutive = true (Dividers and Headings) */ N.filterConsecutive = true;
289
+ /* Remove the item if it is the last item after filtering. */ N.filterLast = true;
290
+ /* Tag the item as a Heading */ N.as = "Heading";
291
+ /* harmony default export */ const H = N;
292
+ // CONCATENATED MODULE: external "lodash/isString"
293
+ const F = require("lodash/isString");
294
+ var $ = e.n(F);
295
+ // CONCATENATED MODULE: external "@splunk/react-icons/CaretSmallRight"
296
+ const A = require("@splunk/react-icons/CaretSmallRight");
297
+ var M = e.n(A);
298
+ // CONCATENATED MODULE: external "@splunk/react-icons/Checkmark"
299
+ const K = require("@splunk/react-icons/Checkmark");
300
+ var z = e.n(K);
301
+ // CONCATENATED MODULE: external "@splunk/react-icons/enterprise/Check"
302
+ const L = require("@splunk/react-icons/enterprise/Check");
303
+ var W = e.n(L);
304
+ // CONCATENATED MODULE: external "@splunk/react-icons/enterprise/ChevronRight"
305
+ const B = require("@splunk/react-icons/enterprise/ChevronRight");
306
+ var G = e.n(B);
307
+ // CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
308
+ const U = require("@splunk/react-ui/Clickable");
309
+ var V = e.n(U);
310
+ // CONCATENATED MODULE: external "@splunk/react-ui/Switch"
311
+ const Q = require("@splunk/react-ui/Switch");
312
+ var Y = e.n(Q);
313
+ // CONCATENATED MODULE: ./src/Menu/ItemStyles.ts
314
+ var J = (0, f.css)([ "color:", ";font-size:", ";line-height:", ";overflow:inherit;white-space:inherit;text-overflow:inherit;" ], (0,
315
+ b.pick)({
316
+ prisma: b.variables.contentColorDefault,
317
+ enterprise: b.variables.textGray
318
+ }), b.variables.fontSizeSmall, (0, b.pick)({
319
+ prisma: "16px"
320
+ }));
321
+ var X = v().span.withConfig({
322
+ displayName: "ItemStyles__StyledItemDescriptionBottom",
323
+ componentId: "sc-4kc053-0"
324
+ })([ "", ";display:block;" ], J);
325
+ var Z = v().span.withConfig({
326
+ displayName: "ItemStyles__StyledItemDescriptionRight",
327
+ componentId: "sc-4kc053-1"
328
+ })([ "", ";float:right;padding-left:", ";max-width:50%;text-align:right;box-sizing:border-box;" ], J, b.variables.spacing);
329
+ var ee = v().div.withConfig({
330
+ displayName: "ItemStyles__StyledItemSelectedIcon",
331
+ componentId: "sc-4kc053-2"
332
+ })([ "position:absolute;", " color:", ";" ], (0, b.pick)({
333
+ prisma: (0, f.css)([ "right:16px;" ]),
334
+ enterprise: (0, f.css)([ "top:5px;right:3px;left:8px;" ])
335
+ }), (0, b.pick)({
336
+ prisma: b.variables.contentColorActive,
337
+ enterprise: b.variables.accentColorL10
338
+ }));
339
+ var te = v().span.withConfig({
340
+ displayName: "ItemStyles__StyledItemIcon",
341
+ componentId: "sc-4kc053-3"
342
+ })([ "flex:0 0 auto;padding-right:", ";min-width:10px;display:inline-block;text-align:center;vertical-align:", ";", "" ], (0,
343
+ b.pick)({
344
+ prisma: "8px",
345
+ enterprise: "3px"
346
+ }), (0, b.pick)({
347
+ prisma: "initial",
348
+ enterprise: "middle"
349
+ }), (0, b.pick)({
350
+ prisma: (0, f.css)([ "color:", ";display:inline-flex;align-items:center;min-width:20px;min-height:20px;& > svg{width:20px;height:20px;}" ], b.variables.contentColorMuted),
351
+ enterprise: (0, f.css)([ "transform:translateY(-1px);" ])
352
+ }));
353
+ var re = v()(V()).withConfig({
354
+ displayName: "ItemStyles__StyledClickable",
355
+ componentId: "sc-4kc053-4"
356
+ })([ "display:block;position:relative;cursor:pointer;color:", ";word-wrap:break-word;max-width:100%;width:100%;padding:", ";", " ", " ", " &:not([disabled]){&:hover{background:", ";", "}&:focus{outline:0;box-shadow:", ";", "}", " ", "}&[disabled]{color:", ";cursor:not-allowed;", ",", "{color:inherit;}", "{cursor:not-allowed;color:", ";}", "}", "" ], (0,
357
+ b.pick)({
358
+ prisma: b.variables.contentColorActive,
359
+ enterprise: {
360
+ dark: b.variables.gray96,
361
+ light: b.variables.gray22
362
+ }
363
+ }), (0, b.pick)({
364
+ prisma: {
365
+ comfortable: "10px 16px",
366
+ compact: "6px 16px"
367
+ },
368
+ enterprise: "6px 10px"
369
+ }), (function(e) {
370
+ var t = e.$isSelectable, r = e.$selectableAppearance;
371
+ return t && (0, b.pick)({
372
+ prisma: (0, f.css)([ "padding-right:44px;", "" ], (function() {
373
+ return r === "checkbox" && "padding-left: 42px;";
374
+ })),
375
+ enterprise: (0, f.css)([ "padding-right:10px;padding-left:", ";" ], (function() {
376
+ return r === "checkbox" ? "32px" : "28px";
377
+ }))
378
+ });
379
+ }), (function(e) {
380
+ var t = e.$active, r = e.$preventFocus;
381
+ return t && !r && (0, f.css)([ "box-shadow:", ";" ], b.variables.focusShadowInset);
382
+ }), (function(e) {
383
+ var t = e.$active;
384
+ return t && (0, f.css)([ "background:", ";font-weight:", ";" ], (0, b.pick)({
385
+ enterprise: {
386
+ light: b.variables.gray92,
387
+ dark: b.variables.gray22
388
+ },
389
+ prisma: b.variables.neutral100
390
+ }), b.variables.fontWeightBold);
391
+ }), (0, b.pick)({
392
+ prisma: b.variables.interactiveColorOverlayHover,
393
+ enterprise: b.variables.backgroundColorHover
394
+ }), (function(e) {
395
+ var t = e.$selected;
396
+ return t && (0, b.pick)({
397
+ prisma: (0, f.css)([ "background:", ";" ], b.mixins.overlayColors(b.variables.interactiveColorOverlaySelected, b.variables.interactiveColorOverlayHover))
398
+ });
399
+ }), b.variables.focusShadowInset, (0, b.pick)({
400
+ prisma: (0, f.css)([ "background:", ";" ], b.variables.interactiveColorOverlayHover)
401
+ }), (0, b.pick)({
402
+ prisma: (0, f.css)([ "&:active{background:", ";}" ], b.variables.interactiveColorOverlayActive)
403
+ }), (function(e) {
404
+ var t = e.$selected;
405
+ return t && (0, b.pick)({
406
+ prisma: (0, f.css)([ "background:", ";&:active{background:", ";}" ], b.variables.interactiveColorOverlaySelected, b.mixins.overlayColors(b.variables.interactiveColorOverlaySelected, b.variables.interactiveColorOverlayActive))
407
+ });
408
+ }), (0, b.pick)({
409
+ enterprise: {
410
+ light: b.variables.gray45,
411
+ dark: b.variables.contentColorDisabled
412
+ },
413
+ prisma: b.variables.contentColorDisabled
414
+ }),
415
+ /* sc-sel */
416
+ X,
392
417
  /* sc-sel */
393
- StyledItemIcon, themes_namespaceObject.variables.contentColorActive)
394
- });
395
- });
396
- var StyledSwitch = external_styled_components_default()((Switch_default())).withConfig({
397
- displayName: "ItemStyles__StyledSwitch",
398
- componentId: "sc-4kc053-5"
399
- })(["position:absolute;left:", ";top:", ";"], (0,themes_namespaceObject.pick)({
400
- prisma: '16px',
401
- enterprise: '8px'
402
- }), (0,themes_namespaceObject.pick)({
403
- prisma: '0px',
404
- enterprise: {
405
- comfortable: '-1px',
406
- compact: '2px'
407
- }
408
- }));
409
- var StyledInnerWrapper = external_styled_components_default().span.withConfig({
410
- displayName: "ItemStyles__StyledInnerWrapper",
411
- componentId: "sc-4kc053-6"
412
- })(["display:flex;align-items:flex-start;"]);
413
- var StyledTitleAndDescriptionWrapper = external_styled_components_default().span.withConfig({
414
- displayName: "ItemStyles__StyledTitleAndDescriptionWrapper",
415
- componentId: "sc-4kc053-7"
416
- })(["max-width:100%;width:100%;align-self:center;word-break:break-word;white-space:normal;", ""], function (_ref7) {
417
- var $truncate = _ref7.$truncate;
418
- return $truncate && (0,external_styled_components_namespaceObject.css)(["white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"]);
419
- });
420
- var StyledLabel = external_styled_components_default().div.withConfig({
421
- displayName: "ItemStyles__StyledLabel",
422
- componentId: "sc-4kc053-8"
423
- })(["overflow:inherit;white-space:inherit;text-overflow:inherit;max-width:100%;min-height:20px;", ""], function (_ref8) {
424
- var $truncate = _ref8.$truncate;
425
- return $truncate && (0,external_styled_components_namespaceObject.css)(["display:block;clear:both;"]);
426
- });
427
- var StyledMatch = external_styled_components_default().span.withConfig({
428
- displayName: "ItemStyles__StyledMatch",
429
- componentId: "sc-4kc053-9"
430
- })(["border-bottom:1px solid ", ";"], (0,themes_namespaceObject.pick)({
431
- prisma: themes_namespaceObject.variables.contentColorActive,
432
- enterprise: {
433
- dark: themes_namespaceObject.variables.gray96,
434
- light: themes_namespaceObject.variables.gray45
435
- }
436
- }));
437
- var StyledSubmenu = external_styled_components_default().span.withConfig({
438
- displayName: "ItemStyles__StyledSubmenu",
439
- componentId: "sc-4kc053-10"
440
- })(["float:right;padding-left:", ";color:", ";"], themes_namespaceObject.variables.spacingSmall, (0,themes_namespaceObject.pick)({
441
- prisma: 'inherit',
442
- enterprise: themes_namespaceObject.variables.textGray
443
- }));
444
-
445
- ;// CONCATENATED MODULE: external "@splunk/react-icons/ArrowSquareTopRight"
446
- const ArrowSquareTopRight_namespaceObject = require("@splunk/react-icons/ArrowSquareTopRight");
447
- var ArrowSquareTopRight_default = /*#__PURE__*/__webpack_require__.n(ArrowSquareTopRight_namespaceObject);
448
- ;// CONCATENATED MODULE: external "@splunk/react-icons/enterprise/External"
449
- const External_namespaceObject = require("@splunk/react-icons/enterprise/External");
450
- var External_default = /*#__PURE__*/__webpack_require__.n(External_namespaceObject);
451
- ;// CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
452
- const i18n_namespaceObject = require("@splunk/ui-utils/i18n");
453
- ;// CONCATENATED MODULE: ./src/Menu/icons/External.tsx
454
-
455
-
456
-
457
-
458
-
459
-
460
-
461
- var label = (0,i18n_namespaceObject._)('Open externally');
462
-
463
- var iconStyles = (0,external_styled_components_namespaceObject.css)(["width:0.8em;height:0.8em;vertical-align:baseline;"]);
464
- var StyledEnterprise = external_styled_components_default()((External_default())).withConfig({
465
- displayName: "External__StyledEnterprise",
466
- componentId: "sc-1turs2s-0"
467
- })(["", " margin:0 0 0 3px;"], iconStyles);
468
- var StyledPrisma = external_styled_components_default()((ArrowSquareTopRight_default())).withConfig({
469
- displayName: "External__StyledPrisma",
470
- componentId: "sc-1turs2s-1"
471
- })(["", " margin:0 0 0 4px;"], iconStyles);
472
-
473
- function External() {
474
- var _useSplunkTheme = (0,themes_namespaceObject.useSplunkTheme)(),
475
- isEnterprise = _useSplunkTheme.isEnterprise,
476
- isCompact = _useSplunkTheme.isCompact;
477
-
478
- var prismaSize = isCompact ? '20px' : '24px';
479
- return isEnterprise ? /*#__PURE__*/external_react_default().createElement(StyledEnterprise, {
480
- screenReaderText: label
481
- }) : /*#__PURE__*/external_react_default().createElement(StyledPrisma, {
482
- "aria-label": label,
483
- height: prismaSize,
484
- width: prismaSize
485
- }, /*#__PURE__*/external_react_default().createElement("title", null, label));
486
- }
487
-
488
- /* harmony default export */ const icons_External = (External);
489
- ;// CONCATENATED MODULE: ./src/utils/updateReactRef.ts
490
- /**
418
+ Z,
419
+ /* sc-sel */
420
+ ee, (0, b.pick)({
421
+ prisma: b.variables.contentColorDisabled,
422
+ enterprise: b.variables.gray80
423
+ }), (0, b.pick)({
424
+ prisma: (0, f.css)([ "& > * > ", "{color:", ";}" ],
425
+ /* sc-sel */
426
+ te, b.variables.contentColorDisabled)
427
+ }), (function(e) {
428
+ var t = e.$selected;
429
+ return t && (0, b.pick)({
430
+ prisma: (0, f.css)([ "", "{color:", ";}" ],
431
+ /* sc-sel */
432
+ te, b.variables.contentColorActive)
433
+ });
434
+ }));
435
+ var ne = v()(Y()).withConfig({
436
+ displayName: "ItemStyles__StyledSwitch",
437
+ componentId: "sc-4kc053-5"
438
+ })([ "position:absolute;left:", ";top:", ";" ], (0, b.pick)({
439
+ prisma: "16px",
440
+ enterprise: "8px"
441
+ }), (0, b.pick)({
442
+ prisma: "0px",
443
+ enterprise: {
444
+ comfortable: "-1px",
445
+ compact: "2px"
446
+ }
447
+ }));
448
+ var ie = v().span.withConfig({
449
+ displayName: "ItemStyles__StyledInnerWrapper",
450
+ componentId: "sc-4kc053-6"
451
+ })([ "display:flex;align-items:flex-start;" ]);
452
+ var ae = v().span.withConfig({
453
+ displayName: "ItemStyles__StyledTitleAndDescriptionWrapper",
454
+ componentId: "sc-4kc053-7"
455
+ })([ "max-width:100%;width:100%;align-self:center;word-break:break-word;white-space:normal;", "" ], (function(e) {
456
+ var t = e.$truncate;
457
+ return t && (0, f.css)([ "white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" ]);
458
+ }));
459
+ var oe = v().div.withConfig({
460
+ displayName: "ItemStyles__StyledLabel",
461
+ componentId: "sc-4kc053-8"
462
+ })([ "overflow:inherit;white-space:inherit;text-overflow:inherit;max-width:100%;min-height:20px;", "" ], (function(e) {
463
+ var t = e.$truncate;
464
+ return t && (0, f.css)([ "display:block;clear:both;" ]);
465
+ }));
466
+ var le = v().span.withConfig({
467
+ displayName: "ItemStyles__StyledMatch",
468
+ componentId: "sc-4kc053-9"
469
+ })([ "border-bottom:1px solid ", ";" ], (0, b.pick)({
470
+ prisma: b.variables.contentColorActive,
471
+ enterprise: {
472
+ dark: b.variables.gray96,
473
+ light: b.variables.gray45
474
+ }
475
+ }));
476
+ var se = v().span.withConfig({
477
+ displayName: "ItemStyles__StyledSubmenu",
478
+ componentId: "sc-4kc053-10"
479
+ })([ "float:right;padding-left:", ";color:", ";" ], b.variables.spacingSmall, (0,
480
+ b.pick)({
481
+ prisma: "inherit",
482
+ enterprise: b.variables.textGray
483
+ }));
484
+ // CONCATENATED MODULE: external "@splunk/react-icons/ArrowSquareTopRight"
485
+ const ce = require("@splunk/react-icons/ArrowSquareTopRight");
486
+ var pe = e.n(ce);
487
+ // CONCATENATED MODULE: external "@splunk/react-icons/enterprise/External"
488
+ const ue = require("@splunk/react-icons/enterprise/External");
489
+ var de = e.n(ue);
490
+ // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
491
+ const fe = require("@splunk/ui-utils/i18n");
492
+ // CONCATENATED MODULE: ./src/Menu/icons/External.tsx
493
+ var ve = (0, fe._)("Open externally");
494
+ var be = (0, f.css)([ "width:0.8em;height:0.8em;vertical-align:baseline;" ]);
495
+ var me = v()(de()).withConfig({
496
+ displayName: "External__StyledEnterprise",
497
+ componentId: "sc-1turs2s-0"
498
+ })([ "", " margin:0 0 0 3px;" ], be);
499
+ var he = v()(pe()).withConfig({
500
+ displayName: "External__StyledPrisma",
501
+ componentId: "sc-1turs2s-1"
502
+ })([ "", " margin:0 0 0 4px;" ], be);
503
+ function ye() {
504
+ var e = (0, b.useSplunkTheme)(), t = e.isEnterprise, r = e.isCompact;
505
+ var i = r ? "20px" : "24px";
506
+ return t ? n().createElement(me, {
507
+ screenReaderText: ve
508
+ }) : n().createElement(he, {
509
+ "aria-label": ve,
510
+ height: i,
511
+ width: i
512
+ }, n().createElement("title", null, ve));
513
+ }
514
+ /* harmony default export */ const ge = ye;
515
+ // CONCATENATED MODULE: ./src/utils/updateReactRef.ts
516
+ /**
491
517
  * Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
492
518
  *
493
519
  * @param ref - The React callback or object ref. Can be `null` or `undefined`.
494
520
  * @param current - The new value of the ref.
495
521
  */
496
- function updateReactRef(ref, current) {
497
- if (ref) {
498
- if (typeof ref === 'function') {
499
- ref(current);
500
- } else {
501
- // the public signature of this util uses React.Ref<T> to mirror the way React types refs.
502
- // the intention here is to signal "we will take care of setting 'current', not you".
503
- ref.current = current; // eslint-disable-line no-param-reassign
522
+ function ke(e, t) {
523
+ if (e) {
524
+ if (typeof e === "function") {
525
+ e(t);
526
+ } else {
527
+ // the public signature of this util uses React.Ref<T> to mirror the way React types refs.
528
+ // the intention here is to signal "we will take care of setting 'current', not you".
529
+ e.current = t;
530
+ // eslint-disable-line no-param-reassign
531
+ }
532
+ }
504
533
  }
505
- }
506
- }
507
-
508
-
509
- ;// CONCATENATED MODULE: ./src/utils/scrollIntoViewIfNeeded.ts
510
- // A utility that attempts to move an element into view by scrolling it's derived parent.
511
- var scrollIntoViewIfNeeded_scrollIntoViewIfNeeded = function scrollIntoViewIfNeeded(el) {
512
- if (!el) {
513
- return;
514
- }
515
-
516
- var parentEl = el.offsetParent;
517
-
518
- if (!parentEl) {
519
- return;
520
- } // Below the bottom of the container.
521
-
522
-
523
- if (parentEl.scrollTop + parentEl.clientHeight < el.offsetTop + el.clientHeight) {
524
- parentEl.scrollTop = el.offsetTop + el.clientHeight - parentEl.clientHeight; // Above the top of the container.
525
- } else if (parentEl.scrollTop > el.offsetTop) {
526
- parentEl.scrollTop = el.offsetTop;
527
- }
528
- };
529
-
530
-
531
- ;// CONCATENATED MODULE: ./src/Menu/Item.tsx
532
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
533
-
534
- function Item_extends() { Item_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Item_extends.apply(this, arguments); }
535
-
536
- function Item_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = Item_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
537
-
538
- function Item_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
539
-
540
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
541
-
542
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
543
-
544
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
545
-
546
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
547
-
548
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
549
-
550
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
551
-
552
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
553
-
554
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
555
-
556
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
557
-
558
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
559
-
560
- function Item_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
561
-
562
-
563
-
564
-
565
-
566
-
567
-
568
-
569
-
570
-
571
-
572
-
573
-
574
-
575
- var Item_propTypes = {
576
- active: (external_prop_types_default()).bool,
577
- children: (external_prop_types_default()).node,
578
- description: (external_prop_types_default()).string,
579
- descriptionPosition: external_prop_types_default().oneOf(['right', 'bottom']),
580
- disabled: (external_prop_types_default()).bool,
581
- elementRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
582
- hasSubmenu: (external_prop_types_default()).bool,
583
- icon: (external_prop_types_default()).node,
584
-
585
- /** @private. The internal key of the tab */
586
- itemKey: (external_prop_types_default()).number,
587
- matchRanges: external_prop_types_default().arrayOf(external_prop_types_default().shape({
588
- start: (external_prop_types_default()).number.isRequired,
589
- end: (external_prop_types_default()).number.isRequired
590
- })),
591
- onClick: (external_prop_types_default()).func,
592
-
593
- /** @private */
594
- onFocus: (external_prop_types_default()).func,
595
- openInNewContext: (external_prop_types_default()).bool,
596
-
597
- /** @private */
598
- preventFocus: (external_prop_types_default()).bool,
599
- role: external_prop_types_default().oneOf(['menuitem', 'menuitemradio', 'menuitemcheckbox', 'listboxitem', 'option']),
600
- selectable: (external_prop_types_default()).bool,
601
- selectableAppearance: external_prop_types_default().oneOf(['checkmark', 'checkbox']),
602
- selected: (external_prop_types_default()).bool,
603
-
604
- /** @private */
605
- splunkTheme: (external_prop_types_default()).object,
606
- to: (external_prop_types_default()).string,
607
- truncate: (external_prop_types_default()).bool
608
- };
609
- var defaultProps = {
610
- active: false,
611
- descriptionPosition: 'bottom',
612
- disabled: false,
613
- hasSubmenu: false,
614
- openInNewContext: false,
615
- preventFocus: false,
616
- selectable: false,
617
- selectableAppearance: 'checkmark',
618
- selected: false,
619
- truncate: false
620
- };
621
-
622
- var Item = /*#__PURE__*/function (_Component) {
623
- _inherits(Item, _Component);
624
-
625
- var _super = _createSuper(Item);
626
-
627
- _createClass(Item, null, [{
628
- key: "validateProps",
629
- // @docs-props-type ItemPropsBase
630
- value: function validateProps(props) {
631
- if (false) {}
534
+ // CONCATENATED MODULE: ./src/utils/scrollIntoViewIfNeeded.ts
535
+ // A utility that attempts to move an element into view by scrolling it's derived parent.
536
+ var xe = function e(t) {
537
+ if (!t) {
538
+ return;
539
+ }
540
+ var r = t.offsetParent;
541
+ if (!r) {
542
+ return;
543
+ }
544
+ // Below the bottom of the container.
545
+ if (r.scrollTop + r.clientHeight < t.offsetTop + t.clientHeight) {
546
+ r.scrollTop = t.offsetTop + t.clientHeight - r.clientHeight;
547
+ // Above the top of the container.
548
+ } else if (r.scrollTop > t.offsetTop) {
549
+ r.scrollTop = t.offsetTop;
550
+ }
551
+ };
552
+ // CONCATENATED MODULE: ./src/Menu/Item.tsx
553
+ function we(e) {
554
+ "@babel/helpers - typeof";
555
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
556
+ we = function e(t) {
557
+ return typeof t;
558
+ };
559
+ } else {
560
+ we = function e(t) {
561
+ return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
562
+ };
563
+ }
564
+ return we(e);
632
565
  }
633
- }]);
634
-
635
- function Item(props) {
636
- var _this;
637
-
638
- _classCallCheck(this, Item);
639
-
640
- _this = _super.call(this, props);
641
-
642
- Item_defineProperty(_assertThisInitialized(_this), "el", null);
643
-
644
- Item_defineProperty(_assertThisInitialized(_this), "handleFocus", function (e) {
645
- var _this$props = _this.props,
646
- onFocus = _this$props.onFocus,
647
- itemKey = _this$props.itemKey;
648
- onFocus === null || onFocus === void 0 ? void 0 : onFocus(e, {
649
- itemKey: itemKey
650
- });
651
- });
652
-
653
- Item_defineProperty(_assertThisInitialized(_this), "handleMount", function (el) {
654
- _this.el = el;
655
- updateReactRef(_this.props.elementRef, el);
656
- });
657
-
658
- Item.validateProps(props);
659
- return _this;
660
- }
661
-
662
- _createClass(Item, [{
663
- key: "componentDidUpdate",
664
- value: function componentDidUpdate() {
665
- Item.validateProps(this.props);
566
+ function Se() {
567
+ Se = Object.assign || function(e) {
568
+ for (var t = 1; t < arguments.length; t++) {
569
+ var r = arguments[t];
570
+ for (var n in r) {
571
+ if (Object.prototype.hasOwnProperty.call(r, n)) {
572
+ e[n] = r[n];
573
+ }
574
+ }
575
+ }
576
+ return e;
577
+ };
578
+ return Se.apply(this, arguments);
666
579
  }
667
- }, {
668
- key: "focus",
669
- value: function focus() {
670
- var _this$el;
671
-
672
- (_this$el = this.el) === null || _this$el === void 0 ? void 0 : _this$el.focus();
580
+ function Oe(e, t) {
581
+ if (e == null) return {};
582
+ var r = Ce(e, t);
583
+ var n, i;
584
+ if (Object.getOwnPropertySymbols) {
585
+ var a = Object.getOwnPropertySymbols(e);
586
+ for (i = 0; i < a.length; i++) {
587
+ n = a[i];
588
+ if (t.indexOf(n) >= 0) continue;
589
+ if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
590
+ r[n] = e[n];
591
+ }
592
+ }
593
+ return r;
673
594
  }
674
- }, {
675
- key: "scrollIntoViewIfNeeded",
676
- value: function scrollIntoViewIfNeeded() {
677
- scrollIntoViewIfNeeded_scrollIntoViewIfNeeded(this.el);
595
+ function Ce(e, t) {
596
+ if (e == null) return {};
597
+ var r = {};
598
+ var n = Object.keys(e);
599
+ var i, a;
600
+ for (a = 0; a < n.length; a++) {
601
+ i = n[a];
602
+ if (t.indexOf(i) >= 0) continue;
603
+ r[i] = e[i];
604
+ }
605
+ return r;
678
606
  }
679
- }, {
680
- key: "renderLabel",
681
- value: function renderLabel() {
682
- var _this$props2 = this.props,
683
- children = _this$props2.children,
684
- matchRanges = _this$props2.matchRanges;
685
-
686
- if (!matchRanges || !isString_default()(children)) {
687
- return children;
688
- }
689
-
690
- var segments = []; // before first match. May be empty string.
691
-
692
- segments.push(children.substring(0, matchRanges[0].start));
693
- matchRanges.forEach(function (match, index) {
694
- segments.push(
695
- /*#__PURE__*/
696
- // eslint-disable-next-line react/no-array-index-key
697
- external_react_default().createElement(StyledMatch, {
698
- key: index,
699
- "data-test": "match"
700
- }, children.substring(match.start, match.end)));
701
-
702
- if (index < matchRanges.length - 1) {
703
- segments.push(children.substring(match.end, matchRanges[index + 1].start));
704
- } else {
705
- segments.push(children.substring(match.end, children.length));
607
+ function Ie(e, t) {
608
+ if (!(e instanceof t)) {
609
+ throw new TypeError("Cannot call a class as a function");
706
610
  }
707
- });
708
- return segments;
709
611
  }
710
- }, {
711
- key: "render",
712
- value: function render() {
713
- var _this$props3 = this.props,
714
- active = _this$props3.active,
715
- children = _this$props3.children,
716
- hasSubmenu = _this$props3.hasSubmenu,
717
- selectable = _this$props3.selectable,
718
- selectableAppearance = _this$props3.selectableAppearance,
719
- selected = _this$props3.selected,
720
- icon = _this$props3.icon,
721
- description = _this$props3.description,
722
- disabled = _this$props3.disabled,
723
- onClick = _this$props3.onClick,
724
- preventFocus = _this$props3.preventFocus,
725
- role = _this$props3.role,
726
- splunkTheme = _this$props3.splunkTheme,
727
- to = _this$props3.to,
728
- truncate = _this$props3.truncate,
729
- descriptionPosition = _this$props3.descriptionPosition,
730
- openInNewContext = _this$props3.openInNewContext,
731
- otherProps = Item_objectWithoutProperties(_this$props3, ["active", "children", "hasSubmenu", "selectable", "selectableAppearance", "selected", "icon", "description", "disabled", "onClick", "preventFocus", "role", "splunkTheme", "to", "truncate", "descriptionPosition", "openInNewContext"]);
732
-
733
- var isEnterprise = splunkTheme.isEnterprise,
734
- isPrisma = splunkTheme.isPrisma;
735
- var isSelectable = selectable || selected;
736
- var defaultRole = {
737
- nonselectable: 'menuitem',
738
- checkmark: 'menuitemradio',
739
- checkbox: 'menuitemcheckbox'
740
- }[isSelectable ? selectableAppearance : 'nonselectable']; // aria-checked updates only with checkmark appearance for now SUI-2578
741
-
742
- var ariaProps = {
743
- 'aria-haspopup': hasSubmenu ? true : undefined,
744
- 'aria-checked': selectableAppearance === 'checkmark' && selected ? true : undefined
745
- };
746
- var selectablePosition = isPrisma ? 'right' : 'left';
747
- var descriptionRight = description && descriptionPosition === 'right' && selectablePosition !== 'right';
748
- var descriptionBottom = description && !descriptionRight;
749
- var selectableCheckmark = selected && selectableAppearance === 'checkmark' && /*#__PURE__*/external_react_default().createElement(StyledItemSelectedIcon, null, isPrisma ? /*#__PURE__*/external_react_default().createElement((Checkmark_default()), {
750
- inline: true,
751
- height: "16",
752
- width: "16"
753
- }) : /*#__PURE__*/external_react_default().createElement((Check_default()), {
754
- hideDefaultTooltip: true,
755
- inline: true,
756
- screenReaderText: null,
757
- size: 0.85
758
- }));
759
- return /*#__PURE__*/external_react_default().createElement(StyledClickable, Item_extends({
760
- $isSelectable: isSelectable,
761
- $selectableAppearance: selectableAppearance,
762
- $selected: selected,
763
- $active: active,
764
- $preventFocus: preventFocus,
765
- "data-test-selected": isSelectable ? selected : null,
766
- "data-test": "item",
767
- "data-has-icon": !!icon,
768
- disabled: disabled,
769
- onClick: onClick,
770
- onFocus: this.handleFocus,
771
- onMouseDown: function onMouseDown(e) {
772
- if (preventFocus) {
773
- e.preventDefault();
774
- }
775
- },
776
- role: role || defaultRole,
777
- to: to,
778
- title: truncate && isString_default()(children) ? children : undefined,
779
- openInNewContext: openInNewContext
780
- }, ariaProps, omit_default()(otherProps, 'onFocus'), {
781
- elementRef: this.handleMount
782
- }), selectablePosition === 'left' && selectableCheckmark, selectable && selectableAppearance === 'checkbox' && /*#__PURE__*/external_react_default().createElement(StyledSwitch, {
783
- interactive: false,
784
- selected: selected,
785
- selectedLabel: "Selected",
786
- value: "menu-item"
787
- }), hasSubmenu && /*#__PURE__*/external_react_default().createElement(StyledSubmenu, null, isEnterprise ? /*#__PURE__*/external_react_default().createElement((ChevronRight_default()), {
788
- hideDefaultTooltip: true,
789
- screenReaderText: null
790
- }) : /*#__PURE__*/external_react_default().createElement((CaretSmallRight_default()), {
791
- height: "24",
792
- width: "24"
793
- })), descriptionRight && /*#__PURE__*/external_react_default().createElement(StyledItemDescriptionRight, {
794
- "data-test": "description"
795
- }, description), /*#__PURE__*/external_react_default().createElement(StyledInnerWrapper, null, icon && /*#__PURE__*/external_react_default().createElement(StyledItemIcon, null, icon), /*#__PURE__*/external_react_default().createElement(StyledTitleAndDescriptionWrapper, {
796
- $truncate: truncate
797
- }, /*#__PURE__*/external_react_default().createElement(StyledLabel, {
798
- $truncate: truncate,
799
- "data-test": "label"
800
- }, this.renderLabel(), openInNewContext && /*#__PURE__*/external_react_default().createElement(icons_External, null)), descriptionBottom && /*#__PURE__*/external_react_default().createElement(StyledItemDescriptionBottom, {
801
- "data-test": "description"
802
- }, description)), selectablePosition === 'right' && selectableCheckmark));
612
+ function Pe(e, t) {
613
+ for (var r = 0; r < t.length; r++) {
614
+ var n = t[r];
615
+ n.enumerable = n.enumerable || false;
616
+ n.configurable = true;
617
+ if ("value" in n) n.writable = true;
618
+ Object.defineProperty(e, n.key, n);
619
+ }
803
620
  }
804
- }]);
805
-
806
- return Item;
807
- }(external_react_namespaceObject.Component);
808
-
809
- Item_defineProperty(Item, "propTypes", Item_propTypes);
810
-
811
- Item_defineProperty(Item, "defaultProps", defaultProps);
812
-
813
- Item_defineProperty(Item, "as", void 0);
814
-
815
- var ItemWithThemeBase = (0,themes_namespaceObject.withSplunkTheme)(Item);
816
- var ItemWithTheme = ItemWithThemeBase;
817
- ItemWithTheme.propTypes = Item.propTypes;
818
- ItemWithTheme.as = 'Item';
819
- /* harmony default export */ const Menu_Item = (ItemWithTheme);
820
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Scroll"
821
- const Scroll_namespaceObject = require("@splunk/react-ui/Scroll");
822
- var Scroll_default = /*#__PURE__*/__webpack_require__.n(Scroll_namespaceObject);
823
- ;// CONCATENATED MODULE: ./src/Menu/MenuStyles.ts
824
-
825
-
826
-
827
- var adjacentSiblingStyles = (0,external_styled_components_namespaceObject.css)(["border-top:1px solid ", ";"], (0,themes_namespaceObject.pick)({
828
- enterprise: themes_namespaceObject.variables.gray60,
829
- prisma: themes_namespaceObject.variables.neutral200
830
- }));
831
- var MenuStyles_Styled = external_styled_components_default().div.withConfig({
832
- displayName: "MenuStyles__Styled",
833
- componentId: "sc-1olffp9-0"
834
- })(["", ";background-color:", ";border-radius:", ";min-width:60px;overflow:auto;position:relative;", " &:focus{outline:0;box-shadow:", ";", "}& + &{", "}"], themes_namespaceObject.mixins.reset('block'), (0,themes_namespaceObject.pick)({
835
- enterprise: themes_namespaceObject.variables.backgroundColor,
836
- prisma: themes_namespaceObject.variables.backgroundColorPopup
837
- }), themes_namespaceObject.variables.borderRadius, (0,themes_namespaceObject.pick)({
838
- prisma: (0,external_styled_components_namespaceObject.css)(["padding:8px 0;"])
839
- }), themes_namespaceObject.variables.focusShadowInset, (0,themes_namespaceObject.pick)({
840
- prisma: (0,external_styled_components_namespaceObject.css)(["background:", ";"], themes_namespaceObject.variables.interactiveColorOverlayHover)
841
- }), adjacentSiblingStyles);
842
- var StyledScroll = external_styled_components_default()(MenuStyles_Styled.withComponent((Scroll_default()))).withConfig({
843
- displayName: "MenuStyles__StyledScroll",
844
- componentId: "sc-1olffp9-1"
845
- })(["", " + &,& + ", "{", "}"],
846
- /* sc-sel */
847
- MenuStyles_Styled,
848
- /* sc-sel */
849
- MenuStyles_Styled, adjacentSiblingStyles);
850
-
851
- ;// CONCATENATED MODULE: ./src/utils/navigateList.ts
852
- // A utility for keyboard navigation of lists
853
- function getNextListItem(refs, currentIndex, nextIndex) {
854
- for (var i = 0; i < refs.length; i += 1) {
855
- var _refs$pointer$current;
856
-
857
- var pointer = (i + nextIndex) % refs.length;
858
-
859
- if (((_refs$pointer$current = refs[pointer].current) === null || _refs$pointer$current === void 0 ? void 0 : _refs$pointer$current.props.disabled) !== true) {
860
- return refs[pointer];
621
+ function _e(e, t, r) {
622
+ if (t) Pe(e.prototype, t);
623
+ if (r) Pe(e, r);
624
+ return e;
861
625
  }
862
- }
863
-
864
- return refs[currentIndex];
865
- }
866
-
867
- function getPrevListItem(refs, currentIndex, prevIndex) {
868
- for (var i = refs.length; i > 0; i -= 1) {
869
- var _refs$pointer$current2;
870
-
871
- var pointer = (i + prevIndex) % refs.length;
872
-
873
- if (((_refs$pointer$current2 = refs[pointer].current) === null || _refs$pointer$current2 === void 0 ? void 0 : _refs$pointer$current2.props.disabled) !== true) {
874
- return refs[pointer];
626
+ function je(e, t) {
627
+ if (typeof t !== "function" && t !== null) {
628
+ throw new TypeError("Super expression must either be null or a function");
629
+ }
630
+ e.prototype = Object.create(t && t.prototype, {
631
+ constructor: {
632
+ value: e,
633
+ writable: true,
634
+ configurable: true
635
+ }
636
+ });
637
+ if (t) Ee(e, t);
638
+ }
639
+ function Ee(e, t) {
640
+ Ee = Object.setPrototypeOf || function e(t, r) {
641
+ t.__proto__ = r;
642
+ return t;
643
+ };
644
+ return Ee(e, t);
645
+ }
646
+ function Te(e) {
647
+ var t = qe();
648
+ return function r() {
649
+ var n = Ne(e), i;
650
+ if (t) {
651
+ var a = Ne(this).constructor;
652
+ i = Reflect.construct(n, arguments, a);
653
+ } else {
654
+ i = n.apply(this, arguments);
655
+ }
656
+ return De(this, i);
657
+ };
658
+ }
659
+ function De(e, t) {
660
+ if (t && (we(t) === "object" || typeof t === "function")) {
661
+ return t;
662
+ }
663
+ return Re(e);
875
664
  }
876
- }
877
-
878
- return refs[currentIndex];
879
- }
880
-
881
-
882
- ;// CONCATENATED MODULE: ./src/Menu/Menu.tsx
883
- function Menu_extends() { Menu_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Menu_extends.apply(this, arguments); }
884
-
885
- function Menu_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = Menu_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
886
-
887
- function Menu_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
888
-
889
-
890
-
891
-
892
-
893
-
894
-
895
-
896
-
897
-
898
-
899
-
900
-
901
-
902
-
903
- var Menu_propTypes = {
904
- children: (external_prop_types_default()).node,
905
-
906
- /** @private */
907
- controlledExternally: (external_prop_types_default()).bool,
908
- elementRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
909
- retainFocus: (external_prop_types_default()).bool,
910
- stopScrollPropagation: (external_prop_types_default()).bool
911
- };
912
- var Menu_defaultProps = {
913
- stopScrollPropagation: false
914
- };
915
-
916
- function Menu(_ref) {
917
- var children = _ref.children,
918
- controlledExternally = _ref.controlledExternally,
919
- elementRef = _ref.elementRef,
920
- retainFocusProp = _ref.retainFocus,
921
- stopScrollPropagation = _ref.stopScrollPropagation,
922
- otherProps = Menu_objectWithoutProperties(_ref, ["children", "controlledExternally", "elementRef", "retainFocus", "stopScrollPropagation"]);
923
-
924
- // @docs-props-type MenuPropsBase
925
- var _useContext = (0,external_react_namespaceObject.useContext)(MenuContext),
926
- _useContext$role = _useContext.role,
927
- role = _useContext$role === void 0 ? 'menu' : _useContext$role;
928
-
929
- var _useContext2 = (0,external_react_namespaceObject.useContext)(Popover_namespaceObject.PopoverContext),
930
- retainFocusFromContext = _useContext2.retainFocus;
931
-
932
- var forceUpdate = useForceUpdate_default()();
933
- var retainFocus = true;
934
-
935
- if (retainFocusProp != null) {
936
- retainFocus = retainFocusProp;
937
- } else if (retainFocusFromContext != null) {
938
- retainFocus = retainFocusFromContext;
939
- }
940
-
941
- var focusedItemKeyRef = external_react_default().useRef(0);
942
- var itemRefs = [];
943
- var itemKeyCounter = 0;
944
- var firstEnabledItemKey;
945
- var focusedItemKeyIsDisabled = false;
946
- var hasSelectedItems = false;
947
- var hasSelectedEnabledItems = false;
948
-
949
- var handleKeyDown = function handleKeyDown(e) {
950
- // SUI-2734: keeping this active even if controlledExternally is set
951
- // because Firefox + Voiceover (and possibly other a11y tools)
952
- // can still set focus on the Menu items and this avoids the
953
- // whole page scrolling when that happens
954
- var key = (0,keyboard_namespaceObject.keycode)(e.nativeEvent);
955
- var focusedItemKey = focusedItemKeyRef.current;
956
- var itemToFocusRef; // the "retainFocus" checks here mimic the prior tab key functionality
957
-
958
- if (key === 'down' || retainFocus && (0,focus_namespaceObject.isTabKey)(e)) {
959
- itemToFocusRef = getNextListItem(itemRefs, focusedItemKey, focusedItemKey + 1);
960
- } else if (key === 'up' || retainFocus && (0,focus_namespaceObject.isTabKey)(e) && e.shiftKey) {
961
- itemToFocusRef = getPrevListItem(itemRefs, focusedItemKey, focusedItemKey - 1);
962
- } else if (key === 'home') {
963
- itemToFocusRef = getNextListItem(itemRefs, focusedItemKey, 0);
964
- } else if (key === 'end') {
965
- itemToFocusRef = getPrevListItem(itemRefs, focusedItemKey, itemRefs.length - 1);
665
+ function Re(e) {
666
+ if (e === void 0) {
667
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
668
+ }
669
+ return e;
966
670
  }
967
-
968
- if (itemToFocusRef != null) {
969
- var _itemToFocusRef$curre, _itemToFocusRef$curre2;
970
-
971
- (_itemToFocusRef$curre = itemToFocusRef.current) === null || _itemToFocusRef$curre === void 0 ? void 0 : (_itemToFocusRef$curre2 = _itemToFocusRef$curre.focus) === null || _itemToFocusRef$curre2 === void 0 ? void 0 : _itemToFocusRef$curre2.call(_itemToFocusRef$curre);
972
- e.preventDefault();
671
+ function qe() {
672
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
673
+ if (Reflect.construct.sham) return false;
674
+ if (typeof Proxy === "function") return true;
675
+ try {
676
+ Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
677
+ return true;
678
+ } catch (e) {
679
+ return false;
680
+ }
973
681
  }
974
- };
975
-
976
- var itemOnFocus = (0,external_react_namespaceObject.useCallback)(function (e, data) {
977
- var itemKey = data.itemKey;
978
-
979
- if (itemKey != null) {
980
- focusedItemKeyRef.current = itemKey;
682
+ function Ne(e) {
683
+ Ne = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
684
+ return t.__proto__ || Object.getPrototypeOf(t);
685
+ };
686
+ return Ne(e);
981
687
  }
982
- }, []);
983
- var childrenCleaned = external_react_namespaceObject.Children.toArray(children).filter(external_react_namespaceObject.isValidElement).reduce(function (acc, item, index, original) {
984
- /* Filter out initial Dividers
688
+ function He(e, t, r) {
689
+ if (t in e) {
690
+ Object.defineProperty(e, t, {
691
+ value: r,
692
+ enumerable: true,
693
+ configurable: true,
694
+ writable: true
695
+ });
696
+ } else {
697
+ e[t] = r;
698
+ }
699
+ return e;
700
+ }
701
+ var Fe = {
702
+ active: a().bool,
703
+ children: a().node,
704
+ description: a().string,
705
+ descriptionPosition: a().oneOf([ "right", "bottom" ]),
706
+ disabled: a().bool,
707
+ elementRef: a().oneOfType([ a().func, a().object ]),
708
+ hasSubmenu: a().bool,
709
+ icon: a().node,
710
+ /** @private. The internal key of the tab */
711
+ itemKey: a().number,
712
+ matchRanges: a().arrayOf(a().shape({
713
+ start: a().number.isRequired,
714
+ end: a().number.isRequired
715
+ })),
716
+ onClick: a().func,
717
+ /** @private */
718
+ onFocus: a().func,
719
+ openInNewContext: a().bool,
720
+ /** @private */
721
+ preventFocus: a().bool,
722
+ role: a().oneOf([ "menuitem", "menuitemradio", "menuitemcheckbox", "listboxitem", "option" ]),
723
+ selectable: a().bool,
724
+ selectableAppearance: a().oneOf([ "checkmark", "checkbox" ]),
725
+ selected: a().bool,
726
+ /** @private */
727
+ splunkTheme: a().object,
728
+ to: a().string,
729
+ truncate: a().bool
730
+ };
731
+ var $e = {
732
+ active: false,
733
+ descriptionPosition: "bottom",
734
+ disabled: false,
735
+ hasSubmenu: false,
736
+ openInNewContext: false,
737
+ preventFocus: false,
738
+ selectable: false,
739
+ selectableAppearance: "checkmark",
740
+ selected: false,
741
+ truncate: false
742
+ };
743
+ var Ae = function(e) {
744
+ je(r, e);
745
+ var t = Te(r);
746
+ _e(r, null, [ {
747
+ key: "validateProps",
748
+ // @docs-props-type ItemPropsBase
749
+ value: function e(t) {
750
+ if (false) {}
751
+ }
752
+ } ]);
753
+ function r(e) {
754
+ var n;
755
+ Ie(this, r);
756
+ n = t.call(this, e);
757
+ He(Re(n), "el", null);
758
+ He(Re(n), "handleFocus", (function(e) {
759
+ var t = n.props, r = t.onFocus, i = t.itemKey;
760
+ r === null || r === void 0 ? void 0 : r(e, {
761
+ itemKey: i
762
+ });
763
+ }));
764
+ He(Re(n), "handleMount", (function(e) {
765
+ n.el = e;
766
+ ke(n.props.elementRef, e);
767
+ }));
768
+ r.validateProps(e);
769
+ return n;
770
+ }
771
+ _e(r, [ {
772
+ key: "componentDidUpdate",
773
+ value: function e() {
774
+ r.validateProps(this.props);
775
+ }
776
+ }, {
777
+ key: "focus",
778
+ value: function e() {
779
+ var t;
780
+ (t = this.el) === null || t === void 0 ? void 0 : t.focus();
781
+ }
782
+ }, {
783
+ key: "scrollIntoViewIfNeeded",
784
+ value: function e() {
785
+ xe(this.el);
786
+ }
787
+ }, {
788
+ key: "renderLabel",
789
+ value: function e() {
790
+ var t = this.props, r = t.children, i = t.matchRanges;
791
+ if (!i || !$()(r)) {
792
+ return r;
793
+ }
794
+ var a = [];
795
+ // before first match. May be empty string.
796
+ a.push(r.substring(0, i[0].start));
797
+ i.forEach((function(e, t) {
798
+ a.push(
799
+
800
+ // eslint-disable-next-line react/no-array-index-key
801
+ n().createElement(le, {
802
+ key: t,
803
+ "data-test": "match"
804
+ }, r.substring(e.start, e.end)));
805
+ if (t < i.length - 1) {
806
+ a.push(r.substring(e.end, i[t + 1].start));
807
+ } else {
808
+ a.push(r.substring(e.end, r.length));
809
+ }
810
+ }));
811
+ return a;
812
+ }
813
+ }, {
814
+ key: "render",
815
+ value: function e() {
816
+ var t = this.props, r = t.active, i = t.children, a = t.hasSubmenu, o = t.selectable, s = t.selectableAppearance, c = t.selected, p = t.icon, u = t.description, d = t.disabled, f = t.onClick, v = t.preventFocus, b = t.role, m = t.splunkTheme, h = t.to, y = t.truncate, g = t.descriptionPosition, k = t.openInNewContext, x = Oe(t, [ "active", "children", "hasSubmenu", "selectable", "selectableAppearance", "selected", "icon", "description", "disabled", "onClick", "preventFocus", "role", "splunkTheme", "to", "truncate", "descriptionPosition", "openInNewContext" ]);
817
+ var w = m.isEnterprise, S = m.isPrisma;
818
+ var O = o || c;
819
+ var C = {
820
+ nonselectable: "menuitem",
821
+ checkmark: "menuitemradio",
822
+ checkbox: "menuitemcheckbox"
823
+ }[O ? s : "nonselectable"];
824
+ // aria-checked updates only with checkmark appearance for now SUI-2578
825
+ var I = {
826
+ "aria-haspopup": a ? true : undefined,
827
+ "aria-checked": s === "checkmark" && c ? true : undefined
828
+ };
829
+ var P = S ? "right" : "left";
830
+ var _ = u && g === "right" && P !== "right";
831
+ var j = u && !_;
832
+ var E = c && s === "checkmark" && n().createElement(ee, null, S ? n().createElement(z(), {
833
+ inline: true,
834
+ height: "16",
835
+ width: "16"
836
+ }) : n().createElement(W(), {
837
+ hideDefaultTooltip: true,
838
+ inline: true,
839
+ screenReaderText: null,
840
+ size: .85
841
+ }));
842
+
843
+ return n().createElement(re, Se({
844
+ $isSelectable: O,
845
+ $selectableAppearance: s,
846
+ $selected: c,
847
+ $active: r,
848
+ $preventFocus: v,
849
+ "data-test-selected": O ? c : null,
850
+ "data-test": "item",
851
+ "data-has-icon": !!p,
852
+ disabled: d,
853
+ onClick: f,
854
+ onFocus: this.handleFocus,
855
+ onMouseDown: function e(t) {
856
+ if (v) {
857
+ t.preventDefault();
858
+ }
859
+ },
860
+ role: b || C,
861
+ to: h,
862
+ title: y && $()(i) ? i : undefined,
863
+ openInNewContext: k
864
+ }, I, l()(x, "onFocus"), {
865
+ elementRef: this.handleMount
866
+ }), P === "left" && E, o && s === "checkbox" && n().createElement(ne, {
867
+ interactive: false,
868
+ selected: c,
869
+ selectedLabel: "Selected",
870
+ value: "menu-item"
871
+ }), a && n().createElement(se, null, w ? n().createElement(G(), {
872
+ hideDefaultTooltip: true,
873
+ screenReaderText: null
874
+ }) : n().createElement(M(), {
875
+ height: "24",
876
+ width: "24"
877
+ })), _ && n().createElement(Z, {
878
+ "data-test": "description"
879
+ }, u), n().createElement(ie, null, p && n().createElement(te, null, p), n().createElement(ae, {
880
+ $truncate: y
881
+ }, n().createElement(oe, {
882
+ $truncate: y,
883
+ "data-test": "label"
884
+ }, this.renderLabel(), k && n().createElement(ge, null)), j && n().createElement(X, {
885
+ "data-test": "description"
886
+ }, u)), P === "right" && E));
887
+ }
888
+ } ]);
889
+ return r;
890
+ }(r.Component);
891
+ He(Ae, "propTypes", Fe);
892
+ He(Ae, "defaultProps", $e);
893
+ He(Ae, "as", void 0);
894
+ var Me = (0, b.withSplunkTheme)(Ae);
895
+ var Ke = Me;
896
+ Ke.propTypes = Ae.propTypes;
897
+ Ke.as = "Item";
898
+ /* harmony default export */ const ze = Ke;
899
+ // CONCATENATED MODULE: external "@splunk/react-ui/Scroll"
900
+ const Le = require("@splunk/react-ui/Scroll");
901
+ var We = e.n(Le);
902
+ // CONCATENATED MODULE: ./src/Menu/MenuStyles.ts
903
+ var Be = (0, f.css)([ "border-top:1px solid ", ";" ], (0, b.pick)({
904
+ enterprise: b.variables.gray60,
905
+ prisma: b.variables.neutral200
906
+ }));
907
+ var Ge = v().div.withConfig({
908
+ displayName: "MenuStyles__Styled",
909
+ componentId: "sc-1olffp9-0"
910
+ })([ "", ";background-color:", ";border-radius:", ";min-width:60px;overflow:auto;position:relative;", " &:focus{outline:0;box-shadow:", ";", "}& + &{", "}" ], b.mixins.reset("block"), (0,
911
+ b.pick)({
912
+ enterprise: b.variables.backgroundColor,
913
+ prisma: b.variables.backgroundColorPopup
914
+ }), b.variables.borderRadius, (0, b.pick)({
915
+ prisma: (0, f.css)([ "padding:8px 0;" ])
916
+ }), b.variables.focusShadowInset, (0, b.pick)({
917
+ prisma: (0, f.css)([ "background:", ";" ], b.variables.interactiveColorOverlayHover)
918
+ }), Be);
919
+ var Ue = v()(Ge.withComponent(We())).withConfig({
920
+ displayName: "MenuStyles__StyledScroll",
921
+ componentId: "sc-1olffp9-1"
922
+ })([ "", " + &,& + ", "{", "}" ],
923
+ /* sc-sel */
924
+ Ge,
925
+ /* sc-sel */
926
+ Ge, Be);
927
+ // CONCATENATED MODULE: ./src/utils/navigateList.ts
928
+ // A utility for keyboard navigation of lists
929
+ function Ve(e, t, r) {
930
+ for (var n = 0; n < e.length; n += 1) {
931
+ var i;
932
+ var a = (n + r) % e.length;
933
+ if (((i = e[a].current) === null || i === void 0 ? void 0 : i.props.disabled) !== true) {
934
+ return e[a];
935
+ }
936
+ }
937
+ return e[t];
938
+ }
939
+ function Qe(e, t, r) {
940
+ for (var n = e.length; n > 0; n -= 1) {
941
+ var i;
942
+ var a = (n + r) % e.length;
943
+ if (((i = e[a].current) === null || i === void 0 ? void 0 : i.props.disabled) !== true) {
944
+ return e[a];
945
+ }
946
+ }
947
+ return e[t];
948
+ }
949
+ // CONCATENATED MODULE: ./src/Menu/Menu.tsx
950
+ function Ye() {
951
+ Ye = Object.assign || function(e) {
952
+ for (var t = 1; t < arguments.length; t++) {
953
+ var r = arguments[t];
954
+ for (var n in r) {
955
+ if (Object.prototype.hasOwnProperty.call(r, n)) {
956
+ e[n] = r[n];
957
+ }
958
+ }
959
+ }
960
+ return e;
961
+ };
962
+ return Ye.apply(this, arguments);
963
+ }
964
+ function Je(e, t) {
965
+ if (e == null) return {};
966
+ var r = Xe(e, t);
967
+ var n, i;
968
+ if (Object.getOwnPropertySymbols) {
969
+ var a = Object.getOwnPropertySymbols(e);
970
+ for (i = 0; i < a.length; i++) {
971
+ n = a[i];
972
+ if (t.indexOf(n) >= 0) continue;
973
+ if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
974
+ r[n] = e[n];
975
+ }
976
+ }
977
+ return r;
978
+ }
979
+ function Xe(e, t) {
980
+ if (e == null) return {};
981
+ var r = {};
982
+ var n = Object.keys(e);
983
+ var i, a;
984
+ for (a = 0; a < n.length; a++) {
985
+ i = n[a];
986
+ if (t.indexOf(i) >= 0) continue;
987
+ r[i] = e[i];
988
+ }
989
+ return r;
990
+ }
991
+ var Ze = {
992
+ children: a().node,
993
+ /** @private */
994
+ controlledExternally: a().bool,
995
+ elementRef: a().oneOfType([ a().func, a().object ]),
996
+ retainFocus: a().bool,
997
+ stopScrollPropagation: a().bool
998
+ };
999
+ var et = {
1000
+ stopScrollPropagation: false
1001
+ };
1002
+ function tt(e) {
1003
+ var t = e.children, i = e.controlledExternally, a = e.elementRef, o = e.retainFocus, u = e.stopScrollPropagation, f = Je(e, [ "children", "controlledExternally", "elementRef", "retainFocus", "stopScrollPropagation" ]);
1004
+ // @docs-props-type MenuPropsBase
1005
+ var v = (0, r.useContext)(h), b = v.role, m = b === void 0 ? "menu" : b;
1006
+ var y = (0, r.useContext)(s.PopoverContext), g = y.retainFocus;
1007
+ var k = d()();
1008
+ var x = true;
1009
+ if (o != null) {
1010
+ x = o;
1011
+ } else if (g != null) {
1012
+ x = g;
1013
+ }
1014
+ var w = n().useRef(0);
1015
+ var S = [];
1016
+ var O = 0;
1017
+ var C;
1018
+ var I = false;
1019
+ var P = false;
1020
+ var _ = false;
1021
+ var j = function e(t) {
1022
+ // SUI-2734: keeping this active even if controlledExternally is set
1023
+ // because Firefox + Voiceover (and possibly other a11y tools)
1024
+ // can still set focus on the Menu items and this avoids the
1025
+ // whole page scrolling when that happens
1026
+ var r = (0, p.keycode)(t.nativeEvent);
1027
+ var n = w.current;
1028
+ var i;
1029
+ // the "retainFocus" checks here mimic the prior tab key functionality
1030
+ if (r === "down" || x && (0, c.isTabKey)(t)) {
1031
+ i = Ve(S, n, n + 1);
1032
+ } else if (r === "up" || x && (0, c.isTabKey)(t) && t.shiftKey) {
1033
+ i = Qe(S, n, n - 1);
1034
+ } else if (r === "home") {
1035
+ i = Ve(S, n, 0);
1036
+ } else if (r === "end") {
1037
+ i = Qe(S, n, S.length - 1);
1038
+ }
1039
+ if (i != null) {
1040
+ var a, o;
1041
+ (a = i.current) === null || a === void 0 ? void 0 : (o = a.focus) === null || o === void 0 ? void 0 : o.call(a);
1042
+ t.preventDefault();
1043
+ }
1044
+ };
1045
+ var E = (0, r.useCallback)((function(e, t) {
1046
+ var r = t.itemKey;
1047
+ if (r != null) {
1048
+ w.current = r;
1049
+ }
1050
+ }), []);
1051
+ var T = r.Children.toArray(t).filter(r.isValidElement).reduce((function(e, t, r, a) {
1052
+ /* Filter out initial Dividers
985
1053
  * Requires reduce() over filter() because a Heading may have been
986
1054
  * before the Divider.
987
1055
  */
988
- if (item.type.as === 'Divider' && acc.length === 0) {
989
- return acc;
990
- } // Filter out consecutive Dividers and Headings
991
- // If Divider is next to Heading then it will remove both Heading and Divider unless Heading has title prop set to it
992
-
993
-
994
- if ((item.type.as === 'Heading' || item.type.as === 'Divider') && !item.props.title && item.type.filterConsecutive && original.length > index + 1) {
995
- var consec = original[index + 1];
996
-
997
- if (consec.type.as === 'Heading' || consec.type.as === 'Divider') {
998
- return acc;
999
- }
1000
- } // Filter out last Dividers and Headings
1001
-
1002
-
1003
- if ((item.type.as === 'Divider' || item.type.as === 'Heading') && index === original.length - 1) {
1004
- return acc;
1005
- } // the filterConsecutive check filters out Headings and Dividers whether styled or not
1006
- // the typeof check prevents props from being applied to HTML elements
1007
- // such as the zero-height scroll bottom div in <ResultsMenu>
1008
-
1009
-
1010
- if (!(item.type.as === 'Divider' || item.type.as === 'Heading') && typeof item.type !== 'string') {
1011
- var _ref2 = /*#__PURE__*/external_react_default().createRef();
1012
-
1013
- itemRefs.push(_ref2);
1014
-
1015
- if (firstEnabledItemKey == null && (!('disabled' in item.props) || !item.props.disabled)) {
1016
- firstEnabledItemKey = itemKeyCounter;
1017
- }
1018
-
1019
- if (focusedItemKeyRef.current === itemKeyCounter && 'disabled' in item.props && item.props.disabled) {
1020
- focusedItemKeyIsDisabled = true;
1021
- }
1022
-
1023
- if ('selected' in item.props && item.props.selected) {
1024
- hasSelectedItems = true;
1025
-
1026
- if ('disabled' in item.props && !item.props.disabled) {
1027
- hasSelectedEnabledItems = true;
1056
+ if (t.type.as === "Divider" && e.length === 0) {
1057
+ return e;
1058
+ }
1059
+ // Filter out consecutive Dividers and Headings
1060
+ // If Divider is next to Heading then it will remove both Heading and Divider unless Heading has title prop set to it
1061
+ if ((t.type.as === "Heading" || t.type.as === "Divider") && !t.props.title && t.type.filterConsecutive && a.length > r + 1) {
1062
+ var o = a[r + 1];
1063
+ if (o.type.as === "Heading" || o.type.as === "Divider") {
1064
+ return e;
1065
+ }
1066
+ }
1067
+ // Filter out last Dividers and Headings
1068
+ if ((t.type.as === "Divider" || t.type.as === "Heading") && r === a.length - 1) {
1069
+ return e;
1070
+ }
1071
+ // the filterConsecutive check filters out Headings and Dividers whether styled or not
1072
+ // the typeof check prevents props from being applied to HTML elements
1073
+ // such as the zero-height scroll bottom div in <ResultsMenu>
1074
+ if (!(t.type.as === "Divider" || t.type.as === "Heading") && typeof t.type !== "string") {
1075
+ var l = n().createRef();
1076
+ S.push(l);
1077
+ if (C == null && (!("disabled" in t.props) || !t.props.disabled)) {
1078
+ C = O;
1079
+ }
1080
+ if (w.current === O && "disabled" in t.props && t.props.disabled) {
1081
+ I = true;
1082
+ }
1083
+ if ("selected" in t.props && t.props.selected) {
1084
+ P = true;
1085
+ if ("disabled" in t.props && !t.props.disabled) {
1086
+ _ = true;
1087
+ }
1088
+ }
1089
+ var s = !i && w.current === O ? undefined : -1;
1090
+ e.push( n().cloneElement(t, {
1091
+ itemKey: O,
1092
+ onFocus: E,
1093
+ preventFocus: i,
1094
+ ref: function e(r) {
1095
+ ke(t.ref, r);
1096
+ ke(l, r);
1097
+ },
1098
+ tabIndex: s
1099
+ }));
1100
+ O += 1;
1101
+ return e;
1102
+ }
1103
+ e.push(t);
1104
+ return e;
1105
+ }), []);
1106
+ if (C !== w.current && (!P || _) && I && C != null) {
1107
+ w.current = C;
1108
+ k();
1028
1109
  }
1029
- }
1030
-
1031
- var tabIndex = !controlledExternally && focusedItemKeyRef.current === itemKeyCounter ? undefined : -1;
1032
- acc.push( /*#__PURE__*/external_react_default().cloneElement(item, {
1033
- itemKey: itemKeyCounter,
1034
- onFocus: itemOnFocus,
1035
- preventFocus: controlledExternally,
1036
- ref: function ref(c) {
1037
- updateReactRef(item.ref, c);
1038
- updateReactRef(_ref2, c);
1039
- },
1040
- tabIndex: tabIndex
1041
- }));
1042
- itemKeyCounter += 1;
1043
- return acc;
1110
+ var D = {
1111
+ "data-test": "menu",
1112
+ onKeyDown: j,
1113
+ role: m,
1114
+ tabIndex: C == null && !i ? 0 : undefined
1115
+ };
1116
+ return u ? n().createElement(Ue, Ye({}, D, {
1117
+ elementRef: a,
1118
+ stopScrollPropagation: true
1119
+ }, l()(f, "tagName")), T) : n().createElement(Ge, Ye({}, D, {
1120
+ ref: a
1121
+ }, f), T);
1044
1122
  }
1045
-
1046
- acc.push(item);
1047
- return acc;
1048
- }, []);
1049
-
1050
- if (firstEnabledItemKey !== focusedItemKeyRef.current && (!hasSelectedItems || hasSelectedEnabledItems) && focusedItemKeyIsDisabled && firstEnabledItemKey != null) {
1051
- focusedItemKeyRef.current = firstEnabledItemKey;
1052
- forceUpdate();
1053
- }
1054
-
1055
- var sharedProps = {
1056
- 'data-test': 'menu',
1057
- onKeyDown: handleKeyDown,
1058
- role: role,
1059
- tabIndex: firstEnabledItemKey == null && !controlledExternally ? 0 : undefined
1060
- };
1061
- return stopScrollPropagation ? /*#__PURE__*/external_react_default().createElement(StyledScroll, Menu_extends({}, sharedProps, {
1062
- elementRef: elementRef,
1063
- stopScrollPropagation: true
1064
- }, omit_default()(otherProps, 'tagName')), childrenCleaned) : /*#__PURE__*/external_react_default().createElement(MenuStyles_Styled, Menu_extends({}, sharedProps, {
1065
- ref: elementRef
1066
- }, otherProps), childrenCleaned);
1067
- }
1068
-
1069
- Menu.propTypes = Menu_propTypes;
1070
- Menu.defaultProps = Menu_defaultProps;
1071
- Menu.Item = Menu_Item;
1072
- Menu.Divider = Menu_Divider;
1073
- Menu.Heading = Menu_Heading;
1074
- /* harmony default export */ const Menu_Menu = (Menu);
1075
-
1076
- ;// CONCATENATED MODULE: ./src/Menu/index.ts
1077
-
1078
-
1079
-
1080
- module.exports = __webpack_exports__;
1081
- /******/ })()
1082
- ;
1123
+ tt.propTypes = Ze;
1124
+ tt.defaultProps = et;
1125
+ tt.Item = ze;
1126
+ tt.Divider = x;
1127
+ tt.Heading = H;
1128
+ /* harmony default export */ const rt = tt;
1129
+ // CONCATENATED MODULE: ./src/Menu/index.ts
1130
+ module.exports = t;
1131
+ /******/})();