@material/web 1.1.2-nightly.cef1b74.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/button/internal/button.d.ts +9 -1
- package/button/internal/button.js +9 -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/dialog/internal/_dialog.scss +50 -42
- package/dialog/internal/dialog-styles.css.js +1 -1
- package/dialog/internal/dialog-styles.css.js.map +1 -1
- package/divider/internal/_divider.scss +6 -6
- package/divider/internal/divider-styles.css.js +1 -1
- package/divider/internal/divider-styles.css.js.map +1 -1
- package/elevation/internal/_elevation.scss +10 -4
- package/elevation/internal/elevation-styles.css.js +1 -1
- package/elevation/internal/elevation-styles.css.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/iconbutton/internal/icon-button.d.ts +9 -1
- package/iconbutton/internal/icon-button.js +9 -1
- package/iconbutton/internal/icon-button.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/list/list-item.d.ts +1 -1
- package/list/list-item.js.map +1 -1
- package/menu/internal/menuitem/_menu-item.scss +31 -52
- package/menu/internal/menuitem/menu-item-styles.css.js +1 -1
- package/menu/internal/menuitem/menu-item-styles.css.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 +5 -3
- package/radio/internal/_radio.scss +34 -34
- package/radio/internal/radio-styles.css.js +1 -1
- package/radio/internal/radio-styles.css.js.map +1 -1
- package/ripple/internal/_ripple.scss +8 -9
- package/ripple/internal/ripple-styles.css.js +1 -1
- package/ripple/internal/ripple-styles.css.js.map +1 -1
- package/select/internal/select.js +3 -10
- 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/switch/internal/_handle.scss +42 -37
- package/switch/internal/_icon.scss +17 -17
- package/switch/internal/_switch.scss +52 -52
- package/switch/internal/_track.scss +18 -18
- package/switch/internal/switch-styles.css.js +1 -1
- package/switch/internal/switch-styles.css.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/testing/harness.d.ts +371 -0
- package/testing/harness.js +737 -0
- package/testing/harness.js.map +1 -0
- package/testing/transform-pseudo-classes.d.ts +39 -0
- package/testing/transform-pseudo-classes.js +172 -0
- package/testing/transform-pseudo-classes.js.map +1 -0
- package/textfield/filled-text-field.d.ts +1 -1
- package/textfield/filled-text-field.js.map +1 -1
- package/textfield/internal/text-field.d.ts +1 -2
- package/textfield/internal/text-field.js +12 -18
- 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/_index.scss +0 -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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +4 -4
- package/tokens/_md-comp-list.scss +2 -2
- package/tokens/_md-comp-menu-item.scss +65 -9
- package/tokens/_md-comp-menu.scss +2 -2
- package/tokens/_md-comp-outlined-button.scss +2 -2
- 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 +2 -2
- 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
- package/tokens/_md-comp-menu-list-item.scss +0 -162
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"on-report-valid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E,YAAY;QACZ,2EAA2E;QAC3E,2BAA2B;QAC3B,MAAM,KAAK,GAAG,IAAI,WAAW,EAAE,CAAC;QAChC,MAAM,mBAAmB,GAAG,IAAI,CAAC,cAAc,CAAC;QAChD,IAAI,CAAC,cAAc,GAAG;YACpB,KAAK,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;YACzC,MAAM,KAAK,GAAG,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC7C,KAAK,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;YACxC,OAAO,KAAK,CAAC;QACf,CAAC,CAAC;QAEF,0BAA0B,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;KAC7C;IAED,MAAM,KAAK,GAAG,0BAA0B,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC;IACpD,KAAK,CAAC,gBAAgB,CAAC,QAAQ,EAAE,oBAAoB,EAAE,EAAC,MAAM,EAAE,OAAO,EAAC,CAAC,CAAC;IAC1E,KAAK,CAAC,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,EAAE,EAAC,MAAM,EAAE,OAAO,EAAC,CAAC,CAAC;AAC1E,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {LitElement, isServer} from 'lit';\n\nimport {ConstraintValidation} from './constraint-validation.js';\nimport {MixinBase, MixinReturn} from './mixin.js';\n\n/**\n * A constraint validation element that has a callback for when the element\n * should report validity styles and error messages to the user.\n *\n * This is commonly used in text-field-like controls that display error styles\n * and error messages.\n */\nexport interface OnReportValidity extends ConstraintValidation {\n /**\n * A callback that is invoked when validity should be reported. Components\n * that can display their own error state can use this and update their\n * styles.\n *\n * If an invalid event is provided, the element is invalid. If `null`, the\n * element is valid.\n *\n * The invalid event's `preventDefault()` may be called to stop the platform\n * popup from displaying.\n *\n * @param invalidEvent The `invalid` event dispatched when an element is\n * invalid, or `null` if the element is valid.\n */\n [onReportValidity](invalidEvent: Event | null): void;\n\n // `mixinOnReportValidity()` implements this optional method. If overriden,\n // call `super.formAssociatedCallback(form)`.\n // (inherit jsdoc from `FormAssociated`)\n formAssociatedCallback(form: HTMLFormElement | null): void;\n}\n\n/**\n * A symbol property used for a callback when validity has been reported.\n */\nexport const onReportValidity = Symbol('onReportValidity');\n\n// Private symbol members, used to avoid name clashing.\nconst privateCleanupFormListeners = Symbol('privateCleanupFormListeners');\nconst privateDoNotReportInvalid = Symbol('privateDoNotReportInvalid');\n\n/**\n * Mixes in a callback for constraint validation when validity should be\n * styled and reported to the user.\n *\n * This is commonly used in text-field-like controls that display error styles\n * and error messages.\n *\n * @example\n * ```ts\n * const baseClass = mixinOnReportValidity(\n * mixinConstraintValidation(\n * mixinFormAssociated(mixinElementInternals(LitElement)),\n * ),\n * );\n *\n * class MyField extends baseClass {\n * \\@property({type: Boolean}) error = false;\n * \\@property() errorMessage = '';\n *\n * [onReportValidity](invalidEvent: Event | null) {\n * this.error = !!invalidEvent;\n * this.errorMessage = this.validationMessage;\n *\n * // Optionally prevent platform popup from displaying\n * invalidEvent?.preventDefault();\n * }\n * }\n * ```\n *\n * @param base The class to mix functionality into.\n * @return The provided class with `OnReportValidity` mixed in.\n */\nexport function mixinOnReportValidity<\n T extends MixinBase<LitElement & ConstraintValidation>,\n>(base: T): MixinReturn<T, OnReportValidity> {\n abstract class OnReportValidityElement\n extends base\n implements OnReportValidity\n {\n /**\n * Used to clean up event listeners when a new form is associated.\n */\n [privateCleanupFormListeners] = new AbortController();\n\n /**\n * Used to determine if an invalid event should report validity. Invalid\n * events from `checkValidity()` do not trigger reporting.\n */\n [privateDoNotReportInvalid] = false;\n\n // Mixins must have a constructor with `...args: any[]`\n // tslint:disable-next-line:no-any\n constructor(...args: any[]) {\n super(...args);\n if (isServer) {\n return;\n }\n\n this.addEventListener(\n 'invalid',\n (invalidEvent) => {\n // Listen for invalid events dispatched by a `<form>` when it tries to\n // submit and the element is invalid. We ignore events dispatched when\n // calling `checkValidity()` as well as untrusted events, since the\n // `reportValidity()` and `<form>`-dispatched events are always\n // trusted.\n if (this[privateDoNotReportInvalid] || !invalidEvent.isTrusted) {\n return;\n }\n\n this.addEventListener(\n 'invalid',\n () => {\n // A normal bubbling phase event listener. By adding it here, we\n // ensure it's the last event listener that is called during the\n // bubbling phase.\n if (!invalidEvent.defaultPrevented) {\n this[onReportValidity](invalidEvent);\n }\n },\n {once: true},\n );\n },\n {\n // Listen during the capture phase, which will happen before the\n // bubbling phase. That way, we can add a final event listener that\n // will run after other event listeners, and we can check if it was\n // default prevented. This works because invalid does not bubble.\n capture: true,\n },\n );\n }\n\n override checkValidity() {\n this[privateDoNotReportInvalid] = true;\n const valid = super.checkValidity();\n this[privateDoNotReportInvalid] = false;\n return valid;\n }\n\n override reportValidity() {\n const valid = super.reportValidity();\n // Constructor's invalid listener will handle reporting invalid events.\n if (valid) {\n this[onReportValidity](null);\n }\n\n return valid;\n }\n\n [onReportValidity](invalidEvent: Event | null) {\n throw new Error('Implement [onReportValidity]');\n }\n\n override formAssociatedCallback(form: HTMLFormElement | null) {\n // can't use super.formAssociatedCallback?.() due to closure\n if (super.formAssociatedCallback) {\n super.formAssociatedCallback(form);\n }\n\n // Clean up previous submit listener\n this[privateCleanupFormListeners].abort();\n if (!form) {\n return;\n }\n\n this[privateCleanupFormListeners] = new AbortController();\n // If the element's form submits, then all controls are valid. This lets\n // the element remove its error styles that may have been set when\n // `reportValidity()` was called.\n form.addEventListener(\n 'submit',\n () => {\n this[onReportValidity](null);\n },\n {\n signal: this[privateCleanupFormListeners].signal,\n },\n );\n\n // Inject a callback when `form.reportValidity()` is called and the form\n // is valid. There isn't an event that is dispatched to alert us (unlike\n // the 'invalid' event), and we need to remove error styles when\n // `form.reportValidity()` is called and returns true.\n let reportedInvalidEventFromForm = false;\n let formReportValidityCleanup = new AbortController();\n injectFormReportValidityHooks({\n form,\n cleanup: this[privateCleanupFormListeners].signal,\n beforeReportValidity: () => {\n reportedInvalidEventFromForm = false;\n this.addEventListener(\n 'invalid',\n (invalidEvent) => {\n reportedInvalidEventFromForm = true;\n if (!invalidEvent.defaultPrevented) {\n this[onReportValidity](invalidEvent);\n }\n },\n {signal: formReportValidityCleanup.signal},\n );\n },\n afterReportValidity: () => {\n formReportValidityCleanup.abort();\n formReportValidityCleanup = new AbortController();\n if (reportedInvalidEventFromForm) {\n reportedInvalidEventFromForm = false;\n return;\n }\n\n // Report successful form validation if an invalid event wasn't\n // fired.\n this[onReportValidity](null);\n },\n });\n }\n }\n\n return OnReportValidityElement;\n}\n\nconst FORM_REPORT_VALIDITY_HOOKS = new WeakMap<HTMLFormElement, EventTarget>();\n\nfunction injectFormReportValidityHooks({\n form,\n beforeReportValidity,\n afterReportValidity,\n cleanup,\n}: {\n form: HTMLFormElement;\n beforeReportValidity: () => void;\n afterReportValidity: () => void;\n cleanup: AbortSignal;\n}) {\n if (!FORM_REPORT_VALIDITY_HOOKS.has(form)) {\n // Patch form.reportValidity() to add an event target that can be used to\n // react when the method is called.\n // We should only patch this method once, since multiple controls and other\n // forces may want to patch this method. We cannot reliably clean it up by\n // resetting the method to \"superReportValidity\", which may be a patched\n // function.\n // Instead, we never clean up the patch but add and clean up event listener\n // hooks once it's patched.\n const hooks = new EventTarget();\n const superReportValidity = form.reportValidity;\n form.reportValidity = function (this: HTMLFormElement) {\n hooks.dispatchEvent(new Event('before'));\n const valid = superReportValidity.call(this);\n hooks.dispatchEvent(new Event('after'));\n return valid;\n };\n\n FORM_REPORT_VALIDITY_HOOKS.set(form, hooks);\n }\n\n const hooks = FORM_REPORT_VALIDITY_HOOKS.get(form)!;\n hooks.addEventListener('before', beforeReportValidity, {signal: cleanup});\n hooks.addEventListener('after', afterReportValidity, {signal: cleanup});\n}\n"]}
|
|
1
|
+
{"version":3,"file":"on-report-validity.js","sourceRoot":"","sources":["on-report-validity.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH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{LitElement, isServer} from 'lit';\n\nimport {ConstraintValidation} from './constraint-validation.js';\nimport {WithElementInternals, internals} from './element-internals.js';\nimport {MixinBase, MixinReturn} from './mixin.js';\n\n/**\n * A constraint validation element that has a callback for when the element\n * should report validity styles and error messages to the user.\n *\n * This is commonly used in text-field-like controls that display error styles\n * and error messages.\n */\nexport interface OnReportValidity extends ConstraintValidation {\n /**\n * A callback that is invoked when validity should be reported. Components\n * that can display their own error state can use this and update their\n * styles.\n *\n * If an invalid event is provided, the element is invalid. If `null`, the\n * element is valid.\n *\n * The invalid event's `preventDefault()` may be called to stop the platform\n * popup from displaying.\n *\n * @param invalidEvent The `invalid` event dispatched when an element is\n * invalid, or `null` if the element is valid.\n */\n [onReportValidity](invalidEvent: Event | null): void;\n\n // `mixinOnReportValidity()` implements this optional method. If overriden,\n // call `super.formAssociatedCallback(form)`.\n // (inherit jsdoc from `FormAssociated`)\n formAssociatedCallback(form: HTMLFormElement | null): void;\n}\n\n/**\n * A symbol property used for a callback when validity has been reported.\n */\nexport const onReportValidity = Symbol('onReportValidity');\n\n// Private symbol members, used to avoid name clashing.\nconst privateCleanupFormListeners = Symbol('privateCleanupFormListeners');\nconst privateDoNotReportInvalid = Symbol('privateDoNotReportInvalid');\nconst privateIsSelfReportingValidity = Symbol('privateIsSelfReportingValidity');\nconst privateCallOnReportValidity = Symbol('privateCallOnReportValidity');\n\n/**\n * Mixes in a callback for constraint validation when validity should be\n * styled and reported to the user.\n *\n * This is commonly used in text-field-like controls that display error styles\n * and error messages.\n *\n * @example\n * ```ts\n * const baseClass = mixinOnReportValidity(\n * mixinConstraintValidation(\n * mixinFormAssociated(mixinElementInternals(LitElement)),\n * ),\n * );\n *\n * class MyField extends baseClass {\n * \\@property({type: Boolean}) error = false;\n * \\@property() errorMessage = '';\n *\n * [onReportValidity](invalidEvent: Event | null) {\n * this.error = !!invalidEvent;\n * this.errorMessage = this.validationMessage;\n *\n * // Optionally prevent platform popup from displaying\n * invalidEvent?.preventDefault();\n * }\n * }\n * ```\n *\n * @param base The class to mix functionality into.\n * @return The provided class with `OnReportValidity` mixed in.\n */\nexport function mixinOnReportValidity<\n T extends MixinBase<LitElement & ConstraintValidation & WithElementInternals>,\n>(base: T): MixinReturn<T, OnReportValidity> {\n abstract class OnReportValidityElement\n extends base\n implements OnReportValidity\n {\n /**\n * Used to clean up event listeners when a new form is associated.\n */\n [privateCleanupFormListeners] = new AbortController();\n\n /**\n * Used to determine if an invalid event should report validity. Invalid\n * events from `checkValidity()` do not trigger reporting.\n */\n [privateDoNotReportInvalid] = false;\n\n /**\n * Used to determine if the control is reporting validity from itself, or\n * if a `<form>` is causing the validity report. Forms have different\n * control focusing behavior.\n */\n [privateIsSelfReportingValidity] = false;\n\n // Mixins must have a constructor with `...args: any[]`\n // tslint:disable-next-line:no-any\n constructor(...args: any[]) {\n super(...args);\n if (isServer) {\n return;\n }\n\n this.addEventListener(\n 'invalid',\n (invalidEvent) => {\n // Listen for invalid events dispatched by a `<form>` when it tries to\n // submit and the element is invalid. We ignore events dispatched when\n // calling `checkValidity()` as well as untrusted events, since the\n // `reportValidity()` and `<form>`-dispatched events are always\n // trusted.\n if (this[privateDoNotReportInvalid] || !invalidEvent.isTrusted) {\n return;\n }\n\n this.addEventListener(\n 'invalid',\n () => {\n // A normal bubbling phase event listener. By adding it here, we\n // ensure it's the last event listener that is called during the\n // bubbling phase.\n this[privateCallOnReportValidity](invalidEvent);\n },\n {once: true},\n );\n },\n {\n // Listen during the capture phase, which will happen before the\n // bubbling phase. That way, we can add a final event listener that\n // will run after other event listeners, and we can check if it was\n // default prevented. This works because invalid does not bubble.\n capture: true,\n },\n );\n }\n\n override checkValidity() {\n this[privateDoNotReportInvalid] = true;\n const valid = super.checkValidity();\n this[privateDoNotReportInvalid] = false;\n return valid;\n }\n\n override reportValidity() {\n this[privateIsSelfReportingValidity] = true;\n const valid = super.reportValidity();\n // Constructor's invalid listener will handle reporting invalid events.\n if (valid) {\n this[privateCallOnReportValidity](null);\n }\n\n this[privateIsSelfReportingValidity] = false;\n return valid;\n }\n\n [privateCallOnReportValidity](invalidEvent: Event | null) {\n // Since invalid events do not bubble to parent listeners, and because\n // our invalid listeners are added lazily after other listeners, we can\n // reliably read `defaultPrevented` synchronously without worrying\n // about waiting for another listener that could cancel it.\n const wasCanceled = invalidEvent?.defaultPrevented;\n if (wasCanceled) {\n return;\n }\n\n this[onReportValidity](invalidEvent);\n\n // If an implementation calls invalidEvent.preventDefault() to stop the\n // platform popup from displaying, focusing is also prevented, so we need\n // to manually focus.\n const implementationCanceledFocus =\n !wasCanceled && invalidEvent?.defaultPrevented;\n if (!implementationCanceledFocus) {\n return;\n }\n\n // The control should be focused when:\n // - `control.reportValidity()` is called (self-reporting).\n // - a form is reporting validity for its controls and this is the first\n // invalid control.\n if (\n this[privateIsSelfReportingValidity] ||\n isFirstInvalidControlInForm(this[internals].form, this)\n ) {\n this.focus();\n }\n }\n\n [onReportValidity](invalidEvent: Event | null) {\n throw new Error('Implement [onReportValidity]');\n }\n\n override formAssociatedCallback(form: HTMLFormElement | null) {\n // can't use super.formAssociatedCallback?.() due to closure\n if (super.formAssociatedCallback) {\n super.formAssociatedCallback(form);\n }\n\n // Clean up previous form listeners.\n this[privateCleanupFormListeners].abort();\n if (!form) {\n return;\n }\n\n this[privateCleanupFormListeners] = new AbortController();\n\n // Add a listener that fires when the form runs constraint validation and\n // the control is valid, so that it may remove its error styles.\n //\n // This happens on `form.reportValidity()` and `form.requestSubmit()`\n // (both when the submit fails and passes).\n addFormReportValidListener(\n this,\n form,\n () => {\n this[privateCallOnReportValidity](null);\n },\n this[privateCleanupFormListeners].signal,\n );\n }\n }\n\n return OnReportValidityElement;\n}\n\n/**\n * Add a listener that fires when a form runs constraint validation on a control\n * and it is valid. This is needed to clear previously invalid styles.\n *\n * @param control The control of the form to listen for valid events.\n * @param form The control's form that can run constraint validation.\n * @param onControlValid A listener that is called when the form runs constraint\n * validation and the control is valid.\n * @param cleanup A cleanup signal to remove the listener.\n */\nfunction addFormReportValidListener(\n control: Element,\n form: HTMLFormElement,\n onControlValid: () => void,\n cleanup: AbortSignal,\n) {\n const validateHooks = getFormValidateHooks(form);\n\n // When a form validates its controls, check if an invalid event is dispatched\n // on the control. If it is not, then inform the control to report its valid\n // state.\n let controlFiredInvalid = false;\n let cleanupInvalidListener: AbortController | undefined;\n let isNextSubmitFromHook = false;\n validateHooks.addEventListener(\n 'before',\n () => {\n isNextSubmitFromHook = true;\n cleanupInvalidListener = new AbortController();\n controlFiredInvalid = false;\n control.addEventListener(\n 'invalid',\n () => {\n controlFiredInvalid = true;\n },\n {\n signal: cleanupInvalidListener.signal,\n },\n );\n },\n {signal: cleanup},\n );\n\n validateHooks.addEventListener(\n 'after',\n () => {\n isNextSubmitFromHook = false;\n cleanupInvalidListener?.abort();\n if (controlFiredInvalid) {\n return;\n }\n\n onControlValid();\n },\n {signal: cleanup},\n );\n\n // The above hooks handle imperatively submitting the form, but not\n // declaratively submitting the form. This happens when:\n // 1. A non-custom element `<button type=\"submit\">` is clicked.\n // 2. Enter is pressed on a non-custom element text editable `<input>`.\n form.addEventListener(\n 'submit',\n () => {\n // This submit was from `form.requestSubmit()`, which already calls the\n // listener.\n if (isNextSubmitFromHook) {\n return;\n }\n\n onControlValid();\n },\n {\n signal: cleanup,\n },\n );\n\n // Note: it is a known limitation that we cannot detect if a form tries to\n // submit declaratively, but fails to do so because an unrelated sibling\n // control failed its constraint validation.\n //\n // Since we cannot detect when that happens, a previously invalid control may\n // not clear its error styling when it becomes valid again.\n //\n // To work around this, call `form.reportValidity()` when submitting a form\n // declaratively. This can be down on the `<button type=\"submit\">`'s click or\n // the text editable `<input>`'s 'Enter' keydown.\n}\n\nconst FORM_VALIDATE_HOOKS = new WeakMap<HTMLFormElement, EventTarget>();\n\n/**\n * Get a hooks `EventTarget` that dispatches 'before' and 'after' events that\n * fire before a form runs constraint validation and immediately after it\n * finishes running constraint validation on its controls.\n *\n * This happens during `form.reportValidity()` and `form.requestSubmit()`.\n *\n * @param form The form to get or set up hooks for.\n * @return A hooks `EventTarget` to add listeners to.\n */\nfunction getFormValidateHooks(form: HTMLFormElement) {\n if (!FORM_VALIDATE_HOOKS.has(form)) {\n // Patch form methods to add event listener hooks. These are needed to react\n // to form behaviors that do not dispatch events, such as a form asking its\n // controls to report their validity.\n //\n // We should only patch the methods once, since multiple controls and other\n // forces may want to patch this method. We cannot reliably clean it up if\n // there are multiple patched and re-patched methods referring holding\n // references to each other.\n //\n // Instead, we never clean up the patch but add and clean up event listeners\n // added to the hooks after the patch.\n const hooks = new EventTarget();\n FORM_VALIDATE_HOOKS.set(form, hooks);\n\n // Add hooks to support notifying before and after a form has run constraint\n // validation on its controls.\n // Note: `form.submit()` does not run constraint validation per spec.\n for (const methodName of ['reportValidity', 'requestSubmit'] as const) {\n const superMethod = form[methodName];\n form[methodName] = function (this: HTMLFormElement) {\n hooks.dispatchEvent(new Event('before'));\n const result = Reflect.apply(superMethod, this, arguments);\n hooks.dispatchEvent(new Event('after'));\n return result;\n };\n }\n }\n\n return FORM_VALIDATE_HOOKS.get(form)!;\n}\n\n/**\n * Checks if a control is the first invalid control in a form.\n *\n * @param form The control's form. When `null`, the control doesn't have a form\n * and the method returns true.\n * @param control The control to check.\n * @return True if there is no form or if the control is the form's first\n * invalid control.\n */\nfunction isFirstInvalidControlInForm(\n form: HTMLFormElement | null,\n control: HTMLElement,\n) {\n if (!form) {\n return true;\n }\n\n let firstInvalidControl: Element | undefined;\n for (const element of form.elements) {\n if (element.matches(':invalid')) {\n firstInvalidControl = element;\n break;\n }\n }\n\n return firstInvalidControl === control;\n}\n"]}
|
package/list/list-item.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { ListItemEl as ListItem } from './internal/listitem/list-item.js';
|
|
7
|
-
export { ListItemType } from './internal/listitem/list-item.js';
|
|
7
|
+
export { type ListItemType } from './internal/listitem/list-item.js';
|
|
8
8
|
declare global {
|
|
9
9
|
interface HTMLElementTagNameMap {
|
|
10
10
|
'md-list-item': MdListItem;
|
package/list/list-item.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-item.js","sourceRoot":"","sources":["list-item.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAC,UAAU,IAAI,QAAQ,EAAC,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAC,MAAM,EAAC,MAAM,6CAA6C,CAAC;AAUnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEI,WAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,QAAQ;;AACtB,iBAAM,GAAG,CAAC,MAAM,CAAC,AAAX,CAAY;AADvB,UAAU;IADtB,aAAa,CAAC,cAAc,CAAC;GACjB,UAAU,CAEtB","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {customElement} from 'lit/decorators.js';\n\nimport {ListItemEl as ListItem} from './internal/listitem/list-item.js';\nimport {styles} from './internal/listitem/list-item-styles.css.js';\n\nexport {ListItemType} from './internal/listitem/list-item.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'md-list-item': MdListItem;\n }\n}\n\n/**\n * @summary\n * Lists are continuous, vertical indexes of text or images. Items are placed\n * inside the list.\n *\n * @description\n * Lists consist of one or more list items, and can contain actions represented\n * by icons and text. List items come in three sizes: one-line, two-line, and\n * three-line.\n *\n * __Takeaways:__\n *\n * - Lists should be sorted in logical ways that make content easy to scan, such\n * as alphabetical, numerical, chronological, or by user preference.\n * - Lists present content in a way that makes it easy to identify a specific\n * item in a collection and act on it.\n * - Lists should present icons, text, and actions in a consistent format.\n *\n * Acceptable slot child variants are:\n *\n * - `img[slot=end]`\n * - `img[slot=start]`\n *\n * @example\n * ```html\n * <md-list-item\n * headline=\"User Name\"\n * supportingText=\"user@name.com\">\n * <md-icon slot=\"start\">account_circle</md-icon>\n * <md-icon slot=\"end\">check</md-icon>\n * </md-list-item>\n * ```\n *\n * @example\n *\n * @final\n * @suppress {visibility}\n */\n@customElement('md-list-item')\nexport class MdListItem extends ListItem {\n static override styles = [styles];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"list-item.js","sourceRoot":"","sources":["list-item.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAC,UAAU,IAAI,QAAQ,EAAC,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAC,MAAM,EAAC,MAAM,6CAA6C,CAAC;AAUnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEI,WAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,QAAQ;;AACtB,iBAAM,GAAG,CAAC,MAAM,CAAC,AAAX,CAAY;AADvB,UAAU;IADtB,aAAa,CAAC,cAAc,CAAC;GACjB,UAAU,CAEtB","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {customElement} from 'lit/decorators.js';\n\nimport {ListItemEl as ListItem} from './internal/listitem/list-item.js';\nimport {styles} from './internal/listitem/list-item-styles.css.js';\n\nexport {type ListItemType} from './internal/listitem/list-item.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'md-list-item': MdListItem;\n }\n}\n\n/**\n * @summary\n * Lists are continuous, vertical indexes of text or images. Items are placed\n * inside the list.\n *\n * @description\n * Lists consist of one or more list items, and can contain actions represented\n * by icons and text. List items come in three sizes: one-line, two-line, and\n * three-line.\n *\n * __Takeaways:__\n *\n * - Lists should be sorted in logical ways that make content easy to scan, such\n * as alphabetical, numerical, chronological, or by user preference.\n * - Lists present content in a way that makes it easy to identify a specific\n * item in a collection and act on it.\n * - Lists should present icons, text, and actions in a consistent format.\n *\n * Acceptable slot child variants are:\n *\n * - `img[slot=end]`\n * - `img[slot=start]`\n *\n * @example\n * ```html\n * <md-list-item\n * headline=\"User Name\"\n * supportingText=\"user@name.com\">\n * <md-icon slot=\"start\">account_circle</md-icon>\n * <md-icon slot=\"end\">check</md-icon>\n * </md-list-item>\n * ```\n *\n * @example\n *\n * @final\n * @suppress {visibility}\n */\n@customElement('md-list-item')\nexport class MdListItem extends ListItem {\n static override styles = [styles];\n}\n"]}
|
|
@@ -17,59 +17,41 @@
|
|
|
17
17
|
// go/keep-sorted end
|
|
18
18
|
|
|
19
19
|
@mixin theme($tokens) {
|
|
20
|
-
$list-item-supported-tokens: tokens.$md-comp-menu-list-item-supported-tokens;
|
|
21
20
|
$supported-tokens: tokens.$md-comp-menu-item-supported-tokens;
|
|
22
21
|
|
|
23
22
|
@each $token, $value in $tokens {
|
|
24
|
-
@if list.index($supported-tokens, $token) ==
|
|
25
|
-
null and
|
|
26
|
-
list.index($list-item-supported-tokens, $token) ==
|
|
27
|
-
null
|
|
28
|
-
{
|
|
23
|
+
@if list.index($supported-tokens, $token) == null {
|
|
29
24
|
@error 'Token `#{$token}` is not a supported token.';
|
|
30
25
|
}
|
|
31
26
|
|
|
32
27
|
@if $value and list.index($supported-tokens, $token) == null {
|
|
33
28
|
--md-menu-item-#{$token}: #{$value};
|
|
34
29
|
}
|
|
35
|
-
|
|
36
|
-
@if $value and list.index($list-item-supported-tokens, $token) == null {
|
|
37
|
-
--md-list-item-#{$token}: #{$value};
|
|
38
|
-
}
|
|
39
30
|
}
|
|
40
31
|
}
|
|
41
32
|
|
|
42
33
|
@mixin styles() {
|
|
43
|
-
$list-item-tokens: tokens.md-comp-menu-list-item-values();
|
|
44
|
-
@each $token, $value in $list-item-tokens {
|
|
45
|
-
$list-item-tokens: map.set(
|
|
46
|
-
$list-item-tokens,
|
|
47
|
-
$token,
|
|
48
|
-
var(--md-menu-item-#{$token}, #{$value})
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
34
|
$tokens: tokens.md-comp-menu-item-values();
|
|
52
35
|
@each $token, $value in $tokens {
|
|
53
36
|
$tokens: map.set($tokens, $token, var(--md-menu-item-#{$token}, #{$value}));
|
|
54
37
|
}
|
|
55
38
|
|
|
56
39
|
:host {
|
|
57
|
-
border-radius: map.get($
|
|
40
|
+
border-radius: map.get($tokens, 'container-shape');
|
|
58
41
|
display: flex;
|
|
59
42
|
|
|
60
43
|
@include ripple.theme(
|
|
61
44
|
(
|
|
62
|
-
hover-color: map.get($
|
|
63
|
-
hover-opacity: map.get($
|
|
64
|
-
pressed-color: map.get($
|
|
65
|
-
pressed-opacity:
|
|
66
|
-
map.get($list-item-tokens, 'pressed-state-layer-opacity'),
|
|
45
|
+
hover-color: map.get($tokens, 'hover-state-layer-color'),
|
|
46
|
+
hover-opacity: map.get($tokens, 'hover-state-layer-opacity'),
|
|
47
|
+
pressed-color: map.get($tokens, 'pressed-state-layer-color'),
|
|
48
|
+
pressed-opacity: map.get($tokens, 'pressed-state-layer-opacity'),
|
|
67
49
|
)
|
|
68
50
|
);
|
|
69
51
|
}
|
|
70
52
|
|
|
71
53
|
:host([disabled]) {
|
|
72
|
-
opacity: map.get($
|
|
54
|
+
opacity: map.get($tokens, 'disabled-opacity');
|
|
73
55
|
pointer-events: none;
|
|
74
56
|
}
|
|
75
57
|
|
|
@@ -121,39 +103,36 @@
|
|
|
121
103
|
md-item {
|
|
122
104
|
border-radius: inherit;
|
|
123
105
|
flex: 1;
|
|
124
|
-
color: map.get($
|
|
125
|
-
font-family: map.get($
|
|
126
|
-
font-size: map.get($
|
|
127
|
-
line-height: map.get($
|
|
128
|
-
font-weight: map.get($
|
|
129
|
-
min-height: map.get($
|
|
130
|
-
padding-top: map.get($
|
|
131
|
-
padding-bottom: map.get($
|
|
132
|
-
padding-inline-start: map.get($
|
|
133
|
-
padding-inline-end: map.get($
|
|
106
|
+
color: map.get($tokens, 'label-text-color');
|
|
107
|
+
font-family: map.get($tokens, 'label-text-font');
|
|
108
|
+
font-size: map.get($tokens, 'label-text-size');
|
|
109
|
+
line-height: map.get($tokens, 'label-text-line-height');
|
|
110
|
+
font-weight: map.get($tokens, 'label-text-weight');
|
|
111
|
+
min-height: map.get($tokens, 'one-line-container-height');
|
|
112
|
+
padding-top: map.get($tokens, 'top-space');
|
|
113
|
+
padding-bottom: map.get($tokens, 'bottom-space');
|
|
114
|
+
padding-inline-start: map.get($tokens, 'leading-space');
|
|
115
|
+
padding-inline-end: map.get($tokens, 'trailing-space');
|
|
134
116
|
}
|
|
135
117
|
|
|
136
118
|
md-item[multiline] {
|
|
137
|
-
min-height: map.get($
|
|
119
|
+
min-height: map.get($tokens, 'two-line-container-height');
|
|
138
120
|
}
|
|
139
121
|
|
|
140
122
|
[slot='supporting-text'] {
|
|
141
|
-
color: map.get($
|
|
142
|
-
font-family: map.get($
|
|
143
|
-
font-size: map.get($
|
|
144
|
-
line-height: map.get($
|
|
145
|
-
font-weight: map.get($
|
|
123
|
+
color: map.get($tokens, 'supporting-text-color');
|
|
124
|
+
font-family: map.get($tokens, 'supporting-text-font');
|
|
125
|
+
font-size: map.get($tokens, 'supporting-text-size');
|
|
126
|
+
line-height: map.get($tokens, 'supporting-text-line-height');
|
|
127
|
+
font-weight: map.get($tokens, 'supporting-text-weight');
|
|
146
128
|
}
|
|
147
129
|
|
|
148
130
|
[slot='trailing-supporting-text'] {
|
|
149
|
-
color: map.get($
|
|
150
|
-
font-family: map.get($
|
|
151
|
-
font-size: map.get($
|
|
152
|
-
line-height: map.get(
|
|
153
|
-
|
|
154
|
-
'trailing-supporting-text-line-height'
|
|
155
|
-
);
|
|
156
|
-
font-weight: map.get($list-item-tokens, 'trailing-supporting-text-weight');
|
|
131
|
+
color: map.get($tokens, 'trailing-supporting-text-color');
|
|
132
|
+
font-family: map.get($tokens, 'trailing-supporting-text-font');
|
|
133
|
+
font-size: map.get($tokens, 'trailing-supporting-text-size');
|
|
134
|
+
line-height: map.get($tokens, 'trailing-supporting-text-line-height');
|
|
135
|
+
font-weight: map.get($tokens, 'trailing-supporting-text-weight');
|
|
157
136
|
}
|
|
158
137
|
|
|
159
138
|
:is([slot='start'], [slot='end'])::slotted(*) {
|
|
@@ -161,15 +140,15 @@
|
|
|
161
140
|
}
|
|
162
141
|
|
|
163
142
|
[slot='start'] {
|
|
164
|
-
color: map.get($
|
|
143
|
+
color: map.get($tokens, 'leading-icon-color');
|
|
165
144
|
}
|
|
166
145
|
|
|
167
146
|
[slot='end'] {
|
|
168
|
-
color: map.get($
|
|
147
|
+
color: map.get($tokens, 'trailing-icon-color');
|
|
169
148
|
}
|
|
170
149
|
|
|
171
150
|
.list-item {
|
|
172
|
-
background-color: map.get($
|
|
151
|
+
background-color: map.get($tokens, 'container-color');
|
|
173
152
|
}
|
|
174
153
|
|
|
175
154
|
.list-item.selected {
|
|
@@ -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{display:flex;--md-ripple-hover-color: var(--md-menu-item-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-hover-opacity: var(--md-menu-item-hover-state-layer-opacity, 0.08);--md-ripple-pressed-color: var(--md-menu-item-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-pressed-opacity: var(--md-menu-item-pressed-state-layer-opacity, 0.12)}:host([disabled]){opacity:var(--md-menu-item-disabled-opacity, 0.3);pointer-events:none}md-focus-ring{z-index:1;--md-focus-ring-shape: 8px}a,button,li{background:none;border:none;padding:0;margin:0;text-align:unset;text-decoration:none}.list-item{border-radius:inherit;display:flex;flex:1;max-width:inherit;min-width:inherit;outline:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.list-item:not(.disabled){cursor:pointer}[slot=container]{pointer-events:none}md-ripple{border-radius:inherit}md-item{border-radius:inherit;flex:1;color:var(--md-menu-item-label-text-color, var(--md-sys-color-on-surface, #1d1b20));font-family:var(--md-menu-item-label-text-font, var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-menu-item-label-text-size, var(--md-sys-typescale-body-large-size, 1rem));line-height:var(--md-menu-item-label-text-line-height, var(--md-sys-typescale-body-large-line-height, 1.5rem));font-weight:var(--md-menu-item-label-text-weight, var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400)));min-height:var(--md-menu-item-one-line-container-height, 56px);padding-top:var(--md-menu-item-top-space, 12px);padding-bottom:var(--md-menu-item-bottom-space, 12px);padding-inline-start:var(--md-menu-item-leading-space, 16px);padding-inline-end:var(--md-menu-item-trailing-space, 16px)}md-item[multiline]{min-height:var(--md-menu-item-two-line-container-height, 72px)}[slot=supporting-text]{color:var(--md-menu-item-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-menu-item-supporting-text-font, var(--md-sys-typescale-body-medium-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-menu-item-supporting-text-size, var(--md-sys-typescale-body-medium-size, 0.875rem));line-height:var(--md-menu-item-supporting-text-line-height, var(--md-sys-typescale-body-medium-line-height, 1.25rem));font-weight:var(--md-menu-item-supporting-text-weight, var(--md-sys-typescale-body-medium-weight, var(--md-ref-typeface-weight-regular, 400)))}[slot=trailing-supporting-text]{color:var(--md-menu-item-trailing-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-menu-item-trailing-supporting-text-font, var(--md-sys-typescale-label-small-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-menu-item-trailing-supporting-text-size, var(--md-sys-typescale-label-small-size, 0.6875rem));line-height:var(--md-menu-item-trailing-supporting-text-line-height, var(--md-sys-typescale-label-small-line-height, 1rem));font-weight:var(--md-menu-item-trailing-supporting-text-weight, var(--md-sys-typescale-label-small-weight, var(--md-ref-typeface-weight-medium, 500)))}:is([slot=start],[slot=end])::slotted(*){fill:currentColor}[slot=start]{color:var(--md-menu-item-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f))}[slot=end]{color:var(--md-menu-item-trailing-icon-color, var(--md-sys-color-on-surface-variant, #49454f))}.list-item.selected{background-color:var(--md-menu-item-selected-container-color, var(--md-sys-color-secondary-container, #e8def8))}.selected:not(.disabled) ::slotted(*){color:var(--md-menu-item-selected-label-text-color, var(--md-sys-color-on-secondary-container, #1d192b))}@media(forced-colors: active){:host([disabled]),:host([disabled]) slot{color:GrayText;opacity:1}.list-item{position:relative}.list-item.selected::before{content:"";position:absolute;inset:0;box-sizing:border-box;border-radius:inherit;pointer-events:none;border:3px double CanvasText}}/*# sourceMappingURL=menu-item-styles.css.map */
|
|
7
|
+
export const styles = css `:host{display:flex;--md-ripple-hover-color: var(--md-menu-item-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-hover-opacity: var(--md-menu-item-hover-state-layer-opacity, 0.08);--md-ripple-pressed-color: var(--md-menu-item-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-pressed-opacity: var(--md-menu-item-pressed-state-layer-opacity, 0.12)}:host([disabled]){opacity:var(--md-menu-item-disabled-opacity, 0.3);pointer-events:none}md-focus-ring{z-index:1;--md-focus-ring-shape: 8px}a,button,li{background:none;border:none;padding:0;margin:0;text-align:unset;text-decoration:none}.list-item{border-radius:inherit;display:flex;flex:1;max-width:inherit;min-width:inherit;outline:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.list-item:not(.disabled){cursor:pointer}[slot=container]{pointer-events:none}md-ripple{border-radius:inherit}md-item{border-radius:inherit;flex:1;color:var(--md-menu-item-label-text-color, var(--md-sys-color-on-surface, #1d1b20));font-family:var(--md-menu-item-label-text-font, var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-menu-item-label-text-size, var(--md-sys-typescale-body-large-size, 1rem));line-height:var(--md-menu-item-label-text-line-height, var(--md-sys-typescale-body-large-line-height, 1.5rem));font-weight:var(--md-menu-item-label-text-weight, var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400)));min-height:var(--md-menu-item-one-line-container-height, 56px);padding-top:var(--md-menu-item-top-space, 12px);padding-bottom:var(--md-menu-item-bottom-space, 12px);padding-inline-start:var(--md-menu-item-leading-space, 16px);padding-inline-end:var(--md-menu-item-trailing-space, 16px)}md-item[multiline]{min-height:var(--md-menu-item-two-line-container-height, 72px)}[slot=supporting-text]{color:var(--md-menu-item-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-menu-item-supporting-text-font, var(--md-sys-typescale-body-medium-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-menu-item-supporting-text-size, var(--md-sys-typescale-body-medium-size, 0.875rem));line-height:var(--md-menu-item-supporting-text-line-height, var(--md-sys-typescale-body-medium-line-height, 1.25rem));font-weight:var(--md-menu-item-supporting-text-weight, var(--md-sys-typescale-body-medium-weight, var(--md-ref-typeface-weight-regular, 400)))}[slot=trailing-supporting-text]{color:var(--md-menu-item-trailing-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-menu-item-trailing-supporting-text-font, var(--md-sys-typescale-label-small-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-menu-item-trailing-supporting-text-size, var(--md-sys-typescale-label-small-size, 0.6875rem));line-height:var(--md-menu-item-trailing-supporting-text-line-height, var(--md-sys-typescale-label-small-line-height, 1rem));font-weight:var(--md-menu-item-trailing-supporting-text-weight, var(--md-sys-typescale-label-small-weight, var(--md-ref-typeface-weight-medium, 500)))}:is([slot=start],[slot=end])::slotted(*){fill:currentColor}[slot=start]{color:var(--md-menu-item-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f))}[slot=end]{color:var(--md-menu-item-trailing-icon-color, var(--md-sys-color-on-surface-variant, #49454f))}.list-item{background-color:var(--md-menu-item-container-color, transparent)}.list-item.selected{background-color:var(--md-menu-item-selected-container-color, var(--md-sys-color-secondary-container, #e8def8))}.selected:not(.disabled) ::slotted(*){color:var(--md-menu-item-selected-label-text-color, var(--md-sys-color-on-secondary-container, #1d192b))}@media(forced-colors: active){:host([disabled]),:host([disabled]) slot{color:GrayText;opacity:1}.list-item{position:relative}.list-item.selected::before{content:"";position:absolute;inset:0;box-sizing:border-box;border-radius:inherit;pointer-events:none;border:3px double CanvasText}}/*# sourceMappingURL=menu-item-styles.css.map */
|
|
8
8
|
`;
|
|
9
9
|
//# sourceMappingURL=menu-item-styles.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-item-styles.css.js","sourceRoot":"","sources":["menu-item-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{display:flex;--md-ripple-hover-color: var(--md-menu-item-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-hover-opacity: var(--md-menu-item-hover-state-layer-opacity, 0.08);--md-ripple-pressed-color: var(--md-menu-item-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-pressed-opacity: var(--md-menu-item-pressed-state-layer-opacity, 0.12)}:host([disabled]){opacity:var(--md-menu-item-disabled-opacity, 0.3);pointer-events:none}md-focus-ring{z-index:1;--md-focus-ring-shape: 8px}a,button,li{background:none;border:none;padding:0;margin:0;text-align:unset;text-decoration:none}.list-item{border-radius:inherit;display:flex;flex:1;max-width:inherit;min-width:inherit;outline:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.list-item:not(.disabled){cursor:pointer}[slot=container]{pointer-events:none}md-ripple{border-radius:inherit}md-item{border-radius:inherit;flex:1;color:var(--md-menu-item-label-text-color, var(--md-sys-color-on-surface, #1d1b20));font-family:var(--md-menu-item-label-text-font, var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-menu-item-label-text-size, var(--md-sys-typescale-body-large-size, 1rem));line-height:var(--md-menu-item-label-text-line-height, var(--md-sys-typescale-body-large-line-height, 1.5rem));font-weight:var(--md-menu-item-label-text-weight, var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400)));min-height:var(--md-menu-item-one-line-container-height, 56px);padding-top:var(--md-menu-item-top-space, 12px);padding-bottom:var(--md-menu-item-bottom-space, 12px);padding-inline-start:var(--md-menu-item-leading-space, 16px);padding-inline-end:var(--md-menu-item-trailing-space, 16px)}md-item[multiline]{min-height:var(--md-menu-item-two-line-container-height, 72px)}[slot=supporting-text]{color:var(--md-menu-item-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-menu-item-supporting-text-font, var(--md-sys-typescale-body-medium-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-menu-item-supporting-text-size, var(--md-sys-typescale-body-medium-size, 0.875rem));line-height:var(--md-menu-item-supporting-text-line-height, var(--md-sys-typescale-body-medium-line-height, 1.25rem));font-weight:var(--md-menu-item-supporting-text-weight, var(--md-sys-typescale-body-medium-weight, var(--md-ref-typeface-weight-regular, 400)))}[slot=trailing-supporting-text]{color:var(--md-menu-item-trailing-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-menu-item-trailing-supporting-text-font, var(--md-sys-typescale-label-small-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-menu-item-trailing-supporting-text-size, var(--md-sys-typescale-label-small-size, 0.6875rem));line-height:var(--md-menu-item-trailing-supporting-text-line-height, var(--md-sys-typescale-label-small-line-height, 1rem));font-weight:var(--md-menu-item-trailing-supporting-text-weight, var(--md-sys-typescale-label-small-weight, var(--md-ref-typeface-weight-medium, 500)))}:is([slot=start],[slot=end])::slotted(*){fill:currentColor}[slot=start]{color:var(--md-menu-item-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f))}[slot=end]{color:var(--md-menu-item-trailing-icon-color, var(--md-sys-color-on-surface-variant, #49454f))}.list-item.selected{background-color:var(--md-menu-item-selected-container-color, var(--md-sys-color-secondary-container, #e8def8))}.selected:not(.disabled) ::slotted(*){color:var(--md-menu-item-selected-label-text-color, var(--md-sys-color-on-secondary-container, #1d192b))}@media(forced-colors: active){:host([disabled]),:host([disabled]) slot{color:GrayText;opacity:1}.list-item{position:relative}.list-item.selected::before{content:\"\";position:absolute;inset:0;box-sizing:border-box;border-radius:inherit;pointer-events:none;border:3px double CanvasText}}/*# sourceMappingURL=menu-item-styles.css.map */\n`;\n "]}
|
|
1
|
+
{"version":3,"file":"menu-item-styles.css.js","sourceRoot":"","sources":["menu-item-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{display:flex;--md-ripple-hover-color: var(--md-menu-item-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-hover-opacity: var(--md-menu-item-hover-state-layer-opacity, 0.08);--md-ripple-pressed-color: var(--md-menu-item-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-pressed-opacity: var(--md-menu-item-pressed-state-layer-opacity, 0.12)}:host([disabled]){opacity:var(--md-menu-item-disabled-opacity, 0.3);pointer-events:none}md-focus-ring{z-index:1;--md-focus-ring-shape: 8px}a,button,li{background:none;border:none;padding:0;margin:0;text-align:unset;text-decoration:none}.list-item{border-radius:inherit;display:flex;flex:1;max-width:inherit;min-width:inherit;outline:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.list-item:not(.disabled){cursor:pointer}[slot=container]{pointer-events:none}md-ripple{border-radius:inherit}md-item{border-radius:inherit;flex:1;color:var(--md-menu-item-label-text-color, var(--md-sys-color-on-surface, #1d1b20));font-family:var(--md-menu-item-label-text-font, var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-menu-item-label-text-size, var(--md-sys-typescale-body-large-size, 1rem));line-height:var(--md-menu-item-label-text-line-height, var(--md-sys-typescale-body-large-line-height, 1.5rem));font-weight:var(--md-menu-item-label-text-weight, var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400)));min-height:var(--md-menu-item-one-line-container-height, 56px);padding-top:var(--md-menu-item-top-space, 12px);padding-bottom:var(--md-menu-item-bottom-space, 12px);padding-inline-start:var(--md-menu-item-leading-space, 16px);padding-inline-end:var(--md-menu-item-trailing-space, 16px)}md-item[multiline]{min-height:var(--md-menu-item-two-line-container-height, 72px)}[slot=supporting-text]{color:var(--md-menu-item-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-menu-item-supporting-text-font, var(--md-sys-typescale-body-medium-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-menu-item-supporting-text-size, var(--md-sys-typescale-body-medium-size, 0.875rem));line-height:var(--md-menu-item-supporting-text-line-height, var(--md-sys-typescale-body-medium-line-height, 1.25rem));font-weight:var(--md-menu-item-supporting-text-weight, var(--md-sys-typescale-body-medium-weight, var(--md-ref-typeface-weight-regular, 400)))}[slot=trailing-supporting-text]{color:var(--md-menu-item-trailing-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-menu-item-trailing-supporting-text-font, var(--md-sys-typescale-label-small-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-menu-item-trailing-supporting-text-size, var(--md-sys-typescale-label-small-size, 0.6875rem));line-height:var(--md-menu-item-trailing-supporting-text-line-height, var(--md-sys-typescale-label-small-line-height, 1rem));font-weight:var(--md-menu-item-trailing-supporting-text-weight, var(--md-sys-typescale-label-small-weight, var(--md-ref-typeface-weight-medium, 500)))}:is([slot=start],[slot=end])::slotted(*){fill:currentColor}[slot=start]{color:var(--md-menu-item-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f))}[slot=end]{color:var(--md-menu-item-trailing-icon-color, var(--md-sys-color-on-surface-variant, #49454f))}.list-item{background-color:var(--md-menu-item-container-color, transparent)}.list-item.selected{background-color:var(--md-menu-item-selected-container-color, var(--md-sys-color-secondary-container, #e8def8))}.selected:not(.disabled) ::slotted(*){color:var(--md-menu-item-selected-label-text-color, var(--md-sys-color-on-secondary-container, #1d192b))}@media(forced-colors: active){:host([disabled]),:host([disabled]) slot{color:GrayText;opacity:1}.list-item{position:relative}.list-item.selected::before{content:\"\";position:absolute;inset:0;box-sizing:border-box;border-radius:inherit;pointer-events:none;border:3px double CanvasText}}/*# sourceMappingURL=menu-item-styles.css.map */\n`;\n "]}
|
|
@@ -8,7 +8,7 @@ import '../../../labs/item/item.js';
|
|
|
8
8
|
import '../../../ripple/ripple.js';
|
|
9
9
|
import { LitElement, nothing, TemplateResult } from 'lit';
|
|
10
10
|
import { ClassInfo } from 'lit/directives/class-map.js';
|
|
11
|
-
import { MenuItem, MenuItemType } from '../controllers/menuItemController.js';
|
|
11
|
+
import { MenuItem, type MenuItemType } from '../controllers/menuItemController.js';
|
|
12
12
|
/**
|
|
13
13
|
* @fires close-menu {CustomEvent<{initiator: SelectOption, reason: Reason, itemPath: SelectOption[]}>}
|
|
14
14
|
* Closes the encapsulating menu on closable interaction. --bubbles --composed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-item.js","sourceRoot":"","sources":["menu-item.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,iCAAiC,CAAC;AACzC,OAAO,4BAA4B,CAAC;AACpC,OAAO,2BAA2B,CAAC;AAEnC,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAiB,MAAM,KAAK,CAAC;AAC9D,OAAO,EACL,QAAQ,EACR,KAAK,EACL,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,mBAAmB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DACU;AAEjC;IADlB,qBAAqB,CAAC,EAAC,IAAI,EAAE,iBAAiB,EAAC,CAAC;0DACS;AAEvC;IADlB,kBAAkB,CAAC,EAAC,IAAI,EAAE,EAAE,EAAC,CAAC;mDACa;AAW5C;IADC,QAAQ,CAAC,EAAC,SAAS,EAAE,gBAAgB,EAAC,CAAC;+CAGvC","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../../focus/md-focus-ring.js';\nimport '../../../labs/item/item.js';\nimport '../../../ripple/ripple.js';\n\nimport {html, LitElement, nothing, TemplateResult} from 'lit';\nimport {\n property,\n query,\n queryAssignedElements,\n queryAssignedNodes,\n} from 'lit/decorators.js';\nimport {ClassInfo, classMap} from 'lit/directives/class-map.js';\nimport {literal, html as staticHtml, StaticValue} from 'lit/static-html.js';\n\nimport {ARIAMixinStrict} from '../../../internal/aria/aria.js';\nimport {requestUpdateOnAriaChange} from '../../../internal/aria/delegate.js';\nimport {\n MenuItem,\n MenuItemController,\n MenuItemType,\n} from '../controllers/menuItemController.js';\n\n/**\n * @fires close-menu {CustomEvent<{initiator: SelectOption, reason: Reason, itemPath: SelectOption[]}>}\n * Closes the encapsulating menu on closable interaction. --bubbles --composed\n */\nexport class MenuItemEl extends LitElement implements MenuItem {\n static {\n requestUpdateOnAriaChange(MenuItemEl);\n }\n\n /** @nocollapse */\n static override shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n /**\n * Disables the item and makes it non-selectable and non-interactive.\n */\n @property({type: Boolean, reflect: true}) disabled = false;\n\n /**\n * Sets the behavior and role of the menu item, defaults to \"menuitem\".\n */\n @property() type: MenuItemType = 'menuitem';\n\n /**\n * Sets the underlying `HTMLAnchorElement`'s `href` resource attribute.\n */\n @property() href = '';\n\n /**\n * Sets the underlying `HTMLAnchorElement`'s `target` attribute when `href` is\n * set.\n */\n @property() target: '_blank' | '_parent' | '_self' | '_top' | '' = '';\n\n /**\n * Keeps the menu open if clicked or keyboard selected.\n */\n @property({type: Boolean, attribute: 'keep-open'}) keepOpen = false;\n\n /**\n * Sets the item in the selected visual state when a submenu is opened.\n */\n @property({type: Boolean}) selected = false;\n\n @query('.list-item') protected readonly listItemRoot!: HTMLElement | null;\n\n @queryAssignedElements({slot: 'headline'})\n protected readonly headlineElements!: HTMLElement[];\n @queryAssignedElements({slot: 'supporting-text'})\n protected readonly supportingTextElements!: HTMLElement[];\n @queryAssignedNodes({slot: ''})\n protected readonly defaultElements!: Node[];\n\n /**\n * The text that is selectable via typeahead. If not set, defaults to the\n * innerText of the item slotted into the `\"headline\"` slot.\n */\n get typeaheadText() {\n return this.menuItemController.typeaheadText;\n }\n\n @property({attribute: 'typeahead-text'})\n set typeaheadText(text: string) {\n this.menuItemController.setTypeaheadText(text);\n }\n\n private readonly menuItemController = new MenuItemController(this, {\n getHeadlineElements: () => {\n return this.headlineElements;\n },\n getSupportingTextElements: () => {\n return this.supportingTextElements;\n },\n getDefaultElements: () => {\n return this.defaultElements;\n },\n getInteractiveElement: () => this.listItemRoot,\n });\n\n protected override render() {\n return this.renderListItem(html`\n <md-item>\n <div slot=\"container\">\n ${this.renderRipple()} ${this.renderFocusRing()}\n </div>\n <slot name=\"start\" slot=\"start\"></slot>\n <slot name=\"end\" slot=\"end\"></slot>\n ${this.renderBody()}\n </md-item>\n `);\n }\n\n /**\n * Renders the root list item.\n *\n * @param content the child content of the list item.\n */\n protected renderListItem(content: unknown) {\n const isAnchor = this.type === 'link';\n let tag: StaticValue;\n switch (this.menuItemController.tagName) {\n case 'a':\n tag = literal`a`;\n break;\n case 'button':\n tag = literal`button`;\n break;\n default:\n case 'li':\n tag = literal`li`;\n break;\n }\n\n // TODO(b/265339866): announce \"button\"/\"link\" inside of a list item. Until\n // then all are \"menuitem\" roles for correct announcement.\n const target = isAnchor && !!this.target ? this.target : nothing;\n return staticHtml`\n <${tag}\n id=\"item\"\n tabindex=${this.disabled && !isAnchor ? -1 : 0}\n role=${this.menuItemController.role}\n aria-label=${(this as ARIAMixinStrict).ariaLabel || nothing}\n aria-selected=${(this as ARIAMixinStrict).ariaSelected || nothing}\n aria-checked=${(this as ARIAMixinStrict).ariaChecked || nothing}\n aria-expanded=${(this as ARIAMixinStrict).ariaExpanded || nothing}\n aria-haspopup=${(this as ARIAMixinStrict).ariaHasPopup || nothing}\n class=\"list-item ${classMap(this.getRenderClasses())}\"\n href=${this.href || nothing}\n target=${target}\n @click=${this.menuItemController.onClick}\n @keydown=${this.menuItemController.onKeydown}\n >${content}</${tag}>\n `;\n }\n\n /**\n * Handles rendering of the ripple element.\n */\n protected renderRipple(): TemplateResult | typeof nothing {\n return html` <md-ripple\n part=\"ripple\"\n for=\"item\"\n ?disabled=${this.disabled}></md-ripple>`;\n }\n\n /**\n * Handles rendering of the focus ring.\n */\n protected renderFocusRing(): TemplateResult | typeof nothing {\n return html` <md-focus-ring\n part=\"focus-ring\"\n for=\"item\"\n inward></md-focus-ring>`;\n }\n\n /**\n * Classes applied to the list item root.\n */\n protected getRenderClasses(): ClassInfo {\n return {\n 'disabled': this.disabled,\n 'selected': this.selected,\n };\n }\n\n /**\n * Handles rendering the headline and supporting text.\n */\n protected renderBody() {\n return html`\n <slot></slot>\n <slot name=\"overline\" slot=\"overline\"></slot>\n <slot name=\"headline\" slot=\"headline\"></slot>\n <slot name=\"supporting-text\" slot=\"supporting-text\"></slot>\n <slot\n name=\"trailing-supporting-text\"\n slot=\"trailing-supporting-text\"></slot>\n `;\n }\n\n override focus() {\n // TODO(b/300334509): needed for some cases where delegatesFocus doesn't\n // work programmatically like in FF and select-option\n this.listItemRoot?.focus();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"menu-item.js","sourceRoot":"","sources":["menu-item.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,iCAAiC,CAAC;AACzC,OAAO,4BAA4B,CAAC;AACpC,OAAO,2BAA2B,CAAC;AAEnC,OAAO,EAAC,IAAI,EAAE,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CAAC;4CAAkB;AAEJ;IAAvC,KAAK,CAAC,YAAY,CAAC;gDAAsD;AAGvD;IADlB,qBAAqB,CAAC,EAAC,IAAI,EAAE,UAAU,EAAC,CAAC;oDACU;AAEjC;IADlB,qBAAqB,CAAC,EAAC,IAAI,EAAE,iBAAiB,EAAC,CAAC;0DACS;AAEvC;IADlB,kBAAkB,CAAC,EAAC,IAAI,EAAE,EAAE,EAAC,CAAC;mDACa;AAW5C;IADC,QAAQ,CAAC,EAAC,SAAS,EAAE,gBAAgB,EAAC,CAAC;+CAGvC","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '../../../focus/md-focus-ring.js';\nimport '../../../labs/item/item.js';\nimport '../../../ripple/ripple.js';\n\nimport {html, LitElement, nothing, TemplateResult} from 'lit';\nimport {\n property,\n query,\n queryAssignedElements,\n queryAssignedNodes,\n} from 'lit/decorators.js';\nimport {ClassInfo, classMap} from 'lit/directives/class-map.js';\nimport {literal, html as staticHtml, StaticValue} from 'lit/static-html.js';\n\nimport {ARIAMixinStrict} from '../../../internal/aria/aria.js';\nimport {requestUpdateOnAriaChange} from '../../../internal/aria/delegate.js';\nimport {\n MenuItem,\n MenuItemController,\n type MenuItemType,\n} from '../controllers/menuItemController.js';\n\n/**\n * @fires close-menu {CustomEvent<{initiator: SelectOption, reason: Reason, itemPath: SelectOption[]}>}\n * Closes the encapsulating menu on closable interaction. --bubbles --composed\n */\nexport class MenuItemEl extends LitElement implements MenuItem {\n static {\n requestUpdateOnAriaChange(MenuItemEl);\n }\n\n /** @nocollapse */\n static override shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n /**\n * Disables the item and makes it non-selectable and non-interactive.\n */\n @property({type: Boolean, reflect: true}) disabled = false;\n\n /**\n * Sets the behavior and role of the menu item, defaults to \"menuitem\".\n */\n @property() type: MenuItemType = 'menuitem';\n\n /**\n * Sets the underlying `HTMLAnchorElement`'s `href` resource attribute.\n */\n @property() href = '';\n\n /**\n * Sets the underlying `HTMLAnchorElement`'s `target` attribute when `href` is\n * set.\n */\n @property() target: '_blank' | '_parent' | '_self' | '_top' | '' = '';\n\n /**\n * Keeps the menu open if clicked or keyboard selected.\n */\n @property({type: Boolean, attribute: 'keep-open'}) keepOpen = false;\n\n /**\n * Sets the item in the selected visual state when a submenu is opened.\n */\n @property({type: Boolean}) selected = false;\n\n @query('.list-item') protected readonly listItemRoot!: HTMLElement | null;\n\n @queryAssignedElements({slot: 'headline'})\n protected readonly headlineElements!: HTMLElement[];\n @queryAssignedElements({slot: 'supporting-text'})\n protected readonly supportingTextElements!: HTMLElement[];\n @queryAssignedNodes({slot: ''})\n protected readonly defaultElements!: Node[];\n\n /**\n * The text that is selectable via typeahead. If not set, defaults to the\n * innerText of the item slotted into the `\"headline\"` slot.\n */\n get typeaheadText() {\n return this.menuItemController.typeaheadText;\n }\n\n @property({attribute: 'typeahead-text'})\n set typeaheadText(text: string) {\n this.menuItemController.setTypeaheadText(text);\n }\n\n private readonly menuItemController = new MenuItemController(this, {\n getHeadlineElements: () => {\n return this.headlineElements;\n },\n getSupportingTextElements: () => {\n return this.supportingTextElements;\n },\n getDefaultElements: () => {\n return this.defaultElements;\n },\n getInteractiveElement: () => this.listItemRoot,\n });\n\n protected override render() {\n return this.renderListItem(html`\n <md-item>\n <div slot=\"container\">\n ${this.renderRipple()} ${this.renderFocusRing()}\n </div>\n <slot name=\"start\" slot=\"start\"></slot>\n <slot name=\"end\" slot=\"end\"></slot>\n ${this.renderBody()}\n </md-item>\n `);\n }\n\n /**\n * Renders the root list item.\n *\n * @param content the child content of the list item.\n */\n protected renderListItem(content: unknown) {\n const isAnchor = this.type === 'link';\n let tag: StaticValue;\n switch (this.menuItemController.tagName) {\n case 'a':\n tag = literal`a`;\n break;\n case 'button':\n tag = literal`button`;\n break;\n default:\n case 'li':\n tag = literal`li`;\n break;\n }\n\n // TODO(b/265339866): announce \"button\"/\"link\" inside of a list item. Until\n // then all are \"menuitem\" roles for correct announcement.\n const target = isAnchor && !!this.target ? this.target : nothing;\n return staticHtml`\n <${tag}\n id=\"item\"\n tabindex=${this.disabled && !isAnchor ? -1 : 0}\n role=${this.menuItemController.role}\n aria-label=${(this as ARIAMixinStrict).ariaLabel || nothing}\n aria-selected=${(this as ARIAMixinStrict).ariaSelected || nothing}\n aria-checked=${(this as ARIAMixinStrict).ariaChecked || nothing}\n aria-expanded=${(this as ARIAMixinStrict).ariaExpanded || nothing}\n aria-haspopup=${(this as ARIAMixinStrict).ariaHasPopup || nothing}\n class=\"list-item ${classMap(this.getRenderClasses())}\"\n href=${this.href || nothing}\n target=${target}\n @click=${this.menuItemController.onClick}\n @keydown=${this.menuItemController.onKeydown}\n >${content}</${tag}>\n `;\n }\n\n /**\n * Handles rendering of the ripple element.\n */\n protected renderRipple(): TemplateResult | typeof nothing {\n return html` <md-ripple\n part=\"ripple\"\n for=\"item\"\n ?disabled=${this.disabled}></md-ripple>`;\n }\n\n /**\n * Handles rendering of the focus ring.\n */\n protected renderFocusRing(): TemplateResult | typeof nothing {\n return html` <md-focus-ring\n part=\"focus-ring\"\n for=\"item\"\n inward></md-focus-ring>`;\n }\n\n /**\n * Classes applied to the list item root.\n */\n protected getRenderClasses(): ClassInfo {\n return {\n 'disabled': this.disabled,\n 'selected': this.selected,\n };\n }\n\n /**\n * Handles rendering the headline and supporting text.\n */\n protected renderBody() {\n return html`\n <slot></slot>\n <slot name=\"overline\" slot=\"overline\"></slot>\n <slot name=\"headline\" slot=\"headline\"></slot>\n <slot name=\"supporting-text\" slot=\"supporting-text\"></slot>\n <slot\n name=\"trailing-supporting-text\"\n slot=\"trailing-supporting-text\"></slot>\n `;\n }\n\n override focus() {\n // TODO(b/300334509): needed for some cases where delegatesFocus doesn't\n // work programmatically like in FF and select-option\n this.listItemRoot?.focus();\n }\n}\n"]}
|
package/menu/menu-item.d.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { MenuItemEl } from './internal/menuitem/menu-item.js';
|
|
7
|
-
export { MenuItem } from './internal/controllers/menuItemController.js';
|
|
8
|
-
export { CloseMenuEvent } from './internal/controllers/shared.js';
|
|
7
|
+
export { type MenuItem } from './internal/controllers/menuItemController.js';
|
|
8
|
+
export { type CloseMenuEvent } from './internal/controllers/shared.js';
|
|
9
9
|
declare global {
|
|
10
10
|
interface HTMLElementTagNameMap {
|
|
11
11
|
'md-menu-item': MdMenuItem;
|
package/menu/menu-item.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-item.js","sourceRoot":"","sources":["menu-item.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAC,UAAU,EAAC,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAC,MAAM,EAAC,MAAM,6CAA6C,CAAC;AAWnE;;;;;;;;;;;;;;GAcG;AAEI,WAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;;AACxB,iBAAM,GAAG,CAAC,MAAM,CAAC,AAAX,CAAY;AADvB,UAAU;IADtB,aAAa,CAAC,cAAc,CAAC;GACjB,UAAU,CAEtB","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {customElement} from 'lit/decorators.js';\n\nimport {MenuItemEl} from './internal/menuitem/menu-item.js';\nimport {styles} from './internal/menuitem/menu-item-styles.css.js';\n\nexport {MenuItem} from './internal/controllers/menuItemController.js';\nexport {CloseMenuEvent} from './internal/controllers/shared.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'md-menu-item': MdMenuItem;\n }\n}\n\n/**\n * @summary Menus display a list of choices on a temporary surface.\n *\n * @description\n * Menu items are the selectable choices within the menu. Menu items must\n * implement the `MenuItem` interface and also have the `md-menu-item`\n * attribute. Additionally menu items are list items so they must also have the\n * `md-list-item` attribute.\n *\n * Menu items can control a menu by selectively firing the `close-menu` and\n * `deselect-items` events.\n *\n * @final\n * @suppress {visibility}\n */\n@customElement('md-menu-item')\nexport class MdMenuItem extends MenuItemEl {\n static override styles = [styles];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"menu-item.js","sourceRoot":"","sources":["menu-item.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAC,UAAU,EAAC,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAC,MAAM,EAAC,MAAM,6CAA6C,CAAC;AAWnE;;;;;;;;;;;;;;GAcG;AAEI,WAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;;AACxB,iBAAM,GAAG,CAAC,MAAM,CAAC,AAAX,CAAY;AADvB,UAAU;IADtB,aAAa,CAAC,cAAc,CAAC;GACjB,UAAU,CAEtB","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {customElement} from 'lit/decorators.js';\n\nimport {MenuItemEl} from './internal/menuitem/menu-item.js';\nimport {styles} from './internal/menuitem/menu-item-styles.css.js';\n\nexport {type MenuItem} from './internal/controllers/menuItemController.js';\nexport {type CloseMenuEvent} from './internal/controllers/shared.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'md-menu-item': MdMenuItem;\n }\n}\n\n/**\n * @summary Menus display a list of choices on a temporary surface.\n *\n * @description\n * Menu items are the selectable choices within the menu. Menu items must\n * implement the `MenuItem` interface and also have the `md-menu-item`\n * attribute. Additionally menu items are list items so they must also have the\n * `md-list-item` attribute.\n *\n * Menu items can control a menu by selectively firing the `close-menu` and\n * `deselect-items` events.\n *\n * @final\n * @suppress {visibility}\n */\n@customElement('md-menu-item')\nexport class MdMenuItem extends MenuItemEl {\n static override styles = [styles];\n}\n"]}
|
package/menu/menu.d.ts
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { Menu } from './internal/menu.js';
|
|
7
|
-
export { ListItem } from '../list/internal/list-navigation-helpers.js';
|
|
8
|
-
export { MenuItem } from './internal/controllers/menuItemController.js';
|
|
9
|
-
export { CloseMenuEvent, FocusState, Menu } from './internal/controllers/shared.js';
|
|
7
|
+
export { type ListItem } from '../list/internal/list-navigation-helpers.js';
|
|
8
|
+
export { type MenuItem } from './internal/controllers/menuItemController.js';
|
|
9
|
+
export { type CloseMenuEvent, FocusState, type Menu } from './internal/controllers/shared.js';
|
|
10
10
|
export { Corner } from './internal/menu.js';
|
|
11
11
|
declare global {
|
|
12
12
|
interface HTMLElementTagNameMap {
|
package/menu/menu.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu.js","sourceRoot":"","sources":["menu.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAC,IAAI,EAAC,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAC,MAAM,EAAC,MAAM,+BAA+B,CAAC;AAIrD,OAAO,
|
|
1
|
+
{"version":3,"file":"menu.js","sourceRoot":"","sources":["menu.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAC,IAAI,EAAC,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAC,MAAM,EAAC,MAAM,+BAA+B,CAAC;AAIrD,OAAO,EAAsB,UAAU,EAAY,MAAM,kCAAkC,CAAC;AAC5F,OAAO,EAAC,MAAM,EAAC,MAAM,oBAAoB,CAAC;AAQ1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEI,WAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,IAAI;;AACd,aAAM,GAAG,CAAC,MAAM,CAAC,AAAX,CAAY;AADvB,MAAM;IADlB,aAAa,CAAC,SAAS,CAAC;GACZ,MAAM,CAElB","sourcesContent":["/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {customElement} from 'lit/decorators.js';\n\nimport {Menu} from './internal/menu.js';\nimport {styles} from './internal/menu-styles.css.js';\n\nexport {type ListItem} from '../list/internal/list-navigation-helpers.js';\nexport {type MenuItem} from './internal/controllers/menuItemController.js';\nexport {type CloseMenuEvent, FocusState, type Menu} from './internal/controllers/shared.js';\nexport {Corner} from './internal/menu.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'md-menu': MdMenu;\n }\n}\n\n/**\n * @summary Menus display a list of choices on a temporary surface.\n *\n * @description\n * Menus appear when users interact with a button, action, or other control.\n *\n * They can be opened from a variety of elements, most commonly icon buttons,\n * buttons, and text fields.\n *\n * md-menu listens for the `close-menu` and `deselect-items` events.\n *\n * - `close-menu` closes the menu when dispatched from a child element.\n * - `deselect-items` deselects all of its immediate menu-item children.\n *\n * @example\n * ```html\n * <div style=\"position:relative;\">\n * <button\n * id=\"anchor\"\n * @click=${() => this.menuRef.value.show()}>\n * Click to open menu\n * </button>\n * <!--\n * `has-overflow` is required when using a submenu which overflows the\n * menu's contents.\n *\n * Additionally, `anchor` ingests an idref which do not pass through shadow\n * roots. You can also set `.anchorElement` to an element reference if\n * necessary.\n * -->\n * <md-menu anchor=\"anchor\" has-overflow ${ref(menuRef)}>\n * <md-menu-item headline=\"This is a headline\"></md-menu-item>\n * <md-sub-menu>\n * <md-menu-item\n * slot=\"item\"\n * headline=\"this is a submenu item\">\n * </md-menu-item>\n * <md-menu slot=\"menu\">\n * <md-menu-item headline=\"This is an item inside a submenu\">\n * </md-menu-item>\n * </md-menu>\n * </md-sub-menu>\n * </md-menu>\n * </div>\n * ```\n *\n * @final\n * @suppress {visibility}\n */\n@customElement('md-menu')\nexport class MdMenu extends Menu {\n static override styles = [styles];\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@material/web",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -43,11 +43,13 @@
|
|
|
43
43
|
"!web-test-runner.config.js",
|
|
44
44
|
"!commitlint.config.js",
|
|
45
45
|
"!**/test/**",
|
|
46
|
-
"!**/testing/**",
|
|
47
46
|
"!**/*_test.*",
|
|
48
47
|
"!.wireit/**",
|
|
49
48
|
"!catalog",
|
|
50
|
-
"!scripts/"
|
|
49
|
+
"!scripts/",
|
|
50
|
+
"!**/testing/**",
|
|
51
|
+
"testing/harness.{js,js.map,d.ts}",
|
|
52
|
+
"testing/transform-pseudo-classes.{js,js.map,d.ts}"
|
|
51
53
|
],
|
|
52
54
|
"workspaces": [
|
|
53
55
|
"catalog"
|
|
@@ -32,31 +32,30 @@ $_md-sys-motion: tokens.md-sys-motion-values();
|
|
|
32
32
|
|
|
33
33
|
@mixin styles() {
|
|
34
34
|
$tokens: tokens.md-comp-radio-values();
|
|
35
|
+
@each $token, $value in $tokens {
|
|
36
|
+
$tokens: map.set($tokens, $token, var(--md-radio-#{$token}, #{$value}));
|
|
37
|
+
}
|
|
35
38
|
|
|
36
39
|
@layer {
|
|
37
40
|
:host {
|
|
38
|
-
@each $token, $value in $tokens {
|
|
39
|
-
--_#{$token}: var(--md-radio-#{$token}, #{$value});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@include ripple.theme(
|
|
43
|
-
(
|
|
44
|
-
hover-color: var(--_hover-state-layer-color),
|
|
45
|
-
hover-opacity: var(--_hover-state-layer-opacity),
|
|
46
|
-
pressed-color: var(--_pressed-state-layer-color),
|
|
47
|
-
pressed-opacity: var(--_pressed-state-layer-opacity),
|
|
48
|
-
)
|
|
49
|
-
);
|
|
50
|
-
|
|
51
41
|
display: inline-flex;
|
|
52
|
-
height:
|
|
42
|
+
height: map.get($tokens, 'icon-size');
|
|
53
43
|
outline: none;
|
|
54
44
|
position: relative;
|
|
55
45
|
vertical-align: top; // Fix extra space when placed inside display: block
|
|
56
|
-
width:
|
|
46
|
+
width: map.get($tokens, 'icon-size');
|
|
57
47
|
// Remove highlight color for mobile Safari
|
|
58
48
|
-webkit-tap-highlight-color: transparent;
|
|
59
49
|
cursor: pointer;
|
|
50
|
+
|
|
51
|
+
@include ripple.theme(
|
|
52
|
+
(
|
|
53
|
+
hover-color: map.get($tokens, 'hover-state-layer-color'),
|
|
54
|
+
hover-opacity: map.get($tokens, 'hover-state-layer-opacity'),
|
|
55
|
+
pressed-color: map.get($tokens, 'pressed-state-layer-color'),
|
|
56
|
+
pressed-opacity: map.get($tokens, 'pressed-state-layer-opacity'),
|
|
57
|
+
)
|
|
58
|
+
);
|
|
60
59
|
}
|
|
61
60
|
|
|
62
61
|
:host([disabled]) {
|
|
@@ -64,7 +63,7 @@ $_md-sys-motion: tokens.md-sys-motion-values();
|
|
|
64
63
|
}
|
|
65
64
|
|
|
66
65
|
:host([touch-target='wrapper']) {
|
|
67
|
-
margin: max(0px, ((48px -
|
|
66
|
+
margin: max(0px, ((48px - map.get($tokens, 'icon-size')) / 2));
|
|
68
67
|
}
|
|
69
68
|
|
|
70
69
|
.container {
|
|
@@ -84,10 +83,11 @@ $_md-sys-motion: tokens.md-sys-motion-values();
|
|
|
84
83
|
.checked {
|
|
85
84
|
@include ripple.theme(
|
|
86
85
|
(
|
|
87
|
-
hover-color:
|
|
88
|
-
hover-opacity:
|
|
89
|
-
pressed-color:
|
|
90
|
-
pressed-opacity:
|
|
86
|
+
hover-color: map.get($tokens, 'selected-hover-state-layer-color'),
|
|
87
|
+
hover-opacity: map.get($tokens, 'selected-hover-state-layer-opacity'),
|
|
88
|
+
pressed-color: map.get($tokens, 'selected-pressed-state-layer-color'),
|
|
89
|
+
pressed-opacity:
|
|
90
|
+
map.get($tokens, 'selected-pressed-state-layer-opacity'),
|
|
91
91
|
)
|
|
92
92
|
);
|
|
93
93
|
}
|
|
@@ -109,13 +109,13 @@ $_md-sys-motion: tokens.md-sys-motion-values();
|
|
|
109
109
|
|
|
110
110
|
md-ripple {
|
|
111
111
|
border-radius: 50%;
|
|
112
|
-
height:
|
|
112
|
+
height: map.get($tokens, 'state-layer-size');
|
|
113
113
|
inset: unset;
|
|
114
|
-
width:
|
|
114
|
+
width: map.get($tokens, 'state-layer-size');
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
.icon {
|
|
118
|
-
fill:
|
|
118
|
+
fill: map.get($tokens, 'icon-color');
|
|
119
119
|
inset: 0;
|
|
120
120
|
position: absolute;
|
|
121
121
|
}
|
|
@@ -132,7 +132,7 @@ $_md-sys-motion: tokens.md-sys-motion-values();
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
.checked .icon {
|
|
135
|
-
fill:
|
|
135
|
+
fill: map.get($tokens, 'selected-icon-color');
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
.checked .inner.circle {
|
|
@@ -157,37 +157,37 @@ $_md-sys-motion: tokens.md-sys-motion-values();
|
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
:host(:hover) .icon {
|
|
160
|
-
fill:
|
|
160
|
+
fill: map.get($tokens, 'hover-icon-color');
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
:host(:focus-within) .icon {
|
|
164
|
-
fill:
|
|
164
|
+
fill: map.get($tokens, 'focus-icon-color');
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
:host(:active) .icon {
|
|
168
|
-
fill:
|
|
168
|
+
fill: map.get($tokens, 'pressed-icon-color');
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
:host([disabled]) .icon {
|
|
172
|
-
fill:
|
|
173
|
-
opacity:
|
|
172
|
+
fill: map.get($tokens, 'disabled-unselected-icon-color');
|
|
173
|
+
opacity: map.get($tokens, 'disabled-unselected-icon-opacity');
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
:host(:hover) .checked .icon {
|
|
177
|
-
fill:
|
|
177
|
+
fill: map.get($tokens, 'selected-hover-icon-color');
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
:host(:focus-within) .checked .icon {
|
|
181
|
-
fill:
|
|
181
|
+
fill: map.get($tokens, 'selected-focus-icon-color');
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
:host(:active) .checked .icon {
|
|
185
|
-
fill:
|
|
185
|
+
fill: map.get($tokens, 'selected-pressed-icon-color');
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
:host([disabled]) .checked .icon {
|
|
189
|
-
fill:
|
|
190
|
-
opacity:
|
|
189
|
+
fill: map.get($tokens, 'disabled-selected-icon-color');
|
|
190
|
+
opacity: map.get($tokens, 'disabled-selected-icon-opacity');
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
|
|
@@ -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 `@layer{:host{
|
|
7
|
+
export const styles = css `@layer{:host{display:inline-flex;height:var(--md-radio-icon-size, 20px);outline:none;position:relative;vertical-align:top;width:var(--md-radio-icon-size, 20px);-webkit-tap-highlight-color:rgba(0,0,0,0);cursor:pointer;--md-ripple-hover-color: var(--md-radio-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-hover-opacity: var(--md-radio-hover-state-layer-opacity, 0.08);--md-ripple-pressed-color: var(--md-radio-pressed-state-layer-color, var(--md-sys-color-primary, #6750a4));--md-ripple-pressed-opacity: var(--md-radio-pressed-state-layer-opacity, 0.12)}:host([disabled]){cursor:default}:host([touch-target=wrapper]){margin:max(0px,(48px - var(--md-radio-icon-size, 20px))/2)}.container{display:flex;height:100%;place-content:center;place-items:center;width:100%}md-focus-ring{height:44px;inset:unset;width:44px}.checked{--md-ripple-hover-color: var(--md-radio-selected-hover-state-layer-color, var(--md-sys-color-primary, #6750a4));--md-ripple-hover-opacity: var(--md-radio-selected-hover-state-layer-opacity, 0.08);--md-ripple-pressed-color: var(--md-radio-selected-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-pressed-opacity: var(--md-radio-selected-pressed-state-layer-opacity, 0.12)}input{appearance:none;height:48px;margin:0;position:absolute;width:48px;cursor:inherit}:host([touch-target=none]) input{width:100%;height:100%}md-ripple{border-radius:50%;height:var(--md-radio-state-layer-size, 40px);inset:unset;width:var(--md-radio-state-layer-size, 40px)}.icon{fill:var(--md-radio-icon-color, var(--md-sys-color-on-surface-variant, #49454f));inset:0;position:absolute}.outer.circle{transition:fill 50ms linear}.inner.circle{opacity:0;transform-origin:center;transition:opacity 50ms linear}.checked .icon{fill:var(--md-radio-selected-icon-color, var(--md-sys-color-primary, #6750a4))}.checked .inner.circle{animation:inner-circle-grow 300ms cubic-bezier(0.05, 0.7, 0.1, 1);opacity:1}@keyframes inner-circle-grow{from{transform:scale(0)}to{transform:scale(1)}}:host([disabled]) .circle{animation-duration:0s;transition-duration:0s}:host(:hover) .icon{fill:var(--md-radio-hover-icon-color, var(--md-sys-color-on-surface, #1d1b20))}:host(:focus-within) .icon{fill:var(--md-radio-focus-icon-color, var(--md-sys-color-on-surface, #1d1b20))}:host(:active) .icon{fill:var(--md-radio-pressed-icon-color, var(--md-sys-color-on-surface, #1d1b20))}:host([disabled]) .icon{fill:var(--md-radio-disabled-unselected-icon-color, var(--md-sys-color-on-surface, #1d1b20));opacity:var(--md-radio-disabled-unselected-icon-opacity, 0.38)}:host(:hover) .checked .icon{fill:var(--md-radio-selected-hover-icon-color, var(--md-sys-color-primary, #6750a4))}:host(:focus-within) .checked .icon{fill:var(--md-radio-selected-focus-icon-color, var(--md-sys-color-primary, #6750a4))}:host(:active) .checked .icon{fill:var(--md-radio-selected-pressed-icon-color, var(--md-sys-color-primary, #6750a4))}:host([disabled]) .checked .icon{fill:var(--md-radio-disabled-selected-icon-color, var(--md-sys-color-on-surface, #1d1b20));opacity:var(--md-radio-disabled-selected-icon-opacity, 0.38)}}@layer hcm{@media(forced-colors: active){.icon{fill:CanvasText}:host([disabled]) .icon{fill:GrayText;opacity:1}}}/*# sourceMappingURL=radio-styles.css.map */
|
|
8
8
|
`;
|
|
9
9
|
//# sourceMappingURL=radio-styles.css.js.map
|