@entur-partner/common 4.0.3 → 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)
@@ -697,12 +717,10 @@ var ErrorBoundary = /*#__PURE__*/function (_Component) {
697
717
  var _proto = ErrorBoundary.prototype;
698
718
 
699
719
  _proto.componentDidCatch = function componentDidCatch(error, errorInfo) {
700
- // React always logs in development
701
- if (process.env.NODE_ENV === 'production') {
702
- var _this$props$handleErr, _this$props;
720
+ var _this$props$handleErr, _this$props;
703
721
 
704
- (_this$props$handleErr = (_this$props = this.props).handleError) == null ? void 0 : _this$props$handleErr.call(_this$props, error, errorInfo);
705
- }
722
+ // React always logs in development
723
+ (_this$props$handleErr = (_this$props = this.props).handleError) == null ? void 0 : _this$props$handleErr.call(_this$props, error, errorInfo);
706
724
  };
707
725
 
708
726
  _proto.render = function render() {
@@ -734,39 +752,42 @@ var ErrorBoundary = /*#__PURE__*/function (_Component) {
734
752
  return ErrorBoundary;
735
753
  }(Component);
736
754
 
755
+ var _excluded$6 = ["date", "locale", "as", "hideTime"];
737
756
  var FormatDateTime = function FormatDateTime(_ref) {
738
757
  var date = _ref.date,
739
758
  locale = _ref.locale,
740
759
  _ref$as = _ref.as,
741
760
  Component = _ref$as === void 0 ? 'main' : _ref$as,
742
761
  hideTime = _ref.hideTime,
743
- rest = _objectWithoutPropertiesLoose(_ref, ["date", "locale", "as", "hideTime"]);
762
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$6);
744
763
 
745
- 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));
746
765
  };
747
766
 
767
+ var _excluded$5 = ["amount", "as"];
748
768
  var FormatCurrencyAmount = function FormatCurrencyAmount(_ref) {
749
769
  var amount = _ref.amount,
750
770
  _ref$as = _ref.as,
751
771
  Component = _ref$as === void 0 ? 'span' : _ref$as,
752
- rest = _objectWithoutPropertiesLoose(_ref, ["amount", "as"]);
772
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$5);
753
773
 
754
774
  var parsedAmount = Number(amount) || 0;
755
775
  var formattedAmount = new Intl.NumberFormat('nb-NO', {
756
776
  maximumFractionDigits: 2,
757
777
  minimumFractionDigits: 2
758
778
  }).format(parsedAmount);
759
- return React.createElement(Component, Object.assign({}, rest), formattedAmount);
779
+ return React.createElement(Component, _extends({}, rest), formattedAmount);
760
780
  };
761
781
 
782
+ var _excluded$4 = ["items", "locale", "className"];
762
783
  var AuditInfo = function AuditInfo(_ref) {
763
784
  var items = _ref.items,
764
785
  locale = _ref.locale,
765
786
  className = _ref.className,
766
- rest = _objectWithoutPropertiesLoose(_ref, ["items", "locale", "className"]);
787
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
767
788
 
768
789
  var classNames = cx('ep-audit-info', className);
769
- return React.createElement("div", Object.assign({
790
+ return React.createElement("div", _extends({
770
791
  className: classNames
771
792
  }, rest), items.map(function (_ref2, i) {
772
793
  var label = _ref2.label,
@@ -783,6 +804,7 @@ var AuditInfo = function AuditInfo(_ref) {
783
804
  }));
784
805
  };
785
806
 
807
+ var _excluded$3 = ["isOpen", "children", "message", "size", "buttons", "onConfirm", "messages", "onClose", "onDismiss"];
786
808
  var ConfirmModal = function ConfirmModal(_ref) {
787
809
  var _ref$isOpen = _ref.isOpen,
788
810
  isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
@@ -795,11 +817,11 @@ var ConfirmModal = function ConfirmModal(_ref) {
795
817
  messages = _ref.messages,
796
818
  onClose = _ref.onClose,
797
819
  onDismiss = _ref.onDismiss,
798
- rest = _objectWithoutPropertiesLoose(_ref, ["isOpen", "children", "message", "size", "buttons", "onConfirm", "messages", "onClose", "onDismiss"]);
820
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
799
821
 
800
822
  var childrenToRender = children ? children : message;
801
823
  var handleDismiss = onClose ? onClose : onDismiss;
802
- return React.createElement(Modal, Object.assign({
824
+ return React.createElement(Modal, _extends({
803
825
  size: size,
804
826
  open: isOpen,
805
827
  onDismiss: handleDismiss
@@ -814,10 +836,11 @@ var ConfirmModal = function ConfirmModal(_ref) {
814
836
  }, messages.confirm)) : buttons));
815
837
  };
816
838
 
839
+ var _excluded$2 = ["children", "shouldBlockNavigation"];
817
840
  var RouteLeavingGuard = function RouteLeavingGuard(_ref) {
818
841
  var children = _ref.children,
819
842
  shouldBlockNavigation = _ref.shouldBlockNavigation,
820
- rest = _objectWithoutPropertiesLoose(_ref, ["children", "shouldBlockNavigation"]);
843
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
821
844
 
822
845
  var history = useHistory();
823
846
 
@@ -849,7 +872,7 @@ var RouteLeavingGuard = function RouteLeavingGuard(_ref) {
849
872
 
850
873
  return React.createElement(React.Fragment, null, React.createElement(Prompt, {
851
874
  message: allowNavigation
852
- }), React.createElement(ConfirmModal, Object.assign({
875
+ }), React.createElement(ConfirmModal, _extends({
853
876
  onDismiss: closeModal,
854
877
  open: status === 'BLOCKED',
855
878
  onConfirm: handleConfirm
@@ -914,13 +937,14 @@ var PermissionCheck = function PermissionCheck(_ref) {
914
937
  return React.createElement(React.Fragment, null, allowed ? children : fallback);
915
938
  };
916
939
 
940
+ var _excluded$1 = ["children", "actualPermissions", "all", "oneOf", "onReject"];
917
941
  var PermissionCheckedRoute = function PermissionCheckedRoute(_ref) {
918
942
  var children = _ref.children,
919
943
  actualPermissions = _ref.actualPermissions,
920
944
  all = _ref.all,
921
945
  oneOf = _ref.oneOf,
922
946
  onReject = _ref.onReject,
923
- props = _objectWithoutPropertiesLoose(_ref, ["children", "actualPermissions", "all", "oneOf", "onReject"]);
947
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
924
948
 
925
949
  var redirect = React.createElement(Redirect, {
926
950
  to: {
@@ -935,7 +959,7 @@ var PermissionCheckedRoute = function PermissionCheckedRoute(_ref) {
935
959
  all: all,
936
960
  oneOf: oneOf,
937
961
  fallback: onReject ? onReject : redirect
938
- }, React.createElement(Route, Object.assign({}, props), children));
962
+ }, React.createElement(Route, _extends({}, props), children));
939
963
  };
940
964
 
941
965
  var Breadcrumbs = function Breadcrumbs(_ref) {
@@ -986,11 +1010,12 @@ var Breadcrumbs = function Breadcrumbs(_ref) {
986
1010
  };
987
1011
 
988
1012
  var Link = function Link(props) {
989
- return React.createElement(Link$1, Object.assign({}, props, {
1013
+ return React.createElement(Link$1, _extends({}, props, {
990
1014
  as: Link$2
991
1015
  }), props.children);
992
1016
  };
993
1017
 
1018
+ var _excluded = ["as", "children", "fontSize", "color", "lineHeight", "fontWeight", "className"];
994
1019
  var Text = function Text(_ref) {
995
1020
  var _ref$as = _ref.as,
996
1021
  component = _ref$as === void 0 ? 'span' : _ref$as,
@@ -1000,14 +1025,14 @@ var Text = function Text(_ref) {
1000
1025
  lineHeight = _ref.lineHeight,
1001
1026
  fontWeight = _ref.fontWeight,
1002
1027
  className = _ref.className,
1003
- rest = _objectWithoutPropertiesLoose(_ref, ["as", "children", "fontSize", "color", "lineHeight", "fontWeight", "className"]);
1028
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
1004
1029
 
1005
1030
  var classes = [];
1006
1031
  fontSize && classes.push.apply(classes, responsiveProp('eps-font-size-', fontSize));
1007
1032
  lineHeight && classes.push.apply(classes, responsiveProp('eps-line-height-', lineHeight));
1008
1033
  fontWeight && classes.push('eps-font-weight-' + fontWeight);
1009
1034
  var classList = cx(classes, className);
1010
- return React.createElement(Box, Object.assign({
1035
+ return React.createElement(Box, _extends({
1011
1036
  as: component,
1012
1037
  color: color,
1013
1038
  className: classList