@cloudflare/kumo 2.13.1 → 2.13.2
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/CHANGELOG.md +6 -0
- package/dist/.build-complete +1 -1
- package/dist/chunks/{sidebar-ob6c9b8fq0hx7uke.js → sidebar-icky50wdc2b1biw8.js} +14 -2
- package/dist/components/sidebar.d.ts +1 -1
- package/dist/components/sidebar.js +1 -1
- package/dist/{index-CMiftS8L2.d.ts → index-BcRyiNd72.d.ts} +5 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/.build-complete
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
1788876240364
|
|
@@ -176,7 +176,8 @@ function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange: set
|
|
|
176
176
|
if (!viewport) return;
|
|
177
177
|
const targetRect = target.getBoundingClientRect();
|
|
178
178
|
const viewportRect = viewport.getBoundingClientRect();
|
|
179
|
-
const
|
|
179
|
+
const viewportScaleY = viewport.offsetHeight > 0 && viewportRect.height > 0 ? viewportRect.height / viewport.offsetHeight : 1;
|
|
180
|
+
const itemScrollOffset = (targetRect.top - viewportRect.top) / viewportScaleY + viewport.scrollTop;
|
|
180
181
|
let desired;
|
|
181
182
|
if (align === "center") desired = itemScrollOffset - (viewport.clientHeight - target.offsetHeight) / 2;
|
|
182
183
|
else if (align === "end") desired = itemScrollOffset - (viewport.clientHeight - target.offsetHeight);
|
|
@@ -194,6 +195,16 @@ function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange: set
|
|
|
194
195
|
behavior: reducedMotion ? "auto" : behavior
|
|
195
196
|
});
|
|
196
197
|
}, []);
|
|
198
|
+
const scrollItemIntoView = useCallback((id, options = {}) => {
|
|
199
|
+
const target = itemsRef.current.get(id);
|
|
200
|
+
if (!target) return;
|
|
201
|
+
const viewport = target.closest("[data-sidebar=\"viewport\"]");
|
|
202
|
+
if (!viewport) return;
|
|
203
|
+
const targetRect = target.getBoundingClientRect();
|
|
204
|
+
const viewportRect = viewport.getBoundingClientRect();
|
|
205
|
+
if (targetRect.top >= viewportRect.top && targetRect.bottom <= viewportRect.bottom) return;
|
|
206
|
+
scrollToItem(id, options);
|
|
207
|
+
}, [scrollToItem]);
|
|
197
208
|
const contextValue = useMemo(() => ({
|
|
198
209
|
state,
|
|
199
210
|
open,
|
|
@@ -219,7 +230,8 @@ function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange: set
|
|
|
219
230
|
contained,
|
|
220
231
|
animationDuration,
|
|
221
232
|
registerItem,
|
|
222
|
-
scrollToItem
|
|
233
|
+
scrollToItem,
|
|
234
|
+
scrollItemIntoView
|
|
223
235
|
}), [
|
|
224
236
|
state,
|
|
225
237
|
open,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as SidebarProviderProps, B as SidebarSlidingViewProps, C as SidebarMenuItem, D as SidebarMenuSubButtonProps, E as SidebarMenuSubButton, F as SidebarScrollAlign, G as SidebarVariant, H as SidebarSlidingViewsProps, I as SidebarScrollToItemOptions, K as useSidebar, L as SidebarSeparator, M as SidebarResizeHandle, N as SidebarRoot, O as SidebarMenuSubItem, P as SidebarRootProps, R as SidebarSide, S as SidebarMenuChevron, T as SidebarMenuSub, U as SidebarState, V as SidebarSlidingViews, W as SidebarTrigger, _ as SidebarMenu, a as SidebarCollapsible, b as SidebarMenuButtonProps, c as SidebarCollapsibleTrigger, d as SidebarContextValue, f as SidebarFooter, g as SidebarLoading, h as SidebarHeader, i as Sidebar, j as SidebarRail, k as SidebarProvider, l as SidebarCollapsibleTriggerProps, m as SidebarGroupLabel, n as KUMO_SIDEBAR_STYLING, o as SidebarCollapsibleContent, p as SidebarGroup, r as KUMO_SIDEBAR_VARIANTS, s as SidebarCollapsibleProps, t as KUMO_SIDEBAR_DEFAULT_VARIANTS, u as SidebarContent, v as SidebarMenuBadge, w as SidebarMenuItemProps, x as SidebarMenuButtonSize, y as SidebarMenuButton, z as SidebarSlidingView } from "../index-
|
|
1
|
+
import { A as SidebarProviderProps, B as SidebarSlidingViewProps, C as SidebarMenuItem, D as SidebarMenuSubButtonProps, E as SidebarMenuSubButton, F as SidebarScrollAlign, G as SidebarVariant, H as SidebarSlidingViewsProps, I as SidebarScrollToItemOptions, K as useSidebar, L as SidebarSeparator, M as SidebarResizeHandle, N as SidebarRoot, O as SidebarMenuSubItem, P as SidebarRootProps, R as SidebarSide, S as SidebarMenuChevron, T as SidebarMenuSub, U as SidebarState, V as SidebarSlidingViews, W as SidebarTrigger, _ as SidebarMenu, a as SidebarCollapsible, b as SidebarMenuButtonProps, c as SidebarCollapsibleTrigger, d as SidebarContextValue, f as SidebarFooter, g as SidebarLoading, h as SidebarHeader, i as Sidebar, j as SidebarRail, k as SidebarProvider, l as SidebarCollapsibleTriggerProps, m as SidebarGroupLabel, n as KUMO_SIDEBAR_STYLING, o as SidebarCollapsibleContent, p as SidebarGroup, r as KUMO_SIDEBAR_VARIANTS, s as SidebarCollapsibleProps, t as KUMO_SIDEBAR_DEFAULT_VARIANTS, u as SidebarContent, v as SidebarMenuBadge, w as SidebarMenuItemProps, x as SidebarMenuButtonSize, y as SidebarMenuButton, z as SidebarSlidingView } from "../index-BcRyiNd72.js";
|
|
2
2
|
export { KUMO_SIDEBAR_DEFAULT_VARIANTS, KUMO_SIDEBAR_STYLING, KUMO_SIDEBAR_VARIANTS, Sidebar, SidebarCollapsible, type SidebarCollapsible as SidebarCollapsibleType, SidebarCollapsibleContent, type SidebarCollapsibleProps, SidebarCollapsibleTrigger, type SidebarCollapsibleTriggerProps, SidebarContent, type SidebarContextValue, SidebarFooter, SidebarGroup, SidebarGroupLabel, SidebarHeader, SidebarLoading, SidebarMenu, SidebarMenuBadge, SidebarMenuButton, type SidebarMenuButtonProps, type SidebarMenuButtonSize, SidebarMenuChevron, SidebarMenuItem, type SidebarMenuItemProps, SidebarMenuSub, SidebarMenuSubButton, type SidebarMenuSubButtonProps, SidebarMenuSubItem, SidebarProvider, type SidebarProviderProps, SidebarRail, SidebarResizeHandle, SidebarRoot, type SidebarRootProps, type SidebarScrollAlign, type SidebarScrollToItemOptions, SidebarSeparator, type SidebarSide, SidebarSlidingView, type SidebarSlidingViewProps, SidebarSlidingViews, type SidebarSlidingViewsProps, type SidebarState, SidebarTrigger, type SidebarVariant, useSidebar };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { A as useSidebar, C as SidebarRail, D as SidebarSlidingView, E as SidebarSeparator, O as SidebarSlidingViews, S as SidebarProvider, T as SidebarRoot, _ as SidebarMenuChevron, a as SidebarCollapsible, b as SidebarMenuSubButton, c as SidebarContent, d as SidebarGroupLabel, f as SidebarHeader, g as SidebarMenuButton, h as SidebarMenuBadge, i as Sidebar, k as SidebarTrigger, l as SidebarFooter, m as SidebarMenu, n as KUMO_SIDEBAR_STYLING, o as SidebarCollapsibleContent, p as SidebarLoading, r as KUMO_SIDEBAR_VARIANTS, s as SidebarCollapsibleTrigger, t as KUMO_SIDEBAR_DEFAULT_VARIANTS, u as SidebarGroup, v as SidebarMenuItem, w as SidebarResizeHandle, x as SidebarMenuSubItem, y as SidebarMenuSub } from "../chunks/sidebar-
|
|
2
|
+
import { A as useSidebar, C as SidebarRail, D as SidebarSlidingView, E as SidebarSeparator, O as SidebarSlidingViews, S as SidebarProvider, T as SidebarRoot, _ as SidebarMenuChevron, a as SidebarCollapsible, b as SidebarMenuSubButton, c as SidebarContent, d as SidebarGroupLabel, f as SidebarHeader, g as SidebarMenuButton, h as SidebarMenuBadge, i as Sidebar, k as SidebarTrigger, l as SidebarFooter, m as SidebarMenu, n as KUMO_SIDEBAR_STYLING, o as SidebarCollapsibleContent, p as SidebarLoading, r as KUMO_SIDEBAR_VARIANTS, s as SidebarCollapsibleTrigger, t as KUMO_SIDEBAR_DEFAULT_VARIANTS, u as SidebarGroup, v as SidebarMenuItem, w as SidebarResizeHandle, x as SidebarMenuSubItem, y as SidebarMenuSub } from "../chunks/sidebar-icky50wdc2b1biw8.js";
|
|
3
3
|
export { KUMO_SIDEBAR_DEFAULT_VARIANTS, KUMO_SIDEBAR_STYLING, KUMO_SIDEBAR_VARIANTS, Sidebar, SidebarCollapsible, SidebarCollapsibleContent, SidebarCollapsibleTrigger, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupLabel, SidebarHeader, SidebarLoading, SidebarMenu, SidebarMenuBadge, SidebarMenuButton, SidebarMenuChevron, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarResizeHandle, SidebarRoot, SidebarSeparator, SidebarSlidingView, SidebarSlidingViews, SidebarTrigger, useSidebar };
|
|
@@ -99,6 +99,11 @@ interface SidebarContextValue {
|
|
|
99
99
|
* @param options.behavior — `"auto"` for instant, `"smooth"` for animated (default `"auto"`)
|
|
100
100
|
*/
|
|
101
101
|
scrollToItem: (id: string, options?: SidebarScrollToItemOptions) => void;
|
|
102
|
+
/**
|
|
103
|
+
* Scroll a tagged nav item only when it is outside its sidebar viewport.
|
|
104
|
+
* Explicit alignment controls where an offscreen item lands.
|
|
105
|
+
*/
|
|
106
|
+
scrollItemIntoView: (id: string, options?: SidebarScrollToItemOptions) => void;
|
|
102
107
|
}
|
|
103
108
|
/**
|
|
104
109
|
* Vertical alignment of the target item within the sidebar viewport.
|
package/dist/index.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ import { _ as PopoverTriggerProps, a as Popover, d as PopoverDescriptionProps, h
|
|
|
41
41
|
import { a as KumoRadioVariantsProps, c as RadioGroup, d as RadioItemProps, f as RadioLegendProps, i as KumoRadioVariant, l as RadioGroupChangeEventDetails, m as radioVariants, n as KUMO_RADIO_VARIANTS, o as Radio, p as RadioVariant, r as KumoRadioAppearance, s as RadioControlPosition, t as KUMO_RADIO_DEFAULT_VARIANTS, u as RadioGroupProps } from "./index-bAud6rG22.js";
|
|
42
42
|
import { t as Select } from "./index-D97n4Bpf2.js";
|
|
43
43
|
import { i as SensitiveInputProps, n as KUMO_SENSITIVE_INPUT_VARIANTS, r as SensitiveInput, t as KUMO_SENSITIVE_INPUT_DEFAULT_VARIANTS } from "./index-D2Gvly0i2.js";
|
|
44
|
-
import { A as SidebarProviderProps, C as SidebarMenuItem, D as SidebarMenuSubButtonProps, E as SidebarMenuSubButton, F as SidebarScrollAlign, G as SidebarVariant, I as SidebarScrollToItemOptions, K as useSidebar, L as SidebarSeparator, M as SidebarResizeHandle, N as SidebarRoot, O as SidebarMenuSubItem, P as SidebarRootProps, R as SidebarSide, S as SidebarMenuChevron, T as SidebarMenuSub, U as SidebarState, V as SidebarSlidingViews, W as SidebarTrigger, _ as SidebarMenu, a as SidebarCollapsible, b as SidebarMenuButtonProps, c as SidebarCollapsibleTrigger, d as SidebarContextValue, f as SidebarFooter, g as SidebarLoading, h as SidebarHeader, i as Sidebar, j as SidebarRail, k as SidebarProvider, m as SidebarGroupLabel, n as KUMO_SIDEBAR_STYLING, o as SidebarCollapsibleContent, p as SidebarGroup, r as KUMO_SIDEBAR_VARIANTS, t as KUMO_SIDEBAR_DEFAULT_VARIANTS, u as SidebarContent, v as SidebarMenuBadge, w as SidebarMenuItemProps, x as SidebarMenuButtonSize, y as SidebarMenuButton, z as SidebarSlidingView } from "./index-
|
|
44
|
+
import { A as SidebarProviderProps, C as SidebarMenuItem, D as SidebarMenuSubButtonProps, E as SidebarMenuSubButton, F as SidebarScrollAlign, G as SidebarVariant, I as SidebarScrollToItemOptions, K as useSidebar, L as SidebarSeparator, M as SidebarResizeHandle, N as SidebarRoot, O as SidebarMenuSubItem, P as SidebarRootProps, R as SidebarSide, S as SidebarMenuChevron, T as SidebarMenuSub, U as SidebarState, V as SidebarSlidingViews, W as SidebarTrigger, _ as SidebarMenu, a as SidebarCollapsible, b as SidebarMenuButtonProps, c as SidebarCollapsibleTrigger, d as SidebarContextValue, f as SidebarFooter, g as SidebarLoading, h as SidebarHeader, i as Sidebar, j as SidebarRail, k as SidebarProvider, m as SidebarGroupLabel, n as KUMO_SIDEBAR_STYLING, o as SidebarCollapsibleContent, p as SidebarGroup, r as KUMO_SIDEBAR_VARIANTS, t as KUMO_SIDEBAR_DEFAULT_VARIANTS, u as SidebarContent, v as SidebarMenuBadge, w as SidebarMenuItemProps, x as SidebarMenuButtonSize, y as SidebarMenuButton, z as SidebarSlidingView } from "./index-BcRyiNd72.js";
|
|
45
45
|
import { t as Surface } from "./index-CzIWigmH.js";
|
|
46
46
|
import { a as Switch, c as SwitchLegendProps } from "./index-AMEc1MEg2.js";
|
|
47
47
|
import { a as KUMO_TABLE_OF_CONTENTS_VARIANTS, c as TableOfContentsGroupProps, d as TableOfContentsProps, f as TableOfContentsTitleProps, i as KUMO_TABLE_OF_CONTENTS_DEFAULT_VARIANTS, l as TableOfContentsItemProps, n as UseTableOfContentsActiveIdResult, o as KumoTableOfContentsState, r as useTableOfContentsActiveId, s as TableOfContents, t as UseTableOfContentsActiveIdOptions, u as TableOfContentsListProps } from "./index-DIV3riUd2.js";
|
package/dist/index.js
CHANGED
|
@@ -50,7 +50,7 @@ import { t as DatePicker } from "./chunks/date-picker-fwe3vllwco4u1utz.js";
|
|
|
50
50
|
import { t as Flow } from "./chunks/flow-fmfb3ri8cxo7w9ci.js";
|
|
51
51
|
import { a as TimeseriesChart, i as ChartLegend, n as ChoroplethMap, o as Chart, r as SankeyChart, s as ChartPalette, t as BubbleMap } from "./chunks/chart-qmls2klknm1pd6hs.js";
|
|
52
52
|
import { i as autocompleteVariants, n as KUMO_AUTOCOMPLETE_DEFAULT_VARIANTS, r as KUMO_AUTOCOMPLETE_VARIANTS, t as Autocomplete } from "./chunks/autocomplete-dn6g4rc8bktdl4an.js";
|
|
53
|
-
import { A as useSidebar, C as SidebarRail, D as SidebarSlidingView, E as SidebarSeparator, O as SidebarSlidingViews, S as SidebarProvider, T as SidebarRoot, _ as SidebarMenuChevron, a as SidebarCollapsible, b as SidebarMenuSubButton, c as SidebarContent, d as SidebarGroupLabel, f as SidebarHeader, g as SidebarMenuButton, h as SidebarMenuBadge, i as Sidebar, k as SidebarTrigger, l as SidebarFooter, m as SidebarMenu, n as KUMO_SIDEBAR_STYLING, o as SidebarCollapsibleContent, p as SidebarLoading, r as KUMO_SIDEBAR_VARIANTS, s as SidebarCollapsibleTrigger, t as KUMO_SIDEBAR_DEFAULT_VARIANTS, u as SidebarGroup, v as SidebarMenuItem, w as SidebarResizeHandle, x as SidebarMenuSubItem, y as SidebarMenuSub } from "./chunks/sidebar-
|
|
53
|
+
import { A as useSidebar, C as SidebarRail, D as SidebarSlidingView, E as SidebarSeparator, O as SidebarSlidingViews, S as SidebarProvider, T as SidebarRoot, _ as SidebarMenuChevron, a as SidebarCollapsible, b as SidebarMenuSubButton, c as SidebarContent, d as SidebarGroupLabel, f as SidebarHeader, g as SidebarMenuButton, h as SidebarMenuBadge, i as Sidebar, k as SidebarTrigger, l as SidebarFooter, m as SidebarMenu, n as KUMO_SIDEBAR_STYLING, o as SidebarCollapsibleContent, p as SidebarLoading, r as KUMO_SIDEBAR_VARIANTS, s as SidebarCollapsibleTrigger, t as KUMO_SIDEBAR_DEFAULT_VARIANTS, u as SidebarGroup, v as SidebarMenuItem, w as SidebarResizeHandle, x as SidebarMenuSubItem, y as SidebarMenuSub } from "./chunks/sidebar-icky50wdc2b1biw8.js";
|
|
54
54
|
import { i as TableOfContents, n as KUMO_TABLE_OF_CONTENTS_DEFAULT_VARIANTS, r as KUMO_TABLE_OF_CONTENTS_VARIANTS, t as useTableOfContentsActiveId } from "./chunks/table-of-contents-cvduqgssxdcbpagh.js";
|
|
55
55
|
import { useCallback, useEffect, useState } from "react";
|
|
56
56
|
import { jsx, jsxs } from "react/jsx-runtime";
|