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