@entur-partner/common 9.3.3-alpha.0 → 9.3.3-alpha.2

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.
Files changed (47) hide show
  1. package/dist/ActionBar.d.ts +9 -9
  2. package/dist/AuditInfo.d.ts +14 -14
  3. package/dist/Box.d.ts +57 -57
  4. package/dist/Breadcrumbs.d.ts +8 -8
  5. package/dist/ConfirmModal.d.ts +28 -28
  6. package/dist/Content.d.ts +10 -10
  7. package/dist/EnturPartnerLogo.d.ts +19 -19
  8. package/dist/ErrorBoundary.d.ts +22 -22
  9. package/dist/ExpandableMultiLanguageInput.d.ts +17 -17
  10. package/dist/FeatureToggle.d.ts +25 -25
  11. package/dist/FormatCurrencyAmount.d.ts +8 -8
  12. package/dist/FormatDateTime.d.ts +7 -7
  13. package/dist/LanguageSelect.d.ts +16 -16
  14. package/dist/LegacyPageTitle.d.ts +16 -0
  15. package/dist/Link.d.ts +6 -6
  16. package/dist/LinkButton.d.ts +8 -8
  17. package/dist/Menu.d.ts +10 -10
  18. package/dist/MultiLanguageInput.d.ts +28 -28
  19. package/dist/OrganisationDropdown.d.ts +14 -14
  20. package/dist/PageTitle.d.ts +6 -15
  21. package/dist/Pager.d.ts +8 -8
  22. package/dist/PermissionCheck.d.ts +24 -24
  23. package/dist/RouteLeavingGuard.d.ts +14 -14
  24. package/dist/Stack.d.ts +9 -9
  25. package/dist/StatusLabel.d.ts +11 -11
  26. package/dist/Text.d.ts +21 -21
  27. package/dist/Unbutton.d.ts +7 -7
  28. package/dist/UserMenu/components/CookieSettingsMenuItem.d.ts +9 -9
  29. package/dist/UserMenu/components/CustomOverflowMenu.d.ts +11 -11
  30. package/dist/UserMenu/components/CustomOverflowMenuItem.d.ts +3 -3
  31. package/dist/UserMenu/components/LanguageSwitchMenuItem.d.ts +10 -10
  32. package/dist/UserMenu/components/LogOutMenuItem.d.ts +9 -9
  33. package/dist/UserMenu/components/UserMenuItem.d.ts +9 -9
  34. package/dist/UserMenu/components/VersionMenuItem.d.ts +5 -5
  35. package/dist/UserMenu/index.d.ts +26 -25
  36. package/dist/UserMenu/useOutsideClick.d.ts +2 -2
  37. package/dist/common.cjs.development.js +199 -191
  38. package/dist/common.cjs.development.js.map +1 -1
  39. package/dist/common.cjs.production.min.js +1 -1
  40. package/dist/common.cjs.production.min.js.map +1 -1
  41. package/dist/common.esm.js +79 -67
  42. package/dist/common.esm.js.map +1 -1
  43. package/dist/environment.d.ts +13 -13
  44. package/dist/index.d.ts +31 -30
  45. package/dist/styles.css +185 -185
  46. package/dist/useEventListener.d.ts +3 -3
  47. package/package.json +6 -7
@@ -9,8 +9,8 @@ import { Paragraph, Link as Link$2, Heading6 } from '@entur/typography';
9
9
  import { BannerAlertBox } from '@entur/alert';
10
10
  import { ExpandablePanel } from '@entur/expand';
11
11
  import { SegmentedControl, SegmentedChoice } from '@entur/form';
12
- import { SearchableDropdown } from '@entur/dropdown';
13
12
  import { Helmet } from 'react-helmet-async';
13
+ import { SearchableDropdown } from '@entur/dropdown';
14
14
  import { CookieIcon, UserIcon, DownArrowIcon, NorwayIcon, UKIcon, LogOutIcon, ChannelsIcon } from '@entur/icons';
15
15
 
16
16
  var ActionBarLeft = function ActionBarLeft(_ref) {
@@ -35,42 +35,30 @@ var ActionBar = function ActionBar(_ref3) {
35
35
  };
36
36
 
37
37
  function _extends() {
38
- _extends = Object.assign ? Object.assign.bind() : function (target) {
39
- for (var i = 1; i < arguments.length; i++) {
40
- var source = arguments[i];
41
- for (var key in source) {
42
- if (Object.prototype.hasOwnProperty.call(source, key)) {
43
- target[key] = source[key];
44
- }
45
- }
38
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
39
+ for (var e = 1; e < arguments.length; e++) {
40
+ var t = arguments[e];
41
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
46
42
  }
47
- return target;
48
- };
49
- return _extends.apply(this, arguments);
43
+ return n;
44
+ }, _extends.apply(null, arguments);
50
45
  }
51
- function _inheritsLoose(subClass, superClass) {
52
- subClass.prototype = Object.create(superClass.prototype);
53
- subClass.prototype.constructor = subClass;
54
- _setPrototypeOf(subClass, superClass);
46
+ function _inheritsLoose(t, o) {
47
+ t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
55
48
  }
56
- function _setPrototypeOf(o, p) {
57
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
58
- o.__proto__ = p;
59
- return o;
60
- };
61
- return _setPrototypeOf(o, p);
62
- }
63
- function _objectWithoutPropertiesLoose(source, excluded) {
64
- if (source == null) return {};
65
- var target = {};
66
- var sourceKeys = Object.keys(source);
67
- var key, i;
68
- for (i = 0; i < sourceKeys.length; i++) {
69
- key = sourceKeys[i];
70
- if (excluded.indexOf(key) >= 0) continue;
71
- target[key] = source[key];
49
+ function _objectWithoutPropertiesLoose(r, e) {
50
+ if (null == r) return {};
51
+ var t = {};
52
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
53
+ if (-1 !== e.indexOf(n)) continue;
54
+ t[n] = r[n];
72
55
  }
73
- return target;
56
+ return t;
57
+ }
58
+ function _setPrototypeOf(t, e) {
59
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
60
+ return t.__proto__ = e, t;
61
+ }, _setPrototypeOf(t, e);
74
62
  }
75
63
 
76
64
  var _excluded$e = ["date", "locale", "as", "hideTime"];
@@ -292,10 +280,10 @@ var Environment;
292
280
  Environment["Production"] = "prod";
293
281
  })(Environment || (Environment = {}));
294
282
  var environmentColors = (_environmentColors = {}, _environmentColors[Environment.Local] = "#B482FB", _environmentColors[Environment.Development] = "#5AC39A", _environmentColors[Environment.Staging] = "#FFCA28", _environmentColors);
295
- /**
296
- * Gets the color for the given environment. This is the color used for the environment
297
- * indicator. There is no color for production as it should not have any special environment
298
- * indication.
283
+ /**
284
+ * Gets the color for the given environment. This is the color used for the environment
285
+ * indicator. There is no color for production as it should not have any special environment
286
+ * indication.
299
287
  */
300
288
  var getColorForEnvironment = function getColorForEnvironment(environment) {
301
289
  return environmentColors[environment];
@@ -467,23 +455,23 @@ var ExpandableMultiLanguageInput = function ExpandableMultiLanguageInput(_ref) {
467
455
  };
468
456
 
469
457
  /// <reference types="vite/client" />
470
- /**
471
- * Returns true if the provided flag exist in localStorage
472
- * or is set as an environment variable.
473
- *
474
- * @param flag case sensitive flag. If it is an environment variable
475
- * you can drop the VITE_APP_ prefix.
458
+ /**
459
+ * Returns true if the provided flag exist in localStorage
460
+ * or is set as an environment variable.
461
+ *
462
+ * @param flag case sensitive flag. If it is an environment variable
463
+ * you can drop the VITE_APP_ prefix.
476
464
  */
477
465
  function featureFlag(flag) {
478
466
  var _window$localStorage, _window$localStorage2;
479
467
  return import.meta.env["VITE_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("VITE_APP_" + flag)) === "true";
480
468
  }
481
- /**
482
- * Returns true if the provided flag exist in localStorage
483
- * or is set as an environment variable.
484
- *
485
- * @param flag case sensitive flag. If it is an environment variable
486
- * you can drop the VITE_APP_ prefix.
469
+ /**
470
+ * Returns true if the provided flag exist in localStorage
471
+ * or is set as an environment variable.
472
+ *
473
+ * @param flag case sensitive flag. If it is an environment variable
474
+ * you can drop the VITE_APP_ prefix.
487
475
  */
488
476
  function useFeatureToggle(flag) {
489
477
  return featureFlag(flag);
@@ -538,6 +526,34 @@ var LanguageSelect = function LanguageSelect(_ref) {
538
526
  })));
539
527
  };
540
528
 
529
+ /**
530
+ * @deprecated Won't work with React 19, because of react-helmet-async
531
+ * This component changes page title by using helmet and current path. It will translate subpaths, join them with a dash
532
+ * and display it on browser tab.
533
+ *
534
+ * @param Props.pathname - The current path from react-router-dom.useLocation()
535
+ * @param Props.onBreadcrumbLookup - A function that takes a path and returns a i18n translated string or undefined
536
+ * @returns A Helmet component with updated title
537
+ */
538
+ var LegacyPageTitle = function LegacyPageTitle(_ref) {
539
+ var pathname = _ref.pathname,
540
+ onBreadcrumbLookup = _ref.onBreadcrumbLookup;
541
+ var paths = splitUrlPath(pathname);
542
+ var pageTitles = paths.map(function (path) {
543
+ return {
544
+ title: onBreadcrumbLookup(path),
545
+ path: path
546
+ };
547
+ }).filter(function (_ref2) {
548
+ var title = _ref2.title;
549
+ return title !== undefined;
550
+ }).map(function (_ref3) {
551
+ var title = _ref3.title;
552
+ return title;
553
+ }).reverse().join(" | ");
554
+ return React.createElement(Helmet, null, React.createElement("title", null, pageTitles, " | Entur Partner"));
555
+ };
556
+
541
557
  var Link = function Link(props) {
542
558
  return React.createElement(Link$2, _extends({}, props, {
543
559
  as: Link$1
@@ -567,8 +583,8 @@ var Menu = function Menu(_ref) {
567
583
  };
568
584
 
569
585
  var _excluded$5 = ["className", "inputComponent", "alertLabel", "alertLevel", "name", "languages", "values", "onChange", "defaultLanguage", "label", "onBlur"];
570
- /**
571
- * @deprecated use ExpandableMultiLanguageInput
586
+ /**
587
+ * @deprecated use ExpandableMultiLanguageInput
572
588
  */
573
589
  var MultiLanguageInput = function MultiLanguageInput(_ref) {
574
590
  var className = _ref.className,
@@ -695,15 +711,7 @@ var Pager = function Pager(_ref) {
695
711
  });
696
712
  };
697
713
 
698
- /**
699
- * This component changes page title by using helmet and current path. It will translate subpaths, join them with a dash
700
- * and display it on browser tab.
701
- *
702
- * @param Props.pathname - The current path from react-router-dom.useLocation()
703
- * @param Props.onBreadcrumbLookup - A function that takes a path and returns a i18n translated string or undefined
704
- * @returns A Helmet component with updated title
705
- */
706
- function PageTitle(_ref) {
714
+ var PageTitle = function PageTitle(_ref) {
707
715
  var pathname = _ref.pathname,
708
716
  onBreadcrumbLookup = _ref.onBreadcrumbLookup;
709
717
  var paths = splitUrlPath(pathname);
@@ -719,13 +727,16 @@ function PageTitle(_ref) {
719
727
  var title = _ref3.title;
720
728
  return title;
721
729
  }).reverse().join(" | ");
722
- return React.createElement(Helmet, null, React.createElement("title", null, pageTitles, " | Entur Partner"));
723
- }
730
+ useEffect(function () {
731
+ document.title = pageTitles + " | Entur Partner";
732
+ }, [pageTitles]);
733
+ return null;
734
+ };
724
735
 
725
- /**
726
- * Note: This component uses BusinessCapability, not because we only want to
727
- * check BusinessCapabilities but because it represents a minimal subset of
728
- * what we need to check.
736
+ /**
737
+ * Note: This component uses BusinessCapability, not because we only want to
738
+ * check BusinessCapabilities but because it represents a minimal subset of
739
+ * what we need to check.
729
740
  */
730
741
  var PermissionCheck = function PermissionCheck(_ref) {
731
742
  var children = _ref.children,
@@ -1031,6 +1042,7 @@ var VersionMenuItem = function VersionMenuItem(_ref) {
1031
1042
  })), title);
1032
1043
  };
1033
1044
 
1045
+ /** biome-ignore-all lint/correctness/useUniqueElementIds: Ignore unique id for now */
1034
1046
  var UserMenu = function UserMenu(_ref) {
1035
1047
  var className = _ref.className,
1036
1048
  messages = _ref.messages,
@@ -1105,5 +1117,5 @@ function useEventListener(eventName, handler, element) {
1105
1117
  }, [eventName, element]);
1106
1118
  }
1107
1119
 
1108
- export { ActionBar, ActionBarLeft, ActionBarRight, AuditInfo, Box, Breadcrumbs, ConfirmModal, Content, EnturPartnerLogo, EnturPartnerLogoSvg, Environment, ErrorBoundary, ExpandableMultiLanguageInput, FeatureToggle, FormatCurrencyAmount, FormatDateTime, LanguageSelect, Link, LinkButton, Menu, MultiLanguageInput, OrganisationDropDown, PageTitle, Pager, PermissionCheck, RouteLeavingGuard, Stack, StatusLabel, Text, Unbutton, UserMenu, featureFlag, getColorForEnvironment, getHumanReadableEnvironment, responsiveProp, useEventListener, useFeatureToggle };
1120
+ export { ActionBar, ActionBarLeft, ActionBarRight, AuditInfo, Box, Breadcrumbs, ConfirmModal, Content, EnturPartnerLogo, EnturPartnerLogoSvg, Environment, ErrorBoundary, ExpandableMultiLanguageInput, FeatureToggle, FormatCurrencyAmount, FormatDateTime, LanguageSelect, LegacyPageTitle, Link, LinkButton, Menu, MultiLanguageInput, OrganisationDropDown, PageTitle, Pager, PermissionCheck, RouteLeavingGuard, Stack, StatusLabel, Text, Unbutton, UserMenu, featureFlag, getColorForEnvironment, getHumanReadableEnvironment, responsiveProp, useEventListener, useFeatureToggle };
1109
1121
  //# sourceMappingURL=common.esm.js.map