@weeehaoooz/talos-ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +85 -0
- package/fesm2022/weeehaoooz-talos-ui-button-button-group.mjs +237 -0
- package/fesm2022/weeehaoooz-talos-ui-button-button-group.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-button-button.mjs +93 -0
- package/fesm2022/weeehaoooz-talos-ui-button-button.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-core.mjs +438 -0
- package/fesm2022/weeehaoooz-talos-ui-core.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-data-display-badge.mjs +233 -0
- package/fesm2022/weeehaoooz-talos-ui-data-display-badge.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-data-display-status-tag.mjs +361 -0
- package/fesm2022/weeehaoooz-talos-ui-data-display-status-tag.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-data-display-timeline.mjs +312 -0
- package/fesm2022/weeehaoooz-talos-ui-data-display-timeline.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-data-display-trend-indicator.mjs +235 -0
- package/fesm2022/weeehaoooz-talos-ui-data-display-trend-indicator.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-data-viz-category-bar.mjs +462 -0
- package/fesm2022/weeehaoooz-talos-ui-data-viz-category-bar.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-data-viz-heatmap.mjs +805 -0
- package/fesm2022/weeehaoooz-talos-ui-data-viz-heatmap.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-data-viz-mini-donut.mjs +267 -0
- package/fesm2022/weeehaoooz-talos-ui-data-viz-mini-donut.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-data-viz-mini-gauge.mjs +351 -0
- package/fesm2022/weeehaoooz-talos-ui-data-viz-mini-gauge.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-data-viz-sparkline.mjs +566 -0
- package/fesm2022/weeehaoooz-talos-ui-data-viz-sparkline.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-feedback-alert.mjs +534 -0
- package/fesm2022/weeehaoooz-talos-ui-feedback-alert.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-feedback-dialog.mjs +446 -0
- package/fesm2022/weeehaoooz-talos-ui-feedback-dialog.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-feedback-snackbar.mjs +376 -0
- package/fesm2022/weeehaoooz-talos-ui-feedback-snackbar.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-feedback-tooltip.mjs +147 -0
- package/fesm2022/weeehaoooz-talos-ui-feedback-tooltip.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-affix.mjs +242 -0
- package/fesm2022/weeehaoooz-talos-ui-form-affix.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-autocomplete.mjs +514 -0
- package/fesm2022/weeehaoooz-talos-ui-form-autocomplete.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-checkbox.mjs +548 -0
- package/fesm2022/weeehaoooz-talos-ui-form-checkbox.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-chips.mjs +692 -0
- package/fesm2022/weeehaoooz-talos-ui-form-chips.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-color-picker.mjs +761 -0
- package/fesm2022/weeehaoooz-talos-ui-form-color-picker.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-date-picker.mjs +896 -0
- package/fesm2022/weeehaoooz-talos-ui-form-date-picker.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-date-range-picker.mjs +872 -0
- package/fesm2022/weeehaoooz-talos-ui-form-date-range-picker.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-date-time-picker.mjs +119 -0
- package/fesm2022/weeehaoooz-talos-ui-form-date-time-picker.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-date-time-range-picker.mjs +135 -0
- package/fesm2022/weeehaoooz-talos-ui-form-date-time-range-picker.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-drop-zone.mjs +666 -0
- package/fesm2022/weeehaoooz-talos-ui-form-drop-zone.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-form-field.mjs +147 -0
- package/fesm2022/weeehaoooz-talos-ui-form-form-field.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-input.mjs +33 -0
- package/fesm2022/weeehaoooz-talos-ui-form-input.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-otp.mjs +455 -0
- package/fesm2022/weeehaoooz-talos-ui-form-otp.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-password-input.mjs +379 -0
- package/fesm2022/weeehaoooz-talos-ui-form-password-input.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-radio.mjs +297 -0
- package/fesm2022/weeehaoooz-talos-ui-form-radio.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-range-input.mjs +661 -0
- package/fesm2022/weeehaoooz-talos-ui-form-range-input.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-rating.mjs +346 -0
- package/fesm2022/weeehaoooz-talos-ui-form-rating.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-select-input.mjs +896 -0
- package/fesm2022/weeehaoooz-talos-ui-form-select-input.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-slide-toggle.mjs +252 -0
- package/fesm2022/weeehaoooz-talos-ui-form-slide-toggle.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-transfer-list.mjs +916 -0
- package/fesm2022/weeehaoooz-talos-ui-form-transfer-list.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-layout.mjs +851 -0
- package/fesm2022/weeehaoooz-talos-ui-layout.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-nav.mjs +897 -0
- package/fesm2022/weeehaoooz-talos-ui-nav.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui.mjs +17058 -0
- package/fesm2022/weeehaoooz-talos-ui.mjs.map +1 -0
- package/package.json +203 -0
- package/schematics/collection.json +10 -0
- package/schematics/ng-add/index.d.ts +3 -0
- package/schematics/ng-add/index.js +99 -0
- package/schematics/ng-add/schema.d.ts +10 -0
- package/schematics/ng-add/schema.js +2 -0
- package/schematics/ng-add/schema.json +52 -0
- package/styles/_alert.scss +56 -0
- package/styles/_badge.scss +279 -0
- package/styles/_button-group.scss +470 -0
- package/styles/_buttons.scss +442 -0
- package/styles/_card.scss +18 -0
- package/styles/_dialog.scss +116 -0
- package/styles/_drop-zone.scss +19 -0
- package/styles/_form-controls.scss +660 -0
- package/styles/_slide-toggle.scss +171 -0
- package/styles/_status-tag.scss +108 -0
- package/styles/_timeline.scss +19 -0
- package/styles/_tooltip.scss +32 -0
- package/styles/_typography.scss +279 -0
- package/styles/_variables.scss +590 -0
- package/styles/index.scss +15 -0
- package/types/weeehaoooz-talos-ui-button-button-group.d.ts +59 -0
- package/types/weeehaoooz-talos-ui-button-button-group.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-button-button.d.ts +38 -0
- package/types/weeehaoooz-talos-ui-button-button.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-core.d.ts +95 -0
- package/types/weeehaoooz-talos-ui-core.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-data-display-badge.d.ts +119 -0
- package/types/weeehaoooz-talos-ui-data-display-badge.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-data-display-status-tag.d.ts +135 -0
- package/types/weeehaoooz-talos-ui-data-display-status-tag.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-data-display-timeline.d.ts +144 -0
- package/types/weeehaoooz-talos-ui-data-display-timeline.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-data-display-trend-indicator.d.ts +83 -0
- package/types/weeehaoooz-talos-ui-data-display-trend-indicator.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-data-viz-category-bar.d.ts +255 -0
- package/types/weeehaoooz-talos-ui-data-viz-category-bar.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-data-viz-heatmap.d.ts +204 -0
- package/types/weeehaoooz-talos-ui-data-viz-heatmap.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-data-viz-mini-donut.d.ts +101 -0
- package/types/weeehaoooz-talos-ui-data-viz-mini-donut.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-data-viz-mini-gauge.d.ts +138 -0
- package/types/weeehaoooz-talos-ui-data-viz-mini-gauge.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-data-viz-sparkline.d.ts +161 -0
- package/types/weeehaoooz-talos-ui-data-viz-sparkline.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-feedback-alert.d.ts +212 -0
- package/types/weeehaoooz-talos-ui-feedback-alert.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-feedback-dialog.d.ts +259 -0
- package/types/weeehaoooz-talos-ui-feedback-dialog.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-feedback-snackbar.d.ts +147 -0
- package/types/weeehaoooz-talos-ui-feedback-snackbar.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-feedback-tooltip.d.ts +32 -0
- package/types/weeehaoooz-talos-ui-feedback-tooltip.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-affix.d.ts +88 -0
- package/types/weeehaoooz-talos-ui-form-affix.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-autocomplete.d.ts +113 -0
- package/types/weeehaoooz-talos-ui-form-autocomplete.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-checkbox.d.ts +165 -0
- package/types/weeehaoooz-talos-ui-form-checkbox.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-chips.d.ts +152 -0
- package/types/weeehaoooz-talos-ui-form-chips.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-color-picker.d.ts +144 -0
- package/types/weeehaoooz-talos-ui-form-color-picker.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-date-picker.d.ts +138 -0
- package/types/weeehaoooz-talos-ui-form-date-picker.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-date-range-picker.d.ts +148 -0
- package/types/weeehaoooz-talos-ui-form-date-range-picker.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-date-time-picker.d.ts +44 -0
- package/types/weeehaoooz-talos-ui-form-date-time-picker.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-date-time-range-picker.d.ts +48 -0
- package/types/weeehaoooz-talos-ui-form-date-time-range-picker.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-drop-zone.d.ts +227 -0
- package/types/weeehaoooz-talos-ui-form-drop-zone.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-form-field.d.ts +42 -0
- package/types/weeehaoooz-talos-ui-form-form-field.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-input.d.ts +15 -0
- package/types/weeehaoooz-talos-ui-form-input.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-otp.d.ts +111 -0
- package/types/weeehaoooz-talos-ui-form-otp.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-password-input.d.ts +145 -0
- package/types/weeehaoooz-talos-ui-form-password-input.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-radio.d.ts +84 -0
- package/types/weeehaoooz-talos-ui-form-radio.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-range-input.d.ts +181 -0
- package/types/weeehaoooz-talos-ui-form-range-input.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-rating.d.ts +110 -0
- package/types/weeehaoooz-talos-ui-form-rating.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-select-input.d.ts +195 -0
- package/types/weeehaoooz-talos-ui-form-select-input.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-slide-toggle.d.ts +79 -0
- package/types/weeehaoooz-talos-ui-form-slide-toggle.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-transfer-list.d.ts +192 -0
- package/types/weeehaoooz-talos-ui-form-transfer-list.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-layout.d.ts +286 -0
- package/types/weeehaoooz-talos-ui-layout.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-nav.d.ts +384 -0
- package/types/weeehaoooz-talos-ui-nav.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui.d.ts +5050 -0
- package/types/weeehaoooz-talos-ui.d.ts.map +1 -0
|
@@ -0,0 +1,692 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, output, computed, Component, inject, ElementRef, signal, effect, forwardRef, ViewChild, NgModule } from '@angular/core';
|
|
3
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
4
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
5
|
+
|
|
6
|
+
class TalosChipComponent {
|
|
7
|
+
label = input('', /* @ts-ignore */
|
|
8
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
9
|
+
value = input(null, /* @ts-ignore */
|
|
10
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
11
|
+
size = input('sm', /* @ts-ignore */
|
|
12
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
13
|
+
variant = input('subtle', /* @ts-ignore */
|
|
14
|
+
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
15
|
+
color = input('primary', /* @ts-ignore */
|
|
16
|
+
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
17
|
+
removable = input(true, /* @ts-ignore */
|
|
18
|
+
...(ngDevMode ? [{ debugName: "removable" }] : /* istanbul ignore next */ []));
|
|
19
|
+
disabled = input(false, /* @ts-ignore */
|
|
20
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
21
|
+
avatarUrl = input('', /* @ts-ignore */
|
|
22
|
+
...(ngDevMode ? [{ debugName: "avatarUrl" }] : /* istanbul ignore next */ []));
|
|
23
|
+
removeAriaLabel = input('Remove', /* @ts-ignore */
|
|
24
|
+
...(ngDevMode ? [{ debugName: "removeAriaLabel" }] : /* istanbul ignore next */ []));
|
|
25
|
+
removed = output();
|
|
26
|
+
chipClick = output();
|
|
27
|
+
hasAvatar = computed(() => !!this.avatarUrl(), /* @ts-ignore */
|
|
28
|
+
...(ngDevMode ? [{ debugName: "hasAvatar" }] : /* istanbul ignore next */ []));
|
|
29
|
+
onChipClick(event) {
|
|
30
|
+
if (this.disabled())
|
|
31
|
+
return;
|
|
32
|
+
this.chipClick.emit(this.value() ?? this.label());
|
|
33
|
+
}
|
|
34
|
+
onRemove(event) {
|
|
35
|
+
event.stopPropagation();
|
|
36
|
+
event.preventDefault();
|
|
37
|
+
if (this.disabled())
|
|
38
|
+
return;
|
|
39
|
+
this.removed.emit(this.value() ?? this.label());
|
|
40
|
+
}
|
|
41
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: TalosChipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
42
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.1", type: TalosChipComponent, isStandalone: true, selector: "talos-chip", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, removable: { classPropertyName: "removable", publicName: "removable", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, avatarUrl: { classPropertyName: "avatarUrl", publicName: "avatarUrl", isSignal: true, isRequired: false, transformFunction: null }, removeAriaLabel: { classPropertyName: "removeAriaLabel", publicName: "removeAriaLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { removed: "removed", chipClick: "chipClick" }, host: { listeners: { "click": "onChipClick($event)" }, properties: { "class.talos-chip-sm": "size() === \"sm\"", "class.talos-chip-md": "size() === \"md\"", "class.talos-chip-lg": "size() === \"lg\"", "class.talos-chip-filled": "variant() === \"filled\"", "class.talos-chip-outline": "variant() === \"outline\"", "class.talos-chip-subtle": "variant() === \"subtle\"", "class.talos-chip-primary": "color() === \"primary\"", "class.talos-chip-neutral": "color() === \"neutral\"", "class.talos-chip-success": "color() === \"success\"", "class.talos-chip-warning": "color() === \"warning\"", "class.talos-chip-error": "color() === \"error\"", "class.talos-chip-indigo": "color() === \"indigo\"", "class.talos-chip-purple": "color() === \"purple\"", "class.talos-chip-cyan": "color() === \"cyan\"", "class.is-disabled": "disabled()", "class.is-removable": "removable() && !disabled()", "attr.aria-disabled": "disabled() ? \"true\" : null" }, classAttribute: "talos-chip" }, ngImport: i0, template: "@if (avatarUrl()) {\n <span class=\"talos-chip-avatar\">\n <img [src]=\"avatarUrl()\" alt=\"\" aria-hidden=\"true\" />\n </span>\n}\n\n<span class=\"talos-chip-content\">\n <ng-content>{{ label() }}</ng-content>\n</span>\n\n@if (removable() && !disabled()) {\n <button\n type=\"button\"\n class=\"talos-chip-remove-btn\"\n [attr.aria-label]=\"removeAriaLabel() + (label() ? ' ' + label() : '')\"\n (click)=\"onRemove($event)\"\n >\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"></line>\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"></line>\n </svg>\n </button>\n}\n", styles: [":host{display:inline-flex;align-items:center;gap:.375rem;font-family:inherit;font-weight:500;border-radius:var(--talos-chip-radius, 9999px);-webkit-user-select:none;user-select:none;white-space:nowrap;vertical-align:middle;box-sizing:border-box;max-width:100%;line-height:1;transition:all .15s cubic-bezier(.4,0,.2,1);position:relative;outline:none}:host.talos-chip-sm{height:1.5rem;padding:0 .5rem;font-size:.75rem}:host.talos-chip-sm.is-removable{padding-right:.25rem}:host.talos-chip-sm .talos-chip-avatar{width:1rem;height:1rem;margin-left:-.25rem}:host.talos-chip-sm .talos-chip-remove-btn{width:1rem;height:1rem}:host.talos-chip-sm .talos-chip-remove-btn svg{width:.625rem;height:.625rem}:host.talos-chip-md{height:1.875rem;padding:0 .625rem;font-size:.8125rem}:host.talos-chip-md.is-removable{padding-right:.375rem}:host.talos-chip-md .talos-chip-avatar{width:1.25rem;height:1.25rem;margin-left:-.375rem}:host.talos-chip-md .talos-chip-remove-btn{width:1.125rem;height:1.125rem}:host.talos-chip-md .talos-chip-remove-btn svg{width:.75rem;height:.75rem}:host.talos-chip-lg{height:2.25rem;padding:0 .75rem;font-size:.875rem}:host.talos-chip-lg.is-removable{padding-right:.5rem}:host.talos-chip-lg .talos-chip-avatar{width:1.5rem;height:1.5rem;margin-left:-.5rem}:host.talos-chip-lg .talos-chip-remove-btn{width:1.25rem;height:1.25rem}:host.talos-chip-lg .talos-chip-remove-btn svg{width:.875rem;height:.875rem}:host.talos-chip-primary.talos-chip-subtle{background-color:var(--talos-primary-50, rgba(37, 99, 235, .08));color:var(--talos-primary-700, #1d4ed8);border:1px solid var(--talos-primary-200, rgba(37, 99, 235, .2))}:host.talos-chip-primary.talos-chip-subtle .talos-chip-remove-btn{color:var(--talos-primary-600, #2563eb)}:host.talos-chip-primary.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:var(--talos-primary-100, rgba(37, 99, 235, .18));color:var(--talos-primary-800, #1e40af)}:host.talos-chip-primary.talos-chip-filled{background-color:var(--talos-primary-600, #2563eb);color:#fff;border:1px solid transparent}:host.talos-chip-primary.talos-chip-filled .talos-chip-remove-btn{color:#ffffffd9}:host.talos-chip-primary.talos-chip-filled .talos-chip-remove-btn:hover{background-color:#fff3;color:#fff}:host.talos-chip-primary.talos-chip-outline{background-color:transparent;color:var(--talos-primary-600, #2563eb);border:1px solid var(--talos-primary-400, #60a5fa)}:host.talos-chip-primary.talos-chip-outline .talos-chip-remove-btn{color:var(--talos-primary-600, #2563eb)}:host.talos-chip-primary.talos-chip-outline .talos-chip-remove-btn:hover{background-color:var(--talos-primary-50, rgba(37, 99, 235, .1))}:host.talos-chip-neutral.talos-chip-subtle{background-color:var(--talos-gray-100, #f1f5f9);color:var(--talos-gray-800, #1e293b);border:1px solid var(--talos-gray-200, #e2e8f0)}:host.talos-chip-neutral.talos-chip-subtle .talos-chip-remove-btn{color:var(--talos-gray-500, #64748b)}:host.talos-chip-neutral.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:var(--talos-gray-200, #e2e8f0);color:var(--talos-gray-800, #1e293b)}:host.talos-chip-neutral.talos-chip-filled{background-color:var(--talos-gray-700, #334155);color:#fff;border:1px solid transparent}:host.talos-chip-neutral.talos-chip-filled .talos-chip-remove-btn{color:#ffffffd9}:host.talos-chip-neutral.talos-chip-filled .talos-chip-remove-btn:hover{background-color:#fff3;color:#fff}:host.talos-chip-neutral.talos-chip-outline{background-color:transparent;color:var(--talos-gray-700, #334155);border:1px solid var(--talos-gray-300, #cbd5e1)}:host.talos-chip-neutral.talos-chip-outline .talos-chip-remove-btn{color:var(--talos-gray-500, #64748b)}:host.talos-chip-neutral.talos-chip-outline .talos-chip-remove-btn:hover{background-color:var(--talos-gray-100, #f1f5f9)}:host.talos-chip-success.talos-chip-subtle{background-color:#10b9811a;color:#065f46;border:1px solid rgba(16,185,129,.25)}:host.talos-chip-success.talos-chip-subtle .talos-chip-remove-btn{color:#059669}:host.talos-chip-success.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:#10b98133;color:#064e3b}:host.talos-chip-success.talos-chip-filled{background-color:#10b981;color:#fff;border:1px solid transparent}:host.talos-chip-success.talos-chip-filled .talos-chip-remove-btn{color:#ffffffd9}:host.talos-chip-success.talos-chip-filled .talos-chip-remove-btn:hover{background-color:#fff3}:host.talos-chip-success.talos-chip-outline{background-color:transparent;color:#10b981;border:1px solid #34d399}:host.talos-chip-success.talos-chip-outline .talos-chip-remove-btn{color:#10b981}:host.talos-chip-success.talos-chip-outline .talos-chip-remove-btn:hover{background-color:#10b9811a}:host.talos-chip-warning.talos-chip-subtle{background-color:#f59e0b1a;color:#92400e;border:1px solid rgba(245,158,11,.25)}:host.talos-chip-warning.talos-chip-subtle .talos-chip-remove-btn{color:#d97706}:host.talos-chip-warning.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:#f59e0b33;color:#78350f}:host.talos-chip-warning.talos-chip-filled{background-color:#f59e0b;color:#fff;border:1px solid transparent}:host.talos-chip-warning.talos-chip-filled .talos-chip-remove-btn{color:#ffffffd9}:host.talos-chip-warning.talos-chip-filled .talos-chip-remove-btn:hover{background-color:#fff3}:host.talos-chip-warning.talos-chip-outline{background-color:transparent;color:#d97706;border:1px solid #fbbf24}:host.talos-chip-warning.talos-chip-outline .talos-chip-remove-btn{color:#d97706}:host.talos-chip-warning.talos-chip-outline .talos-chip-remove-btn:hover{background-color:#f59e0b1a}:host.talos-chip-error.talos-chip-subtle{background-color:#ef44441a;color:#991b1b;border:1px solid rgba(239,68,68,.25)}:host.talos-chip-error.talos-chip-subtle .talos-chip-remove-btn{color:#ef4444}:host.talos-chip-error.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:#ef444433;color:#7f1d1d}:host.talos-chip-error.talos-chip-filled{background-color:#ef4444;color:#fff;border:1px solid transparent}:host.talos-chip-error.talos-chip-filled .talos-chip-remove-btn{color:#ffffffd9}:host.talos-chip-error.talos-chip-filled .talos-chip-remove-btn:hover{background-color:#fff3}:host.talos-chip-error.talos-chip-outline{background-color:transparent;color:#ef4444;border:1px solid #f87171}:host.talos-chip-error.talos-chip-outline .talos-chip-remove-btn{color:#ef4444}:host.talos-chip-error.talos-chip-outline .talos-chip-remove-btn:hover{background-color:#ef44441a}:host.talos-chip-indigo.talos-chip-subtle{background-color:#6366f11a;color:#3730a3;border:1px solid rgba(99,102,241,.25)}:host.talos-chip-indigo.talos-chip-subtle .talos-chip-remove-btn{color:#6366f1}:host.talos-chip-indigo.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:#6366f133;color:#312e81}:host.talos-chip-indigo.talos-chip-filled{background-color:#6366f1;color:#fff;border:1px solid transparent}:host.talos-chip-indigo.talos-chip-filled .talos-chip-remove-btn{color:#ffffffd9}:host.talos-chip-indigo.talos-chip-filled .talos-chip-remove-btn:hover{background-color:#fff3}:host.talos-chip-indigo.talos-chip-outline{background-color:transparent;color:#6366f1;border:1px solid #818cf8}:host.talos-chip-indigo.talos-chip-outline .talos-chip-remove-btn{color:#6366f1}:host.talos-chip-indigo.talos-chip-outline .talos-chip-remove-btn:hover{background-color:#6366f11a}:host.talos-chip-purple.talos-chip-subtle{background-color:#a855f71a;color:#6b21a8;border:1px solid rgba(168,85,247,.25)}:host.talos-chip-purple.talos-chip-subtle .talos-chip-remove-btn{color:#a855f7}:host.talos-chip-purple.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:#a855f733;color:#581c87}:host.talos-chip-purple.talos-chip-filled{background-color:#a855f7;color:#fff;border:1px solid transparent}:host.talos-chip-purple.talos-chip-filled .talos-chip-remove-btn{color:#ffffffd9}:host.talos-chip-purple.talos-chip-filled .talos-chip-remove-btn:hover{background-color:#fff3}:host.talos-chip-purple.talos-chip-outline{background-color:transparent;color:#a855f7;border:1px solid #c084fc}:host.talos-chip-purple.talos-chip-outline .talos-chip-remove-btn{color:#a855f7}:host.talos-chip-purple.talos-chip-outline .talos-chip-remove-btn:hover{background-color:#a855f71a}:host.talos-chip-cyan.talos-chip-subtle{background-color:#06b6d41a;color:#155e75;border:1px solid rgba(6,182,212,.25)}:host.talos-chip-cyan.talos-chip-subtle .talos-chip-remove-btn{color:#0891b2}:host.talos-chip-cyan.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:#06b6d433;color:#164e63}:host.talos-chip-cyan.talos-chip-filled{background-color:#06b6d4;color:#fff;border:1px solid transparent}:host.talos-chip-cyan.talos-chip-filled .talos-chip-remove-btn{color:#ffffffd9}:host.talos-chip-cyan.talos-chip-filled .talos-chip-remove-btn:hover{background-color:#fff3}:host.talos-chip-cyan.talos-chip-outline{background-color:transparent;color:#0891b2;border:1px solid #22d3ee}:host.talos-chip-cyan.talos-chip-outline .talos-chip-remove-btn{color:#0891b2}:host.talos-chip-cyan.talos-chip-outline .talos-chip-remove-btn:hover{background-color:#06b6d41a}:host.is-disabled{opacity:.55;cursor:not-allowed;pointer-events:none}.talos-chip-avatar{display:inline-flex;align-items:center;justify-content:center;border-radius:9999px;overflow:hidden;flex-shrink:0}.talos-chip-avatar img{width:100%;height:100%;object-fit:cover}.talos-chip-content{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.talos-chip-remove-btn{display:inline-flex;align-items:center;justify-content:center;padding:0;border:none;background:transparent;cursor:pointer;border-radius:9999px;transition:all .12s ease;flex-shrink:0;outline:none}.talos-chip-remove-btn:focus-visible{box-shadow:0 0 0 2px var(--talos-primary-400, #60a5fa)}:host-context([data-theme=dark]).talos-chip-neutral.talos-chip-subtle,:host-context(.dark).talos-chip-neutral.talos-chip-subtle{background-color:#ffffff14;color:#e2e8f0;border-color:#ffffff1f}:host-context([data-theme=dark]).talos-chip-neutral.talos-chip-subtle .talos-chip-remove-btn,:host-context(.dark).talos-chip-neutral.talos-chip-subtle .talos-chip-remove-btn{color:#94a3b8}:host-context([data-theme=dark]).talos-chip-neutral.talos-chip-subtle .talos-chip-remove-btn:hover,:host-context(.dark).talos-chip-neutral.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:#ffffff26;color:#fff}:host-context([data-theme=dark]).talos-chip-primary.talos-chip-subtle,:host-context(.dark).talos-chip-primary.talos-chip-subtle{background-color:#3b82f626;color:#93c5fd;border-color:#3b82f64d}:host-context([data-theme=dark]).talos-chip-primary.talos-chip-subtle .talos-chip-remove-btn,:host-context(.dark).talos-chip-primary.talos-chip-subtle .talos-chip-remove-btn{color:#93c5fd}:host-context([data-theme=dark]).talos-chip-primary.talos-chip-subtle .talos-chip-remove-btn:hover,:host-context(.dark).talos-chip-primary.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:#3b82f640;color:#fff}:host-context([data-theme=dark]).talos-chip-success.talos-chip-subtle,:host-context(.dark).talos-chip-success.talos-chip-subtle{background-color:#10b98126;color:#6ee7b7;border-color:#10b9814d}:host-context([data-theme=dark]).talos-chip-success.talos-chip-subtle .talos-chip-remove-btn,:host-context(.dark).talos-chip-success.talos-chip-subtle .talos-chip-remove-btn{color:#6ee7b7}:host-context([data-theme=dark]).talos-chip-success.talos-chip-subtle .talos-chip-remove-btn:hover,:host-context(.dark).talos-chip-success.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:#10b98140;color:#fff}:host-context([data-theme=dark]).talos-chip-warning.talos-chip-subtle,:host-context(.dark).talos-chip-warning.talos-chip-subtle{background-color:#f59e0b26;color:#fcd34d;border-color:#f59e0b4d}:host-context([data-theme=dark]).talos-chip-warning.talos-chip-subtle .talos-chip-remove-btn,:host-context(.dark).talos-chip-warning.talos-chip-subtle .talos-chip-remove-btn{color:#fcd34d}:host-context([data-theme=dark]).talos-chip-warning.talos-chip-subtle .talos-chip-remove-btn:hover,:host-context(.dark).talos-chip-warning.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:#f59e0b40;color:#fff}:host-context([data-theme=dark]).talos-chip-error.talos-chip-subtle,:host-context(.dark).talos-chip-error.talos-chip-subtle{background-color:#ef444426;color:#fca5a5;border-color:#ef44444d}:host-context([data-theme=dark]).talos-chip-error.talos-chip-subtle .talos-chip-remove-btn,:host-context(.dark).talos-chip-error.talos-chip-subtle .talos-chip-remove-btn{color:#fca5a5}:host-context([data-theme=dark]).talos-chip-error.talos-chip-subtle .talos-chip-remove-btn:hover,:host-context(.dark).talos-chip-error.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:#ef444440;color:#fff}:host-context([data-theme=dark]).talos-chip-indigo.talos-chip-subtle,:host-context(.dark).talos-chip-indigo.talos-chip-subtle{background-color:#6366f126;color:#a5b4fc;border-color:#6366f14d}:host-context([data-theme=dark]).talos-chip-indigo.talos-chip-subtle .talos-chip-remove-btn,:host-context(.dark).talos-chip-indigo.talos-chip-subtle .talos-chip-remove-btn{color:#a5b4fc}:host-context([data-theme=dark]).talos-chip-indigo.talos-chip-subtle .talos-chip-remove-btn:hover,:host-context(.dark).talos-chip-indigo.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:#6366f140;color:#fff}:host-context([data-theme=dark]).talos-chip-purple.talos-chip-subtle,:host-context(.dark).talos-chip-purple.talos-chip-subtle{background-color:#a855f726;color:#d8b4fe;border-color:#a855f74d}:host-context([data-theme=dark]).talos-chip-purple.talos-chip-subtle .talos-chip-remove-btn,:host-context(.dark).talos-chip-purple.talos-chip-subtle .talos-chip-remove-btn{color:#d8b4fe}:host-context([data-theme=dark]).talos-chip-purple.talos-chip-subtle .talos-chip-remove-btn:hover,:host-context(.dark).talos-chip-purple.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:#a855f740;color:#fff}:host-context([data-theme=dark]).talos-chip-cyan.talos-chip-subtle,:host-context(.dark).talos-chip-cyan.talos-chip-subtle{background-color:#06b6d426;color:#67e8f9;border-color:#06b6d44d}:host-context([data-theme=dark]).talos-chip-cyan.talos-chip-subtle .talos-chip-remove-btn,:host-context(.dark).talos-chip-cyan.talos-chip-subtle .talos-chip-remove-btn{color:#67e8f9}:host-context([data-theme=dark]).talos-chip-cyan.talos-chip-subtle .talos-chip-remove-btn:hover,:host-context(.dark).talos-chip-cyan.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:#06b6d440;color:#fff}\n"] });
|
|
43
|
+
}
|
|
44
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: TalosChipComponent, decorators: [{
|
|
45
|
+
type: Component,
|
|
46
|
+
args: [{ selector: 'talos-chip', host: {
|
|
47
|
+
'class': 'talos-chip',
|
|
48
|
+
'[class.talos-chip-sm]': 'size() === "sm"',
|
|
49
|
+
'[class.talos-chip-md]': 'size() === "md"',
|
|
50
|
+
'[class.talos-chip-lg]': 'size() === "lg"',
|
|
51
|
+
'[class.talos-chip-filled]': 'variant() === "filled"',
|
|
52
|
+
'[class.talos-chip-outline]': 'variant() === "outline"',
|
|
53
|
+
'[class.talos-chip-subtle]': 'variant() === "subtle"',
|
|
54
|
+
'[class.talos-chip-primary]': 'color() === "primary"',
|
|
55
|
+
'[class.talos-chip-neutral]': 'color() === "neutral"',
|
|
56
|
+
'[class.talos-chip-success]': 'color() === "success"',
|
|
57
|
+
'[class.talos-chip-warning]': 'color() === "warning"',
|
|
58
|
+
'[class.talos-chip-error]': 'color() === "error"',
|
|
59
|
+
'[class.talos-chip-indigo]': 'color() === "indigo"',
|
|
60
|
+
'[class.talos-chip-purple]': 'color() === "purple"',
|
|
61
|
+
'[class.talos-chip-cyan]': 'color() === "cyan"',
|
|
62
|
+
'[class.is-disabled]': 'disabled()',
|
|
63
|
+
'[class.is-removable]': 'removable() && !disabled()',
|
|
64
|
+
'[attr.aria-disabled]': 'disabled() ? "true" : null',
|
|
65
|
+
'(click)': 'onChipClick($event)'
|
|
66
|
+
}, template: "@if (avatarUrl()) {\n <span class=\"talos-chip-avatar\">\n <img [src]=\"avatarUrl()\" alt=\"\" aria-hidden=\"true\" />\n </span>\n}\n\n<span class=\"talos-chip-content\">\n <ng-content>{{ label() }}</ng-content>\n</span>\n\n@if (removable() && !disabled()) {\n <button\n type=\"button\"\n class=\"talos-chip-remove-btn\"\n [attr.aria-label]=\"removeAriaLabel() + (label() ? ' ' + label() : '')\"\n (click)=\"onRemove($event)\"\n >\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"></line>\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"></line>\n </svg>\n </button>\n}\n", styles: [":host{display:inline-flex;align-items:center;gap:.375rem;font-family:inherit;font-weight:500;border-radius:var(--talos-chip-radius, 9999px);-webkit-user-select:none;user-select:none;white-space:nowrap;vertical-align:middle;box-sizing:border-box;max-width:100%;line-height:1;transition:all .15s cubic-bezier(.4,0,.2,1);position:relative;outline:none}:host.talos-chip-sm{height:1.5rem;padding:0 .5rem;font-size:.75rem}:host.talos-chip-sm.is-removable{padding-right:.25rem}:host.talos-chip-sm .talos-chip-avatar{width:1rem;height:1rem;margin-left:-.25rem}:host.talos-chip-sm .talos-chip-remove-btn{width:1rem;height:1rem}:host.talos-chip-sm .talos-chip-remove-btn svg{width:.625rem;height:.625rem}:host.talos-chip-md{height:1.875rem;padding:0 .625rem;font-size:.8125rem}:host.talos-chip-md.is-removable{padding-right:.375rem}:host.talos-chip-md .talos-chip-avatar{width:1.25rem;height:1.25rem;margin-left:-.375rem}:host.talos-chip-md .talos-chip-remove-btn{width:1.125rem;height:1.125rem}:host.talos-chip-md .talos-chip-remove-btn svg{width:.75rem;height:.75rem}:host.talos-chip-lg{height:2.25rem;padding:0 .75rem;font-size:.875rem}:host.talos-chip-lg.is-removable{padding-right:.5rem}:host.talos-chip-lg .talos-chip-avatar{width:1.5rem;height:1.5rem;margin-left:-.5rem}:host.talos-chip-lg .talos-chip-remove-btn{width:1.25rem;height:1.25rem}:host.talos-chip-lg .talos-chip-remove-btn svg{width:.875rem;height:.875rem}:host.talos-chip-primary.talos-chip-subtle{background-color:var(--talos-primary-50, rgba(37, 99, 235, .08));color:var(--talos-primary-700, #1d4ed8);border:1px solid var(--talos-primary-200, rgba(37, 99, 235, .2))}:host.talos-chip-primary.talos-chip-subtle .talos-chip-remove-btn{color:var(--talos-primary-600, #2563eb)}:host.talos-chip-primary.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:var(--talos-primary-100, rgba(37, 99, 235, .18));color:var(--talos-primary-800, #1e40af)}:host.talos-chip-primary.talos-chip-filled{background-color:var(--talos-primary-600, #2563eb);color:#fff;border:1px solid transparent}:host.talos-chip-primary.talos-chip-filled .talos-chip-remove-btn{color:#ffffffd9}:host.talos-chip-primary.talos-chip-filled .talos-chip-remove-btn:hover{background-color:#fff3;color:#fff}:host.talos-chip-primary.talos-chip-outline{background-color:transparent;color:var(--talos-primary-600, #2563eb);border:1px solid var(--talos-primary-400, #60a5fa)}:host.talos-chip-primary.talos-chip-outline .talos-chip-remove-btn{color:var(--talos-primary-600, #2563eb)}:host.talos-chip-primary.talos-chip-outline .talos-chip-remove-btn:hover{background-color:var(--talos-primary-50, rgba(37, 99, 235, .1))}:host.talos-chip-neutral.talos-chip-subtle{background-color:var(--talos-gray-100, #f1f5f9);color:var(--talos-gray-800, #1e293b);border:1px solid var(--talos-gray-200, #e2e8f0)}:host.talos-chip-neutral.talos-chip-subtle .talos-chip-remove-btn{color:var(--talos-gray-500, #64748b)}:host.talos-chip-neutral.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:var(--talos-gray-200, #e2e8f0);color:var(--talos-gray-800, #1e293b)}:host.talos-chip-neutral.talos-chip-filled{background-color:var(--talos-gray-700, #334155);color:#fff;border:1px solid transparent}:host.talos-chip-neutral.talos-chip-filled .talos-chip-remove-btn{color:#ffffffd9}:host.talos-chip-neutral.talos-chip-filled .talos-chip-remove-btn:hover{background-color:#fff3;color:#fff}:host.talos-chip-neutral.talos-chip-outline{background-color:transparent;color:var(--talos-gray-700, #334155);border:1px solid var(--talos-gray-300, #cbd5e1)}:host.talos-chip-neutral.talos-chip-outline .talos-chip-remove-btn{color:var(--talos-gray-500, #64748b)}:host.talos-chip-neutral.talos-chip-outline .talos-chip-remove-btn:hover{background-color:var(--talos-gray-100, #f1f5f9)}:host.talos-chip-success.talos-chip-subtle{background-color:#10b9811a;color:#065f46;border:1px solid rgba(16,185,129,.25)}:host.talos-chip-success.talos-chip-subtle .talos-chip-remove-btn{color:#059669}:host.talos-chip-success.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:#10b98133;color:#064e3b}:host.talos-chip-success.talos-chip-filled{background-color:#10b981;color:#fff;border:1px solid transparent}:host.talos-chip-success.talos-chip-filled .talos-chip-remove-btn{color:#ffffffd9}:host.talos-chip-success.talos-chip-filled .talos-chip-remove-btn:hover{background-color:#fff3}:host.talos-chip-success.talos-chip-outline{background-color:transparent;color:#10b981;border:1px solid #34d399}:host.talos-chip-success.talos-chip-outline .talos-chip-remove-btn{color:#10b981}:host.talos-chip-success.talos-chip-outline .talos-chip-remove-btn:hover{background-color:#10b9811a}:host.talos-chip-warning.talos-chip-subtle{background-color:#f59e0b1a;color:#92400e;border:1px solid rgba(245,158,11,.25)}:host.talos-chip-warning.talos-chip-subtle .talos-chip-remove-btn{color:#d97706}:host.talos-chip-warning.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:#f59e0b33;color:#78350f}:host.talos-chip-warning.talos-chip-filled{background-color:#f59e0b;color:#fff;border:1px solid transparent}:host.talos-chip-warning.talos-chip-filled .talos-chip-remove-btn{color:#ffffffd9}:host.talos-chip-warning.talos-chip-filled .talos-chip-remove-btn:hover{background-color:#fff3}:host.talos-chip-warning.talos-chip-outline{background-color:transparent;color:#d97706;border:1px solid #fbbf24}:host.talos-chip-warning.talos-chip-outline .talos-chip-remove-btn{color:#d97706}:host.talos-chip-warning.talos-chip-outline .talos-chip-remove-btn:hover{background-color:#f59e0b1a}:host.talos-chip-error.talos-chip-subtle{background-color:#ef44441a;color:#991b1b;border:1px solid rgba(239,68,68,.25)}:host.talos-chip-error.talos-chip-subtle .talos-chip-remove-btn{color:#ef4444}:host.talos-chip-error.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:#ef444433;color:#7f1d1d}:host.talos-chip-error.talos-chip-filled{background-color:#ef4444;color:#fff;border:1px solid transparent}:host.talos-chip-error.talos-chip-filled .talos-chip-remove-btn{color:#ffffffd9}:host.talos-chip-error.talos-chip-filled .talos-chip-remove-btn:hover{background-color:#fff3}:host.talos-chip-error.talos-chip-outline{background-color:transparent;color:#ef4444;border:1px solid #f87171}:host.talos-chip-error.talos-chip-outline .talos-chip-remove-btn{color:#ef4444}:host.talos-chip-error.talos-chip-outline .talos-chip-remove-btn:hover{background-color:#ef44441a}:host.talos-chip-indigo.talos-chip-subtle{background-color:#6366f11a;color:#3730a3;border:1px solid rgba(99,102,241,.25)}:host.talos-chip-indigo.talos-chip-subtle .talos-chip-remove-btn{color:#6366f1}:host.talos-chip-indigo.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:#6366f133;color:#312e81}:host.talos-chip-indigo.talos-chip-filled{background-color:#6366f1;color:#fff;border:1px solid transparent}:host.talos-chip-indigo.talos-chip-filled .talos-chip-remove-btn{color:#ffffffd9}:host.talos-chip-indigo.talos-chip-filled .talos-chip-remove-btn:hover{background-color:#fff3}:host.talos-chip-indigo.talos-chip-outline{background-color:transparent;color:#6366f1;border:1px solid #818cf8}:host.talos-chip-indigo.talos-chip-outline .talos-chip-remove-btn{color:#6366f1}:host.talos-chip-indigo.talos-chip-outline .talos-chip-remove-btn:hover{background-color:#6366f11a}:host.talos-chip-purple.talos-chip-subtle{background-color:#a855f71a;color:#6b21a8;border:1px solid rgba(168,85,247,.25)}:host.talos-chip-purple.talos-chip-subtle .talos-chip-remove-btn{color:#a855f7}:host.talos-chip-purple.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:#a855f733;color:#581c87}:host.talos-chip-purple.talos-chip-filled{background-color:#a855f7;color:#fff;border:1px solid transparent}:host.talos-chip-purple.talos-chip-filled .talos-chip-remove-btn{color:#ffffffd9}:host.talos-chip-purple.talos-chip-filled .talos-chip-remove-btn:hover{background-color:#fff3}:host.talos-chip-purple.talos-chip-outline{background-color:transparent;color:#a855f7;border:1px solid #c084fc}:host.talos-chip-purple.talos-chip-outline .talos-chip-remove-btn{color:#a855f7}:host.talos-chip-purple.talos-chip-outline .talos-chip-remove-btn:hover{background-color:#a855f71a}:host.talos-chip-cyan.talos-chip-subtle{background-color:#06b6d41a;color:#155e75;border:1px solid rgba(6,182,212,.25)}:host.talos-chip-cyan.talos-chip-subtle .talos-chip-remove-btn{color:#0891b2}:host.talos-chip-cyan.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:#06b6d433;color:#164e63}:host.talos-chip-cyan.talos-chip-filled{background-color:#06b6d4;color:#fff;border:1px solid transparent}:host.talos-chip-cyan.talos-chip-filled .talos-chip-remove-btn{color:#ffffffd9}:host.talos-chip-cyan.talos-chip-filled .talos-chip-remove-btn:hover{background-color:#fff3}:host.talos-chip-cyan.talos-chip-outline{background-color:transparent;color:#0891b2;border:1px solid #22d3ee}:host.talos-chip-cyan.talos-chip-outline .talos-chip-remove-btn{color:#0891b2}:host.talos-chip-cyan.talos-chip-outline .talos-chip-remove-btn:hover{background-color:#06b6d41a}:host.is-disabled{opacity:.55;cursor:not-allowed;pointer-events:none}.talos-chip-avatar{display:inline-flex;align-items:center;justify-content:center;border-radius:9999px;overflow:hidden;flex-shrink:0}.talos-chip-avatar img{width:100%;height:100%;object-fit:cover}.talos-chip-content{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.talos-chip-remove-btn{display:inline-flex;align-items:center;justify-content:center;padding:0;border:none;background:transparent;cursor:pointer;border-radius:9999px;transition:all .12s ease;flex-shrink:0;outline:none}.talos-chip-remove-btn:focus-visible{box-shadow:0 0 0 2px var(--talos-primary-400, #60a5fa)}:host-context([data-theme=dark]).talos-chip-neutral.talos-chip-subtle,:host-context(.dark).talos-chip-neutral.talos-chip-subtle{background-color:#ffffff14;color:#e2e8f0;border-color:#ffffff1f}:host-context([data-theme=dark]).talos-chip-neutral.talos-chip-subtle .talos-chip-remove-btn,:host-context(.dark).talos-chip-neutral.talos-chip-subtle .talos-chip-remove-btn{color:#94a3b8}:host-context([data-theme=dark]).talos-chip-neutral.talos-chip-subtle .talos-chip-remove-btn:hover,:host-context(.dark).talos-chip-neutral.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:#ffffff26;color:#fff}:host-context([data-theme=dark]).talos-chip-primary.talos-chip-subtle,:host-context(.dark).talos-chip-primary.talos-chip-subtle{background-color:#3b82f626;color:#93c5fd;border-color:#3b82f64d}:host-context([data-theme=dark]).talos-chip-primary.talos-chip-subtle .talos-chip-remove-btn,:host-context(.dark).talos-chip-primary.talos-chip-subtle .talos-chip-remove-btn{color:#93c5fd}:host-context([data-theme=dark]).talos-chip-primary.talos-chip-subtle .talos-chip-remove-btn:hover,:host-context(.dark).talos-chip-primary.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:#3b82f640;color:#fff}:host-context([data-theme=dark]).talos-chip-success.talos-chip-subtle,:host-context(.dark).talos-chip-success.talos-chip-subtle{background-color:#10b98126;color:#6ee7b7;border-color:#10b9814d}:host-context([data-theme=dark]).talos-chip-success.talos-chip-subtle .talos-chip-remove-btn,:host-context(.dark).talos-chip-success.talos-chip-subtle .talos-chip-remove-btn{color:#6ee7b7}:host-context([data-theme=dark]).talos-chip-success.talos-chip-subtle .talos-chip-remove-btn:hover,:host-context(.dark).talos-chip-success.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:#10b98140;color:#fff}:host-context([data-theme=dark]).talos-chip-warning.talos-chip-subtle,:host-context(.dark).talos-chip-warning.talos-chip-subtle{background-color:#f59e0b26;color:#fcd34d;border-color:#f59e0b4d}:host-context([data-theme=dark]).talos-chip-warning.talos-chip-subtle .talos-chip-remove-btn,:host-context(.dark).talos-chip-warning.talos-chip-subtle .talos-chip-remove-btn{color:#fcd34d}:host-context([data-theme=dark]).talos-chip-warning.talos-chip-subtle .talos-chip-remove-btn:hover,:host-context(.dark).talos-chip-warning.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:#f59e0b40;color:#fff}:host-context([data-theme=dark]).talos-chip-error.talos-chip-subtle,:host-context(.dark).talos-chip-error.talos-chip-subtle{background-color:#ef444426;color:#fca5a5;border-color:#ef44444d}:host-context([data-theme=dark]).talos-chip-error.talos-chip-subtle .talos-chip-remove-btn,:host-context(.dark).talos-chip-error.talos-chip-subtle .talos-chip-remove-btn{color:#fca5a5}:host-context([data-theme=dark]).talos-chip-error.talos-chip-subtle .talos-chip-remove-btn:hover,:host-context(.dark).talos-chip-error.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:#ef444440;color:#fff}:host-context([data-theme=dark]).talos-chip-indigo.talos-chip-subtle,:host-context(.dark).talos-chip-indigo.talos-chip-subtle{background-color:#6366f126;color:#a5b4fc;border-color:#6366f14d}:host-context([data-theme=dark]).talos-chip-indigo.talos-chip-subtle .talos-chip-remove-btn,:host-context(.dark).talos-chip-indigo.talos-chip-subtle .talos-chip-remove-btn{color:#a5b4fc}:host-context([data-theme=dark]).talos-chip-indigo.talos-chip-subtle .talos-chip-remove-btn:hover,:host-context(.dark).talos-chip-indigo.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:#6366f140;color:#fff}:host-context([data-theme=dark]).talos-chip-purple.talos-chip-subtle,:host-context(.dark).talos-chip-purple.talos-chip-subtle{background-color:#a855f726;color:#d8b4fe;border-color:#a855f74d}:host-context([data-theme=dark]).talos-chip-purple.talos-chip-subtle .talos-chip-remove-btn,:host-context(.dark).talos-chip-purple.talos-chip-subtle .talos-chip-remove-btn{color:#d8b4fe}:host-context([data-theme=dark]).talos-chip-purple.talos-chip-subtle .talos-chip-remove-btn:hover,:host-context(.dark).talos-chip-purple.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:#a855f740;color:#fff}:host-context([data-theme=dark]).talos-chip-cyan.talos-chip-subtle,:host-context(.dark).talos-chip-cyan.talos-chip-subtle{background-color:#06b6d426;color:#67e8f9;border-color:#06b6d44d}:host-context([data-theme=dark]).talos-chip-cyan.talos-chip-subtle .talos-chip-remove-btn,:host-context(.dark).talos-chip-cyan.talos-chip-subtle .talos-chip-remove-btn{color:#67e8f9}:host-context([data-theme=dark]).talos-chip-cyan.talos-chip-subtle .talos-chip-remove-btn:hover,:host-context(.dark).talos-chip-cyan.talos-chip-subtle .talos-chip-remove-btn:hover{background-color:#06b6d440;color:#fff}\n"] }]
|
|
67
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], removable: [{ type: i0.Input, args: [{ isSignal: true, alias: "removable", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], avatarUrl: [{ type: i0.Input, args: [{ isSignal: true, alias: "avatarUrl", required: false }] }], removeAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "removeAriaLabel", required: false }] }], removed: [{ type: i0.Output, args: ["removed"] }], chipClick: [{ type: i0.Output, args: ["chipClick"] }] } });
|
|
68
|
+
|
|
69
|
+
let uniqueChipsIdCounter = 0;
|
|
70
|
+
class TalosChipsComponent {
|
|
71
|
+
elementRef = inject((ElementRef));
|
|
72
|
+
// Signal Inputs
|
|
73
|
+
options = input([], /* @ts-ignore */
|
|
74
|
+
...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
75
|
+
label = input('', /* @ts-ignore */
|
|
76
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
77
|
+
floatingLabel = input(false, /* @ts-ignore */
|
|
78
|
+
...(ngDevMode ? [{ debugName: "floatingLabel" }] : /* istanbul ignore next */ []));
|
|
79
|
+
floating = input(false, /* @ts-ignore */
|
|
80
|
+
...(ngDevMode ? [{ debugName: "floating" }] : /* istanbul ignore next */ []));
|
|
81
|
+
required = input(false, /* @ts-ignore */
|
|
82
|
+
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
83
|
+
searching = input(false, /* @ts-ignore */
|
|
84
|
+
...(ngDevMode ? [{ debugName: "searching" }] : /* istanbul ignore next */ []));
|
|
85
|
+
loading = input(false, /* @ts-ignore */
|
|
86
|
+
...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
87
|
+
placeholder = input('Type or select...', /* @ts-ignore */
|
|
88
|
+
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
89
|
+
disabled = input(false, /* @ts-ignore */
|
|
90
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
91
|
+
clearable = input(true, /* @ts-ignore */
|
|
92
|
+
...(ngDevMode ? [{ debugName: "clearable" }] : /* istanbul ignore next */ []));
|
|
93
|
+
removable = input(true, /* @ts-ignore */
|
|
94
|
+
...(ngDevMode ? [{ debugName: "removable" }] : /* istanbul ignore next */ []));
|
|
95
|
+
size = input('sm', /* @ts-ignore */
|
|
96
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
97
|
+
maxChips = input(null, /* @ts-ignore */
|
|
98
|
+
...(ngDevMode ? [{ debugName: "maxChips" }] : /* istanbul ignore next */ []));
|
|
99
|
+
allowCustom = input(false, /* @ts-ignore */
|
|
100
|
+
...(ngDevMode ? [{ debugName: "allowCustom" }] : /* istanbul ignore next */ []));
|
|
101
|
+
separatorKeys = input(['Enter', ','], /* @ts-ignore */
|
|
102
|
+
...(ngDevMode ? [{ debugName: "separatorKeys" }] : /* istanbul ignore next */ []));
|
|
103
|
+
displayWith = input(null, /* @ts-ignore */
|
|
104
|
+
...(ngDevMode ? [{ debugName: "displayWith" }] : /* istanbul ignore next */ []));
|
|
105
|
+
valueWith = input(null, /* @ts-ignore */
|
|
106
|
+
...(ngDevMode ? [{ debugName: "valueWith" }] : /* istanbul ignore next */ []));
|
|
107
|
+
filterFn = input(undefined, /* @ts-ignore */
|
|
108
|
+
...(ngDevMode ? [{ debugName: "filterFn" }] : /* istanbul ignore next */ []));
|
|
109
|
+
highlightMatch = input(true, /* @ts-ignore */
|
|
110
|
+
...(ngDevMode ? [{ debugName: "highlightMatch" }] : /* istanbul ignore next */ []));
|
|
111
|
+
noResultsText = input('No matching options', /* @ts-ignore */
|
|
112
|
+
...(ngDevMode ? [{ debugName: "noResultsText" }] : /* istanbul ignore next */ []));
|
|
113
|
+
searchingText = input('Searching...', /* @ts-ignore */
|
|
114
|
+
...(ngDevMode ? [{ debugName: "searchingText" }] : /* istanbul ignore next */ []));
|
|
115
|
+
chipVariant = input('subtle', /* @ts-ignore */
|
|
116
|
+
...(ngDevMode ? [{ debugName: "chipVariant" }] : /* istanbul ignore next */ []));
|
|
117
|
+
chipColor = input('primary', /* @ts-ignore */
|
|
118
|
+
...(ngDevMode ? [{ debugName: "chipColor" }] : /* istanbul ignore next */ []));
|
|
119
|
+
itemTemplate = input(null, /* @ts-ignore */
|
|
120
|
+
...(ngDevMode ? [{ debugName: "itemTemplate" }] : /* istanbul ignore next */ []));
|
|
121
|
+
openOnFocus = input(true, /* @ts-ignore */
|
|
122
|
+
...(ngDevMode ? [{ debugName: "openOnFocus" }] : /* istanbul ignore next */ []));
|
|
123
|
+
id = input('', /* @ts-ignore */
|
|
124
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
125
|
+
// Signal Outputs
|
|
126
|
+
search = output();
|
|
127
|
+
searchChange = output();
|
|
128
|
+
selectionChange = output();
|
|
129
|
+
chipAdd = output();
|
|
130
|
+
chipRemove = output();
|
|
131
|
+
opened = output();
|
|
132
|
+
closed = output();
|
|
133
|
+
cleared = output();
|
|
134
|
+
// View Children
|
|
135
|
+
inputEl;
|
|
136
|
+
dropdownEl;
|
|
137
|
+
// Component IDs for ARIA attributes
|
|
138
|
+
autoId = `talos-chips-${uniqueChipsIdCounter++}`;
|
|
139
|
+
componentId = computed(() => this.id() || this.autoId, /* @ts-ignore */
|
|
140
|
+
...(ngDevMode ? [{ debugName: "componentId" }] : /* istanbul ignore next */ []));
|
|
141
|
+
inputId = computed(() => `${this.componentId()}-input`, /* @ts-ignore */
|
|
142
|
+
...(ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []));
|
|
143
|
+
listboxId = computed(() => `${this.componentId()}-listbox`, /* @ts-ignore */
|
|
144
|
+
...(ngDevMode ? [{ debugName: "listboxId" }] : /* istanbul ignore next */ []));
|
|
145
|
+
// Internal Reactive State
|
|
146
|
+
inputValue = signal('', /* @ts-ignore */
|
|
147
|
+
...(ngDevMode ? [{ debugName: "inputValue" }] : /* istanbul ignore next */ []));
|
|
148
|
+
selectedValues = signal([], /* @ts-ignore */
|
|
149
|
+
...(ngDevMode ? [{ debugName: "selectedValues" }] : /* istanbul ignore next */ []));
|
|
150
|
+
isOpen = signal(false, /* @ts-ignore */
|
|
151
|
+
...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
|
|
152
|
+
activeIndex = signal(-1, /* @ts-ignore */
|
|
153
|
+
...(ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []));
|
|
154
|
+
isDisabled = signal(false, /* @ts-ignore */
|
|
155
|
+
...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
156
|
+
isTouched = signal(false, /* @ts-ignore */
|
|
157
|
+
...(ngDevMode ? [{ debugName: "isTouched" }] : /* istanbul ignore next */ []));
|
|
158
|
+
isInputFocused = signal(false, /* @ts-ignore */
|
|
159
|
+
...(ngDevMode ? [{ debugName: "isInputFocused" }] : /* istanbul ignore next */ []));
|
|
160
|
+
// ControlValueAccessor Callbacks
|
|
161
|
+
onChange = () => { };
|
|
162
|
+
onTouched = () => { };
|
|
163
|
+
// Computed State
|
|
164
|
+
effectiveDisabled = computed(() => this.disabled() || this.isDisabled(), /* @ts-ignore */
|
|
165
|
+
...(ngDevMode ? [{ debugName: "effectiveDisabled" }] : /* istanbul ignore next */ []));
|
|
166
|
+
effectiveSearching = computed(() => this.searching() || this.loading(), /* @ts-ignore */
|
|
167
|
+
...(ngDevMode ? [{ debugName: "effectiveSearching" }] : /* istanbul ignore next */ []));
|
|
168
|
+
isFloatingMode = computed(() => this.floatingLabel() || this.floating(), /* @ts-ignore */
|
|
169
|
+
...(ngDevMode ? [{ debugName: "isFloatingMode" }] : /* istanbul ignore next */ []));
|
|
170
|
+
isFloated = computed(() => {
|
|
171
|
+
if (!this.isFloatingMode())
|
|
172
|
+
return false;
|
|
173
|
+
return (this.isOpen() ||
|
|
174
|
+
this.isInputFocused() ||
|
|
175
|
+
this.selectedValues().length > 0 ||
|
|
176
|
+
!!this.inputValue().trim());
|
|
177
|
+
}, /* @ts-ignore */
|
|
178
|
+
...(ngDevMode ? [{ debugName: "isFloated" }] : /* istanbul ignore next */ []));
|
|
179
|
+
isMaxReached = computed(() => {
|
|
180
|
+
const max = this.maxChips();
|
|
181
|
+
if (max === null || max === undefined)
|
|
182
|
+
return false;
|
|
183
|
+
return this.selectedValues().length >= max;
|
|
184
|
+
}, /* @ts-ignore */
|
|
185
|
+
...(ngDevMode ? [{ debugName: "isMaxReached" }] : /* istanbul ignore next */ []));
|
|
186
|
+
effectivePlaceholder = computed(() => {
|
|
187
|
+
if (this.isFloatingMode() && !this.isFloated()) {
|
|
188
|
+
return '';
|
|
189
|
+
}
|
|
190
|
+
if (this.isMaxReached()) {
|
|
191
|
+
return 'Maximum selections reached';
|
|
192
|
+
}
|
|
193
|
+
return this.placeholder();
|
|
194
|
+
}, /* @ts-ignore */
|
|
195
|
+
...(ngDevMode ? [{ debugName: "effectivePlaceholder" }] : /* istanbul ignore next */ []));
|
|
196
|
+
activeOptionId = computed(() => {
|
|
197
|
+
const idx = this.activeIndex();
|
|
198
|
+
if (idx < 0)
|
|
199
|
+
return null;
|
|
200
|
+
return `${this.componentId()}-option-${idx}`;
|
|
201
|
+
}, /* @ts-ignore */
|
|
202
|
+
...(ngDevMode ? [{ debugName: "activeOptionId" }] : /* istanbul ignore next */ []));
|
|
203
|
+
// Selected representations as Chips
|
|
204
|
+
selectedChips = computed(() => {
|
|
205
|
+
const values = this.selectedValues();
|
|
206
|
+
const rawOpts = this.options();
|
|
207
|
+
return values.map((val) => {
|
|
208
|
+
// Find matching item in options if any
|
|
209
|
+
const matched = rawOpts.find((opt) => this.getItemValue(opt) === val || opt === val);
|
|
210
|
+
if (matched !== undefined) {
|
|
211
|
+
return {
|
|
212
|
+
display: this.getItemDisplay(matched),
|
|
213
|
+
value: this.getItemValue(matched),
|
|
214
|
+
originalItem: matched
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
// Handle raw object with display/value or primitive
|
|
218
|
+
if (val && typeof val === 'object') {
|
|
219
|
+
return {
|
|
220
|
+
display: this.getItemDisplay(val),
|
|
221
|
+
value: this.getItemValue(val),
|
|
222
|
+
originalItem: val
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
return {
|
|
226
|
+
display: String(val ?? ''),
|
|
227
|
+
value: val,
|
|
228
|
+
originalItem: val
|
|
229
|
+
};
|
|
230
|
+
});
|
|
231
|
+
}, /* @ts-ignore */
|
|
232
|
+
...(ngDevMode ? [{ debugName: "selectedChips" }] : /* istanbul ignore next */ []));
|
|
233
|
+
// Filtered dropdown options
|
|
234
|
+
filteredOptions = computed(() => {
|
|
235
|
+
const rawOptions = this.options();
|
|
236
|
+
const search = this.inputValue().trim();
|
|
237
|
+
const customFilter = this.filterFn();
|
|
238
|
+
const selectedVals = this.selectedValues();
|
|
239
|
+
const result = [];
|
|
240
|
+
for (const item of rawOptions) {
|
|
241
|
+
const display = this.getItemDisplay(item);
|
|
242
|
+
const value = this.getItemValue(item);
|
|
243
|
+
const isSelected = selectedVals.some((v) => v === value || v === item || (typeof v === 'object' && typeof value === 'object' && JSON.stringify(v) === JSON.stringify(value)));
|
|
244
|
+
// Check if matches filter
|
|
245
|
+
let matches = true;
|
|
246
|
+
if (search) {
|
|
247
|
+
if (customFilter === null) {
|
|
248
|
+
// Explicit null filterFn indicates external/server-side filtering
|
|
249
|
+
matches = true;
|
|
250
|
+
}
|
|
251
|
+
else if (typeof customFilter === 'function') {
|
|
252
|
+
matches = customFilter(item, search);
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
matches = display.toLowerCase().includes(search.toLowerCase());
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
if (matches) {
|
|
259
|
+
const parts = this.highlightMatch()
|
|
260
|
+
? this.computeHighlightParts(display, search)
|
|
261
|
+
: [{ text: display, matched: false }];
|
|
262
|
+
result.push({
|
|
263
|
+
item,
|
|
264
|
+
display,
|
|
265
|
+
value,
|
|
266
|
+
disabled: false,
|
|
267
|
+
selected: isSelected,
|
|
268
|
+
parts
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
return result;
|
|
273
|
+
}, /* @ts-ignore */
|
|
274
|
+
...(ngDevMode ? [{ debugName: "filteredOptions" }] : /* istanbul ignore next */ []));
|
|
275
|
+
constructor() {
|
|
276
|
+
// Reset activeIndex whenever filtered options change or search changes
|
|
277
|
+
effect(() => {
|
|
278
|
+
this.filteredOptions();
|
|
279
|
+
this.activeIndex.set(-1);
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
// --- ControlValueAccessor Implementation ---
|
|
283
|
+
writeValue(value) {
|
|
284
|
+
if (value === null || value === undefined) {
|
|
285
|
+
this.selectedValues.set([]);
|
|
286
|
+
}
|
|
287
|
+
else if (Array.isArray(value)) {
|
|
288
|
+
this.selectedValues.set([...value]);
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
this.selectedValues.set([value]);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
registerOnChange(fn) {
|
|
295
|
+
this.onChange = fn;
|
|
296
|
+
}
|
|
297
|
+
registerOnTouched(fn) {
|
|
298
|
+
this.onTouched = fn;
|
|
299
|
+
}
|
|
300
|
+
setDisabledState(isDisabled) {
|
|
301
|
+
this.isDisabled.set(isDisabled);
|
|
302
|
+
if (isDisabled && this.isOpen()) {
|
|
303
|
+
this.closeDropdown();
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
// --- Helpers for Display & Value Extraction ---
|
|
307
|
+
getItemDisplay(item) {
|
|
308
|
+
if (item === null || item === undefined)
|
|
309
|
+
return '';
|
|
310
|
+
const displayFn = this.displayWith();
|
|
311
|
+
if (typeof displayFn === 'function') {
|
|
312
|
+
return displayFn(item);
|
|
313
|
+
}
|
|
314
|
+
if (typeof displayFn === 'string' && typeof item === 'object') {
|
|
315
|
+
return String(item[displayFn] ?? '');
|
|
316
|
+
}
|
|
317
|
+
if (typeof item === 'object') {
|
|
318
|
+
const obj = item;
|
|
319
|
+
if ('label' in obj)
|
|
320
|
+
return String(obj['label']);
|
|
321
|
+
if ('name' in obj)
|
|
322
|
+
return String(obj['name']);
|
|
323
|
+
if ('title' in obj)
|
|
324
|
+
return String(obj['title']);
|
|
325
|
+
if ('value' in obj)
|
|
326
|
+
return String(obj['value']);
|
|
327
|
+
}
|
|
328
|
+
return String(item);
|
|
329
|
+
}
|
|
330
|
+
getItemValue(item) {
|
|
331
|
+
if (item === null || item === undefined)
|
|
332
|
+
return item;
|
|
333
|
+
const valueFn = this.valueWith();
|
|
334
|
+
if (typeof valueFn === 'function') {
|
|
335
|
+
return valueFn(item);
|
|
336
|
+
}
|
|
337
|
+
if (typeof valueFn === 'string' && typeof item === 'object') {
|
|
338
|
+
return item[valueFn];
|
|
339
|
+
}
|
|
340
|
+
if (typeof item === 'object') {
|
|
341
|
+
const obj = item;
|
|
342
|
+
if ('value' in obj)
|
|
343
|
+
return obj['value'];
|
|
344
|
+
if ('id' in obj)
|
|
345
|
+
return obj['id'];
|
|
346
|
+
}
|
|
347
|
+
return item;
|
|
348
|
+
}
|
|
349
|
+
computeHighlightParts(text, search) {
|
|
350
|
+
if (!search || !text) {
|
|
351
|
+
return [{ text, matched: false }];
|
|
352
|
+
}
|
|
353
|
+
const regex = new RegExp(`(${this.escapeRegex(search)})`, 'gi');
|
|
354
|
+
const segments = text.split(regex);
|
|
355
|
+
return segments
|
|
356
|
+
.filter((seg) => seg.length > 0)
|
|
357
|
+
.map((seg) => ({
|
|
358
|
+
text: seg,
|
|
359
|
+
matched: seg.toLowerCase() === search.toLowerCase()
|
|
360
|
+
}));
|
|
361
|
+
}
|
|
362
|
+
escapeRegex(str) {
|
|
363
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
364
|
+
}
|
|
365
|
+
// --- Interaction Handlers ---
|
|
366
|
+
onContainerClick(event) {
|
|
367
|
+
if (this.effectiveDisabled())
|
|
368
|
+
return;
|
|
369
|
+
// Focus search input
|
|
370
|
+
if (this.inputEl && !this.isMaxReached()) {
|
|
371
|
+
this.inputEl.nativeElement.focus();
|
|
372
|
+
}
|
|
373
|
+
if (!this.isOpen() && this.options().length > 0) {
|
|
374
|
+
this.openDropdown();
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
onInput(event) {
|
|
378
|
+
const target = event.target;
|
|
379
|
+
const value = target.value;
|
|
380
|
+
// Check if ends with separator (like comma)
|
|
381
|
+
const separators = this.separatorKeys();
|
|
382
|
+
for (const sep of separators) {
|
|
383
|
+
if (sep !== 'Enter' && value.includes(sep)) {
|
|
384
|
+
const parts = value.split(sep);
|
|
385
|
+
for (const part of parts) {
|
|
386
|
+
const trimmed = part.trim();
|
|
387
|
+
if (trimmed) {
|
|
388
|
+
this.addCustomChip(trimmed);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
this.inputValue.set('');
|
|
392
|
+
target.value = '';
|
|
393
|
+
this.emitSearch('');
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
this.inputValue.set(value);
|
|
398
|
+
this.emitSearch(value);
|
|
399
|
+
if (!this.isOpen() && this.options().length > 0) {
|
|
400
|
+
this.openDropdown();
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
onFocus() {
|
|
404
|
+
this.isInputFocused.set(true);
|
|
405
|
+
if (this.openOnFocus() && !this.effectiveDisabled() && this.options().length > 0) {
|
|
406
|
+
this.openDropdown();
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
onBlur() {
|
|
410
|
+
this.isInputFocused.set(false);
|
|
411
|
+
this.markAsTouched();
|
|
412
|
+
// If allowCustom is enabled and user left some text in the input, commit it as a chip
|
|
413
|
+
if (this.allowCustom()) {
|
|
414
|
+
const text = this.inputValue().trim();
|
|
415
|
+
if (text) {
|
|
416
|
+
this.addCustomChip(text);
|
|
417
|
+
this.inputValue.set('');
|
|
418
|
+
if (this.inputEl) {
|
|
419
|
+
this.inputEl.nativeElement.value = '';
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
onKeyDown(event) {
|
|
425
|
+
if (this.effectiveDisabled())
|
|
426
|
+
return;
|
|
427
|
+
const opts = this.filteredOptions();
|
|
428
|
+
const currentIdx = this.activeIndex();
|
|
429
|
+
switch (event.key) {
|
|
430
|
+
case 'ArrowDown': {
|
|
431
|
+
event.preventDefault();
|
|
432
|
+
if (!this.isOpen()) {
|
|
433
|
+
this.openDropdown();
|
|
434
|
+
}
|
|
435
|
+
else if (opts.length > 0) {
|
|
436
|
+
const nextIdx = currentIdx < opts.length - 1 ? currentIdx + 1 : 0;
|
|
437
|
+
this.activeIndex.set(nextIdx);
|
|
438
|
+
this.scrollActiveOptionIntoView(nextIdx);
|
|
439
|
+
}
|
|
440
|
+
break;
|
|
441
|
+
}
|
|
442
|
+
case 'ArrowUp': {
|
|
443
|
+
event.preventDefault();
|
|
444
|
+
if (!this.isOpen()) {
|
|
445
|
+
this.openDropdown();
|
|
446
|
+
}
|
|
447
|
+
else if (opts.length > 0) {
|
|
448
|
+
const prevIdx = currentIdx > 0 ? currentIdx - 1 : opts.length - 1;
|
|
449
|
+
this.activeIndex.set(prevIdx);
|
|
450
|
+
this.scrollActiveOptionIntoView(prevIdx);
|
|
451
|
+
}
|
|
452
|
+
break;
|
|
453
|
+
}
|
|
454
|
+
case 'Enter': {
|
|
455
|
+
event.preventDefault();
|
|
456
|
+
if (this.isOpen() && currentIdx >= 0 && currentIdx < opts.length) {
|
|
457
|
+
const activeOpt = opts[currentIdx];
|
|
458
|
+
this.toggleOption(activeOpt);
|
|
459
|
+
}
|
|
460
|
+
else if (this.allowCustom()) {
|
|
461
|
+
const text = this.inputValue().trim();
|
|
462
|
+
if (text) {
|
|
463
|
+
this.addCustomChip(text);
|
|
464
|
+
this.inputValue.set('');
|
|
465
|
+
if (this.inputEl) {
|
|
466
|
+
this.inputEl.nativeElement.value = '';
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
break;
|
|
471
|
+
}
|
|
472
|
+
case 'Backspace': {
|
|
473
|
+
if (!this.inputValue() && this.selectedValues().length > 0 && this.removable()) {
|
|
474
|
+
// Remove the last selected chip
|
|
475
|
+
const current = [...this.selectedValues()];
|
|
476
|
+
const removed = current.pop();
|
|
477
|
+
this.selectedValues.set(current);
|
|
478
|
+
this.emitSelection(current);
|
|
479
|
+
this.chipRemove.emit(removed);
|
|
480
|
+
}
|
|
481
|
+
break;
|
|
482
|
+
}
|
|
483
|
+
case 'Escape': {
|
|
484
|
+
if (this.isOpen()) {
|
|
485
|
+
event.preventDefault();
|
|
486
|
+
this.closeDropdown();
|
|
487
|
+
}
|
|
488
|
+
break;
|
|
489
|
+
}
|
|
490
|
+
case 'Tab': {
|
|
491
|
+
if (this.isOpen()) {
|
|
492
|
+
this.closeDropdown();
|
|
493
|
+
}
|
|
494
|
+
break;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
toggleOption(option) {
|
|
499
|
+
if (this.effectiveDisabled() || option.disabled)
|
|
500
|
+
return;
|
|
501
|
+
const valToToggle = option.value;
|
|
502
|
+
const currentValues = [...this.selectedValues()];
|
|
503
|
+
const index = currentValues.findIndex((v) => v === valToToggle || v === option.item);
|
|
504
|
+
if (index >= 0) {
|
|
505
|
+
// Deselect
|
|
506
|
+
currentValues.splice(index, 1);
|
|
507
|
+
this.selectedValues.set(currentValues);
|
|
508
|
+
this.emitSelection(currentValues);
|
|
509
|
+
this.chipRemove.emit(valToToggle);
|
|
510
|
+
}
|
|
511
|
+
else {
|
|
512
|
+
// Select (if not max reached)
|
|
513
|
+
if (this.isMaxReached())
|
|
514
|
+
return;
|
|
515
|
+
currentValues.push(valToToggle);
|
|
516
|
+
this.selectedValues.set(currentValues);
|
|
517
|
+
this.emitSelection(currentValues);
|
|
518
|
+
this.chipAdd.emit(valToToggle);
|
|
519
|
+
// Clear search input on selection
|
|
520
|
+
this.inputValue.set('');
|
|
521
|
+
if (this.inputEl) {
|
|
522
|
+
this.inputEl.nativeElement.value = '';
|
|
523
|
+
}
|
|
524
|
+
this.emitSearch('');
|
|
525
|
+
}
|
|
526
|
+
// Keep focus in input
|
|
527
|
+
if (this.inputEl && !this.isMaxReached()) {
|
|
528
|
+
this.inputEl.nativeElement.focus();
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
addCustomChip(text) {
|
|
532
|
+
if (!text || this.effectiveDisabled() || this.isMaxReached())
|
|
533
|
+
return;
|
|
534
|
+
const currentValues = [...this.selectedValues()];
|
|
535
|
+
// Prevent exact duplicates
|
|
536
|
+
if (!currentValues.includes(text)) {
|
|
537
|
+
currentValues.push(text);
|
|
538
|
+
this.selectedValues.set(currentValues);
|
|
539
|
+
this.emitSelection(currentValues);
|
|
540
|
+
this.chipAdd.emit(text);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
removeChip(chipData) {
|
|
544
|
+
if (this.effectiveDisabled() || !this.removable())
|
|
545
|
+
return;
|
|
546
|
+
const currentValues = this.selectedValues().filter((v) => v !== chipData.value && v !== chipData.originalItem && v !== chipData.display);
|
|
547
|
+
this.selectedValues.set(currentValues);
|
|
548
|
+
this.emitSelection(currentValues);
|
|
549
|
+
this.chipRemove.emit(chipData.value);
|
|
550
|
+
// Refocus input if available
|
|
551
|
+
if (this.inputEl && !this.isMaxReached()) {
|
|
552
|
+
this.inputEl.nativeElement.focus();
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
clearAll(event) {
|
|
556
|
+
if (event) {
|
|
557
|
+
event.stopPropagation();
|
|
558
|
+
event.preventDefault();
|
|
559
|
+
}
|
|
560
|
+
if (this.effectiveDisabled())
|
|
561
|
+
return;
|
|
562
|
+
this.selectedValues.set([]);
|
|
563
|
+
this.inputValue.set('');
|
|
564
|
+
if (this.inputEl) {
|
|
565
|
+
this.inputEl.nativeElement.value = '';
|
|
566
|
+
}
|
|
567
|
+
this.emitSelection([]);
|
|
568
|
+
this.cleared.emit();
|
|
569
|
+
this.emitSearch('');
|
|
570
|
+
if (this.inputEl) {
|
|
571
|
+
this.inputEl.nativeElement.focus();
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
toggleDropdown(event) {
|
|
575
|
+
if (event) {
|
|
576
|
+
event.stopPropagation();
|
|
577
|
+
event.preventDefault();
|
|
578
|
+
}
|
|
579
|
+
if (this.effectiveDisabled())
|
|
580
|
+
return;
|
|
581
|
+
if (this.isOpen()) {
|
|
582
|
+
this.closeDropdown();
|
|
583
|
+
}
|
|
584
|
+
else {
|
|
585
|
+
this.openDropdown();
|
|
586
|
+
if (this.inputEl && !this.isMaxReached()) {
|
|
587
|
+
this.inputEl.nativeElement.focus();
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
openDropdown() {
|
|
592
|
+
if (this.isOpen() || this.effectiveDisabled())
|
|
593
|
+
return;
|
|
594
|
+
this.isOpen.set(true);
|
|
595
|
+
this.opened.emit();
|
|
596
|
+
}
|
|
597
|
+
closeDropdown() {
|
|
598
|
+
if (!this.isOpen())
|
|
599
|
+
return;
|
|
600
|
+
this.isOpen.set(false);
|
|
601
|
+
this.activeIndex.set(-1);
|
|
602
|
+
this.closed.emit();
|
|
603
|
+
}
|
|
604
|
+
onDocumentClick(event) {
|
|
605
|
+
if (!this.isOpen())
|
|
606
|
+
return;
|
|
607
|
+
const clickedInside = this.elementRef.nativeElement.contains(event.target);
|
|
608
|
+
if (!clickedInside) {
|
|
609
|
+
this.closeDropdown();
|
|
610
|
+
this.markAsTouched();
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
emitSearch(val) {
|
|
614
|
+
this.search.emit(val);
|
|
615
|
+
this.searchChange.emit(val);
|
|
616
|
+
}
|
|
617
|
+
emitSelection(values) {
|
|
618
|
+
this.onChange(values);
|
|
619
|
+
this.selectionChange.emit(values);
|
|
620
|
+
this.markAsTouched();
|
|
621
|
+
}
|
|
622
|
+
markAsTouched() {
|
|
623
|
+
if (!this.isTouched()) {
|
|
624
|
+
this.isTouched.set(true);
|
|
625
|
+
this.onTouched();
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
scrollActiveOptionIntoView(index) {
|
|
629
|
+
if (!this.dropdownEl)
|
|
630
|
+
return;
|
|
631
|
+
const optionEl = this.dropdownEl.nativeElement.querySelector(`#${this.componentId()}-option-${index}`);
|
|
632
|
+
if (optionEl) {
|
|
633
|
+
optionEl.scrollIntoView({ block: 'nearest' });
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: TalosChipsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
637
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.1", type: TalosChipsComponent, isStandalone: true, selector: "talos-chips", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, floatingLabel: { classPropertyName: "floatingLabel", publicName: "floatingLabel", isSignal: true, isRequired: false, transformFunction: null }, floating: { classPropertyName: "floating", publicName: "floating", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, searching: { classPropertyName: "searching", publicName: "searching", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, removable: { classPropertyName: "removable", publicName: "removable", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, maxChips: { classPropertyName: "maxChips", publicName: "maxChips", isSignal: true, isRequired: false, transformFunction: null }, allowCustom: { classPropertyName: "allowCustom", publicName: "allowCustom", isSignal: true, isRequired: false, transformFunction: null }, separatorKeys: { classPropertyName: "separatorKeys", publicName: "separatorKeys", isSignal: true, isRequired: false, transformFunction: null }, displayWith: { classPropertyName: "displayWith", publicName: "displayWith", isSignal: true, isRequired: false, transformFunction: null }, valueWith: { classPropertyName: "valueWith", publicName: "valueWith", isSignal: true, isRequired: false, transformFunction: null }, filterFn: { classPropertyName: "filterFn", publicName: "filterFn", isSignal: true, isRequired: false, transformFunction: null }, highlightMatch: { classPropertyName: "highlightMatch", publicName: "highlightMatch", isSignal: true, isRequired: false, transformFunction: null }, noResultsText: { classPropertyName: "noResultsText", publicName: "noResultsText", isSignal: true, isRequired: false, transformFunction: null }, searchingText: { classPropertyName: "searchingText", publicName: "searchingText", isSignal: true, isRequired: false, transformFunction: null }, chipVariant: { classPropertyName: "chipVariant", publicName: "chipVariant", isSignal: true, isRequired: false, transformFunction: null }, chipColor: { classPropertyName: "chipColor", publicName: "chipColor", isSignal: true, isRequired: false, transformFunction: null }, itemTemplate: { classPropertyName: "itemTemplate", publicName: "itemTemplate", isSignal: true, isRequired: false, transformFunction: null }, openOnFocus: { classPropertyName: "openOnFocus", publicName: "openOnFocus", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { search: "search", searchChange: "searchChange", selectionChange: "selectionChange", chipAdd: "chipAdd", chipRemove: "chipRemove", opened: "opened", closed: "closed", cleared: "cleared" }, host: { listeners: { "document:click": "onDocumentClick($event)" }, properties: { "class.is-open": "isOpen()", "class.is-disabled": "effectiveDisabled()", "class.is-searching": "effectiveSearching()", "class.has-label": "!!label()", "class.is-floating": "isFloatingMode()", "class.is-floated": "isFloated()", "class.chips-sm": "size() === \"sm\"", "class.chips-md": "size() === \"md\"", "class.chips-lg": "size() === \"lg\"" }, classAttribute: "talos-chips-host" }, providers: [
|
|
638
|
+
{
|
|
639
|
+
provide: NG_VALUE_ACCESSOR,
|
|
640
|
+
useExisting: forwardRef(() => TalosChipsComponent),
|
|
641
|
+
multi: true
|
|
642
|
+
}
|
|
643
|
+
], viewQueries: [{ propertyName: "inputEl", first: true, predicate: ["inputEl"], descendants: true }, { propertyName: "dropdownEl", first: true, predicate: ["dropdownEl"], descendants: true }], ngImport: i0, template: "@if (label() && !isFloatingMode()) {\n <label class=\"talos-field-label\" [attr.for]=\"inputId()\" (click)=\"onContainerClick($event)\">\n {{ label() }}\n @if (required()) {\n <span class=\"required-star\" aria-hidden=\"true\">*</span>\n }\n </label>\n}\n\n<div class=\"chips-wrapper\" [class.has-floating-label]=\"isFloatingMode()\">\n <!-- Main Interactive Input Box -->\n <div\n class=\"chips-control\"\n [class.is-focused]=\"isInputFocused() || isOpen()\"\n [class.is-empty]=\"selectedChips().length === 0 && !inputValue()\"\n (click)=\"onContainerClick($event)\"\n >\n <!-- Selected Chips Pills Container -->\n <div class=\"chips-pills-container\">\n @for (chip of selectedChips(); track chip.value) {\n <talos-chip\n [label]=\"chip.display\"\n [value]=\"chip.value\"\n [size]=\"size()\"\n [variant]=\"chipVariant()\"\n [color]=\"chipColor()\"\n [removable]=\"removable() && !effectiveDisabled()\"\n [disabled]=\"effectiveDisabled()\"\n (removed)=\"removeChip(chip)\"\n />\n }\n\n <!-- Inline Search / Input Field -->\n @if (!isMaxReached()) {\n <input\n #inputEl\n type=\"text\"\n class=\"chips-input\"\n [id]=\"inputId()\"\n [placeholder]=\"effectivePlaceholder()\"\n [value]=\"inputValue()\"\n [disabled]=\"effectiveDisabled()\"\n (input)=\"onInput($event)\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur()\"\n (keydown)=\"onKeyDown($event)\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-controls]=\"listboxId()\"\n [attr.aria-activedescendant]=\"activeOptionId()\"\n [attr.aria-disabled]=\"effectiveDisabled()\"\n autocomplete=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n />\n }\n </div>\n\n @if (label() && isFloatingMode()) {\n <label\n class=\"talos-floating-label\"\n [class.is-floated]=\"isFloated()\"\n [attr.for]=\"inputId()\"\n (click)=\"onContainerClick($event)\"\n >\n {{ label() }}\n @if (required()) {\n <span class=\"required-star\" aria-hidden=\"true\">*</span>\n }\n </label>\n }\n\n <!-- Trailing Action Icons -->\n <div class=\"chips-actions\" (click)=\"$event.stopPropagation()\">\n <!-- Searching / Loading Spinner -->\n @if (effectiveSearching()) {\n <span class=\"chips-spinner\" aria-label=\"Searching...\" title=\"Searching...\">\n <svg class=\"spinner-svg\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <circle class=\"spinner-track\" cx=\"12\" cy=\"12\" r=\"9\" stroke=\"currentColor\" stroke-width=\"2.5\" opacity=\"0.25\"></circle>\n <path class=\"spinner-head\" d=\"M12 3a9 9 0 0 1 9 9\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\"></path>\n </svg>\n </span>\n }\n\n <!-- Clear All Chips Button -->\n @if (clearable() && (selectedChips().length > 0 || inputValue()) && !effectiveDisabled() && !effectiveSearching()) {\n <button\n type=\"button\"\n class=\"chips-clear-btn\"\n aria-label=\"Clear all selections\"\n title=\"Clear all\"\n (click)=\"clearAll($event)\"\n >\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"></line>\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"></line>\n </svg>\n </button>\n }\n\n <!-- Dropdown Toggle Arrow -->\n @if (options().length > 0) {\n <button\n type=\"button\"\n class=\"chips-arrow-btn\"\n [class.is-open]=\"isOpen()\"\n [disabled]=\"effectiveDisabled()\"\n aria-label=\"Toggle options menu\"\n tabindex=\"-1\"\n (click)=\"toggleDropdown($event)\"\n >\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <polyline points=\"6 9 12 15 18 9\"></polyline>\n </svg>\n </button>\n }\n </div>\n </div>\n\n <!-- Dropdown Menu / Listbox -->\n @if (isOpen() && !effectiveDisabled()) {\n <div\n #dropdownEl\n class=\"chips-dropdown\"\n [id]=\"listboxId()\"\n role=\"listbox\"\n aria-multiselectable=\"true\"\n [attr.aria-label]=\"label() || 'Options'\"\n (mousedown)=\"$event.preventDefault()\"\n >\n @if (effectiveSearching()) {\n <div class=\"chips-status-message\">\n <svg class=\"spinner-svg\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <circle class=\"spinner-track\" cx=\"12\" cy=\"12\" r=\"9\" stroke=\"currentColor\" stroke-width=\"2.5\" opacity=\"0.25\"></circle>\n <path class=\"spinner-head\" d=\"M12 3a9 9 0 0 1 9 9\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\"></path>\n </svg>\n <span>{{ searchingText() }}</span>\n </div>\n } @else if (filteredOptions().length > 0) {\n <ul class=\"chips-options-list\" role=\"presentation\">\n @for (option of filteredOptions(); track option.value; let idx = $index) {\n <li\n class=\"chips-option-item\"\n [id]=\"componentId() + '-option-' + idx\"\n role=\"option\"\n [attr.aria-selected]=\"option.selected\"\n [attr.aria-disabled]=\"option.disabled\"\n [class.is-selected]=\"option.selected\"\n [class.is-active]=\"activeIndex() === idx\"\n [class.is-disabled]=\"option.disabled\"\n (click)=\"toggleOption(option)\"\n (mouseenter)=\"activeIndex.set(idx)\"\n >\n <!-- Option Checkbox Indicator -->\n <span class=\"option-checkbox\" [class.is-checked]=\"option.selected\" aria-hidden=\"true\">\n @if (option.selected) {\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <polyline points=\"20 6 9 17 4 12\"></polyline>\n </svg>\n }\n </span>\n\n <!-- Content / Template Outlet -->\n @if (itemTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate()!\"\n [ngTemplateOutletContext]=\"{\n $implicit: option.item,\n display: option.display,\n selected: option.selected,\n disabled: option.disabled\n }\"\n />\n } @else {\n <span class=\"option-label\">\n @for (part of option.parts; track $index) {\n @if (part.matched) {\n <strong class=\"highlight-match\">{{ part.text }}</strong>\n } @else {\n <span>{{ part.text }}</span>\n }\n }\n </span>\n }\n </li>\n }\n </ul>\n } @else {\n <!-- Empty / No Results -->\n <div class=\"chips-empty-message\">\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <circle cx=\"11\" cy=\"11\" r=\"8\"></circle>\n <line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"></line>\n <line x1=\"8\" y1=\"11\" x2=\"14\" y2=\"11\"></line>\n </svg>\n <span>{{ noResultsText() }}</span>\n </div>\n\n @if (allowCustom() && inputValue().trim()) {\n <div class=\"chips-create-tag-action\" (click)=\"addCustomChip(inputValue().trim()); inputValue.set('')\">\n <span>Add \"<strong>{{ inputValue().trim() }}</strong>\"</span>\n <kbd>\u21B5 Enter</kbd>\n </div>\n }\n }\n </div>\n }\n</div>\n", styles: [":host{display:block;width:100%;font-family:inherit;box-sizing:border-box}:host.is-disabled{opacity:.6;pointer-events:none;cursor:not-allowed}.talos-field-label{display:inline-flex;align-items:center;font-size:var(--talos-control-font-size, .8125rem);font-weight:600;color:var(--talos-text-color, #0f172a);margin-bottom:.375rem;-webkit-user-select:none;user-select:none;cursor:pointer}.talos-field-label .required-star{color:var(--talos-error-color, #ef4444);margin-left:.125rem}.chips-wrapper{position:relative;width:100%}.chips-control{position:relative;display:flex;align-items:center;justify-content:space-between;width:100%;box-sizing:border-box;background-color:var(--talos-input-bg, #ffffff);border:1px solid var(--talos-border-color, #cbd5e1);border-radius:var(--talos-control-radius, .5rem);cursor:text;transition:border-color .15s ease,box-shadow .15s ease,background-color .15s ease;min-height:2.25rem;padding:.25rem .5rem;gap:.375rem}.chips-control:hover:not(.is-disabled){border-color:var(--talos-border-hover-color, #94a3b8)}.chips-control.is-focused{border-color:var(--talos-primary-500, #3b82f6);box-shadow:0 0 0 3px var(--talos-primary-100, rgba(59, 130, 246, .2))}:host(.chips-sm) .chips-control{min-height:2rem;padding:.1875rem .375rem;font-size:.75rem}:host(.chips-md) .chips-control{min-height:2.375rem;padding:.25rem .5rem;font-size:.8125rem}:host(.chips-lg) .chips-control{min-height:2.75rem;padding:.375rem .625rem;font-size:.875rem}.chips-pills-container{display:flex;flex-wrap:wrap;align-items:center;gap:.25rem;flex:1;min-width:0}.chips-input{flex:1 1 5rem;min-width:3.5rem;border:none;background:transparent;outline:none;font-family:inherit;font-size:inherit;color:var(--talos-text-color, #0f172a);padding:.125rem .25rem;box-sizing:border-box}.chips-input::placeholder{color:var(--talos-input-placeholder-color, #94a3b8);opacity:1}.chips-input:disabled{cursor:not-allowed}.talos-floating-label{position:absolute;left:.625rem;top:50%;transform:translateY(-50%);font-size:var(--talos-control-font-size, .8125rem);font-weight:500;color:var(--talos-input-placeholder-color, #94a3b8);pointer-events:none;-webkit-user-select:none;user-select:none;background-color:var(--talos-input-bg, #ffffff);padding:0 .25rem;border-radius:.25rem;line-height:1;z-index:2;transition:transform .18s cubic-bezier(.4,0,.2,1),font-size .18s cubic-bezier(.4,0,.2,1),color .18s cubic-bezier(.4,0,.2,1),top .18s cubic-bezier(.4,0,.2,1)}.talos-floating-label .required-star{color:var(--talos-error-color, #ef4444);margin-left:.125rem}.talos-floating-label.is-floated{top:0!important;transform:translateY(-50%) scale(.85)!important;font-size:.75rem;font-weight:600;color:var(--talos-text-muted, #64748b)}:host(.is-open) .talos-floating-label.is-floated,.chips-control.is-focused .talos-floating-label.is-floated{color:var(--talos-primary-color, #2563eb)}.chips-actions{display:inline-flex;align-items:center;gap:.25rem;flex-shrink:0;margin-left:auto}.chips-clear-btn{display:inline-flex;align-items:center;justify-content:center;width:1.125rem;height:1.125rem;padding:0;background:transparent;border:none;border-radius:50%;color:var(--talos-text-muted, #94a3b8);cursor:pointer;outline:none;transition:color .15s ease,background-color .15s ease}.chips-clear-btn svg{width:.75rem;height:.75rem}.chips-clear-btn:hover{color:var(--talos-error-color, #ef4444);background-color:#ef444426}.chips-clear-btn:focus-visible{color:var(--talos-error-color, #ef4444);box-shadow:0 0 0 2px #ef444433}.chips-arrow-btn{display:inline-flex;align-items:center;justify-content:center;width:1.125rem;height:1.125rem;padding:0;background:transparent;border:none;color:var(--talos-text-muted, #64748b);cursor:pointer;outline:none;transition:transform .2s cubic-bezier(.4,0,.2,1),color .15s ease}.chips-arrow-btn svg{width:.875rem;height:.875rem}.chips-arrow-btn.is-open{transform:rotate(180deg);color:var(--talos-primary-600, #2563eb)}.chips-spinner{display:inline-flex;align-items:center;justify-content:center;color:var(--talos-primary-500, #3b82f6)}.chips-spinner .spinner-svg{width:.875rem;height:.875rem;animation:spin .8s linear infinite}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.chips-dropdown{position:absolute;top:calc(100% + 4px);left:0;width:100%;max-height:16rem;overflow-y:auto;background-color:var(--talos-dropdown-bg, #ffffff);border:1px solid var(--talos-border-color, #cbd5e1);border-radius:var(--talos-control-radius, .5rem);box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a;z-index:50;padding:.25rem;box-sizing:border-box;animation:dropdownFadeIn .15s cubic-bezier(.16,1,.3,1)}@keyframes dropdownFadeIn{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}.chips-options-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:.125rem}.chips-option-item{display:flex;align-items:center;gap:.5rem;padding:.4375rem .625rem;border-radius:.375rem;font-size:.8125rem;color:var(--talos-text-color, #0f172a);cursor:pointer;-webkit-user-select:none;user-select:none;transition:background-color .12s ease,color .12s ease}.chips-option-item.is-active,.chips-option-item:hover{background-color:var(--talos-item-hover-bg, #f1f5f9)}.chips-option-item.is-selected{background-color:var(--talos-primary-50, rgba(37, 99, 235, .08));color:var(--talos-primary-700, #1d4ed8);font-weight:500}.chips-option-item.is-selected.is-active,.chips-option-item.is-selected:hover{background-color:var(--talos-primary-100, rgba(37, 99, 235, .15))}.chips-option-item.is-disabled{opacity:.4;cursor:not-allowed;pointer-events:none}.option-checkbox{display:inline-flex;align-items:center;justify-content:center;width:1rem;height:1rem;border-radius:.25rem;border:1px solid var(--talos-gray-300, #cbd5e1);background-color:var(--talos-input-bg, #ffffff);flex-shrink:0;transition:all .12s ease}.option-checkbox.is-checked{background-color:var(--talos-primary-600, #2563eb);border-color:var(--talos-primary-600, #2563eb);color:#fff}.option-checkbox.is-checked svg{width:.75rem;height:.75rem}.option-label{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.option-label .highlight-match{color:var(--talos-primary-600, #2563eb);background-color:#2563eb1f;border-radius:.125rem;padding:0 .125rem;font-weight:700}.chips-status-message,.chips-empty-message{display:flex;align-items:center;justify-content:center;gap:.5rem;padding:1rem;font-size:.8125rem;color:var(--talos-gray-500, #64748b);text-align:center}.chips-status-message svg,.chips-empty-message svg{width:1.125rem;height:1.125rem}.chips-create-tag-action{display:flex;align-items:center;justify-content:space-between;padding:.5rem .75rem;margin-top:.25rem;border-top:1px dashed var(--talos-border-color, #cbd5e1);border-radius:.25rem;font-size:.8125rem;color:var(--talos-primary-600, #2563eb);cursor:pointer;background-color:var(--talos-primary-50, rgba(37, 99, 235, .05));transition:background-color .12s ease}.chips-create-tag-action:hover{background-color:var(--talos-primary-100, rgba(37, 99, 235, .15))}.chips-create-tag-action kbd{font-size:.6875rem;padding:.125rem .375rem;border-radius:.25rem;background-color:var(--talos-card-bg, #ffffff);border:1px solid var(--talos-border-color, #cbd5e1);color:var(--talos-gray-600, #475569)}:host-context([data-theme=dark]) .talos-field-label,:host-context(.dark) .talos-field-label{color:#f1f5f9}:host-context([data-theme=dark]) .chips-control,:host-context(.dark) .chips-control{background-color:var(--talos-input-bg, #0f172a);border-color:var(--talos-border-color, #334155)}:host-context([data-theme=dark]) .chips-control:hover:not(.is-disabled),:host-context(.dark) .chips-control:hover:not(.is-disabled){border-color:#475569}:host-context([data-theme=dark]) .chips-control.is-focused,:host-context(.dark) .chips-control.is-focused{border-color:#60a5fa;box-shadow:0 0 0 3px #60a5fa33}:host-context([data-theme=dark]) .chips-input,:host-context(.dark) .chips-input{color:#f1f5f9}:host-context([data-theme=dark]) .chips-input::placeholder,:host-context(.dark) .chips-input::placeholder{color:#64748b}:host-context([data-theme=dark]) .talos-floating-label,:host-context(.dark) .talos-floating-label{background-color:var(--talos-input-bg, #0f172a);color:#64748b}:host-context([data-theme=dark]) .talos-floating-label.is-floated,:host-context(.dark) .talos-floating-label.is-floated{color:#94a3b8}:host-context([data-theme=dark]):host(.is-open) .talos-floating-label.is-floated,:host-context([data-theme=dark]) .chips-control.is-focused .talos-floating-label.is-floated,:host-context(.dark):host(.is-open) .talos-floating-label.is-floated,:host-context(.dark) .chips-control.is-focused .talos-floating-label.is-floated{color:#60a5fa}:host-context([data-theme=dark]) .chips-dropdown,:host-context(.dark) .chips-dropdown{background-color:var(--talos-dropdown-bg, #1e293b);border-color:#334155;box-shadow:0 10px 15px -3px #00000080}:host-context([data-theme=dark]) .chips-option-item,:host-context(.dark) .chips-option-item{color:#e2e8f0}:host-context([data-theme=dark]) .chips-option-item.is-active,:host-context([data-theme=dark]) .chips-option-item:hover,:host-context(.dark) .chips-option-item.is-active,:host-context(.dark) .chips-option-item:hover{background-color:#ffffff0f}:host-context([data-theme=dark]) .chips-option-item.is-selected,:host-context(.dark) .chips-option-item.is-selected{background-color:#3b82f62e;color:#93c5fd}:host-context([data-theme=dark]) .chips-option-item.is-selected.is-active,:host-context([data-theme=dark]) .chips-option-item.is-selected:hover,:host-context(.dark) .chips-option-item.is-selected.is-active,:host-context(.dark) .chips-option-item.is-selected:hover{background-color:#3b82f647}:host-context([data-theme=dark]) .option-checkbox,:host-context(.dark) .option-checkbox{background-color:#0f172a;border-color:#475569}:host-context([data-theme=dark]) .option-checkbox.is-checked,:host-context(.dark) .option-checkbox.is-checked{background-color:#3b82f6;border-color:#3b82f6}:host-context([data-theme=dark]) .option-label .highlight-match,:host-context(.dark) .option-label .highlight-match{color:#93c5fd;background-color:#3b82f64d}:host-context([data-theme=dark]) .chips-create-tag-action,:host-context(.dark) .chips-create-tag-action{border-top-color:#334155;color:#60a5fa;background-color:#3b82f61f}:host-context([data-theme=dark]) .chips-create-tag-action:hover,:host-context(.dark) .chips-create-tag-action:hover{background-color:#3b82f638}:host-context([data-theme=dark]) .chips-create-tag-action kbd,:host-context(.dark) .chips-create-tag-action kbd{background-color:#0f172a;border-color:#334155;color:#94a3b8}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: TalosChipComponent, selector: "talos-chip", inputs: ["label", "value", "size", "variant", "color", "removable", "disabled", "avatarUrl", "removeAriaLabel"], outputs: ["removed", "chipClick"] }] });
|
|
644
|
+
}
|
|
645
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: TalosChipsComponent, decorators: [{
|
|
646
|
+
type: Component,
|
|
647
|
+
args: [{ selector: 'talos-chips', imports: [NgTemplateOutlet, TalosChipComponent], providers: [
|
|
648
|
+
{
|
|
649
|
+
provide: NG_VALUE_ACCESSOR,
|
|
650
|
+
useExisting: forwardRef(() => TalosChipsComponent),
|
|
651
|
+
multi: true
|
|
652
|
+
}
|
|
653
|
+
], host: {
|
|
654
|
+
'class': 'talos-chips-host',
|
|
655
|
+
'[class.is-open]': 'isOpen()',
|
|
656
|
+
'[class.is-disabled]': 'effectiveDisabled()',
|
|
657
|
+
'[class.is-searching]': 'effectiveSearching()',
|
|
658
|
+
'[class.has-label]': '!!label()',
|
|
659
|
+
'[class.is-floating]': 'isFloatingMode()',
|
|
660
|
+
'[class.is-floated]': 'isFloated()',
|
|
661
|
+
'[class.chips-sm]': 'size() === "sm"',
|
|
662
|
+
'[class.chips-md]': 'size() === "md"',
|
|
663
|
+
'[class.chips-lg]': 'size() === "lg"',
|
|
664
|
+
'(document:click)': 'onDocumentClick($event)'
|
|
665
|
+
}, template: "@if (label() && !isFloatingMode()) {\n <label class=\"talos-field-label\" [attr.for]=\"inputId()\" (click)=\"onContainerClick($event)\">\n {{ label() }}\n @if (required()) {\n <span class=\"required-star\" aria-hidden=\"true\">*</span>\n }\n </label>\n}\n\n<div class=\"chips-wrapper\" [class.has-floating-label]=\"isFloatingMode()\">\n <!-- Main Interactive Input Box -->\n <div\n class=\"chips-control\"\n [class.is-focused]=\"isInputFocused() || isOpen()\"\n [class.is-empty]=\"selectedChips().length === 0 && !inputValue()\"\n (click)=\"onContainerClick($event)\"\n >\n <!-- Selected Chips Pills Container -->\n <div class=\"chips-pills-container\">\n @for (chip of selectedChips(); track chip.value) {\n <talos-chip\n [label]=\"chip.display\"\n [value]=\"chip.value\"\n [size]=\"size()\"\n [variant]=\"chipVariant()\"\n [color]=\"chipColor()\"\n [removable]=\"removable() && !effectiveDisabled()\"\n [disabled]=\"effectiveDisabled()\"\n (removed)=\"removeChip(chip)\"\n />\n }\n\n <!-- Inline Search / Input Field -->\n @if (!isMaxReached()) {\n <input\n #inputEl\n type=\"text\"\n class=\"chips-input\"\n [id]=\"inputId()\"\n [placeholder]=\"effectivePlaceholder()\"\n [value]=\"inputValue()\"\n [disabled]=\"effectiveDisabled()\"\n (input)=\"onInput($event)\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur()\"\n (keydown)=\"onKeyDown($event)\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-controls]=\"listboxId()\"\n [attr.aria-activedescendant]=\"activeOptionId()\"\n [attr.aria-disabled]=\"effectiveDisabled()\"\n autocomplete=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n />\n }\n </div>\n\n @if (label() && isFloatingMode()) {\n <label\n class=\"talos-floating-label\"\n [class.is-floated]=\"isFloated()\"\n [attr.for]=\"inputId()\"\n (click)=\"onContainerClick($event)\"\n >\n {{ label() }}\n @if (required()) {\n <span class=\"required-star\" aria-hidden=\"true\">*</span>\n }\n </label>\n }\n\n <!-- Trailing Action Icons -->\n <div class=\"chips-actions\" (click)=\"$event.stopPropagation()\">\n <!-- Searching / Loading Spinner -->\n @if (effectiveSearching()) {\n <span class=\"chips-spinner\" aria-label=\"Searching...\" title=\"Searching...\">\n <svg class=\"spinner-svg\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <circle class=\"spinner-track\" cx=\"12\" cy=\"12\" r=\"9\" stroke=\"currentColor\" stroke-width=\"2.5\" opacity=\"0.25\"></circle>\n <path class=\"spinner-head\" d=\"M12 3a9 9 0 0 1 9 9\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\"></path>\n </svg>\n </span>\n }\n\n <!-- Clear All Chips Button -->\n @if (clearable() && (selectedChips().length > 0 || inputValue()) && !effectiveDisabled() && !effectiveSearching()) {\n <button\n type=\"button\"\n class=\"chips-clear-btn\"\n aria-label=\"Clear all selections\"\n title=\"Clear all\"\n (click)=\"clearAll($event)\"\n >\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"></line>\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"></line>\n </svg>\n </button>\n }\n\n <!-- Dropdown Toggle Arrow -->\n @if (options().length > 0) {\n <button\n type=\"button\"\n class=\"chips-arrow-btn\"\n [class.is-open]=\"isOpen()\"\n [disabled]=\"effectiveDisabled()\"\n aria-label=\"Toggle options menu\"\n tabindex=\"-1\"\n (click)=\"toggleDropdown($event)\"\n >\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <polyline points=\"6 9 12 15 18 9\"></polyline>\n </svg>\n </button>\n }\n </div>\n </div>\n\n <!-- Dropdown Menu / Listbox -->\n @if (isOpen() && !effectiveDisabled()) {\n <div\n #dropdownEl\n class=\"chips-dropdown\"\n [id]=\"listboxId()\"\n role=\"listbox\"\n aria-multiselectable=\"true\"\n [attr.aria-label]=\"label() || 'Options'\"\n (mousedown)=\"$event.preventDefault()\"\n >\n @if (effectiveSearching()) {\n <div class=\"chips-status-message\">\n <svg class=\"spinner-svg\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <circle class=\"spinner-track\" cx=\"12\" cy=\"12\" r=\"9\" stroke=\"currentColor\" stroke-width=\"2.5\" opacity=\"0.25\"></circle>\n <path class=\"spinner-head\" d=\"M12 3a9 9 0 0 1 9 9\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\"></path>\n </svg>\n <span>{{ searchingText() }}</span>\n </div>\n } @else if (filteredOptions().length > 0) {\n <ul class=\"chips-options-list\" role=\"presentation\">\n @for (option of filteredOptions(); track option.value; let idx = $index) {\n <li\n class=\"chips-option-item\"\n [id]=\"componentId() + '-option-' + idx\"\n role=\"option\"\n [attr.aria-selected]=\"option.selected\"\n [attr.aria-disabled]=\"option.disabled\"\n [class.is-selected]=\"option.selected\"\n [class.is-active]=\"activeIndex() === idx\"\n [class.is-disabled]=\"option.disabled\"\n (click)=\"toggleOption(option)\"\n (mouseenter)=\"activeIndex.set(idx)\"\n >\n <!-- Option Checkbox Indicator -->\n <span class=\"option-checkbox\" [class.is-checked]=\"option.selected\" aria-hidden=\"true\">\n @if (option.selected) {\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <polyline points=\"20 6 9 17 4 12\"></polyline>\n </svg>\n }\n </span>\n\n <!-- Content / Template Outlet -->\n @if (itemTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate()!\"\n [ngTemplateOutletContext]=\"{\n $implicit: option.item,\n display: option.display,\n selected: option.selected,\n disabled: option.disabled\n }\"\n />\n } @else {\n <span class=\"option-label\">\n @for (part of option.parts; track $index) {\n @if (part.matched) {\n <strong class=\"highlight-match\">{{ part.text }}</strong>\n } @else {\n <span>{{ part.text }}</span>\n }\n }\n </span>\n }\n </li>\n }\n </ul>\n } @else {\n <!-- Empty / No Results -->\n <div class=\"chips-empty-message\">\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <circle cx=\"11\" cy=\"11\" r=\"8\"></circle>\n <line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"></line>\n <line x1=\"8\" y1=\"11\" x2=\"14\" y2=\"11\"></line>\n </svg>\n <span>{{ noResultsText() }}</span>\n </div>\n\n @if (allowCustom() && inputValue().trim()) {\n <div class=\"chips-create-tag-action\" (click)=\"addCustomChip(inputValue().trim()); inputValue.set('')\">\n <span>Add \"<strong>{{ inputValue().trim() }}</strong>\"</span>\n <kbd>\u21B5 Enter</kbd>\n </div>\n }\n }\n </div>\n }\n</div>\n", styles: [":host{display:block;width:100%;font-family:inherit;box-sizing:border-box}:host.is-disabled{opacity:.6;pointer-events:none;cursor:not-allowed}.talos-field-label{display:inline-flex;align-items:center;font-size:var(--talos-control-font-size, .8125rem);font-weight:600;color:var(--talos-text-color, #0f172a);margin-bottom:.375rem;-webkit-user-select:none;user-select:none;cursor:pointer}.talos-field-label .required-star{color:var(--talos-error-color, #ef4444);margin-left:.125rem}.chips-wrapper{position:relative;width:100%}.chips-control{position:relative;display:flex;align-items:center;justify-content:space-between;width:100%;box-sizing:border-box;background-color:var(--talos-input-bg, #ffffff);border:1px solid var(--talos-border-color, #cbd5e1);border-radius:var(--talos-control-radius, .5rem);cursor:text;transition:border-color .15s ease,box-shadow .15s ease,background-color .15s ease;min-height:2.25rem;padding:.25rem .5rem;gap:.375rem}.chips-control:hover:not(.is-disabled){border-color:var(--talos-border-hover-color, #94a3b8)}.chips-control.is-focused{border-color:var(--talos-primary-500, #3b82f6);box-shadow:0 0 0 3px var(--talos-primary-100, rgba(59, 130, 246, .2))}:host(.chips-sm) .chips-control{min-height:2rem;padding:.1875rem .375rem;font-size:.75rem}:host(.chips-md) .chips-control{min-height:2.375rem;padding:.25rem .5rem;font-size:.8125rem}:host(.chips-lg) .chips-control{min-height:2.75rem;padding:.375rem .625rem;font-size:.875rem}.chips-pills-container{display:flex;flex-wrap:wrap;align-items:center;gap:.25rem;flex:1;min-width:0}.chips-input{flex:1 1 5rem;min-width:3.5rem;border:none;background:transparent;outline:none;font-family:inherit;font-size:inherit;color:var(--talos-text-color, #0f172a);padding:.125rem .25rem;box-sizing:border-box}.chips-input::placeholder{color:var(--talos-input-placeholder-color, #94a3b8);opacity:1}.chips-input:disabled{cursor:not-allowed}.talos-floating-label{position:absolute;left:.625rem;top:50%;transform:translateY(-50%);font-size:var(--talos-control-font-size, .8125rem);font-weight:500;color:var(--talos-input-placeholder-color, #94a3b8);pointer-events:none;-webkit-user-select:none;user-select:none;background-color:var(--talos-input-bg, #ffffff);padding:0 .25rem;border-radius:.25rem;line-height:1;z-index:2;transition:transform .18s cubic-bezier(.4,0,.2,1),font-size .18s cubic-bezier(.4,0,.2,1),color .18s cubic-bezier(.4,0,.2,1),top .18s cubic-bezier(.4,0,.2,1)}.talos-floating-label .required-star{color:var(--talos-error-color, #ef4444);margin-left:.125rem}.talos-floating-label.is-floated{top:0!important;transform:translateY(-50%) scale(.85)!important;font-size:.75rem;font-weight:600;color:var(--talos-text-muted, #64748b)}:host(.is-open) .talos-floating-label.is-floated,.chips-control.is-focused .talos-floating-label.is-floated{color:var(--talos-primary-color, #2563eb)}.chips-actions{display:inline-flex;align-items:center;gap:.25rem;flex-shrink:0;margin-left:auto}.chips-clear-btn{display:inline-flex;align-items:center;justify-content:center;width:1.125rem;height:1.125rem;padding:0;background:transparent;border:none;border-radius:50%;color:var(--talos-text-muted, #94a3b8);cursor:pointer;outline:none;transition:color .15s ease,background-color .15s ease}.chips-clear-btn svg{width:.75rem;height:.75rem}.chips-clear-btn:hover{color:var(--talos-error-color, #ef4444);background-color:#ef444426}.chips-clear-btn:focus-visible{color:var(--talos-error-color, #ef4444);box-shadow:0 0 0 2px #ef444433}.chips-arrow-btn{display:inline-flex;align-items:center;justify-content:center;width:1.125rem;height:1.125rem;padding:0;background:transparent;border:none;color:var(--talos-text-muted, #64748b);cursor:pointer;outline:none;transition:transform .2s cubic-bezier(.4,0,.2,1),color .15s ease}.chips-arrow-btn svg{width:.875rem;height:.875rem}.chips-arrow-btn.is-open{transform:rotate(180deg);color:var(--talos-primary-600, #2563eb)}.chips-spinner{display:inline-flex;align-items:center;justify-content:center;color:var(--talos-primary-500, #3b82f6)}.chips-spinner .spinner-svg{width:.875rem;height:.875rem;animation:spin .8s linear infinite}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.chips-dropdown{position:absolute;top:calc(100% + 4px);left:0;width:100%;max-height:16rem;overflow-y:auto;background-color:var(--talos-dropdown-bg, #ffffff);border:1px solid var(--talos-border-color, #cbd5e1);border-radius:var(--talos-control-radius, .5rem);box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a;z-index:50;padding:.25rem;box-sizing:border-box;animation:dropdownFadeIn .15s cubic-bezier(.16,1,.3,1)}@keyframes dropdownFadeIn{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}.chips-options-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:.125rem}.chips-option-item{display:flex;align-items:center;gap:.5rem;padding:.4375rem .625rem;border-radius:.375rem;font-size:.8125rem;color:var(--talos-text-color, #0f172a);cursor:pointer;-webkit-user-select:none;user-select:none;transition:background-color .12s ease,color .12s ease}.chips-option-item.is-active,.chips-option-item:hover{background-color:var(--talos-item-hover-bg, #f1f5f9)}.chips-option-item.is-selected{background-color:var(--talos-primary-50, rgba(37, 99, 235, .08));color:var(--talos-primary-700, #1d4ed8);font-weight:500}.chips-option-item.is-selected.is-active,.chips-option-item.is-selected:hover{background-color:var(--talos-primary-100, rgba(37, 99, 235, .15))}.chips-option-item.is-disabled{opacity:.4;cursor:not-allowed;pointer-events:none}.option-checkbox{display:inline-flex;align-items:center;justify-content:center;width:1rem;height:1rem;border-radius:.25rem;border:1px solid var(--talos-gray-300, #cbd5e1);background-color:var(--talos-input-bg, #ffffff);flex-shrink:0;transition:all .12s ease}.option-checkbox.is-checked{background-color:var(--talos-primary-600, #2563eb);border-color:var(--talos-primary-600, #2563eb);color:#fff}.option-checkbox.is-checked svg{width:.75rem;height:.75rem}.option-label{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.option-label .highlight-match{color:var(--talos-primary-600, #2563eb);background-color:#2563eb1f;border-radius:.125rem;padding:0 .125rem;font-weight:700}.chips-status-message,.chips-empty-message{display:flex;align-items:center;justify-content:center;gap:.5rem;padding:1rem;font-size:.8125rem;color:var(--talos-gray-500, #64748b);text-align:center}.chips-status-message svg,.chips-empty-message svg{width:1.125rem;height:1.125rem}.chips-create-tag-action{display:flex;align-items:center;justify-content:space-between;padding:.5rem .75rem;margin-top:.25rem;border-top:1px dashed var(--talos-border-color, #cbd5e1);border-radius:.25rem;font-size:.8125rem;color:var(--talos-primary-600, #2563eb);cursor:pointer;background-color:var(--talos-primary-50, rgba(37, 99, 235, .05));transition:background-color .12s ease}.chips-create-tag-action:hover{background-color:var(--talos-primary-100, rgba(37, 99, 235, .15))}.chips-create-tag-action kbd{font-size:.6875rem;padding:.125rem .375rem;border-radius:.25rem;background-color:var(--talos-card-bg, #ffffff);border:1px solid var(--talos-border-color, #cbd5e1);color:var(--talos-gray-600, #475569)}:host-context([data-theme=dark]) .talos-field-label,:host-context(.dark) .talos-field-label{color:#f1f5f9}:host-context([data-theme=dark]) .chips-control,:host-context(.dark) .chips-control{background-color:var(--talos-input-bg, #0f172a);border-color:var(--talos-border-color, #334155)}:host-context([data-theme=dark]) .chips-control:hover:not(.is-disabled),:host-context(.dark) .chips-control:hover:not(.is-disabled){border-color:#475569}:host-context([data-theme=dark]) .chips-control.is-focused,:host-context(.dark) .chips-control.is-focused{border-color:#60a5fa;box-shadow:0 0 0 3px #60a5fa33}:host-context([data-theme=dark]) .chips-input,:host-context(.dark) .chips-input{color:#f1f5f9}:host-context([data-theme=dark]) .chips-input::placeholder,:host-context(.dark) .chips-input::placeholder{color:#64748b}:host-context([data-theme=dark]) .talos-floating-label,:host-context(.dark) .talos-floating-label{background-color:var(--talos-input-bg, #0f172a);color:#64748b}:host-context([data-theme=dark]) .talos-floating-label.is-floated,:host-context(.dark) .talos-floating-label.is-floated{color:#94a3b8}:host-context([data-theme=dark]):host(.is-open) .talos-floating-label.is-floated,:host-context([data-theme=dark]) .chips-control.is-focused .talos-floating-label.is-floated,:host-context(.dark):host(.is-open) .talos-floating-label.is-floated,:host-context(.dark) .chips-control.is-focused .talos-floating-label.is-floated{color:#60a5fa}:host-context([data-theme=dark]) .chips-dropdown,:host-context(.dark) .chips-dropdown{background-color:var(--talos-dropdown-bg, #1e293b);border-color:#334155;box-shadow:0 10px 15px -3px #00000080}:host-context([data-theme=dark]) .chips-option-item,:host-context(.dark) .chips-option-item{color:#e2e8f0}:host-context([data-theme=dark]) .chips-option-item.is-active,:host-context([data-theme=dark]) .chips-option-item:hover,:host-context(.dark) .chips-option-item.is-active,:host-context(.dark) .chips-option-item:hover{background-color:#ffffff0f}:host-context([data-theme=dark]) .chips-option-item.is-selected,:host-context(.dark) .chips-option-item.is-selected{background-color:#3b82f62e;color:#93c5fd}:host-context([data-theme=dark]) .chips-option-item.is-selected.is-active,:host-context([data-theme=dark]) .chips-option-item.is-selected:hover,:host-context(.dark) .chips-option-item.is-selected.is-active,:host-context(.dark) .chips-option-item.is-selected:hover{background-color:#3b82f647}:host-context([data-theme=dark]) .option-checkbox,:host-context(.dark) .option-checkbox{background-color:#0f172a;border-color:#475569}:host-context([data-theme=dark]) .option-checkbox.is-checked,:host-context(.dark) .option-checkbox.is-checked{background-color:#3b82f6;border-color:#3b82f6}:host-context([data-theme=dark]) .option-label .highlight-match,:host-context(.dark) .option-label .highlight-match{color:#93c5fd;background-color:#3b82f64d}:host-context([data-theme=dark]) .chips-create-tag-action,:host-context(.dark) .chips-create-tag-action{border-top-color:#334155;color:#60a5fa;background-color:#3b82f61f}:host-context([data-theme=dark]) .chips-create-tag-action:hover,:host-context(.dark) .chips-create-tag-action:hover{background-color:#3b82f638}:host-context([data-theme=dark]) .chips-create-tag-action kbd,:host-context(.dark) .chips-create-tag-action kbd{background-color:#0f172a;border-color:#334155;color:#94a3b8}\n"] }]
|
|
666
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], floatingLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "floatingLabel", required: false }] }], floating: [{ type: i0.Input, args: [{ isSignal: true, alias: "floating", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], searching: [{ type: i0.Input, args: [{ isSignal: true, alias: "searching", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], removable: [{ type: i0.Input, args: [{ isSignal: true, alias: "removable", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], maxChips: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxChips", required: false }] }], allowCustom: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowCustom", required: false }] }], separatorKeys: [{ type: i0.Input, args: [{ isSignal: true, alias: "separatorKeys", required: false }] }], displayWith: [{ type: i0.Input, args: [{ isSignal: true, alias: "displayWith", required: false }] }], valueWith: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueWith", required: false }] }], filterFn: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterFn", required: false }] }], highlightMatch: [{ type: i0.Input, args: [{ isSignal: true, alias: "highlightMatch", required: false }] }], noResultsText: [{ type: i0.Input, args: [{ isSignal: true, alias: "noResultsText", required: false }] }], searchingText: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchingText", required: false }] }], chipVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "chipVariant", required: false }] }], chipColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "chipColor", required: false }] }], itemTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemTemplate", required: false }] }], openOnFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "openOnFocus", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], search: [{ type: i0.Output, args: ["search"] }], searchChange: [{ type: i0.Output, args: ["searchChange"] }], selectionChange: [{ type: i0.Output, args: ["selectionChange"] }], chipAdd: [{ type: i0.Output, args: ["chipAdd"] }], chipRemove: [{ type: i0.Output, args: ["chipRemove"] }], opened: [{ type: i0.Output, args: ["opened"] }], closed: [{ type: i0.Output, args: ["closed"] }], cleared: [{ type: i0.Output, args: ["cleared"] }], inputEl: [{
|
|
667
|
+
type: ViewChild,
|
|
668
|
+
args: ['inputEl']
|
|
669
|
+
}], dropdownEl: [{
|
|
670
|
+
type: ViewChild,
|
|
671
|
+
args: ['dropdownEl']
|
|
672
|
+
}] } });
|
|
673
|
+
|
|
674
|
+
class TalosChipsModule {
|
|
675
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: TalosChipsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
676
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.1.1", ngImport: i0, type: TalosChipsModule, imports: [TalosChipsComponent, TalosChipComponent], exports: [TalosChipsComponent, TalosChipComponent] });
|
|
677
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: TalosChipsModule });
|
|
678
|
+
}
|
|
679
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: TalosChipsModule, decorators: [{
|
|
680
|
+
type: NgModule,
|
|
681
|
+
args: [{
|
|
682
|
+
imports: [TalosChipsComponent, TalosChipComponent],
|
|
683
|
+
exports: [TalosChipsComponent, TalosChipComponent]
|
|
684
|
+
}]
|
|
685
|
+
}] });
|
|
686
|
+
|
|
687
|
+
/**
|
|
688
|
+
* Generated bundle index. Do not edit.
|
|
689
|
+
*/
|
|
690
|
+
|
|
691
|
+
export { TalosChipComponent, TalosChipsComponent, TalosChipsModule };
|
|
692
|
+
//# sourceMappingURL=weeehaoooz-talos-ui-form-chips.mjs.map
|