@bitrise/bitkit 13.21.0 → 13.22.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
|
@@ -123,7 +123,7 @@ function findOption<T>(children: ReactNode, value: T): { label: ReactNode; index
|
|
|
123
123
|
const list = React.Children.toArray(children);
|
|
124
124
|
for (let i = 0; i < list.length; i++) {
|
|
125
125
|
const elem = list[i];
|
|
126
|
-
if (React.isValidElement(elem)) {
|
|
126
|
+
if (React.isValidElement(elem) && !elem.props.isDisabled) {
|
|
127
127
|
const optValue = typeof elem.props.value === 'undefined' ? null : elem.props.value;
|
|
128
128
|
if (elem.type === DropdownOption && optValue === value) {
|
|
129
129
|
return { index: elem.props.index, label: elem.props.children };
|
|
@@ -38,15 +38,19 @@ const DropdownOption = <T = string,>({
|
|
|
38
38
|
value === ctx.formValue && 'bitkit-select__option-active',
|
|
39
39
|
index === ctx.activeIndex && 'bitkit-select__option-hover',
|
|
40
40
|
)}
|
|
41
|
-
{...ctx.getItemProps(
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
{...ctx.getItemProps(
|
|
42
|
+
isDisabled
|
|
43
|
+
? {}
|
|
44
|
+
: {
|
|
45
|
+
onClick(event) {
|
|
46
|
+
onClick?.(event);
|
|
44
47
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
if (!event.defaultPrevented) {
|
|
49
|
+
ctx.onOptionSelected({ index, label: children, value });
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
)}
|
|
50
54
|
>
|
|
51
55
|
{children}
|
|
52
56
|
</chakra.div>
|
|
@@ -77,27 +81,26 @@ const DropdownGroup = ({
|
|
|
77
81
|
);
|
|
78
82
|
};
|
|
79
83
|
|
|
80
|
-
|
|
84
|
+
type DropdownDetailedOptionProps<T> = DropdownOptionProps<T> & {
|
|
85
|
+
icon: ReactNode;
|
|
86
|
+
subtitle: string;
|
|
87
|
+
title: string;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const DropdownDetailedOption = <T = string,>({
|
|
81
91
|
icon,
|
|
82
|
-
subtitle,
|
|
83
92
|
title,
|
|
84
|
-
|
|
93
|
+
isDisabled,
|
|
94
|
+
subtitle,
|
|
85
95
|
...rest
|
|
86
|
-
}: {
|
|
87
|
-
icon: ReactNode;
|
|
88
|
-
title: string;
|
|
89
|
-
subtitle: string;
|
|
90
|
-
value?: string;
|
|
91
|
-
}) => {
|
|
96
|
+
}: DropdownDetailedOptionProps<T>) => {
|
|
92
97
|
return (
|
|
93
|
-
<DropdownOption
|
|
98
|
+
<DropdownOption isDisabled={isDisabled} {...rest} aria-label={title}>
|
|
94
99
|
<chakra.div alignItems="center" display="flex" flexDir="row" gap="12">
|
|
95
|
-
{icon}
|
|
100
|
+
<chakra.div opacity={isDisabled ? '0.5' : '1'}>{icon}</chakra.div>
|
|
96
101
|
<chakra.div>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
</Text>
|
|
100
|
-
<Text color="neutral.60" size="2">
|
|
102
|
+
{title}
|
|
103
|
+
<Text color={isDisabled ? 'text/disabled' : 'input/text/helper'} size="2">
|
|
101
104
|
{subtitle}
|
|
102
105
|
</Text>
|
|
103
106
|
</chakra.div>
|