@material/web 1.0.0-pre.11 → 1.0.0-pre.13
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 +18 -1
- package/button/lib/_icon.scss +9 -9
- package/button/lib/_outlined-button.scss +4 -0
- package/button/lib/button.d.ts +0 -6
- package/button/lib/button.js +2 -14
- package/button/lib/button.js.map +1 -1
- package/button/lib/elevated-styles.css.js +1 -1
- package/button/lib/elevated-styles.css.js.map +1 -1
- package/button/lib/filled-styles.css.js +1 -1
- package/button/lib/filled-styles.css.js.map +1 -1
- package/button/lib/outlined-styles.css.js +1 -1
- package/button/lib/outlined-styles.css.js.map +1 -1
- package/button/lib/shared-styles.css.js +1 -1
- package/button/lib/shared-styles.css.js.map +1 -1
- package/button/lib/text-styles.css.js +1 -1
- package/button/lib/text-styles.css.js.map +1 -1
- package/button/lib/tonal-styles.css.js +1 -1
- package/button/lib/tonal-styles.css.js.map +1 -1
- package/chips/assist-chip.js +2 -1
- package/chips/assist-chip.js.map +1 -1
- package/chips/filter-chip.js +3 -1
- package/chips/filter-chip.js.map +1 -1
- package/chips/harness.d.ts +2 -5
- package/chips/harness.js +9 -6
- package/chips/harness.js.map +1 -1
- package/chips/input-chip.js +5 -1
- package/chips/input-chip.js.map +1 -1
- package/chips/lib/_elevated.scss +14 -0
- package/chips/lib/_selectable.scss +8 -0
- package/chips/lib/_shared.scss +1 -0
- package/chips/lib/_trailing-icon.scss +1 -1
- package/chips/lib/assist-chip.d.ts +1 -0
- package/chips/lib/assist-chip.js +1 -0
- package/chips/lib/assist-chip.js.map +1 -1
- package/chips/lib/assist-forced-colors-styles.css.d.ts +1 -0
- package/chips/lib/assist-forced-colors-styles.css.js +9 -0
- package/chips/lib/assist-forced-colors-styles.css.js.map +1 -0
- package/chips/lib/assist-forced-colors-styles.scss +27 -0
- package/chips/lib/chip-set.js +4 -4
- package/chips/lib/chip-set.js.map +1 -1
- package/chips/lib/elevated-styles.css.js +1 -1
- package/chips/lib/elevated-styles.css.js.map +1 -1
- package/chips/lib/filter-chip.d.ts +1 -0
- package/chips/lib/filter-chip.js +2 -1
- package/chips/lib/filter-chip.js.map +1 -1
- package/chips/lib/filter-forced-colors-styles.css.d.ts +1 -0
- package/chips/lib/filter-forced-colors-styles.css.js +9 -0
- package/chips/lib/filter-forced-colors-styles.css.js.map +1 -0
- package/chips/lib/filter-forced-colors-styles.scss +34 -0
- package/chips/lib/input-chip.d.ts +2 -0
- package/chips/lib/input-chip.js +4 -2
- package/chips/lib/input-chip.js.map +1 -1
- package/chips/lib/input-forced-colors-styles.css.d.ts +1 -0
- package/chips/lib/input-forced-colors-styles.css.js +9 -0
- package/chips/lib/input-forced-colors-styles.css.js.map +1 -0
- package/chips/lib/input-forced-colors-styles.scss +39 -0
- package/chips/lib/input-styles.css.js +1 -1
- package/chips/lib/input-styles.css.js.map +1 -1
- package/chips/lib/selectable-styles.css.js +1 -1
- package/chips/lib/selectable-styles.css.js.map +1 -1
- package/chips/lib/shared-styles.css.js +1 -1
- package/chips/lib/shared-styles.css.js.map +1 -1
- package/chips/lib/suggestion-forced-colors-styles.css.d.ts +1 -0
- package/chips/lib/suggestion-forced-colors-styles.css.js +9 -0
- package/chips/lib/suggestion-forced-colors-styles.css.js.map +1 -0
- package/chips/lib/suggestion-forced-colors-styles.scss +27 -0
- package/chips/lib/trailing-icon-styles.css.js +1 -1
- package/chips/lib/trailing-icon-styles.css.js.map +1 -1
- package/chips/suggestion-chip.js +2 -1
- package/chips/suggestion-chip.js.map +1 -1
- package/dialog/lib/_dialog.scss +2 -2
- package/dialog/lib/_tokens.scss +5 -22
- package/dialog/lib/dialog-styles.css.js +1 -1
- package/dialog/lib/dialog-styles.css.js.map +1 -1
- package/dialog/lib/dialog.d.ts +9 -3
- package/dialog/lib/dialog.js +24 -16
- package/dialog/lib/dialog.js.map +1 -1
- package/fab/branded-fab.d.ts +1 -0
- package/fab/lib/_fab.scss +12 -0
- package/fab/lib/fab-styles.css.js +1 -1
- package/fab/lib/fab-styles.css.js.map +1 -1
- package/fab/lib/fab.d.ts +1 -0
- package/fab/lib/shared.d.ts +9 -0
- package/fab/lib/shared.js +23 -2
- package/fab/lib/shared.js.map +1 -1
- package/field/lib/_supporting-text.scss +6 -16
- package/field/lib/field.d.ts +26 -2
- package/field/lib/field.js +100 -15
- package/field/lib/field.js.map +1 -1
- package/field/lib/outlined-field.d.ts +1 -2
- package/field/lib/outlined-field.js.map +1 -1
- package/field/lib/shared-styles.css.js +1 -1
- package/field/lib/shared-styles.css.js.map +1 -1
- package/iconbutton/lib/icon-button.js +1 -1
- package/iconbutton/lib/icon-button.js.map +1 -1
- package/labs/navigationbar/lib/navigation-bar.js +2 -2
- package/labs/navigationbar/lib/navigation-bar.js.map +1 -1
- package/labs/navigationtab/lib/navigation-tab.js +3 -3
- package/labs/navigationtab/lib/navigation-tab.js.map +1 -1
- package/labs/segmentedbutton/lib/_shared.scss +7 -7
- package/labs/segmentedbutton/lib/outlined-styles.css.js +1 -1
- package/labs/segmentedbutton/lib/outlined-styles.css.js.map +1 -1
- package/labs/segmentedbutton/lib/segmented-button.js +2 -2
- package/labs/segmentedbutton/lib/segmented-button.js.map +1 -1
- package/labs/segmentedbutton/lib/shared-styles.css.js +1 -1
- package/labs/segmentedbutton/lib/shared-styles.css.js.map +1 -1
- package/labs/segmentedbuttonset/lib/outlined-styles.css.js +1 -1
- package/labs/segmentedbuttonset/lib/outlined-styles.css.js.map +1 -1
- package/list/harness.d.ts +24 -0
- package/list/harness.js +25 -0
- package/list/harness.js.map +1 -1
- package/list/lib/list.d.ts +28 -10
- package/list/lib/list.js +57 -19
- package/list/lib/list.js.map +1 -1
- package/list/lib/listitem/harness.d.ts +21 -1
- package/list/lib/listitem/harness.js +16 -2
- package/list/lib/listitem/harness.js.map +1 -1
- package/list/lib/listitem/list-item.js +4 -4
- package/list/lib/listitem/list-item.js.map +1 -1
- package/list/lib/listitemlink/list-item-link-only.d.ts +1 -0
- package/list/lib/listitemlink/list-item-link-only.js +4 -1
- package/list/lib/listitemlink/list-item-link-only.js.map +1 -1
- package/menu/harness.js.map +1 -1
- package/menu/lib/menu.d.ts +15 -1
- package/menu/lib/menu.js +29 -6
- package/menu/lib/menu.js.map +1 -1
- package/package.json +5 -4
- package/radio/lib/single-selection-controller.js +2 -3
- package/radio/lib/single-selection-controller.js.map +1 -1
- package/select/harness.js +1 -1
- package/select/harness.js.map +1 -1
- package/select/lib/_shared.scss +2 -1
- package/select/lib/select.d.ts +1 -11
- package/select/lib/select.js +15 -51
- package/select/lib/select.js.map +1 -1
- package/select/lib/shared-styles.css.js +1 -1
- package/select/lib/shared-styles.css.js.map +1 -1
- package/slider/lib/slider.d.ts +3 -3
- package/slider/lib/slider.js +10 -10
- package/slider/lib/slider.js.map +1 -1
- package/switch/lib/switch.js +1 -1
- package/switch/lib/switch.js.map +1 -1
- package/tabs/lib/tab.js +4 -2
- package/tabs/lib/tab.js.map +1 -1
- package/tabs/lib/tabs.js +3 -1
- package/tabs/lib/tabs.js.map +1 -1
- package/textfield/lib/_shared.scss +0 -4
- package/textfield/lib/shared-styles.css.js +1 -1
- package/textfield/lib/shared-styles.css.js.map +1 -1
- package/textfield/lib/text-field.d.ts +2 -13
- package/textfield/lib/text-field.js +44 -98
- package/textfield/lib/text-field.js.map +1 -1
- package/tokens/_md-comp-dialog.scss +48 -6
- package/tokens/_md-comp-elevated-button.scss +17 -7
- package/tokens/_md-comp-elevation.scss +11 -2
- package/tokens/_md-comp-filled-button.scss +17 -7
- package/tokens/_md-comp-filled-tonal-button.scss +17 -7
- package/tokens/_md-comp-input-chip.scss +7 -0
- package/tokens/_md-comp-list-item.scss +5 -0
- package/tokens/_md-comp-menu-item.scss +1 -0
- package/tokens/_md-comp-outlined-button.scss +19 -9
- package/tokens/_md-comp-outlined-segmented-button.scss +19 -13
- package/tokens/_md-comp-slider.scss +48 -2
- package/tokens/_md-comp-suggestion-chip.scss +1 -0
- package/tokens/_md-comp-text-button.scss +17 -7
- package/tokens/_values.scss +1 -1
|
@@ -145,10 +145,10 @@ __decorate([
|
|
|
145
145
|
property()
|
|
146
146
|
], SegmentedButton.prototype, "label", void 0);
|
|
147
147
|
__decorate([
|
|
148
|
-
property({ type: Boolean })
|
|
148
|
+
property({ type: Boolean, attribute: 'no-checkmark' })
|
|
149
149
|
], SegmentedButton.prototype, "noCheckmark", void 0);
|
|
150
150
|
__decorate([
|
|
151
|
-
property({ type: Boolean })
|
|
151
|
+
property({ type: Boolean, attribute: 'has-icon' })
|
|
152
152
|
], SegmentedButton.prototype, "hasIcon", void 0);
|
|
153
153
|
__decorate([
|
|
154
154
|
state()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segmented-button.js","sourceRoot":"","sources":["segmented-button.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;AAEH,OAAO,8BAA8B,CAAC;AACtC,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,yBAAyB,EAAC,MAAM,oCAAoC,CAAC;AAE7E;;;;;GAKG;AACH,MAAM,OAAO,eAAgB,SAAQ,UAAU;IAA/C;;QAK6B,aAAQ,GAAG,KAAK,CAAC;QACjB,aAAQ,GAAG,KAAK,CAAC;QAChC,UAAK,GAAG,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"segmented-button.js","sourceRoot":"","sources":["segmented-button.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;AAEH,OAAO,8BAA8B,CAAC;AACtC,OAAO,2BAA2B,CAAC;AAEnC,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAiC,MAAM,KAAK,CAAC;AAC9E,OAAO,EAAC,QAAQ,E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AAI,CAAC,yBAAyB,EAAE,CAAC,CAAC;YAClC,IAAI,CAAC,sBAAsB,EAAE,CAAC;IAC3D,CAAC;IAEO,yBAAyB;QAC/B,OAAO,IAAI,CAAA;;;;;;;;;;;KAWV,CAAC;IACJ,CAAC;IAEO,sBAAsB;QAC5B,OAAO,IAAI,CAAA;;;;;;;;;;;KAWV,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;;AAlIC;IACE,yBAAyB,CAAC,EAAI,CAAC,CAAC;AAClC,CAAC,GAAA,CAAA;AAE0B;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;AAEzD;IAAR,KAAK,EAAE;kDAAwB;AAEhC;IADC,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/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 {requestUpdateOnAriaChange} from '../../../internal/aria/delegate.js';\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 */\nexport class SegmentedButton extends LitElement {\n static {\n requestUpdateOnAriaChange(this);\n }\n\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(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(\n 'segmented-button-interaction', {bubbles: true, composed: true});\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 >\n <md-focus-ring class=\"md3-segmented-button__focus-ring\"></md-focus-ring>\n <md-ripple ?disabled=\"${\n this.disabled}\" class=\"md3-segmented-button__ripple\"></md-ripple>\n ${this.renderOutline()}\n ${this.renderLeading()}\n ${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 === '' ? 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 class=\"md3-segmented-button__checkmark-path\" fill=\"none\" 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 class=\"md3-segmented-button__checkmark-path\" fill=\"none\" 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"]}
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { css } from 'lit';
|
|
7
|
-
export const styles = css `@keyframes md3-segmented-button-checkmark-selection-draw-in{from{stroke-dashoffset:29.7833385}to{stroke-dashoffset:0}}@keyframes md3-segmented-button-simple-fade-out{from{opacity:1}to{opacity:0}}@keyframes md3-segmented-button-simple-fade-in{from{opacity:0}to{opacity:1}}:host{display:inline-flex;outline:none}.md3-segmented-button{align-items:center;background:rgba(0,0,0,0);border:none;border-radius:inherit;display:flex;flex:1;justify-content:center;outline:none;position:relative;vertical-align:middle;padding-inline-start:var(--_spacing-leading);padding-inline-end:var(--_spacing-trailing)}.md3-segmented-button .md3-segmented-button__outline{border-color:var(--_outline-color)}.md3-segmented-button:disabled .md3-segmented-button__outline{border-color:var(--_disabled-outline-color)}.md3-segmented-button .md3-segmented-button__graphic,.md3-segmented-button .md3-segmented-button__checkmark,.md3-segmented-button .md3-segmented-button__icon,.md3-segmented-button .md3-segmented-button__icon ::slotted([slot=icon]){height:var(--
|
|
7
|
+
export const styles = css `@keyframes md3-segmented-button-checkmark-selection-draw-in{from{stroke-dashoffset:29.7833385}to{stroke-dashoffset:0}}@keyframes md3-segmented-button-simple-fade-out{from{opacity:1}to{opacity:0}}@keyframes md3-segmented-button-simple-fade-in{from{opacity:0}to{opacity:1}}:host{display:inline-flex;outline:none}.md3-segmented-button{align-items:center;background:rgba(0,0,0,0);border:none;border-radius:inherit;display:flex;flex:1;justify-content:center;outline:none;position:relative;vertical-align:middle;padding-inline-start:var(--_spacing-leading);padding-inline-end:var(--_spacing-trailing)}.md3-segmented-button .md3-segmented-button__outline{border-color:var(--_outline-color)}.md3-segmented-button:disabled .md3-segmented-button__outline{border-color:var(--_disabled-outline-color)}.md3-segmented-button .md3-segmented-button__graphic,.md3-segmented-button .md3-segmented-button__checkmark,.md3-segmented-button .md3-segmented-button__icon,.md3-segmented-button .md3-segmented-button__icon ::slotted([slot=icon]){height:var(--_icon-size);width:var(--_icon-size);font-size:var(--_icon-size)}.md3-segmented-button.md3-segmented-button--with-icon.md3-segmented-button--with-label .md3-segmented-button__graphic,.md3-segmented-button.md3-segmented-button--selected.md3-segmented-button--with-label.md3-segmented-button--with-checkmark .md3-segmented-button__graphic,.md3-segmented-button.md3-segmented-button--selected.md3-segmented-button--without-label.md3-segmented-button--with-checkmark .md3-segmented-button__graphic{width:calc(var(--_icon-size) + 8px)}.md3-segmented-button .md3-segmented-button__label-text{font:var(--_label-text-type)}.md3-segmented-button.md3-segmented-button--selected:enabled .md3-segmented-button__label-text{color:var(--_selected-label-text-color)}.md3-segmented-button.md3-segmented-button--selected:enabled:hover .md3-segmented-button__label-text{color:var(--_selected-hover-label-text-color)}.md3-segmented-button.md3-segmented-button--selected:enabled:focus .md3-segmented-button__label-text{color:var(--_selected-focus-label-text-color)}.md3-segmented-button.md3-segmented-button--selected:enabled:active .md3-segmented-button__label-text{color:var(--_selected-pressed-label-text-color)}.md3-segmented-button.md3-segmented-button--unselected:enabled .md3-segmented-button__label-text{color:var(--_unselected-label-text-color)}.md3-segmented-button.md3-segmented-button--unselected:enabled:hover .md3-segmented-button__label-text{color:var(--_unselected-hover-label-text-color)}.md3-segmented-button.md3-segmented-button--unselected:enabled:focus .md3-segmented-button__label-text{color:var(--_unselected-focus-label-text-color)}.md3-segmented-button.md3-segmented-button--unselected:enabled:active .md3-segmented-button__label-text{color:var(--_unselected-pressed-label-text-color)}.md3-segmented-button:disabled .md3-segmented-button__label-text{color:var(--_disabled-label-text-color)}.md3-segmented-button--unselected{--md-ripple-hover-color: var(--_unselected-hover-state-layer-color);--md-ripple-hover-opacity: var(--_hover-state-layer-opacity);--md-ripple-pressed-color: var(--_unselected-pressed-state-layer-color);--md-ripple-pressed-opacity: var(--_pressed-state-layer-opacity)}.md3-segmented-button--unselected .md3-segmented-button__icon{color:var(--_unselected-icon-color)}.md3-segmented-button--unselected:hover .md3-segmented-button__icon{color:var(--_unselected-hover-icon-color)}.md3-segmented-button--unselected:focus .md3-segmented-button__icon{color:var(--_unselected-focus-icon-color)}.md3-segmented-button--unselected:active .md3-segmented-button__icon{color:var(--_unselected-pressed-icon-color)}.md3-segmented-button--unselected:disabled .md3-segmented-button__icon{color:var(--_disabled-icon-color)}.md3-segmented-button--selected{background-color:var(--_selected-container-color);--md-ripple-hover-color: var(--_selected-hover-state-layer-color);--md-ripple-hover-opacity: var(--_hover-state-layer-opacity);--md-ripple-pressed-color: var(--_selected-pressed-state-layer-color);--md-ripple-pressed-opacity: var(--_pressed-state-layer-opacity)}.md3-segmented-button--selected .md3-segmented-button__icon{color:var(--_selected-icon-color)}.md3-segmented-button--selected .md3-segmented-button__checkmark-path{stroke:var(--_selected-icon-color)}.md3-segmented-button--selected:hover .md3-segmented-button__checkmark-path{stroke:var(--_selected-hover-icon-color)}.md3-segmented-button--selected:focus .md3-segmented-button__checkmark-path{stroke:var(--_selected-focus-icon-color)}.md3-segmented-button--selected:active .md3-segmented-button__checkmark-path{stroke:var(--_selected-pressed-icon-color)}.md3-segmented-button--selected:disabled .md3-segmented-button__checkmark-path{stroke:var(--_disabled-icon-color)}.md3-segmented-button:enabled{cursor:pointer}.md3-segmented-button__focus-ring{z-index:1}.md3-segmented-button__ripple{border-radius:inherit;z-index:0}.md3-segmented-button__touch{position:absolute;top:50%;height:48px;left:50%;width:100%;transform:translate(-50%, -50%)}.md3-segmented-button__leading,.md3-segmented-button__graphic{display:inline-flex;justify-content:flex-start;align-items:center}.md3-segmented-button__graphic{position:relative;overflow:hidden}.md3-segmented-button__graphic{transition:width 150ms cubic-bezier(0.4, 0, 0.2, 1)}.md3-segmented-button--unselected.md3-segmented-button--with-label .md3-segmented-button__graphic,.md3-segmented-button--unselected.md3-segmented-button--without-label .md3-segmented-button__graphic,.md3-segmented-button--selected.md3-segmented-button--without-checkmark .md3-segmented-button__graphic{width:0}.md3-segmented-button--unselected .md3-segmented-button__checkmark{opacity:0}.md3-segmented-button--selected.md3-segmented-button--with-label .md3-segmented-button__icon{opacity:0}.md3-segmented-button--with-label .md3-segmented-button__checkmark{display:inline-flex;position:absolute}.md3-segmented-button__checkmark-path{stroke-width:2px;stroke-dasharray:29.7833385}.md3-segmented-button--selecting .md3-segmented-button__checkmark-path{stroke-dashoffset:29.7833385;animation:md3-segmented-button-checkmark-selection-draw-in;animation-duration:150ms;animation-delay:50ms;animation-fill-mode:forwards;animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.md3-segmented-button--selecting.md3-segmented-button--with-label .md3-segmented-button__icon{animation:md3-segmented-button-simple-fade-out;animation-duration:75ms;animation-timing-function:linear;animation-fill-mode:forwards}.md3-segmented-button--deselecting .md3-segmented-button__checkmark{animation:md3-segmented-button-simple-fade-out;animation-duration:50ms;animation-timing-function:linear;animation-fill-mode:forwards}.md3-segmented-button--deselecting.md3-segmented-button--with-label .md3-segmented-button__icon{opacity:0;animation:md3-segmented-button-simple-fade-in;animation-delay:50ms;animation-duration:150ms;animation-timing-function:linear;animation-fill-mode:forwards}/*# sourceMappingURL=shared-styles.css.map */
|
|
8
8
|
`;
|
|
9
9
|
//# sourceMappingURL=shared-styles.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-styles.css.js","sourceRoot":"","sources":["shared-styles.css.ts"],"names":[],"mappings":"AAAA;;;;IAII;AACH,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACzB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n import {css} from 'lit';\n export const styles = css`@keyframes md3-segmented-button-checkmark-selection-draw-in{from{stroke-dashoffset:29.7833385}to{stroke-dashoffset:0}}@keyframes md3-segmented-button-simple-fade-out{from{opacity:1}to{opacity:0}}@keyframes md3-segmented-button-simple-fade-in{from{opacity:0}to{opacity:1}}:host{display:inline-flex;outline:none}.md3-segmented-button{align-items:center;background:rgba(0,0,0,0);border:none;border-radius:inherit;display:flex;flex:1;justify-content:center;outline:none;position:relative;vertical-align:middle;padding-inline-start:var(--_spacing-leading);padding-inline-end:var(--_spacing-trailing)}.md3-segmented-button .md3-segmented-button__outline{border-color:var(--_outline-color)}.md3-segmented-button:disabled .md3-segmented-button__outline{border-color:var(--_disabled-outline-color)}.md3-segmented-button .md3-segmented-button__graphic,.md3-segmented-button .md3-segmented-button__checkmark,.md3-segmented-button .md3-segmented-button__icon,.md3-segmented-button .md3-segmented-button__icon ::slotted([slot=icon]){height:var(--
|
|
1
|
+
{"version":3,"file":"shared-styles.css.js","sourceRoot":"","sources":["shared-styles.css.ts"],"names":[],"mappings":"AAAA;;;;IAII;AACH,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACzB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n import {css} from 'lit';\n export const styles = css`@keyframes md3-segmented-button-checkmark-selection-draw-in{from{stroke-dashoffset:29.7833385}to{stroke-dashoffset:0}}@keyframes md3-segmented-button-simple-fade-out{from{opacity:1}to{opacity:0}}@keyframes md3-segmented-button-simple-fade-in{from{opacity:0}to{opacity:1}}:host{display:inline-flex;outline:none}.md3-segmented-button{align-items:center;background:rgba(0,0,0,0);border:none;border-radius:inherit;display:flex;flex:1;justify-content:center;outline:none;position:relative;vertical-align:middle;padding-inline-start:var(--_spacing-leading);padding-inline-end:var(--_spacing-trailing)}.md3-segmented-button .md3-segmented-button__outline{border-color:var(--_outline-color)}.md3-segmented-button:disabled .md3-segmented-button__outline{border-color:var(--_disabled-outline-color)}.md3-segmented-button .md3-segmented-button__graphic,.md3-segmented-button .md3-segmented-button__checkmark,.md3-segmented-button .md3-segmented-button__icon,.md3-segmented-button .md3-segmented-button__icon ::slotted([slot=icon]){height:var(--_icon-size);width:var(--_icon-size);font-size:var(--_icon-size)}.md3-segmented-button.md3-segmented-button--with-icon.md3-segmented-button--with-label .md3-segmented-button__graphic,.md3-segmented-button.md3-segmented-button--selected.md3-segmented-button--with-label.md3-segmented-button--with-checkmark .md3-segmented-button__graphic,.md3-segmented-button.md3-segmented-button--selected.md3-segmented-button--without-label.md3-segmented-button--with-checkmark .md3-segmented-button__graphic{width:calc(var(--_icon-size) + 8px)}.md3-segmented-button .md3-segmented-button__label-text{font:var(--_label-text-type)}.md3-segmented-button.md3-segmented-button--selected:enabled .md3-segmented-button__label-text{color:var(--_selected-label-text-color)}.md3-segmented-button.md3-segmented-button--selected:enabled:hover .md3-segmented-button__label-text{color:var(--_selected-hover-label-text-color)}.md3-segmented-button.md3-segmented-button--selected:enabled:focus .md3-segmented-button__label-text{color:var(--_selected-focus-label-text-color)}.md3-segmented-button.md3-segmented-button--selected:enabled:active .md3-segmented-button__label-text{color:var(--_selected-pressed-label-text-color)}.md3-segmented-button.md3-segmented-button--unselected:enabled .md3-segmented-button__label-text{color:var(--_unselected-label-text-color)}.md3-segmented-button.md3-segmented-button--unselected:enabled:hover .md3-segmented-button__label-text{color:var(--_unselected-hover-label-text-color)}.md3-segmented-button.md3-segmented-button--unselected:enabled:focus .md3-segmented-button__label-text{color:var(--_unselected-focus-label-text-color)}.md3-segmented-button.md3-segmented-button--unselected:enabled:active .md3-segmented-button__label-text{color:var(--_unselected-pressed-label-text-color)}.md3-segmented-button:disabled .md3-segmented-button__label-text{color:var(--_disabled-label-text-color)}.md3-segmented-button--unselected{--md-ripple-hover-color: var(--_unselected-hover-state-layer-color);--md-ripple-hover-opacity: var(--_hover-state-layer-opacity);--md-ripple-pressed-color: var(--_unselected-pressed-state-layer-color);--md-ripple-pressed-opacity: var(--_pressed-state-layer-opacity)}.md3-segmented-button--unselected .md3-segmented-button__icon{color:var(--_unselected-icon-color)}.md3-segmented-button--unselected:hover .md3-segmented-button__icon{color:var(--_unselected-hover-icon-color)}.md3-segmented-button--unselected:focus .md3-segmented-button__icon{color:var(--_unselected-focus-icon-color)}.md3-segmented-button--unselected:active .md3-segmented-button__icon{color:var(--_unselected-pressed-icon-color)}.md3-segmented-button--unselected:disabled .md3-segmented-button__icon{color:var(--_disabled-icon-color)}.md3-segmented-button--selected{background-color:var(--_selected-container-color);--md-ripple-hover-color: var(--_selected-hover-state-layer-color);--md-ripple-hover-opacity: var(--_hover-state-layer-opacity);--md-ripple-pressed-color: var(--_selected-pressed-state-layer-color);--md-ripple-pressed-opacity: var(--_pressed-state-layer-opacity)}.md3-segmented-button--selected .md3-segmented-button__icon{color:var(--_selected-icon-color)}.md3-segmented-button--selected .md3-segmented-button__checkmark-path{stroke:var(--_selected-icon-color)}.md3-segmented-button--selected:hover .md3-segmented-button__checkmark-path{stroke:var(--_selected-hover-icon-color)}.md3-segmented-button--selected:focus .md3-segmented-button__checkmark-path{stroke:var(--_selected-focus-icon-color)}.md3-segmented-button--selected:active .md3-segmented-button__checkmark-path{stroke:var(--_selected-pressed-icon-color)}.md3-segmented-button--selected:disabled .md3-segmented-button__checkmark-path{stroke:var(--_disabled-icon-color)}.md3-segmented-button:enabled{cursor:pointer}.md3-segmented-button__focus-ring{z-index:1}.md3-segmented-button__ripple{border-radius:inherit;z-index:0}.md3-segmented-button__touch{position:absolute;top:50%;height:48px;left:50%;width:100%;transform:translate(-50%, -50%)}.md3-segmented-button__leading,.md3-segmented-button__graphic{display:inline-flex;justify-content:flex-start;align-items:center}.md3-segmented-button__graphic{position:relative;overflow:hidden}.md3-segmented-button__graphic{transition:width 150ms cubic-bezier(0.4, 0, 0.2, 1)}.md3-segmented-button--unselected.md3-segmented-button--with-label .md3-segmented-button__graphic,.md3-segmented-button--unselected.md3-segmented-button--without-label .md3-segmented-button__graphic,.md3-segmented-button--selected.md3-segmented-button--without-checkmark .md3-segmented-button__graphic{width:0}.md3-segmented-button--unselected .md3-segmented-button__checkmark{opacity:0}.md3-segmented-button--selected.md3-segmented-button--with-label .md3-segmented-button__icon{opacity:0}.md3-segmented-button--with-label .md3-segmented-button__checkmark{display:inline-flex;position:absolute}.md3-segmented-button__checkmark-path{stroke-width:2px;stroke-dasharray:29.7833385}.md3-segmented-button--selecting .md3-segmented-button__checkmark-path{stroke-dashoffset:29.7833385;animation:md3-segmented-button-checkmark-selection-draw-in;animation-duration:150ms;animation-delay:50ms;animation-fill-mode:forwards;animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.md3-segmented-button--selecting.md3-segmented-button--with-label .md3-segmented-button__icon{animation:md3-segmented-button-simple-fade-out;animation-duration:75ms;animation-timing-function:linear;animation-fill-mode:forwards}.md3-segmented-button--deselecting .md3-segmented-button__checkmark{animation:md3-segmented-button-simple-fade-out;animation-duration:50ms;animation-timing-function:linear;animation-fill-mode:forwards}.md3-segmented-button--deselecting.md3-segmented-button--with-label .md3-segmented-button__icon{opacity:0;animation:md3-segmented-button-simple-fade-in;animation-delay:50ms;animation-duration:150ms;animation-timing-function:linear;animation-fill-mode:forwards}/*# sourceMappingURL=shared-styles.css.map */\n`;\n "]}
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { css } from 'lit';
|
|
7
|
-
export const styles = css `:host{--
|
|
7
|
+
export const styles = css `:host{--_disabled-icon-color: var(--md-outlined-segmented-button-disabled-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-label-text-color: var(--md-outlined-segmented-button-disabled-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-outline-color: var(--md-outlined-segmented-button-disabled-outline-color, var(--md-sys-color-on-surface, #1d1b20));--_hover-state-layer-opacity: var(--md-outlined-segmented-button-hover-state-layer-opacity, 0.08);--_label-text-type: var(--md-outlined-segmented-button-label-text-type, var(--md-sys-typescale-label-large, 500 0.875rem / 1.25rem var(--md-ref-typeface-plain, Roboto)));--_outline-color: var(--md-outlined-segmented-button-outline-color, var(--md-sys-color-outline, #79747e));--_pressed-state-layer-opacity: var(--md-outlined-segmented-button-pressed-state-layer-opacity, 0.12);--_selected-container-color: var(--md-outlined-segmented-button-selected-container-color, var(--md-sys-color-secondary-container, #e8def8));--_selected-focus-icon-color: var(--md-outlined-segmented-button-selected-focus-icon-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-focus-label-text-color: var(--md-outlined-segmented-button-selected-focus-label-text-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-hover-icon-color: var(--md-outlined-segmented-button-selected-hover-icon-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-hover-label-text-color: var(--md-outlined-segmented-button-selected-hover-label-text-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-hover-state-layer-color: var(--md-outlined-segmented-button-selected-hover-state-layer-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-label-text-color: var(--md-outlined-segmented-button-selected-label-text-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-pressed-icon-color: var(--md-outlined-segmented-button-selected-pressed-icon-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-pressed-label-text-color: var(--md-outlined-segmented-button-selected-pressed-label-text-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-pressed-state-layer-color: var(--md-outlined-segmented-button-selected-pressed-state-layer-color, var(--md-sys-color-on-secondary-container, #1d192b));--_unselected-focus-icon-color: var(--md-outlined-segmented-button-unselected-focus-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-focus-label-text-color: var(--md-outlined-segmented-button-unselected-focus-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-hover-icon-color: var(--md-outlined-segmented-button-unselected-hover-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-hover-label-text-color: var(--md-outlined-segmented-button-unselected-hover-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-hover-state-layer-color: var(--md-outlined-segmented-button-unselected-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-label-text-color: var(--md-outlined-segmented-button-unselected-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-pressed-icon-color: var(--md-outlined-segmented-button-unselected-pressed-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-pressed-label-text-color: var(--md-outlined-segmented-button-unselected-pressed-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-pressed-state-layer-color: var(--md-outlined-segmented-button-unselected-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_icon-size: var(--md-outlined-segmented-button-icon-size, 18px);--_selected-icon-color: var(--md-outlined-segmented-button-selected-icon-color, var(--md-sys-color-on-secondary-container, #1d192b));--_unselected-icon-color: var(--md-outlined-segmented-button-unselected-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_shape-start-start: var( --md-outlined-segmented-button-shape-start-start, var(--_shape) );--_shape-start-end: var( --md-outlined-segmented-button-shape-start-end, var(--_shape) );--_shape-end-end: var( --md-outlined-segmented-button-shape-end-end, var(--_shape) );--_shape-end-start: var( --md-outlined-segmented-button-shape-end-start, var(--_shape) )}/*# sourceMappingURL=outlined-styles.css.map */
|
|
8
8
|
`;
|
|
9
9
|
//# sourceMappingURL=outlined-styles.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outlined-styles.css.js","sourceRoot":"","sources":["outlined-styles.css.ts"],"names":[],"mappings":"AAAA;;;;IAII;AACH,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACzB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n import {css} from 'lit';\n export const styles = css`:host{--
|
|
1
|
+
{"version":3,"file":"outlined-styles.css.js","sourceRoot":"","sources":["outlined-styles.css.ts"],"names":[],"mappings":"AAAA;;;;IAII;AACH,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AACxB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;CACzB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n import {css} from 'lit';\n export const styles = css`:host{--_disabled-icon-color: var(--md-outlined-segmented-button-disabled-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-label-text-color: var(--md-outlined-segmented-button-disabled-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-outline-color: var(--md-outlined-segmented-button-disabled-outline-color, var(--md-sys-color-on-surface, #1d1b20));--_hover-state-layer-opacity: var(--md-outlined-segmented-button-hover-state-layer-opacity, 0.08);--_label-text-type: var(--md-outlined-segmented-button-label-text-type, var(--md-sys-typescale-label-large, 500 0.875rem / 1.25rem var(--md-ref-typeface-plain, Roboto)));--_outline-color: var(--md-outlined-segmented-button-outline-color, var(--md-sys-color-outline, #79747e));--_pressed-state-layer-opacity: var(--md-outlined-segmented-button-pressed-state-layer-opacity, 0.12);--_selected-container-color: var(--md-outlined-segmented-button-selected-container-color, var(--md-sys-color-secondary-container, #e8def8));--_selected-focus-icon-color: var(--md-outlined-segmented-button-selected-focus-icon-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-focus-label-text-color: var(--md-outlined-segmented-button-selected-focus-label-text-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-hover-icon-color: var(--md-outlined-segmented-button-selected-hover-icon-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-hover-label-text-color: var(--md-outlined-segmented-button-selected-hover-label-text-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-hover-state-layer-color: var(--md-outlined-segmented-button-selected-hover-state-layer-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-label-text-color: var(--md-outlined-segmented-button-selected-label-text-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-pressed-icon-color: var(--md-outlined-segmented-button-selected-pressed-icon-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-pressed-label-text-color: var(--md-outlined-segmented-button-selected-pressed-label-text-color, var(--md-sys-color-on-secondary-container, #1d192b));--_selected-pressed-state-layer-color: var(--md-outlined-segmented-button-selected-pressed-state-layer-color, var(--md-sys-color-on-secondary-container, #1d192b));--_unselected-focus-icon-color: var(--md-outlined-segmented-button-unselected-focus-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-focus-label-text-color: var(--md-outlined-segmented-button-unselected-focus-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-hover-icon-color: var(--md-outlined-segmented-button-unselected-hover-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-hover-label-text-color: var(--md-outlined-segmented-button-unselected-hover-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-hover-state-layer-color: var(--md-outlined-segmented-button-unselected-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-label-text-color: var(--md-outlined-segmented-button-unselected-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-pressed-icon-color: var(--md-outlined-segmented-button-unselected-pressed-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-pressed-label-text-color: var(--md-outlined-segmented-button-unselected-pressed-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_unselected-pressed-state-layer-color: var(--md-outlined-segmented-button-unselected-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_icon-size: var(--md-outlined-segmented-button-icon-size, 18px);--_selected-icon-color: var(--md-outlined-segmented-button-selected-icon-color, var(--md-sys-color-on-secondary-container, #1d192b));--_unselected-icon-color: var(--md-outlined-segmented-button-unselected-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_shape-start-start: var( --md-outlined-segmented-button-shape-start-start, var(--_shape) );--_shape-start-end: var( --md-outlined-segmented-button-shape-start-end, var(--_shape) );--_shape-end-end: var( --md-outlined-segmented-button-shape-end-end, var(--_shape) );--_shape-end-start: var( --md-outlined-segmented-button-shape-end-start, var(--_shape) )}/*# sourceMappingURL=outlined-styles.css.map */\n`;\n "]}
|
package/list/harness.d.ts
CHANGED
|
@@ -7,6 +7,17 @@ import { Harness } from '../testing/harness.js';
|
|
|
7
7
|
import { List } from './lib/list.js';
|
|
8
8
|
import { ListItemHarness } from './lib/listitem/harness.js';
|
|
9
9
|
export { ListItemHarness } from './lib/listitem/harness.js';
|
|
10
|
+
declare const NAVIGABLE_KEYS: {
|
|
11
|
+
readonly ArrowDown: "ArrowDown";
|
|
12
|
+
readonly ArrowUp: "ArrowUp";
|
|
13
|
+
readonly Home: "Home";
|
|
14
|
+
readonly End: "End";
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Keys that are handled by MdList. Keys not included in this are not handled by
|
|
18
|
+
* MdList and should be dispatched by yourself.
|
|
19
|
+
*/
|
|
20
|
+
export type HandledListKeys = typeof NAVIGABLE_KEYS[keyof typeof NAVIGABLE_KEYS];
|
|
10
21
|
/**
|
|
11
22
|
* Test harness for list.
|
|
12
23
|
*/
|
|
@@ -17,4 +28,17 @@ export declare class ListHarness extends Harness<List> {
|
|
|
17
28
|
protected getInteractiveElement(): Promise<HTMLElement>;
|
|
18
29
|
/** @return List item harnesses. */
|
|
19
30
|
getItems(): ListItemHarness[];
|
|
31
|
+
/**
|
|
32
|
+
* Constructs keyboard events that are handled by List and makes sure that
|
|
33
|
+
* they are constructed in a manner that List understands.
|
|
34
|
+
*
|
|
35
|
+
* @param key The key to dispatch on the list.
|
|
36
|
+
*/
|
|
37
|
+
pressHandledKey<T extends string = HandledListKeys>(key: T): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Dispatches a keypress on the list. It may or may not be a supported event.
|
|
40
|
+
*
|
|
41
|
+
* @param key The key to dispatch on the list.
|
|
42
|
+
*/
|
|
43
|
+
keypress(key: string, init?: KeyboardEventInit): Promise<void>;
|
|
20
44
|
}
|
package/list/harness.js
CHANGED
|
@@ -6,6 +6,12 @@
|
|
|
6
6
|
import { Harness } from '../testing/harness.js';
|
|
7
7
|
import { ListItemHarness } from './lib/listitem/harness.js';
|
|
8
8
|
export { ListItemHarness } from './lib/listitem/harness.js';
|
|
9
|
+
const NAVIGABLE_KEYS = {
|
|
10
|
+
'ArrowDown': 'ArrowDown',
|
|
11
|
+
'ArrowUp': 'ArrowUp',
|
|
12
|
+
'Home': 'Home',
|
|
13
|
+
'End': 'End',
|
|
14
|
+
};
|
|
9
15
|
/**
|
|
10
16
|
* Test harness for list.
|
|
11
17
|
*/
|
|
@@ -21,5 +27,24 @@ export class ListHarness extends Harness {
|
|
|
21
27
|
getItems() {
|
|
22
28
|
return this.element.items.map((item) => new ListItemHarness(item));
|
|
23
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Constructs keyboard events that are handled by List and makes sure that
|
|
32
|
+
* they are constructed in a manner that List understands.
|
|
33
|
+
*
|
|
34
|
+
* @param key The key to dispatch on the list.
|
|
35
|
+
*/
|
|
36
|
+
async pressHandledKey(key) {
|
|
37
|
+
await this.keypress(key, { code: key });
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Dispatches a keypress on the list. It may or may not be a supported event.
|
|
41
|
+
*
|
|
42
|
+
* @param key The key to dispatch on the list.
|
|
43
|
+
*/
|
|
44
|
+
async keypress(key, init = {}) {
|
|
45
|
+
const nativeList = this.element.renderRoot.querySelector('ul');
|
|
46
|
+
init = { code: key, ...init };
|
|
47
|
+
this.simulateKeypress(nativeList, key, init);
|
|
48
|
+
}
|
|
24
49
|
}
|
|
25
50
|
//# sourceMappingURL=harness.js.map
|
package/list/harness.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harness.js","sourceRoot":"","sources":["harness.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAG9C,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"harness.js","sourceRoot":"","sources":["harness.ts"],"names":[],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\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {Harness} from '../testing/harness.js';\n\nimport {List} from './lib/list.js';\nimport {ListItemHarness} from './lib/listitem/harness.js';\nimport {ListItemEl} from './lib/listitem/list-item.js';\n\nexport {ListItemHarness} from './lib/listitem/harness.js';\n\nconst NAVIGABLE_KEYS = {\n 'ArrowDown': 'ArrowDown',\n 'ArrowUp': 'ArrowUp',\n 'Home': 'Home',\n 'End': 'End',\n} as const;\n\n/**\n * Keys that are handled by MdList. Keys not included in this are not handled by\n * MdList and should be dispatched by yourself.\n */\nexport type HandledListKeys =\n typeof NAVIGABLE_KEYS[keyof typeof NAVIGABLE_KEYS];\n\n/**\n * Test harness for list.\n */\nexport class ListHarness extends Harness<List> {\n /**\n * Returns the first list item element.\n */\n protected override async getInteractiveElement() {\n await this.element.updateComplete;\n return (await this.getItems())[0].getInteractiveElement();\n }\n\n /** @return List item harnesses. */\n getItems() {\n return this.element.items.map(\n (item) => new ListItemHarness(item as ListItemEl));\n }\n\n /**\n * Constructs keyboard events that are handled by List and makes sure that\n * they are constructed in a manner that List understands.\n *\n * @param key The key to dispatch on the list.\n */\n async pressHandledKey<T extends string = HandledListKeys>(key: T) {\n await this.keypress(key, {code: key});\n }\n\n /**\n * Dispatches a keypress on the list. It may or may not be a supported event.\n *\n * @param key The key to dispatch on the list.\n */\n override async keypress(key: string, init = {} as KeyboardEventInit) {\n const nativeList = this.element.renderRoot.querySelector('ul')!;\n init = {code: key, ...init};\n this.simulateKeypress(nativeList, key, init);\n }\n}\n"]}
|
package/list/lib/list.d.ts
CHANGED
|
@@ -6,6 +6,14 @@
|
|
|
6
6
|
import { LitElement } from 'lit';
|
|
7
7
|
import { ARIARole } from '../../internal/aria/aria.js';
|
|
8
8
|
import { ListItem } from './listitem/list-item.js';
|
|
9
|
+
/**
|
|
10
|
+
* A record that describes a list item in a list with metadata such a reference
|
|
11
|
+
* to the item and its index in the list.
|
|
12
|
+
*/
|
|
13
|
+
export interface ItemRecord {
|
|
14
|
+
item: ListItem;
|
|
15
|
+
index: number;
|
|
16
|
+
}
|
|
9
17
|
export declare class List extends LitElement {
|
|
10
18
|
/** @nocollapse */
|
|
11
19
|
static shadowRootOptions: ShadowRootInit;
|
|
@@ -39,6 +47,22 @@ export declare class List extends LitElement {
|
|
|
39
47
|
* @param event {KeyboardEvent} The keyboard event that triggers this handler.
|
|
40
48
|
*/
|
|
41
49
|
handleKeydown(event: KeyboardEvent): void;
|
|
50
|
+
private activateNextItemInternal;
|
|
51
|
+
private activatePreviousItemInternal;
|
|
52
|
+
/**
|
|
53
|
+
* Activates the next item in the list. If at the end of the list, the first
|
|
54
|
+
* item will be activated.
|
|
55
|
+
*
|
|
56
|
+
* @return The activated list item or `null` if there are no items.
|
|
57
|
+
*/
|
|
58
|
+
activateNextItem(): ListItem | null;
|
|
59
|
+
/**
|
|
60
|
+
* Activates the previous item in the list. If at the start of the list, the
|
|
61
|
+
* last item will be activated.
|
|
62
|
+
*
|
|
63
|
+
* @return The activated list item or `null` if there are no items.
|
|
64
|
+
*/
|
|
65
|
+
activatePreviousItem(): ListItem | null;
|
|
42
66
|
/**
|
|
43
67
|
* Activates the first non-disabled item of a given array of items.
|
|
44
68
|
*
|
|
@@ -46,7 +70,7 @@ export declare class List extends LitElement {
|
|
|
46
70
|
* first item.
|
|
47
71
|
* @nocollapse
|
|
48
72
|
*/
|
|
49
|
-
static activateFirstItem<T extends ListItem>(items: T[]):
|
|
73
|
+
static activateFirstItem<T extends ListItem>(items: T[]): T;
|
|
50
74
|
/**
|
|
51
75
|
* Activates the last non-disabled item of a given array of items.
|
|
52
76
|
*
|
|
@@ -54,7 +78,7 @@ export declare class List extends LitElement {
|
|
|
54
78
|
* last item.
|
|
55
79
|
* @nocollapse
|
|
56
80
|
*/
|
|
57
|
-
static activateLastItem<T extends ListItem>(items: T[]):
|
|
81
|
+
static activateLastItem<T extends ListItem>(items: T[]): T;
|
|
58
82
|
/**
|
|
59
83
|
* Deactivates the currently active item of a given array of items.
|
|
60
84
|
*
|
|
@@ -64,10 +88,7 @@ export declare class List extends LitElement {
|
|
|
64
88
|
* the index of the item or `null` if none are deactivated.
|
|
65
89
|
* @nocollapse
|
|
66
90
|
*/
|
|
67
|
-
static deactivateActiveItem<T extends ListItem>(items: T[]):
|
|
68
|
-
item: T;
|
|
69
|
-
index: number;
|
|
70
|
-
};
|
|
91
|
+
static deactivateActiveItem<T extends ListItem>(items: T[]): ItemRecord;
|
|
71
92
|
focus(): void;
|
|
72
93
|
/**
|
|
73
94
|
* Retrieves the first activated item of a given array of items.
|
|
@@ -77,10 +98,7 @@ export declare class List extends LitElement {
|
|
|
77
98
|
* index of the item or `null` if none are activated.
|
|
78
99
|
* @nocollapse
|
|
79
100
|
*/
|
|
80
|
-
static getActiveItem<T extends ListItem>(items: T[]):
|
|
81
|
-
item: T;
|
|
82
|
-
index: number;
|
|
83
|
-
};
|
|
101
|
+
static getActiveItem<T extends ListItem>(items: T[]): ItemRecord;
|
|
84
102
|
/**
|
|
85
103
|
* Retrieves the first non-disabled item of a given array of items. This
|
|
86
104
|
* the first item that is not disabled.
|
package/list/lib/list.js
CHANGED
|
@@ -79,25 +79,11 @@ export class List extends LitElement {
|
|
|
79
79
|
switch (key) {
|
|
80
80
|
// Activate the next item
|
|
81
81
|
case NAVIGABLE_KEYS.ArrowDown:
|
|
82
|
-
|
|
83
|
-
const next = List.getNextItem(items, activeItemRecord.index);
|
|
84
|
-
if (next)
|
|
85
|
-
next.active = true;
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
List.activateFirstItem(items);
|
|
89
|
-
}
|
|
82
|
+
this.activateNextItemInternal(items, activeItemRecord);
|
|
90
83
|
break;
|
|
91
84
|
// Activate the previous item
|
|
92
85
|
case NAVIGABLE_KEYS.ArrowUp:
|
|
93
|
-
|
|
94
|
-
const prev = List.getPrevItem(items, activeItemRecord.index);
|
|
95
|
-
if (prev)
|
|
96
|
-
prev.active = true;
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
items[items.length - 1].active = true;
|
|
100
|
-
}
|
|
86
|
+
this.activatePreviousItemInternal(items, activeItemRecord);
|
|
101
87
|
break;
|
|
102
88
|
// Activate the first item
|
|
103
89
|
case NAVIGABLE_KEYS.Home:
|
|
@@ -111,6 +97,56 @@ export class List extends LitElement {
|
|
|
111
97
|
break;
|
|
112
98
|
}
|
|
113
99
|
}
|
|
100
|
+
activateNextItemInternal(items, activeItemRecord) {
|
|
101
|
+
if (activeItemRecord) {
|
|
102
|
+
const next = List.getNextItem(items, activeItemRecord.index);
|
|
103
|
+
if (next)
|
|
104
|
+
next.active = true;
|
|
105
|
+
return next;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
return List.activateFirstItem(items);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
activatePreviousItemInternal(items, activeItemRecord) {
|
|
112
|
+
if (activeItemRecord) {
|
|
113
|
+
const prev = List.getPrevItem(items, activeItemRecord.index);
|
|
114
|
+
if (prev)
|
|
115
|
+
prev.active = true;
|
|
116
|
+
return prev;
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
return List.activateLastItem(items);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Activates the next item in the list. If at the end of the list, the first
|
|
124
|
+
* item will be activated.
|
|
125
|
+
*
|
|
126
|
+
* @return The activated list item or `null` if there are no items.
|
|
127
|
+
*/
|
|
128
|
+
activateNextItem() {
|
|
129
|
+
const items = this.items;
|
|
130
|
+
const activeItemRecord = List.getActiveItem(items);
|
|
131
|
+
if (activeItemRecord) {
|
|
132
|
+
activeItemRecord.item.active = false;
|
|
133
|
+
}
|
|
134
|
+
return this.activateNextItemInternal(items, activeItemRecord);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Activates the previous item in the list. If at the start of the list, the
|
|
138
|
+
* last item will be activated.
|
|
139
|
+
*
|
|
140
|
+
* @return The activated list item or `null` if there are no items.
|
|
141
|
+
*/
|
|
142
|
+
activatePreviousItem() {
|
|
143
|
+
const items = this.items;
|
|
144
|
+
const activeItemRecord = List.getActiveItem(items);
|
|
145
|
+
if (activeItemRecord) {
|
|
146
|
+
activeItemRecord.item.active = false;
|
|
147
|
+
}
|
|
148
|
+
return this.activatePreviousItemInternal(items, activeItemRecord);
|
|
149
|
+
}
|
|
114
150
|
/**
|
|
115
151
|
* Activates the first non-disabled item of a given array of items.
|
|
116
152
|
*
|
|
@@ -126,6 +162,7 @@ export class List extends LitElement {
|
|
|
126
162
|
if (firstItem) {
|
|
127
163
|
firstItem.active = true;
|
|
128
164
|
}
|
|
165
|
+
return firstItem;
|
|
129
166
|
}
|
|
130
167
|
/**
|
|
131
168
|
* Activates the last non-disabled item of a given array of items.
|
|
@@ -139,6 +176,7 @@ export class List extends LitElement {
|
|
|
139
176
|
if (lastItem) {
|
|
140
177
|
lastItem.active = true;
|
|
141
178
|
}
|
|
179
|
+
return lastItem;
|
|
142
180
|
}
|
|
143
181
|
/**
|
|
144
182
|
* Deactivates the currently active item of a given array of items.
|
|
@@ -226,7 +264,7 @@ export class List extends LitElement {
|
|
|
226
264
|
return item;
|
|
227
265
|
}
|
|
228
266
|
}
|
|
229
|
-
return null;
|
|
267
|
+
return items[index] ? items[index] : null;
|
|
230
268
|
}
|
|
231
269
|
/**
|
|
232
270
|
* Retrieves the previous non-disabled item of a given array of items.
|
|
@@ -243,7 +281,7 @@ export class List extends LitElement {
|
|
|
243
281
|
return item;
|
|
244
282
|
}
|
|
245
283
|
}
|
|
246
|
-
return null;
|
|
284
|
+
return items[index] ? items[index] : null;
|
|
247
285
|
}
|
|
248
286
|
}
|
|
249
287
|
_a = List;
|
|
@@ -256,7 +294,7 @@ __decorate([
|
|
|
256
294
|
property()
|
|
257
295
|
], List.prototype, "type", void 0);
|
|
258
296
|
__decorate([
|
|
259
|
-
property({ type: Number })
|
|
297
|
+
property({ type: Number, attribute: 'list-tabindex' })
|
|
260
298
|
], List.prototype, "listTabIndex", void 0);
|
|
261
299
|
__decorate([
|
|
262
300
|
query('.md3-list')
|
package/list/lib/list.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;AAEH,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,KAAK,CAAC;AAC9C,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AAGzE,OAAO,EAAC,yBAAyB,EAAC,MAAM,iCAAiC,CAAC;AAI1E,MAAM,cAAc,GAAG;IACrB,SAAS,EAAE,WAAW;IACtB,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;CACF,CAAC;AAIX,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;AAE/D,SAAS,cAAc,CAAC,GAAW;IACjC,OAAO,eAAe,CAAC,GAAG,CAAC,GAAwB,CAAC,CAAC;AACvD,CAAC;AAED,gEAAgE;AAChE,MAAM,OAAO,IAAK,SAAQ,UAAU;IAApC;;QASc,SAAI,GAAgB,MAAM,CAAC;QAEvC;;WAEG;QACuB,iBAAY,GAAG,CAAC,CAAC;IA6P7C,CAAC;IA9OoB,MAAM;QACvB,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;IAC3B,CAAC;IAED;;OAEG;IACK,UAAU;QAChB,iCAAiC;QACjC,MAAM,EAAC,SAAS,EAAC,GAAG,IAAuB,CAAC;QAC5C,OAAO,IAAI,CAAA;;qBAEM,SAAS,IAAI,OAAO;mBACtB,IAAI,CAAC,YAAY;eACrB,IAAI,CAAC,IAAI,IAAI,OAAO;mBAChB,IAAI,CAAC,aAAa;;QAE7B,IAAI,CAAC,aAAa,EAAE;;GAEzB,CAAC;IACF,CAAC;IAED;;O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KAAa;QACtE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACrC,MAAM,SAAS,GAAG,CAAC,KAAK,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;YAC5D,MAAM,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;YAE9B,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;gBAClB,OAAO,IAAI,CAAC;aACb;SACF;QACD,OAAO,IAAI,CAAC;IACd,CAAC;;;AAzQD;IACE,yBAAyB,CAAC,EAAI,CAAC,CAAC;AAClC,CAAC,GAAA,CAAA;AAED,kBAAkB;AACF,sBAAiB,GACZ,EAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,EAAC,CAAC;AAE9C;IAAX,QAAQ,EAAE;kCAA4B;AAKb;IAAzB,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;0CAAkB;AAEvB;IAAnB,KAAK,CAAC,WAAW,CAAC;sCAA6B;AAWhD;IADC,qBAAqB,CAAC,EAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,gBAAgB,EAAC,CAAC;mCAChD","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, query, queryAssignedElements} from 'lit/decorators.js';\n\nimport {ARIAMixinStrict, ARIARole} from '../../internal/aria/aria.js';\nimport {requestUpdateOnAriaChange} from '../../internal/aria/delegate.js';\n\nimport {ListItem} from './listitem/list-item.js';\n\nconst NAVIGABLE_KEYS = {\n ArrowDown: 'ArrowDown',\n ArrowUp: 'ArrowUp',\n Home: 'Home',\n End: 'End',\n} as const;\n\ntype NavigatableValues = typeof NAVIGABLE_KEYS[keyof typeof NAVIGABLE_KEYS];\n\nconst navigableKeySet = new Set(Object.values(NAVIGABLE_KEYS));\n\nfunction isNavigableKey(key: string): key is NavigatableValues {\n return navigableKeySet.has(key as NavigatableValues);\n}\n\n// tslint:disable-next-line:enforce-comments-on-exported-symbols\nexport class List extends LitElement {\n static {\n requestUpdateOnAriaChange(this);\n }\n\n /** @nocollapse */\n static override shadowRootOptions:\n ShadowRootInit = {mode: 'open', delegatesFocus: true};\n\n @property() type: ARIARole|'' = 'list';\n\n /**\n * The tabindex of the underlying list.\n */\n @property({type: Number}) listTabIndex = 0;\n\n @query('.md3-list') listRoot!: HTMLElement|null;\n\n /**\n * An array of activatable and disableable list items. Queries every assigned\n * element that has the `md-list-item` attribute.\n *\n * _NOTE:_ This is a shallow, flattened query via\n * `HTMLSlotElement.queryAssignedElements` and thus will _only_ include direct\n * children / directly slotted elements.\n */\n @queryAssignedElements({flatten: true, selector: '[md-list-item]'})\n items!: ListItem[];\n\n protected override render() {\n return this.renderList();\n }\n\n /**\n * Renders the main list element.\n */\n private renderList() {\n // Needed for closure conformance\n const {ariaLabel} = this as ARIAMixinStrict;\n return html`\n <ul class=\"md3-list\"\n aria-label=${ariaLabel || nothing}\n tabindex=${this.listTabIndex}\n role=${this.type || nothing}\n @keydown=${this.handleKeydown}\n >\n ${this.renderContent()}\n </ul>\n `;\n }\n\n /**\n * The content to be slotted into the list.\n */\n private renderContent() {\n return html`<span><slot @click=${(e: Event) => {\n e.stopPropagation();\n }}></slot></span>`;\n }\n\n /**\n * Handles keyboard navigation in the list.\n *\n * @param event {KeyboardEvent} The keyboard event that triggers this handler.\n */\n handleKeydown(event: KeyboardEvent) {\n const key = event.key;\n if (!isNavigableKey(key)) {\n return;\n }\n // do not use this.items directly so we don't re-query the DOM unnecessarily\n const items = this.items;\n\n if (!items.length) {\n return;\n }\n\n const activeItemRecord = List.getActiveItem(items);\n\n if (activeItemRecord) {\n activeItemRecord.item.active = false;\n }\n\n event.preventDefault();\n\n switch (key) {\n // Activate the next item\n case NAVIGABLE_KEYS.ArrowDown:\n if (activeItemRecord) {\n const next = List.getNextItem(items, activeItemRecord.index);\n\n if (next) next.active = true;\n } else {\n List.activateFirstItem(items);\n }\n break;\n\n // Activate the previous item\n case NAVIGABLE_KEYS.ArrowUp:\n if (activeItemRecord) {\n const prev = List.getPrevItem(items, activeItemRecord.index);\n if (prev) prev.active = true;\n } else {\n items[items.length - 1].active = true;\n }\n break;\n\n // Activate the first item\n case NAVIGABLE_KEYS.Home:\n List.activateFirstItem(items);\n break;\n\n // Activate the last item\n case NAVIGABLE_KEYS.End:\n List.activateLastItem(items);\n break;\n\n default:\n break;\n }\n }\n\n /**\n * Activates the first non-disabled item of a given array of items.\n *\n * @param items {Array<ListItem>} The items from which to activate the\n * first item.\n * @nocollapse\n */\n static activateFirstItem<T extends ListItem>(items: T[]) {\n // NOTE: These selector functions are static and not on the instance such\n // that multiple operations can be chained and we do not have to re-query\n // the DOM\n const firstItem = List.getFirstActivatableItem(items);\n if (firstItem) {\n firstItem.active = true;\n }\n }\n\n /**\n * Activates the last non-disabled item of a given array of items.\n *\n * @param items {Array<ListItem>} The items from which to activate the\n * last item.\n * @nocollapse\n */\n static activateLastItem<T extends ListItem>(items: T[]) {\n const lastItem = List.getLastActivatableItem(items);\n if (lastItem) {\n lastItem.active = true;\n }\n }\n\n /**\n * Deactivates the currently active item of a given array of items.\n *\n * @param items {Array<ListItem>} The items from which to deactivate the\n * active item.\n * @return A record of the deleselcted activated item including the item and\n * the index of the item or `null` if none are deactivated.\n * @nocollapse\n */\n static deactivateActiveItem<T extends ListItem>(items: T[]) {\n const activeItem = List.getActiveItem(items);\n if (activeItem) {\n activeItem.item.active = false;\n }\n return activeItem;\n }\n\n override focus() {\n this.listRoot?.focus();\n }\n\n /**\n * Retrieves the first activated item of a given array of items.\n *\n * @param items {Array<ListItem>} The items to search.\n * @return A record of the first activated item including the item and the\n * index of the item or `null` if none are activated.\n * @nocollapse\n */\n static getActiveItem<T extends ListItem>(items: T[]) {\n for (let i = 0; i < items.length; i++) {\n const item = items[i];\n if (item.active) {\n return {\n item,\n index: i,\n };\n }\n }\n return null;\n }\n\n /**\n * Retrieves the first non-disabled item of a given array of items. This\n * the first item that is not disabled.\n *\n * @param items {Array<ListItem>} The items to search.\n * @return The first activatable item or `null` if none are activatable.\n * @nocollapse\n */\n static getFirstActivatableItem<T extends ListItem>(items: T[]) {\n for (const item of items) {\n if (!item.disabled) {\n return item;\n }\n }\n\n return null;\n }\n\n /**\n * Retrieves the last non-disabled item of a given array of items.\n *\n * @param items {Array<ListItem>} The items to search.\n * @return The last activatable item or `null` if none are activatable.\n * @nocollapse\n */\n static getLastActivatableItem<T extends ListItem>(items: T[]) {\n for (let i = items.length - 1; i >= 0; i--) {\n const item = items[i];\n if (!item.disabled) {\n return item;\n }\n }\n\n return null;\n }\n\n /**\n * Retrieves the next non-disabled item of a given array of items.\n *\n * @param items {Array<ListItem>} The items to search.\n * @param index {{index: number}} The index to search from.\n * @return The next activatable item or `null` if none are activatable.\n */\n private static getNextItem<T extends ListItem>(items: T[], index: number) {\n for (let i = 1; i < items.length; i++) {\n const nextIndex = (i + index) % items.length;\n const item = items[nextIndex];\n if (!item.disabled) {\n return item;\n }\n }\n return null;\n }\n\n /**\n * Retrieves the previous non-disabled item of a given array of items.\n *\n * @param items {Array<ListItem>} The items to search.\n * @param index {{index: number}} The index to search from.\n * @return The previous activatable item or `null` if none are activatable.\n */\n private static getPrevItem<T extends ListItem>(items: T[], index: number) {\n for (let i = 1; i < items.length; i++) {\n const prevIndex = (index - i + items.length) % items.length;\n const item = items[prevIndex];\n\n if (!item.disabled) {\n return item;\n }\n }\n return null;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;AAEH,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,KAAK,CAAC;AAC9C,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;A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ACZ,EAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,EAAC,CAAC;AAE9C;IAAX,QAAQ,EAAE;kCAA4B;AAKe;IAArD,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAC,CAAC;0CAAkB;AAEnD;IAAnB,KAAK,CAAC,WAAW,CAAC;sCAA6B;AAWhD;IADC,qBAAqB,CAAC,EAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,gBAAgB,EAAC,CAAC;mCAChD","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, query, queryAssignedElements} from 'lit/decorators.js';\n\nimport {ARIAMixinStrict, ARIARole} from '../../internal/aria/aria.js';\nimport {requestUpdateOnAriaChange} from '../../internal/aria/delegate.js';\n\nimport {ListItem} from './listitem/list-item.js';\n\nconst NAVIGABLE_KEYS = {\n ArrowDown: 'ArrowDown',\n ArrowUp: 'ArrowUp',\n Home: 'Home',\n End: 'End',\n} as const;\n\n/**\n * A record that describes a list item in a list with metadata such a reference\n * to the item and its index in the list.\n */\nexport interface ItemRecord {\n item: ListItem;\n index: number;\n}\n\ntype NavigatableValues = typeof NAVIGABLE_KEYS[keyof typeof NAVIGABLE_KEYS];\n\nconst navigableKeySet = new Set(Object.values(NAVIGABLE_KEYS));\n\nfunction isNavigableKey(key: string): key is NavigatableValues {\n return navigableKeySet.has(key as NavigatableValues);\n}\n\n// tslint:disable-next-line:enforce-comments-on-exported-symbols\nexport class List extends LitElement {\n static {\n requestUpdateOnAriaChange(this);\n }\n\n /** @nocollapse */\n static override shadowRootOptions:\n ShadowRootInit = {mode: 'open', delegatesFocus: true};\n\n @property() type: ARIARole|'' = 'list';\n\n /**\n * The tabindex of the underlying list.\n */\n @property({type: Number, attribute: 'list-tabindex'}) listTabIndex = 0;\n\n @query('.md3-list') listRoot!: HTMLElement|null;\n\n /**\n * An array of activatable and disableable list items. Queries every assigned\n * element that has the `md-list-item` attribute.\n *\n * _NOTE:_ This is a shallow, flattened query via\n * `HTMLSlotElement.queryAssignedElements` and thus will _only_ include direct\n * children / directly slotted elements.\n */\n @queryAssignedElements({flatten: true, selector: '[md-list-item]'})\n items!: ListItem[];\n\n protected override render() {\n return this.renderList();\n }\n\n /**\n * Renders the main list element.\n */\n private renderList() {\n // Needed for closure conformance\n const {ariaLabel} = this as ARIAMixinStrict;\n return html`\n <ul class=\"md3-list\"\n aria-label=${ariaLabel || nothing}\n tabindex=${this.listTabIndex}\n role=${this.type || nothing}\n @keydown=${this.handleKeydown}\n >\n ${this.renderContent()}\n </ul>\n `;\n }\n\n /**\n * The content to be slotted into the list.\n */\n private renderContent() {\n return html`<span><slot @click=${(e: Event) => {\n e.stopPropagation();\n }}></slot></span>`;\n }\n\n /**\n * Handles keyboard navigation in the list.\n *\n * @param event {KeyboardEvent} The keyboard event that triggers this handler.\n */\n handleKeydown(event: KeyboardEvent) {\n const key = event.key;\n if (!isNavigableKey(key)) {\n return;\n }\n // do not use this.items directly so we don't re-query the DOM unnecessarily\n const items = this.items;\n\n if (!items.length) {\n return;\n }\n\n const activeItemRecord = List.getActiveItem(items);\n\n if (activeItemRecord) {\n activeItemRecord.item.active = false;\n }\n\n event.preventDefault();\n\n switch (key) {\n // Activate the next item\n case NAVIGABLE_KEYS.ArrowDown:\n this.activateNextItemInternal(items, activeItemRecord);\n break;\n\n // Activate the previous item\n case NAVIGABLE_KEYS.ArrowUp:\n this.activatePreviousItemInternal(items, activeItemRecord);\n break;\n\n // Activate the first item\n case NAVIGABLE_KEYS.Home:\n List.activateFirstItem(items);\n break;\n\n // Activate the last item\n case NAVIGABLE_KEYS.End:\n List.activateLastItem(items);\n break;\n\n default:\n break;\n }\n }\n\n private activateNextItemInternal(\n items: ListItem[], activeItemRecord: null|ItemRecord): ListItem|null {\n if (activeItemRecord) {\n const next = List.getNextItem(items, activeItemRecord.index);\n\n if (next) next.active = true;\n\n return next;\n } else {\n return List.activateFirstItem(items);\n }\n }\n\n private activatePreviousItemInternal(\n items: ListItem[], activeItemRecord: null|ItemRecord): ListItem|null {\n if (activeItemRecord) {\n const prev = List.getPrevItem(items, activeItemRecord.index);\n if (prev) prev.active = true;\n return prev;\n } else {\n return List.activateLastItem(items);\n }\n }\n\n /**\n * Activates the next item in the list. If at the end of the list, the first\n * item will be activated.\n *\n * @return The activated list item or `null` if there are no items.\n */\n activateNextItem(): ListItem|null {\n const items = this.items;\n const activeItemRecord = List.getActiveItem(items);\n if (activeItemRecord) {\n activeItemRecord.item.active = false;\n }\n return this.activateNextItemInternal(items, activeItemRecord);\n }\n\n /**\n * Activates the previous item in the list. If at the start of the list, the\n * last item will be activated.\n *\n * @return The activated list item or `null` if there are no items.\n */\n activatePreviousItem(): ListItem|null {\n const items = this.items;\n const activeItemRecord = List.getActiveItem(items);\n if (activeItemRecord) {\n activeItemRecord.item.active = false;\n }\n return this.activatePreviousItemInternal(items, activeItemRecord);\n }\n\n /**\n * Activates the first non-disabled item of a given array of items.\n *\n * @param items {Array<ListItem>} The items from which to activate the\n * first item.\n * @nocollapse\n */\n static activateFirstItem<T extends ListItem>(items: T[]) {\n // NOTE: These selector functions are static and not on the instance such\n // that multiple operations can be chained and we do not have to re-query\n // the DOM\n const firstItem = List.getFirstActivatableItem(items);\n if (firstItem) {\n firstItem.active = true;\n }\n return firstItem;\n }\n\n /**\n * Activates the last non-disabled item of a given array of items.\n *\n * @param items {Array<ListItem>} The items from which to activate the\n * last item.\n * @nocollapse\n */\n static activateLastItem<T extends ListItem>(items: T[]) {\n const lastItem = List.getLastActivatableItem(items);\n if (lastItem) {\n lastItem.active = true;\n }\n return lastItem;\n }\n\n /**\n * Deactivates the currently active item of a given array of items.\n *\n * @param items {Array<ListItem>} The items from which to deactivate the\n * active item.\n * @return A record of the deleselcted activated item including the item and\n * the index of the item or `null` if none are deactivated.\n * @nocollapse\n */\n static deactivateActiveItem<T extends ListItem>(items: T[]) {\n const activeItem = List.getActiveItem(items);\n if (activeItem) {\n activeItem.item.active = false;\n }\n return activeItem;\n }\n\n override focus() {\n this.listRoot?.focus();\n }\n\n /**\n * Retrieves the first activated item of a given array of items.\n *\n * @param items {Array<ListItem>} The items to search.\n * @return A record of the first activated item including the item and the\n * index of the item or `null` if none are activated.\n * @nocollapse\n */\n static getActiveItem<T extends ListItem>(items: T[]) {\n for (let i = 0; i < items.length; i++) {\n const item = items[i];\n if (item.active) {\n return {\n item,\n index: i,\n } as ItemRecord;\n }\n }\n return null;\n }\n\n /**\n * Retrieves the first non-disabled item of a given array of items. This\n * the first item that is not disabled.\n *\n * @param items {Array<ListItem>} The items to search.\n * @return The first activatable item or `null` if none are activatable.\n * @nocollapse\n */\n static getFirstActivatableItem<T extends ListItem>(items: T[]) {\n for (const item of items) {\n if (!item.disabled) {\n return item;\n }\n }\n\n return null;\n }\n\n /**\n * Retrieves the last non-disabled item of a given array of items.\n *\n * @param items {Array<ListItem>} The items to search.\n * @return The last activatable item or `null` if none are activatable.\n * @nocollapse\n */\n static getLastActivatableItem<T extends ListItem>(items: T[]) {\n for (let i = items.length - 1; i >= 0; i--) {\n const item = items[i];\n if (!item.disabled) {\n return item;\n }\n }\n\n return null;\n }\n\n /**\n * Retrieves the next non-disabled item of a given array of items.\n *\n * @param items {Array<ListItem>} The items to search.\n * @param index {{index: number}} The index to search from.\n * @return The next activatable item or `null` if none are activatable.\n */\n private static getNextItem<T extends ListItem>(items: T[], index: number) {\n for (let i = 1; i < items.length; i++) {\n const nextIndex = (i + index) % items.length;\n const item = items[nextIndex];\n if (!item.disabled) {\n return item;\n }\n }\n\n return items[index] ? items[index] : null;\n }\n\n /**\n * Retrieves the previous non-disabled item of a given array of items.\n *\n * @param items {Array<ListItem>} The items to search.\n * @param index {{index: number}} The index to search from.\n * @return The previous activatable item or `null` if none are activatable.\n */\n private static getPrevItem<T extends ListItem>(items: T[], index: number) {\n for (let i = 1; i < items.length; i++) {\n const prevIndex = (index - i + items.length) % items.length;\n const item = items[prevIndex];\n\n if (!item.disabled) {\n return item;\n }\n }\n\n return items[index] ? items[index] : null;\n }\n}\n"]}
|
|
@@ -3,11 +3,31 @@
|
|
|
3
3
|
* Copyright 2022 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import { LitElement } from 'lit';
|
|
6
7
|
import { Harness } from '../../../testing/harness.js';
|
|
7
8
|
import { ListItem } from './list-item.js';
|
|
9
|
+
declare const NAVIGABLE_KEYS: {
|
|
10
|
+
readonly ArrowDown: "ArrowDown";
|
|
11
|
+
readonly ArrowUp: "ArrowUp";
|
|
12
|
+
readonly Home: "Home";
|
|
13
|
+
readonly End: "End";
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Keys that are handled by MdList. Keys not included in this are not handled by
|
|
17
|
+
* MdList and should be dispatched by yourself.
|
|
18
|
+
*/
|
|
19
|
+
export type HandledListKeys = typeof NAVIGABLE_KEYS[keyof typeof NAVIGABLE_KEYS];
|
|
8
20
|
/**
|
|
9
21
|
* Test harness for list item.
|
|
10
22
|
*/
|
|
11
|
-
export declare class ListItemHarness extends Harness<ListItem> {
|
|
23
|
+
export declare class ListItemHarness extends Harness<ListItem & LitElement> {
|
|
12
24
|
getInteractiveElement(): Promise<HTMLElement>;
|
|
25
|
+
/**
|
|
26
|
+
* Constructs keyboard events that are handled by List and makes sure that
|
|
27
|
+
* they are constructed in a manner that List understands.
|
|
28
|
+
*
|
|
29
|
+
* @param key The key to dispatch on the list.
|
|
30
|
+
*/
|
|
31
|
+
pressHandledKey<T extends string = HandledListKeys>(key: T): Promise<void>;
|
|
13
32
|
}
|
|
33
|
+
export {};
|
|
@@ -4,14 +4,28 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { Harness } from '../../../testing/harness.js';
|
|
7
|
+
const NAVIGABLE_KEYS = {
|
|
8
|
+
'ArrowDown': 'ArrowDown',
|
|
9
|
+
'ArrowUp': 'ArrowUp',
|
|
10
|
+
'Home': 'Home',
|
|
11
|
+
'End': 'End',
|
|
12
|
+
};
|
|
7
13
|
/**
|
|
8
14
|
* Test harness for list item.
|
|
9
15
|
*/
|
|
10
16
|
export class ListItemHarness extends Harness {
|
|
11
17
|
async getInteractiveElement() {
|
|
12
18
|
await this.element.updateComplete;
|
|
13
|
-
return this.element
|
|
14
|
-
|
|
19
|
+
return this.element.renderRoot.querySelector('.list-item');
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Constructs keyboard events that are handled by List and makes sure that
|
|
23
|
+
* they are constructed in a manner that List understands.
|
|
24
|
+
*
|
|
25
|
+
* @param key The key to dispatch on the list.
|
|
26
|
+
*/
|
|
27
|
+
async pressHandledKey(key) {
|
|
28
|
+
await this.keypress(key, { code: key });
|
|
15
29
|
}
|
|
16
30
|
}
|
|
17
31
|
//# sourceMappingURL=harness.js.map
|