@entur-partner/common 4.0.6 → 4.0.7

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.
@@ -32,7 +32,17 @@ function _extends() {
32
32
  function _inheritsLoose(subClass, superClass) {
33
33
  subClass.prototype = Object.create(superClass.prototype);
34
34
  subClass.prototype.constructor = subClass;
35
- subClass.__proto__ = superClass;
35
+
36
+ _setPrototypeOf(subClass, superClass);
37
+ }
38
+
39
+ function _setPrototypeOf(o, p) {
40
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
41
+ o.__proto__ = p;
42
+ return o;
43
+ };
44
+
45
+ return _setPrototypeOf(o, p);
36
46
  }
37
47
 
38
48
  function _objectWithoutPropertiesLoose(source, excluded) {
@@ -50,6 +60,7 @@ function _objectWithoutPropertiesLoose(source, excluded) {
50
60
  return target;
51
61
  }
52
62
 
63
+ var _excluded$f = ["as", "children", "contrast", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "paddingX", "paddingY", "padding", "marginTop", "marginRight", "marginBottom", "marginLeft", "marginX", "marginY", "margin", "display", "justifyContent", "maxWidth", "width", "background", "color", "flexDirection", "flexWrap", "className"];
53
64
  function responsiveProp(prefix, prop) {
54
65
  if (Array.isArray(prop)) {
55
66
  var classes = [];
@@ -89,7 +100,7 @@ var Box = function Box(_ref) {
89
100
  flexDirection = _ref.flexDirection,
90
101
  flexWrap = _ref.flexWrap,
91
102
  className = _ref.className,
92
- rest = _objectWithoutPropertiesLoose(_ref, ["as", "children", "contrast", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "paddingX", "paddingY", "padding", "marginTop", "marginRight", "marginBottom", "marginLeft", "marginX", "marginY", "margin", "display", "justifyContent", "maxWidth", "width", "background", "color", "flexDirection", "flexWrap", "className"]);
103
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$f);
93
104
 
94
105
  var classes = [];
95
106
  var resolvedPaddingTop = paddingTop || paddingY || padding;
@@ -118,7 +129,7 @@ var Box = function Box(_ref) {
118
129
  flexDirection && classes.push.apply(classes, responsiveProp('eps-flex-', flexDirection));
119
130
  flexWrap && classes.push.apply(classes, responsiveProp('eps-flex-wrap-', flexWrap));
120
131
  var classList = cx(classes, className);
121
- return React.createElement(Component, Object.assign({
132
+ return React.createElement(Component, _extends({
122
133
  className: classList
123
134
  }, rest), children);
124
135
  };
@@ -168,12 +179,13 @@ var ActionBar = function ActionBar(_ref3) {
168
179
  }, children));
169
180
  };
170
181
 
182
+ var _excluded$e = ["children", "className"];
171
183
  var LinkButton = function LinkButton(_ref) {
172
184
  var children = _ref.children,
173
185
  className = _ref.className,
174
- rest = _objectWithoutPropertiesLoose(_ref, ["children", "className"]);
186
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$e);
175
187
 
176
- return React.createElement(Link$1, Object.assign({}, rest, {
188
+ return React.createElement(Link$1, _extends({}, rest, {
177
189
  as: "button",
178
190
  className: cx('eps-link-button', className)
179
191
  }), children);
@@ -208,11 +220,12 @@ var FeatureToggle = function FeatureToggle(_ref) {
208
220
  return null;
209
221
  };
210
222
 
223
+ var _excluded$d = ["title"];
211
224
  var EnturPartnerLogoSvg = function EnturPartnerLogoSvg(_ref) {
212
225
  var title = _ref.title,
213
- rest = _objectWithoutPropertiesLoose(_ref, ["title"]);
226
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$d);
214
227
 
215
- return React.createElement("svg", Object.assign({
228
+ return React.createElement("svg", _extends({
216
229
  width: 257,
217
230
  height: 37,
218
231
  viewBox: "0 0 257 37"
@@ -270,6 +283,7 @@ var Content = function Content(_ref) {
270
283
  }, children);
271
284
  };
272
285
 
286
+ var _excluded$c = ["className", "children", "userName", "open", "onOpenChange"];
273
287
  var UserMenu = function UserMenu(_ref) {
274
288
  var className = _ref.className,
275
289
  messages = _ref.messages,
@@ -352,7 +366,7 @@ var CustomOverflowMenu = function CustomOverflowMenu(_ref2) {
352
366
  userName = _ref2.userName,
353
367
  open = _ref2.open,
354
368
  onOpenChange = _ref2.onOpenChange,
355
- rest = _objectWithoutPropertiesLoose(_ref2, ["className", "children", "userName", "open", "onOpenChange"]);
369
+ rest = _objectWithoutPropertiesLoose(_ref2, _excluded$c);
356
370
 
357
371
  var overflowItemsClasses = cx('eps-overflow-menu__group', {
358
372
  'eps-overflow-menu__group--open': open
@@ -362,7 +376,7 @@ var CustomOverflowMenu = function CustomOverflowMenu(_ref2) {
362
376
  useOutsideClick(overflowContentRef, overflowMenuTriggerRef, function () {
363
377
  return onOpenChange(false);
364
378
  });
365
- return React.createElement("div", null, React.createElement(SecondaryButton, Object.assign({
379
+ return React.createElement("div", null, React.createElement(SecondaryButton, _extends({
366
380
  className: cx('eps-overflow-menu__button', className),
367
381
  onClick: function onClick() {
368
382
  return onOpenChange(open ? false : true);
@@ -392,7 +406,7 @@ var CustomOverflowMenu = function CustomOverflowMenu(_ref2) {
392
406
  };
393
407
 
394
408
  var CustomOverflowMenuItem = function CustomOverflowMenuItem(props) {
395
- return React.createElement("button", Object.assign({
409
+ return React.createElement("button", _extends({
396
410
  className: cx(props.className, 'eps-overflow-menu__item'),
397
411
  role: "menuitem"
398
412
  }, props));
@@ -441,17 +455,18 @@ function useOutsideClick(ref, buttonRef, handler) {
441
455
  }, [ref, buttonRef, handler]);
442
456
  }
443
457
 
458
+ var _excluded$b = ["label", "organisations", "onChange", "selectedOrganisationId"];
444
459
  var OrganisationDropDown = function OrganisationDropDown(_ref) {
445
460
  var label = _ref.label,
446
461
  organisations = _ref.organisations,
447
462
  handleChange = _ref.onChange,
448
463
  selectedOrganisationId = _ref.selectedOrganisationId,
449
- rest = _objectWithoutPropertiesLoose(_ref, ["label", "organisations", "onChange", "selectedOrganisationId"]);
464
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$b);
450
465
 
451
466
  var selectedOrganisation = organisations.find(function (org) {
452
467
  return org.id === selectedOrganisationId;
453
468
  });
454
- return React.createElement(Dropdown, Object.assign({
469
+ return React.createElement(Dropdown, _extends({
455
470
  label: label,
456
471
  searchable: true,
457
472
  clearable: true,
@@ -476,6 +491,7 @@ var OrganisationDropDown = function OrganisationDropDown(_ref) {
476
491
  }, rest));
477
492
  };
478
493
 
494
+ /*global EventListener WindowEventHandlers*/
479
495
  function useEventListener(eventName, handler, element) {
480
496
  if (element === void 0) {
481
497
  element = window;
@@ -500,15 +516,16 @@ function useEventListener(eventName, handler, element) {
500
516
  }, [eventName, element]);
501
517
  }
502
518
 
519
+ var _excluded$a = ["language", "options", "className", "onChange"];
503
520
  var LanguageSelect = function LanguageSelect(_ref) {
504
521
  var language = _ref.language,
505
522
  options = _ref.options,
506
523
  className = _ref.className,
507
524
  _onChange = _ref.onChange,
508
- rest = _objectWithoutPropertiesLoose(_ref, ["language", "options", "className", "onChange"]);
525
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$a);
509
526
 
510
527
  var classNames = cx('eps-language-select', className);
511
- return React.createElement("div", Object.assign({}, rest, {
528
+ return React.createElement("div", _extends({}, rest, {
512
529
  className: classNames
513
530
  }), React.createElement(SegmentedControl, {
514
531
  onChange: function onChange(language) {
@@ -527,6 +544,7 @@ var LanguageSelect = function LanguageSelect(_ref) {
527
544
  })));
528
545
  };
529
546
 
547
+ var _excluded$9 = ["title", "inputComponent", "languages", "values", "onChange", "name", "variant", "feedback"];
530
548
  var ExpandableMultiLanguageInput = function ExpandableMultiLanguageInput(_ref) {
531
549
  var title = _ref.title,
532
550
  InputComponent = _ref.inputComponent,
@@ -536,7 +554,7 @@ var ExpandableMultiLanguageInput = function ExpandableMultiLanguageInput(_ref) {
536
554
  name = _ref.name,
537
555
  variant = _ref.variant,
538
556
  feedback = _ref.feedback,
539
- rest = _objectWithoutPropertiesLoose(_ref, ["title", "inputComponent", "languages", "values", "onChange", "name", "variant", "feedback"]);
557
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$9);
540
558
 
541
559
  var handleOnChange = function handleOnChange(language, value) {
542
560
  var changes = _extends({}, values);
@@ -564,7 +582,7 @@ var ExpandableMultiLanguageInput = function ExpandableMultiLanguageInput(_ref) {
564
582
  var langKey = _ref2.value,
565
583
  label = _ref2.label,
566
584
  required = _ref2.required;
567
- return React.createElement(InputComponent, Object.assign({
585
+ return React.createElement(InputComponent, _extends({
568
586
  "data-testid": "multi-lang-input-" + name + "-" + langKey,
569
587
  key: title + langKey,
570
588
  label: required ? label + '*' : label,
@@ -579,6 +597,7 @@ var ExpandableMultiLanguageInput = function ExpandableMultiLanguageInput(_ref) {
579
597
  })));
580
598
  };
581
599
 
600
+ var _excluded$8 = ["className", "inputComponent", "alertLabel", "alertLevel", "name", "languages", "values", "onChange", "defaultLanguage", "label", "onBlur"];
582
601
  /**
583
602
  * @deprecated use ExpandableMultiLanguageInput
584
603
  */
@@ -598,7 +617,7 @@ var MultiLanguageInput = function MultiLanguageInput(_ref) {
598
617
  label = _ref$label === void 0 ? '' : _ref$label,
599
618
  _ref$onBlur = _ref.onBlur,
600
619
  onBlur = _ref$onBlur === void 0 ? function () {} : _ref$onBlur,
601
- rest = _objectWithoutPropertiesLoose(_ref, ["className", "inputComponent", "alertLabel", "alertLevel", "name", "languages", "values", "onChange", "defaultLanguage", "label", "onBlur"]);
620
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$8);
602
621
 
603
622
  var _useState = useState(defaultLanguage),
604
623
  language = _useState[0],
@@ -646,7 +665,7 @@ var MultiLanguageInput = function MultiLanguageInput(_ref) {
646
665
  onChange: function onChange(lang) {
647
666
  return handleLanguageChange(lang);
648
667
  }
649
- }), React.createElement(InputComponent, Object.assign({
668
+ }), React.createElement(InputComponent, _extends({
650
669
  label: label,
651
670
  variant: alertLevel,
652
671
  feedback: alertLabel,
@@ -659,12 +678,13 @@ var MultiLanguageInput = function MultiLanguageInput(_ref) {
659
678
  }, rest))));
660
679
  };
661
680
 
681
+ var _excluded$7 = ["children", "className"];
662
682
  var Unbutton = function Unbutton(_ref) {
663
683
  var children = _ref.children,
664
684
  className = _ref.className,
665
- rest = _objectWithoutPropertiesLoose(_ref, ["children", "className"]);
685
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$7);
666
686
 
667
- return React.createElement(Button, Object.assign({
687
+ return React.createElement(Button, _extends({
668
688
  variant: "primary"
669
689
  }, rest, {
670
690
  className: cx('eps-unbutton', className)
@@ -732,39 +752,42 @@ var ErrorBoundary = /*#__PURE__*/function (_Component) {
732
752
  return ErrorBoundary;
733
753
  }(Component);
734
754
 
755
+ var _excluded$6 = ["date", "locale", "as", "hideTime"];
735
756
  var FormatDateTime = function FormatDateTime(_ref) {
736
757
  var date = _ref.date,
737
758
  locale = _ref.locale,
738
759
  _ref$as = _ref.as,
739
760
  Component = _ref$as === void 0 ? 'main' : _ref$as,
740
761
  hideTime = _ref.hideTime,
741
- rest = _objectWithoutPropertiesLoose(_ref, ["date", "locale", "as", "hideTime"]);
762
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$6);
742
763
 
743
- return React.createElement(Component, Object.assign({}, rest), hideTime ? localeDate(date, locale) : localeDateTime(date, locale));
764
+ return React.createElement(Component, _extends({}, rest), hideTime ? localeDate(date, locale) : localeDateTime(date, locale));
744
765
  };
745
766
 
767
+ var _excluded$5 = ["amount", "as"];
746
768
  var FormatCurrencyAmount = function FormatCurrencyAmount(_ref) {
747
769
  var amount = _ref.amount,
748
770
  _ref$as = _ref.as,
749
771
  Component = _ref$as === void 0 ? 'span' : _ref$as,
750
- rest = _objectWithoutPropertiesLoose(_ref, ["amount", "as"]);
772
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$5);
751
773
 
752
774
  var parsedAmount = Number(amount) || 0;
753
775
  var formattedAmount = new Intl.NumberFormat('nb-NO', {
754
776
  maximumFractionDigits: 2,
755
777
  minimumFractionDigits: 2
756
778
  }).format(parsedAmount);
757
- return React.createElement(Component, Object.assign({}, rest), formattedAmount);
779
+ return React.createElement(Component, _extends({}, rest), formattedAmount);
758
780
  };
759
781
 
782
+ var _excluded$4 = ["items", "locale", "className"];
760
783
  var AuditInfo = function AuditInfo(_ref) {
761
784
  var items = _ref.items,
762
785
  locale = _ref.locale,
763
786
  className = _ref.className,
764
- rest = _objectWithoutPropertiesLoose(_ref, ["items", "locale", "className"]);
787
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
765
788
 
766
789
  var classNames = cx('ep-audit-info', className);
767
- return React.createElement("div", Object.assign({
790
+ return React.createElement("div", _extends({
768
791
  className: classNames
769
792
  }, rest), items.map(function (_ref2, i) {
770
793
  var label = _ref2.label,
@@ -781,6 +804,7 @@ var AuditInfo = function AuditInfo(_ref) {
781
804
  }));
782
805
  };
783
806
 
807
+ var _excluded$3 = ["isOpen", "children", "message", "size", "buttons", "onConfirm", "messages", "onClose", "onDismiss"];
784
808
  var ConfirmModal = function ConfirmModal(_ref) {
785
809
  var _ref$isOpen = _ref.isOpen,
786
810
  isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
@@ -793,11 +817,11 @@ var ConfirmModal = function ConfirmModal(_ref) {
793
817
  messages = _ref.messages,
794
818
  onClose = _ref.onClose,
795
819
  onDismiss = _ref.onDismiss,
796
- rest = _objectWithoutPropertiesLoose(_ref, ["isOpen", "children", "message", "size", "buttons", "onConfirm", "messages", "onClose", "onDismiss"]);
820
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
797
821
 
798
822
  var childrenToRender = children ? children : message;
799
823
  var handleDismiss = onClose ? onClose : onDismiss;
800
- return React.createElement(Modal, Object.assign({
824
+ return React.createElement(Modal, _extends({
801
825
  size: size,
802
826
  open: isOpen,
803
827
  onDismiss: handleDismiss
@@ -812,10 +836,11 @@ var ConfirmModal = function ConfirmModal(_ref) {
812
836
  }, messages.confirm)) : buttons));
813
837
  };
814
838
 
839
+ var _excluded$2 = ["children", "shouldBlockNavigation"];
815
840
  var RouteLeavingGuard = function RouteLeavingGuard(_ref) {
816
841
  var children = _ref.children,
817
842
  shouldBlockNavigation = _ref.shouldBlockNavigation,
818
- rest = _objectWithoutPropertiesLoose(_ref, ["children", "shouldBlockNavigation"]);
843
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
819
844
 
820
845
  var history = useHistory();
821
846
 
@@ -847,7 +872,7 @@ var RouteLeavingGuard = function RouteLeavingGuard(_ref) {
847
872
 
848
873
  return React.createElement(React.Fragment, null, React.createElement(Prompt, {
849
874
  message: allowNavigation
850
- }), React.createElement(ConfirmModal, Object.assign({
875
+ }), React.createElement(ConfirmModal, _extends({
851
876
  onDismiss: closeModal,
852
877
  open: status === 'BLOCKED',
853
878
  onConfirm: handleConfirm
@@ -912,13 +937,14 @@ var PermissionCheck = function PermissionCheck(_ref) {
912
937
  return React.createElement(React.Fragment, null, allowed ? children : fallback);
913
938
  };
914
939
 
940
+ var _excluded$1 = ["children", "actualPermissions", "all", "oneOf", "onReject"];
915
941
  var PermissionCheckedRoute = function PermissionCheckedRoute(_ref) {
916
942
  var children = _ref.children,
917
943
  actualPermissions = _ref.actualPermissions,
918
944
  all = _ref.all,
919
945
  oneOf = _ref.oneOf,
920
946
  onReject = _ref.onReject,
921
- props = _objectWithoutPropertiesLoose(_ref, ["children", "actualPermissions", "all", "oneOf", "onReject"]);
947
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
922
948
 
923
949
  var redirect = React.createElement(Redirect, {
924
950
  to: {
@@ -933,7 +959,7 @@ var PermissionCheckedRoute = function PermissionCheckedRoute(_ref) {
933
959
  all: all,
934
960
  oneOf: oneOf,
935
961
  fallback: onReject ? onReject : redirect
936
- }, React.createElement(Route, Object.assign({}, props), children));
962
+ }, React.createElement(Route, _extends({}, props), children));
937
963
  };
938
964
 
939
965
  var Breadcrumbs = function Breadcrumbs(_ref) {
@@ -984,11 +1010,12 @@ var Breadcrumbs = function Breadcrumbs(_ref) {
984
1010
  };
985
1011
 
986
1012
  var Link = function Link(props) {
987
- return React.createElement(Link$1, Object.assign({}, props, {
1013
+ return React.createElement(Link$1, _extends({}, props, {
988
1014
  as: Link$2
989
1015
  }), props.children);
990
1016
  };
991
1017
 
1018
+ var _excluded = ["as", "children", "fontSize", "color", "lineHeight", "fontWeight", "className"];
992
1019
  var Text = function Text(_ref) {
993
1020
  var _ref$as = _ref.as,
994
1021
  component = _ref$as === void 0 ? 'span' : _ref$as,
@@ -998,14 +1025,14 @@ var Text = function Text(_ref) {
998
1025
  lineHeight = _ref.lineHeight,
999
1026
  fontWeight = _ref.fontWeight,
1000
1027
  className = _ref.className,
1001
- rest = _objectWithoutPropertiesLoose(_ref, ["as", "children", "fontSize", "color", "lineHeight", "fontWeight", "className"]);
1028
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
1002
1029
 
1003
1030
  var classes = [];
1004
1031
  fontSize && classes.push.apply(classes, responsiveProp('eps-font-size-', fontSize));
1005
1032
  lineHeight && classes.push.apply(classes, responsiveProp('eps-line-height-', lineHeight));
1006
1033
  fontWeight && classes.push('eps-font-weight-' + fontWeight);
1007
1034
  var classList = cx(classes, className);
1008
- return React.createElement(Box, Object.assign({
1035
+ return React.createElement(Box, _extends({
1009
1036
  as: component,
1010
1037
  color: color,
1011
1038
  className: classList