@digital-realty/ix-switch-input 2.1.35 → 2.1.37
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 @@
|
|
|
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);
|
package/package.json
CHANGED
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
"description": "Webcomponent ix-switch-input following open-wc recommendations",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Digital Realty",
|
|
6
|
-
"version": "2.1.
|
|
6
|
+
"version": "2.1.37",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"module": "dist/index.js",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": "./dist/index.js",
|
|
12
12
|
"./ix-switch-input.js": "./dist/ix-switch-input.js",
|
|
13
|
+
"./ix-switch-input.min.js": "./dist/ix-switch-input.min.js",
|
|
13
14
|
"./IxSwitchInput": "./dist/react/IxSwitchInput.js"
|
|
14
15
|
},
|
|
15
16
|
"publishConfig": {
|
|
@@ -18,7 +19,7 @@
|
|
|
18
19
|
"scripts": {
|
|
19
20
|
"analyze": "cem analyze --litelement",
|
|
20
21
|
"start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
|
|
21
|
-
"build": "tsc && npm run analyze -- --exclude dist",
|
|
22
|
+
"build": "tsc && npm run analyze -- --exclude dist && rollup -c",
|
|
22
23
|
"prepublish": "tsc && npm run analyze -- --exclude dist",
|
|
23
24
|
"lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
|
|
24
25
|
"format": "eslint --ext .ts,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
|
|
@@ -26,8 +27,8 @@
|
|
|
26
27
|
"test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\""
|
|
27
28
|
},
|
|
28
29
|
"dependencies": {
|
|
29
|
-
"@digital-realty/ix-switch-bar": "^2.1.
|
|
30
|
-
"@digital-realty/ix-textbox": "^2.1.
|
|
30
|
+
"@digital-realty/ix-switch-bar": "^2.1.11",
|
|
31
|
+
"@digital-realty/ix-textbox": "^2.1.35",
|
|
31
32
|
"@lit/react": "^1.0.2",
|
|
32
33
|
"lit": "^2.0.2",
|
|
33
34
|
"react": "^18.2.0"
|
|
@@ -48,6 +49,9 @@
|
|
|
48
49
|
"husky": "^4.3.8",
|
|
49
50
|
"lint-staged": "^10.5.4",
|
|
50
51
|
"prettier": "^2.4.1",
|
|
52
|
+
"rollup-plugin-minify-html-literals": "^1.2.6",
|
|
53
|
+
"rollup-plugin-summary": "^2.0.0",
|
|
54
|
+
"rollup-plugin-uglify": "^6.0.4",
|
|
51
55
|
"tslib": "^2.3.1",
|
|
52
56
|
"typescript": "^4.5.2"
|
|
53
57
|
},
|
|
@@ -98,5 +102,5 @@
|
|
|
98
102
|
"README.md",
|
|
99
103
|
"LICENSE"
|
|
100
104
|
],
|
|
101
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "c7668fda980293ca038c0dd061ebe350fa88ee60"
|
|
102
106
|
}
|