material 3.15.0 → 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/menu/features/controller.js +19 -20
- 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
|
@@ -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
|
|
|
@@ -107,7 +107,7 @@ targetEl.addEventListener("focus", handleTargetFocus);
|
|
|
107
107
|
targetEl.addEventListener("blur", handleTargetBlur);
|
|
108
108
|
}
|
|
109
109
|
targetEl.addEventListener("pointerdown", press);
|
|
110
|
-
targetEl.addEventListener("click",
|
|
110
|
+
targetEl.addEventListener("click", handleClick);
|
|
111
111
|
targetEl.addEventListener("keydown", handleKeyDown);
|
|
112
112
|
};
|
|
113
113
|
const removeTargetEvents = (targetEl) => {
|
|
@@ -117,12 +117,18 @@ targetEl.removeEventListener("mouseleave", handleTargetMouseLeave);
|
|
|
117
117
|
targetEl.removeEventListener("focus", handleTargetFocus);
|
|
118
118
|
targetEl.removeEventListener("blur", handleTargetBlur);
|
|
119
119
|
targetEl.removeEventListener("pointerdown", press);
|
|
120
|
-
targetEl.removeEventListener("click",
|
|
120
|
+
targetEl.removeEventListener("click", handleClick);
|
|
121
121
|
targetEl.removeEventListener("keydown", handleKeyDown);
|
|
122
122
|
}
|
|
123
123
|
};
|
|
124
|
-
const handleTargetMouseEnter = () =>
|
|
125
|
-
|
|
124
|
+
const handleTargetMouseEnter = () => {
|
|
125
|
+
if (touchExpiry === undefined)
|
|
126
|
+
api.show();
|
|
127
|
+
};
|
|
128
|
+
const handleTargetMouseLeave = () => {
|
|
129
|
+
if (touchExpiry === undefined)
|
|
130
|
+
api.hide();
|
|
131
|
+
};
|
|
126
132
|
const handleTooltipMouseEnter = () => {
|
|
127
133
|
if (isVisible && hideTimer !== null)
|
|
128
134
|
api.show(true);
|
|
@@ -138,14 +144,45 @@ if (event.key === "Escape" && isVisible)
|
|
|
138
144
|
api.hide(true);
|
|
139
145
|
};
|
|
140
146
|
let pressed = false;
|
|
147
|
+
let touchPointer;
|
|
148
|
+
let touchHold;
|
|
149
|
+
let touchExpiry;
|
|
141
150
|
const menuOpen = () => target?.getAttribute("aria-expanded") === "true";
|
|
142
151
|
const dismiss = () => api.hide(true);
|
|
143
|
-
const
|
|
152
|
+
const dismissOutsideTouch = (event) => {
|
|
153
|
+
if (!event.composedPath().includes(component.element))
|
|
154
|
+
dismiss();
|
|
155
|
+
};
|
|
156
|
+
const clearTouch = () => {
|
|
157
|
+
window.clearTimeout(touchHold);
|
|
158
|
+
window.clearTimeout(touchExpiry);
|
|
159
|
+
touchPointer = touchHold = touchExpiry = undefined;
|
|
160
|
+
document.removeEventListener("pointerdown", dismissOutsideTouch, true);
|
|
161
|
+
};
|
|
162
|
+
const press = (event) => {
|
|
144
163
|
pressed = true;
|
|
145
164
|
dismiss();
|
|
165
|
+
if (event.pointerType !== "touch" || !event.isPrimary || !(showOnHover || showOnFocus))
|
|
166
|
+
return;
|
|
167
|
+
touchPointer = event.pointerId;
|
|
168
|
+
touchHold = window.setTimeout(() => {
|
|
169
|
+
api.show(true);
|
|
170
|
+
if (!isVisible)
|
|
171
|
+
return;
|
|
172
|
+
touchExpiry = window.setTimeout(dismiss, 1500);
|
|
173
|
+
document.addEventListener("pointerdown", dismissOutsideTouch, true);
|
|
174
|
+
}, 500);
|
|
146
175
|
};
|
|
147
|
-
const release = () => {
|
|
176
|
+
const release = (event) => {
|
|
148
177
|
pressed = false;
|
|
178
|
+
if (event.pointerId === touchPointer) {
|
|
179
|
+
window.clearTimeout(touchHold);
|
|
180
|
+
touchPointer = touchHold = undefined;
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
const handleClick = (event) => {
|
|
184
|
+
if (touchExpiry === undefined || event.pointerType !== "touch")
|
|
185
|
+
dismiss();
|
|
149
186
|
};
|
|
150
187
|
document.addEventListener("pointerup", release, true);
|
|
151
188
|
document.addEventListener("pointercancel", release, true);
|
|
@@ -154,7 +191,7 @@ if (event.key === "Enter" || event.key === " ")
|
|
|
154
191
|
dismiss();
|
|
155
192
|
};
|
|
156
193
|
const handleTargetFocus = () => {
|
|
157
|
-
if (!pressed)
|
|
194
|
+
if (!pressed && touchExpiry === undefined)
|
|
158
195
|
api.show();
|
|
159
196
|
};
|
|
160
197
|
const handleTargetBlur = () => api.hide();
|
|
@@ -203,6 +240,10 @@ getPosition() {
|
|
|
203
240
|
return position;
|
|
204
241
|
},
|
|
205
242
|
setTarget(newTarget) {
|
|
243
|
+
if (touchExpiry === undefined)
|
|
244
|
+
clearTouch();
|
|
245
|
+
else
|
|
246
|
+
dismiss();
|
|
206
247
|
if (target) {
|
|
207
248
|
removeTargetEvents(target);
|
|
208
249
|
undescribe(target);
|
|
@@ -222,6 +263,7 @@ return this;
|
|
|
222
263
|
show(immediate = false) {
|
|
223
264
|
if (menuOpen())
|
|
224
265
|
return this;
|
|
266
|
+
clearTouch();
|
|
225
267
|
if (showTimer !== null) {
|
|
226
268
|
window.clearTimeout(showTimer);
|
|
227
269
|
showTimer = null;
|
|
@@ -259,6 +301,7 @@ showTimer = window.setTimeout(showTooltip, showDelay);
|
|
|
259
301
|
return this;
|
|
260
302
|
},
|
|
261
303
|
hide(immediate = false) {
|
|
304
|
+
clearTouch();
|
|
262
305
|
if (hideTimer !== null) {
|
|
263
306
|
window.clearTimeout(hideTimer);
|
|
264
307
|
hideTimer = null;
|
|
@@ -308,6 +351,7 @@ arrowElement.classList.add(`${component.getClass("tooltip")}__arrow--${arrowPosi
|
|
|
308
351
|
return this;
|
|
309
352
|
},
|
|
310
353
|
destroy() {
|
|
354
|
+
clearTouch();
|
|
311
355
|
if (showTimer !== null) {
|
|
312
356
|
window.clearTimeout(showTimer);
|
|
313
357
|
}
|
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Easing function for smooth animations (Material Design standard)
|
|
3
|
+
* @param t
|
|
4
|
+
*/
|
|
5
|
+
declare const easeOutCubic: (t: number) => number;
|
|
6
|
+
|
|
7
|
+
/** Standard Material Design animation durations */
|
|
8
|
+
declare const ANIMATION_DURATIONS: {
|
|
9
|
+
SHORT: number;
|
|
10
|
+
MEDIUM: number;
|
|
11
|
+
LONG: number;
|
|
12
|
+
EXTRA_LONG: number;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/** Common easing functions */
|
|
16
|
+
declare const EASING_FUNCTIONS: {
|
|
17
|
+
linear: (t: number) => number;
|
|
18
|
+
easeIn: (t: number) => number;
|
|
19
|
+
easeOut: (t: number) => number;
|
|
20
|
+
easeInOut: (t: number) => number;
|
|
21
|
+
materialStandard: (t: number) => number;
|
|
22
|
+
};
|
|
1
23
|
/** Canvas drawing utilities */
|
|
2
24
|
/**
|
|
3
25
|
* Creates a rounded rectangle path
|
|
@@ -146,27 +168,5 @@ declare class CleanupManager {
|
|
|
146
168
|
* @param additionalStyles
|
|
147
169
|
*/
|
|
148
170
|
declare const createStyledCanvas: (className: string, additionalStyles?: Partial<CSSStyleDeclaration>) => HTMLCanvasElement;
|
|
149
|
-
/**
|
|
150
|
-
* Easing function for smooth animations (Material Design standard)
|
|
151
|
-
* @param t
|
|
152
|
-
*/
|
|
153
|
-
declare const easeOutCubic: (t: number) => number;
|
|
154
|
-
|
|
155
|
-
/** Standard Material Design animation durations */
|
|
156
|
-
declare const ANIMATION_DURATIONS: {
|
|
157
|
-
SHORT: number;
|
|
158
|
-
MEDIUM: number;
|
|
159
|
-
LONG: number;
|
|
160
|
-
EXTRA_LONG: number;
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
/** Common easing functions */
|
|
164
|
-
declare const EASING_FUNCTIONS: {
|
|
165
|
-
linear: (t: number) => number;
|
|
166
|
-
easeIn: (t: number) => number;
|
|
167
|
-
easeOut: (t: number) => number;
|
|
168
|
-
easeInOut: (t: number) => number;
|
|
169
|
-
materialStandard: (t: number) => number;
|
|
170
|
-
};
|
|
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 };
|