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