@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.
Files changed (47) hide show
  1. package/README.md +8 -13
  2. package/dist/components/input/StackedMultiSelect/index.d.ts +1 -0
  3. package/dist/components/input/StackedSelect/index.d.ts +1 -0
  4. package/dist/components/input/components/dropdown/index.d.ts +2 -0
  5. package/dist/components/input/index.d.ts +2 -1
  6. package/dist/ui-core.cjs.development.js +197 -113
  7. package/dist/ui-core.cjs.development.js.map +1 -1
  8. package/dist/ui-core.cjs.production.min.js +1 -1
  9. package/dist/ui-core.cjs.production.min.js.map +1 -1
  10. package/dist/ui-core.esm.js +198 -114
  11. package/dist/ui-core.esm.js.map +1 -1
  12. package/package.json +6 -2
  13. package/src/components/icons/checkmark/index.tsx +1 -1
  14. package/src/components/icons/chevron/down/index.tsx +7 -1
  15. package/src/components/icons/chevron/right/index.tsx +1 -1
  16. package/src/components/icons/clock/index.tsx +1 -1
  17. package/src/components/icons/dropdown/index.tsx +5 -1
  18. package/src/components/icons/error/index.tsx +1 -1
  19. package/src/components/icons/file/fill/index.tsx +1 -1
  20. package/src/components/icons/file/outline/index.tsx +1 -1
  21. package/src/components/icons/folder/add/fill/index.tsx +1 -1
  22. package/src/components/icons/folder/add/outline/index.tsx +1 -1
  23. package/src/components/icons/folder/outline/index.tsx +1 -1
  24. package/src/components/icons/group/index.tsx +1 -1
  25. package/src/components/icons/home/index.tsx +1 -1
  26. package/src/components/icons/image/index.tsx +1 -1
  27. package/src/components/icons/link/index.tsx +1 -1
  28. package/src/components/icons/menu/index.tsx +1 -1
  29. package/src/components/icons/microsoft/index.tsx +1 -1
  30. package/src/components/icons/neutral/index.tsx +3 -1
  31. package/src/components/icons/page/index.tsx +1 -1
  32. package/src/components/icons/positive/index.tsx +1 -1
  33. package/src/components/icons/question/index.tsx +1 -1
  34. package/src/components/icons/search/index.tsx +1 -1
  35. package/src/components/icons/services/index.tsx +1 -1
  36. package/src/components/icons/settings/index.tsx +3 -1
  37. package/src/components/icons/table/fill/index.tsx +1 -1
  38. package/src/components/icons/table/outline/index.tsx +1 -1
  39. package/src/components/icons/task/index.tsx +1 -1
  40. package/src/components/icons/trash/index.tsx +1 -1
  41. package/src/components/icons/video/index.tsx +1 -1
  42. package/src/components/icons/warning/index.tsx +1 -1
  43. package/src/components/input/Input.stories.tsx +9 -0
  44. package/src/components/input/StackedMultiSelect/index.tsx +296 -277
  45. package/src/components/input/StackedSelect/index.tsx +46 -33
  46. package/src/components/input/components/dropdown/index.tsx +61 -12
  47. package/src/components/input/index.tsx +4 -0
@@ -1,7 +1,7 @@
1
1
  import React__default, { memo, forwardRef, createElement, useMemo, useCallback, Children, useEffect, useRef, useState } from 'react';
2
2
  import { Box, Button as Button$2, Alert as Alert$1, AlertDescription, Flex, Text as Text$2, Spinner, Checkbox as Checkbox$1, InputGroup, Input as Input$2, RadioGroup, Radio, InputRightElement, Textarea as Textarea$1, useOutsideClick, Switch as Switch$1, FormLabel as FormLabel$1, Popover as Popover$1, PopoverTrigger, PopoverContent, PopoverArrow, PopoverBody, FormControl, FormErrorMessage, FormHelperText, SimpleGrid, Image as Image$1, Select as Select$1, useMediaQuery, Grid, GridItem, IconButton, Collapse, Modal as Modal$2, ModalOverlay, ModalContent, ModalHeader, ModalBody, ModalFooter, Link as Link$2, Table as Table$1, Tbody, Tr, Td, TableContainer, Thead, Th, Tabs as Tabs$1, TabList, Tab, createMultiStyleConfigHelpers, defineStyle as defineStyle$1, extendTheme, useToast as useToast$1 } from '@chakra-ui/react';
3
3
  import { FormProvider, useWatch, Controller } from 'react-hook-form';
4
- import { debounce, truncate } from 'lodash-es';
4
+ import { truncate } from 'lodash-es';
5
5
  import { QuestionIcon, CloseIcon, HamburgerIcon } from '@chakra-ui/icons';
6
6
  import { Link as Link$3 } from 'react-router-dom';
7
7
  import { HiOutlineRefresh } from 'react-icons/hi';
@@ -87,7 +87,8 @@ var Memo = /*#__PURE__*/memo(ForwardRef);
87
87
  var Error$1 = function Error(_ref) {
88
88
  var boxSize = _ref.boxSize;
89
89
  return /*#__PURE__*/React__default.createElement(Memo, {
90
- boxSize: boxSize
90
+ width: boxSize,
91
+ height: boxSize
91
92
  });
92
93
  };
93
94
 
@@ -117,7 +118,8 @@ var Neutral = function Neutral(_ref) {
117
118
  var color = _ref.color,
118
119
  boxSize = _ref.boxSize;
119
120
  return /*#__PURE__*/React__default.createElement(Memo$1, {
120
- boxSize: boxSize,
121
+ width: boxSize,
122
+ height: boxSize,
121
123
  fill: color || '#3C3C43'
122
124
  });
123
125
  };
@@ -148,7 +150,8 @@ var Memo$2 = /*#__PURE__*/memo(ForwardRef$2);
148
150
  var Positive = function Positive(_ref) {
149
151
  var boxSize = _ref.boxSize;
150
152
  return /*#__PURE__*/React__default.createElement(Memo$2, {
151
- boxSize: boxSize
153
+ width: boxSize,
154
+ height: boxSize
152
155
  });
153
156
  };
154
157
 
@@ -178,7 +181,8 @@ var Memo$3 = /*#__PURE__*/memo(ForwardRef$3);
178
181
  var Warning = function Warning(_ref) {
179
182
  var boxSize = _ref.boxSize;
180
183
  return /*#__PURE__*/React__default.createElement(Memo$3, {
181
- boxSize: boxSize
184
+ width: boxSize,
185
+ height: boxSize
182
186
  });
183
187
  };
184
188
 
@@ -682,7 +686,8 @@ var Memo$5 = /*#__PURE__*/memo(ForwardRef$5);
682
686
  var Microsoft = function Microsoft(_ref) {
683
687
  var boxSize = _ref.boxSize;
684
688
  return /*#__PURE__*/React__default.createElement(Memo$5, {
685
- boxSize: boxSize
689
+ width: boxSize,
690
+ height: boxSize
686
691
  });
687
692
  };
688
693
 
@@ -867,8 +872,41 @@ var Dropdown = function Dropdown(_ref) {
867
872
  options = _ref.options,
868
873
  dropdownRef = _ref.dropdownRef,
869
874
  position = _ref.position,
870
- optionIndex = _ref.optionIndex;
875
+ optionIndex = _ref.optionIndex,
876
+ children = _ref.children,
877
+ _ref$loading = _ref.loading,
878
+ loading = _ref$loading === void 0 ? false : _ref$loading;
871
879
  var DropdownContent = useMemo(function () {
880
+ if (loading) {
881
+ return /*#__PURE__*/React__default.createElement(Box, {
882
+ borderRadius: "inherit",
883
+ fontSize: "13px",
884
+ px: "8px",
885
+ py: "4px",
886
+ width: "100%",
887
+ color: colors.label.primary.light,
888
+ bg: "inherit",
889
+ whiteSpace: "nowrap"
890
+ }, /*#__PURE__*/React__default.createElement(Flex, {
891
+ alignItems: "center"
892
+ }, "Loading", /*#__PURE__*/React__default.createElement(Spinner, {
893
+ size: "xs",
894
+ opacity: 0.5,
895
+ ml: 2
896
+ })));
897
+ }
898
+ if (!loading && (!options || options.length === 0)) {
899
+ return /*#__PURE__*/React__default.createElement(Box, {
900
+ borderRadius: "inherit",
901
+ fontSize: "13px",
902
+ px: "8px",
903
+ py: "4px",
904
+ width: "100%",
905
+ color: colors.label.primary.light,
906
+ bg: "inherit",
907
+ whiteSpace: "nowrap"
908
+ }, "No options");
909
+ }
872
910
  return options.map(function (option, idx) {
873
911
  return /*#__PURE__*/React__default.createElement(Box, {
874
912
  key: idx,
@@ -911,11 +949,7 @@ var Dropdown = function Dropdown(_ref) {
911
949
  }, option.label));
912
950
  });
913
951
  }, [onSelectItem, optionIndex, options]);
914
- if (!options) return null;
915
952
  return /*#__PURE__*/React__default.createElement(Flex, {
916
- flexDirection: "column",
917
- ref: dropdownRef,
918
- scrollMargin: "15px",
919
953
  bg: colors.fill.light.quaternary,
920
954
  backdropFilter: "auto",
921
955
  backdropBlur: "64px",
@@ -924,17 +958,29 @@ var Dropdown = function Dropdown(_ref) {
924
958
  borderColor: colors.fill.light.tertiary,
925
959
  mt: "3px",
926
960
  maxH: "240px",
927
- overflowY: "auto",
961
+ position: "absolute",
928
962
  px: "8px",
929
963
  py: "4px",
930
- position: "absolute",
964
+ overflow: "hidden",
965
+ minWidth: "100%",
966
+ zIndex: 100,
967
+ tabIndex: -2000,
968
+ alignItems: "flex-start",
969
+ flexDirection: "column",
931
970
  top: position === 'top' ? 26 : undefined,
932
- bottom: position === 'bottom' ? 30 : undefined,
971
+ bottom: position === 'bottom' ? 30 : undefined
972
+ }, children && /*#__PURE__*/React__default.createElement(Box, {
973
+ width: "100%",
974
+ mb: 2,
975
+ mt: 1
976
+ }, children), /*#__PURE__*/React__default.createElement(Flex, {
933
977
  width: "fit-content",
978
+ overflowY: "auto",
979
+ flexDirection: "column",
980
+ ref: dropdownRef,
934
981
  minWidth: "100%",
935
- zIndex: 100,
936
- tabIndex: -2000
937
- }, DropdownContent);
982
+ scrollMargin: "15px"
983
+ }, DropdownContent));
938
984
  };
939
985
 
940
986
  function useOnClickOutside(ref, handler) {
@@ -989,12 +1035,13 @@ var Dropdown$1 = function Dropdown(_ref) {
989
1035
  var boxSize = _ref.boxSize,
990
1036
  disabled = _ref.disabled;
991
1037
  return /*#__PURE__*/React__default.createElement(Memo$6, {
992
- boxSize: boxSize,
1038
+ width: boxSize,
1039
+ height: boxSize,
993
1040
  fill: disabled ? '#3C3C4399' : '#0082FF'
994
1041
  });
995
1042
  };
996
1043
 
997
- var _excluded$1 = ["isRequired", "options", "name", "setValue", "handleOnChange", "disabled", "value", "fullOptions"];
1044
+ var _excluded$1 = ["isRequired", "options", "name", "setValue", "handleOnChange", "disabled", "value", "fullOptions", "loadingOptions"];
998
1045
  /**
999
1046
  * A functional React component utilized to render the `StackedSelect` component.
1000
1047
  */
@@ -1008,6 +1055,7 @@ var StackedSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref
1008
1055
  disabled = _ref2.disabled,
1009
1056
  value = _ref2.value,
1010
1057
  fullOptions = _ref2.fullOptions,
1058
+ loadingOptions = _ref2.loadingOptions,
1011
1059
  props = _objectWithoutPropertiesLoose(_ref2, _excluded$1);
1012
1060
  var dropdownRef = useRef(null);
1013
1061
  var dropdownMenuRef = useRef(null);
@@ -1028,9 +1076,9 @@ var StackedSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref
1028
1076
  var _useState5 = useState(''),
1029
1077
  searchValue = _useState5[0],
1030
1078
  setSearchValue = _useState5[1];
1031
- var _useState6 = useState(''),
1032
- debouncedSearchValue = _useState6[0],
1033
- setDebouncedSearchValue = _useState6[1];
1079
+ var _useState6 = useState(options),
1080
+ filteredOptions = _useState6[0],
1081
+ setFilteredOptions = _useState6[1];
1034
1082
  var boundingClientRect = (_dropdownRef$current = dropdownRef.current) == null ? void 0 : _dropdownRef$current.getBoundingClientRect();
1035
1083
  useEffect(function () {
1036
1084
  var _dropdownRef$current2;
@@ -1046,9 +1094,10 @@ var StackedSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref
1046
1094
  setSelectedOption((_find$label = (_find = (fullOptions || options).find(function (option) {
1047
1095
  return option.value === value;
1048
1096
  })) == null ? void 0 : _find.label) != null ? _find$label : '');
1049
- }, [fullOptions, value]);
1097
+ }, [fullOptions, options, value]);
1050
1098
  useOnClickOutside(dropdownRef, function () {
1051
- return setIsFocussed(false);
1099
+ setIsFocussed(false);
1100
+ setSearchValue('');
1052
1101
  });
1053
1102
  var handleOnSelectItem = function handleOnSelectItem(option) {
1054
1103
  if (handleOnChange) {
@@ -1057,29 +1106,30 @@ var StackedSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref
1057
1106
  setValue(name, option.value);
1058
1107
  setSelectedOption(option.label);
1059
1108
  setIsFocussed(false);
1109
+ setSearchValue('');
1060
1110
  };
1061
1111
  var handleOnKeyDown = function handleOnKeyDown(e) {
1062
- var initialOptionIndex = options[0].value === 'section_header' ? 1 : 0;
1112
+ var initialOptionIndex = filteredOptions.length && filteredOptions[0].value === 'section_header' ? 1 : 0;
1063
1113
  if (!isFocussed && (e.key === 'Enter' || e.key === 'ArrowUp' || e.key === 'ArrowDown')) {
1064
1114
  setIsFocussed(true);
1065
1115
  return setOptionIndex(initialOptionIndex);
1066
1116
  }
1067
- if (isFocussed) {
1117
+ if (isFocussed && filteredOptions.length > 0) {
1068
1118
  if (optionIndex === null && (e.key === 'Enter' || e.key === 'ArrowUp' || e.key === 'ArrowDown')) {
1069
1119
  return setOptionIndex(initialOptionIndex);
1070
1120
  }
1071
1121
  if (e.key === 'ArrowUp' && optionIndex !== null && optionIndex > 0) {
1072
1122
  var _dropdownMenuRef$curr;
1073
- var incrementValue = options[optionIndex - 1] && options[optionIndex - 1].value === 'section_header' ? 2 : 1;
1123
+ var incrementValue = filteredOptions[optionIndex - 1] && filteredOptions[optionIndex - 1].value === 'section_header' ? 2 : 1;
1074
1124
  setOptionIndex(optionIndex - incrementValue);
1075
1125
  return (_dropdownMenuRef$curr = dropdownMenuRef.current) == null ? void 0 : _dropdownMenuRef$curr.scrollTo({
1076
1126
  top: optionIndex * 24,
1077
1127
  behavior: 'smooth'
1078
1128
  });
1079
1129
  }
1080
- if (e.key === 'ArrowDown' && optionIndex !== null && optionIndex < options.length) {
1130
+ if (e.key === 'ArrowDown' && optionIndex !== null && optionIndex < filteredOptions.length) {
1081
1131
  var _dropdownMenuRef$curr2;
1082
- var _incrementValue = options[optionIndex + 1] && options[optionIndex + 1].value === 'section_header' ? 2 : 1;
1132
+ var _incrementValue = filteredOptions[optionIndex + 1] && filteredOptions[optionIndex + 1].value === 'section_header' ? 2 : 1;
1083
1133
  setOptionIndex(optionIndex + _incrementValue);
1084
1134
  return (_dropdownMenuRef$curr2 = dropdownMenuRef.current) == null ? void 0 : _dropdownMenuRef$curr2.scrollTo({
1085
1135
  top: optionIndex * 24,
@@ -1087,7 +1137,7 @@ var StackedSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref
1087
1137
  });
1088
1138
  }
1089
1139
  if (e.key === 'Enter' && optionIndex !== null) {
1090
- var option = options.find(function (_, idx) {
1140
+ var option = filteredOptions.find(function (_, idx) {
1091
1141
  return optionIndex === idx;
1092
1142
  });
1093
1143
  if (!option) return;
@@ -1116,18 +1166,19 @@ var StackedSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref
1116
1166
  top: idx * 24,
1117
1167
  behavior: 'smooth'
1118
1168
  });
1119
- setSearchValue('');
1120
- setDebouncedSearchValue('');
1121
1169
  }
1122
1170
  }, [options, searchValue]);
1123
- var updateSearchValue = useMemo(function () {
1124
- return debounce(function (val) {
1125
- setSearchValue(val);
1126
- }, 1000);
1127
- }, []);
1128
- var update = function update(value) {
1129
- updateSearchValue(value);
1130
- setDebouncedSearchValue(value);
1171
+ useEffect(function () {
1172
+ setFilteredOptions(options.filter(function (element) {
1173
+ return element.label.toLowerCase().includes(searchValue.toLowerCase());
1174
+ }));
1175
+ }, [options, searchValue]);
1176
+ var handleInput = function handleInput(e) {
1177
+ var _filteredOptions$;
1178
+ var initialOptionIndex = filteredOptions.length && ((_filteredOptions$ = filteredOptions[0]) == null ? void 0 : _filteredOptions$.value) === 'section_header' ? 1 : 0;
1179
+ setOptionIndex(initialOptionIndex);
1180
+ var value = e.target.value;
1181
+ setSearchValue(value);
1131
1182
  };
1132
1183
  return /*#__PURE__*/React__default.createElement(Box, {
1133
1184
  ref: dropdownRef,
@@ -1139,16 +1190,12 @@ var StackedSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref
1139
1190
  onClick: function onClick() {
1140
1191
  return setIsFocussed(!isFocussed);
1141
1192
  },
1142
- cursor: "pointer",
1143
- color: "transparent",
1193
+ cursor: isFocussed ? 'default' : 'pointer',
1194
+ color: loadingOptions ? 'transparent' : 'inital',
1144
1195
  fontSize: "13px",
1145
- textShadow: "0 0 0 " + colors.label.primary.light,
1146
- value: selectedOption,
1147
- disabled: disabled,
1196
+ value: isFocussed ? searchValue : selectedOption,
1148
1197
  autoComplete: "off",
1149
- onChange: function onChange(e) {
1150
- return update(debouncedSearchValue.concat(e.target.value));
1151
- },
1198
+ onChange: handleInput,
1152
1199
  onKeyDown: handleOnKeyDown
1153
1200
  })), /*#__PURE__*/React__default.createElement(InputRightElement, {
1154
1201
  cursor: disabled ? 'not-allowed' : 'pointer',
@@ -1156,14 +1203,15 @@ var StackedSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref
1156
1203
  return !disabled && setIsFocussed(!isFocussed);
1157
1204
  }
1158
1205
  }, /*#__PURE__*/React__default.createElement(Dropdown$1, {
1159
- boxSize: "16px",
1206
+ boxSize: "12px",
1160
1207
  disabled: disabled
1161
1208
  }))), isFocussed && /*#__PURE__*/React__default.createElement(Dropdown, {
1162
1209
  position: position,
1163
1210
  dropdownRef: dropdownMenuRef,
1164
1211
  onSelectItem: handleOnSelectItem,
1165
- options: options,
1166
- optionIndex: optionIndex
1212
+ options: filteredOptions,
1213
+ optionIndex: optionIndex,
1214
+ loading: loadingOptions
1167
1215
  }));
1168
1216
  });
1169
1217
 
@@ -1281,7 +1329,8 @@ var StackedMultiSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2,
1281
1329
  control = _ref2.control,
1282
1330
  name = _ref2.name,
1283
1331
  placeholder = _ref2.placeholder,
1284
- disabled = _ref2.disabled;
1332
+ disabled = _ref2.disabled,
1333
+ loadingOptions = _ref2.loadingOptions;
1285
1334
  var watchedValue = useWatch({
1286
1335
  control: control,
1287
1336
  name: name
@@ -1299,24 +1348,25 @@ var StackedMultiSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2,
1299
1348
  var _useState3 = useState(options),
1300
1349
  localOptions = _useState3[0],
1301
1350
  setLocalOptions = _useState3[1];
1302
- var _useState4 = useState(false),
1303
- isFocussed = _useState4[0],
1304
- setIsFocussed = _useState4[1];
1351
+ var _useState4 = useState(localOptions),
1352
+ filteredOptions = _useState4[0],
1353
+ setFilteredOptions = _useState4[1];
1305
1354
  var _useState5 = useState(false),
1306
- shouldSideScroll = _useState5[0],
1307
- setShouldSideScroll = _useState5[1];
1308
- var _useState6 = useState(null),
1309
- optionIndex = _useState6[0],
1310
- setOptionIndex = _useState6[1];
1311
- var _useState7 = useState('top'),
1312
- position = _useState7[0],
1313
- setPosition = _useState7[1];
1314
- var _useState8 = useState(''),
1315
- searchValue = _useState8[0],
1316
- setSearchValue = _useState8[1];
1355
+ isFocussed = _useState5[0],
1356
+ setIsFocussed = _useState5[1];
1357
+ var _useState6 = useState(false),
1358
+ shouldSideScroll = _useState6[0],
1359
+ setShouldSideScroll = _useState6[1];
1360
+ var _useState7 = useState(null),
1361
+ optionIndex = _useState7[0],
1362
+ setOptionIndex = _useState7[1];
1363
+ var _useState8 = useState('top'),
1364
+ position = _useState8[0],
1365
+ setPosition = _useState8[1];
1317
1366
  var _useState9 = useState(''),
1318
- debouncedSearchValue = _useState9[0],
1319
- setDebouncedSearchValue = _useState9[1];
1367
+ searchValue = _useState9[0],
1368
+ setSearchValue = _useState9[1];
1369
+ // const [debouncedSearchValue, setDebouncedSearchValue] = useState('');
1320
1370
  var boundingClientRect = (_dropdownRef$current = dropdownRef.current) == null ? void 0 : _dropdownRef$current.getBoundingClientRect();
1321
1371
  useEffect(function () {
1322
1372
  if (window.innerHeight - ((boundingClientRect == null ? void 0 : boundingClientRect.y) + 240) >= 0) {
@@ -1380,6 +1430,8 @@ var StackedMultiSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2,
1380
1430
  setLocalValues(function (prevLocalValues) {
1381
1431
  return [].concat(prevLocalValues, [option]);
1382
1432
  });
1433
+ // reset search on value select
1434
+ setSearchValue('');
1383
1435
  };
1384
1436
  var handleDelete = function handleDelete(option) {
1385
1437
  var newValue = localValues.filter(function (localValue) {
@@ -1415,16 +1467,16 @@ var StackedMultiSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2,
1415
1467
  }
1416
1468
  if (e.key === 'ArrowUp' && optionIndex !== null && optionIndex > 0) {
1417
1469
  var _dropdownMenuRef$curr;
1418
- var incrementValue = localOptions[optionIndex - 1] && localOptions[optionIndex - 1].value === 'section_header' ? 2 : 1;
1470
+ var incrementValue = filteredOptions[optionIndex - 1] && filteredOptions[optionIndex - 1].value === 'section_header' ? 2 : 1;
1419
1471
  setOptionIndex(optionIndex - incrementValue);
1420
1472
  return (_dropdownMenuRef$curr = dropdownMenuRef.current) == null ? void 0 : _dropdownMenuRef$curr.scrollTo({
1421
1473
  top: optionIndex * 24,
1422
1474
  behavior: 'smooth'
1423
1475
  });
1424
1476
  }
1425
- if (e.key === 'ArrowDown' && optionIndex !== null && optionIndex < localOptions.length) {
1477
+ if (e.key === 'ArrowDown' && optionIndex !== null && optionIndex < filteredOptions.length) {
1426
1478
  var _dropdownMenuRef$curr2;
1427
- var _incrementValue = localOptions[optionIndex + 1] && localOptions[optionIndex + 1].value === 'section_header' ? 2 : 1;
1479
+ var _incrementValue = filteredOptions[optionIndex + 1] && filteredOptions[optionIndex + 1].value === 'section_header' ? 2 : 1;
1428
1480
  setOptionIndex(optionIndex + _incrementValue);
1429
1481
  return (_dropdownMenuRef$curr2 = dropdownMenuRef.current) == null ? void 0 : _dropdownMenuRef$curr2.scrollTo({
1430
1482
  top: optionIndex * 24,
@@ -1432,7 +1484,7 @@ var StackedMultiSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2,
1432
1484
  });
1433
1485
  }
1434
1486
  if (e.key === 'Enter' && optionIndex !== null) {
1435
- var option = localOptions.find(function (_, idx) {
1487
+ var option = filteredOptions.find(function (_, idx) {
1436
1488
  return optionIndex === idx;
1437
1489
  });
1438
1490
  if (!option) return;
@@ -1442,7 +1494,6 @@ var StackedMultiSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2,
1442
1494
  if (e.key === 'Tab') {
1443
1495
  return setIsFocussed(false);
1444
1496
  }
1445
- return update(debouncedSearchValue.concat(e.key));
1446
1497
  }
1447
1498
  };
1448
1499
  useEffect(function () {
@@ -1452,21 +1503,22 @@ var StackedMultiSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2,
1452
1503
  return option.label.substring(0, searchValue.length).toLowerCase() === searchValue.toLowerCase();
1453
1504
  });
1454
1505
  (_dropdownMenuRef$curr3 = dropdownMenuRef.current) == null ? void 0 : _dropdownMenuRef$curr3.scrollTo({
1455
- top: idx * 24,
1506
+ top: idx * 27,
1456
1507
  behavior: 'smooth'
1457
1508
  });
1458
- setSearchValue('');
1459
- setDebouncedSearchValue('');
1460
1509
  }
1461
1510
  }, [options, searchValue]);
1462
- var updateSearchValue = useMemo(function () {
1463
- return debounce(function (val) {
1464
- setSearchValue(val);
1465
- }, 1000);
1466
- }, []);
1467
- var update = function update(value) {
1468
- updateSearchValue(value);
1469
- setDebouncedSearchValue(value);
1511
+ useEffect(function () {
1512
+ setFilteredOptions(localOptions.filter(function (element) {
1513
+ return element.label.toLowerCase().includes(searchValue.toLowerCase());
1514
+ }));
1515
+ }, [localOptions, searchValue]);
1516
+ var handleInput = function handleInput(e) {
1517
+ var _filteredOptions$;
1518
+ var initialOptionIndex = ((_filteredOptions$ = filteredOptions[0]) == null ? void 0 : _filteredOptions$.value) === 'section_header' ? 1 : 0;
1519
+ setOptionIndex(initialOptionIndex);
1520
+ var value = e.target.value;
1521
+ setSearchValue(value);
1470
1522
  };
1471
1523
  return /*#__PURE__*/React__default.createElement(Box, {
1472
1524
  ref: dropdownRef,
@@ -1542,17 +1594,22 @@ var StackedMultiSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2,
1542
1594
  justifyContent: "center",
1543
1595
  alignItems: "center"
1544
1596
  }, /*#__PURE__*/React__default.createElement(Dropdown$1, {
1545
- boxSize: "16px",
1597
+ boxSize: "12px",
1546
1598
  disabled: disabled
1547
1599
  }))), isFocussed && /*#__PURE__*/React__default.createElement(Dropdown, {
1548
1600
  dropdownRef: dropdownMenuRef,
1549
1601
  onSelectItem: function onSelectItem(option) {
1550
1602
  return handleChange(option);
1551
1603
  },
1552
- options: localOptions,
1604
+ options: filteredOptions,
1553
1605
  position: position,
1554
- optionIndex: optionIndex
1555
- }));
1606
+ optionIndex: optionIndex,
1607
+ loading: loadingOptions
1608
+ }, /*#__PURE__*/React__default.createElement(Input$2, {
1609
+ value: searchValue,
1610
+ onChange: handleInput,
1611
+ disabled: loadingOptions
1612
+ })));
1556
1613
  });
1557
1614
 
1558
1615
  /**
@@ -1894,7 +1951,9 @@ function Input(_ref) {
1894
1951
  setValue = _ref.setValue,
1895
1952
  setError = _ref.setError,
1896
1953
  clearErrors = _ref.clearErrors,
1897
- separators = _ref.separators;
1954
+ separators = _ref.separators,
1955
+ _ref$loadingOptions = _ref.loadingOptions,
1956
+ loadingOptions = _ref$loadingOptions === void 0 ? false : _ref$loadingOptions;
1898
1957
  function selectedInputField(onChange, onBlur, ref, value) {
1899
1958
  switch (inputType) {
1900
1959
  case 'text':
@@ -1949,7 +2008,8 @@ function Input(_ref) {
1949
2008
  value: value,
1950
2009
  defaultValue: defaultValue,
1951
2010
  placeholder: placeholder,
1952
- fullOptions: fullOptions
2011
+ fullOptions: fullOptions,
2012
+ loadingOptions: loadingOptions
1953
2013
  });
1954
2014
  case 'textarea':
1955
2015
  return /*#__PURE__*/React__default.createElement(StackedTextarea, {
@@ -2000,7 +2060,8 @@ function Input(_ref) {
2000
2060
  control: control,
2001
2061
  setError: setError,
2002
2062
  clearErrors: clearErrors,
2003
- placeholder: placeholder
2063
+ placeholder: placeholder,
2064
+ loadingOptions: loadingOptions
2004
2065
  });
2005
2066
  case 'pilled-text':
2006
2067
  return /*#__PURE__*/React__default.createElement(StackedPilledInput, {
@@ -2148,7 +2209,8 @@ var Memo$8 = /*#__PURE__*/memo(ForwardRef$8);
2148
2209
  var Checkmark = function Checkmark(_ref) {
2149
2210
  var boxSize = _ref.boxSize;
2150
2211
  return /*#__PURE__*/React__default.createElement(Memo$8, {
2151
- boxSize: boxSize
2212
+ width: boxSize,
2213
+ height: boxSize
2152
2214
  });
2153
2215
  };
2154
2216
 
@@ -2178,7 +2240,8 @@ var Memo$9 = /*#__PURE__*/memo(ForwardRef$9);
2178
2240
  var ChevronDown = function ChevronDown(_ref) {
2179
2241
  var boxSize = _ref.boxSize;
2180
2242
  return /*#__PURE__*/React__default.createElement(Memo$9, {
2181
- boxSize: boxSize,
2243
+ width: boxSize,
2244
+ height: boxSize,
2182
2245
  fill: colors.fill.action
2183
2246
  });
2184
2247
  };
@@ -2209,7 +2272,8 @@ var Memo$a = /*#__PURE__*/memo(ForwardRef$a);
2209
2272
  var ChevronRight = function ChevronRight(_ref) {
2210
2273
  var boxSize = _ref.boxSize;
2211
2274
  return /*#__PURE__*/React__default.createElement(Memo$a, {
2212
- boxSize: boxSize
2275
+ width: boxSize,
2276
+ height: boxSize
2213
2277
  });
2214
2278
  };
2215
2279
 
@@ -2239,7 +2303,8 @@ var Memo$b = /*#__PURE__*/memo(ForwardRef$b);
2239
2303
  var Clock = function Clock(_ref) {
2240
2304
  var boxSize = _ref.boxSize;
2241
2305
  return /*#__PURE__*/React__default.createElement(Memo$b, {
2242
- boxSize: boxSize
2306
+ width: boxSize,
2307
+ height: boxSize
2243
2308
  });
2244
2309
  };
2245
2310
 
@@ -2270,7 +2335,8 @@ var Memo$c = /*#__PURE__*/memo(ForwardRef$c);
2270
2335
  var FileFill = function FileFill(_ref) {
2271
2336
  var boxSize = _ref.boxSize;
2272
2337
  return /*#__PURE__*/React__default.createElement(Memo$c, {
2273
- boxSize: boxSize
2338
+ width: boxSize,
2339
+ height: boxSize
2274
2340
  });
2275
2341
  };
2276
2342
 
@@ -2300,7 +2366,8 @@ var Memo$d = /*#__PURE__*/memo(ForwardRef$d);
2300
2366
  var FileOutline = function FileOutline(_ref) {
2301
2367
  var boxSize = _ref.boxSize;
2302
2368
  return /*#__PURE__*/React__default.createElement(Memo$d, {
2303
- boxSize: boxSize
2369
+ width: boxSize,
2370
+ height: boxSize
2304
2371
  });
2305
2372
  };
2306
2373
 
@@ -2427,7 +2494,8 @@ var Memo$g = /*#__PURE__*/memo(ForwardRef$g);
2427
2494
  var FolderOutline = function FolderOutline(_ref) {
2428
2495
  var boxSize = _ref.boxSize;
2429
2496
  return /*#__PURE__*/React__default.createElement(Memo$g, {
2430
- boxSize: boxSize
2497
+ width: boxSize,
2498
+ height: boxSize
2431
2499
  });
2432
2500
  };
2433
2501
 
@@ -2457,7 +2525,8 @@ var Memo$h = /*#__PURE__*/memo(ForwardRef$h);
2457
2525
  var FolderAddFill = function FolderAddFill(_ref) {
2458
2526
  var boxSize = _ref.boxSize;
2459
2527
  return /*#__PURE__*/React__default.createElement(Memo$h, {
2460
- boxSize: boxSize
2528
+ width: boxSize,
2529
+ height: boxSize
2461
2530
  });
2462
2531
  };
2463
2532
 
@@ -2487,7 +2556,8 @@ var Memo$i = /*#__PURE__*/memo(ForwardRef$i);
2487
2556
  var FolderAddOutline = function FolderAddOutline(_ref) {
2488
2557
  var boxSize = _ref.boxSize;
2489
2558
  return /*#__PURE__*/React__default.createElement(Memo$i, {
2490
- boxSize: boxSize
2559
+ width: boxSize,
2560
+ height: boxSize
2491
2561
  });
2492
2562
  };
2493
2563
 
@@ -2530,7 +2600,8 @@ var Memo$j = /*#__PURE__*/memo(ForwardRef$j);
2530
2600
  var Group = function Group(_ref) {
2531
2601
  var boxSize = _ref.boxSize;
2532
2602
  return /*#__PURE__*/React__default.createElement(Memo$j, {
2533
- boxSize: boxSize
2603
+ width: boxSize,
2604
+ height: boxSize
2534
2605
  });
2535
2606
  };
2536
2607
 
@@ -2560,7 +2631,8 @@ var Memo$k = /*#__PURE__*/memo(ForwardRef$k);
2560
2631
  var Home = function Home(_ref) {
2561
2632
  var boxSize = _ref.boxSize;
2562
2633
  return /*#__PURE__*/React__default.createElement(Memo$k, {
2563
- boxSize: boxSize
2634
+ width: boxSize,
2635
+ height: boxSize
2564
2636
  });
2565
2637
  };
2566
2638
 
@@ -2590,7 +2662,8 @@ var Memo$l = /*#__PURE__*/memo(ForwardRef$l);
2590
2662
  var Image = function Image(_ref) {
2591
2663
  var boxSize = _ref.boxSize;
2592
2664
  return /*#__PURE__*/React__default.createElement(Memo$l, {
2593
- boxSize: boxSize
2665
+ width: boxSize,
2666
+ height: boxSize
2594
2667
  });
2595
2668
  };
2596
2669
 
@@ -2620,7 +2693,8 @@ var Memo$m = /*#__PURE__*/memo(ForwardRef$m);
2620
2693
  var Menu = function Menu(_ref) {
2621
2694
  var boxSize = _ref.boxSize;
2622
2695
  return /*#__PURE__*/React__default.createElement(Memo$m, {
2623
- boxSize: boxSize
2696
+ width: boxSize,
2697
+ height: boxSize
2624
2698
  });
2625
2699
  };
2626
2700
 
@@ -2663,7 +2737,8 @@ var Memo$n = /*#__PURE__*/memo(ForwardRef$n);
2663
2737
  var Search = function Search(_ref) {
2664
2738
  var boxSize = _ref.boxSize;
2665
2739
  return /*#__PURE__*/React__default.createElement(Memo$n, {
2666
- boxSize: boxSize
2740
+ width: boxSize,
2741
+ height: boxSize
2667
2742
  });
2668
2743
  };
2669
2744
 
@@ -2696,7 +2771,8 @@ var Memo$o = /*#__PURE__*/memo(ForwardRef$o);
2696
2771
  var Settings = function Settings(_ref) {
2697
2772
  var boxSize = _ref.boxSize;
2698
2773
  return /*#__PURE__*/React__default.createElement(Memo$o, {
2699
- boxSize: boxSize,
2774
+ width: boxSize,
2775
+ height: boxSize,
2700
2776
  fill: colors.fill.action
2701
2777
  });
2702
2778
  };
@@ -2727,7 +2803,8 @@ var Memo$p = /*#__PURE__*/memo(ForwardRef$p);
2727
2803
  var TableFill = function TableFill(_ref) {
2728
2804
  var boxSize = _ref.boxSize;
2729
2805
  return /*#__PURE__*/React__default.createElement(Memo$p, {
2730
- boxSize: boxSize
2806
+ width: boxSize,
2807
+ height: boxSize
2731
2808
  });
2732
2809
  };
2733
2810
 
@@ -2757,7 +2834,8 @@ var Memo$q = /*#__PURE__*/memo(ForwardRef$q);
2757
2834
  var TableOutline = function TableOutline(_ref) {
2758
2835
  var boxSize = _ref.boxSize;
2759
2836
  return /*#__PURE__*/React__default.createElement(Memo$q, {
2760
- boxSize: boxSize
2837
+ width: boxSize,
2838
+ height: boxSize
2761
2839
  });
2762
2840
  };
2763
2841
 
@@ -2787,7 +2865,8 @@ var Memo$r = /*#__PURE__*/memo(ForwardRef$r);
2787
2865
  var Trash = function Trash(_ref) {
2788
2866
  var boxSize = _ref.boxSize;
2789
2867
  return /*#__PURE__*/React__default.createElement(Memo$r, {
2790
- boxSize: boxSize
2868
+ width: boxSize,
2869
+ height: boxSize
2791
2870
  });
2792
2871
  };
2793
2872
 
@@ -2817,7 +2896,8 @@ var Memo$s = /*#__PURE__*/memo(ForwardRef$s);
2817
2896
  var Services = function Services(_ref) {
2818
2897
  var boxSize = _ref.boxSize;
2819
2898
  return /*#__PURE__*/React__default.createElement(Memo$s, {
2820
- boxSize: boxSize
2899
+ width: boxSize,
2900
+ height: boxSize
2821
2901
  });
2822
2902
  };
2823
2903
 
@@ -2860,7 +2940,8 @@ var Memo$t = /*#__PURE__*/memo(ForwardRef$t);
2860
2940
  var Question = function Question(_ref) {
2861
2941
  var boxSize = _ref.boxSize;
2862
2942
  return /*#__PURE__*/React__default.createElement(Memo$t, {
2863
- boxSize: boxSize
2943
+ width: boxSize,
2944
+ height: boxSize
2864
2945
  });
2865
2946
  };
2866
2947
 
@@ -2890,7 +2971,8 @@ var Memo$u = /*#__PURE__*/memo(ForwardRef$u);
2890
2971
  var Video = function Video(_ref) {
2891
2972
  var boxSize = _ref.boxSize;
2892
2973
  return /*#__PURE__*/React__default.createElement(Memo$u, {
2893
- boxSize: boxSize
2974
+ width: boxSize,
2975
+ height: boxSize
2894
2976
  });
2895
2977
  };
2896
2978
 
@@ -2920,7 +3002,8 @@ var Memo$v = /*#__PURE__*/memo(ForwardRef$v);
2920
3002
  var Page = function Page(_ref) {
2921
3003
  var boxSize = _ref.boxSize;
2922
3004
  return /*#__PURE__*/React__default.createElement(Memo$v, {
2923
- boxSize: boxSize
3005
+ width: boxSize,
3006
+ height: boxSize
2924
3007
  });
2925
3008
  };
2926
3009
 
@@ -3017,7 +3100,8 @@ var Memo$x = /*#__PURE__*/memo(ForwardRef$x);
3017
3100
  var Task = function Task(_ref) {
3018
3101
  var boxSize = _ref.boxSize;
3019
3102
  return /*#__PURE__*/React__default.createElement(Memo$x, {
3020
- boxSize: boxSize
3103
+ width: boxSize,
3104
+ height: boxSize
3021
3105
  });
3022
3106
  };
3023
3107