@entur-partner/common 11.0.0 → 11.0.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 +4 -4
- package/dist/Box.d.ts +3 -4
- package/dist/ConfirmModal.d.ts +1 -2
- package/dist/Content.d.ts +2 -3
- package/dist/EnturPartnerLogo.d.ts +2 -3
- package/dist/ErrorBoundary.d.ts +2 -2
- package/dist/ExpandableMultiLanguageInput.d.ts +3 -3
- package/dist/FeatureToggle.d.ts +2 -2
- package/dist/FormatCurrencyAmount.d.ts +2 -3
- package/dist/LinkButton.d.ts +2 -2
- package/dist/Menu.d.ts +2 -3
- package/dist/MultiLanguageInput.d.ts +2 -2
- package/dist/Stack.d.ts +2 -2
- package/dist/Text.d.ts +3 -4
- package/dist/common.cjs.development.js +477 -348
- 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 +467 -338
- package/dist/common.esm.js.map +1 -1
- package/dist/styles.css +34 -34
- package/dist/user-menu/components/CookieSettingsMenuItem.d.ts +1 -2
- package/dist/user-menu/components/CustomOverflowMenu.d.ts +3 -3
- package/dist/user-menu/components/CustomOverflowMenuItem.d.ts +2 -2
- package/dist/user-menu/components/LocaleSwitchMenuItem.d.ts +1 -2
- package/dist/user-menu/components/LogOutMenuItem.d.ts +1 -2
- package/dist/user-menu/components/UserMenuItem.d.ts +1 -2
- package/dist/user-menu/components/VersionMenuItem.d.ts +2 -2
- package/dist/user-menu/components/useOutsideClick.d.ts +2 -2
- package/package.json +6 -6
package/dist/common.esm.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { localeDate, localeDateTime, isDate, isDateString, splitUrlPath, isString, isFunction, assertIsDefined, hasAllPermissions, hasOneOfPermissions } from '@entur-partner/util';
|
|
3
3
|
import cx from 'classnames';
|
|
4
|
+
import { Children, Component, useState, useRef, useEffect } from 'react';
|
|
4
5
|
import { BreadcrumbItem, BreadcrumbNavigation, Pagination } from '@entur/menu';
|
|
5
6
|
import { Link as Link$1, useInRouterContext, useBlocker } from 'react-router-dom';
|
|
6
7
|
import { ButtonGroup, SecondaryButton, PrimaryButton, Button } from '@entur/button';
|
|
@@ -14,23 +15,28 @@ import { CookieIcon, UserIcon, DownArrowIcon, NorwayIcon, UKIcon, LogOutIcon, Ch
|
|
|
14
15
|
|
|
15
16
|
var ActionBarLeft = function ActionBarLeft(_ref) {
|
|
16
17
|
var children = _ref.children;
|
|
17
|
-
return
|
|
18
|
-
className: "eps-action-bar-left"
|
|
19
|
-
|
|
18
|
+
return jsx("div", {
|
|
19
|
+
className: "eps-action-bar-left",
|
|
20
|
+
children: children
|
|
21
|
+
});
|
|
20
22
|
};
|
|
21
23
|
var ActionBarRight = function ActionBarRight(_ref2) {
|
|
22
24
|
var children = _ref2.children;
|
|
23
|
-
return
|
|
24
|
-
className: "eps-action-bar-right"
|
|
25
|
-
|
|
25
|
+
return jsx("div", {
|
|
26
|
+
className: "eps-action-bar-right",
|
|
27
|
+
children: children
|
|
28
|
+
});
|
|
26
29
|
};
|
|
27
30
|
var ActionBar = function ActionBar(_ref3) {
|
|
28
31
|
var children = _ref3.children;
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
return jsxs(Fragment, {
|
|
33
|
+
children: [jsx("div", {
|
|
34
|
+
className: "eps-action-bar-padding"
|
|
35
|
+
}), jsx("div", {
|
|
36
|
+
className: "eps-action-bar",
|
|
37
|
+
children: children
|
|
38
|
+
})]
|
|
39
|
+
});
|
|
34
40
|
};
|
|
35
41
|
|
|
36
42
|
function _extends() {
|
|
@@ -68,7 +74,9 @@ var FormatDateTime = function FormatDateTime(_ref) {
|
|
|
68
74
|
Component = _ref$as === void 0 ? "main" : _ref$as,
|
|
69
75
|
hideTime = _ref.hideTime,
|
|
70
76
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$e);
|
|
71
|
-
return
|
|
77
|
+
return jsx(Component, _extends({}, rest, {
|
|
78
|
+
children: hideTime ? localeDate(date, locale) : localeDateTime(date, locale)
|
|
79
|
+
}));
|
|
72
80
|
};
|
|
73
81
|
|
|
74
82
|
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"];
|
|
@@ -142,30 +150,34 @@ var Box = function Box(_ref) {
|
|
|
142
150
|
flexDirection && classes.push.apply(classes, responsiveProp("eps-flex-", flexDirection));
|
|
143
151
|
flexWrap && classes.push.apply(classes, responsiveProp("eps-flex-wrap-", flexWrap));
|
|
144
152
|
var classList = cx(classes, className);
|
|
145
|
-
return
|
|
153
|
+
return jsx(Component, _extends({
|
|
146
154
|
className: classList
|
|
147
|
-
}, rest
|
|
155
|
+
}, rest, {
|
|
156
|
+
children: children
|
|
157
|
+
}));
|
|
148
158
|
};
|
|
149
159
|
|
|
150
|
-
/** biome-ignore-all lint/suspicious/noArrayIndexKey: Ignore for now. Should be tested properly before doing changes */
|
|
151
160
|
var Stack = function Stack(_ref) {
|
|
152
161
|
var children = _ref.children,
|
|
153
162
|
space = _ref.space,
|
|
154
163
|
className = _ref.className;
|
|
155
164
|
var stackItems = Children.toArray(children);
|
|
156
165
|
if (stackItems.length <= 1) {
|
|
157
|
-
return
|
|
166
|
+
return jsx(Fragment, {
|
|
167
|
+
children: stackItems
|
|
168
|
+
});
|
|
158
169
|
}
|
|
159
|
-
return
|
|
160
|
-
className: className
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
170
|
+
return jsx("div", {
|
|
171
|
+
className: className,
|
|
172
|
+
children: stackItems.map(function (child, index) {
|
|
173
|
+
return index === stackItems.length - 1 ? jsx("div", {
|
|
174
|
+
children: child
|
|
175
|
+
}, index) : jsx(Box, {
|
|
176
|
+
paddingBottom: space,
|
|
177
|
+
children: child
|
|
178
|
+
}, index);
|
|
179
|
+
})
|
|
180
|
+
});
|
|
169
181
|
};
|
|
170
182
|
|
|
171
183
|
var _excluded$c = ["items", "locale", "className"];
|
|
@@ -175,20 +187,27 @@ var AuditInfo = function AuditInfo(_ref) {
|
|
|
175
187
|
className = _ref.className,
|
|
176
188
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$c);
|
|
177
189
|
var classNames = cx("ep-audit-info", className);
|
|
178
|
-
return
|
|
190
|
+
return jsx("div", _extends({
|
|
179
191
|
className: classNames
|
|
180
|
-
}, rest
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
+
}, rest, {
|
|
193
|
+
children: items.map(function (_ref2) {
|
|
194
|
+
var label = _ref2.label,
|
|
195
|
+
value = _ref2.value;
|
|
196
|
+
return jsxs(Stack, {
|
|
197
|
+
space: "small",
|
|
198
|
+
children: [jsx("div", {
|
|
199
|
+
className: "ep-audit-info-label",
|
|
200
|
+
children: label
|
|
201
|
+
}), jsx("div", {
|
|
202
|
+
children: isDate(value) || isDateString(value) ? jsx(FormatDateTime, {
|
|
203
|
+
date: value,
|
|
204
|
+
locale: locale
|
|
205
|
+
}) : jsx("span", {
|
|
206
|
+
children: value
|
|
207
|
+
})
|
|
208
|
+
})]
|
|
209
|
+
}, value.toString());
|
|
210
|
+
})
|
|
192
211
|
}));
|
|
193
212
|
};
|
|
194
213
|
|
|
@@ -211,21 +230,25 @@ var Breadcrumbs = function Breadcrumbs(_ref) {
|
|
|
211
230
|
path = _ref3.path;
|
|
212
231
|
var isLast = i === breadcrumbs.length - 1;
|
|
213
232
|
if (isLast) {
|
|
214
|
-
return
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
},
|
|
233
|
+
return jsx(BreadcrumbItem, {
|
|
234
|
+
as: "span",
|
|
235
|
+
children: title
|
|
236
|
+
}, path);
|
|
218
237
|
}
|
|
219
|
-
return
|
|
220
|
-
key: path,
|
|
238
|
+
return jsx(BreadcrumbItem, {
|
|
221
239
|
as: Link$1,
|
|
222
|
-
to: path
|
|
223
|
-
|
|
240
|
+
to: path,
|
|
241
|
+
children: title
|
|
242
|
+
}, path);
|
|
224
243
|
});
|
|
225
244
|
if (prependBreadcrumbItem) {
|
|
226
|
-
return
|
|
245
|
+
return jsx(BreadcrumbNavigation, {
|
|
246
|
+
children: [prependBreadcrumbItem].concat(breadcrumbElements)
|
|
247
|
+
});
|
|
227
248
|
}
|
|
228
|
-
return
|
|
249
|
+
return jsx(BreadcrumbNavigation, {
|
|
250
|
+
children: breadcrumbElements
|
|
251
|
+
});
|
|
229
252
|
};
|
|
230
253
|
|
|
231
254
|
var _excluded$b = ["isOpen", "children", "message", "size", "buttons", "onConfirm", "messages", "onClose", "onDismiss"];
|
|
@@ -244,19 +267,30 @@ var ConfirmModal = function ConfirmModal(_ref) {
|
|
|
244
267
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$b);
|
|
245
268
|
var childrenToRender = children ? children : message;
|
|
246
269
|
var handleDismiss = onClose ? onClose : onDismiss;
|
|
247
|
-
return
|
|
270
|
+
return jsxs(Modal, _extends({
|
|
248
271
|
size: size,
|
|
249
272
|
open: isOpen,
|
|
250
273
|
onDismiss: handleDismiss
|
|
251
|
-
}, rest
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
274
|
+
}, rest, {
|
|
275
|
+
children: [isString(childrenToRender) ? jsx(Paragraph, {
|
|
276
|
+
children: childrenToRender
|
|
277
|
+
}) : jsx(Box, {
|
|
278
|
+
paddingBottom: "medium",
|
|
279
|
+
children: childrenToRender
|
|
280
|
+
}), jsx(ButtonGroup, {
|
|
281
|
+
children: onConfirm ? jsxs(Fragment, {
|
|
282
|
+
children: [jsx(SecondaryButton, {
|
|
283
|
+
onClick: handleDismiss,
|
|
284
|
+
"data-testid": "cancel-modal-button",
|
|
285
|
+
children: messages.cancel
|
|
286
|
+
}), jsx(PrimaryButton, {
|
|
287
|
+
onClick: onConfirm,
|
|
288
|
+
"data-testid": "confirm-modal-button",
|
|
289
|
+
children: messages.confirm
|
|
290
|
+
})]
|
|
291
|
+
}) : buttons
|
|
292
|
+
})]
|
|
293
|
+
}));
|
|
260
294
|
};
|
|
261
295
|
|
|
262
296
|
var Content = function Content(_ref) {
|
|
@@ -265,9 +299,10 @@ var Content = function Content(_ref) {
|
|
|
265
299
|
className = _ref.className,
|
|
266
300
|
children = _ref.children;
|
|
267
301
|
var classList = cx(["eps-content", className]);
|
|
268
|
-
return
|
|
269
|
-
className: classList
|
|
270
|
-
|
|
302
|
+
return jsx(Component, {
|
|
303
|
+
className: classList,
|
|
304
|
+
children: children
|
|
305
|
+
});
|
|
271
306
|
};
|
|
272
307
|
|
|
273
308
|
var _environmentColors, _humanReadableEnviron;
|
|
@@ -298,27 +333,33 @@ var EnturPartnerLogoSvg = function EnturPartnerLogoSvg(_ref) {
|
|
|
298
333
|
_ref$accentColor = _ref.accentColor,
|
|
299
334
|
accentColor = _ref$accentColor === void 0 ? "#FF5959" : _ref$accentColor,
|
|
300
335
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$a);
|
|
301
|
-
return
|
|
336
|
+
return jsxs("svg", _extends({
|
|
302
337
|
width: 257,
|
|
303
338
|
height: 37,
|
|
304
339
|
viewBox: "0 0 257 37"
|
|
305
|
-
}, rest
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
340
|
+
}, rest, {
|
|
341
|
+
children: [jsx("title", {
|
|
342
|
+
children: title
|
|
343
|
+
}), jsxs("g", {
|
|
344
|
+
fill: "none",
|
|
345
|
+
fillRule: "evenodd",
|
|
346
|
+
children: [jsx("path", {
|
|
347
|
+
fill: "#FFF",
|
|
348
|
+
d: "M0 .231V25.72h18.745v-4.318H4.869v-6.163h12.31v-4.318H4.87V4.55h13.876V.231z"
|
|
349
|
+
}), jsx("path", {
|
|
350
|
+
fill: accentColor,
|
|
351
|
+
d: "M0 36.408h45.253v-4.32H0z"
|
|
352
|
+
}), jsx("path", {
|
|
353
|
+
fill: "#FFF",
|
|
354
|
+
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"
|
|
355
|
+
}), jsx("g", {
|
|
356
|
+
fill: accentColor,
|
|
357
|
+
children: jsx("path", {
|
|
358
|
+
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"
|
|
359
|
+
})
|
|
360
|
+
})]
|
|
361
|
+
})]
|
|
362
|
+
}));
|
|
322
363
|
};
|
|
323
364
|
var EnturPartnerLogo = function EnturPartnerLogo(_ref2) {
|
|
324
365
|
var _ref2$as = _ref2.as,
|
|
@@ -327,13 +368,14 @@ var EnturPartnerLogo = function EnturPartnerLogo(_ref2) {
|
|
|
327
368
|
altText = _ref2.altText,
|
|
328
369
|
environment = _ref2.environment;
|
|
329
370
|
var classList = cx(["eps-logo-wrapper", className]);
|
|
330
|
-
return
|
|
331
|
-
className: classList
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
371
|
+
return jsx(Component, {
|
|
372
|
+
className: classList,
|
|
373
|
+
children: jsx(EnturPartnerLogoSvg, {
|
|
374
|
+
title: altText,
|
|
375
|
+
className: "logo",
|
|
376
|
+
accentColor: environment !== undefined && environment !== Environment.Production ? getColorForEnvironment(environment) : undefined
|
|
377
|
+
})
|
|
378
|
+
});
|
|
337
379
|
};
|
|
338
380
|
|
|
339
381
|
var newAppVersionErrorMessage = "Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.";
|
|
@@ -375,7 +417,7 @@ var ErrorBoundary = /*#__PURE__*/function (_Component) {
|
|
|
375
417
|
error: error
|
|
376
418
|
});
|
|
377
419
|
} else if (error.name === "NotFoundError" && error.message === newAppVersionErrorMessage) {
|
|
378
|
-
return
|
|
420
|
+
return jsx(RefreshBannerInfo, {});
|
|
379
421
|
}
|
|
380
422
|
return fallback;
|
|
381
423
|
}
|
|
@@ -388,20 +430,25 @@ function RefreshBannerInfo() {
|
|
|
388
430
|
// Taken from ./app-shell/src/storage.ts
|
|
389
431
|
var language = localStorage.getItem(LANGUAGE_STORAGE_KEY);
|
|
390
432
|
var isNorwegian = language === "nb" || language === "nb-NO";
|
|
391
|
-
return
|
|
392
|
-
maxWidth: "large"
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
433
|
+
return jsx(Box, {
|
|
434
|
+
maxWidth: "large",
|
|
435
|
+
children: jsxs(BannerAlertBox, {
|
|
436
|
+
variant: "info",
|
|
437
|
+
title: isNorwegian ? "En ny versjon av nettsiden er tilgjengelig." : "A new version of the website is available.",
|
|
438
|
+
children: [jsx(Box, {
|
|
439
|
+
paddingBottom: "medium",
|
|
440
|
+
children: jsx(Paragraph, {
|
|
441
|
+
margin: "none",
|
|
442
|
+
children: isNorwegian ? "Vennligst oppdater." : "Please refresh."
|
|
443
|
+
})
|
|
444
|
+
}), jsx(PrimaryButton, {
|
|
445
|
+
onClick: function onClick() {
|
|
446
|
+
return window.location.reload();
|
|
447
|
+
},
|
|
448
|
+
children: isNorwegian ? "Oppdater" : "Refresh"
|
|
449
|
+
})]
|
|
450
|
+
})
|
|
451
|
+
});
|
|
405
452
|
}
|
|
406
453
|
|
|
407
454
|
var _excluded$9 = ["title", "inputComponent", "languages", "values", "onChange", "name", "variant", "feedback"];
|
|
@@ -424,33 +471,34 @@ var ExpandableMultiLanguageInput = function ExpandableMultiLanguageInput(_ref) {
|
|
|
424
471
|
}
|
|
425
472
|
onChange(changes);
|
|
426
473
|
};
|
|
427
|
-
return
|
|
474
|
+
return jsx(ExpandablePanel, {
|
|
428
475
|
title: title,
|
|
429
476
|
defaultOpen: true,
|
|
430
477
|
contentStyle: {
|
|
431
478
|
padding: "4px 4px 4px 4px",
|
|
432
479
|
marginTop: "16px",
|
|
433
480
|
marginBottom: "16px"
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
481
|
+
},
|
|
482
|
+
children: jsx(Stack, {
|
|
483
|
+
space: "medium",
|
|
484
|
+
children: languages.map(function (_ref2) {
|
|
485
|
+
var langKey = _ref2.value,
|
|
486
|
+
label = _ref2.label,
|
|
487
|
+
required = _ref2.required;
|
|
488
|
+
return jsx(InputComponent, _extends({
|
|
489
|
+
"data-testid": "multi-lang-input-" + name + "-" + langKey,
|
|
490
|
+
label: required ? label + "*" : label,
|
|
491
|
+
variant: variant == null ? void 0 : variant(langKey),
|
|
492
|
+
feedback: feedback == null ? void 0 : feedback(langKey),
|
|
493
|
+
name: name,
|
|
494
|
+
onChange: function onChange(e) {
|
|
495
|
+
handleOnChange(langKey, e.target.value);
|
|
496
|
+
},
|
|
497
|
+
value: values[langKey] || ""
|
|
498
|
+
}, rest), title + langKey);
|
|
499
|
+
})
|
|
500
|
+
})
|
|
501
|
+
});
|
|
454
502
|
};
|
|
455
503
|
|
|
456
504
|
/**
|
|
@@ -482,7 +530,9 @@ var FeatureToggle = function FeatureToggle(_ref) {
|
|
|
482
530
|
flag = _ref.flag;
|
|
483
531
|
var feature = useFeatureToggle(flag);
|
|
484
532
|
if (feature) {
|
|
485
|
-
return
|
|
533
|
+
return jsx(Fragment, {
|
|
534
|
+
children: children
|
|
535
|
+
});
|
|
486
536
|
}
|
|
487
537
|
return null;
|
|
488
538
|
};
|
|
@@ -498,7 +548,9 @@ var FormatCurrencyAmount = function FormatCurrencyAmount(_ref) {
|
|
|
498
548
|
maximumFractionDigits: 2,
|
|
499
549
|
minimumFractionDigits: 2
|
|
500
550
|
}).format(parsedAmount);
|
|
501
|
-
return
|
|
551
|
+
return jsx(Component, _extends({}, rest, {
|
|
552
|
+
children: formattedAmount
|
|
553
|
+
}));
|
|
502
554
|
};
|
|
503
555
|
|
|
504
556
|
var _excluded$7 = ["language", "options", "className", "onChange"];
|
|
@@ -509,28 +561,34 @@ var LanguageSelect = function LanguageSelect(_ref) {
|
|
|
509
561
|
_onChange = _ref.onChange,
|
|
510
562
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$7);
|
|
511
563
|
var classNames = cx("eps-language-select", className);
|
|
512
|
-
return
|
|
513
|
-
className: classNames
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
564
|
+
return jsx("div", _extends({}, rest, {
|
|
565
|
+
className: classNames,
|
|
566
|
+
children: jsx(SegmentedControl, {
|
|
567
|
+
onChange: function onChange(language) {
|
|
568
|
+
assertIsDefined(language);
|
|
569
|
+
if (typeof language === "string") {
|
|
570
|
+
_onChange(language);
|
|
571
|
+
}
|
|
572
|
+
},
|
|
573
|
+
selectedValue: language,
|
|
574
|
+
children: options.map(function (option) {
|
|
575
|
+
return jsxs(SegmentedChoice, {
|
|
576
|
+
value: option.value,
|
|
577
|
+
children: [option.label, option.required && jsx("span", {
|
|
578
|
+
className: "asterisk-margin",
|
|
579
|
+
children: "*"
|
|
580
|
+
})]
|
|
581
|
+
}, option.value);
|
|
582
|
+
})
|
|
583
|
+
})
|
|
584
|
+
}));
|
|
528
585
|
};
|
|
529
586
|
|
|
530
587
|
var Link = function Link(props) {
|
|
531
|
-
return
|
|
532
|
-
as: Link$1
|
|
533
|
-
|
|
588
|
+
return jsx(Link$2, _extends({}, props, {
|
|
589
|
+
as: Link$1,
|
|
590
|
+
children: props.children
|
|
591
|
+
}));
|
|
534
592
|
};
|
|
535
593
|
|
|
536
594
|
var _excluded$6 = ["children", "className"];
|
|
@@ -538,10 +596,11 @@ var LinkButton = function LinkButton(_ref) {
|
|
|
538
596
|
var children = _ref.children,
|
|
539
597
|
className = _ref.className,
|
|
540
598
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$6);
|
|
541
|
-
return
|
|
599
|
+
return jsx(Link$2, _extends({}, rest, {
|
|
542
600
|
as: "button",
|
|
543
|
-
className: cx("eps-link-button", className)
|
|
544
|
-
|
|
601
|
+
className: cx("eps-link-button", className),
|
|
602
|
+
children: children
|
|
603
|
+
}));
|
|
545
604
|
};
|
|
546
605
|
|
|
547
606
|
var Menu = function Menu(_ref) {
|
|
@@ -550,9 +609,10 @@ var Menu = function Menu(_ref) {
|
|
|
550
609
|
className = _ref.className,
|
|
551
610
|
children = _ref.children;
|
|
552
611
|
var classList = cx(["eds-contrast", "eps-menu", className]);
|
|
553
|
-
return
|
|
554
|
-
className: classList
|
|
555
|
-
|
|
612
|
+
return jsx(Component, {
|
|
613
|
+
className: classList,
|
|
614
|
+
children: children
|
|
615
|
+
});
|
|
556
616
|
};
|
|
557
617
|
|
|
558
618
|
var _excluded$5 = ["className", "inputComponent", "alertLabel", "alertLevel", "name", "languages", "values", "onChange", "defaultLanguage", "label", "onBlur"];
|
|
@@ -603,41 +663,47 @@ var MultiLanguageInput = function MultiLanguageInput(_ref) {
|
|
|
603
663
|
};
|
|
604
664
|
return (
|
|
605
665
|
// biome-ignore lint/a11y/noStaticElementInteractions: Legacy component
|
|
606
|
-
|
|
666
|
+
jsx("div", {
|
|
607
667
|
className: classNames,
|
|
608
668
|
// biome-ignore lint/a11y/noNoninteractiveTabindex: Legacy component
|
|
609
669
|
tabIndex: 0,
|
|
610
670
|
onBlur: handleOnBlur,
|
|
611
|
-
"data-testid": "multi-lang-input-" + name
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
671
|
+
"data-testid": "multi-lang-input-" + name,
|
|
672
|
+
children: jsxs(Stack, {
|
|
673
|
+
space: "extraSmall",
|
|
674
|
+
children: [jsx(LanguageSelect, {
|
|
675
|
+
language: language,
|
|
676
|
+
options: languages,
|
|
677
|
+
onChange: function onChange(lang) {
|
|
678
|
+
return handleLanguageChange(lang);
|
|
679
|
+
}
|
|
680
|
+
}), jsx(InputComponent, _extends({
|
|
681
|
+
label: label,
|
|
682
|
+
variant: alertLevel,
|
|
683
|
+
feedback: alertLabel,
|
|
684
|
+
name: name,
|
|
685
|
+
className: "language-item",
|
|
686
|
+
onChange: function onChange(e) {
|
|
687
|
+
return handleOnChange(e.target.value);
|
|
688
|
+
},
|
|
689
|
+
value: currentValue || ""
|
|
690
|
+
}, rest))]
|
|
691
|
+
})
|
|
692
|
+
})
|
|
631
693
|
);
|
|
632
694
|
};
|
|
633
695
|
|
|
634
696
|
var _excluded$4 = ["label", "organisations", "onChange", "selectedOrganisationId"];
|
|
697
|
+
function isInShadowDom(el) {
|
|
698
|
+
return (el == null ? void 0 : el.getRootNode()) instanceof ShadowRoot;
|
|
699
|
+
}
|
|
635
700
|
var OrganisationDropDown = function OrganisationDropDown(_ref) {
|
|
636
701
|
var label = _ref.label,
|
|
637
702
|
organisations = _ref.organisations,
|
|
638
703
|
handleChange = _ref.onChange,
|
|
639
704
|
selectedOrganisationId = _ref.selectedOrganisationId,
|
|
640
705
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
706
|
+
var wrapperRef = useRef(null);
|
|
641
707
|
var _useState = useState(),
|
|
642
708
|
selectedOrganisation = _useState[0],
|
|
643
709
|
setSelectedOrganisation = _useState[1];
|
|
@@ -646,27 +712,53 @@ var OrganisationDropDown = function OrganisationDropDown(_ref) {
|
|
|
646
712
|
return org.organisationId === selectedOrganisationId;
|
|
647
713
|
}));
|
|
648
714
|
}, [selectedOrganisationId, organisations]);
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
715
|
+
var handleMouseDown = function handleMouseDown(e) {
|
|
716
|
+
if (!isInShadowDom(wrapperRef.current)) return;
|
|
717
|
+
// In shadow DOM, mouse events are retargeted at the shadow boundary,
|
|
718
|
+
// causing downshift's window-level outside-click detection to misidentify
|
|
719
|
+
// clicks within the dropdown as outside clicks. Stop propagation to prevent
|
|
720
|
+
// the retargeted event from reaching window-level listeners.
|
|
721
|
+
e.nativeEvent.stopPropagation();
|
|
722
|
+
// Prevent default on non-input elements to stop the browser from moving
|
|
723
|
+
// focus away from the combobox input, which would trigger a blur that
|
|
724
|
+
// closes the dropdown before the click event can register a selection.
|
|
725
|
+
if (e.target.tagName !== "INPUT") {
|
|
726
|
+
e.preventDefault();
|
|
727
|
+
}
|
|
728
|
+
};
|
|
729
|
+
var handleMouseUp = function handleMouseUp(e) {
|
|
730
|
+
if (!isInShadowDom(wrapperRef.current)) return;
|
|
731
|
+
e.nativeEvent.stopPropagation();
|
|
732
|
+
};
|
|
733
|
+
return (
|
|
734
|
+
// biome-ignore lint/a11y/noStaticElementInteractions: Temporary fix. See comment above. Will be fixed in design system level in the future.
|
|
735
|
+
jsx("div", {
|
|
736
|
+
ref: wrapperRef,
|
|
737
|
+
onMouseDown: handleMouseDown,
|
|
738
|
+
onMouseUp: handleMouseUp,
|
|
739
|
+
children: jsx(SearchableDropdown, _extends({
|
|
740
|
+
label: label,
|
|
741
|
+
items: [].concat(organisations.sort(function (a, b) {
|
|
742
|
+
return a.tradingName.localeCompare(b.tradingName, "nb");
|
|
743
|
+
}).map(function (organisation) {
|
|
744
|
+
return {
|
|
745
|
+
value: organisation.organisationId,
|
|
746
|
+
label: organisation.tradingName
|
|
747
|
+
};
|
|
748
|
+
})),
|
|
749
|
+
selectedItem: selectedOrganisation ? {
|
|
750
|
+
value: selectedOrganisation.organisationId,
|
|
751
|
+
label: selectedOrganisation.tradingName
|
|
752
|
+
} : null,
|
|
753
|
+
onChange: function onChange(selectedValue) {
|
|
754
|
+
if (selectedValue) {
|
|
755
|
+
handleChange(selectedValue.value);
|
|
756
|
+
}
|
|
757
|
+
},
|
|
758
|
+
clearable: false
|
|
759
|
+
}, rest))
|
|
760
|
+
})
|
|
761
|
+
);
|
|
670
762
|
};
|
|
671
763
|
|
|
672
764
|
var Pager = function Pager(_ref) {
|
|
@@ -675,7 +767,7 @@ var Pager = function Pager(_ref) {
|
|
|
675
767
|
_onPageChange = _ref.onPageChange,
|
|
676
768
|
currentPage = _ref.currentPage;
|
|
677
769
|
var pageCount = Math.ceil(collectionSize / pageSize);
|
|
678
|
-
return
|
|
770
|
+
return jsx(Pagination, {
|
|
679
771
|
pageCount: pageCount,
|
|
680
772
|
currentPage: currentPage,
|
|
681
773
|
onPageChange: function onPageChange(page) {
|
|
@@ -737,7 +829,9 @@ var PermissionCheck = function PermissionCheck(_ref) {
|
|
|
737
829
|
var allIsAllowed = hasAllPermissions(all, permissions);
|
|
738
830
|
var oneOfIsAllowed = hasOneOfPermissions(oneOf, permissions);
|
|
739
831
|
var allowed = allIsAllowed && oneOfIsAllowed;
|
|
740
|
-
return
|
|
832
|
+
return jsx(Fragment, {
|
|
833
|
+
children: allowed ? children : fallback
|
|
834
|
+
});
|
|
741
835
|
};
|
|
742
836
|
|
|
743
837
|
var _excluded$3 = ["children", "shouldBlockNavigation"];
|
|
@@ -751,7 +845,7 @@ var RouteLeavingGuard = function RouteLeavingGuard(_ref) {
|
|
|
751
845
|
nextLocation = _ref2.nextLocation;
|
|
752
846
|
return currentLocation.pathname !== nextLocation.pathname && shouldBlockNavigation(nextLocation);
|
|
753
847
|
});
|
|
754
|
-
return
|
|
848
|
+
return jsx(ConfirmModal, _extends({
|
|
755
849
|
onDismiss: function onDismiss() {
|
|
756
850
|
if (blocker.state === "blocked") {
|
|
757
851
|
blocker.reset();
|
|
@@ -763,7 +857,9 @@ var RouteLeavingGuard = function RouteLeavingGuard(_ref) {
|
|
|
763
857
|
blocker.proceed();
|
|
764
858
|
}
|
|
765
859
|
}
|
|
766
|
-
}, rest
|
|
860
|
+
}, rest, {
|
|
861
|
+
children: children
|
|
862
|
+
}));
|
|
767
863
|
};
|
|
768
864
|
|
|
769
865
|
var StatusLabel = function StatusLabel(_ref) {
|
|
@@ -781,11 +877,14 @@ var StatusLabel = function StatusLabel(_ref) {
|
|
|
781
877
|
var statusLabelClassNames = cx("eps-status-label", {
|
|
782
878
|
center: center
|
|
783
879
|
});
|
|
784
|
-
return
|
|
785
|
-
className: statusLabelClassNames
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
880
|
+
return jsxs("div", {
|
|
881
|
+
className: statusLabelClassNames,
|
|
882
|
+
children: [showBullet && jsx("div", {
|
|
883
|
+
className: bulletClassNames
|
|
884
|
+
}), jsx("div", {
|
|
885
|
+
children: label
|
|
886
|
+
})]
|
|
887
|
+
});
|
|
789
888
|
};
|
|
790
889
|
|
|
791
890
|
var _excluded$2 = ["as", "children", "fontSize", "color", "lineHeight", "fontWeight", "className"];
|
|
@@ -804,11 +903,13 @@ var Text = function Text(_ref) {
|
|
|
804
903
|
lineHeight && classes.push.apply(classes, responsiveProp("eps-line-height-", lineHeight));
|
|
805
904
|
fontWeight && classes.push("eps-font-weight-" + fontWeight);
|
|
806
905
|
var classList = cx(classes, className);
|
|
807
|
-
return
|
|
906
|
+
return jsx(Box, _extends({
|
|
808
907
|
as: component,
|
|
809
908
|
color: color,
|
|
810
909
|
className: classList
|
|
811
|
-
}, rest
|
|
910
|
+
}, rest, {
|
|
911
|
+
children: children
|
|
912
|
+
}));
|
|
812
913
|
};
|
|
813
914
|
|
|
814
915
|
var _excluded$1 = ["children", "className"];
|
|
@@ -816,11 +917,12 @@ var Unbutton = function Unbutton(_ref) {
|
|
|
816
917
|
var children = _ref.children,
|
|
817
918
|
className = _ref.className,
|
|
818
919
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
819
|
-
return
|
|
920
|
+
return jsx(Button, _extends({
|
|
820
921
|
variant: "primary"
|
|
821
922
|
}, rest, {
|
|
822
|
-
className: cx("eps-unbutton", className)
|
|
823
|
-
|
|
923
|
+
className: cx("eps-unbutton", className),
|
|
924
|
+
children: children
|
|
925
|
+
}));
|
|
824
926
|
};
|
|
825
927
|
|
|
826
928
|
/*global EventListener WindowEventHandlers*/
|
|
@@ -847,7 +949,7 @@ function useEventListener(eventName, handler, element) {
|
|
|
847
949
|
}
|
|
848
950
|
|
|
849
951
|
var CustomOverflowMenuItem = function CustomOverflowMenuItem(props) {
|
|
850
|
-
return
|
|
952
|
+
return jsx("button", _extends({
|
|
851
953
|
className: cx(props.className, "eps-overflow-menu__item"),
|
|
852
954
|
role: "menuitem"
|
|
853
955
|
}, props));
|
|
@@ -856,19 +958,21 @@ var CustomOverflowMenuItem = function CustomOverflowMenuItem(props) {
|
|
|
856
958
|
var CookieSettingsMenuItem = function CookieSettingsMenuItem(_ref) {
|
|
857
959
|
var locale = _ref.locale,
|
|
858
960
|
onClick = _ref.onClick;
|
|
859
|
-
return
|
|
961
|
+
return jsxs(CustomOverflowMenuItem, {
|
|
860
962
|
onClick: onClick,
|
|
861
|
-
className: "eps-overflow-menu__item"
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
963
|
+
className: "eps-overflow-menu__item",
|
|
964
|
+
children: [jsx("span", {
|
|
965
|
+
"aria-hidden": true,
|
|
966
|
+
children: jsx(CookieIcon, {
|
|
967
|
+
size: "1rem",
|
|
968
|
+
inline: true
|
|
969
|
+
})
|
|
970
|
+
}), locale === "en-GB" ? "Cookie settings" : "Cookieinstillinger"]
|
|
971
|
+
});
|
|
868
972
|
};
|
|
869
973
|
|
|
870
974
|
function useOutsideClick(ref, buttonRef, handler) {
|
|
871
|
-
|
|
975
|
+
useEffect(function () {
|
|
872
976
|
var listener = function listener(event) {
|
|
873
977
|
if (elementContainsEventTarget(ref.current, event) || elementContainsEventTarget(buttonRef.current, event)) {
|
|
874
978
|
return;
|
|
@@ -915,113 +1019,135 @@ var CustomOverflowMenu = function CustomOverflowMenu(_ref) {
|
|
|
915
1019
|
var overflowItemsClasses = cx("eps-overflow-menu__group", {
|
|
916
1020
|
"eps-overflow-menu__group--open": open
|
|
917
1021
|
});
|
|
918
|
-
var overflowContentRef =
|
|
919
|
-
var overflowMenuTriggerRef =
|
|
1022
|
+
var overflowContentRef = useRef(null);
|
|
1023
|
+
var overflowMenuTriggerRef = useRef(null);
|
|
920
1024
|
useOutsideClick(overflowContentRef, overflowMenuTriggerRef, function () {
|
|
921
1025
|
return onOpenChange(false);
|
|
922
1026
|
});
|
|
923
|
-
return
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
1027
|
+
return jsxs("div", {
|
|
1028
|
+
children: [jsx(SecondaryButton, _extends({
|
|
1029
|
+
className: cx("eps-overflow-menu__button", className),
|
|
1030
|
+
onClick: function onClick() {
|
|
1031
|
+
return onOpenChange(!open);
|
|
1032
|
+
},
|
|
1033
|
+
"aria-haspopup": true,
|
|
1034
|
+
"aria-expanded": open,
|
|
1035
|
+
ref: overflowMenuTriggerRef
|
|
1036
|
+
}, rest, {
|
|
1037
|
+
children: jsxs("div", {
|
|
1038
|
+
className: "eps-overflow-menu__button-contents",
|
|
1039
|
+
children: [jsx("span", {
|
|
1040
|
+
className: "eds-overflow-menu__user-icon",
|
|
1041
|
+
children: jsx(UserIcon, {
|
|
1042
|
+
inline: true
|
|
1043
|
+
})
|
|
1044
|
+
}), jsxs(Heading6, {
|
|
1045
|
+
margin: "none",
|
|
1046
|
+
as: "span",
|
|
1047
|
+
children: [userName, environment !== undefined && environment !== Environment.Production && jsxs("span", {
|
|
1048
|
+
style: {
|
|
1049
|
+
color: getColorForEnvironment(environment)
|
|
1050
|
+
},
|
|
1051
|
+
children: [" ", "(", getHumanReadableEnvironment(environment), ")"]
|
|
1052
|
+
})]
|
|
1053
|
+
}), jsx("span", {
|
|
1054
|
+
className: "eps-arrow-icon",
|
|
1055
|
+
children: jsx(DownArrowIcon, {
|
|
1056
|
+
inline: true
|
|
1057
|
+
})
|
|
1058
|
+
})]
|
|
1059
|
+
})
|
|
1060
|
+
})), open && jsx("div", {
|
|
1061
|
+
className: overflowItemsClasses,
|
|
1062
|
+
role: "menu",
|
|
1063
|
+
ref: overflowContentRef,
|
|
1064
|
+
children: children
|
|
1065
|
+
})]
|
|
1066
|
+
});
|
|
953
1067
|
};
|
|
954
1068
|
|
|
955
1069
|
var LocaleSwitchMenuItem = function LocaleSwitchMenuItem(_ref) {
|
|
956
1070
|
var locale = _ref.locale,
|
|
957
1071
|
onLocaleChange = _ref.onLocaleChange;
|
|
958
|
-
return
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
},
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
1072
|
+
return jsx(Fragment, {
|
|
1073
|
+
children: locale === "en-GB" ? jsxs(CustomOverflowMenuItem, {
|
|
1074
|
+
onClick: function onClick() {
|
|
1075
|
+
onLocaleChange("nb-NO");
|
|
1076
|
+
},
|
|
1077
|
+
className: "eps-overflow-menu__item",
|
|
1078
|
+
children: [jsx("span", {
|
|
1079
|
+
"aria-hidden": true,
|
|
1080
|
+
className: "eps-overflow-menu__icon-margin",
|
|
1081
|
+
children: jsx(NorwayIcon, {
|
|
1082
|
+
size: "1rem",
|
|
1083
|
+
inline: true
|
|
1084
|
+
})
|
|
1085
|
+
}), "Bytt til norsk"]
|
|
1086
|
+
}) : jsxs(CustomOverflowMenuItem, {
|
|
1087
|
+
onClick: function onClick() {
|
|
1088
|
+
onLocaleChange("en-GB");
|
|
1089
|
+
},
|
|
1090
|
+
className: "eps-overflow-menu__item",
|
|
1091
|
+
children: [jsx("span", {
|
|
1092
|
+
"aria-hidden": true,
|
|
1093
|
+
className: "eps-overflow-menu__icon-margin",
|
|
1094
|
+
children: jsx(UKIcon, {
|
|
1095
|
+
size: "1rem",
|
|
1096
|
+
inline: true
|
|
1097
|
+
})
|
|
1098
|
+
}), "Switch to English"]
|
|
1099
|
+
})
|
|
1100
|
+
});
|
|
981
1101
|
};
|
|
982
1102
|
|
|
983
1103
|
var LogOutMenuItem = function LogOutMenuItem(_ref) {
|
|
984
1104
|
var onClick = _ref.onClick,
|
|
985
1105
|
locale = _ref.locale;
|
|
986
|
-
return
|
|
1106
|
+
return jsxs(CustomOverflowMenuItem, {
|
|
987
1107
|
onClick: onClick,
|
|
988
1108
|
"data-testid": "user-menu-logout",
|
|
989
|
-
className: "eps-overflow-menu__item"
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
1109
|
+
className: "eps-overflow-menu__item",
|
|
1110
|
+
children: [jsx("span", {
|
|
1111
|
+
"aria-hidden": true,
|
|
1112
|
+
children: jsx(LogOutIcon, {
|
|
1113
|
+
size: "1rem",
|
|
1114
|
+
inline: true
|
|
1115
|
+
})
|
|
1116
|
+
}), locale === "en-GB" ? "Log out " : "Logg ut"]
|
|
1117
|
+
});
|
|
996
1118
|
};
|
|
997
1119
|
|
|
998
1120
|
var UserMenuItem = function UserMenuItem(_ref) {
|
|
999
1121
|
var locale = _ref.locale,
|
|
1000
1122
|
onClick = _ref.onClick;
|
|
1001
|
-
return
|
|
1123
|
+
return jsxs(CustomOverflowMenuItem, {
|
|
1002
1124
|
onClick: onClick,
|
|
1003
|
-
className: "eps-overflow-menu__item"
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1125
|
+
className: "eps-overflow-menu__item",
|
|
1126
|
+
children: [jsx("span", {
|
|
1127
|
+
"aria-hidden": true,
|
|
1128
|
+
children: jsx(UserIcon, {
|
|
1129
|
+
size: "1rem",
|
|
1130
|
+
inline: true
|
|
1131
|
+
})
|
|
1132
|
+
}), locale === "en-GB" ? "My profile" : "Min profil"]
|
|
1133
|
+
});
|
|
1010
1134
|
};
|
|
1011
1135
|
|
|
1012
1136
|
var VersionMenuItem = function VersionMenuItem(_ref) {
|
|
1013
1137
|
var locale = _ref.locale,
|
|
1014
1138
|
onClick = _ref.onClick;
|
|
1015
|
-
return
|
|
1139
|
+
return jsxs(CustomOverflowMenuItem, {
|
|
1016
1140
|
onClick: onClick,
|
|
1017
|
-
className: "eps-overflow-menu__item"
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1141
|
+
className: "eps-overflow-menu__item",
|
|
1142
|
+
children: [jsx("span", {
|
|
1143
|
+
"aria-hidden": true,
|
|
1144
|
+
children: jsx(ChannelsIcon, {
|
|
1145
|
+
className: "eps-version-icon",
|
|
1146
|
+
size: "1rem",
|
|
1147
|
+
inline: true
|
|
1148
|
+
})
|
|
1149
|
+
}), locale === "en-GB" ? "Version" : "Versjon"]
|
|
1150
|
+
});
|
|
1025
1151
|
};
|
|
1026
1152
|
|
|
1027
1153
|
var UserMenu = function UserMenu(_ref) {
|
|
@@ -1041,47 +1167,50 @@ var UserMenu = function UserMenu(_ref) {
|
|
|
1041
1167
|
var _useState = useState(false),
|
|
1042
1168
|
open = _useState[0],
|
|
1043
1169
|
setOpen = _useState[1];
|
|
1044
|
-
return
|
|
1045
|
-
id: "eps-user-menu"
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1170
|
+
return jsx("div", {
|
|
1171
|
+
id: "eps-user-menu",
|
|
1172
|
+
children: jsx(CustomOverflowMenu, {
|
|
1173
|
+
open: open,
|
|
1174
|
+
onOpenChange: setOpen,
|
|
1175
|
+
className: cx(["eps-user-menu__trigger-button", className]),
|
|
1176
|
+
userName: userName,
|
|
1177
|
+
environment: environment,
|
|
1178
|
+
children: jsxs("div", {
|
|
1179
|
+
id: "eps-overflow-menu",
|
|
1180
|
+
children: [jsx(LocaleSwitchMenuItem, {
|
|
1181
|
+
locale: locale,
|
|
1182
|
+
onLocaleChange: function onLocaleChange(newLocale) {
|
|
1183
|
+
_onLocaleChange(newLocale);
|
|
1184
|
+
setOpen(false);
|
|
1185
|
+
}
|
|
1186
|
+
}), showVersionItem && jsx(VersionMenuItem, {
|
|
1187
|
+
locale: locale,
|
|
1188
|
+
onClick: function onClick() {
|
|
1189
|
+
onVersionItemClick == null || onVersionItemClick();
|
|
1190
|
+
setOpen(false);
|
|
1191
|
+
}
|
|
1192
|
+
}), showMyProfileItem && jsx(UserMenuItem, {
|
|
1193
|
+
locale: locale,
|
|
1194
|
+
onClick: function onClick() {
|
|
1195
|
+
onNavigateToMyProfile();
|
|
1196
|
+
setOpen(false);
|
|
1197
|
+
}
|
|
1198
|
+
}), showCookieSettingsItem && jsx(CookieSettingsMenuItem, {
|
|
1199
|
+
locale: locale,
|
|
1200
|
+
onClick: function onClick() {
|
|
1201
|
+
onCookieSettingsOpen();
|
|
1202
|
+
setOpen(false);
|
|
1203
|
+
}
|
|
1204
|
+
}), jsx(LogOutMenuItem, {
|
|
1205
|
+
locale: locale,
|
|
1206
|
+
onClick: function onClick() {
|
|
1207
|
+
onLogout();
|
|
1208
|
+
setOpen(false);
|
|
1209
|
+
}
|
|
1210
|
+
})]
|
|
1211
|
+
})
|
|
1212
|
+
})
|
|
1213
|
+
});
|
|
1085
1214
|
};
|
|
1086
1215
|
|
|
1087
1216
|
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, useDocumentTitle, useEventListener, useFeatureToggle };
|