@m3e/stepper 1.0.2

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.
@@ -0,0 +1,334 @@
1
+ /**
2
+ * @license MIT
3
+ * Copyright (c) 2025 matraic
4
+ * See LICENSE file in the project root for full license text.
5
+ */
6
+ import{css as t,LitElement as e,html as s,nothing as i}from"lit";import{Selected as o,KeyboardClick as r,Focusable as n,HtmlFor as l,Disabled as a,AttachInternals as c,Role as d,DesignToken as h}from"@m3e/core";import{addAriaReferencedId as p,removeAriaReferencedId as m,selectionManager as u,SelectionManager as v}from"@m3e/core/a11y";import{M3eBreakpointObserver as f,Breakpoint as b}from"@m3e/core/layout";function $(t,e,s,i){var o,r=arguments.length,n=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(n=(r<3?o(n):r>3?o(e,s,n):o(e,s))||n);return r>3&&n&&Object.defineProperty(e,s,n),n}function y(t,e,s,i){if("a"===s&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?i:"a"===s?i.call(t):i?i.value:e.get(t)}function g(t,e,s,i,o){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?o.call(t,s):o?o.value=s:e.set(t,s),s}"function"==typeof SuppressedError&&SuppressedError;
7
+ /**
8
+ * @license
9
+ * Copyright 2017 Google LLC
10
+ * SPDX-License-Identifier: BSD-3-Clause
11
+ */
12
+ const _=t=>(e,s)=>{void 0!==s?s.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)},A=globalThis,w=A.ShadowRoot&&(void 0===A.ShadyCSS||A.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,E=Symbol(),x=new WeakMap;
13
+ /**
14
+ * @license
15
+ * Copyright 2019 Google LLC
16
+ * SPDX-License-Identifier: BSD-3-Clause
17
+ */let S=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==E)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(w&&void 0===t){const s=void 0!==e&&1===e.length;s&&(t=x.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&x.set(e,t))}return t}toString(){return this.cssText}};const P=w?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return(t=>new S("string"==typeof t?t:t+"",void 0,E))(e)})(t):t,{is:C,defineProperty:k,getOwnPropertyDescriptor:T,getOwnPropertyNames:O,getOwnPropertySymbols:U,getPrototypeOf:M}=Object,H=globalThis,N=H.trustedTypes,z=N?N.emptyScript:"",R=H.reactiveElementPolyfillSupport,I=(t,e)=>t,j={toAttribute(t,e){switch(e){case Boolean:t=t?z:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},L=(t,e)=>!C(t,e),q={attribute:!0,type:String,converter:j,reflect:!1,useDefault:!1,hasChanged:L};
18
+ /**
19
+ * @license
20
+ * Copyright 2017 Google LLC
21
+ * SPDX-License-Identifier: BSD-3-Clause
22
+ */Symbol.metadata??=Symbol("metadata"),H.litPropertyMetadata??=new WeakMap;class W 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,e=q){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,e);void 0!==i&&k(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:o}=T(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:i,set(e){const r=i?.call(this);o?.call(this,e),this.requestUpdate(t,r,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??q}static _$Ei(){if(this.hasOwnProperty(I("elementProperties")))return;const t=M(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(I("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(I("properties"))){const t=this.properties,e=[...O(t),...U(t)];for(const s of e)this.createProperty(s,t[s])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,s]of e)this.elementProperties.set(t,s)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const s=this._$Eu(t,e);void 0!==s&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(P(t))}else void 0!==t&&e.push(P(t));return e}static _$Eu(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.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(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,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(w)t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const s of e){const e=document.createElement("style"),i=A.litNonce;void 0!==i&&e.setAttribute("nonce",i),e.textContent=s.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(void 0!==i&&!0===s.reflect){const o=(void 0!==s.converter?.toAttribute?s.converter:j).toAttribute(e,s.type);this._$Em=t,null==o?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,e){const s=this.constructor,i=s._$Eh.get(t);if(void 0!==i&&this._$Em!==i){const t=s.getPropertyOptions(i),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:j;this._$Em=i;const r=o.fromAttribute(e,t.type);this[i]=r??this._$Ej?.get(i)??r,this._$Em=null}}requestUpdate(t,e,s){if(void 0!==t){const i=this.constructor,o=this[t];if(s??=i.getPropertyOptions(t),!((s.hasChanged??L)(o,e)||s.useDefault&&s.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,s))))return;this.C(t,e,s)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:i,wrapped:o},r){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??e??this[t]),!0!==o||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),!0===i&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;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,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,s]of t){const{wrapped:t}=s,i=this[e];!0!==t||this._$AL.has(e)||void 0===i||this.C(e,void 0,s,i)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}}W.elementStyles=[],W.shadowRootOptions={mode:"open"},W[I("elementProperties")]=new Map,W[I("finalized")]=new Map,R?.({ReactiveElement:W}),(H.reactiveElementVersions??=[]).push("2.1.1");
23
+ /**
24
+ * @license
25
+ * Copyright 2017 Google LLC
26
+ * SPDX-License-Identifier: BSD-3-Clause
27
+ */
28
+ const B={attribute:!0,type:String,converter:j,reflect:!1,hasChanged:L},D=(t=B,e,s)=>{const{kind:i,metadata:o}=s;let r=globalThis.litPropertyMetadata.get(o);if(void 0===r&&globalThis.litPropertyMetadata.set(o,r=new Map),"setter"===i&&((t=Object.create(t)).wrapped=!0),r.set(s.name,t),"accessor"===i){const{name:i}=s;return{set(s){const o=e.get.call(this);e.set.call(this,s),this.requestUpdate(i,o,t)},init(e){return void 0!==e&&this.C(i,void 0,t,e),e}}}if("setter"===i){const{name:i}=s;return function(s){const o=this[i];e.call(this,s),this.requestUpdate(i,o,t)}}throw Error("Unsupported decorator location: "+i)};function Z(t){return(e,s)=>"object"==typeof s?D(t,e,s):((t,e,s)=>{const i=e.hasOwnProperty(s);return e.constructor.createProperty(s,t),i?Object.getOwnPropertyDescriptor(e,s):void 0})(t,e,s)}
29
+ /**
30
+ * @license
31
+ * Copyright 2017 Google LLC
32
+ * SPDX-License-Identifier: BSD-3-Clause
33
+ */function V(t){return Z({...t,state:!0,attribute:!1})}
34
+ /**
35
+ * @license
36
+ * Copyright 2017 Google LLC
37
+ * SPDX-License-Identifier: BSD-3-Clause
38
+ */
39
+ /**
40
+ * @license
41
+ * Copyright 2017 Google LLC
42
+ * SPDX-License-Identifier: BSD-3-Clause
43
+ */
44
+ function K(t,e){return(e,s,i)=>((t,e,s)=>(s.configurable=!0,s.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,s),s))(e,s,{get(){return(e=>e.renderRoot?.querySelector(t)??null)(this)}})}let F=class extends e{constructor(){super(...arguments),this.active=!1}connectedCallback(){this.role=this.role||"tabpanel",this.slot="panel",super.connectedCallback()}render(){return s`<m3e-collapsible ?open=${this.active}>
45
+ <div class="content">
46
+ <div><slot></slot></div>
47
+ <slot name="actions"></slot>
48
+ </div>
49
+ </m3e-collapsible>`}};var J,X,G,Q,Y;F.styles=t`
50
+ :host {
51
+ display: block;
52
+ }
53
+ .content {
54
+ display: flex;
55
+ flex-direction: column;
56
+ padding: var(--m3e-step-panel-padding, 1rem 1.5rem 1.5rem 1.5rem);
57
+ row-gap: var(--m3e-step-panel-spacing, 0.5rem);
58
+ }
59
+ ::slotted([slot="actions"]) {
60
+ flex: none;
61
+ display: flex;
62
+ align-items: center;
63
+ min-height: var(--m3e-step-panel-actions-height, 3rem);
64
+ }
65
+ ::slotted([slot="actions"][end]) {
66
+ justify-content: flex-end;
67
+ }
68
+ `,$([V()],F.prototype,"active",void 0),F=$([_("m3e-step-panel")],F);let tt=Y=class extends(o(r(n(l(a(c(d(e,"tab")))))))){constructor(){super(...arguments),J.add(this),X.set(this,t=>y(this,J,"m",Q).call(this,t)),this.optional=!1,this.editable=!1,this.completed=!1,this.invalid=!1,this.index=-1}get panel(){return this.control instanceof F?this.control:null}get stepper(){return this.closest("m3e-stepper")}reset(){this.invalid=!1,this.completed=!1,this.panel?.querySelector("form")?.reset()}attach(t){t instanceof F&&(t.id=t.id||"m3e-step-panel-"+Y.__nextId++,p(this,"aria-controls",t.id)),super.attach(t)}detach(){this.control?.id&&m(this,"aria-controls",this.control.id),super.detach()}connectedCallback(){this.slot="step",super.connectedCallback(),this.addEventListener("click",y(this,X,"f"))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",y(this,X,"f"))}update(t){super.update(t),t.has("selected")&&this.closest("m3e-stepper")?.[u].notifySelectionChange(this)}firstUpdated(t){super.firstUpdated(t),[this._focusRing,this._stateLayer,this._ripple].forEach(t=>t?.attach(this))}render(){const t=s`<slot name="hint">${this.optional?s`<span class="hint">(Optional)</span>`:i}</slot>`,e=s`<slot name="error">${t}</slot>`;return s` <m3e-state-layer class="state-layer" ?disabled="${this.disabled}"></m3e-state-layer>
69
+ <m3e-focus-ring class="focus-ring" ?disabled="${this.disabled}"></m3e-focus-ring>
70
+ <m3e-ripple class="ripple" ?disabled="${this.disabled}"></m3e-ripple>
71
+ <div class="wrapper">
72
+ <div class="icon" aria-hidden="true">${y(this,J,"m",G).call(this)}</div>
73
+ <div class="label">
74
+ <slot></slot>
75
+ ${this.invalid?e:t}
76
+ </div>
77
+ </div>`}};var et,st,it,ot;X=new WeakMap,J=new WeakSet,G=function(){if(!this.selected){if(this.invalid)return s`<slot name="error-icon">
78
+ <svg viewBox="0 -960 960 960" fill="currentColor">
79
+ <path
80
+ d="m40-120 440-760 440 760H40Zm138-80h604L480-720 178-200Zm302-40q17 0 28.5-11.5T520-280q0-17-11.5-28.5T480-320q-17 0-28.5 11.5T440-280q0 17 11.5 28.5T480-240Zm-40-120h80v-200h-80v200Zm40-100Z"
81
+ />
82
+ </svg>
83
+ </slot>`;if(this.completed)return this.editable?s`<slot name="edit-icon">
84
+ <svg viewBox="0 -960 960 960" fill="currentColor">
85
+ <path
86
+ d="M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z"
87
+ />
88
+ </svg>
89
+ </slot>`:s`<slot name="done-icon">
90
+ <svg viewBox="0 -960 960 960" fill="currentColor">
91
+ <path d="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z" />
92
+ </svg>
93
+ </slot>`}return s`<slot name="icon">${this.index+1}</slot>`},Q=function(t){this.disabled&&(t.preventDefault(),t.stopImmediatePropagation()),t.defaultPrevented||this.selected||(this.selected=!0,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0,cancelable:!0}))?(this.closest("m3e-stepper")?.moveTo(this.index),this.dispatchEvent(new Event("change",{bubbles:!0}))):this.selected=!1)},tt.styles=t`
94
+ :host {
95
+ display: block;
96
+ position: relative;
97
+ outline: none;
98
+ min-width: 0px;
99
+ border-radius: var(--m3e-step-shape, ${h.shape.corner.medium});
100
+ padding: var(--m3e-step-padding, 1.5rem);
101
+ }
102
+ :host(:not([aria-disabled="true"])) {
103
+ cursor: pointer;
104
+ user-select: none;
105
+ }
106
+ .icon {
107
+ flex: none;
108
+ display: flex;
109
+ align-items: center;
110
+ justify-content: center;
111
+ border-radius: var(--m3e-step-icon-shape, 50%);
112
+ width: var(--m3e-step-icon-size, 1.5rem);
113
+ height: var(--m3e-step-icon-size, 1.5rem);
114
+ }
115
+ .icon svg,
116
+ ::slotted([slot="icon"]),
117
+ ::slotted([slot="edit-icon"]),
118
+ ::slotted([slot="done-icon"]),
119
+ ::slotted([slot="error-icon"]) {
120
+ width: 1em;
121
+ font-size: var(--m3e-step-icon-size, 1.5rem) !important;
122
+ }
123
+ :host(:not([aria-disabled="true"])[selected]) .icon {
124
+ background-color: var(--m3e-step-selected-icon-container-color, ${h.color.primary});
125
+ color: var(--m3e-step-selected-icon-color, ${h.color.onPrimary});
126
+ }
127
+ :host(:not([aria-disabled="true"])[completed]:not([invalid])) .icon {
128
+ background-color: var(--m3e-step-completed-icon-container-color, ${h.color.primary});
129
+ color: var(--m3e-step-completed-icon-color, ${h.color.onPrimary});
130
+ }
131
+ :host(:not([aria-disabled="true"]):not([selected]):not([completed]):not([invalid])) .icon {
132
+ background-color: var(--m3e-step-unselected-icon-container-color, ${h.color.inverseSurface});
133
+ color: var(--m3e-step-unselected-icon-color, ${h.color.inverseOnSurface});
134
+ }
135
+ :host(:not([aria-disabled="true"]):not([selected])[invalid]) .icon {
136
+ color: var(--m3e-step-icon-error-color, ${h.color.error});
137
+ }
138
+ :host([aria-disabled="true"]) .icon {
139
+ background-color: color-mix(
140
+ in srgb,
141
+ var(--m3e-step-disabled-icon-container-color, ${h.color.onSurface}) 10%,
142
+ transparent
143
+ );
144
+ color: color-mix(in srgb, var(--m3e-step-disabled-icon-color, ${h.color.onSurface}) 38%, transparent);
145
+ }
146
+
147
+ :host(:not([aria-disabled="true"])) .label {
148
+ color: var(--m3e-step-label-color, ${h.color.onSurface});
149
+ }
150
+ :host(:not([aria-disabled="true"]):not([selected])[invalid]) .label {
151
+ color: var(--m3e-step-label-error-color, ${h.color.error});
152
+ }
153
+ :host([aria-disabled="true"]) .label {
154
+ color: color-mix(in srgb, var(--m3e-step-disabled-label-color, ${h.color.onSurface}) 38%, transparent);
155
+ }
156
+ .wrapper {
157
+ display: flex;
158
+ align-items: center;
159
+ height: 100%;
160
+ border-radius: inherit;
161
+ font-size: var(--m3e-step-font-size, ${h.typescale.standard.title.small.fontSize});
162
+ font-weight: var(--m3e-step-font-weight, ${h.typescale.standard.title.small.fontWeight});
163
+ line-height: var(--m3e-step-line-height, ${h.typescale.standard.title.small.lineHeight});
164
+ letter-spacing: var(--m3e-step-tracking, ${h.typescale.standard.title.small.tracking});
165
+ flex-direction: var(--_step-direction, row);
166
+ gap: var(--m3e-step-icon-label-space, 0.5rem);
167
+ justify-content: flex-start;
168
+ }
169
+ .label {
170
+ display: flex;
171
+ flex-direction: column;
172
+ align-items: var(--_step-label-align-items, flex-start);
173
+ }
174
+ ::slotted([slot="hint"]),
175
+ .hint,
176
+ ::slotted([slot="error"]) {
177
+ font-size: var(--m3e-step-hint-font-size, ${h.typescale.standard.body.small.fontSize});
178
+ font-weight: var(--m3e-step-hint-font-weight, ${h.typescale.standard.body.small.fontWeight});
179
+ line-height: var(--m3e-step-hint-line-height, ${h.typescale.standard.body.small.lineHeight});
180
+ letter-spacing: var(--m3e-step-hint-tracking, ${h.typescale.standard.body.small.tracking});
181
+ }
182
+ :host(:not([aria-disabled="true"]):not([invalid])) ::slotted([slot="hint"]),
183
+ :host(:not([aria-disabled="true"]):not([invalid])) .hint {
184
+ color: var(--m3e-step-hint-color, ${h.color.onSurfaceVariant});
185
+ }
186
+ :host([aria-disabled="true"]) ::slotted([slot="hint"]),
187
+ :host([aria-disabled="true"]) .hint {
188
+ color: color-mix(in srgb, var(--m3e-step-disabled-hint-color, ${h.color.onSurface}) 38%, transparent);
189
+ }
190
+ `,tt.__nextId=0,$([K(".focus-ring")],tt.prototype,"_focusRing",void 0),$([K(".state-layer")],tt.prototype,"_stateLayer",void 0),$([K(".ripple")],tt.prototype,"_ripple",void 0),$([Z({type:Boolean,reflect:!0})],tt.prototype,"optional",void 0),$([Z({type:Boolean,reflect:!0})],tt.prototype,"editable",void 0),$([Z({type:Boolean,reflect:!0})],tt.prototype,"completed",void 0),$([Z({type:Boolean,reflect:!0})],tt.prototype,"invalid",void 0),$([V()],tt.prototype,"index",void 0),tt=Y=$([_("m3e-step")],tt);class rt extends(c(e)){constructor(t){super(),et.add(this),st.set(this,t=>y(this,et,"m",ot).call(this,t)),it.set(this,void 0),g(this,it,t,"f")}connectedCallback(){this.role=this.role||"none",super.connectedCallback(),this.parentElement?.addEventListener("click",y(this,st,"f"))}disconnectedCallback(){super.disconnectedCallback(),this.parentElement?.removeEventListener("click",y(this,st,"f"))}render(){return s`<slot></slot>`}}st=new WeakMap,it=new WeakMap,et=new WeakSet,ot=function(t){if(!t.defaultPrevented)switch(y(this,it,"f")){case"next":this.closest("m3e-stepper")?.moveNext();break;case"previous":this.closest("m3e-stepper")?.movePrevious();break;case"reset":this.closest("m3e-stepper")?.reset()}},rt.styles=t`
191
+ :host {
192
+ display: contents;
193
+ }
194
+ ::slotted(.material-icons) {
195
+ font-size: inherit !important;
196
+ }
197
+ `
198
+ /**
199
+ * @license
200
+ * Copyright 2017 Google LLC
201
+ * SPDX-License-Identifier: BSD-3-Clause
202
+ */;const nt=globalThis,lt=nt.trustedTypes,at=lt?lt.createPolicy("lit-html",{createHTML:t=>t}):void 0,ct="$lit$",dt=`lit$${Math.random().toFixed(9).slice(2)}$`,ht="?"+dt,pt=`<${ht}>`,mt=document,ut=()=>mt.createComment(""),vt=t=>null===t||"object"!=typeof t&&"function"!=typeof t,ft=Array.isArray,bt="[ \t\n\f\r]",$t=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,yt=/-->/g,gt=/>/g,_t=RegExp(`>|${bt}(?:([^\\s"'>=/]+)(${bt}*=${bt}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),At=/'/g,wt=/"/g,Et=/^(?:script|style|textarea|title)$/i,xt=Symbol.for("lit-noChange"),St=Symbol.for("lit-nothing"),Pt=new WeakMap,Ct=mt.createTreeWalker(mt,129);function kt(t,e){if(!ft(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==at?at.createHTML(e):e}const Tt=(t,e)=>{const s=t.length-1,i=[];let o,r=2===e?"<svg>":3===e?"<math>":"",n=$t;for(let e=0;e<s;e++){const s=t[e];let l,a,c=-1,d=0;for(;d<s.length&&(n.lastIndex=d,a=n.exec(s),null!==a);)d=n.lastIndex,n===$t?"!--"===a[1]?n=yt:void 0!==a[1]?n=gt:void 0!==a[2]?(Et.test(a[2])&&(o=RegExp("</"+a[2],"g")),n=_t):void 0!==a[3]&&(n=_t):n===_t?">"===a[0]?(n=o??$t,c=-1):void 0===a[1]?c=-2:(c=n.lastIndex-a[2].length,l=a[1],n=void 0===a[3]?_t:'"'===a[3]?wt:At):n===wt||n===At?n=_t:n===yt||n===gt?n=$t:(n=_t,o=void 0);const h=n===_t&&t[e+1].startsWith("/>")?" ":"";r+=n===$t?s+pt:c>=0?(i.push(l),s.slice(0,c)+ct+s.slice(c)+dt+h):s+dt+(-2===c?e:h)}return[kt(t,r+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),i]};class Ot{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let o=0,r=0;const n=t.length-1,l=this.parts,[a,c]=Tt(t,e);if(this.el=Ot.createElement(a,s),Ct.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(i=Ct.nextNode())&&l.length<n;){if(1===i.nodeType){if(i.hasAttributes())for(const t of i.getAttributeNames())if(t.endsWith(ct)){const e=c[r++],s=i.getAttribute(t).split(dt),n=/([.?@])?(.*)/.exec(e);l.push({type:1,index:o,name:n[2],strings:s,ctor:"."===n[1]?zt:"?"===n[1]?Rt:"@"===n[1]?It:Nt}),i.removeAttribute(t)}else t.startsWith(dt)&&(l.push({type:6,index:o}),i.removeAttribute(t));if(Et.test(i.tagName)){const t=i.textContent.split(dt),e=t.length-1;if(e>0){i.textContent=lt?lt.emptyScript:"";for(let s=0;s<e;s++)i.append(t[s],ut()),Ct.nextNode(),l.push({type:2,index:++o});i.append(t[e],ut())}}}else if(8===i.nodeType)if(i.data===ht)l.push({type:2,index:o});else{let t=-1;for(;-1!==(t=i.data.indexOf(dt,t+1));)l.push({type:7,index:o}),t+=dt.length-1}o++}}static createElement(t,e){const s=mt.createElement("template");return s.innerHTML=t,s}}function Ut(t,e,s=t,i){if(e===xt)return e;let o=void 0!==i?s._$Co?.[i]:s._$Cl;const r=vt(e)?void 0:e._$litDirective$;return o?.constructor!==r&&(o?._$AO?.(!1),void 0===r?o=void 0:(o=new r(t),o._$AT(t,s,i)),void 0!==i?(s._$Co??=[])[i]=o:s._$Cl=o),void 0!==o&&(e=Ut(t,o._$AS(t,e.values),o,i)),e}class Mt{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,i=(t?.creationScope??mt).importNode(e,!0);Ct.currentNode=i;let o=Ct.nextNode(),r=0,n=0,l=s[0];for(;void 0!==l;){if(r===l.index){let e;2===l.type?e=new Ht(o,o.nextSibling,this,t):1===l.type?e=new l.ctor(o,l.name,l.strings,this,t):6===l.type&&(e=new jt(o,this,t)),this._$AV.push(e),l=s[++n]}r!==l?.index&&(o=Ct.nextNode(),r++)}return Ct.currentNode=mt,i}p(t){let e=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class Ht{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,i){this.type=2,this._$AH=St,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Ut(this,t,e),vt(t)?t===St||null==t||""===t?(this._$AH!==St&&this._$AR(),this._$AH=St):t!==this._$AH&&t!==xt&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>ft(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==St&&vt(this._$AH)?this._$AA.nextSibling.data=t:this.T(mt.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,i="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=Ot.createElement(kt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(e);else{const t=new Mt(i,this),s=t.u(this.options);t.p(e),this.T(s),this._$AH=t}}_$AC(t){let e=Pt.get(t.strings);return void 0===e&&Pt.set(t.strings,e=new Ot(t)),e}k(t){ft(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,i=0;for(const o of t)i===e.length?e.push(s=new Ht(this.O(ut()),this.O(ut()),this,this.options)):s=e[i],s._$AI(o),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class Nt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,o){this.type=1,this._$AH=St,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=St}_$AI(t,e=this,s,i){const o=this.strings;let r=!1;if(void 0===o)t=Ut(this,t,e,0),r=!vt(t)||t!==this._$AH&&t!==xt,r&&(this._$AH=t);else{const i=t;let n,l;for(t=o[0],n=0;n<o.length-1;n++)l=Ut(this,i[s+n],e,n),l===xt&&(l=this._$AH[n]),r||=!vt(l)||l!==this._$AH[n],l===St?t=St:t!==St&&(t+=(l??"")+o[n+1]),this._$AH[n]=l}r&&!i&&this.j(t)}j(t){t===St?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class zt extends Nt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===St?void 0:t}}class Rt extends Nt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==St)}}class It extends Nt{constructor(t,e,s,i,o){super(t,e,s,i,o),this.type=5}_$AI(t,e=this){if((t=Ut(this,t,e,0)??St)===xt)return;const s=this._$AH,i=t===St&&s!==St||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==St&&(s===St||i);i&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class jt{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){Ut(this,t)}}const Lt=nt.litHtmlPolyfillSupport;Lt?.(Ot,Ht),(nt.litHtmlVersions??=[]).push("3.3.1");var qt,Wt,Bt,Dt,Zt,Vt,Kt,Ft,Jt,Xt;let Gt=class extends(c(e)){constructor(){super(...arguments),qt.add(this),Wt.set(this,void 0),this._selectedIndex=null,this[Xt]=(new v).withHomeAndEnd().withWrap().onSelectedItemsChange(()=>y(this,qt,"m",Kt).call(this)),this.headerPosition="above",this.labelPosition="end",this.linear=!1,this.orientation="horizontal"}get steps(){return this[u]?.items??[]}get selectedStep(){return null!==this._selectedIndex?this.steps[this._selectedIndex]??null:null}get selectedIndex(){return this._selectedIndex??-1}movePrevious(){return this.moveTo((this._selectedIndex??1)-1)}moveNext(){return this.moveTo((this._selectedIndex??-1)+1)}moveTo(t){const e=this.selectedStep;if(e&&e.index===t)return!0;if(t>=0&&t<this.steps.length){if(e){const s=y(this,qt,"m",Ft).call(this);if(this.linear)if(t<e.index){const e=this[u].items[t];if(!e||e.completed&&!e.editable)return!1}else if(t>e.index+1){const e=this[u].items[t];if(!e||!e.completed)return!1}else if(!s&&!e.optional)return!1;e.completed=!0}return this._selectedIndex=t,this[u].select(this.selectedStep),this.dispatchEvent(new Event("change",{bubbles:!0})),!0}return e&&(this[u].deselect(e),this.dispatchEvent(new Event("change",{bubbles:!0}))),!1}reset(){this.steps.forEach(t=>t.reset());const t=this.steps.find(t=>!t.disabled);t?this.moveTo(this.steps.indexOf(t)):this.moveTo(-1)}connectedCallback(){this.role=this.role||"none",super.connectedCallback(),this.classList.toggle("-no-animate",!0)}disconnectedCallback(){super.disconnectedCallback(),this._orientation=void 0,y(this,Wt,"f")?.call(this)}update(t){super.update(t),t.has("orientation")&&(y(this,Wt,"f")?.call(this),"auto"===this.orientation?g(this,Wt,f.observe([b.XSmall],t=>{this._orientation=t.get(b.XSmall)?"vertical":"horizontal",y(this,qt,"m",Jt).call(this)}),"f"):y(this,qt,"m",Jt).call(this)),t.has("_orientation")&&y(this,qt,"m",Jt).call(this)}render(){let t=null;return this.selectedStep?.panel&&(t=[...this.querySelectorAll("[slot='panel']")].indexOf(this.selectedStep.panel),-1===t&&(t=null)),this[u].vertical?s`${y(this,qt,"m",Bt).call(this)} <slot name="panel"></slot>`:s`${"above"===this.headerPosition?y(this,qt,"m",Bt).call(this):i}
203
+ <m3e-slide class="steps" .selectedIndex="${t}">
204
+ <slot name="panel"></slot>
205
+ </m3e-slide>
206
+ ${"below"===this.headerPosition?y(this,qt,"m",Bt).call(this):i}`}};Wt=new WeakMap,qt=new WeakSet,Xt=u,Bt=function(){return s`<div
207
+ class="header"
208
+ role="tablist"
209
+ aria-orientation="${(t=>t??St)(this[u].vertical?"vertical":void 0)}"
210
+ @change="${y(this,qt,"m",Dt)}"
211
+ >
212
+ <slot name="step" @slotchange="${y(this,qt,"m",Zt)}" @keydown="${y(this,qt,"m",Vt)}"></slot>
213
+ </div>`},Dt=function(t){t.stopPropagation()},Zt=function(){const{added:t,removed:e}=this[u].setItems([...this.querySelectorAll("m3e-step")]);if(t.length>0||e.length>0){this.querySelectorAll(".-m3e-step-divider").forEach(t=>t.remove());for(let t=0;t<this[u].items.length;t++){const e=this[u].items[t];if(e.index=t,t>0){const t=document.createElement("div");t.ariaHidden="true",t.classList.add("-m3e-step-divider"),t.slot="step",e.insertAdjacentElement("beforebegin",t)}}y(this,qt,"m",Jt).call(this),0==this[u].selectedItems.length&&this[u].select(this[u].items.find(t=>!t.disabled))}},Vt=function(t){this[u].onKeyDown(t)},Kt=function(){const t=this[u].selectedItems[0];let e=t?this.steps.indexOf(t):null;-1===e&&(e=null),this._selectedIndex=e;for(const t of this[u].items)t.panel&&(t.panel.active=t.index===e);t&&this.matches(":focus-within")&&!t.matches(":focus")&&t.focus(),this.classList.contains("-no-animate")&&requestAnimationFrame(()=>this.classList.toggle("-no-animate",!1))},Ft=function(){let t=!1;return this.selectedStep&&(t=this.selectedStep.panel?.querySelector("form")?.checkValidity()??!0,this.selectedStep.optional&&(t=!0),this.selectedStep.invalid=!t),t},Jt=function(){this[u].vertical="vertical"===(this._orientation??this.orientation),this.classList.toggle("-vertical",this[u].vertical),this[u].vertical?this.steps.forEach((t,e)=>{t.style.order=`${e}`,t.panel&&(t.panel.style.order=`${e}`)}):this.steps.forEach(t=>{t.style.order="",t.panel&&(t.panel.style.order="")})},Gt.styles=t`
214
+ :host {
215
+ display: flex;
216
+ flex-direction: column;
217
+ position: relative;
218
+ }
219
+ :host(:not(.-vertical)) .header {
220
+ display: flex;
221
+ align-items: flex-start;
222
+ flex-wrap: nowrap;
223
+ }
224
+ :host(:not(.-vertical)) ::slotted(.-m3e-step-divider) {
225
+ flex: 1 1 auto;
226
+ position: relative;
227
+ min-width: 2rem;
228
+ }
229
+ :host(:not(.-vertical)) ::slotted(.-m3e-step-divider)::before {
230
+ content: "";
231
+ position: absolute;
232
+ left: 0;
233
+ right: 0;
234
+ border-bottom-width: var(--m3e-step-divider-thickness, 1px);
235
+ border-bottom-style: solid;
236
+ border-bottom-color: var(--m3e-step-divider-color, ${h.color.outline});
237
+ }
238
+ :host(:not(.-vertical):not([label-position="below"])) ::slotted(.-m3e-step-divider)::before {
239
+ top: 50%;
240
+ }
241
+ :host(:not(.-vertical)) ::slotted([slot="step"]) {
242
+ align-self: stretch;
243
+ }
244
+ :host(:not(.-vertical)) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:first-of-type))::before,
245
+ :host(:not(.-vertical)) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:last-of-type))::after {
246
+ content: "";
247
+ display: block;
248
+ position: absolute;
249
+ top: 0;
250
+ border-bottom-width: var(--m3e-step-divider-thickness, 1px);
251
+ border-bottom-style: solid;
252
+ border-bottom-color: var(--m3e-step-divider-color, ${h.color.outline});
253
+ }
254
+ :host(:not(.-vertical)[label-position="end"]) ::slotted(.-m3e-step-divider) {
255
+ margin-block: auto;
256
+ }
257
+ :host(:not(.-vertical)[label-position="end"])
258
+ ::slotted([slot="step"]:not(.-m3e-step-divider):not(:first-of-type))::before,
259
+ :host(:not(.-vertical)[label-position="end"])
260
+ ::slotted([slot="step"]:not(.-m3e-step-divider):not(:last-of-type))::after {
261
+ top: 50%;
262
+ }
263
+ :host(:not(.-vertical)[label-position="end"])
264
+ ::slotted([slot="step"]:not(.-m3e-step-divider):not(:first-of-type))::before {
265
+ left: 0;
266
+ right: calc(100% - var(--m3e-step-padding, 1.5rem) + var(--m3e-step-divider-inset, 0.5rem));
267
+ }
268
+ :host(:not(.-vertical)[label-position="end"])
269
+ ::slotted([slot="step"]:not(.-m3e-step-divider):not(:last-of-type))::after {
270
+ left: calc(100% - var(--m3e-step-padding, 1.5rem) + var(--m3e-step-divider-inset, 0.5rem));
271
+ right: 0;
272
+ }
273
+ :host(:not(.-vertical)[label-position="below"]) ::slotted(.-m3e-step-divider)::before,
274
+ :host(:not(.-vertical)[label-position="below"])
275
+ ::slotted([slot="step"]:not(.-m3e-step-divider):not(:first-of-type))::before,
276
+ :host(:not(.-vertical)[label-position="below"])
277
+ ::slotted([slot="step"]:not(.-m3e-step-divider):not(:last-of-type))::after {
278
+ margin-block-start: calc(var(--m3e-step-padding, 1.5rem) + calc(var(--m3e-step-icon-size, 1.5rem) / 2));
279
+ }
280
+ :host(:not(.-vertical)[label-position="below"])
281
+ ::slotted([slot="step"]:not(.-m3e-step-divider):not(:first-of-type))::before {
282
+ left: 0;
283
+ right: calc(50% + calc(var(--m3e-step-icon-size, 1.5rem) / 2) + var(--m3e-step-divider-inset, 0.5rem));
284
+ }
285
+ :host(:not(.-vertical)[label-position="below"])
286
+ ::slotted([slot="step"]:not(.-m3e-step-divider):not(:last-of-type))::after {
287
+ left: calc(50% + calc(var(--m3e-step-icon-size, 1.5rem) / 2) + var(--m3e-step-divider-inset, 0.5rem));
288
+ right: 0;
289
+ }
290
+ :host(:not(.-vertical)[label-position="below"]) {
291
+ --_step-direction: column;
292
+ --_step-label-align-items: center;
293
+ }
294
+ :host(.-vertical) .header {
295
+ display: contents;
296
+ }
297
+ :host(.-vertical) ::slotted([slot="step"]:not(.-m3e-step-divider)) {
298
+ flex: none;
299
+ }
300
+ :host(.-vertical) ::slotted([slot="panel"]) {
301
+ margin-inline-start: calc(var(--m3e-step-padding, 1.5rem) + calc(var(--m3e-step-icon-size, 1.5rem) / 2));
302
+ }
303
+ :host(.-vertical) ::slotted([slot="panel"]:not(:last-of-type)) {
304
+ border-inline-start-width: var(--m3e-step-divider-thickness, 1px);
305
+ border-inline-start-style: solid;
306
+ border-inline-start-color: var(--m3e-step-divider-color, ${h.color.outline});
307
+ }
308
+ :host(.-vertical) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:first-of-type))::before,
309
+ :host(.-vertical) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:last-of-type))::after {
310
+ content: "";
311
+ display: block;
312
+ position: absolute;
313
+ left: 0;
314
+ margin-inline-start: calc(var(--m3e-step-padding, 1.5rem) + calc(var(--m3e-step-icon-size, 1.5rem) / 2));
315
+ border-inline-start-width: var(--m3e-step-divider-thickness, 1px);
316
+ border-inline-start-style: solid;
317
+ border-inline-start-color: var(--m3e-step-divider-color, ${h.color.outline});
318
+ }
319
+ :host(.-vertical) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:first-of-type))::before {
320
+ top: 0;
321
+ bottom: calc(100% - var(--m3e-step-padding, 1.5rem) + var(--m3e-step-divider-inset, 0.5rem));
322
+ }
323
+ :host(.-vertical) ::slotted([slot="step"]:not(.-m3e-step-divider):not(:last-of-type))::after {
324
+ top: calc(100% - var(--m3e-step-padding, 1.5rem) + var(--m3e-step-divider-inset, 0.5rem));
325
+ bottom: 0;
326
+ }
327
+ :host(:not(.-vertical)) {
328
+ --m3e-collapsible-animation-duration: 0ms;
329
+ }
330
+ :host(.-no-animate) {
331
+ --m3e-collapsible-animation-duration: 0ms;
332
+ }
333
+ `,$([V()],Gt.prototype,"_orientation",void 0),$([V()],Gt.prototype,"_selectedIndex",void 0),$([Z({attribute:"header-position",reflect:!0})],Gt.prototype,"headerPosition",void 0),$([Z({attribute:"label-position",reflect:!0})],Gt.prototype,"labelPosition",void 0),$([Z({type:Boolean,reflect:!0})],Gt.prototype,"linear",void 0),$([Z({reflect:!0})],Gt.prototype,"orientation",void 0),Gt=$([_("m3e-stepper")],Gt);let Qt=class extends rt{constructor(){super("next")}};Qt=$([_("m3e-stepper-next")],Qt);let Yt=class extends rt{constructor(){super("previous")}};Yt=$([_("m3e-stepper-previous")],Yt);let te=class extends rt{constructor(){super("reset")}};te=$([_("m3e-stepper-reset")],te);export{tt as M3eStepElement,F as M3eStepPanelElement,Gt as M3eStepperElement,Qt as M3eStepperNextElement,Yt as M3eStepperPreviousElement,te as M3eStepperResetElement,rt as StepperButtonElementBase};
334
+ //# sourceMappingURL=index.min.js.map