@uncinc/uncinc-react-kitchen-sink 2.3.6 → 2.4.0

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.
Files changed (104) hide show
  1. package/dist/Context/ViewportContext.js +5 -5
  2. package/dist/components/AbbreviationAnnotation/stories.js +1 -1
  3. package/dist/components/AbbreviationAnnotation/stories.scss +1 -1
  4. package/dist/components/AbbreviationAnnotation/style.scss +0 -2
  5. package/dist/components/Accordion/AccordionItem/index.js +1 -0
  6. package/dist/components/Accordion/stories.js +1 -1
  7. package/dist/components/ApiAutocomplete/stories.js +1 -1
  8. package/dist/components/Button/index.js +11 -7
  9. package/dist/components/Button/stories.js +1 -1
  10. package/dist/components/Cookie/Checkbox/index.js +1 -1
  11. package/dist/components/Cookie/index.js +28 -13
  12. package/dist/components/Cookie/stories.js +16 -16
  13. package/dist/components/Dialog/index.js +89 -0
  14. package/dist/components/Dialog/stories.js +28 -0
  15. package/dist/components/Dialog/style.scss +72 -0
  16. package/dist/components/FontSizeSwitcher/index.js +10 -4
  17. package/dist/components/FontSizeSwitcher/stories.js +1 -1
  18. package/dist/components/Form/Checkbox/index.js +1 -1
  19. package/dist/components/Form/Checkboxes/index.js +1 -1
  20. package/dist/components/Form/Checkboxes/index.test.js +1 -1
  21. package/dist/components/Form/DatePicker/index.js +3 -3
  22. package/dist/components/Form/DateSelect/index.js +3 -4
  23. package/dist/components/Form/DateSelect/stories.js +1 -1
  24. package/dist/components/Form/GenericFormElement/index.js +2 -2
  25. package/dist/components/Form/Number/index.js +1 -1
  26. package/dist/components/Form/SearchField/index.js +2 -2
  27. package/dist/components/Form/Select/Input/index.js +21 -23
  28. package/dist/components/Form/Select/index.js +1 -1
  29. package/dist/components/Form/TextField/index.js +2 -2
  30. package/dist/components/Form/TextField/index.test.js +1 -1
  31. package/dist/components/Form/TextField/stories.js +1 -1
  32. package/dist/components/Form/Textarea/index.js +1 -1
  33. package/dist/components/Hamburger/stories.js +3 -3
  34. package/dist/components/Header/index.js +3 -3
  35. package/dist/components/Header/stories.js +1 -1
  36. package/dist/components/Image/Picture/index.js +0 -1
  37. package/dist/components/Image/stories.js +9 -9
  38. package/dist/components/InlineMenu/index.js +2 -4
  39. package/dist/components/InlineMenu/stories.js +1 -1
  40. package/dist/components/Layout/Container/stories.js +29 -29
  41. package/dist/components/Layout/QuickLayout/stories.js +1 -1
  42. package/dist/components/Lottie/LottieAnimation/index.js +21 -17
  43. package/dist/components/Lottie/LottieAnimationWithMousePosition.js +4 -4
  44. package/dist/components/Lottie/index.js +3 -2
  45. package/dist/components/Lottie/stories.js +1 -1
  46. package/dist/components/MagicLine/index.js +3 -3
  47. package/dist/components/MagicLine/stories.js +4 -4
  48. package/dist/components/NavigationScroll/index.js +8 -11
  49. package/dist/components/NavigationScroll/stories.js +1 -1
  50. package/dist/components/Pagination/index.js +6 -0
  51. package/dist/components/Pagination/stories.js +11 -11
  52. package/dist/components/SearchKit/Facets/ChipFacet/index.js +1 -1
  53. package/dist/components/SearchKit/Facets/ListFacet/index.js +1 -0
  54. package/dist/components/SearchKit/Facets/SelectFacet/index.js +2 -2
  55. package/dist/components/SearchKit/SearchFacets/index.js +1 -3
  56. package/dist/components/SearchKit/SearchField/index.js +4 -4
  57. package/dist/components/SearchKit/SearchPage/index.js +9 -2
  58. package/dist/components/SearchKit/SearchReset/index.js +20 -8
  59. package/dist/components/SearchKit/SearchResults/index.js +10 -6
  60. package/dist/components/SearchKit/SearchSelectedFilters/Filters/CustomValue/index.js +15 -0
  61. package/dist/components/SearchKit/SearchSelectedFilters/Filters/DateRange/index.js +17 -0
  62. package/dist/components/SearchKit/SearchSelectedFilters/Filters/NumericRange/index.js +17 -0
  63. package/dist/components/SearchKit/SearchSelectedFilters/Filters/Value/index.js +19 -0
  64. package/dist/components/SearchKit/SearchSelectedFilters/index.js +30 -23
  65. package/dist/components/SearchKit/SearchSelectedFilters/style.scss +4 -0
  66. package/dist/components/SearchKit/SearchSorting/index.js +1 -1
  67. package/dist/components/SearchKit/index.js +10 -3
  68. package/dist/components/SearchKit/stories.js +83 -77
  69. package/dist/components/Share/index.js +4 -4
  70. package/dist/components/Share/stories.js +1 -1
  71. package/dist/components/Sliders/SliderRelated/index.js +1 -1
  72. package/dist/components/Sliders/SliderRelated/stories.js +13 -13
  73. package/dist/components/Webform/WebformDate/index.js +5 -4
  74. package/dist/components/Webform/WebformNumber/index.js +1 -1
  75. package/dist/components/Webform/WebformTextField/index.js +1 -1
  76. package/dist/components/Webform/stories.actions.js +17 -17
  77. package/dist/components/Webform/stories.checkboxes.js +22 -22
  78. package/dist/components/Webform/stories.checked.js +35 -35
  79. package/dist/components/Webform/stories.container.js +29 -29
  80. package/dist/components/Webform/stories.date.js +17 -17
  81. package/dist/components/Webform/stories.filled.js +35 -35
  82. package/dist/components/Webform/stories.number.js +18 -18
  83. package/dist/components/Webform/stories.radiobuttons.js +22 -22
  84. package/dist/components/Webform/stories.select.js +22 -22
  85. package/dist/components/Webform/stories.textarea.js +1 -1
  86. package/dist/components/Webform/stories.textfield.js +1 -1
  87. package/dist/components/Webform/stories.wizard.js +115 -115
  88. package/dist/components/WysiwygField/index.js +0 -1
  89. package/dist/components/WysiwygField/stories.js +2 -2
  90. package/dist/config/i18next/locales/en.json +4 -0
  91. package/dist/config/i18next/locales/nl.json +7 -0
  92. package/dist/helpers/date.js +8 -0
  93. package/dist/hooks/useBoolean.ts +20 -0
  94. package/dist/hooks/useClickOutside.ts +38 -0
  95. package/dist/hooks/useDialog.ts +29 -0
  96. package/dist/hooks/useDialogHelpers.ts +95 -0
  97. package/dist/hooks/useEscape.ts +26 -0
  98. package/dist/hooks/usePrevious.js +1 -2
  99. package/dist/hooks/useTrapFocus.ts +80 -0
  100. package/dist/index.js +1 -0
  101. package/package.json +39 -17
  102. package/dist/components/Form/SearchField/stories.js +0 -0
  103. package/dist/components/SearchKit/Facets/HierarchicalFilterFacet/index.js +0 -60
  104. package/dist/components/SearchKit/Facets/HierarchicalMenuFacet/index.js +0 -60
@@ -18,11 +18,11 @@ const defaultValue = {
18
18
  SCREEN_HUGE: DEFAULT_SCREEN_HUGE
19
19
  },
20
20
  imageStyles: {
21
- SCREEN_MOBILE: "small",
22
- SCREEN_TABLET: "small",
23
- SCREEN_NORMAL: "medium",
24
- SCREEN_WIDE: "large",
25
- SCREEN_HUGE: "large"
21
+ SCREEN_MOBILE: 'small',
22
+ SCREEN_TABLET: 'small',
23
+ SCREEN_NORMAL: 'medium',
24
+ SCREEN_WIDE: 'large',
25
+ SCREEN_HUGE: 'large'
26
26
  }
27
27
  };
28
28
  const ViewportContext = /*#__PURE__*/React.createContext(defaultValue);
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import AbbreviationAnnotation from './';
2
+ import AbbreviationAnnotation from '.';
3
3
  export default {
4
4
  title: 'Atoms/AbbreviationAnnotation'
5
5
  };
@@ -1,4 +1,4 @@
1
- @import 'assets/variables';
1
+ @import '../../styles/assets/variables';
2
2
 
3
3
  .AbbreviationAnnotationLink {
4
4
  background-color: $color--tertiary;
@@ -1,5 +1,3 @@
1
- @import 'assets/variables';
2
-
3
1
  .AbbreviationAnnotationLink {
4
2
  display: inline-block;
5
3
  padding: 0 0.5rem;
@@ -40,6 +40,7 @@ const AccordionItem = ({
40
40
  }, /*#__PURE__*/React.createElement(AccordeonTitle, {
41
41
  className: "Accordion__item__title"
42
42
  }, /*#__PURE__*/React.createElement("button", {
43
+ type: "button",
43
44
  onClick: () => setCollapsed(!collapsed)
44
45
  }, /*#__PURE__*/React.createElement("span", {
45
46
  className: iconClasses
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import Accordion from './';
2
+ import Accordion from '.';
3
3
  import AccordionItem from './AccordionItem';
4
4
  import AccordionItemVariant from './AccordionItemVariant';
5
5
  export default {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import ApiAutocomplete from './';
2
+ import ApiAutocomplete from '.';
3
3
  export default {
4
4
  title: 'Organisms/Autocomplete'
5
5
  };
@@ -37,13 +37,17 @@ const Button = ({
37
37
  }
38
38
  };
39
39
  if (!href) {
40
- return /*#__PURE__*/React.createElement("button", _extends({
41
- type: htmlType,
42
- className: classes,
43
- href: href
44
- }, props, {
45
- onClick: onClick
46
- }), children);
40
+ return (
41
+ /*#__PURE__*/
42
+ // eslint-disable-next-line react/button-has-type
43
+ React.createElement("button", _extends({
44
+ type: htmlType,
45
+ className: classes,
46
+ href: href
47
+ }, props, {
48
+ onClick: onClick
49
+ }), children)
50
+ );
47
51
  }
48
52
  return isExternalLink(href) ? /*#__PURE__*/React.createElement("a", _extends({
49
53
  className: classes,
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import Button from './';
2
+ import Button from '.';
3
3
  import './stories.scss';
4
4
  export default {
5
5
  title: 'Atoms/Button'
@@ -13,7 +13,7 @@ const CheckboxAndRadio = ({
13
13
  return /*#__PURE__*/React.createElement("div", {
14
14
  className: "Checkbox"
15
15
  }, /*#__PURE__*/React.createElement("input", {
16
- type: type || "checkbox",
16
+ type: type || 'checkbox',
17
17
  className: "Checkbox__input",
18
18
  name: name,
19
19
  id: id,
@@ -44,6 +44,7 @@ const CookieCompliancePopup = props => {
44
44
  return item.value;
45
45
  });
46
46
  const defaultState = categories.reduce((prev, category) => {
47
+ // eslint-disable-next-line valid-typeof
47
48
  prev[category] = typeof defaultValues[category] !== undefined ? defaultValues[category] : true;
48
49
  return prev;
49
50
  }, {});
@@ -212,9 +213,11 @@ const CookieCompliancePopup = props => {
212
213
  primary: true,
213
214
  onClick: onConsentAll
214
215
  }, agreeText), showDisagree && /*#__PURE__*/React.createElement("button", {
216
+ type: "button",
215
217
  className: `Cookie__content__buttons__manual Cookie__content__buttons__manual-disagree ${manualButtonClassname}`,
216
218
  onClick: onConsent(false)
217
219
  }, disagreeText), /*#__PURE__*/React.createElement("button", {
220
+ type: "button",
218
221
  className: `Cookie__content__buttons__manual Cookie__content__buttons__manual-agree ${manualButtonClassname}`,
219
222
  onClick: e => {
220
223
  displayConsentChoices(e);
@@ -241,26 +244,26 @@ CookieCompliancePopup.defaultProps = {
241
244
  onAgree: () => {},
242
245
  onDisagree: () => {},
243
246
  showDisagree: false,
244
- manualButtonClassname: "icon-after icon-chevron-right icon-variant-2",
247
+ manualButtonClassname: 'icon-after icon-chevron-right icon-variant-2',
245
248
  cookieLevels: [{
246
- value: "necessary",
249
+ value: 'necessary',
247
250
  label: 'Benodigd',
248
- description: "",
251
+ description: '',
249
252
  disabled: true
250
253
  }, {
251
- value: "voorkeuren",
252
- label: "Voorkeuren",
253
- description: "",
254
+ value: 'voorkeuren',
255
+ label: 'Voorkeuren',
256
+ description: '',
254
257
  disabled: false
255
258
  }, {
256
- value: "statistieken",
257
- label: "Statistieken",
258
- description: "",
259
+ value: 'statistieken',
260
+ label: 'Statistieken',
261
+ description: '',
259
262
  disabled: false
260
263
  }, {
261
- value: "marketing",
262
- label: "Marketing",
263
- description: "",
264
+ value: 'marketing',
265
+ label: 'Marketing',
266
+ description: '',
264
267
  disabled: false
265
268
  }],
266
269
  defaultValues: {
@@ -277,6 +280,7 @@ CookieCompliancePopup.defaultProps = {
277
280
  };
278
281
  CookieCompliancePopup.propTypes = {
279
282
  agreeText: PropTypes.string,
283
+ disagreeText: PropTypes.string,
280
284
  manualText: PropTypes.string,
281
285
  manualHeader: PropTypes.func,
282
286
  manualButtonClassname: PropTypes.string,
@@ -288,5 +292,16 @@ CookieCompliancePopup.propTypes = {
288
292
  label: PropTypes.string,
289
293
  description: PropTypes.string,
290
294
  disabled: PropTypes.bool
291
- }))
295
+ })),
296
+ cookieOptions: PropTypes.shape({
297
+ days: PropTypes.number,
298
+ path: PropTypes.string
299
+ }),
300
+ cookieDomain: PropTypes.string,
301
+ defaultValues: PropTypes.shape({
302
+ necessary: PropTypes.bool,
303
+ voorkeuren: PropTypes.bool,
304
+ statistieken: PropTypes.bool,
305
+ marketing: PropTypes.bool
306
+ })
292
307
  };
@@ -1,35 +1,35 @@
1
1
  import React from 'react';
2
- import Cookie from './';
2
+ import Cookie from '.';
3
3
  import './stories.scss';
4
4
  export default {
5
5
  title: 'Organisms/Cookie'
6
6
  };
7
7
  export const Default = () => /*#__PURE__*/React.createElement(Cookie, {
8
- agreeText: 'Accepteren',
9
- manualText: 'Zelf instellen',
10
- onAgree: choices => console.log("User agreed to", choices),
11
- onDisagree: () => console.log("User did NOT agree")
8
+ agreeText: "Accepteren",
9
+ manualText: "Zelf instellen",
10
+ onAgree: choices => console.log('User agreed to', choices),
11
+ onDisagree: () => console.log('User did NOT agree')
12
12
  }, /*#__PURE__*/React.createElement("h1", null, "Wij gebruiken cookies"), /*#__PURE__*/React.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."));
13
13
  export const Advanced = () => /*#__PURE__*/React.createElement(Cookie, {
14
- agreeText: 'Accepteren',
15
- manualText: 'Zelf instellen',
14
+ agreeText: "Accepteren",
15
+ manualText: "Zelf instellen",
16
16
  showDisagree: true,
17
17
  onDisagree: () => {},
18
18
  manualButtonClassname: "",
19
19
  cookieLevels: [{
20
- value: "necessary",
21
- label: "Noodzakelijk",
22
- 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.",
20
+ value: 'necessary',
21
+ label: 'Noodzakelijk',
22
+ 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.',
23
23
  disabled: true
24
24
  }, {
25
- value: "voorkeuren",
26
- label: "Voorkeuren",
27
- 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.",
25
+ value: 'voorkeuren',
26
+ label: 'Voorkeuren',
27
+ 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.',
28
28
  disabled: false
29
29
  }, {
30
- value: "statistieken",
31
- label: "Statistieken",
32
- description: "Statistische cookies helpen eigenaren van websites begrijpen hoe bezoekers hun website gebruiken, door anoniem gegevens te verzamelen en te rapporteren.",
30
+ value: 'statistieken',
31
+ label: 'Statistieken',
32
+ description: 'Statistische cookies helpen eigenaren van websites begrijpen hoe bezoekers hun website gebruiken, door anoniem gegevens te verzamelen en te rapporteren.',
33
33
  disabled: false
34
34
  }],
35
35
  defaultValues: {
@@ -0,0 +1,89 @@
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); }
2
+ import React, { useRef } from 'react';
3
+ import { createPortal } from 'react-dom';
4
+ import { RemoveScroll } from 'react-remove-scroll';
5
+ import { useTranslation } from 'react-i18next';
6
+ import PropTypes from 'prop-types';
7
+ import { v4 as uuidv4 } from 'uuid';
8
+ import useDialogHelpers from '../../hooks/useDialogHelpers';
9
+ import './style.scss';
10
+ const Dialog = props => {
11
+ const {
12
+ id,
13
+ children,
14
+ isOpen,
15
+ closeFunction,
16
+ showCloseButton,
17
+ closeButtonText,
18
+ showCloseIcon,
19
+ closeIcon,
20
+ dialogLabel,
21
+ portalTarget
22
+ } = props;
23
+ const wrapper = useRef(null);
24
+ const {
25
+ t
26
+ } = useTranslation();
27
+ const {
28
+ labelId,
29
+ dialogHelpersProps
30
+ } = useDialogHelpers({
31
+ id: id,
32
+ wrapperElement: wrapper,
33
+ closeFunction: closeFunction,
34
+ isOpen: isOpen
35
+ });
36
+ if (!isOpen) return null;
37
+ return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", {
38
+ className: "Dialog"
39
+ }, /*#__PURE__*/React.createElement("div", _extends({
40
+ className: "Dialog__wrapper"
41
+ }, dialogHelpersProps, {
42
+ ref: wrapper
43
+ }), /*#__PURE__*/React.createElement("div", {
44
+ id: labelId,
45
+ className: "Dialog__sr-only"
46
+ }, dialogLabel), showCloseIcon && /*#__PURE__*/React.createElement("button", {
47
+ type: "button",
48
+ className: "Dialog__closeicon",
49
+ "aria-label": t('general.close', 'Close'),
50
+ onClick: closeFunction
51
+ }, /*#__PURE__*/React.createElement("i", {
52
+ className: `icon ${closeIcon}`
53
+ })), /*#__PURE__*/React.createElement(RemoveScroll, {
54
+ className: "Dialog__inner"
55
+ }, /*#__PURE__*/React.createElement("div", {
56
+ className: "Dialog__content"
57
+ }, children), showCloseButton && /*#__PURE__*/React.createElement("button", {
58
+ type: "button",
59
+ className: "Dialog__closebutton",
60
+ onClick: closeFunction
61
+ }, closeButtonText))), /*#__PURE__*/React.createElement("div", {
62
+ className: "Dialog__backdrop",
63
+ "aria-label": t('general.close', 'Close')
64
+ })), portalTarget);
65
+ };
66
+ Dialog.propTypes = {
67
+ id: PropTypes.string,
68
+ children: PropTypes.element.isRequired,
69
+ isOpen: PropTypes.bool,
70
+ closeFunction: PropTypes.func,
71
+ showCloseButton: PropTypes.bool,
72
+ closeButtonText: PropTypes.string,
73
+ showCloseIcon: PropTypes.bool,
74
+ closeIcon: PropTypes.string,
75
+ dialogLabel: PropTypes.string,
76
+ portalTarget: PropTypes.element
77
+ };
78
+ Dialog.defaultProps = {
79
+ id: uuidv4(),
80
+ showCloseButton: false,
81
+ closeButtonText: 'Close',
82
+ showCloseIcon: false,
83
+ closeIcon: 'icon-cross',
84
+ dialogLabel: 'dialog',
85
+ isOpen: false,
86
+ closeFunction: null,
87
+ portalTarget: document.body
88
+ };
89
+ export default Dialog;
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import { v4 as uuidv4 } from 'uuid';
3
+ import useDialog from '../../hooks/useDialog';
4
+ export default {
5
+ title: 'Molecules/Dialog'
6
+ };
7
+ export const Default = () => {
8
+ const Content = () => {
9
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h1", null, "I'm a Dialog!"), /*#__PURE__*/React.createElement("p", null, "I've been created using the ", /*#__PURE__*/React.createElement("code", null, "useDialog"), " hook.", /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), "This hook provides you with:", /*#__PURE__*/React.createElement("ul", null, /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("code", null, "DialogComponent"), " - the Dialog component"), /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("code", null, "dialogIsOpen"), " - a const which tells you if the dialog is open or closed"), /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("code", null, "openDialog"), " - a function to open the dialog"), /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("code", null, "closeDialog"), " - a function to close the dialog")), "The ", /*#__PURE__*/React.createElement("code", null, "DialogComponent"), " has several arguments:", /*#__PURE__*/React.createElement("ul", null, /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("code", null, "id"), " - a unique identifier (optional)"), /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("code", null, "children"), " - the dialog's content. Wrapped within the dialog."), /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("code", null, "showCloseButton"), " - render a close button? (optional)"), /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("code", null, "showCloseIcon"), " - render a close icon? (optional)"), /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("code", null, "closeButtonText"), " - text for the close button (optional)"), /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("code", null, "closeIcon"), " - what icon to use. Default 'icon-cross' (optional)"), /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("code", null, "dialogLabel"), " - a label for a11y - default 'dialog' (optional)")), "Depending on where the dialog is being used, you might need to add a z-index.", /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), "This Dialog handles several things for you: Taking focus and keeping it inside and it allows you to close the Dialog by either pressing Escape or clicking outside of it. This is done by several different hooks.", /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), "Alternatively, if you need a more custom approach, you can opt to use the ", /*#__PURE__*/React.createElement("code", null, "useDialogControls"), " hook instead."));
10
+ };
11
+ return /*#__PURE__*/React.createElement("div", null, [...Array(3)].map(() => {
12
+ const {
13
+ openDialog,
14
+ DialogComponent
15
+ } = useDialog();
16
+ const uuid = uuidv4();
17
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("button", {
18
+ type: "button",
19
+ onClick: openDialog
20
+ }, "Open a dialog"), /*#__PURE__*/React.createElement(DialogComponent, {
21
+ id: uuid,
22
+ showCloseButton: true,
23
+ closeButtonText: "Click here to close me.",
24
+ showCloseIcon: true,
25
+ closeIcon: "icon-cross"
26
+ }, /*#__PURE__*/React.createElement(Content, null)));
27
+ }));
28
+ };
@@ -0,0 +1,72 @@
1
+ .Dialog {
2
+ position: fixed;
3
+ top: 0;
4
+ bottom: 0;
5
+ right: 0;
6
+ left: 0;
7
+ display: flex;
8
+ justify-content: center;
9
+ align-items: center;
10
+
11
+ &__sr-only {
12
+ position: absolute;
13
+ width: 1px;
14
+ height: 1px;
15
+ padding: 0;
16
+ margin: -1px;
17
+ overflow: hidden;
18
+ clip: rect(0,0,0,0);
19
+ border: 0;
20
+ }
21
+
22
+ &__closeicon {
23
+ position: absolute;
24
+ right: 1.5rem;
25
+ top: 1rem;
26
+ font-size: 2rem;
27
+ cursor: pointer;
28
+ }
29
+
30
+ &__wrapper {
31
+ position: relative;
32
+ display: flex;
33
+ flex-direction: column;
34
+ align-items: center;
35
+ justify-content: center;
36
+ padding: 2rem;
37
+ z-index: 1;
38
+ width: 50%;
39
+ max-height: 90vh;
40
+ background-color: white;
41
+ border-radius: 2rem;
42
+ }
43
+
44
+ &__inner {
45
+ display: flex;
46
+ flex-direction: column;
47
+ margin-top: 2rem;
48
+ overflow: hidden;
49
+ }
50
+
51
+ &__content {
52
+ display: flex;
53
+ flex-direction: column;
54
+ align-items: center;
55
+ overflow-x: hidden;
56
+ overflow-y: auto;
57
+ }
58
+
59
+ &__backdrop {
60
+ width: 100%;
61
+ height: 100%;
62
+ position: absolute;
63
+ cursor: pointer;
64
+ background: black;
65
+ opacity: 0.7;
66
+ }
67
+
68
+ }
69
+
70
+ code {
71
+ color: red;
72
+ }
@@ -23,17 +23,17 @@ const FontSizeSwitcher = ({
23
23
  }
24
24
  };
25
25
  useEffect(() => {
26
- var html = document.getElementsByTagName('html')[0];
26
+ let html = document.getElementsByTagName('html')[0];
27
27
  html.classList.remove('font-size--small', 'font-size--regular', 'font-size--large');
28
28
  html.classList.add(['font-size--small', 'font-size--regular', 'font-size--large'][currentSize]);
29
29
  }, [currentSize]);
30
- const classesSmall = classnames("FontSizeSwitcher__button FontSizeSwitcher__button--small", {
30
+ const classesSmall = classnames('FontSizeSwitcher__button FontSizeSwitcher__button--small', {
31
31
  'active': currentSize === 0
32
32
  });
33
- const classesRegular = classnames("FontSizeSwitcher__button FontSizeSwitcher__button--regular", {
33
+ const classesRegular = classnames('FontSizeSwitcher__button FontSizeSwitcher__button--regular', {
34
34
  'active': currentSize === 1
35
35
  });
36
- const classesLarge = classnames("FontSizeSwitcher__button FontSizeSwitcher__button--large", {
36
+ const classesLarge = classnames('FontSizeSwitcher__button FontSizeSwitcher__button--large', {
37
37
  'active': currentSize === 2
38
38
  });
39
39
  if (incrementMode === true) {
@@ -43,22 +43,28 @@ const FontSizeSwitcher = ({
43
43
  changeCurrentSize(currentSize + 1);
44
44
  }
45
45
  }, /*#__PURE__*/React.createElement("button", {
46
+ type: "button",
46
47
  className: classesSmall
47
48
  }, "Small"), /*#__PURE__*/React.createElement("button", {
49
+ type: "button",
48
50
  className: classesRegular
49
51
  }, "Regular"), /*#__PURE__*/React.createElement("button", {
52
+ type: "button",
50
53
  className: classesLarge
51
54
  }, "Large"));
52
55
  }
53
56
  return /*#__PURE__*/React.createElement("div", {
54
57
  className: "FontSizeSwitcher"
55
58
  }, /*#__PURE__*/React.createElement("button", {
59
+ type: "button",
56
60
  className: classesSmall,
57
61
  onClick: () => changeCurrentSize(0)
58
62
  }, "Small"), /*#__PURE__*/React.createElement("button", {
63
+ type: "button",
59
64
  className: classesRegular,
60
65
  onClick: () => changeCurrentSize(1)
61
66
  }, "Regular"), /*#__PURE__*/React.createElement("button", {
67
+ type: "button",
62
68
  className: classesLarge,
63
69
  onClick: () => changeCurrentSize(2)
64
70
  }, "Large"));
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import FontSizeSwitcher from './';
2
+ import FontSizeSwitcher from '.';
3
3
  export default {
4
4
  title: 'Molecules/FontSizeSwitcher'
5
5
  };
@@ -22,7 +22,7 @@ const Checkbox = props => {
22
22
  disabled = false
23
23
  } = props;
24
24
  return /*#__PURE__*/React.createElement(GenericFormElement, {
25
- className: c("Checkbox", wrapperClassName),
25
+ className: c('Checkbox', wrapperClassName),
26
26
  required: required,
27
27
  description: description,
28
28
  fieldName: fieldName,
@@ -86,7 +86,7 @@ const Checkboxes = props => {
86
86
  otherPlaceholder
87
87
  } = props;
88
88
  return /*#__PURE__*/React.createElement(GenericFormElement, {
89
- className: c("Checkboxes", wrapperClassName),
89
+ className: c('Checkboxes', wrapperClassName),
90
90
  title: title,
91
91
  required: required,
92
92
  description: description,
@@ -63,7 +63,7 @@ describe('<Checkboxes />', () => {
63
63
 
64
64
  // Submitted values should contain my value.
65
65
  expect(onSubmitCallback).to.have.been.calledWith({
66
- poison: ["rum", "whisky"]
66
+ poison: ['rum', 'whisky']
67
67
  });
68
68
  });
69
69
  });
@@ -3,7 +3,7 @@ import ReactDatePicker from 'react-datepicker';
3
3
  import { Field } from 'formik';
4
4
  import c from 'classnames';
5
5
  import GenericFormElement from '../GenericFormElement';
6
- import "react-datepicker/dist/react-datepicker.css";
6
+ import 'react-datepicker/dist/react-datepicker.css';
7
7
  import './style.scss';
8
8
  const DatePicker = props => {
9
9
  const {
@@ -23,7 +23,7 @@ const DatePicker = props => {
23
23
  disabled = false
24
24
  } = props;
25
25
  return /*#__PURE__*/React.createElement(GenericFormElement, {
26
- className: c("DatePicker", wrapperClassName),
26
+ className: c('DatePicker', wrapperClassName),
27
27
  title: title,
28
28
  required: required,
29
29
  description: description,
@@ -37,7 +37,7 @@ const DatePicker = props => {
37
37
  validation: validation,
38
38
  touched: touched,
39
39
  error: error,
40
- type: type || "text",
40
+ type: type || 'text',
41
41
  value: value
42
42
  }, ({
43
43
  form
@@ -84,7 +84,6 @@ const DateSelect = props => {
84
84
  if (required && !values[fieldName]) {
85
85
  !dateNotValid && setError(requiredError);
86
86
  setShowError(true);
87
- return;
88
87
  }
89
88
  }
90
89
  }, [isSubmitting]);
@@ -106,14 +105,14 @@ const DateSelect = props => {
106
105
  setError(notValidError);
107
106
  setShowError(true);
108
107
  setDateNotValid(true);
109
- setFieldValue("dateSelect", '');
108
+ setFieldValue('dateSelect', '');
110
109
  return;
111
110
  }
112
111
 
113
112
  // The Date is valid, so we hide previous errors and set the FieldValue
114
113
  setShowError(false);
115
114
  setDateNotValid(false);
116
- setFieldValue("dateSelect", date);
115
+ setFieldValue('dateSelect', date);
117
116
  return;
118
117
  }
119
118
 
@@ -122,7 +121,7 @@ const DateSelect = props => {
122
121
  // so that validation - and also the useEffect on isSubmitting - can do it's job.
123
122
  setShowError(false);
124
123
  setDateNotValid(false);
125
- setFieldValue("dateSelect", '');
124
+ setFieldValue('dateSelect', '');
126
125
  }, [day, month, year]);
127
126
  return /*#__PURE__*/React.createElement(GenericFormElement, {
128
127
  className: "DateSelect",
@@ -26,7 +26,7 @@ export const DateSelect = () => {
26
26
  requiredError: "Please fill all fields.",
27
27
  notValidError: "That's not a valid date."
28
28
  }), /*#__PURE__*/React.createElement("p", null, "Selected date: ", date.toString()), /*#__PURE__*/React.createElement("input", {
29
- class: "submitButton",
29
+ className: "submitButton",
30
30
  type: "submit",
31
31
  value: "Pick date"
32
32
  }));
@@ -22,9 +22,9 @@ const GenericFormElement = props => {
22
22
  className: error ? `FormElement ${className} error` : `FormElement ${className}`
23
23
  }, title && /*#__PURE__*/React.createElement("label", {
24
24
  htmlFor: fieldName
25
- }, title, !required && displayRequiredIndicator === "optional" && /*#__PURE__*/React.createElement("span", {
25
+ }, title, !required && displayRequiredIndicator === 'optional' && /*#__PURE__*/React.createElement("span", {
26
26
  className: `FormElement__optional ${className}__optional`
27
- }, t(['form.optional', ' - optioneel'])), required && displayRequiredIndicator === "required" && /*#__PURE__*/React.createElement("span", {
27
+ }, t(['form.optional', ' - optioneel'])), required && displayRequiredIndicator === 'required' && /*#__PURE__*/React.createElement("span", {
28
28
  className: `FormElement__required ${className}__required`
29
29
  }, t(['form.required', ' - vereist']))), /*#__PURE__*/React.createElement("div", {
30
30
  className: `FormElement__inner ${className}__inner`
@@ -1,7 +1,7 @@
1
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); }
2
2
  import React from 'react';
3
+ import { useTranslation } from 'react-i18next';
3
4
  import TextField from '../TextField';
4
- import { useTranslation } from "react-i18next";
5
5
  const Number = props => {
6
6
  const {
7
7
  t
@@ -20,12 +20,12 @@ const SearchField = props => {
20
20
  disabled = false
21
21
  } = props;
22
22
  return /*#__PURE__*/React.createElement("div", {
23
- className: c("SearchField", wrapperClassName)
23
+ className: c('SearchField', wrapperClassName)
24
24
  }, title && /*#__PURE__*/React.createElement("label", {
25
25
  htmlFor: fieldName
26
26
  }, title, " ", !required && /*#__PURE__*/React.createElement("div", {
27
27
  className: "WebformComponent--optional"
28
- }, "- ", 'optioneel')), /*#__PURE__*/React.createElement(Field, {
28
+ }, "- optioneel")), /*#__PURE__*/React.createElement(Field, {
29
29
  className: c(className, {
30
30
  'error': error && touched
31
31
  }),