@bitrise/bitkit 13.200.0 → 13.201.0

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bitrise/bitkit",
3
3
  "description": "Bitrise React component library",
4
- "version": "13.200.0",
4
+ "version": "13.201.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+ssh://git@github.com/bitrise-io/bitkit.git"
@@ -22,6 +22,7 @@ export type FilterCategoryProps = {
22
22
  iconsMap?: FilterIconsMap;
23
23
  hasNotFilteredOption?: boolean;
24
24
  preserveOptionOrder?: boolean;
25
+ isInitialLoading?: boolean;
25
26
  isMultiple?: boolean;
26
27
  onAsyncSearch?: FilterSearchCallback;
27
28
  options?: FilterOptions;
@@ -35,6 +35,7 @@ const FilterForm = (props: FilterFormProps) => {
35
35
  iconsMap,
36
36
  hasNotFilteredOption = true,
37
37
  preserveOptionOrder,
38
+ isInitialLoading,
38
39
  isMultiple,
39
40
  onAsyncSearch,
40
41
  options,
@@ -47,7 +48,7 @@ const FilterForm = (props: FilterFormProps) => {
47
48
  const [searchValue, setSearchValue] = useState<string>('');
48
49
  const debouncedSearchValue = useDebounce<string>(searchValue, 1000);
49
50
 
50
- const [isLoading, setLoading] = useState(false);
51
+ const [isLoading, setLoading] = useState(Boolean(isInitialLoading));
51
52
  const [foundOptions, setFoundOptions] = useState<FilterOptions>([]);
52
53
 
53
54
  const isAsync = !!onAsyncSearch;
@@ -63,7 +64,7 @@ const FilterForm = (props: FilterFormProps) => {
63
64
  });
64
65
  }
65
66
  return [];
66
- }, [searchValue]);
67
+ }, [searchValue, options]);
67
68
 
68
69
  const onSearchChange = (q: string) => {
69
70
  setSearchValue(q);
@@ -107,11 +108,15 @@ const FilterForm = (props: FilterFormProps) => {
107
108
  }
108
109
  };
109
110
 
111
+ useEffect(() => {
112
+ setLoading(Boolean(isInitialLoading));
113
+ }, [isInitialLoading]);
114
+
110
115
  useEffect(() => {
111
116
  if (debouncedSearchValue.length > 0) {
112
117
  getAsyncList();
113
118
  } else {
114
- setLoading(false);
119
+ setLoading(Boolean(isInitialLoading));
115
120
  }
116
121
  }, [debouncedSearchValue]);
117
122
 
@@ -137,6 +142,7 @@ const FilterForm = (props: FilterFormProps) => {
137
142
  </Box>
138
143
  {(withSearch || isAsync) && (
139
144
  <SearchInput
145
+ isDisabled={isInitialLoading}
140
146
  onChange={onSearchChange}
141
147
  placeholder={isAsync ? 'Start typing to search options' : 'Start typing to find options'}
142
148
  sx={filterStyle.formSearch}