@altinn/altinn-components 0.66.1 → 0.67.1
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/{ToolbarSearch-DFYx6gIb.js → ToolbarSearch-bv2opbAj.js} +52 -52
- package/dist/assets/AccountSelector.css +1 -1
- package/dist/components/AccessAreaListItem/AccessAreaListItem.js +1 -1
- package/dist/components/AccessPackageListItem/AccessPackageListItem.js +1 -1
- package/dist/components/Account/AccountList.js +1 -1
- package/dist/components/Account/AccountListItem.js +1 -1
- package/dist/components/Account/AccountListItemControls.js +1 -1
- package/dist/components/Account/AccountListItemDetails.js +1 -1
- package/dist/components/Account/AccountListVirtual.js +1 -1
- package/dist/components/Account/AccountMenu.js +1 -1
- package/dist/components/Account/AccountNotificationSettings.js +1 -1
- package/dist/components/Account/AccountOrganization.js +1 -1
- package/dist/components/AccountSelector/AccountSelector.js +56 -55
- package/dist/components/ActivityLog/ActivityLog.js +1 -1
- package/dist/components/ActivityLog/ActivityLogItem.js +1 -1
- package/dist/components/ActivityLog/ActivityLogSegment.js +1 -1
- package/dist/components/Alert/Alert.js +1 -1
- package/dist/components/Article/Article.js +1 -1
- package/dist/components/Article/ArticleContact.js +1 -1
- package/dist/components/Article/ArticleHeader.js +1 -1
- package/dist/components/Attachment/AttachmentLink.js +1 -1
- package/dist/components/AuthEvidence/AuthEvidence.js +1 -1
- package/dist/components/AuthEvidence/AuthEvidenceItem.js +1 -1
- package/dist/components/AuthEvidence/AuthEvidenceOwner.js +1 -1
- package/dist/components/AuthEvidence/AuthEvidenceParent.js +1 -1
- package/dist/components/AuthEvidence/AuthEvidenceService.js +1 -1
- package/dist/components/Badge/Badge.js +1 -1
- package/dist/components/Badge/index.js +1 -1
- package/dist/components/Banner/Banner.js +1 -1
- package/dist/components/Bookmarks/BookmarkModal.js +1 -1
- package/dist/components/Bookmarks/BookmarkSettingsItem.js +1 -1
- package/dist/components/Bookmarks/BookmarkSettingsItemLabel.js +1 -1
- package/dist/components/Bookmarks/BookmarkSettingsList.js +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/components/Bulk/BulkHeader.js +1 -1
- package/dist/components/Button/ButtonIcon.js +1 -1
- package/dist/components/Button/ComboButton.js +1 -1
- package/dist/components/Button/FloatingActionButton.js +1 -1
- package/dist/components/Button/IconButton.js +1 -1
- package/dist/components/Byline/Byline.js +1 -1
- package/dist/components/Byline/index.js +1 -1
- package/dist/components/ContextMenu/ContextMenu.js +1 -1
- package/dist/components/Dashboard/DashboardCard.js +1 -1
- package/dist/components/Dashboard/DashboardHeader.js +1 -1
- package/dist/components/Datepicker/Datepicker.js +1 -1
- package/dist/components/Datepicker/DatepickerHeader.js +1 -1
- package/dist/components/Datepicker/DatepickerTable.js +1 -1
- package/dist/components/Dialog/Dialog.js +1 -1
- package/dist/components/Dialog/DialogActions.js +1 -1
- package/dist/components/Dialog/DialogActivityLog.js +1 -1
- package/dist/components/Dialog/DialogAttachments.js +1 -1
- package/dist/components/Dialog/DialogBody.js +1 -1
- package/dist/components/Dialog/DialogByline.js +1 -1
- package/dist/components/Dialog/DialogContact.js +1 -1
- package/dist/components/Dialog/DialogHeader.js +1 -1
- package/dist/components/Dialog/DialogHistory.js +1 -1
- package/dist/components/Dialog/DialogHistoryItem.js +1 -1
- package/dist/components/Dialog/DialogHistorySegment.js +1 -1
- package/dist/components/Dialog/DialogLayout.js +1 -1
- package/dist/components/Dialog/DialogList.js +1 -1
- package/dist/components/Dialog/DialogListItem.js +1 -1
- package/dist/components/Dialog/DialogMetadata.js +1 -1
- package/dist/components/Dialog/DialogSection.js +1 -1
- package/dist/components/Dialog/DialogSeenBy.js +1 -1
- package/dist/components/Dialog/DialogSelect.js +1 -1
- package/dist/components/Dialog/DialogStatus.js +1 -1
- package/dist/components/Dialog/DialogTabs.js +1 -1
- package/dist/components/Dialog/SeenByLog.js +1 -1
- package/dist/components/Dialog/SeenByLogButton.js +1 -1
- package/dist/components/Dialog/SeenByLogItem.js +1 -1
- package/dist/components/Dialog/index.js +1 -1
- package/dist/components/Dropdown/DrawerButton.js +1 -1
- package/dist/components/Dropdown/DrawerHeader.js +1 -1
- package/dist/components/Dropdown/Dropdown.js +1 -1
- package/dist/components/Dropdown/DropdownBase.js +1 -1
- package/dist/components/Dropdown/FloatingDropdown.js +1 -1
- package/dist/components/Dropdown/index.js +1 -1
- package/dist/components/Forms/Checkbox.js +1 -1
- package/dist/components/Forms/CheckboxOptions.js +1 -1
- package/dist/components/Forms/FieldBase.js +1 -1
- package/dist/components/Forms/FieldsetBase.js +1 -1
- package/dist/components/Forms/Radio.js +1 -1
- package/dist/components/Forms/RadioOptions.js +1 -1
- package/dist/components/Forms/SearchField.js +1 -1
- package/dist/components/Forms/SelectField.js +1 -1
- package/dist/components/Forms/Switch.js +1 -1
- package/dist/components/Forms/SwitchOptions.js +1 -1
- package/dist/components/Forms/TextField.js +1 -1
- package/dist/components/Forms/TextFieldDropdown.js +1 -1
- package/dist/components/Forms/TextareaField.js +1 -1
- package/dist/components/Forms/index.js +1 -1
- package/dist/components/GlobalHeader/GlobalAccountButton.js +2 -1
- package/dist/components/GlobalHeader/GlobalHeader.js +10 -10
- package/dist/components/GlobalHeader/GlobalMenuButton.js +10 -9
- package/dist/components/GlobalHeader/HeaderDrawer.js +1 -1
- package/dist/components/GlobalHeader/HeaderDropdown.js +1 -1
- package/dist/components/GlobalHeader/HeaderLogo.js +1 -1
- package/dist/components/GlobalMenu/GlobalMenu.js +1 -1
- package/dist/components/GlobalMenu/LocaleSwitcher.js +1 -1
- package/dist/components/GlobalMenu/LogoutButton.js +1 -1
- package/dist/components/Icon/Icon.js +1 -1
- package/dist/components/Icon/index.js +1 -1
- package/dist/components/Inbox/InboxPage.js +1 -1
- package/dist/components/InboxSearch/InboxSearch.js +1 -1
- package/dist/components/Item/ItemLabel.js +1 -1
- package/dist/components/Item/ItemMedia.js +1 -1
- package/dist/components/Item/ItemSelect.js +1 -1
- package/dist/components/Item/index.js +1 -1
- package/dist/components/Layout/Layout.js +1 -1
- package/dist/components/List/List.js +1 -1
- package/dist/components/List/ListBase.js +1 -1
- package/dist/components/List/ListItemHeader.js +1 -1
- package/dist/components/List/ListItemIcon.js +1 -1
- package/dist/components/List/ListItemLabel.js +1 -1
- package/dist/components/Menu/Menu.js +1 -1
- package/dist/components/Menu/MenuItem.js +1 -1
- package/dist/components/Menu/MenuItems.js +1 -1
- package/dist/components/Menu/MenuListHeading.js +2 -2
- package/dist/components/Menu/MenuListSearch.js +1 -1
- package/dist/components/Menu/MenuOption.js +1 -1
- package/dist/components/Menu/TabMenu.js +1 -1
- package/dist/components/Menu/VirtualizedMenuItems.js +1 -1
- package/dist/components/Menu/index.js +1 -1
- package/dist/components/Menu/useMenuSearch.js +1 -1
- package/dist/components/Metadata/MetaItem.js +1 -1
- package/dist/components/Metadata/MetaItemIcon.js +1 -1
- package/dist/components/Metadata/MetaTimestamp.js +1 -1
- package/dist/components/Metadata/Metadata.js +1 -1
- package/dist/components/Metadata/index.js +1 -1
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/Modal/ModalBase.js +1 -1
- package/dist/components/Modal/ModalHeader.js +1 -1
- package/dist/components/Modal/ModalIcon.js +1 -1
- package/dist/components/Notifications/NotificationItem.js +1 -1
- package/dist/components/Notifications/NotificationItemBase.js +1 -1
- package/dist/components/Notifications/NotificationItemControls.js +1 -1
- package/dist/components/Notifications/NotificationItemIcon.js +1 -1
- package/dist/components/Page/AccordionSection.js +1 -1
- package/dist/components/Page/ContactButtons.js +1 -1
- package/dist/components/Page/ContactSection.js +1 -1
- package/dist/components/Page/PageMenu.js +1 -1
- package/dist/components/Page/PageNav.js +1 -1
- package/dist/components/Page/Section.js +1 -1
- package/dist/components/Pagination/Pagination.js +1 -1
- package/dist/components/ResourceListItem/ResourceListItem.js +1 -1
- package/dist/components/RootProvider/RootProvider.js +1 -1
- package/dist/components/RootProvider/index.js +1 -1
- package/dist/components/Search/SearchItem.js +1 -1
- package/dist/components/Searchbar/Autocomplete.js +1 -1
- package/dist/components/Searchbar/AutocompleteItem.js +1 -1
- package/dist/components/Searchbar/Searchbar.js +1 -1
- package/dist/components/Searchbar/SearchbarField.js +1 -1
- package/dist/components/Settings/SettingsItem.js +1 -1
- package/dist/components/Settings/SettingsItemBase.js +1 -1
- package/dist/components/Settings/SettingsList.js +1 -1
- package/dist/components/Settings/SettingsListVirtual.js +1 -1
- package/dist/components/Settings/SettingsModal.js +1 -1
- package/dist/components/Settings/SettingsSection.js +1 -1
- package/dist/components/Settings/UsedByLog.js +1 -1
- package/dist/components/Settings/UsedByLogItem.js +1 -1
- package/dist/components/Snackbar/SnackbarItem.js +1 -1
- package/dist/components/Timeline/Timeline.js +1 -1
- package/dist/components/Timeline/TimelineActivity.js +1 -1
- package/dist/components/Timeline/TimelineBase.js +1 -1
- package/dist/components/Timeline/TimelineFooter.js +1 -1
- package/dist/components/Timeline/TimelineHeader.js +1 -1
- package/dist/components/Timeline/TimelineIcon.js +1 -1
- package/dist/components/Timeline/TimelineSection.js +1 -1
- package/dist/components/Timeline/TimelineSegment.js +1 -1
- package/dist/components/Toolbar/DatepickerFilter.js +1 -1
- package/dist/components/Toolbar/SelectDateFilter.js +1 -1
- package/dist/components/Toolbar/Toolbar.js +1 -1
- package/dist/components/Toolbar/ToolbarFilter.js +1 -1
- package/dist/components/Toolbar/ToolbarFilterAddMenu.js +1 -1
- package/dist/components/Toolbar/ToolbarFilterButton.js +21 -20
- package/dist/components/Toolbar/ToolbarFilterMenu.js +1 -1
- package/dist/components/Toolbar/ToolbarMenu.js +1 -1
- package/dist/components/Toolbar/ToolbarSearch.js +1 -1
- package/dist/components/Toolbar/index.js +1 -1
- package/dist/components/Transmission/Transmission.js +1 -1
- package/dist/components/Transmission/TransmissionList.js +1 -1
- package/dist/components/Transmission/TransmissionType.js +1 -1
- package/dist/components/Typography/Heading.js +1 -1
- package/dist/components/Typography/index.js +1 -1
- package/dist/components/UserListItem/UserListItem.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/hooks/useAccountSelector.js +127 -120
- package/dist/index.js +1 -1
- package/dist/types/lib/components/AccountSelector/AccountSelector.d.ts +9 -1
- package/dist/types/lib/components/AccountSelector/AccountSelector.stories.d.ts +6 -1
- package/dist/types/lib/components/Layout/AccountSelectorInLayout.stories.d.ts +49 -0
- package/dist/types/lib/components/Layout/Layout.stories.d.ts +0 -1
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import { jsx as i, jsxs as s } from "react/jsx-runtime";
|
|
|
2
2
|
import { createElement as l } from "react";
|
|
3
3
|
import "../../index-p1eeF8LQ.js";
|
|
4
4
|
import "../../tooltip-Ct39-719.js";
|
|
5
|
-
import { a } from "../../ToolbarSearch-
|
|
5
|
+
import { a } from "../../ToolbarSearch-bv2opbAj.js";
|
|
6
6
|
import "../Typography/Link.js";
|
|
7
7
|
import "../Button/Button.js";
|
|
8
8
|
import "react-dom";
|
|
@@ -3,7 +3,7 @@ import "../../index-p1eeF8LQ.js";
|
|
|
3
3
|
import "react";
|
|
4
4
|
import "../Skeleton/Skeleton.js";
|
|
5
5
|
import "../../tooltip-Ct39-719.js";
|
|
6
|
-
import { H as s } from "../../ToolbarSearch-
|
|
6
|
+
import { H as s } from "../../ToolbarSearch-bv2opbAj.js";
|
|
7
7
|
import "./useHighlightedText.js";
|
|
8
8
|
import "./Link.js";
|
|
9
9
|
import "../Button/Button.js";
|
package/dist/components/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import { AccountNotificationSettings as A } from "./Account/AccountNotificationS
|
|
|
11
11
|
import { AccountOrganization as y } from "./Account/AccountOrganization.js";
|
|
12
12
|
import { AccountSelector as k } from "./AccountSelector/AccountSelector.js";
|
|
13
13
|
import { Alert as v } from "./Alert/Alert.js";
|
|
14
|
-
import { B as P, a as C, D as H, b as w, c as E, d as G, e as O, f as R, g as N, F as V, H as U, I as z, h as j, i as Q, M as q, j as J, k as K, l as W, m as X, n as Y, R as Z, S as _, T as $, t as oo, V as ro, u as eo, w as to } from "../ToolbarSearch-
|
|
14
|
+
import { B as P, a as C, D as H, b as w, c as E, d as G, e as O, f as R, g as N, F as V, H as U, I as z, h as j, i as Q, M as q, j as J, k as K, l as W, m as X, n as Y, R as Z, S as _, T as $, t as oo, V as ro, u as eo, w as to } from "../ToolbarSearch-bv2opbAj.js";
|
|
15
15
|
import { Banner as ao, BannerColorEnum as po, BannerVariantEnum as io } from "./Banner/Banner.js";
|
|
16
16
|
import { BookmarkSettingsItem as fo } from "./Bookmarks/BookmarkSettingsItem.js";
|
|
17
17
|
import { BookmarkSettingsList as no } from "./Bookmarks/BookmarkSettingsList.js";
|
|
@@ -1,112 +1,118 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
1
|
+
import { jsx as F } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as R, useMemo as h } from "react";
|
|
3
3
|
import "../index-p1eeF8LQ.js";
|
|
4
4
|
import "../tooltip-Ct39-719.js";
|
|
5
|
-
import "../ToolbarSearch-
|
|
5
|
+
import "../ToolbarSearch-bv2opbAj.js";
|
|
6
6
|
import "../components/Typography/Link.js";
|
|
7
|
-
import { Button as
|
|
7
|
+
import { Button as q } from "../components/Button/Button.js";
|
|
8
8
|
import "react-dom";
|
|
9
|
-
import { useIsDesktop as
|
|
9
|
+
import { useIsDesktop as J } from "./useIsDesktop.js";
|
|
10
10
|
import "../components/GlobalMenu/GlobalMenuBase.js";
|
|
11
11
|
import "../components/Snackbar/useSnackbar.js";
|
|
12
|
-
import { formatDisplayName as
|
|
13
|
-
import { formatDate as
|
|
14
|
-
import { formatOrgNo as
|
|
15
|
-
import { a as
|
|
16
|
-
const H = (
|
|
17
|
-
partyListDTO:
|
|
18
|
-
favoriteAccountUuids:
|
|
12
|
+
import { formatDisplayName as j } from "../functions/name/name.js";
|
|
13
|
+
import { formatDate as K } from "../functions/date/date.js";
|
|
14
|
+
import { formatOrgNo as w } from "../functions/orgno/orgno.js";
|
|
15
|
+
import { a as Q, S as X } from "../HeartFill-CbQmSZr5.js";
|
|
16
|
+
const H = (e) => e === "Organization" ? "company" : "person", pt = ({
|
|
17
|
+
partyListDTO: e = [],
|
|
18
|
+
favoriteAccountUuids: o,
|
|
19
19
|
currentAccountUuid: f,
|
|
20
|
-
selfAccountUuid:
|
|
21
|
-
isLoading:
|
|
20
|
+
selfAccountUuid: d,
|
|
21
|
+
isLoading: m = !1,
|
|
22
22
|
onSelectAccount: N,
|
|
23
23
|
virtualized: p = !1,
|
|
24
|
-
onToggleFavorite:
|
|
25
|
-
languageCode:
|
|
26
|
-
showDeletedUnits:
|
|
27
|
-
onShowDeletedUnitsChange:
|
|
24
|
+
onToggleFavorite: I,
|
|
25
|
+
languageCode: s,
|
|
26
|
+
showDeletedUnits: c,
|
|
27
|
+
onShowDeletedUnitsChange: g
|
|
28
28
|
}) => {
|
|
29
|
-
const v =
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
const y =
|
|
34
|
-
if (!
|
|
35
|
-
const
|
|
29
|
+
const v = J(), u = R(I);
|
|
30
|
+
u.current = I;
|
|
31
|
+
const _ = R(f);
|
|
32
|
+
_.current = f;
|
|
33
|
+
const y = h(() => {
|
|
34
|
+
if (!e || e.length === 0) return [];
|
|
35
|
+
const i = s || "nb", r = (n, l) => n.name.localeCompare(l.name, i, {
|
|
36
36
|
sensitivity: "base",
|
|
37
37
|
ignorePunctuation: !0
|
|
38
38
|
});
|
|
39
|
-
return [...
|
|
40
|
-
}, [
|
|
41
|
-
|
|
39
|
+
return [...e].sort(r);
|
|
40
|
+
}, [e, s]), $ = h(
|
|
41
|
+
() => e.some((i) => i.isDeleted || i.subunits?.some((r) => r.isDeleted)),
|
|
42
|
+
[e]
|
|
43
|
+
), V = h(
|
|
44
|
+
() => e.reduce((i, r) => i + 1 + (r.subunits?.length ?? 0), 0),
|
|
45
|
+
[e]
|
|
46
|
+
), [D, W] = h(() => {
|
|
47
|
+
if (m || !y.length || !d)
|
|
42
48
|
return [
|
|
43
49
|
{ selfAccountItem: void 0, peopleAccountItems: [], organizationAccountItems: [], favoriteAccountItems: [] },
|
|
44
50
|
{}
|
|
45
51
|
];
|
|
46
|
-
const
|
|
52
|
+
const i = new Set(o), r = (t) => i.has(t), n = (t) => !t.isDeleted || c !== !1 || t.partyUuid === _.current, l = M(s), A = s || "nb", G = (t, a) => t.name.localeCompare(a.name, A, {
|
|
47
53
|
sensitivity: "base",
|
|
48
54
|
ignorePunctuation: !0
|
|
49
55
|
});
|
|
50
|
-
let
|
|
51
|
-
const k = [],
|
|
56
|
+
let x;
|
|
57
|
+
const k = [], U = [], S = [];
|
|
52
58
|
for (const t of y)
|
|
53
|
-
if (
|
|
54
|
-
if (t.partyUuid ===
|
|
55
|
-
|
|
56
|
-
|
|
59
|
+
if (T(t.type)) {
|
|
60
|
+
if (t.partyUuid === d)
|
|
61
|
+
x = z(
|
|
62
|
+
s,
|
|
57
63
|
t,
|
|
58
64
|
"favorites",
|
|
59
65
|
!1,
|
|
60
|
-
|
|
66
|
+
u,
|
|
61
67
|
v,
|
|
62
68
|
void 0,
|
|
63
69
|
!0
|
|
64
70
|
);
|
|
65
|
-
else if (
|
|
66
|
-
const
|
|
67
|
-
|
|
71
|
+
else if (n(t) || r(t.partyUuid)) {
|
|
72
|
+
const a = z(
|
|
73
|
+
s,
|
|
68
74
|
t,
|
|
69
75
|
t.partyUuid,
|
|
70
|
-
|
|
71
|
-
|
|
76
|
+
r(t.partyUuid),
|
|
77
|
+
u,
|
|
72
78
|
v
|
|
73
79
|
);
|
|
74
|
-
k.push(
|
|
80
|
+
k.push(a), r(t.partyUuid) && S.push({ ...a, groupId: "favorites" });
|
|
75
81
|
}
|
|
76
|
-
} else if (
|
|
77
|
-
if (
|
|
78
|
-
const
|
|
79
|
-
|
|
82
|
+
} else if (C(t.type)) {
|
|
83
|
+
if (n(t) || r(t.partyUuid)) {
|
|
84
|
+
const a = z(
|
|
85
|
+
s,
|
|
80
86
|
t,
|
|
81
87
|
t.partyUuid,
|
|
82
|
-
|
|
83
|
-
|
|
88
|
+
r(t.partyUuid),
|
|
89
|
+
u,
|
|
84
90
|
v
|
|
85
91
|
);
|
|
86
|
-
|
|
92
|
+
n(t) && U.push(a), r(t.partyUuid) && S.push({ ...a, groupId: "favorites" });
|
|
87
93
|
}
|
|
88
94
|
if (t.subunits && t.subunits.length > 0) {
|
|
89
|
-
const
|
|
90
|
-
for (const b of
|
|
91
|
-
if (
|
|
92
|
-
const
|
|
93
|
-
|
|
95
|
+
const a = [...t.subunits].sort(G);
|
|
96
|
+
for (const b of a)
|
|
97
|
+
if (n(b) || r(b.partyUuid)) {
|
|
98
|
+
const O = z(
|
|
99
|
+
s,
|
|
94
100
|
b,
|
|
95
101
|
t.partyUuid,
|
|
96
|
-
|
|
97
|
-
|
|
102
|
+
r(b.partyUuid),
|
|
103
|
+
u,
|
|
98
104
|
v,
|
|
99
105
|
t
|
|
100
106
|
);
|
|
101
|
-
|
|
102
|
-
...
|
|
107
|
+
n(b) && U.push(O), r(b.partyUuid) && S.push({
|
|
108
|
+
...O,
|
|
103
109
|
groupId: "favorites"
|
|
104
110
|
});
|
|
105
111
|
}
|
|
106
112
|
}
|
|
107
113
|
}
|
|
108
|
-
const
|
|
109
|
-
[
|
|
114
|
+
const Y = {
|
|
115
|
+
[U[0]?.groupId || "company"]: {
|
|
110
116
|
title: l.account_orgs,
|
|
111
117
|
divider: !0
|
|
112
118
|
},
|
|
@@ -119,23 +125,23 @@ const H = (o) => o === "Organization" ? "company" : "person", dt = ({
|
|
|
119
125
|
divider: !0
|
|
120
126
|
}
|
|
121
127
|
};
|
|
122
|
-
return [{ selfAccountItem:
|
|
123
|
-
}, [y,
|
|
124
|
-
const { selfAccountItem:
|
|
125
|
-
return
|
|
126
|
-
}, [
|
|
128
|
+
return [{ selfAccountItem: x, peopleAccountItems: k, organizationAccountItems: U, favoriteAccountItems: S }, Y];
|
|
129
|
+
}, [y, d, o, m, s, v, c]), P = h(() => {
|
|
130
|
+
const { selfAccountItem: i, peopleAccountItems: r, organizationAccountItems: n, favoriteAccountItems: l } = D;
|
|
131
|
+
return i ? [i, ...l, ...r, ...n] : [];
|
|
132
|
+
}, [D]), [E, B] = h(() => {
|
|
127
133
|
if (P.length === 0)
|
|
128
134
|
return [[], void 0];
|
|
129
|
-
let
|
|
130
|
-
return [P.map((
|
|
131
|
-
if (f ===
|
|
132
|
-
const
|
|
133
|
-
return
|
|
135
|
+
let i;
|
|
136
|
+
return [P.map((n) => {
|
|
137
|
+
if (f === n.id) {
|
|
138
|
+
const A = { ...n, selected: !0 };
|
|
139
|
+
return i = A, A;
|
|
134
140
|
}
|
|
135
|
-
return
|
|
136
|
-
}),
|
|
141
|
+
return n.selected ? { ...n, selected: !1 } : n;
|
|
142
|
+
}), i];
|
|
137
143
|
}, [P, f]);
|
|
138
|
-
return
|
|
144
|
+
return m || !e || !B ? {
|
|
139
145
|
accountMenu: {
|
|
140
146
|
items: [],
|
|
141
147
|
groups: {},
|
|
@@ -144,89 +150,90 @@ const H = (o) => o === "Organization" ? "company" : "person", dt = ({
|
|
|
144
150
|
},
|
|
145
151
|
currentAccount: void 0
|
|
146
152
|
},
|
|
147
|
-
loading:
|
|
153
|
+
loading: m
|
|
148
154
|
} : {
|
|
149
155
|
accountMenu: {
|
|
150
|
-
items:
|
|
151
|
-
groups:
|
|
156
|
+
items: E,
|
|
157
|
+
groups: W,
|
|
152
158
|
virtualized: p,
|
|
153
159
|
onSelectAccount: N,
|
|
154
|
-
currentAccount:
|
|
160
|
+
currentAccount: B
|
|
155
161
|
},
|
|
156
162
|
loading: !1,
|
|
157
|
-
showDeletedUnits:
|
|
158
|
-
onShowDeletedUnitsChange:
|
|
163
|
+
showDeletedUnits: $ ? c : void 0,
|
|
164
|
+
onShowDeletedUnitsChange: $ ? g : void 0,
|
|
165
|
+
accountCount: V
|
|
159
166
|
};
|
|
160
|
-
},
|
|
161
|
-
partyUuid:
|
|
162
|
-
isFavorite:
|
|
167
|
+
}, Z = ({
|
|
168
|
+
partyUuid: e,
|
|
169
|
+
isFavorite: o,
|
|
163
170
|
toggleFavoriteRef: f,
|
|
164
|
-
texts:
|
|
165
|
-
}) => /* @__PURE__ */
|
|
166
|
-
|
|
171
|
+
texts: d
|
|
172
|
+
}) => /* @__PURE__ */ F(
|
|
173
|
+
q,
|
|
167
174
|
{
|
|
168
175
|
rounded: !0,
|
|
169
176
|
variant: "ghost",
|
|
170
|
-
"aria-label":
|
|
171
|
-
onClick: (
|
|
172
|
-
|
|
177
|
+
"aria-label": o ? d.remove_from_favorites : d.add_to_favorites,
|
|
178
|
+
onClick: (m) => {
|
|
179
|
+
m.stopPropagation(), f?.current?.(e);
|
|
173
180
|
},
|
|
174
181
|
size: "xs",
|
|
175
|
-
children:
|
|
182
|
+
children: o ? /* @__PURE__ */ F(Q, {}) : /* @__PURE__ */ F(X, {})
|
|
176
183
|
}
|
|
177
|
-
),
|
|
178
|
-
const
|
|
179
|
-
fullName:
|
|
180
|
-
type:
|
|
181
|
-
}), v = p ?
|
|
184
|
+
), z = (e, o, f, d, m, N, p, I) => {
|
|
185
|
+
const s = H(o?.type ?? ""), c = M(e), g = j({
|
|
186
|
+
fullName: o?.name,
|
|
187
|
+
type: s
|
|
188
|
+
}), v = p ? j({
|
|
182
189
|
fullName: p?.name,
|
|
183
190
|
type: H(p?.type ?? ""),
|
|
184
191
|
reverseNameOrder: !1
|
|
185
192
|
}) : void 0;
|
|
186
|
-
let
|
|
187
|
-
const
|
|
188
|
-
switch (
|
|
193
|
+
let u = "";
|
|
194
|
+
const _ = s === "company" && p ? "subunit" : s;
|
|
195
|
+
switch (_) {
|
|
189
196
|
case "company":
|
|
190
|
-
|
|
197
|
+
u = `${c.org_no}. ${w(o.organizationNumber)}`;
|
|
191
198
|
break;
|
|
192
199
|
case "person":
|
|
193
|
-
|
|
200
|
+
u = o?.dateOfBirth ? `${c.birthdate}: ${K(o?.dateOfBirth)}` : "";
|
|
194
201
|
break;
|
|
195
202
|
case "subunit":
|
|
196
|
-
|
|
203
|
+
u = `↳ ${c.org_no}. ${w(o?.organizationNumber)}, ${c.subunit_of} ${v}`;
|
|
197
204
|
break;
|
|
198
205
|
default:
|
|
199
|
-
|
|
206
|
+
u = "";
|
|
200
207
|
}
|
|
201
|
-
const y =
|
|
202
|
-
|
|
208
|
+
const y = I ? void 0 : /* @__PURE__ */ F(
|
|
209
|
+
Z,
|
|
203
210
|
{
|
|
204
|
-
partyUuid:
|
|
205
|
-
isFavorite:
|
|
206
|
-
toggleFavoriteRef:
|
|
207
|
-
texts:
|
|
211
|
+
partyUuid: o?.partyUuid,
|
|
212
|
+
isFavorite: d,
|
|
213
|
+
toggleFavoriteRef: m,
|
|
214
|
+
texts: c
|
|
208
215
|
}
|
|
209
216
|
);
|
|
210
217
|
return {
|
|
211
|
-
id:
|
|
218
|
+
id: o?.partyUuid,
|
|
212
219
|
icon: {
|
|
213
|
-
name:
|
|
214
|
-
type:
|
|
220
|
+
name: g,
|
|
221
|
+
type: s,
|
|
215
222
|
isParent: !p,
|
|
216
|
-
isDeleted:
|
|
223
|
+
isDeleted: o?.isDeleted
|
|
217
224
|
},
|
|
218
|
-
name:
|
|
219
|
-
description:
|
|
220
|
-
searchWords:
|
|
225
|
+
name: g,
|
|
226
|
+
description: u,
|
|
227
|
+
searchWords: _ === "person" ? [g, o?.dateOfBirth ?? ""] : [g, o?.organizationNumber ?? ""],
|
|
221
228
|
groupId: f,
|
|
222
|
-
type:
|
|
229
|
+
type: _,
|
|
223
230
|
selected: !1,
|
|
224
|
-
disabled: !!
|
|
225
|
-
badge:
|
|
231
|
+
disabled: !!o?.onlyHierarchyElementWithNoAccess,
|
|
232
|
+
badge: I ? { label: c.you, color: "person" } : o.isDeleted && N ? { label: c.deleted, color: "neutral" } : void 0,
|
|
226
233
|
controls: y
|
|
227
234
|
};
|
|
228
|
-
},
|
|
229
|
-
switch (
|
|
235
|
+
}, C = (e) => e === "Organization", T = (e) => e === "Person" || e === "SelfIdentified", M = (e) => {
|
|
236
|
+
switch (e) {
|
|
230
237
|
case "nn":
|
|
231
238
|
return {
|
|
232
239
|
account_orgs: "Virksemder",
|
|
@@ -269,5 +276,5 @@ const H = (o) => o === "Organization" ? "company" : "person", dt = ({
|
|
|
269
276
|
}
|
|
270
277
|
};
|
|
271
278
|
export {
|
|
272
|
-
|
|
279
|
+
pt as useAccountSelector
|
|
273
280
|
};
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import { AccountNotificationSettings as b } from "./components/Account/AccountNo
|
|
|
11
11
|
import { AccountOrganization as y } from "./components/Account/AccountOrganization.js";
|
|
12
12
|
import { AccountSelector as k } from "./components/AccountSelector/AccountSelector.js";
|
|
13
13
|
import { Alert as v } from "./components/Alert/Alert.js";
|
|
14
|
-
import { B as C, a as P, D as H, b as w, c as E, d as G, e as O, f as N, g as R, F as V, H as U, I as z, h as j, i as Q, M as K, j as q, k as J, l as W, m as X, n as Y, R as Z, S as _, T as $, t as oo, V as ro, u as eo, w as to } from "./ToolbarSearch-
|
|
14
|
+
import { B as C, a as P, D as H, b as w, c as E, d as G, e as O, f as N, g as R, F as V, H as U, I as z, h as j, i as Q, M as K, j as q, k as J, l as W, m as X, n as Y, R as Z, S as _, T as $, t as oo, V as ro, u as eo, w as to } from "./ToolbarSearch-bv2opbAj.js";
|
|
15
15
|
import { Banner as ao, BannerColorEnum as po, BannerVariantEnum as xo } from "./components/Banner/Banner.js";
|
|
16
16
|
import { BookmarkSettingsItem as fo } from "./components/Bookmarks/BookmarkSettingsItem.js";
|
|
17
17
|
import { BookmarkSettingsList as no } from "./components/Bookmarks/BookmarkSettingsList.js";
|
|
@@ -13,5 +13,13 @@ export interface AccountSelectorProps {
|
|
|
13
13
|
onShowDeletedUnitsChange?: (newValue: boolean) => void;
|
|
14
14
|
/** Show in fullscreen*/
|
|
15
15
|
isFullScreen?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Total number of accounts the user has, including deleted ones. Used to
|
|
18
|
+
* decide whether to show the search field, so the decision stays stable when
|
|
19
|
+
* the user toggles deleted accounts on/off (toggling only changes how many
|
|
20
|
+
* accounts are currently listed, not how many the user actually has).
|
|
21
|
+
* Falls back to the number of currently listed accounts when not provided.
|
|
22
|
+
*/
|
|
23
|
+
accountCount?: number;
|
|
16
24
|
}
|
|
17
|
-
export declare const AccountSelector: ({ accountMenu, forceOpenFullScreen, className, loading, showDeletedUnits, onShowDeletedUnitsChange, isFullScreen, }: AccountSelectorProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export declare const AccountSelector: ({ accountMenu, forceOpenFullScreen, className, loading, showDeletedUnits, onShowDeletedUnitsChange, isFullScreen, accountCount, }: AccountSelectorProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AccountSelectorProps } from './AccountSelector';
|
|
2
2
|
declare const meta: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: ({ accountMenu, forceOpenFullScreen, className, loading, showDeletedUnits, onShowDeletedUnitsChange, isFullScreen, }: AccountSelectorProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
component: ({ accountMenu, forceOpenFullScreen, className, loading, showDeletedUnits, onShowDeletedUnitsChange, isFullScreen, accountCount, }: AccountSelectorProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
tags: string[];
|
|
6
6
|
parameters: {
|
|
7
7
|
layout: string;
|
|
@@ -27,3 +27,8 @@ export default meta;
|
|
|
27
27
|
export declare const WithAccounts: (args: AccountSelectorProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
28
|
export declare const NoAccounts: (args: AccountSelectorProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
29
|
export declare const Loading: (args: AccountSelectorProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export declare const UsingUseAccountHook: (args: AccountSelectorProps) => import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export declare const ThreeAccounts: (args: AccountSelectorProps) => import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export declare const FourAccountsOneDeleted: (args: AccountSelectorProps) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export declare const SixAccountsThreeDeleted: (args: AccountSelectorProps) => import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export declare const TenAccountsNoneDeleted: (args: AccountSelectorProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { LayoutProps } from '../';
|
|
2
|
+
interface LayoutStoryArgs extends LayoutProps {
|
|
3
|
+
forceOpenFullScreen?: boolean | undefined;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* AccountSelector demos rendered inside a full Layout, so you can see how the
|
|
7
|
+
* selector behaves alongside the header, sidebar and global menu. The same
|
|
8
|
+
* cases are available as standalone-component stories under Layout/AccountSelector.
|
|
9
|
+
*/
|
|
10
|
+
declare const meta: {
|
|
11
|
+
title: string;
|
|
12
|
+
component: ({ banner, color, theme, header, footer, sidebar, content, children, skipLink, breadcrumbs, }: LayoutProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
parameters: {
|
|
14
|
+
layout: string;
|
|
15
|
+
};
|
|
16
|
+
args: {
|
|
17
|
+
theme: "subtle";
|
|
18
|
+
skipLink: {
|
|
19
|
+
href: string;
|
|
20
|
+
color: import('..').Color;
|
|
21
|
+
size: import('..').Size;
|
|
22
|
+
children: string;
|
|
23
|
+
};
|
|
24
|
+
header: import('..').GlobalHeaderProps;
|
|
25
|
+
footer: import('..').FooterProps;
|
|
26
|
+
sidebar: {
|
|
27
|
+
menu: import('..').MenuProps;
|
|
28
|
+
};
|
|
29
|
+
children: import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
color: "company";
|
|
31
|
+
forceOpenFullScreen: undefined;
|
|
32
|
+
};
|
|
33
|
+
argTypes: {
|
|
34
|
+
color: {
|
|
35
|
+
control: "select";
|
|
36
|
+
options: string[];
|
|
37
|
+
};
|
|
38
|
+
forceOpenFullScreen: {
|
|
39
|
+
control: "select";
|
|
40
|
+
options: (boolean | undefined)[];
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export default meta;
|
|
45
|
+
export declare const UsingUseAccountHook: (args: LayoutStoryArgs) => import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
export declare const ThreeAccounts: (args: LayoutStoryArgs) => import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
export declare const FourAccountsOneDeleted: (args: LayoutStoryArgs) => import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
export declare const SixAccountsThreeDeleted: (args: LayoutStoryArgs) => import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
export declare const TenAccountsNoneDeleted: (args: LayoutStoryArgs) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -38,7 +38,6 @@ declare const meta: {
|
|
|
38
38
|
};
|
|
39
39
|
export default meta;
|
|
40
40
|
export declare const Preview: (args: LayoutStoryArgs) => import("react/jsx-runtime").JSX.Element;
|
|
41
|
-
export declare const UsingUseAccountHook: (args: LayoutStoryArgs) => import("react/jsx-runtime").JSX.Element;
|
|
42
41
|
export declare const LogInView: (args: LayoutStoryArgs) => import("react/jsx-runtime").JSX.Element;
|
|
43
42
|
export declare const WithEnglishLanguage: (args: LayoutStoryArgs) => import("react/jsx-runtime").JSX.Element;
|
|
44
43
|
export declare const StickySidebar: (args: LayoutStoryArgs) => import("react/jsx-runtime").JSX.Element;
|