material 3.15.1 → 3.15.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/README.md +2 -2
- package/dist/components/bottom-sheet/features/state.js +27 -0
- package/dist/components/card/index.d.ts +35 -35
- package/dist/components/dialog/features.js +4 -0
- package/dist/components/divider/features.js +6 -3
- package/dist/components/divider/index.d.ts +8 -8
- package/dist/components/drawer/index.d.ts +6 -6
- package/dist/components/fab-menu/index.d.ts +6 -6
- package/dist/components/list/index.d.ts +6 -6
- package/dist/components/listbox/index.d.ts +6 -6
- package/dist/components/loading-indicator/index.d.ts +6 -6
- package/dist/components/snackbar/api.js +3 -0
- package/dist/components/snackbar/index.d.ts +9 -9
- package/dist/components/tabs/index.d.ts +90 -90
- package/dist/components/text-field/index.d.ts +6 -6
- package/dist/components/tooltip/api.js +51 -7
- package/dist/core/canvas/index.d.ts +22 -22
- package/dist/core/compose/index.d.ts +478 -478
- package/dist/core/dom/index.d.ts +47 -47
- package/dist/core/shapes/index.d.ts +61 -61
- package/dist/core/theme/index.d.ts +6 -6
- package/dist/core/utils/index.d.ts +27 -27
- package/dist/elements/css/badge.css +1 -1
- package/dist/elements/css/bottom-app-bar.css +1 -1
- package/dist/elements/css/navigation-bar.css +1 -1
- package/dist/elements/css/side-sheet.css +1 -1
- package/dist/elements/css/text-field.css +1 -1
- package/dist/elements/css/toolbar.css +1 -1
- package/dist/elements/css/tooltip.css +1 -1
- package/dist/elements/css/top-app-bar.css +1 -1
- package/dist/elements/index.d.ts +2226 -2226
- package/dist/elements/preupgrade/badge.css +2 -2
- package/dist/elements/preupgrade/bottom-app-bar.css +1 -1
- package/dist/elements/preupgrade/bottom-sheet.css +1 -1
- package/dist/elements/preupgrade/button-group.css +1 -1
- package/dist/elements/preupgrade/button.css +1 -1
- package/dist/elements/preupgrade/card.css +1 -1
- package/dist/elements/preupgrade/carousel.css +1 -1
- package/dist/elements/preupgrade/checkbox.css +1 -1
- package/dist/elements/preupgrade/chips.css +1 -1
- package/dist/elements/preupgrade/datepicker.css +1 -1
- package/dist/elements/preupgrade/dialog.css +1 -1
- package/dist/elements/preupgrade/divider.css +1 -1
- package/dist/elements/preupgrade/drawer.css +1 -1
- package/dist/elements/preupgrade/extended-fab.css +1 -1
- package/dist/elements/preupgrade/fab-menu.css +1 -1
- package/dist/elements/preupgrade/fab.css +1 -1
- package/dist/elements/preupgrade/icon-button.css +1 -1
- package/dist/elements/preupgrade/list.css +1 -1
- package/dist/elements/preupgrade/loading-indicator.css +1 -1
- package/dist/elements/preupgrade/menu.css +1 -1
- package/dist/elements/preupgrade/navigation-bar.css +1 -1
- package/dist/elements/preupgrade/navigation-rail.css +1 -1
- package/dist/elements/preupgrade/progress.css +1 -1
- package/dist/elements/preupgrade/radios.css +1 -1
- package/dist/elements/preupgrade/search.css +1 -1
- package/dist/elements/preupgrade/select.css +1 -1
- package/dist/elements/preupgrade/side-sheet.css +1 -1
- package/dist/elements/preupgrade/slider.css +1 -1
- package/dist/elements/preupgrade/snackbar.css +1 -1
- package/dist/elements/preupgrade/split-button.css +1 -1
- package/dist/elements/preupgrade/switch.css +1 -1
- package/dist/elements/preupgrade/tabs.css +1 -1
- package/dist/elements/preupgrade/text-field.css +1 -1
- package/dist/elements/preupgrade/timepicker.css +1 -1
- package/dist/elements/preupgrade/toolbar.css +1 -1
- package/dist/elements/preupgrade/tooltip.css +1 -1
- package/dist/elements/preupgrade/top-app-bar.css +1 -1
- package/dist/elements/preupgrade.css +2 -2
- package/dist/elements/styles.js +9 -9
- package/dist/elements/top-app-bar.js +11 -1
- package/dist/react/index.d.ts +50 -50
- package/dist/solid/index.d.ts +50 -50
- package/dist/styles/badge.css +2 -2
- package/dist/styles/base-elements.css +1 -1
- package/dist/styles/base-lite.css +1 -1
- package/dist/styles/base.css +1 -1
- package/dist/styles/bottom-app-bar-toolbar.css +2 -2
- package/dist/styles/bottom-app-bar.css +2 -2
- package/dist/styles/bottom-sheet.css +1 -1
- package/dist/styles/button-filled-small-round.css +1 -1
- package/dist/styles/button-group.css +1 -1
- package/dist/styles/button.css +1 -1
- package/dist/styles/card.css +1 -1
- package/dist/styles/carousel.css +1 -1
- package/dist/styles/checkbox.css +1 -1
- package/dist/styles/chips.css +1 -1
- package/dist/styles/contrast.css +1 -1
- package/dist/styles/datepicker.css +1 -1
- package/dist/styles/dialog.css +1 -1
- package/dist/styles/divider.css +1 -1
- package/dist/styles/drawer.css +1 -1
- package/dist/styles/extended-fab.css +1 -1
- package/dist/styles/fab-menu.css +1 -1
- package/dist/styles/fab.css +1 -1
- package/dist/styles/icon-button.css +1 -1
- package/dist/styles/list.css +1 -1
- package/dist/styles/listbox.css +1 -1
- package/dist/styles/loading-indicator.css +1 -1
- package/dist/styles/menu.css +1 -1
- package/dist/styles/navigation-bar.css +2 -2
- package/dist/styles/navigation-rail.css +1 -1
- package/dist/styles/progress.css +1 -1
- package/dist/styles/radios.css +1 -1
- package/dist/styles/search.css +1 -1
- package/dist/styles/select.css +1 -1
- package/dist/styles/side-sheet.css +2 -2
- package/dist/styles/slider.css +1 -1
- package/dist/styles/snackbar.css +1 -1
- package/dist/styles/split-button.css +1 -1
- package/dist/styles/switch.css +1 -1
- package/dist/styles/tabs.css +1 -1
- package/dist/styles/text-field.css +2 -2
- package/dist/styles/timepicker.css +1 -1
- package/dist/styles/toolbar.css +2 -2
- package/dist/styles/tooltip.css +2 -2
- package/dist/styles/top-app-bar.css +2 -2
- package/dist/styles/typography.css +1 -1
- package/dist/styles/utilities.css +1 -1
- package/dist/styles.css +2 -2
- package/dist/themes/autumn-contrast.css +1 -1
- package/dist/themes/autumn.css +1 -1
- package/dist/themes/baseline-contrast.css +1 -1
- package/dist/themes/baseline.css +1 -1
- package/dist/themes/brownbeige-contrast.css +1 -1
- package/dist/themes/brownbeige.css +1 -1
- package/dist/themes/content-contrast.css +1 -1
- package/dist/themes/content.css +1 -1
- package/dist/themes/desert-contrast.css +1 -1
- package/dist/themes/desert.css +1 -1
- package/dist/themes/expressive-contrast.css +1 -1
- package/dist/themes/expressive.css +1 -1
- package/dist/themes/fidelity-contrast.css +1 -1
- package/dist/themes/fidelity.css +1 -1
- package/dist/themes/forest-contrast.css +1 -1
- package/dist/themes/forest.css +1 -1
- package/dist/themes/fruit-salad-contrast.css +1 -1
- package/dist/themes/fruit-salad.css +1 -1
- package/dist/themes/highcontrast-contrast.css +1 -1
- package/dist/themes/highcontrast.css +1 -1
- package/dist/themes/monochrome-contrast.css +1 -1
- package/dist/themes/monochrome.css +1 -1
- package/dist/themes/neutral-contrast.css +1 -1
- package/dist/themes/neutral.css +1 -1
- package/dist/themes/ocean-contrast.css +1 -1
- package/dist/themes/ocean.css +1 -1
- package/dist/themes/rainbow-contrast.css +1 -1
- package/dist/themes/rainbow.css +1 -1
- package/dist/themes/sageivory-contrast.css +1 -1
- package/dist/themes/sageivory.css +1 -1
- package/dist/themes/spring-contrast.css +1 -1
- package/dist/themes/spring.css +1 -1
- package/dist/themes/summer-contrast.css +1 -1
- package/dist/themes/summer.css +1 -1
- package/dist/themes/sunset-contrast.css +1 -1
- package/dist/themes/sunset.css +1 -1
- package/dist/themes/tealcaramel-contrast.css +1 -1
- package/dist/themes/tealcaramel.css +1 -1
- package/dist/themes/vibrant-contrast.css +1 -1
- package/dist/themes/vibrant.css +1 -1
- package/dist/tokens/catalogue.json +3 -3
- package/dist/vue/index.d.ts +50 -50
- package/package.json +1 -1
- package/src/styles/base/_plain-slot-button.scss +67 -0
- package/src/styles/components/_badge.scss +1 -3
- package/src/styles/components/_bottom-app-bar.scss +6 -0
- package/src/styles/components/_navigation-bar.scss +1 -2
- package/src/styles/components/_side-sheet.scss +6 -0
- package/src/styles/components/_text-field.scss +8 -0
- package/src/styles/components/_toolbar.scss +1 -0
- package/src/styles/components/_tooltip.scss +5 -2
- package/src/styles/components/_top-app-bar.scss +21 -12
- package/src/styles/elements/_badge.scss +5 -3
package/README.md
CHANGED
|
@@ -138,11 +138,11 @@ What a bundler keeps, minified and gzipped (kB is 1,000 bytes), measured from th
|
|
|
138
138
|
| `createButton` from `material`, with code splitting: the initial chunks (the progress indicator loads on demand) | 7.5 kB |
|
|
139
139
|
| `createButton`, without code splitting (the progress indicator included) | 13.9 kB |
|
|
140
140
|
| `createButton`, `createTextField` and `createCheckbox`, without code splitting | 20.3 kB |
|
|
141
|
-
| Everything the root exports (`export * from 'material'`), without code splitting | 131.
|
|
141
|
+
| Everything the root exports (`export * from 'material'`), without code splitting | 131.7 kB |
|
|
142
142
|
| `material/styles/base` | 3.1 kB |
|
|
143
143
|
| `material/styles/base-lite` | 1.7 kB |
|
|
144
144
|
| `material/styles/base` and `material/styles/button` | 5.4 kB |
|
|
145
|
-
| `material/styles`, the full stylesheet |
|
|
145
|
+
| `material/styles`, the full stylesheet | 60.1 kB |
|
|
146
146
|
<!-- /sizes -->
|
|
147
147
|
|
|
148
148
|
`material` publishes ESM only, so bundlers drop what you do not import. Each component's page on [md3.io/components](https://md3.io/components/) gives its size.
|
|
@@ -39,12 +39,30 @@ const open = next !== BOTTOM_SHEET_STATES.HIDDEN;
|
|
|
39
39
|
element.setAttribute("aria-hidden", open ? "false" : "true");
|
|
40
40
|
element.style.pointerEvents = open ? "" : "none";
|
|
41
41
|
};
|
|
42
|
+
const fullHeight = `${root}--full-height`;
|
|
43
|
+
const syncFullHeight = () => {
|
|
44
|
+
const box = structure.container;
|
|
45
|
+
element.classList.toggle(fullHeight, state === BOTTOM_SHEET_STATES.EXPANDED && box.offsetHeight > 0 && box.offsetTop < 1);
|
|
46
|
+
};
|
|
47
|
+
const placeContent = structure.setContent;
|
|
48
|
+
structure.setContent = (next) => {
|
|
49
|
+
placeContent(next);
|
|
50
|
+
syncFullHeight();
|
|
51
|
+
};
|
|
52
|
+
const boxObserver = typeof ResizeObserver === "function"
|
|
53
|
+
? new ResizeObserver(() => {
|
|
54
|
+
if (state === BOTTOM_SHEET_STATES.EXPANDED)
|
|
55
|
+
syncFullHeight();
|
|
56
|
+
})
|
|
57
|
+
: null;
|
|
58
|
+
boxObserver?.observe(structure.container);
|
|
42
59
|
const setState = (next) => {
|
|
43
60
|
if (next === state)
|
|
44
61
|
return;
|
|
45
62
|
const previous = state;
|
|
46
63
|
state = next;
|
|
47
64
|
applyState(next);
|
|
65
|
+
syncFullHeight();
|
|
48
66
|
component.emit(BOTTOM_SHEET_EVENTS.STATE_CHANGE, { state: next, previous });
|
|
49
67
|
};
|
|
50
68
|
const handleKeydown = (event) => {
|
|
@@ -95,8 +113,15 @@ previouslyFocused = null;
|
|
|
95
113
|
component.emit(BOTTOM_SHEET_EVENTS.CLOSE);
|
|
96
114
|
}
|
|
97
115
|
applyState(state);
|
|
116
|
+
syncFullHeight();
|
|
98
117
|
if (state !== BOTTOM_SHEET_STATES.HIDDEN)
|
|
99
118
|
onStack(true);
|
|
119
|
+
const onResize = () => {
|
|
120
|
+
if (state === BOTTOM_SHEET_STATES.EXPANDED)
|
|
121
|
+
syncFullHeight();
|
|
122
|
+
};
|
|
123
|
+
const view = element.ownerDocument.defaultView;
|
|
124
|
+
view?.addEventListener("resize", onResize);
|
|
100
125
|
let stopCloses = null;
|
|
101
126
|
if (top) {
|
|
102
127
|
element.addEventListener("click", handleScrimClick);
|
|
@@ -121,6 +146,8 @@ isOpen: () => state !== BOTTOM_SHEET_STATES.HIDDEN,
|
|
|
121
146
|
getState: () => state,
|
|
122
147
|
setState,
|
|
123
148
|
release: () => {
|
|
149
|
+
boxObserver?.disconnect();
|
|
150
|
+
view?.removeEventListener("resize", onResize);
|
|
124
151
|
document.removeEventListener("keydown", handleKeydown);
|
|
125
152
|
structure.scrim?.removeEventListener("click", handleScrimClick);
|
|
126
153
|
element.removeEventListener("click", handleScrimClick);
|
|
@@ -2,6 +2,41 @@ import type { ForwardedEventPayload } from "../../core/dom/index.js";
|
|
|
2
2
|
import type { TouchEvents } from "../../core/utils/mobile.js";
|
|
3
3
|
import type { ButtonConfig as BaseButtonConfig } from "../button/types.js";
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new Card component following Material Design 3 principles.
|
|
7
|
+
* @param config
|
|
8
|
+
*/
|
|
9
|
+
declare const createCard: (config?: CardConfig) => CardComponent;
|
|
10
|
+
|
|
11
|
+
declare const CARD_CONTENT_PADDING = true;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Creates a card content component
|
|
15
|
+
* @param config
|
|
16
|
+
*/
|
|
17
|
+
declare const createCardContent: (config?: CardContentConfig) => HTMLElement;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Creates a card header component
|
|
21
|
+
* @param config
|
|
22
|
+
*/
|
|
23
|
+
declare const createCardHeader: (config?: CardHeaderConfig) => HTMLElement;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Creates a card actions component
|
|
27
|
+
* @param config
|
|
28
|
+
*/
|
|
29
|
+
declare const createCardActions: (config?: CardActionsConfig) => HTMLElement;
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
declare const NESTED_ACTION_SELECTOR = "button,a[href],input,select,textarea,m-button,m-icon-button,[role=button],[role=link],slot[name=actions],slot[name=header-action]";
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Creates a card media component
|
|
36
|
+
* @param config
|
|
37
|
+
*/
|
|
38
|
+
declare const createCardMedia: (config?: CardMediaConfig) => HTMLElement;
|
|
39
|
+
|
|
5
40
|
/** Card variant types following Material Design 3 guidelines. */
|
|
6
41
|
type CardVariant = 'elevated' | 'filled' | 'outlined';
|
|
7
42
|
|
|
@@ -292,40 +327,5 @@ declare module "../../core/config/global" {
|
|
|
292
327
|
card?: Partial<CardConfig>;
|
|
293
328
|
}
|
|
294
329
|
}
|
|
295
|
-
|
|
296
|
-
declare const CARD_CONTENT_PADDING = true;
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Creates a card content component
|
|
300
|
-
* @param config
|
|
301
|
-
*/
|
|
302
|
-
declare const createCardContent: (config?: CardContentConfig) => HTMLElement;
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* Creates a card header component
|
|
306
|
-
* @param config
|
|
307
|
-
*/
|
|
308
|
-
declare const createCardHeader: (config?: CardHeaderConfig) => HTMLElement;
|
|
309
|
-
|
|
310
|
-
/**
|
|
311
|
-
* Creates a card actions component
|
|
312
|
-
* @param config
|
|
313
|
-
*/
|
|
314
|
-
declare const createCardActions: (config?: CardActionsConfig) => HTMLElement;
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
declare const NESTED_ACTION_SELECTOR = "button,a[href],input,select,textarea,m-button,m-icon-button,[role=button],[role=link],slot[name=actions],slot[name=header-action]";
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* Creates a card media component
|
|
321
|
-
* @param config
|
|
322
|
-
*/
|
|
323
|
-
declare const createCardMedia: (config?: CardMediaConfig) => HTMLElement;
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* Creates a new Card component following Material Design 3 principles.
|
|
327
|
-
* @param config
|
|
328
|
-
*/
|
|
329
|
-
declare const createCard: (config?: CardConfig) => CardComponent;
|
|
330
330
|
export type { CardActionsConfig, CardAriaAttributes, CardComponent, CardConfig, CardContentConfig, CardElevationLevel, CardEvents, CardHeaderConfig, CardMediaConfig, CardVariant };
|
|
331
331
|
export { createCard, createCard as default, createCardActions, createCardContent, createCardHeader, createCardMedia };
|
|
@@ -93,6 +93,7 @@ const footer = Array.isArray(config.buttons) && config.buttons.length > 0
|
|
|
93
93
|
? createFooter()
|
|
94
94
|
: null;
|
|
95
95
|
addClass(component.element, component.getClass("dialog"));
|
|
96
|
+
component.element.inert = true;
|
|
96
97
|
if (config.title) {
|
|
97
98
|
component.element.setAttribute("aria-labelledby", titleId);
|
|
98
99
|
}
|
|
@@ -426,6 +427,7 @@ const dialogVisibleClass = `${component.getClass("dialog")}--visible`;
|
|
|
426
427
|
const overlayVisibleClass = `${component.getClass("dialog__overlay")}--visible`;
|
|
427
428
|
scopeScrim();
|
|
428
429
|
if (isOpen) {
|
|
430
|
+
component.element.inert = false;
|
|
429
431
|
if (top)
|
|
430
432
|
showModal();
|
|
431
433
|
addClass(component.overlay, overlayVisibleClass);
|
|
@@ -441,6 +443,7 @@ previouslyFocusedElement = deepActiveElement();
|
|
|
441
443
|
if (ask(DIALOG_EVENTS.BEFORE_OPEN))
|
|
442
444
|
return;
|
|
443
445
|
opened = true;
|
|
446
|
+
component.element.inert = false;
|
|
444
447
|
clearTimeout(afterCloseTimer);
|
|
445
448
|
afterOpenWaiting = false;
|
|
446
449
|
focusPending = false;
|
|
@@ -485,6 +488,7 @@ return;
|
|
|
485
488
|
stopOpen();
|
|
486
489
|
removeClass(component.element, dialogVisibleClass);
|
|
487
490
|
removeClass(component.overlay, overlayVisibleClass);
|
|
491
|
+
component.element.inert = true;
|
|
488
492
|
if (top)
|
|
489
493
|
hideFromTopLayer(component.element);
|
|
490
494
|
releaseFocus();
|
|
@@ -21,14 +21,17 @@ const cross = horizontal ? 'height' : 'width';
|
|
|
21
21
|
const main = horizontal ? 'width' : 'height';
|
|
22
22
|
style[cross] = `${thickness}px`;
|
|
23
23
|
style[main] = '100%';
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
const explicit = config.insetStart !== undefined || config.insetEnd !== undefined;
|
|
25
|
+
if (variant !== 'full-width' || explicit) {
|
|
26
|
+
const insetStart = config.insetStart !== undefined
|
|
27
|
+
? config.insetStart
|
|
28
|
+
: (variant === 'full-width' ? 0 : DEFAULT_INSET);
|
|
26
29
|
const insetEnd = config.insetEnd !== undefined
|
|
27
30
|
? config.insetEnd
|
|
28
31
|
: (variant === 'middle-inset' ? DEFAULT_INSET : 0);
|
|
29
32
|
style[horizontal ? 'marginInlineStart' : 'marginBlockStart'] = `${insetStart}px`;
|
|
30
33
|
style[horizontal ? 'marginInlineEnd' : 'marginBlockEnd'] = `${insetEnd}px`;
|
|
31
|
-
style[main] =
|
|
34
|
+
style[main] = `calc(100% - ${insetStart + insetEnd}px)`;
|
|
32
35
|
}
|
|
33
36
|
};
|
|
34
37
|
export const withOrientation = (config) => (component) => {
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import { BaseComponent, ElementComponent } from "../../core/compose/index.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Creates a new Divider component with the specified configuration.
|
|
5
|
-
* @param config
|
|
6
|
-
*/
|
|
7
|
-
declare const createDivider: (config?: DividerConfig) => DividerComponent;
|
|
8
2
|
/** Configuration options for divider components Controls the appearance, orientation, and behavior of Material Design 3 dividers. */
|
|
9
3
|
interface DividerConfig {
|
|
10
4
|
/** CSS class prefix (defaults to 'mtrl') */
|
|
@@ -23,12 +17,12 @@ interface DividerConfig {
|
|
|
23
17
|
variant?: 'full-width' | 'inset' | 'middle-inset';
|
|
24
18
|
/**
|
|
25
19
|
* Custom inset value (left margin for horizontal, top margin for vertical) Overrides the default inset spacing at the start of the divider.
|
|
26
|
-
* @default 16 for 'inset' and 'middle-inset' variants
|
|
20
|
+
* @default 16 for 'inset' and 'middle-inset' variants, 0 for full-width
|
|
27
21
|
*/
|
|
28
22
|
insetStart?: number;
|
|
29
23
|
/**
|
|
30
24
|
* Custom inset end value (right margin for horizontal, bottom margin for vertical) Overrides the default inset spacing at the end of the divider.
|
|
31
|
-
* @default 0 for 'inset', 16 for 'middle-inset'
|
|
25
|
+
* @default 0 for 'inset' and full-width, 16 for 'middle-inset'
|
|
32
26
|
*/
|
|
33
27
|
insetEnd?: number;
|
|
34
28
|
/** Color of the divider Sets a custom color for the divider. */
|
|
@@ -48,6 +42,12 @@ declare const defaultConfig: Partial<DividerConfig>;
|
|
|
48
42
|
|
|
49
43
|
declare const createBaseConfig: (config?: DividerConfig) => DividerConfig;
|
|
50
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Creates a new Divider component with the specified configuration.
|
|
47
|
+
* @param config
|
|
48
|
+
*/
|
|
49
|
+
declare const createDivider: (config?: DividerConfig) => DividerComponent;
|
|
50
|
+
|
|
51
51
|
/** The three slices of a divider, one per enhancer in features.ts. */
|
|
52
52
|
interface DividerOrientation {
|
|
53
53
|
/** Gets current orientation of the divider */
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { BaseComponentConfig } from "../../core/config/component.js";
|
|
2
2
|
import type { ForwardedEventPayload } from "../../core/dom/index.js";
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Creates a new Drawer component with the specified configuration.
|
|
6
|
+
* @param config
|
|
7
|
+
*/
|
|
8
|
+
declare const createDrawer: (config?: DrawerConfig) => DrawerComponent;
|
|
9
|
+
|
|
4
10
|
/** Drawer variant type — controls layout behavior */
|
|
5
11
|
type DrawerVariant = "standard" | "modal";
|
|
6
12
|
|
|
@@ -186,11 +192,5 @@ interface DrawerComponent {
|
|
|
186
192
|
destroy: () => void;
|
|
187
193
|
};
|
|
188
194
|
}
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Creates a new Drawer component with the specified configuration.
|
|
192
|
-
* @param config
|
|
193
|
-
*/
|
|
194
|
-
declare const createDrawer: (config?: DrawerConfig) => DrawerComponent;
|
|
195
195
|
export type { DrawerComponent, DrawerConfig, DrawerEvents, DrawerItemConfig, DrawerPosition, DrawerSelectEvent, DrawerVariant };
|
|
196
196
|
export { createDrawer, createDrawer as default };
|
|
@@ -2,6 +2,12 @@ import type { ElementComponent } from "../../core/compose/index.js";
|
|
|
2
2
|
import type { BaseComponentConfig } from "../../core/config/component.js";
|
|
3
3
|
import type { FabMenuColor, FabMenuPlacement, FabMenuPresentation, FabMenuSize } from "./constants.js";
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Creates a FAB menu: M3 Expressive's FAB that opens a list of related actions.
|
|
7
|
+
* @param config
|
|
8
|
+
*/
|
|
9
|
+
declare const createFabMenu: (config: FabMenuConfig) => FabMenuComponent;
|
|
10
|
+
|
|
5
11
|
/** An action of the menu */
|
|
6
12
|
interface FabMenuItem {
|
|
7
13
|
/** Identifies the item in `select` */
|
|
@@ -101,12 +107,6 @@ declare module "../../core/config/global" {
|
|
|
101
107
|
"fab-menu"?: Partial<FabMenuConfig>;
|
|
102
108
|
}
|
|
103
109
|
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Creates a FAB menu: M3 Expressive's FAB that opens a list of related actions.
|
|
107
|
-
* @param config
|
|
108
|
-
*/
|
|
109
|
-
declare const createFabMenu: (config: FabMenuConfig) => FabMenuComponent;
|
|
110
110
|
export type { FabMenuComponent, FabMenuConfig, FabMenuEvents, FabMenuItem, FabMenuMenu };
|
|
111
111
|
export { createFabMenu, createFabMenu as default };
|
|
112
112
|
export type { FabMenuColor, FabMenuPlacement, FabMenuPresentation, FabMenuSize } from "./constants.js";
|
|
@@ -16,6 +16,12 @@ interface SingleSelectListboxOptions {
|
|
|
16
16
|
*/
|
|
17
17
|
declare const withSingleSelectListbox: (component: ListComponent<ListItem>, options?: SingleSelectListboxOptions) => ListComponent<ListItem>;
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Creates a new List component The List component provides a simple way to render static arrays of data with Material item anatomy and built-in selection capabilities.
|
|
21
|
+
* @param config
|
|
22
|
+
*/
|
|
23
|
+
declare const createList: (config?: Partial<ListConfig<ListItem>>) => ListComponent<ListItem>;
|
|
24
|
+
|
|
19
25
|
/** List variant types following Material Design 3 guidelines. */
|
|
20
26
|
type ListVariant = 'standard' | 'segmented';
|
|
21
27
|
|
|
@@ -288,12 +294,6 @@ interface ListEvents<T = unknown> {
|
|
|
288
294
|
scroll: (event: ForwardedEventPayload<Event, HTMLElement>) => void;
|
|
289
295
|
keydown: (event: ForwardedEventPayload<KeyboardEvent, HTMLElement>) => void;
|
|
290
296
|
}
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Creates a new List component The List component provides a simple way to render static arrays of data with Material item anatomy and built-in selection capabilities.
|
|
294
|
-
* @param config
|
|
295
|
-
*/
|
|
296
|
-
declare const createList: (config?: Partial<ListConfig<ListItem>>) => ListComponent<ListItem>;
|
|
297
297
|
export type { ListComponent, ListConfig, ListItem, ListSlot, ListVariant, LoadEvent, SelectEvent, SingleSelectListboxOptions };
|
|
298
298
|
export { createList, createList as default, withSingleSelectListbox };
|
|
299
299
|
export { LIST_CLASSES, LIST_DEFAULTS, LIST_EVENTS, LIST_SCROLL_POSITIONS, LIST_SELECTION_MODES, LIST_TYPES, LIST_VARIANTS } from "./constants.js";
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* Creates a listbox handle on a dedicated control.
|
|
4
|
+
* @param config
|
|
5
|
+
*/
|
|
6
|
+
declare function createListbox<T = unknown>(config: ListboxConfig<T>): ListboxComponent<T>;
|
|
1
7
|
/** The lean selection popup's public types. */
|
|
2
8
|
/** One option of a listbox. */
|
|
3
9
|
interface ListboxOption<T = unknown> {
|
|
@@ -90,11 +96,5 @@ interface ListboxComponent<T = unknown> {
|
|
|
90
96
|
/** Idempotent and terminal. */
|
|
91
97
|
destroy: () => void;
|
|
92
98
|
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Creates a listbox handle on a dedicated control.
|
|
96
|
-
* @param config
|
|
97
|
-
*/
|
|
98
|
-
declare function createListbox<T = unknown>(config: ListboxConfig<T>): ListboxComponent<T>;
|
|
99
99
|
export type { ListboxChangeDetail, ListboxComponent, ListboxConfig, ListboxEventDetail, ListboxEventHandlers, ListboxEvents, ListboxOption };
|
|
100
100
|
export { createListbox, createListbox as default };
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { MaterialShapeName, RadialProfile } from "../../core/shapes/index.js";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Creates a loading indicator: the Material 3 expressive shape morph for waits under about five seconds.
|
|
5
|
-
* @param config
|
|
6
|
-
*/
|
|
7
|
-
declare const createLoadingIndicator: (config?: LoadingIndicatorConfig) => LoadingIndicatorComponent;
|
|
8
|
-
|
|
9
3
|
|
|
10
4
|
interface Frame {
|
|
11
5
|
|
|
@@ -32,6 +26,12 @@ interface Renderer {
|
|
|
32
26
|
|
|
33
27
|
declare const withRenderer: (config: LoadingIndicatorConfig) => (component: BaseComponent) => BaseComponent;
|
|
34
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Creates a loading indicator: the Material 3 expressive shape morph for waits under about five seconds.
|
|
31
|
+
* @param config
|
|
32
|
+
*/
|
|
33
|
+
declare const createLoadingIndicator: (config?: LoadingIndicatorConfig) => LoadingIndicatorComponent;
|
|
34
|
+
|
|
35
35
|
/** Configuration options for the loading indicator */
|
|
36
36
|
interface LoadingIndicatorConfig {
|
|
37
37
|
/** Width and height in pixels, 24 to 240 (default 48) */
|
|
@@ -10,6 +10,7 @@ throw new Error('Snackbar queue is required');
|
|
|
10
10
|
const element = component.element;
|
|
11
11
|
const prefix = config.prefix || 'mtrl';
|
|
12
12
|
const cls = (name) => `${prefix}-${name}`;
|
|
13
|
+
element.inert = true;
|
|
13
14
|
let entry = null;
|
|
14
15
|
let previouslyFocused = null;
|
|
15
16
|
let removal = null;
|
|
@@ -98,12 +99,14 @@ if (active && element.contains(active) && previouslyFocused instanceof HTMLEleme
|
|
|
98
99
|
previouslyFocused.focus();
|
|
99
100
|
}
|
|
100
101
|
element.classList.remove(cls(SNACKBAR_CLASSES.VISIBLE));
|
|
102
|
+
element.inert = true;
|
|
101
103
|
scheduleRemoval();
|
|
102
104
|
emit('close', { reason, originalEvent });
|
|
103
105
|
emit('dismiss', { reason, originalEvent });
|
|
104
106
|
};
|
|
105
107
|
const open = () => {
|
|
106
108
|
api.state = 'visible';
|
|
109
|
+
element.inert = false;
|
|
107
110
|
cancelRemoval();
|
|
108
111
|
previouslyFocused = deepActiveElement();
|
|
109
112
|
if (topLayer) {
|
|
@@ -2,6 +2,15 @@ import type { EventCallback } from "../../core/state/emitter.js";
|
|
|
2
2
|
import type { ButtonComponent } from "../button/types.js";
|
|
3
3
|
import type { IconButtonComponent } from "../icon-button/types.js";
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new Snackbar component
|
|
7
|
+
* @param config
|
|
8
|
+
*/
|
|
9
|
+
declare const createSnackbar: (config: SnackbarConfig) => SnackbarComponent;
|
|
10
|
+
|
|
11
|
+
/** Dismisses the snackbar on screen and drops the ones still waiting. */
|
|
12
|
+
declare const clearSnackbars: () => void;
|
|
13
|
+
|
|
5
14
|
/** Where the snackbar sits along the bottom edge */
|
|
6
15
|
type SnackbarPosition = 'center' | 'start' | 'end';
|
|
7
16
|
|
|
@@ -201,15 +210,6 @@ interface ApiOptions {
|
|
|
201
210
|
|
|
202
211
|
config: SnackbarConfig;
|
|
203
212
|
}
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Creates a new Snackbar component
|
|
207
|
-
* @param config
|
|
208
|
-
*/
|
|
209
|
-
declare const createSnackbar: (config: SnackbarConfig) => SnackbarComponent;
|
|
210
|
-
|
|
211
|
-
/** Dismisses the snackbar on screen and drops the ones still waiting. */
|
|
212
|
-
declare const clearSnackbars: () => void;
|
|
213
213
|
export type { SnackbarCloseReason, SnackbarComponent, SnackbarConfig, SnackbarDuration, SnackbarEvent, SnackbarEvents, SnackbarPosition, SnackbarQueueBehavior };
|
|
214
214
|
export { clearSnackbars, createSnackbar, createSnackbar as default };
|
|
215
215
|
export { SNACKBAR_CLOSE_REASONS, SNACKBAR_DURATIONS, SNACKBAR_POSITIONS, SNACKBAR_QUEUE_BEHAVIORS } from "./constants.js";
|
|
@@ -3,6 +3,49 @@ import type { BadgeComponent } from "../badge/index.js";
|
|
|
3
3
|
import type { ButtonComponent } from "../button/types.js";
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
interface TabIndicatorConfig {
|
|
7
|
+
|
|
8
|
+
height?: number;
|
|
9
|
+
|
|
10
|
+
widthStrategy?: 'fixed' | 'dynamic' | 'content' | 'auto';
|
|
11
|
+
|
|
12
|
+
fixedWidth?: number;
|
|
13
|
+
|
|
14
|
+
animationDuration?: number;
|
|
15
|
+
|
|
16
|
+
animationTiming?: string;
|
|
17
|
+
|
|
18
|
+
visible?: boolean;
|
|
19
|
+
|
|
20
|
+
prefix?: string;
|
|
21
|
+
|
|
22
|
+
color?: string;
|
|
23
|
+
|
|
24
|
+
variant?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Tab indicator API */
|
|
28
|
+
interface TabIndicator {
|
|
29
|
+
/** The indicator DOM element */
|
|
30
|
+
element: HTMLElement;
|
|
31
|
+
/** Move the indicator to a specific tab */
|
|
32
|
+
moveToTab: (tab: TabComponent, immediate?: boolean) => void;
|
|
33
|
+
/** Show the indicator */
|
|
34
|
+
show: () => void;
|
|
35
|
+
/** Hide the indicator */
|
|
36
|
+
hide: () => void;
|
|
37
|
+
/** Set indicator color */
|
|
38
|
+
setColor: (color: string) => void;
|
|
39
|
+
/** Update indicator position (e.g. */
|
|
40
|
+
update: () => void;
|
|
41
|
+
/** Destroy the indicator and clean up */
|
|
42
|
+
destroy: () => void;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
declare const createTabIndicator: (config?: TabIndicatorConfig) => TabIndicator;
|
|
47
|
+
|
|
48
|
+
|
|
6
49
|
declare const RESPONSIVE_BREAKPOINTS: {
|
|
7
50
|
|
|
8
51
|
SMALL: number;
|
|
@@ -43,54 +86,6 @@ interface ResponsiveConfig {
|
|
|
43
86
|
*/
|
|
44
87
|
declare const setupResponsiveBehavior: (tabs: TabsComponent, config?: ResponsiveConfig) => void;
|
|
45
88
|
|
|
46
|
-
/**
|
|
47
|
-
* Creates a new Tabs component following MD3 guidelines
|
|
48
|
-
* @param config
|
|
49
|
-
*/
|
|
50
|
-
declare const createTabs: (config?: TabsConfig) => TabsComponent;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
interface TabsHost {
|
|
54
|
-
element?: HTMLElement;
|
|
55
|
-
tabs?: TabComponent[];
|
|
56
|
-
getTabs?: () => TabComponent[];
|
|
57
|
-
getActiveTab?: () => TabComponent | null;
|
|
58
|
-
setActiveTab?: (tabOrValue: TabComponent | string) => unknown;
|
|
59
|
-
handleTabClick?: (event: Event | null, tab: TabComponent) => void;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
declare function getActiveTab(component: TabsHost): TabComponent | null;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
declare function allocateTabsGroupId(): string;
|
|
67
|
-
|
|
68
|
-
/** A tab's element id within its group: `tab-<groupId>-<value>` for a value of `[A-Za-z0-9_-]`, and `tabx-<groupId>-<encoded value>` otherwise. */
|
|
69
|
-
declare const tabIdFor: (groupId: string, value: string) => string;
|
|
70
|
-
|
|
71
|
-
/** The panel id a group looks for when a page does not label its panels: `tabpanel-<groupId>-<value>`, or `tabpanelx-<groupId>-<encoded value>` for a value with other characters, as {@link tabIdFor} derives the tab's. */
|
|
72
|
-
declare const tabPanelIdFor: (groupId: string, value: string) => string;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
declare function registerTab(element: HTMLElement, groupId: string, value: string): void;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
declare function findRegisteredPanel(tab: HTMLElement): HTMLElement | null;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
declare function syncTabControls(element: HTMLElement): void;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
declare function updateTabPanels(component: TabsHost): void;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
declare function syncTabStops(component: TabsHost): void;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
declare function setupKeyboardNavigation(component: TabsHost, options?: {
|
|
91
|
-
autoActivate?: boolean;
|
|
92
|
-
}): void;
|
|
93
|
-
|
|
94
89
|
/**
|
|
95
90
|
* Creates a new Tab component following MD3 guidelines
|
|
96
91
|
* @param config
|
|
@@ -98,48 +93,11 @@ declare function setupKeyboardNavigation(component: TabsHost, options?: {
|
|
|
98
93
|
/** Point a tab at its panel, but only when that panel exists. */
|
|
99
94
|
declare const createTab: (config?: TabConfig) => TabComponent;
|
|
100
95
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
widthStrategy?: 'fixed' | 'dynamic' | 'content' | 'auto';
|
|
107
|
-
|
|
108
|
-
fixedWidth?: number;
|
|
109
|
-
|
|
110
|
-
animationDuration?: number;
|
|
111
|
-
|
|
112
|
-
animationTiming?: string;
|
|
113
|
-
|
|
114
|
-
visible?: boolean;
|
|
115
|
-
|
|
116
|
-
prefix?: string;
|
|
117
|
-
|
|
118
|
-
color?: string;
|
|
119
|
-
|
|
120
|
-
variant?: string;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/** Tab indicator API */
|
|
124
|
-
interface TabIndicator {
|
|
125
|
-
/** The indicator DOM element */
|
|
126
|
-
element: HTMLElement;
|
|
127
|
-
/** Move the indicator to a specific tab */
|
|
128
|
-
moveToTab: (tab: TabComponent, immediate?: boolean) => void;
|
|
129
|
-
/** Show the indicator */
|
|
130
|
-
show: () => void;
|
|
131
|
-
/** Hide the indicator */
|
|
132
|
-
hide: () => void;
|
|
133
|
-
/** Set indicator color */
|
|
134
|
-
setColor: (color: string) => void;
|
|
135
|
-
/** Update indicator position (e.g. */
|
|
136
|
-
update: () => void;
|
|
137
|
-
/** Destroy the indicator and clean up */
|
|
138
|
-
destroy: () => void;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
declare const createTabIndicator: (config?: TabIndicatorConfig) => TabIndicator;
|
|
96
|
+
/**
|
|
97
|
+
* Creates a new Tabs component following MD3 guidelines
|
|
98
|
+
* @param config
|
|
99
|
+
*/
|
|
100
|
+
declare const createTabs: (config?: TabsConfig) => TabsComponent;
|
|
143
101
|
|
|
144
102
|
/** Button methods the tab delegates to; each one is checked before use */
|
|
145
103
|
type TabButton = Partial<Pick<ButtonComponent, 'getValue' | 'setValue' | 'getText' | 'setText' | 'getIcon' | 'setIcon'>>;
|
|
@@ -449,6 +407,48 @@ interface TabsComponent {
|
|
|
449
407
|
/** Scroll container owned by the scrollable feature. */
|
|
450
408
|
scrollContainer?: HTMLElement;
|
|
451
409
|
}
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
interface TabsHost {
|
|
413
|
+
element?: HTMLElement;
|
|
414
|
+
tabs?: TabComponent[];
|
|
415
|
+
getTabs?: () => TabComponent[];
|
|
416
|
+
getActiveTab?: () => TabComponent | null;
|
|
417
|
+
setActiveTab?: (tabOrValue: TabComponent | string) => unknown;
|
|
418
|
+
handleTabClick?: (event: Event | null, tab: TabComponent) => void;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
declare function getActiveTab(component: TabsHost): TabComponent | null;
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
declare function allocateTabsGroupId(): string;
|
|
426
|
+
|
|
427
|
+
/** A tab's element id within its group: `tab-<groupId>-<value>` for a value of `[A-Za-z0-9_-]`, and `tabx-<groupId>-<encoded value>` otherwise. */
|
|
428
|
+
declare const tabIdFor: (groupId: string, value: string) => string;
|
|
429
|
+
|
|
430
|
+
/** The panel id a group looks for when a page does not label its panels: `tabpanel-<groupId>-<value>`, or `tabpanelx-<groupId>-<encoded value>` for a value with other characters, as {@link tabIdFor} derives the tab's. */
|
|
431
|
+
declare const tabPanelIdFor: (groupId: string, value: string) => string;
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
declare function registerTab(element: HTMLElement, groupId: string, value: string): void;
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
declare function findRegisteredPanel(tab: HTMLElement): HTMLElement | null;
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
declare function syncTabControls(element: HTMLElement): void;
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
declare function updateTabPanels(component: TabsHost): void;
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
declare function syncTabStops(component: TabsHost): void;
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
declare function setupKeyboardNavigation(component: TabsHost, options?: {
|
|
450
|
+
autoActivate?: boolean;
|
|
451
|
+
}): void;
|
|
452
452
|
export type { IndicatorConfig, ResponsiveConfig, TabChangeEventData, TabComponent, TabConfig, TabEvents, TabIndicator, TabsComponent, TabsConfig, TabsEvents, TabsVariant };
|
|
453
453
|
export { createTab, createTabs, createTabs as default, setupResponsiveBehavior, tabIdFor, tabPanelIdFor };
|
|
454
454
|
export { TABS_CLASSES, TABS_DEFAULTS, TABS_EVENTS, TAB_CLASSES, TAB_EVENTS, TAB_INDICATOR_WIDTH_STRATEGIES, TAB_STATES, TAB_VARIANTS } from "./constants.js";
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { BaseComponent as BaseComponent_1, ElementComponent } from "../../core/compose/component.js";
|
|
2
2
|
import type { EventCallback } from "../../core/state/emitter.js";
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* Creates a new TextField component Text fields allow users to enter text into a UI.
|
|
6
|
-
* @param config
|
|
7
|
-
*/
|
|
8
|
-
declare const createTextField: (config?: TextFieldConfig) => TextFieldComponent;
|
|
9
|
-
|
|
10
4
|
|
|
11
5
|
interface InputElementComponent extends ElementComponent {
|
|
12
6
|
input?: HTMLInputElement | HTMLTextAreaElement;
|
|
@@ -58,6 +52,12 @@ interface TrailingIconComponent extends BaseComponent_1, TrailingIconFeature {
|
|
|
58
52
|
|
|
59
53
|
declare const withTrailingIcon: <T extends TrailingIconConfig & object>(config: T) => <C extends InputElementComponent>(component: C) => C & TrailingIconFeature;
|
|
60
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Creates a new TextField component Text fields allow users to enter text into a UI.
|
|
57
|
+
* @param config
|
|
58
|
+
*/
|
|
59
|
+
declare const createTextField: (config?: TextFieldConfig) => TextFieldComponent;
|
|
60
|
+
|
|
61
61
|
/** Available TextField variants */
|
|
62
62
|
type TextFieldVariant = "filled" | "outlined";
|
|
63
63
|
|