haze-ui 1.34.0 → 1.35.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.
Files changed (99) hide show
  1. package/README.md +26 -0
  2. package/dist/THIRD-PARTY-NOTICES.md +2 -1
  3. package/dist/components/Anchor/Anchor.js +84 -65
  4. package/dist/components/BackToTop/BackToTop.js +18 -12
  5. package/dist/components/Combobox/Combobox.js +109 -99
  6. package/dist/components/CopyButton/CopyButton.js +13 -12
  7. package/dist/components/DataTable/DataTable.js +16 -16
  8. package/dist/components/FloatButton/FloatButton.js +11 -19
  9. package/dist/components/FollowUpSuggestions/FollowUpSuggestions.js +45 -0
  10. package/dist/components/FollowUpSuggestions/index.js +3 -0
  11. package/dist/components/LocaleProvider/ar-sa.js +9 -0
  12. package/dist/components/LocaleProvider/de-de.js +9 -0
  13. package/dist/components/LocaleProvider/es-es.js +9 -0
  14. package/dist/components/LocaleProvider/fr-fr.js +9 -0
  15. package/dist/components/LocaleProvider/it-it.js +9 -0
  16. package/dist/components/LocaleProvider/ja-jp.js +9 -0
  17. package/dist/components/LocaleProvider/ko-kr.js +9 -0
  18. package/dist/components/LocaleProvider/locale.js +9 -0
  19. package/dist/components/LocaleProvider/pt-br.js +9 -0
  20. package/dist/components/LocaleProvider/ru-ru.js +9 -0
  21. package/dist/components/LocaleProvider/zh-cn.js +9 -0
  22. package/dist/components/NavigationBar/NavLink.js +15 -16
  23. package/dist/components/NotificationCenter/NotificationCenter.js +294 -0
  24. package/dist/components/NotificationCenter/index.js +3 -0
  25. package/dist/components/Tabs/Tab.js +58 -50
  26. package/dist/components/TaskList/TaskList.js +96 -0
  27. package/dist/components/TaskList/index.js +3 -0
  28. package/dist/components/Toggle/Toggle.js +8 -8
  29. package/dist/components/Toggle/ToggleCore.js +4 -5
  30. package/dist/components/Toolbar/ToolbarButton.js +7 -7
  31. package/dist/components/Toolbar/ToolbarToggle.js +9 -9
  32. package/dist/components/Tree/Tree.js +159 -137
  33. package/dist/components/Tree/index.js +2 -1
  34. package/dist/components/Tree/useTree.js +32 -0
  35. package/dist/components/Tree/utils.js +21 -11
  36. package/dist/css/anchor.css +1 -1
  37. package/dist/css/combobox.css +1 -1
  38. package/dist/css/copy-button.css +1 -1
  39. package/dist/css/data-table.css +1 -1
  40. package/dist/css/follow-up-suggestions.css +4 -0
  41. package/dist/css/notification-center.css +5 -0
  42. package/dist/css/task-list.css +4 -0
  43. package/dist/css/tokens.css +1 -0
  44. package/dist/css-manifest.json +21 -0
  45. package/dist/haze-ui.css +18 -4
  46. package/dist/headless/index.js +2 -1
  47. package/dist/hooks/index.js +25 -0
  48. package/dist/hooks/useAnchorSpy.js +49 -0
  49. package/dist/hooks/useElementSize.js +31 -0
  50. package/dist/hooks/useIdle.js +45 -0
  51. package/dist/hooks/useMutationObserver.js +31 -0
  52. package/dist/hooks/useNetwork.js +28 -0
  53. package/dist/hooks/useOrientation.js +27 -0
  54. package/dist/hooks/useResizeObserver.js +16 -0
  55. package/dist/icons/index.js +9 -0
  56. package/dist/index.js +323 -318
  57. package/dist/mcp-docs.json +535 -13
  58. package/dist/registry.json +387 -7
  59. package/dist/sitemap.xml +6 -0
  60. package/dist/tokens/index.js +2 -1
  61. package/dist/tokens/zoom.js +6 -0
  62. package/dist/types/components/Anchor/Anchor.d.ts +5 -1
  63. package/dist/types/components/BackToTop/BackToTop.d.ts +23 -5
  64. package/dist/types/components/Combobox/Combobox.d.ts +17 -1
  65. package/dist/types/components/ConfigProvider/ConfigContext.d.ts +6 -0
  66. package/dist/types/components/CopyButton/CopyButton.d.ts +16 -4
  67. package/dist/types/components/DataTable/DataTable.bench.d.ts +1 -0
  68. package/dist/types/components/FloatButton/FloatButton.d.ts +25 -5
  69. package/dist/types/components/FollowUpSuggestions/FollowUpSuggestions.d.ts +27 -0
  70. package/dist/types/components/FollowUpSuggestions/index.d.ts +2 -0
  71. package/dist/types/components/LocaleProvider/locale.d.ts +9 -0
  72. package/dist/types/components/NavigationBar/NavLink.d.ts +24 -32
  73. package/dist/types/components/NotificationCenter/NotificationCenter.d.ts +111 -0
  74. package/dist/types/components/NotificationCenter/index.d.ts +2 -0
  75. package/dist/types/components/Select/Select.bench.d.ts +1 -0
  76. package/dist/types/components/Tabs/Tab.d.ts +26 -4
  77. package/dist/types/components/TaskList/TaskList.d.ts +50 -0
  78. package/dist/types/components/TaskList/index.d.ts +2 -0
  79. package/dist/types/components/Toggle/Toggle.d.ts +15 -8
  80. package/dist/types/components/Toggle/ToggleCore.d.ts +16 -7
  81. package/dist/types/components/Toolbar/ToolbarButton.d.ts +17 -5
  82. package/dist/types/components/Toolbar/ToolbarToggle.d.ts +22 -5
  83. package/dist/types/components/Tree/Tree.d.ts +1 -1
  84. package/dist/types/components/Tree/index.d.ts +4 -1
  85. package/dist/types/components/Tree/types.d.ts +20 -0
  86. package/dist/types/components/Tree/useTree.d.ts +96 -0
  87. package/dist/types/components/Tree/utils.d.ts +7 -0
  88. package/dist/types/components/VirtualList/VirtualList.bench.d.ts +1 -0
  89. package/dist/types/headless/index.d.ts +16 -0
  90. package/dist/types/hooks/index.d.ts +4 -0
  91. package/dist/types/hooks/useAnchorSpy.d.ts +62 -0
  92. package/dist/types/icons/index.d.ts +138 -0
  93. package/dist/types/index.d.ts +10 -2
  94. package/dist/types/tokens/index.d.ts +1 -0
  95. package/dist/types/tokens/zoom.d.ts +33 -0
  96. package/dist/types/utils/deprecate.d.ts +13 -0
  97. package/dist/types/utils/portal.d.ts +29 -0
  98. package/dist/utils/portal.js +13 -0
  99. package/package.json +40 -8
@@ -1,19 +1,26 @@
1
- import type { ComponentPropsWithoutRef, Ref } from 'react';
1
+ import type { ComponentPropsWithRef, ElementType } from 'react';
2
2
  import type { ControlOrValue } from 'react-use-control';
3
- type ToggleProps = {
3
+ type ToggleOwnProps = {
4
4
  /** Whether the toggle is pressed; a control for full external ownership. */
5
5
  pressed?: ControlOrValue<boolean>;
6
6
  size?: 'sm' | 'md' | 'lg';
7
7
  /** Equal padding on all sides — for icon-only square toggles. */
8
8
  square?: boolean;
9
- /** Forwarded to the underlying `<button>` — form bridges and
10
- * `ref.current.focus()` reach. */
11
- ref?: Ref<HTMLButtonElement>;
12
- } & Omit<ComponentPropsWithoutRef<'button'>, 'type' | 'aria-pressed'>;
9
+ };
10
+ /**
11
+ * Polymorphic like Button's `as` (delegated to {@link ToggleCore}):
12
+ * `as='a'` renders the toggle skin on a real anchor — href/link
13
+ * semantics with the same `aria-pressed` wiring.
14
+ */
15
+ type ToggleProps<T extends ElementType = 'button'> = ToggleOwnProps & {
16
+ /** Render element — 'button' (default), 'a', or any component that
17
+ * forwards props and ref to a DOM element (a router Link). */
18
+ as?: T;
19
+ } & Omit<ComponentPropsWithRef<T>, keyof ToggleOwnProps | 'as' | 'type' | 'aria-pressed'>;
13
20
  /**
14
21
  * A momentary pressed-state button (aria-pressed) for one-shot modes —
15
22
  * bold, mute, grid/list view. `pressed` is one prop, two modes: a plain
16
23
  * boolean leaves state internal, a control hands ownership to the caller.
17
24
  */
18
- export default function Toggle({ pressed: pressedControl, size, square, className, onClick, ref, ...rest }: ToggleProps): import("react").JSX.Element;
19
- export type { ToggleProps };
25
+ export default function Toggle<T extends ElementType = 'button'>({ pressed: pressedControl, size, square, as, className, onClick, ...rest }: ToggleProps<T>): import("react").JSX.Element;
26
+ export type { ToggleOwnProps, ToggleProps };
@@ -1,5 +1,5 @@
1
- import type { ComponentPropsWithoutRef, Ref } from 'react';
2
- type ToggleCoreProps = {
1
+ import type { ComponentPropsWithRef, ComponentPropsWithoutRef, ElementType } from 'react';
2
+ type ToggleCoreOwnProps = {
3
3
  pressed: boolean;
4
4
  onPressedChange: (pressed: boolean) => void;
5
5
  /** Native click event passthrough — invoked with the DOM event after
@@ -9,9 +9,18 @@ type ToggleCoreProps = {
9
9
  /** Equal padding on all sides — for icon-only square toggles. */
10
10
  square?: boolean;
11
11
  className?: string;
12
- /** Forwarded to the `<button>` element. */
13
- ref?: Ref<HTMLButtonElement>;
14
- } & Omit<ComponentPropsWithoutRef<'button'>, 'type' | 'aria-pressed'>;
12
+ };
13
+ /**
14
+ * Polymorphic like Button's `as`: the toggle skin and the pressed wiring
15
+ * (`aria-pressed`, click → `onPressedChange`) always land on the rendered
16
+ * element. `as='a'` renders a pressed-state anchor — `type='button'` is
17
+ * gated to the native-button shape.
18
+ */
19
+ type ToggleCoreProps<T extends ElementType = 'button'> = ToggleCoreOwnProps & {
20
+ /** Render element — 'button' (default), 'a', or any component that
21
+ * forwards props and ref to a DOM element (a router Link). */
22
+ as?: T;
23
+ } & Omit<ComponentPropsWithRef<T>, keyof ToggleCoreOwnProps | 'as' | 'type' | 'aria-pressed'>;
15
24
  /**
16
25
  * The controlled half of Toggle: a momentary pressed-state button
17
26
  * (`<button aria-pressed>`) — one-shot commands like bold/mute, not the
@@ -19,5 +28,5 @@ type ToggleCoreProps = {
19
28
  * lives here: it renders `pressed` and reports clicks through
20
29
  * `onPressedChange`, so the sugar (or any owner) owns the truth.
21
30
  */
22
- export default function ToggleCore({ pressed, onPressedChange, onNativeClick, size, square, className, ref, ...rest }: ToggleCoreProps): import("react").JSX.Element;
23
- export type { ToggleCoreProps };
31
+ export default function ToggleCore<T extends ElementType = 'button'>({ pressed, onPressedChange, onNativeClick, size, square, as, className, ...rest }: ToggleCoreProps<T>): import("react").JSX.Element;
32
+ export type { ToggleCoreOwnProps, ToggleCoreProps };
@@ -1,4 +1,4 @@
1
- import type { ComponentPropsWithoutRef } from 'react';
1
+ import type { ComponentPropsWithRef, ElementType } from 'react';
2
2
  /**
3
3
  * A toolbar item wearing Button's skin — the same `variant`/`size`/
4
4
  * `square` props (see ButtonLink for the same styles.ts reuse), quieter
@@ -11,10 +11,22 @@ import type { ComponentPropsWithoutRef } from 'react';
11
11
  * look is keyed off that state attribute, so no extra prop can drift
12
12
  * out of sync with what assistive tech announces.
13
13
  */
14
- type ToolbarButtonProps = {
14
+ type ToolbarButtonOwnProps = {
15
15
  variant?: 'solid' | 'outline' | 'ghost';
16
16
  size?: 'sm' | 'md' | 'lg';
17
17
  square?: boolean;
18
- } & Omit<ComponentPropsWithoutRef<'button'>, 'type'>;
19
- export default function ToolbarButton({ variant, size, square, className, ...rest }: ToolbarButtonProps): import("react").JSX.Element;
20
- export type { ToolbarButtonProps };
18
+ };
19
+ /**
20
+ * Polymorphic like Button's `as`: the skin and the toolbar wiring
21
+ * (`data-haze-toolbar-item`, the roving `tabIndex={-1}`) always land on
22
+ * the rendered element — `as='a'` renders a link-shaped toolbar item
23
+ * that still joins the roving model. `type='button'` is gated to the
24
+ * native-button shape.
25
+ */
26
+ type ToolbarButtonProps<T extends ElementType = 'button'> = ToolbarButtonOwnProps & {
27
+ /** Render element — 'button' (default), 'a', or any component that
28
+ * forwards props and ref to a DOM element (a router Link). */
29
+ as?: T;
30
+ } & Omit<ComponentPropsWithRef<T>, keyof ToolbarButtonOwnProps | 'as' | 'type'>;
31
+ export default function ToolbarButton<T extends ElementType = 'button'>({ variant, size, square, as, className, ...rest }: ToolbarButtonProps<T>): import("react").JSX.Element;
32
+ export type { ToolbarButtonOwnProps, ToolbarButtonProps };
@@ -1,4 +1,4 @@
1
- import type { ComponentPropsWithoutRef } from 'react';
1
+ import type { ComponentPropsWithRef, ElementType, MouseEvent } from 'react';
2
2
  import type { ControlOrValue } from 'react-use-control';
3
3
  /**
4
4
  * A toolbar item that toggles: ToolbarButton's skin and roving behavior
@@ -7,13 +7,30 @@ import type { ControlOrValue } from 'react-use-control';
7
7
  * when passed a control. The pressed look is keyed off `aria-pressed`,
8
8
  * so the visual state can never drift from what assistive tech announces.
9
9
  */
10
- type ToolbarToggleProps = {
10
+ type ToolbarToggleOwnProps = {
11
11
  /** Whether the item is pressed; a control for full external ownership. */
12
12
  pressed?: ControlOrValue<boolean>;
13
13
  variant?: 'solid' | 'outline' | 'ghost';
14
14
  size?: 'sm' | 'md' | 'lg';
15
15
  /** Equal padding on all sides — for icon-only square items. */
16
16
  square?: boolean;
17
- } & Omit<ComponentPropsWithoutRef<'button'>, 'type' | 'aria-pressed'>;
18
- export default function ToolbarToggle({ pressed: pressedControl, variant, size, square, className, onClick, ...rest }: ToolbarToggleProps): import("react").JSX.Element;
19
- export type { ToolbarToggleProps };
17
+ /**
18
+ * Element-agnostic click: whatever element `as` rendered, the
19
+ * consumer's handler fires first — the pressed-state toggle rides
20
+ * after it.
21
+ */
22
+ onClick?: (event: MouseEvent<HTMLElement>) => void;
23
+ };
24
+ /**
25
+ * Polymorphic like Button's `as`: the skin, the toolbar wiring
26
+ * (`data-haze-toolbar-item`, the roving `tabIndex={-1}`) and the
27
+ * `aria-pressed` state always land on the rendered element.
28
+ * `type='button'` is gated to the native-button shape.
29
+ */
30
+ type ToolbarToggleProps<T extends ElementType = 'button'> = ToolbarToggleOwnProps & {
31
+ /** Render element — 'button' (default), 'a', or any component that
32
+ * forwards props and ref to a DOM element (a router Link). */
33
+ as?: T;
34
+ } & Omit<ComponentPropsWithRef<T>, keyof ToolbarToggleOwnProps | 'as' | 'type' | 'aria-pressed'>;
35
+ export default function ToolbarToggle<T extends ElementType = 'button'>({ pressed: pressedControl, variant, size, square, as, className, onClick, ...rest }: ToolbarToggleProps<T>): import("react").JSX.Element;
36
+ export type { ToolbarToggleOwnProps, ToolbarToggleProps };
@@ -1,3 +1,3 @@
1
1
  import type { TreeProps, TreeVirtualizedConfig } from './types.js';
2
- export default function Tree({ treeData, multiple, checkable, checkStrictly, selectable, disabled, blockNode, showLine, showIcon, switcherIcon, loadingIcon, titleRender, iconRender, virtualized, loadData, searchValue, rowWrap, keyboardNavigation, expandedKeys: expandedKeysControl, selectedKeys: selectedKeysControl, checkedKeys: checkedKeysControl, ref, className, onExpand, onSelect, onCheck, }: TreeProps): import("react").JSX.Element;
2
+ export default function Tree({ treeData, multiple, checkable, checkStrictly, selectable, disabled, blockNode, showLine, showIcon, switcherIcon, loadingIcon, titleRender, iconRender, virtualized, loadData, searchValue, rowWrap, keyboardNavigation, scrollHandleRef, expandedKeys: expandedKeysControl, selectedKeys: selectedKeysControl, checkedKeys: checkedKeysControl, ref, className, onExpand, onSelect, onCheck, }: TreeProps): import("react").JSX.Element;
3
3
  export type { TreeProps, TreeVirtualizedConfig };
@@ -1,4 +1,7 @@
1
1
  export { default as Tree } from './Tree.js';
2
2
  export { default as SortableTree } from './SortableTree.js';
3
- export type { TreeProps, TreeNodeData } from './types.js';
3
+ export { useTree } from './useTree.js';
4
+ export type { TreeProps, TreeNodeData, TreeScrollHandle } from './types.js';
5
+ export type { UseTreeOptions, UseTreeResult, TreeScrollToOptions, } from './useTree.js';
4
6
  export type { SortableTreeProps, SortableTreeMoveInfo } from './SortableTree.js';
7
+ export type { VisibleTreeRow } from './utils.js';
@@ -1,5 +1,6 @@
1
1
  import type { ReactNode, Ref } from 'react';
2
2
  import type { ControlOrValue } from 'react-use-control';
3
+ import type { VirtualListAlign } from '../VirtualList/index.js';
3
4
  /**
4
5
  * Tree 节点数据接口
5
6
  */
@@ -46,6 +47,25 @@ export type TreeVirtualizedConfig = {
46
47
  */
47
48
  overscan?: number;
48
49
  };
50
+ /**
51
+ * Imperative scroll surface the tree reports through the internal
52
+ * `scrollHandleRef` seam (`useTree` wires it via `treeProps`;
53
+ * `SortableTree` forwards it with its `...rest`).
54
+ */
55
+ export type TreeScrollHandle = {
56
+ /**
57
+ * Bring the row for `key` into view — `align` defaults to `'auto'`
58
+ * (VirtualList semantics: no-op while fully visible, entering from
59
+ * below pins to the start edge, from above to the end edge).
60
+ * Virtualized trees window-shift through `VirtualListHandle
61
+ * .scrollToIndex`; nested trees `scrollIntoView` the row. The request
62
+ * is durable: a `key` that is not currently visible (its ancestors
63
+ * are still collapsing into view — e.g. `useTree`'s `autoExpand`
64
+ * write has not committed yet) stays pending and resolves on the next
65
+ * rows change. It never expands anything by itself.
66
+ */
67
+ scrollToKey: (key: string, align?: VirtualListAlign) => void;
68
+ };
49
69
  /**
50
70
  * Tree 组件 Props
51
71
  */
@@ -0,0 +1,96 @@
1
+ import type { Dispatch, SetStateAction } from 'react';
2
+ import type { ControlOrValue } from 'react-use-control';
3
+ import type { VirtualListAlign } from '../VirtualList/index.js';
4
+ import type { TreeNodeData, TreeProps } from './types.js';
5
+ import type { VisibleTreeRow } from './utils.js';
6
+ /**
7
+ * Options for `useTree`.
8
+ */
9
+ export type UseTreeOptions = {
10
+ /**
11
+ * The same `treeData` you hand to `<Tree>` — the source the path and
12
+ * flattening queries reason about. (Lazy `loadData` children live in
13
+ * the tree's internal cache and are invisible here; see `getPath`.)
14
+ */
15
+ treeData: TreeNodeData[];
16
+ /**
17
+ * Expansion state, `ControlOrValue<string[]>` — the exact contract of
18
+ * `Tree.expandedKeys`. Pass a `Control` (from your own `useControl`)
19
+ * for controlled sharing, or a plain array as the uncontrolled
20
+ * initial value; omit for `[]`. The hook threads the resulting
21
+ * control into `treeProps`, so switcher clicks inside the tree and
22
+ * `setExpandedKeys` writes are the same state.
23
+ */
24
+ expandedKeys?: ControlOrValue<string[]>;
25
+ };
26
+ /** Options for `UseTreeResult.scrollTo`. */
27
+ export type TreeScrollToOptions = {
28
+ /**
29
+ * Expand the target's ancestor chain first (default `false` — scroll
30
+ * never silently mutates expansion). The scroll request is durable:
31
+ * it resolves on the commit that makes the row visible.
32
+ */
33
+ autoExpand?: boolean;
34
+ /** Row alignment once scrolled — `VirtualListAlign`, default `'auto'`. */
35
+ align?: VirtualListAlign;
36
+ };
37
+ /**
38
+ * Result of `useTree`.
39
+ */
40
+ export type UseTreeResult = {
41
+ /**
42
+ * Props for `<Tree>` (or `<SortableTree>`): the `treeData` you passed
43
+ * in, the shared expansion control, and the internal scroll-handle
44
+ * wiring. Spread as `<Tree {...tree.treeProps} />` so `scrollTo` and
45
+ * the tree stay connected; the queries work without it too.
46
+ */
47
+ treeProps: Pick<TreeProps, 'treeData' | 'expandedKeys' | 'scrollHandleRef'>;
48
+ /** Current expanded keys (the value behind the shared control). */
49
+ expandedKeys: string[];
50
+ /**
51
+ * Write expansion — the same `Dispatch<SetStateAction<string[]>>` the
52
+ * tree's switcher writes through; `onExpand` on `<Tree>` still fires
53
+ * for user toggles.
54
+ */
55
+ setExpandedKeys: Dispatch<SetStateAction<string[]>>;
56
+ /**
57
+ * Ancestor chain of `key`, root first and the node itself last — `[]`
58
+ * for an unknown key. Strict ancestors are `path.slice(0, -1)`.
59
+ */
60
+ getPath: (key: string) => TreeNodeData[];
61
+ /**
62
+ * The currently visible rows in depth-first order — exactly the item
63
+ * sequence a `virtualized` tree windows over (one entry per rendered
64
+ * treeitem, parents before children, expanded subtrees only).
65
+ */
66
+ flattenVisible: () => VisibleTreeRow[];
67
+ /**
68
+ * Scroll the row for `key` into view: virtualized trees window-shift
69
+ * via `VirtualListHandle.scrollToIndex`, nested trees `scrollIntoView`
70
+ * the row. With `autoExpand` the ancestors are expanded first and the
71
+ * scroll lands on that commit. Requires `treeProps` to be spread onto
72
+ * the tree (the hook holds no DOM otherwise); an unknown key is a
73
+ * durable no-op — nothing expands, nothing scrolls.
74
+ */
75
+ scrollTo: (key: string, options?: TreeScrollToOptions) => void;
76
+ };
77
+ /**
78
+ * Companion hook for `Tree` (the AntD v6 `useTree` slot): owns the
79
+ * expansion state through `react-use-control`, answers path/flattening
80
+ * queries against the tree data, and drives imperative scrolling with
81
+ * optional ancestor auto-expansion.
82
+ *
83
+ * ```tsx
84
+ * const tree = useTree({ treeData });
85
+ * // tree.getPath('0-0-1') → [root, '0-0', the node] — breadcrumb-ready
86
+ * <Tree {...tree.treeProps} virtualized />
87
+ * <button onClick={() => tree.scrollTo('0-0-1', { autoExpand: true })}>
88
+ * Jump
89
+ * </button>
90
+ * ```
91
+ *
92
+ * - `expandedKeys` accepts a control (controlled) or a plain array
93
+ * (uncontrolled initial) — the same one-prop contract as the tree.
94
+ * - `scrollTo` never mutates expansion unless `autoExpand` is set.
95
+ */
96
+ export declare function useTree(options: UseTreeOptions): UseTreeResult;
@@ -35,6 +35,13 @@ export declare function flattenTreeData(data: TreeNodeData[]): TreeNodeData[];
35
35
  export declare function findNodeByKey(data: TreeNodeData[], key: string): TreeNodeData | null;
36
36
  export declare function getChildKeys(data: TreeNodeData[], parentKey: string): string[];
37
37
  export declare function getParentKey(data: TreeNodeData[], targetKey: string, parentKey?: string): string | null;
38
+ /**
39
+ * Ancestor chain of `key`: root first, the node itself last — `[]` when
40
+ * the key is unknown. One DFS pass (`getParentKey` re-walked per level
41
+ * would be O(depth · n)); the caller drops the last entry for the strict
42
+ * ancestors.
43
+ */
44
+ export declare function getNodePath(data: TreeNodeData[], key: string): TreeNodeData[];
38
45
  export declare function getAllLeafKeys(data: TreeNodeData[]): string[];
39
46
  /**
40
47
  * Case-insensitive `[start, end)` ranges of every non-overlapping
@@ -32,6 +32,7 @@ import { focusFirst, getTabbables, isTabbable, TABBABLE_SELECTOR } from '../util
32
32
  import { useFocusScope } from '../utils/focus-scope.js';
33
33
  import { getEnabledMenuItems, useMenuKeyboard, useRovingTabindex } from '../utils/menuKeyboard.js';
34
34
  import { Presence, whenExitSettles } from '../utils/presence.js';
35
+ import { Portal } from '../utils/portal.js';
35
36
  import { mergeRefs } from '../utils/refs.js';
36
37
  import { SUBMENU_CLOSE_GRACE_MS, SUBMENU_OPEN_DELAY_MS, SubmenuProvider, useSubmenu, useSubmenuContext } from '../utils/submenu.js';
37
38
  import { useViewTransitionFlip } from '../utils/view-transition.js';
@@ -129,6 +130,21 @@ export type { PresenceProps } from '../utils/presence.js';
129
130
  * settle. The imperative companion to {@link Presence}.
130
131
  */
131
132
  export { whenExitSettles };
133
+ /**
134
+ * Renders children into a DOM container outside the current React tree
135
+ * position — `document.body` by default, so overlays escape ancestor
136
+ * `overflow`, `transform` and stacking contexts. SSR-safe: nothing
137
+ * renders until the client mounts (no `document` access during render),
138
+ * and `disabled` renders the children in place instead. The primitive
139
+ * behind haze-ui's overlay families, exported for composing your own.
140
+ */
141
+ export { Portal };
142
+ /**
143
+ * Props accepted by {@link Portal}: `children`, an optional `container`
144
+ * (element or lazy getter, default `document.body`), and `disabled` to
145
+ * render in place.
146
+ */
147
+ export type { PortalProps } from '../utils/portal.js';
132
148
  /**
133
149
  * Focus-domain hook for overlays: attach the returned ref callback to a
134
150
  * container and flip `enabled` to get initial focus, focus restoration
@@ -1,3 +1,5 @@
1
+ export { useAnchorSpy } from './useAnchorSpy.js';
2
+ export type { UseAnchorSpyOptions, UseAnchorSpyResult } from './useAnchorSpy.js';
1
3
  export { useBusyPressable } from './useBusyPressable.js';
2
4
  export { useClipboard } from './useClipboard.js';
3
5
  export type { UseClipboardResult } from './useClipboard.js';
@@ -30,4 +32,6 @@ export type { UseResizeObserverOptions, UseResizeObserverResult, } from './useRe
30
32
  export { usePrefersReducedMotion } from './usePrefersReducedMotion.js';
31
33
  export { usePrevious } from './usePrevious.js';
32
34
  export { useSessionStorage } from './useSessionStorage.js';
35
+ export { useStorageState } from './useStorageState.js';
36
+ export type { StorageKind } from './useStorageState.js';
33
37
  export { useTitle } from './useTitle.js';
@@ -0,0 +1,62 @@
1
+ import type { Dispatch, SetStateAction } from 'react';
2
+ import type { ControlOrValue } from 'react-use-control';
3
+ type UseAnchorSpyOptions = {
4
+ /** 追踪的区块 id 列表(文档顺序)。 */
5
+ ids: readonly string[];
6
+ /** 滚动容器,默认 `window`。 */
7
+ getContainer?: () => HTMLElement | Window;
8
+ /** 容器顶部与区块顶部保留的距离(吸顶头高度),px。 */
9
+ offsetTop?: number;
10
+ /** 滚动侦测触发线,距容器顶部 px(仅无 IntersectionObserver 的回退引擎)。 */
11
+ bounds?: number;
12
+ /** 高亮区块 id:接受 control(受控)或普通值(非受控初值)。 */
13
+ activeId?: ControlOrValue<string>;
14
+ };
15
+ type UseAnchorSpyResult = {
16
+ /** 当前高亮区块 id;无匹配时为空串。 */
17
+ activeId: string;
18
+ /** 写入高亮(点击导航、外部跳转),受控时同步到外部状态。 */
19
+ setActiveId: Dispatch<SetStateAction<string>>;
20
+ };
21
+ /**
22
+ * 滚动侦测(scroll-spy):追踪一组区块 id,返回当前应高亮的那个。
23
+ *
24
+ * ```tsx
25
+ * function TocNav() {
26
+ * const { activeId, setActiveId } = useAnchorSpy({ ids: ['basics', 'api'] });
27
+ * return (
28
+ * <nav>
29
+ * {['basics', 'api'].map((id) => (
30
+ * <a
31
+ * key={id}
32
+ * href={`#${id}`}
33
+ * aria-current={activeId === id ? 'true' : undefined}
34
+ * onClick={(event) => {
35
+ * event.preventDefault();
36
+ * setActiveId(id);
37
+ * }}
38
+ * >
39
+ * {id}
40
+ * </a>
41
+ * ))}
42
+ * </nav>
43
+ * );
44
+ * }
45
+ * ```
46
+ *
47
+ * - IntersectionObserver 引擎:区块与 `offsetTop` 以下的视口带相交即
48
+ * 「可见」,按 `ids` 顺序取最靠前的可见区块。容器是元素时作为
49
+ * observer root,否则用视口。
50
+ * - 回退引擎(无 IntersectionObserver 的环境):监听容器 scroll,激活
51
+ * 最后一个顶部越过 `bounds` 触发线的区块。不做初始运行——初值交给
52
+ * `activeId`(jsdom 的零矩形会误报)。
53
+ * - `activeId` 走 react-use-control:传 control 受控、传普通值作
54
+ * 非受控初值(默认 `ids[0]`)。
55
+ * - `ids` 身份随父级渲染漂移只会重建订阅——观察者重新上报当前位置,
56
+ * 行为不变。
57
+ *
58
+ * @param options 见 {@link UseAnchorSpyOptions}。
59
+ * @returns `{ activeId, setActiveId }`。
60
+ */
61
+ export declare function useAnchorSpy({ ids, getContainer, offsetTop, bounds, activeId: activeIdControl, }: UseAnchorSpyOptions): UseAnchorSpyResult;
62
+ export type { UseAnchorSpyOptions, UseAnchorSpyResult };
@@ -0,0 +1,138 @@
1
+ /**
2
+ * Curated icon re-exports from [lucide-react](https://lucide.dev) — the
3
+ * `haze-ui/icons` subpath.
4
+ *
5
+ * Curation strategy: the ~100 most common UI glyphs (navigation chevrons,
6
+ * form feedback, media, communication, files, commerce), re-exported as
7
+ * individual named exports in alphabetical order. The full lucide catalog
8
+ * (1800+ icons) stays one `lucide-react` import away — import it directly
9
+ * when a rare glyph is needed; this barrel only fixes the common vocabulary
10
+ * and keeps the default choice obvious.
11
+ *
12
+ * Tree-shaking: `lucide-react` is a regular dependency with
13
+ * `sideEffects: false`, and the lib build emits `preserveModules` output
14
+ * with `lucide-react` external — an icon that is never imported costs zero
15
+ * bytes (and consumers who import none of haze-ui's icons never pull the
16
+ * package into their graph at all; it tree-shakes away entirely).
17
+ *
18
+ * Pairing with the `Icon` component:
19
+ *
20
+ * ```tsx
21
+ * import { Icon } from 'haze-ui';
22
+ * import { Check } from 'haze-ui/icons';
23
+ *
24
+ * <Icon icon={Check} /> // 20px (md) by default
25
+ * <Icon icon={Check} size='sm' /> // 16px — see hazeIconSize below
26
+ * ```
27
+ */
28
+ export { ArrowDown } from 'lucide-react';
29
+ export { ArrowLeft } from 'lucide-react';
30
+ export { ArrowRight } from 'lucide-react';
31
+ export { ArrowUp } from 'lucide-react';
32
+ export { ArrowUpDown } from 'lucide-react';
33
+ export { ArrowUpRight } from 'lucide-react';
34
+ export { Asterisk } from 'lucide-react';
35
+ export { AtSign } from 'lucide-react';
36
+ export { Bell } from 'lucide-react';
37
+ export { BellOff } from 'lucide-react';
38
+ export { Bold } from 'lucide-react';
39
+ export { BookOpen } from 'lucide-react';
40
+ export { Bookmark } from 'lucide-react';
41
+ export { Calendar } from 'lucide-react';
42
+ export { ChartColumn } from 'lucide-react';
43
+ export { ChartLine } from 'lucide-react';
44
+ export { ChartPie } from 'lucide-react';
45
+ export { Check } from 'lucide-react';
46
+ export { CheckCheck } from 'lucide-react';
47
+ export { ChevronDown } from 'lucide-react';
48
+ export { ChevronLeft } from 'lucide-react';
49
+ export { ChevronRight } from 'lucide-react';
50
+ export { ChevronUp } from 'lucide-react';
51
+ export { ChevronsUpDown } from 'lucide-react';
52
+ export { Circle } from 'lucide-react';
53
+ export { CircleQuestionMark } from 'lucide-react';
54
+ export { Clipboard } from 'lucide-react';
55
+ export { Clock } from 'lucide-react';
56
+ export { Cloud } from 'lucide-react';
57
+ export { CloudOff } from 'lucide-react';
58
+ export { Code } from 'lucide-react';
59
+ export { Command } from 'lucide-react';
60
+ export { Copy } from 'lucide-react';
61
+ export { Download } from 'lucide-react';
62
+ export { Ellipsis } from 'lucide-react';
63
+ export { EllipsisVertical } from 'lucide-react';
64
+ export { ExternalLink } from 'lucide-react';
65
+ export { Eye } from 'lucide-react';
66
+ export { EyeOff } from 'lucide-react';
67
+ export { File } from 'lucide-react';
68
+ export { FileText } from 'lucide-react';
69
+ export { Flag } from 'lucide-react';
70
+ export { Folder } from 'lucide-react';
71
+ export { FolderOpen } from 'lucide-react';
72
+ export { Funnel } from 'lucide-react';
73
+ export { Globe } from 'lucide-react';
74
+ export { Hash } from 'lucide-react';
75
+ export { Heart } from 'lucide-react';
76
+ export { House } from 'lucide-react';
77
+ export { Image } from 'lucide-react';
78
+ export { Inbox } from 'lucide-react';
79
+ export { Info } from 'lucide-react';
80
+ export { Italic } from 'lucide-react';
81
+ export { LayoutGrid } from 'lucide-react';
82
+ export { LayoutList } from 'lucide-react';
83
+ export { Link } from 'lucide-react';
84
+ export { List } from 'lucide-react';
85
+ export { Loader } from 'lucide-react';
86
+ export { LoaderCircle } from 'lucide-react';
87
+ export { Lock } from 'lucide-react';
88
+ export { LockOpen } from 'lucide-react';
89
+ export { LogOut } from 'lucide-react';
90
+ export { Mail } from 'lucide-react';
91
+ export { MapPin } from 'lucide-react';
92
+ export { Menu } from 'lucide-react';
93
+ export { MessageCircle } from 'lucide-react';
94
+ export { MessageSquare } from 'lucide-react';
95
+ export { Mic } from 'lucide-react';
96
+ export { Minus } from 'lucide-react';
97
+ export { Moon } from 'lucide-react';
98
+ export { Pencil } from 'lucide-react';
99
+ export { Phone } from 'lucide-react';
100
+ export { Play } from 'lucide-react';
101
+ export { Plus } from 'lucide-react';
102
+ export { QrCode } from 'lucide-react';
103
+ export { RefreshCw } from 'lucide-react';
104
+ export { Save } from 'lucide-react';
105
+ export { Search } from 'lucide-react';
106
+ export { Send } from 'lucide-react';
107
+ export { Settings } from 'lucide-react';
108
+ export { Shield } from 'lucide-react';
109
+ export { ShieldCheck } from 'lucide-react';
110
+ export { ShoppingCart } from 'lucide-react';
111
+ export { Sparkles } from 'lucide-react';
112
+ export { SquareCheck } from 'lucide-react';
113
+ export { Star } from 'lucide-react';
114
+ export { Sun } from 'lucide-react';
115
+ export { Tag } from 'lucide-react';
116
+ export { Trash } from 'lucide-react';
117
+ export { Underline } from 'lucide-react';
118
+ export { Upload } from 'lucide-react';
119
+ export { User } from 'lucide-react';
120
+ export { UserPlus } from 'lucide-react';
121
+ export { Users } from 'lucide-react';
122
+ export { Volume2 } from 'lucide-react';
123
+ export { VolumeX } from 'lucide-react';
124
+ export { X } from 'lucide-react';
125
+ export { Zap } from 'lucide-react';
126
+ export { ZoomIn } from 'lucide-react';
127
+ export { ZoomOut } from 'lucide-react';
128
+ /**
129
+ * Pixel sizes the `Icon` component maps its `size` prop to (`sm`/`md`/`lg`
130
+ * → 16/20/24) — kept in lockstep with `components/Icon/Icon.tsx`. Use it
131
+ * when an icon lands outside `<Icon>` (e.g. a lucide glyph sized directly
132
+ * next to haze-ui components) so both paths agree on the size scale.
133
+ */
134
+ export declare const hazeIconSize: Readonly<{
135
+ readonly sm: 16;
136
+ readonly md: 20;
137
+ readonly lg: 24;
138
+ }>;
@@ -7,6 +7,7 @@ export { spacing } from './tokens/spacing.js';
7
7
  export { compact } from './tokens/density.js';
8
8
  export { typography } from './tokens/typography.js';
9
9
  export { motion, motionPresets } from './tokens/motion.js';
10
+ export { remScale } from './tokens/zoom.js';
10
11
  export type { MotionPreset } from './tokens/motion.js';
11
12
  export { TOKEN_REGISTRY, COMPONENT_TOKENS } from './tokens/registry.js';
12
13
  export type { TokenDef } from './tokens/registry.js';
@@ -38,6 +39,8 @@ export { Popconfirm } from './components/Popconfirm/index.js';
38
39
  export type { PopconfirmProps, PopconfirmHandle, PopconfirmPlacement } from './components/Popconfirm/index.js';
39
40
  export { Popover } from './components/Popover/index.js';
40
41
  export type { PopoverProps, PopoverHandle, PopoverClassNames } from './components/Popover/index.js';
42
+ export { NotificationCenter } from './components/NotificationCenter/index.js';
43
+ export type { NotificationCenterProps, NotificationCenterClassNames, NotificationCenterItem, NotificationCenterSeverity, NotificationCenterKind } from './components/NotificationCenter/index.js';
41
44
  export { Card, cardVariants } from './components/Card/index.js';
42
45
  export type { CardProps } from './components/Card/index.js';
43
46
  export { Radio, RadioGroup, RadioGroupCore } from './components/Radio/index.js';
@@ -92,8 +95,9 @@ export { Datepicker, DatepickerCore } from './components/Datepicker/index.js';
92
95
  export type { DatepickerProps, DatepickerCoreProps, DatepickerPreset } from './components/Datepicker/index.js';
93
96
  export { DateField, DateFieldCore } from './components/DateField/index.js';
94
97
  export type { DateFieldProps, DateFieldCoreProps, DatePlaceholder, DateLabels } from './components/DateField/index.js';
95
- export { Tree, SortableTree } from './components/Tree/index.js';
96
- export type { TreeProps, TreeNodeData, SortableTreeProps, SortableTreeMoveInfo } from './components/Tree/index.js';
98
+ export { Tree, SortableTree, useTree } from './components/Tree/index.js';
99
+ export type { TreeProps, TreeNodeData, TreeScrollHandle, SortableTreeProps, SortableTreeMoveInfo } from './components/Tree/index.js';
100
+ export type { UseTreeOptions, UseTreeResult, TreeScrollToOptions, VisibleTreeRow } from './components/Tree/index.js';
97
101
  export { TreeSelect } from './components/TreeSelect/index.js';
98
102
  export type { TreeSelectProps } from './components/TreeSelect/index.js';
99
103
  export { Divider } from './components/Divider/index.js';
@@ -289,6 +293,8 @@ export { ToolCallCard } from './components/ToolCallCard/index.js';
289
293
  export type { ToolCallCardProps, ToolCallStatus } from './components/ToolCallCard/index.js';
290
294
  export { ThinkingIndicator } from './components/ThinkingIndicator/index.js';
291
295
  export type { ThinkingIndicatorProps } from './components/ThinkingIndicator/index.js';
296
+ export { TaskList, TaskListItem } from './components/TaskList/index.js';
297
+ export type { TaskListProps, TaskListItemProps, TaskData } from './components/TaskList/index.js';
292
298
  export { StepTimeline, StepTimelineItem } from './components/StepTimeline/index.js';
293
299
  export type { StepTimelineProps, StepTimelineItemProps, StepStatus } from './components/StepTimeline/index.js';
294
300
  export { Trace, TraceItem, TraceDetails } from './components/Trace/index.js';
@@ -321,6 +327,8 @@ export { Sources } from './components/Sources/index.js';
321
327
  export type { SourcesProps, SourceItem } from './components/Sources/index.js';
322
328
  export { FilePreview } from './components/FilePreview/index.js';
323
329
  export type { FilePreviewProps, FilePreviewFile, FilePreviewStatus } from './components/FilePreview/index.js';
330
+ export { FollowUpSuggestions } from './components/FollowUpSuggestions/index.js';
331
+ export type { FollowUpSuggestionsProps } from './components/FollowUpSuggestions/index.js';
324
332
  export { InlineCompletion } from './components/InlineCompletion/index.js';
325
333
  export type { InlineCompletionProps } from './components/InlineCompletion/index.js';
326
334
  export { InlineCitation } from './components/InlineCitation/index.js';
@@ -9,3 +9,4 @@ export { PRIMITIVES, SEMANTIC_COLOR_TOKENS, createBrandTheme } from './palette.j
9
9
  export type { Family, Mode, PrimitiveScales, SemanticColorToken, ScaleSeed, BrandSeedOverrides, CreateBrandThemeOptions, BrandThemeCss } from './palette.js';
10
10
  export { deltaE, formatOklch, oklchToHex, parseHex, parseOklch, wcagContrast } from './oklch.js';
11
11
  export type { Oklch } from './oklch.js';
12
+ export { remScale } from './zoom.js';
@@ -0,0 +1,33 @@
1
+ import type { DensitySpaceTokenName } from './spacing.js';
2
+ /** The spacing scale at a 16px = 1rem base, answered through the density indirection. */
3
+ export declare const REM_SPACE_OVERRIDES: Record<DensitySpaceTokenName, string>;
4
+ /** The text-size scale at a 16px = 1rem base (leading is unitless already). */
5
+ export declare const REM_TEXT_SIZES: {
6
+ readonly '--haze-text-xs': "0.75rem";
7
+ readonly '--haze-text-sm': "0.875rem";
8
+ readonly '--haze-text-base': "1rem";
9
+ readonly '--haze-text-lg': "1.125rem";
10
+ readonly '--haze-text-xl': "1.25rem";
11
+ readonly '--haze-text-2xl': "1.5rem";
12
+ readonly '--haze-text-3xl': "1.875rem";
13
+ };
14
+ export type TextSizeTokenName = keyof typeof REM_TEXT_SIZES;
15
+ /** The radius scale at a 16px = 1rem base (9999px = 624.9375rem exactly). */
16
+ export declare const REM_RADII: {
17
+ readonly '--haze-radius-none': "0";
18
+ readonly '--haze-radius-sm': "0.25rem";
19
+ readonly '--haze-radius-md': "0.375rem";
20
+ readonly '--haze-radius-lg': "0.5rem";
21
+ readonly '--haze-radius-xl': "0.75rem";
22
+ readonly '--haze-radius-2xl': "1rem";
23
+ readonly '--haze-radius-full': "624.9375rem";
24
+ };
25
+ export type RadiusTokenName = keyof typeof REM_RADII;
26
+ /**
27
+ * The declarations the remScale class emits, one per re-declared token.
28
+ * Exported for the token tests — the css template interpolates this exact
29
+ * function and Linaria evaluates it at build time (spacingDeclarations /
30
+ * compactDeclarations precedent).
31
+ */
32
+ export declare function remDeclarations(): string;
33
+ export declare const remScale: import("@linaria/core").LinariaClassName;