@tekus/design-system 5.23.0 → 5.24.0
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/fesm2022/tekus-design-system-components-autocomplete.mjs +24 -17
- package/fesm2022/tekus-design-system-components-autocomplete.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-badge.mjs +3 -3
- package/fesm2022/tekus-design-system-components-badge.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-button.mjs +48 -31
- package/fesm2022/tekus-design-system-components-button.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-checkbox.mjs +13 -16
- package/fesm2022/tekus-design-system-components-checkbox.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-date-picker.mjs +21 -10
- package/fesm2022/tekus-design-system-components-date-picker.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-drawer.mjs +7 -7
- package/fesm2022/tekus-design-system-components-drawer.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-fallback-view.mjs +18 -38
- package/fesm2022/tekus-design-system-components-fallback-view.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-icon.mjs +11 -17
- package/fesm2022/tekus-design-system-components-icon.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-input-number.mjs +15 -14
- package/fesm2022/tekus-design-system-components-input-number.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-input-text.mjs +19 -21
- package/fesm2022/tekus-design-system-components-input-text.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-modal.mjs +9 -8
- package/fesm2022/tekus-design-system-components-modal.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-multiselect.mjs +3 -3
- package/fesm2022/tekus-design-system-components-multiselect.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-pagination.mjs +3 -3
- package/fesm2022/tekus-design-system-components-pagination.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-panel.mjs +21 -30
- package/fesm2022/tekus-design-system-components-panel.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-radio-button.mjs +14 -16
- package/fesm2022/tekus-design-system-components-radio-button.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-select.mjs +13 -11
- package/fesm2022/tekus-design-system-components-select.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-table.mjs +27 -23
- package/fesm2022/tekus-design-system-components-table.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-tabs.mjs +3 -3
- package/fesm2022/tekus-design-system-components-tabs.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-tag.mjs +3 -3
- package/fesm2022/tekus-design-system-components-tag.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-textarea.mjs +15 -14
- package/fesm2022/tekus-design-system-components-textarea.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-toolbar.mjs +3 -3
- package/fesm2022/tekus-design-system-components-toolbar.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-tooltip.mjs +3 -3
- package/fesm2022/tekus-design-system-components-tooltip.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-topbar.mjs +3 -3
- package/fesm2022/tekus-design-system-components-topbar.mjs.map +1 -1
- package/fesm2022/tekus-design-system-core-types.mjs +5 -0
- package/fesm2022/tekus-design-system-core-types.mjs.map +1 -1
- package/fesm2022/tekus-design-system-core.mjs +5 -0
- package/fesm2022/tekus-design-system-core.mjs.map +1 -1
- package/fesm2022/tekus-design-system-directives-gird-item.mjs +19 -24
- package/fesm2022/tekus-design-system-directives-gird-item.mjs.map +1 -1
- package/package.json +1 -1
- package/types/tekus-design-system-components-autocomplete.d.ts +10 -2
- package/types/tekus-design-system-components-button.d.ts +15 -19
- package/types/tekus-design-system-components-checkbox.d.ts +3 -8
- package/types/tekus-design-system-components-date-picker.d.ts +11 -3
- package/types/tekus-design-system-components-drawer.d.ts +3 -3
- package/types/tekus-design-system-components-fallback-view.d.ts +17 -18
- package/types/tekus-design-system-components-icon.d.ts +7 -16
- package/types/tekus-design-system-components-input-number.d.ts +3 -4
- package/types/tekus-design-system-components-input-text.d.ts +4 -10
- package/types/tekus-design-system-components-modal.d.ts +3 -3
- package/types/tekus-design-system-components-panel.d.ts +10 -18
- package/types/tekus-design-system-components-radio-button.d.ts +3 -7
- package/types/tekus-design-system-components-select.d.ts +14 -1
- package/types/tekus-design-system-components-table.d.ts +5 -5
- package/types/tekus-design-system-components-textarea.d.ts +3 -4
- package/types/tekus-design-system-directives-gird-item.d.ts +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, input, signal, model, output, effect, forwardRef,
|
|
2
|
+
import { inject, input, signal, model, output, effect, viewChild, forwardRef, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/forms';
|
|
4
4
|
import { NgControl, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
5
5
|
import * as i2 from 'primeng/floatlabel';
|
|
@@ -90,25 +90,34 @@ class AutocompleteComponent {
|
|
|
90
90
|
// -----------------------------------
|
|
91
91
|
this.onChangeFn = () => { };
|
|
92
92
|
this.onTouchedFn = () => { };
|
|
93
|
-
|
|
94
|
-
this.ngControl
|
|
95
|
-
|
|
93
|
+
this.init = (() => {
|
|
94
|
+
if (this.ngControl) {
|
|
95
|
+
this.ngControl.valueAccessor = this;
|
|
96
|
+
}
|
|
97
|
+
})();
|
|
96
98
|
/**
|
|
97
99
|
* disabled → internalDisabled
|
|
98
100
|
*/
|
|
99
|
-
effect(() => {
|
|
101
|
+
this.syncDisabled = effect(() => {
|
|
100
102
|
this.internalDisabled.set(this.disabled());
|
|
101
|
-
});
|
|
103
|
+
}, ...(ngDevMode ? [{ debugName: "syncDisabled" }] : /* istanbul ignore next */ []));
|
|
102
104
|
/**
|
|
103
105
|
* model → internal value + forms
|
|
104
106
|
*/
|
|
105
|
-
effect(() => {
|
|
107
|
+
this.syncModel = effect(() => {
|
|
106
108
|
const v = this.model();
|
|
107
109
|
if (v !== this.value) {
|
|
108
110
|
this.value = v ?? null;
|
|
109
111
|
this.onChangeFn(this.value);
|
|
110
112
|
}
|
|
111
|
-
});
|
|
113
|
+
}, ...(ngDevMode ? [{ debugName: "syncModel" }] : /* istanbul ignore next */ []));
|
|
114
|
+
/**
|
|
115
|
+
* @property {AutoComplete} autoComplete
|
|
116
|
+
* @description
|
|
117
|
+
* Reference to the underlying PrimeNG AutoComplete component.
|
|
118
|
+
* Used to access the native input element for chip creation on blur.
|
|
119
|
+
*/
|
|
120
|
+
this.autoComplete = viewChild(AutoComplete, ...(ngDevMode ? [{ debugName: "autoComplete" }] : /* istanbul ignore next */ []));
|
|
112
121
|
}
|
|
113
122
|
/**
|
|
114
123
|
* @method writeValue
|
|
@@ -171,14 +180,15 @@ class AutocompleteComponent {
|
|
|
171
180
|
* This ensures that typing text and clicking away behaves similarly to pressing "Enter".
|
|
172
181
|
*/
|
|
173
182
|
handleBlur() {
|
|
174
|
-
|
|
175
|
-
|
|
183
|
+
const ac = this.autoComplete();
|
|
184
|
+
if (ac?.inputEL) {
|
|
185
|
+
const inputValue = ac.inputEL.nativeElement.value;
|
|
176
186
|
if (inputValue && inputValue.trim() !== '') {
|
|
177
187
|
const newValue = inputValue.trim();
|
|
178
188
|
const currentValues = Array.isArray(this.value) ? [...this.value] : [];
|
|
179
189
|
currentValues.push(newValue);
|
|
180
190
|
this.handleChange(currentValues);
|
|
181
|
-
|
|
191
|
+
ac.inputEL.nativeElement.value = '';
|
|
182
192
|
}
|
|
183
193
|
}
|
|
184
194
|
}
|
|
@@ -199,21 +209,18 @@ class AutocompleteComponent {
|
|
|
199
209
|
useExisting: forwardRef(() => AutocompleteComponent),
|
|
200
210
|
multi: true,
|
|
201
211
|
},
|
|
202
|
-
], viewQueries: [{ propertyName: "autoComplete", first: true, predicate: AutoComplete, descendants: true }], ngImport: i0, template: "<p-floatlabel class=\"w-full\">\n <div class=\"tk-autocomplete-wrapper\">\n @if (icon()) {\n <tk-icon [icon]=\"icon()\" class=\"tk-autocomplete-icon\"></tk-icon>\n }\n <p-autocomplete [ngModel]=\"value\" (ngModelChange)=\"handleChange($event)\" [disabled]=\"disabled()\" [inputId]=\"id()\"\n [typeahead]=\"false\" multiple fluid (onBlur)=\"handleBlur()\"\n [class.ng-invalid]=\"effectiveControl?.invalid && (effectiveControl?.dirty || effectiveControl?.touched)\"\n [class.ng-dirty]=\"effectiveControl?.dirty\" [class.ng-touched]=\"effectiveControl?.touched\" />\n <label [for]=\"id()\">{{ label() }}</label>\n </div>\n</p-floatlabel>\n\n<div class=\"tk-autocomplete-bottom\">\n <div class=\"tk-autocomplete-messages\">\n @if ((effectiveControl?.invalid && (effectiveControl?.dirty || effectiveControl?.touched)) && errorMessage()) {\n <p-message severity=\"error\" size=\"small\" variant=\"simple\">{{ errorMessage() }}</p-message>\n } @else if (hint()) {\n <p-message severity=\"secondary\" size=\"small\" variant=\"simple\">{{ hint() }}</p-message>\n }\n </div>\n</div>", styles: [":host ::ng-deep .p-autocomplete-input-multiple{width:100%;border:none;border-bottom:1px solid var(--tk-color-border-default, #cecdcd);border-radius:0;background-color:transparent}:host ::ng-deep .p-autocomplete-input-multiple:focus{border-color:var(--tk-color-base-primary-600, #140065)}:host ::ng-deep p-autocomplete{flex:1;width:100%}:host ::ng-deep .tk-autocomplete-wrapper:has(.tk-autocomplete-icon) .p-autocomplete-input-multiple{padding-left:var(--tk-spacing-base-200, 2rem)}:host ::ng-deep p-autocomplete.ng-invalid.ng-dirty .p-autocomplete-input-multiple,:host ::ng-deep p-autocomplete.ng-invalid.ng-touched .p-autocomplete-input-multiple{border-color:var(--tk-color-base-red-700, #cf2604)}:host ::ng-deep .p-floatlabel:has(.p-inputwrapper-filled) label,:host ::ng-deep .p-floatlabel:has(input:focus) label{color:var(--tk-primary-500, #16006f)}:host ::ng-deep .p-floatlabel label{color:var(--tk-color-base-surface-500, #8a8a8b);font-family:var(--tk-font-family, Poppins, sans-serif);font-size:var(--tk-font-size-2xs, 1rem);font-weight:var(--tk-font-weight-400, 400);left:var(--tk-spacing-base-25, .25rem)}:host ::ng-deep .p-floatlabel .tk-autocomplete-wrapper:has(.tk-autocomplete-icon) label{left:var(--tk-spacing-base-200, 2rem)}:host ::ng-deep .p-floatlabel:has(p-autocomplete.ng-invalid.ng-dirty) label,:host ::ng-deep .p-floatlabel:has(p-autocomplete.ng-invalid.ng-touched) label{color:var(--tk-color-base-red-700, #cf2604)!important}:host ::ng-deep .p-autocomplete-chip-icon{display:flex;color:var(--tk-surface-700, #424243)}:host ::ng-deep .p-autocomplete-chip{border-radius:var(--tk-borderRadius-full, 999px)!important;color:var(--tk-surface-700, #424243)}:host ::ng-deep .p-chip-label{display:inline-block;max-width:10ch;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host ::ng-deep .p-autocomplete-input-multiple-label{gap:.313rem;padding:var(--tk-spacing-base-75, 12px) var(--tk-spacing-base-75, 12px) var(--tk-spacing-base-75, 12px) var(--tk-spacing-base-25, 4px)!important}:host ::ng-deep p-message[severity=error] .p-inline-message-text,:host ::ng-deep p-message[severity=error] span{color:var(--tk-color-base-red-700, #cf2604)}:host ::ng-deep p-message[severity=secondary] .p-inline-message-text,:host ::ng-deep p-message[severity=secondary] span{color:var(--tk-color-base-surface-600, #5d5d5e)}:host ::ng-deep .tk-autocomplete-bottom{display:flex;justify-content:space-between;align-items:flex-start;margin-top:var(--tk-spacing-base-25, .25rem);min-height:var(--tk-spacing-base-125, 1.25rem)}:host ::ng-deep .tk-autocomplete-messages{flex:1;margin-right:var(--tk-spacing-base-100, 1rem)}:host ::ng-deep .tk-autocomplete-wrapper{position:relative;display:flex;align-items:center;width:100%}:host ::ng-deep .tk-autocomplete-icon{position:absolute;left:0;top:50%;transform:translateY(-50%)}\n"], 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: "component", type: AutoComplete, selector: "p-autoComplete, p-autocomplete, p-auto-complete", inputs: ["minLength", "minQueryLength", "delay", "panelStyle", "styleClass", "panelStyleClass", "inputStyle", "inputId", "inputStyleClass", "placeholder", "readonly", "scrollHeight", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "autoHighlight", "forceSelection", "type", "autoZIndex", "baseZIndex", "ariaLabel", "dropdownAriaLabel", "ariaLabelledBy", "dropdownIcon", "unique", "group", "completeOnFocus", "showClear", "dropdown", "showEmptyMessage", "dropdownMode", "multiple", "addOnTab", "tabindex", "dataKey", "emptyMessage", "showTransitionOptions", "hideTransitionOptions", "autofocus", "autocomplete", "optionGroupChildren", "optionGroupLabel", "overlayOptions", "suggestions", "optionLabel", "optionValue", "id", "searchMessage", "emptySelectionMessage", "selectionMessage", "autoOptionFocus", "selectOnFocus", "searchLocale", "optionDisabled", "focusOnHover", "typeahead", "addOnBlur", "separator", "appendTo", "motionOptions"], outputs: ["completeMethod", "onSelect", "onUnselect", "onAdd", "onFocus", "onBlur", "onDropdownClick", "onClear", "onInputKeydown", "onKeyUp", "onShow", "onHide", "onLazyLoad"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i2.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i3.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }, { kind: "component", type: IconComponent, selector: "tk-icon", inputs: ["icon", "styleIcon", "color", "size", "disabled"],
|
|
212
|
+
], viewQueries: [{ propertyName: "autoComplete", first: true, predicate: AutoComplete, descendants: true, isSignal: true }], ngImport: i0, template: "<p-floatlabel class=\"w-full\">\n <div class=\"tk-autocomplete-wrapper\">\n @if (icon()) {\n <tk-icon [icon]=\"icon()\" class=\"tk-autocomplete-icon\"></tk-icon>\n }\n <p-autocomplete [ngModel]=\"value\" (ngModelChange)=\"handleChange($event)\" [disabled]=\"disabled()\" [inputId]=\"id()\"\n [typeahead]=\"false\" multiple fluid (onBlur)=\"handleBlur()\"\n [class.ng-invalid]=\"effectiveControl?.invalid && (effectiveControl?.dirty || effectiveControl?.touched)\"\n [class.ng-dirty]=\"effectiveControl?.dirty\" [class.ng-touched]=\"effectiveControl?.touched\" />\n <label [for]=\"id()\">{{ label() }}</label>\n </div>\n</p-floatlabel>\n\n<div class=\"tk-autocomplete-bottom\">\n <div class=\"tk-autocomplete-messages\">\n @if ((effectiveControl?.invalid && (effectiveControl?.dirty || effectiveControl?.touched)) && errorMessage()) {\n <p-message severity=\"error\" size=\"small\" variant=\"simple\">{{ errorMessage() }}</p-message>\n } @else if (hint()) {\n <p-message severity=\"secondary\" size=\"small\" variant=\"simple\">{{ hint() }}</p-message>\n }\n </div>\n</div>", styles: [":host ::ng-deep .p-autocomplete-input-multiple{width:100%;border:none;border-bottom:1px solid var(--tk-color-border-default, #cecdcd);border-radius:0;background-color:transparent}:host ::ng-deep .p-autocomplete-input-multiple:focus{border-color:var(--tk-color-base-primary-600, #140065)}:host ::ng-deep p-autocomplete{flex:1;width:100%}:host ::ng-deep .tk-autocomplete-wrapper:has(.tk-autocomplete-icon) .p-autocomplete-input-multiple{padding-left:var(--tk-spacing-base-200, 2rem)}:host ::ng-deep p-autocomplete.ng-invalid.ng-dirty .p-autocomplete-input-multiple,:host ::ng-deep p-autocomplete.ng-invalid.ng-touched .p-autocomplete-input-multiple{border-color:var(--tk-color-base-red-700, #cf2604)}:host ::ng-deep .p-floatlabel:has(.p-inputwrapper-filled) label,:host ::ng-deep .p-floatlabel:has(input:focus) label{color:var(--tk-primary-500, #16006f)}:host ::ng-deep .p-floatlabel label{color:var(--tk-color-base-surface-500, #8a8a8b);font-family:var(--tk-font-family, Poppins, sans-serif);font-size:var(--tk-font-size-2xs, 1rem);font-weight:var(--tk-font-weight-400, 400);left:var(--tk-spacing-base-25, .25rem)}:host ::ng-deep .p-floatlabel .tk-autocomplete-wrapper:has(.tk-autocomplete-icon) label{left:var(--tk-spacing-base-200, 2rem)}:host ::ng-deep .p-floatlabel:has(p-autocomplete.ng-invalid.ng-dirty) label,:host ::ng-deep .p-floatlabel:has(p-autocomplete.ng-invalid.ng-touched) label{color:var(--tk-color-base-red-700, #cf2604)!important}:host ::ng-deep .p-autocomplete-chip-icon{display:flex;color:var(--tk-surface-700, #424243)}:host ::ng-deep .p-autocomplete-chip{border-radius:var(--tk-borderRadius-full, 999px)!important;color:var(--tk-surface-700, #424243)}:host ::ng-deep .p-chip-label{display:inline-block;max-width:10ch;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host ::ng-deep .p-autocomplete-input-multiple-label{gap:.313rem;padding:var(--tk-spacing-base-75, 12px) var(--tk-spacing-base-75, 12px) var(--tk-spacing-base-75, 12px) var(--tk-spacing-base-25, 4px)!important}:host ::ng-deep p-message[severity=error] .p-inline-message-text,:host ::ng-deep p-message[severity=error] span{color:var(--tk-color-base-red-700, #cf2604)}:host ::ng-deep p-message[severity=secondary] .p-inline-message-text,:host ::ng-deep p-message[severity=secondary] span{color:var(--tk-color-base-surface-600, #5d5d5e)}:host ::ng-deep .tk-autocomplete-bottom{display:flex;justify-content:space-between;align-items:flex-start;margin-top:var(--tk-spacing-base-25, .25rem);min-height:var(--tk-spacing-base-125, 1.25rem)}:host ::ng-deep .tk-autocomplete-messages{flex:1;margin-right:var(--tk-spacing-base-100, 1rem)}:host ::ng-deep .tk-autocomplete-wrapper{position:relative;display:flex;align-items:center;width:100%}:host ::ng-deep .tk-autocomplete-icon{position:absolute;left:0;top:50%;transform:translateY(-50%)}\n"], 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: "component", type: AutoComplete, selector: "p-autoComplete, p-autocomplete, p-auto-complete", inputs: ["minLength", "minQueryLength", "delay", "panelStyle", "styleClass", "panelStyleClass", "inputStyle", "inputId", "inputStyleClass", "placeholder", "readonly", "scrollHeight", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "autoHighlight", "forceSelection", "type", "autoZIndex", "baseZIndex", "ariaLabel", "dropdownAriaLabel", "ariaLabelledBy", "dropdownIcon", "unique", "group", "completeOnFocus", "showClear", "dropdown", "showEmptyMessage", "dropdownMode", "multiple", "addOnTab", "tabindex", "dataKey", "emptyMessage", "showTransitionOptions", "hideTransitionOptions", "autofocus", "autocomplete", "optionGroupChildren", "optionGroupLabel", "overlayOptions", "suggestions", "optionLabel", "optionValue", "id", "searchMessage", "emptySelectionMessage", "selectionMessage", "autoOptionFocus", "selectOnFocus", "searchLocale", "optionDisabled", "focusOnHover", "typeahead", "addOnBlur", "separator", "appendTo", "motionOptions"], outputs: ["completeMethod", "onSelect", "onUnselect", "onAdd", "onFocus", "onBlur", "onDropdownClick", "onClear", "onInputKeydown", "onKeyUp", "onShow", "onHide", "onLazyLoad"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i2.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i3.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }, { kind: "component", type: IconComponent, selector: "tk-icon", inputs: ["icon", "styleIcon", "color", "size", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
203
213
|
}
|
|
204
214
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.3", ngImport: i0, type: AutocompleteComponent, decorators: [{
|
|
205
215
|
type: Component,
|
|
206
|
-
args: [{ selector: 'tk-autocomplete',
|
|
216
|
+
args: [{ selector: 'tk-autocomplete', imports: [FormsModule, AutoComplete, FloatLabelModule, MessageModule, IconComponent], changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
207
217
|
{
|
|
208
218
|
provide: NG_VALUE_ACCESSOR,
|
|
209
219
|
useExisting: forwardRef(() => AutocompleteComponent),
|
|
210
220
|
multi: true,
|
|
211
221
|
},
|
|
212
222
|
], template: "<p-floatlabel class=\"w-full\">\n <div class=\"tk-autocomplete-wrapper\">\n @if (icon()) {\n <tk-icon [icon]=\"icon()\" class=\"tk-autocomplete-icon\"></tk-icon>\n }\n <p-autocomplete [ngModel]=\"value\" (ngModelChange)=\"handleChange($event)\" [disabled]=\"disabled()\" [inputId]=\"id()\"\n [typeahead]=\"false\" multiple fluid (onBlur)=\"handleBlur()\"\n [class.ng-invalid]=\"effectiveControl?.invalid && (effectiveControl?.dirty || effectiveControl?.touched)\"\n [class.ng-dirty]=\"effectiveControl?.dirty\" [class.ng-touched]=\"effectiveControl?.touched\" />\n <label [for]=\"id()\">{{ label() }}</label>\n </div>\n</p-floatlabel>\n\n<div class=\"tk-autocomplete-bottom\">\n <div class=\"tk-autocomplete-messages\">\n @if ((effectiveControl?.invalid && (effectiveControl?.dirty || effectiveControl?.touched)) && errorMessage()) {\n <p-message severity=\"error\" size=\"small\" variant=\"simple\">{{ errorMessage() }}</p-message>\n } @else if (hint()) {\n <p-message severity=\"secondary\" size=\"small\" variant=\"simple\">{{ hint() }}</p-message>\n }\n </div>\n</div>", styles: [":host ::ng-deep .p-autocomplete-input-multiple{width:100%;border:none;border-bottom:1px solid var(--tk-color-border-default, #cecdcd);border-radius:0;background-color:transparent}:host ::ng-deep .p-autocomplete-input-multiple:focus{border-color:var(--tk-color-base-primary-600, #140065)}:host ::ng-deep p-autocomplete{flex:1;width:100%}:host ::ng-deep .tk-autocomplete-wrapper:has(.tk-autocomplete-icon) .p-autocomplete-input-multiple{padding-left:var(--tk-spacing-base-200, 2rem)}:host ::ng-deep p-autocomplete.ng-invalid.ng-dirty .p-autocomplete-input-multiple,:host ::ng-deep p-autocomplete.ng-invalid.ng-touched .p-autocomplete-input-multiple{border-color:var(--tk-color-base-red-700, #cf2604)}:host ::ng-deep .p-floatlabel:has(.p-inputwrapper-filled) label,:host ::ng-deep .p-floatlabel:has(input:focus) label{color:var(--tk-primary-500, #16006f)}:host ::ng-deep .p-floatlabel label{color:var(--tk-color-base-surface-500, #8a8a8b);font-family:var(--tk-font-family, Poppins, sans-serif);font-size:var(--tk-font-size-2xs, 1rem);font-weight:var(--tk-font-weight-400, 400);left:var(--tk-spacing-base-25, .25rem)}:host ::ng-deep .p-floatlabel .tk-autocomplete-wrapper:has(.tk-autocomplete-icon) label{left:var(--tk-spacing-base-200, 2rem)}:host ::ng-deep .p-floatlabel:has(p-autocomplete.ng-invalid.ng-dirty) label,:host ::ng-deep .p-floatlabel:has(p-autocomplete.ng-invalid.ng-touched) label{color:var(--tk-color-base-red-700, #cf2604)!important}:host ::ng-deep .p-autocomplete-chip-icon{display:flex;color:var(--tk-surface-700, #424243)}:host ::ng-deep .p-autocomplete-chip{border-radius:var(--tk-borderRadius-full, 999px)!important;color:var(--tk-surface-700, #424243)}:host ::ng-deep .p-chip-label{display:inline-block;max-width:10ch;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host ::ng-deep .p-autocomplete-input-multiple-label{gap:.313rem;padding:var(--tk-spacing-base-75, 12px) var(--tk-spacing-base-75, 12px) var(--tk-spacing-base-75, 12px) var(--tk-spacing-base-25, 4px)!important}:host ::ng-deep p-message[severity=error] .p-inline-message-text,:host ::ng-deep p-message[severity=error] span{color:var(--tk-color-base-red-700, #cf2604)}:host ::ng-deep p-message[severity=secondary] .p-inline-message-text,:host ::ng-deep p-message[severity=secondary] span{color:var(--tk-color-base-surface-600, #5d5d5e)}:host ::ng-deep .tk-autocomplete-bottom{display:flex;justify-content:space-between;align-items:flex-start;margin-top:var(--tk-spacing-base-25, .25rem);min-height:var(--tk-spacing-base-125, 1.25rem)}:host ::ng-deep .tk-autocomplete-messages{flex:1;margin-right:var(--tk-spacing-base-100, 1rem)}:host ::ng-deep .tk-autocomplete-wrapper{position:relative;display:flex;align-items:center;width:100%}:host ::ng-deep .tk-autocomplete-icon{position:absolute;left:0;top:50%;transform:translateY(-50%)}\n"] }]
|
|
213
|
-
}],
|
|
214
|
-
type: ViewChild,
|
|
215
|
-
args: [AutoComplete]
|
|
216
|
-
}] } });
|
|
223
|
+
}], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], control: [{ type: i0.Input, args: [{ isSignal: true, alias: "control", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], errorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessage", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], model: [{ type: i0.Input, args: [{ isSignal: true, alias: "model", required: false }] }, { type: i0.Output, args: ["modelChange"] }], modelChange: [{ type: i0.Output, args: ["modelChange"] }], autoComplete: [{ type: i0.ViewChild, args: [i0.forwardRef(() => AutoComplete), { isSignal: true }] }] } });
|
|
217
224
|
|
|
218
225
|
/**
|
|
219
226
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tekus-design-system-components-autocomplete.mjs","sources":["../../../projects/design-system/components/autocomplete/src/autocomplete.component.ts","../../../projects/design-system/components/autocomplete/src/autocomplete.component.html","../../../projects/design-system/components/autocomplete/tekus-design-system-components-autocomplete.ts"],"sourcesContent":["import {\n Component,\n effect,\n model,\n forwardRef,\n input,\n output,\n signal,\n inject,\n ViewChild,\n} from '@angular/core';\nimport {\n ControlValueAccessor,\n NG_VALUE_ACCESSOR,\n FormsModule, \n NgControl, \n FormControl \n} from '@angular/forms';\nimport { FloatLabelModule } from 'primeng/floatlabel';\nimport { AutoComplete } from 'primeng/autocomplete';\nimport { MessageModule } from 'primeng/message';\nimport { IconComponent } from '@tekus/design-system/components/icon';\ntype AutocompleteValue<T = unknown> = T | T[] | null;\n\n@Component({\n selector: 'tk-autocomplete',\n standalone: true,\n imports: [FormsModule, AutoComplete, FloatLabelModule, MessageModule, IconComponent],\n templateUrl: './autocomplete.component.html',\n styleUrl: './autocomplete.component.scss',\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => AutocompleteComponent),\n multi: true,\n },\n ],\n})\nexport class AutocompleteComponent<T = unknown>\n implements ControlValueAccessor\n{\n readonly ngControl = inject(NgControl, { self: true, optional: true });\n /**\n * @property {string} id\n * @description\n * HTML id attribute for the autocomplete input.\n *\n * @default 'autocomplete'\n */\n id = input<string>('autocomplete');\n\n /**\n * @property {InputSignal<string>} icon\n * @description\n * Icon to display next to the input (e.g., 'magnifying-glass').\n */\n icon = input<string>('');\n\n /**\n * @property {InputSignal<FormControl>} control\n * @description\n * External FormControl used to read/set the input value.\n * If not provided, an internal FormControl is created.\n */\n control = input<FormControl>();\n\n /**\n * @property {string} label\n * @description\n * Floating label displayed above the autocomplete input.\n */\n label = input<string>('');\n\n /**\n * @property {boolean} disabled\n * @description\n * Determines whether the autocomplete field is disabled.\n *\n * @default false\n */\n disabled = input<boolean>(false);\n\n /**\n * @property {InputSignal<string>} errorMessage\n * @description\n * Message to display when the control is invalid and touched.\n */\n errorMessage = input<string>('');\n\n /**\n * @property {InputSignal<string>} hint\n * @description\n * Hint text to display below the input.\n */\n hint = input<string>('');\n\n /**\n * @property {AutocompleteValue<T>} value\n * @description\n * Internal selected value. Synced with Angular forms and the model signal.\n *\n * @internal\n */\n value: AutocompleteValue<T> = null;\n\n internalDisabled = signal(false);\n\n /**\n * @property {Signal<AutocompleteValue<T>>} model\n * @description\n * Two-way binding model using Angular signals.\n * Allows usage with the syntax: `[(model)]=\"myValue\"`.\n */\n model = model<AutocompleteValue<T>>();\n\n /**\n * @event modelChange\n * @description\n * Emits whenever the value changes.\n * Payload: the selected item(s) of type `AutocompleteValue<T>`.\n *\n * @example\n * <tk-autocomplete (modelChange)=\"onChange($event)\"></tk-autocomplete>\n */\n modelChange = output<AutocompleteValue<T>>();\n\n // -----------------------------------\n // CVA CALLBACKS\n // -----------------------------------\n\n private onChangeFn: (value: AutocompleteValue<T>) => void = () => {};\n private onTouchedFn = () => {};\n\n constructor() {\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n /**\n * disabled → internalDisabled\n */\n effect(() => {\n this.internalDisabled.set(this.disabled());\n });\n\n /**\n * model → internal value + forms\n */\n effect(() => {\n const v = this.model();\n if (v !== this.value) {\n this.value = v ?? null;\n this.onChangeFn(this.value);\n }\n });\n }\n\n /**\n * @method writeValue\n * @description\n * Receives value updates from Angular Forms and writes them into the component.\n *\n * @param {AutocompleteValue<T>} value - New value from the forms API.\n */\n writeValue(value: AutocompleteValue<T>): void {\n this.model.set(value);\n }\n\n /**\n * @method registerOnChange\n * @description\n * Registers a callback that is invoked when the component's value changes.\n */\n registerOnChange(fn: (value: AutocompleteValue<T>) => void): void {\n this.onChangeFn = fn;\n }\n\n /**\n * @method registerOnTouched\n * @description\n * Registers a callback invoked when the component is touched.\n */\n registerOnTouched(fn: () => void): void {\n this.onTouchedFn = fn;\n }\n\n /**\n * @method setDisabledState\n * @description\n * Updates the disabled state of the autocomplete control.\n *\n * @param {boolean} isDisabled - Whether the component should be disabled.\n */\n setDisabledState(isDisabled: boolean): void {\n this.internalDisabled.set(isDisabled);\n }\n\n /**\n * @method handleChange\n * @description\n * Handles value changes from the autocomplete component.\n * Updates Angular Forms, Signals, and emits the modelChange event.\n *\n * @param {AutocompleteValue<T>} value - The new selected value(s).\n */\n handleChange(value: AutocompleteValue<T>) {\n this.value = value;\n this.onChangeFn(value);\n this.onTouchedFn();\n this.model.set(value);\n this.modelChange.emit(value);\n this.effectiveControl?.setValue(value);\n this.effectiveControl?.markAsDirty();\n }\n\n /**\n * @property {AutoComplete} autoComplete\n * @description\n * Reference to the underlying PrimeNG AutoComplete component.\n * Used to access the native input element for chip creation on blur.\n */\n @ViewChild(AutoComplete) autoComplete!: AutoComplete;\n\n /**\n * @method handleBlur\n * @description\n * Handles the blur event of the autocomplete input.\n * Captures any pending text in the input field and converts it into a chip/value.\n * This ensures that typing text and clicking away behaves similarly to pressing \"Enter\".\n */\n handleBlur() {\n if (this.autoComplete?.inputEL) {\n const inputValue = this.autoComplete.inputEL.nativeElement.value;\n if (inputValue && inputValue.trim() !== '') {\n const newValue = inputValue.trim();\n const currentValues = Array.isArray(this.value) ? [...this.value] : [];\n currentValues.push(newValue);\n \n this.handleChange(currentValues as unknown as AutocompleteValue<T>);\n\n this.autoComplete.inputEL.nativeElement.value = '';\n }\n }\n }\n\n /**\n * @method effectiveControl\n * @description\n * Gets the active FormControl for the component.\n * Returns the injected NgControl's control if available, otherwise falls back to the local `control` input.\n * This getter is crucial for unifying validation status checks in the template.\n */\n get effectiveControl(): FormControl | undefined {\n return (this.ngControl?.control as FormControl) || this.control();\n }\n}\n","<p-floatlabel class=\"w-full\">\n <div class=\"tk-autocomplete-wrapper\">\n @if (icon()) {\n <tk-icon [icon]=\"icon()\" class=\"tk-autocomplete-icon\"></tk-icon>\n }\n <p-autocomplete [ngModel]=\"value\" (ngModelChange)=\"handleChange($event)\" [disabled]=\"disabled()\" [inputId]=\"id()\"\n [typeahead]=\"false\" multiple fluid (onBlur)=\"handleBlur()\"\n [class.ng-invalid]=\"effectiveControl?.invalid && (effectiveControl?.dirty || effectiveControl?.touched)\"\n [class.ng-dirty]=\"effectiveControl?.dirty\" [class.ng-touched]=\"effectiveControl?.touched\" />\n <label [for]=\"id()\">{{ label() }}</label>\n </div>\n</p-floatlabel>\n\n<div class=\"tk-autocomplete-bottom\">\n <div class=\"tk-autocomplete-messages\">\n @if ((effectiveControl?.invalid && (effectiveControl?.dirty || effectiveControl?.touched)) && errorMessage()) {\n <p-message severity=\"error\" size=\"small\" variant=\"simple\">{{ errorMessage() }}</p-message>\n } @else if (hint()) {\n <p-message severity=\"secondary\" size=\"small\" variant=\"simple\">{{ hint() }}</p-message>\n }\n </div>\n</div>","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;MAsCa,qBAAqB,CAAA;AA+FhC,IAAA,WAAA,GAAA;AA5FS,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AACtE;;;;;;AAMG;AACH,QAAA,IAAA,CAAA,EAAE,GAAG,KAAK,CAAS,cAAc,yEAAC;AAElC;;;;AAIG;AACH,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAS,EAAE,2EAAC;AAExB;;;;;AAKG;QACH,IAAA,CAAA,OAAO,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,SAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAe;AAE9B;;;;AAIG;AACH,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAS,EAAE,4EAAC;AAEzB;;;;;;AAMG;AACH,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAU,KAAK,+EAAC;AAE/B;;;;AAIE;AACH,QAAA,IAAA,CAAA,YAAY,GAAG,KAAK,CAAS,EAAE,mFAAC;AAEhC;;;;AAIG;AACH,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAS,EAAE,2EAAC;AAExB;;;;;;AAMG;QACH,IAAA,CAAA,KAAK,GAAyB,IAAI;AAElC,QAAA,IAAA,CAAA,gBAAgB,GAAG,MAAM,CAAC,KAAK,uFAAC;AAEhC;;;;;AAKG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A,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,OAAA,EAAA,QAAA,EAAA,WAAA,EAAA,MAAA,EAAA,CAAA,UAAA,EAAA,MAAA,EAAA,QAAA,EAAA,OAAA,EAAA,YAAA,EAAA,UAAA,EAAA,MAAA,EAAA,WAAA,EAAA,MAAA,EAAA,uBAAA,EAAA,uBAAA,EAAA,MAAA,EAAA,SAAA,EAAA,eAAA,CAAA,EAAA,OAAA,EAAA,CAAA,SAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,aAAa,EAAA,QAAA,EAAA,SAAA,EAAA,MAAA,EAAA,CAAA,MAAA,EAAA,WAAA,EAAA,OAAA,EAAA,MAAA,EAAA,UAAA,CAAA,EAAA,OAAA,EAAA,CAAA,YAAA,EAAA,iBAAA,EAAA,aAAA,EAAA,YAAA,EAAA,gBAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA;;2FAWxE,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAdjC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,iBAAiB,EAAA,UAAA,EACf,IAAI,EAAA,OAAA,EACP,CAAC,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,aAAa,CAAC,EAAA,SAAA,EAGzE;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,2BAA2B,CAAC;AACpD,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;AACF,qBAAA,EAAA,QAAA,EAAA,mmCAAA,EAAA,MAAA,EAAA,CAAA,2wFAAA,CAAA,EAAA;;sBAwLA,SAAS;uBAAC,YAAY;;;AE5NzB;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"tekus-design-system-components-autocomplete.mjs","sources":["../../../projects/design-system/components/autocomplete/src/autocomplete.component.ts","../../../projects/design-system/components/autocomplete/src/autocomplete.component.html","../../../projects/design-system/components/autocomplete/tekus-design-system-components-autocomplete.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n effect,\n model,\n forwardRef,\n input,\n output,\n signal,\n inject,\n viewChild,\n} from '@angular/core';\nimport {\n ControlValueAccessor,\n NG_VALUE_ACCESSOR,\n FormsModule, \n NgControl, \n FormControl \n} from '@angular/forms';\nimport { FloatLabelModule } from 'primeng/floatlabel';\nimport { AutoComplete } from 'primeng/autocomplete';\nimport { MessageModule } from 'primeng/message';\nimport { IconComponent } from '@tekus/design-system/components/icon';\ntype AutocompleteValue<T = unknown> = T | T[] | null;\n\n@Component({\n selector: 'tk-autocomplete',\n imports: [FormsModule, AutoComplete, FloatLabelModule, MessageModule, IconComponent],\n templateUrl: './autocomplete.component.html',\n styleUrl: './autocomplete.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => AutocompleteComponent),\n multi: true,\n },\n ],\n})\nexport class AutocompleteComponent<T = unknown>\n implements ControlValueAccessor\n{\n readonly ngControl = inject(NgControl, { self: true, optional: true });\n /**\n * @property {string} id\n * @description\n * HTML id attribute for the autocomplete input.\n *\n * @default 'autocomplete'\n */\n id = input<string>('autocomplete');\n\n /**\n * @property {InputSignal<string>} icon\n * @description\n * Icon to display next to the input (e.g., 'magnifying-glass').\n */\n icon = input<string>('');\n\n /**\n * @property {InputSignal<FormControl>} control\n * @description\n * External FormControl used to read/set the input value.\n * If not provided, an internal FormControl is created.\n */\n control = input<FormControl>();\n\n /**\n * @property {string} label\n * @description\n * Floating label displayed above the autocomplete input.\n */\n label = input<string>('');\n\n /**\n * @property {boolean} disabled\n * @description\n * Determines whether the autocomplete field is disabled.\n *\n * @default false\n */\n disabled = input<boolean>(false);\n\n /**\n * @property {InputSignal<string>} errorMessage\n * @description\n * Message to display when the control is invalid and touched.\n */\n errorMessage = input<string>('');\n\n /**\n * @property {InputSignal<string>} hint\n * @description\n * Hint text to display below the input.\n */\n hint = input<string>('');\n\n /**\n * @property {AutocompleteValue<T>} value\n * @description\n * Internal selected value. Synced with Angular forms and the model signal.\n *\n * @internal\n */\n value: AutocompleteValue<T> = null;\n\n internalDisabled = signal(false);\n\n /**\n * @property {Signal<AutocompleteValue<T>>} model\n * @description\n * Two-way binding model using Angular signals.\n * Allows usage with the syntax: `[(model)]=\"myValue\"`.\n */\n model = model<AutocompleteValue<T>>();\n\n /**\n * @event modelChange\n * @description\n * Emits whenever the value changes.\n * Payload: the selected item(s) of type `AutocompleteValue<T>`.\n *\n * @example\n * <tk-autocomplete (modelChange)=\"onChange($event)\"></tk-autocomplete>\n */\n modelChange = output<AutocompleteValue<T>>();\n\n // -----------------------------------\n // CVA CALLBACKS\n // -----------------------------------\n\n private onChangeFn: (value: AutocompleteValue<T>) => void = () => {};\n private onTouchedFn = () => {};\n\n private readonly init = (() => {\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n })();\n\n /**\n * disabled → internalDisabled\n */\n private readonly syncDisabled = effect(() => {\n this.internalDisabled.set(this.disabled());\n });\n\n /**\n * model → internal value + forms\n */\n private readonly syncModel = effect(() => {\n const v = this.model();\n if (v !== this.value) {\n this.value = v ?? null;\n this.onChangeFn(this.value);\n }\n });\n\n /**\n * @method writeValue\n * @description\n * Receives value updates from Angular Forms and writes them into the component.\n *\n * @param {AutocompleteValue<T>} value - New value from the forms API.\n */\n writeValue(value: AutocompleteValue<T>): void {\n this.model.set(value);\n }\n\n /**\n * @method registerOnChange\n * @description\n * Registers a callback that is invoked when the component's value changes.\n */\n registerOnChange(fn: (value: AutocompleteValue<T>) => void): void {\n this.onChangeFn = fn;\n }\n\n /**\n * @method registerOnTouched\n * @description\n * Registers a callback invoked when the component is touched.\n */\n registerOnTouched(fn: () => void): void {\n this.onTouchedFn = fn;\n }\n\n /**\n * @method setDisabledState\n * @description\n * Updates the disabled state of the autocomplete control.\n *\n * @param {boolean} isDisabled - Whether the component should be disabled.\n */\n setDisabledState(isDisabled: boolean): void {\n this.internalDisabled.set(isDisabled);\n }\n\n /**\n * @method handleChange\n * @description\n * Handles value changes from the autocomplete component.\n * Updates Angular Forms, Signals, and emits the modelChange event.\n *\n * @param {AutocompleteValue<T>} value - The new selected value(s).\n */\n handleChange(value: AutocompleteValue<T>) {\n this.value = value;\n this.onChangeFn(value);\n this.onTouchedFn();\n this.model.set(value);\n this.modelChange.emit(value);\n this.effectiveControl?.setValue(value);\n this.effectiveControl?.markAsDirty();\n }\n\n /**\n * @property {AutoComplete} autoComplete\n * @description\n * Reference to the underlying PrimeNG AutoComplete component.\n * Used to access the native input element for chip creation on blur.\n */\n autoComplete = viewChild<AutoComplete>(AutoComplete);\n\n /**\n * @method handleBlur\n * @description\n * Handles the blur event of the autocomplete input.\n * Captures any pending text in the input field and converts it into a chip/value.\n * This ensures that typing text and clicking away behaves similarly to pressing \"Enter\".\n */\n handleBlur() {\n const ac = this.autoComplete();\n if (ac?.inputEL) {\n const inputValue = ac.inputEL.nativeElement.value;\n if (inputValue && inputValue.trim() !== '') {\n const newValue = inputValue.trim();\n const currentValues = Array.isArray(this.value) ? [...this.value] : [];\n currentValues.push(newValue);\n\n this.handleChange(currentValues as unknown as AutocompleteValue<T>);\n\n ac.inputEL.nativeElement.value = '';\n }\n }\n }\n\n /**\n * @method effectiveControl\n * @description\n * Gets the active FormControl for the component.\n * Returns the injected NgControl's control if available, otherwise falls back to the local `control` input.\n * This getter is crucial for unifying validation status checks in the template.\n */\n get effectiveControl(): FormControl | undefined {\n return (this.ngControl?.control as FormControl) || this.control();\n }\n}\n","<p-floatlabel class=\"w-full\">\n <div class=\"tk-autocomplete-wrapper\">\n @if (icon()) {\n <tk-icon [icon]=\"icon()\" class=\"tk-autocomplete-icon\"></tk-icon>\n }\n <p-autocomplete [ngModel]=\"value\" (ngModelChange)=\"handleChange($event)\" [disabled]=\"disabled()\" [inputId]=\"id()\"\n [typeahead]=\"false\" multiple fluid (onBlur)=\"handleBlur()\"\n [class.ng-invalid]=\"effectiveControl?.invalid && (effectiveControl?.dirty || effectiveControl?.touched)\"\n [class.ng-dirty]=\"effectiveControl?.dirty\" [class.ng-touched]=\"effectiveControl?.touched\" />\n <label [for]=\"id()\">{{ label() }}</label>\n </div>\n</p-floatlabel>\n\n<div class=\"tk-autocomplete-bottom\">\n <div class=\"tk-autocomplete-messages\">\n @if ((effectiveControl?.invalid && (effectiveControl?.dirty || effectiveControl?.touched)) && errorMessage()) {\n <p-message severity=\"error\" size=\"small\" variant=\"simple\">{{ errorMessage() }}</p-message>\n } @else if (hint()) {\n <p-message severity=\"secondary\" size=\"small\" variant=\"simple\">{{ hint() }}</p-message>\n }\n </div>\n</div>","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;MAuCa,qBAAqB,CAAA;AAdlC,IAAA,WAAA,GAAA;AAiBW,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AACtE;;;;;;AAMG;AACH,QAAA,IAAA,CAAA,EAAE,GAAG,KAAK,CAAS,cAAc,yEAAC;AAElC;;;;AAIG;AACH,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAS,EAAE,2EAAC;AAExB;;;;;AAKG;QACH,IAAA,CAAA,OAAO,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,SAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAe;AAE9B;;;;AAIG;AACH,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAS,EAAE,4EAAC;AAEzB;;;;;;AAMG;AACH,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAU,KAAK,+EAAC;AAE/B;;;;AAIE;AACH,QAAA,IAAA,CAAA,YAAY,GAAG,KAAK,CAAS,EAAE,mFAAC;AAE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AGnE,uBAAuB,CAAC,MAAM,EAAA,SAAA,EACpC;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,2BAA2B,CAAC;AACpD,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;AACF,qBAAA,EAAA,QAAA,EAAA,mmCAAA,EAAA,MAAA,EAAA,CAAA,2wFAAA,CAAA,EAAA;m6BAyLsC,YAAY,CAAA,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AE9NrD;;AAEG;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, computed, Component } from '@angular/core';
|
|
2
|
+
import { input, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import * as i1 from 'primeng/badge';
|
|
4
4
|
import { BadgeModule } from 'primeng/badge';
|
|
5
5
|
|
|
@@ -42,11 +42,11 @@ class BadgeComponent {
|
|
|
42
42
|
}, ...(ngDevMode ? [{ debugName: "primeSeverity" }] : /* istanbul ignore next */ []));
|
|
43
43
|
}
|
|
44
44
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.3", ngImport: i0, type: BadgeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
45
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.3", type: BadgeComponent, isStandalone: true, selector: "tk-badge", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, severity: { classPropertyName: "severity", publicName: "severity", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<p-badge [value]=\"value()\" [severity]=\"primeSeverity()\" />\n", styles: [":host{display:inline-flex}:host ::ng-deep .p-badge{font-weight:var(--tk-font-weight-400, 400);font-size:var(--tk-font-size-legal-s, .625rem);border-radius:var(--tk-borderRadius-full, 50%)}:host ::ng-deep .p-badge-success{background-color:var(--tk-color-base-primary-500);color:var(--tk-color-base-surface-0, #ffffff)}:host ::ng-deep .p-badge-secondary{background-color:var(--tk-color-base-surface-300, #d2d2d2);color:var(--tk-color-base-surface-600, #5d5d5e)}:host ::ng-deep .p-badge-contrast{background-color:var(--tk-color-base-surface-950, #191a1b);color:var(--tk-color-base-surface-0, #ffffff)}\n"], dependencies: [{ kind: "ngmodule", type: BadgeModule }, { kind: "component", type: i1.Badge, selector: "p-badge", inputs: ["styleClass", "badgeSize", "size", "severity", "value", "badgeDisabled"] }] }); }
|
|
45
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.3", type: BadgeComponent, isStandalone: true, selector: "tk-badge", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, severity: { classPropertyName: "severity", publicName: "severity", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<p-badge [value]=\"value()\" [severity]=\"primeSeverity()\" />\n", styles: [":host{display:inline-flex}:host ::ng-deep .p-badge{font-weight:var(--tk-font-weight-400, 400);font-size:var(--tk-font-size-legal-s, .625rem);border-radius:var(--tk-borderRadius-full, 50%)}:host ::ng-deep .p-badge-success{background-color:var(--tk-color-base-primary-500);color:var(--tk-color-base-surface-0, #ffffff)}:host ::ng-deep .p-badge-secondary{background-color:var(--tk-color-base-surface-300, #d2d2d2);color:var(--tk-color-base-surface-600, #5d5d5e)}:host ::ng-deep .p-badge-contrast{background-color:var(--tk-color-base-surface-950, #191a1b);color:var(--tk-color-base-surface-0, #ffffff)}\n"], dependencies: [{ kind: "ngmodule", type: BadgeModule }, { kind: "component", type: i1.Badge, selector: "p-badge", inputs: ["styleClass", "badgeSize", "size", "severity", "value", "badgeDisabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
46
46
|
}
|
|
47
47
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.3", ngImport: i0, type: BadgeComponent, decorators: [{
|
|
48
48
|
type: Component,
|
|
49
|
-
args: [{ selector: 'tk-badge',
|
|
49
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'tk-badge', imports: [BadgeModule], template: "<p-badge [value]=\"value()\" [severity]=\"primeSeverity()\" />\n", styles: [":host{display:inline-flex}:host ::ng-deep .p-badge{font-weight:var(--tk-font-weight-400, 400);font-size:var(--tk-font-size-legal-s, .625rem);border-radius:var(--tk-borderRadius-full, 50%)}:host ::ng-deep .p-badge-success{background-color:var(--tk-color-base-primary-500);color:var(--tk-color-base-surface-0, #ffffff)}:host ::ng-deep .p-badge-secondary{background-color:var(--tk-color-base-surface-300, #d2d2d2);color:var(--tk-color-base-surface-600, #5d5d5e)}:host ::ng-deep .p-badge-contrast{background-color:var(--tk-color-base-surface-950, #191a1b);color:var(--tk-color-base-surface-0, #ffffff)}\n"] }]
|
|
50
50
|
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], severity: [{ type: i0.Input, args: [{ isSignal: true, alias: "severity", required: false }] }] } });
|
|
51
51
|
|
|
52
52
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tekus-design-system-components-badge.mjs","sources":["../../../projects/design-system/components/badge/src/badge.component.ts","../../../projects/design-system/components/badge/src/badge.component.html","../../../projects/design-system/components/badge/tekus-design-system-components-badge.ts"],"sourcesContent":["import { Component, computed, input } from '@angular/core';\nimport { BadgeModule } from 'primeng/badge';\n\nexport type BadgeSeverity = 'secondary' | 'primary' | 'contrast';\n/**\n * @component BadgeComponent\n * @description\n * A component used to display numerical or textual badges.\n * It wraps PrimeNG's `p-badge` component with custom styling and behavior.\n *\n * This component supports:\n * - `value`: The text content to be displayed in the badge\n * - `severity`: The color scheme of the badge. Options: `'primary' | 'secondary' | 'contrast'`\n * - Automatically maps severity values to PrimeNG's badge styles\n *\n * @usage\n * ### Basic Usage\n * ```html\n * <tk-badge value=\"5\" severity=\"primary\"></tk-badge>\n * */\n@Component({\n selector: 'tk-badge',\n
|
|
1
|
+
{"version":3,"file":"tekus-design-system-components-badge.mjs","sources":["../../../projects/design-system/components/badge/src/badge.component.ts","../../../projects/design-system/components/badge/src/badge.component.html","../../../projects/design-system/components/badge/tekus-design-system-components-badge.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';\nimport { BadgeModule } from 'primeng/badge';\n\nexport type BadgeSeverity = 'secondary' | 'primary' | 'contrast';\n/**\n * @component BadgeComponent\n * @description\n * A component used to display numerical or textual badges.\n * It wraps PrimeNG's `p-badge` component with custom styling and behavior.\n *\n * This component supports:\n * - `value`: The text content to be displayed in the badge\n * - `severity`: The color scheme of the badge. Options: `'primary' | 'secondary' | 'contrast'`\n * - Automatically maps severity values to PrimeNG's badge styles\n *\n * @usage\n * ### Basic Usage\n * ```html\n * <tk-badge value=\"5\" severity=\"primary\"></tk-badge>\n * */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n selector: 'tk-badge',\n imports: [BadgeModule],\n templateUrl: './badge.component.html',\n styleUrl: './badge.component.scss',\n})\nexport class BadgeComponent {\n /** The text content to be displayed in the badge. */\n value = input.required<string>();\n\n /**\n * The severity level of the badge, which determines its color and styling.\n * @default 'primary'\n */\n severity = input<BadgeSeverity>('primary');\n\n /**\n * Computed property that maps the custom `BadgeSeverity` to the underlying PrimeNG `severity`.\n * Returns `undefined` for 'primary' as it uses the default style, and maps others accordingly.\n */\n primeSeverity = computed((): 'success' | 'secondary' | 'contrast' => {\n const severityMap: Record<\n BadgeSeverity,\n 'success' | 'secondary' | 'contrast'\n > = {\n secondary: 'secondary',\n primary: 'success',\n contrast: 'contrast',\n };\n return severityMap[this.severity()];\n });\n}\n","<p-badge [value]=\"value()\" [severity]=\"primeSeverity()\" />\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAIA;;;;;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AAA,SAAA,EAAA,MAAA,EAAA,CAAA,YAAA,EAAA,WAAA,EAAA,MAAA,EAAA,UAAA,EAAA,OAAA,EAAA,eAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAIV,cAAc,EAAA,UAAA,EAAA,CAAA;kBAP1B,SAAS;AACS,YAAA,IAAA,EAAA,CAAA,EAAA,eAAA,EAAA,uBAAuB,CAAC,MAAM,EAAA,QAAA,EACrC,UAAU,EAAA,OAAA,EACX,CAAC,WAAW,CAAC,EAAA,QAAA,EAAA,kEAAA,EAAA,MAAA,EAAA,CAAA,0lBAAA,CAAA,EAAA;;;AEvBxB;;AAEG;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { input, output, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import * as i1 from 'primeng/button';
|
|
4
4
|
import { ButtonModule } from 'primeng/button';
|
|
5
5
|
import { IconComponent } from '@tekus/design-system/components/icon';
|
|
@@ -10,7 +10,7 @@ import { Tooltip } from 'primeng/tooltip';
|
|
|
10
10
|
* @description
|
|
11
11
|
* Atomic button component that provides a reusable and customizable button element
|
|
12
12
|
* across the application.
|
|
13
|
-
* It uses PrimeNG
|
|
13
|
+
* It uses PrimeNG's `ButtonModule` under the hood and allows setting different visual
|
|
14
14
|
* variants (severity), button types, and disabled states.
|
|
15
15
|
*
|
|
16
16
|
* This component ensures consistent design and behavior in all button interactions.
|
|
@@ -34,6 +34,14 @@ import { Tooltip } from 'primeng/tooltip';
|
|
|
34
34
|
*/
|
|
35
35
|
class ButtonComponent {
|
|
36
36
|
constructor() {
|
|
37
|
+
/**
|
|
38
|
+
* @property {string} label
|
|
39
|
+
* @description
|
|
40
|
+
* Text displayed inside the button.
|
|
41
|
+
*
|
|
42
|
+
* @default `undefined`
|
|
43
|
+
*/
|
|
44
|
+
this.label = input(...(ngDevMode ? [undefined, { debugName: "label" }] : /* istanbul ignore next */ []));
|
|
37
45
|
/**
|
|
38
46
|
* @property {boolean} disabled
|
|
39
47
|
* @description
|
|
@@ -42,17 +50,17 @@ class ButtonComponent {
|
|
|
42
50
|
*
|
|
43
51
|
* @default `false`
|
|
44
52
|
*/
|
|
45
|
-
this.disabled = false;
|
|
53
|
+
this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
46
54
|
/**
|
|
47
55
|
* @property {'button' | 'submit'} type
|
|
48
56
|
* @description
|
|
49
|
-
* Defines the button
|
|
57
|
+
* Defines the button's HTML type attribute.
|
|
50
58
|
* - `'button'`: Standard clickable button (default).
|
|
51
59
|
* - `'submit'`: Used to submit forms.
|
|
52
60
|
*
|
|
53
61
|
* @default `'button'`
|
|
54
62
|
*/
|
|
55
|
-
this.type = 'button';
|
|
63
|
+
this.type = input('button', ...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
56
64
|
/**
|
|
57
65
|
* @property {ButtonSeverity} severity
|
|
58
66
|
* @description
|
|
@@ -61,9 +69,19 @@ class ButtonComponent {
|
|
|
61
69
|
* - `'secondary'`: Secondary option.
|
|
62
70
|
* - `'danger'`: Destructive or warning actions.
|
|
63
71
|
*
|
|
64
|
-
* @default `'
|
|
72
|
+
* @default `'primary'`
|
|
73
|
+
*/
|
|
74
|
+
this.severity = input('primary', ...(ngDevMode ? [{ debugName: "severity" }] : /* istanbul ignore next */ []));
|
|
75
|
+
/**
|
|
76
|
+
* @property {'text' | 'outlined'} variant
|
|
77
|
+
* @description
|
|
78
|
+
* Defines the variant of the button.
|
|
79
|
+
* - `'text'`: Text-only button.
|
|
80
|
+
* - `'outlined'`: Outlined button.
|
|
81
|
+
*
|
|
82
|
+
* @default `undefined`
|
|
65
83
|
*/
|
|
66
|
-
this.
|
|
84
|
+
this.variant = input(...(ngDevMode ? [undefined, { debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
67
85
|
/**
|
|
68
86
|
* @property {boolean} link
|
|
69
87
|
* @description
|
|
@@ -71,7 +89,16 @@ class ButtonComponent {
|
|
|
71
89
|
*
|
|
72
90
|
* @default false
|
|
73
91
|
*/
|
|
74
|
-
this.link = false;
|
|
92
|
+
this.link = input(false, ...(ngDevMode ? [{ debugName: "link" }] : /* istanbul ignore next */ []));
|
|
93
|
+
/**
|
|
94
|
+
* @property {string} icon
|
|
95
|
+
* @description
|
|
96
|
+
* - If `label` is provided, the icon is displayed to the left.
|
|
97
|
+
* - If `label` is empty, the button is rendered as an icon-only button.
|
|
98
|
+
*
|
|
99
|
+
* @default `undefined`
|
|
100
|
+
*/
|
|
101
|
+
this.icon = input(...(ngDevMode ? [undefined, { debugName: "icon" }] : /* istanbul ignore next */ []));
|
|
75
102
|
/**
|
|
76
103
|
* @event clicked
|
|
77
104
|
* @description
|
|
@@ -83,7 +110,15 @@ class ButtonComponent {
|
|
|
83
110
|
* <tk-button label="Click me" (clicked)="handleClick()"></tk-button>
|
|
84
111
|
* ```
|
|
85
112
|
*/
|
|
86
|
-
this.clicked =
|
|
113
|
+
this.clicked = output();
|
|
114
|
+
/**
|
|
115
|
+
* @property {string} tooltipText
|
|
116
|
+
* @description
|
|
117
|
+
* Tooltip text to be displayed when the user hovers over the button.
|
|
118
|
+
*
|
|
119
|
+
* @default `undefined`
|
|
120
|
+
*/
|
|
121
|
+
this.tooltipText = input(...(ngDevMode ? [undefined, { debugName: "tooltipText" }] : /* istanbul ignore next */ []));
|
|
87
122
|
}
|
|
88
123
|
/**
|
|
89
124
|
* @method onButtonClick
|
|
@@ -92,34 +127,16 @@ class ButtonComponent {
|
|
|
92
127
|
* is not disabled.
|
|
93
128
|
*/
|
|
94
129
|
onButtonClick() {
|
|
95
|
-
if (!this.disabled)
|
|
130
|
+
if (!this.disabled())
|
|
96
131
|
this.clicked.emit('mouse');
|
|
97
132
|
}
|
|
98
133
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.3", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
99
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.3", type: ButtonComponent, isStandalone: true, selector: "tk-button", inputs: { label: "label", disabled: "disabled", type: "type", severity: "severity", variant: "variant", link: "link", icon: "icon", tooltipText: "tooltipText" }, outputs: { clicked: "clicked" }, ngImport: i0, template: "<p-button\n class=\"tk-button\"\n [label]=\"label\"\n [disabled]=\"disabled\"\n [type]=\"type\"\n [severity]=\"link ?
|
|
134
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.3", type: ButtonComponent, isStandalone: true, selector: "tk-button", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, severity: { classPropertyName: "severity", publicName: "severity", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, link: { classPropertyName: "link", publicName: "link", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, tooltipText: { classPropertyName: "tooltipText", publicName: "tooltipText", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { clicked: "clicked" }, ngImport: i0, template: "<p-button\n class=\"tk-button\"\n [label]=\"label()\"\n [disabled]=\"disabled()\"\n [type]=\"type()\"\n [severity]=\"link() ? undefined : severity()\"\n [variant]=\"variant()\"\n [link]=\"link()\"\n [pTooltip]=\"tooltipText()\"\n tooltipPosition=\"top\"\n (click)=\"onButtonClick()\"\n (keydown.enter)=\"onButtonClick()\"\n (keydown.space)=\"onButtonClick()\">\n\n @if (icon()) {\n <tk-icon [icon]=\"icon()!\"></tk-icon>\n }\n</p-button>\n", styles: [":host ::ng-deep .p-button{min-width:var(--tk-size-base-250, 2.5rem)}:host ::ng-deep .p-button.p-button-primary .p-button-label,:host ::ng-deep .p-button.p-button-danger .p-button-label{color:var(--tk-color-base-surface-0, #ffffff)!important}:host ::ng-deep .p-button.p-button-link .p-button-label{color:var(--tk-color-base-primary-500, #16006f)!important}:host ::ng-deep .p-button.p-button-link:hover .p-button-label{color:var(--tk-color-base-primary-400, #45338c)!important}:host ::ng-deep .p-button.p-button-secondary .p-button-label{color:var(--tk-color-base-surface-900, #191A1B)!important}:host ::ng-deep .p-button.p-button-secondary.p-button-outlined .p-button-label{color:var(--tk-color-base-surface-500, #8a8a8b)!important}:host ::ng-deep .p-button.p-button-secondary .p-button-label,:host ::ng-deep .p-button.p-button-danger .p-button-label{font-weight:var(--tk-font-weight-400, 400)}:host ::ng-deep .p-button-label{display:inline-block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n"], dependencies: [{ kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i1.Button, selector: "p-button", inputs: ["hostName", "type", "badge", "disabled", "raised", "rounded", "text", "plain", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "iconPos", "icon", "label", "loading", "loadingIcon", "severity", "buttonProps", "fluid"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: IconComponent, selector: "tk-icon", inputs: ["icon", "styleIcon", "color", "size", "disabled"] }, { kind: "directive", type: Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "showOnEllipsis", "pTooltip", "tooltipDisabled", "tooltipOptions", "appendTo", "ptTooltip", "pTooltipPT", "pTooltipUnstyled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
100
135
|
}
|
|
101
136
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.3", ngImport: i0, type: ButtonComponent, decorators: [{
|
|
102
137
|
type: Component,
|
|
103
|
-
args: [{ selector: 'tk-button',
|
|
104
|
-
}], propDecorators: { label: [{
|
|
105
|
-
type: Input
|
|
106
|
-
}], disabled: [{
|
|
107
|
-
type: Input
|
|
108
|
-
}], type: [{
|
|
109
|
-
type: Input
|
|
110
|
-
}], severity: [{
|
|
111
|
-
type: Input
|
|
112
|
-
}], variant: [{
|
|
113
|
-
type: Input
|
|
114
|
-
}], link: [{
|
|
115
|
-
type: Input
|
|
116
|
-
}], icon: [{
|
|
117
|
-
type: Input
|
|
118
|
-
}], clicked: [{
|
|
119
|
-
type: Output
|
|
120
|
-
}], tooltipText: [{
|
|
121
|
-
type: Input
|
|
122
|
-
}] } });
|
|
138
|
+
args: [{ selector: 'tk-button', imports: [ButtonModule, IconComponent, Tooltip], changeDetection: ChangeDetectionStrategy.OnPush, template: "<p-button\n class=\"tk-button\"\n [label]=\"label()\"\n [disabled]=\"disabled()\"\n [type]=\"type()\"\n [severity]=\"link() ? undefined : severity()\"\n [variant]=\"variant()\"\n [link]=\"link()\"\n [pTooltip]=\"tooltipText()\"\n tooltipPosition=\"top\"\n (click)=\"onButtonClick()\"\n (keydown.enter)=\"onButtonClick()\"\n (keydown.space)=\"onButtonClick()\">\n\n @if (icon()) {\n <tk-icon [icon]=\"icon()!\"></tk-icon>\n }\n</p-button>\n", styles: [":host ::ng-deep .p-button{min-width:var(--tk-size-base-250, 2.5rem)}:host ::ng-deep .p-button.p-button-primary .p-button-label,:host ::ng-deep .p-button.p-button-danger .p-button-label{color:var(--tk-color-base-surface-0, #ffffff)!important}:host ::ng-deep .p-button.p-button-link .p-button-label{color:var(--tk-color-base-primary-500, #16006f)!important}:host ::ng-deep .p-button.p-button-link:hover .p-button-label{color:var(--tk-color-base-primary-400, #45338c)!important}:host ::ng-deep .p-button.p-button-secondary .p-button-label{color:var(--tk-color-base-surface-900, #191A1B)!important}:host ::ng-deep .p-button.p-button-secondary.p-button-outlined .p-button-label{color:var(--tk-color-base-surface-500, #8a8a8b)!important}:host ::ng-deep .p-button.p-button-secondary .p-button-label,:host ::ng-deep .p-button.p-button-danger .p-button-label{font-weight:var(--tk-font-weight-400, 400)}:host ::ng-deep .p-button-label{display:inline-block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n"] }]
|
|
139
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], severity: [{ type: i0.Input, args: [{ isSignal: true, alias: "severity", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], link: [{ type: i0.Input, args: [{ isSignal: true, alias: "link", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], clicked: [{ type: i0.Output, args: ["clicked"] }], tooltipText: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipText", required: false }] }] } });
|
|
123
140
|
|
|
124
141
|
/**
|
|
125
142
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tekus-design-system-components-button.mjs","sources":["../../../projects/design-system/components/button/src/button.component.ts","../../../projects/design-system/components/button/src/button.component.html","../../../projects/design-system/components/button/tekus-design-system-components-button.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"tekus-design-system-components-button.mjs","sources":["../../../projects/design-system/components/button/src/button.component.ts","../../../projects/design-system/components/button/src/button.component.html","../../../projects/design-system/components/button/tekus-design-system-components-button.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input, output } from '@angular/core';\nimport { ButtonModule } from 'primeng/button';\nimport { IconComponent } from '@tekus/design-system/components/icon';\nimport { Tooltip } from 'primeng/tooltip';\n\n\nexport type ButtonSeverity = 'primary' | 'secondary' | 'danger';\nexport type Variant = 'text' | 'outlined';\n/**\n * @component ButtonComponent\n * @description\n * Atomic button component that provides a reusable and customizable button element\n * across the application.\n * It uses PrimeNG's `ButtonModule` under the hood and allows setting different visual\n * variants (severity), button types, and disabled states.\n *\n * This component ensures consistent design and behavior in all button interactions.\n * It is accessible via both mouse clicks and keyboard actions (Enter/Space).\n *\n * @usage\n * ```html\n * <tk-button\n * label=\"Save\"\n * [severity]=\"'primary'\"\n * [type]=\"'submit'\"\n * (clicked)=\"handleSave()\">\n * </tk-button>\n *\n * <tk-button\n * label=\"Cancel\"\n * [severity]=\"'secondary'\"\n * [disabled]=\"true\">\n * </tk-button>\n * ```\n */\n@Component({\n selector: 'tk-button',\n imports: [ButtonModule, IconComponent, Tooltip],\n templateUrl: './button.component.html',\n styleUrl: './button.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ButtonComponent {\n /**\n * @property {string} label\n * @description\n * Text displayed inside the button.\n *\n * @default `undefined`\n */\n label = input<string>();\n\n /**\n * @property {boolean} disabled\n * @description\n * Disables the button, preventing user interaction and applying a visual style\n * that indicates the inactive state.\n *\n * @default `false`\n */\n disabled = input<boolean>(false);\n\n /**\n * @property {'button' | 'submit'} type\n * @description\n * Defines the button's HTML type attribute.\n * - `'button'`: Standard clickable button (default).\n * - `'submit'`: Used to submit forms.\n *\n * @default `'button'`\n */\n type = input<'button' | 'submit'>('button');\n\n /**\n * @property {ButtonSeverity} severity\n * @description\n * Defines the visual importance or style of the button.\n * - `'primary'`: Default, neutral action.\n * - `'secondary'`: Secondary option.\n * - `'danger'`: Destructive or warning actions.\n *\n * @default `'primary'`\n */\n severity = input<ButtonSeverity>('primary');\n\n /**\n * @property {'text' | 'outlined'} variant\n * @description\n * Defines the variant of the button.\n * - `'text'`: Text-only button.\n * - `'outlined'`: Outlined button.\n *\n * @default `undefined`\n */\n variant = input<Variant>();\n\n /**\n * @property {boolean} link\n * @description\n * When true, the button will be styled as a link (text only with underline).\n *\n * @default false\n */\n link = input<boolean>(false);\n\n /**\n * @property {string} icon\n * @description\n * - If `label` is provided, the icon is displayed to the left.\n * - If `label` is empty, the button is rendered as an icon-only button.\n *\n * @default `undefined`\n */\n icon = input<string>();\n\n /**\n * @event clicked\n * @description\n * Emits when the button is activated via click or keyboard (Enter/Space),\n * unless the button is disabled.\n *\n * @example\n * ```html\n * <tk-button label=\"Click me\" (clicked)=\"handleClick()\"></tk-button>\n * ```\n */\n clicked = output<'mouse' | 'keyboard'>();\n\n /**\n * @property {string} tooltipText\n * @description\n * Tooltip text to be displayed when the user hovers over the button.\n *\n * @default `undefined`\n */\n tooltipText = input<string>();\n\n /**\n * @method onButtonClick\n * @description\n * Handles the native click event. Emits the `clicked` event if the button\n * is not disabled.\n */\n onButtonClick(): void {\n if (!this.disabled()) this.clicked.emit('mouse');\n }\n}\n","<p-button\n class=\"tk-button\"\n [label]=\"label()\"\n [disabled]=\"disabled()\"\n [type]=\"type()\"\n [severity]=\"link() ? undefined : severity()\"\n [variant]=\"variant()\"\n [link]=\"link()\"\n [pTooltip]=\"tooltipText()\"\n tooltipPosition=\"top\"\n (click)=\"onButtonClick()\"\n (keydown.enter)=\"onButtonClick()\"\n (keydown.space)=\"onButtonClick()\">\n\n @if (icon()) {\n <tk-icon [icon]=\"icon()!\"></tk-icon>\n }\n</p-button>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BG;MAQU,eAAe,CAAA;AAP5B,IAAA,WAAA,GAAA;AAQE;;;;;;AAMG;QACH,IAAA,CAAA,KAAK,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,OAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAU;AAEvB;;;;;;;AAOG;AACH,QAAA,IAAA,CAA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CAAC,EAAA,eAAA,EAG9B,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,ycAAA,EAAA,MAAA,EAAA,CAAA,+/BAAA,CAAA,EAAA;;;AExCjD;;AAEG;;;;"}
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, model, input, Component } from '@angular/core';
|
|
2
|
+
import { inject, DestroyRef, model, input, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
3
4
|
import * as i1 from '@angular/forms';
|
|
4
5
|
import { NgControl, FormControl, ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
5
|
-
import { Subscription } from 'rxjs';
|
|
6
6
|
import * as i2 from 'primeng/checkbox';
|
|
7
7
|
import { CheckboxModule } from 'primeng/checkbox';
|
|
8
8
|
import * as i3 from 'primeng/message';
|
|
9
9
|
import { MessageModule } from 'primeng/message';
|
|
10
10
|
|
|
11
11
|
class CheckboxComponent {
|
|
12
|
-
/**
|
|
13
|
-
* Initialize the component and register it as a ControlValueAccessor.
|
|
14
|
-
*/
|
|
15
12
|
constructor() {
|
|
16
|
-
/** Internal references and injections */
|
|
17
13
|
this.ngControl = inject(NgControl, { self: true, optional: true });
|
|
14
|
+
this.destroyRef = inject(DestroyRef);
|
|
18
15
|
/** Properties and Signals */
|
|
19
16
|
/**
|
|
20
17
|
* @property {ModelSignal<any>} model
|
|
@@ -82,7 +79,6 @@ class CheckboxComponent {
|
|
|
82
79
|
this.disabled = model(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
83
80
|
this.onChange = () => { };
|
|
84
81
|
this.onTouched = () => { };
|
|
85
|
-
this.subscription = new Subscription();
|
|
86
82
|
if (this.ngControl) {
|
|
87
83
|
this.ngControl.valueAccessor = this;
|
|
88
84
|
}
|
|
@@ -102,15 +98,16 @@ class CheckboxComponent {
|
|
|
102
98
|
else {
|
|
103
99
|
this.disabled.set(control.disabled);
|
|
104
100
|
}
|
|
105
|
-
|
|
101
|
+
control.statusChanges
|
|
102
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
103
|
+
.subscribe(() => {
|
|
106
104
|
this.disabled.set(control.disabled);
|
|
107
|
-
})
|
|
108
|
-
|
|
105
|
+
});
|
|
106
|
+
control.valueChanges
|
|
107
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
108
|
+
.subscribe(value => {
|
|
109
109
|
this.model.set(value);
|
|
110
|
-
})
|
|
111
|
-
}
|
|
112
|
-
ngOnDestroy() {
|
|
113
|
-
this.subscription.unsubscribe();
|
|
110
|
+
});
|
|
114
111
|
}
|
|
115
112
|
/**
|
|
116
113
|
* Implementation of ControlValueAccessor: Writes a new value from the form.
|
|
@@ -160,7 +157,7 @@ class CheckboxComponent {
|
|
|
160
157
|
this.effectiveControl.markAsTouched();
|
|
161
158
|
}
|
|
162
159
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.3", ngImport: i0, type: CheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
163
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.3", type: CheckboxComponent, isStandalone: true, selector: "tk-checkbox", inputs: { model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, binary: { classPropertyName: "binary", publicName: "binary", isSignal: true, isRequired: false, transformFunction: null }, control: { classPropertyName: "control", publicName: "control", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { model: "modelChange", indeterminate: "indeterminateChange", disabled: "disabledChange" }, ngImport: i0, template: "<div class=\"tk-checkbox-wrapper\">\n <div class=\"tk-checkbox-group\" [class.tk-disabled]=\"disabled()\">\n <p-checkbox\n [inputId]=\"inputId()\"\n [name]=\"name()\"\n [value]=\"value()\"\n [binary]=\"binary()\"\n [disabled]=\"disabled()\"\n [indeterminate]=\"indeterminate()\"\n [ngModel]=\"model()\"\n (ngModelChange)=\"onModelChange($event)\"\n [class.ng-invalid]=\"effectiveControl.invalid\"\n [class.ng-dirty]=\"effectiveControl.dirty\"\n [class.ng-touched]=\"effectiveControl.touched\">\n </p-checkbox>\n @if (label()) {\n <label [for]=\"inputId()\" class=\"tk-checkbox-label\"> {{ label() }} </label>\n }\n </div>\n @if (\n effectiveControl.invalid &&\n (effectiveControl.dirty || effectiveControl.touched) &&\n errorMessage()\n ) {\n <div class=\"tk-input-bottom\">\n <div class=\"tk-input-messages\">\n <p-message severity=\"error\" size=\"small\" variant=\"simple\">{{\n errorMessage()\n }}</p-message>\n </div>\n </div>\n }\n</div>\n", styles: [":host ::ng-deep .tk-checkbox-wrapper{display:flex;flex-direction:column}:host ::ng-deep .tk-checkbox-wrapper label{font-size:var(--tk-font-size-paragraph-s, .875rem);font-weight:var(--tk-font-weight-400, \"Regular\")}:host ::ng-deep .tk-checkbox-group{display:flex;align-items:center;gap:var(--tk-spacing-base-50, .5rem)}:host ::ng-deep .tk-checkbox-group.tk-disabled label{color:var(--tk-color-base-surface-600, #424243)}:host ::ng-deep .tk-checkbox-label{margin-top:var(--tk-spacing-base-25, .25rem)}:host ::ng-deep p-message[severity=error] .p-inline-message-text,:host ::ng-deep p-message[severity=error] span{color:var(--tk-color-base-red-700, #cf2604)}:host ::ng-deep p-message[severity=secondary] .p-inline-message-text,:host ::ng-deep p-message[severity=secondary] span{color:var(--tk-color-base-surface-600, #5d5d5e)}:host ::ng-deep .tk-input-bottom{display:flex;justify-content:space-between;align-items:flex-start;margin-top:.25rem;min-height:1.25rem}:host ::ng-deep .tk-input-messages{flex:1;margin-right:1rem}:host ::ng-deep .p-checkbox.p-disabled .p-checkbox-icon{color:var(--tk-color-base-surface-300, #d2d2d2)!important}:host ::ng-deep p-checkbox.ng-invalid.ng-touched .p-checkbox-box,:host ::ng-deep p-checkbox.ng-invalid.ng-dirty .p-checkbox-box{border-color:var(--tk-color-base-red-700, #cf2604)}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: FormsModule }, { 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: ["hostName", "value", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "inputStyle", "styleClass", "inputClass", "indeterminate", "formControl", "checkboxIcon", "readonly", "autofocus", "trueValue", "falseValue", "variant", "size"], outputs: ["onChange", "onFocus", "onBlur"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i3.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }] }); }
|
|
160
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.3", type: CheckboxComponent, isStandalone: true, selector: "tk-checkbox", inputs: { model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, binary: { classPropertyName: "binary", publicName: "binary", isSignal: true, isRequired: false, transformFunction: null }, control: { classPropertyName: "control", publicName: "control", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { model: "modelChange", indeterminate: "indeterminateChange", disabled: "disabledChange" }, ngImport: i0, template: "<div class=\"tk-checkbox-wrapper\">\n <div class=\"tk-checkbox-group\" [class.tk-disabled]=\"disabled()\">\n <p-checkbox\n [inputId]=\"inputId()\"\n [name]=\"name()\"\n [value]=\"value()\"\n [binary]=\"binary()\"\n [disabled]=\"disabled()\"\n [indeterminate]=\"indeterminate()\"\n [ngModel]=\"model()\"\n (ngModelChange)=\"onModelChange($event)\"\n [class.ng-invalid]=\"effectiveControl.invalid\"\n [class.ng-dirty]=\"effectiveControl.dirty\"\n [class.ng-touched]=\"effectiveControl.touched\">\n </p-checkbox>\n @if (label()) {\n <label [for]=\"inputId()\" class=\"tk-checkbox-label\"> {{ label() }} </label>\n }\n </div>\n @if (\n effectiveControl.invalid &&\n (effectiveControl.dirty || effectiveControl.touched) &&\n errorMessage()\n ) {\n <div class=\"tk-input-bottom\">\n <div class=\"tk-input-messages\">\n <p-message severity=\"error\" size=\"small\" variant=\"simple\">{{\n errorMessage()\n }}</p-message>\n </div>\n </div>\n }\n</div>\n", styles: [":host ::ng-deep .tk-checkbox-wrapper{display:flex;flex-direction:column}:host ::ng-deep .tk-checkbox-wrapper label{font-size:var(--tk-font-size-paragraph-s, .875rem);font-weight:var(--tk-font-weight-400, \"Regular\")}:host ::ng-deep .tk-checkbox-group{display:flex;align-items:center;gap:var(--tk-spacing-base-50, .5rem)}:host ::ng-deep .tk-checkbox-group.tk-disabled label{color:var(--tk-color-base-surface-600, #424243)}:host ::ng-deep .tk-checkbox-label{margin-top:var(--tk-spacing-base-25, .25rem)}:host ::ng-deep p-message[severity=error] .p-inline-message-text,:host ::ng-deep p-message[severity=error] span{color:var(--tk-color-base-red-700, #cf2604)}:host ::ng-deep p-message[severity=secondary] .p-inline-message-text,:host ::ng-deep p-message[severity=secondary] span{color:var(--tk-color-base-surface-600, #5d5d5e)}:host ::ng-deep .tk-input-bottom{display:flex;justify-content:space-between;align-items:flex-start;margin-top:.25rem;min-height:1.25rem}:host ::ng-deep .tk-input-messages{flex:1;margin-right:1rem}:host ::ng-deep .p-checkbox.p-disabled .p-checkbox-icon{color:var(--tk-color-base-surface-300, #d2d2d2)!important}:host ::ng-deep p-checkbox.ng-invalid.ng-touched .p-checkbox-box,:host ::ng-deep p-checkbox.ng-invalid.ng-dirty .p-checkbox-box{border-color:var(--tk-color-base-red-700, #cf2604)}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: FormsModule }, { 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: ["hostName", "value", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "inputStyle", "styleClass", "inputClass", "indeterminate", "formControl", "checkboxIcon", "readonly", "autofocus", "trueValue", "falseValue", "variant", "size"], outputs: ["onChange", "onFocus", "onBlur"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i3.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
164
161
|
}
|
|
165
162
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.3", ngImport: i0, type: CheckboxComponent, decorators: [{
|
|
166
163
|
type: Component,
|
|
@@ -169,7 +166,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.3", ngImpor
|
|
|
169
166
|
FormsModule,
|
|
170
167
|
CheckboxModule,
|
|
171
168
|
MessageModule,
|
|
172
|
-
], template: "<div class=\"tk-checkbox-wrapper\">\n <div class=\"tk-checkbox-group\" [class.tk-disabled]=\"disabled()\">\n <p-checkbox\n [inputId]=\"inputId()\"\n [name]=\"name()\"\n [value]=\"value()\"\n [binary]=\"binary()\"\n [disabled]=\"disabled()\"\n [indeterminate]=\"indeterminate()\"\n [ngModel]=\"model()\"\n (ngModelChange)=\"onModelChange($event)\"\n [class.ng-invalid]=\"effectiveControl.invalid\"\n [class.ng-dirty]=\"effectiveControl.dirty\"\n [class.ng-touched]=\"effectiveControl.touched\">\n </p-checkbox>\n @if (label()) {\n <label [for]=\"inputId()\" class=\"tk-checkbox-label\"> {{ label() }} </label>\n }\n </div>\n @if (\n effectiveControl.invalid &&\n (effectiveControl.dirty || effectiveControl.touched) &&\n errorMessage()\n ) {\n <div class=\"tk-input-bottom\">\n <div class=\"tk-input-messages\">\n <p-message severity=\"error\" size=\"small\" variant=\"simple\">{{\n errorMessage()\n }}</p-message>\n </div>\n </div>\n }\n</div>\n", styles: [":host ::ng-deep .tk-checkbox-wrapper{display:flex;flex-direction:column}:host ::ng-deep .tk-checkbox-wrapper label{font-size:var(--tk-font-size-paragraph-s, .875rem);font-weight:var(--tk-font-weight-400, \"Regular\")}:host ::ng-deep .tk-checkbox-group{display:flex;align-items:center;gap:var(--tk-spacing-base-50, .5rem)}:host ::ng-deep .tk-checkbox-group.tk-disabled label{color:var(--tk-color-base-surface-600, #424243)}:host ::ng-deep .tk-checkbox-label{margin-top:var(--tk-spacing-base-25, .25rem)}:host ::ng-deep p-message[severity=error] .p-inline-message-text,:host ::ng-deep p-message[severity=error] span{color:var(--tk-color-base-red-700, #cf2604)}:host ::ng-deep p-message[severity=secondary] .p-inline-message-text,:host ::ng-deep p-message[severity=secondary] span{color:var(--tk-color-base-surface-600, #5d5d5e)}:host ::ng-deep .tk-input-bottom{display:flex;justify-content:space-between;align-items:flex-start;margin-top:.25rem;min-height:1.25rem}:host ::ng-deep .tk-input-messages{flex:1;margin-right:1rem}:host ::ng-deep .p-checkbox.p-disabled .p-checkbox-icon{color:var(--tk-color-base-surface-300, #d2d2d2)!important}:host ::ng-deep p-checkbox.ng-invalid.ng-touched .p-checkbox-box,:host ::ng-deep p-checkbox.ng-invalid.ng-dirty .p-checkbox-box{border-color:var(--tk-color-base-red-700, #cf2604)}\n"] }]
|
|
169
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"tk-checkbox-wrapper\">\n <div class=\"tk-checkbox-group\" [class.tk-disabled]=\"disabled()\">\n <p-checkbox\n [inputId]=\"inputId()\"\n [name]=\"name()\"\n [value]=\"value()\"\n [binary]=\"binary()\"\n [disabled]=\"disabled()\"\n [indeterminate]=\"indeterminate()\"\n [ngModel]=\"model()\"\n (ngModelChange)=\"onModelChange($event)\"\n [class.ng-invalid]=\"effectiveControl.invalid\"\n [class.ng-dirty]=\"effectiveControl.dirty\"\n [class.ng-touched]=\"effectiveControl.touched\">\n </p-checkbox>\n @if (label()) {\n <label [for]=\"inputId()\" class=\"tk-checkbox-label\"> {{ label() }} </label>\n }\n </div>\n @if (\n effectiveControl.invalid &&\n (effectiveControl.dirty || effectiveControl.touched) &&\n errorMessage()\n ) {\n <div class=\"tk-input-bottom\">\n <div class=\"tk-input-messages\">\n <p-message severity=\"error\" size=\"small\" variant=\"simple\">{{\n errorMessage()\n }}</p-message>\n </div>\n </div>\n }\n</div>\n", styles: [":host ::ng-deep .tk-checkbox-wrapper{display:flex;flex-direction:column}:host ::ng-deep .tk-checkbox-wrapper label{font-size:var(--tk-font-size-paragraph-s, .875rem);font-weight:var(--tk-font-weight-400, \"Regular\")}:host ::ng-deep .tk-checkbox-group{display:flex;align-items:center;gap:var(--tk-spacing-base-50, .5rem)}:host ::ng-deep .tk-checkbox-group.tk-disabled label{color:var(--tk-color-base-surface-600, #424243)}:host ::ng-deep .tk-checkbox-label{margin-top:var(--tk-spacing-base-25, .25rem)}:host ::ng-deep p-message[severity=error] .p-inline-message-text,:host ::ng-deep p-message[severity=error] span{color:var(--tk-color-base-red-700, #cf2604)}:host ::ng-deep p-message[severity=secondary] .p-inline-message-text,:host ::ng-deep p-message[severity=secondary] span{color:var(--tk-color-base-surface-600, #5d5d5e)}:host ::ng-deep .tk-input-bottom{display:flex;justify-content:space-between;align-items:flex-start;margin-top:.25rem;min-height:1.25rem}:host ::ng-deep .tk-input-messages{flex:1;margin-right:1rem}:host ::ng-deep .p-checkbox.p-disabled .p-checkbox-icon{color:var(--tk-color-base-surface-300, #d2d2d2)!important}:host ::ng-deep p-checkbox.ng-invalid.ng-touched .p-checkbox-box,:host ::ng-deep p-checkbox.ng-invalid.ng-dirty .p-checkbox-box{border-color:var(--tk-color-base-red-700, #cf2604)}\n"] }]
|
|
173
170
|
}], ctorParameters: () => [], propDecorators: { model: [{ type: i0.Input, args: [{ isSignal: true, alias: "model", required: false }] }, { type: i0.Output, args: ["modelChange"] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], binary: [{ type: i0.Input, args: [{ isSignal: true, alias: "binary", required: false }] }], control: [{ type: i0.Input, args: [{ isSignal: true, alias: "control", required: false }] }], errorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessage", required: false }] }], indeterminate: [{ type: i0.Input, args: [{ isSignal: true, alias: "indeterminate", required: false }] }, { type: i0.Output, args: ["indeterminateChange"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }, { type: i0.Output, args: ["disabledChange"] }] } });
|
|
174
171
|
|
|
175
172
|
/**
|