@material/web 1.5.1 → 1.5.2-nightly.5df9410.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/button/internal/button.d.ts +1 -1
- package/button/internal/button.js +2 -3
- package/button/internal/button.js.map +1 -1
- package/checkbox/internal/checkbox.d.ts +1 -1
- package/checkbox/internal/checkbox.js +2 -5
- package/checkbox/internal/checkbox.js.map +1 -1
- package/chips/internal/chip.d.ts +3 -1
- package/chips/internal/chip.js +4 -5
- package/chips/internal/chip.js.map +1 -1
- package/dialog/internal/dialog.d.ts +3 -1
- package/dialog/internal/dialog.js +4 -5
- package/dialog/internal/dialog.js.map +1 -1
- package/fab/internal/shared.d.ts +3 -1
- package/fab/internal/shared.js +4 -5
- package/fab/internal/shared.js.map +1 -1
- package/field/internal/field.js +2 -2
- package/field/internal/field.js.map +1 -1
- package/iconbutton/internal/icon-button.d.ts +1 -1
- package/iconbutton/internal/icon-button.js +2 -3
- package/iconbutton/internal/icon-button.js.map +1 -1
- package/internal/aria/aria.js +1 -1
- package/internal/aria/aria.js.map +1 -1
- package/internal/aria/delegate.d.ts +34 -17
- package/internal/aria/delegate.js +149 -26
- package/internal/aria/delegate.js.map +1 -1
- package/labs/navigationbar/internal/navigation-bar.d.ts +3 -1
- package/labs/navigationbar/internal/navigation-bar.js +4 -5
- package/labs/navigationbar/internal/navigation-bar.js.map +1 -1
- package/labs/navigationdrawer/internal/navigation-drawer-modal.d.ts +3 -1
- package/labs/navigationdrawer/internal/navigation-drawer-modal.js +4 -5
- package/labs/navigationdrawer/internal/navigation-drawer-modal.js.map +1 -1
- package/labs/navigationdrawer/internal/navigation-drawer.d.ts +3 -1
- package/labs/navigationdrawer/internal/navigation-drawer.js +4 -5
- package/labs/navigationdrawer/internal/navigation-drawer.js.map +1 -1
- package/labs/navigationtab/internal/navigation-tab.d.ts +3 -1
- package/labs/navigationtab/internal/navigation-tab.js +4 -5
- package/labs/navigationtab/internal/navigation-tab.js.map +1 -1
- package/labs/segmentedbutton/internal/segmented-button.d.ts +3 -1
- package/labs/segmentedbutton/internal/segmented-button.js +4 -5
- package/labs/segmentedbutton/internal/segmented-button.js.map +1 -1
- package/labs/segmentedbuttonset/internal/segmented-button-set.d.ts +3 -1
- package/labs/segmentedbuttonset/internal/segmented-button-set.js +4 -5
- package/labs/segmentedbuttonset/internal/segmented-button-set.js.map +1 -1
- package/list/internal/listitem/list-item.d.ts +3 -1
- package/list/internal/listitem/list-item.js +4 -5
- package/list/internal/listitem/list-item.js.map +1 -1
- package/menu/internal/menuitem/menu-item.d.ts +3 -1
- package/menu/internal/menuitem/menu-item.js +4 -5
- package/menu/internal/menuitem/menu-item.js.map +1 -1
- package/migrations/v2/query-selector-aria.d.ts +22 -0
- package/migrations/v2/query-selector-aria.js +30 -0
- package/migrations/v2/query-selector-aria.js.map +1 -0
- package/package.json +1 -1
- package/progress/internal/progress.d.ts +3 -1
- package/progress/internal/progress.js +4 -5
- package/progress/internal/progress.js.map +1 -1
- package/select/internal/select.d.ts +1 -1
- package/select/internal/select.js +2 -5
- package/select/internal/select.js.map +1 -1
- package/select/internal/selectoption/select-option.d.ts +2 -1
- package/select/internal/selectoption/select-option.js +4 -5
- package/select/internal/selectoption/select-option.js.map +1 -1
- package/slider/internal/slider.d.ts +1 -1
- package/slider/internal/slider.js +3 -6
- package/slider/internal/slider.js.map +1 -1
- package/switch/internal/switch.d.ts +1 -1
- package/switch/internal/switch.js +2 -5
- package/switch/internal/switch.js.map +1 -1
- package/tabs/internal/tabs.js +1 -1
- package/tabs/internal/tabs.js.map +1 -1
- package/textfield/internal/text-field.d.ts +1 -1
- package/textfield/internal/text-field.js +2 -5
- package/textfield/internal/text-field.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation-bar.js","sourceRoot":"","sources":["navigation-bar.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,iCAAiC,CAAC;AAEzC,OAAO,EAAC,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AAI,KAAK,CAAC,CAAC;QACrE,IAAI,aAAa,IAAI,eAAe,KAAK,CAAC,EAAE;YAC1C,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,CAAC;YAC5B,OAAO;SACR;QACD,IAAI,aAAa,EAAE;YACjB,IAAI,CAAC,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;YACvC,OAAO;SACR;IACH,CAAC;IAEO,mBAAmB,CAAC,KAAa;QACvC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YACrB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;SACjE;QACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACzC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,KAAK,KAAK,CAAC;SACnC;IACH,CAAC;IAEO,0BAA0B,CAAC,KAAc;QAC/C,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE;YAC3B,GAAG,CAAC,iBAAiB,GAAG,KAAK,CAAC;SAC/B;IACH,CAAC;CACF;AAvIsD;IAApD,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAC,CAAC;kDAAiB;AAGrE;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAC,CAAC;yDAClC;AAKV;IADhB,qBAAqB,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;kDACQ","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../../elevation/elevation.js';\n\nimport {html, LitElement, nothing, PropertyValues} from 'lit';\nimport {property, queryAssignedElements} from 'lit/decorators.js';\n\nimport {ARIAMixinStrict} from '../../../internal/aria/aria.js';\nimport {mixinDelegatesAria} from '../../../internal/aria/delegate.js';\nimport {isRtl} from '../../../internal/controller/is-rtl.js';\nimport {NavigationTab} from '../../navigationtab/internal/navigation-tab.js';\n\nimport {NavigationTabInteractionEvent} from './constants.js';\nimport {NavigationBarState} from './state.js';\n\n// Separate variable needed for closure.\nconst navigationBarBaseClass = mixinDelegatesAria(LitElement);\n\n/**\n * b/265346501 - add docs\n *\n * @fires navigation-bar-activated {CustomEvent<tab: NavigationTab, activeIndex: number>}\n * Dispatched whenever the `activeIndex` changes. --bubbles --composed\n */\nexport class NavigationBar\n extends navigationBarBaseClass\n implements NavigationBarState\n{\n @property({type: Number, attribute: 'active-index'}) activeIndex = 0;\n\n @property({type: Boolean, attribute: 'hide-inactive-labels'})\n hideInactiveLabels = false;\n\n tabs: NavigationTab[] = [];\n\n @queryAssignedElements({flatten: true})\n private readonly tabsElement!: NavigationTab[];\n\n protected override render() {\n // Needed for closure conformance\n const {ariaLabel} = this as ARIAMixinStrict;\n return html`<div\n class=\"md3-navigation-bar\"\n role=\"tablist\"\n aria-label=${ariaLabel || nothing}\n @keydown=\"${this.handleKeydown}\"\n @navigation-tab-interaction=\"${this.handleNavigationTabInteraction}\"\n @navigation-tab-rendered=${this.handleNavigationTabConnected}\n ><md-elevation part=\"elevation\"></md-elevation\n ><div class=\"md3-navigation-bar__tabs-slot-container\"><slot></slot></div\n ></div>`;\n }\n\n protected override updated(changedProperties: PropertyValues<NavigationBar>) {\n if (changedProperties.has('activeIndex')) {\n this.onActiveIndexChange(this.activeIndex);\n this.dispatchEvent(\n new CustomEvent('navigation-bar-activated', {\n detail: {\n tab: this.tabs[this.activeIndex],\n activeIndex: this.activeIndex,\n },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n if (changedProperties.has('hideInactiveLabels')) {\n this.onHideInactiveLabelsChange(this.hideInactiveLabels);\n }\n\n if (changedProperties.has('tabs')) {\n this.onHideInactiveLabelsChange(this.hideInactiveLabels);\n this.onActiveIndexChange(this.activeIndex);\n }\n }\n\n override firstUpdated(changedProperties: PropertyValues) {\n super.firstUpdated(changedProperties);\n this.layout();\n }\n\n layout() {\n if (!this.tabsElement) return;\n const navTabs: NavigationTab[] = [];\n for (const node of this.tabsElement) {\n navTabs.push(node);\n }\n this.tabs = navTabs;\n }\n\n private handleNavigationTabConnected(event: CustomEvent) {\n const target = event.target as NavigationTab;\n if (this.tabs.indexOf(target) === -1) {\n this.layout();\n }\n }\n\n private handleNavigationTabInteraction(event: NavigationTabInteractionEvent) {\n this.activeIndex = this.tabs.indexOf(event.detail.state as NavigationTab);\n }\n\n private handleKeydown(event: KeyboardEvent) {\n const key = event.key;\n const focusedTabIndex = this.tabs.findIndex((tab) => {\n return tab.matches(':focus-within');\n });\n const isRTL = isRtl(this);\n const maxIndex = this.tabs.length - 1;\n\n if (key === 'Enter' || key === ' ') {\n this.activeIndex = focusedTabIndex;\n return;\n }\n\n if (key === 'Home') {\n this.tabs[0].focus();\n return;\n }\n\n if (key === 'End') {\n this.tabs[maxIndex].focus();\n return;\n }\n\n const toNextTab =\n (key === 'ArrowRight' && !isRTL) || (key === 'ArrowLeft' && isRTL);\n if (toNextTab && focusedTabIndex === maxIndex) {\n this.tabs[0].focus();\n return;\n }\n if (toNextTab) {\n this.tabs[focusedTabIndex + 1].focus();\n return;\n }\n\n const toPreviousTab =\n (key === 'ArrowLeft' && !isRTL) || (key === 'ArrowRight' && isRTL);\n if (toPreviousTab && focusedTabIndex === 0) {\n this.tabs[maxIndex].focus();\n return;\n }\n if (toPreviousTab) {\n this.tabs[focusedTabIndex - 1].focus();\n return;\n }\n }\n\n private onActiveIndexChange(value: number) {\n if (!this.tabs[value]) {\n throw new Error('NavigationBar: activeIndex is out of bounds.');\n }\n for (let i = 0; i < this.tabs.length; i++) {\n this.tabs[i].active = i === value;\n }\n }\n\n private onHideInactiveLabelsChange(value: boolean) {\n for (const tab of this.tabs) {\n tab.hideInactiveLabel = value;\n }\n }\n}\n"]}
|
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { LitElement, PropertyValues } from 'lit';
|
|
7
|
+
declare const navigationDrawerModalBaseClass: import("../../behaviors/mixin.js").MixinReturn<typeof LitElement>;
|
|
7
8
|
/**
|
|
8
9
|
* b/265346501 - add docs
|
|
9
10
|
*
|
|
10
11
|
* @fires navigation-drawer-changed {CustomEvent<{opened: boolean}>}
|
|
11
12
|
* Dispatched whenever the drawer opens or closes --bubbles --composed
|
|
12
13
|
*/
|
|
13
|
-
export declare class NavigationDrawerModal extends
|
|
14
|
+
export declare class NavigationDrawerModal extends navigationDrawerModalBaseClass {
|
|
14
15
|
opened: boolean;
|
|
15
16
|
pivot: 'start' | 'end';
|
|
16
17
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
@@ -20,3 +21,4 @@ export declare class NavigationDrawerModal extends LitElement {
|
|
|
20
21
|
private handleKeyDown;
|
|
21
22
|
private handleScrimClick;
|
|
22
23
|
}
|
|
24
|
+
export {};
|
|
@@ -7,14 +7,16 @@ import { __decorate } from "tslib";
|
|
|
7
7
|
import { html, LitElement, nothing } from 'lit';
|
|
8
8
|
import { property } from 'lit/decorators.js';
|
|
9
9
|
import { classMap } from 'lit/directives/class-map.js';
|
|
10
|
-
import {
|
|
10
|
+
import { mixinDelegatesAria } from '../../../internal/aria/delegate.js';
|
|
11
|
+
// Separate variable needed for closure.
|
|
12
|
+
const navigationDrawerModalBaseClass = mixinDelegatesAria(LitElement);
|
|
11
13
|
/**
|
|
12
14
|
* b/265346501 - add docs
|
|
13
15
|
*
|
|
14
16
|
* @fires navigation-drawer-changed {CustomEvent<{opened: boolean}>}
|
|
15
17
|
* Dispatched whenever the drawer opens or closes --bubbles --composed
|
|
16
18
|
*/
|
|
17
|
-
export class NavigationDrawerModal extends
|
|
19
|
+
export class NavigationDrawerModal extends navigationDrawerModalBaseClass {
|
|
18
20
|
constructor() {
|
|
19
21
|
super(...arguments);
|
|
20
22
|
this.opened = false;
|
|
@@ -76,9 +78,6 @@ export class NavigationDrawerModal extends LitElement {
|
|
|
76
78
|
this.opened = !this.opened;
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
|
-
(() => {
|
|
80
|
-
requestUpdateOnAriaChange(NavigationDrawerModal);
|
|
81
|
-
})();
|
|
82
81
|
__decorate([
|
|
83
82
|
property({ type: Boolean })
|
|
84
83
|
], NavigationDrawerModal.prototype, "opened", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation-drawer-modal.js","sourceRoot":"","sources":["navigation-drawer-modal.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAiB,MAAM,KAAK,CAAC;AAC9D,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAGrD,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"navigation-drawer-modal.js","sourceRoot":"","sources":["navigation-drawer-modal.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAiB,MAAM,KAAK,CAAC;AAC9D,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAGrD,OAAO,EAAC,kBAAkB,EAAC,MAAM,oCAAoC,CAAC;AAEtE,wCAAwC;AACxC,MAAM,8BAA8B,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;AAEtE;;;;;GAKG;AACH,MAAM,OAAO,qBAAsB,SAAQ,8BAA8B;IAAzE;;QAC6B,WAAM,GAAG,KAAK,CAAC;QAC9B,UAAK,GAAoB,KAAK,CAAC;IAkE7C,CAAC;IAhEoB,MAAM;QACvB,MAAM,YAAY,GAAG,IAAI,C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AK,CAAC;SACrB;IACH,CAAC;IAEO,gBAAgB;QACtB,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC;IAC7B,CAAC;CACF;AAnE4B;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;qDAAgB;AAC9B;IAAX,QAAQ,EAAE;oDAAgC","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {html, LitElement, nothing, PropertyValues} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\n\nimport {ARIAMixinStrict} from '../../../internal/aria/aria.js';\nimport {mixinDelegatesAria} from '../../../internal/aria/delegate.js';\n\n// Separate variable needed for closure.\nconst navigationDrawerModalBaseClass = mixinDelegatesAria(LitElement);\n\n/**\n * b/265346501 - add docs\n *\n * @fires navigation-drawer-changed {CustomEvent<{opened: boolean}>}\n * Dispatched whenever the drawer opens or closes --bubbles --composed\n */\nexport class NavigationDrawerModal extends navigationDrawerModalBaseClass {\n @property({type: Boolean}) opened = false;\n @property() pivot: 'start' | 'end' = 'end';\n\n protected override render() {\n const ariaExpanded = this.opened ? 'true' : 'false';\n const ariaHidden = !this.opened ? 'true' : 'false';\n // Needed for closure conformance\n const {ariaLabel, ariaModal} = this as ARIAMixinStrict;\n return html`\n <div\n class=\"md3-navigation-drawer-modal__scrim ${this.getScrimClasses()}\"\n @click=\"${this.handleScrimClick}\">\n </div>\n <div\n aria-expanded=${ariaExpanded}\n aria-hidden=${ariaHidden}\n aria-label=${ariaLabel || nothing}\n aria-modal=${ariaModal || nothing}\n class=\"md3-navigation-drawer-modal ${this.getRenderClasses()}\"\n @keydown=\"${this.handleKeyDown}\"\n role=\"dialog\"\n ><div class=\"md3-elevation-overlay\"></div>\n <div class=\"md3-navigation-drawer-modal__slot-content\">\n <slot></slot>\n </div>\n </div>\n `;\n }\n\n private getScrimClasses() {\n return classMap({\n 'md3-navigation-drawer-modal--scrim-visible': this.opened,\n });\n }\n\n private getRenderClasses() {\n return classMap({\n 'md3-navigation-drawer-modal--opened': this.opened,\n 'md3-navigation-drawer-modal--pivot-at-start': this.pivot === 'start',\n });\n }\n\n protected override updated(\n changedProperties: PropertyValues<NavigationDrawerModal>,\n ) {\n if (changedProperties.has('opened')) {\n setTimeout(() => {\n this.dispatchEvent(\n new CustomEvent('navigation-drawer-changed', {\n detail: {opened: this.opened},\n bubbles: true,\n composed: true,\n }),\n );\n }, 250);\n }\n }\n\n private handleKeyDown(event: KeyboardEvent) {\n if (event.code === 'Escape') {\n this.opened = false;\n }\n }\n\n private handleScrimClick() {\n this.opened = !this.opened;\n }\n}\n"]}
|
|
@@ -5,16 +5,18 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import '../../../elevation/elevation.js';
|
|
7
7
|
import { LitElement, PropertyValues } from 'lit';
|
|
8
|
+
declare const navigationDrawerBaseClass: import("../../behaviors/mixin.js").MixinReturn<typeof LitElement>;
|
|
8
9
|
/**
|
|
9
10
|
* b/265346501 - add docs
|
|
10
11
|
*
|
|
11
12
|
* @fires navigation-drawer-changed {CustomEvent<{opened: boolean}>}
|
|
12
13
|
* Dispatched whenever the drawer opens or closes --bubbles --composed
|
|
13
14
|
*/
|
|
14
|
-
export declare class NavigationDrawer extends
|
|
15
|
+
export declare class NavigationDrawer extends navigationDrawerBaseClass {
|
|
15
16
|
opened: boolean;
|
|
16
17
|
pivot: 'start' | 'end';
|
|
17
18
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
18
19
|
private getRenderClasses;
|
|
19
20
|
protected updated(changedProperties: PropertyValues<NavigationDrawer>): void;
|
|
20
21
|
}
|
|
22
|
+
export {};
|
|
@@ -8,14 +8,16 @@ import '../../../elevation/elevation.js';
|
|
|
8
8
|
import { html, LitElement, nothing } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
import { classMap } from 'lit/directives/class-map.js';
|
|
11
|
-
import {
|
|
11
|
+
import { mixinDelegatesAria } from '../../../internal/aria/delegate.js';
|
|
12
|
+
// Separate variable needed for closure.
|
|
13
|
+
const navigationDrawerBaseClass = mixinDelegatesAria(LitElement);
|
|
12
14
|
/**
|
|
13
15
|
* b/265346501 - add docs
|
|
14
16
|
*
|
|
15
17
|
* @fires navigation-drawer-changed {CustomEvent<{opened: boolean}>}
|
|
16
18
|
* Dispatched whenever the drawer opens or closes --bubbles --composed
|
|
17
19
|
*/
|
|
18
|
-
export class NavigationDrawer extends
|
|
20
|
+
export class NavigationDrawer extends navigationDrawerBaseClass {
|
|
19
21
|
constructor() {
|
|
20
22
|
super(...arguments);
|
|
21
23
|
this.opened = false;
|
|
@@ -59,9 +61,6 @@ export class NavigationDrawer extends LitElement {
|
|
|
59
61
|
}
|
|
60
62
|
}
|
|
61
63
|
}
|
|
62
|
-
(() => {
|
|
63
|
-
requestUpdateOnAriaChange(NavigationDrawer);
|
|
64
|
-
})();
|
|
65
64
|
__decorate([
|
|
66
65
|
property({ type: Boolean })
|
|
67
66
|
], NavigationDrawer.prototype, "opened", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation-drawer.js","sourceRoot":"","sources":["navigation-drawer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,iCAAiC,CAAC;AAEzC,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAiB,MAAM,KAAK,CAAC;AAC9D,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAGrD,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"navigation-drawer.js","sourceRoot":"","sources":["navigation-drawer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,iCAAiC,CAAC;AAEzC,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAiB,MAAM,KAAK,CAAC;AAC9D,OAAO,E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O,EAAE,IAAI;oBACb,QAAQ,EAAE,IAAI;iBACf,CAAC,CACH,CAAC;YACJ,CAAC,EAAE,GAAG,CAAC,CAAC;SACT;IACH,CAAC;CACF;AA9C4B;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;gDAAgB;AAC9B;IAAX,QAAQ,EAAE;+CAAgC","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../../elevation/elevation.js';\n\nimport {html, LitElement, nothing, PropertyValues} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\n\nimport {ARIAMixinStrict} from '../../../internal/aria/aria.js';\nimport {mixinDelegatesAria} from '../../../internal/aria/delegate.js';\n\n// Separate variable needed for closure.\nconst navigationDrawerBaseClass = mixinDelegatesAria(LitElement);\n\n/**\n * b/265346501 - add docs\n *\n * @fires navigation-drawer-changed {CustomEvent<{opened: boolean}>}\n * Dispatched whenever the drawer opens or closes --bubbles --composed\n */\nexport class NavigationDrawer extends navigationDrawerBaseClass {\n @property({type: Boolean}) opened = false;\n @property() pivot: 'start' | 'end' = 'end';\n\n protected override render() {\n const ariaExpanded = this.opened ? 'true' : 'false';\n const ariaHidden = !this.opened ? 'true' : 'false';\n // Needed for closure conformance\n const {ariaLabel, ariaModal} = this as ARIAMixinStrict;\n return html`\n <div\n aria-expanded=\"${ariaExpanded}\"\n aria-hidden=\"${ariaHidden}\"\n aria-label=${ariaLabel || nothing}\n aria-modal=\"${ariaModal || nothing}\"\n class=\"md3-navigation-drawer ${this.getRenderClasses()}\"\n role=\"dialog\">\n <md-elevation part=\"elevation\"></md-elevation>\n <div class=\"md3-navigation-drawer__slot-content\">\n <slot></slot>\n </div>\n </div>\n `;\n }\n\n private getRenderClasses() {\n return classMap({\n 'md3-navigation-drawer--opened': this.opened,\n 'md3-navigation-drawer--pivot-at-start': this.pivot === 'start',\n });\n }\n\n protected override updated(\n changedProperties: PropertyValues<NavigationDrawer>,\n ) {\n if (changedProperties.has('opened')) {\n setTimeout(() => {\n this.dispatchEvent(\n new CustomEvent('navigation-drawer-changed', {\n detail: {opened: this.opened},\n bubbles: true,\n composed: true,\n }),\n );\n }, 250);\n }\n }\n}\n"]}
|
|
@@ -8,6 +8,7 @@ import '../../../ripple/ripple.js';
|
|
|
8
8
|
import '../../badge/badge.js';
|
|
9
9
|
import { LitElement, PropertyValues } from 'lit';
|
|
10
10
|
import { NavigationTabState } from './state.js';
|
|
11
|
+
declare const navigationTabBaseClass: import("../../behaviors/mixin.js").MixinReturn<typeof LitElement>;
|
|
11
12
|
/**
|
|
12
13
|
* b/265346501 - add docs
|
|
13
14
|
*
|
|
@@ -17,7 +18,7 @@ import { NavigationTabState } from './state.js';
|
|
|
17
18
|
* @fires navigation-tab-interaction {CustomEvent<{state: MdNavigationTab}>}
|
|
18
19
|
* Dispatched when the navigation tab has been clicked. --bubbles --composed
|
|
19
20
|
*/
|
|
20
|
-
export declare class NavigationTab extends
|
|
21
|
+
export declare class NavigationTab extends navigationTabBaseClass implements NavigationTabState {
|
|
21
22
|
disabled: boolean;
|
|
22
23
|
active: boolean;
|
|
23
24
|
hideInactiveLabel: boolean;
|
|
@@ -34,3 +35,4 @@ export declare class NavigationTab extends LitElement implements NavigationTabSt
|
|
|
34
35
|
blur(): void;
|
|
35
36
|
handleClick(): void;
|
|
36
37
|
}
|
|
38
|
+
export {};
|
|
@@ -10,7 +10,9 @@ import '../../badge/badge.js';
|
|
|
10
10
|
import { html, LitElement, nothing } from 'lit';
|
|
11
11
|
import { property, query } from 'lit/decorators.js';
|
|
12
12
|
import { classMap } from 'lit/directives/class-map.js';
|
|
13
|
-
import {
|
|
13
|
+
import { mixinDelegatesAria } from '../../../internal/aria/delegate.js';
|
|
14
|
+
// Separate variable needed for closure.
|
|
15
|
+
const navigationTabBaseClass = mixinDelegatesAria(LitElement);
|
|
14
16
|
/**
|
|
15
17
|
* b/265346501 - add docs
|
|
16
18
|
*
|
|
@@ -20,7 +22,7 @@ import { requestUpdateOnAriaChange } from '../../../internal/aria/delegate.js';
|
|
|
20
22
|
* @fires navigation-tab-interaction {CustomEvent<{state: MdNavigationTab}>}
|
|
21
23
|
* Dispatched when the navigation tab has been clicked. --bubbles --composed
|
|
22
24
|
*/
|
|
23
|
-
export class NavigationTab extends
|
|
25
|
+
export class NavigationTab extends navigationTabBaseClass {
|
|
24
26
|
constructor() {
|
|
25
27
|
super(...arguments);
|
|
26
28
|
this.disabled = false;
|
|
@@ -106,9 +108,6 @@ export class NavigationTab extends LitElement {
|
|
|
106
108
|
}));
|
|
107
109
|
}
|
|
108
110
|
}
|
|
109
|
-
(() => {
|
|
110
|
-
requestUpdateOnAriaChange(NavigationTab);
|
|
111
|
-
})();
|
|
112
111
|
__decorate([
|
|
113
112
|
property({ type: Boolean })
|
|
114
113
|
], NavigationTab.prototype, "disabled", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation-tab.js","sourceRoot":"","sources":["navigation-tab.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,iCAAiC,CAAC;AACzC,OAAO,2BAA2B,CAAC;AACnC,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAiB,MAAM,KAAK,CAAC;AAC9D,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAGrD,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"navigation-tab.js","sourceRoot":"","sources":["navigation-tab.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,iCAAiC,CAAC;AACzC,OAAO,2BAA2B,CAAC;AACnC,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAiB,MAAM,KAAK,CAAC;AAC9D,O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AAE,SAAS,EAAE,qBAAqB,EAAC,CAAC;wDAClC;AACd;IAAX,QAAQ,EAAE;4CAAgB;AACW;IAArC,QAAQ,CAAC,EAAC,SAAS,EAAE,aAAa,EAAC,CAAC;iDAAiB;AACF;IAAnD,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAC,CAAC;gDAAmB;AAErD;IAAhB,KAAK,CAAC,QAAQ,CAAC;oDAAoC","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../../focus/md-focus-ring.js';\nimport '../../../ripple/ripple.js';\nimport '../../badge/badge.js';\n\nimport {html, LitElement, nothing, PropertyValues} from 'lit';\nimport {property, query} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\n\nimport {ARIAMixinStrict} from '../../../internal/aria/aria.js';\nimport {mixinDelegatesAria} from '../../../internal/aria/delegate.js';\n\nimport {NavigationTabState} from './state.js';\n\n// Separate variable needed for closure.\nconst navigationTabBaseClass = mixinDelegatesAria(LitElement);\n\n/**\n * b/265346501 - add docs\n *\n * @fires navigation-tab-rendered {Event} Dispatched when the navigation tab's\n * DOM has rendered and custom element definition has loaded. --bubbles\n * --composed\n * @fires navigation-tab-interaction {CustomEvent<{state: MdNavigationTab}>}\n * Dispatched when the navigation tab has been clicked. --bubbles --composed\n */\nexport class NavigationTab\n extends navigationTabBaseClass\n implements NavigationTabState\n{\n @property({type: Boolean}) disabled = false;\n @property({type: Boolean, reflect: true}) active = false;\n @property({type: Boolean, attribute: 'hide-inactive-label'})\n hideInactiveLabel = false;\n @property() label?: string;\n @property({attribute: 'badge-value'}) badgeValue = '';\n @property({type: Boolean, attribute: 'show-badge'}) showBadge = false;\n\n @query('button') buttonElement!: HTMLElement | null;\n\n protected override render() {\n // Needed for closure conformance\n const {ariaLabel} = this as ARIAMixinStrict;\n return html` <button\n class=\"md3-navigation-tab ${classMap(this.getRenderClasses())}\"\n role=\"tab\"\n aria-selected=\"${this.active}\"\n aria-label=${ariaLabel || nothing}\n tabindex=\"${this.active ? 0 : -1}\"\n @click=\"${this.handleClick}\">\n <md-focus-ring part=\"focus-ring\" inward></md-focus-ring>\n <md-ripple\n ?disabled=\"${this.disabled}\"\n class=\"md3-navigation-tab__ripple\"></md-ripple>\n <span aria-hidden=\"true\" class=\"md3-navigation-tab__icon-content\"\n ><span class=\"md3-navigation-tab__active-indicator\"></span\n ><span class=\"md3-navigation-tab__icon\"\n ><slot name=\"inactive-icon\"></slot\n ></span>\n <span class=\"md3-navigation-tab__icon md3-navigation-tab__icon--active\"\n ><slot name=\"active-icon\"></slot></span\n >${this.renderBadge()}</span\n >${this.renderLabel()}\n </button>`;\n }\n\n private getRenderClasses() {\n return {\n 'md3-navigation-tab--hide-inactive-label': this.hideInactiveLabel,\n 'md3-navigation-tab--active': this.active,\n };\n }\n\n private renderBadge() {\n return this.showBadge\n ? html`<md-badge .value=\"${this.badgeValue}\"></md-badge>`\n : nothing;\n }\n\n private renderLabel() {\n // Needed for closure conformance\n const {ariaLabel} = this as ARIAMixinStrict;\n const ariaHidden = ariaLabel ? 'true' : 'false';\n return !this.label\n ? nothing\n : html` <span\n aria-hidden=\"${ariaHidden}\"\n class=\"md3-navigation-tab__label-text\"\n >${this.label}</span\n >`;\n }\n\n override firstUpdated(changedProperties: PropertyValues) {\n super.firstUpdated(changedProperties);\n const event = new Event('navigation-tab-rendered', {\n bubbles: true,\n composed: true,\n });\n this.dispatchEvent(event);\n }\n\n override focus() {\n const buttonElement = this.buttonElement;\n if (buttonElement) {\n buttonElement.focus();\n }\n }\n\n override blur() {\n const buttonElement = this.buttonElement;\n if (buttonElement) {\n buttonElement.blur();\n }\n }\n\n handleClick() {\n // b/269772145 - connect to ripple\n this.dispatchEvent(\n new CustomEvent('navigation-tab-interaction', {\n detail: {state: this},\n bubbles: true,\n composed: true,\n }),\n );\n }\n}\n"]}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import '../../../focus/md-focus-ring.js';
|
|
7
7
|
import '../../../ripple/ripple.js';
|
|
8
8
|
import { LitElement, nothing, PropertyValues, TemplateResult } from 'lit';
|
|
9
|
+
declare const segmentedButtonBaseClass: import("../../behaviors/mixin.js").MixinReturn<typeof LitElement>;
|
|
9
10
|
/**
|
|
10
11
|
* SegmentedButton is a web component implementation of the Material Design
|
|
11
12
|
* segmented button component. It is intended **only** for use as a child of a
|
|
@@ -15,7 +16,7 @@ import { LitElement, nothing, PropertyValues, TemplateResult } from 'lit';
|
|
|
15
16
|
* @fires segmented-button-interaction {Event} Dispatched whenever a button is
|
|
16
17
|
* clicked. --bubbles --composed
|
|
17
18
|
*/
|
|
18
|
-
export declare class SegmentedButton extends
|
|
19
|
+
export declare class SegmentedButton extends segmentedButtonBaseClass {
|
|
19
20
|
disabled: boolean;
|
|
20
21
|
selected: boolean;
|
|
21
22
|
label: string;
|
|
@@ -45,3 +46,4 @@ export declare class SegmentedButton extends LitElement {
|
|
|
45
46
|
private renderLabel;
|
|
46
47
|
private renderTouchTarget;
|
|
47
48
|
}
|
|
49
|
+
export {};
|
|
@@ -9,7 +9,9 @@ import '../../../ripple/ripple.js';
|
|
|
9
9
|
import { html, LitElement, nothing } from 'lit';
|
|
10
10
|
import { property, queryAssignedElements, state } from 'lit/decorators.js';
|
|
11
11
|
import { classMap } from 'lit/directives/class-map.js';
|
|
12
|
-
import {
|
|
12
|
+
import { mixinDelegatesAria } from '../../../internal/aria/delegate.js';
|
|
13
|
+
// Separate variable needed for closure.
|
|
14
|
+
const segmentedButtonBaseClass = mixinDelegatesAria(LitElement);
|
|
13
15
|
/**
|
|
14
16
|
* SegmentedButton is a web component implementation of the Material Design
|
|
15
17
|
* segmented button component. It is intended **only** for use as a child of a
|
|
@@ -19,7 +21,7 @@ import { requestUpdateOnAriaChange } from '../../../internal/aria/delegate.js';
|
|
|
19
21
|
* @fires segmented-button-interaction {Event} Dispatched whenever a button is
|
|
20
22
|
* clicked. --bubbles --composed
|
|
21
23
|
*/
|
|
22
|
-
export class SegmentedButton extends
|
|
24
|
+
export class SegmentedButton extends segmentedButtonBaseClass {
|
|
23
25
|
constructor() {
|
|
24
26
|
super(...arguments);
|
|
25
27
|
this.disabled = false;
|
|
@@ -144,9 +146,6 @@ export class SegmentedButton extends LitElement {
|
|
|
144
146
|
return html `<span class="md3-segmented-button__touch"></span>`;
|
|
145
147
|
}
|
|
146
148
|
}
|
|
147
|
-
(() => {
|
|
148
|
-
requestUpdateOnAriaChange(SegmentedButton);
|
|
149
|
-
})();
|
|
150
149
|
__decorate([
|
|
151
150
|
property({ type: Boolean })
|
|
152
151
|
], SegmentedButton.prototype, "disabled", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segmented-button.js","sourceRoot":"","sources":["segmented-button.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,iCAAiC,CAAC;AACzC,OAAO,2BAA2B,CAAC;AAEnC,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAiC,MAAM,KAAK,CAAC;AAC9E,OAAO,EAAC,QAAQ,EAAE,qBAAqB,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAGrD,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"segmented-button.js","sourceRoot":"","sources":["segmented-button.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,iCAAiC,CAAC;AACzC,OAAO,2BAA2B,CAAC;AAEnC,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAiC,MAAM,KAAK,CAAC;AAC9E,OAAO,EAAC,QAAQ,EAAE,qBAAqB,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAGrD,OAAO,EAAC,kBAAkB,EAAC,MAAM,oCAAoC,CAAC;AAEtE,wC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AAC;IAEO,yBAAyB;QAC/B,OAAO,IAAI,CAAA;;;;;;;;;;;;;;KAcV,CAAC;IACJ,CAAC;IAEO,sBAAsB;QAC5B,OAAO,IAAI,CAAA;;;;;;;;;;;;;;KAcV,CAAC;IACJ,CAAC;IAEO,WAAW;QACjB,OAAO,IAAI,CAAA;uDACwC,IAAI,CAAC,KAAK;KAC5D,CAAC;IACJ,CAAC;IAEO,iBAAiB;QACvB,OAAO,IAAI,CAAA,mDAAmD,CAAC;IACjE,CAAC;CACF;AAxI4B;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;iDAAkB;AACjB;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;iDAAkB;AAChC;IAAX,QAAQ,EAAE;8CAAY;AAC+B;IAArD,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAC,CAAC;oDAAqB;AACxB;IAAjD,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAC,CAAC;gDAAiB;AAEjD;IAAhB,KAAK,EAAE;kDAAwB;AAEf;IADhB,qBAAqB,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;oDACR","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../../focus/md-focus-ring.js';\nimport '../../../ripple/ripple.js';\n\nimport {html, LitElement, nothing, PropertyValues, TemplateResult} from 'lit';\nimport {property, queryAssignedElements, state} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\n\nimport {ARIAMixinStrict} from '../../../internal/aria/aria.js';\nimport {mixinDelegatesAria} from '../../../internal/aria/delegate.js';\n\n// Separate variable needed for closure.\nconst segmentedButtonBaseClass = mixinDelegatesAria(LitElement);\n\n/**\n * SegmentedButton is a web component implementation of the Material Design\n * segmented button component. It is intended **only** for use as a child of a\n * `SementedButtonSet` component. It is **not** intended for use in any other\n * context.\n *\n * @fires segmented-button-interaction {Event} Dispatched whenever a button is\n * clicked. --bubbles --composed\n */\nexport class SegmentedButton extends segmentedButtonBaseClass {\n @property({type: Boolean}) disabled = false;\n @property({type: Boolean}) selected = false;\n @property() label = '';\n @property({type: Boolean, attribute: 'no-checkmark'}) noCheckmark = false;\n @property({type: Boolean, attribute: 'has-icon'}) hasIcon = false;\n\n @state() private animState = '';\n @queryAssignedElements({slot: 'icon', flatten: true})\n private readonly iconElement!: HTMLElement[];\n\n protected override update(props: PropertyValues<SegmentedButton>) {\n this.animState = this.nextAnimationState(props);\n super.update(props);\n // NOTE: This needs to be set *after* calling super.update() to ensure the\n // appropriate CSS classes are applied.\n this.hasIcon = this.iconElement.length > 0;\n }\n\n private nextAnimationState(\n changedProps: PropertyValues<SegmentedButton>,\n ): string {\n const prevSelected = changedProps.get('selected');\n // Early exit for first update.\n if (prevSelected === undefined) return '';\n\n const nextSelected = this.selected;\n const nextHasCheckmark = !this.noCheckmark;\n if (!prevSelected && nextSelected && nextHasCheckmark) {\n return 'selecting';\n }\n if (prevSelected && !nextSelected && nextHasCheckmark) {\n return 'deselecting';\n }\n return '';\n }\n\n private handleClick() {\n const event = new Event('segmented-button-interaction', {\n bubbles: true,\n composed: true,\n });\n this.dispatchEvent(event);\n }\n\n protected override render() {\n // Needed for closure conformance\n const {ariaLabel} = this as ARIAMixinStrict;\n return html`\n <button\n tabindex=\"${this.disabled ? '-1' : '0'}\"\n aria-label=${ariaLabel || nothing}\n aria-pressed=${this.selected}\n ?disabled=${this.disabled}\n @click=\"${this.handleClick}\"\n class=\"md3-segmented-button ${classMap(this.getRenderClasses())}\">\n <md-focus-ring\n class=\"md3-segmented-button__focus-ring\"\n part=\"focus-ring\"></md-focus-ring>\n <md-ripple\n ?disabled=\"${this.disabled}\"\n class=\"md3-segmented-button__ripple\"></md-ripple>\n ${this.renderOutline()} ${this.renderLeading()} ${this.renderLabel()}\n ${this.renderTouchTarget()}\n </button>\n `;\n }\n\n protected getRenderClasses() {\n return {\n 'md3-segmented-button--selected': this.selected,\n 'md3-segmented-button--unselected': !this.selected,\n 'md3-segmented-button--with-label': this.label !== '',\n 'md3-segmented-button--without-label': this.label === '',\n 'md3-segmented-button--with-icon': this.hasIcon,\n 'md3-segmented-button--with-checkmark': !this.noCheckmark,\n 'md3-segmented-button--without-checkmark': this.noCheckmark,\n 'md3-segmented-button--selecting': this.animState === 'selecting',\n 'md3-segmented-button--deselecting': this.animState === 'deselecting',\n };\n }\n\n protected renderOutline(): TemplateResult | typeof nothing {\n return nothing;\n }\n\n private renderLeading() {\n return this.label === ''\n ? this.renderLeadingWithoutLabel()\n : this.renderLeadingWithLabel();\n }\n\n private renderLeadingWithoutLabel() {\n return html`\n <span class=\"md3-segmented-button__leading\" aria-hidden=\"true\">\n <span class=\"md3-segmented-button__graphic\">\n <svg class=\"md3-segmented-button__checkmark\" viewBox=\"0 0 24 24\">\n <path\n class=\"md3-segmented-button__checkmark-path\"\n fill=\"none\"\n d=\"M1.73,12.91 8.1,19.28 22.79,4.59\"></path>\n </svg>\n </span>\n <span class=\"md3-segmented-button__icon\" aria-hidden=\"true\">\n <slot name=\"icon\"></slot>\n </span>\n </span>\n `;\n }\n\n private renderLeadingWithLabel() {\n return html`\n <span class=\"md3-segmented-button__leading\" aria-hidden=\"true\">\n <span class=\"md3-segmented-button__graphic\">\n <svg class=\"md3-segmented-button__checkmark\" viewBox=\"0 0 24 24\">\n <path\n class=\"md3-segmented-button__checkmark-path\"\n fill=\"none\"\n d=\"M1.73,12.91 8.1,19.28 22.79,4.59\"></path>\n </svg>\n <span class=\"md3-segmented-button__icon\" aria-hidden=\"true\">\n <slot name=\"icon\"></slot>\n </span>\n </span>\n </span>\n `;\n }\n\n private renderLabel() {\n return html`\n <span class=\"md3-segmented-button__label-text\">${this.label}</span>\n `;\n }\n\n private renderTouchTarget() {\n return html`<span class=\"md3-segmented-button__touch\"></span>`;\n }\n}\n"]}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { LitElement } from 'lit';
|
|
7
7
|
import { SegmentedButton } from '../../segmentedbutton/internal/segmented-button.js';
|
|
8
|
+
declare const segmentedButtonSetBaseClass: import("../../behaviors/mixin.js").MixinReturn<typeof LitElement>;
|
|
8
9
|
/**
|
|
9
10
|
* SegmentedButtonSet is the parent component for two or more
|
|
10
11
|
* `SegmentedButton` components. **Only** `SegmentedButton` components may be
|
|
@@ -15,7 +16,7 @@ import { SegmentedButton } from '../../segmentedbutton/internal/segmented-button
|
|
|
15
16
|
* `setButtonSelected` or the `toggleSelection` methods as well as on user
|
|
16
17
|
* interaction. --bubbles --composed
|
|
17
18
|
*/
|
|
18
|
-
export declare class SegmentedButtonSet extends
|
|
19
|
+
export declare class SegmentedButtonSet extends segmentedButtonSetBaseClass {
|
|
19
20
|
multiselect: boolean;
|
|
20
21
|
buttons: SegmentedButton[];
|
|
21
22
|
getButtonDisabled(index: number): boolean;
|
|
@@ -29,3 +30,4 @@ export declare class SegmentedButtonSet extends LitElement {
|
|
|
29
30
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
30
31
|
protected getRenderClasses(): {};
|
|
31
32
|
}
|
|
33
|
+
export {};
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
import { __decorate } from "tslib";
|
|
7
7
|
import { html, LitElement, nothing } from 'lit';
|
|
8
8
|
import { property, queryAssignedElements } from 'lit/decorators.js';
|
|
9
|
-
import {
|
|
9
|
+
import { mixinDelegatesAria } from '../../../internal/aria/delegate.js';
|
|
10
|
+
// Separate variable needed for closure.
|
|
11
|
+
const segmentedButtonSetBaseClass = mixinDelegatesAria(LitElement);
|
|
10
12
|
/**
|
|
11
13
|
* SegmentedButtonSet is the parent component for two or more
|
|
12
14
|
* `SegmentedButton` components. **Only** `SegmentedButton` components may be
|
|
@@ -17,7 +19,7 @@ import { requestUpdateOnAriaChange } from '../../../internal/aria/delegate.js';
|
|
|
17
19
|
* `setButtonSelected` or the `toggleSelection` methods as well as on user
|
|
18
20
|
* interaction. --bubbles --composed
|
|
19
21
|
*/
|
|
20
|
-
export class SegmentedButtonSet extends
|
|
22
|
+
export class SegmentedButtonSet extends segmentedButtonSetBaseClass {
|
|
21
23
|
constructor() {
|
|
22
24
|
super(...arguments);
|
|
23
25
|
this.multiselect = false;
|
|
@@ -101,9 +103,6 @@ export class SegmentedButtonSet extends LitElement {
|
|
|
101
103
|
return {};
|
|
102
104
|
}
|
|
103
105
|
}
|
|
104
|
-
(() => {
|
|
105
|
-
requestUpdateOnAriaChange(SegmentedButtonSet);
|
|
106
|
-
})();
|
|
107
106
|
__decorate([
|
|
108
107
|
property({ type: Boolean })
|
|
109
108
|
], SegmentedButtonSet.prototype, "multiselect", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segmented-button-set.js","sourceRoot":"","sources":["segmented-button-set.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,KAAK,CAAC;AAC9C,OAAO,EAAC,QAAQ,EAAE,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AAGlE,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"segmented-button-set.js","sourceRoot":"","sources":["segmented-button-set.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,KAAK,CAAC;AAC9C,OAAO,EAAC,QAAQ,EAAE,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AAGlE,OAAO,EAAC,kBAAkB,EAAC,MAAM,oCAAoC,CAAC;AAGtE,wCAAwC;AACxC,MAAM,2BAA2B,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;AAEnE;;;;;;;;;GASG;AACH,MAAM,OAAO,kBAAmB,SAAQ,2BAA2B;IAAnE;;QAC6B,gBAAW,GAAG,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Z,CAAC;CACF;AAxF4B;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;uDAAqB;AAEP;IAAvC,qBAAqB,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;mDAA6B","sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {html, LitElement, nothing} from 'lit';\nimport {property, queryAssignedElements} from 'lit/decorators.js';\n\nimport {ARIAMixinStrict} from '../../../internal/aria/aria.js';\nimport {mixinDelegatesAria} from '../../../internal/aria/delegate.js';\nimport {SegmentedButton} from '../../segmentedbutton/internal/segmented-button.js';\n\n// Separate variable needed for closure.\nconst segmentedButtonSetBaseClass = mixinDelegatesAria(LitElement);\n\n/**\n * SegmentedButtonSet is the parent component for two or more\n * `SegmentedButton` components. **Only** `SegmentedButton` components may be\n * used as children.\n *\n * @fires segmented-button-set-selection {CustomEvent<{button: SegmentedButton, selected: boolean, index: number}>}\n * Dispatched when a button is selected programattically with the\n * `setButtonSelected` or the `toggleSelection` methods as well as on user\n * interaction. --bubbles --composed\n */\nexport class SegmentedButtonSet extends segmentedButtonSetBaseClass {\n @property({type: Boolean}) multiselect = false;\n\n @queryAssignedElements({flatten: true}) buttons!: SegmentedButton[];\n\n getButtonDisabled(index: number): boolean {\n if (this.indexOutOfBounds(index)) return false;\n return this.buttons[index].disabled;\n }\n\n setButtonDisabled(index: number, disabled: boolean) {\n if (this.indexOutOfBounds(index)) return;\n this.buttons[index].disabled = disabled;\n }\n\n getButtonSelected(index: number): boolean {\n if (this.indexOutOfBounds(index)) return false;\n return this.buttons[index].selected;\n }\n\n setButtonSelected(index: number, selected: boolean) {\n // Ignore out-of-index values.\n if (this.indexOutOfBounds(index)) return;\n // Ignore disabled buttons.\n if (this.getButtonDisabled(index)) return;\n\n if (this.multiselect) {\n this.buttons[index].selected = selected;\n this.emitSelectionEvent(index);\n return;\n }\n\n // Single-select segmented buttons are not unselectable.\n if (!selected) return;\n\n this.buttons[index].selected = true;\n this.emitSelectionEvent(index);\n // Deselect all other buttons for single-select.\n for (let i = 0; i < this.buttons.length; i++) {\n if (i === index) continue;\n this.buttons[i].selected = false;\n }\n }\n\n private handleSegmentedButtonInteraction(event: CustomEvent) {\n const index = this.buttons.indexOf(event.target as SegmentedButton);\n this.toggleSelection(index);\n }\n\n private toggleSelection(index: number) {\n if (this.indexOutOfBounds(index)) return;\n this.setButtonSelected(index, !this.buttons[index].selected);\n }\n\n private indexOutOfBounds(index: number): boolean {\n return index < 0 || index >= this.buttons.length;\n }\n\n private emitSelectionEvent(index: number) {\n this.dispatchEvent(\n new CustomEvent('segmented-button-set-selection', {\n detail: {\n button: this.buttons[index],\n selected: this.buttons[index].selected,\n index,\n },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n protected override render() {\n // Needed for closure conformance\n const {ariaLabel} = this as ARIAMixinStrict;\n return html`\n <span\n role=\"group\"\n @segmented-button-interaction=\"${this.handleSegmentedButtonInteraction}\"\n aria-label=${ariaLabel || nothing}\n class=\"md3-segmented-button-set\">\n <slot></slot>\n </span>\n `;\n }\n\n protected getRenderClasses() {\n return {};\n }\n}\n"]}
|
|
@@ -13,11 +13,12 @@ import { ListItem } from '../list-navigation-helpers.js';
|
|
|
13
13
|
* Supported behaviors for a list item.
|
|
14
14
|
*/
|
|
15
15
|
export type ListItemType = 'text' | 'button' | 'link';
|
|
16
|
+
declare const listItemBaseClass: import("../../../labs/behaviors/mixin.js").MixinReturn<typeof LitElement>;
|
|
16
17
|
/**
|
|
17
18
|
* @fires request-activation {Event} Requests the list to set `tabindex=0` on
|
|
18
19
|
* the item and focus it. --bubbles --composed
|
|
19
20
|
*/
|
|
20
|
-
export declare class ListItemEl extends
|
|
21
|
+
export declare class ListItemEl extends listItemBaseClass implements ListItem {
|
|
21
22
|
/** @nocollapse */
|
|
22
23
|
static shadowRootOptions: {
|
|
23
24
|
delegatesFocus: boolean;
|
|
@@ -76,3 +77,4 @@ export declare class ListItemEl extends LitElement implements ListItem {
|
|
|
76
77
|
protected onFocus(): void;
|
|
77
78
|
focus(): void;
|
|
78
79
|
}
|
|
80
|
+
export {};
|
|
@@ -11,13 +11,15 @@ import { html, LitElement, nothing } from 'lit';
|
|
|
11
11
|
import { property, query } from 'lit/decorators.js';
|
|
12
12
|
import { classMap } from 'lit/directives/class-map.js';
|
|
13
13
|
import { literal, html as staticHtml } from 'lit/static-html.js';
|
|
14
|
-
import {
|
|
14
|
+
import { mixinDelegatesAria } from '../../../internal/aria/delegate.js';
|
|
15
15
|
import { createRequestActivationEvent, } from '../list-navigation-helpers.js';
|
|
16
|
+
// Separate variable needed for closure.
|
|
17
|
+
const listItemBaseClass = mixinDelegatesAria(LitElement);
|
|
16
18
|
/**
|
|
17
19
|
* @fires request-activation {Event} Requests the list to set `tabindex=0` on
|
|
18
20
|
* the item and focus it. --bubbles --composed
|
|
19
21
|
*/
|
|
20
|
-
export class ListItemEl extends
|
|
22
|
+
export class ListItemEl extends listItemBaseClass {
|
|
21
23
|
constructor() {
|
|
22
24
|
super(...arguments);
|
|
23
25
|
/**
|
|
@@ -164,9 +166,6 @@ export class ListItemEl extends LitElement {
|
|
|
164
166
|
this.listItemRoot?.focus();
|
|
165
167
|
}
|
|
166
168
|
}
|
|
167
|
-
(() => {
|
|
168
|
-
requestUpdateOnAriaChange(ListItemEl);
|
|
169
|
-
})();
|
|
170
169
|
/** @nocollapse */
|
|
171
170
|
ListItemEl.shadowRootOptions = {
|
|
172
171
|
...LitElement.shadowRootOptions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-item.js","sourceRoot":"","sources":["list-item.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,iCAAiC,CAAC;AACzC,OAAO,4BAA4B,CAAC;AACpC,OAAO,2BAA2B,CAAC;AAEnC,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAiC,MAAM,KAAK,CAAC;AAC9E,OAAO,EAAC,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,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;4CAAkB;AAMhC;IAA1B,QAAQ,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;wCAA6B;AAMvD;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;8CAClD;AAKN;IAAX,QAAQ,EAAE;wCAAW;AAMV;IAAX,QAAQ,EAAE;0CAA2D;AAE9B;IAAvC,KAAK,CAAC,YAAY,CAAC;gDAAsD","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../../focus/md-focus-ring.js';\nimport '../../../labs/item/item.js';\nimport '../../../ripple/ripple.js';\n\nimport {html, LitElement, nothing, PropertyValues, TemplateResult} from 'lit';\nimport {property, query} from 'lit/decorators.js';\nimport {ClassInfo, classMap} from 'lit/directives/class-map.js';\nimport {literal, html as staticHtml, StaticValue} from 'lit/static-html.js';\n\nimport {ARIAMixinStrict} from '../../../internal/aria/aria.js';\nimport {mixinDelegatesAria} from '../../../internal/aria/delegate.js';\nimport {\n createRequestActivationEvent,\n ListItem,\n} from '../list-navigation-helpers.js';\n\n/**\n * Supported behaviors for a list item.\n */\nexport type ListItemType = 'text' | 'button' | 'link';\n\n// Separate variable needed for closure.\nconst listItemBaseClass = mixinDelegatesAria(LitElement);\n\n/**\n * @fires request-activation {Event} Requests the list to set `tabindex=0` on\n * the item and focus it. --bubbles --composed\n */\nexport class ListItemEl extends listItemBaseClass implements ListItem {\n /** @nocollapse */\n static override shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n /**\n * Disables the item and makes it non-selectable and non-interactive.\n */\n @property({type: Boolean, reflect: true}) disabled = false;\n\n /**\n * Sets the behavior of the list item, defaults to \"text\". Change to \"link\" or\n * \"button\" for interactive items.\n */\n @property({reflect: true}) type: ListItemType = 'text';\n\n /**\n * READONLY. Sets the `md-list-item` attribute on the element.\n */\n @property({type: Boolean, attribute: 'md-list-item', reflect: true})\n isListItem = true;\n\n /**\n * Sets the underlying `HTMLAnchorElement`'s `href` resource attribute.\n */\n @property() href = '';\n\n /**\n * Sets the underlying `HTMLAnchorElement`'s `target` attribute when `href` is\n * set.\n */\n @property() target: '_blank' | '_parent' | '_self' | '_top' | '' = '';\n\n @query('.list-item') protected readonly listItemRoot!: HTMLElement | null;\n\n private get isDisabled() {\n return this.disabled && this.type !== 'link';\n }\n\n protected override willUpdate(changed: PropertyValues<ListItemEl>) {\n if (this.href) {\n this.type = 'link';\n }\n\n super.willUpdate(changed);\n }\n\n protected override render() {\n return this.renderListItem(html`\n <md-item>\n <div slot=\"container\">\n ${this.renderRipple()} ${this.renderFocusRing()}\n </div>\n <slot name=\"start\" slot=\"start\"></slot>\n <slot name=\"end\" slot=\"end\"></slot>\n ${this.renderBody()}\n </md-item>\n `);\n }\n\n /**\n * Renders the root list item.\n *\n * @param content the child content of the list item.\n */\n protected renderListItem(content: unknown) {\n const isAnchor = this.type === 'link';\n let tag: StaticValue;\n switch (this.type) {\n case 'link':\n tag = literal`a`;\n break;\n case 'button':\n tag = literal`button`;\n break;\n default:\n case 'text':\n tag = literal`li`;\n break;\n }\n\n const isInteractive = this.type !== 'text';\n // TODO(b/265339866): announce \"button\"/\"link\" inside of a list item. Until\n // then all are \"listitem\" roles for correct announcement.\n const target = isAnchor && !!this.target ? this.target : nothing;\n return staticHtml`\n <${tag}\n id=\"item\"\n tabindex=\"${this.isDisabled || !isInteractive ? -1 : 0}\"\n ?disabled=${this.isDisabled}\n role=\"listitem\"\n aria-selected=${(this as ARIAMixinStrict).ariaSelected || nothing}\n aria-checked=${(this as ARIAMixinStrict).ariaChecked || nothing}\n aria-expanded=${(this as ARIAMixinStrict).ariaExpanded || nothing}\n aria-haspopup=${(this as ARIAMixinStrict).ariaHasPopup || nothing}\n class=\"list-item ${classMap(this.getRenderClasses())}\"\n href=${this.href || nothing}\n target=${target}\n @focus=${this.onFocus}\n >${content}</${tag}>\n `;\n }\n\n /**\n * Handles rendering of the ripple element.\n */\n protected renderRipple(): TemplateResult | typeof nothing {\n if (this.type === 'text') {\n return nothing;\n }\n\n return html` <md-ripple\n part=\"ripple\"\n for=\"item\"\n ?disabled=${this.isDisabled}></md-ripple>`;\n }\n\n /**\n * Handles rendering of the focus ring.\n */\n protected renderFocusRing(): TemplateResult | typeof nothing {\n if (this.type === 'text') {\n return nothing;\n }\n\n return html` <md-focus-ring\n @visibility-changed=${this.onFocusRingVisibilityChanged}\n part=\"focus-ring\"\n for=\"item\"\n inward></md-focus-ring>`;\n }\n\n protected onFocusRingVisibilityChanged(e: Event) {}\n\n /**\n * Classes applied to the list item root.\n */\n protected getRenderClasses(): ClassInfo {\n return {'disabled': this.isDisabled};\n }\n\n /**\n * Handles rendering the headline and supporting text.\n */\n protected renderBody() {\n return html`\n <slot></slot>\n <slot name=\"overline\" slot=\"overline\"></slot>\n <slot name=\"headline\" slot=\"headline\"></slot>\n <slot name=\"supporting-text\" slot=\"supporting-text\"></slot>\n <slot\n name=\"trailing-supporting-text\"\n slot=\"trailing-supporting-text\"></slot>\n `;\n }\n\n protected onFocus() {\n if (this.tabIndex !== -1) {\n return;\n }\n // Handles the case where the user clicks on the element and then tabs.\n this.dispatchEvent(createRequestActivationEvent());\n }\n\n override focus() {\n // TODO(b/300334509): needed for some cases where delegatesFocus doesn't\n // work programmatically like in FF and select-option\n this.listItemRoot?.focus();\n }\n}\n"]}
|
|
@@ -9,11 +9,12 @@ import '../../../ripple/ripple.js';
|
|
|
9
9
|
import { LitElement, nothing, TemplateResult } from 'lit';
|
|
10
10
|
import { ClassInfo } from 'lit/directives/class-map.js';
|
|
11
11
|
import { MenuItem, type MenuItemType } from '../controllers/menuItemController.js';
|
|
12
|
+
declare const menuItemBaseClass: import("../../../labs/behaviors/mixin.js").MixinReturn<typeof LitElement>;
|
|
12
13
|
/**
|
|
13
14
|
* @fires close-menu {CustomEvent<{initiator: SelectOption, reason: Reason, itemPath: SelectOption[]}>}
|
|
14
15
|
* Closes the encapsulating menu on closable interaction. --bubbles --composed
|
|
15
16
|
*/
|
|
16
|
-
export declare class MenuItemEl extends
|
|
17
|
+
export declare class MenuItemEl extends menuItemBaseClass implements MenuItem {
|
|
17
18
|
/** @nocollapse */
|
|
18
19
|
static shadowRootOptions: {
|
|
19
20
|
delegatesFocus: boolean;
|
|
@@ -81,3 +82,4 @@ export declare class MenuItemEl extends LitElement implements MenuItem {
|
|
|
81
82
|
protected renderBody(): TemplateResult<1>;
|
|
82
83
|
focus(): void;
|
|
83
84
|
}
|
|
85
|
+
export {};
|