@bug-on/m3-expressive 1.3.1 → 1.3.2
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 +9 -0
- package/README.md +88 -60
- package/dist/buttons.d.mts +3 -3
- package/dist/buttons.d.ts +3 -3
- package/dist/{core-CAU8g2HY.d.mts → core-D8FdHY6I.d.mts} +1 -1
- package/dist/{core-DRrLnsnJ.d.ts → core-DyEy8H9Z.d.ts} +1 -1
- package/dist/core.d.mts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/feedback.js +1 -1
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs +1 -1
- package/dist/feedback.mjs.map +1 -1
- package/dist/forms.d.mts +4 -3
- package/dist/forms.d.ts +4 -3
- package/dist/forms.js +5084 -2987
- package/dist/forms.js.map +1 -1
- package/dist/forms.mjs +5083 -2989
- package/dist/forms.mjs.map +1 -1
- package/dist/{icon-button-USJo7AqO.d.mts → icon-button-CxyJv7UV.d.mts} +1 -1
- package/dist/{icon-button-CqdQBsRe.d.ts → icon-button-Di8VX6ou.d.ts} +1 -1
- package/dist/index.d.mts +12 -82
- package/dist/index.d.ts +12 -82
- package/dist/index.js +2635 -1119
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2483 -979
- package/dist/index.mjs.map +1 -1
- package/dist/layout.d.mts +481 -33
- package/dist/layout.d.ts +481 -33
- package/dist/layout.js +1499 -220
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +1471 -208
- package/dist/layout.mjs.map +1 -1
- package/dist/{md3-D0_Z7IXj.d.mts → md3-BQhRygSi.d.mts} +1 -1
- package/dist/{md3-D0_Z7IXj.d.ts → md3-BQhRygSi.d.ts} +1 -1
- package/dist/menu-types-rZNQFO7Y.d.mts +315 -0
- package/dist/menu-types-rZNQFO7Y.d.ts +315 -0
- package/dist/navigation.d.mts +5 -289
- package/dist/navigation.d.ts +5 -289
- package/dist/navigation.js +423 -250
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs +415 -243
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.d.mts +2 -2
- package/dist/overlays.d.ts +2 -2
- package/dist/{side-sheet-modal-Dgjt739k.d.mts → side-sheet-modal-64FGhDxL.d.mts} +1 -1
- package/dist/{side-sheet-modal-DdEZR6Vl.d.ts → side-sheet-modal-Bd5Qqvp9.d.ts} +1 -1
- package/dist/{split-button-trailing-uncheckable-DTQJjzsB.d.ts → split-button-trailing-uncheckable-CGzk7KcG.d.ts} +1 -1
- package/dist/{split-button-trailing-uncheckable-CIVEYgjY.d.mts → split-button-trailing-uncheckable-gAz6OAIi.d.mts} +1 -1
- package/dist/{text-field-Ear3hCSq.d.mts → text-field-4OlT9o8s.d.mts} +155 -5
- package/dist/{text-field-CiOmDM_8.d.ts → text-field-DARNdj14.d.ts} +155 -5
- package/package.json +3 -3
package/dist/overlays.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { B as BaseSheetProps, a as BottomSheet, b as BottomSheetHandle, c as BottomSheetModal, d as BottomSheetModalProps, e as BottomSheetProps, f as BottomSheetSnapPoint, D as Dialog, g as DialogBody, h as DialogClose, i as DialogContent, j as DialogContentProps, k as DialogDescription, l as DialogFooter, m as DialogFullScreenContent, n as DialogFullScreenContentProps, o as DialogHeader, p as DialogIcon, q as DialogOverlay, r as DialogPortal, s as DialogProps, t as DialogTitle, u as DialogTrigger, v as DragHandle, w as DragHandleProps, x as Drawer, y as DrawerClose, z as DrawerContent, A as DrawerContentProps, C as DrawerDescription, E as DrawerFooter, F as DrawerHeader, G as DrawerOverlay, H as DrawerPortal, I as DrawerProps, J as DrawerTitle, K as DrawerTrigger,
|
|
1
|
+
import { W as SheetValue } from './side-sheet-modal-64FGhDxL.mjs';
|
|
2
|
+
export { B as BaseSheetProps, a as BottomSheet, b as BottomSheetHandle, c as BottomSheetModal, d as BottomSheetModalProps, e as BottomSheetProps, f as BottomSheetSnapPoint, D as Dialog, g as DialogBody, h as DialogClose, i as DialogContent, j as DialogContentProps, k as DialogDescription, l as DialogFooter, m as DialogFullScreenContent, n as DialogFullScreenContentProps, o as DialogHeader, p as DialogIcon, q as DialogOverlay, r as DialogPortal, s as DialogProps, t as DialogTitle, u as DialogTrigger, v as DragHandle, w as DragHandleProps, x as Drawer, y as DrawerClose, z as DrawerContent, A as DrawerContentProps, C as DrawerDescription, E as DrawerFooter, F as DrawerHeader, G as DrawerOverlay, H as DrawerPortal, I as DrawerProps, J as DrawerTitle, K as DrawerTrigger, S as Scrim, L as ScrimProps, M as SheetEdge, N as SheetState, O as SideSheet, P as SideSheetModal, Q as SideSheetModalProps, R as SideSheetProps, U as UseBottomSheetOptions, T as UseBottomSheetReturn, V as useBottomSheet } from './side-sheet-modal-64FGhDxL.mjs';
|
|
3
3
|
import * as React$1 from 'react';
|
|
4
4
|
import { useMotionValue, PanInfo } from 'motion/react';
|
|
5
5
|
import 'react/jsx-runtime';
|
package/dist/overlays.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { B as BaseSheetProps, a as BottomSheet, b as BottomSheetHandle, c as BottomSheetModal, d as BottomSheetModalProps, e as BottomSheetProps, f as BottomSheetSnapPoint, D as Dialog, g as DialogBody, h as DialogClose, i as DialogContent, j as DialogContentProps, k as DialogDescription, l as DialogFooter, m as DialogFullScreenContent, n as DialogFullScreenContentProps, o as DialogHeader, p as DialogIcon, q as DialogOverlay, r as DialogPortal, s as DialogProps, t as DialogTitle, u as DialogTrigger, v as DragHandle, w as DragHandleProps, x as Drawer, y as DrawerClose, z as DrawerContent, A as DrawerContentProps, C as DrawerDescription, E as DrawerFooter, F as DrawerHeader, G as DrawerOverlay, H as DrawerPortal, I as DrawerProps, J as DrawerTitle, K as DrawerTrigger,
|
|
1
|
+
import { W as SheetValue } from './side-sheet-modal-Bd5Qqvp9.js';
|
|
2
|
+
export { B as BaseSheetProps, a as BottomSheet, b as BottomSheetHandle, c as BottomSheetModal, d as BottomSheetModalProps, e as BottomSheetProps, f as BottomSheetSnapPoint, D as Dialog, g as DialogBody, h as DialogClose, i as DialogContent, j as DialogContentProps, k as DialogDescription, l as DialogFooter, m as DialogFullScreenContent, n as DialogFullScreenContentProps, o as DialogHeader, p as DialogIcon, q as DialogOverlay, r as DialogPortal, s as DialogProps, t as DialogTitle, u as DialogTrigger, v as DragHandle, w as DragHandleProps, x as Drawer, y as DrawerClose, z as DrawerContent, A as DrawerContentProps, C as DrawerDescription, E as DrawerFooter, F as DrawerHeader, G as DrawerOverlay, H as DrawerPortal, I as DrawerProps, J as DrawerTitle, K as DrawerTrigger, S as Scrim, L as ScrimProps, M as SheetEdge, N as SheetState, O as SideSheet, P as SideSheetModal, Q as SideSheetModalProps, R as SideSheetProps, U as UseBottomSheetOptions, T as UseBottomSheetReturn, V as useBottomSheet } from './side-sheet-modal-Bd5Qqvp9.js';
|
|
3
3
|
import * as React$1 from 'react';
|
|
4
4
|
import { useMotionValue, PanInfo } from 'motion/react';
|
|
5
5
|
import 'react/jsx-runtime';
|
|
@@ -549,4 +549,4 @@ interface SideSheetModalProps extends BaseSheetProps {
|
|
|
549
549
|
*/
|
|
550
550
|
declare const SideSheetModal: React$1.ForwardRefExoticComponent<SideSheetModalProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
551
551
|
|
|
552
|
-
export { type DrawerContentProps as A, type BaseSheetProps as B, DrawerDescription as C, Dialog as D, DrawerFooter as E, DrawerHeader as F, DrawerOverlay as G, DrawerPortal as H, type DrawerProps as I, DrawerTitle as J, DrawerTrigger as K,
|
|
552
|
+
export { type DrawerContentProps as A, type BaseSheetProps as B, DrawerDescription as C, Dialog as D, DrawerFooter as E, DrawerHeader as F, DrawerOverlay as G, DrawerPortal as H, type DrawerProps as I, DrawerTitle as J, DrawerTrigger as K, type ScrimProps as L, type SheetEdge as M, type SheetState as N, SideSheet as O, SideSheetModal as P, type SideSheetModalProps as Q, type SideSheetProps as R, Scrim as S, type UseBottomSheetReturn as T, type UseBottomSheetOptions as U, useBottomSheet as V, type SheetValue as W, BottomSheet as a, type BottomSheetHandle as b, BottomSheetModal as c, type BottomSheetModalProps as d, type BottomSheetProps as e, type BottomSheetSnapPoint as f, DialogBody as g, DialogClose as h, DialogContent as i, type DialogContentProps as j, DialogDescription as k, DialogFooter as l, DialogFullScreenContent as m, type DialogFullScreenContentProps as n, DialogHeader as o, DialogIcon as p, DialogOverlay as q, DialogPortal as r, type DialogProps as s, DialogTitle as t, DialogTrigger as u, DragHandle as v, type DragHandleProps as w, Drawer as x, DrawerClose as y, DrawerContent as z };
|
|
@@ -549,4 +549,4 @@ interface SideSheetModalProps extends BaseSheetProps {
|
|
|
549
549
|
*/
|
|
550
550
|
declare const SideSheetModal: React$1.ForwardRefExoticComponent<SideSheetModalProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
551
551
|
|
|
552
|
-
export { type DrawerContentProps as A, type BaseSheetProps as B, DrawerDescription as C, Dialog as D, DrawerFooter as E, DrawerHeader as F, DrawerOverlay as G, DrawerPortal as H, type DrawerProps as I, DrawerTitle as J, DrawerTrigger as K,
|
|
552
|
+
export { type DrawerContentProps as A, type BaseSheetProps as B, DrawerDescription as C, Dialog as D, DrawerFooter as E, DrawerHeader as F, DrawerOverlay as G, DrawerPortal as H, type DrawerProps as I, DrawerTitle as J, DrawerTrigger as K, type ScrimProps as L, type SheetEdge as M, type SheetState as N, SideSheet as O, SideSheetModal as P, type SideSheetModalProps as Q, type SideSheetProps as R, Scrim as S, type UseBottomSheetReturn as T, type UseBottomSheetOptions as U, useBottomSheet as V, type SheetValue as W, BottomSheet as a, type BottomSheetHandle as b, BottomSheetModal as c, type BottomSheetModalProps as d, type BottomSheetProps as e, type BottomSheetSnapPoint as f, DialogBody as g, DialogClose as h, DialogContent as i, type DialogContentProps as j, DialogDescription as k, DialogFooter as l, DialogFullScreenContent as m, type DialogFullScreenContentProps as n, DialogHeader as o, DialogIcon as p, DialogOverlay as q, DialogPortal as r, type DialogProps as s, DialogTitle as t, DialogTrigger as u, DragHandle as v, type DragHandleProps as w, Drawer as x, DrawerClose as y, DrawerContent as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HTMLMotionProps } from 'motion/react';
|
|
2
|
-
import {
|
|
2
|
+
import { M as MD3ColorStyle, b as MD3Size, a as MD3Shape } from './md3-BQhRygSi.js';
|
|
3
3
|
import * as React$1 from 'react';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HTMLMotionProps } from 'motion/react';
|
|
2
|
-
import {
|
|
2
|
+
import { M as MD3ColorStyle, b as MD3Size, a as MD3Shape } from './md3-BQhRygSi.mjs';
|
|
3
3
|
import * as React$1 from 'react';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
|
-
import {
|
|
4
|
+
import { M as MenuColorVariant, l as MenuVariant, p as VerticalMenuSeparatorStyle } from './menu-types-rZNQFO7Y.mjs';
|
|
5
|
+
import { b as MD3Size } from './md3-BQhRygSi.mjs';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* @file checkbox.tsx
|
|
@@ -107,15 +108,17 @@ interface ChipProps extends Omit<React$1.ButtonHTMLAttributes<HTMLButtonElement>
|
|
|
107
108
|
elevated?: boolean;
|
|
108
109
|
/**
|
|
109
110
|
* Toggle/selection state.
|
|
110
|
-
* - `filter`:
|
|
111
|
-
* - `input`:
|
|
112
|
-
*
|
|
111
|
+
* - `filter`: selected → bg `secondary-container`, animated checkmark appears.
|
|
112
|
+
* - `input`: selected → bg `secondary-container`.
|
|
113
|
+
* - `suggestion`: selected → bg `secondary-container`.
|
|
114
|
+
* Used for `role="checkbox"` (filter) / `aria-pressed` (input/suggestion).
|
|
113
115
|
*/
|
|
114
116
|
selected?: boolean;
|
|
115
117
|
/**
|
|
116
118
|
* Disables the chip. Applies:
|
|
117
119
|
* - `pointer-events-none` – no mouse/touch interaction
|
|
118
120
|
* - `opacity-[0.38]` – DisabledLabelTextOpacity (0.38) per MD3 tokens
|
|
121
|
+
* - `text-m3-on-surface` – DisabledLabelTextColor per MD3 tokens
|
|
119
122
|
* - `aria-disabled="true"`
|
|
120
123
|
* - `tabIndex={-1}`
|
|
121
124
|
*/
|
|
@@ -133,6 +136,7 @@ interface ChipProps extends Omit<React$1.ButtonHTMLAttributes<HTMLButtonElement>
|
|
|
133
136
|
leadingIcon?: React$1.ReactNode;
|
|
134
137
|
/**
|
|
135
138
|
* Optional trailing icon element (18×18px recommended).
|
|
139
|
+
* Supported across all chip variants including `filter` (alongside checkmark).
|
|
136
140
|
* Color: `on-surface-variant` (unselected) / `on-secondary-container` (selected).
|
|
137
141
|
*/
|
|
138
142
|
trailingIcon?: React$1.ReactNode;
|
|
@@ -413,6 +417,152 @@ interface TextFieldProps {
|
|
|
413
417
|
scrollAreaType?: "hover" | "scroll" | "always" | "none";
|
|
414
418
|
}
|
|
415
419
|
|
|
420
|
+
interface SelectOption {
|
|
421
|
+
/** Display label for the option */
|
|
422
|
+
label: string;
|
|
423
|
+
/** Unique value for the option */
|
|
424
|
+
value: string;
|
|
425
|
+
/** Optional disabled state for this option */
|
|
426
|
+
disabled?: boolean;
|
|
427
|
+
/** Optional leading icon for this option */
|
|
428
|
+
leadingIcon?: React$1.ReactNode;
|
|
429
|
+
/** Supporting text below option label */
|
|
430
|
+
supportingText?: React$1.ReactNode;
|
|
431
|
+
}
|
|
432
|
+
interface SelectOptionRenderState {
|
|
433
|
+
/** Whether the option is currently selected */
|
|
434
|
+
selected: boolean;
|
|
435
|
+
/** Whether the option is disabled */
|
|
436
|
+
disabled?: boolean;
|
|
437
|
+
/** Select handler to trigger when clicking the custom option */
|
|
438
|
+
handleSelect: () => void;
|
|
439
|
+
/** Index in the current visible list */
|
|
440
|
+
index: number;
|
|
441
|
+
}
|
|
442
|
+
interface SelectContentRenderState {
|
|
443
|
+
/** Original options array passed to the component */
|
|
444
|
+
options: SelectOption[];
|
|
445
|
+
/** Options after filtering (or external options when onSearchChange is used) */
|
|
446
|
+
filteredOptions: SelectOption[];
|
|
447
|
+
/** Currently visible items slice */
|
|
448
|
+
visibleOptions: SelectOption[];
|
|
449
|
+
/** Whether there are more items to load in the virtual window */
|
|
450
|
+
hasMore: boolean;
|
|
451
|
+
/** Ref to attach to a sentinel element for progressive loading */
|
|
452
|
+
sentinelRef: React$1.RefObject<HTMLDivElement | null>;
|
|
453
|
+
/** Controlled/uncontrolled current value */
|
|
454
|
+
currentValue?: string;
|
|
455
|
+
/** Selected option object */
|
|
456
|
+
selectedOption?: SelectOption;
|
|
457
|
+
/** Current search query string */
|
|
458
|
+
searchQuery: string;
|
|
459
|
+
/** Callback to select an option and close menu */
|
|
460
|
+
handleSelect: (option: SelectOption) => void;
|
|
461
|
+
/** Empty state text */
|
|
462
|
+
emptyText: string;
|
|
463
|
+
/** Whether loading state is active */
|
|
464
|
+
loading?: boolean;
|
|
465
|
+
}
|
|
466
|
+
interface SelectProps extends Omit<TextFieldProps, "value" | "onChange" | "defaultValue" | "type" | "multiline" | "children"> {
|
|
467
|
+
/** Array of selectable options */
|
|
468
|
+
options: SelectOption[];
|
|
469
|
+
/** Controlled selected value */
|
|
470
|
+
value?: string;
|
|
471
|
+
/** Default selected value (uncontrolled) */
|
|
472
|
+
defaultValue?: string;
|
|
473
|
+
/** Callback fired when selection changes */
|
|
474
|
+
onChange?: (value: string, option?: SelectOption) => void;
|
|
475
|
+
/**
|
|
476
|
+
* Callback fired when search query changes in searchable mode.
|
|
477
|
+
* When provided, INTERNAL filtering is disabled — pass filtered `options` from outside (for server-side/async search).
|
|
478
|
+
*/
|
|
479
|
+
onSearchChange?: (query: string) => void;
|
|
480
|
+
/** Enable autocomplete mode (input filtering real-time search) */
|
|
481
|
+
searchable?: boolean;
|
|
482
|
+
/** Whether data is loading (displays a spinner inside the dropdown) */
|
|
483
|
+
loading?: boolean;
|
|
484
|
+
/** Maximum number of items rendered per chunk in virtual window (default: 50) */
|
|
485
|
+
maxVisible?: number;
|
|
486
|
+
/** Custom placeholder when no option is selected or when searching */
|
|
487
|
+
placeholder?: string;
|
|
488
|
+
/** Label text for the input field */
|
|
489
|
+
label?: string;
|
|
490
|
+
/** Supporting text below the input field */
|
|
491
|
+
supportingText?: string;
|
|
492
|
+
/** Color variant for the dropdown menu ('standard' | 'vibrant') */
|
|
493
|
+
colorVariant?: MenuColorVariant;
|
|
494
|
+
/** Menu visual variant ('expressive' | 'baseline') */
|
|
495
|
+
menuVariant?: MenuVariant;
|
|
496
|
+
/**
|
|
497
|
+
* Whether to show divider lines between menu options.
|
|
498
|
+
* Default: true
|
|
499
|
+
*/
|
|
500
|
+
showDividers?: boolean;
|
|
501
|
+
/**
|
|
502
|
+
* Separation style between menu options ('divider' | 'gap' | 'none').
|
|
503
|
+
* Overrides `showDividers` when explicitly specified.
|
|
504
|
+
* Default: 'divider' (or 'none' if showDividers={false})
|
|
505
|
+
*/
|
|
506
|
+
separatorStyle?: VerticalMenuSeparatorStyle;
|
|
507
|
+
/** Custom empty state message when searchable mode yields no results */
|
|
508
|
+
emptyText?: string;
|
|
509
|
+
/** Whether the popup menu automatically matches the input width. Default: true */
|
|
510
|
+
matchTriggerWidth?: boolean;
|
|
511
|
+
/**
|
|
512
|
+
* Maximum height of the dropdown options list before scrolling.
|
|
513
|
+
* Default: "360px"
|
|
514
|
+
*/
|
|
515
|
+
maxHeight?: string;
|
|
516
|
+
/** Additional class names for the root container */
|
|
517
|
+
className?: string;
|
|
518
|
+
/** Custom renderer for individual option items */
|
|
519
|
+
renderOption?: (option: SelectOption, state: SelectOptionRenderState) => React$1.ReactNode;
|
|
520
|
+
/** Custom renderer for the dropdown content (e.g. for custom virtual list libraries like TanStack Virtual) */
|
|
521
|
+
renderContent?: (state: SelectContentRenderState) => React$1.ReactNode;
|
|
522
|
+
/** Custom children to render inside MenuContent if fully overriding options */
|
|
523
|
+
children?: React$1.ReactNode;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* M3 Expressive Select component (Exposed Dropdown Menu & Autocomplete).
|
|
528
|
+
*
|
|
529
|
+
* Implements Material 3 Exposed Dropdown Menu spec (Figma Node `58966:3961`).
|
|
530
|
+
* Features progressive slice virtualization and server-side/async search via `onSearchChange`.
|
|
531
|
+
*
|
|
532
|
+
* @example
|
|
533
|
+
* // Standard Exposed Dropdown Menu
|
|
534
|
+
* <Select
|
|
535
|
+
* label="City"
|
|
536
|
+
* options={[
|
|
537
|
+
* { label: "Hanoi", value: "hn" },
|
|
538
|
+
* { label: "Ho Chi Minh City", value: "hcm" }
|
|
539
|
+
* ]}
|
|
540
|
+
* value={city}
|
|
541
|
+
* onChange={(val) => setCity(val)}
|
|
542
|
+
* />
|
|
543
|
+
*
|
|
544
|
+
* @example
|
|
545
|
+
* // Searchable Autocomplete (Local filtering)
|
|
546
|
+
* <Select
|
|
547
|
+
* searchable
|
|
548
|
+
* label="Search Employee"
|
|
549
|
+
* options={userList}
|
|
550
|
+
* onChange={(val, opt) => setSelected(opt)}
|
|
551
|
+
* />
|
|
552
|
+
*
|
|
553
|
+
* @example
|
|
554
|
+
* // Searchable Autocomplete (Async / Server-side search)
|
|
555
|
+
* <Select
|
|
556
|
+
* searchable
|
|
557
|
+
* loading={isLoading}
|
|
558
|
+
* label="Search Countries"
|
|
559
|
+
* options={searchResults}
|
|
560
|
+
* onSearchChange={(query) => fetchCountries(query)}
|
|
561
|
+
* onChange={(val, opt) => setSelectedCountry(opt)}
|
|
562
|
+
* />
|
|
563
|
+
*/
|
|
564
|
+
declare const Select: React$1.ForwardRefExoticComponent<Omit<SelectProps, "ref"> & React$1.RefAttributes<TextFieldHandle>>;
|
|
565
|
+
|
|
416
566
|
/**
|
|
417
567
|
* @file slider.types.ts
|
|
418
568
|
* MD3 Expressive Slider — TypeScript prop definitions.
|
|
@@ -1043,4 +1193,4 @@ declare const SwitchColors: {
|
|
|
1043
1193
|
*/
|
|
1044
1194
|
declare const TextField: React$1.NamedExoticComponent<Omit<TextFieldProps, "ref"> & React$1.RefAttributes<TextFieldHandle>>;
|
|
1045
1195
|
|
|
1046
|
-
export {
|
|
1196
|
+
export { type TextFieldInputType as A, type TextFieldProps as B, Checkbox as C, type TextFieldTrailingIconMode as D, type TextFieldVariant as E, TriStateCheckbox as F, type TriStateCheckboxProps as G, type SliderThumbProps as H, RadioButton as R, Select as S, TextField as T, type CheckboxProps as a, type CheckboxState as b, Chip as c, type ChipProps as d, type RadioButtonColors as e, type RadioButtonProps as f, RadioGroup as g, type RadioGroupProps as h, RangeSlider as i, type RangeSliderProps as j, type SelectContentRenderState as k, type SelectOption as l, type SelectOptionRenderState as m, type SelectProps as n, Slider as o, SliderColors as p, type SliderOrientation as q, type SliderProps as r, SliderTokens as s, type SliderTrackSize as t, type SliderVariant as u, Switch as v, SwitchColors as w, type SwitchProps as x, SwitchTokens as y, type TextFieldHandle as z };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
|
-
import {
|
|
4
|
+
import { M as MenuColorVariant, l as MenuVariant, p as VerticalMenuSeparatorStyle } from './menu-types-rZNQFO7Y.js';
|
|
5
|
+
import { b as MD3Size } from './md3-BQhRygSi.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* @file checkbox.tsx
|
|
@@ -107,15 +108,17 @@ interface ChipProps extends Omit<React$1.ButtonHTMLAttributes<HTMLButtonElement>
|
|
|
107
108
|
elevated?: boolean;
|
|
108
109
|
/**
|
|
109
110
|
* Toggle/selection state.
|
|
110
|
-
* - `filter`:
|
|
111
|
-
* - `input`:
|
|
112
|
-
*
|
|
111
|
+
* - `filter`: selected → bg `secondary-container`, animated checkmark appears.
|
|
112
|
+
* - `input`: selected → bg `secondary-container`.
|
|
113
|
+
* - `suggestion`: selected → bg `secondary-container`.
|
|
114
|
+
* Used for `role="checkbox"` (filter) / `aria-pressed` (input/suggestion).
|
|
113
115
|
*/
|
|
114
116
|
selected?: boolean;
|
|
115
117
|
/**
|
|
116
118
|
* Disables the chip. Applies:
|
|
117
119
|
* - `pointer-events-none` – no mouse/touch interaction
|
|
118
120
|
* - `opacity-[0.38]` – DisabledLabelTextOpacity (0.38) per MD3 tokens
|
|
121
|
+
* - `text-m3-on-surface` – DisabledLabelTextColor per MD3 tokens
|
|
119
122
|
* - `aria-disabled="true"`
|
|
120
123
|
* - `tabIndex={-1}`
|
|
121
124
|
*/
|
|
@@ -133,6 +136,7 @@ interface ChipProps extends Omit<React$1.ButtonHTMLAttributes<HTMLButtonElement>
|
|
|
133
136
|
leadingIcon?: React$1.ReactNode;
|
|
134
137
|
/**
|
|
135
138
|
* Optional trailing icon element (18×18px recommended).
|
|
139
|
+
* Supported across all chip variants including `filter` (alongside checkmark).
|
|
136
140
|
* Color: `on-surface-variant` (unselected) / `on-secondary-container` (selected).
|
|
137
141
|
*/
|
|
138
142
|
trailingIcon?: React$1.ReactNode;
|
|
@@ -413,6 +417,152 @@ interface TextFieldProps {
|
|
|
413
417
|
scrollAreaType?: "hover" | "scroll" | "always" | "none";
|
|
414
418
|
}
|
|
415
419
|
|
|
420
|
+
interface SelectOption {
|
|
421
|
+
/** Display label for the option */
|
|
422
|
+
label: string;
|
|
423
|
+
/** Unique value for the option */
|
|
424
|
+
value: string;
|
|
425
|
+
/** Optional disabled state for this option */
|
|
426
|
+
disabled?: boolean;
|
|
427
|
+
/** Optional leading icon for this option */
|
|
428
|
+
leadingIcon?: React$1.ReactNode;
|
|
429
|
+
/** Supporting text below option label */
|
|
430
|
+
supportingText?: React$1.ReactNode;
|
|
431
|
+
}
|
|
432
|
+
interface SelectOptionRenderState {
|
|
433
|
+
/** Whether the option is currently selected */
|
|
434
|
+
selected: boolean;
|
|
435
|
+
/** Whether the option is disabled */
|
|
436
|
+
disabled?: boolean;
|
|
437
|
+
/** Select handler to trigger when clicking the custom option */
|
|
438
|
+
handleSelect: () => void;
|
|
439
|
+
/** Index in the current visible list */
|
|
440
|
+
index: number;
|
|
441
|
+
}
|
|
442
|
+
interface SelectContentRenderState {
|
|
443
|
+
/** Original options array passed to the component */
|
|
444
|
+
options: SelectOption[];
|
|
445
|
+
/** Options after filtering (or external options when onSearchChange is used) */
|
|
446
|
+
filteredOptions: SelectOption[];
|
|
447
|
+
/** Currently visible items slice */
|
|
448
|
+
visibleOptions: SelectOption[];
|
|
449
|
+
/** Whether there are more items to load in the virtual window */
|
|
450
|
+
hasMore: boolean;
|
|
451
|
+
/** Ref to attach to a sentinel element for progressive loading */
|
|
452
|
+
sentinelRef: React$1.RefObject<HTMLDivElement | null>;
|
|
453
|
+
/** Controlled/uncontrolled current value */
|
|
454
|
+
currentValue?: string;
|
|
455
|
+
/** Selected option object */
|
|
456
|
+
selectedOption?: SelectOption;
|
|
457
|
+
/** Current search query string */
|
|
458
|
+
searchQuery: string;
|
|
459
|
+
/** Callback to select an option and close menu */
|
|
460
|
+
handleSelect: (option: SelectOption) => void;
|
|
461
|
+
/** Empty state text */
|
|
462
|
+
emptyText: string;
|
|
463
|
+
/** Whether loading state is active */
|
|
464
|
+
loading?: boolean;
|
|
465
|
+
}
|
|
466
|
+
interface SelectProps extends Omit<TextFieldProps, "value" | "onChange" | "defaultValue" | "type" | "multiline" | "children"> {
|
|
467
|
+
/** Array of selectable options */
|
|
468
|
+
options: SelectOption[];
|
|
469
|
+
/** Controlled selected value */
|
|
470
|
+
value?: string;
|
|
471
|
+
/** Default selected value (uncontrolled) */
|
|
472
|
+
defaultValue?: string;
|
|
473
|
+
/** Callback fired when selection changes */
|
|
474
|
+
onChange?: (value: string, option?: SelectOption) => void;
|
|
475
|
+
/**
|
|
476
|
+
* Callback fired when search query changes in searchable mode.
|
|
477
|
+
* When provided, INTERNAL filtering is disabled — pass filtered `options` from outside (for server-side/async search).
|
|
478
|
+
*/
|
|
479
|
+
onSearchChange?: (query: string) => void;
|
|
480
|
+
/** Enable autocomplete mode (input filtering real-time search) */
|
|
481
|
+
searchable?: boolean;
|
|
482
|
+
/** Whether data is loading (displays a spinner inside the dropdown) */
|
|
483
|
+
loading?: boolean;
|
|
484
|
+
/** Maximum number of items rendered per chunk in virtual window (default: 50) */
|
|
485
|
+
maxVisible?: number;
|
|
486
|
+
/** Custom placeholder when no option is selected or when searching */
|
|
487
|
+
placeholder?: string;
|
|
488
|
+
/** Label text for the input field */
|
|
489
|
+
label?: string;
|
|
490
|
+
/** Supporting text below the input field */
|
|
491
|
+
supportingText?: string;
|
|
492
|
+
/** Color variant for the dropdown menu ('standard' | 'vibrant') */
|
|
493
|
+
colorVariant?: MenuColorVariant;
|
|
494
|
+
/** Menu visual variant ('expressive' | 'baseline') */
|
|
495
|
+
menuVariant?: MenuVariant;
|
|
496
|
+
/**
|
|
497
|
+
* Whether to show divider lines between menu options.
|
|
498
|
+
* Default: true
|
|
499
|
+
*/
|
|
500
|
+
showDividers?: boolean;
|
|
501
|
+
/**
|
|
502
|
+
* Separation style between menu options ('divider' | 'gap' | 'none').
|
|
503
|
+
* Overrides `showDividers` when explicitly specified.
|
|
504
|
+
* Default: 'divider' (or 'none' if showDividers={false})
|
|
505
|
+
*/
|
|
506
|
+
separatorStyle?: VerticalMenuSeparatorStyle;
|
|
507
|
+
/** Custom empty state message when searchable mode yields no results */
|
|
508
|
+
emptyText?: string;
|
|
509
|
+
/** Whether the popup menu automatically matches the input width. Default: true */
|
|
510
|
+
matchTriggerWidth?: boolean;
|
|
511
|
+
/**
|
|
512
|
+
* Maximum height of the dropdown options list before scrolling.
|
|
513
|
+
* Default: "360px"
|
|
514
|
+
*/
|
|
515
|
+
maxHeight?: string;
|
|
516
|
+
/** Additional class names for the root container */
|
|
517
|
+
className?: string;
|
|
518
|
+
/** Custom renderer for individual option items */
|
|
519
|
+
renderOption?: (option: SelectOption, state: SelectOptionRenderState) => React$1.ReactNode;
|
|
520
|
+
/** Custom renderer for the dropdown content (e.g. for custom virtual list libraries like TanStack Virtual) */
|
|
521
|
+
renderContent?: (state: SelectContentRenderState) => React$1.ReactNode;
|
|
522
|
+
/** Custom children to render inside MenuContent if fully overriding options */
|
|
523
|
+
children?: React$1.ReactNode;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* M3 Expressive Select component (Exposed Dropdown Menu & Autocomplete).
|
|
528
|
+
*
|
|
529
|
+
* Implements Material 3 Exposed Dropdown Menu spec (Figma Node `58966:3961`).
|
|
530
|
+
* Features progressive slice virtualization and server-side/async search via `onSearchChange`.
|
|
531
|
+
*
|
|
532
|
+
* @example
|
|
533
|
+
* // Standard Exposed Dropdown Menu
|
|
534
|
+
* <Select
|
|
535
|
+
* label="City"
|
|
536
|
+
* options={[
|
|
537
|
+
* { label: "Hanoi", value: "hn" },
|
|
538
|
+
* { label: "Ho Chi Minh City", value: "hcm" }
|
|
539
|
+
* ]}
|
|
540
|
+
* value={city}
|
|
541
|
+
* onChange={(val) => setCity(val)}
|
|
542
|
+
* />
|
|
543
|
+
*
|
|
544
|
+
* @example
|
|
545
|
+
* // Searchable Autocomplete (Local filtering)
|
|
546
|
+
* <Select
|
|
547
|
+
* searchable
|
|
548
|
+
* label="Search Employee"
|
|
549
|
+
* options={userList}
|
|
550
|
+
* onChange={(val, opt) => setSelected(opt)}
|
|
551
|
+
* />
|
|
552
|
+
*
|
|
553
|
+
* @example
|
|
554
|
+
* // Searchable Autocomplete (Async / Server-side search)
|
|
555
|
+
* <Select
|
|
556
|
+
* searchable
|
|
557
|
+
* loading={isLoading}
|
|
558
|
+
* label="Search Countries"
|
|
559
|
+
* options={searchResults}
|
|
560
|
+
* onSearchChange={(query) => fetchCountries(query)}
|
|
561
|
+
* onChange={(val, opt) => setSelectedCountry(opt)}
|
|
562
|
+
* />
|
|
563
|
+
*/
|
|
564
|
+
declare const Select: React$1.ForwardRefExoticComponent<Omit<SelectProps, "ref"> & React$1.RefAttributes<TextFieldHandle>>;
|
|
565
|
+
|
|
416
566
|
/**
|
|
417
567
|
* @file slider.types.ts
|
|
418
568
|
* MD3 Expressive Slider — TypeScript prop definitions.
|
|
@@ -1043,4 +1193,4 @@ declare const SwitchColors: {
|
|
|
1043
1193
|
*/
|
|
1044
1194
|
declare const TextField: React$1.NamedExoticComponent<Omit<TextFieldProps, "ref"> & React$1.RefAttributes<TextFieldHandle>>;
|
|
1045
1195
|
|
|
1046
|
-
export {
|
|
1196
|
+
export { type TextFieldInputType as A, type TextFieldProps as B, Checkbox as C, type TextFieldTrailingIconMode as D, type TextFieldVariant as E, TriStateCheckbox as F, type TriStateCheckboxProps as G, type SliderThumbProps as H, RadioButton as R, Select as S, TextField as T, type CheckboxProps as a, type CheckboxState as b, Chip as c, type ChipProps as d, type RadioButtonColors as e, type RadioButtonProps as f, RadioGroup as g, type RadioGroupProps as h, RangeSlider as i, type RangeSliderProps as j, type SelectContentRenderState as k, type SelectOption as l, type SelectOptionRenderState as m, type SelectProps as n, Slider as o, SliderColors as p, type SliderOrientation as q, type SliderProps as r, SliderTokens as s, type SliderTrackSize as t, type SliderVariant as u, Switch as v, SwitchColors as w, type SwitchProps as x, SwitchTokens as y, type TextFieldHandle as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bug-on/m3-expressive",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Material Design 3 Expressive React components",
|
|
5
5
|
"author": "Bug On",
|
|
6
6
|
"license": "MIT",
|
|
@@ -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-
|
|
183
|
-
"@bug-on/m3-
|
|
182
|
+
"@bug-on/m3-tailwind": "1.2.2",
|
|
183
|
+
"@bug-on/m3-tokens": "1.2.2"
|
|
184
184
|
},
|
|
185
185
|
"devDependencies": {
|
|
186
186
|
"@testing-library/jest-dom": "^6.9.1",
|