Skip to content

Commit e299437

Browse files
committed
fix(pf4): Add disabled styles for select
1 parent 7061c52 commit e299437

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

packages/pf4-component-mapper/demo/demo-schemas/wizard-schema.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ export const wizardSchema = {
9191
{
9292
value: 'google',
9393
label: 'Google'
94+
},
95+
{
96+
value: 'disabled',
97+
label: 'i am disabled',
98+
isDisabled: true
9499
}
95100
],
96101
validate: [

packages/pf4-component-mapper/src/common/select/option.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Checkbox } from '@patternfly/react-core';
66
import { CheckIcon } from '@patternfly/react-icons';
77

88
const Option = (props) => (
9-
<div className={`ddorg__pf4-component-mapper__select__menu--option ${props.isFocused ? 'focused' : ''}`}>
9+
<div className={`ddorg__pf4-component-mapper__select__menu--option ${props.isFocused ? 'focused' : ''} ${props.isDisabled ? 'disabled' : ''}`}>
1010
{props.selectProps && props.selectProps && props.selectProps.isCheckbox && (
1111
<Checkbox
1212
isChecked={props.isSelected || (props.data && props.data.selected) || false}
@@ -33,12 +33,14 @@ Option.propTypes = {
3333
}),
3434
selectProps: PropTypes.shape({
3535
isCheckbox: PropTypes.bool
36-
})
36+
}),
37+
isDisabled: PropTypes.bool
3738
};
3839

3940
Option.defaultProps = {
4041
isFocused: false,
4142
isSelected: false,
43+
isDisabled: false,
4244
selectOption: () => undefined,
4345
selectProps: {
4446
isCheckbox: false

packages/pf4-component-mapper/src/common/select/select-styles.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
.ddorg__pf4-component-mapper__select__menu--option {
7777
display: flex;
7878
align-items: center;
79+
color: var(--pf-global--Color--dark-100);
7980

8081
&.focused {
8182
background-color: var(--pf-global--Color--light-200);
@@ -93,6 +94,16 @@
9394
padding-left: 0;
9495
}
9596
}
97+
98+
&.disabled {
99+
cursor: default;
100+
}
101+
102+
&.disabled div {
103+
color: var(--pf-global--disabled-color--100);
104+
pointer-events: none;
105+
cursor: none;
106+
}
96107
}
97108

98109
.ddorg__pf4-component-mapper__select__menu--option div {

0 commit comments

Comments
 (0)