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