@altinn/altinn-components 0.54.2 → 0.55.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/{PersonCircle-DlX_3kRO.js → ChevronUpDown-DqGsU4MC.js} +5 -5
- package/dist/Eye-BrbjRZJp.js +24 -0
- package/dist/InboxFill-vGck_zM_.js +81 -0
- package/dist/InformationSquare-D3WAxfVw.js +24 -0
- package/dist/Trash-DBcymOP9.js +81 -0
- package/dist/assets/AccountMenuButton.css +1 -1
- package/dist/assets/AccountSelector.css +1 -1
- package/dist/assets/AutocompleteBase.css +1 -1
- package/dist/assets/ButtonGroup.css +1 -1
- package/dist/assets/ButtonIcon.css +1 -1
- package/dist/assets/DashboardCard.css +1 -0
- package/dist/assets/DashboardHeader.css +1 -0
- package/dist/assets/DialogListItem.css +1 -1
- package/dist/assets/Dropdown.css +1 -0
- package/dist/assets/DropdownBase.css +1 -1
- package/dist/assets/GlobalHeader.css +1 -1
- package/dist/assets/ItemControls.css +1 -0
- package/dist/assets/ItemLabel.css +1 -0
- package/dist/assets/ItemMedia.css +1 -0
- package/dist/assets/MenuItem.css +1 -1
- package/dist/assets/MenuListDivider.css +1 -0
- package/dist/assets/MenuListHeading.css +1 -0
- package/dist/assets/MenuListItem.css +1 -0
- package/dist/assets/MenuListSearch.css +1 -0
- package/dist/assets/MetaItemIcon.css +1 -1
- package/dist/assets/SearchField.css +1 -1
- package/dist/assets/SeenByLogButton.css +1 -0
- package/dist/assets/Switch.css +1 -0
- package/dist/assets/TabMenu.css +1 -0
- package/dist/assets/Tooltip.css +1 -0
- package/dist/assets/menuList.css +1 -0
- package/dist/components/Account/AccountList.js +1 -1
- package/dist/components/Account/AccountListVirtual.js +4 -4
- package/dist/components/Account/AccountMenu.js +14 -11
- package/dist/components/Account/AccountMenuButton.js +58 -56
- package/dist/components/Attachment/AttachmentLink.js +47 -41
- package/dist/components/Avatar/Avatar.js +11 -12
- package/dist/components/Avatar/AvatarGroup.js +38 -28
- package/dist/components/Banner/Banner.js +20 -38
- package/dist/components/Button/ButtonGroup.js +28 -12
- package/dist/components/Button/ButtonIcon.js +15 -15
- package/dist/components/Button/FloatingActionButton.js +22 -19
- package/dist/components/Byline/Byline.js +1 -1
- package/dist/components/ContextMenu/ContextMenu.js +73 -67
- package/dist/components/Dashboard/DashboardCard.js +24 -21
- package/dist/components/Dashboard/DashboardHeader.js +16 -14
- package/dist/components/Dashboard/index.js +2 -4
- package/dist/components/Datepicker/Datepicker.js +16 -14
- package/dist/components/Datepicker/DatepickerHeader.js +13 -13
- package/dist/components/Dialog/DialogActions.js +9 -9
- package/dist/components/Dialog/DialogAttachments.js +1 -1
- package/dist/components/Dialog/DialogListItem.js +113 -112
- package/dist/components/Dialog/DialogMetadata.js +83 -154
- package/dist/components/Dialog/DialogSeenBy.js +24 -41
- package/dist/components/Dialog/DialogTabs.js +4 -4
- package/dist/components/Dialog/SeenByLog.js +7 -7
- package/dist/components/Dialog/SeenByLogButton.js +12 -6
- package/dist/components/Dropdown/DrawerOrDropdown.js +1 -1
- package/dist/components/Dropdown/Dropdown.js +160 -0
- package/dist/components/Dropdown/DropdownBase.js +12 -12
- package/dist/components/Dropdown/FloatingDropdown.js +119 -74
- package/dist/components/Dropdown/index.js +18 -16
- package/dist/components/DsComponents/index.js +2 -2
- package/dist/components/Forms/SearchField.js +44 -29
- package/dist/components/Forms/Switch.js +10 -8
- package/dist/components/GlobalHeader/AccountSelector.js +55 -55
- package/dist/components/GlobalHeader/GlobalHeader.js +55 -54
- package/dist/components/GlobalHeader/GlobalSearch.js +1 -1
- package/dist/components/GlobalHeader/GlobalSearchButton.js +1 -0
- package/dist/components/GlobalMenu/BackButton.js +1 -1
- package/dist/components/GlobalMenu/GlobalMenu.js +52 -43
- package/dist/components/GlobalMenu/GlobalMenuButton.js +15 -14
- package/dist/components/GlobalMenu/LocaleSwitcher.js +30 -24
- package/dist/components/GlobalMenu_old/BackButton.js +1 -1
- package/dist/components/GlobalMenu_old/CurrentAccount.js +8 -9
- package/dist/components/GlobalMenu_old/EndUserLabel.js +29 -10
- package/dist/components/GlobalMenu_old/GlobalMenu.js +15 -8
- package/dist/components/GlobalMenu_old/GlobalMenuButton.js +1 -1
- package/dist/components/Header/Header.js +6 -6
- package/dist/components/Header/HeaderBase.js +1 -1
- package/dist/components/Header/LocaleSwitcher.js +10 -10
- package/dist/components/Icon/Icon.js +19 -20
- package/dist/components/Icon/ProgressIcon.js +1 -0
- package/dist/components/Icon/index.js +4 -6
- package/dist/components/Item/ItemControls.js +8 -0
- package/dist/components/Item/ItemLabel.js +34 -0
- package/dist/components/Item/ItemMedia.js +33 -0
- package/dist/components/Item/index.js +8 -0
- package/dist/components/Layout/Layout.js +4 -4
- package/dist/components/Menu/Menu.js +67 -45
- package/dist/components/Menu/MenuItem.js +192 -66
- package/dist/components/Menu/MenuItems.js +154 -71
- package/dist/components/Menu/MenuList.js +39 -0
- package/dist/components/Menu/MenuListDivider.js +8 -0
- package/dist/components/Menu/MenuListGroup.js +7 -0
- package/dist/components/Menu/MenuListHeading.js +7 -0
- package/dist/components/Menu/MenuListItem.js +34 -0
- package/dist/components/Menu/MenuListSearch.js +83 -0
- package/dist/components/Menu/MenuOption.js +4 -87
- package/dist/components/Menu/TabMenu.js +15 -0
- package/dist/components/Menu/VirtualizedMenuItems.js +227 -0
- package/dist/components/Menu/aria.js +9 -0
- package/dist/components/Menu/example.data.js +373 -0
- package/dist/components/Menu/example.hooks.js +75 -0
- package/dist/components/Menu/index.js +24 -25
- package/dist/components/Menu/types.js +1 -0
- package/dist/components/Menu/useDropdownMenuController.js +43 -0
- package/dist/components/Menu/useMenuSearch.js +146 -0
- package/dist/components/Menu/useMenuVirtualization.js +5 -0
- package/dist/components/Metadata/MetaItemIcon.js +4 -4
- package/dist/components/Notifications/NotificationItemBase.js +49 -50
- package/dist/components/Page/ContactButtons.js +13 -10
- package/dist/components/Page/PageTabs.js +4 -13
- package/dist/components/Searchbar/Autocomplete.js +34 -32
- package/dist/components/Searchbar/AutocompleteBase.js +3 -3
- package/dist/components/Searchbar/AutocompleteItem.js +29 -42
- package/dist/components/Settings/SettingsItemBase.js +25 -26
- package/dist/components/Settings/UsedByLog.js +6 -6
- package/dist/components/Toolbar/DatepickerFilter.js +87 -0
- package/dist/components/Toolbar/SelectDateFilter.js +51 -0
- package/dist/components/Toolbar/Toolbar.js +18 -104
- package/dist/components/Toolbar/ToolbarFilter.js +69 -73
- package/dist/components/Toolbar/ToolbarFilterAddMenu.js +82 -0
- package/dist/components/Toolbar/ToolbarFilterButton.js +46 -0
- package/dist/components/Toolbar/ToolbarFilterMenu.js +117 -0
- package/dist/components/Toolbar/ToolbarMenu.js +58 -21
- package/dist/components/Toolbar/ToolbarSearch.js +15 -10
- package/dist/components/Toolbar/example.data.js +388 -0
- package/dist/components/Toolbar/example.hooks.js +68 -0
- package/dist/components/Toolbar/formatDateRange.js +19 -0
- package/dist/components/Toolbar/index.js +12 -14
- package/dist/components/Toolbar/useFilter.js +63 -0
- package/dist/components/Tooltip/Tooltip.js +101 -0
- package/dist/components/Tooltip/index.js +4 -0
- package/dist/components/UserListItem/UserListItem.js +15 -13
- package/dist/components/index.js +389 -386
- package/dist/floating-ui.dom-bEgaHJCq.js +997 -0
- package/dist/global.css +1 -1
- package/dist/hooks/useAccountSelector.js +9 -9
- package/dist/hooks/useMenu.js +48 -47
- package/dist/index--jNxJmA8.js +2000 -0
- package/dist/index.js +402 -399
- package/dist/menuList.module-DFH60CqT.js +6 -0
- package/dist/{textfield-DAuYWtUj.js → textfield-Drdr9bio.js} +40 -39
- package/dist/types/lib/components/Account/AccountList.d.ts +2 -2
- package/dist/types/lib/components/Account/AccountList.stories.d.ts +3 -4
- package/dist/types/lib/components/Account/AccountMenu.d.ts +3 -3
- package/dist/types/lib/components/Account/AccountMenu.stories.d.ts +1 -1
- package/dist/types/lib/components/Account/AccountMenuButton.stories.d.ts +10 -2
- package/dist/types/lib/components/Attachment/AttachmentLink.d.ts +3 -1
- package/dist/types/lib/components/Attachment/AttachmentLink.stories.d.ts +1 -1
- package/dist/types/lib/components/Button/ButtonGroup.d.ts +3 -1
- package/dist/types/lib/components/Button/ButtonGroup.stories.d.ts +1 -1
- package/dist/types/lib/components/Button/FloatingActionButton.d.ts +1 -6
- package/dist/types/lib/components/ContextMenu/ContextMenu.d.ts +7 -8
- package/dist/types/lib/components/Dashboard/DashboardCard.d.ts +2 -2
- package/dist/types/lib/components/Dashboard/DashboardHeader.d.ts +2 -2
- package/dist/types/lib/components/Dashboard/index.d.ts +0 -1
- package/dist/types/lib/components/Dialog/DialogTabs.d.ts +2 -4
- package/dist/types/lib/components/Dialog/SeenByLogButton.d.ts +8 -5
- package/dist/types/lib/components/Dropdown/Dropdown.d.ts +22 -0
- package/dist/types/lib/components/Dropdown/Dropdown.stories.d.ts +14 -0
- package/dist/types/lib/components/Dropdown/DropdownBase.d.ts +3 -2
- package/dist/types/lib/components/Dropdown/index.d.ts +1 -0
- package/dist/types/lib/components/Forms/SearchField.d.ts +2 -1
- package/dist/types/lib/components/Forms/SearchField.stories.d.ts +1 -1
- package/dist/types/lib/components/Forms/Switch.d.ts +2 -1
- package/dist/types/lib/components/Forms/Switch.stories.d.ts +1 -1
- package/dist/types/lib/components/GlobalMenu/GlobalMenu.d.ts +1 -1
- package/dist/types/lib/components/GlobalMenu/GlobalMenu.stories.d.ts +1 -3
- package/dist/types/lib/components/GlobalMenu/LocaleSwitcher.d.ts +1 -1
- package/dist/types/lib/components/Header/HeaderButton.d.ts +0 -4
- package/dist/types/lib/components/Header/HeaderButton.stories.d.ts +0 -1
- package/dist/types/lib/components/Icon/Icon.d.ts +3 -2
- package/dist/types/lib/components/Icon/index.d.ts +0 -1
- package/dist/types/lib/components/Item/ItemControls.d.ts +7 -0
- package/dist/types/lib/components/Item/ItemLabel.d.ts +14 -0
- package/dist/types/lib/components/Item/ItemMedia.d.ts +9 -0
- package/dist/types/lib/components/Item/index.d.ts +3 -0
- package/dist/types/lib/components/Menu/Menu.d.ts +4 -7
- package/dist/types/lib/components/Menu/Menu.stories.d.ts +64 -4
- package/dist/types/lib/components/Menu/MenuItem.d.ts +53 -21
- package/dist/types/lib/components/Menu/MenuItems.d.ts +21 -14
- package/dist/types/lib/components/Menu/MenuList.d.ts +21 -0
- package/dist/types/lib/components/Menu/MenuListDivider.d.ts +6 -0
- package/dist/types/lib/components/Menu/MenuListGroup.d.ts +8 -0
- package/dist/types/lib/components/Menu/MenuListHeading.d.ts +8 -0
- package/dist/types/lib/components/Menu/MenuListItem.d.ts +9 -0
- package/dist/types/lib/components/Menu/MenuListSearch.d.ts +15 -0
- package/dist/types/lib/components/Menu/MenuListSearch.stories.d.ts +18 -0
- package/dist/types/lib/components/Menu/MenuOption.d.ts +5 -16
- package/dist/types/lib/components/Menu/TabMenu.d.ts +8 -0
- package/dist/types/lib/components/Menu/VirtualizedMenu.stories.d.ts +22 -0
- package/dist/types/lib/components/Menu/VirtualizedMenuItems.d.ts +2 -0
- package/dist/types/lib/components/Menu/aria.d.ts +1 -0
- package/dist/types/lib/components/Menu/example.hooks.d.ts +24 -0
- package/dist/types/lib/components/Menu/index.d.ts +10 -9
- package/dist/types/lib/components/Menu/types.d.ts +1 -0
- package/dist/types/lib/components/Menu/useDropdownMenuController.d.ts +27 -0
- package/dist/types/lib/components/Menu/useMenuSearch.d.ts +129 -0
- package/dist/types/lib/components/Menu/useMenuVirtualization.d.ts +35 -0
- package/dist/types/lib/components/Page/ContactButtons.d.ts +6 -2
- package/dist/types/lib/components/Page/PageTabs.d.ts +3 -10
- package/dist/types/lib/components/Page/PageTabs.stories.d.ts +1 -1
- package/dist/types/lib/components/Searchbar/AutocompleteItem.d.ts +3 -3
- package/dist/types/lib/components/Searchbar/Searchbar.stories.d.ts +1 -1
- package/dist/types/lib/components/Toolbar/DatepickerFilter.d.ts +15 -0
- package/dist/types/lib/components/Toolbar/SelectDateFilter.d.ts +8 -0
- package/dist/types/lib/components/Toolbar/SelectDateFilter.stories.d.ts +9 -0
- package/dist/types/lib/components/Toolbar/Toolbar.d.ts +6 -19
- package/dist/types/lib/components/Toolbar/Toolbar.stories.d.ts +21 -19
- package/dist/types/lib/components/Toolbar/ToolbarFilter.d.ts +11 -23
- package/dist/types/lib/components/Toolbar/ToolbarFilter.stories.d.ts +6 -13
- package/dist/types/lib/components/Toolbar/ToolbarFilterAddMenu.d.ts +8 -0
- package/dist/types/lib/components/Toolbar/ToolbarFilterButton.d.ts +15 -0
- package/dist/types/lib/components/Toolbar/ToolbarFilterMenu.d.ts +15 -0
- package/dist/types/lib/components/Toolbar/ToolbarMenu.d.ts +5 -10
- package/dist/types/lib/components/Toolbar/ToolbarSearch.d.ts +3 -5
- package/dist/types/lib/components/Toolbar/ToolbarSearch.stories.d.ts +635 -1
- package/dist/types/lib/components/Toolbar/example.hooks.d.ts +41 -0
- package/dist/types/lib/components/Toolbar/formatDateRange.d.ts +10 -0
- package/dist/types/lib/components/Toolbar/index.d.ts +4 -5
- package/dist/types/lib/components/Toolbar/useFilter.d.ts +173 -0
- package/dist/types/lib/components/Tooltip/Tooltip.d.ts +8 -0
- package/dist/types/lib/components/Tooltip/Tooltip.stories.d.ts +9 -0
- package/dist/types/lib/components/Tooltip/index.d.ts +1 -0
- package/dist/types/lib/components/Transmission/Transmission.stories.d.ts +2 -2
- package/dist/types/lib/components/Typography/Heading.d.ts +2 -2
- package/dist/types/lib/components/UserListItem/UserListItem.d.ts +3 -1
- package/dist/types/lib/components/UserListItem/UserListItem.stories.d.ts +7 -1
- package/dist/types/lib/components/index.d.ts +2 -0
- package/dist/types/lib/hooks/useAccountSelector.d.ts +2 -2
- package/dist/types/lib/hooks/useMenu.d.ts +3 -1
- package/dist/{index-De5bF0Gf.js → useMenuVirtualization-DpvWCsyD.js} +216 -165
- package/package.json +1 -1
- package/dist/assets/ContextMenu.css +0 -1
- package/dist/assets/IconOrAvatar.css +0 -1
- package/dist/assets/MenuBase.css +0 -1
- package/dist/assets/MenuHeader.css +0 -1
- package/dist/assets/MenuInputField.css +0 -1
- package/dist/assets/MenuItemBase.css +0 -1
- package/dist/assets/MenuItemIcon.css +0 -1
- package/dist/assets/MenuItemLabel.css +0 -1
- package/dist/assets/MenuItemsVirtual.css +0 -1
- package/dist/assets/MenuOption.css +0 -1
- package/dist/assets/MenuSearch.css +0 -1
- package/dist/assets/PageTabs.css +0 -1
- package/dist/assets/ToolbarBase.css +0 -1
- package/dist/assets/ToolbarButton.css +0 -1
- package/dist/assets/ToolbarDaterange.css +0 -1
- package/dist/assets/ToolbarFilterBase.css +0 -1
- package/dist/components/Dashboard/DashboardIcon.js +0 -11
- package/dist/components/Datepicker/DatepickerBase.js +0 -8
- package/dist/components/GlobalMenu/EndUserLabel.js +0 -13
- package/dist/components/GlobalMenu/LocaleButton.js +0 -13
- package/dist/components/Icon/IconOrAvatar.js +0 -33
- package/dist/components/Menu/MenuBase.js +0 -56
- package/dist/components/Menu/MenuHeader.js +0 -8
- package/dist/components/Menu/MenuInputField.js +0 -31
- package/dist/components/Menu/MenuItemBase.js +0 -58
- package/dist/components/Menu/MenuItemIcon.js +0 -27
- package/dist/components/Menu/MenuItemLabel.js +0 -76
- package/dist/components/Menu/MenuItemsVirtual.js +0 -168
- package/dist/components/Menu/MenuSearch.js +0 -41
- package/dist/components/Toolbar/ToolbarAccountMenu.js +0 -52
- package/dist/components/Toolbar/ToolbarAdd.js +0 -24
- package/dist/components/Toolbar/ToolbarBase.js +0 -8
- package/dist/components/Toolbar/ToolbarButton.js +0 -115
- package/dist/components/Toolbar/ToolbarDaterange.js +0 -58
- package/dist/components/Toolbar/ToolbarFilterBase.js +0 -17
- package/dist/components/Toolbar/ToolbarOptions.js +0 -84
- package/dist/index-DttADHE1.js +0 -2993
- package/dist/types/lib/components/ContextMenu/ContextMenu.stories.d.ts +0 -8
- package/dist/types/lib/components/Dashboard/DashboardIcon.d.ts +0 -7
- package/dist/types/lib/components/Datepicker/DatepickerBase.d.ts +0 -6
- package/dist/types/lib/components/GlobalMenu/EndUserLabel.d.ts +0 -5
- package/dist/types/lib/components/GlobalMenu/LocaleButton.d.ts +0 -3
- package/dist/types/lib/components/Icon/IconOrAvatar.d.ts +0 -13
- package/dist/types/lib/components/Menu/MenuBase.d.ts +0 -42
- package/dist/types/lib/components/Menu/MenuHeader.d.ts +0 -4
- package/dist/types/lib/components/Menu/MenuInputField.d.ts +0 -12
- package/dist/types/lib/components/Menu/MenuItemBase.d.ts +0 -28
- package/dist/types/lib/components/Menu/MenuItemIcon.d.ts +0 -10
- package/dist/types/lib/components/Menu/MenuItemLabel.d.ts +0 -15
- package/dist/types/lib/components/Menu/MenuItemsVirtual.d.ts +0 -2
- package/dist/types/lib/components/Menu/MenuSearch.d.ts +0 -10
- package/dist/types/lib/components/Menu/MenuSearch.stories.d.ts +0 -18
- package/dist/types/lib/components/Toolbar/ToolbarAccountMenu.d.ts +0 -8
- package/dist/types/lib/components/Toolbar/ToolbarAdd.d.ts +0 -8
- package/dist/types/lib/components/Toolbar/ToolbarAdd.stories.d.ts +0 -13
- package/dist/types/lib/components/Toolbar/ToolbarBase.d.ts +0 -5
- package/dist/types/lib/components/Toolbar/ToolbarButton.d.ts +0 -16
- package/dist/types/lib/components/Toolbar/ToolbarButton.stories.d.ts +0 -15
- package/dist/types/lib/components/Toolbar/ToolbarDate.stories.d.ts +0 -26
- package/dist/types/lib/components/Toolbar/ToolbarDaterange.d.ts +0 -11
- package/dist/types/lib/components/Toolbar/ToolbarDaterange.stories.d.ts +0 -15
- package/dist/types/lib/components/Toolbar/ToolbarFilterBase.d.ts +0 -8
- package/dist/types/lib/components/Toolbar/ToolbarMenu.stories.d.ts +0 -19
- package/dist/types/lib/components/Toolbar/ToolbarOptions.d.ts +0 -22
- package/dist/types/lib/components/Toolbar/ToolbarOptions.stories.d.ts +0 -12
- /package/dist/assets/{DatepickerBase.css → Datepicker.css} +0 -0
- /package/dist/types/lib/components/GlobalHeader/{AccountSector.stories.d.ts → AccountSelector.stories.d.ts} +0 -0
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
import { S as m } from "../../InformationSquare-D3WAxfVw.js";
|
|
2
|
+
import { S as o, a as p, b as I, c as b } from "../../Trash-DBcymOP9.js";
|
|
3
|
+
import { S as v } from "../../Eye-BrbjRZJp.js";
|
|
4
|
+
import { S as h, a as k, b as S, c as f } from "../../InboxFill-vGck_zM_.js";
|
|
5
|
+
const x = {
|
|
6
|
+
id: "1",
|
|
7
|
+
groupId: "1",
|
|
8
|
+
name: "status",
|
|
9
|
+
icon: m,
|
|
10
|
+
label: "Velg status",
|
|
11
|
+
groups: {
|
|
12
|
+
1: {
|
|
13
|
+
title: "Velg status"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
items: [
|
|
17
|
+
{
|
|
18
|
+
id: "1",
|
|
19
|
+
groupId: "1",
|
|
20
|
+
role: "checkbox",
|
|
21
|
+
name: "unread",
|
|
22
|
+
value: "true",
|
|
23
|
+
title: "Ulest"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: "2",
|
|
27
|
+
groupId: "2",
|
|
28
|
+
role: "checkbox",
|
|
29
|
+
name: "status",
|
|
30
|
+
value: "requires-action",
|
|
31
|
+
title: "Krever handling"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: "3",
|
|
35
|
+
groupId: "2",
|
|
36
|
+
role: "checkbox",
|
|
37
|
+
name: "status",
|
|
38
|
+
value: "awaiting",
|
|
39
|
+
title: "Avventer"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
id: "4",
|
|
43
|
+
groupId: "2",
|
|
44
|
+
role: "checkbox",
|
|
45
|
+
name: "status",
|
|
46
|
+
value: "in-progress",
|
|
47
|
+
title: "Under arbeid"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: "5",
|
|
51
|
+
groupId: "2",
|
|
52
|
+
role: "checkbox",
|
|
53
|
+
name: "status",
|
|
54
|
+
value: "completed",
|
|
55
|
+
title: "Avsluttet"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: "6",
|
|
59
|
+
groupId: "3",
|
|
60
|
+
role: "checkbox",
|
|
61
|
+
name: "status",
|
|
62
|
+
value: "undefined",
|
|
63
|
+
title: "Ingen status"
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
}, B = {
|
|
67
|
+
id: "2",
|
|
68
|
+
groupId: "1",
|
|
69
|
+
icon: o,
|
|
70
|
+
name: "time",
|
|
71
|
+
label: "Velg dato",
|
|
72
|
+
groups: {
|
|
73
|
+
1: {
|
|
74
|
+
title: "Velg dato"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
items: [
|
|
78
|
+
{
|
|
79
|
+
id: "1",
|
|
80
|
+
groupId: "1",
|
|
81
|
+
name: "time",
|
|
82
|
+
role: "radio",
|
|
83
|
+
value: "all-time",
|
|
84
|
+
title: "Alle tider"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: "2",
|
|
88
|
+
groupId: "2",
|
|
89
|
+
name: "time",
|
|
90
|
+
role: "radio",
|
|
91
|
+
value: "today",
|
|
92
|
+
title: "I dag"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
id: "3",
|
|
96
|
+
groupId: "2",
|
|
97
|
+
name: "time",
|
|
98
|
+
role: "radio",
|
|
99
|
+
value: "this-week",
|
|
100
|
+
title: "Denne uken"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
id: "4",
|
|
104
|
+
groupId: "2",
|
|
105
|
+
name: "time",
|
|
106
|
+
role: "radio",
|
|
107
|
+
value: "this-month",
|
|
108
|
+
title: "Denne måneden"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: "5",
|
|
112
|
+
groupId: "3",
|
|
113
|
+
name: "time",
|
|
114
|
+
role: "radio",
|
|
115
|
+
value: "last-6-months",
|
|
116
|
+
title: "Siste 6 måneder"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
id: "6",
|
|
120
|
+
groupId: "3",
|
|
121
|
+
name: "time",
|
|
122
|
+
role: "radio",
|
|
123
|
+
value: "last-12-months",
|
|
124
|
+
title: "Siste 12 måneder"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
id: "7",
|
|
128
|
+
groupId: "4",
|
|
129
|
+
name: "datepicker",
|
|
130
|
+
icon: o,
|
|
131
|
+
title: "Spesifiser dato"
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
}, y = {
|
|
135
|
+
id: "seenBy",
|
|
136
|
+
groupId: "2",
|
|
137
|
+
icon: v,
|
|
138
|
+
name: "seenBy",
|
|
139
|
+
label: "Sett av ...",
|
|
140
|
+
searchable: !0,
|
|
141
|
+
groups: {
|
|
142
|
+
1: {
|
|
143
|
+
title: "Sett av ..."
|
|
144
|
+
},
|
|
145
|
+
search: {
|
|
146
|
+
title: "{count} treff"
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
items: [
|
|
150
|
+
{
|
|
151
|
+
id: "1",
|
|
152
|
+
groupId: "1",
|
|
153
|
+
name: "seenBy",
|
|
154
|
+
role: "checkbox",
|
|
155
|
+
value: "you",
|
|
156
|
+
title: "Sett av deg"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
id: "2",
|
|
160
|
+
groupId: "1",
|
|
161
|
+
name: "seenBy",
|
|
162
|
+
role: "checkbox",
|
|
163
|
+
value: "others",
|
|
164
|
+
title: "Sett av andre"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
id: "3",
|
|
168
|
+
groupId: "2",
|
|
169
|
+
name: "seenBy",
|
|
170
|
+
role: "checkbox",
|
|
171
|
+
value: "per-nordmann",
|
|
172
|
+
title: "Per Nordmann"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
id: "4",
|
|
176
|
+
groupId: "2",
|
|
177
|
+
name: "seenBy",
|
|
178
|
+
role: "checkbox",
|
|
179
|
+
value: "kari-nordmann",
|
|
180
|
+
title: "Kari Nordmann"
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
}, N = {
|
|
184
|
+
id: "content",
|
|
185
|
+
groupId: "2",
|
|
186
|
+
icon: p,
|
|
187
|
+
name: "content",
|
|
188
|
+
label: "Inneholder ...",
|
|
189
|
+
groups: {
|
|
190
|
+
1: {
|
|
191
|
+
title: "Inneholder ..."
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
items: [
|
|
195
|
+
{
|
|
196
|
+
id: "1",
|
|
197
|
+
groupId: "1",
|
|
198
|
+
name: "drafts",
|
|
199
|
+
role: "checkbox",
|
|
200
|
+
value: "true",
|
|
201
|
+
title: "Utkast"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
id: "2",
|
|
205
|
+
groupId: "1",
|
|
206
|
+
name: "attachments",
|
|
207
|
+
role: "checkbox",
|
|
208
|
+
value: "true",
|
|
209
|
+
title: "Vedlegg"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
id: "3",
|
|
213
|
+
groupId: "2",
|
|
214
|
+
name: "sent",
|
|
215
|
+
role: "checkbox",
|
|
216
|
+
value: "true",
|
|
217
|
+
title: "Sendte meldinger"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
id: "4",
|
|
221
|
+
groupId: "2",
|
|
222
|
+
name: "received",
|
|
223
|
+
role: "checkbox",
|
|
224
|
+
value: "true",
|
|
225
|
+
title: "Mottatte meldinger"
|
|
226
|
+
}
|
|
227
|
+
]
|
|
228
|
+
}, F = [x, B, y, N], C = F?.map((e) => ({
|
|
229
|
+
...e,
|
|
230
|
+
removable: !0
|
|
231
|
+
})), n = [
|
|
232
|
+
{
|
|
233
|
+
id: "user",
|
|
234
|
+
groupId: "favourites",
|
|
235
|
+
name: "Kari Nordmann",
|
|
236
|
+
birthdate: "03037712345"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
id: "aa-1",
|
|
240
|
+
groupId: "aa",
|
|
241
|
+
name: "Alfa Bar & Brød",
|
|
242
|
+
orgNumber: "551415161"
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
id: "aa-2",
|
|
246
|
+
groupId: "aa",
|
|
247
|
+
name: "Alfa Bar & Brød",
|
|
248
|
+
orgNumber: "551415162",
|
|
249
|
+
parentId: "aa-1"
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
id: "bb-1",
|
|
253
|
+
groupId: "bb",
|
|
254
|
+
name: "Beta Inc.",
|
|
255
|
+
orgNumber: "991557788"
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
id: "bb-2",
|
|
259
|
+
groupId: "bb",
|
|
260
|
+
name: "Beta Inc.",
|
|
261
|
+
orgNumber: "991557789",
|
|
262
|
+
parentId: "bb-1"
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
id: "cc-1",
|
|
266
|
+
groupId: "cc",
|
|
267
|
+
name: "Charlies engler",
|
|
268
|
+
orgNumber: "333444555"
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
id: "cc-2",
|
|
272
|
+
groupId: "cc",
|
|
273
|
+
name: "Charlies engler",
|
|
274
|
+
orgNumber: "333444556",
|
|
275
|
+
parentId: "cc-1"
|
|
276
|
+
}
|
|
277
|
+
].map((e) => {
|
|
278
|
+
const a = [e.name, e.orgNumber, e.birthdate].filter(Boolean);
|
|
279
|
+
if (e.birthdate)
|
|
280
|
+
return {
|
|
281
|
+
id: e.id,
|
|
282
|
+
groupId: e.groupId,
|
|
283
|
+
searchWords: a,
|
|
284
|
+
title: e.name,
|
|
285
|
+
description: "Født: " + e.birthdate,
|
|
286
|
+
icon: {
|
|
287
|
+
type: "person",
|
|
288
|
+
name: e.name
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
function d(t) {
|
|
292
|
+
if (!t)
|
|
293
|
+
return "";
|
|
294
|
+
const u = t.length, r = Math.ceil(u / 3), s = t.slice(0, r), c = t.slice(r, r * 2), g = t.slice(r * 2);
|
|
295
|
+
return [s, c, g].join(" ");
|
|
296
|
+
}
|
|
297
|
+
const l = "Org. nr. " + d(e?.orgNumber);
|
|
298
|
+
return {
|
|
299
|
+
id: e.id,
|
|
300
|
+
groupId: e.groupId,
|
|
301
|
+
title: e.name,
|
|
302
|
+
description: l,
|
|
303
|
+
searchWords: a,
|
|
304
|
+
icon: {
|
|
305
|
+
type: "company",
|
|
306
|
+
name: e.name,
|
|
307
|
+
isParent: !!e?.parentId
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
}), U = {
|
|
311
|
+
label: n[0].title,
|
|
312
|
+
items: n,
|
|
313
|
+
groups: {
|
|
314
|
+
favourites: { title: "Favoritter" },
|
|
315
|
+
aa: { title: "Alfa Bar & Brød" },
|
|
316
|
+
search: { title: "{count} treff" }
|
|
317
|
+
},
|
|
318
|
+
size: "md"
|
|
319
|
+
}, i = [
|
|
320
|
+
{
|
|
321
|
+
id: "inbox",
|
|
322
|
+
groupId: "1",
|
|
323
|
+
icon: h,
|
|
324
|
+
selected: !0,
|
|
325
|
+
title: "Innboks"
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
id: "drafts",
|
|
329
|
+
groupId: "2",
|
|
330
|
+
icon: k,
|
|
331
|
+
title: "Utkast"
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
id: "sent",
|
|
335
|
+
groupId: "2",
|
|
336
|
+
icon: S,
|
|
337
|
+
title: "Sendt"
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
id: "bookmarks",
|
|
341
|
+
groupId: "3",
|
|
342
|
+
icon: f,
|
|
343
|
+
title: "Lagrede søk"
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
id: "trash",
|
|
347
|
+
groupId: "4",
|
|
348
|
+
icon: I,
|
|
349
|
+
title: "Arkivert"
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
id: "6",
|
|
353
|
+
groupId: "4",
|
|
354
|
+
icon: b,
|
|
355
|
+
title: "Papirkurv"
|
|
356
|
+
}
|
|
357
|
+
], D = {
|
|
358
|
+
label: i[0].title,
|
|
359
|
+
items: i,
|
|
360
|
+
size: "md"
|
|
361
|
+
};
|
|
362
|
+
export {
|
|
363
|
+
U as accountMenu,
|
|
364
|
+
n as accountMenuItems,
|
|
365
|
+
N as contentFilter,
|
|
366
|
+
F as inboxFilters,
|
|
367
|
+
D as inboxMenu,
|
|
368
|
+
i as inboxMenuItems,
|
|
369
|
+
C as removableInboxFilters,
|
|
370
|
+
y as seenByFilter,
|
|
371
|
+
x as statusFilter,
|
|
372
|
+
B as timeFilter
|
|
373
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
const N = (u = 10) => {
|
|
2
|
+
const m = ["Nordic", "Global", "Norwegian", "Alpha", "Beta", "Gamma", "Rapid", "Smart", "Green", "Future"], l = [
|
|
3
|
+
"Solutions",
|
|
4
|
+
"Logistics",
|
|
5
|
+
"Systems",
|
|
6
|
+
"Consulting",
|
|
7
|
+
"Bakery",
|
|
8
|
+
"Tech",
|
|
9
|
+
"Holdings",
|
|
10
|
+
"Ventures",
|
|
11
|
+
"Media",
|
|
12
|
+
"Group"
|
|
13
|
+
], h = ["AS", "ASA", "AB", "Inc", "Ltd", "Corp"], c = (n) => n[Math.floor(Math.random() * n.length)], g = () => Math.floor(1e8 + Math.random() * 9e8).toString(), f = ((n) => {
|
|
14
|
+
const r = [], a = [];
|
|
15
|
+
for (let o = 0; o < n; o++) {
|
|
16
|
+
const t = `company-${o}`, s = `${c(m)} ${c(l)} ${c(h)}`, e = s.charAt(0).toLowerCase(), i = o > 0 && Math.random() < 0.5 ? a[Math.floor(Math.random() * a.length)] : void 0;
|
|
17
|
+
r.push({
|
|
18
|
+
id: t,
|
|
19
|
+
groupId: e,
|
|
20
|
+
name: s,
|
|
21
|
+
orgNumber: g(),
|
|
22
|
+
parentId: i
|
|
23
|
+
}), a.push(t);
|
|
24
|
+
}
|
|
25
|
+
return r.sort((o, t) => o.name.localeCompare(t.name));
|
|
26
|
+
})(u), d = [
|
|
27
|
+
{
|
|
28
|
+
id: "user",
|
|
29
|
+
groupId: "favourites",
|
|
30
|
+
name: "Kari Nordmann",
|
|
31
|
+
birthdate: "03037712345"
|
|
32
|
+
},
|
|
33
|
+
...f
|
|
34
|
+
].map((n) => {
|
|
35
|
+
const r = [n.name, n.orgNumber, n.birthdate];
|
|
36
|
+
if (n.birthdate)
|
|
37
|
+
return {
|
|
38
|
+
...n,
|
|
39
|
+
searchWords: r,
|
|
40
|
+
title: n.name,
|
|
41
|
+
description: "Født: " + n.birthdate,
|
|
42
|
+
icon: {
|
|
43
|
+
type: "person",
|
|
44
|
+
name: n.name
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
function a(t) {
|
|
48
|
+
if (!t)
|
|
49
|
+
return "";
|
|
50
|
+
const s = t.length, e = Math.ceil(s / 3), p = t.slice(0, e), i = t.slice(e, e * 2), I = t.slice(e * 2);
|
|
51
|
+
return [p, i, I].join(" ");
|
|
52
|
+
}
|
|
53
|
+
const o = "Org. nr. " + a(n?.orgNumber);
|
|
54
|
+
return {
|
|
55
|
+
id: n.id,
|
|
56
|
+
groupId: n?.parentId || n.id,
|
|
57
|
+
title: n.name,
|
|
58
|
+
description: o,
|
|
59
|
+
searchWords: r,
|
|
60
|
+
icon: {
|
|
61
|
+
type: "company",
|
|
62
|
+
name: n.name,
|
|
63
|
+
isParent: !!n.parentId
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}), C = d.find((n) => n.icon.type === "company")?.groupId || "aa", y = {
|
|
67
|
+
favourites: { title: "Favoritter" },
|
|
68
|
+
[C]: { title: "Alle virksomheter" },
|
|
69
|
+
search: { title: "{count} treff" }
|
|
70
|
+
};
|
|
71
|
+
return { items: d, groups: y };
|
|
72
|
+
};
|
|
73
|
+
export {
|
|
74
|
+
N as useRandomMenuItems
|
|
75
|
+
};
|
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
1
|
+
import { Menu as o } from "./Menu.js";
|
|
2
|
+
import { MenuItem as m } from "./MenuItem.js";
|
|
3
|
+
import { MenuItems as p } from "./MenuItems.js";
|
|
4
|
+
import { MenuList as f } from "./MenuList.js";
|
|
5
|
+
import { MenuListItem as x } from "./MenuListItem.js";
|
|
6
|
+
import { MenuListGroup as s } from "./MenuListGroup.js";
|
|
7
|
+
import { MenuListDivider as a } from "./MenuListDivider.js";
|
|
8
|
+
import { MenuListHeading as d } from "./MenuListHeading.js";
|
|
9
|
+
import { MenuListSearch as c } from "./MenuListSearch.js";
|
|
10
|
+
import { MenuOption as h } from "./MenuOption.js";
|
|
11
|
+
import { TabMenu as v } from "./TabMenu.js";
|
|
12
|
+
import { VirtualizedMenuItems as D } from "./VirtualizedMenuItems.js";
|
|
12
13
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
l as MenuSearch,
|
|
26
|
-
n as getAriaLabelFromTitle
|
|
14
|
+
o as Menu,
|
|
15
|
+
m as MenuItem,
|
|
16
|
+
p as MenuItems,
|
|
17
|
+
f as MenuList,
|
|
18
|
+
a as MenuListDivider,
|
|
19
|
+
s as MenuListGroup,
|
|
20
|
+
d as MenuListHeading,
|
|
21
|
+
x as MenuListItem,
|
|
22
|
+
c as MenuListSearch,
|
|
23
|
+
h as MenuOption,
|
|
24
|
+
v as TabMenu,
|
|
25
|
+
D as VirtualizedMenuItems
|
|
27
26
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useId as D, useMemo as u, useState as v, useRef as c, useCallback as a, useEffect as F } from "react";
|
|
2
|
+
function q(A = {}) {
|
|
3
|
+
const { id: f, focusPanelOnOpen: i = !0, returnFocusOnClose: l = !0 } = A, p = D(), n = u(() => f || `menu-${p}`, [f, p]), [e, t] = v(!1), [s, d] = v(void 0), m = c(null), r = c(null), I = c(e), O = a(() => t(!0), []), g = a(() => t(!1), []), M = a(() => t((o) => !o), []);
|
|
4
|
+
F(() => {
|
|
5
|
+
const o = I.current;
|
|
6
|
+
if (I.current = e, o && !e && l) {
|
|
7
|
+
requestAnimationFrame(() => m.current?.focus?.());
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
!o && e && i && requestAnimationFrame(() => r.current?.focus?.());
|
|
11
|
+
}, [e, i, l]);
|
|
12
|
+
const C = u(
|
|
13
|
+
() => ({
|
|
14
|
+
menuId: n,
|
|
15
|
+
activeDescendantId: s,
|
|
16
|
+
panelRef: r
|
|
17
|
+
}),
|
|
18
|
+
[n, s]
|
|
19
|
+
), R = u(
|
|
20
|
+
() => ({
|
|
21
|
+
id: n,
|
|
22
|
+
onActiveItemIdChange: d
|
|
23
|
+
}),
|
|
24
|
+
[n]
|
|
25
|
+
);
|
|
26
|
+
return {
|
|
27
|
+
open: e,
|
|
28
|
+
setOpen: t,
|
|
29
|
+
openMenu: O,
|
|
30
|
+
closeMenu: g,
|
|
31
|
+
toggleMenu: M,
|
|
32
|
+
menuId: n,
|
|
33
|
+
activeDescendantId: s,
|
|
34
|
+
setActiveDescendantId: d,
|
|
35
|
+
triggerRef: m,
|
|
36
|
+
panelRef: r,
|
|
37
|
+
dropdownA11yProps: C,
|
|
38
|
+
menuA11yProps: R
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
q as useDropdownMenuController
|
|
43
|
+
};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as t from "react";
|
|
3
|
+
import { useRootContext as Q } from "../RootProvider/RootProvider.js";
|
|
4
|
+
import { S as z } from "../../InformationSquare-D3WAxfVw.js";
|
|
5
|
+
const B = (u) => {
|
|
6
|
+
switch (u) {
|
|
7
|
+
case "nn":
|
|
8
|
+
return {
|
|
9
|
+
placeholder: "Søk ...",
|
|
10
|
+
hits: (e) => `${e} treff`,
|
|
11
|
+
selected: (e) => `${e} valt`,
|
|
12
|
+
noResults: "Ingen treff"
|
|
13
|
+
};
|
|
14
|
+
case "en":
|
|
15
|
+
return {
|
|
16
|
+
placeholder: "Search ...",
|
|
17
|
+
hits: (e) => `${e} hit${e === 1 ? "" : "s"}`,
|
|
18
|
+
selected: (e) => `${e} selected`,
|
|
19
|
+
noResults: "No results"
|
|
20
|
+
};
|
|
21
|
+
default:
|
|
22
|
+
return {
|
|
23
|
+
placeholder: "Søk ...",
|
|
24
|
+
hits: (e) => `${e} treff`,
|
|
25
|
+
selected: (e) => `${e} valgt`,
|
|
26
|
+
noResults: "Ingen treff"
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}, j = (u) => {
|
|
30
|
+
const e = /* @__PURE__ */ new Set(), l = [];
|
|
31
|
+
for (const d of u) {
|
|
32
|
+
const a = d.id;
|
|
33
|
+
if (!a) {
|
|
34
|
+
l.push(d);
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
e.has(a) || (e.add(a), l.push(d));
|
|
38
|
+
}
|
|
39
|
+
return l;
|
|
40
|
+
}, K = ({
|
|
41
|
+
placeholder: u,
|
|
42
|
+
name: e,
|
|
43
|
+
onChange: l,
|
|
44
|
+
onClear: d,
|
|
45
|
+
clearButtonAltText: a,
|
|
46
|
+
items: h = [],
|
|
47
|
+
groups: M = {}
|
|
48
|
+
}) => {
|
|
49
|
+
const { languageCode: I } = Q(), o = t.useMemo(() => B(I), [I]), [f, R] = t.useState(""), C = t.useCallback(
|
|
50
|
+
(s) => {
|
|
51
|
+
R(s.target.value), l?.(s);
|
|
52
|
+
},
|
|
53
|
+
[l]
|
|
54
|
+
), w = t.useCallback(() => {
|
|
55
|
+
R(""), d?.();
|
|
56
|
+
}, [d]), i = t.useMemo(() => f.trim().replace(/\s+/g, " "), [f]), r = i.length > 0, y = t.useMemo(() => i.toLowerCase(), [i]), v = t.useMemo(() => i ? i.split(" ") : [], [i]), H = t.useMemo(
|
|
57
|
+
() => ({
|
|
58
|
+
placeholder: u ?? o.placeholder,
|
|
59
|
+
name: e ?? "search",
|
|
60
|
+
value: f,
|
|
61
|
+
onChange: C,
|
|
62
|
+
onClear: w,
|
|
63
|
+
clearButtonAltText: a
|
|
64
|
+
}),
|
|
65
|
+
[u, o.placeholder, e, f, C, w, a]
|
|
66
|
+
), $ = t.useMemo(
|
|
67
|
+
() => h.map((s) => {
|
|
68
|
+
const c = s?.searchWords?.length ? s.searchWords : [s?.title, s?.description].filter(Boolean);
|
|
69
|
+
return {
|
|
70
|
+
...s,
|
|
71
|
+
searchWords: c ?? []
|
|
72
|
+
};
|
|
73
|
+
}),
|
|
74
|
+
[h]
|
|
75
|
+
), k = t.useMemo(
|
|
76
|
+
() => [
|
|
77
|
+
{
|
|
78
|
+
id: "emptySearch",
|
|
79
|
+
title: o.noResults,
|
|
80
|
+
groupId: "emptySearch",
|
|
81
|
+
icon: z,
|
|
82
|
+
size: "sm",
|
|
83
|
+
as: "div"
|
|
84
|
+
}
|
|
85
|
+
],
|
|
86
|
+
[o.noResults]
|
|
87
|
+
), q = t.useMemo(() => {
|
|
88
|
+
const s = h.filter((c) => c.groupId === "emptySearch").map((c) => ({ ...c, hidden: !1 }));
|
|
89
|
+
return s.length ? s : k;
|
|
90
|
+
}, [h, k]), { selectedItems: p, results: g } = t.useMemo(() => {
|
|
91
|
+
if (!r) return { selectedItems: [], results: [] };
|
|
92
|
+
const s = [], c = [];
|
|
93
|
+
for (const S of $)
|
|
94
|
+
S.checked === !0 && s.push({ ...S, groupId: "selected" }), (S.searchWords ?? []).some((G) => String(G).toLowerCase().includes(y)) && c.push({
|
|
95
|
+
...S,
|
|
96
|
+
groupId: "search",
|
|
97
|
+
highlightWords: v
|
|
98
|
+
});
|
|
99
|
+
return { selectedItems: s, results: c };
|
|
100
|
+
}, [r, $, y, v]), n = g.length, m = p.length, W = t.useMemo(
|
|
101
|
+
() => ({
|
|
102
|
+
search: {
|
|
103
|
+
hidden: !0,
|
|
104
|
+
title: o.hits(n)
|
|
105
|
+
},
|
|
106
|
+
selected: {
|
|
107
|
+
hidden: !0,
|
|
108
|
+
title: o.selected(m)
|
|
109
|
+
},
|
|
110
|
+
emptySearch: {
|
|
111
|
+
hidden: !0,
|
|
112
|
+
title: o.noResults
|
|
113
|
+
},
|
|
114
|
+
...M
|
|
115
|
+
}),
|
|
116
|
+
[o, n, m, M]
|
|
117
|
+
), L = t.useMemo(
|
|
118
|
+
() => ({
|
|
119
|
+
...W,
|
|
120
|
+
search: {
|
|
121
|
+
hidden: !r,
|
|
122
|
+
title: o.hits(n)
|
|
123
|
+
},
|
|
124
|
+
selected: {
|
|
125
|
+
hidden: m === 0,
|
|
126
|
+
title: o.selected(m)
|
|
127
|
+
},
|
|
128
|
+
emptySearch: {
|
|
129
|
+
hidden: r && (n > 0 || m > 0),
|
|
130
|
+
title: o.noResults
|
|
131
|
+
}
|
|
132
|
+
}),
|
|
133
|
+
[W, r, o, n, m]
|
|
134
|
+
), b = t.useMemo(() => r ? j([...g, ...p]) : [], [r, g, p]), x = t.useMemo(() => [...q || [], ...p || []], [q, p]), N = t.useMemo(() => r ? n ? b : x : h, [r, h, n, b, x]);
|
|
135
|
+
return {
|
|
136
|
+
search: H,
|
|
137
|
+
results: g,
|
|
138
|
+
resultCount: n,
|
|
139
|
+
hasQuery: r,
|
|
140
|
+
items: N,
|
|
141
|
+
groups: L
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
export {
|
|
145
|
+
K as useMenuSearch
|
|
146
|
+
};
|