@material/web 1.1.2-nightly.c9360e2.0 → 1.1.2-nightly.c97362c.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/_filled-button.scss +1 -0
- package/button/internal/_filled-tonal-button.scss +1 -0
- package/button/internal/_text-button.scss +1 -0
- package/button/internal/button.d.ts +1 -1
- package/button/internal/button.js.map +1 -1
- package/checkbox/internal/_checkbox.scss +69 -63
- package/checkbox/internal/checkbox-styles.css.js +1 -1
- package/checkbox/internal/checkbox-styles.css.js.map +1 -1
- package/chips/internal/filter-chip.js +7 -1
- package/chips/internal/filter-chip.js.map +1 -1
- package/dialog/internal/dialog.d.ts +0 -6
- package/dialog/internal/dialog.js +19 -5
- package/dialog/internal/dialog.js.map +1 -1
- package/fab/branded-fab.d.ts +1 -1
- package/fab/branded-fab.js.map +1 -1
- package/fab/fab.d.ts +2 -2
- package/fab/fab.js.map +1 -1
- package/field/internal/field.js +7 -2
- package/field/internal/field.js.map +1 -1
- package/iconbutton/internal/icon-button.d.ts +1 -1
- package/iconbutton/internal/icon-button.js.map +1 -1
- package/labs/badge/internal/badge.d.ts +1 -1
- package/labs/badge/internal/badge.js +1 -1
- package/labs/badge/internal/badge.js.map +1 -1
- package/labs/behaviors/on-report-validity.d.ts +2 -1
- package/labs/behaviors/on-report-validity.js +171 -67
- package/labs/behaviors/on-report-validity.js.map +1 -1
- package/labs/behaviors/validators/text-field-validator.js +12 -4
- package/labs/behaviors/validators/text-field-validator.js.map +1 -1
- package/labs/navigationbar/internal/navigation-bar.d.ts +1 -1
- package/labs/navigationbar/internal/navigation-bar.js +1 -1
- package/labs/navigationbar/internal/navigation-bar.js.map +1 -1
- package/labs/navigationdrawer/internal/_navigation-drawer-modal.scss +1 -1
- package/labs/navigationdrawer/internal/_navigation-drawer.scss +1 -1
- package/labs/navigationdrawer/internal/navigation-drawer-modal.d.ts +1 -1
- package/labs/navigationdrawer/internal/navigation-drawer-modal.js +1 -1
- package/labs/navigationdrawer/internal/navigation-drawer-modal.js.map +1 -1
- package/labs/navigationdrawer/internal/navigation-drawer.d.ts +1 -1
- package/labs/navigationdrawer/internal/navigation-drawer.js +1 -1
- package/labs/navigationdrawer/internal/navigation-drawer.js.map +1 -1
- package/labs/navigationtab/internal/navigation-tab.d.ts +1 -1
- package/labs/navigationtab/internal/navigation-tab.js +2 -2
- package/labs/navigationtab/internal/navigation-tab.js.map +1 -1
- package/labs/navigationtab/internal/state.d.ts +0 -6
- package/labs/navigationtab/internal/state.js.map +1 -1
- package/labs/segmentedbutton/internal/_outlined-segmented-button.scss +2 -2
- package/labs/segmentedbutton/internal/_shared.scss +1 -1
- package/labs/segmentedbutton/internal/outlined-segmented-button.d.ts +1 -1
- package/labs/segmentedbutton/internal/outlined-segmented-button.js +1 -1
- package/labs/segmentedbutton/internal/outlined-segmented-button.js.map +1 -1
- package/labs/segmentedbuttonset/internal/outlined-segmented-button-set.d.ts +1 -1
- package/labs/segmentedbuttonset/internal/outlined-segmented-button-set.js +1 -1
- package/labs/segmentedbuttonset/internal/outlined-segmented-button-set.js.map +1 -1
- package/list/list-item.d.ts +1 -1
- package/list/list-item.js.map +1 -1
- package/menu/internal/menuitem/menu-item.d.ts +1 -1
- package/menu/internal/menuitem/menu-item.js.map +1 -1
- package/menu/menu-item.d.ts +2 -2
- package/menu/menu-item.js.map +1 -1
- package/menu/menu.d.ts +3 -3
- package/menu/menu.js.map +1 -1
- package/package.json +1 -1
- package/progress/internal/_linear-progress.scss +6 -4
- package/progress/internal/linear-progress-styles.css.js +1 -1
- package/progress/internal/linear-progress-styles.css.js.map +1 -1
- package/progress/internal/linear-progress.js +4 -1
- package/progress/internal/linear-progress.js.map +1 -1
- package/ripple/internal/ripple.js +1 -0
- package/ripple/internal/ripple.js.map +1 -1
- package/select/harness.d.ts +1 -0
- package/select/harness.js +7 -0
- package/select/harness.js.map +1 -1
- package/select/internal/select.js +6 -12
- package/select/internal/select.js.map +1 -1
- package/select/select-option.d.ts +1 -1
- package/select/select-option.js.map +1 -1
- package/slider/internal/slider.js +2 -2
- package/slider/internal/slider.js.map +1 -1
- package/tabs/internal/tabs.d.ts +1 -0
- package/tabs/internal/tabs.js +7 -2
- package/tabs/internal/tabs.js.map +1 -1
- package/textfield/filled-text-field.d.ts +1 -1
- package/textfield/filled-text-field.js.map +1 -1
- package/textfield/internal/_input.scss +12 -0
- package/textfield/internal/shared-styles.css.js +1 -1
- package/textfield/internal/shared-styles.css.js.map +1 -1
- package/textfield/internal/text-field.d.ts +5 -2
- package/textfield/internal/text-field.js +28 -22
- package/textfield/internal/text-field.js.map +1 -1
- package/textfield/outlined-text-field.d.ts +1 -1
- package/textfield/outlined-text-field.js.map +1 -1
- package/tokens/_md-comp-assist-chip.scss +2 -2
- package/tokens/_md-comp-checkbox.scss +2 -2
- package/tokens/_md-comp-circular-progress.scss +2 -2
- package/tokens/_md-comp-dialog.scss +2 -2
- package/tokens/_md-comp-divider.scss +2 -2
- package/tokens/_md-comp-elevated-button.scss +3 -3
- package/tokens/_md-comp-elevated-card.scss +2 -2
- package/tokens/_md-comp-elevation.scss +2 -2
- package/tokens/_md-comp-fab-branded.scss +2 -2
- package/tokens/_md-comp-fab.scss +2 -2
- package/tokens/_md-comp-filled-button.scss +3 -3
- package/tokens/_md-comp-filled-card.scss +2 -2
- package/tokens/_md-comp-filled-field.scss +2 -2
- package/tokens/_md-comp-filled-icon-button.scss +2 -2
- package/tokens/_md-comp-filled-select.scss +2 -2
- package/tokens/_md-comp-filled-text-field.scss +2 -2
- package/tokens/_md-comp-filled-tonal-button.scss +3 -3
- package/tokens/_md-comp-filled-tonal-icon-button.scss +2 -2
- package/tokens/_md-comp-filter-chip.scss +2 -2
- package/tokens/_md-comp-focus-ring.scss +2 -2
- package/tokens/_md-comp-icon-button.scss +2 -2
- package/tokens/_md-comp-icon.scss +2 -2
- package/tokens/_md-comp-input-chip.scss +2 -2
- package/tokens/_md-comp-item.scss +2 -2
- package/tokens/_md-comp-linear-progress.scss +2 -2
- package/tokens/_md-comp-list-item.scss +2 -2
- package/tokens/_md-comp-list.scss +2 -2
- package/tokens/_md-comp-menu-item.scss +2 -2
- package/tokens/_md-comp-menu-list-item.scss +2 -2
- package/tokens/_md-comp-menu.scss +2 -2
- package/tokens/_md-comp-outlined-button.scss +3 -3
- package/tokens/_md-comp-outlined-card.scss +2 -2
- package/tokens/_md-comp-outlined-field.scss +2 -2
- package/tokens/_md-comp-outlined-icon-button.scss +2 -2
- package/tokens/_md-comp-outlined-segmented-button.scss +2 -2
- package/tokens/_md-comp-outlined-select.scss +2 -2
- package/tokens/_md-comp-outlined-text-field.scss +2 -2
- package/tokens/_md-comp-primary-tab.scss +2 -2
- package/tokens/_md-comp-radio.scss +2 -2
- package/tokens/_md-comp-ripple.scss +2 -2
- package/tokens/_md-comp-secondary-tab.scss +2 -2
- package/tokens/_md-comp-slider.scss +2 -2
- package/tokens/_md-comp-suggestion-chip.scss +2 -2
- package/tokens/_md-comp-switch.scss +2 -2
- package/tokens/_md-comp-text-button.scss +3 -3
- package/tokens/_md-ref-palette.scss +2 -2
- package/tokens/_md-ref-typeface.scss +2 -2
- package/tokens/_md-sys-color.scss +3 -3
- package/tokens/_md-sys-typescale.scss +2 -2
- package/tokens/{_values.scss → internal/_validate.scss} +10 -10
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import '../../focus/md-focus-ring.js';
|
|
7
7
|
import '../../ripple/ripple.js';
|
|
8
8
|
import { LitElement } from 'lit';
|
|
9
|
-
import { FormSubmitter, FormSubmitterType } from '../../internal/controller/form-submitter.js';
|
|
9
|
+
import { FormSubmitter, type FormSubmitterType } from '../../internal/controller/form-submitter.js';
|
|
10
10
|
declare const buttonBaseClass: import("../../labs/behaviors/mixin.js").MixinReturn<typeof LitElement, import("../../labs/behaviors/element-internals.js").WithElementInternals>;
|
|
11
11
|
/**
|
|
12
12
|
* A button component.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","s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E;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;4CAChD;AAK4C;IAAhE,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;uCACxD;AAEI;IAAX,QAAQ,EAAE;oCAAoC;AAEnC;IAAX,QAAQ,EAAE;qCAAY;AAgBY;IAAlC,KAAK,CAAC,SAAS,CAAC;6CAAqD;AAGrD;IADhB,qBAAqB,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;6CACN","sourcesContent":["/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../focus/md-focus-ring.js';\nimport '../../ripple/ripple.js';\n\nimport {html, isServer, LitElement, nothing} from 'lit';\nimport {property, query, queryAssignedElements} from 'lit/decorators.js';\n\nimport {ARIAMixinStrict} from '../../internal/aria/aria.js';\nimport {requestUpdateOnAriaChange} from '../../internal/aria/delegate.js';\nimport {\n FormSubmitter,\n FormSubmitterType,\n setupFormSubmitter,\n} from '../../internal/controller/form-submitter.js';\nimport {\n dispatchActivationClick,\n isActivationClick,\n} from '../../internal/events/form-label-activation.js';\nimport {\n internals,\n mixinElementInternals,\n} from '../../labs/behaviors/element-internals.js';\n\n// Separate variable needed for closure.\nconst buttonBaseClass = mixinElementInternals(LitElement);\n\n/**\n * A button component.\n */\nexport abstract class Button extends buttonBaseClass implements FormSubmitter {\n static {\n requestUpdateOnAriaChange(Button);\n setupFormSubmitter(Button);\n }\n\n /** @nocollapse */\n static readonly formAssociated = true;\n\n /** @nocollapse */\n static override shadowRootOptions: ShadowRootInit = {\n mode: 'open',\n delegatesFocus: true,\n };\n\n /**\n * Whether or not the button is disabled.\n */\n @property({type: Boolean, reflect: true}) disabled = false;\n\n /**\n * The URL that the link button points to.\n */\n @property() href = '';\n\n /**\n * Where to display the linked `href` URL for a link button. Common options\n * include `_blank` to open in a new tab.\n */\n @property() target: '_blank' | '_parent' | '_self' | '_top' | '' = '';\n\n /**\n * Whether to render the icon at the inline end of the label rather than the\n * inline start.\n *\n * _Note:_ Link buttons cannot have trailing icons.\n */\n @property({type: Boolean, attribute: 'trailing-icon', reflect: true})\n trailingIcon = false;\n\n /**\n * Whether to display the icon or not.\n */\n @property({type: Boolean, attribute: 'has-icon', reflect: true}) hasIcon =\n false;\n\n @property() type: FormSubmitterType = 'submit';\n\n @property() value = '';\n\n get name() {\n return this.getAttribute('name') ?? '';\n }\n set name(name: string) {\n this.setAttribute('name', name);\n }\n\n /**\n * The associated form element with which this element's value will submit.\n */\n get form() {\n return this[internals].form;\n }\n\n @query('.button') private readonly buttonElement!: HTMLElement | null;\n\n @queryAssignedElements({slot: 'icon', flatten: true})\n private readonly assignedIcons!: HTMLElement[];\n\n constructor() {\n super();\n if (!isServer) {\n this.addEventListener('click', this.handleActivationClick);\n }\n }\n\n override focus() {\n this.buttonElement?.focus();\n }\n\n override blur() {\n this.buttonElement?.blur();\n }\n\n protected override render() {\n // Link buttons may not be disabled\n const isDisabled = this.disabled && !this.href;\n const buttonOrLink = this.href ? this.renderLink() : this.renderButton();\n // TODO(b/310046938): due to a limitation in focus ring/ripple, we can't use\n // the same ID for different elements, so we change the ID instead.\n const buttonId = this.href ? 'link' : 'button';\n return html`\n ${this.renderElevationOrOutline?.()}\n <div class=\"background\"></div>\n <md-focus-ring part=\"focus-ring\" for=${buttonId}></md-focus-ring>\n <md-ripple for=${buttonId} ?disabled=\"${isDisabled}\"></md-ripple>\n ${buttonOrLink}\n `;\n }\n\n // Buttons can override this to add elevation or an outline. Use this and\n // return `<md-elevation>` (for elevated, filled, and tonal buttons)\n // or `<div class=\"outline\">` (for outlined buttons).\n // Text buttons that have neither do not need to implement this.\n protected renderElevationOrOutline?(): unknown;\n\n private renderButton() {\n // Needed for closure conformance\n const {ariaLabel, ariaHasPopup, ariaExpanded} = this as ARIAMixinStrict;\n return html`<button\n id=\"button\"\n class=\"button\"\n ?disabled=${this.disabled}\n aria-label=\"${ariaLabel || nothing}\"\n aria-haspopup=\"${ariaHasPopup || nothing}\"\n aria-expanded=\"${ariaExpanded || nothing}\">\n ${this.renderContent()}\n </button>`;\n }\n\n private renderLink() {\n // Needed for closure conformance\n const {ariaLabel, ariaHasPopup, ariaExpanded} = this as ARIAMixinStrict;\n return html`<a\n id=\"link\"\n class=\"button\"\n aria-label=\"${ariaLabel || nothing}\"\n aria-haspopup=\"${ariaHasPopup || nothing}\"\n aria-expanded=\"${ariaExpanded || nothing}\"\n href=${this.href}\n target=${this.target || nothing}\n >${this.renderContent()}\n </a>`;\n }\n\n private renderContent() {\n const icon = html`<slot\n name=\"icon\"\n @slotchange=\"${this.handleSlotChange}\"></slot>`;\n\n return html`\n <span class=\"touch\"></span>\n ${this.trailingIcon ? nothing : icon}\n <span class=\"label\"><slot></slot></span>\n ${this.trailingIcon ? icon : nothing}\n `;\n }\n\n private readonly handleActivationClick = (event: MouseEvent) => {\n if (!isActivationClick(event) || !this.buttonElement) {\n return;\n }\n this.focus();\n dispatchActivationClick(this.buttonElement);\n };\n\n private handleSlotChange() {\n this.hasIcon = this.assignedIcons.length > 0;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["button.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,8BAA8B,CAAC;AACtC,OAAO,wBAAwB,CAAC;AAEhC,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,KAAK,CAAC;AACxD,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AAGzE,OAAO,EAAC,yBAAyB,EAAC,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAGL,kBAAkB,GACnB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAC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AAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;6CACN","sourcesContent":["/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../focus/md-focus-ring.js';\nimport '../../ripple/ripple.js';\n\nimport {html, isServer, LitElement, nothing} from 'lit';\nimport {property, query, queryAssignedElements} from 'lit/decorators.js';\n\nimport {ARIAMixinStrict} from '../../internal/aria/aria.js';\nimport {requestUpdateOnAriaChange} from '../../internal/aria/delegate.js';\nimport {\n FormSubmitter,\n type FormSubmitterType,\n setupFormSubmitter,\n} from '../../internal/controller/form-submitter.js';\nimport {\n dispatchActivationClick,\n isActivationClick,\n} from '../../internal/events/form-label-activation.js';\nimport {\n internals,\n mixinElementInternals,\n} from '../../labs/behaviors/element-internals.js';\n\n// Separate variable needed for closure.\nconst buttonBaseClass = mixinElementInternals(LitElement);\n\n/**\n * A button component.\n */\nexport abstract class Button extends buttonBaseClass implements FormSubmitter {\n static {\n requestUpdateOnAriaChange(Button);\n setupFormSubmitter(Button);\n }\n\n /** @nocollapse */\n static readonly formAssociated = true;\n\n /** @nocollapse */\n static override shadowRootOptions: ShadowRootInit = {\n mode: 'open',\n delegatesFocus: true,\n };\n\n /**\n * Whether or not the button is disabled.\n */\n @property({type: Boolean, reflect: true}) disabled = false;\n\n /**\n * The URL that the link button points to.\n */\n @property() href = '';\n\n /**\n * Where to display the linked `href` URL for a link button. Common options\n * include `_blank` to open in a new tab.\n */\n @property() target: '_blank' | '_parent' | '_self' | '_top' | '' = '';\n\n /**\n * Whether to render the icon at the inline end of the label rather than the\n * inline start.\n *\n * _Note:_ Link buttons cannot have trailing icons.\n */\n @property({type: Boolean, attribute: 'trailing-icon', reflect: true})\n trailingIcon = false;\n\n /**\n * Whether to display the icon or not.\n */\n @property({type: Boolean, attribute: 'has-icon', reflect: true}) hasIcon =\n false;\n\n @property() type: FormSubmitterType = 'submit';\n\n @property() value = '';\n\n get name() {\n return this.getAttribute('name') ?? '';\n }\n set name(name: string) {\n this.setAttribute('name', name);\n }\n\n /**\n * The associated form element with which this element's value will submit.\n */\n get form() {\n return this[internals].form;\n }\n\n @query('.button') private readonly buttonElement!: HTMLElement | null;\n\n @queryAssignedElements({slot: 'icon', flatten: true})\n private readonly assignedIcons!: HTMLElement[];\n\n constructor() {\n super();\n if (!isServer) {\n this.addEventListener('click', this.handleActivationClick);\n }\n }\n\n override focus() {\n this.buttonElement?.focus();\n }\n\n override blur() {\n this.buttonElement?.blur();\n }\n\n protected override render() {\n // Link buttons may not be disabled\n const isDisabled = this.disabled && !this.href;\n const buttonOrLink = this.href ? this.renderLink() : this.renderButton();\n // TODO(b/310046938): due to a limitation in focus ring/ripple, we can't use\n // the same ID for different elements, so we change the ID instead.\n const buttonId = this.href ? 'link' : 'button';\n return html`\n ${this.renderElevationOrOutline?.()}\n <div class=\"background\"></div>\n <md-focus-ring part=\"focus-ring\" for=${buttonId}></md-focus-ring>\n <md-ripple for=${buttonId} ?disabled=\"${isDisabled}\"></md-ripple>\n ${buttonOrLink}\n `;\n }\n\n // Buttons can override this to add elevation or an outline. Use this and\n // return `<md-elevation>` (for elevated, filled, and tonal buttons)\n // or `<div class=\"outline\">` (for outlined buttons).\n // Text buttons that have neither do not need to implement this.\n protected renderElevationOrOutline?(): unknown;\n\n private renderButton() {\n // Needed for closure conformance\n const {ariaLabel, ariaHasPopup, ariaExpanded} = this as ARIAMixinStrict;\n return html`<button\n id=\"button\"\n class=\"button\"\n ?disabled=${this.disabled}\n aria-label=\"${ariaLabel || nothing}\"\n aria-haspopup=\"${ariaHasPopup || nothing}\"\n aria-expanded=\"${ariaExpanded || nothing}\">\n ${this.renderContent()}\n </button>`;\n }\n\n private renderLink() {\n // Needed for closure conformance\n const {ariaLabel, ariaHasPopup, ariaExpanded} = this as ARIAMixinStrict;\n return html`<a\n id=\"link\"\n class=\"button\"\n aria-label=\"${ariaLabel || nothing}\"\n aria-haspopup=\"${ariaHasPopup || nothing}\"\n aria-expanded=\"${ariaExpanded || nothing}\"\n href=${this.href}\n target=${this.target || nothing}\n >${this.renderContent()}\n </a>`;\n }\n\n private renderContent() {\n const icon = html`<slot\n name=\"icon\"\n @slotchange=\"${this.handleSlotChange}\"></slot>`;\n\n return html`\n <span class=\"touch\"></span>\n ${this.trailingIcon ? nothing : icon}\n <span class=\"label\"><slot></slot></span>\n ${this.trailingIcon ? icon : nothing}\n `;\n }\n\n private readonly handleActivationClick = (event: MouseEvent) => {\n if (!isActivationClick(event) || !this.buttonElement) {\n return;\n }\n this.focus();\n dispatchActivationClick(this.buttonElement);\n };\n\n private handleSlotChange() {\n this.hasIcon = this.assignedIcons.length > 0;\n }\n}\n"]}
|
|
@@ -49,38 +49,43 @@ $_checkmark-bottom-left: 7px, -14px;
|
|
|
49
49
|
@mixin styles() {
|
|
50
50
|
$tokens: tokens.md-comp-checkbox-values();
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
// Support logical shape properties
|
|
53
|
+
$container-shape: map.get($tokens, 'container-shape');
|
|
54
|
+
$tokens: map.set(
|
|
55
|
+
$tokens,
|
|
56
|
+
'container-shape-start-start',
|
|
57
|
+
var(--md-checkbox-container-shape, #{$container-shape})
|
|
58
|
+
);
|
|
59
|
+
$tokens: map.set(
|
|
60
|
+
$tokens,
|
|
61
|
+
'container-shape-start-end',
|
|
62
|
+
var(--md-checkbox-container-shape, #{$container-shape})
|
|
63
|
+
);
|
|
64
|
+
$tokens: map.set(
|
|
65
|
+
$tokens,
|
|
66
|
+
'container-shape-end-end',
|
|
67
|
+
var(--md-checkbox-container-shape, #{$container-shape})
|
|
68
|
+
);
|
|
69
|
+
$tokens: map.set(
|
|
70
|
+
$tokens,
|
|
71
|
+
'container-shape-end-start',
|
|
72
|
+
var(--md-checkbox-container-shape, #{$container-shape})
|
|
73
|
+
);
|
|
56
74
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
var(--_container-shape)
|
|
61
|
-
);
|
|
62
|
-
--_container-shape-start-end: var(
|
|
63
|
-
--md-checkbox-container-shape-start-end,
|
|
64
|
-
var(--_container-shape)
|
|
65
|
-
);
|
|
66
|
-
--_container-shape-end-end: var(
|
|
67
|
-
--md-checkbox-container-shape-end-end,
|
|
68
|
-
var(--_container-shape)
|
|
69
|
-
);
|
|
70
|
-
--_container-shape-end-start: var(
|
|
71
|
-
--md-checkbox-container-shape-end-start,
|
|
72
|
-
var(--_container-shape)
|
|
73
|
-
);
|
|
75
|
+
@each $token, $value in $tokens {
|
|
76
|
+
$tokens: map.set($tokens, $token, var(--md-checkbox-#{$token}, #{$value}));
|
|
77
|
+
}
|
|
74
78
|
|
|
75
|
-
|
|
76
|
-
border-start-
|
|
77
|
-
border-
|
|
78
|
-
border-end-
|
|
79
|
+
:host {
|
|
80
|
+
border-start-start-radius: map.get($tokens, 'container-shape-start-start');
|
|
81
|
+
border-start-end-radius: map.get($tokens, 'container-shape-start-end');
|
|
82
|
+
border-end-end-radius: map.get($tokens, 'container-shape-end-end');
|
|
83
|
+
border-end-start-radius: map.get($tokens, 'container-shape-end-start');
|
|
79
84
|
display: inline-flex;
|
|
80
|
-
height:
|
|
85
|
+
height: map.get($tokens, 'container-size');
|
|
81
86
|
position: relative;
|
|
82
87
|
vertical-align: top; // Fix extra space when placed inside display: block
|
|
83
|
-
width:
|
|
88
|
+
width: map.get($tokens, 'container-size');
|
|
84
89
|
-webkit-tap-highlight-color: transparent;
|
|
85
90
|
cursor: pointer;
|
|
86
91
|
}
|
|
@@ -90,7 +95,7 @@ $_checkmark-bottom-left: 7px, -14px;
|
|
|
90
95
|
}
|
|
91
96
|
|
|
92
97
|
:host([touch-target='wrapper']) {
|
|
93
|
-
margin: max(0px, ((48px -
|
|
98
|
+
margin: max(0px, ((48px - map.get($tokens, 'container-size')) / 2));
|
|
94
99
|
}
|
|
95
100
|
|
|
96
101
|
md-focus-ring {
|
|
@@ -140,14 +145,14 @@ $_checkmark-bottom-left: 7px, -14px;
|
|
|
140
145
|
}
|
|
141
146
|
|
|
142
147
|
.outline {
|
|
143
|
-
border-color:
|
|
148
|
+
border-color: map.get($tokens, 'outline-color');
|
|
144
149
|
border-style: solid;
|
|
145
|
-
border-width:
|
|
150
|
+
border-width: map.get($tokens, 'outline-width');
|
|
146
151
|
box-sizing: border-box;
|
|
147
152
|
}
|
|
148
153
|
|
|
149
154
|
.background {
|
|
150
|
-
background-color:
|
|
155
|
+
background-color: map.get($tokens, 'selected-container-color');
|
|
151
156
|
}
|
|
152
157
|
|
|
153
158
|
// Background and icon transitions.
|
|
@@ -181,17 +186,17 @@ $_checkmark-bottom-left: 7px, -14px;
|
|
|
181
186
|
// Ripple
|
|
182
187
|
|
|
183
188
|
md-ripple {
|
|
184
|
-
border-radius:
|
|
185
|
-
height:
|
|
189
|
+
border-radius: map.get($tokens, 'state-layer-shape');
|
|
190
|
+
height: map.get($tokens, 'state-layer-size');
|
|
186
191
|
inset: unset;
|
|
187
|
-
width:
|
|
192
|
+
width: map.get($tokens, 'state-layer-size');
|
|
188
193
|
|
|
189
194
|
@include ripple.theme(
|
|
190
195
|
(
|
|
191
|
-
hover-color:
|
|
192
|
-
hover-opacity:
|
|
193
|
-
pressed-color:
|
|
194
|
-
pressed-opacity:
|
|
196
|
+
hover-color: map.get($tokens, 'hover-state-layer-color'),
|
|
197
|
+
hover-opacity: map.get($tokens, 'hover-state-layer-opacity'),
|
|
198
|
+
pressed-color: map.get($tokens, 'pressed-state-layer-color'),
|
|
199
|
+
pressed-opacity: map.get($tokens, 'pressed-state-layer-opacity'),
|
|
195
200
|
)
|
|
196
201
|
);
|
|
197
202
|
}
|
|
@@ -199,10 +204,11 @@ $_checkmark-bottom-left: 7px, -14px;
|
|
|
199
204
|
.selected md-ripple {
|
|
200
205
|
@include ripple.theme(
|
|
201
206
|
(
|
|
202
|
-
hover-color:
|
|
203
|
-
hover-opacity:
|
|
204
|
-
pressed-color:
|
|
205
|
-
pressed-opacity:
|
|
207
|
+
hover-color: map.get($tokens, 'selected-hover-state-layer-color'),
|
|
208
|
+
hover-opacity: map.get($tokens, 'selected-hover-state-layer-opacity'),
|
|
209
|
+
pressed-color: map.get($tokens, 'selected-pressed-state-layer-color'),
|
|
210
|
+
pressed-opacity:
|
|
211
|
+
map.get($tokens, 'selected-pressed-state-layer-opacity'),
|
|
206
212
|
)
|
|
207
213
|
);
|
|
208
214
|
}
|
|
@@ -217,9 +223,9 @@ $_checkmark-bottom-left: 7px, -14px;
|
|
|
217
223
|
// 2. Long end
|
|
218
224
|
// - the larger trailing part of the checkmark
|
|
219
225
|
// - the entirety of the indeterminate mark
|
|
220
|
-
fill:
|
|
221
|
-
height:
|
|
222
|
-
width:
|
|
226
|
+
fill: map.get($tokens, 'selected-icon-color');
|
|
227
|
+
height: map.get($tokens, 'icon-size');
|
|
228
|
+
width: map.get($tokens, 'icon-size');
|
|
223
229
|
}
|
|
224
230
|
|
|
225
231
|
// The short end of the checkmark. Initially hidden underneath the
|
|
@@ -327,42 +333,42 @@ $_checkmark-bottom-left: 7px, -14px;
|
|
|
327
333
|
// States
|
|
328
334
|
|
|
329
335
|
:where(:hover) .outline {
|
|
330
|
-
border-color:
|
|
331
|
-
border-width:
|
|
336
|
+
border-color: map.get($tokens, 'hover-outline-color');
|
|
337
|
+
border-width: map.get($tokens, 'hover-outline-width');
|
|
332
338
|
}
|
|
333
339
|
|
|
334
340
|
:where(:hover) .background {
|
|
335
|
-
background:
|
|
341
|
+
background: map.get($tokens, 'selected-hover-container-color');
|
|
336
342
|
}
|
|
337
343
|
|
|
338
344
|
:where(:hover) .icon {
|
|
339
|
-
fill:
|
|
345
|
+
fill: map.get($tokens, 'selected-hover-icon-color');
|
|
340
346
|
}
|
|
341
347
|
|
|
342
348
|
:where(:focus-within) .outline {
|
|
343
|
-
border-color:
|
|
344
|
-
border-width:
|
|
349
|
+
border-color: map.get($tokens, 'focus-outline-color');
|
|
350
|
+
border-width: map.get($tokens, 'focus-outline-width');
|
|
345
351
|
}
|
|
346
352
|
|
|
347
353
|
:where(:focus-within) .background {
|
|
348
|
-
background:
|
|
354
|
+
background: map.get($tokens, 'selected-focus-container-color');
|
|
349
355
|
}
|
|
350
356
|
|
|
351
357
|
:where(:focus-within) .icon {
|
|
352
|
-
fill:
|
|
358
|
+
fill: map.get($tokens, 'selected-focus-icon-color');
|
|
353
359
|
}
|
|
354
360
|
|
|
355
361
|
:where(:active) .outline {
|
|
356
|
-
border-color:
|
|
357
|
-
border-width:
|
|
362
|
+
border-color: map.get($tokens, 'pressed-outline-color');
|
|
363
|
+
border-width: map.get($tokens, 'pressed-outline-width');
|
|
358
364
|
}
|
|
359
365
|
|
|
360
366
|
:where(:active) .background {
|
|
361
|
-
background:
|
|
367
|
+
background: map.get($tokens, 'selected-pressed-container-color');
|
|
362
368
|
}
|
|
363
369
|
|
|
364
370
|
:where(:active) .icon {
|
|
365
|
-
fill:
|
|
371
|
+
fill: map.get($tokens, 'selected-pressed-icon-color');
|
|
366
372
|
}
|
|
367
373
|
|
|
368
374
|
// Don't animate to/from disabled states because the outline is hidden when
|
|
@@ -374,9 +380,9 @@ $_checkmark-bottom-left: 7px, -14px;
|
|
|
374
380
|
}
|
|
375
381
|
|
|
376
382
|
:where(.disabled) .outline {
|
|
377
|
-
border-color:
|
|
378
|
-
border-width:
|
|
379
|
-
opacity:
|
|
383
|
+
border-color: map.get($tokens, 'disabled-outline-color');
|
|
384
|
+
border-width: map.get($tokens, 'disabled-outline-width');
|
|
385
|
+
opacity: map.get($tokens, 'disabled-container-opacity');
|
|
380
386
|
}
|
|
381
387
|
|
|
382
388
|
:where(.selected.disabled) .outline {
|
|
@@ -388,12 +394,12 @@ $_checkmark-bottom-left: 7px, -14px;
|
|
|
388
394
|
:where(.selected.disabled) .background {
|
|
389
395
|
// Set disabled opacity only when selected since opacity is used to show
|
|
390
396
|
// or hide the container background.
|
|
391
|
-
background:
|
|
392
|
-
opacity:
|
|
397
|
+
background: map.get($tokens, 'selected-disabled-container-color');
|
|
398
|
+
opacity: map.get($tokens, 'selected-disabled-container-opacity');
|
|
393
399
|
}
|
|
394
400
|
|
|
395
401
|
:where(.disabled) .icon {
|
|
396
|
-
fill:
|
|
402
|
+
fill: map.get($tokens, 'selected-disabled-icon-color');
|
|
397
403
|
}
|
|
398
404
|
|
|
399
405
|
@media (forced-colors: active) {
|
|
@@ -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{border-start-start-radius:var(--md-checkbox-container-shape-start-start, var(--md-checkbox-container-shape, 2px));border-start-end-radius:var(--md-checkbox-container-shape-start-end, var(--md-checkbox-container-shape, 2px));border-end-end-radius:var(--md-checkbox-container-shape-end-end, var(--md-checkbox-container-shape, 2px));border-end-start-radius:var(--md-checkbox-container-shape-end-start, var(--md-checkbox-container-shape, 2px));display:inline-flex;height:var(--md-checkbox-container-size, 18px);position:relative;vertical-align:top;width:var(--md-checkbox-container-size, 18px);-webkit-tap-highlight-color:rgba(0,0,0,0);cursor:pointer}:host([disabled]){cursor:default}:host([touch-target=wrapper]){margin:max(0px,(48px - var(--md-checkbox-container-size, 18px))/2)}md-focus-ring{height:44px;inset:unset;width:44px}input{appearance:none;height:48px;margin:0;opacity:0;outline:none;position:absolute;width:48px;z-index:1;cursor:inherit}:host([touch-target=none]) input{height:100%;width:100%}.container{border-radius:inherit;display:flex;height:100%;place-content:center;place-items:center;position:relative;width:100%}.outline,.background,.icon{inset:0;position:absolute}.outline,.background{border-radius:inherit}.outline{border-color:var(--md-checkbox-outline-color, var(--md-sys-color-on-surface-variant, #49454f));border-style:solid;border-width:var(--md-checkbox-outline-width, 2px);box-sizing:border-box}.background{background-color:var(--md-checkbox-selected-container-color, var(--md-sys-color-primary, #6750a4))}.background,.icon{opacity:0;transition-duration:150ms,50ms;transition-property:transform,opacity;transition-timing-function:cubic-bezier(0.3, 0, 0.8, 0.15),linear;transform:scale(0.6)}:where(.selected) :is(.background,.icon){opacity:1;transition-duration:350ms,50ms;transition-timing-function:cubic-bezier(0.05, 0.7, 0.1, 1),linear;transform:scale(1)}md-ripple{border-radius:var(--md-checkbox-state-layer-shape, 9999px);height:var(--md-checkbox-state-layer-size, 40px);inset:unset;width:var(--md-checkbox-state-layer-size, 40px);--md-ripple-hover-color: var(--md-checkbox-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-hover-opacity: var(--md-checkbox-hover-state-layer-opacity, 0.08);--md-ripple-pressed-color: var(--md-checkbox-pressed-state-layer-color, var(--md-sys-color-primary, #6750a4));--md-ripple-pressed-opacity: var(--md-checkbox-pressed-state-layer-opacity, 0.12)}.selected md-ripple{--md-ripple-hover-color: var(--md-checkbox-selected-hover-state-layer-color, var(--md-sys-color-primary, #6750a4));--md-ripple-hover-opacity: var(--md-checkbox-selected-hover-state-layer-opacity, 0.08);--md-ripple-pressed-color: var(--md-checkbox-selected-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-pressed-opacity: var(--md-checkbox-selected-pressed-state-layer-opacity, 0.12)}.icon{fill:var(--md-checkbox-selected-icon-color, var(--md-sys-color-on-primary, #fff));height:var(--md-checkbox-icon-size, 18px);width:var(--md-checkbox-icon-size, 18px)}.mark.short{height:2px;transition-property:transform,height;width:2px}.mark.long{height:2px;transition-property:transform,width;width:10px}.mark{animation-duration:150ms;animation-timing-function:cubic-bezier(0.3, 0, 0.8, 0.15);transition-duration:150ms;transition-timing-function:cubic-bezier(0.3, 0, 0.8, 0.15)}.selected .mark{animation-duration:350ms;animation-timing-function:cubic-bezier(0.05, 0.7, 0.1, 1);transition-duration:350ms;transition-timing-function:cubic-bezier(0.05, 0.7, 0.1, 1)}.checked .mark,.prev-checked.unselected .mark{transform:scaleY(-1) translate(7px, -14px) rotate(45deg)}.checked .mark.short,.prev-checked.unselected .mark.short{height:5.6568542495px}.checked .mark.long,.prev-checked.unselected .mark.long{width:11.313708499px}.indeterminate .mark,.prev-indeterminate.unselected .mark{transform:scaleY(-1) translate(4px, -10px) rotate(0deg)}.prev-unselected .mark{transition-property:none}.prev-unselected.checked .mark.long{animation-name:prev-unselected-to-checked}@keyframes prev-unselected-to-checked{from{width:0}}:where(:hover) .outline{border-color:var(--md-checkbox-hover-outline-color, var(--md-sys-color-on-surface, #1d1b20));border-width:var(--md-checkbox-hover-outline-width, 2px)}:where(:hover) .background{background:var(--md-checkbox-selected-hover-container-color, var(--md-sys-color-primary, #6750a4))}:where(:hover) .icon{fill:var(--md-checkbox-selected-hover-icon-color, var(--md-sys-color-on-primary, #fff))}:where(:focus-within) .outline{border-color:var(--md-checkbox-focus-outline-color, var(--md-sys-color-on-surface, #1d1b20));border-width:var(--md-checkbox-focus-outline-width, 2px)}:where(:focus-within) .background{background:var(--md-checkbox-selected-focus-container-color, var(--md-sys-color-primary, #6750a4))}:where(:focus-within) .icon{fill:var(--md-checkbox-selected-focus-icon-color, var(--md-sys-color-on-primary, #fff))}:where(:active) .outline{border-color:var(--md-checkbox-pressed-outline-color, var(--md-sys-color-on-surface, #1d1b20));border-width:var(--md-checkbox-pressed-outline-width, 2px)}:where(:active) .background{background:var(--md-checkbox-selected-pressed-container-color, var(--md-sys-color-primary, #6750a4))}:where(:active) .icon{fill:var(--md-checkbox-selected-pressed-icon-color, var(--md-sys-color-on-primary, #fff))}:where(.disabled,.prev-disabled) :is(.background,.icon,.mark){animation-duration:0s;transition-duration:0s}:where(.disabled) .outline{border-color:var(--md-checkbox-disabled-outline-color, var(--md-sys-color-on-surface, #1d1b20));border-width:var(--md-checkbox-disabled-outline-width, 2px);opacity:var(--md-checkbox-disabled-container-opacity, 0.38)}:where(.selected.disabled) .outline{visibility:hidden}:where(.selected.disabled) .background{background:var(--md-checkbox-selected-disabled-container-color, var(--md-sys-color-on-surface, #1d1b20));opacity:var(--md-checkbox-selected-disabled-container-opacity, 0.38)}:where(.disabled) .icon{fill:var(--md-checkbox-selected-disabled-icon-color, var(--md-sys-color-surface, #fef7ff))}@media(forced-colors: active){.background{background-color:CanvasText}.selected.disabled .background{background-color:GrayText;opacity:1}.outline{border-color:CanvasText}.disabled .outline{border-color:GrayText;opacity:1}.icon{fill:Canvas}}/*# sourceMappingURL=checkbox-styles.css.map */
|
|
8
8
|
`;
|
|
9
9
|
//# sourceMappingURL=checkbox-styles.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox-styles.css.js","sourceRoot":"","sources":["checkbox-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":"checkbox-styles.css.js","sourceRoot":"","sources":["checkbox-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{border-start-start-radius:var(--md-checkbox-container-shape-start-start, var(--md-checkbox-container-shape, 2px));border-start-end-radius:var(--md-checkbox-container-shape-start-end, var(--md-checkbox-container-shape, 2px));border-end-end-radius:var(--md-checkbox-container-shape-end-end, var(--md-checkbox-container-shape, 2px));border-end-start-radius:var(--md-checkbox-container-shape-end-start, var(--md-checkbox-container-shape, 2px));display:inline-flex;height:var(--md-checkbox-container-size, 18px);position:relative;vertical-align:top;width:var(--md-checkbox-container-size, 18px);-webkit-tap-highlight-color:rgba(0,0,0,0);cursor:pointer}:host([disabled]){cursor:default}:host([touch-target=wrapper]){margin:max(0px,(48px - var(--md-checkbox-container-size, 18px))/2)}md-focus-ring{height:44px;inset:unset;width:44px}input{appearance:none;height:48px;margin:0;opacity:0;outline:none;position:absolute;width:48px;z-index:1;cursor:inherit}:host([touch-target=none]) input{height:100%;width:100%}.container{border-radius:inherit;display:flex;height:100%;place-content:center;place-items:center;position:relative;width:100%}.outline,.background,.icon{inset:0;position:absolute}.outline,.background{border-radius:inherit}.outline{border-color:var(--md-checkbox-outline-color, var(--md-sys-color-on-surface-variant, #49454f));border-style:solid;border-width:var(--md-checkbox-outline-width, 2px);box-sizing:border-box}.background{background-color:var(--md-checkbox-selected-container-color, var(--md-sys-color-primary, #6750a4))}.background,.icon{opacity:0;transition-duration:150ms,50ms;transition-property:transform,opacity;transition-timing-function:cubic-bezier(0.3, 0, 0.8, 0.15),linear;transform:scale(0.6)}:where(.selected) :is(.background,.icon){opacity:1;transition-duration:350ms,50ms;transition-timing-function:cubic-bezier(0.05, 0.7, 0.1, 1),linear;transform:scale(1)}md-ripple{border-radius:var(--md-checkbox-state-layer-shape, 9999px);height:var(--md-checkbox-state-layer-size, 40px);inset:unset;width:var(--md-checkbox-state-layer-size, 40px);--md-ripple-hover-color: var(--md-checkbox-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-hover-opacity: var(--md-checkbox-hover-state-layer-opacity, 0.08);--md-ripple-pressed-color: var(--md-checkbox-pressed-state-layer-color, var(--md-sys-color-primary, #6750a4));--md-ripple-pressed-opacity: var(--md-checkbox-pressed-state-layer-opacity, 0.12)}.selected md-ripple{--md-ripple-hover-color: var(--md-checkbox-selected-hover-state-layer-color, var(--md-sys-color-primary, #6750a4));--md-ripple-hover-opacity: var(--md-checkbox-selected-hover-state-layer-opacity, 0.08);--md-ripple-pressed-color: var(--md-checkbox-selected-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-pressed-opacity: var(--md-checkbox-selected-pressed-state-layer-opacity, 0.12)}.icon{fill:var(--md-checkbox-selected-icon-color, var(--md-sys-color-on-primary, #fff));height:var(--md-checkbox-icon-size, 18px);width:var(--md-checkbox-icon-size, 18px)}.mark.short{height:2px;transition-property:transform,height;width:2px}.mark.long{height:2px;transition-property:transform,width;width:10px}.mark{animation-duration:150ms;animation-timing-function:cubic-bezier(0.3, 0, 0.8, 0.15);transition-duration:150ms;transition-timing-function:cubic-bezier(0.3, 0, 0.8, 0.15)}.selected .mark{animation-duration:350ms;animation-timing-function:cubic-bezier(0.05, 0.7, 0.1, 1);transition-duration:350ms;transition-timing-function:cubic-bezier(0.05, 0.7, 0.1, 1)}.checked .mark,.prev-checked.unselected .mark{transform:scaleY(-1) translate(7px, -14px) rotate(45deg)}.checked .mark.short,.prev-checked.unselected .mark.short{height:5.6568542495px}.checked .mark.long,.prev-checked.unselected .mark.long{width:11.313708499px}.indeterminate .mark,.prev-indeterminate.unselected .mark{transform:scaleY(-1) translate(4px, -10px) rotate(0deg)}.prev-unselected .mark{transition-property:none}.prev-unselected.checked .mark.long{animation-name:prev-unselected-to-checked}@keyframes prev-unselected-to-checked{from{width:0}}:where(:hover) .outline{border-color:var(--md-checkbox-hover-outline-color, var(--md-sys-color-on-surface, #1d1b20));border-width:var(--md-checkbox-hover-outline-width, 2px)}:where(:hover) .background{background:var(--md-checkbox-selected-hover-container-color, var(--md-sys-color-primary, #6750a4))}:where(:hover) .icon{fill:var(--md-checkbox-selected-hover-icon-color, var(--md-sys-color-on-primary, #fff))}:where(:focus-within) .outline{border-color:var(--md-checkbox-focus-outline-color, var(--md-sys-color-on-surface, #1d1b20));border-width:var(--md-checkbox-focus-outline-width, 2px)}:where(:focus-within) .background{background:var(--md-checkbox-selected-focus-container-color, var(--md-sys-color-primary, #6750a4))}:where(:focus-within) .icon{fill:var(--md-checkbox-selected-focus-icon-color, var(--md-sys-color-on-primary, #fff))}:where(:active) .outline{border-color:var(--md-checkbox-pressed-outline-color, var(--md-sys-color-on-surface, #1d1b20));border-width:var(--md-checkbox-pressed-outline-width, 2px)}:where(:active) .background{background:var(--md-checkbox-selected-pressed-container-color, var(--md-sys-color-primary, #6750a4))}:where(:active) .icon{fill:var(--md-checkbox-selected-pressed-icon-color, var(--md-sys-color-on-primary, #fff))}:where(.disabled,.prev-disabled) :is(.background,.icon,.mark){animation-duration:0s;transition-duration:0s}:where(.disabled) .outline{border-color:var(--md-checkbox-disabled-outline-color, var(--md-sys-color-on-surface, #1d1b20));border-width:var(--md-checkbox-disabled-outline-width, 2px);opacity:var(--md-checkbox-disabled-container-opacity, 0.38)}:where(.selected.disabled) .outline{visibility:hidden}:where(.selected.disabled) .background{background:var(--md-checkbox-selected-disabled-container-color, var(--md-sys-color-on-surface, #1d1b20));opacity:var(--md-checkbox-selected-disabled-container-opacity, 0.38)}:where(.disabled) .icon{fill:var(--md-checkbox-selected-disabled-icon-color, var(--md-sys-color-surface, #fef7ff))}@media(forced-colors: active){.background{background-color:CanvasText}.selected.disabled .background{background-color:GrayText;opacity:1}.outline{border-color:CanvasText}.disabled .outline{border-color:GrayText;opacity:1}.icon{fill:Canvas}}/*# sourceMappingURL=checkbox-styles.css.map */\n`;\n "]}
|
|
@@ -88,10 +88,16 @@ export class FilterChip extends MultiActionChip {
|
|
|
88
88
|
if (this.disabled) {
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
|
+
// Store prevValue to revert in case `chip.selected` is changed during an
|
|
92
|
+
// event listener.
|
|
93
|
+
const prevValue = this.selected;
|
|
91
94
|
this.selected = !this.selected;
|
|
92
95
|
const preventDefault = !redispatchEvent(this, event);
|
|
93
96
|
if (preventDefault) {
|
|
94
|
-
this.selected = !this.selected
|
|
97
|
+
// We should not do `this.selected = !this.selected`, since a client
|
|
98
|
+
// click listener could change its value. Instead, always revert to the
|
|
99
|
+
// original value.
|
|
100
|
+
this.selected = prevValue;
|
|
95
101
|
return;
|
|
96
102
|
}
|
|
97
103
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-chip.js","sourceRoot":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AG,IAAI,CAAC,QAAQ,CAAC;QAChC,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;QAE/B,MAAM,cAAc,GAAG,CAAC,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACrD,IAAI,cAAc,EAAE;YAClB,oEAAoE;YACpE,uEAAuE;YACvE,kBAAkB;YAClB,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;YAC1B,OAAO;SACR;IACH,CAAC;CACF;AArG4B;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;4CAAkB;AACjB;IAA1B,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;6CAAmB;AACH;IAAzC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;4CAAkB;AAS3D;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,mBAAmB,EAAC,CAAC;mDACjD;AAOL;IADlB,KAAK,CAAC,iBAAiB,CAAC;iDAC6B;AAEnC;IADlB,KAAK,CAAC,kBAAkB,CAAC;kDAC6B","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../elevation/elevation.js';\n\nimport {html, nothing} from 'lit';\nimport {property, query} from 'lit/decorators.js';\n\nimport {ARIAMixinStrict} from '../../internal/aria/aria.js';\nimport {redispatchEvent} from '../../internal/events/redispatch-event.js';\n\nimport {MultiActionChip} from './multi-action-chip.js';\nimport {renderRemoveButton} from './trailing-icons.js';\n\n/**\n * A filter chip component.\n *\n * @fires remove {Event} Dispatched when the remove button is clicked.\n */\nexport class FilterChip extends MultiActionChip {\n @property({type: Boolean}) elevated = false;\n @property({type: Boolean}) removable = false;\n @property({type: Boolean, reflect: true}) selected = false;\n\n /**\n * Only needed for SSR.\n *\n * Add this attribute when a filter chip has a `slot=\"selected-icon\"` to avoid\n * a Flash Of Unstyled Content.\n */\n @property({type: Boolean, reflect: true, attribute: 'has-selected-icon'})\n hasSelectedIcon = false;\n\n protected get primaryId() {\n return 'button';\n }\n\n @query('.primary.action')\n protected readonly primaryAction!: HTMLElement | null;\n @query('.trailing.action')\n protected readonly trailingAction!: HTMLElement | null;\n\n protected override getContainerClasses() {\n return {\n ...super.getContainerClasses(),\n elevated: this.elevated,\n selected: this.selected,\n 'has-trailing': this.removable,\n 'has-icon': this.hasIcon || this.selected,\n };\n }\n\n protected override renderPrimaryAction(content: unknown) {\n const {ariaLabel} = this as ARIAMixinStrict;\n return html`\n <button\n class=\"primary action\"\n id=\"button\"\n aria-label=${ariaLabel || nothing}\n aria-pressed=${this.selected}\n ?disabled=${this.disabled && !this.alwaysFocusable}\n @click=${this.handleClick}\n >${content}</button\n >\n `;\n }\n\n protected override renderLeadingIcon() {\n if (!this.selected) {\n return super.renderLeadingIcon();\n }\n\n return html`\n <slot name=\"selected-icon\">\n <svg class=\"checkmark\" viewBox=\"0 0 18 18\" aria-hidden=\"true\">\n <path\n d=\"M6.75012 12.1274L3.62262 8.99988L2.55762 10.0574L6.75012 14.2499L15.7501 5.24988L14.6926 4.19238L6.75012 12.1274Z\" />\n </svg>\n </slot>\n `;\n }\n\n protected override renderTrailingAction(focusListener: EventListener) {\n if (this.removable) {\n return renderRemoveButton({\n focusListener,\n ariaLabel: this.ariaLabelRemove,\n disabled: this.disabled,\n });\n }\n\n return nothing;\n }\n\n protected override renderOutline() {\n if (this.elevated) {\n return html`<md-elevation></md-elevation>`;\n }\n\n return super.renderOutline();\n }\n\n private handleClick(event: MouseEvent) {\n if (this.disabled) {\n return;\n }\n\n // Store prevValue to revert in case `chip.selected` is changed during an\n // event listener.\n const prevValue = this.selected;\n this.selected = !this.selected;\n\n const preventDefault = !redispatchEvent(this, event);\n if (preventDefault) {\n // We should not do `this.selected = !this.selected`, since a client\n // click listener could change its value. Instead, always revert to the\n // original value.\n this.selected = prevValue;\n return;\n }\n }\n}\n"]}
|
|
@@ -17,12 +17,6 @@ import { DialogAnimation } from './animations.js';
|
|
|
17
17
|
* on the scrim or pressing Escape.
|
|
18
18
|
*/
|
|
19
19
|
export declare class Dialog extends LitElement {
|
|
20
|
-
/** @nocollapse */
|
|
21
|
-
static shadowRootOptions: {
|
|
22
|
-
delegatesFocus: boolean;
|
|
23
|
-
mode: ShadowRootMode;
|
|
24
|
-
slotAssignment?: SlotAssignmentMode;
|
|
25
|
-
};
|
|
26
20
|
/**
|
|
27
21
|
* Opens the dialog when set to `true` and closes it when set to `false`.
|
|
28
22
|
*/
|
|
@@ -87,6 +87,25 @@ export class Dialog extends LitElement {
|
|
|
87
87
|
this.escapePressedWithoutCancel = false;
|
|
88
88
|
if (!isServer) {
|
|
89
89
|
this.addEventListener('submit', this.handleSubmit);
|
|
90
|
+
// We do not use `delegatesFocus: true` due to a Chromium bug with
|
|
91
|
+
// selecting text.
|
|
92
|
+
// See https://bugs.chromium.org/p/chromium/issues/detail?id=950357
|
|
93
|
+
//
|
|
94
|
+
// Material requires using focus trapping within the dialog (see
|
|
95
|
+
// b/314840853 for the bug to add it). This would normally mean we don't
|
|
96
|
+
// care about delegating focus since the `<dialog>` never receives it.
|
|
97
|
+
// However, we still need to handle situations when a user has not
|
|
98
|
+
// provided an focusable child in the content. When that happens, the
|
|
99
|
+
// `<dialog>` itself is focused.
|
|
100
|
+
//
|
|
101
|
+
// Listen to focus/blur instead of focusin/focusout since those can bubble
|
|
102
|
+
// from content.
|
|
103
|
+
this.addEventListener('focus', () => {
|
|
104
|
+
this.dialog?.focus();
|
|
105
|
+
});
|
|
106
|
+
this.addEventListener('blur', () => {
|
|
107
|
+
this.dialog?.blur();
|
|
108
|
+
});
|
|
90
109
|
}
|
|
91
110
|
}
|
|
92
111
|
/**
|
|
@@ -349,11 +368,6 @@ export class Dialog extends LitElement {
|
|
|
349
368
|
(() => {
|
|
350
369
|
requestUpdateOnAriaChange(Dialog);
|
|
351
370
|
})();
|
|
352
|
-
/** @nocollapse */
|
|
353
|
-
Dialog.shadowRootOptions = {
|
|
354
|
-
...LitElement.shadowRootOptions,
|
|
355
|
-
delegatesFocus: true,
|
|
356
|
-
};
|
|
357
371
|
__decorate([
|
|
358
372
|
property({ type: Boolean })
|
|
359
373
|
], Dialog.prototype, "open", null);
|