Skip to content

Commit 48b188d

Browse files
committed
feat(pf4): use original timepicker component
1 parent d883935 commit 48b188d

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ describe('FormFields', () => {
312312
.first()
313313
.props().disabled
314314
).toEqual(true);
315-
} else if ([componentTypes.CHECKBOX, componentTypes.RADIO, componentTypes.SWITCH, componentTypes.SLIDER].includes(component)) {
315+
} else if ([componentTypes.TIME_PICKER, componentTypes.CHECKBOX, componentTypes.RADIO, componentTypes.SWITCH, componentTypes.SLIDER].includes(component)) {
316316
expect(
317317
wrapper
318318
.find('input')

packages/pf4-component-mapper/src/time-picker/time-picker.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import React from 'react';
22
import FormGroup from '../form-group/form-group';
3-
import { TextInput } from '@patternfly/react-core';
3+
import { TimePicker as PF4TimePicker } from '@patternfly/react-core';
44
import { useFieldApi } from '@data-driven-forms/react-form-renderer';
55
import PropTypes from 'prop-types';
6-
import showError from '../show-error/show-error';
76

87
const TimePicker = (props) => {
98
const {
@@ -33,14 +32,12 @@ const TimePicker = (props) => {
3332
id={id || input.name}
3433
FormGroupProps={FormGroupProps}
3534
>
36-
<TextInput
37-
{...showError(meta, validateOnMount)}
35+
<PF4TimePicker
3836
{...input}
37+
defaultTime={input.value}
3938
{...rest}
40-
type="time"
4139
id={id || input.name}
42-
isReadOnly={isReadOnly}
43-
isDisabled={isDisabled}
40+
isDisabled={isDisabled || isReadOnly}
4441
/>
4542
</FormGroup>
4643
);

0 commit comments

Comments
 (0)