@bitrise/bitkit 13.195.0 → 13.196.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.195.0",
4
+ "version": "13.196.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+ssh://git@github.com/bitrise-io/bitkit.git"
@@ -12,29 +12,30 @@ export const FILTER_STORY_DATA: FilterData = {
12
12
  categoryName: 'App',
13
13
  iconsMap: {
14
14
  '0a248b278e135ea7': 'Other',
15
- '29d62a794c77ad99': 'AppleFill',
16
15
  '32b14416be4b7b24': 'Android',
17
16
  '46b6b9a78a418ee8': 'AppleFill',
18
- '792fda8fed0308a6': 'Android',
17
+ '29d62a794c77ad99': 'AppleFill',
19
18
  fcb0a0f49138e0a0: 'Other',
19
+ '792fda8fed0308a6': 'Android',
20
20
  },
21
21
  options: [
22
22
  '0a248b278e135ea7',
23
23
  '32b14416be4b7b24',
24
- '0a248b278e135ea7',
24
+ '46b6b9a78a418ee8',
25
25
  '29d62a794c77ad99',
26
26
  'fcb0a0f49138e0a0',
27
27
  '792fda8fed0308a6',
28
28
  ],
29
29
  optionsMap: {
30
30
  '0a248b278e135ea7': 'pipeline-service',
31
- '29d62a794c77ad99': 'build-log-service',
32
31
  '32b14416be4b7b24': 'bitkit',
33
32
  '46b6b9a78a418ee8': 'bitrise-website',
34
- '792fda8fed0308a6': 'website-docker-base-env #docker',
33
+ '29d62a794c77ad99': 'build-log-service',
35
34
  fcb0a0f49138e0a0: 'bitrise-insights-cf',
35
+ '792fda8fed0308a6': 'website-docker-base-env #docker',
36
36
  },
37
37
  hasNotFilteredOption: false,
38
+ preserveOptionOrder: true,
38
39
  type: 'select',
39
40
  },
40
41
  branch: {
@@ -21,6 +21,7 @@ export type FilterCategoryProps = {
21
21
  dependsOn?: Record<string, string>;
22
22
  iconsMap?: FilterIconsMap;
23
23
  hasNotFilteredOption?: boolean;
24
+ preserveOptionOrder?: boolean;
24
25
  isMultiple?: boolean;
25
26
  onAsyncSearch?: FilterSearchCallback;
26
27
  options?: FilterOptions;
@@ -31,7 +31,15 @@ const FilterForm = (props: FilterFormProps) => {
31
31
  const filterStyle = useMultiStyleConfig('Filter') as FilterStyle;
32
32
 
33
33
  const { data, state } = useFilterContext();
34
- const { iconsMap, hasNotFilteredOption = true, isMultiple, onAsyncSearch, options, optionsMap } = data[category];
34
+ const {
35
+ iconsMap,
36
+ hasNotFilteredOption = true,
37
+ preserveOptionOrder,
38
+ isMultiple,
39
+ onAsyncSearch,
40
+ options,
41
+ optionsMap,
42
+ } = data[category];
35
43
  const value = state[category] || [];
36
44
 
37
45
  const [selected, setSelected] = useState<FilterValue>(value);
@@ -111,8 +119,8 @@ const FilterForm = (props: FilterFormProps) => {
111
119
 
112
120
  const items =
113
121
  isAsync && !!searchValue
114
- ? Array.from(new Set([...value, ...foundOptions]))
115
- : Array.from(new Set([...value, ...filteredOptions]));
122
+ ? Array.from(new Set(preserveOptionOrder ? [...foundOptions] : [...value, ...foundOptions]))
123
+ : Array.from(new Set(preserveOptionOrder ? [...filteredOptions] : [...value, ...filteredOptions]));
116
124
 
117
125
  return (
118
126
  <FocusLock>
@@ -178,7 +186,7 @@ const FilterForm = (props: FilterFormProps) => {
178
186
  </RadioGroup>
179
187
  )}
180
188
  <ButtonGroup spacing="12" sx={filterStyle.formButtonGroup}>
181
- {isEditMode && (
189
+ {isEditMode && hasNotFilteredOption && (
182
190
  <Button marginInlineEnd="auto" onClick={onClearClick} size="sm" variant="tertiary">
183
191
  Clear
184
192
  </Button>