@bitrise/bitkit 13.265.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
|
@@ -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:
|
|
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
|
</>
|
|
@@ -25,6 +25,7 @@ export interface TagsInputProps extends UsedFormControlProps {
|
|
|
25
25
|
separator?: RegExp;
|
|
26
26
|
maxCount?: number;
|
|
27
27
|
invalidValues?: string[];
|
|
28
|
+
isInvalidItem?: (item: string) => boolean;
|
|
28
29
|
errorText?: ReactNode;
|
|
29
30
|
helperText?: ReactNode;
|
|
30
31
|
isReadOnly?: boolean;
|
|
@@ -39,6 +40,7 @@ const TagsInput = ({
|
|
|
39
40
|
infoTooltipLabel,
|
|
40
41
|
infoTooltipProps,
|
|
41
42
|
invalidValues = [],
|
|
43
|
+
isInvalidItem = (item: string) => invalidValues.includes(item),
|
|
42
44
|
isReadOnly,
|
|
43
45
|
label,
|
|
44
46
|
maxCount,
|
|
@@ -114,7 +116,7 @@ const TagsInput = ({
|
|
|
114
116
|
{value.map((item, idx) => (
|
|
115
117
|
<Tag
|
|
116
118
|
key={item}
|
|
117
|
-
colorScheme={
|
|
119
|
+
colorScheme={isInvalidItem(item) || (maxCount && idx > maxCount - 1) ? 'red' : undefined}
|
|
118
120
|
onClose={isReadOnly ? undefined : () => removeItem(item)}
|
|
119
121
|
size="sm"
|
|
120
122
|
>
|