@digital-realty/ix-switch-input 2.3.7 → 2.4.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.
@@ -1 +1,52 @@
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:var(--ix-switch-label-text-size,var(--text-small-size,.875rem));font-weight:var(--ix-switch-label-font-weight,var(--text-small-weight,normal));line-height:var(--ix-switch-label-line-height,var(--text-small-line-height,1.42857143em));letter-spacing:var(--ix-switch-label-letter-spacing,var(--text-small-letter-spacing,.0275em));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 as t}from"tslib";import{css as e,LitElement as i,html as s,nothing as o}from"lit";import{property as l,query as h}from"lit/decorators.js";import"@digital-realty/ix-switch-bar";const d=e`
2
+ :host {
3
+ display: block;
4
+ }
5
+
6
+ :host([hidden]) {
7
+ display: none;
8
+ }
9
+
10
+ ix-textbox {
11
+ max-width: var(--po-number-textbox-max-width, 320px);
12
+ }
13
+
14
+ .label {
15
+ font-size: var(
16
+ --ix-switch-label-text-size,
17
+ var(--text-small-size, 0.875rem)
18
+ );
19
+ font-weight: var(
20
+ --ix-switch-label-font-weight,
21
+ var(--text-small-weight, normal)
22
+ );
23
+ line-height: var(
24
+ --ix-switch-label-line-height,
25
+ var(--text-small-line-height, 1.42857143em)
26
+ );
27
+ letter-spacing: var(
28
+ --ix-switch-label-letter-spacing,
29
+ var(--text-small-letter-spacing, 0.0275em)
30
+ );
31
+ margin: 1rem 0 var(--spacing-tiny, 0.25rem);
32
+ display: block;
33
+ }
34
+ `;class r extends i{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[d]}getPlaceholder(){return this.selected?"":this.defaultInputValue||"Not required"}getValidityStatus(){var t,e,i;return!this.selected||(this.isValid=null!==(i=null===(e=null===(t=this.ixSwitchInputTextbox)||void 0===t?void 0:t.component)||void 0===e?void 0:e.checkValidity())&&void 0!==i?i: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(){const t=new CustomEvent("toggleSwitch",{detail:{selected:this.selected},composed:!0});this.dispatchEvent(t)}dispatchTextEvent(t){const e=new CustomEvent("textChange",{detail:t,composed:!0});this.dispatchEvent(e)}renderSwitch(){return s`<ix-switch-bar
35
+ .text=${this.switchText}
36
+ .note=${this.switchNote}
37
+ ?selected=${this.selected}
38
+ ?disabled=${this.disabled}
39
+ ?required=${this.required}
40
+ ?icons=${this.icons}
41
+ ?showOnlySelectedIcon="${this.showOnlySelectedIcon}"
42
+ @toggleSwitch=${t=>this.onToggleSwitch(t)}
43
+ ></ix-switch-bar>`}renderTextbox(){return this.isHidden?o:s` <p class="label">${this.label}</p>
44
+ <ix-textbox
45
+ id="ix-switch-input-textbox"
46
+ .text="${this.text}"
47
+ .placeholder="${this.placeholder}"
48
+ ?disabled="${!this.selected}"
49
+ ?required=${this.required&&this.selected}
50
+ @textChange="${t=>this.onUpdateText(t)}"
51
+ >
52
+ </ix-textbox>`}render(){return s` ${this.renderSwitch()} ${this.renderTextbox()} `}}t([l({type:String})],r.prototype,"switchText",void 0),t([l({type:String})],r.prototype,"switchNote",void 0),t([l({type:String})],r.prototype,"label",void 0),t([l({type:String})],r.prototype,"text",void 0),t([l({type:String})],r.prototype,"defaultInputValue",void 0),t([l({type:String})],r.prototype,"placeholder",void 0),t([l({type:Boolean})],r.prototype,"selected",void 0),t([l({type:Boolean})],r.prototype,"disabled",void 0),t([l({type:Boolean})],r.prototype,"required",void 0),t([l({type:Boolean})],r.prototype,"icons",void 0),t([l({type:Boolean})],r.prototype,"showOnlySelectedIcon",void 0),t([l({type:Boolean})],r.prototype,"isHidden",void 0),t([l({type:Boolean})],r.prototype,"isValid",void 0),t([h("#ix-switch-input-textbox")],r.prototype,"ixSwitchInputTextbox",void 0),window.customElements.define("ix-switch-input",r);
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.3.7",
6
+ "version": "2.4.1",
7
7
  "type": "module",
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/index.js",
@@ -21,48 +21,41 @@
21
21
  "start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
22
22
  "build": "tsc && npm run analyze -- --exclude dist && rollup -c",
23
23
  "prepublish": "tsc && npm run analyze -- --exclude dist",
24
- "lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
25
- "format": "eslint --ext .ts,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
24
+ "lint": "eslint --ext .ts,.html . && prettier \"**/*.ts\" --check --ignore-path .gitignore",
25
+ "format": "eslint --ext .ts,.html . --fix && prettier \"**/*.ts\" --write --ignore-path .gitignore",
26
26
  "test": "tsc && wtr --coverage",
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.3.4",
31
- "@digital-realty/ix-textbox": "^2.3.8",
30
+ "@digital-realty/ix-switch-bar": "^2.4.1",
31
+ "@digital-realty/ix-textbox": "^2.4.1",
32
32
  "@lit/react": "^1.0.2",
33
33
  "lit": "^3.2.1",
34
34
  "react": "^18.2.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@custom-elements-manifest/analyzer": "^0.4.17",
38
- "@open-wc/building-rollup": "^3.0.2",
39
- "@open-wc/eslint-config": "^9.2.1",
40
38
  "@open-wc/testing": "^3.1.6",
39
+ "@rollup/plugin-terser": "^1.0.0",
41
40
  "@types/react": "^18.2.22",
42
- "@typescript-eslint/eslint-plugin": "^5.48.0",
43
- "@typescript-eslint/parser": "^5.48.0",
41
+ "@typescript-eslint/eslint-plugin": "^8.58.2",
42
+ "@typescript-eslint/parser": "^8.58.2",
44
43
  "@web/dev-server": "^0.4.6",
45
44
  "@web/test-runner": "^0.20.2",
46
- "concurrently": "^9.1.0",
47
- "eslint": "^8.31.0",
45
+ "concurrently": "^9.2.1",
46
+ "eslint": "^9.39.4",
48
47
  "eslint-config-prettier": "^8.3.0",
49
48
  "husky": "^4.3.8",
50
49
  "lint-staged": "^10.5.4",
51
50
  "prettier": "^2.4.1",
52
51
  "rollup": "^4.29.1",
53
- "rollup-plugin-minify-html-literals": "^1.2.6",
54
52
  "rollup-plugin-summary": "^2.0.0",
55
- "rollup-plugin-uglify": "^6.0.4",
56
53
  "tslib": "^2.3.1",
57
54
  "typescript": "^4.5.2"
58
55
  },
59
56
  "customElements": "custom-elements.json",
60
57
  "eslintConfig": {
61
58
  "parser": "@typescript-eslint/parser",
62
- "extends": [
63
- "@open-wc",
64
- "prettier"
65
- ],
66
59
  "plugins": [
67
60
  "@typescript-eslint"
68
61
  ],
@@ -104,5 +97,5 @@
104
97
  "README.md",
105
98
  "LICENSE"
106
99
  ],
107
- "gitHead": "4cd8803f4c5f3b3833ae6ebb5791f73a057863f8"
100
+ "gitHead": "da06737d6707fd3d4ef898ba0fa632e7b3ed8019"
108
101
  }