@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
package/dist/components/index.js
CHANGED
|
@@ -1,15 +1,111 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Button", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _Button.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "FormCheckbox", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _Checkbox.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "FormCheckboxes", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _Checkboxes.default;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "FormDate", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _Date.default;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "FormDatePicker", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _DatePicker.default;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "FormDateSelect", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function get() {
|
|
39
|
+
return _DateSelect.default;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "FormEmail", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function get() {
|
|
45
|
+
return _Email.default;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "FormNumber", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function get() {
|
|
51
|
+
return _Number.default;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "FormRadioButtons", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function get() {
|
|
57
|
+
return _RadioButtons.default;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "FormSearchField", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function get() {
|
|
63
|
+
return _SearchField.default;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "FormSelect", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function get() {
|
|
69
|
+
return _Select.default;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(exports, "FormTextField", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function get() {
|
|
75
|
+
return _TextField.default;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(exports, "FormTextarea", {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function get() {
|
|
81
|
+
return _Textarea.default;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
Object.defineProperty(exports, "FormikWrapper", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function get() {
|
|
87
|
+
return _FormikWrapper.default;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
Object.defineProperty(exports, "WysiwygField", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function get() {
|
|
93
|
+
return _WysiwygField.default;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
var _Button = _interopRequireDefault(require("./Button"));
|
|
97
|
+
var _WysiwygField = _interopRequireDefault(require("./WysiwygField"));
|
|
98
|
+
var _FormikWrapper = _interopRequireDefault(require("./Form/FormikWrapper"));
|
|
99
|
+
var _Checkbox = _interopRequireDefault(require("./Form/Checkbox"));
|
|
100
|
+
var _Checkboxes = _interopRequireDefault(require("./Form/Checkboxes"));
|
|
101
|
+
var _Date = _interopRequireDefault(require("./Form/Date"));
|
|
102
|
+
var _DatePicker = _interopRequireDefault(require("./Form/DatePicker"));
|
|
103
|
+
var _DateSelect = _interopRequireDefault(require("./Form/DateSelect"));
|
|
104
|
+
var _Email = _interopRequireDefault(require("./Form/Email"));
|
|
105
|
+
var _Number = _interopRequireDefault(require("./Form/Number"));
|
|
106
|
+
var _RadioButtons = _interopRequireDefault(require("./Form/RadioButtons"));
|
|
107
|
+
var _SearchField = _interopRequireDefault(require("./Form/SearchField"));
|
|
108
|
+
var _Select = _interopRequireDefault(require("./Form/Select"));
|
|
109
|
+
var _Textarea = _interopRequireDefault(require("./Form/Textarea"));
|
|
110
|
+
var _TextField = _interopRequireDefault(require("./Form/TextField"));
|
|
111
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/dist/config/constants.js
CHANGED
|
@@ -1,24 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
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;
|
|
17
|
+
var API_URL = 'https://content.uncinc.nl';
|
|
18
|
+
exports.API_URL = API_URL;
|
|
7
19
|
if (APP_ENV === 'development') {
|
|
8
|
-
API_URL = 'http://uncinc.docker.localhost';
|
|
20
|
+
exports.API_URL = API_URL = 'http://uncinc.docker.localhost';
|
|
9
21
|
} else if (APP_ENV === 'staging') {
|
|
10
|
-
API_URL = 'https://staging.uncinc.nl';
|
|
22
|
+
exports.API_URL = API_URL = 'https://staging.uncinc.nl';
|
|
11
23
|
}
|
|
12
|
-
|
|
13
|
-
|
|
24
|
+
var IS_SERVER = !(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
25
|
+
exports.IS_SERVER = IS_SERVER;
|
|
26
|
+
var IS_CLIENT = !IS_SERVER;
|
|
14
27
|
|
|
15
28
|
// The value is where the breakpoint starts (mobile-first).
|
|
16
29
|
// These values are taken from '/src/shared/styles/assets/_variables.scss'.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
30
|
+
exports.IS_CLIENT = IS_CLIENT;
|
|
31
|
+
var SCREEN_MOBILE = 0;
|
|
32
|
+
exports.SCREEN_MOBILE = SCREEN_MOBILE;
|
|
33
|
+
var SCREEN_TABLET = 768;
|
|
34
|
+
exports.SCREEN_TABLET = SCREEN_TABLET;
|
|
35
|
+
var SCREEN_NORMAL = 992;
|
|
36
|
+
exports.SCREEN_NORMAL = SCREEN_NORMAL;
|
|
37
|
+
var SCREEN_WIDE = 1240;
|
|
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;
|
|
@@ -1,18 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
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 }; }
|
|
13
|
+
var resources = {
|
|
7
14
|
nl: {
|
|
8
|
-
translation:
|
|
15
|
+
translation: _nl.default
|
|
9
16
|
},
|
|
10
17
|
en: {
|
|
11
|
-
translation:
|
|
18
|
+
translation: _en.default
|
|
12
19
|
}
|
|
13
20
|
};
|
|
14
|
-
|
|
15
|
-
resources,
|
|
21
|
+
_i18next.default.use(_i18nextBrowserLanguagedetector.default).use(_reactI18next.initReactI18next).init({
|
|
22
|
+
resources: resources,
|
|
16
23
|
lng: 'nl',
|
|
17
24
|
fallbackLng: 'nl',
|
|
18
25
|
debug: true,
|
|
@@ -20,4 +27,5 @@ i18n.use(LanguageDetector).use(initReactI18next).init({
|
|
|
20
27
|
escapeValue: false
|
|
21
28
|
}
|
|
22
29
|
});
|
|
23
|
-
|
|
30
|
+
var _default = _i18next.default;
|
|
31
|
+
exports.default = _default;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
+
"general": {
|
|
3
|
+
"open": "Openen",
|
|
4
|
+
"close": "Sluiten"
|
|
5
|
+
},
|
|
2
6
|
"dateselect" : {
|
|
3
7
|
"months": {
|
|
4
8
|
"jan": "Januari",
|
|
@@ -18,5 +22,8 @@
|
|
|
18
22
|
"form": {
|
|
19
23
|
"required": "vereist",
|
|
20
24
|
"optional": "optioneel"
|
|
25
|
+
},
|
|
26
|
+
"searchkit": {
|
|
27
|
+
"reset_search": "Zoeken opnieuw instellen"
|
|
21
28
|
}
|
|
22
29
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.parseDateWithTimezoneOffset = exports.isValidDate = void 0;
|
|
7
|
+
var parseDateWithTimezoneOffset = function parseDateWithTimezoneOffset(date) {
|
|
8
|
+
var offset = date.getTimezoneOffset();
|
|
9
|
+
var dateWithTimezoneOffset = new Date(date.getTime() - offset * 60 * 1000);
|
|
10
|
+
return dateWithTimezoneOffset.toISOString();
|
|
11
|
+
};
|
|
12
|
+
exports.parseDateWithTimezoneOffset = parseDateWithTimezoneOffset;
|
|
13
|
+
var isValidDate = function isValidDate(date) {
|
|
14
|
+
return date instanceof Date && !Number.isNaN(date);
|
|
15
|
+
};
|
|
16
|
+
exports.isValidDate = isValidDate;
|
package/dist/helpers/gtm.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _constants = require("../config/constants");
|
|
8
|
+
var gtm = {
|
|
3
9
|
// Track wether events are binded already or not.
|
|
4
10
|
hasEventsAttached: false,
|
|
5
11
|
// If GTM is not loaded we will push all events to this variable. Once GTM is
|
|
@@ -21,7 +27,7 @@ const gtm = {
|
|
|
21
27
|
* @return {bool}
|
|
22
28
|
* A boolean wether the GTM is loaded or not.
|
|
23
29
|
*/
|
|
24
|
-
gtm.loaded = ()
|
|
30
|
+
gtm.loaded = function () {
|
|
25
31
|
return typeof window.google_tag_manager !== 'undefined';
|
|
26
32
|
};
|
|
27
33
|
|
|
@@ -37,12 +43,15 @@ gtm.loaded = () => {
|
|
|
37
43
|
* The callback of the function being registered.
|
|
38
44
|
* @return {void}
|
|
39
45
|
*/
|
|
40
|
-
gtm.register = (fn, callback)
|
|
41
|
-
gtm[fn] = (
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
gtm.register = function (fn, callback) {
|
|
47
|
+
gtm[fn] = function () {
|
|
48
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
49
|
+
args[_key] = arguments[_key];
|
|
50
|
+
}
|
|
51
|
+
if (_constants.__DEBUG__) {
|
|
52
|
+
console.info("GTM Event: ".concat(fn, "() with args"), args);
|
|
44
53
|
}
|
|
45
|
-
callback(
|
|
54
|
+
callback.apply(void 0, args);
|
|
46
55
|
};
|
|
47
56
|
};
|
|
48
57
|
|
|
@@ -56,7 +65,7 @@ gtm.register = (fn, callback) => {
|
|
|
56
65
|
* @return {array|bool}
|
|
57
66
|
* An array containing the new dataLayer result or `false`.
|
|
58
67
|
*/
|
|
59
|
-
gtm.push = data
|
|
68
|
+
gtm.push = function (data) {
|
|
60
69
|
if (gtm.loaded()) {
|
|
61
70
|
return window.dataLayer.push(data);
|
|
62
71
|
} else {
|
|
@@ -72,10 +81,10 @@ gtm.push = data => {
|
|
|
72
81
|
* Attach event listeners related to GTM.
|
|
73
82
|
* @return {void}
|
|
74
83
|
*/
|
|
75
|
-
gtm.attachEventListeners = ()
|
|
76
|
-
if (IS_CLIENT && !gtm.hasEventsAttached) {
|
|
77
|
-
window.addEventListener('GTM-Loaded', ()
|
|
78
|
-
for (
|
|
84
|
+
gtm.attachEventListeners = function () {
|
|
85
|
+
if (_constants.IS_CLIENT && !gtm.hasEventsAttached) {
|
|
86
|
+
window.addEventListener('GTM-Loaded', function () {
|
|
87
|
+
for (var i = 0, len = gtm.tempDataLayer.length; i < len; i++) {
|
|
79
88
|
window.dataLayer.push(gtm.tempDataLayer[i]);
|
|
80
89
|
}
|
|
81
90
|
gtm.tempDataLayer = [];
|
|
@@ -89,7 +98,7 @@ gtm.attachEventListeners = () => {
|
|
|
89
98
|
// Register our wrapper functions. We will use these throughout the app.
|
|
90
99
|
//
|
|
91
100
|
// -----------------------------------------------------------------------------
|
|
92
|
-
gtm.register('trackPage', url
|
|
101
|
+
gtm.register('trackPage', function (url) {
|
|
93
102
|
if (url) {
|
|
94
103
|
gtm.push({
|
|
95
104
|
event: 'Track page',
|
|
@@ -97,7 +106,7 @@ gtm.register('trackPage', url => {
|
|
|
97
106
|
});
|
|
98
107
|
}
|
|
99
108
|
});
|
|
100
|
-
gtm.register('trackUserEvent', (category, action, label, value)
|
|
109
|
+
gtm.register('trackUserEvent', function (category, action, label, value) {
|
|
101
110
|
gtm.push({
|
|
102
111
|
event: 'Track user event',
|
|
103
112
|
eventCategory: category,
|
|
@@ -106,7 +115,7 @@ gtm.register('trackUserEvent', (category, action, label, value) => {
|
|
|
106
115
|
eventValue: value
|
|
107
116
|
});
|
|
108
117
|
});
|
|
109
|
-
gtm.register('loadConsentRequiredTags', ()
|
|
118
|
+
gtm.register('loadConsentRequiredTags', function () {
|
|
110
119
|
gtm.push({
|
|
111
120
|
event: 'Cookie consent: load tags on consent'
|
|
112
121
|
});
|
|
@@ -114,4 +123,5 @@ gtm.register('loadConsentRequiredTags', () => {
|
|
|
114
123
|
|
|
115
124
|
// Initialize GTM.
|
|
116
125
|
gtm.attachEventListeners();
|
|
117
|
-
|
|
126
|
+
var _default = gtm;
|
|
127
|
+
exports.default = _default;
|
package/dist/helpers/link.js
CHANGED
|
@@ -1,15 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
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() {
|
|
11
|
+
var uri = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
12
|
+
var value = uri.trim().replace(/\/$/, '');
|
|
4
13
|
if (/^(https?|mailto|tel):/g.test(value)) {
|
|
5
14
|
return true;
|
|
6
15
|
}
|
|
7
16
|
return false;
|
|
8
17
|
}
|
|
9
|
-
|
|
10
|
-
|
|
18
|
+
function normalizeLink(link) {
|
|
19
|
+
var API_URL = _reactGlobalConfiguration.default.get('API_URL');
|
|
11
20
|
if (/^\//g.test(link)) {
|
|
12
|
-
return
|
|
21
|
+
return "".concat(API_URL).concat(link);
|
|
13
22
|
}
|
|
14
23
|
return link;
|
|
15
24
|
}
|
|
@@ -1,13 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
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
|
+
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
|
+
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
|
+
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
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
+
function useValueForCurrentViewPort(val1, val2, val3, val4, val5) {
|
|
17
|
+
var viewportContext = (0, _react.useContext)(_ViewportContext.default);
|
|
18
|
+
var _useState = (0, _react.useState)(val1),
|
|
19
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
20
|
+
ValueForCurrentViewPort = _useState2[0],
|
|
21
|
+
setValueForCurrentViewPort = _useState2[1];
|
|
22
|
+
(0, _react.useEffect)(function () {
|
|
7
23
|
function handleResize() {
|
|
8
|
-
|
|
9
|
-
innerWidth
|
|
10
|
-
} = window;
|
|
24
|
+
var _window = window,
|
|
25
|
+
width = _window.innerWidth;
|
|
11
26
|
|
|
12
27
|
// 0 & 768
|
|
13
28
|
if (width >= viewportContext.screenSizes.SCREEN_MOBILE && width <= viewportContext.screenSizes.SCREEN_TABLET) {
|
|
@@ -38,7 +53,9 @@ export default function useValueForCurrentViewPort(val1, val2, val3, val4, val5)
|
|
|
38
53
|
}
|
|
39
54
|
window.addEventListener('resize', handleResize);
|
|
40
55
|
handleResize();
|
|
41
|
-
return ()
|
|
56
|
+
return function () {
|
|
57
|
+
return window.removeEventListener('resize', handleResize);
|
|
58
|
+
};
|
|
42
59
|
}, [viewportContext, val1, val2, val3, val4, val5]);
|
|
43
60
|
return ValueForCurrentViewPort;
|
|
44
61
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export default function useBoolean(defaultValue?: boolean): {
|
|
3
|
+
readonly value: boolean;
|
|
4
|
+
readonly setValue: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
5
|
+
readonly setTrue: () => void;
|
|
6
|
+
readonly setFalse: () => void;
|
|
7
|
+
readonly toggle: () => void;
|
|
8
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useBoolean;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
+
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
|
+
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
|
+
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
|
+
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
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
+
function useBoolean() {
|
|
15
|
+
var defaultValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
16
|
+
var _useState = (0, _react.useState)(defaultValue),
|
|
17
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
18
|
+
value = _useState2[0],
|
|
19
|
+
setValue = _useState2[1];
|
|
20
|
+
var toggle = (0, _react.useCallback)(function () {
|
|
21
|
+
setValue(function (current) {
|
|
22
|
+
return !current;
|
|
23
|
+
});
|
|
24
|
+
}, [setValue]);
|
|
25
|
+
var setTrue = (0, _react.useCallback)(function () {
|
|
26
|
+
setValue(true);
|
|
27
|
+
}, []);
|
|
28
|
+
var setFalse = (0, _react.useCallback)(function () {
|
|
29
|
+
setValue(false);
|
|
30
|
+
}, []);
|
|
31
|
+
return {
|
|
32
|
+
value: value,
|
|
33
|
+
setValue: setValue,
|
|
34
|
+
setTrue: setTrue,
|
|
35
|
+
setFalse: setFalse,
|
|
36
|
+
toggle: toggle
|
|
37
|
+
};
|
|
38
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MutableRefObject } from 'react';
|
|
2
|
+
interface UseClickOutsideOptions {
|
|
3
|
+
refs: MutableRefObject<HTMLElement>[] | MutableRefObject<HTMLElement>;
|
|
4
|
+
unless?: boolean | ((e: globalThis.MouseEvent) => boolean);
|
|
5
|
+
onClick: (e: globalThis.MouseEvent) => void;
|
|
6
|
+
}
|
|
7
|
+
export default function useClickOutside({ refs, unless, onClick, }: UseClickOutsideOptions): void;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useClickOutside;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
function useClickOutside(_ref) {
|
|
9
|
+
var refs = _ref.refs,
|
|
10
|
+
_ref$unless = _ref.unless,
|
|
11
|
+
unless = _ref$unless === void 0 ? false : _ref$unless,
|
|
12
|
+
onClick = _ref.onClick;
|
|
13
|
+
var refsAsArray = Array.isArray(refs) ? refs : [refs];
|
|
14
|
+
(0, _react.useEffect)(function () {
|
|
15
|
+
function handleOutsideClick(e) {
|
|
16
|
+
var allRefsHaveCurrent = refsAsArray.every(function (ref) {
|
|
17
|
+
return !!ref.current;
|
|
18
|
+
});
|
|
19
|
+
var shouldNotExecute = typeof unless === 'function' ? unless(e) : unless;
|
|
20
|
+
if (!allRefsHaveCurrent || shouldNotExecute) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
var isOutsideClick = refsAsArray.every(function (ref) {
|
|
24
|
+
return !ref.current.contains(e.target);
|
|
25
|
+
});
|
|
26
|
+
if (isOutsideClick) {
|
|
27
|
+
onClick(e);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
document.addEventListener('mousedown', handleOutsideClick);
|
|
31
|
+
return function () {
|
|
32
|
+
document.removeEventListener('mousedown', handleOutsideClick);
|
|
33
|
+
};
|
|
34
|
+
}, [unless, onClick, refs]);
|
|
35
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export default function useDialog(): {
|
|
3
|
+
readonly dialogIsOpen: boolean;
|
|
4
|
+
readonly openDialog: () => void;
|
|
5
|
+
readonly closeDialog: () => void;
|
|
6
|
+
readonly DialogComponent: ({ children, ...props }: {
|
|
7
|
+
[x: string]: any;
|
|
8
|
+
children: any;
|
|
9
|
+
}) => React.FunctionComponentElement<any>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
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
|
+
var _excluded = ["children"];
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
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
|
+
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
|
+
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; }
|
|
16
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
17
|
+
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
|
+
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
|
+
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
|
+
function useDialog() {
|
|
21
|
+
var _useBoolean = (0, _useBoolean2.default)(),
|
|
22
|
+
dialogIsOpen = _useBoolean.value,
|
|
23
|
+
openDialog = _useBoolean.setTrue,
|
|
24
|
+
closeDialog = _useBoolean.setFalse;
|
|
25
|
+
var DialogComponent = function DialogComponent(_ref) {
|
|
26
|
+
var children = _ref.children,
|
|
27
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
28
|
+
return /*#__PURE__*/_react.default.createElement(_Dialog.default, _objectSpread(_objectSpread({}, props), {}, {
|
|
29
|
+
isOpen: dialogIsOpen,
|
|
30
|
+
closeFunction: closeDialog
|
|
31
|
+
}), children);
|
|
32
|
+
};
|
|
33
|
+
return {
|
|
34
|
+
dialogIsOpen: dialogIsOpen,
|
|
35
|
+
openDialog: openDialog,
|
|
36
|
+
closeDialog: closeDialog,
|
|
37
|
+
DialogComponent: DialogComponent
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { MutableRefObject } from 'react';
|
|
2
|
+
export interface UseDialogHelpersOptions<T extends HTMLElement> {
|
|
3
|
+
id?: string;
|
|
4
|
+
wrapperElement: MutableRefObject<T>;
|
|
5
|
+
closeFunction: () => void;
|
|
6
|
+
isOpen: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Hook to allow you to implement your own Dialog component.
|
|
10
|
+
* This takes care of focus, and closing the Dialog by
|
|
11
|
+
* click outside it, or hitting Escape.
|
|
12
|
+
*/
|
|
13
|
+
export default function useDialogHelpers<T extends HTMLElement>(options: UseDialogHelpersOptions<T>): {
|
|
14
|
+
readonly id: any;
|
|
15
|
+
readonly labelId: string;
|
|
16
|
+
readonly dialogHelpersProps: {
|
|
17
|
+
'aria-role': string;
|
|
18
|
+
'aria-labelledby': string;
|
|
19
|
+
};
|
|
20
|
+
};
|