Skip to content

Commit 0f6c0fe

Browse files
authored
Merge pull request #454 from rvsia/updatePf4
Updates PF4 from V1
2 parents 899f399 + e299437 commit 0f6c0fe

File tree

6 files changed

+25
-5
lines changed

6 files changed

+25
-5
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 {

packages/pf4-component-mapper/src/files/wizard.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ const WizardInternal = ({
4343
navSchema,
4444
activeStepIndex,
4545
maxStepIndex,
46-
isDynamic
46+
isDynamic,
47+
container
4748
}) => {
48-
const [state, dispatch] = useReducer(reducer, { loading: true });
49+
const [state, dispatch] = useReducer(reducer, { loading: true, container });
4950

5051
useEffect(() => {
5152
if (inModal) {

packages/pf4-component-mapper/src/files/wizard/reducer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const reducer = (state, { type }) => {
66
loading: false
77
};
88
case 'setContainer':
9-
return { ...state, container: document.createElement('div') };
9+
return { ...state, container: state.container || document.createElement('div') };
1010
default:
1111
return state;
1212
}

packages/react-renderer-demo/src/app/src/doc-components/pf4-wizard.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Don't forget hide form controls by setting \`showFormControls\` to \`false\` as
1010
| description | string | undefined | Description in header |
1111
| buttonLabels | object | see below | Labels for buttons |
1212
| inModal | bool | undefined | show form in modal |
13+
| container | HTMLElement | 'div' | element containing the modal |
1314
| isCompactNav | bool | undefined | see Patternfly |
1415
| setFullWidth | bool | undefined | see Patternfly |
1516
| setFullHeight | bool | undefined | see Patternfly |

0 commit comments

Comments
 (0)