@entur-partner/common 9.3.2 → 9.3.3-alpha.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/ActionBar.d.ts +9 -9
- package/dist/AuditInfo.d.ts +14 -14
- package/dist/Box.d.ts +57 -56
- package/dist/Breadcrumbs.d.ts +8 -8
- package/dist/ConfirmModal.d.ts +28 -27
- package/dist/Content.d.ts +10 -9
- package/dist/EnturPartnerLogo.d.ts +19 -18
- package/dist/ErrorBoundary.d.ts +22 -22
- package/dist/ExpandableMultiLanguageInput.d.ts +17 -17
- package/dist/FeatureToggle.d.ts +25 -25
- package/dist/FormatCurrencyAmount.d.ts +8 -7
- package/dist/FormatDateTime.d.ts +7 -7
- package/dist/LanguageSelect.d.ts +16 -16
- package/dist/LegacyPageTitle.d.ts +16 -0
- package/dist/Link.d.ts +6 -6
- package/dist/LinkButton.d.ts +8 -8
- package/dist/Menu.d.ts +10 -9
- package/dist/MultiLanguageInput.d.ts +28 -28
- package/dist/OrganisationDropdown.d.ts +14 -14
- package/dist/PageTitle.d.ts +6 -15
- package/dist/Pager.d.ts +8 -8
- package/dist/PermissionCheck.d.ts +24 -24
- package/dist/RouteLeavingGuard.d.ts +14 -14
- package/dist/Stack.d.ts +9 -8
- package/dist/StatusLabel.d.ts +11 -11
- package/dist/Text.d.ts +21 -20
- package/dist/Unbutton.d.ts +7 -7
- package/dist/UserMenu/components/CookieSettingsMenuItem.d.ts +9 -9
- package/dist/UserMenu/components/CustomOverflowMenu.d.ts +11 -11
- package/dist/UserMenu/components/CustomOverflowMenuItem.d.ts +3 -3
- package/dist/UserMenu/components/LanguageSwitchMenuItem.d.ts +10 -10
- package/dist/UserMenu/components/LogOutMenuItem.d.ts +9 -9
- package/dist/UserMenu/components/UserMenuItem.d.ts +9 -9
- package/dist/UserMenu/components/VersionMenuItem.d.ts +5 -5
- package/dist/UserMenu/index.d.ts +26 -25
- package/dist/UserMenu/useOutsideClick.d.ts +2 -2
- package/dist/common.cjs.development.js +878 -870
- package/dist/common.cjs.development.js.map +1 -1
- package/dist/common.cjs.production.min.js +1 -1
- package/dist/common.cjs.production.min.js.map +1 -1
- package/dist/common.esm.js +838 -826
- package/dist/common.esm.js.map +1 -1
- package/dist/environment.d.ts +13 -13
- package/dist/index.d.ts +31 -30
- package/dist/styles.css +161 -161
- package/dist/useEventListener.d.ts +3 -5
- package/package.json +62 -62
- package/dist/helpers.d.ts +0 -1
package/dist/common.esm.js
CHANGED
|
@@ -1,58 +1,78 @@
|
|
|
1
|
-
import React, { Children, useState, useEffect, useRef
|
|
1
|
+
import React, { Children, Component, useState, useEffect, useRef } from 'react';
|
|
2
|
+
import { localeDate, localeDateTime, isDate, isDateString, splitUrlPath, isString, isFunction, assertIsDefined, hasAllPermissions, hasOneOfPermissions } from '@entur-partner/util';
|
|
2
3
|
import cx from 'classnames';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { useNavigate, Link as Link$2, useInRouterContext, useBlocker } from 'react-router-dom';
|
|
7
|
-
import { SearchableDropdown } from '@entur/dropdown';
|
|
8
|
-
import { SegmentedControl, SegmentedChoice } from '@entur/form';
|
|
9
|
-
import { assertIsDefined, localeDate, localeDateTime, isDate, isDateString, isString, hasAllPermissions, hasOneOfPermissions, splitUrlPath } from '@entur-partner/util';
|
|
10
|
-
import { ExpandablePanel } from '@entur/expand';
|
|
11
|
-
import { BannerAlertBox } from '@entur/alert';
|
|
4
|
+
import { BreadcrumbItem, BreadcrumbNavigation, Pagination } from '@entur/menu';
|
|
5
|
+
import { Link as Link$1, useInRouterContext, useBlocker, useNavigate } from 'react-router-dom';
|
|
6
|
+
import { ButtonGroup, SecondaryButton, PrimaryButton, Button } from '@entur/button';
|
|
12
7
|
import { Modal } from '@entur/modal';
|
|
13
|
-
import {
|
|
8
|
+
import { Paragraph, Link as Link$2, Heading6 } from '@entur/typography';
|
|
9
|
+
import { BannerAlertBox } from '@entur/alert';
|
|
10
|
+
import { ExpandablePanel } from '@entur/expand';
|
|
11
|
+
import { SegmentedControl, SegmentedChoice } from '@entur/form';
|
|
14
12
|
import { Helmet } from 'react-helmet-async';
|
|
13
|
+
import { SearchableDropdown } from '@entur/dropdown';
|
|
14
|
+
import { CookieIcon, UserIcon, DownArrowIcon, NorwayIcon, UKIcon, LogOutIcon, ChannelsIcon } from '@entur/icons';
|
|
15
|
+
|
|
16
|
+
var ActionBarLeft = function ActionBarLeft(_ref) {
|
|
17
|
+
var children = _ref.children;
|
|
18
|
+
return React.createElement("div", {
|
|
19
|
+
className: "eps-action-bar-left"
|
|
20
|
+
}, children);
|
|
21
|
+
};
|
|
22
|
+
var ActionBarRight = function ActionBarRight(_ref2) {
|
|
23
|
+
var children = _ref2.children;
|
|
24
|
+
return React.createElement("div", {
|
|
25
|
+
className: "eps-action-bar-right"
|
|
26
|
+
}, children);
|
|
27
|
+
};
|
|
28
|
+
var ActionBar = function ActionBar(_ref3) {
|
|
29
|
+
var children = _ref3.children;
|
|
30
|
+
return React.createElement(React.Fragment, null, React.createElement("div", {
|
|
31
|
+
className: "eps-action-bar-padding"
|
|
32
|
+
}), React.createElement("div", {
|
|
33
|
+
className: "eps-action-bar"
|
|
34
|
+
}, children));
|
|
35
|
+
};
|
|
15
36
|
|
|
16
37
|
function _extends() {
|
|
17
|
-
_extends = Object.assign ? Object.assign.bind() : function (
|
|
18
|
-
for (var
|
|
19
|
-
var
|
|
20
|
-
for (var
|
|
21
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
22
|
-
target[key] = source[key];
|
|
23
|
-
}
|
|
24
|
-
}
|
|
38
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
39
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
40
|
+
var t = arguments[e];
|
|
41
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
25
42
|
}
|
|
26
|
-
return
|
|
27
|
-
};
|
|
28
|
-
return _extends.apply(this, arguments);
|
|
29
|
-
}
|
|
30
|
-
function _inheritsLoose(subClass, superClass) {
|
|
31
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
32
|
-
subClass.prototype.constructor = subClass;
|
|
33
|
-
_setPrototypeOf(subClass, superClass);
|
|
43
|
+
return n;
|
|
44
|
+
}, _extends.apply(null, arguments);
|
|
34
45
|
}
|
|
35
|
-
function
|
|
36
|
-
|
|
37
|
-
o.__proto__ = p;
|
|
38
|
-
return o;
|
|
39
|
-
};
|
|
40
|
-
return _setPrototypeOf(o, p);
|
|
46
|
+
function _inheritsLoose(t, o) {
|
|
47
|
+
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
|
|
41
48
|
}
|
|
42
|
-
function _objectWithoutPropertiesLoose(
|
|
43
|
-
if (
|
|
44
|
-
var
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
key = sourceKeys[i];
|
|
49
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
50
|
-
target[key] = source[key];
|
|
49
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
50
|
+
if (null == r) return {};
|
|
51
|
+
var t = {};
|
|
52
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
53
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
54
|
+
t[n] = r[n];
|
|
51
55
|
}
|
|
52
|
-
return
|
|
56
|
+
return t;
|
|
57
|
+
}
|
|
58
|
+
function _setPrototypeOf(t, e) {
|
|
59
|
+
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
60
|
+
return t.__proto__ = e, t;
|
|
61
|
+
}, _setPrototypeOf(t, e);
|
|
53
62
|
}
|
|
54
63
|
|
|
55
|
-
var _excluded$e = ["
|
|
64
|
+
var _excluded$e = ["date", "locale", "as", "hideTime"];
|
|
65
|
+
var FormatDateTime = function FormatDateTime(_ref) {
|
|
66
|
+
var date = _ref.date,
|
|
67
|
+
locale = _ref.locale,
|
|
68
|
+
_ref$as = _ref.as,
|
|
69
|
+
Component = _ref$as === void 0 ? "main" : _ref$as,
|
|
70
|
+
hideTime = _ref.hideTime,
|
|
71
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$e);
|
|
72
|
+
return React.createElement(Component, _extends({}, rest), hideTime ? localeDate(date, locale) : localeDateTime(date, locale));
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
var _excluded$d = ["as", "children", "contrast", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "paddingX", "paddingY", "padding", "marginTop", "marginRight", "marginBottom", "marginLeft", "marginX", "marginY", "margin", "display", "justifyContent", "alignItems", "maxWidth", "width", "background", "color", "flexDirection", "flexWrap", "className"];
|
|
56
76
|
function responsiveProp(prefix, prop) {
|
|
57
77
|
if (Array.isArray(prop)) {
|
|
58
78
|
var classes = [];
|
|
@@ -65,7 +85,7 @@ function responsiveProp(prefix, prop) {
|
|
|
65
85
|
}
|
|
66
86
|
var Box = function Box(_ref) {
|
|
67
87
|
var _ref$as = _ref.as,
|
|
68
|
-
Component = _ref$as === void 0 ?
|
|
88
|
+
Component = _ref$as === void 0 ? "div" : _ref$as,
|
|
69
89
|
children = _ref.children,
|
|
70
90
|
contrast = _ref.contrast,
|
|
71
91
|
paddingTop = _ref.paddingTop,
|
|
@@ -92,7 +112,7 @@ var Box = function Box(_ref) {
|
|
|
92
112
|
flexDirection = _ref.flexDirection,
|
|
93
113
|
flexWrap = _ref.flexWrap,
|
|
94
114
|
className = _ref.className,
|
|
95
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
115
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$d);
|
|
96
116
|
var classes = [];
|
|
97
117
|
var resolvedPaddingTop = paddingTop || paddingY || padding;
|
|
98
118
|
var resolvedPaddingBottom = paddingBottom || paddingY || padding;
|
|
@@ -102,32 +122,33 @@ var Box = function Box(_ref) {
|
|
|
102
122
|
var resolvedMarginBottom = marginBottom || marginY || margin;
|
|
103
123
|
var resolvedMarginLeft = marginLeft || marginX || margin;
|
|
104
124
|
var resolvedMarginRight = marginRight || marginX || margin;
|
|
105
|
-
contrast && classes.push(
|
|
106
|
-
resolvedPaddingTop && classes.push.apply(classes, responsiveProp(
|
|
107
|
-
resolvedPaddingBottom && classes.push.apply(classes, responsiveProp(
|
|
108
|
-
resolvedPaddingLeft && classes.push.apply(classes, responsiveProp(
|
|
109
|
-
resolvedPaddingRight && classes.push.apply(classes, responsiveProp(
|
|
110
|
-
resolvedMarginTop && classes.push.apply(classes, responsiveProp(
|
|
111
|
-
resolvedMarginBottom && classes.push.apply(classes, responsiveProp(
|
|
112
|
-
resolvedMarginLeft && classes.push.apply(classes, responsiveProp(
|
|
113
|
-
resolvedMarginRight && classes.push.apply(classes, responsiveProp(
|
|
114
|
-
display && classes.push.apply(classes, responsiveProp(
|
|
115
|
-
justifyContent && classes.push.apply(classes, responsiveProp(
|
|
125
|
+
contrast && classes.push("eds-contrast");
|
|
126
|
+
resolvedPaddingTop && classes.push.apply(classes, responsiveProp("eps-pt-", resolvedPaddingTop));
|
|
127
|
+
resolvedPaddingBottom && classes.push.apply(classes, responsiveProp("eps-pb-", resolvedPaddingBottom));
|
|
128
|
+
resolvedPaddingLeft && classes.push.apply(classes, responsiveProp("eps-pl-", resolvedPaddingLeft));
|
|
129
|
+
resolvedPaddingRight && classes.push.apply(classes, responsiveProp("eps-pr-", resolvedPaddingRight));
|
|
130
|
+
resolvedMarginTop && classes.push.apply(classes, responsiveProp("eps-mt-", resolvedMarginTop));
|
|
131
|
+
resolvedMarginBottom && classes.push.apply(classes, responsiveProp("eps-mb-", resolvedMarginBottom));
|
|
132
|
+
resolvedMarginLeft && classes.push.apply(classes, responsiveProp("eps-ml-", resolvedMarginLeft));
|
|
133
|
+
resolvedMarginRight && classes.push.apply(classes, responsiveProp("eps-mr-", resolvedMarginRight));
|
|
134
|
+
display && classes.push.apply(classes, responsiveProp("eps-", display));
|
|
135
|
+
justifyContent && classes.push.apply(classes, responsiveProp("eps-justify-", justifyContent));
|
|
116
136
|
if (alignItems) {
|
|
117
|
-
classes.push.apply(classes, responsiveProp(
|
|
137
|
+
classes.push.apply(classes, responsiveProp("eps-items-", alignItems));
|
|
118
138
|
}
|
|
119
|
-
maxWidth && classes.push.apply(classes, responsiveProp(
|
|
120
|
-
width && classes.push.apply(classes, responsiveProp(
|
|
139
|
+
maxWidth && classes.push.apply(classes, responsiveProp("eps-max-w-", maxWidth));
|
|
140
|
+
width && classes.push.apply(classes, responsiveProp("eps-w-", width));
|
|
121
141
|
color && classes.push("eps-color-" + color);
|
|
122
142
|
background && classes.push("eps-bg-" + background);
|
|
123
|
-
flexDirection && classes.push.apply(classes, responsiveProp(
|
|
124
|
-
flexWrap && classes.push.apply(classes, responsiveProp(
|
|
143
|
+
flexDirection && classes.push.apply(classes, responsiveProp("eps-flex-", flexDirection));
|
|
144
|
+
flexWrap && classes.push.apply(classes, responsiveProp("eps-flex-wrap-", flexWrap));
|
|
125
145
|
var classList = cx(classes, className);
|
|
126
146
|
return React.createElement(Component, _extends({
|
|
127
147
|
className: classList
|
|
128
148
|
}, rest), children);
|
|
129
149
|
};
|
|
130
150
|
|
|
151
|
+
/** biome-ignore-all lint/suspicious/noArrayIndexKey: Ignore for now. Should be tested properly before doing changes */
|
|
131
152
|
var Stack = function Stack(_ref) {
|
|
132
153
|
var children = _ref.children,
|
|
133
154
|
space = _ref.space,
|
|
@@ -148,68 +169,106 @@ var Stack = function Stack(_ref) {
|
|
|
148
169
|
}));
|
|
149
170
|
};
|
|
150
171
|
|
|
151
|
-
var
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
var
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
172
|
+
var _excluded$c = ["items", "locale", "className"];
|
|
173
|
+
var AuditInfo = function AuditInfo(_ref) {
|
|
174
|
+
var items = _ref.items,
|
|
175
|
+
locale = _ref.locale,
|
|
176
|
+
className = _ref.className,
|
|
177
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$c);
|
|
178
|
+
var classNames = cx("ep-audit-info", className);
|
|
179
|
+
return React.createElement("div", _extends({
|
|
180
|
+
className: classNames
|
|
181
|
+
}, rest), items.map(function (_ref2) {
|
|
182
|
+
var label = _ref2.label,
|
|
183
|
+
value = _ref2.value;
|
|
184
|
+
return React.createElement(Stack, {
|
|
185
|
+
space: "small",
|
|
186
|
+
key: value.toString()
|
|
187
|
+
}, React.createElement("div", {
|
|
188
|
+
className: "ep-audit-info-label"
|
|
189
|
+
}, label), React.createElement("div", null, isDate(value) || isDateString(value) ? React.createElement(FormatDateTime, {
|
|
190
|
+
date: value,
|
|
191
|
+
locale: locale
|
|
192
|
+
}) : React.createElement("span", null, value)));
|
|
193
|
+
}));
|
|
162
194
|
};
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
195
|
+
|
|
196
|
+
var Breadcrumbs = function Breadcrumbs(_ref) {
|
|
197
|
+
var prependBreadcrumbItem = _ref.prependBreadcrumbItem,
|
|
198
|
+
pathname = _ref.pathname,
|
|
199
|
+
onBreadcrumbLookup = _ref.onBreadcrumbLookup;
|
|
200
|
+
var paths = splitUrlPath(pathname);
|
|
201
|
+
var breadcrumbs = paths.map(function (path) {
|
|
202
|
+
return {
|
|
203
|
+
title: onBreadcrumbLookup(path),
|
|
204
|
+
path: path
|
|
205
|
+
};
|
|
206
|
+
}).filter(function (_ref2) {
|
|
207
|
+
var title = _ref2.title;
|
|
208
|
+
return title !== undefined;
|
|
209
|
+
});
|
|
210
|
+
var breadcrumbElements = breadcrumbs.map(function (_ref3, i) {
|
|
211
|
+
var title = _ref3.title,
|
|
212
|
+
path = _ref3.path;
|
|
213
|
+
var isLast = i === breadcrumbs.length - 1;
|
|
214
|
+
if (isLast) {
|
|
215
|
+
return React.createElement(BreadcrumbItem, {
|
|
216
|
+
key: path,
|
|
217
|
+
as: "span"
|
|
218
|
+
}, title);
|
|
219
|
+
}
|
|
220
|
+
return React.createElement(BreadcrumbItem, {
|
|
221
|
+
key: path,
|
|
222
|
+
as: Link$1,
|
|
223
|
+
to: path
|
|
224
|
+
}, title);
|
|
225
|
+
});
|
|
226
|
+
if (prependBreadcrumbItem) {
|
|
227
|
+
return React.createElement(BreadcrumbNavigation, null, [prependBreadcrumbItem].concat(breadcrumbElements));
|
|
228
|
+
}
|
|
229
|
+
return React.createElement(BreadcrumbNavigation, null, breadcrumbElements);
|
|
170
230
|
};
|
|
171
231
|
|
|
172
|
-
var _excluded$
|
|
173
|
-
var
|
|
174
|
-
var
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
232
|
+
var _excluded$b = ["isOpen", "children", "message", "size", "buttons", "onConfirm", "messages", "onClose", "onDismiss"];
|
|
233
|
+
var ConfirmModal = function ConfirmModal(_ref) {
|
|
234
|
+
var _ref$isOpen = _ref.isOpen,
|
|
235
|
+
isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
|
|
236
|
+
children = _ref.children,
|
|
237
|
+
message = _ref.message,
|
|
238
|
+
_ref$size = _ref.size,
|
|
239
|
+
size = _ref$size === void 0 ? "medium" : _ref$size,
|
|
240
|
+
buttons = _ref.buttons,
|
|
241
|
+
onConfirm = _ref.onConfirm,
|
|
242
|
+
messages = _ref.messages,
|
|
243
|
+
onClose = _ref.onClose,
|
|
244
|
+
onDismiss = _ref.onDismiss,
|
|
245
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$b);
|
|
246
|
+
var childrenToRender = children ? children : message;
|
|
247
|
+
var handleDismiss = onClose ? onClose : onDismiss;
|
|
248
|
+
return React.createElement(Modal, _extends({
|
|
249
|
+
size: size,
|
|
250
|
+
open: isOpen,
|
|
251
|
+
onDismiss: handleDismiss
|
|
252
|
+
}, rest), isString(childrenToRender) ? React.createElement(Paragraph, null, childrenToRender) : React.createElement(Box, {
|
|
253
|
+
paddingBottom: "medium"
|
|
254
|
+
}, childrenToRender), React.createElement(ButtonGroup, null, onConfirm ? React.createElement(React.Fragment, null, React.createElement(SecondaryButton, {
|
|
255
|
+
onClick: handleDismiss,
|
|
256
|
+
"data-testid": "cancel-modal-button"
|
|
257
|
+
}, messages.cancel), React.createElement(PrimaryButton, {
|
|
258
|
+
onClick: onConfirm,
|
|
259
|
+
"data-testid": "confirm-modal-button"
|
|
260
|
+
}, messages.confirm)) : buttons));
|
|
181
261
|
};
|
|
182
262
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
var _window$localStorage, _window$localStorage2;
|
|
193
|
-
return import.meta.env["VITE_APP_" + flag] === 'true' || ((_window$localStorage = window.localStorage) == null ? void 0 : _window$localStorage.getItem(flag)) === 'true' || ((_window$localStorage2 = window.localStorage) == null ? void 0 : _window$localStorage2.getItem("VITE_APP_" + flag)) === 'true';
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Returns true if the provided flag exist in localStorage
|
|
197
|
-
* or is set as an environment variable.
|
|
198
|
-
*
|
|
199
|
-
* @param flag case sensitive flag. If it is an environment variable
|
|
200
|
-
* you can drop the VITE_APP_ prefix.
|
|
201
|
-
*/
|
|
202
|
-
function useFeatureToggle(flag) {
|
|
203
|
-
return featureFlag(flag);
|
|
204
|
-
}
|
|
205
|
-
var FeatureToggle = function FeatureToggle(_ref) {
|
|
206
|
-
var children = _ref.children,
|
|
207
|
-
flag = _ref.flag;
|
|
208
|
-
var feature = useFeatureToggle(flag);
|
|
209
|
-
if (feature) {
|
|
210
|
-
return React.createElement(React.Fragment, null, children);
|
|
211
|
-
}
|
|
212
|
-
return null;
|
|
263
|
+
var Content = function Content(_ref) {
|
|
264
|
+
var _ref$as = _ref.as,
|
|
265
|
+
Component = _ref$as === void 0 ? "main" : _ref$as,
|
|
266
|
+
className = _ref.className,
|
|
267
|
+
children = _ref.children;
|
|
268
|
+
var classList = cx(["eps-content", className]);
|
|
269
|
+
return React.createElement(Component, {
|
|
270
|
+
className: classList
|
|
271
|
+
}, children);
|
|
213
272
|
};
|
|
214
273
|
|
|
215
274
|
var _environmentColors, _humanReadableEnviron;
|
|
@@ -220,26 +279,26 @@ var Environment;
|
|
|
220
279
|
Environment["Staging"] = "staging";
|
|
221
280
|
Environment["Production"] = "prod";
|
|
222
281
|
})(Environment || (Environment = {}));
|
|
223
|
-
var environmentColors = (_environmentColors = {}, _environmentColors[Environment.Local] =
|
|
224
|
-
/**
|
|
225
|
-
* Gets the color for the given environment. This is the color used for the environment
|
|
226
|
-
* indicator. There is no color for production as it should not have any special environment
|
|
227
|
-
* indication.
|
|
282
|
+
var environmentColors = (_environmentColors = {}, _environmentColors[Environment.Local] = "#B482FB", _environmentColors[Environment.Development] = "#5AC39A", _environmentColors[Environment.Staging] = "#FFCA28", _environmentColors);
|
|
283
|
+
/**
|
|
284
|
+
* Gets the color for the given environment. This is the color used for the environment
|
|
285
|
+
* indicator. There is no color for production as it should not have any special environment
|
|
286
|
+
* indication.
|
|
228
287
|
*/
|
|
229
288
|
var getColorForEnvironment = function getColorForEnvironment(environment) {
|
|
230
289
|
return environmentColors[environment];
|
|
231
290
|
};
|
|
232
|
-
var humanReadableEnvironment = (_humanReadableEnviron = {}, _humanReadableEnviron[Environment.Local] =
|
|
291
|
+
var humanReadableEnvironment = (_humanReadableEnviron = {}, _humanReadableEnviron[Environment.Local] = "Local", _humanReadableEnviron[Environment.Development] = "Dev", _humanReadableEnviron[Environment.Staging] = "Staging", _humanReadableEnviron[Environment.Production] = "Prod", _humanReadableEnviron);
|
|
233
292
|
var getHumanReadableEnvironment = function getHumanReadableEnvironment(environment) {
|
|
234
293
|
return humanReadableEnvironment[environment];
|
|
235
294
|
};
|
|
236
295
|
|
|
237
|
-
var _excluded$
|
|
296
|
+
var _excluded$a = ["title", "accentColor"];
|
|
238
297
|
var EnturPartnerLogoSvg = function EnturPartnerLogoSvg(_ref) {
|
|
239
298
|
var title = _ref.title,
|
|
240
299
|
_ref$accentColor = _ref.accentColor,
|
|
241
|
-
accentColor = _ref$accentColor === void 0 ?
|
|
242
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
300
|
+
accentColor = _ref$accentColor === void 0 ? "#FF5959" : _ref$accentColor,
|
|
301
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$a);
|
|
243
302
|
return React.createElement("svg", _extends({
|
|
244
303
|
width: 257,
|
|
245
304
|
height: 37,
|
|
@@ -264,11 +323,11 @@ var EnturPartnerLogoSvg = function EnturPartnerLogoSvg(_ref) {
|
|
|
264
323
|
};
|
|
265
324
|
var EnturPartnerLogo = function EnturPartnerLogo(_ref2) {
|
|
266
325
|
var _ref2$as = _ref2.as,
|
|
267
|
-
Component = _ref2$as === void 0 ?
|
|
326
|
+
Component = _ref2$as === void 0 ? "nav" : _ref2$as,
|
|
268
327
|
className = _ref2.className,
|
|
269
328
|
altText = _ref2.altText,
|
|
270
329
|
environment = _ref2.environment;
|
|
271
|
-
var classList = cx([
|
|
330
|
+
var classList = cx(["eps-logo-wrapper", className]);
|
|
272
331
|
return React.createElement(Component, {
|
|
273
332
|
className: classList
|
|
274
333
|
}, React.createElement(EnturPartnerLogoSvg, {
|
|
@@ -278,425 +337,254 @@ var EnturPartnerLogo = function EnturPartnerLogo(_ref2) {
|
|
|
278
337
|
}));
|
|
279
338
|
};
|
|
280
339
|
|
|
281
|
-
var
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
className: classList
|
|
289
|
-
}, children);
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
var Content = function Content(_ref) {
|
|
293
|
-
var _ref$as = _ref.as,
|
|
294
|
-
Component = _ref$as === void 0 ? 'main' : _ref$as,
|
|
295
|
-
className = _ref.className,
|
|
296
|
-
children = _ref.children;
|
|
297
|
-
var classList = cx(['eps-content', className]);
|
|
298
|
-
return React.createElement(Component, {
|
|
299
|
-
className: classList
|
|
300
|
-
}, children);
|
|
301
|
-
};
|
|
302
|
-
|
|
303
|
-
function useOutsideClick(ref, buttonRef, handler) {
|
|
304
|
-
React.useEffect(function () {
|
|
305
|
-
var listener = function listener(event) {
|
|
306
|
-
if (elementContainsEventTarget(ref.current, event) || elementContainsEventTarget(buttonRef.current, event)) {
|
|
307
|
-
return;
|
|
308
|
-
}
|
|
309
|
-
handler();
|
|
310
|
-
};
|
|
311
|
-
document.addEventListener('mousedown', listener);
|
|
312
|
-
document.addEventListener('touchstart', listener);
|
|
313
|
-
return function () {
|
|
314
|
-
document.removeEventListener('mousedown', listener);
|
|
315
|
-
document.removeEventListener('touchstart', listener);
|
|
340
|
+
var newAppVersionErrorMessage = "Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.";
|
|
341
|
+
var ErrorBoundary = /*#__PURE__*/function (_Component) {
|
|
342
|
+
function ErrorBoundary(props) {
|
|
343
|
+
var _this;
|
|
344
|
+
_this = _Component.call(this, props) || this;
|
|
345
|
+
_this.state = {
|
|
346
|
+
error: null
|
|
316
347
|
};
|
|
317
|
-
|
|
318
|
-
}
|
|
319
|
-
function elementContainsEventTarget(element, event) {
|
|
320
|
-
if (!element) {
|
|
321
|
-
return false;
|
|
322
|
-
}
|
|
323
|
-
if (element.contains(event.target)) {
|
|
324
|
-
return true;
|
|
348
|
+
return _this;
|
|
325
349
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
350
|
+
_inheritsLoose(ErrorBoundary, _Component);
|
|
351
|
+
ErrorBoundary.getDerivedStateFromError = function getDerivedStateFromError(error) {
|
|
352
|
+
return {
|
|
353
|
+
error: error
|
|
354
|
+
};
|
|
355
|
+
};
|
|
356
|
+
var _proto = ErrorBoundary.prototype;
|
|
357
|
+
_proto.componentDidCatch = function componentDidCatch(error, errorInfo) {
|
|
358
|
+
var _this$props$handleErr, _this$props;
|
|
359
|
+
// React always logs in development
|
|
360
|
+
(_this$props$handleErr = (_this$props = this.props).handleError) == null || _this$props$handleErr.call(_this$props, error, errorInfo);
|
|
361
|
+
};
|
|
362
|
+
_proto.render = function render() {
|
|
363
|
+
var _this2 = this;
|
|
364
|
+
var error = this.state.error;
|
|
365
|
+
var _this$props2 = this.props,
|
|
366
|
+
fallback = _this$props2.fallback,
|
|
367
|
+
children = _this$props2.children;
|
|
368
|
+
if (error) {
|
|
369
|
+
if (isFunction(fallback)) {
|
|
370
|
+
return fallback({
|
|
371
|
+
retry: function retry() {
|
|
372
|
+
return _this2.setState({
|
|
373
|
+
error: null
|
|
374
|
+
});
|
|
375
|
+
},
|
|
376
|
+
error: error
|
|
377
|
+
});
|
|
378
|
+
} else if (error.name === "NotFoundError" && error.message === newAppVersionErrorMessage) {
|
|
379
|
+
return React.createElement(RefreshBannerInfo, null);
|
|
331
380
|
}
|
|
332
|
-
return
|
|
333
|
-
}
|
|
334
|
-
return
|
|
335
|
-
}
|
|
336
|
-
return
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
var
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
useOutsideClick(overflowContentRef, overflowMenuTriggerRef, function () {
|
|
354
|
-
return onOpenChange(false);
|
|
355
|
-
});
|
|
356
|
-
return React.createElement("div", null, React.createElement(SecondaryButton, _extends({
|
|
357
|
-
className: cx('eps-overflow-menu__button', className),
|
|
381
|
+
return fallback;
|
|
382
|
+
}
|
|
383
|
+
return children;
|
|
384
|
+
};
|
|
385
|
+
return ErrorBoundary;
|
|
386
|
+
}(Component);
|
|
387
|
+
var LANGUAGE_STORAGE_KEY = "EP::locale";
|
|
388
|
+
function RefreshBannerInfo() {
|
|
389
|
+
// Taken from ./app-shell/src/storage.ts
|
|
390
|
+
var language = localStorage.getItem(LANGUAGE_STORAGE_KEY);
|
|
391
|
+
var isNorwegian = language === "nb" || language === "nb-NO";
|
|
392
|
+
return React.createElement(Box, {
|
|
393
|
+
maxWidth: "large"
|
|
394
|
+
}, React.createElement(BannerAlertBox, {
|
|
395
|
+
variant: "info",
|
|
396
|
+
title: isNorwegian ? "En ny versjon av nettsiden er tilgjengelig." : "A new version of the website is available."
|
|
397
|
+
}, React.createElement(Box, {
|
|
398
|
+
paddingBottom: "medium"
|
|
399
|
+
}, React.createElement(Paragraph, {
|
|
400
|
+
margin: "none"
|
|
401
|
+
}, isNorwegian ? "Vennligst oppdater." : "Please refresh.")), React.createElement(PrimaryButton, {
|
|
358
402
|
onClick: function onClick() {
|
|
359
|
-
return
|
|
360
|
-
},
|
|
361
|
-
"aria-haspopup": true,
|
|
362
|
-
role: "button",
|
|
363
|
-
"aria-expanded": open,
|
|
364
|
-
ref: overflowMenuTriggerRef
|
|
365
|
-
}, rest), React.createElement("div", {
|
|
366
|
-
className: "eps-overflow-menu__button-contents"
|
|
367
|
-
}, React.createElement("span", {
|
|
368
|
-
className: "eds-overflow-menu__user-icon"
|
|
369
|
-
}, React.createElement(UserIcon, {
|
|
370
|
-
inline: true
|
|
371
|
-
})), React.createElement(Heading6, {
|
|
372
|
-
margin: "none",
|
|
373
|
-
as: "span"
|
|
374
|
-
}, userName, environment !== undefined && environment !== Environment.Production && React.createElement("span", {
|
|
375
|
-
style: {
|
|
376
|
-
color: getColorForEnvironment(environment)
|
|
403
|
+
return window.location.reload();
|
|
377
404
|
}
|
|
378
|
-
},
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
405
|
+
}, isNorwegian ? "Oppdater" : "Refresh")));
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
var _excluded$9 = ["title", "inputComponent", "languages", "values", "onChange", "name", "variant", "feedback"];
|
|
409
|
+
var ExpandableMultiLanguageInput = function ExpandableMultiLanguageInput(_ref) {
|
|
410
|
+
var title = _ref.title,
|
|
411
|
+
InputComponent = _ref.inputComponent,
|
|
412
|
+
languages = _ref.languages,
|
|
413
|
+
values = _ref.values,
|
|
414
|
+
onChange = _ref.onChange,
|
|
415
|
+
name = _ref.name,
|
|
416
|
+
variant = _ref.variant,
|
|
417
|
+
feedback = _ref.feedback,
|
|
418
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$9);
|
|
419
|
+
var handleOnChange = function handleOnChange(language, value) {
|
|
420
|
+
var changes = _extends({}, values);
|
|
421
|
+
if (value === "" || !value) {
|
|
422
|
+
delete changes[language];
|
|
423
|
+
} else {
|
|
424
|
+
changes[language] = value;
|
|
425
|
+
}
|
|
426
|
+
onChange(changes);
|
|
427
|
+
};
|
|
428
|
+
return React.createElement(ExpandablePanel, {
|
|
429
|
+
title: title,
|
|
430
|
+
defaultOpen: true,
|
|
431
|
+
contentStyle: {
|
|
432
|
+
padding: "4px 4px 4px 4px",
|
|
433
|
+
marginTop: "16px",
|
|
434
|
+
marginBottom: "16px"
|
|
435
|
+
}
|
|
436
|
+
}, React.createElement(Stack, {
|
|
437
|
+
space: "medium"
|
|
438
|
+
}, languages.map(function (_ref2) {
|
|
439
|
+
var langKey = _ref2.value,
|
|
440
|
+
label = _ref2.label,
|
|
441
|
+
required = _ref2.required;
|
|
442
|
+
return React.createElement(InputComponent, _extends({
|
|
443
|
+
"data-testid": "multi-lang-input-" + name + "-" + langKey,
|
|
444
|
+
key: title + langKey,
|
|
445
|
+
label: required ? label + "*" : label,
|
|
446
|
+
variant: variant == null ? void 0 : variant(langKey),
|
|
447
|
+
feedback: feedback == null ? void 0 : feedback(langKey),
|
|
448
|
+
name: name,
|
|
449
|
+
onChange: function onChange(e) {
|
|
450
|
+
handleOnChange(langKey, e.target.value);
|
|
451
|
+
},
|
|
452
|
+
value: values[langKey] || ""
|
|
453
|
+
}, rest));
|
|
454
|
+
})));
|
|
387
455
|
};
|
|
388
456
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
457
|
+
/// <reference types="vite/client" />
|
|
458
|
+
/**
|
|
459
|
+
* Returns true if the provided flag exist in localStorage
|
|
460
|
+
* or is set as an environment variable.
|
|
461
|
+
*
|
|
462
|
+
* @param flag case sensitive flag. If it is an environment variable
|
|
463
|
+
* you can drop the VITE_APP_ prefix.
|
|
464
|
+
*/
|
|
465
|
+
function featureFlag(flag) {
|
|
466
|
+
var _window$localStorage, _window$localStorage2;
|
|
467
|
+
return import.meta.env["VITE_APP_" + flag] === "true" || ((_window$localStorage = window.localStorage) == null ? void 0 : _window$localStorage.getItem(flag)) === "true" || ((_window$localStorage2 = window.localStorage) == null ? void 0 : _window$localStorage2.getItem("VITE_APP_" + flag)) === "true";
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Returns true if the provided flag exist in localStorage
|
|
471
|
+
* or is set as an environment variable.
|
|
472
|
+
*
|
|
473
|
+
* @param flag case sensitive flag. If it is an environment variable
|
|
474
|
+
* you can drop the VITE_APP_ prefix.
|
|
475
|
+
*/
|
|
476
|
+
function useFeatureToggle(flag) {
|
|
477
|
+
return featureFlag(flag);
|
|
478
|
+
}
|
|
479
|
+
var FeatureToggle = function FeatureToggle(_ref) {
|
|
480
|
+
var children = _ref.children,
|
|
481
|
+
flag = _ref.flag;
|
|
482
|
+
var feature = useFeatureToggle(flag);
|
|
483
|
+
if (feature) {
|
|
484
|
+
return React.createElement(React.Fragment, null, children);
|
|
485
|
+
}
|
|
486
|
+
return null;
|
|
394
487
|
};
|
|
395
488
|
|
|
396
|
-
var
|
|
489
|
+
var _excluded$8 = ["amount", "as"];
|
|
490
|
+
var FormatCurrencyAmount = function FormatCurrencyAmount(_ref) {
|
|
491
|
+
var amount = _ref.amount,
|
|
492
|
+
_ref$as = _ref.as,
|
|
493
|
+
Component = _ref$as === void 0 ? "span" : _ref$as,
|
|
494
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$8);
|
|
495
|
+
var parsedAmount = Number(amount) || 0;
|
|
496
|
+
var formattedAmount = new Intl.NumberFormat("nb-NO", {
|
|
497
|
+
maximumFractionDigits: 2,
|
|
498
|
+
minimumFractionDigits: 2
|
|
499
|
+
}).format(parsedAmount);
|
|
500
|
+
return React.createElement(Component, _extends({}, rest), formattedAmount);
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
var _excluded$7 = ["language", "options", "className", "onChange"];
|
|
504
|
+
var LanguageSelect = function LanguageSelect(_ref) {
|
|
397
505
|
var language = _ref.language,
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
var
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
className: "eps-overflow-menu__item"
|
|
410
|
-
}, React.createElement("span", {
|
|
411
|
-
"aria-hidden": true,
|
|
412
|
-
className: "eps-overflow-menu__icon-margin"
|
|
413
|
-
}, React.createElement(NorwayIcon, {
|
|
414
|
-
size: "1rem",
|
|
415
|
-
inline: true
|
|
416
|
-
})), name) : React.createElement(CustomOverflowMenuItem, {
|
|
417
|
-
onClick: function onClick() {
|
|
418
|
-
onLanguageChange(englishLanguageKey);
|
|
419
|
-
setOpen(false);
|
|
506
|
+
options = _ref.options,
|
|
507
|
+
className = _ref.className,
|
|
508
|
+
_onChange = _ref.onChange,
|
|
509
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$7);
|
|
510
|
+
var classNames = cx("eps-language-select", className);
|
|
511
|
+
return React.createElement("div", _extends({}, rest, {
|
|
512
|
+
className: classNames
|
|
513
|
+
}), React.createElement(SegmentedControl, {
|
|
514
|
+
onChange: function onChange(language) {
|
|
515
|
+
assertIsDefined(language);
|
|
516
|
+
_onChange(language);
|
|
420
517
|
},
|
|
421
|
-
|
|
422
|
-
},
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
518
|
+
selectedValue: language
|
|
519
|
+
}, options.map(function (option) {
|
|
520
|
+
return React.createElement(SegmentedChoice, {
|
|
521
|
+
key: option.value,
|
|
522
|
+
value: option.value
|
|
523
|
+
}, option.label, option.required && React.createElement("span", {
|
|
524
|
+
className: "asterisk-margin"
|
|
525
|
+
}, "*"));
|
|
526
|
+
})));
|
|
429
527
|
};
|
|
430
528
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
529
|
+
/**
|
|
530
|
+
* @deprecated Won't work with React 19, because of react-helmet-async
|
|
531
|
+
* This component changes page title by using helmet and current path. It will translate subpaths, join them with a dash
|
|
532
|
+
* and display it on browser tab.
|
|
533
|
+
*
|
|
534
|
+
* @param Props.pathname - The current path from react-router-dom.useLocation()
|
|
535
|
+
* @param Props.onBreadcrumbLookup - A function that takes a path and returns a i18n translated string or undefined
|
|
536
|
+
* @returns A Helmet component with updated title
|
|
537
|
+
*/
|
|
538
|
+
var LegacyPageTitle = function LegacyPageTitle(_ref) {
|
|
539
|
+
var pathname = _ref.pathname,
|
|
540
|
+
onBreadcrumbLookup = _ref.onBreadcrumbLookup;
|
|
541
|
+
var paths = splitUrlPath(pathname);
|
|
542
|
+
var pageTitles = paths.map(function (path) {
|
|
543
|
+
return {
|
|
544
|
+
title: onBreadcrumbLookup(path),
|
|
545
|
+
path: path
|
|
546
|
+
};
|
|
547
|
+
}).filter(function (_ref2) {
|
|
548
|
+
var title = _ref2.title;
|
|
549
|
+
return title !== undefined;
|
|
550
|
+
}).map(function (_ref3) {
|
|
551
|
+
var title = _ref3.title;
|
|
552
|
+
return title;
|
|
553
|
+
}).reverse().join(" | ");
|
|
554
|
+
return React.createElement(Helmet, null, React.createElement("title", null, pageTitles, " | Entur Partner"));
|
|
448
555
|
};
|
|
449
556
|
|
|
450
|
-
var
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
return React.createElement(Link$2, {
|
|
455
|
-
to: "/permission-admin/my-profile",
|
|
456
|
-
style: {
|
|
457
|
-
textDecoration: 'none'
|
|
458
|
-
}
|
|
459
|
-
}, React.createElement(CustomOverflowMenuItem, {
|
|
460
|
-
onClick: function onClick() {
|
|
461
|
-
setOpen(false);
|
|
462
|
-
onNavigateToMyProfile();
|
|
463
|
-
},
|
|
464
|
-
className: "eps-overflow-menu__item"
|
|
465
|
-
}, React.createElement("span", {
|
|
466
|
-
"aria-hidden": true
|
|
467
|
-
}, React.createElement(UserIcon, {
|
|
468
|
-
size: "1rem",
|
|
469
|
-
inline: true
|
|
470
|
-
})), name));
|
|
557
|
+
var Link = function Link(props) {
|
|
558
|
+
return React.createElement(Link$2, _extends({}, props, {
|
|
559
|
+
as: Link$1
|
|
560
|
+
}), props.children);
|
|
471
561
|
};
|
|
472
562
|
|
|
473
|
-
var
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
"data-testid": "user-menu-logout",
|
|
483
|
-
className: "eps-overflow-menu__item"
|
|
484
|
-
}, React.createElement("span", {
|
|
485
|
-
"aria-hidden": true
|
|
486
|
-
}, React.createElement(LogOutIcon, {
|
|
487
|
-
size: "1rem",
|
|
488
|
-
inline: true
|
|
489
|
-
})), name);
|
|
563
|
+
var _excluded$6 = ["children", "className"];
|
|
564
|
+
var LinkButton = function LinkButton(_ref) {
|
|
565
|
+
var children = _ref.children,
|
|
566
|
+
className = _ref.className,
|
|
567
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$6);
|
|
568
|
+
return React.createElement(Link$2, _extends({}, rest, {
|
|
569
|
+
as: "button",
|
|
570
|
+
className: cx("eps-link-button", className)
|
|
571
|
+
}), children);
|
|
490
572
|
};
|
|
491
573
|
|
|
492
|
-
var
|
|
493
|
-
var
|
|
494
|
-
|
|
495
|
-
onCookieSettingsOpen = _ref.onCookieSettingsOpen;
|
|
496
|
-
return React.createElement(CustomOverflowMenuItem, {
|
|
497
|
-
onClick: function onClick() {
|
|
498
|
-
onCookieSettingsOpen();
|
|
499
|
-
setOpen(false);
|
|
500
|
-
},
|
|
501
|
-
className: "eps-overflow-menu__item"
|
|
502
|
-
}, React.createElement("span", {
|
|
503
|
-
"aria-hidden": true
|
|
504
|
-
}, React.createElement(CookieIcon, {
|
|
505
|
-
size: "1rem",
|
|
506
|
-
inline: true
|
|
507
|
-
})), name);
|
|
508
|
-
};
|
|
509
|
-
|
|
510
|
-
var UserMenu = function UserMenu(_ref) {
|
|
511
|
-
var className = _ref.className,
|
|
512
|
-
messages = _ref.messages,
|
|
513
|
-
onLogout = _ref.onLogout,
|
|
514
|
-
onLanguageChange = _ref.onLanguageChange,
|
|
515
|
-
userName = _ref.userName,
|
|
516
|
-
language = _ref.language,
|
|
517
|
-
environment = _ref.environment,
|
|
518
|
-
showVersionItem = _ref.showVersionItem,
|
|
519
|
-
showMyProfileItem = _ref.showMyProfileItem,
|
|
520
|
-
showCookieSettingsItem = _ref.showCookieSettingsItem,
|
|
521
|
-
onNavigateToMyProfile = _ref.onNavigateToMyProfile,
|
|
522
|
-
_ref$onCookieSettings = _ref.onCookieSettingsOpen,
|
|
523
|
-
onCookieSettingsOpen = _ref$onCookieSettings === void 0 ? function () {} : _ref$onCookieSettings;
|
|
524
|
-
var triggerClassList = cx(['eps-user-menu__trigger-button', className]);
|
|
525
|
-
var _useState = useState(false),
|
|
526
|
-
open = _useState[0],
|
|
527
|
-
setOpen = _useState[1];
|
|
528
|
-
return React.createElement("div", {
|
|
529
|
-
id: "eps-user-menu"
|
|
530
|
-
}, React.createElement(CustomOverflowMenu, {
|
|
531
|
-
open: open,
|
|
532
|
-
onOpenChange: setOpen,
|
|
533
|
-
className: triggerClassList,
|
|
534
|
-
userName: userName,
|
|
535
|
-
environment: environment
|
|
536
|
-
}, React.createElement("div", {
|
|
537
|
-
id: "eps-overflow-menu"
|
|
538
|
-
}, React.createElement(LanguageSwitchMenuItem, {
|
|
539
|
-
name: messages.switchLanguage,
|
|
540
|
-
language: language,
|
|
541
|
-
onLanguageChange: onLanguageChange,
|
|
542
|
-
setOpen: setOpen
|
|
543
|
-
}), showVersionItem && messages.appVersion && React.createElement(VersionMenuItem, {
|
|
544
|
-
title: messages.appVersion,
|
|
545
|
-
setOpen: setOpen
|
|
546
|
-
}), showMyProfileItem && messages.myProfile && React.createElement(UserMenuItem, {
|
|
547
|
-
name: messages.myProfile,
|
|
548
|
-
setOpen: setOpen,
|
|
549
|
-
onNavigateToMyProfile: onNavigateToMyProfile
|
|
550
|
-
}), showCookieSettingsItem && messages.cookieSettings && React.createElement(CookieSettingsMenuItem, {
|
|
551
|
-
name: messages.cookieSettings,
|
|
552
|
-
setOpen: setOpen,
|
|
553
|
-
onCookieSettingsOpen: onCookieSettingsOpen
|
|
554
|
-
}), React.createElement(LogOutMenuItem, {
|
|
555
|
-
name: messages.logout,
|
|
556
|
-
setOpen: setOpen,
|
|
557
|
-
onLogout: onLogout
|
|
558
|
-
}))));
|
|
559
|
-
};
|
|
560
|
-
|
|
561
|
-
var _excluded$a = ["label", "organisations", "onChange", "selectedOrganisationId"];
|
|
562
|
-
var OrganisationDropDown = function OrganisationDropDown(_ref) {
|
|
563
|
-
var label = _ref.label,
|
|
564
|
-
organisations = _ref.organisations,
|
|
565
|
-
handleChange = _ref.onChange,
|
|
566
|
-
selectedOrganisationId = _ref.selectedOrganisationId,
|
|
567
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$a);
|
|
568
|
-
var _useState = useState(),
|
|
569
|
-
selectedOrganisation = _useState[0],
|
|
570
|
-
setSelectedOrganisation = _useState[1];
|
|
571
|
-
useEffect(function () {
|
|
572
|
-
setSelectedOrganisation(organisations.find(function (org) {
|
|
573
|
-
return org.organisationId === selectedOrganisationId;
|
|
574
|
-
}));
|
|
575
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
576
|
-
}, [selectedOrganisationId]);
|
|
577
|
-
return React.createElement(SearchableDropdown, _extends({
|
|
578
|
-
label: label,
|
|
579
|
-
items: [].concat(organisations.sort(function (a, b) {
|
|
580
|
-
return a.tradingName.localeCompare(b.tradingName, 'nb');
|
|
581
|
-
}).map(function (organisation) {
|
|
582
|
-
return {
|
|
583
|
-
value: organisation.organisationId,
|
|
584
|
-
label: organisation.tradingName
|
|
585
|
-
};
|
|
586
|
-
})),
|
|
587
|
-
selectedItem: selectedOrganisation ? {
|
|
588
|
-
value: selectedOrganisation.organisationId,
|
|
589
|
-
label: selectedOrganisation.tradingName
|
|
590
|
-
} : null,
|
|
591
|
-
onChange: function onChange(selectedValue) {
|
|
592
|
-
if (selectedValue) {
|
|
593
|
-
handleChange(selectedValue.value);
|
|
594
|
-
}
|
|
595
|
-
},
|
|
596
|
-
clearable: false
|
|
597
|
-
}, rest));
|
|
598
|
-
};
|
|
599
|
-
|
|
600
|
-
/*global EventListener WindowEventHandlers*/
|
|
601
|
-
function useEventListener(eventName, handler, element) {
|
|
602
|
-
if (element === void 0) {
|
|
603
|
-
element = window;
|
|
604
|
-
}
|
|
605
|
-
var savedHandler = useRef();
|
|
606
|
-
useEffect(function () {
|
|
607
|
-
savedHandler.current = handler;
|
|
608
|
-
}, [handler]);
|
|
609
|
-
useEffect(function () {
|
|
610
|
-
var isSupported = element && element.addEventListener;
|
|
611
|
-
if (!isSupported) return;
|
|
612
|
-
var eventListener = function eventListener(event) {
|
|
613
|
-
return savedHandler.current == null ? void 0 : savedHandler.current(event);
|
|
614
|
-
};
|
|
615
|
-
element.addEventListener(eventName, eventListener);
|
|
616
|
-
return function () {
|
|
617
|
-
element.removeEventListener(eventName, eventListener);
|
|
618
|
-
};
|
|
619
|
-
}, [eventName, element]);
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
var _excluded$9 = ["language", "options", "className", "onChange"];
|
|
623
|
-
var LanguageSelect = function LanguageSelect(_ref) {
|
|
624
|
-
var language = _ref.language,
|
|
625
|
-
options = _ref.options,
|
|
574
|
+
var Menu = function Menu(_ref) {
|
|
575
|
+
var _ref$as = _ref.as,
|
|
576
|
+
Component = _ref$as === void 0 ? "nav" : _ref$as,
|
|
626
577
|
className = _ref.className,
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
}), React.createElement(SegmentedControl, {
|
|
633
|
-
onChange: function onChange(language) {
|
|
634
|
-
assertIsDefined(language);
|
|
635
|
-
_onChange(language);
|
|
636
|
-
},
|
|
637
|
-
selectedValue: language
|
|
638
|
-
}, options.map(function (option) {
|
|
639
|
-
return React.createElement(SegmentedChoice, {
|
|
640
|
-
key: option.value,
|
|
641
|
-
value: option.value
|
|
642
|
-
}, option.label, option.required && React.createElement("span", {
|
|
643
|
-
className: "asterisk-margin"
|
|
644
|
-
}, '*'));
|
|
645
|
-
})));
|
|
646
|
-
};
|
|
647
|
-
|
|
648
|
-
var _excluded$8 = ["title", "inputComponent", "languages", "values", "onChange", "name", "variant", "feedback"];
|
|
649
|
-
var ExpandableMultiLanguageInput = function ExpandableMultiLanguageInput(_ref) {
|
|
650
|
-
var title = _ref.title,
|
|
651
|
-
InputComponent = _ref.inputComponent,
|
|
652
|
-
languages = _ref.languages,
|
|
653
|
-
values = _ref.values,
|
|
654
|
-
onChange = _ref.onChange,
|
|
655
|
-
name = _ref.name,
|
|
656
|
-
variant = _ref.variant,
|
|
657
|
-
feedback = _ref.feedback,
|
|
658
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$8);
|
|
659
|
-
var handleOnChange = function handleOnChange(language, value) {
|
|
660
|
-
var changes = _extends({}, values);
|
|
661
|
-
if (value === '' || !value) {
|
|
662
|
-
delete changes[language];
|
|
663
|
-
} else {
|
|
664
|
-
changes[language] = value;
|
|
665
|
-
}
|
|
666
|
-
onChange(changes);
|
|
667
|
-
};
|
|
668
|
-
return React.createElement(ExpandablePanel, {
|
|
669
|
-
title: title,
|
|
670
|
-
defaultOpen: true,
|
|
671
|
-
contentStyle: {
|
|
672
|
-
padding: '4px 4px 4px 4px',
|
|
673
|
-
marginTop: '16px',
|
|
674
|
-
marginBottom: '16px'
|
|
675
|
-
}
|
|
676
|
-
}, React.createElement(Stack, {
|
|
677
|
-
space: "medium"
|
|
678
|
-
}, languages.map(function (_ref2) {
|
|
679
|
-
var langKey = _ref2.value,
|
|
680
|
-
label = _ref2.label,
|
|
681
|
-
required = _ref2.required;
|
|
682
|
-
return React.createElement(InputComponent, _extends({
|
|
683
|
-
"data-testid": "multi-lang-input-" + name + "-" + langKey,
|
|
684
|
-
key: title + langKey,
|
|
685
|
-
label: required ? label + '*' : label,
|
|
686
|
-
variant: variant && variant(langKey),
|
|
687
|
-
feedback: feedback && feedback(langKey),
|
|
688
|
-
name: name,
|
|
689
|
-
onChange: function onChange(e) {
|
|
690
|
-
handleOnChange(langKey, e.target.value);
|
|
691
|
-
},
|
|
692
|
-
value: values[langKey] || ''
|
|
693
|
-
}, rest));
|
|
694
|
-
})));
|
|
578
|
+
children = _ref.children;
|
|
579
|
+
var classList = cx(["eds-contrast", "eps-menu", className]);
|
|
580
|
+
return React.createElement(Component, {
|
|
581
|
+
className: classList
|
|
582
|
+
}, children);
|
|
695
583
|
};
|
|
696
584
|
|
|
697
|
-
var _excluded$
|
|
698
|
-
/**
|
|
699
|
-
* @deprecated use ExpandableMultiLanguageInput
|
|
585
|
+
var _excluded$5 = ["className", "inputComponent", "alertLabel", "alertLevel", "name", "languages", "values", "onChange", "defaultLanguage", "label", "onBlur"];
|
|
586
|
+
/**
|
|
587
|
+
* @deprecated use ExpandableMultiLanguageInput
|
|
700
588
|
*/
|
|
701
589
|
var MultiLanguageInput = function MultiLanguageInput(_ref) {
|
|
702
590
|
var className = _ref.className,
|
|
@@ -708,16 +596,16 @@ var MultiLanguageInput = function MultiLanguageInput(_ref) {
|
|
|
708
596
|
values = _ref.values,
|
|
709
597
|
onChange = _ref.onChange,
|
|
710
598
|
_ref$defaultLanguage = _ref.defaultLanguage,
|
|
711
|
-
defaultLanguage = _ref$defaultLanguage === void 0 ?
|
|
599
|
+
defaultLanguage = _ref$defaultLanguage === void 0 ? "nob" : _ref$defaultLanguage,
|
|
712
600
|
_ref$label = _ref.label,
|
|
713
|
-
label = _ref$label === void 0 ?
|
|
601
|
+
label = _ref$label === void 0 ? "" : _ref$label,
|
|
714
602
|
_ref$onBlur = _ref.onBlur,
|
|
715
603
|
onBlur = _ref$onBlur === void 0 ? function () {} : _ref$onBlur,
|
|
716
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
604
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$5);
|
|
717
605
|
var _useState = useState(defaultLanguage),
|
|
718
606
|
language = _useState[0],
|
|
719
607
|
setLanguage = _useState[1];
|
|
720
|
-
var classNames = cx(
|
|
608
|
+
var classNames = cx("multi-language-input", className);
|
|
721
609
|
var currentValue = values[language];
|
|
722
610
|
var handleOnBlur = function handleOnBlur(e) {
|
|
723
611
|
e.persist();
|
|
@@ -733,208 +621,143 @@ var MultiLanguageInput = function MultiLanguageInput(_ref) {
|
|
|
733
621
|
};
|
|
734
622
|
var handleOnChange = function handleOnChange(value) {
|
|
735
623
|
var changes = Object.assign({}, values);
|
|
736
|
-
if (value ===
|
|
624
|
+
if (value === "" || !value) {
|
|
737
625
|
delete changes[language];
|
|
738
626
|
} else {
|
|
739
627
|
changes[language] = value;
|
|
740
628
|
}
|
|
741
629
|
onChange(changes);
|
|
742
630
|
};
|
|
743
|
-
return
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
631
|
+
return (
|
|
632
|
+
// biome-ignore lint/a11y/noStaticElementInteractions: Legacy component
|
|
633
|
+
React.createElement("div", {
|
|
634
|
+
className: classNames,
|
|
635
|
+
// biome-ignore lint/a11y/noNoninteractiveTabindex: Legacy component
|
|
636
|
+
tabIndex: 0,
|
|
637
|
+
onBlur: handleOnBlur,
|
|
638
|
+
"data-testid": "multi-lang-input-" + name
|
|
639
|
+
}, React.createElement(Stack, {
|
|
640
|
+
space: "extraSmall"
|
|
641
|
+
}, React.createElement(LanguageSelect, {
|
|
642
|
+
language: language,
|
|
643
|
+
options: languages,
|
|
644
|
+
onChange: function onChange(lang) {
|
|
645
|
+
return handleLanguageChange(lang);
|
|
646
|
+
}
|
|
647
|
+
}), React.createElement(InputComponent, _extends({
|
|
648
|
+
label: label,
|
|
649
|
+
variant: alertLevel,
|
|
650
|
+
feedback: alertLabel,
|
|
651
|
+
name: name,
|
|
652
|
+
className: "language-item",
|
|
653
|
+
onChange: function onChange(e) {
|
|
654
|
+
return handleOnChange(e.target.value);
|
|
655
|
+
},
|
|
656
|
+
value: currentValue || ""
|
|
657
|
+
}, rest))))
|
|
658
|
+
);
|
|
659
|
+
};
|
|
660
|
+
|
|
661
|
+
var _excluded$4 = ["label", "organisations", "onChange", "selectedOrganisationId"];
|
|
662
|
+
var OrganisationDropDown = function OrganisationDropDown(_ref) {
|
|
663
|
+
var label = _ref.label,
|
|
664
|
+
organisations = _ref.organisations,
|
|
665
|
+
handleChange = _ref.onChange,
|
|
666
|
+
selectedOrganisationId = _ref.selectedOrganisationId,
|
|
667
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
668
|
+
var _useState = useState(),
|
|
669
|
+
selectedOrganisation = _useState[0],
|
|
670
|
+
setSelectedOrganisation = _useState[1];
|
|
671
|
+
useEffect(function () {
|
|
672
|
+
setSelectedOrganisation(organisations.find(function (org) {
|
|
673
|
+
return org.organisationId === selectedOrganisationId;
|
|
674
|
+
}));
|
|
675
|
+
}, [selectedOrganisationId, organisations]);
|
|
676
|
+
return React.createElement(SearchableDropdown, _extends({
|
|
757
677
|
label: label,
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
678
|
+
items: [].concat(organisations.sort(function (a, b) {
|
|
679
|
+
return a.tradingName.localeCompare(b.tradingName, "nb");
|
|
680
|
+
}).map(function (organisation) {
|
|
681
|
+
return {
|
|
682
|
+
value: organisation.organisationId,
|
|
683
|
+
label: organisation.tradingName
|
|
684
|
+
};
|
|
685
|
+
})),
|
|
686
|
+
selectedItem: selectedOrganisation ? {
|
|
687
|
+
value: selectedOrganisation.organisationId,
|
|
688
|
+
label: selectedOrganisation.tradingName
|
|
689
|
+
} : null,
|
|
690
|
+
onChange: function onChange(selectedValue) {
|
|
691
|
+
if (selectedValue) {
|
|
692
|
+
handleChange(selectedValue.value);
|
|
693
|
+
}
|
|
764
694
|
},
|
|
765
|
-
|
|
766
|
-
}, rest))
|
|
695
|
+
clearable: false
|
|
696
|
+
}, rest));
|
|
767
697
|
};
|
|
768
698
|
|
|
769
|
-
var
|
|
770
|
-
var
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
699
|
+
var Pager = function Pager(_ref) {
|
|
700
|
+
var collectionSize = _ref.collectionSize,
|
|
701
|
+
pageSize = _ref.pageSize,
|
|
702
|
+
_onPageChange = _ref.onPageChange,
|
|
703
|
+
currentPage = _ref.currentPage;
|
|
704
|
+
var pageCount = Math.ceil(collectionSize / pageSize);
|
|
705
|
+
return React.createElement(Pagination, {
|
|
706
|
+
pageCount: pageCount,
|
|
707
|
+
currentPage: currentPage,
|
|
708
|
+
onPageChange: function onPageChange(page) {
|
|
709
|
+
_onPageChange(page);
|
|
710
|
+
}
|
|
711
|
+
});
|
|
779
712
|
};
|
|
780
713
|
|
|
781
|
-
function
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
var
|
|
786
|
-
var ErrorBoundary = /*#__PURE__*/function (_Component) {
|
|
787
|
-
function ErrorBoundary(props) {
|
|
788
|
-
var _this;
|
|
789
|
-
_this = _Component.call(this, props) || this;
|
|
790
|
-
_this.state = {
|
|
791
|
-
error: null
|
|
792
|
-
};
|
|
793
|
-
return _this;
|
|
794
|
-
}
|
|
795
|
-
_inheritsLoose(ErrorBoundary, _Component);
|
|
796
|
-
ErrorBoundary.getDerivedStateFromError = function getDerivedStateFromError(error) {
|
|
714
|
+
var PageTitle = function PageTitle(_ref) {
|
|
715
|
+
var pathname = _ref.pathname,
|
|
716
|
+
onBreadcrumbLookup = _ref.onBreadcrumbLookup;
|
|
717
|
+
var paths = splitUrlPath(pathname);
|
|
718
|
+
var pageTitles = paths.map(function (path) {
|
|
797
719
|
return {
|
|
798
|
-
|
|
720
|
+
title: onBreadcrumbLookup(path),
|
|
721
|
+
path: path
|
|
799
722
|
};
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
};
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
fallback = _this$props2.fallback,
|
|
812
|
-
children = _this$props2.children;
|
|
813
|
-
if (error) {
|
|
814
|
-
if (isFunction(fallback)) {
|
|
815
|
-
return fallback({
|
|
816
|
-
retry: function retry() {
|
|
817
|
-
return _this2.setState({
|
|
818
|
-
error: null
|
|
819
|
-
});
|
|
820
|
-
},
|
|
821
|
-
error: error
|
|
822
|
-
});
|
|
823
|
-
} else if (error.name === 'NotFoundError' && error.message === newAppVersionErrorMessage) {
|
|
824
|
-
return React.createElement(RefreshBannerInfo, null);
|
|
825
|
-
}
|
|
826
|
-
return fallback;
|
|
827
|
-
}
|
|
828
|
-
return children;
|
|
829
|
-
};
|
|
830
|
-
return ErrorBoundary;
|
|
831
|
-
}(Component);
|
|
832
|
-
var LANGUAGE_STORAGE_KEY = 'EP::locale';
|
|
833
|
-
function RefreshBannerInfo() {
|
|
834
|
-
// Taken from ./app-shell/src/storage.ts
|
|
835
|
-
var language = localStorage.getItem(LANGUAGE_STORAGE_KEY);
|
|
836
|
-
var isNorwegian = language === 'nb' || language === 'nb-NO';
|
|
837
|
-
return React.createElement(Box, {
|
|
838
|
-
maxWidth: "large"
|
|
839
|
-
}, React.createElement(BannerAlertBox, {
|
|
840
|
-
variant: "info",
|
|
841
|
-
title: isNorwegian ? 'En ny versjon av nettsiden er tilgjengelig.' : 'A new version of the website is available.'
|
|
842
|
-
}, React.createElement(Box, {
|
|
843
|
-
paddingBottom: "medium"
|
|
844
|
-
}, React.createElement(Paragraph, {
|
|
845
|
-
margin: "none"
|
|
846
|
-
}, isNorwegian ? 'Vennligst oppdater.' : 'Please refresh.')), React.createElement(PrimaryButton, {
|
|
847
|
-
onClick: function onClick() {
|
|
848
|
-
return window.location.reload();
|
|
849
|
-
}
|
|
850
|
-
}, isNorwegian ? 'Oppdater' : 'Refresh')));
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
var _excluded$5 = ["date", "locale", "as", "hideTime"];
|
|
854
|
-
var FormatDateTime = function FormatDateTime(_ref) {
|
|
855
|
-
var date = _ref.date,
|
|
856
|
-
locale = _ref.locale,
|
|
857
|
-
_ref$as = _ref.as,
|
|
858
|
-
Component = _ref$as === void 0 ? 'main' : _ref$as,
|
|
859
|
-
hideTime = _ref.hideTime,
|
|
860
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$5);
|
|
861
|
-
return React.createElement(Component, _extends({}, rest), hideTime ? localeDate(date, locale) : localeDateTime(date, locale));
|
|
862
|
-
};
|
|
863
|
-
|
|
864
|
-
var _excluded$4 = ["amount", "as"];
|
|
865
|
-
var FormatCurrencyAmount = function FormatCurrencyAmount(_ref) {
|
|
866
|
-
var amount = _ref.amount,
|
|
867
|
-
_ref$as = _ref.as,
|
|
868
|
-
Component = _ref$as === void 0 ? 'span' : _ref$as,
|
|
869
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
870
|
-
var parsedAmount = Number(amount) || 0;
|
|
871
|
-
var formattedAmount = new Intl.NumberFormat('nb-NO', {
|
|
872
|
-
maximumFractionDigits: 2,
|
|
873
|
-
minimumFractionDigits: 2
|
|
874
|
-
}).format(parsedAmount);
|
|
875
|
-
return React.createElement(Component, _extends({}, rest), formattedAmount);
|
|
876
|
-
};
|
|
877
|
-
|
|
878
|
-
var _excluded$3 = ["items", "locale", "className"];
|
|
879
|
-
var AuditInfo = function AuditInfo(_ref) {
|
|
880
|
-
var items = _ref.items,
|
|
881
|
-
locale = _ref.locale,
|
|
882
|
-
className = _ref.className,
|
|
883
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
884
|
-
var classNames = cx('ep-audit-info', className);
|
|
885
|
-
return React.createElement("div", _extends({
|
|
886
|
-
className: classNames
|
|
887
|
-
}, rest), items.map(function (_ref2, i) {
|
|
888
|
-
var label = _ref2.label,
|
|
889
|
-
value = _ref2.value;
|
|
890
|
-
return React.createElement(Stack, {
|
|
891
|
-
space: "small",
|
|
892
|
-
key: i
|
|
893
|
-
}, React.createElement("div", {
|
|
894
|
-
className: "ep-audit-info-label"
|
|
895
|
-
}, label), React.createElement("div", null, isDate(value) || isDateString(value) ? React.createElement(FormatDateTime, {
|
|
896
|
-
date: value,
|
|
897
|
-
locale: locale
|
|
898
|
-
}) : React.createElement("span", null, value)));
|
|
899
|
-
}));
|
|
723
|
+
}).filter(function (_ref2) {
|
|
724
|
+
var title = _ref2.title;
|
|
725
|
+
return title !== undefined;
|
|
726
|
+
}).map(function (_ref3) {
|
|
727
|
+
var title = _ref3.title;
|
|
728
|
+
return title;
|
|
729
|
+
}).reverse().join(" | ");
|
|
730
|
+
useEffect(function () {
|
|
731
|
+
document.title = pageTitles + " | Entur Partner";
|
|
732
|
+
}, [pageTitles]);
|
|
733
|
+
return null;
|
|
900
734
|
};
|
|
901
735
|
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
var
|
|
917
|
-
var
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
open: isOpen,
|
|
921
|
-
onDismiss: handleDismiss
|
|
922
|
-
}, rest), isString(childrenToRender) ? React.createElement(Paragraph, null, childrenToRender) : React.createElement(Box, {
|
|
923
|
-
paddingBottom: "medium"
|
|
924
|
-
}, childrenToRender), React.createElement(ButtonGroup, null, onConfirm ? React.createElement(React.Fragment, null, React.createElement(SecondaryButton, {
|
|
925
|
-
onClick: handleDismiss,
|
|
926
|
-
"data-testid": "cancel-modal-button"
|
|
927
|
-
}, messages.cancel), React.createElement(PrimaryButton, {
|
|
928
|
-
onClick: onConfirm,
|
|
929
|
-
"data-testid": "confirm-modal-button"
|
|
930
|
-
}, messages.confirm)) : buttons));
|
|
736
|
+
/**
|
|
737
|
+
* Note: This component uses BusinessCapability, not because we only want to
|
|
738
|
+
* check BusinessCapabilities but because it represents a minimal subset of
|
|
739
|
+
* what we need to check.
|
|
740
|
+
*/
|
|
741
|
+
var PermissionCheck = function PermissionCheck(_ref) {
|
|
742
|
+
var children = _ref.children,
|
|
743
|
+
_ref$fallback = _ref.fallback,
|
|
744
|
+
fallback = _ref$fallback === void 0 ? null : _ref$fallback,
|
|
745
|
+
permissions = _ref.permissions,
|
|
746
|
+
_ref$oneOf = _ref.oneOf,
|
|
747
|
+
oneOf = _ref$oneOf === void 0 ? [] : _ref$oneOf,
|
|
748
|
+
_ref$all = _ref.all,
|
|
749
|
+
all = _ref$all === void 0 ? [] : _ref$all;
|
|
750
|
+
var allIsAllowed = hasAllPermissions(all, permissions);
|
|
751
|
+
var oneOfIsAllowed = hasOneOfPermissions(oneOf, permissions);
|
|
752
|
+
var allowed = allIsAllowed && oneOfIsAllowed;
|
|
753
|
+
return React.createElement(React.Fragment, null, allowed ? children : fallback);
|
|
931
754
|
};
|
|
932
755
|
|
|
933
|
-
var _excluded$
|
|
756
|
+
var _excluded$3 = ["children", "shouldBlockNavigation"];
|
|
934
757
|
var RouteLeavingGuard = function RouteLeavingGuard(_ref) {
|
|
935
758
|
var children = _ref.children,
|
|
936
759
|
shouldBlockNavigation = _ref.shouldBlockNavigation,
|
|
937
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
760
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
938
761
|
assertIsDefined(useInRouterContext() ? true : undefined, "RouteLeavingGuard must be used within a data router.");
|
|
939
762
|
var blocker = useBlocker(function (_ref2) {
|
|
940
763
|
var currentLocation = _ref2.currentLocation,
|
|
@@ -943,47 +766,32 @@ var RouteLeavingGuard = function RouteLeavingGuard(_ref) {
|
|
|
943
766
|
});
|
|
944
767
|
return React.createElement(ConfirmModal, _extends({
|
|
945
768
|
onDismiss: function onDismiss() {
|
|
946
|
-
if (blocker.state ===
|
|
769
|
+
if (blocker.state === "blocked") {
|
|
947
770
|
blocker.reset();
|
|
948
771
|
}
|
|
949
772
|
},
|
|
950
|
-
open: blocker.state ===
|
|
773
|
+
open: blocker.state === "blocked",
|
|
951
774
|
onConfirm: function onConfirm() {
|
|
952
|
-
if (blocker.state ===
|
|
775
|
+
if (blocker.state === "blocked") {
|
|
953
776
|
blocker.proceed();
|
|
954
777
|
}
|
|
955
778
|
}
|
|
956
779
|
}, rest), children);
|
|
957
780
|
};
|
|
958
781
|
|
|
959
|
-
var Pager = function Pager(_ref) {
|
|
960
|
-
var collectionSize = _ref.collectionSize,
|
|
961
|
-
pageSize = _ref.pageSize,
|
|
962
|
-
_onPageChange = _ref.onPageChange,
|
|
963
|
-
currentPage = _ref.currentPage;
|
|
964
|
-
var pageCount = Math.ceil(collectionSize / pageSize);
|
|
965
|
-
return React.createElement(Pagination, {
|
|
966
|
-
pageCount: pageCount,
|
|
967
|
-
currentPage: currentPage,
|
|
968
|
-
onPageChange: function onPageChange(page) {
|
|
969
|
-
_onPageChange(page);
|
|
970
|
-
}
|
|
971
|
-
});
|
|
972
|
-
};
|
|
973
|
-
|
|
974
782
|
var StatusLabel = function StatusLabel(_ref) {
|
|
975
783
|
var _ref$active = _ref.active,
|
|
976
784
|
active = _ref$active === void 0 ? false : _ref$active,
|
|
977
785
|
_ref$label = _ref.label,
|
|
978
|
-
label = _ref$label === void 0 ?
|
|
786
|
+
label = _ref$label === void 0 ? "" : _ref$label,
|
|
979
787
|
aggressiveInactive = _ref.aggressiveInactive,
|
|
980
788
|
showBullet = _ref.showBullet,
|
|
981
789
|
center = _ref.center;
|
|
982
|
-
var bulletClassNames = cx(
|
|
790
|
+
var bulletClassNames = cx("eps-status-label__bullet", {
|
|
983
791
|
active: active,
|
|
984
792
|
aggressive: aggressiveInactive
|
|
985
793
|
});
|
|
986
|
-
var statusLabelClassNames = cx(
|
|
794
|
+
var statusLabelClassNames = cx("eps-status-label", {
|
|
987
795
|
center: center
|
|
988
796
|
});
|
|
989
797
|
return React.createElement("div", {
|
|
@@ -993,83 +801,21 @@ var StatusLabel = function StatusLabel(_ref) {
|
|
|
993
801
|
}), React.createElement("div", null, label));
|
|
994
802
|
};
|
|
995
803
|
|
|
996
|
-
|
|
997
|
-
* Note: This component uses BusinessCapability, not because we only want to
|
|
998
|
-
* check BusinessCapabilities but because it represents a minimal subset of
|
|
999
|
-
* what we need to check.
|
|
1000
|
-
*/
|
|
1001
|
-
var PermissionCheck = function PermissionCheck(_ref) {
|
|
1002
|
-
var children = _ref.children,
|
|
1003
|
-
_ref$fallback = _ref.fallback,
|
|
1004
|
-
fallback = _ref$fallback === void 0 ? null : _ref$fallback,
|
|
1005
|
-
permissions = _ref.permissions,
|
|
1006
|
-
_ref$oneOf = _ref.oneOf,
|
|
1007
|
-
oneOf = _ref$oneOf === void 0 ? [] : _ref$oneOf,
|
|
1008
|
-
_ref$all = _ref.all,
|
|
1009
|
-
all = _ref$all === void 0 ? [] : _ref$all;
|
|
1010
|
-
var allIsAllowed = hasAllPermissions(all, permissions);
|
|
1011
|
-
var oneOfIsAllowed = hasOneOfPermissions(oneOf, permissions);
|
|
1012
|
-
var allowed = allIsAllowed && oneOfIsAllowed;
|
|
1013
|
-
return React.createElement(React.Fragment, null, allowed ? children : fallback);
|
|
1014
|
-
};
|
|
1015
|
-
|
|
1016
|
-
var Breadcrumbs = function Breadcrumbs(_ref) {
|
|
1017
|
-
var prependBreadcrumbItem = _ref.prependBreadcrumbItem,
|
|
1018
|
-
pathname = _ref.pathname,
|
|
1019
|
-
onBreadcrumbLookup = _ref.onBreadcrumbLookup;
|
|
1020
|
-
var paths = splitUrlPath(pathname);
|
|
1021
|
-
var breadcrumbs = paths.map(function (path) {
|
|
1022
|
-
return {
|
|
1023
|
-
title: onBreadcrumbLookup(path),
|
|
1024
|
-
path: path
|
|
1025
|
-
};
|
|
1026
|
-
}).filter(function (_ref2) {
|
|
1027
|
-
var title = _ref2.title;
|
|
1028
|
-
return title !== undefined;
|
|
1029
|
-
});
|
|
1030
|
-
var breadcrumbElements = breadcrumbs.map(function (_ref3, i) {
|
|
1031
|
-
var title = _ref3.title,
|
|
1032
|
-
path = _ref3.path;
|
|
1033
|
-
var isLast = i === breadcrumbs.length - 1;
|
|
1034
|
-
if (isLast) {
|
|
1035
|
-
return React.createElement(BreadcrumbItem, {
|
|
1036
|
-
key: path,
|
|
1037
|
-
as: 'span'
|
|
1038
|
-
}, title);
|
|
1039
|
-
}
|
|
1040
|
-
return React.createElement(BreadcrumbItem, {
|
|
1041
|
-
key: path,
|
|
1042
|
-
as: Link$2,
|
|
1043
|
-
to: path
|
|
1044
|
-
}, title);
|
|
1045
|
-
});
|
|
1046
|
-
if (prependBreadcrumbItem) {
|
|
1047
|
-
return React.createElement(BreadcrumbNavigation, null, [prependBreadcrumbItem].concat(breadcrumbElements));
|
|
1048
|
-
}
|
|
1049
|
-
return React.createElement(BreadcrumbNavigation, null, breadcrumbElements);
|
|
1050
|
-
};
|
|
1051
|
-
|
|
1052
|
-
var Link = function Link(props) {
|
|
1053
|
-
return React.createElement(Link$1, _extends({}, props, {
|
|
1054
|
-
as: Link$2
|
|
1055
|
-
}), props.children);
|
|
1056
|
-
};
|
|
1057
|
-
|
|
1058
|
-
var _excluded = ["as", "children", "fontSize", "color", "lineHeight", "fontWeight", "className"];
|
|
804
|
+
var _excluded$2 = ["as", "children", "fontSize", "color", "lineHeight", "fontWeight", "className"];
|
|
1059
805
|
var Text = function Text(_ref) {
|
|
1060
806
|
var _ref$as = _ref.as,
|
|
1061
|
-
component = _ref$as === void 0 ?
|
|
807
|
+
component = _ref$as === void 0 ? "span" : _ref$as,
|
|
1062
808
|
children = _ref.children,
|
|
1063
809
|
fontSize = _ref.fontSize,
|
|
1064
810
|
color = _ref.color,
|
|
1065
811
|
lineHeight = _ref.lineHeight,
|
|
1066
812
|
fontWeight = _ref.fontWeight,
|
|
1067
813
|
className = _ref.className,
|
|
1068
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
814
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
1069
815
|
var classes = [];
|
|
1070
|
-
fontSize && classes.push.apply(classes, responsiveProp(
|
|
1071
|
-
lineHeight && classes.push.apply(classes, responsiveProp(
|
|
1072
|
-
fontWeight && classes.push(
|
|
816
|
+
fontSize && classes.push.apply(classes, responsiveProp("eps-font-size-", fontSize));
|
|
817
|
+
lineHeight && classes.push.apply(classes, responsiveProp("eps-line-height-", lineHeight));
|
|
818
|
+
fontWeight && classes.push("eps-font-weight-" + fontWeight);
|
|
1073
819
|
var classList = cx(classes, className);
|
|
1074
820
|
return React.createElement(Box, _extends({
|
|
1075
821
|
as: component,
|
|
@@ -1078,32 +824,298 @@ var Text = function Text(_ref) {
|
|
|
1078
824
|
}, rest), children);
|
|
1079
825
|
};
|
|
1080
826
|
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
827
|
+
var _excluded$1 = ["children", "className"];
|
|
828
|
+
var Unbutton = function Unbutton(_ref) {
|
|
829
|
+
var children = _ref.children,
|
|
830
|
+
className = _ref.className,
|
|
831
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
832
|
+
return React.createElement(Button, _extends({
|
|
833
|
+
variant: "primary"
|
|
834
|
+
}, rest, {
|
|
835
|
+
className: cx("eps-unbutton", className)
|
|
836
|
+
}), children);
|
|
837
|
+
};
|
|
838
|
+
|
|
839
|
+
var CustomOverflowMenuItem = function CustomOverflowMenuItem(props) {
|
|
840
|
+
return React.createElement("button", _extends({
|
|
841
|
+
className: cx(props.className, "eps-overflow-menu__item"),
|
|
842
|
+
role: "menuitem"
|
|
843
|
+
}, props));
|
|
844
|
+
};
|
|
845
|
+
|
|
846
|
+
var CookieSettingsMenuItem = function CookieSettingsMenuItem(_ref) {
|
|
847
|
+
var name = _ref.name,
|
|
848
|
+
setOpen = _ref.setOpen,
|
|
849
|
+
onCookieSettingsOpen = _ref.onCookieSettingsOpen;
|
|
850
|
+
return React.createElement(CustomOverflowMenuItem, {
|
|
851
|
+
onClick: function onClick() {
|
|
852
|
+
onCookieSettingsOpen();
|
|
853
|
+
setOpen(false);
|
|
854
|
+
},
|
|
855
|
+
className: "eps-overflow-menu__item"
|
|
856
|
+
}, React.createElement("span", {
|
|
857
|
+
"aria-hidden": true
|
|
858
|
+
}, React.createElement(CookieIcon, {
|
|
859
|
+
size: "1rem",
|
|
860
|
+
inline: true
|
|
861
|
+
})), name);
|
|
862
|
+
};
|
|
863
|
+
|
|
864
|
+
function useOutsideClick(ref, buttonRef, handler) {
|
|
865
|
+
React.useEffect(function () {
|
|
866
|
+
var listener = function listener(event) {
|
|
867
|
+
if (elementContainsEventTarget(ref.current, event) || elementContainsEventTarget(buttonRef.current, event)) {
|
|
868
|
+
return;
|
|
869
|
+
}
|
|
870
|
+
handler();
|
|
1097
871
|
};
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
return
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
}
|
|
1105
|
-
|
|
872
|
+
document.addEventListener("mousedown", listener);
|
|
873
|
+
document.addEventListener("touchstart", listener);
|
|
874
|
+
return function () {
|
|
875
|
+
document.removeEventListener("mousedown", listener);
|
|
876
|
+
document.removeEventListener("touchstart", listener);
|
|
877
|
+
};
|
|
878
|
+
}, [ref, buttonRef, handler]);
|
|
879
|
+
}
|
|
880
|
+
function elementContainsEventTarget(element, event) {
|
|
881
|
+
if (!element) {
|
|
882
|
+
return false;
|
|
883
|
+
}
|
|
884
|
+
if (element.contains(event.target)) {
|
|
885
|
+
return true;
|
|
886
|
+
}
|
|
887
|
+
// For elements inside a Shadow DOM we need to check the composedPath
|
|
888
|
+
if (event.composed && event.composedPath) {
|
|
889
|
+
var contains = event.composedPath().find(function (target) {
|
|
890
|
+
if (target === window) {
|
|
891
|
+
return false;
|
|
892
|
+
}
|
|
893
|
+
return element.contains(target);
|
|
894
|
+
});
|
|
895
|
+
return !!contains;
|
|
896
|
+
}
|
|
897
|
+
return false;
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
var _excluded = ["className", "children", "userName", "open", "onOpenChange", "environment"];
|
|
901
|
+
var CustomOverflowMenu = function CustomOverflowMenu(_ref) {
|
|
902
|
+
var className = _ref.className,
|
|
903
|
+
children = _ref.children,
|
|
904
|
+
userName = _ref.userName,
|
|
905
|
+
open = _ref.open,
|
|
906
|
+
onOpenChange = _ref.onOpenChange,
|
|
907
|
+
environment = _ref.environment,
|
|
908
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
909
|
+
var overflowItemsClasses = cx("eps-overflow-menu__group", {
|
|
910
|
+
"eps-overflow-menu__group--open": open
|
|
911
|
+
});
|
|
912
|
+
var overflowContentRef = React.useRef(null);
|
|
913
|
+
var overflowMenuTriggerRef = React.useRef(null);
|
|
914
|
+
useOutsideClick(overflowContentRef, overflowMenuTriggerRef, function () {
|
|
915
|
+
return onOpenChange(false);
|
|
916
|
+
});
|
|
917
|
+
return React.createElement("div", null, React.createElement(SecondaryButton, _extends({
|
|
918
|
+
className: cx("eps-overflow-menu__button", className),
|
|
919
|
+
onClick: function onClick() {
|
|
920
|
+
return onOpenChange(!open);
|
|
921
|
+
},
|
|
922
|
+
"aria-haspopup": true,
|
|
923
|
+
"aria-expanded": open,
|
|
924
|
+
ref: overflowMenuTriggerRef
|
|
925
|
+
}, rest), React.createElement("div", {
|
|
926
|
+
className: "eps-overflow-menu__button-contents"
|
|
927
|
+
}, React.createElement("span", {
|
|
928
|
+
className: "eds-overflow-menu__user-icon"
|
|
929
|
+
}, React.createElement(UserIcon, {
|
|
930
|
+
inline: true
|
|
931
|
+
})), React.createElement(Heading6, {
|
|
932
|
+
margin: "none",
|
|
933
|
+
as: "span"
|
|
934
|
+
}, userName, environment !== undefined && environment !== Environment.Production && React.createElement("span", {
|
|
935
|
+
style: {
|
|
936
|
+
color: getColorForEnvironment(environment)
|
|
937
|
+
}
|
|
938
|
+
}, " ", "(", getHumanReadableEnvironment(environment), ")")), React.createElement("span", {
|
|
939
|
+
className: "eps-arrow-icon"
|
|
940
|
+
}, React.createElement(DownArrowIcon, {
|
|
941
|
+
inline: true
|
|
942
|
+
})))), open && React.createElement("div", {
|
|
943
|
+
className: overflowItemsClasses,
|
|
944
|
+
role: "menu",
|
|
945
|
+
ref: overflowContentRef
|
|
946
|
+
}, children));
|
|
947
|
+
};
|
|
948
|
+
|
|
949
|
+
var LanguageSwitchMenuItem = function LanguageSwitchMenuItem(_ref) {
|
|
950
|
+
var language = _ref.language,
|
|
951
|
+
onLanguageChange = _ref.onLanguageChange,
|
|
952
|
+
setOpen = _ref.setOpen,
|
|
953
|
+
name = _ref.name;
|
|
954
|
+
var useB47LanguageKey = useFeatureToggle("USE_BCP-47_LANGUAGE_KEY");
|
|
955
|
+
var norwegianLanguageKey = useB47LanguageKey ? "nb-NO" : "nb";
|
|
956
|
+
var englishLanguageKey = useB47LanguageKey ? "en-GB" : "en";
|
|
957
|
+
return React.createElement(React.Fragment, null, language === englishLanguageKey ? React.createElement(CustomOverflowMenuItem, {
|
|
958
|
+
onClick: function onClick() {
|
|
959
|
+
onLanguageChange(norwegianLanguageKey);
|
|
960
|
+
setOpen(false);
|
|
961
|
+
},
|
|
962
|
+
className: "eps-overflow-menu__item"
|
|
963
|
+
}, React.createElement("span", {
|
|
964
|
+
"aria-hidden": true,
|
|
965
|
+
className: "eps-overflow-menu__icon-margin"
|
|
966
|
+
}, React.createElement(NorwayIcon, {
|
|
967
|
+
size: "1rem",
|
|
968
|
+
inline: true
|
|
969
|
+
})), name) : React.createElement(CustomOverflowMenuItem, {
|
|
970
|
+
onClick: function onClick() {
|
|
971
|
+
onLanguageChange(englishLanguageKey);
|
|
972
|
+
setOpen(false);
|
|
973
|
+
},
|
|
974
|
+
className: "eps-overflow-menu__item"
|
|
975
|
+
}, React.createElement("span", {
|
|
976
|
+
"aria-hidden": true,
|
|
977
|
+
className: "eps-overflow-menu__icon-margin"
|
|
978
|
+
}, React.createElement(UKIcon, {
|
|
979
|
+
size: "1rem",
|
|
980
|
+
inline: true
|
|
981
|
+
})), name));
|
|
982
|
+
};
|
|
983
|
+
|
|
984
|
+
var LogOutMenuItem = function LogOutMenuItem(_ref) {
|
|
985
|
+
var name = _ref.name,
|
|
986
|
+
setOpen = _ref.setOpen,
|
|
987
|
+
onLogout = _ref.onLogout;
|
|
988
|
+
return React.createElement(CustomOverflowMenuItem, {
|
|
989
|
+
onClick: function onClick() {
|
|
990
|
+
onLogout();
|
|
991
|
+
setOpen(false);
|
|
992
|
+
},
|
|
993
|
+
"data-testid": "user-menu-logout",
|
|
994
|
+
className: "eps-overflow-menu__item"
|
|
995
|
+
}, React.createElement("span", {
|
|
996
|
+
"aria-hidden": true
|
|
997
|
+
}, React.createElement(LogOutIcon, {
|
|
998
|
+
size: "1rem",
|
|
999
|
+
inline: true
|
|
1000
|
+
})), name);
|
|
1001
|
+
};
|
|
1002
|
+
|
|
1003
|
+
var UserMenuItem = function UserMenuItem(_ref) {
|
|
1004
|
+
var name = _ref.name,
|
|
1005
|
+
setOpen = _ref.setOpen,
|
|
1006
|
+
onNavigateToMyProfile = _ref.onNavigateToMyProfile;
|
|
1007
|
+
return React.createElement(Link$1, {
|
|
1008
|
+
to: "/permission-admin/my-profile",
|
|
1009
|
+
style: {
|
|
1010
|
+
textDecoration: "none"
|
|
1011
|
+
}
|
|
1012
|
+
}, React.createElement(CustomOverflowMenuItem, {
|
|
1013
|
+
onClick: function onClick() {
|
|
1014
|
+
setOpen(false);
|
|
1015
|
+
onNavigateToMyProfile();
|
|
1016
|
+
},
|
|
1017
|
+
className: "eps-overflow-menu__item"
|
|
1018
|
+
}, React.createElement("span", {
|
|
1019
|
+
"aria-hidden": true
|
|
1020
|
+
}, React.createElement(UserIcon, {
|
|
1021
|
+
size: "1rem",
|
|
1022
|
+
inline: true
|
|
1023
|
+
})), name));
|
|
1024
|
+
};
|
|
1025
|
+
|
|
1026
|
+
var VersionMenuItem = function VersionMenuItem(_ref) {
|
|
1027
|
+
var title = _ref.title,
|
|
1028
|
+
setOpen = _ref.setOpen;
|
|
1029
|
+
var navigate = useNavigate(); // Hide useNavigate from standalone micro-frontends because it is not under RouterProvider
|
|
1030
|
+
return React.createElement(CustomOverflowMenuItem, {
|
|
1031
|
+
onClick: function onClick() {
|
|
1032
|
+
navigate("/app-version");
|
|
1033
|
+
setOpen(false);
|
|
1034
|
+
},
|
|
1035
|
+
className: "eps-overflow-menu__item"
|
|
1036
|
+
}, React.createElement("span", {
|
|
1037
|
+
"aria-hidden": true
|
|
1038
|
+
}, React.createElement(ChannelsIcon, {
|
|
1039
|
+
className: "eps-version-icon",
|
|
1040
|
+
size: "1rem",
|
|
1041
|
+
inline: true
|
|
1042
|
+
})), title);
|
|
1043
|
+
};
|
|
1044
|
+
|
|
1045
|
+
/** biome-ignore-all lint/correctness/useUniqueElementIds: Ignore unique id for now */
|
|
1046
|
+
var UserMenu = function UserMenu(_ref) {
|
|
1047
|
+
var className = _ref.className,
|
|
1048
|
+
messages = _ref.messages,
|
|
1049
|
+
onLogout = _ref.onLogout,
|
|
1050
|
+
onLanguageChange = _ref.onLanguageChange,
|
|
1051
|
+
userName = _ref.userName,
|
|
1052
|
+
language = _ref.language,
|
|
1053
|
+
environment = _ref.environment,
|
|
1054
|
+
showVersionItem = _ref.showVersionItem,
|
|
1055
|
+
showMyProfileItem = _ref.showMyProfileItem,
|
|
1056
|
+
showCookieSettingsItem = _ref.showCookieSettingsItem,
|
|
1057
|
+
onNavigateToMyProfile = _ref.onNavigateToMyProfile,
|
|
1058
|
+
_ref$onCookieSettings = _ref.onCookieSettingsOpen,
|
|
1059
|
+
onCookieSettingsOpen = _ref$onCookieSettings === void 0 ? function () {} : _ref$onCookieSettings;
|
|
1060
|
+
var triggerClassList = cx(["eps-user-menu__trigger-button", className]);
|
|
1061
|
+
var _useState = useState(false),
|
|
1062
|
+
open = _useState[0],
|
|
1063
|
+
setOpen = _useState[1];
|
|
1064
|
+
return React.createElement("div", {
|
|
1065
|
+
id: "eps-user-menu"
|
|
1066
|
+
}, React.createElement(CustomOverflowMenu, {
|
|
1067
|
+
open: open,
|
|
1068
|
+
onOpenChange: setOpen,
|
|
1069
|
+
className: triggerClassList,
|
|
1070
|
+
userName: userName,
|
|
1071
|
+
environment: environment
|
|
1072
|
+
}, React.createElement("div", {
|
|
1073
|
+
id: "eps-overflow-menu"
|
|
1074
|
+
}, React.createElement(LanguageSwitchMenuItem, {
|
|
1075
|
+
name: messages.switchLanguage,
|
|
1076
|
+
language: language,
|
|
1077
|
+
onLanguageChange: onLanguageChange,
|
|
1078
|
+
setOpen: setOpen
|
|
1079
|
+
}), showVersionItem && messages.appVersion && React.createElement(VersionMenuItem, {
|
|
1080
|
+
title: messages.appVersion,
|
|
1081
|
+
setOpen: setOpen
|
|
1082
|
+
}), showMyProfileItem && messages.myProfile && React.createElement(UserMenuItem, {
|
|
1083
|
+
name: messages.myProfile,
|
|
1084
|
+
setOpen: setOpen,
|
|
1085
|
+
onNavigateToMyProfile: onNavigateToMyProfile
|
|
1086
|
+
}), showCookieSettingsItem && messages.cookieSettings && React.createElement(CookieSettingsMenuItem, {
|
|
1087
|
+
name: messages.cookieSettings,
|
|
1088
|
+
setOpen: setOpen,
|
|
1089
|
+
onCookieSettingsOpen: onCookieSettingsOpen
|
|
1090
|
+
}), React.createElement(LogOutMenuItem, {
|
|
1091
|
+
name: messages.logout,
|
|
1092
|
+
setOpen: setOpen,
|
|
1093
|
+
onLogout: onLogout
|
|
1094
|
+
}))));
|
|
1095
|
+
};
|
|
1096
|
+
|
|
1097
|
+
/*global EventListener WindowEventHandlers*/
|
|
1098
|
+
function useEventListener(eventName, handler, element) {
|
|
1099
|
+
if (element === void 0) {
|
|
1100
|
+
element = window;
|
|
1101
|
+
}
|
|
1102
|
+
var savedHandler = useRef();
|
|
1103
|
+
useEffect(function () {
|
|
1104
|
+
savedHandler.current = handler;
|
|
1105
|
+
}, [handler]);
|
|
1106
|
+
useEffect(function () {
|
|
1107
|
+
var _element;
|
|
1108
|
+
var isSupported = (_element = element) == null ? void 0 : _element.addEventListener;
|
|
1109
|
+
if (!isSupported) return;
|
|
1110
|
+
var eventListener = function eventListener(event) {
|
|
1111
|
+
return savedHandler.current == null ? void 0 : savedHandler.current(event);
|
|
1112
|
+
};
|
|
1113
|
+
element.addEventListener(eventName, eventListener);
|
|
1114
|
+
return function () {
|
|
1115
|
+
element.removeEventListener(eventName, eventListener);
|
|
1116
|
+
};
|
|
1117
|
+
}, [eventName, element]);
|
|
1106
1118
|
}
|
|
1107
1119
|
|
|
1108
|
-
export { ActionBar, ActionBarLeft, ActionBarRight, AuditInfo, Box, Breadcrumbs, ConfirmModal, Content, EnturPartnerLogo, EnturPartnerLogoSvg, Environment, ErrorBoundary, ExpandableMultiLanguageInput, FeatureToggle, FormatCurrencyAmount, FormatDateTime, LanguageSelect, Link, LinkButton, Menu, MultiLanguageInput, OrganisationDropDown, PageTitle, Pager, PermissionCheck, RouteLeavingGuard, Stack, StatusLabel, Text, Unbutton, UserMenu, featureFlag, getColorForEnvironment, getHumanReadableEnvironment, responsiveProp, useEventListener, useFeatureToggle };
|
|
1120
|
+
export { ActionBar, ActionBarLeft, ActionBarRight, AuditInfo, Box, Breadcrumbs, ConfirmModal, Content, EnturPartnerLogo, EnturPartnerLogoSvg, Environment, ErrorBoundary, ExpandableMultiLanguageInput, FeatureToggle, FormatCurrencyAmount, FormatDateTime, LanguageSelect, LegacyPageTitle, Link, LinkButton, Menu, MultiLanguageInput, OrganisationDropDown, PageTitle, Pager, PermissionCheck, RouteLeavingGuard, Stack, StatusLabel, Text, Unbutton, UserMenu, featureFlag, getColorForEnvironment, getHumanReadableEnvironment, responsiveProp, useEventListener, useFeatureToggle };
|
|
1109
1121
|
//# sourceMappingURL=common.esm.js.map
|