@xqmsg/ui-core 0.24.2 → 0.24.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/README.md +8 -13
- package/dist/components/input/StackedMultiSelect/index.d.ts +1 -0
- package/dist/components/input/StackedSelect/index.d.ts +1 -0
- package/dist/components/input/components/dropdown/index.d.ts +2 -0
- package/dist/components/input/index.d.ts +2 -1
- package/dist/ui-core.cjs.development.js +197 -113
- package/dist/ui-core.cjs.development.js.map +1 -1
- package/dist/ui-core.cjs.production.min.js +1 -1
- package/dist/ui-core.cjs.production.min.js.map +1 -1
- package/dist/ui-core.esm.js +198 -114
- package/dist/ui-core.esm.js.map +1 -1
- package/package.json +6 -2
- package/src/components/icons/checkmark/index.tsx +1 -1
- package/src/components/icons/chevron/down/index.tsx +7 -1
- package/src/components/icons/chevron/right/index.tsx +1 -1
- package/src/components/icons/clock/index.tsx +1 -1
- package/src/components/icons/dropdown/index.tsx +5 -1
- package/src/components/icons/error/index.tsx +1 -1
- package/src/components/icons/file/fill/index.tsx +1 -1
- package/src/components/icons/file/outline/index.tsx +1 -1
- package/src/components/icons/folder/add/fill/index.tsx +1 -1
- package/src/components/icons/folder/add/outline/index.tsx +1 -1
- package/src/components/icons/folder/outline/index.tsx +1 -1
- package/src/components/icons/group/index.tsx +1 -1
- package/src/components/icons/home/index.tsx +1 -1
- package/src/components/icons/image/index.tsx +1 -1
- package/src/components/icons/link/index.tsx +1 -1
- package/src/components/icons/menu/index.tsx +1 -1
- package/src/components/icons/microsoft/index.tsx +1 -1
- package/src/components/icons/neutral/index.tsx +3 -1
- package/src/components/icons/page/index.tsx +1 -1
- package/src/components/icons/positive/index.tsx +1 -1
- package/src/components/icons/question/index.tsx +1 -1
- package/src/components/icons/search/index.tsx +1 -1
- package/src/components/icons/services/index.tsx +1 -1
- package/src/components/icons/settings/index.tsx +3 -1
- package/src/components/icons/table/fill/index.tsx +1 -1
- package/src/components/icons/table/outline/index.tsx +1 -1
- package/src/components/icons/task/index.tsx +1 -1
- package/src/components/icons/trash/index.tsx +1 -1
- package/src/components/icons/video/index.tsx +1 -1
- package/src/components/icons/warning/index.tsx +1 -1
- package/src/components/input/Input.stories.tsx +9 -0
- package/src/components/input/StackedMultiSelect/index.tsx +296 -277
- package/src/components/input/StackedSelect/index.tsx +46 -33
- package/src/components/input/components/dropdown/index.tsx +61 -12
- package/src/components/input/index.tsx +4 -0
|
@@ -94,7 +94,8 @@ var Memo = /*#__PURE__*/React.memo(ForwardRef);
|
|
|
94
94
|
var Error$1 = function Error(_ref) {
|
|
95
95
|
var boxSize = _ref.boxSize;
|
|
96
96
|
return /*#__PURE__*/React__default.createElement(Memo, {
|
|
97
|
-
|
|
97
|
+
width: boxSize,
|
|
98
|
+
height: boxSize
|
|
98
99
|
});
|
|
99
100
|
};
|
|
100
101
|
|
|
@@ -124,7 +125,8 @@ var Neutral = function Neutral(_ref) {
|
|
|
124
125
|
var color = _ref.color,
|
|
125
126
|
boxSize = _ref.boxSize;
|
|
126
127
|
return /*#__PURE__*/React__default.createElement(Memo$1, {
|
|
127
|
-
|
|
128
|
+
width: boxSize,
|
|
129
|
+
height: boxSize,
|
|
128
130
|
fill: color || '#3C3C43'
|
|
129
131
|
});
|
|
130
132
|
};
|
|
@@ -155,7 +157,8 @@ var Memo$2 = /*#__PURE__*/React.memo(ForwardRef$2);
|
|
|
155
157
|
var Positive = function Positive(_ref) {
|
|
156
158
|
var boxSize = _ref.boxSize;
|
|
157
159
|
return /*#__PURE__*/React__default.createElement(Memo$2, {
|
|
158
|
-
|
|
160
|
+
width: boxSize,
|
|
161
|
+
height: boxSize
|
|
159
162
|
});
|
|
160
163
|
};
|
|
161
164
|
|
|
@@ -185,7 +188,8 @@ var Memo$3 = /*#__PURE__*/React.memo(ForwardRef$3);
|
|
|
185
188
|
var Warning = function Warning(_ref) {
|
|
186
189
|
var boxSize = _ref.boxSize;
|
|
187
190
|
return /*#__PURE__*/React__default.createElement(Memo$3, {
|
|
188
|
-
|
|
191
|
+
width: boxSize,
|
|
192
|
+
height: boxSize
|
|
189
193
|
});
|
|
190
194
|
};
|
|
191
195
|
|
|
@@ -689,7 +693,8 @@ var Memo$5 = /*#__PURE__*/React.memo(ForwardRef$5);
|
|
|
689
693
|
var Microsoft = function Microsoft(_ref) {
|
|
690
694
|
var boxSize = _ref.boxSize;
|
|
691
695
|
return /*#__PURE__*/React__default.createElement(Memo$5, {
|
|
692
|
-
|
|
696
|
+
width: boxSize,
|
|
697
|
+
height: boxSize
|
|
693
698
|
});
|
|
694
699
|
};
|
|
695
700
|
|
|
@@ -874,8 +879,41 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
874
879
|
options = _ref.options,
|
|
875
880
|
dropdownRef = _ref.dropdownRef,
|
|
876
881
|
position = _ref.position,
|
|
877
|
-
optionIndex = _ref.optionIndex
|
|
882
|
+
optionIndex = _ref.optionIndex,
|
|
883
|
+
children = _ref.children,
|
|
884
|
+
_ref$loading = _ref.loading,
|
|
885
|
+
loading = _ref$loading === void 0 ? false : _ref$loading;
|
|
878
886
|
var DropdownContent = React.useMemo(function () {
|
|
887
|
+
if (loading) {
|
|
888
|
+
return /*#__PURE__*/React__default.createElement(react.Box, {
|
|
889
|
+
borderRadius: "inherit",
|
|
890
|
+
fontSize: "13px",
|
|
891
|
+
px: "8px",
|
|
892
|
+
py: "4px",
|
|
893
|
+
width: "100%",
|
|
894
|
+
color: colors.label.primary.light,
|
|
895
|
+
bg: "inherit",
|
|
896
|
+
whiteSpace: "nowrap"
|
|
897
|
+
}, /*#__PURE__*/React__default.createElement(react.Flex, {
|
|
898
|
+
alignItems: "center"
|
|
899
|
+
}, "Loading", /*#__PURE__*/React__default.createElement(react.Spinner, {
|
|
900
|
+
size: "xs",
|
|
901
|
+
opacity: 0.5,
|
|
902
|
+
ml: 2
|
|
903
|
+
})));
|
|
904
|
+
}
|
|
905
|
+
if (!loading && (!options || options.length === 0)) {
|
|
906
|
+
return /*#__PURE__*/React__default.createElement(react.Box, {
|
|
907
|
+
borderRadius: "inherit",
|
|
908
|
+
fontSize: "13px",
|
|
909
|
+
px: "8px",
|
|
910
|
+
py: "4px",
|
|
911
|
+
width: "100%",
|
|
912
|
+
color: colors.label.primary.light,
|
|
913
|
+
bg: "inherit",
|
|
914
|
+
whiteSpace: "nowrap"
|
|
915
|
+
}, "No options");
|
|
916
|
+
}
|
|
879
917
|
return options.map(function (option, idx) {
|
|
880
918
|
return /*#__PURE__*/React__default.createElement(react.Box, {
|
|
881
919
|
key: idx,
|
|
@@ -918,11 +956,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
918
956
|
}, option.label));
|
|
919
957
|
});
|
|
920
958
|
}, [onSelectItem, optionIndex, options]);
|
|
921
|
-
if (!options) return null;
|
|
922
959
|
return /*#__PURE__*/React__default.createElement(react.Flex, {
|
|
923
|
-
flexDirection: "column",
|
|
924
|
-
ref: dropdownRef,
|
|
925
|
-
scrollMargin: "15px",
|
|
926
960
|
bg: colors.fill.light.quaternary,
|
|
927
961
|
backdropFilter: "auto",
|
|
928
962
|
backdropBlur: "64px",
|
|
@@ -931,17 +965,29 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
931
965
|
borderColor: colors.fill.light.tertiary,
|
|
932
966
|
mt: "3px",
|
|
933
967
|
maxH: "240px",
|
|
934
|
-
|
|
968
|
+
position: "absolute",
|
|
935
969
|
px: "8px",
|
|
936
970
|
py: "4px",
|
|
937
|
-
|
|
971
|
+
overflow: "hidden",
|
|
972
|
+
minWidth: "100%",
|
|
973
|
+
zIndex: 100,
|
|
974
|
+
tabIndex: -2000,
|
|
975
|
+
alignItems: "flex-start",
|
|
976
|
+
flexDirection: "column",
|
|
938
977
|
top: position === 'top' ? 26 : undefined,
|
|
939
|
-
bottom: position === 'bottom' ? 30 : undefined
|
|
978
|
+
bottom: position === 'bottom' ? 30 : undefined
|
|
979
|
+
}, children && /*#__PURE__*/React__default.createElement(react.Box, {
|
|
980
|
+
width: "100%",
|
|
981
|
+
mb: 2,
|
|
982
|
+
mt: 1
|
|
983
|
+
}, children), /*#__PURE__*/React__default.createElement(react.Flex, {
|
|
940
984
|
width: "fit-content",
|
|
985
|
+
overflowY: "auto",
|
|
986
|
+
flexDirection: "column",
|
|
987
|
+
ref: dropdownRef,
|
|
941
988
|
minWidth: "100%",
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
}, DropdownContent);
|
|
989
|
+
scrollMargin: "15px"
|
|
990
|
+
}, DropdownContent));
|
|
945
991
|
};
|
|
946
992
|
|
|
947
993
|
function useOnClickOutside(ref, handler) {
|
|
@@ -996,12 +1042,13 @@ var Dropdown$1 = function Dropdown(_ref) {
|
|
|
996
1042
|
var boxSize = _ref.boxSize,
|
|
997
1043
|
disabled = _ref.disabled;
|
|
998
1044
|
return /*#__PURE__*/React__default.createElement(Memo$6, {
|
|
999
|
-
|
|
1045
|
+
width: boxSize,
|
|
1046
|
+
height: boxSize,
|
|
1000
1047
|
fill: disabled ? '#3C3C4399' : '#0082FF'
|
|
1001
1048
|
});
|
|
1002
1049
|
};
|
|
1003
1050
|
|
|
1004
|
-
var _excluded$1 = ["isRequired", "options", "name", "setValue", "handleOnChange", "disabled", "value", "fullOptions"];
|
|
1051
|
+
var _excluded$1 = ["isRequired", "options", "name", "setValue", "handleOnChange", "disabled", "value", "fullOptions", "loadingOptions"];
|
|
1005
1052
|
/**
|
|
1006
1053
|
* A functional React component utilized to render the `StackedSelect` component.
|
|
1007
1054
|
*/
|
|
@@ -1015,6 +1062,7 @@ var StackedSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref
|
|
|
1015
1062
|
disabled = _ref2.disabled,
|
|
1016
1063
|
value = _ref2.value,
|
|
1017
1064
|
fullOptions = _ref2.fullOptions,
|
|
1065
|
+
loadingOptions = _ref2.loadingOptions,
|
|
1018
1066
|
props = _objectWithoutPropertiesLoose(_ref2, _excluded$1);
|
|
1019
1067
|
var dropdownRef = React.useRef(null);
|
|
1020
1068
|
var dropdownMenuRef = React.useRef(null);
|
|
@@ -1035,9 +1083,9 @@ var StackedSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref
|
|
|
1035
1083
|
var _useState5 = React.useState(''),
|
|
1036
1084
|
searchValue = _useState5[0],
|
|
1037
1085
|
setSearchValue = _useState5[1];
|
|
1038
|
-
var _useState6 = React.useState(
|
|
1039
|
-
|
|
1040
|
-
|
|
1086
|
+
var _useState6 = React.useState(options),
|
|
1087
|
+
filteredOptions = _useState6[0],
|
|
1088
|
+
setFilteredOptions = _useState6[1];
|
|
1041
1089
|
var boundingClientRect = (_dropdownRef$current = dropdownRef.current) == null ? void 0 : _dropdownRef$current.getBoundingClientRect();
|
|
1042
1090
|
React.useEffect(function () {
|
|
1043
1091
|
var _dropdownRef$current2;
|
|
@@ -1053,9 +1101,10 @@ var StackedSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref
|
|
|
1053
1101
|
setSelectedOption((_find$label = (_find = (fullOptions || options).find(function (option) {
|
|
1054
1102
|
return option.value === value;
|
|
1055
1103
|
})) == null ? void 0 : _find.label) != null ? _find$label : '');
|
|
1056
|
-
}, [fullOptions, value]);
|
|
1104
|
+
}, [fullOptions, options, value]);
|
|
1057
1105
|
useOnClickOutside(dropdownRef, function () {
|
|
1058
|
-
|
|
1106
|
+
setIsFocussed(false);
|
|
1107
|
+
setSearchValue('');
|
|
1059
1108
|
});
|
|
1060
1109
|
var handleOnSelectItem = function handleOnSelectItem(option) {
|
|
1061
1110
|
if (handleOnChange) {
|
|
@@ -1064,29 +1113,30 @@ var StackedSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref
|
|
|
1064
1113
|
setValue(name, option.value);
|
|
1065
1114
|
setSelectedOption(option.label);
|
|
1066
1115
|
setIsFocussed(false);
|
|
1116
|
+
setSearchValue('');
|
|
1067
1117
|
};
|
|
1068
1118
|
var handleOnKeyDown = function handleOnKeyDown(e) {
|
|
1069
|
-
var initialOptionIndex =
|
|
1119
|
+
var initialOptionIndex = filteredOptions.length && filteredOptions[0].value === 'section_header' ? 1 : 0;
|
|
1070
1120
|
if (!isFocussed && (e.key === 'Enter' || e.key === 'ArrowUp' || e.key === 'ArrowDown')) {
|
|
1071
1121
|
setIsFocussed(true);
|
|
1072
1122
|
return setOptionIndex(initialOptionIndex);
|
|
1073
1123
|
}
|
|
1074
|
-
if (isFocussed) {
|
|
1124
|
+
if (isFocussed && filteredOptions.length > 0) {
|
|
1075
1125
|
if (optionIndex === null && (e.key === 'Enter' || e.key === 'ArrowUp' || e.key === 'ArrowDown')) {
|
|
1076
1126
|
return setOptionIndex(initialOptionIndex);
|
|
1077
1127
|
}
|
|
1078
1128
|
if (e.key === 'ArrowUp' && optionIndex !== null && optionIndex > 0) {
|
|
1079
1129
|
var _dropdownMenuRef$curr;
|
|
1080
|
-
var incrementValue =
|
|
1130
|
+
var incrementValue = filteredOptions[optionIndex - 1] && filteredOptions[optionIndex - 1].value === 'section_header' ? 2 : 1;
|
|
1081
1131
|
setOptionIndex(optionIndex - incrementValue);
|
|
1082
1132
|
return (_dropdownMenuRef$curr = dropdownMenuRef.current) == null ? void 0 : _dropdownMenuRef$curr.scrollTo({
|
|
1083
1133
|
top: optionIndex * 24,
|
|
1084
1134
|
behavior: 'smooth'
|
|
1085
1135
|
});
|
|
1086
1136
|
}
|
|
1087
|
-
if (e.key === 'ArrowDown' && optionIndex !== null && optionIndex <
|
|
1137
|
+
if (e.key === 'ArrowDown' && optionIndex !== null && optionIndex < filteredOptions.length) {
|
|
1088
1138
|
var _dropdownMenuRef$curr2;
|
|
1089
|
-
var _incrementValue =
|
|
1139
|
+
var _incrementValue = filteredOptions[optionIndex + 1] && filteredOptions[optionIndex + 1].value === 'section_header' ? 2 : 1;
|
|
1090
1140
|
setOptionIndex(optionIndex + _incrementValue);
|
|
1091
1141
|
return (_dropdownMenuRef$curr2 = dropdownMenuRef.current) == null ? void 0 : _dropdownMenuRef$curr2.scrollTo({
|
|
1092
1142
|
top: optionIndex * 24,
|
|
@@ -1094,7 +1144,7 @@ var StackedSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref
|
|
|
1094
1144
|
});
|
|
1095
1145
|
}
|
|
1096
1146
|
if (e.key === 'Enter' && optionIndex !== null) {
|
|
1097
|
-
var option =
|
|
1147
|
+
var option = filteredOptions.find(function (_, idx) {
|
|
1098
1148
|
return optionIndex === idx;
|
|
1099
1149
|
});
|
|
1100
1150
|
if (!option) return;
|
|
@@ -1123,18 +1173,19 @@ var StackedSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref
|
|
|
1123
1173
|
top: idx * 24,
|
|
1124
1174
|
behavior: 'smooth'
|
|
1125
1175
|
});
|
|
1126
|
-
setSearchValue('');
|
|
1127
|
-
setDebouncedSearchValue('');
|
|
1128
1176
|
}
|
|
1129
1177
|
}, [options, searchValue]);
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
}
|
|
1134
|
-
}, []);
|
|
1135
|
-
var
|
|
1136
|
-
|
|
1137
|
-
|
|
1178
|
+
React.useEffect(function () {
|
|
1179
|
+
setFilteredOptions(options.filter(function (element) {
|
|
1180
|
+
return element.label.toLowerCase().includes(searchValue.toLowerCase());
|
|
1181
|
+
}));
|
|
1182
|
+
}, [options, searchValue]);
|
|
1183
|
+
var handleInput = function handleInput(e) {
|
|
1184
|
+
var _filteredOptions$;
|
|
1185
|
+
var initialOptionIndex = filteredOptions.length && ((_filteredOptions$ = filteredOptions[0]) == null ? void 0 : _filteredOptions$.value) === 'section_header' ? 1 : 0;
|
|
1186
|
+
setOptionIndex(initialOptionIndex);
|
|
1187
|
+
var value = e.target.value;
|
|
1188
|
+
setSearchValue(value);
|
|
1138
1189
|
};
|
|
1139
1190
|
return /*#__PURE__*/React__default.createElement(react.Box, {
|
|
1140
1191
|
ref: dropdownRef,
|
|
@@ -1146,16 +1197,12 @@ var StackedSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref
|
|
|
1146
1197
|
onClick: function onClick() {
|
|
1147
1198
|
return setIsFocussed(!isFocussed);
|
|
1148
1199
|
},
|
|
1149
|
-
cursor:
|
|
1150
|
-
color:
|
|
1200
|
+
cursor: isFocussed ? 'default' : 'pointer',
|
|
1201
|
+
color: loadingOptions ? 'transparent' : 'inital',
|
|
1151
1202
|
fontSize: "13px",
|
|
1152
|
-
|
|
1153
|
-
value: selectedOption,
|
|
1154
|
-
disabled: disabled,
|
|
1203
|
+
value: isFocussed ? searchValue : selectedOption,
|
|
1155
1204
|
autoComplete: "off",
|
|
1156
|
-
onChange:
|
|
1157
|
-
return update(debouncedSearchValue.concat(e.target.value));
|
|
1158
|
-
},
|
|
1205
|
+
onChange: handleInput,
|
|
1159
1206
|
onKeyDown: handleOnKeyDown
|
|
1160
1207
|
})), /*#__PURE__*/React__default.createElement(react.InputRightElement, {
|
|
1161
1208
|
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
@@ -1163,14 +1210,15 @@ var StackedSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref
|
|
|
1163
1210
|
return !disabled && setIsFocussed(!isFocussed);
|
|
1164
1211
|
}
|
|
1165
1212
|
}, /*#__PURE__*/React__default.createElement(Dropdown$1, {
|
|
1166
|
-
boxSize: "
|
|
1213
|
+
boxSize: "12px",
|
|
1167
1214
|
disabled: disabled
|
|
1168
1215
|
}))), isFocussed && /*#__PURE__*/React__default.createElement(Dropdown, {
|
|
1169
1216
|
position: position,
|
|
1170
1217
|
dropdownRef: dropdownMenuRef,
|
|
1171
1218
|
onSelectItem: handleOnSelectItem,
|
|
1172
|
-
options:
|
|
1173
|
-
optionIndex: optionIndex
|
|
1219
|
+
options: filteredOptions,
|
|
1220
|
+
optionIndex: optionIndex,
|
|
1221
|
+
loading: loadingOptions
|
|
1174
1222
|
}));
|
|
1175
1223
|
});
|
|
1176
1224
|
|
|
@@ -1288,7 +1336,8 @@ var StackedMultiSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2,
|
|
|
1288
1336
|
control = _ref2.control,
|
|
1289
1337
|
name = _ref2.name,
|
|
1290
1338
|
placeholder = _ref2.placeholder,
|
|
1291
|
-
disabled = _ref2.disabled
|
|
1339
|
+
disabled = _ref2.disabled,
|
|
1340
|
+
loadingOptions = _ref2.loadingOptions;
|
|
1292
1341
|
var watchedValue = reactHookForm.useWatch({
|
|
1293
1342
|
control: control,
|
|
1294
1343
|
name: name
|
|
@@ -1306,24 +1355,25 @@ var StackedMultiSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2,
|
|
|
1306
1355
|
var _useState3 = React.useState(options),
|
|
1307
1356
|
localOptions = _useState3[0],
|
|
1308
1357
|
setLocalOptions = _useState3[1];
|
|
1309
|
-
var _useState4 = React.useState(
|
|
1310
|
-
|
|
1311
|
-
|
|
1358
|
+
var _useState4 = React.useState(localOptions),
|
|
1359
|
+
filteredOptions = _useState4[0],
|
|
1360
|
+
setFilteredOptions = _useState4[1];
|
|
1312
1361
|
var _useState5 = React.useState(false),
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
var _useState6 = React.useState(
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
var _useState7 = React.useState(
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
var _useState8 = React.useState(''),
|
|
1322
|
-
|
|
1323
|
-
|
|
1362
|
+
isFocussed = _useState5[0],
|
|
1363
|
+
setIsFocussed = _useState5[1];
|
|
1364
|
+
var _useState6 = React.useState(false),
|
|
1365
|
+
shouldSideScroll = _useState6[0],
|
|
1366
|
+
setShouldSideScroll = _useState6[1];
|
|
1367
|
+
var _useState7 = React.useState(null),
|
|
1368
|
+
optionIndex = _useState7[0],
|
|
1369
|
+
setOptionIndex = _useState7[1];
|
|
1370
|
+
var _useState8 = React.useState('top'),
|
|
1371
|
+
position = _useState8[0],
|
|
1372
|
+
setPosition = _useState8[1];
|
|
1324
1373
|
var _useState9 = React.useState(''),
|
|
1325
|
-
|
|
1326
|
-
|
|
1374
|
+
searchValue = _useState9[0],
|
|
1375
|
+
setSearchValue = _useState9[1];
|
|
1376
|
+
// const [debouncedSearchValue, setDebouncedSearchValue] = useState('');
|
|
1327
1377
|
var boundingClientRect = (_dropdownRef$current = dropdownRef.current) == null ? void 0 : _dropdownRef$current.getBoundingClientRect();
|
|
1328
1378
|
React.useEffect(function () {
|
|
1329
1379
|
if (window.innerHeight - ((boundingClientRect == null ? void 0 : boundingClientRect.y) + 240) >= 0) {
|
|
@@ -1387,6 +1437,8 @@ var StackedMultiSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2,
|
|
|
1387
1437
|
setLocalValues(function (prevLocalValues) {
|
|
1388
1438
|
return [].concat(prevLocalValues, [option]);
|
|
1389
1439
|
});
|
|
1440
|
+
// reset search on value select
|
|
1441
|
+
setSearchValue('');
|
|
1390
1442
|
};
|
|
1391
1443
|
var handleDelete = function handleDelete(option) {
|
|
1392
1444
|
var newValue = localValues.filter(function (localValue) {
|
|
@@ -1422,16 +1474,16 @@ var StackedMultiSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2,
|
|
|
1422
1474
|
}
|
|
1423
1475
|
if (e.key === 'ArrowUp' && optionIndex !== null && optionIndex > 0) {
|
|
1424
1476
|
var _dropdownMenuRef$curr;
|
|
1425
|
-
var incrementValue =
|
|
1477
|
+
var incrementValue = filteredOptions[optionIndex - 1] && filteredOptions[optionIndex - 1].value === 'section_header' ? 2 : 1;
|
|
1426
1478
|
setOptionIndex(optionIndex - incrementValue);
|
|
1427
1479
|
return (_dropdownMenuRef$curr = dropdownMenuRef.current) == null ? void 0 : _dropdownMenuRef$curr.scrollTo({
|
|
1428
1480
|
top: optionIndex * 24,
|
|
1429
1481
|
behavior: 'smooth'
|
|
1430
1482
|
});
|
|
1431
1483
|
}
|
|
1432
|
-
if (e.key === 'ArrowDown' && optionIndex !== null && optionIndex <
|
|
1484
|
+
if (e.key === 'ArrowDown' && optionIndex !== null && optionIndex < filteredOptions.length) {
|
|
1433
1485
|
var _dropdownMenuRef$curr2;
|
|
1434
|
-
var _incrementValue =
|
|
1486
|
+
var _incrementValue = filteredOptions[optionIndex + 1] && filteredOptions[optionIndex + 1].value === 'section_header' ? 2 : 1;
|
|
1435
1487
|
setOptionIndex(optionIndex + _incrementValue);
|
|
1436
1488
|
return (_dropdownMenuRef$curr2 = dropdownMenuRef.current) == null ? void 0 : _dropdownMenuRef$curr2.scrollTo({
|
|
1437
1489
|
top: optionIndex * 24,
|
|
@@ -1439,7 +1491,7 @@ var StackedMultiSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2,
|
|
|
1439
1491
|
});
|
|
1440
1492
|
}
|
|
1441
1493
|
if (e.key === 'Enter' && optionIndex !== null) {
|
|
1442
|
-
var option =
|
|
1494
|
+
var option = filteredOptions.find(function (_, idx) {
|
|
1443
1495
|
return optionIndex === idx;
|
|
1444
1496
|
});
|
|
1445
1497
|
if (!option) return;
|
|
@@ -1449,7 +1501,6 @@ var StackedMultiSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2,
|
|
|
1449
1501
|
if (e.key === 'Tab') {
|
|
1450
1502
|
return setIsFocussed(false);
|
|
1451
1503
|
}
|
|
1452
|
-
return update(debouncedSearchValue.concat(e.key));
|
|
1453
1504
|
}
|
|
1454
1505
|
};
|
|
1455
1506
|
React.useEffect(function () {
|
|
@@ -1459,21 +1510,22 @@ var StackedMultiSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2,
|
|
|
1459
1510
|
return option.label.substring(0, searchValue.length).toLowerCase() === searchValue.toLowerCase();
|
|
1460
1511
|
});
|
|
1461
1512
|
(_dropdownMenuRef$curr3 = dropdownMenuRef.current) == null ? void 0 : _dropdownMenuRef$curr3.scrollTo({
|
|
1462
|
-
top: idx *
|
|
1513
|
+
top: idx * 27,
|
|
1463
1514
|
behavior: 'smooth'
|
|
1464
1515
|
});
|
|
1465
|
-
setSearchValue('');
|
|
1466
|
-
setDebouncedSearchValue('');
|
|
1467
1516
|
}
|
|
1468
1517
|
}, [options, searchValue]);
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
}
|
|
1473
|
-
}, []);
|
|
1474
|
-
var
|
|
1475
|
-
|
|
1476
|
-
|
|
1518
|
+
React.useEffect(function () {
|
|
1519
|
+
setFilteredOptions(localOptions.filter(function (element) {
|
|
1520
|
+
return element.label.toLowerCase().includes(searchValue.toLowerCase());
|
|
1521
|
+
}));
|
|
1522
|
+
}, [localOptions, searchValue]);
|
|
1523
|
+
var handleInput = function handleInput(e) {
|
|
1524
|
+
var _filteredOptions$;
|
|
1525
|
+
var initialOptionIndex = ((_filteredOptions$ = filteredOptions[0]) == null ? void 0 : _filteredOptions$.value) === 'section_header' ? 1 : 0;
|
|
1526
|
+
setOptionIndex(initialOptionIndex);
|
|
1527
|
+
var value = e.target.value;
|
|
1528
|
+
setSearchValue(value);
|
|
1477
1529
|
};
|
|
1478
1530
|
return /*#__PURE__*/React__default.createElement(react.Box, {
|
|
1479
1531
|
ref: dropdownRef,
|
|
@@ -1549,17 +1601,22 @@ var StackedMultiSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2,
|
|
|
1549
1601
|
justifyContent: "center",
|
|
1550
1602
|
alignItems: "center"
|
|
1551
1603
|
}, /*#__PURE__*/React__default.createElement(Dropdown$1, {
|
|
1552
|
-
boxSize: "
|
|
1604
|
+
boxSize: "12px",
|
|
1553
1605
|
disabled: disabled
|
|
1554
1606
|
}))), isFocussed && /*#__PURE__*/React__default.createElement(Dropdown, {
|
|
1555
1607
|
dropdownRef: dropdownMenuRef,
|
|
1556
1608
|
onSelectItem: function onSelectItem(option) {
|
|
1557
1609
|
return handleChange(option);
|
|
1558
1610
|
},
|
|
1559
|
-
options:
|
|
1611
|
+
options: filteredOptions,
|
|
1560
1612
|
position: position,
|
|
1561
|
-
optionIndex: optionIndex
|
|
1562
|
-
|
|
1613
|
+
optionIndex: optionIndex,
|
|
1614
|
+
loading: loadingOptions
|
|
1615
|
+
}, /*#__PURE__*/React__default.createElement(react.Input, {
|
|
1616
|
+
value: searchValue,
|
|
1617
|
+
onChange: handleInput,
|
|
1618
|
+
disabled: loadingOptions
|
|
1619
|
+
})));
|
|
1563
1620
|
});
|
|
1564
1621
|
|
|
1565
1622
|
/**
|
|
@@ -1901,7 +1958,9 @@ function Input(_ref) {
|
|
|
1901
1958
|
setValue = _ref.setValue,
|
|
1902
1959
|
setError = _ref.setError,
|
|
1903
1960
|
clearErrors = _ref.clearErrors,
|
|
1904
|
-
separators = _ref.separators
|
|
1961
|
+
separators = _ref.separators,
|
|
1962
|
+
_ref$loadingOptions = _ref.loadingOptions,
|
|
1963
|
+
loadingOptions = _ref$loadingOptions === void 0 ? false : _ref$loadingOptions;
|
|
1905
1964
|
function selectedInputField(onChange, onBlur, ref, value) {
|
|
1906
1965
|
switch (inputType) {
|
|
1907
1966
|
case 'text':
|
|
@@ -1956,7 +2015,8 @@ function Input(_ref) {
|
|
|
1956
2015
|
value: value,
|
|
1957
2016
|
defaultValue: defaultValue,
|
|
1958
2017
|
placeholder: placeholder,
|
|
1959
|
-
fullOptions: fullOptions
|
|
2018
|
+
fullOptions: fullOptions,
|
|
2019
|
+
loadingOptions: loadingOptions
|
|
1960
2020
|
});
|
|
1961
2021
|
case 'textarea':
|
|
1962
2022
|
return /*#__PURE__*/React__default.createElement(StackedTextarea, {
|
|
@@ -2007,7 +2067,8 @@ function Input(_ref) {
|
|
|
2007
2067
|
control: control,
|
|
2008
2068
|
setError: setError,
|
|
2009
2069
|
clearErrors: clearErrors,
|
|
2010
|
-
placeholder: placeholder
|
|
2070
|
+
placeholder: placeholder,
|
|
2071
|
+
loadingOptions: loadingOptions
|
|
2011
2072
|
});
|
|
2012
2073
|
case 'pilled-text':
|
|
2013
2074
|
return /*#__PURE__*/React__default.createElement(StackedPilledInput, {
|
|
@@ -2155,7 +2216,8 @@ var Memo$8 = /*#__PURE__*/React.memo(ForwardRef$8);
|
|
|
2155
2216
|
var Checkmark = function Checkmark(_ref) {
|
|
2156
2217
|
var boxSize = _ref.boxSize;
|
|
2157
2218
|
return /*#__PURE__*/React__default.createElement(Memo$8, {
|
|
2158
|
-
|
|
2219
|
+
width: boxSize,
|
|
2220
|
+
height: boxSize
|
|
2159
2221
|
});
|
|
2160
2222
|
};
|
|
2161
2223
|
|
|
@@ -2185,7 +2247,8 @@ var Memo$9 = /*#__PURE__*/React.memo(ForwardRef$9);
|
|
|
2185
2247
|
var ChevronDown = function ChevronDown(_ref) {
|
|
2186
2248
|
var boxSize = _ref.boxSize;
|
|
2187
2249
|
return /*#__PURE__*/React__default.createElement(Memo$9, {
|
|
2188
|
-
|
|
2250
|
+
width: boxSize,
|
|
2251
|
+
height: boxSize,
|
|
2189
2252
|
fill: colors.fill.action
|
|
2190
2253
|
});
|
|
2191
2254
|
};
|
|
@@ -2216,7 +2279,8 @@ var Memo$a = /*#__PURE__*/React.memo(ForwardRef$a);
|
|
|
2216
2279
|
var ChevronRight = function ChevronRight(_ref) {
|
|
2217
2280
|
var boxSize = _ref.boxSize;
|
|
2218
2281
|
return /*#__PURE__*/React__default.createElement(Memo$a, {
|
|
2219
|
-
|
|
2282
|
+
width: boxSize,
|
|
2283
|
+
height: boxSize
|
|
2220
2284
|
});
|
|
2221
2285
|
};
|
|
2222
2286
|
|
|
@@ -2246,7 +2310,8 @@ var Memo$b = /*#__PURE__*/React.memo(ForwardRef$b);
|
|
|
2246
2310
|
var Clock = function Clock(_ref) {
|
|
2247
2311
|
var boxSize = _ref.boxSize;
|
|
2248
2312
|
return /*#__PURE__*/React__default.createElement(Memo$b, {
|
|
2249
|
-
|
|
2313
|
+
width: boxSize,
|
|
2314
|
+
height: boxSize
|
|
2250
2315
|
});
|
|
2251
2316
|
};
|
|
2252
2317
|
|
|
@@ -2277,7 +2342,8 @@ var Memo$c = /*#__PURE__*/React.memo(ForwardRef$c);
|
|
|
2277
2342
|
var FileFill = function FileFill(_ref) {
|
|
2278
2343
|
var boxSize = _ref.boxSize;
|
|
2279
2344
|
return /*#__PURE__*/React__default.createElement(Memo$c, {
|
|
2280
|
-
|
|
2345
|
+
width: boxSize,
|
|
2346
|
+
height: boxSize
|
|
2281
2347
|
});
|
|
2282
2348
|
};
|
|
2283
2349
|
|
|
@@ -2307,7 +2373,8 @@ var Memo$d = /*#__PURE__*/React.memo(ForwardRef$d);
|
|
|
2307
2373
|
var FileOutline = function FileOutline(_ref) {
|
|
2308
2374
|
var boxSize = _ref.boxSize;
|
|
2309
2375
|
return /*#__PURE__*/React__default.createElement(Memo$d, {
|
|
2310
|
-
|
|
2376
|
+
width: boxSize,
|
|
2377
|
+
height: boxSize
|
|
2311
2378
|
});
|
|
2312
2379
|
};
|
|
2313
2380
|
|
|
@@ -2434,7 +2501,8 @@ var Memo$g = /*#__PURE__*/React.memo(ForwardRef$g);
|
|
|
2434
2501
|
var FolderOutline = function FolderOutline(_ref) {
|
|
2435
2502
|
var boxSize = _ref.boxSize;
|
|
2436
2503
|
return /*#__PURE__*/React__default.createElement(Memo$g, {
|
|
2437
|
-
|
|
2504
|
+
width: boxSize,
|
|
2505
|
+
height: boxSize
|
|
2438
2506
|
});
|
|
2439
2507
|
};
|
|
2440
2508
|
|
|
@@ -2464,7 +2532,8 @@ var Memo$h = /*#__PURE__*/React.memo(ForwardRef$h);
|
|
|
2464
2532
|
var FolderAddFill = function FolderAddFill(_ref) {
|
|
2465
2533
|
var boxSize = _ref.boxSize;
|
|
2466
2534
|
return /*#__PURE__*/React__default.createElement(Memo$h, {
|
|
2467
|
-
|
|
2535
|
+
width: boxSize,
|
|
2536
|
+
height: boxSize
|
|
2468
2537
|
});
|
|
2469
2538
|
};
|
|
2470
2539
|
|
|
@@ -2494,7 +2563,8 @@ var Memo$i = /*#__PURE__*/React.memo(ForwardRef$i);
|
|
|
2494
2563
|
var FolderAddOutline = function FolderAddOutline(_ref) {
|
|
2495
2564
|
var boxSize = _ref.boxSize;
|
|
2496
2565
|
return /*#__PURE__*/React__default.createElement(Memo$i, {
|
|
2497
|
-
|
|
2566
|
+
width: boxSize,
|
|
2567
|
+
height: boxSize
|
|
2498
2568
|
});
|
|
2499
2569
|
};
|
|
2500
2570
|
|
|
@@ -2537,7 +2607,8 @@ var Memo$j = /*#__PURE__*/React.memo(ForwardRef$j);
|
|
|
2537
2607
|
var Group = function Group(_ref) {
|
|
2538
2608
|
var boxSize = _ref.boxSize;
|
|
2539
2609
|
return /*#__PURE__*/React__default.createElement(Memo$j, {
|
|
2540
|
-
|
|
2610
|
+
width: boxSize,
|
|
2611
|
+
height: boxSize
|
|
2541
2612
|
});
|
|
2542
2613
|
};
|
|
2543
2614
|
|
|
@@ -2567,7 +2638,8 @@ var Memo$k = /*#__PURE__*/React.memo(ForwardRef$k);
|
|
|
2567
2638
|
var Home = function Home(_ref) {
|
|
2568
2639
|
var boxSize = _ref.boxSize;
|
|
2569
2640
|
return /*#__PURE__*/React__default.createElement(Memo$k, {
|
|
2570
|
-
|
|
2641
|
+
width: boxSize,
|
|
2642
|
+
height: boxSize
|
|
2571
2643
|
});
|
|
2572
2644
|
};
|
|
2573
2645
|
|
|
@@ -2597,7 +2669,8 @@ var Memo$l = /*#__PURE__*/React.memo(ForwardRef$l);
|
|
|
2597
2669
|
var Image = function Image(_ref) {
|
|
2598
2670
|
var boxSize = _ref.boxSize;
|
|
2599
2671
|
return /*#__PURE__*/React__default.createElement(Memo$l, {
|
|
2600
|
-
|
|
2672
|
+
width: boxSize,
|
|
2673
|
+
height: boxSize
|
|
2601
2674
|
});
|
|
2602
2675
|
};
|
|
2603
2676
|
|
|
@@ -2627,7 +2700,8 @@ var Memo$m = /*#__PURE__*/React.memo(ForwardRef$m);
|
|
|
2627
2700
|
var Menu = function Menu(_ref) {
|
|
2628
2701
|
var boxSize = _ref.boxSize;
|
|
2629
2702
|
return /*#__PURE__*/React__default.createElement(Memo$m, {
|
|
2630
|
-
|
|
2703
|
+
width: boxSize,
|
|
2704
|
+
height: boxSize
|
|
2631
2705
|
});
|
|
2632
2706
|
};
|
|
2633
2707
|
|
|
@@ -2670,7 +2744,8 @@ var Memo$n = /*#__PURE__*/React.memo(ForwardRef$n);
|
|
|
2670
2744
|
var Search = function Search(_ref) {
|
|
2671
2745
|
var boxSize = _ref.boxSize;
|
|
2672
2746
|
return /*#__PURE__*/React__default.createElement(Memo$n, {
|
|
2673
|
-
|
|
2747
|
+
width: boxSize,
|
|
2748
|
+
height: boxSize
|
|
2674
2749
|
});
|
|
2675
2750
|
};
|
|
2676
2751
|
|
|
@@ -2703,7 +2778,8 @@ var Memo$o = /*#__PURE__*/React.memo(ForwardRef$o);
|
|
|
2703
2778
|
var Settings = function Settings(_ref) {
|
|
2704
2779
|
var boxSize = _ref.boxSize;
|
|
2705
2780
|
return /*#__PURE__*/React__default.createElement(Memo$o, {
|
|
2706
|
-
|
|
2781
|
+
width: boxSize,
|
|
2782
|
+
height: boxSize,
|
|
2707
2783
|
fill: colors.fill.action
|
|
2708
2784
|
});
|
|
2709
2785
|
};
|
|
@@ -2734,7 +2810,8 @@ var Memo$p = /*#__PURE__*/React.memo(ForwardRef$p);
|
|
|
2734
2810
|
var TableFill = function TableFill(_ref) {
|
|
2735
2811
|
var boxSize = _ref.boxSize;
|
|
2736
2812
|
return /*#__PURE__*/React__default.createElement(Memo$p, {
|
|
2737
|
-
|
|
2813
|
+
width: boxSize,
|
|
2814
|
+
height: boxSize
|
|
2738
2815
|
});
|
|
2739
2816
|
};
|
|
2740
2817
|
|
|
@@ -2764,7 +2841,8 @@ var Memo$q = /*#__PURE__*/React.memo(ForwardRef$q);
|
|
|
2764
2841
|
var TableOutline = function TableOutline(_ref) {
|
|
2765
2842
|
var boxSize = _ref.boxSize;
|
|
2766
2843
|
return /*#__PURE__*/React__default.createElement(Memo$q, {
|
|
2767
|
-
|
|
2844
|
+
width: boxSize,
|
|
2845
|
+
height: boxSize
|
|
2768
2846
|
});
|
|
2769
2847
|
};
|
|
2770
2848
|
|
|
@@ -2794,7 +2872,8 @@ var Memo$r = /*#__PURE__*/React.memo(ForwardRef$r);
|
|
|
2794
2872
|
var Trash = function Trash(_ref) {
|
|
2795
2873
|
var boxSize = _ref.boxSize;
|
|
2796
2874
|
return /*#__PURE__*/React__default.createElement(Memo$r, {
|
|
2797
|
-
|
|
2875
|
+
width: boxSize,
|
|
2876
|
+
height: boxSize
|
|
2798
2877
|
});
|
|
2799
2878
|
};
|
|
2800
2879
|
|
|
@@ -2824,7 +2903,8 @@ var Memo$s = /*#__PURE__*/React.memo(ForwardRef$s);
|
|
|
2824
2903
|
var Services = function Services(_ref) {
|
|
2825
2904
|
var boxSize = _ref.boxSize;
|
|
2826
2905
|
return /*#__PURE__*/React__default.createElement(Memo$s, {
|
|
2827
|
-
|
|
2906
|
+
width: boxSize,
|
|
2907
|
+
height: boxSize
|
|
2828
2908
|
});
|
|
2829
2909
|
};
|
|
2830
2910
|
|
|
@@ -2867,7 +2947,8 @@ var Memo$t = /*#__PURE__*/React.memo(ForwardRef$t);
|
|
|
2867
2947
|
var Question = function Question(_ref) {
|
|
2868
2948
|
var boxSize = _ref.boxSize;
|
|
2869
2949
|
return /*#__PURE__*/React__default.createElement(Memo$t, {
|
|
2870
|
-
|
|
2950
|
+
width: boxSize,
|
|
2951
|
+
height: boxSize
|
|
2871
2952
|
});
|
|
2872
2953
|
};
|
|
2873
2954
|
|
|
@@ -2897,7 +2978,8 @@ var Memo$u = /*#__PURE__*/React.memo(ForwardRef$u);
|
|
|
2897
2978
|
var Video = function Video(_ref) {
|
|
2898
2979
|
var boxSize = _ref.boxSize;
|
|
2899
2980
|
return /*#__PURE__*/React__default.createElement(Memo$u, {
|
|
2900
|
-
|
|
2981
|
+
width: boxSize,
|
|
2982
|
+
height: boxSize
|
|
2901
2983
|
});
|
|
2902
2984
|
};
|
|
2903
2985
|
|
|
@@ -2927,7 +3009,8 @@ var Memo$v = /*#__PURE__*/React.memo(ForwardRef$v);
|
|
|
2927
3009
|
var Page = function Page(_ref) {
|
|
2928
3010
|
var boxSize = _ref.boxSize;
|
|
2929
3011
|
return /*#__PURE__*/React__default.createElement(Memo$v, {
|
|
2930
|
-
|
|
3012
|
+
width: boxSize,
|
|
3013
|
+
height: boxSize
|
|
2931
3014
|
});
|
|
2932
3015
|
};
|
|
2933
3016
|
|
|
@@ -3024,7 +3107,8 @@ var Memo$x = /*#__PURE__*/React.memo(ForwardRef$x);
|
|
|
3024
3107
|
var Task = function Task(_ref) {
|
|
3025
3108
|
var boxSize = _ref.boxSize;
|
|
3026
3109
|
return /*#__PURE__*/React__default.createElement(Memo$x, {
|
|
3027
|
-
|
|
3110
|
+
width: boxSize,
|
|
3111
|
+
height: boxSize
|
|
3028
3112
|
});
|
|
3029
3113
|
};
|
|
3030
3114
|
|