@refraction-ui/react 0.18.4 → 0.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +7147 -5367
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3413 -2754
- package/dist/index.js.map +1 -1
- package/dist/internal/analytics/index.d.cts +6 -0
- package/dist/internal/analytics/index.d.ts +6 -0
- package/dist/internal/calendar/index.d.cts +5 -3
- package/dist/internal/calendar/index.d.ts +5 -3
- package/dist/internal/call-controls/index.d.ts +1 -3
- package/dist/internal/command-input/index.d.cts +10 -2
- package/dist/internal/command-input/index.d.ts +10 -2
- package/dist/internal/conversation/index.d.cts +2 -0
- package/dist/internal/conversation/index.d.ts +2 -0
- package/dist/internal/date-picker/index.d.cts +2 -0
- package/dist/internal/date-picker/index.d.ts +2 -0
- package/dist/internal/device-frame/index.d.cts +1 -3
- package/dist/internal/device-frame/index.d.ts +1 -3
- package/dist/internal/emoji-picker/index.d.cts +1 -3
- package/dist/internal/emoji-picker/index.d.ts +1 -3
- package/dist/internal/file-tree/index.d.cts +125 -0
- package/dist/internal/file-tree/index.d.ts +125 -0
- package/dist/internal/footer/index.d.cts +2 -0
- package/dist/internal/footer/index.d.ts +2 -0
- package/dist/internal/logger/index.d.cts +4 -0
- package/dist/internal/logger/index.d.ts +4 -0
- package/dist/internal/presence-indicator/index.d.cts +1 -3
- package/dist/internal/presence-indicator/index.d.ts +1 -3
- package/dist/internal/react-app-shell/index.d.cts +7 -51
- package/dist/internal/react-app-shell/index.d.ts +7 -51
- package/dist/internal/react-avatar-group/index.d.cts +1 -21
- package/dist/internal/react-avatar-group/index.d.ts +1 -21
- package/dist/internal/react-calendar/index.d.cts +2 -27
- package/dist/internal/react-calendar/index.d.ts +2 -27
- package/dist/internal/react-charts/index.d.cts +20 -10
- package/dist/internal/react-charts/index.d.ts +20 -10
- package/dist/internal/react-command/index.d.cts +1 -1
- package/dist/internal/react-command/index.d.ts +1 -1
- package/dist/internal/react-conversation/index.d.cts +2 -6
- package/dist/internal/react-conversation/index.d.ts +2 -6
- package/dist/internal/react-cookie-consent/index.d.cts +1 -6
- package/dist/internal/react-cookie-consent/index.d.ts +1 -6
- package/dist/internal/react-date-picker/index.d.cts +1 -0
- package/dist/internal/react-date-picker/index.d.ts +1 -0
- package/dist/internal/react-device-frame/index.d.cts +1 -25
- package/dist/internal/react-device-frame/index.d.ts +1 -25
- package/dist/internal/react-dropdown-menu/index.d.cts +1 -1
- package/dist/internal/react-dropdown-menu/index.d.ts +1 -1
- package/dist/internal/react-emoji-picker/index.d.cts +1 -5
- package/dist/internal/react-emoji-picker/index.d.ts +1 -5
- package/dist/internal/react-file-tree/index.d.cts +30 -3
- package/dist/internal/react-file-tree/index.d.ts +30 -3
- package/dist/internal/react-file-upload/index.d.cts +1 -6
- package/dist/internal/react-file-upload/index.d.ts +1 -6
- package/dist/internal/react-inline-editor/index.d.cts +1 -6
- package/dist/internal/react-inline-editor/index.d.ts +1 -6
- package/dist/internal/react-keyboard-shortcut/index.d.cts +1 -1
- package/dist/internal/react-keyboard-shortcut/index.d.ts +1 -1
- package/dist/internal/react-language-selector/index.d.cts +2 -13
- package/dist/internal/react-language-selector/index.d.ts +2 -13
- package/dist/internal/react-location-selector/index.d.cts +1 -3
- package/dist/internal/react-location-selector/index.d.ts +1 -3
- package/dist/internal/react-pagination/index.d.ts +22 -1
- package/dist/internal/react-presence-indicator/index.d.cts +1 -21
- package/dist/internal/react-presence-indicator/index.d.ts +1 -21
- package/dist/internal/react-radio/index.d.ts +2 -17
- package/dist/internal/react-reaction-bar/index.d.cts +1 -21
- package/dist/internal/react-reaction-bar/index.d.ts +1 -21
- package/dist/internal/react-search-bar/index.d.cts +1 -12
- package/dist/internal/react-search-bar/index.d.ts +1 -12
- package/dist/internal/react-slider/index.d.cts +22 -1
- package/dist/internal/react-slider/index.d.ts +22 -1
- package/dist/internal/react-status-indicator/index.d.cts +1 -5
- package/dist/internal/react-status-indicator/index.d.ts +1 -5
- package/dist/internal/react-tabs/index.d.cts +2 -8
- package/dist/internal/react-tabs/index.d.ts +2 -8
- package/dist/internal/react-thread-view/index.d.cts +1 -21
- package/dist/internal/react-thread-view/index.d.ts +1 -21
- package/dist/internal/react-version-selector/index.d.cts +2 -12
- package/dist/internal/react-version-selector/index.d.ts +2 -12
- package/dist/internal/reaction-bar/index.d.cts +1 -3
- package/dist/internal/reaction-bar/index.d.ts +1 -3
- package/dist/internal/status-indicator/index.d.cts +1 -3
- package/dist/internal/status-indicator/index.d.ts +1 -3
- package/dist/internal/thread-view/index.d.cts +3 -5
- package/dist/internal/thread-view/index.d.ts +3 -5
- package/dist/internal/toast/index.d.cts +7 -1
- package/dist/internal/toast/index.d.ts +7 -1
- package/dist/internal/voice-pill/index.d.cts +2 -2
- package/dist/internal/voice-pill/index.d.ts +2 -2
- package/dist/module-X3HTTRQK.js +6438 -0
- package/dist/module-X3HTTRQK.js.map +1 -0
- package/package.json +1 -1
- package/dist/module-XHEQRMQB.js +0 -5320
- package/dist/module-XHEQRMQB.js.map +0 -1
|
@@ -166,6 +166,8 @@ interface HttpSinkOptions {
|
|
|
166
166
|
maxBatchBytes?: number;
|
|
167
167
|
/** Soft per-event byte cap (Segment ≈ 32KB). Default 32_000. */
|
|
168
168
|
maxEventBytes?: number;
|
|
169
|
+
/** Clock for the batch `sentAt` stamp. Default: ambient `new Date()` — inject for deterministic tests. */
|
|
170
|
+
now?: () => Date;
|
|
169
171
|
}
|
|
170
172
|
/** `createAnalytics` configuration. */
|
|
171
173
|
interface AnalyticsConfig {
|
|
@@ -200,6 +202,10 @@ interface AnalyticsConfig {
|
|
|
200
202
|
batchSize?: number;
|
|
201
203
|
/** Auto-flush interval in ms (prod). Default 10_000. */
|
|
202
204
|
flushIntervalMs?: number;
|
|
205
|
+
/** Clock for default event timestamps. Default: ambient `new Date()` — inject for deterministic tests/SSR. */
|
|
206
|
+
now?: () => Date;
|
|
207
|
+
/** RNG for sample-rate decisions. Default: ambient `Math.random` — inject for deterministic tests. */
|
|
208
|
+
random?: () => number;
|
|
203
209
|
}
|
|
204
210
|
/** Options accepted by every top-level call. */
|
|
205
211
|
interface CallOptions {
|
|
@@ -166,6 +166,8 @@ interface HttpSinkOptions {
|
|
|
166
166
|
maxBatchBytes?: number;
|
|
167
167
|
/** Soft per-event byte cap (Segment ≈ 32KB). Default 32_000. */
|
|
168
168
|
maxEventBytes?: number;
|
|
169
|
+
/** Clock for the batch `sentAt` stamp. Default: ambient `new Date()` — inject for deterministic tests. */
|
|
170
|
+
now?: () => Date;
|
|
169
171
|
}
|
|
170
172
|
/** `createAnalytics` configuration. */
|
|
171
173
|
interface AnalyticsConfig {
|
|
@@ -200,6 +202,10 @@ interface AnalyticsConfig {
|
|
|
200
202
|
batchSize?: number;
|
|
201
203
|
/** Auto-flush interval in ms (prod). Default 10_000. */
|
|
202
204
|
flushIntervalMs?: number;
|
|
205
|
+
/** Clock for default event timestamps. Default: ambient `new Date()` — inject for deterministic tests/SSR. */
|
|
206
|
+
now?: () => Date;
|
|
207
|
+
/** RNG for sample-rate decisions. Default: ambient `Math.random` — inject for deterministic tests. */
|
|
208
|
+
random?: () => number;
|
|
203
209
|
}
|
|
204
210
|
/** Options accepted by every top-level call. */
|
|
205
211
|
interface CallOptions {
|
|
@@ -17,6 +17,8 @@ interface CalendarProps {
|
|
|
17
17
|
maxDate?: Date;
|
|
18
18
|
/** Specific dates to disable */
|
|
19
19
|
disabledDates?: Date[];
|
|
20
|
+
/** Reference "today" for isToday/aria-current. Default: ambient `new Date()` — inject to avoid SSR/CSR hydration mismatch. */
|
|
21
|
+
today?: Date;
|
|
20
22
|
}
|
|
21
23
|
interface CalendarDay {
|
|
22
24
|
/** The date this cell represents */
|
|
@@ -48,9 +50,9 @@ interface CalendarAPI {
|
|
|
48
50
|
/** Select a date */
|
|
49
51
|
select(date: Date): void;
|
|
50
52
|
/** ARIA attributes for the calendar grid */
|
|
51
|
-
ariaProps: Partial<AccessibilityProps> & Record<string,
|
|
53
|
+
ariaProps: Partial<AccessibilityProps> & Record<string, string | number | boolean>;
|
|
52
54
|
/** Get ARIA attributes for a specific day cell */
|
|
53
|
-
getDayAriaProps(day: CalendarDay): Partial<AccessibilityProps> & Record<string,
|
|
55
|
+
getDayAriaProps(day: CalendarDay): Partial<AccessibilityProps> & Record<string, string | number | boolean>;
|
|
54
56
|
/** Generated IDs */
|
|
55
57
|
ids: {
|
|
56
58
|
grid: string;
|
|
@@ -65,7 +67,7 @@ declare const calendarVariants: (props?: ({
|
|
|
65
67
|
className?: string;
|
|
66
68
|
}) | undefined) => string;
|
|
67
69
|
declare const dayVariants: (props?: ({
|
|
68
|
-
state?: "
|
|
70
|
+
state?: "today" | "default" | "selected" | "disabled" | "outside" | undefined;
|
|
69
71
|
} & {
|
|
70
72
|
className?: string;
|
|
71
73
|
}) | undefined) => string;
|
|
@@ -17,6 +17,8 @@ interface CalendarProps {
|
|
|
17
17
|
maxDate?: Date;
|
|
18
18
|
/** Specific dates to disable */
|
|
19
19
|
disabledDates?: Date[];
|
|
20
|
+
/** Reference "today" for isToday/aria-current. Default: ambient `new Date()` — inject to avoid SSR/CSR hydration mismatch. */
|
|
21
|
+
today?: Date;
|
|
20
22
|
}
|
|
21
23
|
interface CalendarDay {
|
|
22
24
|
/** The date this cell represents */
|
|
@@ -48,9 +50,9 @@ interface CalendarAPI {
|
|
|
48
50
|
/** Select a date */
|
|
49
51
|
select(date: Date): void;
|
|
50
52
|
/** ARIA attributes for the calendar grid */
|
|
51
|
-
ariaProps: Partial<AccessibilityProps> & Record<string,
|
|
53
|
+
ariaProps: Partial<AccessibilityProps> & Record<string, string | number | boolean>;
|
|
52
54
|
/** Get ARIA attributes for a specific day cell */
|
|
53
|
-
getDayAriaProps(day: CalendarDay): Partial<AccessibilityProps> & Record<string,
|
|
55
|
+
getDayAriaProps(day: CalendarDay): Partial<AccessibilityProps> & Record<string, string | number | boolean>;
|
|
54
56
|
/** Generated IDs */
|
|
55
57
|
ids: {
|
|
56
58
|
grid: string;
|
|
@@ -65,7 +67,7 @@ declare const calendarVariants: (props?: ({
|
|
|
65
67
|
className?: string;
|
|
66
68
|
}) | undefined) => string;
|
|
67
69
|
declare const dayVariants: (props?: ({
|
|
68
|
-
state?: "
|
|
70
|
+
state?: "today" | "default" | "selected" | "disabled" | "outside" | undefined;
|
|
69
71
|
} & {
|
|
70
72
|
className?: string;
|
|
71
73
|
}) | undefined) => string;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { AccessibilityProps } from '../shared/index.js';
|
|
2
|
-
|
|
3
1
|
/** Visual/semantic tone of a call control button. */
|
|
4
2
|
type CallControlTone = 'default' | 'active' | 'destructive';
|
|
5
3
|
/**
|
|
@@ -29,7 +27,7 @@ interface CallControlsProps {
|
|
|
29
27
|
}
|
|
30
28
|
interface CallControlsAPI {
|
|
31
29
|
/** ARIA attributes to spread on the toolbar element (`role="toolbar"`). */
|
|
32
|
-
ariaProps:
|
|
30
|
+
ariaProps: Record<string, string | number | boolean>;
|
|
33
31
|
/** Data attributes for styling hooks. */
|
|
34
32
|
dataAttributes: Record<string, string>;
|
|
35
33
|
}
|
|
@@ -26,16 +26,24 @@ interface CommandInputOptions {
|
|
|
26
26
|
onCommandCommit?: (trigger: Trigger, text: string) => void;
|
|
27
27
|
onCommandCancel?: () => void;
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Minimal keyboard-event surface {@link CommandInput.handleKeyDown} needs.
|
|
31
|
+
* DOM `KeyboardEvent`s and framework synthetic events (e.g. React's) both
|
|
32
|
+
* satisfy this structurally, so adapters can pass their events without casts.
|
|
33
|
+
*/
|
|
34
|
+
interface CommandKeyEvent {
|
|
35
|
+
preventDefault(): void;
|
|
36
|
+
}
|
|
29
37
|
declare class CommandInput {
|
|
30
38
|
private state;
|
|
31
39
|
private options;
|
|
32
40
|
constructor(options: CommandInputOptions);
|
|
33
41
|
handleInput(text: string, cursorPosition: number): void;
|
|
34
|
-
handleKeyDown(key: string, event?:
|
|
42
|
+
handleKeyDown(key: string, event?: CommandKeyEvent): void;
|
|
35
43
|
get value(): InputNode[];
|
|
36
44
|
getState(): CommandInputState;
|
|
37
45
|
private parseInput;
|
|
38
46
|
private notifyStateChange;
|
|
39
47
|
}
|
|
40
48
|
|
|
41
|
-
export { CommandInput, type CommandInputOptions, type CommandInputState, type CommandNode, type InputNode, type TextNode, type Trigger };
|
|
49
|
+
export { CommandInput, type CommandInputOptions, type CommandInputState, type CommandKeyEvent, type CommandNode, type InputNode, type TextNode, type Trigger };
|
|
@@ -26,16 +26,24 @@ interface CommandInputOptions {
|
|
|
26
26
|
onCommandCommit?: (trigger: Trigger, text: string) => void;
|
|
27
27
|
onCommandCancel?: () => void;
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Minimal keyboard-event surface {@link CommandInput.handleKeyDown} needs.
|
|
31
|
+
* DOM `KeyboardEvent`s and framework synthetic events (e.g. React's) both
|
|
32
|
+
* satisfy this structurally, so adapters can pass their events without casts.
|
|
33
|
+
*/
|
|
34
|
+
interface CommandKeyEvent {
|
|
35
|
+
preventDefault(): void;
|
|
36
|
+
}
|
|
29
37
|
declare class CommandInput {
|
|
30
38
|
private state;
|
|
31
39
|
private options;
|
|
32
40
|
constructor(options: CommandInputOptions);
|
|
33
41
|
handleInput(text: string, cursorPosition: number): void;
|
|
34
|
-
handleKeyDown(key: string, event?:
|
|
42
|
+
handleKeyDown(key: string, event?: CommandKeyEvent): void;
|
|
35
43
|
get value(): InputNode[];
|
|
36
44
|
getState(): CommandInputState;
|
|
37
45
|
private parseInput;
|
|
38
46
|
private notifyStateChange;
|
|
39
47
|
}
|
|
40
48
|
|
|
41
|
-
export { CommandInput, type CommandInputOptions, type CommandInputState, type CommandNode, type InputNode, type TextNode, type Trigger };
|
|
49
|
+
export { CommandInput, type CommandInputOptions, type CommandInputState, type CommandKeyEvent, type CommandNode, type InputNode, type TextNode, type Trigger };
|
|
@@ -157,6 +157,8 @@ interface ConversationConfig {
|
|
|
157
157
|
generateTitle?: (firstMessage: string) => string;
|
|
158
158
|
/** Threading mode (default 'inline') */
|
|
159
159
|
threadingMode?: ThreadingMode;
|
|
160
|
+
/** Clock for conversation/message timestamps. Default: ambient `new Date()` — inject for deterministic SSR/tests. */
|
|
161
|
+
now?: () => Date;
|
|
160
162
|
}
|
|
161
163
|
/** Options for a single `sendMessage`. */
|
|
162
164
|
interface SendOptions {
|
|
@@ -157,6 +157,8 @@ interface ConversationConfig {
|
|
|
157
157
|
generateTitle?: (firstMessage: string) => string;
|
|
158
158
|
/** Threading mode (default 'inline') */
|
|
159
159
|
threadingMode?: ThreadingMode;
|
|
160
|
+
/** Clock for conversation/message timestamps. Default: ambient `new Date()` — inject for deterministic SSR/tests. */
|
|
161
|
+
now?: () => Date;
|
|
160
162
|
}
|
|
161
163
|
/** Options for a single `sendMessage`. */
|
|
162
164
|
interface SendOptions {
|
|
@@ -24,6 +24,8 @@ interface DatePickerProps {
|
|
|
24
24
|
onOpenChange?: (open: boolean) => void;
|
|
25
25
|
/** The currently displayed month (controlled) */
|
|
26
26
|
currentMonth?: Date;
|
|
27
|
+
/** Reference "today" for isToday/aria-current and time defaults. Default: ambient `new Date()` — inject to avoid SSR/CSR hydration mismatch. */
|
|
28
|
+
today?: Date;
|
|
27
29
|
}
|
|
28
30
|
interface DatePickerState {
|
|
29
31
|
open: boolean;
|
|
@@ -24,6 +24,8 @@ interface DatePickerProps {
|
|
|
24
24
|
onOpenChange?: (open: boolean) => void;
|
|
25
25
|
/** The currently displayed month (controlled) */
|
|
26
26
|
currentMonth?: Date;
|
|
27
|
+
/** Reference "today" for isToday/aria-current and time defaults. Default: ambient `new Date()` — inject to avoid SSR/CSR hydration mismatch. */
|
|
28
|
+
today?: Date;
|
|
27
29
|
}
|
|
28
30
|
interface DatePickerState {
|
|
29
31
|
open: boolean;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { AccessibilityProps } from '../shared/index.cjs';
|
|
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:
|
|
25
|
+
ariaProps: Record<string, string | number | boolean>;
|
|
28
26
|
/** Data attributes for styling hooks */
|
|
29
27
|
dataAttributes: Record<string, string>;
|
|
30
28
|
}
|
|
@@ -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:
|
|
25
|
+
ariaProps: Record<string, string | number | boolean>;
|
|
28
26
|
/** Data attributes for styling hooks */
|
|
29
27
|
dataAttributes: Record<string, string>;
|
|
30
28
|
}
|
|
@@ -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:
|
|
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:
|
|
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:
|
|
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:
|
|
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 */
|