@libs-ui/components-switch 0.2.11

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 ADDED
@@ -0,0 +1,3 @@
1
+ # switch
2
+
3
+ This library was generated with [Nx](https://nx.dev).
@@ -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.libs-ui-disable]=\"disable()\"\n [class.pointer-events-none]=\"disable()\"\n (click)=\"handlerClick($event)\">\n\n <div [attr.size]=\"size()\"\n [class.libs-ui-switch-bar]=\"true\"\n [class.libs-ui-switch-bar-active]=\"active()\">\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.libs-ui-disable]=\"disable()\"\n [class.pointer-events-none]=\"disable()\"\n (click)=\"handlerClick($event)\">\n\n <div [attr.size]=\"size()\"\n [class.libs-ui-switch-bar]=\"true\"\n [class.libs-ui-switch-bar-active]=\"active()\">\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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3dpdGNoLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL2xpYnMtdWkvY29tcG9uZW50cy9zd2l0Y2gvc3JjL3N3aXRjaC5jb21wb25lbnQudHMiLCIuLi8uLi8uLi8uLi8uLi9saWJzLXVpL2NvbXBvbmVudHMvc3dpdGNoL3NyYy9zd2l0Y2guY29tcG9uZW50Lmh0bWwiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLHVCQUF1QixFQUFFLFNBQVMsRUFBRSxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLGVBQWUsQ0FBQzs7QUFZekYsTUFBTSxPQUFPLCtCQUErQjtJQUUxQyxjQUFjO0lBQ0wsSUFBSSxHQUFHLEtBQUssQ0FBc0IsU0FBUyxDQUFDLENBQUM7SUFDN0MsT0FBTyxHQUFHLEtBQUssRUFBVyxDQUFDO0lBQzNCLE1BQU0sR0FBRyxLQUFLLENBQVUsS0FBSyxDQUFDLENBQUM7SUFFeEMsWUFBWTtJQUNILFNBQVMsR0FBRyxNQUFNLEVBQWdCLENBQUM7SUFFNUMsZUFBZTtJQUNMLEtBQUssQ0FBQyxZQUFZLENBQUMsS0FBWTtRQUN2QyxLQUFLLENBQUMsZUFBZSxFQUFFLENBQUM7UUFDeEIsSUFBSSxJQUFJLENBQUMsT0FBTyxFQUFFLEVBQUUsQ0FBQztZQUNuQixPQUFPO1FBQ1QsQ0FBQztRQUNELElBQUksQ0FBQyxlQUFlLEVBQUUsQ0FBQztRQUN2QixJQUF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zcy5saWJzLXVpLWRpc2FibGVdPVwiZGlzYWJsZSgpXCJcbiAgW2NsYXNzLnBvaW50ZXItZXZlbnRzLW5vbmVdPVwiZGlzYWJsZSgpXCJcbiAgKGNsaWNrKT1cImhhbmRsZXJDbGljaygkZXZlbnQpXCI+XG5cbiAgPGRpdiBbYXR0ci5zaXplXT1cInNpemUoKVwiXG4gICAgW2NsYXNzLmxpYnMtdWktc3dpdGNoLWJhcl09XCJ0cnVlXCJcbiAgICBbY2xhc3MubGlicy11aS1zd2l0Y2gtYmFyLWFjdGl2ZV09XCJhY3RpdmUoKVwiPlxuICA8L2Rpdj5cbiAgPGRpdiBbYXR0ci5zaXplXT1cInNpemUoKVwiXG4gICAgW2NsYXNzLmxpYnMtdWktc3dpdGNoLWNpcmNsZV09XCJ0cnVlXCJcbiAgICBbY2xhc3MubGlicy11aS1zd2l0Y2gtY2lyY2xlLWFjdGl2ZV09XCJhY3RpdmUoKVwiPlxuICA8L2Rpdj5cblxuPC9kaXY+XG4iXX0=
@@ -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.libs-ui-disable]=\"disable()\"\n [class.pointer-events-none]=\"disable()\"\n (click)=\"handlerClick($event)\">\n\n <div [attr.size]=\"size()\"\n [class.libs-ui-switch-bar]=\"true\"\n [class.libs-ui-switch-bar-active]=\"active()\">\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.libs-ui-disable]=\"disable()\"\n [class.pointer-events-none]=\"disable()\"\n (click)=\"handlerClick($event)\">\n\n <div [attr.size]=\"size()\"\n [class.libs-ui-switch-bar]=\"true\"\n [class.libs-ui-switch-bar-active]=\"active()\">\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.libs-ui-disable]=\"disable()\"\n [class.pointer-events-none]=\"disable()\"\n (click)=\"handlerClick($event)\">\n\n <div [attr.size]=\"size()\"\n [class.libs-ui-switch-bar]=\"true\"\n [class.libs-ui-switch-bar-active]=\"active()\">\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;IAC5C,OAAO,GAAG,KAAK,EAAW;AAC1B,IAAA,MAAM,GAAG,KAAK,CAAU,KAAK,CAAC;;IAG9B,SAAS,GAAG,MAAM,EAAgB;;IAGjC,MAAM,YAAY,CAAC,KAAY,EAAA;QACvC,KAAK,CAAC,eAAe,EAAE;AACvB,QAAA,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE;YAClB;;QAEF,IAAI,CAAC,eAAe,EAAE;AACtB,QAAA,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;AAClB,YAAA,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE;YACrB,MAAM,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI;AACvC,SAAA,CAAC;;AAGI,IAAA,MAAM,eAAe,GAAA;AAC3B,QAAA,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,IAAI,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC;;wGAxBxC,+BAA+B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAA/B,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,+BAA+B,4gBCZ5C,ueAgBA,EAAA,MAAA,EAAA,CAAA,k6BAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FDJa,+BAA+B,EAAA,UAAA,EAAA,CAAA;kBAT3C,SAAS;AAEE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,2BAA2B,EAGzB,UAAA,EAAA,IAAI,EACC,eAAA,EAAA,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,ueAAA,EAAA,MAAA,EAAA,CAAA,k6BAAA,CAAA,EAAA;;;AETjD;;AAEG;;;;"}
package/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './switch.component';
2
+ export * from './interfaces';
@@ -0,0 +1 @@
1
+ export * from './switch.interface';
@@ -0,0 +1,8 @@
1
+ export interface ISwitch {
2
+ disable?: boolean;
3
+ active?: boolean;
4
+ }
5
+ export interface ISwitchEvent {
6
+ active: boolean;
7
+ revert: () => Promise<void>;
8
+ }
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@libs-ui/components-switch",
3
+ "version": "0.2.11",
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
+ }