@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,388 @@
|
|
|
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
|
+
role: "datepicker",
|
|
131
|
+
icon: o,
|
|
132
|
+
title: "Spesifiser dato ...",
|
|
133
|
+
linkIcon: !0
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
}, y = {
|
|
137
|
+
id: "seenBy",
|
|
138
|
+
groupId: "2",
|
|
139
|
+
icon: v,
|
|
140
|
+
name: "seenBy",
|
|
141
|
+
label: "Sett av ...",
|
|
142
|
+
searchable: !0,
|
|
143
|
+
search: {
|
|
144
|
+
name: "seenBy",
|
|
145
|
+
placeholder: "Seen by who?",
|
|
146
|
+
onChange: (e) => console.log(e.target.value)
|
|
147
|
+
},
|
|
148
|
+
groups: {
|
|
149
|
+
1: {
|
|
150
|
+
title: "Sett av ..."
|
|
151
|
+
},
|
|
152
|
+
search: {
|
|
153
|
+
title: "{count} treff"
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
items: [
|
|
157
|
+
{
|
|
158
|
+
id: "1",
|
|
159
|
+
groupId: "1",
|
|
160
|
+
name: "seenBy",
|
|
161
|
+
role: "checkbox",
|
|
162
|
+
value: "you",
|
|
163
|
+
title: "Sett av deg"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
id: "2",
|
|
167
|
+
groupId: "1",
|
|
168
|
+
name: "seenBy",
|
|
169
|
+
role: "checkbox",
|
|
170
|
+
value: "others",
|
|
171
|
+
title: "Sett av andre"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
id: "3",
|
|
175
|
+
groupId: "2",
|
|
176
|
+
name: "seenBy",
|
|
177
|
+
role: "checkbox",
|
|
178
|
+
value: "per-nordmann",
|
|
179
|
+
title: "Per Nordmann"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
id: "4",
|
|
183
|
+
groupId: "2",
|
|
184
|
+
name: "seenBy",
|
|
185
|
+
role: "checkbox",
|
|
186
|
+
value: "kari-nordmann",
|
|
187
|
+
title: "Kari Nordmann"
|
|
188
|
+
}
|
|
189
|
+
]
|
|
190
|
+
}, N = {
|
|
191
|
+
id: "content",
|
|
192
|
+
groupId: "2",
|
|
193
|
+
icon: p,
|
|
194
|
+
name: "content",
|
|
195
|
+
label: "Inneholder ...",
|
|
196
|
+
groups: {
|
|
197
|
+
1: {
|
|
198
|
+
title: "Inneholder ..."
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
items: [
|
|
202
|
+
{
|
|
203
|
+
id: "1",
|
|
204
|
+
groupId: "1",
|
|
205
|
+
name: "drafts",
|
|
206
|
+
role: "checkbox",
|
|
207
|
+
value: "true",
|
|
208
|
+
title: "Utkast"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
id: "2",
|
|
212
|
+
groupId: "1",
|
|
213
|
+
name: "attachments",
|
|
214
|
+
role: "checkbox",
|
|
215
|
+
value: "true",
|
|
216
|
+
title: "Vedlegg"
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
id: "3",
|
|
220
|
+
groupId: "2",
|
|
221
|
+
name: "sent",
|
|
222
|
+
role: "checkbox",
|
|
223
|
+
value: "true",
|
|
224
|
+
title: "Sendte meldinger"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
id: "4",
|
|
228
|
+
groupId: "2",
|
|
229
|
+
name: "received",
|
|
230
|
+
role: "checkbox",
|
|
231
|
+
value: "true",
|
|
232
|
+
title: "Mottatte meldinger"
|
|
233
|
+
}
|
|
234
|
+
]
|
|
235
|
+
}, F = [x, B, y, N], V = F?.map((e) => ({
|
|
236
|
+
...e,
|
|
237
|
+
removable: !0
|
|
238
|
+
})), n = [
|
|
239
|
+
{
|
|
240
|
+
id: "user",
|
|
241
|
+
groupId: "favourites",
|
|
242
|
+
name: "Kari Nordmann",
|
|
243
|
+
birthdate: "03037712345"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
id: "aa-1",
|
|
247
|
+
groupId: "aa",
|
|
248
|
+
name: "Alfa Bar & Brød",
|
|
249
|
+
orgNumber: "551415161"
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
id: "aa-2",
|
|
253
|
+
groupId: "aa",
|
|
254
|
+
name: "Alfa Bar & Brød",
|
|
255
|
+
orgNumber: "551415162",
|
|
256
|
+
parentId: "aa-1"
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
id: "bb-1",
|
|
260
|
+
groupId: "bb",
|
|
261
|
+
name: "Beta Inc.",
|
|
262
|
+
orgNumber: "991557788"
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
id: "bb-2",
|
|
266
|
+
groupId: "bb",
|
|
267
|
+
name: "Beta Inc.",
|
|
268
|
+
orgNumber: "991557789",
|
|
269
|
+
parentId: "bb-1"
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
id: "cc-1",
|
|
273
|
+
groupId: "cc",
|
|
274
|
+
name: "Charlies engler",
|
|
275
|
+
orgNumber: "333444555"
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
id: "cc-2",
|
|
279
|
+
groupId: "cc",
|
|
280
|
+
name: "Charlies engler",
|
|
281
|
+
orgNumber: "333444556",
|
|
282
|
+
parentId: "cc-1"
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
id: "cc-3",
|
|
286
|
+
groupId: "dd",
|
|
287
|
+
name: "Den kjempeskumle krokodillen Alan",
|
|
288
|
+
orgNumber: "333444557",
|
|
289
|
+
parentId: ""
|
|
290
|
+
}
|
|
291
|
+
].map((e) => {
|
|
292
|
+
const a = [e.name, e.orgNumber, e.birthdate].filter(Boolean) || void 0;
|
|
293
|
+
if (e.birthdate)
|
|
294
|
+
return {
|
|
295
|
+
id: e.id,
|
|
296
|
+
groupId: e.groupId,
|
|
297
|
+
searchWords: a,
|
|
298
|
+
title: e.name,
|
|
299
|
+
description: "Født: " + e.birthdate,
|
|
300
|
+
icon: {
|
|
301
|
+
type: "person",
|
|
302
|
+
name: e.name
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
function l(t) {
|
|
306
|
+
if (!t)
|
|
307
|
+
return "";
|
|
308
|
+
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);
|
|
309
|
+
return [s, c, g].join(" ");
|
|
310
|
+
}
|
|
311
|
+
const d = "Org. nr. " + l(e?.orgNumber);
|
|
312
|
+
return {
|
|
313
|
+
id: e.id,
|
|
314
|
+
groupId: e.groupId,
|
|
315
|
+
title: e.name,
|
|
316
|
+
description: d,
|
|
317
|
+
searchWords: a,
|
|
318
|
+
icon: {
|
|
319
|
+
type: "company",
|
|
320
|
+
name: e.name,
|
|
321
|
+
isParent: !!e?.parentId
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
}), D = {
|
|
325
|
+
label: n[0].title,
|
|
326
|
+
items: n,
|
|
327
|
+
searchable: !0,
|
|
328
|
+
groups: {
|
|
329
|
+
favourites: { title: "Favoritter" },
|
|
330
|
+
aa: { title: "Alfa Bar & Brød" },
|
|
331
|
+
search: { title: "{count} treff" }
|
|
332
|
+
},
|
|
333
|
+
size: "md"
|
|
334
|
+
}, i = [
|
|
335
|
+
{
|
|
336
|
+
id: "inbox",
|
|
337
|
+
groupId: "1",
|
|
338
|
+
icon: h,
|
|
339
|
+
selected: !0,
|
|
340
|
+
title: "Innboks"
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
id: "drafts",
|
|
344
|
+
groupId: "2",
|
|
345
|
+
icon: k,
|
|
346
|
+
title: "Utkast"
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
id: "sent",
|
|
350
|
+
groupId: "2",
|
|
351
|
+
icon: S,
|
|
352
|
+
title: "Sendt"
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
id: "bookmarks",
|
|
356
|
+
groupId: "3",
|
|
357
|
+
icon: f,
|
|
358
|
+
title: "Lagrede søk"
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
id: "trash",
|
|
362
|
+
groupId: "4",
|
|
363
|
+
icon: I,
|
|
364
|
+
title: "Arkivert"
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
id: "6",
|
|
368
|
+
groupId: "4",
|
|
369
|
+
icon: b,
|
|
370
|
+
title: "Papirkurv"
|
|
371
|
+
}
|
|
372
|
+
], U = {
|
|
373
|
+
label: i[0].title,
|
|
374
|
+
items: i,
|
|
375
|
+
size: "sm"
|
|
376
|
+
};
|
|
377
|
+
export {
|
|
378
|
+
D as accountMenu,
|
|
379
|
+
n as accountMenuItems,
|
|
380
|
+
N as contentFilter,
|
|
381
|
+
F as inboxFilters,
|
|
382
|
+
U as inboxMenu,
|
|
383
|
+
i as inboxMenuItems,
|
|
384
|
+
V as removableInboxFilters,
|
|
385
|
+
y as seenByFilter,
|
|
386
|
+
x as statusFilter,
|
|
387
|
+
B as timeFilter
|
|
388
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { useState as S } from "react";
|
|
2
|
+
import { inboxFilters as v, accountMenu as l } from "./example.data.js";
|
|
3
|
+
import { formatDateRange as h } from "./formatDateRange.js";
|
|
4
|
+
const p = ({ filters: s = v, defaultFilterState: c = {} }) => {
|
|
5
|
+
const [n, u] = S(c), d = () => {
|
|
6
|
+
const t = n?.seenBy || [], e = t?.length;
|
|
7
|
+
return e > 1 && t?.includes("you") && t?.includes("others") ? "Sett av deg + andre" : e > 1 && t?.includes("you") ? `Sett av deg + ${e - 1}` : t?.includes("user") ? "Sett av deg" : t?.includes("others") ? "Sett av andre" : e ? `Sett av ${e}` : "Sett av ...";
|
|
8
|
+
}, o = () => {
|
|
9
|
+
const t = (n?.drafts?.length ?? 0) > 0 ? "Utkast" : void 0, e = (n?.attachments?.length ?? 0) > 0 ? "Vedlegg" : void 0, i = (n?.sent?.length ?? 0) > 0 ? "Sendt" : void 0, r = (n?.received?.length ?? 0) > 0 ? "Mottatt" : void 0;
|
|
10
|
+
return [t, e, i, r].filter(Boolean).join(" + ");
|
|
11
|
+
}, b = () => {
|
|
12
|
+
const t = n?.fromDate?.[0]?.toString(), e = n?.toDate?.[0]?.toString();
|
|
13
|
+
if (t && e)
|
|
14
|
+
return h(t, e);
|
|
15
|
+
if (t)
|
|
16
|
+
return h(t);
|
|
17
|
+
const i = n?.time || [], r = i?.length, g = s?.find((a) => a.name === "time")?.items, m = i?.map((a) => g?.find((f) => f.value === a)?.title);
|
|
18
|
+
return r === 1 ? m?.[0] : r > 1 ? `${r} tider` : "Tid";
|
|
19
|
+
}, L = () => {
|
|
20
|
+
const t = n?.status || [], e = t?.length, i = s?.find((a) => a.name === "status")?.items, r = t?.map((a) => i?.find((f) => f.value === a)?.title), g = (n?.unread?.length ?? 0) > 0 ? "Ulest" : void 0, m = e === 1 ? r?.[0] : e > 1 ? `${e} statuser` : void 0;
|
|
21
|
+
return [g, m].filter(Boolean).join(" + ");
|
|
22
|
+
};
|
|
23
|
+
return {
|
|
24
|
+
addLabel: "Legg til filter",
|
|
25
|
+
submitLabel: "Show results",
|
|
26
|
+
addNextLabel: "Legg til",
|
|
27
|
+
filters: s,
|
|
28
|
+
filterState: n,
|
|
29
|
+
onFilterStateChange: u,
|
|
30
|
+
getFilterLabel: (t) => {
|
|
31
|
+
switch (t) {
|
|
32
|
+
case "status":
|
|
33
|
+
return L() || "Status";
|
|
34
|
+
case "time":
|
|
35
|
+
return b() || "Tid";
|
|
36
|
+
case "seenBy":
|
|
37
|
+
return d() || "Sett av";
|
|
38
|
+
case "content":
|
|
39
|
+
return o() || "Innhold";
|
|
40
|
+
default:
|
|
41
|
+
return t;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}, F = () => {
|
|
46
|
+
const [s, c] = S(l.items[0].id), n = (o) => {
|
|
47
|
+
c(o);
|
|
48
|
+
}, u = l.items.find((o) => o.id === s)?.title?.toString() || "Account", d = l.items.map((o) => ({
|
|
49
|
+
...o,
|
|
50
|
+
selected: o.id === s
|
|
51
|
+
}));
|
|
52
|
+
return { ...l, label: u, onSelectId: n, items: d, virtualized: !0 };
|
|
53
|
+
}, A = () => {
|
|
54
|
+
const s = p({ filters: v });
|
|
55
|
+
return {
|
|
56
|
+
menus: [F()],
|
|
57
|
+
search: {
|
|
58
|
+
name: "search",
|
|
59
|
+
placeholder: "Søk"
|
|
60
|
+
},
|
|
61
|
+
filter: s
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export {
|
|
65
|
+
F as useAccountMenu,
|
|
66
|
+
p as useInboxFilter,
|
|
67
|
+
A as useInboxToolbar
|
|
68
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
function u(e) {
|
|
2
|
+
if (!e || e === "" || !/^\d{4}-\d{2}-\d{2}$/.test(e))
|
|
3
|
+
return !1;
|
|
4
|
+
const [s, t, a] = e.split("-"), n = Number.parseInt(s, 10), i = Number.parseInt(t, 10), m = Number.parseInt(a, 10), o = new Date(n, i - 1, m);
|
|
5
|
+
return !Number.isNaN(o.getTime()) && // Check if date is not "Invalid Date"
|
|
6
|
+
o.getFullYear() === n && o.getMonth() + 1 === i && // Add 1 back to month for comparison
|
|
7
|
+
o.getDate() === m;
|
|
8
|
+
}
|
|
9
|
+
function f(e, r, s = "nb-NO") {
|
|
10
|
+
const t = e && u(e) ? new Date(e) : void 0, a = r && u(r) ? new Date(r) : void 0, n = new Intl.DateTimeFormat(s, {
|
|
11
|
+
day: "numeric",
|
|
12
|
+
month: "long",
|
|
13
|
+
year: "numeric"
|
|
14
|
+
});
|
|
15
|
+
return t && a && n.formatRange ? n.formatRange(t, a) : t ? n.format(t) : "";
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
f as formatDateRange
|
|
19
|
+
};
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { ToolbarDaterange as n } from "./ToolbarDaterange.js";
|
|
1
|
+
import { Toolbar as e } from "./Toolbar.js";
|
|
2
|
+
import { ToolbarFilter as l } from "./ToolbarFilter.js";
|
|
3
|
+
import { ToolbarSearch as f } from "./ToolbarSearch.js";
|
|
4
|
+
import { ToolbarMenu as p } from "./ToolbarMenu.js";
|
|
5
|
+
import { useFilter as b } from "./useFilter.js";
|
|
6
|
+
import { SelectDateFilter as i } from "./SelectDateFilter.js";
|
|
8
7
|
export {
|
|
9
|
-
|
|
10
|
-
e as
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
m as ToolbarSearch
|
|
8
|
+
i as SelectDateFilter,
|
|
9
|
+
e as Toolbar,
|
|
10
|
+
l as ToolbarFilter,
|
|
11
|
+
p as ToolbarMenu,
|
|
12
|
+
f as ToolbarSearch,
|
|
13
|
+
b as useFilter
|
|
16
14
|
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState as g, useMemo as f, useEffect as h } from "react";
|
|
3
|
+
const m = (l, d) => d || `toolbar-filter-${l}`, N = ({ filters: l = [], filterState: d, onFilterStateChange: u }) => {
|
|
4
|
+
const i = d || {}, c = typeof u == "function" ? u : () => {
|
|
5
|
+
}, [r, o] = g(
|
|
6
|
+
() => l.filter((e) => !e.removable || typeof i[e.name] < "u").map((e) => e.name)
|
|
7
|
+
), F = f(
|
|
8
|
+
() => r.map((e) => l.find((t) => t.name === e)).filter((e) => typeof e < "u"),
|
|
9
|
+
[l, r]
|
|
10
|
+
), b = f(
|
|
11
|
+
() => l.filter((e) => !r.includes(e.name)),
|
|
12
|
+
[l, r]
|
|
13
|
+
);
|
|
14
|
+
h(() => {
|
|
15
|
+
const e = l.filter((t) => !t.removable || typeof i[t.name] < "u").map((t) => t.name);
|
|
16
|
+
o((t) => {
|
|
17
|
+
const s = e.filter((n) => !t.includes(n));
|
|
18
|
+
return s.length === 0 ? t : [...t, ...s];
|
|
19
|
+
});
|
|
20
|
+
}, [l, i]);
|
|
21
|
+
const v = (e, t, s) => {
|
|
22
|
+
const n = [s];
|
|
23
|
+
c(e === "radio" ? {
|
|
24
|
+
...i,
|
|
25
|
+
[t]: n
|
|
26
|
+
} : {
|
|
27
|
+
...i,
|
|
28
|
+
[t]: i[t] ? i[t].some((a) => n.includes(String(a))) ? i[t].filter((a) => !(n || []).includes(String(a))) : [...i[t], ...n || []] : n
|
|
29
|
+
});
|
|
30
|
+
}, p = (e) => {
|
|
31
|
+
o((t) => t.filter((s) => s !== e)), c({
|
|
32
|
+
...i,
|
|
33
|
+
[e]: void 0
|
|
34
|
+
});
|
|
35
|
+
}, y = (e) => {
|
|
36
|
+
r.includes(e) || o((t) => [...t, e]), c({
|
|
37
|
+
...i,
|
|
38
|
+
[e]: i[e] ?? []
|
|
39
|
+
}), requestAnimationFrame(() => {
|
|
40
|
+
document.querySelector(`[data-id="filter-button-${e}"]`)?.click();
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
return {
|
|
44
|
+
visibleFilters: F?.map((e) => ({
|
|
45
|
+
...e,
|
|
46
|
+
items: e.items?.map((t) => ({
|
|
47
|
+
...t,
|
|
48
|
+
checked: t?.name && t?.value !== void 0 ? i?.[t.name]?.includes(t.value) : !1
|
|
49
|
+
})),
|
|
50
|
+
id: m(e.name, e.id)
|
|
51
|
+
})),
|
|
52
|
+
hiddenFilters: b?.map((e) => ({
|
|
53
|
+
...e,
|
|
54
|
+
id: m(e.name, e.id)
|
|
55
|
+
})),
|
|
56
|
+
onFilterChange: v,
|
|
57
|
+
onFilterRemove: p,
|
|
58
|
+
onFilterAdd: y
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
export {
|
|
62
|
+
N as useFilter
|
|
63
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as z, Fragment as I, jsx as w } from "react/jsx-runtime";
|
|
3
|
+
import { a as j, c as D, o as N, f as W, s as x } from "../../floating-ui.dom-bEgaHJCq.js";
|
|
4
|
+
import { S as B } from "../../index-D7FJjvrv.js";
|
|
5
|
+
import { c as K } from "../../lite-1fxw3LjI.js";
|
|
6
|
+
import { forwardRef as U, useId as X, useState as Y, useRef as k, useEffect as E, Fragment as q, version as T } from "react";
|
|
7
|
+
import { u as G } from "../../use-merge-refs-Cj4kTYVj.js";
|
|
8
|
+
import '../../assets/Tooltip.css';const H = U(function({ id: s, children: e, content: n, placement: t = "top", autoPlacement: o = !0, open: P, className: M, type: v, ...R }, $) {
|
|
9
|
+
const F = X(), [L, f] = Y(!1), d = k(null), u = k(null), O = G([u, $]), i = P ?? L, m = s ?? F, g = () => {
|
|
10
|
+
f(!0);
|
|
11
|
+
}, h = () => {
|
|
12
|
+
f(!1);
|
|
13
|
+
};
|
|
14
|
+
E(() => {
|
|
15
|
+
const a = u.current, p = d.current;
|
|
16
|
+
if (a?.togglePopover?.(i), a && (a.style.opacity = i ? "1" : "0"), a && p && i)
|
|
17
|
+
return j(p, a, () => {
|
|
18
|
+
D(p, a, {
|
|
19
|
+
placement: t,
|
|
20
|
+
strategy: "fixed",
|
|
21
|
+
middleware: [
|
|
22
|
+
N((l) => {
|
|
23
|
+
const c = getComputedStyle(l.elements.floating, "::before");
|
|
24
|
+
return parseFloat(c.height);
|
|
25
|
+
}),
|
|
26
|
+
...o ? [W({ fallbackAxisSideDirection: "start" }), x()] : [],
|
|
27
|
+
x(),
|
|
28
|
+
J,
|
|
29
|
+
Q
|
|
30
|
+
]
|
|
31
|
+
}).then(({ x: l, y: c }) => {
|
|
32
|
+
a.style.translate = `${Math.round(l)}px ${Math.round(c)}px`;
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}, [i, t]), E(() => {
|
|
36
|
+
const a = u.current, p = d.current, l = (y) => {
|
|
37
|
+
y.key === "Escape" && f(!1);
|
|
38
|
+
}, c = (y) => {
|
|
39
|
+
const b = y.target, C = a?.contains(b);
|
|
40
|
+
!p?.contains(b) && !C && i && f(!1);
|
|
41
|
+
};
|
|
42
|
+
return i && (window.addEventListener("keydown", l), document.addEventListener("click", c)), () => {
|
|
43
|
+
window.removeEventListener("keydown", l), document.removeEventListener("click", c);
|
|
44
|
+
};
|
|
45
|
+
}, [i]);
|
|
46
|
+
const S = typeof e == "string" ? "span" : B;
|
|
47
|
+
if (typeof e != "string" && e.type === q)
|
|
48
|
+
return console.error("<Tooltip> children needs to be a single ReactElement that can receive a ref and not: <Fragment/> | <></>"), null;
|
|
49
|
+
const _ = {
|
|
50
|
+
[T.startsWith("19") ? "popoverTarget" : "popovertarget"]: m,
|
|
51
|
+
[T.startsWith("19") ? "popoverTargetAction" : "popovertargetaction"]: "show"
|
|
52
|
+
}, A = `aria-${d.current?.innerText?.trim() ? "describedby" : "labelledby"}`;
|
|
53
|
+
return z(I, { children: [w(S, { ref: d, ..._, onMouseEnter: g, onMouseLeave: h, onFocus: g, onBlur: h, [v ? "aria-" + v : A]: m, children: e }), w("span", { onMouseEnter: g, onMouseLeave: h, ref: O, role: "tooltip", className: K("ds-tooltip", M), id: m, popover: "manual", ...R, children: n })] });
|
|
54
|
+
}), J = {
|
|
55
|
+
name: "ArrowPseudoElement",
|
|
56
|
+
fn(r) {
|
|
57
|
+
const { elements: s, rects: e, placement: n } = r;
|
|
58
|
+
let t = `${Math.round(e.reference.width / 2 + e.reference.x - r.x)}px`, o = `${Math.round(e.reference.height / 2 + e.reference.y - r.y)}px`;
|
|
59
|
+
switch (n) {
|
|
60
|
+
case "top":
|
|
61
|
+
o = "100%";
|
|
62
|
+
break;
|
|
63
|
+
case "right":
|
|
64
|
+
t = "0";
|
|
65
|
+
break;
|
|
66
|
+
case "bottom":
|
|
67
|
+
o = "0";
|
|
68
|
+
break;
|
|
69
|
+
case "left":
|
|
70
|
+
t = "100%";
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
return s.floating.style.setProperty("--dsc-tooltip-arrow-x", t), s.floating.style.setProperty("--dsc-tooltip-arrow-y", o), r;
|
|
74
|
+
}
|
|
75
|
+
}, Q = {
|
|
76
|
+
name: "SafeAreaElement",
|
|
77
|
+
fn(r) {
|
|
78
|
+
const { elements: s, placement: e } = r;
|
|
79
|
+
let n = "100%", t = "var(--dsc-tooltip-arrow-size)", o = "0px";
|
|
80
|
+
switch (e) {
|
|
81
|
+
case "top":
|
|
82
|
+
o = "-50% 0%";
|
|
83
|
+
break;
|
|
84
|
+
case "right":
|
|
85
|
+
t = "100%", n = "var(--dsc-tooltip-arrow-size)", o = "-100% -50%";
|
|
86
|
+
break;
|
|
87
|
+
case "bottom":
|
|
88
|
+
o = "-50% -100%";
|
|
89
|
+
break;
|
|
90
|
+
case "left":
|
|
91
|
+
t = "100%", n = "var(--dsc-tooltip-arrow-size)", o = "0 -50%";
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
return s.floating.style.setProperty("--_dsc-tooltip-safearea-height", t), s.floating.style.setProperty("--_dsc-tooltip-safearea-width", n), s.floating.style.setProperty("--_dsc-tooltip-safearea-translate", o), r;
|
|
95
|
+
}
|
|
96
|
+
}, V = "_tooltip_10ebf_1", Z = {
|
|
97
|
+
tooltip: V
|
|
98
|
+
}, le = ({ size: r = "xs", placement: s, children: e, content: n, hidden: t }) => /* @__PURE__ */ w(H, { "aria-hidden": t, "data-size": r, content: n, placement: s, className: Z.tooltip, children: e });
|
|
99
|
+
export {
|
|
100
|
+
le as Tooltip
|
|
101
|
+
};
|