@kuntiwar/tonalkit 0.0.0-stage → 1.0.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/LICENSE +21 -0
- package/README.md +61 -2
- package/dist/chunk-DKFQD2ME.js +296 -0
- package/dist/chunk-DKFQD2ME.js.map +1 -0
- package/dist/chunk-EH6TVKAU.cjs +296 -0
- package/dist/chunk-EH6TVKAU.cjs.map +1 -0
- package/dist/index.cjs +2501 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1020 -0
- package/dist/index.d.ts +1020 -0
- package/dist/index.js +2501 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +1 -0
- package/dist/theme.cjs +25 -0
- package/dist/theme.cjs.map +1 -0
- package/dist/theme.d.cts +165 -0
- package/dist/theme.d.ts +165 -0
- package/dist/theme.js +25 -0
- package/dist/theme.js.map +1 -0
- package/package.json +70 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1020 @@
|
|
|
1
|
+
import { Theme, BuiltInThemeName, Breakpoint } from './theme.js';
|
|
2
|
+
export { DeepPartial, ThemeColors, ThemeElevation, ThemeMotion, ThemeShape, ThemeZIndex, TypographyRole, TypographyStyle, blueTheme, breakpointKeys, breakpoints, createTheme, darkTheme, pinkTheme, themeToCss, themeToCssVars, themes, typographyScale } from './theme.js';
|
|
3
|
+
import * as react from 'react';
|
|
4
|
+
import { CSSProperties, ReactNode, HTMLAttributes, ElementType, SVGAttributes, RefObject, MouseEvent, ButtonHTMLAttributes, InputHTMLAttributes, KeyboardEvent, TextareaHTMLAttributes } from 'react';
|
|
5
|
+
|
|
6
|
+
interface ThemeContextValue {
|
|
7
|
+
/** The active theme object. */
|
|
8
|
+
theme: Theme;
|
|
9
|
+
/** Switch theme at runtime. Accepts a theme object or the name of a built-in theme. */
|
|
10
|
+
setTheme: (theme: Theme | BuiltInThemeName) => void;
|
|
11
|
+
/** CSS custom properties for the active theme (used by portals). */
|
|
12
|
+
cssVars: CSSProperties;
|
|
13
|
+
}
|
|
14
|
+
interface ThemeProviderProps {
|
|
15
|
+
/** Controlled theme (object or built-in name: "blue" | "pink" | "dark"). */
|
|
16
|
+
theme?: Theme | BuiltInThemeName;
|
|
17
|
+
/** Initial theme when uncontrolled. Defaults to "blue". */
|
|
18
|
+
defaultTheme?: Theme | BuiltInThemeName;
|
|
19
|
+
/** Called when `setTheme` is used. */
|
|
20
|
+
onThemeChange?: (theme: Theme) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Where the CSS variables are applied. `wrapper` renders a `<div>` (default, SSR friendly);
|
|
23
|
+
* `root` writes them to `<html>` so the whole page is themed.
|
|
24
|
+
*/
|
|
25
|
+
target?: 'wrapper' | 'root';
|
|
26
|
+
/** Paint the theme surface colour behind the wrapper. Default `true`. */
|
|
27
|
+
paintSurface?: boolean;
|
|
28
|
+
className?: string;
|
|
29
|
+
style?: CSSProperties;
|
|
30
|
+
children?: ReactNode;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Provides a theme to all TonalKit components below it.
|
|
34
|
+
* @example <ThemeProvider theme="dark"><App /></ThemeProvider>
|
|
35
|
+
*/
|
|
36
|
+
declare function ThemeProvider({ theme: themeProp, defaultTheme, onThemeChange, target, paintSurface, className, style, children, }: ThemeProviderProps): react.JSX.Element;
|
|
37
|
+
/** Access the active theme and `setTheme`. */
|
|
38
|
+
declare function useTheme(): ThemeContextValue;
|
|
39
|
+
|
|
40
|
+
/** Subscribe to a CSS media query. Returns `false` during SSR. */
|
|
41
|
+
declare function useMediaQuery(query: string): boolean;
|
|
42
|
+
/** True when the viewport is at least the given breakpoint wide. */
|
|
43
|
+
declare function useBreakpointUp(bp: Breakpoint): boolean;
|
|
44
|
+
/** The largest breakpoint that currently matches (`xs` during SSR). */
|
|
45
|
+
declare function useBreakpoint(): Breakpoint;
|
|
46
|
+
|
|
47
|
+
interface Options$1<T> {
|
|
48
|
+
value?: T;
|
|
49
|
+
defaultValue: T;
|
|
50
|
+
onChange?: (value: T) => void;
|
|
51
|
+
}
|
|
52
|
+
/** State that can be controlled (`value`) or uncontrolled (`defaultValue`). */
|
|
53
|
+
declare function useControllableState<T>({ value, defaultValue, onChange }: Options$1<T>): [T, (next: T) => void];
|
|
54
|
+
|
|
55
|
+
interface ContainerProps extends HTMLAttributes<HTMLElement> {
|
|
56
|
+
/** Maximum width, aligned with the Material window size classes. `false` = fluid. Default `lg`. */
|
|
57
|
+
maxWidth?: 'sm' | 'md' | 'lg' | 'xl' | false;
|
|
58
|
+
/** Remove the horizontal padding. */
|
|
59
|
+
disableGutters?: boolean;
|
|
60
|
+
/** Element to render. Default `div`. */
|
|
61
|
+
as?: ElementType;
|
|
62
|
+
}
|
|
63
|
+
/** Centers content horizontally with a responsive max-width and gutters. */
|
|
64
|
+
declare const Container: react.ForwardRefExoticComponent<ContainerProps & react.RefAttributes<HTMLElement>>;
|
|
65
|
+
|
|
66
|
+
type Span = number | 'auto';
|
|
67
|
+
interface GridProps extends HTMLAttributes<HTMLElement> {
|
|
68
|
+
/** Number of columns. Default `12`. */
|
|
69
|
+
columns?: number;
|
|
70
|
+
/** Gap in spacing units (1 unit = 4px by default) for rows and columns. Default `4` (16px). */
|
|
71
|
+
gap?: number;
|
|
72
|
+
rowGap?: number;
|
|
73
|
+
columnGap?: number;
|
|
74
|
+
alignItems?: CSSProperties['alignItems'];
|
|
75
|
+
justifyItems?: CSSProperties['justifyItems'];
|
|
76
|
+
as?: ElementType;
|
|
77
|
+
}
|
|
78
|
+
/** CSS grid container with a 12 column (configurable) layout. Use with `Col`. */
|
|
79
|
+
declare const Grid: react.ForwardRefExoticComponent<GridProps & react.RefAttributes<HTMLElement>>;
|
|
80
|
+
interface ColProps extends HTMLAttributes<HTMLElement> {
|
|
81
|
+
/** Columns to span at every size (same as `xs`). */
|
|
82
|
+
span?: Span;
|
|
83
|
+
xs?: Span;
|
|
84
|
+
sm?: Span;
|
|
85
|
+
md?: Span;
|
|
86
|
+
lg?: Span;
|
|
87
|
+
xl?: Span;
|
|
88
|
+
/** Columns to skip before this item. A number applies from `xs`; an object sets it per breakpoint. */
|
|
89
|
+
offset?: number | Partial<Record<Breakpoint, number>>;
|
|
90
|
+
/** Span the full row. */
|
|
91
|
+
full?: boolean;
|
|
92
|
+
as?: ElementType;
|
|
93
|
+
}
|
|
94
|
+
/** Grid item. Spans are 1–12 and can differ per breakpoint (mobile first). */
|
|
95
|
+
declare const Col: react.ForwardRefExoticComponent<ColProps & react.RefAttributes<HTMLElement>>;
|
|
96
|
+
|
|
97
|
+
interface StackProps extends HTMLAttributes<HTMLElement> {
|
|
98
|
+
/** Main axis direction. Default `column`. */
|
|
99
|
+
direction?: 'row' | 'column';
|
|
100
|
+
/** Space between children in spacing units (1 unit = 4px by default). Default `2`. */
|
|
101
|
+
spacing?: number;
|
|
102
|
+
alignItems?: CSSProperties['alignItems'];
|
|
103
|
+
justifyContent?: CSSProperties['justifyContent'];
|
|
104
|
+
/** Allow children to wrap onto multiple lines. */
|
|
105
|
+
wrap?: boolean;
|
|
106
|
+
/** Element rendered between each pair of children, e.g. `<Divider />`. */
|
|
107
|
+
divider?: ReactNode;
|
|
108
|
+
as?: ElementType;
|
|
109
|
+
}
|
|
110
|
+
/** One-dimensional flex layout with consistent spacing. */
|
|
111
|
+
declare const Stack: react.ForwardRefExoticComponent<StackProps & react.RefAttributes<HTMLElement>>;
|
|
112
|
+
|
|
113
|
+
/** Built-in icon paths (24×24, Material Icons, Apache-2.0). */
|
|
114
|
+
declare const iconPaths: {
|
|
115
|
+
readonly add: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z";
|
|
116
|
+
readonly remove: "M19 13H5v-2h14v2z";
|
|
117
|
+
readonly close: "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z";
|
|
118
|
+
readonly check: "M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z";
|
|
119
|
+
readonly 'check-circle': "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z";
|
|
120
|
+
readonly info: "M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z";
|
|
121
|
+
readonly warning: "M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z";
|
|
122
|
+
readonly error: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z";
|
|
123
|
+
readonly 'chevron-left': "M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z";
|
|
124
|
+
readonly 'chevron-right': "M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z";
|
|
125
|
+
readonly 'expand-more': "M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z";
|
|
126
|
+
readonly 'expand-less': "M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z";
|
|
127
|
+
readonly 'first-page': "M18.41 16.59 13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z";
|
|
128
|
+
readonly 'last-page': "M5.59 7.41 10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z";
|
|
129
|
+
readonly menu: "M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z";
|
|
130
|
+
readonly search: "M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z";
|
|
131
|
+
readonly home: "M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z";
|
|
132
|
+
readonly person: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z";
|
|
133
|
+
readonly settings: "M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58a.49.49 0 0 0 .12-.61l-1.92-3.32a.488.488 0 0 0-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.484.484 0 0 0-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58a.49.49 0 0 0-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z";
|
|
134
|
+
readonly mail: "M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4-8 5-8-5V6l8 5 8-5v2z";
|
|
135
|
+
readonly notifications: "M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z";
|
|
136
|
+
readonly star: "M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z";
|
|
137
|
+
readonly favorite: "M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z";
|
|
138
|
+
readonly delete: "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z";
|
|
139
|
+
readonly edit: "M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04a.996.996 0 0 0 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z";
|
|
140
|
+
readonly upload: "M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z";
|
|
141
|
+
readonly download: "M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z";
|
|
142
|
+
readonly file: "M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm-1 7V3.5L18.5 9H13z";
|
|
143
|
+
readonly calendar: "M19 4h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V10h14v10zm0-12H5V6h14v2z";
|
|
144
|
+
readonly visibility: "M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z";
|
|
145
|
+
readonly 'visibility-off': "M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78 3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z";
|
|
146
|
+
readonly 'more-vert': "M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z";
|
|
147
|
+
readonly copy: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z";
|
|
148
|
+
readonly folder: "M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z";
|
|
149
|
+
readonly dashboard: "M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z";
|
|
150
|
+
};
|
|
151
|
+
type IconName = keyof typeof iconPaths;
|
|
152
|
+
interface IconProps extends Omit<SVGAttributes<SVGSVGElement>, 'name'> {
|
|
153
|
+
/** Name of a built-in icon. */
|
|
154
|
+
name?: IconName;
|
|
155
|
+
/** Size in px (number) or any CSS length. Default `24`. */
|
|
156
|
+
size?: number | string;
|
|
157
|
+
/** Accessible label. When omitted the icon is hidden from screen readers. */
|
|
158
|
+
title?: string;
|
|
159
|
+
}
|
|
160
|
+
/** SVG icon. Pass a built-in `name` or custom SVG `children` (24×24 viewBox). */
|
|
161
|
+
declare const Icon: react.ForwardRefExoticComponent<IconProps & react.RefAttributes<SVGSVGElement>>;
|
|
162
|
+
|
|
163
|
+
type Placement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end';
|
|
164
|
+
interface VirtualPoint {
|
|
165
|
+
x: number;
|
|
166
|
+
y: number;
|
|
167
|
+
}
|
|
168
|
+
interface Options {
|
|
169
|
+
open: boolean;
|
|
170
|
+
anchorRef?: RefObject<HTMLElement | null>;
|
|
171
|
+
point?: VirtualPoint | null;
|
|
172
|
+
placement?: Placement;
|
|
173
|
+
offset?: number;
|
|
174
|
+
}
|
|
175
|
+
/** Positions a `position: fixed` floating element next to an anchor element or a point. */
|
|
176
|
+
declare function useFloating({ open, anchorRef, point, placement, offset }: Options): {
|
|
177
|
+
floatingRef: react.MutableRefObject<HTMLDivElement | null>;
|
|
178
|
+
style: CSSProperties;
|
|
179
|
+
placement: Placement;
|
|
180
|
+
update: () => void;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Keeps an element mounted long enough to play its exit animation.
|
|
185
|
+
* `mounted` = render it; `visible` = apply the "open" styles.
|
|
186
|
+
*/
|
|
187
|
+
declare function usePresence(open: boolean, exitMs?: number): {
|
|
188
|
+
mounted: boolean;
|
|
189
|
+
visible: boolean;
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
type AccordionVariant = 'elevated' | 'outlined' | 'filled' | 'flush';
|
|
193
|
+
interface AccordionProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {
|
|
194
|
+
/** `single` keeps one item open at a time, `multiple` allows several. Default `single`. */
|
|
195
|
+
type?: 'single' | 'multiple';
|
|
196
|
+
/** Allow closing the open item in `single` mode. Default `true`. */
|
|
197
|
+
collapsible?: boolean;
|
|
198
|
+
/** Open item values (controlled). */
|
|
199
|
+
value?: string[];
|
|
200
|
+
defaultValue?: string[];
|
|
201
|
+
/** Called with the list of open item values. */
|
|
202
|
+
onChange?: (value: string[]) => void;
|
|
203
|
+
/** Visual style. Default `outlined`. */
|
|
204
|
+
variant?: AccordionVariant;
|
|
205
|
+
}
|
|
206
|
+
/** Vertically stacked sections that expand and collapse. */
|
|
207
|
+
declare const Accordion: react.ForwardRefExoticComponent<AccordionProps & react.RefAttributes<HTMLDivElement>>;
|
|
208
|
+
interface AccordionItemProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
209
|
+
/** Unique value identifying the item. */
|
|
210
|
+
value: string;
|
|
211
|
+
/** Header text. */
|
|
212
|
+
title: ReactNode;
|
|
213
|
+
/** Secondary header text. */
|
|
214
|
+
subtitle?: ReactNode;
|
|
215
|
+
/** Icon before the title. */
|
|
216
|
+
icon?: ReactNode;
|
|
217
|
+
disabled?: boolean;
|
|
218
|
+
}
|
|
219
|
+
declare const AccordionItem: react.ForwardRefExoticComponent<AccordionItemProps & react.RefAttributes<HTMLDivElement>>;
|
|
220
|
+
|
|
221
|
+
/** Colour roles available to components through the `color` prop. */
|
|
222
|
+
type ColorRole = 'primary' | 'secondary' | 'tertiary' | 'error' | 'success' | 'warning' | 'info';
|
|
223
|
+
type Severity = 'info' | 'success' | 'warning' | 'error';
|
|
224
|
+
|
|
225
|
+
interface AlertProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
226
|
+
/** Meaning of the message. Default `info`. */
|
|
227
|
+
severity?: Severity;
|
|
228
|
+
variant?: 'tonal' | 'filled' | 'outlined';
|
|
229
|
+
/** Bold heading above the message. */
|
|
230
|
+
title?: ReactNode;
|
|
231
|
+
/** Custom icon, or `false` to hide it. */
|
|
232
|
+
icon?: ReactNode | false;
|
|
233
|
+
/** Shows a close button when provided. */
|
|
234
|
+
onClose?: () => void;
|
|
235
|
+
/** Element on the right, such as a Button. */
|
|
236
|
+
action?: ReactNode;
|
|
237
|
+
}
|
|
238
|
+
/** Inline message that communicates status. */
|
|
239
|
+
declare const Alert: react.ForwardRefExoticComponent<AlertProps & react.RefAttributes<HTMLDivElement>>;
|
|
240
|
+
|
|
241
|
+
interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {
|
|
242
|
+
/** Image URL. Falls back to initials if it fails to load. */
|
|
243
|
+
src?: string;
|
|
244
|
+
alt?: string;
|
|
245
|
+
/** Person or entity name; used for initials and a stable background colour. */
|
|
246
|
+
name?: string;
|
|
247
|
+
/** `sm` 32, `md` 40, `lg` 56, `xl` 96 or a number in px. Default `md`. */
|
|
248
|
+
size?: 'sm' | 'md' | 'lg' | 'xl' | number;
|
|
249
|
+
shape?: 'circle' | 'rounded';
|
|
250
|
+
/** Small presence indicator. */
|
|
251
|
+
status?: 'online' | 'offline' | 'busy' | 'away';
|
|
252
|
+
/** Custom content (e.g. an Icon). Used when there is no image or name. */
|
|
253
|
+
children?: ReactNode;
|
|
254
|
+
}
|
|
255
|
+
/** Image, initials or icon representing a user or entity. */
|
|
256
|
+
declare const Avatar: react.ForwardRefExoticComponent<AvatarProps & react.RefAttributes<HTMLSpanElement>>;
|
|
257
|
+
interface AvatarGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
258
|
+
/** Maximum avatars shown before a "+N" avatar. Default `4`. */
|
|
259
|
+
max?: number;
|
|
260
|
+
size?: AvatarProps['size'];
|
|
261
|
+
}
|
|
262
|
+
/** Overlapping stack of avatars with a "+N" overflow. */
|
|
263
|
+
declare const AvatarGroup: react.ForwardRefExoticComponent<AvatarGroupProps & react.RefAttributes<HTMLDivElement>>;
|
|
264
|
+
|
|
265
|
+
interface BadgeProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'content'> {
|
|
266
|
+
/** Number shown in the badge. */
|
|
267
|
+
count?: number;
|
|
268
|
+
/** Custom badge content (overrides `count`). */
|
|
269
|
+
content?: ReactNode;
|
|
270
|
+
/** Show a small dot instead of a number. */
|
|
271
|
+
dot?: boolean;
|
|
272
|
+
/** Counts above `max` render as `max+`. Default `99`. */
|
|
273
|
+
max?: number;
|
|
274
|
+
/** Render the badge when `count` is 0. */
|
|
275
|
+
showZero?: boolean;
|
|
276
|
+
/** Hide the badge. */
|
|
277
|
+
invisible?: boolean;
|
|
278
|
+
color?: ColorRole;
|
|
279
|
+
/** Corner of the child where the badge sits. Default `top-end`. */
|
|
280
|
+
position?: 'top-end' | 'top-start' | 'bottom-end' | 'bottom-start';
|
|
281
|
+
/** Use `circular` when the child is round (e.g. an Avatar) to hug its edge. */
|
|
282
|
+
overlap?: 'rectangular' | 'circular';
|
|
283
|
+
/** Screen reader text, e.g. "3 unread messages". */
|
|
284
|
+
srLabel?: string;
|
|
285
|
+
/** Element the badge is attached to. Without children the badge is rendered inline. */
|
|
286
|
+
children?: ReactNode;
|
|
287
|
+
}
|
|
288
|
+
/** Small status descriptor: a count, a dot or custom content. */
|
|
289
|
+
declare const Badge: react.ForwardRefExoticComponent<BadgeProps & react.RefAttributes<HTMLSpanElement>>;
|
|
290
|
+
|
|
291
|
+
interface BreadcrumbItem {
|
|
292
|
+
label: ReactNode;
|
|
293
|
+
/** Link target. The last item is rendered as the current page. */
|
|
294
|
+
href?: string;
|
|
295
|
+
icon?: ReactNode;
|
|
296
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
297
|
+
}
|
|
298
|
+
interface BreadcrumbProps extends Omit<HTMLAttributes<HTMLElement>, 'children'> {
|
|
299
|
+
items: BreadcrumbItem[];
|
|
300
|
+
/** Separator between items. Default is a chevron icon. */
|
|
301
|
+
separator?: ReactNode;
|
|
302
|
+
/** Collapse middle items into "…" when there are more than this many. */
|
|
303
|
+
maxItems?: number;
|
|
304
|
+
/** Items kept before the "…". Default `1`. */
|
|
305
|
+
itemsBeforeCollapse?: number;
|
|
306
|
+
/** Items kept after the "…". Default `2`. */
|
|
307
|
+
itemsAfterCollapse?: number;
|
|
308
|
+
}
|
|
309
|
+
/** Shows the user's location within a hierarchy. */
|
|
310
|
+
declare const Breadcrumb: react.ForwardRefExoticComponent<BreadcrumbProps & react.RefAttributes<HTMLElement>>;
|
|
311
|
+
|
|
312
|
+
interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'color'> {
|
|
313
|
+
/** Visual emphasis. Default `filled`. */
|
|
314
|
+
variant?: 'filled' | 'tonal' | 'elevated' | 'outlined' | 'text';
|
|
315
|
+
size?: 'sm' | 'md' | 'lg';
|
|
316
|
+
/** Colour role. Default `primary`. */
|
|
317
|
+
color?: ColorRole;
|
|
318
|
+
/** Icon before the label. */
|
|
319
|
+
startIcon?: ReactNode;
|
|
320
|
+
/** Icon after the label. */
|
|
321
|
+
endIcon?: ReactNode;
|
|
322
|
+
/** Show a spinner and block interaction. */
|
|
323
|
+
loading?: boolean;
|
|
324
|
+
/** Stretch to the width of the container. */
|
|
325
|
+
fullWidth?: boolean;
|
|
326
|
+
/** Square/circular button containing only an icon. Remember `aria-label`. */
|
|
327
|
+
iconOnly?: boolean;
|
|
328
|
+
shape?: 'round' | 'square';
|
|
329
|
+
/** Toggle button state. When defined the button gets `aria-pressed`. */
|
|
330
|
+
selected?: boolean;
|
|
331
|
+
/** Badge on the button's corner: a number, text, or `true` for a dot. */
|
|
332
|
+
badge?: number | string | boolean;
|
|
333
|
+
/** Render as another element, e.g. `a` or a router `Link`. */
|
|
334
|
+
as?: ElementType;
|
|
335
|
+
href?: string;
|
|
336
|
+
target?: string;
|
|
337
|
+
rel?: string;
|
|
338
|
+
}
|
|
339
|
+
/** Triggers an action. Five Material emphasis levels, icons, loading and badge support. */
|
|
340
|
+
declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
341
|
+
|
|
342
|
+
interface DateRange {
|
|
343
|
+
start: Date | null;
|
|
344
|
+
end: Date | null;
|
|
345
|
+
}
|
|
346
|
+
interface BaseProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {
|
|
347
|
+
/** Month shown (controlled). Only the year and month are used. */
|
|
348
|
+
month?: Date;
|
|
349
|
+
/** Month shown initially when uncontrolled. Defaults to the selected date or today. */
|
|
350
|
+
defaultMonth?: Date;
|
|
351
|
+
onMonthChange?: (month: Date) => void;
|
|
352
|
+
/** BCP 47 locale for month and weekday names. Default `en-US`. */
|
|
353
|
+
locale?: string;
|
|
354
|
+
/** First day of the week: 0 = Sunday … 6 = Saturday. Default `0`. */
|
|
355
|
+
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
356
|
+
/** Earliest selectable date. */
|
|
357
|
+
min?: Date;
|
|
358
|
+
/** Latest selectable date. */
|
|
359
|
+
max?: Date;
|
|
360
|
+
/** Return `true` to make a date unselectable. */
|
|
361
|
+
disabledDate?: (date: Date) => boolean;
|
|
362
|
+
/** Show days of the neighbouring months. Default `true`. */
|
|
363
|
+
showOutsideDays?: boolean;
|
|
364
|
+
/** Show a "Today" shortcut button. */
|
|
365
|
+
showToday?: boolean;
|
|
366
|
+
disabled?: boolean;
|
|
367
|
+
}
|
|
368
|
+
interface SingleCalendarProps extends BaseProps {
|
|
369
|
+
mode?: 'single';
|
|
370
|
+
value?: Date | null;
|
|
371
|
+
defaultValue?: Date | null;
|
|
372
|
+
onChange?: (date: Date) => void;
|
|
373
|
+
}
|
|
374
|
+
interface RangeCalendarProps extends BaseProps {
|
|
375
|
+
mode: 'range';
|
|
376
|
+
value?: DateRange;
|
|
377
|
+
defaultValue?: DateRange;
|
|
378
|
+
onChange?: (range: DateRange) => void;
|
|
379
|
+
}
|
|
380
|
+
type CalendarProps = SingleCalendarProps | RangeCalendarProps;
|
|
381
|
+
/** Month calendar for picking a date or a date range, with keyboard navigation and a year picker. */
|
|
382
|
+
declare const Calendar: react.ForwardRefExoticComponent<CalendarProps & react.RefAttributes<HTMLDivElement>>;
|
|
383
|
+
|
|
384
|
+
interface CardProps extends HTMLAttributes<HTMLElement> {
|
|
385
|
+
/** Surface style. Default `elevated`. */
|
|
386
|
+
variant?: 'elevated' | 'filled' | 'outlined';
|
|
387
|
+
/** Adds hover / focus / pressed state layers and a pointer cursor. Use with `onClick` or `as="a"`. */
|
|
388
|
+
interactive?: boolean;
|
|
389
|
+
/** Layout direction of the card's direct sections. */
|
|
390
|
+
orientation?: 'vertical' | 'horizontal';
|
|
391
|
+
as?: ElementType;
|
|
392
|
+
href?: string;
|
|
393
|
+
}
|
|
394
|
+
/** Container that groups related content and actions. */
|
|
395
|
+
declare const Card: react.ForwardRefExoticComponent<CardProps & react.RefAttributes<HTMLElement>>;
|
|
396
|
+
interface CardHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
397
|
+
title: ReactNode;
|
|
398
|
+
subtitle?: ReactNode;
|
|
399
|
+
/** Leading element, usually an Avatar. */
|
|
400
|
+
avatar?: ReactNode;
|
|
401
|
+
/** Trailing element, usually an icon button. */
|
|
402
|
+
action?: ReactNode;
|
|
403
|
+
}
|
|
404
|
+
declare const CardHeader: react.ForwardRefExoticComponent<CardHeaderProps & react.RefAttributes<HTMLDivElement>>;
|
|
405
|
+
interface CardMediaProps extends HTMLAttributes<HTMLDivElement> {
|
|
406
|
+
/** Image URL (rendered as a cover image). */
|
|
407
|
+
src?: string;
|
|
408
|
+
alt?: string;
|
|
409
|
+
/** Height in px or CSS length. Default `180`. */
|
|
410
|
+
height?: number | string;
|
|
411
|
+
}
|
|
412
|
+
declare const CardMedia: react.ForwardRefExoticComponent<CardMediaProps & react.RefAttributes<HTMLDivElement>>;
|
|
413
|
+
declare const CardContent: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & react.RefAttributes<HTMLDivElement>>;
|
|
414
|
+
declare const CardActions: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
415
|
+
align?: "start" | "end" | "between";
|
|
416
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
417
|
+
|
|
418
|
+
interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'> {
|
|
419
|
+
/** Visible label. */
|
|
420
|
+
label?: ReactNode;
|
|
421
|
+
/** Secondary text under the label. */
|
|
422
|
+
description?: ReactNode;
|
|
423
|
+
/** Partially selected (e.g. "select all" with some children selected). */
|
|
424
|
+
indeterminate?: boolean;
|
|
425
|
+
error?: boolean;
|
|
426
|
+
color?: ColorRole;
|
|
427
|
+
/** Place the label before the box. */
|
|
428
|
+
labelPlacement?: 'end' | 'start';
|
|
429
|
+
}
|
|
430
|
+
/** Binary (or tri-state) selection control. */
|
|
431
|
+
declare const Checkbox: react.ForwardRefExoticComponent<CheckboxProps & react.RefAttributes<HTMLInputElement>>;
|
|
432
|
+
|
|
433
|
+
interface ChipProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onClick'> {
|
|
434
|
+
/** Material chip type. `filter` chips show a check when selected; `input` chips are usually deletable. */
|
|
435
|
+
variant?: 'assist' | 'filter' | 'input' | 'suggestion';
|
|
436
|
+
/** Selected state (filter / input chips). */
|
|
437
|
+
selected?: boolean;
|
|
438
|
+
/** Makes the chip clickable. */
|
|
439
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
440
|
+
/** Shows a remove (×) button and calls this when pressed. */
|
|
441
|
+
onDelete?: (event: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => void;
|
|
442
|
+
/** Leading icon. */
|
|
443
|
+
icon?: ReactNode;
|
|
444
|
+
/** Leading avatar (replaces `icon`). */
|
|
445
|
+
avatar?: ReactNode;
|
|
446
|
+
/** Raised chip with a shadow instead of an outline. */
|
|
447
|
+
elevated?: boolean;
|
|
448
|
+
disabled?: boolean;
|
|
449
|
+
size?: 'sm' | 'md';
|
|
450
|
+
}
|
|
451
|
+
/** Compact element for filters, input tokens, suggestions and actions. */
|
|
452
|
+
declare const Chip: react.ForwardRefExoticComponent<ChipProps & react.RefAttributes<HTMLDivElement>>;
|
|
453
|
+
|
|
454
|
+
interface CollapseProps extends HTMLAttributes<HTMLDivElement> {
|
|
455
|
+
/** Whether the content is expanded. */
|
|
456
|
+
open: boolean;
|
|
457
|
+
}
|
|
458
|
+
/** Animates height between 0 and the content height. Collapsed content is hidden from keyboard and screen readers. */
|
|
459
|
+
declare const Collapse: react.ForwardRefExoticComponent<CollapseProps & react.RefAttributes<HTMLDivElement>>;
|
|
460
|
+
|
|
461
|
+
interface ContextMenuItem {
|
|
462
|
+
/** Visible text. Ignored for `divider` items. */
|
|
463
|
+
label?: ReactNode;
|
|
464
|
+
icon?: ReactNode;
|
|
465
|
+
/** Keyboard shortcut hint shown on the right, e.g. "⌘C". */
|
|
466
|
+
shortcut?: string;
|
|
467
|
+
onSelect?: () => void;
|
|
468
|
+
disabled?: boolean;
|
|
469
|
+
/** Style as destructive (error colour). */
|
|
470
|
+
danger?: boolean;
|
|
471
|
+
/** Render a separator line instead of an item. */
|
|
472
|
+
divider?: boolean;
|
|
473
|
+
/** Render a non-interactive group heading. */
|
|
474
|
+
heading?: boolean;
|
|
475
|
+
/** Stable key (optional). */
|
|
476
|
+
id?: string;
|
|
477
|
+
}
|
|
478
|
+
interface ContextMenuProps extends Omit<HTMLAttributes<HTMLElement>, 'onContextMenu'> {
|
|
479
|
+
items: ContextMenuItem[];
|
|
480
|
+
/**
|
|
481
|
+
* How the menu is opened. `double-right-click` needs two right-clicks in quick succession
|
|
482
|
+
* (the browser's own menu is suppressed); `right-click` opens on the first. Default `double-right-click`.
|
|
483
|
+
*/
|
|
484
|
+
trigger?: 'double-right-click' | 'right-click';
|
|
485
|
+
/** Max time between the two right-clicks, in ms. Default `500`. */
|
|
486
|
+
doubleClickDelay?: number;
|
|
487
|
+
disabled?: boolean;
|
|
488
|
+
onOpenChange?: (open: boolean) => void;
|
|
489
|
+
/** Element to render. Default `div`. */
|
|
490
|
+
as?: ElementType;
|
|
491
|
+
children?: ReactNode;
|
|
492
|
+
}
|
|
493
|
+
/** Custom menu opened by a (double) right-click or the keyboard's menu key on the wrapped area. */
|
|
494
|
+
declare const ContextMenu: react.ForwardRefExoticComponent<ContextMenuProps & react.RefAttributes<HTMLElement>>;
|
|
495
|
+
|
|
496
|
+
interface ModalProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
497
|
+
/** Whether the modal is shown. */
|
|
498
|
+
open: boolean;
|
|
499
|
+
/** Called when the user asks to close (Escape, backdrop click). */
|
|
500
|
+
onClose?: () => void;
|
|
501
|
+
/** Panel width. `fullscreen` fills the viewport. Default `md`. */
|
|
502
|
+
size?: 'sm' | 'md' | 'lg' | 'xl' | 'fullscreen';
|
|
503
|
+
/** Close when the backdrop is clicked. Default `true`. */
|
|
504
|
+
closeOnBackdrop?: boolean;
|
|
505
|
+
/** Close when Escape is pressed. Default `true`. */
|
|
506
|
+
closeOnEsc?: boolean;
|
|
507
|
+
/** Use `alertdialog` for urgent confirmations. */
|
|
508
|
+
role?: 'dialog' | 'alertdialog';
|
|
509
|
+
/** Class for the dimmed backdrop. */
|
|
510
|
+
backdropClassName?: string;
|
|
511
|
+
children?: ReactNode;
|
|
512
|
+
}
|
|
513
|
+
/** Overlay panel that blocks the page. Traps focus, locks scroll and restores focus on close. */
|
|
514
|
+
declare const Modal: react.ForwardRefExoticComponent<ModalProps & react.RefAttributes<HTMLDivElement>>;
|
|
515
|
+
|
|
516
|
+
interface DialogProps extends Omit<ModalProps, 'title' | 'role'> {
|
|
517
|
+
/** Dialog headline. */
|
|
518
|
+
title?: ReactNode;
|
|
519
|
+
/** Supporting text below the title. */
|
|
520
|
+
description?: ReactNode;
|
|
521
|
+
/** Hero icon above the title (centers the header). */
|
|
522
|
+
icon?: ReactNode;
|
|
523
|
+
/** Action buttons, usually right-aligned `Button`s. */
|
|
524
|
+
actions?: ReactNode;
|
|
525
|
+
/** `alert` dialogs interrupt the user and don't close on backdrop click. */
|
|
526
|
+
variant?: 'basic' | 'alert';
|
|
527
|
+
}
|
|
528
|
+
/** Material dialog: icon, title, description, body and actions. Built on `Modal`. */
|
|
529
|
+
declare const Dialog: react.ForwardRefExoticComponent<DialogProps & react.RefAttributes<HTMLDivElement>>;
|
|
530
|
+
|
|
531
|
+
interface DividerProps extends HTMLAttributes<HTMLElement> {
|
|
532
|
+
orientation?: 'horizontal' | 'vertical';
|
|
533
|
+
/** `inset` indents the start by 16px, `middle` indents both sides. */
|
|
534
|
+
variant?: 'full' | 'inset' | 'middle';
|
|
535
|
+
/** Text or element placed on the line. */
|
|
536
|
+
children?: ReactNode;
|
|
537
|
+
/** Where the label sits on the line. Default `center`. */
|
|
538
|
+
align?: 'start' | 'center' | 'end';
|
|
539
|
+
}
|
|
540
|
+
/** Thin line that separates content. Optionally carries a label. */
|
|
541
|
+
declare const Divider: react.ForwardRefExoticComponent<DividerProps & react.RefAttributes<HTMLElement>>;
|
|
542
|
+
|
|
543
|
+
interface FileRejection {
|
|
544
|
+
file: File;
|
|
545
|
+
reason: 'type' | 'size' | 'count';
|
|
546
|
+
}
|
|
547
|
+
interface FileUploadProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | 'title'> {
|
|
548
|
+
/** Accepted types, like the native `accept` attribute: `image/*,.pdf`. */
|
|
549
|
+
accept?: string;
|
|
550
|
+
multiple?: boolean;
|
|
551
|
+
/** Maximum size per file in bytes. */
|
|
552
|
+
maxSize?: number;
|
|
553
|
+
/** Maximum number of files (when `multiple`). */
|
|
554
|
+
maxFiles?: number;
|
|
555
|
+
/** Controlled list of files. */
|
|
556
|
+
value?: File[];
|
|
557
|
+
defaultValue?: File[];
|
|
558
|
+
onChange?: (files: File[]) => void;
|
|
559
|
+
/** Called with files that were refused and why. */
|
|
560
|
+
onReject?: (rejections: FileRejection[]) => void;
|
|
561
|
+
disabled?: boolean;
|
|
562
|
+
/** `dropzone` shows a drag-and-drop area; `button` just a button. Default `dropzone`. */
|
|
563
|
+
variant?: 'dropzone' | 'button';
|
|
564
|
+
/** Main text in the dropzone. */
|
|
565
|
+
title?: ReactNode;
|
|
566
|
+
/** Secondary text, e.g. allowed formats. */
|
|
567
|
+
hint?: ReactNode;
|
|
568
|
+
/** Show the selected files list. Default `true`. */
|
|
569
|
+
showFileList?: boolean;
|
|
570
|
+
error?: boolean;
|
|
571
|
+
helperText?: ReactNode;
|
|
572
|
+
}
|
|
573
|
+
declare function formatBytes(bytes: number): string;
|
|
574
|
+
/** File picker with drag-and-drop, validation and a removable file list. */
|
|
575
|
+
declare const FileUpload: react.ForwardRefExoticComponent<FileUploadProps & react.RefAttributes<HTMLDivElement>>;
|
|
576
|
+
|
|
577
|
+
interface FieldChromeProps {
|
|
578
|
+
/** Visual style. Default `outlined`. */
|
|
579
|
+
variant?: 'outlined' | 'filled';
|
|
580
|
+
/** Floating label. */
|
|
581
|
+
label?: ReactNode;
|
|
582
|
+
/** Helper or error message below the field. */
|
|
583
|
+
helperText?: ReactNode;
|
|
584
|
+
/** Error state. */
|
|
585
|
+
error?: boolean;
|
|
586
|
+
disabled?: boolean;
|
|
587
|
+
/** Element placed before the input, e.g. an Icon. */
|
|
588
|
+
startAdornment?: ReactNode;
|
|
589
|
+
/** Element placed after the input, e.g. an Icon or button. */
|
|
590
|
+
endAdornment?: ReactNode;
|
|
591
|
+
fullWidth?: boolean;
|
|
592
|
+
/** `sm` = 40px high. Default `md` = 56px. */
|
|
593
|
+
size?: 'sm' | 'md';
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix'>, FieldChromeProps {
|
|
597
|
+
/** Show a clear (×) button while the field has a value. */
|
|
598
|
+
clearable?: boolean;
|
|
599
|
+
/** Called after the clear button is pressed. */
|
|
600
|
+
onClear?: () => void;
|
|
601
|
+
/** Show a "length / maxLength" counter (needs `maxLength`). */
|
|
602
|
+
showCounter?: boolean;
|
|
603
|
+
/** Class applied to the outer wrapper element (`className` targets the native input). */
|
|
604
|
+
wrapperClassName?: string;
|
|
605
|
+
}
|
|
606
|
+
/** Single-line text field with floating label, adornments, helper text and validation state. */
|
|
607
|
+
declare const Input: react.ForwardRefExoticComponent<InputProps & react.RefAttributes<HTMLInputElement>>;
|
|
608
|
+
|
|
609
|
+
interface InputTagsProps extends FieldChromeProps {
|
|
610
|
+
/** Controlled list of tags. */
|
|
611
|
+
value?: string[];
|
|
612
|
+
/** Initial tags when uncontrolled. */
|
|
613
|
+
defaultValue?: string[];
|
|
614
|
+
/** Called with the new list whenever a tag is added or removed. */
|
|
615
|
+
onChange?: (tags: string[]) => void;
|
|
616
|
+
placeholder?: string;
|
|
617
|
+
/** Keys that commit the current text as a tag. Default `['Enter', ',']`. */
|
|
618
|
+
delimiters?: string[];
|
|
619
|
+
/** Maximum number of tags. */
|
|
620
|
+
max?: number;
|
|
621
|
+
/** Allow the same tag twice. Default `false`. */
|
|
622
|
+
allowDuplicates?: boolean;
|
|
623
|
+
/** Return `false` (or an error string) to reject a tag. */
|
|
624
|
+
validate?: (tag: string) => boolean | string;
|
|
625
|
+
/** Add the pending text as a tag when the field loses focus. Default `true`. */
|
|
626
|
+
addOnBlur?: boolean;
|
|
627
|
+
/** Called when a tag was rejected (duplicate, max, or failed validation). */
|
|
628
|
+
onReject?: (tag: string, reason: 'duplicate' | 'max' | 'invalid') => void;
|
|
629
|
+
id?: string;
|
|
630
|
+
name?: string;
|
|
631
|
+
className?: string;
|
|
632
|
+
}
|
|
633
|
+
/** Text field that turns typed values into removable tags (chips). */
|
|
634
|
+
declare const InputTags: react.ForwardRefExoticComponent<InputTagsProps & react.RefAttributes<HTMLInputElement>>;
|
|
635
|
+
|
|
636
|
+
interface SpinnerProps extends HTMLAttributes<HTMLSpanElement> {
|
|
637
|
+
/** Diameter in px or `sm` (16) / `md` (24) / `lg` (40). Default `md`. */
|
|
638
|
+
size?: 'sm' | 'md' | 'lg' | number;
|
|
639
|
+
color?: ColorRole;
|
|
640
|
+
/** Accessible label. Default "Loading". */
|
|
641
|
+
label?: string;
|
|
642
|
+
}
|
|
643
|
+
/** Circular indeterminate spinner. */
|
|
644
|
+
declare const Spinner: react.ForwardRefExoticComponent<SpinnerProps & react.RefAttributes<HTMLSpanElement>>;
|
|
645
|
+
interface LoaderProps extends HTMLAttributes<HTMLDivElement> {
|
|
646
|
+
/** Animation style. Default `spinner`. */
|
|
647
|
+
variant?: 'spinner' | 'dots' | 'bars' | 'pulse';
|
|
648
|
+
size?: 'sm' | 'md' | 'lg';
|
|
649
|
+
color?: ColorRole;
|
|
650
|
+
/** Text shown next to the loader (also used as the accessible label). */
|
|
651
|
+
label?: string;
|
|
652
|
+
}
|
|
653
|
+
/** Loading indicators in several styles. */
|
|
654
|
+
declare const Loader: react.ForwardRefExoticComponent<LoaderProps & react.RefAttributes<HTMLDivElement>>;
|
|
655
|
+
|
|
656
|
+
interface NavbarLink {
|
|
657
|
+
label: ReactNode;
|
|
658
|
+
href?: string;
|
|
659
|
+
/** Highlights the link as the current page. */
|
|
660
|
+
active?: boolean;
|
|
661
|
+
icon?: ReactNode;
|
|
662
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
663
|
+
disabled?: boolean;
|
|
664
|
+
}
|
|
665
|
+
interface NavbarProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
|
|
666
|
+
/** Logo or product name shown on the left. */
|
|
667
|
+
brand?: ReactNode;
|
|
668
|
+
/** Optional page title in the centre-left area (used instead of links on small screens). */
|
|
669
|
+
title?: ReactNode;
|
|
670
|
+
/** Primary links; shown inline from the `md` breakpoint up. */
|
|
671
|
+
links?: NavbarLink[];
|
|
672
|
+
/** Elements on the right: icon buttons, avatar, search… */
|
|
673
|
+
actions?: ReactNode;
|
|
674
|
+
/** Shows a menu button on small screens. Typically opens a `Sidebar` drawer. */
|
|
675
|
+
onMenuClick?: () => void;
|
|
676
|
+
/** CSS position. Default `static`. */
|
|
677
|
+
position?: 'static' | 'sticky' | 'fixed';
|
|
678
|
+
/** Surface treatment. Default `surface`. */
|
|
679
|
+
variant?: 'surface' | 'primary' | 'transparent';
|
|
680
|
+
/** Raise the bar with a shadow once the page is scrolled. */
|
|
681
|
+
elevateOnScroll?: boolean;
|
|
682
|
+
/** Always draw a bottom border. */
|
|
683
|
+
bordered?: boolean;
|
|
684
|
+
}
|
|
685
|
+
/** Top app bar with brand, navigation links and actions. */
|
|
686
|
+
declare const Navbar: react.ForwardRefExoticComponent<NavbarProps & react.RefAttributes<HTMLElement>>;
|
|
687
|
+
|
|
688
|
+
type PaginationItem = number | 'prev' | 'next' | 'first' | 'last' | 'start-ellipsis' | 'end-ellipsis';
|
|
689
|
+
/** Headless logic: the list of items (pages, ellipses, prev/next) for a pager. */
|
|
690
|
+
declare function usePagination({ count, page, siblingCount, boundaryCount, showFirstLast }: {
|
|
691
|
+
count: number;
|
|
692
|
+
page: number;
|
|
693
|
+
siblingCount?: number;
|
|
694
|
+
boundaryCount?: number;
|
|
695
|
+
showFirstLast?: boolean;
|
|
696
|
+
}): PaginationItem[];
|
|
697
|
+
interface PaginationProps extends Omit<HTMLAttributes<HTMLElement>, 'onChange' | 'defaultValue'> {
|
|
698
|
+
/** Total number of pages. */
|
|
699
|
+
count: number;
|
|
700
|
+
/** Current page, 1-based (controlled). */
|
|
701
|
+
page?: number;
|
|
702
|
+
defaultPage?: number;
|
|
703
|
+
onChange?: (page: number) => void;
|
|
704
|
+
/** Pages shown on each side of the current page. Default `1`. */
|
|
705
|
+
siblingCount?: number;
|
|
706
|
+
/** Pages always shown at the start and end. Default `1`. */
|
|
707
|
+
boundaryCount?: number;
|
|
708
|
+
/** Show "first" and "last" buttons. */
|
|
709
|
+
showFirstLast?: boolean;
|
|
710
|
+
variant?: 'text' | 'outlined' | 'tonal';
|
|
711
|
+
size?: 'sm' | 'md' | 'lg';
|
|
712
|
+
shape?: 'round' | 'square';
|
|
713
|
+
disabled?: boolean;
|
|
714
|
+
}
|
|
715
|
+
/** Page navigation with ellipsis collapsing. */
|
|
716
|
+
declare const Pagination: react.ForwardRefExoticComponent<PaginationProps & react.RefAttributes<HTMLElement>>;
|
|
717
|
+
|
|
718
|
+
interface PanelProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'onToggle'> {
|
|
719
|
+
/** Header title. */
|
|
720
|
+
title?: ReactNode;
|
|
721
|
+
subtitle?: ReactNode;
|
|
722
|
+
/** Icon before the title. */
|
|
723
|
+
icon?: ReactNode;
|
|
724
|
+
/** Elements on the right side of the header (buttons, badges…). */
|
|
725
|
+
headerActions?: ReactNode;
|
|
726
|
+
/** Footer content, e.g. action buttons. */
|
|
727
|
+
footer?: ReactNode;
|
|
728
|
+
/** Allow the user to collapse the body by clicking the header. */
|
|
729
|
+
toggleable?: boolean;
|
|
730
|
+
/** Collapsed state (controlled). */
|
|
731
|
+
collapsed?: boolean;
|
|
732
|
+
defaultCollapsed?: boolean;
|
|
733
|
+
onToggle?: (collapsed: boolean) => void;
|
|
734
|
+
variant?: 'outlined' | 'filled' | 'elevated';
|
|
735
|
+
}
|
|
736
|
+
/** Grouped content area with a header, optional collapsing and a footer. */
|
|
737
|
+
declare const Panel: react.ForwardRefExoticComponent<PanelProps & react.RefAttributes<HTMLDivElement>>;
|
|
738
|
+
|
|
739
|
+
interface PopoverProps extends Omit<HTMLAttributes<HTMLDivElement>, 'content' | 'onChange'> {
|
|
740
|
+
/** Content shown in the popover. */
|
|
741
|
+
content: ReactNode;
|
|
742
|
+
/** Open state (controlled). */
|
|
743
|
+
open?: boolean;
|
|
744
|
+
defaultOpen?: boolean;
|
|
745
|
+
onOpenChange?: (open: boolean) => void;
|
|
746
|
+
placement?: Placement;
|
|
747
|
+
/** Distance from the trigger in px. Default `8`. */
|
|
748
|
+
offset?: number;
|
|
749
|
+
/** `click` toggles on press, `hover` opens on pointer hover. Default `click`. */
|
|
750
|
+
trigger?: 'click' | 'hover';
|
|
751
|
+
/** Close when clicking outside. Default `true`. */
|
|
752
|
+
closeOnOutsideClick?: boolean;
|
|
753
|
+
/** Close with Escape. Default `true`. */
|
|
754
|
+
closeOnEsc?: boolean;
|
|
755
|
+
/** The element that opens the popover. */
|
|
756
|
+
children: ReactNode;
|
|
757
|
+
/** Class for the anchor wrapper. */
|
|
758
|
+
anchorClassName?: string;
|
|
759
|
+
}
|
|
760
|
+
/** Floating panel anchored to a trigger. Can hold any content, including forms and menus. */
|
|
761
|
+
declare const Popover: react.ForwardRefExoticComponent<PopoverProps & react.RefAttributes<HTMLDivElement>>;
|
|
762
|
+
|
|
763
|
+
interface ProgressBarProps extends HTMLAttributes<HTMLDivElement> {
|
|
764
|
+
/** Progress 0–100. Omit (or set `indeterminate`) for an unknown duration. */
|
|
765
|
+
value?: number;
|
|
766
|
+
/** Secondary "buffer" value 0–100 shown behind the bar. */
|
|
767
|
+
buffer?: number;
|
|
768
|
+
indeterminate?: boolean;
|
|
769
|
+
color?: ColorRole;
|
|
770
|
+
/** Thickness: `sm` 4px, `md` 8px, `lg` 12px. Default `sm`. */
|
|
771
|
+
size?: 'sm' | 'md' | 'lg';
|
|
772
|
+
/** Show the percentage to the right of the bar. */
|
|
773
|
+
showValue?: boolean;
|
|
774
|
+
/** Accessible label. */
|
|
775
|
+
label?: string;
|
|
776
|
+
}
|
|
777
|
+
/** Linear progress indicator (determinate, buffer or indeterminate). */
|
|
778
|
+
declare const ProgressBar: react.ForwardRefExoticComponent<ProgressBarProps & react.RefAttributes<HTMLDivElement>>;
|
|
779
|
+
interface ProgressCircleProps extends HTMLAttributes<HTMLDivElement> {
|
|
780
|
+
value?: number;
|
|
781
|
+
indeterminate?: boolean;
|
|
782
|
+
color?: ColorRole;
|
|
783
|
+
/** Diameter in px. Default `48`. */
|
|
784
|
+
size?: number;
|
|
785
|
+
/** Stroke width in px. Default `4`. */
|
|
786
|
+
thickness?: number;
|
|
787
|
+
/** Show the percentage in the centre. */
|
|
788
|
+
showValue?: boolean;
|
|
789
|
+
label?: string;
|
|
790
|
+
}
|
|
791
|
+
/** Circular progress indicator. */
|
|
792
|
+
declare const ProgressCircle: react.ForwardRefExoticComponent<ProgressCircleProps & react.RefAttributes<HTMLDivElement>>;
|
|
793
|
+
|
|
794
|
+
interface RadioGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {
|
|
795
|
+
/** Selected value (controlled). */
|
|
796
|
+
value?: string;
|
|
797
|
+
defaultValue?: string;
|
|
798
|
+
onChange?: (value: string) => void;
|
|
799
|
+
/** Shared `name` of the inputs. Generated when omitted. */
|
|
800
|
+
name?: string;
|
|
801
|
+
/** Group label shown above the options. */
|
|
802
|
+
label?: ReactNode;
|
|
803
|
+
orientation?: 'vertical' | 'horizontal';
|
|
804
|
+
disabled?: boolean;
|
|
805
|
+
color?: ColorRole;
|
|
806
|
+
}
|
|
807
|
+
/** Groups Radio buttons and manages the selected value. */
|
|
808
|
+
declare const RadioGroup: react.ForwardRefExoticComponent<RadioGroupProps & react.RefAttributes<HTMLDivElement>>;
|
|
809
|
+
interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'value'> {
|
|
810
|
+
/** Value reported to the RadioGroup. */
|
|
811
|
+
value: string;
|
|
812
|
+
label?: ReactNode;
|
|
813
|
+
description?: ReactNode;
|
|
814
|
+
color?: ColorRole;
|
|
815
|
+
}
|
|
816
|
+
/** Single choice from a set. Use inside `RadioGroup`. */
|
|
817
|
+
declare const Radio: react.ForwardRefExoticComponent<RadioProps & react.RefAttributes<HTMLInputElement>>;
|
|
818
|
+
|
|
819
|
+
interface SidebarItem {
|
|
820
|
+
/** Unique id, reported through `onSelect`. */
|
|
821
|
+
id: string;
|
|
822
|
+
label?: ReactNode;
|
|
823
|
+
icon?: ReactNode;
|
|
824
|
+
/** Renders a link. */
|
|
825
|
+
href?: string;
|
|
826
|
+
/** Count shown at the end (or as a dot on the icon when collapsed). */
|
|
827
|
+
badge?: number | string;
|
|
828
|
+
disabled?: boolean;
|
|
829
|
+
/** Nested items (one or more levels). */
|
|
830
|
+
children?: SidebarItem[];
|
|
831
|
+
/** Renders a section heading instead of an item. */
|
|
832
|
+
heading?: boolean;
|
|
833
|
+
/** Renders a divider instead of an item. */
|
|
834
|
+
divider?: boolean;
|
|
835
|
+
}
|
|
836
|
+
interface SidebarProps extends Omit<HTMLAttributes<HTMLElement>, 'onSelect'> {
|
|
837
|
+
items: SidebarItem[];
|
|
838
|
+
/** Id of the active item. */
|
|
839
|
+
activeId?: string;
|
|
840
|
+
onSelect?: (id: string, item: SidebarItem, event: MouseEvent<HTMLElement>) => void;
|
|
841
|
+
/** Collapsed to icons only (controlled). */
|
|
842
|
+
collapsed?: boolean;
|
|
843
|
+
defaultCollapsed?: boolean;
|
|
844
|
+
onCollapsedChange?: (collapsed: boolean) => void;
|
|
845
|
+
/** Show a built-in collapse toggle in the header. */
|
|
846
|
+
collapsible?: boolean;
|
|
847
|
+
/** Top area, e.g. a logo. */
|
|
848
|
+
header?: ReactNode;
|
|
849
|
+
/** Bottom area, e.g. a user card. */
|
|
850
|
+
footer?: ReactNode;
|
|
851
|
+
/** `permanent` is part of the layout; `temporary` is an overlay drawer. Default `permanent`. */
|
|
852
|
+
variant?: 'permanent' | 'temporary';
|
|
853
|
+
/** Temporary variant: whether the drawer is open. */
|
|
854
|
+
open?: boolean;
|
|
855
|
+
/** Temporary variant: called on scrim click or Escape. */
|
|
856
|
+
onClose?: () => void;
|
|
857
|
+
/** Width in px when expanded. Default `280`. */
|
|
858
|
+
width?: number;
|
|
859
|
+
/** Compact items (40px instead of 56px), useful for long navigation lists. */
|
|
860
|
+
dense?: boolean;
|
|
861
|
+
/** Accessible name for the navigation landmark. Default "Main navigation". */
|
|
862
|
+
'aria-label'?: string;
|
|
863
|
+
}
|
|
864
|
+
/** Vertical navigation: permanent, collapsible to icons, or a modal drawer. Supports nested items. */
|
|
865
|
+
declare const Sidebar: react.ForwardRefExoticComponent<SidebarProps & react.RefAttributes<HTMLElement>>;
|
|
866
|
+
|
|
867
|
+
interface SkeletonProps extends HTMLAttributes<HTMLDivElement> {
|
|
868
|
+
/** Shape of the placeholder. Default `text`. */
|
|
869
|
+
variant?: 'text' | 'rect' | 'rounded' | 'circle';
|
|
870
|
+
width?: number | string;
|
|
871
|
+
height?: number | string;
|
|
872
|
+
/** Animation style, or `false` for none. Default `pulse`. */
|
|
873
|
+
animation?: 'pulse' | 'wave' | false;
|
|
874
|
+
/** For `text`: number of lines. The last line is shorter. */
|
|
875
|
+
lines?: number;
|
|
876
|
+
}
|
|
877
|
+
/** Placeholder shown while content loads. */
|
|
878
|
+
declare const Skeleton: react.ForwardRefExoticComponent<SkeletonProps & react.RefAttributes<HTMLDivElement>>;
|
|
879
|
+
|
|
880
|
+
interface StepConfig {
|
|
881
|
+
label: ReactNode;
|
|
882
|
+
/** Text under the label. */
|
|
883
|
+
description?: ReactNode;
|
|
884
|
+
/** Shows "Optional" under the label. */
|
|
885
|
+
optional?: boolean;
|
|
886
|
+
/** Marks the step as failed. */
|
|
887
|
+
error?: boolean;
|
|
888
|
+
/** Force the completed state. By default every step before `activeStep` is completed. */
|
|
889
|
+
completed?: boolean;
|
|
890
|
+
/** Custom indicator content instead of the number. */
|
|
891
|
+
icon?: ReactNode;
|
|
892
|
+
/** Vertical orientation only: content revealed below the active step. */
|
|
893
|
+
content?: ReactNode;
|
|
894
|
+
disabled?: boolean;
|
|
895
|
+
}
|
|
896
|
+
interface StepperProps extends HTMLAttributes<HTMLOListElement> {
|
|
897
|
+
steps: StepConfig[];
|
|
898
|
+
/** Zero-based index of the current step. */
|
|
899
|
+
activeStep: number;
|
|
900
|
+
orientation?: 'horizontal' | 'vertical';
|
|
901
|
+
/** Makes steps clickable. */
|
|
902
|
+
onStepClick?: (index: number) => void;
|
|
903
|
+
/** In linear mode only completed steps and the active step are clickable. Default `true`. */
|
|
904
|
+
linear?: boolean;
|
|
905
|
+
/** Put labels under the indicators (horizontal only). */
|
|
906
|
+
alternativeLabel?: boolean;
|
|
907
|
+
}
|
|
908
|
+
/** Shows progress through a sequence of steps. */
|
|
909
|
+
declare const Stepper: react.ForwardRefExoticComponent<StepperProps & react.RefAttributes<HTMLOListElement>>;
|
|
910
|
+
|
|
911
|
+
interface TabsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {
|
|
912
|
+
/** Selected tab value (controlled). */
|
|
913
|
+
value?: string;
|
|
914
|
+
defaultValue?: string;
|
|
915
|
+
onChange?: (value: string) => void;
|
|
916
|
+
/** `primary` has icons above/with labels and a short indicator; `secondary` has a full-width underline. */
|
|
917
|
+
variant?: 'primary' | 'secondary';
|
|
918
|
+
/** Tabs share the available width equally. */
|
|
919
|
+
fullWidth?: boolean;
|
|
920
|
+
}
|
|
921
|
+
/** Organises content into tabbed views. Compose with `TabList`, `Tab` and `TabPanel`. */
|
|
922
|
+
declare const Tabs: react.ForwardRefExoticComponent<TabsProps & react.RefAttributes<HTMLDivElement>>;
|
|
923
|
+
declare const TabList: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & react.RefAttributes<HTMLDivElement>>;
|
|
924
|
+
interface TabProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value'> {
|
|
925
|
+
/** Value that links the tab to its `TabPanel`. */
|
|
926
|
+
value: string;
|
|
927
|
+
/** Icon shown with the label. */
|
|
928
|
+
icon?: ReactNode;
|
|
929
|
+
/** Badge count / dot next to the label. */
|
|
930
|
+
badge?: number | boolean;
|
|
931
|
+
}
|
|
932
|
+
declare const Tab: react.ForwardRefExoticComponent<TabProps & react.RefAttributes<HTMLButtonElement>>;
|
|
933
|
+
interface TabPanelProps extends HTMLAttributes<HTMLDivElement> {
|
|
934
|
+
value: string;
|
|
935
|
+
/** Keep the panel in the DOM (hidden) when inactive. Default `false`. */
|
|
936
|
+
keepMounted?: boolean;
|
|
937
|
+
}
|
|
938
|
+
declare const TabPanel: react.ForwardRefExoticComponent<TabPanelProps & react.RefAttributes<HTMLDivElement>>;
|
|
939
|
+
|
|
940
|
+
interface TextareaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'>, FieldChromeProps {
|
|
941
|
+
/** Grow with the content up to `maxRows`. */
|
|
942
|
+
autoResize?: boolean;
|
|
943
|
+
/** Minimum visible rows. Default `3`. */
|
|
944
|
+
minRows?: number;
|
|
945
|
+
/** Maximum rows when `autoResize` is on. */
|
|
946
|
+
maxRows?: number;
|
|
947
|
+
/** Show a "length / maxLength" counter (needs `maxLength`). */
|
|
948
|
+
showCounter?: boolean;
|
|
949
|
+
}
|
|
950
|
+
/** Multi-line text field with optional auto-resize and character counter. */
|
|
951
|
+
declare const Textarea: react.ForwardRefExoticComponent<TextareaProps & react.RefAttributes<HTMLTextAreaElement>>;
|
|
952
|
+
|
|
953
|
+
type ToastPlacement = 'top-start' | 'top-center' | 'top-end' | 'bottom-start' | 'bottom-center' | 'bottom-end';
|
|
954
|
+
interface ToastOptions {
|
|
955
|
+
/** Main message. */
|
|
956
|
+
message: ReactNode;
|
|
957
|
+
/** Optional bold heading. */
|
|
958
|
+
title?: ReactNode;
|
|
959
|
+
/** Colours the icon accent. Default `neutral`. */
|
|
960
|
+
severity?: 'neutral' | Severity;
|
|
961
|
+
/** Auto-dismiss delay in ms. `0` keeps it until closed. Default from the provider (5000). */
|
|
962
|
+
duration?: number;
|
|
963
|
+
/** Action button on the toast. */
|
|
964
|
+
action?: {
|
|
965
|
+
label: string;
|
|
966
|
+
onClick?: () => void;
|
|
967
|
+
};
|
|
968
|
+
/** Show a close button. Default `true`. */
|
|
969
|
+
closable?: boolean;
|
|
970
|
+
/** Custom icon or `false`. */
|
|
971
|
+
icon?: ReactNode | false;
|
|
972
|
+
/** Provide an id to update or de-duplicate a toast. */
|
|
973
|
+
id?: string;
|
|
974
|
+
onClose?: () => void;
|
|
975
|
+
}
|
|
976
|
+
interface ToastApi {
|
|
977
|
+
/** Show a toast. Returns its id. */
|
|
978
|
+
show: (options: ToastOptions) => string;
|
|
979
|
+
info: (message: ReactNode, options?: Omit<ToastOptions, 'message' | 'severity'>) => string;
|
|
980
|
+
success: (message: ReactNode, options?: Omit<ToastOptions, 'message' | 'severity'>) => string;
|
|
981
|
+
warning: (message: ReactNode, options?: Omit<ToastOptions, 'message' | 'severity'>) => string;
|
|
982
|
+
error: (message: ReactNode, options?: Omit<ToastOptions, 'message' | 'severity'>) => string;
|
|
983
|
+
dismiss: (id: string) => void;
|
|
984
|
+
dismissAll: () => void;
|
|
985
|
+
}
|
|
986
|
+
/** Access the toast API. Must be used below `ToastProvider`. */
|
|
987
|
+
declare function useToast(): ToastApi;
|
|
988
|
+
interface ToastProviderProps {
|
|
989
|
+
children?: ReactNode;
|
|
990
|
+
/** Where toasts appear. Default `bottom-center`. */
|
|
991
|
+
placement?: ToastPlacement;
|
|
992
|
+
/** Default auto-dismiss time in ms. Default `5000`. */
|
|
993
|
+
duration?: number;
|
|
994
|
+
/** Maximum toasts visible at once. Older ones are dismissed. Default `4`. */
|
|
995
|
+
max?: number;
|
|
996
|
+
}
|
|
997
|
+
/** Provides `useToast()` and renders the toast stack. Place it once near the root, inside `ThemeProvider`. */
|
|
998
|
+
declare function ToastProvider({ children, placement, duration, max }: ToastProviderProps): react.JSX.Element;
|
|
999
|
+
|
|
1000
|
+
interface TooltipProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'content' | 'title'> {
|
|
1001
|
+
/** Tooltip text or element. */
|
|
1002
|
+
content: ReactNode;
|
|
1003
|
+
/** Heading for the `rich` variant. */
|
|
1004
|
+
title?: ReactNode;
|
|
1005
|
+
/** `rich` tooltips can hold a title and actions. Default `plain`. */
|
|
1006
|
+
variant?: 'plain' | 'rich';
|
|
1007
|
+
/** Buttons / links for the `rich` variant. */
|
|
1008
|
+
actions?: ReactNode;
|
|
1009
|
+
placement?: Placement;
|
|
1010
|
+
/** Delay before showing, in ms. Default `300`. */
|
|
1011
|
+
delay?: number;
|
|
1012
|
+
disabled?: boolean;
|
|
1013
|
+
/** The element that triggers the tooltip. */
|
|
1014
|
+
children: ReactNode;
|
|
1015
|
+
}
|
|
1016
|
+
/** Short hint shown on hover or keyboard focus. */
|
|
1017
|
+
declare const Tooltip: react.ForwardRefExoticComponent<TooltipProps & react.RefAttributes<HTMLSpanElement>>;
|
|
1018
|
+
|
|
1019
|
+
export { Accordion, AccordionItem, Alert, Avatar, AvatarGroup, Badge, Breadcrumb, Breakpoint, BuiltInThemeName, Button, Calendar, Card, CardActions, CardContent, CardHeader, CardMedia, Checkbox, Chip, Col, Collapse, Container, ContextMenu, Dialog, Divider, FileUpload, Grid, Icon, Input, InputTags, Loader, Modal, Navbar, Pagination, Panel, Popover, ProgressBar, ProgressCircle, Radio, RadioGroup, Sidebar, Skeleton, Spinner, Stack, Stepper, Tab, TabList, TabPanel, Tabs, Textarea, Theme, ThemeProvider, ToastProvider, Tooltip, formatBytes, iconPaths, useBreakpoint, useBreakpointUp, useControllableState, useFloating, useMediaQuery, usePagination, usePresence, useTheme, useToast };
|
|
1020
|
+
export type { AccordionItemProps, AccordionProps, AlertProps, AvatarGroupProps, AvatarProps, BadgeProps, BreadcrumbItem, BreadcrumbProps, ButtonProps, CalendarProps, CardHeaderProps, CardMediaProps, CardProps, CheckboxProps, ChipProps, ColProps, CollapseProps, ContainerProps, ContextMenuItem, ContextMenuProps, DateRange, DialogProps, DividerProps, FieldChromeProps, FileRejection, FileUploadProps, GridProps, IconName, IconProps, InputProps, InputTagsProps, LoaderProps, ModalProps, NavbarLink, NavbarProps, PaginationItem, PaginationProps, PanelProps, Placement, PopoverProps, ProgressBarProps, ProgressCircleProps, RadioGroupProps, RadioProps, RangeCalendarProps, SidebarItem, SidebarProps, SingleCalendarProps, SkeletonProps, SpinnerProps, StackProps, StepConfig, StepperProps, TabPanelProps, TabProps, TabsProps, TextareaProps, ThemeContextValue, ThemeProviderProps, ToastApi, ToastOptions, ToastPlacement, ToastProviderProps, TooltipProps };
|