@bitrise/bitkit 13.21.0 → 13.23.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.21.0",
4
+ "version": "13.23.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+ssh://git@github.com/bitrise-io/bitkit.git"
@@ -47,7 +47,7 @@ const DropdownTheme = {
47
47
  },
48
48
  _disabled: {
49
49
  color: 'neutral.70',
50
- pointerEvents: 'none',
50
+ cursor: 'not-allowed',
51
51
  },
52
52
  color: 'purple.10',
53
53
  cursor: 'pointer',
@@ -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
- onClick(event) {
43
- onClick?.(event);
41
+ {...ctx.getItemProps(
42
+ isDisabled
43
+ ? {}
44
+ : {
45
+ onClick(event) {
46
+ onClick?.(event);
44
47
 
45
- if (!event.defaultPrevented) {
46
- ctx.onOptionSelected({ index, label: children, value });
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
- const DropdownDetailedOption = ({
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
- value,
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 value={value} {...rest} aria-label={title}>
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
- <Text color="purple.10" size="3">
98
- {title}
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>
@@ -21,7 +21,7 @@ const baseStyle = defineStyle(
21
21
  boxShadow: 'inset 0 2px var(--colors-purple-50), inset 0 0 0 3px var(--colors-purple-70)',
22
22
  },
23
23
  _hover: {
24
- backgroundColor: 'neutral.95',
24
+ backgroundColor: 'background/active',
25
25
  },
26
26
  _selected: {
27
27
  '+ [role="tab"]': {