@eightshift/ui-components 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/README.md +27 -0
  2. package/dist/Checkbox-BLcVbhiO.js +178 -0
  3. package/dist/ColorSwatch-Cmlex_kT.js +66 -0
  4. package/dist/FieldError-wtMA4667.js +42 -0
  5. package/dist/FocusScope-1u9yyfIN.js +725 -0
  6. package/dist/Form-Cq3fu75_.js +5 -0
  7. package/dist/GridList-BZPXp3_O.js +1256 -0
  8. package/dist/Group-DyqpTRPe.js +49 -0
  9. package/dist/Input-jsbb4ugq.js +130 -0
  10. package/dist/Label-BPzS-sR7.js +17 -0
  11. package/dist/ListBox-w9gDaJkV.js +4423 -0
  12. package/dist/LiveAnnouncer-IsokfWQ5.js +73 -0
  13. package/dist/NumberFormatter-LzoKy975.js +160 -0
  14. package/dist/RSPContexts-CrNYmadY.js +14 -0
  15. package/dist/Select-49a62830.esm-C-RFtLiD.js +2541 -0
  16. package/dist/SelectionManager-mefd0ThJ.js +2155 -0
  17. package/dist/Separator-DHn0CwdK.js +325 -0
  18. package/dist/Slider-Pyh2V4bY.js +885 -0
  19. package/dist/Text-BM136LvS.js +17 -0
  20. package/dist/VisuallyHidden-BYRI1Lfo.js +51 -0
  21. package/dist/_commonjsHelpers-CUmg6egw.js +6 -0
  22. package/dist/ariaHideOutside-ByKBPHmX.js +113 -0
  23. package/dist/assets/style.css +1 -0
  24. package/dist/button-BkkdyHfJ.js +307 -0
  25. package/dist/components/animated-visibility/animated-visibility.js +7165 -0
  26. package/dist/components/base-control/base-control.js +97 -0
  27. package/dist/components/breakpoint-preview/breakpoint-preview.js +218 -0
  28. package/dist/components/button/button.js +10 -0
  29. package/dist/components/checkbox/checkbox.js +119 -0
  30. package/dist/components/color-pickers/color-picker.js +242 -0
  31. package/dist/components/color-pickers/color-swatch.js +62 -0
  32. package/dist/components/color-pickers/gradient-editor.js +516 -0
  33. package/dist/components/color-pickers/solid-color-picker.js +1633 -0
  34. package/dist/components/component-toggle/component-toggle.js +71 -0
  35. package/dist/components/container-panel/container-panel.js +39 -0
  36. package/dist/components/expandable/expandable.js +144 -0
  37. package/dist/components/input-field/input-field.js +224 -0
  38. package/dist/components/link-input/link-input.js +937 -0
  39. package/dist/components/list-box/list-box.js +152 -0
  40. package/dist/components/matrix-align/matrix-align.js +185 -0
  41. package/dist/components/menu/menu.js +1608 -0
  42. package/dist/components/notice/notice.js +119 -0
  43. package/dist/components/number-picker/number-picker.js +277 -0
  44. package/dist/components/popover/popover.js +9 -0
  45. package/dist/components/radio/radio.js +552 -0
  46. package/dist/components/repeater/repeater-item.js +127 -0
  47. package/dist/components/repeater/repeater.js +248 -0
  48. package/dist/components/responsive/responsive-legacy.js +326 -0
  49. package/dist/components/responsive/responsive.js +499 -0
  50. package/dist/components/responsive-preview/responsive-preview.js +119 -0
  51. package/dist/components/rich-label/rich-label.js +56 -0
  52. package/dist/components/select/async-multi-select.js +144 -0
  53. package/dist/components/select/async-single-select.js +126 -0
  54. package/dist/components/select/custom-select-default-components.js +38 -0
  55. package/dist/components/select/multi-select-components.js +8 -0
  56. package/dist/components/select/multi-select.js +134 -0
  57. package/dist/components/select/react-select-component-wrappers.js +90 -0
  58. package/dist/components/select/shared.js +45 -0
  59. package/dist/components/select/single-select.js +116 -0
  60. package/dist/components/select/styles.js +55 -0
  61. package/dist/components/slider/column-config-slider.js +225 -0
  62. package/dist/components/slider/slider.js +362 -0
  63. package/dist/components/slider/utils.js +45 -0
  64. package/dist/components/spacer/spacer.js +93 -0
  65. package/dist/components/tabs/tabs.js +626 -0
  66. package/dist/components/toggle/switch.js +140 -0
  67. package/dist/components/toggle/toggle.js +58 -0
  68. package/dist/components/toggle-button/toggle-button.js +206 -0
  69. package/dist/components/tooltip/tooltip.js +10 -0
  70. package/dist/context-jMy6xdVq.js +98 -0
  71. package/dist/default-i18n-BhE-OUmt.js +873 -0
  72. package/dist/filterDOMProps-DG2RfOUr.js +30 -0
  73. package/dist/focusSafely-C3K8zAKj.js +743 -0
  74. package/dist/hooks/use-cell-edit-mode.js +35 -0
  75. package/dist/icons/block-icon.js +42 -0
  76. package/dist/icons/generic-color-swatch.js +21 -0
  77. package/dist/icons/icons.js +3636 -0
  78. package/dist/index-Bfb9bWcb.js +28844 -0
  79. package/dist/index-a301f526.esm-Bioi4cGX.js +3576 -0
  80. package/dist/index.js +109 -0
  81. package/dist/intlStrings-CUhoK9EN.js +2484 -0
  82. package/dist/isScrollable-PcyglExV.js +10 -0
  83. package/dist/modifiers.esm-BuJQPI1X.js +31 -0
  84. package/dist/multi-select-components-CjVpCNko.js +3677 -0
  85. package/dist/number-rWqELA8W.js +39 -0
  86. package/dist/popover-Dx3vKXUX.js +1061 -0
  87. package/dist/react-select-async.esm-TFb_ZX6C.js +111 -0
  88. package/dist/react-select.esm-BjRWqf0E.js +15 -0
  89. package/dist/style.js +1 -0
  90. package/dist/textSelection-BosCCRVE.js +89 -0
  91. package/dist/tooltip-CkCndvTI.js +1094 -0
  92. package/dist/useButton-CuG5UzUw.js +74 -0
  93. package/dist/useEvent-DHv-yhOH.js +24 -0
  94. package/dist/useFocusRing-Cc-4eouh.js +41 -0
  95. package/dist/useFocusable-5q1Gek1J.js +81 -0
  96. package/dist/useFormReset-Buc9YJcv.js +23 -0
  97. package/dist/useFormValidationState-BAPPNXic.js +238 -0
  98. package/dist/useHasTabbableChild-D3uUNhJ0.js +37 -0
  99. package/dist/useLabel-CGlkoFG0.js +28 -0
  100. package/dist/useLabels-Dg62M_3P.js +25 -0
  101. package/dist/useListData-BelKu4kx.js +211 -0
  102. package/dist/useListState-Domq0blV.js +137 -0
  103. package/dist/useLocalizedStringFormatter-Prmz0h0A.js +130 -0
  104. package/dist/useNumberFieldState-BLU3uhSR.js +1253 -0
  105. package/dist/useNumberFormatter-BLc2xjZn.js +13 -0
  106. package/dist/usePress-BQgVor4T.js +698 -0
  107. package/dist/useToggle-C9ETOBaZ.js +58 -0
  108. package/dist/useToggleState-DJ_z5E2S.js +21 -0
  109. package/dist/utilities/classnames.js +16 -0
  110. package/dist/utilities/text-helpers.js +79 -0
  111. package/dist/utils-BsiH7-5Y.js +488 -0
  112. package/package.json +71 -0
@@ -0,0 +1,2541 @@
1
+ import { a as _objectWithoutProperties, b as _slicedToArray, d as _objectSpread2, t as toPropertyKey, f as _typeof, g as _arrayLikeToArray, i as _unsupportedIterableToArray, j as isTouchCapable, k as isMobileDevice, m as multiValueAsValue, s as singleValueAsValue, v as valueTernary, l as classNames, n as defaultComponents, o as isDocumentElement, p as cleanValue, q as scrollIntoView, _ as _extends, r as noop, M as MenuPlacer, u as removeProps, w as jsx, x as css, y as clearIndicatorCSS, z as containerCSS, A as css$1, B as dropdownIndicatorCSS, C as groupCSS, D as groupHeadingCSS, E as indicatorsContainerCSS, F as indicatorSeparatorCSS, G as inputCSS, H as loadingIndicatorCSS, I as loadingMessageCSS, J as menuCSS, K as menuListCSS, L as menuPortalCSS, N as multiValueCSS, O as multiValueLabelCSS, P as multiValueRemoveCSS, Q as noOptionsMessageCSS, R as optionCSS, S as placeholderCSS, T as css$2, U as valueContainerCSS, V as notNullish, W as supportsPassiveEvents } from "./index-a301f526.esm-Bioi4cGX.js";
2
+ import * as React from "react";
3
+ import { useState, useCallback, Component, Fragment, useMemo, useRef, useEffect } from "react";
4
+ var _excluded$1 = ["defaultInputValue", "defaultMenuIsOpen", "defaultValue", "inputValue", "menuIsOpen", "onChange", "onInputChange", "onMenuClose", "onMenuOpen", "value"];
5
+ function useStateManager(_ref3) {
6
+ var _ref$defaultInputValu = _ref3.defaultInputValue, defaultInputValue = _ref$defaultInputValu === void 0 ? "" : _ref$defaultInputValu, _ref$defaultMenuIsOpe = _ref3.defaultMenuIsOpen, defaultMenuIsOpen = _ref$defaultMenuIsOpe === void 0 ? false : _ref$defaultMenuIsOpe, _ref$defaultValue = _ref3.defaultValue, defaultValue = _ref$defaultValue === void 0 ? null : _ref$defaultValue, propsInputValue = _ref3.inputValue, propsMenuIsOpen = _ref3.menuIsOpen, propsOnChange = _ref3.onChange, propsOnInputChange = _ref3.onInputChange, propsOnMenuClose = _ref3.onMenuClose, propsOnMenuOpen = _ref3.onMenuOpen, propsValue = _ref3.value, restSelectProps = _objectWithoutProperties(_ref3, _excluded$1);
7
+ var _useState = useState(propsInputValue !== void 0 ? propsInputValue : defaultInputValue), _useState2 = _slicedToArray(_useState, 2), stateInputValue = _useState2[0], setStateInputValue = _useState2[1];
8
+ var _useState3 = useState(propsMenuIsOpen !== void 0 ? propsMenuIsOpen : defaultMenuIsOpen), _useState4 = _slicedToArray(_useState3, 2), stateMenuIsOpen = _useState4[0], setStateMenuIsOpen = _useState4[1];
9
+ var _useState5 = useState(propsValue !== void 0 ? propsValue : defaultValue), _useState6 = _slicedToArray(_useState5, 2), stateValue = _useState6[0], setStateValue = _useState6[1];
10
+ var onChange2 = useCallback(function(value2, actionMeta) {
11
+ if (typeof propsOnChange === "function") {
12
+ propsOnChange(value2, actionMeta);
13
+ }
14
+ setStateValue(value2);
15
+ }, [propsOnChange]);
16
+ var onInputChange = useCallback(function(value2, actionMeta) {
17
+ var newValue;
18
+ if (typeof propsOnInputChange === "function") {
19
+ newValue = propsOnInputChange(value2, actionMeta);
20
+ }
21
+ setStateInputValue(newValue !== void 0 ? newValue : value2);
22
+ }, [propsOnInputChange]);
23
+ var onMenuOpen = useCallback(function() {
24
+ if (typeof propsOnMenuOpen === "function") {
25
+ propsOnMenuOpen();
26
+ }
27
+ setStateMenuIsOpen(true);
28
+ }, [propsOnMenuOpen]);
29
+ var onMenuClose = useCallback(function() {
30
+ if (typeof propsOnMenuClose === "function") {
31
+ propsOnMenuClose();
32
+ }
33
+ setStateMenuIsOpen(false);
34
+ }, [propsOnMenuClose]);
35
+ var inputValue = propsInputValue !== void 0 ? propsInputValue : stateInputValue;
36
+ var menuIsOpen = propsMenuIsOpen !== void 0 ? propsMenuIsOpen : stateMenuIsOpen;
37
+ var value = propsValue !== void 0 ? propsValue : stateValue;
38
+ return _objectSpread2(_objectSpread2({}, restSelectProps), {}, {
39
+ inputValue,
40
+ menuIsOpen,
41
+ onChange: onChange2,
42
+ onInputChange,
43
+ onMenuClose,
44
+ onMenuOpen,
45
+ value
46
+ });
47
+ }
48
+ function _classCallCheck(instance, Constructor) {
49
+ if (!(instance instanceof Constructor)) {
50
+ throw new TypeError("Cannot call a class as a function");
51
+ }
52
+ }
53
+ function _defineProperties(target, props) {
54
+ for (var i = 0; i < props.length; i++) {
55
+ var descriptor = props[i];
56
+ descriptor.enumerable = descriptor.enumerable || false;
57
+ descriptor.configurable = true;
58
+ if ("value" in descriptor)
59
+ descriptor.writable = true;
60
+ Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);
61
+ }
62
+ }
63
+ function _createClass(Constructor, protoProps, staticProps) {
64
+ if (protoProps)
65
+ _defineProperties(Constructor.prototype, protoProps);
66
+ if (staticProps)
67
+ _defineProperties(Constructor, staticProps);
68
+ Object.defineProperty(Constructor, "prototype", {
69
+ writable: false
70
+ });
71
+ return Constructor;
72
+ }
73
+ function _setPrototypeOf(o, p) {
74
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
75
+ o2.__proto__ = p2;
76
+ return o2;
77
+ };
78
+ return _setPrototypeOf(o, p);
79
+ }
80
+ function _inherits(subClass, superClass) {
81
+ if (typeof superClass !== "function" && superClass !== null) {
82
+ throw new TypeError("Super expression must either be null or a function");
83
+ }
84
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
85
+ constructor: {
86
+ value: subClass,
87
+ writable: true,
88
+ configurable: true
89
+ }
90
+ });
91
+ Object.defineProperty(subClass, "prototype", {
92
+ writable: false
93
+ });
94
+ if (superClass)
95
+ _setPrototypeOf(subClass, superClass);
96
+ }
97
+ function _getPrototypeOf(o) {
98
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) {
99
+ return o2.__proto__ || Object.getPrototypeOf(o2);
100
+ };
101
+ return _getPrototypeOf(o);
102
+ }
103
+ function _isNativeReflectConstruct() {
104
+ try {
105
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
106
+ }));
107
+ } catch (t2) {
108
+ }
109
+ return (_isNativeReflectConstruct = function _isNativeReflectConstruct2() {
110
+ return !!t;
111
+ })();
112
+ }
113
+ function _assertThisInitialized(self) {
114
+ if (self === void 0) {
115
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
116
+ }
117
+ return self;
118
+ }
119
+ function _possibleConstructorReturn(self, call) {
120
+ if (call && (_typeof(call) === "object" || typeof call === "function")) {
121
+ return call;
122
+ } else if (call !== void 0) {
123
+ throw new TypeError("Derived constructors may only return object or undefined");
124
+ }
125
+ return _assertThisInitialized(self);
126
+ }
127
+ function _createSuper(Derived) {
128
+ var hasNativeReflectConstruct = _isNativeReflectConstruct();
129
+ return function _createSuperInternal() {
130
+ var Super = _getPrototypeOf(Derived), result;
131
+ if (hasNativeReflectConstruct) {
132
+ var NewTarget = _getPrototypeOf(this).constructor;
133
+ result = Reflect.construct(Super, arguments, NewTarget);
134
+ } else {
135
+ result = Super.apply(this, arguments);
136
+ }
137
+ return _possibleConstructorReturn(this, result);
138
+ };
139
+ }
140
+ function _arrayWithoutHoles(arr) {
141
+ if (Array.isArray(arr))
142
+ return _arrayLikeToArray(arr);
143
+ }
144
+ function _iterableToArray(iter) {
145
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
146
+ return Array.from(iter);
147
+ }
148
+ function _nonIterableSpread() {
149
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
150
+ }
151
+ function _toConsumableArray(arr) {
152
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
153
+ }
154
+ var safeIsNaN = Number.isNaN || function ponyfill(value) {
155
+ return typeof value === "number" && value !== value;
156
+ };
157
+ function isEqual(first, second) {
158
+ if (first === second) {
159
+ return true;
160
+ }
161
+ if (safeIsNaN(first) && safeIsNaN(second)) {
162
+ return true;
163
+ }
164
+ return false;
165
+ }
166
+ function areInputsEqual(newInputs, lastInputs) {
167
+ if (newInputs.length !== lastInputs.length) {
168
+ return false;
169
+ }
170
+ for (var i = 0; i < newInputs.length; i++) {
171
+ if (!isEqual(newInputs[i], lastInputs[i])) {
172
+ return false;
173
+ }
174
+ }
175
+ return true;
176
+ }
177
+ function memoizeOne(resultFn, isEqual2) {
178
+ if (isEqual2 === void 0) {
179
+ isEqual2 = areInputsEqual;
180
+ }
181
+ var cache = null;
182
+ function memoized() {
183
+ var newArgs = [];
184
+ for (var _i = 0; _i < arguments.length; _i++) {
185
+ newArgs[_i] = arguments[_i];
186
+ }
187
+ if (cache && cache.lastThis === this && isEqual2(newArgs, cache.lastArgs)) {
188
+ return cache.lastResult;
189
+ }
190
+ var lastResult = resultFn.apply(this, newArgs);
191
+ cache = {
192
+ lastResult,
193
+ lastArgs: newArgs,
194
+ lastThis: this
195
+ };
196
+ return lastResult;
197
+ }
198
+ memoized.clear = function clear() {
199
+ cache = null;
200
+ };
201
+ return memoized;
202
+ }
203
+ function _EMOTION_STRINGIFIED_CSS_ERROR__$2() {
204
+ return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).";
205
+ }
206
+ var _ref = process.env.NODE_ENV === "production" ? {
207
+ name: "7pg0cj-a11yText",
208
+ styles: "label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap"
209
+ } : {
210
+ name: "1f43avz-a11yText-A11yText",
211
+ styles: "label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap;label:A11yText;",
212
+ map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkExMXlUZXh0LnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFNSSIsImZpbGUiOiJBMTF5VGV4dC50c3giLCJzb3VyY2VzQ29udGVudCI6WyIvKiogQGpzeCBqc3ggKi9cbmltcG9ydCB7IGpzeCB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcblxuLy8gQXNzaXN0aXZlIHRleHQgdG8gZGVzY3JpYmUgdmlzdWFsIGVsZW1lbnRzLiBIaWRkZW4gZm9yIHNpZ2h0ZWQgdXNlcnMuXG5jb25zdCBBMTF5VGV4dCA9IChwcm9wczogSlNYLkludHJpbnNpY0VsZW1lbnRzWydzcGFuJ10pID0+IChcbiAgPHNwYW5cbiAgICBjc3M9e3tcbiAgICAgIGxhYmVsOiAnYTExeVRleHQnLFxuICAgICAgekluZGV4OiA5OTk5LFxuICAgICAgYm9yZGVyOiAwLFxuICAgICAgY2xpcDogJ3JlY3QoMXB4LCAxcHgsIDFweCwgMXB4KScsXG4gICAgICBoZWlnaHQ6IDEsXG4gICAgICB3aWR0aDogMSxcbiAgICAgIHBvc2l0aW9uOiAnYWJzb2x1dGUnLFxuICAgICAgb3ZlcmZsb3c6ICdoaWRkZW4nLFxuICAgICAgcGFkZGluZzogMCxcbiAgICAgIHdoaXRlU3BhY2U6ICdub3dyYXAnLFxuICAgIH19XG4gICAgey4uLnByb3BzfVxuICAvPlxuKTtcblxuZXhwb3J0IGRlZmF1bHQgQTExeVRleHQ7XG4iXX0= */",
213
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__$2
214
+ };
215
+ var A11yText = function A11yText2(props) {
216
+ return jsx("span", _extends({
217
+ css: _ref
218
+ }, props));
219
+ };
220
+ var A11yText$1 = A11yText;
221
+ var defaultAriaLiveMessages = {
222
+ guidance: function guidance(props) {
223
+ var isSearchable = props.isSearchable, isMulti = props.isMulti, tabSelectsValue = props.tabSelectsValue, context = props.context, isInitialFocus = props.isInitialFocus;
224
+ switch (context) {
225
+ case "menu":
226
+ return "Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu".concat(tabSelectsValue ? ", press Tab to select the option and exit the menu" : "", ".");
227
+ case "input":
228
+ return isInitialFocus ? "".concat(props["aria-label"] || "Select", " is focused ").concat(isSearchable ? ",type to refine list" : "", ", press Down to open the menu, ").concat(isMulti ? " press left to focus selected values" : "") : "";
229
+ case "value":
230
+ return "Use left and right to toggle between focused values, press Backspace to remove the currently focused value";
231
+ default:
232
+ return "";
233
+ }
234
+ },
235
+ onChange: function onChange(props) {
236
+ var action = props.action, _props$label = props.label, label = _props$label === void 0 ? "" : _props$label, labels = props.labels, isDisabled = props.isDisabled;
237
+ switch (action) {
238
+ case "deselect-option":
239
+ case "pop-value":
240
+ case "remove-value":
241
+ return "option ".concat(label, ", deselected.");
242
+ case "clear":
243
+ return "All selected options have been cleared.";
244
+ case "initial-input-focus":
245
+ return "option".concat(labels.length > 1 ? "s" : "", " ").concat(labels.join(","), ", selected.");
246
+ case "select-option":
247
+ return isDisabled ? "option ".concat(label, " is disabled. Select another option.") : "option ".concat(label, ", selected.");
248
+ default:
249
+ return "";
250
+ }
251
+ },
252
+ onFocus: function onFocus(props) {
253
+ var context = props.context, focused = props.focused, options = props.options, _props$label2 = props.label, label = _props$label2 === void 0 ? "" : _props$label2, selectValue = props.selectValue, isDisabled = props.isDisabled, isSelected = props.isSelected, isAppleDevice2 = props.isAppleDevice;
254
+ var getArrayIndex = function getArrayIndex2(arr, item) {
255
+ return arr && arr.length ? "".concat(arr.indexOf(item) + 1, " of ").concat(arr.length) : "";
256
+ };
257
+ if (context === "value" && selectValue) {
258
+ return "value ".concat(label, " focused, ").concat(getArrayIndex(selectValue, focused), ".");
259
+ }
260
+ if (context === "menu" && isAppleDevice2) {
261
+ var disabled = isDisabled ? " disabled" : "";
262
+ var status = "".concat(isSelected ? " selected" : "").concat(disabled);
263
+ return "".concat(label).concat(status, ", ").concat(getArrayIndex(options, focused), ".");
264
+ }
265
+ return "";
266
+ },
267
+ onFilter: function onFilter(props) {
268
+ var inputValue = props.inputValue, resultsMessage = props.resultsMessage;
269
+ return "".concat(resultsMessage).concat(inputValue ? " for search term " + inputValue : "", ".");
270
+ }
271
+ };
272
+ var LiveRegion = function LiveRegion2(props) {
273
+ var ariaSelection = props.ariaSelection, focusedOption = props.focusedOption, focusedValue = props.focusedValue, focusableOptions = props.focusableOptions, isFocused = props.isFocused, selectValue = props.selectValue, selectProps = props.selectProps, id = props.id, isAppleDevice2 = props.isAppleDevice;
274
+ var ariaLiveMessages = selectProps.ariaLiveMessages, getOptionLabel4 = selectProps.getOptionLabel, inputValue = selectProps.inputValue, isMulti = selectProps.isMulti, isOptionDisabled3 = selectProps.isOptionDisabled, isSearchable = selectProps.isSearchable, menuIsOpen = selectProps.menuIsOpen, options = selectProps.options, screenReaderStatus2 = selectProps.screenReaderStatus, tabSelectsValue = selectProps.tabSelectsValue, isLoading = selectProps.isLoading;
275
+ var ariaLabel = selectProps["aria-label"];
276
+ var ariaLive = selectProps["aria-live"];
277
+ var messages = useMemo(function() {
278
+ return _objectSpread2(_objectSpread2({}, defaultAriaLiveMessages), ariaLiveMessages || {});
279
+ }, [ariaLiveMessages]);
280
+ var ariaSelected = useMemo(function() {
281
+ var message = "";
282
+ if (ariaSelection && messages.onChange) {
283
+ var option = ariaSelection.option, selectedOptions = ariaSelection.options, removedValue = ariaSelection.removedValue, removedValues = ariaSelection.removedValues, value = ariaSelection.value;
284
+ var asOption = function asOption2(val) {
285
+ return !Array.isArray(val) ? val : null;
286
+ };
287
+ var selected = removedValue || option || asOption(value);
288
+ var label = selected ? getOptionLabel4(selected) : "";
289
+ var multiSelected = selectedOptions || removedValues || void 0;
290
+ var labels = multiSelected ? multiSelected.map(getOptionLabel4) : [];
291
+ var onChangeProps = _objectSpread2({
292
+ // multiSelected items are usually items that have already been selected
293
+ // or set by the user as a default value so we assume they are not disabled
294
+ isDisabled: selected && isOptionDisabled3(selected, selectValue),
295
+ label,
296
+ labels
297
+ }, ariaSelection);
298
+ message = messages.onChange(onChangeProps);
299
+ }
300
+ return message;
301
+ }, [ariaSelection, messages, isOptionDisabled3, selectValue, getOptionLabel4]);
302
+ var ariaFocused = useMemo(function() {
303
+ var focusMsg = "";
304
+ var focused = focusedOption || focusedValue;
305
+ var isSelected = !!(focusedOption && selectValue && selectValue.includes(focusedOption));
306
+ if (focused && messages.onFocus) {
307
+ var onFocusProps = {
308
+ focused,
309
+ label: getOptionLabel4(focused),
310
+ isDisabled: isOptionDisabled3(focused, selectValue),
311
+ isSelected,
312
+ options: focusableOptions,
313
+ context: focused === focusedOption ? "menu" : "value",
314
+ selectValue,
315
+ isAppleDevice: isAppleDevice2
316
+ };
317
+ focusMsg = messages.onFocus(onFocusProps);
318
+ }
319
+ return focusMsg;
320
+ }, [focusedOption, focusedValue, getOptionLabel4, isOptionDisabled3, messages, focusableOptions, selectValue, isAppleDevice2]);
321
+ var ariaResults = useMemo(function() {
322
+ var resultsMsg = "";
323
+ if (menuIsOpen && options.length && !isLoading && messages.onFilter) {
324
+ var resultsMessage = screenReaderStatus2({
325
+ count: focusableOptions.length
326
+ });
327
+ resultsMsg = messages.onFilter({
328
+ inputValue,
329
+ resultsMessage
330
+ });
331
+ }
332
+ return resultsMsg;
333
+ }, [focusableOptions, inputValue, menuIsOpen, messages, options, screenReaderStatus2, isLoading]);
334
+ var isInitialFocus = (ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === "initial-input-focus";
335
+ var ariaGuidance = useMemo(function() {
336
+ var guidanceMsg = "";
337
+ if (messages.guidance) {
338
+ var context = focusedValue ? "value" : menuIsOpen ? "menu" : "input";
339
+ guidanceMsg = messages.guidance({
340
+ "aria-label": ariaLabel,
341
+ context,
342
+ isDisabled: focusedOption && isOptionDisabled3(focusedOption, selectValue),
343
+ isMulti,
344
+ isSearchable,
345
+ tabSelectsValue,
346
+ isInitialFocus
347
+ });
348
+ }
349
+ return guidanceMsg;
350
+ }, [ariaLabel, focusedOption, focusedValue, isMulti, isOptionDisabled3, isSearchable, menuIsOpen, messages, selectValue, tabSelectsValue, isInitialFocus]);
351
+ var ScreenReaderText = jsx(Fragment, null, jsx("span", {
352
+ id: "aria-selection"
353
+ }, ariaSelected), jsx("span", {
354
+ id: "aria-focused"
355
+ }, ariaFocused), jsx("span", {
356
+ id: "aria-results"
357
+ }, ariaResults), jsx("span", {
358
+ id: "aria-guidance"
359
+ }, ariaGuidance));
360
+ return jsx(Fragment, null, jsx(A11yText$1, {
361
+ id
362
+ }, isInitialFocus && ScreenReaderText), jsx(A11yText$1, {
363
+ "aria-live": ariaLive,
364
+ "aria-atomic": "false",
365
+ "aria-relevant": "additions text",
366
+ role: "log"
367
+ }, isFocused && !isInitialFocus && ScreenReaderText));
368
+ };
369
+ var LiveRegion$1 = LiveRegion;
370
+ var diacritics = [{
371
+ base: "A",
372
+ letters: "AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"
373
+ }, {
374
+ base: "AA",
375
+ letters: "Ꜳ"
376
+ }, {
377
+ base: "AE",
378
+ letters: "ÆǼǢ"
379
+ }, {
380
+ base: "AO",
381
+ letters: "Ꜵ"
382
+ }, {
383
+ base: "AU",
384
+ letters: "Ꜷ"
385
+ }, {
386
+ base: "AV",
387
+ letters: "ꜸꜺ"
388
+ }, {
389
+ base: "AY",
390
+ letters: "Ꜽ"
391
+ }, {
392
+ base: "B",
393
+ letters: "BⒷBḂḄḆɃƂƁ"
394
+ }, {
395
+ base: "C",
396
+ letters: "CⒸCĆĈĊČÇḈƇȻꜾ"
397
+ }, {
398
+ base: "D",
399
+ letters: "DⒹDḊĎḌḐḒḎĐƋƊƉꝹ"
400
+ }, {
401
+ base: "DZ",
402
+ letters: "DZDŽ"
403
+ }, {
404
+ base: "Dz",
405
+ letters: "DzDž"
406
+ }, {
407
+ base: "E",
408
+ letters: "EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"
409
+ }, {
410
+ base: "F",
411
+ letters: "FⒻFḞƑꝻ"
412
+ }, {
413
+ base: "G",
414
+ letters: "GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"
415
+ }, {
416
+ base: "H",
417
+ letters: "HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"
418
+ }, {
419
+ base: "I",
420
+ letters: "IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"
421
+ }, {
422
+ base: "J",
423
+ letters: "JⒿJĴɈ"
424
+ }, {
425
+ base: "K",
426
+ letters: "KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"
427
+ }, {
428
+ base: "L",
429
+ letters: "LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"
430
+ }, {
431
+ base: "LJ",
432
+ letters: "LJ"
433
+ }, {
434
+ base: "Lj",
435
+ letters: "Lj"
436
+ }, {
437
+ base: "M",
438
+ letters: "MⓂMḾṀṂⱮƜ"
439
+ }, {
440
+ base: "N",
441
+ letters: "NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"
442
+ }, {
443
+ base: "NJ",
444
+ letters: "NJ"
445
+ }, {
446
+ base: "Nj",
447
+ letters: "Nj"
448
+ }, {
449
+ base: "O",
450
+ letters: "OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"
451
+ }, {
452
+ base: "OI",
453
+ letters: "Ƣ"
454
+ }, {
455
+ base: "OO",
456
+ letters: "Ꝏ"
457
+ }, {
458
+ base: "OU",
459
+ letters: "Ȣ"
460
+ }, {
461
+ base: "P",
462
+ letters: "PⓅPṔṖƤⱣꝐꝒꝔ"
463
+ }, {
464
+ base: "Q",
465
+ letters: "QⓆQꝖꝘɊ"
466
+ }, {
467
+ base: "R",
468
+ letters: "RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"
469
+ }, {
470
+ base: "S",
471
+ letters: "SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"
472
+ }, {
473
+ base: "T",
474
+ letters: "TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"
475
+ }, {
476
+ base: "TZ",
477
+ letters: "Ꜩ"
478
+ }, {
479
+ base: "U",
480
+ letters: "UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"
481
+ }, {
482
+ base: "V",
483
+ letters: "VⓋVṼṾƲꝞɅ"
484
+ }, {
485
+ base: "VY",
486
+ letters: "Ꝡ"
487
+ }, {
488
+ base: "W",
489
+ letters: "WⓌWẀẂŴẆẄẈⱲ"
490
+ }, {
491
+ base: "X",
492
+ letters: "XⓍXẊẌ"
493
+ }, {
494
+ base: "Y",
495
+ letters: "YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"
496
+ }, {
497
+ base: "Z",
498
+ letters: "ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"
499
+ }, {
500
+ base: "a",
501
+ letters: "aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ"
502
+ }, {
503
+ base: "aa",
504
+ letters: "ꜳ"
505
+ }, {
506
+ base: "ae",
507
+ letters: "æǽǣ"
508
+ }, {
509
+ base: "ao",
510
+ letters: "ꜵ"
511
+ }, {
512
+ base: "au",
513
+ letters: "ꜷ"
514
+ }, {
515
+ base: "av",
516
+ letters: "ꜹꜻ"
517
+ }, {
518
+ base: "ay",
519
+ letters: "ꜽ"
520
+ }, {
521
+ base: "b",
522
+ letters: "bⓑbḃḅḇƀƃɓ"
523
+ }, {
524
+ base: "c",
525
+ letters: "cⓒcćĉċčçḉƈȼꜿↄ"
526
+ }, {
527
+ base: "d",
528
+ letters: "dⓓdḋďḍḑḓḏđƌɖɗꝺ"
529
+ }, {
530
+ base: "dz",
531
+ letters: "dzdž"
532
+ }, {
533
+ base: "e",
534
+ letters: "eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"
535
+ }, {
536
+ base: "f",
537
+ letters: "fⓕfḟƒꝼ"
538
+ }, {
539
+ base: "g",
540
+ letters: "gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"
541
+ }, {
542
+ base: "h",
543
+ letters: "hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"
544
+ }, {
545
+ base: "hv",
546
+ letters: "ƕ"
547
+ }, {
548
+ base: "i",
549
+ letters: "iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"
550
+ }, {
551
+ base: "j",
552
+ letters: "jⓙjĵǰɉ"
553
+ }, {
554
+ base: "k",
555
+ letters: "kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"
556
+ }, {
557
+ base: "l",
558
+ letters: "lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"
559
+ }, {
560
+ base: "lj",
561
+ letters: "lj"
562
+ }, {
563
+ base: "m",
564
+ letters: "mⓜmḿṁṃɱɯ"
565
+ }, {
566
+ base: "n",
567
+ letters: "nⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ"
568
+ }, {
569
+ base: "nj",
570
+ letters: "nj"
571
+ }, {
572
+ base: "o",
573
+ letters: "oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"
574
+ }, {
575
+ base: "oi",
576
+ letters: "ƣ"
577
+ }, {
578
+ base: "ou",
579
+ letters: "ȣ"
580
+ }, {
581
+ base: "oo",
582
+ letters: "ꝏ"
583
+ }, {
584
+ base: "p",
585
+ letters: "pⓟpṕṗƥᵽꝑꝓꝕ"
586
+ }, {
587
+ base: "q",
588
+ letters: "qⓠqɋꝗꝙ"
589
+ }, {
590
+ base: "r",
591
+ letters: "rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"
592
+ }, {
593
+ base: "s",
594
+ letters: "sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"
595
+ }, {
596
+ base: "t",
597
+ letters: "tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"
598
+ }, {
599
+ base: "tz",
600
+ letters: "ꜩ"
601
+ }, {
602
+ base: "u",
603
+ letters: "uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"
604
+ }, {
605
+ base: "v",
606
+ letters: "vⓥvṽṿʋꝟʌ"
607
+ }, {
608
+ base: "vy",
609
+ letters: "ꝡ"
610
+ }, {
611
+ base: "w",
612
+ letters: "wⓦwẁẃŵẇẅẘẉⱳ"
613
+ }, {
614
+ base: "x",
615
+ letters: "xⓧxẋẍ"
616
+ }, {
617
+ base: "y",
618
+ letters: "yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"
619
+ }, {
620
+ base: "z",
621
+ letters: "zⓩzźẑżžẓẕƶȥɀⱬꝣ"
622
+ }];
623
+ var anyDiacritic = new RegExp("[" + diacritics.map(function(d) {
624
+ return d.letters;
625
+ }).join("") + "]", "g");
626
+ var diacriticToBase = {};
627
+ for (var i = 0; i < diacritics.length; i++) {
628
+ var diacritic = diacritics[i];
629
+ for (var j = 0; j < diacritic.letters.length; j++) {
630
+ diacriticToBase[diacritic.letters[j]] = diacritic.base;
631
+ }
632
+ }
633
+ var stripDiacritics = function stripDiacritics2(str) {
634
+ return str.replace(anyDiacritic, function(match) {
635
+ return diacriticToBase[match];
636
+ });
637
+ };
638
+ var memoizedStripDiacriticsForInput = memoizeOne(stripDiacritics);
639
+ var trimString = function trimString2(str) {
640
+ return str.replace(/^\s+|\s+$/g, "");
641
+ };
642
+ var defaultStringify = function defaultStringify2(option) {
643
+ return "".concat(option.label, " ").concat(option.value);
644
+ };
645
+ var createFilter = function createFilter2(config) {
646
+ return function(option, rawInput) {
647
+ if (option.data.__isNew__)
648
+ return true;
649
+ var _ignoreCase$ignoreAcc = _objectSpread2({
650
+ ignoreCase: true,
651
+ ignoreAccents: true,
652
+ stringify: defaultStringify,
653
+ trim: true,
654
+ matchFrom: "any"
655
+ }, config), ignoreCase = _ignoreCase$ignoreAcc.ignoreCase, ignoreAccents = _ignoreCase$ignoreAcc.ignoreAccents, stringify = _ignoreCase$ignoreAcc.stringify, trim = _ignoreCase$ignoreAcc.trim, matchFrom = _ignoreCase$ignoreAcc.matchFrom;
656
+ var input = trim ? trimString(rawInput) : rawInput;
657
+ var candidate = trim ? trimString(stringify(option)) : stringify(option);
658
+ if (ignoreCase) {
659
+ input = input.toLowerCase();
660
+ candidate = candidate.toLowerCase();
661
+ }
662
+ if (ignoreAccents) {
663
+ input = memoizedStripDiacriticsForInput(input);
664
+ candidate = stripDiacritics(candidate);
665
+ }
666
+ return matchFrom === "start" ? candidate.substr(0, input.length) === input : candidate.indexOf(input) > -1;
667
+ };
668
+ };
669
+ var _excluded = ["innerRef"];
670
+ function DummyInput(_ref3) {
671
+ var innerRef = _ref3.innerRef, props = _objectWithoutProperties(_ref3, _excluded);
672
+ var filteredProps = removeProps(props, "onExited", "in", "enter", "exit", "appear");
673
+ return jsx("input", _extends({
674
+ ref: innerRef
675
+ }, filteredProps, {
676
+ css: /* @__PURE__ */ css({
677
+ label: "dummyInput",
678
+ // get rid of any default styles
679
+ background: 0,
680
+ border: 0,
681
+ // important! this hides the flashing cursor
682
+ caretColor: "transparent",
683
+ fontSize: "inherit",
684
+ gridArea: "1 / 1 / 2 / 3",
685
+ outline: 0,
686
+ padding: 0,
687
+ // important! without `width` browsers won't allow focus
688
+ width: 1,
689
+ // remove cursor on desktop
690
+ color: "transparent",
691
+ // remove cursor on mobile whilst maintaining "scroll into view" behaviour
692
+ left: -100,
693
+ opacity: 0,
694
+ position: "relative",
695
+ transform: "scale(.01)"
696
+ }, process.env.NODE_ENV === "production" ? "" : ";label:DummyInput;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkR1bW15SW5wdXQudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXlCTSIsImZpbGUiOiJEdW1teUlucHV0LnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKiBAanN4IGpzeCAqL1xuaW1wb3J0IHsgUmVmIH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHsganN4IH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuaW1wb3J0IHsgcmVtb3ZlUHJvcHMgfSBmcm9tICcuLi91dGlscyc7XG5cbmV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIER1bW15SW5wdXQoe1xuICBpbm5lclJlZixcbiAgLi4ucHJvcHNcbn06IEpTWC5JbnRyaW5zaWNFbGVtZW50c1snaW5wdXQnXSAmIHtcbiAgcmVhZG9ubHkgaW5uZXJSZWY6IFJlZjxIVE1MSW5wdXRFbGVtZW50Pjtcbn0pIHtcbiAgLy8gUmVtb3ZlIGFuaW1hdGlvbiBwcm9wcyBub3QgbWVhbnQgZm9yIEhUTUwgZWxlbWVudHNcbiAgY29uc3QgZmlsdGVyZWRQcm9wcyA9IHJlbW92ZVByb3BzKFxuICAgIHByb3BzLFxuICAgICdvbkV4aXRlZCcsXG4gICAgJ2luJyxcbiAgICAnZW50ZXInLFxuICAgICdleGl0JyxcbiAgICAnYXBwZWFyJ1xuICApO1xuXG4gIHJldHVybiAoXG4gICAgPGlucHV0XG4gICAgICByZWY9e2lubmVyUmVmfVxuICAgICAgey4uLmZpbHRlcmVkUHJvcHN9XG4gICAgICBjc3M9e3tcbiAgICAgICAgbGFiZWw6ICdkdW1teUlucHV0JyxcbiAgICAgICAgLy8gZ2V0IHJpZCBvZiBhbnkgZGVmYXVsdCBzdHlsZXNcbiAgICAgICAgYmFja2dyb3VuZDogMCxcbiAgICAgICAgYm9yZGVyOiAwLFxuICAgICAgICAvLyBpbXBvcnRhbnQhIHRoaXMgaGlkZXMgdGhlIGZsYXNoaW5nIGN1cnNvclxuICAgICAgICBjYXJldENvbG9yOiAndHJhbnNwYXJlbnQnLFxuICAgICAgICBmb250U2l6ZTogJ2luaGVyaXQnLFxuICAgICAgICBncmlkQXJlYTogJzEgLyAxIC8gMiAvIDMnLFxuICAgICAgICBvdXRsaW5lOiAwLFxuICAgICAgICBwYWRkaW5nOiAwLFxuICAgICAgICAvLyBpbXBvcnRhbnQhIHdpdGhvdXQgYHdpZHRoYCBicm93c2VycyB3b24ndCBhbGxvdyBmb2N1c1xuICAgICAgICB3aWR0aDogMSxcblxuICAgICAgICAvLyByZW1vdmUgY3Vyc29yIG9uIGRlc2t0b3BcbiAgICAgICAgY29sb3I6ICd0cmFuc3BhcmVudCcsXG5cbiAgICAgICAgLy8gcmVtb3ZlIGN1cnNvciBvbiBtb2JpbGUgd2hpbHN0IG1haW50YWluaW5nIFwic2Nyb2xsIGludG8gdmlld1wiIGJlaGF2aW91clxuICAgICAgICBsZWZ0OiAtMTAwLFxuICAgICAgICBvcGFjaXR5OiAwLFxuICAgICAgICBwb3NpdGlvbjogJ3JlbGF0aXZlJyxcbiAgICAgICAgdHJhbnNmb3JtOiAnc2NhbGUoLjAxKScsXG4gICAgICB9fVxuICAgIC8+XG4gICk7XG59XG4iXX0= */")
697
+ }));
698
+ }
699
+ var cancelScroll = function cancelScroll2(event) {
700
+ if (event.cancelable)
701
+ event.preventDefault();
702
+ event.stopPropagation();
703
+ };
704
+ function useScrollCapture(_ref3) {
705
+ var isEnabled = _ref3.isEnabled, onBottomArrive = _ref3.onBottomArrive, onBottomLeave = _ref3.onBottomLeave, onTopArrive = _ref3.onTopArrive, onTopLeave = _ref3.onTopLeave;
706
+ var isBottom = useRef(false);
707
+ var isTop = useRef(false);
708
+ var touchStart = useRef(0);
709
+ var scrollTarget = useRef(null);
710
+ var handleEventDelta = useCallback(function(event, delta) {
711
+ if (scrollTarget.current === null)
712
+ return;
713
+ var _scrollTarget$current = scrollTarget.current, scrollTop = _scrollTarget$current.scrollTop, scrollHeight = _scrollTarget$current.scrollHeight, clientHeight = _scrollTarget$current.clientHeight;
714
+ var target = scrollTarget.current;
715
+ var isDeltaPositive = delta > 0;
716
+ var availableScroll = scrollHeight - clientHeight - scrollTop;
717
+ var shouldCancelScroll = false;
718
+ if (availableScroll > delta && isBottom.current) {
719
+ if (onBottomLeave)
720
+ onBottomLeave(event);
721
+ isBottom.current = false;
722
+ }
723
+ if (isDeltaPositive && isTop.current) {
724
+ if (onTopLeave)
725
+ onTopLeave(event);
726
+ isTop.current = false;
727
+ }
728
+ if (isDeltaPositive && delta > availableScroll) {
729
+ if (onBottomArrive && !isBottom.current) {
730
+ onBottomArrive(event);
731
+ }
732
+ target.scrollTop = scrollHeight;
733
+ shouldCancelScroll = true;
734
+ isBottom.current = true;
735
+ } else if (!isDeltaPositive && -delta > scrollTop) {
736
+ if (onTopArrive && !isTop.current) {
737
+ onTopArrive(event);
738
+ }
739
+ target.scrollTop = 0;
740
+ shouldCancelScroll = true;
741
+ isTop.current = true;
742
+ }
743
+ if (shouldCancelScroll) {
744
+ cancelScroll(event);
745
+ }
746
+ }, [onBottomArrive, onBottomLeave, onTopArrive, onTopLeave]);
747
+ var onWheel = useCallback(function(event) {
748
+ handleEventDelta(event, event.deltaY);
749
+ }, [handleEventDelta]);
750
+ var onTouchStart = useCallback(function(event) {
751
+ touchStart.current = event.changedTouches[0].clientY;
752
+ }, []);
753
+ var onTouchMove = useCallback(function(event) {
754
+ var deltaY = touchStart.current - event.changedTouches[0].clientY;
755
+ handleEventDelta(event, deltaY);
756
+ }, [handleEventDelta]);
757
+ var startListening = useCallback(function(el) {
758
+ if (!el)
759
+ return;
760
+ var notPassive = supportsPassiveEvents ? {
761
+ passive: false
762
+ } : false;
763
+ el.addEventListener("wheel", onWheel, notPassive);
764
+ el.addEventListener("touchstart", onTouchStart, notPassive);
765
+ el.addEventListener("touchmove", onTouchMove, notPassive);
766
+ }, [onTouchMove, onTouchStart, onWheel]);
767
+ var stopListening = useCallback(function(el) {
768
+ if (!el)
769
+ return;
770
+ el.removeEventListener("wheel", onWheel, false);
771
+ el.removeEventListener("touchstart", onTouchStart, false);
772
+ el.removeEventListener("touchmove", onTouchMove, false);
773
+ }, [onTouchMove, onTouchStart, onWheel]);
774
+ useEffect(function() {
775
+ if (!isEnabled)
776
+ return;
777
+ var element = scrollTarget.current;
778
+ startListening(element);
779
+ return function() {
780
+ stopListening(element);
781
+ };
782
+ }, [isEnabled, startListening, stopListening]);
783
+ return function(element) {
784
+ scrollTarget.current = element;
785
+ };
786
+ }
787
+ var STYLE_KEYS = ["boxSizing", "height", "overflow", "paddingRight", "position"];
788
+ var LOCK_STYLES = {
789
+ boxSizing: "border-box",
790
+ // account for possible declaration `width: 100%;` on body
791
+ overflow: "hidden",
792
+ position: "relative",
793
+ height: "100%"
794
+ };
795
+ function preventTouchMove(e) {
796
+ e.preventDefault();
797
+ }
798
+ function allowTouchMove(e) {
799
+ e.stopPropagation();
800
+ }
801
+ function preventInertiaScroll() {
802
+ var top = this.scrollTop;
803
+ var totalScroll = this.scrollHeight;
804
+ var currentScroll = top + this.offsetHeight;
805
+ if (top === 0) {
806
+ this.scrollTop = 1;
807
+ } else if (currentScroll === totalScroll) {
808
+ this.scrollTop = top - 1;
809
+ }
810
+ }
811
+ function isTouchDevice() {
812
+ return "ontouchstart" in window || navigator.maxTouchPoints;
813
+ }
814
+ var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
815
+ var activeScrollLocks = 0;
816
+ var listenerOptions = {
817
+ capture: false,
818
+ passive: false
819
+ };
820
+ function useScrollLock(_ref3) {
821
+ var isEnabled = _ref3.isEnabled, _ref$accountForScroll = _ref3.accountForScrollbars, accountForScrollbars = _ref$accountForScroll === void 0 ? true : _ref$accountForScroll;
822
+ var originalStyles = useRef({});
823
+ var scrollTarget = useRef(null);
824
+ var addScrollLock = useCallback(function(touchScrollTarget) {
825
+ if (!canUseDOM)
826
+ return;
827
+ var target = document.body;
828
+ var targetStyle = target && target.style;
829
+ if (accountForScrollbars) {
830
+ STYLE_KEYS.forEach(function(key) {
831
+ var val = targetStyle && targetStyle[key];
832
+ originalStyles.current[key] = val;
833
+ });
834
+ }
835
+ if (accountForScrollbars && activeScrollLocks < 1) {
836
+ var currentPadding = parseInt(originalStyles.current.paddingRight, 10) || 0;
837
+ var clientWidth = document.body ? document.body.clientWidth : 0;
838
+ var adjustedPadding = window.innerWidth - clientWidth + currentPadding || 0;
839
+ Object.keys(LOCK_STYLES).forEach(function(key) {
840
+ var val = LOCK_STYLES[key];
841
+ if (targetStyle) {
842
+ targetStyle[key] = val;
843
+ }
844
+ });
845
+ if (targetStyle) {
846
+ targetStyle.paddingRight = "".concat(adjustedPadding, "px");
847
+ }
848
+ }
849
+ if (target && isTouchDevice()) {
850
+ target.addEventListener("touchmove", preventTouchMove, listenerOptions);
851
+ if (touchScrollTarget) {
852
+ touchScrollTarget.addEventListener("touchstart", preventInertiaScroll, listenerOptions);
853
+ touchScrollTarget.addEventListener("touchmove", allowTouchMove, listenerOptions);
854
+ }
855
+ }
856
+ activeScrollLocks += 1;
857
+ }, [accountForScrollbars]);
858
+ var removeScrollLock = useCallback(function(touchScrollTarget) {
859
+ if (!canUseDOM)
860
+ return;
861
+ var target = document.body;
862
+ var targetStyle = target && target.style;
863
+ activeScrollLocks = Math.max(activeScrollLocks - 1, 0);
864
+ if (accountForScrollbars && activeScrollLocks < 1) {
865
+ STYLE_KEYS.forEach(function(key) {
866
+ var val = originalStyles.current[key];
867
+ if (targetStyle) {
868
+ targetStyle[key] = val;
869
+ }
870
+ });
871
+ }
872
+ if (target && isTouchDevice()) {
873
+ target.removeEventListener("touchmove", preventTouchMove, listenerOptions);
874
+ if (touchScrollTarget) {
875
+ touchScrollTarget.removeEventListener("touchstart", preventInertiaScroll, listenerOptions);
876
+ touchScrollTarget.removeEventListener("touchmove", allowTouchMove, listenerOptions);
877
+ }
878
+ }
879
+ }, [accountForScrollbars]);
880
+ useEffect(function() {
881
+ if (!isEnabled)
882
+ return;
883
+ var element = scrollTarget.current;
884
+ addScrollLock(element);
885
+ return function() {
886
+ removeScrollLock(element);
887
+ };
888
+ }, [isEnabled, addScrollLock, removeScrollLock]);
889
+ return function(element) {
890
+ scrollTarget.current = element;
891
+ };
892
+ }
893
+ function _EMOTION_STRINGIFIED_CSS_ERROR__$1() {
894
+ return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).";
895
+ }
896
+ var blurSelectInput = function blurSelectInput2(event) {
897
+ var element = event.target;
898
+ return element.ownerDocument.activeElement && element.ownerDocument.activeElement.blur();
899
+ };
900
+ var _ref2$1 = process.env.NODE_ENV === "production" ? {
901
+ name: "1kfdb0e",
902
+ styles: "position:fixed;left:0;bottom:0;right:0;top:0"
903
+ } : {
904
+ name: "bp8cua-ScrollManager",
905
+ styles: "position:fixed;left:0;bottom:0;right:0;top:0;label:ScrollManager;",
906
+ map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlNjcm9sbE1hbmFnZXIudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQW9EVSIsImZpbGUiOiJTY3JvbGxNYW5hZ2VyLnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKiBAanN4IGpzeCAqL1xuaW1wb3J0IHsganN4IH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuaW1wb3J0IHsgRnJhZ21lbnQsIFJlYWN0RWxlbWVudCwgUmVmQ2FsbGJhY2ssIE1vdXNlRXZlbnQgfSBmcm9tICdyZWFjdCc7XG5pbXBvcnQgdXNlU2Nyb2xsQ2FwdHVyZSBmcm9tICcuL3VzZVNjcm9sbENhcHR1cmUnO1xuaW1wb3J0IHVzZVNjcm9sbExvY2sgZnJvbSAnLi91c2VTY3JvbGxMb2NrJztcblxuaW50ZXJmYWNlIFByb3BzIHtcbiAgcmVhZG9ubHkgY2hpbGRyZW46IChyZWY6IFJlZkNhbGxiYWNrPEhUTUxFbGVtZW50PikgPT4gUmVhY3RFbGVtZW50O1xuICByZWFkb25seSBsb2NrRW5hYmxlZDogYm9vbGVhbjtcbiAgcmVhZG9ubHkgY2FwdHVyZUVuYWJsZWQ6IGJvb2xlYW47XG4gIHJlYWRvbmx5IG9uQm90dG9tQXJyaXZlPzogKGV2ZW50OiBXaGVlbEV2ZW50IHwgVG91Y2hFdmVudCkgPT4gdm9pZDtcbiAgcmVhZG9ubHkgb25Cb3R0b21MZWF2ZT86IChldmVudDogV2hlZWxFdmVudCB8IFRvdWNoRXZlbnQpID0+IHZvaWQ7XG4gIHJlYWRvbmx5IG9uVG9wQXJyaXZlPzogKGV2ZW50OiBXaGVlbEV2ZW50IHwgVG91Y2hFdmVudCkgPT4gdm9pZDtcbiAgcmVhZG9ubHkgb25Ub3BMZWF2ZT86IChldmVudDogV2hlZWxFdmVudCB8IFRvdWNoRXZlbnQpID0+IHZvaWQ7XG59XG5cbmNvbnN0IGJsdXJTZWxlY3RJbnB1dCA9IChldmVudDogTW91c2VFdmVudDxIVE1MRGl2RWxlbWVudD4pID0+IHtcbiAgY29uc3QgZWxlbWVudCA9IGV2ZW50LnRhcmdldCBhcyBIVE1MRGl2RWxlbWVudDtcbiAgcmV0dXJuIChcbiAgICBlbGVtZW50Lm93bmVyRG9jdW1lbnQuYWN0aXZlRWxlbWVudCAmJlxuICAgIChlbGVtZW50Lm93bmVyRG9jdW1lbnQuYWN0aXZlRWxlbWVudCBhcyBIVE1MRWxlbWVudCkuYmx1cigpXG4gICk7XG59O1xuXG5leHBvcnQgZGVmYXVsdCBmdW5jdGlvbiBTY3JvbGxNYW5hZ2VyKHtcbiAgY2hpbGRyZW4sXG4gIGxvY2tFbmFibGVkLFxuICBjYXB0dXJlRW5hYmxlZCA9IHRydWUsXG4gIG9uQm90dG9tQXJyaXZlLFxuICBvbkJvdHRvbUxlYXZlLFxuICBvblRvcEFycml2ZSxcbiAgb25Ub3BMZWF2ZSxcbn06IFByb3BzKSB7XG4gIGNvbnN0IHNldFNjcm9sbENhcHR1cmVUYXJnZXQgPSB1c2VTY3JvbGxDYXB0dXJlKHtcbiAgICBpc0VuYWJsZWQ6IGNhcHR1cmVFbmFibGVkLFxuICAgIG9uQm90dG9tQXJyaXZlLFxuICAgIG9uQm90dG9tTGVhdmUsXG4gICAgb25Ub3BBcnJpdmUsXG4gICAgb25Ub3BMZWF2ZSxcbiAgfSk7XG4gIGNvbnN0IHNldFNjcm9sbExvY2tUYXJnZXQgPSB1c2VTY3JvbGxMb2NrKHsgaXNFbmFibGVkOiBsb2NrRW5hYmxlZCB9KTtcblxuICBjb25zdCB0YXJnZXRSZWY6IFJlZkNhbGxiYWNrPEhUTUxFbGVtZW50PiA9IChlbGVtZW50KSA9PiB7XG4gICAgc2V0U2Nyb2xsQ2FwdHVyZVRhcmdldChlbGVtZW50KTtcbiAgICBzZXRTY3JvbGxMb2NrVGFyZ2V0KGVsZW1lbnQpO1xuICB9O1xuXG4gIHJldHVybiAoXG4gICAgPEZyYWdtZW50PlxuICAgICAge2xvY2tFbmFibGVkICYmIChcbiAgICAgICAgPGRpdlxuICAgICAgICAgIG9uQ2xpY2s9e2JsdXJTZWxlY3RJbnB1dH1cbiAgICAgICAgICBjc3M9e3sgcG9zaXRpb246ICdmaXhlZCcsIGxlZnQ6IDAsIGJvdHRvbTogMCwgcmlnaHQ6IDAsIHRvcDogMCB9fVxuICAgICAgICAvPlxuICAgICAgKX1cbiAgICAgIHtjaGlsZHJlbih0YXJnZXRSZWYpfVxuICAgIDwvRnJhZ21lbnQ+XG4gICk7XG59XG4iXX0= */",
907
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__$1
908
+ };
909
+ function ScrollManager(_ref3) {
910
+ var children = _ref3.children, lockEnabled = _ref3.lockEnabled, _ref$captureEnabled = _ref3.captureEnabled, captureEnabled = _ref$captureEnabled === void 0 ? true : _ref$captureEnabled, onBottomArrive = _ref3.onBottomArrive, onBottomLeave = _ref3.onBottomLeave, onTopArrive = _ref3.onTopArrive, onTopLeave = _ref3.onTopLeave;
911
+ var setScrollCaptureTarget = useScrollCapture({
912
+ isEnabled: captureEnabled,
913
+ onBottomArrive,
914
+ onBottomLeave,
915
+ onTopArrive,
916
+ onTopLeave
917
+ });
918
+ var setScrollLockTarget = useScrollLock({
919
+ isEnabled: lockEnabled
920
+ });
921
+ var targetRef = function targetRef2(element) {
922
+ setScrollCaptureTarget(element);
923
+ setScrollLockTarget(element);
924
+ };
925
+ return jsx(Fragment, null, lockEnabled && jsx("div", {
926
+ onClick: blurSelectInput,
927
+ css: _ref2$1
928
+ }), children(targetRef));
929
+ }
930
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() {
931
+ return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).";
932
+ }
933
+ var _ref2 = process.env.NODE_ENV === "production" ? {
934
+ name: "1a0ro4n-requiredInput",
935
+ styles: "label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"
936
+ } : {
937
+ name: "5kkxb2-requiredInput-RequiredInput",
938
+ styles: "label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%;label:RequiredInput;",
939
+ map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlJlcXVpcmVkSW5wdXQudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWNJIiwiZmlsZSI6IlJlcXVpcmVkSW5wdXQudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiLyoqIEBqc3gganN4ICovXG5pbXBvcnQgeyBGb2N1c0V2ZW50SGFuZGxlciwgRnVuY3Rpb25Db21wb25lbnQgfSBmcm9tICdyZWFjdCc7XG5pbXBvcnQgeyBqc3ggfSBmcm9tICdAZW1vdGlvbi9yZWFjdCc7XG5cbmNvbnN0IFJlcXVpcmVkSW5wdXQ6IEZ1bmN0aW9uQ29tcG9uZW50PHtcbiAgcmVhZG9ubHkgbmFtZT86IHN0cmluZztcbiAgcmVhZG9ubHkgb25Gb2N1czogRm9jdXNFdmVudEhhbmRsZXI8SFRNTElucHV0RWxlbWVudD47XG59PiA9ICh7IG5hbWUsIG9uRm9jdXMgfSkgPT4gKFxuICA8aW5wdXRcbiAgICByZXF1aXJlZFxuICAgIG5hbWU9e25hbWV9XG4gICAgdGFiSW5kZXg9ey0xfVxuICAgIGFyaWEtaGlkZGVuPVwidHJ1ZVwiXG4gICAgb25Gb2N1cz17b25Gb2N1c31cbiAgICBjc3M9e3tcbiAgICAgIGxhYmVsOiAncmVxdWlyZWRJbnB1dCcsXG4gICAgICBvcGFjaXR5OiAwLFxuICAgICAgcG9pbnRlckV2ZW50czogJ25vbmUnLFxuICAgICAgcG9zaXRpb246ICdhYnNvbHV0ZScsXG4gICAgICBib3R0b206IDAsXG4gICAgICBsZWZ0OiAwLFxuICAgICAgcmlnaHQ6IDAsXG4gICAgICB3aWR0aDogJzEwMCUnLFxuICAgIH19XG4gICAgLy8gUHJldmVudCBgU3dpdGNoaW5nIGZyb20gdW5jb250cm9sbGVkIHRvIGNvbnRyb2xsZWRgIGVycm9yXG4gICAgdmFsdWU9XCJcIlxuICAgIG9uQ2hhbmdlPXsoKSA9PiB7fX1cbiAgLz5cbik7XG5cbmV4cG9ydCBkZWZhdWx0IFJlcXVpcmVkSW5wdXQ7XG4iXX0= */",
940
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
941
+ };
942
+ var RequiredInput = function RequiredInput2(_ref3) {
943
+ var name = _ref3.name, onFocus2 = _ref3.onFocus;
944
+ return jsx("input", {
945
+ required: true,
946
+ name,
947
+ tabIndex: -1,
948
+ "aria-hidden": "true",
949
+ onFocus: onFocus2,
950
+ css: _ref2,
951
+ value: "",
952
+ onChange: function onChange2() {
953
+ }
954
+ });
955
+ };
956
+ var RequiredInput$1 = RequiredInput;
957
+ function testPlatform(re) {
958
+ var _window$navigator$use;
959
+ return typeof window !== "undefined" && window.navigator != null ? re.test(((_window$navigator$use = window.navigator["userAgentData"]) === null || _window$navigator$use === void 0 ? void 0 : _window$navigator$use.platform) || window.navigator.platform) : false;
960
+ }
961
+ function isIPhone() {
962
+ return testPlatform(/^iPhone/i);
963
+ }
964
+ function isMac() {
965
+ return testPlatform(/^Mac/i);
966
+ }
967
+ function isIPad() {
968
+ return testPlatform(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
969
+ isMac() && navigator.maxTouchPoints > 1;
970
+ }
971
+ function isIOS() {
972
+ return isIPhone() || isIPad();
973
+ }
974
+ function isAppleDevice() {
975
+ return isMac() || isIOS();
976
+ }
977
+ var formatGroupLabel = function formatGroupLabel2(group) {
978
+ return group.label;
979
+ };
980
+ var getOptionLabel$1 = function getOptionLabel(option) {
981
+ return option.label;
982
+ };
983
+ var getOptionValue$1 = function getOptionValue(option) {
984
+ return option.value;
985
+ };
986
+ var isOptionDisabled = function isOptionDisabled2(option) {
987
+ return !!option.isDisabled;
988
+ };
989
+ var defaultStyles = {
990
+ clearIndicator: clearIndicatorCSS,
991
+ container: containerCSS,
992
+ control: css$1,
993
+ dropdownIndicator: dropdownIndicatorCSS,
994
+ group: groupCSS,
995
+ groupHeading: groupHeadingCSS,
996
+ indicatorsContainer: indicatorsContainerCSS,
997
+ indicatorSeparator: indicatorSeparatorCSS,
998
+ input: inputCSS,
999
+ loadingIndicator: loadingIndicatorCSS,
1000
+ loadingMessage: loadingMessageCSS,
1001
+ menu: menuCSS,
1002
+ menuList: menuListCSS,
1003
+ menuPortal: menuPortalCSS,
1004
+ multiValue: multiValueCSS,
1005
+ multiValueLabel: multiValueLabelCSS,
1006
+ multiValueRemove: multiValueRemoveCSS,
1007
+ noOptionsMessage: noOptionsMessageCSS,
1008
+ option: optionCSS,
1009
+ placeholder: placeholderCSS,
1010
+ singleValue: css$2,
1011
+ valueContainer: valueContainerCSS
1012
+ };
1013
+ var colors = {
1014
+ primary: "#2684FF",
1015
+ primary75: "#4C9AFF",
1016
+ primary50: "#B2D4FF",
1017
+ primary25: "#DEEBFF",
1018
+ danger: "#DE350B",
1019
+ dangerLight: "#FFBDAD",
1020
+ neutral0: "hsl(0, 0%, 100%)",
1021
+ neutral5: "hsl(0, 0%, 95%)",
1022
+ neutral10: "hsl(0, 0%, 90%)",
1023
+ neutral20: "hsl(0, 0%, 80%)",
1024
+ neutral30: "hsl(0, 0%, 70%)",
1025
+ neutral40: "hsl(0, 0%, 60%)",
1026
+ neutral50: "hsl(0, 0%, 50%)",
1027
+ neutral60: "hsl(0, 0%, 40%)",
1028
+ neutral70: "hsl(0, 0%, 30%)",
1029
+ neutral80: "hsl(0, 0%, 20%)",
1030
+ neutral90: "hsl(0, 0%, 10%)"
1031
+ };
1032
+ var borderRadius = 4;
1033
+ var baseUnit = 4;
1034
+ var controlHeight = 38;
1035
+ var menuGutter = baseUnit * 2;
1036
+ var spacing = {
1037
+ baseUnit,
1038
+ controlHeight,
1039
+ menuGutter
1040
+ };
1041
+ var defaultTheme = {
1042
+ borderRadius,
1043
+ colors,
1044
+ spacing
1045
+ };
1046
+ var defaultProps = {
1047
+ "aria-live": "polite",
1048
+ backspaceRemovesValue: true,
1049
+ blurInputOnSelect: isTouchCapable(),
1050
+ captureMenuScroll: !isTouchCapable(),
1051
+ classNames: {},
1052
+ closeMenuOnSelect: true,
1053
+ closeMenuOnScroll: false,
1054
+ components: {},
1055
+ controlShouldRenderValue: true,
1056
+ escapeClearsValue: false,
1057
+ filterOption: createFilter(),
1058
+ formatGroupLabel,
1059
+ getOptionLabel: getOptionLabel$1,
1060
+ getOptionValue: getOptionValue$1,
1061
+ isDisabled: false,
1062
+ isLoading: false,
1063
+ isMulti: false,
1064
+ isRtl: false,
1065
+ isSearchable: true,
1066
+ isOptionDisabled,
1067
+ loadingMessage: function loadingMessage() {
1068
+ return "Loading...";
1069
+ },
1070
+ maxMenuHeight: 300,
1071
+ minMenuHeight: 140,
1072
+ menuIsOpen: false,
1073
+ menuPlacement: "bottom",
1074
+ menuPosition: "absolute",
1075
+ menuShouldBlockScroll: false,
1076
+ menuShouldScrollIntoView: !isMobileDevice(),
1077
+ noOptionsMessage: function noOptionsMessage() {
1078
+ return "No options";
1079
+ },
1080
+ openMenuOnFocus: false,
1081
+ openMenuOnClick: true,
1082
+ options: [],
1083
+ pageSize: 5,
1084
+ placeholder: "Select...",
1085
+ screenReaderStatus: function screenReaderStatus(_ref3) {
1086
+ var count = _ref3.count;
1087
+ return "".concat(count, " result").concat(count !== 1 ? "s" : "", " available");
1088
+ },
1089
+ styles: {},
1090
+ tabIndex: 0,
1091
+ tabSelectsValue: true,
1092
+ unstyled: false
1093
+ };
1094
+ function toCategorizedOption(props, option, selectValue, index) {
1095
+ var isDisabled = _isOptionDisabled(props, option, selectValue);
1096
+ var isSelected = _isOptionSelected(props, option, selectValue);
1097
+ var label = getOptionLabel2(props, option);
1098
+ var value = getOptionValue2(props, option);
1099
+ return {
1100
+ type: "option",
1101
+ data: option,
1102
+ isDisabled,
1103
+ isSelected,
1104
+ label,
1105
+ value,
1106
+ index
1107
+ };
1108
+ }
1109
+ function buildCategorizedOptions(props, selectValue) {
1110
+ return props.options.map(function(groupOrOption, groupOrOptionIndex) {
1111
+ if ("options" in groupOrOption) {
1112
+ var categorizedOptions = groupOrOption.options.map(function(option, optionIndex) {
1113
+ return toCategorizedOption(props, option, selectValue, optionIndex);
1114
+ }).filter(function(categorizedOption2) {
1115
+ return isFocusable(props, categorizedOption2);
1116
+ });
1117
+ return categorizedOptions.length > 0 ? {
1118
+ type: "group",
1119
+ data: groupOrOption,
1120
+ options: categorizedOptions,
1121
+ index: groupOrOptionIndex
1122
+ } : void 0;
1123
+ }
1124
+ var categorizedOption = toCategorizedOption(props, groupOrOption, selectValue, groupOrOptionIndex);
1125
+ return isFocusable(props, categorizedOption) ? categorizedOption : void 0;
1126
+ }).filter(notNullish);
1127
+ }
1128
+ function buildFocusableOptionsFromCategorizedOptions(categorizedOptions) {
1129
+ return categorizedOptions.reduce(function(optionsAccumulator, categorizedOption) {
1130
+ if (categorizedOption.type === "group") {
1131
+ optionsAccumulator.push.apply(optionsAccumulator, _toConsumableArray(categorizedOption.options.map(function(option) {
1132
+ return option.data;
1133
+ })));
1134
+ } else {
1135
+ optionsAccumulator.push(categorizedOption.data);
1136
+ }
1137
+ return optionsAccumulator;
1138
+ }, []);
1139
+ }
1140
+ function buildFocusableOptionsWithIds(categorizedOptions, optionId) {
1141
+ return categorizedOptions.reduce(function(optionsAccumulator, categorizedOption) {
1142
+ if (categorizedOption.type === "group") {
1143
+ optionsAccumulator.push.apply(optionsAccumulator, _toConsumableArray(categorizedOption.options.map(function(option) {
1144
+ return {
1145
+ data: option.data,
1146
+ id: "".concat(optionId, "-").concat(categorizedOption.index, "-").concat(option.index)
1147
+ };
1148
+ })));
1149
+ } else {
1150
+ optionsAccumulator.push({
1151
+ data: categorizedOption.data,
1152
+ id: "".concat(optionId, "-").concat(categorizedOption.index)
1153
+ });
1154
+ }
1155
+ return optionsAccumulator;
1156
+ }, []);
1157
+ }
1158
+ function buildFocusableOptions(props, selectValue) {
1159
+ return buildFocusableOptionsFromCategorizedOptions(buildCategorizedOptions(props, selectValue));
1160
+ }
1161
+ function isFocusable(props, categorizedOption) {
1162
+ var _props$inputValue = props.inputValue, inputValue = _props$inputValue === void 0 ? "" : _props$inputValue;
1163
+ var data = categorizedOption.data, isSelected = categorizedOption.isSelected, label = categorizedOption.label, value = categorizedOption.value;
1164
+ return (!shouldHideSelectedOptions(props) || !isSelected) && _filterOption(props, {
1165
+ label,
1166
+ value,
1167
+ data
1168
+ }, inputValue);
1169
+ }
1170
+ function getNextFocusedValue(state, nextSelectValue) {
1171
+ var focusedValue = state.focusedValue, lastSelectValue = state.selectValue;
1172
+ var lastFocusedIndex = lastSelectValue.indexOf(focusedValue);
1173
+ if (lastFocusedIndex > -1) {
1174
+ var nextFocusedIndex = nextSelectValue.indexOf(focusedValue);
1175
+ if (nextFocusedIndex > -1) {
1176
+ return focusedValue;
1177
+ } else if (lastFocusedIndex < nextSelectValue.length) {
1178
+ return nextSelectValue[lastFocusedIndex];
1179
+ }
1180
+ }
1181
+ return null;
1182
+ }
1183
+ function getNextFocusedOption(state, options) {
1184
+ var lastFocusedOption = state.focusedOption;
1185
+ return lastFocusedOption && options.indexOf(lastFocusedOption) > -1 ? lastFocusedOption : options[0];
1186
+ }
1187
+ var getFocusedOptionId = function getFocusedOptionId2(focusableOptionsWithIds, focusedOption) {
1188
+ var _focusableOptionsWith;
1189
+ var focusedOptionId = (_focusableOptionsWith = focusableOptionsWithIds.find(function(option) {
1190
+ return option.data === focusedOption;
1191
+ })) === null || _focusableOptionsWith === void 0 ? void 0 : _focusableOptionsWith.id;
1192
+ return focusedOptionId || null;
1193
+ };
1194
+ var getOptionLabel2 = function getOptionLabel3(props, data) {
1195
+ return props.getOptionLabel(data);
1196
+ };
1197
+ var getOptionValue2 = function getOptionValue3(props, data) {
1198
+ return props.getOptionValue(data);
1199
+ };
1200
+ function _isOptionDisabled(props, option, selectValue) {
1201
+ return typeof props.isOptionDisabled === "function" ? props.isOptionDisabled(option, selectValue) : false;
1202
+ }
1203
+ function _isOptionSelected(props, option, selectValue) {
1204
+ if (selectValue.indexOf(option) > -1)
1205
+ return true;
1206
+ if (typeof props.isOptionSelected === "function") {
1207
+ return props.isOptionSelected(option, selectValue);
1208
+ }
1209
+ var candidate = getOptionValue2(props, option);
1210
+ return selectValue.some(function(i) {
1211
+ return getOptionValue2(props, i) === candidate;
1212
+ });
1213
+ }
1214
+ function _filterOption(props, option, inputValue) {
1215
+ return props.filterOption ? props.filterOption(option, inputValue) : true;
1216
+ }
1217
+ var shouldHideSelectedOptions = function shouldHideSelectedOptions2(props) {
1218
+ var hideSelectedOptions = props.hideSelectedOptions, isMulti = props.isMulti;
1219
+ if (hideSelectedOptions === void 0)
1220
+ return isMulti;
1221
+ return hideSelectedOptions;
1222
+ };
1223
+ var instanceId = 1;
1224
+ var Select = /* @__PURE__ */ function(_Component) {
1225
+ _inherits(Select2, _Component);
1226
+ var _super = _createSuper(Select2);
1227
+ function Select2(_props) {
1228
+ var _this;
1229
+ _classCallCheck(this, Select2);
1230
+ _this = _super.call(this, _props);
1231
+ _this.state = {
1232
+ ariaSelection: null,
1233
+ focusedOption: null,
1234
+ focusedOptionId: null,
1235
+ focusableOptionsWithIds: [],
1236
+ focusedValue: null,
1237
+ inputIsHidden: false,
1238
+ isFocused: false,
1239
+ selectValue: [],
1240
+ clearFocusValueOnUpdate: false,
1241
+ prevWasFocused: false,
1242
+ inputIsHiddenAfterUpdate: void 0,
1243
+ prevProps: void 0,
1244
+ instancePrefix: ""
1245
+ };
1246
+ _this.blockOptionHover = false;
1247
+ _this.isComposing = false;
1248
+ _this.commonProps = void 0;
1249
+ _this.initialTouchX = 0;
1250
+ _this.initialTouchY = 0;
1251
+ _this.openAfterFocus = false;
1252
+ _this.scrollToFocusedOptionOnUpdate = false;
1253
+ _this.userIsDragging = void 0;
1254
+ _this.isAppleDevice = isAppleDevice();
1255
+ _this.controlRef = null;
1256
+ _this.getControlRef = function(ref) {
1257
+ _this.controlRef = ref;
1258
+ };
1259
+ _this.focusedOptionRef = null;
1260
+ _this.getFocusedOptionRef = function(ref) {
1261
+ _this.focusedOptionRef = ref;
1262
+ };
1263
+ _this.menuListRef = null;
1264
+ _this.getMenuListRef = function(ref) {
1265
+ _this.menuListRef = ref;
1266
+ };
1267
+ _this.inputRef = null;
1268
+ _this.getInputRef = function(ref) {
1269
+ _this.inputRef = ref;
1270
+ };
1271
+ _this.focus = _this.focusInput;
1272
+ _this.blur = _this.blurInput;
1273
+ _this.onChange = function(newValue, actionMeta) {
1274
+ var _this$props = _this.props, onChange2 = _this$props.onChange, name = _this$props.name;
1275
+ actionMeta.name = name;
1276
+ _this.ariaOnChange(newValue, actionMeta);
1277
+ onChange2(newValue, actionMeta);
1278
+ };
1279
+ _this.setValue = function(newValue, action, option) {
1280
+ var _this$props2 = _this.props, closeMenuOnSelect = _this$props2.closeMenuOnSelect, isMulti = _this$props2.isMulti, inputValue = _this$props2.inputValue;
1281
+ _this.onInputChange("", {
1282
+ action: "set-value",
1283
+ prevInputValue: inputValue
1284
+ });
1285
+ if (closeMenuOnSelect) {
1286
+ _this.setState({
1287
+ inputIsHiddenAfterUpdate: !isMulti
1288
+ });
1289
+ _this.onMenuClose();
1290
+ }
1291
+ _this.setState({
1292
+ clearFocusValueOnUpdate: true
1293
+ });
1294
+ _this.onChange(newValue, {
1295
+ action,
1296
+ option
1297
+ });
1298
+ };
1299
+ _this.selectOption = function(newValue) {
1300
+ var _this$props3 = _this.props, blurInputOnSelect = _this$props3.blurInputOnSelect, isMulti = _this$props3.isMulti, name = _this$props3.name;
1301
+ var selectValue = _this.state.selectValue;
1302
+ var deselected = isMulti && _this.isOptionSelected(newValue, selectValue);
1303
+ var isDisabled = _this.isOptionDisabled(newValue, selectValue);
1304
+ if (deselected) {
1305
+ var candidate = _this.getOptionValue(newValue);
1306
+ _this.setValue(multiValueAsValue(selectValue.filter(function(i) {
1307
+ return _this.getOptionValue(i) !== candidate;
1308
+ })), "deselect-option", newValue);
1309
+ } else if (!isDisabled) {
1310
+ if (isMulti) {
1311
+ _this.setValue(multiValueAsValue([].concat(_toConsumableArray(selectValue), [newValue])), "select-option", newValue);
1312
+ } else {
1313
+ _this.setValue(singleValueAsValue(newValue), "select-option");
1314
+ }
1315
+ } else {
1316
+ _this.ariaOnChange(singleValueAsValue(newValue), {
1317
+ action: "select-option",
1318
+ option: newValue,
1319
+ name
1320
+ });
1321
+ return;
1322
+ }
1323
+ if (blurInputOnSelect) {
1324
+ _this.blurInput();
1325
+ }
1326
+ };
1327
+ _this.removeValue = function(removedValue) {
1328
+ var isMulti = _this.props.isMulti;
1329
+ var selectValue = _this.state.selectValue;
1330
+ var candidate = _this.getOptionValue(removedValue);
1331
+ var newValueArray = selectValue.filter(function(i) {
1332
+ return _this.getOptionValue(i) !== candidate;
1333
+ });
1334
+ var newValue = valueTernary(isMulti, newValueArray, newValueArray[0] || null);
1335
+ _this.onChange(newValue, {
1336
+ action: "remove-value",
1337
+ removedValue
1338
+ });
1339
+ _this.focusInput();
1340
+ };
1341
+ _this.clearValue = function() {
1342
+ var selectValue = _this.state.selectValue;
1343
+ _this.onChange(valueTernary(_this.props.isMulti, [], null), {
1344
+ action: "clear",
1345
+ removedValues: selectValue
1346
+ });
1347
+ };
1348
+ _this.popValue = function() {
1349
+ var isMulti = _this.props.isMulti;
1350
+ var selectValue = _this.state.selectValue;
1351
+ var lastSelectedValue = selectValue[selectValue.length - 1];
1352
+ var newValueArray = selectValue.slice(0, selectValue.length - 1);
1353
+ var newValue = valueTernary(isMulti, newValueArray, newValueArray[0] || null);
1354
+ _this.onChange(newValue, {
1355
+ action: "pop-value",
1356
+ removedValue: lastSelectedValue
1357
+ });
1358
+ };
1359
+ _this.getFocusedOptionId = function(focusedOption) {
1360
+ return getFocusedOptionId(_this.state.focusableOptionsWithIds, focusedOption);
1361
+ };
1362
+ _this.getFocusableOptionsWithIds = function() {
1363
+ return buildFocusableOptionsWithIds(buildCategorizedOptions(_this.props, _this.state.selectValue), _this.getElementId("option"));
1364
+ };
1365
+ _this.getValue = function() {
1366
+ return _this.state.selectValue;
1367
+ };
1368
+ _this.cx = function() {
1369
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1370
+ args[_key] = arguments[_key];
1371
+ }
1372
+ return classNames.apply(void 0, [_this.props.classNamePrefix].concat(args));
1373
+ };
1374
+ _this.getOptionLabel = function(data) {
1375
+ return getOptionLabel2(_this.props, data);
1376
+ };
1377
+ _this.getOptionValue = function(data) {
1378
+ return getOptionValue2(_this.props, data);
1379
+ };
1380
+ _this.getStyles = function(key, props) {
1381
+ var unstyled = _this.props.unstyled;
1382
+ var base = defaultStyles[key](props, unstyled);
1383
+ base.boxSizing = "border-box";
1384
+ var custom = _this.props.styles[key];
1385
+ return custom ? custom(base, props) : base;
1386
+ };
1387
+ _this.getClassNames = function(key, props) {
1388
+ var _this$props$className, _this$props$className2;
1389
+ return (_this$props$className = (_this$props$className2 = _this.props.classNames)[key]) === null || _this$props$className === void 0 ? void 0 : _this$props$className.call(_this$props$className2, props);
1390
+ };
1391
+ _this.getElementId = function(element) {
1392
+ return "".concat(_this.state.instancePrefix, "-").concat(element);
1393
+ };
1394
+ _this.getComponents = function() {
1395
+ return defaultComponents(_this.props);
1396
+ };
1397
+ _this.buildCategorizedOptions = function() {
1398
+ return buildCategorizedOptions(_this.props, _this.state.selectValue);
1399
+ };
1400
+ _this.getCategorizedOptions = function() {
1401
+ return _this.props.menuIsOpen ? _this.buildCategorizedOptions() : [];
1402
+ };
1403
+ _this.buildFocusableOptions = function() {
1404
+ return buildFocusableOptionsFromCategorizedOptions(_this.buildCategorizedOptions());
1405
+ };
1406
+ _this.getFocusableOptions = function() {
1407
+ return _this.props.menuIsOpen ? _this.buildFocusableOptions() : [];
1408
+ };
1409
+ _this.ariaOnChange = function(value, actionMeta) {
1410
+ _this.setState({
1411
+ ariaSelection: _objectSpread2({
1412
+ value
1413
+ }, actionMeta)
1414
+ });
1415
+ };
1416
+ _this.onMenuMouseDown = function(event) {
1417
+ if (event.button !== 0) {
1418
+ return;
1419
+ }
1420
+ event.stopPropagation();
1421
+ event.preventDefault();
1422
+ _this.focusInput();
1423
+ };
1424
+ _this.onMenuMouseMove = function(event) {
1425
+ _this.blockOptionHover = false;
1426
+ };
1427
+ _this.onControlMouseDown = function(event) {
1428
+ if (event.defaultPrevented) {
1429
+ return;
1430
+ }
1431
+ var openMenuOnClick = _this.props.openMenuOnClick;
1432
+ if (!_this.state.isFocused) {
1433
+ if (openMenuOnClick) {
1434
+ _this.openAfterFocus = true;
1435
+ }
1436
+ _this.focusInput();
1437
+ } else if (!_this.props.menuIsOpen) {
1438
+ if (openMenuOnClick) {
1439
+ _this.openMenu("first");
1440
+ }
1441
+ } else {
1442
+ if (event.target.tagName !== "INPUT" && event.target.tagName !== "TEXTAREA") {
1443
+ _this.onMenuClose();
1444
+ }
1445
+ }
1446
+ if (event.target.tagName !== "INPUT" && event.target.tagName !== "TEXTAREA") {
1447
+ event.preventDefault();
1448
+ }
1449
+ };
1450
+ _this.onDropdownIndicatorMouseDown = function(event) {
1451
+ if (event && event.type === "mousedown" && event.button !== 0) {
1452
+ return;
1453
+ }
1454
+ if (_this.props.isDisabled)
1455
+ return;
1456
+ var _this$props4 = _this.props, isMulti = _this$props4.isMulti, menuIsOpen = _this$props4.menuIsOpen;
1457
+ _this.focusInput();
1458
+ if (menuIsOpen) {
1459
+ _this.setState({
1460
+ inputIsHiddenAfterUpdate: !isMulti
1461
+ });
1462
+ _this.onMenuClose();
1463
+ } else {
1464
+ _this.openMenu("first");
1465
+ }
1466
+ event.preventDefault();
1467
+ };
1468
+ _this.onClearIndicatorMouseDown = function(event) {
1469
+ if (event && event.type === "mousedown" && event.button !== 0) {
1470
+ return;
1471
+ }
1472
+ _this.clearValue();
1473
+ event.preventDefault();
1474
+ _this.openAfterFocus = false;
1475
+ if (event.type === "touchend") {
1476
+ _this.focusInput();
1477
+ } else {
1478
+ setTimeout(function() {
1479
+ return _this.focusInput();
1480
+ });
1481
+ }
1482
+ };
1483
+ _this.onScroll = function(event) {
1484
+ if (typeof _this.props.closeMenuOnScroll === "boolean") {
1485
+ if (event.target instanceof HTMLElement && isDocumentElement(event.target)) {
1486
+ _this.props.onMenuClose();
1487
+ }
1488
+ } else if (typeof _this.props.closeMenuOnScroll === "function") {
1489
+ if (_this.props.closeMenuOnScroll(event)) {
1490
+ _this.props.onMenuClose();
1491
+ }
1492
+ }
1493
+ };
1494
+ _this.onCompositionStart = function() {
1495
+ _this.isComposing = true;
1496
+ };
1497
+ _this.onCompositionEnd = function() {
1498
+ _this.isComposing = false;
1499
+ };
1500
+ _this.onTouchStart = function(_ref22) {
1501
+ var touches = _ref22.touches;
1502
+ var touch = touches && touches.item(0);
1503
+ if (!touch) {
1504
+ return;
1505
+ }
1506
+ _this.initialTouchX = touch.clientX;
1507
+ _this.initialTouchY = touch.clientY;
1508
+ _this.userIsDragging = false;
1509
+ };
1510
+ _this.onTouchMove = function(_ref3) {
1511
+ var touches = _ref3.touches;
1512
+ var touch = touches && touches.item(0);
1513
+ if (!touch) {
1514
+ return;
1515
+ }
1516
+ var deltaX = Math.abs(touch.clientX - _this.initialTouchX);
1517
+ var deltaY = Math.abs(touch.clientY - _this.initialTouchY);
1518
+ var moveThreshold = 5;
1519
+ _this.userIsDragging = deltaX > moveThreshold || deltaY > moveThreshold;
1520
+ };
1521
+ _this.onTouchEnd = function(event) {
1522
+ if (_this.userIsDragging)
1523
+ return;
1524
+ if (_this.controlRef && !_this.controlRef.contains(event.target) && _this.menuListRef && !_this.menuListRef.contains(event.target)) {
1525
+ _this.blurInput();
1526
+ }
1527
+ _this.initialTouchX = 0;
1528
+ _this.initialTouchY = 0;
1529
+ };
1530
+ _this.onControlTouchEnd = function(event) {
1531
+ if (_this.userIsDragging)
1532
+ return;
1533
+ _this.onControlMouseDown(event);
1534
+ };
1535
+ _this.onClearIndicatorTouchEnd = function(event) {
1536
+ if (_this.userIsDragging)
1537
+ return;
1538
+ _this.onClearIndicatorMouseDown(event);
1539
+ };
1540
+ _this.onDropdownIndicatorTouchEnd = function(event) {
1541
+ if (_this.userIsDragging)
1542
+ return;
1543
+ _this.onDropdownIndicatorMouseDown(event);
1544
+ };
1545
+ _this.handleInputChange = function(event) {
1546
+ var prevInputValue = _this.props.inputValue;
1547
+ var inputValue = event.currentTarget.value;
1548
+ _this.setState({
1549
+ inputIsHiddenAfterUpdate: false
1550
+ });
1551
+ _this.onInputChange(inputValue, {
1552
+ action: "input-change",
1553
+ prevInputValue
1554
+ });
1555
+ if (!_this.props.menuIsOpen) {
1556
+ _this.onMenuOpen();
1557
+ }
1558
+ };
1559
+ _this.onInputFocus = function(event) {
1560
+ if (_this.props.onFocus) {
1561
+ _this.props.onFocus(event);
1562
+ }
1563
+ _this.setState({
1564
+ inputIsHiddenAfterUpdate: false,
1565
+ isFocused: true
1566
+ });
1567
+ if (_this.openAfterFocus || _this.props.openMenuOnFocus) {
1568
+ _this.openMenu("first");
1569
+ }
1570
+ _this.openAfterFocus = false;
1571
+ };
1572
+ _this.onInputBlur = function(event) {
1573
+ var prevInputValue = _this.props.inputValue;
1574
+ if (_this.menuListRef && _this.menuListRef.contains(document.activeElement)) {
1575
+ _this.inputRef.focus();
1576
+ return;
1577
+ }
1578
+ if (_this.props.onBlur) {
1579
+ _this.props.onBlur(event);
1580
+ }
1581
+ _this.onInputChange("", {
1582
+ action: "input-blur",
1583
+ prevInputValue
1584
+ });
1585
+ _this.onMenuClose();
1586
+ _this.setState({
1587
+ focusedValue: null,
1588
+ isFocused: false
1589
+ });
1590
+ };
1591
+ _this.onOptionHover = function(focusedOption) {
1592
+ if (_this.blockOptionHover || _this.state.focusedOption === focusedOption) {
1593
+ return;
1594
+ }
1595
+ var options = _this.getFocusableOptions();
1596
+ var focusedOptionIndex = options.indexOf(focusedOption);
1597
+ _this.setState({
1598
+ focusedOption,
1599
+ focusedOptionId: focusedOptionIndex > -1 ? _this.getFocusedOptionId(focusedOption) : null
1600
+ });
1601
+ };
1602
+ _this.shouldHideSelectedOptions = function() {
1603
+ return shouldHideSelectedOptions(_this.props);
1604
+ };
1605
+ _this.onValueInputFocus = function(e) {
1606
+ e.preventDefault();
1607
+ e.stopPropagation();
1608
+ _this.focus();
1609
+ };
1610
+ _this.onKeyDown = function(event) {
1611
+ var _this$props5 = _this.props, isMulti = _this$props5.isMulti, backspaceRemovesValue = _this$props5.backspaceRemovesValue, escapeClearsValue = _this$props5.escapeClearsValue, inputValue = _this$props5.inputValue, isClearable = _this$props5.isClearable, isDisabled = _this$props5.isDisabled, menuIsOpen = _this$props5.menuIsOpen, onKeyDown = _this$props5.onKeyDown, tabSelectsValue = _this$props5.tabSelectsValue, openMenuOnFocus = _this$props5.openMenuOnFocus;
1612
+ var _this$state = _this.state, focusedOption = _this$state.focusedOption, focusedValue = _this$state.focusedValue, selectValue = _this$state.selectValue;
1613
+ if (isDisabled)
1614
+ return;
1615
+ if (typeof onKeyDown === "function") {
1616
+ onKeyDown(event);
1617
+ if (event.defaultPrevented) {
1618
+ return;
1619
+ }
1620
+ }
1621
+ _this.blockOptionHover = true;
1622
+ switch (event.key) {
1623
+ case "ArrowLeft":
1624
+ if (!isMulti || inputValue)
1625
+ return;
1626
+ _this.focusValue("previous");
1627
+ break;
1628
+ case "ArrowRight":
1629
+ if (!isMulti || inputValue)
1630
+ return;
1631
+ _this.focusValue("next");
1632
+ break;
1633
+ case "Delete":
1634
+ case "Backspace":
1635
+ if (inputValue)
1636
+ return;
1637
+ if (focusedValue) {
1638
+ _this.removeValue(focusedValue);
1639
+ } else {
1640
+ if (!backspaceRemovesValue)
1641
+ return;
1642
+ if (isMulti) {
1643
+ _this.popValue();
1644
+ } else if (isClearable) {
1645
+ _this.clearValue();
1646
+ }
1647
+ }
1648
+ break;
1649
+ case "Tab":
1650
+ if (_this.isComposing)
1651
+ return;
1652
+ if (event.shiftKey || !menuIsOpen || !tabSelectsValue || !focusedOption || // don't capture the event if the menu opens on focus and the focused
1653
+ // option is already selected; it breaks the flow of navigation
1654
+ openMenuOnFocus && _this.isOptionSelected(focusedOption, selectValue)) {
1655
+ return;
1656
+ }
1657
+ _this.selectOption(focusedOption);
1658
+ break;
1659
+ case "Enter":
1660
+ if (event.keyCode === 229) {
1661
+ break;
1662
+ }
1663
+ if (menuIsOpen) {
1664
+ if (!focusedOption)
1665
+ return;
1666
+ if (_this.isComposing)
1667
+ return;
1668
+ _this.selectOption(focusedOption);
1669
+ break;
1670
+ }
1671
+ return;
1672
+ case "Escape":
1673
+ if (menuIsOpen) {
1674
+ _this.setState({
1675
+ inputIsHiddenAfterUpdate: false
1676
+ });
1677
+ _this.onInputChange("", {
1678
+ action: "menu-close",
1679
+ prevInputValue: inputValue
1680
+ });
1681
+ _this.onMenuClose();
1682
+ } else if (isClearable && escapeClearsValue) {
1683
+ _this.clearValue();
1684
+ }
1685
+ break;
1686
+ case " ":
1687
+ if (inputValue) {
1688
+ return;
1689
+ }
1690
+ if (!menuIsOpen) {
1691
+ _this.openMenu("first");
1692
+ break;
1693
+ }
1694
+ if (!focusedOption)
1695
+ return;
1696
+ _this.selectOption(focusedOption);
1697
+ break;
1698
+ case "ArrowUp":
1699
+ if (menuIsOpen) {
1700
+ _this.focusOption("up");
1701
+ } else {
1702
+ _this.openMenu("last");
1703
+ }
1704
+ break;
1705
+ case "ArrowDown":
1706
+ if (menuIsOpen) {
1707
+ _this.focusOption("down");
1708
+ } else {
1709
+ _this.openMenu("first");
1710
+ }
1711
+ break;
1712
+ case "PageUp":
1713
+ if (!menuIsOpen)
1714
+ return;
1715
+ _this.focusOption("pageup");
1716
+ break;
1717
+ case "PageDown":
1718
+ if (!menuIsOpen)
1719
+ return;
1720
+ _this.focusOption("pagedown");
1721
+ break;
1722
+ case "Home":
1723
+ if (!menuIsOpen)
1724
+ return;
1725
+ _this.focusOption("first");
1726
+ break;
1727
+ case "End":
1728
+ if (!menuIsOpen)
1729
+ return;
1730
+ _this.focusOption("last");
1731
+ break;
1732
+ default:
1733
+ return;
1734
+ }
1735
+ event.preventDefault();
1736
+ };
1737
+ _this.state.instancePrefix = "react-select-" + (_this.props.instanceId || ++instanceId);
1738
+ _this.state.selectValue = cleanValue(_props.value);
1739
+ if (_props.menuIsOpen && _this.state.selectValue.length) {
1740
+ var focusableOptionsWithIds = _this.getFocusableOptionsWithIds();
1741
+ var focusableOptions = _this.buildFocusableOptions();
1742
+ var optionIndex = focusableOptions.indexOf(_this.state.selectValue[0]);
1743
+ _this.state.focusableOptionsWithIds = focusableOptionsWithIds;
1744
+ _this.state.focusedOption = focusableOptions[optionIndex];
1745
+ _this.state.focusedOptionId = getFocusedOptionId(focusableOptionsWithIds, focusableOptions[optionIndex]);
1746
+ }
1747
+ return _this;
1748
+ }
1749
+ _createClass(Select2, [{
1750
+ key: "componentDidMount",
1751
+ value: function componentDidMount() {
1752
+ this.startListeningComposition();
1753
+ this.startListeningToTouch();
1754
+ if (this.props.closeMenuOnScroll && document && document.addEventListener) {
1755
+ document.addEventListener("scroll", this.onScroll, true);
1756
+ }
1757
+ if (this.props.autoFocus) {
1758
+ this.focusInput();
1759
+ }
1760
+ if (this.props.menuIsOpen && this.state.focusedOption && this.menuListRef && this.focusedOptionRef) {
1761
+ scrollIntoView(this.menuListRef, this.focusedOptionRef);
1762
+ }
1763
+ }
1764
+ }, {
1765
+ key: "componentDidUpdate",
1766
+ value: function componentDidUpdate(prevProps) {
1767
+ var _this$props6 = this.props, isDisabled = _this$props6.isDisabled, menuIsOpen = _this$props6.menuIsOpen;
1768
+ var isFocused = this.state.isFocused;
1769
+ if (
1770
+ // ensure focus is restored correctly when the control becomes enabled
1771
+ isFocused && !isDisabled && prevProps.isDisabled || // ensure focus is on the Input when the menu opens
1772
+ isFocused && menuIsOpen && !prevProps.menuIsOpen
1773
+ ) {
1774
+ this.focusInput();
1775
+ }
1776
+ if (isFocused && isDisabled && !prevProps.isDisabled) {
1777
+ this.setState({
1778
+ isFocused: false
1779
+ }, this.onMenuClose);
1780
+ } else if (!isFocused && !isDisabled && prevProps.isDisabled && this.inputRef === document.activeElement) {
1781
+ this.setState({
1782
+ isFocused: true
1783
+ });
1784
+ }
1785
+ if (this.menuListRef && this.focusedOptionRef && this.scrollToFocusedOptionOnUpdate) {
1786
+ scrollIntoView(this.menuListRef, this.focusedOptionRef);
1787
+ this.scrollToFocusedOptionOnUpdate = false;
1788
+ }
1789
+ }
1790
+ }, {
1791
+ key: "componentWillUnmount",
1792
+ value: function componentWillUnmount() {
1793
+ this.stopListeningComposition();
1794
+ this.stopListeningToTouch();
1795
+ document.removeEventListener("scroll", this.onScroll, true);
1796
+ }
1797
+ // ==============================
1798
+ // Consumer Handlers
1799
+ // ==============================
1800
+ }, {
1801
+ key: "onMenuOpen",
1802
+ value: function onMenuOpen() {
1803
+ this.props.onMenuOpen();
1804
+ }
1805
+ }, {
1806
+ key: "onMenuClose",
1807
+ value: function onMenuClose() {
1808
+ this.onInputChange("", {
1809
+ action: "menu-close",
1810
+ prevInputValue: this.props.inputValue
1811
+ });
1812
+ this.props.onMenuClose();
1813
+ }
1814
+ }, {
1815
+ key: "onInputChange",
1816
+ value: function onInputChange(newValue, actionMeta) {
1817
+ this.props.onInputChange(newValue, actionMeta);
1818
+ }
1819
+ // ==============================
1820
+ // Methods
1821
+ // ==============================
1822
+ }, {
1823
+ key: "focusInput",
1824
+ value: function focusInput() {
1825
+ if (!this.inputRef)
1826
+ return;
1827
+ this.inputRef.focus();
1828
+ }
1829
+ }, {
1830
+ key: "blurInput",
1831
+ value: function blurInput() {
1832
+ if (!this.inputRef)
1833
+ return;
1834
+ this.inputRef.blur();
1835
+ }
1836
+ // aliased for consumers
1837
+ }, {
1838
+ key: "openMenu",
1839
+ value: function openMenu(focusOption) {
1840
+ var _this2 = this;
1841
+ var _this$state2 = this.state, selectValue = _this$state2.selectValue, isFocused = _this$state2.isFocused;
1842
+ var focusableOptions = this.buildFocusableOptions();
1843
+ var openAtIndex = focusOption === "first" ? 0 : focusableOptions.length - 1;
1844
+ if (!this.props.isMulti) {
1845
+ var selectedIndex = focusableOptions.indexOf(selectValue[0]);
1846
+ if (selectedIndex > -1) {
1847
+ openAtIndex = selectedIndex;
1848
+ }
1849
+ }
1850
+ this.scrollToFocusedOptionOnUpdate = !(isFocused && this.menuListRef);
1851
+ this.setState({
1852
+ inputIsHiddenAfterUpdate: false,
1853
+ focusedValue: null,
1854
+ focusedOption: focusableOptions[openAtIndex],
1855
+ focusedOptionId: this.getFocusedOptionId(focusableOptions[openAtIndex])
1856
+ }, function() {
1857
+ return _this2.onMenuOpen();
1858
+ });
1859
+ }
1860
+ }, {
1861
+ key: "focusValue",
1862
+ value: function focusValue(direction) {
1863
+ var _this$state3 = this.state, selectValue = _this$state3.selectValue, focusedValue = _this$state3.focusedValue;
1864
+ if (!this.props.isMulti)
1865
+ return;
1866
+ this.setState({
1867
+ focusedOption: null
1868
+ });
1869
+ var focusedIndex = selectValue.indexOf(focusedValue);
1870
+ if (!focusedValue) {
1871
+ focusedIndex = -1;
1872
+ }
1873
+ var lastIndex = selectValue.length - 1;
1874
+ var nextFocus = -1;
1875
+ if (!selectValue.length)
1876
+ return;
1877
+ switch (direction) {
1878
+ case "previous":
1879
+ if (focusedIndex === 0) {
1880
+ nextFocus = 0;
1881
+ } else if (focusedIndex === -1) {
1882
+ nextFocus = lastIndex;
1883
+ } else {
1884
+ nextFocus = focusedIndex - 1;
1885
+ }
1886
+ break;
1887
+ case "next":
1888
+ if (focusedIndex > -1 && focusedIndex < lastIndex) {
1889
+ nextFocus = focusedIndex + 1;
1890
+ }
1891
+ break;
1892
+ }
1893
+ this.setState({
1894
+ inputIsHidden: nextFocus !== -1,
1895
+ focusedValue: selectValue[nextFocus]
1896
+ });
1897
+ }
1898
+ }, {
1899
+ key: "focusOption",
1900
+ value: function focusOption() {
1901
+ var direction = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "first";
1902
+ var pageSize = this.props.pageSize;
1903
+ var focusedOption = this.state.focusedOption;
1904
+ var options = this.getFocusableOptions();
1905
+ if (!options.length)
1906
+ return;
1907
+ var nextFocus = 0;
1908
+ var focusedIndex = options.indexOf(focusedOption);
1909
+ if (!focusedOption) {
1910
+ focusedIndex = -1;
1911
+ }
1912
+ if (direction === "up") {
1913
+ nextFocus = focusedIndex > 0 ? focusedIndex - 1 : options.length - 1;
1914
+ } else if (direction === "down") {
1915
+ nextFocus = (focusedIndex + 1) % options.length;
1916
+ } else if (direction === "pageup") {
1917
+ nextFocus = focusedIndex - pageSize;
1918
+ if (nextFocus < 0)
1919
+ nextFocus = 0;
1920
+ } else if (direction === "pagedown") {
1921
+ nextFocus = focusedIndex + pageSize;
1922
+ if (nextFocus > options.length - 1)
1923
+ nextFocus = options.length - 1;
1924
+ } else if (direction === "last") {
1925
+ nextFocus = options.length - 1;
1926
+ }
1927
+ this.scrollToFocusedOptionOnUpdate = true;
1928
+ this.setState({
1929
+ focusedOption: options[nextFocus],
1930
+ focusedValue: null,
1931
+ focusedOptionId: this.getFocusedOptionId(options[nextFocus])
1932
+ });
1933
+ }
1934
+ }, {
1935
+ key: "getTheme",
1936
+ value: (
1937
+ // ==============================
1938
+ // Getters
1939
+ // ==============================
1940
+ function getTheme() {
1941
+ if (!this.props.theme) {
1942
+ return defaultTheme;
1943
+ }
1944
+ if (typeof this.props.theme === "function") {
1945
+ return this.props.theme(defaultTheme);
1946
+ }
1947
+ return _objectSpread2(_objectSpread2({}, defaultTheme), this.props.theme);
1948
+ }
1949
+ )
1950
+ }, {
1951
+ key: "getCommonProps",
1952
+ value: function getCommonProps() {
1953
+ var clearValue = this.clearValue, cx = this.cx, getStyles = this.getStyles, getClassNames = this.getClassNames, getValue = this.getValue, selectOption = this.selectOption, setValue = this.setValue, props = this.props;
1954
+ var isMulti = props.isMulti, isRtl = props.isRtl, options = props.options;
1955
+ var hasValue = this.hasValue();
1956
+ return {
1957
+ clearValue,
1958
+ cx,
1959
+ getStyles,
1960
+ getClassNames,
1961
+ getValue,
1962
+ hasValue,
1963
+ isMulti,
1964
+ isRtl,
1965
+ options,
1966
+ selectOption,
1967
+ selectProps: props,
1968
+ setValue,
1969
+ theme: this.getTheme()
1970
+ };
1971
+ }
1972
+ }, {
1973
+ key: "hasValue",
1974
+ value: function hasValue() {
1975
+ var selectValue = this.state.selectValue;
1976
+ return selectValue.length > 0;
1977
+ }
1978
+ }, {
1979
+ key: "hasOptions",
1980
+ value: function hasOptions() {
1981
+ return !!this.getFocusableOptions().length;
1982
+ }
1983
+ }, {
1984
+ key: "isClearable",
1985
+ value: function isClearable() {
1986
+ var _this$props7 = this.props, isClearable2 = _this$props7.isClearable, isMulti = _this$props7.isMulti;
1987
+ if (isClearable2 === void 0)
1988
+ return isMulti;
1989
+ return isClearable2;
1990
+ }
1991
+ }, {
1992
+ key: "isOptionDisabled",
1993
+ value: function isOptionDisabled3(option, selectValue) {
1994
+ return _isOptionDisabled(this.props, option, selectValue);
1995
+ }
1996
+ }, {
1997
+ key: "isOptionSelected",
1998
+ value: function isOptionSelected(option, selectValue) {
1999
+ return _isOptionSelected(this.props, option, selectValue);
2000
+ }
2001
+ }, {
2002
+ key: "filterOption",
2003
+ value: function filterOption(option, inputValue) {
2004
+ return _filterOption(this.props, option, inputValue);
2005
+ }
2006
+ }, {
2007
+ key: "formatOptionLabel",
2008
+ value: function formatOptionLabel(data, context) {
2009
+ if (typeof this.props.formatOptionLabel === "function") {
2010
+ var _inputValue = this.props.inputValue;
2011
+ var _selectValue = this.state.selectValue;
2012
+ return this.props.formatOptionLabel(data, {
2013
+ context,
2014
+ inputValue: _inputValue,
2015
+ selectValue: _selectValue
2016
+ });
2017
+ } else {
2018
+ return this.getOptionLabel(data);
2019
+ }
2020
+ }
2021
+ }, {
2022
+ key: "formatGroupLabel",
2023
+ value: function formatGroupLabel3(data) {
2024
+ return this.props.formatGroupLabel(data);
2025
+ }
2026
+ // ==============================
2027
+ // Mouse Handlers
2028
+ // ==============================
2029
+ }, {
2030
+ key: "startListeningComposition",
2031
+ value: (
2032
+ // ==============================
2033
+ // Composition Handlers
2034
+ // ==============================
2035
+ function startListeningComposition() {
2036
+ if (document && document.addEventListener) {
2037
+ document.addEventListener("compositionstart", this.onCompositionStart, false);
2038
+ document.addEventListener("compositionend", this.onCompositionEnd, false);
2039
+ }
2040
+ }
2041
+ )
2042
+ }, {
2043
+ key: "stopListeningComposition",
2044
+ value: function stopListeningComposition() {
2045
+ if (document && document.removeEventListener) {
2046
+ document.removeEventListener("compositionstart", this.onCompositionStart);
2047
+ document.removeEventListener("compositionend", this.onCompositionEnd);
2048
+ }
2049
+ }
2050
+ }, {
2051
+ key: "startListeningToTouch",
2052
+ value: (
2053
+ // ==============================
2054
+ // Touch Handlers
2055
+ // ==============================
2056
+ function startListeningToTouch() {
2057
+ if (document && document.addEventListener) {
2058
+ document.addEventListener("touchstart", this.onTouchStart, false);
2059
+ document.addEventListener("touchmove", this.onTouchMove, false);
2060
+ document.addEventListener("touchend", this.onTouchEnd, false);
2061
+ }
2062
+ }
2063
+ )
2064
+ }, {
2065
+ key: "stopListeningToTouch",
2066
+ value: function stopListeningToTouch() {
2067
+ if (document && document.removeEventListener) {
2068
+ document.removeEventListener("touchstart", this.onTouchStart);
2069
+ document.removeEventListener("touchmove", this.onTouchMove);
2070
+ document.removeEventListener("touchend", this.onTouchEnd);
2071
+ }
2072
+ }
2073
+ }, {
2074
+ key: "renderInput",
2075
+ value: (
2076
+ // ==============================
2077
+ // Renderers
2078
+ // ==============================
2079
+ function renderInput() {
2080
+ var _this$props8 = this.props, isDisabled = _this$props8.isDisabled, isSearchable = _this$props8.isSearchable, inputId = _this$props8.inputId, inputValue = _this$props8.inputValue, tabIndex = _this$props8.tabIndex, form = _this$props8.form, menuIsOpen = _this$props8.menuIsOpen, required = _this$props8.required;
2081
+ var _this$getComponents = this.getComponents(), Input = _this$getComponents.Input;
2082
+ var _this$state4 = this.state, inputIsHidden = _this$state4.inputIsHidden, ariaSelection = _this$state4.ariaSelection;
2083
+ var commonProps = this.commonProps;
2084
+ var id = inputId || this.getElementId("input");
2085
+ var ariaAttributes = _objectSpread2(_objectSpread2(_objectSpread2({
2086
+ "aria-autocomplete": "list",
2087
+ "aria-expanded": menuIsOpen,
2088
+ "aria-haspopup": true,
2089
+ "aria-errormessage": this.props["aria-errormessage"],
2090
+ "aria-invalid": this.props["aria-invalid"],
2091
+ "aria-label": this.props["aria-label"],
2092
+ "aria-labelledby": this.props["aria-labelledby"],
2093
+ "aria-required": required,
2094
+ role: "combobox",
2095
+ "aria-activedescendant": this.isAppleDevice ? void 0 : this.state.focusedOptionId || ""
2096
+ }, menuIsOpen && {
2097
+ "aria-controls": this.getElementId("listbox")
2098
+ }), !isSearchable && {
2099
+ "aria-readonly": true
2100
+ }), this.hasValue() ? (ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === "initial-input-focus" && {
2101
+ "aria-describedby": this.getElementId("live-region")
2102
+ } : {
2103
+ "aria-describedby": this.getElementId("placeholder")
2104
+ });
2105
+ if (!isSearchable) {
2106
+ return /* @__PURE__ */ React.createElement(DummyInput, _extends({
2107
+ id,
2108
+ innerRef: this.getInputRef,
2109
+ onBlur: this.onInputBlur,
2110
+ onChange: noop,
2111
+ onFocus: this.onInputFocus,
2112
+ disabled: isDisabled,
2113
+ tabIndex,
2114
+ inputMode: "none",
2115
+ form,
2116
+ value: ""
2117
+ }, ariaAttributes));
2118
+ }
2119
+ return /* @__PURE__ */ React.createElement(Input, _extends({}, commonProps, {
2120
+ autoCapitalize: "none",
2121
+ autoComplete: "off",
2122
+ autoCorrect: "off",
2123
+ id,
2124
+ innerRef: this.getInputRef,
2125
+ isDisabled,
2126
+ isHidden: inputIsHidden,
2127
+ onBlur: this.onInputBlur,
2128
+ onChange: this.handleInputChange,
2129
+ onFocus: this.onInputFocus,
2130
+ spellCheck: "false",
2131
+ tabIndex,
2132
+ form,
2133
+ type: "text",
2134
+ value: inputValue
2135
+ }, ariaAttributes));
2136
+ }
2137
+ )
2138
+ }, {
2139
+ key: "renderPlaceholderOrValue",
2140
+ value: function renderPlaceholderOrValue() {
2141
+ var _this3 = this;
2142
+ var _this$getComponents2 = this.getComponents(), MultiValue = _this$getComponents2.MultiValue, MultiValueContainer = _this$getComponents2.MultiValueContainer, MultiValueLabel = _this$getComponents2.MultiValueLabel, MultiValueRemove = _this$getComponents2.MultiValueRemove, SingleValue = _this$getComponents2.SingleValue, Placeholder = _this$getComponents2.Placeholder;
2143
+ var commonProps = this.commonProps;
2144
+ var _this$props9 = this.props, controlShouldRenderValue = _this$props9.controlShouldRenderValue, isDisabled = _this$props9.isDisabled, isMulti = _this$props9.isMulti, inputValue = _this$props9.inputValue, placeholder = _this$props9.placeholder;
2145
+ var _this$state5 = this.state, selectValue = _this$state5.selectValue, focusedValue = _this$state5.focusedValue, isFocused = _this$state5.isFocused;
2146
+ if (!this.hasValue() || !controlShouldRenderValue) {
2147
+ return inputValue ? null : /* @__PURE__ */ React.createElement(Placeholder, _extends({}, commonProps, {
2148
+ key: "placeholder",
2149
+ isDisabled,
2150
+ isFocused,
2151
+ innerProps: {
2152
+ id: this.getElementId("placeholder")
2153
+ }
2154
+ }), placeholder);
2155
+ }
2156
+ if (isMulti) {
2157
+ return selectValue.map(function(opt, index) {
2158
+ var isOptionFocused = opt === focusedValue;
2159
+ var key = "".concat(_this3.getOptionLabel(opt), "-").concat(_this3.getOptionValue(opt));
2160
+ return /* @__PURE__ */ React.createElement(MultiValue, _extends({}, commonProps, {
2161
+ components: {
2162
+ Container: MultiValueContainer,
2163
+ Label: MultiValueLabel,
2164
+ Remove: MultiValueRemove
2165
+ },
2166
+ isFocused: isOptionFocused,
2167
+ isDisabled,
2168
+ key,
2169
+ index,
2170
+ removeProps: {
2171
+ onClick: function onClick() {
2172
+ return _this3.removeValue(opt);
2173
+ },
2174
+ onTouchEnd: function onTouchEnd() {
2175
+ return _this3.removeValue(opt);
2176
+ },
2177
+ onMouseDown: function onMouseDown(e) {
2178
+ e.preventDefault();
2179
+ }
2180
+ },
2181
+ data: opt
2182
+ }), _this3.formatOptionLabel(opt, "value"));
2183
+ });
2184
+ }
2185
+ if (inputValue) {
2186
+ return null;
2187
+ }
2188
+ var singleValue = selectValue[0];
2189
+ return /* @__PURE__ */ React.createElement(SingleValue, _extends({}, commonProps, {
2190
+ data: singleValue,
2191
+ isDisabled
2192
+ }), this.formatOptionLabel(singleValue, "value"));
2193
+ }
2194
+ }, {
2195
+ key: "renderClearIndicator",
2196
+ value: function renderClearIndicator() {
2197
+ var _this$getComponents3 = this.getComponents(), ClearIndicator = _this$getComponents3.ClearIndicator;
2198
+ var commonProps = this.commonProps;
2199
+ var _this$props10 = this.props, isDisabled = _this$props10.isDisabled, isLoading = _this$props10.isLoading;
2200
+ var isFocused = this.state.isFocused;
2201
+ if (!this.isClearable() || !ClearIndicator || isDisabled || !this.hasValue() || isLoading) {
2202
+ return null;
2203
+ }
2204
+ var innerProps = {
2205
+ onMouseDown: this.onClearIndicatorMouseDown,
2206
+ onTouchEnd: this.onClearIndicatorTouchEnd,
2207
+ "aria-hidden": "true"
2208
+ };
2209
+ return /* @__PURE__ */ React.createElement(ClearIndicator, _extends({}, commonProps, {
2210
+ innerProps,
2211
+ isFocused
2212
+ }));
2213
+ }
2214
+ }, {
2215
+ key: "renderLoadingIndicator",
2216
+ value: function renderLoadingIndicator() {
2217
+ var _this$getComponents4 = this.getComponents(), LoadingIndicator = _this$getComponents4.LoadingIndicator;
2218
+ var commonProps = this.commonProps;
2219
+ var _this$props11 = this.props, isDisabled = _this$props11.isDisabled, isLoading = _this$props11.isLoading;
2220
+ var isFocused = this.state.isFocused;
2221
+ if (!LoadingIndicator || !isLoading)
2222
+ return null;
2223
+ var innerProps = {
2224
+ "aria-hidden": "true"
2225
+ };
2226
+ return /* @__PURE__ */ React.createElement(LoadingIndicator, _extends({}, commonProps, {
2227
+ innerProps,
2228
+ isDisabled,
2229
+ isFocused
2230
+ }));
2231
+ }
2232
+ }, {
2233
+ key: "renderIndicatorSeparator",
2234
+ value: function renderIndicatorSeparator() {
2235
+ var _this$getComponents5 = this.getComponents(), DropdownIndicator = _this$getComponents5.DropdownIndicator, IndicatorSeparator = _this$getComponents5.IndicatorSeparator;
2236
+ if (!DropdownIndicator || !IndicatorSeparator)
2237
+ return null;
2238
+ var commonProps = this.commonProps;
2239
+ var isDisabled = this.props.isDisabled;
2240
+ var isFocused = this.state.isFocused;
2241
+ return /* @__PURE__ */ React.createElement(IndicatorSeparator, _extends({}, commonProps, {
2242
+ isDisabled,
2243
+ isFocused
2244
+ }));
2245
+ }
2246
+ }, {
2247
+ key: "renderDropdownIndicator",
2248
+ value: function renderDropdownIndicator() {
2249
+ var _this$getComponents6 = this.getComponents(), DropdownIndicator = _this$getComponents6.DropdownIndicator;
2250
+ if (!DropdownIndicator)
2251
+ return null;
2252
+ var commonProps = this.commonProps;
2253
+ var isDisabled = this.props.isDisabled;
2254
+ var isFocused = this.state.isFocused;
2255
+ var innerProps = {
2256
+ onMouseDown: this.onDropdownIndicatorMouseDown,
2257
+ onTouchEnd: this.onDropdownIndicatorTouchEnd,
2258
+ "aria-hidden": "true"
2259
+ };
2260
+ return /* @__PURE__ */ React.createElement(DropdownIndicator, _extends({}, commonProps, {
2261
+ innerProps,
2262
+ isDisabled,
2263
+ isFocused
2264
+ }));
2265
+ }
2266
+ }, {
2267
+ key: "renderMenu",
2268
+ value: function renderMenu() {
2269
+ var _this4 = this;
2270
+ var _this$getComponents7 = this.getComponents(), Group = _this$getComponents7.Group, GroupHeading = _this$getComponents7.GroupHeading, Menu = _this$getComponents7.Menu, MenuList = _this$getComponents7.MenuList, MenuPortal = _this$getComponents7.MenuPortal, LoadingMessage = _this$getComponents7.LoadingMessage, NoOptionsMessage = _this$getComponents7.NoOptionsMessage, Option = _this$getComponents7.Option;
2271
+ var commonProps = this.commonProps;
2272
+ var focusedOption = this.state.focusedOption;
2273
+ var _this$props12 = this.props, captureMenuScroll = _this$props12.captureMenuScroll, inputValue = _this$props12.inputValue, isLoading = _this$props12.isLoading, loadingMessage2 = _this$props12.loadingMessage, minMenuHeight = _this$props12.minMenuHeight, maxMenuHeight = _this$props12.maxMenuHeight, menuIsOpen = _this$props12.menuIsOpen, menuPlacement = _this$props12.menuPlacement, menuPosition = _this$props12.menuPosition, menuPortalTarget = _this$props12.menuPortalTarget, menuShouldBlockScroll = _this$props12.menuShouldBlockScroll, menuShouldScrollIntoView = _this$props12.menuShouldScrollIntoView, noOptionsMessage2 = _this$props12.noOptionsMessage, onMenuScrollToTop = _this$props12.onMenuScrollToTop, onMenuScrollToBottom = _this$props12.onMenuScrollToBottom;
2274
+ if (!menuIsOpen)
2275
+ return null;
2276
+ var render = function render2(props, id) {
2277
+ var type = props.type, data = props.data, isDisabled = props.isDisabled, isSelected = props.isSelected, label = props.label, value = props.value;
2278
+ var isFocused = focusedOption === data;
2279
+ var onHover = isDisabled ? void 0 : function() {
2280
+ return _this4.onOptionHover(data);
2281
+ };
2282
+ var onSelect = isDisabled ? void 0 : function() {
2283
+ return _this4.selectOption(data);
2284
+ };
2285
+ var optionId = "".concat(_this4.getElementId("option"), "-").concat(id);
2286
+ var innerProps = {
2287
+ id: optionId,
2288
+ onClick: onSelect,
2289
+ onMouseMove: onHover,
2290
+ onMouseOver: onHover,
2291
+ tabIndex: -1,
2292
+ role: "option",
2293
+ "aria-selected": _this4.isAppleDevice ? void 0 : isSelected
2294
+ // is not supported on Apple devices
2295
+ };
2296
+ return /* @__PURE__ */ React.createElement(Option, _extends({}, commonProps, {
2297
+ innerProps,
2298
+ data,
2299
+ isDisabled,
2300
+ isSelected,
2301
+ key: optionId,
2302
+ label,
2303
+ type,
2304
+ value,
2305
+ isFocused,
2306
+ innerRef: isFocused ? _this4.getFocusedOptionRef : void 0
2307
+ }), _this4.formatOptionLabel(props.data, "menu"));
2308
+ };
2309
+ var menuUI;
2310
+ if (this.hasOptions()) {
2311
+ menuUI = this.getCategorizedOptions().map(function(item) {
2312
+ if (item.type === "group") {
2313
+ var _data = item.data, options = item.options, groupIndex = item.index;
2314
+ var groupId = "".concat(_this4.getElementId("group"), "-").concat(groupIndex);
2315
+ var headingId = "".concat(groupId, "-heading");
2316
+ return /* @__PURE__ */ React.createElement(Group, _extends({}, commonProps, {
2317
+ key: groupId,
2318
+ data: _data,
2319
+ options,
2320
+ Heading: GroupHeading,
2321
+ headingProps: {
2322
+ id: headingId,
2323
+ data: item.data
2324
+ },
2325
+ label: _this4.formatGroupLabel(item.data)
2326
+ }), item.options.map(function(option) {
2327
+ return render(option, "".concat(groupIndex, "-").concat(option.index));
2328
+ }));
2329
+ } else if (item.type === "option") {
2330
+ return render(item, "".concat(item.index));
2331
+ }
2332
+ });
2333
+ } else if (isLoading) {
2334
+ var message = loadingMessage2({
2335
+ inputValue
2336
+ });
2337
+ if (message === null)
2338
+ return null;
2339
+ menuUI = /* @__PURE__ */ React.createElement(LoadingMessage, commonProps, message);
2340
+ } else {
2341
+ var _message = noOptionsMessage2({
2342
+ inputValue
2343
+ });
2344
+ if (_message === null)
2345
+ return null;
2346
+ menuUI = /* @__PURE__ */ React.createElement(NoOptionsMessage, commonProps, _message);
2347
+ }
2348
+ var menuPlacementProps = {
2349
+ minMenuHeight,
2350
+ maxMenuHeight,
2351
+ menuPlacement,
2352
+ menuPosition,
2353
+ menuShouldScrollIntoView
2354
+ };
2355
+ var menuElement = /* @__PURE__ */ React.createElement(MenuPlacer, _extends({}, commonProps, menuPlacementProps), function(_ref4) {
2356
+ var ref = _ref4.ref, _ref4$placerProps = _ref4.placerProps, placement = _ref4$placerProps.placement, maxHeight = _ref4$placerProps.maxHeight;
2357
+ return /* @__PURE__ */ React.createElement(Menu, _extends({}, commonProps, menuPlacementProps, {
2358
+ innerRef: ref,
2359
+ innerProps: {
2360
+ onMouseDown: _this4.onMenuMouseDown,
2361
+ onMouseMove: _this4.onMenuMouseMove
2362
+ },
2363
+ isLoading,
2364
+ placement
2365
+ }), /* @__PURE__ */ React.createElement(ScrollManager, {
2366
+ captureEnabled: captureMenuScroll,
2367
+ onTopArrive: onMenuScrollToTop,
2368
+ onBottomArrive: onMenuScrollToBottom,
2369
+ lockEnabled: menuShouldBlockScroll
2370
+ }, function(scrollTargetRef) {
2371
+ return /* @__PURE__ */ React.createElement(MenuList, _extends({}, commonProps, {
2372
+ innerRef: function innerRef(instance) {
2373
+ _this4.getMenuListRef(instance);
2374
+ scrollTargetRef(instance);
2375
+ },
2376
+ innerProps: {
2377
+ role: "listbox",
2378
+ "aria-multiselectable": commonProps.isMulti,
2379
+ id: _this4.getElementId("listbox")
2380
+ },
2381
+ isLoading,
2382
+ maxHeight,
2383
+ focusedOption
2384
+ }), menuUI);
2385
+ }));
2386
+ });
2387
+ return menuPortalTarget || menuPosition === "fixed" ? /* @__PURE__ */ React.createElement(MenuPortal, _extends({}, commonProps, {
2388
+ appendTo: menuPortalTarget,
2389
+ controlElement: this.controlRef,
2390
+ menuPlacement,
2391
+ menuPosition
2392
+ }), menuElement) : menuElement;
2393
+ }
2394
+ }, {
2395
+ key: "renderFormField",
2396
+ value: function renderFormField() {
2397
+ var _this5 = this;
2398
+ var _this$props13 = this.props, delimiter = _this$props13.delimiter, isDisabled = _this$props13.isDisabled, isMulti = _this$props13.isMulti, name = _this$props13.name, required = _this$props13.required;
2399
+ var selectValue = this.state.selectValue;
2400
+ if (required && !this.hasValue() && !isDisabled) {
2401
+ return /* @__PURE__ */ React.createElement(RequiredInput$1, {
2402
+ name,
2403
+ onFocus: this.onValueInputFocus
2404
+ });
2405
+ }
2406
+ if (!name || isDisabled)
2407
+ return;
2408
+ if (isMulti) {
2409
+ if (delimiter) {
2410
+ var value = selectValue.map(function(opt) {
2411
+ return _this5.getOptionValue(opt);
2412
+ }).join(delimiter);
2413
+ return /* @__PURE__ */ React.createElement("input", {
2414
+ name,
2415
+ type: "hidden",
2416
+ value
2417
+ });
2418
+ } else {
2419
+ var input = selectValue.length > 0 ? selectValue.map(function(opt, i) {
2420
+ return /* @__PURE__ */ React.createElement("input", {
2421
+ key: "i-".concat(i),
2422
+ name,
2423
+ type: "hidden",
2424
+ value: _this5.getOptionValue(opt)
2425
+ });
2426
+ }) : /* @__PURE__ */ React.createElement("input", {
2427
+ name,
2428
+ type: "hidden",
2429
+ value: ""
2430
+ });
2431
+ return /* @__PURE__ */ React.createElement("div", null, input);
2432
+ }
2433
+ } else {
2434
+ var _value = selectValue[0] ? this.getOptionValue(selectValue[0]) : "";
2435
+ return /* @__PURE__ */ React.createElement("input", {
2436
+ name,
2437
+ type: "hidden",
2438
+ value: _value
2439
+ });
2440
+ }
2441
+ }
2442
+ }, {
2443
+ key: "renderLiveRegion",
2444
+ value: function renderLiveRegion() {
2445
+ var commonProps = this.commonProps;
2446
+ var _this$state6 = this.state, ariaSelection = _this$state6.ariaSelection, focusedOption = _this$state6.focusedOption, focusedValue = _this$state6.focusedValue, isFocused = _this$state6.isFocused, selectValue = _this$state6.selectValue;
2447
+ var focusableOptions = this.getFocusableOptions();
2448
+ return /* @__PURE__ */ React.createElement(LiveRegion$1, _extends({}, commonProps, {
2449
+ id: this.getElementId("live-region"),
2450
+ ariaSelection,
2451
+ focusedOption,
2452
+ focusedValue,
2453
+ isFocused,
2454
+ selectValue,
2455
+ focusableOptions,
2456
+ isAppleDevice: this.isAppleDevice
2457
+ }));
2458
+ }
2459
+ }, {
2460
+ key: "render",
2461
+ value: function render() {
2462
+ var _this$getComponents8 = this.getComponents(), Control = _this$getComponents8.Control, IndicatorsContainer = _this$getComponents8.IndicatorsContainer, SelectContainer = _this$getComponents8.SelectContainer, ValueContainer = _this$getComponents8.ValueContainer;
2463
+ var _this$props14 = this.props, className = _this$props14.className, id = _this$props14.id, isDisabled = _this$props14.isDisabled, menuIsOpen = _this$props14.menuIsOpen;
2464
+ var isFocused = this.state.isFocused;
2465
+ var commonProps = this.commonProps = this.getCommonProps();
2466
+ return /* @__PURE__ */ React.createElement(SelectContainer, _extends({}, commonProps, {
2467
+ className,
2468
+ innerProps: {
2469
+ id,
2470
+ onKeyDown: this.onKeyDown
2471
+ },
2472
+ isDisabled,
2473
+ isFocused
2474
+ }), this.renderLiveRegion(), /* @__PURE__ */ React.createElement(Control, _extends({}, commonProps, {
2475
+ innerRef: this.getControlRef,
2476
+ innerProps: {
2477
+ onMouseDown: this.onControlMouseDown,
2478
+ onTouchEnd: this.onControlTouchEnd
2479
+ },
2480
+ isDisabled,
2481
+ isFocused,
2482
+ menuIsOpen
2483
+ }), /* @__PURE__ */ React.createElement(ValueContainer, _extends({}, commonProps, {
2484
+ isDisabled
2485
+ }), this.renderPlaceholderOrValue(), this.renderInput()), /* @__PURE__ */ React.createElement(IndicatorsContainer, _extends({}, commonProps, {
2486
+ isDisabled
2487
+ }), this.renderClearIndicator(), this.renderLoadingIndicator(), this.renderIndicatorSeparator(), this.renderDropdownIndicator())), this.renderMenu(), this.renderFormField());
2488
+ }
2489
+ }], [{
2490
+ key: "getDerivedStateFromProps",
2491
+ value: function getDerivedStateFromProps(props, state) {
2492
+ var prevProps = state.prevProps, clearFocusValueOnUpdate = state.clearFocusValueOnUpdate, inputIsHiddenAfterUpdate = state.inputIsHiddenAfterUpdate, ariaSelection = state.ariaSelection, isFocused = state.isFocused, prevWasFocused = state.prevWasFocused, instancePrefix = state.instancePrefix;
2493
+ var options = props.options, value = props.value, menuIsOpen = props.menuIsOpen, inputValue = props.inputValue, isMulti = props.isMulti;
2494
+ var selectValue = cleanValue(value);
2495
+ var newMenuOptionsState = {};
2496
+ if (prevProps && (value !== prevProps.value || options !== prevProps.options || menuIsOpen !== prevProps.menuIsOpen || inputValue !== prevProps.inputValue)) {
2497
+ var focusableOptions = menuIsOpen ? buildFocusableOptions(props, selectValue) : [];
2498
+ var focusableOptionsWithIds = menuIsOpen ? buildFocusableOptionsWithIds(buildCategorizedOptions(props, selectValue), "".concat(instancePrefix, "-option")) : [];
2499
+ var focusedValue = clearFocusValueOnUpdate ? getNextFocusedValue(state, selectValue) : null;
2500
+ var focusedOption = getNextFocusedOption(state, focusableOptions);
2501
+ var focusedOptionId = getFocusedOptionId(focusableOptionsWithIds, focusedOption);
2502
+ newMenuOptionsState = {
2503
+ selectValue,
2504
+ focusedOption,
2505
+ focusedOptionId,
2506
+ focusableOptionsWithIds,
2507
+ focusedValue,
2508
+ clearFocusValueOnUpdate: false
2509
+ };
2510
+ }
2511
+ var newInputIsHiddenState = inputIsHiddenAfterUpdate != null && props !== prevProps ? {
2512
+ inputIsHidden: inputIsHiddenAfterUpdate,
2513
+ inputIsHiddenAfterUpdate: void 0
2514
+ } : {};
2515
+ var newAriaSelection = ariaSelection;
2516
+ var hasKeptFocus = isFocused && prevWasFocused;
2517
+ if (isFocused && !hasKeptFocus) {
2518
+ newAriaSelection = {
2519
+ value: valueTernary(isMulti, selectValue, selectValue[0] || null),
2520
+ options: selectValue,
2521
+ action: "initial-input-focus"
2522
+ };
2523
+ hasKeptFocus = !prevWasFocused;
2524
+ }
2525
+ if ((ariaSelection === null || ariaSelection === void 0 ? void 0 : ariaSelection.action) === "initial-input-focus") {
2526
+ newAriaSelection = null;
2527
+ }
2528
+ return _objectSpread2(_objectSpread2(_objectSpread2({}, newMenuOptionsState), newInputIsHiddenState), {}, {
2529
+ prevProps: props,
2530
+ ariaSelection: newAriaSelection,
2531
+ prevWasFocused: hasKeptFocus
2532
+ });
2533
+ }
2534
+ }]);
2535
+ return Select2;
2536
+ }(Component);
2537
+ Select.defaultProps = defaultProps;
2538
+ export {
2539
+ Select as S,
2540
+ useStateManager as u
2541
+ };