@majoo-ui/react 1.59.6-rc.3 → 1.59.6-rc.4
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/components/form/components/InputSelect/InputSelect.d.ts +6 -1
- package/index.esm.js +246 -192
- package/index.umd.js +265 -205
- package/package.json +1 -1
|
@@ -592,7 +592,10 @@ export declare const SelectOption: import("@stitches/react/types/styled-componen
|
|
|
592
592
|
backgroundColor: string;
|
|
593
593
|
};
|
|
594
594
|
}>>;
|
|
595
|
-
export declare const SelectItem: import("@stitches/react/types/styled-component").StyledComponent<"div", {
|
|
595
|
+
export declare const SelectItem: import("@stitches/react/types/styled-component").StyledComponent<"div", {
|
|
596
|
+
hasGroup?: boolean | "true" | undefined;
|
|
597
|
+
isGroup?: boolean | "true" | undefined;
|
|
598
|
+
}, {
|
|
596
599
|
sm: "(min-width: 359px)";
|
|
597
600
|
md: "(min-width: 767px)";
|
|
598
601
|
lg: "(min-width: 1023px)";
|
|
@@ -693,6 +696,8 @@ export declare type Option = {
|
|
|
693
696
|
name: string;
|
|
694
697
|
isDisabled?: boolean;
|
|
695
698
|
render?: (selectedItem?: Option | null) => React.ReactNode;
|
|
699
|
+
group?: string;
|
|
700
|
+
isGroup?: boolean;
|
|
696
701
|
};
|
|
697
702
|
interface InputSelectProps extends Omit<DownshiftProps<Option>, 'initialSelectedItem' | 'defaultValue'> {
|
|
698
703
|
/**
|
package/index.esm.js
CHANGED
|
@@ -11043,6 +11043,181 @@ InputSearchbox.defaultProps = {
|
|
|
11043
11043
|
};
|
|
11044
11044
|
InputSearchbox.displayName = 'InputSearchbox';
|
|
11045
11045
|
|
|
11046
|
+
var tryToString$2 = tryToString$5;
|
|
11047
|
+
|
|
11048
|
+
var $TypeError$5 = TypeError;
|
|
11049
|
+
|
|
11050
|
+
var deletePropertyOrThrow$1 = function (O, P) {
|
|
11051
|
+
if (!delete O[P]) throw $TypeError$5('Cannot delete property ' + tryToString$2(P) + ' of ' + tryToString$2(O));
|
|
11052
|
+
};
|
|
11053
|
+
|
|
11054
|
+
var arraySlice$3 = arraySliceSimple;
|
|
11055
|
+
|
|
11056
|
+
var floor$2 = Math.floor;
|
|
11057
|
+
|
|
11058
|
+
var mergeSort = function (array, comparefn) {
|
|
11059
|
+
var length = array.length;
|
|
11060
|
+
var middle = floor$2(length / 2);
|
|
11061
|
+
return length < 8 ? insertionSort(array, comparefn) : merge(
|
|
11062
|
+
array,
|
|
11063
|
+
mergeSort(arraySlice$3(array, 0, middle), comparefn),
|
|
11064
|
+
mergeSort(arraySlice$3(array, middle), comparefn),
|
|
11065
|
+
comparefn
|
|
11066
|
+
);
|
|
11067
|
+
};
|
|
11068
|
+
|
|
11069
|
+
var insertionSort = function (array, comparefn) {
|
|
11070
|
+
var length = array.length;
|
|
11071
|
+
var i = 1;
|
|
11072
|
+
var element, j;
|
|
11073
|
+
|
|
11074
|
+
while (i < length) {
|
|
11075
|
+
j = i;
|
|
11076
|
+
element = array[i];
|
|
11077
|
+
while (j && comparefn(array[j - 1], element) > 0) {
|
|
11078
|
+
array[j] = array[--j];
|
|
11079
|
+
}
|
|
11080
|
+
if (j !== i++) array[j] = element;
|
|
11081
|
+
} return array;
|
|
11082
|
+
};
|
|
11083
|
+
|
|
11084
|
+
var merge = function (array, left, right, comparefn) {
|
|
11085
|
+
var llength = left.length;
|
|
11086
|
+
var rlength = right.length;
|
|
11087
|
+
var lindex = 0;
|
|
11088
|
+
var rindex = 0;
|
|
11089
|
+
|
|
11090
|
+
while (lindex < llength || rindex < rlength) {
|
|
11091
|
+
array[lindex + rindex] = (lindex < llength && rindex < rlength)
|
|
11092
|
+
? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
|
|
11093
|
+
: lindex < llength ? left[lindex++] : right[rindex++];
|
|
11094
|
+
} return array;
|
|
11095
|
+
};
|
|
11096
|
+
|
|
11097
|
+
var arraySort$1 = mergeSort;
|
|
11098
|
+
|
|
11099
|
+
var userAgent$4 = engineUserAgent;
|
|
11100
|
+
|
|
11101
|
+
var firefox = userAgent$4.match(/firefox\/(\d+)/i);
|
|
11102
|
+
|
|
11103
|
+
var engineFfVersion = !!firefox && +firefox[1];
|
|
11104
|
+
|
|
11105
|
+
var UA = engineUserAgent;
|
|
11106
|
+
|
|
11107
|
+
var engineIsIeOrEdge = /MSIE|Trident/.test(UA);
|
|
11108
|
+
|
|
11109
|
+
var userAgent$3 = engineUserAgent;
|
|
11110
|
+
|
|
11111
|
+
var webkit = userAgent$3.match(/AppleWebKit\/(\d+)\./);
|
|
11112
|
+
|
|
11113
|
+
var engineWebkitVersion = !!webkit && +webkit[1];
|
|
11114
|
+
|
|
11115
|
+
var $$c = _export;
|
|
11116
|
+
var uncurryThis$6 = functionUncurryThis;
|
|
11117
|
+
var aCallable$6 = aCallable$a;
|
|
11118
|
+
var toObject$1 = toObject$7;
|
|
11119
|
+
var lengthOfArrayLike$2 = lengthOfArrayLike$6;
|
|
11120
|
+
var deletePropertyOrThrow = deletePropertyOrThrow$1;
|
|
11121
|
+
var toString$4 = toString$j;
|
|
11122
|
+
var fails$4 = fails$t;
|
|
11123
|
+
var internalSort = arraySort$1;
|
|
11124
|
+
var arrayMethodIsStrict = arrayMethodIsStrict$2;
|
|
11125
|
+
var FF = engineFfVersion;
|
|
11126
|
+
var IE_OR_EDGE = engineIsIeOrEdge;
|
|
11127
|
+
var V8 = engineV8Version;
|
|
11128
|
+
var WEBKIT = engineWebkitVersion;
|
|
11129
|
+
|
|
11130
|
+
var test = [];
|
|
11131
|
+
var nativeSort = uncurryThis$6(test.sort);
|
|
11132
|
+
var push$3 = uncurryThis$6(test.push);
|
|
11133
|
+
|
|
11134
|
+
// IE8-
|
|
11135
|
+
var FAILS_ON_UNDEFINED = fails$4(function () {
|
|
11136
|
+
test.sort(undefined);
|
|
11137
|
+
});
|
|
11138
|
+
// V8 bug
|
|
11139
|
+
var FAILS_ON_NULL = fails$4(function () {
|
|
11140
|
+
test.sort(null);
|
|
11141
|
+
});
|
|
11142
|
+
// Old WebKit
|
|
11143
|
+
var STRICT_METHOD = arrayMethodIsStrict('sort');
|
|
11144
|
+
|
|
11145
|
+
var STABLE_SORT = !fails$4(function () {
|
|
11146
|
+
// feature detection can be too slow, so check engines versions
|
|
11147
|
+
if (V8) return V8 < 70;
|
|
11148
|
+
if (FF && FF > 3) return;
|
|
11149
|
+
if (IE_OR_EDGE) return true;
|
|
11150
|
+
if (WEBKIT) return WEBKIT < 603;
|
|
11151
|
+
|
|
11152
|
+
var result = '';
|
|
11153
|
+
var code, chr, value, index;
|
|
11154
|
+
|
|
11155
|
+
// generate an array with more 512 elements (Chakra and old V8 fails only in this case)
|
|
11156
|
+
for (code = 65; code < 76; code++) {
|
|
11157
|
+
chr = String.fromCharCode(code);
|
|
11158
|
+
|
|
11159
|
+
switch (code) {
|
|
11160
|
+
case 66: case 69: case 70: case 72: value = 3; break;
|
|
11161
|
+
case 68: case 71: value = 4; break;
|
|
11162
|
+
default: value = 2;
|
|
11163
|
+
}
|
|
11164
|
+
|
|
11165
|
+
for (index = 0; index < 47; index++) {
|
|
11166
|
+
test.push({ k: chr + index, v: value });
|
|
11167
|
+
}
|
|
11168
|
+
}
|
|
11169
|
+
|
|
11170
|
+
test.sort(function (a, b) { return b.v - a.v; });
|
|
11171
|
+
|
|
11172
|
+
for (index = 0; index < test.length; index++) {
|
|
11173
|
+
chr = test[index].k.charAt(0);
|
|
11174
|
+
if (result.charAt(result.length - 1) !== chr) result += chr;
|
|
11175
|
+
}
|
|
11176
|
+
|
|
11177
|
+
return result !== 'DGBEFHACIJK';
|
|
11178
|
+
});
|
|
11179
|
+
|
|
11180
|
+
var FORCED$1 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;
|
|
11181
|
+
|
|
11182
|
+
var getSortCompare = function (comparefn) {
|
|
11183
|
+
return function (x, y) {
|
|
11184
|
+
if (y === undefined) return -1;
|
|
11185
|
+
if (x === undefined) return 1;
|
|
11186
|
+
if (comparefn !== undefined) return +comparefn(x, y) || 0;
|
|
11187
|
+
return toString$4(x) > toString$4(y) ? 1 : -1;
|
|
11188
|
+
};
|
|
11189
|
+
};
|
|
11190
|
+
|
|
11191
|
+
// `Array.prototype.sort` method
|
|
11192
|
+
// https://tc39.es/ecma262/#sec-array.prototype.sort
|
|
11193
|
+
$$c({ target: 'Array', proto: true, forced: FORCED$1 }, {
|
|
11194
|
+
sort: function sort(comparefn) {
|
|
11195
|
+
if (comparefn !== undefined) aCallable$6(comparefn);
|
|
11196
|
+
|
|
11197
|
+
var array = toObject$1(this);
|
|
11198
|
+
|
|
11199
|
+
if (STABLE_SORT) return comparefn === undefined ? nativeSort(array) : nativeSort(array, comparefn);
|
|
11200
|
+
|
|
11201
|
+
var items = [];
|
|
11202
|
+
var arrayLength = lengthOfArrayLike$2(array);
|
|
11203
|
+
var itemsLength, index;
|
|
11204
|
+
|
|
11205
|
+
for (index = 0; index < arrayLength; index++) {
|
|
11206
|
+
if (index in array) push$3(items, array[index]);
|
|
11207
|
+
}
|
|
11208
|
+
|
|
11209
|
+
internalSort(items, getSortCompare(comparefn));
|
|
11210
|
+
|
|
11211
|
+
itemsLength = lengthOfArrayLike$2(items);
|
|
11212
|
+
index = 0;
|
|
11213
|
+
|
|
11214
|
+
while (index < itemsLength) array[index] = items[index++];
|
|
11215
|
+
while (index < arrayLength) deletePropertyOrThrow(array, index++);
|
|
11216
|
+
|
|
11217
|
+
return array;
|
|
11218
|
+
}
|
|
11219
|
+
});
|
|
11220
|
+
|
|
11046
11221
|
const _excluded$d = ["children"];
|
|
11047
11222
|
var _jsxFileName$z = "/home/alfiantryp/Projects/majoo-ui/packages/react/src/components/popover/Popover.js";
|
|
11048
11223
|
const {
|
|
@@ -11438,6 +11613,19 @@ const SelectItem = styled('div', {
|
|
|
11438
11613
|
lineHeight: '20px',
|
|
11439
11614
|
'&:not(:last-child)': {
|
|
11440
11615
|
borderBottom: '1px solid $bgBorder'
|
|
11616
|
+
},
|
|
11617
|
+
variants: {
|
|
11618
|
+
hasGroup: {
|
|
11619
|
+
true: {
|
|
11620
|
+
paddingLeft: '$spacing-06'
|
|
11621
|
+
}
|
|
11622
|
+
},
|
|
11623
|
+
isGroup: {
|
|
11624
|
+
true: {
|
|
11625
|
+
padding: '$spacing-03 0',
|
|
11626
|
+
borderBottom: 'none !important'
|
|
11627
|
+
}
|
|
11628
|
+
}
|
|
11441
11629
|
}
|
|
11442
11630
|
});
|
|
11443
11631
|
const StyledFooter = styled('div', {
|
|
@@ -11556,17 +11744,12 @@ const InputSelect = /*#__PURE__*/React.forwardRef((_a, ref) => {
|
|
|
11556
11744
|
} = useTranslation(['MajooUI/inputSelect', 'translation']);
|
|
11557
11745
|
const [options, setOptions] = useState([]);
|
|
11558
11746
|
const [item, setItem] = useState([]);
|
|
11747
|
+
const [groupedItems, setGroupedItems] = useState([]);
|
|
11559
11748
|
const [selectedValue, setSelectedValue] = useState(value);
|
|
11560
11749
|
const [query, setQuery] = useState();
|
|
11561
11750
|
const [openOptions, setOpenOptions] = useState(false);
|
|
11562
11751
|
const selectBoxRef = useRef(null);
|
|
11563
11752
|
const scrollerRef = useRef(null);
|
|
11564
|
-
useEffect(() => {
|
|
11565
|
-
var _a;
|
|
11566
|
-
(_a = scrollerRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
|
|
11567
|
-
top: 0
|
|
11568
|
-
});
|
|
11569
|
-
}, [query]);
|
|
11570
11753
|
const handleInputValue = (value, isReset = false) => {
|
|
11571
11754
|
if (onSearch && !isReset) onSearch(value);
|
|
11572
11755
|
if (fetchData) return;
|
|
@@ -11584,18 +11767,30 @@ const InputSelect = /*#__PURE__*/React.forwardRef((_a, ref) => {
|
|
|
11584
11767
|
return {
|
|
11585
11768
|
name,
|
|
11586
11769
|
value,
|
|
11770
|
+
isDisabled: option.isDisabled === undefined && disabledOptions && disabledOptions.length > 0 ? disabledOptions.includes(value) : option.isDisabled,
|
|
11587
11771
|
render: option.render,
|
|
11588
|
-
|
|
11772
|
+
group: option.group
|
|
11589
11773
|
};
|
|
11590
11774
|
}
|
|
11591
11775
|
return {
|
|
11592
11776
|
name: option,
|
|
11593
11777
|
value: option,
|
|
11778
|
+
isDisabled: disabledOptions && disabledOptions.includes(option),
|
|
11594
11779
|
render: option.render,
|
|
11595
|
-
|
|
11780
|
+
group: option.group
|
|
11596
11781
|
};
|
|
11597
11782
|
});
|
|
11598
11783
|
};
|
|
11784
|
+
const debouncedSearch = React.useRef(debounce(query => __awaiter(void 0, void 0, void 0, function* () {
|
|
11785
|
+
setQuery(query);
|
|
11786
|
+
if (onSearch) onSearch(query);
|
|
11787
|
+
}), 1000)).current;
|
|
11788
|
+
useEffect(() => {
|
|
11789
|
+
var _a;
|
|
11790
|
+
(_a = scrollerRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
|
|
11791
|
+
top: 0
|
|
11792
|
+
});
|
|
11793
|
+
}, [query]);
|
|
11599
11794
|
useEffect(() => {
|
|
11600
11795
|
setSelectedValue(value);
|
|
11601
11796
|
}, [value]);
|
|
@@ -11604,15 +11799,44 @@ const InputSelect = /*#__PURE__*/React.forwardRef((_a, ref) => {
|
|
|
11604
11799
|
setItem(generatedOption);
|
|
11605
11800
|
setOptions(generatedOption);
|
|
11606
11801
|
}, [option, disabledOptions, valueSelector, textSelector]);
|
|
11607
|
-
|
|
11608
|
-
setQuery(query);
|
|
11609
|
-
if (onSearch) onSearch(query);
|
|
11610
|
-
}), 1000)).current;
|
|
11611
|
-
React.useEffect(() => {
|
|
11802
|
+
useEffect(() => {
|
|
11612
11803
|
return () => {
|
|
11613
11804
|
debouncedSearch.cancel();
|
|
11614
11805
|
};
|
|
11615
11806
|
}, [debouncedSearch]);
|
|
11807
|
+
useEffect(() => {
|
|
11808
|
+
setGroupedItems(item.sort(function (a, b) {
|
|
11809
|
+
const nameA = (typeof a.group === 'string' ? a.group.toUpperCase() : a.group) || ''; // ignore upper and lowercase
|
|
11810
|
+
const nameB = (typeof b.group === 'string' ? b.group.toUpperCase() : b.group) || ''; // ignore upper and lowercase
|
|
11811
|
+
if (!a.group) return 1;
|
|
11812
|
+
if (!b.group) return -1;
|
|
11813
|
+
if (nameA < nameB) {
|
|
11814
|
+
return -1;
|
|
11815
|
+
}
|
|
11816
|
+
if (nameA > nameB) {
|
|
11817
|
+
return 1;
|
|
11818
|
+
}
|
|
11819
|
+
return 0;
|
|
11820
|
+
}).reduce((prev, current) => {
|
|
11821
|
+
let addedGroupItems = [];
|
|
11822
|
+
if (prev) addedGroupItems = [...prev];
|
|
11823
|
+
const group = current.group;
|
|
11824
|
+
if ((!prev || !prev.find(val => val.value === `#group#${group}#`)) && group) {
|
|
11825
|
+
addedGroupItems.push({
|
|
11826
|
+
name: group,
|
|
11827
|
+
value: `#group#${group}#`,
|
|
11828
|
+
isGroup: true,
|
|
11829
|
+
render: () => jsx(Paragraph, Object.assign({
|
|
11830
|
+
paragraph: "shortContentBold"
|
|
11831
|
+
}, {
|
|
11832
|
+
children: group
|
|
11833
|
+
}), void 0)
|
|
11834
|
+
});
|
|
11835
|
+
}
|
|
11836
|
+
addedGroupItems.push(current);
|
|
11837
|
+
return addedGroupItems;
|
|
11838
|
+
}, []));
|
|
11839
|
+
}, [item]);
|
|
11616
11840
|
return jsx(Downshift, Object.assign({}, props, {
|
|
11617
11841
|
onChange: onChange,
|
|
11618
11842
|
itemToString: item => item ? item.name : '',
|
|
@@ -11833,14 +12057,16 @@ const InputSelect = /*#__PURE__*/React.forwardRef((_a, ref) => {
|
|
|
11833
12057
|
}
|
|
11834
12058
|
}, {
|
|
11835
12059
|
children: jsx(SelectOption, {
|
|
11836
|
-
children: item.map((item, index) => {
|
|
12060
|
+
children: (groupedItems.length > 0 ? groupedItems : item).map((item, index) => {
|
|
11837
12061
|
var _a;
|
|
11838
12062
|
return /*#__PURE__*/createElement$2(SelectItem, Object.assign({}, getItemProps({
|
|
11839
12063
|
item,
|
|
11840
|
-
disabled: item.isDisabled
|
|
12064
|
+
disabled: item.isDisabled || item.isGroup
|
|
11841
12065
|
}), {
|
|
11842
12066
|
key: (_a = item.value) !== null && _a !== void 0 ? _a : index,
|
|
11843
|
-
|
|
12067
|
+
hasGroup: !!item.group,
|
|
12068
|
+
isGroup: item.isGroup,
|
|
12069
|
+
css: Object.assign({}, !item.isGroup ? item.isDisabled ? {
|
|
11844
12070
|
backgroundColor: 'unset',
|
|
11845
12071
|
cursor: 'not-allowed',
|
|
11846
12072
|
color: '$textDisable'
|
|
@@ -11848,7 +12074,10 @@ const InputSelect = /*#__PURE__*/React.forwardRef((_a, ref) => {
|
|
|
11848
12074
|
backgroundColor: highlightedIndex === index ? '$bgGray' : 'white',
|
|
11849
12075
|
fontWeight: 'normal',
|
|
11850
12076
|
color: selectedItem && selectedItem.value === item.value ? '$textGreen' : '$textPrimary'
|
|
11851
|
-
}
|
|
12077
|
+
} : {
|
|
12078
|
+
backgroundColor: 'unset',
|
|
12079
|
+
cursor: 'default'
|
|
12080
|
+
})
|
|
11852
12081
|
}), item.render ? item.render(selectedItem) : item.name);
|
|
11853
12082
|
})
|
|
11854
12083
|
}, void 0)
|
|
@@ -11881,181 +12110,6 @@ const InputSelect = /*#__PURE__*/React.forwardRef((_a, ref) => {
|
|
|
11881
12110
|
}), void 0);
|
|
11882
12111
|
});
|
|
11883
12112
|
|
|
11884
|
-
var tryToString$2 = tryToString$5;
|
|
11885
|
-
|
|
11886
|
-
var $TypeError$5 = TypeError;
|
|
11887
|
-
|
|
11888
|
-
var deletePropertyOrThrow$1 = function (O, P) {
|
|
11889
|
-
if (!delete O[P]) throw $TypeError$5('Cannot delete property ' + tryToString$2(P) + ' of ' + tryToString$2(O));
|
|
11890
|
-
};
|
|
11891
|
-
|
|
11892
|
-
var arraySlice$3 = arraySliceSimple;
|
|
11893
|
-
|
|
11894
|
-
var floor$2 = Math.floor;
|
|
11895
|
-
|
|
11896
|
-
var mergeSort = function (array, comparefn) {
|
|
11897
|
-
var length = array.length;
|
|
11898
|
-
var middle = floor$2(length / 2);
|
|
11899
|
-
return length < 8 ? insertionSort(array, comparefn) : merge(
|
|
11900
|
-
array,
|
|
11901
|
-
mergeSort(arraySlice$3(array, 0, middle), comparefn),
|
|
11902
|
-
mergeSort(arraySlice$3(array, middle), comparefn),
|
|
11903
|
-
comparefn
|
|
11904
|
-
);
|
|
11905
|
-
};
|
|
11906
|
-
|
|
11907
|
-
var insertionSort = function (array, comparefn) {
|
|
11908
|
-
var length = array.length;
|
|
11909
|
-
var i = 1;
|
|
11910
|
-
var element, j;
|
|
11911
|
-
|
|
11912
|
-
while (i < length) {
|
|
11913
|
-
j = i;
|
|
11914
|
-
element = array[i];
|
|
11915
|
-
while (j && comparefn(array[j - 1], element) > 0) {
|
|
11916
|
-
array[j] = array[--j];
|
|
11917
|
-
}
|
|
11918
|
-
if (j !== i++) array[j] = element;
|
|
11919
|
-
} return array;
|
|
11920
|
-
};
|
|
11921
|
-
|
|
11922
|
-
var merge = function (array, left, right, comparefn) {
|
|
11923
|
-
var llength = left.length;
|
|
11924
|
-
var rlength = right.length;
|
|
11925
|
-
var lindex = 0;
|
|
11926
|
-
var rindex = 0;
|
|
11927
|
-
|
|
11928
|
-
while (lindex < llength || rindex < rlength) {
|
|
11929
|
-
array[lindex + rindex] = (lindex < llength && rindex < rlength)
|
|
11930
|
-
? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
|
|
11931
|
-
: lindex < llength ? left[lindex++] : right[rindex++];
|
|
11932
|
-
} return array;
|
|
11933
|
-
};
|
|
11934
|
-
|
|
11935
|
-
var arraySort$1 = mergeSort;
|
|
11936
|
-
|
|
11937
|
-
var userAgent$4 = engineUserAgent;
|
|
11938
|
-
|
|
11939
|
-
var firefox = userAgent$4.match(/firefox\/(\d+)/i);
|
|
11940
|
-
|
|
11941
|
-
var engineFfVersion = !!firefox && +firefox[1];
|
|
11942
|
-
|
|
11943
|
-
var UA = engineUserAgent;
|
|
11944
|
-
|
|
11945
|
-
var engineIsIeOrEdge = /MSIE|Trident/.test(UA);
|
|
11946
|
-
|
|
11947
|
-
var userAgent$3 = engineUserAgent;
|
|
11948
|
-
|
|
11949
|
-
var webkit = userAgent$3.match(/AppleWebKit\/(\d+)\./);
|
|
11950
|
-
|
|
11951
|
-
var engineWebkitVersion = !!webkit && +webkit[1];
|
|
11952
|
-
|
|
11953
|
-
var $$c = _export;
|
|
11954
|
-
var uncurryThis$6 = functionUncurryThis;
|
|
11955
|
-
var aCallable$6 = aCallable$a;
|
|
11956
|
-
var toObject$1 = toObject$7;
|
|
11957
|
-
var lengthOfArrayLike$2 = lengthOfArrayLike$6;
|
|
11958
|
-
var deletePropertyOrThrow = deletePropertyOrThrow$1;
|
|
11959
|
-
var toString$4 = toString$j;
|
|
11960
|
-
var fails$4 = fails$t;
|
|
11961
|
-
var internalSort = arraySort$1;
|
|
11962
|
-
var arrayMethodIsStrict = arrayMethodIsStrict$2;
|
|
11963
|
-
var FF = engineFfVersion;
|
|
11964
|
-
var IE_OR_EDGE = engineIsIeOrEdge;
|
|
11965
|
-
var V8 = engineV8Version;
|
|
11966
|
-
var WEBKIT = engineWebkitVersion;
|
|
11967
|
-
|
|
11968
|
-
var test = [];
|
|
11969
|
-
var nativeSort = uncurryThis$6(test.sort);
|
|
11970
|
-
var push$3 = uncurryThis$6(test.push);
|
|
11971
|
-
|
|
11972
|
-
// IE8-
|
|
11973
|
-
var FAILS_ON_UNDEFINED = fails$4(function () {
|
|
11974
|
-
test.sort(undefined);
|
|
11975
|
-
});
|
|
11976
|
-
// V8 bug
|
|
11977
|
-
var FAILS_ON_NULL = fails$4(function () {
|
|
11978
|
-
test.sort(null);
|
|
11979
|
-
});
|
|
11980
|
-
// Old WebKit
|
|
11981
|
-
var STRICT_METHOD = arrayMethodIsStrict('sort');
|
|
11982
|
-
|
|
11983
|
-
var STABLE_SORT = !fails$4(function () {
|
|
11984
|
-
// feature detection can be too slow, so check engines versions
|
|
11985
|
-
if (V8) return V8 < 70;
|
|
11986
|
-
if (FF && FF > 3) return;
|
|
11987
|
-
if (IE_OR_EDGE) return true;
|
|
11988
|
-
if (WEBKIT) return WEBKIT < 603;
|
|
11989
|
-
|
|
11990
|
-
var result = '';
|
|
11991
|
-
var code, chr, value, index;
|
|
11992
|
-
|
|
11993
|
-
// generate an array with more 512 elements (Chakra and old V8 fails only in this case)
|
|
11994
|
-
for (code = 65; code < 76; code++) {
|
|
11995
|
-
chr = String.fromCharCode(code);
|
|
11996
|
-
|
|
11997
|
-
switch (code) {
|
|
11998
|
-
case 66: case 69: case 70: case 72: value = 3; break;
|
|
11999
|
-
case 68: case 71: value = 4; break;
|
|
12000
|
-
default: value = 2;
|
|
12001
|
-
}
|
|
12002
|
-
|
|
12003
|
-
for (index = 0; index < 47; index++) {
|
|
12004
|
-
test.push({ k: chr + index, v: value });
|
|
12005
|
-
}
|
|
12006
|
-
}
|
|
12007
|
-
|
|
12008
|
-
test.sort(function (a, b) { return b.v - a.v; });
|
|
12009
|
-
|
|
12010
|
-
for (index = 0; index < test.length; index++) {
|
|
12011
|
-
chr = test[index].k.charAt(0);
|
|
12012
|
-
if (result.charAt(result.length - 1) !== chr) result += chr;
|
|
12013
|
-
}
|
|
12014
|
-
|
|
12015
|
-
return result !== 'DGBEFHACIJK';
|
|
12016
|
-
});
|
|
12017
|
-
|
|
12018
|
-
var FORCED$1 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;
|
|
12019
|
-
|
|
12020
|
-
var getSortCompare = function (comparefn) {
|
|
12021
|
-
return function (x, y) {
|
|
12022
|
-
if (y === undefined) return -1;
|
|
12023
|
-
if (x === undefined) return 1;
|
|
12024
|
-
if (comparefn !== undefined) return +comparefn(x, y) || 0;
|
|
12025
|
-
return toString$4(x) > toString$4(y) ? 1 : -1;
|
|
12026
|
-
};
|
|
12027
|
-
};
|
|
12028
|
-
|
|
12029
|
-
// `Array.prototype.sort` method
|
|
12030
|
-
// https://tc39.es/ecma262/#sec-array.prototype.sort
|
|
12031
|
-
$$c({ target: 'Array', proto: true, forced: FORCED$1 }, {
|
|
12032
|
-
sort: function sort(comparefn) {
|
|
12033
|
-
if (comparefn !== undefined) aCallable$6(comparefn);
|
|
12034
|
-
|
|
12035
|
-
var array = toObject$1(this);
|
|
12036
|
-
|
|
12037
|
-
if (STABLE_SORT) return comparefn === undefined ? nativeSort(array) : nativeSort(array, comparefn);
|
|
12038
|
-
|
|
12039
|
-
var items = [];
|
|
12040
|
-
var arrayLength = lengthOfArrayLike$2(array);
|
|
12041
|
-
var itemsLength, index;
|
|
12042
|
-
|
|
12043
|
-
for (index = 0; index < arrayLength; index++) {
|
|
12044
|
-
if (index in array) push$3(items, array[index]);
|
|
12045
|
-
}
|
|
12046
|
-
|
|
12047
|
-
internalSort(items, getSortCompare(comparefn));
|
|
12048
|
-
|
|
12049
|
-
itemsLength = lengthOfArrayLike$2(items);
|
|
12050
|
-
index = 0;
|
|
12051
|
-
|
|
12052
|
-
while (index < itemsLength) array[index] = items[index++];
|
|
12053
|
-
while (index < arrayLength) deletePropertyOrThrow(array, index++);
|
|
12054
|
-
|
|
12055
|
-
return array;
|
|
12056
|
-
}
|
|
12057
|
-
});
|
|
12058
|
-
|
|
12059
12113
|
var isPrototypeOf$1 = objectIsPrototypeOf;
|
|
12060
12114
|
|
|
12061
12115
|
var $TypeError$4 = TypeError;
|
package/index.umd.js
CHANGED
|
@@ -11123,6 +11123,181 @@
|
|
|
11123
11123
|
};
|
|
11124
11124
|
InputSearchbox.displayName = 'InputSearchbox';
|
|
11125
11125
|
|
|
11126
|
+
var tryToString$2 = tryToString$5;
|
|
11127
|
+
|
|
11128
|
+
var $TypeError$5 = TypeError;
|
|
11129
|
+
|
|
11130
|
+
var deletePropertyOrThrow$1 = function (O, P) {
|
|
11131
|
+
if (!delete O[P]) throw $TypeError$5('Cannot delete property ' + tryToString$2(P) + ' of ' + tryToString$2(O));
|
|
11132
|
+
};
|
|
11133
|
+
|
|
11134
|
+
var arraySlice$3 = arraySliceSimple;
|
|
11135
|
+
|
|
11136
|
+
var floor$2 = Math.floor;
|
|
11137
|
+
|
|
11138
|
+
var mergeSort = function (array, comparefn) {
|
|
11139
|
+
var length = array.length;
|
|
11140
|
+
var middle = floor$2(length / 2);
|
|
11141
|
+
return length < 8 ? insertionSort(array, comparefn) : merge(
|
|
11142
|
+
array,
|
|
11143
|
+
mergeSort(arraySlice$3(array, 0, middle), comparefn),
|
|
11144
|
+
mergeSort(arraySlice$3(array, middle), comparefn),
|
|
11145
|
+
comparefn
|
|
11146
|
+
);
|
|
11147
|
+
};
|
|
11148
|
+
|
|
11149
|
+
var insertionSort = function (array, comparefn) {
|
|
11150
|
+
var length = array.length;
|
|
11151
|
+
var i = 1;
|
|
11152
|
+
var element, j;
|
|
11153
|
+
|
|
11154
|
+
while (i < length) {
|
|
11155
|
+
j = i;
|
|
11156
|
+
element = array[i];
|
|
11157
|
+
while (j && comparefn(array[j - 1], element) > 0) {
|
|
11158
|
+
array[j] = array[--j];
|
|
11159
|
+
}
|
|
11160
|
+
if (j !== i++) array[j] = element;
|
|
11161
|
+
} return array;
|
|
11162
|
+
};
|
|
11163
|
+
|
|
11164
|
+
var merge = function (array, left, right, comparefn) {
|
|
11165
|
+
var llength = left.length;
|
|
11166
|
+
var rlength = right.length;
|
|
11167
|
+
var lindex = 0;
|
|
11168
|
+
var rindex = 0;
|
|
11169
|
+
|
|
11170
|
+
while (lindex < llength || rindex < rlength) {
|
|
11171
|
+
array[lindex + rindex] = (lindex < llength && rindex < rlength)
|
|
11172
|
+
? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
|
|
11173
|
+
: lindex < llength ? left[lindex++] : right[rindex++];
|
|
11174
|
+
} return array;
|
|
11175
|
+
};
|
|
11176
|
+
|
|
11177
|
+
var arraySort$1 = mergeSort;
|
|
11178
|
+
|
|
11179
|
+
var userAgent$4 = engineUserAgent;
|
|
11180
|
+
|
|
11181
|
+
var firefox = userAgent$4.match(/firefox\/(\d+)/i);
|
|
11182
|
+
|
|
11183
|
+
var engineFfVersion = !!firefox && +firefox[1];
|
|
11184
|
+
|
|
11185
|
+
var UA = engineUserAgent;
|
|
11186
|
+
|
|
11187
|
+
var engineIsIeOrEdge = /MSIE|Trident/.test(UA);
|
|
11188
|
+
|
|
11189
|
+
var userAgent$3 = engineUserAgent;
|
|
11190
|
+
|
|
11191
|
+
var webkit = userAgent$3.match(/AppleWebKit\/(\d+)\./);
|
|
11192
|
+
|
|
11193
|
+
var engineWebkitVersion = !!webkit && +webkit[1];
|
|
11194
|
+
|
|
11195
|
+
var $$c = _export;
|
|
11196
|
+
var uncurryThis$6 = functionUncurryThis;
|
|
11197
|
+
var aCallable$6 = aCallable$a;
|
|
11198
|
+
var toObject$1 = toObject$7;
|
|
11199
|
+
var lengthOfArrayLike$2 = lengthOfArrayLike$6;
|
|
11200
|
+
var deletePropertyOrThrow = deletePropertyOrThrow$1;
|
|
11201
|
+
var toString$4 = toString$j;
|
|
11202
|
+
var fails$4 = fails$t;
|
|
11203
|
+
var internalSort = arraySort$1;
|
|
11204
|
+
var arrayMethodIsStrict = arrayMethodIsStrict$2;
|
|
11205
|
+
var FF = engineFfVersion;
|
|
11206
|
+
var IE_OR_EDGE = engineIsIeOrEdge;
|
|
11207
|
+
var V8 = engineV8Version;
|
|
11208
|
+
var WEBKIT = engineWebkitVersion;
|
|
11209
|
+
|
|
11210
|
+
var test = [];
|
|
11211
|
+
var nativeSort = uncurryThis$6(test.sort);
|
|
11212
|
+
var push$3 = uncurryThis$6(test.push);
|
|
11213
|
+
|
|
11214
|
+
// IE8-
|
|
11215
|
+
var FAILS_ON_UNDEFINED = fails$4(function () {
|
|
11216
|
+
test.sort(undefined);
|
|
11217
|
+
});
|
|
11218
|
+
// V8 bug
|
|
11219
|
+
var FAILS_ON_NULL = fails$4(function () {
|
|
11220
|
+
test.sort(null);
|
|
11221
|
+
});
|
|
11222
|
+
// Old WebKit
|
|
11223
|
+
var STRICT_METHOD = arrayMethodIsStrict('sort');
|
|
11224
|
+
|
|
11225
|
+
var STABLE_SORT = !fails$4(function () {
|
|
11226
|
+
// feature detection can be too slow, so check engines versions
|
|
11227
|
+
if (V8) return V8 < 70;
|
|
11228
|
+
if (FF && FF > 3) return;
|
|
11229
|
+
if (IE_OR_EDGE) return true;
|
|
11230
|
+
if (WEBKIT) return WEBKIT < 603;
|
|
11231
|
+
|
|
11232
|
+
var result = '';
|
|
11233
|
+
var code, chr, value, index;
|
|
11234
|
+
|
|
11235
|
+
// generate an array with more 512 elements (Chakra and old V8 fails only in this case)
|
|
11236
|
+
for (code = 65; code < 76; code++) {
|
|
11237
|
+
chr = String.fromCharCode(code);
|
|
11238
|
+
|
|
11239
|
+
switch (code) {
|
|
11240
|
+
case 66: case 69: case 70: case 72: value = 3; break;
|
|
11241
|
+
case 68: case 71: value = 4; break;
|
|
11242
|
+
default: value = 2;
|
|
11243
|
+
}
|
|
11244
|
+
|
|
11245
|
+
for (index = 0; index < 47; index++) {
|
|
11246
|
+
test.push({ k: chr + index, v: value });
|
|
11247
|
+
}
|
|
11248
|
+
}
|
|
11249
|
+
|
|
11250
|
+
test.sort(function (a, b) { return b.v - a.v; });
|
|
11251
|
+
|
|
11252
|
+
for (index = 0; index < test.length; index++) {
|
|
11253
|
+
chr = test[index].k.charAt(0);
|
|
11254
|
+
if (result.charAt(result.length - 1) !== chr) result += chr;
|
|
11255
|
+
}
|
|
11256
|
+
|
|
11257
|
+
return result !== 'DGBEFHACIJK';
|
|
11258
|
+
});
|
|
11259
|
+
|
|
11260
|
+
var FORCED$1 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;
|
|
11261
|
+
|
|
11262
|
+
var getSortCompare = function (comparefn) {
|
|
11263
|
+
return function (x, y) {
|
|
11264
|
+
if (y === undefined) return -1;
|
|
11265
|
+
if (x === undefined) return 1;
|
|
11266
|
+
if (comparefn !== undefined) return +comparefn(x, y) || 0;
|
|
11267
|
+
return toString$4(x) > toString$4(y) ? 1 : -1;
|
|
11268
|
+
};
|
|
11269
|
+
};
|
|
11270
|
+
|
|
11271
|
+
// `Array.prototype.sort` method
|
|
11272
|
+
// https://tc39.es/ecma262/#sec-array.prototype.sort
|
|
11273
|
+
$$c({ target: 'Array', proto: true, forced: FORCED$1 }, {
|
|
11274
|
+
sort: function sort(comparefn) {
|
|
11275
|
+
if (comparefn !== undefined) aCallable$6(comparefn);
|
|
11276
|
+
|
|
11277
|
+
var array = toObject$1(this);
|
|
11278
|
+
|
|
11279
|
+
if (STABLE_SORT) return comparefn === undefined ? nativeSort(array) : nativeSort(array, comparefn);
|
|
11280
|
+
|
|
11281
|
+
var items = [];
|
|
11282
|
+
var arrayLength = lengthOfArrayLike$2(array);
|
|
11283
|
+
var itemsLength, index;
|
|
11284
|
+
|
|
11285
|
+
for (index = 0; index < arrayLength; index++) {
|
|
11286
|
+
if (index in array) push$3(items, array[index]);
|
|
11287
|
+
}
|
|
11288
|
+
|
|
11289
|
+
internalSort(items, getSortCompare(comparefn));
|
|
11290
|
+
|
|
11291
|
+
itemsLength = lengthOfArrayLike$2(items);
|
|
11292
|
+
index = 0;
|
|
11293
|
+
|
|
11294
|
+
while (index < itemsLength) array[index] = items[index++];
|
|
11295
|
+
while (index < arrayLength) deletePropertyOrThrow(array, index++);
|
|
11296
|
+
|
|
11297
|
+
return array;
|
|
11298
|
+
}
|
|
11299
|
+
});
|
|
11300
|
+
|
|
11126
11301
|
const _excluded$d = ["children"];
|
|
11127
11302
|
var _jsxFileName$z = "/home/alfiantryp/Projects/majoo-ui/packages/react/src/components/popover/Popover.js";
|
|
11128
11303
|
const {
|
|
@@ -11516,6 +11691,19 @@
|
|
|
11516
11691
|
lineHeight: '20px',
|
|
11517
11692
|
'&:not(:last-child)': {
|
|
11518
11693
|
borderBottom: '1px solid $bgBorder'
|
|
11694
|
+
},
|
|
11695
|
+
variants: {
|
|
11696
|
+
hasGroup: {
|
|
11697
|
+
true: {
|
|
11698
|
+
paddingLeft: '$spacing-06'
|
|
11699
|
+
}
|
|
11700
|
+
},
|
|
11701
|
+
isGroup: {
|
|
11702
|
+
true: {
|
|
11703
|
+
padding: '$spacing-03 0',
|
|
11704
|
+
borderBottom: 'none !important'
|
|
11705
|
+
}
|
|
11706
|
+
}
|
|
11519
11707
|
}
|
|
11520
11708
|
});
|
|
11521
11709
|
var StyledFooter = styled('div', {
|
|
@@ -11649,23 +11837,20 @@
|
|
|
11649
11837
|
var _t = React.useState([]),
|
|
11650
11838
|
item = _t[0],
|
|
11651
11839
|
setItem = _t[1];
|
|
11652
|
-
var _u = React.useState(
|
|
11653
|
-
|
|
11654
|
-
|
|
11655
|
-
var _v = React.useState(),
|
|
11656
|
-
|
|
11657
|
-
|
|
11658
|
-
var _w = React.useState(
|
|
11659
|
-
|
|
11660
|
-
|
|
11840
|
+
var _u = React.useState([]),
|
|
11841
|
+
groupedItems = _u[0],
|
|
11842
|
+
setGroupedItems = _u[1];
|
|
11843
|
+
var _v = React.useState(value),
|
|
11844
|
+
selectedValue = _v[0],
|
|
11845
|
+
setSelectedValue = _v[1];
|
|
11846
|
+
var _w = React.useState(),
|
|
11847
|
+
query = _w[0],
|
|
11848
|
+
setQuery = _w[1];
|
|
11849
|
+
var _x = React.useState(false),
|
|
11850
|
+
openOptions = _x[0],
|
|
11851
|
+
setOpenOptions = _x[1];
|
|
11661
11852
|
var selectBoxRef = React.useRef(null);
|
|
11662
11853
|
var scrollerRef = React.useRef(null);
|
|
11663
|
-
React.useEffect(function () {
|
|
11664
|
-
var _a;
|
|
11665
|
-
(_a = scrollerRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
|
|
11666
|
-
top: 0
|
|
11667
|
-
});
|
|
11668
|
-
}, [query]);
|
|
11669
11854
|
var handleInputValue = function handleInputValue(value, isReset) {
|
|
11670
11855
|
if (isReset === void 0) {
|
|
11671
11856
|
isReset = false;
|
|
@@ -11694,26 +11879,20 @@
|
|
|
11694
11879
|
return {
|
|
11695
11880
|
name: name_1,
|
|
11696
11881
|
value: value_1,
|
|
11882
|
+
isDisabled: option.isDisabled === undefined && disabledOptions && disabledOptions.length > 0 ? disabledOptions.includes(value_1) : option.isDisabled,
|
|
11697
11883
|
render: option.render,
|
|
11698
|
-
|
|
11884
|
+
group: option.group
|
|
11699
11885
|
};
|
|
11700
11886
|
}
|
|
11701
11887
|
return {
|
|
11702
11888
|
name: option,
|
|
11703
11889
|
value: option,
|
|
11890
|
+
isDisabled: disabledOptions && disabledOptions.includes(option),
|
|
11704
11891
|
render: option.render,
|
|
11705
|
-
|
|
11892
|
+
group: option.group
|
|
11706
11893
|
};
|
|
11707
11894
|
});
|
|
11708
11895
|
};
|
|
11709
|
-
React.useEffect(function () {
|
|
11710
|
-
setSelectedValue(value);
|
|
11711
|
-
}, [value]);
|
|
11712
|
-
React.useEffect(function () {
|
|
11713
|
-
var generatedOption = generateOptions(option, valueSelector, textSelector);
|
|
11714
|
-
setItem(generatedOption);
|
|
11715
|
-
setOptions(generatedOption);
|
|
11716
|
-
}, [option, disabledOptions, valueSelector, textSelector]);
|
|
11717
11896
|
var debouncedSearch = React__namespace.useRef(debounce__default["default"](function (query) {
|
|
11718
11897
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
11719
11898
|
return __generator(this, function (_a) {
|
|
@@ -11723,11 +11902,62 @@
|
|
|
11723
11902
|
});
|
|
11724
11903
|
});
|
|
11725
11904
|
}, 1000)).current;
|
|
11726
|
-
|
|
11905
|
+
React.useEffect(function () {
|
|
11906
|
+
var _a;
|
|
11907
|
+
(_a = scrollerRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
|
|
11908
|
+
top: 0
|
|
11909
|
+
});
|
|
11910
|
+
}, [query]);
|
|
11911
|
+
React.useEffect(function () {
|
|
11912
|
+
setSelectedValue(value);
|
|
11913
|
+
}, [value]);
|
|
11914
|
+
React.useEffect(function () {
|
|
11915
|
+
var generatedOption = generateOptions(option, valueSelector, textSelector);
|
|
11916
|
+
setItem(generatedOption);
|
|
11917
|
+
setOptions(generatedOption);
|
|
11918
|
+
}, [option, disabledOptions, valueSelector, textSelector]);
|
|
11919
|
+
React.useEffect(function () {
|
|
11727
11920
|
return function () {
|
|
11728
11921
|
debouncedSearch.cancel();
|
|
11729
11922
|
};
|
|
11730
11923
|
}, [debouncedSearch]);
|
|
11924
|
+
React.useEffect(function () {
|
|
11925
|
+
setGroupedItems(item.sort(function (a, b) {
|
|
11926
|
+
var nameA = (typeof a.group === 'string' ? a.group.toUpperCase() : a.group) || ''; // ignore upper and lowercase
|
|
11927
|
+
var nameB = (typeof b.group === 'string' ? b.group.toUpperCase() : b.group) || ''; // ignore upper and lowercase
|
|
11928
|
+
if (!a.group) return 1;
|
|
11929
|
+
if (!b.group) return -1;
|
|
11930
|
+
if (nameA < nameB) {
|
|
11931
|
+
return -1;
|
|
11932
|
+
}
|
|
11933
|
+
if (nameA > nameB) {
|
|
11934
|
+
return 1;
|
|
11935
|
+
}
|
|
11936
|
+
return 0;
|
|
11937
|
+
}).reduce(function (prev, current) {
|
|
11938
|
+
var addedGroupItems = [];
|
|
11939
|
+
if (prev) addedGroupItems = __spreadArray([], prev, true);
|
|
11940
|
+
var group = current.group;
|
|
11941
|
+
if ((!prev || !prev.find(function (val) {
|
|
11942
|
+
return val.value === "#group#".concat(group, "#");
|
|
11943
|
+
})) && group) {
|
|
11944
|
+
addedGroupItems.push({
|
|
11945
|
+
name: group,
|
|
11946
|
+
value: "#group#".concat(group, "#"),
|
|
11947
|
+
isGroup: true,
|
|
11948
|
+
render: function () {
|
|
11949
|
+
return jsxRuntime.jsx(Paragraph, __assign({
|
|
11950
|
+
paragraph: "shortContentBold"
|
|
11951
|
+
}, {
|
|
11952
|
+
children: group
|
|
11953
|
+
}), void 0);
|
|
11954
|
+
}
|
|
11955
|
+
});
|
|
11956
|
+
}
|
|
11957
|
+
addedGroupItems.push(current);
|
|
11958
|
+
return addedGroupItems;
|
|
11959
|
+
}, []));
|
|
11960
|
+
}, [item]);
|
|
11731
11961
|
return jsxRuntime.jsx(Downshift__default["default"], __assign({}, props, {
|
|
11732
11962
|
onChange: onChange,
|
|
11733
11963
|
itemToString: function (item) {
|
|
@@ -11957,14 +12187,16 @@
|
|
|
11957
12187
|
}
|
|
11958
12188
|
}, {
|
|
11959
12189
|
children: jsxRuntime.jsx(SelectOption, {
|
|
11960
|
-
children: item.map(function (item, index) {
|
|
12190
|
+
children: (groupedItems.length > 0 ? groupedItems : item).map(function (item, index) {
|
|
11961
12191
|
var _a;
|
|
11962
12192
|
return /*#__PURE__*/React.createElement(SelectItem, __assign({}, getItemProps({
|
|
11963
12193
|
item: item,
|
|
11964
|
-
disabled: item.isDisabled
|
|
12194
|
+
disabled: item.isDisabled || item.isGroup
|
|
11965
12195
|
}), {
|
|
11966
12196
|
key: (_a = item.value) !== null && _a !== void 0 ? _a : index,
|
|
11967
|
-
|
|
12197
|
+
hasGroup: !!item.group,
|
|
12198
|
+
isGroup: item.isGroup,
|
|
12199
|
+
css: __assign({}, !item.isGroup ? item.isDisabled ? {
|
|
11968
12200
|
backgroundColor: 'unset',
|
|
11969
12201
|
cursor: 'not-allowed',
|
|
11970
12202
|
color: '$textDisable'
|
|
@@ -11972,7 +12204,10 @@
|
|
|
11972
12204
|
backgroundColor: highlightedIndex === index ? '$bgGray' : 'white',
|
|
11973
12205
|
fontWeight: 'normal',
|
|
11974
12206
|
color: selectedItem && selectedItem.value === item.value ? '$textGreen' : '$textPrimary'
|
|
11975
|
-
}
|
|
12207
|
+
} : {
|
|
12208
|
+
backgroundColor: 'unset',
|
|
12209
|
+
cursor: 'default'
|
|
12210
|
+
})
|
|
11976
12211
|
}), item.render ? item.render(selectedItem) : item.name);
|
|
11977
12212
|
})
|
|
11978
12213
|
}, void 0)
|
|
@@ -12005,181 +12240,6 @@
|
|
|
12005
12240
|
}), void 0);
|
|
12006
12241
|
});
|
|
12007
12242
|
|
|
12008
|
-
var tryToString$2 = tryToString$5;
|
|
12009
|
-
|
|
12010
|
-
var $TypeError$5 = TypeError;
|
|
12011
|
-
|
|
12012
|
-
var deletePropertyOrThrow$1 = function (O, P) {
|
|
12013
|
-
if (!delete O[P]) throw $TypeError$5('Cannot delete property ' + tryToString$2(P) + ' of ' + tryToString$2(O));
|
|
12014
|
-
};
|
|
12015
|
-
|
|
12016
|
-
var arraySlice$3 = arraySliceSimple;
|
|
12017
|
-
|
|
12018
|
-
var floor$2 = Math.floor;
|
|
12019
|
-
|
|
12020
|
-
var mergeSort = function (array, comparefn) {
|
|
12021
|
-
var length = array.length;
|
|
12022
|
-
var middle = floor$2(length / 2);
|
|
12023
|
-
return length < 8 ? insertionSort(array, comparefn) : merge(
|
|
12024
|
-
array,
|
|
12025
|
-
mergeSort(arraySlice$3(array, 0, middle), comparefn),
|
|
12026
|
-
mergeSort(arraySlice$3(array, middle), comparefn),
|
|
12027
|
-
comparefn
|
|
12028
|
-
);
|
|
12029
|
-
};
|
|
12030
|
-
|
|
12031
|
-
var insertionSort = function (array, comparefn) {
|
|
12032
|
-
var length = array.length;
|
|
12033
|
-
var i = 1;
|
|
12034
|
-
var element, j;
|
|
12035
|
-
|
|
12036
|
-
while (i < length) {
|
|
12037
|
-
j = i;
|
|
12038
|
-
element = array[i];
|
|
12039
|
-
while (j && comparefn(array[j - 1], element) > 0) {
|
|
12040
|
-
array[j] = array[--j];
|
|
12041
|
-
}
|
|
12042
|
-
if (j !== i++) array[j] = element;
|
|
12043
|
-
} return array;
|
|
12044
|
-
};
|
|
12045
|
-
|
|
12046
|
-
var merge = function (array, left, right, comparefn) {
|
|
12047
|
-
var llength = left.length;
|
|
12048
|
-
var rlength = right.length;
|
|
12049
|
-
var lindex = 0;
|
|
12050
|
-
var rindex = 0;
|
|
12051
|
-
|
|
12052
|
-
while (lindex < llength || rindex < rlength) {
|
|
12053
|
-
array[lindex + rindex] = (lindex < llength && rindex < rlength)
|
|
12054
|
-
? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
|
|
12055
|
-
: lindex < llength ? left[lindex++] : right[rindex++];
|
|
12056
|
-
} return array;
|
|
12057
|
-
};
|
|
12058
|
-
|
|
12059
|
-
var arraySort$1 = mergeSort;
|
|
12060
|
-
|
|
12061
|
-
var userAgent$4 = engineUserAgent;
|
|
12062
|
-
|
|
12063
|
-
var firefox = userAgent$4.match(/firefox\/(\d+)/i);
|
|
12064
|
-
|
|
12065
|
-
var engineFfVersion = !!firefox && +firefox[1];
|
|
12066
|
-
|
|
12067
|
-
var UA = engineUserAgent;
|
|
12068
|
-
|
|
12069
|
-
var engineIsIeOrEdge = /MSIE|Trident/.test(UA);
|
|
12070
|
-
|
|
12071
|
-
var userAgent$3 = engineUserAgent;
|
|
12072
|
-
|
|
12073
|
-
var webkit = userAgent$3.match(/AppleWebKit\/(\d+)\./);
|
|
12074
|
-
|
|
12075
|
-
var engineWebkitVersion = !!webkit && +webkit[1];
|
|
12076
|
-
|
|
12077
|
-
var $$c = _export;
|
|
12078
|
-
var uncurryThis$6 = functionUncurryThis;
|
|
12079
|
-
var aCallable$6 = aCallable$a;
|
|
12080
|
-
var toObject$1 = toObject$7;
|
|
12081
|
-
var lengthOfArrayLike$2 = lengthOfArrayLike$6;
|
|
12082
|
-
var deletePropertyOrThrow = deletePropertyOrThrow$1;
|
|
12083
|
-
var toString$4 = toString$j;
|
|
12084
|
-
var fails$4 = fails$t;
|
|
12085
|
-
var internalSort = arraySort$1;
|
|
12086
|
-
var arrayMethodIsStrict = arrayMethodIsStrict$2;
|
|
12087
|
-
var FF = engineFfVersion;
|
|
12088
|
-
var IE_OR_EDGE = engineIsIeOrEdge;
|
|
12089
|
-
var V8 = engineV8Version;
|
|
12090
|
-
var WEBKIT = engineWebkitVersion;
|
|
12091
|
-
|
|
12092
|
-
var test = [];
|
|
12093
|
-
var nativeSort = uncurryThis$6(test.sort);
|
|
12094
|
-
var push$3 = uncurryThis$6(test.push);
|
|
12095
|
-
|
|
12096
|
-
// IE8-
|
|
12097
|
-
var FAILS_ON_UNDEFINED = fails$4(function () {
|
|
12098
|
-
test.sort(undefined);
|
|
12099
|
-
});
|
|
12100
|
-
// V8 bug
|
|
12101
|
-
var FAILS_ON_NULL = fails$4(function () {
|
|
12102
|
-
test.sort(null);
|
|
12103
|
-
});
|
|
12104
|
-
// Old WebKit
|
|
12105
|
-
var STRICT_METHOD = arrayMethodIsStrict('sort');
|
|
12106
|
-
|
|
12107
|
-
var STABLE_SORT = !fails$4(function () {
|
|
12108
|
-
// feature detection can be too slow, so check engines versions
|
|
12109
|
-
if (V8) return V8 < 70;
|
|
12110
|
-
if (FF && FF > 3) return;
|
|
12111
|
-
if (IE_OR_EDGE) return true;
|
|
12112
|
-
if (WEBKIT) return WEBKIT < 603;
|
|
12113
|
-
|
|
12114
|
-
var result = '';
|
|
12115
|
-
var code, chr, value, index;
|
|
12116
|
-
|
|
12117
|
-
// generate an array with more 512 elements (Chakra and old V8 fails only in this case)
|
|
12118
|
-
for (code = 65; code < 76; code++) {
|
|
12119
|
-
chr = String.fromCharCode(code);
|
|
12120
|
-
|
|
12121
|
-
switch (code) {
|
|
12122
|
-
case 66: case 69: case 70: case 72: value = 3; break;
|
|
12123
|
-
case 68: case 71: value = 4; break;
|
|
12124
|
-
default: value = 2;
|
|
12125
|
-
}
|
|
12126
|
-
|
|
12127
|
-
for (index = 0; index < 47; index++) {
|
|
12128
|
-
test.push({ k: chr + index, v: value });
|
|
12129
|
-
}
|
|
12130
|
-
}
|
|
12131
|
-
|
|
12132
|
-
test.sort(function (a, b) { return b.v - a.v; });
|
|
12133
|
-
|
|
12134
|
-
for (index = 0; index < test.length; index++) {
|
|
12135
|
-
chr = test[index].k.charAt(0);
|
|
12136
|
-
if (result.charAt(result.length - 1) !== chr) result += chr;
|
|
12137
|
-
}
|
|
12138
|
-
|
|
12139
|
-
return result !== 'DGBEFHACIJK';
|
|
12140
|
-
});
|
|
12141
|
-
|
|
12142
|
-
var FORCED$1 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;
|
|
12143
|
-
|
|
12144
|
-
var getSortCompare = function (comparefn) {
|
|
12145
|
-
return function (x, y) {
|
|
12146
|
-
if (y === undefined) return -1;
|
|
12147
|
-
if (x === undefined) return 1;
|
|
12148
|
-
if (comparefn !== undefined) return +comparefn(x, y) || 0;
|
|
12149
|
-
return toString$4(x) > toString$4(y) ? 1 : -1;
|
|
12150
|
-
};
|
|
12151
|
-
};
|
|
12152
|
-
|
|
12153
|
-
// `Array.prototype.sort` method
|
|
12154
|
-
// https://tc39.es/ecma262/#sec-array.prototype.sort
|
|
12155
|
-
$$c({ target: 'Array', proto: true, forced: FORCED$1 }, {
|
|
12156
|
-
sort: function sort(comparefn) {
|
|
12157
|
-
if (comparefn !== undefined) aCallable$6(comparefn);
|
|
12158
|
-
|
|
12159
|
-
var array = toObject$1(this);
|
|
12160
|
-
|
|
12161
|
-
if (STABLE_SORT) return comparefn === undefined ? nativeSort(array) : nativeSort(array, comparefn);
|
|
12162
|
-
|
|
12163
|
-
var items = [];
|
|
12164
|
-
var arrayLength = lengthOfArrayLike$2(array);
|
|
12165
|
-
var itemsLength, index;
|
|
12166
|
-
|
|
12167
|
-
for (index = 0; index < arrayLength; index++) {
|
|
12168
|
-
if (index in array) push$3(items, array[index]);
|
|
12169
|
-
}
|
|
12170
|
-
|
|
12171
|
-
internalSort(items, getSortCompare(comparefn));
|
|
12172
|
-
|
|
12173
|
-
itemsLength = lengthOfArrayLike$2(items);
|
|
12174
|
-
index = 0;
|
|
12175
|
-
|
|
12176
|
-
while (index < itemsLength) array[index] = items[index++];
|
|
12177
|
-
while (index < arrayLength) deletePropertyOrThrow(array, index++);
|
|
12178
|
-
|
|
12179
|
-
return array;
|
|
12180
|
-
}
|
|
12181
|
-
});
|
|
12182
|
-
|
|
12183
12243
|
var isPrototypeOf$1 = objectIsPrototypeOf;
|
|
12184
12244
|
|
|
12185
12245
|
var $TypeError$4 = TypeError;
|