@entur-partner/common 11.0.0 → 11.1.0
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/Pager.d.ts +3 -0
- package/dist/Stack.d.ts +2 -2
- package/dist/Text.d.ts +3 -4
- package/dist/common.cjs.development.js +480 -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 +470 -338
- package/dist/common.esm.js.map +1 -1
- package/dist/styles.css +40 -40
- 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,36 +712,65 @@ 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
|
|
|
764
|
+
/**
|
|
765
|
+
* @deprecated use Pagination directly instead
|
|
766
|
+
*/
|
|
672
767
|
var Pager = function Pager(_ref) {
|
|
673
768
|
var collectionSize = _ref.collectionSize,
|
|
674
769
|
pageSize = _ref.pageSize,
|
|
675
770
|
_onPageChange = _ref.onPageChange,
|
|
676
771
|
currentPage = _ref.currentPage;
|
|
677
772
|
var pageCount = Math.ceil(collectionSize / pageSize);
|
|
678
|
-
return
|
|
773
|
+
return jsx(Pagination, {
|
|
679
774
|
pageCount: pageCount,
|
|
680
775
|
currentPage: currentPage,
|
|
681
776
|
onPageChange: function onPageChange(page) {
|
|
@@ -737,7 +832,9 @@ var PermissionCheck = function PermissionCheck(_ref) {
|
|
|
737
832
|
var allIsAllowed = hasAllPermissions(all, permissions);
|
|
738
833
|
var oneOfIsAllowed = hasOneOfPermissions(oneOf, permissions);
|
|
739
834
|
var allowed = allIsAllowed && oneOfIsAllowed;
|
|
740
|
-
return
|
|
835
|
+
return jsx(Fragment, {
|
|
836
|
+
children: allowed ? children : fallback
|
|
837
|
+
});
|
|
741
838
|
};
|
|
742
839
|
|
|
743
840
|
var _excluded$3 = ["children", "shouldBlockNavigation"];
|
|
@@ -751,7 +848,7 @@ var RouteLeavingGuard = function RouteLeavingGuard(_ref) {
|
|
|
751
848
|
nextLocation = _ref2.nextLocation;
|
|
752
849
|
return currentLocation.pathname !== nextLocation.pathname && shouldBlockNavigation(nextLocation);
|
|
753
850
|
});
|
|
754
|
-
return
|
|
851
|
+
return jsx(ConfirmModal, _extends({
|
|
755
852
|
onDismiss: function onDismiss() {
|
|
756
853
|
if (blocker.state === "blocked") {
|
|
757
854
|
blocker.reset();
|
|
@@ -763,7 +860,9 @@ var RouteLeavingGuard = function RouteLeavingGuard(_ref) {
|
|
|
763
860
|
blocker.proceed();
|
|
764
861
|
}
|
|
765
862
|
}
|
|
766
|
-
}, rest
|
|
863
|
+
}, rest, {
|
|
864
|
+
children: children
|
|
865
|
+
}));
|
|
767
866
|
};
|
|
768
867
|
|
|
769
868
|
var StatusLabel = function StatusLabel(_ref) {
|
|
@@ -781,11 +880,14 @@ var StatusLabel = function StatusLabel(_ref) {
|
|
|
781
880
|
var statusLabelClassNames = cx("eps-status-label", {
|
|
782
881
|
center: center
|
|
783
882
|
});
|
|
784
|
-
return
|
|
785
|
-
className: statusLabelClassNames
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
883
|
+
return jsxs("div", {
|
|
884
|
+
className: statusLabelClassNames,
|
|
885
|
+
children: [showBullet && jsx("div", {
|
|
886
|
+
className: bulletClassNames
|
|
887
|
+
}), jsx("div", {
|
|
888
|
+
children: label
|
|
889
|
+
})]
|
|
890
|
+
});
|
|
789
891
|
};
|
|
790
892
|
|
|
791
893
|
var _excluded$2 = ["as", "children", "fontSize", "color", "lineHeight", "fontWeight", "className"];
|
|
@@ -804,11 +906,13 @@ var Text = function Text(_ref) {
|
|
|
804
906
|
lineHeight && classes.push.apply(classes, responsiveProp("eps-line-height-", lineHeight));
|
|
805
907
|
fontWeight && classes.push("eps-font-weight-" + fontWeight);
|
|
806
908
|
var classList = cx(classes, className);
|
|
807
|
-
return
|
|
909
|
+
return jsx(Box, _extends({
|
|
808
910
|
as: component,
|
|
809
911
|
color: color,
|
|
810
912
|
className: classList
|
|
811
|
-
}, rest
|
|
913
|
+
}, rest, {
|
|
914
|
+
children: children
|
|
915
|
+
}));
|
|
812
916
|
};
|
|
813
917
|
|
|
814
918
|
var _excluded$1 = ["children", "className"];
|
|
@@ -816,11 +920,12 @@ var Unbutton = function Unbutton(_ref) {
|
|
|
816
920
|
var children = _ref.children,
|
|
817
921
|
className = _ref.className,
|
|
818
922
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
819
|
-
return
|
|
923
|
+
return jsx(Button, _extends({
|
|
820
924
|
variant: "primary"
|
|
821
925
|
}, rest, {
|
|
822
|
-
className: cx("eps-unbutton", className)
|
|
823
|
-
|
|
926
|
+
className: cx("eps-unbutton", className),
|
|
927
|
+
children: children
|
|
928
|
+
}));
|
|
824
929
|
};
|
|
825
930
|
|
|
826
931
|
/*global EventListener WindowEventHandlers*/
|
|
@@ -847,7 +952,7 @@ function useEventListener(eventName, handler, element) {
|
|
|
847
952
|
}
|
|
848
953
|
|
|
849
954
|
var CustomOverflowMenuItem = function CustomOverflowMenuItem(props) {
|
|
850
|
-
return
|
|
955
|
+
return jsx("button", _extends({
|
|
851
956
|
className: cx(props.className, "eps-overflow-menu__item"),
|
|
852
957
|
role: "menuitem"
|
|
853
958
|
}, props));
|
|
@@ -856,19 +961,21 @@ var CustomOverflowMenuItem = function CustomOverflowMenuItem(props) {
|
|
|
856
961
|
var CookieSettingsMenuItem = function CookieSettingsMenuItem(_ref) {
|
|
857
962
|
var locale = _ref.locale,
|
|
858
963
|
onClick = _ref.onClick;
|
|
859
|
-
return
|
|
964
|
+
return jsxs(CustomOverflowMenuItem, {
|
|
860
965
|
onClick: onClick,
|
|
861
|
-
className: "eps-overflow-menu__item"
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
966
|
+
className: "eps-overflow-menu__item",
|
|
967
|
+
children: [jsx("span", {
|
|
968
|
+
"aria-hidden": true,
|
|
969
|
+
children: jsx(CookieIcon, {
|
|
970
|
+
size: "1rem",
|
|
971
|
+
inline: true
|
|
972
|
+
})
|
|
973
|
+
}), locale === "en-GB" ? "Cookie settings" : "Cookieinstillinger"]
|
|
974
|
+
});
|
|
868
975
|
};
|
|
869
976
|
|
|
870
977
|
function useOutsideClick(ref, buttonRef, handler) {
|
|
871
|
-
|
|
978
|
+
useEffect(function () {
|
|
872
979
|
var listener = function listener(event) {
|
|
873
980
|
if (elementContainsEventTarget(ref.current, event) || elementContainsEventTarget(buttonRef.current, event)) {
|
|
874
981
|
return;
|
|
@@ -915,113 +1022,135 @@ var CustomOverflowMenu = function CustomOverflowMenu(_ref) {
|
|
|
915
1022
|
var overflowItemsClasses = cx("eps-overflow-menu__group", {
|
|
916
1023
|
"eps-overflow-menu__group--open": open
|
|
917
1024
|
});
|
|
918
|
-
var overflowContentRef =
|
|
919
|
-
var overflowMenuTriggerRef =
|
|
1025
|
+
var overflowContentRef = useRef(null);
|
|
1026
|
+
var overflowMenuTriggerRef = useRef(null);
|
|
920
1027
|
useOutsideClick(overflowContentRef, overflowMenuTriggerRef, function () {
|
|
921
1028
|
return onOpenChange(false);
|
|
922
1029
|
});
|
|
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
|
-
|
|
1030
|
+
return jsxs("div", {
|
|
1031
|
+
children: [jsx(SecondaryButton, _extends({
|
|
1032
|
+
className: cx("eps-overflow-menu__button", className),
|
|
1033
|
+
onClick: function onClick() {
|
|
1034
|
+
return onOpenChange(!open);
|
|
1035
|
+
},
|
|
1036
|
+
"aria-haspopup": true,
|
|
1037
|
+
"aria-expanded": open,
|
|
1038
|
+
ref: overflowMenuTriggerRef
|
|
1039
|
+
}, rest, {
|
|
1040
|
+
children: jsxs("div", {
|
|
1041
|
+
className: "eps-overflow-menu__button-contents",
|
|
1042
|
+
children: [jsx("span", {
|
|
1043
|
+
className: "eds-overflow-menu__user-icon",
|
|
1044
|
+
children: jsx(UserIcon, {
|
|
1045
|
+
inline: true
|
|
1046
|
+
})
|
|
1047
|
+
}), jsxs(Heading6, {
|
|
1048
|
+
margin: "none",
|
|
1049
|
+
as: "span",
|
|
1050
|
+
children: [userName, environment !== undefined && environment !== Environment.Production && jsxs("span", {
|
|
1051
|
+
style: {
|
|
1052
|
+
color: getColorForEnvironment(environment)
|
|
1053
|
+
},
|
|
1054
|
+
children: [" ", "(", getHumanReadableEnvironment(environment), ")"]
|
|
1055
|
+
})]
|
|
1056
|
+
}), jsx("span", {
|
|
1057
|
+
className: "eps-arrow-icon",
|
|
1058
|
+
children: jsx(DownArrowIcon, {
|
|
1059
|
+
inline: true
|
|
1060
|
+
})
|
|
1061
|
+
})]
|
|
1062
|
+
})
|
|
1063
|
+
})), open && jsx("div", {
|
|
1064
|
+
className: overflowItemsClasses,
|
|
1065
|
+
role: "menu",
|
|
1066
|
+
ref: overflowContentRef,
|
|
1067
|
+
children: children
|
|
1068
|
+
})]
|
|
1069
|
+
});
|
|
953
1070
|
};
|
|
954
1071
|
|
|
955
1072
|
var LocaleSwitchMenuItem = function LocaleSwitchMenuItem(_ref) {
|
|
956
1073
|
var locale = _ref.locale,
|
|
957
1074
|
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
|
-
|
|
1075
|
+
return jsx(Fragment, {
|
|
1076
|
+
children: locale === "en-GB" ? jsxs(CustomOverflowMenuItem, {
|
|
1077
|
+
onClick: function onClick() {
|
|
1078
|
+
onLocaleChange("nb-NO");
|
|
1079
|
+
},
|
|
1080
|
+
className: "eps-overflow-menu__item",
|
|
1081
|
+
children: [jsx("span", {
|
|
1082
|
+
"aria-hidden": true,
|
|
1083
|
+
className: "eps-overflow-menu__icon-margin",
|
|
1084
|
+
children: jsx(NorwayIcon, {
|
|
1085
|
+
size: "1rem",
|
|
1086
|
+
inline: true
|
|
1087
|
+
})
|
|
1088
|
+
}), "Bytt til norsk"]
|
|
1089
|
+
}) : jsxs(CustomOverflowMenuItem, {
|
|
1090
|
+
onClick: function onClick() {
|
|
1091
|
+
onLocaleChange("en-GB");
|
|
1092
|
+
},
|
|
1093
|
+
className: "eps-overflow-menu__item",
|
|
1094
|
+
children: [jsx("span", {
|
|
1095
|
+
"aria-hidden": true,
|
|
1096
|
+
className: "eps-overflow-menu__icon-margin",
|
|
1097
|
+
children: jsx(UKIcon, {
|
|
1098
|
+
size: "1rem",
|
|
1099
|
+
inline: true
|
|
1100
|
+
})
|
|
1101
|
+
}), "Switch to English"]
|
|
1102
|
+
})
|
|
1103
|
+
});
|
|
981
1104
|
};
|
|
982
1105
|
|
|
983
1106
|
var LogOutMenuItem = function LogOutMenuItem(_ref) {
|
|
984
1107
|
var onClick = _ref.onClick,
|
|
985
1108
|
locale = _ref.locale;
|
|
986
|
-
return
|
|
1109
|
+
return jsxs(CustomOverflowMenuItem, {
|
|
987
1110
|
onClick: onClick,
|
|
988
1111
|
"data-testid": "user-menu-logout",
|
|
989
|
-
className: "eps-overflow-menu__item"
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
1112
|
+
className: "eps-overflow-menu__item",
|
|
1113
|
+
children: [jsx("span", {
|
|
1114
|
+
"aria-hidden": true,
|
|
1115
|
+
children: jsx(LogOutIcon, {
|
|
1116
|
+
size: "1rem",
|
|
1117
|
+
inline: true
|
|
1118
|
+
})
|
|
1119
|
+
}), locale === "en-GB" ? "Log out " : "Logg ut"]
|
|
1120
|
+
});
|
|
996
1121
|
};
|
|
997
1122
|
|
|
998
1123
|
var UserMenuItem = function UserMenuItem(_ref) {
|
|
999
1124
|
var locale = _ref.locale,
|
|
1000
1125
|
onClick = _ref.onClick;
|
|
1001
|
-
return
|
|
1126
|
+
return jsxs(CustomOverflowMenuItem, {
|
|
1002
1127
|
onClick: onClick,
|
|
1003
|
-
className: "eps-overflow-menu__item"
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1128
|
+
className: "eps-overflow-menu__item",
|
|
1129
|
+
children: [jsx("span", {
|
|
1130
|
+
"aria-hidden": true,
|
|
1131
|
+
children: jsx(UserIcon, {
|
|
1132
|
+
size: "1rem",
|
|
1133
|
+
inline: true
|
|
1134
|
+
})
|
|
1135
|
+
}), locale === "en-GB" ? "My profile" : "Min profil"]
|
|
1136
|
+
});
|
|
1010
1137
|
};
|
|
1011
1138
|
|
|
1012
1139
|
var VersionMenuItem = function VersionMenuItem(_ref) {
|
|
1013
1140
|
var locale = _ref.locale,
|
|
1014
1141
|
onClick = _ref.onClick;
|
|
1015
|
-
return
|
|
1142
|
+
return jsxs(CustomOverflowMenuItem, {
|
|
1016
1143
|
onClick: onClick,
|
|
1017
|
-
className: "eps-overflow-menu__item"
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1144
|
+
className: "eps-overflow-menu__item",
|
|
1145
|
+
children: [jsx("span", {
|
|
1146
|
+
"aria-hidden": true,
|
|
1147
|
+
children: jsx(ChannelsIcon, {
|
|
1148
|
+
className: "eps-version-icon",
|
|
1149
|
+
size: "1rem",
|
|
1150
|
+
inline: true
|
|
1151
|
+
})
|
|
1152
|
+
}), locale === "en-GB" ? "Version" : "Versjon"]
|
|
1153
|
+
});
|
|
1025
1154
|
};
|
|
1026
1155
|
|
|
1027
1156
|
var UserMenu = function UserMenu(_ref) {
|
|
@@ -1041,47 +1170,50 @@ var UserMenu = function UserMenu(_ref) {
|
|
|
1041
1170
|
var _useState = useState(false),
|
|
1042
1171
|
open = _useState[0],
|
|
1043
1172
|
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
|
-
|
|
1173
|
+
return jsx("div", {
|
|
1174
|
+
id: "eps-user-menu",
|
|
1175
|
+
children: jsx(CustomOverflowMenu, {
|
|
1176
|
+
open: open,
|
|
1177
|
+
onOpenChange: setOpen,
|
|
1178
|
+
className: cx(["eps-user-menu__trigger-button", className]),
|
|
1179
|
+
userName: userName,
|
|
1180
|
+
environment: environment,
|
|
1181
|
+
children: jsxs("div", {
|
|
1182
|
+
id: "eps-overflow-menu",
|
|
1183
|
+
children: [jsx(LocaleSwitchMenuItem, {
|
|
1184
|
+
locale: locale,
|
|
1185
|
+
onLocaleChange: function onLocaleChange(newLocale) {
|
|
1186
|
+
_onLocaleChange(newLocale);
|
|
1187
|
+
setOpen(false);
|
|
1188
|
+
}
|
|
1189
|
+
}), showVersionItem && jsx(VersionMenuItem, {
|
|
1190
|
+
locale: locale,
|
|
1191
|
+
onClick: function onClick() {
|
|
1192
|
+
onVersionItemClick == null || onVersionItemClick();
|
|
1193
|
+
setOpen(false);
|
|
1194
|
+
}
|
|
1195
|
+
}), showMyProfileItem && jsx(UserMenuItem, {
|
|
1196
|
+
locale: locale,
|
|
1197
|
+
onClick: function onClick() {
|
|
1198
|
+
onNavigateToMyProfile();
|
|
1199
|
+
setOpen(false);
|
|
1200
|
+
}
|
|
1201
|
+
}), showCookieSettingsItem && jsx(CookieSettingsMenuItem, {
|
|
1202
|
+
locale: locale,
|
|
1203
|
+
onClick: function onClick() {
|
|
1204
|
+
onCookieSettingsOpen();
|
|
1205
|
+
setOpen(false);
|
|
1206
|
+
}
|
|
1207
|
+
}), jsx(LogOutMenuItem, {
|
|
1208
|
+
locale: locale,
|
|
1209
|
+
onClick: function onClick() {
|
|
1210
|
+
onLogout();
|
|
1211
|
+
setOpen(false);
|
|
1212
|
+
}
|
|
1213
|
+
})]
|
|
1214
|
+
})
|
|
1215
|
+
})
|
|
1216
|
+
});
|
|
1085
1217
|
};
|
|
1086
1218
|
|
|
1087
1219
|
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 };
|