@zovaris/sephiro 0.6.0 → 0.7.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.
package/dist/index.d.ts CHANGED
@@ -1,8 +1,20 @@
1
1
  import * as react from 'react';
2
- import { HTMLAttributes, ButtonHTMLAttributes, InputHTMLAttributes, TextareaHTMLAttributes, TableHTMLAttributes } from 'react';
2
+ import { HTMLAttributes, ButtonHTMLAttributes, InputHTMLAttributes, TextareaHTMLAttributes, RefObject, TableHTMLAttributes } from 'react';
3
3
  import { ExternalToast, ToasterProps } from 'sonner';
4
4
  export { toast } from 'sonner';
5
5
 
6
+ type ControlSize = "sm" | "md" | "lg";
7
+
8
+ type AvatarStatus = "online" | "offline" | "busy" | "away";
9
+ type AvatarProps = Omit<HTMLAttributes<HTMLSpanElement>, "children"> & {
10
+ /** Image URL. Falls back to `name` initials when it fails to load. */
11
+ src?: string;
12
+ name?: string;
13
+ size?: ControlSize;
14
+ status?: AvatarStatus;
15
+ };
16
+ declare function Avatar({ src, name, size, status, className, ...props }: AvatarProps): react.JSX.Element;
17
+
6
18
  type RenderableElement = {
7
19
  type: any;
8
20
  props: any;
@@ -10,8 +22,6 @@ type RenderableElement = {
10
22
  };
11
23
  type Renderable = string | number | boolean | null | undefined | Iterable<Renderable> | RenderableElement;
12
24
 
13
- type ControlSize = "sm" | "md" | "lg";
14
-
15
25
  type BadgeProps = Omit<HTMLAttributes<HTMLSpanElement>, "children"> & {
16
26
  variant?: "neutral" | "accent" | "success" | "warning" | "danger";
17
27
  size?: ControlSize;
@@ -49,6 +59,30 @@ type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, "size"> & {
49
59
  };
50
60
  declare function Input({ invalid, size, className, "aria-invalid": ariaInvalid, ...props }: InputProps): react.JSX.Element;
51
61
 
62
+ type KbdProps = {
63
+ /**
64
+ * Key caps to render. An array draws one cap per entry (`["⌘", "K"]`);
65
+ * a single value draws one cap (`"Esc"`).
66
+ */
67
+ keys: Renderable;
68
+ className?: string;
69
+ };
70
+ declare function Kbd({ keys, className }: KbdProps): react.JSX.Element;
71
+
72
+ type ProgressProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
73
+ /** Completion from 0 to 100. Omit it for the indeterminate sweep. */
74
+ value?: number;
75
+ label?: string;
76
+ size?: ControlSize;
77
+ };
78
+ declare function Progress({ value, label, size, className, ...props }: ProgressProps): react.JSX.Element;
79
+
80
+ type ScrollAreaProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
81
+ orientation?: "vertical" | "horizontal" | "both";
82
+ children?: Renderable;
83
+ };
84
+ declare function ScrollArea({ orientation, className, children, ...props }: ScrollAreaProps): react.JSX.Element;
85
+
52
86
  type SeparatorProps = Omit<HTMLAttributes<HTMLHRElement>, "children"> & {
53
87
  orientation?: "horizontal" | "vertical";
54
88
  decorative?: boolean;
@@ -104,6 +138,38 @@ type ToggleProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onChange" | "o
104
138
  };
105
139
  declare function Toggle({ checked, onCheckedChange, label, className, disabled, onClick, size, "aria-checked": ariaChecked, "aria-label": ariaLabel, ...props }: ToggleProps): react.JSX.Element;
106
140
 
141
+ type MotionSpeed = "fast" | "normal" | "slow";
142
+ /** Parses a CSS time string ("180ms", "0.18s", "0ms") into milliseconds. */
143
+ declare function parseDurationMs(value: string): number;
144
+ /**
145
+ * Reads the motion token in effect for an element, honouring theme
146
+ * overrides, `prefers-reduced-motion`, and `data-sephiro-motion="off"`.
147
+ * Returns 0 when there is nothing to wait for.
148
+ */
149
+ declare function motionDurationMs(element: HTMLElement | null, speed: MotionSpeed): number;
150
+ type Presence<E extends HTMLElement = HTMLElement> = {
151
+ /** Keep rendering the overlay while its exit animation plays. */
152
+ present: boolean;
153
+ /** True once the overlay has begun leaving; drive exit styles with it. */
154
+ leaving: boolean;
155
+ /** `open` while settled, `closed` once leaving. */
156
+ state: "open" | "closed";
157
+ /** Attach to the overlay element so its exit duration can be measured. */
158
+ ref: RefObject<E | null>;
159
+ };
160
+ /**
161
+ * Holds an overlay mounted for exactly as long as its exit animation runs.
162
+ *
163
+ * Enter animations replay on mount, so the component only needs to render
164
+ * while `present` and style itself with `state`:
165
+ *
166
+ * ```tsx
167
+ * const { present, state, ref } = usePresence(open, "fast");
168
+ * return present ? <div ref={ref} data-state={state} /> : null;
169
+ * ```
170
+ */
171
+ declare function usePresence<E extends HTMLElement = HTMLElement>(open: boolean, speed?: MotionSpeed): Presence<E>;
172
+
107
173
  type AlertProps = Omit<HTMLAttributes<HTMLDivElement>, "children" | "title"> & {
108
174
  variant?: "info" | "success" | "warning" | "danger";
109
175
  title?: Renderable;
@@ -115,6 +181,15 @@ declare function Alert({ variant, title, children, dismissible, onDismiss, class
115
181
  declare const Notice: typeof Alert;
116
182
  type NoticeProps = AlertProps;
117
183
 
184
+ type AvatarGroupItem = Pick<AvatarProps, "src" | "name" | "status">;
185
+ type AvatarGroupProps = Omit<HTMLAttributes<HTMLSpanElement>, "children"> & {
186
+ avatars: AvatarGroupItem[];
187
+ /** Avatars shown before collapsing the rest into a `+N` chip. */
188
+ max?: number;
189
+ size?: ControlSize;
190
+ };
191
+ declare function AvatarGroup({ avatars, max, size, className, ...props }: AvatarGroupProps): react.JSX.Element;
192
+
118
193
  type CardProps = Omit<HTMLAttributes<HTMLElement>, "children" | "title"> & {
119
194
  title?: Renderable;
120
195
  description?: Renderable;
@@ -126,6 +201,44 @@ type CardProps = Omit<HTMLAttributes<HTMLElement>, "children" | "title"> & {
126
201
  };
127
202
  declare function Card({ title, description, header, footer, children, interactive, selected, className, ...props }: CardProps): react.JSX.Element;
128
203
 
204
+ type CollapsibleProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
205
+ trigger: Renderable;
206
+ children?: Renderable;
207
+ open?: boolean;
208
+ defaultOpen?: boolean;
209
+ onOpenChange?: (open: boolean) => void;
210
+ disabled?: boolean;
211
+ };
212
+ declare function Collapsible({ trigger, children, open, defaultOpen, onOpenChange, disabled, className, ...props }: CollapsibleProps): react.JSX.Element;
213
+
214
+ type ComboboxOption = {
215
+ value: string;
216
+ label: Renderable;
217
+ disabled?: boolean;
218
+ /** Groups options under a heading; ungrouped options come first. */
219
+ group?: string;
220
+ /** Extra terms matched by the filter but never highlighted. */
221
+ keywords?: string;
222
+ };
223
+ type ComboboxProps = {
224
+ options: ComboboxOption[];
225
+ /** Single-select value. Omit it and pass `values` for multi-select. */
226
+ value?: string;
227
+ /** Multi-select values; selecting keeps the popup open. */
228
+ values?: string[];
229
+ onValueChange?: (value: string) => void;
230
+ onValuesChange?: (values: string[]) => void;
231
+ placeholder?: Renderable;
232
+ searchPlaceholder?: string;
233
+ emptyMessage?: Renderable;
234
+ disabled?: boolean;
235
+ size?: ControlSize;
236
+ id?: string;
237
+ ariaLabel?: string;
238
+ className?: string;
239
+ };
240
+ declare function Combobox({ options, value, values, onValueChange, onValuesChange, placeholder, searchPlaceholder, emptyMessage, disabled, size, id, ariaLabel, className, }: ComboboxProps): react.JSX.Element;
241
+
129
242
  type DialogProps = {
130
243
  open: boolean;
131
244
  onClose: () => void;
@@ -139,6 +252,22 @@ type DialogProps = {
139
252
  };
140
253
  declare function Dialog({ open, onClose, title, description, children, footer, closeLabel, closeOnOverlayClick, className, }: DialogProps): react.JSX.Element | null;
141
254
 
255
+ type DrawerSide = "left" | "right" | "bottom";
256
+ type DrawerProps = {
257
+ open: boolean;
258
+ onClose: () => void;
259
+ title: Renderable;
260
+ description?: Renderable;
261
+ children?: Renderable;
262
+ footer?: Renderable;
263
+ side?: DrawerSide;
264
+ size?: "sm" | "md" | "lg";
265
+ closeLabel?: string;
266
+ closeOnOverlayClick?: boolean;
267
+ className?: string;
268
+ };
269
+ declare function Drawer({ open, onClose, title, description, children, footer, side, size, closeLabel, closeOnOverlayClick, className, }: DrawerProps): react.JSX.Element | null;
270
+
142
271
  type FieldMessageProps = Omit<HTMLAttributes<HTMLParagraphElement>, "children"> & {
143
272
  variant?: "hint" | "error" | "success";
144
273
  children?: Renderable;
@@ -157,6 +286,21 @@ type FieldProps = {
157
286
  };
158
287
  declare function Field({ label, htmlFor, description, message, messageType, required, className, children, }: FieldProps): react.JSX.Element;
159
288
 
289
+ type OverlaySide = "top" | "bottom" | "left" | "right";
290
+
291
+ type HoverCardProps = {
292
+ trigger: Renderable;
293
+ children: Renderable;
294
+ /** Grace before opening, so passing the trigger never flickers. */
295
+ openDelay?: number;
296
+ /** Grace before closing, so the pointer can travel into the card. */
297
+ closeDelay?: number;
298
+ placement?: OverlaySide;
299
+ ariaLabel?: string;
300
+ className?: string;
301
+ };
302
+ declare function HoverCard({ trigger, children, openDelay, closeDelay, placement, ariaLabel, className, }: HoverCardProps): react.JSX.Element;
303
+
160
304
  type MenuItem = {
161
305
  value?: string;
162
306
  label?: Renderable;
@@ -286,6 +430,40 @@ type TooltipProps = {
286
430
  };
287
431
  declare function Tooltip({ content, children, side, delay, disabled, className, }: TooltipProps): react.JSX.Element;
288
432
 
433
+ type CommandItem = {
434
+ id?: string;
435
+ label: Renderable;
436
+ /** Value reported to `onSelect` when omitted (falls back to the label). */
437
+ value?: string;
438
+ icon?: Renderable;
439
+ /** Groups options under a heading; ungrouped options always come first. */
440
+ group?: string;
441
+ /** Muted text trailing the option (chevrons are drawn for parents). */
442
+ hint?: Renderable;
443
+ badge?: Renderable;
444
+ shortcut?: string[];
445
+ /** Extra terms matched by the filter but never highlighted. */
446
+ keywords?: string;
447
+ disabled?: boolean;
448
+ /** Sub-options: activating this option drills into a new level. */
449
+ children?: CommandItem[];
450
+ };
451
+ type CommandPaletteProps = {
452
+ open: boolean;
453
+ onOpenChange: (open: boolean) => void;
454
+ items: CommandItem[];
455
+ onSelect?: (item: CommandItem) => void;
456
+ placeholder?: string;
457
+ emptyMessage?: Renderable;
458
+ /** Label of the breadcrumb that returns to the root level. */
459
+ homeLabel?: string;
460
+ ariaLabel?: string;
461
+ /** Bind Cmd/Ctrl+K to toggle the palette. Default: true. */
462
+ hotkey?: boolean;
463
+ className?: string;
464
+ };
465
+ declare function CommandPalette({ open, onOpenChange, items, onSelect, placeholder, emptyMessage, homeLabel, ariaLabel, hotkey, className, }: CommandPaletteProps): react.ReactPortal | null;
466
+
289
467
  type EmptyStateProps = Omit<HTMLAttributes<HTMLElement>, "children" | "title"> & {
290
468
  title: Renderable;
291
469
  description?: Renderable;
@@ -295,6 +473,98 @@ type EmptyStateProps = Omit<HTMLAttributes<HTMLElement>, "children" | "title"> &
295
473
  };
296
474
  declare function EmptyState({ title, description, icon, action, compact, className, ...props }: EmptyStateProps): react.JSX.Element;
297
475
 
476
+ type MagneticDropzoneProps = Omit<React.HTMLAttributes<HTMLDivElement>, "onDrop" | "onDragOver" | "children"> & {
477
+ /** Idle content: an icon, instructions, a choose-file button. */
478
+ children?: Renderable;
479
+ /** Replaces `children` while files hover over the zone. */
480
+ activeContent?: Renderable;
481
+ onFiles?: (files: File[]) => void;
482
+ /** Forwarded to the hidden file input, e.g. "image/*,.pdf". */
483
+ accept?: string;
484
+ multiple?: boolean;
485
+ disabled?: boolean;
486
+ className?: string;
487
+ };
488
+ /**
489
+ * A drop zone whose content leans toward the pointer while files hover —
490
+ * the pull is a CSS variable updated on dragover, so the attraction stays
491
+ * cheap and collapses with the motion tokens.
492
+ */
493
+ declare function MagneticDropzone({ children, activeContent, onFiles, accept, multiple, disabled, className, ...props }: MagneticDropzoneProps): react.JSX.Element;
494
+
495
+ type ReasoningStep = {
496
+ id?: string;
497
+ title: Renderable;
498
+ detail?: Renderable;
499
+ status?: "pending" | "active" | "done";
500
+ };
501
+ type ReasoningStepsProps = {
502
+ steps: ReasoningStep[];
503
+ /** Header label. Default: "Reasoning". */
504
+ label?: Renderable;
505
+ open?: boolean;
506
+ defaultOpen?: boolean;
507
+ onOpenChange?: (open: boolean) => void;
508
+ className?: string;
509
+ };
510
+ declare function ReasoningSteps({ steps, label, open, defaultOpen, onOpenChange, className, }: ReasoningStepsProps): react.JSX.Element;
511
+
512
+ type ResizableProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
513
+ /** The panes, in visual order. A handle is rendered between each pair. */
514
+ panes: Renderable[];
515
+ direction?: "horizontal" | "vertical";
516
+ /** Controlled pane sizes in percent; they should sum to 100. */
517
+ sizes?: number[];
518
+ defaultSizes?: number[];
519
+ onSizesChange?: (sizes: number[]) => void;
520
+ /** Smallest share a pane may keep, in percent. Default: 10. */
521
+ min?: number;
522
+ handleLabel?: string;
523
+ };
524
+ declare function Resizable({ panes, direction, sizes, defaultSizes, onSizesChange, min, handleLabel, className, ...props }: ResizableProps): react.JSX.Element;
525
+
526
+ type SidebarItem = {
527
+ value: string;
528
+ label: Renderable;
529
+ icon?: Renderable;
530
+ badge?: Renderable;
531
+ disabled?: boolean;
532
+ };
533
+ type SidebarSection = {
534
+ title?: string;
535
+ items: SidebarItem[];
536
+ };
537
+ type SidebarProps = Omit<HTMLAttributes<HTMLElement>, "children" | "onSelect"> & {
538
+ sections: SidebarSection[];
539
+ /** Controlled active item. */
540
+ value?: string;
541
+ defaultValue?: string;
542
+ onSelect?: (value: string) => void;
543
+ header?: Renderable;
544
+ footer?: Renderable;
545
+ /** Show the collapse toggle. Default: false. */
546
+ collapsible?: boolean;
547
+ collapsed?: boolean;
548
+ defaultCollapsed?: boolean;
549
+ onCollapsedChange?: (collapsed: boolean) => void;
550
+ ariaLabel?: string;
551
+ };
552
+ declare function Sidebar({ sections, value, defaultValue, onSelect, header, footer, collapsible, collapsed, defaultCollapsed, onCollapsedChange, ariaLabel, className, ...props }: SidebarProps): react.JSX.Element;
553
+
554
+ type StreamingTextProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
555
+ text: string;
556
+ /** Delay between word entrances, in ms. Default: 30. */
557
+ speed?: number;
558
+ /** Reveal words progressively. Default: true. */
559
+ animated?: boolean;
560
+ };
561
+ /**
562
+ * Words arrive one at a time — and because each word animates only when it
563
+ * mounts, appending to `text` streams naturally without any JS timing: the
564
+ * new words cascade in while finished ones stay put.
565
+ */
566
+ declare function StreamingText({ text, speed, animated, className, ...props }: StreamingTextProps): react.JSX.Element;
567
+
298
568
  type TableColumn<Row extends Record<string, unknown> = Record<string, unknown>> = {
299
569
  key: string;
300
570
  label: Renderable;
@@ -315,4 +585,4 @@ type TableProps<Row extends Record<string, unknown> = Record<string, unknown>> =
315
585
  };
316
586
  declare function Table<Row extends Record<string, unknown> = Record<string, unknown>>({ columns, rows, caption, emptyMessage, rowKey, density, striped, stickyHeader, className, ...props }: TableProps<Row>): react.JSX.Element;
317
587
 
318
- export { Alert, type AlertProps, Badge, type BadgeProps, Button, type ButtonProps, Card, type CardProps, Checkbox, type CheckboxProps, type ControlSize, Dialog, type DialogProps, EmptyState, type EmptyStateProps, Field, FieldMessage, type FieldMessageProps, type FieldProps, IconButton, type IconButtonProps, Input, type InputProps, Menu, type MenuItem, type MenuProps, Notice, type NoticeProps, Popover, type PopoverProps, RadioGroup, type RadioGroupProps, type RadioOption, type Renderable, type RenderableElement, Select, type SelectOption, type SelectProps, Separator, type SeparatorProps, Skeleton, type SkeletonProps, Slider, type SliderProps, Spinner, type SpinnerProps, Surface, type SurfaceProps, type TabItem, Table, type TableColumn, type TableProps, Tabs, type TabsProps, Textarea, type TextareaProps, Toast, type ToastProps, ToastViewport, type ToastViewportProps, Toggle, type ToggleProps, Toolbar, type ToolbarProps, Tooltip, type TooltipProps };
588
+ export { Alert, type AlertProps, Avatar, AvatarGroup, type AvatarGroupItem, type AvatarGroupProps, type AvatarProps, type AvatarStatus, Badge, type BadgeProps, Button, type ButtonProps, Card, type CardProps, Checkbox, type CheckboxProps, Collapsible, type CollapsibleProps, Combobox, type ComboboxOption, type ComboboxProps, type CommandItem, CommandPalette, type CommandPaletteProps, type ControlSize, Dialog, type DialogProps, Drawer, type DrawerProps, type DrawerSide, EmptyState, type EmptyStateProps, Field, FieldMessage, type FieldMessageProps, type FieldProps, HoverCard, type HoverCardProps, IconButton, type IconButtonProps, Input, type InputProps, Kbd, type KbdProps, MagneticDropzone, type MagneticDropzoneProps, Menu, type MenuItem, type MenuProps, type MotionSpeed, Notice, type NoticeProps, Popover, type PopoverProps, type Presence, Progress, type ProgressProps, RadioGroup, type RadioGroupProps, type RadioOption, type ReasoningStep, ReasoningSteps, type ReasoningStepsProps, type Renderable, type RenderableElement, Resizable, type ResizableProps, ScrollArea, type ScrollAreaProps, Select, type SelectOption, type SelectProps, Separator, type SeparatorProps, Sidebar, type SidebarItem, type SidebarProps, type SidebarSection, Skeleton, type SkeletonProps, Slider, type SliderProps, Spinner, type SpinnerProps, StreamingText, type StreamingTextProps, Surface, type SurfaceProps, type TabItem, Table, type TableColumn, type TableProps, Tabs, type TabsProps, Textarea, type TextareaProps, Toast, type ToastProps, ToastViewport, type ToastViewportProps, Toggle, type ToggleProps, Toolbar, type ToolbarProps, Tooltip, type TooltipProps, motionDurationMs, parseDurationMs, usePresence };