@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.
- package/dist/ActionBar.d.ts +1 -1
- package/dist/AuditInfo.d.ts +3 -0
- package/dist/Box.d.ts +4 -0
- package/dist/ErrorBoundary.d.ts +0 -1
- package/dist/ExpandableMultiLanguageInput.d.ts +3 -0
- package/dist/FeatureToggle.d.ts +3 -1
- package/dist/FormatCurrencyAmount.d.ts +4 -0
- package/dist/FormatDateTime.d.ts +6 -1
- package/dist/LanguageSelect.d.ts +6 -1
- package/dist/Link.d.ts +4 -0
- package/dist/LinkButton.d.ts +5 -1
- package/dist/MultiLanguageInput.d.ts +2 -2
- package/dist/Stack.d.ts +5 -1
- package/dist/StatusLabel.d.ts +3 -0
- package/dist/Text.d.ts +4 -0
- package/dist/Unbutton.d.ts +3 -0
- package/dist/common.cjs.development.js +66 -53
- package/dist/common.cjs.development.js.map +1 -1
- package/dist/common.cjs.production.min.js +1 -1
- package/dist/common.cjs.production.min.js.map +1 -1
- package/dist/common.esm.js +67 -54
- package/dist/common.esm.js.map +1 -1
- package/dist/styles.css +59 -59
- package/package.json +6 -6
package/dist/common.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { localeDate, localeDateTime, isDate, isDateString, splitUrlPath, isString, isFunction, assertIsDefined, hasAllPermissions, hasOneOfPermissions } from '@entur-partner/util';
|
|
3
3
|
import cx from 'classnames';
|
|
4
|
-
import { Children, Component, useState,
|
|
4
|
+
import { Children, Component, useState, useEffect, useRef } from 'react';
|
|
5
5
|
import { BreadcrumbItem, BreadcrumbNavigation, Pagination } from '@entur/menu';
|
|
6
6
|
import { Link as Link$1, useInRouterContext, useBlocker } from 'react-router-dom';
|
|
7
7
|
import { ButtonGroup, SecondaryButton, PrimaryButton, Button } from '@entur/button';
|
|
@@ -67,6 +67,10 @@ function _setPrototypeOf(t, e) {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
var _excluded$e = ["date", "locale", "as", "hideTime"];
|
|
70
|
+
/**
|
|
71
|
+
*
|
|
72
|
+
* @deprecated Consider to use localeDate and localeDateTime functions from @entur-partner/util instead.
|
|
73
|
+
*/
|
|
70
74
|
var FormatDateTime = function FormatDateTime(_ref) {
|
|
71
75
|
var date = _ref.date,
|
|
72
76
|
locale = _ref.locale,
|
|
@@ -90,6 +94,10 @@ function responsiveProp(prefix, prop) {
|
|
|
90
94
|
}
|
|
91
95
|
return [prefix + prop];
|
|
92
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
*
|
|
99
|
+
* @deprecated Consider to use Tailwind or similar utility-first CSS framework instead.
|
|
100
|
+
*/
|
|
93
101
|
var Box = function Box(_ref) {
|
|
94
102
|
var _ref$as = _ref.as,
|
|
95
103
|
Component = _ref$as === void 0 ? "div" : _ref$as,
|
|
@@ -157,6 +165,9 @@ var Box = function Box(_ref) {
|
|
|
157
165
|
}));
|
|
158
166
|
};
|
|
159
167
|
|
|
168
|
+
/**
|
|
169
|
+
* @deprecated Consider to use Tailwind or CSS/SCSS directly.
|
|
170
|
+
*/
|
|
160
171
|
var Stack = function Stack(_ref) {
|
|
161
172
|
var children = _ref.children,
|
|
162
173
|
space = _ref.space,
|
|
@@ -181,6 +192,9 @@ var Stack = function Stack(_ref) {
|
|
|
181
192
|
};
|
|
182
193
|
|
|
183
194
|
var _excluded$c = ["items", "locale", "className"];
|
|
195
|
+
/**
|
|
196
|
+
* @deprecated Only Product Frontend uses this component. Consider to move it there.
|
|
197
|
+
*/
|
|
184
198
|
var AuditInfo = function AuditInfo(_ref) {
|
|
185
199
|
var items = _ref.items,
|
|
186
200
|
locale = _ref.locale,
|
|
@@ -452,6 +466,9 @@ function RefreshBannerInfo() {
|
|
|
452
466
|
}
|
|
453
467
|
|
|
454
468
|
var _excluded$9 = ["title", "inputComponent", "languages", "values", "onChange", "name", "variant", "feedback"];
|
|
469
|
+
/**
|
|
470
|
+
* @deprecated No longer in use by anyone.
|
|
471
|
+
*/
|
|
455
472
|
var ExpandableMultiLanguageInput = function ExpandableMultiLanguageInput(_ref) {
|
|
456
473
|
var title = _ref.title,
|
|
457
474
|
InputComponent = _ref.inputComponent,
|
|
@@ -519,6 +536,7 @@ function featureFlag(flag) {
|
|
|
519
536
|
* Returns true if the provided flag exist in localStorage
|
|
520
537
|
* or is set as an environment variable.
|
|
521
538
|
*
|
|
539
|
+
* @deprecated use featureFlag instead.
|
|
522
540
|
* @param flag case sensitive flag. If it is an environment variable
|
|
523
541
|
* you can drop the VITE_APP_ prefix.
|
|
524
542
|
*/
|
|
@@ -528,7 +546,7 @@ function useFeatureToggle(flag) {
|
|
|
528
546
|
var FeatureToggle = function FeatureToggle(_ref) {
|
|
529
547
|
var children = _ref.children,
|
|
530
548
|
flag = _ref.flag;
|
|
531
|
-
var feature =
|
|
549
|
+
var feature = featureFlag(flag);
|
|
532
550
|
if (feature) {
|
|
533
551
|
return jsx(Fragment, {
|
|
534
552
|
children: children
|
|
@@ -538,6 +556,10 @@ var FeatureToggle = function FeatureToggle(_ref) {
|
|
|
538
556
|
};
|
|
539
557
|
|
|
540
558
|
var _excluded$8 = ["amount", "as"];
|
|
559
|
+
/**
|
|
560
|
+
*
|
|
561
|
+
* @deprecated Moved to @entur-partner/util as a function instead.
|
|
562
|
+
*/
|
|
541
563
|
var FormatCurrencyAmount = function FormatCurrencyAmount(_ref) {
|
|
542
564
|
var amount = _ref.amount,
|
|
543
565
|
_ref$as = _ref.as,
|
|
@@ -554,6 +576,10 @@ var FormatCurrencyAmount = function FormatCurrencyAmount(_ref) {
|
|
|
554
576
|
};
|
|
555
577
|
|
|
556
578
|
var _excluded$7 = ["language", "options", "className", "onChange"];
|
|
579
|
+
/**
|
|
580
|
+
*
|
|
581
|
+
* @deprecated This component is no longer in use by anyone.
|
|
582
|
+
*/
|
|
557
583
|
var LanguageSelect = function LanguageSelect(_ref) {
|
|
558
584
|
var language = _ref.language,
|
|
559
585
|
options = _ref.options,
|
|
@@ -584,6 +610,10 @@ var LanguageSelect = function LanguageSelect(_ref) {
|
|
|
584
610
|
}));
|
|
585
611
|
};
|
|
586
612
|
|
|
613
|
+
/**
|
|
614
|
+
*
|
|
615
|
+
* @deprecated Use Link from react-router instead.
|
|
616
|
+
*/
|
|
587
617
|
var Link = function Link(props) {
|
|
588
618
|
return jsx(Link$2, _extends({}, props, {
|
|
589
619
|
as: Link$1,
|
|
@@ -592,6 +622,9 @@ var Link = function Link(props) {
|
|
|
592
622
|
};
|
|
593
623
|
|
|
594
624
|
var _excluded$6 = ["children", "className"];
|
|
625
|
+
/**
|
|
626
|
+
* @deprecated LinkButton is not UU compliant and should be replaced with a regular Link or Button component depending on the use case.
|
|
627
|
+
*/
|
|
595
628
|
var LinkButton = function LinkButton(_ref) {
|
|
596
629
|
var children = _ref.children,
|
|
597
630
|
className = _ref.className,
|
|
@@ -617,7 +650,7 @@ var Menu = function Menu(_ref) {
|
|
|
617
650
|
|
|
618
651
|
var _excluded$5 = ["className", "inputComponent", "alertLabel", "alertLevel", "name", "languages", "values", "onChange", "defaultLanguage", "label", "onBlur"];
|
|
619
652
|
/**
|
|
620
|
-
* @deprecated use
|
|
653
|
+
* @deprecated No longer in use by anyone.
|
|
621
654
|
*/
|
|
622
655
|
var MultiLanguageInput = function MultiLanguageInput(_ref) {
|
|
623
656
|
var className = _ref.className,
|
|
@@ -694,16 +727,12 @@ var MultiLanguageInput = function MultiLanguageInput(_ref) {
|
|
|
694
727
|
};
|
|
695
728
|
|
|
696
729
|
var _excluded$4 = ["label", "organisations", "onChange", "selectedOrganisationId"];
|
|
697
|
-
function isInShadowDom(el) {
|
|
698
|
-
return (el == null ? void 0 : el.getRootNode()) instanceof ShadowRoot;
|
|
699
|
-
}
|
|
700
730
|
var OrganisationDropDown = function OrganisationDropDown(_ref) {
|
|
701
731
|
var label = _ref.label,
|
|
702
732
|
organisations = _ref.organisations,
|
|
703
733
|
handleChange = _ref.onChange,
|
|
704
734
|
selectedOrganisationId = _ref.selectedOrganisationId,
|
|
705
735
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
706
|
-
var wrapperRef = useRef(null);
|
|
707
736
|
var _useState = useState(),
|
|
708
737
|
selectedOrganisation = _useState[0],
|
|
709
738
|
setSelectedOrganisation = _useState[1];
|
|
@@ -712,53 +741,27 @@ var OrganisationDropDown = function OrganisationDropDown(_ref) {
|
|
|
712
741
|
return org.organisationId === selectedOrganisationId;
|
|
713
742
|
}));
|
|
714
743
|
}, [selectedOrganisationId, organisations]);
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
ref: wrapperRef,
|
|
737
|
-
onMouseDown: handleMouseDown,
|
|
738
|
-
onMouseUp: handleMouseUp,
|
|
739
|
-
children: jsx(SearchableDropdown, _extends({
|
|
740
|
-
label: label,
|
|
741
|
-
items: [].concat(organisations.sort(function (a, b) {
|
|
742
|
-
return a.tradingName.localeCompare(b.tradingName, "nb");
|
|
743
|
-
}).map(function (organisation) {
|
|
744
|
-
return {
|
|
745
|
-
value: organisation.organisationId,
|
|
746
|
-
label: organisation.tradingName
|
|
747
|
-
};
|
|
748
|
-
})),
|
|
749
|
-
selectedItem: selectedOrganisation ? {
|
|
750
|
-
value: selectedOrganisation.organisationId,
|
|
751
|
-
label: selectedOrganisation.tradingName
|
|
752
|
-
} : null,
|
|
753
|
-
onChange: function onChange(selectedValue) {
|
|
754
|
-
if (selectedValue) {
|
|
755
|
-
handleChange(selectedValue.value);
|
|
756
|
-
}
|
|
757
|
-
},
|
|
758
|
-
clearable: false
|
|
759
|
-
}, rest))
|
|
760
|
-
})
|
|
761
|
-
);
|
|
744
|
+
return jsx(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));
|
|
762
765
|
};
|
|
763
766
|
|
|
764
767
|
/**
|
|
@@ -865,6 +868,9 @@ var RouteLeavingGuard = function RouteLeavingGuard(_ref) {
|
|
|
865
868
|
}));
|
|
866
869
|
};
|
|
867
870
|
|
|
871
|
+
/**
|
|
872
|
+
* @deprecated Consider to copy component for own usage or use entur design system.
|
|
873
|
+
*/
|
|
868
874
|
var StatusLabel = function StatusLabel(_ref) {
|
|
869
875
|
var _ref$active = _ref.active,
|
|
870
876
|
active = _ref$active === void 0 ? false : _ref$active,
|
|
@@ -891,6 +897,10 @@ var StatusLabel = function StatusLabel(_ref) {
|
|
|
891
897
|
};
|
|
892
898
|
|
|
893
899
|
var _excluded$2 = ["as", "children", "fontSize", "color", "lineHeight", "fontWeight", "className"];
|
|
900
|
+
/**
|
|
901
|
+
*
|
|
902
|
+
* @deprecated Use Entur design system Text component.
|
|
903
|
+
*/
|
|
894
904
|
var Text = function Text(_ref) {
|
|
895
905
|
var _ref$as = _ref.as,
|
|
896
906
|
component = _ref$as === void 0 ? "span" : _ref$as,
|
|
@@ -916,6 +926,9 @@ var Text = function Text(_ref) {
|
|
|
916
926
|
};
|
|
917
927
|
|
|
918
928
|
var _excluded$1 = ["children", "className"];
|
|
929
|
+
/**
|
|
930
|
+
* @deprecated Consider to copy component for own usage.
|
|
931
|
+
*/
|
|
919
932
|
var Unbutton = function Unbutton(_ref) {
|
|
920
933
|
var children = _ref.children,
|
|
921
934
|
className = _ref.className,
|