@digital-realty/ix-switch-input 2.1.39 → 2.1.40

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.
@@ -1 +1 @@
1
- import{__decorate}from"tslib";import{css,LitElement,html,nothing}from"lit";import{property,query}from"lit/decorators.js";import"@digital-realty/ix-switch-bar";const NotRequired="Not required",IxSwitchInputStyles=css`:host{display:block}:host([hidden]){display:none}ix-textbox{max-width:var(--po-number-textbox-max-width,320px)}.label{font-size:.875rem;font-weight:400;line-height:1rem;margin:1rem 0 var(--spacing-tiny,.25rem);display:block}`;class IxSwitchInput extends LitElement{constructor(){super(...arguments),this.switchText="",this.switchNote="",this.label="",this.text="",this.defaultInputValue="",this.placeholder="",this.selected=!1,this.disabled=!1,this.required=!1,this.icons=!1,this.showOnlySelectedIcon=!1,this.isHidden=!1,this.isValid=!0}static get styles(){return[IxSwitchInputStyles]}getPlaceholder(){return this.selected?"":this.defaultInputValue||""+NotRequired}getValidityStatus(){var t;return!this.selected||(this.isValid=null!=(t=null==(t=null==(t=this.ixSwitchInputTextbox)?void 0:t.component)?void 0:t.checkValidity())?t:null,this.isValid)}onToggleSwitch(t){this.selected=!this.selected,this.dispatchSwitchEvent(),t.stopPropagation(),this.text="",this.placeholder=this.getPlaceholder()}onUpdateText(t){this.text=t.detail.value,this.getValidityStatus(),this.dispatchTextEvent({value:this.text,isValid:this.isValid}),t.stopPropagation()}dispatchSwitchEvent(){var t=new CustomEvent("toggleSwitch",{detail:{selected:this.selected},composed:!0});this.dispatchEvent(t)}dispatchTextEvent(t){t=new CustomEvent("textChange",{detail:t,composed:!0});this.dispatchEvent(t)}renderSwitch(){return html`<ix-switch-bar .text="${this.switchText}" .note="${this.switchNote}" ?selected="${this.selected}" ?disabled="${this.disabled}" ?required="${this.required}" ?icons="${this.icons}" ?showOnlySelectedIcon="${this.showOnlySelectedIcon}" @toggleSwitch="${t=>this.onToggleSwitch(t)}"></ix-switch-bar>`}renderTextbox(){return this.isHidden?nothing:html`<p class="label">${this.label}</p><ix-textbox id="ix-switch-input-textbox" .text="${this.text}" .placeholder="${this.placeholder}" ?disabled="${!this.selected}" ?required="${this.required&&this.selected}" @textChange="${t=>this.onUpdateText(t)}"></ix-textbox>`}render(){return html`${this.renderSwitch()} ${this.renderTextbox()}`}}__decorate([property({type:String})],IxSwitchInput.prototype,"switchText",void 0),__decorate([property({type:String})],IxSwitchInput.prototype,"switchNote",void 0),__decorate([property({type:String})],IxSwitchInput.prototype,"label",void 0),__decorate([property({type:String})],IxSwitchInput.prototype,"text",void 0),__decorate([property({type:String})],IxSwitchInput.prototype,"defaultInputValue",void 0),__decorate([property({type:String})],IxSwitchInput.prototype,"placeholder",void 0),__decorate([property({type:Boolean})],IxSwitchInput.prototype,"selected",void 0),__decorate([property({type:Boolean})],IxSwitchInput.prototype,"disabled",void 0),__decorate([property({type:Boolean})],IxSwitchInput.prototype,"required",void 0),__decorate([property({type:Boolean})],IxSwitchInput.prototype,"icons",void 0),__decorate([property({type:Boolean})],IxSwitchInput.prototype,"showOnlySelectedIcon",void 0),__decorate([property({type:Boolean})],IxSwitchInput.prototype,"isHidden",void 0),__decorate([property({type:Boolean})],IxSwitchInput.prototype,"isValid",void 0),__decorate([query("#ix-switch-input-textbox")],IxSwitchInput.prototype,"ixSwitchInputTextbox",void 0),window.customElements.define("ix-switch-input",IxSwitchInput);
1
+ import{__decorate}from"tslib";import{css,LitElement,html,nothing}from"lit";import{property,query}from"lit/decorators.js";import"@digital-realty/ix-switch-bar";let NotRequired="Not required",IxSwitchInputStyles=css`:host{display:block}:host([hidden]){display:none}ix-textbox{max-width:var(--po-number-textbox-max-width,320px)}.label{font-size:.875rem;font-weight:400;line-height:1rem;margin:1rem 0 var(--spacing-tiny,.25rem);display:block}`;class IxSwitchInput extends LitElement{constructor(){super(...arguments),this.switchText="",this.switchNote="",this.label="",this.text="",this.defaultInputValue="",this.placeholder="",this.selected=!1,this.disabled=!1,this.required=!1,this.icons=!1,this.showOnlySelectedIcon=!1,this.isHidden=!1,this.isValid=!0}static get styles(){return[IxSwitchInputStyles]}getPlaceholder(){return this.selected?"":this.defaultInputValue||""+NotRequired}getValidityStatus(){var t;return!this.selected||(this.isValid=null!=(t=null==(t=null==(t=this.ixSwitchInputTextbox)?void 0:t.component)?void 0:t.checkValidity())?t:null,this.isValid)}onToggleSwitch(t){this.selected=!this.selected,this.dispatchSwitchEvent(),t.stopPropagation(),this.text="",this.placeholder=this.getPlaceholder()}onUpdateText(t){this.text=t.detail.value,this.getValidityStatus(),this.dispatchTextEvent({value:this.text,isValid:this.isValid}),t.stopPropagation()}dispatchSwitchEvent(){var t=new CustomEvent("toggleSwitch",{detail:{selected:this.selected},composed:!0});this.dispatchEvent(t)}dispatchTextEvent(t){t=new CustomEvent("textChange",{detail:t,composed:!0});this.dispatchEvent(t)}renderSwitch(){return html`<ix-switch-bar .text="${this.switchText}" .note="${this.switchNote}" ?selected="${this.selected}" ?disabled="${this.disabled}" ?required="${this.required}" ?icons="${this.icons}" ?showOnlySelectedIcon="${this.showOnlySelectedIcon}" @toggleSwitch="${t=>this.onToggleSwitch(t)}"></ix-switch-bar>`}renderTextbox(){return this.isHidden?nothing:html`<p class="label">${this.label}</p><ix-textbox id="ix-switch-input-textbox" .text="${this.text}" .placeholder="${this.placeholder}" ?disabled="${!this.selected}" ?required="${this.required&&this.selected}" @textChange="${t=>this.onUpdateText(t)}"></ix-textbox>`}render(){return html`${this.renderSwitch()} ${this.renderTextbox()}`}}__decorate([property({type:String})],IxSwitchInput.prototype,"switchText",void 0),__decorate([property({type:String})],IxSwitchInput.prototype,"switchNote",void 0),__decorate([property({type:String})],IxSwitchInput.prototype,"label",void 0),__decorate([property({type:String})],IxSwitchInput.prototype,"text",void 0),__decorate([property({type:String})],IxSwitchInput.prototype,"defaultInputValue",void 0),__decorate([property({type:String})],IxSwitchInput.prototype,"placeholder",void 0),__decorate([property({type:Boolean})],IxSwitchInput.prototype,"selected",void 0),__decorate([property({type:Boolean})],IxSwitchInput.prototype,"disabled",void 0),__decorate([property({type:Boolean})],IxSwitchInput.prototype,"required",void 0),__decorate([property({type:Boolean})],IxSwitchInput.prototype,"icons",void 0),__decorate([property({type:Boolean})],IxSwitchInput.prototype,"showOnlySelectedIcon",void 0),__decorate([property({type:Boolean})],IxSwitchInput.prototype,"isHidden",void 0),__decorate([property({type:Boolean})],IxSwitchInput.prototype,"isValid",void 0),__decorate([query("#ix-switch-input-textbox")],IxSwitchInput.prototype,"ixSwitchInputTextbox",void 0),window.customElements.define("ix-switch-input",IxSwitchInput);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Webcomponent ix-switch-input following open-wc recommendations",
4
4
  "license": "MIT",
5
5
  "author": "Digital Realty",
6
- "version": "2.1.39",
6
+ "version": "2.1.40",
7
7
  "type": "module",
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/index.js",
@@ -27,8 +27,8 @@
27
27
  "test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\""
28
28
  },
29
29
  "dependencies": {
30
- "@digital-realty/ix-switch-bar": "^2.1.11",
31
- "@digital-realty/ix-textbox": "^2.1.37",
30
+ "@digital-realty/ix-switch-bar": "^2.1.12",
31
+ "@digital-realty/ix-textbox": "^2.1.38",
32
32
  "@lit/react": "^1.0.2",
33
33
  "lit": "^2.0.2",
34
34
  "react": "^18.2.0"
@@ -102,5 +102,5 @@
102
102
  "README.md",
103
103
  "LICENSE"
104
104
  ],
105
- "gitHead": "93b748837a1a2222e475507c244f99adcf3a31d6"
105
+ "gitHead": "024e4b85148c7a248e9f283e35085f512e7c3b1e"
106
106
  }