tempest-react-sdk 0.1.6 → 0.3.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/README.md +21 -16
- package/dist/index.d.ts +454 -21
- package/dist/styles.css +1 -1
- package/dist/tempest-react-sdk.cjs +3 -3
- package/dist/tempest-react-sdk.cjs.map +1 -1
- package/dist/tempest-react-sdk.js +2491 -1659
- package/dist/tempest-react-sdk.js.map +1 -1
- package/package.json +5 -23
package/dist/index.d.ts
CHANGED
|
@@ -28,6 +28,33 @@ import { UseFormProps } from 'react-hook-form';
|
|
|
28
28
|
import { UseFormReturn } from 'react-hook-form';
|
|
29
29
|
import { z } from 'zod';
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Accessible accordion. Each item collapses/expands its content. Single-mode by
|
|
33
|
+
* default — pass `multiple` to allow more than one item open at a time. Can be
|
|
34
|
+
* controlled via `value` + `onChange`, or uncontrolled via `defaultValue`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function Accordion({ items, multiple, value, defaultValue, onChange, className, }: AccordionProps): JSX.Element;
|
|
37
|
+
|
|
38
|
+
export declare interface AccordionItem {
|
|
39
|
+
/** Stable identifier. */
|
|
40
|
+
id: string;
|
|
41
|
+
title: ReactNode;
|
|
42
|
+
children: ReactNode;
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export declare interface AccordionProps {
|
|
47
|
+
items: AccordionItem[];
|
|
48
|
+
/** When `true` multiple items can be open simultaneously. Default `false`. */
|
|
49
|
+
multiple?: boolean;
|
|
50
|
+
/** Controlled open ids. */
|
|
51
|
+
value?: string[];
|
|
52
|
+
/** Uncontrolled default open ids. */
|
|
53
|
+
defaultValue?: string[];
|
|
54
|
+
onChange?: (openIds: string[]) => void;
|
|
55
|
+
className?: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
31
58
|
/**
|
|
32
59
|
* Inline alert / notice with tone (info/success/warning/danger) and appearance
|
|
33
60
|
* (soft/solid/outline). Accepts optional `icon`, `title`, `description` and
|
|
@@ -52,6 +79,10 @@ export declare interface AlertProps extends Omit<HTMLAttributes<HTMLDivElement>,
|
|
|
52
79
|
|
|
53
80
|
export declare type AlertVariant = "neutral" | "info" | "success" | "warning" | "danger";
|
|
54
81
|
|
|
82
|
+
declare type AnyEventTarget = EventTarget | {
|
|
83
|
+
current: EventTarget | null;
|
|
84
|
+
} | null | undefined;
|
|
85
|
+
|
|
55
86
|
export declare interface ApiClient {
|
|
56
87
|
request<T>(path: string, options?: RequestOptions): Promise<T>;
|
|
57
88
|
get<T>(path: string, options?: RequestOptions): Promise<T>;
|
|
@@ -88,6 +119,29 @@ export declare interface ApiError {
|
|
|
88
119
|
body?: unknown;
|
|
89
120
|
}
|
|
90
121
|
|
|
122
|
+
/**
|
|
123
|
+
* Preserve a constant aspect ratio for media (images, video, embeds). The
|
|
124
|
+
* inner child stretches to fill the box. Uses the native `aspect-ratio`
|
|
125
|
+
* CSS property — works on all modern browsers (Safari 15+, Chrome 88+).
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* <AspectRatio ratio={16 / 9}>
|
|
129
|
+
* <img src="/cover.jpg" alt="" style={{ width: "100%", height: "100%", objectFit: "cover" }} />
|
|
130
|
+
* </AspectRatio>
|
|
131
|
+
*/
|
|
132
|
+
export declare function AspectRatio({ ratio, className, style, children, ...props }: AspectRatioProps): JSX.Element;
|
|
133
|
+
|
|
134
|
+
export declare interface AspectRatioProps extends HTMLAttributes<HTMLDivElement> {
|
|
135
|
+
/**
|
|
136
|
+
* Width-to-height ratio. Pass `16/9` for widescreen, `1` for square,
|
|
137
|
+
* `4/3` for SD video, `3/4` for portrait, etc. Default `16/9`.
|
|
138
|
+
*/
|
|
139
|
+
ratio?: number;
|
|
140
|
+
children?: ReactNode;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export declare type AsyncStatus = "idle" | "pending" | "success" | "error";
|
|
144
|
+
|
|
91
145
|
export declare interface AudioPlayer {
|
|
92
146
|
/** Play `src`. Returns the underlying element, or `null` when the browser blocked autoplay. */
|
|
93
147
|
play: (src: string, options?: PlayAudioOptions) => Promise<HTMLAudioElement | null>;
|
|
@@ -201,6 +255,30 @@ export declare interface BreadcrumbsProps {
|
|
|
201
255
|
className?: string;
|
|
202
256
|
}
|
|
203
257
|
|
|
258
|
+
/**
|
|
259
|
+
* Breakpoint keys exposed by the SDK. Values mirror the CSS tokens
|
|
260
|
+
* `--tempest-bp-xs|sm|md|lg|xl|2xl` defined in `styles/colors.css`.
|
|
261
|
+
*/
|
|
262
|
+
export declare type Breakpoint = "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
263
|
+
|
|
264
|
+
export declare interface BreakpointHelpers {
|
|
265
|
+
/** Current breakpoint key (the largest one whose min-width is matched). */
|
|
266
|
+
current: Breakpoint;
|
|
267
|
+
/** Window width in pixels at last update. `0` when SSR. */
|
|
268
|
+
width: number;
|
|
269
|
+
/** True when viewport width is `>=` the given breakpoint. */
|
|
270
|
+
above: (bp: Breakpoint) => boolean;
|
|
271
|
+
/** True when viewport width is `<` the given breakpoint. */
|
|
272
|
+
below: (bp: Breakpoint) => boolean;
|
|
273
|
+
/** Convenience flags mapping to typical device shapes. */
|
|
274
|
+
isMobile: boolean;
|
|
275
|
+
isTablet: boolean;
|
|
276
|
+
isDesktop: boolean;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/** Pixel value paired with each breakpoint key. */
|
|
280
|
+
export declare const BREAKPOINTS: Record<Breakpoint, number>;
|
|
281
|
+
|
|
204
282
|
/**
|
|
205
283
|
* Primary action button with variants, sizes and a loading state that
|
|
206
284
|
* preserves layout via an absolutely-positioned spinner.
|
|
@@ -259,7 +337,31 @@ export declare interface CardProps extends Omit<HTMLAttributes<HTMLDivElement>,
|
|
|
259
337
|
|
|
260
338
|
export declare type Catalog = Record<string, Messages>;
|
|
261
339
|
|
|
262
|
-
|
|
340
|
+
/**
|
|
341
|
+
* Center children horizontally, vertically, or both. Flex-based; works with
|
|
342
|
+
* any child size. Pair with `minHeight` (or set parent height) when
|
|
343
|
+
* centering vertically.
|
|
344
|
+
*
|
|
345
|
+
* @example
|
|
346
|
+
* <Center axis="both" minHeight="100vh">
|
|
347
|
+
* <Spinner />
|
|
348
|
+
* </Center>
|
|
349
|
+
*/
|
|
350
|
+
export declare function Center({ axis, minHeight, fullWidth, className, style, children, ...props }: CenterProps): JSX.Element;
|
|
351
|
+
|
|
352
|
+
export declare type CenterAxis = "both" | "horizontal" | "vertical";
|
|
353
|
+
|
|
354
|
+
export declare interface CenterProps extends HTMLAttributes<HTMLDivElement> {
|
|
355
|
+
/** Which axis to center on. Default `"both"`. */
|
|
356
|
+
axis?: CenterAxis;
|
|
357
|
+
/** Fixed height for the container. Numbers map to `${n}px`; strings pass through. Useful when centering inside an unsized parent. */
|
|
358
|
+
minHeight?: number | string;
|
|
359
|
+
/** When `true` (default), takes up `100%` width of the parent. */
|
|
360
|
+
fullWidth?: boolean;
|
|
361
|
+
children?: ReactNode;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
export declare const CEPInput: ForwardRefExoticComponent<Omit<InputProps, "value" | "onChange"> & {
|
|
263
365
|
value: string;
|
|
264
366
|
onChange: (value: string) => void;
|
|
265
367
|
} & RefAttributes<HTMLInputElement>>;
|
|
@@ -308,11 +410,41 @@ declare type ClassValue = string | number | bigint | boolean | null | undefined
|
|
|
308
410
|
*/
|
|
309
411
|
export declare function cn(...values: ClassValue[]): string;
|
|
310
412
|
|
|
311
|
-
export declare const CNPJInput: ForwardRefExoticComponent<Omit<InputProps, "
|
|
413
|
+
export declare const CNPJInput: ForwardRefExoticComponent<Omit<InputProps, "value" | "onChange"> & {
|
|
312
414
|
value: string;
|
|
313
415
|
onChange: (value: string) => void;
|
|
314
416
|
} & RefAttributes<HTMLInputElement>>;
|
|
315
417
|
|
|
418
|
+
/**
|
|
419
|
+
* Combobox — text input with a filterable dropdown of options.
|
|
420
|
+
*
|
|
421
|
+
* Selecting an option fires `onChange(value)`. Typing filters the list.
|
|
422
|
+
* Keyboard: ArrowUp/ArrowDown to navigate, Enter to select, Esc to close.
|
|
423
|
+
*/
|
|
424
|
+
export declare function Combobox({ options, value, onChange, label, placeholder, helperText, error, disabled, filter, emptyMessage, className, }: ComboboxProps): JSX.Element;
|
|
425
|
+
|
|
426
|
+
export declare interface ComboboxOption {
|
|
427
|
+
value: string;
|
|
428
|
+
label: string;
|
|
429
|
+
disabled?: boolean;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
export declare interface ComboboxProps {
|
|
433
|
+
options: ComboboxOption[];
|
|
434
|
+
value: string;
|
|
435
|
+
onChange: (value: string) => void;
|
|
436
|
+
label?: string;
|
|
437
|
+
placeholder?: string;
|
|
438
|
+
helperText?: string;
|
|
439
|
+
error?: string;
|
|
440
|
+
disabled?: boolean;
|
|
441
|
+
/** Custom filter — return true to keep the option. Default is case-insensitive substring match on label. */
|
|
442
|
+
filter?: (option: ComboboxOption, query: string) => boolean;
|
|
443
|
+
/** Message shown when no option matches. */
|
|
444
|
+
emptyMessage?: string;
|
|
445
|
+
className?: string;
|
|
446
|
+
}
|
|
447
|
+
|
|
316
448
|
/**
|
|
317
449
|
* Quick confirmation prompt built on top of {@link Modal}. Use for destructive
|
|
318
450
|
* actions with `variant="danger"`.
|
|
@@ -340,7 +472,10 @@ export declare const consoleSink: LoggerSink;
|
|
|
340
472
|
*/
|
|
341
473
|
export declare const consoleTelemetryAdapter: TelemetryAdapter;
|
|
342
474
|
|
|
343
|
-
/**
|
|
475
|
+
/**
|
|
476
|
+
* Page-level horizontal container with a max-width preset and responsive
|
|
477
|
+
* side padding (`space-4` mobile / `space-6` tablet / `space-8` desktop).
|
|
478
|
+
*/
|
|
344
479
|
export declare function Container({ size, className, children, ...props }: ContainerProps): JSX.Element;
|
|
345
480
|
|
|
346
481
|
export declare interface ContainerProps extends HTMLAttributes<HTMLDivElement> {
|
|
@@ -349,7 +484,7 @@ export declare interface ContainerProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
349
484
|
|
|
350
485
|
export declare type ContainerSize = "sm" | "md" | "lg" | "xl" | "full";
|
|
351
486
|
|
|
352
|
-
export declare const CPFInput: ForwardRefExoticComponent<Omit<InputProps, "
|
|
487
|
+
export declare const CPFInput: ForwardRefExoticComponent<Omit<InputProps, "value" | "onChange"> & {
|
|
353
488
|
value: string;
|
|
354
489
|
onChange: (value: string) => void;
|
|
355
490
|
} & RefAttributes<HTMLInputElement>>;
|
|
@@ -774,7 +909,7 @@ export declare type DocumentVisibility = "visible" | "hidden";
|
|
|
774
909
|
* Sliding side panel. Same building blocks as {@link Modal} but anchored to
|
|
775
910
|
* an edge. Locks body scroll while open.
|
|
776
911
|
*/
|
|
777
|
-
export declare function Drawer({ open, onClose, placement, title, children, footer, closeOnBackdrop, closeOnEsc, hideCloseButton, className, }: DrawerProps): ReactPortal | null;
|
|
912
|
+
export declare function Drawer({ open, onClose, placement, title, children, footer, closeOnBackdrop, closeOnEsc, hideCloseButton, className, mobilePlacement, showHandle, }: DrawerProps): ReactPortal | null;
|
|
778
913
|
|
|
779
914
|
export declare type DrawerPlacement = "right" | "left" | "top" | "bottom";
|
|
780
915
|
|
|
@@ -789,6 +924,54 @@ export declare interface DrawerProps {
|
|
|
789
924
|
closeOnEsc?: boolean;
|
|
790
925
|
hideCloseButton?: boolean;
|
|
791
926
|
className?: string;
|
|
927
|
+
/**
|
|
928
|
+
* Auto-switch to bottom-sheet placement on mobile viewports (< md).
|
|
929
|
+
* Modern mobile apps default to bottom drawers; on desktop the original
|
|
930
|
+
* `placement` is preserved.
|
|
931
|
+
*/
|
|
932
|
+
mobilePlacement?: DrawerPlacement;
|
|
933
|
+
/** Render a drag handle indicator at the leading edge (bottom-sheet style). */
|
|
934
|
+
showHandle?: boolean;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
/**
|
|
938
|
+
* Dropdown menu — list of selectable actions anchored to a trigger.
|
|
939
|
+
*
|
|
940
|
+
* - Toggle on trigger click.
|
|
941
|
+
* - Close on outside click / Escape / item selection.
|
|
942
|
+
* - Arrow keys navigate, Enter activates focused item.
|
|
943
|
+
*/
|
|
944
|
+
export declare function DropdownMenu({ trigger, items, placement, className, }: DropdownMenuProps): JSX.Element;
|
|
945
|
+
|
|
946
|
+
export declare type DropdownMenuEntry = {
|
|
947
|
+
type: "item";
|
|
948
|
+
id: string;
|
|
949
|
+
label: ReactNode;
|
|
950
|
+
icon?: ReactNode;
|
|
951
|
+
danger?: boolean;
|
|
952
|
+
disabled?: boolean;
|
|
953
|
+
onSelect: () => void;
|
|
954
|
+
} | {
|
|
955
|
+
type: "separator";
|
|
956
|
+
id: string;
|
|
957
|
+
} | {
|
|
958
|
+
type: "label";
|
|
959
|
+
id: string;
|
|
960
|
+
label: ReactNode;
|
|
961
|
+
};
|
|
962
|
+
|
|
963
|
+
export declare type DropdownMenuPlacement = "bottom-start" | "bottom-end" | "top-start" | "top-end";
|
|
964
|
+
|
|
965
|
+
export declare interface DropdownMenuProps {
|
|
966
|
+
trigger: ReactElement<{
|
|
967
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
968
|
+
"aria-expanded"?: boolean;
|
|
969
|
+
"aria-controls"?: string;
|
|
970
|
+
"aria-haspopup"?: boolean | "menu";
|
|
971
|
+
}>;
|
|
972
|
+
items: DropdownMenuEntry[];
|
|
973
|
+
placement?: DropdownMenuPlacement;
|
|
974
|
+
className?: string;
|
|
792
975
|
}
|
|
793
976
|
|
|
794
977
|
export declare interface ElementSize {
|
|
@@ -1107,10 +1290,10 @@ export declare interface GetInitialThemeOptions {
|
|
|
1107
1290
|
export declare function Grid({ columns, gap, className, style, children, ...props }: GridProps): JSX.Element;
|
|
1108
1291
|
|
|
1109
1292
|
export declare interface GridProps extends HTMLAttributes<HTMLDivElement> {
|
|
1110
|
-
/** Number of columns or a custom `grid-template-columns` value. */
|
|
1111
|
-
columns?: number | string
|
|
1112
|
-
/** Gap as a CSS length. Numbers map to a multiple of the 4px scale. */
|
|
1113
|
-
gap?: number | string
|
|
1293
|
+
/** Number of columns or a custom `grid-template-columns` value. Accepts responsive object. */
|
|
1294
|
+
columns?: ResponsiveValue<number | string>;
|
|
1295
|
+
/** Gap as a CSS length. Numbers map to a multiple of the 4px scale. Accepts responsive object. */
|
|
1296
|
+
gap?: ResponsiveValue<number | string>;
|
|
1114
1297
|
children?: ReactNode;
|
|
1115
1298
|
}
|
|
1116
1299
|
|
|
@@ -1125,6 +1308,19 @@ export declare interface GrowthBookLike {
|
|
|
1125
1308
|
setRenderer?: (renderer: () => void) => void;
|
|
1126
1309
|
}
|
|
1127
1310
|
|
|
1311
|
+
/** Inverse of `<Show>` — hides children when the condition matches. */
|
|
1312
|
+
export declare function Hide({ above, below, only, children }: HideProps): ReactNode;
|
|
1313
|
+
|
|
1314
|
+
export declare interface HideProps {
|
|
1315
|
+
/** Hide children when viewport width is `>=` this breakpoint. */
|
|
1316
|
+
above?: Breakpoint;
|
|
1317
|
+
/** Hide children when viewport width is `<` this breakpoint. */
|
|
1318
|
+
below?: Breakpoint;
|
|
1319
|
+
/** Hide on specific breakpoints. */
|
|
1320
|
+
only?: Breakpoint | Breakpoint[];
|
|
1321
|
+
children: ReactNode;
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1128
1324
|
export declare interface I18n {
|
|
1129
1325
|
/** Currently active locale. */
|
|
1130
1326
|
locale: string;
|
|
@@ -1335,6 +1531,11 @@ export declare interface ListOptions<TItem> {
|
|
|
1335
1531
|
filter?: (item: TItem) => boolean;
|
|
1336
1532
|
}
|
|
1337
1533
|
|
|
1534
|
+
export declare type LocalStorageOptions<T> = {
|
|
1535
|
+
serialize?: (value: T) => string;
|
|
1536
|
+
deserialize?: (raw: string) => T;
|
|
1537
|
+
};
|
|
1538
|
+
|
|
1338
1539
|
export declare interface LogEntry {
|
|
1339
1540
|
level: LogLevel;
|
|
1340
1541
|
message: string;
|
|
@@ -1363,7 +1564,7 @@ export declare type Messages = Record<string, string>;
|
|
|
1363
1564
|
* Portal-rendered modal dialog with backdrop, Esc handler, and slots for
|
|
1364
1565
|
* header/body/footer. Locks body scroll while open.
|
|
1365
1566
|
*/
|
|
1366
|
-
export declare function Modal({ open, onClose, title, children, footer, size, closeOnBackdrop, closeOnEsc, className, hideCloseButton, }: ModalProps): ReactPortal | null;
|
|
1567
|
+
export declare function Modal({ open, onClose, title, children, footer, size, closeOnBackdrop, closeOnEsc, className, hideCloseButton, fullscreen, fullscreenOnMobile, }: ModalProps): ReactPortal | null;
|
|
1367
1568
|
|
|
1368
1569
|
export declare interface ModalProps {
|
|
1369
1570
|
open: boolean;
|
|
@@ -1376,9 +1577,13 @@ export declare interface ModalProps {
|
|
|
1376
1577
|
closeOnEsc?: boolean;
|
|
1377
1578
|
className?: string;
|
|
1378
1579
|
hideCloseButton?: boolean;
|
|
1580
|
+
/** Force fullscreen at all breakpoints. */
|
|
1581
|
+
fullscreen?: boolean;
|
|
1582
|
+
/** Auto-fullscreen on mobile viewports (< 640px). Default `false`. */
|
|
1583
|
+
fullscreenOnMobile?: boolean;
|
|
1379
1584
|
}
|
|
1380
1585
|
|
|
1381
|
-
export declare type ModalSize = "sm" | "md" | "lg" | "xl";
|
|
1586
|
+
export declare type ModalSize = "sm" | "md" | "lg" | "xl" | "2xl" | "3xl";
|
|
1382
1587
|
|
|
1383
1588
|
/**
|
|
1384
1589
|
* Currency-masked input. Stores the value as an integer number of cents to
|
|
@@ -1477,7 +1682,7 @@ export declare interface PaginationProps {
|
|
|
1477
1682
|
*/
|
|
1478
1683
|
export declare function parseResponse<TSchema extends z.ZodTypeAny>(schema: TSchema, raw: unknown, context: string): z.infer<TSchema>;
|
|
1479
1684
|
|
|
1480
|
-
export declare const PhoneInput: ForwardRefExoticComponent<Omit<InputProps, "
|
|
1685
|
+
export declare const PhoneInput: ForwardRefExoticComponent<Omit<InputProps, "value" | "onChange"> & {
|
|
1481
1686
|
value: string;
|
|
1482
1687
|
onChange: (value: string) => void;
|
|
1483
1688
|
} & RefAttributes<HTMLInputElement>>;
|
|
@@ -1504,6 +1709,37 @@ export declare interface PlayAudioOptions {
|
|
|
1504
1709
|
onError?: (error: unknown) => void;
|
|
1505
1710
|
}
|
|
1506
1711
|
|
|
1712
|
+
/**
|
|
1713
|
+
* Lightweight popover. Renders a positioned panel anchored to a trigger,
|
|
1714
|
+
* dismissed on outside click / Escape. Does NOT include collision detection
|
|
1715
|
+
* or smart positioning — pair with Floating UI if you need that.
|
|
1716
|
+
*/
|
|
1717
|
+
export declare function Popover({ trigger, children, placement, open, onOpenChange, defaultOpen, closeOnEsc, closeOnOutsideClick, className, }: PopoverProps): JSX.Element;
|
|
1718
|
+
|
|
1719
|
+
export declare type PopoverPlacement = "top" | "bottom" | "left" | "right";
|
|
1720
|
+
|
|
1721
|
+
export declare interface PopoverProps {
|
|
1722
|
+
/** Trigger element. Receives `onClick`/`aria-expanded`/`aria-controls`. */
|
|
1723
|
+
trigger: ReactElement<{
|
|
1724
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
1725
|
+
"aria-expanded"?: boolean;
|
|
1726
|
+
"aria-controls"?: string;
|
|
1727
|
+
}>;
|
|
1728
|
+
children: ReactNode;
|
|
1729
|
+
placement?: PopoverPlacement;
|
|
1730
|
+
/** Controlled open state. */
|
|
1731
|
+
open?: boolean;
|
|
1732
|
+
/** Called when the user toggles or dismisses. */
|
|
1733
|
+
onOpenChange?: (open: boolean) => void;
|
|
1734
|
+
/** Default open state for uncontrolled usage. */
|
|
1735
|
+
defaultOpen?: boolean;
|
|
1736
|
+
/** Close on Escape. Default true. */
|
|
1737
|
+
closeOnEsc?: boolean;
|
|
1738
|
+
/** Close on outside click. Default true. */
|
|
1739
|
+
closeOnOutsideClick?: boolean;
|
|
1740
|
+
className?: string;
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1507
1743
|
/**
|
|
1508
1744
|
* Minimal subset of `posthog-js` used by the adapter. Pass either the real
|
|
1509
1745
|
* default export (`import posthog from "posthog-js"`) or a stubbed object
|
|
@@ -1610,6 +1846,51 @@ export declare interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputEl
|
|
|
1610
1846
|
wrapperClassName?: string;
|
|
1611
1847
|
}
|
|
1612
1848
|
|
|
1849
|
+
/**
|
|
1850
|
+
* Dual-thumb range slider. Built on two native `<input type="range">` so it
|
|
1851
|
+
* stays accessible and works with keyboards/screen readers without
|
|
1852
|
+
* heavyweight positioning libs. The active fill is positioned via percentages.
|
|
1853
|
+
*/
|
|
1854
|
+
export declare function RangeSlider({ value, onChange, min, max, step, label, helperText, disabled, formatValue, className, }: RangeSliderProps): JSX.Element;
|
|
1855
|
+
|
|
1856
|
+
export declare interface RangeSliderProps {
|
|
1857
|
+
value: RangeValue;
|
|
1858
|
+
onChange: (value: RangeValue) => void;
|
|
1859
|
+
min?: number;
|
|
1860
|
+
max?: number;
|
|
1861
|
+
step?: number;
|
|
1862
|
+
label?: string;
|
|
1863
|
+
helperText?: string;
|
|
1864
|
+
disabled?: boolean;
|
|
1865
|
+
/** Formatter for the value badge next to the label. Defaults to `min – max`. */
|
|
1866
|
+
formatValue?: (value: RangeValue) => string;
|
|
1867
|
+
className?: string;
|
|
1868
|
+
}
|
|
1869
|
+
|
|
1870
|
+
export declare type RangeValue = [number, number];
|
|
1871
|
+
|
|
1872
|
+
export declare type RatingSize = "sm" | "md" | "lg";
|
|
1873
|
+
|
|
1874
|
+
/**
|
|
1875
|
+
* Star rating control. Renders `max` stars, fills the first `value`. Click a
|
|
1876
|
+
* star to set rating (when not readonly). Hovering previews the value.
|
|
1877
|
+
*/
|
|
1878
|
+
export declare function RatingStars({ value, max, onChange, size, readonly, disabled, label, className, }: RatingStarsProps): JSX.Element;
|
|
1879
|
+
|
|
1880
|
+
export declare interface RatingStarsProps {
|
|
1881
|
+
/** Current selected value (1..max). 0 means none. */
|
|
1882
|
+
value: number;
|
|
1883
|
+
/** Total number of stars. Default 5. */
|
|
1884
|
+
max?: number;
|
|
1885
|
+
onChange?: (value: number) => void;
|
|
1886
|
+
size?: RatingSize;
|
|
1887
|
+
readonly?: boolean;
|
|
1888
|
+
disabled?: boolean;
|
|
1889
|
+
/** Accessible label for the rating group. */
|
|
1890
|
+
label?: string;
|
|
1891
|
+
className?: string;
|
|
1892
|
+
}
|
|
1893
|
+
|
|
1613
1894
|
/** Recommended refetch intervals (milliseconds). */
|
|
1614
1895
|
export declare const REFETCH_TIME: {
|
|
1615
1896
|
readonly REALTIME: number;
|
|
@@ -1667,6 +1948,17 @@ declare interface ResolverOutput<T> {
|
|
|
1667
1948
|
errors: Record<string, ResolverError | object>;
|
|
1668
1949
|
}
|
|
1669
1950
|
|
|
1951
|
+
/**
|
|
1952
|
+
* Responsive value — either a single value applied at all breakpoints, or
|
|
1953
|
+
* an object with `mobile` / `tablet` / `desktop` overrides. Apps can mix
|
|
1954
|
+
* any combination; `mobile` is the base, `tablet` / `desktop` cascade up.
|
|
1955
|
+
*/
|
|
1956
|
+
export declare type ResponsiveValue<T> = T | {
|
|
1957
|
+
mobile?: T;
|
|
1958
|
+
tablet?: T;
|
|
1959
|
+
desktop?: T;
|
|
1960
|
+
};
|
|
1961
|
+
|
|
1670
1962
|
/**
|
|
1671
1963
|
* Run `factory()` with exponential backoff. Each attempt awaits an
|
|
1672
1964
|
* increasing delay capped at `maxDelay`. Throws the last error if every
|
|
@@ -1779,6 +2071,28 @@ export declare interface ShareResult {
|
|
|
1779
2071
|
error?: unknown;
|
|
1780
2072
|
}
|
|
1781
2073
|
|
|
2074
|
+
/**
|
|
2075
|
+
* Conditionally render children based on the viewport breakpoint.
|
|
2076
|
+
*
|
|
2077
|
+
* - `above` — render when viewport width is `>=` the given breakpoint.
|
|
2078
|
+
* - `below` — render when viewport width is `<` the given breakpoint.
|
|
2079
|
+
* - `only` — render only on the listed breakpoint(s).
|
|
2080
|
+
*
|
|
2081
|
+
* SSR-safe: first render uses `xs` (renders mobile content first); the
|
|
2082
|
+
* component re-renders once `useBreakpoint` has the real viewport width.
|
|
2083
|
+
*/
|
|
2084
|
+
export declare function Show({ above, below, only, children }: ShowProps): ReactNode;
|
|
2085
|
+
|
|
2086
|
+
export declare interface ShowProps {
|
|
2087
|
+
/** Render children only when viewport width is `>=` this breakpoint. */
|
|
2088
|
+
above?: Breakpoint;
|
|
2089
|
+
/** Render children only when viewport width is `<` this breakpoint. */
|
|
2090
|
+
below?: Breakpoint;
|
|
2091
|
+
/** Render only on specific breakpoints. Wins over `above`/`below` when set. */
|
|
2092
|
+
only?: Breakpoint | Breakpoint[];
|
|
2093
|
+
children: ReactNode;
|
|
2094
|
+
}
|
|
2095
|
+
|
|
1782
2096
|
/** Loading placeholder block. Use `variant="text"` for inline lines, `circle` for avatars. */
|
|
1783
2097
|
export declare function Skeleton({ variant, width, height, className, style }: SkeletonProps): JSX.Element;
|
|
1784
2098
|
|
|
@@ -1796,6 +2110,26 @@ export declare interface SkeletonProps {
|
|
|
1796
2110
|
*/
|
|
1797
2111
|
export declare function skipWaiting(worker: ServiceWorker): void;
|
|
1798
2112
|
|
|
2113
|
+
/**
|
|
2114
|
+
* Flex spacer — pushes siblings apart inside a flex container. Equivalent
|
|
2115
|
+
* to `<div style={{ flex: 1 }}>` but typed and intent-revealing.
|
|
2116
|
+
*
|
|
2117
|
+
* @example
|
|
2118
|
+
* <Stack direction="horizontal">
|
|
2119
|
+
* <Button>Cancelar</Button>
|
|
2120
|
+
* <Spacer />
|
|
2121
|
+
* <Button variant="primary">Salvar</Button>
|
|
2122
|
+
* </Stack>
|
|
2123
|
+
*/
|
|
2124
|
+
export declare function Spacer({ axis, className, ...props }: SpacerProps): JSX.Element;
|
|
2125
|
+
|
|
2126
|
+
export declare type SpacerAxis = "both" | "x" | "y";
|
|
2127
|
+
|
|
2128
|
+
export declare interface SpacerProps extends HTMLAttributes<HTMLDivElement> {
|
|
2129
|
+
/** Axis to flex along. Default `"both"` (`flex: 1`). */
|
|
2130
|
+
axis?: SpacerAxis;
|
|
2131
|
+
}
|
|
2132
|
+
|
|
1799
2133
|
/** Loading spinner with preset sizes (xs..xl). Provide `label` for screen readers. */
|
|
1800
2134
|
export declare function Spinner({ size, className, label }: SpinnerProps): JSX.Element;
|
|
1801
2135
|
|
|
@@ -1812,13 +2146,15 @@ export declare function Stack({ direction, gap, align, justify, wrap, className,
|
|
|
1812
2146
|
|
|
1813
2147
|
export declare type StackAlign = "start" | "center" | "end" | "stretch";
|
|
1814
2148
|
|
|
2149
|
+
export declare type StackDirection = "vertical" | "horizontal";
|
|
2150
|
+
|
|
1815
2151
|
export declare type StackJustify = "start" | "center" | "end" | "between";
|
|
1816
2152
|
|
|
1817
2153
|
export declare interface StackProps extends HTMLAttributes<HTMLDivElement> {
|
|
1818
|
-
/** Direction.
|
|
1819
|
-
direction?:
|
|
1820
|
-
/** Gap as a CSS length. Numbers map to a multiple of the 4px scale. */
|
|
1821
|
-
gap?: number | string
|
|
2154
|
+
/** Direction. Accepts responsive object — e.g. `{ mobile: "vertical", desktop: "horizontal" }`. */
|
|
2155
|
+
direction?: ResponsiveValue<StackDirection>;
|
|
2156
|
+
/** Gap as a CSS length. Numbers map to a multiple of the 4px scale. Accepts responsive object. */
|
|
2157
|
+
gap?: ResponsiveValue<number | string>;
|
|
1822
2158
|
align?: StackAlign;
|
|
1823
2159
|
justify?: StackJustify;
|
|
1824
2160
|
wrap?: boolean;
|
|
@@ -1881,11 +2217,13 @@ export declare interface TabItem {
|
|
|
1881
2217
|
}
|
|
1882
2218
|
|
|
1883
2219
|
/**
|
|
1884
|
-
* Lightweight table
|
|
1885
|
-
*
|
|
1886
|
-
* `
|
|
2220
|
+
* Lightweight table with declarative columns + mobile niceties.
|
|
2221
|
+
*
|
|
2222
|
+
* - `priority` per column lets less-important data hide on narrow viewports.
|
|
2223
|
+
* - `stackOnMobile` re-renders each row as a label/value card on mobile,
|
|
2224
|
+
* avoiding horizontal scroll for dense data.
|
|
1887
2225
|
*/
|
|
1888
|
-
export declare function Table<T>({ columns, data, rowKey, onRowClick, emptyMessage, className, }: TableProps<T>): JSX.Element;
|
|
2226
|
+
export declare function Table<T>({ columns, data, rowKey, onRowClick, emptyMessage, className, stackOnMobile, }: TableProps<T>): JSX.Element;
|
|
1889
2227
|
|
|
1890
2228
|
export declare type TableAlign = "left" | "right" | "center";
|
|
1891
2229
|
|
|
@@ -1897,8 +2235,15 @@ export declare interface TableColumn<T> {
|
|
|
1897
2235
|
align?: TableAlign;
|
|
1898
2236
|
width?: string | number;
|
|
1899
2237
|
className?: string;
|
|
2238
|
+
/**
|
|
2239
|
+
* Visibility priority: `always` (default) shows on every viewport,
|
|
2240
|
+
* `tablet` hides below md (< 768px), `desktop` hides below lg (< 1024px).
|
|
2241
|
+
*/
|
|
2242
|
+
priority?: TablePriority;
|
|
1900
2243
|
}
|
|
1901
2244
|
|
|
2245
|
+
export declare type TablePriority = "always" | "tablet" | "desktop";
|
|
2246
|
+
|
|
1902
2247
|
export declare interface TableProps<T> {
|
|
1903
2248
|
columns: TableColumn<T>[];
|
|
1904
2249
|
data: T[];
|
|
@@ -1906,6 +2251,11 @@ export declare interface TableProps<T> {
|
|
|
1906
2251
|
onRowClick?: (row: T) => void;
|
|
1907
2252
|
emptyMessage?: ReactNode;
|
|
1908
2253
|
className?: string;
|
|
2254
|
+
/**
|
|
2255
|
+
* Stack mode — render rows as label/value cards on mobile (< md).
|
|
2256
|
+
* Better than horizontal scroll when each row has 3+ columns of dense data.
|
|
2257
|
+
*/
|
|
2258
|
+
stackOnMobile?: boolean;
|
|
1909
2259
|
}
|
|
1910
2260
|
|
|
1911
2261
|
/**
|
|
@@ -2040,19 +2390,30 @@ export declare interface ToastOptions {
|
|
|
2040
2390
|
duration?: number;
|
|
2041
2391
|
}
|
|
2042
2392
|
|
|
2393
|
+
export declare type ToastPosition = "top-right" | "top-left" | "top-center" | "bottom-right" | "bottom-left" | "bottom-center";
|
|
2394
|
+
|
|
2043
2395
|
/**
|
|
2044
2396
|
* Renders a portalled toast container and exposes the imperative {@link useToast} API.
|
|
2045
2397
|
*/
|
|
2046
|
-
export declare function ToastProvider({ children, defaultDuration }: ToastProviderProps): JSX.Element;
|
|
2398
|
+
export declare function ToastProvider({ children, defaultDuration, position, }: ToastProviderProps): JSX.Element;
|
|
2047
2399
|
|
|
2048
2400
|
export declare interface ToastProviderProps {
|
|
2049
2401
|
children: ReactNode;
|
|
2050
2402
|
/** Default auto-dismiss duration (ms). Default 4000. */
|
|
2051
2403
|
defaultDuration?: number;
|
|
2404
|
+
/** Stack position on screen. Default `"top-right"`. */
|
|
2405
|
+
position?: ToastPosition;
|
|
2052
2406
|
}
|
|
2053
2407
|
|
|
2054
2408
|
export declare type ToastVariant = "success" | "warning" | "error" | "info";
|
|
2055
2409
|
|
|
2410
|
+
export declare interface ToggleHelpers {
|
|
2411
|
+
toggle: () => void;
|
|
2412
|
+
setTrue: () => void;
|
|
2413
|
+
setFalse: () => void;
|
|
2414
|
+
set: (next: boolean) => void;
|
|
2415
|
+
}
|
|
2416
|
+
|
|
2056
2417
|
/**
|
|
2057
2418
|
* Lightweight tooltip. Shows on hover and on focus (keyboard-friendly). Wraps
|
|
2058
2419
|
* a single child element via `cloneElement`, so the trigger keeps its own ref
|
|
@@ -2132,6 +2493,34 @@ export declare interface UploadWithProgressOptions {
|
|
|
2132
2493
|
*/
|
|
2133
2494
|
export declare function urlBase64ToUint8Array(base64String: string): Uint8Array<ArrayBuffer>;
|
|
2134
2495
|
|
|
2496
|
+
/**
|
|
2497
|
+
* Run an async function and track its `idle/pending/success/error` state.
|
|
2498
|
+
*
|
|
2499
|
+
* - Discards results from stale runs (race-condition safe).
|
|
2500
|
+
* - `immediate` (default `false`) triggers the function on mount and when
|
|
2501
|
+
* `deps` change. With `false`, call `run()` manually.
|
|
2502
|
+
* - Returns a stable object so callers can destructure or pass around safely.
|
|
2503
|
+
*
|
|
2504
|
+
* For server data with caching, prefer React Query — `useAsync` is the
|
|
2505
|
+
* minimal one-shot primitive without dependencies.
|
|
2506
|
+
*/
|
|
2507
|
+
export declare function useAsync<T>(asyncFn: () => Promise<T>, deps?: ReadonlyArray<unknown>, options?: {
|
|
2508
|
+
immediate?: boolean;
|
|
2509
|
+
}): UseAsyncResult<T>;
|
|
2510
|
+
|
|
2511
|
+
export declare interface UseAsyncResult<T> {
|
|
2512
|
+
status: AsyncStatus;
|
|
2513
|
+
data: T | undefined;
|
|
2514
|
+
error: unknown;
|
|
2515
|
+
isPending: boolean;
|
|
2516
|
+
isSuccess: boolean;
|
|
2517
|
+
isError: boolean;
|
|
2518
|
+
/** Trigger the async function. Resolves with the new data or rejects. */
|
|
2519
|
+
run: () => Promise<T>;
|
|
2520
|
+
/** Reset state back to idle. */
|
|
2521
|
+
reset: () => void;
|
|
2522
|
+
}
|
|
2523
|
+
|
|
2135
2524
|
/**
|
|
2136
2525
|
* Hook-managed audio player. Each component instance gets its own
|
|
2137
2526
|
* {@link AudioPlayer}, so unmounting cleanly stops playback. Useful for
|
|
@@ -2166,6 +2555,15 @@ export declare interface UseBeforeInstallPromptResult {
|
|
|
2166
2555
|
prompt: () => Promise<"accepted" | "dismissed" | "unsupported">;
|
|
2167
2556
|
}
|
|
2168
2557
|
|
|
2558
|
+
/**
|
|
2559
|
+
* Reactive viewport-breakpoint hook.
|
|
2560
|
+
*
|
|
2561
|
+
* Returns the current breakpoint key plus `above` / `below` helpers and
|
|
2562
|
+
* `isMobile` / `isTablet` / `isDesktop` flags. SSR-safe — returns `xs` /
|
|
2563
|
+
* `width: 0` on the server, then updates after mount.
|
|
2564
|
+
*/
|
|
2565
|
+
export declare function useBreakpoint(): BreakpointHelpers;
|
|
2566
|
+
|
|
2169
2567
|
/**
|
|
2170
2568
|
* Client-side filter helper. Performs a case-insensitive match on the listed
|
|
2171
2569
|
* keys when no custom predicate is provided.
|
|
@@ -2233,6 +2631,21 @@ export declare function useDocumentVisibility(): DocumentVisibility;
|
|
|
2233
2631
|
*/
|
|
2234
2632
|
export declare function useErrorHandler(): (error: unknown) => void;
|
|
2235
2633
|
|
|
2634
|
+
/**
|
|
2635
|
+
* Subscribe to a DOM event with React-friendly semantics.
|
|
2636
|
+
*
|
|
2637
|
+
* - Handler is stored in a ref so callers can pass inline functions without
|
|
2638
|
+
* resubscribing on every render.
|
|
2639
|
+
* - `target` defaults to `window`. Accepts a raw `EventTarget` (window, document,
|
|
2640
|
+
* element) OR a ref pointing at one.
|
|
2641
|
+
* - Returns nothing — cleanup is automatic on unmount or when `eventName`/`target` change.
|
|
2642
|
+
*/
|
|
2643
|
+
export declare function useEventListener<K extends keyof WindowEventMap>(eventName: K, handler: (event: WindowEventMap[K]) => void, target?: AnyEventTarget, options?: AddEventListenerOptions | boolean): void;
|
|
2644
|
+
|
|
2645
|
+
export declare function useEventListener<K extends keyof DocumentEventMap>(eventName: K, handler: (event: DocumentEventMap[K]) => void, target?: AnyEventTarget, options?: AddEventListenerOptions | boolean): void;
|
|
2646
|
+
|
|
2647
|
+
export declare function useEventListener<K extends keyof HTMLElementEventMap>(eventName: K, handler: (event: HTMLElementEventMap[K]) => void, target?: AnyEventTarget, options?: AddEventListenerOptions | boolean): void;
|
|
2648
|
+
|
|
2236
2649
|
/**
|
|
2237
2650
|
* React hook wrapper around {@link createEventStream}. Connection lifecycle is
|
|
2238
2651
|
* tied to the component (and the `url`/`enabled` dependencies); the stream
|
|
@@ -2333,6 +2746,18 @@ export declare interface UseKeyboardShortcutOptions {
|
|
|
2333
2746
|
ignoreInput?: boolean;
|
|
2334
2747
|
}
|
|
2335
2748
|
|
|
2749
|
+
/**
|
|
2750
|
+
* State synced with `localStorage`. SSR-safe — initial render returns the
|
|
2751
|
+
* provided default; the stored value is hydrated after mount. Updates to the
|
|
2752
|
+
* same key in other tabs are picked up via the `storage` event.
|
|
2753
|
+
*
|
|
2754
|
+
* @param key - localStorage key.
|
|
2755
|
+
* @param defaultValue - value used when nothing is stored or in SSR.
|
|
2756
|
+
* @param options - custom `serialize` / `deserialize` (default JSON).
|
|
2757
|
+
* @returns Tuple `[value, setValue, remove]`.
|
|
2758
|
+
*/
|
|
2759
|
+
export declare function useLocalStorage<T>(key: string, defaultValue: T, options?: LocalStorageOptions<T>): [T, (value: T | ((prev: T) => T)) => void, () => void];
|
|
2760
|
+
|
|
2336
2761
|
/**
|
|
2337
2762
|
* Subscribe to a CSS media query and re-render on match changes.
|
|
2338
2763
|
*
|
|
@@ -2460,6 +2885,14 @@ export declare function useTheme(): ThemeContextValue;
|
|
|
2460
2885
|
*/
|
|
2461
2886
|
export declare function useToast(): ToastApi;
|
|
2462
2887
|
|
|
2888
|
+
/**
|
|
2889
|
+
* Boolean state with `toggle`/`setTrue`/`setFalse` helpers.
|
|
2890
|
+
*
|
|
2891
|
+
* @param initial - initial value (default `false`).
|
|
2892
|
+
* @returns Tuple `[value, helpers]`.
|
|
2893
|
+
*/
|
|
2894
|
+
export declare function useToggle(initial?: boolean): [boolean, ToggleHelpers];
|
|
2895
|
+
|
|
2463
2896
|
/**
|
|
2464
2897
|
* Shortcut for components that only need the `t` function — avoids destructuring.
|
|
2465
2898
|
*/
|