@entur-partner/common 4.0.5 → 4.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.
@@ -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", "alignItems", "maxWidth", "width", "background", "color", "flexDirection", "flexWrap", "className"];
53
64
  function responsiveProp(prefix, prop) {
54
65
  if (Array.isArray(prop)) {
55
66
  var classes = [];
@@ -82,6 +93,7 @@ var Box = function Box(_ref) {
82
93
  margin = _ref.margin,
83
94
  display = _ref.display,
84
95
  justifyContent = _ref.justifyContent,
96
+ alignItems = _ref.alignItems,
85
97
  maxWidth = _ref.maxWidth,
86
98
  width = _ref.width,
87
99
  background = _ref.background,
@@ -89,7 +101,7 @@ var Box = function Box(_ref) {
89
101
  flexDirection = _ref.flexDirection,
90
102
  flexWrap = _ref.flexWrap,
91
103
  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"]);
104
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$f);
93
105
 
94
106
  var classes = [];
95
107
  var resolvedPaddingTop = paddingTop || paddingY || padding;
@@ -111,6 +123,11 @@ var Box = function Box(_ref) {
111
123
  resolvedMarginRight && classes.push.apply(classes, responsiveProp('eps-mr-', resolvedMarginRight));
112
124
  display && classes.push.apply(classes, responsiveProp('eps-', display));
113
125
  justifyContent && classes.push.apply(classes, responsiveProp('eps-justify-', justifyContent));
126
+
127
+ if (alignItems) {
128
+ classes.push.apply(classes, responsiveProp('eps-items-', alignItems));
129
+ }
130
+
114
131
  maxWidth && classes.push.apply(classes, responsiveProp('eps-max-w-', maxWidth));
115
132
  width && classes.push.apply(classes, responsiveProp('eps-w-', width));
116
133
  color && classes.push("eps-color-" + color);
@@ -118,7 +135,7 @@ var Box = function Box(_ref) {
118
135
  flexDirection && classes.push.apply(classes, responsiveProp('eps-flex-', flexDirection));
119
136
  flexWrap && classes.push.apply(classes, responsiveProp('eps-flex-wrap-', flexWrap));
120
137
  var classList = cx(classes, className);
121
- return React.createElement(Component, Object.assign({
138
+ return React.createElement(Component, _extends({
122
139
  className: classList
123
140
  }, rest), children);
124
141
  };
@@ -168,12 +185,13 @@ var ActionBar = function ActionBar(_ref3) {
168
185
  }, children));
169
186
  };
170
187
 
188
+ var _excluded$e = ["children", "className"];
171
189
  var LinkButton = function LinkButton(_ref) {
172
190
  var children = _ref.children,
173
191
  className = _ref.className,
174
- rest = _objectWithoutPropertiesLoose(_ref, ["children", "className"]);
192
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$e);
175
193
 
176
- return React.createElement(Link$1, Object.assign({}, rest, {
194
+ return React.createElement(Link$1, _extends({}, rest, {
177
195
  as: "button",
178
196
  className: cx('eps-link-button', className)
179
197
  }), children);
@@ -208,11 +226,12 @@ var FeatureToggle = function FeatureToggle(_ref) {
208
226
  return null;
209
227
  };
210
228
 
229
+ var _excluded$d = ["title"];
211
230
  var EnturPartnerLogoSvg = function EnturPartnerLogoSvg(_ref) {
212
231
  var title = _ref.title,
213
- rest = _objectWithoutPropertiesLoose(_ref, ["title"]);
232
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$d);
214
233
 
215
- return React.createElement("svg", Object.assign({
234
+ return React.createElement("svg", _extends({
216
235
  width: 257,
217
236
  height: 37,
218
237
  viewBox: "0 0 257 37"
@@ -270,6 +289,7 @@ var Content = function Content(_ref) {
270
289
  }, children);
271
290
  };
272
291
 
292
+ var _excluded$c = ["className", "children", "userName", "open", "onOpenChange"];
273
293
  var UserMenu = function UserMenu(_ref) {
274
294
  var className = _ref.className,
275
295
  messages = _ref.messages,
@@ -352,7 +372,7 @@ var CustomOverflowMenu = function CustomOverflowMenu(_ref2) {
352
372
  userName = _ref2.userName,
353
373
  open = _ref2.open,
354
374
  onOpenChange = _ref2.onOpenChange,
355
- rest = _objectWithoutPropertiesLoose(_ref2, ["className", "children", "userName", "open", "onOpenChange"]);
375
+ rest = _objectWithoutPropertiesLoose(_ref2, _excluded$c);
356
376
 
357
377
  var overflowItemsClasses = cx('eps-overflow-menu__group', {
358
378
  'eps-overflow-menu__group--open': open
@@ -362,7 +382,7 @@ var CustomOverflowMenu = function CustomOverflowMenu(_ref2) {
362
382
  useOutsideClick(overflowContentRef, overflowMenuTriggerRef, function () {
363
383
  return onOpenChange(false);
364
384
  });
365
- return React.createElement("div", null, React.createElement(SecondaryButton, Object.assign({
385
+ return React.createElement("div", null, React.createElement(SecondaryButton, _extends({
366
386
  className: cx('eps-overflow-menu__button', className),
367
387
  onClick: function onClick() {
368
388
  return onOpenChange(open ? false : true);
@@ -392,7 +412,7 @@ var CustomOverflowMenu = function CustomOverflowMenu(_ref2) {
392
412
  };
393
413
 
394
414
  var CustomOverflowMenuItem = function CustomOverflowMenuItem(props) {
395
- return React.createElement("button", Object.assign({
415
+ return React.createElement("button", _extends({
396
416
  className: cx(props.className, 'eps-overflow-menu__item'),
397
417
  role: "menuitem"
398
418
  }, props));
@@ -441,17 +461,18 @@ function useOutsideClick(ref, buttonRef, handler) {
441
461
  }, [ref, buttonRef, handler]);
442
462
  }
443
463
 
464
+ var _excluded$b = ["label", "organisations", "onChange", "selectedOrganisationId"];
444
465
  var OrganisationDropDown = function OrganisationDropDown(_ref) {
445
466
  var label = _ref.label,
446
467
  organisations = _ref.organisations,
447
468
  handleChange = _ref.onChange,
448
469
  selectedOrganisationId = _ref.selectedOrganisationId,
449
- rest = _objectWithoutPropertiesLoose(_ref, ["label", "organisations", "onChange", "selectedOrganisationId"]);
470
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$b);
450
471
 
451
472
  var selectedOrganisation = organisations.find(function (org) {
452
473
  return org.id === selectedOrganisationId;
453
474
  });
454
- return React.createElement(Dropdown, Object.assign({
475
+ return React.createElement(Dropdown, _extends({
455
476
  label: label,
456
477
  searchable: true,
457
478
  clearable: true,
@@ -476,6 +497,7 @@ var OrganisationDropDown = function OrganisationDropDown(_ref) {
476
497
  }, rest));
477
498
  };
478
499
 
500
+ /*global EventListener WindowEventHandlers*/
479
501
  function useEventListener(eventName, handler, element) {
480
502
  if (element === void 0) {
481
503
  element = window;
@@ -500,15 +522,16 @@ function useEventListener(eventName, handler, element) {
500
522
  }, [eventName, element]);
501
523
  }
502
524
 
525
+ var _excluded$a = ["language", "options", "className", "onChange"];
503
526
  var LanguageSelect = function LanguageSelect(_ref) {
504
527
  var language = _ref.language,
505
528
  options = _ref.options,
506
529
  className = _ref.className,
507
530
  _onChange = _ref.onChange,
508
- rest = _objectWithoutPropertiesLoose(_ref, ["language", "options", "className", "onChange"]);
531
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$a);
509
532
 
510
533
  var classNames = cx('eps-language-select', className);
511
- return React.createElement("div", Object.assign({}, rest, {
534
+ return React.createElement("div", _extends({}, rest, {
512
535
  className: classNames
513
536
  }), React.createElement(SegmentedControl, {
514
537
  onChange: function onChange(language) {
@@ -527,6 +550,7 @@ var LanguageSelect = function LanguageSelect(_ref) {
527
550
  })));
528
551
  };
529
552
 
553
+ var _excluded$9 = ["title", "inputComponent", "languages", "values", "onChange", "name", "variant", "feedback"];
530
554
  var ExpandableMultiLanguageInput = function ExpandableMultiLanguageInput(_ref) {
531
555
  var title = _ref.title,
532
556
  InputComponent = _ref.inputComponent,
@@ -536,7 +560,7 @@ var ExpandableMultiLanguageInput = function ExpandableMultiLanguageInput(_ref) {
536
560
  name = _ref.name,
537
561
  variant = _ref.variant,
538
562
  feedback = _ref.feedback,
539
- rest = _objectWithoutPropertiesLoose(_ref, ["title", "inputComponent", "languages", "values", "onChange", "name", "variant", "feedback"]);
563
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$9);
540
564
 
541
565
  var handleOnChange = function handleOnChange(language, value) {
542
566
  var changes = _extends({}, values);
@@ -564,7 +588,7 @@ var ExpandableMultiLanguageInput = function ExpandableMultiLanguageInput(_ref) {
564
588
  var langKey = _ref2.value,
565
589
  label = _ref2.label,
566
590
  required = _ref2.required;
567
- return React.createElement(InputComponent, Object.assign({
591
+ return React.createElement(InputComponent, _extends({
568
592
  "data-testid": "multi-lang-input-" + name + "-" + langKey,
569
593
  key: title + langKey,
570
594
  label: required ? label + '*' : label,
@@ -579,6 +603,7 @@ var ExpandableMultiLanguageInput = function ExpandableMultiLanguageInput(_ref) {
579
603
  })));
580
604
  };
581
605
 
606
+ var _excluded$8 = ["className", "inputComponent", "alertLabel", "alertLevel", "name", "languages", "values", "onChange", "defaultLanguage", "label", "onBlur"];
582
607
  /**
583
608
  * @deprecated use ExpandableMultiLanguageInput
584
609
  */
@@ -598,7 +623,7 @@ var MultiLanguageInput = function MultiLanguageInput(_ref) {
598
623
  label = _ref$label === void 0 ? '' : _ref$label,
599
624
  _ref$onBlur = _ref.onBlur,
600
625
  onBlur = _ref$onBlur === void 0 ? function () {} : _ref$onBlur,
601
- rest = _objectWithoutPropertiesLoose(_ref, ["className", "inputComponent", "alertLabel", "alertLevel", "name", "languages", "values", "onChange", "defaultLanguage", "label", "onBlur"]);
626
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$8);
602
627
 
603
628
  var _useState = useState(defaultLanguage),
604
629
  language = _useState[0],
@@ -646,7 +671,7 @@ var MultiLanguageInput = function MultiLanguageInput(_ref) {
646
671
  onChange: function onChange(lang) {
647
672
  return handleLanguageChange(lang);
648
673
  }
649
- }), React.createElement(InputComponent, Object.assign({
674
+ }), React.createElement(InputComponent, _extends({
650
675
  label: label,
651
676
  variant: alertLevel,
652
677
  feedback: alertLabel,
@@ -659,12 +684,13 @@ var MultiLanguageInput = function MultiLanguageInput(_ref) {
659
684
  }, rest))));
660
685
  };
661
686
 
687
+ var _excluded$7 = ["children", "className"];
662
688
  var Unbutton = function Unbutton(_ref) {
663
689
  var children = _ref.children,
664
690
  className = _ref.className,
665
- rest = _objectWithoutPropertiesLoose(_ref, ["children", "className"]);
691
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$7);
666
692
 
667
- return React.createElement(Button, Object.assign({
693
+ return React.createElement(Button, _extends({
668
694
  variant: "primary"
669
695
  }, rest, {
670
696
  className: cx('eps-unbutton', className)
@@ -732,39 +758,42 @@ var ErrorBoundary = /*#__PURE__*/function (_Component) {
732
758
  return ErrorBoundary;
733
759
  }(Component);
734
760
 
761
+ var _excluded$6 = ["date", "locale", "as", "hideTime"];
735
762
  var FormatDateTime = function FormatDateTime(_ref) {
736
763
  var date = _ref.date,
737
764
  locale = _ref.locale,
738
765
  _ref$as = _ref.as,
739
766
  Component = _ref$as === void 0 ? 'main' : _ref$as,
740
767
  hideTime = _ref.hideTime,
741
- rest = _objectWithoutPropertiesLoose(_ref, ["date", "locale", "as", "hideTime"]);
768
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$6);
742
769
 
743
- return React.createElement(Component, Object.assign({}, rest), hideTime ? localeDate(date, locale) : localeDateTime(date, locale));
770
+ return React.createElement(Component, _extends({}, rest), hideTime ? localeDate(date, locale) : localeDateTime(date, locale));
744
771
  };
745
772
 
773
+ var _excluded$5 = ["amount", "as"];
746
774
  var FormatCurrencyAmount = function FormatCurrencyAmount(_ref) {
747
775
  var amount = _ref.amount,
748
776
  _ref$as = _ref.as,
749
777
  Component = _ref$as === void 0 ? 'span' : _ref$as,
750
- rest = _objectWithoutPropertiesLoose(_ref, ["amount", "as"]);
778
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$5);
751
779
 
752
780
  var parsedAmount = Number(amount) || 0;
753
781
  var formattedAmount = new Intl.NumberFormat('nb-NO', {
754
782
  maximumFractionDigits: 2,
755
783
  minimumFractionDigits: 2
756
784
  }).format(parsedAmount);
757
- return React.createElement(Component, Object.assign({}, rest), formattedAmount);
785
+ return React.createElement(Component, _extends({}, rest), formattedAmount);
758
786
  };
759
787
 
788
+ var _excluded$4 = ["items", "locale", "className"];
760
789
  var AuditInfo = function AuditInfo(_ref) {
761
790
  var items = _ref.items,
762
791
  locale = _ref.locale,
763
792
  className = _ref.className,
764
- rest = _objectWithoutPropertiesLoose(_ref, ["items", "locale", "className"]);
793
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
765
794
 
766
795
  var classNames = cx('ep-audit-info', className);
767
- return React.createElement("div", Object.assign({
796
+ return React.createElement("div", _extends({
768
797
  className: classNames
769
798
  }, rest), items.map(function (_ref2, i) {
770
799
  var label = _ref2.label,
@@ -781,6 +810,7 @@ var AuditInfo = function AuditInfo(_ref) {
781
810
  }));
782
811
  };
783
812
 
813
+ var _excluded$3 = ["isOpen", "children", "message", "size", "buttons", "onConfirm", "messages", "onClose", "onDismiss"];
784
814
  var ConfirmModal = function ConfirmModal(_ref) {
785
815
  var _ref$isOpen = _ref.isOpen,
786
816
  isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
@@ -793,11 +823,11 @@ var ConfirmModal = function ConfirmModal(_ref) {
793
823
  messages = _ref.messages,
794
824
  onClose = _ref.onClose,
795
825
  onDismiss = _ref.onDismiss,
796
- rest = _objectWithoutPropertiesLoose(_ref, ["isOpen", "children", "message", "size", "buttons", "onConfirm", "messages", "onClose", "onDismiss"]);
826
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
797
827
 
798
828
  var childrenToRender = children ? children : message;
799
829
  var handleDismiss = onClose ? onClose : onDismiss;
800
- return React.createElement(Modal, Object.assign({
830
+ return React.createElement(Modal, _extends({
801
831
  size: size,
802
832
  open: isOpen,
803
833
  onDismiss: handleDismiss
@@ -812,10 +842,11 @@ var ConfirmModal = function ConfirmModal(_ref) {
812
842
  }, messages.confirm)) : buttons));
813
843
  };
814
844
 
845
+ var _excluded$2 = ["children", "shouldBlockNavigation"];
815
846
  var RouteLeavingGuard = function RouteLeavingGuard(_ref) {
816
847
  var children = _ref.children,
817
848
  shouldBlockNavigation = _ref.shouldBlockNavigation,
818
- rest = _objectWithoutPropertiesLoose(_ref, ["children", "shouldBlockNavigation"]);
849
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
819
850
 
820
851
  var history = useHistory();
821
852
 
@@ -847,7 +878,7 @@ var RouteLeavingGuard = function RouteLeavingGuard(_ref) {
847
878
 
848
879
  return React.createElement(React.Fragment, null, React.createElement(Prompt, {
849
880
  message: allowNavigation
850
- }), React.createElement(ConfirmModal, Object.assign({
881
+ }), React.createElement(ConfirmModal, _extends({
851
882
  onDismiss: closeModal,
852
883
  open: status === 'BLOCKED',
853
884
  onConfirm: handleConfirm
@@ -912,13 +943,14 @@ var PermissionCheck = function PermissionCheck(_ref) {
912
943
  return React.createElement(React.Fragment, null, allowed ? children : fallback);
913
944
  };
914
945
 
946
+ var _excluded$1 = ["children", "actualPermissions", "all", "oneOf", "onReject"];
915
947
  var PermissionCheckedRoute = function PermissionCheckedRoute(_ref) {
916
948
  var children = _ref.children,
917
949
  actualPermissions = _ref.actualPermissions,
918
950
  all = _ref.all,
919
951
  oneOf = _ref.oneOf,
920
952
  onReject = _ref.onReject,
921
- props = _objectWithoutPropertiesLoose(_ref, ["children", "actualPermissions", "all", "oneOf", "onReject"]);
953
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
922
954
 
923
955
  var redirect = React.createElement(Redirect, {
924
956
  to: {
@@ -933,7 +965,7 @@ var PermissionCheckedRoute = function PermissionCheckedRoute(_ref) {
933
965
  all: all,
934
966
  oneOf: oneOf,
935
967
  fallback: onReject ? onReject : redirect
936
- }, React.createElement(Route, Object.assign({}, props), children));
968
+ }, React.createElement(Route, _extends({}, props), children));
937
969
  };
938
970
 
939
971
  var Breadcrumbs = function Breadcrumbs(_ref) {
@@ -984,11 +1016,12 @@ var Breadcrumbs = function Breadcrumbs(_ref) {
984
1016
  };
985
1017
 
986
1018
  var Link = function Link(props) {
987
- return React.createElement(Link$1, Object.assign({}, props, {
1019
+ return React.createElement(Link$1, _extends({}, props, {
988
1020
  as: Link$2
989
1021
  }), props.children);
990
1022
  };
991
1023
 
1024
+ var _excluded = ["as", "children", "fontSize", "color", "lineHeight", "fontWeight", "className"];
992
1025
  var Text = function Text(_ref) {
993
1026
  var _ref$as = _ref.as,
994
1027
  component = _ref$as === void 0 ? 'span' : _ref$as,
@@ -998,14 +1031,14 @@ var Text = function Text(_ref) {
998
1031
  lineHeight = _ref.lineHeight,
999
1032
  fontWeight = _ref.fontWeight,
1000
1033
  className = _ref.className,
1001
- rest = _objectWithoutPropertiesLoose(_ref, ["as", "children", "fontSize", "color", "lineHeight", "fontWeight", "className"]);
1034
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
1002
1035
 
1003
1036
  var classes = [];
1004
1037
  fontSize && classes.push.apply(classes, responsiveProp('eps-font-size-', fontSize));
1005
1038
  lineHeight && classes.push.apply(classes, responsiveProp('eps-line-height-', lineHeight));
1006
1039
  fontWeight && classes.push('eps-font-weight-' + fontWeight);
1007
1040
  var classList = cx(classes, className);
1008
- return React.createElement(Box, Object.assign({
1041
+ return React.createElement(Box, _extends({
1009
1042
  as: component,
1010
1043
  color: color,
1011
1044
  className: classList