@m3e/chips 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 (45) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +539 -0
  3. package/cem.config.mjs +16 -0
  4. package/demo/index.html +183 -0
  5. package/dist/css-custom-data.json +777 -0
  6. package/dist/custom-elements.json +3307 -0
  7. package/dist/html-custom-data.json +277 -0
  8. package/dist/index.js +1516 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/index.min.js +480 -0
  11. package/dist/index.min.js.map +1 -0
  12. package/dist/src/AssistChipElement.d.ts +82 -0
  13. package/dist/src/AssistChipElement.d.ts.map +1 -0
  14. package/dist/src/ChipElement.d.ts +86 -0
  15. package/dist/src/ChipElement.d.ts.map +1 -0
  16. package/dist/src/ChipSetElement.d.ts +43 -0
  17. package/dist/src/ChipSetElement.d.ts.map +1 -0
  18. package/dist/src/ChipVariant.d.ts +3 -0
  19. package/dist/src/ChipVariant.d.ts.map +1 -0
  20. package/dist/src/FilterChipElement.d.ts +93 -0
  21. package/dist/src/FilterChipElement.d.ts.map +1 -0
  22. package/dist/src/FilterChipSetElement.d.ts +78 -0
  23. package/dist/src/FilterChipSetElement.d.ts.map +1 -0
  24. package/dist/src/InputChipElement.d.ts +104 -0
  25. package/dist/src/InputChipElement.d.ts.map +1 -0
  26. package/dist/src/InputChipSetElement.d.ts +75 -0
  27. package/dist/src/InputChipSetElement.d.ts.map +1 -0
  28. package/dist/src/SuggestionChipElement.d.ts +83 -0
  29. package/dist/src/SuggestionChipElement.d.ts.map +1 -0
  30. package/dist/src/index.d.ts +10 -0
  31. package/dist/src/index.d.ts.map +1 -0
  32. package/eslint.config.mjs +13 -0
  33. package/package.json +55 -0
  34. package/rollup.config.js +32 -0
  35. package/src/AssistChipElement.ts +103 -0
  36. package/src/ChipElement.ts +336 -0
  37. package/src/ChipSetElement.ts +60 -0
  38. package/src/ChipVariant.ts +2 -0
  39. package/src/FilterChipElement.ts +254 -0
  40. package/src/FilterChipSetElement.ts +161 -0
  41. package/src/InputChipElement.ts +287 -0
  42. package/src/InputChipSetElement.ts +360 -0
  43. package/src/SuggestionChipElement.ts +104 -0
  44. package/src/index.ts +9 -0
  45. package/tsconfig.json +9 -0
@@ -0,0 +1,480 @@
1
+ /**
2
+ * @license MIT
3
+ * Copyright (c) 2025 matraic
4
+ * See LICENSE file in the project root for full license text.
5
+ */
6
+ import{LitElement as e,nothing as t,html as i,unsafeCSS as s,css as o}from"lit";import{Role as n,isDisabledMixin as r,isDisabledInteractiveMixin as a,isLinkButtonMixin as l,renderPseudoLink as c,DesignToken as h,hasAssignedNodes as d,getTextContent as p,FormSubmitter as u,AttachInternals as v,LinkButton as m,KeyboardClick as f,Focusable as b,DisabledInteractive as g,Disabled as $,Vertical as y,Selected as _,Labelled as w,Dirty as A,Touched as E,FormAssociated as S,formValue as x,EventAttribute as C,RequiredConstraintValidation as k,Required as P,ConstraintValidation as T}from"@m3e/core";import{selectionManager as M,SelectionManager as I,ListManager as U,ListKeyManager as O}from"@m3e/core/a11y";function L(e,t,i,s){var o,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(n<3?o(r):n>3?o(t,i,r):o(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r}function H(e,t,i,s){if("a"===i&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?s:"a"===i?s.call(e):s?s.value:t.get(e)}function N(e,t,i,s,o){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?o.call(e,i):o?o.value=i:t.set(e,i),i}"function"==typeof SuppressedError&&SuppressedError;
7
+ /**
8
+ * @license
9
+ * Copyright 2017 Google LLC
10
+ * SPDX-License-Identifier: BSD-3-Clause
11
+ */
12
+ const R=e=>(t,i)=>{void 0!==i?i.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)},z=globalThis,W=z.ShadowRoot&&(void 0===z.ShadyCSS||z.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,j=Symbol(),B=new WeakMap;
13
+ /**
14
+ * @license
15
+ * Copyright 2019 Google LLC
16
+ * SPDX-License-Identifier: BSD-3-Clause
17
+ */let D=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==j)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(W&&void 0===e){const i=void 0!==t&&1===t.length;i&&(e=B.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&B.set(t,e))}return e}toString(){return this.cssText}};const q=W?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return(e=>new D("string"==typeof e?e:e+"",void 0,j))(t)})(e):e,{is:V,defineProperty:F,getOwnPropertyDescriptor:K,getOwnPropertyNames:Z,getOwnPropertySymbols:G,getPrototypeOf:J}=Object,Q=globalThis,X=Q.trustedTypes,Y=X?X.emptyScript:"",ee=Q.reactiveElementPolyfillSupport,te=(e,t)=>e,ie={toAttribute(e,t){switch(t){case Boolean:e=e?Y:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},se=(e,t)=>!V(e,t),oe={attribute:!0,type:String,converter:ie,reflect:!1,useDefault:!1,hasChanged:se};
18
+ /**
19
+ * @license
20
+ * Copyright 2017 Google LLC
21
+ * SPDX-License-Identifier: BSD-3-Clause
22
+ */Symbol.metadata??=Symbol("metadata"),Q.litPropertyMetadata??=new WeakMap;class ne extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=oe){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(e,i,t);void 0!==s&&F(this.prototype,e,s)}}static getPropertyDescriptor(e,t,i){const{get:s,set:o}=K(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:s,set(t){const n=s?.call(this);o?.call(this,t),this.requestUpdate(e,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??oe}static _$Ei(){if(this.hasOwnProperty(te("elementProperties")))return;const e=J(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(te("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(te("properties"))){const e=this.properties,t=[...Z(e),...G(e)];for(const i of t)this.createProperty(i,e[i])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,i]of t)this.elementProperties.set(e,i)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const i=this._$Eu(e,t);void 0!==i&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const e of i)t.unshift(q(e))}else void 0!==e&&t.push(q(e));return t}static _$Eu(e,t){const i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(W)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const i of t){const t=document.createElement("style"),s=z.litNonce;void 0!==s&&t.setAttribute("nonce",s),t.textContent=i.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){const i=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,i);if(void 0!==s&&!0===i.reflect){const o=(void 0!==i.converter?.toAttribute?i.converter:ie).toAttribute(t,i.type);this._$Em=e,null==o?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(e,t){const i=this.constructor,s=i._$Eh.get(e);if(void 0!==s&&this._$Em!==s){const e=i.getPropertyOptions(s),o="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:ie;this._$Em=s;const n=o.fromAttribute(t,e.type);this[s]=n??this._$Ej?.get(s)??n,this._$Em=null}}requestUpdate(e,t,i){if(void 0!==e){const s=this.constructor,o=this[e];if(i??=s.getPropertyOptions(e),!((i.hasChanged??se)(o,t)||i.useDefault&&i.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(s._$Eu(e,i))))return;this.C(e,t,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:s,wrapped:o},n){i&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,n??t??this[e]),!0!==o||void 0!==n)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),!0===s&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,i]of e){const{wrapped:e}=i,s=this[t];!0!==e||this._$AL.has(t)||void 0===s||this.C(t,void 0,i,s)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}}ne.elementStyles=[],ne.shadowRootOptions={mode:"open"},ne[te("elementProperties")]=new Map,ne[te("finalized")]=new Map,ee?.({ReactiveElement:ne}),(Q.reactiveElementVersions??=[]).push("2.1.1");
23
+ /**
24
+ * @license
25
+ * Copyright 2017 Google LLC
26
+ * SPDX-License-Identifier: BSD-3-Clause
27
+ */
28
+ const re={attribute:!0,type:String,converter:ie,reflect:!1,hasChanged:se},ae=(e=re,t,i)=>{const{kind:s,metadata:o}=i;let n=globalThis.litPropertyMetadata.get(o);if(void 0===n&&globalThis.litPropertyMetadata.set(o,n=new Map),"setter"===s&&((e=Object.create(e)).wrapped=!0),n.set(i.name,e),"accessor"===s){const{name:s}=i;return{set(i){const o=t.get.call(this);t.set.call(this,i),this.requestUpdate(s,o,e)},init(t){return void 0!==t&&this.C(s,void 0,e,t),t}}}if("setter"===s){const{name:s}=i;return function(i){const o=this[s];t.call(this,i),this.requestUpdate(s,o,e)}}throw Error("Unsupported decorator location: "+s)};function le(e){return(t,i)=>"object"==typeof i?ae(e,t,i):((e,t,i)=>{const s=t.hasOwnProperty(i);return t.constructor.createProperty(i,e),s?Object.getOwnPropertyDescriptor(t,i):void 0})(e,t,i)}
29
+ /**
30
+ * @license
31
+ * Copyright 2017 Google LLC
32
+ * SPDX-License-Identifier: BSD-3-Clause
33
+ */
34
+ /**
35
+ * @license
36
+ * Copyright 2017 Google LLC
37
+ * SPDX-License-Identifier: BSD-3-Clause
38
+ */
39
+ function ce(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,i),i))(t,i,{get(){return(t=>t.renderRoot?.querySelector(e)??null)(this)}})}var he,de,pe,ue,ve,me,fe;let be=class extends(n(e,"none")){constructor(){super(...arguments),he.add(this),de.set(this,void 0),pe.set(this,""),this.variant="outlined"}get value(){return H(this,de,"f")??H(this,pe,"f")}set value(e){N(this,de,e,"f")}firstUpdated(e){super.firstUpdated(e),"listitem"===this.role&&this.removeAttribute("tabindex"),[this._elevation,this._focusRing,this._stateLayer,this._ripple].forEach(e=>{e?.htmlFor||e?.attach(this)})}render(){const e=!r(this)||this.disabled,s=a(this)&&this.disabledInteractive;return i`<div class="base">
40
+ <m3e-elevation class="elevation" ?disabled="${e||s}"></m3e-elevation>
41
+ <m3e-state-layer class="state-layer" ?disabled="${e||s}"></m3e-state-layer>
42
+ <m3e-focus-ring class="focus-ring" ?disabled="${e}"></m3e-focus-ring>
43
+ <m3e-ripple class="ripple" ?disabled="${e||s}"></m3e-ripple>
44
+ <div class="touch" aria-hidden="true"></div>
45
+ ${l(this)?this[c]():t}
46
+ <div class="wrapper">${H(this,he,"m",ue).call(this)}</div>
47
+ </div>`}_renderIcon(){return i`<slot name="icon" aria-hidden="true" @slotchange="${H(this,he,"m",ve)}"></slot>`}_renderTrailingIcon(){return i`<slot
48
+ name="trailing-icon"
49
+ aria-hidden="true"
50
+ @slotchange="${H(this,he,"m",me)}"
51
+ ></slot>`}_renderSlot(){return i`<slot @slotchange="${H(this,he,"m",fe)}"></slot>`}};de=new WeakMap,pe=new WeakMap,he=new WeakSet,ue=function(){return i`${this._renderIcon()}
52
+ <div class="label">${this._renderSlot()}</div>
53
+ ${this._renderTrailingIcon()}`},ve=function(e){this.classList.toggle("-with-icon",d(e.target))},me=function(e){this.classList.toggle("-with-trailing-icon",d(e.target))},fe=function(e){N(this,pe,p(e.target),"f")},be.styles=o`
54
+ :host {
55
+ display: inline-block;
56
+ vertical-align: middle;
57
+ outline: none;
58
+ }
59
+ .base {
60
+ box-sizing: border-box;
61
+ vertical-align: middle;
62
+ display: inline-flex;
63
+ align-items: center;
64
+ justify-content: center;
65
+ position: relative;
66
+ width: 100%;
67
+ transition: ${s(`background-color ${h.motion.duration.short4} ${h.motion.easing.standard}`)};
68
+ border-radius: var(--m3e-chip-container-shape, ${h.shape.corner.small});
69
+ height: calc(var(--m3e-chip-container-height, 2rem) + ${h.density.calc(-2)});
70
+ font-size: var(--m3e-chip-label-text-font-size, ${h.typescale.standard.label.large.fontSize});
71
+ font-weight: var(--m3e-chip-label-text-font-weight, ${h.typescale.standard.label.large.fontWeight});
72
+ line-height: var(--m3e-chip-label-text-line-height, ${h.typescale.standard.label.large.lineHeight});
73
+ letter-spacing: var(--m3e-chip-label-text-tracking, ${h.typescale.standard.label.large.tracking});
74
+ }
75
+ :host(:not(m3e-chip):not(:disabled):not([disabled-interactive])) {
76
+ cursor: pointer;
77
+ }
78
+ :host(:not(m3e-chip):not(:disabled)[disabled-interactive]) {
79
+ cursor: not-allowed;
80
+ }
81
+ :host(:not(m3e-chip):not(:disabled):not([disabled-interactive])) .base {
82
+ user-select: none;
83
+ }
84
+ .touch {
85
+ position: absolute;
86
+ height: 3rem;
87
+ left: 0;
88
+ right: 0;
89
+ }
90
+ .wrapper {
91
+ width: 100%;
92
+ overflow: hidden;
93
+ display: inline-flex;
94
+ align-items: center;
95
+ column-gap: var(--m3e-chip-spacing, 0.5rem);
96
+ }
97
+ .label {
98
+ flex: 1 1 auto;
99
+ min-width: 0;
100
+ white-space: nowrap;
101
+ overflow: hidden;
102
+ text-overflow: ellipsis;
103
+ }
104
+ :host([variant="elevated"]) .base {
105
+ background-color: var(--m3e-elevated-chip-container-color, ${h.color.surfaceContainerLow});
106
+
107
+ --m3e-elevation-level: var(--m3e-elevated-chip-elevation, ${h.elevation.level1});
108
+ --m3e-elevation-hover-level: var(--m3e-elevated-chip-hover-elevation, ${h.elevation.level2});
109
+ --m3e-elevation-focus-level: var(--m3e-elevated-chip-elevation, ${h.elevation.level1});
110
+ --m3e-elevation-pressed-level: var(--m3e-elevated-chip-elevation, ${h.elevation.level1});
111
+ }
112
+ :host([variant="outlined"]) .base {
113
+ outline-width: var(--m3e-outlined-chip-outline-thickness, 1px);
114
+ outline-style: solid;
115
+ outline-offset: calc(0px - var(--m3e-outlined-chip-outline-thickness, 1px));
116
+ }
117
+ :host(:not(:disabled):not([disabled-interactive])[variant="outlined"]) .base {
118
+ outline-color: var(--m3e-outlined-chip-outline-color, ${h.color.outlineVariant});
119
+ }
120
+ :host(:disabled[variant="outlined"]) .base,
121
+ :host([disabled-interactive][variant="outlined"]) .base {
122
+ outline-color: color-mix(
123
+ in srgb,
124
+ var(--m3e-outlined-chip-disabled-outline-color, ${h.color.onSurface})
125
+ var(--m3e-outlined-chip-disabled-outline-opacity, 12%),
126
+ transparent
127
+ );
128
+ }
129
+ :host(.-with-icon) .wrapper {
130
+ padding-inline-start: var(--m3e-chip-with-icon-padding-start, 0.5rem);
131
+ }
132
+ :host(:not(.-with-icon)) .wrapper {
133
+ padding-inline-start: var(--m3e-chip-padding-start, 1rem);
134
+ }
135
+ :host(.-with-trailing-icon) .wrapper {
136
+ padding-inline-end: var(--m3e-chip-with-icon-padding-end, 0.5rem);
137
+ }
138
+ :host(:not(.-with-trailing-icon)) .wrapper {
139
+ padding-inline-end: var(--m3e-chip-padding-end, 1rem);
140
+ }
141
+ ::slotted([slot="icon"]),
142
+ ::slotted([slot="trailing-icon"]) {
143
+ flex: none;
144
+ width: 1em;
145
+ font-size: var(--m3e-chip-icon-size, 1.125rem) !important;
146
+ }
147
+ :host(:not(:disabled):not([disabled-interactive]):not([selected])) .base {
148
+ color: var(--m3e-chip-label-text-color, ${h.color.onSurface});
149
+ }
150
+ :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="icon"]),
151
+ :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="trailing-icon"]) {
152
+ color: var(--m3e-chip-icon-color, ${h.color.primary});
153
+ }
154
+ :host(:disabled) .base,
155
+ :host([disabled-interactive]) .base {
156
+ color: color-mix(
157
+ in srgb,
158
+ var(--m3e-chip-disabled-label-text-color, ${h.color.onSurface})
159
+ var(--m3e-chip-disabled-label-text-opacity, 38%),
160
+ transparent
161
+ );
162
+ }
163
+ :host(:disabled) ::slotted([slot="icon"]),
164
+ :host([disabled-interactive]) ::slotted([slot="icon"]),
165
+ :host(:disabled) ::slotted([slot="trailing-icon"]),
166
+ :host([disabled-interactive]) ::slotted([slot="trailing-icon"]) {
167
+ color: color-mix(
168
+ in srgb,
169
+ var(--m3e-chip-disabled-icon-color, ${h.color.onSurface}) var(--m3e-chip-disabled-icon-opacity, 38%),
170
+ transparent
171
+ );
172
+ }
173
+ :host([variant="elevated"]:disabled) .base,
174
+ :host([variant="elevated"][disabled-interactive]) .base {
175
+ background-color: color-mix(
176
+ in srgb,
177
+ var(--m3e-elevated-chip-disabled-container-color, ${h.color.onSurface})
178
+ var(--m3e-elevated-chip-disabled-container-opacity, 12%),
179
+ transparent
180
+ );
181
+ --m3e-elevation-level: var(--m3e-elevated-chip-disabled-elevation, ${h.elevation.level0});
182
+ }
183
+ @media (prefers-reduced-motion) {
184
+ .base {
185
+ transition: none;
186
+ }
187
+ }
188
+ @media (forced-colors: active) {
189
+ .base {
190
+ transition: none;
191
+ }
192
+ :host(:not(:disabled):not([disabled-interactive]):not([selected])) .base,
193
+ :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="icon"]),
194
+ :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="trailing-icon"]) {
195
+ color: CanvasText;
196
+ }
197
+ :host(:not(:disabled):not([disabled-interactive])[variant="outlined"]) .base {
198
+ outline-color: CanvasText;
199
+ }
200
+ :host(:disabled) .base,
201
+ :host([disabled-interactive]) .base,
202
+ :host(:disabled) ::slotted([slot="icon"]),
203
+ :host([disabled-interactive]) ::slotted([slot="icon"]),
204
+ :host(:disabled) ::slotted([slot="trailing-icon"]),
205
+ :host([disabled-interactive]) ::slotted([slot="trailing-icon"]) {
206
+ color: GrayText;
207
+ }
208
+ :host(:disabled[variant="outlined"]) .base,
209
+ :host([disabled-interactive][variant="outlined"]) .base {
210
+ outline-color: GrayText;
211
+ }
212
+ }
213
+ `,L([ce(".elevation")],be.prototype,"_elevation",void 0),L([ce(".focus-ring")],be.prototype,"_focusRing",void 0),L([ce(".state-layer")],be.prototype,"_stateLayer",void 0),L([ce(".ripple")],be.prototype,"_ripple",void 0),L([le({reflect:!0})],be.prototype,"variant",void 0),L([le()],be.prototype,"value",null),be=L([R("m3e-chip")],be);let ge=class extends(u(v(m(f(b(g($(n(be,"button")))))),!0))){_renderTrailingIcon(){return t}};ge=L([R("m3e-assist-chip")],ge);let $e=class extends(y(n(e,"none"))){render(){return i`<slot></slot>`}};var ye,_e,we;$e.styles=o`
214
+ :host {
215
+ display: inline-flex;
216
+ flex-wrap: wrap;
217
+ vertical-align: middle;
218
+ gap: var(--m3e-chip-set-spacing, 0.5rem);
219
+ outline: none;
220
+ }
221
+ :host([vertical]) {
222
+ flex-direction: column;
223
+ }
224
+ `,$e=L([R("m3e-chip-set")],$e);let Ae=class extends(_(f(b(g($(v(n(be,"option"),!0))))))){constructor(){super(...arguments),ye.add(this),_e.set(this,e=>H(this,ye,"m",we).call(this,e))}connectedCallback(){super.connectedCallback(),this.addEventListener("click",H(this,_e,"f"))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",H(this,_e,"f"))}update(e){super.update(e),e.has("selected")&&this.closest("m3e-filter-chip-set")?.[M].notifySelectionChange(this)}_renderIcon(){return i`<div class="icon" aria-hidden="true">
225
+ <svg class="check" viewBox="0 -960 960 960" aria-hidden="true">
226
+ <path fill="currentColor" d="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z" />
227
+ </svg>
228
+ ${super._renderIcon()}
229
+ </div>`}};var Ee,Se,xe,Ce,ke;_e=new WeakMap,ye=new WeakSet,we=function(e){if(e.defaultPrevented)return;const t=this.selected;this.selected=!this.selected,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0,cancelable:!0}))?(this.closest("m3e-filter-chip-set")?.[M].notifySelectionChange(this),this.dispatchEvent(new Event("change",{bubbles:!0}))):this.selected=t},Ae.styles=[be.styles,o`
230
+ :host([selected]:not(.-hide-selection)) .wrapper {
231
+ padding-inline-start: var(--m3e-chip-with-icon-padding-start, 0.5rem);
232
+ }
233
+ .icon {
234
+ display: flex;
235
+ align-items: center;
236
+ justify-content: center;
237
+ }
238
+ .check {
239
+ width: 1em;
240
+ font-size: var(--m3e-chip-icon-size, 1.125rem);
241
+ }
242
+ :host(:not(:disabled):not([disabled-interactive])) .check {
243
+ color: var(--m3e-chip-selected-leading-icon-color, ${h.color.onSecondaryContainer});
244
+ }
245
+ :host(:not([selected])) .check,
246
+ :host(.-hide-selection) .check,
247
+ :host(.-hide-selection:not(.-with-icon)) .icon {
248
+ display: none;
249
+ }
250
+ :host(:not(.-with-icon)) .icon {
251
+ margin-inline-start: calc(0px - var(--m3e-chip-with-icon-padding-start, 0.5rem));
252
+ transition: margin-inline-start ${h.motion.spring.fastEffects};
253
+ }
254
+ :host([selected]) .icon {
255
+ margin-inline-start: 0;
256
+ }
257
+ :host([selected]:not(.-hide-selection)) ::slotted([slot="icon"]) {
258
+ display: none !important;
259
+ }
260
+ :host(:not(:disabled):not([disabled-interactive]):not([selected])) .base {
261
+ color: var(--m3e-chip-unselected-label-text-color, ${h.color.onSurfaceVariant});
262
+ --m3e-ripple-color: var(--m3e-chip-unselected-ripple-color, ${h.color.onSurfaceVariant});
263
+ --m3e-state-layer-focus-color: var(
264
+ --m3e-chip-unselected-state-layer-focus-color,
265
+ ${h.color.onSurfaceVariant}
266
+ );
267
+ --m3e-state-layer-hover-color: var(
268
+ --m3e-chip-unselected-state-layer-hover-color,
269
+ ${h.color.onSurfaceVariant}
270
+ );
271
+ }
272
+ :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="icon"]) {
273
+ color: var(--m3e-chip-unselected-leading-icon-color, ${h.color.primary});
274
+ }
275
+ :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="trailing-icon"]) {
276
+ color: var(--m3e-chip-unselected-trailing-icon-color, ${h.color.onSurfaceVariant});
277
+ }
278
+ :host(:not(:disabled):not([disabled-interactive])[selected]) .base {
279
+ outline-offset: unset;
280
+ outline-width: var(--m3e-chip-selected-outline-thickness, 0);
281
+ color: var(--m3e-chip-selected-label-text-color, ${h.color.onSecondaryContainer});
282
+ background-color: var(--m3e-chip-selected-container-color, ${h.color.secondaryContainer});
283
+ --m3e-state-layer-hover-color: var(
284
+ --m3e-chip-selected-container-hover-color,
285
+ ${h.color.onSecondaryContainer}
286
+ );
287
+ --m3e-state-layer-focus-color: var(
288
+ --m3e-chip-selected-container-focus-color,
289
+ ${h.color.onSecondaryContainer}
290
+ );
291
+ --m3e-elevation-hover-level: var(--m3e-chip-selected-hover-elevation, ${h.elevation.level1});
292
+ --m3e-ripple-color: var(--m3e-chip-selected-ripple-color, ${h.color.onSecondaryContainer});
293
+ --m3e-state-layer-focus-color: var(
294
+ --m3e-chip-selected-state-layer-focus-color,
295
+ ${h.color.onSecondaryContainer}
296
+ );
297
+ --m3e-state-layer-hover-color: var(
298
+ --m3e-chip-selected-state-layer-hover-color,
299
+ ${h.color.onSecondaryContainer}
300
+ );
301
+ }
302
+ :host(:not(:disabled):not([disabled-interactive])[selected]) ::slotted([slot="icon"]) {
303
+ color: var(--m3e-chip-selected-leading-icon-color, ${h.color.onSecondaryContainer});
304
+ }
305
+ :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="trailing-icon"]) {
306
+ color: var(--m3e-chip-selected-trailing-icon-color, ${h.color.onSecondaryContainer});
307
+ }
308
+ @media (prefers-reduced-motion) {
309
+ .base,
310
+ :host(:not(.-with-icon)) .icon {
311
+ transition: none;
312
+ }
313
+ }
314
+ @media (forced-colors: active) {
315
+ :host(:not(:disabled):not([disabled-interactive]):not([selected])) .base,
316
+ :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="icon"]),
317
+ :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="trailing-icon"]) {
318
+ color: CanvasText;
319
+ }
320
+ :host(:not(:disabled):not([disabled-interactive])[selected]) .base,
321
+ :host(:not(:disabled):not([disabled-interactive])[selected]) ::slotted([slot="icon"]),
322
+ :host(:not(:disabled):not([disabled-interactive])[selected]) ::slotted([slot="trailing-icon"]),
323
+ :host(:not(:disabled):not([disabled-interactive])) .check {
324
+ color: ButtonText;
325
+ }
326
+ :host(:not(:disabled):not([disabled-interactive])[selected]) .base {
327
+ outline-offset: calc(0px - var(--m3e-outlined-chip-outline-thickness, 1px));
328
+ outline-width: var(--m3e-outlined-chip-outline-thickness, 1px);
329
+ outline-color: ButtonText;
330
+ }
331
+ }
332
+ `],Ae=L([R("m3e-filter-chip")],Ae);let Pe=class extends(w(A(E(S($(v(n($e,"listbox")))))))){constructor(){super(...arguments),Ee.add(this),this[ke]=(new I).onActiveItemChange(()=>this[M].activeItem?.focus()).withWrap(),this.multi=!1,this.hideSelectionIndicator=!1}get chips(){return this[M]?.items??[]}get selected(){return this[M]?.selectedItems??[]}get value(){const e=this.selected.map(e=>e.value);switch(e.length){case 0:return null;case 1:return e[0];default:return e}}get[(Ee=new WeakSet,ke=M,x)](){const e=this.value;if(Array.isArray(e)){const t=new FormData;for(const i of e)t.append(this.name,i);return t}return e}update(e){super.update(e),e.has("vertical")&&(this[M].vertical=this.vertical),e.has("disabled")&&(void 0!==e.get("disabled")||this.disabled)&&(this[M].disabled=this.disabled),e.has("multi")&&(this.ariaMultiSelectable=`${this.multi}`,this[M].multi=this.multi,this[M].disableRovingTabIndex(this.multi)),e.has("hideSelectionIndicator")&&this.chips.forEach(e=>e.classList.toggle("-hide-selection",this.hideSelectionIndicator))}render(){return i`<slot
333
+ @slotchange="${H(this,Ee,"m",Se)}"
334
+ @keydown="${H(this,Ee,"m",xe)}"
335
+ @change="${H(this,Ee,"m",Ce)}"
336
+ ></slot>`}};Se=function(){const{added:e}=this[M].setItems([...this.querySelectorAll("m3e-filter-chip")]);e.forEach(e=>e.classList.toggle("-hide-selection",this.hideSelectionIndicator))},xe=function(e){this.multi||this[M].onKeyDown(e)},Ce=function(e){e.stopPropagation(),this.dispatchEvent(new Event("change",{bubbles:!0}))},L([le({type:Boolean})],Pe.prototype,"multi",void 0),L([le({attribute:"hide-selection-indicator",type:Boolean})],Pe.prototype,"hideSelectionIndicator",void 0),Pe=L([R("m3e-filter-chip-set")],Pe);
337
+ /**
338
+ * @license
339
+ * Copyright 2017 Google LLC
340
+ * SPDX-License-Identifier: BSD-3-Clause
341
+ */
342
+ const Te=globalThis,Me=Te.trustedTypes,Ie=Me?Me.createPolicy("lit-html",{createHTML:e=>e}):void 0,Ue="$lit$",Oe=`lit$${Math.random().toFixed(9).slice(2)}$`,Le="?"+Oe,He=`<${Le}>`,Ne=document,Re=()=>Ne.createComment(""),ze=e=>null===e||"object"!=typeof e&&"function"!=typeof e,We=Array.isArray,je="[ \t\n\f\r]",Be=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,De=/-->/g,qe=/>/g,Ve=RegExp(`>|${je}(?:([^\\s"'>=/]+)(${je}*=${je}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Fe=/'/g,Ke=/"/g,Ze=/^(?:script|style|textarea|title)$/i,Ge=Symbol.for("lit-noChange"),Je=Symbol.for("lit-nothing"),Qe=new WeakMap,Xe=Ne.createTreeWalker(Ne,129);function Ye(e,t){if(!We(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==Ie?Ie.createHTML(t):t}const et=(e,t)=>{const i=e.length-1,s=[];let o,n=2===t?"<svg>":3===t?"<math>":"",r=Be;for(let t=0;t<i;t++){const i=e[t];let a,l,c=-1,h=0;for(;h<i.length&&(r.lastIndex=h,l=r.exec(i),null!==l);)h=r.lastIndex,r===Be?"!--"===l[1]?r=De:void 0!==l[1]?r=qe:void 0!==l[2]?(Ze.test(l[2])&&(o=RegExp("</"+l[2],"g")),r=Ve):void 0!==l[3]&&(r=Ve):r===Ve?">"===l[0]?(r=o??Be,c=-1):void 0===l[1]?c=-2:(c=r.lastIndex-l[2].length,a=l[1],r=void 0===l[3]?Ve:'"'===l[3]?Ke:Fe):r===Ke||r===Fe?r=Ve:r===De||r===qe?r=Be:(r=Ve,o=void 0);const d=r===Ve&&e[t+1].startsWith("/>")?" ":"";n+=r===Be?i+He:c>=0?(s.push(a),i.slice(0,c)+Ue+i.slice(c)+Oe+d):i+Oe+(-2===c?t:d)}return[Ye(e,n+(e[i]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),s]};class tt{constructor({strings:e,_$litType$:t},i){let s;this.parts=[];let o=0,n=0;const r=e.length-1,a=this.parts,[l,c]=et(e,t);if(this.el=tt.createElement(l,i),Xe.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(s=Xe.nextNode())&&a.length<r;){if(1===s.nodeType){if(s.hasAttributes())for(const e of s.getAttributeNames())if(e.endsWith(Ue)){const t=c[n++],i=s.getAttribute(e).split(Oe),r=/([.?@])?(.*)/.exec(t);a.push({type:1,index:o,name:r[2],strings:i,ctor:"."===r[1]?rt:"?"===r[1]?at:"@"===r[1]?lt:nt}),s.removeAttribute(e)}else e.startsWith(Oe)&&(a.push({type:6,index:o}),s.removeAttribute(e));if(Ze.test(s.tagName)){const e=s.textContent.split(Oe),t=e.length-1;if(t>0){s.textContent=Me?Me.emptyScript:"";for(let i=0;i<t;i++)s.append(e[i],Re()),Xe.nextNode(),a.push({type:2,index:++o});s.append(e[t],Re())}}}else if(8===s.nodeType)if(s.data===Le)a.push({type:2,index:o});else{let e=-1;for(;-1!==(e=s.data.indexOf(Oe,e+1));)a.push({type:7,index:o}),e+=Oe.length-1}o++}}static createElement(e,t){const i=Ne.createElement("template");return i.innerHTML=e,i}}function it(e,t,i=e,s){if(t===Ge)return t;let o=void 0!==s?i._$Co?.[s]:i._$Cl;const n=ze(t)?void 0:t._$litDirective$;return o?.constructor!==n&&(o?._$AO?.(!1),void 0===n?o=void 0:(o=new n(e),o._$AT(e,i,s)),void 0!==s?(i._$Co??=[])[s]=o:i._$Cl=o),void 0!==o&&(t=it(e,o._$AS(e,t.values),o,s)),t}class st{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,s=(e?.creationScope??Ne).importNode(t,!0);Xe.currentNode=s;let o=Xe.nextNode(),n=0,r=0,a=i[0];for(;void 0!==a;){if(n===a.index){let t;2===a.type?t=new ot(o,o.nextSibling,this,e):1===a.type?t=new a.ctor(o,a.name,a.strings,this,e):6===a.type&&(t=new ct(o,this,e)),this._$AV.push(t),a=i[++r]}n!==a?.index&&(o=Xe.nextNode(),n++)}return Xe.currentNode=Ne,s}p(e){let t=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class ot{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,i,s){this.type=2,this._$AH=Je,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=it(this,e,t),ze(e)?e===Je||null==e||""===e?(this._$AH!==Je&&this._$AR(),this._$AH=Je):e!==this._$AH&&e!==Ge&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>We(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Je&&ze(this._$AH)?this._$AA.nextSibling.data=e:this.T(Ne.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:i}=e,s="number"==typeof i?this._$AC(e):(void 0===i.el&&(i.el=tt.createElement(Ye(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(t);else{const e=new st(s,this),i=e.u(this.options);e.p(t),this.T(i),this._$AH=e}}_$AC(e){let t=Qe.get(e.strings);return void 0===t&&Qe.set(e.strings,t=new tt(e)),t}k(e){We(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,s=0;for(const o of e)s===t.length?t.push(i=new ot(this.O(Re()),this.O(Re()),this,this.options)):i=t[s],i._$AI(o),s++;s<t.length&&(this._$AR(i&&i._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class nt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,s,o){this.type=1,this._$AH=Je,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=o,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Je}_$AI(e,t=this,i,s){const o=this.strings;let n=!1;if(void 0===o)e=it(this,e,t,0),n=!ze(e)||e!==this._$AH&&e!==Ge,n&&(this._$AH=e);else{const s=e;let r,a;for(e=o[0],r=0;r<o.length-1;r++)a=it(this,s[i+r],t,r),a===Ge&&(a=this._$AH[r]),n||=!ze(a)||a!==this._$AH[r],a===Je?e=Je:e!==Je&&(e+=(a??"")+o[r+1]),this._$AH[r]=a}n&&!s&&this.j(e)}j(e){e===Je?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class rt extends nt{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Je?void 0:e}}class at extends nt{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Je)}}class lt extends nt{constructor(e,t,i,s,o){super(e,t,i,s,o),this.type=5}_$AI(e,t=this){if((e=it(this,e,t,0)??Je)===Ge)return;const i=this._$AH,s=e===Je&&i!==Je||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,o=e!==Je&&(i===Je||s);s&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class ct{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){it(this,e)}}const ht=Te.litHtmlPolyfillSupport;ht?.(tt,ot),(Te.litHtmlVersions??=[]).push("3.3.1");var dt,pt,ut,vt;let mt=class extends(C(g($(v(n(be,"row"),!0))),"remove")){constructor(){super(...arguments),dt.add(this),this.removable=!1,this.removeLabel="Remove"}connectedCallback(){super.connectedCallback(),this.removeAttribute("tabindex")}update(e){super.update(e),this.removeAttribute("tabindex"),e.has("removable")&&this.classList.toggle("-with-trailing-icon",this.removable)}render(){return i`<div class="base">
343
+ <m3e-elevation
344
+ class="elevation"
345
+ for="cell"
346
+ ?disabled="${this.disabled||this.disabledInteractive}"
347
+ ></m3e-elevation>
348
+ <m3e-state-layer
349
+ class="state-layer"
350
+ for="cell"
351
+ ?disabled="${this.disabled||this.disabledInteractive}"
352
+ ></m3e-state-layer>
353
+ <m3e-focus-ring class="focus-ring" for="cell" ?disabled="${this.disabled}"></m3e-focus-ring>
354
+ <m3e-ripple class="ripple" for="cell" ?disabled="${this.disabled||this.disabledInteractive}"></m3e-ripple>
355
+ <div class="wrapper">
356
+ <div
357
+ id="cell"
358
+ class="cell"
359
+ role="gridcell"
360
+ tabindex="${(e=>e??Je)(this.disabled?void 0:"-1")}"
361
+ @keydown="${H(this,dt,"m",vt)}"
362
+ >
363
+ <slot name="avatar" @slotchange="${H(this,dt,"m",pt)}"></slot>
364
+ ${this._renderIcon()}
365
+ <div class="label">${this._renderSlot()}</div>
366
+ <div class="touch" aria-hidden="true"></div>
367
+ </div>
368
+ ${this._renderTrailingIcon()}
369
+ </div>
370
+ </div>`}_renderTrailingIcon(){return this.removable?i`<span role="gridcell" class="remove">
371
+ <m3e-icon-button
372
+ class="remove-button"
373
+ aria-label="${this.removeLabel}"
374
+ size="extra-small"
375
+ tabindex="-1"
376
+ ?disabled="${this.disabled}"
377
+ ?disabled-interactive="${this.disabledInteractive}"
378
+ @click="${H(this,dt,"m",ut)}"
379
+ >
380
+ <slot name="remove-icon">
381
+ <svg class="remove-icon" viewBox="0 -960 960 960" fill="currentColor">
382
+ <path
383
+ d="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"
384
+ />
385
+ </svg>
386
+ </slot>
387
+ </m3e-icon-button>
388
+ </span>`:t}};var ft,bt,gt,$t,yt,_t,wt,At,Et,St,xt,Ct,kt,Pt,Tt,Mt,It,Ut,Ot,Lt,Ht,Nt,Rt;dt=new WeakSet,pt=function(e){this.classList.toggle("-with-avatar",d(e.target))},ut=function(e){e.stopPropagation(),this.dispatchEvent(new Event("remove"))},vt=function(e){if(this.removable)switch(e.key){case"Backspace":case"Delete":this.dispatchEvent(new Event("remove"))}},mt.styles=[be.styles,o`
389
+ .cell {
390
+ display: inline-flex;
391
+ align-items: center;
392
+ outline: none;
393
+ column-gap: var(--m3e-chip-spacing, 0.5rem);
394
+ min-width: 0;
395
+ }
396
+ .remove-button {
397
+ --m3e-icon-button-extra-small-container-height: 1.5rem;
398
+ --m3e-icon-button-extra-small-icon-size: var(--m3e-chip-icon-size, 1.125rem);
399
+ width: 1.5rem;
400
+ }
401
+ .remove-icon {
402
+ flex: none;
403
+ width: var(--m3e-chip-icon-size, 1.125rem);
404
+ height: var(--m3e-chip-icon-size, 1.125rem);
405
+ }
406
+ .touch {
407
+ top: calc(
408
+ 0px - calc(calc(3rem - calc(var(--m3e-chip-container-height, 2rem) + ${h.density.calc(-2)})) / 2)
409
+ );
410
+ }
411
+ .wrapper {
412
+ height: 100%;
413
+ overflow: visible;
414
+ min-width: 0;
415
+ }
416
+ ::slotted([slot="avatar"]) {
417
+ flex: none;
418
+ font-size: var(--m3e-chip-avatar-size, 1.5rem);
419
+ }
420
+ :host(:disabled) ::slotted([slot="avatar"]),
421
+ :host([disabled-interactive]) ::slotted([slot="avatar"]) {
422
+ opacity: var(--m3e-chip-disabled-avatar-opacity, 38%);
423
+ color: var(--m3e-chip-disabled-icon-color, ${h.color.onSurface});
424
+ }
425
+ :host(.-with-avatar) ::slotted([slot="icon"]) {
426
+ display: none;
427
+ }
428
+ :host(.-with-avatar) .wrapper {
429
+ padding-inline-start: var(--m3e-chip-with-avatar-padding-start, 0.25rem);
430
+ }
431
+ @media (forced-colors: active) {
432
+ :host(:disabled) ::slotted([slot="avatar"]),
433
+ :host([disabled-interactive]) ::slotted([slot="avatar"]) {
434
+ color: CanvasText;
435
+ }
436
+ }
437
+ `],L([ce(".cell")],mt.prototype,"cell",void 0),L([ce(".remove-button")],mt.prototype,"removeButton",void 0),L([le({type:Boolean})],mt.prototype,"removable",void 0),L([le({attribute:"remove-label"})],mt.prototype,"removeLabel",void 0),mt=L([R("m3e-input-chip")],mt);let zt=class extends(k(P(T(A(E(S($(v(n($e,"grid")))))))))){constructor(){super(...arguments),ft.add(this),bt.set(this,()=>H(this,ft,"m",Nt).call(this)),gt.set(this,e=>H(this,ft,"m",Rt).call(this,e)),$t.set(this,()=>H(this,ft,"m",It).call(this)),yt.set(this,()=>H(this,ft,"m",Ut).call(this)),_t.set(this,()=>H(this,ft,"m",Ot).call(this)),wt.set(this,e=>H(this,ft,"m",Lt).call(this,e)),At.set(this,e=>H(this,ft,"m",Ht).call(this,e)),Et.set(this,new U),St.set(this,(new O).onActiveItemChange(()=>H(this,St,"f").activeItem?.focus()).withHomeAndEnd().withSkipPredicate(e=>!e.hasAttribute("tabindex"))),xt.set(this,!1),Ct.set(this,null),kt.set(this,0)}get chips(){return[...this.querySelectorAll("m3e-input-chip")]}get value(){const e=this.chips.map(e=>e.value);return 0==e.length?null:e}get[(bt=new WeakMap,gt=new WeakMap,$t=new WeakMap,yt=new WeakMap,_t=new WeakMap,wt=new WeakMap,At=new WeakMap,Et=new WeakMap,St=new WeakMap,xt=new WeakMap,Ct=new WeakMap,kt=new WeakMap,ft=new WeakSet,x)](){const e=this.value;if(!e)return null;const t=new FormData;for(const i of e)t.append(this.name,i);return t}get shouldLabelFloat(){return this.chips.length>0}onContainerClick(){H(this,Ct,"f")?.focus()}connectedCallback(){super.connectedCallback(),this.closest("m3e-form-field")?.notifyControlStateChange(),N(this,kt,Number.parseInt(this.getAttribute("tabindex")??"0"),"f"),this.addEventListener("focus",H(this,$t,"f")),this.addEventListener("focusin",H(this,yt,"f")),this.addEventListener("focusout",H(this,_t,"f"))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("focus",H(this,$t,"f")),this.removeEventListener("focusin",H(this,yt,"f")),this.removeEventListener("focusout",H(this,_t,"f"))}firstUpdated(e){super.firstUpdated(e),this.hasAttribute("tabindex")||this.setAttribute("tabindex",`${H(this,kt,"f")}`)}update(e){super.update(e),e.has("vertical")&&(this.ariaOrientation=null),e.has("disabled")&&(H(this,Et,"f").items.forEach(e=>e.disabled=this.disabled),H(this,Ct,"f")&&(H(this,Ct,"f").disabled=this.disabled))}render(){return i`<slot @keydown="${H(this,ft,"m",Pt)}" @slotchange="${H(this,ft,"m",Tt)}"></slot>
438
+ <span role="row">
439
+ <span role="gridcell"><slot name="input" @slotchange="${H(this,ft,"m",Mt)}"></slot></span>
440
+ </span> `}};Pt=function(e){H(this,St,"f").onKeyDown(e)},Tt=async function(){const{added:e,removed:t}=H(this,Et,"f").setItems([...this.querySelectorAll("m3e-input-chip")]);for(const t of e)t.isUpdatePending&&await t.updateComplete,this.disabled&&(t.disabled=!0),t.addEventListener("remove",H(this,wt,"f")),t.cell.addEventListener("click",H(this,At,"f"));t.forEach(e=>{e.removeEventListener("remove",H(this,wt,"f")),e.cell.removeEventListener("click",H(this,At,"f"))}),H(this,St,"f").setItems(H(this,Et,"f").items.flatMap(e=>e.removeButton?[e.cell,e.removeButton]:[e.cell])),H(this,St,"f").activeItem||H(this,St,"f").updateActiveItem(H(this,St,"f").items.find(e=>e.hasAttribute("tabindex")))},Mt=function(){const e=this.querySelector("input");if(H(this,Ct,"f")&&(H(this,Ct,"f").removeEventListener("change",H(this,bt,"f")),H(this,Ct,"f").removeEventListener("keydown",H(this,gt,"f"))),N(this,Ct,e,"f"),H(this,Ct,"f")){H(this,Ct,"f").disabled=this.disabled,H(this,Ct,"f").addEventListener("change",H(this,bt,"f")),H(this,Ct,"f").addEventListener("keydown",H(this,gt,"f"));const t=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");Object.defineProperty(e,"value",{get:()=>t.get?.call(e),set:i=>{t.set?.call(e,i),H(this,Ct,"f")!==e||H(this,xt,"f")||H(this,ft,"m",Nt).call(this)}})}},It=function(){setTimeout(()=>(H(this,St,"f").activeItem??H(this,Ct,"f"))?.focus())},Ut=function(){this.setAttribute("tabindex","-1")},Ot=function(){this.setAttribute("tabindex",`${H(this,kt,"f")}`)},Lt=function(e){const t=e.target,i=H(this,Et,"f").items.indexOf(t),s=H(this,Et,"f").items.find((e,t)=>t>i&&!e.disabled&&e.removable);t.remove(),H(this,St,"f").setActiveItem(H(this,St,"f").items.find(e=>e===s?.removeButton)),H(this,St,"f").activeItem||H(this,Ct,"f")?.focus(),this.dispatchEvent(new Event("change",{bubbles:!0}))},Ht=function(e){H(this,St,"f").updateActiveItem(e.composedPath().find(e=>e instanceof mt)?.cell)},Nt=function(){const e=H(this,Ct,"f")?.value;e&&setTimeout(()=>{const e=H(this,Ct,"f")?.value;if(!e)return;const t=document.createElement("m3e-input-chip");if(t.removable=!0,t.appendChild(document.createTextNode(e)),this.appendChild(t),H(this,Ct,"f"))try{N(this,xt,!0,"f"),H(this,Ct,"f").value=""}finally{N(this,xt,!1,"f")}this.dispatchEvent(new Event("change",{bubbles:!0}))})},Rt=function(e){if("Backspace"===e.key&&!H(this,Ct,"f")?.value){const e=[...H(this,Et,"f").items].reverse().find(e=>!e.disabled&&!e.disabledInteractive&&e.removable);e&&e.dispatchEvent(new Event("remove"))}},zt.styles=[$e.styles,o`
441
+ ::slotted([slot="input"]) {
442
+ outline: unset;
443
+ border: unset;
444
+ background-color: transparent;
445
+ box-shadow: none;
446
+ font-family: inherit;
447
+ font-size: inherit;
448
+ line-height: initial;
449
+ letter-spacing: inherit;
450
+ color: var(--_form-field-input-color, inherit);
451
+ flex: 1 1 auto;
452
+ min-width: 0;
453
+ padding: unset;
454
+ }
455
+ ::slotted(m3e-input-chip) {
456
+ min-width: 0;
457
+ }
458
+ ::slotted([slot="input"])::placeholder {
459
+ user-select: none;
460
+ color: currentColor;
461
+ transition: opacity ${h.motion.duration.extraLong1};
462
+ }
463
+ :host(:not(:focus-within)) ::slotted([slot="input"])::placeholder {
464
+ opacity: 0;
465
+ transition: 0s;
466
+ }
467
+ :host(:hover) ::slotted([slot="input"])::placeholder {
468
+ transition: 0s;
469
+ }
470
+ span[role="row"],
471
+ span[role="gridcell"] {
472
+ display: contents;
473
+ }
474
+ @media (prefers-reduced-motion) {
475
+ ::slotted([slot="input"])::placeholder {
476
+ transition: none !important;
477
+ }
478
+ }
479
+ `],zt=L([R("m3e-input-chip-set")],zt);let Wt=class extends(u(v(m(f(b(g($(n(be,"button")))))),!0))){_renderTrailingIcon(){return t}};Wt=L([R("m3e-suggestion-chip")],Wt);export{ge as M3eAssistChipElement,be as M3eChipElement,$e as M3eChipSetElement,Ae as M3eFilterChipElement,Pe as M3eFilterChipSetElement,mt as M3eInputChipElement,zt as M3eInputChipSetElement,Wt as M3eSuggestionChipElement};
480
+ //# sourceMappingURL=index.min.js.map