@digital-realty/ix-switch-input 2.1.6 → 2.1.8
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/README.md +2 -41
- package/dist/IxSwitchInput.js +3 -2
- package/dist/IxSwitchInput.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -24,45 +24,6 @@ npm i @digital-realty/ix-switch-input
|
|
|
24
24
|
</script>
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
##
|
|
27
|
+
## Demo and Documentation
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
npm run lint
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
To automatically fix linting and formatting errors, run
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
npm run format
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## Testing with Web Test Runner
|
|
42
|
-
|
|
43
|
-
To execute a single test run:
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
npm run test
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
To run the tests in interactive watch mode run:
|
|
50
|
-
|
|
51
|
-
```bash
|
|
52
|
-
npm run test:watch
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
## Tooling configs
|
|
57
|
-
|
|
58
|
-
For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.
|
|
59
|
-
|
|
60
|
-
If you customize the configuration a lot, you can consider moving them to individual files.
|
|
61
|
-
|
|
62
|
-
## Local Demo with `web-dev-server`
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
npm start
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
To run a local development server that serves the basic demo located in `demo/index.html`
|
|
29
|
+
Full documentation and demo are available at [DLR Component Gallery](https://inxn-p1-uicomponentgallery.azurewebsites.net/?path=/story/inxn-ix-switch-input--default).
|
package/dist/IxSwitchInput.js
CHANGED
|
@@ -31,10 +31,11 @@ export class IxSwitchInput extends LitElement {
|
|
|
31
31
|
return '';
|
|
32
32
|
}
|
|
33
33
|
getValidityStatus() {
|
|
34
|
-
var _a, _b;
|
|
34
|
+
var _a, _b, _c;
|
|
35
35
|
if (!this.selected)
|
|
36
36
|
return true;
|
|
37
|
-
this.isValid =
|
|
37
|
+
this.isValid =
|
|
38
|
+
(_c = (_b = (_a = this.ixSwitchInputTextbox) === null || _a === void 0 ? void 0 : _a.component) === null || _b === void 0 ? void 0 : _b.checkValidity()) !== null && _c !== void 0 ? _c : null;
|
|
38
39
|
return this.isValid;
|
|
39
40
|
}
|
|
40
41
|
onToggleSwitch(e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IxSwitchInput.js","sourceRoot":"","sources":["../src/IxSwitchInput.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,+BAA+B,CAAC;AAGvC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAOlE,MAAM,OAAO,aAAc,SAAQ,UAAU;IAA7C;;QAC8B,eAAU,GAAG,EAAE,CAAC;QAEhB,eAAU,GAAG,EAAE,CAAC;QAEhB,UAAK,GAAG,EAAE,CAAC;QAEX,SAAI,GAAG,EAAE,CAAC;QAEV,sBAAiB,GAAG,EAAE,CAAC;QAEvB,gBAAW,GAAG,EAAE,CAAC;QAEhB,aAAQ,GAAG,KAAK,CAAC;QAEjB,aAAQ,GAAG,KAAK,CAAC;QAEjB,aAAQ,GAAG,KAAK,CAAC;QAEjB,UAAK,GAAG,KAAK,CAAC;QAEd,yBAAoB,GAAG,KAAK,CAAC;QAE7B,aAAQ,GAAG,KAAK,CAAC;QAEjB,YAA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AC;+CAAkB;AAEjB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CAAkB;AAEjB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4CAAe;AAEd;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2DAA8B;AAE7B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CAAkB;AAEjB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;8CAAgB;AAET;IAAlC,KAAK,CAAC,0BAA0B,CAAC;2DAAkC","sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { property, query } from 'lit/decorators.js';\n\nimport '@digital-realty/ix-switch-bar';\nimport { IxTextbox } from '@digital-realty/ix-textbox';\n\nimport { NotRequired } from './constants.js';\nimport { IxSwitchInputStyles } from './ix-switch-input-styles.js';\nimport {\n ToggleSwitchEvent,\n TextChangeEvent,\n TextEventDetail,\n} from './types/index.js';\n\nexport class IxSwitchInput extends LitElement {\n @property({ type: String }) switchText = '';\n\n @property({ type: String }) switchNote = '';\n\n @property({ type: String }) label = '';\n\n @property({ type: String }) text = '';\n\n @property({ type: String }) defaultInputValue = '';\n\n @property({ type: String }) placeholder = '';\n\n @property({ type: Boolean }) selected = false;\n\n @property({ type: Boolean }) disabled = false;\n\n @property({ type: Boolean }) required = false;\n\n @property({ type: Boolean }) icons = false;\n\n @property({ type: Boolean }) showOnlySelectedIcon = false;\n\n @property({ type: Boolean }) isHidden = false;\n\n @property({ type: Boolean }) isValid = true;\n\n @query('#ix-switch-input-textbox') ixSwitchInputTextbox!: IxTextbox;\n\n static get styles() {\n return [IxSwitchInputStyles];\n }\n\n getPlaceholder() {\n if (!this.selected) {\n return this.defaultInputValue || `${NotRequired}`;\n }\n return '';\n }\n\n getValidityStatus() {\n if (!this.selected) return true;\n this.isValid =\n this.ixSwitchInputTextbox?.component?.checkValidity() ?? null;\n return this.isValid;\n }\n\n onToggleSwitch(e: ToggleSwitchEvent) {\n this.selected = !this.selected;\n this.dispatchSwitchEvent();\n e.stopPropagation();\n this.text = '';\n this.placeholder = this.getPlaceholder();\n }\n\n onUpdateText(e: TextChangeEvent) {\n this.text = e.detail.value;\n this.getValidityStatus();\n this.dispatchTextEvent({ value: this.text, isValid: this.isValid });\n e.stopPropagation();\n }\n\n dispatchSwitchEvent() {\n const toggleSwitchEvent = new CustomEvent('toggleSwitch', {\n detail: { selected: this.selected },\n composed: true,\n });\n this.dispatchEvent(toggleSwitchEvent);\n }\n\n dispatchTextEvent(eventDetail: TextEventDetail) {\n const textChangeEvent = new CustomEvent('textChange', {\n detail: eventDetail,\n composed: true,\n });\n this.dispatchEvent(textChangeEvent);\n }\n\n renderSwitch() {\n return html`<ix-switch-bar\n .text=${this.switchText}\n .note=${this.switchNote}\n ?selected=${this.selected}\n ?disabled=${this.disabled}\n ?required=${this.required}\n ?icons=${this.icons}\n ?showOnlySelectedIcon=\"${this.showOnlySelectedIcon}\"\n @toggleSwitch=${(e: ToggleSwitchEvent) => this.onToggleSwitch(e)}\n ></ix-switch-bar>`;\n }\n\n renderTextbox() {\n if (this.isHidden) return nothing;\n return html` <p class=\"label\">${this.label}</p>\n <ix-textbox\n id=\"ix-switch-input-textbox\"\n .text=\"${this.text}\"\n .placeholder=\"${this.placeholder}\"\n ?disabled=\"${!this.selected}\"\n ?required=${this.required && this.selected}\n @textChange=\"${(e: TextChangeEvent) => this.onUpdateText(e)}\"\n >\n </ix-textbox>`;\n }\n\n render() {\n return html` ${this.renderSwitch()} ${this.renderTextbox()} `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ix-switch-input': IxSwitchInput;\n }\n}\n"]}
|
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.
|
|
6
|
+
"version": "2.1.8",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"module": "dist/index.js",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\""
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@digital-realty/ix-switch-bar": "^2.1.
|
|
30
|
-
"@digital-realty/ix-textbox": "^2.1.
|
|
29
|
+
"@digital-realty/ix-switch-bar": "^2.1.5",
|
|
30
|
+
"@digital-realty/ix-textbox": "^2.1.5",
|
|
31
31
|
"@lit-labs/react": "^2.0.3",
|
|
32
32
|
"lit": "^2.0.2",
|
|
33
33
|
"react": "^18.2.0"
|
|
@@ -98,5 +98,5 @@
|
|
|
98
98
|
"README.md",
|
|
99
99
|
"LICENSE"
|
|
100
100
|
],
|
|
101
|
-
"gitHead": "
|
|
101
|
+
"gitHead": "c4a9f3abe2ba82b4fd192ce53abc4d2bcbc66b7f"
|
|
102
102
|
}
|