@refraction-ui/react 0.18.3 → 0.19.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 (108) hide show
  1. package/dist/dist-IBD7CHHX.js +649 -0
  2. package/dist/dist-IBD7CHHX.js.map +1 -0
  3. package/dist/index.cjs +6830 -3824
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.cts +5 -0
  6. package/dist/index.d.ts +5 -0
  7. package/dist/index.js +4866 -2612
  8. package/dist/index.js.map +1 -1
  9. package/dist/internal/ai/index.d.cts +111 -0
  10. package/dist/internal/ai/index.d.ts +111 -0
  11. package/dist/internal/analytics/index.d.cts +6 -0
  12. package/dist/internal/analytics/index.d.ts +6 -0
  13. package/dist/internal/calendar/index.d.cts +5 -3
  14. package/dist/internal/calendar/index.d.ts +5 -3
  15. package/dist/internal/call-controls/index.d.ts +1 -3
  16. package/dist/internal/charts/index.d.cts +95 -0
  17. package/dist/internal/charts/index.d.ts +95 -0
  18. package/dist/internal/command-input/index.d.cts +41 -0
  19. package/dist/internal/command-input/index.d.ts +41 -0
  20. package/dist/internal/conversation/index.d.cts +2 -0
  21. package/dist/internal/conversation/index.d.ts +2 -0
  22. package/dist/internal/date-picker/index.d.cts +2 -0
  23. package/dist/internal/date-picker/index.d.ts +2 -0
  24. package/dist/internal/device-frame/index.d.cts +1 -3
  25. package/dist/internal/device-frame/index.d.ts +1 -3
  26. package/dist/internal/diff-viewer/index.d.cts +118 -0
  27. package/dist/internal/diff-viewer/index.d.ts +118 -0
  28. package/dist/internal/emoji-picker/index.d.cts +1 -3
  29. package/dist/internal/emoji-picker/index.d.ts +1 -3
  30. package/dist/internal/file-tree/index.d.cts +125 -0
  31. package/dist/internal/file-tree/index.d.ts +125 -0
  32. package/dist/internal/footer/index.d.cts +2 -0
  33. package/dist/internal/footer/index.d.ts +2 -0
  34. package/dist/internal/logger/index.d.cts +4 -0
  35. package/dist/internal/logger/index.d.ts +4 -0
  36. package/dist/internal/presence-indicator/index.d.cts +1 -3
  37. package/dist/internal/presence-indicator/index.d.ts +1 -3
  38. package/dist/internal/react-ai/index.d.cts +59 -0
  39. package/dist/internal/react-ai/index.d.ts +59 -0
  40. package/dist/internal/react-app-shell/index.d.cts +7 -51
  41. package/dist/internal/react-app-shell/index.d.ts +7 -51
  42. package/dist/internal/react-avatar-group/index.d.cts +1 -21
  43. package/dist/internal/react-avatar-group/index.d.ts +1 -21
  44. package/dist/internal/react-calendar/index.d.cts +2 -27
  45. package/dist/internal/react-calendar/index.d.ts +2 -27
  46. package/dist/internal/react-charts/index.d.cts +118 -0
  47. package/dist/internal/react-charts/index.d.ts +118 -0
  48. package/dist/internal/react-command/index.d.cts +1 -1
  49. package/dist/internal/react-command/index.d.ts +1 -1
  50. package/dist/internal/react-command-input/index.d.cts +21 -0
  51. package/dist/internal/react-command-input/index.d.ts +21 -0
  52. package/dist/internal/react-conversation/index.d.cts +2 -6
  53. package/dist/internal/react-conversation/index.d.ts +2 -6
  54. package/dist/internal/react-cookie-consent/index.d.cts +1 -6
  55. package/dist/internal/react-cookie-consent/index.d.ts +1 -6
  56. package/dist/internal/react-device-frame/index.d.cts +1 -25
  57. package/dist/internal/react-device-frame/index.d.ts +1 -25
  58. package/dist/internal/react-diff-viewer/index.d.cts +45 -0
  59. package/dist/internal/react-diff-viewer/index.d.ts +45 -0
  60. package/dist/internal/react-dropdown-menu/index.d.cts +1 -1
  61. package/dist/internal/react-dropdown-menu/index.d.ts +1 -1
  62. package/dist/internal/react-emoji-picker/index.d.cts +1 -5
  63. package/dist/internal/react-emoji-picker/index.d.ts +1 -5
  64. package/dist/internal/react-file-tree/index.d.cts +30 -3
  65. package/dist/internal/react-file-tree/index.d.ts +30 -3
  66. package/dist/internal/react-file-upload/index.d.cts +1 -6
  67. package/dist/internal/react-file-upload/index.d.ts +1 -6
  68. package/dist/internal/react-inline-editor/index.d.cts +1 -6
  69. package/dist/internal/react-inline-editor/index.d.ts +1 -6
  70. package/dist/internal/react-keyboard-shortcut/index.d.cts +1 -1
  71. package/dist/internal/react-keyboard-shortcut/index.d.ts +1 -1
  72. package/dist/internal/react-language-selector/index.d.cts +2 -13
  73. package/dist/internal/react-language-selector/index.d.ts +2 -13
  74. package/dist/internal/react-location-selector/index.d.cts +12 -0
  75. package/dist/internal/react-location-selector/index.d.ts +12 -0
  76. package/dist/internal/react-pagination/index.d.ts +22 -1
  77. package/dist/internal/react-presence-indicator/index.d.cts +1 -21
  78. package/dist/internal/react-presence-indicator/index.d.ts +1 -21
  79. package/dist/internal/react-radio/index.d.ts +2 -17
  80. package/dist/internal/react-reaction-bar/index.d.cts +1 -21
  81. package/dist/internal/react-reaction-bar/index.d.ts +1 -21
  82. package/dist/internal/react-search-bar/index.d.cts +1 -12
  83. package/dist/internal/react-search-bar/index.d.ts +1 -12
  84. package/dist/internal/react-slider/index.d.cts +22 -1
  85. package/dist/internal/react-slider/index.d.ts +22 -1
  86. package/dist/internal/react-status-indicator/index.d.cts +1 -5
  87. package/dist/internal/react-status-indicator/index.d.ts +1 -5
  88. package/dist/internal/react-tabs/index.d.cts +2 -8
  89. package/dist/internal/react-tabs/index.d.ts +2 -8
  90. package/dist/internal/react-thread-view/index.d.cts +1 -21
  91. package/dist/internal/react-thread-view/index.d.ts +1 -21
  92. package/dist/internal/react-version-selector/index.d.cts +2 -12
  93. package/dist/internal/react-version-selector/index.d.ts +2 -12
  94. package/dist/internal/reaction-bar/index.d.cts +1 -3
  95. package/dist/internal/reaction-bar/index.d.ts +1 -3
  96. package/dist/internal/status-indicator/index.d.cts +1 -3
  97. package/dist/internal/status-indicator/index.d.ts +1 -3
  98. package/dist/internal/thread-view/index.d.cts +3 -5
  99. package/dist/internal/thread-view/index.d.ts +3 -5
  100. package/dist/internal/toast/index.d.cts +7 -1
  101. package/dist/internal/toast/index.d.ts +7 -1
  102. package/dist/internal/voice-pill/index.d.cts +2 -2
  103. package/dist/internal/voice-pill/index.d.ts +2 -2
  104. package/dist/theme.cjs +10 -10
  105. package/dist/theme.cjs.map +1 -1
  106. package/dist/theme.js +10 -10
  107. package/dist/theme.js.map +1 -1
  108. package/package.json +2 -1
@@ -1,5 +1,3 @@
1
- import { AccessibilityProps } from '../shared/index.js';
2
-
3
1
  type DeviceType = 'iphone' | 'ipad' | 'android-phone' | 'android-tablet';
4
2
  type DeviceOrientation = 'portrait' | 'landscape';
5
3
  interface DeviceFrameProps {
@@ -24,7 +22,7 @@ interface DeviceFrameAPI {
24
22
  /** Computed dimensions for the device */
25
23
  dimensions: DeviceDimensions;
26
24
  /** ARIA attributes for the device frame */
27
- ariaProps: Partial<AccessibilityProps> & Record<string, unknown>;
25
+ ariaProps: Record<string, string | number | boolean>;
28
26
  /** Data attributes for styling hooks */
29
27
  dataAttributes: Record<string, string>;
30
28
  }
@@ -0,0 +1,118 @@
1
+ import { AccessibilityProps, TokenContract } from '../shared/index.cjs';
2
+
3
+ type DiffViewerTheme = 'light' | 'dark';
4
+ type DiffViewMode = 'side-by-side' | 'inline';
5
+ type DiffFileStatus = 'added' | 'modified' | 'deleted' | 'renamed';
6
+ interface DiffFile {
7
+ /** File path */
8
+ path: string;
9
+ /** Change status */
10
+ status: DiffFileStatus;
11
+ /** Lines added */
12
+ additions: number;
13
+ /** Lines deleted */
14
+ deletions: number;
15
+ /** Unified diff content for this file */
16
+ diff?: string;
17
+ /** Old path for renamed files */
18
+ oldPath?: string;
19
+ }
20
+ interface DiffViewerProps {
21
+ /** Files in this diff */
22
+ files?: DiffFile[];
23
+ /** Index of the active file */
24
+ activeFileIndex?: number;
25
+ /** View mode */
26
+ viewMode?: DiffViewMode;
27
+ /** Theme */
28
+ theme?: DiffViewerTheme;
29
+ /** Language for syntax highlighting */
30
+ language?: string;
31
+ /** Whether the sidebar is visible */
32
+ sidebarOpen?: boolean;
33
+ /** Callback when active file changes */
34
+ onFileSelect?: (index: number) => void;
35
+ /** Callback when view mode changes */
36
+ onViewModeChange?: (mode: DiffViewMode) => void;
37
+ /** Callback when sidebar toggled */
38
+ onSidebarToggle?: () => void;
39
+ }
40
+ interface DiffViewerState {
41
+ activeFileIndex: number;
42
+ viewMode: DiffViewMode;
43
+ theme: DiffViewerTheme;
44
+ language: string;
45
+ sidebarOpen: boolean;
46
+ files: DiffFile[];
47
+ }
48
+ interface DiffViewerAPI {
49
+ /** Current viewer state */
50
+ state: DiffViewerState;
51
+ /** ARIA attributes for the root element */
52
+ ariaProps: Partial<AccessibilityProps> & Record<string, unknown>;
53
+ /** Data attributes for CSS styling hooks */
54
+ dataAttributes: Record<string, string>;
55
+ /** Select a file by index */
56
+ selectFile: (index: number) => void;
57
+ /** Move to next file */
58
+ nextFile: () => void;
59
+ /** Move to previous file */
60
+ prevFile: () => void;
61
+ /** Toggle view mode */
62
+ toggleViewMode: () => void;
63
+ /** Toggle sidebar */
64
+ toggleSidebar: () => void;
65
+ /** Get language label for a file path */
66
+ getLanguageForFile: (path: string) => string;
67
+ /** Get human-readable file status icon */
68
+ getFileStatusIcon: (status: DiffFileStatus) => string;
69
+ /** Get total additions across all files */
70
+ totalAdditions: () => number;
71
+ /** Get total deletions across all files */
72
+ totalDeletions: () => number;
73
+ }
74
+ /**
75
+ * Create a headless diff viewer API.
76
+ *
77
+ * Manages file selection, view mode, sidebar state, and produces ARIA/data
78
+ * attributes. The actual rendering (Monaco DiffEditor, custom renderer, etc.)
79
+ * is handled by framework-specific wrappers.
80
+ */
81
+ declare function createDiffViewer(props?: DiffViewerProps): DiffViewerAPI;
82
+
83
+ declare const diffViewerTokens: TokenContract;
84
+ declare const diffViewerVariants: (props?: ({
85
+ theme?: "light" | "dark" | undefined;
86
+ fullscreen?: "true" | "false" | undefined;
87
+ } & {
88
+ className?: string;
89
+ }) | undefined) => string;
90
+ declare const sidebarVariants: (props?: ({
91
+ theme?: "light" | "dark" | undefined;
92
+ } & {
93
+ className?: string;
94
+ }) | undefined) => string;
95
+ declare const sidebarItemVariants: (props?: ({
96
+ active?: "true" | "false" | undefined;
97
+ theme?: "light" | "dark" | undefined;
98
+ } & {
99
+ className?: string;
100
+ }) | undefined) => string;
101
+ declare const tabBarVariants: (props?: ({
102
+ theme?: "light" | "dark" | undefined;
103
+ } & {
104
+ className?: string;
105
+ }) | undefined) => string;
106
+ declare const tabVariants: (props?: ({
107
+ active?: "true" | "false" | undefined;
108
+ theme?: "light" | "dark" | undefined;
109
+ } & {
110
+ className?: string;
111
+ }) | undefined) => string;
112
+ declare const statusBarVariants: (props?: ({
113
+ theme?: "light" | "dark" | undefined;
114
+ } & {
115
+ className?: string;
116
+ }) | undefined) => string;
117
+
118
+ export { type DiffFile, type DiffFileStatus, type DiffViewMode, type DiffViewerAPI, type DiffViewerProps, type DiffViewerState, type DiffViewerTheme, createDiffViewer, diffViewerTokens, diffViewerVariants, sidebarItemVariants, sidebarVariants, statusBarVariants, tabBarVariants, tabVariants };
@@ -0,0 +1,118 @@
1
+ import { AccessibilityProps, TokenContract } from '../shared/index.js';
2
+
3
+ type DiffViewerTheme = 'light' | 'dark';
4
+ type DiffViewMode = 'side-by-side' | 'inline';
5
+ type DiffFileStatus = 'added' | 'modified' | 'deleted' | 'renamed';
6
+ interface DiffFile {
7
+ /** File path */
8
+ path: string;
9
+ /** Change status */
10
+ status: DiffFileStatus;
11
+ /** Lines added */
12
+ additions: number;
13
+ /** Lines deleted */
14
+ deletions: number;
15
+ /** Unified diff content for this file */
16
+ diff?: string;
17
+ /** Old path for renamed files */
18
+ oldPath?: string;
19
+ }
20
+ interface DiffViewerProps {
21
+ /** Files in this diff */
22
+ files?: DiffFile[];
23
+ /** Index of the active file */
24
+ activeFileIndex?: number;
25
+ /** View mode */
26
+ viewMode?: DiffViewMode;
27
+ /** Theme */
28
+ theme?: DiffViewerTheme;
29
+ /** Language for syntax highlighting */
30
+ language?: string;
31
+ /** Whether the sidebar is visible */
32
+ sidebarOpen?: boolean;
33
+ /** Callback when active file changes */
34
+ onFileSelect?: (index: number) => void;
35
+ /** Callback when view mode changes */
36
+ onViewModeChange?: (mode: DiffViewMode) => void;
37
+ /** Callback when sidebar toggled */
38
+ onSidebarToggle?: () => void;
39
+ }
40
+ interface DiffViewerState {
41
+ activeFileIndex: number;
42
+ viewMode: DiffViewMode;
43
+ theme: DiffViewerTheme;
44
+ language: string;
45
+ sidebarOpen: boolean;
46
+ files: DiffFile[];
47
+ }
48
+ interface DiffViewerAPI {
49
+ /** Current viewer state */
50
+ state: DiffViewerState;
51
+ /** ARIA attributes for the root element */
52
+ ariaProps: Partial<AccessibilityProps> & Record<string, unknown>;
53
+ /** Data attributes for CSS styling hooks */
54
+ dataAttributes: Record<string, string>;
55
+ /** Select a file by index */
56
+ selectFile: (index: number) => void;
57
+ /** Move to next file */
58
+ nextFile: () => void;
59
+ /** Move to previous file */
60
+ prevFile: () => void;
61
+ /** Toggle view mode */
62
+ toggleViewMode: () => void;
63
+ /** Toggle sidebar */
64
+ toggleSidebar: () => void;
65
+ /** Get language label for a file path */
66
+ getLanguageForFile: (path: string) => string;
67
+ /** Get human-readable file status icon */
68
+ getFileStatusIcon: (status: DiffFileStatus) => string;
69
+ /** Get total additions across all files */
70
+ totalAdditions: () => number;
71
+ /** Get total deletions across all files */
72
+ totalDeletions: () => number;
73
+ }
74
+ /**
75
+ * Create a headless diff viewer API.
76
+ *
77
+ * Manages file selection, view mode, sidebar state, and produces ARIA/data
78
+ * attributes. The actual rendering (Monaco DiffEditor, custom renderer, etc.)
79
+ * is handled by framework-specific wrappers.
80
+ */
81
+ declare function createDiffViewer(props?: DiffViewerProps): DiffViewerAPI;
82
+
83
+ declare const diffViewerTokens: TokenContract;
84
+ declare const diffViewerVariants: (props?: ({
85
+ theme?: "light" | "dark" | undefined;
86
+ fullscreen?: "true" | "false" | undefined;
87
+ } & {
88
+ className?: string;
89
+ }) | undefined) => string;
90
+ declare const sidebarVariants: (props?: ({
91
+ theme?: "light" | "dark" | undefined;
92
+ } & {
93
+ className?: string;
94
+ }) | undefined) => string;
95
+ declare const sidebarItemVariants: (props?: ({
96
+ active?: "true" | "false" | undefined;
97
+ theme?: "light" | "dark" | undefined;
98
+ } & {
99
+ className?: string;
100
+ }) | undefined) => string;
101
+ declare const tabBarVariants: (props?: ({
102
+ theme?: "light" | "dark" | undefined;
103
+ } & {
104
+ className?: string;
105
+ }) | undefined) => string;
106
+ declare const tabVariants: (props?: ({
107
+ active?: "true" | "false" | undefined;
108
+ theme?: "light" | "dark" | undefined;
109
+ } & {
110
+ className?: string;
111
+ }) | undefined) => string;
112
+ declare const statusBarVariants: (props?: ({
113
+ theme?: "light" | "dark" | undefined;
114
+ } & {
115
+ className?: string;
116
+ }) | undefined) => string;
117
+
118
+ export { type DiffFile, type DiffFileStatus, type DiffViewMode, type DiffViewerAPI, type DiffViewerProps, type DiffViewerState, type DiffViewerTheme, createDiffViewer, diffViewerTokens, diffViewerVariants, sidebarItemVariants, sidebarVariants, statusBarVariants, tabBarVariants, tabVariants };
@@ -1,5 +1,3 @@
1
- import { AccessibilityProps } from '../shared/index.cjs';
2
-
3
1
  type EmojiCategory = 'smileys' | 'people' | 'nature' | 'food' | 'travel' | 'activities' | 'objects' | 'symbols' | 'flags';
4
2
  interface EmojiEntry {
5
3
  /** The rendered glyph (native codepoints). */
@@ -77,7 +75,7 @@ interface EmojiPickerAPI {
77
75
  emoji: string;
78
76
  }[];
79
77
  /** ARIA props for the picker container */
80
- ariaProps: Partial<AccessibilityProps> & Record<string, unknown>;
78
+ ariaProps: Record<string, string | number | boolean>;
81
79
  /** ARIA props for the search input */
82
80
  searchInputProps: Record<string, unknown>;
83
81
  /** Get ARIA props for an emoji button */
@@ -1,5 +1,3 @@
1
- import { AccessibilityProps } from '../shared/index.js';
2
-
3
1
  type EmojiCategory = 'smileys' | 'people' | 'nature' | 'food' | 'travel' | 'activities' | 'objects' | 'symbols' | 'flags';
4
2
  interface EmojiEntry {
5
3
  /** The rendered glyph (native codepoints). */
@@ -77,7 +75,7 @@ interface EmojiPickerAPI {
77
75
  emoji: string;
78
76
  }[];
79
77
  /** ARIA props for the picker container */
80
- ariaProps: Partial<AccessibilityProps> & Record<string, unknown>;
78
+ ariaProps: Record<string, string | number | boolean>;
81
79
  /** ARIA props for the search input */
82
80
  searchInputProps: Record<string, unknown>;
83
81
  /** Get ARIA props for an emoji button */
@@ -0,0 +1,125 @@
1
+ /**
2
+ * @refraction-ui/file-tree — headless tree view.
3
+ *
4
+ * Owns the *behavior* of a hierarchical tree: the node model, expand/collapse
5
+ * state, single selection, roving focus, and WAI-ARIA treeview keyboard
6
+ * semantics. It has NO UI opinion — adapters render the nested markup and
7
+ * spread the ARIA objects.
8
+ */
9
+ /** A node in the tree. Parents carry `children`; leaves do not. */
10
+ interface FileTreeNode {
11
+ /** Unique, stable id (used for expansion/selection/focus). */
12
+ id: string;
13
+ /** Display label. */
14
+ label: string;
15
+ /** Child nodes — presence (even empty is not allowed: omit for leaves) marks a parent. */
16
+ children?: FileTreeNode[];
17
+ /** Disabled nodes cannot be selected, toggled, or focused via click. */
18
+ disabled?: boolean;
19
+ }
20
+ /** Options for {@link createFileTree}. */
21
+ interface FileTreeConfig {
22
+ /** Root-level nodes. */
23
+ nodes?: FileTreeNode[];
24
+ /** Controlled expanded node ids. Pair with `onExpandedChange`. */
25
+ expandedIds?: string[];
26
+ /** Uncontrolled initial expanded node ids. */
27
+ defaultExpandedIds?: string[];
28
+ /** Controlled selected node id (`null` = none). Pair with `onSelectionChange`. */
29
+ selectedId?: string | null;
30
+ /** Uncontrolled initial selected node id. */
31
+ defaultSelectedId?: string | null;
32
+ /** Called whenever the expanded set changes. */
33
+ onExpandedChange?: (ids: string[]) => void;
34
+ /** Called whenever the selection changes. */
35
+ onSelectionChange?: (id: string | null) => void;
36
+ /** Accessible label for the tree (default `'File tree'`). */
37
+ 'aria-label'?: string;
38
+ }
39
+ /** Snapshot of the store. Returned by `getState()`; treat as immutable. */
40
+ interface FileTreeState {
41
+ nodes: FileTreeNode[];
42
+ expandedIds: string[];
43
+ selectedId: string | null;
44
+ /** Node holding the roving-tabindex focus (null = the first visible item). */
45
+ focusedId: string | null;
46
+ }
47
+ /** A row of the flattened, currently-visible tree (DFS order). */
48
+ interface VisibleTreeItem {
49
+ node: FileTreeNode;
50
+ /** Id of the parent node, or null for root-level items. */
51
+ parentId: string | null;
52
+ /** 1-based nesting depth (ARIA `aria-level`). */
53
+ depth: number;
54
+ hasChildren: boolean;
55
+ isExpanded: boolean;
56
+ isSelected: boolean;
57
+ isFocused: boolean;
58
+ }
59
+ /** The framework-agnostic store. React/Astro adapters wrap this. */
60
+ interface FileTreeAPI {
61
+ /** Current immutable snapshot */
62
+ getState(): FileTreeState;
63
+ /** Subscribe to changes; returns an unsubscribe fn (suits useSyncExternalStore) */
64
+ subscribe(listener: () => void): () => void;
65
+ /** Flattened visible rows in DFS order (children of collapsed parents omitted) */
66
+ getVisibleItems(): VisibleTreeItem[];
67
+ isExpanded(id: string): boolean;
68
+ /** Toggle a parent's expanded state (no-op for leaves/disabled nodes) */
69
+ toggle(id: string): void;
70
+ expand(id: string): void;
71
+ collapse(id: string): void;
72
+ /** Select a node (`null` clears). No-op for unknown/disabled nodes. */
73
+ select(id: string | null): void;
74
+ /** Move the roving focus to a node */
75
+ focus(id: string | null): void;
76
+ /**
77
+ * WAI-ARIA treeview keyboard semantics, applied to the focused item:
78
+ * ArrowDown/Up move, ArrowRight expands or descends, ArrowLeft collapses or
79
+ * ascends, Home/End jump, Enter/Space selects.
80
+ */
81
+ handleKey(key: string): void;
82
+ /** Replace the node model (adapters sync the prop) */
83
+ setNodes(nodes: FileTreeNode[]): void;
84
+ /** Sync a controlled expanded set */
85
+ setExpandedIds(ids: string[]): void;
86
+ /** Sync a controlled selection */
87
+ setSelectedId(id: string | null): void;
88
+ /** Update callbacks/options after creation */
89
+ setOptions(options: {
90
+ onExpandedChange?: (ids: string[]) => void;
91
+ onSelectionChange?: (id: string | null) => void;
92
+ 'aria-label'?: string;
93
+ }): void;
94
+ /** ARIA attributes for the tree container (`role="tree"`). */
95
+ getTreeAria(): Record<string, string | number | boolean>;
96
+ /** ARIA attributes for one visible row (`role="treeitem"`). */
97
+ getItemAria(item: VisibleTreeItem): Record<string, string | number | boolean>;
98
+ }
99
+ /**
100
+ * createFileTree — headless tree store with expand/collapse, single
101
+ * selection, roving focus, and treeview keyboard semantics. Supports
102
+ * controlled (`expandedIds` / `selectedId`) and uncontrolled
103
+ * (`defaultExpandedIds` / `defaultSelectedId`) usage.
104
+ */
105
+ declare function createFileTree(config?: FileTreeConfig): FileTreeAPI;
106
+
107
+ /** Tree container. */
108
+ declare const fileTreeVariants: (props?: ({
109
+ [x: string]: string | undefined;
110
+ } & {
111
+ className?: string;
112
+ }) | undefined) => string;
113
+ /**
114
+ * A single tree row (treeitem). The `selected` variant carries the
115
+ * selected-row treatment so adapters never inline these classes.
116
+ */
117
+ declare const fileTreeItemVariants: (props?: ({
118
+ selected?: "true" | "false" | undefined;
119
+ } & {
120
+ className?: string;
121
+ }) | undefined) => string;
122
+ /** Expand/collapse glyph or file marker preceding the label. */
123
+ declare const fileTreeGlyphClass = "w-4 shrink-0 text-center text-muted-foreground";
124
+
125
+ export { type FileTreeAPI, type FileTreeConfig, type FileTreeNode, type FileTreeState, type VisibleTreeItem, createFileTree, fileTreeGlyphClass, fileTreeItemVariants, fileTreeVariants };
@@ -0,0 +1,125 @@
1
+ /**
2
+ * @refraction-ui/file-tree — headless tree view.
3
+ *
4
+ * Owns the *behavior* of a hierarchical tree: the node model, expand/collapse
5
+ * state, single selection, roving focus, and WAI-ARIA treeview keyboard
6
+ * semantics. It has NO UI opinion — adapters render the nested markup and
7
+ * spread the ARIA objects.
8
+ */
9
+ /** A node in the tree. Parents carry `children`; leaves do not. */
10
+ interface FileTreeNode {
11
+ /** Unique, stable id (used for expansion/selection/focus). */
12
+ id: string;
13
+ /** Display label. */
14
+ label: string;
15
+ /** Child nodes — presence (even empty is not allowed: omit for leaves) marks a parent. */
16
+ children?: FileTreeNode[];
17
+ /** Disabled nodes cannot be selected, toggled, or focused via click. */
18
+ disabled?: boolean;
19
+ }
20
+ /** Options for {@link createFileTree}. */
21
+ interface FileTreeConfig {
22
+ /** Root-level nodes. */
23
+ nodes?: FileTreeNode[];
24
+ /** Controlled expanded node ids. Pair with `onExpandedChange`. */
25
+ expandedIds?: string[];
26
+ /** Uncontrolled initial expanded node ids. */
27
+ defaultExpandedIds?: string[];
28
+ /** Controlled selected node id (`null` = none). Pair with `onSelectionChange`. */
29
+ selectedId?: string | null;
30
+ /** Uncontrolled initial selected node id. */
31
+ defaultSelectedId?: string | null;
32
+ /** Called whenever the expanded set changes. */
33
+ onExpandedChange?: (ids: string[]) => void;
34
+ /** Called whenever the selection changes. */
35
+ onSelectionChange?: (id: string | null) => void;
36
+ /** Accessible label for the tree (default `'File tree'`). */
37
+ 'aria-label'?: string;
38
+ }
39
+ /** Snapshot of the store. Returned by `getState()`; treat as immutable. */
40
+ interface FileTreeState {
41
+ nodes: FileTreeNode[];
42
+ expandedIds: string[];
43
+ selectedId: string | null;
44
+ /** Node holding the roving-tabindex focus (null = the first visible item). */
45
+ focusedId: string | null;
46
+ }
47
+ /** A row of the flattened, currently-visible tree (DFS order). */
48
+ interface VisibleTreeItem {
49
+ node: FileTreeNode;
50
+ /** Id of the parent node, or null for root-level items. */
51
+ parentId: string | null;
52
+ /** 1-based nesting depth (ARIA `aria-level`). */
53
+ depth: number;
54
+ hasChildren: boolean;
55
+ isExpanded: boolean;
56
+ isSelected: boolean;
57
+ isFocused: boolean;
58
+ }
59
+ /** The framework-agnostic store. React/Astro adapters wrap this. */
60
+ interface FileTreeAPI {
61
+ /** Current immutable snapshot */
62
+ getState(): FileTreeState;
63
+ /** Subscribe to changes; returns an unsubscribe fn (suits useSyncExternalStore) */
64
+ subscribe(listener: () => void): () => void;
65
+ /** Flattened visible rows in DFS order (children of collapsed parents omitted) */
66
+ getVisibleItems(): VisibleTreeItem[];
67
+ isExpanded(id: string): boolean;
68
+ /** Toggle a parent's expanded state (no-op for leaves/disabled nodes) */
69
+ toggle(id: string): void;
70
+ expand(id: string): void;
71
+ collapse(id: string): void;
72
+ /** Select a node (`null` clears). No-op for unknown/disabled nodes. */
73
+ select(id: string | null): void;
74
+ /** Move the roving focus to a node */
75
+ focus(id: string | null): void;
76
+ /**
77
+ * WAI-ARIA treeview keyboard semantics, applied to the focused item:
78
+ * ArrowDown/Up move, ArrowRight expands or descends, ArrowLeft collapses or
79
+ * ascends, Home/End jump, Enter/Space selects.
80
+ */
81
+ handleKey(key: string): void;
82
+ /** Replace the node model (adapters sync the prop) */
83
+ setNodes(nodes: FileTreeNode[]): void;
84
+ /** Sync a controlled expanded set */
85
+ setExpandedIds(ids: string[]): void;
86
+ /** Sync a controlled selection */
87
+ setSelectedId(id: string | null): void;
88
+ /** Update callbacks/options after creation */
89
+ setOptions(options: {
90
+ onExpandedChange?: (ids: string[]) => void;
91
+ onSelectionChange?: (id: string | null) => void;
92
+ 'aria-label'?: string;
93
+ }): void;
94
+ /** ARIA attributes for the tree container (`role="tree"`). */
95
+ getTreeAria(): Record<string, string | number | boolean>;
96
+ /** ARIA attributes for one visible row (`role="treeitem"`). */
97
+ getItemAria(item: VisibleTreeItem): Record<string, string | number | boolean>;
98
+ }
99
+ /**
100
+ * createFileTree — headless tree store with expand/collapse, single
101
+ * selection, roving focus, and treeview keyboard semantics. Supports
102
+ * controlled (`expandedIds` / `selectedId`) and uncontrolled
103
+ * (`defaultExpandedIds` / `defaultSelectedId`) usage.
104
+ */
105
+ declare function createFileTree(config?: FileTreeConfig): FileTreeAPI;
106
+
107
+ /** Tree container. */
108
+ declare const fileTreeVariants: (props?: ({
109
+ [x: string]: string | undefined;
110
+ } & {
111
+ className?: string;
112
+ }) | undefined) => string;
113
+ /**
114
+ * A single tree row (treeitem). The `selected` variant carries the
115
+ * selected-row treatment so adapters never inline these classes.
116
+ */
117
+ declare const fileTreeItemVariants: (props?: ({
118
+ selected?: "true" | "false" | undefined;
119
+ } & {
120
+ className?: string;
121
+ }) | undefined) => string;
122
+ /** Expand/collapse glyph or file marker preceding the label. */
123
+ declare const fileTreeGlyphClass = "w-4 shrink-0 text-center text-muted-foreground";
124
+
125
+ export { type FileTreeAPI, type FileTreeConfig, type FileTreeNode, type FileTreeState, type VisibleTreeItem, createFileTree, fileTreeGlyphClass, fileTreeItemVariants, fileTreeVariants };
@@ -14,6 +14,8 @@ interface FooterProps {
14
14
  copyright?: string;
15
15
  socialLinks?: SocialLink[];
16
16
  columns?: FooterColumn[];
17
+ /** Year for the default copyrightText. Default: ambient current year — inject to avoid year-boundary SSR/CSR mismatch. */
18
+ year?: number;
17
19
  }
18
20
  interface FooterAPI {
19
21
  ariaProps: Record<string, string>;
@@ -14,6 +14,8 @@ interface FooterProps {
14
14
  copyright?: string;
15
15
  socialLinks?: SocialLink[];
16
16
  columns?: FooterColumn[];
17
+ /** Year for the default copyrightText. Default: ambient current year — inject to avoid year-boundary SSR/CSR mismatch. */
18
+ year?: number;
17
19
  }
18
20
  interface FooterAPI {
19
21
  ariaProps: Record<string, string>;
@@ -74,6 +74,10 @@ interface TelemetryConfig {
74
74
  * PII / secrets, e.g. `['password', 'token', 'authorization']`.
75
75
  */
76
76
  redactKeys?: string[];
77
+ /** Clock for record timestamps and span timing (ms epoch). Default: ambient `Date.now()` — inject for deterministic tests. */
78
+ now?: () => number;
79
+ /** RNG for sample-rate decisions. Default: ambient `Math.random` — inject for deterministic tests. */
80
+ random?: () => number;
77
81
  }
78
82
  /** A logger bound to a context. Child loggers inherit + extend that context. */
79
83
  interface Logger {
@@ -74,6 +74,10 @@ interface TelemetryConfig {
74
74
  * PII / secrets, e.g. `['password', 'token', 'authorization']`.
75
75
  */
76
76
  redactKeys?: string[];
77
+ /** Clock for record timestamps and span timing (ms epoch). Default: ambient `Date.now()` — inject for deterministic tests. */
78
+ now?: () => number;
79
+ /** RNG for sample-rate decisions. Default: ambient `Math.random` — inject for deterministic tests. */
80
+ random?: () => number;
77
81
  }
78
82
  /** A logger bound to a context. Child loggers inherit + extend that context. */
79
83
  interface Logger {
@@ -1,5 +1,3 @@
1
- import { AccessibilityProps } from '../shared/index.cjs';
2
-
3
1
  type PresenceStatus = 'online' | 'offline' | 'away' | 'busy' | 'dnd';
4
2
  interface PresenceProps {
5
3
  /** The presence status to display */
@@ -11,7 +9,7 @@ interface PresenceProps {
11
9
  }
12
10
  interface PresenceAPI {
13
11
  /** ARIA attributes for the indicator */
14
- ariaProps: Partial<AccessibilityProps> & Record<string, unknown>;
12
+ ariaProps: Record<string, string | number | boolean>;
15
13
  /** CSS color for the status dot */
16
14
  color: string;
17
15
  /** Human-readable label for the status */
@@ -1,5 +1,3 @@
1
- import { AccessibilityProps } from '../shared/index.js';
2
-
3
1
  type PresenceStatus = 'online' | 'offline' | 'away' | 'busy' | 'dnd';
4
2
  interface PresenceProps {
5
3
  /** The presence status to display */
@@ -11,7 +9,7 @@ interface PresenceProps {
11
9
  }
12
10
  interface PresenceAPI {
13
11
  /** ARIA attributes for the indicator */
14
- ariaProps: Partial<AccessibilityProps> & Record<string, unknown>;
12
+ ariaProps: Record<string, string | number | boolean>;
15
13
  /** CSS color for the status dot */
16
14
  color: string;
17
15
  /** Human-readable label for the status */
@@ -0,0 +1,59 @@
1
+ import * as React from 'react';
2
+ import { GenerateOptions, AIConfig, AIProvider as AIProvider$1, TTSOptions, TTSConfig, TTSProvider as TTSProvider$1 } from '../ai/index.cjs';
3
+ export { AIProvider as AIProviderInterface, GenerateOptions, RouterFn, TTSOptions, TTSProvider as TTSProviderInterface } from '../ai/index.cjs';
4
+
5
+ interface AIContextValue {
6
+ generateText: (prompt: string, opts?: GenerateOptions) => Promise<string>;
7
+ generateJSON: <T = unknown>(prompt: string, opts?: GenerateOptions) => Promise<T>;
8
+ providers: string[];
9
+ isGenerating: boolean;
10
+ }
11
+ interface AIProviderProps extends AIConfig {
12
+ children: React.ReactNode;
13
+ /** Pre-register providers by name */
14
+ providers?: Record<string, AIProvider$1>;
15
+ }
16
+ /**
17
+ * AIProvider — wraps your app with AI context.
18
+ *
19
+ * ```tsx
20
+ * <AIProvider default="openai" providers={{ openai: myOpenAIProvider }}>
21
+ * <App />
22
+ * </AIProvider>
23
+ * ```
24
+ */
25
+ declare function AIProvider({ children, providers: providerMap, ...config }: AIProviderProps): React.FunctionComponentElement<React.ProviderProps<AIContextValue | null>>;
26
+ /**
27
+ * useAI — access AI generation methods and state.
28
+ * Must be used within <AIProvider>.
29
+ */
30
+ declare function useAI(): AIContextValue;
31
+
32
+ interface TTSContextValue {
33
+ speak: (text: string, opts?: TTSOptions) => void;
34
+ stop: () => void;
35
+ isSpeaking: boolean;
36
+ providers: string[];
37
+ }
38
+ interface TTSProviderProps extends TTSConfig {
39
+ children: React.ReactNode;
40
+ /** Pre-register providers by name */
41
+ providers?: Record<string, TTSProvider$1>;
42
+ }
43
+ /**
44
+ * TTSProvider — wraps your app with TTS context.
45
+ *
46
+ * ```tsx
47
+ * <TTSProvider providers={{ browser: myBrowserTTS }}>
48
+ * <App />
49
+ * </TTSProvider>
50
+ * ```
51
+ */
52
+ declare function TTSProvider({ children, providers: providerMap, ...config }: TTSProviderProps): React.FunctionComponentElement<React.ProviderProps<TTSContextValue | null>>;
53
+ /**
54
+ * useTTS — access TTS methods and state.
55
+ * Must be used within <TTSProvider>.
56
+ */
57
+ declare function useTTS(): TTSContextValue;
58
+
59
+ export { type AIContextValue, AIProvider, type AIProviderProps, type TTSContextValue, TTSProvider, type TTSProviderProps, useAI, useTTS };