@masterteam/components 0.0.10 → 0.0.12
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/assets/common.css +37 -0
- package/checkbox-field/index.d.ts +3 -1
- package/fesm2022/masterteam-components-card.mjs +3 -3
- package/fesm2022/masterteam-components-card.mjs.map +1 -1
- package/fesm2022/masterteam-components-checkbox-field.mjs +5 -3
- package/fesm2022/masterteam-components-checkbox-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-editor-field.mjs +2 -2
- package/fesm2022/masterteam-components-editor-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-list.mjs +2 -2
- package/fesm2022/masterteam-components-list.mjs.map +1 -1
- package/fesm2022/masterteam-components-toast.mjs +75 -0
- package/fesm2022/masterteam-components-toast.mjs.map +1 -0
- package/fesm2022/masterteam-components-toggle-field.mjs +80 -0
- package/fesm2022/masterteam-components-toggle-field.mjs.map +1 -0
- package/fesm2022/masterteam-components.mjs +58 -21
- package/fesm2022/masterteam-components.mjs.map +1 -1
- package/index.d.ts +4 -1
- package/package.json +32 -24
- package/toast/index.d.ts +26 -0
- package/toggle-field/index.d.ts +33 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
@plugin "tailwindcss-primeui";
|
|
3
|
+
|
|
4
|
+
@custom-variant dark (&:where(.dark, .dark *));
|
|
5
|
+
|
|
6
|
+
:root {
|
|
7
|
+
--app-background: var(--p-surface-100);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
:root[class="dark"] {
|
|
11
|
+
--app-background: var(--p-surface-950);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
body {
|
|
15
|
+
background-color: var(--app-background);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@utility bg-content {
|
|
19
|
+
background-color: var(--p-content-background);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@layer components {
|
|
23
|
+
label.required {
|
|
24
|
+
&:after {
|
|
25
|
+
content: "*";
|
|
26
|
+
color: var(--p-red-500);
|
|
27
|
+
padding-inline-start: 2px;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
.dark {
|
|
31
|
+
label.required {
|
|
32
|
+
&:after {
|
|
33
|
+
color: var(--p-red-600);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -6,12 +6,14 @@ import { isInvalid } from '@masterteam/components';
|
|
|
6
6
|
declare class CheckboxField implements ControlValueAccessor {
|
|
7
7
|
checkbox: Checkbox;
|
|
8
8
|
label: _angular_core.InputSignal<string | undefined>;
|
|
9
|
+
labelPosition: _angular_core.InputSignal<"top" | "start" | "end" | "bottom">;
|
|
9
10
|
placeholder: _angular_core.InputSignal<string | undefined>;
|
|
10
11
|
readonly: _angular_core.InputSignal<boolean>;
|
|
11
12
|
pInputs: _angular_core.InputSignal<Partial<Checkbox> | undefined>;
|
|
12
13
|
onChange: _angular_core.OutputEmitterRef<CheckboxChangeEvent>;
|
|
13
14
|
ngControl: NgControl;
|
|
14
15
|
isInvalid: typeof isInvalid;
|
|
16
|
+
isVertical: _angular_core.Signal<boolean>;
|
|
15
17
|
requiredValidator: typeof Validators.required;
|
|
16
18
|
value: _angular_core.WritableSignal<boolean | null>;
|
|
17
19
|
disabled: _angular_core.WritableSignal<boolean>;
|
|
@@ -25,7 +27,7 @@ declare class CheckboxField implements ControlValueAccessor {
|
|
|
25
27
|
registerOnTouched(fn: any): void;
|
|
26
28
|
setDisabledState(disabled: boolean): void;
|
|
27
29
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CheckboxField, never>;
|
|
28
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CheckboxField, "mt-checkbox-field", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "pInputs": { "alias": "pInputs"; "required": false; "isSignal": true; }; }, { "onChange": "onChange"; }, never, never, true, never>;
|
|
30
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CheckboxField, "mt-checkbox-field", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "labelPosition": { "alias": "labelPosition"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "pInputs": { "alias": "pInputs"; "required": false; "isSignal": true; }; }, { "onChange": "onChange"; }, never, never, true, never>;
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
export { CheckboxField };
|
|
@@ -12,13 +12,13 @@ class Card {
|
|
|
12
12
|
// Content child to get the headless template
|
|
13
13
|
headless = contentChild('headless', ...(ngDevMode ? [{ debugName: "headless" }] : []));
|
|
14
14
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: Card, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
15
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: Card, isStandalone: true, selector: "mt-card", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, paddingless: { classPropertyName: "paddingless", publicName: "paddingless", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "block bg-
|
|
15
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: Card, isStandalone: true, selector: "mt-card", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, paddingless: { classPropertyName: "paddingless", publicName: "paddingless", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "block bg-content rounded-2xl border-1 border-surface" }, queries: [{ propertyName: "headless", first: true, predicate: ["headless"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"size-full flex flex-col\">\n @if (headless()) {\n <!-- Custom headless template -->\n <ng-container [ngTemplateOutlet]=\"headless()\"></ng-container>\n } @else {\n @if (title()) {\n <!-- Default header with dynamic title -->\n <div\n class=\"flex items-center justify-between px-4 py-5 border-b border-surface\"\n >\n <h3 class=\"text-xl font-semibold\">{{ title() }}</h3>\n </div>\n }\n\n <div class=\"flex-1\" [class.p-4]=\"!paddingless()\">\n <ng-content></ng-content>\n </div>\n }\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
16
16
|
}
|
|
17
17
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: Card, decorators: [{
|
|
18
18
|
type: Component,
|
|
19
19
|
args: [{ selector: 'mt-card', standalone: true, imports: [CommonModule], host: {
|
|
20
|
-
class: 'block bg-
|
|
21
|
-
}, template: "<div class=\"size-full flex flex-col\">\n @if (headless()) {\n <!-- Custom headless template -->\n <ng-container [ngTemplateOutlet]=\"headless()\"></ng-container>\n } @else {\n @if (title()) {\n <!-- Default header with dynamic title -->\n <div\n class=\"flex items-center justify-between px-4 py-5 border-b border-surface
|
|
20
|
+
class: 'block bg-content rounded-2xl border-1 border-surface',
|
|
21
|
+
}, template: "<div class=\"size-full flex flex-col\">\n @if (headless()) {\n <!-- Custom headless template -->\n <ng-container [ngTemplateOutlet]=\"headless()\"></ng-container>\n } @else {\n @if (title()) {\n <!-- Default header with dynamic title -->\n <div\n class=\"flex items-center justify-between px-4 py-5 border-b border-surface\"\n >\n <h3 class=\"text-xl font-semibold\">{{ title() }}</h3>\n </div>\n }\n\n <div class=\"flex-1\" [class.p-4]=\"!paddingless()\">\n <ng-content></ng-content>\n </div>\n }\n</div>\n" }]
|
|
22
22
|
}] });
|
|
23
23
|
|
|
24
24
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"masterteam-components-card.mjs","sources":["../../../../packages/masterteam/components/card/card.ts","../../../../packages/masterteam/components/card/card.html","../../../../packages/masterteam/components/card/masterteam-components-card.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport {\n Component,\n input,\n contentChild,\n TemplateRef,\n booleanAttribute,\n} from '@angular/core';\n\n@Component({\n selector: 'mt-card',\n standalone: true,\n templateUrl: './card.html',\n styleUrl: './card.scss',\n imports: [CommonModule],\n host: {\n class: 'block bg-
|
|
1
|
+
{"version":3,"file":"masterteam-components-card.mjs","sources":["../../../../packages/masterteam/components/card/card.ts","../../../../packages/masterteam/components/card/card.html","../../../../packages/masterteam/components/card/masterteam-components-card.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport {\n Component,\n input,\n contentChild,\n TemplateRef,\n booleanAttribute,\n} from '@angular/core';\n\n@Component({\n selector: 'mt-card',\n standalone: true,\n templateUrl: './card.html',\n styleUrl: './card.scss',\n imports: [CommonModule],\n host: {\n class: 'block bg-content rounded-2xl border-1 border-surface',\n },\n})\nexport class Card {\n readonly class = input<string>('');\n readonly title = input<string>('');\n readonly paddingless = input<boolean, unknown>(false, {\n transform: booleanAttribute,\n });\n // Content child to get the headless template\n headless = contentChild<TemplateRef<any>>('headless');\n}\n","<div class=\"size-full flex flex-col\">\n @if (headless()) {\n <!-- Custom headless template -->\n <ng-container [ngTemplateOutlet]=\"headless()\"></ng-container>\n } @else {\n @if (title()) {\n <!-- Default header with dynamic title -->\n <div\n class=\"flex items-center justify-between px-4 py-5 border-b border-surface\"\n >\n <h3 class=\"text-xl font-semibold\">{{ title() }}</h3>\n </div>\n }\n\n <div class=\"flex-1\" [class.p-4]=\"!paddingless()\">\n <ng-content></ng-content>\n </div>\n }\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[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,EAAA,MAAA,EAAA,CAAA,EAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EDLY,YAAY,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,gBAAA,EAAA,QAAA,EAAA,oBAAA,EAAA,MAAA,EAAA,CAAA,yBAAA,EAAA,kBAAA,EAAA,0BAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;2FAKX,IAAI,EAAA,UAAA,EAAA,CAAA;kBAVhB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,SAAS,cACP,IAAI,EAAA,OAAA,EAGP,CAAC,YAAY,CAAC,EAAA,IAAA,EACjB;AACJ,wBAAA,KAAK,EAAE,sDAAsD;AAC9D,qBAAA,EAAA,QAAA,EAAA,yjBAAA,EAAA;;;AEjBH;;AAEG;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, output, inject, signal, effect, ViewChild, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { input, output, inject, computed, signal, effect, ViewChild, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/forms';
|
|
4
4
|
import { NgControl, Validators, FormsModule } from '@angular/forms';
|
|
5
5
|
import * as i2 from 'primeng/checkbox';
|
|
@@ -10,12 +10,14 @@ import { isInvalid } from '@masterteam/components';
|
|
|
10
10
|
class CheckboxField {
|
|
11
11
|
checkbox;
|
|
12
12
|
label = input(...(ngDevMode ? [undefined, { debugName: "label" }] : []));
|
|
13
|
+
labelPosition = input('end', ...(ngDevMode ? [{ debugName: "labelPosition" }] : []));
|
|
13
14
|
placeholder = input(...(ngDevMode ? [undefined, { debugName: "placeholder" }] : []));
|
|
14
15
|
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : []));
|
|
15
16
|
pInputs = input(...(ngDevMode ? [undefined, { debugName: "pInputs" }] : []));
|
|
16
17
|
onChange = output();
|
|
17
18
|
ngControl = inject(NgControl, { self: true });
|
|
18
19
|
isInvalid = isInvalid;
|
|
20
|
+
isVertical = computed(() => this.labelPosition() === 'top' || this.labelPosition() === 'bottom', ...(ngDevMode ? [{ debugName: "isVertical" }] : []));
|
|
19
21
|
requiredValidator = Validators.required;
|
|
20
22
|
value = signal(null, ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
21
23
|
disabled = signal(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
@@ -58,13 +60,13 @@ class CheckboxField {
|
|
|
58
60
|
this.disabled.set(disabled);
|
|
59
61
|
}
|
|
60
62
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: CheckboxField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
61
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: CheckboxField, isStandalone: true, selector: "mt-checkbox-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, pInputs: { classPropertyName: "pInputs", publicName: "pInputs", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onChange: "onChange" }, host: { classAttribute: "grid gap-1" }, viewQueries: [{ propertyName: "checkbox", first: true, predicate: ["checkbox"], descendants: true, static: true }], ngImport: i0, template: "<div class=\"
|
|
63
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: CheckboxField, isStandalone: true, selector: "mt-checkbox-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, pInputs: { classPropertyName: "pInputs", publicName: "pInputs", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onChange: "onChange" }, host: { classAttribute: "grid gap-1" }, viewQueries: [{ propertyName: "checkbox", first: true, predicate: ["checkbox"], descendants: true, static: true }], ngImport: i0, template: "<div\n class=\"flex gap-1\"\n [class.items-center]=\"!isVertical()\"\n [class.gap-2]=\"!isVertical()\"\n [class.flex-col]=\"isVertical()\"\n [class.flex-col-reverse]=\"labelPosition() === 'top'\"\n [class.flex-row-reverse]=\"labelPosition() === 'start'\"\n [class.justify-end]=\"labelPosition() === 'start'\"\n>\n <p-checkbox\n #checkbox\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n (onChange)=\"onChange.emit($event)\"\n (onBlur)=\"onTouched()\"\n [disabled]=\"disabled() || readonly()\"\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\n [binary]=\"true\"\n [invalid]=\"isInvalid(ngControl?.control)\"\n class=\"leading-none\"\n ></p-checkbox>\n @if (label()) {\n <label\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n }\n</div>\n\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i2.Checkbox, selector: "p-checkbox, p-checkBox, p-check-box", inputs: ["value", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "inputStyle", "styleClass", "inputClass", "indeterminate", "formControl", "checkboxIcon", "readonly", "autofocus", "trueValue", "falseValue", "variant", "size"], outputs: ["onChange", "onFocus", "onBlur"] }, { kind: "component", type: FieldValidation, selector: "mt-field-validation", inputs: ["control", "touched"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
62
64
|
}
|
|
63
65
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: CheckboxField, decorators: [{
|
|
64
66
|
type: Component,
|
|
65
67
|
args: [{ selector: 'mt-checkbox-field', standalone: true, imports: [FormsModule, CheckboxModule, FieldValidation], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
66
68
|
class: 'grid gap-1',
|
|
67
|
-
}, template: "<div class=\"
|
|
69
|
+
}, template: "<div\n class=\"flex gap-1\"\n [class.items-center]=\"!isVertical()\"\n [class.gap-2]=\"!isVertical()\"\n [class.flex-col]=\"isVertical()\"\n [class.flex-col-reverse]=\"labelPosition() === 'top'\"\n [class.flex-row-reverse]=\"labelPosition() === 'start'\"\n [class.justify-end]=\"labelPosition() === 'start'\"\n>\n <p-checkbox\n #checkbox\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n (onChange)=\"onChange.emit($event)\"\n (onBlur)=\"onTouched()\"\n [disabled]=\"disabled() || readonly()\"\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\n [binary]=\"true\"\n [invalid]=\"isInvalid(ngControl?.control)\"\n class=\"leading-none\"\n ></p-checkbox>\n @if (label()) {\n <label\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n }\n</div>\n\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\n" }]
|
|
68
70
|
}], ctorParameters: () => [], propDecorators: { checkbox: [{
|
|
69
71
|
type: ViewChild,
|
|
70
72
|
args: ['checkbox', { static: true }]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"masterteam-components-checkbox-field.mjs","sources":["../../../../packages/masterteam/components/checkbox-field/checkbox-field.ts","../../../../packages/masterteam/components/checkbox-field/checkbox-field.html","../../../../packages/masterteam/components/checkbox-field/masterteam-components-checkbox-field.ts"],"sourcesContent":["import {\n Component,\n ViewChild,\n signal,\n input,\n effect,\n output,\n inject,\n ChangeDetectionStrategy,\n} from '@angular/core';\nimport {\n ControlValueAccessor,\n FormsModule,\n NgControl,\n Validators,\n} from '@angular/forms';\nimport {\n CheckboxModule,\n Checkbox,\n CheckboxChangeEvent,\n} from 'primeng/checkbox';\nimport { FieldValidation } from '@masterteam/components/field-validation';\nimport { isInvalid } from '@masterteam/components';\n\n@Component({\n selector: 'mt-checkbox-field',\n standalone: true,\n imports: [FormsModule, CheckboxModule, FieldValidation],\n templateUrl: './checkbox-field.html',\n styleUrls: ['./checkbox-field.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'grid gap-1',\n },\n})\nexport class CheckboxField implements ControlValueAccessor {\n @ViewChild('checkbox', { static: true })\n checkbox: Checkbox;\n\n label = input<string>();\n placeholder = input<string>();\n readonly = input<boolean>(false);\n pInputs = input<Partial<Checkbox>>();\n\n onChange = output<CheckboxChangeEvent>();\n\n public ngControl = inject(NgControl, { self: true });\n\n isInvalid = isInvalid;\n\n requiredValidator = Validators.required;\n value = signal<boolean | null>(null);\n disabled = signal<boolean>(false);\n\n onTouched: () => void = () => {};\n onModelChange: (value: boolean | null) => void = () => {};\n\n constructor() {\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n\n // Effect to apply pInputs reactively when the pInputs signal changes\n effect(() => {\n const currentPInputs = this.pInputs();\n // Ensure checkbox ViewChild is initialized and pInputs has a value\n // @ViewChild with static: true makes 'checkbox' available during construction/ngOnInit\n if (this.checkbox && currentPInputs) {\n this.applyInputsToCheckbox();\n }\n });\n }\n\n applyInputsToCheckbox() {\n const currentPInputs = this.pInputs();\n if (currentPInputs) {\n Object.assign(this.checkbox, currentPInputs);\n }\n }\n\n onValueChange(value: boolean | null) {\n this.onModelChange(value);\n this.value.set(value);\n }\n\n writeValue(value: boolean | null) {\n this.value.set(value);\n }\n\n registerOnChange(fn: any) {\n this.onModelChange = fn;\n }\n\n registerOnTouched(fn: any) {\n this.onTouched = fn;\n }\n\n setDisabledState(disabled: boolean) {\n this.disabled.set(disabled);\n }\n}\n","<div class=\"
|
|
1
|
+
{"version":3,"file":"masterteam-components-checkbox-field.mjs","sources":["../../../../packages/masterteam/components/checkbox-field/checkbox-field.ts","../../../../packages/masterteam/components/checkbox-field/checkbox-field.html","../../../../packages/masterteam/components/checkbox-field/masterteam-components-checkbox-field.ts"],"sourcesContent":["import {\n Component,\n ViewChild,\n signal,\n input,\n effect,\n output,\n inject,\n ChangeDetectionStrategy,\n computed,\n} from '@angular/core';\nimport {\n ControlValueAccessor,\n FormsModule,\n NgControl,\n Validators,\n} from '@angular/forms';\nimport {\n CheckboxModule,\n Checkbox,\n CheckboxChangeEvent,\n} from 'primeng/checkbox';\nimport { FieldValidation } from '@masterteam/components/field-validation';\nimport { isInvalid } from '@masterteam/components';\n\n@Component({\n selector: 'mt-checkbox-field',\n standalone: true,\n imports: [FormsModule, CheckboxModule, FieldValidation],\n templateUrl: './checkbox-field.html',\n styleUrls: ['./checkbox-field.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'grid gap-1',\n },\n})\nexport class CheckboxField implements ControlValueAccessor {\n @ViewChild('checkbox', { static: true })\n checkbox: Checkbox;\n\n label = input<string>();\n labelPosition = input<'top' | 'start' | 'end' | 'bottom'>('end');\n placeholder = input<string>();\n readonly = input<boolean>(false);\n pInputs = input<Partial<Checkbox>>();\n\n onChange = output<CheckboxChangeEvent>();\n\n public ngControl = inject(NgControl, { self: true });\n\n isInvalid = isInvalid;\n\n isVertical = computed(\n () => this.labelPosition() === 'top' || this.labelPosition() === 'bottom',\n );\n\n requiredValidator = Validators.required;\n value = signal<boolean | null>(null);\n disabled = signal<boolean>(false);\n\n onTouched: () => void = () => {};\n onModelChange: (value: boolean | null) => void = () => {};\n\n constructor() {\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n\n // Effect to apply pInputs reactively when the pInputs signal changes\n effect(() => {\n const currentPInputs = this.pInputs();\n // Ensure checkbox ViewChild is initialized and pInputs has a value\n // @ViewChild with static: true makes 'checkbox' available during construction/ngOnInit\n if (this.checkbox && currentPInputs) {\n this.applyInputsToCheckbox();\n }\n });\n }\n\n applyInputsToCheckbox() {\n const currentPInputs = this.pInputs();\n if (currentPInputs) {\n Object.assign(this.checkbox, currentPInputs);\n }\n }\n\n onValueChange(value: boolean | null) {\n this.onModelChange(value);\n this.value.set(value);\n }\n\n writeValue(value: boolean | null) {\n this.value.set(value);\n }\n\n registerOnChange(fn: any) {\n this.onModelChange = fn;\n }\n\n registerOnTouched(fn: any) {\n this.onTouched = fn;\n }\n\n setDisabledState(disabled: boolean) {\n this.disabled.set(disabled);\n }\n}\n","<div\n class=\"flex gap-1\"\n [class.items-center]=\"!isVertical()\"\n [class.gap-2]=\"!isVertical()\"\n [class.flex-col]=\"isVertical()\"\n [class.flex-col-reverse]=\"labelPosition() === 'top'\"\n [class.flex-row-reverse]=\"labelPosition() === 'start'\"\n [class.justify-end]=\"labelPosition() === 'start'\"\n>\n <p-checkbox\n #checkbox\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n (onChange)=\"onChange.emit($event)\"\n (onBlur)=\"onTouched()\"\n [disabled]=\"disabled() || readonly()\"\n [inputId]=\"ngControl?.name ? ngControl?.name?.toString() : label()\"\n [binary]=\"true\"\n [invalid]=\"isInvalid(ngControl?.control)\"\n class=\"leading-none\"\n ></p-checkbox>\n @if (label()) {\n <label\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\n [for]=\"ngControl?.name || label()\"\n >{{ label() }}</label\n >\n }\n</div>\n\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;MAoCa,aAAa,CAAA;AAExB,IAAA,QAAQ;IAER,KAAK,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,OAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAU;AACvB,IAAA,aAAa,GAAG,KAAK,CAAqC,KAAK,yDAAC;IAChE,WAAW,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,aAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAU;AAC7B,IAAA,QAAQ,GAAG,KAAK,CAAU,KAAK,oDAAC;IAChC,OAAO,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,SAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAqB;IAEpC,QAAQ,GAAG,MAAM,EAAuB;IAEjC,SAAS,GAAG,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAEpD,SAAS,GAAG,SAAS;IAErB,UAAU,GAAG,QAAQ,CACnB,MAAM,IAAI,CAAC,aAAa,EAAE,KAAK,KAAK,IAAI,IAAI,CAAC,aAAa,EAAE,KAAK,QAAQ,sDAC1E;AAED,IAAA,iBAAiB,GAAG,UAAU,CAAC,QAAQ;AACvC,IAAA,KAAK,GAAG,MAAM,CAAiB,IAAI,iDAAC;AACpC,IAAA,QAAQ,GAAG,MAAM,CAAU,KAAK,oDAAC;AAEjC,IAAA,SAAS,GAAe,MAAK,EAAE,CAAC;AAChC,IAAA,aAAa,GAAoC,MAAK,EAAE,CAAC;AAEzD,IAAA,WAAA,GAAA;AACE,QAAA,IAAI,IAAI,CAAC,SAAS,EAAE;AAClB,YAAA,IAAI,CAAC,SAAS,CAAC,aAAa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