@splunk/react-ui 4.38.0 → 4.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/Accordion.js +131 -153
  2. package/Anchor.js +50 -58
  3. package/Animation.js +64 -59
  4. package/AnimationToggle.js +59 -61
  5. package/Box.js +59 -67
  6. package/Breadcrumbs.js +113 -127
  7. package/Button.js +151 -169
  8. package/ButtonGroup.js +41 -49
  9. package/ButtonSimple.js +264 -295
  10. package/CHANGELOG.md +49 -0
  11. package/Calendar.js +353 -414
  12. package/Card.js +186 -244
  13. package/CardLayout.js +86 -83
  14. package/Chip.js +136 -146
  15. package/Clickable.js +180 -198
  16. package/CloseButton.js +52 -60
  17. package/Code.js +24 -31
  18. package/CollapsiblePanel.js +172 -202
  19. package/Color.js +371 -412
  20. package/ColumnLayout.js +72 -96
  21. package/ComboBox.js +266 -303
  22. package/Concertina.js +406 -454
  23. package/ControlGroup.js +178 -210
  24. package/Date.js +116 -131
  25. package/DefinitionList.js +125 -149
  26. package/Divider.js +81 -79
  27. package/Dropdown.js +226 -237
  28. package/DualListbox.js +150 -186
  29. package/EventListener.js +4 -1
  30. package/File.js +1032 -955
  31. package/FormRows.js +281 -334
  32. package/Heading.js +27 -35
  33. package/Image.js +101 -116
  34. package/JSONTree.js +301 -344
  35. package/Layer.js +118 -126
  36. package/Link.js +141 -159
  37. package/List.js +61 -77
  38. package/MIGRATION.mdx +123 -38
  39. package/Markdown.js +288 -347
  40. package/Menu.js +506 -532
  41. package/Message.js +197 -207
  42. package/MessageBar.js +58 -66
  43. package/Modal.js +241 -290
  44. package/ModalLayer.js +130 -148
  45. package/Monogram.js +138 -138
  46. package/Multiselect.js +3137 -3433
  47. package/Number.js +164 -178
  48. package/Paginator.js +296 -335
  49. package/Paragraph.js +24 -32
  50. package/Popover.js +450 -442
  51. package/Progress.js +65 -75
  52. package/RadioBar.js +301 -303
  53. package/RadioList.js +77 -119
  54. package/Resize.js +105 -127
  55. package/ResultsMenu.js +373 -385
  56. package/ScreenReaderContent.js +50 -58
  57. package/Scroll.js +209 -244
  58. package/Search.js +379 -391
  59. package/Select.js +2085 -2345
  60. package/SidePanel.js +122 -142
  61. package/Slider.js +132 -145
  62. package/SlidingPanels.js +238 -270
  63. package/SplitButton.d.ts +2 -0
  64. package/SplitButton.js +222 -245
  65. package/StaticContent.js +68 -76
  66. package/StepBar.js +206 -205
  67. package/Switch.js +176 -205
  68. package/TabBar.js +235 -268
  69. package/TabLayout.js +122 -141
  70. package/Table.js +2103 -2261
  71. package/Text.js +379 -493
  72. package/TextArea.js +411 -441
  73. package/Tooltip.js +116 -132
  74. package/TransitionOpen.js +160 -178
  75. package/Tree.js +268 -287
  76. package/Typography.js +48 -52
  77. package/WaitSpinner.js +61 -69
  78. package/cypress/support/commands.ts +9 -0
  79. package/cypress/support/index.d.ts +6 -0
  80. package/cypress/tsconfig.cypress.json +1 -0
  81. package/docker-compose.yml +0 -1
  82. package/package.json +15 -15
  83. package/types/src/Button/Button.d.ts +5 -1
  84. package/types/src/ButtonSimple/ButtonSimple.d.ts +2 -2
  85. package/types/src/Card/Card.d.ts +1 -0
  86. package/types/src/Card/Footer.d.ts +1 -0
  87. package/types/src/Chip/Chip.d.ts +3 -6
  88. package/types/src/CollapsiblePanel/CollapsiblePanel.d.ts +1 -1
  89. package/types/src/Color/Color.d.ts +2 -2
  90. package/types/src/Color/Palette.d.ts +4 -2
  91. package/types/src/ComboBox/ComboBox.d.ts +1 -1
  92. package/types/src/ComboBox/Option.d.ts +1 -1
  93. package/types/src/ControlGroup/ControlGroup.d.ts +1 -2
  94. package/types/src/Date/Date.d.ts +2 -2
  95. package/types/src/File/File.d.ts +2 -3
  96. package/types/src/File/Retry.d.ts +1 -2
  97. package/types/src/Menu/Item.d.ts +18 -5
  98. package/types/src/Menu/Menu.d.ts +3 -3
  99. package/types/src/Menu/docs/examples/Adornments.d.ts +2 -0
  100. package/types/src/Menu/docs/examples/SelectableWithAdornments.d.ts +2 -0
  101. package/types/src/ModalLayer/ModalLayer.d.ts +1 -1
  102. package/types/src/Multiselect/Compact.d.ts +1 -1
  103. package/types/src/Multiselect/Multiselect.d.ts +1 -1
  104. package/types/src/Multiselect/Normal.d.ts +1 -1
  105. package/types/src/Multiselect/Option.d.ts +2 -0
  106. package/types/src/Number/Number.d.ts +3 -3
  107. package/types/src/Popover/Popover.d.ts +3 -4
  108. package/types/src/RadioBar/RadioBar.d.ts +2 -2
  109. package/types/src/ResultsMenu/VirtualizedResultsMenu/VirtualizedResultsMenu.d.ts +1 -1
  110. package/types/src/ScrollContainerContext/ScrollContainerContext.d.ts +2 -2
  111. package/types/src/Search/Option.d.ts +9 -3
  112. package/types/src/Select/Option.d.ts +3 -1
  113. package/types/src/Select/OptionBase.d.ts +7 -5
  114. package/types/src/Select/Select.d.ts +4 -2
  115. package/types/src/Select/SelectAllOption.d.ts +4 -4
  116. package/types/src/Select/SelectBase.d.ts +104 -66
  117. package/types/src/Select/docs/examples/Appearance.d.ts +0 -2
  118. package/types/src/SidePanel/SidePanel.d.ts +1 -1
  119. package/types/src/Slider/Slider.d.ts +2 -2
  120. package/types/src/SlidingPanels/SlidingPanels.d.ts +1 -1
  121. package/types/src/StepBar/Step.d.ts +1 -2
  122. package/types/src/Switch/Switch.d.ts +0 -1
  123. package/types/src/TabBar/Tab.d.ts +1 -1
  124. package/types/src/TabBar/TabBar.d.ts +3 -1
  125. package/types/src/TabLayout/TabLayout.d.ts +2 -0
  126. package/types/src/Table/Cell.d.ts +0 -2
  127. package/types/src/Table/HeadDropdownCell.d.ts +2 -0
  128. package/types/src/Table/HeadInner.d.ts +5 -1
  129. package/types/src/Table/Table.d.ts +0 -1
  130. package/types/src/Table/docs/examples/StripeRows.d.ts +2 -0
  131. package/types/src/Text/IconOutlinedHide.d.ts +1 -2
  132. package/types/src/Text/IconOutlinedView.d.ts +1 -2
  133. package/types/src/Text/Text.d.ts +2 -2
  134. package/types/src/TextArea/TextArea.d.ts +2 -2
  135. package/types/src/Tooltip/Tooltip.d.ts +4 -4
  136. package/types/src/TransitionOpen/TransitionOpen.d.ts +1 -1
  137. package/types/src/WaitSpinner/WaitSpinner.d.ts +0 -1
  138. package/types/src/useControlled/index.d.ts +2 -0
  139. package/types/src/useControlled/useControlled.d.ts +21 -0
  140. package/types/src/useResizeObserver/index.d.ts +2 -0
  141. package/types/src/useResizeObserver/useResizeObserver.d.ts +12 -0
  142. package/useControlled.js +112 -0
  143. package/useForceUpdate.js +30 -32
  144. package/useKeyPress.d.ts +2 -0
  145. package/useKeyPress.js +1 -1
  146. package/useResizeObserver.d.ts +2 -0
  147. package/useResizeObserver.js +137 -0
  148. package/types/src/ButtonGroup/docs/examples/prisma/Basic.d.ts +0 -1
  149. package/types/src/Chip/docs/examples/Basic.d.ts +0 -2
  150. package/types/src/Chip/docs/examples/prisma/Appearance.d.ts +0 -2
  151. package/types/src/Color/docs/examples/prisma/Controlled.d.ts +0 -2
  152. package/types/src/Color/docs/examples/prisma/ThemeVariables.d.ts +0 -1
  153. package/types/src/Color/docs/examples/prisma/Uncontrolled.d.ts +0 -2
  154. package/types/src/Dropdown/docs/examples/prisma/Basic.d.ts +0 -2
  155. package/types/src/Dropdown/docs/examples/prisma/BasicMenu.d.ts +0 -2
  156. package/types/src/Dropdown/docs/examples/prisma/ControlledDropdown.d.ts +0 -2
  157. package/types/src/Dropdown/docs/examples/prisma/Dialog.d.ts +0 -2
  158. package/types/src/Dropdown/docs/examples/prisma/OtherToggles.d.ts +0 -2
  159. package/types/src/Dropdown/docs/examples/prisma/ScrollingMenu.d.ts +0 -2
  160. package/types/src/File/docs/examples/prisma/Disabled.d.ts +0 -12
  161. package/types/src/File/docs/examples/prisma/Error.d.ts +0 -1
  162. package/types/src/Menu/docs/examples/Icons.d.ts +0 -2
  163. package/types/src/Menu/docs/examples/SelectableWithIcons.d.ts +0 -2
  164. package/types/src/Message/docs/examples/prisma/Title.d.ts +0 -2
  165. package/types/src/TabBar/docs/examples/prisma/Context.d.ts +0 -2
  166. package/types/src/TabLayout/docs/examples/prisma/Context.d.ts +0 -2
  167. package/types/src/Table/docs/examples/prisma/Basic.d.ts +0 -2
  168. package/types/src/WaitSpinner/docs/examples/prisma/Basic.d.ts +0 -2
  169. /package/types/src/Color/docs/examples/{prisma/CustomizedPalette.d.ts → CustomizedPalette.d.ts} +0 -0
  170. /package/types/src/Color/docs/examples/{prisma/HideInput.d.ts → HideInput.d.ts} +0 -0
  171. /package/types/src/StepBar/docs/examples/{prisma/Error.d.ts → Error.d.ts} +0 -0
  172. /package/types/src/TabBar/docs/examples/{prisma/Disabled.d.ts → Disabled.d.ts} +0 -0
package/Select.js CHANGED
@@ -1,34 +1,98 @@
1
1
  /******/ (() => {
2
2
  // webpackBootstrap
3
3
  /******/ "use strict";
4
- /******/ // The require scope
5
- /******/ var e = {};
4
+ /******/ var e = {
5
+ /***/ 2907:
6
+ /***/ (e, t, n) => {
7
+ // EXPORTS
8
+ n.d(t, {
9
+ default: () => /* reexport */ l
10
+ });
11
+ // EXTERNAL MODULE: external "react"
12
+ var r = n(9497);
13
+ // CONCATENATED MODULE: ./src/useControlled/useControlled.tsx
14
+ /**
15
+ * This is a private component not intended for use outside @splunk/react-ui
16
+ *
17
+ * A hook that accepts a default value (as used in an uncontrolled component)
18
+ * and validates that actions that aren't valid in an uncontrolled component
19
+ * such as updating the default value, combining default value with value, etc.
20
+ * are not happening.
21
+ *
22
+ * Return the controlled state of the component.
23
+ */
24
+ function o(e) {
25
+ var t = e.defaultValue, n = e.value, o = e.componentName, l = o === void 0 ? "this component" : o, a = e.defaultValuePropName, i = a === void 0 ? "defaultValue" : a, u = e.valuePropName, c = u === void 0 ? "value" : u;
26
+ var s = (0, r.useRef)(n != null);
27
+ var f = (0, r.useRef)(t);
28
+ (0, r.useEffect)((function() {
29
+ if (false) {}
30
+ }), [ l, t, i, c ]);
31
+ (0, r.useEffect)((function() {
32
+ if (false) {}
33
+ if (false) {}
34
+ }), [ l, t, i, n, c ]);
35
+ return s.current;
36
+ }
37
+ /* harmony default export */ const l = o;
38
+ } // CONCATENATED MODULE: ./src/useControlled/index.ts
39
+ /***/ ,
40
+ /***/ 9497:
41
+ /***/ e => {
42
+ e.exports = require("react");
43
+ /***/
44
+ /******/ }
45
+ };
46
+ /************************************************************************/
47
+ /******/ // The module cache
48
+ /******/ var t = {};
49
+ /******/
50
+ /******/ // The require function
51
+ /******/ function n(r) {
52
+ /******/ // Check if module is in cache
53
+ /******/ var o = t[r];
54
+ /******/ if (o !== undefined) {
55
+ /******/ return o.exports;
56
+ /******/ }
57
+ /******/ // Create a new module (and put it into the cache)
58
+ /******/ var l = t[r] = {
59
+ /******/ // no module.id needed
60
+ /******/ // no module.loaded needed
61
+ /******/ exports: {}
62
+ /******/ };
63
+ /******/
64
+ /******/ // Execute the module function
65
+ /******/ e[r](l, l.exports, n);
66
+ /******/
67
+ /******/ // Return the exports of the module
68
+ /******/ return l.exports;
69
+ /******/ }
6
70
  /******/
7
71
  /************************************************************************/
8
72
  /******/ /* webpack/runtime/compat get default export */
9
73
  /******/ (() => {
10
74
  /******/ // getDefaultExport function for compatibility with non-harmony modules
11
- /******/ e.n = t => {
12
- /******/ var n = t && t.__esModule ?
13
- /******/ () => t["default"]
14
- /******/ : () => t
75
+ /******/ n.n = e => {
76
+ /******/ var t = e && e.__esModule ?
77
+ /******/ () => e["default"]
78
+ /******/ : () => e
15
79
  /******/;
16
- e.d(n, {
17
- a: n
80
+ n.d(t, {
81
+ a: t
18
82
  });
19
- /******/ return n;
83
+ /******/ return t;
20
84
  /******/ };
21
85
  /******/ })();
22
86
  /******/
23
87
  /******/ /* webpack/runtime/define property getters */
24
88
  /******/ (() => {
25
89
  /******/ // define getter functions for harmony exports
26
- /******/ e.d = (t, n) => {
27
- /******/ for (var r in n) {
28
- /******/ if (e.o(n, r) && !e.o(t, r)) {
29
- /******/ Object.defineProperty(t, r, {
90
+ /******/ n.d = (e, t) => {
91
+ /******/ for (var r in t) {
92
+ /******/ if (n.o(t, r) && !n.o(e, r)) {
93
+ /******/ Object.defineProperty(e, r, {
30
94
  enumerable: true,
31
- get: n[r]
95
+ get: t[r]
32
96
  });
33
97
  /******/ }
34
98
  /******/ }
@@ -37,14 +101,14 @@
37
101
  /******/
38
102
  /******/ /* webpack/runtime/hasOwnProperty shorthand */
39
103
  /******/ (() => {
40
- /******/ e.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t)
104
+ /******/ n.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t)
41
105
  /******/;
42
106
  })();
43
107
  /******/
44
108
  /******/ /* webpack/runtime/make namespace object */
45
109
  /******/ (() => {
46
110
  /******/ // define __esModule on exports
47
- /******/ e.r = e => {
111
+ /******/ n.r = e => {
48
112
  /******/ if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
49
113
  /******/ Object.defineProperty(e, Symbol.toStringTag, {
50
114
  value: "Module"
@@ -56,2464 +120,2140 @@
56
120
  /******/ };
57
121
  /******/ })();
58
122
  /******/
59
- /************************************************************************/ var t = {};
60
- // ESM COMPAT FLAG
61
- e.r(t);
62
- // EXPORTS
63
- e.d(t, {
64
- Divider: () => /* reexport */ T.Divider,
65
- Heading: () => /* reexport */ T.Heading,
66
- Option: () => /* reexport */ nn,
67
- default: () => /* reexport */ wn
68
- });
69
- // CONCATENATED MODULE: external "react"
70
- const n = require("react");
71
- var r = e.n(n);
72
- // CONCATENATED MODULE: external "prop-types"
73
- const o = require("prop-types");
74
- var i = e.n(o);
75
- // CONCATENATED MODULE: external "lodash/has"
76
- const a = require("lodash/has");
77
- var l = e.n(a);
78
- // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
79
- const c = require("@splunk/ui-utils/i18n");
80
- // CONCATENATED MODULE: external "lodash/castArray"
81
- const s = require("lodash/castArray");
82
- var u = e.n(s);
83
- // CONCATENATED MODULE: external "lodash/find"
84
- const p = require("lodash/find");
85
- var f = e.n(p);
86
- // CONCATENATED MODULE: external "lodash/forEachRight"
87
- const d = require("lodash/forEachRight");
88
- var v = e.n(d);
89
- // CONCATENATED MODULE: external "lodash/includes"
90
- const h = require("lodash/includes");
91
- var b = e.n(h);
92
- // CONCATENATED MODULE: external "lodash/isUndefined"
93
- const m = require("lodash/isUndefined");
94
- var y = e.n(m);
95
- // CONCATENATED MODULE: external "lodash/keys"
96
- const g = require("lodash/keys");
97
- var O = e.n(g);
98
- // CONCATENATED MODULE: external "lodash/memoize"
99
- const S = require("lodash/memoize");
100
- var w = e.n(S);
101
- // CONCATENATED MODULE: external "lodash/omit"
102
- const x = require("lodash/omit");
103
- var C = e.n(x);
104
- // CONCATENATED MODULE: external "lodash/pick"
105
- const k = require("lodash/pick");
106
- var I = e.n(k);
107
- // CONCATENATED MODULE: external "lodash/uniq"
108
- const _ = require("lodash/uniq");
109
- var A = e.n(_);
110
- // CONCATENATED MODULE: external "lodash/without"
111
- const j = require("lodash/without");
112
- var E = e.n(j);
113
- // CONCATENATED MODULE: external "@splunk/ui-utils/id"
114
- const M = require("@splunk/ui-utils/id");
115
- // CONCATENATED MODULE: external "@splunk/react-ui/Menu"
116
- const T = require("@splunk/react-ui/Menu");
117
- // CONCATENATED MODULE: external "@splunk/react-ui/Dropdown"
118
- const P = require("@splunk/react-ui/Dropdown");
119
- var V = e.n(P);
120
- // CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
121
- const R = require("@splunk/ui-utils/keyboard");
122
- // CONCATENATED MODULE: external "@splunk/ui-utils/filter"
123
- const D = require("@splunk/ui-utils/filter");
124
- // CONCATENATED MODULE: external "@splunk/react-ui/Link"
125
- const L = require("@splunk/react-ui/Link");
126
- var q = e.n(L);
127
- // CONCATENATED MODULE: external "@splunk/react-ui/ResultsMenu"
128
- const N = require("@splunk/react-ui/ResultsMenu");
129
- var B = e.n(N);
130
- // CONCATENATED MODULE: external "@splunk/react-ui/Text"
131
- const K = require("@splunk/react-ui/Text");
132
- var F = e.n(K);
133
- // CONCATENATED MODULE: external "@splunk/react-icons/CaretSmallDown"
134
- const H = require("@splunk/react-icons/CaretSmallDown");
135
- var $ = e.n(H);
136
- // CONCATENATED MODULE: external "@splunk/react-icons/enterprise/Caret"
137
- const z = require("@splunk/react-icons/enterprise/Caret");
138
- var W = e.n(z);
139
- // CONCATENATED MODULE: external "@splunk/themes"
140
- const U = require("@splunk/themes");
141
- // CONCATENATED MODULE: ./src/Select/icons/CaretSmallDown.tsx
142
- var G = function e() {
143
- var t = (0, U.useSplunkTheme)(), n = t.isEnterprise;
144
- var o = n ? r().createElement(W(), {
145
- screenReaderText: null,
146
- hideDefaultTooltip: true,
147
- size: .5
148
- }) : r().createElement($(), null);
149
- return o;
150
- };
151
- /* harmony default export */ const J = G;
152
- // CONCATENATED MODULE: external "@splunk/react-icons/enterprise/Search"
153
- const X = require("@splunk/react-icons/enterprise/Search");
154
- var Y = e.n(X);
155
- // CONCATENATED MODULE: external "@splunk/react-icons/Magnifier"
156
- const Q = require("@splunk/react-icons/Magnifier");
157
- var Z = e.n(Q);
158
- // CONCATENATED MODULE: ./src/Select/icons/Search.tsx
159
- var ee = function e() {
160
- var t = (0, U.useSplunkTheme)(), n = t.isEnterprise, o = t.isCompact;
161
- var i = (0, c._)("Search");
162
- var a = o ? "20px" : "24px";
163
- var l = n ? r().createElement(Y(), {
164
- role: "presentation",
165
- size: "16px",
166
- screenReaderText: i,
167
- hideDefaultTooltip: true
168
- }) : r().createElement(Z(), {
169
- role: "presentation",
170
- "aria-label": i,
171
- width: a,
172
- height: a
123
+ /************************************************************************/ var r = {};
124
+ // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
125
+ (() => {
126
+ // ESM COMPAT FLAG
127
+ n.r(r);
128
+ // EXPORTS
129
+ n.d(r, {
130
+ Divider: () => /* reexport */ A.Divider,
131
+ Heading: () => /* reexport */ A.Heading,
132
+ Option: () => /* reexport */ Nt,
133
+ default: () => /* reexport */ un
173
134
  });
174
- return l;
175
- };
176
- /* harmony default export */ const te = ee;
177
- // CONCATENATED MODULE: ./src/Select/OptionBase.tsx
178
- function ne(e) {
179
- "@babel/helpers - typeof";
180
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
181
- ne = function e(t) {
182
- return typeof t;
183
- };
184
- } else {
185
- ne = function e(t) {
186
- return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
187
- };
135
+ // EXTERNAL MODULE: external "react"
136
+ var e = n(9497);
137
+ var t = n.n(e);
138
+ // CONCATENATED MODULE: external "prop-types"
139
+ const o = require("prop-types");
140
+ var l = n.n(o);
141
+ // CONCATENATED MODULE: external "lodash/has"
142
+ const a = require("lodash/has");
143
+ var i = n.n(a);
144
+ // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
145
+ const u = require("@splunk/ui-utils/i18n");
146
+ // CONCATENATED MODULE: external "lodash/castArray"
147
+ const c = require("lodash/castArray");
148
+ var s = n.n(c);
149
+ // CONCATENATED MODULE: external "lodash/find"
150
+ const f = require("lodash/find");
151
+ var p = n.n(f);
152
+ // CONCATENATED MODULE: external "lodash/forEachRight"
153
+ const d = require("lodash/forEachRight");
154
+ var v = n.n(d);
155
+ // CONCATENATED MODULE: external "lodash/includes"
156
+ const b = require("lodash/includes");
157
+ var m = n.n(b);
158
+ // CONCATENATED MODULE: external "lodash/memoize"
159
+ const y = require("lodash/memoize");
160
+ var h = n.n(y);
161
+ // CONCATENATED MODULE: external "lodash/pick"
162
+ const g = require("lodash/pick");
163
+ var O = n.n(g);
164
+ // CONCATENATED MODULE: external "lodash/uniq"
165
+ const w = require("lodash/uniq");
166
+ var S = n.n(w);
167
+ // CONCATENATED MODULE: external "lodash/without"
168
+ const C = require("lodash/without");
169
+ var k = n.n(C);
170
+ // CONCATENATED MODULE: external "@splunk/react-ui/Dropdown"
171
+ const x = require("@splunk/react-ui/Dropdown");
172
+ var j = n.n(x);
173
+ // CONCATENATED MODULE: external "@splunk/react-ui/Link"
174
+ const E = require("@splunk/react-ui/Link");
175
+ var P = n.n(E);
176
+ // CONCATENATED MODULE: external "@splunk/react-ui/Menu"
177
+ const A = require("@splunk/react-ui/Menu");
178
+ // CONCATENATED MODULE: external "@splunk/react-ui/ResultsMenu"
179
+ const T = require("@splunk/react-ui/ResultsMenu");
180
+ var I = n.n(T);
181
+ // CONCATENATED MODULE: external "@splunk/react-ui/Text"
182
+ const _ = require("@splunk/react-ui/Text");
183
+ var M = n.n(_);
184
+ // CONCATENATED MODULE: external "@splunk/react-ui/usePrevious"
185
+ const R = require("@splunk/react-ui/usePrevious");
186
+ var L = n.n(R);
187
+ // CONCATENATED MODULE: external "@splunk/ui-utils/filter"
188
+ const V = require("@splunk/ui-utils/filter");
189
+ // CONCATENATED MODULE: external "@splunk/ui-utils/id"
190
+ const q = require("@splunk/ui-utils/id");
191
+ // CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
192
+ const B = require("@splunk/ui-utils/keyboard");
193
+ // CONCATENATED MODULE: external "@splunk/react-icons/CaretSmallDown"
194
+ const D = require("@splunk/react-icons/CaretSmallDown");
195
+ var N = n.n(D);
196
+ // CONCATENATED MODULE: external "@splunk/react-icons/enterprise/Caret"
197
+ const K = require("@splunk/react-icons/enterprise/Caret");
198
+ var F = n.n(K);
199
+ // CONCATENATED MODULE: external "@splunk/themes"
200
+ const H = require("@splunk/themes");
201
+ // CONCATENATED MODULE: ./src/Select/icons/CaretSmallDown.tsx
202
+ var z = function e() {
203
+ var n = (0, H.useSplunkTheme)(), r = n.isEnterprise;
204
+ var o = r ? t().createElement(F(), {
205
+ screenReaderText: null,
206
+ hideDefaultTooltip: true,
207
+ size: .5
208
+ }) : t().createElement(N(), null);
209
+ return o;
210
+ };
211
+ /* harmony default export */ const $ = z;
212
+ // CONCATENATED MODULE: external "@splunk/react-icons/enterprise/Search"
213
+ const W = require("@splunk/react-icons/enterprise/Search");
214
+ var U = n.n(W);
215
+ // CONCATENATED MODULE: external "@splunk/react-icons/Magnifier"
216
+ const J = require("@splunk/react-icons/Magnifier");
217
+ var X = n.n(J);
218
+ // CONCATENATED MODULE: ./src/Select/icons/Search.tsx
219
+ var G = function e() {
220
+ var n = (0, H.useSplunkTheme)(), r = n.isEnterprise, o = n.isCompact;
221
+ var l = (0, u._)("Search");
222
+ var a = o ? "20px" : "24px";
223
+ var i = r ? t().createElement(U(), {
224
+ role: "presentation",
225
+ size: "16px",
226
+ screenReaderText: l,
227
+ hideDefaultTooltip: true
228
+ }) : t().createElement(X(), {
229
+ role: "presentation",
230
+ "aria-label": l,
231
+ width: a,
232
+ height: a
233
+ });
234
+ return i;
235
+ };
236
+ /* harmony default export */ const Q = G;
237
+ // CONCATENATED MODULE: ./src/Select/OptionBase.tsx
238
+ function Y(e) {
239
+ "@babel/helpers - typeof";
240
+ return Y = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
241
+ return typeof e;
242
+ } : function(e) {
243
+ return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
244
+ }, Y(e);
188
245
  }
189
- return ne(e);
190
- }
191
- function re() {
192
- re = Object.assign || function(e) {
193
- for (var t = 1; t < arguments.length; t++) {
194
- var n = arguments[t];
195
- for (var r in n) {
196
- if (Object.prototype.hasOwnProperty.call(n, r)) {
197
- e[r] = n[r];
246
+ function Z() {
247
+ return Z = Object.assign ? Object.assign.bind() : function(e) {
248
+ for (var t = 1; t < arguments.length; t++) {
249
+ var n = arguments[t];
250
+ for (var r in n) {
251
+ ({}).hasOwnProperty.call(n, r) && (e[r] = n[r]);
198
252
  }
199
253
  }
254
+ return e;
255
+ }, Z.apply(null, arguments);
256
+ }
257
+ function ee(e, t) {
258
+ if (null == e) return {};
259
+ var n, r, o = te(e, t);
260
+ if (Object.getOwnPropertySymbols) {
261
+ var l = Object.getOwnPropertySymbols(e);
262
+ for (r = 0; r < l.length; r++) {
263
+ n = l[r], t.includes(n) || {}.propertyIsEnumerable.call(e, n) && (o[n] = e[n]);
264
+ }
200
265
  }
201
- return e;
202
- };
203
- return re.apply(this, arguments);
204
- }
205
- function oe(e, t) {
206
- if (e == null) return {};
207
- var n = ie(e, t);
208
- var r, o;
209
- if (Object.getOwnPropertySymbols) {
210
- var i = Object.getOwnPropertySymbols(e);
211
- for (o = 0; o < i.length; o++) {
212
- r = i[o];
213
- if (t.indexOf(r) >= 0) continue;
214
- if (!Object.prototype.propertyIsEnumerable.call(e, r)) continue;
215
- n[r] = e[r];
266
+ return o;
267
+ }
268
+ function te(e, t) {
269
+ if (null == e) return {};
270
+ var n = {};
271
+ for (var r in e) {
272
+ if ({}.hasOwnProperty.call(e, r)) {
273
+ if (t.includes(r)) continue;
274
+ n[r] = e[r];
275
+ }
216
276
  }
277
+ return n;
217
278
  }
218
- return n;
219
- }
220
- function ie(e, t) {
221
- if (e == null) return {};
222
- var n = {};
223
- var r = Object.keys(e);
224
- var o, i;
225
- for (i = 0; i < r.length; i++) {
226
- o = r[i];
227
- if (t.indexOf(o) >= 0) continue;
228
- n[o] = e[o];
229
- }
230
- return n;
231
- }
232
- function ae(e, t) {
233
- if (!(e instanceof t)) {
234
- throw new TypeError("Cannot call a class as a function");
235
- }
236
- }
237
- function le(e, t) {
238
- for (var n = 0; n < t.length; n++) {
239
- var r = t[n];
240
- r.enumerable = r.enumerable || false;
241
- r.configurable = true;
242
- if ("value" in r) r.writable = true;
243
- Object.defineProperty(e, r.key, r);
244
- }
245
- }
246
- function ce(e, t, n) {
247
- if (t) le(e.prototype, t);
248
- if (n) le(e, n);
249
- return e;
250
- }
251
- function se(e, t) {
252
- if (typeof t !== "function" && t !== null) {
253
- throw new TypeError("Super expression must either be null or a function");
254
- }
255
- e.prototype = Object.create(t && t.prototype, {
256
- constructor: {
257
- value: e,
258
- writable: true,
259
- configurable: true
279
+ function ne(e, t) {
280
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
281
+ }
282
+ function re(e, t) {
283
+ for (var n = 0; n < t.length; n++) {
284
+ var r = t[n];
285
+ r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
286
+ Object.defineProperty(e, de(r.key), r);
260
287
  }
261
- });
262
- if (t) ue(e, t);
263
- }
264
- function ue(e, t) {
265
- ue = Object.setPrototypeOf || function e(t, n) {
266
- t.__proto__ = n;
267
- return t;
268
- };
269
- return ue(e, t);
270
- }
271
- function pe(e) {
272
- var t = ve();
273
- return function n() {
274
- var r = he(e), o;
275
- if (t) {
276
- var i = he(this).constructor;
277
- o = Reflect.construct(r, arguments, i);
278
- } else {
279
- o = r.apply(this, arguments);
288
+ }
289
+ function oe(e, t, n) {
290
+ return t && re(e.prototype, t), n && re(e, n), Object.defineProperty(e, "prototype", {
291
+ writable: !1
292
+ }), e;
293
+ }
294
+ function le(e, t) {
295
+ if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
296
+ e.prototype = Object.create(t && t.prototype, {
297
+ constructor: {
298
+ value: e,
299
+ writable: !0,
300
+ configurable: !0
301
+ }
302
+ }), Object.defineProperty(e, "prototype", {
303
+ writable: !1
304
+ }), t && ae(e, t);
305
+ }
306
+ function ae(e, t) {
307
+ return ae = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
308
+ return e.__proto__ = t, e;
309
+ }, ae(e, t);
310
+ }
311
+ function ie(e) {
312
+ var t = se();
313
+ return function() {
314
+ var n, r = fe(e);
315
+ if (t) {
316
+ var o = fe(this).constructor;
317
+ n = Reflect.construct(r, arguments, o);
318
+ } else n = r.apply(this, arguments);
319
+ return ue(this, n);
320
+ };
321
+ }
322
+ function ue(e, t) {
323
+ if (t && ("object" == Y(t) || "function" == typeof t)) return t;
324
+ if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
325
+ return ce(e);
326
+ }
327
+ function ce(e) {
328
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
329
+ return e;
330
+ }
331
+ function se() {
332
+ try {
333
+ var e = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
334
+ } catch (e) {}
335
+ return (se = function t() {
336
+ return !!e;
337
+ })();
338
+ }
339
+ function fe(e) {
340
+ return fe = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
341
+ return e.__proto__ || Object.getPrototypeOf(e);
342
+ }, fe(e);
343
+ }
344
+ function pe(e, t, n) {
345
+ return (t = de(t)) in e ? Object.defineProperty(e, t, {
346
+ value: n,
347
+ enumerable: !0,
348
+ configurable: !0,
349
+ writable: !0
350
+ }) : e[t] = n, e;
351
+ }
352
+ function de(e) {
353
+ var t = ve(e, "string");
354
+ return "symbol" == Y(t) ? t : t + "";
355
+ }
356
+ function ve(e, t) {
357
+ if ("object" != Y(e) || !e) return e;
358
+ var n = e[Symbol.toPrimitive];
359
+ if (void 0 !== n) {
360
+ var r = n.call(e, t || "default");
361
+ if ("object" != Y(r)) return r;
362
+ throw new TypeError("@@toPrimitive must return a primitive value.");
280
363
  }
281
- return fe(this, o);
364
+ return ("string" === t ? String : Number)(e);
365
+ }
366
+ var be = {
367
+ /** @private */
368
+ active: l().bool,
369
+ children: l().node,
370
+ description: l().string,
371
+ descriptionPosition: l().oneOf([ "right", "bottom" ]),
372
+ disabled: l().bool,
373
+ hidden: l().bool,
374
+ icon: l().node,
375
+ label: l().string.isRequired,
376
+ /**
377
+ * @private Passed down from <BaseSelect>
378
+ */
379
+ multiple: l().bool,
380
+ matchRanges: l().arrayOf(l().shape({
381
+ start: l().number.isRequired,
382
+ end: l().number.isRequired
383
+ })),
384
+ /** @private */
385
+ onClick: l().func,
386
+ /** @private */
387
+ role: l().oneOf([ "menuitemcheckbox", "option" ]),
388
+ /** @private */
389
+ selected: l().oneOfType([ l().bool, l().oneOf([ "some" ]) ]),
390
+ truncate: l().bool,
391
+ value: l().oneOfType([ l().string, l().number, l().bool ]).isRequired
282
392
  };
283
- }
284
- function fe(e, t) {
285
- if (t && (ne(t) === "object" || typeof t === "function")) {
286
- return t;
287
- }
288
- return de(e);
289
- }
290
- function de(e) {
291
- if (e === void 0) {
292
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
293
- }
294
- return e;
295
- }
296
- function ve() {
297
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
298
- if (Reflect.construct.sham) return false;
299
- if (typeof Proxy === "function") return true;
300
- try {
301
- Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
302
- return true;
303
- } catch (e) {
304
- return false;
305
- }
306
- }
307
- function he(e) {
308
- he = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
309
- return t.__proto__ || Object.getPrototypeOf(t);
393
+ var me = {
394
+ descriptionPosition: "bottom",
395
+ disabled: false,
396
+ multiple: false,
397
+ role: "option",
398
+ selected: false,
399
+ truncate: false
310
400
  };
311
- return he(e);
312
- }
313
- function be(e, t, n) {
314
- if (t in e) {
315
- Object.defineProperty(e, t, {
316
- value: n,
317
- enumerable: true,
318
- configurable: true,
319
- writable: true
320
- });
321
- } else {
322
- e[t] = n;
323
- }
324
- return e;
325
- }
326
- var me = {
327
- /** @private */
328
- active: i().bool,
329
- children: i().node,
330
- description: i().string,
331
- descriptionPosition: i().oneOf([ "right", "bottom" ]),
332
- disabled: i().bool,
333
- hidden: i().bool,
334
- icon: i().node,
335
- label: i().string.isRequired,
336
401
  /**
337
- * @private Passed down from <BaseSelect>
338
- */
339
- multiple: i().bool,
340
- matchRanges: i().arrayOf(i().shape({
341
- start: i().number.isRequired,
342
- end: i().number.isRequired
343
- })),
344
- /** @private */
345
- onClick: i().func,
346
- /** @private */
347
- selected: i().bool,
348
- truncate: i().bool,
349
- value: i().oneOfType([ i().string, i().number, i().bool ]).isRequired
350
- };
351
- var ye = {
352
- descriptionPosition: "bottom",
353
- disabled: false,
354
- multiple: false,
355
- selected: false,
356
- truncate: false
357
- };
358
- /**
359
402
  * An option within a `Multiselect`. This inherits from
360
403
  * [PureComponent](https://reactjs.org/docs/react-api.html#reactpurecomponent)
361
404
  * so any elements passed to it must also be pure.
362
- */ var ge = function(e) {
363
- se(n, e);
364
- var t = pe(n);
365
- function n() {
366
- var e;
367
- ae(this, n);
368
- for (var r = arguments.length, o = new Array(r), i = 0; i < r; i++) {
369
- o[i] = arguments[i];
370
- }
371
- e = t.call.apply(t, [ this ].concat(o));
372
- be(de(e), "c", null);
373
- be(de(e), "handleClick", (function(t) {
374
- var n = e.props, r = n.onClick, o = n.value, i = n.disabled;
375
- if (!i) {
376
- r === null || r === void 0 ? void 0 : r(t, {
377
- value: o
378
- });
405
+ */ var ye = function(e) {
406
+ le(r, e);
407
+ var n = ie(r);
408
+ function r() {
409
+ var e;
410
+ ne(this, r);
411
+ for (var t = arguments.length, o = new Array(t), l = 0; l < t; l++) {
412
+ o[l] = arguments[l];
379
413
  }
380
- }));
381
- be(de(e), "handleMount", (function(t) {
382
- e.c = t;
383
- }));
384
- return e;
385
- }
386
- ce(n, [ {
387
- key: "scrollIntoViewIfNeeded",
388
- value: function e() {
389
- var t;
390
- (t = this.c) === null || t === void 0 ? void 0 : t.scrollIntoViewIfNeeded();
414
+ e = n.call.apply(n, [ this ].concat(o));
415
+ pe(ce(e), "c", null);
416
+ pe(ce(e), "handleClick", (function(t) {
417
+ var n = e.props, r = n.onClick, o = n.value, l = n.disabled;
418
+ if (!l) {
419
+ r === null || r === void 0 ? void 0 : r(t, {
420
+ value: o
421
+ });
422
+ }
423
+ }));
424
+ pe(ce(e), "handleMount", (function(t) {
425
+ e.c = t;
426
+ }));
427
+ return e;
391
428
  }
392
- /**
429
+ // @docs-props-type OptionPropsBase
430
+ oe(r, [ {
431
+ key: "scrollIntoViewIfNeeded",
432
+ // eslint-disable-next-line react/no-unused-class-component-methods
433
+ value: function e() {
434
+ var t;
435
+ (t = this.c) === null || t === void 0 ? void 0 : t.scrollIntoViewIfNeeded();
436
+ }
437
+ /**
393
438
  * Place focus on the button.
394
- */ }, {
395
- key: "focus",
396
- value: function e() {
397
- var t;
398
- (t = this.c) === null || t === void 0 ? void 0 : t.focus();
399
- }
400
- }, {
401
- key: "render",
402
- value: function e() {
403
- var t = this.props, n = t.value, o = t.children, i = t.label, a = t.multiple, l = oe(t, [ "value", "children", "label", "multiple" ]);
404
-
405
- return r().createElement(T.Item, re({
406
- "data-test-value": n,
407
- "data-test": "option",
408
- ref: this.handleMount
409
- }, l, {
410
- selectable: true,
411
- selectableAppearance: a ? "checkbox" : "checkmark",
412
- onClick: this.handleClick,
413
- role: "option",
414
- value: n.toString()
415
- }), o || i);
416
- }
417
- } ]);
418
- return n;
419
- }(n.PureComponent);
420
- be(ge, "propTypes", me);
421
- be(ge, "defaultProps", ye);
422
- be(ge, "type", T.Item);
423
- /* harmony default export */ const Oe = ge;
424
- // CONCATENATED MODULE: external "styled-components"
425
- const Se = require("styled-components");
426
- var we = e.n(Se);
427
- // CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
428
- const xe = require("@splunk/react-ui/Clickable");
429
- var Ce = e.n(xe);
430
- // CONCATENATED MODULE: external "@splunk/react-ui/Switch"
431
- const ke = require("@splunk/react-ui/Switch");
432
- var Ie = e.n(ke);
433
- // CONCATENATED MODULE: ./src/Menu/ItemStyles.ts
434
- var _e = (0, Se.css)([ "color:", ";font-size:", ";line-height:", ";overflow:inherit;white-space:inherit;text-overflow:inherit;" ], (0,
435
- U.pick)({
436
- prisma: U.variables.contentColorDefault,
437
- enterprise: U.variables.textGray
438
- }), U.variables.fontSizeSmall, (0, U.pick)({
439
- prisma: "16px"
440
- }));
441
- var Ae = we().span.withConfig({
442
- displayName: "ItemStyles__StyledItemDescriptionBottom",
443
- componentId: "sc-4kc053-0"
444
- })([ "", ";display:block;" ], _e);
445
- var je = we().span.withConfig({
446
- displayName: "ItemStyles__StyledItemDescriptionRight",
447
- componentId: "sc-4kc053-1"
448
- })([ "", ";float:right;", " max-width:50%;text-align:right;box-sizing:border-box;" ], _e, (0,
449
- U.pick)({
450
- enterprise: (0, Se.css)([ "padding-left:", ";" ], U.variables.spacingLarge)
451
- }));
452
- var Ee = we().div.withConfig({
453
- displayName: "ItemStyles__StyledItemSelectedIcon",
454
- componentId: "sc-4kc053-2"
455
- })([ "position:absolute;", " color:", ";" ], (0, U.pick)({
456
- prisma: (0, Se.css)([ "right:16px;" ]),
457
- enterprise: (0, Se.css)([ "right:3px;left:8px;" ])
458
- }), (0, U.pick)({
459
- prisma: U.variables.contentColorActive,
460
- enterprise: U.variables.accentColorL10
461
- }));
462
- var Me = we().span.withConfig({
463
- displayName: "ItemStyles__StyledItemIcon",
464
- componentId: "sc-4kc053-3"
465
- })([ "flex:0 0 auto;padding-right:", ";min-width:10px;display:inline-block;text-align:center;vertical-align:", ";", "" ], (0,
466
- U.pick)({
467
- prisma: "8px",
468
- enterprise: "3px"
469
- }), (0, U.pick)({
470
- prisma: "initial",
471
- enterprise: "middle"
472
- }), (0, U.pick)({
473
- prisma: (0, Se.css)([ "color:", ";display:inline-flex;align-items:center;min-width:20px;min-height:20px;& > svg{width:20px;height:20px;}" ], U.variables.contentColorMuted),
474
- enterprise: (0, Se.css)([ "transform:translateY(-1px);" ])
475
- }));
476
- var Te = we()(Ce()).withConfig({
477
- displayName: "ItemStyles__StyledClickable",
478
- componentId: "sc-4kc053-4"
479
- })([ "display:block;position:relative;cursor:pointer;color:", ";word-wrap:break-word;max-width:100%;width:100%;padding:", ";", " ", " ", " &:not([disabled],[aria-disabled='true']){&:hover{background:", ";", "}", " ", "}&:focus{outline:0;box-shadow:", ";", "}&[disabled],&[aria-disabled='true']{color:", ";cursor:not-allowed;", ",", "{color:inherit;}", "{cursor:not-allowed;color:", ";}", "}", "" ], (0,
480
- U.pick)({
481
- prisma: U.variables.contentColorActive,
482
- enterprise: {
483
- dark: U.variables.gray96,
484
- light: U.variables.gray22
485
- }
486
- }), (0, U.pick)({
487
- prisma: {
488
- comfortable: "10px 16px",
489
- compact: "6px 16px"
490
- },
491
- enterprise: "6px 10px"
492
- }), (function(e) {
493
- var t = e.$isSelectable, n = e.$selectableAppearance;
494
- return t && (0, U.pick)({
495
- prisma: (0, Se.css)([ "padding-right:44px;", "" ], (function() {
496
- return n === "checkbox" && "padding-left: 42px;";
497
- })),
498
- enterprise: (0, Se.css)([ "padding-right:10px;padding-left:", ";" ], (function() {
499
- return n === "checkbox" ? "32px" : "28px";
500
- }))
501
- });
502
- }), (function(e) {
503
- var t = e.$active, n = e.$preventFocus;
504
- return t && !n && (0, Se.css)([ "box-shadow:", ";" ], U.variables.focusShadowInset);
505
- }), (function(e) {
506
- var t = e.$active;
507
- return t && (0, Se.css)([ "background:", ";font-weight:", ";" ], (0, U.pick)({
439
+ */
440
+ // eslint-disable-next-line react/no-unused-class-component-methods
441
+ }, {
442
+ key: "focus",
443
+ value: function e() {
444
+ var t;
445
+ (t = this.c) === null || t === void 0 ? void 0 : t.focus();
446
+ }
447
+ }, {
448
+ key: "render",
449
+ value: function e() {
450
+ var n = this.props, r = n.value, o = n.children, l = n.label, a = n.multiple, i = n.role, u = n.icon, c = ee(n, [ "value", "children", "label", "multiple", "role", "icon" ]);
451
+ var s = r.toString();
452
+
453
+ return t().createElement(A.Item, Z({
454
+ "data-test-value": r,
455
+ "data-test": "option",
456
+ ref: this.handleMount
457
+ }, c, {
458
+ selectable: true,
459
+ selectableAppearance: a ? "checkbox" : "checkmark",
460
+ onClick: this.handleClick,
461
+ role: i,
462
+ value: s,
463
+ startAdornment: u
464
+ }), o || l);
465
+ }
466
+ } ]);
467
+ return r;
468
+ }(e.PureComponent);
469
+ pe(ye, "propTypes", be);
470
+ pe(ye, "defaultProps", me);
471
+ pe(ye, "type", A.Item);
472
+ /* harmony default export */ const he = ye;
473
+ // CONCATENATED MODULE: ./src/Select/SelectAllOption.tsx
474
+ var ge = {
475
+ active: l().bool,
476
+ changedToggle: l().bool,
477
+ elementRef: l().oneOfType([ l().func, l().object ]),
478
+ id: l().string,
479
+ onClick: l().func,
480
+ selectAllLabel: l().string,
481
+ selected: l().oneOf([ false, true, "some" ]),
482
+ totalCount: l().number
483
+ };
484
+ var Oe = t().forwardRef((function(e, n) {
485
+ var r = e.active, o = e.id, l = e.onClick, a = e.selectAllLabel, i = e.totalCount, u = e.changedToggle, c = e.selected;
486
+ // When toggle is changed the total count is not displayed anymore so the count is now shown in the Select all menu item
487
+ var s = u ? " (".concat(i === null || i === void 0 ? void 0 : i.toString(), ")") : "";
488
+
489
+ return t().createElement(he, {
490
+ active: r,
491
+ "aria-keyshortcuts": "Control+A",
492
+ "data-test": "select-all",
493
+ description: "".concat(s, " Ctrl-a"),
494
+ descriptionPosition: "right",
495
+ id: o,
496
+ key: "selectAll",
497
+ label: a,
498
+ multiple: true,
499
+ onClick: l,
500
+ ref: n,
501
+ role: "menuitemcheckbox",
502
+ selected: c,
503
+ tabIndex: -1,
504
+ value: "selectAll"
505
+ });
506
+ }));
507
+ Oe.propTypes = ge;
508
+ /* harmony default export */ const we = Oe;
509
+ // CONCATENATED MODULE: external "styled-components"
510
+ const Se = require("styled-components");
511
+ var Ce = n.n(Se);
512
+ // CONCATENATED MODULE: external "@splunk/react-ui/Button"
513
+ const ke = require("@splunk/react-ui/Button");
514
+ var xe = n.n(ke);
515
+ // CONCATENATED MODULE: ./src/Select/SelectBaseStyles.ts
516
+ var je = Ce()(xe()).withConfig({
517
+ displayName: "SelectBaseStyles__StyledButton",
518
+ componentId: "sc-16cj7sk-0"
519
+ })([ "&[data-inline]{width:", ";}", "" ], (function(e) {
520
+ var t = e.$multiple;
521
+ return t ? "400px" : "auto";
522
+ }), (function(e) {
523
+ var t = e.$multiple;
524
+ return !t && "flex-grow: 0;";
525
+ }));
526
+ var Ee = Ce().span.withConfig({
527
+ displayName: "SelectBaseStyles__StyledLinkIcon",
528
+ componentId: "sc-16cj7sk-1"
529
+ })([ "padding-right:2px;" ]);
530
+ var Pe = Ce().span.withConfig({
531
+ displayName: "SelectBaseStyles__StyledLinkCaret",
532
+ componentId: "sc-16cj7sk-2"
533
+ })([ "padding-left:2px;" ]);
534
+ var Ae = Ce().div.withConfig({
535
+ displayName: "SelectBaseStyles__StyledFilter",
536
+ componentId: "sc-16cj7sk-3"
537
+ })([ "padding:", ";min-width:160px;" ], (0, H.pick)({
538
+ enterprise: "8px",
539
+ prisma: "10px 16px"
540
+ }));
541
+ var Te = Ce().span.withConfig({
542
+ displayName: "SelectBaseStyles__StyledSearchIconWrapper",
543
+ componentId: "sc-16cj7sk-4"
544
+ })([ "color:", ";pointer-events:none;padding:", ";" ], (0, H.pick)({
508
545
  enterprise: {
509
- light: U.variables.gray92,
510
- dark: U.variables.gray22
546
+ light: H.variables.gray60,
547
+ dark: H.variables.white
511
548
  },
512
- prisma: U.variables.neutral100
513
- }), U.variables.fontWeightBold);
514
- }), (0, U.pick)({
515
- prisma: U.variables.interactiveColorOverlayHover,
516
- enterprise: U.variables.backgroundColorHover
517
- }), (function(e) {
518
- var t = e.$selected;
519
- return t && (0, U.pick)({
520
- prisma: (0, Se.css)([ "background:", ";" ], U.mixins.overlayColors(U.variables.interactiveColorOverlaySelected, U.variables.interactiveColorOverlayHover))
521
- });
522
- }), (0, U.pick)({
523
- prisma: (0, Se.css)([ "&:active{background:", ";}" ], U.variables.interactiveColorOverlayActive)
524
- }), (function(e) {
525
- var t = e.$selected;
526
- return t && (0, U.pick)({
527
- prisma: (0, Se.css)([ "background:", ";&:active{background:", ";}" ], U.variables.interactiveColorOverlaySelected, U.mixins.overlayColors(U.variables.interactiveColorOverlaySelected, U.variables.interactiveColorOverlayActive))
528
- });
529
- }), U.variables.focusShadowInset, (0, U.pick)({
530
- prisma: (0, Se.css)([ "background:", ";" ], U.variables.interactiveColorOverlayHover)
531
- }), (0, U.pick)({
532
- enterprise: {
533
- light: U.variables.gray45,
534
- dark: U.variables.contentColorDisabled
535
- },
536
- prisma: U.variables.contentColorDisabled
537
- }),
538
- /* sc-sel */
539
- Ae,
540
- /* sc-sel */
541
- je,
542
- /* sc-sel */
543
- Ee, (0, U.pick)({
544
- prisma: U.variables.contentColorDisabled,
545
- enterprise: U.variables.gray80
546
- }), (0, U.pick)({
547
- prisma: (0, Se.css)([ "& > * > ", "{color:", ";}" ],
548
- /* sc-sel */
549
- Me, U.variables.contentColorDisabled)
550
- }), (function(e) {
551
- var t = e.$selected;
552
- return t && (0, U.pick)({
553
- prisma: (0, Se.css)([ "", "{color:", ";}" ],
554
- /* sc-sel */
555
- Me, U.variables.contentColorActive)
556
- });
557
- }));
558
- var Pe = we()(Ie()).withConfig({
559
- displayName: "ItemStyles__StyledSwitch",
560
- componentId: "sc-4kc053-5"
561
- })([ "position:absolute;left:", ";top:", ";" ], (0, U.pick)({
562
- prisma: "16px",
563
- enterprise: "8px"
564
- }), (0, U.pick)({
565
- prisma: "0px",
566
- enterprise: {
567
- comfortable: "-1px",
568
- compact: "2px"
569
- }
570
- }));
571
- var Ve = we().span.withConfig({
572
- displayName: "ItemStyles__StyledInnerWrapper",
573
- componentId: "sc-4kc053-6"
574
- })([ "display:flex;align-items:flex-start;" ]);
575
- var Re = we().span.withConfig({
576
- displayName: "ItemStyles__StyledTitleAndDescriptionWrapper",
577
- componentId: "sc-4kc053-7"
578
- })([ "display:flex;flex-wrap:wrap;flex-direction:column;max-width:100%;width:100%;align-self:center;word-break:break-word;white-space:normal;", "" ], (function(e) {
579
- var t = e.$truncate;
580
- return t && (0, Se.css)([ "white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" ]);
581
- }));
582
- var De = we().div.withConfig({
583
- displayName: "ItemStyles__StyledLabel",
584
- componentId: "sc-4kc053-8"
585
- })([ "overflow:inherit;white-space:inherit;text-overflow:inherit;max-width:100%;min-height:20px;", "" ], (function(e) {
586
- var t = e.$truncate;
587
- return t && (0, Se.css)([ "display:block;clear:both;" ]);
588
- }));
589
- var Le = we().span.withConfig({
590
- displayName: "ItemStyles__StyledMatch",
591
- componentId: "sc-4kc053-9"
592
- })([ "border-bottom:1px solid ", ";" ], (0, U.pick)({
593
- prisma: U.variables.contentColorActive,
594
- enterprise: {
595
- dark: U.variables.gray96,
596
- light: U.variables.gray45
597
- }
598
- }));
599
- var qe = we().span.withConfig({
600
- displayName: "ItemStyles__StyledSubmenu",
601
- componentId: "sc-4kc053-10"
602
- })([ "float:right;padding-left:", ";color:", ";", "" ], U.variables.spacingSmall, (0,
603
- U.pick)({
604
- prisma: "inherit",
605
- enterprise: U.variables.textGray
606
- }), (0, U.pick)({
607
- prisma: (0, Se.css)([ "& > svg{width:20px;height:20px;}" ])
608
- }));
609
- // CONCATENATED MODULE: ./src/Select/SelectAllOptionStyles.ts
610
- var Ne = we()(De).withConfig({
611
- displayName: "SelectAllOptionStyles__StyledSelectAllLabel",
612
- componentId: "y6bn08-0"
613
- })([ "font-weight:", ";" ], U.variables.fontWeightBold);
614
- var Be = we()(Oe).withConfig({
615
- displayName: "SelectAllOptionStyles__StyledSelectAllOption",
616
- componentId: "y6bn08-1"
617
- })([ "padding-inline-start:", ";box-shadow:none;" ], (0, U.pick)({
618
- prisma: "42px;",
619
- enterprise: "32px;"
620
- }));
621
- // CONCATENATED MODULE: ./src/Select/SelectAllOption.tsx
622
- var Ke = {
623
- active: i().bool,
624
- elementRef: i().oneOfType([ i().func, i().object ]),
625
- id: i().string,
626
- onClick: i().func,
627
- selectAllLabel: i().string,
628
- totalCount: i().number,
629
- changedToggle: i().bool,
630
- selected: i().oneOf([ false, true, "some" ])
631
- };
632
- var Fe = r().forwardRef((function(e, t) {
633
- var n = e.active, o = e.id, i = e.onClick, a = e.selectAllLabel, l = e.totalCount, s = e.changedToggle, u = e.selected;
634
- // When toggle is changed the total count is not displayed anymore so the count is now shown in the Select all menu item
635
- var p = s ? " (".concat(l === null || l === void 0 ? void 0 : l.toString(), ")") : "";
636
-
637
- return r().createElement(Be, {
638
- label: a,
639
- value: "selectAll",
640
- key: "selectAll",
641
- onClick: i,
642
- "data-test": "select-all",
643
- "aria-keyshortcuts": "Control+A",
644
- id: o,
645
- active: n,
646
- ref: t,
647
- tabIndex: -1
648
- }, r().createElement(Pe, {
649
- interactive: false,
650
- selected: u === "some" && "some" || u,
651
- key: "main-checkbox",
652
- value: "main-checkbox",
653
- appearance: "checkbox",
654
- "aria-label": !u && (0, c._)("No options selected") || u === "some" && (0, c._)("Some options selected") || (0,
655
- c._)("All options selected"),
656
- "data-test": "select-all-switch",
657
- selectedLabel: u === true ? (0, c._)("All options selected") : (0, c._)("Option selected"),
658
- unselectedLabel: u === true ? (0, c._)("No options selected") : (0, c._)("Option unselected"),
659
- someSelectedLabel: (0, c._)("Some options selected")
660
- }), r().createElement(je, {
661
- "data-test": "description"
662
- }, "".concat(p, " Ctrl-a")), r().createElement(Ve, null, r().createElement(Re, {
663
- $truncate: false
664
- }, r().createElement(Ne, {
665
- $truncate: false
666
- }, a))));
667
- }));
668
- Fe.propTypes = Ke;
669
- /* harmony default export */ const He = Fe;
670
- // CONCATENATED MODULE: external "@splunk/react-ui/Button"
671
- const $e = require("@splunk/react-ui/Button");
672
- var ze = e.n($e);
673
- // CONCATENATED MODULE: ./src/Select/SelectBaseStyles.ts
674
- var We = we()(ze()).withConfig({
675
- displayName: "SelectBaseStyles__StyledButton",
676
- componentId: "sc-16cj7sk-0"
677
- })([ "&[data-inline]{width:", ";}", "" ], (function(e) {
678
- var t = e.$multiple;
679
- return t ? "400px" : "auto";
680
- }), (function(e) {
681
- var t = e.$multiple;
682
- return !t && "flex-grow: 0;";
683
- }));
684
- var Ue = we().span.withConfig({
685
- displayName: "SelectBaseStyles__StyledLinkIcon",
686
- componentId: "sc-16cj7sk-1"
687
- })([ "padding-right:2px;" ]);
688
- var Ge = we().span.withConfig({
689
- displayName: "SelectBaseStyles__StyledLinkCaret",
690
- componentId: "sc-16cj7sk-2"
691
- })([ "padding-left:2px;" ]);
692
- var Je = we().div.withConfig({
693
- displayName: "SelectBaseStyles__StyledFilter",
694
- componentId: "sc-16cj7sk-3"
695
- })([ "padding:", ";min-width:160px;" ], (0, U.pick)({
696
- enterprise: "8px",
697
- prisma: "10px 16px"
698
- }));
699
- var Xe = we().span.withConfig({
700
- displayName: "SelectBaseStyles__StyledSearchIconWrapper",
701
- componentId: "sc-16cj7sk-4"
702
- })([ "color:", ";pointer-events:none;padding:", ";" ], (0, U.pick)({
703
- enterprise: {
704
- light: U.variables.gray60,
705
- dark: U.variables.white
706
- },
707
- prisma: U.variables.contentColorMuted
708
- }), (0, U.pick)({
709
- comfortable: "0 8px",
710
- compact: "0 6px"
711
- }));
712
- var Ye = we().span.withConfig({
713
- displayName: "SelectBaseStyles__StyledCount",
714
- componentId: "sc-16cj7sk-5"
715
- })([ "padding-right:", ";" ], U.variables.spacingXSmall);
716
- var Qe = we()(q()).withConfig({
717
- displayName: "SelectBaseStyles__StyledControlsLink",
718
- componentId: "sc-16cj7sk-6"
719
- })([ "margin-right:20px;", ";" ], (function(e) {
720
- var t = e.$disabled;
721
- return t && (0, Se.css)([ "color:", ";" ], U.variables.contentColorDisabled);
722
- }));
723
- var Ze = we().div.withConfig({
724
- displayName: "SelectBaseStyles__StyledToggleAllControls",
725
- componentId: "sc-16cj7sk-7"
726
- })([ "padding:", ";", "" ], (0, U.pick)({
727
- enterprise: "5px 8px",
728
- prisma: "10px 16px"
729
- }), (0, U.pickVariant)("$placement", {
730
- above: {
731
- enterprise: (0, Se.css)([ "border-top:", ";" ], U.variables.border),
732
- prisma: (0, Se.css)([ "border-top:1px solid ", ";" ], U.variables.neutral200)
733
- },
734
- below: {
735
- enterprise: (0, Se.css)([ "border-bottom:", ";" ], U.variables.border),
736
- prisma: (0, Se.css)([ "border-bottom:1px solid ", ";" ], U.variables.neutral200)
737
- }
738
- }));
739
- // CONCATENATED MODULE: ./src/utils/fuzzyMatch.ts
740
- // A utility for matching keyboard characters to list values
741
- var et = function e(t, n) {
742
- return t ? t.label.charAt(n).toLowerCase() : "";
743
- };
744
- var tt = function e(t, n) {
745
- if (!t.length) {
746
- return t;
747
- }
748
- var r = null;
749
- var o = false;
750
- var i = t.filter((function(e) {
751
- var t = et(e, n.index);
752
- if (t === n.value) {
753
- o = true;
754
- return true;
549
+ prisma: H.variables.contentColorMuted
550
+ }), (0, H.pick)({
551
+ comfortable: "0 8px",
552
+ compact: "0 6px"
553
+ }));
554
+ var Ie = Ce().span.withConfig({
555
+ displayName: "SelectBaseStyles__StyledCount",
556
+ componentId: "sc-16cj7sk-5"
557
+ })([ "padding-right:", ";" ], H.variables.spacingXSmall);
558
+ var _e = Ce()(P()).withConfig({
559
+ displayName: "SelectBaseStyles__StyledControlsLink",
560
+ componentId: "sc-16cj7sk-6"
561
+ })([ "margin-right:20px;", ";" ], (function(e) {
562
+ var t = e.$disabled;
563
+ return t && (0, Se.css)([ "color:", ";" ], H.variables.contentColorDisabled);
564
+ }));
565
+ var Me = Ce().div.withConfig({
566
+ displayName: "SelectBaseStyles__StyledToggleAllControls",
567
+ componentId: "sc-16cj7sk-7"
568
+ })([ "padding:", ";", "" ], (0, H.pick)({
569
+ enterprise: "5px 8px",
570
+ prisma: "10px 16px"
571
+ }), (0, H.pickVariant)("$placement", {
572
+ above: {
573
+ enterprise: (0, Se.css)([ "border-top:", ";" ], H.variables.border),
574
+ prisma: (0, Se.css)([ "border-top:1px solid ", ";" ], H.variables.neutral200)
575
+ },
576
+ below: {
577
+ enterprise: (0, Se.css)([ "border-bottom:", ";" ], H.variables.border),
578
+ prisma: (0, Se.css)([ "border-bottom:1px solid ", ";" ], H.variables.neutral200)
579
+ }
580
+ }));
581
+ // EXTERNAL MODULE: ./src/useControlled/index.ts + 1 modules
582
+ var Re = n(2907);
583
+ // CONCATENATED MODULE: ./src/utils/fuzzyMatch.ts
584
+ // A utility for matching keyboard characters to list values
585
+ var Le = function e(t, n) {
586
+ return t ? t.label.charAt(n).toLowerCase() : "";
587
+ };
588
+ var Ve = function e(t, n) {
589
+ if (!t.length) {
590
+ return t;
755
591
  }
756
- // If we haven't found a match yet, keep track of the next closest match.
757
- // Secondary matching looks for the closest character of a higher value, and failing that, closest of a lower value.
758
- if (!o) {
759
- var i = et(r, n.index);
760
- if (!i) {
761
- r = e;
762
- } else if (t > n.value) {
763
- if (i < n.value) {
592
+ var r = null;
593
+ var o = false;
594
+ var l = t.filter((function(e) {
595
+ var t = Le(e, n.index);
596
+ if (t === n.value) {
597
+ o = true;
598
+ return true;
599
+ }
600
+ // If we haven't found a match yet, keep track of the next closest match.
601
+ // Secondary matching looks for the closest character of a higher value, and failing that, closest of a lower value.
602
+ if (!o) {
603
+ var l = Le(r, n.index);
604
+ if (!l) {
764
605
  r = e;
765
- } else if (i > t) {
606
+ } else if (t > n.value) {
607
+ if (l < n.value) {
608
+ r = e;
609
+ } else if (l > t) {
610
+ r = e;
611
+ }
612
+ } else if (t > l) {
766
613
  r = e;
767
614
  }
768
- } else if (t > i) {
769
- r = e;
770
615
  }
771
- }
772
- return false;
773
- }));
774
- return i.length === 0 && r ? [ r ] : i;
775
- };
776
- // CONCATENATED MODULE: ./src/utils/ssrDocument.ts
777
- /* eslint-disable @typescript-eslint/no-empty-function */
778
- var nt = {
779
- body: {
780
- appendChild: function e() {
616
+ return false;
617
+ }));
618
+ return l.length === 0 && r ? [ r ] : l;
619
+ };
620
+ // CONCATENATED MODULE: ./src/utils/ssrDocument.ts
621
+ /* eslint-disable @typescript-eslint/no-empty-function */
622
+ var qe = {
623
+ body: {
624
+ appendChild: function e() {
625
+ return [];
626
+ }
627
+ },
628
+ addEventListener: function e() {},
629
+ removeEventListener: function e() {},
630
+ activeElement: {
631
+ blur: function e() {},
632
+ nodeName: ""
633
+ },
634
+ querySelector: function e() {
635
+ return null;
636
+ },
637
+ querySelectorAll: function e() {
781
638
  return [];
639
+ },
640
+ getElementById: function e() {
641
+ return null;
642
+ },
643
+ createEvent: function e() {
644
+ return {
645
+ initEvent: function e() {}
646
+ };
647
+ },
648
+ createElement: function e() {
649
+ return {
650
+ children: [],
651
+ childNodes: [],
652
+ style: {},
653
+ setAttribute: function e() {},
654
+ getElementsByTagName: function e() {
655
+ return [];
656
+ }
657
+ };
658
+ },
659
+ createElementNS: function e() {
660
+ return {};
661
+ },
662
+ importNode: function e() {
663
+ return null;
664
+ },
665
+ location: {
666
+ hash: "",
667
+ host: "",
668
+ hostname: "",
669
+ href: "",
670
+ origin: "",
671
+ pathname: "",
672
+ protocol: "",
673
+ search: ""
782
674
  }
783
- },
784
- addEventListener: function e() {},
785
- removeEventListener: function e() {},
786
- activeElement: {
787
- blur: function e() {},
788
- nodeName: ""
789
- },
790
- querySelector: function e() {
791
- return null;
792
- },
793
- querySelectorAll: function e() {
794
- return [];
795
- },
796
- getElementById: function e() {
797
- return null;
798
- },
799
- createEvent: function e() {
800
- return {
801
- initEvent: function e() {}
802
- };
803
- },
804
- createElement: function e() {
805
- return {
806
- children: [],
807
- childNodes: [],
808
- style: {},
809
- setAttribute: function e() {},
810
- getElementsByTagName: function e() {
811
- return [];
675
+ };
676
+ function Be() {
677
+ var e = typeof document !== "undefined" ? document : qe;
678
+ return e;
679
+ }
680
+ // CONCATENATED MODULE: ./src/utils/ssrWindow.ts
681
+ /* eslint-disable @typescript-eslint/no-empty-function */
682
+ var De = {
683
+ document: qe,
684
+ navigator: {
685
+ userAgent: ""
686
+ },
687
+ location: {
688
+ hash: "",
689
+ host: "",
690
+ hostname: "",
691
+ href: "",
692
+ origin: "",
693
+ pathname: "",
694
+ protocol: "",
695
+ search: ""
696
+ },
697
+ history: {
698
+ replaceState: function e() {},
699
+ pushState: function e() {},
700
+ go: function e() {},
701
+ back: function e() {}
702
+ },
703
+ CustomEvent: function e() {
704
+ return this;
705
+ },
706
+ addEventListener: function e() {},
707
+ removeEventListener: function e() {},
708
+ getComputedStyle: function e() {
709
+ return {
710
+ getPropertyValue: function e() {
711
+ return "";
712
+ }
713
+ };
714
+ },
715
+ Image: function e() {},
716
+ Date: function e() {},
717
+ screen: {},
718
+ setTimeout: function e() {},
719
+ clearTimeout: function e() {},
720
+ matchMedia: function e() {
721
+ return {};
722
+ },
723
+ requestAnimationFrame: function e(t) {
724
+ if (typeof setTimeout === "undefined") {
725
+ t();
726
+ return null;
812
727
  }
813
- };
814
- },
815
- createElementNS: function e() {
816
- return {};
817
- },
818
- importNode: function e() {
819
- return null;
820
- },
821
- location: {
822
- hash: "",
823
- host: "",
824
- hostname: "",
825
- href: "",
826
- origin: "",
827
- pathname: "",
828
- protocol: "",
829
- search: ""
728
+ return setTimeout(t, 0);
729
+ },
730
+ cancelAnimationFrame: function e(t) {
731
+ if (typeof setTimeout === "undefined") {
732
+ return;
733
+ }
734
+ clearTimeout(t);
735
+ }
736
+ };
737
+ function Ne() {
738
+ var e = typeof window !== "undefined" ? window : De;
739
+ return e;
830
740
  }
831
- };
832
- function rt() {
833
- var e = typeof document !== "undefined" ? document : nt;
834
- return e;
835
- }
836
- // CONCATENATED MODULE: ./src/utils/ssrWindow.ts
837
- /* eslint-disable @typescript-eslint/no-empty-function */
838
- var ot = {
839
- document: nt,
840
- navigator: {
841
- userAgent: ""
842
- },
843
- location: {
844
- hash: "",
845
- host: "",
846
- hostname: "",
847
- href: "",
848
- origin: "",
849
- pathname: "",
850
- protocol: "",
851
- search: ""
852
- },
853
- history: {
854
- replaceState: function e() {},
855
- pushState: function e() {},
856
- go: function e() {},
857
- back: function e() {}
858
- },
859
- CustomEvent: function e() {
860
- return this;
861
- },
862
- addEventListener: function e() {},
863
- removeEventListener: function e() {},
864
- getComputedStyle: function e() {
865
- return {
866
- getPropertyValue: function e() {
867
- return "";
741
+ // CONCATENATED MODULE: ./src/Select/SelectBase.tsx
742
+ function Ke(e) {
743
+ return ze(e) || He(e) || Je(e) || Fe();
744
+ }
745
+ function Fe() {
746
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
747
+ }
748
+ function He(e) {
749
+ if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) return Array.from(e);
750
+ }
751
+ function ze(e) {
752
+ if (Array.isArray(e)) return Xe(e);
753
+ }
754
+ function $e() {
755
+ return $e = Object.assign ? Object.assign.bind() : function(e) {
756
+ for (var t = 1; t < arguments.length; t++) {
757
+ var n = arguments[t];
758
+ for (var r in n) {
759
+ ({}).hasOwnProperty.call(n, r) && (e[r] = n[r]);
760
+ }
868
761
  }
869
- };
870
- },
871
- Image: function e() {},
872
- Date: function e() {},
873
- screen: {},
874
- setTimeout: function e() {},
875
- clearTimeout: function e() {},
876
- matchMedia: function e() {
877
- return {};
878
- },
879
- requestAnimationFrame: function e(t) {
880
- if (typeof setTimeout === "undefined") {
881
- t();
882
- return null;
762
+ return e;
763
+ }, $e.apply(null, arguments);
764
+ }
765
+ function We(e, t) {
766
+ return Qe(e) || Ge(e, t) || Je(e, t) || Ue();
767
+ }
768
+ function Ue() {
769
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
770
+ }
771
+ function Je(e, t) {
772
+ if (e) {
773
+ if ("string" == typeof e) return Xe(e, t);
774
+ var n = {}.toString.call(e).slice(8, -1);
775
+ return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? Xe(e, t) : void 0;
883
776
  }
884
- return setTimeout(t, 0);
885
- },
886
- cancelAnimationFrame: function e(t) {
887
- if (typeof setTimeout === "undefined") {
888
- return;
777
+ }
778
+ function Xe(e, t) {
779
+ (null == t || t > e.length) && (t = e.length);
780
+ for (var n = 0, r = Array(t); n < t; n++) {
781
+ r[n] = e[n];
889
782
  }
890
- clearTimeout(t);
783
+ return r;
891
784
  }
892
- };
893
- function it() {
894
- var e = typeof window !== "undefined" ? window : ot;
895
- return e;
896
- }
897
- // CONCATENATED MODULE: ./src/Select/SelectBase.tsx
898
- function at() {
899
- at = Object.assign || function(e) {
900
- for (var t = 1; t < arguments.length; t++) {
901
- var n = arguments[t];
902
- for (var r in n) {
903
- if (Object.prototype.hasOwnProperty.call(n, r)) {
904
- e[r] = n[r];
785
+ function Ge(e, t) {
786
+ var n = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
787
+ if (null != n) {
788
+ var r, o, l, a, i = [], u = !0, c = !1;
789
+ try {
790
+ if (l = (n = n.call(e)).next, 0 === t) {
791
+ if (Object(n) !== n) return;
792
+ u = !1;
793
+ } else for (;!(u = (r = l.call(n)).done) && (i.push(r.value), i.length !== t); u = !0) {
794
+ }
795
+ } catch (e) {
796
+ c = !0, o = e;
797
+ } finally {
798
+ try {
799
+ if (!u && null != n["return"] && (a = n["return"](), Object(a) !== a)) return;
800
+ } finally {
801
+ if (c) throw o;
905
802
  }
906
803
  }
804
+ return i;
907
805
  }
908
- return e;
909
- };
910
- return at.apply(this, arguments);
911
- }
912
- function lt(e, t) {
913
- return ut(e) || st(e, t) || dt(e, t) || ct();
914
- }
915
- function ct() {
916
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
917
- }
918
- function st(e, t) {
919
- if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(e))) return;
920
- var n = [];
921
- var r = true;
922
- var o = false;
923
- var i = undefined;
924
- try {
925
- for (var a = e[Symbol.iterator](), l; !(r = (l = a.next()).done); r = true) {
926
- n.push(l.value);
927
- if (t && n.length === t) break;
928
- }
929
- } catch (e) {
930
- o = true;
931
- i = e;
932
- } finally {
933
- try {
934
- if (!r && a["return"] != null) a["return"]();
935
- } finally {
936
- if (o) throw i;
806
+ }
807
+ function Qe(e) {
808
+ if (Array.isArray(e)) return e;
809
+ }
810
+ function Ye(e, t) {
811
+ if (null == e) return {};
812
+ var n, r, o = Ze(e, t);
813
+ if (Object.getOwnPropertySymbols) {
814
+ var l = Object.getOwnPropertySymbols(e);
815
+ for (r = 0; r < l.length; r++) {
816
+ n = l[r], t.includes(n) || {}.propertyIsEnumerable.call(e, n) && (o[n] = e[n]);
817
+ }
937
818
  }
819
+ return o;
938
820
  }
939
- return n;
940
- }
941
- function ut(e) {
942
- if (Array.isArray(e)) return e;
943
- }
944
- function pt(e) {
945
- return ht(e) || vt(e) || dt(e) || ft();
946
- }
947
- function ft() {
948
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
949
- }
950
- function dt(e, t) {
951
- if (!e) return;
952
- if (typeof e === "string") return bt(e, t);
953
- var n = Object.prototype.toString.call(e).slice(8, -1);
954
- if (n === "Object" && e.constructor) n = e.constructor.name;
955
- if (n === "Map" || n === "Set") return Array.from(e);
956
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return bt(e, t);
957
- }
958
- function vt(e) {
959
- if (typeof Symbol !== "undefined" && Symbol.iterator in Object(e)) return Array.from(e);
960
- }
961
- function ht(e) {
962
- if (Array.isArray(e)) return bt(e);
963
- }
964
- function bt(e, t) {
965
- if (t == null || t > e.length) t = e.length;
966
- for (var n = 0, r = new Array(t); n < t; n++) {
967
- r[n] = e[n];
968
- }
969
- return r;
970
- }
971
- function mt(e, t) {
972
- if (!(e instanceof t)) {
973
- throw new TypeError("Cannot call a class as a function");
974
- }
975
- }
976
- function yt(e, t) {
977
- for (var n = 0; n < t.length; n++) {
978
- var r = t[n];
979
- r.enumerable = r.enumerable || false;
980
- r.configurable = true;
981
- if ("value" in r) r.writable = true;
982
- Object.defineProperty(e, r.key, r);
983
- }
984
- }
985
- function gt(e, t, n) {
986
- if (t) yt(e.prototype, t);
987
- if (n) yt(e, n);
988
- return e;
989
- }
990
- function Ot(e, t) {
991
- if (typeof t !== "function" && t !== null) {
992
- throw new TypeError("Super expression must either be null or a function");
993
- }
994
- e.prototype = Object.create(t && t.prototype, {
995
- constructor: {
996
- value: e,
997
- writable: true,
998
- configurable: true
821
+ function Ze(e, t) {
822
+ if (null == e) return {};
823
+ var n = {};
824
+ for (var r in e) {
825
+ if ({}.hasOwnProperty.call(e, r)) {
826
+ if (t.includes(r)) continue;
827
+ n[r] = e[r];
828
+ }
999
829
  }
1000
- });
1001
- if (t) St(e, t);
1002
- }
1003
- function St(e, t) {
1004
- St = Object.setPrototypeOf || function e(t, n) {
1005
- t.__proto__ = n;
1006
- return t;
1007
- };
1008
- return St(e, t);
1009
- }
1010
- function wt(e) {
1011
- var t = kt();
1012
- return function n() {
1013
- var r = It(e), o;
1014
- if (t) {
1015
- var i = It(this).constructor;
1016
- o = Reflect.construct(r, arguments, i);
1017
- } else {
1018
- o = r.apply(this, arguments);
830
+ return n;
831
+ }
832
+ function et(e) {
833
+ "@babel/helpers - typeof";
834
+ return et = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
835
+ return typeof e;
836
+ } : function(e) {
837
+ return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
838
+ }, et(e);
839
+ }
840
+ function tt(e, t) {
841
+ var n = Object.keys(e);
842
+ if (Object.getOwnPropertySymbols) {
843
+ var r = Object.getOwnPropertySymbols(e);
844
+ t && (r = r.filter((function(t) {
845
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
846
+ }))), n.push.apply(n, r);
1019
847
  }
1020
- return xt(this, o);
1021
- };
1022
- }
1023
- function xt(e, t) {
1024
- if (t && (_t(t) === "object" || typeof t === "function")) {
1025
- return t;
1026
- }
1027
- return Ct(e);
1028
- }
1029
- function Ct(e) {
1030
- if (e === void 0) {
1031
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1032
- }
1033
- return e;
1034
- }
1035
- function kt() {
1036
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
1037
- if (Reflect.construct.sham) return false;
1038
- if (typeof Proxy === "function") return true;
1039
- try {
1040
- Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
1041
- return true;
1042
- } catch (e) {
1043
- return false;
1044
- }
1045
- }
1046
- function It(e) {
1047
- It = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
1048
- return t.__proto__ || Object.getPrototypeOf(t);
1049
- };
1050
- return It(e);
1051
- }
1052
- function _t(e) {
1053
- "@babel/helpers - typeof";
1054
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
1055
- _t = function e(t) {
1056
- return typeof t;
1057
- };
1058
- } else {
1059
- _t = function e(t) {
1060
- return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
1061
- };
848
+ return n;
1062
849
  }
1063
- return _t(e);
1064
- }
1065
- function At(e, t) {
1066
- var n = Object.keys(e);
1067
- if (Object.getOwnPropertySymbols) {
1068
- var r = Object.getOwnPropertySymbols(e);
1069
- if (t) r = r.filter((function(t) {
1070
- return Object.getOwnPropertyDescriptor(e, t).enumerable;
1071
- }));
1072
- n.push.apply(n, r);
1073
- }
1074
- return n;
1075
- }
1076
- function jt(e) {
1077
- for (var t = 1; t < arguments.length; t++) {
1078
- var n = arguments[t] != null ? arguments[t] : {};
1079
- if (t % 2) {
1080
- At(Object(n), true).forEach((function(t) {
1081
- Et(e, t, n[t]);
1082
- }));
1083
- } else if (Object.getOwnPropertyDescriptors) {
1084
- Object.defineProperties(e, Object.getOwnPropertyDescriptors(n));
1085
- } else {
1086
- At(Object(n)).forEach((function(t) {
850
+ function nt(e) {
851
+ for (var t = 1; t < arguments.length; t++) {
852
+ var n = null != arguments[t] ? arguments[t] : {};
853
+ t % 2 ? tt(Object(n), !0).forEach((function(t) {
854
+ rt(e, t, n[t]);
855
+ })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : tt(Object(n)).forEach((function(t) {
1087
856
  Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
1088
857
  }));
1089
858
  }
859
+ return e;
1090
860
  }
1091
- return e;
1092
- }
1093
- function Et(e, t, n) {
1094
- if (t in e) {
1095
- Object.defineProperty(e, t, {
861
+ function rt(e, t, n) {
862
+ return (t = ot(t)) in e ? Object.defineProperty(e, t, {
1096
863
  value: n,
1097
- enumerable: true,
1098
- configurable: true,
1099
- writable: true
1100
- });
1101
- } else {
1102
- e[t] = n;
1103
- }
1104
- return e;
1105
- }
1106
- var Mt = {
1107
- allowKeyMatching: i().bool,
1108
- allowNewValues: i().bool,
1109
- animateLoading: i().bool,
1110
- appearance: i().oneOf([ "default", "link", "primary", "pill", "toggle", "flat", "subtle" ]),
1111
- append: i().bool,
1112
- children: i().node,
1113
- defaultPlacement: i().oneOf([ "above", "below", "vertical" ]),
1114
- defaultValues: i().array,
1115
- describedBy: i().string,
1116
- disabled: i().bool,
1117
- elementRef: i().oneOfType([ i().func, i().object ]),
1118
- error: i().bool,
1119
- filter: i().oneOf([ false, true, "controlled" ]),
1120
- footerMessage: i().node,
1121
- inline: i().bool,
1122
- inputId: i().string,
1123
- inputRef: i().oneOfType([ i().func, i().object ]),
1124
- isLoadingOptions: i().bool,
1125
- labelledBy: i().string,
1126
- labelText: i().string,
1127
- loadingMessage: i().node,
1128
- menuStyle: i().object,
1129
- multiple: i().bool,
1130
- name: i().string,
1131
- noOptionsMessage: i().node,
1132
- onChange: i().func,
1133
- onClose: i().func,
1134
- onFilterChange: i().func,
1135
- onOpen: i().func,
1136
- onScroll: i().func,
1137
- onScrollBottom: i().func,
1138
- /** @private. */
1139
- required: i().bool,
1140
- placeholder: i().string,
1141
- prefixLabel: i().string,
1142
- prepend: i().bool,
1143
- repositionMode: i().oneOf([ "none", "flip" ]),
1144
- selectAllAppearance: i().oneOf([ "buttongroup", "checkbox" ]),
1145
- showSelectedValuesFirst: i().oneOf([ "nextOpen", "immediately", "never" ]),
1146
- suffixLabel: i().string,
1147
- tabConfirmsNewValue: i().bool,
1148
- toggleContent: i().oneOf([ "optionChildren", "optionLabel" ]),
1149
- values: i().array,
1150
- /** @private. */
1151
- virtualization: i().number
1152
- };
1153
- var Tt = {
1154
- allowKeyMatching: true,
1155
- allowNewValues: false,
1156
- animateLoading: false,
1157
- appearance: "toggle",
1158
- append: false,
1159
- defaultPlacement: "vertical",
1160
- disabled: false,
1161
- filter: false,
1162
- inline: false,
1163
- isLoadingOptions: false,
1164
- menuStyle: {},
1165
- multiple: false,
1166
- noOptionsMessage: (0, c._)("No matches"),
1167
- placeholder: (0, c._)("Select..."),
1168
- prepend: false,
1169
- repositionMode: "flip",
1170
- selectAllAppearance: "buttongroup",
1171
- tabConfirmsNewValue: false,
1172
- toggleContent: "optionChildren"
1173
- };
1174
- var Pt = w()((function(e) {
1175
- return [ e ];
1176
- }));
1177
- // preserve separate widths for single vs. multi mode
1178
- var Vt = w()((function(e) {
1179
- var t = e.anchorWidth, n = e.isMultiple, r = e.maxHeight, o = e.menuStyle;
1180
- return n ? jt({
1181
- width: Math.max(t !== null && t !== void 0 ? t : 0, 200),
1182
- maxHeight: r
1183
- }, o) : jt({
1184
- minWidth: t !== null && t !== void 0 ? t : undefined,
1185
- maxWidth: Math.max(t !== null && t !== void 0 ? t : 0, 300),
1186
- maxHeight: r
1187
- }, o);
1188
- }));
1189
- var Rt = [ "clickAway", "escapeKey", "offScreen", "tabKey", "toggleClick" ];
1190
- function Dt(e) {
1191
- return e && l()(e.props, "value");
1192
- }
1193
- function Lt(e, t) {
1194
- return "".concat(_t(e), "-").concat(e, "-").concat(t);
1195
- }
1196
- var qt = function(e) {
1197
- Ot(o, e);
1198
- var t = wt(o);
1199
- gt(o, null, [ {
1200
- key: "validateAppearance",
1201
- // @docs-props-type CompactPropsBase
1202
- value: function e(t) {
1203
- if (false) {}
864
+ enumerable: !0,
865
+ configurable: !0,
866
+ writable: !0
867
+ }) : e[t] = n, e;
868
+ }
869
+ function ot(e) {
870
+ var t = lt(e, "string");
871
+ return "symbol" == et(t) ? t : t + "";
872
+ }
873
+ function lt(e, t) {
874
+ if ("object" != et(e) || !e) return e;
875
+ var n = e[Symbol.toPrimitive];
876
+ if (void 0 !== n) {
877
+ var r = n.call(e, t || "default");
878
+ if ("object" != et(r)) return r;
879
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1204
880
  }
1205
- } ]);
1206
- function o(e) {
1207
- var i;
1208
- mt(this, o);
1209
- i = t.call(this, e);
1210
- Et(Ct(i), "activeItemId", void 0);
1211
- Et(Ct(i), "activeValue", void 0);
1212
- Et(Ct(i), "availableOptionCount", void 0);
1213
- Et(Ct(i), "controlledExternally", void 0);
1214
- Et(Ct(i), "displayedValues", void 0);
1215
- Et(Ct(i), "dropdown", null);
1216
- Et(Ct(i), "firstSelectedEnabledOption", null);
1217
- Et(Ct(i), "firstSelectedOptionIndex", void 0);
1218
- Et(Ct(i), "menuListboxId", void 0);
1219
- Et(Ct(i), "previousActiveIndex", null);
1220
- Et(Ct(i), "selectedOptionCount", void 0);
1221
- Et(Ct(i), "optionRefsByKey", void 0);
1222
- Et(Ct(i), "matchCharacter", void 0);
1223
- Et(Ct(i), "matchTimeout", void 0);
1224
- Et(Ct(i), "currentMatchOptions", void 0);
1225
- Et(Ct(i), "availableMatchOptions", void 0);
1226
- Et(Ct(i), "optionSelection", void 0);
1227
- Et(Ct(i), "resetMatches", (function() {
1228
- i.matchCharacter = null;
1229
- i.currentMatchOptions = [];
1230
- if (i.matchTimeout) {
1231
- clearTimeout(i.matchTimeout);
881
+ return ("string" === t ? String : Number)(e);
882
+ }
883
+ var at = {
884
+ allowKeyMatching: l().bool,
885
+ allowNewValues: l().bool,
886
+ animateLoading: l().bool,
887
+ appearance: l().oneOf([ "default", "link", "primary", "pill", "toggle", "flat", "subtle" ]),
888
+ append: l().bool,
889
+ children: l().node,
890
+ defaultPlacement: l().oneOf([ "above", "below", "vertical" ]),
891
+ defaultValues: l().array,
892
+ describedBy: l().string,
893
+ disabled: l().bool,
894
+ elementRef: l().oneOfType([ l().func, l().object ]),
895
+ error: l().bool,
896
+ filter: l().oneOf([ false, true, "controlled" ]),
897
+ footerMessage: l().node,
898
+ inline: l().bool,
899
+ inputId: l().string,
900
+ inputRef: l().oneOfType([ l().func, l().object ]),
901
+ isLoadingOptions: l().bool,
902
+ labelledBy: l().string,
903
+ labelText: l().string,
904
+ loadingMessage: l().node,
905
+ menuStyle: l().object,
906
+ multiple: l().bool,
907
+ name: l().string,
908
+ noOptionsMessage: l().node,
909
+ onChange: l().func,
910
+ onClick: l().func,
911
+ onClose: l().func,
912
+ onFilterChange: l().func,
913
+ onOpen: l().func,
914
+ onScroll: l().func,
915
+ onScrollBottom: l().func,
916
+ /** @private. */
917
+ required: l().bool,
918
+ placeholder: l().string,
919
+ prefixLabel: l().string,
920
+ prepend: l().bool,
921
+ repositionMode: l().oneOf([ "none", "flip" ]),
922
+ selectAllAppearance: l().oneOf([ "buttongroup", "checkbox" ]),
923
+ showSelectedValuesFirst: l().oneOf([ "nextOpen", "immediately", "never" ]),
924
+ suffixLabel: l().string,
925
+ tabConfirmsNewValue: l().bool,
926
+ toggle: l().node,
927
+ toggleContent: l().oneOf([ "optionChildren", "optionLabel" ]),
928
+ values: l().array,
929
+ /** @private. */
930
+ virtualization: l().number
931
+ };
932
+ var it = h()((function(e) {
933
+ return [ e ];
934
+ }));
935
+ // preserve separate widths for single vs. multi mode
936
+ var ut = h()((function(e) {
937
+ var t = e.anchorWidth, n = e.isMultiple, r = e.maxHeight, o = e.menuStyle;
938
+ return n ? nt({
939
+ width: Math.max(t !== null && t !== void 0 ? t : 0, 200),
940
+ maxHeight: r
941
+ }, o) : nt({
942
+ minWidth: t !== null && t !== void 0 ? t : undefined,
943
+ maxWidth: Math.max(t !== null && t !== void 0 ? t : 0, 300),
944
+ maxHeight: r
945
+ }, o);
946
+ }));
947
+ var ct = [ "clickAway", "escapeKey", "offScreen", "tabKey", "toggleClick" ];
948
+ function st(e) {
949
+ return e && i()(e.props, "value");
950
+ }
951
+ function ft(e, t) {
952
+ return "".concat(et(e), "-").concat(e, "-").concat(t);
953
+ }
954
+ var pt = [ "append", "error", "prepend" ];
955
+ var dt = (0, u._)("No matches");
956
+ var vt = (0, u._)("Select...");
957
+ var bt = function e(n) {
958
+ var r = n.activeItemId, o = n.filterKeyword, l = n.hasChildren, a = n.inputId, i = n.inputRef, c = n.menuListboxId, s = n.multiple, f = n.onClearAll, p = n.onSelectAll, d = n.onTextBlur, v = n.onTextChange, b = n.onTextFocus, m = n.onTextKeyDown, y = n.optionSelection, h = n.placement, g = n.selectAllAppearance, O = n.textHasFocus;
959
+ var w = (0, u._)("Select all options".concat(y.current === "all" ? " disabled" : ""));
960
+ var S = (0, u._)("Clear all options".concat(y.current === "none" ? " disabled" : ""));
961
+ // only visually disable these as opposed to fully disabling to avoid losing keyboard focus - see SUI-2731
962
+ var C = t().createElement(Me, {
963
+ $placement: h,
964
+ key: "selectAll"
965
+ }, t().createElement(_e, {
966
+ $disabled: y.current === "all",
967
+ "aria-label": w,
968
+ onClick: p,
969
+ "data-test": "select-all"
970
+ }, o ? (0, u._)("Select all Matches") : (0, u._)("Select all")), t().createElement(_e, {
971
+ $disabled: y.current === "none",
972
+ "aria-label": S,
973
+ onClick: f,
974
+ "data-test": "clear-all"
975
+ }, o ? (0, u._)("Clear all Matches") : (0, u._)("Clear all")));
976
+
977
+ return t().createElement("div", {
978
+ key: "controls"
979
+ }, t().createElement(Ae, {
980
+ key: "filter",
981
+ "data-test": "filter"
982
+ }, t().createElement(M(), {
983
+ value: o,
984
+ autoCapitalize: "off",
985
+ autoComplete: "off",
986
+ autoCorrect: "off",
987
+ spellCheck: false,
988
+ onChange: v,
989
+ onKeyDown: m,
990
+ onFocus: b,
991
+ onBlur: d,
992
+ placeholder: (0, u._)("filter"),
993
+ role: "combobox",
994
+ "aria-expanded": "true",
995
+ "aria-controls": c,
996
+ "aria-owns": l ? r : undefined,
997
+ "aria-label": (0, u._)("Filter"),
998
+ "aria-autocomplete": "list",
999
+ "aria-activedescendant": O && l ? r : undefined,
1000
+ inputRef: i,
1001
+ inputId: a,
1002
+ canClear: true,
1003
+ startAdornment: t().createElement(Te, null, t().createElement(Q, null))
1004
+ })), s && l && g === "buttongroup" && C);
1005
+ };
1006
+ var mt = false;
1007
+ var yt = function n(r) {
1008
+ var o = r.activeIndex, l = r.activeItemId, a = r.allowKeyMatching, i = r.allowNewValues, c = r.availableMatchOptions, s = r.availableOptionCount, f = r.children, d = r.currentValues, b = r.filter, m = r.filterKeyword, y = r.firstSelectedOptionIndex, h = r.isLoadingOptions, g = r.multiple, O = r.newTopValues, w = r.onActiveOptionMount, S = r.onClearAll, C = r.onClick, k = r.onKeyDown, x = r.onOptionMount, j = r.onScrollBottom, E = r.onSelectAll, P = r.optionSelection, T = r.selectAllAppearance, I = r.selectedOptionCount, _ = r.setActiveValue, M = r.setAvailableMatchOptions, R = r.setAvailableOptionCount, L = r.setDisplayedValues, q = r.setFirstSelectedOptionIndex, B = r.setOptionSelection, D = r.setSelectedOptionCount, N = r.textHasFocus, K = r.toggle;
1009
+ R(0);
1010
+ q(undefined);
1011
+ D(0);
1012
+ _(undefined);
1013
+ M([]);
1014
+ var F;
1015
+ var H = 0;
1016
+ var z = false;
1017
+ // used to avoid overwriting the selected item ref in multiple mode
1018
+ var $;
1019
+ var W = e.Children.toArray(f).reduce((function(n, r, o) {
1020
+ // ignore Headings and Dividers
1021
+ if (!st(r)) {
1022
+ n.push(r);
1023
+ return n;
1232
1024
  }
1233
- }));
1234
- Et(Ct(i), "handleSelectAll", (function(e) {
1235
- var t, n, o;
1236
- var a = i.props, l = a.name, c = a.children, s = a.multiple;
1237
- // this doesn't make sense if we can't select multiple values
1238
- if (!s) {
1239
- return;
1025
+ var l = r.props, i = l.disabled, u = l.hidden, s = l.label, f = l.value;
1026
+ // Find out if the search string exactly matches a value
1027
+ if (f === m) {
1028
+ F = true;
1240
1029
  }
1241
- var u = (t = i.getCurrentValues()) !== null && t !== void 0 ? t : [];
1242
- var p = A()(u.concat(i.displayedValues));
1243
- p = r().Children.toArray(c).filter((function(e) {
1244
- return Dt(e) && b()(p, e.props.value) && (!e.props.disabled || b()(u, e.props.value));
1245
- })).map((function(e) {
1246
- return e.props.value;
1247
- }));
1248
- if (!i.isControlled()) {
1249
- i.setState({
1250
- values: p
1030
+ var p = d && d.indexOf(f) >= 0;
1031
+ var v = !!p && !i && !$;
1032
+ var y = a && !g && !b && !h && !j;
1033
+ var w = ft(f, s);
1034
+ var S = -1;
1035
+ if (y && !i && !u) {
1036
+ c.current.push({
1037
+ label: s,
1038
+ value: f
1251
1039
  });
1040
+ S = c.current.length - 1;
1252
1041
  }
1253
- (n = (o = i.props).onChange) === null || n === void 0 ? void 0 : n.call(o, e, {
1254
- values: p,
1255
- name: l,
1256
- reason: "selectAll"
1042
+ // Format the Menu.Item
1043
+ var E = (0, e.cloneElement)(r, {
1044
+ key: r.key || o,
1045
+ onClick: C,
1046
+ onKeyDown: y ? function(e) {
1047
+ return k(e, S);
1048
+ } : undefined,
1049
+ selected: p,
1050
+ multiple: g,
1051
+ role: "option",
1052
+ ref: function e(t) {
1053
+ return x(t, w, v);
1054
+ }
1257
1055
  });
1258
- }));
1259
- Et(Ct(i), "handleClearAll", (function(e) {
1260
- var t, n, o;
1261
- var a = i.props, l = a.name, c = a.children, s = a.multiple;
1262
- // this doesn't make sense if we can't select multiple values
1263
- if (!s) {
1264
- return;
1056
+ if (v) {
1057
+ $ = true;
1265
1058
  }
1266
- var u = (t = i.getCurrentValues()) !== null && t !== void 0 ? t : [];
1267
- var p = E().apply(void 0, [ u ].concat(pt(i.displayedValues)));
1268
- // this will unselect all selected values unless those values are disabled or hidden by the filter
1269
- var f = r().Children.toArray(c).filter((function(e) {
1270
- return Dt(e) && (b()(u, e.props.value) && e.props.disabled || b()(p, e.props.value));
1271
- })).map((function(e) {
1272
- return e.props.value;
1059
+ if (O && O.indexOf(f) >= 0) {
1060
+ if (H === 0) {
1061
+ n.splice(H, 0, t().createElement(A.Divider, {
1062
+ key: "topDivider"
1063
+ }));
1064
+ z = true;
1065
+ }
1066
+ n.splice(H, 0, E);
1067
+ H += 1;
1068
+ } else {
1069
+ n.push(E);
1070
+ }
1071
+ return n;
1072
+ }), []);
1073
+ // In multiple mode, add missing items
1074
+ if (g) {
1075
+ v()(d, (function(e) {
1076
+ var n = p()(W, (function(t) {
1077
+ return st(t) && t.props && t.props.value === e;
1078
+ }));
1079
+ if (!n) {
1080
+ if (e === m) {
1081
+ F = true;
1082
+ }
1083
+ var r = O && O.indexOf(e) >= 0;
1084
+ var o = O.length;
1085
+ if (H === 0) {
1086
+ W.splice(0, 0, t().createElement(A.Divider, {
1087
+ key: "topDivider"
1088
+ }));
1089
+ H += 1;
1090
+ z = true;
1091
+ }
1092
+ W.splice(r ? 0 : o + 1, 0, t().createElement(he, {
1093
+ label: String(e),
1094
+ value: e,
1095
+ key: "missing-value-".concat(e),
1096
+ onClick: C,
1097
+ multiple: g,
1098
+ selected: true
1099
+ }));
1100
+ if (r) {
1101
+ H += 1;
1102
+ }
1103
+ }
1273
1104
  }));
1274
- if (!i.isControlled()) {
1275
- i.setState({
1276
- values: f
1277
- });
1105
+ }
1106
+ var U = b === "controlled";
1107
+ // Filter the items
1108
+ var J = (0, V.stringToKeywords)(m);
1109
+ W = U ? W : W.filter((function(e) {
1110
+ if (st(e)) {
1111
+ return (0, V.testPhrase)(e.props.label, J);
1278
1112
  }
1279
- (n = (o = i.props).onChange) === null || n === void 0 ? void 0 : n.call(o, e, {
1280
- values: f,
1281
- name: l,
1282
- reason: "clearAll"
1113
+ return true;
1114
+ // Keep all headers and non-interactive options
1115
+ })).map((function(t) {
1116
+ if (!st(t)) {
1117
+ return t;
1118
+ }
1119
+ // highlight matched text
1120
+ var n = J && (0, V.keywordLocations)(t.props.label, J);
1121
+
1122
+ return (0, e.cloneElement)(t, {
1123
+ matchRanges: n || undefined
1283
1124
  });
1284
1125
  }));
1285
- Et(Ct(i), "handleTextKeyDown", (function(e) {
1286
- var t = i.props, r = t.children, o = t.onScrollBottom, a = t.tabConfirmsNewValue;
1287
- var l = (0, R.keycode)(e.nativeEvent);
1288
- if (l === "tab") {
1289
- if (a && !y()(i.activeValue) && i.availableOptionCount <= 1) {
1290
- e.preventDefault();
1291
- i.toggleValue(e, i.activeValue);
1292
- }
1126
+ // Add the option to add the new value
1127
+ if (i && !F && m) {
1128
+ var X = z ? H + 1 : H;
1129
+ W.splice(X, 0, t().createElement(he, {
1130
+ label: "".concat(m, " (new value)"),
1131
+ value: m,
1132
+ key: "newValue",
1133
+ multiple: g,
1134
+ onClick: C
1135
+ }));
1136
+ }
1137
+ // When selectAll is a menu item, add an offset so that activeItem accounts for the extra selectAll option.
1138
+ var G = T === "checkbox" && g && W.length > 1 ? 1 : 0;
1139
+ var Q = true;
1140
+ // Highlight the selected Items and remove hidden
1141
+ W = W.reduce((function(t, n) {
1142
+ // ignore Dividers & Headings
1143
+ if (!st(n)) {
1144
+ t.push(n);
1145
+ return t;
1293
1146
  }
1294
- if (e.shiftKey || e.metaKey || e.ctrlKey) {
1295
- if (l === "a" && (e.ctrlKey || e.metaKey)) {
1296
- // handle control + A
1297
- if (i.optionSelection === "all") {
1298
- i.handleClearAll(e);
1299
- } else {
1300
- i.handleSelectAll(e);
1301
- }
1302
- }
1303
- return;
1147
+ // Ignore any hidden items
1148
+ if (n.props && n.props.hidden) {
1149
+ return t;
1304
1150
  }
1305
- if (l === "down") {
1306
- e.preventDefault();
1307
- i.setState((function(e) {
1308
- return {
1309
- activeIndex: Math.min(e.activeIndex + 1, i.props.selectAllAppearance === "checkbox" ? i.availableOptionCount : i.availableOptionCount - 1)
1310
- };
1311
- }));
1312
- if (r && o) {
1313
- var c;
1314
- var s = n.Children.toArray(r).length - (2 + ((c = i.getCurrentValues()) !== null && c !== void 0 ? c : []).length);
1315
- if (i.state.activeIndex === s) {
1316
- i.handleScrollBottom(e);
1317
- }
1318
- }
1151
+ if (n.props.selected && !n.props.disabled && y.current == null) {
1152
+ q(s.current);
1319
1153
  }
1320
- if (l === "up") {
1321
- e.preventDefault();
1322
- i.setState((function(e) {
1323
- return {
1324
- activeIndex: Math.max(e.activeIndex - 1, 0)
1325
- };
1326
- }));
1154
+ var r = G === o;
1155
+ G += 1;
1156
+ R(s.current + 1);
1157
+ D(I.current + (n.props.selected ? 1 : 0));
1158
+ if (n.key !== "newValue" && !n.props.disabled && !n.props.selected) {
1159
+ Q = false;
1327
1160
  }
1328
- if (l === "enter" && !y()(i.activeValue) && i.state.open) {
1329
- if (i.activeValue === "selectAll") {
1330
- if (i.optionSelection === "all") {
1331
- i.handleClearAll(e);
1332
- } else {
1333
- i.handleSelectAll(e);
1334
- }
1161
+ if (!r || !N) {
1162
+ t.push(n);
1163
+ return t;
1164
+ }
1165
+ if (!n.props.disabled) {
1166
+ _(n.props.value);
1167
+ }
1168
+ var a = (0, e.cloneElement)(n, {
1169
+ active: r,
1170
+ id: l,
1171
+ ref: w
1172
+ });
1173
+ t.push(a);
1174
+ return t;
1175
+ }), []);
1176
+ B(I.current === 0 && "none" || Q && "all" || "some");
1177
+ // add select all option
1178
+ if (T === "checkbox" && g && s.current > 0) {
1179
+ var Y;
1180
+ if (P.current === "all") {
1181
+ if (m === "") {
1182
+ Y = (0, u._)("Clear all");
1335
1183
  } else {
1336
- e.preventDefault();
1337
- i.toggleValue(e, i.activeValue);
1184
+ Y = (0, u._)("Clear all matches");
1338
1185
  }
1186
+ } else if (m === "") {
1187
+ Y = (0, u._)("Select all");
1188
+ } else {
1189
+ Y = (0, u._)("Select all matches");
1339
1190
  }
1340
- }));
1341
- Et(Ct(i), "handleMenuOptionClick", (function(e, t) {
1342
- var n = t.value;
1343
- e.preventDefault();
1344
- if (!i.state.open) {
1345
- return;
1191
+ if (o === 0 && N) {
1192
+ _("selectAll");
1346
1193
  }
1347
- i.toggleValue(e, n);
1194
+ W.unshift( t().createElement(we, {
1195
+ active: o === 0,
1196
+ changedToggle: !!K,
1197
+ id: o === 0 ? l : undefined,
1198
+ onClick: P.current === "all" ? S : E,
1199
+ selectAllLabel: Y,
1200
+ selected: P.current === "all" || P.current !== "none" && "some",
1201
+ totalCount: d.length,
1202
+ tabIndex: -1,
1203
+ ref: w
1204
+ }), t().createElement(A.Divider, {
1205
+ key: "selectAllDivider"
1206
+ }));
1207
+ }
1208
+ L(W.reduce((function(e, t) {
1209
+ if (st(t)) {
1210
+ e.push(t.props.value);
1211
+ }
1212
+ return e;
1213
+ }), []));
1214
+ mt = W.some((function(e) {
1215
+ return st(e);
1348
1216
  }));
1349
- Et(Ct(i), "handleMenuOptionKeyDown", (function(e, t) {
1350
- var n = e.nativeEvent.key;
1351
- // Checking for a single character to avoid complications from double-byte languages and emojis.
1352
- if (n.length === 1) {
1353
- var r = [];
1354
- var o = {
1355
- index: 0,
1356
- value: n
1357
- };
1358
- if (!i.matchCharacter) {
1359
- if (n === " ") {
1360
- i.resetMatches();
1361
- return;
1362
- }
1363
- r = tt(i.availableMatchOptions, o);
1364
- } else if (i.currentMatchOptions.length > 1) {
1365
- o.index = i.matchCharacter.index + 1;
1366
- r = tt(i.currentMatchOptions, o);
1367
- }
1368
- if (r.length) {
1369
- var a = 0;
1370
- // If the active option is a first character match, cycle to the next matching option.
1371
- if (o.index === 0 && r.length > 1) {
1372
- var l = r.indexOf(i.availableMatchOptions[t]);
1373
- if (l >= 0) {
1374
- a = l === r.length - 1 ? 0 : l + 1;
1375
- }
1376
- }
1377
- var c = r[a];
1378
- var s = i.optionRefsByKey[Lt(c.value, c.label)];
1379
- if (s != null) {
1380
- var u;
1381
- (u = s.focus) === null || u === void 0 ? void 0 : u.call(s);
1382
- }
1383
- }
1384
- i.currentMatchOptions = r;
1385
- i.matchCharacter = o;
1386
- if (i.matchTimeout) {
1387
- clearTimeout(i.matchTimeout);
1217
+ // eslint-disable-next-line react/jsx-no-useless-fragment
1218
+
1219
+ return t().createElement(t().Fragment, null, W);
1220
+ };
1221
+ var ht = function e(t) {
1222
+ var n = t.prefixLabel, r = t.label, o = t.suffixLabel;
1223
+ var l = r;
1224
+ if (n) {
1225
+ l = [ "".concat(n, ": ") ].concat(l);
1226
+ }
1227
+ if (o) {
1228
+ l = s()(l).concat(" ".concat(o));
1229
+ }
1230
+ return l;
1231
+ };
1232
+ function gt(n) {
1233
+ var r = n.appearance, o = n.append, l = n.children, a = n.currentValues, i = a === void 0 ? [] : a, c = n.describedBy, s = n.disabled, f = n.elementRef, d = n.error, v = n.inline, b = n.labelText, m = n.labelledBy, y = n.multiple, h = n.onClick, g = n.placeholder, w = n.prefixLabel, S = n.prepend, C = n.required, k = n.suffixLabel, x = n.toggle, j = n.toggleContent, E = Ye(n, [ "appearance", "append", "children", "currentValues", "describedBy", "disabled", "elementRef", "error", "inline", "labelText", "labelledBy", "multiple", "onClick", "placeholder", "prefixLabel", "prepend", "required", "suffixLabel", "toggle", "toggleContent" ]);
1234
+ var A;
1235
+ var T;
1236
+ var I = [];
1237
+ // Generate buttonLabels
1238
+ var _ = e.Children.toArray(l);
1239
+ var M = i.reduce((function(e, t, n, r) {
1240
+ var o = p()(_, (function(e) {
1241
+ return st(e) && e.props.value === t;
1242
+ }));
1243
+ if (o) {
1244
+ var l = o.props, a = l.children, c = l.icon, s = l.label;
1245
+ var f = j !== "optionLabel" && a ? a : s;
1246
+ e.push(f);
1247
+ I.push(s);
1248
+ // if not in multiple mode, add the icon
1249
+ if (!y && i.length === 1) {
1250
+ A = c;
1388
1251
  }
1389
- i.matchTimeout = setTimeout(i.resetMatches, 500);
1390
- e.preventDefault();
1391
- e.stopPropagation();
1252
+ } else if (y) {
1253
+ // only add values that don't match an option in "multiple" mode to preserve old behaviour
1254
+ e.push(t);
1255
+ I.push(t.toString());
1392
1256
  }
1393
- }));
1394
- Et(Ct(i), "handleTextChange", (function(e, t) {
1395
- var n, r;
1396
- var o = t.value;
1397
- i.setState({
1398
- filterKeyword: o,
1399
- open: true,
1400
- activeIndex: 0
1401
- });
1402
- (n = (r = i.props).onFilterChange) === null || n === void 0 ? void 0 : n.call(r, e, {
1403
- keyword: o
1404
- });
1405
- }));
1406
- Et(Ct(i), "handleTextFocus", (function() {
1407
- i.setState({
1408
- textHasFocus: true
1257
+ if (n < r.length - 1) {
1258
+ e.push((0, u._)(", "));
1259
+ I.push((0, u._)(", "));
1260
+ }
1261
+ return e;
1262
+ }), []);
1263
+ T = M;
1264
+ // only apply prefix / suffix if the label is not empty
1265
+ if (T.length > 0) {
1266
+ // If there's more than one item selected, read out the selected total
1267
+ // rather than reading out each selected item
1268
+ I = ht({
1269
+ prefixLabel: w,
1270
+ label: T.length > 1 ? [ "".concat(i.length, " items selected") ] : I,
1271
+ suffixLabel: k
1409
1272
  });
1410
- }));
1411
- Et(Ct(i), "handleTextBlur", (function() {
1412
- i.setState({
1413
- textHasFocus: false
1273
+ T = ht({
1274
+ prefixLabel: w,
1275
+ label: T,
1276
+ suffixLabel: k
1414
1277
  });
1415
- }));
1416
- Et(Ct(i), "handleRequestOpen", (function(e) {
1417
- var t = {
1418
- open: true,
1419
- topValues: i.getTopValues()
1278
+ }
1279
+ // single <Select> behaviour is to show the placeholder if all parts of the label
1280
+ // are empty strings so we replicate this behaviour here
1281
+ if (T.length === 0 || !y && T.every((function(e) {
1282
+ return e === "";
1283
+ }))) {
1284
+ T = it(g);
1285
+ I = T;
1286
+ }
1287
+ var R = nt({
1288
+ "aria-describedby": c,
1289
+ "aria-label": "".concat(b ? "".concat(b, ", ") : "").concat(I.join("")),
1290
+ "aria-labelledby": m,
1291
+ // aria-labelledby takes precedence over aria-label if exists
1292
+ "aria-required": C,
1293
+ "data-select-appearance": r,
1294
+ append: o,
1295
+ prepend: S,
1296
+ onClick: h,
1297
+ role: "combobox",
1298
+ disabled: s,
1299
+ elementRef: f,
1300
+ error: d
1301
+ }, E);
1302
+ if (y) {
1303
+ R["data-test-values"] = JSON.stringify(i);
1304
+ } else {
1305
+ var L = We(i, 1), V = L[0];
1306
+ R["data-test-value"] = V;
1307
+ }
1308
+ if (x) {
1309
+
1310
+ return (0, e.cloneElement)(x, R);
1311
+ }
1312
+ if (r === "link") {
1313
+
1314
+ return t().createElement(P(), $e({}, R, {
1315
+ "data-select-appearance": "link"
1316
+ }), !!A && t().createElement(Ee, null, A), T || g, t().createElement(Pe, null, t().createElement($, null)));
1317
+ }
1318
+
1319
+ return t().createElement(je, $e({}, R, {
1320
+ $multiple: y,
1321
+ appearance: r,
1322
+ label: T,
1323
+ error: d,
1324
+ icon: A,
1325
+ inline: v,
1326
+ isMenu: true,
1327
+ onClick: h
1328
+ }, O()(E, pt)), !!i.length && y && t().createElement(Ie, {
1329
+ "data-role": "count"
1330
+ }, "(", i.length, ")"));
1331
+ }
1332
+ gt[x.legacyRefMode] = true;
1333
+ function Ot(n) {
1334
+ var r;
1335
+ var o = n.allowKeyMatching, l = o === void 0 ? true : o, a = n.animateLoading, i = n.appearance, u = i === void 0 ? "toggle" : i, c = n.append, s = n.allowNewValues, f = n.children, d = n.defaultPlacement, v = d === void 0 ? "vertical" : d, b = n.defaultValues, y = n.describedBy, h = n.disabled, g = n.elementRef, O = n.error, w = n.filter, C = n.footerMessage, x = n.inline, E = n.inputId, P = n.inputRef, A = n.isLoadingOptions, _ = n.labelledBy, M = n.labelText, R = n.loadingMessage, V = n.menuStyle, D = V === void 0 ? {} : V, N = n.multiple, K = n.name, F = n.noOptionsMessage, H = F === void 0 ? dt : F, z = n.onChange, $ = n.onScroll, W = n.onScrollBottom, U = n.onFilterChange, J = n.onClick, X = n.onClose, G = n.onOpen, Q = n.required, Y = n.placeholder, Z = Y === void 0 ? vt : Y, ee = n.prefixLabel, te = n.prepend, ne = n.repositionMode, re = ne === void 0 ? "flip" : ne, oe = n.selectAllAppearance, le = oe === void 0 ? "buttongroup" : oe, ae = n.showSelectedValuesFirst, ie = n.suffixLabel, ue = n.tabConfirmsNewValue, ce = n.values, se = n.virtualization, fe = n.toggle, pe = n.toggleContent, de = pe === void 0 ? "optionChildren" : pe, ve = Ye(n, [ "allowKeyMatching", "animateLoading", "appearance", "append", "allowNewValues", "children", "defaultPlacement", "defaultValues", "describedBy", "disabled", "elementRef", "error", "filter", "footerMessage", "inline", "inputId", "inputRef", "isLoadingOptions", "labelledBy", "labelText", "loadingMessage", "menuStyle", "multiple", "name", "noOptionsMessage", "onChange", "onScroll", "onScrollBottom", "onFilterChange", "onClick", "onClose", "onOpen", "required", "placeholder", "prefixLabel", "prepend", "repositionMode", "selectAllAppearance", "showSelectedValuesFirst", "suffixLabel", "tabConfirmsNewValue", "values", "virtualization", "toggle", "toggleContent" ]);
1336
+ // @docs-props-type SelectBasePropsBase
1337
+ var be = (0, Re["default"])({
1338
+ value: ce,
1339
+ defaultValue: b,
1340
+ componentName: "SelectBase"
1341
+ });
1342
+ // states
1343
+ var me = (0, e.useState)((function() {
1344
+ return {
1345
+ activeItemId: (0, q.createDOMID)("active-item"),
1346
+ menuListboxId: (0, q.createDOMID)("menu-listbox")
1420
1347
  };
1421
- // SUI-3234: preserve existing behavior difference between <Select> and <Multiselect.Compact>
1422
- if (i.props.multiple) {
1423
- t.filterKeyword = "";
1424
- }
1425
- var n = i.state.filterKeyword;
1426
- i.setState(t, (function() {
1427
- var t, r;
1428
- (t = (r = i.props).onOpen) === null || t === void 0 ? void 0 : t.call(r);
1429
- if (i.firstSelectedEnabledOption && !i.hasFilter()) {
1430
- i.firstSelectedEnabledOption.focus();
1431
- } else {
1432
- var o;
1433
- i.setState({
1434
- activeIndex: (o = i.firstSelectedOptionIndex) !== null && o !== void 0 ? o : 0
1435
- });
1436
- }
1437
- if (n !== i.state.filterKeyword) {
1438
- var a, l;
1439
- (a = (l = i.props).onFilterChange) === null || a === void 0 ? void 0 : a.call(l, e, {
1440
- keyword: i.state.filterKeyword
1441
- });
1442
- }
1443
- }));
1444
- }));
1445
- Et(Ct(i), "handleRequestClose", (function() {
1446
- i.setState({
1447
- open: false,
1448
- activeIndex: 0
1449
- }, (function() {
1450
- var e, t;
1451
- i.previousActiveIndex = null;
1452
- (e = (t = i.props).onClose) === null || e === void 0 ? void 0 : e.call(t);
1453
- }));
1454
- }));
1455
- Et(Ct(i), "handleScrollBottom", (function(e) {
1456
- if (i.state.open && !i.props.isLoadingOptions) {
1457
- var t, n;
1458
- (t = (n = i.props).onScrollBottom) === null || t === void 0 ? void 0 : t.call(n, e);
1348
+ })), ye = We(me, 1), he = ye[0], ge = he.activeItemId, Oe = he.menuListboxId;
1349
+ var we = (0, e.useState)(0), Se = We(we, 2), Ce = Se[0], ke = Se[1];
1350
+ var xe = (0, e.useState)(""), je = We(xe, 2), Ee = je[0], Pe = je[1];
1351
+ var Ae = (0, e.useState)(false), Te = We(Ae, 2), Ie = Te[0], _e = Te[1];
1352
+ var Me = (0, e.useState)(false), Le = We(Me, 2), qe = Le[0], Be = Le[1];
1353
+ var De = (0, e.useState)([]), Fe = We(De, 2), He = Fe[0], ze = Fe[1];
1354
+ var Ue = (0, e.useState)(b || []), Je = We(Ue, 2), Xe = Je[0], Ge = Je[1];
1355
+ // previous state
1356
+ var Qe = L()(Ce);
1357
+ // refs
1358
+ var Ze = (0, e.useRef)(null);
1359
+ var et = (0, e.useRef)(null);
1360
+ var tt = (0, e.useRef)(null);
1361
+ var nt = (0, e.useRef)([]);
1362
+ var rt = (0, e.useRef)([]);
1363
+ var ot = (0, e.useRef)(Qe);
1364
+ var lt = (0, e.useRef)();
1365
+ var at = (0, e.useRef)({});
1366
+ var it = (0, e.useRef)(0);
1367
+ var pt = (0, e.useRef)([]);
1368
+ var ht = (0, e.useRef)(null);
1369
+ var Ot = (0, e.useRef)();
1370
+ var wt = (0, e.useRef)(0);
1371
+ var St = (0, e.useRef)("none");
1372
+ // setters for refs used in subcomponents
1373
+ var Ct = function e(t) {
1374
+ it.current = t;
1375
+ };
1376
+ var kt = function e(t) {
1377
+ Ot.current = t;
1378
+ };
1379
+ var xt = function e(t) {
1380
+ wt.current = t;
1381
+ };
1382
+ var jt = function e(t) {
1383
+ lt.current = t;
1384
+ };
1385
+ var Et = function e(t) {
1386
+ rt.current = t;
1387
+ };
1388
+ var Pt = function e(t) {
1389
+ St.current = t;
1390
+ };
1391
+ var At = function e(t) {
1392
+ pt.current = t;
1393
+ };
1394
+ (0, e.useEffect)((function() {
1395
+ if (false) {}
1396
+ }), [ u, c, O, te ]);
1397
+ var Tt = (0, e.useCallback)((function() {
1398
+ var e = be ? ce : Xe;
1399
+ return N || e == null ? e : e.slice(0, 1);
1400
+ }), [ be, N, ce, Xe ]);
1401
+ var It = (0, e.useCallback)((function() {
1402
+ var e;
1403
+ // in non-multiple mode, don't move values to the top of the list
1404
+ return N && ae !== "never" ? (e = Tt()) !== null && e !== void 0 ? e : [] : [];
1405
+ }), [ Tt, N, ae ]);
1406
+ var _t = (0, e.useCallback)((function(e) {
1407
+ var t = Ee;
1408
+ _e(true);
1409
+ ze(It());
1410
+ // SUI-3234: preserve existing behavior difference between <Select> and <Multiselect.Compact>
1411
+ if (N) {
1412
+ Pe("");
1459
1413
  }
1460
- }));
1461
- Et(Ct(i), "handleActiveOptionMount", (function(e) {
1462
- if (i.previousActiveIndex !== i.state.activeIndex) {
1463
- e === null || e === void 0 ? void 0 : e.scrollIntoViewIfNeeded();
1414
+ if (t !== Ee) {
1415
+ U === null || U === void 0 ? void 0 : U(e, {
1416
+ keyword: Ee
1417
+ });
1464
1418
  }
1465
- }));
1466
- Et(Ct(i), "handleOptionMount", (function(e, t, n) {
1467
- if (n) {
1468
- i.firstSelectedEnabledOption = e;
1419
+ }), [ Ee, It, N, U ]);
1420
+ (0, e.useEffect)((function() {
1421
+ if (Ie) {
1422
+ G === null || G === void 0 ? void 0 : G();
1423
+ if (ht.current && !w) {
1424
+ ht.current.focus();
1425
+ } else {
1426
+ var e;
1427
+ ke((e = Ot.current) !== null && e !== void 0 ? e : 0);
1428
+ }
1469
1429
  }
1470
- if (e == null) {
1471
- delete i.optionRefsByKey[t];
1430
+ }), [ G, Ie, He, Ee, w ]);
1431
+ var Mt = (0, e.useCallback)((function() {
1432
+ _e(false);
1433
+ ke(0);
1434
+ ot.current = null;
1435
+ X === null || X === void 0 ? void 0 : X();
1436
+ }), [ X ]);
1437
+ var Rt = (0, e.useCallback)((function(e, t) {
1438
+ var n;
1439
+ var r = (n = Tt()) !== null && n !== void 0 ? n : [];
1440
+ var o = r.indexOf(t);
1441
+ var l;
1442
+ if (N) {
1443
+ if (o >= 0) {
1444
+ l = [].concat(Ke(r.slice(0, o)), Ke(r.slice(o + 1)));
1445
+ } else {
1446
+ l = r.concat([ t ]);
1447
+ }
1472
1448
  } else {
1473
- i.optionRefsByKey[t] = e;
1449
+ // non-multiple mode must always have a value
1450
+ l = [ t ];
1474
1451
  }
1475
- }));
1476
- Et(Ct(i), "createToggle", (function() {
1477
- var e;
1478
- var t = i.props, a = t.toggle, l = t.appearance, s = t.children, u = t.describedBy, p = t.disabled, d = t.elementRef, v = t.error, h = t.inline, b = t.labelledBy, m = t.labelText, y = t.multiple, g = t.placeholder, S = t.prefixLabel, w = t.required, x = t.suffixLabel, k = t.toggleContent;
1479
- var _;
1480
- var A;
1481
- var j = [];
1482
- // Generate buttonLabels
1483
- var E = (e = i.getCurrentValues()) !== null && e !== void 0 ? e : [];
1484
- var M = n.Children.toArray(s);
1485
- var T = E.reduce((function(e, t, n, r) {
1486
- var o = f()(M, (function(e) {
1487
- return Dt(e) && e.props.value === t;
1488
- }));
1489
- if (o) {
1490
- var i = k !== "optionLabel" && o.props.children ? o.props.children : o.props.label;
1491
- e.push(i);
1492
- j.push(o.props.label);
1493
- // if not in multiple mode, add the icon
1494
- if (!y && E.length === 1) {
1495
- _ = o.props.icon;
1496
- }
1497
- } else if (y) {
1498
- // only add values that don't match an option in "multiple" mode to preserve old behaviour
1499
- e.push(t);
1500
- j.push(t.toString());
1501
- }
1502
- if (n < r.length - 1) {
1503
- e.push((0, c._)(", "));
1504
- j.push((0, c._)(", "));
1452
+ var a = !be;
1453
+ if (a) {
1454
+ Ge(l);
1455
+ }
1456
+ if (N) {
1457
+ // in uncontrolled multiple mode, keep the menu open
1458
+ if (a) {
1459
+ _e(true);
1505
1460
  }
1506
- return e;
1507
- }), []);
1508
- A = T;
1509
- // only apply prefix / suffix if the label is not empty
1510
- if (A.length > 0) {
1511
- // If there's more than one item selected, read out the selected total
1512
- // rather than reading out each selected item
1513
- j = i.wrapLabel({
1514
- prefixLabel: S,
1515
- label: A.length > 1 ? [ "".concat(E.length, " items selected") ] : j,
1516
- suffixLabel: x
1517
- });
1518
- A = i.wrapLabel({
1519
- prefixLabel: S,
1520
- label: A,
1521
- suffixLabel: x
1461
+ } else {
1462
+ var i;
1463
+ // non-multiple mode only supports a single selection
1464
+ // so close the menu once a selection is made
1465
+ Mt({
1466
+ reason: "contentClick"
1522
1467
  });
1468
+ (i = Ze.current) === null || i === void 0 ? void 0 : i.focus();
1523
1469
  }
1524
- // single <Select> behaviour is to show the placeholder if all parts of the label
1525
- // are empty strings so we replicate this behaviour here
1526
- if (A.length === 0 || !y && A.every((function(e) {
1527
- return e === "";
1528
- }))) {
1529
- A = Pt(g);
1530
- j = A;
1531
- }
1532
- var P = jt({
1533
- "aria-describedby": u,
1534
- "aria-label": "".concat(m ? "".concat(m, ", ") : "").concat(j.join("")),
1535
- "aria-labelledby": m ? undefined : b,
1536
- "aria-required": w,
1537
- "data-select-appearance": l,
1538
- "data-test": y ? "multiselect" : "select",
1539
- role: "combobox",
1540
- disabled: p,
1541
- elementRef: d,
1542
- error: v
1543
- }, C()(i.props, O()(o.propTypes)));
1544
- if (y) {
1545
- P["data-test-values"] = JSON.stringify(E);
1546
- } else {
1547
- var V = lt(E, 1), R = V[0];
1548
- P["data-test-value"] = R;
1470
+ z === null || z === void 0 ? void 0 : z(e, {
1471
+ values: l,
1472
+ name: K,
1473
+ reason: "valueToggle"
1474
+ });
1475
+ }), [ Tt, Mt, be, N, K, z ]);
1476
+ var Lt = function e() {
1477
+ et.current = null;
1478
+ nt.current = [];
1479
+ if (tt.current) {
1480
+ clearTimeout(tt.current);
1549
1481
  }
1550
- if (a) {
1551
-
1552
- return (0, n.cloneElement)(a, P);
1482
+ };
1483
+ var Vt = (0, e.useCallback)((function(e) {
1484
+ var n;
1485
+ // this doesn't make sense if we can't select multiple values
1486
+ if (!N) {
1487
+ return;
1553
1488
  }
1554
- if (l === "link") {
1555
-
1556
- return r().createElement(q(), at({}, P, {
1557
- "data-select-appearance": "link"
1558
- }), !!_ && r().createElement(Ue, null, _), A || g, r().createElement(Ge, null, r().createElement(J, null)));
1489
+ var r = (n = Tt()) !== null && n !== void 0 ? n : [];
1490
+ var o = S()(r.concat(pt.current));
1491
+ o = t().Children.toArray(f).filter((function(e) {
1492
+ return st(e) && m()(o, e.props.value) && (!e.props.disabled || m()(r, e.props.value));
1493
+ })).map((function(e) {
1494
+ return e.props.value;
1495
+ }));
1496
+ if (!be) {
1497
+ Ge(o);
1559
1498
  }
1560
-
1561
- return r().createElement(We, at({}, P, {
1562
- $multiple: y,
1563
- appearance: l,
1564
- label: A,
1565
- error: v,
1566
- icon: _,
1567
- inline: h,
1568
- isMenu: true,
1569
- onClick: i.props.onClick
1570
- }, I()(i.props, o.invalidLinkAppearanceProps)), !!E.length && y && r().createElement(Ye, {
1571
- "data-role": "count"
1572
- }, "(", E.length, ")"));
1573
- }));
1574
- Et(Ct(i), "createChildren", (function() {
1575
- var e = i.state, t = e.filterKeyword, o = e.textHasFocus, a = e.topValues;
1576
- var l = i.props, s = l.allowKeyMatching, u = l.allowNewValues, p = l.filter, d = l.multiple, h = l.selectAllAppearance, b = l.showSelectedValuesFirst, m = l.isLoadingOptions, y = l.onScrollBottom;
1577
- var g = i.getCurrentValues();
1578
- i.availableOptionCount = 0;
1579
- i.firstSelectedOptionIndex = undefined;
1580
- i.selectedOptionCount = 0;
1581
- i.activeValue = undefined;
1582
- i.availableMatchOptions = [];
1583
- var O;
1584
- var S = 0;
1585
- var w = false;
1586
- // used to avoid overwriting the selected item ref in multiple mode
1587
- var x;
1588
- var C = b === "immediately" ? i.getTopValues() : a;
1589
- var k = n.Children.toArray(i.props.children).reduce((function(e, t, o) {
1590
- // ignore Headings and Dividers
1591
- if (!Dt(t)) {
1592
- e.push(t);
1593
- return e;
1594
- }
1595
- // Find out if the search string exactly matches a value
1596
- if (t.props.value === i.state.filterKeyword) {
1597
- O = true;
1598
- }
1599
- var a = g && g.indexOf(t.props.value) >= 0;
1600
- var l = !!a && !t.props.disabled && !x;
1601
- var c = s && !d && !p && !m && !y;
1602
- var u = Lt(t.props.value, t.props.label);
1603
- var f = -1;
1604
- if (c && !t.props.disabled && !t.props.hidden) {
1605
- i.availableMatchOptions.push({
1606
- label: t.props.label,
1607
- value: t.props.value
1608
- });
1609
- f = i.availableMatchOptions.length - 1;
1610
- }
1611
- // Format the Menu.Item
1612
- var v = (0, n.cloneElement)(t, {
1613
- key: t.key || o,
1614
- onClick: i.handleMenuOptionClick,
1615
- onKeyDown: c ? function(e) {
1616
- return i.handleMenuOptionKeyDown(e, f);
1617
- } : undefined,
1618
- selected: a,
1619
- multiple: d,
1620
- role: "option",
1621
- ref: function e(t) {
1622
- return i.handleOptionMount(t, u, l);
1623
- }
1624
- });
1625
- if (l) {
1626
- x = true;
1627
- }
1628
- if (C && C.indexOf(t.props.value) >= 0) {
1629
- if (S === 0) {
1630
- e.splice(S, 0, r().createElement(T.Divider, {
1631
- key: "topDivider"
1632
- }));
1633
- w = true;
1634
- }
1635
- e.splice(S, 0, v);
1636
- S += 1;
1637
- } else {
1638
- e.push(v);
1639
- }
1640
- return e;
1641
- }), []);
1642
- // In multiple mode, add missing items
1643
- if (d) {
1644
- v()(g, (function(e) {
1645
- var t = f()(k, (function(t) {
1646
- return Dt(t) && t.props && t.props.value === e;
1647
- }));
1648
- if (!t) {
1649
- if (e === i.state.filterKeyword) {
1650
- O = true;
1651
- }
1652
- var n = C && C.indexOf(e) >= 0;
1653
- var o = C.length;
1654
- if (S === 0) {
1655
- k.splice(0, 0, r().createElement(T.Divider, {
1656
- key: "topDivider"
1657
- }));
1658
- S += 1;
1659
- w = true;
1660
- }
1661
- k.splice(n ? 0 : o + 1, 0, r().createElement(Oe, {
1662
- label: String(e),
1663
- value: e,
1664
- key: "missing-value-".concat(e),
1665
- onClick: i.handleMenuOptionClick,
1666
- multiple: d,
1667
- selected: true
1668
- }));
1669
- if (n) {
1670
- S += 1;
1671
- }
1672
- }
1673
- }));
1499
+ z === null || z === void 0 ? void 0 : z(e, {
1500
+ values: o,
1501
+ name: K,
1502
+ reason: "selectAll"
1503
+ });
1504
+ }), [ f, Tt, be, N, K, z ]);
1505
+ var qt = (0, e.useCallback)((function(e) {
1506
+ var n;
1507
+ // this doesn't make sense if we can't select multiple values
1508
+ if (!N) {
1509
+ return;
1674
1510
  }
1675
- var I = p === "controlled";
1676
- // Filter the items
1677
- var _ = (0, D.stringToKeywords)(t);
1678
- k = I ? k : k.filter((function(e) {
1679
- if (Dt(e)) {
1680
- return (0, D.testPhrase)(e.props.label, _);
1681
- }
1682
- return true;
1683
- // Keep all headers and non-interactive options
1684
- })).map((function(e) {
1685
- if (!Dt(e)) {
1686
- return e;
1687
- }
1688
- // highlight matched text
1689
- var t = _ && (0, D.keywordLocations)(e.props.label, _);
1690
-
1691
- return (0, n.cloneElement)(e, {
1692
- matchRanges: t || undefined
1693
- });
1511
+ var r = (n = Tt()) !== null && n !== void 0 ? n : [];
1512
+ var o = k().apply(void 0, [ r ].concat(Ke(pt.current)));
1513
+ // this will unselect all selected values unless those values are disabled or hidden by the filter
1514
+ var l = t().Children.toArray(f).filter((function(e) {
1515
+ return st(e) && (m()(r, e.props.value) && e.props.disabled || m()(o, e.props.value));
1516
+ })).map((function(e) {
1517
+ return e.props.value;
1694
1518
  }));
1695
- // Add the option to add the new value
1696
- if (u && !O && t) {
1697
- var A = w ? S + 1 : S;
1698
- k.splice(A, 0, r().createElement(Oe, {
1699
- label: "".concat(t, " (new value)"),
1700
- value: t,
1701
- key: "newValue",
1702
- multiple: d,
1703
- onClick: i.handleMenuOptionClick
1704
- }));
1519
+ if (!be) {
1520
+ Ge(l);
1705
1521
  }
1706
- // When selectAll is a menu item, add an offset so that activeItem accounts for the extra selectAll option.
1707
- var j = h === "checkbox" && d && k.length > 1 ? 1 : 0;
1708
- var E = true;
1709
- // Highlight the selected Items and remove hidden
1710
- k = k.reduce((function(e, t) {
1711
- // ignore Dividers & Headings
1712
- if (!Dt(t)) {
1713
- e.push(t);
1714
- return e;
1715
- }
1716
- // Ignore any hidden items
1717
- if (t.props && t.props.hidden) {
1718
- return e;
1719
- }
1720
- if (t.props.selected && !t.props.disabled && i.firstSelectedOptionIndex == null) {
1721
- i.firstSelectedOptionIndex = i.availableOptionCount;
1722
- }
1723
- var r = j === i.state.activeIndex;
1724
- j += 1;
1725
- i.availableOptionCount += 1;
1726
- i.selectedOptionCount += t.props.selected ? 1 : 0;
1727
- if (t.key !== "newValue" && !t.props.disabled && !t.props.selected) {
1728
- E = false;
1729
- }
1730
- if (!r || !o) {
1731
- e.push(t);
1732
- return e;
1733
- }
1734
- if (!t.props.disabled) {
1735
- i.activeValue = t.props.value;
1522
+ z === null || z === void 0 ? void 0 : z(e, {
1523
+ values: l,
1524
+ name: K,
1525
+ reason: "clearAll"
1526
+ });
1527
+ }), [ f, Tt, be, N, K, z ]);
1528
+ var Bt = (0, e.useCallback)((function(e) {
1529
+ if (Ie && !A) {
1530
+ W === null || W === void 0 ? void 0 : W(e);
1531
+ }
1532
+ }), [ Ie, A, W ]);
1533
+ var Dt = (0, e.useCallback)((function(t) {
1534
+ var n = (0, B.keycode)(t.nativeEvent);
1535
+ if (n === "tab") {
1536
+ if (ue && lt.current && it.current <= 1) {
1537
+ t.preventDefault();
1538
+ Rt(t, lt.current);
1736
1539
  }
1737
- var a = (0, n.cloneElement)(t, {
1738
- active: r,
1739
- id: i.activeItemId,
1740
- ref: i.handleActiveOptionMount
1741
- });
1742
- e.push(a);
1743
- return e;
1744
- }), []);
1745
- i.optionSelection = i.selectedOptionCount === 0 && "none" || E && "all" || "some";
1746
- // add select all option
1747
- if (h === "checkbox" && d && i.availableOptionCount > 0) {
1748
- var M;
1749
- var P;
1750
- if (i.optionSelection === "all") {
1751
- if (t === "") {
1752
- P = (0, c._)("Clear all");
1540
+ }
1541
+ if (t.shiftKey || t.metaKey || t.ctrlKey) {
1542
+ if (n === "a" && (t.ctrlKey || t.metaKey)) {
1543
+ // handle control + A
1544
+ if (St.current === "all") {
1545
+ qt(t);
1753
1546
  } else {
1754
- P = (0, c._)("Clear all matches");
1547
+ Vt(t);
1755
1548
  }
1756
- } else if (t === "") {
1757
- P = (0, c._)("Select all");
1758
- } else {
1759
- P = (0, c._)("Select all matches");
1760
1549
  }
1761
- if (i.state.activeIndex === 0 && o) {
1762
- i.activeValue = "selectAll";
1763
- }
1764
- k.unshift( r().createElement(He, {
1765
- key: "selectAllOption",
1766
- selected: i.optionSelection === "all" || i.optionSelection !== "none" && "some",
1767
- selectAllLabel: P,
1768
- totalCount: (M = i.getCurrentValues()) === null || M === void 0 ? void 0 : M.length,
1769
- changedToggle: !!i.props.toggle,
1770
- onClick: i.optionSelection === "all" ? i.handleClearAll : i.handleSelectAll,
1771
- id: i.state.activeIndex === 0 ? i.activeItemId : undefined,
1772
- active: i.state.activeIndex === 0,
1773
- ref: i.handleActiveOptionMount,
1774
- tabIndex: -1
1775
- }), r().createElement(T.Divider, {
1776
- key: "selectAllDivider"
1777
- }));
1550
+ return;
1778
1551
  }
1779
- i.displayedValues = k.reduce((function(e, t) {
1780
- if (Dt(t)) {
1781
- e.push(t.props.value);
1552
+ if (n === "down") {
1553
+ t.preventDefault();
1554
+ ke(Math.min(Ce + 1, le === "checkbox" ? it.current : it.current - 1));
1555
+ if (f && W) {
1556
+ var r;
1557
+ var o = e.Children.toArray(f).length - (2 + ((r = Tt()) !== null && r !== void 0 ? r : []).length);
1558
+ if (Ce === o) {
1559
+ Bt(t);
1560
+ }
1782
1561
  }
1783
- return e;
1784
- }), []);
1785
- return k;
1786
- }));
1787
- Et(Ct(i), "wrapLabel", (function(e) {
1788
- var t = e.prefixLabel, n = e.label, r = e.suffixLabel;
1789
- var o = n;
1790
- if (t) {
1791
- o = [ "".concat(t, ": ") ].concat(o);
1792
1562
  }
1793
- if (r) {
1794
- o = u()(o).concat(" ".concat(r));
1563
+ if (n === "up") {
1564
+ t.preventDefault();
1565
+ ke(Math.max(Ce - 1, 0));
1795
1566
  }
1796
- return o;
1797
- }));
1798
- Et(Ct(i), "handleDropdownMount", (function(e) {
1799
- i.dropdown = e;
1800
- }));
1801
- i.state = {
1802
- activeIndex: 0,
1803
- filterKeyword: "",
1804
- open: false,
1805
- textHasFocus: false,
1806
- topValues: [],
1807
- values: e.defaultValues || []
1808
- };
1809
- i.controlledExternally = l()(e, "values");
1810
- i.displayedValues = [];
1811
- i.availableOptionCount = 0;
1812
- i.firstSelectedOptionIndex = undefined;
1813
- i.selectedOptionCount = 0;
1814
- i.matchCharacter = null;
1815
- i.matchTimeout = null;
1816
- i.currentMatchOptions = [];
1817
- i.availableMatchOptions = [];
1818
- i.optionRefsByKey = {};
1819
- i.optionSelection = "none";
1820
- if (false) {}
1821
- if (false) {}
1822
- o.validateAppearance(e);
1823
- i.menuListboxId = (0, M.createDOMID)("menu-listbox");
1824
- i.activeItemId = (0, M.createDOMID)("active-item");
1825
- return i;
1826
- }
1827
- gt(o, [ {
1828
- key: "componentDidUpdate",
1829
- value: function e(t, n) {
1830
- if (false) {}
1831
- if (false) {}
1832
- o.validateAppearance(this.props);
1833
- this.previousActiveIndex = n.activeIndex;
1834
- }
1835
- }, {
1836
- key: "getCurrentValues",
1837
- value: function e() {
1838
- var t = this.isControlled() ? this.props.values : this.state.values;
1839
- return this.props.multiple || t == null ? t : t.slice(0, 1);
1840
- }
1841
- }, {
1842
- key: "getTopValues",
1843
- value: function e() {
1844
- var t;
1845
- // in non-multiple mode, don't move values to the top of the list
1846
- return this.props.multiple && this.props.showSelectedValuesFirst !== "never" ? (t = this.getCurrentValues()) !== null && t !== void 0 ? t : [] : [];
1847
- }
1848
- }, {
1849
- key: "isControlled",
1850
- value: function e() {
1851
- return this.controlledExternally;
1852
- }
1853
- }, {
1854
- key: "hasFilter",
1855
- value: function e() {
1856
- return !!this.props.filter;
1857
- }
1858
- }, {
1859
- key: "toggleValue",
1860
- value: function e(t, n) {
1861
- var r, o, i;
1862
- var a = (r = this.getCurrentValues()) !== null && r !== void 0 ? r : [];
1863
- var l = a.indexOf(n);
1864
- var c = this.props, s = c.name, u = c.multiple;
1865
- var p;
1866
- if (u) {
1867
- if (l >= 0) {
1868
- p = [].concat(pt(a.slice(0, l)), pt(a.slice(l + 1)));
1567
+ if (n === "enter" && lt.current && Ie) {
1568
+ if (lt.current === "selectAll") {
1569
+ if (St.current === "all") {
1570
+ qt(t);
1571
+ } else {
1572
+ Vt(t);
1573
+ }
1869
1574
  } else {
1870
- p = a.concat([ n ]);
1575
+ t.preventDefault();
1576
+ Rt(t, lt.current);
1871
1577
  }
1872
- } else {
1873
- // non-multiple mode must always have a value
1874
- p = [ n ];
1875
1578
  }
1876
- var f = !this.isControlled();
1877
- if (f) {
1878
- this.setState({
1879
- values: p
1880
- });
1579
+ }), [ Ce, f, Tt, qt, Bt, Vt, W, Ie, le, ue, Rt ]);
1580
+ var Nt = (0, e.useCallback)((function(e, t) {
1581
+ var n = t.value;
1582
+ e.preventDefault();
1583
+ if (!Ie) {
1584
+ return;
1881
1585
  }
1882
- if (u) {
1883
- // in uncontrolled multiple mode, keep the menu open
1884
- if (f) {
1885
- this.setState({
1886
- open: true
1887
- });
1586
+ Rt(e, n);
1587
+ }), [ Ie, Rt ]);
1588
+ var Kt = (0, e.useCallback)((function(e, t) {
1589
+ var n = e.nativeEvent.key;
1590
+ // Checking for a single character to avoid complications from double-byte languages and emojis.
1591
+ if (n.length === 1) {
1592
+ var r = [];
1593
+ var o = {
1594
+ index: 0,
1595
+ value: n
1596
+ };
1597
+ if (!et.current) {
1598
+ if (n === " ") {
1599
+ Lt();
1600
+ return;
1601
+ }
1602
+ r = Ve(rt.current, o);
1603
+ } else if (nt.current.length > 1) {
1604
+ o.index = et.current.index + 1;
1605
+ r = Ve(nt.current, o);
1888
1606
  }
1889
- } else {
1890
- // non-multiple mode only supports a single selection
1891
- // so close the menu once a selection is made
1892
- this.handleRequestClose({
1893
- reason: "contentClick"
1894
- });
1895
- this.focus();
1607
+ if (r.length) {
1608
+ var l = 0;
1609
+ // If the active option is a first character match, cycle to the next matching option.
1610
+ if (o.index === 0 && r.length > 1) {
1611
+ var a = r.indexOf(rt.current[t]);
1612
+ if (a >= 0) {
1613
+ l = a === r.length - 1 ? 0 : a + 1;
1614
+ }
1615
+ }
1616
+ var i = r[l];
1617
+ var u = i.value, c = i.label;
1618
+ var s = at.current[ft(u, c)];
1619
+ if (s != null) {
1620
+ var f;
1621
+ (f = s.focus) === null || f === void 0 ? void 0 : f.call(s);
1622
+ }
1623
+ }
1624
+ nt.current = r;
1625
+ et.current = o;
1626
+ if (tt.current) {
1627
+ clearTimeout(tt.current);
1628
+ }
1629
+ tt.current = setTimeout(Lt, 500);
1630
+ e.preventDefault();
1631
+ e.stopPropagation();
1896
1632
  }
1897
- (o = (i = this.props).onChange) === null || o === void 0 ? void 0 : o.call(i, t, {
1898
- values: p,
1899
- name: s,
1900
- reason: "valueToggle"
1633
+ }), []);
1634
+ var Ft = (0, e.useCallback)((function(e, t) {
1635
+ var n = t.value;
1636
+ Pe(n);
1637
+ _e(true);
1638
+ ke(0);
1639
+ U === null || U === void 0 ? void 0 : U(e, {
1640
+ keyword: n
1901
1641
  });
1902
- }
1903
- /**
1904
- * Place focus on the toggle.
1905
- */ }, {
1906
- key: "focus",
1907
- value: function e() {
1908
- var t;
1909
- (t = this.dropdown) === null || t === void 0 ? void 0 : t.focus();
1910
- }
1911
- }, {
1912
- key: "renderControls",
1913
- value: function e(t) {
1914
- var n = t.hasChildren, o = t.placement;
1915
- var i = this.state.filterKeyword;
1916
- var a = this.props, l = a.inputId, s = a.inputRef, u = a.multiple, p = a.selectAllAppearance;
1917
- var f = (0, c._)("Select all options".concat(this.optionSelection === "all" ? " disabled" : ""));
1918
- var d = (0, c._)("Clear all options".concat(this.optionSelection === "none" ? " disabled" : ""));
1919
- // only visually disable these as opposed to fully disabling to avoid losing keyboard focus - see SUI-2731
1920
- var v = r().createElement(Ze, {
1921
- $placement: o,
1922
- key: "selectAll"
1923
- }, r().createElement(Qe, {
1924
- $disabled: this.optionSelection === "all",
1925
- "aria-label": f,
1926
- onClick: this.handleSelectAll,
1927
- "data-test": "select-all"
1928
- }, i ? (0, c._)("Select all Matches") : (0, c._)("Select all")), r().createElement(Qe, {
1929
- $disabled: this.optionSelection === "none",
1930
- "aria-label": d,
1931
- onClick: this.handleClearAll,
1932
- "data-test": "clear-all"
1933
- }, i ? (0, c._)("Clear all Matches") : (0, c._)("Clear all")));
1934
- return this.hasFilter() && r().createElement("div", {
1935
- key: "controls"
1936
- }, r().createElement(Je, {
1937
- key: "filter",
1938
- "data-test": "filter"
1939
- }, r().createElement(F(), {
1940
- value: i,
1941
- autoCapitalize: "off",
1942
- autoComplete: "off",
1943
- autoCorrect: "off",
1944
- spellCheck: false,
1945
- onChange: this.handleTextChange,
1946
- onKeyDown: this.handleTextKeyDown,
1947
- onFocus: this.handleTextFocus,
1948
- onBlur: this.handleTextBlur,
1949
- placeholder: (0, c._)("filter"),
1950
- role: "combobox",
1951
- "aria-expanded": "true",
1952
- "aria-controls": this.menuListboxId,
1953
- "aria-owns": n ? this.activeItemId : undefined,
1954
- "aria-label": (0, c._)("Filter"),
1955
- "aria-autocomplete": "list",
1956
- "aria-activedescendant": this.state.textHasFocus && n ? this.activeItemId : undefined,
1957
- inputRef: s,
1958
- inputId: l,
1959
- canClear: true,
1960
- startAdornment: r().createElement(Xe, null, r().createElement(te, null))
1961
- })), u && n && p === "buttongroup" && v);
1962
- }
1963
- }, {
1964
- key: "render",
1965
- value: function e() {
1966
- var t, o = this;
1967
- var i = this.props, a = i.children, l = i.defaultPlacement, c = i.inputId, s = i.multiple, u = i.repositionMode, p = i.virtualization;
1968
- var d = this.hasFilter();
1969
- var v = (t = this.getCurrentValues()) !== null && t !== void 0 ? t : [];
1970
- var h = n.Children.toArray(a);
1971
- var b = v.some((function(e) {
1972
- var t = f()(h, (function(t) {
1973
- return Dt(t) && t.props.value === e;
1974
- }));
1975
- return t && !t.props.disabled;
1642
+ }), [ U ]);
1643
+ var Ht = (0, e.useCallback)((function() {
1644
+ Be(true);
1645
+ }), []);
1646
+ var zt = (0, e.useCallback)((function() {
1647
+ Be(false);
1648
+ }), []);
1649
+ var $t = (0, e.useCallback)((function(e) {
1650
+ if (ot.current !== Ce) {
1651
+ e === null || e === void 0 ? void 0 : e.scrollIntoViewIfNeeded();
1652
+ }
1653
+ }), [ Ce ]);
1654
+ var Wt = (0, e.useCallback)((function(e, t, n) {
1655
+ if (n) {
1656
+ ht.current = e;
1657
+ }
1658
+ if (e == null) {
1659
+ delete at.current[t];
1660
+ } else {
1661
+ at.current[t] = e;
1662
+ }
1663
+ }), []);
1664
+ var Ut = (0, e.useCallback)((function(e) {
1665
+ Ze.current = e;
1666
+ }), [ Ze ]);
1667
+ var Jt = (r = Tt()) !== null && r !== void 0 ? r : [];
1668
+ var Xt = e.Children.toArray(f);
1669
+ var Gt = Jt.some((function(e) {
1670
+ var t = p()(Xt, (function(t) {
1671
+ return st(t) && t.props.value === e;
1976
1672
  }));
1977
- var m = this.createChildren();
1978
- var y = this.createToggle();
1979
- var g = function e(t) {
1980
- var n = t.anchorWidth, i = t.maxHeight, a = t.placement;
1981
- var l = Vt({
1982
- anchorWidth: n,
1983
- isMultiple: o.props.multiple,
1984
- maxHeight: i,
1985
- menuStyle: o.props.menuStyle
1986
- });
1987
- var c = v.length > 0 && !b && !o.hasFilter() ? 0 : undefined;
1988
- var u = jt(jt({
1989
- "aria-multiselectable": s || undefined,
1990
- childrenStart: o.renderControls({
1991
- placement: a,
1992
- hasChildren: m.some((function(e) {
1993
- return Dt(e);
1994
- }))
1995
- }),
1996
- focusMode: o.hasFilter() ? "never" : undefined,
1997
- isLoading: o.props.isLoadingOptions,
1998
- menuId: o.menuListboxId,
1999
- onScrollBottom: o.props.onScrollBottom ? o.handleScrollBottom : undefined,
2000
- placement: a !== null && a !== void 0 ? a : undefined
2001
- }, I()(o.props, "noOptionsMessage", "footerMessage", "animateLoading", "loadingMessage", "onScroll")), {}, {
2002
- style: l,
2003
- tabIndex: c
2004
- });
2005
- if (p) {
2006
-
2007
- return r().createElement(N.VirtualizedResultsMenu, at({
2008
- virtualization: p
2009
- }, u), m);
2010
- }
2011
-
2012
- return r().createElement(B(), u, m);
1673
+ return t && !t.props.disabled;
1674
+ }));
1675
+ var Qt = ae === "immediately" ? It() : He;
1676
+ var Yt = {
1677
+ activeIndex: Ce,
1678
+ activeItemId: ge,
1679
+ allowKeyMatching: l,
1680
+ allowNewValues: s,
1681
+ availableMatchOptions: rt,
1682
+ availableOptionCount: it,
1683
+ children: f,
1684
+ currentValues: Jt,
1685
+ filter: w,
1686
+ filterKeyword: Ee,
1687
+ firstSelectedOptionIndex: Ot,
1688
+ isLoadingOptions: A,
1689
+ multiple: N,
1690
+ newTopValues: Qt,
1691
+ onActiveOptionMount: $t,
1692
+ onClick: Nt,
1693
+ onClearAll: qt,
1694
+ onKeyDown: Kt,
1695
+ onOptionMount: Wt,
1696
+ onScrollBottom: W,
1697
+ onSelectAll: Vt,
1698
+ optionSelection: St,
1699
+ selectAllAppearance: le,
1700
+ selectedOptionCount: wt,
1701
+ setActiveValue: jt,
1702
+ setAvailableMatchOptions: Et,
1703
+ setAvailableOptionCount: Ct,
1704
+ setDisplayedValues: At,
1705
+ setFirstSelectedOptionIndex: kt,
1706
+ setOptionSelection: Pt,
1707
+ setSelectedOptionCount: xt,
1708
+ textHasFocus: qe,
1709
+ toggle: fe
1710
+ };
1711
+ var Zt = function e(n) {
1712
+ var r = n.anchorWidth, o = n.maxHeight, l = n.placement;
1713
+ var i = ut({
1714
+ anchorWidth: r,
1715
+ isMultiple: N,
1716
+ maxHeight: o,
1717
+ menuStyle: D
1718
+ });
1719
+ var u = Jt.length > 0 && !Gt && !w ? 0 : undefined;
1720
+ var c = {
1721
+ "aria-multiselectable": N || undefined,
1722
+ childrenStart: !!w && t().createElement(bt, {
1723
+ activeItemId: ge,
1724
+ filterKeyword: Ee,
1725
+ hasChildren: mt,
1726
+ inputId: E,
1727
+ inputRef: P,
1728
+ menuListboxId: Oe,
1729
+ multiple: N,
1730
+ onClearAll: qt,
1731
+ onSelectAll: Vt,
1732
+ onTextBlur: zt,
1733
+ onTextChange: Ft,
1734
+ onTextFocus: Ht,
1735
+ onTextKeyDown: Dt,
1736
+ optionSelection: St,
1737
+ placement: l,
1738
+ selectAllAppearance: le,
1739
+ textHasFocus: qe
1740
+ }),
1741
+ focusMode: w ? "never" : undefined,
1742
+ isLoading: A,
1743
+ menuId: Oe,
1744
+ onScrollBottom: W ? Bt : undefined,
1745
+ placement: l !== null && l !== void 0 ? l : undefined,
1746
+ noOptionsMessage: H,
1747
+ footerMessage: C,
1748
+ animateLoading: a,
1749
+ loadingMessage: R,
1750
+ onScroll: $,
1751
+ style: i,
1752
+ tabIndex: u
2013
1753
  };
1754
+ if (se) {
1755
+
1756
+ return t().createElement(T.VirtualizedResultsMenu, $e({
1757
+ virtualization: se
1758
+ }, c), t().createElement(yt, Yt));
1759
+ }
2014
1760
 
2015
- return r().createElement(V(), {
2016
- closeReasons: Rt,
2017
- inputId: c,
2018
- toggle: y,
2019
- onRequestOpen: this.handleRequestOpen,
2020
- onRequestClose: this.handleRequestClose,
2021
- open: this.state.open,
2022
- openWithArrowKeys: true,
2023
- repositionMode: u,
2024
- defaultPlacement: d ? l : undefined,
2025
- canCoverAnchor: it().innerHeight < 500,
2026
- ref: this.handleDropdownMount,
2027
- retainFocus: false,
2028
- takeFocus: v.length === 0 || v.length > 0 && !b || d
2029
- }, g);
2030
- }
2031
- } ]);
2032
- return o;
2033
- }(n.Component);
2034
- Et(qt, "propTypes", Mt);
2035
- Et(qt, "defaultProps", Tt);
2036
- Et(qt, "Option", Oe);
2037
- Et(qt, "Divider", T.Divider);
2038
- Et(qt, "Heading", T.Heading);
2039
- Et(qt, "invalidLinkAppearanceProps", [ "append", "error", "prepend" ]);
2040
- /* harmony default export */ const Nt = qt;
2041
- // CONCATENATED MODULE: ./src/Select/Option.tsx
2042
- function Bt(e) {
2043
- "@babel/helpers - typeof";
2044
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
2045
- Bt = function e(t) {
2046
- return typeof t;
2047
- };
2048
- } else {
2049
- Bt = function e(t) {
2050
- return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
1761
+ return t().createElement(I(), c, t().createElement(yt, Yt));
2051
1762
  };
1763
+
1764
+ return t().createElement(j(), {
1765
+ closeReasons: ct,
1766
+ inputId: E,
1767
+ toggle: t().createElement(gt, $e({
1768
+ appearance: u,
1769
+ append: c,
1770
+ currentValues: Tt(),
1771
+ "data-test": N ? "multiselect" : "select",
1772
+ describedBy: y,
1773
+ disabled: h,
1774
+ elementRef: g,
1775
+ error: O,
1776
+ inline: x,
1777
+ labelText: M,
1778
+ labelledBy: _,
1779
+ multiple: N,
1780
+ onClick: J,
1781
+ placeholder: Z,
1782
+ prefixLabel: ee,
1783
+ prepend: te,
1784
+ required: Q,
1785
+ suffixLabel: ie,
1786
+ toggle: fe,
1787
+ toggleContent: de
1788
+ }, ve), f),
1789
+ onRequestOpen: _t,
1790
+ onRequestClose: Mt,
1791
+ open: Ie,
1792
+ openWithArrowKeys: true,
1793
+ repositionMode: re,
1794
+ defaultPlacement: w ? v : undefined,
1795
+ canCoverAnchor: Ne().innerHeight < 500,
1796
+ ref: Ut,
1797
+ retainFocus: false,
1798
+ takeFocus: Jt.length === 0 || Jt.length > 0 && !Gt || !!w
1799
+ }, Zt);
2052
1800
  }
2053
- return Bt(e);
2054
- }
2055
- function Kt() {
2056
- Kt = Object.assign || function(e) {
2057
- for (var t = 1; t < arguments.length; t++) {
2058
- var n = arguments[t];
2059
- for (var r in n) {
2060
- if (Object.prototype.hasOwnProperty.call(n, r)) {
2061
- e[r] = n[r];
1801
+ Ot.propTypes = at;
1802
+ Ot.componentType = "SelectBase";
1803
+ Ot.Option = he;
1804
+ Ot.Divider = A.Divider;
1805
+ Ot.Heading = A.Heading;
1806
+ /* harmony default export */ const wt = Ot;
1807
+ // CONCATENATED MODULE: ./src/Select/Option.tsx
1808
+ function St(e) {
1809
+ "@babel/helpers - typeof";
1810
+ return St = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
1811
+ return typeof e;
1812
+ } : function(e) {
1813
+ return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
1814
+ }, St(e);
1815
+ }
1816
+ function Ct() {
1817
+ return Ct = Object.assign ? Object.assign.bind() : function(e) {
1818
+ for (var t = 1; t < arguments.length; t++) {
1819
+ var n = arguments[t];
1820
+ for (var r in n) {
1821
+ ({}).hasOwnProperty.call(n, r) && (e[r] = n[r]);
2062
1822
  }
2063
1823
  }
1824
+ return e;
1825
+ }, Ct.apply(null, arguments);
1826
+ }
1827
+ function kt(e, t) {
1828
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
1829
+ }
1830
+ function xt(e, t) {
1831
+ for (var n = 0; n < t.length; n++) {
1832
+ var r = t[n];
1833
+ r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
1834
+ Object.defineProperty(e, Lt(r.key), r);
2064
1835
  }
1836
+ }
1837
+ function jt(e, t, n) {
1838
+ return t && xt(e.prototype, t), n && xt(e, n), Object.defineProperty(e, "prototype", {
1839
+ writable: !1
1840
+ }), e;
1841
+ }
1842
+ function Et(e, t) {
1843
+ if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
1844
+ e.prototype = Object.create(t && t.prototype, {
1845
+ constructor: {
1846
+ value: e,
1847
+ writable: !0,
1848
+ configurable: !0
1849
+ }
1850
+ }), Object.defineProperty(e, "prototype", {
1851
+ writable: !1
1852
+ }), t && Pt(e, t);
1853
+ }
1854
+ function Pt(e, t) {
1855
+ return Pt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
1856
+ return e.__proto__ = t, e;
1857
+ }, Pt(e, t);
1858
+ }
1859
+ function At(e) {
1860
+ var t = _t();
1861
+ return function() {
1862
+ var n, r = Mt(e);
1863
+ if (t) {
1864
+ var o = Mt(this).constructor;
1865
+ n = Reflect.construct(r, arguments, o);
1866
+ } else n = r.apply(this, arguments);
1867
+ return Tt(this, n);
1868
+ };
1869
+ }
1870
+ function Tt(e, t) {
1871
+ if (t && ("object" == St(t) || "function" == typeof t)) return t;
1872
+ if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
1873
+ return It(e);
1874
+ }
1875
+ function It(e) {
1876
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2065
1877
  return e;
2066
- };
2067
- return Kt.apply(this, arguments);
2068
- }
2069
- function Ft(e, t) {
2070
- if (!(e instanceof t)) {
2071
- throw new TypeError("Cannot call a class as a function");
2072
- }
2073
- }
2074
- function Ht(e, t) {
2075
- for (var n = 0; n < t.length; n++) {
2076
- var r = t[n];
2077
- r.enumerable = r.enumerable || false;
2078
- r.configurable = true;
2079
- if ("value" in r) r.writable = true;
2080
- Object.defineProperty(e, r.key, r);
2081
- }
2082
- }
2083
- function $t(e, t, n) {
2084
- if (t) Ht(e.prototype, t);
2085
- if (n) Ht(e, n);
2086
- return e;
2087
- }
2088
- function zt(e, t) {
2089
- if (typeof t !== "function" && t !== null) {
2090
- throw new TypeError("Super expression must either be null or a function");
2091
- }
2092
- e.prototype = Object.create(t && t.prototype, {
2093
- constructor: {
2094
- value: e,
2095
- writable: true,
2096
- configurable: true
2097
- }
2098
- });
2099
- if (t) Wt(e, t);
2100
- }
2101
- function Wt(e, t) {
2102
- Wt = Object.setPrototypeOf || function e(t, n) {
2103
- t.__proto__ = n;
2104
- return t;
2105
- };
2106
- return Wt(e, t);
2107
- }
2108
- function Ut(e) {
2109
- var t = Xt();
2110
- return function n() {
2111
- var r = Yt(e), o;
2112
- if (t) {
2113
- var i = Yt(this).constructor;
2114
- o = Reflect.construct(r, arguments, i);
2115
- } else {
2116
- o = r.apply(this, arguments);
1878
+ }
1879
+ function _t() {
1880
+ try {
1881
+ var e = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
1882
+ } catch (e) {}
1883
+ return (_t = function t() {
1884
+ return !!e;
1885
+ })();
1886
+ }
1887
+ function Mt(e) {
1888
+ return Mt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
1889
+ return e.__proto__ || Object.getPrototypeOf(e);
1890
+ }, Mt(e);
1891
+ }
1892
+ function Rt(e, t, n) {
1893
+ return (t = Lt(t)) in e ? Object.defineProperty(e, t, {
1894
+ value: n,
1895
+ enumerable: !0,
1896
+ configurable: !0,
1897
+ writable: !0
1898
+ }) : e[t] = n, e;
1899
+ }
1900
+ function Lt(e) {
1901
+ var t = Vt(e, "string");
1902
+ return "symbol" == St(t) ? t : t + "";
1903
+ }
1904
+ function Vt(e, t) {
1905
+ if ("object" != St(e) || !e) return e;
1906
+ var n = e[Symbol.toPrimitive];
1907
+ if (void 0 !== n) {
1908
+ var r = n.call(e, t || "default");
1909
+ if ("object" != St(r)) return r;
1910
+ throw new TypeError("@@toPrimitive must return a primitive value.");
2117
1911
  }
2118
- return Gt(this, o);
1912
+ return ("string" === t ? String : Number)(e);
1913
+ }
1914
+ var qt = {
1915
+ /** @private */
1916
+ active: l().bool,
1917
+ children: l().node,
1918
+ description: l().string,
1919
+ descriptionPosition: l().oneOf([ "right", "bottom" ]),
1920
+ disabled: l().bool,
1921
+ hidden: l().bool,
1922
+ icon: l().node,
1923
+ label: l().string.isRequired,
1924
+ matchRanges: l().arrayOf(l().shape({
1925
+ start: l().number.isRequired,
1926
+ end: l().number.isRequired
1927
+ })),
1928
+ /** @private */
1929
+ onClick: l().func,
1930
+ /** @private */
1931
+ role: l().oneOf([ "menuitemcheckbox", "option" ]),
1932
+ /** @private */
1933
+ selected: l().bool,
1934
+ truncate: l().bool,
1935
+ value: l().oneOfType([ l().string, l().number, l().bool ]).isRequired
2119
1936
  };
2120
- }
2121
- function Gt(e, t) {
2122
- if (t && (Bt(t) === "object" || typeof t === "function")) {
2123
- return t;
2124
- }
2125
- return Jt(e);
2126
- }
2127
- function Jt(e) {
2128
- if (e === void 0) {
2129
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2130
- }
2131
- return e;
2132
- }
2133
- function Xt() {
2134
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
2135
- if (Reflect.construct.sham) return false;
2136
- if (typeof Proxy === "function") return true;
2137
- try {
2138
- Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
2139
- return true;
2140
- } catch (e) {
2141
- return false;
2142
- }
2143
- }
2144
- function Yt(e) {
2145
- Yt = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
2146
- return t.__proto__ || Object.getPrototypeOf(t);
1937
+ var Bt = {
1938
+ active: false,
1939
+ descriptionPosition: "bottom",
1940
+ disabled: false,
1941
+ hidden: false,
1942
+ selected: false,
1943
+ truncate: false
2147
1944
  };
2148
- return Yt(e);
2149
- }
2150
- function Qt(e, t, n) {
2151
- if (t in e) {
2152
- Object.defineProperty(e, t, {
2153
- value: n,
2154
- enumerable: true,
2155
- configurable: true,
2156
- writable: true
2157
- });
2158
- } else {
2159
- e[t] = n;
2160
- }
2161
- return e;
2162
- }
2163
- var Zt = {
2164
- /** @private */
2165
- active: i().bool,
2166
- children: i().node,
2167
- description: i().string,
2168
- descriptionPosition: i().oneOf([ "right", "bottom" ]),
2169
- disabled: i().bool,
2170
- hidden: i().bool,
2171
- icon: i().node,
2172
- label: i().string.isRequired,
2173
- matchRanges: i().arrayOf(i().shape({
2174
- start: i().number.isRequired,
2175
- end: i().number.isRequired
2176
- })),
2177
- /** @private */
2178
- onClick: i().func,
2179
- /** @private */
2180
- selected: i().bool,
2181
- truncate: i().bool,
2182
- value: i().oneOfType([ i().string, i().number, i().bool ]).isRequired
2183
- };
2184
- var en = {
2185
- active: false,
2186
- descriptionPosition: "bottom",
2187
- disabled: false,
2188
- hidden: false,
2189
- selected: false,
2190
- truncate: false
2191
- };
2192
- /**
1945
+ /**
2193
1946
  * An option within a `Select`. This inherits from
2194
1947
  * [PureComponent](https://reactjs.org/docs/react-api.html#reactpurecomponent)
2195
1948
  * so any elements passed to it must also be pure.
2196
- */ var tn = function(e) {
2197
- zt(n, e);
2198
- var t = Ut(n);
2199
- function n() {
2200
- var e;
2201
- Ft(this, n);
2202
- for (var r = arguments.length, o = new Array(r), i = 0; i < r; i++) {
2203
- o[i] = arguments[i];
2204
- }
2205
- e = t.call.apply(t, [ this ].concat(o));
2206
- Qt(Jt(e), "c", null);
2207
- Qt(Jt(e), "handleMount", (function(t) {
2208
- e.c = t;
2209
- }));
2210
- return e;
2211
- }
2212
- $t(n, [ {
2213
- key: "scrollIntoViewIfNeeded",
2214
- value: function e() {
2215
- var t;
2216
- (t = this.c) === null || t === void 0 ? void 0 : t.scrollIntoViewIfNeeded();
1949
+ */ var Dt = function(e) {
1950
+ Et(r, e);
1951
+ var n = At(r);
1952
+ function r() {
1953
+ var e;
1954
+ kt(this, r);
1955
+ for (var t = arguments.length, o = new Array(t), l = 0; l < t; l++) {
1956
+ o[l] = arguments[l];
1957
+ }
1958
+ e = n.call.apply(n, [ this ].concat(o));
1959
+ Rt(It(e), "c", null);
1960
+ Rt(It(e), "handleMount", (function(t) {
1961
+ e.c = t;
1962
+ }));
1963
+ return e;
2217
1964
  }
2218
- /**
1965
+ // @docs-props-type OptionPropsBase
1966
+ jt(r, [ {
1967
+ key: "scrollIntoViewIfNeeded",
1968
+ // eslint-disable-next-line react/no-unused-class-component-methods
1969
+ value: function e() {
1970
+ var t;
1971
+ (t = this.c) === null || t === void 0 ? void 0 : t.scrollIntoViewIfNeeded();
1972
+ }
1973
+ /**
2219
1974
  * Place focus on the button.
2220
- */ }, {
2221
- key: "focus",
2222
- value: function e() {
2223
- var t;
2224
- (t = this.c) === null || t === void 0 ? void 0 : t.focus();
2225
- }
2226
- }, {
2227
- key: "render",
2228
- value: function e() {
2229
-
2230
- return r().createElement(Oe, Kt({}, this.props, {
2231
- multiple: false,
2232
- ref: this.handleMount
2233
- }), this.props.children || this.props.label);
2234
- }
2235
- } ]);
2236
- return n;
2237
- }(n.PureComponent);
2238
- Qt(tn, "propTypes", Zt);
2239
- Qt(tn, "defaultProps", en);
2240
- /* harmony default export */ const nn = tn;
2241
- // CONCATENATED MODULE: ./src/Select/Select.tsx
2242
- function rn(e) {
2243
- "@babel/helpers - typeof";
2244
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
2245
- rn = function e(t) {
2246
- return typeof t;
2247
- };
2248
- } else {
2249
- rn = function e(t) {
2250
- return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
2251
- };
1975
+ */
1976
+ // eslint-disable-next-line react/no-unused-class-component-methods
1977
+ }, {
1978
+ key: "focus",
1979
+ value: function e() {
1980
+ var t;
1981
+ (t = this.c) === null || t === void 0 ? void 0 : t.focus();
1982
+ }
1983
+ }, {
1984
+ key: "render",
1985
+ value: function e() {
1986
+
1987
+ return t().createElement(he, Ct({}, this.props, {
1988
+ multiple: false,
1989
+ ref: this.handleMount
1990
+ }), this.props.children || this.props.label);
1991
+ }
1992
+ } ]);
1993
+ return r;
1994
+ }(e.PureComponent);
1995
+ Rt(Dt, "propTypes", qt);
1996
+ Rt(Dt, "defaultProps", Bt);
1997
+ /* harmony default export */ const Nt = Dt;
1998
+ // CONCATENATED MODULE: ./src/Select/Select.tsx
1999
+ function Kt(e) {
2000
+ "@babel/helpers - typeof";
2001
+ return Kt = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
2002
+ return typeof e;
2003
+ } : function(e) {
2004
+ return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
2005
+ }, Kt(e);
2252
2006
  }
2253
- return rn(e);
2254
- }
2255
- function on() {
2256
- on = Object.assign || function(e) {
2257
- for (var t = 1; t < arguments.length; t++) {
2258
- var n = arguments[t];
2259
- for (var r in n) {
2260
- if (Object.prototype.hasOwnProperty.call(n, r)) {
2261
- e[r] = n[r];
2007
+ function Ft() {
2008
+ return Ft = Object.assign ? Object.assign.bind() : function(e) {
2009
+ for (var t = 1; t < arguments.length; t++) {
2010
+ var n = arguments[t];
2011
+ for (var r in n) {
2012
+ ({}).hasOwnProperty.call(n, r) && (e[r] = n[r]);
2262
2013
  }
2263
2014
  }
2015
+ return e;
2016
+ }, Ft.apply(null, arguments);
2017
+ }
2018
+ function Ht(e, t) {
2019
+ if (null == e) return {};
2020
+ var n, r, o = zt(e, t);
2021
+ if (Object.getOwnPropertySymbols) {
2022
+ var l = Object.getOwnPropertySymbols(e);
2023
+ for (r = 0; r < l.length; r++) {
2024
+ n = l[r], t.includes(n) || {}.propertyIsEnumerable.call(e, n) && (o[n] = e[n]);
2025
+ }
2264
2026
  }
2265
- return e;
2266
- };
2267
- return on.apply(this, arguments);
2268
- }
2269
- function an(e, t) {
2270
- if (e == null) return {};
2271
- var n = ln(e, t);
2272
- var r, o;
2273
- if (Object.getOwnPropertySymbols) {
2274
- var i = Object.getOwnPropertySymbols(e);
2275
- for (o = 0; o < i.length; o++) {
2276
- r = i[o];
2277
- if (t.indexOf(r) >= 0) continue;
2278
- if (!Object.prototype.propertyIsEnumerable.call(e, r)) continue;
2279
- n[r] = e[r];
2280
- }
2027
+ return o;
2281
2028
  }
2282
- return n;
2283
- }
2284
- function ln(e, t) {
2285
- if (e == null) return {};
2286
- var n = {};
2287
- var r = Object.keys(e);
2288
- var o, i;
2289
- for (i = 0; i < r.length; i++) {
2290
- o = r[i];
2291
- if (t.indexOf(o) >= 0) continue;
2292
- n[o] = e[o];
2293
- }
2294
- return n;
2295
- }
2296
- function cn(e, t) {
2297
- if (!(e instanceof t)) {
2298
- throw new TypeError("Cannot call a class as a function");
2299
- }
2300
- }
2301
- function sn(e, t) {
2302
- for (var n = 0; n < t.length; n++) {
2303
- var r = t[n];
2304
- r.enumerable = r.enumerable || false;
2305
- r.configurable = true;
2306
- if ("value" in r) r.writable = true;
2307
- Object.defineProperty(e, r.key, r);
2308
- }
2309
- }
2310
- function un(e, t, n) {
2311
- if (t) sn(e.prototype, t);
2312
- if (n) sn(e, n);
2313
- return e;
2314
- }
2315
- function pn(e, t) {
2316
- if (typeof t !== "function" && t !== null) {
2317
- throw new TypeError("Super expression must either be null or a function");
2318
- }
2319
- e.prototype = Object.create(t && t.prototype, {
2320
- constructor: {
2321
- value: e,
2322
- writable: true,
2323
- configurable: true
2029
+ function zt(e, t) {
2030
+ if (null == e) return {};
2031
+ var n = {};
2032
+ for (var r in e) {
2033
+ if ({}.hasOwnProperty.call(e, r)) {
2034
+ if (t.includes(r)) continue;
2035
+ n[r] = e[r];
2036
+ }
2324
2037
  }
2325
- });
2326
- if (t) fn(e, t);
2327
- }
2328
- function fn(e, t) {
2329
- fn = Object.setPrototypeOf || function e(t, n) {
2330
- t.__proto__ = n;
2331
- return t;
2332
- };
2333
- return fn(e, t);
2334
- }
2335
- function dn(e) {
2336
- var t = bn();
2337
- return function n() {
2338
- var r = mn(e), o;
2339
- if (t) {
2340
- var i = mn(this).constructor;
2341
- o = Reflect.construct(r, arguments, i);
2342
- } else {
2343
- o = r.apply(this, arguments);
2038
+ return n;
2039
+ }
2040
+ function $t(e, t) {
2041
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
2042
+ }
2043
+ function Wt(e, t) {
2044
+ for (var n = 0; n < t.length; n++) {
2045
+ var r = t[n];
2046
+ r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
2047
+ Object.defineProperty(e, nn(r.key), r);
2344
2048
  }
2345
- return vn(this, o);
2346
- };
2347
- }
2348
- function vn(e, t) {
2349
- if (t && (rn(t) === "object" || typeof t === "function")) {
2350
- return t;
2351
- }
2352
- return hn(e);
2353
- }
2354
- function hn(e) {
2355
- if (e === void 0) {
2356
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2357
- }
2358
- return e;
2359
- }
2360
- function bn() {
2361
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
2362
- if (Reflect.construct.sham) return false;
2363
- if (typeof Proxy === "function") return true;
2364
- try {
2365
- Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
2366
- return true;
2367
- } catch (e) {
2368
- return false;
2369
- }
2370
- }
2371
- function mn(e) {
2372
- mn = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
2373
- return t.__proto__ || Object.getPrototypeOf(t);
2374
- };
2375
- return mn(e);
2376
- }
2377
- function yn(e, t, n) {
2378
- if (t in e) {
2379
- Object.defineProperty(e, t, {
2380
- value: n,
2381
- enumerable: true,
2382
- configurable: true,
2383
- writable: true
2384
- });
2385
- } else {
2386
- e[t] = n;
2387
- }
2388
- return e;
2389
- }
2390
- /* eslint-disable max-classes-per-file */
2391
- /** @public */ var gn = {
2392
- allowKeyMatching: i().bool,
2393
- animateLoading: i().bool,
2394
- appearance: i().oneOf([ "default", "link", "primary", "pill", "toggle", "flat", "subtle" ]),
2395
- append: i().bool,
2396
- children: i().node,
2397
- defaultPlacement: i().oneOf([ "above", "below", "vertical" ]),
2398
- defaultValue: i().oneOfType([ i().string, i().number, i().bool ]),
2399
- describedBy: i().string,
2400
- disabled: i().bool,
2401
- elementRef: i().oneOfType([ i().func, i().object ]),
2402
- error: i().bool,
2403
- filter: i().oneOf([ false, true, "controlled" ]),
2404
- footerMessage: i().node,
2405
- inline: i().bool,
2406
- inputId: i().string,
2407
- inputRef: i().oneOfType([ i().func, i().object ]),
2408
- isLoadingOptions: i().bool,
2409
- labelledBy: i().string,
2410
- labelText: i().string,
2411
- loadingMessage: i().node,
2412
- menuStyle: i().object,
2413
- name: i().string,
2414
- noOptionsMessage: i().node,
2415
- onChange: i().func,
2416
- onClose: i().func,
2417
- onFilterChange: i().func,
2418
- onOpen: i().func,
2419
- onScroll: i().func,
2420
- onScrollBottom: i().func,
2421
- placeholder: i().string,
2422
- prefixLabel: i().string,
2423
- prepend: i().bool,
2424
- suffixLabel: i().string,
2425
- toggleContent: i().oneOf([ "optionChildren", "optionLabel" ]),
2426
- /** @private. */
2427
- toggle: i().node,
2428
- value: i().oneOfType([ i().string, i().number, i().bool ]),
2429
- /** @private. */
2430
- virtualization: i().number
2431
- };
2432
- var On = {
2433
- allowKeyMatching: true,
2434
- animateLoading: false,
2435
- appearance: "toggle",
2436
- append: false,
2437
- children: [],
2438
- defaultPlacement: "vertical",
2439
- disabled: false,
2440
- error: false,
2441
- filter: false,
2442
- inline: true,
2443
- isLoadingOptions: false,
2444
- menuStyle: {},
2445
- noOptionsMessage: (0, c._)("No matches"),
2446
- placeholder: (0, c._)("Select..."),
2447
- prepend: false,
2448
- toggleContent: "optionChildren"
2449
- };
2450
- var Sn = function(e) {
2451
- pn(n, e);
2452
- var t = dn(n);
2453
- // @docs-props-type SelectPropsBase
2454
- function n(e) {
2455
- var r;
2456
- cn(this, n);
2457
- r = t.call(this, e);
2458
- var o = {};
2459
- // wrap defaultValue in an array once to avoid failing <SelectBase>'s defaultValues comparison check
2460
- // using "has" to make sure that pre-4.3 behavior is preserved if a user explicitly passes "null" or "undefined"
2461
- if (l()(e, "defaultValue")) {
2462
- if (e.defaultValue != null) {
2463
- o.defaultValues = [ e.defaultValue ];
2464
- } else {
2465
- o.defaultValues = [];
2049
+ }
2050
+ function Ut(e, t, n) {
2051
+ return t && Wt(e.prototype, t), n && Wt(e, n), Object.defineProperty(e, "prototype", {
2052
+ writable: !1
2053
+ }), e;
2054
+ }
2055
+ function Jt(e, t) {
2056
+ if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
2057
+ e.prototype = Object.create(t && t.prototype, {
2058
+ constructor: {
2059
+ value: e,
2060
+ writable: !0,
2061
+ configurable: !0
2466
2062
  }
2467
- }
2468
- r.state = o;
2469
- // `this.props.appearance === 'toggle'` is not included here because it is the default value.
2470
- // Including it would trigger a warning for every instance of using `Select`.
2471
- if (false) {}
2472
- return r;
2063
+ }), Object.defineProperty(e, "prototype", {
2064
+ writable: !1
2065
+ }), t && Xt(e, t);
2473
2066
  }
2474
- un(n, [ {
2475
- key: "componentDidUpdate",
2476
- value: function e(t) {
2477
- if (false) {}
2067
+ function Xt(e, t) {
2068
+ return Xt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
2069
+ return e.__proto__ = t, e;
2070
+ }, Xt(e, t);
2071
+ }
2072
+ function Gt(e) {
2073
+ var t = Zt();
2074
+ return function() {
2075
+ var n, r = en(e);
2076
+ if (t) {
2077
+ var o = en(this).constructor;
2078
+ n = Reflect.construct(r, arguments, o);
2079
+ } else n = r.apply(this, arguments);
2080
+ return Qt(this, n);
2081
+ };
2082
+ }
2083
+ function Qt(e, t) {
2084
+ if (t && ("object" == Kt(t) || "function" == typeof t)) return t;
2085
+ if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
2086
+ return Yt(e);
2087
+ }
2088
+ function Yt(e) {
2089
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2090
+ return e;
2091
+ }
2092
+ function Zt() {
2093
+ try {
2094
+ var e = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
2095
+ } catch (e) {}
2096
+ return (Zt = function t() {
2097
+ return !!e;
2098
+ })();
2099
+ }
2100
+ function en(e) {
2101
+ return en = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
2102
+ return e.__proto__ || Object.getPrototypeOf(e);
2103
+ }, en(e);
2104
+ }
2105
+ function tn(e, t, n) {
2106
+ return (t = nn(t)) in e ? Object.defineProperty(e, t, {
2107
+ value: n,
2108
+ enumerable: !0,
2109
+ configurable: !0,
2110
+ writable: !0
2111
+ }) : e[t] = n, e;
2112
+ }
2113
+ function nn(e) {
2114
+ var t = rn(e, "string");
2115
+ return "symbol" == Kt(t) ? t : t + "";
2116
+ }
2117
+ function rn(e, t) {
2118
+ if ("object" != Kt(e) || !e) return e;
2119
+ var n = e[Symbol.toPrimitive];
2120
+ if (void 0 !== n) {
2121
+ var r = n.call(e, t || "default");
2122
+ if ("object" != Kt(r)) return r;
2123
+ throw new TypeError("@@toPrimitive must return a primitive value.");
2478
2124
  }
2479
- }, {
2480
- key: "render",
2481
- value: function e() {
2482
- var t = this.props, n = t.defaultValue, o = t.onChange, i = t.value, a = an(t, [ "defaultValue", "onChange", "value" ]);
2483
- var c = {
2484
- onChange: function e(t, n) {
2485
- var r = n.name, i = n.values;
2486
- o === null || o === void 0 ? void 0 : o(t, {
2487
- name: r,
2488
- value: i[0]
2489
- });
2490
- }
2491
- };
2492
- // using "has" as opposed to a null check to match SelectBase
2493
- if (l()(this.props, "value")) {
2494
- if (i != null) {
2495
- c.values = [ i ];
2125
+ return ("string" === t ? String : Number)(e);
2126
+ }
2127
+ /* eslint-disable max-classes-per-file */
2128
+ /** @public */
2129
+ /** @public */
2130
+ /** @public */ var on = {
2131
+ allowKeyMatching: l().bool,
2132
+ animateLoading: l().bool,
2133
+ appearance: l().oneOf([ "default", "link", "primary", "pill", "toggle", "flat", "subtle" ]),
2134
+ append: l().bool,
2135
+ children: l().node,
2136
+ defaultPlacement: l().oneOf([ "above", "below", "vertical" ]),
2137
+ defaultValue: l().oneOfType([ l().string, l().number, l().bool ]),
2138
+ describedBy: l().string,
2139
+ disabled: l().bool,
2140
+ elementRef: l().oneOfType([ l().func, l().object ]),
2141
+ error: l().bool,
2142
+ filter: l().oneOf([ false, true, "controlled" ]),
2143
+ footerMessage: l().node,
2144
+ inline: l().bool,
2145
+ inputId: l().string,
2146
+ inputRef: l().oneOfType([ l().func, l().object ]),
2147
+ isLoadingOptions: l().bool,
2148
+ labelledBy: l().string,
2149
+ labelText: l().string,
2150
+ loadingMessage: l().node,
2151
+ menuStyle: l().object,
2152
+ name: l().string,
2153
+ noOptionsMessage: l().node,
2154
+ onChange: l().func,
2155
+ onClose: l().func,
2156
+ onFilterChange: l().func,
2157
+ onOpen: l().func,
2158
+ onScroll: l().func,
2159
+ onScrollBottom: l().func,
2160
+ placeholder: l().string,
2161
+ prefixLabel: l().string,
2162
+ prepend: l().bool,
2163
+ suffixLabel: l().string,
2164
+ toggleContent: l().oneOf([ "optionChildren", "optionLabel" ]),
2165
+ /** @private. */
2166
+ toggle: l().node,
2167
+ value: l().oneOfType([ l().string, l().number, l().bool ]),
2168
+ /** @private. */
2169
+ virtualization: l().number
2170
+ };
2171
+ var ln = {
2172
+ allowKeyMatching: true,
2173
+ animateLoading: false,
2174
+ appearance: "toggle",
2175
+ append: false,
2176
+ children: [],
2177
+ defaultPlacement: "vertical",
2178
+ disabled: false,
2179
+ error: false,
2180
+ filter: false,
2181
+ inline: true,
2182
+ isLoadingOptions: false,
2183
+ menuStyle: {},
2184
+ noOptionsMessage: (0, u._)("No matches"),
2185
+ placeholder: (0, u._)("Select..."),
2186
+ prepend: false,
2187
+ toggleContent: "optionChildren"
2188
+ };
2189
+ var an = function(e) {
2190
+ Jt(r, e);
2191
+ var n = Gt(r);
2192
+ // @docs-props-type SelectPropsBase
2193
+ function r(e) {
2194
+ var t;
2195
+ $t(this, r);
2196
+ t = n.call(this, e);
2197
+ var o = {};
2198
+ // wrap defaultValue in an array once to avoid failing <SelectBase>'s defaultValues comparison check
2199
+ // using "has" to make sure that pre-4.3 behavior is preserved if a user explicitly passes "null" or "undefined"
2200
+ if (i()(e, "defaultValue")) {
2201
+ if (e.defaultValue != null) {
2202
+ o.defaultValues = [ e.defaultValue ];
2496
2203
  } else {
2497
- c.values = [];
2204
+ o.defaultValues = [];
2498
2205
  }
2499
- } else if (this.state.defaultValues != null) {
2500
- // using defaultValues from state in order to avoid wrapping defaultValue here
2501
- c.defaultValues = this.state.defaultValues;
2502
2206
  }
2503
-
2504
- return r().createElement(Nt, on({}, a, c, {
2505
- multiple: false
2506
- }));
2207
+ t.state = o;
2208
+ // `this.props.appearance === 'toggle'` is not included here because it is the default value.
2209
+ // Including it would trigger a warning for every instance of using `Select`.
2210
+ if (false) {}
2211
+ return t;
2507
2212
  }
2508
- } ]);
2509
- return n;
2510
- }(n.Component);
2511
- yn(Sn, "propTypes", gn);
2512
- yn(Sn, "defaultProps", On);
2513
- yn(Sn, "Option", nn);
2514
- yn(Sn, "Heading", T.Heading);
2515
- yn(Sn, "Divider", T.Divider);
2516
- /* harmony default export */ const wn = Sn;
2517
- // CONCATENATED MODULE: ./src/Select/index.ts
2518
- module.exports = t;
2213
+ Ut(r, [ {
2214
+ key: "componentDidUpdate",
2215
+ value: function e(t) {
2216
+ if (false) {}
2217
+ }
2218
+ }, {
2219
+ key: "render",
2220
+ value: function e() {
2221
+ var n = this.props, r = n.defaultValue, o = n.onChange, l = n.value, a = Ht(n, [ "defaultValue", "onChange", "value" ]);
2222
+ var u = {
2223
+ onChange: function e(t, n) {
2224
+ var r = n.name, l = n.values;
2225
+ o === null || o === void 0 ? void 0 : o(t, {
2226
+ name: r,
2227
+ value: l[0]
2228
+ });
2229
+ }
2230
+ };
2231
+ // using "has" as opposed to a null check to match SelectBase
2232
+ if (i()(this.props, "value")) {
2233
+ if (l != null) {
2234
+ u.values = [ l ];
2235
+ } else {
2236
+ u.values = [];
2237
+ }
2238
+ } else if (this.state.defaultValues != null) {
2239
+ // using defaultValues from state in order to avoid wrapping defaultValue here
2240
+ u.defaultValues = this.state.defaultValues;
2241
+ }
2242
+
2243
+ return t().createElement(wt, Ft({}, a, u, {
2244
+ multiple: false
2245
+ }));
2246
+ }
2247
+ } ]);
2248
+ return r;
2249
+ }(e.Component);
2250
+ tn(an, "propTypes", on);
2251
+ tn(an, "defaultProps", ln);
2252
+ tn(an, "Option", Nt);
2253
+ tn(an, "Heading", A.Heading);
2254
+ tn(an, "Divider", A.Divider);
2255
+ /* harmony default export */ const un = an;
2256
+ }) // CONCATENATED MODULE: ./src/Select/index.ts
2257
+ ();
2258
+ module.exports = r;
2519
2259
  /******/})();