@bitrise/bitkit 13.190.0 → 13.192.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
|
@@ -4,6 +4,7 @@ import { cx } from '@chakra-ui/utils';
|
|
|
4
4
|
import Text, { TextProps } from '../Text/Text';
|
|
5
5
|
import Divider from '../Divider/Divider';
|
|
6
6
|
import Box from '../Box/Box';
|
|
7
|
+
import Icon from '../Icon/Icon';
|
|
7
8
|
import { useDropdownContext, useDropdownStyles } from './Dropdown.context';
|
|
8
9
|
|
|
9
10
|
export type DropdownOptionProps<T> = {
|
|
@@ -14,6 +15,7 @@ export type DropdownOptionProps<T> = {
|
|
|
14
15
|
onClick?: MouseEventHandler<HTMLElement>;
|
|
15
16
|
isDisabled?: boolean;
|
|
16
17
|
};
|
|
18
|
+
|
|
17
19
|
const DropdownOption = <T = string,>({
|
|
18
20
|
avatar,
|
|
19
21
|
children,
|
|
@@ -25,6 +27,7 @@ const DropdownOption = <T = string,>({
|
|
|
25
27
|
const { item } = useDropdownStyles();
|
|
26
28
|
const ctx = useDropdownContext<T | null>();
|
|
27
29
|
const { index } = rest as { index?: number };
|
|
30
|
+
const isSelected = value === ctx.formValue;
|
|
28
31
|
|
|
29
32
|
return (
|
|
30
33
|
<chakra.div
|
|
@@ -39,7 +42,7 @@ const DropdownOption = <T = string,>({
|
|
|
39
42
|
{...rest}
|
|
40
43
|
__css={item}
|
|
41
44
|
className={cx(
|
|
42
|
-
|
|
45
|
+
isSelected && 'bitkit-select__option-active',
|
|
43
46
|
index === ctx.activeIndex && 'bitkit-select__option-hover',
|
|
44
47
|
)}
|
|
45
48
|
{...ctx.getItemProps(
|
|
@@ -56,14 +59,11 @@ const DropdownOption = <T = string,>({
|
|
|
56
59
|
},
|
|
57
60
|
)}
|
|
58
61
|
>
|
|
59
|
-
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
) : (
|
|
65
|
-
children
|
|
66
|
-
)}
|
|
62
|
+
<Box display="flex" alignItems="center" gap="8">
|
|
63
|
+
{avatar && <Avatar size={ctx.size === 'lg' ? '32' : '24'} {...avatar} />}
|
|
64
|
+
<Box flex="1">{children}</Box>
|
|
65
|
+
{isSelected && <Icon name="Check" color="icon/interactive" />}
|
|
66
|
+
</Box>
|
|
67
67
|
</chakra.div>
|
|
68
68
|
);
|
|
69
69
|
};
|
|
@@ -20,6 +20,7 @@ export type FilterCategoryProps = {
|
|
|
20
20
|
unfilteredLabel?: string;
|
|
21
21
|
dependsOn?: Record<string, string>;
|
|
22
22
|
iconsMap?: FilterIconsMap;
|
|
23
|
+
hasNotFilteredOption?: boolean;
|
|
23
24
|
isMultiple?: boolean;
|
|
24
25
|
onAsyncSearch?: FilterSearchCallback;
|
|
25
26
|
options?: FilterOptions;
|
|
@@ -31,7 +31,7 @@ const FilterForm = (props: FilterFormProps) => {
|
|
|
31
31
|
const filterStyle = useMultiStyleConfig('Filter') as FilterStyle;
|
|
32
32
|
|
|
33
33
|
const { data, state } = useFilterContext();
|
|
34
|
-
const { iconsMap, isMultiple, onAsyncSearch, options, optionsMap } = data[category];
|
|
34
|
+
const { iconsMap, hasNotFilteredOption = true, isMultiple, onAsyncSearch, options, optionsMap } = data[category];
|
|
35
35
|
const value = state[category] || [];
|
|
36
36
|
|
|
37
37
|
const [selected, setSelected] = useState<FilterValue>(value);
|
|
@@ -150,11 +150,13 @@ const FilterForm = (props: FilterFormProps) => {
|
|
|
150
150
|
)}
|
|
151
151
|
{!isLoading && !isMultiple && (
|
|
152
152
|
<RadioGroup onChange={(v) => setSelected([v])} sx={filterStyle.formInputGroup} value={selected[0] || ''}>
|
|
153
|
-
|
|
154
|
-
<
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
153
|
+
{hasNotFilteredOption && (
|
|
154
|
+
<Radio value="">
|
|
155
|
+
<Text as="span" color="neutral.40" fontStyle="italic">
|
|
156
|
+
Not filtered
|
|
157
|
+
</Text>
|
|
158
|
+
</Radio>
|
|
159
|
+
)}
|
|
158
160
|
{items.length
|
|
159
161
|
? items.map((opt) => {
|
|
160
162
|
const hasIcon = iconsMap && iconsMap[opt];
|