@uncinc/uncinc-react-kitchen-sink 2.3.3 → 2.3.5
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/Context/withMapping.js +1 -6
- package/dist/components/AbbreviationAnnotation/index.js +47 -0
- package/dist/components/AbbreviationAnnotation/stories.js +23 -0
- package/dist/components/AbbreviationAnnotation/stories.scss +39 -0
- package/dist/components/AbbreviationAnnotation/style.scss +33 -0
- package/dist/components/Accordion/AccordionItem/index.js +0 -5
- package/dist/components/Accordion/AccordionItemVariant/index.js +0 -5
- package/dist/components/Accordion/index.js +0 -2
- package/dist/components/ApiAutocomplete/index.js +6 -12
- package/dist/components/Button/index.js +4 -10
- package/dist/components/Cookie/Checkbox/index.js +0 -2
- package/dist/components/Cookie/index.js +39 -34
- package/dist/components/FontSizeSwitcher/index.js +2 -8
- package/dist/components/Form/Checkbox/index.js +1 -4
- package/dist/components/Form/Checkbox/stories.js +0 -2
- package/dist/components/Form/Checkboxes/index.js +1 -7
- package/dist/components/Form/Checkboxes/index.test.js +8 -4
- package/dist/components/Form/Checkboxes/stories.js +1 -4
- package/dist/components/Form/Date/index.js +1 -4
- package/dist/components/Form/Date/stories.js +0 -2
- package/dist/components/Form/DatePicker/index.js +0 -2
- package/dist/components/Form/DatePicker/stories.js +0 -2
- package/dist/components/Form/DateSelect/index.js +110 -85
- package/dist/components/Form/DateSelect/stories.js +24 -15
- package/dist/components/Form/DateSelect/style.scss +10 -4
- package/dist/components/Form/Email/index.js +1 -4
- package/dist/components/Form/Email/stories.js +0 -2
- package/dist/components/Form/FormikWrapper/index.js +9 -15
- package/dist/components/Form/GenericFormElement/index.js +0 -2
- package/dist/components/Form/Number/index.js +12 -13
- package/dist/components/Form/Number/stories.js +0 -2
- package/dist/components/Form/RadioButtons/index.js +1 -7
- package/dist/components/Form/RadioButtons/index.test.js +8 -4
- package/dist/components/Form/RadioButtons/stories.js +1 -4
- package/dist/components/Form/SearchField/index.js +0 -2
- package/dist/components/Form/Select/Input/index.js +6 -14
- package/dist/components/Form/Select/index.js +1 -4
- package/dist/components/Form/Select/stories.js +0 -4
- package/dist/components/Form/TextField/index.js +0 -6
- package/dist/components/Form/TextField/index.test.js +8 -4
- package/dist/components/Form/TextField/stories.js +1 -4
- package/dist/components/Form/Textarea/index.js +0 -2
- package/dist/components/Form/Textarea/stories.js +0 -2
- package/dist/components/Hamburger/index.js +0 -2
- package/dist/components/Header/index.js +4 -9
- package/dist/components/Image/Background/index.js +1 -7
- package/dist/components/Image/LazyLoadWrapper/index.js +0 -12
- package/dist/components/Image/Picture/index.js +4 -19
- package/dist/components/Image/index.js +0 -4
- package/dist/components/InlineMenu/index.js +0 -9
- package/dist/components/Layout/Container/index.js +1 -4
- package/dist/components/Layout/Container/stories.js +0 -3
- package/dist/components/Layout/QuickLayout/Auto/index.js +0 -2
- package/dist/components/Layout/QuickLayout/Center/index.js +0 -2
- package/dist/components/Layout/QuickLayout/Clamp/index.js +0 -2
- package/dist/components/Layout/QuickLayout/Sidebar/index.js +0 -2
- package/dist/components/Layout/QuickLayout/SpaceBetween/index.js +0 -2
- package/dist/components/Layout/QuickLayout/Stack/index.js +1 -4
- package/dist/components/Layout/QuickLayout/Wrap/index.js +0 -2
- package/dist/components/Layout/QuickLayout/index.js +0 -9
- package/dist/components/Lottie/LottieAnimation/index.js +12 -17
- package/dist/components/Lottie/LottieAnimationWithMousePosition.js +8 -9
- package/dist/components/Lottie/index.js +3 -3
- package/dist/components/Lottie/stories.js +10 -5
- package/dist/components/MagicLine/index.js +0 -14
- package/dist/components/MagicLine/stories.js +0 -2
- package/dist/components/NavigationScroll/index.js +2 -12
- package/dist/components/Pagination/index.js +0 -7
- package/dist/components/SearchKit/Facets/ChipFacet/index.js +0 -2
- package/dist/components/SearchKit/Facets/HierarchicalFilterFacet/index.js +0 -2
- package/dist/components/SearchKit/Facets/HierarchicalMenuFacet/index.js +0 -2
- package/dist/components/SearchKit/Facets/SelectFacet/index.js +0 -6
- package/dist/components/SearchKit/Query/index.js +3 -6
- package/dist/components/SearchKit/SearchFacets/index.js +0 -7
- package/dist/components/SearchKit/SearchField/index.js +0 -9
- package/dist/components/SearchKit/SearchLoadMore/index.js +0 -7
- package/dist/components/SearchKit/SearchPage/index.js +3 -9
- package/dist/components/SearchKit/SearchPagination/index.js +0 -5
- package/dist/components/SearchKit/SearchReset/index.js +0 -2
- package/dist/components/SearchKit/SearchResults/index.js +9 -16
- package/dist/components/SearchKit/SearchSelectedFilters/index.js +0 -4
- package/dist/components/SearchKit/SearchSorting/index.js +2 -4
- package/dist/components/SearchKit/index.js +0 -3
- package/dist/components/SearchKit/stories.js +2 -7
- package/dist/components/Share/index.js +0 -3
- package/dist/components/Sliders/SliderRelated/index.js +1 -6
- package/dist/components/Sliders/SliderRelated/stories.js +1 -4
- package/dist/components/Webform/WebformActions/index.js +0 -2
- package/dist/components/Webform/WebformCheckbox/index.js +1 -8
- package/dist/components/Webform/WebformCheckboxes/index.js +1 -9
- package/dist/components/Webform/WebformContainer/index.js +5 -6
- package/dist/components/Webform/WebformDate/index.js +12 -18
- package/dist/components/Webform/WebformMapper/index.js +1 -18
- package/dist/components/Webform/WebformNumber/index.js +1 -4
- package/dist/components/Webform/WebformRadioButtons/index.js +1 -9
- package/dist/components/Webform/WebformSelect/index.js +1 -9
- package/dist/components/Webform/WebformTextField/index.js +1 -8
- package/dist/components/Webform/WebformTextarea/index.js +1 -8
- package/dist/components/Webform/WebformWizardPage/index.js +6 -8
- package/dist/components/Webform/index.js +1 -8
- package/dist/components/Webform/withStates.js +6 -19
- package/dist/components/WysiwygField/index.js +1 -8
- package/dist/components/WysiwygField/stories.js +4 -14
- package/dist/config/constants.js +3 -4
- package/dist/config/i18next/index.js +23 -0
- package/dist/config/i18next/locales/en.json +22 -0
- package/dist/config/i18next/locales/nl.json +22 -0
- package/dist/helpers/gtm.js +11 -15
- package/dist/helpers/link.js +0 -4
- package/dist/helpers/useValueForCurrentViewPort.js +20 -14
- package/dist/hooks/useOnScreen.js +2 -2
- package/dist/hooks/usePrevious.js +3 -2
- package/dist/hooks/useScrollPosition.js +0 -3
- package/dist/hooks/useWindowDimensions.js +0 -3
- package/dist/index.js +2 -1
- package/dist/styles/assets/_base.scss +0 -1
- package/package.json +14 -5
- package/dist/pages/api/graphql.js +0 -25
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import TextField from '../TextField';
|
|
5
|
-
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
6
5
|
const Number = props => {
|
|
6
|
+
const {
|
|
7
|
+
t
|
|
8
|
+
} = useTranslation();
|
|
7
9
|
const {
|
|
8
10
|
min,
|
|
9
11
|
max,
|
|
@@ -11,25 +13,23 @@ const Number = props => {
|
|
|
11
13
|
required,
|
|
12
14
|
requiredError
|
|
13
15
|
} = props;
|
|
14
|
-
|
|
15
16
|
const validation = value => {
|
|
16
17
|
let error;
|
|
17
|
-
|
|
18
18
|
if (required && !value) {
|
|
19
|
-
error = requiredError ||
|
|
19
|
+
error = requiredError || t('webform.required');
|
|
20
20
|
}
|
|
21
|
-
|
|
22
21
|
if (min && parseInt(value) < min) {
|
|
23
|
-
error =
|
|
22
|
+
error = t('webform.number.min', {
|
|
23
|
+
min: min
|
|
24
|
+
});
|
|
24
25
|
}
|
|
25
|
-
|
|
26
26
|
if (max && parseInt(value) > max) {
|
|
27
|
-
error =
|
|
27
|
+
error = t('webform.number.max', {
|
|
28
|
+
max: max
|
|
29
|
+
});
|
|
28
30
|
}
|
|
29
|
-
|
|
30
31
|
return error;
|
|
31
32
|
};
|
|
32
|
-
|
|
33
33
|
return /*#__PURE__*/React.createElement(TextField, _extends({}, props, {
|
|
34
34
|
type: "number",
|
|
35
35
|
validation: validation,
|
|
@@ -38,5 +38,4 @@ const Number = props => {
|
|
|
38
38
|
step: step
|
|
39
39
|
}));
|
|
40
40
|
};
|
|
41
|
-
|
|
42
41
|
export default Number;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import { Field } from 'formik';
|
|
5
4
|
import c from 'classnames';
|
|
6
5
|
import GenericFormElement from '../GenericFormElement';
|
|
7
6
|
import './style.scss';
|
|
8
|
-
|
|
9
7
|
const Radio = props => {
|
|
10
8
|
const {
|
|
11
9
|
className,
|
|
@@ -24,7 +22,6 @@ const Radio = props => {
|
|
|
24
22
|
'icon-radio': true,
|
|
25
23
|
'icon-variant-1': field.value && field.value === props.value
|
|
26
24
|
});
|
|
27
|
-
|
|
28
25
|
if (props.value === '__other__') {
|
|
29
26
|
const inputClasses = c({
|
|
30
27
|
hidden: field.value !== '__other__'
|
|
@@ -44,7 +41,6 @@ const Radio = props => {
|
|
|
44
41
|
}
|
|
45
42
|
}));
|
|
46
43
|
}
|
|
47
|
-
|
|
48
44
|
return /*#__PURE__*/React.createElement("label", {
|
|
49
45
|
htmlFor: name,
|
|
50
46
|
className: classes
|
|
@@ -57,7 +53,6 @@ const Radio = props => {
|
|
|
57
53
|
})), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("span", null, props.label), props.description && /*#__PURE__*/React.createElement("span", null, props.description)));
|
|
58
54
|
});
|
|
59
55
|
};
|
|
60
|
-
|
|
61
56
|
const RadioButtons = props => {
|
|
62
57
|
const {
|
|
63
58
|
title,
|
|
@@ -102,5 +97,4 @@ const RadioButtons = props => {
|
|
|
102
97
|
});
|
|
103
98
|
}));
|
|
104
99
|
};
|
|
105
|
-
|
|
106
100
|
export default RadioButtons;
|
|
@@ -4,8 +4,9 @@ import { mount } from 'enzyme';
|
|
|
4
4
|
import { act } from '@testing-library/react';
|
|
5
5
|
import sinon from 'sinon';
|
|
6
6
|
import sinonChai from 'sinon-chai';
|
|
7
|
-
import { RadioButtons } from './stories';
|
|
7
|
+
import { RadioButtons } from './stories';
|
|
8
8
|
|
|
9
|
+
// Use sinon-chai for spies.
|
|
9
10
|
chai.use(sinonChai);
|
|
10
11
|
describe('<RadioButtons />', () => {
|
|
11
12
|
it('renders 5 label elements', () => {
|
|
@@ -42,17 +43,20 @@ describe('<RadioButtons />', () => {
|
|
|
42
43
|
input.at(2).simulate('change');
|
|
43
44
|
await new Promise(resolve => {
|
|
44
45
|
setTimeout(resolve);
|
|
45
|
-
});
|
|
46
|
+
});
|
|
46
47
|
|
|
48
|
+
// Submit values, and wait for Formik to complete.
|
|
47
49
|
wrapper.find('Formik').simulate('submit');
|
|
48
50
|
await new Promise(resolve => {
|
|
49
51
|
setTimeout(resolve);
|
|
50
52
|
});
|
|
51
53
|
});
|
|
52
|
-
wrapper.update();
|
|
54
|
+
wrapper.update();
|
|
53
55
|
|
|
54
|
-
|
|
56
|
+
// Should not display an error message.
|
|
57
|
+
expect(wrapper.find('div.RadioButtons__error')).to.have.lengthOf(0);
|
|
55
58
|
|
|
59
|
+
// Submitted values should contain my value.
|
|
56
60
|
expect(onSubmitCallback).to.have.been.calledWith({
|
|
57
61
|
poison: 'rum'
|
|
58
62
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import FormikWrapper from '../FormikWrapper';
|
|
5
4
|
import FormikRadio from '.';
|
|
@@ -31,11 +30,9 @@ export const RadioButtons = props => {
|
|
|
31
30
|
},
|
|
32
31
|
validation: value => {
|
|
33
32
|
let error;
|
|
34
|
-
|
|
35
33
|
if (!value) {
|
|
36
34
|
error = 'This field is required';
|
|
37
35
|
}
|
|
38
|
-
|
|
39
36
|
return error;
|
|
40
37
|
},
|
|
41
38
|
otherLabel: "Anders"
|
|
@@ -3,7 +3,6 @@ import { Field } from 'formik';
|
|
|
3
3
|
import c from 'classnames';
|
|
4
4
|
import withMapping from '../../../Context/withMapping';
|
|
5
5
|
import WysiwygField from '../../WysiwygField';
|
|
6
|
-
|
|
7
6
|
const SearchField = props => {
|
|
8
7
|
const {
|
|
9
8
|
title,
|
|
@@ -44,5 +43,4 @@ const SearchField = props => {
|
|
|
44
43
|
className: "SearchField__error WebformComponent--error"
|
|
45
44
|
}, error) : null);
|
|
46
45
|
};
|
|
47
|
-
|
|
48
46
|
export default withMapping(SearchField);
|
|
@@ -3,7 +3,6 @@ import SelectStyled from 'react-select';
|
|
|
3
3
|
import c from 'classnames';
|
|
4
4
|
import { Field } from 'formik';
|
|
5
5
|
import './style.scss';
|
|
6
|
-
|
|
7
6
|
const SelectInput = props => {
|
|
8
7
|
const {
|
|
9
8
|
fieldName,
|
|
@@ -18,15 +17,16 @@ const SelectInput = props => {
|
|
|
18
17
|
className,
|
|
19
18
|
wrapperClassName,
|
|
20
19
|
isClearable = true,
|
|
20
|
+
isSearchable = true,
|
|
21
21
|
multiple = false,
|
|
22
22
|
size
|
|
23
23
|
} = props;
|
|
24
24
|
let {
|
|
25
25
|
selectedOption
|
|
26
|
-
} = props;
|
|
26
|
+
} = props;
|
|
27
27
|
|
|
28
|
+
// Check if options is [{value, label}] or {value: label}.
|
|
28
29
|
let optionsTransformed = options;
|
|
29
|
-
|
|
30
30
|
if (!Array.isArray(options)) {
|
|
31
31
|
optionsTransformed = Object.keys(options).map(value => {
|
|
32
32
|
const label = options[value];
|
|
@@ -35,25 +35,22 @@ const SelectInput = props => {
|
|
|
35
35
|
label: label
|
|
36
36
|
};
|
|
37
37
|
});
|
|
38
|
-
}
|
|
39
|
-
|
|
38
|
+
}
|
|
40
39
|
|
|
40
|
+
// If the selected option is not set, find the currently selected option by value.
|
|
41
41
|
if (!selectedOption) {
|
|
42
42
|
if (multiple) {
|
|
43
43
|
const _value = value !== undefined ? value : defaultValue || [];
|
|
44
|
-
|
|
45
44
|
selectedOption = optionsTransformed.filter(option => {
|
|
46
45
|
return _value.includes(option.value);
|
|
47
46
|
});
|
|
48
47
|
} else {
|
|
49
48
|
const _value = value !== undefined ? value : defaultValue || '';
|
|
50
|
-
|
|
51
49
|
selectedOption = optionsTransformed.find(option => {
|
|
52
50
|
return option.value === _value;
|
|
53
51
|
});
|
|
54
52
|
}
|
|
55
53
|
}
|
|
56
|
-
|
|
57
54
|
return /*#__PURE__*/React.createElement(Field, {
|
|
58
55
|
required: true,
|
|
59
56
|
name: fieldName,
|
|
@@ -72,7 +69,6 @@ const SelectInput = props => {
|
|
|
72
69
|
disabled: disabled,
|
|
73
70
|
onChange: e => {
|
|
74
71
|
let value = '';
|
|
75
|
-
|
|
76
72
|
if (e) {
|
|
77
73
|
if (multiple) {
|
|
78
74
|
value = e.map(item => {
|
|
@@ -86,11 +82,9 @@ const SelectInput = props => {
|
|
|
86
82
|
value = [];
|
|
87
83
|
}
|
|
88
84
|
}
|
|
89
|
-
|
|
90
85
|
if (onChange) {
|
|
91
86
|
onChange(value);
|
|
92
87
|
}
|
|
93
|
-
|
|
94
88
|
form.setFieldValue(fieldName, value);
|
|
95
89
|
},
|
|
96
90
|
options: optionsTransformed,
|
|
@@ -99,15 +93,14 @@ const SelectInput = props => {
|
|
|
99
93
|
if (option.disabled) {
|
|
100
94
|
return true;
|
|
101
95
|
}
|
|
102
|
-
|
|
103
96
|
if (size && selectedOption.length >= size) {
|
|
104
97
|
return true;
|
|
105
98
|
}
|
|
106
|
-
|
|
107
99
|
return false;
|
|
108
100
|
},
|
|
109
101
|
placeholder: placeholder,
|
|
110
102
|
isClearable: isClearable,
|
|
103
|
+
isSearchable: isSearchable,
|
|
111
104
|
theme: {
|
|
112
105
|
borderRadius: 0,
|
|
113
106
|
colors: {
|
|
@@ -133,5 +126,4 @@ const SelectInput = props => {
|
|
|
133
126
|
});
|
|
134
127
|
});
|
|
135
128
|
};
|
|
136
|
-
|
|
137
129
|
export default SelectInput;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import c from 'classnames';
|
|
5
4
|
import GenericFormElement from '../GenericFormElement';
|
|
6
5
|
import SelectInput from './Input';
|
|
7
6
|
import './style.scss';
|
|
8
|
-
|
|
9
7
|
const Select = props => {
|
|
10
8
|
const {
|
|
11
9
|
title,
|
|
@@ -37,5 +35,4 @@ const Select = props => {
|
|
|
37
35
|
multiple: multiple
|
|
38
36
|
})));
|
|
39
37
|
};
|
|
40
|
-
|
|
41
38
|
export default Select;
|
|
@@ -20,11 +20,9 @@ export const Select = () => {
|
|
|
20
20
|
defaultValue: "wine",
|
|
21
21
|
validation: value => {
|
|
22
22
|
let error;
|
|
23
|
-
|
|
24
23
|
if (!value) {
|
|
25
24
|
error = 'Dit is een vereist veld.';
|
|
26
25
|
}
|
|
27
|
-
|
|
28
26
|
return error;
|
|
29
27
|
},
|
|
30
28
|
onChange: e => {
|
|
@@ -50,11 +48,9 @@ export const SelectMultiple = () => {
|
|
|
50
48
|
defaultValue: ['wine'],
|
|
51
49
|
validation: value => {
|
|
52
50
|
let error;
|
|
53
|
-
|
|
54
51
|
if (!value) {
|
|
55
52
|
error = 'Dit is een vereist veld.';
|
|
56
53
|
}
|
|
57
|
-
|
|
58
54
|
return error;
|
|
59
55
|
},
|
|
60
56
|
onChange: e => {
|
|
@@ -4,7 +4,6 @@ import c from 'classnames';
|
|
|
4
4
|
import withMapping from '../../../Context/withMapping';
|
|
5
5
|
import GenericFormElement from '../GenericFormElement';
|
|
6
6
|
import './style.scss';
|
|
7
|
-
|
|
8
7
|
const TextField = props => {
|
|
9
8
|
const {
|
|
10
9
|
title,
|
|
@@ -23,21 +22,17 @@ const TextField = props => {
|
|
|
23
22
|
disabled = false
|
|
24
23
|
} = props;
|
|
25
24
|
const type = props.type || "text";
|
|
26
|
-
|
|
27
25
|
const handleChange = e => {
|
|
28
26
|
const {
|
|
29
27
|
handleChange
|
|
30
28
|
} = props;
|
|
31
|
-
|
|
32
29
|
if (handleChange) {
|
|
33
30
|
handleChange(e);
|
|
34
31
|
}
|
|
35
|
-
|
|
36
32
|
if (onChange) {
|
|
37
33
|
onChange(e);
|
|
38
34
|
}
|
|
39
35
|
};
|
|
40
|
-
|
|
41
36
|
return /*#__PURE__*/React.createElement(GenericFormElement, {
|
|
42
37
|
className: c("TextField", wrapperClassName),
|
|
43
38
|
title: title,
|
|
@@ -60,5 +55,4 @@ const TextField = props => {
|
|
|
60
55
|
disabled: disabled
|
|
61
56
|
}));
|
|
62
57
|
};
|
|
63
|
-
|
|
64
58
|
export default withMapping(TextField);
|
|
@@ -4,8 +4,9 @@ import { mount } from 'enzyme';
|
|
|
4
4
|
import { act } from '@testing-library/react';
|
|
5
5
|
import sinon from 'sinon';
|
|
6
6
|
import sinonChai from 'sinon-chai';
|
|
7
|
-
import { TextField } from './stories';
|
|
7
|
+
import { TextField } from './stories';
|
|
8
8
|
|
|
9
|
+
// Use sinon-chai for spies.
|
|
9
10
|
chai.use(sinonChai);
|
|
10
11
|
describe('<TextField />', () => {
|
|
11
12
|
it('renders a label element', () => {
|
|
@@ -41,17 +42,20 @@ describe('<TextField />', () => {
|
|
|
41
42
|
input.simulate('change');
|
|
42
43
|
await new Promise(resolve => {
|
|
43
44
|
setTimeout(resolve);
|
|
44
|
-
});
|
|
45
|
+
});
|
|
45
46
|
|
|
47
|
+
// Submit values, and wait for Formik to complete.
|
|
46
48
|
wrapper.find('Formik').simulate('submit');
|
|
47
49
|
await new Promise(resolve => {
|
|
48
50
|
setTimeout(resolve);
|
|
49
51
|
});
|
|
50
52
|
});
|
|
51
|
-
wrapper.update();
|
|
53
|
+
wrapper.update();
|
|
52
54
|
|
|
53
|
-
|
|
55
|
+
// Should not display an error message.
|
|
56
|
+
expect(wrapper.find('div.TextField__error')).to.have.lengthOf(0);
|
|
54
57
|
|
|
58
|
+
// Submitted values should contain my value.
|
|
55
59
|
expect(onSubmitCallback).to.have.been.calledWith({
|
|
56
60
|
firstname: value
|
|
57
61
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import FormikWrapper from '../FormikWrapper';
|
|
5
4
|
import FormikTextField from '.';
|
|
@@ -20,11 +19,9 @@ export const TextField = props => {
|
|
|
20
19
|
fieldName: "firstname",
|
|
21
20
|
validation: value => {
|
|
22
21
|
let error;
|
|
23
|
-
|
|
24
22
|
if (!value) {
|
|
25
23
|
error = 'Dit is een vereist veld.';
|
|
26
24
|
}
|
|
27
|
-
|
|
28
25
|
return error;
|
|
29
26
|
},
|
|
30
27
|
onChange: e => console.log(e.target.value)
|
|
@@ -3,7 +3,6 @@ import { Field } from 'formik';
|
|
|
3
3
|
import c from 'classnames';
|
|
4
4
|
import GenericFormElement from '../GenericFormElement';
|
|
5
5
|
import './style.scss';
|
|
6
|
-
|
|
7
6
|
const Textarea = props => {
|
|
8
7
|
const {
|
|
9
8
|
title,
|
|
@@ -43,5 +42,4 @@ const Textarea = props => {
|
|
|
43
42
|
disabled: disabled
|
|
44
43
|
}));
|
|
45
44
|
};
|
|
46
|
-
|
|
47
45
|
export default Textarea;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './style.scss';
|
|
3
|
-
|
|
4
3
|
const Hamburger = ({
|
|
5
4
|
onClick,
|
|
6
5
|
numberOfLines
|
|
@@ -16,7 +15,6 @@ const Hamburger = ({
|
|
|
16
15
|
}).map((item, index) => /*#__PURE__*/React.createElement("span", {
|
|
17
16
|
key: index
|
|
18
17
|
}))));
|
|
19
|
-
|
|
20
18
|
Hamburger.defaultProps = {
|
|
21
19
|
onClick: () => {},
|
|
22
20
|
numberOfLines: 3
|
|
@@ -4,7 +4,6 @@ import Container from '../Layout/Container';
|
|
|
4
4
|
import Hamburger from '../Hamburger';
|
|
5
5
|
import NavigationScroll from '../NavigationScroll';
|
|
6
6
|
import './style.scss';
|
|
7
|
-
|
|
8
7
|
const Header = ({
|
|
9
8
|
logo,
|
|
10
9
|
menu,
|
|
@@ -24,18 +23,17 @@ const Header = ({
|
|
|
24
23
|
"Header--force-hamburger": forceHamburger,
|
|
25
24
|
"show-nav": active
|
|
26
25
|
});
|
|
27
|
-
|
|
28
26
|
if (forceHamburger) {
|
|
29
|
-
import('./style-force-hamburger.scss').then(() => {
|
|
27
|
+
import('./style-force-hamburger.scss').then(() => {
|
|
28
|
+
// Do nothing.
|
|
30
29
|
});
|
|
31
30
|
} else {
|
|
32
|
-
import('./style-default.scss').then(() => {
|
|
31
|
+
import('./style-default.scss').then(() => {
|
|
32
|
+
// Do nothing.
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
|
|
36
35
|
const onUpdateNavigationScroll = (isVisible, hasReachedTop, scrolledPastNavHeight) => {
|
|
37
36
|
const shouldUpdate = state.visible !== isVisible || state.reachedTop !== hasReachedTop || state.scrolledPastNavHeight !== scrolledPastNavHeight;
|
|
38
|
-
|
|
39
37
|
if (shouldUpdate) {
|
|
40
38
|
setState({
|
|
41
39
|
scrolledPastNavHeight,
|
|
@@ -44,7 +42,6 @@ const Header = ({
|
|
|
44
42
|
});
|
|
45
43
|
}
|
|
46
44
|
};
|
|
47
|
-
|
|
48
45
|
const headerComponent = /*#__PURE__*/React.createElement("header", {
|
|
49
46
|
className: className
|
|
50
47
|
}, /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement("div", {
|
|
@@ -64,7 +61,6 @@ const Header = ({
|
|
|
64
61
|
}))))), subMenu && /*#__PURE__*/React.createElement("div", {
|
|
65
62
|
className: "Header__subMenu"
|
|
66
63
|
}, /*#__PURE__*/React.createElement(Container, null, subMenu)));
|
|
67
|
-
|
|
68
64
|
if (withAnimation) {
|
|
69
65
|
return /*#__PURE__*/React.createElement(NavigationScroll, {
|
|
70
66
|
onUpdate: onUpdateNavigationScroll,
|
|
@@ -74,5 +70,4 @@ const Header = ({
|
|
|
74
70
|
return headerComponent;
|
|
75
71
|
}
|
|
76
72
|
};
|
|
77
|
-
|
|
78
73
|
export default Header;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
3
2
|
import React, { useRef } from 'react';
|
|
4
3
|
import c from 'classnames';
|
|
5
4
|
import Picture from '../Picture';
|
|
6
5
|
import './style.scss';
|
|
7
|
-
|
|
8
6
|
const ImageBackground = ({
|
|
9
7
|
className,
|
|
10
8
|
children,
|
|
@@ -13,17 +11,14 @@ const ImageBackground = ({
|
|
|
13
11
|
}) => {
|
|
14
12
|
const bgElem = useRef(null);
|
|
15
13
|
const imgElement = useRef(null);
|
|
16
|
-
|
|
17
14
|
const onLoad = e => {
|
|
18
15
|
const src = typeof imgElement.current.currentSrc !== 'undefined' ? imgElement.current.currentSrc : imgElement.current.src;
|
|
19
|
-
|
|
20
16
|
if (withGradient) {
|
|
21
17
|
bgElem.current.style.backgroundImage = `${withGradient}, url("${src}")`;
|
|
22
18
|
} else {
|
|
23
19
|
bgElem.current.style.backgroundImage = `url("${src}")`;
|
|
24
20
|
}
|
|
25
21
|
};
|
|
26
|
-
|
|
27
22
|
const classes = c('ImageBackground', className);
|
|
28
23
|
return /*#__PURE__*/React.createElement("div", {
|
|
29
24
|
className: classes,
|
|
@@ -35,5 +30,4 @@ const ImageBackground = ({
|
|
|
35
30
|
imageRef: imgElement
|
|
36
31
|
}, props)), children);
|
|
37
32
|
};
|
|
38
|
-
|
|
39
33
|
export default ImageBackground;
|
|
@@ -3,7 +3,6 @@ import classNames from 'classnames';
|
|
|
3
3
|
import LazyLoad from 'react-lazyload';
|
|
4
4
|
import { Map } from 'immutable';
|
|
5
5
|
import './style.scss';
|
|
6
|
-
|
|
7
6
|
class LazyLoadWrapper extends Component {
|
|
8
7
|
constructor(props) {
|
|
9
8
|
super(props);
|
|
@@ -12,7 +11,6 @@ class LazyLoadWrapper extends Component {
|
|
|
12
11
|
error: false
|
|
13
12
|
};
|
|
14
13
|
}
|
|
15
|
-
|
|
16
14
|
render() {
|
|
17
15
|
const {
|
|
18
16
|
lazyload: shouldLazyLoad,
|
|
@@ -23,38 +21,30 @@ class LazyLoadWrapper extends Component {
|
|
|
23
21
|
src: "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",
|
|
24
22
|
alt: "placeholder"
|
|
25
23
|
});
|
|
26
|
-
|
|
27
24
|
if (!shouldLazyLoad) {
|
|
28
25
|
return children;
|
|
29
26
|
}
|
|
30
|
-
|
|
31
27
|
const addOnLoadCallback = element => {
|
|
32
28
|
const newProps = {};
|
|
33
|
-
|
|
34
29
|
newProps.onLoad = event => {
|
|
35
30
|
this.setState({
|
|
36
31
|
loaded: true
|
|
37
32
|
});
|
|
38
33
|
};
|
|
39
|
-
|
|
40
34
|
newProps.onError = event => {
|
|
41
35
|
this.setState({
|
|
42
36
|
error: true
|
|
43
37
|
});
|
|
44
38
|
};
|
|
45
|
-
|
|
46
39
|
let elements = [];
|
|
47
40
|
const elementMap = Map(element);
|
|
48
|
-
|
|
49
41
|
if (Array.isArray(elementMap.getIn(['props', 'children']))) {
|
|
50
42
|
elements = React.Children.map(element.props.children, child => {
|
|
51
43
|
return addOnLoadCallback(child);
|
|
52
44
|
});
|
|
53
45
|
}
|
|
54
|
-
|
|
55
46
|
return /*#__PURE__*/React.cloneElement(element, newProps, ...elements);
|
|
56
47
|
};
|
|
57
|
-
|
|
58
48
|
const {
|
|
59
49
|
loaded,
|
|
60
50
|
error
|
|
@@ -75,7 +65,5 @@ class LazyLoadWrapper extends Component {
|
|
|
75
65
|
return addOnLoadCallback(child);
|
|
76
66
|
}))));
|
|
77
67
|
}
|
|
78
|
-
|
|
79
68
|
}
|
|
80
|
-
|
|
81
69
|
export default LazyLoadWrapper;
|