@entur-partner/common 11.2.0 → 11.2.3

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.
@@ -1,6 +1,6 @@
1
1
  import "./ActionBar.scss";
2
2
  import { type ReactNode } from "react";
3
- export interface ActionBarProps {
3
+ interface ActionBarProps {
4
4
  children: ReactNode;
5
5
  }
6
6
  declare const ActionBarLeft: ({ children }: ActionBarProps) => import("react/jsx-runtime").JSX.Element;
@@ -10,5 +10,8 @@ export interface AuditInfoProps {
10
10
  className?: string;
11
11
  [key: string]: object | string | number | boolean | undefined;
12
12
  }
13
+ /**
14
+ * @deprecated Only Product Frontend uses this component. Consider to move it there.
15
+ */
13
16
  export declare const AuditInfo: FC<AuditInfoProps>;
14
17
  export {};
package/dist/Box.d.ts CHANGED
@@ -52,5 +52,9 @@ export interface BoxProps {
52
52
  }
53
53
  type ResponsiveProp = string | [string?, string?, string?];
54
54
  export declare function responsiveProp(prefix: string, prop: ResponsiveProp): string[];
55
+ /**
56
+ *
57
+ * @deprecated Consider to use Tailwind or similar utility-first CSS framework instead.
58
+ */
55
59
  export declare const Box: ({ as: Component, 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, ...rest }: BoxProps) => import("react/jsx-runtime").JSX.Element;
56
60
  export {};
@@ -18,5 +18,4 @@ export declare class ErrorBoundary extends Component<Props, State> {
18
18
  componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
19
19
  render(): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
20
20
  }
21
- export declare const LANGUAGE_STORAGE_KEY = "EP::locale";
22
21
  export {};
@@ -13,5 +13,8 @@ type ExpandableMultiLanguageInputProps = {
13
13
  feedback?: (lang: LanguageKey) => string;
14
14
  [key: string]: object | string | number | boolean | undefined;
15
15
  };
16
+ /**
17
+ * @deprecated No longer in use by anyone.
18
+ */
16
19
  export declare const ExpandableMultiLanguageInput: ({ title, inputComponent: InputComponent, languages, values, onChange, name, variant, feedback, ...rest }: ExpandableMultiLanguageInputProps) => import("react/jsx-runtime").JSX.Element;
17
20
  export {};
@@ -11,11 +11,12 @@ export declare function featureFlag(flag: string): boolean;
11
11
  * Returns true if the provided flag exist in localStorage
12
12
  * or is set as an environment variable.
13
13
  *
14
+ * @deprecated use featureFlag instead.
14
15
  * @param flag case sensitive flag. If it is an environment variable
15
16
  * you can drop the VITE_APP_ prefix.
16
17
  */
17
18
  export declare function useFeatureToggle(flag: string): boolean;
18
- export interface FeatureToggleProps {
19
+ interface FeatureToggleProps {
19
20
  /** Visible if flag exist, hidden if not.*/
20
21
  children: ReactNode;
21
22
  /** Case sensitive flag. If it is an environment variable
@@ -23,3 +24,4 @@ export interface FeatureToggleProps {
23
24
  flag: string;
24
25
  }
25
26
  export declare const FeatureToggle: ({ children, flag }: FeatureToggleProps) => import("react/jsx-runtime").JSX.Element | null;
27
+ export {};
@@ -4,4 +4,8 @@ export interface FormatCurrencyAmountProps {
4
4
  as?: "span" | ElementType;
5
5
  [key: string]: object | string | number | boolean | undefined;
6
6
  }
7
+ /**
8
+ *
9
+ * @deprecated Moved to @entur-partner/util as a function instead.
10
+ */
7
11
  export declare const FormatCurrencyAmount: FC<FormatCurrencyAmountProps>;
@@ -1,7 +1,12 @@
1
1
  import { type FC } from "react";
2
- export interface FormatDateTimeProps {
2
+ interface FormatDateTimeProps {
3
3
  date: string | Date;
4
4
  locale: string;
5
5
  [key: string]: any;
6
6
  }
7
+ /**
8
+ *
9
+ * @deprecated Consider to use localeDate and localeDateTime functions from @entur-partner/util instead.
10
+ */
7
11
  export declare const FormatDateTime: FC<FormatDateTimeProps>;
12
+ export {};
@@ -6,11 +6,16 @@ export interface LanguageOption {
6
6
  label: string;
7
7
  required: boolean;
8
8
  }
9
- export interface LanguageSelectProps {
9
+ interface LanguageSelectProps {
10
10
  language: string;
11
11
  options: LanguageOption[];
12
12
  className?: string;
13
13
  onChange: (language: string) => void;
14
14
  [key: string]: object | string | number | boolean | undefined;
15
15
  }
16
+ /**
17
+ *
18
+ * @deprecated This component is no longer in use by anyone.
19
+ */
16
20
  export declare const LanguageSelect: FC<LanguageSelectProps>;
21
+ export {};
package/dist/Link.d.ts CHANGED
@@ -2,5 +2,9 @@ import { type FC } from "react";
2
2
  import { type LinkProps } from "react-router-dom";
3
3
  interface Props extends LinkProps {
4
4
  }
5
+ /**
6
+ *
7
+ * @deprecated Use Link from react-router instead.
8
+ */
5
9
  export declare const Link: FC<Props>;
6
10
  export {};
@@ -1,8 +1,12 @@
1
1
  import "./LinkButton.scss";
2
2
  import { type ReactNode } from "react";
3
- export interface LinkButtonProps {
3
+ interface LinkButtonProps {
4
4
  children: ReactNode;
5
5
  className?: string;
6
6
  [key: string]: object | string | number | boolean | undefined | ReactNode;
7
7
  }
8
+ /**
9
+ * @deprecated LinkButton is not UU compliant and should be replaced with a regular Link or Button component depending on the use case.
10
+ */
8
11
  export declare const LinkButton: ({ children, className, ...rest }: LinkButtonProps) => import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -5,7 +5,7 @@ import { type LanguageOption } from "./LanguageSelect";
5
5
  type Values = {
6
6
  [key: string]: string;
7
7
  };
8
- export interface MultiLanguageInputProps {
8
+ interface MultiLanguageInputProps {
9
9
  className?: string;
10
10
  onBlur?: (e: FocusEvent<HTMLDivElement>) => void;
11
11
  inputComponent: ElementType;
@@ -22,7 +22,7 @@ export interface MultiLanguageInputProps {
22
22
  [key: string]: object | string | number | boolean | undefined;
23
23
  }
24
24
  /**
25
- * @deprecated use ExpandableMultiLanguageInput
25
+ * @deprecated No longer in use by anyone.
26
26
  */
27
27
  export declare const MultiLanguageInput: FC<MultiLanguageInputProps>;
28
28
  export {};
package/dist/Stack.d.ts CHANGED
@@ -1,9 +1,13 @@
1
1
  /** biome-ignore-all lint/suspicious/noArrayIndexKey: Ignore for now. Should be tested properly before doing changes */
2
2
  import { type ReactNode } from "react";
3
3
  import { type ResponsiveStyleSpacing } from "./Box";
4
- export interface StackProps {
4
+ interface StackProps {
5
5
  className?: string;
6
6
  children: ReactNode;
7
7
  space: ResponsiveStyleSpacing;
8
8
  }
9
+ /**
10
+ * @deprecated Consider to use Tailwind or CSS/SCSS directly.
11
+ */
9
12
  export declare const Stack: ({ children, space, className }: StackProps) => import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -7,5 +7,8 @@ interface StatusLabelProps {
7
7
  showBullet?: boolean;
8
8
  center?: boolean;
9
9
  }
10
+ /**
11
+ * @deprecated Consider to copy component for own usage or use entur design system.
12
+ */
10
13
  export declare const StatusLabel: FC<StatusLabelProps>;
11
14
  export {};
package/dist/Text.d.ts CHANGED
@@ -16,5 +16,9 @@ export interface TextProps {
16
16
  fontWeight?: StyleFontWeight;
17
17
  [key: string]: any;
18
18
  }
19
+ /**
20
+ *
21
+ * @deprecated Use Entur design system Text component.
22
+ */
19
23
  export declare const Text: ({ as: component, children, fontSize, color, lineHeight, fontWeight, className, ...rest }: TextProps) => import("react/jsx-runtime").JSX.Element;
20
24
  export {};
@@ -3,5 +3,8 @@ import { Button, type ButtonProps } from "@entur/button";
3
3
  import { type FC } from "react";
4
4
  interface UnbuttonProps extends Omit<ButtonProps<typeof Button>, "variant"> {
5
5
  }
6
+ /**
7
+ * @deprecated Consider to copy component for own usage.
8
+ */
6
9
  export declare const Unbutton: FC<UnbuttonProps>;
7
10
  export {};
@@ -72,6 +72,10 @@ function _setPrototypeOf(t, e) {
72
72
  }
73
73
 
74
74
  var _excluded$e = ["date", "locale", "as", "hideTime"];
75
+ /**
76
+ *
77
+ * @deprecated Consider to use localeDate and localeDateTime functions from @entur-partner/util instead.
78
+ */
75
79
  var FormatDateTime = function FormatDateTime(_ref) {
76
80
  var date = _ref.date,
77
81
  locale = _ref.locale,
@@ -95,6 +99,10 @@ function responsiveProp(prefix, prop) {
95
99
  }
96
100
  return [prefix + prop];
97
101
  }
102
+ /**
103
+ *
104
+ * @deprecated Consider to use Tailwind or similar utility-first CSS framework instead.
105
+ */
98
106
  var Box = function Box(_ref) {
99
107
  var _ref$as = _ref.as,
100
108
  Component = _ref$as === void 0 ? "div" : _ref$as,
@@ -162,6 +170,9 @@ var Box = function Box(_ref) {
162
170
  }));
163
171
  };
164
172
 
173
+ /**
174
+ * @deprecated Consider to use Tailwind or CSS/SCSS directly.
175
+ */
165
176
  var Stack = function Stack(_ref) {
166
177
  var children = _ref.children,
167
178
  space = _ref.space,
@@ -186,6 +197,9 @@ var Stack = function Stack(_ref) {
186
197
  };
187
198
 
188
199
  var _excluded$c = ["items", "locale", "className"];
200
+ /**
201
+ * @deprecated Only Product Frontend uses this component. Consider to move it there.
202
+ */
189
203
  var AuditInfo = function AuditInfo(_ref) {
190
204
  var items = _ref.items,
191
205
  locale = _ref.locale,
@@ -457,6 +471,9 @@ function RefreshBannerInfo() {
457
471
  }
458
472
 
459
473
  var _excluded$9 = ["title", "inputComponent", "languages", "values", "onChange", "name", "variant", "feedback"];
474
+ /**
475
+ * @deprecated No longer in use by anyone.
476
+ */
460
477
  var ExpandableMultiLanguageInput = function ExpandableMultiLanguageInput(_ref) {
461
478
  var title = _ref.title,
462
479
  InputComponent = _ref.inputComponent,
@@ -524,6 +541,7 @@ function featureFlag(flag) {
524
541
  * Returns true if the provided flag exist in localStorage
525
542
  * or is set as an environment variable.
526
543
  *
544
+ * @deprecated use featureFlag instead.
527
545
  * @param flag case sensitive flag. If it is an environment variable
528
546
  * you can drop the VITE_APP_ prefix.
529
547
  */
@@ -533,7 +551,7 @@ function useFeatureToggle(flag) {
533
551
  var FeatureToggle = function FeatureToggle(_ref) {
534
552
  var children = _ref.children,
535
553
  flag = _ref.flag;
536
- var feature = useFeatureToggle(flag);
554
+ var feature = featureFlag(flag);
537
555
  if (feature) {
538
556
  return jsxRuntime.jsx(jsxRuntime.Fragment, {
539
557
  children: children
@@ -543,6 +561,10 @@ var FeatureToggle = function FeatureToggle(_ref) {
543
561
  };
544
562
 
545
563
  var _excluded$8 = ["amount", "as"];
564
+ /**
565
+ *
566
+ * @deprecated Moved to @entur-partner/util as a function instead.
567
+ */
546
568
  var FormatCurrencyAmount = function FormatCurrencyAmount(_ref) {
547
569
  var amount = _ref.amount,
548
570
  _ref$as = _ref.as,
@@ -559,6 +581,10 @@ var FormatCurrencyAmount = function FormatCurrencyAmount(_ref) {
559
581
  };
560
582
 
561
583
  var _excluded$7 = ["language", "options", "className", "onChange"];
584
+ /**
585
+ *
586
+ * @deprecated This component is no longer in use by anyone.
587
+ */
562
588
  var LanguageSelect = function LanguageSelect(_ref) {
563
589
  var language = _ref.language,
564
590
  options = _ref.options,
@@ -589,6 +615,10 @@ var LanguageSelect = function LanguageSelect(_ref) {
589
615
  }));
590
616
  };
591
617
 
618
+ /**
619
+ *
620
+ * @deprecated Use Link from react-router instead.
621
+ */
592
622
  var Link = function Link(props) {
593
623
  return jsxRuntime.jsx(typography.Link, _extends({}, props, {
594
624
  as: reactRouterDom.Link,
@@ -597,6 +627,9 @@ var Link = function Link(props) {
597
627
  };
598
628
 
599
629
  var _excluded$6 = ["children", "className"];
630
+ /**
631
+ * @deprecated LinkButton is not UU compliant and should be replaced with a regular Link or Button component depending on the use case.
632
+ */
600
633
  var LinkButton = function LinkButton(_ref) {
601
634
  var children = _ref.children,
602
635
  className = _ref.className,
@@ -622,7 +655,7 @@ var Menu = function Menu(_ref) {
622
655
 
623
656
  var _excluded$5 = ["className", "inputComponent", "alertLabel", "alertLevel", "name", "languages", "values", "onChange", "defaultLanguage", "label", "onBlur"];
624
657
  /**
625
- * @deprecated use ExpandableMultiLanguageInput
658
+ * @deprecated No longer in use by anyone.
626
659
  */
627
660
  var MultiLanguageInput = function MultiLanguageInput(_ref) {
628
661
  var className = _ref.className,
@@ -699,16 +732,12 @@ var MultiLanguageInput = function MultiLanguageInput(_ref) {
699
732
  };
700
733
 
701
734
  var _excluded$4 = ["label", "organisations", "onChange", "selectedOrganisationId"];
702
- function isInShadowDom(el) {
703
- return (el == null ? void 0 : el.getRootNode()) instanceof ShadowRoot;
704
- }
705
735
  var OrganisationDropDown = function OrganisationDropDown(_ref) {
706
736
  var label = _ref.label,
707
737
  organisations = _ref.organisations,
708
738
  handleChange = _ref.onChange,
709
739
  selectedOrganisationId = _ref.selectedOrganisationId,
710
740
  rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
711
- var wrapperRef = react.useRef(null);
712
741
  var _useState = react.useState(),
713
742
  selectedOrganisation = _useState[0],
714
743
  setSelectedOrganisation = _useState[1];
@@ -717,53 +746,27 @@ var OrganisationDropDown = function OrganisationDropDown(_ref) {
717
746
  return org.organisationId === selectedOrganisationId;
718
747
  }));
719
748
  }, [selectedOrganisationId, organisations]);
720
- var handleMouseDown = function handleMouseDown(e) {
721
- if (!isInShadowDom(wrapperRef.current)) return;
722
- // In shadow DOM, mouse events are retargeted at the shadow boundary,
723
- // causing downshift's window-level outside-click detection to misidentify
724
- // clicks within the dropdown as outside clicks. Stop propagation to prevent
725
- // the retargeted event from reaching window-level listeners.
726
- e.nativeEvent.stopPropagation();
727
- // Prevent default on non-input elements to stop the browser from moving
728
- // focus away from the combobox input, which would trigger a blur that
729
- // closes the dropdown before the click event can register a selection.
730
- if (e.target.tagName !== "INPUT") {
731
- e.preventDefault();
732
- }
733
- };
734
- var handleMouseUp = function handleMouseUp(e) {
735
- if (!isInShadowDom(wrapperRef.current)) return;
736
- e.nativeEvent.stopPropagation();
737
- };
738
- return (
739
- // biome-ignore lint/a11y/noStaticElementInteractions: Temporary fix. See comment above. Will be fixed in design system level in the future.
740
- jsxRuntime.jsx("div", {
741
- ref: wrapperRef,
742
- onMouseDown: handleMouseDown,
743
- onMouseUp: handleMouseUp,
744
- children: jsxRuntime.jsx(dropdown.SearchableDropdown, _extends({
745
- label: label,
746
- items: [].concat(organisations.sort(function (a, b) {
747
- return a.tradingName.localeCompare(b.tradingName, "nb");
748
- }).map(function (organisation) {
749
- return {
750
- value: organisation.organisationId,
751
- label: organisation.tradingName
752
- };
753
- })),
754
- selectedItem: selectedOrganisation ? {
755
- value: selectedOrganisation.organisationId,
756
- label: selectedOrganisation.tradingName
757
- } : null,
758
- onChange: function onChange(selectedValue) {
759
- if (selectedValue) {
760
- handleChange(selectedValue.value);
761
- }
762
- },
763
- clearable: false
764
- }, rest))
765
- })
766
- );
749
+ return jsxRuntime.jsx(dropdown.SearchableDropdown, _extends({
750
+ label: label,
751
+ items: [].concat(organisations.sort(function (a, b) {
752
+ return a.tradingName.localeCompare(b.tradingName, "nb");
753
+ }).map(function (organisation) {
754
+ return {
755
+ value: organisation.organisationId,
756
+ label: organisation.tradingName
757
+ };
758
+ })),
759
+ selectedItem: selectedOrganisation ? {
760
+ value: selectedOrganisation.organisationId,
761
+ label: selectedOrganisation.tradingName
762
+ } : null,
763
+ onChange: function onChange(selectedValue) {
764
+ if (selectedValue) {
765
+ handleChange(selectedValue.value);
766
+ }
767
+ },
768
+ clearable: false
769
+ }, rest));
767
770
  };
768
771
 
769
772
  /**
@@ -870,6 +873,9 @@ var RouteLeavingGuard = function RouteLeavingGuard(_ref) {
870
873
  }));
871
874
  };
872
875
 
876
+ /**
877
+ * @deprecated Consider to copy component for own usage or use entur design system.
878
+ */
873
879
  var StatusLabel = function StatusLabel(_ref) {
874
880
  var _ref$active = _ref.active,
875
881
  active = _ref$active === void 0 ? false : _ref$active,
@@ -896,6 +902,10 @@ var StatusLabel = function StatusLabel(_ref) {
896
902
  };
897
903
 
898
904
  var _excluded$2 = ["as", "children", "fontSize", "color", "lineHeight", "fontWeight", "className"];
905
+ /**
906
+ *
907
+ * @deprecated Use Entur design system Text component.
908
+ */
899
909
  var Text = function Text(_ref) {
900
910
  var _ref$as = _ref.as,
901
911
  component = _ref$as === void 0 ? "span" : _ref$as,
@@ -921,6 +931,9 @@ var Text = function Text(_ref) {
921
931
  };
922
932
 
923
933
  var _excluded$1 = ["children", "className"];
934
+ /**
935
+ * @deprecated Consider to copy component for own usage.
936
+ */
924
937
  var Unbutton = function Unbutton(_ref) {
925
938
  var children = _ref.children,
926
939
  className = _ref.className,