@tekus/design-system 5.36.0 → 5.38.1
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/tokens/tk-foundations.json +4 -0
- package/fesm2022/tekus-design-system-components-autocomplete.mjs +7 -17
- package/fesm2022/tekus-design-system-components-autocomplete.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-avatar.mjs +120 -0
- package/fesm2022/tekus-design-system-components-avatar.mjs.map +1 -0
- package/fesm2022/tekus-design-system-components-button.mjs +2 -2
- package/fesm2022/tekus-design-system-components-button.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-card.mjs +1 -1
- package/fesm2022/tekus-design-system-components-card.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-checkbox.mjs +9 -3
- package/fesm2022/tekus-design-system-components-checkbox.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-color-picker.mjs +203 -29
- package/fesm2022/tekus-design-system-components-color-picker.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-date-picker.mjs +16 -3
- package/fesm2022/tekus-design-system-components-date-picker.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-grid-container.mjs +181 -0
- package/fesm2022/tekus-design-system-components-grid-container.mjs.map +1 -0
- package/fesm2022/tekus-design-system-components-input-number.mjs +37 -3
- package/fesm2022/tekus-design-system-components-input-number.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-input-text.mjs +2 -2
- package/fesm2022/tekus-design-system-components-input-text.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-menu.mjs +2 -2
- package/fesm2022/tekus-design-system-components-menu.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-multiselect.mjs +2 -2
- package/fesm2022/tekus-design-system-components-multiselect.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-panel-menu.mjs +2 -2
- package/fesm2022/tekus-design-system-components-panel-menu.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-radio-button.mjs +9 -3
- package/fesm2022/tekus-design-system-components-radio-button.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-section.mjs +63 -0
- package/fesm2022/tekus-design-system-components-section.mjs.map +1 -0
- package/fesm2022/tekus-design-system-components-select.mjs +37 -32
- package/fesm2022/tekus-design-system-components-select.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-sidebar-layout.mjs +2 -2
- package/fesm2022/tekus-design-system-components-sidebar-layout.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-table.mjs +1 -1
- package/fesm2022/tekus-design-system-components-table.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-tabs.mjs +2 -2
- package/fesm2022/tekus-design-system-components-tabs.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-textarea.mjs +2 -2
- package/fesm2022/tekus-design-system-components-textarea.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-time-picker.mjs +13 -3
- package/fesm2022/tekus-design-system-components-time-picker.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-toggle.mjs +4 -3
- package/fesm2022/tekus-design-system-components-toggle.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-toolbar.mjs +2 -2
- package/fesm2022/tekus-design-system-components-toolbar.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-topbar.mjs +2 -2
- package/fesm2022/tekus-design-system-components-topbar.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-tree-table.mjs +94 -0
- package/fesm2022/tekus-design-system-components-tree-table.mjs.map +1 -0
- package/fesm2022/tekus-design-system-core-types.mjs +26 -10
- package/fesm2022/tekus-design-system-core-types.mjs.map +1 -1
- package/fesm2022/tekus-design-system-core.mjs +26 -10
- package/fesm2022/tekus-design-system-core.mjs.map +1 -1
- package/fesm2022/tekus-design-system-directives-gird-item.mjs +1 -1
- package/fesm2022/tekus-design-system-directives-gird-item.mjs.map +1 -1
- package/package.json +17 -1
- package/scss/_config.scss +242 -0
- package/scss/tk-bundle.scss +105 -0
- package/styles/variables.css +1 -0
- package/types/tekus-design-system-components-autocomplete.d.ts +3 -12
- package/types/tekus-design-system-components-avatar.d.ts +104 -0
- package/types/tekus-design-system-components-checkbox.d.ts +7 -1
- package/types/tekus-design-system-components-color-picker.d.ts +75 -12
- package/types/tekus-design-system-components-date-picker.d.ts +11 -1
- package/types/tekus-design-system-components-grid-container.d.ts +123 -0
- package/types/tekus-design-system-components-input-number.d.ts +35 -1
- package/types/tekus-design-system-components-radio-button.d.ts +7 -1
- package/types/tekus-design-system-components-section.d.ts +45 -0
- package/types/tekus-design-system-components-select.d.ts +2 -6
- package/types/tekus-design-system-components-time-picker.d.ts +8 -1
- package/types/tekus-design-system-components-toggle.d.ts +2 -1
- package/types/tekus-design-system-components-tree-table.d.ts +62 -0
- package/types/tekus-design-system-core-types.d.ts +7 -7
- package/types/tekus-design-system-core.d.ts +7 -7
- package/types/tekus-design-system-directives-gird-item.d.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, input, signal, model,
|
|
2
|
+
import { inject, input, signal, model, 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';
|
|
@@ -75,16 +75,6 @@ class AutocompleteComponent {
|
|
|
75
75
|
* Allows usage with the syntax: `[(model)]="myValue"`.
|
|
76
76
|
*/
|
|
77
77
|
this.model = model(...(ngDevMode ? [undefined, { debugName: "model" }] : /* istanbul ignore next */ []));
|
|
78
|
-
/**
|
|
79
|
-
* @event modelChange
|
|
80
|
-
* @description
|
|
81
|
-
* Emits whenever the value changes.
|
|
82
|
-
* Payload: the selected item(s) of type `AutocompleteValue<T>`.
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* <tk-autocomplete (modelChange)="onChange($event)"></tk-autocomplete>
|
|
86
|
-
*/
|
|
87
|
-
this.modelChange = output();
|
|
88
78
|
// -----------------------------------
|
|
89
79
|
// CVA CALLBACKS
|
|
90
80
|
// -----------------------------------
|
|
@@ -159,7 +149,8 @@ class AutocompleteComponent {
|
|
|
159
149
|
* @method handleChange
|
|
160
150
|
* @description
|
|
161
151
|
* Handles value changes from the autocomplete component.
|
|
162
|
-
* Updates Angular Forms
|
|
152
|
+
* Updates Angular Forms and Signals. `model.set()` emits the model's
|
|
153
|
+
* auto-generated `modelChange` output — no separate emit needed.
|
|
163
154
|
*
|
|
164
155
|
* @param {AutocompleteValue<T>} value - The new selected value(s).
|
|
165
156
|
*/
|
|
@@ -168,7 +159,6 @@ class AutocompleteComponent {
|
|
|
168
159
|
this.onChangeFn(value);
|
|
169
160
|
this.onTouchedFn();
|
|
170
161
|
this.model.set(value);
|
|
171
|
-
this.modelChange.emit(value);
|
|
172
162
|
this.effectiveControl?.setValue(value);
|
|
173
163
|
this.effectiveControl?.markAsDirty();
|
|
174
164
|
}
|
|
@@ -203,13 +193,13 @@ class AutocompleteComponent {
|
|
|
203
193
|
return this.ngControl?.control || this.control();
|
|
204
194
|
}
|
|
205
195
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: AutocompleteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
206
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: AutocompleteComponent, isStandalone: true, selector: "tk-autocomplete", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, control: { classPropertyName: "control", publicName: "control", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { model: "modelChange"
|
|
196
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: AutocompleteComponent, isStandalone: true, selector: "tk-autocomplete", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, control: { classPropertyName: "control", publicName: "control", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { model: "modelChange" }, providers: [
|
|
207
197
|
{
|
|
208
198
|
provide: NG_VALUE_ACCESSOR,
|
|
209
199
|
useExisting: forwardRef(() => AutocompleteComponent),
|
|
210
200
|
multi: true,
|
|
211
201
|
},
|
|
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,
|
|
202
|
+
], 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-theme-l, var(--tk-borderRadius-full, 62.4375rem))!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:var(--tk-spacing-base-25, .25rem);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 }); }
|
|
213
203
|
}
|
|
214
204
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: AutocompleteComponent, decorators: [{
|
|
215
205
|
type: Component,
|
|
@@ -219,8 +209,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
219
209
|
useExisting: forwardRef(() => AutocompleteComponent),
|
|
220
210
|
multi: true,
|
|
221
211
|
},
|
|
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,
|
|
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"] }],
|
|
212
|
+
], 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-theme-l, var(--tk-borderRadius-full, 62.4375rem))!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:var(--tk-spacing-base-25, .25rem);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
|
+
}], 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"] }], autoComplete: [{ type: i0.ViewChild, args: [i0.forwardRef(() => AutoComplete), { isSignal: true }] }] } });
|
|
224
214
|
|
|
225
215
|
/**
|
|
226
216
|
* 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 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;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;QACH,IAAA,CAAA,KAAK,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA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,YAAY,CAAA,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AE9NrD;;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 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 // 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 and Signals. `model.set()` emits the model's\n * auto-generated `modelChange` output — no separate emit needed.\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.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":";;;;;;;;;;;MAsCa,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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AiB;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,00FAAA,CAAA,EAAA;w2BA8KsC,YAAY,CAAA,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AElNrD;;AAEG;;;;"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { IconComponent } from '@tekus/design-system/components/icon';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Maximum number of characters rendered by the `'text'` variant. This variant is
|
|
7
|
+
* designed for initials (e.g. `'AB'`); longer strings break the layout at every
|
|
8
|
+
* size, so `value` is always truncated to this length rather than allowed to overflow.
|
|
9
|
+
*/
|
|
10
|
+
const AVATAR_TEXT_MAX_LENGTH = 2;
|
|
11
|
+
/**
|
|
12
|
+
* @component AvatarComponent
|
|
13
|
+
* @description
|
|
14
|
+
* A component used to represent a user, entity, or placeholder with initials, an icon, or an image.
|
|
15
|
+
*
|
|
16
|
+
* This component supports:
|
|
17
|
+
* - `variant`: What the avatar displays. Options: `'text' | 'icon' | 'image'`.
|
|
18
|
+
* - `severity`: The color scheme of the avatar. Options: `'secondary' | 'primary' | 'contrast'`. Ignored when `variant` is `'image'`.
|
|
19
|
+
* - `size`: The size of the avatar. Options: `'s' | 'm' | 'l' | 'xl'`.
|
|
20
|
+
* - `value`: The initials to display for the `'text'` variant. Limited to 2 characters — longer values are truncated.
|
|
21
|
+
* - `icon`: The icon name to display for the `'icon'` variant, rendered via `tk-icon`.
|
|
22
|
+
* - `image` / `alt`: The image source and accessible text for the `'image'` variant.
|
|
23
|
+
* - `ariaLabel`: The accessible name for the `'text'` and `'icon'` variants.
|
|
24
|
+
*
|
|
25
|
+
* @usage
|
|
26
|
+
* ### Basic Usage
|
|
27
|
+
* ```html
|
|
28
|
+
* <tk-avatar variant="text" value="AB" severity="primary" size="m" ariaLabel="Ana Bermúdez"></tk-avatar>
|
|
29
|
+
* <tk-avatar variant="icon" icon="user" severity="secondary" size="m" ariaLabel="Usuario sin foto"></tk-avatar>
|
|
30
|
+
* <tk-avatar variant="image" image="/assets/avatar.png" alt="Ana Bermúdez" size="m"></tk-avatar>
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
class AvatarComponent {
|
|
34
|
+
constructor() {
|
|
35
|
+
/**
|
|
36
|
+
* What the avatar displays.
|
|
37
|
+
* @default 'text'
|
|
38
|
+
*/
|
|
39
|
+
this.variant = input('text', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
40
|
+
/**
|
|
41
|
+
* The color scheme of the avatar. Ignored when `variant` is `'image'`.
|
|
42
|
+
* @default 'secondary'
|
|
43
|
+
*/
|
|
44
|
+
this.severity = input('secondary', ...(ngDevMode ? [{ debugName: "severity" }] : /* istanbul ignore next */ []));
|
|
45
|
+
/**
|
|
46
|
+
* The size of the avatar.
|
|
47
|
+
* @default 'm'
|
|
48
|
+
*/
|
|
49
|
+
this.size = input('m', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
50
|
+
/**
|
|
51
|
+
* The initials to display. Only used when `variant` is `'text'`.
|
|
52
|
+
*
|
|
53
|
+
* Limited to {@link AVATAR_TEXT_MAX_LENGTH} characters — this variant is meant
|
|
54
|
+
* for initials (e.g. `'AB'`), not arbitrary text. Longer values are silently
|
|
55
|
+
* truncated (see `displayValue`) since they overflow the avatar at every size.
|
|
56
|
+
*/
|
|
57
|
+
this.value = input('', ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
58
|
+
/** The icon name to display, forwarded to `tk-icon`. Only used when `variant` is `'icon'`. */
|
|
59
|
+
this.icon = input('', ...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
|
|
60
|
+
/** The image source. Only used when `variant` is `'image'`. */
|
|
61
|
+
this.image = input('', ...(ngDevMode ? [{ debugName: "image" }] : /* istanbul ignore next */ []));
|
|
62
|
+
/** The accessible alt text for the image. Only used when `variant` is `'image'`. */
|
|
63
|
+
this.alt = input('', ...(ngDevMode ? [{ debugName: "alt" }] : /* istanbul ignore next */ []));
|
|
64
|
+
/**
|
|
65
|
+
* The accessible name announced by screen readers, for the `'text'` and
|
|
66
|
+
* `'icon'` variants. Should be the entity the avatar stands for (e.g. the
|
|
67
|
+
* user's full name), not a description of the graphic.
|
|
68
|
+
*
|
|
69
|
+
* Always worth setting: neither variant carries a meaningful name on its own —
|
|
70
|
+
* `'text'` would otherwise announce bare initials and `'icon'` the raw icon
|
|
71
|
+
* name. The `'image'` variant ignores this input and uses `alt` instead,
|
|
72
|
+
* since its `<img>` already provides the accessible name.
|
|
73
|
+
*/
|
|
74
|
+
this.ariaLabel = input('', ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
75
|
+
/**
|
|
76
|
+
* The `value` truncated to {@link AVATAR_TEXT_MAX_LENGTH} characters. This is
|
|
77
|
+
* what actually gets rendered for the `'text'` variant.
|
|
78
|
+
*/
|
|
79
|
+
this.displayValue = computed(() => this.value().slice(0, AVATAR_TEXT_MAX_LENGTH), ...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
|
|
80
|
+
/**
|
|
81
|
+
* Whether the avatar exposes itself as a labelled image to assistive tech.
|
|
82
|
+
* True for every variant except `'image'`, which is excluded because its
|
|
83
|
+
* `<img [alt]>` already carries the accessible name — adding `role="img"`
|
|
84
|
+
* plus a label on the wrapper too would announce the avatar twice.
|
|
85
|
+
*/
|
|
86
|
+
this.isLabelled = computed(() => this.variant() !== 'image', ...(ngDevMode ? [{ debugName: "isLabelled" }] : /* istanbul ignore next */ []));
|
|
87
|
+
/**
|
|
88
|
+
* The accessible name actually rendered for the `'text'` and `'icon'`
|
|
89
|
+
* variants. Falls back to the displayed initials or the icon name when
|
|
90
|
+
* `ariaLabel` is not provided, so the avatar is never fully silent.
|
|
91
|
+
*/
|
|
92
|
+
this.accessibleLabel = computed(() => this.ariaLabel() ||
|
|
93
|
+
(this.variant() === 'text' ? this.displayValue() : this.icon()), ...(ngDevMode ? [{ debugName: "accessibleLabel" }] : /* istanbul ignore next */ []));
|
|
94
|
+
/**
|
|
95
|
+
* Computed host class (BEM block + modifiers) combining `variant` and `size`
|
|
96
|
+
* always, plus `severity` unless `variant` is `'image'` (severity doesn't
|
|
97
|
+
* apply to images).
|
|
98
|
+
*/
|
|
99
|
+
this.hostClass = computed(() => {
|
|
100
|
+
const classes = ['tk-avatar', `tk-avatar--${this.variant()}`, `tk-avatar--${this.size()}`];
|
|
101
|
+
if (this.variant() !== 'image') {
|
|
102
|
+
classes.push(`tk-avatar--${this.severity()}`);
|
|
103
|
+
}
|
|
104
|
+
return classes.join(' ');
|
|
105
|
+
}, ...(ngDevMode ? [{ debugName: "hostClass" }] : /* istanbul ignore next */ []));
|
|
106
|
+
}
|
|
107
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: AvatarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
108
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: AvatarComponent, isStandalone: true, selector: "tk-avatar", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, severity: { classPropertyName: "severity", publicName: "severity", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, image: { classPropertyName: "image", publicName: "image", isSignal: true, isRequired: false, transformFunction: null }, alt: { classPropertyName: "alt", publicName: "alt", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "\n<div\n [class]=\"hostClass()\"\n [attr.role]=\"isLabelled() ? 'img' : null\"\n [attr.aria-label]=\"isLabelled() ? accessibleLabel() : null\">\n @switch (variant()) {\n @case ('text') {\n <span class=\"tk-avatar__value\">{{ displayValue() }}</span>\n }\n @case ('icon') {\n <tk-icon class=\"tk-avatar__glyph\" [icon]=\"icon()\" aria-hidden=\"true\" />\n }\n @case ('image') {\n <img class=\"tk-avatar__media\" [src]=\"image()\" [alt]=\"alt()\" />\n }\n }\n</div>\n", styles: [":host{display:inline-flex}.tk-avatar{display:flex;flex-shrink:0;align-items:center;justify-content:center;overflow:hidden;font-family:var(--tk-font-family, Poppins, sans-serif)}.tk-avatar__value{white-space:nowrap;-webkit-user-select:none;user-select:none}.tk-avatar__glyph{color:inherit}.tk-avatar__media{display:block;width:100%;height:100%;object-fit:cover}.tk-avatar--s{width:var(--tk-size-base-150, 1.5rem);height:var(--tk-size-base-150, 1.5rem);border-radius:var(--tk-borderRadius-theme-s, var(--tk-borderRadius-s, .5rem))}.tk-avatar--s .tk-avatar__value{font-weight:var(--tk-font-weight-400, 400);font-size:var(--tk-font-size-paragraph-s, .875rem)}.tk-avatar--s .tk-avatar__glyph{font-size:var(--tk-size-base-100, 1rem)}.tk-avatar--m{width:var(--tk-size-base-250, 2.5rem);height:var(--tk-size-base-250, 2.5rem);border-radius:var(--tk-borderRadius-theme-m, var(--tk-borderRadius-m, 1rem))}.tk-avatar--m .tk-avatar__value{font-weight:var(--tk-font-weight-600, 600);font-size:var(--tk-font-size-paragraph-m, 1rem)}.tk-avatar--m .tk-avatar__glyph{font-size:var(--tk-size-base-150, 1.5rem)}.tk-avatar--l{width:var(--tk-size-base-500, 5rem);height:var(--tk-size-base-500, 5rem);border-radius:var(--tk-borderRadius-theme-xl, var(--tk-borderRadius-l, 1.5rem))}.tk-avatar--l .tk-avatar__value{font-weight:var(--tk-font-weight-400, 400);font-size:var(--tk-font-size-headers-l, 2rem)}.tk-avatar--l .tk-avatar__glyph{font-size:var(--tk-size-base-250, 2.5rem)}.tk-avatar--xl{width:var(--tk-size-base-1000, 10rem);height:var(--tk-size-base-1000, 10rem);border-radius:var(--tk-borderRadius-theme-xl, var(--tk-borderRadius-l, 1.5rem))}.tk-avatar--xl .tk-avatar__value{font-weight:var(--tk-font-weight-400, 400);font-size:var(--tk-font-size-headers-xl, 2.5rem)}.tk-avatar--xl .tk-avatar__glyph{font-size:var(--tk-size-base-500, 5rem)}.tk-avatar--secondary{background-color:var(--tk-color-background-soft, #f2f1f1);color:var(--tk-color-text-default, #191a1b)}.tk-avatar--primary{background-color:var(--tk-color-primary-default, #16006f);color:var(--tk-color-text-inverse, #ffffff)}.tk-avatar--contrast{background-color:var(--tk-color-background-inverse, #191a1b);color:var(--tk-color-text-inverse, #ffffff)}\n"], dependencies: [{ kind: "component", type: IconComponent, selector: "tk-icon", inputs: ["icon", "styleIcon", "color", "size", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
109
|
+
}
|
|
110
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: AvatarComponent, decorators: [{
|
|
111
|
+
type: Component,
|
|
112
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'tk-avatar', imports: [IconComponent], template: "\n<div\n [class]=\"hostClass()\"\n [attr.role]=\"isLabelled() ? 'img' : null\"\n [attr.aria-label]=\"isLabelled() ? accessibleLabel() : null\">\n @switch (variant()) {\n @case ('text') {\n <span class=\"tk-avatar__value\">{{ displayValue() }}</span>\n }\n @case ('icon') {\n <tk-icon class=\"tk-avatar__glyph\" [icon]=\"icon()\" aria-hidden=\"true\" />\n }\n @case ('image') {\n <img class=\"tk-avatar__media\" [src]=\"image()\" [alt]=\"alt()\" />\n }\n }\n</div>\n", styles: [":host{display:inline-flex}.tk-avatar{display:flex;flex-shrink:0;align-items:center;justify-content:center;overflow:hidden;font-family:var(--tk-font-family, Poppins, sans-serif)}.tk-avatar__value{white-space:nowrap;-webkit-user-select:none;user-select:none}.tk-avatar__glyph{color:inherit}.tk-avatar__media{display:block;width:100%;height:100%;object-fit:cover}.tk-avatar--s{width:var(--tk-size-base-150, 1.5rem);height:var(--tk-size-base-150, 1.5rem);border-radius:var(--tk-borderRadius-theme-s, var(--tk-borderRadius-s, .5rem))}.tk-avatar--s .tk-avatar__value{font-weight:var(--tk-font-weight-400, 400);font-size:var(--tk-font-size-paragraph-s, .875rem)}.tk-avatar--s .tk-avatar__glyph{font-size:var(--tk-size-base-100, 1rem)}.tk-avatar--m{width:var(--tk-size-base-250, 2.5rem);height:var(--tk-size-base-250, 2.5rem);border-radius:var(--tk-borderRadius-theme-m, var(--tk-borderRadius-m, 1rem))}.tk-avatar--m .tk-avatar__value{font-weight:var(--tk-font-weight-600, 600);font-size:var(--tk-font-size-paragraph-m, 1rem)}.tk-avatar--m .tk-avatar__glyph{font-size:var(--tk-size-base-150, 1.5rem)}.tk-avatar--l{width:var(--tk-size-base-500, 5rem);height:var(--tk-size-base-500, 5rem);border-radius:var(--tk-borderRadius-theme-xl, var(--tk-borderRadius-l, 1.5rem))}.tk-avatar--l .tk-avatar__value{font-weight:var(--tk-font-weight-400, 400);font-size:var(--tk-font-size-headers-l, 2rem)}.tk-avatar--l .tk-avatar__glyph{font-size:var(--tk-size-base-250, 2.5rem)}.tk-avatar--xl{width:var(--tk-size-base-1000, 10rem);height:var(--tk-size-base-1000, 10rem);border-radius:var(--tk-borderRadius-theme-xl, var(--tk-borderRadius-l, 1.5rem))}.tk-avatar--xl .tk-avatar__value{font-weight:var(--tk-font-weight-400, 400);font-size:var(--tk-font-size-headers-xl, 2.5rem)}.tk-avatar--xl .tk-avatar__glyph{font-size:var(--tk-size-base-500, 5rem)}.tk-avatar--secondary{background-color:var(--tk-color-background-soft, #f2f1f1);color:var(--tk-color-text-default, #191a1b)}.tk-avatar--primary{background-color:var(--tk-color-primary-default, #16006f);color:var(--tk-color-text-inverse, #ffffff)}.tk-avatar--contrast{background-color:var(--tk-color-background-inverse, #191a1b);color:var(--tk-color-text-inverse, #ffffff)}\n"] }]
|
|
113
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], severity: [{ type: i0.Input, args: [{ isSignal: true, alias: "severity", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], image: [{ type: i0.Input, args: [{ isSignal: true, alias: "image", required: false }] }], alt: [{ type: i0.Input, args: [{ isSignal: true, alias: "alt", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }] } });
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Generated bundle index. Do not edit.
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
export { AVATAR_TEXT_MAX_LENGTH, AvatarComponent };
|
|
120
|
+
//# sourceMappingURL=tekus-design-system-components-avatar.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tekus-design-system-components-avatar.mjs","sources":["../../../projects/design-system/components/avatar/src/avatar.component.ts","../../../projects/design-system/components/avatar/src/avatar.component.html","../../../projects/design-system/components/avatar/tekus-design-system-components-avatar.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';\nimport { IconComponent } from '@tekus/design-system/components/icon';\n\nexport type AvatarVariant = 'text' | 'icon' | 'image';\nexport type AvatarSeverity = 'secondary' | 'primary' | 'contrast';\nexport type AvatarSize = 's' | 'm' | 'l' | 'xl';\n\n/**\n * Maximum number of characters rendered by the `'text'` variant. This variant is\n * designed for initials (e.g. `'AB'`); longer strings break the layout at every\n * size, so `value` is always truncated to this length rather than allowed to overflow.\n */\nexport const AVATAR_TEXT_MAX_LENGTH = 2;\n\n/**\n * @component AvatarComponent\n * @description\n * A component used to represent a user, entity, or placeholder with initials, an icon, or an image.\n *\n * This component supports:\n * - `variant`: What the avatar displays. Options: `'text' | 'icon' | 'image'`.\n * - `severity`: The color scheme of the avatar. Options: `'secondary' | 'primary' | 'contrast'`. Ignored when `variant` is `'image'`.\n * - `size`: The size of the avatar. Options: `'s' | 'm' | 'l' | 'xl'`.\n * - `value`: The initials to display for the `'text'` variant. Limited to 2 characters — longer values are truncated.\n * - `icon`: The icon name to display for the `'icon'` variant, rendered via `tk-icon`.\n * - `image` / `alt`: The image source and accessible text for the `'image'` variant.\n * - `ariaLabel`: The accessible name for the `'text'` and `'icon'` variants.\n *\n * @usage\n * ### Basic Usage\n * ```html\n * <tk-avatar variant=\"text\" value=\"AB\" severity=\"primary\" size=\"m\" ariaLabel=\"Ana Bermúdez\"></tk-avatar>\n * <tk-avatar variant=\"icon\" icon=\"user\" severity=\"secondary\" size=\"m\" ariaLabel=\"Usuario sin foto\"></tk-avatar>\n * <tk-avatar variant=\"image\" image=\"/assets/avatar.png\" alt=\"Ana Bermúdez\" size=\"m\"></tk-avatar>\n * ```\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n selector: 'tk-avatar',\n imports: [IconComponent],\n templateUrl: './avatar.component.html',\n styleUrl: './avatar.component.scss',\n})\nexport class AvatarComponent {\n /**\n * What the avatar displays.\n * @default 'text'\n */\n variant = input<AvatarVariant>('text');\n\n /**\n * The color scheme of the avatar. Ignored when `variant` is `'image'`.\n * @default 'secondary'\n */\n severity = input<AvatarSeverity>('secondary');\n\n /**\n * The size of the avatar.\n * @default 'm'\n */\n size = input<AvatarSize>('m');\n\n /**\n * The initials to display. Only used when `variant` is `'text'`.\n *\n * Limited to {@link AVATAR_TEXT_MAX_LENGTH} characters — this variant is meant\n * for initials (e.g. `'AB'`), not arbitrary text. Longer values are silently\n * truncated (see `displayValue`) since they overflow the avatar at every size.\n */\n value = input<string>('');\n\n /** The icon name to display, forwarded to `tk-icon`. Only used when `variant` is `'icon'`. */\n icon = input<string>('');\n\n /** The image source. Only used when `variant` is `'image'`. */\n image = input<string>('');\n\n /** The accessible alt text for the image. Only used when `variant` is `'image'`. */\n alt = input<string>('');\n\n /**\n * The accessible name announced by screen readers, for the `'text'` and\n * `'icon'` variants. Should be the entity the avatar stands for (e.g. the\n * user's full name), not a description of the graphic.\n *\n * Always worth setting: neither variant carries a meaningful name on its own —\n * `'text'` would otherwise announce bare initials and `'icon'` the raw icon\n * name. The `'image'` variant ignores this input and uses `alt` instead,\n * since its `<img>` already provides the accessible name.\n */\n ariaLabel = input<string>('');\n\n /**\n * The `value` truncated to {@link AVATAR_TEXT_MAX_LENGTH} characters. This is\n * what actually gets rendered for the `'text'` variant.\n */\n displayValue = computed(() => this.value().slice(0, AVATAR_TEXT_MAX_LENGTH));\n\n /**\n * Whether the avatar exposes itself as a labelled image to assistive tech.\n * True for every variant except `'image'`, which is excluded because its\n * `<img [alt]>` already carries the accessible name — adding `role=\"img\"`\n * plus a label on the wrapper too would announce the avatar twice.\n */\n isLabelled = computed(() => this.variant() !== 'image');\n\n /**\n * The accessible name actually rendered for the `'text'` and `'icon'`\n * variants. Falls back to the displayed initials or the icon name when\n * `ariaLabel` is not provided, so the avatar is never fully silent.\n */\n accessibleLabel = computed(\n () =>\n this.ariaLabel() ||\n (this.variant() === 'text' ? this.displayValue() : this.icon())\n );\n\n /**\n * Computed host class (BEM block + modifiers) combining `variant` and `size`\n * always, plus `severity` unless `variant` is `'image'` (severity doesn't\n * apply to images).\n */\n hostClass = computed(() => {\n const classes = ['tk-avatar', `tk-avatar--${this.variant()}`, `tk-avatar--${this.size()}`];\n if (this.variant() !== 'image') {\n classes.push(`tk-avatar--${this.severity()}`);\n }\n return classes.join(' ');\n });\n}\n","\n<div\n [class]=\"hostClass()\"\n [attr.role]=\"isLabelled() ? 'img' : null\"\n [attr.aria-label]=\"isLabelled() ? accessibleLabel() : null\">\n @switch (variant()) {\n @case ('text') {\n <span class=\"tk-avatar__value\">{{ displayValue() }}</span>\n }\n @case ('icon') {\n <tk-icon class=\"tk-avatar__glyph\" [icon]=\"icon()\" aria-hidden=\"true\" />\n }\n @case ('image') {\n <img class=\"tk-avatar__media\" [src]=\"image()\" [alt]=\"alt()\" />\n }\n }\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAOA;;;;AAIG;AACI,MAAM,sBAAsB,GAAG;AAEtC;;;;;;;;;;;;;;;;;;;;;AAqBG;MAQU,eAAe,CAAA;AAP5B,IAAA,WAAA,GAAA;AAQE;;;AAGG;AACH,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAgB,MAAM,8EAAC;AAEtC;;;AAGG;AACH,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAiB,WAAW,+EAAC;AAE7C;;;AAGG;AACH,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAa,GAAG,2EAAC;AAE7B;;;;;;AAMG;AACH,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAS,EAAE,4EAAC;;AAGzB,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAS,EAAE,2EAAC;;AAGxB,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAS,EAAE,4EAAC;;AAGzB,QAAA,IAAA,CAAA,GAAG,GAAG,KAAK,CAAS,EAAE,0EAAC;AAEvB;;;;;;;;;AASG;AACH,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK,CAAS,EAAE,gFAAC;AAE7B;;;AAGG;AACH,QAAA,IAAA,CAAA,YAAY,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,sBAAsB,CAAC,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,MAAA,EAAA,WAAA,EAAA,OAAA,EAAA,MAAA,EAAA,UAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;4FAIZ,eAAe,EAAA,UAAA,EAAA,CAAA;kBAP3B,SAAS;AACS,YAAA,IAAA,EAAA,CAAA,EAAA,eAAA,EAAA,uBAAuB,CAAC,MAAM,EAAA,QAAA,EACrC,WAAW,EAAA,OAAA,EACZ,CAAC,aAAa,CAAC,EAAA,QAAA,EAAA,yfAAA,EAAA,MAAA,EAAA,CAAA,wpEAAA,CAAA,EAAA;;;AEvC1B;;AAEG;;;;"}
|
|
@@ -169,13 +169,13 @@ class ButtonComponent {
|
|
|
169
169
|
this.clicked.emit('mouse');
|
|
170
170
|
}
|
|
171
171
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
172
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", 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 }, iconPosition: { classPropertyName: "iconPosition", publicName: "iconPosition", isSignal: true, isRequired: false, transformFunction: null }, tooltipText: { classPropertyName: "tooltipText", publicName: "tooltipText", isSignal: true, isRequired: false, transformFunction: null }, full: { classPropertyName: "full", publicName: "full", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { clicked: "clicked" }, host: { properties: { "class.tk-button--full": "full()" } }, ngImport: i0, template: "<p-button\n [styleClass]=\"'tk-button'\"\n [disabled]=\"disabled()\"\n [type]=\"type()\"\n [severity]=\"link() ? undefined : severity()\"\n [variant]=\"variant()\"\n [link]=\"link()\"\n [size]=\"size()\"\n [fluid]=\"full()\"\n [ariaLabel]=\"ariaLabel()\"\n [pTooltip]=\"tooltipText()\"\n tooltipPosition=\"top\"\n (click)=\"onButtonClick()\"\n (keydown.enter)=\"onButtonClick()\"\n (keydown.space)=\"onButtonClick()\">\n\n @if (icon() && iconPosition() === 'left') {\n <tk-icon [icon]=\"icon()!\"></tk-icon>\n }\n\n @if (label()) {\n <span class=\"p-button-label\">{{ label() }}</span>\n }\n\n @if (icon() && iconPosition() === 'right') {\n <tk-icon [icon]=\"icon()!\"></tk-icon>\n }\n</p-button>\n", styles: [":host{display:inline-flex;vertical-align:middle}:host(.tk-button--full){display:flex;width:100%}:host(.tk-button--full) ::ng-deep p-button{display:flex;width:100%}:host ::ng-deep .p-button{min-width:var(--tk-size-base-250, 2.5rem)}:host ::ng-deep .p-button.p-button-sm{min-width:var(--tk-spacing-padding-xl, 1.5rem);height:var(--tk-spacing-padding-xl, 1.5rem);padding:0;display:flex;align-items:center;justify-content:center;line-height:1}:host ::ng-deep .p-button.p-button-sm.p-button-icon-only{width:var(--tk-spacing-padding-xl, 1.5rem)}:host ::ng-deep .p-button.p-button-sm ::ng-deep tk-icon{display:flex;align-items:center;justify-content:center}:host ::ng-deep .p-button.p-button-sm ::ng-deep tk-icon svg{width:1rem;height:1rem}:host ::ng-deep .p-button{display:inline-flex;align-items:center;gap:var(--tk-spacing-padding-xs, .5rem)}:host ::ng-deep .p-button tk-icon{display:flex}: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 }); }
|
|
172
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", 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 }, iconPosition: { classPropertyName: "iconPosition", publicName: "iconPosition", isSignal: true, isRequired: false, transformFunction: null }, tooltipText: { classPropertyName: "tooltipText", publicName: "tooltipText", isSignal: true, isRequired: false, transformFunction: null }, full: { classPropertyName: "full", publicName: "full", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { clicked: "clicked" }, host: { properties: { "class.tk-button--full": "full()" } }, ngImport: i0, template: "<p-button\n [styleClass]=\"'tk-button'\"\n [disabled]=\"disabled()\"\n [type]=\"type()\"\n [severity]=\"link() ? undefined : severity()\"\n [variant]=\"variant()\"\n [link]=\"link()\"\n [size]=\"size()\"\n [fluid]=\"full()\"\n [ariaLabel]=\"ariaLabel()\"\n [pTooltip]=\"tooltipText()\"\n tooltipPosition=\"top\"\n (click)=\"onButtonClick()\"\n (keydown.enter)=\"onButtonClick()\"\n (keydown.space)=\"onButtonClick()\">\n\n @if (icon() && iconPosition() === 'left') {\n <tk-icon [icon]=\"icon()!\"></tk-icon>\n }\n\n @if (label()) {\n <span class=\"p-button-label\">{{ label() }}</span>\n }\n\n @if (icon() && iconPosition() === 'right') {\n <tk-icon [icon]=\"icon()!\"></tk-icon>\n }\n</p-button>\n", styles: [":host{display:inline-flex;vertical-align:middle}:host(.tk-button--full){display:flex;width:100%}:host(.tk-button--full) ::ng-deep p-button{display:flex;width:100%}:host ::ng-deep .p-button{min-width:var(--tk-size-base-250, 2.5rem)}:host ::ng-deep .p-button.p-button-sm{min-width:var(--tk-spacing-padding-xl, 1.5rem);height:var(--tk-spacing-padding-xl, 1.5rem);padding:0;display:flex;align-items:center;justify-content:center;line-height:1}:host ::ng-deep .p-button.p-button-sm.p-button-icon-only{width:var(--tk-spacing-padding-xl, 1.5rem)}:host ::ng-deep .p-button.p-button-sm ::ng-deep tk-icon{display:flex;align-items:center;justify-content:center}:host ::ng-deep .p-button.p-button-sm ::ng-deep tk-icon svg{width:var(--tk-size-base-100, 1rem);height:var(--tk-size-base-100, 1rem)}:host ::ng-deep .p-button{display:inline-flex;align-items:center;gap:var(--tk-spacing-padding-xs, .5rem)}:host ::ng-deep .p-button tk-icon{display:flex}: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 }); }
|
|
173
173
|
}
|
|
174
174
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: ButtonComponent, decorators: [{
|
|
175
175
|
type: Component,
|
|
176
176
|
args: [{ selector: 'tk-button', imports: [ButtonModule, IconComponent, Tooltip], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
177
177
|
'[class.tk-button--full]': 'full()',
|
|
178
|
-
}, template: "<p-button\n [styleClass]=\"'tk-button'\"\n [disabled]=\"disabled()\"\n [type]=\"type()\"\n [severity]=\"link() ? undefined : severity()\"\n [variant]=\"variant()\"\n [link]=\"link()\"\n [size]=\"size()\"\n [fluid]=\"full()\"\n [ariaLabel]=\"ariaLabel()\"\n [pTooltip]=\"tooltipText()\"\n tooltipPosition=\"top\"\n (click)=\"onButtonClick()\"\n (keydown.enter)=\"onButtonClick()\"\n (keydown.space)=\"onButtonClick()\">\n\n @if (icon() && iconPosition() === 'left') {\n <tk-icon [icon]=\"icon()!\"></tk-icon>\n }\n\n @if (label()) {\n <span class=\"p-button-label\">{{ label() }}</span>\n }\n\n @if (icon() && iconPosition() === 'right') {\n <tk-icon [icon]=\"icon()!\"></tk-icon>\n }\n</p-button>\n", styles: [":host{display:inline-flex;vertical-align:middle}:host(.tk-button--full){display:flex;width:100%}:host(.tk-button--full) ::ng-deep p-button{display:flex;width:100%}:host ::ng-deep .p-button{min-width:var(--tk-size-base-250, 2.5rem)}:host ::ng-deep .p-button.p-button-sm{min-width:var(--tk-spacing-padding-xl, 1.5rem);height:var(--tk-spacing-padding-xl, 1.5rem);padding:0;display:flex;align-items:center;justify-content:center;line-height:1}:host ::ng-deep .p-button.p-button-sm.p-button-icon-only{width:var(--tk-spacing-padding-xl, 1.5rem)}:host ::ng-deep .p-button.p-button-sm ::ng-deep tk-icon{display:flex;align-items:center;justify-content:center}:host ::ng-deep .p-button.p-button-sm ::ng-deep tk-icon svg{width:1rem;height:1rem}:host ::ng-deep .p-button{display:inline-flex;align-items:center;gap:var(--tk-spacing-padding-xs, .5rem)}:host ::ng-deep .p-button tk-icon{display:flex}: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"] }]
|
|
178
|
+
}, template: "<p-button\n [styleClass]=\"'tk-button'\"\n [disabled]=\"disabled()\"\n [type]=\"type()\"\n [severity]=\"link() ? undefined : severity()\"\n [variant]=\"variant()\"\n [link]=\"link()\"\n [size]=\"size()\"\n [fluid]=\"full()\"\n [ariaLabel]=\"ariaLabel()\"\n [pTooltip]=\"tooltipText()\"\n tooltipPosition=\"top\"\n (click)=\"onButtonClick()\"\n (keydown.enter)=\"onButtonClick()\"\n (keydown.space)=\"onButtonClick()\">\n\n @if (icon() && iconPosition() === 'left') {\n <tk-icon [icon]=\"icon()!\"></tk-icon>\n }\n\n @if (label()) {\n <span class=\"p-button-label\">{{ label() }}</span>\n }\n\n @if (icon() && iconPosition() === 'right') {\n <tk-icon [icon]=\"icon()!\"></tk-icon>\n }\n</p-button>\n", styles: [":host{display:inline-flex;vertical-align:middle}:host(.tk-button--full){display:flex;width:100%}:host(.tk-button--full) ::ng-deep p-button{display:flex;width:100%}:host ::ng-deep .p-button{min-width:var(--tk-size-base-250, 2.5rem)}:host ::ng-deep .p-button.p-button-sm{min-width:var(--tk-spacing-padding-xl, 1.5rem);height:var(--tk-spacing-padding-xl, 1.5rem);padding:0;display:flex;align-items:center;justify-content:center;line-height:1}:host ::ng-deep .p-button.p-button-sm.p-button-icon-only{width:var(--tk-spacing-padding-xl, 1.5rem)}:host ::ng-deep .p-button.p-button-sm ::ng-deep tk-icon{display:flex;align-items:center;justify-content:center}:host ::ng-deep .p-button.p-button-sm ::ng-deep tk-icon svg{width:var(--tk-size-base-100, 1rem);height:var(--tk-size-base-100, 1rem)}:host ::ng-deep .p-button{display:inline-flex;align-items:center;gap:var(--tk-spacing-padding-xs, .5rem)}:host ::ng-deep .p-button tk-icon{display:flex}: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"] }]
|
|
179
179
|
}], 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 }] }], iconPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconPosition", required: false }] }], clicked: [{ type: i0.Output, args: ["clicked"] }], tooltipText: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipText", required: false }] }], full: [{ type: i0.Input, args: [{ isSignal: true, alias: "full", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
|
|
180
180
|
|
|
181
181
|
/**
|
|
@@ -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 { 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 host: {\n '[class.tk-button--full]': 'full()',\n },\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 * @property {'left' | 'right'} iconPosition\n * @description\n * Defines the position of the icon relative to the label.\n *\n * @default `'left'`\n */\n iconPosition = input<'left' | 'right'>('left');\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 * @property {boolean} full\n * @description\n * When true, the button stretches to fill the full width of its container.\n * Unlike `size`, which scales typography and padding, this only affects\n * how much horizontal space the button occupies.\n *\n * @default `false`\n */\n full = input<boolean>(false);\n\n /**\n * @property {string} ariaLabel\n * @description\n * Accessible label forwarded to the native button. Required for\n * icon-only buttons, where there is no visible label to announce.\n *\n * @default `undefined`\n */\n ariaLabel = input<string>();\n\n /**\n * @property {'small' | 'large' | undefined} size\n * @description\n * Defines the size of the button.\n * - `'small'`: Small button.\n * - `'large'`: Large button.\n * - `undefined`: Default size.\n *\n * @default `undefined`\n */\n size = input<'small' | 'large' | undefined>();\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 [styleClass]=\"'tk-button'\"\n [disabled]=\"disabled()\"\n [type]=\"type()\"\n [severity]=\"link() ? undefined : severity()\"\n [variant]=\"variant()\"\n [link]=\"link()\"\n [size]=\"size()\"\n [fluid]=\"full()\"\n [ariaLabel]=\"ariaLabel()\"\n [pTooltip]=\"tooltipText()\"\n tooltipPosition=\"top\"\n (click)=\"onButtonClick()\"\n (keydown.enter)=\"onButtonClick()\"\n (keydown.space)=\"onButtonClick()\">\n\n @if (icon() && iconPosition() === 'left') {\n <tk-icon [icon]=\"icon()!\"></tk-icon>\n }\n\n @if (label()) {\n <span class=\"p-button-label\">{{ label() }}</span>\n }\n\n @if (icon() && iconPosition() === 'right') {\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;MAWU,eAAe,CAAA;AAV5B,IAAA,WAAA,GAAA;AAWE;;;;;;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,CAAA,QAAQ,GAAG,KAAK,CAAU,KAAK,+EAAC;AAEhC;;;;;;;;AAQG;AACH,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAsB,QAAQ,2EAAC;AAE3C;;;;;;;;;AASG;AACH,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAiB,SAAS,+EAAC;AAE3C;;;;;;;;AAQG;QACH,IAAA,CAAA,OAAO,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,SAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAW;AAE1B;;;;;;AAMG;AACH,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAU,KAAK,2EAAC;AAE5B;;;;;;;AAOG;QACH,IAAA,CAAA,IAAI,GAAG,KAAK,CAAA,IAAA,SAAA,G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CAAA,
|
|
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 host: {\n '[class.tk-button--full]': 'full()',\n },\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 * @property {'left' | 'right'} iconPosition\n * @description\n * Defines the position of the icon relative to the label.\n *\n * @default `'left'`\n */\n iconPosition = input<'left' | 'right'>('left');\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 * @property {boolean} full\n * @description\n * When true, the button stretches to fill the full width of its container.\n * Unlike `size`, which scales typography and padding, this only affects\n * how much horizontal space the button occupies.\n *\n * @default `false`\n */\n full = input<boolean>(false);\n\n /**\n * @property {string} ariaLabel\n * @description\n * Accessible label forwarded to the native button. Required for\n * icon-only buttons, where there is no visible label to announce.\n *\n * @default `undefined`\n */\n ariaLabel = input<string>();\n\n /**\n * @property {'small' | 'large' | undefined} size\n * @description\n * Defines the size of the button.\n * - `'small'`: Small button.\n * - `'large'`: Large button.\n * - `undefined`: Default size.\n *\n * @default `undefined`\n */\n size = input<'small' | 'large' | undefined>();\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 [styleClass]=\"'tk-button'\"\n [disabled]=\"disabled()\"\n [type]=\"type()\"\n [severity]=\"link() ? undefined : severity()\"\n [variant]=\"variant()\"\n [link]=\"link()\"\n [size]=\"size()\"\n [fluid]=\"full()\"\n [ariaLabel]=\"ariaLabel()\"\n [pTooltip]=\"tooltipText()\"\n tooltipPosition=\"top\"\n (click)=\"onButtonClick()\"\n (keydown.enter)=\"onButtonClick()\"\n (keydown.space)=\"onButtonClick()\">\n\n @if (icon() && iconPosition() === 'left') {\n <tk-icon [icon]=\"icon()!\"></tk-icon>\n }\n\n @if (label()) {\n <span class=\"p-button-label\">{{ label() }}</span>\n }\n\n @if (icon() && iconPosition() === 'right') {\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;MAWU,eAAe,CAAA;AAV5B,IAAA,WAAA,GAAA;AAWE;;;;;;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,CAAA,QAAQ,GAAG,KAAK,CAAU,KAAK,+EAAC;AAEhC;;;;;;;;AAQG;AACH,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAsB,QAAQ,2EAAC;AAE3C;;;;;;;;;AASG;AACH,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAiB,SAAS,+EAAC;AAE3C;;;;;;;;AAQG;QACH,IAAA,CAAA,OAAO,GAAG,KA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,EAAA,kBAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;4FAQnC,eAAe,EAAA,UAAA,EAAA,CAAA;kBAV3B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,WAAW,EAAA,OAAA,EACZ,CAAC,YAAY,EAAE,aAAa,EAAE,OAAO,CAAC,EAAA,eAAA,EAG9B,uBAAuB,CAAC,MAAM,EAAA,IAAA,EACzC;AACJ,wBAAA,yBAAyB,EAAE,QAAQ;AACpC,qBAAA,EAAA,QAAA,EAAA,ytBAAA,EAAA,MAAA,EAAA,CAAA,k2DAAA,CAAA,EAAA;;;AE3CH;;AAEG;;;;"}
|
|
@@ -119,7 +119,7 @@ class CardComponent {
|
|
|
119
119
|
return 'primary';
|
|
120
120
|
}
|
|
121
121
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: CardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
122
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: CardComponent, isStandalone: true, selector: "tk-card", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: true, transformFunction: null }, titleLink: { classPropertyName: "titleLink", publicName: "titleLink", isSignal: true, isRequired: false, transformFunction: null }, titleHref: { classPropertyName: "titleHref", publicName: "titleHref", isSignal: true, isRequired: false, transformFunction: null }, titleIcon: { classPropertyName: "titleIcon", publicName: "titleIcon", isSignal: true, isRequired: false, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: false, transformFunction: null }, image: { classPropertyName: "image", publicName: "image", isSignal: true, isRequired: false, transformFunction: null }, showImage: { classPropertyName: "showImage", publicName: "showImage", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, selectable: { classPropertyName: "selectable", publicName: "selectable", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null }, badgeText: { classPropertyName: "badgeText", publicName: "badgeText", isSignal: true, isRequired: false, transformFunction: null }, secondaryBadgeText: { classPropertyName: "secondaryBadgeText", publicName: "secondaryBadgeText", isSignal: true, isRequired: false, transformFunction: null }, connectionStatusDate: { classPropertyName: "connectionStatusDate", publicName: "connectionStatusDate", isSignal: true, isRequired: false, transformFunction: null }, connectionStatusSeverity: { classPropertyName: "connectionStatusSeverity", publicName: "connectionStatusSeverity", isSignal: true, isRequired: false, transformFunction: null }, actions: { classPropertyName: "actions", publicName: "actions", isSignal: true, isRequired: false, transformFunction: null }, actionGroup: { classPropertyName: "actionGroup", publicName: "actionGroup", isSignal: true, isRequired: false, transformFunction: null }, actionGroupMaxVisible: { classPropertyName: "actionGroupMaxVisible", publicName: "actionGroupMaxVisible", isSignal: true, isRequired: false, transformFunction: null }, actionGroupDisabled: { classPropertyName: "actionGroupDisabled", publicName: "actionGroupDisabled", isSignal: true, isRequired: false, transformFunction: null }, infoElements: { classPropertyName: "infoElements", publicName: "infoElements", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selectedChange" }, ngImport: i0, template: "<div \n class=\"tk-card\" \n [class.tk-card-horizontal]=\"layout() === 'horizontal'\"\n [class.tk-card-selectable]=\"selectable()\"\n [class.tk-card-selected]=\"selectable() && selected()\"\n [class.tk-card-no-image]=\"!showImage()\"\n [attr.aria-pressed]=\"selectable() ? selected() : null\">\n \n <!-- Header: Selection, Metadata, and Actions -->\n @if (selectable() || badgeText() || secondaryBadgeText() || connectionStatusDate() || actions().length > 0 || actionGroup().length > 0) {\n <div class=\"tk-card-header\">\n <div class=\"tk-card-header-left\">\n @if (selectable()) {\n <div \n class=\"tk-card-selection\" \n tabindex=\"-1\">\n <tk-checkbox [binary]=\"true\" [(model)]=\"selected\"></tk-checkbox>\n </div>\n }\n @if (badgeText() || secondaryBadgeText() || connectionStatusDate()) {\n <div class=\"tk-card-metadata\">\n @if (badgeText()) {\n <tk-tag [value]=\"badgeText()!\"></tk-tag>\n }\n @if (connectionStatusDate()) {\n <tk-time-ago [dateTime]=\"connectionStatusDate()!\" [severity]=\"connectionStatusSeverity()\"></tk-time-ago>\n }\n @if (secondaryBadgeText()) {\n <span class=\"tk-card-metadata-secondary\">{{ secondaryBadgeText() }}</span>\n }\n </div>\n }\n </div>\n\n <div \n class=\"tk-card-actions\" \n tabindex=\"-1\">\n <!-- Single Action -->\n @for (action of visibleActions(); track action.id) {\n <tk-button \n [icon]=\"action.icon\" \n [severity]=\"getButtonSeverity(action.severity)\"\n variant=\"text\"\n [disabled]=\"action.disabled || false\"\n [tooltipText]=\"action.label\"\n size=\"small\"\n (clicked)=\"action.handler()\">\n </tk-button>\n }\n\n <!-- Multiple Actions Dropdown -->\n @if (hasOverflowActions()) {\n <tk-dropdown [model]=\"menuItems()\" size=\"small\"></tk-dropdown>\n }\n\n <!-- Action Group -->\n @if (actionGroup().length > 0) {\n <tk-action-group\n [actions]=\"actionGroup()\"\n [maxVisible]=\"actionGroupMaxVisible()\"\n [disabled]=\"actionGroupDisabled()\"\n ></tk-action-group>\n }\n </div>\n </div>\n }\n\n <!-- Image Section -->\n @if (showImage()) {\n <div class=\"tk-card-image-container\">\n @if (image()) {\n <div \n class=\"tk-card-image\" \n [style.background-image]=\"'url(' + image() + ')'\">\n </div>\n } @else {\n <div class=\"tk-card-image-placeholder\">\n <tk-icon icon=\"image\" size=\"lg\"></tk-icon>\n </div>\n }\n </div>\n }\n\n <!-- Content Section -->\n <div class=\"tk-card-content\">\n <div class=\"tk-card-body\">\n <h3 class=\"tk-card-title\" [class.tk-card-title--link]=\"titleLink() || titleHref()\">\n @if (titleLink()) {\n <a [routerLink]=\"titleLink()!\" class=\"tk-card-title-link\">\n @if (titleIcon()) {\n <tk-icon [icon]=\"titleIcon()!\" size=\"sm\"></tk-icon>\n }\n {{ title() }}\n </a>\n } @else if (titleHref()) {\n <a [href]=\"titleHref()!\" class=\"tk-card-title-link\">\n @if (titleIcon()) {\n <tk-icon [icon]=\"titleIcon()!\" size=\"sm\"></tk-icon>\n }\n {{ title() }}\n </a>\n } @else {\n @if (titleIcon()) {\n <tk-icon [icon]=\"titleIcon()!\" size=\"sm\"></tk-icon>\n }\n {{ title() }}\n }\n </h3>\n @if (description()) {\n <p class=\"tk-card-description\">{{ description() }}</p>\n }\n </div>\n\n @if (infoElements().length > 0) {\n <div class=\"tk-card-info-elements\">\n @for (element of infoElements(); track $index) {\n <div class=\"tk-card-info-item\">\n @switch (element.type) {\n @case ('progress-bar') {\n <div class=\"tk-card-info-progress\">\n @if (element.label) {\n <span class=\"tk-card-info-progress-label\">{{ element.label }}</span>\n }\n <tk-progress-bar [value]=\"element.value || 0\" size=\"small\"></tk-progress-bar>\n </div>\n }\n @case ('tag') {\n <tk-tag [value]=\"element.label || ''\" [severity]=\"element.severity || 'secondary'\"></tk-tag>\n }\n @case ('chip') {\n <!-- Using tag for chips as per design system style -->\n <tk-tag [value]=\"element.label || ''\" [severity]=\"element.severity || 'secondary'\"></tk-tag>\n }\n @case ('status-bar') {\n <tk-status-bar \n [label]=\"element.label || ''\" \n [barLabel]=\"element.barLabel || ''\"\n [severity]=\"getStatusBarSeverity(element.severity)\">\n </tk-status-bar>\n }\n @case ('button') {\n <tk-button \n [label]=\"element.label\" \n [icon]=\"element.icon\" \n [severity]=\"getButtonSeverity(element.severity)\"\n size=\"small\"\n (clicked)=\"element.handler ? element.handler() : null\">\n </tk-button>\n }\n @case ('icon') {\n <tk-icon [icon]=\"element.icon || ''\"></tk-icon>\n }\n @case ('string') {\n <span class=\"tk-card-info-text\">{{ element.label }}</span>\n }\n }\n </div>\n }\n </div>\n }\n </div>\n</div>\n", styles: [":host{display:block;width:100%}.tk-card{background-color:var(--tk-color-base-surface-0);border:1px solid var(--tk-color-base-surface-200);border-radius:var(--tk-borderRadius-m);display:flex;flex-direction:column;position:relative;overflow:hidden;transition:all .2s cubic-bezier(.4,0,.2,1);width:100%;box-shadow:0 1px 3px rgba(var(--tk-color-base-surface-1000),.05)}.tk-card.tk-card-selectable:hover{border-color:var(--tk-color-base-primary-300);box-shadow:0 4px 12px rgba(var(--tk-color-base-surface-1000),.08);transform:translateY(-2px)}.tk-card.tk-card-selected{border-color:var(--tk-color-base-primary-500);background-color:var(--tk-color-base-sky-100)}.tk-card .tk-card-header{display:flex;justify-content:space-between;align-items:center;padding:var(--tk-spacing-padding-s);min-height:var(--tk-spacing-base-300);z-index:2}.tk-card .tk-card-header .tk-card-header-left{display:flex;align-items:center;gap:var(--tk-spacing-base-100)}.tk-card .tk-card-header .tk-card-metadata{display:flex;align-items:center;gap:var(--tk-spacing-base-75)}.tk-card .tk-card-header .tk-card-metadata tk-tag ::ng-deep .p-tag{background-color:var(--tk-color-base-surface-100)!important;color:var(--tk-color-text-default)!important;font-weight:500}.tk-card .tk-card-header .tk-card-metadata .tk-card-metadata-secondary{font-size:var(--tk-font-size-legal-m);color:var(--tk-color-text-subtle);font-weight:400}.tk-card .tk-card-header .tk-card-actions{display:flex;align-items:center;gap:var(--tk-spacing-base-25)}.tk-card .tk-card-image-container{background-color:var(--tk-color-base-surface-100);display:flex;justify-content:center;align-items:center;width:100%;position:relative}.tk-card .tk-card-image-container .tk-card-image{width:100%;height:100%;background-size:contain;background-position:center;background-repeat:no-repeat}.tk-card .tk-card-image-container .tk-card-image-placeholder{color:var(--tk-color-base-surface-400);display:flex;justify-content:center;align-items:center;width:100%;height:100%}.tk-card .tk-card-image-container .tk-card-image-placeholder tk-icon{font-size:3rem;opacity:.5}.tk-card .tk-card-content{padding:var(--tk-spacing-padding-m);display:flex;flex-direction:column;gap:var(--tk-spacing-gap-xs);flex:1}.tk-card .tk-card-content .tk-card-body{display:flex;flex-direction:column;gap:var(--tk-spacing-base-25)}.tk-card .tk-card-content .tk-card-title{margin:0;font-size:var(--tk-font-size-paragraph-m);font-weight:var(--tk-font-weight-600);color:var(--tk-color-text-default);display:flex;align-items:center;gap:var(--tk-spacing-base-50);line-height:normal}.tk-card .tk-card-content .tk-card-title.tk-card-title--link{cursor:pointer}.tk-card .tk-card-content .tk-card-title .tk-card-title-link{color:inherit;text-decoration:none;display:flex;align-items:center;gap:inherit;width:100%;transition:opacity .2s ease-in-out}.tk-card .tk-card-content .tk-card-title .tk-card-title-link:hover{opacity:.7}.tk-card .tk-card-content .tk-card-description{margin:0;font-size:var(--tk-font-size-paragraph-s);color:var(--tk-color-text-subtle);line-height:1.5}.tk-card .tk-card-content .tk-card-info-elements{display:flex;flex-direction:column;gap:var(--tk-spacing-base-100);margin-top:auto}.tk-card .tk-card-content .tk-card-info-progress{display:flex;flex-direction:row;align-items:center;gap:var(--tk-spacing-base-75)}.tk-card .tk-card-content .tk-card-info-progress .tk-card-info-progress-label{font-size:var(--tk-font-size-legal-m);font-weight:600;color:var(--tk-color-text-default);min-width:fit-content}.tk-card .tk-card-content .tk-card-info-progress tk-progress-bar{flex:1}.tk-card .tk-card-content .tk-card-info-text{font-size:var(--tk-font-size-legal-m);color:var(--tk-color-text-default);line-height:normal}.tk-card.tk-card-horizontal{flex-direction:row;min-height:11.25rem;display:grid;grid-template-columns:11.25rem 1fr;grid-template-rows:auto 1fr}.tk-card.tk-card-horizontal.tk-card-no-image{grid-template-columns:1fr;min-height:auto}.tk-card.tk-card-horizontal .tk-card-image-container{grid-row:1/span 2;grid-column:1;width:11.25rem;min-width:11.25rem;height:100%;border-right:1px solid var(--tk-color-base-surface-100)}.tk-card.tk-card-horizontal .tk-card-header{grid-column:2;grid-row:1}.tk-card.tk-card-horizontal .tk-card-content{grid-column:2;grid-row:2;margin-top:0}.tk-card:not(.tk-card-horizontal) .tk-card-image-container{height:13.75rem}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "ngmodule", type: MenuModule }, { kind: "component", type: ButtonComponent, selector: "tk-button", inputs: ["label", "disabled", "type", "severity", "variant", "link", "icon", "iconPosition", "tooltipText", "full", "ariaLabel", "size"], outputs: ["clicked"] }, { kind: "component", type: CheckboxComponent, selector: "tk-checkbox", inputs: ["model", "value", "label", "name", "inputId", "binary", "control", "errorMessage", "indeterminate", "disabled"], outputs: ["modelChange", "indeterminateChange", "disabledChange"] }, { kind: "component", type: IconComponent, selector: "tk-icon", inputs: ["icon", "styleIcon", "color", "size", "disabled"] }, { kind: "component", type: ProgressBarComponent, selector: "tk-progress-bar", inputs: ["value", "showValue", "size"] }, { kind: "component", type: StatusBarComponent, selector: "tk-status-bar", inputs: ["label", "severity", "size", "barLabel"] }, { kind: "component", type: TagComponent, selector: "tk-tag", inputs: ["value", "severity", "truncationLimit"] }, { kind: "component", type: DropdownComponent, selector: "tk-dropdown", inputs: ["model", "icon", "label", "iconPosition", "size", "disabled", "tooltip", "tooltipPosition"] }, { kind: "component", type: ActionGroupComponent, selector: "tk-action-group", inputs: ["actions", "maxVisible", "disabled"] }, { kind: "component", type: TimeAgoComponent, selector: "tk-time-ago", inputs: ["dateTime", "severity", "tooltipText", "tooltipFormat"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
122
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: CardComponent, isStandalone: true, selector: "tk-card", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: true, transformFunction: null }, titleLink: { classPropertyName: "titleLink", publicName: "titleLink", isSignal: true, isRequired: false, transformFunction: null }, titleHref: { classPropertyName: "titleHref", publicName: "titleHref", isSignal: true, isRequired: false, transformFunction: null }, titleIcon: { classPropertyName: "titleIcon", publicName: "titleIcon", isSignal: true, isRequired: false, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: false, transformFunction: null }, image: { classPropertyName: "image", publicName: "image", isSignal: true, isRequired: false, transformFunction: null }, showImage: { classPropertyName: "showImage", publicName: "showImage", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, selectable: { classPropertyName: "selectable", publicName: "selectable", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null }, badgeText: { classPropertyName: "badgeText", publicName: "badgeText", isSignal: true, isRequired: false, transformFunction: null }, secondaryBadgeText: { classPropertyName: "secondaryBadgeText", publicName: "secondaryBadgeText", isSignal: true, isRequired: false, transformFunction: null }, connectionStatusDate: { classPropertyName: "connectionStatusDate", publicName: "connectionStatusDate", isSignal: true, isRequired: false, transformFunction: null }, connectionStatusSeverity: { classPropertyName: "connectionStatusSeverity", publicName: "connectionStatusSeverity", isSignal: true, isRequired: false, transformFunction: null }, actions: { classPropertyName: "actions", publicName: "actions", isSignal: true, isRequired: false, transformFunction: null }, actionGroup: { classPropertyName: "actionGroup", publicName: "actionGroup", isSignal: true, isRequired: false, transformFunction: null }, actionGroupMaxVisible: { classPropertyName: "actionGroupMaxVisible", publicName: "actionGroupMaxVisible", isSignal: true, isRequired: false, transformFunction: null }, actionGroupDisabled: { classPropertyName: "actionGroupDisabled", publicName: "actionGroupDisabled", isSignal: true, isRequired: false, transformFunction: null }, infoElements: { classPropertyName: "infoElements", publicName: "infoElements", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selectedChange" }, ngImport: i0, template: "<div \n class=\"tk-card\" \n [class.tk-card-horizontal]=\"layout() === 'horizontal'\"\n [class.tk-card-selectable]=\"selectable()\"\n [class.tk-card-selected]=\"selectable() && selected()\"\n [class.tk-card-no-image]=\"!showImage()\"\n [attr.aria-pressed]=\"selectable() ? selected() : null\">\n \n <!-- Header: Selection, Metadata, and Actions -->\n @if (selectable() || badgeText() || secondaryBadgeText() || connectionStatusDate() || actions().length > 0 || actionGroup().length > 0) {\n <div class=\"tk-card-header\">\n <div class=\"tk-card-header-left\">\n @if (selectable()) {\n <div \n class=\"tk-card-selection\" \n tabindex=\"-1\">\n <tk-checkbox [binary]=\"true\" [(model)]=\"selected\"></tk-checkbox>\n </div>\n }\n @if (badgeText() || secondaryBadgeText() || connectionStatusDate()) {\n <div class=\"tk-card-metadata\">\n @if (badgeText()) {\n <tk-tag [value]=\"badgeText()!\"></tk-tag>\n }\n @if (connectionStatusDate()) {\n <tk-time-ago [dateTime]=\"connectionStatusDate()!\" [severity]=\"connectionStatusSeverity()\"></tk-time-ago>\n }\n @if (secondaryBadgeText()) {\n <span class=\"tk-card-metadata-secondary\">{{ secondaryBadgeText() }}</span>\n }\n </div>\n }\n </div>\n\n <div \n class=\"tk-card-actions\" \n tabindex=\"-1\">\n <!-- Single Action -->\n @for (action of visibleActions(); track action.id) {\n <tk-button \n [icon]=\"action.icon\" \n [severity]=\"getButtonSeverity(action.severity)\"\n variant=\"text\"\n [disabled]=\"action.disabled || false\"\n [tooltipText]=\"action.label\"\n size=\"small\"\n (clicked)=\"action.handler()\">\n </tk-button>\n }\n\n <!-- Multiple Actions Dropdown -->\n @if (hasOverflowActions()) {\n <tk-dropdown [model]=\"menuItems()\" size=\"small\"></tk-dropdown>\n }\n\n <!-- Action Group -->\n @if (actionGroup().length > 0) {\n <tk-action-group\n [actions]=\"actionGroup()\"\n [maxVisible]=\"actionGroupMaxVisible()\"\n [disabled]=\"actionGroupDisabled()\"\n ></tk-action-group>\n }\n </div>\n </div>\n }\n\n <!-- Image Section -->\n @if (showImage()) {\n <div class=\"tk-card-image-container\">\n @if (image()) {\n <div \n class=\"tk-card-image\" \n [style.background-image]=\"'url(' + image() + ')'\">\n </div>\n } @else {\n <div class=\"tk-card-image-placeholder\">\n <tk-icon icon=\"image\" size=\"lg\"></tk-icon>\n </div>\n }\n </div>\n }\n\n <!-- Content Section -->\n <div class=\"tk-card-content\">\n <div class=\"tk-card-body\">\n <h3 class=\"tk-card-title\" [class.tk-card-title--link]=\"titleLink() || titleHref()\">\n @if (titleLink()) {\n <a [routerLink]=\"titleLink()!\" class=\"tk-card-title-link\">\n @if (titleIcon()) {\n <tk-icon [icon]=\"titleIcon()!\" size=\"sm\"></tk-icon>\n }\n {{ title() }}\n </a>\n } @else if (titleHref()) {\n <a [href]=\"titleHref()!\" class=\"tk-card-title-link\">\n @if (titleIcon()) {\n <tk-icon [icon]=\"titleIcon()!\" size=\"sm\"></tk-icon>\n }\n {{ title() }}\n </a>\n } @else {\n @if (titleIcon()) {\n <tk-icon [icon]=\"titleIcon()!\" size=\"sm\"></tk-icon>\n }\n {{ title() }}\n }\n </h3>\n @if (description()) {\n <p class=\"tk-card-description\">{{ description() }}</p>\n }\n </div>\n\n @if (infoElements().length > 0) {\n <div class=\"tk-card-info-elements\">\n @for (element of infoElements(); track $index) {\n <div class=\"tk-card-info-item\">\n @switch (element.type) {\n @case ('progress-bar') {\n <div class=\"tk-card-info-progress\">\n @if (element.label) {\n <span class=\"tk-card-info-progress-label\">{{ element.label }}</span>\n }\n <tk-progress-bar [value]=\"element.value || 0\" size=\"small\"></tk-progress-bar>\n </div>\n }\n @case ('tag') {\n <tk-tag [value]=\"element.label || ''\" [severity]=\"element.severity || 'secondary'\"></tk-tag>\n }\n @case ('chip') {\n <!-- Using tag for chips as per design system style -->\n <tk-tag [value]=\"element.label || ''\" [severity]=\"element.severity || 'secondary'\"></tk-tag>\n }\n @case ('status-bar') {\n <tk-status-bar \n [label]=\"element.label || ''\" \n [barLabel]=\"element.barLabel || ''\"\n [severity]=\"getStatusBarSeverity(element.severity)\">\n </tk-status-bar>\n }\n @case ('button') {\n <tk-button \n [label]=\"element.label\" \n [icon]=\"element.icon\" \n [severity]=\"getButtonSeverity(element.severity)\"\n size=\"small\"\n (clicked)=\"element.handler ? element.handler() : null\">\n </tk-button>\n }\n @case ('icon') {\n <tk-icon [icon]=\"element.icon || ''\"></tk-icon>\n }\n @case ('string') {\n <span class=\"tk-card-info-text\">{{ element.label }}</span>\n }\n }\n </div>\n }\n </div>\n }\n </div>\n</div>\n", styles: [":host{display:block;width:100%}.tk-card{background-color:var(--tk-color-base-surface-0);border:1px solid var(--tk-color-base-surface-200);border-radius:var(--tk-borderRadius-m);display:flex;flex-direction:column;position:relative;overflow:hidden;transition:all .2s cubic-bezier(.4,0,.2,1);width:100%;box-shadow:0 1px 3px rgba(var(--tk-color-base-surface-1000),.05)}.tk-card.tk-card-selectable:hover{border-color:var(--tk-color-base-primary-300);box-shadow:0 4px 12px rgba(var(--tk-color-base-surface-1000),.08);transform:translateY(-2px)}.tk-card.tk-card-selected{border-color:var(--tk-color-base-primary-500);background-color:var(--tk-color-base-sky-100)}.tk-card .tk-card-header{display:flex;justify-content:space-between;align-items:center;padding:var(--tk-spacing-padding-s);min-height:var(--tk-spacing-base-300);z-index:2}.tk-card .tk-card-header .tk-card-header-left{display:flex;align-items:center;gap:var(--tk-spacing-base-100)}.tk-card .tk-card-header .tk-card-metadata{display:flex;align-items:center;gap:var(--tk-spacing-base-75)}.tk-card .tk-card-header .tk-card-metadata tk-tag ::ng-deep .p-tag{background-color:var(--tk-color-base-surface-100)!important;color:var(--tk-color-text-default)!important;font-weight:500}.tk-card .tk-card-header .tk-card-metadata .tk-card-metadata-secondary{font-size:var(--tk-font-size-legal-m);color:var(--tk-color-text-subtle);font-weight:400}.tk-card .tk-card-header .tk-card-actions{display:flex;align-items:center;gap:var(--tk-spacing-base-25)}.tk-card .tk-card-image-container{background-color:var(--tk-color-base-surface-100);display:flex;justify-content:center;align-items:center;width:100%;position:relative}.tk-card .tk-card-image-container .tk-card-image{width:100%;height:100%;background-size:contain;background-position:center;background-repeat:no-repeat}.tk-card .tk-card-image-container .tk-card-image-placeholder{color:var(--tk-color-base-surface-400);display:flex;justify-content:center;align-items:center;width:100%;height:100%}.tk-card .tk-card-image-container .tk-card-image-placeholder tk-icon{font-size:3rem;opacity:.5}.tk-card .tk-card-content{padding:var(--tk-spacing-padding-m);display:flex;flex-direction:column;gap:var(--tk-spacing-gap-xs);flex:1}.tk-card .tk-card-content .tk-card-body{display:flex;flex-direction:column;gap:var(--tk-spacing-base-25)}.tk-card .tk-card-content .tk-card-title{margin:0;font-size:var(--tk-font-size-paragraph-m);font-weight:var(--tk-font-weight-600);color:var(--tk-color-text-default);display:flex;align-items:center;gap:var(--tk-spacing-base-50);line-height:normal}.tk-card .tk-card-content .tk-card-title.tk-card-title--link{cursor:pointer}.tk-card .tk-card-content .tk-card-title .tk-card-title-link{color:inherit;text-decoration:none;display:flex;align-items:center;gap:inherit;width:100%;transition:opacity .2s ease-in-out}.tk-card .tk-card-content .tk-card-title .tk-card-title-link:hover{opacity:.7}.tk-card .tk-card-content .tk-card-description{margin:0;font-size:var(--tk-font-size-paragraph-s);color:var(--tk-color-text-subtle);line-height:1.5}.tk-card .tk-card-content .tk-card-info-elements{display:flex;flex-direction:column;gap:var(--tk-spacing-base-100);margin-top:auto}.tk-card .tk-card-content .tk-card-info-progress{display:flex;flex-direction:row;align-items:center;gap:var(--tk-spacing-base-75)}.tk-card .tk-card-content .tk-card-info-progress .tk-card-info-progress-label{font-size:var(--tk-font-size-legal-m);font-weight:600;color:var(--tk-color-text-default);min-width:fit-content}.tk-card .tk-card-content .tk-card-info-progress tk-progress-bar{flex:1}.tk-card .tk-card-content .tk-card-info-text{font-size:var(--tk-font-size-legal-m);color:var(--tk-color-text-default);line-height:normal}.tk-card.tk-card-horizontal{flex-direction:row;min-height:11.25rem;display:grid;grid-template-columns:11.25rem 1fr;grid-template-rows:auto 1fr}.tk-card.tk-card-horizontal.tk-card-no-image{grid-template-columns:1fr;min-height:auto}.tk-card.tk-card-horizontal .tk-card-image-container{grid-row:1/span 2;grid-column:1;width:11.25rem;min-width:11.25rem;height:100%;border-right:1px solid var(--tk-color-base-surface-100)}.tk-card.tk-card-horizontal .tk-card-header{grid-column:2;grid-row:1}.tk-card.tk-card-horizontal .tk-card-content{grid-column:2;grid-row:2;margin-top:0}.tk-card:not(.tk-card-horizontal) .tk-card-image-container{height:13.75rem}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "ngmodule", type: MenuModule }, { kind: "component", type: ButtonComponent, selector: "tk-button", inputs: ["label", "disabled", "type", "severity", "variant", "link", "icon", "iconPosition", "tooltipText", "full", "ariaLabel", "size"], outputs: ["clicked"] }, { kind: "component", type: CheckboxComponent, selector: "tk-checkbox", inputs: ["model", "value", "label", "name", "inputId", "binary", "control", "errorMessage", "hint", "indeterminate", "disabled"], outputs: ["modelChange", "indeterminateChange", "disabledChange"] }, { kind: "component", type: IconComponent, selector: "tk-icon", inputs: ["icon", "styleIcon", "color", "size", "disabled"] }, { kind: "component", type: ProgressBarComponent, selector: "tk-progress-bar", inputs: ["value", "showValue", "size"] }, { kind: "component", type: StatusBarComponent, selector: "tk-status-bar", inputs: ["label", "severity", "size", "barLabel"] }, { kind: "component", type: TagComponent, selector: "tk-tag", inputs: ["value", "severity", "truncationLimit"] }, { kind: "component", type: DropdownComponent, selector: "tk-dropdown", inputs: ["model", "icon", "label", "iconPosition", "size", "disabled", "tooltip", "tooltipPosition"] }, { kind: "component", type: ActionGroupComponent, selector: "tk-action-group", inputs: ["actions", "maxVisible", "disabled"] }, { kind: "component", type: TimeAgoComponent, selector: "tk-time-ago", inputs: ["dateTime", "severity", "tooltipText", "tooltipFormat"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
123
123
|
}
|
|
124
124
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: CardComponent, decorators: [{
|
|
125
125
|
type: Component,
|