@altinn/altinn-components 0.54.3 → 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/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/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
|
@@ -1,92 +1,94 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import * as E from "react";
|
|
3
|
+
import { useState as C, useLayoutEffect as T, useMemo as _ } from "react";
|
|
4
|
+
import { flushSync as R } from "react-dom";
|
|
5
|
+
function v(r, l, e) {
|
|
4
6
|
let s = e.initialDeps ?? [], t;
|
|
5
|
-
function
|
|
6
|
-
var
|
|
7
|
-
let
|
|
8
|
-
e.key && ((
|
|
7
|
+
function i() {
|
|
8
|
+
var n, o, h, c;
|
|
9
|
+
let a;
|
|
10
|
+
e.key && ((n = e.debug) != null && n.call(e)) && (a = Date.now());
|
|
9
11
|
const u = r();
|
|
10
|
-
if (!(u.length !== s.length || u.some((
|
|
12
|
+
if (!(u.length !== s.length || u.some((g, m) => s[m] !== g)))
|
|
11
13
|
return t;
|
|
12
14
|
s = u;
|
|
13
|
-
let
|
|
14
|
-
if (e.key && ((o = e.debug) != null && o.call(e)) && (
|
|
15
|
-
const
|
|
16
|
-
for (
|
|
17
|
-
|
|
18
|
-
return
|
|
15
|
+
let d;
|
|
16
|
+
if (e.key && ((o = e.debug) != null && o.call(e)) && (d = Date.now()), t = l(...u), e.key && ((h = e.debug) != null && h.call(e))) {
|
|
17
|
+
const g = Math.round((Date.now() - a) * 100) / 100, m = Math.round((Date.now() - d) * 100) / 100, x = m / 16, b = (p, I) => {
|
|
18
|
+
for (p = String(p); p.length < I; )
|
|
19
|
+
p = " " + p;
|
|
20
|
+
return p;
|
|
19
21
|
};
|
|
20
22
|
console.info(
|
|
21
|
-
`%c⏱ ${b(
|
|
23
|
+
`%c⏱ ${b(m, 5)} /${b(g, 5)} ms`,
|
|
22
24
|
`
|
|
23
25
|
font-size: .6rem;
|
|
24
26
|
font-weight: bold;
|
|
25
27
|
color: hsl(${Math.max(
|
|
26
28
|
0,
|
|
27
|
-
Math.min(120 - 120 *
|
|
29
|
+
Math.min(120 - 120 * x, 120)
|
|
28
30
|
)}deg 100% 31%);`,
|
|
29
31
|
e?.key
|
|
30
32
|
);
|
|
31
33
|
}
|
|
32
34
|
return (c = e?.onChange) == null || c.call(e, t), t;
|
|
33
35
|
}
|
|
34
|
-
return
|
|
35
|
-
s =
|
|
36
|
-
},
|
|
36
|
+
return i.updateDeps = (n) => {
|
|
37
|
+
s = n;
|
|
38
|
+
}, i;
|
|
37
39
|
}
|
|
38
|
-
function
|
|
40
|
+
function y(r, l) {
|
|
39
41
|
if (r === void 0)
|
|
40
42
|
throw new Error("Unexpected undefined");
|
|
41
43
|
return r;
|
|
42
44
|
}
|
|
43
|
-
const
|
|
45
|
+
const D = (r, l) => Math.abs(r - l) <= 1, A = (r, l, e) => {
|
|
44
46
|
let s;
|
|
45
47
|
return function(...t) {
|
|
46
48
|
r.clearTimeout(s), s = r.setTimeout(() => l.apply(this, t), e);
|
|
47
49
|
};
|
|
48
|
-
},
|
|
50
|
+
}, M = (r) => {
|
|
49
51
|
const { offsetWidth: l, offsetHeight: e } = r;
|
|
50
52
|
return { width: l, height: e };
|
|
51
|
-
},
|
|
53
|
+
}, F = (r) => r, k = (r) => {
|
|
52
54
|
const l = Math.max(r.startIndex - r.overscan, 0), e = Math.min(r.endIndex + r.overscan, r.count - 1), s = [];
|
|
53
55
|
for (let t = l; t <= e; t++)
|
|
54
56
|
s.push(t);
|
|
55
57
|
return s;
|
|
56
|
-
},
|
|
58
|
+
}, N = (r, l) => {
|
|
57
59
|
const e = r.scrollElement;
|
|
58
60
|
if (!e)
|
|
59
61
|
return;
|
|
60
62
|
const s = r.targetWindow;
|
|
61
63
|
if (!s)
|
|
62
64
|
return;
|
|
63
|
-
const t = (
|
|
64
|
-
const { width: o, height:
|
|
65
|
-
l({ width: Math.round(o), height: Math.round(
|
|
65
|
+
const t = (n) => {
|
|
66
|
+
const { width: o, height: h } = n;
|
|
67
|
+
l({ width: Math.round(o), height: Math.round(h) });
|
|
66
68
|
};
|
|
67
|
-
if (t(
|
|
69
|
+
if (t(M(e)), !s.ResizeObserver)
|
|
68
70
|
return () => {
|
|
69
71
|
};
|
|
70
|
-
const
|
|
72
|
+
const i = new s.ResizeObserver((n) => {
|
|
71
73
|
const o = () => {
|
|
72
|
-
const
|
|
73
|
-
if (
|
|
74
|
-
const c =
|
|
74
|
+
const h = n[0];
|
|
75
|
+
if (h?.borderBoxSize) {
|
|
76
|
+
const c = h.borderBoxSize[0];
|
|
75
77
|
if (c) {
|
|
76
78
|
t({ width: c.inlineSize, height: c.blockSize });
|
|
77
79
|
return;
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
|
-
t(
|
|
82
|
+
t(M(e));
|
|
81
83
|
};
|
|
82
84
|
r.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(o) : o();
|
|
83
85
|
});
|
|
84
|
-
return
|
|
85
|
-
|
|
86
|
+
return i.observe(e, { box: "border-box" }), () => {
|
|
87
|
+
i.unobserve(e);
|
|
86
88
|
};
|
|
87
|
-
},
|
|
89
|
+
}, S = {
|
|
88
90
|
passive: !0
|
|
89
|
-
},
|
|
91
|
+
}, w = typeof window > "u" ? !0 : "onscrollend" in window, W = (r, l) => {
|
|
90
92
|
const e = r.scrollElement;
|
|
91
93
|
if (!e)
|
|
92
94
|
return;
|
|
@@ -94,23 +96,23 @@ const T = (r, l) => Math.abs(r - l) <= 1, _ = (r, l, e) => {
|
|
|
94
96
|
if (!s)
|
|
95
97
|
return;
|
|
96
98
|
let t = 0;
|
|
97
|
-
const
|
|
98
|
-
} :
|
|
99
|
+
const i = r.options.useScrollendEvent && w ? () => {
|
|
100
|
+
} : A(
|
|
99
101
|
s,
|
|
100
102
|
() => {
|
|
101
103
|
l(t, !1);
|
|
102
104
|
},
|
|
103
105
|
r.options.isScrollingResetDelay
|
|
104
|
-
),
|
|
105
|
-
const { horizontal: u, isRtl:
|
|
106
|
-
t = u ? e.scrollLeft * (
|
|
107
|
-
}, o =
|
|
108
|
-
|
|
109
|
-
const c = r.options.useScrollendEvent &&
|
|
110
|
-
return c && e.addEventListener("scrollend",
|
|
111
|
-
e.removeEventListener("scroll", o), c && e.removeEventListener("scrollend",
|
|
106
|
+
), n = (a) => () => {
|
|
107
|
+
const { horizontal: u, isRtl: f } = r.options;
|
|
108
|
+
t = u ? e.scrollLeft * (f && -1 || 1) : e.scrollTop, i(), l(t, a);
|
|
109
|
+
}, o = n(!0), h = n(!1);
|
|
110
|
+
h(), e.addEventListener("scroll", o, S);
|
|
111
|
+
const c = r.options.useScrollendEvent && w;
|
|
112
|
+
return c && e.addEventListener("scrollend", h, S), () => {
|
|
113
|
+
e.removeEventListener("scroll", o), c && e.removeEventListener("scrollend", h);
|
|
112
114
|
};
|
|
113
|
-
},
|
|
115
|
+
}, V = (r, l, e) => {
|
|
114
116
|
if (l?.borderBoxSize) {
|
|
115
117
|
const s = l.borderBoxSize[0];
|
|
116
118
|
if (s)
|
|
@@ -119,27 +121,27 @@ const T = (r, l) => Math.abs(r - l) <= 1, _ = (r, l, e) => {
|
|
|
119
121
|
);
|
|
120
122
|
}
|
|
121
123
|
return r[e.options.horizontal ? "offsetWidth" : "offsetHeight"];
|
|
122
|
-
},
|
|
124
|
+
}, L = (r, {
|
|
123
125
|
adjustments: l = 0,
|
|
124
126
|
behavior: e
|
|
125
127
|
}, s) => {
|
|
126
|
-
var t,
|
|
127
|
-
const
|
|
128
|
-
(
|
|
129
|
-
[s.options.horizontal ? "left" : "top"]:
|
|
128
|
+
var t, i;
|
|
129
|
+
const n = r + l;
|
|
130
|
+
(i = (t = s.scrollElement) == null ? void 0 : t.scrollTo) == null || i.call(t, {
|
|
131
|
+
[s.options.horizontal ? "left" : "top"]: n,
|
|
130
132
|
behavior: e
|
|
131
133
|
});
|
|
132
134
|
};
|
|
133
|
-
class
|
|
135
|
+
class P {
|
|
134
136
|
constructor(l) {
|
|
135
137
|
this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.scrollToIndexTimeoutId = null, this.measurementsCache = [], this.itemSizeCache = /* @__PURE__ */ new Map(), this.pendingMeasuredCacheIndexes = [], this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this.scrollAdjustments = 0, this.elementsCache = /* @__PURE__ */ new Map(), this.observer = /* @__PURE__ */ (() => {
|
|
136
138
|
let e = null;
|
|
137
139
|
const s = () => e || (!this.targetWindow || !this.targetWindow.ResizeObserver ? null : e = new this.targetWindow.ResizeObserver((t) => {
|
|
138
|
-
t.forEach((
|
|
139
|
-
const
|
|
140
|
-
this._measureElement(
|
|
140
|
+
t.forEach((i) => {
|
|
141
|
+
const n = () => {
|
|
142
|
+
this._measureElement(i.target, i);
|
|
141
143
|
};
|
|
142
|
-
this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(
|
|
144
|
+
this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(n) : n();
|
|
143
145
|
});
|
|
144
146
|
}));
|
|
145
147
|
return {
|
|
@@ -148,12 +150,12 @@ class W {
|
|
|
148
150
|
(t = s()) == null || t.disconnect(), e = null;
|
|
149
151
|
},
|
|
150
152
|
observe: (t) => {
|
|
151
|
-
var
|
|
152
|
-
return (
|
|
153
|
+
var i;
|
|
154
|
+
return (i = s()) == null ? void 0 : i.observe(t, { box: "border-box" });
|
|
153
155
|
},
|
|
154
156
|
unobserve: (t) => {
|
|
155
|
-
var
|
|
156
|
-
return (
|
|
157
|
+
var i;
|
|
158
|
+
return (i = s()) == null ? void 0 : i.unobserve(t);
|
|
157
159
|
}
|
|
158
160
|
};
|
|
159
161
|
})(), this.range = null, this.setOptions = (e) => {
|
|
@@ -168,11 +170,11 @@ class W {
|
|
|
168
170
|
scrollPaddingStart: 0,
|
|
169
171
|
scrollPaddingEnd: 0,
|
|
170
172
|
horizontal: !1,
|
|
171
|
-
getItemKey:
|
|
172
|
-
rangeExtractor:
|
|
173
|
+
getItemKey: F,
|
|
174
|
+
rangeExtractor: k,
|
|
173
175
|
onChange: () => {
|
|
174
176
|
},
|
|
175
|
-
measureElement:
|
|
177
|
+
measureElement: V,
|
|
176
178
|
initialRect: { width: 0, height: 0 },
|
|
177
179
|
scrollMargin: 0,
|
|
178
180
|
gap: 0,
|
|
@@ -189,7 +191,7 @@ class W {
|
|
|
189
191
|
}, this.notify = (e) => {
|
|
190
192
|
var s, t;
|
|
191
193
|
(t = (s = this.options).onChange) == null || t.call(s, this, e);
|
|
192
|
-
}, this.maybeNotify =
|
|
194
|
+
}, this.maybeNotify = v(
|
|
193
195
|
() => (this.calculateRange(), [
|
|
194
196
|
this.isScrolling,
|
|
195
197
|
this.range ? this.range.startIndex : null,
|
|
@@ -229,25 +231,25 @@ class W {
|
|
|
229
231
|
this.scrollRect = t, this.maybeNotify();
|
|
230
232
|
})
|
|
231
233
|
), this.unsubs.push(
|
|
232
|
-
this.options.observeElementOffset(this, (t,
|
|
233
|
-
this.scrollAdjustments = 0, this.scrollDirection =
|
|
234
|
+
this.options.observeElementOffset(this, (t, i) => {
|
|
235
|
+
this.scrollAdjustments = 0, this.scrollDirection = i ? this.getScrollOffset() < t ? "forward" : "backward" : null, this.scrollOffset = t, this.isScrolling = i, this.maybeNotify();
|
|
234
236
|
})
|
|
235
237
|
);
|
|
236
238
|
}
|
|
237
239
|
}, this.getSize = () => this.options.enabled ? (this.scrollRect = this.scrollRect ?? this.options.initialRect, this.scrollRect[this.options.horizontal ? "width" : "height"]) : (this.scrollRect = null, 0), this.getScrollOffset = () => this.options.enabled ? (this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset == "function" ? this.options.initialOffset() : this.options.initialOffset), this.scrollOffset) : (this.scrollOffset = null, 0), this.getFurthestMeasurement = (e, s) => {
|
|
238
|
-
const t = /* @__PURE__ */ new Map(),
|
|
239
|
-
for (let
|
|
240
|
-
const o = e[
|
|
240
|
+
const t = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
241
|
+
for (let n = s - 1; n >= 0; n--) {
|
|
242
|
+
const o = e[n];
|
|
241
243
|
if (t.has(o.lane))
|
|
242
244
|
continue;
|
|
243
|
-
const
|
|
245
|
+
const h = i.get(
|
|
244
246
|
o.lane
|
|
245
247
|
);
|
|
246
|
-
if (
|
|
248
|
+
if (h == null || o.end > h.end ? i.set(o.lane, o) : o.end < h.end && t.set(o.lane, !0), t.size === this.options.lanes)
|
|
247
249
|
break;
|
|
248
250
|
}
|
|
249
|
-
return
|
|
250
|
-
}, this.getMeasurementOptions =
|
|
251
|
+
return i.size === this.options.lanes ? Array.from(i.values()).sort((n, o) => n.end === o.end ? n.index - o.index : n.end - o.end)[0] : void 0;
|
|
252
|
+
}, this.getMeasurementOptions = v(
|
|
251
253
|
() => [
|
|
252
254
|
this.options.count,
|
|
253
255
|
this.options.paddingStart,
|
|
@@ -255,34 +257,34 @@ class W {
|
|
|
255
257
|
this.options.getItemKey,
|
|
256
258
|
this.options.enabled
|
|
257
259
|
],
|
|
258
|
-
(e, s, t,
|
|
260
|
+
(e, s, t, i, n) => (this.pendingMeasuredCacheIndexes = [], {
|
|
259
261
|
count: e,
|
|
260
262
|
paddingStart: s,
|
|
261
263
|
scrollMargin: t,
|
|
262
|
-
getItemKey:
|
|
263
|
-
enabled:
|
|
264
|
+
getItemKey: i,
|
|
265
|
+
enabled: n
|
|
264
266
|
}),
|
|
265
267
|
{
|
|
266
268
|
key: !1
|
|
267
269
|
}
|
|
268
|
-
), this.getMeasurements =
|
|
270
|
+
), this.getMeasurements = v(
|
|
269
271
|
() => [this.getMeasurementOptions(), this.itemSizeCache],
|
|
270
|
-
({ count: e, paddingStart: s, scrollMargin: t, getItemKey:
|
|
271
|
-
if (!
|
|
272
|
+
({ count: e, paddingStart: s, scrollMargin: t, getItemKey: i, enabled: n }, o) => {
|
|
273
|
+
if (!n)
|
|
272
274
|
return this.measurementsCache = [], this.itemSizeCache.clear(), [];
|
|
273
|
-
this.measurementsCache.length === 0 && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((
|
|
274
|
-
this.itemSizeCache.set(
|
|
275
|
+
this.measurementsCache.length === 0 && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((a) => {
|
|
276
|
+
this.itemSizeCache.set(a.key, a.size);
|
|
275
277
|
}));
|
|
276
|
-
const
|
|
278
|
+
const h = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
|
|
277
279
|
this.pendingMeasuredCacheIndexes = [];
|
|
278
|
-
const c = this.measurementsCache.slice(0,
|
|
279
|
-
for (let
|
|
280
|
-
const u =
|
|
281
|
-
c[
|
|
282
|
-
index:
|
|
283
|
-
start:
|
|
284
|
-
size:
|
|
285
|
-
end:
|
|
280
|
+
const c = this.measurementsCache.slice(0, h);
|
|
281
|
+
for (let a = h; a < e; a++) {
|
|
282
|
+
const u = i(a), f = this.options.lanes === 1 ? c[a - 1] : this.getFurthestMeasurement(c, a), d = f ? f.end + this.options.gap : s + t, g = o.get(u), m = typeof g == "number" ? g : this.options.estimateSize(a), x = d + m, b = f ? f.lane : a % this.options.lanes;
|
|
283
|
+
c[a] = {
|
|
284
|
+
index: a,
|
|
285
|
+
start: d,
|
|
286
|
+
size: m,
|
|
287
|
+
end: x,
|
|
286
288
|
key: u,
|
|
287
289
|
lane: b
|
|
288
290
|
};
|
|
@@ -293,24 +295,24 @@ class W {
|
|
|
293
295
|
key: process.env.NODE_ENV !== "production" && "getMeasurements",
|
|
294
296
|
debug: () => this.options.debug
|
|
295
297
|
}
|
|
296
|
-
), this.calculateRange =
|
|
298
|
+
), this.calculateRange = v(
|
|
297
299
|
() => [
|
|
298
300
|
this.getMeasurements(),
|
|
299
301
|
this.getSize(),
|
|
300
302
|
this.getScrollOffset(),
|
|
301
303
|
this.options.lanes
|
|
302
304
|
],
|
|
303
|
-
(e, s, t,
|
|
305
|
+
(e, s, t, i) => this.range = e.length > 0 && s > 0 ? j({
|
|
304
306
|
measurements: e,
|
|
305
307
|
outerSize: s,
|
|
306
308
|
scrollOffset: t,
|
|
307
|
-
lanes:
|
|
309
|
+
lanes: i
|
|
308
310
|
}) : null,
|
|
309
311
|
{
|
|
310
312
|
key: process.env.NODE_ENV !== "production" && "calculateRange",
|
|
311
313
|
debug: () => this.options.debug
|
|
312
314
|
}
|
|
313
|
-
), this.getVirtualIndexes =
|
|
315
|
+
), this.getVirtualIndexes = v(
|
|
314
316
|
() => {
|
|
315
317
|
let e = null, s = null;
|
|
316
318
|
const t = this.calculateRange();
|
|
@@ -322,9 +324,9 @@ class W {
|
|
|
322
324
|
s
|
|
323
325
|
];
|
|
324
326
|
},
|
|
325
|
-
(e, s, t,
|
|
326
|
-
startIndex:
|
|
327
|
-
endIndex:
|
|
327
|
+
(e, s, t, i, n) => i === null || n === null ? [] : e({
|
|
328
|
+
startIndex: i,
|
|
329
|
+
endIndex: n,
|
|
328
330
|
overscan: s,
|
|
329
331
|
count: t
|
|
330
332
|
}),
|
|
@@ -338,18 +340,18 @@ class W {
|
|
|
338
340
|
`Missing attribute name '${s}={index}' on measured element.`
|
|
339
341
|
), -1);
|
|
340
342
|
}, this._measureElement = (e, s) => {
|
|
341
|
-
const t = this.indexFromElement(e),
|
|
342
|
-
if (!
|
|
343
|
+
const t = this.indexFromElement(e), i = this.measurementsCache[t];
|
|
344
|
+
if (!i)
|
|
343
345
|
return;
|
|
344
|
-
const
|
|
345
|
-
o !== e && (o && this.observer.unobserve(o), this.observer.observe(e), this.elementsCache.set(
|
|
346
|
+
const n = i.key, o = this.elementsCache.get(n);
|
|
347
|
+
o !== e && (o && this.observer.unobserve(o), this.observer.observe(e), this.elementsCache.set(n, e)), e.isConnected && this.resizeItem(t, this.options.measureElement(e, s, this));
|
|
346
348
|
}, this.resizeItem = (e, s) => {
|
|
347
349
|
const t = this.measurementsCache[e];
|
|
348
350
|
if (!t)
|
|
349
351
|
return;
|
|
350
|
-
const
|
|
351
|
-
|
|
352
|
-
adjustments: this.scrollAdjustments +=
|
|
352
|
+
const i = this.itemSizeCache.get(t.key) ?? t.size, n = s - i;
|
|
353
|
+
n !== 0 && ((this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(t, n, this) : t.start < this.getScrollOffset() + this.scrollAdjustments) && (process.env.NODE_ENV !== "production" && this.options.debug && console.info("correction", n), this._scrollToOffset(this.getScrollOffset(), {
|
|
354
|
+
adjustments: this.scrollAdjustments += n,
|
|
353
355
|
behavior: void 0
|
|
354
356
|
})), this.pendingMeasuredCacheIndexes.push(t.index), this.itemSizeCache = new Map(this.itemSizeCache.set(t.key, s)), this.notify(!1));
|
|
355
357
|
}, this.measureElement = (e) => {
|
|
@@ -360,13 +362,13 @@ class W {
|
|
|
360
362
|
return;
|
|
361
363
|
}
|
|
362
364
|
this._measureElement(e, void 0);
|
|
363
|
-
}, this.getVirtualItems =
|
|
365
|
+
}, this.getVirtualItems = v(
|
|
364
366
|
() => [this.getVirtualIndexes(), this.getMeasurements()],
|
|
365
367
|
(e, s) => {
|
|
366
368
|
const t = [];
|
|
367
|
-
for (let
|
|
368
|
-
const o = e[
|
|
369
|
-
t.push(
|
|
369
|
+
for (let i = 0, n = e.length; i < n; i++) {
|
|
370
|
+
const o = e[i], h = s[o];
|
|
371
|
+
t.push(h);
|
|
370
372
|
}
|
|
371
373
|
return t;
|
|
372
374
|
},
|
|
@@ -377,32 +379,32 @@ class W {
|
|
|
377
379
|
), this.getVirtualItemForOffset = (e) => {
|
|
378
380
|
const s = this.getMeasurements();
|
|
379
381
|
if (s.length !== 0)
|
|
380
|
-
return
|
|
381
|
-
s[
|
|
382
|
+
return y(
|
|
383
|
+
s[O(
|
|
382
384
|
0,
|
|
383
385
|
s.length - 1,
|
|
384
|
-
(t) =>
|
|
386
|
+
(t) => y(s[t]).start,
|
|
385
387
|
e
|
|
386
388
|
)]
|
|
387
389
|
);
|
|
388
390
|
}, this.getOffsetForAlignment = (e, s, t = 0) => {
|
|
389
|
-
const
|
|
390
|
-
s === "auto" && (s = e >=
|
|
391
|
-
const o = this.getTotalSize() -
|
|
391
|
+
const i = this.getSize(), n = this.getScrollOffset();
|
|
392
|
+
s === "auto" && (s = e >= n + i ? "end" : "start"), s === "center" ? e += (t - i) / 2 : s === "end" && (e -= i);
|
|
393
|
+
const o = this.getTotalSize() - i;
|
|
392
394
|
return Math.max(Math.min(o, e), 0);
|
|
393
395
|
}, this.getOffsetForIndex = (e, s = "auto") => {
|
|
394
396
|
e = Math.max(0, Math.min(e, this.options.count - 1));
|
|
395
397
|
const t = this.measurementsCache[e];
|
|
396
398
|
if (!t)
|
|
397
399
|
return;
|
|
398
|
-
const
|
|
400
|
+
const i = this.getSize(), n = this.getScrollOffset();
|
|
399
401
|
if (s === "auto")
|
|
400
|
-
if (t.end >=
|
|
402
|
+
if (t.end >= n + i - this.options.scrollPaddingEnd)
|
|
401
403
|
s = "end";
|
|
402
|
-
else if (t.start <=
|
|
404
|
+
else if (t.start <= n + this.options.scrollPaddingStart)
|
|
403
405
|
s = "start";
|
|
404
406
|
else
|
|
405
|
-
return [
|
|
407
|
+
return [n, s];
|
|
406
408
|
const o = s === "end" ? t.end + this.options.scrollPaddingEnd : t.start - this.options.scrollPaddingStart;
|
|
407
409
|
return [
|
|
408
410
|
this.getOffsetForAlignment(o, s, t.size),
|
|
@@ -421,17 +423,17 @@ class W {
|
|
|
421
423
|
e = Math.max(0, Math.min(e, this.options.count - 1)), this.cancelScrollToIndex(), t === "smooth" && this.isDynamicMode() && console.warn(
|
|
422
424
|
"The `smooth` scroll behavior is not fully supported with dynamic size."
|
|
423
425
|
);
|
|
424
|
-
const
|
|
425
|
-
if (!
|
|
426
|
-
const [
|
|
427
|
-
this._scrollToOffset(
|
|
426
|
+
const i = this.getOffsetForIndex(e, s);
|
|
427
|
+
if (!i) return;
|
|
428
|
+
const [n, o] = i;
|
|
429
|
+
this._scrollToOffset(n, { adjustments: void 0, behavior: t }), t !== "smooth" && this.isDynamicMode() && this.targetWindow && (this.scrollToIndexTimeoutId = this.targetWindow.setTimeout(() => {
|
|
428
430
|
if (this.scrollToIndexTimeoutId = null, this.elementsCache.has(
|
|
429
431
|
this.options.getItemKey(e)
|
|
430
432
|
)) {
|
|
431
433
|
const c = this.getOffsetForIndex(e, o);
|
|
432
434
|
if (!c) return;
|
|
433
|
-
const [
|
|
434
|
-
|
|
435
|
+
const [a] = c, u = this.getScrollOffset();
|
|
436
|
+
D(a, u) || this.scrollToIndex(e, { align: o, behavior: t });
|
|
435
437
|
} else
|
|
436
438
|
this.scrollToIndex(e, { align: o, behavior: t });
|
|
437
439
|
}));
|
|
@@ -451,13 +453,13 @@ class W {
|
|
|
451
453
|
else if (this.options.lanes === 1)
|
|
452
454
|
t = ((e = s[s.length - 1]) == null ? void 0 : e.end) ?? 0;
|
|
453
455
|
else {
|
|
454
|
-
const
|
|
455
|
-
let
|
|
456
|
-
for (;
|
|
457
|
-
const o = s[
|
|
458
|
-
|
|
456
|
+
const i = Array(this.options.lanes).fill(null);
|
|
457
|
+
let n = s.length - 1;
|
|
458
|
+
for (; n >= 0 && i.some((o) => o === null); ) {
|
|
459
|
+
const o = s[n];
|
|
460
|
+
i[o.lane] === null && (i[o.lane] = o.end), n--;
|
|
459
461
|
}
|
|
460
|
-
t = Math.max(...
|
|
462
|
+
t = Math.max(...i.filter((o) => o !== null));
|
|
461
463
|
}
|
|
462
464
|
return Math.max(
|
|
463
465
|
t - this.options.scrollMargin + this.options.paddingEnd,
|
|
@@ -473,75 +475,124 @@ class W {
|
|
|
473
475
|
}, this.setOptions(l);
|
|
474
476
|
}
|
|
475
477
|
}
|
|
476
|
-
const
|
|
478
|
+
const O = (r, l, e, s) => {
|
|
477
479
|
for (; r <= l; ) {
|
|
478
|
-
const t = (r + l) / 2 | 0,
|
|
479
|
-
if (
|
|
480
|
+
const t = (r + l) / 2 | 0, i = e(t);
|
|
481
|
+
if (i < s)
|
|
480
482
|
r = t + 1;
|
|
481
|
-
else if (
|
|
483
|
+
else if (i > s)
|
|
482
484
|
l = t - 1;
|
|
483
485
|
else
|
|
484
486
|
return t;
|
|
485
487
|
}
|
|
486
488
|
return r > 0 ? r - 1 : 0;
|
|
487
489
|
};
|
|
488
|
-
function
|
|
490
|
+
function j({
|
|
489
491
|
measurements: r,
|
|
490
492
|
outerSize: l,
|
|
491
493
|
scrollOffset: e,
|
|
492
494
|
lanes: s
|
|
493
495
|
}) {
|
|
494
|
-
const t = r.length - 1,
|
|
496
|
+
const t = r.length - 1, i = (h) => r[h].start;
|
|
495
497
|
if (r.length <= s)
|
|
496
498
|
return {
|
|
497
499
|
startIndex: 0,
|
|
498
500
|
endIndex: t
|
|
499
501
|
};
|
|
500
|
-
let
|
|
502
|
+
let n = O(
|
|
501
503
|
0,
|
|
502
504
|
t,
|
|
503
|
-
|
|
505
|
+
i,
|
|
504
506
|
e
|
|
505
|
-
), o =
|
|
507
|
+
), o = n;
|
|
506
508
|
if (s === 1)
|
|
507
509
|
for (; o < t && r[o].end < e + l; )
|
|
508
510
|
o++;
|
|
509
511
|
else if (s > 1) {
|
|
510
|
-
const
|
|
511
|
-
for (; o < t &&
|
|
512
|
-
const
|
|
513
|
-
a
|
|
512
|
+
const h = Array(s).fill(0);
|
|
513
|
+
for (; o < t && h.some((a) => a < e + l); ) {
|
|
514
|
+
const a = r[o];
|
|
515
|
+
h[a.lane] = a.end, o++;
|
|
514
516
|
}
|
|
515
517
|
const c = Array(s).fill(e + l);
|
|
516
|
-
for (;
|
|
517
|
-
const
|
|
518
|
-
c[
|
|
518
|
+
for (; n >= 0 && c.some((a) => a >= e); ) {
|
|
519
|
+
const a = r[n];
|
|
520
|
+
c[a.lane] = a.start, n--;
|
|
519
521
|
}
|
|
520
|
-
|
|
522
|
+
n = Math.max(0, n - n % s), o = Math.min(t, o + (s - 1 - o % s));
|
|
521
523
|
}
|
|
522
|
-
return { startIndex:
|
|
524
|
+
return { startIndex: n, endIndex: o };
|
|
523
525
|
}
|
|
524
|
-
const
|
|
525
|
-
function
|
|
526
|
-
const l =
|
|
526
|
+
const z = typeof document < "u" ? E.useLayoutEffect : E.useEffect;
|
|
527
|
+
function B(r) {
|
|
528
|
+
const l = E.useReducer(() => ({}), {})[1], e = {
|
|
527
529
|
...r,
|
|
528
|
-
onChange: (t,
|
|
529
|
-
var
|
|
530
|
-
|
|
530
|
+
onChange: (t, i) => {
|
|
531
|
+
var n;
|
|
532
|
+
i ? R(l) : l(), (n = r.onChange) == null || n.call(r, t, i);
|
|
531
533
|
}
|
|
532
|
-
}, [s] =
|
|
533
|
-
() => new
|
|
534
|
+
}, [s] = E.useState(
|
|
535
|
+
() => new P(e)
|
|
534
536
|
);
|
|
535
|
-
return s.setOptions(e),
|
|
537
|
+
return s.setOptions(e), z(() => s._didMount(), []), z(() => s._willUpdate()), s;
|
|
536
538
|
}
|
|
537
|
-
function
|
|
538
|
-
return
|
|
539
|
-
observeElementRect:
|
|
540
|
-
observeElementOffset:
|
|
541
|
-
scrollToFn:
|
|
539
|
+
function H(r) {
|
|
540
|
+
return B({
|
|
541
|
+
observeElementRect: N,
|
|
542
|
+
observeElementOffset: W,
|
|
543
|
+
scrollToFn: L,
|
|
542
544
|
...r
|
|
543
545
|
});
|
|
544
546
|
}
|
|
547
|
+
const U = ({
|
|
548
|
+
menu: r,
|
|
549
|
+
scrollRef: l
|
|
550
|
+
}) => {
|
|
551
|
+
const [e, s] = C(400);
|
|
552
|
+
T(() => {
|
|
553
|
+
const n = l.current;
|
|
554
|
+
if (!n) return;
|
|
555
|
+
const o = () => {
|
|
556
|
+
const c = n.getBoundingClientRect().top || 0, a = Math.max(300, window.innerHeight - c - 8);
|
|
557
|
+
s((u) => u === a ? u : a);
|
|
558
|
+
};
|
|
559
|
+
o(), window.addEventListener("resize", o);
|
|
560
|
+
const h = new ResizeObserver(() => o());
|
|
561
|
+
return h.observe(document.body), () => {
|
|
562
|
+
window.removeEventListener("resize", o), h.disconnect();
|
|
563
|
+
};
|
|
564
|
+
}, [l]);
|
|
565
|
+
const t = _(() => r.flatMap((n, o) => {
|
|
566
|
+
const h = n?.items?.filter((d) => !d.props?.hidden) || [], c = n?.props || {}, { title: a, hidden: u = !1, divider: f = !0 } = c;
|
|
567
|
+
return u ? [] : h.length === 0 && !a ? [] : [
|
|
568
|
+
...o > 0 && f ? [{ type: "divider" }] : [],
|
|
569
|
+
...a ? [{ type: "header", title: a }] : [],
|
|
570
|
+
...h.map((d) => ({
|
|
571
|
+
type: "item",
|
|
572
|
+
itemProps: d.props || {},
|
|
573
|
+
active: d.active
|
|
574
|
+
}))
|
|
575
|
+
];
|
|
576
|
+
}), [r]), i = H({
|
|
577
|
+
count: t.length,
|
|
578
|
+
getScrollElement: () => l.current,
|
|
579
|
+
useAnimationFrameWithResizeObserver: !0,
|
|
580
|
+
estimateSize: (n) => {
|
|
581
|
+
switch (t[n]?.type) {
|
|
582
|
+
case "divider":
|
|
583
|
+
return 9;
|
|
584
|
+
case "header":
|
|
585
|
+
return 36;
|
|
586
|
+
default:
|
|
587
|
+
return 44;
|
|
588
|
+
}
|
|
589
|
+
},
|
|
590
|
+
gap: 0,
|
|
591
|
+
paddingEnd: -8
|
|
592
|
+
});
|
|
593
|
+
return { flatMenu: t, virtualizer: i, scrollMaxHeight: e };
|
|
594
|
+
};
|
|
545
595
|
export {
|
|
546
|
-
|
|
596
|
+
H as a,
|
|
597
|
+
U as u
|
|
547
598
|
};
|