@bitrise/bitkit 13.191.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
|
};
|