@bug-on/m3-expressive 1.0.0 → 1.2.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 +41 -2
- package/README.md +20 -18
- package/dist/assets/material-symbols-self-hosted.css +27 -26
- package/dist/buttons.d.mts +2 -2
- package/dist/buttons.d.ts +2 -2
- package/dist/buttons.js +30 -1
- package/dist/buttons.js.map +1 -1
- package/dist/buttons.mjs +30 -1
- package/dist/buttons.mjs.map +1 -1
- package/dist/core-Bc5Wj_pc.d.ts +497 -0
- package/dist/core-D4048_K5.d.mts +497 -0
- package/dist/core.d.mts +6 -422
- package/dist/core.d.ts +6 -422
- package/dist/core.js +137 -68
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +138 -69
- package/dist/core.mjs.map +1 -1
- package/dist/feedback.d.mts +54 -54
- package/dist/feedback.d.ts +54 -54
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs.map +1 -1
- package/dist/index.css +9 -1
- package/dist/index.d.mts +66 -4
- package/dist/index.d.ts +66 -4
- package/dist/index.js +214 -94
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +214 -95
- package/dist/index.mjs.map +1 -1
- package/dist/layout.d.mts +40 -40
- package/dist/layout.d.ts +40 -40
- package/dist/layout.js +34 -5
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +34 -5
- package/dist/layout.mjs.map +1 -1
- package/dist/material-symbols-self-hosted.css +27 -26
- package/dist/{md3-DFhj-NZj.d.mts → md3-Dty-Qcad.d.mts} +7 -1
- package/dist/{md3-DFhj-NZj.d.ts → md3-Dty-Qcad.d.ts} +7 -1
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.d.mts +2 -2
- package/dist/overlays.d.ts +2 -2
- package/dist/overlays.js +2 -2
- package/dist/overlays.js.map +1 -1
- package/dist/overlays.mjs +2 -2
- package/dist/overlays.mjs.map +1 -1
- package/dist/pickers.d.mts +241 -243
- package/dist/pickers.d.ts +241 -243
- package/dist/pickers.js +1 -1
- package/dist/pickers.js.map +1 -1
- package/dist/pickers.mjs +1 -1
- package/dist/pickers.mjs.map +1 -1
- package/dist/{side-sheet-modal-BY6VCC8p.d.mts → side-sheet-modal-64FGhDxL.d.mts} +20 -21
- package/dist/{side-sheet-modal-CglP6KYA.d.ts → side-sheet-modal-Bd5Qqvp9.d.ts} +20 -21
- package/dist/{split-button-trailing-uncheckable-C5CLCIKP.d.ts → split-button-trailing-uncheckable-BkPbiBo3.d.ts} +169 -152
- package/dist/{split-button-trailing-uncheckable-MXj_kyNt.d.mts → split-button-trailing-uncheckable-D_PLPb-u.d.mts} +169 -152
- package/dist/typography.css +5 -0
- package/package.json +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HTMLMotionProps } from 'motion/react';
|
|
2
|
-
import { M as MD3ColorStyle, b as MD3Size, a as MD3Shape } from './md3-
|
|
2
|
+
import { M as MD3ColorStyle, b as MD3Size, a as MD3Shape } from './md3-Dty-Qcad.js';
|
|
3
3
|
import * as React$1 from 'react';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
|
|
@@ -170,77 +170,105 @@ declare const BUTTON_COLOR_TOKENS: {
|
|
|
170
170
|
readonly selected: "bg-transparent text-m3-primary";
|
|
171
171
|
readonly unselected: "bg-transparent text-m3-primary";
|
|
172
172
|
};
|
|
173
|
+
/**
|
|
174
|
+
* High-chroma tertiary tone. Use for hero CTAs and expressive moments where
|
|
175
|
+
* a distinct accent beyond primary is needed (e.g., hero chip, highlight fab).
|
|
176
|
+
*/
|
|
177
|
+
readonly tertiary: {
|
|
178
|
+
readonly default: "bg-m3-tertiary text-m3-on-tertiary";
|
|
179
|
+
readonly selected: "bg-m3-tertiary text-m3-on-tertiary";
|
|
180
|
+
readonly unselected: "bg-m3-tertiary-container text-m3-on-tertiary-container";
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* Brand-stable primary fixed. Hue stays consistent across light and dark modes.
|
|
184
|
+
* Ideal for badges, pill chips, and elements that must carry the brand color
|
|
185
|
+
* regardless of the active theme.
|
|
186
|
+
*/
|
|
187
|
+
readonly "primary-fixed": {
|
|
188
|
+
readonly default: "bg-m3-primary-fixed text-m3-on-primary-fixed";
|
|
189
|
+
readonly selected: "bg-m3-primary-fixed text-m3-on-primary-fixed";
|
|
190
|
+
readonly unselected: "bg-m3-primary-fixed text-m3-on-primary-fixed-variant";
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* Brand-stable tertiary fixed. Use for special-state indicators, achievement
|
|
194
|
+
* badges, or accent pills that need a fixed tertiary hue across themes.
|
|
195
|
+
*/
|
|
196
|
+
readonly "tertiary-fixed": {
|
|
197
|
+
readonly default: "bg-m3-tertiary-fixed text-m3-on-tertiary-fixed";
|
|
198
|
+
readonly selected: "bg-m3-tertiary-fixed text-m3-on-tertiary-fixed";
|
|
199
|
+
readonly unselected: "bg-m3-tertiary-fixed text-m3-on-tertiary-fixed-variant";
|
|
200
|
+
};
|
|
173
201
|
};
|
|
174
202
|
|
|
175
203
|
type ButtonGroupVariant = "standard" | "connected" | "navbar";
|
|
176
204
|
type ButtonGroupOrientation = "horizontal" | "vertical";
|
|
177
205
|
/**
|
|
178
|
-
*
|
|
206
|
+
* Props for ButtonGroup component.
|
|
179
207
|
*/
|
|
180
208
|
interface ButtonGroupProps extends React$1.FieldsetHTMLAttributes<HTMLFieldSetElement> {
|
|
181
209
|
/**
|
|
182
|
-
*
|
|
183
|
-
* - `standard`:
|
|
184
|
-
* - `connected`:
|
|
185
|
-
* - `navbar`:
|
|
210
|
+
* Display variant of the button group:
|
|
211
|
+
* - `standard`: Independent buttons with gap spacing.
|
|
212
|
+
* - `connected`: Connected buttons sharing borders (Segmented Button).
|
|
213
|
+
* - `navbar`: Navigation bar variant with animated active sliding indicator pill.
|
|
186
214
|
* @default "standard"
|
|
187
215
|
*/
|
|
188
216
|
variant?: ButtonGroupVariant;
|
|
189
217
|
/**
|
|
190
|
-
*
|
|
218
|
+
* Layout orientation of buttons in group.
|
|
191
219
|
* @default "horizontal"
|
|
192
220
|
*/
|
|
193
221
|
orientation?: ButtonGroupOrientation;
|
|
194
222
|
/**
|
|
195
|
-
*
|
|
223
|
+
* When `true`, expands `standard` group to stretch full width of container.
|
|
196
224
|
* @default false
|
|
197
225
|
*/
|
|
198
226
|
fullWidth?: boolean;
|
|
199
227
|
/**
|
|
200
|
-
*
|
|
228
|
+
* Applies unified `size` to all child buttons in group (overrides individual button sizes).
|
|
201
229
|
*/
|
|
202
230
|
size?: MD3Size;
|
|
203
231
|
/**
|
|
204
|
-
*
|
|
232
|
+
* Toggles width expansion/padding animation (Morphing Width) when buttons are pressed (`standard` group).
|
|
205
233
|
* @default true
|
|
206
234
|
*/
|
|
207
235
|
morphingWidth?: boolean;
|
|
208
236
|
/**
|
|
209
|
-
*
|
|
210
|
-
*
|
|
237
|
+
* Expansion ratio for button width on press (`standard` horizontal group).
|
|
238
|
+
* Per MD3 Spec, default is 0.15 (15%).
|
|
211
239
|
* @default 0.15
|
|
212
240
|
*/
|
|
213
241
|
expandedRatio?: number;
|
|
214
242
|
/**
|
|
215
|
-
*
|
|
243
|
+
* Automatically displays Check icon when a child button has `selected={true}`.
|
|
216
244
|
* @default false
|
|
217
245
|
*/
|
|
218
246
|
showCheck?: boolean;
|
|
219
247
|
/**
|
|
220
|
-
*
|
|
221
|
-
* - `selected`:
|
|
222
|
-
* - `all`:
|
|
223
|
-
* - `none`:
|
|
248
|
+
* Controls icon display behavior (primarily for `navbar`).
|
|
249
|
+
* - `selected`: Display icon only on selected item.
|
|
250
|
+
* - `all`: Display on all items.
|
|
251
|
+
* - `none`: Hide all icons.
|
|
224
252
|
*/
|
|
225
253
|
iconBehavior?: "selected" | "all" | "none";
|
|
226
254
|
/**
|
|
227
|
-
*
|
|
228
|
-
* - `selected`:
|
|
229
|
-
* - `all`:
|
|
230
|
-
* - `none`:
|
|
255
|
+
* Controls label display behavior (primarily for `navbar`).
|
|
256
|
+
* - `selected`: Display label only on selected item.
|
|
257
|
+
* - `all`: Display on all items.
|
|
258
|
+
* - `none`: Hide all labels.
|
|
231
259
|
*/
|
|
232
260
|
labelBehavior?: "selected" | "all" | "none";
|
|
233
261
|
/**
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
262
|
+
* Enable Active Morphing mode (selection-based).
|
|
263
|
+
* When `true`, buttons automatically expand/contract based on selection state,
|
|
264
|
+
* creating smooth size transitions.
|
|
265
|
+
* When `false` or `undefined`, Group responds to `isPressed` by default.
|
|
238
266
|
*/
|
|
239
267
|
activeMorphing?: boolean;
|
|
240
268
|
/**
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
*
|
|
269
|
+
* Custom CSS class applied to individual child buttons in group.
|
|
270
|
+
* Useful for customizing padding, min-width, or other layout properties.
|
|
271
|
+
* For `navbar` variant, overrides default padding styles.
|
|
244
272
|
*/
|
|
245
273
|
itemClassName?: string;
|
|
246
274
|
}
|
|
@@ -287,236 +315,225 @@ declare const ExtendedFAB: React$1.NamedExoticComponent<Omit<ExtendedFABProps, "
|
|
|
287
315
|
|
|
288
316
|
type MotionButtonProps$1 = Omit<HTMLMotionProps<"button">, "children" | "color">;
|
|
289
317
|
/**
|
|
290
|
-
*
|
|
318
|
+
* Props for `FAB` Floating Action Button component.
|
|
291
319
|
*
|
|
292
320
|
* @remarks
|
|
293
|
-
* -
|
|
294
|
-
* -
|
|
295
|
-
* -
|
|
296
|
-
*
|
|
321
|
+
* - Ensure icon-only FABs specify `aria-label` for accessibility.
|
|
322
|
+
* - In extended mode (`extended={true}`), text passed to `children` acts as the label, so `aria-label` may be omitted if children is string.
|
|
323
|
+
* - `lowered` prop reduces the container shadow to MD3 "lowered" FAB specification;
|
|
324
|
+
* useful when placed on surface containers like Bottom App Bars for visual balance.
|
|
297
325
|
*
|
|
298
326
|
* @see https://m3.material.io/components/floating-action-button/overview
|
|
299
327
|
*/
|
|
300
328
|
interface FABProps extends MotionButtonProps$1 {
|
|
301
329
|
/**
|
|
302
|
-
* Icon
|
|
303
|
-
*
|
|
330
|
+
* Icon element to render — typically an Icon component.
|
|
331
|
+
* Swapped for loading spinner when `loading={true}`.
|
|
304
332
|
*/
|
|
305
333
|
icon: React$1.ReactNode;
|
|
306
334
|
/**
|
|
307
|
-
*
|
|
308
|
-
* - `sm`: Small (40dp) —
|
|
309
|
-
* - `md`: Regular (56dp) —
|
|
310
|
-
* - `lg`: Large (96dp) —
|
|
311
|
-
* - `xl`: Extra-large (136dp) —
|
|
335
|
+
* FAB size variant according to MD3 specification.
|
|
336
|
+
* - `sm`: Small (40dp) — Recommended for tight layouts / inside content.
|
|
337
|
+
* - `md`: Regular (56dp) — Standard primary action.
|
|
338
|
+
* - `lg`: Large (96dp) — High-emphasis action.
|
|
339
|
+
* - `xl`: Extra-large (136dp) — Spotlight action element.
|
|
312
340
|
* @default "md"
|
|
313
341
|
*/
|
|
314
342
|
size?: "sm" | "md" | "lg" | "xl";
|
|
315
343
|
/**
|
|
316
|
-
*
|
|
344
|
+
* MD3 color role container style.
|
|
317
345
|
* @default "primary"
|
|
318
346
|
*/
|
|
319
347
|
colorStyle?: "primary" | "secondary" | "tertiary" | "surface";
|
|
320
348
|
/**
|
|
321
|
-
*
|
|
322
|
-
*
|
|
349
|
+
* When `true`, expands FAB to display label text alongside icon.
|
|
350
|
+
* Width automatically expands to fit `children`.
|
|
323
351
|
* @default false
|
|
324
352
|
*/
|
|
325
353
|
extended?: boolean;
|
|
326
354
|
/**
|
|
327
|
-
*
|
|
328
|
-
*
|
|
355
|
+
* Label content rendered when `extended={true}`.
|
|
356
|
+
* Plain string recommended.
|
|
329
357
|
*/
|
|
330
358
|
children?: React$1.ReactNode;
|
|
331
359
|
/**
|
|
332
|
-
*
|
|
333
|
-
* Mảng bám ở Bottom bar hay Top bar Surface để ránh rườm rà.
|
|
360
|
+
* When `true`, reduces container shadow to lowered elevation.
|
|
334
361
|
* @default false
|
|
335
362
|
*/
|
|
336
363
|
lowered?: boolean;
|
|
337
364
|
/**
|
|
338
|
-
*
|
|
365
|
+
* When `true`, displays loading spinner and disables click interactions.
|
|
339
366
|
* @default false
|
|
340
367
|
*/
|
|
341
368
|
loading?: boolean;
|
|
342
369
|
/**
|
|
343
|
-
*
|
|
370
|
+
* Loading spinner variant.
|
|
344
371
|
* @default "loading-indicator"
|
|
345
372
|
*/
|
|
346
373
|
loadingVariant?: "loading-indicator" | "circular";
|
|
347
374
|
/**
|
|
348
|
-
*
|
|
375
|
+
* Controls FAB visibility in layout using scale motion animation.
|
|
349
376
|
* @default true
|
|
350
377
|
*/
|
|
351
378
|
visible?: boolean;
|
|
352
379
|
}
|
|
353
380
|
/**
|
|
354
|
-
*
|
|
381
|
+
* Props for `FABPosition` layout wrapper component.
|
|
382
|
+
* Position absolute wrapper to anchor FAB to a screen corner.
|
|
355
383
|
*
|
|
356
384
|
* @see {@link FABPosition}
|
|
357
385
|
*/
|
|
358
386
|
interface FABPositionProps {
|
|
359
387
|
/**
|
|
360
|
-
*
|
|
388
|
+
* Screen corner position for FAB.
|
|
361
389
|
* @default "bottom-right"
|
|
362
390
|
*/
|
|
363
391
|
position?: "bottom-right" | "bottom-left" | "top-right" | "top-left";
|
|
364
|
-
/**
|
|
392
|
+
/** Child elements — typically a `<FAB>` component */
|
|
365
393
|
children: React$1.ReactNode;
|
|
366
|
-
/** CSS
|
|
394
|
+
/** Additional CSS class */
|
|
367
395
|
className?: string;
|
|
368
396
|
}
|
|
369
397
|
/**
|
|
370
|
-
*
|
|
398
|
+
* Absolute position wrapper component for `<FAB>`.
|
|
371
399
|
*
|
|
372
|
-
*
|
|
373
|
-
*
|
|
400
|
+
* Anchors FAB to a screen corner with responsive offset padding.
|
|
401
|
+
* Requires parent element to have `position: relative`.
|
|
374
402
|
*
|
|
375
|
-
* @example
|
|
376
|
-
* ```tsx
|
|
377
|
-
* <div className="relative min-h-screen">
|
|
378
|
-
* // Cái nút sẽ xà xuống dưới cùng bên lề Trái
|
|
379
|
-
* <FABPosition position="bottom-left">
|
|
380
|
-
* <FAB icon={<Icon name="edit" />} aria-label="Compose New Mail" />
|
|
381
|
-
* </FABPosition>
|
|
382
|
-
* </div>
|
|
383
|
-
* ```
|
|
384
|
-
*
|
|
385
|
-
* @see {@link FAB}
|
|
386
403
|
* @see https://m3.material.io/components/floating-action-button/guidelines
|
|
387
404
|
*/
|
|
388
405
|
declare function FABPosition({ position, children, className, }: FABPositionProps): react_jsx_runtime.JSX.Element;
|
|
389
406
|
/**
|
|
390
|
-
* Action
|
|
407
|
+
* Primary Floating Action Button (FAB) component adhering to MD3 Expressive.
|
|
391
408
|
*
|
|
392
|
-
*
|
|
393
|
-
*
|
|
394
|
-
* Trạng thái load/nhấp hiện xuất cùng animation thu scale thoát cảnh bắt mắt đầy nghệ thuật.
|
|
409
|
+
* Supports sizes from SM to XL, multiple color roles, extended label expansion,
|
|
410
|
+
* loading states, and entrance/exit scale motion animations.
|
|
395
411
|
*
|
|
396
412
|
* @remarks
|
|
397
|
-
* -
|
|
398
|
-
* -
|
|
399
|
-
*
|
|
400
|
-
* -
|
|
401
|
-
* - Sài kèm `FABPosition` bao đùm nó lại nếu bạn muốn xích nó cố định ngấm chân sâu góc màn hình hiển thị.
|
|
413
|
+
* - Requires `aria-label` for icon-only FABs.
|
|
414
|
+
* - When `extended={true}`, string `children` is automatically used as the accessible label.
|
|
415
|
+
* - Animates scale out when `visible={false}` using fluid spring animation.
|
|
416
|
+
* - Combine with `FABPosition` to anchor to screen corners.
|
|
402
417
|
*
|
|
403
418
|
* @example
|
|
404
419
|
* ```tsx
|
|
405
|
-
* //
|
|
406
|
-
* <FAB icon={<Icon name="search" />} aria-label="
|
|
420
|
+
* // Basic small icon-only FAB
|
|
421
|
+
* <FAB icon={<Icon name="search" />} aria-label="Search" size="sm" />
|
|
407
422
|
*
|
|
408
|
-
* //
|
|
423
|
+
* // Extended FAB with label
|
|
409
424
|
* const [isOpen, setOpen] = React.useState(false);
|
|
410
425
|
* <FAB
|
|
411
426
|
* icon={<Icon name="edit" />}
|
|
412
427
|
* extended={isOpen}
|
|
413
428
|
* onClick={() => setOpen(!isOpen)}
|
|
414
429
|
* >
|
|
415
|
-
*
|
|
430
|
+
* Compose
|
|
416
431
|
* </FAB>
|
|
417
432
|
*
|
|
418
|
-
* // FAB
|
|
433
|
+
* // Large FAB with loading state
|
|
419
434
|
* <FAB
|
|
420
435
|
* icon={<Icon name="upload" />}
|
|
436
|
+
|
|
421
437
|
* size="lg"
|
|
422
438
|
* loading={isUploading}
|
|
423
439
|
* colorStyle="secondary"
|
|
424
|
-
* aria-label="Upload
|
|
440
|
+
* aria-label="Upload files"
|
|
425
441
|
* />
|
|
426
442
|
*
|
|
427
|
-
* //
|
|
443
|
+
* // Fixed at bottom right
|
|
428
444
|
* <FABPosition position="bottom-right">
|
|
429
|
-
* <FAB icon={<Icon name="add" />} aria-label="
|
|
445
|
+
* <FAB icon={<Icon name="add" />} aria-label="Add item" />
|
|
430
446
|
* </FABPosition>
|
|
431
447
|
* ```
|
|
448
|
+
|
|
432
449
|
*
|
|
433
450
|
* @see https://m3.material.io/components/floating-action-button/overview
|
|
434
451
|
*/
|
|
435
452
|
declare const FAB: React$1.NamedExoticComponent<Omit<FABProps, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
436
453
|
|
|
437
454
|
/**
|
|
438
|
-
*
|
|
455
|
+
* Data interface for each action item in FAB menu.
|
|
439
456
|
*
|
|
440
|
-
*
|
|
457
|
+
* If `label` is omitted, renders as an icon-only item.
|
|
441
458
|
*/
|
|
442
459
|
interface FABMenuItemData {
|
|
443
|
-
/**
|
|
460
|
+
/** Unique ID used for React keys and focus tracking. */
|
|
444
461
|
id: string;
|
|
445
|
-
/** Label
|
|
462
|
+
/** Label displayed adjacent to icon (optional). Omit for icon-only item. */
|
|
446
463
|
label?: string;
|
|
447
|
-
/**
|
|
464
|
+
/** Icon node — typically an SVG icon component. */
|
|
448
465
|
icon: React$1.ReactNode;
|
|
449
|
-
/**
|
|
466
|
+
/** Callback invoked when item is activated (click, Enter, or Space). */
|
|
450
467
|
onClick: () => void;
|
|
451
468
|
/**
|
|
452
|
-
*
|
|
453
|
-
*
|
|
469
|
+
* When `true`, visually and interactively disables the item.
|
|
470
|
+
* Uses `aria-disabled` instead of HTML `disabled` to preserve focusability for accessibility.
|
|
454
471
|
* @default false
|
|
455
472
|
*/
|
|
456
473
|
disabled?: boolean;
|
|
457
|
-
/**
|
|
474
|
+
/** Additional CSS class names for item wrapper. */
|
|
458
475
|
className?: string;
|
|
459
476
|
}
|
|
460
477
|
/**
|
|
461
|
-
*
|
|
478
|
+
* Props controlling the main `FABMenu` component.
|
|
462
479
|
*
|
|
463
480
|
* @remarks
|
|
464
|
-
* FABMenu
|
|
465
|
-
*
|
|
466
|
-
* do đó bạn có thể quản lý qua react state, hoặc dùng router hay business logic khác.
|
|
481
|
+
* FABMenu manages menu open/close lifecycle, focus trapping, keyboard control,
|
|
482
|
+
* and staggered motion transitions. `expanded` state is controlled externally.
|
|
467
483
|
*/
|
|
468
484
|
interface FABMenuProps {
|
|
469
|
-
/** FAB Menu
|
|
485
|
+
/** Whether the FAB Menu is open (expanded). */
|
|
470
486
|
expanded: boolean;
|
|
471
|
-
/**
|
|
487
|
+
/** Callback invoked when Toggle FAB is interacted with or backdrop dismissed. */
|
|
472
488
|
onToggle: (expanded: boolean) => void;
|
|
473
|
-
/**
|
|
489
|
+
/** List of action items (MD3 spec recommends 2–6 items). */
|
|
474
490
|
items: FABMenuItemData[];
|
|
475
491
|
/**
|
|
476
|
-
*
|
|
492
|
+
* MD3 container color role for trigger FAB and menu items.
|
|
477
493
|
* @default "primary"
|
|
478
494
|
*/
|
|
479
495
|
colorVariant?: "primary" | "secondary" | "tertiary";
|
|
480
496
|
/**
|
|
481
|
-
*
|
|
497
|
+
* Initial size variant for ToggleFAB (morphs into close icon when expanded).
|
|
482
498
|
* @default "baseline"
|
|
483
499
|
*/
|
|
484
500
|
fabSize?: "baseline" | "medium" | "large";
|
|
485
501
|
/**
|
|
486
|
-
*
|
|
487
|
-
* - `"end"`:
|
|
488
|
-
* - `"start"`:
|
|
489
|
-
* - `"center"`:
|
|
502
|
+
* Menu items alignment relative to Toggle FAB.
|
|
503
|
+
* - `"end"`: Items align to right edge (trailing edge, recommended for RTL).
|
|
504
|
+
* - `"start"`: Items align along left edge.
|
|
505
|
+
* - `"center"`: Items align vertically centered above FAB.
|
|
490
506
|
* @default "end"
|
|
491
507
|
*/
|
|
492
508
|
alignment?: "start" | "end" | "center";
|
|
493
|
-
/**
|
|
509
|
+
/** Custom CSS className for root component. */
|
|
494
510
|
className?: string;
|
|
495
511
|
/**
|
|
496
|
-
*
|
|
512
|
+
* When `true`, clicking backdrop overlay closes menu.
|
|
497
513
|
* @default true
|
|
498
514
|
*/
|
|
499
515
|
closeOnBackdropClick?: boolean;
|
|
500
516
|
/**
|
|
501
|
-
*
|
|
502
|
-
*
|
|
517
|
+
* When `true`, focus automatically moves to the LAST item (closest above FAB) when expanded.
|
|
518
|
+
* If `false`, focus moves to the FIRST item in list.
|
|
519
|
+
|
|
503
520
|
* @default true
|
|
504
521
|
*/
|
|
505
522
|
focusLast?: boolean;
|
|
506
|
-
/**
|
|
523
|
+
/** Required `aria-label` for ToggleFAB for accessibility. */
|
|
507
524
|
"aria-label"?: string;
|
|
508
525
|
}
|
|
509
526
|
/**
|
|
510
|
-
* Props
|
|
527
|
+
* Props for standalone `ToggleFAB` component.
|
|
511
528
|
*/
|
|
512
529
|
interface ToggleFABProps {
|
|
513
|
-
/**
|
|
530
|
+
/** Whether the button is in expanded/active state. */
|
|
514
531
|
expanded: boolean;
|
|
515
|
-
/**
|
|
532
|
+
/** Callback fired when button toggle state changes. */
|
|
516
533
|
onToggle: (expanded: boolean) => void;
|
|
517
534
|
/**
|
|
518
|
-
*
|
|
519
|
-
*
|
|
535
|
+
* Icon generator function receiving `progress` between `0` -> `1` (collapsed -> expanded).
|
|
536
|
+
* Useful for icon morphing effects during animation (e.g., plus to close icon).
|
|
520
537
|
*
|
|
521
538
|
* @example
|
|
522
539
|
* ```tsx
|
|
@@ -524,47 +541,47 @@ interface ToggleFABProps {
|
|
|
524
541
|
* ```
|
|
525
542
|
*/
|
|
526
543
|
icon: (progress: number) => React$1.ReactNode;
|
|
527
|
-
/**
|
|
544
|
+
/** MD3 container color role. @default "primary" */
|
|
528
545
|
colorVariant?: "primary" | "secondary" | "tertiary";
|
|
529
|
-
/**
|
|
546
|
+
/** Initial FAB size variant. @default "baseline" */
|
|
530
547
|
fabSize?: "baseline" | "medium" | "large";
|
|
531
|
-
/** CSS
|
|
548
|
+
/** Additional CSS class name. */
|
|
532
549
|
className?: string;
|
|
533
|
-
/**
|
|
550
|
+
/** Accessible label requirement. Required. */
|
|
534
551
|
"aria-label"?: string;
|
|
535
|
-
/**
|
|
552
|
+
/** ID link for aria-controls attribute to reference menu. */
|
|
536
553
|
"aria-controls"?: string;
|
|
537
|
-
/**
|
|
554
|
+
/** Component ID. */
|
|
538
555
|
id?: string;
|
|
539
556
|
}
|
|
540
557
|
/**
|
|
541
|
-
* Props
|
|
558
|
+
* Props for an individual `FABMenuItem`.
|
|
542
559
|
*/
|
|
543
560
|
interface FABMenuItemProps {
|
|
544
|
-
/**
|
|
561
|
+
/** Icon node to display. */
|
|
545
562
|
icon: React$1.ReactNode;
|
|
546
|
-
/**
|
|
563
|
+
/** Descriptive label text adjacent to icon. */
|
|
547
564
|
label?: string;
|
|
548
|
-
/**
|
|
565
|
+
/** Callback fired when item is clicked. */
|
|
549
566
|
onClick: () => void;
|
|
550
|
-
/**
|
|
567
|
+
/** Disables interaction while keeping element focusable in tab order. @default false */
|
|
551
568
|
disabled?: boolean;
|
|
552
|
-
/** Container
|
|
569
|
+
/** Container color role. @default "primary" */
|
|
553
570
|
colorVariant?: "primary" | "secondary" | "tertiary";
|
|
554
571
|
/** Custom CSS className. */
|
|
555
572
|
className?: string;
|
|
556
|
-
/**
|
|
573
|
+
/** Item index used for staggered animation delay. */
|
|
557
574
|
index?: number;
|
|
558
|
-
/**
|
|
575
|
+
/** Total items count in menu array. */
|
|
559
576
|
totalItems?: number;
|
|
560
|
-
/**
|
|
577
|
+
/** Logic `tabIndex` value for manual keyboard navigation. */
|
|
561
578
|
tabIndex?: number;
|
|
562
579
|
}
|
|
563
580
|
/**
|
|
564
|
-
*
|
|
581
|
+
* Toggle FAB button (Morphing FAB) usable as standalone or trigger for `FABMenu`.
|
|
565
582
|
*
|
|
566
|
-
*
|
|
567
|
-
*
|
|
583
|
+
* Container shape transitions from squircle to circle (square → circle) and shifts colors
|
|
584
|
+
* when `expanded` state changes from false → true.
|
|
568
585
|
*
|
|
569
586
|
* @example
|
|
570
587
|
* ```tsx
|
|
@@ -580,45 +597,45 @@ interface FABMenuItemProps {
|
|
|
580
597
|
*/
|
|
581
598
|
declare const ToggleFAB: React$1.NamedExoticComponent<ToggleFABProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
582
599
|
/**
|
|
583
|
-
*
|
|
600
|
+
* Single action item within a `FABMenu`.
|
|
584
601
|
*
|
|
585
|
-
*
|
|
586
|
-
*
|
|
587
|
-
*
|
|
602
|
+
* Renders a pill shape enclosing icon and optional label text.
|
|
603
|
+
* When `label` is omitted, renders as a square item containing only icon.
|
|
604
|
+
* Includes MD3 Ripple and 48dp touch target area per WCAG 2.5.5 touch target guidelines.
|
|
588
605
|
*
|
|
589
606
|
* @remarks
|
|
590
|
-
*
|
|
591
|
-
*
|
|
592
|
-
* (quy chuẩn chặt chẽ của Material Design 3).
|
|
607
|
+
* Disabled items use `aria-disabled="true"` rather than native HTML `disabled`
|
|
608
|
+
* so they remain focusable in the tab sequence per MD3 specification.
|
|
593
609
|
*/
|
|
594
610
|
declare function FABMenuItem({ icon, label, onClick, disabled, colorVariant, className, tabIndex, }: FABMenuItemProps): react_jsx_runtime.JSX.Element;
|
|
595
611
|
/**
|
|
596
612
|
* MD3 Expressive FAB Menu.
|
|
597
613
|
*
|
|
598
|
-
*
|
|
614
|
+
* Floating Action Button expansion menu. Toggling trigger button reveals vertically stacked action items.
|
|
599
615
|
*
|
|
600
|
-
*
|
|
601
|
-
* -
|
|
602
|
-
* -
|
|
603
|
-
* -
|
|
604
|
-
* -
|
|
616
|
+
* Full MD3 Accessibility implementation:
|
|
617
|
+
* - `role="menu"` assigned to container
|
|
618
|
+
* - `role="menuitem"` assigned to child action items
|
|
619
|
+
* - Focus lifecycle management: Open -> Focus first/last menu item; Close -> Restore focus to ToggleFAB
|
|
620
|
+
* - Keyboard navigation: Escape key closes menu, ArrowUp/Down navigates items, Tab moves focus.
|
|
605
621
|
*
|
|
606
622
|
* @example
|
|
607
623
|
* ```tsx
|
|
608
624
|
* const [open, setOpen] = React.useState(false);
|
|
609
625
|
*
|
|
610
626
|
* const items = [
|
|
611
|
-
* { id: 'share', icon: <Icon name="share" />, label: '
|
|
612
|
-
* { id: 'edit', icon: <Icon name="edit" />, label: '
|
|
613
|
-
* { id: 'delete', icon: <Icon name="delete" />, label: '
|
|
627
|
+
* { id: 'share', icon: <Icon name="share" />, label: 'Share', onClick: () => console.log('Share') },
|
|
628
|
+
* { id: 'edit', icon: <Icon name="edit" />, label: 'Edit', onClick: () => console.log('Edit') },
|
|
629
|
+
* { id: 'delete', icon: <Icon name="delete" />, label: 'Delete', disabled: true, onClick: () => {} }
|
|
614
630
|
* ];
|
|
615
631
|
*
|
|
616
632
|
* <FABMenu
|
|
617
633
|
* expanded={open}
|
|
618
634
|
* onToggle={setOpen}
|
|
619
|
-
* aria-label="
|
|
635
|
+
* aria-label="Quick actions"
|
|
620
636
|
* alignment="center"
|
|
621
637
|
* colorVariant="tertiary"
|
|
638
|
+
|
|
622
639
|
* items={items}
|
|
623
640
|
* />
|
|
624
641
|
* ```
|