@entur-partner/common 8.0.5 → 9.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.
- package/dist/OrganisationDropdown.d.ts +6 -6
- package/dist/UserMenu/components/CookieSettingsMenuItem.d.ts +9 -0
- package/dist/UserMenu/index.d.ts +3 -0
- package/dist/common.cjs.development.js +32 -7
- 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 +33 -8
- package/dist/common.esm.js.map +1 -1
- package/dist/styles.css +665 -665
- package/package.json +2 -2
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
interface
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
interface OrganisationV3 {
|
|
3
|
+
organisationId: number;
|
|
4
|
+
tradingName: string;
|
|
5
5
|
}
|
|
6
6
|
interface OrganisationDropDownProps {
|
|
7
7
|
label: string;
|
|
8
|
-
onChange: (
|
|
9
|
-
organisations:
|
|
10
|
-
selectedOrganisationId?:
|
|
8
|
+
onChange: (organisationId: number) => void;
|
|
9
|
+
organisations: OrganisationV3[];
|
|
10
|
+
selectedOrganisationId?: number;
|
|
11
11
|
[key: string]: any;
|
|
12
12
|
}
|
|
13
13
|
export declare const OrganisationDropDown: FC<OrganisationDropDownProps>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import '../index.scss';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
type Props = {
|
|
4
|
+
name: string;
|
|
5
|
+
setOpen: (open: boolean) => void;
|
|
6
|
+
onCookieSettingsOpen: () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const CookieSettingsMenuItem: ({ name, setOpen, onCookieSettingsOpen, }: Props) => React.JSX.Element;
|
|
9
|
+
export {};
|
package/dist/UserMenu/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ interface UserMenuProps {
|
|
|
8
8
|
switchLanguage: string;
|
|
9
9
|
appVersion?: string;
|
|
10
10
|
myProfile?: string;
|
|
11
|
+
cookieSettings?: string;
|
|
11
12
|
};
|
|
12
13
|
onLogout: () => void;
|
|
13
14
|
onLanguageChange: (language: string) => void;
|
|
@@ -16,7 +17,9 @@ interface UserMenuProps {
|
|
|
16
17
|
environment?: Environment;
|
|
17
18
|
showVersionItem?: boolean;
|
|
18
19
|
showMyProfileItem?: boolean;
|
|
20
|
+
showCookieSettingsItem?: boolean;
|
|
19
21
|
onNavigateToMyProfile: () => void;
|
|
22
|
+
onCookieSettingsOpen?: () => void;
|
|
20
23
|
}
|
|
21
24
|
export declare const UserMenu: FC<UserMenuProps>;
|
|
22
25
|
export {};
|
|
@@ -498,6 +498,24 @@ var LogOutMenuItem = function LogOutMenuItem(_ref) {
|
|
|
498
498
|
})), name);
|
|
499
499
|
};
|
|
500
500
|
|
|
501
|
+
var CookieSettingsMenuItem = function CookieSettingsMenuItem(_ref) {
|
|
502
|
+
var name = _ref.name,
|
|
503
|
+
setOpen = _ref.setOpen,
|
|
504
|
+
onCookieSettingsOpen = _ref.onCookieSettingsOpen;
|
|
505
|
+
return React__default["default"].createElement(CustomOverflowMenuItem, {
|
|
506
|
+
onClick: function onClick() {
|
|
507
|
+
onCookieSettingsOpen();
|
|
508
|
+
setOpen(false);
|
|
509
|
+
},
|
|
510
|
+
className: "eps-overflow-menu__item"
|
|
511
|
+
}, React__default["default"].createElement("span", {
|
|
512
|
+
"aria-hidden": true
|
|
513
|
+
}, React__default["default"].createElement(icons.ConfigurationIcon, {
|
|
514
|
+
size: "1rem",
|
|
515
|
+
inline: true
|
|
516
|
+
})), name);
|
|
517
|
+
};
|
|
518
|
+
|
|
501
519
|
var UserMenu = function UserMenu(_ref) {
|
|
502
520
|
var className = _ref.className,
|
|
503
521
|
messages = _ref.messages,
|
|
@@ -508,7 +526,10 @@ var UserMenu = function UserMenu(_ref) {
|
|
|
508
526
|
environment = _ref.environment,
|
|
509
527
|
showVersionItem = _ref.showVersionItem,
|
|
510
528
|
showMyProfileItem = _ref.showMyProfileItem,
|
|
511
|
-
|
|
529
|
+
showCookieSettingsItem = _ref.showCookieSettingsItem,
|
|
530
|
+
onNavigateToMyProfile = _ref.onNavigateToMyProfile,
|
|
531
|
+
_ref$onCookieSettings = _ref.onCookieSettingsOpen,
|
|
532
|
+
onCookieSettingsOpen = _ref$onCookieSettings === void 0 ? function () {} : _ref$onCookieSettings;
|
|
512
533
|
var triggerClassList = cx__default["default"](['eps-user-menu__trigger-button', className]);
|
|
513
534
|
var _useState = React.useState(false),
|
|
514
535
|
open = _useState[0],
|
|
@@ -535,6 +556,10 @@ var UserMenu = function UserMenu(_ref) {
|
|
|
535
556
|
name: messages.myProfile,
|
|
536
557
|
setOpen: setOpen,
|
|
537
558
|
onNavigateToMyProfile: onNavigateToMyProfile
|
|
559
|
+
}), showCookieSettingsItem && messages.cookieSettings && React__default["default"].createElement(CookieSettingsMenuItem, {
|
|
560
|
+
name: messages.cookieSettings,
|
|
561
|
+
setOpen: setOpen,
|
|
562
|
+
onCookieSettingsOpen: onCookieSettingsOpen
|
|
538
563
|
}), React__default["default"].createElement(LogOutMenuItem, {
|
|
539
564
|
name: messages.logout,
|
|
540
565
|
setOpen: setOpen,
|
|
@@ -554,23 +579,23 @@ var OrganisationDropDown = function OrganisationDropDown(_ref) {
|
|
|
554
579
|
setSelectedOrganisation = _useState[1];
|
|
555
580
|
React.useEffect(function () {
|
|
556
581
|
setSelectedOrganisation(organisations.find(function (org) {
|
|
557
|
-
return org.
|
|
582
|
+
return org.organisationId === selectedOrganisationId;
|
|
558
583
|
}));
|
|
559
584
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
560
585
|
}, [selectedOrganisationId]);
|
|
561
586
|
return React__default["default"].createElement(dropdown.SearchableDropdown, _extends({
|
|
562
587
|
label: label,
|
|
563
588
|
items: [].concat(organisations.sort(function (a, b) {
|
|
564
|
-
return a.
|
|
589
|
+
return a.tradingName.localeCompare(b.tradingName, 'nb');
|
|
565
590
|
}).map(function (organisation) {
|
|
566
591
|
return {
|
|
567
|
-
value: organisation.
|
|
568
|
-
label: organisation.
|
|
592
|
+
value: organisation.organisationId,
|
|
593
|
+
label: organisation.tradingName
|
|
569
594
|
};
|
|
570
595
|
})),
|
|
571
596
|
selectedItem: selectedOrganisation ? {
|
|
572
|
-
value: selectedOrganisation.
|
|
573
|
-
label: selectedOrganisation.
|
|
597
|
+
value: selectedOrganisation.organisationId,
|
|
598
|
+
label: selectedOrganisation.tradingName
|
|
574
599
|
} : null,
|
|
575
600
|
onChange: function onChange(selectedValue) {
|
|
576
601
|
if (selectedValue) {
|