@libs-ui/components-buttons-tab 0.2.29 → 0.2.30-6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,154 @@
1
- # buttons-tab
1
+ # Button Tab
2
2
 
3
- This library was generated with [Nx](https://nx.dev).
3
+ ## Giới thiệu
4
+
5
+ `@libs-ui/components-buttons-tab` là một component Tab cho Angular, cho phép hiển thị danh sách tabs, hỗ trợ trạng thái active và tuỳ chỉnh màu cho type "other".
6
+
7
+ ## Tính năng
8
+
9
+ - Hiển thị tabs dạng button theo danh sách đầu vào
10
+ - Two-way binding cho tab đang active (`keySelected`)
11
+ - Hỗ trợ vô hiệu hóa toàn bộ tabs (`disable`)
12
+ - Type `other` cho phép cấu hình màu chữ và nền riêng (`otherConfig`)
13
+ - Hỗ trợ hiển thị số lượng badge (`count`, `maxCount`, `modeCount`)
14
+
15
+ ## Cài đặt
16
+
17
+ ```bash
18
+ npm install @libs-ui/components-buttons-tab
19
+ ```
20
+
21
+ hoặc
22
+
23
+ ```bash
24
+ yarn add @libs-ui/components-buttons-tab
25
+ ```
26
+
27
+ ## Sử dụng
28
+
29
+ ### Inline Template
30
+
31
+ ```typescript
32
+ import { Component } from '@angular/core';
33
+ import { LibsUiComponentsButtonsTabComponent, IButtonTab, IOtherConfig } from '@libs-ui/components-buttons-tab';
34
+
35
+ @Component({
36
+ selector: 'app-example',
37
+ standalone: true,
38
+ imports: [LibsUiComponentsButtonsTabComponent],
39
+ template: `
40
+ <libs_ui-components-buttons-tab
41
+ [items]="tabs"
42
+ [disable]="isDisabled"
43
+ [(keySelected)]="selectedKey"
44
+ [otherConfig]="otherConfig"
45
+ (outKeySelected)="onSelect($event)">
46
+ </libs_ui-components-buttons-tab>
47
+ `
48
+ })
49
+ export class ExampleComponent {
50
+ tabs: IButtonTab[] = [
51
+ { key: 'tab1', label: 'Tab 1', type: 'blue' },
52
+ { key: 'tab2', label: 'Tab 2', type: 'red', count: 5 },
53
+ { key: 'tab3', label: 'Tab 3', type: 'other' }
54
+ ];
55
+ isDisabled = false;
56
+ selectedKey = 'tab1';
57
+ otherConfig: IOtherConfig = { color: '#000000', background: '#ffffff' };
58
+
59
+ onSelect(key: string) {
60
+ console.log('Selected tab:', key);
61
+ }
62
+ }
63
+ ```
64
+
65
+ ### File HTML riêng
66
+
67
+ ```typescript
68
+ import { Component } from '@angular/core';
69
+ import { LibsUiComponentsButtonsTabComponent, IButtonTab, IOtherConfig } from '@libs-ui/components-buttons-tab';
70
+
71
+ @Component({
72
+ selector: 'app-example',
73
+ standalone: true,
74
+ imports: [LibsUiComponentsButtonsTabComponent],
75
+ templateUrl: './example.component.html'
76
+ })
77
+ export class ExampleComponent {
78
+ tabs: IButtonTab[] = [ /* ... */ ];
79
+ isDisabled = false;
80
+ selectedKey = '';
81
+ otherConfig: IOtherConfig = { color: '#000000', background: '#ffffff' };
82
+
83
+ onSelect(key: string) {}
84
+ }
85
+ ```
86
+
87
+ ```html
88
+ <libs_ui-components-buttons-tab
89
+ [items]="tabs"
90
+ [disable]="isDisabled"
91
+ [(keySelected)]="selectedKey"
92
+ [otherConfig]="otherConfig"
93
+ (outKeySelected)="onSelect($event)">
94
+ </libs_ui-components-buttons-tab>
95
+ ```
96
+
97
+ ## Công nghệ sử dụng
98
+
99
+ - **Angular 18** standalone components, Signals
100
+ - **Tailwind CSS** 3.x
101
+
102
+ ## API Reference
103
+
104
+ ### Inputs
105
+
106
+ | Tên | Kiểu | Mặc định | Mô tả |
107
+ |----------------|-------------------------|----------|-----------------------------------|
108
+ | items | `Array<IButtonTab>` | required | Danh sách cấu hình tabs |
109
+ | disable | `boolean` | `false` | Vô hiệu hóa toàn bộ tabs |
110
+ | keySelected | `string` | `''` | Key của tab đang active (two-way) |
111
+ | otherConfig | `IOtherConfig` | n/a | Cấu hình màu cho type 'other' |
112
+
113
+ ### Outputs
114
+
115
+ | Tên | Kiểu | Mô tả |
116
+ |-----------------|-------------------|-------------------------------------|
117
+ | outKeySelected | `string` | Emit key của tab được chọn |
118
+
119
+ ### Interfaces
120
+
121
+ #### `IButtonTab`
122
+ | Property | Type | Required | Description |
123
+ |--------------|-------------------|----------|--------------------------------------------------------------|
124
+ | key | `string` | yes | Định danh duy nhất của tab, dùng cho two-way binding. |
125
+ | label | `string` | yes | Nội dung text hiển thị trên tab. |
126
+ | type | `TYPE_BUTTON_TAB` | yes | Chủ đề màu của tab; giá trị mặc định hoặc tuỳ chỉnh qua `otherConfig`. |
127
+ | count | `number` | no | Giá trị số (badge) hiển thị trên tab. |
128
+ | modeCount | `TYPE_BADGE_MODE` | no | Chế độ hiển thị badge khi `count` vượt quá `maxCount`. |
129
+ | maxCount | `number` | no | Số tối đa hiển thị trước khi chuyển sang định dạng `modeCount`. |
130
+ | class | `string` | no | Các class CSS thêm cho container tab. |
131
+ | classLabel | `string` | no | Các class CSS thêm cho label text. |
132
+ | disable | `boolean` | no | Nếu `true`: vô hiệu hoá tương tác click cho tab này. |
133
+ | data | `any` | no | Dữ liệu tuỳ ý gắn kèm với tab. |
134
+
135
+ #### `IOtherConfig`
136
+ | Property | Type | Required | Description |
137
+ |------------------|----------|----------|--------------------------------------------------------|
138
+ | color | `string` | yes | Màu chữ (label) cho tab đang active khi `type` là `other`. |
139
+ | background | `string` | no | Màu nền cho tab đang active khi `type` là `other`. |
140
+ | background_badge | `string` | no | Màu nền cho badge khi `type` là `other`. |
141
+
142
+ #### `TYPE_BUTTON_TAB`
143
+ | Value | Description |
144
+ |----------|------------------------------------------------------------|
145
+ | `blue` | Chủ đề màu xanh mặc định. |
146
+ | `green` | Chủ đề màu xanh lá (thành công). |
147
+ | `red` | Chủ đề màu đỏ (cảnh báo). |
148
+ | `orange` | Chủ đề màu cam (cảnh báo). |
149
+ | `yellow` | Chủ đề màu vàng (thông tin). |
150
+ | `cyan` | Chủ đề màu xanh lam nhạt (phụ). |
151
+ | `purple` | Chủ đề màu tím (nổi bật). |
152
+ | `brown` | Chủ đề màu nâu (trung tính). |
153
+ | `other` | Chủ đề tuỳ chỉnh; màu được định nghĩa qua `otherConfig`. |
154
+ | `string` | Các tên chủ đề tuỳ chỉnh khác. |
package/esm2022/index.mjs CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './tab.component';
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9saWJzLXVpL2NvbXBvbmVudHMvYnV0dG9ucy90YWIvc3JjL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsaUJBQWlCLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL3RhYi5jb21wb25lbnQnO1xuIl19
2
+ export * from './interfaces/tab.interface';
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9saWJzLXVpL2NvbXBvbmVudHMvYnV0dG9ucy90YWIvc3JjL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsaUJBQWlCLENBQUM7QUFDaEMsY0FBYyw0QkFBNEIsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vdGFiLmNvbXBvbmVudCc7XG5leHBvcnQgKiBmcm9tICcuL2ludGVyZmFjZXMvdGFiLmludGVyZmFjZSc7Il19
@@ -1,2 +1,2 @@
1
1
  export {};
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFiLmludGVyZmFjZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4u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luZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBUWVBFX0JBREdFX01PREUgfSBmcm9tIFwiQGxpYnMtdWkvY29tcG9uZW50cy1iYWRnZVwiO1xuXG5leHBvcnQgaW50ZXJmYWNlIElCdXR0b25UYWIge1xuICBrZXk6IHN0cmluZztcbiAgbGFiZWw6IHN0cmluZztcbiAgdHlwZTogVFlQRV9CVVRUT05fVEFCO1xuICBjb3VudD86IG51bWJlcjtcbiAgbW9kZUNvdW50PzogVFlQRV9CQURHRV9NT0RFO1xuICBtYXhDb3VudD86IG51bWJlcjtcbiAgY2xhc3M/OiBzdHJpbmc7XG4gIGNsYXNzTGFiZWw/OiBzdHJpbmc7XG4gIGRpc2FibGU/OiBib29sZWFuO1xuICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L25vLWV4cGxpY2l0LWFueVxuICBkYXRhPzogYW55O1xufVxuXG5leHBvcnQgaW50ZXJmYWNlIElPdGhlckNvbmZpZyB7XG4gIGNvbG9yOiBzdHJpbmc7XG4gIGJhY2tncm91bmQ/OiBzdHJpbmc7XG4gIGJhY2tncm91bmRfYmFkZ2U/OiBzdHJpbmc7XG59XG5cbmV4cG9ydCB0eXBlIFRZUEVfQlVUVE9OX1RBQiA9ICdibHVlJyB8ICdncmVlbicgfCAncmVkJyB8ICdvcmFuZ2UnIHwgJ3llbGxvdycgfCAnY3lhbicgfCAncHVycGxlJyB8ICdicm93bicgfCAnb3RoZXInIHwgc3RyaW5nOyJdfQ==
@@ -1,17 +1,44 @@
1
- import { ChangeDetectionStrategy, Component, input, model, output } from '@angular/core';
1
+ import { ChangeDetectionStrategy, Component, effect, input, model, output, viewChild } from '@angular/core';
2
2
  import { LibsUiComponentsBadgeComponent } from '@libs-ui/components-badge';
3
3
  import { LibsUiComponentsPopoverComponent } from '@libs-ui/components-popover';
4
- import { escapeHtml } from '@libs-ui/utils';
4
+ import { colorStepContrastFromOrigin, escapeHtml } from '@libs-ui/utils';
5
5
  import { TranslateModule } from '@ngx-translate/core';
6
6
  import * as i0 from "@angular/core";
7
7
  import * as i1 from "@ngx-translate/core";
8
8
  export class LibsUiComponentsButtonsTabComponent {
9
- /* INPUT */
9
+ otherStyleClassButtonTabEl = document.createElement('style');
10
+ // #region INPUT
10
11
  items = input.required({ transform: data => data.map(item => ({ ...item, label: escapeHtml(item.label) })) });
11
12
  disable = input(false);
12
13
  keySelected = model('');
13
- /* OUTPUT */
14
+ otherConfig = input(); // required and only apply when type is other
15
+ // #region OUTPUT
14
16
  outKeySelected = output();
17
+ /* VIEW CHILD */
18
+ buttonEl = viewChild('buttonEl');
19
+ constructor() {
20
+ effect(() => {
21
+ const config = this.otherConfig();
22
+ if (config) {
23
+ const background = config.background || colorStepContrastFromOrigin(config.color, 95)?.light;
24
+ const backgroundBadge = config.background_badge || colorStepContrastFromOrigin(config.color, 90)?.light;
25
+ const styles = `.libs-ui-button-tab-other[active="true"] {
26
+ background-color: ${background} !important;
27
+ }
28
+
29
+ .libs-ui-button-tab-other[active="true"] > .libs-ui-button-tab-label {
30
+ color: ${config.color} !important;
31
+ }
32
+
33
+ .libs-ui-button-tab-other[active="true"] > .libs-ui-button-tab-badge > .libs-ui-button-tab-badge-circle {
34
+ color: ${config.color} !important;
35
+ background-color: ${backgroundBadge} !important;
36
+ }`;
37
+ this.otherStyleClassButtonTabEl.innerHTML = styles;
38
+ this.buttonEl()?.nativeElement.append(this.otherStyleClassButtonTabEl);
39
+ }
40
+ });
41
+ }
15
42
  /* FUNCTIONS */
16
43
  async handlerSelectItem(event, item) {
17
44
  event.stopPropagation();
@@ -22,7 +49,7 @@ export class LibsUiComponentsButtonsTabComponent {
22
49
  this.outKeySelected.emit(this.keySelected());
23
50
  }
24
51
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsButtonsTabComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
25
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: LibsUiComponentsButtonsTabComponent, isStandalone: true, selector: "libs_ui-components-buttons-tab", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, disable: { classPropertyName: "disable", publicName: "disable", isSignal: true, isRequired: false, transformFunction: null }, keySelected: { classPropertyName: "keySelected", publicName: "keySelected", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { keySelected: "keySelectedChange", outKeySelected: "outKeySelected" }, ngImport: i0, template: "<div class=\"flex\">\n @for (item of items(); track item) {\n <div class=\"flex items-center libs-ui-button-tab {{ 'libs-ui-button-tab-'+item.type }} {{ item.class || 'px-[8px] mx-[8px] py-[4px]' }} {{ (disable() || item.disable) ? 'pointer-events-none cursor-default' : 'cursor-pointer' }}\"\n [attr.active]=\"item.key === keySelected()\"\n (click)=\"handlerSelectItem($event, item)\">\n <span LibsUiComponentsPopoverDirective\n class=\"w-full label {{ item.classLabel || 'libs-ui-font-h6r' }}\"\n [class.libs-ui-disable]=\"disable() || item.disable\"\n [type]=\"'text'\"\n [attr.active]=\"item.key === keySelected()\"\n [ignoreStopPropagationEvent]=\"true\"\n [innerHtml]=\"item.label | translate\"></span>\n @if (item.count !== undefined) {\n <libs_ui-components-badge class=\"badge\"\n [mode]=\"item.modeCount || 'x+'\"\n [count]=\"item.count\"\n [maxCount]=\"item.maxCount || 99\"\n [classCircle]=\"'circle-tab libs-ui-font-h6r'\" />\n }\n </div>\n }\n</div>\n", styles: [":host ::ng-deep .libs-ui-button-tab{border-radius:4px}:host ::ng-deep .libs-ui-button-tab>[class*=label]{color:#6a7383}:host ::ng-deep .libs-ui-button-tab>[class*=badge]>[class*=circle-tab]{color:#6a7383;background-color:#f8f9fa}:host ::ng-deep .libs-ui-button-tab:hover{background:#f8f9fa}:host ::ng-deep .libs-ui-button-tab:hover>[class*=label]{color:#6a7383}:host ::ng-deep .libs-ui-button-tab:hover>[class*=badge]>[class*=circle-tab]{color:#6a7383;background-color:#e6e7ea}\n"], dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "component", type: LibsUiComponentsPopoverComponent, selector: "libs_ui-components-popover,[LibsUiComponentsPopoverDirective]", inputs: ["flagMouse", "type", "mode", "config", "ignoreShowPopover", "elementRefCustom", "classInclude", "ignoreHiddenPopoverContentWhenMouseLeave", "ignoreStopPropagationEvent", "ignoreCursorPointerModeLikeClick", "isAddContentToParentDocument", "ignoreClickOutside"], outputs: ["outEvent", "outChangStageFlagMouse", "outEventPopoverContent", "outFunctionsControl"] }, { kind: "component", type: LibsUiComponentsBadgeComponent, selector: "libs_ui-components-badge", inputs: ["popoverConfig", "active", "count", "mode", "maxCount", "ignoreMarginDefault", "classCircle", "ignoreStopPropagationEvent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
52
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: LibsUiComponentsButtonsTabComponent, isStandalone: true, selector: "libs_ui-components-buttons-tab", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, disable: { classPropertyName: "disable", publicName: "disable", isSignal: true, isRequired: false, transformFunction: null }, keySelected: { classPropertyName: "keySelected", publicName: "keySelected", isSignal: true, isRequired: false, transformFunction: null }, otherConfig: { classPropertyName: "otherConfig", publicName: "otherConfig", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { keySelected: "keySelectedChange", outKeySelected: "outKeySelected" }, viewQueries: [{ propertyName: "buttonEl", first: true, predicate: ["buttonEl"], descendants: true, isSignal: true }], ngImport: i0, template: "<div #buttonEl\n class=\"flex\">\n @for (item of items(); track item) {\n <div class=\"flex items-center libs-ui-button-tab {{ 'libs-ui-button-tab-'+item.type }} {{ item.class || 'px-[8px] mx-[8px] py-[4px]' }} {{ (disable() || item.disable) ? 'pointer-events-none cursor-default' : 'cursor-pointer' }}\"\n [attr.active]=\"item.key === keySelected()\"\n (click)=\"handlerSelectItem($event, item)\">\n <span LibsUiComponentsPopoverDirective\n class=\"w-full libs-ui-button-tab-label {{ item.classLabel || 'libs-ui-font-h6r' }}\"\n [class.libs-ui-disable]=\"disable() || item.disable\"\n [type]=\"'text'\"\n [attr.active]=\"item.key === keySelected()\"\n [ignoreStopPropagationEvent]=\"true\"\n [innerHtml]=\"item.label | translate\"></span>\n @if (item.count !== undefined) {\n <libs_ui-components-badge class=\"libs-ui-button-tab-badge\"\n [mode]=\"item.modeCount || 'x+'\"\n [count]=\"item.count\"\n [maxCount]=\"item.maxCount || 99\"\n [classCircle]=\"'libs-ui-button-tab-badge-circle libs-ui-font-h6r'\" />\n }\n </div>\n }\n</div>\n", styles: [":host ::ng-deep .libs-ui-button-tab{border-radius:4px}:host ::ng-deep .libs-ui-button-tab>[class*=libs-ui-button-tab-label]{color:#6a7383}:host ::ng-deep .libs-ui-button-tab>[class*=libs-ui-button-tab-badge]>[class*=libs-ui-button-tab-badge-circle]{color:#6a7383;background-color:#f8f9fa}:host ::ng-deep .libs-ui-button-tab:hover{background:#f8f9fa}:host ::ng-deep .libs-ui-button-tab:hover>[class*=libs-ui-button-tab-label]{color:#6a7383}:host ::ng-deep .libs-ui-button-tab:hover>[class*=libs-ui-button-tab-badge]>[class*=libs-ui-button-tab-badge-circle]{color:#6a7383;background-color:#e6e7ea}\n"], dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "component", type: LibsUiComponentsPopoverComponent, selector: "libs_ui-components-popover,[LibsUiComponentsPopoverDirective]", inputs: ["debugId", "flagMouse", "type", "mode", "config", "ignoreShowPopover", "elementRefCustom", "initEventInElementRefCustom", "classInclude", "ignoreHiddenPopoverContentWhenMouseLeave", "ignoreStopPropagationEvent", "ignoreCursorPointerModeLikeClick", "isAddContentToParentDocument", "ignoreClickOutside"], outputs: ["outEvent", "outChangStageFlagMouse", "outEventPopoverContent", "outFunctionsControl"] }, { kind: "component", type: LibsUiComponentsBadgeComponent, selector: "libs_ui-components-badge", inputs: ["popoverConfig", "active", "count", "mode", "maxCount", "ignoreMarginDefault", "classCircle", "ignoreStopPropagationEvent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
26
53
  }
27
54
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsButtonsTabComponent, decorators: [{
28
55
  type: Component,
@@ -30,6 +57,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
30
57
  TranslateModule,
31
58
  LibsUiComponentsPopoverComponent,
32
59
  LibsUiComponentsBadgeComponent
33
- ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex\">\n @for (item of items(); track item) {\n <div class=\"flex items-center libs-ui-button-tab {{ 'libs-ui-button-tab-'+item.type }} {{ item.class || 'px-[8px] mx-[8px] py-[4px]' }} {{ (disable() || item.disable) ? 'pointer-events-none cursor-default' : 'cursor-pointer' }}\"\n [attr.active]=\"item.key === keySelected()\"\n (click)=\"handlerSelectItem($event, item)\">\n <span LibsUiComponentsPopoverDirective\n class=\"w-full label {{ item.classLabel || 'libs-ui-font-h6r' }}\"\n [class.libs-ui-disable]=\"disable() || item.disable\"\n [type]=\"'text'\"\n [attr.active]=\"item.key === keySelected()\"\n [ignoreStopPropagationEvent]=\"true\"\n [innerHtml]=\"item.label | translate\"></span>\n @if (item.count !== undefined) {\n <libs_ui-components-badge class=\"badge\"\n [mode]=\"item.modeCount || 'x+'\"\n [count]=\"item.count\"\n [maxCount]=\"item.maxCount || 99\"\n [classCircle]=\"'circle-tab libs-ui-font-h6r'\" />\n }\n </div>\n }\n</div>\n", styles: [":host ::ng-deep .libs-ui-button-tab{border-radius:4px}:host ::ng-deep .libs-ui-button-tab>[class*=label]{color:#6a7383}:host ::ng-deep .libs-ui-button-tab>[class*=badge]>[class*=circle-tab]{color:#6a7383;background-color:#f8f9fa}:host ::ng-deep .libs-ui-button-tab:hover{background:#f8f9fa}:host ::ng-deep .libs-ui-button-tab:hover>[class*=label]{color:#6a7383}:host ::ng-deep .libs-ui-button-tab:hover>[class*=badge]>[class*=circle-tab]{color:#6a7383;background-color:#e6e7ea}\n"] }]
34
- }] });
35
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFiLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMtdWkvY29tcG9uZW50cy9idXR0b25zL3RhYi9zcmMvdGFiLmNvbXBvbmVudC50cyIsIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMtdWkvY29tcG9uZW50cy9idXR0b25zL3RhYi9zcmMvdGFiLmNvbXBvbmVudC5odG1sIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSx1QkFBdUIsRUFBRSxTQUFTLEVBQUUsS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDekYsT0FBTyxFQUFFLDhCQUE4QixFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFDM0UsT0FBTyxFQUFFLGdDQUFnQyxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFDL0UsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBQzVDLE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQzs7O0FBZ0J0RCxNQUFNLE9BQU8sbUNBQW1DO0lBRTlDLFdBQVc7SUFDRixLQUFLLEdBQUcsS0FBSyxDQUFDLFFBQVEsQ0FBdUMsRUFBRSxTQUFTLEVBQUUsSUFBSSxDQUFDLEVBQUUsQ0FBQyxJQUFJLENBQUMsR0FBRyxDQUFDLElBQUksQ0FBQyxFQUFFLENBQUMsQ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gfHwgOTlcIlxuICAgICAgICAgIFtjbGFzc0NpcmNsZV09XCInY2lyY2xlLXRhYiBsaWJzLXVpLWZvbnQtaDZyJ1wiIC8+XG4gICAgICB9XG4gICAgPC9kaXY+XG4gIH1cbjwvZGl2PlxuIl19
60
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div #buttonEl\n class=\"flex\">\n @for (item of items(); track item) {\n <div class=\"flex items-center libs-ui-button-tab {{ 'libs-ui-button-tab-'+item.type }} {{ item.class || 'px-[8px] mx-[8px] py-[4px]' }} {{ (disable() || item.disable) ? 'pointer-events-none cursor-default' : 'cursor-pointer' }}\"\n [attr.active]=\"item.key === keySelected()\"\n (click)=\"handlerSelectItem($event, item)\">\n <span LibsUiComponentsPopoverDirective\n class=\"w-full libs-ui-button-tab-label {{ item.classLabel || 'libs-ui-font-h6r' }}\"\n [class.libs-ui-disable]=\"disable() || item.disable\"\n [type]=\"'text'\"\n [attr.active]=\"item.key === keySelected()\"\n [ignoreStopPropagationEvent]=\"true\"\n [innerHtml]=\"item.label | translate\"></span>\n @if (item.count !== undefined) {\n <libs_ui-components-badge class=\"libs-ui-button-tab-badge\"\n [mode]=\"item.modeCount || 'x+'\"\n [count]=\"item.count\"\n [maxCount]=\"item.maxCount || 99\"\n [classCircle]=\"'libs-ui-button-tab-badge-circle libs-ui-font-h6r'\" />\n }\n </div>\n }\n</div>\n", styles: [":host ::ng-deep .libs-ui-button-tab{border-radius:4px}:host ::ng-deep .libs-ui-button-tab>[class*=libs-ui-button-tab-label]{color:#6a7383}:host ::ng-deep .libs-ui-button-tab>[class*=libs-ui-button-tab-badge]>[class*=libs-ui-button-tab-badge-circle]{color:#6a7383;background-color:#f8f9fa}:host ::ng-deep .libs-ui-button-tab:hover{background:#f8f9fa}:host ::ng-deep .libs-ui-button-tab:hover>[class*=libs-ui-button-tab-label]{color:#6a7383}:host ::ng-deep .libs-ui-button-tab:hover>[class*=libs-ui-button-tab-badge]>[class*=libs-ui-button-tab-badge-circle]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dWktYnV0dG9uLXRhYi1sYWJlbCB7eyBpdGVtLmNsYXNzTGFiZWwgfHwgJ2xpYnMtdWktZm9udC1oNnInIH19XCJcbiAgICAgICAgW2NsYXNzLmxpYnMtdWktZGlzYWJsZV09XCJkaXNhYmxlKCkgfHwgaXRlbS5kaXNhYmxlXCJcbiAgICAgICAgW3R5cGVdPVwiJ3RleHQnXCJcbiAgICAgICAgW2F0dHIuYWN0aXZlXT1cIml0ZW0ua2V5ID09PSBrZXlTZWxlY3RlZCgpXCJcbiAgICAgICAgW2lnbm9yZVN0b3BQcm9wYWdhdGlvbkV2ZW50XT1cInRydWVcIlxuICAgICAgICBbaW5uZXJIdG1sXT1cIml0ZW0ubGFiZWwgfCB0cmFuc2xhdGVcIj48L3NwYW4+XG4gICAgICBAaWYgKGl0ZW0uY291bnQgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICA8bGlic191aS1jb21wb25lbnRzLWJhZGdlIGNsYXNzPVwibGlicy11aS1idXR0b24tdGFiLWJhZGdlXCJcbiAgICAgICAgICBbbW9kZV09XCJpdGVtLm1vZGVDb3VudCB8fCAneCsnXCJcbiAgICAgICAgICBbY291bnRdPVwiaXRlbS5jb3VudFwiXG4gICAgICAgICAgW21heENvdW50XT1cIml0ZW0ubWF4Q291bnQgfHwgOTlcIlxuICAgICAgICAgIFtjbGFzc0NpcmNsZV09XCInbGlicy11aS1idXR0b24tdGFiLWJhZGdlLWNpcmNsZSBsaWJzLXVpLWZvbnQtaDZyJ1wiIC8+XG4gICAgICB9XG4gICAgPC9kaXY+XG4gIH1cbjwvZGl2PlxuIl19
@@ -1,18 +1,45 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, model, output, Component, ChangeDetectionStrategy } from '@angular/core';
2
+ import { input, model, output, viewChild, effect, ChangeDetectionStrategy, Component } from '@angular/core';
3
3
  import { LibsUiComponentsBadgeComponent } from '@libs-ui/components-badge';
4
4
  import { LibsUiComponentsPopoverComponent } from '@libs-ui/components-popover';
5
- import { escapeHtml } from '@libs-ui/utils';
5
+ import { escapeHtml, colorStepContrastFromOrigin } from '@libs-ui/utils';
6
6
  import * as i1 from '@ngx-translate/core';
7
7
  import { TranslateModule } from '@ngx-translate/core';
8
8
 
9
9
  class LibsUiComponentsButtonsTabComponent {
10
- /* INPUT */
10
+ otherStyleClassButtonTabEl = document.createElement('style');
11
+ // #region INPUT
11
12
  items = input.required({ transform: data => data.map(item => ({ ...item, label: escapeHtml(item.label) })) });
12
13
  disable = input(false);
13
14
  keySelected = model('');
14
- /* OUTPUT */
15
+ otherConfig = input(); // required and only apply when type is other
16
+ // #region OUTPUT
15
17
  outKeySelected = output();
18
+ /* VIEW CHILD */
19
+ buttonEl = viewChild('buttonEl');
20
+ constructor() {
21
+ effect(() => {
22
+ const config = this.otherConfig();
23
+ if (config) {
24
+ const background = config.background || colorStepContrastFromOrigin(config.color, 95)?.light;
25
+ const backgroundBadge = config.background_badge || colorStepContrastFromOrigin(config.color, 90)?.light;
26
+ const styles = `.libs-ui-button-tab-other[active="true"] {
27
+ background-color: ${background} !important;
28
+ }
29
+
30
+ .libs-ui-button-tab-other[active="true"] > .libs-ui-button-tab-label {
31
+ color: ${config.color} !important;
32
+ }
33
+
34
+ .libs-ui-button-tab-other[active="true"] > .libs-ui-button-tab-badge > .libs-ui-button-tab-badge-circle {
35
+ color: ${config.color} !important;
36
+ background-color: ${backgroundBadge} !important;
37
+ }`;
38
+ this.otherStyleClassButtonTabEl.innerHTML = styles;
39
+ this.buttonEl()?.nativeElement.append(this.otherStyleClassButtonTabEl);
40
+ }
41
+ });
42
+ }
16
43
  /* FUNCTIONS */
17
44
  async handlerSelectItem(event, item) {
18
45
  event.stopPropagation();
@@ -23,7 +50,7 @@ class LibsUiComponentsButtonsTabComponent {
23
50
  this.outKeySelected.emit(this.keySelected());
24
51
  }
25
52
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsButtonsTabComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
26
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: LibsUiComponentsButtonsTabComponent, isStandalone: true, selector: "libs_ui-components-buttons-tab", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, disable: { classPropertyName: "disable", publicName: "disable", isSignal: true, isRequired: false, transformFunction: null }, keySelected: { classPropertyName: "keySelected", publicName: "keySelected", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { keySelected: "keySelectedChange", outKeySelected: "outKeySelected" }, ngImport: i0, template: "<div class=\"flex\">\n @for (item of items(); track item) {\n <div class=\"flex items-center libs-ui-button-tab {{ 'libs-ui-button-tab-'+item.type }} {{ item.class || 'px-[8px] mx-[8px] py-[4px]' }} {{ (disable() || item.disable) ? 'pointer-events-none cursor-default' : 'cursor-pointer' }}\"\n [attr.active]=\"item.key === keySelected()\"\n (click)=\"handlerSelectItem($event, item)\">\n <span LibsUiComponentsPopoverDirective\n class=\"w-full label {{ item.classLabel || 'libs-ui-font-h6r' }}\"\n [class.libs-ui-disable]=\"disable() || item.disable\"\n [type]=\"'text'\"\n [attr.active]=\"item.key === keySelected()\"\n [ignoreStopPropagationEvent]=\"true\"\n [innerHtml]=\"item.label | translate\"></span>\n @if (item.count !== undefined) {\n <libs_ui-components-badge class=\"badge\"\n [mode]=\"item.modeCount || 'x+'\"\n [count]=\"item.count\"\n [maxCount]=\"item.maxCount || 99\"\n [classCircle]=\"'circle-tab libs-ui-font-h6r'\" />\n }\n </div>\n }\n</div>\n", styles: [":host ::ng-deep .libs-ui-button-tab{border-radius:4px}:host ::ng-deep .libs-ui-button-tab>[class*=label]{color:#6a7383}:host ::ng-deep .libs-ui-button-tab>[class*=badge]>[class*=circle-tab]{color:#6a7383;background-color:#f8f9fa}:host ::ng-deep .libs-ui-button-tab:hover{background:#f8f9fa}:host ::ng-deep .libs-ui-button-tab:hover>[class*=label]{color:#6a7383}:host ::ng-deep .libs-ui-button-tab:hover>[class*=badge]>[class*=circle-tab]{color:#6a7383;background-color:#e6e7ea}\n"], dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "component", type: LibsUiComponentsPopoverComponent, selector: "libs_ui-components-popover,[LibsUiComponentsPopoverDirective]", inputs: ["flagMouse", "type", "mode", "config", "ignoreShowPopover", "elementRefCustom", "classInclude", "ignoreHiddenPopoverContentWhenMouseLeave", "ignoreStopPropagationEvent", "ignoreCursorPointerModeLikeClick", "isAddContentToParentDocument", "ignoreClickOutside"], outputs: ["outEvent", "outChangStageFlagMouse", "outEventPopoverContent", "outFunctionsControl"] }, { kind: "component", type: LibsUiComponentsBadgeComponent, selector: "libs_ui-components-badge", inputs: ["popoverConfig", "active", "count", "mode", "maxCount", "ignoreMarginDefault", "classCircle", "ignoreStopPropagationEvent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
53
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: LibsUiComponentsButtonsTabComponent, isStandalone: true, selector: "libs_ui-components-buttons-tab", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, disable: { classPropertyName: "disable", publicName: "disable", isSignal: true, isRequired: false, transformFunction: null }, keySelected: { classPropertyName: "keySelected", publicName: "keySelected", isSignal: true, isRequired: false, transformFunction: null }, otherConfig: { classPropertyName: "otherConfig", publicName: "otherConfig", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { keySelected: "keySelectedChange", outKeySelected: "outKeySelected" }, viewQueries: [{ propertyName: "buttonEl", first: true, predicate: ["buttonEl"], descendants: true, isSignal: true }], ngImport: i0, template: "<div #buttonEl\n class=\"flex\">\n @for (item of items(); track item) {\n <div class=\"flex items-center libs-ui-button-tab {{ 'libs-ui-button-tab-'+item.type }} {{ item.class || 'px-[8px] mx-[8px] py-[4px]' }} {{ (disable() || item.disable) ? 'pointer-events-none cursor-default' : 'cursor-pointer' }}\"\n [attr.active]=\"item.key === keySelected()\"\n (click)=\"handlerSelectItem($event, item)\">\n <span LibsUiComponentsPopoverDirective\n class=\"w-full libs-ui-button-tab-label {{ item.classLabel || 'libs-ui-font-h6r' }}\"\n [class.libs-ui-disable]=\"disable() || item.disable\"\n [type]=\"'text'\"\n [attr.active]=\"item.key === keySelected()\"\n [ignoreStopPropagationEvent]=\"true\"\n [innerHtml]=\"item.label | translate\"></span>\n @if (item.count !== undefined) {\n <libs_ui-components-badge class=\"libs-ui-button-tab-badge\"\n [mode]=\"item.modeCount || 'x+'\"\n [count]=\"item.count\"\n [maxCount]=\"item.maxCount || 99\"\n [classCircle]=\"'libs-ui-button-tab-badge-circle libs-ui-font-h6r'\" />\n }\n </div>\n }\n</div>\n", styles: [":host ::ng-deep .libs-ui-button-tab{border-radius:4px}:host ::ng-deep .libs-ui-button-tab>[class*=libs-ui-button-tab-label]{color:#6a7383}:host ::ng-deep .libs-ui-button-tab>[class*=libs-ui-button-tab-badge]>[class*=libs-ui-button-tab-badge-circle]{color:#6a7383;background-color:#f8f9fa}:host ::ng-deep .libs-ui-button-tab:hover{background:#f8f9fa}:host ::ng-deep .libs-ui-button-tab:hover>[class*=libs-ui-button-tab-label]{color:#6a7383}:host ::ng-deep .libs-ui-button-tab:hover>[class*=libs-ui-button-tab-badge]>[class*=libs-ui-button-tab-badge-circle]{color:#6a7383;background-color:#e6e7ea}\n"], dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "component", type: LibsUiComponentsPopoverComponent, selector: "libs_ui-components-popover,[LibsUiComponentsPopoverDirective]", inputs: ["debugId", "flagMouse", "type", "mode", "config", "ignoreShowPopover", "elementRefCustom", "initEventInElementRefCustom", "classInclude", "ignoreHiddenPopoverContentWhenMouseLeave", "ignoreStopPropagationEvent", "ignoreCursorPointerModeLikeClick", "isAddContentToParentDocument", "ignoreClickOutside"], outputs: ["outEvent", "outChangStageFlagMouse", "outEventPopoverContent", "outFunctionsControl"] }, { kind: "component", type: LibsUiComponentsBadgeComponent, selector: "libs_ui-components-badge", inputs: ["popoverConfig", "active", "count", "mode", "maxCount", "ignoreMarginDefault", "classCircle", "ignoreStopPropagationEvent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
27
54
  }
28
55
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsButtonsTabComponent, decorators: [{
29
56
  type: Component,
@@ -31,8 +58,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
31
58
  TranslateModule,
32
59
  LibsUiComponentsPopoverComponent,
33
60
  LibsUiComponentsBadgeComponent
34
- ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex\">\n @for (item of items(); track item) {\n <div class=\"flex items-center libs-ui-button-tab {{ 'libs-ui-button-tab-'+item.type }} {{ item.class || 'px-[8px] mx-[8px] py-[4px]' }} {{ (disable() || item.disable) ? 'pointer-events-none cursor-default' : 'cursor-pointer' }}\"\n [attr.active]=\"item.key === keySelected()\"\n (click)=\"handlerSelectItem($event, item)\">\n <span LibsUiComponentsPopoverDirective\n class=\"w-full label {{ item.classLabel || 'libs-ui-font-h6r' }}\"\n [class.libs-ui-disable]=\"disable() || item.disable\"\n [type]=\"'text'\"\n [attr.active]=\"item.key === keySelected()\"\n [ignoreStopPropagationEvent]=\"true\"\n [innerHtml]=\"item.label | translate\"></span>\n @if (item.count !== undefined) {\n <libs_ui-components-badge class=\"badge\"\n [mode]=\"item.modeCount || 'x+'\"\n [count]=\"item.count\"\n [maxCount]=\"item.maxCount || 99\"\n [classCircle]=\"'circle-tab libs-ui-font-h6r'\" />\n }\n </div>\n }\n</div>\n", styles: [":host ::ng-deep .libs-ui-button-tab{border-radius:4px}:host ::ng-deep .libs-ui-button-tab>[class*=label]{color:#6a7383}:host ::ng-deep .libs-ui-button-tab>[class*=badge]>[class*=circle-tab]{color:#6a7383;background-color:#f8f9fa}:host ::ng-deep .libs-ui-button-tab:hover{background:#f8f9fa}:host ::ng-deep .libs-ui-button-tab:hover>[class*=label]{color:#6a7383}:host ::ng-deep .libs-ui-button-tab:hover>[class*=badge]>[class*=circle-tab]{color:#6a7383;background-color:#e6e7ea}\n"] }]
35
- }] });
61
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div #buttonEl\n class=\"flex\">\n @for (item of items(); track item) {\n <div class=\"flex items-center libs-ui-button-tab {{ 'libs-ui-button-tab-'+item.type }} {{ item.class || 'px-[8px] mx-[8px] py-[4px]' }} {{ (disable() || item.disable) ? 'pointer-events-none cursor-default' : 'cursor-pointer' }}\"\n [attr.active]=\"item.key === keySelected()\"\n (click)=\"handlerSelectItem($event, item)\">\n <span LibsUiComponentsPopoverDirective\n class=\"w-full libs-ui-button-tab-label {{ item.classLabel || 'libs-ui-font-h6r' }}\"\n [class.libs-ui-disable]=\"disable() || item.disable\"\n [type]=\"'text'\"\n [attr.active]=\"item.key === keySelected()\"\n [ignoreStopPropagationEvent]=\"true\"\n [innerHtml]=\"item.label | translate\"></span>\n @if (item.count !== undefined) {\n <libs_ui-components-badge class=\"libs-ui-button-tab-badge\"\n [mode]=\"item.modeCount || 'x+'\"\n [count]=\"item.count\"\n [maxCount]=\"item.maxCount || 99\"\n [classCircle]=\"'libs-ui-button-tab-badge-circle libs-ui-font-h6r'\" />\n }\n </div>\n }\n</div>\n", styles: [":host ::ng-deep .libs-ui-button-tab{border-radius:4px}:host ::ng-deep .libs-ui-button-tab>[class*=libs-ui-button-tab-label]{color:#6a7383}:host ::ng-deep .libs-ui-button-tab>[class*=libs-ui-button-tab-badge]>[class*=libs-ui-button-tab-badge-circle]{color:#6a7383;background-color:#f8f9fa}:host ::ng-deep .libs-ui-button-tab:hover{background:#f8f9fa}:host ::ng-deep .libs-ui-button-tab:hover>[class*=libs-ui-button-tab-label]{color:#6a7383}:host ::ng-deep .libs-ui-button-tab:hover>[class*=libs-ui-button-tab-badge]>[class*=libs-ui-button-tab-badge-circle]{color:#6a7383;background-color:#e6e7ea}\n"] }]
62
+ }], ctorParameters: () => [] });
36
63
 
37
64
  /**
38
65
  * Generated bundle index. Do not edit.
@@ -1 +1 @@
1
- {"version":3,"file":"libs-ui-components-buttons-tab.mjs","sources":["../../../../../../libs-ui/components/buttons/tab/src/tab.component.ts","../../../../../../libs-ui/components/buttons/tab/src/tab.component.html","../../../../../../libs-ui/components/buttons/tab/src/libs-ui-components-buttons-tab.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input, model, output } from '@angular/core';\nimport { LibsUiComponentsBadgeComponent } from '@libs-ui/components-badge';\nimport { LibsUiComponentsPopoverComponent } from '@libs-ui/components-popover';\nimport { escapeHtml } from '@libs-ui/utils';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { IButtonTab } from './interfaces/tab.interface';\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'libs_ui-components-buttons-tab',\n templateUrl: './tab.component.html',\n styleUrl: './tab.component.scss',\n standalone: true,\n imports: [\n TranslateModule,\n LibsUiComponentsPopoverComponent,\n LibsUiComponentsBadgeComponent\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class LibsUiComponentsButtonsTabComponent {\n\n /* INPUT */\n readonly items = input.required<Array<IButtonTab>, Array<IButtonTab>>({ transform: data => data.map(item => ({ ...item, label: escapeHtml(item.label) })) });\n readonly disable = input<boolean>(false);\n readonly keySelected = model<string>('');\n\n /* OUTPUT */\n readonly outKeySelected = output<string>();\n\n /* FUNCTIONS */\n protected async handlerSelectItem(event: MouseEvent, item: IButtonTab) {\n event.stopPropagation();\n if (this.disable() || item.disable) {\n return;\n }\n this.keySelected.set(item.key);\n this.outKeySelected.emit(this.keySelected());\n }\n\n}\n","<div class=\"flex\">\n @for (item of items(); track item) {\n <div class=\"flex items-center libs-ui-button-tab {{ 'libs-ui-button-tab-'+item.type }} {{ item.class || 'px-[8px] mx-[8px] py-[4px]' }} {{ (disable() || item.disable) ? 'pointer-events-none cursor-default' : 'cursor-pointer' }}\"\n [attr.active]=\"item.key === keySelected()\"\n (click)=\"handlerSelectItem($event, item)\">\n <span LibsUiComponentsPopoverDirective\n class=\"w-full label {{ item.classLabel || 'libs-ui-font-h6r' }}\"\n [class.libs-ui-disable]=\"disable() || item.disable\"\n [type]=\"'text'\"\n [attr.active]=\"item.key === keySelected()\"\n [ignoreStopPropagationEvent]=\"true\"\n [innerHtml]=\"item.label | translate\"></span>\n @if (item.count !== undefined) {\n <libs_ui-components-badge class=\"badge\"\n [mode]=\"item.modeCount || 'x+'\"\n [count]=\"item.count\"\n [maxCount]=\"item.maxCount || 99\"\n [classCircle]=\"'circle-tab libs-ui-font-h6r'\" />\n }\n </div>\n }\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MAoBa,mCAAmC,CAAA;;AAGrC,IAAA,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAuC,EAAE,SAAS,EAAE,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AACnJ,IAAA,OAAO,GAAG,KAAK,CAAU,KAAK,CAAC;AAC/B,IAAA,WAAW,GAAG,KAAK,CAAS,EAAE,CAAC;;IAG/B,cAAc,GAAG,MAAM,EAAU;;AAGhC,IAAA,MAAM,iBAAiB,CAAC,KAAiB,EAAE,IAAgB,EAAA;QACnE,KAAK,CAAC,eAAe,EAAE;QACvB,IAAI,IAAI,CAAC,OAAO,EAAE,IAAI,IAAI,CAAC,OAAO,EAAE;YAClC;;QAEF,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC;QAC9B,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;;wGAjBnC,mCAAmC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAnC,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,mCAAmC,sjBCpBhD,6jCAsBA,EAAA,MAAA,EAAA,CAAA,ieAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EDRI,eAAe,EACf,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EAAA,EAAA,CAAA,aAAA,EAAA,IAAA,EAAA,WAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,gCAAgC,0dAChC,8BAA8B,EAAA,QAAA,EAAA,0BAAA,EAAA,MAAA,EAAA,CAAA,eAAA,EAAA,QAAA,EAAA,OAAA,EAAA,MAAA,EAAA,UAAA,EAAA,qBAAA,EAAA,aAAA,EAAA,4BAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FAIrB,mCAAmC,EAAA,UAAA,EAAA,CAAA;kBAb/C,SAAS;+BAEE,gCAAgC,EAAA,UAAA,EAG9B,IAAI,EACP,OAAA,EAAA;wBACP,eAAe;wBACf,gCAAgC;wBAChC;qBACD,EACgB,eAAA,EAAA,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,6jCAAA,EAAA,MAAA,EAAA,CAAA,ieAAA,CAAA,EAAA;;;AElBjD;;AAEG;;;;"}
1
+ {"version":3,"file":"libs-ui-components-buttons-tab.mjs","sources":["../../../../../../libs-ui/components/buttons/tab/src/tab.component.ts","../../../../../../libs-ui/components/buttons/tab/src/tab.component.html","../../../../../../libs-ui/components/buttons/tab/src/libs-ui-components-buttons-tab.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, effect, ElementRef, input, model, output, viewChild } from '@angular/core';\nimport { LibsUiComponentsBadgeComponent } from '@libs-ui/components-badge';\nimport { LibsUiComponentsPopoverComponent } from '@libs-ui/components-popover';\nimport { colorStepContrastFromOrigin, escapeHtml } from '@libs-ui/utils';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { IButtonTab, IOtherConfig } from './interfaces/tab.interface';\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'libs_ui-components-buttons-tab',\n templateUrl: './tab.component.html',\n styleUrl: './tab.component.scss',\n standalone: true,\n imports: [\n TranslateModule,\n LibsUiComponentsPopoverComponent,\n LibsUiComponentsBadgeComponent\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class LibsUiComponentsButtonsTabComponent {\n\n private readonly otherStyleClassButtonTabEl = document.createElement('style');\n\n // #region INPUT\n readonly items = input.required<Array<IButtonTab>, Array<IButtonTab>>({ transform: data => data.map(item => ({ ...item, label: escapeHtml(item.label) })) });\n readonly disable = input<boolean>(false);\n readonly keySelected = model<string>('');\n readonly otherConfig = input<IOtherConfig>(); // required and only apply when type is other\n\n // #region OUTPUT\n readonly outKeySelected = output<string>();\n\n /* VIEW CHILD */\n private readonly buttonEl = viewChild<ElementRef>('buttonEl');\n\n constructor() {\n effect(() => {\n const config = this.otherConfig();\n\n if (config) {\n const background = config.background || colorStepContrastFromOrigin(config.color, 95)?.light;\n const backgroundBadge = config.background_badge || colorStepContrastFromOrigin(config.color, 90)?.light;\n const styles = `.libs-ui-button-tab-other[active=\"true\"] {\n background-color: ${background} !important;\n }\n \n .libs-ui-button-tab-other[active=\"true\"] > .libs-ui-button-tab-label {\n color: ${config.color} !important;\n }\n \n .libs-ui-button-tab-other[active=\"true\"] > .libs-ui-button-tab-badge > .libs-ui-button-tab-badge-circle {\n color: ${config.color} !important;\n background-color: ${backgroundBadge} !important;\n }`;\n this.otherStyleClassButtonTabEl.innerHTML = styles;\n this.buttonEl()?.nativeElement.append(this.otherStyleClassButtonTabEl);\n }\n });\n }\n\n /* FUNCTIONS */\n protected async handlerSelectItem(event: MouseEvent, item: IButtonTab) {\n event.stopPropagation();\n if (this.disable() || item.disable) {\n return;\n }\n this.keySelected.set(item.key);\n this.outKeySelected.emit(this.keySelected());\n }\n\n}\n","<div #buttonEl\n class=\"flex\">\n @for (item of items(); track item) {\n <div class=\"flex items-center libs-ui-button-tab {{ 'libs-ui-button-tab-'+item.type }} {{ item.class || 'px-[8px] mx-[8px] py-[4px]' }} {{ (disable() || item.disable) ? 'pointer-events-none cursor-default' : 'cursor-pointer' }}\"\n [attr.active]=\"item.key === keySelected()\"\n (click)=\"handlerSelectItem($event, item)\">\n <span LibsUiComponentsPopoverDirective\n class=\"w-full libs-ui-button-tab-label {{ item.classLabel || 'libs-ui-font-h6r' }}\"\n [class.libs-ui-disable]=\"disable() || item.disable\"\n [type]=\"'text'\"\n [attr.active]=\"item.key === keySelected()\"\n [ignoreStopPropagationEvent]=\"true\"\n [innerHtml]=\"item.label | translate\"></span>\n @if (item.count !== undefined) {\n <libs_ui-components-badge class=\"libs-ui-button-tab-badge\"\n [mode]=\"item.modeCount || 'x+'\"\n [count]=\"item.count\"\n [maxCount]=\"item.maxCount || 99\"\n [classCircle]=\"'libs-ui-button-tab-badge-circle libs-ui-font-h6r'\" />\n }\n </div>\n }\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MAoBa,mCAAmC,CAAA;AAE7B,IAAA,0BAA0B,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC;;AAGpE,IAAA,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAuC,EAAE,SAAS,EAAE,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;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AI,CAAC,WAAW,EAAE,CAAC;IAC9C;wGAjDW,mCAAmC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAnC,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,mCAAmC,szBCpBhD,qoCAuBA,EAAA,MAAA,EAAA,CAAA,ulBAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EDTI,eAAe,EAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EAAA,EAAA,CAAA,aAAA,EAAA,IAAA,EAAA,WAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EACf,gCAAgC,ogBAChC,8BAA8B,EAAA,QAAA,EAAA,0BAAA,EAAA,MAAA,EAAA,CAAA,eAAA,EAAA,QAAA,EAAA,OAAA,EAAA,MAAA,EAAA,UAAA,EAAA,qBAAA,EAAA,aAAA,EAAA,4BAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FAIrB,mCAAmC,EAAA,UAAA,EAAA,CAAA;kBAb/C,SAAS;+BAEE,gCAAgC,EAAA,UAAA,EAG9B,IAAI,EAAA,OAAA,EACP;wBACP,eAAe;wBACf,gCAAgC;wBAChC;qBACD,EAAA,eAAA,EACgB,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,qoCAAA,EAAA,MAAA,EAAA,CAAA,ulBAAA,CAAA,EAAA;;;AElBjD;;AAEG;;;;"}
package/index.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export * from './tab.component';
2
+ export * from './interfaces/tab.interface';
@@ -11,4 +11,9 @@ export interface IButtonTab {
11
11
  disable?: boolean;
12
12
  data?: any;
13
13
  }
14
+ export interface IOtherConfig {
15
+ color: string;
16
+ background?: string;
17
+ background_badge?: string;
18
+ }
14
19
  export type TYPE_BUTTON_TAB = 'blue' | 'green' | 'red' | 'orange' | 'yellow' | 'cyan' | 'purple' | 'brown' | 'other' | string;
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@libs-ui/components-buttons-tab",
3
- "version": "0.2.29",
3
+ "version": "0.2.306.2",
4
4
  "peerDependencies": {
5
- "@angular/common": "^18.2.0",
6
- "@angular/core": "^18.2.0"
5
+ "@angular/core": ">=18.0.0",
6
+ "@libs-ui/components-badge": "0.2.306.2",
7
+ "@libs-ui/components-popover": "0.2.306.2",
8
+ "@libs-ui/utils": "0.2.306.2",
9
+ "@ngx-translate/core": "^15.0.0"
7
10
  },
8
11
  "sideEffects": false,
9
12
  "module": "fesm2022/libs-ui-components-buttons-tab.mjs",
@@ -1,11 +1,15 @@
1
- import { IButtonTab } from './interfaces/tab.interface';
1
+ import { IButtonTab, IOtherConfig } from './interfaces/tab.interface';
2
2
  import * as i0 from "@angular/core";
3
3
  export declare class LibsUiComponentsButtonsTabComponent {
4
+ private readonly otherStyleClassButtonTabEl;
4
5
  readonly items: import("@angular/core").InputSignalWithTransform<IButtonTab[], IButtonTab[]>;
5
6
  readonly disable: import("@angular/core").InputSignal<boolean>;
6
7
  readonly keySelected: import("@angular/core").ModelSignal<string>;
8
+ readonly otherConfig: import("@angular/core").InputSignal<IOtherConfig | undefined>;
7
9
  readonly outKeySelected: import("@angular/core").OutputEmitterRef<string>;
10
+ private readonly buttonEl;
11
+ constructor();
8
12
  protected handlerSelectItem(event: MouseEvent, item: IButtonTab): Promise<void>;
9
13
  static ɵfac: i0.ɵɵFactoryDeclaration<LibsUiComponentsButtonsTabComponent, never>;
10
- static ɵcmp: i0.ɵɵComponentDeclaration<LibsUiComponentsButtonsTabComponent, "libs_ui-components-buttons-tab", never, { "items": { "alias": "items"; "required": true; "isSignal": true; }; "disable": { "alias": "disable"; "required": false; "isSignal": true; }; "keySelected": { "alias": "keySelected"; "required": false; "isSignal": true; }; }, { "keySelected": "keySelectedChange"; "outKeySelected": "outKeySelected"; }, never, never, true, never>;
14
+ static ɵcmp: i0.ɵɵComponentDeclaration<LibsUiComponentsButtonsTabComponent, "libs_ui-components-buttons-tab", never, { "items": { "alias": "items"; "required": true; "isSignal": true; }; "disable": { "alias": "disable"; "required": false; "isSignal": true; }; "keySelected": { "alias": "keySelected"; "required": false; "isSignal": true; }; "otherConfig": { "alias": "otherConfig"; "required": false; "isSignal": true; }; }, { "keySelected": "keySelectedChange"; "outKeySelected": "outKeySelected"; }, never, never, true, never>;
11
15
  }