@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
|
@@ -2,43 +2,37 @@ import React, { useState, useRef } from 'react';
|
|
|
2
2
|
import Immutable from 'immutable';
|
|
3
3
|
import WebformMapper from './WebformMapper';
|
|
4
4
|
import FormikWrapper from '../Form/FormikWrapper';
|
|
5
|
-
|
|
6
5
|
const Webform = ({
|
|
7
6
|
entities
|
|
8
7
|
}) => {
|
|
9
8
|
const [currentPage, setCurrentPage] = useState(0);
|
|
10
9
|
const webformRef = useRef(null);
|
|
10
|
+
|
|
11
11
|
/**
|
|
12
12
|
* @description Scroll to the top of the webform component
|
|
13
13
|
*/
|
|
14
|
-
|
|
15
14
|
const scrollToTop = () => {
|
|
16
15
|
window.scrollTo(0, webformRef.getBoundingClientRect().top);
|
|
17
16
|
webformRef.scrollIntoView();
|
|
18
17
|
};
|
|
19
|
-
|
|
20
18
|
const onNextPage = () => {
|
|
21
19
|
setCurrentPage(currentPage + 1);
|
|
22
20
|
scrollToTop();
|
|
23
21
|
};
|
|
24
|
-
|
|
25
22
|
const onPreviousPage = () => {
|
|
26
23
|
setCurrentPage(currentPage - 1);
|
|
27
24
|
scrollToTop();
|
|
28
25
|
};
|
|
29
|
-
|
|
30
26
|
const collectPages = entities => {
|
|
31
27
|
let output = new Immutable.List();
|
|
32
28
|
entities.entrySeq().forEach(([key, entity]) => {
|
|
33
29
|
const mappedEntity = Immutable.fromJS(entity);
|
|
34
|
-
|
|
35
30
|
if (mappedEntity.get('#type') === 'webform_wizard_page') {
|
|
36
31
|
output = output.push(mappedEntity.get('#webform_key'));
|
|
37
32
|
}
|
|
38
33
|
});
|
|
39
34
|
return output;
|
|
40
35
|
};
|
|
41
|
-
|
|
42
36
|
const pages = collectPages(entities);
|
|
43
37
|
return /*#__PURE__*/React.createElement("div", {
|
|
44
38
|
className: "Webform",
|
|
@@ -52,5 +46,4 @@ const Webform = ({
|
|
|
52
46
|
currentPage: pages.get(currentPage)
|
|
53
47
|
})));
|
|
54
48
|
};
|
|
55
|
-
|
|
56
49
|
export default Webform;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
2
|
const determineVisibility = (entity, values) => {
|
|
4
3
|
let visible = true;
|
|
5
|
-
|
|
6
4
|
if (entity.hasIn(['#states', 'visible'])) {
|
|
7
5
|
visible = entity.getIn(['#states', 'visible']).keySeq().every(component => {
|
|
8
6
|
const condition = entity.getIn(['#states', 'visible', component]);
|
|
9
|
-
const fieldName = component.match(/input\[name="(.+)"\]/)[1];
|
|
7
|
+
const fieldName = component.match(/input\[name="(.+)"\]/)[1];
|
|
10
8
|
|
|
9
|
+
// Determine the type of condition.
|
|
11
10
|
if (condition.get('filled')) {
|
|
12
11
|
if (values[fieldName]) {
|
|
13
12
|
return true;
|
|
@@ -17,69 +16,57 @@ const determineVisibility = (entity, values) => {
|
|
|
17
16
|
return true;
|
|
18
17
|
}
|
|
19
18
|
} else if (condition.get('value')) {
|
|
20
|
-
const value = condition.get('value');
|
|
21
|
-
|
|
19
|
+
const value = condition.get('value');
|
|
20
|
+
// Check for subfield.
|
|
22
21
|
const matches = [...fieldName.matchAll(/(.*)\[(.*)\]/g)];
|
|
23
|
-
|
|
24
22
|
if (matches && matches.length > 0) {
|
|
25
23
|
const [, field] = matches[0];
|
|
26
|
-
|
|
27
24
|
if (values[field]) {
|
|
28
25
|
if (values[field].includes(value)) {
|
|
29
26
|
return true;
|
|
30
27
|
}
|
|
31
28
|
}
|
|
32
29
|
}
|
|
33
|
-
|
|
34
30
|
if (values[fieldName] === value) {
|
|
35
31
|
return true;
|
|
36
32
|
}
|
|
37
33
|
} else if (condition.get('checked')) {
|
|
38
34
|
// Check for subfield.
|
|
39
35
|
const matches = [...fieldName.matchAll(/(.*)\[(.*)\]/g)];
|
|
40
|
-
|
|
41
36
|
if (matches && matches.length > 0) {
|
|
42
37
|
const [, field, subField] = matches[0];
|
|
43
|
-
|
|
44
38
|
if (values[field]) {
|
|
45
39
|
if (values[field].includes(subField)) {
|
|
46
40
|
return true;
|
|
47
41
|
}
|
|
48
42
|
}
|
|
49
43
|
}
|
|
50
|
-
|
|
51
44
|
if (values[fieldName] === true) {
|
|
52
45
|
return true;
|
|
53
46
|
}
|
|
54
47
|
} else {
|
|
55
48
|
console.log('Condition not yet supported:', condition);
|
|
56
|
-
}
|
|
57
|
-
|
|
49
|
+
}
|
|
58
50
|
|
|
51
|
+
// By default, states will make a field invisible.
|
|
59
52
|
return false;
|
|
60
53
|
});
|
|
61
54
|
}
|
|
62
|
-
|
|
63
55
|
return visible;
|
|
64
56
|
};
|
|
65
|
-
|
|
66
57
|
const withStates = BaseComponent => props => {
|
|
67
58
|
const {
|
|
68
59
|
entity,
|
|
69
60
|
values
|
|
70
61
|
} = props;
|
|
71
62
|
const states = entity.get('#states');
|
|
72
|
-
|
|
73
63
|
if (states) {
|
|
74
64
|
const visible = entity.get('#visible', true);
|
|
75
65
|
const visibility = determineVisibility(entity, values);
|
|
76
|
-
|
|
77
66
|
if (!visible || !visibility) {
|
|
78
67
|
return null;
|
|
79
68
|
}
|
|
80
69
|
}
|
|
81
|
-
|
|
82
70
|
return /*#__PURE__*/React.createElement(BaseComponent, props, props.children);
|
|
83
71
|
};
|
|
84
|
-
|
|
85
72
|
export default withStates;
|
|
@@ -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 from 'react';
|
|
4
3
|
import PropTypes from 'prop-types';
|
|
5
4
|
import ReactHtmlParser from 'react-html-parser';
|
|
6
5
|
import Button from '../Button';
|
|
7
|
-
|
|
8
6
|
const WysiwygField = ({
|
|
9
7
|
html,
|
|
10
8
|
customElementHandler,
|
|
@@ -13,11 +11,9 @@ const WysiwygField = ({
|
|
|
13
11
|
const parsedHtml = ReactHtmlParser(html, {
|
|
14
12
|
transform: node => {
|
|
15
13
|
const customHandler = customElementHandler(node);
|
|
16
|
-
|
|
17
14
|
if (customHandler) {
|
|
18
15
|
return customHandler;
|
|
19
16
|
}
|
|
20
|
-
|
|
21
17
|
switch (node.name) {
|
|
22
18
|
case 'a':
|
|
23
19
|
{
|
|
@@ -33,10 +29,8 @@ const WysiwygField = ({
|
|
|
33
29
|
key: `${node.name}:${label}`
|
|
34
30
|
}, label);
|
|
35
31
|
}
|
|
36
|
-
|
|
37
32
|
break;
|
|
38
33
|
}
|
|
39
|
-
|
|
40
34
|
default:
|
|
41
35
|
{
|
|
42
36
|
break;
|
|
@@ -48,7 +42,6 @@ const WysiwygField = ({
|
|
|
48
42
|
className: "WysiwygField"
|
|
49
43
|
}, props), parsedHtml);
|
|
50
44
|
};
|
|
51
|
-
|
|
52
45
|
WysiwygField.propTypes = {
|
|
53
46
|
html: PropTypes.string.isRequired,
|
|
54
47
|
customElementHandler: PropTypes.func
|
|
@@ -1,5 +1,7 @@
|
|
|
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); }
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import WysiwygField from './';
|
|
4
|
+
import AbbreviationAnnotation from '../AbbreviationAnnotation';
|
|
3
5
|
export default {
|
|
4
6
|
title: 'Atoms/WysiwygField'
|
|
5
7
|
};
|
|
@@ -7,16 +9,6 @@ const html = "<p>This is <em>some</em> example <a href='https://www.uncinc.nl'>H
|
|
|
7
9
|
export const Primary = () => /*#__PURE__*/React.createElement(WysiwygField, {
|
|
8
10
|
html: html
|
|
9
11
|
});
|
|
10
|
-
|
|
11
|
-
const Abbr = ({
|
|
12
|
-
title,
|
|
13
|
-
children
|
|
14
|
-
}) => {
|
|
15
|
-
return /*#__PURE__*/React.createElement("abbr", {
|
|
16
|
-
title: title
|
|
17
|
-
}, children);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
12
|
const htmlCustomHandler = `
|
|
21
13
|
<p>Lorem ipsum dolor sit amet, <abbr title="Ut ut tellus et augue feugiat sollicitudin sit amet viverra nisi.">consectetur adipiscing</abbr> elit. Aliquam in sodales tellus. Ut ut tellus et augue feugiat sollicitudin sit amet viverra nisi. Nulla malesuada erat non massa pellentesque, ut ultricies tellus sodales. Fusce ac feugiat ligula. In vel metus diam. Maecenas diam ex, tincidunt tempor nibh sed, suscipit semper lectus. Sed eu enim vel erat tempus mollis. Integer eget gravida orci. Nunc volutpat velit id dui semper tincidunt. Nulla maximus nisl nec volutpat faucibus. Integer vitae ullamcorper ex. Vestibulum facilisis convallis arcu, ac interdum libero malesuada eget.</p>
|
|
22
14
|
<p>Donec feugiat, nunc vitae euismod posuere, urna nisl elementum nibh, quis ultricies libero leo sed neque. Praesent vel vestibulum sem, eget congue purus. Nunc non volutpat urna, vitae ullamcorper justo. Suspendisse in tortor ex. Phasellus euismod eget neque vitae consequat. Vestibulum sem mi, dictum id consectetur at, hendrerit in massa. Mauris quis sem condimentum, condimentum enim sed, varius sem. Curabitur convallis tempus nulla, eget consectetur quam sagittis at. Nulla a feugiat tortor. Mauris fermentum lectus ac mauris cursus ornare.</p>
|
|
@@ -28,12 +20,10 @@ export const CustomHandlers = () => /*#__PURE__*/React.createElement(WysiwygFiel
|
|
|
28
20
|
switch (element.name) {
|
|
29
21
|
case 'abbr':
|
|
30
22
|
{
|
|
31
|
-
|
|
32
|
-
return /*#__PURE__*/React.createElement(Abbr, {
|
|
23
|
+
return /*#__PURE__*/React.createElement(AbbreviationAnnotation, _extends({
|
|
33
24
|
title: element.attribs.title
|
|
34
|
-
}, element.children[0].data);
|
|
25
|
+
}, element.attribs), element.children[0].data);
|
|
35
26
|
}
|
|
36
|
-
|
|
37
27
|
default:
|
|
38
28
|
{
|
|
39
29
|
return null;
|
package/dist/config/constants.js
CHANGED
|
@@ -4,17 +4,16 @@ export const DEFAULT_LANGUAGE = 'nl';
|
|
|
4
4
|
export const SITE_NAME = 'Unc Inc';
|
|
5
5
|
export const MAPBOX_API_TOKEN = 'pk.eyJ1IjoidW5jaW5jYnYiLCJhIjoiY2pxeHhxd2FlMDMyeTQzbWp1a3hleHRscCJ9.QMfmlryTLEyrSyjU7FfBiw';
|
|
6
6
|
let API_URL = 'https://content.uncinc.nl';
|
|
7
|
-
|
|
8
7
|
if (APP_ENV === 'development') {
|
|
9
8
|
API_URL = 'http://uncinc.docker.localhost';
|
|
10
9
|
} else if (APP_ENV === 'staging') {
|
|
11
10
|
API_URL = 'https://staging.uncinc.nl';
|
|
12
11
|
}
|
|
13
|
-
|
|
14
12
|
export const IS_SERVER = !(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
15
|
-
export const IS_CLIENT = !IS_SERVER;
|
|
16
|
-
// These values are taken from '/src/shared/styles/assets/_variables.scss'.
|
|
13
|
+
export const IS_CLIENT = !IS_SERVER;
|
|
17
14
|
|
|
15
|
+
// The value is where the breakpoint starts (mobile-first).
|
|
16
|
+
// These values are taken from '/src/shared/styles/assets/_variables.scss'.
|
|
18
17
|
export const SCREEN_MOBILE = 0;
|
|
19
18
|
export const SCREEN_TABLET = 768;
|
|
20
19
|
export const SCREEN_NORMAL = 992;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import i18n from 'i18next';
|
|
2
|
+
import LanguageDetector from 'i18next-browser-languagedetector';
|
|
3
|
+
import { initReactI18next } from 'react-i18next';
|
|
4
|
+
import NL from './locales/nl.json';
|
|
5
|
+
import EN from './locales/en.json';
|
|
6
|
+
const resources = {
|
|
7
|
+
nl: {
|
|
8
|
+
translation: NL
|
|
9
|
+
},
|
|
10
|
+
en: {
|
|
11
|
+
translation: EN
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
i18n.use(LanguageDetector).use(initReactI18next).init({
|
|
15
|
+
resources,
|
|
16
|
+
lng: 'nl',
|
|
17
|
+
fallbackLng: 'nl',
|
|
18
|
+
debug: true,
|
|
19
|
+
interpolation: {
|
|
20
|
+
escapeValue: false
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
export default i18n;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"dateselect": {
|
|
3
|
+
"months": {
|
|
4
|
+
"jan": "January",
|
|
5
|
+
"feb": "February",
|
|
6
|
+
"mar": "March",
|
|
7
|
+
"apr": "April",
|
|
8
|
+
"may": "May",
|
|
9
|
+
"jun": "June",
|
|
10
|
+
"jul": "Juli",
|
|
11
|
+
"aug": "August",
|
|
12
|
+
"sep": "September",
|
|
13
|
+
"oct": "October",
|
|
14
|
+
"nov": "November",
|
|
15
|
+
"dec": "December"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"form": {
|
|
19
|
+
"required": "required",
|
|
20
|
+
"optional": "optional"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"dateselect" : {
|
|
3
|
+
"months": {
|
|
4
|
+
"jan": "Januari",
|
|
5
|
+
"feb": "Februari",
|
|
6
|
+
"mar": "Maart",
|
|
7
|
+
"apr": "April",
|
|
8
|
+
"may": "Mei",
|
|
9
|
+
"jun": "Juni",
|
|
10
|
+
"jul": "Juli",
|
|
11
|
+
"aug": "Augustus",
|
|
12
|
+
"sep": "September",
|
|
13
|
+
"oct": "Oktober",
|
|
14
|
+
"nov": "November",
|
|
15
|
+
"dec": "December"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"form": {
|
|
19
|
+
"required": "vereist",
|
|
20
|
+
"optional": "optioneel"
|
|
21
|
+
}
|
|
22
|
+
}
|
package/dist/helpers/gtm.js
CHANGED
|
@@ -5,7 +5,9 @@ const gtm = {
|
|
|
5
5
|
// If GTM is not loaded we will push all events to this variable. Once GTM is
|
|
6
6
|
// loaded we will concat this array with the GTM dataLayer variable.
|
|
7
7
|
tempDataLayer: []
|
|
8
|
-
};
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// -----------------------------------------------------------------------------
|
|
9
11
|
//
|
|
10
12
|
// Define our internal helper functions.
|
|
11
13
|
//
|
|
@@ -19,10 +21,10 @@ const gtm = {
|
|
|
19
21
|
* @return {bool}
|
|
20
22
|
* A boolean wether the GTM is loaded or not.
|
|
21
23
|
*/
|
|
22
|
-
|
|
23
24
|
gtm.loaded = () => {
|
|
24
25
|
return typeof window.google_tag_manager !== 'undefined';
|
|
25
26
|
};
|
|
27
|
+
|
|
26
28
|
/**
|
|
27
29
|
* gtm.register
|
|
28
30
|
*
|
|
@@ -35,17 +37,15 @@ gtm.loaded = () => {
|
|
|
35
37
|
* The callback of the function being registered.
|
|
36
38
|
* @return {void}
|
|
37
39
|
*/
|
|
38
|
-
|
|
39
|
-
|
|
40
40
|
gtm.register = (fn, callback) => {
|
|
41
41
|
gtm[fn] = (...args) => {
|
|
42
42
|
if (__DEBUG__) {
|
|
43
43
|
console.info(`GTM Event: ${fn}() with args`, args);
|
|
44
44
|
}
|
|
45
|
-
|
|
46
45
|
callback(...args);
|
|
47
46
|
};
|
|
48
47
|
};
|
|
48
|
+
|
|
49
49
|
/**
|
|
50
50
|
* gtm.push
|
|
51
51
|
*
|
|
@@ -56,17 +56,15 @@ gtm.register = (fn, callback) => {
|
|
|
56
56
|
* @return {array|bool}
|
|
57
57
|
* An array containing the new dataLayer result or `false`.
|
|
58
58
|
*/
|
|
59
|
-
|
|
60
|
-
|
|
61
59
|
gtm.push = data => {
|
|
62
60
|
if (gtm.loaded()) {
|
|
63
61
|
return window.dataLayer.push(data);
|
|
64
62
|
} else {
|
|
65
63
|
gtm.tempDataLayer.push(data);
|
|
66
64
|
}
|
|
67
|
-
|
|
68
65
|
return false;
|
|
69
66
|
};
|
|
67
|
+
|
|
70
68
|
/**
|
|
71
69
|
* gtm.attachEventListeners
|
|
72
70
|
*
|
|
@@ -74,26 +72,23 @@ gtm.push = data => {
|
|
|
74
72
|
* Attach event listeners related to GTM.
|
|
75
73
|
* @return {void}
|
|
76
74
|
*/
|
|
77
|
-
|
|
78
|
-
|
|
79
75
|
gtm.attachEventListeners = () => {
|
|
80
76
|
if (IS_CLIENT && !gtm.hasEventsAttached) {
|
|
81
77
|
window.addEventListener('GTM-Loaded', () => {
|
|
82
78
|
for (let i = 0, len = gtm.tempDataLayer.length; i < len; i++) {
|
|
83
79
|
window.dataLayer.push(gtm.tempDataLayer[i]);
|
|
84
80
|
}
|
|
85
|
-
|
|
86
81
|
gtm.tempDataLayer = [];
|
|
87
82
|
});
|
|
88
83
|
gtm.hasEventsAttached = true;
|
|
89
84
|
}
|
|
90
|
-
};
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// -----------------------------------------------------------------------------
|
|
91
88
|
//
|
|
92
89
|
// Register our wrapper functions. We will use these throughout the app.
|
|
93
90
|
//
|
|
94
91
|
// -----------------------------------------------------------------------------
|
|
95
|
-
|
|
96
|
-
|
|
97
92
|
gtm.register('trackPage', url => {
|
|
98
93
|
if (url) {
|
|
99
94
|
gtm.push({
|
|
@@ -115,7 +110,8 @@ gtm.register('loadConsentRequiredTags', () => {
|
|
|
115
110
|
gtm.push({
|
|
116
111
|
event: 'Cookie consent: load tags on consent'
|
|
117
112
|
});
|
|
118
|
-
});
|
|
113
|
+
});
|
|
119
114
|
|
|
115
|
+
// Initialize GTM.
|
|
120
116
|
gtm.attachEventListeners();
|
|
121
117
|
export default gtm;
|
package/dist/helpers/link.js
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import config from 'react-global-configuration';
|
|
2
2
|
export function isExternalLink(uri = '') {
|
|
3
3
|
const value = uri.trim().replace(/\/$/, '');
|
|
4
|
-
|
|
5
4
|
if (/^(https?|mailto|tel):/g.test(value)) {
|
|
6
5
|
return true;
|
|
7
6
|
}
|
|
8
|
-
|
|
9
7
|
return false;
|
|
10
8
|
}
|
|
11
9
|
export function normalizeLink(link) {
|
|
12
10
|
const API_URL = config.get('API_URL');
|
|
13
|
-
|
|
14
11
|
if (/^\//g.test(link)) {
|
|
15
12
|
return `${API_URL}${link}`;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
return link;
|
|
19
15
|
}
|
|
@@ -7,29 +7,35 @@ export default function useValueForCurrentViewPort(val1, val2, val3, val4, val5)
|
|
|
7
7
|
function handleResize() {
|
|
8
8
|
const {
|
|
9
9
|
innerWidth: width
|
|
10
|
-
} = window;
|
|
10
|
+
} = window;
|
|
11
11
|
|
|
12
|
+
// 0 & 768
|
|
12
13
|
if (width >= viewportContext.screenSizes.SCREEN_MOBILE && width <= viewportContext.screenSizes.SCREEN_TABLET) {
|
|
13
14
|
setValueForCurrentViewPort(val1);
|
|
14
15
|
return;
|
|
15
|
-
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// 768 & 992
|
|
16
19
|
else if (width >= viewportContext.screenSizes.SCREEN_TABLET && width <= viewportContext.screenSizes.SCREEN_NORMAL) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return;
|
|
27
|
-
} // SCREEN_HUGE and larger
|
|
20
|
+
setValueForCurrentViewPort(val2);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// 992 & 1240
|
|
25
|
+
else if (width >= viewportContext.screenSizes.SCREEN_NORMAL && width <= viewportContext.screenSizes.SCREEN_WIDE) {
|
|
26
|
+
setValueForCurrentViewPort(val3);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
28
29
|
|
|
30
|
+
// 1240 & 2000
|
|
31
|
+
else if (width >= viewportContext.screenSizes.SCREEN_WIDE && width <= viewportContext.screenSizes.SCREEN_HUGE) {
|
|
32
|
+
setValueForCurrentViewPort(val4);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
29
35
|
|
|
36
|
+
// SCREEN_HUGE and larger
|
|
30
37
|
setValueForCurrentViewPort(val5);
|
|
31
38
|
}
|
|
32
|
-
|
|
33
39
|
window.addEventListener('resize', handleResize);
|
|
34
40
|
handleResize();
|
|
35
41
|
return () => window.removeEventListener('resize', handleResize);
|
|
@@ -3,8 +3,8 @@ export default function useOnScreen(ref) {
|
|
|
3
3
|
const [isIntersecting, setIntersecting] = useState(false);
|
|
4
4
|
const observer = new IntersectionObserver(([entry]) => setIntersecting(entry.isIntersecting));
|
|
5
5
|
useEffect(() => {
|
|
6
|
-
observer.observe(ref.current);
|
|
7
|
-
|
|
6
|
+
observer.observe(ref.current);
|
|
7
|
+
// Remove the observer as soon as the component is unmounted
|
|
8
8
|
return () => observer.disconnect();
|
|
9
9
|
}, [observer, ref]);
|
|
10
10
|
return isIntersecting;
|
|
@@ -2,13 +2,14 @@ import { useEffect, useRef } from 'react';
|
|
|
2
2
|
export default function usePrevious(value) {
|
|
3
3
|
// The ref object is a generic container whose current property is mutable ...
|
|
4
4
|
// ... and can hold any value, similar to an instance property on a class
|
|
5
|
-
const ref = useRef();
|
|
5
|
+
const ref = useRef();
|
|
6
6
|
|
|
7
|
+
// Store current value in ref
|
|
7
8
|
useEffect(() => {
|
|
8
9
|
ref.current = value;
|
|
9
10
|
}, [value]); // Only re-run if value changes
|
|
10
|
-
// Return previous value (happens before update in useEffect above)
|
|
11
11
|
|
|
12
|
+
// Return previous value (happens before update in useEffect above)
|
|
12
13
|
return ref.current;
|
|
13
14
|
}
|
|
14
15
|
;
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
|
-
|
|
3
2
|
const useScrollPosition = () => {
|
|
4
3
|
const [scrollPosition, setScrollPosition] = useState(0);
|
|
5
4
|
useEffect(() => {
|
|
6
5
|
const updatePosition = () => {
|
|
7
6
|
setScrollPosition(window.pageYOffset);
|
|
8
7
|
};
|
|
9
|
-
|
|
10
8
|
window.addEventListener('scroll', updatePosition);
|
|
11
9
|
updatePosition();
|
|
12
10
|
return () => window.removeEventListener('scroll', updatePosition);
|
|
13
11
|
}, []);
|
|
14
12
|
return scrollPosition;
|
|
15
13
|
};
|
|
16
|
-
|
|
17
14
|
export default useScrollPosition;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useState, useEffect } from 'react';
|
|
2
|
-
|
|
3
2
|
function getWindowDimensions() {
|
|
4
3
|
const {
|
|
5
4
|
innerWidth: width,
|
|
@@ -10,14 +9,12 @@ function getWindowDimensions() {
|
|
|
10
9
|
height
|
|
11
10
|
};
|
|
12
11
|
}
|
|
13
|
-
|
|
14
12
|
export default function useWindowDimensions() {
|
|
15
13
|
const [windowDimensions, setWindowDimensions] = useState(getWindowDimensions());
|
|
16
14
|
useEffect(() => {
|
|
17
15
|
function handleResize() {
|
|
18
16
|
setWindowDimensions(getWindowDimensions());
|
|
19
17
|
}
|
|
20
|
-
|
|
21
18
|
window.addEventListener('resize', handleResize);
|
|
22
19
|
return () => window.removeEventListener('resize', handleResize);
|
|
23
20
|
}, []);
|
package/dist/index.js
CHANGED
|
@@ -51,4 +51,5 @@ export { default as Cookie } from './components/Cookie';
|
|
|
51
51
|
export { default as useOnScreen } from './hooks/useOnScreen';
|
|
52
52
|
export { default as usePrevious } from './hooks/usePrevious';
|
|
53
53
|
export { default as useScrollPosition } from './hooks/useScrollPosition';
|
|
54
|
-
export { default as useWindowDimensions } from './hooks/useWindowDimensions';
|
|
54
|
+
export { default as useWindowDimensions } from './hooks/useWindowDimensions';
|
|
55
|
+
export { default as AbbreviationAnnotation } from './components/AbbreviationAnnotation';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uncinc/uncinc-react-kitchen-sink",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.5",
|
|
4
4
|
"description": "Default React components that are easily extended.",
|
|
5
5
|
"author": "uncinc",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"scripts": {
|
|
25
25
|
"start": "yarn run storybook",
|
|
26
26
|
"build": "react-scripts build",
|
|
27
|
-
"test": "
|
|
27
|
+
"test": "jest",
|
|
28
28
|
"eject": "react-scripts eject",
|
|
29
29
|
"prepare": "yarn run publish:npm",
|
|
30
30
|
"storybook": "start-storybook -p 9009 -s public",
|
|
@@ -40,11 +40,15 @@
|
|
|
40
40
|
"@loadable/component": "^5.15.0",
|
|
41
41
|
"@searchkit/client": "^3.0.0-canary.45",
|
|
42
42
|
"@searchkit/elastic-ui": "^3.0.0-canary.45",
|
|
43
|
+
"@uncinc/react-drupal-core": "^2.3.4",
|
|
43
44
|
"apollo-server-micro": "^3.4.0",
|
|
44
45
|
"bootstrap": "^4",
|
|
45
46
|
"fork-ts-checker-webpack-plugin-alt": "0.4.14",
|
|
46
47
|
"formik": "^2.2.6",
|
|
47
48
|
"graphql": "^15.7.0",
|
|
49
|
+
"i18next": "^22.4.13",
|
|
50
|
+
"i18next-browser-languagedetector": "^7.0.1",
|
|
51
|
+
"i18next-http-backend": "^2.2.0",
|
|
48
52
|
"immutable": "^4.0.0-rc.15",
|
|
49
53
|
"js-cookie": "^3.0.1",
|
|
50
54
|
"lottie-web": "^5.7.7",
|
|
@@ -60,7 +64,7 @@
|
|
|
60
64
|
"react-dom": "^16 || ^17 || ^18",
|
|
61
65
|
"react-global-configuration": "^1.4.0",
|
|
62
66
|
"react-html-parser": "^2.0.2",
|
|
63
|
-
"react-i18next": "^
|
|
67
|
+
"react-i18next": "^12.2.0",
|
|
64
68
|
"react-immutable-proptypes": "^2.2.0",
|
|
65
69
|
"react-lazyload": "^3.0.0",
|
|
66
70
|
"react-paginate": "^7.1.3",
|
|
@@ -80,6 +84,8 @@
|
|
|
80
84
|
"@babel/cli": "^7.0.0-beta.44",
|
|
81
85
|
"@babel/helper-define-map": "^7.14.5",
|
|
82
86
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
87
|
+
"@babel/preset-env": "^7.20.2",
|
|
88
|
+
"@babel/preset-react": "^7.18.6",
|
|
83
89
|
"@babel/runtime": "^7.9.6",
|
|
84
90
|
"@storybook/addon-actions": "^6.2.8",
|
|
85
91
|
"@storybook/addon-info": "^5.3.21",
|
|
@@ -90,15 +96,18 @@
|
|
|
90
96
|
"@testing-library/jest-dom": "^4.2.4",
|
|
91
97
|
"@testing-library/react": "^9.3.2",
|
|
92
98
|
"@testing-library/user-event": "^7.1.2",
|
|
99
|
+
"babel-jest": "^29.4.3",
|
|
93
100
|
"chai": "^4.2.0",
|
|
94
101
|
"cross-env": "^7.0.2",
|
|
95
102
|
"enzyme": "^3.11.0",
|
|
96
103
|
"enzyme-adapter-react-16": "^1.15.2",
|
|
104
|
+
"jest": "^29.4.3",
|
|
97
105
|
"react-scripts": "3.4.1",
|
|
98
|
-
"react-test-renderer": "^
|
|
106
|
+
"react-test-renderer": "^18.2.0",
|
|
99
107
|
"sinon": "^9.0.2",
|
|
100
108
|
"sinon-chai": "^3.5.0",
|
|
101
|
-
"storybook-addon-export-stories": "^1.0.0"
|
|
109
|
+
"storybook-addon-export-stories": "^1.0.0",
|
|
110
|
+
"storybook-react-i18next": "^1.1.3"
|
|
102
111
|
},
|
|
103
112
|
"eslintConfig": {
|
|
104
113
|
"extends": "react-app"
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ApolloServer, gql } from 'apollo-server-micro';
|
|
2
|
-
export const config = {
|
|
3
|
-
api: {
|
|
4
|
-
bodyParser: false
|
|
5
|
-
}
|
|
6
|
-
};
|
|
7
|
-
const typeDefs = [gql`
|
|
8
|
-
type Query {
|
|
9
|
-
root: String
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
type Mutation {
|
|
13
|
-
root: String
|
|
14
|
-
}
|
|
15
|
-
`];
|
|
16
|
-
const server = new ApolloServer({
|
|
17
|
-
typeDefs,
|
|
18
|
-
resolvers: {},
|
|
19
|
-
introspection: true,
|
|
20
|
-
playground: true,
|
|
21
|
-
context: {}
|
|
22
|
-
});
|
|
23
|
-
export default server.createHandler({
|
|
24
|
-
path: '/api/graphql'
|
|
25
|
-
});
|