@gamecrafters/base-ui 0.0.28 → 0.0.30

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 (85) hide show
  1. package/build/components/accordion/Accordion.d.ts +2 -0
  2. package/build/components/accordion/Accordion.types.d.ts +10 -0
  3. package/build/components/accordion/index.d.ts +2 -0
  4. package/build/components/badge/Badge.d.ts +13 -0
  5. package/build/components/badge/Badge.types.d.ts +13 -0
  6. package/build/components/badge/index.d.ts +2 -0
  7. package/build/components/clipboard/Clipboard.d.ts +10 -5
  8. package/build/components/clipboard/Clipboard.types.d.ts +38 -11
  9. package/build/components/clipboard/ClipboardContext.d.ts +1 -0
  10. package/build/components/clipboard/ClipboardCopyText.d.ts +9 -0
  11. package/build/components/clipboard/ClipboardIndicator.d.ts +4 -3
  12. package/build/components/clipboard/ClipboardLabel.d.ts +7 -0
  13. package/build/components/clipboard/ClipboardValueText.d.ts +7 -0
  14. package/build/components/clipboard/index.d.ts +58 -10
  15. package/build/components/clipboard/useClipboard.d.ts +3 -0
  16. package/build/components/collapsible/Collapsible.types.d.ts +8 -2
  17. package/build/components/collapsible/CollapsiblePanel.d.ts +9 -0
  18. package/build/components/collapsible/index.d.ts +19 -2
  19. package/build/components/index.d.ts +4 -1
  20. package/build/components/json-tree-view/JSONTreeView.d.ts +8 -0
  21. package/build/components/json-tree-view/JSONTreeView.types.d.ts +47 -0
  22. package/build/components/json-tree-view/JSONTreeViewContext.d.ts +3 -0
  23. package/build/components/json-tree-view/JSONTreeViewKey.d.ts +7 -0
  24. package/build/components/json-tree-view/JSONTreeViewNode.d.ts +7 -0
  25. package/build/components/json-tree-view/JSONTreeViewValue.d.ts +7 -0
  26. package/build/components/json-tree-view/index.d.ts +5 -0
  27. package/build/components/json-tree-view/jsonNodes.d.ts +5 -0
  28. package/build/components/json-tree-view/jsonTokens.d.ts +4 -0
  29. package/build/components/marquee/Marquee.d.ts +20 -6
  30. package/build/components/marquee/Marquee.types.d.ts +52 -19
  31. package/build/components/marquee/MarqueeContent.d.ts +7 -0
  32. package/build/components/marquee/MarqueeContext.d.ts +3 -0
  33. package/build/components/marquee/MarqueeEdge.d.ts +8 -0
  34. package/build/components/marquee/MarqueeItem.d.ts +7 -0
  35. package/build/components/marquee/MarqueeViewport.d.ts +7 -0
  36. package/build/components/marquee/index.d.ts +72 -2
  37. package/build/components/marquee/useMarquee.d.ts +2 -14
  38. package/build/components/resizable/Resizable.d.ts +7 -0
  39. package/build/components/resizable/Resizable.types.d.ts +23 -0
  40. package/build/components/{splitter → resizable}/index.d.ts +9 -9
  41. package/build/components/table-of-contents/TableOfContents.d.ts +14 -3
  42. package/build/components/table-of-contents/TableOfContents.types.d.ts +80 -21
  43. package/build/components/table-of-contents/TableOfContentsContent.d.ts +7 -0
  44. package/build/components/table-of-contents/TableOfContentsContext.d.ts +5 -0
  45. package/build/components/table-of-contents/TableOfContentsIndicator.d.ts +7 -0
  46. package/build/components/table-of-contents/TableOfContentsItem.d.ts +2 -2
  47. package/build/components/table-of-contents/TableOfContentsLink.d.ts +7 -0
  48. package/build/components/table-of-contents/TableOfContentsList.d.ts +3 -1
  49. package/build/components/table-of-contents/TableOfContentsNav.d.ts +8 -0
  50. package/build/components/table-of-contents/TableOfContentsTitle.d.ts +1 -1
  51. package/build/components/table-of-contents/headingScroll.d.ts +12 -0
  52. package/build/components/table-of-contents/index.d.ts +63 -13
  53. package/build/components/table-of-contents/useTableOfContents.d.ts +3 -0
  54. package/build/components/timer/Timer.d.ts +16 -0
  55. package/build/components/timer/Timer.types.d.ts +64 -0
  56. package/build/components/timer/TimerActionTrigger.d.ts +9 -0
  57. package/build/components/timer/TimerArea.d.ts +7 -0
  58. package/build/components/timer/TimerContext.d.ts +2 -0
  59. package/build/components/timer/TimerControl.d.ts +7 -0
  60. package/build/components/timer/TimerItem.d.ts +8 -0
  61. package/build/components/timer/TimerSeparator.d.ts +7 -0
  62. package/build/components/timer/index.d.ts +66 -0
  63. package/build/components/timer/timerDuration.d.ts +5 -0
  64. package/build/components/timer/useTimer.d.ts +3 -0
  65. package/build/hooks/useIsomorphicLayoutEffect.d.ts +2 -2
  66. package/build/lib/hotkey/hotkey.d.ts +48 -0
  67. package/build/lib/hotkey/index.d.ts +27 -0
  68. package/build/lib/hotkey/macos-symbol-layer.d.ts +6 -0
  69. package/build/lib/hotkey/macos-uppercase-layer.d.ts +6 -0
  70. package/build/lib/hotkey/radix-trie.d.ts +22 -0
  71. package/build/lib/hotkey/sequence.d.ts +39 -0
  72. package/build/lib/hotkey/utilities.d.ts +21 -0
  73. package/build/main.cjs.js +70 -70
  74. package/build/main.esm.js +68 -68
  75. package/build/styles/main.css +1 -1
  76. package/package.json +1 -1
  77. package/build/components/splitter/Splitter.d.ts +0 -7
  78. package/build/components/splitter/Splitter.types.d.ts +0 -23
  79. package/build/components/table-of-contents/TableOfContentsGroup.d.ts +0 -9
  80. package/build/components/table-of-contents/useTableOfContentsActiveId.d.ts +0 -2
  81. /package/build/components/{collapsible/CollapsibleContent.d.ts → clipboard/ClipboardControl.d.ts} +0 -0
  82. /package/build/components/{splitter/SplitterPanel.d.ts → resizable/ResizablePanel.d.ts} +0 -0
  83. /package/build/components/{splitter/SplitterResizeTrigger.d.ts → resizable/ResizableResizeTrigger.d.ts} +0 -0
  84. /package/build/components/{splitter/SplitterResizeTriggerIndicator.d.ts → resizable/ResizableResizeTriggerIndicator.d.ts} +0 -0
  85. /package/build/components/{splitter/SplitterResizeTriggerSeparator.d.ts → resizable/ResizableResizeTriggerSeparator.d.ts} +0 -0
@@ -1,26 +1,59 @@
1
1
  import type * as React from "react";
2
+ import type { PolymorphicProps } from "../../utilities/polymorphic";
2
3
  export type MarqueeSide = "start" | "end" | "top" | "bottom";
3
- export type MarqueeAxis = "inline" | "block";
4
- export type MarqueeSpeed = "slow" | "medium" | "fast";
5
- export type MarqueeSpacing = "none" | "tight" | "condensed" | "cozy" | "normal" | "spacious";
6
- export type MarqueeProps = React.ComponentPropsWithoutRef<"div"> & {
7
- side?: MarqueeSide;
8
- speed?: MarqueeSpeed;
9
- spacing?: MarqueeSpacing;
10
- pauseOnHover?: boolean;
4
+ export type MarqueeOrientation = "horizontal" | "vertical";
5
+ type MarqueePauseProps = {
11
6
  paused?: boolean;
12
- className?: string;
7
+ defaultPaused?: boolean;
8
+ };
9
+ type MarqueePauseCallback = {
10
+ onPauseChange?: (paused: boolean) => void;
13
11
  };
14
- export type UseMarqueeOptions = {
12
+ type MarqueeCallbacks = MarqueePauseCallback & {
13
+ onLoopComplete?: (loops: number) => void;
14
+ onComplete?: () => void;
15
+ };
16
+ export type UseMarqueeProps = MarqueePauseProps & MarqueePauseCallback;
17
+ export type UseMarqueeReturn = {
18
+ paused: boolean;
19
+ pause: () => void;
20
+ resume: () => void;
21
+ toggle: () => void;
22
+ setPaused: (paused: boolean) => void;
23
+ };
24
+ type MarqueeOwnProps = MarqueePauseProps & {
15
25
  side?: MarqueeSide;
16
- speed?: MarqueeSpeed;
26
+ speed?: number;
27
+ delay?: number;
28
+ loopCount?: number;
29
+ autoFill?: boolean;
30
+ spacing?: string;
31
+ reverse?: boolean;
32
+ pauseOnInteraction?: boolean;
33
+ className?: string;
17
34
  };
18
- export type UseMarqueeResult = {
19
- rootRef: React.RefObject<HTMLDivElement | null>;
20
- groupRef: React.RefObject<HTMLDivElement | null>;
21
- axis: MarqueeAxis;
22
- copies: number;
23
- distance: number;
24
- duration: number;
25
- style: React.CSSProperties;
35
+ export type MarqueeProps<As extends React.ElementType = "div"> = PolymorphicProps<As, "div", MarqueeOwnProps> & MarqueeCallbacks;
36
+ export type MarqueeElementProps = MarqueeProps<"div">;
37
+ export type MarqueeViewportProps<As extends React.ElementType = "div"> = PolymorphicProps<As, "div", {
38
+ className?: string;
39
+ }>;
40
+ export type MarqueeContentProps<As extends React.ElementType = "div"> = PolymorphicProps<As, "div", {
41
+ className?: string;
42
+ }>;
43
+ export type MarqueeItemProps<As extends React.ElementType = "div"> = PolymorphicProps<As, "div", {
44
+ className?: string;
45
+ }>;
46
+ export type MarqueeEdgeProps<As extends React.ElementType = "div"> = PolymorphicProps<As, "div", {
47
+ side: MarqueeSide;
48
+ className?: string;
49
+ }>;
50
+ export type MarqueeContextValue = Partial<UseMarqueeReturn> & {
51
+ side?: MarqueeSide;
52
+ orientation?: MarqueeOrientation;
53
+ copyCount?: number;
54
+ viewportRef?: React.Ref<HTMLElement>;
55
+ copyRef?: React.Ref<HTMLElement>;
56
+ onLoopComplete?: (loops: number) => void;
57
+ onComplete?: () => void;
26
58
  };
59
+ export {};
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ declare const _default: <As extends React.ElementType = "div">(props: import("../../utilities/polymorphic").DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "div" : As> & {
3
+ className?: string;
4
+ }, "as"> & {
5
+ as?: As | undefined;
6
+ } & React.RefAttributes<any>) => React.ReactNode;
7
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { MarqueeContextValue } from "./Marquee.types";
2
+ export declare const MarqueeContext: import("react").Context<MarqueeContextValue>;
3
+ export declare const useMarqueeContext: () => MarqueeContextValue;
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ declare const _default: <As extends React.ElementType = "div">(props: import("../../utilities/polymorphic").DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "div" : As> & {
3
+ side: import("./Marquee.types").MarqueeSide;
4
+ className?: string;
5
+ }, "as"> & {
6
+ as?: As | undefined;
7
+ } & React.RefAttributes<any>) => React.ReactNode;
8
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ declare const _default: <As extends React.ElementType = "div">(props: import("../../utilities/polymorphic").DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "div" : As> & {
3
+ className?: string;
4
+ }, "as"> & {
5
+ as?: As | undefined;
6
+ } & React.RefAttributes<any>) => React.ReactNode;
7
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ declare const _default: <As extends React.ElementType = "div">(props: import("../../utilities/polymorphic").DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "div" : As> & {
3
+ className?: string;
4
+ }, "as"> & {
5
+ as?: As | undefined;
6
+ } & React.RefAttributes<any>) => React.ReactNode;
7
+ export default _default;
@@ -1,3 +1,73 @@
1
- export { default as Marquee } from "./Marquee";
2
- export { useMarquee, MARQUEE_SPEEDS, MARQUEE_MINIMUM_COPIES } from "./useMarquee";
1
+ import { DEFAULT_MARQUEE_SPEED } from "./Marquee";
2
+ import MarqueeContent from "./MarqueeContent";
3
+ import MarqueeEdge from "./MarqueeEdge";
4
+ import MarqueeItem from "./MarqueeItem";
5
+ import MarqueeViewport from "./MarqueeViewport";
6
+ export declare const Marquee: (<As extends React.ElementType = "div">(props: import("../../utilities/polymorphic").DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "div" : As> & {
7
+ paused?: boolean;
8
+ defaultPaused?: boolean;
9
+ } & {
10
+ side?: import("./Marquee.types").MarqueeSide;
11
+ speed?: number;
12
+ delay?: number;
13
+ loopCount?: number;
14
+ autoFill?: boolean;
15
+ spacing?: string;
16
+ reverse?: boolean;
17
+ pauseOnInteraction?: boolean;
18
+ className?: string;
19
+ }, "as"> & {
20
+ as?: As | undefined;
21
+ } & {
22
+ onPauseChange?: (paused: boolean) => void;
23
+ } & {
24
+ onLoopComplete?: (loops: number) => void;
25
+ onComplete?: () => void;
26
+ } & import("react").RefAttributes<any>) => React.ReactNode) & {
27
+ Root: <As extends React.ElementType = "div">(props: import("../../utilities/polymorphic").DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "div" : As> & {
28
+ paused?: boolean;
29
+ defaultPaused?: boolean;
30
+ } & {
31
+ side?: import("./Marquee.types").MarqueeSide;
32
+ speed?: number;
33
+ delay?: number;
34
+ loopCount?: number;
35
+ autoFill?: boolean;
36
+ spacing?: string;
37
+ reverse?: boolean;
38
+ pauseOnInteraction?: boolean;
39
+ className?: string;
40
+ }, "as"> & {
41
+ as?: As | undefined;
42
+ } & {
43
+ onPauseChange?: (paused: boolean) => void;
44
+ } & {
45
+ onLoopComplete?: (loops: number) => void;
46
+ onComplete?: () => void;
47
+ } & import("react").RefAttributes<any>) => React.ReactNode;
48
+ Viewport: <As extends React.ElementType = "div">(props: import("../../utilities/polymorphic").DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "div" : As> & {
49
+ className?: string;
50
+ }, "as"> & {
51
+ as?: As | undefined;
52
+ } & import("react").RefAttributes<any>) => React.ReactNode;
53
+ Content: <As extends React.ElementType = "div">(props: import("../../utilities/polymorphic").DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "div" : As> & {
54
+ className?: string;
55
+ }, "as"> & {
56
+ as?: As | undefined;
57
+ } & import("react").RefAttributes<any>) => React.ReactNode;
58
+ Item: <As extends React.ElementType = "div">(props: import("../../utilities/polymorphic").DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "div" : As> & {
59
+ className?: string;
60
+ }, "as"> & {
61
+ as?: As | undefined;
62
+ } & import("react").RefAttributes<any>) => React.ReactNode;
63
+ Edge: <As extends React.ElementType = "div">(props: import("../../utilities/polymorphic").DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "div" : As> & {
64
+ side: import("./Marquee.types").MarqueeSide;
65
+ className?: string;
66
+ }, "as"> & {
67
+ as?: As | undefined;
68
+ } & import("react").RefAttributes<any>) => React.ReactNode;
69
+ };
70
+ export { MarqueeViewport, MarqueeContent, MarqueeItem, MarqueeEdge, DEFAULT_MARQUEE_SPEED };
71
+ export { MarqueeContext, useMarqueeContext } from "./MarqueeContext";
72
+ export { useMarquee } from "./useMarquee";
3
73
  export * from "./Marquee.types";
@@ -1,14 +1,2 @@
1
- import type { UseMarqueeOptions, UseMarqueeResult } from "./Marquee.types";
2
- export declare const MARQUEE_SPEEDS: {
3
- slow: number;
4
- medium: number;
5
- fast: number;
6
- };
7
- export declare const MARQUEE_AXES: {
8
- start: "inline";
9
- end: "inline";
10
- top: "block";
11
- bottom: "block";
12
- };
13
- export declare const MARQUEE_MINIMUM_COPIES = 2;
14
- export declare const useMarquee: ({ side, speed, }?: UseMarqueeOptions) => UseMarqueeResult;
1
+ import type { UseMarqueeProps, UseMarqueeReturn } from "./Marquee.types";
2
+ export declare const useMarquee: (props?: UseMarqueeProps) => UseMarqueeReturn;
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ declare const _default: (props: Omit<import("react-resizable-panels").GroupProps, "orientation" | "elementRef" | "groupRef"> & {
3
+ orientation?: import("./Resizable.types").ResizableOrientation;
4
+ resizableRef?: import("react-resizable-panels").GroupProps["groupRef"];
5
+ className?: string;
6
+ } & React.RefAttributes<any>) => React.ReactNode;
7
+ export default _default;
@@ -0,0 +1,23 @@
1
+ import type * as React from "react";
2
+ import type { GroupImperativeHandle, GroupProps, Layout, PanelImperativeHandle, PanelProps, SeparatorProps as PanelSeparatorProps } from "react-resizable-panels";
3
+ export type ResizableOrientation = "horizontal" | "vertical";
4
+ export type ResizableLayout = Layout;
5
+ export type ResizableInstance = GroupImperativeHandle;
6
+ export type ResizablePanelInstance = PanelImperativeHandle;
7
+ export type ResizableProps = Omit<GroupProps, "elementRef" | "groupRef" | "orientation"> & {
8
+ orientation?: ResizableOrientation;
9
+ resizableRef?: GroupProps["groupRef"];
10
+ className?: string;
11
+ };
12
+ export type ResizablePanelProps = Omit<PanelProps, "elementRef"> & {
13
+ className?: string;
14
+ };
15
+ export type ResizableResizeTriggerProps = Omit<PanelSeparatorProps, "elementRef"> & {
16
+ className?: string;
17
+ };
18
+ export type ResizableResizeTriggerSeparatorProps = React.ComponentPropsWithoutRef<"span"> & {
19
+ className?: string;
20
+ };
21
+ export type ResizableResizeTriggerIndicatorProps = React.ComponentPropsWithoutRef<"span"> & {
22
+ className?: string;
23
+ };
@@ -1,10 +1,10 @@
1
- import SplitterPanel from "./SplitterPanel";
2
- import SplitterResizeTrigger from "./SplitterResizeTrigger";
3
- import SplitterResizeTriggerIndicator from "./SplitterResizeTriggerIndicator";
4
- import SplitterResizeTriggerSeparator from "./SplitterResizeTriggerSeparator";
5
- export declare const Splitter: ((props: Omit<import("react-resizable-panels").GroupProps, "orientation" | "groupRef" | "elementRef"> & {
6
- orientation?: import("./Splitter.types").SplitterOrientation;
7
- splitterRef?: import("react-resizable-panels").GroupProps["groupRef"];
1
+ import ResizablePanel from "./ResizablePanel";
2
+ import ResizableResizeTrigger from "./ResizableResizeTrigger";
3
+ import ResizableResizeTriggerIndicator from "./ResizableResizeTriggerIndicator";
4
+ import ResizableResizeTriggerSeparator from "./ResizableResizeTriggerSeparator";
5
+ export declare const Resizable: ((props: Omit<import("react-resizable-panels").GroupProps, "orientation" | "elementRef" | "groupRef"> & {
6
+ orientation?: import("./Resizable.types").ResizableOrientation;
7
+ resizableRef?: import("react-resizable-panels").GroupProps["groupRef"];
8
8
  className?: string;
9
9
  } & import("react").RefAttributes<any>) => React.ReactNode) & {
10
10
  Panel: (props: Omit<import("react-resizable-panels").PanelProps, "elementRef"> & {
@@ -20,5 +20,5 @@ export declare const Splitter: ((props: Omit<import("react-resizable-panels").Gr
20
20
  className?: string;
21
21
  } & import("react").RefAttributes<any>) => React.ReactNode;
22
22
  };
23
- export { SplitterPanel, SplitterResizeTrigger, SplitterResizeTriggerSeparator, SplitterResizeTriggerIndicator, };
24
- export * from "./Splitter.types";
23
+ export { ResizablePanel, ResizableResizeTrigger, ResizableResizeTriggerSeparator, ResizableResizeTriggerIndicator, };
24
+ export * from "./Resizable.types";
@@ -1,7 +1,18 @@
1
1
  import * as React from "react";
2
- declare const DEFAULT_LABEL = "Table of contents";
3
- export { DEFAULT_LABEL };
4
- declare const _default: (props: Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & {
2
+ declare const _default: <As extends React.ElementType = "div">(props: import("../../utilities/polymorphic").DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "div" : As> & {
3
+ items?: import("./TableOfContents.types").TableOfContentsItemData[];
4
+ activeIds?: string[];
5
+ defaultActiveIds?: string[];
6
+ rootMargin?: string;
7
+ threshold?: number | number[];
8
+ scrollElement?: HTMLElement | null;
9
+ scrollBehavior?: ScrollBehavior;
10
+ } & {
11
+ autoScroll?: boolean;
5
12
  className?: string;
13
+ }, "as"> & {
14
+ as?: As | undefined;
15
+ } & {
16
+ onActiveChange?: (details: import("./TableOfContents.types").TableOfContentsActiveChangeDetails) => void;
6
17
  } & React.RefAttributes<any>) => React.ReactNode;
7
18
  export default _default;
@@ -1,32 +1,91 @@
1
1
  import type * as React from "react";
2
2
  import type { PolymorphicProps } from "../../utilities/polymorphic";
3
- export type TableOfContentsProps = React.ComponentPropsWithoutRef<"nav"> & {
3
+ export type TableOfContentsItemData = {
4
+ value: string;
5
+ depth: number;
6
+ };
7
+ export type TableOfContentsActiveChangeDetails = {
8
+ activeIds: string[];
9
+ activeItems: TableOfContentsItemData[];
10
+ };
11
+ export type TableOfContentsScrollToDetails = {
12
+ behavior?: ScrollBehavior;
13
+ };
14
+ export type TableOfContentsItemState = {
15
+ active: boolean;
16
+ first: boolean;
17
+ last: boolean;
18
+ depth: number;
19
+ };
20
+ type TableOfContentsStoreProps = {
21
+ items?: TableOfContentsItemData[];
22
+ activeIds?: string[];
23
+ defaultActiveIds?: string[];
24
+ rootMargin?: string;
25
+ threshold?: number | number[];
26
+ scrollElement?: HTMLElement | null;
27
+ scrollBehavior?: ScrollBehavior;
28
+ };
29
+ type TableOfContentsCallbacks = {
30
+ onActiveChange?: (details: TableOfContentsActiveChangeDetails) => void;
31
+ };
32
+ export type UseTableOfContentsProps = TableOfContentsStoreProps & TableOfContentsCallbacks;
33
+ export type UseTableOfContentsReturn = {
34
+ items: TableOfContentsItemData[];
35
+ activeIds: string[];
36
+ activeItems: TableOfContentsItemData[];
37
+ setActiveIds: (activeIds: string[]) => void;
38
+ scrollTo: (value: string, details?: TableOfContentsScrollToDetails) => boolean;
39
+ getItemState: (item: TableOfContentsItemData) => TableOfContentsItemState;
40
+ };
41
+ export type TableOfContentsIds = {
42
+ root: string;
43
+ title: string;
44
+ list: string;
45
+ indicator: string;
46
+ item: (value: string) => string;
47
+ link: (value: string) => string;
48
+ };
49
+ export type TableOfContentsContextValue = Partial<UseTableOfContentsReturn> & {
50
+ ids?: TableOfContentsIds;
51
+ scrollElement?: HTMLElement | null;
52
+ setScrollElement?: (element: HTMLElement | null) => void;
53
+ hasTitle?: boolean;
54
+ setHasTitle?: (hasTitle: boolean) => void;
55
+ };
56
+ type TableOfContentsOwnProps = TableOfContentsStoreProps & {
57
+ autoScroll?: boolean;
4
58
  className?: string;
5
59
  };
6
- export type TableOfContentsTitleProps<As extends React.ElementType = "p"> = PolymorphicProps<As, "p", {
60
+ export type TableOfContentsProps<As extends React.ElementType = "div"> = PolymorphicProps<As, "div", TableOfContentsOwnProps> & TableOfContentsCallbacks;
61
+ export type TableOfContentsElementProps = TableOfContentsProps<"div">;
62
+ export type TableOfContentsContentProps<As extends React.ElementType = "article"> = PolymorphicProps<As, "article", {
7
63
  className?: string;
8
64
  }>;
9
- export type TableOfContentsListProps = Omit<React.ComponentPropsWithoutRef<"ul">, "role"> & {
65
+ export type TableOfContentsNavProps<As extends React.ElementType = "nav"> = PolymorphicProps<As, "nav", {
66
+ placement?: "start" | "end";
10
67
  className?: string;
11
- };
12
- export type TableOfContentsItemProps<As extends React.ElementType = "a"> = PolymorphicProps<As, "a", {
13
- active?: boolean;
68
+ }>;
69
+ export type TableOfContentsTitleProps<As extends React.ElementType = "h2"> = PolymorphicProps<As, "h2", {
14
70
  className?: string;
15
71
  }>;
16
- export type TableOfContentsGroupProps = Omit<React.ComponentPropsWithoutRef<"li">, "onClick"> & {
17
- label: string;
18
- href?: string;
19
- active?: boolean;
20
- onClick?: React.MouseEventHandler<HTMLAnchorElement>;
72
+ export type TableOfContentsListProps<As extends React.ElementType = "ul"> = PolymorphicProps<As, "ul", {
21
73
  className?: string;
74
+ }>;
75
+ export type TableOfContentsItemProps<As extends React.ElementType = "li"> = PolymorphicProps<As, "li", {
76
+ item: TableOfContentsItemData;
77
+ className?: string;
78
+ }>;
79
+ export type TableOfContentsLinkProps<As extends React.ElementType = "a"> = PolymorphicProps<As, "a", {
80
+ className?: string;
81
+ }>;
82
+ export type TableOfContentsIndicatorProps<As extends React.ElementType = "div"> = PolymorphicProps<As, "div", {
83
+ className?: string;
84
+ }>;
85
+ export type TableOfContentsRect = {
86
+ x: number;
87
+ y: number;
88
+ width: number;
89
+ height: number;
22
90
  };
23
- export type UseTableOfContentsActiveIdOptions = {
24
- ids: string[];
25
- offset?: number;
26
- root?: Element | null;
27
- trackHash?: boolean;
28
- };
29
- export type UseTableOfContentsActiveIdResult = {
30
- activeId: string | null;
31
- selectSection: (id: string) => void;
32
- };
91
+ export {};
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ declare const _default: <As extends React.ElementType = "article">(props: import("../../utilities/polymorphic").DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "article" : As> & {
3
+ className?: string;
4
+ }, "as"> & {
5
+ as?: As | undefined;
6
+ } & React.RefAttributes<any>) => React.ReactNode;
7
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import type { TableOfContentsContextValue, TableOfContentsItemData } from "./TableOfContents.types";
2
+ export declare const TableOfContentsContext: import("react").Context<TableOfContentsContextValue>;
3
+ export declare const useTableOfContentsContext: () => TableOfContentsContextValue;
4
+ export declare const TableOfContentsItemContext: import("react").Context<TableOfContentsItemData | null>;
5
+ export declare const useTableOfContentsItemContext: () => TableOfContentsItemData | null;
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ declare const _default: <As extends React.ElementType = "div">(props: import("../../utilities/polymorphic").DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "div" : As> & {
3
+ className?: string;
4
+ }, "as"> & {
5
+ as?: As | undefined;
6
+ } & React.RefAttributes<any>) => React.ReactNode;
7
+ export default _default;
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
- declare const _default: <As extends React.ElementType = "a">(props: import("../../utilities/polymorphic").DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & {
3
- active?: boolean;
2
+ declare const _default: <As extends React.ElementType = "li">(props: import("../../utilities/polymorphic").DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "li" : As> & {
3
+ item: import("./TableOfContents.types").TableOfContentsItemData;
4
4
  className?: string;
5
5
  }, "as"> & {
6
6
  as?: As | undefined;
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ declare const _default: <As extends React.ElementType = "a">(props: import("../../utilities/polymorphic").DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "a" : As> & {
3
+ className?: string;
4
+ }, "as"> & {
5
+ as?: As | undefined;
6
+ } & React.RefAttributes<any>) => React.ReactNode;
7
+ export default _default;
@@ -1,5 +1,7 @@
1
1
  import * as React from "react";
2
- declare const _default: (props: Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "ref">, "role"> & {
2
+ declare const _default: <As extends React.ElementType = "ul">(props: import("../../utilities/polymorphic").DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "ul" : As> & {
3
3
  className?: string;
4
+ }, "as"> & {
5
+ as?: As | undefined;
4
6
  } & React.RefAttributes<any>) => React.ReactNode;
5
7
  export default _default;
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ declare const _default: <As extends React.ElementType = "nav">(props: import("../../utilities/polymorphic").DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "nav" : As> & {
3
+ placement?: "start" | "end";
4
+ className?: string;
5
+ }, "as"> & {
6
+ as?: As | undefined;
7
+ } & React.RefAttributes<any>) => React.ReactNode;
8
+ export default _default;
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- declare const _default: <As extends React.ElementType = "p">(props: import("../../utilities/polymorphic").DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "p" : As> & {
2
+ declare const _default: <As extends React.ElementType = "h2">(props: import("../../utilities/polymorphic").DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "h2" : As> & {
3
3
  className?: string;
4
4
  }, "as"> & {
5
5
  as?: As | undefined;
@@ -0,0 +1,12 @@
1
+ import type * as React from "react";
2
+ import type { TableOfContentsRect } from "./TableOfContents.types";
3
+ export declare const getHeadingElement: (value: string) => HTMLElement | null;
4
+ export declare const scrollToHeading: (value: string, options?: {
5
+ scrollElement?: HTMLElement | null;
6
+ behavior?: ScrollBehavior;
7
+ }) => boolean;
8
+ export declare const getSamePageHash: (anchor: HTMLElement) => string | null;
9
+ export declare const pushHash: (value: string) => void;
10
+ export declare const isPlainClick: (event: React.MouseEvent<HTMLElement>) => boolean;
11
+ export declare const isEmptyRect: (rect: TableOfContentsRect | null) => boolean;
12
+ export declare const isSameRect: (one: TableOfContentsRect | null, other: TableOfContentsRect) => boolean;
@@ -1,32 +1,82 @@
1
- import TableOfContentsGroup from "./TableOfContentsGroup";
1
+ import TableOfContentsContent from "./TableOfContentsContent";
2
+ import TableOfContentsIndicator from "./TableOfContentsIndicator";
2
3
  import TableOfContentsItem from "./TableOfContentsItem";
4
+ import TableOfContentsLink from "./TableOfContentsLink";
3
5
  import TableOfContentsList from "./TableOfContentsList";
6
+ import TableOfContentsNav from "./TableOfContentsNav";
4
7
  import TableOfContentsTitle from "./TableOfContentsTitle";
5
- export declare const TableOfContents: ((props: Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & {
8
+ export declare const TableOfContents: (<As extends React.ElementType = "div">(props: import("../../utilities/polymorphic").DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "div" : As> & {
9
+ items?: import("./TableOfContents.types").TableOfContentsItemData[];
10
+ activeIds?: string[];
11
+ defaultActiveIds?: string[];
12
+ rootMargin?: string;
13
+ threshold?: number | number[];
14
+ scrollElement?: HTMLElement | null;
15
+ scrollBehavior?: ScrollBehavior;
16
+ } & {
17
+ autoScroll?: boolean;
6
18
  className?: string;
19
+ }, "as"> & {
20
+ as?: As | undefined;
21
+ } & {
22
+ onActiveChange?: (details: import("./TableOfContents.types").TableOfContentsActiveChangeDetails) => void;
7
23
  } & import("react").RefAttributes<any>) => React.ReactNode) & {
8
- Title: <As extends React.ElementType = "p">(props: import("../../utilities/polymorphic").DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "p" : As> & {
24
+ Root: <As extends React.ElementType = "div">(props: import("../../utilities/polymorphic").DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "div" : As> & {
25
+ items?: import("./TableOfContents.types").TableOfContentsItemData[];
26
+ activeIds?: string[];
27
+ defaultActiveIds?: string[];
28
+ rootMargin?: string;
29
+ threshold?: number | number[];
30
+ scrollElement?: HTMLElement | null;
31
+ scrollBehavior?: ScrollBehavior;
32
+ } & {
33
+ autoScroll?: boolean;
9
34
  className?: string;
10
35
  }, "as"> & {
11
36
  as?: As | undefined;
37
+ } & {
38
+ onActiveChange?: (details: import("./TableOfContents.types").TableOfContentsActiveChangeDetails) => void;
12
39
  } & import("react").RefAttributes<any>) => React.ReactNode;
13
- List: (props: Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "ref">, "role"> & {
40
+ Content: <As extends React.ElementType = "article">(props: import("../../utilities/polymorphic").DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "article" : As> & {
14
41
  className?: string;
42
+ }, "as"> & {
43
+ as?: As | undefined;
44
+ } & import("react").RefAttributes<any>) => React.ReactNode;
45
+ Nav: <As extends React.ElementType = "nav">(props: import("../../utilities/polymorphic").DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "nav" : As> & {
46
+ placement?: "start" | "end";
47
+ className?: string;
48
+ }, "as"> & {
49
+ as?: As | undefined;
50
+ } & import("react").RefAttributes<any>) => React.ReactNode;
51
+ Title: <As extends React.ElementType = "h2">(props: import("../../utilities/polymorphic").DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "h2" : As> & {
52
+ className?: string;
53
+ }, "as"> & {
54
+ as?: As | undefined;
15
55
  } & import("react").RefAttributes<any>) => React.ReactNode;
16
- Item: <As extends React.ElementType = "a">(props: import("../../utilities/polymorphic").DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "a" : As> & {
17
- active?: boolean;
56
+ List: <As extends React.ElementType = "ul">(props: import("../../utilities/polymorphic").DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "ul" : As> & {
18
57
  className?: string;
19
58
  }, "as"> & {
20
59
  as?: As | undefined;
21
60
  } & import("react").RefAttributes<any>) => React.ReactNode;
22
- Group: (props: Omit<Omit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref">, "onClick"> & {
23
- label: string;
24
- href?: string;
25
- active?: boolean;
26
- onClick?: React.MouseEventHandler<HTMLAnchorElement>;
61
+ Item: <As extends React.ElementType = "li">(props: import("../../utilities/polymorphic").DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "li" : As> & {
62
+ item: import("./TableOfContents.types").TableOfContentsItemData;
27
63
  className?: string;
64
+ }, "as"> & {
65
+ as?: As | undefined;
66
+ } & import("react").RefAttributes<any>) => React.ReactNode;
67
+ Link: <As extends React.ElementType = "a">(props: import("../../utilities/polymorphic").DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "a" : As> & {
68
+ className?: string;
69
+ }, "as"> & {
70
+ as?: As | undefined;
71
+ } & import("react").RefAttributes<any>) => React.ReactNode;
72
+ Indicator: <As extends React.ElementType = "div">(props: import("../../utilities/polymorphic").DistributiveOmit<import("react").ComponentPropsWithRef<import("react").ElementType extends As ? "div" : As> & {
73
+ className?: string;
74
+ }, "as"> & {
75
+ as?: As | undefined;
28
76
  } & import("react").RefAttributes<any>) => React.ReactNode;
29
77
  };
30
- export { TableOfContentsTitle, TableOfContentsList, TableOfContentsItem, TableOfContentsGroup };
31
- export { useTableOfContentsActiveId } from "./useTableOfContentsActiveId";
78
+ export { TableOfContentsContent, TableOfContentsNav, TableOfContentsTitle, TableOfContentsList, TableOfContentsItem, TableOfContentsLink, TableOfContentsIndicator, };
79
+ export { TableOfContentsContext, useTableOfContentsContext, TableOfContentsItemContext, useTableOfContentsItemContext, } from "./TableOfContentsContext";
80
+ export { useTableOfContents, DEFAULT_TABLE_OF_CONTENTS_ROOT_MARGIN } from "./useTableOfContents";
81
+ export { scrollToHeading } from "./headingScroll";
32
82
  export * from "./TableOfContents.types";
@@ -0,0 +1,3 @@
1
+ import type { UseTableOfContentsProps, UseTableOfContentsReturn } from "./TableOfContents.types";
2
+ export declare const DEFAULT_TABLE_OF_CONTENTS_ROOT_MARGIN = "-20px 0% -40% 0%";
3
+ export declare const useTableOfContents: (props?: UseTableOfContentsProps) => UseTableOfContentsReturn;
@@ -0,0 +1,16 @@
1
+ import * as React from "react";
2
+ declare const _default: <As extends React.ElementType = "div">(props: import("../../utilities/polymorphic").DistributiveOmit<React.ComponentPropsWithRef<React.ElementType extends As ? "div" : As> & {
3
+ countdown?: boolean;
4
+ startMs?: number;
5
+ targetMs?: number;
6
+ interval?: number;
7
+ autoStart?: boolean;
8
+ } & {
9
+ className?: string;
10
+ }, "as"> & {
11
+ as?: As | undefined;
12
+ } & {
13
+ onTick?: (details: import("./Timer.types").TimerTickDetails) => void;
14
+ onComplete?: () => void;
15
+ } & React.RefAttributes<any>) => React.ReactNode;
16
+ export default _default;