@bitrise/bitkit 13.266.0 → 13.267.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.266.0",
4
+ "version": "13.267.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+ssh://git@github.com/bitrise-io/bitkit.git"
@@ -2,6 +2,8 @@ import { DateTime } from 'luxon';
2
2
  import { DateRange } from '../DatePicker/useDateRange';
3
3
  import { FilterContextType, FilterData, FilterOptions, FilterState } from './Filter.types';
4
4
 
5
+ const branches = [...new Array(25000)].map((_, i) => `branch ${i}`);
6
+
5
7
  export const FILTER_STORY_OPTIONS: FilterOptions =
6
8
  'Lorem ipsum dolor sit amet consectetur adipisicing elit Reiciendis reprehenderit laudantium laborum excepturi nam quae quod sunt expedita vel repellat cum cupiditate esse similique est ducimus provident eos numquam voluptas'.split(
7
9
  ' ',
@@ -43,7 +45,7 @@ export const FILTER_STORY_DATA: FilterData = {
43
45
  categoryNamePlural: 'Branches',
44
46
  isMultiple: true,
45
47
  isPatternEnabled: true,
46
- options: ['default 1', 'default 2', 'default 3', 'default 13'],
48
+ options: branches,
47
49
  type: 'tag',
48
50
  },
49
51
  cache_type: {
@@ -23,6 +23,8 @@ import { isEqual, useDebounce } from '../../../utils/utils';
23
23
  import { getOptionLabel } from '../Filter.utils';
24
24
  import { useFilterContext } from '../Filter.context';
25
25
 
26
+ const MAX_ITEMS = 100;
27
+
26
28
  /**
27
29
  * https://gist.github.com/donmccurdy/6d073ce2c6f3951312dfa45da14a420f
28
30
  * RegExp-escapes all characters in the given string.
@@ -242,13 +244,19 @@ const FilterForm = (props: FilterFormProps) => {
242
244
  {!isLoading && isMultiple && (
243
245
  <CheckboxGroup onChange={setSelected} sx={filterStyle.formInputGroup} value={selected}>
244
246
  {items.length
245
- ? items.map((opt) => (
247
+ ? items.slice(0, MAX_ITEMS).map((opt) => (
246
248
  <Checkbox key={opt} value={opt}>
247
249
  {iconsMap && iconsMap[opt] && <Icon name={iconsMap[opt]} />}
248
250
  {getOptionLabel(opt, currentOptionMap)}
249
251
  </Checkbox>
250
252
  ))
251
253
  : getEmptyText()}
254
+ {items.length > MAX_ITEMS && (
255
+ <Text textStyle="body/md/regular">
256
+ We show only {MAX_ITEMS} items, use the search
257
+ <br /> to find more.
258
+ </Text>
259
+ )}
252
260
  </CheckboxGroup>
253
261
  )}
254
262
  {!isLoading && !isMultiple && (
@@ -261,7 +269,7 @@ const FilterForm = (props: FilterFormProps) => {
261
269
  </Radio>
262
270
  )}
263
271
  {items.length
264
- ? items.map((opt) => {
272
+ ? items.slice(0, MAX_ITEMS).map((opt) => {
265
273
  const hasIcon = iconsMap && iconsMap[opt];
266
274
  const label = getOptionLabel(opt, currentOptionMap);
267
275
  return (
@@ -278,6 +286,12 @@ const FilterForm = (props: FilterFormProps) => {
278
286
  );
279
287
  })
280
288
  : getEmptyText()}
289
+ {items.length > MAX_ITEMS && (
290
+ <Text textStyle="body/md/regular">
291
+ We show only {MAX_ITEMS} items, use the search
292
+ <br /> to find more.
293
+ </Text>
294
+ )}
281
295
  </RadioGroup>
282
296
  )}
283
297
  </>