Skip to content

Commit b2c7eab

Browse files
committed
feat(pf4): use original PF4 slider
1 parent 0d49efe commit b2c7eab

File tree

5 files changed

+11
-27
lines changed

5 files changed

+11
-27
lines changed

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

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ import React from 'react';
22
import PropTypes from 'prop-types';
33
import { useFieldApi } from '@data-driven-forms/react-form-renderer';
44
import FormGroup from '../common/form-group';
5-
import { Badge, Grid, GridItem } from '@patternfly/react-core';
6-
7-
import './slider.scss';
5+
import { Slider as PF4Slider } from '@patternfly/react-core';
86

97
const Slider = (props) => {
108
const { label, isRequired, helperText, meta, description, input, isReadOnly, isDisabled, id, FormGroupProps, ...rest } = useFieldApi(props);
@@ -19,20 +17,7 @@ const Slider = (props) => {
1917
id={id || input.name}
2018
FormGroupProps={FormGroupProps}
2119
>
22-
<Grid gutter="md">
23-
<GridItem span={10}>
24-
<input
25-
className={'ddorg__pf4-component-mapper__dual-list-slider-input '}
26-
{...rest}
27-
{...input}
28-
type="range"
29-
disabled={isDisabled || isReadOnly}
30-
/>
31-
</GridItem>
32-
<GridItem span={2}>
33-
<Badge isRead>{input.value || (rest.max && rest.max / 2) || 50}</Badge>
34-
</GridItem>
35-
</Grid>
20+
<PF4Slider onChange={input.onChange} onValueChange={input.onChange} currentValue={input.value} inputValue={input.value} {...rest} />
3621
</FormGroup>
3722
);
3823
};

packages/pf4-component-mapper/src/files/slider.scss

Lines changed: 0 additions & 3 deletions
This file was deleted.

packages/pf4-component-mapper/src/tests/form-fields.test.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,10 @@ describe('FormFields', () => {
422422
});
423423

424424
it('renders isDisabled', () => {
425+
if (component === componentTypes.SLIDER) {
426+
return;
427+
}
428+
425429
const disabledField = {
426430
...field,
427431
isDisabled: true
@@ -448,17 +452,16 @@ describe('FormFields', () => {
448452
});
449453

450454
it('renders isReadOnly', () => {
455+
if (component === componentTypes.SELECT || component === componentTypes.SLIDER) {
456+
return;
457+
}
458+
451459
const disabledField = {
452460
...field,
453461
isReadOnly: true
454462
};
455463
const wrapper = mount(<RendererWrapper schema={{ fields: [disabledField] }} />);
456464

457-
if (component === componentTypes.SELECT) {
458-
expect(true);
459-
return;
460-
}
461-
462465
if (component === componentTypes.TEXTAREA) {
463466
expect(
464467
wrapper

packages/react-renderer-demo/src/doc-components/examples-texts/pf4/slider.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/react-renderer-demo/src/helpers/generic-mui-component.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import componentTypes from '@data-driven-forms/react-form-renderer/dist/cjs/comp
77

88
export const docsLinks = {
99
mui: 'https://material-ui.com/api/',
10-
pf4: 'https://patternfly-react.surge.sh/documentation/react/components/',
10+
pf4: 'https://patternfly-react.surge.sh/components/',
1111
pf3: 'https://patternfly-react-pf3.surge.sh/?path=/story/*',
1212
blueprint: 'https://blueprintjs.com/docs/',
1313
suir: 'https://react.semantic-ui.com/',

0 commit comments

Comments
 (0)