@entur-partner/common 6.0.0 → 7.0.1-alpha.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.
@@ -26,26 +26,21 @@ function _extends() {
26
26
  _extends = Object.assign ? Object.assign.bind() : function (target) {
27
27
  for (var i = 1; i < arguments.length; i++) {
28
28
  var source = arguments[i];
29
-
30
29
  for (var key in source) {
31
30
  if (Object.prototype.hasOwnProperty.call(source, key)) {
32
31
  target[key] = source[key];
33
32
  }
34
33
  }
35
34
  }
36
-
37
35
  return target;
38
36
  };
39
37
  return _extends.apply(this, arguments);
40
38
  }
41
-
42
39
  function _inheritsLoose(subClass, superClass) {
43
40
  subClass.prototype = Object.create(superClass.prototype);
44
41
  subClass.prototype.constructor = subClass;
45
-
46
42
  _setPrototypeOf(subClass, superClass);
47
43
  }
48
-
49
44
  function _setPrototypeOf(o, p) {
50
45
  _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
51
46
  o.__proto__ = p;
@@ -53,23 +48,20 @@ function _setPrototypeOf(o, p) {
53
48
  };
54
49
  return _setPrototypeOf(o, p);
55
50
  }
56
-
57
51
  function _objectWithoutPropertiesLoose(source, excluded) {
58
52
  if (source == null) return {};
59
53
  var target = {};
60
54
  var sourceKeys = Object.keys(source);
61
55
  var key, i;
62
-
63
56
  for (i = 0; i < sourceKeys.length; i++) {
64
57
  key = sourceKeys[i];
65
58
  if (excluded.indexOf(key) >= 0) continue;
66
59
  target[key] = source[key];
67
60
  }
68
-
69
61
  return target;
70
62
  }
71
63
 
72
- var _excluded$f = ["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"];
64
+ var _excluded$e = ["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"];
73
65
  function responsiveProp(prefix, prop) {
74
66
  if (Array.isArray(prop)) {
75
67
  var classes = [];
@@ -78,40 +70,38 @@ function responsiveProp(prefix, prop) {
78
70
  prop[2] && classes.push("" + prefix + prop[2] + "-xl");
79
71
  return classes;
80
72
  }
81
-
82
73
  return [prefix + prop];
83
74
  }
84
75
  var Box = function Box(_ref) {
85
76
  var _ref$as = _ref.as,
86
- Component = _ref$as === void 0 ? 'div' : _ref$as,
87
- children = _ref.children,
88
- contrast = _ref.contrast,
89
- paddingTop = _ref.paddingTop,
90
- paddingRight = _ref.paddingRight,
91
- paddingBottom = _ref.paddingBottom,
92
- paddingLeft = _ref.paddingLeft,
93
- paddingX = _ref.paddingX,
94
- paddingY = _ref.paddingY,
95
- padding = _ref.padding,
96
- marginTop = _ref.marginTop,
97
- marginRight = _ref.marginRight,
98
- marginBottom = _ref.marginBottom,
99
- marginLeft = _ref.marginLeft,
100
- marginX = _ref.marginX,
101
- marginY = _ref.marginY,
102
- margin = _ref.margin,
103
- display = _ref.display,
104
- justifyContent = _ref.justifyContent,
105
- alignItems = _ref.alignItems,
106
- maxWidth = _ref.maxWidth,
107
- width = _ref.width,
108
- background = _ref.background,
109
- color = _ref.color,
110
- flexDirection = _ref.flexDirection,
111
- flexWrap = _ref.flexWrap,
112
- className = _ref.className,
113
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$f);
114
-
77
+ Component = _ref$as === void 0 ? 'div' : _ref$as,
78
+ children = _ref.children,
79
+ contrast = _ref.contrast,
80
+ paddingTop = _ref.paddingTop,
81
+ paddingRight = _ref.paddingRight,
82
+ paddingBottom = _ref.paddingBottom,
83
+ paddingLeft = _ref.paddingLeft,
84
+ paddingX = _ref.paddingX,
85
+ paddingY = _ref.paddingY,
86
+ padding = _ref.padding,
87
+ marginTop = _ref.marginTop,
88
+ marginRight = _ref.marginRight,
89
+ marginBottom = _ref.marginBottom,
90
+ marginLeft = _ref.marginLeft,
91
+ marginX = _ref.marginX,
92
+ marginY = _ref.marginY,
93
+ margin = _ref.margin,
94
+ display = _ref.display,
95
+ justifyContent = _ref.justifyContent,
96
+ alignItems = _ref.alignItems,
97
+ maxWidth = _ref.maxWidth,
98
+ width = _ref.width,
99
+ background = _ref.background,
100
+ color = _ref.color,
101
+ flexDirection = _ref.flexDirection,
102
+ flexWrap = _ref.flexWrap,
103
+ className = _ref.className,
104
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$e);
115
105
  var classes = [];
116
106
  var resolvedPaddingTop = paddingTop || paddingY || padding;
117
107
  var resolvedPaddingBottom = paddingBottom || paddingY || padding;
@@ -132,11 +122,9 @@ var Box = function Box(_ref) {
132
122
  resolvedMarginRight && classes.push.apply(classes, responsiveProp('eps-mr-', resolvedMarginRight));
133
123
  display && classes.push.apply(classes, responsiveProp('eps-', display));
134
124
  justifyContent && classes.push.apply(classes, responsiveProp('eps-justify-', justifyContent));
135
-
136
125
  if (alignItems) {
137
126
  classes.push.apply(classes, responsiveProp('eps-items-', alignItems));
138
127
  }
139
-
140
128
  maxWidth && classes.push.apply(classes, responsiveProp('eps-max-w-', maxWidth));
141
129
  width && classes.push.apply(classes, responsiveProp('eps-w-', width));
142
130
  color && classes.push("eps-color-" + color);
@@ -151,14 +139,12 @@ var Box = function Box(_ref) {
151
139
 
152
140
  var Stack = function Stack(_ref) {
153
141
  var children = _ref.children,
154
- space = _ref.space,
155
- className = _ref.className;
142
+ space = _ref.space,
143
+ className = _ref.className;
156
144
  var stackItems = React.Children.toArray(children);
157
-
158
145
  if (stackItems.length <= 1) {
159
146
  return React__default["default"].createElement(React__default["default"].Fragment, null, stackItems);
160
147
  }
161
-
162
148
  return React__default["default"].createElement("div", {
163
149
  className: className
164
150
  }, stackItems.map(function (child, index) {
@@ -177,14 +163,12 @@ var ActionBarLeft = function ActionBarLeft(_ref) {
177
163
  className: "eps-action-bar-left"
178
164
  }, children);
179
165
  };
180
-
181
166
  var ActionBarRight = function ActionBarRight(_ref2) {
182
167
  var children = _ref2.children;
183
168
  return React__default["default"].createElement("div", {
184
169
  className: "eps-action-bar-right"
185
170
  }, children);
186
171
  };
187
-
188
172
  var ActionBar = function ActionBar(_ref3) {
189
173
  var children = _ref3.children;
190
174
  return React__default["default"].createElement(React__default["default"].Fragment, null, React__default["default"].createElement("div", {
@@ -194,12 +178,11 @@ var ActionBar = function ActionBar(_ref3) {
194
178
  }, children));
195
179
  };
196
180
 
197
- var _excluded$e = ["children", "className"];
181
+ var _excluded$d = ["children", "className"];
198
182
  var LinkButton = function LinkButton(_ref) {
199
183
  var children = _ref.children,
200
- className = _ref.className,
201
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$e);
202
-
184
+ className = _ref.className,
185
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$d);
203
186
  return React__default["default"].createElement(typography.Link, _extends({}, rest, {
204
187
  as: "button",
205
188
  className: cx__default["default"]('eps-link-button', className)
@@ -213,10 +196,8 @@ var LinkButton = function LinkButton(_ref) {
213
196
  * @param flag case sensitive flag. If it is an environment variable
214
197
  * you can drop the REACT_APP_ prefix.
215
198
  */
216
-
217
199
  function featureFlag(flag) {
218
200
  var _window$localStorage, _window$localStorage2;
219
-
220
201
  return process.env["REACT_APP_" + flag] === 'true' || ((_window$localStorage = window.localStorage) == null ? void 0 : _window$localStorage.getItem(flag)) === 'true' || ((_window$localStorage2 = window.localStorage) == null ? void 0 : _window$localStorage2.getItem("REACT_APP_" + flag)) === 'true';
221
202
  }
222
203
  /**
@@ -226,40 +207,33 @@ function featureFlag(flag) {
226
207
  * @param flag case sensitive flag. If it is an environment variable
227
208
  * you can drop the REACT_APP_ prefix.
228
209
  */
229
-
230
210
  function useFeatureToggle(flag) {
231
211
  return featureFlag(flag);
232
212
  }
233
213
  var FeatureToggle = function FeatureToggle(_ref) {
234
214
  var children = _ref.children,
235
- flag = _ref.flag;
215
+ flag = _ref.flag;
236
216
  var feature = useFeatureToggle(flag);
237
-
238
217
  if (feature) {
239
218
  return React__default["default"].createElement(React__default["default"].Fragment, null, children);
240
219
  }
241
-
242
220
  return null;
243
221
  };
244
222
 
245
223
  var _environmentColors, _humanReadableEnviron;
246
-
247
224
  exports.Environment = void 0;
248
-
249
225
  (function (Environment) {
250
226
  Environment["Local"] = "local";
251
227
  Environment["Development"] = "dev";
252
228
  Environment["Staging"] = "staging";
253
229
  Environment["Production"] = "prod";
254
230
  })(exports.Environment || (exports.Environment = {}));
255
-
256
231
  var environmentColors = (_environmentColors = {}, _environmentColors[exports.Environment.Local] = '#B482FB', _environmentColors[exports.Environment.Development] = '#5AC39A', _environmentColors[exports.Environment.Staging] = '#FFCA28', _environmentColors);
257
232
  /**
258
233
  * Gets the color for the given environment. This is the color used for the environment
259
234
  * indicator. There is no color for production as it should not have any special environment
260
235
  * indication.
261
236
  */
262
-
263
237
  var getColorForEnvironment = function getColorForEnvironment(environment) {
264
238
  return environmentColors[environment];
265
239
  };
@@ -268,13 +242,12 @@ var getHumanReadableEnvironment = function getHumanReadableEnvironment(environme
268
242
  return humanReadableEnvironment[environment];
269
243
  };
270
244
 
271
- var _excluded$d = ["title", "accentColor"];
245
+ var _excluded$c = ["title", "accentColor"];
272
246
  var EnturPartnerLogoSvg = function EnturPartnerLogoSvg(_ref) {
273
247
  var title = _ref.title,
274
- _ref$accentColor = _ref.accentColor,
275
- accentColor = _ref$accentColor === void 0 ? '#FF5959' : _ref$accentColor,
276
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$d);
277
-
248
+ _ref$accentColor = _ref.accentColor,
249
+ accentColor = _ref$accentColor === void 0 ? '#FF5959' : _ref$accentColor,
250
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$c);
278
251
  return React__default["default"].createElement("svg", _extends({
279
252
  width: 257,
280
253
  height: 37,
@@ -299,10 +272,10 @@ var EnturPartnerLogoSvg = function EnturPartnerLogoSvg(_ref) {
299
272
  };
300
273
  var EnturPartnerLogo = function EnturPartnerLogo(_ref2) {
301
274
  var _ref2$as = _ref2.as,
302
- Component = _ref2$as === void 0 ? 'nav' : _ref2$as,
303
- className = _ref2.className,
304
- altText = _ref2.altText,
305
- environment = _ref2.environment;
275
+ Component = _ref2$as === void 0 ? 'nav' : _ref2$as,
276
+ className = _ref2.className,
277
+ altText = _ref2.altText,
278
+ environment = _ref2.environment;
306
279
  var classList = cx__default["default"](['eps-logo-wrapper', className]);
307
280
  return React__default["default"].createElement(Component, {
308
281
  className: classList
@@ -315,9 +288,9 @@ var EnturPartnerLogo = function EnturPartnerLogo(_ref2) {
315
288
 
316
289
  var Menu = function Menu(_ref) {
317
290
  var _ref$as = _ref.as,
318
- Component = _ref$as === void 0 ? 'nav' : _ref$as,
319
- className = _ref.className,
320
- children = _ref.children;
291
+ Component = _ref$as === void 0 ? 'nav' : _ref$as,
292
+ className = _ref.className,
293
+ children = _ref.children;
321
294
  var classList = cx__default["default"](['eds-contrast', 'eps-menu', className]);
322
295
  return React__default["default"].createElement(Component, {
323
296
  className: classList
@@ -326,33 +299,31 @@ var Menu = function Menu(_ref) {
326
299
 
327
300
  var Content = function Content(_ref) {
328
301
  var _ref$as = _ref.as,
329
- Component = _ref$as === void 0 ? 'main' : _ref$as,
330
- className = _ref.className,
331
- children = _ref.children;
302
+ Component = _ref$as === void 0 ? 'main' : _ref$as,
303
+ className = _ref.className,
304
+ children = _ref.children;
332
305
  var classList = cx__default["default"](['eps-content', className]);
333
306
  return React__default["default"].createElement(Component, {
334
307
  className: classList
335
308
  }, children);
336
309
  };
337
310
 
338
- var _excluded$c = ["className", "children", "userName", "open", "onOpenChange", "environment"];
311
+ var _excluded$b = ["className", "children", "userName", "open", "onOpenChange", "environment"];
339
312
  var UserMenu = function UserMenu(_ref) {
340
313
  var className = _ref.className,
341
- messages = _ref.messages,
342
- onLogout = _ref.onLogout,
343
- onLanguageChange = _ref.onLanguageChange,
344
- userName = _ref.userName,
345
- language = _ref.language,
346
- environment = _ref.environment,
347
- showVersionItem = _ref.showVersionItem,
348
- showMyProfileItem = _ref.showMyProfileItem,
349
- onNavigateToMyProfile = _ref.onNavigateToMyProfile;
314
+ messages = _ref.messages,
315
+ onLogout = _ref.onLogout,
316
+ onLanguageChange = _ref.onLanguageChange,
317
+ userName = _ref.userName,
318
+ language = _ref.language,
319
+ environment = _ref.environment,
320
+ showVersionItem = _ref.showVersionItem,
321
+ showMyProfileItem = _ref.showMyProfileItem,
322
+ onNavigateToMyProfile = _ref.onNavigateToMyProfile;
350
323
  var triggerClassList = cx__default["default"](['eps-user-menu__trigger-button', className]);
351
-
352
324
  var _useState = React.useState(false),
353
- open = _useState[0],
354
- setOpen = _useState[1];
355
-
325
+ open = _useState[0],
326
+ setOpen = _useState[1];
356
327
  return React__default["default"].createElement("div", {
357
328
  id: "eps-user-menu"
358
329
  }, React__default["default"].createElement(CustomOverflowMenu, {
@@ -420,16 +391,14 @@ var UserMenu = function UserMenu(_ref) {
420
391
  inline: true
421
392
  })), messages.logout))));
422
393
  };
423
-
424
394
  var CustomOverflowMenu = function CustomOverflowMenu(_ref2) {
425
395
  var className = _ref2.className,
426
- children = _ref2.children,
427
- userName = _ref2.userName,
428
- open = _ref2.open,
429
- onOpenChange = _ref2.onOpenChange,
430
- environment = _ref2.environment,
431
- rest = _objectWithoutPropertiesLoose(_ref2, _excluded$c);
432
-
396
+ children = _ref2.children,
397
+ userName = _ref2.userName,
398
+ open = _ref2.open,
399
+ onOpenChange = _ref2.onOpenChange,
400
+ environment = _ref2.environment,
401
+ rest = _objectWithoutPropertiesLoose(_ref2, _excluded$b);
433
402
  var overflowItemsClasses = cx__default["default"]('eps-overflow-menu__group', {
434
403
  'eps-overflow-menu__group--open': open
435
404
  });
@@ -470,19 +439,16 @@ var CustomOverflowMenu = function CustomOverflowMenu(_ref2) {
470
439
  ref: overflowContentRef
471
440
  }, children));
472
441
  };
473
-
474
442
  var CustomOverflowMenuItem = function CustomOverflowMenuItem(props) {
475
443
  return React__default["default"].createElement("button", _extends({
476
444
  className: cx__default["default"](props.className, 'eps-overflow-menu__item'),
477
445
  role: "menuitem"
478
446
  }, props));
479
447
  };
480
-
481
448
  var VersionCustomOverflowMenuItems = function VersionCustomOverflowMenuItems(_ref3) {
482
449
  var title = _ref3.title,
483
- setOpen = _ref3.setOpen;
450
+ setOpen = _ref3.setOpen;
484
451
  var navigate = reactRouterDom.useNavigate(); // Hide useNavigate from standalone micro-frontends because it is not under RouterProvider
485
-
486
452
  return React__default["default"].createElement(CustomOverflowMenuItem, {
487
453
  onClick: function onClick() {
488
454
  navigate('/app-version');
@@ -497,41 +463,33 @@ var VersionCustomOverflowMenuItems = function VersionCustomOverflowMenuItems(_re
497
463
  inline: true
498
464
  })), title);
499
465
  };
500
-
501
466
  function elementContainsEventTarget(element, event) {
502
467
  if (!element) {
503
468
  return false;
504
469
  }
505
-
506
470
  if (element.contains(event.target)) {
507
471
  return true;
508
- } // For elements inside a Shadow DOM we need to check the composedPath
509
-
510
-
472
+ }
473
+ // For elements inside a Shadow DOM we need to check the composedPath
511
474
  if (event.composed && event.composedPath) {
512
475
  var contains = event.composedPath().find(function (target) {
513
476
  if (target === window) {
514
477
  return false;
515
478
  }
516
-
517
479
  return element.contains(target);
518
480
  });
519
481
  return contains ? true : false;
520
482
  }
521
-
522
483
  return false;
523
484
  }
524
-
525
485
  function useOutsideClick(ref, buttonRef, handler) {
526
486
  React__default["default"].useEffect(function () {
527
487
  var listener = function listener(event) {
528
488
  if (elementContainsEventTarget(ref.current, event) || elementContainsEventTarget(buttonRef.current, event)) {
529
489
  return;
530
490
  }
531
-
532
491
  handler();
533
492
  };
534
-
535
493
  document.addEventListener('mousedown', listener);
536
494
  document.addEventListener('touchstart', listener);
537
495
  return function () {
@@ -541,14 +499,13 @@ function useOutsideClick(ref, buttonRef, handler) {
541
499
  }, [ref, buttonRef, handler]);
542
500
  }
543
501
 
544
- var _excluded$b = ["label", "organisations", "onChange", "selectedOrganisationId"];
502
+ var _excluded$a = ["label", "organisations", "onChange", "selectedOrganisationId"];
545
503
  var OrganisationDropDown = function OrganisationDropDown(_ref) {
546
504
  var label = _ref.label,
547
- organisations = _ref.organisations,
548
- handleChange = _ref.onChange,
549
- selectedOrganisationId = _ref.selectedOrganisationId,
550
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$b);
551
-
505
+ organisations = _ref.organisations,
506
+ handleChange = _ref.onChange,
507
+ selectedOrganisationId = _ref.selectedOrganisationId,
508
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$a);
552
509
  var selectedOrganisation = organisations.find(function (org) {
553
510
  return org.id === selectedOrganisationId;
554
511
  });
@@ -580,7 +537,6 @@ function useEventListener(eventName, handler, element) {
580
537
  if (element === void 0) {
581
538
  element = window;
582
539
  }
583
-
584
540
  var savedHandler = React.useRef();
585
541
  React.useEffect(function () {
586
542
  savedHandler.current = handler;
@@ -588,11 +544,9 @@ function useEventListener(eventName, handler, element) {
588
544
  React.useEffect(function () {
589
545
  var isSupported = element && element.addEventListener;
590
546
  if (!isSupported) return;
591
-
592
547
  var eventListener = function eventListener(event) {
593
548
  return savedHandler.current == null ? void 0 : savedHandler.current(event);
594
549
  };
595
-
596
550
  element.addEventListener(eventName, eventListener);
597
551
  return function () {
598
552
  element.removeEventListener(eventName, eventListener);
@@ -600,21 +554,19 @@ function useEventListener(eventName, handler, element) {
600
554
  }, [eventName, element]);
601
555
  }
602
556
 
603
- var _excluded$a = ["language", "options", "className", "onChange"];
557
+ var _excluded$9 = ["language", "options", "className", "onChange"];
604
558
  var LanguageSelect = function LanguageSelect(_ref) {
605
559
  var language = _ref.language,
606
- options = _ref.options,
607
- className = _ref.className,
608
- _onChange = _ref.onChange,
609
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$a);
610
-
560
+ options = _ref.options,
561
+ className = _ref.className,
562
+ _onChange = _ref.onChange,
563
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$9);
611
564
  var classNames = cx__default["default"]('eps-language-select', className);
612
565
  return React__default["default"].createElement("div", _extends({}, rest, {
613
566
  className: classNames
614
567
  }), React__default["default"].createElement(form.SegmentedControl, {
615
568
  onChange: function onChange(language) {
616
569
  util.assertIsDefined(language);
617
-
618
570
  _onChange(language);
619
571
  },
620
572
  selectedValue: language
@@ -628,30 +580,26 @@ var LanguageSelect = function LanguageSelect(_ref) {
628
580
  })));
629
581
  };
630
582
 
631
- var _excluded$9 = ["title", "inputComponent", "languages", "values", "onChange", "name", "variant", "feedback"];
583
+ var _excluded$8 = ["title", "inputComponent", "languages", "values", "onChange", "name", "variant", "feedback"];
632
584
  var ExpandableMultiLanguageInput = function ExpandableMultiLanguageInput(_ref) {
633
585
  var title = _ref.title,
634
- InputComponent = _ref.inputComponent,
635
- languages = _ref.languages,
636
- values = _ref.values,
637
- onChange = _ref.onChange,
638
- name = _ref.name,
639
- variant = _ref.variant,
640
- feedback = _ref.feedback,
641
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$9);
642
-
586
+ InputComponent = _ref.inputComponent,
587
+ languages = _ref.languages,
588
+ values = _ref.values,
589
+ onChange = _ref.onChange,
590
+ name = _ref.name,
591
+ variant = _ref.variant,
592
+ feedback = _ref.feedback,
593
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$8);
643
594
  var handleOnChange = function handleOnChange(language, value) {
644
595
  var changes = _extends({}, values);
645
-
646
596
  if (value === '' || !value) {
647
597
  delete changes[language];
648
598
  } else {
649
599
  changes[language] = value;
650
600
  }
651
-
652
601
  onChange(changes);
653
602
  };
654
-
655
603
  return React__default["default"].createElement(expand.ExpandablePanel, {
656
604
  title: title,
657
605
  defaultOpen: true,
@@ -664,8 +612,8 @@ var ExpandableMultiLanguageInput = function ExpandableMultiLanguageInput(_ref) {
664
612
  space: "medium"
665
613
  }, languages.map(function (_ref2) {
666
614
  var langKey = _ref2.value,
667
- label = _ref2.label,
668
- required = _ref2.required;
615
+ label = _ref2.label,
616
+ required = _ref2.required;
669
617
  return React__default["default"].createElement(InputComponent, _extends({
670
618
  "data-testid": "multi-lang-input-" + name + "-" + langKey,
671
619
  key: title + langKey,
@@ -681,35 +629,31 @@ var ExpandableMultiLanguageInput = function ExpandableMultiLanguageInput(_ref) {
681
629
  })));
682
630
  };
683
631
 
684
- var _excluded$8 = ["className", "inputComponent", "alertLabel", "alertLevel", "name", "languages", "values", "onChange", "defaultLanguage", "label", "onBlur"];
632
+ var _excluded$7 = ["className", "inputComponent", "alertLabel", "alertLevel", "name", "languages", "values", "onChange", "defaultLanguage", "label", "onBlur"];
685
633
  /**
686
634
  * @deprecated use ExpandableMultiLanguageInput
687
635
  */
688
-
689
636
  var MultiLanguageInput = function MultiLanguageInput(_ref) {
690
637
  var className = _ref.className,
691
- InputComponent = _ref.inputComponent,
692
- alertLabel = _ref.alertLabel,
693
- alertLevel = _ref.alertLevel,
694
- name = _ref.name,
695
- languages = _ref.languages,
696
- values = _ref.values,
697
- onChange = _ref.onChange,
698
- _ref$defaultLanguage = _ref.defaultLanguage,
699
- defaultLanguage = _ref$defaultLanguage === void 0 ? 'nob' : _ref$defaultLanguage,
700
- _ref$label = _ref.label,
701
- label = _ref$label === void 0 ? '' : _ref$label,
702
- _ref$onBlur = _ref.onBlur,
703
- onBlur = _ref$onBlur === void 0 ? function () {} : _ref$onBlur,
704
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$8);
705
-
638
+ InputComponent = _ref.inputComponent,
639
+ alertLabel = _ref.alertLabel,
640
+ alertLevel = _ref.alertLevel,
641
+ name = _ref.name,
642
+ languages = _ref.languages,
643
+ values = _ref.values,
644
+ onChange = _ref.onChange,
645
+ _ref$defaultLanguage = _ref.defaultLanguage,
646
+ defaultLanguage = _ref$defaultLanguage === void 0 ? 'nob' : _ref$defaultLanguage,
647
+ _ref$label = _ref.label,
648
+ label = _ref$label === void 0 ? '' : _ref$label,
649
+ _ref$onBlur = _ref.onBlur,
650
+ onBlur = _ref$onBlur === void 0 ? function () {} : _ref$onBlur,
651
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$7);
706
652
  var _useState = React.useState(defaultLanguage),
707
- language = _useState[0],
708
- setLanguage = _useState[1];
709
-
653
+ language = _useState[0],
654
+ setLanguage = _useState[1];
710
655
  var classNames = cx__default["default"]('multi-language-input', className);
711
656
  var currentValue = values[language];
712
-
713
657
  var handleOnBlur = function handleOnBlur(e) {
714
658
  e.persist();
715
659
  var currentTarget = e.currentTarget;
@@ -719,23 +663,18 @@ var MultiLanguageInput = function MultiLanguageInput(_ref) {
719
663
  }
720
664
  }, 0);
721
665
  };
722
-
723
666
  var handleLanguageChange = function handleLanguageChange(language) {
724
667
  setLanguage(language);
725
668
  };
726
-
727
669
  var handleOnChange = function handleOnChange(value) {
728
670
  var changes = Object.assign({}, values);
729
-
730
671
  if (value === '' || !value) {
731
672
  delete changes[language];
732
673
  } else {
733
674
  changes[language] = value;
734
675
  }
735
-
736
676
  onChange(changes);
737
677
  };
738
-
739
678
  return React__default["default"].createElement("div", {
740
679
  className: classNames,
741
680
  tabIndex: 0,
@@ -762,12 +701,11 @@ var MultiLanguageInput = function MultiLanguageInput(_ref) {
762
701
  }, rest))));
763
702
  };
764
703
 
765
- var _excluded$7 = ["children", "className"];
704
+ var _excluded$6 = ["children", "className"];
766
705
  var Unbutton = function Unbutton(_ref) {
767
706
  var children = _ref.children,
768
- className = _ref.className,
769
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$7);
770
-
707
+ className = _ref.className,
708
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$6);
771
709
  return React__default["default"].createElement(button.Button, _extends({
772
710
  variant: "primary"
773
711
  }, rest, {
@@ -781,41 +719,32 @@ function isFunction(functionToCheck) {
781
719
 
782
720
  var newAppVersionErrorMessage = "Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.";
783
721
  var ErrorBoundary = /*#__PURE__*/function (_Component) {
784
- _inheritsLoose(ErrorBoundary, _Component);
785
-
786
722
  function ErrorBoundary(props) {
787
723
  var _this;
788
-
789
724
  _this = _Component.call(this, props) || this;
790
725
  _this.state = {
791
726
  error: null
792
727
  };
793
728
  return _this;
794
729
  }
795
-
730
+ _inheritsLoose(ErrorBoundary, _Component);
796
731
  ErrorBoundary.getDerivedStateFromError = function getDerivedStateFromError(error) {
797
732
  return {
798
733
  error: error
799
734
  };
800
735
  };
801
-
802
736
  var _proto = ErrorBoundary.prototype;
803
-
804
737
  _proto.componentDidCatch = function componentDidCatch(error, errorInfo) {
805
738
  var _this$props$handleErr, _this$props;
806
-
807
739
  // React always logs in development
808
- (_this$props$handleErr = (_this$props = this.props).handleError) == null ? void 0 : _this$props$handleErr.call(_this$props, error, errorInfo);
740
+ (_this$props$handleErr = (_this$props = this.props).handleError) == null || _this$props$handleErr.call(_this$props, error, errorInfo);
809
741
  };
810
-
811
742
  _proto.render = function render() {
812
743
  var _this2 = this;
813
-
814
744
  var error = this.state.error;
815
745
  var _this$props2 = this.props,
816
- fallback = _this$props2.fallback,
817
- children = _this$props2.children;
818
-
746
+ fallback = _this$props2.fallback,
747
+ children = _this$props2.children;
819
748
  if (error) {
820
749
  if (isFunction(fallback)) {
821
750
  return fallback({
@@ -829,17 +758,13 @@ var ErrorBoundary = /*#__PURE__*/function (_Component) {
829
758
  } else if (error.name === 'NotFoundError' && error.message === newAppVersionErrorMessage) {
830
759
  return React__default["default"].createElement(RefreshBannerInfo, null);
831
760
  }
832
-
833
761
  return fallback;
834
762
  }
835
-
836
763
  return children;
837
764
  };
838
-
839
765
  return ErrorBoundary;
840
766
  }(React.Component);
841
767
  var LANGUAGE_STORAGE_KEY = 'EP::locale';
842
-
843
768
  function RefreshBannerInfo() {
844
769
  // Taken from ./app-shell/src/storage.ts
845
770
  var language = localStorage.getItem(LANGUAGE_STORAGE_KEY);
@@ -860,25 +785,23 @@ function RefreshBannerInfo() {
860
785
  }, isNorwegian ? 'Oppdater' : 'Refresh')));
861
786
  }
862
787
 
863
- var _excluded$6 = ["date", "locale", "as", "hideTime"];
788
+ var _excluded$5 = ["date", "locale", "as", "hideTime"];
864
789
  var FormatDateTime = function FormatDateTime(_ref) {
865
790
  var date = _ref.date,
866
- locale = _ref.locale,
867
- _ref$as = _ref.as,
868
- Component = _ref$as === void 0 ? 'main' : _ref$as,
869
- hideTime = _ref.hideTime,
870
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$6);
871
-
791
+ locale = _ref.locale,
792
+ _ref$as = _ref.as,
793
+ Component = _ref$as === void 0 ? 'main' : _ref$as,
794
+ hideTime = _ref.hideTime,
795
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$5);
872
796
  return React__default["default"].createElement(Component, _extends({}, rest), hideTime ? util.localeDate(date, locale) : util.localeDateTime(date, locale));
873
797
  };
874
798
 
875
- var _excluded$5 = ["amount", "as"];
799
+ var _excluded$4 = ["amount", "as"];
876
800
  var FormatCurrencyAmount = function FormatCurrencyAmount(_ref) {
877
801
  var amount = _ref.amount,
878
- _ref$as = _ref.as,
879
- Component = _ref$as === void 0 ? 'span' : _ref$as,
880
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$5);
881
-
802
+ _ref$as = _ref.as,
803
+ Component = _ref$as === void 0 ? 'span' : _ref$as,
804
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
882
805
  var parsedAmount = Number(amount) || 0;
883
806
  var formattedAmount = new Intl.NumberFormat('nb-NO', {
884
807
  maximumFractionDigits: 2,
@@ -887,19 +810,18 @@ var FormatCurrencyAmount = function FormatCurrencyAmount(_ref) {
887
810
  return React__default["default"].createElement(Component, _extends({}, rest), formattedAmount);
888
811
  };
889
812
 
890
- var _excluded$4 = ["items", "locale", "className"];
813
+ var _excluded$3 = ["items", "locale", "className"];
891
814
  var AuditInfo = function AuditInfo(_ref) {
892
815
  var items = _ref.items,
893
- locale = _ref.locale,
894
- className = _ref.className,
895
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
896
-
816
+ locale = _ref.locale,
817
+ className = _ref.className,
818
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
897
819
  var classNames = cx__default["default"]('ep-audit-info', className);
898
820
  return React__default["default"].createElement("div", _extends({
899
821
  className: classNames
900
822
  }, rest), items.map(function (_ref2, i) {
901
823
  var label = _ref2.label,
902
- value = _ref2.value;
824
+ value = _ref2.value;
903
825
  return React__default["default"].createElement(Stack, {
904
826
  space: "small",
905
827
  key: i
@@ -912,21 +834,20 @@ var AuditInfo = function AuditInfo(_ref) {
912
834
  }));
913
835
  };
914
836
 
915
- var _excluded$3 = ["isOpen", "children", "message", "size", "buttons", "onConfirm", "messages", "onClose", "onDismiss"];
837
+ var _excluded$2 = ["isOpen", "children", "message", "size", "buttons", "onConfirm", "messages", "onClose", "onDismiss"];
916
838
  var ConfirmModal = function ConfirmModal(_ref) {
917
839
  var _ref$isOpen = _ref.isOpen,
918
- isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
919
- children = _ref.children,
920
- message = _ref.message,
921
- _ref$size = _ref.size,
922
- size = _ref$size === void 0 ? 'medium' : _ref$size,
923
- buttons = _ref.buttons,
924
- onConfirm = _ref.onConfirm,
925
- messages = _ref.messages,
926
- onClose = _ref.onClose,
927
- onDismiss = _ref.onDismiss,
928
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
929
-
840
+ isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
841
+ children = _ref.children,
842
+ message = _ref.message,
843
+ _ref$size = _ref.size,
844
+ size = _ref$size === void 0 ? 'medium' : _ref$size,
845
+ buttons = _ref.buttons,
846
+ onConfirm = _ref.onConfirm,
847
+ messages = _ref.messages,
848
+ onClose = _ref.onClose,
849
+ onDismiss = _ref.onDismiss,
850
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
930
851
  var childrenToRender = children ? children : message;
931
852
  var handleDismiss = onClose ? onClose : onDismiss;
932
853
  return React__default["default"].createElement(modal.Modal, _extends({
@@ -944,16 +865,15 @@ var ConfirmModal = function ConfirmModal(_ref) {
944
865
  }, messages.confirm)) : buttons));
945
866
  };
946
867
 
947
- var _excluded$2 = ["children", "shouldBlockNavigation"];
868
+ var _excluded$1 = ["children", "shouldBlockNavigation"];
948
869
  var RouteLeavingGuard = function RouteLeavingGuard(_ref) {
949
870
  var children = _ref.children,
950
- shouldBlockNavigation = _ref.shouldBlockNavigation,
951
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
952
-
871
+ shouldBlockNavigation = _ref.shouldBlockNavigation,
872
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
953
873
  util.assertIsDefined(reactRouterDom.useInRouterContext() ? true : undefined, "RouteLeavingGuard must be used within a data router.");
954
874
  var blocker = reactRouterDom.useBlocker(function (_ref2) {
955
875
  var currentLocation = _ref2.currentLocation,
956
- nextLocation = _ref2.nextLocation;
876
+ nextLocation = _ref2.nextLocation;
957
877
  return currentLocation.pathname !== nextLocation.pathname && shouldBlockNavigation(nextLocation);
958
878
  });
959
879
  return React__default["default"].createElement(ConfirmModal, _extends({
@@ -973,9 +893,9 @@ var RouteLeavingGuard = function RouteLeavingGuard(_ref) {
973
893
 
974
894
  var Pager = function Pager(_ref) {
975
895
  var collectionSize = _ref.collectionSize,
976
- pageSize = _ref.pageSize,
977
- _onPageChange = _ref.onPageChange,
978
- currentPage = _ref.currentPage;
896
+ pageSize = _ref.pageSize,
897
+ _onPageChange = _ref.onPageChange,
898
+ currentPage = _ref.currentPage;
979
899
  var pageCount = Math.ceil(collectionSize / pageSize);
980
900
  return React__default["default"].createElement(menu.Pagination, {
981
901
  pageCount: pageCount,
@@ -988,12 +908,12 @@ var Pager = function Pager(_ref) {
988
908
 
989
909
  var StatusLabel = function StatusLabel(_ref) {
990
910
  var _ref$active = _ref.active,
991
- active = _ref$active === void 0 ? false : _ref$active,
992
- _ref$label = _ref.label,
993
- label = _ref$label === void 0 ? '' : _ref$label,
994
- aggressiveInactive = _ref.aggressiveInactive,
995
- showBullet = _ref.showBullet,
996
- center = _ref.center;
911
+ active = _ref$active === void 0 ? false : _ref$active,
912
+ _ref$label = _ref.label,
913
+ label = _ref$label === void 0 ? '' : _ref$label,
914
+ aggressiveInactive = _ref.aggressiveInactive,
915
+ showBullet = _ref.showBullet,
916
+ center = _ref.center;
997
917
  var bulletClassNames = cx__default["default"]('eps-status-label__bullet', {
998
918
  active: active,
999
919
  aggressive: aggressiveInactive
@@ -1013,43 +933,25 @@ var StatusLabel = function StatusLabel(_ref) {
1013
933
  * check BusinessCapabilities but because it represents a minimal subset of
1014
934
  * what we need to check.
1015
935
  */
1016
-
1017
936
  var PermissionCheck = function PermissionCheck(_ref) {
1018
937
  var children = _ref.children,
1019
- _ref$fallback = _ref.fallback,
1020
- fallback = _ref$fallback === void 0 ? null : _ref$fallback,
1021
- permissions = _ref.permissions,
1022
- _ref$oneOf = _ref.oneOf,
1023
- oneOf = _ref$oneOf === void 0 ? [] : _ref$oneOf,
1024
- _ref$all = _ref.all,
1025
- all = _ref$all === void 0 ? [] : _ref$all;
938
+ _ref$fallback = _ref.fallback,
939
+ fallback = _ref$fallback === void 0 ? null : _ref$fallback,
940
+ permissions = _ref.permissions,
941
+ _ref$oneOf = _ref.oneOf,
942
+ oneOf = _ref$oneOf === void 0 ? [] : _ref$oneOf,
943
+ _ref$all = _ref.all,
944
+ all = _ref$all === void 0 ? [] : _ref$all;
1026
945
  var allIsAllowed = util.hasAllPermissions(all, permissions);
1027
946
  var oneOfIsAllowed = util.hasOneOfPermissions(oneOf, permissions);
1028
947
  var allowed = allIsAllowed && oneOfIsAllowed;
1029
948
  return React__default["default"].createElement(React__default["default"].Fragment, null, allowed ? children : fallback);
1030
949
  };
1031
950
 
1032
- var _excluded$1 = ["children", "actualPermissions", "all", "oneOf", "onReject"];
1033
- var PermissionCheckedRoute = function PermissionCheckedRoute(_ref) {
1034
- var children = _ref.children,
1035
- actualPermissions = _ref.actualPermissions,
1036
- all = _ref.all,
1037
- oneOf = _ref.oneOf,
1038
- onReject = _ref.onReject,
1039
- props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
1040
-
1041
- return React__default["default"].createElement(PermissionCheck, {
1042
- permissions: actualPermissions,
1043
- all: all,
1044
- oneOf: oneOf,
1045
- fallback: onReject != null ? onReject : reactRouterDom.redirect('/unauthorized')
1046
- }, React__default["default"].createElement(reactRouterDom.Route, _extends({}, props), children));
1047
- };
1048
-
1049
951
  var Breadcrumbs = function Breadcrumbs(_ref) {
1050
952
  var prependBreadcrumbItem = _ref.prependBreadcrumbItem,
1051
- pathname = _ref.pathname,
1052
- onBreadcrumbLookup = _ref.onBreadcrumbLookup;
953
+ pathname = _ref.pathname,
954
+ onBreadcrumbLookup = _ref.onBreadcrumbLookup;
1053
955
  var paths = util.splitUrlPath(pathname);
1054
956
  var breadcrumbs = paths.map(function (path) {
1055
957
  return {
@@ -1062,27 +964,23 @@ var Breadcrumbs = function Breadcrumbs(_ref) {
1062
964
  });
1063
965
  var breadcrumbElements = breadcrumbs.map(function (_ref3, i) {
1064
966
  var title = _ref3.title,
1065
- path = _ref3.path;
967
+ path = _ref3.path;
1066
968
  var isLast = i === breadcrumbs.length - 1;
1067
-
1068
969
  if (isLast) {
1069
970
  return React__default["default"].createElement(menu.BreadcrumbItem, {
1070
971
  key: path,
1071
972
  as: 'span'
1072
973
  }, title);
1073
974
  }
1074
-
1075
975
  return React__default["default"].createElement(menu.BreadcrumbItem, {
1076
976
  key: path,
1077
977
  as: reactRouterDom.Link,
1078
978
  to: path
1079
979
  }, title);
1080
980
  });
1081
-
1082
981
  if (prependBreadcrumbItem) {
1083
982
  return React__default["default"].createElement(menu.BreadcrumbNavigation, null, [prependBreadcrumbItem].concat(breadcrumbElements));
1084
983
  }
1085
-
1086
984
  return React__default["default"].createElement(menu.BreadcrumbNavigation, null, breadcrumbElements);
1087
985
  };
1088
986
 
@@ -1095,15 +993,14 @@ var Link = function Link(props) {
1095
993
  var _excluded = ["as", "children", "fontSize", "color", "lineHeight", "fontWeight", "className"];
1096
994
  var Text = function Text(_ref) {
1097
995
  var _ref$as = _ref.as,
1098
- component = _ref$as === void 0 ? 'span' : _ref$as,
1099
- children = _ref.children,
1100
- fontSize = _ref.fontSize,
1101
- color = _ref.color,
1102
- lineHeight = _ref.lineHeight,
1103
- fontWeight = _ref.fontWeight,
1104
- className = _ref.className,
1105
- rest = _objectWithoutPropertiesLoose(_ref, _excluded);
1106
-
996
+ component = _ref$as === void 0 ? 'span' : _ref$as,
997
+ children = _ref.children,
998
+ fontSize = _ref.fontSize,
999
+ color = _ref.color,
1000
+ lineHeight = _ref.lineHeight,
1001
+ fontWeight = _ref.fontWeight,
1002
+ className = _ref.className,
1003
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
1107
1004
  var classes = [];
1108
1005
  fontSize && classes.push.apply(classes, responsiveProp('eps-font-size-', fontSize));
1109
1006
  lineHeight && classes.push.apply(classes, responsiveProp('eps-line-height-', lineHeight));
@@ -1124,10 +1021,9 @@ var Text = function Text(_ref) {
1124
1021
  * @param Props.onBreadcrumbLookup - A function that takes a path and returns a i18n translated string or undefined
1125
1022
  * @returns A Helmet component with updated title
1126
1023
  */
1127
-
1128
1024
  function PageTitle(_ref) {
1129
1025
  var pathname = _ref.pathname,
1130
- onBreadcrumbLookup = _ref.onBreadcrumbLookup;
1026
+ onBreadcrumbLookup = _ref.onBreadcrumbLookup;
1131
1027
  var paths = util.splitUrlPath(pathname);
1132
1028
  var pageTitles = paths.map(function (path) {
1133
1029
  return {
@@ -1168,7 +1064,6 @@ exports.OrganisationDropDown = OrganisationDropDown;
1168
1064
  exports.PageTitle = PageTitle;
1169
1065
  exports.Pager = Pager;
1170
1066
  exports.PermissionCheck = PermissionCheck;
1171
- exports.PermissionCheckedRoute = PermissionCheckedRoute;
1172
1067
  exports.RouteLeavingGuard = RouteLeavingGuard;
1173
1068
  exports.Stack = Stack;
1174
1069
  exports.StatusLabel = StatusLabel;