@uncinc/uncinc-react-kitchen-sink 2.7.9 → 2.7.10
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 +3 -11
- package/dist/Context/ViewportContext.js +8 -21
- package/dist/Context/withMapping.js +6 -17
- package/dist/components/AbbreviationAnnotation/index.js +17 -28
- package/dist/components/Accordion/AccordionItem/index.js +19 -27
- package/dist/components/Accordion/AccordionItemVariant/index.js +14 -25
- package/dist/components/Accordion/index.js +6 -14
- package/dist/components/ApiAutocomplete/index.js +7 -17
- package/dist/components/Button/index.js +22 -31
- package/dist/components/CallToAction/index.js +12 -20
- package/dist/components/Cookie/Checkbox/index.js +6 -14
- package/dist/components/Cookie/index.js +59 -69
- package/dist/components/Dialog/DialogHelpersStory/index.js +13 -25
- package/dist/components/Dialog/DialogHookStory/index.js +12 -21
- package/dist/components/Dialog/DialogOverrideStory/index.js +9 -18
- package/dist/components/Dialog/index.js +35 -46
- package/dist/components/Download/index.js +14 -22
- package/dist/components/FontSizeSwitcher/index.js +17 -28
- package/dist/components/Form/Checkbox/index.js +18 -27
- package/dist/components/Form/Checkboxes/index.js +23 -31
- package/dist/components/Form/DateField/index.js +6 -14
- package/dist/components/Form/DatePicker/index.js +16 -24
- package/dist/components/Form/DatePickerRange/Picker/index.js +18 -26
- package/dist/components/Form/DatePickerRange/index.js +37 -47
- package/dist/components/Form/DateSelect/index.js +22 -33
- package/dist/components/Form/Email/index.js +4 -12
- package/dist/components/Form/FormikWrapper/index.js +13 -24
- package/dist/components/Form/GenericFormElement/index.js +14 -22
- package/dist/components/Form/Number/index.js +6 -14
- package/dist/components/Form/RadioButtons/index.js +23 -31
- package/dist/components/Form/SearchField/index.js +14 -22
- package/dist/components/Form/Select/Input/index.js +15 -23
- package/dist/components/Form/Select/index.js +12 -20
- package/dist/components/Form/TextField/index.js +16 -25
- package/dist/components/Form/Textarea/index.js +14 -22
- package/dist/components/Form/commonTests.js +19 -32
- package/dist/components/Form/index.js +13 -97
- package/dist/components/Hamburger/index.js +7 -15
- package/dist/components/Header/index.js +23 -38
- package/dist/components/Icon/index.js +9 -17
- package/dist/components/Image/AdaptivePicture/index.js +16 -23
- package/dist/components/Image/Background/index.js +10 -21
- package/dist/components/Image/LazyLoadWrapper/index.js +16 -26
- package/dist/components/Image/Picture/index.js +25 -33
- package/dist/components/Image/helpers/index.js +11 -21
- package/dist/components/Image/index.js +16 -24
- package/dist/components/InlineMenu/index.js +26 -37
- package/dist/components/Layout/Container/index.js +13 -21
- package/dist/components/Layout/QuickLayout/Auto/index.js +5 -13
- package/dist/components/Layout/QuickLayout/Center/index.js +6 -14
- package/dist/components/Layout/QuickLayout/Clamp/index.js +5 -13
- package/dist/components/Layout/QuickLayout/Sidebar/index.js +6 -14
- package/dist/components/Layout/QuickLayout/SpaceBetween/index.js +6 -14
- package/dist/components/Layout/QuickLayout/Stack/index.js +6 -14
- package/dist/components/Layout/QuickLayout/Wrap/index.js +7 -15
- package/dist/components/Layout/QuickLayout/index.js +16 -24
- package/dist/components/Lottie/LottieAnimation/index.js +12 -23
- package/dist/components/Lottie/LottieAnimationWithMousePosition.js +8 -19
- package/dist/components/Lottie/index.js +29 -41
- package/dist/components/MagicLine/index.js +12 -23
- package/dist/components/MediaPlayer/index.js +19 -28
- package/dist/components/MediaPlayer/types.js +1 -1
- package/dist/components/NavigationScroll/index.js +11 -21
- package/dist/components/Pagination/index.js +28 -37
- package/dist/components/SearchKit/Facets/ChipFacet/index.js +11 -20
- package/dist/components/SearchKit/Facets/ListFacet/index.js +11 -20
- package/dist/components/SearchKit/Facets/SelectFacet/index.js +15 -24
- package/dist/components/SearchKit/Query/index.js +13 -24
- package/dist/components/SearchKit/SearchFacets/index.js +10 -18
- package/dist/components/SearchKit/SearchField/index.js +12 -23
- package/dist/components/SearchKit/SearchLoadMore/index.js +7 -15
- package/dist/components/SearchKit/SearchPage/index.js +8 -17
- package/dist/components/SearchKit/SearchPagination/index.js +6 -14
- package/dist/components/SearchKit/SearchReset/index.js +8 -16
- package/dist/components/SearchKit/SearchResults/index.js +28 -39
- package/dist/components/SearchKit/SearchSelectedFilters/Filters/CustomValue/index.js +6 -14
- package/dist/components/SearchKit/SearchSelectedFilters/Filters/DateRange/index.js +6 -14
- package/dist/components/SearchKit/SearchSelectedFilters/Filters/NumericRange/index.js +6 -14
- package/dist/components/SearchKit/SearchSelectedFilters/Filters/Value/index.js +7 -18
- package/dist/components/SearchKit/SearchSelectedFilters/index.js +18 -26
- package/dist/components/SearchKit/SearchSorting/index.js +9 -17
- package/dist/components/SearchKit/index.js +29 -40
- package/dist/components/Share/index.js +18 -26
- package/dist/components/Sliders/SliderRelated/index.js +11 -19
- package/dist/components/TableRender/index.js +12 -23
- package/dist/components/Tag/index.js +10 -18
- package/dist/components/TitleWithText/index.js +8 -16
- package/dist/components/WysiwygField/index.js +10 -18
- package/dist/components/index.js +17 -127
- package/dist/config/constants.js +17 -37
- package/dist/config/i18next/index.js +9 -17
- package/dist/custom.d.js +0 -1
- package/dist/helpers/date.js +4 -13
- package/dist/helpers/gtm.js +4 -11
- package/dist/helpers/link.js +4 -12
- package/dist/helpers/useValueForCurrentViewPort.js +6 -13
- package/dist/hooks/useBoolean.js +6 -12
- package/dist/hooks/useClickOutside.js +3 -9
- package/dist/hooks/useDialog.js +6 -13
- package/dist/hooks/useDialogHelpers.js +11 -18
- package/dist/hooks/useEscape.js +3 -9
- package/dist/hooks/useOnScreen.js +4 -10
- package/dist/hooks/usePrevious.js +4 -10
- package/dist/hooks/useScrollPosition.js +4 -11
- package/dist/hooks/useTrapFocus.js +3 -9
- package/dist/hooks/useWindowDimensions.js +4 -10
- package/dist/index.js +89 -564
- package/dist/organisms/Downloads/index.js +10 -18
- package/dist/organisms/ImageGrid/index.js +5 -13
- package/dist/organisms/Quote/index.js +16 -24
- package/dist/organisms/Text/index.js +20 -31
- package/dist/setupTests.js +2 -5
- package/package.json +8 -2
|
@@ -1,31 +1,23 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
-
var _WysiwygField = _interopRequireDefault(require("../WysiwygField"));
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
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 from 'react';
|
|
3
|
+
import c from 'classnames';
|
|
4
|
+
import WysiwygField from '../WysiwygField';
|
|
12
5
|
var TitleWithText = function TitleWithText(_ref) {
|
|
13
6
|
var title = _ref.title,
|
|
14
7
|
titleProps = _ref.titleProps,
|
|
15
8
|
text = _ref.text,
|
|
16
9
|
textProps = _ref.textProps,
|
|
17
10
|
className = _ref.className;
|
|
18
|
-
var classes = (
|
|
19
|
-
return /*#__PURE__*/
|
|
11
|
+
var classes = c('TitleWithText', className);
|
|
12
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
20
13
|
className: classes
|
|
21
|
-
}, title && /*#__PURE__*/
|
|
14
|
+
}, title && /*#__PURE__*/React.createElement("h2", _extends({
|
|
22
15
|
className: "TitleWithText__title"
|
|
23
|
-
}, titleProps), title), text && /*#__PURE__*/
|
|
16
|
+
}, titleProps), title), text && /*#__PURE__*/React.createElement(WysiwygField, _extends({
|
|
24
17
|
className: "TitleWithText__text",
|
|
25
18
|
property: "schema:text"
|
|
26
19
|
}, textProps, {
|
|
27
20
|
html: text
|
|
28
21
|
})));
|
|
29
22
|
};
|
|
30
|
-
|
|
31
|
-
exports.default = _default;
|
|
23
|
+
export default TitleWithText;
|
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _reactHtmlParser = _interopRequireDefault(require("react-html-parser"));
|
|
10
|
-
var _Button = _interopRequireDefault(require("../Button"));
|
|
11
1
|
var _excluded = ["html", "customElementHandler"];
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
2
|
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); }
|
|
14
3
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
15
4
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import ReactHtmlParser from 'react-html-parser';
|
|
8
|
+
import Button from '../Button';
|
|
16
9
|
var WysiwygField = function WysiwygField(_ref) {
|
|
17
10
|
var html = _ref.html,
|
|
18
11
|
_ref$customElementHan = _ref.customElementHandler,
|
|
19
12
|
customElementHandler = _ref$customElementHan === void 0 ? function () {} : _ref$customElementHan,
|
|
20
13
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
21
|
-
var parsedHtml = (
|
|
14
|
+
var parsedHtml = ReactHtmlParser(html, {
|
|
22
15
|
transform: function transform(node) {
|
|
23
16
|
var customHandler = customElementHandler(node);
|
|
24
17
|
if (customHandler) {
|
|
@@ -29,7 +22,7 @@ var WysiwygField = function WysiwygField(_ref) {
|
|
|
29
22
|
{
|
|
30
23
|
if (node.attribs.class && node.attribs.class.indexOf('button--primary') !== -1) {
|
|
31
24
|
var label = node.children[0].data;
|
|
32
|
-
return /*#__PURE__*/
|
|
25
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
33
26
|
primary: true,
|
|
34
27
|
withIcon: true,
|
|
35
28
|
buttonIcon: true,
|
|
@@ -48,16 +41,15 @@ var WysiwygField = function WysiwygField(_ref) {
|
|
|
48
41
|
}
|
|
49
42
|
}
|
|
50
43
|
});
|
|
51
|
-
return /*#__PURE__*/
|
|
44
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
52
45
|
className: "WysiwygField"
|
|
53
46
|
}, props), parsedHtml);
|
|
54
47
|
};
|
|
55
48
|
WysiwygField.propTypes = {
|
|
56
|
-
html:
|
|
57
|
-
customElementHandler:
|
|
49
|
+
html: PropTypes.string.isRequired,
|
|
50
|
+
customElementHandler: PropTypes.func
|
|
58
51
|
};
|
|
59
52
|
WysiwygField.defaultProps = {
|
|
60
53
|
customElementHandler: function customElementHandler() {}
|
|
61
54
|
};
|
|
62
|
-
|
|
63
|
-
exports.default = _default;
|
|
55
|
+
export default WysiwygField;
|
package/dist/components/index.js
CHANGED
|
@@ -1,127 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports, "FormCheckboxes", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function get() {
|
|
22
|
-
return _Checkboxes.default;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
Object.defineProperty(exports, "FormDate", {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function get() {
|
|
28
|
-
return _DateField.default;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
Object.defineProperty(exports, "FormDatePicker", {
|
|
32
|
-
enumerable: true,
|
|
33
|
-
get: function get() {
|
|
34
|
-
return _DatePicker.default;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
Object.defineProperty(exports, "FormDateSelect", {
|
|
38
|
-
enumerable: true,
|
|
39
|
-
get: function get() {
|
|
40
|
-
return _DateSelect.default;
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
Object.defineProperty(exports, "FormEmail", {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
get: function get() {
|
|
46
|
-
return _Email.default;
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
Object.defineProperty(exports, "FormNumber", {
|
|
50
|
-
enumerable: true,
|
|
51
|
-
get: function get() {
|
|
52
|
-
return _Number.default;
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
Object.defineProperty(exports, "FormRadioButtons", {
|
|
56
|
-
enumerable: true,
|
|
57
|
-
get: function get() {
|
|
58
|
-
return _RadioButtons.default;
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
Object.defineProperty(exports, "FormSearchField", {
|
|
62
|
-
enumerable: true,
|
|
63
|
-
get: function get() {
|
|
64
|
-
return _SearchField.default;
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
Object.defineProperty(exports, "FormSelect", {
|
|
68
|
-
enumerable: true,
|
|
69
|
-
get: function get() {
|
|
70
|
-
return _Select.default;
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
Object.defineProperty(exports, "FormTextField", {
|
|
74
|
-
enumerable: true,
|
|
75
|
-
get: function get() {
|
|
76
|
-
return _TextField.default;
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
Object.defineProperty(exports, "FormTextarea", {
|
|
80
|
-
enumerable: true,
|
|
81
|
-
get: function get() {
|
|
82
|
-
return _Textarea.default;
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
Object.defineProperty(exports, "FormikExtendedContextProvider", {
|
|
86
|
-
enumerable: true,
|
|
87
|
-
get: function get() {
|
|
88
|
-
return _FormikWrapper.FormikExtendedContextProvider;
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
Object.defineProperty(exports, "FormikWrapper", {
|
|
92
|
-
enumerable: true,
|
|
93
|
-
get: function get() {
|
|
94
|
-
return _FormikWrapper.default;
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
Object.defineProperty(exports, "MediaPlayer", {
|
|
98
|
-
enumerable: true,
|
|
99
|
-
get: function get() {
|
|
100
|
-
return _MediaPlayer.default;
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
Object.defineProperty(exports, "WysiwygField", {
|
|
104
|
-
enumerable: true,
|
|
105
|
-
get: function get() {
|
|
106
|
-
return _WysiwygField.default;
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
var _Button = _interopRequireDefault(require("./Button"));
|
|
110
|
-
var _WysiwygField = _interopRequireDefault(require("./WysiwygField"));
|
|
111
|
-
var _MediaPlayer = _interopRequireDefault(require("./MediaPlayer"));
|
|
112
|
-
var _FormikWrapper = _interopRequireWildcard(require("./Form/FormikWrapper"));
|
|
113
|
-
var _Checkbox = _interopRequireDefault(require("./Form/Checkbox"));
|
|
114
|
-
var _Checkboxes = _interopRequireDefault(require("./Form/Checkboxes"));
|
|
115
|
-
var _DateField = _interopRequireDefault(require("./Form/DateField"));
|
|
116
|
-
var _DatePicker = _interopRequireDefault(require("./Form/DatePicker"));
|
|
117
|
-
var _DateSelect = _interopRequireDefault(require("./Form/DateSelect"));
|
|
118
|
-
var _Email = _interopRequireDefault(require("./Form/Email"));
|
|
119
|
-
var _Number = _interopRequireDefault(require("./Form/Number"));
|
|
120
|
-
var _RadioButtons = _interopRequireDefault(require("./Form/RadioButtons"));
|
|
121
|
-
var _SearchField = _interopRequireDefault(require("./Form/SearchField"));
|
|
122
|
-
var _Select = _interopRequireDefault(require("./Form/Select"));
|
|
123
|
-
var _Textarea = _interopRequireDefault(require("./Form/Textarea"));
|
|
124
|
-
var _TextField = _interopRequireDefault(require("./Form/TextField"));
|
|
125
|
-
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); }
|
|
126
|
-
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; }
|
|
127
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1
|
+
export { default as Button } from './Button';
|
|
2
|
+
export { default as WysiwygField } from './WysiwygField';
|
|
3
|
+
export { default as MediaPlayer } from './MediaPlayer';
|
|
4
|
+
export { default as FormikWrapper } from './Form/FormikWrapper';
|
|
5
|
+
export { FormikExtendedContextProvider } from './Form/FormikWrapper';
|
|
6
|
+
export { default as FormCheckbox } from './Form/Checkbox';
|
|
7
|
+
export { default as FormCheckboxes } from './Form/Checkboxes';
|
|
8
|
+
export { default as FormDate } from './Form/DateField';
|
|
9
|
+
export { default as FormDatePicker } from './Form/DatePicker';
|
|
10
|
+
export { default as FormDateSelect } from './Form/DateSelect';
|
|
11
|
+
export { default as FormEmail } from './Form/Email';
|
|
12
|
+
export { default as FormNumber } from './Form/Number';
|
|
13
|
+
export { default as FormRadioButtons } from './Form/RadioButtons';
|
|
14
|
+
export { default as FormSearchField } from './Form/SearchField';
|
|
15
|
+
export { default as FormSelect } from './Form/Select';
|
|
16
|
+
export { default as FormTextarea } from './Form/Textarea';
|
|
17
|
+
export { default as FormTextField } from './Form/TextField';
|
package/dist/config/constants.js
CHANGED
|
@@ -1,44 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.__DEBUG__ = exports.VIEW_ACTION_REPLACE = exports.VIEW_ACTION_APPEND = exports.SITE_NAME = exports.SCREEN_WIDE = exports.SCREEN_TABLET = exports.SCREEN_NORMAL = exports.SCREEN_MOBILE = exports.SCREEN_HUGE = exports.MAPBOX_API_TOKEN = exports.IS_SERVER = exports.IS_CLIENT = exports.DEFAULT_LANGUAGE = exports.APP_ENV = exports.API_URL = void 0;
|
|
7
|
-
var APP_ENV = process.env.REACT_APP_ENV;
|
|
8
|
-
exports.APP_ENV = APP_ENV;
|
|
9
|
-
var __DEBUG__ = APP_ENV !== 'production';
|
|
10
|
-
exports.__DEBUG__ = __DEBUG__;
|
|
11
|
-
var DEFAULT_LANGUAGE = 'nl';
|
|
12
|
-
exports.DEFAULT_LANGUAGE = DEFAULT_LANGUAGE;
|
|
13
|
-
var SITE_NAME = 'Unc Inc';
|
|
14
|
-
exports.SITE_NAME = SITE_NAME;
|
|
15
|
-
var MAPBOX_API_TOKEN = 'pk.eyJ1IjoidW5jaW5jYnYiLCJhIjoiY2pxeHhxd2FlMDMyeTQzbWp1a3hleHRscCJ9.QMfmlryTLEyrSyjU7FfBiw';
|
|
16
|
-
exports.MAPBOX_API_TOKEN = MAPBOX_API_TOKEN;
|
|
1
|
+
export var APP_ENV = process.env.REACT_APP_ENV;
|
|
2
|
+
export var __DEBUG__ = APP_ENV !== 'production';
|
|
3
|
+
export var DEFAULT_LANGUAGE = 'nl';
|
|
4
|
+
export var SITE_NAME = 'Unc Inc';
|
|
5
|
+
export var MAPBOX_API_TOKEN = 'pk.eyJ1IjoidW5jaW5jYnYiLCJhIjoiY2pxeHhxd2FlMDMyeTQzbWp1a3hleHRscCJ9.QMfmlryTLEyrSyjU7FfBiw';
|
|
17
6
|
var API_URL = 'https://content.uncinc.nl';
|
|
18
|
-
exports.API_URL = API_URL;
|
|
19
7
|
if (APP_ENV === 'development') {
|
|
20
|
-
|
|
8
|
+
API_URL = 'http://uncinc.docker.localhost';
|
|
21
9
|
} else if (APP_ENV === 'staging') {
|
|
22
|
-
|
|
10
|
+
API_URL = 'https://staging.uncinc.nl';
|
|
23
11
|
}
|
|
24
|
-
var IS_SERVER = !(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
25
|
-
|
|
26
|
-
var IS_CLIENT = !IS_SERVER;
|
|
12
|
+
export var IS_SERVER = !(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
13
|
+
export var IS_CLIENT = !IS_SERVER;
|
|
27
14
|
|
|
28
15
|
// The value is where the breakpoint starts (mobile-first).
|
|
29
16
|
// These values are taken from '/src/shared/styles/assets/_variables.scss'.
|
|
30
|
-
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
var
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
exports.SCREEN_WIDE = SCREEN_WIDE;
|
|
39
|
-
var SCREEN_HUGE = 2000;
|
|
40
|
-
exports.SCREEN_HUGE = SCREEN_HUGE;
|
|
41
|
-
var VIEW_ACTION_REPLACE = 'replace';
|
|
42
|
-
exports.VIEW_ACTION_REPLACE = VIEW_ACTION_REPLACE;
|
|
43
|
-
var VIEW_ACTION_APPEND = 'append';
|
|
44
|
-
exports.VIEW_ACTION_APPEND = VIEW_ACTION_APPEND;
|
|
17
|
+
export var SCREEN_MOBILE = 0;
|
|
18
|
+
export var SCREEN_TABLET = 768;
|
|
19
|
+
export var SCREEN_NORMAL = 992;
|
|
20
|
+
export var SCREEN_WIDE = 1240;
|
|
21
|
+
export var SCREEN_HUGE = 2000;
|
|
22
|
+
export var VIEW_ACTION_REPLACE = 'replace';
|
|
23
|
+
export var VIEW_ACTION_APPEND = 'append';
|
|
24
|
+
export { API_URL };
|
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _i18next = _interopRequireDefault(require("i18next"));
|
|
8
|
-
var _i18nextBrowserLanguagedetector = _interopRequireDefault(require("i18next-browser-languagedetector"));
|
|
9
|
-
var _reactI18next = require("react-i18next");
|
|
10
|
-
var _nl = _interopRequireDefault(require("./locales/nl.json"));
|
|
11
|
-
var _en = _interopRequireDefault(require("./locales/en.json"));
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
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';
|
|
13
6
|
var resources = {
|
|
14
7
|
nl: {
|
|
15
|
-
translation:
|
|
8
|
+
translation: NL
|
|
16
9
|
},
|
|
17
10
|
en: {
|
|
18
|
-
translation:
|
|
11
|
+
translation: EN
|
|
19
12
|
}
|
|
20
13
|
};
|
|
21
|
-
|
|
14
|
+
i18n.use(LanguageDetector).use(initReactI18next).init({
|
|
22
15
|
resources: resources,
|
|
23
16
|
lng: 'nl',
|
|
24
17
|
fallbackLng: 'nl',
|
|
@@ -27,5 +20,4 @@ _i18next.default.use(_i18nextBrowserLanguagedetector.default).use(_reactI18next.
|
|
|
27
20
|
escapeValue: false
|
|
28
21
|
}
|
|
29
22
|
});
|
|
30
|
-
|
|
31
|
-
exports.default = _default;
|
|
23
|
+
export default i18n;
|
package/dist/custom.d.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/dist/helpers/date.js
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.parseDateWithTimezoneOffset = exports.isValidDate = exports.doubleDigits = void 0;
|
|
7
|
-
var parseDateWithTimezoneOffset = function parseDateWithTimezoneOffset(date) {
|
|
1
|
+
export var parseDateWithTimezoneOffset = function parseDateWithTimezoneOffset(date) {
|
|
8
2
|
var offset = date.getTimezoneOffset();
|
|
9
3
|
var dateWithTimezoneOffset = new Date(date.getTime() - offset * 60 * 1000);
|
|
10
4
|
return dateWithTimezoneOffset.toISOString();
|
|
11
5
|
};
|
|
12
|
-
|
|
13
|
-
var isValidDate = function isValidDate(date) {
|
|
6
|
+
export var isValidDate = function isValidDate(date) {
|
|
14
7
|
return date instanceof Date && !Number.isNaN(date);
|
|
15
8
|
};
|
|
16
9
|
|
|
@@ -21,8 +14,6 @@ var isValidDate = function isValidDate(date) {
|
|
|
21
14
|
*
|
|
22
15
|
* @returns {number} The double digit number.
|
|
23
16
|
*/
|
|
24
|
-
|
|
25
|
-
var doubleDigits = function doubleDigits(number) {
|
|
17
|
+
export var doubleDigits = function doubleDigits(number) {
|
|
26
18
|
return "0".concat(number).slice(-2);
|
|
27
|
-
};
|
|
28
|
-
exports.doubleDigits = doubleDigits;
|
|
19
|
+
};
|
package/dist/helpers/gtm.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _constants = require("../config/constants");
|
|
1
|
+
import { IS_CLIENT, __DEBUG__ } from '../config/constants';
|
|
8
2
|
var gtm = {
|
|
9
3
|
// Track wether events are binded already or not.
|
|
10
4
|
hasEventsAttached: false,
|
|
@@ -48,7 +42,7 @@ gtm.register = function (fn, callback) {
|
|
|
48
42
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
49
43
|
args[_key] = arguments[_key];
|
|
50
44
|
}
|
|
51
|
-
if (
|
|
45
|
+
if (__DEBUG__) {
|
|
52
46
|
console.info("GTM Event: ".concat(fn, "() with args"), args);
|
|
53
47
|
}
|
|
54
48
|
callback.apply(void 0, args);
|
|
@@ -82,7 +76,7 @@ gtm.push = function (data) {
|
|
|
82
76
|
* @return {void}
|
|
83
77
|
*/
|
|
84
78
|
gtm.attachEventListeners = function () {
|
|
85
|
-
if (
|
|
79
|
+
if (IS_CLIENT && !gtm.hasEventsAttached) {
|
|
86
80
|
window.addEventListener('GTM-Loaded', function () {
|
|
87
81
|
for (var i = 0, len = gtm.tempDataLayer.length; i < len; i++) {
|
|
88
82
|
window.dataLayer.push(gtm.tempDataLayer[i]);
|
|
@@ -123,5 +117,4 @@ gtm.register('loadConsentRequiredTags', function () {
|
|
|
123
117
|
|
|
124
118
|
// Initialize GTM.
|
|
125
119
|
gtm.attachEventListeners();
|
|
126
|
-
|
|
127
|
-
exports.default = _default;
|
|
120
|
+
export default gtm;
|
package/dist/helpers/link.js
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isExternalLink = isExternalLink;
|
|
7
|
-
exports.normalizeLink = normalizeLink;
|
|
8
|
-
var _reactGlobalConfiguration = _interopRequireDefault(require("react-global-configuration"));
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
function isExternalLink() {
|
|
1
|
+
import config from 'react-global-configuration';
|
|
2
|
+
export function isExternalLink() {
|
|
11
3
|
var uri = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
12
4
|
var value = uri.trim().replace(/\/$/, '');
|
|
13
5
|
if (/^(https?|mailto|tel):/g.test(value)) {
|
|
@@ -15,8 +7,8 @@ function isExternalLink() {
|
|
|
15
7
|
}
|
|
16
8
|
return false;
|
|
17
9
|
}
|
|
18
|
-
function normalizeLink(link) {
|
|
19
|
-
var API_URL =
|
|
10
|
+
export function normalizeLink(link) {
|
|
11
|
+
var API_URL = config.get('API_URL');
|
|
20
12
|
if (/^\//g.test(link)) {
|
|
21
13
|
return "".concat(API_URL).concat(link);
|
|
22
14
|
}
|
|
@@ -1,25 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = useValueForCurrentViewPort;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _ViewportContext = _interopRequireDefault(require("../Context/ViewportContext"));
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
2
|
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."); }
|
|
12
3
|
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); }
|
|
13
4
|
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; }
|
|
14
5
|
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; } }
|
|
15
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
import { useState, useEffect, useContext } from 'react';
|
|
8
|
+
import ViewportContext from '../Context/ViewportContext';
|
|
9
|
+
export default function useValueForCurrentViewPort(val1, val2, val3, val4, val5) {
|
|
10
|
+
var viewportContext = useContext(ViewportContext);
|
|
11
|
+
var _useState = useState(val1),
|
|
19
12
|
_useState2 = _slicedToArray(_useState, 2),
|
|
20
13
|
ValueForCurrentViewPort = _useState2[0],
|
|
21
14
|
setValueForCurrentViewPort = _useState2[1];
|
|
22
|
-
|
|
15
|
+
useEffect(function () {
|
|
23
16
|
function handleResize() {
|
|
24
17
|
var _window = window,
|
|
25
18
|
width = _window.innerWidth;
|
package/dist/hooks/useBoolean.js
CHANGED
|
@@ -1,31 +1,25 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = useBoolean;
|
|
7
|
-
var _react = require("react");
|
|
8
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
2
|
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."); }
|
|
10
3
|
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); }
|
|
11
4
|
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; }
|
|
12
5
|
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; } }
|
|
13
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
-
|
|
7
|
+
import { useCallback, useState } from 'react';
|
|
8
|
+
export default function useBoolean() {
|
|
15
9
|
var defaultValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
16
|
-
var _useState =
|
|
10
|
+
var _useState = useState(defaultValue),
|
|
17
11
|
_useState2 = _slicedToArray(_useState, 2),
|
|
18
12
|
value = _useState2[0],
|
|
19
13
|
setValue = _useState2[1];
|
|
20
|
-
var toggle =
|
|
14
|
+
var toggle = useCallback(function () {
|
|
21
15
|
setValue(function (current) {
|
|
22
16
|
return !current;
|
|
23
17
|
});
|
|
24
18
|
}, [setValue]);
|
|
25
|
-
var setTrue =
|
|
19
|
+
var setTrue = useCallback(function () {
|
|
26
20
|
setValue(true);
|
|
27
21
|
}, []);
|
|
28
|
-
var setFalse =
|
|
22
|
+
var setFalse = useCallback(function () {
|
|
29
23
|
setValue(false);
|
|
30
24
|
}, []);
|
|
31
25
|
return {
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = useClickOutside;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
function useClickOutside(_ref) {
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
export default function useClickOutside(_ref) {
|
|
9
3
|
var refs = _ref.refs,
|
|
10
4
|
_ref$unless = _ref.unless,
|
|
11
5
|
unless = _ref$unless === void 0 ? false : _ref$unless,
|
|
12
6
|
onClick = _ref.onClick;
|
|
13
|
-
|
|
7
|
+
useEffect(function () {
|
|
14
8
|
var refsAsArray = Array.isArray(refs) ? refs : [refs];
|
|
15
9
|
function handleOutsideClick(e) {
|
|
16
10
|
var allRefsHaveCurrent = refsAsArray.every(function (ref) {
|
package/dist/hooks/useDialog.js
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
1
|
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); }
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = useDialog;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _Dialog = _interopRequireDefault(require("../components/Dialog"));
|
|
10
|
-
var _useBoolean2 = _interopRequireDefault(require("./useBoolean"));
|
|
11
2
|
var _excluded = ["children"];
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
3
|
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; }
|
|
14
4
|
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; }
|
|
15
5
|
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; }
|
|
@@ -17,15 +7,18 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
|
|
|
17
7
|
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); }
|
|
18
8
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
19
9
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
20
|
-
|
|
21
|
-
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import Dialog from '../components/Dialog';
|
|
12
|
+
import useBoolean from './useBoolean';
|
|
13
|
+
export default function useDialog() {
|
|
14
|
+
var _useBoolean = useBoolean(),
|
|
22
15
|
dialogIsOpen = _useBoolean.value,
|
|
23
16
|
openDialog = _useBoolean.setTrue,
|
|
24
17
|
closeDialog = _useBoolean.setFalse;
|
|
25
18
|
var DialogComponent = function DialogComponent(_ref) {
|
|
26
19
|
var children = _ref.children,
|
|
27
20
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
28
|
-
return /*#__PURE__*/
|
|
21
|
+
return /*#__PURE__*/React.createElement(Dialog, _objectSpread(_objectSpread({}, props), {}, {
|
|
29
22
|
isOpen: dialogIsOpen,
|
|
30
23
|
closeFunction: closeDialog
|
|
31
24
|
}), children);
|
|
@@ -1,23 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.default = useDialogHelpers;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _uuid = require("uuid");
|
|
9
|
-
var _useClickOutside = _interopRequireDefault(require("./useClickOutside"));
|
|
10
|
-
var _useEscape = _interopRequireDefault(require("./useEscape"));
|
|
11
|
-
var _useTrapFocus = _interopRequireDefault(require("./useTrapFocus"));
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
3
|
+
import useClickOutside from './useClickOutside';
|
|
4
|
+
import useEscape from './useEscape';
|
|
5
|
+
import useTrapFocus from './useTrapFocus';
|
|
13
6
|
/**
|
|
14
7
|
* Hook to allow you to implement your own Dialog component.
|
|
15
8
|
* This takes care of focus, and closing the Dialog by
|
|
16
9
|
* click outside it, or hitting Escape.
|
|
17
10
|
*/
|
|
18
|
-
function useDialogHelpers(options) {
|
|
11
|
+
export default function useDialogHelpers(options) {
|
|
19
12
|
var _options$id = options.id,
|
|
20
|
-
id = _options$id === void 0 ? (
|
|
13
|
+
id = _options$id === void 0 ? uuidv4() : _options$id,
|
|
21
14
|
wrapperElement = options.wrapperElement,
|
|
22
15
|
closeFunction = options.closeFunction,
|
|
23
16
|
isOpen = options.isOpen,
|
|
@@ -30,7 +23,7 @@ function useDialogHelpers(options) {
|
|
|
30
23
|
/**
|
|
31
24
|
* Close the Dialog by pressing Escape.
|
|
32
25
|
*/
|
|
33
|
-
(
|
|
26
|
+
useClickOutside({
|
|
34
27
|
refs: [wrapperElement],
|
|
35
28
|
onClick: closeFunction
|
|
36
29
|
});
|
|
@@ -38,7 +31,7 @@ function useDialogHelpers(options) {
|
|
|
38
31
|
/**
|
|
39
32
|
* Close the Dialog by pressing Escape.
|
|
40
33
|
*/
|
|
41
|
-
(
|
|
34
|
+
useEscape({
|
|
42
35
|
onPress: closeFunction
|
|
43
36
|
});
|
|
44
37
|
}
|
|
@@ -46,7 +39,7 @@ function useDialogHelpers(options) {
|
|
|
46
39
|
/**
|
|
47
40
|
* Make sure focus does not leave the Dialog while it's open.
|
|
48
41
|
*/
|
|
49
|
-
(
|
|
42
|
+
useTrapFocus({
|
|
50
43
|
ref: wrapperElement,
|
|
51
44
|
isActive: isOpen
|
|
52
45
|
});
|
|
@@ -55,7 +48,7 @@ function useDialogHelpers(options) {
|
|
|
55
48
|
* Sets focus on the popup so that screen readers announce
|
|
56
49
|
* that the user is currently on a dialog.
|
|
57
50
|
*/
|
|
58
|
-
|
|
51
|
+
useEffect(function () {
|
|
59
52
|
if (isOpen && wrapperElement.current) {
|
|
60
53
|
wrapperElement.current.setAttribute('tabindex', '-1');
|
|
61
54
|
wrapperElement.current.focus();
|