@uncinc/uncinc-react-kitchen-sink 2.3.2 → 2.3.4
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/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 +1 -10
- 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 +4 -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 +36 -18
- 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 +44 -17
- package/dist/components/SearchKit/SearchSelectedFilters/index.js +0 -4
- package/dist/components/SearchKit/SearchSorting/index.js +0 -2
- 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 +0 -3
- 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/package.json +16 -7
- package/dist/components/WysiwygField/stories.scss +0 -3
- package/dist/helpers/makeSafeForCSS.js +0 -5
|
@@ -1,22 +1,17 @@
|
|
|
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, { useContext } from 'react';
|
|
4
3
|
import KitchenSinkComponentMapperContext from './KitchenSinkComponentMapperContext';
|
|
5
|
-
|
|
6
4
|
const withMapping = BaseComponent => props => {
|
|
7
5
|
const {
|
|
8
6
|
componentIsWrapped
|
|
9
7
|
} = props;
|
|
10
8
|
const context = useContext(KitchenSinkComponentMapperContext);
|
|
11
|
-
|
|
12
9
|
if (context && BaseComponent && !componentIsWrapped && context[BaseComponent.name]) {
|
|
13
10
|
const WrapperComponent = context[BaseComponent.name];
|
|
14
11
|
return /*#__PURE__*/React.createElement(WrapperComponent, _extends({}, props, {
|
|
15
12
|
componentIsWrapped: true
|
|
16
13
|
}), props.children);
|
|
17
14
|
}
|
|
18
|
-
|
|
19
15
|
return /*#__PURE__*/React.createElement(BaseComponent, props, props.children);
|
|
20
16
|
};
|
|
21
|
-
|
|
22
17
|
export default withMapping;
|
|
@@ -2,7 +2,6 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import c from 'classnames';
|
|
3
3
|
import AnimateHeight from 'react-animate-height';
|
|
4
4
|
import WysiwygField from '../../WysiwygField';
|
|
5
|
-
|
|
6
5
|
const ContentParsed = ({
|
|
7
6
|
children
|
|
8
7
|
}) => {
|
|
@@ -11,10 +10,8 @@ const ContentParsed = ({
|
|
|
11
10
|
html: children
|
|
12
11
|
});
|
|
13
12
|
}
|
|
14
|
-
|
|
15
13
|
return /*#__PURE__*/React.createElement("div", null, children);
|
|
16
14
|
};
|
|
17
|
-
|
|
18
15
|
const AccordeonTitle = ({
|
|
19
16
|
className,
|
|
20
17
|
children
|
|
@@ -23,7 +20,6 @@ const AccordeonTitle = ({
|
|
|
23
20
|
className: className
|
|
24
21
|
}, children);
|
|
25
22
|
};
|
|
26
|
-
|
|
27
23
|
const AccordionItem = ({
|
|
28
24
|
title,
|
|
29
25
|
content,
|
|
@@ -55,7 +51,6 @@ const AccordionItem = ({
|
|
|
55
51
|
className: "Accordion__item__content"
|
|
56
52
|
}, /*#__PURE__*/React.createElement(ContentParsed, null, content))));
|
|
57
53
|
};
|
|
58
|
-
|
|
59
54
|
AccordionItem.defaultProps = {
|
|
60
55
|
title: 'Default title',
|
|
61
56
|
content: 'Default content',
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import AnimateHeight from 'react-animate-height';
|
|
3
3
|
import c from 'classnames';
|
|
4
|
-
|
|
5
4
|
const AccordionItemVariant = ({
|
|
6
5
|
title,
|
|
7
6
|
children,
|
|
@@ -14,16 +13,13 @@ const AccordionItemVariant = ({
|
|
|
14
13
|
}) => {
|
|
15
14
|
const [toggleAccordion, setToggleAccordion] = useState(false);
|
|
16
15
|
const [height, setHeight] = useState(0);
|
|
17
|
-
|
|
18
16
|
const toggle = () => {
|
|
19
17
|
setToggleAccordion(!toggleAccordion);
|
|
20
18
|
setHeight(height === 0 ? 'auto' : 0);
|
|
21
|
-
|
|
22
19
|
if (onClick) {
|
|
23
20
|
onClick();
|
|
24
21
|
}
|
|
25
22
|
};
|
|
26
|
-
|
|
27
23
|
const AccordionItem = c('AccordionItem', className, toggleAccordion === true ? 'AccordionItem--active' : 'AccordionItem--inactive');
|
|
28
24
|
return /*#__PURE__*/React.createElement("div", {
|
|
29
25
|
className: AccordionItem
|
|
@@ -38,7 +34,6 @@ const AccordionItemVariant = ({
|
|
|
38
34
|
height: height
|
|
39
35
|
}, children));
|
|
40
36
|
};
|
|
41
|
-
|
|
42
37
|
AccordionItemVariant.defaultProps = {
|
|
43
38
|
title: 'Default title',
|
|
44
39
|
className: 'AccordionItemCustomClass',
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import Autosuggest from 'react-autosuggest';
|
|
3
3
|
import './style.scss';
|
|
4
|
-
|
|
5
4
|
function abortableFetch(request, opts) {
|
|
6
5
|
const controller = new AbortController();
|
|
7
6
|
const signal = controller.signal;
|
|
8
7
|
return {
|
|
9
8
|
abort: () => controller.abort(),
|
|
10
|
-
ready: fetch(request, {
|
|
9
|
+
ready: fetch(request, {
|
|
10
|
+
...opts,
|
|
11
11
|
signal
|
|
12
12
|
})
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
|
|
16
15
|
let currentFetch = null;
|
|
17
|
-
|
|
18
16
|
const ApiAutocomplete = ({
|
|
19
17
|
endpoint,
|
|
20
18
|
placeholder,
|
|
@@ -28,14 +26,11 @@ const ApiAutocomplete = ({
|
|
|
28
26
|
}) => {
|
|
29
27
|
const [queryInput, setQuery] = useState(defaultValue || '');
|
|
30
28
|
const [results, setResults] = useState([]);
|
|
31
|
-
|
|
32
29
|
const getSuggestions = query => {
|
|
33
30
|
const url = `${endpoint}?${queryParameter}=${query}`;
|
|
34
|
-
|
|
35
31
|
if (currentFetch) {
|
|
36
32
|
currentFetch.abort();
|
|
37
33
|
}
|
|
38
|
-
|
|
39
34
|
currentFetch = abortableFetch(url, requestOptions);
|
|
40
35
|
currentFetch.ready.then(response => {
|
|
41
36
|
return response.json();
|
|
@@ -45,10 +40,10 @@ const ApiAutocomplete = ({
|
|
|
45
40
|
return item;
|
|
46
41
|
});
|
|
47
42
|
setResults(ajaxResults);
|
|
48
|
-
}).catch(e => {
|
|
43
|
+
}).catch(e => {
|
|
44
|
+
// Catch the error so the browser does not output errors.
|
|
49
45
|
});
|
|
50
46
|
};
|
|
51
|
-
|
|
52
47
|
return /*#__PURE__*/React.createElement(Autosuggest, {
|
|
53
48
|
suggestions: results,
|
|
54
49
|
onSuggestionsFetchRequested: ({
|
|
@@ -69,12 +64,12 @@ const ApiAutocomplete = ({
|
|
|
69
64
|
}) => {
|
|
70
65
|
onSelectItem(suggestion);
|
|
71
66
|
},
|
|
72
|
-
inputProps: {
|
|
67
|
+
inputProps: {
|
|
68
|
+
...props,
|
|
73
69
|
placeholder,
|
|
74
70
|
value: queryInput,
|
|
75
71
|
onBlur: event => {
|
|
76
72
|
const value = event.target.value;
|
|
77
|
-
|
|
78
73
|
if (!value || value.length === 0) {
|
|
79
74
|
onSelectItem('');
|
|
80
75
|
}
|
|
@@ -87,7 +82,6 @@ const ApiAutocomplete = ({
|
|
|
87
82
|
}
|
|
88
83
|
});
|
|
89
84
|
};
|
|
90
|
-
|
|
91
85
|
ApiAutocomplete.defaultProps = {
|
|
92
86
|
getSuggestionValue: item => {
|
|
93
87
|
return item.name;
|
|
@@ -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 { Link } from 'react-router-dom';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
@@ -8,7 +7,6 @@ import gtm from '../../helpers/gtm';
|
|
|
8
7
|
import { isExternalLink } from '../../helpers/link';
|
|
9
8
|
import withMapping from '../../Context/withMapping';
|
|
10
9
|
import './style.scss';
|
|
11
|
-
|
|
12
10
|
const Button = ({
|
|
13
11
|
href,
|
|
14
12
|
dispatch,
|
|
@@ -27,19 +25,17 @@ const Button = ({
|
|
|
27
25
|
'Button--inverted': inverted,
|
|
28
26
|
'is-loading': loading
|
|
29
27
|
});
|
|
30
|
-
|
|
31
28
|
const onClick = event => {
|
|
32
|
-
if (loading) return;
|
|
33
|
-
// perfect for the tracking event. We don't want a string containing HTML.
|
|
29
|
+
if (loading) return;
|
|
34
30
|
|
|
31
|
+
// Using element.innerText gives us purely the text of the element which is
|
|
32
|
+
// perfect for the tracking event. We don't want a string containing HTML.
|
|
35
33
|
const text = event.target ? event.target.innerText : 'Unknown';
|
|
36
34
|
gtm.trackUserEvent('button', 'click', text, href);
|
|
37
|
-
|
|
38
35
|
if (props.onClick) {
|
|
39
36
|
props.onClick(event);
|
|
40
37
|
}
|
|
41
38
|
};
|
|
42
|
-
|
|
43
39
|
if (!href) {
|
|
44
40
|
return /*#__PURE__*/React.createElement("button", _extends({
|
|
45
41
|
type: htmlType,
|
|
@@ -49,7 +45,6 @@ const Button = ({
|
|
|
49
45
|
onClick: onClick
|
|
50
46
|
}), children);
|
|
51
47
|
}
|
|
52
|
-
|
|
53
48
|
return isExternalLink(href) ? /*#__PURE__*/React.createElement("a", _extends({
|
|
54
49
|
className: classes,
|
|
55
50
|
href: href,
|
|
@@ -64,7 +59,6 @@ const Button = ({
|
|
|
64
59
|
onClick: onClick
|
|
65
60
|
}), children);
|
|
66
61
|
};
|
|
67
|
-
|
|
68
62
|
Button.defaultProps = {
|
|
69
63
|
primary: true,
|
|
70
64
|
inverted: false,
|
|
@@ -7,7 +7,6 @@ import Button from '../Button';
|
|
|
7
7
|
import Container from '../Layout/Container';
|
|
8
8
|
import Checkbox from './Checkbox';
|
|
9
9
|
import './style.scss';
|
|
10
|
-
|
|
11
10
|
const CookieCompliancePopup = props => {
|
|
12
11
|
const {
|
|
13
12
|
className,
|
|
@@ -24,18 +23,22 @@ const CookieCompliancePopup = props => {
|
|
|
24
23
|
defaultValues,
|
|
25
24
|
manualHeader,
|
|
26
25
|
manualButtonClassname
|
|
27
|
-
} = props;
|
|
26
|
+
} = props;
|
|
27
|
+
|
|
28
|
+
// This is an internal state to check whether we should show the options.
|
|
29
|
+
const [manualChoiceVisible, setManualChoiceVisible] = useState(false);
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
// This is an extra hidden variable to internally check if we should show the notification.
|
|
30
32
|
// This also allows us to add an animation when the user accepts.
|
|
33
|
+
const [hiddenInternal, setHiddenInternal] = useState(false);
|
|
31
34
|
|
|
32
|
-
|
|
35
|
+
// Cookie stating if the cookie has already been accepted. Uses the following states:
|
|
33
36
|
// 0: Declined (Not yet used).
|
|
34
37
|
// 1: Not yet agreed/disagreed (Not yet used).
|
|
35
38
|
// 2: Accepted.
|
|
39
|
+
const [didConsent, setDidConsent] = useCookie('cookie-agreed', null);
|
|
36
40
|
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
// Cookie stating whether we should render the notification.
|
|
39
42
|
const [hidden, setHidden] = useState(didConsent !== null);
|
|
40
43
|
const categories = cookieLevels.map(item => {
|
|
41
44
|
return item.value;
|
|
@@ -43,32 +46,35 @@ const CookieCompliancePopup = props => {
|
|
|
43
46
|
const defaultState = categories.reduce((prev, category) => {
|
|
44
47
|
prev[category] = typeof defaultValues[category] !== undefined ? defaultValues[category] : true;
|
|
45
48
|
return prev;
|
|
46
|
-
}, {});
|
|
49
|
+
}, {});
|
|
47
50
|
|
|
51
|
+
// Default choices for select, this way we can locally manage the state of the form.
|
|
48
52
|
const [choicesSelected, setChoicesSelected] = useState(defaultState);
|
|
49
53
|
useEffect(() => {
|
|
50
54
|
if (hidden) {
|
|
51
55
|
setHiddenInternal(true);
|
|
52
|
-
}
|
|
56
|
+
}
|
|
57
|
+
// We don't want to add hidden to the dependency list, as this would -
|
|
53
58
|
// unrender the notification immediately on save.
|
|
54
59
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
60
|
+
}, []);
|
|
55
61
|
|
|
56
|
-
|
|
62
|
+
// Check if didConsent has been changed.
|
|
57
63
|
// If so, set the hidden cookie for page reloads.
|
|
58
|
-
|
|
59
64
|
useEffect(() => {
|
|
60
65
|
if (didConsent !== null) {
|
|
61
66
|
setHidden(true);
|
|
62
67
|
}
|
|
63
|
-
}, [didConsent, cookieOptions, setHidden]);
|
|
68
|
+
}, [didConsent, cookieOptions, setHidden]);
|
|
64
69
|
|
|
70
|
+
// This function expands the notification to show the options.
|
|
65
71
|
const displayConsentChoices = e => {
|
|
66
72
|
e.preventDefault();
|
|
67
73
|
setManualChoiceVisible(true);
|
|
68
|
-
};
|
|
69
|
-
// and also sets the accepted categories in CookieAgreedCategories.
|
|
70
|
-
|
|
74
|
+
};
|
|
71
75
|
|
|
76
|
+
// This function sets cookie-agreed to 2 ( accepted state ),
|
|
77
|
+
// and also sets the accepted categories in CookieAgreedCategories.
|
|
72
78
|
const _onAgree = choices => {
|
|
73
79
|
const selectedChoices = Object.keys(choices).filter(key => {
|
|
74
80
|
return choices[key];
|
|
@@ -81,15 +87,17 @@ const CookieCompliancePopup = props => {
|
|
|
81
87
|
});
|
|
82
88
|
}
|
|
83
89
|
});
|
|
84
|
-
setDidConsent('2', cookieOptions);
|
|
90
|
+
setDidConsent('2', cookieOptions);
|
|
91
|
+
|
|
92
|
+
// I used js-cookie for this insead of react-use-cookie because the encoding is not what we want
|
|
85
93
|
// for arrays in react-use-cookie. This shouldn't be an issue, as we don't want to keep track of
|
|
86
94
|
// CookieAgreedCategories, as we have that in state already.
|
|
87
|
-
|
|
88
95
|
Cookies.set('cookie-agreed-categories', JSON.stringify(selectedChoices), {
|
|
89
96
|
expires: 365,
|
|
90
97
|
domain: cookieDomain
|
|
91
|
-
});
|
|
98
|
+
});
|
|
92
99
|
|
|
100
|
+
// Set cookie for current domain, so it does not appear twice.
|
|
93
101
|
const timestamp = Math.round(new Date().getTime() / 1000);
|
|
94
102
|
const value = {
|
|
95
103
|
ver: 1,
|
|
@@ -105,7 +113,6 @@ const CookieCompliancePopup = props => {
|
|
|
105
113
|
});
|
|
106
114
|
onAgree(choices);
|
|
107
115
|
};
|
|
108
|
-
|
|
109
116
|
const _onDisagree = () => {
|
|
110
117
|
setDidConsent('0', cookieOptions);
|
|
111
118
|
Cookies.set('cookie-agreed-categories', JSON.stringify([]), {
|
|
@@ -123,20 +130,19 @@ const CookieCompliancePopup = props => {
|
|
|
123
130
|
domain: cookieDomain
|
|
124
131
|
});
|
|
125
132
|
onDisagree();
|
|
126
|
-
};
|
|
127
|
-
|
|
133
|
+
};
|
|
128
134
|
|
|
135
|
+
// Function for accepting al categories at once.
|
|
129
136
|
const onConsentAll = () => {
|
|
130
137
|
const allCategoriesSelected = categories.reduce((prev, category) => {
|
|
131
138
|
prev[category] = true;
|
|
132
139
|
return prev;
|
|
133
140
|
}, {});
|
|
134
|
-
|
|
135
141
|
_onAgree(allCategoriesSelected);
|
|
136
|
-
};
|
|
137
|
-
// Also has eventual support for a false case.
|
|
138
|
-
|
|
142
|
+
};
|
|
139
143
|
|
|
144
|
+
// This function is fired when the accept button is pressed.
|
|
145
|
+
// Also has eventual support for a false case.
|
|
140
146
|
const onConsent = value => {
|
|
141
147
|
return () => {
|
|
142
148
|
if (value === true) {
|
|
@@ -145,29 +151,30 @@ const CookieCompliancePopup = props => {
|
|
|
145
151
|
_onDisagree();
|
|
146
152
|
}
|
|
147
153
|
};
|
|
148
|
-
};
|
|
149
|
-
|
|
154
|
+
};
|
|
150
155
|
|
|
156
|
+
// This function sets the value of the checkmark in the form state.
|
|
151
157
|
const handleChoiceState = event => {
|
|
152
158
|
const {
|
|
153
159
|
value,
|
|
154
160
|
checked
|
|
155
161
|
} = event.target;
|
|
156
|
-
setChoicesSelected({
|
|
162
|
+
setChoicesSelected({
|
|
163
|
+
...choicesSelected,
|
|
157
164
|
[value]: checked
|
|
158
165
|
});
|
|
159
166
|
};
|
|
160
|
-
|
|
161
167
|
const classes = classNames('Cookie', className, {
|
|
162
168
|
'Cookie--hidden': didConsent !== null
|
|
163
|
-
});
|
|
169
|
+
});
|
|
164
170
|
|
|
171
|
+
// If hiddenInternal is true, we do not render the notification.
|
|
165
172
|
if (hiddenInternal === true) {
|
|
166
173
|
return null;
|
|
167
|
-
}
|
|
168
|
-
// allowing us to add more checkboxes eventually.
|
|
169
|
-
|
|
174
|
+
}
|
|
170
175
|
|
|
176
|
+
// This function renders the different options of checkboxes,
|
|
177
|
+
// allowing us to add more checkboxes eventually.
|
|
171
178
|
const renderChoices = () => {
|
|
172
179
|
return cookieLevels.map(choice => {
|
|
173
180
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -189,7 +196,6 @@ const CookieCompliancePopup = props => {
|
|
|
189
196
|
}, choice.description));
|
|
190
197
|
});
|
|
191
198
|
};
|
|
192
|
-
|
|
193
199
|
return /*#__PURE__*/React.createElement("div", {
|
|
194
200
|
className: classes
|
|
195
201
|
}, /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement("div", {
|
|
@@ -226,7 +232,6 @@ const CookieCompliancePopup = props => {
|
|
|
226
232
|
onClick: onConsent(true)
|
|
227
233
|
}, agreeText))))));
|
|
228
234
|
};
|
|
229
|
-
|
|
230
235
|
export default CookieCompliancePopup;
|
|
231
236
|
CookieCompliancePopup.defaultProps = {
|
|
232
237
|
agreeText: 'Accepteren',
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import './style.scss';
|
|
4
|
-
|
|
5
4
|
const FontSizeSwitcher = ({
|
|
6
5
|
defaultSize,
|
|
7
6
|
incrementMode = false
|
|
@@ -9,12 +8,11 @@ const FontSizeSwitcher = ({
|
|
|
9
8
|
const getCookie = n => {
|
|
10
9
|
let a = `; ${document.cookie}`.match(`;\\s*${n}=([^;]+)`);
|
|
11
10
|
return a ? a[1] : '';
|
|
12
|
-
};
|
|
13
|
-
|
|
11
|
+
};
|
|
14
12
|
|
|
13
|
+
// Use cookie by default to prevent flickering.
|
|
15
14
|
const cookie = getCookie('WCAG_font_size');
|
|
16
15
|
const [currentSize, setCurrentSize] = useState(cookie ? parseInt(cookie) : defaultSize);
|
|
17
|
-
|
|
18
16
|
const changeCurrentSize = size => {
|
|
19
17
|
if (incrementMode === true && size >= 3) {
|
|
20
18
|
document.cookie = `WCAG_font_size=${0}`;
|
|
@@ -24,7 +22,6 @@ const FontSizeSwitcher = ({
|
|
|
24
22
|
setCurrentSize(parseInt(size));
|
|
25
23
|
}
|
|
26
24
|
};
|
|
27
|
-
|
|
28
25
|
useEffect(() => {
|
|
29
26
|
var html = document.getElementsByTagName('html')[0];
|
|
30
27
|
html.classList.remove('font-size--small', 'font-size--regular', 'font-size--large');
|
|
@@ -39,7 +36,6 @@ const FontSizeSwitcher = ({
|
|
|
39
36
|
const classesLarge = classnames("FontSizeSwitcher__button FontSizeSwitcher__button--large", {
|
|
40
37
|
'active': currentSize === 2
|
|
41
38
|
});
|
|
42
|
-
|
|
43
39
|
if (incrementMode === true) {
|
|
44
40
|
return /*#__PURE__*/React.createElement("div", {
|
|
45
41
|
className: "FontSizeSwitcher FontSizeSwitcher--increment-mode",
|
|
@@ -54,7 +50,6 @@ const FontSizeSwitcher = ({
|
|
|
54
50
|
className: classesLarge
|
|
55
51
|
}, "Large"));
|
|
56
52
|
}
|
|
57
|
-
|
|
58
53
|
return /*#__PURE__*/React.createElement("div", {
|
|
59
54
|
className: "FontSizeSwitcher"
|
|
60
55
|
}, /*#__PURE__*/React.createElement("button", {
|
|
@@ -68,7 +63,6 @@ const FontSizeSwitcher = ({
|
|
|
68
63
|
onClick: () => changeCurrentSize(2)
|
|
69
64
|
}, "Large"));
|
|
70
65
|
};
|
|
71
|
-
|
|
72
66
|
FontSizeSwitcher.defaultProps = {
|
|
73
67
|
defaultSize: 1
|
|
74
68
|
};
|
|
@@ -1,12 +1,10 @@
|
|
|
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 withMapping from '../../../Context/withMapping';
|
|
8
7
|
import './style.scss';
|
|
9
|
-
|
|
10
8
|
const Checkbox = props => {
|
|
11
9
|
const {
|
|
12
10
|
title,
|
|
@@ -63,7 +61,6 @@ const Checkbox = props => {
|
|
|
63
61
|
})), title);
|
|
64
62
|
}));
|
|
65
63
|
};
|
|
66
|
-
|
|
67
64
|
Checkbox.defaultProps = {
|
|
68
65
|
onChange: () => {}
|
|
69
66
|
};
|
|
@@ -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
|
function Checkbox(props) {
|
|
10
8
|
const {
|
|
11
9
|
name,
|
|
@@ -30,7 +28,6 @@ function Checkbox(props) {
|
|
|
30
28
|
'icon-checkmark': true,
|
|
31
29
|
'icon-variant-1': checked
|
|
32
30
|
});
|
|
33
|
-
|
|
34
31
|
if (props.value === '__other__') {
|
|
35
32
|
const inputClasses = c({
|
|
36
33
|
hidden: !field.value.includes('__other__')
|
|
@@ -54,7 +51,6 @@ function Checkbox(props) {
|
|
|
54
51
|
}
|
|
55
52
|
}));
|
|
56
53
|
}
|
|
57
|
-
|
|
58
54
|
return /*#__PURE__*/React.createElement("label", {
|
|
59
55
|
className: classes,
|
|
60
56
|
htmlFor: name
|
|
@@ -69,7 +65,6 @@ function Checkbox(props) {
|
|
|
69
65
|
})), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("span", null, props.label), props.description && /*#__PURE__*/React.createElement("span", null, props.description)));
|
|
70
66
|
});
|
|
71
67
|
}
|
|
72
|
-
|
|
73
68
|
const Checkboxes = props => {
|
|
74
69
|
const {
|
|
75
70
|
title,
|
|
@@ -120,5 +115,4 @@ const Checkboxes = props => {
|
|
|
120
115
|
});
|
|
121
116
|
}));
|
|
122
117
|
};
|
|
123
|
-
|
|
124
118
|
export default Checkboxes;
|
|
@@ -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 { Checkboxes } from './stories';
|
|
7
|
+
import { Checkboxes } from './stories';
|
|
8
8
|
|
|
9
|
+
// Use sinon-chai for spies.
|
|
9
10
|
chai.use(sinonChai);
|
|
10
11
|
describe('<Checkboxes />', () => {
|
|
11
12
|
it('renders 5 label elements', () => {
|
|
@@ -47,17 +48,20 @@ describe('<Checkboxes />', () => {
|
|
|
47
48
|
input.at(3).simulate('change');
|
|
48
49
|
await new Promise(resolve => {
|
|
49
50
|
setTimeout(resolve);
|
|
50
|
-
});
|
|
51
|
+
});
|
|
51
52
|
|
|
53
|
+
// Submit values, and wait for Formik to complete.
|
|
52
54
|
wrapper.find('Formik').simulate('submit');
|
|
53
55
|
await new Promise(resolve => {
|
|
54
56
|
setTimeout(resolve);
|
|
55
57
|
});
|
|
56
58
|
});
|
|
57
|
-
wrapper.update();
|
|
59
|
+
wrapper.update();
|
|
58
60
|
|
|
59
|
-
|
|
61
|
+
// Should not display an error message.
|
|
62
|
+
expect(wrapper.find('div.Checkboxes__error')).to.have.lengthOf(0);
|
|
60
63
|
|
|
64
|
+
// Submitted values should contain my value.
|
|
61
65
|
expect(onSubmitCallback).to.have.been.calledWith({
|
|
62
66
|
poison: ["rum", "whisky"]
|
|
63
67
|
});
|
|
@@ -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 FormikCheckboxes from '.';
|
|
@@ -26,11 +25,9 @@ export const Checkboxes = props => {
|
|
|
26
25
|
},
|
|
27
26
|
validation: value => {
|
|
28
27
|
let error;
|
|
29
|
-
|
|
30
28
|
if (value && value.length === 0) {
|
|
31
29
|
error = 'This field is required';
|
|
32
30
|
}
|
|
33
|
-
|
|
34
31
|
return error;
|
|
35
32
|
},
|
|
36
33
|
otherLabel: "Anders"
|
|
@@ -1,12 +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 TextField from '../TextField';
|
|
5
|
-
|
|
6
4
|
const Date = props => {
|
|
7
5
|
return /*#__PURE__*/React.createElement(TextField, _extends({}, props, {
|
|
8
6
|
type: "date"
|
|
9
7
|
}));
|
|
10
8
|
};
|
|
11
|
-
|
|
12
9
|
export default Date;
|
|
@@ -5,7 +5,6 @@ import c from 'classnames';
|
|
|
5
5
|
import GenericFormElement from '../GenericFormElement';
|
|
6
6
|
import "react-datepicker/dist/react-datepicker.css";
|
|
7
7
|
import './style.scss';
|
|
8
|
-
|
|
9
8
|
const DatePicker = props => {
|
|
10
9
|
const {
|
|
11
10
|
title,
|
|
@@ -57,5 +56,4 @@ const DatePicker = props => {
|
|
|
57
56
|
});
|
|
58
57
|
}));
|
|
59
58
|
};
|
|
60
|
-
|
|
61
59
|
export default DatePicker;
|