@m3e/button 1.0.0-rc.1

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.
Files changed (48) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +193 -0
  3. package/cem.config.mjs +16 -0
  4. package/demo/index.html +105 -0
  5. package/dist/css-custom-data.json +1582 -0
  6. package/dist/custom-elements.json +1753 -0
  7. package/dist/html-custom-data.json +83 -0
  8. package/dist/index.js +1781 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/index.min.js +468 -0
  11. package/dist/index.min.js.map +1 -0
  12. package/dist/src/ButtonElement.d.ts +429 -0
  13. package/dist/src/ButtonElement.d.ts.map +1 -0
  14. package/dist/src/ButtonShape.d.ts +3 -0
  15. package/dist/src/ButtonShape.d.ts.map +1 -0
  16. package/dist/src/ButtonSize.d.ts +3 -0
  17. package/dist/src/ButtonSize.d.ts.map +1 -0
  18. package/dist/src/ButtonVariant.d.ts +3 -0
  19. package/dist/src/ButtonVariant.d.ts.map +1 -0
  20. package/dist/src/index.d.ts +5 -0
  21. package/dist/src/index.d.ts.map +1 -0
  22. package/dist/src/styles/ButtonSizeStyle.d.ts +7 -0
  23. package/dist/src/styles/ButtonSizeStyle.d.ts.map +1 -0
  24. package/dist/src/styles/ButtonSizeToken.d.ts +27 -0
  25. package/dist/src/styles/ButtonSizeToken.d.ts.map +1 -0
  26. package/dist/src/styles/ButtonStyle.d.ts +7 -0
  27. package/dist/src/styles/ButtonStyle.d.ts.map +1 -0
  28. package/dist/src/styles/ButtonVariantStyle.d.ts +7 -0
  29. package/dist/src/styles/ButtonVariantStyle.d.ts.map +1 -0
  30. package/dist/src/styles/ButtonVariantToken.d.ts +75 -0
  31. package/dist/src/styles/ButtonVariantToken.d.ts.map +1 -0
  32. package/dist/src/styles/index.d.ts +4 -0
  33. package/dist/src/styles/index.d.ts.map +1 -0
  34. package/eslint.config.mjs +13 -0
  35. package/package.json +48 -0
  36. package/rollup.config.js +32 -0
  37. package/src/ButtonElement.ts +629 -0
  38. package/src/ButtonShape.ts +2 -0
  39. package/src/ButtonSize.ts +2 -0
  40. package/src/ButtonVariant.ts +2 -0
  41. package/src/index.ts +4 -0
  42. package/src/styles/ButtonSizeStyle.ts +102 -0
  43. package/src/styles/ButtonSizeToken.ts +180 -0
  44. package/src/styles/ButtonStyle.ts +191 -0
  45. package/src/styles/ButtonVariantStyle.ts +170 -0
  46. package/src/styles/ButtonVariantToken.ts +1165 -0
  47. package/src/styles/index.ts +3 -0
  48. package/tsconfig.json +9 -0
package/dist/index.js ADDED
@@ -0,0 +1,1781 @@
1
+ /**
2
+ * @license MIT
3
+ * Copyright (c) 2025 matraic
4
+ * See LICENSE file in the project root for full license text.
5
+ */
6
+ import { unsafeCSS, css, LitElement, nothing, html } from 'lit';
7
+ import { DesignToken, KeyboardClick, LinkButton, FormSubmitter, Focusable, DisabledInteractive, Disabled, AttachInternals, Role, ResizeController, FocusController, PressedController, renderPseudoLink, debounce, hasAssignedNodes } from '@m3e/core';
8
+
9
+ /******************************************************************************
10
+ Copyright (c) Microsoft Corporation.
11
+
12
+ Permission to use, copy, modify, and/or distribute this software for any
13
+ purpose with or without fee is hereby granted.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
16
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
17
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
18
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
19
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
20
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21
+ PERFORMANCE OF THIS SOFTWARE.
22
+ ***************************************************************************** */
23
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
24
+
25
+
26
+ function __decorate(decorators, target, key, desc) {
27
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
28
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
29
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
30
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
31
+ }
32
+
33
+ function __classPrivateFieldGet(receiver, state, kind, f) {
34
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
35
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
36
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
37
+ }
38
+
39
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
40
+ var e = new Error(message);
41
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
42
+ };
43
+
44
+ /**
45
+ * @license
46
+ * Copyright 2017 Google LLC
47
+ * SPDX-License-Identifier: BSD-3-Clause
48
+ */
49
+ const t$1=t=>(e,o)=>{ void 0!==o?o.addInitializer((()=>{customElements.define(t,e);})):customElements.define(t,e);};
50
+
51
+ /**
52
+ * @license
53
+ * Copyright 2019 Google LLC
54
+ * SPDX-License-Identifier: BSD-3-Clause
55
+ */
56
+ const t=globalThis,e$3=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),o$2=new WeakMap;let n$2 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$3&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$2.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$2.set(s,t));}return t}toString(){return this.cssText}};const r$2=t=>new n$2("string"==typeof t?t:t+"",void 0,s),S=(s,o)=>{if(e$3)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$1=e$3?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$2(e)})(t):t;
57
+
58
+ /**
59
+ * @license
60
+ * Copyright 2017 Google LLC
61
+ * SPDX-License-Identifier: BSD-3-Clause
62
+ */const{is:i,defineProperty:e$2,getOwnPropertyDescriptor:h,getOwnPropertyNames:r$1,getOwnPropertySymbols:o$1,getPrototypeOf:n$1}=Object,a=globalThis,c=a.trustedTypes,l=c?c.emptyScript:"",p=a.reactiveElementPolyfillSupport,d=(t,s)=>t,u={toAttribute(t,s){switch(s){case Boolean:t=t?l:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f=(t,s)=>!i(t,s),b={attribute:true,type:String,converter:u,reflect:false,useDefault:false,hasChanged:f};Symbol.metadata??=Symbol("metadata"),a.litPropertyMetadata??=new WeakMap;class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b){if(s.state&&(s.attribute=false),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=true),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e$2(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(d("elementProperties")))return;const t=n$1(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(d("properties"))){const t=this.properties,s=[...r$1(t),...o$1(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$1(s));}else void 0!==s&&i.push(c$1(s));return i}static _$Eu(t,s){const i=s.attribute;return false===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this._$EO?.forEach((t=>t.hostConnected?.()));}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()));}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&true===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u;this._$Em=e;const r=h.fromAttribute(s,t.type);this[e]=r??this._$Ej?.get(e)??r,this._$Em=null;}}requestUpdate(t,s,i){if(void 0!==t){const e=this.constructor,h=this[t];if(i??=e.getPropertyOptions(t),!((i.hasChanged??f)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(e._$Eu(t,i))))return;this.C(t,s,i);} false===this.isUpdatePending&&(this._$ES=this._$EP());}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),true!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),true===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t));}async _$EP(){this.isUpdatePending=true;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t){const{wrapped:t}=i,e=this[s];true!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e);}}let t=false;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$EM();}catch(s){throw t=false,this._$EM(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}_$EM(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return true}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM();}updated(t){}firstUpdated(t){}}y.elementStyles=[],y.shadowRootOptions={mode:"open"},y[d("elementProperties")]=new Map,y[d("finalized")]=new Map,p?.({ReactiveElement:y}),(a.reactiveElementVersions??=[]).push("2.1.1");
63
+
64
+ /**
65
+ * @license
66
+ * Copyright 2017 Google LLC
67
+ * SPDX-License-Identifier: BSD-3-Clause
68
+ */const o={attribute:true,type:String,converter:u,reflect:false,hasChanged:f},r=(t=o,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),"setter"===n&&((t=Object.create(t)).wrapped=true),s.set(r.name,t),"accessor"===n){const{name:o}=r;return {set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t);},init(e){return void 0!==e&&this.C(o,void 0,t,e),e}}}if("setter"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t);}}throw Error("Unsupported decorator location: "+n)};function n(t){return (e,o)=>"object"==typeof o?r(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}
69
+
70
+ /**
71
+ * @license
72
+ * Copyright 2017 Google LLC
73
+ * SPDX-License-Identifier: BSD-3-Clause
74
+ */
75
+ const e$1=(e,t,c)=>(c.configurable=true,c.enumerable=true,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
76
+
77
+ /**
78
+ * @license
79
+ * Copyright 2017 Google LLC
80
+ * SPDX-License-Identifier: BSD-3-Clause
81
+ */function e(e,r){return (n,s,i)=>{const o=t=>t.renderRoot?.querySelector(e)??null;return e$1(n,s,{get(){return o(this)}})}}
82
+
83
+ /**
84
+ * Component design tokens that control the `M3eButtonElement` for all size variants.
85
+ * @internal
86
+ */
87
+ const ButtonSizeToken = {
88
+ "extra-small": {
89
+ containerHeight: unsafeCSS(`calc(var(--m3e-button-extra-small-container-height, 2rem) + ${DesignToken.density.calc(0)})`),
90
+ outlineThickness: unsafeCSS("var(--m3e-button-extra-small-outline-thickness, 1px)"),
91
+ labelTextFontSize: unsafeCSS(`var(--m3e-button-extra-small-label-text-font-size, ${DesignToken.typescale.standard.label.large.fontSize})`),
92
+ labelTextFontWeight: unsafeCSS(`var(--m3e-button-extra-small-label-text-font-weight, ${DesignToken.typescale.standard.label.large.fontWeight})`),
93
+ labelTextLineHeight: unsafeCSS(`var(--m3e-button-extra-small-label-text-line-height, ${DesignToken.typescale.standard.label.large.lineHeight})`),
94
+ labelTextTracking: unsafeCSS(`var(--m3e-button-extra-small-label-text-tracking, ${DesignToken.typescale.standard.label.large.tracking})`),
95
+ iconSize: unsafeCSS("var(--m3e-button-extra-small-icon-size, 1.25rem)"),
96
+ shapeRound: unsafeCSS(`var(--m3e-button-extra-small-shape-round, ${DesignToken.shape.corner.full})`),
97
+ shapeSquare: unsafeCSS(`var(--m3e-button-extra-small-shape-square, ${DesignToken.shape.corner.medium})`),
98
+ selectedShapeRound: unsafeCSS(`var(--m3e-button-extra-small-selected-shape-round, ${DesignToken.shape.corner.medium})`),
99
+ selectedShapeSquare: unsafeCSS(`var(--m3e-button-extra-small-selected-shape-square, ${DesignToken.shape.corner.full})`),
100
+ shapePressedMorph: unsafeCSS(`var(--m3e-button-extra-small-shape-pressed-morph, ${DesignToken.shape.corner.small})`),
101
+ leadingSpace: unsafeCSS("var(--m3e-button-extra-small-leading-space, 0.75rem)"),
102
+ trailingSpace: unsafeCSS("var(--m3e-button-extra-small-trailing-space, 0.75rem)"),
103
+ iconLabelSpace: unsafeCSS("var(--m3e-button-extra-small-icon-label-space, 0.5rem)"),
104
+ },
105
+ small: {
106
+ containerHeight: unsafeCSS(`calc(var(--m3e-button-small-container-height, 2.5rem) + ${DesignToken.density.calc(-1)})`),
107
+ outlineThickness: unsafeCSS("var(--m3e-button-small-outline-thickness, 1px)"),
108
+ labelTextFontSize: unsafeCSS(`var(--m3e-button-small-label-text-font-size, ${DesignToken.typescale.standard.label.large.fontSize})`),
109
+ labelTextFontWeight: unsafeCSS(`var(--m3e-button-small-label-text-font-weight, ${DesignToken.typescale.standard.label.large.fontWeight})`),
110
+ labelTextLineHeight: unsafeCSS(`var(--m3e-button-small-label-text-line-height, ${DesignToken.typescale.standard.label.large.lineHeight})`),
111
+ labelTextTracking: unsafeCSS(`var(--m3e-button-small-label-text-tracking, ${DesignToken.typescale.standard.label.large.tracking})`),
112
+ iconSize: unsafeCSS("var(--m3e-button-small-icon-size, 1.25rem)"),
113
+ shapeRound: unsafeCSS(`var(--m3e-button-small-shape-round, ${DesignToken.shape.corner.full})`),
114
+ shapeSquare: unsafeCSS(`var(--m3e-button-small-shape-square, ${DesignToken.shape.corner.medium})`),
115
+ selectedShapeRound: unsafeCSS(`var(--m3e-button-small-selected-shape-round, ${DesignToken.shape.corner.medium})`),
116
+ selectedShapeSquare: unsafeCSS(`var(--m3e-button-small-selected-shape-square, ${DesignToken.shape.corner.full})`),
117
+ shapePressedMorph: unsafeCSS(`var(--m3e-button-small-shape-pressed-morph, ${DesignToken.shape.corner.small})`),
118
+ leadingSpace: unsafeCSS("var(--m3e-button-small-leading-space, 1rem)"),
119
+ trailingSpace: unsafeCSS("var(--m3e-button-small-trailing-space, 1rem)"),
120
+ iconLabelSpace: unsafeCSS("var(--m3e-button-small-icon-label-space, 0.5rem)"),
121
+ },
122
+ medium: {
123
+ containerHeight: unsafeCSS(`calc(var(--m3e-button-medium-container-height, 3.5rem) + ${DesignToken.density.calc(-2)})`),
124
+ outlineThickness: unsafeCSS("var(--m3e-button-medium-outline-thickness, 1px)"),
125
+ labelTextFontSize: unsafeCSS(`var(--m3e-button-medium-label-text-font-size, ${DesignToken.typescale.standard.body.large.fontSize})`),
126
+ labelTextFontWeight: unsafeCSS(`var(--m3e-button-medium-label-text-font-weight, ${DesignToken.typescale.standard.body.large.fontWeight})`),
127
+ labelTextLineHeight: unsafeCSS(`var(--m3e-button-medium-label-text-line-height, ${DesignToken.typescale.standard.body.large.lineHeight})`),
128
+ labelTextTracking: unsafeCSS(`var(--m3e-button-medium-label-text-tracking, ${DesignToken.typescale.standard.body.large.tracking})`),
129
+ iconSize: unsafeCSS("var(--m3e-button-medium-icon-size, 1.5rem)"),
130
+ shapeRound: unsafeCSS(`var(--m3e-button-medium-shape-round, ${DesignToken.shape.corner.full})`),
131
+ shapeSquare: unsafeCSS(`var(--m3e-button-medium-shape-square, ${DesignToken.shape.corner.large})`),
132
+ selectedShapeRound: unsafeCSS(`var(--m3e-button-medium-selected-shape-round, ${DesignToken.shape.corner.large})`),
133
+ selectedShapeSquare: unsafeCSS(`var(--m3e-button-medium-selected-shape-square, ${DesignToken.shape.corner.full})`),
134
+ shapePressedMorph: unsafeCSS(`var(--m3e-button-medium-shape-pressed-morph, ${DesignToken.shape.corner.medium})`),
135
+ leadingSpace: unsafeCSS("var(--m3e-button-medium-leading-space, 1.5rem)"),
136
+ trailingSpace: unsafeCSS("var(--m3e-button-medium-trailing-space, 1.5rem)"),
137
+ iconLabelSpace: unsafeCSS("var(--m3e-button-medium-icon-label-space, 0.5rem)"),
138
+ },
139
+ large: {
140
+ containerHeight: unsafeCSS(`calc(var(--m3e-button-large-container-height, 6rem) + ${DesignToken.density.calc(-3)})`),
141
+ outlineThickness: unsafeCSS("var(--m3e-button-large-outline-thickness, 0.125rem)"),
142
+ labelTextFontSize: unsafeCSS(`var(--m3e-button-large-label-text-font-size, ${DesignToken.typescale.standard.headline.small.fontSize})`),
143
+ labelTextFontWeight: unsafeCSS(`var(--m3e-button-large-label-text-font-weight, ${DesignToken.typescale.standard.headline.small.fontWeight})`),
144
+ labelTextLineHeight: unsafeCSS(`var(--m3e-button-large-label-text-line-height, ${DesignToken.typescale.standard.headline.small.lineHeight})`),
145
+ labelTextTracking: unsafeCSS(`var(--m3e-button-large-label-text-tracking, ${DesignToken.typescale.standard.headline.small.tracking})`),
146
+ iconSize: unsafeCSS("var(--m3e-button-large-icon-size, 2rem)"),
147
+ shapeRound: unsafeCSS(`var(--m3e-button-large-shape-round, ${DesignToken.shape.corner.full})`),
148
+ shapeSquare: unsafeCSS(`var(--m3e-button-large-shape-square, ${DesignToken.shape.corner.extraLarge})`),
149
+ selectedShapeRound: unsafeCSS(`var(--m3e-button-large-selected-shape-round, ${DesignToken.shape.corner.extraLarge})`),
150
+ selectedShapeSquare: unsafeCSS(`var(--m3e-button-large-selected-shape-square, ${DesignToken.shape.corner.full})`),
151
+ shapePressedMorph: unsafeCSS(`var(--m3e-button-large-shape-pressed-morph, ${DesignToken.shape.corner.large})`),
152
+ leadingSpace: unsafeCSS("var(--m3e-button-large-leading-space, 3rem)"),
153
+ trailingSpace: unsafeCSS("var(--m3e-button-large-trailing-space, 3rem)"),
154
+ iconLabelSpace: unsafeCSS("var(--m3e-button-large-icon-label-space, 0.75rem)"),
155
+ },
156
+ "extra-large": {
157
+ containerHeight: unsafeCSS(`calc(var(--m3e-button-extra-large-container-height, 8.5rem) + ${DesignToken.density.calc(-3)})`),
158
+ outlineThickness: unsafeCSS("var(--m3e-button-extra-large-outline-thickness, 0.1875rem)"),
159
+ labelTextFontSize: unsafeCSS(`var(--m3e-button-extra-large-label-text-font-size, ${DesignToken.typescale.standard.headline.large.fontSize})`),
160
+ labelTextFontWeight: unsafeCSS(`var(--m3e-button-extra-large-label-text-font-weight, ${DesignToken.typescale.standard.headline.large.fontWeight})`),
161
+ labelTextLineHeight: unsafeCSS(`var(--m3e-button-extra-large-label-text-line-height, ${DesignToken.typescale.standard.headline.large.lineHeight})`),
162
+ labelTextTracking: unsafeCSS(`var(--m3e-button-extra-large-label-text-tracking, ${DesignToken.typescale.standard.headline.large.tracking})`),
163
+ iconSize: unsafeCSS("var(--m3e-button-extra-large-icon-size, 2.5rem)"),
164
+ shapeRound: unsafeCSS(`var(--m3e-button-extra-large-shape-round, ${DesignToken.shape.corner.full})`),
165
+ shapeSquare: unsafeCSS(`var(--m3e-button-extra-large-shape-square, ${DesignToken.shape.corner.extraLarge})`),
166
+ selectedShapeRound: unsafeCSS(`var(--m3e-button-extra-large-selected-shape-round, ${DesignToken.shape.corner.extraLarge})`),
167
+ selectedShapeSquare: unsafeCSS(`var(--m3e-button-extra-large-selected-shape-square, ${DesignToken.shape.corner.full})`),
168
+ shapePressedMorph: unsafeCSS(`var(--m3e-button-extra-large-shape-pressed-morph, ${DesignToken.shape.corner.large})`),
169
+ leadingSpace: unsafeCSS("var(--m3e-button-extra-large-leading-space, 4rem)"),
170
+ trailingSpace: unsafeCSS("var(--m3e-button-extra-large-trailing-space, 4rem)"),
171
+ iconLabelSpace: unsafeCSS("var(--m3e-button-extra-large-icon-label-space, 1rem)"),
172
+ },
173
+ };
174
+
175
+ /** @private */
176
+ function buttonStyle(size) {
177
+ return css `
178
+ :host([size="${unsafeCSS(size)}"]) .base {
179
+ height: ${ButtonSizeToken[size].containerHeight};
180
+ }
181
+ :host([size="${unsafeCSS(size)}"]) .wrapper {
182
+ padding-inline-start: ${ButtonSizeToken[size].leadingSpace};
183
+ padding-inline-end: ${ButtonSizeToken[size].trailingSpace};
184
+ column-gap: ${ButtonSizeToken[size].iconLabelSpace};
185
+ }
186
+ :host([size="${unsafeCSS(size)}"].-grouped:not(.-connected).-adjacent-pressed:not(.-pressed)) .wrapper {
187
+ padding-inline-start: calc(
188
+ ${ButtonSizeToken[size].leadingSpace} -
189
+ calc(calc(var(--_adjacent-button-width) * var(--m3e-standard-button-group-width-multiplier, 0.15)) / 4.25)
190
+ );
191
+ padding-inline-end: calc(
192
+ ${ButtonSizeToken[size].trailingSpace} -
193
+ calc(calc(var(--_adjacent-button-width) * var(--m3e-standard-button-group-width-multiplier, 0.15)) / 4.25)
194
+ );
195
+ }
196
+ :host([size="${unsafeCSS(size)}"]) .label {
197
+ font-size: ${ButtonSizeToken[size].labelTextFontSize};
198
+ font-weight: ${ButtonSizeToken[size].labelTextFontWeight};
199
+ line-height: ${ButtonSizeToken[size].labelTextLineHeight};
200
+ letter-spacing: ${ButtonSizeToken[size].labelTextTracking};
201
+ }
202
+ :host([size="${unsafeCSS(size)}"]) .icon {
203
+ font-size: ${ButtonSizeToken[size].iconSize};
204
+ --m3e-icon-size: ${ButtonSizeToken[size].iconSize};
205
+ }
206
+ :host([size="${unsafeCSS(size)}"]) .base {
207
+ outline-offset: calc(0px - ${ButtonSizeToken[size].outlineThickness});
208
+ outline-width: ${ButtonSizeToken[size].outlineThickness};
209
+ }
210
+ :host(:not(.-connected)[size="${unsafeCSS(size)}"][shape="rounded"]) .base {
211
+ border-radius: var(--_button-shape, ${ButtonSizeToken[size].shapeRound});
212
+ }
213
+ :host(:not(.-connected)[size="${unsafeCSS(size)}"][shape="rounded"][toggle][selected]:not(.-pressed)) .base {
214
+ border-radius: ${ButtonSizeToken[size].selectedShapeRound};
215
+ }
216
+ :host(:not(.-connected)[size="${unsafeCSS(size)}"][shape="square"]) .base {
217
+ border-radius: ${ButtonSizeToken[size].shapeSquare};
218
+ }
219
+ :host(:not(.-connected)[size="${unsafeCSS(size)}"][shape="square"][toggle][selected]:not(.-pressed)) .base {
220
+ border-radius: var(--_button-shape, ${ButtonSizeToken[size].selectedShapeSquare});
221
+ }
222
+ :host(:not(.-connected)[size="${unsafeCSS(size)}"].-pressed) .base {
223
+ border-radius: ${ButtonSizeToken[size].shapePressedMorph};
224
+ }
225
+ :host(.-connected[size="${unsafeCSS(size)}"][shape="rounded"]) .base {
226
+ border-start-start-radius: var(
227
+ --_button-rounded-start-shape,
228
+ var(--_button-shape, ${ButtonSizeToken[size].shapeRound})
229
+ );
230
+ border-end-start-radius: var(
231
+ --_button-rounded-start-shape,
232
+ var(--_button-shape, ${ButtonSizeToken[size].shapeRound})
233
+ );
234
+ border-start-end-radius: var(
235
+ --_button-rounded-end-shape,
236
+ var(--_button-shape, ${ButtonSizeToken[size].shapeRound})
237
+ );
238
+ border-end-end-radius: var(
239
+ --_button-rounded-end-shape,
240
+ var(--_button-shape, ${ButtonSizeToken[size].shapeRound})
241
+ );
242
+ }
243
+ :host(.-connected[size="${unsafeCSS(size)}"][shape="square"]) .base {
244
+ border-start-start-radius: var(--_button-square-start-shape, ${ButtonSizeToken[size].shapeSquare});
245
+ border-end-start-radius: var(--_button-square-start-shape, ${ButtonSizeToken[size].shapeSquare});
246
+ border-start-end-radius: var(--_button-square-end-shape, ${ButtonSizeToken[size].shapeSquare});
247
+ border-end-end-radius: var(--_button-square-end-shape, ${ButtonSizeToken[size].shapeSquare});
248
+ }
249
+ :host(.-connected[size="${unsafeCSS(size)}"][shape="square"][toggle][selected]:not(.-pressed)) .base {
250
+ border-radius: var(--_button-shape, ${ButtonSizeToken[size].selectedShapeSquare});
251
+ }
252
+ :host(.-connected[size="${unsafeCSS(size)}"].-pressed) .base {
253
+ border-start-start-radius: var(--_button-start-shape-pressed-morph, ${ButtonSizeToken[size].shapePressedMorph});
254
+ border-end-start-radius: var(--_button-start-shape-pressed-morph, ${ButtonSizeToken[size].shapePressedMorph});
255
+ border-start-end-radius: var(--_button-end-shape-pressed-morph, ${ButtonSizeToken[size].shapePressedMorph});
256
+ border-end-end-radius: var(--_button-end-shape-pressed-morph, ${ButtonSizeToken[size].shapePressedMorph});
257
+ }
258
+ `;
259
+ }
260
+ /**
261
+ * Size variant styles for `M3eButtonElement`.
262
+ * @internal
263
+ */
264
+ const ButtonSizeStyle = [
265
+ buttonStyle("extra-small"),
266
+ buttonStyle("small"),
267
+ buttonStyle("medium"),
268
+ buttonStyle("large"),
269
+ buttonStyle("extra-large"),
270
+ ];
271
+
272
+ /**
273
+ * Baseline styles for `M3eButtonElement`.
274
+ * @internal
275
+ */
276
+ const ButtonStyle = css `
277
+ :host {
278
+ display: inline-block;
279
+ outline: none;
280
+ user-select: none;
281
+ }
282
+ .base {
283
+ box-sizing: border-box;
284
+ vertical-align: middle;
285
+ display: inline-flex;
286
+ align-items: center;
287
+ justify-content: center;
288
+ position: relative;
289
+ width: 100%;
290
+ transition: ${unsafeCSS(`background-color ${DesignToken.motion.duration.short4} ${DesignToken.motion.easing.standard}`)};
291
+ }
292
+ .touch {
293
+ position: absolute;
294
+ height: 3rem;
295
+ left: 0;
296
+ right: 0;
297
+ }
298
+ :host(.-pressed) .base,
299
+ :host(.-resting) .base {
300
+ transition: ${unsafeCSS(`background-color ${DesignToken.motion.duration.short4} ${DesignToken.motion.easing.standard},
301
+ border-radius ${DesignToken.motion.spring.fastEffects}`)};
302
+ }
303
+ .wrapper {
304
+ width: 100%;
305
+ overflow: hidden;
306
+ display: inline-flex;
307
+ align-items: center;
308
+ }
309
+ .label {
310
+ justify-self: center;
311
+ flex: 1 1 auto;
312
+ text-align: center;
313
+ white-space: nowrap;
314
+ overflow: hidden;
315
+ text-overflow: ellipsis;
316
+ transition: ${unsafeCSS(`color ${DesignToken.motion.duration.short4} ${DesignToken.motion.easing.standard}`)};
317
+ }
318
+ .icon {
319
+ transition: ${unsafeCSS(`color ${DesignToken.motion.duration.short4} ${DesignToken.motion.easing.standard}`)};
320
+ }
321
+ :host(:not(:disabled):not([disabled-interactive])) {
322
+ cursor: pointer;
323
+ }
324
+ :host([disabled-interactive]) {
325
+ cursor: not-allowed;
326
+ }
327
+ ::slotted([slot="icon"]),
328
+ ::slotted([slot="selected-icon"]),
329
+ ::slotted([slot="trailing-icon"]) {
330
+ font-size: inherit !important;
331
+ flex: none;
332
+ }
333
+ ::slotted(svg[slot="icon"]),
334
+ ::slotted(svg[slot="selected-icon"]),
335
+ ::slotted(svg[slot="trailing-icon"]) {
336
+ width: 1em;
337
+ height: 1em;
338
+ }
339
+ :host([toggle]:not([selected])) .base.with-selected-icon slot[name="selected-icon"],
340
+ :host([toggle][selected]) .base.with-selected-icon slot[name="icon"] {
341
+ display: none;
342
+ }
343
+ a {
344
+ all: unset;
345
+ display: block;
346
+ position: absolute;
347
+ top: 0px;
348
+ left: 0px;
349
+ right: 0px;
350
+ bottom: 0px;
351
+ z-index: 1;
352
+ }
353
+ :host(.-grouped.-connected) {
354
+ flex: 1 1 auto;
355
+ }
356
+ :host(.-grouped:not(.-connected)) {
357
+ transition: ${unsafeCSS(`padding-inline ${DesignToken.motion.spring.fastEffects}`)};
358
+ }
359
+ :host(.-grouped:not(.-connected):not(.-adjacent-pressed):not(.-pressed)) {
360
+ flex-shrink: 0;
361
+ flex-grow: 0;
362
+ }
363
+ :host(.-grouped:not(.-connected).-adjacent-pressed:not(.-pressed)) {
364
+ flex-shrink: 1;
365
+ min-width: 0;
366
+ }
367
+ :host(.-grouped:not(.-connected).-adjacent-pressed:not(.-pressed)) .label {
368
+ text-overflow: clip;
369
+ }
370
+ :host(.-grouped:not(.-connected).-pressed:not([disabled-interactive]):not(:disabled)) {
371
+ flex-shrink: 0;
372
+ flex-basis: calc(
373
+ var(--_button-width) + calc(var(--_button-width) * var(--m3e-standard-button-group-width-multiplier, 0.15))
374
+ );
375
+ }
376
+ @media (forced-colors: active) {
377
+ .base,
378
+ .label,
379
+ .icon {
380
+ transition: none;
381
+ }
382
+ :host(.-pressed) .base,
383
+ :host(.-resting) .base {
384
+ transition: ${unsafeCSS(`border-radius ${DesignToken.motion.spring.fastEffects}`)};
385
+ }
386
+ :host([variant]:not(:disabled):not([disabled-interactive]):not([toggle])) .base {
387
+ background-color: ButtonFace;
388
+ outline-color: ButtonText;
389
+ }
390
+ :host([variant]:not(:disabled):not([disabled-interactive]):not([toggle])) .label,
391
+ :host([variant]:not(:disabled):not([disabled-interactive]):not([toggle])) .icon {
392
+ color: ButtonText;
393
+ }
394
+ :host([variant]:not(:disabled):not([disabled-interactive])[toggle]:not([selected])) .base {
395
+ background-color: ButtonFace;
396
+ outline-color: ButtonText;
397
+ }
398
+ :host([variant]:not(:disabled):not([disabled-interactive])[toggle]:not([selected])) .label,
399
+ :host([variant]:not(:disabled):not([disabled-interactive])[toggle]:not([selected])) .icon {
400
+ color: ButtonText;
401
+ }
402
+ :host([variant]:not(:disabled):not([disabled-interactive])[toggle][selected]) .base {
403
+ background-color: ButtonText;
404
+ outline: none;
405
+ }
406
+ :host([variant]:not(:disabled):not([disabled-interactive])[toggle][selected]) .label,
407
+ :host([variant]:not(:disabled):not([disabled-interactive])[toggle][selected]) .icon {
408
+ forced-color-adjust: none;
409
+ color: ButtonFace;
410
+ background-color: ButtonText;
411
+ }
412
+ :host([variant]:disabled) .base,
413
+ :host([variant][disabled-interactive]) .base {
414
+ outline-color: GrayText;
415
+ background-color: unset;
416
+ }
417
+ :host([variant]:disabled) .label,
418
+ :host([variant][disabled-interactive]) .label,
419
+ :host([variant]:disabled) .icon,
420
+ :host([variant][disabled-interactive]) .icon {
421
+ color: GrayText;
422
+ }
423
+ .base {
424
+ outline-style: solid;
425
+ }
426
+ :host([size="extra-small"]) .base {
427
+ outline-offset: calc(0px - var(--m3e-button-extra-small-outline-thickness, 1px));
428
+ outline-width: var(--m3e-button-extra-small-outline-thickness, 1px);
429
+ }
430
+ :host([size="small"]) .base {
431
+ outline-offset: calc(0px - var(--m3e-button-small-outline-thickness, 1px));
432
+ outline-width: var(--m3e-button-small-outline-thickness, 1px);
433
+ }
434
+ :host([size="medium"]) .base {
435
+ outline-offset: calc(0px - var(--m3e-button-medium-outline-thickness, 1px));
436
+ outline-width: var(--m3e-button-medium-outline-thickness, 1px);
437
+ }
438
+ :host([size="large"]) .base {
439
+ outline-offset: calc(0px - var(--m3e-button-large-outline-thickness, 0.125rem));
440
+ outline-width: var(--m3e-button-large-outline-thickness, 0.125rem);
441
+ }
442
+ :host([size="extra-large"]) .base {
443
+ outline-offset: calc(0px - var(--m3e-button-extra-large-outline-thickness, 0.1875rem));
444
+ outline-width: var(--m3e-button-extra-large-outline-thickness, 0.1875rem);
445
+ }
446
+ }
447
+ @media (prefers-reduced-motion) {
448
+ :host(.-pressed) .base,
449
+ :host(.-resting) .base,
450
+ .base,
451
+ .label,
452
+ .icon {
453
+ transition: none;
454
+ }
455
+ }
456
+ `;
457
+
458
+ /**
459
+ * Component design tokens that control the appearance variants of `M3eButtonElement`.
460
+ * @internal
461
+ */
462
+ const ButtonVariantToken = {
463
+ /** Design tokens that control the `elevated` variant. */
464
+ elevated: {
465
+ /** Default label color. */
466
+ labelTextColor: unsafeCSS(`var(--m3e-elevated-button-label-text-color, ${DesignToken.color.primary})`),
467
+ /** Default icon color. */
468
+ iconColor: unsafeCSS(`var(--m3e-elevated-button-icon-color, ${DesignToken.color.primary})`),
469
+ /** Default container background color. */
470
+ containerColor: unsafeCSS(`var(--m3e-elevated-button-container-color, ${DesignToken.color.surfaceContainerLow})`),
471
+ /** Resting elevation. */
472
+ containerElevation: unsafeCSS(`var(--m3e-elevated-button-container-elevation, ${DesignToken.elevation.level1})`),
473
+ /** Unselected label color. */
474
+ unselectedLabelTextColor: unsafeCSS(`var(--m3e-elevated-button-unselected-label-text-color, ${DesignToken.color.primary})`),
475
+ /** Unselected icon color. */
476
+ unselectedIconColor: unsafeCSS(`var(--m3e-elevated-button-unselected-icon-color, ${DesignToken.color.primary})`),
477
+ /** Unselected container background color. */
478
+ unselectedContainerColor: unsafeCSS(`var(--m3e-elevated-button-unselected-container-color, ${DesignToken.color.surfaceContainerLow})`),
479
+ /** Selected label color. */
480
+ selectedLabelTextColor: unsafeCSS(`var(--m3e-elevated-button-selected-label-text-color, ${DesignToken.color.onPrimary})`),
481
+ /** Selected icon color. */
482
+ selectedIconColor: unsafeCSS(`var(--m3e-elevated-button-selected-icon-color, ${DesignToken.color.onPrimary})`),
483
+ /** Selected container background color. */
484
+ selectedContainerColor: unsafeCSS(`var(--m3e-elevated-button-selected-container-color, ${DesignToken.color.primary})`),
485
+ /** Design tokens that control disabled state. */
486
+ disabled: {
487
+ /** Container background color when disabled. */
488
+ containerColor: unsafeCSS(`var(--m3e-elevated-button-disabled-container-color, ${DesignToken.color.onSurface})`),
489
+ /** Opacity of container when disabled. */
490
+ containerOpacity: unsafeCSS(`var(--m3e-elevated-button-disabled-container-opacity, 10%)`),
491
+ /** Icon color when disabled. */
492
+ iconColor: unsafeCSS(`var(--m3e-elevated-button-disabled-icon-color, ${DesignToken.color.onSurface})`),
493
+ /** Icon opacity when disabled. */
494
+ iconOpacity: unsafeCSS(`var(--m3e-elevated-button-disabled-icon-opacity, 38%)`),
495
+ /** Label color when disabled. */
496
+ labelTextColor: unsafeCSS(`var(--m3e-elevated-button-disabled-label-text-color, ${DesignToken.color.onSurface})`),
497
+ /** Label opacity when disabled. */
498
+ labelTextOpacity: unsafeCSS(`var(--m3e-elevated-button-disabled-label-text-opacity, 38%)`),
499
+ /** Elevation when disabled. */
500
+ containerElevation: unsafeCSS(`var(--m3e-elevated-button-disabled-container-elevation, ${DesignToken.elevation.level0})`),
501
+ },
502
+ /** Design tokens that control hover state. */
503
+ hover: {
504
+ /** Icon color on hover. */
505
+ iconColor: unsafeCSS(`var(--m3e-elevated-button-hover-icon-color, ${DesignToken.color.primary})`),
506
+ /** Label color on hover. */
507
+ labelTextColor: unsafeCSS(`var(--m3e-elevated-button-hover-label-text-color, ${DesignToken.color.primary})`),
508
+ /** State layer color on hover. */
509
+ stateLayerColor: unsafeCSS(`var(--m3e-elevated-button-hover-state-layer-color, ${DesignToken.color.primary})`),
510
+ /** State layer opacity on hover. */
511
+ stateLayerOpacity: unsafeCSS(`var(--m3e-elevated-button-hover-state-layer-opacity, ${DesignToken.state.hoverStateLayerOpacity})`),
512
+ /** Elevation on hover. */
513
+ containerElevation: unsafeCSS(`var(--m3e-elevated-button-hover-container-elevation, ${DesignToken.elevation.level2})`),
514
+ /** Unselected icon color on hover. */
515
+ unselectedIconColor: unsafeCSS(`var(--m3e-elevated-button-hover-unselected-icon-color, ${DesignToken.color.primary})`),
516
+ /** Unselected label color on hover. */
517
+ unselectedLabelTextColor: unsafeCSS(`var(--m3e-elevated-button-hover-unselected-label-text-color, ${DesignToken.color.primary})`),
518
+ /** Unselected state layer color on hover. */
519
+ unselectedStateLayerColor: unsafeCSS(`var(--m3e-elevated-button-hover-unselected-state-layer-color, ${DesignToken.color.primary})`),
520
+ /** Selected icon color on hover. */
521
+ selectedIconColor: unsafeCSS(`var(--m3e-elevated-button-hover-selected-icon-color, ${DesignToken.color.onPrimary})`),
522
+ /** Selected label color on hover. */
523
+ selectedLabelTextColor: unsafeCSS(`var(--m3e-elevated-button-hover-selected-label-text-color, ${DesignToken.color.onPrimary})`),
524
+ /** Selected ripple color on hover. */
525
+ selectedStateLayerColor: unsafeCSS(`var(--m3e-elevated-button-hover-selected-state-layer-color, ${DesignToken.color.onPrimary})`),
526
+ },
527
+ /** Design tokens that control focus state. */
528
+ focus: {
529
+ /** Icon color on focus. */
530
+ iconColor: unsafeCSS(`var(--m3e-elevated-button-focus-icon-color, ${DesignToken.color.primary})`),
531
+ /** Label color on focus. */
532
+ labelTextColor: unsafeCSS(`var(--m3e-elevated-button-focus-label-text-color, ${DesignToken.color.primary})`),
533
+ /** State layer color on focus. */
534
+ stateLayerColor: unsafeCSS(`var(--m3e-elevated-button-focus-state-layer-color, ${DesignToken.color.primary})`),
535
+ /**State layer opacity on focus. */
536
+ stateLayerOpacity: unsafeCSS(`var(--m3e-elevated-button-focus-state-layer-opacity, ${DesignToken.state.focusStateLayerOpacity})`),
537
+ /** Elevation on focus. */
538
+ containerElevation: unsafeCSS(`var(--m3e-elevated-button-focus-container-elevation, ${DesignToken.elevation.level1})`),
539
+ /** Unselected label color on focus. */
540
+ unselectedLabelTextColor: unsafeCSS(`var(--m3e-elevated-button-focus-unselected-label-text-color, ${DesignToken.color.primary})`),
541
+ /** Unselected icon color on focus. */
542
+ unselectedIconColor: unsafeCSS(`var(--m3e-elevated-button-focus-unselected-icon-color, ${DesignToken.color.primary})`),
543
+ /** Unselected ripple color on focus. */
544
+ unselectedStateLayerColor: unsafeCSS(`var(--m3e-elevated-button-focus-unselected-state-layer-color, ${DesignToken.color.primary})`),
545
+ /** Selected icon color on focus. */
546
+ selectedIconColor: unsafeCSS(`var(--m3e-elevated-button-focus-selected-icon-color, ${DesignToken.color.onPrimary})`),
547
+ /** Selected label color on focus. */
548
+ selectedLabelTextColor: unsafeCSS(`var(--m3e-elevated-button-focus-selected-label-text-color, ${DesignToken.color.onPrimary})`),
549
+ /** Selected ripple color on focus. */
550
+ selectedStateLayerColor: unsafeCSS(`var(--m3e-elevated-button-focus-selected-state-layer-color, ${DesignToken.color.onPrimary})`),
551
+ },
552
+ /** Design tokens that control pressed state. */
553
+ pressed: {
554
+ /** Icon color on pressed. */
555
+ iconColor: unsafeCSS(`var(--m3e-elevated-button-pressed-icon-color, ${DesignToken.color.primary})`),
556
+ /** Label color on pressed. */
557
+ labelTextColor: unsafeCSS(`var(--m3e-elevated-button-pressed-label-text-color, ${DesignToken.color.primary})`),
558
+ /** State layer color on pressed. */
559
+ stateLayerColor: unsafeCSS(`var(--m3e-elevated-button-pressed-state-layer-color, ${DesignToken.color.primary})`),
560
+ /** State layer opacity on pressed. */
561
+ stateLayerOpacity: unsafeCSS(`var(--m3e-elevated-button-pressed-state-layer-opacity, ${DesignToken.state.pressedStateLayerOpacity})`),
562
+ /** Elevation on pressed. */
563
+ containerElevation: unsafeCSS(`var(--m3e-elevated-button-pressed-container-elevation, ${DesignToken.elevation.level1})`),
564
+ /** Unselected label color on pressed. */
565
+ unselectedLabelTextColor: unsafeCSS(`var(--m3e-elevated-button-pressed-unselected-label-text-color, ${DesignToken.color.primary})`),
566
+ /** Unselected icon color on pressed. */
567
+ unselectedIconColor: unsafeCSS(`var(--m3e-elevated-button-pressed-unselected-icon-color, ${DesignToken.color.primary})`),
568
+ /** Unselected ripple color on pressed. */
569
+ unselectedStateLayerColor: unsafeCSS(`var(--m3e-elevated-button-pressed-unselected-state-layer-color, ${DesignToken.color.primary})`),
570
+ /** Selected icon color on pressed. */
571
+ selectedIconColor: unsafeCSS(`var(--m3e-elevated-button-pressed-selected-icon-color, ${DesignToken.color.onPrimary})`),
572
+ /** Selected label color on pressed. */
573
+ selectedLabelTextColor: unsafeCSS(`var(--m3e-elevated-button-pressed-selected-label-text-color, ${DesignToken.color.onPrimary})`),
574
+ /** Selected ripple color on pressed. */
575
+ selectedStateLayerColor: unsafeCSS(`var(--m3e-elevated-button-pressed-selected-state-layer-color, ${DesignToken.color.onPrimary})`),
576
+ },
577
+ },
578
+ /** Design tokens that control the `outlined` variant. */
579
+ outlined: {
580
+ /** Default label color. */
581
+ labelTextColor: unsafeCSS(`var(--m3e-outlined-button-label-text-color, ${DesignToken.color.onSurfaceVariant})`),
582
+ /** Default icon color. */
583
+ iconColor: unsafeCSS(`var(--m3e-outlined-button-icon-color, ${DesignToken.color.onSurfaceVariant})`),
584
+ /** Default outline color. */
585
+ outlineColor: unsafeCSS(`var(--m3e-outlined-button-outline-color, ${DesignToken.color.outlineVariant})`),
586
+ /** Unselected label color. */
587
+ unselectedLabelTextColor: unsafeCSS(`var(--m3e-outlined-button-unselected-label-text-color, ${DesignToken.color.onSurfaceVariant})`),
588
+ /** Unselected icon color. */
589
+ unselectedIconColor: unsafeCSS(`var(--m3e-outlined-button-unselected-icon-color, ${DesignToken.color.onSurfaceVariant})`),
590
+ /** Selected label color. */
591
+ selectedLabelTextColor: unsafeCSS(`var(--m3e-outlined-button-selected-label-text-color, ${DesignToken.color.inverseOnSurface})`),
592
+ /** Selected icon color. */
593
+ selectedIconColor: unsafeCSS(`var(--m3e-outlined-button-selected-icon-color, ${DesignToken.color.inverseOnSurface})`),
594
+ /** Selected container background color. */
595
+ selectedContainerColor: unsafeCSS(`var(--m3e-outlined-button-selected-container-color, ${DesignToken.color.inverseSurface})`),
596
+ /** Design tokens that control disabled state. */
597
+ disabled: {
598
+ /** Container background color when disabled. */
599
+ containerColor: unsafeCSS(`var(--m3e-outlined-button-disabled-container-color, ${DesignToken.color.onSurface})`),
600
+ /** Opacity of container when disabled. */
601
+ containerOpacity: unsafeCSS(`var(--m3e-outlined-button-disabled-container-opacity, 10%)`),
602
+ /** Icon color when disabled. */
603
+ iconColor: unsafeCSS(`var(--m3e-outlined-button-disabled-icon-color, ${DesignToken.color.onSurface})`),
604
+ /** Icon opacity when disabled. */
605
+ iconOpacity: unsafeCSS(`var(--m3e-outlined-button-disabled-icon-opacity, 38%)`),
606
+ /** Label color when disabled. */
607
+ labelTextColor: unsafeCSS(`var(--m3e-outlined-button-disabled-label-text-color, ${DesignToken.color.onSurface})`),
608
+ /** Label opacity when disabled. */
609
+ labelTextOpacity: unsafeCSS(`var(--m3e-outlined-button-disabled-label-text-opacity, 38%)`),
610
+ /** Outline color when disabled. */
611
+ outlineColor: unsafeCSS(`var(--m3e-outlined-button-disabled-outline-color, ${DesignToken.color.outlineVariant})`),
612
+ },
613
+ /** Design tokens that control hover state. */
614
+ hover: {
615
+ /** Icon color on hover. */
616
+ iconColor: unsafeCSS(`var(--m3e-outlined-button-hover-icon-color, ${DesignToken.color.onSurfaceVariant})`),
617
+ /** Label color on hover. */
618
+ labelTextColor: unsafeCSS(`var(--m3e-outlined-button-hover-label-text-color, ${DesignToken.color.onSurfaceVariant})`),
619
+ /** Outline color on hover. */
620
+ outlineColor: unsafeCSS(`var(--m3e-outlined-button-hover-outline-color, ${DesignToken.color.outlineVariant})`),
621
+ /** State layer color on hover. */
622
+ stateLayerColor: unsafeCSS(`var(--m3e-outlined-button-hover-state-layer-color, ${DesignToken.color.onSurfaceVariant})`),
623
+ /** State layer opacity on hover. */
624
+ stateLayerOpacity: unsafeCSS(`var(--m3e-outlined-button-hover-state-layer-opacity, ${DesignToken.state.hoverStateLayerOpacity})`),
625
+ /** Unselected icon color on hover. */
626
+ unselectedIconColor: unsafeCSS(`var(--m3e-outlined-button-hover-unselected-icon-color, ${DesignToken.color.onSurfaceVariant})`),
627
+ /** Unselected label color on hover. */
628
+ unselectedLabelTextColor: unsafeCSS(`var(--m3e-outlined-button-hover-unselected-label-text-color, ${DesignToken.color.onSurfaceVariant})`),
629
+ /** Unselected state layer color on hover. */
630
+ unselectedStateLayerColor: unsafeCSS(`var(--m3e-outlined-button-hover-unselected-state-layer-color, ${DesignToken.color.onSurfaceVariant})`),
631
+ /** Selected icon color on hover. */
632
+ selectedIconColor: unsafeCSS(`var(--m3e-outlined-button-hover-selected-icon-color, ${DesignToken.color.inverseOnSurface})`),
633
+ /** Selected label color on hover. */
634
+ selectedLabelTextColor: unsafeCSS(`var(--m3e-outlined-button-hover-selected-label-text-color, ${DesignToken.color.inverseOnSurface})`),
635
+ /** Selected state layer color on hover. */
636
+ selectedStateLayerColor: unsafeCSS(`var(--m3e-outlined-button-hover-selected-state-layer-color, ${DesignToken.color.inverseOnSurface})`),
637
+ },
638
+ /** Design tokens that control focus state. */
639
+ focus: {
640
+ /** Icon color on focus. */
641
+ iconColor: unsafeCSS(`var(--m3e-outlined-button-focus-icon-color, ${DesignToken.color.onSurfaceVariant})`),
642
+ /** Label color on focus. */
643
+ labelTextColor: unsafeCSS(`var(--m3e-outlined-button-focus-label-text-color, ${DesignToken.color.onSurfaceVariant})`),
644
+ /** Outline color on focus. */
645
+ outlineColor: unsafeCSS(`var(--m3e-outlined-button-focus-outline-color, ${DesignToken.color.outlineVariant})`),
646
+ /** State layer color on focus. */
647
+ stateLayerColor: unsafeCSS(`var(--m3e-outlined-button-focus-state-layer-color, ${DesignToken.color.onSurfaceVariant})`),
648
+ /**State layer opacity on focus. */
649
+ stateLayerOpacity: unsafeCSS(`var(--m3e-outlined-button-focus-state-layer-opacity, ${DesignToken.state.focusStateLayerOpacity})`),
650
+ /** Unselected icon color on focus. */
651
+ unselectedIconColor: unsafeCSS(`var(--m3e-outlined-button-focus-unselected-icon-color, ${DesignToken.color.onSurfaceVariant})`),
652
+ /** Unselected label color on focus. */
653
+ unselectedLabelTextColor: unsafeCSS(`var(--m3e-outlined-button-focus-unselected-label-text-color, ${DesignToken.color.onSurfaceVariant})`),
654
+ /** Unselected state layer color on focus. */
655
+ unselectedStateLayerColor: unsafeCSS(`var(--m3e-outlined-button-focus-unselected-state-layer-color, ${DesignToken.color.onSurfaceVariant})`),
656
+ /** Selected icon color on focus. */
657
+ selectedIconColor: unsafeCSS(`var(--m3e-outlined-button-focus-selected-icon-color, ${DesignToken.color.inverseOnSurface})`),
658
+ /** Selected label color on focus. */
659
+ selectedLabelTextColor: unsafeCSS(`var(--m3e-outlined-button-focus-selected-label-text-color, ${DesignToken.color.inverseOnSurface})`),
660
+ /** Selected state layer color on focus. */
661
+ selectedStateLayerColor: unsafeCSS(`var(--m3e-outlined-button-focus-selected-state-layer-color, ${DesignToken.color.inverseOnSurface})`),
662
+ },
663
+ /** Design tokens that control pressed state. */
664
+ pressed: {
665
+ /** Icon color on pressed. */
666
+ iconColor: unsafeCSS(`var(--m3e-outlined-button-pressed-icon-color, ${DesignToken.color.onSurfaceVariant})`),
667
+ /** Label color on pressed. */
668
+ labelTextColor: unsafeCSS(`var(--m3e-outlined-button-pressed-label-text-color, ${DesignToken.color.onSurfaceVariant})`),
669
+ /** Outline color on pressed. */
670
+ outlineColor: unsafeCSS(`var(--m3e-outlined-button-pressed-outline-color, ${DesignToken.color.outlineVariant})`),
671
+ /** State layer color on pressed. */
672
+ stateLayerColor: unsafeCSS(`var(--m3e-outlined-button-pressed-state-layer-color, ${DesignToken.color.onSurfaceVariant})`),
673
+ /** State layer opacity on pressed. */
674
+ stateLayerOpacity: unsafeCSS(`var(--m3e-outlined-button-pressed-state-layer-opacity, ${DesignToken.state.pressedStateLayerOpacity})`),
675
+ /** Unselected icon color on pressed. */
676
+ unselectedIconColor: unsafeCSS(`var(--m3e-outlined-button-pressed-unselected-icon-color, ${DesignToken.color.onSurfaceVariant})`),
677
+ /** Unselected label color on pressed. */
678
+ unselectedLabelTextColor: unsafeCSS(`var(--m3e-outlined-button-pressed-unselected-label-text-color, ${DesignToken.color.onSurfaceVariant})`),
679
+ /** Unselected state layer color on pressed. */
680
+ unselectedStateLayerColor: unsafeCSS(`var(--m3e-outlined-button-pressed-unselected-state-layer-color, ${DesignToken.color.onSurfaceVariant})`),
681
+ /** Selected icon color on pressed. */
682
+ selectedIconColor: unsafeCSS(`var(--m3e-outlined-button-pressed-selected-icon-color, ${DesignToken.color.inverseOnSurface})`),
683
+ /** Selected label color on pressed. */
684
+ selectedLabelTextColor: unsafeCSS(`var(--m3e-outlined-button-pressed-selected-label-text-color, ${DesignToken.color.inverseOnSurface})`),
685
+ /** Selected state layer color on pressed. */
686
+ selectedStateLayerColor: unsafeCSS(`var(--m3e-outlined-button-pressed-selected-state-layer-color, ${DesignToken.color.inverseOnSurface})`),
687
+ },
688
+ },
689
+ /** Design tokens that control the `filled` variant. */
690
+ filled: {
691
+ /** Default label color. */
692
+ labelTextColor: unsafeCSS(`var(--m3e-filled-button-label-text-color, ${DesignToken.color.onPrimary})`),
693
+ /** Default icon color. */
694
+ iconColor: unsafeCSS(`var(--m3e-filled-button-icon-color, ${DesignToken.color.onPrimary})`),
695
+ /** Default container background color. */
696
+ containerColor: unsafeCSS(`var(--m3e-filled-button-container-color, ${DesignToken.color.primary})`),
697
+ /** Resting elevation. */
698
+ containerElevation: unsafeCSS(`var(--m3e-filled-button-container-elevation, ${DesignToken.elevation.level0})`),
699
+ /** Unselected label color. */
700
+ unselectedLabelTextColor: unsafeCSS(`var(--m3e-filled-button-unselected-label-text-color, ${DesignToken.color.onSurfaceVariant})`),
701
+ /** Unselected icon color. */
702
+ unselectedIconColor: unsafeCSS(`var(--m3e-filled-button-unselected-icon-color, ${DesignToken.color.onSurfaceVariant})`),
703
+ /** Unselected container background color. */
704
+ unselectedContainerColor: unsafeCSS(`var(--m3e-filled-button-unselected-container-color, ${DesignToken.color.surfaceContainer})`),
705
+ /** Selected label color. */
706
+ selectedLabelTextColor: unsafeCSS(`var(--m3e-filled-button-selected-label-text-color, ${DesignToken.color.onPrimary})`),
707
+ /** Selected icon color. */
708
+ selectedIconColor: unsafeCSS(`var(--m3e-filled-button-selected-icon-color, ${DesignToken.color.onPrimary})`),
709
+ /** Selected container background color. */
710
+ selectedContainerColor: unsafeCSS(`var(--m3e-filled-button-selected-container-color, ${DesignToken.color.primary})`),
711
+ /** Design tokens that control disabled state. */
712
+ disabled: {
713
+ /** Container background color when disabled. */
714
+ containerColor: unsafeCSS(`var(--m3e-filled-button-disabled-container-color, ${DesignToken.color.onSurface})`),
715
+ /** Opacity of container when disabled. */
716
+ containerOpacity: unsafeCSS(`var(--m3e-filled-button-disabled-container-opacity, 10%)`),
717
+ /** Icon color when disabled. */
718
+ iconColor: unsafeCSS(`var(--m3e-filled-button-disabled-icon-color, ${DesignToken.color.onSurface})`),
719
+ /** Icon opacity when disabled. */
720
+ iconOpacity: unsafeCSS(`var(--m3e-filled-button-disabled-icon-opacity, 38%)`),
721
+ /** Label color when disabled. */
722
+ labelTextColor: unsafeCSS(`var(--m3e-filled-button-disabled-label-text-color, ${DesignToken.color.onSurface})`),
723
+ /** Label opacity when disabled. */
724
+ labelTextOpacity: unsafeCSS(`var(--m3e-filled-button-disabled-label-text-opacity, 38%)`),
725
+ /** Elevation when disabled. */
726
+ containerElevation: unsafeCSS(`var(--m3e-filled-button-disabled-container-elevation, ${DesignToken.elevation.level0})`),
727
+ },
728
+ /** Design tokens that control hover state. */
729
+ hover: {
730
+ /** Icon color on hover. */
731
+ iconColor: unsafeCSS(`var(--m3e-filled-button-hover-icon-color, ${DesignToken.color.onPrimary})`),
732
+ /** Label color on hover. */
733
+ labelTextColor: unsafeCSS(`var(--m3e-filled-button-hover-label-text-color, ${DesignToken.color.onPrimary})`),
734
+ /** State layer color on hover. */
735
+ stateLayerColor: unsafeCSS(`var(--m3e-filled-button-hover-state-layer-color, ${DesignToken.color.onPrimary})`),
736
+ /** State layer opacity on hover. */
737
+ stateLayerOpacity: unsafeCSS(`var(--m3e-filled-button-hover-state-layer-opacity, ${DesignToken.state.hoverStateLayerOpacity})`),
738
+ /** Elevation on hover. */
739
+ containerElevation: unsafeCSS(`var(--m3e-filled-button-hover-container-elevation, ${DesignToken.elevation.level1})`),
740
+ /** Unselected icon color on hover. */
741
+ unselectedIconColor: unsafeCSS(`var(--m3e-filled-button-hover-unselected-icon-color, ${DesignToken.color.onSurfaceVariant})`),
742
+ /** Unselected label color on hover. */
743
+ unselectedLabelTextColor: unsafeCSS(`var(--m3e-filled-button-hover-unselected-label-text-color, ${DesignToken.color.onSurfaceVariant})`),
744
+ /** Unselected state layer color on hover. */
745
+ unselectedStateLayerColor: unsafeCSS(`var(--m3e-filled-button-hover-unselected-state-layer-color, ${DesignToken.color.onSurfaceVariant})`),
746
+ /** Selected icon color on hover. */
747
+ selectedIconColor: unsafeCSS(`var(--m3e-filled-button-hover-selected-icon-color, ${DesignToken.color.onPrimary})`),
748
+ /** Selected label color on hover. */
749
+ selectedLabelTextColor: unsafeCSS(`var(--m3e-filled-button-hover-selected-label-text-color, ${DesignToken.color.onPrimary})`),
750
+ /** Selected state layer color on hover. */
751
+ selectedStateLayerColor: unsafeCSS(`var(--m3e-filled-button-hover-selected-state-layer-color, ${DesignToken.color.onPrimary})`),
752
+ },
753
+ /** Design tokens that control focus state. */
754
+ focus: {
755
+ /** Icon color on focus. */
756
+ iconColor: unsafeCSS(`var(--m3e-filled-button-focus-icon-color, ${DesignToken.color.onPrimary})`),
757
+ /** Label color on focus. */
758
+ labelTextColor: unsafeCSS(`var(--m3e-filled-button-focus-label-text-color, ${DesignToken.color.onPrimary})`),
759
+ /** State layer color on focus. */
760
+ stateLayerColor: unsafeCSS(`var(--m3e-filled-button-focus-state-layer-color, ${DesignToken.color.onPrimary})`),
761
+ /**State layer opacity on focus. */
762
+ stateLayerOpacity: unsafeCSS(`var(--m3e-filled-button-focus-state-layer-opacity, ${DesignToken.state.focusStateLayerOpacity})`),
763
+ /** Elevation on focus. */
764
+ containerElevation: unsafeCSS(`var(--m3e-filled-button-focus-container-elevation, ${DesignToken.elevation.level0})`),
765
+ /** Unselected icon color on focus. */
766
+ unselectedIconColor: unsafeCSS(`var(--m3e-filled-button-focus-unselected-icon-color, ${DesignToken.color.onSurfaceVariant})`),
767
+ /** Unselected label color on focus. */
768
+ unselectedLabelTextColor: unsafeCSS(`var(--m3e-filled-button-focus-unselected-label-text-color, ${DesignToken.color.onSurfaceVariant})`),
769
+ /** Unselected state layer color on focus. */
770
+ unselectedStateLayerColor: unsafeCSS(`var(--m3e-filled-button-focus-unselected-state-layer-color, ${DesignToken.color.onSurfaceVariant})`),
771
+ /** Selected icon color on focus. */
772
+ selectedIconColor: unsafeCSS(`var(--m3e-filled-button-focus-selected-icon-color, ${DesignToken.color.onPrimary})`),
773
+ /** Selected label color on focus. */
774
+ selectedLabelTextColor: unsafeCSS(`var(--m3e-filled-button-focus-selected-label-text-color, ${DesignToken.color.onPrimary})`),
775
+ /** Selected state layer color on focus. */
776
+ selectedStateLayerColor: unsafeCSS(`var(--m3e-filled-button-focus-selected-state-layer-color, ${DesignToken.color.onPrimary})`),
777
+ },
778
+ /** Design tokens that control pressed state. */
779
+ pressed: {
780
+ /** Icon color on pressed. */
781
+ iconColor: unsafeCSS(`var(--m3e-filled-button-pressed-icon-color, ${DesignToken.color.onPrimary})`),
782
+ /** Label color on pressed. */
783
+ labelTextColor: unsafeCSS(`var(--m3e-filled-button-pressed-label-text-color, ${DesignToken.color.onPrimary})`),
784
+ /** State layer color on pressed. */
785
+ stateLayerColor: unsafeCSS(`var(--m3e-filled-button-pressed-state-layer-color, ${DesignToken.color.onPrimary})`),
786
+ /** State layer opacity on pressed. */
787
+ stateLayerOpacity: unsafeCSS(`var(--m3e-filled-button-pressed-state-layer-opacity, ${DesignToken.state.pressedStateLayerOpacity})`),
788
+ /** Elevation on pressed. */
789
+ containerElevation: unsafeCSS(`var(--m3e-filled-button-pressed-container-elevation, ${DesignToken.elevation.level0})`),
790
+ /** Unselected icon color on pressed. */
791
+ unselectedIconColor: unsafeCSS(`var(--m3e-filled-button-pressed-unselected-icon-color, ${DesignToken.color.onSurfaceVariant})`),
792
+ /** Unselected label color on pressed. */
793
+ unselectedLabelTextColor: unsafeCSS(`var(--m3e-filled-button-pressed-unselected-label-text-color, ${DesignToken.color.onSurfaceVariant})`),
794
+ /** Unselected state layer color on pressed. */
795
+ unselectedStateLayerColor: unsafeCSS(`var(--m3e-filled-button-pressed-unselected-state-layer-color, ${DesignToken.color.onSurfaceVariant})`),
796
+ /** Selected icon color on pressed. */
797
+ selectedIconColor: unsafeCSS(`var(--m3e-filled-button-pressed-selected-icon-color, ${DesignToken.color.onPrimary})`),
798
+ /** Selected label color on pressed. */
799
+ selectedLabelTextColor: unsafeCSS(`var(--m3e-filled-button-pressed-selected-label-text-color, ${DesignToken.color.onPrimary})`),
800
+ /** Selected state layer color on pressed. */
801
+ selectedStateLayerColor: unsafeCSS(`var(--m3e-filled-button-pressed-selected-state-layer-color, ${DesignToken.color.onPrimary})`),
802
+ },
803
+ },
804
+ /** Design tokens that control the `tonal` variant. */
805
+ tonal: {
806
+ /** Default label color. */
807
+ labelTextColor: unsafeCSS(`var(--m3e-tonal-button-label-text-color, ${DesignToken.color.onSecondaryContainer})`),
808
+ /** Default icon color. */
809
+ iconColor: unsafeCSS(`var(--m3e-tonal-button-icon-color, ${DesignToken.color.onSecondaryContainer})`),
810
+ /** Default container background color. */
811
+ containerColor: unsafeCSS(`var(--m3e-tonal-button-container-color, ${DesignToken.color.secondaryContainer})`),
812
+ /** Resting elevation. */
813
+ containerElevation: unsafeCSS(`var(--m3e-tonal-button-container-elevation, ${DesignToken.elevation.level0})`),
814
+ /** Unselected label color. */
815
+ unselectedLabelTextColor: unsafeCSS(`var(--m3e-tonal-button-unselected-label-text-color, ${DesignToken.color.onSecondaryContainer})`),
816
+ /** Unselected icon color. */
817
+ unselectedIconColor: unsafeCSS(`var(--m3e-tonal-button-unselected-icon-color, ${DesignToken.color.onSecondaryContainer})`),
818
+ /** Unselected container background color. */
819
+ unselectedContainerColor: unsafeCSS(`var(--m3e-tonal-button-unselected-container-color, ${DesignToken.color.secondaryContainer})`),
820
+ /** Selected label color. */
821
+ selectedLabelTextColor: unsafeCSS(`var(--m3e-tonal-button-selected-label-text-color, ${DesignToken.color.onSecondary})`),
822
+ /** Selected icon color. */
823
+ selectedIconColor: unsafeCSS(`var(--m3e-tonal-button-selected-icon-color, ${DesignToken.color.onSecondary})`),
824
+ /** Selected container background color. */
825
+ selectedContainerColor: unsafeCSS(`var(--m3e-tonal-button-selected-container-color, ${DesignToken.color.secondary})`),
826
+ /** Design tokens that control disabled state. */
827
+ disabled: {
828
+ /** Container background color when disabled. */
829
+ containerColor: unsafeCSS(`var(--m3e-tonal-button-disabled-container-color, ${DesignToken.color.onSurface})`),
830
+ /** Opacity of container when disabled. */
831
+ containerOpacity: unsafeCSS(`var(--m3e-tonal-button-disabled-container-opacity, 10%)`),
832
+ /** Icon color when disabled. */
833
+ iconColor: unsafeCSS(`var(--m3e-tonal-button-disabled-icon-color, ${DesignToken.color.onSurface})`),
834
+ /** Icon opacity when disabled. */
835
+ iconOpacity: unsafeCSS(`var(--m3e-tonal-button-disabled-icon-opacity, 38%)`),
836
+ /** Label color when disabled. */
837
+ labelTextColor: unsafeCSS(`var(--m3e-tonal-button-disabled-label-text-color, ${DesignToken.color.onSurface})`),
838
+ /** Label opacity when disabled. */
839
+ labelTextOpacity: unsafeCSS(`var(--m3e-tonal-button-disabled-label-text-opacity, 38%)`),
840
+ /** Elevation when disabled. */
841
+ containerElevation: unsafeCSS(`var(--m3e-tonal-button-disabled-container-elevation, ${DesignToken.elevation.level0})`),
842
+ },
843
+ /** Design tokens that control hover state. */
844
+ hover: {
845
+ /** Icon color on hover. */
846
+ iconColor: unsafeCSS(`var(--m3e-tonal-button-hover-icon-color, ${DesignToken.color.onSecondaryContainer})`),
847
+ /** Label color on hover. */
848
+ labelTextColor: unsafeCSS(`var(--m3e-tonal-button-hover-label-text-color, ${DesignToken.color.onSecondaryContainer})`),
849
+ /** State layer color on hover. */
850
+ stateLayerColor: unsafeCSS(`var(--m3e-tonal-button-hover-state-layer-color, ${DesignToken.color.onSecondaryContainer})`),
851
+ /** State layer opacity on hover. */
852
+ stateLayerOpacity: unsafeCSS(`var(--m3e-tonal-button-hover-state-layer-opacity, ${DesignToken.state.hoverStateLayerOpacity})`),
853
+ /** Elevation on hover. */
854
+ containerElevation: unsafeCSS(`var(--m3e-tonal-button-hover-container-elevation, ${DesignToken.elevation.level1})`),
855
+ /** Unselected icon color on hover. */
856
+ unselectedIconColor: unsafeCSS(`var(--m3e-tonal-button-hover-unselected-icon-color, ${DesignToken.color.onSecondaryContainer})`),
857
+ /** Unselected label color on hover. */
858
+ unselectedLabelTextColor: unsafeCSS(`var(--m3e-tonal-button-hover-unselected-label-text-color, ${DesignToken.color.onSecondaryContainer})`),
859
+ /** Unselected state layer color on hover. */
860
+ unselectedStateLayerColor: unsafeCSS(`var(--m3e-tonal-button-hover-unselected-state-layer-color, ${DesignToken.color.onSecondaryContainer})`),
861
+ /** Selected icon color on hover. */
862
+ selectedIconColor: unsafeCSS(`var(--m3e-tonal-button-hover-selected-icon-color, ${DesignToken.color.onSecondary})`),
863
+ /** Selected label color on hover. */
864
+ selectedLabelTextColor: unsafeCSS(`var(--m3e-tonal-button-hover-selected-label-text-color, ${DesignToken.color.onSecondary})`),
865
+ /** Selected state layer color on hover. */
866
+ selectedStateLayerColor: unsafeCSS(`var(--m3e-tonal-button-hover-selected-state-layer-color, ${DesignToken.color.onSecondary})`),
867
+ },
868
+ /** Design tokens that control focus state. */
869
+ focus: {
870
+ /** Icon color on focus. */
871
+ iconColor: unsafeCSS(`var(--m3e-tonal-button-focus-icon-color, ${DesignToken.color.onSecondaryContainer})`),
872
+ /** Label color on focus. */
873
+ labelTextColor: unsafeCSS(`var(--m3e-tonal-button-focus-label-text-color, ${DesignToken.color.onSecondaryContainer})`),
874
+ /** State layer color on focus. */
875
+ stateLayerColor: unsafeCSS(`var(--m3e-tonal-button-focus-state-layer-color, ${DesignToken.color.onSecondaryContainer})`),
876
+ /**State layer opacity on focus. */
877
+ stateLayerOpacity: unsafeCSS(`var(--m3e-tonal-button-focus-state-layer-opacity, ${DesignToken.state.focusStateLayerOpacity})`),
878
+ /** Elevation on focus. */
879
+ containerElevation: unsafeCSS(`var(--m3e-tonal-button-focus-container-elevation, ${DesignToken.elevation.level0})`),
880
+ /** Unselected icon color on focus. */
881
+ unselectedIconColor: unsafeCSS(`var(--m3e-tonal-button-focus-unselected-icon-color, ${DesignToken.color.onSecondaryContainer})`),
882
+ /** Unselected label color on focus. */
883
+ unselectedLabelTextColor: unsafeCSS(`var(--m3e-tonal-button-focus-unselected-label-text-color, ${DesignToken.color.onSecondaryContainer})`),
884
+ /** Unselected state layer color on focus. */
885
+ unselectedStateLayerColor: unsafeCSS(`var(--m3e-tonal-button-focus-unselected-state-layer-color, ${DesignToken.color.onSecondaryContainer})`),
886
+ /** Selected icon color on focus. */
887
+ selectedIconColor: unsafeCSS(`var(--m3e-tonal-button-focus-selected-icon-color, ${DesignToken.color.onSecondary})`),
888
+ /** Selected label color on focus. */
889
+ selectedLabelTextColor: unsafeCSS(`var(--m3e-tonal-button-focus-selected-label-text-color, ${DesignToken.color.onSecondary})`),
890
+ /** Selected state layer color on focus. */
891
+ selectedStateLayerColor: unsafeCSS(`var(--m3e-tonal-button-focus-selected-state-layer-color, ${DesignToken.color.onSecondary})`),
892
+ },
893
+ /** Design tokens that control pressed state. */
894
+ pressed: {
895
+ /** Icon color on pressed. */
896
+ iconColor: unsafeCSS(`var(--m3e-tonal-button-pressed-icon-color, ${DesignToken.color.onSecondaryContainer})`),
897
+ /** Label color on pressed. */
898
+ labelTextColor: unsafeCSS(`var(--m3e-tonal-button-pressed-label-text-color, ${DesignToken.color.onSecondaryContainer})`),
899
+ /** State layer color on pressed. */
900
+ stateLayerColor: unsafeCSS(`var(--m3e-tonal-button-pressed-state-layer-color, ${DesignToken.color.onSecondaryContainer})`),
901
+ /** State layer opacity on pressed. */
902
+ stateLayerOpacity: unsafeCSS(`var(--m3e-tonal-button-pressed-state-layer-opacity, ${DesignToken.state.pressedStateLayerOpacity})`),
903
+ /** Elevation on pressed. */
904
+ containerElevation: unsafeCSS(`var(--m3e-tonal-button-pressed-container-elevation, ${DesignToken.elevation.level0})`),
905
+ /** Unselected icon color on pressed. */
906
+ unselectedIconColor: unsafeCSS(`var(--m3e-tonal-button-pressed-unselected-icon-color, ${DesignToken.color.onSecondaryContainer})`),
907
+ /** Unselected label color on pressed. */
908
+ unselectedLabelTextColor: unsafeCSS(`var(--m3e-tonal-button-pressed-unselected-label-text-color, ${DesignToken.color.onSecondaryContainer})`),
909
+ /** Unselected state layer color on pressed. */
910
+ unselectedStateLayerColor: unsafeCSS(`var(--m3e-tonal-button-pressed-unselected-state-layer-color, ${DesignToken.color.onSecondaryContainer})`),
911
+ /** Selected icon color on pressed. */
912
+ selectedIconColor: unsafeCSS(`var(--m3e-tonal-button-pressed-selected-icon-color, ${DesignToken.color.onSecondary})`),
913
+ /** Selected label color on pressed. */
914
+ selectedLabelTextColor: unsafeCSS(`var(--m3e-tonal-button-pressed-selected-label-text-color, ${DesignToken.color.onSecondary})`),
915
+ /** Selected state layer color on pressed. */
916
+ selectedStateLayerColor: unsafeCSS(`var(--m3e-tonal-button-pressed-selected-state-layer-color, ${DesignToken.color.onSecondary})`),
917
+ },
918
+ },
919
+ /** Design tokens that control the `text` variant. */
920
+ text: {
921
+ /** Default label color. */
922
+ labelTextColor: unsafeCSS(`var(--m3e-text-button-label-text-color, ${DesignToken.color.primary})`),
923
+ /** Default icon color. */
924
+ iconColor: unsafeCSS(`var(--m3e-text-button-icon-color, ${DesignToken.color.primary})`),
925
+ /** Unselected label color. */
926
+ unselectedLabelTextColor: unsafeCSS(`var(--m3e-text-button-unselected-label-text-color, ${DesignToken.color.primary})`),
927
+ /** Unselected icon color. */
928
+ unselectedIconColor: unsafeCSS(`var(--m3e-text-button-unselected-icon-color, ${DesignToken.color.primary})`),
929
+ /** Selected label color. */
930
+ selectedLabelTextColor: unsafeCSS(`var(--m3e-text-button-selected-label-text-color, ${DesignToken.color.primary})`),
931
+ /** Selected icon color. */
932
+ selectedIconColor: unsafeCSS(`var(--m3e-text-button-selected-icon-color, ${DesignToken.color.primary})`),
933
+ /** Design tokens that control disabled state. */
934
+ disabled: {
935
+ /** Container background color when disabled. */
936
+ containerColor: unsafeCSS(`var(--m3e-text-button-disabled-container-color, ${DesignToken.color.onSurface})`),
937
+ /** Opacity of container when disabled. */
938
+ containerOpacity: unsafeCSS(`var(--m3e-text-button-disabled-container-opacity, 10%)`),
939
+ /** Icon color when disabled. */
940
+ iconColor: unsafeCSS(`var(--m3e-text-button-disabled-icon-color, ${DesignToken.color.onSurface})`),
941
+ /** Icon opacity when disabled. */
942
+ iconOpacity: unsafeCSS(`var(--m3e-text-button-disabled-icon-opacity, 38%)`),
943
+ /** Label color when disabled. */
944
+ labelTextColor: unsafeCSS(`var(--m3e-text-button-disabled-label-text-color, ${DesignToken.color.onSurface})`),
945
+ /** Label opacity when disabled. */
946
+ labelTextOpacity: unsafeCSS(`var(--m3e-text-button-disabled-label-text-opacity, 38%)`),
947
+ },
948
+ /** Design tokens that control hover state. */
949
+ hover: {
950
+ /** Icon color on hover. */
951
+ iconColor: unsafeCSS(`var(--m3e-text-button-hover-icon-color, ${DesignToken.color.primary})`),
952
+ /** Label color on hover. */
953
+ labelTextColor: unsafeCSS(`var(--m3e-text-button-hover-label-text-color, ${DesignToken.color.primary})`),
954
+ /** State layer color on hover. */
955
+ stateLayerColor: unsafeCSS(`var(--m3e-text-button-hover-state-layer-color, ${DesignToken.color.primary})`),
956
+ /** State layer opacity on hover. */
957
+ stateLayerOpacity: unsafeCSS(`var(--m3e-text-button-hover-state-layer-opacity, ${DesignToken.state.hoverStateLayerOpacity})`),
958
+ /** Unselected icon color on hover. */
959
+ unselectedIconColor: unsafeCSS(`var(--m3e-text-button-hover-unselected-icon-color, ${DesignToken.color.primary})`),
960
+ /** Unselected label color on hover. */
961
+ unselectedLabelTextColor: unsafeCSS(`var(--m3e-text-button-hover-unselected-label-text-color, ${DesignToken.color.primary})`),
962
+ /** Unselected state layer color on hover. */
963
+ unselectedStateLayerColor: unsafeCSS(`var(--m3e-text-button-hover-unselected-state-layer-color, ${DesignToken.color.primary})`),
964
+ /** Selected icon color on hover. */
965
+ selectedIconColor: unsafeCSS(`var(--m3e-text-button-hover-selected-icon-color, ${DesignToken.color.primary})`),
966
+ /** Selected label color on hover. */
967
+ selectedLabelTextColor: unsafeCSS(`var(--m3e-text-button-hover-selected-label-text-color, ${DesignToken.color.primary})`),
968
+ /** Selected state layer color on hover. */
969
+ selectedStateLayerColor: unsafeCSS(`var(--m3e-text-button-hover-selected-state-layer-color, ${DesignToken.color.primary})`),
970
+ },
971
+ /** Design tokens that control focus state. */
972
+ focus: {
973
+ /** Icon color on focus. */
974
+ iconColor: unsafeCSS(`var(--m3e-text-button-focus-icon-color, ${DesignToken.color.primary})`),
975
+ /** Label color on focus. */
976
+ labelTextColor: unsafeCSS(`var(--m3e-text-button-focus-label-text-color, ${DesignToken.color.primary})`),
977
+ /** State layer color on focus. */
978
+ stateLayerColor: unsafeCSS(`var(--m3e-text-button-focus-state-layer-color, ${DesignToken.color.primary})`),
979
+ /**State layer opacity on focus. */
980
+ stateLayerOpacity: unsafeCSS(`var(--m3e-text-button-focus-state-layer-opacity, ${DesignToken.state.focusStateLayerOpacity})`),
981
+ /** Unselected icon color on focus. */
982
+ unselectedIconColor: unsafeCSS(`var(--m3e-text-button-focus-unselected-icon-color, ${DesignToken.color.primary})`),
983
+ /** Unselected label color on focus. */
984
+ unselectedLabelTextColor: unsafeCSS(`var(--m3e-text-button-focus-unselected-label-text-color, ${DesignToken.color.primary})`),
985
+ /** Unselected state layer color on focus. */
986
+ unselectedStateLayerColor: unsafeCSS(`var(--m3e-text-button-focus-unselected-state-layer-color, ${DesignToken.color.primary})`),
987
+ /** Selected icon color on focus. */
988
+ selectedIconColor: unsafeCSS(`var(--m3e-text-button-focus-selected-icon-color, ${DesignToken.color.primary})`),
989
+ /** Selected label color on focus. */
990
+ selectedLabelTextColor: unsafeCSS(`var(--m3e-text-button-focus-selected-label-text-color, ${DesignToken.color.primary})`),
991
+ /** Selected state layer color on focus. */
992
+ selectedStateLayerColor: unsafeCSS(`var(--m3e-text-button-focus-selected-state-layer-color, ${DesignToken.color.primary})`),
993
+ },
994
+ /** Design tokens that control pressed state. */
995
+ pressed: {
996
+ /** Icon color on pressed. */
997
+ iconColor: unsafeCSS(`var(--m3e-text-button-pressed-icon-color, ${DesignToken.color.primary})`),
998
+ /** Label color on pressed. */
999
+ labelTextColor: unsafeCSS(`var(--m3e-text-button-pressed-label-text-color, ${DesignToken.color.primary})`),
1000
+ /** State layer color on pressed. */
1001
+ stateLayerColor: unsafeCSS(`var(--m3e-text-button-pressed-state-layer-color, ${DesignToken.color.primary})`),
1002
+ /** State layer opacity on pressed. */
1003
+ stateLayerOpacity: unsafeCSS(`var(--m3e-text-button-pressed-state-layer-opacity, ${DesignToken.state.pressedStateLayerOpacity})`),
1004
+ /** Unselected icon color on pressed. */
1005
+ unselectedIconColor: unsafeCSS(`var(--m3e-text-button-pressed-unselected-icon-color, ${DesignToken.color.primary})`),
1006
+ /** Unselected label color on pressed. */
1007
+ unselectedLabelTextColor: unsafeCSS(`var(--m3e-text-button-pressed-unselected-label-text-color, ${DesignToken.color.primary})`),
1008
+ /** Unselected state layer color on pressed. */
1009
+ unselectedStateLayerColor: unsafeCSS(`var(--m3e-text-button-pressed-unselected-state-layer-color, ${DesignToken.color.primary})`),
1010
+ /** Selected icon color on pressed. */
1011
+ selectedIconColor: unsafeCSS(`var(--m3e-text-button-pressed-selected-icon-color, ${DesignToken.color.primary})`),
1012
+ /** Selected label color on pressed. */
1013
+ selectedLabelTextColor: unsafeCSS(`var(--m3e-text-button-pressed-selected-label-text-color, ${DesignToken.color.primary})`),
1014
+ /** Selected state layer color on pressed. */
1015
+ selectedStateLayerColor: unsafeCSS(`var(--m3e-text-button-pressed-selected-state-layer-color, ${DesignToken.color.primary})`),
1016
+ },
1017
+ },
1018
+ };
1019
+
1020
+ /** @private */
1021
+ function buttonVariantStyle(variant) {
1022
+ return css `
1023
+ :host([variant="${unsafeCSS(variant)}"]:not(:disabled):not([disabled-interactive])) .base {
1024
+ background-color: ${ButtonVariantToken[variant].containerColor ?? unsafeCSS("unset")};
1025
+ --m3e-state-layer-hover-color: ${ButtonVariantToken[variant].hover.stateLayerColor};
1026
+ --m3e-state-layer-hover-opacity: ${ButtonVariantToken[variant].hover.stateLayerOpacity};
1027
+ --m3e-state-layer-focus-color: ${ButtonVariantToken[variant].focus.stateLayerColor};
1028
+ --m3e-state-layer-focus-opacity: ${ButtonVariantToken[variant].focus.stateLayerOpacity};
1029
+ --m3e-ripple-color: ${ButtonVariantToken[variant].pressed.stateLayerColor};
1030
+ --m3e-ripple-opacity: ${ButtonVariantToken[variant].pressed.stateLayerOpacity};
1031
+ --m3e-elevation-level: ${ButtonVariantToken[variant].containerElevation ?? unsafeCSS("unset")};
1032
+ --m3e-elevation-hover-level: ${ButtonVariantToken[variant].hover.containerElevation ?? unsafeCSS("unset")};
1033
+ --m3e-elevation-focus-level: ${ButtonVariantToken[variant].focus.containerElevation ?? unsafeCSS("unset")};
1034
+ --m3e-elevation-pressed-level: ${ButtonVariantToken[variant].pressed.containerElevation ?? unsafeCSS("unset")};
1035
+ }
1036
+ :host([variant="${unsafeCSS(variant)}"][toggle]:not([selected]):not(:disabled):not([disabled-interactive])) .base {
1037
+ background-color: ${ButtonVariantToken[variant].unselectedContainerColor ?? unsafeCSS("unset")};
1038
+ --m3e-state-layer-hover-color: ${ButtonVariantToken[variant].hover.unselectedStateLayerColor};
1039
+ --m3e-state-layer-focus-color: ${ButtonVariantToken[variant].focus.unselectedStateLayerColor};
1040
+ --m3e-ripple-color: ${ButtonVariantToken[variant].pressed.unselectedStateLayerColor};
1041
+ }
1042
+ :host([variant="${unsafeCSS(variant)}"][toggle][selected]:not(:disabled):not([disabled-interactive])) .base {
1043
+ background-color: ${ButtonVariantToken[variant].selectedContainerColor ?? unsafeCSS("unset")};
1044
+ --m3e-state-layer-hover-color: ${ButtonVariantToken[variant].hover.selectedStateLayerColor};
1045
+ --m3e-state-layer-focus-color: ${ButtonVariantToken[variant].focus.selectedStateLayerColor};
1046
+ --m3e-ripple-color: ${ButtonVariantToken[variant].pressed.selectedStateLayerColor};
1047
+ }
1048
+ :host([variant="${unsafeCSS(variant)}"]:not(:disabled):not([disabled-interactive])) .base {
1049
+ outline-color: ${ButtonVariantToken[variant].outlineColor ?? unsafeCSS("unset")};
1050
+ }
1051
+ :host([variant="${unsafeCSS(variant)}"]:focus:not(:disabled):not([disabled-interactive])) .base {
1052
+ outline-color: ${ButtonVariantToken[variant].focus.outlineColor ?? unsafeCSS("unset")};
1053
+ }
1054
+ :host([variant="${unsafeCSS(variant)}"]:hover:not(:disabled):not([disabled-interactive])) .base {
1055
+ outline-color: ${ButtonVariantToken[variant].hover.outlineColor ?? unsafeCSS("unset")};
1056
+ }
1057
+ :host([variant="${unsafeCSS(variant)}"].-pressed:not(:disabled):not([disabled-interactive])) .base {
1058
+ outline-color: ${ButtonVariantToken[variant].pressed.outlineColor ?? unsafeCSS("unset")};
1059
+ }
1060
+ :host([variant="${unsafeCSS(variant)}"]:not(:disabled):not([disabled-interactive])) .label {
1061
+ color: ${ButtonVariantToken[variant].labelTextColor};
1062
+ }
1063
+ :host([variant="${unsafeCSS(variant)}"][toggle]:not([selected]):not(:disabled):not([disabled-interactive])) .label {
1064
+ color: ${ButtonVariantToken[variant].unselectedLabelTextColor};
1065
+ }
1066
+ :host([variant="${unsafeCSS(variant)}"][toggle][selected]:not(:disabled):not([disabled-interactive])) .label {
1067
+ color: ${ButtonVariantToken[variant].selectedLabelTextColor};
1068
+ }
1069
+ :host([variant="${unsafeCSS(variant)}"]:focus:not(:disabled):not([disabled-interactive])) .label {
1070
+ color: ${ButtonVariantToken[variant].focus.labelTextColor};
1071
+ }
1072
+ :host([variant="${unsafeCSS(variant)}"][toggle]:not([selected]):focus:not(:disabled):not([disabled-interactive]))
1073
+ .label {
1074
+ color: ${ButtonVariantToken[variant].focus.unselectedLabelTextColor};
1075
+ }
1076
+ :host([variant="${unsafeCSS(variant)}"][toggle][selected]:focus:not(:disabled):not([disabled-interactive])) .label {
1077
+ color: ${ButtonVariantToken[variant].focus.selectedLabelTextColor};
1078
+ }
1079
+ :host([variant="${unsafeCSS(variant)}"]:hover:not(:disabled):not([disabled-interactive])) .label {
1080
+ color: ${ButtonVariantToken[variant].hover.labelTextColor};
1081
+ }
1082
+ :host([variant="${unsafeCSS(variant)}"][toggle]:not([selected]):hover:not(:disabled):not([disabled-interactive]))
1083
+ .label {
1084
+ color: ${ButtonVariantToken[variant].hover.unselectedLabelTextColor};
1085
+ }
1086
+ :host([variant="${unsafeCSS(variant)}"][toggle][selected]:hover:not(:disabled):not([disabled-interactive])) .label {
1087
+ color: ${ButtonVariantToken[variant].hover.selectedLabelTextColor};
1088
+ }
1089
+ :host([variant="${unsafeCSS(variant)}"].-pressed:not(:disabled):not([disabled-interactive])) .label {
1090
+ color: ${ButtonVariantToken[variant].pressed.labelTextColor};
1091
+ }
1092
+ :host([variant="${unsafeCSS(variant)}"][toggle]:not([selected]).-pressed:not(:disabled):not([disabled-interactive]))
1093
+ .label {
1094
+ color: ${ButtonVariantToken[variant].pressed.unselectedLabelTextColor};
1095
+ }
1096
+ :host([variant="${unsafeCSS(variant)}"][toggle][selected].-pressed:not(:disabled):not([disabled-interactive]))
1097
+ .label {
1098
+ color: ${ButtonVariantToken[variant].pressed.selectedLabelTextColor};
1099
+ }
1100
+ :host([variant="${unsafeCSS(variant)}"]:not(:disabled):not([disabled-interactive])) .icon {
1101
+ color: ${ButtonVariantToken[variant].iconColor};
1102
+ }
1103
+ :host([variant="${unsafeCSS(variant)}"][toggle]:not([selected]):not(:disabled):not([disabled-interactive])) .icon {
1104
+ color: ${ButtonVariantToken[variant].unselectedIconColor};
1105
+ }
1106
+ :host([variant="${unsafeCSS(variant)}"][toggle][selected]:not(:disabled):not([disabled-interactive])) .icon {
1107
+ color: ${ButtonVariantToken[variant].selectedIconColor};
1108
+ }
1109
+ :host([variant="${unsafeCSS(variant)}"]:focus:not(:disabled):not([disabled-interactive])) .icon {
1110
+ color: ${ButtonVariantToken[variant].focus.iconColor};
1111
+ }
1112
+ :host([variant="${unsafeCSS(variant)}"][toggle]:not([selected]):focus:not(:disabled):not([disabled-interactive]))
1113
+ .icon {
1114
+ color: ${ButtonVariantToken[variant].focus.unselectedIconColor};
1115
+ }
1116
+ :host([variant="${unsafeCSS(variant)}"][toggle][selected]:focus:not(:disabled):not([disabled-interactive])) .icon {
1117
+ color: ${ButtonVariantToken[variant].focus.selectedIconColor};
1118
+ }
1119
+ :host([variant="${unsafeCSS(variant)}"]:hover:not(:disabled):not([disabled-interactive])) .icon {
1120
+ color: ${ButtonVariantToken[variant].hover.iconColor};
1121
+ }
1122
+ :host([variant="${unsafeCSS(variant)}"][toggle]:not([selected]):hover:not(:disabled):not([disabled-interactive]))
1123
+ .icon {
1124
+ color: ${ButtonVariantToken[variant].hover.unselectedIconColor};
1125
+ }
1126
+ :host([variant="${unsafeCSS(variant)}"][toggle][selected]:hover:not(:disabled):not([disabled-interactive])) .icon {
1127
+ color: ${ButtonVariantToken[variant].hover.selectedIconColor};
1128
+ }
1129
+ :host([variant="${unsafeCSS(variant)}"].-pressed:not(:disabled):not([disabled-interactive])) .icon {
1130
+ color: ${ButtonVariantToken[variant].pressed.iconColor};
1131
+ }
1132
+ :host([variant="${unsafeCSS(variant)}"][toggle]:not([selected]).-pressed:not(:disabled):not([disabled-interactive]))
1133
+ .icon {
1134
+ color: ${ButtonVariantToken[variant].pressed.unselectedIconColor};
1135
+ }
1136
+ :host([variant="${unsafeCSS(variant)}"][toggle][selected].-pressed:not(:disabled):not([disabled-interactive]))
1137
+ .icon {
1138
+ color: ${ButtonVariantToken[variant].pressed.selectedIconColor};
1139
+ }
1140
+ :host([variant="${unsafeCSS(variant)}"]:disabled) .base,
1141
+ :host([variant="${unsafeCSS(variant)}"][disabled-interactive]) .base {
1142
+ --m3e-elevation-level: ${ButtonVariantToken[variant].disabled.containerElevation ?? unsafeCSS("unset")};
1143
+ outline-color: ${ButtonVariantToken[variant].disabled.outlineColor ?? unsafeCSS("unset")};
1144
+ background-color: color-mix(
1145
+ in srgb,
1146
+ ${ButtonVariantToken[variant].disabled.containerColor} ${ButtonVariantToken[variant].disabled.containerOpacity},
1147
+ transparent
1148
+ );
1149
+ }
1150
+ :host([variant="${unsafeCSS(variant)}"]:disabled) .label,
1151
+ :host([variant="${unsafeCSS(variant)}"][disabled-interactive]) .label {
1152
+ color: color-mix(
1153
+ in srgb,
1154
+ ${ButtonVariantToken[variant].disabled.labelTextColor} ${ButtonVariantToken[variant].disabled.labelTextOpacity},
1155
+ transparent
1156
+ );
1157
+ }
1158
+ :host([variant="${unsafeCSS(variant)}"]:disabled) .icon,
1159
+ :host([variant="${unsafeCSS(variant)}"][disabled-interactive]) .icon {
1160
+ color: color-mix(
1161
+ in srgb,
1162
+ ${ButtonVariantToken[variant].disabled.iconColor} ${ButtonVariantToken[variant].disabled.iconOpacity},
1163
+ transparent
1164
+ );
1165
+ }
1166
+ `;
1167
+ }
1168
+ /**
1169
+ * Appearance variant styles for `M3eButtonElement`.
1170
+ * @internal
1171
+ */
1172
+ const ButtonVariantStyle = [
1173
+ buttonVariantStyle("text"),
1174
+ buttonVariantStyle("elevated"),
1175
+ buttonVariantStyle("outlined"),
1176
+ buttonVariantStyle("filled"),
1177
+ buttonVariantStyle("tonal"),
1178
+ css `
1179
+ :host([variant="outlined"]) .base {
1180
+ outline-style: solid;
1181
+ }
1182
+ `,
1183
+ ];
1184
+
1185
+ var _M3eButtonElement_instances, _M3eButtonElement_clickHandler, _M3eButtonElement_handleClick, _M3eButtonElement_handleSelectedIconSlotChange, _M3eButtonElement_updateButtonShape;
1186
+ /**
1187
+ * @summary
1188
+ * A button users interact with to perform an action.
1189
+ *
1190
+ * @description
1191
+ * The `m3e-button` component is a semantic, expressive UI primitive users interact with to perform an action.
1192
+ * Designed according to Material Design 3 guidelines, it supports five visual variants, specified using the
1193
+ * `variant` attribute—`filled`, `tonal`, `elevated`, `outlined`, and `text`—each with dynamic elevation,
1194
+ * shape morphing, and adaptive color theming. The component responds to interaction states (hover, focus, press, disabled)
1195
+ * with smooth motion transitions, ensuring emotional clarity and visual hierarchy.
1196
+ *
1197
+ * The component is accessible by default, with ARIA roles, contrast-safe color tokens, and strong focus indicators.
1198
+ * It supports optional icons and states for binary actions. When using `m3e-icon` for icons, `filled` is automatically
1199
+ * set based on the selected state of a toggle button. It can also function as a link or be used to submit form data.
1200
+ *
1201
+ * Native disabled `<button>` elements cannot receive focus. This can be problematic in some cases because it can prevent you
1202
+ * from telling the user why the button is disabled. You can use the `disabled-interactive` attribute to style a `m3e-button`
1203
+ * as disabled but allow for it to receive focus. The button will have `aria-disabled="true"` for assistive technology.
1204
+ *
1205
+ * @example
1206
+ * The following example illustrates changing the appearance from `text` (default), to `tonal` using the `variant` attribute.
1207
+ * ```html
1208
+ * <m3e-button variant="tonal">Tonal Button</m3e-button>
1209
+ * ```
1210
+ *
1211
+ * @tag m3e-button
1212
+ *
1213
+ * @slot - Renders the label of the button.
1214
+ * @slot icon - Renders an icon before the button's label.
1215
+ * @slot selected - Renders the label of the button, when selected.
1216
+ * @slot selected-icon - Renders an icon before the button's label, when selected.
1217
+ * @slot trailing-icon - Renders an icon after the button's label.
1218
+ *
1219
+ * @attr disabled - Whether the element is disabled.
1220
+ * @attr disabled-interactive - Whether the element is disabled and interactive.
1221
+ * @attr download - A value indicating whether the `target` of the link button will be downloaded, optionally specifying the new name of the file.
1222
+ * @attr href - The URL to which the link button points.
1223
+ * @attr name - The name of the element, submitted as a pair with the element's `value` as part of form data, when the element is used to submit a form.
1224
+ * @attr rel - The relationship between the `target` of the link button and the document.
1225
+ * @attr selected - Whether the toggle button is selected.
1226
+ * @attr shape - The shape of the button.
1227
+ * @attr size - The size of the button.
1228
+ * @attr target - The target of the link button.
1229
+ * @attr toggle - Whether the button will toggle between selected and unselected states.
1230
+ * @attr type - The type of the element.
1231
+ * @attr value - The value associated with the element's name when it's submitted with form data.
1232
+ * @attr variant - The appearance variant of the button.
1233
+ *
1234
+ * @fires input - Dispatched when a toggle button's selected state changes.
1235
+ * @fires change - Dispatched when a toggle button's selected state changes.
1236
+ *
1237
+ * @cssprop --m3e-button-extra-small-container-height - Height of the button container, for the extra-small size variant.
1238
+ * @cssprop --m3e-button-extra-small-outline-thickness - Thickness of the button outline, for the extra-small size variant.
1239
+ * @cssprop --m3e-button-extra-small-label-text-font-size - Font size for the label text, for the extra-small size variant.
1240
+ * @cssprop --m3e-button-extra-small-label-text-font-weight - Font weight for the label text, for the extra-small size variant.
1241
+ * @cssprop --m3e-button-extra-small-label-text-line-height - Line height for the label text, for the extra-small size variant.
1242
+ * @cssprop --m3e-button-extra-small-label-text-tracking - Letter tracking for the label text, for the extra-small size variant.
1243
+ * @cssprop --m3e-button-extra-small-icon-size - Size of the icon, for the extra-small size variant.
1244
+ * @cssprop --m3e-button-extra-small-shape-round - Corner radius for round shape, for the extra-small size variant.
1245
+ * @cssprop --m3e-button-extra-small-shape-square - Corner radius for square shape, for the extra-small size variant.
1246
+ * @cssprop --m3e-button-extra-small-selected-shape-round - Corner radius when selected (round), for the extra-small size variant.
1247
+ * @cssprop --m3e-button-extra-small-selected-shape-square - Corner radius when selected (square), for the extra-small size variant.
1248
+ * @cssprop --m3e-button-extra-small-shape-pressed-morph - Corner radius when pressed, for the extra-small size variant.
1249
+ * @cssprop --m3e-button-extra-small-leading-space - Space before icon or label, for the extra-small size variant.
1250
+ * @cssprop --m3e-button-extra-small-trailing-space - Space after icon or label, for the extra-small size variant.
1251
+ * @cssprop --m3e-button-extra-small-icon-label-space - Space between icon and label, for the extra-small size variant.
1252
+ * @cssprop --m3e-button-small-container-height - Height of the button container, for the small size variant.
1253
+ * @cssprop --m3e-button-small-outline-thickness - Thickness of the button outline, for the small size variant.
1254
+ * @cssprop --m3e-button-small-label-text-font-size - Font size for the label text, for the small size variant.
1255
+ * @cssprop --m3e-button-small-label-text-font-weight - Font weight for the label text, for the small size variant.
1256
+ * @cssprop --m3e-button-small-label-text-line-height - Line height for the label text, for the small size variant.
1257
+ * @cssprop --m3e-button-small-label-text-tracking - Letter tracking for the label text, for the small size variant.
1258
+ * @cssprop --m3e-button-small-icon-size - Size of the icon, for the small size variant.
1259
+ * @cssprop --m3e-button-small-shape-round - Corner radius for round shape, for the small size variant.
1260
+ * @cssprop --m3e-button-small-shape-square - Corner radius for square shape, for the small size variant.
1261
+ * @cssprop --m3e-button-small-selected-shape-round - Corner radius when selected (round), for the small size variant.
1262
+ * @cssprop --m3e-button-small-selected-shape-square - Corner radius when selected (square), for the small size variant.
1263
+ * @cssprop --m3e-button-small-shape-pressed-morph - Corner radius when pressed, for the small size variant.
1264
+ * @cssprop --m3e-button-small-leading-space - Space before icon or label, for the small size variant.
1265
+ * @cssprop --m3e-button-small-trailing-space - Space after icon or label, for the small size variant.
1266
+ * @cssprop --m3e-button-small-icon-label-space - Space between icon and label, for the small size variant.
1267
+ * @cssprop --m3e-button-medium-container-height - Height of the button container, for the medium size variant.
1268
+ * @cssprop --m3e-button-medium-outline-thickness - Thickness of the button outline, for the medium size variant.
1269
+ * @cssprop --m3e-button-medium-label-text-font-size - Font size for the label text, for the medium size variant.
1270
+ * @cssprop --m3e-button-medium-label-text-font-weight - Font weight for the label text, for the medium size variant.
1271
+ * @cssprop --m3e-button-medium-label-text-line-height - Line height for the label text, for the medium size variant.
1272
+ * @cssprop --m3e-button-medium-label-text-tracking - Letter tracking for the label text, for the medium size variant.
1273
+ * @cssprop --m3e-button-medium-icon-size - Size of the icon, for the medium size variant.
1274
+ * @cssprop --m3e-button-medium-shape-round - Corner radius for round shape, for the medium size variant.
1275
+ * @cssprop --m3e-button-medium-shape-square - Corner radius for square shape, for the medium size variant.
1276
+ * @cssprop --m3e-button-medium-selected-shape-round - Corner radius when selected (round), for the medium size variant.
1277
+ * @cssprop --m3e-button-medium-selected-shape-square - Corner radius when selected (square), for the medium size variant.
1278
+ * @cssprop --m3e-button-medium-shape-pressed-morph - Corner radius when pressed, for the medium size variant.
1279
+ * @cssprop --m3e-button-medium-leading-space - Space before icon or label, for the medium size variant.
1280
+ * @cssprop --m3e-button-medium-trailing-space - Space after icon or label, for the medium size variant.
1281
+ * @cssprop --m3e-button-medium-icon-label-space - Space between icon and label, for the medium size variant.
1282
+ * @cssprop --m3e-button-large-container-height - Height of the button container, for the large size variant.
1283
+ * @cssprop --m3e-button-large-outline-thickness - Thickness of the button outline, for the large size variant.
1284
+ * @cssprop --m3e-button-large-label-text-font-size - Font size for the label text, for the large size variant.
1285
+ * @cssprop --m3e-button-large-label-text-font-weight - Font weight for the label text, for the large size variant.
1286
+ * @cssprop --m3e-button-large-label-text-line-height - Line height for the label text, for the large size variant.
1287
+ * @cssprop --m3e-button-large-label-text-tracking - Letter tracking for the label text, for the large size variant.
1288
+ * @cssprop --m3e-button-large-icon-size - Size of the icon, for the large size variant.
1289
+ * @cssprop --m3e-button-large-shape-round - Corner radius for round shape, for the large size variant.
1290
+ * @cssprop --m3e-button-large-shape-square - Corner radius for square shape, for the large size variant.
1291
+ * @cssprop --m3e-button-large-selected-shape-round - Corner radius when selected (round), for the large size variant.
1292
+ * @cssprop --m3e-button-large-selected-shape-square - Corner radius when selected (square), for the large size variant.
1293
+ * @cssprop --m3e-button-large-shape-pressed-morph - Corner radius when pressed, for the large size variant.
1294
+ * @cssprop --m3e-button-large-leading-space - Space before icon or label, for the large size variant.
1295
+ * @cssprop --m3e-button-large-trailing-space - Space after icon or label, for the large size variant.
1296
+ * @cssprop --m3e-button-large-icon-label-space - Space between icon and label, for the large size variant.
1297
+ * @cssprop --m3e-button-extra-large-container-height - Height of the button container, for the extra-large size variant.
1298
+ * @cssprop --m3e-button-extra-large-outline-thickness - Thickness of the button outline, for the extra-large size variant.
1299
+ * @cssprop --m3e-button-extra-large-label-text-font-size - Font size for the label text, for the extra-large size variant.
1300
+ * @cssprop --m3e-button-extra-large-label-text-font-weight - Font weight for the label text, for the extra-large size variant.
1301
+ * @cssprop --m3e-button-extra-large-label-text-line-height - Line height for the label text, for the extra-large size variant.
1302
+ * @cssprop --m3e-button-extra-large-label-text-tracking - Letter tracking for the label text, for the extra-large size variant.
1303
+ * @cssprop --m3e-button-extra-large-icon-size - Size of the icon, for the extra-large size variant.
1304
+ * @cssprop --m3e-button-extra-large-shape-round - Corner radius for round shape, for the extra-large size variant.
1305
+ * @cssprop --m3e-button-extra-large-shape-square - Corner radius for square shape, for the extra-large size variant.
1306
+ * @cssprop --m3e-button-extra-large-selected-shape-round - Corner radius when selected (round), for the extra-large size variant.
1307
+ * @cssprop --m3e-button-extra-large-selected-shape-square - Corner radius when selected (square), for the extra-large size variant.
1308
+ * @cssprop --m3e-button-extra-large-shape-pressed-morph - Corner radius when pressed, for the extra-large size variant.
1309
+ * @cssprop --m3e-button-extra-large-leading-space - Space before icon or label, for the extra-large size variant.
1310
+ * @cssprop --m3e-button-extra-large-trailing-space - Space after icon or label, for the extra-large size variant.
1311
+ * @cssprop --m3e-button-extra-large-icon-label-space - Space between icon and label, for the extra-large size variant.
1312
+ * @cssprop --m3e-elevated-button-label-text-color - Label color, for the elevated variant.
1313
+ * @cssprop --m3e-elevated-button-icon-color - Icon color, for the elevated variant.
1314
+ * @cssprop --m3e-elevated-button-container-color - Container background color, for the elevated variant.
1315
+ * @cssprop --m3e-elevated-button-container-elevation - Elevation, for the elevated variant.
1316
+ * @cssprop --m3e-elevated-button-unselected-label-text-color - Unselected label color, for the elevated variant.
1317
+ * @cssprop --m3e-elevated-button-unselected-icon-color - Unselected icon color, for the elevated variant.
1318
+ * @cssprop --m3e-elevated-button-unselected-container-color - Unselected container color, for the elevated variant.
1319
+ * @cssprop --m3e-elevated-button-selected-label-text-color - Selected label color, for the elevated variant.
1320
+ * @cssprop --m3e-elevated-button-selected-icon-color - Selected icon color, for the elevated variant.
1321
+ * @cssprop --m3e-elevated-button-selected-container-color - Selected container color, for the elevated variant.
1322
+ * @cssprop --m3e-elevated-button-disabled-container-color - Disabled container color, for the elevated variant.
1323
+ * @cssprop --m3e-elevated-button-disabled-container-opacity - Disabled container opacity, for the elevated variant.
1324
+ * @cssprop --m3e-elevated-button-disabled-icon-color - Disabled icon color, for the elevated variant.
1325
+ * @cssprop --m3e-elevated-button-disabled-icon-opacity - Disabled icon opacity, for the elevated variant.
1326
+ * @cssprop --m3e-elevated-button-disabled-label-text-color - Disabled label color, for the elevated variant.
1327
+ * @cssprop --m3e-elevated-button-disabled-label-text-opacity - Disabled label opacity, for the elevated variant.
1328
+ * @cssprop --m3e-elevated-button-disabled-container-elevation - Disabled elevation, for the elevated variant.
1329
+ * @cssprop --m3e-elevated-button-hover-icon-color - Hover icon color, for the elevated variant.
1330
+ * @cssprop --m3e-elevated-button-hover-label-text-color - Hover label color, for the elevated variant.
1331
+ * @cssprop --m3e-elevated-button-hover-state-layer-color - Hover state layer color, for the elevated variant.
1332
+ * @cssprop --m3e-elevated-button-hover-state-layer-opacity - Hover state layer opacity, for the elevated variant.
1333
+ * @cssprop --m3e-elevated-button-hover-container-elevation - Hover elevation, for the elevated variant.
1334
+ * @cssprop --m3e-elevated-button-hover-unselected-icon-color - Hover unselected icon color, for the elevated variant.
1335
+ * @cssprop --m3e-elevated-button-hover-unselected-label-text-color - Hover unselected label color, for the elevated variant.
1336
+ * @cssprop --m3e-elevated-button-hover-unselected-state-layer-color - Hover unselected state layer color, for the elevated variant.
1337
+ * @cssprop --m3e-elevated-button-hover-selected-icon-color - Hover selected icon color, for the elevated variant.
1338
+ * @cssprop --m3e-elevated-button-hover-selected-label-text-color - Hover selected label color, for the elevated variant.
1339
+ * @cssprop --m3e-elevated-button-hover-selected-state-layer-color - Hover selected state layer color, for the elevated variant.
1340
+ * @cssprop --m3e-elevated-button-focus-icon-color - Focus icon color, for the elevated variant.
1341
+ * @cssprop --m3e-elevated-button-focus-label-text-color - Focus label color, for the elevated variant.
1342
+ * @cssprop --m3e-elevated-button-focus-state-layer-color - Focus state layer color, for the elevated variant.
1343
+ * @cssprop --m3e-elevated-button-focus-state-layer-opacity - Focus state layer opacity, for the elevated variant.
1344
+ * @cssprop --m3e-elevated-button-focus-container-elevation - Focus elevation, for the elevated variant.
1345
+ * @cssprop --m3e-elevated-button-focus-unselected-label-text-color - Focus unselected label color, for the elevated variant.
1346
+ * @cssprop --m3e-elevated-button-focus-unselected-icon-color - Focus unselected icon color, for the elevated variant.
1347
+ * @cssprop --m3e-elevated-button-focus-unselected-state-layer-color - Focus unselected state layer color, for the elevated variant.
1348
+ * @cssprop --m3e-elevated-button-focus-selected-icon-color - Focus selected icon color, for the elevated variant.
1349
+ * @cssprop --m3e-elevated-button-focus-selected-label-text-color - Focus selected label color, for the elevated variant.
1350
+ * @cssprop --m3e-elevated-button-focus-selected-state-layer-color - Focus selected state layer color, for the elevated variant.
1351
+ * @cssprop --m3e-elevated-button-pressed-icon-color - Pressed icon color, for the elevated variant.
1352
+ * @cssprop --m3e-elevated-button-pressed-label-text-color - Pressed label color, for the elevated variant.
1353
+ * @cssprop --m3e-elevated-button-pressed-state-layer-color - Pressed state layer color, for the elevated variant.
1354
+ * @cssprop --m3e-elevated-button-pressed-state-layer-opacity - Pressed state layer opacity, for the elevated variant.
1355
+ * @cssprop --m3e-elevated-button-pressed-container-elevation - Pressed elevation, for the elevated variant.
1356
+ * @cssprop --m3e-elevated-button-pressed-unselected-label-text-color - Pressed unselected label color, for the elevated variant.
1357
+ * @cssprop --m3e-elevated-button-pressed-unselected-icon-color - Pressed unselected icon color, for the elevated variant.
1358
+ * @cssprop --m3e-elevated-button-pressed-unselected-state-layer-color - Pressed unselected state layer color, for the elevated variant.
1359
+ * @cssprop --m3e-elevated-button-pressed-selected-icon-color - Pressed selected icon color, for the elevated variant.
1360
+ * @cssprop --m3e-elevated-button-pressed-selected-label-text-color - Pressed selected label color, for the elevated variant.
1361
+ * @cssprop --m3e-elevated-button-pressed-selected-state-layer-color - Pressed selected state layer color, for the elevated variant.
1362
+ * @cssprop --m3e-outlined-button-label-text-color - Label color, for the outlined variant.
1363
+ * @cssprop --m3e-outlined-button-icon-color - Icon color, for the outlined variant.
1364
+ * @cssprop --m3e-outlined-button-outline-color - Outline color, for the outlined variant.
1365
+ * @cssprop --m3e-outlined-button-unselected-label-text-color - Unselected label color, for the outlined variant.
1366
+ * @cssprop --m3e-outlined-button-unselected-icon-color - Unselected icon color, for the outlined variant.
1367
+ * @cssprop --m3e-outlined-button-selected-label-text-color - Selected label color, for the outlined variant.
1368
+ * @cssprop --m3e-outlined-button-selected-icon-color - Selected icon color, for the outlined variant.
1369
+ * @cssprop --m3e-outlined-button-selected-container-color - Selected container color, for the outlined variant.
1370
+ * @cssprop --m3e-outlined-button-disabled-container-color - Disabled container color, for the outlined variant.
1371
+ * @cssprop --m3e-outlined-button-disabled-container-opacity - Disabled container opacity, for the outlined variant.
1372
+ * @cssprop --m3e-outlined-button-disabled-icon-color - Disabled icon color, for the outlined variant.
1373
+ * @cssprop --m3e-outlined-button-disabled-icon-opacity - Disabled icon opacity, for the outlined variant.
1374
+ * @cssprop --m3e-outlined-button-disabled-label-text-color - Disabled label color, for the outlined variant.
1375
+ * @cssprop --m3e-outlined-button-disabled-label-text-opacity - Disabled label opacity, for the outlined variant.
1376
+ * @cssprop --m3e-outlined-button-disabled-outline-color - Disabled outline color, for the outlined variant.
1377
+ * @cssprop --m3e-outlined-button-hover-icon-color - Hover icon color, for the outlined variant.
1378
+ * @cssprop --m3e-outlined-button-hover-label-text-color - Hover label color, for the outlined variant.
1379
+ * @cssprop --m3e-outlined-button-hover-outline-color - Hover outline color, for the outlined variant.
1380
+ * @cssprop --m3e-outlined-button-hover-state-layer-color - Hover state layer color, for the outlined variant.
1381
+ * @cssprop --m3e-outlined-button-hover-state-layer-opacity - Hover state layer opacity, for the outlined variant.
1382
+ * @cssprop --m3e-outlined-button-hover-unselected-icon-color - Hover unselected icon color, for the outlined variant.
1383
+ * @cssprop --m3e-outlined-button-hover-unselected-label-text-color - Hover unselected label color, for the outlined variant.
1384
+ * @cssprop --m3e-outlined-button-hover-unselected-state-layer-color - Hover unselected state layer color, for the outlined variant.
1385
+ * @cssprop --m3e-outlined-button-hover-selected-icon-color - Hover selected icon color, for the outlined variant.
1386
+ * @cssprop --m3e-outlined-button-hover-selected-label-text-color - Hover selected label color, for the outlined variant.
1387
+ * @cssprop --m3e-outlined-button-hover-selected-state-layer-color - Hover selected state layer color, for the outlined variant.
1388
+ * @cssprop --m3e-outlined-button-focus-icon-color - Focus icon color, for the outlined variant.
1389
+ * @cssprop --m3e-outlined-button-focus-label-text-color - Focus label color, for the outlined variant.
1390
+ * @cssprop --m3e-outlined-button-focus-outline-color - Focus outline color, for the outlined variant.
1391
+ * @cssprop --m3e-outlined-button-focus-state-layer-color - Focus state layer color, for the outlined variant.
1392
+ * @cssprop --m3e-outlined-button-focus-state-layer-opacity - Focus state layer opacity, for the outlined variant.
1393
+ * @cssprop --m3e-outlined-button-focus-unselected-icon-color - Focus unselected icon color, for the outlined variant.
1394
+ * @cssprop --m3e-outlined-button-focus-unselected-label-text-color - Focus unselected label color, for the outlined variant.
1395
+ * @cssprop --m3e-outlined-button-focus-unselected-state-layer-color - Focus unselected state layer color, for the outlined variant.
1396
+ * @cssprop --m3e-outlined-button-focus-selected-icon-color - Focus selected icon color, for the outlined variant.
1397
+ * @cssprop --m3e-outlined-button-focus-selected-label-text-color - Focus selected label color, for the outlined variant.
1398
+ * @cssprop --m3e-outlined-button-focus-selected-state-layer-color - Focus selected state layer color, for the outlined variant.
1399
+ * @cssprop --m3e-outlined-button-pressed-icon-color - Pressed icon color, for the outlined variant.
1400
+ * @cssprop --m3e-outlined-button-pressed-label-text-color - Pressed label color, for the outlined variant.
1401
+ * @cssprop --m3e-outlined-button-pressed-outline-color - Pressed outline color, for the outlined variant.
1402
+ * @cssprop --m3e-outlined-button-pressed-state-layer-color - Pressed state layer color, for the outlined variant.
1403
+ * @cssprop --m3e-outlined-button-pressed-state-layer-opacity - Pressed state layer opacity, for the outlined variant.
1404
+ * @cssprop --m3e-outlined-button-pressed-unselected-icon-color - Pressed unselected icon color, for the outlined variant.
1405
+ * @cssprop --m3e-outlined-button-pressed-unselected-label-text-color - Pressed unselected label color, for the outlined variant.
1406
+ * @cssprop --m3e-outlined-button-pressed-unselected-state-layer-color - Pressed unselected state layer color, for the outlined variant.
1407
+ * @cssprop --m3e-outlined-button-pressed-selected-icon-color - Pressed selected icon color, for the outlined variant.
1408
+ * @cssprop --m3e-outlined-button-pressed-selected-label-text-color - Pressed selected label color, for the outlined variant.
1409
+ * @cssprop --m3e-outlined-button-pressed-selected-state-layer-color - Pressed selected state layer color, for the outlined variant.
1410
+ * @cssprop --m3e-filled-button-label-text-color - Label color, for the filled variant.
1411
+ * @cssprop --m3e-filled-button-icon-color - Icon color, for the filled variant.
1412
+ * @cssprop --m3e-filled-button-container-color - Container background color, for the filled variant.
1413
+ * @cssprop --m3e-filled-button-container-elevation - Elevation, for the filled variant.
1414
+ * @cssprop --m3e-filled-button-unselected-label-text-color - Unselected label color, for the filled variant.
1415
+ * @cssprop --m3e-filled-button-unselected-icon-color - Unselected icon color, for the filled variant.
1416
+ * @cssprop --m3e-filled-button-unselected-container-color - Unselected container color, for the filled variant.
1417
+ * @cssprop --m3e-filled-button-selected-label-text-color - Selected label color, for the filled variant.
1418
+ * @cssprop --m3e-filled-button-selected-icon-color - Selected icon color, for the filled variant.
1419
+ * @cssprop --m3e-filled-button-selected-container-color - Selected container color, for the filled variant.
1420
+ * @cssprop --m3e-filled-button-disabled-container-color - Disabled container color, for the filled variant.
1421
+ * @cssprop --m3e-filled-button-disabled-container-opacity - Disabled container opacity, for the filled variant.
1422
+ * @cssprop --m3e-filled-button-disabled-icon-color - Disabled icon color, for the filled variant.
1423
+ * @cssprop --m3e-filled-button-disabled-icon-opacity - Disabled icon opacity, for the filled variant.
1424
+ * @cssprop --m3e-filled-button-disabled-label-text-color - Disabled label color, for the filled variant.
1425
+ * @cssprop --m3e-filled-button-disabled-label-text-opacity - Disabled label opacity, for the filled variant.
1426
+ * @cssprop --m3e-filled-button-disabled-container-elevation - Disabled elevation, for the filled variant.
1427
+ * @cssprop --m3e-filled-button-hover-icon-color - Hover icon color, for the filled variant.
1428
+ * @cssprop --m3e-filled-button-hover-label-text-color - Hover label color, for the filled variant.
1429
+ * @cssprop --m3e-filled-button-hover-state-layer-color - Hover state layer color, for the filled variant.
1430
+ * @cssprop --m3e-filled-button-hover-state-layer-opacity - Hover state layer opacity, for the filled variant.
1431
+ * @cssprop --m3e-filled-button-hover-container-elevation - Hover elevation, for the filled variant.
1432
+ * @cssprop --m3e-filled-button-hover-unselected-icon-color - Hover unselected icon color, for the filled variant.
1433
+ * @cssprop --m3e-filled-button-hover-unselected-label-text-color - Hover unselected label color, for the filled variant.
1434
+ * @cssprop --m3e-filled-button-hover-unselected-state-layer-color - Hover unselected state layer color, for the filled variant.
1435
+ * @cssprop --m3e-filled-button-hover-selected-icon-color - Hover selected icon color, for the filled variant.
1436
+ * @cssprop --m3e-filled-button-hover-selected-label-text-color - Hover selected label color, for the filled variant.
1437
+ * @cssprop --m3e-filled-button-hover-selected-state-layer-color - Hover selected state layer color, for the filled variant.
1438
+ * @cssprop --m3e-filled-button-focus-icon-color - Focus icon color, for the filled variant.
1439
+ * @cssprop --m3e-filled-button-focus-label-text-color - Focus label color, for the filled variant.
1440
+ * @cssprop --m3e-filled-button-focus-state-layer-color - Focus state layer color, for the filled variant.
1441
+ * @cssprop --m3e-filled-button-focus-state-layer-opacity - Focus state layer opacity, for the filled variant.
1442
+ * @cssprop --m3e-filled-button-focus-container-elevation - Focus elevation, for the filled variant.
1443
+ * @cssprop --m3e-filled-button-focus-unselected-icon-color - Focus unselected icon color, for the filled variant.
1444
+ * @cssprop --m3e-filled-button-focus-unselected-label-text-color - Focus unselected label color, for the filled variant.
1445
+ * @cssprop --m3e-filled-button-focus-unselected-state-layer-color - Focus unselected state layer color, for the filled variant.
1446
+ * @cssprop --m3e-filled-button-focus-selected-icon-color - Focus selected icon color, for the filled variant.
1447
+ * @cssprop --m3e-filled-button-focus-selected-label-text-color - Focus selected label color, for the filled variant.
1448
+ * @cssprop --m3e-filled-button-focus-selected-state-layer-color - Focus selected state layer color, for the filled variant.
1449
+ * @cssprop --m3e-filled-button-pressed-icon-color - Pressed icon color, for the filled variant.
1450
+ * @cssprop --m3e-filled-button-pressed-label-text-color - Pressed label color, for the filled variant.
1451
+ * @cssprop --m3e-filled-button-pressed-state-layer-color - Pressed state layer color, for the filled variant.
1452
+ * @cssprop --m3e-filled-button-pressed-state-layer-opacity - Pressed state layer opacity, for the filled variant.
1453
+ * @cssprop --m3e-filled-button-pressed-container-elevation - Pressed elevation, for the filled variant.
1454
+ * @cssprop --m3e-filled-button-pressed-unselected-icon-color - Pressed unselected icon color, for the filled variant.
1455
+ * @cssprop --m3e-filled-button-pressed-unselected-label-text-color - Pressed unselected label color, for the filled variant.
1456
+ * @cssprop --m3e-filled-button-pressed-unselected-state-layer-color - Pressed unselected state layer color, for the filled variant.
1457
+ * @cssprop --m3e-filled-button-pressed-selected-icon-color - Pressed selected icon color, for the filled variant.
1458
+ * @cssprop --m3e-filled-button-pressed-selected-label-text-color - Pressed selected label color, for the filled variant.
1459
+ * @cssprop --m3e-filled-button-pressed-selected-state-layer-color - Pressed selected state layer color, for the filled variant.
1460
+ * @cssprop --m3e-tonal-button-label-text-color - Label color, for the tonal variant.
1461
+ * @cssprop --m3e-tonal-button-icon-color - Icon color, for the tonal variant.
1462
+ * @cssprop --m3e-tonal-button-container-color - Container background color, for the tonal variant.
1463
+ * @cssprop --m3e-tonal-button-container-elevation - Elevation, for the tonal variant.
1464
+ * @cssprop --m3e-tonal-button-unselected-label-text-color - Unselected label color, for the tonal variant.
1465
+ * @cssprop --m3e-tonal-button-unselected-icon-color - Unselected icon color, for the tonal variant.
1466
+ * @cssprop --m3e-tonal-button-unselected-container-color - Unselected container color, for the tonal variant.
1467
+ * @cssprop --m3e-tonal-button-selected-label-text-color - Selected label color, for the tonal variant.
1468
+ * @cssprop --m3e-tonal-button-selected-icon-color - Selected icon color, for the tonal variant.
1469
+ * @cssprop --m3e-tonal-button-selected-container-color - Selected container color, for the tonal variant.
1470
+ * @cssprop --m3e-tonal-button-disabled-container-color - Disabled container color, for the tonal variant.
1471
+ * @cssprop --m3e-tonal-button-disabled-container-opacity - Disabled container opacity, for the tonal variant.
1472
+ * @cssprop --m3e-tonal-button-disabled-icon-color - Disabled icon color, for the tonal variant.
1473
+ * @cssprop --m3e-tonal-button-disabled-icon-opacity - Disabled icon opacity, for the tonal variant.
1474
+ * @cssprop --m3e-tonal-button-disabled-label-text-color - Disabled label color, for the tonal variant.
1475
+ * @cssprop --m3e-tonal-button-disabled-label-text-opacity - Disabled label opacity, for the tonal variant.
1476
+ * @cssprop --m3e-tonal-button-disabled-container-elevation - Disabled elevation, for the tonal variant.
1477
+ * @cssprop --m3e-tonal-button-hover-icon-color - Hover icon color, for the tonal variant.
1478
+ * @cssprop --m3e-tonal-button-hover-label-text-color - Hover label color, for the tonal variant.
1479
+ * @cssprop --m3e-tonal-button-hover-state-layer-color - Hover state layer color, for the tonal variant.
1480
+ * @cssprop --m3e-tonal-button-hover-state-layer-opacity - Hover state layer opacity, for the tonal variant.
1481
+ * @cssprop --m3e-tonal-button-hover-container-elevation - Hover elevation, for the tonal variant.
1482
+ * @cssprop --m3e-tonal-button-hover-unselected-icon-color - Hover unselected icon color, for the tonal variant.
1483
+ * @cssprop --m3e-tonal-button-hover-unselected-label-text-color - Hover unselected label color, for the tonal variant.
1484
+ * @cssprop --m3e-tonal-button-hover-unselected-state-layer-color - Hover unselected state layer color, for the tonal variant.
1485
+ * @cssprop --m3e-tonal-button-hover-selected-icon-color - Hover selected icon color, for the tonal variant.
1486
+ * @cssprop --m3e-tonal-button-hover-selected-label-text-color - Hover selected label color, for the tonal variant.
1487
+ * @cssprop --m3e-tonal-button-hover-selected-state-layer-color - Hover selected state layer color, for the tonal variant.
1488
+ * @cssprop --m3e-tonal-button-focus-icon-color - Focus icon color, for the tonal variant.
1489
+ * @cssprop --m3e-tonal-button-focus-label-text-color - Focus label color, for the tonal variant.
1490
+ * @cssprop --m3e-tonal-button-focus-state-layer-color - Focus state layer color, for the tonal variant.
1491
+ * @cssprop --m3e-tonal-button-focus-state-layer-opacity - Focus state layer opacity, for the tonal variant.
1492
+ * @cssprop --m3e-tonal-button-focus-container-elevation - Focus elevation, for the tonal variant.
1493
+ * @cssprop --m3e-tonal-button-focus-unselected-icon-color - Focus unselected icon color, for the tonal variant.
1494
+ * @cssprop --m3e-tonal-button-focus-unselected-label-text-color - Focus unselected label color, for the tonal variant.
1495
+ * @cssprop --m3e-tonal-button-focus-unselected-state-layer-color - Focus unselected state layer color, for the tonal variant.
1496
+ * @cssprop --m3e-tonal-button-focus-selected-icon-color - Focus selected icon color, for the tonal variant.
1497
+ * @cssprop --m3e-tonal-button-focus-selected-label-text-color - Focus selected label color, for the tonal variant.
1498
+ * @cssprop --m3e-tonal-button-focus-selected-state-layer-color - Focus selected state layer color, for the tonal variant.
1499
+ * @cssprop --m3e-tonal-button-pressed-icon-color - Pressed icon color, for the tonal variant.
1500
+ * @cssprop --m3e-tonal-button-pressed-label-text-color - Pressed label color, for the tonal variant.
1501
+ * @cssprop --m3e-tonal-button-pressed-state-layer-color - Pressed state layer color, for the tonal variant.
1502
+ * @cssprop --m3e-tonal-button-pressed-state-layer-opacity - Pressed state layer opacity, for the tonal variant.
1503
+ * @cssprop --m3e-tonal-button-pressed-container-elevation - Pressed elevation, for the tonal variant.
1504
+ * @cssprop --m3e-tonal-button-pressed-unselected-icon-color - Pressed unselected icon color, for the tonal variant.
1505
+ * @cssprop --m3e-tonal-button-pressed-unselected-label-text-color - Pressed unselected label color, for the tonal variant.
1506
+ * @cssprop --m3e-tonal-button-pressed-unselected-state-layer-color - Pressed unselected state layer color, for the tonal variant.
1507
+ * @cssprop --m3e-tonal-button-pressed-selected-icon-color - Pressed selected icon color, for the tonal variant.
1508
+ * @cssprop --m3e-tonal-button-pressed-selected-label-text-color - Pressed selected label color, for the tonal variant.
1509
+ * @cssprop --m3e-tonal-button-pressed-selected-state-layer-color - Pressed selected state layer color, for the tonal variant.
1510
+ * @cssprop --m3e-text-button-label-text-color - Label color, for the text variant.
1511
+ * @cssprop --m3e-text-button-icon-color - Icon color, for the text variant.
1512
+ * @cssprop --m3e-text-button-unselected-label-text-color - Unselected label color, for the text variant.
1513
+ * @cssprop --m3e-text-button-unselected-icon-color - Unselected icon color, for the text variant.
1514
+ * @cssprop --m3e-text-button-selected-label-text-color - Selected label color, for the text variant.
1515
+ * @cssprop --m3e-text-button-selected-icon-color - Selected icon color, for the text variant.
1516
+ * @cssprop --m3e-text-button-disabled-container-color - Disabled container color, for the text variant.
1517
+ * @cssprop --m3e-text-button-disabled-container-opacity - Disabled container opacity, for the text variant.
1518
+ * @cssprop --m3e-text-button-disabled-icon-color - Disabled icon color, for the text variant.
1519
+ * @cssprop --m3e-text-button-disabled-icon-opacity - Disabled icon opacity, for the text variant.
1520
+ * @cssprop --m3e-text-button-disabled-label-text-color - Disabled label color, for the text variant.
1521
+ * @cssprop --m3e-text-button-disabled-label-text-opacity - Disabled label opacity, for the text variant.
1522
+ * @cssprop --m3e-text-button-hover-icon-color - Hover icon color, for the text variant.
1523
+ * @cssprop --m3e-text-button-hover-label-text-color - Hover label color, for the text variant.
1524
+ * @cssprop --m3e-text-button-hover-state-layer-color - Hover state layer color, for the text variant.
1525
+ * @cssprop --m3e-text-button-hover-state-layer-opacity - Hover state layer opacity, for the text variant.
1526
+ * @cssprop --m3e-text-button-hover-unselected-icon-color - Hover unselected icon color, for the text variant.
1527
+ * @cssprop --m3e-text-button-hover-unselected-label-text-color - Hover unselected label color, for the text variant.
1528
+ * @cssprop --m3e-text-button-hover-unselected-state-layer-color - Hover unselected state layer color, for the text variant.
1529
+ * @cssprop --m3e-text-button-hover-selected-icon-color - Hover selected icon color, for the text variant.
1530
+ * @cssprop --m3e-text-button-hover-selected-label-text-color - Hover selected label color, for the text variant.
1531
+ * @cssprop --m3e-text-button-hover-selected-state-layer-color - Hover selected state layer color, for the text variant.
1532
+ * @cssprop --m3e-text-button-focus-icon-color - Focus icon color, for the text variant.
1533
+ * @cssprop --m3e-text-button-focus-label-text-color - Focus label color, for the text variant.
1534
+ * @cssprop --m3e-text-button-focus-state-layer-color - Focus state layer color, for the text variant.
1535
+ * @cssprop --m3e-text-button-focus-state-layer-opacity - Focus state layer opacity, for the text variant.
1536
+ * @cssprop --m3e-text-button-focus-unselected-icon-color - Focus unselected icon color, for the text variant.
1537
+ * @cssprop --m3e-text-button-focus-unselected-label-text-color - Focus unselected label color, for the text variant.
1538
+ * @cssprop --m3e-text-button-focus-unselected-state-layer-color - Focus unselected state layer color, for the text variant.
1539
+ * @cssprop --m3e-text-button-focus-selected-icon-color - Focus selected icon color, for the text variant.
1540
+ * @cssprop --m3e-text-button-focus-selected-label-text-color - Focus selected label color, for the text variant.
1541
+ * @cssprop --m3e-text-button-focus-selected-state-layer-color - Focus selected state layer color, for the text variant.
1542
+ * @cssprop --m3e-text-button-pressed-icon-color - Pressed icon color, for the text variant.
1543
+ * @cssprop --m3e-text-button-pressed-label-text-color - Pressed label color, for the text variant.
1544
+ * @cssprop --m3e-text-button-pressed-state-layer-color - Pressed state layer color, for the text variant.
1545
+ * @cssprop --m3e-text-button-pressed-state-layer-opacity - Pressed state layer opacity, for the text variant.
1546
+ * @cssprop --m3e-text-button-pressed-unselected-icon-color - Pressed unselected icon color, for the text variant.
1547
+ * @cssprop --m3e-text-button-pressed-unselected-label-text-color - Pressed unselected label color, for the text variant.
1548
+ * @cssprop --m3e-text-button-pressed-unselected-state-layer-color - Pressed unselected state layer color, for the text variant.
1549
+ * @cssprop --m3e-text-button-pressed-selected-icon-color - Pressed selected icon color, for the text variant.
1550
+ * @cssprop --m3e-text-button-pressed-selected-label-text-color - Pressed selected label color, for the text variant.
1551
+ * @cssprop --m3e-text-button-pressed-selected-state-layer-color - Pressed selected state layer color, for the text variant.
1552
+ */
1553
+ let M3eButtonElement = class M3eButtonElement extends KeyboardClick(LinkButton(FormSubmitter(Focusable(DisabledInteractive(Disabled(AttachInternals(Role(LitElement, "button"), true))))))) {
1554
+ constructor() {
1555
+ super();
1556
+ _M3eButtonElement_instances.add(this);
1557
+ /** @private */ _M3eButtonElement_clickHandler.set(this, (e) => __classPrivateFieldGet(this, _M3eButtonElement_instances, "m", _M3eButtonElement_handleClick).call(this, e));
1558
+ /**
1559
+ * The appearance variant of the button.
1560
+ * @default "text"
1561
+ */
1562
+ this.variant = "text";
1563
+ /**
1564
+ * The shape of the button.
1565
+ * @default "rounded"
1566
+ */
1567
+ this.shape = "rounded";
1568
+ /**
1569
+ * The size of the button.
1570
+ * @default "small"
1571
+ */
1572
+ this.size = "small";
1573
+ /**
1574
+ * Whether the button will toggle between selected and unselected states.
1575
+ * @default false
1576
+ */
1577
+ this.toggle = false;
1578
+ /**
1579
+ * Whether the toggle button is selected.
1580
+ * @default false
1581
+ */
1582
+ this.selected = false;
1583
+ new ResizeController(this, {
1584
+ callback: () => {
1585
+ if (this.grouped) {
1586
+ this._handleResize();
1587
+ }
1588
+ },
1589
+ });
1590
+ new FocusController(this, {
1591
+ callback: (focused) => {
1592
+ if (!this.disabledInteractive && this._base) {
1593
+ if (focused) {
1594
+ __classPrivateFieldGet(this, _M3eButtonElement_instances, "m", _M3eButtonElement_updateButtonShape).call(this);
1595
+ }
1596
+ else if (!this.grouped) {
1597
+ this._base?.style.removeProperty("--_button-shape");
1598
+ }
1599
+ }
1600
+ },
1601
+ });
1602
+ new PressedController(this, {
1603
+ isPressedKey: (key) => key === " " || key === "Enter",
1604
+ callback: (pressed) => {
1605
+ if (!this.disabled && !this.disabledInteractive) {
1606
+ this.classList.toggle("-pressed", pressed);
1607
+ this.classList.toggle("-resting", !pressed);
1608
+ const group = this.closest("m3e-button-group");
1609
+ if (group) {
1610
+ const clientWidth = this.getBoundingClientRect().width;
1611
+ const buttons = [...group.querySelectorAll("m3e-button,m3e-icon-button")];
1612
+ const index = buttons.indexOf(this);
1613
+ for (let i = 0; i < buttons.length; i++) {
1614
+ const button = buttons[i];
1615
+ if (i === index - 1) {
1616
+ button.style.setProperty("--_adjacent-button-width", `${clientWidth}px`);
1617
+ button.classList.toggle("-adjacent-pressed", pressed);
1618
+ }
1619
+ else if (i === index + 1) {
1620
+ button.style.setProperty("--_adjacent-button-width", `${clientWidth}px`);
1621
+ button.classList.toggle("-adjacent-pressed", pressed);
1622
+ }
1623
+ else {
1624
+ button.style.removeProperty("--_adjacent-button-width");
1625
+ button.classList.remove("-adjacent-pressed");
1626
+ }
1627
+ }
1628
+ }
1629
+ }
1630
+ },
1631
+ });
1632
+ }
1633
+ /** Whether the button is contained by a button group. */
1634
+ get grouped() {
1635
+ return this.classList.contains("-grouped");
1636
+ }
1637
+ /** @inheritdoc */
1638
+ render() {
1639
+ return html `<div class="base">
1640
+ <m3e-elevation class="elevation" ?disabled="${this.disabled || this.disabledInteractive}"></m3e-elevation>
1641
+ <m3e-state-layer class="state-layer" ?disabled="${this.disabled || this.disabledInteractive}"></m3e-state-layer>
1642
+ <m3e-focus-ring class="focus-ring" ?disabled="${this.disabled}"></m3e-focus-ring>
1643
+ <m3e-ripple class="ripple" ?disabled="${this.disabled || this.disabledInteractive}"></m3e-ripple>
1644
+ <div class="touch" aria-hidden="true"></div>
1645
+ ${this[renderPseudoLink]()}
1646
+ <div class="wrapper">
1647
+ ${this.toggle
1648
+ ? html `<slot
1649
+ class="icon"
1650
+ name="selected-icon"
1651
+ aria-hidden="true"
1652
+ @slotchange="${__classPrivateFieldGet(this, _M3eButtonElement_instances, "m", _M3eButtonElement_handleSelectedIconSlotChange)}"
1653
+ ></slot>`
1654
+ : nothing}
1655
+ <slot class="icon" name="icon" aria-hidden="true"></slot>
1656
+ <div class="label">
1657
+ ${this.toggle && this.selected ? html `<slot name="selected"><slot></slot></slot>` : html `<slot></slot>`}
1658
+ </div>
1659
+ <slot class="icon" name="trailing-icon" aria-hidden="true"></slot>
1660
+ </div>
1661
+ </div>`;
1662
+ }
1663
+ /** @inheritdoc */
1664
+ connectedCallback() {
1665
+ super.connectedCallback();
1666
+ this.addEventListener("click", __classPrivateFieldGet(this, _M3eButtonElement_clickHandler, "f"));
1667
+ }
1668
+ /** @inheritdoc */
1669
+ disconnectedCallback() {
1670
+ super.disconnectedCallback();
1671
+ ["-pressed", "-resting", "-grouped", "-connected"].forEach((x) => this.classList.remove(x));
1672
+ this._base?.style.removeProperty("--_button-shape");
1673
+ this.style.removeProperty("--_button-width");
1674
+ this.style.removeProperty("--_adjacent-button-width");
1675
+ this.classList.remove("-adjacent-pressed");
1676
+ this.removeEventListener("click", __classPrivateFieldGet(this, _M3eButtonElement_clickHandler, "f"));
1677
+ }
1678
+ /** @inheritdoc */
1679
+ firstUpdated(_changedProperties) {
1680
+ super.firstUpdated(_changedProperties);
1681
+ [this._elevation, this._focusRing, this._stateLayer, this._ripple].forEach((x) => x?.attach(this));
1682
+ }
1683
+ /** @inheritdoc */
1684
+ updated(_changedProperties) {
1685
+ super.updated(_changedProperties);
1686
+ if ((_changedProperties.has("disabled") && this.disabled) ||
1687
+ (_changedProperties.has("disabledInteractive") && this.disabledInteractive)) {
1688
+ this.classList.toggle("-pressed", false);
1689
+ this.classList.toggle("-resting", false);
1690
+ }
1691
+ if (_changedProperties.has("toggle") || _changedProperties.has("selected")) {
1692
+ this.ariaPressed = this.toggle ? `${this.selected}` : null;
1693
+ if (this.toggle) {
1694
+ for (const icon of this.querySelectorAll("m3e-icon")) {
1695
+ icon.toggleAttribute("filled", this.selected);
1696
+ }
1697
+ }
1698
+ }
1699
+ }
1700
+ /** @private */
1701
+ _handleResize() {
1702
+ if (this.grouped && !this.classList.contains("-pressed")) {
1703
+ this.style.setProperty("--_button-width", `${this.clientWidth}px`);
1704
+ __classPrivateFieldGet(this, _M3eButtonElement_instances, "m", _M3eButtonElement_updateButtonShape).call(this, true);
1705
+ }
1706
+ }
1707
+ };
1708
+ _M3eButtonElement_clickHandler = new WeakMap();
1709
+ _M3eButtonElement_instances = new WeakSet();
1710
+ _M3eButtonElement_handleClick = function _M3eButtonElement_handleClick(e) {
1711
+ if (this.disabled || this.disabledInteractive) {
1712
+ e.preventDefault();
1713
+ e.stopImmediatePropagation();
1714
+ }
1715
+ if (this.toggle && !e.defaultPrevented) {
1716
+ this.selected = !this.selected;
1717
+ // Dispatch an input event and if not prevented, dispatch a change event.
1718
+ // Otherwise, reset the selected state.
1719
+ if (this.dispatchEvent(new Event("input", { bubbles: true, composed: true, cancelable: true }))) {
1720
+ this.dispatchEvent(new Event("change", { bubbles: true }));
1721
+ }
1722
+ else {
1723
+ this.selected = !this.selected;
1724
+ }
1725
+ }
1726
+ };
1727
+ _M3eButtonElement_handleSelectedIconSlotChange = function _M3eButtonElement_handleSelectedIconSlotChange(e) {
1728
+ this._base?.classList.toggle("with-selected-icon", hasAssignedNodes(e.target));
1729
+ };
1730
+ _M3eButtonElement_updateButtonShape = function _M3eButtonElement_updateButtonShape(force = false) {
1731
+ if (!this._base)
1732
+ return;
1733
+ const shape = parseFloat(getComputedStyle(this._base).borderRadius);
1734
+ if (!isNaN(shape) || force) {
1735
+ const adjustedShape = this.clientHeight / 2;
1736
+ if (adjustedShape < shape || force) {
1737
+ this._base?.style.setProperty("--_button-shape", `${adjustedShape}px`);
1738
+ }
1739
+ }
1740
+ };
1741
+ /** The styles of the element. */
1742
+ M3eButtonElement.styles = [ButtonSizeStyle, ButtonVariantStyle, ButtonStyle];
1743
+ __decorate([
1744
+ e(".base")
1745
+ ], M3eButtonElement.prototype, "_base", void 0);
1746
+ __decorate([
1747
+ e(".elevation")
1748
+ ], M3eButtonElement.prototype, "_elevation", void 0);
1749
+ __decorate([
1750
+ e(".focus-ring")
1751
+ ], M3eButtonElement.prototype, "_focusRing", void 0);
1752
+ __decorate([
1753
+ e(".state-layer")
1754
+ ], M3eButtonElement.prototype, "_stateLayer", void 0);
1755
+ __decorate([
1756
+ e(".ripple")
1757
+ ], M3eButtonElement.prototype, "_ripple", void 0);
1758
+ __decorate([
1759
+ n({ reflect: true })
1760
+ ], M3eButtonElement.prototype, "variant", void 0);
1761
+ __decorate([
1762
+ n({ reflect: true })
1763
+ ], M3eButtonElement.prototype, "shape", void 0);
1764
+ __decorate([
1765
+ n({ reflect: true })
1766
+ ], M3eButtonElement.prototype, "size", void 0);
1767
+ __decorate([
1768
+ n({ type: Boolean, reflect: true })
1769
+ ], M3eButtonElement.prototype, "toggle", void 0);
1770
+ __decorate([
1771
+ n({ type: Boolean, reflect: true })
1772
+ ], M3eButtonElement.prototype, "selected", void 0);
1773
+ __decorate([
1774
+ debounce(40)
1775
+ ], M3eButtonElement.prototype, "_handleResize", null);
1776
+ M3eButtonElement = __decorate([
1777
+ t$1("m3e-button")
1778
+ ], M3eButtonElement);
1779
+
1780
+ export { M3eButtonElement };
1781
+ //# sourceMappingURL=index.js.map