@digital-realty/ix-button 3.3.3 → 3.3.4-alpha-224946-t51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,7 @@ import '@material/web/button/filled-button.js';
6
6
  import '@material/web/button/outlined-button.js';
7
7
  import '@material/web/button/filled-tonal-button.js';
8
8
  import '@material/web/icon/icon.js';
9
+ import '@digital-realty/ix-progress/ix-progress.js';
9
10
  import { FormSubmitter, FormSubmitterType } from '@material/web/internal/controller/form-submitter.js';
10
11
  export declare class IxButton extends LitElement implements FormSubmitter {
11
12
  /** @nocollapse */
@@ -30,6 +31,10 @@ export declare class IxButton extends LitElement implements FormSubmitter {
30
31
  * Whether or not the button is disabled.
31
32
  */
32
33
  disabled: boolean;
34
+ /**
35
+ * Whether or not the button is submitting.
36
+ */
37
+ submitting: boolean;
33
38
  /**
34
39
  * The URL that the link button points to.
35
40
  */
package/dist/IxButton.js CHANGED
@@ -12,6 +12,7 @@ import '@material/web/button/filled-button.js';
12
12
  import '@material/web/button/outlined-button.js';
13
13
  import '@material/web/button/filled-tonal-button.js';
14
14
  import '@material/web/icon/icon.js';
15
+ import '@digital-realty/ix-progress/ix-progress.js';
15
16
  import { setupFormSubmitter, } from '@material/web/internal/controller/form-submitter.js';
16
17
  import { requestUpdateOnAriaChange } from '@material/web/internal/aria/delegate.js';
17
18
  export class IxButton extends LitElement {
@@ -52,6 +53,10 @@ export class IxButton extends LitElement {
52
53
  * Whether or not the button is disabled.
53
54
  */
54
55
  this.disabled = false;
56
+ /**
57
+ * Whether or not the button is submitting.
58
+ */
59
+ this.submitting = false;
55
60
  /**
56
61
  * The URL that the link button points to.
57
62
  */
@@ -102,7 +107,7 @@ export class IxButton extends LitElement {
102
107
  }
103
108
  const tag = ((_b = this.tags) === null || _b === void 0 ? void 0 : _b[this.appearance]) || this.tags.outlined;
104
109
  return staticHtml `<${tag}
105
- ?disabled=${this.disabled}
110
+ ?disabled=${this.disabled || this.submitting}
106
111
  target=${ifDefined(this.target)}
107
112
  href=${ifDefined(this.href)}
108
113
  ?trailing-icon=${this.trailingIcon}
@@ -112,7 +117,12 @@ export class IxButton extends LitElement {
112
117
  class="md-button"
113
118
  >
114
119
  <div class="slot-wrap">
115
- <slot></slot>
120
+ ${this.submitting
121
+ ? html `<ix-progress
122
+ .indeterminate=${true}
123
+ .linear=${false}
124
+ ></ix-progress>`
125
+ : html `<slot></slot>`}
116
126
  </div>
117
127
  ${this.hasIcon ? html `<slot slot="icon" name="icon"></slot>` : nothing}
118
128
  </${tag}>`;
@@ -139,6 +149,9 @@ __decorate([
139
149
  __decorate([
140
150
  property({ type: Boolean, reflect: true })
141
151
  ], IxButton.prototype, "disabled", void 0);
152
+ __decorate([
153
+ property({ type: Boolean, reflect: true })
154
+ ], IxButton.prototype, "submitting", void 0);
142
155
  __decorate([
143
156
  property()
144
157
  ], IxButton.prototype, "href", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"IxButton.js","sourceRoot":"","sources":["../src/IxButton.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAC1D,OAAO,EAAE,IAAI,IAAI,UAAU,EAAe,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EACL,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,mDAAmD,CAAC;AAC9E,OAAO,qCAAqC,CAAC;AAC7C,OAAO,yCAAyC,CAAC;AACjD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,yCAAyC,CAAC;AACjD,OAAO,6CAA6C,CAAC;AACrD,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAGL,kBAAk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,CAAC,YAAY;kBACtB,IAAI,CAAC,OAAO;eACf,IAAI,CAAC,KAAK;aACZ,IAAI,CAAC,IAAI;;;;;;QAMd,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAA,uCAAuC,CAAC,CAAC,CAAC,OAAO;QACpE,GAAG,GAAG,CAAC;IACb,CAAC;;KAlGA,SAAS;AA1CV;IACE,yBAAyB,CAAC,QAAQ,CAAC,CAAC;IACpC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;AAC/B,CAAC,GAAA,CAAA;AAED,kBAAkB;AACF,uBAAc,GAAG,IAAI,AAAP,CAAQ;AAEtC,kBAAkB;AACF,0BAAiB,GAAmB;IAClD,IAAI,EAAE,MAAM;IACZ,cAAc,EAAE,IAAI;CACrB,AAHgC,CAG/B;AA2BU;IAAX,QAAQ,EAAE;uCAAY;AAcX;IAAX,QAAQ,EAAE;sCAAoC;AAKH;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAkB;AAKjD;IAAX,QAAQ,EAAE;sCAAsC;AAMrC;IAAX,QAAQ,EAAE;wCAA2D;AAQb;IAAxD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;8CAAsB;AAK1B;IAAnD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;yCAAiB;AAGpE;IADC,QAAQ,EAAE;4CAOa","sourcesContent":["import { html, LitElement, isServer, nothing } from 'lit';\nimport { html as staticHtml, StaticValue, literal } from 'lit/static-html.js';\nimport { property } from 'lit/decorators.js';\nimport {\n dispatchActivationClick,\n isActivationClick,\n} from '@material/web/internal/events/form-label-activation.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { internals } from '@material/web/labs/behaviors/element-internals.js';\nimport '@material/web/button/text-button.js';\nimport '@material/web/button/elevated-button.js';\nimport '@material/web/button/filled-button.js';\nimport '@material/web/button/outlined-button.js';\nimport '@material/web/button/filled-tonal-button.js';\nimport '@material/web/icon/icon.js';\nimport {\n FormSubmitter,\n FormSubmitterType,\n setupFormSubmitter,\n} from '@material/web/internal/controller/form-submitter.js';\nimport { requestUpdateOnAriaChange } from '@material/web/internal/aria/delegate.js';\n\nexport class IxButton extends LitElement implements FormSubmitter {\n static {\n requestUpdateOnAriaChange(IxButton);\n setupFormSubmitter(IxButton);\n }\n\n /** @nocollapse */\n static readonly formAssociated = true;\n\n /** @nocollapse */\n static override shadowRootOptions: ShadowRootInit = {\n mode: 'open',\n delegatesFocus: true,\n };\n\n /**\n * The associated form element with which this element's value will submit.\n */\n get form() {\n return this[internals].form;\n }\n\n set form(form: HTMLFormElement | null) {\n this.setAttribute('form', form as unknown as string);\n }\n\n get buttonElement(): HTMLElement {\n return this.shadowRoot\n ?.querySelector('.md-button')\n ?.shadowRoot?.querySelector('.button')!;\n }\n\n get name() {\n return this.getAttribute('name') ?? '';\n }\n\n set name(name: string) {\n this.setAttribute('name', name);\n }\n\n @property() value = '';\n\n /** @private */\n [internals] = (this as HTMLElement) /* needed for closure */\n .attachInternals();\n\n override focus() {\n this.buttonElement.focus();\n }\n\n override blur() {\n this.buttonElement.blur();\n }\n\n @property() type: FormSubmitterType = 'submit';\n\n /**\n * Whether or not the button is disabled.\n */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /**\n * The URL that the link button points to.\n */\n @property() href: string | undefined = undefined;\n\n /**\n * Where to display the linked `href` URL for a link button. Common options\n * include `_blank` to open in a new tab.\n */\n @property() target: '_blank' | '_parent' | '_self' | '_top' | '' = '';\n\n /**\n * Whether to render the icon at the inline end of the label rather than the\n * inline start.\n *\n * _Note:_ Link buttons cannot have trailing icons.\n */\n @property({ type: Boolean, attribute: 'trailing-icon' }) trailingIcon = false;\n\n /**\n * Whether to display the icon or not.\n */\n @property({ type: Boolean, attribute: 'has-icon' }) hasIcon = false;\n\n @property()\n appearance:\n | 'elevated'\n | 'filled'\n | 'filled-tonal'\n | 'outlined'\n | 'text'\n | 'anchor' = 'filled';\n\n constructor() {\n super();\n if (!isServer) {\n this.addEventListener('click', this.handleActivationClick);\n }\n }\n\n private readonly handleActivationClick = (event: MouseEvent) => {\n if (!isActivationClick(event) || !this.buttonElement) {\n return;\n }\n this.focus();\n dispatchActivationClick(this.buttonElement);\n };\n\n private readonly tags = {\n elevated: literal`md-elevated-button`,\n filled: literal`md-filled-button`,\n 'filled-tonal': literal`md-filled-tonal-button`,\n outlined: literal`md-outlined-button`,\n text: literal`md-text-button`,\n };\n\n protected override render() {\n if (this.appearance === 'anchor') {\n return html`<a\n target=${ifDefined(this.target)}\n href=${ifDefined(this.href)}\n >${this.value ? this.value : nothing}<slot></slot\n ></a>`;\n }\n const tag: StaticValue = this.tags?.[this.appearance] || this.tags.outlined;\n return staticHtml`<${tag}\n ?disabled=${this.disabled}\n target=${ifDefined(this.target)}\n href=${ifDefined(this.href)}\n ?trailing-icon=${this.trailingIcon}\n ?has-icon=${this.hasIcon}\n value=\"${this.value}\"\n type=${this.type}\n class=\"md-button\"\n >\n <div class=\"slot-wrap\">\n <slot></slot>\n </div>\n ${this.hasIcon ? html`<slot slot=\"icon\" name=\"icon\"></slot>` : nothing}\n </${tag}>`;\n }\n}\n"]}
1
+ {"version":3,"file":"IxButton.js","sourceRoot":"","sources":["../src/IxButton.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAC1D,OAAO,EAAE,IAAI,IAAI,UAAU,EAAe,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EACL,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE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,QAAQ,EAAE;wCAA2D;AAQb;IAAxD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;8CAAsB;AAK1B;IAAnD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;yCAAiB;AAGpE;IADC,QAAQ,EAAE;4CAOa","sourcesContent":["import { html, LitElement, isServer, nothing } from 'lit';\nimport { html as staticHtml, StaticValue, literal } from 'lit/static-html.js';\nimport { property } from 'lit/decorators.js';\nimport {\n dispatchActivationClick,\n isActivationClick,\n} from '@material/web/internal/events/form-label-activation.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { internals } from '@material/web/labs/behaviors/element-internals.js';\nimport '@material/web/button/text-button.js';\nimport '@material/web/button/elevated-button.js';\nimport '@material/web/button/filled-button.js';\nimport '@material/web/button/outlined-button.js';\nimport '@material/web/button/filled-tonal-button.js';\nimport '@material/web/icon/icon.js';\nimport '@digital-realty/ix-progress/ix-progress.js';\nimport {\n FormSubmitter,\n FormSubmitterType,\n setupFormSubmitter,\n} from '@material/web/internal/controller/form-submitter.js';\nimport { requestUpdateOnAriaChange } from '@material/web/internal/aria/delegate.js';\n\nexport class IxButton extends LitElement implements FormSubmitter {\n static {\n requestUpdateOnAriaChange(IxButton);\n setupFormSubmitter(IxButton);\n }\n\n /** @nocollapse */\n static readonly formAssociated = true;\n\n /** @nocollapse */\n static override shadowRootOptions: ShadowRootInit = {\n mode: 'open',\n delegatesFocus: true,\n };\n\n /**\n * The associated form element with which this element's value will submit.\n */\n get form() {\n return this[internals].form;\n }\n\n set form(form: HTMLFormElement | null) {\n this.setAttribute('form', form as unknown as string);\n }\n\n get buttonElement(): HTMLElement {\n return this.shadowRoot\n ?.querySelector('.md-button')\n ?.shadowRoot?.querySelector('.button')!;\n }\n\n get name() {\n return this.getAttribute('name') ?? '';\n }\n\n set name(name: string) {\n this.setAttribute('name', name);\n }\n\n @property() value = '';\n\n /** @private */\n [internals] = (this as HTMLElement) /* needed for closure */\n .attachInternals();\n\n override focus() {\n this.buttonElement.focus();\n }\n\n override blur() {\n this.buttonElement.blur();\n }\n\n @property() type: FormSubmitterType = 'submit';\n\n /**\n * Whether or not the button is disabled.\n */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /**\n * Whether or not the button is submitting.\n */\n @property({ type: Boolean, reflect: true }) submitting = false;\n\n /**\n * The URL that the link button points to.\n */\n @property() href: string | undefined = undefined;\n\n /**\n * Where to display the linked `href` URL for a link button. Common options\n * include `_blank` to open in a new tab.\n */\n @property() target: '_blank' | '_parent' | '_self' | '_top' | '' = '';\n\n /**\n * Whether to render the icon at the inline end of the label rather than the\n * inline start.\n *\n * _Note:_ Link buttons cannot have trailing icons.\n */\n @property({ type: Boolean, attribute: 'trailing-icon' }) trailingIcon = false;\n\n /**\n * Whether to display the icon or not.\n */\n @property({ type: Boolean, attribute: 'has-icon' }) hasIcon = false;\n\n @property()\n appearance:\n | 'elevated'\n | 'filled'\n | 'filled-tonal'\n | 'outlined'\n | 'text'\n | 'anchor' = 'filled';\n\n constructor() {\n super();\n if (!isServer) {\n this.addEventListener('click', this.handleActivationClick);\n }\n }\n\n private readonly handleActivationClick = (event: MouseEvent) => {\n if (!isActivationClick(event) || !this.buttonElement) {\n return;\n }\n this.focus();\n dispatchActivationClick(this.buttonElement);\n };\n\n private readonly tags = {\n elevated: literal`md-elevated-button`,\n filled: literal`md-filled-button`,\n 'filled-tonal': literal`md-filled-tonal-button`,\n outlined: literal`md-outlined-button`,\n text: literal`md-text-button`,\n };\n\n protected override render() {\n if (this.appearance === 'anchor') {\n return html`<a\n target=${ifDefined(this.target)}\n href=${ifDefined(this.href)}\n >${this.value ? this.value : nothing}<slot></slot\n ></a>`;\n }\n const tag: StaticValue = this.tags?.[this.appearance] || this.tags.outlined;\n return staticHtml`<${tag}\n ?disabled=${this.disabled || this.submitting}\n target=${ifDefined(this.target)}\n href=${ifDefined(this.href)}\n ?trailing-icon=${this.trailingIcon}\n ?has-icon=${this.hasIcon}\n value=\"${this.value}\"\n type=${this.type}\n class=\"md-button\"\n >\n <div class=\"slot-wrap\">\n ${\n this.submitting\n ? html`<ix-progress\n .indeterminate=${true}\n .linear=${false}\n ></ix-progress>`\n : html`<slot></slot>`\n }\n </div>\n ${this.hasIcon ? html`<slot slot=\"icon\" name=\"icon\"></slot>` : nothing}\n </${tag}>`;\n }\n}\n"]}
package/dist/ix-button.js CHANGED
@@ -5,6 +5,7 @@ export class IxButtonStyled extends IxButton {
5
5
  IxButtonStyled.styles = css `
6
6
  .md-button {
7
7
  display: flex;
8
+ --md-circular-progress-size: 24px;
8
9
  }
9
10
 
10
11
  .slot-wrap {
@@ -1 +1 @@
1
- {"version":3,"file":"ix-button.js","sourceRoot":"","sources":["../src/ix-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,OAAO,cAAe,SAAQ,QAAQ;;AAC1B,qBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;GAW3B,CAAC;AAGJ,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import { css } from 'lit';\nimport { IxButton } from './IxButton.js';\n\nexport class IxButtonStyled extends IxButton {\n static override styles = css`\n .md-button {\n display: flex;\n }\n\n .slot-wrap {\n font-weight: bold;\n text-transform: uppercase;\n position: relative;\n letter-spacing: 1.25px;\n }\n `;\n}\n\nwindow.customElements.define('ix-button', IxButtonStyled);\n"]}
1
+ {"version":3,"file":"ix-button.js","sourceRoot":"","sources":["../src/ix-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,OAAO,cAAe,SAAQ,QAAQ;;AAC1B,qBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;GAY3B,CAAC;AAGJ,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import { css } from 'lit';\nimport { IxButton } from './IxButton.js';\n\nexport class IxButtonStyled extends IxButton {\n static override styles = css`\n .md-button {\n display: flex;\n --md-circular-progress-size: 24px;\n }\n\n .slot-wrap {\n font-weight: bold;\n text-transform: uppercase;\n position: relative;\n letter-spacing: 1.25px;\n }\n `;\n}\n\nwindow.customElements.define('ix-button', IxButtonStyled);\n"]}
@@ -1,9 +1,9 @@
1
- import{LitElement,isServer,html,nothing,css}from"lit";import{__decorate}from"tslib";import{literal,html as html$1}from"lit/static-html.js";import{property}from"lit/decorators.js";import{isActivationClick,dispatchActivationClick}from"@material/web/internal/events/form-label-activation.js";import{ifDefined}from"lit/directives/if-defined.js";import{internals}from"@material/web/labs/behaviors/element-internals.js";import"@material/web/button/text-button.js";import"@material/web/button/elevated-button.js";import"@material/web/button/filled-button.js";import"@material/web/button/outlined-button.js";import"@material/web/button/filled-tonal-button.js";import"@material/web/icon/icon.js";import{setupFormSubmitter}from"@material/web/internal/controller/form-submitter.js";import{requestUpdateOnAriaChange}from"@material/web/internal/aria/delegate.js";var _a;class IxButton extends LitElement{get form(){return this[internals].form}set form(t){this.setAttribute("form",t)}get buttonElement(){var t;return null==(t=null==(t=null==(t=this.shadowRoot)?void 0:t.querySelector(".md-button"))?void 0:t.shadowRoot)?void 0:t.querySelector(".button")}get name(){var t;return null!=(t=this.getAttribute("name"))?t:""}set name(t){this.setAttribute("name",t)}focus(){this.buttonElement.focus()}blur(){this.buttonElement.blur()}constructor(){super(),this.value="",this[_a]=this.attachInternals(),this.type="submit",this.disabled=!1,this.href=void 0,this.target="",this.trailingIcon=!1,this.hasIcon=!1,this.appearance="filled",this.handleActivationClick=t=>{isActivationClick(t)&&this.buttonElement&&(this.focus(),dispatchActivationClick(this.buttonElement))},this.tags={elevated:literal`md-elevated-button`,filled:literal`md-filled-button`,"filled-tonal":literal`md-filled-tonal-button`,outlined:literal`md-outlined-button`,text:literal`md-text-button`},isServer||this.addEventListener("click",this.handleActivationClick)}render(){var t;return"anchor"===this.appearance?html`<a
1
+ import{LitElement,isServer,html,nothing,css}from"lit";import{__decorate}from"tslib";import{literal,html as html$1}from"lit/static-html.js";import{property}from"lit/decorators.js";import{isActivationClick,dispatchActivationClick}from"@material/web/internal/events/form-label-activation.js";import{ifDefined}from"lit/directives/if-defined.js";import{internals}from"@material/web/labs/behaviors/element-internals.js";import"@material/web/button/text-button.js";import"@material/web/button/elevated-button.js";import"@material/web/button/filled-button.js";import"@material/web/button/outlined-button.js";import"@material/web/button/filled-tonal-button.js";import"@material/web/icon/icon.js";import"@digital-realty/ix-progress/ix-progress.js";import{setupFormSubmitter}from"@material/web/internal/controller/form-submitter.js";import{requestUpdateOnAriaChange}from"@material/web/internal/aria/delegate.js";var _a;class IxButton extends LitElement{get form(){return this[internals].form}set form(t){this.setAttribute("form",t)}get buttonElement(){var t;return null==(t=null==(t=null==(t=this.shadowRoot)?void 0:t.querySelector(".md-button"))?void 0:t.shadowRoot)?void 0:t.querySelector(".button")}get name(){var t;return null!=(t=this.getAttribute("name"))?t:""}set name(t){this.setAttribute("name",t)}focus(){this.buttonElement.focus()}blur(){this.buttonElement.blur()}constructor(){super(),this.value="",this[_a]=this.attachInternals(),this.type="submit",this.disabled=!1,this.submitting=!1,this.href=void 0,this.target="",this.trailingIcon=!1,this.hasIcon=!1,this.appearance="filled",this.handleActivationClick=t=>{isActivationClick(t)&&this.buttonElement&&(this.focus(),dispatchActivationClick(this.buttonElement))},this.tags={elevated:literal`md-elevated-button`,filled:literal`md-filled-button`,"filled-tonal":literal`md-filled-tonal-button`,outlined:literal`md-outlined-button`,text:literal`md-text-button`},isServer||this.addEventListener("click",this.handleActivationClick)}render(){var t;return"anchor"===this.appearance?html`<a
2
2
  target=${ifDefined(this.target)}
3
3
  href=${ifDefined(this.href)}
4
4
  >${this.value||nothing}<slot></slot
5
5
  ></a>`:(t=(null==(t=this.tags)?void 0:t[this.appearance])||this.tags.outlined,html$1`<${t}
6
- ?disabled=${this.disabled}
6
+ ?disabled=${this.disabled||this.submitting}
7
7
  target=${ifDefined(this.target)}
8
8
  href=${ifDefined(this.href)}
9
9
  ?trailing-icon=${this.trailingIcon}
@@ -13,7 +13,10 @@ import{LitElement,isServer,html,nothing,css}from"lit";import{__decorate}from"tsl
13
13
  class="md-button"
14
14
  >
15
15
  <div class="slot-wrap">
16
- <slot></slot>
16
+ ${this.submitting?html`<ix-progress
17
+ .indeterminate=${!0}
18
+ .linear=${!1}
19
+ ></ix-progress>`:html`<slot></slot>`}
17
20
  </div>
18
21
  ${this.hasIcon?html`<slot slot="icon" name="icon"></slot>`:nothing}
19
- </${t}>`)}}_a=internals,requestUpdateOnAriaChange(IxButton),setupFormSubmitter(IxButton),IxButton.formAssociated=!0,IxButton.shadowRootOptions={mode:"open",delegatesFocus:!0},__decorate([property()],IxButton.prototype,"value",void 0),__decorate([property()],IxButton.prototype,"type",void 0),__decorate([property({type:Boolean,reflect:!0})],IxButton.prototype,"disabled",void 0),__decorate([property()],IxButton.prototype,"href",void 0),__decorate([property()],IxButton.prototype,"target",void 0),__decorate([property({type:Boolean,attribute:"trailing-icon"})],IxButton.prototype,"trailingIcon",void 0),__decorate([property({type:Boolean,attribute:"has-icon"})],IxButton.prototype,"hasIcon",void 0),__decorate([property()],IxButton.prototype,"appearance",void 0);class IxButtonStyled extends IxButton{}IxButtonStyled.styles=css`.md-button{display:flex}.slot-wrap{font-weight:700;text-transform:uppercase;position:relative;letter-spacing:1.25px}`,window.customElements.define("ix-button",IxButtonStyled);export{IxButtonStyled};
22
+ </${t}>`)}}_a=internals,requestUpdateOnAriaChange(IxButton),setupFormSubmitter(IxButton),IxButton.formAssociated=!0,IxButton.shadowRootOptions={mode:"open",delegatesFocus:!0},__decorate([property()],IxButton.prototype,"value",void 0),__decorate([property()],IxButton.prototype,"type",void 0),__decorate([property({type:Boolean,reflect:!0})],IxButton.prototype,"disabled",void 0),__decorate([property({type:Boolean,reflect:!0})],IxButton.prototype,"submitting",void 0),__decorate([property()],IxButton.prototype,"href",void 0),__decorate([property()],IxButton.prototype,"target",void 0),__decorate([property({type:Boolean,attribute:"trailing-icon"})],IxButton.prototype,"trailingIcon",void 0),__decorate([property({type:Boolean,attribute:"has-icon"})],IxButton.prototype,"hasIcon",void 0),__decorate([property()],IxButton.prototype,"appearance",void 0);class IxButtonStyled extends IxButton{}IxButtonStyled.styles=css`.md-button{display:flex;--md-circular-progress-size:24px}.slot-wrap{font-weight:700;text-transform:uppercase;position:relative;letter-spacing:1.25px}`,window.customElements.define("ix-button",IxButtonStyled);export{IxButtonStyled};
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Webcomponent ix-button following open-wc recommendations",
4
4
  "license": "MIT",
5
5
  "author": "Digital Realty",
6
- "version": "3.3.3",
6
+ "version": "3.3.4-alpha-224946-t51.0",
7
7
  "type": "module",
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/index.js",
@@ -27,6 +27,7 @@
27
27
  "test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\""
28
28
  },
29
29
  "dependencies": {
30
+ "@digital-realty/ix-progress": "^1.2.4-alpha-224946-t51.0",
30
31
  "@lit/react": "^1.0.2",
31
32
  "@material/web": "1.2.0",
32
33
  "lit": "^2.8.0 || ^3.0.0",
@@ -105,5 +106,6 @@
105
106
  "package.json",
106
107
  "README.md",
107
108
  "LICENSE"
108
- ]
109
+ ],
110
+ "gitHead": "437314309d1a36abb68fb6a6c31e96ef466759a5"
109
111
  }