@uncinc/uncinc-react-kitchen-sink 2.3.6 → 2.4.1
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/KitchenSinkComponentMapperContext.js +11 -3
- package/dist/Context/ViewportContext.js +32 -19
- package/dist/Context/withMapping.js +26 -15
- package/dist/components/AbbreviationAnnotation/index.js +49 -27
- package/dist/components/AbbreviationAnnotation/stories.js +32 -21
- package/dist/components/AbbreviationAnnotation/stories.scss +1 -1
- package/dist/components/AbbreviationAnnotation/style.scss +0 -2
- package/dist/components/Accordion/AccordionItem/index.js +56 -36
- package/dist/components/Accordion/AccordionItemVariant/index.js +47 -25
- package/dist/components/Accordion/index.js +17 -10
- package/dist/components/Accordion/stories.js +38 -24
- package/dist/components/ApiAutocomplete/index.js +79 -51
- package/dist/components/ApiAutocomplete/stories.js +18 -9
- package/dist/components/Button/index.js +53 -39
- package/dist/components/Button/stories.js +52 -30
- package/dist/components/Cookie/Checkbox/index.js +24 -17
- package/dist/components/Cookie/index.js +164 -118
- package/dist/components/Cookie/stories.js +57 -39
- package/dist/components/Dialog/index.d.ts +38 -0
- package/dist/components/Dialog/index.js +96 -0
- package/dist/components/Dialog/stories.js +42 -0
- package/dist/components/Dialog/style.scss +72 -0
- package/dist/components/FontSizeSwitcher/index.js +63 -31
- package/dist/components/FontSizeSwitcher/stories.js +23 -9
- package/dist/components/Form/Checkbox/index.js +43 -37
- package/dist/components/Form/Checkbox/stories.js +20 -11
- package/dist/components/Form/Checkboxes/index.js +62 -57
- package/dist/components/Form/Checkboxes/index.test.js +113 -62
- package/dist/components/Form/Checkboxes/stories.js +23 -12
- package/dist/components/Form/Date/index.js +13 -5
- package/dist/components/Form/Date/stories.js +18 -9
- package/dist/components/Form/DatePicker/index.js +40 -34
- package/dist/components/Form/DatePicker/stories.js +18 -9
- package/dist/components/Form/DateSelect/index.js +102 -66
- package/dist/components/Form/DateSelect/stories.js +33 -12
- package/dist/components/Form/Email/index.js +13 -5
- package/dist/components/Form/Email/stories.js +18 -9
- package/dist/components/Form/FormikWrapper/index.js +52 -45
- package/dist/components/Form/GenericFormElement/index.js +39 -34
- package/dist/components/Form/Number/index.js +23 -18
- package/dist/components/Form/Number/stories.js +18 -9
- package/dist/components/Form/RadioButtons/index.js +53 -49
- package/dist/components/Form/RadioButtons/index.test.js +106 -57
- package/dist/components/Form/RadioButtons/stories.js +23 -12
- package/dist/components/Form/SearchField/index.js +37 -30
- package/dist/components/Form/Select/Input/index.js +74 -70
- package/dist/components/Form/Select/index.js +32 -24
- package/dist/components/Form/Select/stories.js +25 -15
- package/dist/components/Form/TextField/index.js +38 -33
- package/dist/components/Form/TextField/index.test.js +104 -56
- package/dist/components/Form/TextField/stories.js +23 -12
- package/dist/components/Form/Textarea/index.js +34 -27
- package/dist/components/Form/Textarea/stories.js +18 -9
- package/dist/components/Hamburger/index.js +30 -19
- package/dist/components/Hamburger/stories.js +42 -16
- package/dist/components/Header/index.js +70 -42
- package/dist/components/Header/stories.js +48 -28
- package/dist/components/Image/Background/index.js +36 -21
- package/dist/components/Image/LazyLoadWrapper/index.js +101 -64
- package/dist/components/Image/Picture/index.js +83 -66
- package/dist/components/Image/index.js +21 -15
- package/dist/components/Image/stories.js +87 -64
- package/dist/components/InlineMenu/index.js +62 -42
- package/dist/components/InlineMenu/stories.js +66 -55
- package/dist/components/Layout/Container/index.js +29 -21
- package/dist/components/Layout/Container/stories.js +104 -83
- package/dist/components/Layout/QuickLayout/Auto/index.js +19 -12
- package/dist/components/Layout/QuickLayout/Center/index.js +17 -10
- package/dist/components/Layout/QuickLayout/Clamp/index.js +20 -13
- package/dist/components/Layout/QuickLayout/Sidebar/index.js +20 -13
- package/dist/components/Layout/QuickLayout/SpaceBetween/index.js +20 -13
- package/dist/components/Layout/QuickLayout/Stack/index.js +21 -11
- package/dist/components/Layout/QuickLayout/Wrap/index.js +21 -14
- package/dist/components/Layout/QuickLayout/index.js +31 -21
- package/dist/components/Layout/QuickLayout/stories.js +102 -70
- package/dist/components/Lottie/LottieAnimation/index.js +74 -71
- package/dist/components/Lottie/LottieAnimationWithMousePosition.js +33 -20
- package/dist/components/Lottie/index.js +47 -34
- package/dist/components/Lottie/stories.js +54 -31
- package/dist/components/MagicLine/index.js +52 -29
- package/dist/components/MagicLine/stories.js +60 -46
- package/dist/components/NavigationScroll/index.js +76 -57
- package/dist/components/NavigationScroll/stories.js +19 -8
- package/dist/components/Pagination/index.js +54 -41
- package/dist/components/Pagination/stories.js +51 -28
- package/dist/components/SearchKit/Facets/ChipFacet/index.js +24 -16
- package/dist/components/SearchKit/Facets/ListFacet/index.js +24 -15
- package/dist/components/SearchKit/Facets/SelectFacet/index.js +39 -30
- package/dist/components/SearchKit/Query/index.js +41 -23
- package/dist/components/SearchKit/SearchFacets/index.js +36 -25
- package/dist/components/SearchKit/SearchField/index.js +50 -26
- package/dist/components/SearchKit/SearchLoadMore/index.js +22 -15
- package/dist/components/SearchKit/SearchPage/index.js +26 -11
- package/dist/components/SearchKit/SearchPagination/index.js +17 -10
- package/dist/components/SearchKit/SearchReset/index.js +33 -12
- package/dist/components/SearchKit/SearchResults/index.js +114 -61
- package/dist/components/SearchKit/SearchSelectedFilters/Filters/CustomValue/index.js +22 -0
- package/dist/components/SearchKit/SearchSelectedFilters/Filters/DateRange/index.js +24 -0
- package/dist/components/SearchKit/SearchSelectedFilters/Filters/NumericRange/index.js +24 -0
- package/dist/components/SearchKit/SearchSelectedFilters/Filters/Value/index.js +29 -0
- package/dist/components/SearchKit/SearchSelectedFilters/index.js +43 -30
- package/dist/components/SearchKit/SearchSelectedFilters/style.scss +4 -0
- package/dist/components/SearchKit/SearchSorting/index.js +29 -19
- package/dist/components/SearchKit/index.js +75 -49
- package/dist/components/SearchKit/stories.js +144 -183
- package/dist/components/Share/index.js +51 -43
- package/dist/components/Share/stories.js +16 -5
- package/dist/components/Sliders/SliderRelated/index.js +32 -25
- package/dist/components/Sliders/SliderRelated/stories.js +75 -57
- package/dist/components/Webform/WebformActions/index.js +19 -13
- package/dist/components/Webform/WebformCheckbox/index.js +32 -24
- package/dist/components/Webform/WebformCheckboxes/index.js +37 -29
- package/dist/components/Webform/WebformContainer/index.js +17 -11
- package/dist/components/Webform/WebformDate/index.js +77 -48
- package/dist/components/Webform/WebformMapper/index.js +53 -38
- package/dist/components/Webform/WebformNumber/index.js +31 -22
- package/dist/components/Webform/WebformRadioButtons/index.js +37 -29
- package/dist/components/Webform/WebformSelect/index.js +37 -29
- package/dist/components/Webform/WebformTextField/index.js +34 -26
- package/dist/components/Webform/WebformTextarea/index.js +32 -24
- package/dist/components/Webform/WebformWizardPage/index.js +56 -43
- package/dist/components/Webform/index.js +42 -20
- package/dist/components/Webform/stories.actions.js +35 -24
- package/dist/components/Webform/stories.checkboxes.js +40 -29
- package/dist/components/Webform/stories.checked.js +53 -42
- package/dist/components/Webform/stories.container.js +47 -36
- package/dist/components/Webform/stories.date.js +35 -24
- package/dist/components/Webform/stories.filled.js +53 -42
- package/dist/components/Webform/stories.number.js +36 -25
- package/dist/components/Webform/stories.radiobuttons.js +40 -29
- package/dist/components/Webform/stories.select.js +40 -29
- package/dist/components/Webform/stories.textarea.js +19 -8
- package/dist/components/Webform/stories.textfield.js +19 -8
- package/dist/components/Webform/stories.wizard.js +133 -122
- package/dist/components/Webform/withStates.js +49 -28
- package/dist/components/WysiwygField/index.js +30 -21
- package/dist/components/WysiwygField/stories.js +39 -29
- package/dist/components/index.js +111 -15
- package/dist/config/constants.js +38 -18
- package/dist/config/i18next/index.js +19 -11
- package/dist/config/i18next/locales/en.json +4 -0
- package/dist/config/i18next/locales/nl.json +7 -0
- package/dist/helpers/date.js +16 -0
- package/dist/helpers/gtm.js +27 -17
- package/dist/helpers/link.js +15 -6
- package/dist/helpers/useValueForCurrentViewPort.js +27 -10
- package/dist/hooks/useBoolean.d.ts +8 -0
- package/dist/hooks/useBoolean.js +38 -0
- package/dist/hooks/useClickOutside.d.ts +8 -0
- package/dist/hooks/useClickOutside.js +35 -0
- package/dist/hooks/useDialog.d.ts +10 -0
- package/dist/hooks/useDialog.js +39 -0
- package/dist/hooks/useDialogHelpers.d.ts +20 -0
- package/dist/hooks/useDialogHelpers.js +85 -0
- package/dist/hooks/useEscape.d.ts +6 -0
- package/dist/hooks/useEscape.js +24 -0
- package/dist/hooks/useOnScreen.js +27 -6
- package/dist/hooks/usePrevious.js +11 -6
- package/dist/hooks/useScrollPosition.js +25 -7
- package/dist/hooks/useTrapFocus.d.ts +10 -0
- package/dist/hooks/useTrapFocus.js +63 -0
- package/dist/hooks/useWindowDimensions.js +27 -11
- package/dist/index.js +398 -55
- package/dist/setupTests.js +9 -5
- package/package.json +44 -19
- package/dist/components/Form/SearchField/stories.js +0 -0
- package/dist/components/SearchKit/Facets/HierarchicalFilterFacet/index.js +0 -60
- package/dist/components/SearchKit/Facets/HierarchicalMenuFacet/index.js +0 -60
|
@@ -1,56 +1,91 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _reactUseCookie = _interopRequireDefault(require("react-use-cookie"));
|
|
10
|
+
var _jsCookie = _interopRequireDefault(require("js-cookie"));
|
|
11
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
|
+
var _Button = _interopRequireDefault(require("../Button"));
|
|
13
|
+
var _Container = _interopRequireDefault(require("../Layout/Container"));
|
|
14
|
+
var _Checkbox = _interopRequireDefault(require("./Checkbox"));
|
|
15
|
+
require("./style.scss");
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
20
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
22
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
23
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
24
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
25
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
26
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
27
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
28
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
29
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
30
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
31
|
+
var CookieCompliancePopup = function CookieCompliancePopup(props) {
|
|
32
|
+
var className = props.className,
|
|
33
|
+
children = props.children,
|
|
34
|
+
manualText = props.manualText,
|
|
35
|
+
agreeText = props.agreeText,
|
|
36
|
+
disagreeText = props.disagreeText,
|
|
37
|
+
showDisagree = props.showDisagree,
|
|
38
|
+
onAgree = props.onAgree,
|
|
39
|
+
onDisagree = props.onDisagree,
|
|
40
|
+
cookieLevels = props.cookieLevels,
|
|
41
|
+
cookieOptions = props.cookieOptions,
|
|
42
|
+
cookieDomain = props.cookieDomain,
|
|
43
|
+
defaultValues = props.defaultValues,
|
|
44
|
+
manualHeader = props.manualHeader,
|
|
45
|
+
manualButtonClassname = props.manualButtonClassname;
|
|
27
46
|
|
|
28
47
|
// This is an internal state to check whether we should show the options.
|
|
29
|
-
|
|
48
|
+
var _useState = (0, _react.useState)(false),
|
|
49
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
50
|
+
manualChoiceVisible = _useState2[0],
|
|
51
|
+
setManualChoiceVisible = _useState2[1];
|
|
30
52
|
|
|
31
53
|
// This is an extra hidden variable to internally check if we should show the notification.
|
|
32
54
|
// This also allows us to add an animation when the user accepts.
|
|
33
|
-
|
|
55
|
+
var _useState3 = (0, _react.useState)(false),
|
|
56
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
57
|
+
hiddenInternal = _useState4[0],
|
|
58
|
+
setHiddenInternal = _useState4[1];
|
|
34
59
|
|
|
35
60
|
// Cookie stating if the cookie has already been accepted. Uses the following states:
|
|
36
61
|
// 0: Declined (Not yet used).
|
|
37
62
|
// 1: Not yet agreed/disagreed (Not yet used).
|
|
38
63
|
// 2: Accepted.
|
|
39
|
-
|
|
64
|
+
var _useCookie = (0, _reactUseCookie.default)('cookie-agreed', null),
|
|
65
|
+
_useCookie2 = _slicedToArray(_useCookie, 2),
|
|
66
|
+
didConsent = _useCookie2[0],
|
|
67
|
+
setDidConsent = _useCookie2[1];
|
|
40
68
|
|
|
41
69
|
// Cookie stating whether we should render the notification.
|
|
42
|
-
|
|
43
|
-
|
|
70
|
+
var _useState5 = (0, _react.useState)(didConsent !== null),
|
|
71
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
72
|
+
hidden = _useState6[0],
|
|
73
|
+
setHidden = _useState6[1];
|
|
74
|
+
var categories = cookieLevels.map(function (item) {
|
|
44
75
|
return item.value;
|
|
45
76
|
});
|
|
46
|
-
|
|
47
|
-
|
|
77
|
+
var defaultState = categories.reduce(function (prev, category) {
|
|
78
|
+
// eslint-disable-next-line valid-typeof
|
|
79
|
+
prev[category] = _typeof(defaultValues[category]) !== undefined ? defaultValues[category] : true;
|
|
48
80
|
return prev;
|
|
49
81
|
}, {});
|
|
50
82
|
|
|
51
83
|
// Default choices for select, this way we can locally manage the state of the form.
|
|
52
|
-
|
|
53
|
-
|
|
84
|
+
var _useState7 = (0, _react.useState)(defaultState),
|
|
85
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
86
|
+
choicesSelected = _useState8[0],
|
|
87
|
+
setChoicesSelected = _useState8[1];
|
|
88
|
+
(0, _react.useEffect)(function () {
|
|
54
89
|
if (hidden) {
|
|
55
90
|
setHiddenInternal(true);
|
|
56
91
|
}
|
|
@@ -61,29 +96,29 @@ const CookieCompliancePopup = props => {
|
|
|
61
96
|
|
|
62
97
|
// Check if didConsent has been changed.
|
|
63
98
|
// If so, set the hidden cookie for page reloads.
|
|
64
|
-
useEffect(()
|
|
99
|
+
(0, _react.useEffect)(function () {
|
|
65
100
|
if (didConsent !== null) {
|
|
66
101
|
setHidden(true);
|
|
67
102
|
}
|
|
68
103
|
}, [didConsent, cookieOptions, setHidden]);
|
|
69
104
|
|
|
70
105
|
// This function expands the notification to show the options.
|
|
71
|
-
|
|
106
|
+
var displayConsentChoices = function displayConsentChoices(e) {
|
|
72
107
|
e.preventDefault();
|
|
73
108
|
setManualChoiceVisible(true);
|
|
74
109
|
};
|
|
75
110
|
|
|
76
111
|
// This function sets cookie-agreed to 2 ( accepted state ),
|
|
77
112
|
// and also sets the accepted categories in CookieAgreedCategories.
|
|
78
|
-
|
|
79
|
-
|
|
113
|
+
var _onAgree = function _onAgree(choices) {
|
|
114
|
+
var selectedChoices = Object.keys(choices).filter(function (key) {
|
|
80
115
|
return choices[key];
|
|
81
116
|
});
|
|
82
|
-
Object.keys(choices).forEach(key
|
|
117
|
+
Object.keys(choices).forEach(function (key) {
|
|
83
118
|
if (choicesSelected[key]) {
|
|
84
119
|
window.dataLayer = window.dataLayer || [];
|
|
85
120
|
window.dataLayer.push({
|
|
86
|
-
event:
|
|
121
|
+
event: "cookies-accepted-".concat(key)
|
|
87
122
|
});
|
|
88
123
|
}
|
|
89
124
|
});
|
|
@@ -92,40 +127,40 @@ const CookieCompliancePopup = props => {
|
|
|
92
127
|
// I used js-cookie for this insead of react-use-cookie because the encoding is not what we want
|
|
93
128
|
// for arrays in react-use-cookie. This shouldn't be an issue, as we don't want to keep track of
|
|
94
129
|
// CookieAgreedCategories, as we have that in state already.
|
|
95
|
-
|
|
130
|
+
_jsCookie.default.set('cookie-agreed-categories', JSON.stringify(selectedChoices), {
|
|
96
131
|
expires: 365,
|
|
97
132
|
domain: cookieDomain
|
|
98
133
|
});
|
|
99
134
|
|
|
100
135
|
// Set cookie for current domain, so it does not appear twice.
|
|
101
|
-
|
|
102
|
-
|
|
136
|
+
var timestamp = Math.round(new Date().getTime() / 1000);
|
|
137
|
+
var value = {
|
|
103
138
|
ver: 1,
|
|
104
139
|
utc: timestamp,
|
|
105
140
|
region: 'nl'
|
|
106
141
|
};
|
|
107
|
-
categories.forEach(category
|
|
142
|
+
categories.forEach(function (category) {
|
|
108
143
|
value[category] = true;
|
|
109
144
|
}, {});
|
|
110
|
-
|
|
145
|
+
_jsCookie.default.set('cookie-consent', JSON.stringify(value), {
|
|
111
146
|
expires: 365,
|
|
112
147
|
domain: cookieDomain
|
|
113
148
|
});
|
|
114
149
|
onAgree(choices);
|
|
115
150
|
};
|
|
116
|
-
|
|
151
|
+
var _onDisagree = function _onDisagree() {
|
|
117
152
|
setDidConsent('0', cookieOptions);
|
|
118
|
-
|
|
153
|
+
_jsCookie.default.set('cookie-agreed-categories', JSON.stringify([]), {
|
|
119
154
|
expires: 365,
|
|
120
155
|
domain: cookieDomain
|
|
121
156
|
});
|
|
122
|
-
|
|
123
|
-
|
|
157
|
+
var timestamp = Math.round(new Date().getTime() / 1000);
|
|
158
|
+
var value = {
|
|
124
159
|
ver: 1,
|
|
125
160
|
utc: timestamp,
|
|
126
161
|
region: 'nl'
|
|
127
162
|
};
|
|
128
|
-
|
|
163
|
+
_jsCookie.default.set('cookie-consent', JSON.stringify(value), {
|
|
129
164
|
expires: 365,
|
|
130
165
|
domain: cookieDomain
|
|
131
166
|
});
|
|
@@ -133,8 +168,8 @@ const CookieCompliancePopup = props => {
|
|
|
133
168
|
};
|
|
134
169
|
|
|
135
170
|
// Function for accepting al categories at once.
|
|
136
|
-
|
|
137
|
-
|
|
171
|
+
var onConsentAll = function onConsentAll() {
|
|
172
|
+
var allCategoriesSelected = categories.reduce(function (prev, category) {
|
|
138
173
|
prev[category] = true;
|
|
139
174
|
return prev;
|
|
140
175
|
}, {});
|
|
@@ -143,8 +178,8 @@ const CookieCompliancePopup = props => {
|
|
|
143
178
|
|
|
144
179
|
// This function is fired when the accept button is pressed.
|
|
145
180
|
// Also has eventual support for a false case.
|
|
146
|
-
|
|
147
|
-
return ()
|
|
181
|
+
var onConsent = function onConsent(value) {
|
|
182
|
+
return function () {
|
|
148
183
|
if (value === true) {
|
|
149
184
|
_onAgree(choicesSelected);
|
|
150
185
|
} else {
|
|
@@ -154,17 +189,13 @@ const CookieCompliancePopup = props => {
|
|
|
154
189
|
};
|
|
155
190
|
|
|
156
191
|
// This function sets the value of the checkmark in the form state.
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
value,
|
|
160
|
-
checked
|
|
161
|
-
}
|
|
162
|
-
setChoicesSelected({
|
|
163
|
-
...choicesSelected,
|
|
164
|
-
[value]: checked
|
|
165
|
-
});
|
|
192
|
+
var handleChoiceState = function handleChoiceState(event) {
|
|
193
|
+
var _event$target = event.target,
|
|
194
|
+
value = _event$target.value,
|
|
195
|
+
checked = _event$target.checked;
|
|
196
|
+
setChoicesSelected(_objectSpread(_objectSpread({}, choicesSelected), {}, _defineProperty({}, value, checked)));
|
|
166
197
|
};
|
|
167
|
-
|
|
198
|
+
var classes = (0, _classnames.default)('Cookie', className, {
|
|
168
199
|
'Cookie--hidden': didConsent !== null
|
|
169
200
|
});
|
|
170
201
|
|
|
@@ -175,92 +206,95 @@ const CookieCompliancePopup = props => {
|
|
|
175
206
|
|
|
176
207
|
// This function renders the different options of checkboxes,
|
|
177
208
|
// allowing us to add more checkboxes eventually.
|
|
178
|
-
|
|
179
|
-
return cookieLevels.map(choice
|
|
180
|
-
return /*#__PURE__*/
|
|
209
|
+
var renderChoices = function renderChoices() {
|
|
210
|
+
return cookieLevels.map(function (choice) {
|
|
211
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
181
212
|
className: "Cookie__category col-xs-12 col-lg-6",
|
|
182
213
|
key: choice.value
|
|
183
|
-
}, /*#__PURE__*/
|
|
214
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
184
215
|
className: "Checkbox"
|
|
185
|
-
}, /*#__PURE__*/
|
|
216
|
+
}, /*#__PURE__*/_react.default.createElement(_Checkbox.default, {
|
|
186
217
|
name: "cookie-categories",
|
|
187
218
|
type: "checkbox",
|
|
188
|
-
id:
|
|
219
|
+
id: "cookie-category-".concat(choice.value),
|
|
189
220
|
onChange: handleChoiceState,
|
|
190
221
|
label: choice.label,
|
|
191
222
|
value: choice.value,
|
|
192
223
|
checked: choicesSelected[choice.value],
|
|
193
224
|
disabled: choice.disabled
|
|
194
|
-
})), /*#__PURE__*/
|
|
225
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
195
226
|
className: "Cookie__category__description"
|
|
196
227
|
}, choice.description));
|
|
197
228
|
});
|
|
198
229
|
};
|
|
199
|
-
return /*#__PURE__*/
|
|
230
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
200
231
|
className: classes
|
|
201
|
-
}, /*#__PURE__*/
|
|
202
|
-
className:
|
|
203
|
-
}, !manualChoiceVisible ? /*#__PURE__*/
|
|
232
|
+
}, /*#__PURE__*/_react.default.createElement(_Container.default, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
233
|
+
className: "Cookie__content ".concat(manualChoiceVisible ? 'Cookie__content--full-height' : '')
|
|
234
|
+
}, !manualChoiceVisible ? /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
204
235
|
className: "row"
|
|
205
|
-
}, /*#__PURE__*/
|
|
236
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
206
237
|
className: "col-12 Cookie__content__message"
|
|
207
|
-
}, children), /*#__PURE__*/
|
|
238
|
+
}, children), /*#__PURE__*/_react.default.createElement("div", {
|
|
208
239
|
className: "col-12 Cookie__content__buttons"
|
|
209
|
-
}, /*#__PURE__*/
|
|
240
|
+
}, /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
210
241
|
id: "complete-agree",
|
|
211
242
|
className: "Button--cta",
|
|
212
243
|
primary: true,
|
|
213
244
|
onClick: onConsentAll
|
|
214
|
-
}, agreeText), showDisagree && /*#__PURE__*/
|
|
215
|
-
|
|
245
|
+
}, agreeText), showDisagree && /*#__PURE__*/_react.default.createElement("button", {
|
|
246
|
+
type: "button",
|
|
247
|
+
className: "Cookie__content__buttons__manual Cookie__content__buttons__manual-disagree ".concat(manualButtonClassname),
|
|
216
248
|
onClick: onConsent(false)
|
|
217
|
-
}, disagreeText), /*#__PURE__*/
|
|
218
|
-
|
|
219
|
-
|
|
249
|
+
}, disagreeText), /*#__PURE__*/_react.default.createElement("button", {
|
|
250
|
+
type: "button",
|
|
251
|
+
className: "Cookie__content__buttons__manual Cookie__content__buttons__manual-agree ".concat(manualButtonClassname),
|
|
252
|
+
onClick: function onClick(e) {
|
|
220
253
|
displayConsentChoices(e);
|
|
221
254
|
}
|
|
222
|
-
}, manualText)))) : /*#__PURE__*/
|
|
255
|
+
}, manualText)))) : /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
223
256
|
className: "Cookie__content__message"
|
|
224
|
-
}, /*#__PURE__*/
|
|
257
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
225
258
|
className: "Cookie__checkboxes-container row"
|
|
226
|
-
}, /*#__PURE__*/
|
|
259
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
227
260
|
className: "col-12"
|
|
228
|
-
}, manualHeader), renderChoices())), /*#__PURE__*/
|
|
261
|
+
}, manualHeader), renderChoices())), /*#__PURE__*/_react.default.createElement("div", {
|
|
229
262
|
className: "Cookie__content__buttons"
|
|
230
|
-
}, /*#__PURE__*/
|
|
263
|
+
}, /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
231
264
|
className: "Button--cta",
|
|
232
265
|
onClick: onConsent(true)
|
|
233
266
|
}, agreeText))))));
|
|
234
267
|
};
|
|
235
|
-
|
|
268
|
+
var _default = CookieCompliancePopup;
|
|
269
|
+
exports.default = _default;
|
|
236
270
|
CookieCompliancePopup.defaultProps = {
|
|
237
271
|
agreeText: 'Accepteren',
|
|
238
272
|
disagreeText: 'Alles weigeren',
|
|
239
273
|
manualText: 'Zelf instellen',
|
|
240
|
-
manualHeader: ()
|
|
241
|
-
onAgree: ()
|
|
242
|
-
onDisagree: ()
|
|
274
|
+
manualHeader: function manualHeader() {},
|
|
275
|
+
onAgree: function onAgree() {},
|
|
276
|
+
onDisagree: function onDisagree() {},
|
|
243
277
|
showDisagree: false,
|
|
244
|
-
manualButtonClassname:
|
|
278
|
+
manualButtonClassname: 'icon-after icon-chevron-right icon-variant-2',
|
|
245
279
|
cookieLevels: [{
|
|
246
|
-
value:
|
|
280
|
+
value: 'necessary',
|
|
247
281
|
label: 'Benodigd',
|
|
248
|
-
description:
|
|
282
|
+
description: '',
|
|
249
283
|
disabled: true
|
|
250
284
|
}, {
|
|
251
|
-
value:
|
|
252
|
-
label:
|
|
253
|
-
description:
|
|
285
|
+
value: 'voorkeuren',
|
|
286
|
+
label: 'Voorkeuren',
|
|
287
|
+
description: '',
|
|
254
288
|
disabled: false
|
|
255
289
|
}, {
|
|
256
|
-
value:
|
|
257
|
-
label:
|
|
258
|
-
description:
|
|
290
|
+
value: 'statistieken',
|
|
291
|
+
label: 'Statistieken',
|
|
292
|
+
description: '',
|
|
259
293
|
disabled: false
|
|
260
294
|
}, {
|
|
261
|
-
value:
|
|
262
|
-
label:
|
|
263
|
-
description:
|
|
295
|
+
value: 'marketing',
|
|
296
|
+
label: 'Marketing',
|
|
297
|
+
description: '',
|
|
264
298
|
disabled: false
|
|
265
299
|
}],
|
|
266
300
|
defaultValues: {
|
|
@@ -276,17 +310,29 @@ CookieCompliancePopup.defaultProps = {
|
|
|
276
310
|
}
|
|
277
311
|
};
|
|
278
312
|
CookieCompliancePopup.propTypes = {
|
|
279
|
-
agreeText:
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
313
|
+
agreeText: _propTypes.default.string,
|
|
314
|
+
disagreeText: _propTypes.default.string,
|
|
315
|
+
manualText: _propTypes.default.string,
|
|
316
|
+
manualHeader: _propTypes.default.func,
|
|
317
|
+
manualButtonClassname: _propTypes.default.string,
|
|
318
|
+
onAgree: _propTypes.default.func,
|
|
319
|
+
onDisagree: _propTypes.default.func,
|
|
320
|
+
showDisagree: _propTypes.default.bool,
|
|
321
|
+
cookieLevels: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
322
|
+
value: _propTypes.default.string,
|
|
323
|
+
label: _propTypes.default.string,
|
|
324
|
+
description: _propTypes.default.string,
|
|
325
|
+
disabled: _propTypes.default.bool
|
|
326
|
+
})),
|
|
327
|
+
cookieOptions: _propTypes.default.shape({
|
|
328
|
+
days: _propTypes.default.number,
|
|
329
|
+
path: _propTypes.default.string
|
|
330
|
+
}),
|
|
331
|
+
cookieDomain: _propTypes.default.string,
|
|
332
|
+
defaultValues: _propTypes.default.shape({
|
|
333
|
+
necessary: _propTypes.default.bool,
|
|
334
|
+
voorkeuren: _propTypes.default.bool,
|
|
335
|
+
statistieken: _propTypes.default.bool,
|
|
336
|
+
marketing: _propTypes.default.bool
|
|
337
|
+
})
|
|
292
338
|
};
|
|
@@ -1,41 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.Default = exports.Advanced = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _ = _interopRequireDefault(require("."));
|
|
9
|
+
require("./stories.scss");
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
var _default = {
|
|
5
12
|
title: 'Organisms/Cookie'
|
|
6
13
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
14
|
+
exports.default = _default;
|
|
15
|
+
var Default = function Default() {
|
|
16
|
+
return /*#__PURE__*/_react.default.createElement(_.default, {
|
|
17
|
+
agreeText: "Accepteren",
|
|
18
|
+
manualText: "Zelf instellen",
|
|
19
|
+
onAgree: function onAgree(choices) {
|
|
20
|
+
return console.log('User agreed to', choices);
|
|
21
|
+
},
|
|
22
|
+
onDisagree: function onDisagree() {
|
|
23
|
+
return console.log('User did NOT agree');
|
|
24
|
+
}
|
|
25
|
+
}, /*#__PURE__*/_react.default.createElement("h1", null, "Wij gebruiken cookies"), /*#__PURE__*/_react.default.createElement("p", null, "Aliquam accumsan sem lacus, ut laoreet urna aliquam quis. Ut ut imperdiet tortor, sed vestibulum felis. Etiam a eleifend leo, eu interdum nulla. Etiam id elit ex. Etiam condimentum facilisis venenatis. Curabitur accumsan ut dui vel laoreet. Donec dapibus convallis diam, at sodales nulla laoreet ac. Nunc maximus, orci ac tristique dapibus, dolor felis semper lorem, eu dapibus turpis enim quis urna."));
|
|
26
|
+
};
|
|
27
|
+
exports.Default = Default;
|
|
28
|
+
var Advanced = function Advanced() {
|
|
29
|
+
return /*#__PURE__*/_react.default.createElement(_.default, {
|
|
30
|
+
agreeText: "Accepteren",
|
|
31
|
+
manualText: "Zelf instellen",
|
|
32
|
+
showDisagree: true,
|
|
33
|
+
onDisagree: function onDisagree() {},
|
|
34
|
+
manualButtonClassname: "",
|
|
35
|
+
cookieLevels: [{
|
|
36
|
+
value: 'necessary',
|
|
37
|
+
label: 'Noodzakelijk',
|
|
38
|
+
description: 'Noodzakelijke cookies helpen een website bruikbaarder te maken, door basisfuncties als paginanavigatie en toegang tot beveiligde gedeelten van de website mogelijk te maken. Zonder deze cookies kan de website niet naar behoren werken.',
|
|
39
|
+
disabled: true
|
|
40
|
+
}, {
|
|
41
|
+
value: 'voorkeuren',
|
|
42
|
+
label: 'Voorkeuren',
|
|
43
|
+
description: 'Voorkeurscookies zorgen ervoor dat een website informatie kan onthouden die van invloed is op het gedrag en de vormgeving van de website, zoals de taal van uw voorkeur of de regio waar u woont.',
|
|
44
|
+
disabled: false
|
|
45
|
+
}, {
|
|
46
|
+
value: 'statistieken',
|
|
47
|
+
label: 'Statistieken',
|
|
48
|
+
description: 'Statistische cookies helpen eigenaren van websites begrijpen hoe bezoekers hun website gebruiken, door anoniem gegevens te verzamelen en te rapporteren.',
|
|
49
|
+
disabled: false
|
|
50
|
+
}],
|
|
51
|
+
defaultValues: {
|
|
52
|
+
necessary: true,
|
|
53
|
+
voorkeuren: true,
|
|
54
|
+
statistieken: true
|
|
55
|
+
},
|
|
56
|
+
manualHeader: /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h1", null, "Manual choice"), /*#__PURE__*/_react.default.createElement("p", null, "You have a choice."))
|
|
57
|
+
}, /*#__PURE__*/_react.default.createElement("h1", null, "Wij gebruiken cookies"), /*#__PURE__*/_react.default.createElement("p", null, "Aliquam accumsan sem lacus, ut laoreet urna aliquam quis. Ut ut imperdiet tortor, sed vestibulum felis. Etiam a eleifend leo, eu interdum nulla. Etiam id elit ex. Etiam condimentum facilisis venenatis. Curabitur accumsan ut dui vel laoreet. Donec dapibus convallis diam, at sodales nulla laoreet ac. Nunc maximus, orci ac tristique dapibus, dolor felis semper lorem, eu dapibus turpis enim quis urna."));
|
|
58
|
+
};
|
|
59
|
+
exports.Advanced = Advanced;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export default Dialog;
|
|
2
|
+
declare function Dialog(props: any): React.ReactPortal;
|
|
3
|
+
declare namespace Dialog {
|
|
4
|
+
namespace propTypes {
|
|
5
|
+
let id: PropTypes.Requireable<string>;
|
|
6
|
+
let children: PropTypes.Validator<PropTypes.ReactElementLike>;
|
|
7
|
+
let isOpen: PropTypes.Requireable<boolean>;
|
|
8
|
+
let closeFunction: PropTypes.Requireable<(...args: any[]) => any>;
|
|
9
|
+
let showCloseButton: PropTypes.Requireable<boolean>;
|
|
10
|
+
let closeButtonText: PropTypes.Requireable<string>;
|
|
11
|
+
let showCloseIcon: PropTypes.Requireable<boolean>;
|
|
12
|
+
let closeIcon: PropTypes.Requireable<string>;
|
|
13
|
+
let dialogLabel: PropTypes.Requireable<string>;
|
|
14
|
+
let portalTarget: PropTypes.Requireable<PropTypes.ReactElementLike>;
|
|
15
|
+
}
|
|
16
|
+
namespace defaultProps {
|
|
17
|
+
let id_1: any;
|
|
18
|
+
export { id_1 as id };
|
|
19
|
+
let showCloseButton_1: boolean;
|
|
20
|
+
export { showCloseButton_1 as showCloseButton };
|
|
21
|
+
let closeButtonText_1: string;
|
|
22
|
+
export { closeButtonText_1 as closeButtonText };
|
|
23
|
+
let showCloseIcon_1: boolean;
|
|
24
|
+
export { showCloseIcon_1 as showCloseIcon };
|
|
25
|
+
let closeIcon_1: string;
|
|
26
|
+
export { closeIcon_1 as closeIcon };
|
|
27
|
+
let dialogLabel_1: string;
|
|
28
|
+
export { dialogLabel_1 as dialogLabel };
|
|
29
|
+
let isOpen_1: boolean;
|
|
30
|
+
export { isOpen_1 as isOpen };
|
|
31
|
+
let closeFunction_1: any;
|
|
32
|
+
export { closeFunction_1 as closeFunction };
|
|
33
|
+
let portalTarget_1: HTMLElement;
|
|
34
|
+
export { portalTarget_1 as portalTarget };
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
import React from 'react';
|
|
38
|
+
import PropTypes from 'prop-types';
|