@bug-on/m3-expressive 1.0.0 → 1.1.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.
Files changed (49) hide show
  1. package/CHANGELOG.md +29 -2
  2. package/README.md +20 -18
  3. package/dist/assets/material-symbols-self-hosted.css +27 -26
  4. package/dist/buttons.d.mts +1 -1
  5. package/dist/buttons.d.ts +1 -1
  6. package/dist/buttons.js.map +1 -1
  7. package/dist/buttons.mjs.map +1 -1
  8. package/dist/core.d.mts +44 -44
  9. package/dist/core.d.ts +44 -44
  10. package/dist/core.js.map +1 -1
  11. package/dist/core.mjs.map +1 -1
  12. package/dist/feedback.d.mts +54 -54
  13. package/dist/feedback.d.ts +54 -54
  14. package/dist/feedback.js.map +1 -1
  15. package/dist/feedback.mjs.map +1 -1
  16. package/dist/index.css +3 -0
  17. package/dist/index.d.mts +2 -2
  18. package/dist/index.d.ts +2 -2
  19. package/dist/index.js +8 -8
  20. package/dist/index.js.map +1 -1
  21. package/dist/index.mjs +8 -8
  22. package/dist/index.mjs.map +1 -1
  23. package/dist/layout.d.mts +40 -40
  24. package/dist/layout.d.ts +40 -40
  25. package/dist/layout.js +5 -5
  26. package/dist/layout.js.map +1 -1
  27. package/dist/layout.mjs +5 -5
  28. package/dist/layout.mjs.map +1 -1
  29. package/dist/material-symbols-self-hosted.css +27 -26
  30. package/dist/navigation.js.map +1 -1
  31. package/dist/navigation.mjs.map +1 -1
  32. package/dist/overlays.d.mts +2 -2
  33. package/dist/overlays.d.ts +2 -2
  34. package/dist/overlays.js +2 -2
  35. package/dist/overlays.js.map +1 -1
  36. package/dist/overlays.mjs +2 -2
  37. package/dist/overlays.mjs.map +1 -1
  38. package/dist/pickers.d.mts +241 -243
  39. package/dist/pickers.d.ts +241 -243
  40. package/dist/pickers.js +1 -1
  41. package/dist/pickers.js.map +1 -1
  42. package/dist/pickers.mjs +1 -1
  43. package/dist/pickers.mjs.map +1 -1
  44. package/dist/{side-sheet-modal-BY6VCC8p.d.mts → side-sheet-modal-64FGhDxL.d.mts} +20 -21
  45. package/dist/{side-sheet-modal-CglP6KYA.d.ts → side-sheet-modal-Bd5Qqvp9.d.ts} +20 -21
  46. package/dist/{split-button-trailing-uncheckable-MXj_kyNt.d.mts → split-button-trailing-uncheckable-BRPuTqi1.d.mts} +140 -151
  47. package/dist/{split-button-trailing-uncheckable-C5CLCIKP.d.ts → split-button-trailing-uncheckable-CjOFCoyW.d.ts} +140 -151
  48. package/dist/typography.css +5 -0
  49. package/package.json +4 -4
@@ -175,72 +175,72 @@ declare const BUTTON_COLOR_TOKENS: {
175
175
  type ButtonGroupVariant = "standard" | "connected" | "navbar";
176
176
  type ButtonGroupOrientation = "horizontal" | "vertical";
177
177
  /**
178
- * Thuộc tính truyền vào cho thành phần nhóm nút (Button Group).
178
+ * Props for ButtonGroup component.
179
179
  */
180
180
  interface ButtonGroupProps extends React$1.FieldsetHTMLAttributes<HTMLFieldSetElement> {
181
181
  /**
182
- * Cấu trúc hiển thị của nhóm nút:
183
- * - `standard`: Các nút cách xa và có khoảng cách độc lập với nhau (gap).
184
- * - `connected`: Các nút nối liền khung viền với nhau để tạo thành dạng Segmented Button.
185
- * - `navbar`: Nút hiển thị dưới dạng thanh điều hướng với active pill chuyển động (Sliding Indicator).
182
+ * Display variant of the button group:
183
+ * - `standard`: Independent buttons with gap spacing.
184
+ * - `connected`: Connected buttons sharing borders (Segmented Button).
185
+ * - `navbar`: Navigation bar variant with animated active sliding indicator pill.
186
186
  * @default "standard"
187
187
  */
188
188
  variant?: ButtonGroupVariant;
189
189
  /**
190
- * Hướng sắp xếp của các nút trong nhóm.
190
+ * Layout orientation of buttons in group.
191
191
  * @default "horizontal"
192
192
  */
193
193
  orientation?: ButtonGroupOrientation;
194
194
  /**
195
- * Đặt thành `true` nếu bạn muốn nhóm hiển thị dạng `standard` giãn đều lấp đầy toàn bộ khu vực chứa (container).
195
+ * When `true`, expands `standard` group to stretch full width of container.
196
196
  * @default false
197
197
  */
198
198
  fullWidth?: boolean;
199
199
  /**
200
- * Áp dụng thống nhất chung một kích thước (`size`) cho tất cả các con trong nhóm (ghi đè kích thước lẻ từng nút).
200
+ * Applies unified `size` to all child buttons in group (overrides individual button sizes).
201
201
  */
202
202
  size?: MD3Size;
203
203
  /**
204
- * Bật/tắt hiệu ứng thu phóng độ rộng / khoảng đệm (Morphing Width) khi nhấn vào các nút (áp dụng cho nhóm `standard`).
204
+ * Toggles width expansion/padding animation (Morphing Width) when buttons are pressed (`standard` group).
205
205
  * @default true
206
206
  */
207
207
  morphingWidth?: boolean;
208
208
  /**
209
- * Tỷ lệ mở rộng chiều rộng của nút khi được nhấn (áp dụng cho nhóm `standard` ngang).
210
- * Theo MD3 Spec, mặc định 0.15 (15%).
209
+ * Expansion ratio for button width on press (`standard` horizontal group).
210
+ * Per MD3 Spec, default is 0.15 (15%).
211
211
  * @default 0.15
212
212
  */
213
213
  expandedRatio?: number;
214
214
  /**
215
- * Tự động hiển thị biểu tượng (icon) Check khi một nút trạng thái nằm trong nhóm được chỉ định là `selected={true}`.
215
+ * Automatically displays Check icon when a child button has `selected={true}`.
216
216
  * @default false
217
217
  */
218
218
  showCheck?: boolean;
219
219
  /**
220
- * Điều khiển hành vi hiển thị Icon (áp dụng chính cho `navbar`).
221
- * - `selected`: Chỉ hiển thị icon trên mục được chọn.
222
- * - `all`: Hiển thị trên tất cả.
223
- * - `none`: Ẩn toàn bộ icon.
220
+ * Controls icon display behavior (primarily for `navbar`).
221
+ * - `selected`: Display icon only on selected item.
222
+ * - `all`: Display on all items.
223
+ * - `none`: Hide all icons.
224
224
  */
225
225
  iconBehavior?: "selected" | "all" | "none";
226
226
  /**
227
- * Điều khiển hành vi hiển thị Label (áp dụng chính cho `navbar`).
228
- * - `selected`: Chỉ hiển thị label trên mục được chọn.
229
- * - `all`: Hiển thị trên tất cả.
230
- * - `none`: Ẩn toàn bộ label.
227
+ * Controls label display behavior (primarily for `navbar`).
228
+ * - `selected`: Display label only on selected item.
229
+ * - `all`: Display on all items.
230
+ * - `none`: Hide all labels.
231
231
  */
232
232
  labelBehavior?: "selected" | "all" | "none";
233
233
  /**
234
- * Tùy chọn: Bật chế độ Active Morphing (dựa trên Selection).
235
- * Khi `true`, các nút sẽ tự động co dãn (tăng/giảm width) dựa trên việc nút nào đang được chọn,
236
- * tạo hiệu ứng thay đổi kích thước mượt mà theo trạng thái.
237
- * Khi `false` hoặc `undefined`, Group sẽ hoạt động dựa trên `isPressed` (nhấn chuột) như mặc định.
234
+ * Enable Active Morphing mode (selection-based).
235
+ * When `true`, buttons automatically expand/contract based on selection state,
236
+ * creating smooth size transitions.
237
+ * When `false` or `undefined`, Group responds to `isPressed` by default.
238
238
  */
239
239
  activeMorphing?: boolean;
240
240
  /**
241
- * Class CSS tùy chỉnh áp dụng cho từng button con trong nhóm.
242
- * Hữu ích để thay đổi padding, min-width hoặc các thuộc tính khác một cách linh hoạt.
243
- * Đối với variant `navbar`, class này sẽ được ưu tiên hơn so với các padding mặc định.
241
+ * Custom CSS class applied to individual child buttons in group.
242
+ * Useful for customizing padding, min-width, or other layout properties.
243
+ * For `navbar` variant, overrides default padding styles.
244
244
  */
245
245
  itemClassName?: string;
246
246
  }
@@ -287,236 +287,225 @@ declare const ExtendedFAB: React$1.NamedExoticComponent<Omit<ExtendedFABProps, "
287
287
 
288
288
  type MotionButtonProps$1 = Omit<HTMLMotionProps<"button">, "children" | "color">;
289
289
  /**
290
- * Tham số Props dùng cho component thao tác nổi `FAB`.
290
+ * Props for `FAB` Floating Action Button component.
291
291
  *
292
292
  * @remarks
293
- * - Đảm bảo rằng đối với loại FAB chỉ show ra mỗi con Icon mà không có nhãn hiển thị (icon-only), bắt buộc phải có thuộc tính `aria-label` nhằm phục vụ (accessibility).
294
- * - hình thể mở rộng (khi `extended={true}`), phần nội dung truyền vào `children` chính chuỗi Text được thể hiện cùng nút, nó sẽ khiến nút button có label mặc định nên bạn thể chém bớt tham số `aria-label`.
295
- * - Thuộc tính cờ `lowered` (chìm) giúp giáng cấp hiệu ứng tạo bóng Shadow của thẻ, rải mảng cái shadow theo phong thái MD3 "lowered" FAB;
296
- * sử dụng khi nút FAB này vốn bị bọc bên trong bề mặt chìm đè lên component gì khác mà vốn tụi nó đã nhún ở mực sâu (Ví dụ Bottom App Bar) để thiết lập Hierarchy hài hoà.
293
+ * - Ensure icon-only FABs specify `aria-label` for accessibility.
294
+ * - In extended mode (`extended={true}`), text passed to `children` acts as the label, so `aria-label` may be omitted if children is string.
295
+ * - `lowered` prop reduces the container shadow to MD3 "lowered" FAB specification;
296
+ * useful when placed on surface containers like Bottom App Bars for visual balance.
297
297
  *
298
298
  * @see https://m3.material.io/components/floating-action-button/overview
299
299
  */
300
300
  interface FABProps extends MotionButtonProps$1 {
301
301
  /**
302
- * Icon đại diện render — thông thường truyền thẻ component Icon.
303
- * Sẽ được tráo đổi thành Spinner tự động quay khi giá trị `loading={true}`.
302
+ * Icon element to render — typically an Icon component.
303
+ * Swapped for loading spinner when `loading={true}`.
304
304
  */
305
305
  icon: React$1.ReactNode;
306
306
  /**
307
- * Kích thước hiển thị FAB. Tuân chuẩn.
308
- * - `sm`: Small (40dp) — Được khuyên dùng cho các không gian kín/trong lòng Content.
309
- * - `md`: Regular (56dp) — Action thứ yếu hoặc tiêu điểm màn hình. (Phần đông người dùng xài).
310
- * - `lg`: Large (96dp) — Trọng tâm thao tác quan trọng lớn nhát.
311
- * - `xl`: Extra-large (136dp) — Gây tiếng vang, dạng Spotlight cực bùng nổ của app.
307
+ * FAB size variant according to MD3 specification.
308
+ * - `sm`: Small (40dp) — Recommended for tight layouts / inside content.
309
+ * - `md`: Regular (56dp) — Standard primary action.
310
+ * - `lg`: Large (96dp) — High-emphasis action.
311
+ * - `xl`: Extra-large (136dp) — Spotlight action element.
312
312
  * @default "md"
313
313
  */
314
314
  size?: "sm" | "md" | "lg" | "xl";
315
315
  /**
316
- * Container vai trò hệ thống tông màu MD3 dùng phết nền.
316
+ * MD3 color role container style.
317
317
  * @default "primary"
318
318
  */
319
319
  colorStyle?: "primary" | "secondary" | "tertiary" | "surface";
320
320
  /**
321
- * Kích hoạt khi giá trị được đổi là `true`, sẽ diễn tả Animation bung chữ kèm theo độ dãn hình dài cho cái FAB.
322
- * Chiều rộng tự cơi nới để thích ứng chuỗi `children`.
321
+ * When `true`, expands FAB to display label text alongside icon.
322
+ * Width automatically expands to fit `children`.
323
323
  * @default false
324
324
  */
325
325
  extended?: boolean;
326
326
  /**
327
- * Nơi đón lấy chữ được render cùng khi `extended={true}` bật lên.
328
- * Khuyến nghị là Text string thuần.
327
+ * Label content rendered when `extended={true}`.
328
+ * Plain string recommended.
329
329
  */
330
330
  children?: React$1.ReactNode;
331
331
  /**
332
- * Nhấn `true`, thì rút lại shadow đi một cấp xuống độ nổi nông cạn.
333
- * Mảng bám ở Bottom bar hay Top bar Surface để ránh rườm rà.
332
+ * When `true`, reduces container shadow to lowered elevation.
334
333
  * @default false
335
334
  */
336
335
  lowered?: boolean;
337
336
  /**
338
- * Nhấp chuột sang `true`, đổi Icon thành cối xay Spinner chờ kết quả. Đồng loạt chặn click tương tác.
337
+ * When `true`, displays loading spinner and disables click interactions.
339
338
  * @default false
340
339
  */
341
340
  loading?: boolean;
342
341
  /**
343
- * 2 chuẩn hình của Loading chờ.
342
+ * Loading spinner variant.
344
343
  * @default "loading-indicator"
345
344
  */
346
345
  loadingVariant?: "loading-indicator" | "circular";
347
346
  /**
348
- * Hiện thẻ FAB lên layout không (Kiểm soát bằng motion scale Entrance/Exit).
347
+ * Controls FAB visibility in layout using scale motion animation.
349
348
  * @default true
350
349
  */
351
350
  visible?: boolean;
352
351
  }
353
352
  /**
354
- * Interface cho component bọc thẻ `FABPosition` Gắn lớp absolute position nhét cục FAB vào một góc cố định của góc nào đó tại trình duyệt/bề mặt render.
353
+ * Props for `FABPosition` layout wrapper component.
354
+ * Position absolute wrapper to anchor FAB to a screen corner.
355
355
  *
356
356
  * @see {@link FABPosition}
357
357
  */
358
358
  interface FABPositionProps {
359
359
  /**
360
- * Góc để niêm chặt nút FAB.
360
+ * Screen corner position for FAB.
361
361
  * @default "bottom-right"
362
362
  */
363
363
  position?: "bottom-right" | "bottom-left" | "top-right" | "top-left";
364
- /** Kẹp một nùi element. Mong chờ thả Node `<FAB>` vào đây.*/
364
+ /** Child elements typically a `<FAB>` component */
365
365
  children: React$1.ReactNode;
366
- /** CSS Class hỗ trợ chỉnh override */
366
+ /** Additional CSS class */
367
367
  className?: string;
368
368
  }
369
369
  /**
370
- * Element bao bọc thẻ định vị Absolute cho component `<FAB>`.
370
+ * Absolute position wrapper component for `<FAB>`.
371
371
  *
372
- * Component dùng để cắm phao Neo cái FAB vào sát ở góc của screen kèm theo một cái offset space theo responsive an toàn mà lại trơn chu nhạy nhẽo.
373
- * Nhưng quy tắc gốc đó là phần tử bao bọc cha mẹ của nó PHẢI có thẻ tag css `position: relative` (hoặc ở cấp tổ tiêm của trang nào đó phải đẻ gốc rễ ra posisition).
372
+ * Anchors FAB to a screen corner with responsive offset padding.
373
+ * Requires parent element to have `position: relative`.
374
374
  *
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
375
  * @see https://m3.material.io/components/floating-action-button/guidelines
387
376
  */
388
377
  declare function FABPosition({ position, children, className, }: FABPositionProps): react_jsx_runtime.JSX.Element;
389
378
  /**
390
- * Action nổi chính theo phong cách MD3 Expressive Floating Action Button (FAB).
379
+ * Primary Floating Action Button (FAB) component adhering to MD3 Expressive.
391
380
  *
392
- * Phơi nhiễm các action tạo nhịp điệu kích hoạt cho người sử dụng với đủ bộ trang hoàn trọn kích thước Size (SM->XL),
393
- * mang nhiều màu sắc Color role khác biệt, cung cấp một sức nén cho Label để kéo toẹt cái ống dài ra (gọi là Dạng Mở Rộng - Extended) tạo nên hành động sinh động,
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.
381
+ * Supports sizes from SM to XL, multiple color roles, extended label expansion,
382
+ * loading states, and entrance/exit scale motion animations.
395
383
  *
396
384
  * @remarks
397
- * - Chỉ định bắt buộc `aria-label` cho những mẫu icon bị đơn côi trơ trọi (icon-only FABs).
398
- * - Trường hợp xài mode Mở Rộng qua việc truyền hàm `extended={true}`, nút FAB này tự ngộ nhận thân thế, lấy `children` dùng làm Aria label luôn hễ như `children` đó đang chứa text string.
399
- * Khi ấy bạn tha hồ cắt bỏ thuộc tính `aria-label` ra.
400
- * - Lúc cho biến mất (`visible={false}`), bộ nút tung chiêu lùi về sau làm quả rút bóng thoát Scale-out qua effect spring uyển chuyển.
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ị.
385
+ * - Requires `aria-label` for icon-only FABs.
386
+ * - When `extended={true}`, string `children` is automatically used as the accessible label.
387
+ * - Animates scale out when `visible={false}` using fluid spring animation.
388
+ * - Combine with `FABPosition` to anchor to screen corners.
402
389
  *
403
390
  * @example
404
391
  * ```tsx
405
- * // FAB bản, nhỏ xinh, chỉ hiện icon.
406
- * <FAB icon={<Icon name="search" />} aria-label="Nhấn tìm kiếm" size="sm" />
392
+ * // Basic small icon-only FAB
393
+ * <FAB icon={<Icon name="search" />} aria-label="Search" size="sm" />
407
394
  *
408
- * // Dịch sang dòng Extended dòng caption chữ dài thòn
395
+ * // Extended FAB with label
409
396
  * const [isOpen, setOpen] = React.useState(false);
410
397
  * <FAB
411
398
  * icon={<Icon name="edit" />}
412
399
  * extended={isOpen}
413
400
  * onClick={() => setOpen(!isOpen)}
414
401
  * >
415
- * Viết tâm thư
402
+ * Compose
416
403
  * </FAB>
417
404
  *
418
- * // FAB to lớn nhất dùng trạng thái chờ load Submit lên Server
405
+ * // Large FAB with loading state
419
406
  * <FAB
420
407
  * icon={<Icon name="upload" />}
408
+
421
409
  * size="lg"
422
410
  * loading={isUploading}
423
411
  * colorStyle="secondary"
424
- * aria-label="Upload Files lên mây xanh"
412
+ * aria-label="Upload files"
425
413
  * />
426
414
  *
427
- * // Cố định dưới chân tay phải
415
+ * // Fixed at bottom right
428
416
  * <FABPosition position="bottom-right">
429
- * <FAB icon={<Icon name="add" />} aria-label="Dấu Cộng sinh nảy" />
417
+ * <FAB icon={<Icon name="add" />} aria-label="Add item" />
430
418
  * </FABPosition>
431
419
  * ```
420
+
432
421
  *
433
422
  * @see https://m3.material.io/components/floating-action-button/overview
434
423
  */
435
424
  declare const FAB: React$1.NamedExoticComponent<Omit<FABProps, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
436
425
 
437
426
  /**
438
- * Định dạng dữ liệu cho từng hành động (item) trong biểu mẫu menu của FAB.
427
+ * Data interface for each action item in FAB menu.
439
428
  *
440
- * Nếu bỏ qua thuộc tính `label`, item sẽ render dạng ô vuông chỉ có icon.
429
+ * If `label` is omitted, renders as an icon-only item.
441
430
  */
442
431
  interface FABMenuItemData {
443
- /** Một ID duy nhất để dùng cho key react và quản lý focus. */
432
+ /** Unique ID used for React keys and focus tracking. */
444
433
  id: string;
445
- /** Label hiển thị cạnh icon (tuỳ chọn). Không thêm thuộc tính này nếu muốn hiển thị chỉ có icon (icon-only). */
434
+ /** Label displayed adjacent to icon (optional). Omit for icon-only item. */
446
435
  label?: string;
447
- /** Node của Icon thường một component SVG Icon duy nhất. */
436
+ /** Icon nodetypically an SVG icon component. */
448
437
  icon: React$1.ReactNode;
449
- /** Gọi hàm ngay lập tức khi item được kích hoạt (click hoặc nhấn Enter/Phím cách). */
438
+ /** Callback invoked when item is activated (click, Enter, or Space). */
450
439
  onClick: () => void;
451
440
  /**
452
- * Khi `true`, hiệu hoá item về mặt hình thức lẫn tương tác rẽ nhánh.
453
- * Vẫn dùng `aria-disabled` thay HTML `disabled` nhằm giữ lấy được focus phục vụ cho accessibility.
441
+ * When `true`, visually and interactively disables the item.
442
+ * Uses `aria-disabled` instead of HTML `disabled` to preserve focusability for accessibility.
454
443
  * @default false
455
444
  */
456
445
  disabled?: boolean;
457
- /** Thêm CSS classes bổ sung dùng cho wrapper chính của item. */
446
+ /** Additional CSS class names for item wrapper. */
458
447
  className?: string;
459
448
  }
460
449
  /**
461
- * Các props điều khiển Component chính `FABMenu`.
450
+ * Props controlling the main `FABMenu` component.
462
451
  *
463
452
  * @remarks
464
- * FABMenu quản lý vòng đời trạng thái mở/đóng menu (open/close), quản lý focus, điều khiển phím,
465
- * điều hướng hiệu ứng chuyển động. Trạng thái `expanded` được truyền từ ngoài (controlled state),
466
- * do đó bạn có thể quản lý qua react state, hoặc dùng router hay business logic khác.
453
+ * FABMenu manages menu open/close lifecycle, focus trapping, keyboard control,
454
+ * and staggered motion transitions. `expanded` state is controlled externally.
467
455
  */
468
456
  interface FABMenuProps {
469
- /** FAB Menu đang mở (mở rộng)/hiển thị hay không. */
457
+ /** Whether the FAB Menu is open (expanded). */
470
458
  expanded: boolean;
471
- /** Hàm handler kích hoạt khi Toggle FAB được người dùng tương tác, hoặc khi dismiss backdrop. */
459
+ /** Callback invoked when Toggle FAB is interacted with or backdrop dismissed. */
472
460
  onToggle: (expanded: boolean) => void;
473
- /** Danh sách các action items (Spec MD3 đề nghị 2-6 item là hoàn hảo). */
461
+ /** List of action items (MD3 spec recommends 26 items). */
474
462
  items: FABMenuItemData[];
475
463
  /**
476
- * Vai trò màu (color role container) MD3 cho cái nút FAB lẫn các menu items.
464
+ * MD3 container color role for trigger FAB and menu items.
477
465
  * @default "primary"
478
466
  */
479
467
  colorVariant?: "primary" | "secondary" | "tertiary";
480
468
  /**
481
- * Kích cỡ khởi tạo cho cái ToggleFAB (FAB biến hình thành cục đóng dấu X khi nó expanded).
469
+ * Initial size variant for ToggleFAB (morphs into close icon when expanded).
482
470
  * @default "baseline"
483
471
  */
484
472
  fabSize?: "baseline" | "medium" | "large";
485
473
  /**
486
- * Căn lề của danh sách menu items tương quan với cái Toggle FAB.
487
- * - `"end"`: Các items dồn hết theo lề phía tay phải (trailing edge, default cực hữu hiệu đối với RTL design).
488
- * - `"start"`: Các items dồn hết dọc theo lề trái.
489
- * - `"center"`: Các item sẽ được căn ra giữa chiều dọc, căn giữa tâm khối với cái FAB.
474
+ * Menu items alignment relative to Toggle FAB.
475
+ * - `"end"`: Items align to right edge (trailing edge, recommended for RTL).
476
+ * - `"start"`: Items align along left edge.
477
+ * - `"center"`: Items align vertically centered above FAB.
490
478
  * @default "end"
491
479
  */
492
480
  alignment?: "start" | "end" | "center";
493
- /** Thuộc tính cho CSS component root để đè. */
481
+ /** Custom CSS className for root component. */
494
482
  className?: string;
495
483
  /**
496
- * Nếu `true`, khi menu đang hiện ra, click chuột ra phía sau (màn xám mờ backdrop) để đóng menu.
484
+ * When `true`, clicking backdrop overlay closes menu.
497
485
  * @default true
498
486
  */
499
487
  closeOnBackdropClick?: boolean;
500
488
  /**
501
- * Nếu `true`, focus sẽ tự động chạy xuống item CUỐI (sát bên trên cái nút FAB) khi menu vừa loé mờ ra.
502
- * Nếu `false`, focus sẽ bay lên item ĐẦU TIÊN của danh sách (cao nhất trên màn hình).
489
+ * When `true`, focus automatically moves to the LAST item (closest above FAB) when expanded.
490
+ * If `false`, focus moves to the FIRST item in list.
491
+
503
492
  * @default true
504
493
  */
505
494
  focusLast?: boolean;
506
- /** Bắt buộc truyền `aria-label` cho ToggleFAB để đáp ứng Accessibility. */
495
+ /** Required `aria-label` for ToggleFAB for accessibility. */
507
496
  "aria-label"?: string;
508
497
  }
509
498
  /**
510
- * Props thuộc component `ToggleFAB` đứng độc lập.
499
+ * Props for standalone `ToggleFAB` component.
511
500
  */
512
501
  interface ToggleFABProps {
513
- /** Nút đang trong trạng thái được kích hoạt check (expanded). */
502
+ /** Whether the button is in expanded/active state. */
514
503
  expanded: boolean;
515
- /** Gọi khi xảy ra sự kiện Toggle nút. */
504
+ /** Callback fired when button toggle state changes. */
516
505
  onToggle: (expanded: boolean) => void;
517
506
  /**
518
- * Function sinh Icon - nhận về tiến độ `progress` trong khoảng `0` -> `1` (Từ Chưa Expanded -> Đã Expanded)
519
- * Dùng cho các hiệu ứng morphing Icon khi animtion render (VD: Từ Cộng thành Đóng).
507
+ * Icon generator function receiving `progress` between `0` -> `1` (collapsed -> expanded).
508
+ * Useful for icon morphing effects during animation (e.g., plus to close icon).
520
509
  *
521
510
  * @example
522
511
  * ```tsx
@@ -524,47 +513,47 @@ interface ToggleFABProps {
524
513
  * ```
525
514
  */
526
515
  icon: (progress: number) => React$1.ReactNode;
527
- /** Vai trò màu container chuẩn MD3. @default "primary" */
516
+ /** MD3 container color role. @default "primary" */
528
517
  colorVariant?: "primary" | "secondary" | "tertiary";
529
- /** Kích thước của cục FAB ban đầu (Sau khi nhấn sẽ thu tròn). @default "baseline" */
518
+ /** Initial FAB size variant. @default "baseline" */
530
519
  fabSize?: "baseline" | "medium" | "large";
531
- /** CSS Class linh tinh bổ sung thêm. */
520
+ /** Additional CSS class name. */
532
521
  className?: string;
533
- /** Thuộc tính đọc thẻ accessibility. Bắt buộc có. */
522
+ /** Accessible label requirement. Required. */
534
523
  "aria-label"?: string;
535
- /** Kiểm soát giá trị của ID để link với menu qua aria-controls. */
524
+ /** ID link for aria-controls attribute to reference menu. */
536
525
  "aria-controls"?: string;
537
- /** Trỏ id component. */
526
+ /** Component ID. */
538
527
  id?: string;
539
528
  }
540
529
  /**
541
- * Props thuộc component một món item đơn lẻ `FABMenuItem`.
530
+ * Props for an individual `FABMenuItem`.
542
531
  */
543
532
  interface FABMenuItemProps {
544
- /** Node của icon hiện. */
533
+ /** Icon node to display. */
545
534
  icon: React$1.ReactNode;
546
- /** Tên nhãn tả kế bên icon cho item này. Hoặc ẩn nó đi nếu không mong đợi. */
535
+ /** Descriptive label text adjacent to icon. */
547
536
  label?: string;
548
- /** Hàm bắn ra khi item được kích. */
537
+ /** Callback fired when item is clicked. */
549
538
  onClick: () => void;
550
- /** hiệu hóa hành vi tương tác item mà vẫn cho phép bàn phím tab bấm dính lấy focus. @default false */
539
+ /** Disables interaction while keeping element focusable in tab order. @default false */
551
540
  disabled?: boolean;
552
- /** Container tông màu. @default "primary" */
541
+ /** Container color role. @default "primary" */
553
542
  colorVariant?: "primary" | "secondary" | "tertiary";
554
543
  /** Custom CSS className. */
555
544
  className?: string;
556
- /** Số index liệt trong mảng dùng tính render delay (Dành cho animation cấu trúc `custom`). */
545
+ /** Item index used for staggered animation delay. */
557
546
  index?: number;
558
- /** Tổng danh sách items mảng. */
547
+ /** Total items count in menu array. */
559
548
  totalItems?: number;
560
- /** Giá trị logic `tabIndex` dùng điều khiển thao tác phím Tab thủ công. */
549
+ /** Logic `tabIndex` value for manual keyboard navigation. */
561
550
  tabIndex?: number;
562
551
  }
563
552
  /**
564
- * Nút Toggle FAB (Biến hình) thể được dùng độc lập đứng một mình (standalone) hoặc kết nối để kích hoạt mở cả nùi Menu ở dưới con `FABMenu`.
553
+ * Toggle FAB button (Morphing FAB) usable as standalone or trigger for `FABMenu`.
565
554
  *
566
- * Sức ép hiệu ứng kích thước khung nền sẽ chuyển từ vuôn/vát cạnh sang hình tròn hẵn (square → circle), chuyển biến cả màu sắc
567
- * khi mà cờ `expanded` chuyển tiếp từ false sang → true.
555
+ * Container shape transitions from squircle to circle (square → circle) and shifts colors
556
+ * when `expanded` state changes from false → true.
568
557
  *
569
558
  * @example
570
559
  * ```tsx
@@ -580,45 +569,45 @@ interface FABMenuItemProps {
580
569
  */
581
570
  declare const ToggleFAB: React$1.NamedExoticComponent<ToggleFABProps & React$1.RefAttributes<HTMLButtonElement>>;
582
571
  /**
583
- * Một item thực hiện một loại hành động duy nhất trong `FABMenu`.
572
+ * Single action item within a `FABMenu`.
584
573
  *
585
- * Render hình dạng viên thuốc bao quanh icon cùng với label diễn giải.
586
- * Khi `label` bỏ trống, sẽ render thành một cục thẻ gạch ốp màu vuông vức chứa chữ mỗi cái icon.
587
- * Component chứa gợn sóng MD3 Ripple cùng 48dp chuẩn vùng target đụng diện chuẩn WCAG 2.5.5 cho cảm ứng.
574
+ * Renders a pill shape enclosing icon and optional label text.
575
+ * When `label` is omitted, renders as a square item containing only icon.
576
+ * Includes MD3 Ripple and 48dp touch target area per WCAG 2.5.5 touch target guidelines.
588
577
  *
589
578
  * @remarks
590
- * Những thành phần khi bị tắt (vô hiệu tương tác) thì chỉ được dùng role `aria-disabled="true"` lớp div bề mặt thay vì lấy
591
- * thuộc tính gốc `disabled` của HTML. Nhờ đó, item tuy xám mờ không bấm được phím chuột vẫn sẽ có khả năng focus qua vòng đời tab phím bàn phím
592
- * (quy chuẩn chặt chẽ của Material Design 3).
579
+ * Disabled items use `aria-disabled="true"` rather than native HTML `disabled`
580
+ * so they remain focusable in the tab sequence per MD3 specification.
593
581
  */
594
582
  declare function FABMenuItem({ icon, label, onClick, disabled, colorVariant, className, tabIndex, }: FABMenuItemProps): react_jsx_runtime.JSX.Element;
595
583
  /**
596
584
  * MD3 Expressive FAB Menu.
597
585
  *
598
- * Bộ mở rộng Floating Action Button. Khi tương tác bật vào toggle-button (FAB con lai), sẽ trút ra mớ tác vụ menu ở xếp dọc (hoặc lan ra) từ trên đè ngược xuống trên nó.
586
+ * Floating Action Button expansion menu. Toggling trigger button reveals vertically stacked action items.
599
587
  *
600
- * Accessibility thực thi chuẩn MD3 toàn phần:
601
- * - thẻ `role="menu"` trang bị cho thẻ hộp div làm luống container
602
- * - trang bị thẻ `role="menuitem"` trên mảng items thành phần con
603
- * - Lifecycle Focus cho trải nghiệm hoàn mỹ: Mở phím bật -> Focus thẳng lên item cao/thấp đầu/cuối cùng menu; Đóng tắt menu -> Focus trả về ngược lại ToggleFAB
604
- * - Tính năng Bàn Phím: Lách Escape nhấn tắt nhắm, Nhấn phím hướng lên-xuống(ArrowUp/Down) để di chuyển, Móc Tab(hoặc Shift+Tab) nhảy lăng quăng qua các item.
588
+ * Full MD3 Accessibility implementation:
589
+ * - `role="menu"` assigned to container
590
+ * - `role="menuitem"` assigned to child action items
591
+ * - Focus lifecycle management: Open -> Focus first/last menu item; Close -> Restore focus to ToggleFAB
592
+ * - Keyboard navigation: Escape key closes menu, ArrowUp/Down navigates items, Tab moves focus.
605
593
  *
606
594
  * @example
607
595
  * ```tsx
608
596
  * const [open, setOpen] = React.useState(false);
609
597
  *
610
598
  * const items = [
611
- * { id: 'share', icon: <Icon name="share" />, label: 'Chia sẻ', onClick: () => console.log('Share') },
612
- * { id: 'edit', icon: <Icon name="edit" />, label: 'Chỉnh sửa', onClick: () => console.log('Edit') },
613
- * { id: 'delete', icon: <Icon name="delete" />, label: 'Xóa bớt', disabled: true, onClick: () => {} }
599
+ * { id: 'share', icon: <Icon name="share" />, label: 'Share', onClick: () => console.log('Share') },
600
+ * { id: 'edit', icon: <Icon name="edit" />, label: 'Edit', onClick: () => console.log('Edit') },
601
+ * { id: 'delete', icon: <Icon name="delete" />, label: 'Delete', disabled: true, onClick: () => {} }
614
602
  * ];
615
603
  *
616
604
  * <FABMenu
617
605
  * expanded={open}
618
606
  * onToggle={setOpen}
619
- * aria-label="Các công cụ thao tác nhanh"
607
+ * aria-label="Quick actions"
620
608
  * alignment="center"
621
609
  * colorVariant="tertiary"
610
+
622
611
  * items={items}
623
612
  * />
624
613
  * ```
@@ -16,6 +16,11 @@
16
16
  * Usage: Add this class to any element or the root element to apply
17
17
  * the MD3 Expressive typography defaults.
18
18
  */
19
+ @utility font-md3-expressive {
20
+ font-family: "Google Sans Flex", system-ui, sans-serif;
21
+ font-variation-settings: "ROND" 100;
22
+ }
23
+
19
24
  .font-md3-expressive {
20
25
  font-family: "Google Sans Flex", system-ui, sans-serif;
21
26
  font-variation-settings: "ROND" 100;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@bug-on/m3-expressive",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Material Design 3 Expressive React components",
5
- "author": "Bug Ổn",
5
+ "author": "Bug On",
6
6
  "license": "MIT",
7
7
  "publishConfig": {
8
8
  "access": "public"
@@ -179,8 +179,8 @@
179
179
  "class-variance-authority": "^0.7.1",
180
180
  "clsx": "^2.1.1",
181
181
  "tailwind-merge": "^3.3.1",
182
- "@bug-on/m3-tailwind": "1.0.0",
183
- "@bug-on/m3-tokens": "1.0.0"
182
+ "@bug-on/m3-tailwind": "1.1.0",
183
+ "@bug-on/m3-tokens": "1.1.0"
184
184
  },
185
185
  "devDependencies": {
186
186
  "@testing-library/jest-dom": "^6.9.1",