@uncinc/uncinc-react-kitchen-sink 2.2.5 → 2.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Button/stories.scss +45 -0
- package/dist/components/Form/Checkbox/index.js +10 -5
- package/dist/components/Form/Checkboxes/index.js +18 -8
- package/dist/components/Form/DatePicker/index.js +13 -6
- package/dist/components/Form/DateSelect/index.js +12 -2
- package/dist/components/Form/FormikWrapper/index.js +56 -43
- package/dist/components/Form/RadioButtons/index.js +10 -4
- package/dist/components/Form/SearchField/index.js +11 -4
- package/dist/components/Form/Select/Input/index.js +8 -3
- package/dist/components/Form/Select/index.js +14 -3
- package/dist/components/Form/TextField/index.js +15 -5
- package/dist/components/Form/TextField/stories.js +2 -1
- package/dist/components/Form/Textarea/index.js +11 -4
- package/dist/components/WysiwygField/stories.scss +3 -0
- package/dist/helpers/makeSafeForCSS.js +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
@import '../../styles/assets/variables';
|
|
2
|
+
|
|
3
|
+
.Button {
|
|
4
|
+
&.Button--styled {
|
|
5
|
+
display: inline-block;
|
|
6
|
+
border-radius: 5px;
|
|
7
|
+
text-decoration: none;
|
|
8
|
+
text-align: center;
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
|
|
11
|
+
&--primary {
|
|
12
|
+
font-size: 21px;
|
|
13
|
+
background-color: black;
|
|
14
|
+
color: #ffffff;
|
|
15
|
+
font-weight: 600;
|
|
16
|
+
line-height: 1.14;
|
|
17
|
+
padding: 19px 30px;
|
|
18
|
+
|
|
19
|
+
&:hover {
|
|
20
|
+
background-color: #434343;
|
|
21
|
+
}
|
|
22
|
+
&:disabled {
|
|
23
|
+
font-family: inherit;
|
|
24
|
+
background-color: rgba(0, 0, 0, 0.3);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&--inverted {
|
|
29
|
+
border: solid 1px #888888;
|
|
30
|
+
background-color: #ffffff;
|
|
31
|
+
padding: 18px 34.5px;
|
|
32
|
+
font-size: 18px;
|
|
33
|
+
font-weight: 600;
|
|
34
|
+
color: #000000;
|
|
35
|
+
|
|
36
|
+
&:hover {
|
|
37
|
+
background-color: #f1f1f1;
|
|
38
|
+
}
|
|
39
|
+
&:disabled {
|
|
40
|
+
font-family: inherit;
|
|
41
|
+
opacity: .5;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -2,7 +2,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { Field } from 'formik';
|
|
5
|
-
import
|
|
5
|
+
import c from 'classnames';
|
|
6
6
|
import GenericFormElement from '../GenericFormElement';
|
|
7
7
|
import withMapping from '../../../Context/withMapping';
|
|
8
8
|
import './style.scss';
|
|
@@ -18,10 +18,13 @@ const Checkbox = props => {
|
|
|
18
18
|
error,
|
|
19
19
|
value,
|
|
20
20
|
displayRequiredIndicator,
|
|
21
|
-
onChange
|
|
21
|
+
onChange,
|
|
22
|
+
className,
|
|
23
|
+
wrapperClassName,
|
|
24
|
+
disabled = false
|
|
22
25
|
} = props;
|
|
23
26
|
return /*#__PURE__*/React.createElement(GenericFormElement, {
|
|
24
|
-
className: "Checkbox",
|
|
27
|
+
className: c("Checkbox", wrapperClassName),
|
|
25
28
|
required: required,
|
|
26
29
|
description: description,
|
|
27
30
|
fieldName: fieldName,
|
|
@@ -38,7 +41,7 @@ const Checkbox = props => {
|
|
|
38
41
|
form
|
|
39
42
|
}) => {
|
|
40
43
|
const id = `${props.fieldName}--${props.value}`;
|
|
41
|
-
const classes =
|
|
44
|
+
const classes = c('WebformCheckboxes__checkbox__input', {
|
|
42
45
|
'icon-before': true,
|
|
43
46
|
'icon-checkmark': true,
|
|
44
47
|
'icon-variant-1': field.value
|
|
@@ -54,7 +57,9 @@ const Checkbox = props => {
|
|
|
54
57
|
onChange: e => {
|
|
55
58
|
field.onChange(e);
|
|
56
59
|
onChange(!field.value);
|
|
57
|
-
}
|
|
60
|
+
},
|
|
61
|
+
disabled: disabled,
|
|
62
|
+
className: className
|
|
58
63
|
})), title);
|
|
59
64
|
}));
|
|
60
65
|
};
|
|
@@ -2,7 +2,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { Field } from 'formik';
|
|
5
|
-
import
|
|
5
|
+
import c from 'classnames';
|
|
6
6
|
import GenericFormElement from '../GenericFormElement';
|
|
7
7
|
import './style.scss';
|
|
8
8
|
|
|
@@ -10,7 +10,9 @@ function Checkbox(props) {
|
|
|
10
10
|
const {
|
|
11
11
|
name,
|
|
12
12
|
value,
|
|
13
|
-
validate
|
|
13
|
+
validate,
|
|
14
|
+
disabled,
|
|
15
|
+
className
|
|
14
16
|
} = props;
|
|
15
17
|
return /*#__PURE__*/React.createElement(Field, {
|
|
16
18
|
required: true,
|
|
@@ -23,7 +25,7 @@ function Checkbox(props) {
|
|
|
23
25
|
}) => {
|
|
24
26
|
const name = `${props.name}--${props.value}`;
|
|
25
27
|
const checked = field.value && field.value.includes(value);
|
|
26
|
-
const classes =
|
|
28
|
+
const classes = c('WebformCheckboxes__checkbox__input', {
|
|
27
29
|
'icon-before': true,
|
|
28
30
|
'icon-checkmark': true,
|
|
29
31
|
'icon-variant-1': checked
|
|
@@ -48,7 +50,9 @@ function Checkbox(props) {
|
|
|
48
50
|
|
|
49
51
|
form.setFieldValue(field.name, Array.from(set));
|
|
50
52
|
form.setFieldTouched(field.name, true);
|
|
51
|
-
}
|
|
53
|
+
},
|
|
54
|
+
disabled: disabled,
|
|
55
|
+
className: className
|
|
52
56
|
})), props.label);
|
|
53
57
|
});
|
|
54
58
|
}
|
|
@@ -65,10 +69,13 @@ const Checkboxes = props => {
|
|
|
65
69
|
error,
|
|
66
70
|
type,
|
|
67
71
|
options,
|
|
68
|
-
displayRequiredIndicator
|
|
72
|
+
displayRequiredIndicator,
|
|
73
|
+
className,
|
|
74
|
+
wrapperClassName,
|
|
75
|
+
disabled = false
|
|
69
76
|
} = props;
|
|
70
77
|
return /*#__PURE__*/React.createElement(GenericFormElement, {
|
|
71
|
-
className: "Checkboxes",
|
|
78
|
+
className: c("Checkboxes", wrapperClassName),
|
|
72
79
|
title: title,
|
|
73
80
|
required: required,
|
|
74
81
|
description: description,
|
|
@@ -81,12 +88,15 @@ const Checkboxes = props => {
|
|
|
81
88
|
return /*#__PURE__*/React.createElement(Checkbox, {
|
|
82
89
|
key: value,
|
|
83
90
|
label: label,
|
|
84
|
-
className:
|
|
91
|
+
className: c(className, {
|
|
92
|
+
'error': error && touched
|
|
93
|
+
}),
|
|
85
94
|
name: fieldName,
|
|
86
95
|
type: type || 'text',
|
|
87
96
|
value: value,
|
|
88
97
|
placeholder: placeholder,
|
|
89
|
-
validate: validation
|
|
98
|
+
validate: validation,
|
|
99
|
+
disabled: disabled
|
|
90
100
|
});
|
|
91
101
|
}));
|
|
92
102
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import ReactDatePicker from 'react-datepicker';
|
|
3
3
|
import { Field } from 'formik';
|
|
4
|
+
import c from 'classnames';
|
|
4
5
|
import GenericFormElement from '../GenericFormElement';
|
|
5
6
|
import "react-datepicker/dist/react-datepicker.css";
|
|
6
7
|
import './style.scss';
|
|
@@ -17,11 +18,13 @@ const DatePicker = props => {
|
|
|
17
18
|
error,
|
|
18
19
|
type,
|
|
19
20
|
value,
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
displayRequiredIndicator,
|
|
22
|
+
className,
|
|
23
|
+
wrapperClassName,
|
|
24
|
+
disabled = false
|
|
22
25
|
} = props;
|
|
23
26
|
return /*#__PURE__*/React.createElement(GenericFormElement, {
|
|
24
|
-
className: "DatePicker",
|
|
27
|
+
className: c("DatePicker", wrapperClassName),
|
|
25
28
|
title: title,
|
|
26
29
|
required: required,
|
|
27
30
|
description: description,
|
|
@@ -37,16 +40,20 @@ const DatePicker = props => {
|
|
|
37
40
|
error: error,
|
|
38
41
|
type: type || "text",
|
|
39
42
|
value: value
|
|
40
|
-
}, (
|
|
43
|
+
}, ({
|
|
44
|
+
form
|
|
45
|
+
}) => {
|
|
41
46
|
return /*#__PURE__*/React.createElement(ReactDatePicker, {
|
|
42
47
|
selected: value && new Date(value) || null,
|
|
43
48
|
onChange: value => {
|
|
44
|
-
setFieldValue(fieldName, value);
|
|
49
|
+
form.setFieldValue(fieldName, value);
|
|
45
50
|
},
|
|
46
51
|
peekNextMonth: true,
|
|
47
52
|
showMonthDropdown: true,
|
|
48
53
|
showYearDropdown: true,
|
|
49
|
-
dropdownMode: "select"
|
|
54
|
+
dropdownMode: "select",
|
|
55
|
+
className: className,
|
|
56
|
+
disabled: disabled
|
|
50
57
|
});
|
|
51
58
|
}));
|
|
52
59
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useState, useCallback, useEffect } from 'react';
|
|
2
2
|
import moment from 'moment';
|
|
3
|
+
import c from 'classnames';
|
|
3
4
|
import SelectInput from '../Select/Input';
|
|
4
5
|
import GenericFormElement from '../GenericFormElement';
|
|
5
6
|
import './style.scss';
|
|
@@ -15,7 +16,10 @@ const DateSelect = props => {
|
|
|
15
16
|
values,
|
|
16
17
|
setFieldValue,
|
|
17
18
|
setFieldError,
|
|
18
|
-
displayRequiredIndicator
|
|
19
|
+
displayRequiredIndicator,
|
|
20
|
+
className,
|
|
21
|
+
wrapperClassName,
|
|
22
|
+
disabled = false
|
|
19
23
|
} = props; // Set all states for the date.
|
|
20
24
|
|
|
21
25
|
const [day, setDay] = useState();
|
|
@@ -96,7 +100,7 @@ const DateSelect = props => {
|
|
|
96
100
|
setFieldValue(fieldName, birthdate.format('YYYY-MM-DD'));
|
|
97
101
|
}, [day, month, year, fieldName, values, setFieldValue, setFieldError, requiredError]);
|
|
98
102
|
return /*#__PURE__*/React.createElement(GenericFormElement, {
|
|
99
|
-
className: "DateSelect",
|
|
103
|
+
className: c("DateSelect", wrapperClassName),
|
|
100
104
|
title: title,
|
|
101
105
|
required: required,
|
|
102
106
|
description: description,
|
|
@@ -105,6 +109,8 @@ const DateSelect = props => {
|
|
|
105
109
|
error: error,
|
|
106
110
|
displayRequiredIndicator: displayRequiredIndicator
|
|
107
111
|
}, /*#__PURE__*/React.createElement(SelectInput, {
|
|
112
|
+
className: className,
|
|
113
|
+
disabled: disabled,
|
|
108
114
|
fieldName: `${fieldName}[day]`,
|
|
109
115
|
options: renderDayOptions(),
|
|
110
116
|
value: day,
|
|
@@ -113,6 +119,8 @@ const DateSelect = props => {
|
|
|
113
119
|
setDay(e);
|
|
114
120
|
}
|
|
115
121
|
}), /*#__PURE__*/React.createElement(SelectInput, {
|
|
122
|
+
className: className,
|
|
123
|
+
disabled: disabled,
|
|
116
124
|
fieldName: `${fieldName}[month]`,
|
|
117
125
|
options: renderMonthOptions(),
|
|
118
126
|
value: month,
|
|
@@ -121,6 +129,8 @@ const DateSelect = props => {
|
|
|
121
129
|
setMonth(e);
|
|
122
130
|
}
|
|
123
131
|
}), /*#__PURE__*/React.createElement(SelectInput, {
|
|
132
|
+
className: className,
|
|
133
|
+
disabled: disabled,
|
|
124
134
|
fieldName: `${fieldName}[year]`,
|
|
125
135
|
options: renderYearOptions(),
|
|
126
136
|
value: year,
|
|
@@ -2,7 +2,61 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { Form, Formik } from 'formik';
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
const renderChildrenRecursively = (child, childProps, displayRequiredIndicator) => {
|
|
7
|
+
const {
|
|
8
|
+
fieldName,
|
|
9
|
+
type,
|
|
10
|
+
htmlType,
|
|
11
|
+
children
|
|
12
|
+
} = child.props;
|
|
13
|
+
|
|
14
|
+
if (type === 'submit' || htmlType === 'submit') {
|
|
15
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
16
|
+
disabled: childProps.isSubmitting
|
|
17
|
+
}, children);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const fieldProps = {
|
|
21
|
+
touched: childProps.touched[fieldName],
|
|
22
|
+
error: childProps.errors[fieldName],
|
|
23
|
+
value: childProps.values[fieldName],
|
|
24
|
+
displayRequiredIndicator: displayRequiredIndicator
|
|
25
|
+
};
|
|
26
|
+
return /*#__PURE__*/React.cloneElement(child, { ...child.props,
|
|
27
|
+
...fieldProps
|
|
28
|
+
}, React.Children.map(children, subchild => {
|
|
29
|
+
// Happens when we conditionally render elements.
|
|
30
|
+
if (!subchild) {
|
|
31
|
+
return null;
|
|
32
|
+
} // Happens for simple text nodes.
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
if (!subchild.props) {
|
|
36
|
+
return /*#__PURE__*/React.createElement("span", null, subchild);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const {
|
|
40
|
+
fieldName,
|
|
41
|
+
children
|
|
42
|
+
} = subchild.props;
|
|
43
|
+
const fieldProps = {
|
|
44
|
+
touched: childProps.touched[fieldName],
|
|
45
|
+
error: childProps.errors[fieldName],
|
|
46
|
+
value: childProps.values[fieldName],
|
|
47
|
+
displayRequiredIndicator: displayRequiredIndicator
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
if (children) {
|
|
51
|
+
return renderChildrenRecursively(subchild, { ...childProps
|
|
52
|
+
}, displayRequiredIndicator);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return /*#__PURE__*/React.cloneElement(subchild, { ...childProps,
|
|
56
|
+
...fieldProps
|
|
57
|
+
}, null);
|
|
58
|
+
}));
|
|
59
|
+
};
|
|
6
60
|
|
|
7
61
|
const FormikWrapper = props => {
|
|
8
62
|
const {
|
|
@@ -25,49 +79,8 @@ const FormikWrapper = props => {
|
|
|
25
79
|
validateOnMount: validateOnMount,
|
|
26
80
|
onReset: onReset
|
|
27
81
|
}, restProps), childProps => /*#__PURE__*/React.createElement(Form, null, React.Children.map(props.children, child => {
|
|
28
|
-
|
|
29
|
-
fieldName,
|
|
30
|
-
type,
|
|
31
|
-
htmlType,
|
|
32
|
-
children
|
|
33
|
-
} = child.props;
|
|
34
|
-
|
|
35
|
-
if (type === 'submit' || htmlType === 'submit') {
|
|
36
|
-
return /*#__PURE__*/React.cloneElement(child, {
|
|
37
|
-
disabled: childProps.isSubmitting
|
|
38
|
-
}, children);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const fieldProps = {
|
|
42
|
-
touched: childProps.touched[fieldName],
|
|
43
|
-
error: childProps.errors[fieldName],
|
|
44
|
-
value: childProps.values[fieldName],
|
|
45
|
-
displayRequiredIndicator: displayRequiredIndicator
|
|
46
|
-
};
|
|
47
|
-
return /*#__PURE__*/React.cloneElement(child, { ...childProps,
|
|
48
|
-
...fieldProps
|
|
49
|
-
}, null);
|
|
82
|
+
return renderChildrenRecursively(child, childProps, displayRequiredIndicator);
|
|
50
83
|
})));
|
|
51
84
|
};
|
|
52
85
|
|
|
53
|
-
FormikWrapper.defaultProps = {
|
|
54
|
-
onSubmit: () => {},
|
|
55
|
-
initialValues: {},
|
|
56
|
-
displayRequiredIndicator: "optional",
|
|
57
|
-
validate: () => {},
|
|
58
|
-
validateOnChange: true,
|
|
59
|
-
validateOnBlur: true,
|
|
60
|
-
validateOnMount: false,
|
|
61
|
-
onReset: () => {}
|
|
62
|
-
};
|
|
63
|
-
FormikWrapper.propTypes = {
|
|
64
|
-
onSubmit: PropTypes.func,
|
|
65
|
-
initialValues: PropTypes.object,
|
|
66
|
-
displayRequiredIndicator: PropTypes.oneOf(['optional', 'required', 'none']),
|
|
67
|
-
validate: PropTypes.func,
|
|
68
|
-
validateOnChange: PropTypes.bool,
|
|
69
|
-
validateOnBlur: PropTypes.bool,
|
|
70
|
-
validateOnMount: PropTypes.bool,
|
|
71
|
-
onReset: PropTypes.func
|
|
72
|
-
};
|
|
73
86
|
export default FormikWrapper;
|
|
@@ -2,11 +2,15 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { Field } from 'formik';
|
|
5
|
-
import
|
|
5
|
+
import c from 'classnames';
|
|
6
6
|
import GenericFormElement from '../GenericFormElement';
|
|
7
7
|
import './style.scss';
|
|
8
8
|
|
|
9
9
|
const Radio = props => {
|
|
10
|
+
const {
|
|
11
|
+
className,
|
|
12
|
+
disabled
|
|
13
|
+
} = props;
|
|
10
14
|
return /*#__PURE__*/React.createElement(Field, {
|
|
11
15
|
name: props.name,
|
|
12
16
|
validate: props.validate
|
|
@@ -15,14 +19,14 @@ const Radio = props => {
|
|
|
15
19
|
form
|
|
16
20
|
}) => {
|
|
17
21
|
const name = `${props.name}--${props.value}`;
|
|
18
|
-
const classes =
|
|
22
|
+
const classes = c('WebformRadios__radio__input', {
|
|
19
23
|
'icon-before': true,
|
|
20
24
|
'icon-radio': true,
|
|
21
25
|
'icon-variant-1': field.value && field.value.includes(props.value)
|
|
22
26
|
});
|
|
23
27
|
|
|
24
28
|
if (props.value === '__other__') {
|
|
25
|
-
const inputClasses =
|
|
29
|
+
const inputClasses = c({
|
|
26
30
|
hidden: field.value !== '__other__'
|
|
27
31
|
});
|
|
28
32
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -46,9 +50,11 @@ const Radio = props => {
|
|
|
46
50
|
htmlFor: name,
|
|
47
51
|
className: classes
|
|
48
52
|
}, /*#__PURE__*/React.createElement("input", _extends({}, field, {
|
|
53
|
+
className: className,
|
|
49
54
|
type: "radio",
|
|
50
55
|
id: name,
|
|
51
|
-
value: props.value
|
|
56
|
+
value: props.value,
|
|
57
|
+
disabled: disabled
|
|
52
58
|
})), props.label);
|
|
53
59
|
});
|
|
54
60
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Field } from 'formik';
|
|
3
|
+
import c from 'classnames';
|
|
3
4
|
import withMapping from '../../../Context/withMapping';
|
|
4
5
|
import WysiwygField from '../../WysiwygField';
|
|
5
6
|
|
|
@@ -14,21 +15,27 @@ const SearchField = props => {
|
|
|
14
15
|
touched,
|
|
15
16
|
error,
|
|
16
17
|
type,
|
|
17
|
-
value
|
|
18
|
+
value,
|
|
19
|
+
className,
|
|
20
|
+
wrapperClassName,
|
|
21
|
+
disabled = false
|
|
18
22
|
} = props;
|
|
19
23
|
return /*#__PURE__*/React.createElement("div", {
|
|
20
|
-
className: "SearchField"
|
|
24
|
+
className: c("SearchField", wrapperClassName)
|
|
21
25
|
}, title && /*#__PURE__*/React.createElement("label", {
|
|
22
26
|
htmlFor: fieldName
|
|
23
27
|
}, title, " ", !required && /*#__PURE__*/React.createElement("div", {
|
|
24
28
|
className: "WebformComponent--optional"
|
|
25
29
|
}, "- ", 'optioneel')), /*#__PURE__*/React.createElement(Field, {
|
|
26
|
-
className:
|
|
30
|
+
className: c(className, {
|
|
31
|
+
'error': error && touched
|
|
32
|
+
}),
|
|
27
33
|
name: fieldName,
|
|
28
34
|
type: type || 'text',
|
|
29
35
|
value: value,
|
|
30
36
|
placeholder: placeholder,
|
|
31
|
-
validate: validation
|
|
37
|
+
validate: validation,
|
|
38
|
+
disabled: disabled
|
|
32
39
|
}), description && /*#__PURE__*/React.createElement(WysiwygField, {
|
|
33
40
|
property: "schema:text",
|
|
34
41
|
html: description,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import SelectStyled from 'react-select';
|
|
3
|
+
import c from 'classnames';
|
|
3
4
|
import { Field } from 'formik';
|
|
4
5
|
import './style.scss';
|
|
5
6
|
|
|
@@ -12,7 +13,10 @@ const SelectInput = props => {
|
|
|
12
13
|
defaultValue,
|
|
13
14
|
onChange,
|
|
14
15
|
options,
|
|
15
|
-
placeholder
|
|
16
|
+
placeholder,
|
|
17
|
+
disabled,
|
|
18
|
+
className,
|
|
19
|
+
wrapperClassName
|
|
16
20
|
} = props;
|
|
17
21
|
let {
|
|
18
22
|
selectedOption
|
|
@@ -48,10 +52,11 @@ const SelectInput = props => {
|
|
|
48
52
|
}) => {
|
|
49
53
|
return /*#__PURE__*/React.createElement(SelectStyled, {
|
|
50
54
|
id: id,
|
|
51
|
-
className: "Select__select",
|
|
52
|
-
classNamePrefix: "Select__inner",
|
|
55
|
+
className: c("Select__select", className),
|
|
56
|
+
classNamePrefix: c("Select__inner", wrapperClassName),
|
|
53
57
|
value: selectedOption || "",
|
|
54
58
|
defaultValue: defaultValue,
|
|
59
|
+
disabled: disabled,
|
|
55
60
|
onChange: e => {
|
|
56
61
|
if (e) {
|
|
57
62
|
if (onChange) {
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
1
3
|
import React from 'react';
|
|
4
|
+
import c from 'classnames';
|
|
2
5
|
import GenericFormElement from '../GenericFormElement';
|
|
3
6
|
import SelectInput from './Input';
|
|
4
7
|
import './style.scss';
|
|
@@ -11,10 +14,13 @@ const Select = props => {
|
|
|
11
14
|
description,
|
|
12
15
|
error,
|
|
13
16
|
touched,
|
|
14
|
-
displayRequiredIndicator
|
|
17
|
+
displayRequiredIndicator,
|
|
18
|
+
className,
|
|
19
|
+
wrapperClassName,
|
|
20
|
+
disabled = false
|
|
15
21
|
} = props;
|
|
16
22
|
return /*#__PURE__*/React.createElement(GenericFormElement, {
|
|
17
|
-
className: "Select",
|
|
23
|
+
className: c("Select", wrapperClassName),
|
|
18
24
|
title: title,
|
|
19
25
|
required: required,
|
|
20
26
|
description: description,
|
|
@@ -22,7 +28,12 @@ const Select = props => {
|
|
|
22
28
|
touched: touched,
|
|
23
29
|
error: error,
|
|
24
30
|
displayRequiredIndicator: displayRequiredIndicator
|
|
25
|
-
}, /*#__PURE__*/React.createElement(SelectInput, props
|
|
31
|
+
}, /*#__PURE__*/React.createElement(SelectInput, _extends({}, props, {
|
|
32
|
+
className: c(className, {
|
|
33
|
+
'error': error && touched
|
|
34
|
+
}),
|
|
35
|
+
disabled: disabled
|
|
36
|
+
})));
|
|
26
37
|
};
|
|
27
38
|
|
|
28
39
|
export default Select;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Field } from 'formik';
|
|
3
|
+
import c from 'classnames';
|
|
3
4
|
import withMapping from '../../../Context/withMapping';
|
|
4
5
|
import GenericFormElement from '../GenericFormElement';
|
|
5
6
|
import './style.scss';
|
|
@@ -16,7 +17,10 @@ const TextField = props => {
|
|
|
16
17
|
error,
|
|
17
18
|
value,
|
|
18
19
|
displayRequiredIndicator,
|
|
19
|
-
onChange
|
|
20
|
+
onChange,
|
|
21
|
+
className,
|
|
22
|
+
wrapperClassName,
|
|
23
|
+
disabled = false
|
|
20
24
|
} = props;
|
|
21
25
|
const type = props.type || "text";
|
|
22
26
|
|
|
@@ -24,7 +28,10 @@ const TextField = props => {
|
|
|
24
28
|
const {
|
|
25
29
|
handleChange
|
|
26
30
|
} = props;
|
|
27
|
-
|
|
31
|
+
|
|
32
|
+
if (handleChange) {
|
|
33
|
+
handleChange(e);
|
|
34
|
+
}
|
|
28
35
|
|
|
29
36
|
if (onChange) {
|
|
30
37
|
onChange(e);
|
|
@@ -32,7 +39,7 @@ const TextField = props => {
|
|
|
32
39
|
};
|
|
33
40
|
|
|
34
41
|
return /*#__PURE__*/React.createElement(GenericFormElement, {
|
|
35
|
-
className: "TextField",
|
|
42
|
+
className: c("TextField", wrapperClassName),
|
|
36
43
|
title: title,
|
|
37
44
|
required: required,
|
|
38
45
|
description: description,
|
|
@@ -41,13 +48,16 @@ const TextField = props => {
|
|
|
41
48
|
error: error,
|
|
42
49
|
displayRequiredIndicator: displayRequiredIndicator
|
|
43
50
|
}, /*#__PURE__*/React.createElement(Field, {
|
|
44
|
-
className:
|
|
51
|
+
className: c(className, {
|
|
52
|
+
'error': error && touched
|
|
53
|
+
}),
|
|
45
54
|
name: fieldName,
|
|
46
55
|
type: type,
|
|
47
56
|
value: value,
|
|
48
57
|
placeholder: placeholder,
|
|
49
58
|
validate: validation,
|
|
50
|
-
|
|
59
|
+
onKeyUp: handleChange,
|
|
60
|
+
disabled: disabled
|
|
51
61
|
}));
|
|
52
62
|
};
|
|
53
63
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Field } from 'formik';
|
|
3
|
+
import c from 'classnames';
|
|
3
4
|
import GenericFormElement from '../GenericFormElement';
|
|
4
5
|
import './style.scss';
|
|
5
6
|
|
|
@@ -15,10 +16,13 @@ const Textarea = props => {
|
|
|
15
16
|
error,
|
|
16
17
|
rows,
|
|
17
18
|
value,
|
|
18
|
-
displayRequiredIndicator
|
|
19
|
+
displayRequiredIndicator,
|
|
20
|
+
className,
|
|
21
|
+
wrapperClassName,
|
|
22
|
+
disabled = false
|
|
19
23
|
} = props;
|
|
20
24
|
return /*#__PURE__*/React.createElement(GenericFormElement, {
|
|
21
|
-
className: "Textarea",
|
|
25
|
+
className: c("Textarea", wrapperClassName),
|
|
22
26
|
title: title,
|
|
23
27
|
required: required,
|
|
24
28
|
description: description,
|
|
@@ -27,13 +31,16 @@ const Textarea = props => {
|
|
|
27
31
|
error: error,
|
|
28
32
|
displayRequiredIndicator: displayRequiredIndicator
|
|
29
33
|
}, /*#__PURE__*/React.createElement(Field, {
|
|
30
|
-
className:
|
|
34
|
+
className: c(className, {
|
|
35
|
+
'error': error && touched
|
|
36
|
+
}),
|
|
31
37
|
name: fieldName,
|
|
32
38
|
component: "textarea",
|
|
33
39
|
value: value,
|
|
34
40
|
placeholder: placeholder,
|
|
35
41
|
rows: rows,
|
|
36
|
-
validate: validation
|
|
42
|
+
validate: validation,
|
|
43
|
+
disabled: disabled
|
|
37
44
|
}));
|
|
38
45
|
};
|
|
39
46
|
|