trotl-filter 1.0.5 → 1.0.6
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/index.cjs.js +202 -74
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +202 -74
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -2,6 +2,16 @@ import * as React from 'react';
|
|
|
2
2
|
import React__default, { useState, useCallback, forwardRef, useContext, useLayoutEffect, useRef, useMemo, createContext, Component, Fragment, useEffect } from 'react';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
4
|
|
|
5
|
+
function _extends$1() {
|
|
6
|
+
return _extends$1 = Object.assign ? Object.assign.bind() : function (n) {
|
|
7
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
8
|
+
var t = arguments[e];
|
|
9
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
10
|
+
}
|
|
11
|
+
return n;
|
|
12
|
+
}, _extends$1.apply(null, arguments);
|
|
13
|
+
}
|
|
14
|
+
|
|
5
15
|
function _typeof(o) {
|
|
6
16
|
"@babel/helpers - typeof";
|
|
7
17
|
|
|
@@ -202,14 +212,14 @@ function useStateManager(_ref) {
|
|
|
202
212
|
});
|
|
203
213
|
}
|
|
204
214
|
|
|
205
|
-
function _extends
|
|
206
|
-
return _extends
|
|
215
|
+
function _extends() {
|
|
216
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
207
217
|
for (var e = 1; e < arguments.length; e++) {
|
|
208
218
|
var t = arguments[e];
|
|
209
219
|
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
210
220
|
}
|
|
211
221
|
return n;
|
|
212
|
-
}, _extends
|
|
222
|
+
}, _extends.apply(null, arguments);
|
|
213
223
|
}
|
|
214
224
|
|
|
215
225
|
function _classCallCheck(a, n) {
|
|
@@ -3441,7 +3451,7 @@ var Menu = function Menu(props) {
|
|
|
3441
3451
|
var children = props.children,
|
|
3442
3452
|
innerRef = props.innerRef,
|
|
3443
3453
|
innerProps = props.innerProps;
|
|
3444
|
-
return jsx("div", _extends
|
|
3454
|
+
return jsx("div", _extends({}, getStyleProps(props, 'menu', {
|
|
3445
3455
|
menu: true
|
|
3446
3456
|
}), {
|
|
3447
3457
|
ref: innerRef
|
|
@@ -3472,7 +3482,7 @@ var MenuList = function MenuList(props) {
|
|
|
3472
3482
|
innerProps = props.innerProps,
|
|
3473
3483
|
innerRef = props.innerRef,
|
|
3474
3484
|
isMulti = props.isMulti;
|
|
3475
|
-
return jsx("div", _extends
|
|
3485
|
+
return jsx("div", _extends({}, getStyleProps(props, 'menuList', {
|
|
3476
3486
|
'menu-list': true,
|
|
3477
3487
|
'menu-list--is-multi': isMulti
|
|
3478
3488
|
}), {
|
|
@@ -3502,7 +3512,7 @@ var NoOptionsMessage = function NoOptionsMessage(_ref6) {
|
|
|
3502
3512
|
children = _ref6$children === void 0 ? 'No options' : _ref6$children,
|
|
3503
3513
|
innerProps = _ref6.innerProps,
|
|
3504
3514
|
restProps = _objectWithoutProperties(_ref6, _excluded$3);
|
|
3505
|
-
return jsx("div", _extends
|
|
3515
|
+
return jsx("div", _extends({}, getStyleProps(_objectSpread2(_objectSpread2({}, restProps), {}, {
|
|
3506
3516
|
children: children,
|
|
3507
3517
|
innerProps: innerProps
|
|
3508
3518
|
}), 'noOptionsMessage', {
|
|
@@ -3515,7 +3525,7 @@ var LoadingMessage = function LoadingMessage(_ref7) {
|
|
|
3515
3525
|
children = _ref7$children === void 0 ? 'Loading...' : _ref7$children,
|
|
3516
3526
|
innerProps = _ref7.innerProps,
|
|
3517
3527
|
restProps = _objectWithoutProperties(_ref7, _excluded2$1);
|
|
3518
|
-
return jsx("div", _extends
|
|
3528
|
+
return jsx("div", _extends({}, getStyleProps(_objectSpread2(_objectSpread2({}, restProps), {}, {
|
|
3519
3529
|
children: children,
|
|
3520
3530
|
innerProps: innerProps
|
|
3521
3531
|
}), 'loadingMessage', {
|
|
@@ -3600,7 +3610,7 @@ var MenuPortal = function MenuPortal(props) {
|
|
|
3600
3610
|
if (!appendTo && menuPosition !== 'fixed' || !computedPosition) return null;
|
|
3601
3611
|
|
|
3602
3612
|
// same wrapper element whether fixed or portalled
|
|
3603
|
-
var menuWrapper = jsx("div", _extends
|
|
3613
|
+
var menuWrapper = jsx("div", _extends({
|
|
3604
3614
|
ref: setMenuPortalElement
|
|
3605
3615
|
}, getStyleProps(_objectSpread2(_objectSpread2({}, props), {}, {
|
|
3606
3616
|
offset: computedPosition.offset,
|
|
@@ -3634,7 +3644,7 @@ var SelectContainer = function SelectContainer(props) {
|
|
|
3634
3644
|
innerProps = props.innerProps,
|
|
3635
3645
|
isDisabled = props.isDisabled,
|
|
3636
3646
|
isRtl = props.isRtl;
|
|
3637
|
-
return jsx("div", _extends
|
|
3647
|
+
return jsx("div", _extends({}, getStyleProps(props, 'container', {
|
|
3638
3648
|
'--is-disabled': isDisabled,
|
|
3639
3649
|
'--is-rtl': isRtl
|
|
3640
3650
|
}), innerProps), children);
|
|
@@ -3666,7 +3676,7 @@ var ValueContainer = function ValueContainer(props) {
|
|
|
3666
3676
|
innerProps = props.innerProps,
|
|
3667
3677
|
isMulti = props.isMulti,
|
|
3668
3678
|
hasValue = props.hasValue;
|
|
3669
|
-
return jsx("div", _extends
|
|
3679
|
+
return jsx("div", _extends({}, getStyleProps(props, 'valueContainer', {
|
|
3670
3680
|
'value-container': true,
|
|
3671
3681
|
'value-container--is-multi': isMulti,
|
|
3672
3682
|
'value-container--has-value': hasValue
|
|
@@ -3688,7 +3698,7 @@ var indicatorsContainerCSS = function indicatorsContainerCSS() {
|
|
|
3688
3698
|
var IndicatorsContainer = function IndicatorsContainer(props) {
|
|
3689
3699
|
var children = props.children,
|
|
3690
3700
|
innerProps = props.innerProps;
|
|
3691
|
-
return jsx("div", _extends
|
|
3701
|
+
return jsx("div", _extends({}, getStyleProps(props, 'indicatorsContainer', {
|
|
3692
3702
|
indicators: true
|
|
3693
3703
|
}), innerProps), children);
|
|
3694
3704
|
};
|
|
@@ -3713,7 +3723,7 @@ var _ref2$2 = process.env.NODE_ENV === "production" ? {
|
|
|
3713
3723
|
var Svg = function Svg(_ref) {
|
|
3714
3724
|
var size = _ref.size,
|
|
3715
3725
|
props = _objectWithoutProperties(_ref, _excluded$2);
|
|
3716
|
-
return jsx("svg", _extends
|
|
3726
|
+
return jsx("svg", _extends({
|
|
3717
3727
|
height: size,
|
|
3718
3728
|
width: size,
|
|
3719
3729
|
viewBox: "0 0 20 20",
|
|
@@ -3723,14 +3733,14 @@ var Svg = function Svg(_ref) {
|
|
|
3723
3733
|
}, props));
|
|
3724
3734
|
};
|
|
3725
3735
|
var CrossIcon = function CrossIcon(props) {
|
|
3726
|
-
return jsx(Svg, _extends
|
|
3736
|
+
return jsx(Svg, _extends({
|
|
3727
3737
|
size: 20
|
|
3728
3738
|
}, props), jsx("path", {
|
|
3729
3739
|
d: "M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"
|
|
3730
3740
|
}));
|
|
3731
3741
|
};
|
|
3732
3742
|
var DownChevron = function DownChevron(props) {
|
|
3733
|
-
return jsx(Svg, _extends
|
|
3743
|
+
return jsx(Svg, _extends({
|
|
3734
3744
|
size: 20
|
|
3735
3745
|
}, props), jsx("path", {
|
|
3736
3746
|
d: "M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"
|
|
@@ -3762,7 +3772,7 @@ var dropdownIndicatorCSS = baseCSS;
|
|
|
3762
3772
|
var DropdownIndicator = function DropdownIndicator(props) {
|
|
3763
3773
|
var children = props.children,
|
|
3764
3774
|
innerProps = props.innerProps;
|
|
3765
|
-
return jsx("div", _extends
|
|
3775
|
+
return jsx("div", _extends({}, getStyleProps(props, 'dropdownIndicator', {
|
|
3766
3776
|
indicator: true,
|
|
3767
3777
|
'dropdown-indicator': true
|
|
3768
3778
|
}), innerProps), children || jsx(DownChevron, null));
|
|
@@ -3771,7 +3781,7 @@ var clearIndicatorCSS = baseCSS;
|
|
|
3771
3781
|
var ClearIndicator = function ClearIndicator(props) {
|
|
3772
3782
|
var children = props.children,
|
|
3773
3783
|
innerProps = props.innerProps;
|
|
3774
|
-
return jsx("div", _extends
|
|
3784
|
+
return jsx("div", _extends({}, getStyleProps(props, 'clearIndicator', {
|
|
3775
3785
|
indicator: true,
|
|
3776
3786
|
'clear-indicator': true
|
|
3777
3787
|
}), innerProps), children || jsx(CrossIcon, null));
|
|
@@ -3798,7 +3808,7 @@ var indicatorSeparatorCSS = function indicatorSeparatorCSS(_ref4, unstyled) {
|
|
|
3798
3808
|
};
|
|
3799
3809
|
var IndicatorSeparator = function IndicatorSeparator(props) {
|
|
3800
3810
|
var innerProps = props.innerProps;
|
|
3801
|
-
return jsx("span", _extends
|
|
3811
|
+
return jsx("span", _extends({}, innerProps, getStyleProps(props, 'indicatorSeparator', {
|
|
3802
3812
|
'indicator-separator': true
|
|
3803
3813
|
})));
|
|
3804
3814
|
};
|
|
@@ -3851,7 +3861,7 @@ var LoadingIndicator = function LoadingIndicator(_ref7) {
|
|
|
3851
3861
|
_ref7$size = _ref7.size,
|
|
3852
3862
|
size = _ref7$size === void 0 ? 4 : _ref7$size,
|
|
3853
3863
|
restProps = _objectWithoutProperties(_ref7, _excluded2);
|
|
3854
|
-
return jsx("div", _extends
|
|
3864
|
+
return jsx("div", _extends({}, getStyleProps(_objectSpread2(_objectSpread2({}, restProps), {}, {
|
|
3855
3865
|
innerProps: innerProps,
|
|
3856
3866
|
isRtl: isRtl,
|
|
3857
3867
|
size: size
|
|
@@ -3907,7 +3917,7 @@ var Control = function Control(props) {
|
|
|
3907
3917
|
innerRef = props.innerRef,
|
|
3908
3918
|
innerProps = props.innerProps,
|
|
3909
3919
|
menuIsOpen = props.menuIsOpen;
|
|
3910
|
-
return jsx("div", _extends
|
|
3920
|
+
return jsx("div", _extends({
|
|
3911
3921
|
ref: innerRef
|
|
3912
3922
|
}, getStyleProps(props, 'control', {
|
|
3913
3923
|
control: true,
|
|
@@ -3939,9 +3949,9 @@ var Group = function Group(props) {
|
|
|
3939
3949
|
label = props.label,
|
|
3940
3950
|
theme = props.theme,
|
|
3941
3951
|
selectProps = props.selectProps;
|
|
3942
|
-
return jsx("div", _extends
|
|
3952
|
+
return jsx("div", _extends({}, getStyleProps(props, 'group', {
|
|
3943
3953
|
group: true
|
|
3944
|
-
}), innerProps), jsx(Heading, _extends
|
|
3954
|
+
}), innerProps), jsx(Heading, _extends({}, headingProps, {
|
|
3945
3955
|
selectProps: selectProps,
|
|
3946
3956
|
theme: theme,
|
|
3947
3957
|
getStyles: getStyles,
|
|
@@ -3971,7 +3981,7 @@ var GroupHeading = function GroupHeading(props) {
|
|
|
3971
3981
|
var _cleanCommonProps = cleanCommonProps(props);
|
|
3972
3982
|
_cleanCommonProps.data;
|
|
3973
3983
|
var innerProps = _objectWithoutProperties(_cleanCommonProps, _excluded$1);
|
|
3974
|
-
return jsx("div", _extends
|
|
3984
|
+
return jsx("div", _extends({}, getStyleProps(props, 'groupHeading', {
|
|
3975
3985
|
'group-heading': true
|
|
3976
3986
|
}), innerProps));
|
|
3977
3987
|
};
|
|
@@ -4034,11 +4044,11 @@ var Input = function Input(props) {
|
|
|
4034
4044
|
isHidden = _cleanCommonProps.isHidden,
|
|
4035
4045
|
inputClassName = _cleanCommonProps.inputClassName,
|
|
4036
4046
|
innerProps = _objectWithoutProperties(_cleanCommonProps, _excluded$5);
|
|
4037
|
-
return jsx("div", _extends
|
|
4047
|
+
return jsx("div", _extends({}, getStyleProps(props, 'input', {
|
|
4038
4048
|
'input-container': true
|
|
4039
4049
|
}), {
|
|
4040
4050
|
"data-value": value || ''
|
|
4041
|
-
}), jsx("input", _extends
|
|
4051
|
+
}), jsx("input", _extends({
|
|
4042
4052
|
className: cx({
|
|
4043
4053
|
input: true
|
|
4044
4054
|
}, inputClassName),
|
|
@@ -4111,7 +4121,7 @@ var MultiValueLabel = MultiValueGeneric;
|
|
|
4111
4121
|
function MultiValueRemove(_ref5) {
|
|
4112
4122
|
var children = _ref5.children,
|
|
4113
4123
|
innerProps = _ref5.innerProps;
|
|
4114
|
-
return jsx("div", _extends
|
|
4124
|
+
return jsx("div", _extends({
|
|
4115
4125
|
role: "button"
|
|
4116
4126
|
}, innerProps), children || jsx(CrossIcon, {
|
|
4117
4127
|
size: 14
|
|
@@ -4185,7 +4195,7 @@ var Option = function Option(props) {
|
|
|
4185
4195
|
isSelected = props.isSelected,
|
|
4186
4196
|
innerRef = props.innerRef,
|
|
4187
4197
|
innerProps = props.innerProps;
|
|
4188
|
-
return jsx("div", _extends
|
|
4198
|
+
return jsx("div", _extends({}, getStyleProps(props, 'option', {
|
|
4189
4199
|
option: true,
|
|
4190
4200
|
'option--is-disabled': isDisabled,
|
|
4191
4201
|
'option--is-focused': isFocused,
|
|
@@ -4213,7 +4223,7 @@ var placeholderCSS = function placeholderCSS(_ref, unstyled) {
|
|
|
4213
4223
|
var Placeholder = function Placeholder(props) {
|
|
4214
4224
|
var children = props.children,
|
|
4215
4225
|
innerProps = props.innerProps;
|
|
4216
|
-
return jsx("div", _extends
|
|
4226
|
+
return jsx("div", _extends({}, getStyleProps(props, 'placeholder', {
|
|
4217
4227
|
placeholder: true
|
|
4218
4228
|
}), innerProps), children);
|
|
4219
4229
|
};
|
|
@@ -4241,7 +4251,7 @@ var SingleValue = function SingleValue(props) {
|
|
|
4241
4251
|
var children = props.children,
|
|
4242
4252
|
isDisabled = props.isDisabled,
|
|
4243
4253
|
innerProps = props.innerProps;
|
|
4244
|
-
return jsx("div", _extends
|
|
4254
|
+
return jsx("div", _extends({}, getStyleProps(props, 'singleValue', {
|
|
4245
4255
|
'single-value': true,
|
|
4246
4256
|
'single-value--is-disabled': isDisabled
|
|
4247
4257
|
}), innerProps), children);
|
|
@@ -4342,7 +4352,7 @@ var _ref = process.env.NODE_ENV === "production" ? {
|
|
|
4342
4352
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__$2
|
|
4343
4353
|
};
|
|
4344
4354
|
var A11yText = function A11yText(props) {
|
|
4345
|
-
return jsx("span", _extends
|
|
4355
|
+
return jsx("span", _extends({
|
|
4346
4356
|
css: _ref
|
|
4347
4357
|
}, props));
|
|
4348
4358
|
};
|
|
@@ -4859,7 +4869,7 @@ function DummyInput(_ref) {
|
|
|
4859
4869
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
4860
4870
|
// Remove animation props not meant for HTML elements
|
|
4861
4871
|
var filteredProps = removeProps(props, 'onExited', 'in', 'enter', 'exit', 'appear');
|
|
4862
|
-
return jsx("input", _extends
|
|
4872
|
+
return jsx("input", _extends({
|
|
4863
4873
|
ref: innerRef
|
|
4864
4874
|
}, filteredProps, {
|
|
4865
4875
|
css: /*#__PURE__*/css$2({
|
|
@@ -6441,7 +6451,7 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
6441
6451
|
});
|
|
6442
6452
|
if (!isSearchable) {
|
|
6443
6453
|
// use a dummy input to maintain focus/blur functionality
|
|
6444
|
-
return /*#__PURE__*/React.createElement(DummyInput, _extends
|
|
6454
|
+
return /*#__PURE__*/React.createElement(DummyInput, _extends({
|
|
6445
6455
|
id: id,
|
|
6446
6456
|
innerRef: this.getInputRef,
|
|
6447
6457
|
onBlur: this.onInputBlur,
|
|
@@ -6454,7 +6464,7 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
6454
6464
|
value: ""
|
|
6455
6465
|
}, ariaAttributes));
|
|
6456
6466
|
}
|
|
6457
|
-
return /*#__PURE__*/React.createElement(Input, _extends
|
|
6467
|
+
return /*#__PURE__*/React.createElement(Input, _extends({}, commonProps, {
|
|
6458
6468
|
autoCapitalize: "none",
|
|
6459
6469
|
autoComplete: "off",
|
|
6460
6470
|
autoCorrect: "off",
|
|
@@ -6495,7 +6505,7 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
6495
6505
|
focusedValue = _this$state5.focusedValue,
|
|
6496
6506
|
isFocused = _this$state5.isFocused;
|
|
6497
6507
|
if (!this.hasValue() || !controlShouldRenderValue) {
|
|
6498
|
-
return inputValue ? null : /*#__PURE__*/React.createElement(Placeholder, _extends
|
|
6508
|
+
return inputValue ? null : /*#__PURE__*/React.createElement(Placeholder, _extends({}, commonProps, {
|
|
6499
6509
|
key: "placeholder",
|
|
6500
6510
|
isDisabled: isDisabled,
|
|
6501
6511
|
isFocused: isFocused,
|
|
@@ -6508,7 +6518,7 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
6508
6518
|
return selectValue.map(function (opt, index) {
|
|
6509
6519
|
var isOptionFocused = opt === focusedValue;
|
|
6510
6520
|
var key = "".concat(_this3.getOptionLabel(opt), "-").concat(_this3.getOptionValue(opt));
|
|
6511
|
-
return /*#__PURE__*/React.createElement(MultiValue, _extends
|
|
6521
|
+
return /*#__PURE__*/React.createElement(MultiValue, _extends({}, commonProps, {
|
|
6512
6522
|
components: {
|
|
6513
6523
|
Container: MultiValueContainer,
|
|
6514
6524
|
Label: MultiValueLabel,
|
|
@@ -6537,7 +6547,7 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
6537
6547
|
return null;
|
|
6538
6548
|
}
|
|
6539
6549
|
var singleValue = selectValue[0];
|
|
6540
|
-
return /*#__PURE__*/React.createElement(SingleValue, _extends
|
|
6550
|
+
return /*#__PURE__*/React.createElement(SingleValue, _extends({}, commonProps, {
|
|
6541
6551
|
data: singleValue,
|
|
6542
6552
|
isDisabled: isDisabled
|
|
6543
6553
|
}), this.formatOptionLabel(singleValue, 'value'));
|
|
@@ -6560,7 +6570,7 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
6560
6570
|
onTouchEnd: this.onClearIndicatorTouchEnd,
|
|
6561
6571
|
'aria-hidden': 'true'
|
|
6562
6572
|
};
|
|
6563
|
-
return /*#__PURE__*/React.createElement(ClearIndicator, _extends
|
|
6573
|
+
return /*#__PURE__*/React.createElement(ClearIndicator, _extends({}, commonProps, {
|
|
6564
6574
|
innerProps: innerProps,
|
|
6565
6575
|
isFocused: isFocused
|
|
6566
6576
|
}));
|
|
@@ -6579,7 +6589,7 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
6579
6589
|
var innerProps = {
|
|
6580
6590
|
'aria-hidden': 'true'
|
|
6581
6591
|
};
|
|
6582
|
-
return /*#__PURE__*/React.createElement(LoadingIndicator, _extends
|
|
6592
|
+
return /*#__PURE__*/React.createElement(LoadingIndicator, _extends({}, commonProps, {
|
|
6583
6593
|
innerProps: innerProps,
|
|
6584
6594
|
isDisabled: isDisabled,
|
|
6585
6595
|
isFocused: isFocused
|
|
@@ -6597,7 +6607,7 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
6597
6607
|
var commonProps = this.commonProps;
|
|
6598
6608
|
var isDisabled = this.props.isDisabled;
|
|
6599
6609
|
var isFocused = this.state.isFocused;
|
|
6600
|
-
return /*#__PURE__*/React.createElement(IndicatorSeparator, _extends
|
|
6610
|
+
return /*#__PURE__*/React.createElement(IndicatorSeparator, _extends({}, commonProps, {
|
|
6601
6611
|
isDisabled: isDisabled,
|
|
6602
6612
|
isFocused: isFocused
|
|
6603
6613
|
}));
|
|
@@ -6616,7 +6626,7 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
6616
6626
|
onTouchEnd: this.onDropdownIndicatorTouchEnd,
|
|
6617
6627
|
'aria-hidden': 'true'
|
|
6618
6628
|
};
|
|
6619
|
-
return /*#__PURE__*/React.createElement(DropdownIndicator, _extends
|
|
6629
|
+
return /*#__PURE__*/React.createElement(DropdownIndicator, _extends({}, commonProps, {
|
|
6620
6630
|
innerProps: innerProps,
|
|
6621
6631
|
isDisabled: isDisabled,
|
|
6622
6632
|
isFocused: isFocused
|
|
@@ -6681,7 +6691,7 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
6681
6691
|
'aria-selected': _this4.state.isAppleDevice ? undefined : isSelected // is not supported on Apple devices
|
|
6682
6692
|
};
|
|
6683
6693
|
|
|
6684
|
-
return /*#__PURE__*/React.createElement(Option, _extends
|
|
6694
|
+
return /*#__PURE__*/React.createElement(Option, _extends({}, commonProps, {
|
|
6685
6695
|
innerProps: innerProps,
|
|
6686
6696
|
data: data,
|
|
6687
6697
|
isDisabled: isDisabled,
|
|
@@ -6703,7 +6713,7 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
6703
6713
|
groupIndex = item.index;
|
|
6704
6714
|
var groupId = "".concat(_this4.getElementId('group'), "-").concat(groupIndex);
|
|
6705
6715
|
var headingId = "".concat(groupId, "-heading");
|
|
6706
|
-
return /*#__PURE__*/React.createElement(Group, _extends
|
|
6716
|
+
return /*#__PURE__*/React.createElement(Group, _extends({}, commonProps, {
|
|
6707
6717
|
key: groupId,
|
|
6708
6718
|
data: _data,
|
|
6709
6719
|
options: options,
|
|
@@ -6740,12 +6750,12 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
6740
6750
|
menuPosition: menuPosition,
|
|
6741
6751
|
menuShouldScrollIntoView: menuShouldScrollIntoView
|
|
6742
6752
|
};
|
|
6743
|
-
var menuElement = /*#__PURE__*/React.createElement(MenuPlacer, _extends
|
|
6753
|
+
var menuElement = /*#__PURE__*/React.createElement(MenuPlacer, _extends({}, commonProps, menuPlacementProps), function (_ref4) {
|
|
6744
6754
|
var ref = _ref4.ref,
|
|
6745
6755
|
_ref4$placerProps = _ref4.placerProps,
|
|
6746
6756
|
placement = _ref4$placerProps.placement,
|
|
6747
6757
|
maxHeight = _ref4$placerProps.maxHeight;
|
|
6748
|
-
return /*#__PURE__*/React.createElement(Menu, _extends
|
|
6758
|
+
return /*#__PURE__*/React.createElement(Menu, _extends({}, commonProps, menuPlacementProps, {
|
|
6749
6759
|
innerRef: ref,
|
|
6750
6760
|
innerProps: {
|
|
6751
6761
|
onMouseDown: _this4.onMenuMouseDown,
|
|
@@ -6759,7 +6769,7 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
6759
6769
|
onBottomArrive: onMenuScrollToBottom,
|
|
6760
6770
|
lockEnabled: menuShouldBlockScroll
|
|
6761
6771
|
}, function (scrollTargetRef) {
|
|
6762
|
-
return /*#__PURE__*/React.createElement(MenuList, _extends
|
|
6772
|
+
return /*#__PURE__*/React.createElement(MenuList, _extends({}, commonProps, {
|
|
6763
6773
|
innerRef: function innerRef(instance) {
|
|
6764
6774
|
_this4.getMenuListRef(instance);
|
|
6765
6775
|
scrollTargetRef(instance);
|
|
@@ -6779,7 +6789,7 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
6779
6789
|
// positioning behaviour is almost identical for portalled and fixed,
|
|
6780
6790
|
// so we use the same component. the actual portalling logic is forked
|
|
6781
6791
|
// within the component based on `menuPosition`
|
|
6782
|
-
return menuPortalTarget || menuPosition === 'fixed' ? /*#__PURE__*/React.createElement(MenuPortal, _extends
|
|
6792
|
+
return menuPortalTarget || menuPosition === 'fixed' ? /*#__PURE__*/React.createElement(MenuPortal, _extends({}, commonProps, {
|
|
6783
6793
|
appendTo: menuPortalTarget,
|
|
6784
6794
|
controlElement: this.controlRef,
|
|
6785
6795
|
menuPlacement: menuPlacement,
|
|
@@ -6849,7 +6859,7 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
6849
6859
|
isFocused = _this$state6.isFocused,
|
|
6850
6860
|
selectValue = _this$state6.selectValue;
|
|
6851
6861
|
var focusableOptions = this.getFocusableOptions();
|
|
6852
|
-
return /*#__PURE__*/React.createElement(LiveRegion$1, _extends
|
|
6862
|
+
return /*#__PURE__*/React.createElement(LiveRegion$1, _extends({}, commonProps, {
|
|
6853
6863
|
id: this.getElementId('live-region'),
|
|
6854
6864
|
ariaSelection: ariaSelection,
|
|
6855
6865
|
focusedOption: focusedOption,
|
|
@@ -6875,7 +6885,7 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
6875
6885
|
menuIsOpen = _this$props14.menuIsOpen;
|
|
6876
6886
|
var isFocused = this.state.isFocused;
|
|
6877
6887
|
var commonProps = this.commonProps = this.getCommonProps();
|
|
6878
|
-
return /*#__PURE__*/React.createElement(SelectContainer, _extends
|
|
6888
|
+
return /*#__PURE__*/React.createElement(SelectContainer, _extends({}, commonProps, {
|
|
6879
6889
|
className: className,
|
|
6880
6890
|
innerProps: {
|
|
6881
6891
|
id: id,
|
|
@@ -6883,7 +6893,7 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
6883
6893
|
},
|
|
6884
6894
|
isDisabled: isDisabled,
|
|
6885
6895
|
isFocused: isFocused
|
|
6886
|
-
}), this.renderLiveRegion(), /*#__PURE__*/React.createElement(Control, _extends
|
|
6896
|
+
}), this.renderLiveRegion(), /*#__PURE__*/React.createElement(Control, _extends({}, commonProps, {
|
|
6887
6897
|
innerRef: this.getControlRef,
|
|
6888
6898
|
innerProps: {
|
|
6889
6899
|
onMouseDown: this.onControlMouseDown,
|
|
@@ -6892,9 +6902,9 @@ var Select = /*#__PURE__*/function (_Component) {
|
|
|
6892
6902
|
isDisabled: isDisabled,
|
|
6893
6903
|
isFocused: isFocused,
|
|
6894
6904
|
menuIsOpen: menuIsOpen
|
|
6895
|
-
}), /*#__PURE__*/React.createElement(ValueContainer, _extends
|
|
6905
|
+
}), /*#__PURE__*/React.createElement(ValueContainer, _extends({}, commonProps, {
|
|
6896
6906
|
isDisabled: isDisabled
|
|
6897
|
-
}), this.renderPlaceholderOrValue(), this.renderInput()), /*#__PURE__*/React.createElement(IndicatorsContainer, _extends
|
|
6907
|
+
}), this.renderPlaceholderOrValue(), this.renderInput()), /*#__PURE__*/React.createElement(IndicatorsContainer, _extends({}, commonProps, {
|
|
6898
6908
|
isDisabled: isDisabled
|
|
6899
6909
|
}), this.renderClearIndicator(), this.renderLoadingIndicator(), this.renderIndicatorSeparator(), this.renderDropdownIndicator())), this.renderMenu(), this.renderFormField());
|
|
6900
6910
|
}
|
|
@@ -6966,7 +6976,7 @@ Select.defaultProps = defaultProps;
|
|
|
6966
6976
|
|
|
6967
6977
|
var StateManagedSelect = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
6968
6978
|
var baseSelectProps = useStateManager(props);
|
|
6969
|
-
return /*#__PURE__*/React.createElement(Select, _extends
|
|
6979
|
+
return /*#__PURE__*/React.createElement(Select, _extends({
|
|
6970
6980
|
ref: ref
|
|
6971
6981
|
}, baseSelectProps));
|
|
6972
6982
|
});
|
|
@@ -6981,7 +6991,9 @@ const MultiSelectDropdown = ({
|
|
|
6981
6991
|
placeholder = "Select...",
|
|
6982
6992
|
required = false,
|
|
6983
6993
|
closeMenuOnSelect = false,
|
|
6984
|
-
pushUrlParamObj = false
|
|
6994
|
+
pushUrlParamObj = false,
|
|
6995
|
+
// pushUrlParamObj={"ids"}
|
|
6996
|
+
addItem = undefined
|
|
6985
6997
|
}) => {
|
|
6986
6998
|
const containerRef = useRef(null);
|
|
6987
6999
|
const [maxVisible, setMaxVisible] = useState(1);
|
|
@@ -7063,6 +7075,71 @@ const MultiSelectDropdown = ({
|
|
|
7063
7075
|
}
|
|
7064
7076
|
window.history.replaceState({}, "", url);
|
|
7065
7077
|
};
|
|
7078
|
+
|
|
7079
|
+
// For custom input: track input value and show add button as inline option
|
|
7080
|
+
const [inputValue, setInputValue] = useState("");
|
|
7081
|
+
const inputExists = useMemo(() => {
|
|
7082
|
+
return options.some(opt => String(opt.label).toLowerCase() === inputValue.trim().toLowerCase());
|
|
7083
|
+
}, [inputValue, options]);
|
|
7084
|
+
|
|
7085
|
+
// Add special option for +Add if inputValue is non-empty and not in options
|
|
7086
|
+
const menuOptions = useMemo(() => {
|
|
7087
|
+
if (inputValue && !inputExists && typeof addItem === 'function') {
|
|
7088
|
+
return [...options, {
|
|
7089
|
+
label: `+ Add "${inputValue.trim()}"`,
|
|
7090
|
+
value: '__add_new__',
|
|
7091
|
+
__isAddNew: true
|
|
7092
|
+
}];
|
|
7093
|
+
}
|
|
7094
|
+
return options;
|
|
7095
|
+
}, [options, inputValue, inputExists, addItem]);
|
|
7096
|
+
const handleAddNew = () => {
|
|
7097
|
+
if (!inputValue.trim()) return;
|
|
7098
|
+
const newLabel = inputValue.trim();
|
|
7099
|
+
// Prevent duplicate by value or label (case-insensitive)
|
|
7100
|
+
const exists = options.some(opt => String(opt.value).toLowerCase() === newLabel.toLowerCase() || String(opt.label).toLowerCase() === newLabel.toLowerCase());
|
|
7101
|
+
if (exists) {
|
|
7102
|
+
setInputValue("");
|
|
7103
|
+
return;
|
|
7104
|
+
}
|
|
7105
|
+
const newOption = {
|
|
7106
|
+
label: newLabel,
|
|
7107
|
+
value: newLabel
|
|
7108
|
+
};
|
|
7109
|
+
if (typeof addItem === 'function') {
|
|
7110
|
+
addItem(newOption);
|
|
7111
|
+
// return;
|
|
7112
|
+
}
|
|
7113
|
+
if (isMulti) {
|
|
7114
|
+
onChange([...(selected || []), newOption.value]);
|
|
7115
|
+
if (pushUrlParamObj) setUrlParam([...(selected || []), newOption.value].join(","));
|
|
7116
|
+
} else {
|
|
7117
|
+
onChange([newOption.value]);
|
|
7118
|
+
if (pushUrlParamObj) setUrlParam(newOption.value);
|
|
7119
|
+
}
|
|
7120
|
+
setInputValue("");
|
|
7121
|
+
};
|
|
7122
|
+
|
|
7123
|
+
// Custom Option to handle +Add
|
|
7124
|
+
const Option = props => {
|
|
7125
|
+
if (props.data.__isAddNew) {
|
|
7126
|
+
return /*#__PURE__*/React__default.createElement("div", _extends$1({}, props.innerProps, {
|
|
7127
|
+
style: {
|
|
7128
|
+
padding: '8px 12px',
|
|
7129
|
+
cursor: 'pointer',
|
|
7130
|
+
color: '#1677ff',
|
|
7131
|
+
fontWeight: 500,
|
|
7132
|
+
background: props.isFocused ? '#e6f4ff' : '#fff'
|
|
7133
|
+
},
|
|
7134
|
+
onMouseDown: e => {
|
|
7135
|
+
e.preventDefault();
|
|
7136
|
+
handleAddNew();
|
|
7137
|
+
props.selectOption(props.data);
|
|
7138
|
+
}
|
|
7139
|
+
}), props.data.label);
|
|
7140
|
+
}
|
|
7141
|
+
return /*#__PURE__*/React__default.createElement(components.Option, props);
|
|
7142
|
+
};
|
|
7066
7143
|
const handleChange = selectedItems => {
|
|
7067
7144
|
if (isMulti) {
|
|
7068
7145
|
const values = selectedItems ? selectedItems.map(item => item.value) : [];
|
|
@@ -7189,17 +7266,29 @@ const MultiSelectDropdown = ({
|
|
|
7189
7266
|
className: showRequiredError ? "select-required-error" : ""
|
|
7190
7267
|
}, /*#__PURE__*/React__default.createElement(StateManagedSelect$1, {
|
|
7191
7268
|
isMulti: isMulti,
|
|
7192
|
-
options:
|
|
7269
|
+
options: menuOptions,
|
|
7193
7270
|
value: selectedOptions,
|
|
7194
|
-
onChange:
|
|
7271
|
+
onChange: (val, action) => {
|
|
7272
|
+
// If user selects the +Add option, handle it
|
|
7273
|
+
if (action && action.action === 'select-option' && val && val.length && val[val.length - 1]?.__isAddNew) {
|
|
7274
|
+
handleAddNew();
|
|
7275
|
+
return;
|
|
7276
|
+
}
|
|
7277
|
+
handleChange(val);
|
|
7278
|
+
},
|
|
7195
7279
|
placeholder: placeholder,
|
|
7196
7280
|
styles: selectStyle,
|
|
7197
7281
|
components: {
|
|
7198
|
-
MultiValue
|
|
7282
|
+
MultiValue,
|
|
7283
|
+
Option
|
|
7199
7284
|
},
|
|
7200
7285
|
menuPortalTarget: document.body,
|
|
7201
7286
|
closeMenuOnSelect: closeMenuOnSelect,
|
|
7202
|
-
"aria-required": required
|
|
7287
|
+
"aria-required": required,
|
|
7288
|
+
inputValue: inputValue,
|
|
7289
|
+
onInputChange: (val, action) => {
|
|
7290
|
+
if (action.action === "input-change") setInputValue(val);
|
|
7291
|
+
}
|
|
7203
7292
|
}), showRequiredError && /*#__PURE__*/React__default.createElement("div", {
|
|
7204
7293
|
className: "error-text"
|
|
7205
7294
|
}, "This field is required."));
|
|
@@ -7218,7 +7307,9 @@ const DebounceSelect = ({
|
|
|
7218
7307
|
objValue,
|
|
7219
7308
|
style,
|
|
7220
7309
|
isMulti = false,
|
|
7221
|
-
pushUrlParamObj = false
|
|
7310
|
+
pushUrlParamObj = false,
|
|
7311
|
+
addItem = undefined,
|
|
7312
|
+
fetchAll = true
|
|
7222
7313
|
}) => {
|
|
7223
7314
|
const [input, setInput] = useState("");
|
|
7224
7315
|
const [options, setOptions] = useState([]);
|
|
@@ -7287,8 +7378,9 @@ const DebounceSelect = ({
|
|
|
7287
7378
|
clearTimeout(timeoutRef.current);
|
|
7288
7379
|
timeoutRef.current = setTimeout(async () => {
|
|
7289
7380
|
try {
|
|
7290
|
-
// If input is '...', fetch all options
|
|
7291
|
-
|
|
7381
|
+
// If fetchAll is true and input is '...', fetch all options
|
|
7382
|
+
// If fetchAll is false, '...' will be treated as regular search
|
|
7383
|
+
const query = fetchAll && input === "..." ? "" : input;
|
|
7292
7384
|
const results = await fetchOptions(query);
|
|
7293
7385
|
setOptions(results);
|
|
7294
7386
|
} catch (err) {
|
|
@@ -7299,7 +7391,7 @@ const DebounceSelect = ({
|
|
|
7299
7391
|
}
|
|
7300
7392
|
}, debounceDelay);
|
|
7301
7393
|
return () => clearTimeout(timeoutRef.current);
|
|
7302
|
-
}, [input, fetchOptions, debounceDelay]);
|
|
7394
|
+
}, [input, fetchOptions, debounceDelay, fetchAll]);
|
|
7303
7395
|
const setUrlParam = value => {
|
|
7304
7396
|
const url = new URL(window.location);
|
|
7305
7397
|
if (value === null || value === undefined || value === "") {
|
|
@@ -7344,6 +7436,37 @@ const DebounceSelect = ({
|
|
|
7344
7436
|
setUrlParam(updated.length ? updated.map(item => item.value).join(",") : "");
|
|
7345
7437
|
}
|
|
7346
7438
|
};
|
|
7439
|
+
|
|
7440
|
+
// Check if input value exists in options
|
|
7441
|
+
const inputExists = input.trim() && options.some(opt => String(opt.label).toLowerCase() === input.trim().toLowerCase() || String(opt.value).toLowerCase() === input.trim().toLowerCase());
|
|
7442
|
+
const handleAddNew = () => {
|
|
7443
|
+
if (!input.trim()) return;
|
|
7444
|
+
const newOption = {
|
|
7445
|
+
label: input.trim(),
|
|
7446
|
+
value: input.trim()
|
|
7447
|
+
};
|
|
7448
|
+
if (typeof addItem === 'function') {
|
|
7449
|
+
addItem(newOption);
|
|
7450
|
+
}
|
|
7451
|
+
handleSelect(newOption.value, newOption.label);
|
|
7452
|
+
};
|
|
7453
|
+
|
|
7454
|
+
// Handle double-click to fetch all when fetchAll is false
|
|
7455
|
+
const handleDoubleClick = async () => {
|
|
7456
|
+
if (!fetchAll && !disabled) {
|
|
7457
|
+
setLoading(true);
|
|
7458
|
+
setOpen(true);
|
|
7459
|
+
try {
|
|
7460
|
+
const results = await fetchOptions("");
|
|
7461
|
+
setOptions(results);
|
|
7462
|
+
} catch (err) {
|
|
7463
|
+
console.error("Failed to fetch options", err);
|
|
7464
|
+
setOptions([]);
|
|
7465
|
+
} finally {
|
|
7466
|
+
setLoading(false);
|
|
7467
|
+
}
|
|
7468
|
+
}
|
|
7469
|
+
};
|
|
7347
7470
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
7348
7471
|
style: {
|
|
7349
7472
|
position: 'relative'
|
|
@@ -7376,6 +7499,7 @@ const DebounceSelect = ({
|
|
|
7376
7499
|
placeholder: placeholder,
|
|
7377
7500
|
onFocus: () => setOpen(true),
|
|
7378
7501
|
onBlur: () => setTimeout(() => setOpen(false), 200),
|
|
7502
|
+
onDoubleClick: handleDoubleClick,
|
|
7379
7503
|
disabled: disabled,
|
|
7380
7504
|
style: style
|
|
7381
7505
|
}), (input || !isMulti && selectedItems.length > 0) && !disabled && /*#__PURE__*/React__default.createElement("button", {
|
|
@@ -7406,28 +7530,32 @@ const DebounceSelect = ({
|
|
|
7406
7530
|
className: "basic-input-dropdown-menu"
|
|
7407
7531
|
}, loading ? /*#__PURE__*/React__default.createElement("div", {
|
|
7408
7532
|
className: "loading-dropdown-item"
|
|
7409
|
-
}, "Loading...") : options?.length > 0 ? options.map(({
|
|
7533
|
+
}, "Loading...") : options?.length > 0 ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, options.map(({
|
|
7410
7534
|
label,
|
|
7411
7535
|
value
|
|
7412
7536
|
}) => /*#__PURE__*/React__default.createElement("div", {
|
|
7413
7537
|
key: value,
|
|
7414
7538
|
className: "basic-input-dropdown-item",
|
|
7415
7539
|
onMouseDown: () => handleSelect(value, label)
|
|
7416
|
-
}, label))
|
|
7540
|
+
}, label)), input.trim() && !inputExists && typeof addItem === 'function' && /*#__PURE__*/React__default.createElement("div", {
|
|
7541
|
+
className: "basic-input-dropdown-item",
|
|
7542
|
+
style: {
|
|
7543
|
+
color: '#1677ff',
|
|
7544
|
+
fontWeight: 500
|
|
7545
|
+
},
|
|
7546
|
+
onMouseDown: handleAddNew
|
|
7547
|
+
}, "+ Add \"", input.trim(), "\"")) : input.trim() && !loading && typeof addItem === 'function' ? /*#__PURE__*/React__default.createElement("div", {
|
|
7548
|
+
className: "basic-input-dropdown-item",
|
|
7549
|
+
style: {
|
|
7550
|
+
color: '#1677ff',
|
|
7551
|
+
fontWeight: 500
|
|
7552
|
+
},
|
|
7553
|
+
onMouseDown: handleAddNew
|
|
7554
|
+
}, "+ Add \"", input.trim(), "\"") : /*#__PURE__*/React__default.createElement("div", {
|
|
7417
7555
|
className: "no-results-dropdown-item"
|
|
7418
7556
|
}, "No results")));
|
|
7419
7557
|
};
|
|
7420
7558
|
|
|
7421
|
-
function _extends() {
|
|
7422
|
-
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
7423
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
7424
|
-
var t = arguments[e];
|
|
7425
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
7426
|
-
}
|
|
7427
|
-
return n;
|
|
7428
|
-
}, _extends.apply(null, arguments);
|
|
7429
|
-
}
|
|
7430
|
-
|
|
7431
7559
|
function SearchInput({
|
|
7432
7560
|
pushUrlParamObj = null,
|
|
7433
7561
|
...props
|
|
@@ -7476,7 +7604,7 @@ function SearchInput({
|
|
|
7476
7604
|
height: "34px",
|
|
7477
7605
|
verticalAlign: "middle"
|
|
7478
7606
|
}
|
|
7479
|
-
}, /*#__PURE__*/React__default.createElement("input", _extends({
|
|
7607
|
+
}, /*#__PURE__*/React__default.createElement("input", _extends$1({
|
|
7480
7608
|
className: "basic-input",
|
|
7481
7609
|
value: value,
|
|
7482
7610
|
style: {
|
|
@@ -8995,7 +9123,7 @@ function DateTimeInput({
|
|
|
8995
9123
|
window.addEventListener('mousedown', onClick);
|
|
8996
9124
|
return () => window.removeEventListener('mousedown', onClick);
|
|
8997
9125
|
}, [open]);
|
|
8998
|
-
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
9126
|
+
return /*#__PURE__*/React__default.createElement("div", _extends$1({
|
|
8999
9127
|
className: `datetime-input-wrapper ${className}`,
|
|
9000
9128
|
style: {
|
|
9001
9129
|
position: 'relative',
|