@digital-realty/ix-switch-input 2.3.15 → 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.
- package/dist/ix-switch-input.min.js +52 -1
- package/package.json +11 -18
|
@@ -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";
|
|
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.
|
|
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 .
|
|
25
|
-
"format": "eslint --ext .ts,.html . --fix
|
|
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.
|
|
31
|
-
"@digital-realty/ix-textbox": "^2.
|
|
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": "^
|
|
43
|
-
"@typescript-eslint/parser": "^
|
|
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
|
|
47
|
-
"eslint": "^
|
|
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": "
|
|
100
|
+
"gitHead": "da06737d6707fd3d4ef898ba0fa632e7b3ed8019"
|
|
108
101
|
}
|