Skip to content

Commit 998540f

Browse files
Merge release/v3.2.2 into main branch (#1253)
* Render disabled select option as disabled (#1252)
1 parent 1a86644 commit 998540f

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@user-interviews/ui-design-system",
3-
"version": "3.2.1",
3+
"version": "3.2.2",
44
"dependencies": {
55
"@tiptap/core": "^2.3.1",
66
"@tiptap/extension-bold": "^2.3.1",

src/Select/styles.js

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,26 @@ const defaultStyles = ({ menuWidth, size }) => ({
9393
isDisabled,
9494
isFocused,
9595
isSelected,
96-
}) => ({
96+
}) => {
97+
const getBackgroundColor = () => {
98+
if (isDisabled) return systemColors.SYNTH_ALERT_BG_NEUTRAL;
99+
if (isSelected || isFocused) return systemColors.SYNTH_HOVER_STATE;
100+
return styles.backgroundColor;
101+
};
102+
103+
const getHoverBackgroundColor = () => {
104+
if (isDisabled) return systemColors.SYNTH_ALERT_BG_NEUTRAL;
105+
if (isSelected) return systemColors.SYNTH_SELECTED_STATE_GREEN;
106+
return systemColors.SYNTH_HOVER_STATE;
107+
};
108+
109+
return {
97110
...styles,
98-
backgroundColor: isSelected || isFocused ?
99-
systemColors.SYNTH_HOVER_STATE : styles.backgroundColor,
100-
color: systemColors.UX_GRAY_900,
111+
backgroundColor: getBackgroundColor(),
112+
color: isDisabled ? systemColors.SYNTH_UNSELECTED_NEUTRAL : systemColors.UX_GRAY_900,
101113
fontWeight: fontWeights.light,
102114
fontSize: '0.875rem',
103-
cursor: 'pointer',
115+
cursor: isDisabled ? 'default' : 'pointer',
104116

105117
':active': {
106118
...styles[':active'],
@@ -110,10 +122,10 @@ const defaultStyles = ({ menuWidth, size }) => ({
110122

111123
':hover': {
112124
...styles[':hover'],
113-
backgroundColor: isSelected ?
114-
systemColors.SYNTH_SELECTED_STATE_GREEN : systemColors.SYNTH_HOVER_STATE,
125+
backgroundColor: getHoverBackgroundColor(),
115126
},
116-
}),
127+
};
128+
},
117129
});
118130

119131
const borderedMultiValueStyles = (borderedMultiValue) => borderedMultiValue ? {

0 commit comments

Comments
 (0)