Skip to content

Commit 14b4044

Browse files
committed
breaking(pf4): use import transform lookup on pf4 components.
1 parent 6d7596f commit 14b4044

File tree

18 files changed

+64
-64
lines changed

18 files changed

+64
-64
lines changed

packages/pf3-component-mapper/rollup.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const pf3Externals = createFilter(
3131
const globals = {
3232
react: 'React',
3333
'react-dom': 'ReactDOM',
34+
'prop-types': 'PropTypes',
3435
'patternfly-react': 'PatternflyReact',
3536
'@data-driven-forms/react-form-renderer': '@data-driven-forms/react-form-renderer'
3637
};
@@ -43,9 +44,8 @@ const babelOptions = {
4344

4445
const commonjsOptions = {
4546
ignoreGlobal: true,
46-
include: [/node_modules/, '../../node_modules/**'],
47+
include: /node_modules/,
4748
namedExports: {
48-
'../react-form-renderer/dist/index.js': ['composeValidators'],
4949
'../../node_modules/react-day-picker/DayPicker.js': ['DayPicker']
5050
}
5151
};
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
3-
import { FormGroup as Pf3FormGroup, ControlLabel, FieldLevelHelp } from 'patternfly-react';
3+
import { FormGroup, ControlLabel, FieldLevelHelp } from 'patternfly-react';
44
import { validationError } from '../form-fields/helpers';
55
import RequiredLabel from '../form-fields/required-label';
66
import renderHelperText from './render-helper-text';
77
import InputAddonWrapper from './render-input-group';
88

9-
const FormGroup = ({ meta, validateOnMount, label, hideLabel, noCheckboxLabel, isRequired, helperText, description, children, inputAddon }) => {
9+
const Pf3FormGroup = ({ meta, validateOnMount, label, hideLabel, noCheckboxLabel, isRequired, helperText, description, children, inputAddon }) => {
1010
const invalid = validationError(meta, validateOnMount);
1111

1212
return (
13-
<Pf3FormGroup validationState={invalid ? 'error' : null}>
13+
<FormGroup validationState={invalid ? 'error' : null}>
1414
{label && !hideLabel && !noCheckboxLabel && (
1515
<ControlLabel>
1616
{isRequired ? <RequiredLabel label={label} /> : label}
@@ -19,11 +19,11 @@ const FormGroup = ({ meta, validateOnMount, label, hideLabel, noCheckboxLabel, i
1919
)}
2020
{inputAddon ? <InputAddonWrapper inputAddon={inputAddon}>{children}</InputAddonWrapper> : children}
2121
{renderHelperText(invalid && meta.error, description)}
22-
</Pf3FormGroup>
22+
</FormGroup>
2323
);
2424
};
2525

26-
FormGroup.propTypes = {
26+
Pf3FormGroup.propTypes = {
2727
meta: PropTypes.shape({ error: PropTypes.string }).isRequired,
2828
validateOnMount: PropTypes.bool,
2929
hideLabel: PropTypes.bool,
@@ -36,4 +36,4 @@ FormGroup.propTypes = {
3636
inputAddon: PropTypes.shape({ fields: PropTypes.array })
3737
};
3838

39-
export default FormGroup;
39+
export default Pf3FormGroup;

packages/pf3-component-mapper/src/tests/__snapshots__/form-fields.test.js.snap

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ exports[`FormFields <Checkbox /> should render single checkbox variant 1`] = `
1313
meta={Object {}}
1414
name="single-check-box"
1515
>
16-
<FormGroup
16+
<Pf3FormGroup
1717
hideLabel={true}
1818
meta={
1919
Object {
@@ -76,7 +76,7 @@ exports[`FormFields <Checkbox /> should render single checkbox variant 1`] = `
7676
</Checkbox>
7777
</div>
7878
</FormGroup>
79-
</FormGroup>
79+
</Pf3FormGroup>
8080
</SingleCheckbox>
8181
</Checkbox>
8282
</ReactFinalForm>
@@ -98,7 +98,7 @@ exports[`FormFields <Checkbox /> should render single checkbox variant with a he
9898
meta={Object {}}
9999
name="single-check-box"
100100
>
101-
<FormGroup
101+
<Pf3FormGroup
102102
hideLabel={true}
103103
meta={
104104
Object {
@@ -219,7 +219,7 @@ exports[`FormFields <Checkbox /> should render single checkbox variant with a he
219219
</Checkbox>
220220
</div>
221221
</FormGroup>
222-
</FormGroup>
222+
</Pf3FormGroup>
223223
</SingleCheckbox>
224224
</Checkbox>
225225
</ReactFinalForm>
@@ -246,7 +246,7 @@ exports[`FormFields <Radio /> should render correctly 1`] = `
246246
]
247247
}
248248
>
249-
<FormGroup
249+
<Pf3FormGroup
250250
meta={
251251
Object {
252252
"active": false,
@@ -369,7 +369,7 @@ exports[`FormFields <Radio /> should render correctly 1`] = `
369369
</RadioOption>
370370
</div>
371371
</FormGroup>
372-
</FormGroup>
372+
</Pf3FormGroup>
373373
</Radio>
374374
</ReactFinalForm>
375375
</RenderWithProvider>
@@ -405,7 +405,7 @@ exports[`FormFields <Switch /> should render Switch correctly 1`] = `
405405
}
406406
}
407407
>
408-
<FormGroup
408+
<Pf3FormGroup
409409
meta={
410410
Object {
411411
"active": false,
@@ -514,7 +514,7 @@ exports[`FormFields <Switch /> should render Switch correctly 1`] = `
514514
</Switch>
515515
</div>
516516
</FormGroup>
517-
</FormGroup>
517+
</Pf3FormGroup>
518518
</Switch>
519519
</ReactFinalForm>
520520
</RenderWithProvider>
@@ -551,7 +551,7 @@ exports[`FormFields <Switch /> should render Switch with label correctly 1`] = `
551551
}
552552
}
553553
>
554-
<FormGroup
554+
<Pf3FormGroup
555555
label="Label"
556556
meta={
557557
Object {
@@ -671,7 +671,7 @@ exports[`FormFields <Switch /> should render Switch with label correctly 1`] = `
671671
</Switch>
672672
</div>
673673
</FormGroup>
674-
</FormGroup>
674+
</Pf3FormGroup>
675675
</Switch>
676676
</ReactFinalForm>
677677
</RenderWithProvider>
@@ -708,7 +708,7 @@ exports[`FormFields <Switch /> should render Switch with onText (custom prop) co
708708
}
709709
onText="OnText"
710710
>
711-
<FormGroup
711+
<Pf3FormGroup
712712
meta={
713713
Object {
714714
"active": false,
@@ -817,7 +817,7 @@ exports[`FormFields <Switch /> should render Switch with onText (custom prop) co
817817
</Switch>
818818
</div>
819819
</FormGroup>
820-
</FormGroup>
820+
</Pf3FormGroup>
821821
</Switch>
822822
</ReactFinalForm>
823823
</RenderWithProvider>
@@ -854,7 +854,7 @@ exports[`FormFields <Switch /> should render Switch with placeholder correctly 1
854854
}
855855
placeholder="Placeholder"
856856
>
857-
<FormGroup
857+
<Pf3FormGroup
858858
meta={
859859
Object {
860860
"active": false,
@@ -963,7 +963,7 @@ exports[`FormFields <Switch /> should render Switch with placeholder correctly 1
963963
</Switch>
964964
</div>
965965
</FormGroup>
966-
</FormGroup>
966+
</Pf3FormGroup>
967967
</Switch>
968968
</ReactFinalForm>
969969
</RenderWithProvider>
@@ -1000,7 +1000,7 @@ exports[`FormFields <Switch /> should render disabled Switch correctly 1`] = `
10001000
}
10011001
}
10021002
>
1003-
<FormGroup
1003+
<Pf3FormGroup
10041004
meta={
10051005
Object {
10061006
"active": false,
@@ -1111,7 +1111,7 @@ exports[`FormFields <Switch /> should render disabled Switch correctly 1`] = `
11111111
</Switch>
11121112
</div>
11131113
</FormGroup>
1114-
</FormGroup>
1114+
</Pf3FormGroup>
11151115
</Switch>
11161116
</ReactFinalForm>
11171117
</RenderWithProvider>
@@ -1148,7 +1148,7 @@ exports[`FormFields <Switch /> should render mini Switch correctly 1`] = `
11481148
}
11491149
}
11501150
>
1151-
<FormGroup
1151+
<Pf3FormGroup
11521152
meta={
11531153
Object {
11541154
"active": false,
@@ -1258,7 +1258,7 @@ exports[`FormFields <Switch /> should render mini Switch correctly 1`] = `
12581258
</Switch>
12591259
</div>
12601260
</FormGroup>
1261-
</FormGroup>
1261+
</Pf3FormGroup>
12621262
</Switch>
12631263
</ReactFinalForm>
12641264
</RenderWithProvider>
@@ -1295,7 +1295,7 @@ exports[`FormFields <Switch /> should render readOnly Switch correctly 1`] = `
12951295
}
12961296
}
12971297
>
1298-
<FormGroup
1298+
<Pf3FormGroup
12991299
meta={
13001300
Object {
13011301
"active": false,
@@ -1406,7 +1406,7 @@ exports[`FormFields <Switch /> should render readOnly Switch correctly 1`] = `
14061406
</Switch>
14071407
</div>
14081408
</FormGroup>
1409-
</FormGroup>
1409+
</Pf3FormGroup>
14101410
</Switch>
14111411
</ReactFinalForm>
14121412
</RenderWithProvider>
@@ -1443,7 +1443,7 @@ exports[`FormFields <Switch /> should render sm Switch correctly 1`] = `
14431443
}
14441444
}
14451445
>
1446-
<FormGroup
1446+
<Pf3FormGroup
14471447
meta={
14481448
Object {
14491449
"active": false,
@@ -1553,7 +1553,7 @@ exports[`FormFields <Switch /> should render sm Switch correctly 1`] = `
15531553
</Switch>
15541554
</div>
15551555
</FormGroup>
1556-
</FormGroup>
1556+
</Pf3FormGroup>
15571557
</Switch>
15581558
</ReactFinalForm>
15591559
</RenderWithProvider>
@@ -1567,7 +1567,7 @@ exports[`FormFields <TextField /> should render correctly 1`] = `
15671567
<TextField
15681568
name="text-field"
15691569
>
1570-
<FormGroup
1570+
<Pf3FormGroup
15711571
meta={
15721572
Object {
15731573
"active": false,
@@ -1618,7 +1618,7 @@ exports[`FormFields <TextField /> should render correctly 1`] = `
16181618
</FormControl>
16191619
</div>
16201620
</FormGroup>
1621-
</FormGroup>
1621+
</Pf3FormGroup>
16221622
</TextField>
16231623
</ReactFinalForm>
16241624
</RenderWithProvider>
@@ -1633,7 +1633,7 @@ exports[`FormFields <TextField /> should render correctly with placeholder 1`] =
16331633
name="text-field"
16341634
placeholder="placeholder"
16351635
>
1636-
<FormGroup
1636+
<Pf3FormGroup
16371637
meta={
16381638
Object {
16391639
"active": false,
@@ -1686,7 +1686,7 @@ exports[`FormFields <TextField /> should render correctly with placeholder 1`] =
16861686
</FormControl>
16871687
</div>
16881688
</FormGroup>
1689-
</FormGroup>
1689+
</Pf3FormGroup>
16901690
</TextField>
16911691
</ReactFinalForm>
16921692
</RenderWithProvider>
@@ -1705,7 +1705,7 @@ exports[`FormFields <Textarea /> should render correctly 1`] = `
17051705
}
17061706
meta={Object {}}
17071707
>
1708-
<FormGroup
1708+
<Pf3FormGroup
17091709
meta={
17101710
Object {
17111711
"active": false,
@@ -1754,7 +1754,7 @@ exports[`FormFields <Textarea /> should render correctly 1`] = `
17541754
</FormControl>
17551755
</div>
17561756
</FormGroup>
1757-
</FormGroup>
1757+
</Pf3FormGroup>
17581758
</Textarea>
17591759
</ReactFinalForm>
17601760
</RenderWithProvider>
@@ -1774,7 +1774,7 @@ exports[`FormFields <Textarea /> should render correctly with placeholder 1`] =
17741774
meta={Object {}}
17751775
placeholder="placeholder"
17761776
>
1777-
<FormGroup
1777+
<Pf3FormGroup
17781778
meta={
17791779
Object {
17801780
"active": false,
@@ -1825,7 +1825,7 @@ exports[`FormFields <Textarea /> should render correctly with placeholder 1`] =
18251825
</FormControl>
18261826
</div>
18271827
</FormGroup>
1828-
</FormGroup>
1828+
</Pf3FormGroup>
18291829
</Textarea>
18301830
</ReactFinalForm>
18311831
</RenderWithProvider>

0 commit comments

Comments
 (0)