material 3.13.1 → 3.14.1
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 +28 -1
- package/dist/components/badge/index.d.ts +6 -6
- package/dist/components/bottom-app-bar-toolbar/index.d.ts +8 -0
- package/dist/components/bottom-app-bar-toolbar/index.js +66 -0
- package/dist/components/bottom-app-bar-toolbar/structure.js +18 -0
- package/dist/components/bottom-sheet/index.d.ts +6 -6
- package/dist/components/button/features/progress.js +6 -9
- package/dist/components/button-group/index.d.ts +6 -6
- package/dist/components/card/index.d.ts +29 -29
- package/dist/components/checkbox/index.d.ts +6 -6
- package/dist/components/chips/chip/chip.js +6 -4
- package/dist/components/chips/index.d.ts +18 -18
- package/dist/components/datepicker/index.d.ts +6 -6
- package/dist/components/dialog/features.js +9 -24
- package/dist/components/dialog/index.d.ts +6 -6
- package/dist/components/divider/index.d.ts +42 -42
- package/dist/components/fab/index.d.ts +6 -6
- package/dist/components/fab-menu/fab-menu.js +5 -6
- package/dist/components/fab-menu/index.d.ts +7 -0
- package/dist/components/list/index.d.ts +16 -16
- package/dist/components/listbox/index.d.ts +100 -0
- package/dist/components/listbox/index.js +1 -0
- package/dist/components/listbox/listbox.js +633 -0
- package/dist/components/loading-indicator/index.d.ts +32 -32
- package/dist/components/navigation-bar/index.d.ts +3 -3
- package/dist/components/navigation-rail/index.d.ts +3 -3
- package/dist/components/progress/features/canvas.js +7 -13
- package/dist/components/radios/index.d.ts +6 -6
- package/dist/components/switch/index.d.ts +6 -6
- package/dist/components/tabs/index.d.ts +97 -97
- package/dist/components/text-field/index.d.ts +51 -51
- package/dist/components/tooltip/index.d.ts +6 -6
- package/dist/core/canvas/index.d.ts +77 -77
- package/dist/core/compose/index.d.ts +365 -365
- package/dist/core/dom/index.d.ts +117 -117
- package/dist/core/icons/index.d.ts +5 -5
- package/dist/core/shapes/index.d.ts +51 -51
- package/dist/core/state/index.d.ts +26 -26
- package/dist/core/utils/index.d.ts +8 -8
- package/dist/elements/index.d.ts +2109 -2109
- package/dist/elements/preupgrade/badge.css +1 -1
- 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 +1 -1
- package/dist/react/index.d.ts +47 -47
- package/dist/solid/index.d.ts +47 -47
- package/dist/styles/badge.css +1 -1
- 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 -0
- package/dist/styles/bottom-app-bar-toolbar.js +2 -0
- package/dist/styles/bottom-app-bar.css +1 -1
- 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 +2 -0
- package/dist/styles/listbox.js +2 -0
- package/dist/styles/loading-indicator.css +1 -1
- package/dist/styles/menu.css +1 -1
- package/dist/styles/navigation-bar.css +1 -1
- 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 +1 -1
- 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 +1 -1
- package/dist/styles/timepicker.css +1 -1
- package/dist/styles/toolbar.css +1 -1
- package/dist/styles/tooltip.css +1 -1
- package/dist/styles/top-app-bar.css +1 -1
- package/dist/styles/typography.css +1 -1
- package/dist/styles/utilities.css +1 -1
- package/dist/styles.css +1 -1
- 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 +74 -74
- package/package.json +19 -1
- package/src/styles/components/_listbox.scss +95 -0
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { DestinationConfig } from "../../core/navigation/destinations.js";
|
|
2
2
|
|
|
3
|
+
/** Creates an M3 Expressive navigation bar: three to five destinations along the bottom of a compact or medium window (Compose `ShortNavigationBar`). */
|
|
4
|
+
declare function createNavigationBar(config?: NavigationBarConfig): NavigationBarComponent;
|
|
5
|
+
|
|
3
6
|
/** One destination of the bar: a link (`href`) or a button. */
|
|
4
7
|
type NavigationBarItemConfig = DestinationConfig;
|
|
5
8
|
|
|
@@ -63,8 +66,5 @@ interface NavigationBarComponent {
|
|
|
63
66
|
off: <K extends keyof NavigationBarEvents>(event: K, handler: (payload: NavigationBarEvents[K]) => void) => NavigationBarComponent;
|
|
64
67
|
destroy: () => void;
|
|
65
68
|
}
|
|
66
|
-
|
|
67
|
-
/** Creates an M3 Expressive navigation bar: three to five destinations along the bottom of a compact or medium window (Compose `ShortNavigationBar`). */
|
|
68
|
-
declare function createNavigationBar(config?: NavigationBarConfig): NavigationBarComponent;
|
|
69
69
|
export type { NavigationBarComponent, NavigationBarConfig, NavigationBarEvents, NavigationBarItemConfig, NavigationBarItemLayout, NavigationBarSelectEvent };
|
|
70
70
|
export { createNavigationBar, createNavigationBar as default };
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { BaseComponentConfig } from "../../core/config/component.js";
|
|
2
2
|
|
|
3
|
+
/** Creates an M3 Expressive navigation rail with stable destinations during expansion. */
|
|
4
|
+
declare function createNavigationRail(config?: NavigationRailConfig): NavigationRailComponent;
|
|
5
|
+
|
|
3
6
|
/** A primary destination. */
|
|
4
7
|
interface NavigationRailItemConfig {
|
|
5
8
|
id: string;
|
|
@@ -91,8 +94,5 @@ declare module "../../core/config/global" {
|
|
|
91
94
|
"navigation-rail"?: Partial<NavigationRailConfig>;
|
|
92
95
|
}
|
|
93
96
|
}
|
|
94
|
-
|
|
95
|
-
/** Creates an M3 Expressive navigation rail with stable destinations during expansion. */
|
|
96
|
-
declare function createNavigationRail(config?: NavigationRailConfig): NavigationRailComponent;
|
|
97
97
|
export type { NavigationRailComponent, NavigationRailConfig, NavigationRailEvents, NavigationRailItemConfig, NavigationRailSelectEvent };
|
|
98
98
|
export { createNavigationRail, createNavigationRail as default };
|
|
@@ -12,11 +12,10 @@ return thickness === "thick" ? PROGRESS_THICKNESS.THICK : PROGRESS_THICKNESS.THI
|
|
|
12
12
|
export const getWaveAmplitude = (isCircular, strokeWidth, size) => isCircular
|
|
13
13
|
? PROGRESS_WAVE.CIRCULAR.AMPLITUDE * (size / PROGRESS_MEASUREMENTS.CIRCULAR.SIZE)
|
|
14
14
|
: PROGRESS_WAVE.LINEAR.AMPLITUDE * (strokeWidth / PROGRESS_THICKNESS.THIN);
|
|
15
|
-
export const getCircularSize = (config) => {
|
|
16
|
-
|
|
15
|
+
export const getCircularSize = (config, size = config.size) => {
|
|
16
|
+
return Math.max(config.minSize ?? PROGRESS_MEASUREMENTS.CIRCULAR.MIN_SIZE, Math.min(size ?? (config.shape === PROGRESS_SHAPES.WAVY
|
|
17
17
|
? PROGRESS_MEASUREMENTS.CIRCULAR.WAVE_SIZE
|
|
18
|
-
: PROGRESS_MEASUREMENTS.CIRCULAR.SIZE;
|
|
19
|
-
return Math.max(PROGRESS_MEASUREMENTS.CIRCULAR.MIN_SIZE, Math.min(config.size ?? fallback, PROGRESS_MEASUREMENTS.CIRCULAR.MAX_SIZE));
|
|
18
|
+
: PROGRESS_MEASUREMENTS.CIRCULAR.SIZE), PROGRESS_MEASUREMENTS.CIRCULAR.MAX_SIZE));
|
|
20
19
|
};
|
|
21
20
|
export const getLinearHeight = (strokeWidth, isWavy) => isWavy ? strokeWidth + 2 * getWaveAmplitude(false, strokeWidth, 0) : strokeWidth;
|
|
22
21
|
export const withCanvas = (config) => (component) => {
|
|
@@ -25,6 +24,8 @@ const view = component.element.ownerDocument?.defaultView ?? null;
|
|
|
25
24
|
const canvas = document.createElement("canvas");
|
|
26
25
|
canvas.className = `${component.getClass(PROGRESS_CLASSES.CONTAINER)}__canvas`;
|
|
27
26
|
canvas.setAttribute("aria-hidden", "true");
|
|
27
|
+
if (config.minSize)
|
|
28
|
+
canvas.style.maxWidth = "none";
|
|
28
29
|
component.element.appendChild(canvas);
|
|
29
30
|
let context = null;
|
|
30
31
|
let currentThickness = config.thickness ?? "thin";
|
|
@@ -71,7 +72,6 @@ const width = isCircular
|
|
|
71
72
|
: Math.max(component.element.getBoundingClientRect?.().width || component.element.offsetWidth || 0, 0);
|
|
72
73
|
context.width = width;
|
|
73
74
|
context.height = height;
|
|
74
|
-
context.pixelRatio = ratioOf();
|
|
75
75
|
if (width <= 0 || height <= 0)
|
|
76
76
|
return;
|
|
77
77
|
context.ctx.setTransform(canvas.width / width, 0, 0, canvas.height / height, 0, 0);
|
|
@@ -82,7 +82,7 @@ return false;
|
|
|
82
82
|
const ctx = canvas.getContext("2d");
|
|
83
83
|
if (!ctx)
|
|
84
84
|
return false;
|
|
85
|
-
context = { canvas, ctx, width: 0, height: 0
|
|
85
|
+
context = { canvas, ctx, width: 0, height: 0 };
|
|
86
86
|
measure();
|
|
87
87
|
return true;
|
|
88
88
|
};
|
|
@@ -212,8 +212,6 @@ animatedValue = component.state?.value ?? animatedValue;
|
|
|
212
212
|
if (!indeterminate)
|
|
213
213
|
retargetAmplitude(animatedValue / max());
|
|
214
214
|
startAnimation();
|
|
215
|
-
if (!needsAnimation())
|
|
216
|
-
draw(0);
|
|
217
215
|
};
|
|
218
216
|
component.setThickness = (thickness) => {
|
|
219
217
|
currentThickness = thickness;
|
|
@@ -237,13 +235,11 @@ retargetAmplitude(animatedValue / max());
|
|
|
237
235
|
}
|
|
238
236
|
measure();
|
|
239
237
|
startAnimation(animationTime);
|
|
240
|
-
if (!needsAnimation())
|
|
241
|
-
draw(0);
|
|
242
238
|
};
|
|
243
239
|
component.setSize = (size) => {
|
|
244
240
|
if (!isCircular)
|
|
245
241
|
return;
|
|
246
|
-
currentSize =
|
|
242
|
+
currentSize = getCircularSize(config, size);
|
|
247
243
|
measure();
|
|
248
244
|
draw();
|
|
249
245
|
};
|
|
@@ -260,8 +256,6 @@ component.element.classList.add(component.getClass(PROGRESS_CLASSES.TRANSITION))
|
|
|
260
256
|
component.element.removeAttribute("hidden");
|
|
261
257
|
measure();
|
|
262
258
|
startAnimation(animationTime);
|
|
263
|
-
if (!needsAnimation())
|
|
264
|
-
draw(0);
|
|
265
259
|
return component;
|
|
266
260
|
};
|
|
267
261
|
component.isVisible = () => !component.element.hasAttribute("hidden");
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* Creates a new Radios component
|
|
4
|
+
* @param config
|
|
5
|
+
*/
|
|
6
|
+
declare const createRadios: (config: RadiosConfig) => RadiosComponent;
|
|
1
7
|
/** Configuration for a radio option in the Radios component */
|
|
2
8
|
interface RadioOptionConfig {
|
|
3
9
|
/** Radio input value attribute */
|
|
@@ -147,12 +153,6 @@ interface RadiosComponent {
|
|
|
147
153
|
*/
|
|
148
154
|
off: <K extends keyof RadiosEvents>(event: K, handler: RadiosEvents[K]) => RadiosComponent;
|
|
149
155
|
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Creates a new Radios component
|
|
153
|
-
* @param config
|
|
154
|
-
*/
|
|
155
|
-
declare const createRadios: (config: RadiosConfig) => RadiosComponent;
|
|
156
156
|
export type { RadioOptionConfig, RadiosChangePayload, RadiosComponent, RadiosConfig, RadiosEvents };
|
|
157
157
|
export { createRadios, createRadios as default };
|
|
158
158
|
export { RADIO_DEFAULTS, RADIO_DIRECTIONS, RADIO_EVENTS, RADIO_STATES } from "./constants.js";
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { EventCallback } from "../../core/state/emitter.js";
|
|
2
2
|
import type { TouchEvents } from "../../core/utils/mobile.js";
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Creates a new Switch component
|
|
6
|
+
* @param config
|
|
7
|
+
*/
|
|
8
|
+
declare const createSwitch: (config?: SwitchConfig) => SwitchComponent;
|
|
9
|
+
|
|
4
10
|
type SwitchPosition = "center" | "start" | "end";
|
|
5
11
|
|
|
6
12
|
/** Switch label position types */
|
|
@@ -179,12 +185,6 @@ declare module "../../core/config/global" {
|
|
|
179
185
|
switch?: Partial<SwitchConfig>;
|
|
180
186
|
}
|
|
181
187
|
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Creates a new Switch component
|
|
185
|
-
* @param config
|
|
186
|
-
*/
|
|
187
|
-
declare const createSwitch: (config?: SwitchConfig) => SwitchComponent;
|
|
188
188
|
export type { SwitchChangePayload, SwitchComponent, SwitchConfig, SwitchEvents };
|
|
189
189
|
export { createSwitch, createSwitch as default };
|
|
190
190
|
export { SWITCH_CLASSES, SWITCH_DEFAULTS, SWITCH_EVENTS, SWITCH_LABEL_POSITIONS, SWITCH_STATES } from "./constants.js";
|
|
@@ -3,6 +3,53 @@ import type { BadgeComponent } from "../badge/index.js";
|
|
|
3
3
|
import type { ButtonComponent } from "../button/types.js";
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
declare const RESPONSIVE_BREAKPOINTS: {
|
|
7
|
+
|
|
8
|
+
SMALL: number;
|
|
9
|
+
|
|
10
|
+
MEDIUM: number;
|
|
11
|
+
|
|
12
|
+
LARGE: number;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/** Configuration for responsive behavior */
|
|
16
|
+
interface ResponsiveConfig {
|
|
17
|
+
/** Whether to enable responsive behavior */
|
|
18
|
+
responsive?: boolean;
|
|
19
|
+
/** Options for small screens */
|
|
20
|
+
smallScreen?: {
|
|
21
|
+
/**
|
|
22
|
+
* Layout below the small breakpoint: `icon-only` hides the labels of tabs that have an icon (the label still names the tab), `text-only` hides the icons of tabs that have a label, `icon-and-text` keeps every tab as built.
|
|
23
|
+
* @default 'icon-only'
|
|
24
|
+
*/
|
|
25
|
+
layout?: 'icon-only' | 'text-only' | 'icon-and-text';
|
|
26
|
+
};
|
|
27
|
+
/** Breakpoints. */
|
|
28
|
+
breakpoints?: {
|
|
29
|
+
small?: number;
|
|
30
|
+
medium?: number;
|
|
31
|
+
large?: number;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Enhances tabs with responsive behavior.
|
|
37
|
+
* @deprecated Pass `tabsResponsive(config)` from
|
|
38
|
+
* `material/components/tabs/responsive` as createTabs's `responsive` option
|
|
39
|
+
* instead: it takes this configuration and applies this behaviour. This
|
|
40
|
+
* function keeps working in 3.x and is removed in 4.0.
|
|
41
|
+
* @param tabs
|
|
42
|
+
* @param config
|
|
43
|
+
*/
|
|
44
|
+
declare const setupResponsiveBehavior: (tabs: TabsComponent, config?: ResponsiveConfig) => void;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Creates a new Tabs component following MD3 guidelines
|
|
48
|
+
* @param config
|
|
49
|
+
*/
|
|
50
|
+
declare const createTabs: (config?: TabsConfig) => TabsComponent;
|
|
51
|
+
|
|
52
|
+
|
|
6
53
|
interface TabsHost {
|
|
7
54
|
element?: HTMLElement;
|
|
8
55
|
tabs?: TabComponent[];
|
|
@@ -44,6 +91,56 @@ declare function setupKeyboardNavigation(component: TabsHost, options?: {
|
|
|
44
91
|
autoActivate?: boolean;
|
|
45
92
|
}): void;
|
|
46
93
|
|
|
94
|
+
/**
|
|
95
|
+
* Creates a new Tab component following MD3 guidelines
|
|
96
|
+
* @param config
|
|
97
|
+
*/
|
|
98
|
+
/** Point a tab at its panel, but only when that panel exists. */
|
|
99
|
+
declare const createTab: (config?: TabConfig) => TabComponent;
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
interface TabIndicatorConfig {
|
|
103
|
+
|
|
104
|
+
height?: number;
|
|
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;
|
|
143
|
+
|
|
47
144
|
/** Button methods the tab delegates to; each one is checked before use */
|
|
48
145
|
type TabButton = Partial<Pick<ButtonComponent, 'getValue' | 'setValue' | 'getText' | 'setText' | 'getIcon' | 'setIcon'>>;
|
|
49
146
|
|
|
@@ -352,103 +449,6 @@ interface TabsComponent {
|
|
|
352
449
|
/** Scroll container owned by the scrollable feature. */
|
|
353
450
|
scrollContainer?: HTMLElement;
|
|
354
451
|
}
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
* Creates a new Tab component following MD3 guidelines
|
|
358
|
-
* @param config
|
|
359
|
-
*/
|
|
360
|
-
/** Point a tab at its panel, but only when that panel exists. */
|
|
361
|
-
declare const createTab: (config?: TabConfig) => TabComponent;
|
|
362
|
-
|
|
363
|
-
/**
|
|
364
|
-
* Creates a new Tabs component following MD3 guidelines
|
|
365
|
-
* @param config
|
|
366
|
-
*/
|
|
367
|
-
declare const createTabs: (config?: TabsConfig) => TabsComponent;
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
interface TabIndicatorConfig {
|
|
371
|
-
|
|
372
|
-
height?: number;
|
|
373
|
-
|
|
374
|
-
widthStrategy?: 'fixed' | 'dynamic' | 'content' | 'auto';
|
|
375
|
-
|
|
376
|
-
fixedWidth?: number;
|
|
377
|
-
|
|
378
|
-
animationDuration?: number;
|
|
379
|
-
|
|
380
|
-
animationTiming?: string;
|
|
381
|
-
|
|
382
|
-
visible?: boolean;
|
|
383
|
-
|
|
384
|
-
prefix?: string;
|
|
385
|
-
|
|
386
|
-
color?: string;
|
|
387
|
-
|
|
388
|
-
variant?: string;
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
/** Tab indicator API */
|
|
392
|
-
interface TabIndicator {
|
|
393
|
-
/** The indicator DOM element */
|
|
394
|
-
element: HTMLElement;
|
|
395
|
-
/** Move the indicator to a specific tab */
|
|
396
|
-
moveToTab: (tab: TabComponent, immediate?: boolean) => void;
|
|
397
|
-
/** Show the indicator */
|
|
398
|
-
show: () => void;
|
|
399
|
-
/** Hide the indicator */
|
|
400
|
-
hide: () => void;
|
|
401
|
-
/** Set indicator color */
|
|
402
|
-
setColor: (color: string) => void;
|
|
403
|
-
/** Update indicator position (e.g. */
|
|
404
|
-
update: () => void;
|
|
405
|
-
/** Destroy the indicator and clean up */
|
|
406
|
-
destroy: () => void;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
declare const createTabIndicator: (config?: TabIndicatorConfig) => TabIndicator;
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
declare const RESPONSIVE_BREAKPOINTS: {
|
|
414
|
-
|
|
415
|
-
SMALL: number;
|
|
416
|
-
|
|
417
|
-
MEDIUM: number;
|
|
418
|
-
|
|
419
|
-
LARGE: number;
|
|
420
|
-
};
|
|
421
|
-
|
|
422
|
-
/** Configuration for responsive behavior */
|
|
423
|
-
interface ResponsiveConfig {
|
|
424
|
-
/** Whether to enable responsive behavior */
|
|
425
|
-
responsive?: boolean;
|
|
426
|
-
/** Options for small screens */
|
|
427
|
-
smallScreen?: {
|
|
428
|
-
/**
|
|
429
|
-
* Layout below the small breakpoint: `icon-only` hides the labels of tabs that have an icon (the label still names the tab), `text-only` hides the icons of tabs that have a label, `icon-and-text` keeps every tab as built.
|
|
430
|
-
* @default 'icon-only'
|
|
431
|
-
*/
|
|
432
|
-
layout?: 'icon-only' | 'text-only' | 'icon-and-text';
|
|
433
|
-
};
|
|
434
|
-
/** Breakpoints. */
|
|
435
|
-
breakpoints?: {
|
|
436
|
-
small?: number;
|
|
437
|
-
medium?: number;
|
|
438
|
-
large?: number;
|
|
439
|
-
};
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
* Enhances tabs with responsive behavior.
|
|
444
|
-
* @deprecated Pass `tabsResponsive(config)` from
|
|
445
|
-
* `material/components/tabs/responsive` as createTabs's `responsive` option
|
|
446
|
-
* instead: it takes this configuration and applies this behaviour. This
|
|
447
|
-
* function keeps working in 3.x and is removed in 4.0.
|
|
448
|
-
* @param tabs
|
|
449
|
-
* @param config
|
|
450
|
-
*/
|
|
451
|
-
declare const setupResponsiveBehavior: (tabs: TabsComponent, config?: ResponsiveConfig) => 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";
|
|
@@ -7,6 +7,57 @@ import type { EventCallback } from "../../core/state/emitter.js";
|
|
|
7
7
|
*/
|
|
8
8
|
declare const createTextField: (config?: TextFieldConfig) => TextFieldComponent;
|
|
9
9
|
|
|
10
|
+
|
|
11
|
+
interface InputElementComponent extends ElementComponent {
|
|
12
|
+
input?: HTMLInputElement | HTMLTextAreaElement;
|
|
13
|
+
emit?: (event: string, data?: unknown) => void;
|
|
14
|
+
lifecycle?: {
|
|
15
|
+
destroy: () => void;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** What an interactive trailing icon's `trailing` event carries */
|
|
20
|
+
interface TextFieldTrailingPayload {
|
|
21
|
+
/** The field's value when the icon was activated */
|
|
22
|
+
value: string;
|
|
23
|
+
/** The click (Enter and Space reach a button as one) */
|
|
24
|
+
event: MouseEvent;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
interface TrailingIconConfig {
|
|
29
|
+
|
|
30
|
+
trailingIcon?: string;
|
|
31
|
+
|
|
32
|
+
trailingIconLabel?: string;
|
|
33
|
+
|
|
34
|
+
onTrailingClick?: (event: TextFieldTrailingPayload) => void;
|
|
35
|
+
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
|
|
38
|
+
prefix?: string;
|
|
39
|
+
|
|
40
|
+
componentName?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
interface TrailingIconFeature {
|
|
46
|
+
|
|
47
|
+
trailingIcon: HTMLElement | null;
|
|
48
|
+
|
|
49
|
+
setTrailingIcon: (html: string, label?: string) => TrailingIconComponent;
|
|
50
|
+
|
|
51
|
+
removeTrailingIcon: () => TrailingIconComponent;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
interface TrailingIconComponent extends BaseComponent_1, TrailingIconFeature {
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
declare const withTrailingIcon: <T extends TrailingIconConfig & object>(config: T) => <C extends InputElementComponent>(component: C) => C & TrailingIconFeature;
|
|
60
|
+
|
|
10
61
|
/** Available TextField variants */
|
|
11
62
|
type TextFieldVariant = "filled" | "outlined";
|
|
12
63
|
|
|
@@ -283,56 +334,5 @@ declare module "../../core/config/global" {
|
|
|
283
334
|
"text-field"?: Partial<TextFieldConfig>;
|
|
284
335
|
}
|
|
285
336
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
interface InputElementComponent extends ElementComponent {
|
|
289
|
-
input?: HTMLInputElement | HTMLTextAreaElement;
|
|
290
|
-
emit?: (event: string, data?: unknown) => void;
|
|
291
|
-
lifecycle?: {
|
|
292
|
-
destroy: () => void;
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
/** What an interactive trailing icon's `trailing` event carries */
|
|
297
|
-
interface TextFieldTrailingPayload {
|
|
298
|
-
/** The field's value when the icon was activated */
|
|
299
|
-
value: string;
|
|
300
|
-
/** The click (Enter and Space reach a button as one) */
|
|
301
|
-
event: MouseEvent;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
interface TrailingIconConfig {
|
|
306
|
-
|
|
307
|
-
trailingIcon?: string;
|
|
308
|
-
|
|
309
|
-
trailingIconLabel?: string;
|
|
310
|
-
|
|
311
|
-
onTrailingClick?: (event: TextFieldTrailingPayload) => void;
|
|
312
|
-
|
|
313
|
-
disabled?: boolean;
|
|
314
|
-
|
|
315
|
-
prefix?: string;
|
|
316
|
-
|
|
317
|
-
componentName?: string;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
interface TrailingIconFeature {
|
|
323
|
-
|
|
324
|
-
trailingIcon: HTMLElement | null;
|
|
325
|
-
|
|
326
|
-
setTrailingIcon: (html: string, label?: string) => TrailingIconComponent;
|
|
327
|
-
|
|
328
|
-
removeTrailingIcon: () => TrailingIconComponent;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
interface TrailingIconComponent extends BaseComponent_1, TrailingIconFeature {
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
declare const withTrailingIcon: <T extends TrailingIconConfig & object>(config: T) => <C extends InputElementComponent>(component: C) => C & TrailingIconFeature;
|
|
337
337
|
export type { TextFieldComponent, TextFieldConfig, TextFieldDensity, TextFieldEvents, TextFieldFocusPayload, TextFieldTrailingPayload, TextFieldValuePayload, TextFieldVariant };
|
|
338
338
|
export { createTextField, createTextField as default };
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* Creates a new Tooltip component
|
|
4
|
+
* @param config
|
|
5
|
+
*/
|
|
6
|
+
declare const createTooltip: (config?: TooltipConfig) => TooltipComponent;
|
|
1
7
|
/** Tooltip positions */
|
|
2
8
|
declare const TOOLTIP_POSITIONS: {
|
|
3
9
|
readonly TOP: "top";
|
|
@@ -144,12 +150,6 @@ interface TooltipComponent {
|
|
|
144
150
|
/** Destroys the tooltip component and cleans up resources */
|
|
145
151
|
destroy: () => void;
|
|
146
152
|
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Creates a new Tooltip component
|
|
150
|
-
* @param config
|
|
151
|
-
*/
|
|
152
|
-
declare const createTooltip: (config?: TooltipConfig) => TooltipComponent;
|
|
153
153
|
export type { TooltipComponent, TooltipConfig, TooltipVariant };
|
|
154
154
|
export { createTooltip, createTooltip as default };
|
|
155
155
|
export { TOOLTIP_CLASSES, TOOLTIP_DEFAULTS, TOOLTIP_EVENTS, TOOLTIP_POSITIONS, TOOLTIP_VARIANTS } from "./constants.js";
|
|
@@ -1,72 +1,3 @@
|
|
|
1
|
-
/** Common canvas context interface used by components */
|
|
2
|
-
interface CanvasContext {
|
|
3
|
-
canvas: HTMLCanvasElement;
|
|
4
|
-
ctx: CanvasRenderingContext2D;
|
|
5
|
-
width: number;
|
|
6
|
-
height: number;
|
|
7
|
-
pixelRatio: number;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Creates and initializes a canvas context with proper pixel ratio handling
|
|
12
|
-
* @param canvas
|
|
13
|
-
* @param width
|
|
14
|
-
* @param height
|
|
15
|
-
*/
|
|
16
|
-
declare const createCanvasContext: (canvas: HTMLCanvasElement, width: number, height: number) => CanvasContext;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Updates canvas dimensions while preserving pixel ratio
|
|
20
|
-
* @param context
|
|
21
|
-
* @param width
|
|
22
|
-
* @param height
|
|
23
|
-
*/
|
|
24
|
-
declare const updateCanvasDimensions: (context: CanvasContext, width: number, height: number) => void;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Tries to initialize a canvas with retry mechanism
|
|
28
|
-
* @param initFn
|
|
29
|
-
* @param onSuccess
|
|
30
|
-
* @param signal
|
|
31
|
-
*/
|
|
32
|
-
declare const initializeCanvasWithRetry: (initFn: () => boolean, onSuccess?: () => void, signal?: AbortSignal) => boolean;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Creates a theme observer that triggers a callback on theme changes
|
|
36
|
-
* @param _color
|
|
37
|
-
* @param callback
|
|
38
|
-
*/
|
|
39
|
-
declare const createCanvasThemeObserver: (_color: string, callback: () => void) => (() => void);
|
|
40
|
-
|
|
41
|
-
/** Standard animation frame manager for components */
|
|
42
|
-
declare class AnimationFrameManager {
|
|
43
|
-
private animationId;
|
|
44
|
-
/**
|
|
45
|
-
* Starts an animation loop
|
|
46
|
-
* @param callback
|
|
47
|
-
*/
|
|
48
|
-
start(callback: (timestamp: number) => void): void;
|
|
49
|
-
/** Stops the animation loop */
|
|
50
|
-
stop(): void;
|
|
51
|
-
/** Whether animation is currently running */
|
|
52
|
-
get isRunning(): boolean;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/** Manages multiple cleanup functions for components */
|
|
56
|
-
declare class CleanupManager {
|
|
57
|
-
private cleanupFunctions;
|
|
58
|
-
/** Adds a cleanup function */
|
|
59
|
-
add(cleanup: (() => void) | null | undefined): void;
|
|
60
|
-
/** Runs all cleanup functions and clears the list */
|
|
61
|
-
cleanup(): void;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Creates a standard canvas element with common styles
|
|
66
|
-
* @param className
|
|
67
|
-
* @param additionalStyles
|
|
68
|
-
*/
|
|
69
|
-
declare const createStyledCanvas: (className: string, additionalStyles?: Partial<CSSStyleDeclaration>) => HTMLCanvasElement;
|
|
70
1
|
/** Canvas drawing utilities */
|
|
71
2
|
/**
|
|
72
3
|
* Creates a rounded rectangle path
|
|
@@ -138,6 +69,83 @@ declare const fillRoundedRectLR: (ctx: CanvasRenderingContext2D, x: number, y: n
|
|
|
138
69
|
* @param backgroundColor
|
|
139
70
|
*/
|
|
140
71
|
declare const clearCanvas: (ctx: CanvasRenderingContext2D, width: number, height: number, backgroundColor?: string) => void;
|
|
72
|
+
/** Canvas resize utilities */
|
|
73
|
+
/**
|
|
74
|
+
* Observes an element for the two things that change a canvas backing store: its width, and the devicePixelRatio.
|
|
75
|
+
* @param element
|
|
76
|
+
* @param canvas
|
|
77
|
+
* @param onResize
|
|
78
|
+
*/
|
|
79
|
+
declare const observeCanvasResize: (element: HTMLElement, canvas: HTMLCanvasElement | null | undefined, onResize: () => void) => (() => void);
|
|
80
|
+
/** Common canvas context interface used by components */
|
|
81
|
+
interface CanvasContext {
|
|
82
|
+
canvas: HTMLCanvasElement;
|
|
83
|
+
ctx: CanvasRenderingContext2D;
|
|
84
|
+
width: number;
|
|
85
|
+
height: number;
|
|
86
|
+
pixelRatio: number;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Creates and initializes a canvas context with proper pixel ratio handling
|
|
91
|
+
* @param canvas
|
|
92
|
+
* @param width
|
|
93
|
+
* @param height
|
|
94
|
+
*/
|
|
95
|
+
declare const createCanvasContext: (canvas: HTMLCanvasElement, width: number, height: number) => CanvasContext;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Updates canvas dimensions while preserving pixel ratio
|
|
99
|
+
* @param context
|
|
100
|
+
* @param width
|
|
101
|
+
* @param height
|
|
102
|
+
*/
|
|
103
|
+
declare const updateCanvasDimensions: (context: CanvasContext, width: number, height: number) => void;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Tries to initialize a canvas with retry mechanism
|
|
107
|
+
* @param initFn
|
|
108
|
+
* @param onSuccess
|
|
109
|
+
* @param signal
|
|
110
|
+
*/
|
|
111
|
+
declare const initializeCanvasWithRetry: (initFn: () => boolean, onSuccess?: () => void, signal?: AbortSignal) => boolean;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Creates a theme observer that triggers a callback on theme changes
|
|
115
|
+
* @param _color
|
|
116
|
+
* @param callback
|
|
117
|
+
*/
|
|
118
|
+
declare const createCanvasThemeObserver: (_color: string, callback: () => void) => (() => void);
|
|
119
|
+
|
|
120
|
+
/** Standard animation frame manager for components */
|
|
121
|
+
declare class AnimationFrameManager {
|
|
122
|
+
private animationId;
|
|
123
|
+
/**
|
|
124
|
+
* Starts an animation loop
|
|
125
|
+
* @param callback
|
|
126
|
+
*/
|
|
127
|
+
start(callback: (timestamp: number) => void): void;
|
|
128
|
+
/** Stops the animation loop */
|
|
129
|
+
stop(): void;
|
|
130
|
+
/** Whether animation is currently running */
|
|
131
|
+
get isRunning(): boolean;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** Manages multiple cleanup functions for components */
|
|
135
|
+
declare class CleanupManager {
|
|
136
|
+
private cleanupFunctions;
|
|
137
|
+
/** Adds a cleanup function */
|
|
138
|
+
add(cleanup: (() => void) | null | undefined): void;
|
|
139
|
+
/** Runs all cleanup functions and clears the list */
|
|
140
|
+
cleanup(): void;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Creates a standard canvas element with common styles
|
|
145
|
+
* @param className
|
|
146
|
+
* @param additionalStyles
|
|
147
|
+
*/
|
|
148
|
+
declare const createStyledCanvas: (className: string, additionalStyles?: Partial<CSSStyleDeclaration>) => HTMLCanvasElement;
|
|
141
149
|
/**
|
|
142
150
|
* Easing function for smooth animations (Material Design standard)
|
|
143
151
|
* @param t
|
|
@@ -160,13 +168,5 @@ declare const EASING_FUNCTIONS: {
|
|
|
160
168
|
easeInOut: (t: number) => number;
|
|
161
169
|
materialStandard: (t: number) => number;
|
|
162
170
|
};
|
|
163
|
-
/** Canvas resize utilities */
|
|
164
|
-
/**
|
|
165
|
-
* Observes an element for the two things that change a canvas backing store: its width, and the devicePixelRatio.
|
|
166
|
-
* @param element
|
|
167
|
-
* @param canvas
|
|
168
|
-
* @param onResize
|
|
169
|
-
*/
|
|
170
|
-
declare const observeCanvasResize: (element: HTMLElement, canvas: HTMLCanvasElement | null | undefined, onResize: () => void) => (() => void);
|
|
171
171
|
export type { CanvasContext };
|
|
172
172
|
export { ANIMATION_DURATIONS, AnimationFrameManager, CleanupManager, EASING_FUNCTIONS, clearCanvas, clipRoundedRect, createCanvasContext, createCanvasThemeObserver, createRoundedRectPath, createStyledCanvas, easeOutCubic, fillRoundedRect, fillRoundedRectLR, initializeCanvasWithRetry, observeCanvasResize, updateCanvasDimensions };
|