@libs-ui/components-switch 0.2.10-6.2
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 +3 -0
- package/esm2022/index.mjs +3 -0
- package/esm2022/interfaces/index.mjs +2 -0
- package/esm2022/interfaces/switch.interface.mjs +2 -0
- package/esm2022/libs-ui-components-switch.mjs +5 -0
- package/esm2022/switch.component.mjs +32 -0
- package/fesm2022/libs-ui-components-switch.mjs +39 -0
- package/fesm2022/libs-ui-components-switch.mjs.map +1 -0
- package/index.d.ts +2 -0
- package/interfaces/index.d.ts +1 -0
- package/interfaces/switch.interface.d.ts +8 -0
- package/package.json +25 -0
- package/switch.component.d.ts +12 -0
package/README.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export * from './switch.component';
|
|
2
|
+
export * from './interfaces';
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9saWJzLXVpL2NvbXBvbmVudHMvc3dpdGNoL3NyYy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLG9CQUFvQixDQUFDO0FBQ25DLGNBQWMsY0FBYyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSAnLi9zd2l0Y2guY29tcG9uZW50JztcbmV4cG9ydCAqIGZyb20gJy4vaW50ZXJmYWNlcyc7Il19
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export * from './switch.interface';
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9saWJzLXVpL2NvbXBvbmVudHMvc3dpdGNoL3NyYy9pbnRlcmZhY2VzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsb0JBQW9CLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL3N3aXRjaC5pbnRlcmZhY2UnO1xuIl19
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3dpdGNoLmludGVyZmFjZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMtdWkvY29tcG9uZW50cy9zd2l0Y2gvc3JjL2ludGVyZmFjZXMvc3dpdGNoLmludGVyZmFjZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGludGVyZmFjZSBJU3dpdGNoIHtcbiAgICBkaXNhYmxlPzogYm9vbGVhbjtcbiAgICBhY3RpdmU/OiBib29sZWFuO1xufVxuXG5leHBvcnQgaW50ZXJmYWNlIElTd2l0Y2hFdmVudCB7XG4gICAgYWN0aXZlOiBib29sZWFuO1xuICAgIHJldmVydDogKCkgPT4gUHJvbWlzZTx2b2lkPjtcbn1cbiJdfQ==
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
export * from './index';
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlicy11aS1jb21wb25lbnRzLXN3aXRjaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL2xpYnMtdWkvY29tcG9uZW50cy9zd2l0Y2gvc3JjL2xpYnMtdWktY29tcG9uZW50cy1zd2l0Y2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLFNBQVMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9pbmRleCc7XG4iXX0=
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, input, model, output } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export class LibsUiComponentsSwitchComponent {
|
|
4
|
+
/* PROPERTY */
|
|
5
|
+
size = input('default');
|
|
6
|
+
disable = input();
|
|
7
|
+
active = model(false);
|
|
8
|
+
/* OUTPUT */
|
|
9
|
+
outSwitch = output();
|
|
10
|
+
/* FUNCTIONS */
|
|
11
|
+
async handlerClick(event) {
|
|
12
|
+
event.stopPropagation();
|
|
13
|
+
if (this.disable()) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
this.setActiveToggle();
|
|
17
|
+
this.outSwitch.emit({
|
|
18
|
+
active: this.active(),
|
|
19
|
+
revert: this.setActiveToggle.bind(this)
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
async setActiveToggle() {
|
|
23
|
+
this.active.update(value => value ? false : true);
|
|
24
|
+
}
|
|
25
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsSwitchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
26
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: LibsUiComponentsSwitchComponent, isStandalone: true, selector: "libs_ui-components-switch", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, disable: { classPropertyName: "disable", publicName: "disable", isSignal: true, isRequired: false, transformFunction: null }, active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { active: "activeChange", outSwitch: "outSwitch" }, ngImport: i0, template: "<div [attr.size]=\"size()\"\n [class.libs-ui-switch-container]=\"true\"\n [class.pointer-events-none]=\"disable()\"\n (click)=\"handlerClick($event)\">\n <div [attr.size]=\"size()\"\n [class.libs-ui-switch-bar]=\"true\"\n [class.libs-ui-switch-bar-active]=\"active()\"\n [class.libs-ui-disable-background]=\"!active() && disable()\"\n [class.libs-ui-disable-active-background]=\"active() && disable()\">\n </div>\n <div [attr.size]=\"size()\"\n [class.libs-ui-switch-circle]=\"true\"\n [class.libs-ui-switch-circle-active]=\"active()\">\n </div>\n\n</div>\n", styles: [".libs-ui-switch-container{position:relative;cursor:pointer}.libs-ui-switch-container .libs-ui-switch-bar{width:30px;height:16px;border-radius:8px;background-color:#d9d9d9;transition:all .3s;-webkit-transition:all .3s}.libs-ui-switch-container .libs-ui-switch-bar[size=large]{width:45px;height:24px;border-radius:24px}.libs-ui-switch-container .libs-ui-switch-bar.libs-ui-switch-bar-active{background-color:var(--libs-ui-color-default, #226FF5)}.libs-ui-switch-container .libs-ui-switch-circle{height:12px;width:12px;background-color:#fff;border-radius:50%;position:absolute;top:2px;left:2px;cursor:pointer;transition:left .3s;-webkit-transition:left .3s}.libs-ui-switch-container .libs-ui-switch-circle[size=large]{width:20px;height:20px}.libs-ui-switch-container .libs-ui-switch-circle.libs-ui-switch-circle-active{left:16px}.libs-ui-switch-container .libs-ui-switch-circle.libs-ui-switch-circle-active[size=large]{left:23px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
27
|
+
}
|
|
28
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsSwitchComponent, decorators: [{
|
|
29
|
+
type: Component,
|
|
30
|
+
args: [{ selector: 'libs_ui-components-switch', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [attr.size]=\"size()\"\n [class.libs-ui-switch-container]=\"true\"\n [class.pointer-events-none]=\"disable()\"\n (click)=\"handlerClick($event)\">\n <div [attr.size]=\"size()\"\n [class.libs-ui-switch-bar]=\"true\"\n [class.libs-ui-switch-bar-active]=\"active()\"\n [class.libs-ui-disable-background]=\"!active() && disable()\"\n [class.libs-ui-disable-active-background]=\"active() && disable()\">\n </div>\n <div [attr.size]=\"size()\"\n [class.libs-ui-switch-circle]=\"true\"\n [class.libs-ui-switch-circle-active]=\"active()\">\n </div>\n\n</div>\n", styles: [".libs-ui-switch-container{position:relative;cursor:pointer}.libs-ui-switch-container .libs-ui-switch-bar{width:30px;height:16px;border-radius:8px;background-color:#d9d9d9;transition:all .3s;-webkit-transition:all .3s}.libs-ui-switch-container .libs-ui-switch-bar[size=large]{width:45px;height:24px;border-radius:24px}.libs-ui-switch-container .libs-ui-switch-bar.libs-ui-switch-bar-active{background-color:var(--libs-ui-color-default, #226FF5)}.libs-ui-switch-container .libs-ui-switch-circle{height:12px;width:12px;background-color:#fff;border-radius:50%;position:absolute;top:2px;left:2px;cursor:pointer;transition:left .3s;-webkit-transition:left .3s}.libs-ui-switch-container .libs-ui-switch-circle[size=large]{width:20px;height:20px}.libs-ui-switch-container .libs-ui-switch-circle.libs-ui-switch-circle-active{left:16px}.libs-ui-switch-container .libs-ui-switch-circle.libs-ui-switch-circle-active[size=large]{left:23px}\n"] }]
|
|
31
|
+
}] });
|
|
32
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3dpdGNoLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL2xpYnMtdWkvY29tcG9uZW50cy9zd2l0Y2gvc3JjL3N3aXRjaC5jb21wb25lbnQudHMiLCIuLi8uLi8uLi8uLi8uLi9saWJzLXVpL2NvbXBvbmVudHMvc3dpdGNoL3NyYy9zd2l0Y2guY29tcG9uZW50Lmh0bWwiXSwibmFtZXMiOltdLCJ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XCI+XG4gIDwvZGl2PlxuICA8ZGl2IFthdHRyLnNpemVdPVwic2l6ZSgpXCJcbiAgICBbY2xhc3MubGlicy11aS1zd2l0Y2gtY2lyY2xlXT1cInRydWVcIlxuICAgIFtjbGFzcy5saWJzLXVpLXN3aXRjaC1jaXJjbGUtYWN0aXZlXT1cImFjdGl2ZSgpXCI+XG4gIDwvZGl2PlxuXG48L2Rpdj5cbiJdfQ==
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, model, output, Component, ChangeDetectionStrategy } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
class LibsUiComponentsSwitchComponent {
|
|
5
|
+
/* PROPERTY */
|
|
6
|
+
size = input('default');
|
|
7
|
+
disable = input();
|
|
8
|
+
active = model(false);
|
|
9
|
+
/* OUTPUT */
|
|
10
|
+
outSwitch = output();
|
|
11
|
+
/* FUNCTIONS */
|
|
12
|
+
async handlerClick(event) {
|
|
13
|
+
event.stopPropagation();
|
|
14
|
+
if (this.disable()) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
this.setActiveToggle();
|
|
18
|
+
this.outSwitch.emit({
|
|
19
|
+
active: this.active(),
|
|
20
|
+
revert: this.setActiveToggle.bind(this)
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
async setActiveToggle() {
|
|
24
|
+
this.active.update(value => value ? false : true);
|
|
25
|
+
}
|
|
26
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsSwitchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
27
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: LibsUiComponentsSwitchComponent, isStandalone: true, selector: "libs_ui-components-switch", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, disable: { classPropertyName: "disable", publicName: "disable", isSignal: true, isRequired: false, transformFunction: null }, active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { active: "activeChange", outSwitch: "outSwitch" }, ngImport: i0, template: "<div [attr.size]=\"size()\"\n [class.libs-ui-switch-container]=\"true\"\n [class.pointer-events-none]=\"disable()\"\n (click)=\"handlerClick($event)\">\n <div [attr.size]=\"size()\"\n [class.libs-ui-switch-bar]=\"true\"\n [class.libs-ui-switch-bar-active]=\"active()\"\n [class.libs-ui-disable-background]=\"!active() && disable()\"\n [class.libs-ui-disable-active-background]=\"active() && disable()\">\n </div>\n <div [attr.size]=\"size()\"\n [class.libs-ui-switch-circle]=\"true\"\n [class.libs-ui-switch-circle-active]=\"active()\">\n </div>\n\n</div>\n", styles: [".libs-ui-switch-container{position:relative;cursor:pointer}.libs-ui-switch-container .libs-ui-switch-bar{width:30px;height:16px;border-radius:8px;background-color:#d9d9d9;transition:all .3s;-webkit-transition:all .3s}.libs-ui-switch-container .libs-ui-switch-bar[size=large]{width:45px;height:24px;border-radius:24px}.libs-ui-switch-container .libs-ui-switch-bar.libs-ui-switch-bar-active{background-color:var(--libs-ui-color-default, #226FF5)}.libs-ui-switch-container .libs-ui-switch-circle{height:12px;width:12px;background-color:#fff;border-radius:50%;position:absolute;top:2px;left:2px;cursor:pointer;transition:left .3s;-webkit-transition:left .3s}.libs-ui-switch-container .libs-ui-switch-circle[size=large]{width:20px;height:20px}.libs-ui-switch-container .libs-ui-switch-circle.libs-ui-switch-circle-active{left:16px}.libs-ui-switch-container .libs-ui-switch-circle.libs-ui-switch-circle-active[size=large]{left:23px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
28
|
+
}
|
|
29
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsSwitchComponent, decorators: [{
|
|
30
|
+
type: Component,
|
|
31
|
+
args: [{ selector: 'libs_ui-components-switch', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [attr.size]=\"size()\"\n [class.libs-ui-switch-container]=\"true\"\n [class.pointer-events-none]=\"disable()\"\n (click)=\"handlerClick($event)\">\n <div [attr.size]=\"size()\"\n [class.libs-ui-switch-bar]=\"true\"\n [class.libs-ui-switch-bar-active]=\"active()\"\n [class.libs-ui-disable-background]=\"!active() && disable()\"\n [class.libs-ui-disable-active-background]=\"active() && disable()\">\n </div>\n <div [attr.size]=\"size()\"\n [class.libs-ui-switch-circle]=\"true\"\n [class.libs-ui-switch-circle-active]=\"active()\">\n </div>\n\n</div>\n", styles: [".libs-ui-switch-container{position:relative;cursor:pointer}.libs-ui-switch-container .libs-ui-switch-bar{width:30px;height:16px;border-radius:8px;background-color:#d9d9d9;transition:all .3s;-webkit-transition:all .3s}.libs-ui-switch-container .libs-ui-switch-bar[size=large]{width:45px;height:24px;border-radius:24px}.libs-ui-switch-container .libs-ui-switch-bar.libs-ui-switch-bar-active{background-color:var(--libs-ui-color-default, #226FF5)}.libs-ui-switch-container .libs-ui-switch-circle{height:12px;width:12px;background-color:#fff;border-radius:50%;position:absolute;top:2px;left:2px;cursor:pointer;transition:left .3s;-webkit-transition:left .3s}.libs-ui-switch-container .libs-ui-switch-circle[size=large]{width:20px;height:20px}.libs-ui-switch-container .libs-ui-switch-circle.libs-ui-switch-circle-active{left:16px}.libs-ui-switch-container .libs-ui-switch-circle.libs-ui-switch-circle-active[size=large]{left:23px}\n"] }]
|
|
32
|
+
}] });
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Generated bundle index. Do not edit.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
export { LibsUiComponentsSwitchComponent };
|
|
39
|
+
//# sourceMappingURL=libs-ui-components-switch.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"libs-ui-components-switch.mjs","sources":["../../../../../libs-ui/components/switch/src/switch.component.ts","../../../../../libs-ui/components/switch/src/switch.component.html","../../../../../libs-ui/components/switch/src/libs-ui-components-switch.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input, model, output } from '@angular/core';\nimport { ISwitchEvent } from './interfaces';\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'libs_ui-components-switch',\n templateUrl: './switch.component.html',\n styleUrls: ['./switch.component.scss'],\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush\n})\n\nexport class LibsUiComponentsSwitchComponent {\n\n /* PROPERTY */\n readonly size = input<'default' | 'large'>('default');\n readonly disable = input<boolean>();\n readonly active = model<boolean>(false);\n\n /* OUTPUT */\n readonly outSwitch = output<ISwitchEvent>();\n\n /* FUNCTIONS */\n protected async handlerClick(event: Event) {\n event.stopPropagation();\n if (this.disable()) {\n return;\n }\n this.setActiveToggle();\n this.outSwitch.emit({\n active: this.active(),\n revert: this.setActiveToggle.bind(this)\n });\n }\n\n private async setActiveToggle() {\n this.active.update(value => value ? false : true);\n }\n}\n","<div [attr.size]=\"size()\"\n [class.libs-ui-switch-container]=\"true\"\n [class.pointer-events-none]=\"disable()\"\n (click)=\"handlerClick($event)\">\n <div [attr.size]=\"size()\"\n [class.libs-ui-switch-bar]=\"true\"\n [class.libs-ui-switch-bar-active]=\"active()\"\n [class.libs-ui-disable-background]=\"!active() && disable()\"\n [class.libs-ui-disable-active-background]=\"active() && disable()\">\n </div>\n <div [attr.size]=\"size()\"\n [class.libs-ui-switch-circle]=\"true\"\n [class.libs-ui-switch-circle-active]=\"active()\">\n </div>\n\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;MAYa,+BAA+B,CAAA;;AAGjC,IAAA,IAAI,GAAG,KAAK,CAAsB,SAAS,CAAC,CAAC;IAC7C,OAAO,GAAG,KAAK,EAAW,CAAC;AAC3B,IAAA,MAAM,GAAG,KAAK,CAAU,KAAK,CAAC,CAAC;;IAG/B,SAAS,GAAG,MAAM,EAAgB,CAAC;;IAGlC,MAAM,YAAY,CAAC,KAAY,EA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
|
2
|
+
"name": "@libs-ui/components-switch",
|
|
3
|
+
"version": "0.2.106.2",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^18.2.0",
|
|
6
|
+
"@angular/core": "^18.2.0"
|
|
7
|
+
},
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"module": "fesm2022/libs-ui-components-switch.mjs",
|
|
10
|
+
"typings": "index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
"./package.json": {
|
|
13
|
+
"default": "./package.json"
|
|
14
|
+
},
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./index.d.ts",
|
|
17
|
+
"esm2022": "./esm2022/libs-ui-components-switch.mjs",
|
|
18
|
+
"esm": "./esm2022/libs-ui-components-switch.mjs",
|
|
19
|
+
"default": "./fesm2022/libs-ui-components-switch.mjs"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"tslib": "^2.3.0"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ISwitchEvent } from './interfaces';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class LibsUiComponentsSwitchComponent {
|
|
4
|
+
readonly size: import("@angular/core").InputSignal<"default" | "large">;
|
|
5
|
+
readonly disable: import("@angular/core").InputSignal<boolean | undefined>;
|
|
6
|
+
readonly active: import("@angular/core").ModelSignal<boolean>;
|
|
7
|
+
readonly outSwitch: import("@angular/core").OutputEmitterRef<ISwitchEvent>;
|
|
8
|
+
protected handlerClick(event: Event): Promise<void>;
|
|
9
|
+
private setActiveToggle;
|
|
10
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LibsUiComponentsSwitchComponent, never>;
|
|
11
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LibsUiComponentsSwitchComponent, "libs_ui-components-switch", never, { "size": { "alias": "size"; "required": false; "isSignal": true; }; "disable": { "alias": "disable"; "required": false; "isSignal": true; }; "active": { "alias": "active"; "required": false; "isSignal": true; }; }, { "active": "activeChange"; "outSwitch": "outSwitch"; }, never, never, true, never>;
|
|
12
|
+
}
|