@eightshift/ui-components 1.0.6 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/dist/{Button-eebLs4cp.js → Button-CbFrFO04.js} +5 -5
- package/dist/{Checkbox-BN0TEda-.js → Checkbox-Cv3pZDHg.js} +12 -16
- package/dist/{ColorSwatch-BrowHhTG.js → ColorSwatch-CNQmCQV8.js} +6 -7
- package/dist/{FieldError-ILxgMZy5.js → FieldError-J1-YPbi6.js} +2 -2
- package/dist/{FocusScope-B9b0VMib.js → FocusScope-Bw-IatMO.js} +79 -153
- package/dist/{GridList-CzpWxJsS.js → GridList-CEzzyr-l.js} +62 -90
- package/dist/{Group-Dkdm2-E7.js → Group-D3Qa6PrV.js} +3 -3
- package/dist/{Input-BJA4rmIo.js → Input-CX_rocyZ.js} +8 -8
- package/dist/{Label-9x5iLJ-Y.js → Label-Bg5O81Wb.js} +1 -1
- package/dist/{ListBox-D3Vr4vvC.js → ListBox-CCWXTj0t.js} +391 -598
- package/dist/{LiveAnnouncer-IsokfWQ5.js → LiveAnnouncer-D8h-3GrG.js} +12 -22
- package/dist/{NumberFormatter-LzoKy975.js → NumberFormatter-U_Gx0UDq.js} +26 -44
- package/dist/{Select-49a62830.esm-CKPmlkza.js → Select-49a62830.esm-BnlXlUnT.js} +92 -166
- package/dist/{SelectionManager-sedvcM-1.js → SelectionManager-XOAt-Ekx.js} +219 -401
- package/dist/{Separator-B6rnDabE.js → Separator-DZeg0KOr.js} +41 -72
- package/dist/{Slider-C5U5N7uM.js → Slider-fULMI0gI.js} +51 -82
- package/dist/{Text-Cyxp9ewv.js → Text-WqetJduR.js} +1 -1
- package/dist/{VisuallyHidden-BPJVSUyp.js → VisuallyHidden-Di1zXprL.js} +8 -11
- package/dist/{ariaHideOutside-ByKBPHmX.js → ariaHideOutside-Zn64-frS.js} +20 -36
- package/dist/assets/style.css +1 -1
- package/dist/assets/wp-font-enhancements.css +1 -1
- package/dist/assets/wp-ui-enhancements.css +1 -1
- package/dist/{button-idVI4jmd.js → button-CD8Q1eok.js} +17 -29
- package/dist/components/animated-visibility/animated-visibility.js +125 -113
- package/dist/components/base-control/base-control.js +3 -9
- package/dist/components/breakpoint-preview/breakpoint-preview.js +51 -108
- package/dist/components/button/button.js +6 -6
- package/dist/components/checkbox/checkbox.js +2 -2
- package/dist/components/color-pickers/color-picker.js +2 -2
- package/dist/components/color-pickers/color-swatch.js +5 -9
- package/dist/components/color-pickers/gradient-editor.js +15 -29
- package/dist/components/color-pickers/solid-color-picker.js +81 -128
- package/dist/components/component-toggle/component-toggle.js +4 -4
- package/dist/components/container-panel/container-panel.js +4 -11
- package/dist/components/draggable-list/draggable-list-item.js +4 -4
- package/dist/components/draggable-list/draggable-list.js +5 -5
- package/dist/components/expandable/expandable.js +45 -57
- package/dist/components/index.js +3 -3
- package/dist/components/input-field/input-field.js +11 -26
- package/dist/components/layout/hstack.js +2 -12
- package/dist/components/layout/vstack.js +2 -12
- package/dist/components/link-input/link-input.js +36 -53
- package/dist/components/list-box/list-box.js +4 -4
- package/dist/components/matrix-align/matrix-align.js +6 -10
- package/dist/components/menu/menu.js +101 -170
- package/dist/components/notice/notice.js +1 -1
- package/dist/components/number-picker/number-picker.js +15 -15
- package/dist/components/option-select/option-select.js +48 -64
- package/dist/components/options-panel/options-panel.js +3 -3
- package/dist/components/placeholders/file-placeholder.js +2 -2
- package/dist/components/placeholders/image-placeholder.js +1 -1
- package/dist/components/placeholders/media-placeholder.js +1 -1
- package/dist/components/popover/popover.js +4 -4
- package/dist/components/radio/radio.js +25 -38
- package/dist/components/repeater/repeater-item.js +6 -17
- package/dist/components/repeater/repeater.js +6 -7
- package/dist/components/responsive/responsive-legacy.js +6 -12
- package/dist/components/responsive/responsive.js +21 -48
- package/dist/components/responsive-preview/responsive-preview.js +1 -1
- package/dist/components/rich-label/rich-label.js +2 -8
- package/dist/components/select/async-multi-select.js +3 -3
- package/dist/components/select/async-single-select.js +2 -2
- package/dist/components/select/custom-select-default-components.js +2 -2
- package/dist/components/select/multi-select-components.js +2 -2
- package/dist/components/select/multi-select.js +3 -3
- package/dist/components/select/react-select-component-wrappers.js +9 -9
- package/dist/components/select/single-select.js +2 -2
- package/dist/components/select/styles.js +3 -10
- package/dist/components/slider/column-config-slider.js +4 -4
- package/dist/components/slider/slider.js +5 -8
- package/dist/components/slider/utils.js +2 -6
- package/dist/components/spacer/spacer.js +2 -7
- package/dist/components/tabs/tabs.js +29 -50
- package/dist/components/toggle/switch.js +8 -8
- package/dist/components/toggle/toggle.js +1 -1
- package/dist/components/toggle-button/toggle-button.js +8 -22
- package/dist/components/tooltip/tooltip.js +4 -4
- package/dist/{context-BAcFg5GO.js → context-4oSz1ItD.js} +10 -16
- package/dist/{default-i18n-Bk1GxDHz.js → default-i18n-BqwLkgZv.js} +21 -22
- package/dist/{filterDOMProps-DG2RfOUr.js → filterDOMProps-EDDcM64A.js} +1 -3
- package/dist/{focusSafely-B0hyd-S4.js → focusSafely-BS4dllCW.js} +85 -143
- package/dist/icons/generic-color-swatch.js +105 -13
- package/dist/icons/icons.js +31010 -3447
- package/dist/icons/jsx-svg.js +591 -953
- package/dist/{index-BDk0TPWz.js → index-CAPcSs9K.js} +1504 -2087
- package/dist/{index-a301f526.esm-BzTuHLdr.js → index-a301f526.esm-ByOfDxiG.js} +111 -183
- package/dist/index.js +3 -3
- package/dist/{intlStrings-Ctkp0HDc.js → intlStrings-Dxaeitoh.js} +35 -60
- package/dist/{isScrollable-PcyglExV.js → isScrollable-Dh9D9IOd.js} +1 -2
- package/dist/lite-DVmmD_-j.js +7 -0
- package/dist/{multi-select-components-nORKdJ-2.js → multi-select-components-7vKCF8dG.js} +3 -3
- package/dist/{number-rWqELA8W.js → number-CHmNj-oR.js} +3 -6
- package/dist/{popover-o2Q28Ljn.js → popover-Dk2o4S7K.js} +70 -112
- package/dist/{react-select-async.esm-CLj9uZTq.js → react-select-async.esm-5zW9Dv9E.js} +7 -11
- package/dist/{react-select.esm-3tyTZmrx.js → react-select.esm-Bi6uzjbT.js} +3 -3
- package/dist/{textSelection-BRZdHY-4.js → textSelection-exP_9srp.js} +5 -9
- package/dist/{tooltip-T6H9uF-Z.js → tooltip-BRQ4tvZL.js} +64 -111
- package/dist/{useButton-D-xACzEY.js → useButton-DbjDV_33.js} +19 -22
- package/dist/{useEvent-XlYPKgwX.js → useEvent-zvxfEnmK.js} +2 -3
- package/dist/{useFocusRing-CRx_hYC4.js → useFocusRing-SPRI0-SN.js} +1 -1
- package/dist/{useFocusable-CHfpEdlE.js → useFocusable-CLmhO94g.js} +5 -8
- package/dist/{useFormReset-aHn6-wRk.js → useFormReset-BVWgcyGO.js} +2 -3
- package/dist/{useFormValidationState-CdYmOaXI.js → useFormValidationState-CthG9Fbc.js} +20 -38
- package/dist/{useHasTabbableChild-domoFB7A.js → useHasTabbableChild--gkWUICh.js} +2 -2
- package/dist/{useLabel-DVhXVhtH.js → useLabel-g836T8kL.js} +3 -4
- package/dist/{useLabels-C7E5SkOi.js → useLabels-CfOtyOe2.js} +3 -5
- package/dist/{useListData-BelKu4kx.js → useListData-BpYQj7kK.js} +18 -32
- package/dist/{useListState-BRsq7O1C.js → useListState-DnWZa__1.js} +6 -12
- package/dist/{useLocalizedStringFormatter-WsEL47qR.js → useLocalizedStringFormatter-BQCMno9k.js} +12 -21
- package/dist/{useNumberFieldState-ZH2Qyyxh.js → useNumberFieldState-BegO5X6F.js} +75 -132
- package/dist/{useNumberFormatter-mhdYLxWQ.js → useNumberFormatter-DhOGEsEK.js} +2 -2
- package/dist/{usePress-B42RawCH.js → usePress-CScNeV3V.js} +92 -175
- package/dist/{useToggle-CExfZM8x.js → useToggle-6LnpaJ7-.js} +6 -7
- package/dist/{useToggleState-DghG5ImG.js → useToggleState-Cymkpac8.js} +3 -5
- package/dist/utilities/array-helpers.js +1 -1
- package/dist/utilities/index.js +1 -1
- package/dist/utilities/text-helpers.js +20 -20
- package/dist/{utils-DIBzm1e4.js → utils-Dc35LwuT.js} +49 -90
- package/package.json +96 -90
- package/dist/lite-pbIeT7tm.js +0 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as _objectWithoutProperties, b as _slicedToArray, d as _objectSpread2, t as toPropertyKey, f as _typeof, g as _arrayLikeToArray, i as _unsupportedIterableToArray, j as isTouchCapable, k as isMobileDevice, m as multiValueAsValue, s as singleValueAsValue, v as valueTernary, l as classNames, n as defaultComponents, o as isDocumentElement, p as cleanValue, q as scrollIntoView, _ as _extends, r as noop, M as MenuPlacer, u as removeProps, w as jsx, x as css, y as clearIndicatorCSS, z as containerCSS, A as css$1, B as dropdownIndicatorCSS, C as groupCSS, D as groupHeadingCSS, E as indicatorsContainerCSS, F as indicatorSeparatorCSS, G as inputCSS, H as loadingIndicatorCSS, I as loadingMessageCSS, J as menuCSS, K as menuListCSS, L as menuPortalCSS, N as multiValueCSS, O as multiValueLabelCSS, P as multiValueRemoveCSS, Q as noOptionsMessageCSS, R as optionCSS, S as placeholderCSS, T as css$2, U as valueContainerCSS, V as notNullish, W as supportsPassiveEvents } from "./index-a301f526.esm-
|
|
1
|
+
import { a as _objectWithoutProperties, b as _slicedToArray, d as _objectSpread2, t as toPropertyKey, f as _typeof, g as _arrayLikeToArray, i as _unsupportedIterableToArray, j as isTouchCapable, k as isMobileDevice, m as multiValueAsValue, s as singleValueAsValue, v as valueTernary, l as classNames, n as defaultComponents, o as isDocumentElement, p as cleanValue, q as scrollIntoView, _ as _extends, r as noop, M as MenuPlacer, u as removeProps, w as jsx, x as css, y as clearIndicatorCSS, z as containerCSS, A as css$1, B as dropdownIndicatorCSS, C as groupCSS, D as groupHeadingCSS, E as indicatorsContainerCSS, F as indicatorSeparatorCSS, G as inputCSS, H as loadingIndicatorCSS, I as loadingMessageCSS, J as menuCSS, K as menuListCSS, L as menuPortalCSS, N as multiValueCSS, O as multiValueLabelCSS, P as multiValueRemoveCSS, Q as noOptionsMessageCSS, R as optionCSS, S as placeholderCSS, T as css$2, U as valueContainerCSS, V as notNullish, W as supportsPassiveEvents } from "./index-a301f526.esm-ByOfDxiG.js";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { useState, useCallback, Component, Fragment, useMemo, useRef, useEffect } from "react";
|
|
4
4
|
var _excluded$1 = ["defaultInputValue", "defaultMenuIsOpen", "defaultValue", "inputValue", "menuIsOpen", "onChange", "onInputChange", "onMenuClose", "onMenuOpen", "value"];
|
|
@@ -45,60 +45,41 @@ function useStateManager(_ref3) {
|
|
|
45
45
|
value
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
function _classCallCheck(
|
|
49
|
-
if (!(
|
|
50
|
-
throw new TypeError("Cannot call a class as a function");
|
|
51
|
-
}
|
|
48
|
+
function _classCallCheck(a, n) {
|
|
49
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
52
50
|
}
|
|
53
|
-
function _defineProperties(
|
|
54
|
-
for (var
|
|
55
|
-
var
|
|
56
|
-
|
|
57
|
-
descriptor.configurable = true;
|
|
58
|
-
if ("value" in descriptor)
|
|
59
|
-
descriptor.writable = true;
|
|
60
|
-
Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);
|
|
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);
|
|
61
55
|
}
|
|
62
56
|
}
|
|
63
|
-
function _createClass(
|
|
64
|
-
|
|
65
|
-
_defineProperties(Constructor.prototype, protoProps);
|
|
66
|
-
if (staticProps)
|
|
67
|
-
_defineProperties(Constructor, staticProps);
|
|
68
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
57
|
+
function _createClass(e, r, t) {
|
|
58
|
+
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
|
69
59
|
writable: false
|
|
70
|
-
});
|
|
71
|
-
return Constructor;
|
|
60
|
+
}), e;
|
|
72
61
|
}
|
|
73
|
-
function _setPrototypeOf(
|
|
74
|
-
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
};
|
|
78
|
-
return _setPrototypeOf(o, p);
|
|
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);
|
|
79
66
|
}
|
|
80
|
-
function _inherits(
|
|
81
|
-
if (typeof
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
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, {
|
|
85
70
|
constructor: {
|
|
86
|
-
value:
|
|
71
|
+
value: t,
|
|
87
72
|
writable: true,
|
|
88
73
|
configurable: true
|
|
89
74
|
}
|
|
90
|
-
})
|
|
91
|
-
Object.defineProperty(subClass, "prototype", {
|
|
75
|
+
}), Object.defineProperty(t, "prototype", {
|
|
92
76
|
writable: false
|
|
93
|
-
});
|
|
94
|
-
if (superClass)
|
|
95
|
-
_setPrototypeOf(subClass, superClass);
|
|
77
|
+
}), e && _setPrototypeOf(t, e);
|
|
96
78
|
}
|
|
97
|
-
function _getPrototypeOf(
|
|
98
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function
|
|
99
|
-
return
|
|
100
|
-
};
|
|
101
|
-
return _getPrototypeOf(o);
|
|
79
|
+
function _getPrototypeOf(t) {
|
|
80
|
+
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t2) {
|
|
81
|
+
return t2.__proto__ || Object.getPrototypeOf(t2);
|
|
82
|
+
}, _getPrototypeOf(t);
|
|
102
83
|
}
|
|
103
84
|
function _isNativeReflectConstruct() {
|
|
104
85
|
try {
|
|
@@ -110,46 +91,37 @@ function _isNativeReflectConstruct() {
|
|
|
110
91
|
return !!t;
|
|
111
92
|
})();
|
|
112
93
|
}
|
|
113
|
-
function _assertThisInitialized(
|
|
114
|
-
if (
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
return self;
|
|
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;
|
|
118
97
|
}
|
|
119
|
-
function _possibleConstructorReturn(
|
|
120
|
-
if (
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
throw new TypeError("Derived constructors may only return object or undefined");
|
|
124
|
-
}
|
|
125
|
-
return _assertThisInitialized(self);
|
|
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);
|
|
126
102
|
}
|
|
127
|
-
function _createSuper(
|
|
128
|
-
var
|
|
129
|
-
return function
|
|
130
|
-
var
|
|
131
|
-
if (
|
|
132
|
-
var
|
|
133
|
-
|
|
134
|
-
} else
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
return _possibleConstructorReturn(this, result);
|
|
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);
|
|
138
112
|
};
|
|
139
113
|
}
|
|
140
|
-
function _arrayWithoutHoles(
|
|
141
|
-
if (Array.isArray(
|
|
142
|
-
return _arrayLikeToArray(arr);
|
|
114
|
+
function _arrayWithoutHoles(r) {
|
|
115
|
+
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
143
116
|
}
|
|
144
|
-
function _iterableToArray(
|
|
145
|
-
if (typeof Symbol
|
|
146
|
-
return Array.from(iter);
|
|
117
|
+
function _iterableToArray(r) {
|
|
118
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
147
119
|
}
|
|
148
120
|
function _nonIterableSpread() {
|
|
149
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.");
|
|
150
122
|
}
|
|
151
|
-
function _toConsumableArray(
|
|
152
|
-
return _arrayWithoutHoles(
|
|
123
|
+
function _toConsumableArray(r) {
|
|
124
|
+
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
153
125
|
}
|
|
154
126
|
var safeIsNaN = Number.isNaN || function ponyfill(value) {
|
|
155
127
|
return typeof value === "number" && value !== value;
|
|
@@ -644,8 +616,7 @@ var defaultStringify = function defaultStringify2(option) {
|
|
|
644
616
|
};
|
|
645
617
|
var createFilter = function createFilter2(config) {
|
|
646
618
|
return function(option, rawInput) {
|
|
647
|
-
if (option.data.__isNew__)
|
|
648
|
-
return true;
|
|
619
|
+
if (option.data.__isNew__) return true;
|
|
649
620
|
var _ignoreCase$ignoreAcc = _objectSpread2({
|
|
650
621
|
ignoreCase: true,
|
|
651
622
|
ignoreAccents: true,
|
|
@@ -697,8 +668,7 @@ function DummyInput(_ref3) {
|
|
|
697
668
|
}));
|
|
698
669
|
}
|
|
699
670
|
var cancelScroll = function cancelScroll2(event) {
|
|
700
|
-
if (event.cancelable)
|
|
701
|
-
event.preventDefault();
|
|
671
|
+
if (event.cancelable) event.preventDefault();
|
|
702
672
|
event.stopPropagation();
|
|
703
673
|
};
|
|
704
674
|
function useScrollCapture(_ref3) {
|
|
@@ -708,21 +678,18 @@ function useScrollCapture(_ref3) {
|
|
|
708
678
|
var touchStart = useRef(0);
|
|
709
679
|
var scrollTarget = useRef(null);
|
|
710
680
|
var handleEventDelta = useCallback(function(event, delta) {
|
|
711
|
-
if (scrollTarget.current === null)
|
|
712
|
-
return;
|
|
681
|
+
if (scrollTarget.current === null) return;
|
|
713
682
|
var _scrollTarget$current = scrollTarget.current, scrollTop = _scrollTarget$current.scrollTop, scrollHeight = _scrollTarget$current.scrollHeight, clientHeight = _scrollTarget$current.clientHeight;
|
|
714
683
|
var target = scrollTarget.current;
|
|
715
684
|
var isDeltaPositive = delta > 0;
|
|
716
685
|
var availableScroll = scrollHeight - clientHeight - scrollTop;
|
|
717
686
|
var shouldCancelScroll = false;
|
|
718
687
|
if (availableScroll > delta && isBottom.current) {
|
|
719
|
-
if (onBottomLeave)
|
|
720
|
-
onBottomLeave(event);
|
|
688
|
+
if (onBottomLeave) onBottomLeave(event);
|
|
721
689
|
isBottom.current = false;
|
|
722
690
|
}
|
|
723
691
|
if (isDeltaPositive && isTop.current) {
|
|
724
|
-
if (onTopLeave)
|
|
725
|
-
onTopLeave(event);
|
|
692
|
+
if (onTopLeave) onTopLeave(event);
|
|
726
693
|
isTop.current = false;
|
|
727
694
|
}
|
|
728
695
|
if (isDeltaPositive && delta > availableScroll) {
|
|
@@ -755,8 +722,7 @@ function useScrollCapture(_ref3) {
|
|
|
755
722
|
handleEventDelta(event, deltaY);
|
|
756
723
|
}, [handleEventDelta]);
|
|
757
724
|
var startListening = useCallback(function(el) {
|
|
758
|
-
if (!el)
|
|
759
|
-
return;
|
|
725
|
+
if (!el) return;
|
|
760
726
|
var notPassive = supportsPassiveEvents ? {
|
|
761
727
|
passive: false
|
|
762
728
|
} : false;
|
|
@@ -765,15 +731,13 @@ function useScrollCapture(_ref3) {
|
|
|
765
731
|
el.addEventListener("touchmove", onTouchMove, notPassive);
|
|
766
732
|
}, [onTouchMove, onTouchStart, onWheel]);
|
|
767
733
|
var stopListening = useCallback(function(el) {
|
|
768
|
-
if (!el)
|
|
769
|
-
return;
|
|
734
|
+
if (!el) return;
|
|
770
735
|
el.removeEventListener("wheel", onWheel, false);
|
|
771
736
|
el.removeEventListener("touchstart", onTouchStart, false);
|
|
772
737
|
el.removeEventListener("touchmove", onTouchMove, false);
|
|
773
738
|
}, [onTouchMove, onTouchStart, onWheel]);
|
|
774
739
|
useEffect(function() {
|
|
775
|
-
if (!isEnabled)
|
|
776
|
-
return;
|
|
740
|
+
if (!isEnabled) return;
|
|
777
741
|
var element = scrollTarget.current;
|
|
778
742
|
startListening(element);
|
|
779
743
|
return function() {
|
|
@@ -822,8 +786,7 @@ function useScrollLock(_ref3) {
|
|
|
822
786
|
var originalStyles = useRef({});
|
|
823
787
|
var scrollTarget = useRef(null);
|
|
824
788
|
var addScrollLock = useCallback(function(touchScrollTarget) {
|
|
825
|
-
if (!canUseDOM)
|
|
826
|
-
return;
|
|
789
|
+
if (!canUseDOM) return;
|
|
827
790
|
var target = document.body;
|
|
828
791
|
var targetStyle = target && target.style;
|
|
829
792
|
if (accountForScrollbars) {
|
|
@@ -856,8 +819,7 @@ function useScrollLock(_ref3) {
|
|
|
856
819
|
activeScrollLocks += 1;
|
|
857
820
|
}, [accountForScrollbars]);
|
|
858
821
|
var removeScrollLock = useCallback(function(touchScrollTarget) {
|
|
859
|
-
if (!canUseDOM)
|
|
860
|
-
return;
|
|
822
|
+
if (!canUseDOM) return;
|
|
861
823
|
var target = document.body;
|
|
862
824
|
var targetStyle = target && target.style;
|
|
863
825
|
activeScrollLocks = Math.max(activeScrollLocks - 1, 0);
|
|
@@ -878,8 +840,7 @@ function useScrollLock(_ref3) {
|
|
|
878
840
|
}
|
|
879
841
|
}, [accountForScrollbars]);
|
|
880
842
|
useEffect(function() {
|
|
881
|
-
if (!isEnabled)
|
|
882
|
-
return;
|
|
843
|
+
if (!isEnabled) return;
|
|
883
844
|
var element = scrollTarget.current;
|
|
884
845
|
addScrollLock(element);
|
|
885
846
|
return function() {
|
|
@@ -1201,8 +1162,7 @@ function _isOptionDisabled(props, option, selectValue) {
|
|
|
1201
1162
|
return typeof props.isOptionDisabled === "function" ? props.isOptionDisabled(option, selectValue) : false;
|
|
1202
1163
|
}
|
|
1203
1164
|
function _isOptionSelected(props, option, selectValue) {
|
|
1204
|
-
if (selectValue.indexOf(option) > -1)
|
|
1205
|
-
return true;
|
|
1165
|
+
if (selectValue.indexOf(option) > -1) return true;
|
|
1206
1166
|
if (typeof props.isOptionSelected === "function") {
|
|
1207
1167
|
return props.isOptionSelected(option, selectValue);
|
|
1208
1168
|
}
|
|
@@ -1216,8 +1176,7 @@ function _filterOption(props, option, inputValue) {
|
|
|
1216
1176
|
}
|
|
1217
1177
|
var shouldHideSelectedOptions = function shouldHideSelectedOptions2(props) {
|
|
1218
1178
|
var hideSelectedOptions = props.hideSelectedOptions, isMulti = props.isMulti;
|
|
1219
|
-
if (hideSelectedOptions === void 0)
|
|
1220
|
-
return isMulti;
|
|
1179
|
+
if (hideSelectedOptions === void 0) return isMulti;
|
|
1221
1180
|
return hideSelectedOptions;
|
|
1222
1181
|
};
|
|
1223
1182
|
var instanceId = 1;
|
|
@@ -1451,8 +1410,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
1451
1410
|
if (event && event.type === "mousedown" && event.button !== 0) {
|
|
1452
1411
|
return;
|
|
1453
1412
|
}
|
|
1454
|
-
if (_this.props.isDisabled)
|
|
1455
|
-
return;
|
|
1413
|
+
if (_this.props.isDisabled) return;
|
|
1456
1414
|
var _this$props4 = _this.props, isMulti = _this$props4.isMulti, menuIsOpen = _this$props4.menuIsOpen;
|
|
1457
1415
|
_this.focusInput();
|
|
1458
1416
|
if (menuIsOpen) {
|
|
@@ -1519,8 +1477,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
1519
1477
|
_this.userIsDragging = deltaX > moveThreshold || deltaY > moveThreshold;
|
|
1520
1478
|
};
|
|
1521
1479
|
_this.onTouchEnd = function(event) {
|
|
1522
|
-
if (_this.userIsDragging)
|
|
1523
|
-
return;
|
|
1480
|
+
if (_this.userIsDragging) return;
|
|
1524
1481
|
if (_this.controlRef && !_this.controlRef.contains(event.target) && _this.menuListRef && !_this.menuListRef.contains(event.target)) {
|
|
1525
1482
|
_this.blurInput();
|
|
1526
1483
|
}
|
|
@@ -1528,18 +1485,15 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
1528
1485
|
_this.initialTouchY = 0;
|
|
1529
1486
|
};
|
|
1530
1487
|
_this.onControlTouchEnd = function(event) {
|
|
1531
|
-
if (_this.userIsDragging)
|
|
1532
|
-
return;
|
|
1488
|
+
if (_this.userIsDragging) return;
|
|
1533
1489
|
_this.onControlMouseDown(event);
|
|
1534
1490
|
};
|
|
1535
1491
|
_this.onClearIndicatorTouchEnd = function(event) {
|
|
1536
|
-
if (_this.userIsDragging)
|
|
1537
|
-
return;
|
|
1492
|
+
if (_this.userIsDragging) return;
|
|
1538
1493
|
_this.onClearIndicatorMouseDown(event);
|
|
1539
1494
|
};
|
|
1540
1495
|
_this.onDropdownIndicatorTouchEnd = function(event) {
|
|
1541
|
-
if (_this.userIsDragging)
|
|
1542
|
-
return;
|
|
1496
|
+
if (_this.userIsDragging) return;
|
|
1543
1497
|
_this.onDropdownIndicatorMouseDown(event);
|
|
1544
1498
|
};
|
|
1545
1499
|
_this.handleInputChange = function(event) {
|
|
@@ -1610,8 +1564,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
1610
1564
|
_this.onKeyDown = function(event) {
|
|
1611
1565
|
var _this$props5 = _this.props, isMulti = _this$props5.isMulti, backspaceRemovesValue = _this$props5.backspaceRemovesValue, escapeClearsValue = _this$props5.escapeClearsValue, inputValue = _this$props5.inputValue, isClearable = _this$props5.isClearable, isDisabled = _this$props5.isDisabled, menuIsOpen = _this$props5.menuIsOpen, onKeyDown = _this$props5.onKeyDown, tabSelectsValue = _this$props5.tabSelectsValue, openMenuOnFocus = _this$props5.openMenuOnFocus;
|
|
1612
1566
|
var _this$state = _this.state, focusedOption = _this$state.focusedOption, focusedValue = _this$state.focusedValue, selectValue = _this$state.selectValue;
|
|
1613
|
-
if (isDisabled)
|
|
1614
|
-
return;
|
|
1567
|
+
if (isDisabled) return;
|
|
1615
1568
|
if (typeof onKeyDown === "function") {
|
|
1616
1569
|
onKeyDown(event);
|
|
1617
1570
|
if (event.defaultPrevented) {
|
|
@@ -1621,24 +1574,20 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
1621
1574
|
_this.blockOptionHover = true;
|
|
1622
1575
|
switch (event.key) {
|
|
1623
1576
|
case "ArrowLeft":
|
|
1624
|
-
if (!isMulti || inputValue)
|
|
1625
|
-
return;
|
|
1577
|
+
if (!isMulti || inputValue) return;
|
|
1626
1578
|
_this.focusValue("previous");
|
|
1627
1579
|
break;
|
|
1628
1580
|
case "ArrowRight":
|
|
1629
|
-
if (!isMulti || inputValue)
|
|
1630
|
-
return;
|
|
1581
|
+
if (!isMulti || inputValue) return;
|
|
1631
1582
|
_this.focusValue("next");
|
|
1632
1583
|
break;
|
|
1633
1584
|
case "Delete":
|
|
1634
1585
|
case "Backspace":
|
|
1635
|
-
if (inputValue)
|
|
1636
|
-
return;
|
|
1586
|
+
if (inputValue) return;
|
|
1637
1587
|
if (focusedValue) {
|
|
1638
1588
|
_this.removeValue(focusedValue);
|
|
1639
1589
|
} else {
|
|
1640
|
-
if (!backspaceRemovesValue)
|
|
1641
|
-
return;
|
|
1590
|
+
if (!backspaceRemovesValue) return;
|
|
1642
1591
|
if (isMulti) {
|
|
1643
1592
|
_this.popValue();
|
|
1644
1593
|
} else if (isClearable) {
|
|
@@ -1647,8 +1596,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
1647
1596
|
}
|
|
1648
1597
|
break;
|
|
1649
1598
|
case "Tab":
|
|
1650
|
-
if (_this.isComposing)
|
|
1651
|
-
return;
|
|
1599
|
+
if (_this.isComposing) return;
|
|
1652
1600
|
if (event.shiftKey || !menuIsOpen || !tabSelectsValue || !focusedOption || // don't capture the event if the menu opens on focus and the focused
|
|
1653
1601
|
// option is already selected; it breaks the flow of navigation
|
|
1654
1602
|
openMenuOnFocus && _this.isOptionSelected(focusedOption, selectValue)) {
|
|
@@ -1661,10 +1609,8 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
1661
1609
|
break;
|
|
1662
1610
|
}
|
|
1663
1611
|
if (menuIsOpen) {
|
|
1664
|
-
if (!focusedOption)
|
|
1665
|
-
|
|
1666
|
-
if (_this.isComposing)
|
|
1667
|
-
return;
|
|
1612
|
+
if (!focusedOption) return;
|
|
1613
|
+
if (_this.isComposing) return;
|
|
1668
1614
|
_this.selectOption(focusedOption);
|
|
1669
1615
|
break;
|
|
1670
1616
|
}
|
|
@@ -1691,8 +1637,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
1691
1637
|
_this.openMenu("first");
|
|
1692
1638
|
break;
|
|
1693
1639
|
}
|
|
1694
|
-
if (!focusedOption)
|
|
1695
|
-
return;
|
|
1640
|
+
if (!focusedOption) return;
|
|
1696
1641
|
_this.selectOption(focusedOption);
|
|
1697
1642
|
break;
|
|
1698
1643
|
case "ArrowUp":
|
|
@@ -1710,23 +1655,19 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
1710
1655
|
}
|
|
1711
1656
|
break;
|
|
1712
1657
|
case "PageUp":
|
|
1713
|
-
if (!menuIsOpen)
|
|
1714
|
-
return;
|
|
1658
|
+
if (!menuIsOpen) return;
|
|
1715
1659
|
_this.focusOption("pageup");
|
|
1716
1660
|
break;
|
|
1717
1661
|
case "PageDown":
|
|
1718
|
-
if (!menuIsOpen)
|
|
1719
|
-
return;
|
|
1662
|
+
if (!menuIsOpen) return;
|
|
1720
1663
|
_this.focusOption("pagedown");
|
|
1721
1664
|
break;
|
|
1722
1665
|
case "Home":
|
|
1723
|
-
if (!menuIsOpen)
|
|
1724
|
-
return;
|
|
1666
|
+
if (!menuIsOpen) return;
|
|
1725
1667
|
_this.focusOption("first");
|
|
1726
1668
|
break;
|
|
1727
1669
|
case "End":
|
|
1728
|
-
if (!menuIsOpen)
|
|
1729
|
-
return;
|
|
1670
|
+
if (!menuIsOpen) return;
|
|
1730
1671
|
_this.focusOption("last");
|
|
1731
1672
|
break;
|
|
1732
1673
|
default:
|
|
@@ -1822,15 +1763,13 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
1822
1763
|
}, {
|
|
1823
1764
|
key: "focusInput",
|
|
1824
1765
|
value: function focusInput() {
|
|
1825
|
-
if (!this.inputRef)
|
|
1826
|
-
return;
|
|
1766
|
+
if (!this.inputRef) return;
|
|
1827
1767
|
this.inputRef.focus();
|
|
1828
1768
|
}
|
|
1829
1769
|
}, {
|
|
1830
1770
|
key: "blurInput",
|
|
1831
1771
|
value: function blurInput() {
|
|
1832
|
-
if (!this.inputRef)
|
|
1833
|
-
return;
|
|
1772
|
+
if (!this.inputRef) return;
|
|
1834
1773
|
this.inputRef.blur();
|
|
1835
1774
|
}
|
|
1836
1775
|
// aliased for consumers
|
|
@@ -1861,8 +1800,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
1861
1800
|
key: "focusValue",
|
|
1862
1801
|
value: function focusValue(direction) {
|
|
1863
1802
|
var _this$state3 = this.state, selectValue = _this$state3.selectValue, focusedValue = _this$state3.focusedValue;
|
|
1864
|
-
if (!this.props.isMulti)
|
|
1865
|
-
return;
|
|
1803
|
+
if (!this.props.isMulti) return;
|
|
1866
1804
|
this.setState({
|
|
1867
1805
|
focusedOption: null
|
|
1868
1806
|
});
|
|
@@ -1872,8 +1810,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
1872
1810
|
}
|
|
1873
1811
|
var lastIndex = selectValue.length - 1;
|
|
1874
1812
|
var nextFocus = -1;
|
|
1875
|
-
if (!selectValue.length)
|
|
1876
|
-
return;
|
|
1813
|
+
if (!selectValue.length) return;
|
|
1877
1814
|
switch (direction) {
|
|
1878
1815
|
case "previous":
|
|
1879
1816
|
if (focusedIndex === 0) {
|
|
@@ -1902,8 +1839,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
1902
1839
|
var pageSize = this.props.pageSize;
|
|
1903
1840
|
var focusedOption = this.state.focusedOption;
|
|
1904
1841
|
var options = this.getFocusableOptions();
|
|
1905
|
-
if (!options.length)
|
|
1906
|
-
return;
|
|
1842
|
+
if (!options.length) return;
|
|
1907
1843
|
var nextFocus = 0;
|
|
1908
1844
|
var focusedIndex = options.indexOf(focusedOption);
|
|
1909
1845
|
if (!focusedOption) {
|
|
@@ -1915,12 +1851,10 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
1915
1851
|
nextFocus = (focusedIndex + 1) % options.length;
|
|
1916
1852
|
} else if (direction === "pageup") {
|
|
1917
1853
|
nextFocus = focusedIndex - pageSize;
|
|
1918
|
-
if (nextFocus < 0)
|
|
1919
|
-
nextFocus = 0;
|
|
1854
|
+
if (nextFocus < 0) nextFocus = 0;
|
|
1920
1855
|
} else if (direction === "pagedown") {
|
|
1921
1856
|
nextFocus = focusedIndex + pageSize;
|
|
1922
|
-
if (nextFocus > options.length - 1)
|
|
1923
|
-
nextFocus = options.length - 1;
|
|
1857
|
+
if (nextFocus > options.length - 1) nextFocus = options.length - 1;
|
|
1924
1858
|
} else if (direction === "last") {
|
|
1925
1859
|
nextFocus = options.length - 1;
|
|
1926
1860
|
}
|
|
@@ -1984,8 +1918,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
1984
1918
|
key: "isClearable",
|
|
1985
1919
|
value: function isClearable() {
|
|
1986
1920
|
var _this$props7 = this.props, isClearable2 = _this$props7.isClearable, isMulti = _this$props7.isMulti;
|
|
1987
|
-
if (isClearable2 === void 0)
|
|
1988
|
-
return isMulti;
|
|
1921
|
+
if (isClearable2 === void 0) return isMulti;
|
|
1989
1922
|
return isClearable2;
|
|
1990
1923
|
}
|
|
1991
1924
|
}, {
|
|
@@ -2218,8 +2151,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
2218
2151
|
var commonProps = this.commonProps;
|
|
2219
2152
|
var _this$props11 = this.props, isDisabled = _this$props11.isDisabled, isLoading = _this$props11.isLoading;
|
|
2220
2153
|
var isFocused = this.state.isFocused;
|
|
2221
|
-
if (!LoadingIndicator || !isLoading)
|
|
2222
|
-
return null;
|
|
2154
|
+
if (!LoadingIndicator || !isLoading) return null;
|
|
2223
2155
|
var innerProps = {
|
|
2224
2156
|
"aria-hidden": "true"
|
|
2225
2157
|
};
|
|
@@ -2233,8 +2165,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
2233
2165
|
key: "renderIndicatorSeparator",
|
|
2234
2166
|
value: function renderIndicatorSeparator() {
|
|
2235
2167
|
var _this$getComponents5 = this.getComponents(), DropdownIndicator = _this$getComponents5.DropdownIndicator, IndicatorSeparator = _this$getComponents5.IndicatorSeparator;
|
|
2236
|
-
if (!DropdownIndicator || !IndicatorSeparator)
|
|
2237
|
-
return null;
|
|
2168
|
+
if (!DropdownIndicator || !IndicatorSeparator) return null;
|
|
2238
2169
|
var commonProps = this.commonProps;
|
|
2239
2170
|
var isDisabled = this.props.isDisabled;
|
|
2240
2171
|
var isFocused = this.state.isFocused;
|
|
@@ -2247,8 +2178,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
2247
2178
|
key: "renderDropdownIndicator",
|
|
2248
2179
|
value: function renderDropdownIndicator() {
|
|
2249
2180
|
var _this$getComponents6 = this.getComponents(), DropdownIndicator = _this$getComponents6.DropdownIndicator;
|
|
2250
|
-
if (!DropdownIndicator)
|
|
2251
|
-
return null;
|
|
2181
|
+
if (!DropdownIndicator) return null;
|
|
2252
2182
|
var commonProps = this.commonProps;
|
|
2253
2183
|
var isDisabled = this.props.isDisabled;
|
|
2254
2184
|
var isFocused = this.state.isFocused;
|
|
@@ -2271,8 +2201,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
2271
2201
|
var commonProps = this.commonProps;
|
|
2272
2202
|
var focusedOption = this.state.focusedOption;
|
|
2273
2203
|
var _this$props12 = this.props, captureMenuScroll = _this$props12.captureMenuScroll, inputValue = _this$props12.inputValue, isLoading = _this$props12.isLoading, loadingMessage2 = _this$props12.loadingMessage, minMenuHeight = _this$props12.minMenuHeight, maxMenuHeight = _this$props12.maxMenuHeight, menuIsOpen = _this$props12.menuIsOpen, menuPlacement = _this$props12.menuPlacement, menuPosition = _this$props12.menuPosition, menuPortalTarget = _this$props12.menuPortalTarget, menuShouldBlockScroll = _this$props12.menuShouldBlockScroll, menuShouldScrollIntoView = _this$props12.menuShouldScrollIntoView, noOptionsMessage2 = _this$props12.noOptionsMessage, onMenuScrollToTop = _this$props12.onMenuScrollToTop, onMenuScrollToBottom = _this$props12.onMenuScrollToBottom;
|
|
2274
|
-
if (!menuIsOpen)
|
|
2275
|
-
return null;
|
|
2204
|
+
if (!menuIsOpen) return null;
|
|
2276
2205
|
var render = function render2(props, id) {
|
|
2277
2206
|
var type = props.type, data = props.data, isDisabled = props.isDisabled, isSelected = props.isSelected, label = props.label, value = props.value;
|
|
2278
2207
|
var isFocused = focusedOption === data;
|
|
@@ -2334,15 +2263,13 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
2334
2263
|
var message = loadingMessage2({
|
|
2335
2264
|
inputValue
|
|
2336
2265
|
});
|
|
2337
|
-
if (message === null)
|
|
2338
|
-
return null;
|
|
2266
|
+
if (message === null) return null;
|
|
2339
2267
|
menuUI = /* @__PURE__ */ React.createElement(LoadingMessage, commonProps, message);
|
|
2340
2268
|
} else {
|
|
2341
2269
|
var _message = noOptionsMessage2({
|
|
2342
2270
|
inputValue
|
|
2343
2271
|
});
|
|
2344
|
-
if (_message === null)
|
|
2345
|
-
return null;
|
|
2272
|
+
if (_message === null) return null;
|
|
2346
2273
|
menuUI = /* @__PURE__ */ React.createElement(NoOptionsMessage, commonProps, _message);
|
|
2347
2274
|
}
|
|
2348
2275
|
var menuPlacementProps = {
|
|
@@ -2403,8 +2330,7 @@ var Select = /* @__PURE__ */ function(_Component) {
|
|
|
2403
2330
|
onFocus: this.onValueInputFocus
|
|
2404
2331
|
});
|
|
2405
2332
|
}
|
|
2406
|
-
if (!name || isDisabled)
|
|
2407
|
-
return;
|
|
2333
|
+
if (!name || isDisabled) return;
|
|
2408
2334
|
if (isMulti) {
|
|
2409
2335
|
if (delimiter) {
|
|
2410
2336
|
var value = selectValue.map(function(opt) {
|