@bug-on/m3-expressive 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/CHANGELOG.md +110 -0
- package/README.md +110 -0
- package/dist/assets/fonts/GoogleSansFlex-VariableFont.woff2 +0 -0
- package/dist/assets/fonts/MaterialSymbolsOutlined-VariableFont_FILL,GRAD,opsz,wght.ttf +0 -0
- package/dist/assets/fonts/MaterialSymbolsRounded-VariableFont_FILL,GRAD,opsz,wght.ttf +0 -0
- package/dist/assets/fonts/MaterialSymbolsSharp-VariableFont_FILL,GRAD,opsz,wght.ttf +0 -0
- package/dist/assets/loading-indicator.svg +19 -0
- package/dist/assets/material-symbols-cdn.css +65 -0
- package/dist/assets/material-symbols-self-hosted.css +94 -0
- package/dist/buttons.d.mts +180 -0
- package/dist/buttons.d.ts +180 -0
- package/dist/buttons.js +4282 -0
- package/dist/buttons.js.map +1 -0
- package/dist/buttons.mjs +4227 -0
- package/dist/buttons.mjs.map +1 -0
- package/dist/core.d.mts +422 -0
- package/dist/core.d.ts +422 -0
- package/dist/core.js +2581 -0
- package/dist/core.js.map +1 -0
- package/dist/core.mjs +2547 -0
- package/dist/core.mjs.map +1 -0
- package/dist/feedback.d.mts +600 -0
- package/dist/feedback.d.ts +600 -0
- package/dist/feedback.js +2357 -0
- package/dist/feedback.js.map +1 -0
- package/dist/feedback.mjs +2321 -0
- package/dist/feedback.mjs.map +1 -0
- package/dist/forms.d.mts +40 -0
- package/dist/forms.d.ts +40 -0
- package/dist/forms.js +4263 -0
- package/dist/forms.js.map +1 -0
- package/dist/forms.mjs +4228 -0
- package/dist/forms.mjs.map +1 -0
- package/dist/icon-button-D-gs0gfj.d.mts +136 -0
- package/dist/icon-button-D-gs0gfj.d.ts +136 -0
- package/dist/index.css +309 -0
- package/dist/index.css.d.ts +2 -0
- package/dist/index.d.mts +24 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +23972 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +23668 -0
- package/dist/index.mjs.map +1 -0
- package/dist/layout.d.mts +610 -0
- package/dist/layout.d.ts +610 -0
- package/dist/layout.js +5091 -0
- package/dist/layout.js.map +1 -0
- package/dist/layout.mjs +5042 -0
- package/dist/layout.mjs.map +1 -0
- package/dist/material-symbols-cdn.css +65 -0
- package/dist/material-symbols-cdn.css.d.ts +2 -0
- package/dist/material-symbols-self-hosted.css +94 -0
- package/dist/material-symbols-self-hosted.css.d.ts +2 -0
- package/dist/md3-DFhj-NZj.d.mts +17 -0
- package/dist/md3-DFhj-NZj.d.ts +17 -0
- package/dist/navigation.d.mts +2766 -0
- package/dist/navigation.d.ts +2766 -0
- package/dist/navigation.js +6684 -0
- package/dist/navigation.js.map +1 -0
- package/dist/navigation.mjs +6573 -0
- package/dist/navigation.mjs.map +1 -0
- package/dist/overlays.d.mts +161 -0
- package/dist/overlays.d.ts +161 -0
- package/dist/overlays.js +3298 -0
- package/dist/overlays.js.map +1 -0
- package/dist/overlays.mjs +3244 -0
- package/dist/overlays.mjs.map +1 -0
- package/dist/pickers.d.mts +1074 -0
- package/dist/pickers.d.ts +1074 -0
- package/dist/pickers.js +4240 -0
- package/dist/pickers.js.map +1 -0
- package/dist/pickers.mjs +4200 -0
- package/dist/pickers.mjs.map +1 -0
- package/dist/plugin.d.mts +1 -0
- package/dist/plugin.d.ts +1 -0
- package/dist/plugin.js +13 -0
- package/dist/plugin.js.map +1 -0
- package/dist/plugin.mjs +3 -0
- package/dist/plugin.mjs.map +1 -0
- package/dist/scroll-area-CVS6HyLl.d.mts +33 -0
- package/dist/scroll-area-CVS6HyLl.d.ts +33 -0
- package/dist/shapes.d.mts +1119 -0
- package/dist/shapes.d.ts +1119 -0
- package/dist/shapes.js +2941 -0
- package/dist/shapes.js.map +1 -0
- package/dist/shapes.mjs +2889 -0
- package/dist/shapes.mjs.map +1 -0
- package/dist/side-sheet-modal-BY6VCC8p.d.mts +553 -0
- package/dist/side-sheet-modal-CglP6KYA.d.ts +553 -0
- package/dist/split-button-trailing-uncheckable-C5CLCIKP.d.ts +731 -0
- package/dist/split-button-trailing-uncheckable-MXj_kyNt.d.mts +731 -0
- package/dist/text-field-eAIpz9z1.d.mts +1038 -0
- package/dist/text-field-eAIpz9z1.d.ts +1038 -0
- package/dist/typography-339RV6v7.d.mts +486 -0
- package/dist/typography-339RV6v7.d.ts +486 -0
- package/dist/typography.css +22 -0
- package/dist/typography.css.d.ts +2 -0
- package/package.json +207 -0
|
@@ -0,0 +1,600 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React$1 from 'react';
|
|
3
|
+
|
|
4
|
+
type SafeHTMLSpanAttrs = Omit<React$1.HTMLAttributes<HTMLSpanElement>, "onDrag" | "onDragStart" | "onDragEnd" | "onDragEnter" | "onDragLeave" | "onDragOver" | "onDrop">;
|
|
5
|
+
interface BadgeProps extends SafeHTMLSpanAttrs {
|
|
6
|
+
/**
|
|
7
|
+
* The content to display inside the badge.
|
|
8
|
+
* - Omitted / undefined → renders as a small 6×6px dot (decorative).
|
|
9
|
+
* - string | number → renders as a large badge (min 16px height) with label.
|
|
10
|
+
*
|
|
11
|
+
* Numbers exceeding `max` are displayed as `{max}+`.
|
|
12
|
+
* Strings longer than 4 characters are truncated to 4.
|
|
13
|
+
*/
|
|
14
|
+
children?: React$1.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Maximum numeric value to display before appending "+".
|
|
17
|
+
* Only applies when `children` is a number.
|
|
18
|
+
* @example max={99} + children={150} → "99+"
|
|
19
|
+
*/
|
|
20
|
+
max?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Override the background (container) color.
|
|
23
|
+
* Accepts any valid CSS color value.
|
|
24
|
+
* Defaults to MD3 `error` token — `bg-m3-error`.
|
|
25
|
+
*/
|
|
26
|
+
containerColor?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Override the text/content color.
|
|
29
|
+
* Accepts any valid CSS color value.
|
|
30
|
+
* Defaults to MD3 `on-error` token — `text-m3-on-error`.
|
|
31
|
+
*/
|
|
32
|
+
contentColor?: string;
|
|
33
|
+
}
|
|
34
|
+
interface BadgedBoxProps {
|
|
35
|
+
/**
|
|
36
|
+
* The badge element to overlay on the anchor.
|
|
37
|
+
* Typically a `<Badge />`.
|
|
38
|
+
*/
|
|
39
|
+
badge: React$1.ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* The anchor content that the badge is attached to.
|
|
42
|
+
*/
|
|
43
|
+
children: React$1.ReactNode;
|
|
44
|
+
/**
|
|
45
|
+
* Additional className applied to the outer wrapper `span`.
|
|
46
|
+
*/
|
|
47
|
+
className?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Explicitly override size detection for badge positioning.
|
|
50
|
+
* - `'small'` → BadgeOffset = 6dp → translate(50%, -50%)
|
|
51
|
+
* - `'large'` → HOffset=12dp/VOffset=14dp → translate(35%, -35%)
|
|
52
|
+
* When omitted, BadgedBox auto-detects by inspecting `badge` children prop.
|
|
53
|
+
*/
|
|
54
|
+
badgeSize?: "small" | "large";
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* MD3 Expressive Badge — dynamic status indicator.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```tsx
|
|
61
|
+
* // Small dot badge (no content) — decorative
|
|
62
|
+
* <Badge />
|
|
63
|
+
*
|
|
64
|
+
* // Large badge with number (truncated at max)
|
|
65
|
+
* <Badge max={99}>150</Badge>
|
|
66
|
+
* // → displays "99+"
|
|
67
|
+
*
|
|
68
|
+
* // Large badge with text label
|
|
69
|
+
* <Badge>NEW</Badge>
|
|
70
|
+
*
|
|
71
|
+
* // Custom colors
|
|
72
|
+
* <Badge containerColor="#6750A4" contentColor="#FFFFFF">3</Badge>
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* @see https://m3.material.io/components/badge/overview
|
|
76
|
+
*/
|
|
77
|
+
declare const Badge: React$1.NamedExoticComponent<BadgeProps & React$1.RefAttributes<HTMLSpanElement>>;
|
|
78
|
+
/**
|
|
79
|
+
* MD3 BadgedBox — positions a Badge at the top-trailing corner of an anchor.
|
|
80
|
+
*
|
|
81
|
+
* Implements MD3 offset specs from Badge.kt:
|
|
82
|
+
* - Small badge (dot): `BadgeOffset = 6dp` → translate(50%, -50%)
|
|
83
|
+
* - Large badge (text): `BadgeWithContentHorizontalOffset = 12dp` / `VerticalOffset = 14dp`
|
|
84
|
+
* → translate(35%, -35%)
|
|
85
|
+
*
|
|
86
|
+
* Auto-detects badge size by inspecting the badge element's children prop,
|
|
87
|
+
* or accepts an explicit `badgeSize` override.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```tsx
|
|
91
|
+
* // Small dot on mail icon
|
|
92
|
+
* <BadgedBox badge={<Badge />}>
|
|
93
|
+
* <Icon name="mail" />
|
|
94
|
+
* </BadgedBox>
|
|
95
|
+
*
|
|
96
|
+
* // Count badge on notification icon
|
|
97
|
+
* <BadgedBox badge={<Badge max={99}>{count}</Badge>}>
|
|
98
|
+
* <Icon name="notifications" />
|
|
99
|
+
* </BadgedBox>
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
declare function BadgedBox({ badge, children, className, badgeSize, }: BadgedBoxProps): react_jsx_runtime.JSX.Element;
|
|
103
|
+
|
|
104
|
+
interface LoadingIndicatorProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
105
|
+
/**
|
|
106
|
+
* Visual style variant.
|
|
107
|
+
* - `uncontained` (default): bare indicator, no container background
|
|
108
|
+
* - `contained`: indicator inside a circular container
|
|
109
|
+
* (MD3 spec: 38dp container / 24dp active indicator)
|
|
110
|
+
*/
|
|
111
|
+
variant?: "uncontained" | "contained";
|
|
112
|
+
/**
|
|
113
|
+
* Indicator size in dp (pixels). Clamped to the MD3 spec range [24dp, 240dp].
|
|
114
|
+
* Defaults to 48dp.
|
|
115
|
+
*
|
|
116
|
+
* Size guidelines:
|
|
117
|
+
* - Small displays: 24–48dp
|
|
118
|
+
* - Medium displays: 48–80dp
|
|
119
|
+
* - Large/XL displays (desktop): up to 240dp
|
|
120
|
+
*
|
|
121
|
+
* @default 48
|
|
122
|
+
*/
|
|
123
|
+
size?: number;
|
|
124
|
+
/**
|
|
125
|
+
* Determinate progress value between 0 and 1.
|
|
126
|
+
* - **Omit** (default) for indeterminate mode: continuous morphing loop.
|
|
127
|
+
* - **Provide** for determinate mode: Circle→SoftBurst morph + counterclockwise rotation.
|
|
128
|
+
*
|
|
129
|
+
* @example `progress={0.7}` shows 70% progress
|
|
130
|
+
*/
|
|
131
|
+
progress?: number;
|
|
132
|
+
/**
|
|
133
|
+
* Active indicator color override. Falls back to MD3 system color tokens.
|
|
134
|
+
* Supports any valid CSS color value or CSS variable.
|
|
135
|
+
* @example "#ff5722" | "var(--brand-color)"
|
|
136
|
+
*/
|
|
137
|
+
color?: string;
|
|
138
|
+
/**
|
|
139
|
+
* Required accessible label describing what is loading.
|
|
140
|
+
* @example "Loading news article"
|
|
141
|
+
*/
|
|
142
|
+
"aria-label": string;
|
|
143
|
+
}
|
|
144
|
+
declare const LoadingIndicator: React$1.ForwardRefExoticComponent<LoadingIndicatorProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
145
|
+
|
|
146
|
+
interface ProgressBaseProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
147
|
+
/**
|
|
148
|
+
* Giá trị phần trăm tiến trình hiện tại (từ 0 đến 100).
|
|
149
|
+
* Nếu truyền giá trị này, tiến trình sẽ hiển thị ở trạng thái Determinate.
|
|
150
|
+
* Nếu bỏ trống (undefined), tiến trình sẽ tự động ở trạng thái Indeterminate.
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```tsx
|
|
154
|
+
* <ProgressIndicator value={45} aria-label="Loading profile..." />
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
value?: number;
|
|
158
|
+
/**
|
|
159
|
+
* Nhan đề mô tả mục đích của thanh tiến trình dành cho screen readers (bắt buộc).
|
|
160
|
+
*/
|
|
161
|
+
"aria-label": string;
|
|
162
|
+
/**
|
|
163
|
+
* Độ dày của track (đường nền) của thanh tiến trình (đơn vị: px).
|
|
164
|
+
* - Với Linear: là chiều cao của thanh.
|
|
165
|
+
* - Với Circular: là độ dày của viền hình tròn.
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* trackHeight={8} // Dày hơn bình thường
|
|
169
|
+
*/
|
|
170
|
+
trackHeight?: number;
|
|
171
|
+
/**
|
|
172
|
+
* Màu sắc của phần tiến trình (phần đã hoàn thành).
|
|
173
|
+
* Mặc định mượn màu `currentColor` của thẻ wrap, để dễ dàng tuỳ biến qua utility class.
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* color="var(--md-sys-color-primary)" // Sử dụng custom token
|
|
177
|
+
*/
|
|
178
|
+
color?: string;
|
|
179
|
+
/**
|
|
180
|
+
* Màu sắc của thanh nền (phần chưa hoàn thành).
|
|
181
|
+
* Mặc định sử dụng màu được tính toán từ bề mặt hoặc transparency để tạo sự tinh tế.
|
|
182
|
+
*/
|
|
183
|
+
trackColor?: string;
|
|
184
|
+
}
|
|
185
|
+
interface LinearProgressProps extends ProgressBaseProps {
|
|
186
|
+
/** Phân loại component sang kiểu dáng Linear (đường thẳng ngang). */
|
|
187
|
+
variant: "linear";
|
|
188
|
+
/**
|
|
189
|
+
* Hình dáng của vạch tiến trình (phần đã hoàn thành).
|
|
190
|
+
* - `flat`: Đường nét liền phẳng (mặc định)
|
|
191
|
+
* - `wavy`: Đường lượn sóng động
|
|
192
|
+
*/
|
|
193
|
+
shape?: "flat" | "wavy";
|
|
194
|
+
/**
|
|
195
|
+
* Hình dáng của thanh nền chờ (track).
|
|
196
|
+
* - `flat`: Đường nét liền phẳng (mặc định)
|
|
197
|
+
* - `wavy`: Đường lượn sóng cố định hoặc động
|
|
198
|
+
*/
|
|
199
|
+
trackShape?: "flat" | "wavy";
|
|
200
|
+
/**
|
|
201
|
+
* Biên độ sóng (áp dụng khi `shape` hoặc `trackShape` là "wavy").
|
|
202
|
+
* Chỉ định độ lượn cao thấp của con sóng.
|
|
203
|
+
*/
|
|
204
|
+
amplitude?: number;
|
|
205
|
+
/**
|
|
206
|
+
* Chiều dài một nhịp sóng (áp dụng khi `shape` là "wavy" theo determinate).
|
|
207
|
+
* Khoảng cách giữa 2 đỉnh sóng kề nhau.
|
|
208
|
+
*/
|
|
209
|
+
wavelength?: number;
|
|
210
|
+
/**
|
|
211
|
+
* Nhịp sóng dành riêng cho trạng thái chạy liên tục (Indeterminate Wavy).
|
|
212
|
+
*/
|
|
213
|
+
indeterminateWavelength?: number;
|
|
214
|
+
/**
|
|
215
|
+
* Khoảng hở kết dính giữa cụm vạch đang chạy và thanh nền.
|
|
216
|
+
* Cho phép truyền \`0\` để hai thanh chạm sát vào nhau liền mạch.
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* ```tsx
|
|
220
|
+
* <ProgressIndicator variant="linear" shape="wavy" gapSize={0} /> // Sóng chạm track liền nét
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
gapSize?: number;
|
|
224
|
+
/**
|
|
225
|
+
* Tốc độ dao động vỗ của sóng (Multiplier). Mặc định là \`1\`.
|
|
226
|
+
* Tăng giá trị (VD: 1.5, 2) để sóng dao động nhanh hơn.
|
|
227
|
+
*/
|
|
228
|
+
waveSpeed?: number;
|
|
229
|
+
/**
|
|
230
|
+
* Tốc độ lướt / cuộn dải màu dọc trên track (Crawler) đối với trạng thái Indeterminate.
|
|
231
|
+
* Mặc định là \`1\`.
|
|
232
|
+
*/
|
|
233
|
+
crawlerSpeed?: number;
|
|
234
|
+
/**
|
|
235
|
+
* Cấu hình hiệu ứng gợn khi thanh determinate ở mức xấp xỉ mép viền (<= 10% hoặc >= 90%).
|
|
236
|
+
* - `md3`: Tự động ép phẳng biên độ sóng thành số 0 một cách mềm mại (Chuẩn Google MD3).
|
|
237
|
+
* - `continuous`: Bỏ qua các ràng buộc ép phẳng, con sóng vẫn gợn lấp lóa trên mọi giá trị phần trăm.
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* ```tsx
|
|
241
|
+
* <ProgressIndicator variant="linear" shape="wavy" determinateAnimation="continuous" />
|
|
242
|
+
* ```
|
|
243
|
+
*/
|
|
244
|
+
determinateAnimation?: "md3" | "continuous";
|
|
245
|
+
/**
|
|
246
|
+
* Kiểu kịch bản tịnh tiến cho thanh Indeterminate.
|
|
247
|
+
* - `md3`: Render 2 vạch song song vọt tới & co giãn mô phỏng vật lý (Chuẩn Google MD3).
|
|
248
|
+
* - `continuous`: Vạch không ngắt quãng mà tràn lướt vòng lặp mượt mà.
|
|
249
|
+
*
|
|
250
|
+
* @example
|
|
251
|
+
* ```tsx
|
|
252
|
+
* <ProgressIndicator variant="linear" indeterminateAnimation="continuous" />
|
|
253
|
+
* ```
|
|
254
|
+
*/
|
|
255
|
+
indeterminateAnimation?: "md3" | "continuous";
|
|
256
|
+
/**
|
|
257
|
+
* Bật/tắt dấm chấm điểm báo kết thúc ở cuối track (Stop Indicator).
|
|
258
|
+
* - `true`: Luôn thấy một chấm tròn bé xíu ở cuối đường đi
|
|
259
|
+
* - `false`: Tắt hoàn toàn
|
|
260
|
+
* - `"auto"`: Chấm tròn chỉ hiển thị và hòa trộn khi progress đạt 100%
|
|
261
|
+
*/
|
|
262
|
+
showStopIndicator?: boolean | "auto";
|
|
263
|
+
}
|
|
264
|
+
interface CircularProgressProps extends ProgressBaseProps {
|
|
265
|
+
/** Phân loại component sang kiểu dáng Circular (hình tròn khép kín). */
|
|
266
|
+
variant: "circular";
|
|
267
|
+
/**
|
|
268
|
+
* Đường kính hiển thị của vòng biểu đồ, đơn vị px.
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* ```tsx
|
|
272
|
+
* <ProgressIndicator variant="circular" size={48} aria-label="Loading..." />
|
|
273
|
+
* ```
|
|
274
|
+
*/
|
|
275
|
+
size?: number;
|
|
276
|
+
/**
|
|
277
|
+
* Phong cách nét vẽ của đường viền trong trạng thái trượt.
|
|
278
|
+
* - `flat`: Đường nét cứng, vuốt tròn hai đầu stroke.
|
|
279
|
+
* - `wavy`: Vệt màu chuyển động rung tạo hình răng cưa/gợn sóng.
|
|
280
|
+
*/
|
|
281
|
+
shape?: "flat" | "wavy";
|
|
282
|
+
/**
|
|
283
|
+
* Biên độ gợn của trạng thái `wavy` cho vòng tròn.
|
|
284
|
+
*/
|
|
285
|
+
amplitude?: number;
|
|
286
|
+
/** Bước sóng bao trọn chu vi hình tròn. */
|
|
287
|
+
wavelength?: number;
|
|
288
|
+
/** Khoảng hở khe đứt ngang nối đỉnh nét vẽ. */
|
|
289
|
+
gapSize?: number;
|
|
290
|
+
/**
|
|
291
|
+
* Xoay nhanh hay chậm theo số nhân cho Crawler Circular quay Indeterminate.
|
|
292
|
+
*/
|
|
293
|
+
crawlerSpeed?: number;
|
|
294
|
+
}
|
|
295
|
+
type ProgressIndicatorProps = LinearProgressProps | CircularProgressProps;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Thanh tiến trình (Progress Indicator) theo nguyên tắc Material Design 3 Expressive.
|
|
299
|
+
* Hỗ trợ linh hoạt 2 loại hình hiển thị: Linear (Đường thẳng) và Circular (Hình tròn),
|
|
300
|
+
* cùng với thiết kế Wavy (Lượn sóng) động rất mềm mại.
|
|
301
|
+
*
|
|
302
|
+
* @example
|
|
303
|
+
* ```tsx
|
|
304
|
+
* // Determinate Flat Linear
|
|
305
|
+
* <ProgressIndicator variant="linear" value={60} aria-label="Loading profile..." />
|
|
306
|
+
*
|
|
307
|
+
* // Indeterminate Wavy Linear
|
|
308
|
+
* <ProgressIndicator variant="linear" shape="wavy" aria-label="Connecting to server..." />
|
|
309
|
+
*
|
|
310
|
+
* // Determinate Flat Circular
|
|
311
|
+
* <ProgressIndicator variant="circular" value={45} size={48} aria-label="Syncing..." />
|
|
312
|
+
* ```
|
|
313
|
+
*/
|
|
314
|
+
declare const ProgressIndicator: React$1.ForwardRefExoticComponent<ProgressIndicatorProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Duration preset for the snackbar auto-dismiss timer.
|
|
318
|
+
* - `'short'` → 4 000 ms (default, MD3 spec)
|
|
319
|
+
* - `'long'` → 7 000 ms
|
|
320
|
+
* - `number` → custom milliseconds
|
|
321
|
+
*/
|
|
322
|
+
type SnackbarDuration = "short" | "long" | number;
|
|
323
|
+
/**
|
|
324
|
+
* Resolution value returned by the `showSnackbar()` promise.
|
|
325
|
+
* - `'action-performed'` → user clicked the action button
|
|
326
|
+
* - `'dismissed'` → auto-dismissed or close button clicked
|
|
327
|
+
*/
|
|
328
|
+
type SnackbarResult = "action-performed" | "dismissed";
|
|
329
|
+
/**
|
|
330
|
+
* Visual configuration for a single snackbar instance.
|
|
331
|
+
*/
|
|
332
|
+
interface SnackbarVisuals {
|
|
333
|
+
/** Main message text. */
|
|
334
|
+
message: string;
|
|
335
|
+
/** Label for the optional action button. */
|
|
336
|
+
actionLabel?: string;
|
|
337
|
+
/** When `true`, renders a close (X) icon button. @default false */
|
|
338
|
+
withDismissAction?: boolean;
|
|
339
|
+
/**
|
|
340
|
+
* When `true`, renders the action button below the message (Column layout).
|
|
341
|
+
* Use when both message and actionLabel are long.
|
|
342
|
+
* @default false
|
|
343
|
+
*/
|
|
344
|
+
actionOnNewLine?: boolean;
|
|
345
|
+
/**
|
|
346
|
+
* Auto-dismiss duration.
|
|
347
|
+
* @default 'short' (4 000 ms)
|
|
348
|
+
*/
|
|
349
|
+
duration?: SnackbarDuration;
|
|
350
|
+
/** Additional className applied to the snackbar container. */
|
|
351
|
+
className?: string;
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Internal runtime data for a currently-displayed snackbar.
|
|
355
|
+
* Includes the resolve callback to settle the caller's promise.
|
|
356
|
+
*/
|
|
357
|
+
interface SnackbarData {
|
|
358
|
+
/** Unique key for AnimatePresence element diffing. */
|
|
359
|
+
id: string;
|
|
360
|
+
/** Visual configuration. */
|
|
361
|
+
visuals: SnackbarVisuals;
|
|
362
|
+
/** Settles the promise returned by `showSnackbar()`. */
|
|
363
|
+
resolve: (result: SnackbarResult) => void;
|
|
364
|
+
}
|
|
365
|
+
/** Props for the pure `Snackbar` display component. */
|
|
366
|
+
interface SnackbarProps {
|
|
367
|
+
/** Runtime data including message, actions, and resolve callback. */
|
|
368
|
+
data: SnackbarData;
|
|
369
|
+
/** Additional className merged onto the snackbar container. */
|
|
370
|
+
className?: string;
|
|
371
|
+
}
|
|
372
|
+
/** Props for the `SnackbarHost` component. */
|
|
373
|
+
interface SnackbarHostProps {
|
|
374
|
+
/** State returned by `useSnackbarState()`. */
|
|
375
|
+
state: UseSnackbarStateReturn;
|
|
376
|
+
/** Additional className applied to the fixed host wrapper. */
|
|
377
|
+
className?: string;
|
|
378
|
+
}
|
|
379
|
+
/** Return type of `useSnackbarState`. */
|
|
380
|
+
interface UseSnackbarStateReturn {
|
|
381
|
+
/** Currently visible snackbar data, or `null` when idle. */
|
|
382
|
+
current: SnackbarData | null;
|
|
383
|
+
/**
|
|
384
|
+
* Show a snackbar with the given visuals.
|
|
385
|
+
* Returns a promise that resolves when the snackbar is dismissed or the action is triggered.
|
|
386
|
+
*/
|
|
387
|
+
showSnackbar: (visuals: SnackbarVisuals) => Promise<SnackbarResult>;
|
|
388
|
+
/** Internal dismiss handler — called by `SnackbarHost`. */
|
|
389
|
+
_dismiss: (result: SnackbarResult) => void;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Low-level hook that manages the snackbar queue and current state.
|
|
393
|
+
*
|
|
394
|
+
* Uses a `ref`-based queue (mutex pattern) so that enqueueing never
|
|
395
|
+
* triggers a re-render storm — only the state transition does.
|
|
396
|
+
*
|
|
397
|
+
* @example
|
|
398
|
+
* ```tsx
|
|
399
|
+
* // Used internally by SnackbarProvider
|
|
400
|
+
* const state = useSnackbarState();
|
|
401
|
+
* return <SnackbarHost state={state} />;
|
|
402
|
+
* ```
|
|
403
|
+
*/
|
|
404
|
+
declare function useSnackbarState(): UseSnackbarStateReturn;
|
|
405
|
+
/**
|
|
406
|
+
* MD3 Expressive Snackbar — pure display component.
|
|
407
|
+
*
|
|
408
|
+
* Renders a single snackbar with message, optional action button, and
|
|
409
|
+
* optional dismiss icon button. Handles its own auto-dismiss timer.
|
|
410
|
+
*
|
|
411
|
+
* @remarks
|
|
412
|
+
* - Uses `role="status"` + `aria-live="polite"` for screen reader announcements.
|
|
413
|
+
* - All entrance/exit animation is handled by the parent `SnackbarHost` via
|
|
414
|
+
* `AnimatePresence` + `SNACKBAR_ANIM`.
|
|
415
|
+
* - Do NOT render this component directly — use `SnackbarHost`.
|
|
416
|
+
*
|
|
417
|
+
* @example
|
|
418
|
+
* ```tsx
|
|
419
|
+
* // Internal usage inside SnackbarHost — not for direct use
|
|
420
|
+
* <Snackbar data={currentSnackbarData} />
|
|
421
|
+
* ```
|
|
422
|
+
*/
|
|
423
|
+
declare const Snackbar: React$1.NamedExoticComponent<SnackbarProps>;
|
|
424
|
+
/**
|
|
425
|
+
* MD3 SnackbarHost — renders the AnimatePresence container for snackbar queue.
|
|
426
|
+
*
|
|
427
|
+
* Place this once in your app layout. It will show snackbars one at a time,
|
|
428
|
+
* dequeuing the next one as each dismisses.
|
|
429
|
+
*
|
|
430
|
+
* @example
|
|
431
|
+
* ```tsx
|
|
432
|
+
* // Typically used inside SnackbarProvider — not directly
|
|
433
|
+
* const state = useSnackbarState();
|
|
434
|
+
* <SnackbarHost state={state} />
|
|
435
|
+
* ```
|
|
436
|
+
*/
|
|
437
|
+
declare function SnackbarHost({ state, className }: SnackbarHostProps): react_jsx_runtime.JSX.Element;
|
|
438
|
+
declare namespace SnackbarHost {
|
|
439
|
+
var displayName: string;
|
|
440
|
+
}
|
|
441
|
+
interface SnackbarContextValue {
|
|
442
|
+
showSnackbar: (visuals: SnackbarVisuals) => Promise<SnackbarResult>;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* MD3 SnackbarProvider — context provider for imperative snackbar API.
|
|
446
|
+
*
|
|
447
|
+
* Wrap your application (or a section of it) with this provider.
|
|
448
|
+
* Then use `useSnackbar()` in any descendant to show snackbars.
|
|
449
|
+
*
|
|
450
|
+
* @example
|
|
451
|
+
* ```tsx
|
|
452
|
+
* // In your root layout:
|
|
453
|
+
* <SnackbarProvider>
|
|
454
|
+
* <App />
|
|
455
|
+
* </SnackbarProvider>
|
|
456
|
+
*
|
|
457
|
+
* // In any component:
|
|
458
|
+
* const { showSnackbar } = useSnackbar();
|
|
459
|
+
* await showSnackbar({ message: 'Saved!', actionLabel: 'Undo' });
|
|
460
|
+
* ```
|
|
461
|
+
*/
|
|
462
|
+
declare function SnackbarProvider({ children }: {
|
|
463
|
+
children: React$1.ReactNode;
|
|
464
|
+
}): react_jsx_runtime.JSX.Element;
|
|
465
|
+
declare namespace SnackbarProvider {
|
|
466
|
+
var displayName: string;
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Hook that returns the `showSnackbar` function from the nearest `SnackbarProvider`.
|
|
470
|
+
*
|
|
471
|
+
* @throws {Error} if used outside of a `SnackbarProvider`.
|
|
472
|
+
*
|
|
473
|
+
* @example
|
|
474
|
+
* ```tsx
|
|
475
|
+
* function SaveButton() {
|
|
476
|
+
* const { showSnackbar } = useSnackbar();
|
|
477
|
+
*
|
|
478
|
+
* const handleSave = async () => {
|
|
479
|
+
* const result = await showSnackbar({
|
|
480
|
+
* message: 'Changes saved',
|
|
481
|
+
* actionLabel: 'Undo',
|
|
482
|
+
* });
|
|
483
|
+
* if (result === 'action-performed') undoSave();
|
|
484
|
+
* };
|
|
485
|
+
*
|
|
486
|
+
* return <button onClick={handleSave}>Save</button>;
|
|
487
|
+
* }
|
|
488
|
+
* ```
|
|
489
|
+
*/
|
|
490
|
+
declare function useSnackbar(): SnackbarContextValue;
|
|
491
|
+
|
|
492
|
+
type TooltipPlacement = "top" | "bottom" | "left" | "right" | "auto";
|
|
493
|
+
type TooltipTrigger = "hover" | "focus" | "click" | "long-press" | "manual";
|
|
494
|
+
interface TooltipStateConfig {
|
|
495
|
+
initialVisible?: boolean;
|
|
496
|
+
isPersistent?: boolean;
|
|
497
|
+
duration?: number;
|
|
498
|
+
}
|
|
499
|
+
interface TooltipState {
|
|
500
|
+
isVisible: boolean;
|
|
501
|
+
show: () => void;
|
|
502
|
+
dismiss: () => void;
|
|
503
|
+
}
|
|
504
|
+
interface CaretConfig {
|
|
505
|
+
enabled: boolean;
|
|
506
|
+
width?: number;
|
|
507
|
+
height?: number;
|
|
508
|
+
customPath?: string;
|
|
509
|
+
}
|
|
510
|
+
interface TooltipBoxProps {
|
|
511
|
+
children: React$1.ReactNode;
|
|
512
|
+
tooltip: React$1.ReactNode;
|
|
513
|
+
placement?: TooltipPlacement;
|
|
514
|
+
trigger?: TooltipTrigger | TooltipTrigger[];
|
|
515
|
+
state?: TooltipState;
|
|
516
|
+
spacingFromAnchor?: number;
|
|
517
|
+
disabled?: boolean;
|
|
518
|
+
className?: string;
|
|
519
|
+
showDelay?: number;
|
|
520
|
+
hideDelay?: number;
|
|
521
|
+
"aria-label"?: string;
|
|
522
|
+
}
|
|
523
|
+
interface PlainTooltipProps extends React$1.HTMLAttributes<HTMLDivElement> {
|
|
524
|
+
children: React$1.ReactNode;
|
|
525
|
+
caret?: CaretConfig | null;
|
|
526
|
+
maxWidth?: number;
|
|
527
|
+
className?: string;
|
|
528
|
+
containerColor?: string;
|
|
529
|
+
textColor?: string;
|
|
530
|
+
"data-side"?: "top" | "bottom" | "left" | "right";
|
|
531
|
+
}
|
|
532
|
+
interface RichTooltipProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
533
|
+
children?: React$1.ReactNode;
|
|
534
|
+
title?: React$1.ReactNode;
|
|
535
|
+
action?: React$1.ReactNode;
|
|
536
|
+
caret?: CaretConfig | null;
|
|
537
|
+
maxWidth?: number;
|
|
538
|
+
className?: string;
|
|
539
|
+
colors?: {
|
|
540
|
+
container?: string;
|
|
541
|
+
title?: string;
|
|
542
|
+
body?: string;
|
|
543
|
+
action?: string;
|
|
544
|
+
};
|
|
545
|
+
"data-side"?: "top" | "bottom" | "left" | "right";
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
declare const PlainTooltip: React$1.ForwardRefExoticComponent<PlainTooltipProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
549
|
+
|
|
550
|
+
declare const RichTooltip: React$1.ForwardRefExoticComponent<RichTooltipProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
551
|
+
|
|
552
|
+
declare const TooltipTokens: {
|
|
553
|
+
readonly PlainTooltip: {
|
|
554
|
+
readonly containerColor: "var(--md-sys-color-inverse-surface)";
|
|
555
|
+
readonly textColor: "var(--md-sys-color-inverse-on-surface)";
|
|
556
|
+
readonly shape: "rounded-[4px]";
|
|
557
|
+
readonly font: "text-[12px] font-normal tracking-[0.4px] leading-[16px]";
|
|
558
|
+
readonly height: "min-h-6";
|
|
559
|
+
readonly padding: "px-2 py-1";
|
|
560
|
+
readonly maxWidth: "max-w-50";
|
|
561
|
+
};
|
|
562
|
+
readonly RichTooltip: {
|
|
563
|
+
readonly containerColor: "var(--md-sys-color-surface-container)";
|
|
564
|
+
readonly elevation: "shadow-md";
|
|
565
|
+
readonly shape: "rounded-[12px]";
|
|
566
|
+
readonly paddingTop: "pt-3";
|
|
567
|
+
readonly paddingBottom: "pb-2";
|
|
568
|
+
readonly paddingX: "px-4";
|
|
569
|
+
readonly maxWidth: "max-w-80";
|
|
570
|
+
readonly subheadColor: "var(--md-sys-color-on-surface-variant)";
|
|
571
|
+
readonly subheadFont: "text-[14px] font-medium leading-[20px]";
|
|
572
|
+
readonly bodyColor: "var(--md-sys-color-on-surface-variant)";
|
|
573
|
+
readonly bodyFont: "text-[14px] font-normal leading-[20px]";
|
|
574
|
+
readonly actionColor: "var(--md-sys-color-primary)";
|
|
575
|
+
readonly actionFont: "text-[14px] font-medium leading-[20px]";
|
|
576
|
+
};
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
declare function TooltipBox({ children, tooltip, placement, trigger, state: controlledState, spacingFromAnchor, disabled, className, showDelay, hideDelay, "aria-label": ariaLabel, }: TooltipBoxProps): react_jsx_runtime.JSX.Element;
|
|
580
|
+
|
|
581
|
+
interface TooltipCaretProps {
|
|
582
|
+
side: "top" | "bottom" | "left" | "right";
|
|
583
|
+
width?: number;
|
|
584
|
+
height?: number;
|
|
585
|
+
color?: string;
|
|
586
|
+
customPath?: string;
|
|
587
|
+
className?: string;
|
|
588
|
+
}
|
|
589
|
+
declare function TooltipCaretShape({ side, width, height, color, customPath, className, }: TooltipCaretProps): react_jsx_runtime.JSX.Element;
|
|
590
|
+
|
|
591
|
+
interface PositionState {
|
|
592
|
+
top: number;
|
|
593
|
+
left: number;
|
|
594
|
+
actualSide: "top" | "bottom" | "left" | "right";
|
|
595
|
+
}
|
|
596
|
+
declare function useTooltipPosition(anchorRef: React.RefObject<HTMLElement | null>, tooltipRef: React.RefObject<HTMLElement | null>, placement: TooltipPlacement, spacing: number, isVisible: boolean): PositionState;
|
|
597
|
+
|
|
598
|
+
declare function useTooltipState(config?: TooltipStateConfig): TooltipState;
|
|
599
|
+
|
|
600
|
+
export { Badge, type BadgeProps, BadgedBox, type BadgedBoxProps, type CaretConfig, type CircularProgressProps, type LinearProgressProps, LoadingIndicator, type LoadingIndicatorProps, PlainTooltip, type PlainTooltipProps, ProgressIndicator, type ProgressIndicatorProps, RichTooltip, type RichTooltipProps, Snackbar, type SnackbarData, type SnackbarDuration, SnackbarHost, type SnackbarHostProps, type SnackbarProps, SnackbarProvider, type SnackbarResult, type SnackbarVisuals, TooltipBox, type TooltipBoxProps, TooltipCaretShape, type TooltipPlacement, type TooltipState, type TooltipStateConfig, TooltipTokens, type TooltipTrigger, type UseSnackbarStateReturn, useSnackbar, useSnackbarState, useTooltipPosition, useTooltipState };
|