@masterteam/components 0.0.268 → 0.0.270

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.
@@ -1 +1 @@
1
- {"version":3,"file":"masterteam-components-tabs.mjs","sources":["../../../../packages/masterteam/components/tabs/tabs.ts","../../../../packages/masterteam/components/tabs/tabs.html","../../../../packages/masterteam/components/tabs/masterteam-components-tabs.ts"],"sourcesContent":["import {\r\n afterNextRender,\r\n booleanAttribute,\r\n Component,\r\n computed,\r\n DestroyRef,\r\n effect,\r\n ElementRef,\r\n inject,\r\n input,\r\n model,\r\n output,\r\n signal,\r\n viewChild,\r\n} from '@angular/core';\r\nimport { NgTemplateOutlet } from '@angular/common';\r\nimport { FormsModule } from '@angular/forms';\r\nimport { TranslocoPipe, TranslocoService } from '@jsverse/transloco';\r\nimport { MTIcon, Icon } from '@masterteam/icons';\r\nimport { SelectButton } from 'primeng/selectbutton';\r\nimport { Popover } from 'primeng/popover';\r\nimport { InputTextModule } from 'primeng/inputtext';\r\nimport { IconFieldModule } from 'primeng/iconfield';\r\nimport { InputIconModule } from 'primeng/inputicon';\r\nimport { Button } from '@masterteam/components/button';\r\nimport { Avatar } from '@masterteam/components/avatar';\r\n\r\nexport type TabSeverity =\r\n | 'primary'\r\n | 'secondary'\r\n | 'success'\r\n | 'info'\r\n | 'warn'\r\n | 'warning'\r\n | 'danger'\r\n | 'error'\r\n | 'help'\r\n | 'contrast';\r\n\r\nexport interface OptionItem {\r\n label?: string;\r\n value?: any;\r\n icon?: MTIcon | null;\r\n badge?: number | string | null;\r\n severity?: TabSeverity | null;\r\n disabled?: boolean;\r\n /**\r\n * The host is still resolving this tab's title — typically it names a record\r\n * that is being fetched. The label slot renders a placeholder instead of the\r\n * text, so the tab never flashes a stand-in name before the real one lands.\r\n * Keep supplying the fallback `label`: it stays the accessible name and is\r\n * still what the \"more\" search matches against.\r\n */\r\n loading?: boolean;\r\n [key: string]: unknown;\r\n}\r\n\r\ntype NormalizedTabSeverity =\r\n | 'primary'\r\n | 'secondary'\r\n | 'success'\r\n | 'info'\r\n | 'warn'\r\n | 'danger'\r\n | 'help'\r\n | 'contrast';\r\n\r\n@Component({\r\n selector: 'mt-tabs',\r\n standalone: true,\r\n imports: [\r\n Icon,\r\n NgTemplateOutlet,\r\n SelectButton,\r\n FormsModule,\r\n Button,\r\n Popover,\r\n Avatar,\r\n InputTextModule,\r\n IconFieldModule,\r\n InputIconModule,\r\n TranslocoPipe,\r\n ],\r\n templateUrl: './tabs.html',\r\n styleUrls: ['./tabs.scss'],\r\n host: {\r\n class: 'grid min-w-0 gap-1',\r\n '[class.w-full]': 'fluid()',\r\n },\r\n})\r\nexport class Tabs {\r\n private readonly transloco = inject(TranslocoService);\r\n options = input<OptionItem[]>([]);\r\n optionLabel = input<string>('label');\r\n optionValue = input<string>('value');\r\n active = model<any>(null);\r\n readonly mode = input<'horizontal' | 'vertical' | 'underline'>('horizontal');\r\n readonly moreLabel = input<string>(\r\n this.transloco.translate('components.tabs.more'),\r\n );\r\n readonly defaultIcon = input<MTIcon>('layout.align-left-02');\r\n\r\n onChange = output<any>();\r\n\r\n readonly size = input<'small' | 'large' | undefined>();\r\n readonly fluid = input<boolean, unknown>(false, {\r\n transform: booleanAttribute,\r\n });\r\n disabled = input<boolean, unknown>(false, {\r\n transform: booleanAttribute,\r\n });\r\n\r\n private readonly destroyRef = inject(DestroyRef);\r\n private readonly tabsContainer =\r\n viewChild<ElementRef<HTMLElement>>('tabsContainer');\r\n private readonly measureRow =\r\n viewChild<ElementRef<HTMLElement>>('measureRow');\r\n private readonly morePopover = viewChild(Popover);\r\n private resizeObserver?: ResizeObserver;\r\n private measureHandle = 0;\r\n private alignHandle = 0;\r\n\r\n readonly visibleCount = signal<number>(Number.MAX_SAFE_INTEGER);\r\n readonly visibleOptions = computed(() =>\r\n this.options().slice(0, this.visibleCount()),\r\n );\r\n readonly overflowOptions = computed(() =>\r\n this.options().slice(this.visibleCount()),\r\n );\r\n readonly hasOverflow = computed(() => this.overflowOptions().length > 0);\r\n readonly isActiveInOverflow = computed(() =>\r\n this.overflowOptions().some((option) => this.isActiveOption(option)),\r\n );\r\n\r\n readonly searchThreshold = input<number>(8);\r\n readonly searchTerm = signal<string>('');\r\n readonly showOverflowSearch = computed(\r\n () => this.overflowOptions().length >= this.searchThreshold(),\r\n );\r\n readonly filteredOverflowOptions = computed(() => {\r\n const term = this.searchTerm().trim().toLowerCase();\r\n if (!term) return this.overflowOptions();\r\n return this.overflowOptions().filter((option) =>\r\n this.resolveLabel(option).toLowerCase().includes(term),\r\n );\r\n });\r\n\r\n constructor() {\r\n effect(() => {\r\n const options = this.options();\r\n const active = this.active();\r\n if (!options.length) {\r\n return;\r\n }\r\n\r\n const hasActiveOption = options.some((option) =>\r\n Object.is(this.resolveValue(option), active),\r\n );\r\n if (!hasActiveOption) {\r\n this.active.set(this.resolveValue(options[0]));\r\n }\r\n });\r\n\r\n afterNextRender(() => {\r\n if (this.mode() !== 'underline') return;\r\n this.setupResizeObserver();\r\n this.scheduleMeasure();\r\n });\r\n\r\n effect(() => {\r\n // Re-measure when options or mode change.\r\n this.options();\r\n if (this.mode() !== 'underline') return;\r\n this.scheduleMeasure();\r\n });\r\n\r\n this.destroyRef.onDestroy(() => {\r\n this.resizeObserver?.disconnect();\r\n if (this.measureHandle) {\r\n cancelAnimationFrame(this.measureHandle);\r\n }\r\n if (this.alignHandle) {\r\n cancelAnimationFrame(this.alignHandle);\r\n }\r\n });\r\n }\r\n\r\n private setupResizeObserver(): void {\r\n const container = this.tabsContainer()?.nativeElement;\r\n if (!container || typeof ResizeObserver === 'undefined') return;\r\n\r\n this.resizeObserver = new ResizeObserver(() => this.scheduleMeasure());\r\n this.resizeObserver.observe(container);\r\n }\r\n\r\n private scheduleMeasure(): void {\r\n if (this.measureHandle) {\r\n cancelAnimationFrame(this.measureHandle);\r\n }\r\n this.measureHandle = requestAnimationFrame(() => {\r\n this.measureHandle = 0;\r\n this.measureAndUpdate();\r\n });\r\n }\r\n\r\n private measureAndUpdate(): void {\r\n const container = this.tabsContainer()?.nativeElement;\r\n const measureRow = this.measureRow()?.nativeElement;\r\n if (!container || !measureRow) return;\r\n\r\n const optionsCount = this.options().length;\r\n if (optionsCount === 0) {\r\n this.visibleCount.set(0);\r\n return;\r\n }\r\n\r\n if (container.clientWidth === 0) return;\r\n\r\n // Inner width excludes the container's horizontal padding so we compare\r\n // against the actual space available to the flex tabs row.\r\n const style = getComputedStyle(container);\r\n const paddingX =\r\n (parseFloat(style.paddingLeft) || 0) +\r\n (parseFloat(style.paddingRight) || 0);\r\n const innerWidth = container.clientWidth - paddingX;\r\n if (innerWidth <= 0) return;\r\n\r\n const tabWidths = Array.from(measureRow.children).map(\r\n (el) => (el as HTMLElement).getBoundingClientRect().width,\r\n );\r\n\r\n if (tabWidths.length === 0) return;\r\n\r\n // Approximate gap-0.5 between tabs (2px).\r\n const gap = 2;\r\n const totalWidth =\r\n tabWidths.reduce((sum, width) => sum + width, 0) +\r\n Math.max(0, tabWidths.length - 1) * gap;\r\n\r\n // Everything fits — no more button needed.\r\n if (totalWidth <= innerWidth) {\r\n this.visibleCount.set(tabWidths.length);\r\n return;\r\n }\r\n\r\n // Reserve space for the More button (icon + label ~ 88px).\r\n const moreButtonReserve = 96;\r\n const available = innerWidth - moreButtonReserve;\r\n\r\n let cumulative = 0;\r\n let visibleCount = 0;\r\n for (let i = 0; i < tabWidths.length; i++) {\r\n const next = cumulative + tabWidths[i] + (i > 0 ? gap : 0);\r\n if (next > available) break;\r\n cumulative = next;\r\n visibleCount++;\r\n }\r\n\r\n this.visibleCount.set(Math.max(1, visibleCount));\r\n }\r\n\r\n onTabChange(value: any) {\r\n this.onChange.emit(value);\r\n }\r\n\r\n onOverflowSearch(value: string): void {\r\n this.searchTerm.set(value ?? '');\r\n // Filtering shrinks/grows the popover content, but PrimeNG only positions\r\n // the popover on show. Re-align after the filtered list re-renders so a\r\n // popover opened above the trigger stays attached instead of overlapping.\r\n this.scheduleOverflowAlign();\r\n }\r\n\r\n private scheduleOverflowAlign(): void {\r\n if (this.alignHandle) {\r\n cancelAnimationFrame(this.alignHandle);\r\n }\r\n this.alignHandle = requestAnimationFrame(() => {\r\n this.alignHandle = 0;\r\n const popover = this.morePopover();\r\n if (!popover?.overlayVisible) return;\r\n\r\n // Clear the stale flip marker so align() recomputes the arrow direction\r\n // for the new height instead of keeping the previous \"above\" state.\r\n const container = popover.container;\r\n if (container) {\r\n container.removeAttribute('data-p-popover-flipped');\r\n container.classList.remove('p-popover-flipped');\r\n }\r\n popover.align();\r\n });\r\n }\r\n\r\n onOverflowPopoverHide(): void {\r\n this.searchTerm.set('');\r\n }\r\n\r\n onOptionSelect(option: OptionItem): void {\r\n if (this.disabled() || this.isOptionDisabled(option)) {\r\n return;\r\n }\r\n\r\n const value = this.resolveValue(option);\r\n this.active.set(value);\r\n this.onTabChange(value);\r\n }\r\n\r\n resolveLabel(option: OptionItem): string {\r\n const labelKey = this.optionLabel();\r\n const label =\r\n option && typeof option === 'object'\r\n ? (option as Record<string, unknown>)[labelKey]\r\n : option;\r\n\r\n return typeof label === 'string' ? label : String(label ?? '');\r\n }\r\n\r\n resolveValue(option: OptionItem): unknown {\r\n const valueKey = this.optionValue();\r\n if (option && typeof option === 'object' && valueKey in option) {\r\n return (option as Record<string, unknown>)[valueKey];\r\n }\r\n\r\n return option;\r\n }\r\n\r\n resolveIcon(option: OptionItem): MTIcon | null {\r\n return typeof option?.icon === 'string' ? option.icon : null;\r\n }\r\n\r\n resolveIconOrDefault(option: OptionItem): MTIcon {\r\n return this.resolveIcon(option) ?? this.defaultIcon();\r\n }\r\n\r\n resolveBadge(option: OptionItem): number | string | null {\r\n return option?.badge ?? null;\r\n }\r\n\r\n isOptionLoading(option: OptionItem): boolean {\r\n return option?.loading === true;\r\n }\r\n\r\n hasBadge(option: OptionItem): boolean {\r\n return option?.badge !== null && option?.badge !== undefined;\r\n }\r\n\r\n hasCountBadge(option: OptionItem): boolean {\r\n const badge = option?.badge;\r\n if (badge === null || badge === undefined || badge === '') {\r\n return false;\r\n }\r\n const numeric = typeof badge === 'number' ? badge : Number(badge);\r\n return Number.isNaN(numeric) ? true : numeric > 0;\r\n }\r\n\r\n severity(option: OptionItem): NormalizedTabSeverity {\r\n const severity =\r\n typeof option?.severity === 'string'\r\n ? option.severity.trim().toLowerCase()\r\n : '';\r\n if (severity === 'error') return 'danger';\r\n if (severity === 'warning') return 'warn';\r\n if (\r\n severity === 'secondary' ||\r\n severity === 'success' ||\r\n severity === 'info' ||\r\n severity === 'warn' ||\r\n severity === 'danger' ||\r\n severity === 'help' ||\r\n severity === 'contrast'\r\n ) {\r\n return severity;\r\n }\r\n\r\n return 'primary';\r\n }\r\n\r\n isSeverity(option: OptionItem, severity: NormalizedTabSeverity): boolean {\r\n return this.severity(option) === severity;\r\n }\r\n\r\n hasNonPrimarySeverity(option: OptionItem): boolean {\r\n return this.severity(option) !== 'primary';\r\n }\r\n\r\n isActiveOption(option: OptionItem): boolean {\r\n return Object.is(this.active(), this.resolveValue(option));\r\n }\r\n\r\n isOptionDisabled(option: OptionItem): boolean {\r\n return !!option?.disabled;\r\n }\r\n\r\n trackOption(option: OptionItem, index: number): unknown {\r\n return this.resolveValue(option) ?? index;\r\n }\r\n}\r\n","@if (mode() === \"vertical\") {\r\n <div\r\n class=\"flex min-h-0 flex-col gap-1 rounded-2xl border border-surface-200 bg-white p-2\"\r\n role=\"tablist\"\r\n aria-orientation=\"vertical\"\r\n >\r\n @for (option of options(); track trackOption(option, $index)) {\r\n <button\r\n type=\"button\"\r\n role=\"tab\"\r\n class=\"group relative flex w-full items-center gap-3 overflow-hidden rounded-lg px-3 py-2.5 text-start text-sm transition-colors duration-150 outline-none focus-visible:ring-2 focus-visible:ring-primary/20\"\r\n [attr.aria-selected]=\"isActiveOption(option)\"\r\n [attr.tabindex]=\"isActiveOption(option) ? 0 : -1\"\r\n [disabled]=\"disabled() || isOptionDisabled(option)\"\r\n [class.bg-primary-50]=\"isActiveOption(option)\"\r\n [class.font-semibold]=\"isActiveOption(option)\"\r\n [class.text-primary-700]=\"isActiveOption(option)\"\r\n [class.text-surface-500]=\"!isActiveOption(option)\"\r\n [class.hover:bg-surface-50]=\"!isActiveOption(option)\"\r\n [class.cursor-pointer]=\"!(disabled() || isOptionDisabled(option))\"\r\n [class.cursor-not-allowed]=\"disabled() || isOptionDisabled(option)\"\r\n [class.opacity-60]=\"disabled() || isOptionDisabled(option)\"\r\n (click)=\"onOptionSelect(option)\"\r\n >\r\n @if (resolveIcon(option); as icon) {\r\n <mt-icon\r\n [icon]=\"icon\"\r\n class=\"relative z-10 text-base\"\r\n [class.text-primary]=\"isActiveOption(option)\"\r\n [class.text-surface-400]=\"!isActiveOption(option)\"\r\n />\r\n }\r\n\r\n <span class=\"relative z-10 min-w-0 flex-1 truncate\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"tabLabel\"\r\n [ngTemplateOutletContext]=\"{ $implicit: option }\"\r\n />\r\n </span>\r\n\r\n @if (hasBadge(option)) {\r\n <span\r\n class=\"relative z-10 ms-auto inline-flex min-w-5 items-center justify-center rounded-full px-2 py-0.5 text-[11px] font-bold leading-none\"\r\n [class.bg-primary]=\"isActiveOption(option)\"\r\n [class.text-white]=\"isActiveOption(option)\"\r\n [class.bg-surface-100]=\"!isActiveOption(option)\"\r\n [class.text-surface-600]=\"!isActiveOption(option)\"\r\n >\r\n {{ resolveBadge(option) }}\r\n </span>\r\n }\r\n </button>\r\n }\r\n </div>\r\n} @else if (mode() === \"underline\") {\r\n <div\r\n #tabsContainer\r\n class=\"relative flex w-full min-w-0 max-w-full items-center gap-0.5 overflow-x-clip\"\r\n role=\"tablist\"\r\n aria-orientation=\"horizontal\"\r\n >\r\n <!-- Invisible measurement ghost row: always renders every option at natural width -->\r\n <div\r\n #measureRow\r\n aria-hidden=\"true\"\r\n class=\"pointer-events-none invisible absolute top-0 left-0 flex flex-nowrap gap-0.5 -z-10\"\r\n >\r\n @for (option of options(); track trackOption(option, $index)) {\r\n <span\r\n class=\"inline-flex items-center gap-1.5 border-b-2 border-transparent px-3.5 py-2.5 text-sm font-semibold whitespace-nowrap\"\r\n >\r\n @if (resolveIcon(option); as icon) {\r\n <mt-icon [icon]=\"icon\" class=\"text-base\" />\r\n }\r\n <span>\r\n <ng-container\r\n [ngTemplateOutlet]=\"tabLabel\"\r\n [ngTemplateOutletContext]=\"{ $implicit: option }\"\r\n />\r\n </span>\r\n @if (hasCountBadge(option)) {\r\n <span\r\n class=\"inline-grid min-w-[18px] place-items-center rounded-full px-1.5 text-[10px] leading-4 font-bold tabular-nums\"\r\n >\r\n {{ resolveBadge(option) }}\r\n </span>\r\n }\r\n </span>\r\n }\r\n </div>\r\n\r\n <!-- Visible tabs row -->\r\n <div\r\n class=\"flex min-w-0 flex-1 items-center gap-0.5 overflow-x-clip border-b border-surface-200\"\r\n >\r\n @for (option of visibleOptions(); track trackOption(option, $index)) {\r\n <button\r\n type=\"button\"\r\n role=\"tab\"\r\n class=\"-mb-px inline-flex shrink-0 items-center gap-1.5 border-b-2 px-3.5 py-2.5 text-sm whitespace-nowrap transition-colors duration-150 outline-none focus-visible:ring-2 focus-visible:ring-primary/20\"\r\n [attr.aria-selected]=\"isActiveOption(option)\"\r\n [attr.tabindex]=\"isActiveOption(option) ? 0 : -1\"\r\n [disabled]=\"disabled() || isOptionDisabled(option)\"\r\n [class.border-primary]=\"\r\n isActiveOption(option) && isSeverity(option, 'primary')\r\n \"\r\n [class.text-primary]=\"\r\n isActiveOption(option) && isSeverity(option, 'primary')\r\n \"\r\n [class.border-slate-500]=\"\r\n isActiveOption(option) && isSeverity(option, 'secondary')\r\n \"\r\n [class.text-slate-600]=\"isSeverity(option, 'secondary')\"\r\n [class.border-emerald-500]=\"\r\n isActiveOption(option) && isSeverity(option, 'success')\r\n \"\r\n [class.text-emerald-600]=\"isSeverity(option, 'success')\"\r\n [class.border-sky-500]=\"\r\n isActiveOption(option) && isSeverity(option, 'info')\r\n \"\r\n [class.text-sky-600]=\"isSeverity(option, 'info')\"\r\n [class.border-amber-500]=\"\r\n isActiveOption(option) && isSeverity(option, 'warn')\r\n \"\r\n [class.text-amber-700]=\"isSeverity(option, 'warn')\"\r\n [class.border-red-500]=\"\r\n isActiveOption(option) && isSeverity(option, 'danger')\r\n \"\r\n [class.text-red-600]=\"isSeverity(option, 'danger')\"\r\n [class.border-purple-500]=\"\r\n isActiveOption(option) && isSeverity(option, 'help')\r\n \"\r\n [class.text-purple-600]=\"isSeverity(option, 'help')\"\r\n [class.border-zinc-700]=\"\r\n isActiveOption(option) && isSeverity(option, 'contrast')\r\n \"\r\n [class.text-zinc-800]=\"isSeverity(option, 'contrast')\"\r\n [class.font-semibold]=\"isActiveOption(option)\"\r\n [class.border-transparent]=\"!isActiveOption(option)\"\r\n [class.text-surface-700]=\"\r\n !isActiveOption(option) && !hasNonPrimarySeverity(option)\r\n \"\r\n [class.font-medium]=\"!isActiveOption(option)\"\r\n [class.hover:text-primary-600]=\"\r\n !isActiveOption(option) &&\r\n !hasNonPrimarySeverity(option) &&\r\n !(disabled() || isOptionDisabled(option))\r\n \"\r\n [class.hover:text-slate-700]=\"\r\n !isActiveOption(option) && isSeverity(option, 'secondary')\r\n \"\r\n [class.hover:text-emerald-700]=\"\r\n !isActiveOption(option) && isSeverity(option, 'success')\r\n \"\r\n [class.hover:text-sky-700]=\"\r\n !isActiveOption(option) && isSeverity(option, 'info')\r\n \"\r\n [class.hover:text-amber-800]=\"\r\n !isActiveOption(option) && isSeverity(option, 'warn')\r\n \"\r\n [class.hover:text-red-700]=\"\r\n !isActiveOption(option) && isSeverity(option, 'danger')\r\n \"\r\n [class.hover:text-purple-700]=\"\r\n !isActiveOption(option) && isSeverity(option, 'help')\r\n \"\r\n [class.hover:text-zinc-900]=\"\r\n !isActiveOption(option) && isSeverity(option, 'contrast')\r\n \"\r\n [class.cursor-pointer]=\"!(disabled() || isOptionDisabled(option))\"\r\n [class.cursor-not-allowed]=\"disabled() || isOptionDisabled(option)\"\r\n [class.opacity-60]=\"disabled() || isOptionDisabled(option)\"\r\n (click)=\"onOptionSelect(option)\"\r\n >\r\n @if (resolveIcon(option); as icon) {\r\n <mt-icon [icon]=\"icon\" class=\"text-base\" />\r\n }\r\n\r\n <span class=\"truncate\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"tabLabel\"\r\n [ngTemplateOutletContext]=\"{ $implicit: option }\"\r\n />\r\n </span>\r\n\r\n @if (hasCountBadge(option)) {\r\n <span\r\n class=\"inline-grid min-w-[18px] place-items-center rounded-full px-1.5 text-[10px] leading-4 font-bold tabular-nums\"\r\n [class.bg-primary-50]=\"isSeverity(option, 'primary')\"\r\n [class.text-primary-700]=\"isSeverity(option, 'primary')\"\r\n [class.bg-slate-100]=\"isSeverity(option, 'secondary')\"\r\n [class.text-slate-700]=\"isSeverity(option, 'secondary')\"\r\n [class.bg-emerald-50]=\"isSeverity(option, 'success')\"\r\n [class.text-emerald-700]=\"isSeverity(option, 'success')\"\r\n [class.bg-sky-50]=\"isSeverity(option, 'info')\"\r\n [class.text-sky-700]=\"isSeverity(option, 'info')\"\r\n [class.bg-amber-50]=\"isSeverity(option, 'warn')\"\r\n [class.text-amber-800]=\"isSeverity(option, 'warn')\"\r\n [class.bg-red-50]=\"isSeverity(option, 'danger')\"\r\n [class.text-red-700]=\"isSeverity(option, 'danger')\"\r\n [class.bg-purple-50]=\"isSeverity(option, 'help')\"\r\n [class.text-purple-700]=\"isSeverity(option, 'help')\"\r\n [class.bg-zinc-100]=\"isSeverity(option, 'contrast')\"\r\n [class.text-zinc-800]=\"isSeverity(option, 'contrast')\"\r\n [class.bg-surface-100]=\"\r\n !isActiveOption(option) && !hasNonPrimarySeverity(option)\r\n \"\r\n [class.text-surface-500]=\"\r\n !isActiveOption(option) && !hasNonPrimarySeverity(option)\r\n \"\r\n >\r\n {{ resolveBadge(option) }}\r\n </span>\r\n }\r\n </button>\r\n }\r\n </div>\r\n\r\n @if (hasOverflow()) {\r\n <div\r\n class=\"flex shrink-0 items-center -mb-px border-b border-surface-200 pb-1\"\r\n >\r\n <mt-button\r\n icon=\"arrow.chevron-down\"\r\n [label]=\"moreLabel()\"\r\n size=\"small\"\r\n severity=\"primary\"\r\n [text]=\"true\"\r\n [rounded]=\"true\"\r\n (onClick)=\"morePopover.toggle($event)\"\r\n />\r\n <p-popover\r\n #morePopover\r\n appendTo=\"body\"\r\n (onHide)=\"onOverflowPopoverHide()\"\r\n >\r\n <div class=\"flex min-w-56 flex-col\">\r\n @if (showOverflowSearch()) {\r\n <div class=\"border-b border-surface-200 p-2\">\r\n <p-iconfield iconPosition=\"left\">\r\n <p-inputicon>\r\n <mt-icon icon=\"general.search-md\" />\r\n </p-inputicon>\r\n <input\r\n pInputText\r\n type=\"text\"\r\n [value]=\"searchTerm()\"\r\n (input)=\"onOverflowSearch($any($event.target).value)\"\r\n [placeholder]=\"'components.tabs.search' | transloco\"\r\n class=\"w-full\"\r\n />\r\n </p-iconfield>\r\n </div>\r\n }\r\n <div\r\n class=\"flex max-h-80 flex-col divide-y divide-surface-100 overflow-y-auto\"\r\n >\r\n @for (\r\n option of filteredOverflowOptions();\r\n track trackOption(option, $index)\r\n ) {\r\n <button\r\n type=\"button\"\r\n class=\"flex w-full cursor-pointer items-center justify-start gap-2 px-2 py-1 text-start text-sm transition-colors [&_.p-avatar]:h-7 [&_.p-avatar]:w-7 [&_.p-avatar]:text-sm\"\r\n [class.bg-primary-50]=\"\r\n isActiveOption(option) && isSeverity(option, 'primary')\r\n \"\r\n [class.text-primary]=\"\r\n isActiveOption(option) && isSeverity(option, 'primary')\r\n \"\r\n [class.bg-slate-50]=\"\r\n isActiveOption(option) && isSeverity(option, 'secondary')\r\n \"\r\n [class.text-slate-600]=\"isSeverity(option, 'secondary')\"\r\n [class.bg-emerald-50]=\"\r\n isActiveOption(option) && isSeverity(option, 'success')\r\n \"\r\n [class.text-emerald-600]=\"isSeverity(option, 'success')\"\r\n [class.bg-sky-50]=\"\r\n isActiveOption(option) && isSeverity(option, 'info')\r\n \"\r\n [class.text-sky-600]=\"isSeverity(option, 'info')\"\r\n [class.bg-amber-50]=\"\r\n isActiveOption(option) && isSeverity(option, 'warn')\r\n \"\r\n [class.text-amber-700]=\"isSeverity(option, 'warn')\"\r\n [class.bg-red-50]=\"\r\n isActiveOption(option) && isSeverity(option, 'danger')\r\n \"\r\n [class.text-red-600]=\"isSeverity(option, 'danger')\"\r\n [class.bg-purple-50]=\"\r\n isActiveOption(option) && isSeverity(option, 'help')\r\n \"\r\n [class.text-purple-600]=\"isSeverity(option, 'help')\"\r\n [class.bg-zinc-100]=\"\r\n isActiveOption(option) && isSeverity(option, 'contrast')\r\n \"\r\n [class.text-zinc-800]=\"isSeverity(option, 'contrast')\"\r\n [class.font-semibold]=\"isActiveOption(option)\"\r\n [class.text-surface-700]=\"\r\n !isActiveOption(option) && !hasNonPrimarySeverity(option)\r\n \"\r\n [class.hover:bg-surface-100]=\"!isActiveOption(option)\"\r\n [class.cursor-not-allowed]=\"\r\n disabled() || isOptionDisabled(option)\r\n \"\r\n [class.opacity-60]=\"disabled() || isOptionDisabled(option)\"\r\n [disabled]=\"disabled() || isOptionDisabled(option)\"\r\n (click)=\"onOptionSelect(option); morePopover.hide()\"\r\n >\r\n <mt-avatar\r\n [icon]=\"resolveIconOrDefault(option)\"\r\n size=\"normal\"\r\n shape=\"circle\"\r\n styleClass=\"!bg-surface-100 !text-surface-600\"\r\n />\r\n <span class=\"flex-1 truncate text-start\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"tabLabel\"\r\n [ngTemplateOutletContext]=\"{ $implicit: option }\"\r\n />\r\n </span>\r\n @if (hasCountBadge(option)) {\r\n <span\r\n class=\"inline-grid min-w-[18px] place-items-center rounded-full px-1.5 text-[10px] leading-4 font-bold tabular-nums\"\r\n [class.bg-primary-100]=\"isSeverity(option, 'primary')\"\r\n [class.text-primary-700]=\"isSeverity(option, 'primary')\"\r\n [class.bg-slate-100]=\"isSeverity(option, 'secondary')\"\r\n [class.text-slate-700]=\"isSeverity(option, 'secondary')\"\r\n [class.bg-emerald-50]=\"isSeverity(option, 'success')\"\r\n [class.text-emerald-700]=\"isSeverity(option, 'success')\"\r\n [class.bg-sky-50]=\"isSeverity(option, 'info')\"\r\n [class.text-sky-700]=\"isSeverity(option, 'info')\"\r\n [class.bg-amber-50]=\"isSeverity(option, 'warn')\"\r\n [class.text-amber-800]=\"isSeverity(option, 'warn')\"\r\n [class.bg-red-50]=\"isSeverity(option, 'danger')\"\r\n [class.text-red-700]=\"isSeverity(option, 'danger')\"\r\n [class.bg-purple-50]=\"isSeverity(option, 'help')\"\r\n [class.text-purple-700]=\"isSeverity(option, 'help')\"\r\n [class.bg-zinc-100]=\"isSeverity(option, 'contrast')\"\r\n [class.text-zinc-800]=\"isSeverity(option, 'contrast')\"\r\n [class.bg-surface-100]=\"\r\n !isActiveOption(option) &&\r\n !hasNonPrimarySeverity(option)\r\n \"\r\n [class.text-surface-500]=\"\r\n !isActiveOption(option) &&\r\n !hasNonPrimarySeverity(option)\r\n \"\r\n >\r\n {{ resolveBadge(option) }}\r\n </span>\r\n }\r\n </button>\r\n } @empty {\r\n <div class=\"px-3 py-4 text-center text-sm text-surface-500\">\r\n {{ \"components.tabs.no-results\" | transloco }}\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n </p-popover>\r\n </div>\r\n }\r\n </div>\r\n} @else {\r\n <p-selectbutton\r\n [options]=\"options()\"\r\n [(ngModel)]=\"active\"\r\n (ngModelChange)=\"onTabChange($event)\"\r\n [optionLabel]=\"optionLabel()\"\r\n [optionValue]=\"optionValue()\"\r\n styleClass=\"my-tabs-button\"\r\n [size]=\"size()\"\r\n [fluid]=\"fluid()\"\r\n [disabled]=\"disabled()\"\r\n unselectable\r\n >\r\n <ng-template #item let-option>\r\n <span class=\"inline-flex min-w-0 items-center gap-1.5\">\r\n <span class=\"truncate\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"tabLabel\"\r\n [ngTemplateOutletContext]=\"{ $implicit: option }\"\r\n />\r\n </span>\r\n\r\n @if (hasBadge(option)) {\r\n <span\r\n class=\"relative z-10 min-w-5 ms-auto inline-flex items-center justify-center rounded-full p-1 text-xs leading-none\"\r\n [class.bg-primary]=\"isActiveOption(option)\"\r\n [class.text-white]=\"isActiveOption(option)\"\r\n [class.bg-surface-100]=\"!isActiveOption(option)\"\r\n [class.text-surface-600]=\"!isActiveOption(option)\"\r\n >\r\n {{ resolveBadge(option) }}\r\n </span>\r\n }\r\n </span>\r\n </ng-template>\r\n </p-selectbutton>\r\n}\r\n\r\n<!-- Shared label slot. A tab whose title is still being resolved by the host\r\n (`option.loading`) renders a placeholder bar instead of a stand-in name;\r\n the real label stays in the accessibility tree throughout. -->\r\n<ng-template #tabLabel let-option>\r\n @if (isOptionLoading(option)) {\r\n <span class=\"sr-only\">{{ resolveLabel(option) }}</span>\r\n <span\r\n aria-hidden=\"true\"\r\n class=\"inline-block h-3 w-20 max-w-full animate-pulse rounded bg-surface-200 align-middle\"\r\n ></span>\r\n } @else {\r\n {{ resolveLabel(option) }}\r\n }\r\n</ng-template>\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;MA0Fa,IAAI,CAAA;AACE,IAAA,SAAS,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACrD,IAAA,OAAO,GAAG,KAAK,CAAe,EAAE,8EAAC;AACjC,IAAA,WAAW,GAAG,KAAK,CAAS,OAAO,kFAAC;AACpC,IAAA,WAAW,GAAG,KAAK,CAAS,OAAO,kFAAC;AACpC,IAAA,MAAM,GAAG,KAAK,CAAM,IAAI,6EAAC;AAChB,IAAA,IAAI,GAAG,KAAK,CAA0C,YAAY,2EAAC;AACnE,IAAA,SAAS,GAAG,KAAK,CACxB,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,sBAAsB,CAAC,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,WAAA,EAAA,CAAA,8BA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f,eAAe;wBACf,aAAa;qBACd,EAAA,IAAA,EAGK;AACJ,wBAAA,KAAK,EAAE,oBAAoB;AAC3B,wBAAA,gBAAgB,EAAE,SAAS;AAC5B,qBAAA,EAAA,QAAA,EAAA,8hmBAAA,EAAA,MAAA,EAAA,CAAA,sBAAA,CAAA,EAAA;+nCA0BoC,eAAe,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,UAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,SAAA,EAAA,IAAA,EAAA,CAEf,YAAY,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,WAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,SAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,UAAA,CAAA,MACR,OAAO,CAAA,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AErHlD;;AAEG;;;;"}
1
+ {"version":3,"file":"masterteam-components-tabs.mjs","sources":["../../../../packages/masterteam/components/tabs/tabs.ts","../../../../packages/masterteam/components/tabs/tabs.html","../../../../packages/masterteam/components/tabs/masterteam-components-tabs.ts"],"sourcesContent":["import {\r\n afterNextRender,\r\n booleanAttribute,\r\n Component,\r\n computed,\r\n DestroyRef,\r\n effect,\r\n ElementRef,\r\n inject,\r\n input,\r\n model,\r\n output,\r\n signal,\r\n viewChild,\r\n} from '@angular/core';\r\nimport { NgTemplateOutlet } from '@angular/common';\r\nimport { FormsModule } from '@angular/forms';\r\nimport { TranslocoPipe, TranslocoService } from '@jsverse/transloco';\r\nimport { MTIcon, Icon } from '@masterteam/icons';\r\nimport { SelectButton } from 'primeng/selectbutton';\r\nimport { Popover } from 'primeng/popover';\r\nimport { InputTextModule } from 'primeng/inputtext';\r\nimport { IconFieldModule } from 'primeng/iconfield';\r\nimport { InputIconModule } from 'primeng/inputicon';\r\nimport { Button } from '@masterteam/components/button';\r\nimport { Avatar } from '@masterteam/components/avatar';\r\n\r\n/** Horizontal gap between tabs — `gap-0.5`, in pixels. */\r\nconst GAP = 2;\r\n\r\n/** Width assumed for the more block on the one pass before it has rendered. */\r\nconst MORE_BLOCK_FALLBACK = 96;\r\n\r\nexport type TabSeverity =\r\n | 'primary'\r\n | 'secondary'\r\n | 'success'\r\n | 'info'\r\n | 'warn'\r\n | 'warning'\r\n | 'danger'\r\n | 'error'\r\n | 'help'\r\n | 'contrast';\r\n\r\nexport interface OptionItem {\r\n label?: string;\r\n value?: any;\r\n icon?: MTIcon | null;\r\n badge?: number | string | null;\r\n severity?: TabSeverity | null;\r\n disabled?: boolean;\r\n /**\r\n * The host is still resolving this tab's title — typically it names a record\r\n * that is being fetched. The label slot renders a placeholder instead of the\r\n * text, so the tab never flashes a stand-in name before the real one lands.\r\n * Keep supplying the fallback `label`: it stays the accessible name and is\r\n * still what the \"more\" search matches against.\r\n */\r\n loading?: boolean;\r\n [key: string]: unknown;\r\n}\r\n\r\ntype NormalizedTabSeverity =\r\n | 'primary'\r\n | 'secondary'\r\n | 'success'\r\n | 'info'\r\n | 'warn'\r\n | 'danger'\r\n | 'help'\r\n | 'contrast';\r\n\r\n@Component({\r\n selector: 'mt-tabs',\r\n standalone: true,\r\n imports: [\r\n Icon,\r\n NgTemplateOutlet,\r\n SelectButton,\r\n FormsModule,\r\n Button,\r\n Popover,\r\n Avatar,\r\n InputTextModule,\r\n IconFieldModule,\r\n InputIconModule,\r\n TranslocoPipe,\r\n ],\r\n templateUrl: './tabs.html',\r\n styleUrls: ['./tabs.scss'],\r\n host: {\r\n class: 'grid min-w-0 gap-1',\r\n '[class.w-full]': 'fluid()',\r\n },\r\n})\r\nexport class Tabs {\r\n private readonly transloco = inject(TranslocoService);\r\n options = input<OptionItem[]>([]);\r\n optionLabel = input<string>('label');\r\n optionValue = input<string>('value');\r\n active = model<any>(null);\r\n readonly mode = input<'horizontal' | 'vertical' | 'underline'>('horizontal');\r\n readonly moreLabel = input<string>(\r\n this.transloco.translate('components.tabs.more'),\r\n );\r\n readonly defaultIcon = input<MTIcon>('layout.align-left-02');\r\n\r\n onChange = output<any>();\r\n\r\n readonly size = input<'small' | 'large' | undefined>();\r\n readonly fluid = input<boolean, unknown>(false, {\r\n transform: booleanAttribute,\r\n });\r\n disabled = input<boolean, unknown>(false, {\r\n transform: booleanAttribute,\r\n });\r\n\r\n private readonly destroyRef = inject(DestroyRef);\r\n private readonly tabsContainer =\r\n viewChild<ElementRef<HTMLElement>>('tabsContainer');\r\n private readonly measureRow =\r\n viewChild<ElementRef<HTMLElement>>('measureRow');\r\n private readonly morePopover = viewChild(Popover);\r\n private readonly moreBlock = viewChild<ElementRef<HTMLElement>>('moreBlock');\r\n private resizeObserver?: ResizeObserver;\r\n private measureHandle = 0;\r\n private alignHandle = 0;\r\n /** Last real width of the more block; 0 until it has been rendered once. */\r\n private moreWidth = 0;\r\n\r\n readonly visibleCount = signal<number>(Number.MAX_SAFE_INTEGER);\r\n\r\n /** Natural width of every option, in order, from the measurement ghost row. */\r\n private readonly tabWidths = signal<number[]>([]);\r\n /** Room the visible row actually has, once the more button is accounted for. */\r\n private readonly availableWidth = signal<number>(0);\r\n\r\n private readonly activeIndex = computed(() =>\r\n this.options().findIndex((option) => this.isActiveOption(option)),\r\n );\r\n\r\n /**\r\n * The tabs the strip shows — the widest prefix that fits, plus the active tab\r\n * if that prefix would have hidden it.\r\n *\r\n * Without the second half, selecting a tab from the more menu left the strip\r\n * with nothing selected at all: no underline, and no `aria-selected` on any\r\n * tab, so neither a sighted user nor a screen reader could tell where they\r\n * were. A project exposes twenty-three tabs and ten of them sit in the menu,\r\n * so this is the normal case for a third of the product, not an edge.\r\n *\r\n * The active tab is appended rather than swapped in, which keeps the row in\r\n * the options' own order: everything in the prefix precedes it already.\r\n * Trailing tabs are dropped until it genuinely fits, using the same measured\r\n * widths the prefix was chosen with, so pinning never pushes the row wider\r\n * than the space it was measured against.\r\n */\r\n readonly visibleOptions = computed(() => {\r\n const options = this.options();\r\n const head = options.slice(0, this.visibleCount());\r\n\r\n const activeIndex = this.activeIndex();\r\n if (activeIndex < 0 || activeIndex < head.length) {\r\n return head;\r\n }\r\n\r\n const widths = this.tabWidths();\r\n const budget = this.availableWidth();\r\n const activeWidth = widths[activeIndex] ?? 0;\r\n\r\n const kept = [...head];\r\n let used = kept.reduce(\r\n (total, _, index) => total + (widths[index] ?? 0) + (index > 0 ? GAP : 0),\r\n 0,\r\n );\r\n while (kept.length && used + GAP + activeWidth > budget) {\r\n const last = kept.length - 1;\r\n used -= (widths[last] ?? 0) + (last > 0 ? GAP : 0);\r\n kept.pop();\r\n }\r\n\r\n return [...kept, options[activeIndex]];\r\n });\r\n\r\n readonly overflowOptions = computed(() => {\r\n const visible = new Set<OptionItem>(this.visibleOptions());\r\n return this.options().filter((option) => !visible.has(option));\r\n });\r\n readonly hasOverflow = computed(() => this.overflowOptions().length > 0);\r\n\r\n readonly searchThreshold = input<number>(8);\r\n readonly searchTerm = signal<string>('');\r\n readonly showOverflowSearch = computed(\r\n () => this.overflowOptions().length >= this.searchThreshold(),\r\n );\r\n readonly filteredOverflowOptions = computed(() => {\r\n const term = this.searchTerm().trim().toLowerCase();\r\n if (!term) return this.overflowOptions();\r\n return this.overflowOptions().filter((option) =>\r\n this.resolveLabel(option).toLowerCase().includes(term),\r\n );\r\n });\r\n\r\n constructor() {\r\n effect(() => {\r\n const options = this.options();\r\n const active = this.active();\r\n if (!options.length) {\r\n return;\r\n }\r\n\r\n const hasActiveOption = options.some((option) =>\r\n Object.is(this.resolveValue(option), active),\r\n );\r\n if (!hasActiveOption) {\r\n this.active.set(this.resolveValue(options[0]));\r\n }\r\n });\r\n\r\n afterNextRender(() => {\r\n if (this.mode() !== 'underline') return;\r\n this.setupResizeObserver();\r\n this.scheduleMeasure();\r\n });\r\n\r\n effect(() => {\r\n // Re-measure when options or mode change.\r\n this.options();\r\n if (this.mode() !== 'underline') return;\r\n this.scheduleMeasure();\r\n });\r\n\r\n this.destroyRef.onDestroy(() => {\r\n this.resizeObserver?.disconnect();\r\n if (this.measureHandle) {\r\n cancelAnimationFrame(this.measureHandle);\r\n }\r\n if (this.alignHandle) {\r\n cancelAnimationFrame(this.alignHandle);\r\n }\r\n });\r\n }\r\n\r\n private setupResizeObserver(): void {\r\n const container = this.tabsContainer()?.nativeElement;\r\n if (!container || typeof ResizeObserver === 'undefined') return;\r\n\r\n this.resizeObserver = new ResizeObserver(() => this.scheduleMeasure());\r\n this.resizeObserver.observe(container);\r\n }\r\n\r\n private scheduleMeasure(): void {\r\n if (this.measureHandle) {\r\n cancelAnimationFrame(this.measureHandle);\r\n }\r\n this.measureHandle = requestAnimationFrame(() => {\r\n this.measureHandle = 0;\r\n this.measureAndUpdate();\r\n });\r\n }\r\n\r\n private measureAndUpdate(): void {\r\n const container = this.tabsContainer()?.nativeElement;\r\n const measureRow = this.measureRow()?.nativeElement;\r\n if (!container || !measureRow) return;\r\n\r\n const optionsCount = this.options().length;\r\n if (optionsCount === 0) {\r\n this.visibleCount.set(0);\r\n return;\r\n }\r\n\r\n if (container.clientWidth === 0) return;\r\n\r\n // Inner width excludes the container's horizontal padding so we compare\r\n // against the actual space available to the flex tabs row.\r\n const style = getComputedStyle(container);\r\n const paddingX =\r\n (parseFloat(style.paddingLeft) || 0) +\r\n (parseFloat(style.paddingRight) || 0);\r\n const innerWidth = container.clientWidth - paddingX;\r\n if (innerWidth <= 0) return;\r\n\r\n const tabWidths = Array.from(measureRow.children).map(\r\n (el) => (el as HTMLElement).getBoundingClientRect().width,\r\n );\r\n\r\n if (tabWidths.length === 0) return;\r\n\r\n this.tabWidths.set(tabWidths);\r\n\r\n const totalWidth =\r\n tabWidths.reduce((sum, width) => sum + width, 0) +\r\n Math.max(0, tabWidths.length - 1) * GAP;\r\n\r\n // Everything fits — no more button needed.\r\n if (totalWidth <= innerWidth) {\r\n this.availableWidth.set(innerWidth);\r\n this.visibleCount.set(tabWidths.length);\r\n return;\r\n }\r\n\r\n // Reserve space for the more block. Measure it rather than assume: its\r\n // label is translated and it carries a count, so the old fixed 96px guess\r\n // ran narrow and let the row overflow the space it was measured against.\r\n // The block only exists once there IS overflow, so the first pass has to\r\n // fall back to the guess and re-measure as soon as the real one renders.\r\n const renderedMore = this.moreBlock()?.nativeElement.offsetWidth ?? 0;\r\n if (renderedMore > 0) {\r\n this.moreWidth = renderedMore;\r\n }\r\n const available = innerWidth - (this.moreWidth || MORE_BLOCK_FALLBACK);\r\n this.availableWidth.set(available);\r\n\r\n let cumulative = 0;\r\n let visibleCount = 0;\r\n for (let i = 0; i < tabWidths.length; i++) {\r\n const next = cumulative + tabWidths[i] + (i > 0 ? GAP : 0);\r\n if (next > available) break;\r\n cumulative = next;\r\n visibleCount++;\r\n }\r\n\r\n this.visibleCount.set(Math.max(1, visibleCount));\r\n\r\n if (!this.moreWidth) {\r\n // Second and final pass, now that the block it reserved room for exists.\r\n this.scheduleMeasure();\r\n }\r\n }\r\n\r\n onTabChange(value: any) {\r\n this.onChange.emit(value);\r\n }\r\n\r\n onOverflowSearch(value: string): void {\r\n this.searchTerm.set(value ?? '');\r\n // Filtering shrinks/grows the popover content, but PrimeNG only positions\r\n // the popover on show. Re-align after the filtered list re-renders so a\r\n // popover opened above the trigger stays attached instead of overlapping.\r\n this.scheduleOverflowAlign();\r\n }\r\n\r\n private scheduleOverflowAlign(): void {\r\n if (this.alignHandle) {\r\n cancelAnimationFrame(this.alignHandle);\r\n }\r\n this.alignHandle = requestAnimationFrame(() => {\r\n this.alignHandle = 0;\r\n const popover = this.morePopover();\r\n if (!popover?.overlayVisible) return;\r\n\r\n // Clear the stale flip marker so align() recomputes the arrow direction\r\n // for the new height instead of keeping the previous \"above\" state.\r\n const container = popover.container;\r\n if (container) {\r\n container.removeAttribute('data-p-popover-flipped');\r\n container.classList.remove('p-popover-flipped');\r\n }\r\n popover.align();\r\n });\r\n }\r\n\r\n onOverflowPopoverHide(): void {\r\n this.searchTerm.set('');\r\n }\r\n\r\n onOptionSelect(option: OptionItem): void {\r\n if (this.disabled() || this.isOptionDisabled(option)) {\r\n return;\r\n }\r\n\r\n const value = this.resolveValue(option);\r\n this.active.set(value);\r\n this.onTabChange(value);\r\n }\r\n\r\n resolveLabel(option: OptionItem): string {\r\n const labelKey = this.optionLabel();\r\n const label =\r\n option && typeof option === 'object'\r\n ? (option as Record<string, unknown>)[labelKey]\r\n : option;\r\n\r\n return typeof label === 'string' ? label : String(label ?? '');\r\n }\r\n\r\n resolveValue(option: OptionItem): unknown {\r\n const valueKey = this.optionValue();\r\n if (option && typeof option === 'object' && valueKey in option) {\r\n return (option as Record<string, unknown>)[valueKey];\r\n }\r\n\r\n return option;\r\n }\r\n\r\n resolveIcon(option: OptionItem): MTIcon | null {\r\n return typeof option?.icon === 'string' ? option.icon : null;\r\n }\r\n\r\n resolveIconOrDefault(option: OptionItem): MTIcon {\r\n return this.resolveIcon(option) ?? this.defaultIcon();\r\n }\r\n\r\n resolveBadge(option: OptionItem): number | string | null {\r\n return option?.badge ?? null;\r\n }\r\n\r\n isOptionLoading(option: OptionItem): boolean {\r\n return option?.loading === true;\r\n }\r\n\r\n hasBadge(option: OptionItem): boolean {\r\n return option?.badge !== null && option?.badge !== undefined;\r\n }\r\n\r\n hasCountBadge(option: OptionItem): boolean {\r\n const badge = option?.badge;\r\n if (badge === null || badge === undefined || badge === '') {\r\n return false;\r\n }\r\n const numeric = typeof badge === 'number' ? badge : Number(badge);\r\n return Number.isNaN(numeric) ? true : numeric > 0;\r\n }\r\n\r\n severity(option: OptionItem): NormalizedTabSeverity {\r\n const severity =\r\n typeof option?.severity === 'string'\r\n ? option.severity.trim().toLowerCase()\r\n : '';\r\n if (severity === 'error') return 'danger';\r\n if (severity === 'warning') return 'warn';\r\n if (\r\n severity === 'secondary' ||\r\n severity === 'success' ||\r\n severity === 'info' ||\r\n severity === 'warn' ||\r\n severity === 'danger' ||\r\n severity === 'help' ||\r\n severity === 'contrast'\r\n ) {\r\n return severity;\r\n }\r\n\r\n return 'primary';\r\n }\r\n\r\n isSeverity(option: OptionItem, severity: NormalizedTabSeverity): boolean {\r\n return this.severity(option) === severity;\r\n }\r\n\r\n hasNonPrimarySeverity(option: OptionItem): boolean {\r\n return this.severity(option) !== 'primary';\r\n }\r\n\r\n isActiveOption(option: OptionItem): boolean {\r\n return Object.is(this.active(), this.resolveValue(option));\r\n }\r\n\r\n isOptionDisabled(option: OptionItem): boolean {\r\n return !!option?.disabled;\r\n }\r\n\r\n trackOption(option: OptionItem, index: number): unknown {\r\n return this.resolveValue(option) ?? index;\r\n }\r\n}\r\n","@if (mode() === \"vertical\") {\r\n <div\r\n class=\"flex min-h-0 flex-col gap-1 rounded-2xl border border-surface-200 bg-white p-2\"\r\n role=\"tablist\"\r\n aria-orientation=\"vertical\"\r\n >\r\n @for (option of options(); track trackOption(option, $index)) {\r\n <button\r\n type=\"button\"\r\n role=\"tab\"\r\n class=\"group relative flex w-full items-center gap-3 overflow-hidden rounded-lg px-3 py-2.5 text-start text-sm transition-colors duration-150 outline-none focus-visible:ring-2 focus-visible:ring-primary/20\"\r\n [attr.aria-selected]=\"isActiveOption(option)\"\r\n [attr.tabindex]=\"isActiveOption(option) ? 0 : -1\"\r\n [disabled]=\"disabled() || isOptionDisabled(option)\"\r\n [class.bg-primary-50]=\"isActiveOption(option)\"\r\n [class.font-semibold]=\"isActiveOption(option)\"\r\n [class.text-primary-700]=\"isActiveOption(option)\"\r\n [class.text-surface-500]=\"!isActiveOption(option)\"\r\n [class.hover:bg-surface-50]=\"!isActiveOption(option)\"\r\n [class.cursor-pointer]=\"!(disabled() || isOptionDisabled(option))\"\r\n [class.cursor-not-allowed]=\"disabled() || isOptionDisabled(option)\"\r\n [class.opacity-60]=\"disabled() || isOptionDisabled(option)\"\r\n (click)=\"onOptionSelect(option)\"\r\n >\r\n @if (resolveIcon(option); as icon) {\r\n <mt-icon\r\n [icon]=\"icon\"\r\n class=\"relative z-10 text-base\"\r\n [class.text-primary]=\"isActiveOption(option)\"\r\n [class.text-surface-400]=\"!isActiveOption(option)\"\r\n />\r\n }\r\n\r\n <span class=\"relative z-10 min-w-0 flex-1 truncate\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"tabLabel\"\r\n [ngTemplateOutletContext]=\"{ $implicit: option }\"\r\n />\r\n </span>\r\n\r\n @if (hasBadge(option)) {\r\n <span\r\n class=\"relative z-10 ms-auto inline-flex min-w-5 items-center justify-center rounded-full px-2 py-0.5 text-[11px] font-bold leading-none\"\r\n [class.bg-primary]=\"isActiveOption(option)\"\r\n [class.text-white]=\"isActiveOption(option)\"\r\n [class.bg-surface-100]=\"!isActiveOption(option)\"\r\n [class.text-surface-600]=\"!isActiveOption(option)\"\r\n >\r\n {{ resolveBadge(option) }}\r\n </span>\r\n }\r\n </button>\r\n }\r\n </div>\r\n} @else if (mode() === \"underline\") {\r\n <div\r\n #tabsContainer\r\n class=\"relative flex w-full min-w-0 max-w-full items-center gap-0.5 overflow-x-clip\"\r\n role=\"tablist\"\r\n aria-orientation=\"horizontal\"\r\n >\r\n <!-- Invisible measurement ghost row: always renders every option at natural width -->\r\n <div\r\n #measureRow\r\n aria-hidden=\"true\"\r\n class=\"pointer-events-none invisible absolute top-0 left-0 flex flex-nowrap gap-0.5 -z-10\"\r\n >\r\n @for (option of options(); track trackOption(option, $index)) {\r\n <span\r\n class=\"inline-flex items-center gap-1.5 border-b-2 border-transparent px-3.5 py-2.5 text-sm font-semibold whitespace-nowrap\"\r\n >\r\n @if (resolveIcon(option); as icon) {\r\n <mt-icon [icon]=\"icon\" class=\"text-base\" />\r\n }\r\n <span>\r\n <ng-container\r\n [ngTemplateOutlet]=\"tabLabel\"\r\n [ngTemplateOutletContext]=\"{ $implicit: option }\"\r\n />\r\n </span>\r\n @if (hasCountBadge(option)) {\r\n <span\r\n class=\"inline-grid min-w-[18px] place-items-center rounded-full px-1.5 text-[10px] leading-4 font-bold tabular-nums\"\r\n >\r\n {{ resolveBadge(option) }}\r\n </span>\r\n }\r\n </span>\r\n }\r\n </div>\r\n\r\n <!-- Visible tabs row -->\r\n <div\r\n class=\"flex min-w-0 flex-1 items-center gap-0.5 overflow-x-clip border-b border-surface-200\"\r\n >\r\n @for (option of visibleOptions(); track trackOption(option, $index)) {\r\n <button\r\n type=\"button\"\r\n role=\"tab\"\r\n class=\"-mb-px inline-flex shrink-0 items-center gap-1.5 border-b-2 px-3.5 py-2.5 text-sm whitespace-nowrap transition-colors duration-150 outline-none focus-visible:ring-2 focus-visible:ring-primary/20\"\r\n [attr.aria-selected]=\"isActiveOption(option)\"\r\n [attr.tabindex]=\"isActiveOption(option) ? 0 : -1\"\r\n [disabled]=\"disabled() || isOptionDisabled(option)\"\r\n [class.border-primary]=\"\r\n isActiveOption(option) && isSeverity(option, 'primary')\r\n \"\r\n [class.text-primary]=\"\r\n isActiveOption(option) && isSeverity(option, 'primary')\r\n \"\r\n [class.border-slate-500]=\"\r\n isActiveOption(option) && isSeverity(option, 'secondary')\r\n \"\r\n [class.text-slate-600]=\"isSeverity(option, 'secondary')\"\r\n [class.border-emerald-500]=\"\r\n isActiveOption(option) && isSeverity(option, 'success')\r\n \"\r\n [class.text-emerald-600]=\"isSeverity(option, 'success')\"\r\n [class.border-sky-500]=\"\r\n isActiveOption(option) && isSeverity(option, 'info')\r\n \"\r\n [class.text-sky-600]=\"isSeverity(option, 'info')\"\r\n [class.border-amber-500]=\"\r\n isActiveOption(option) && isSeverity(option, 'warn')\r\n \"\r\n [class.text-amber-700]=\"isSeverity(option, 'warn')\"\r\n [class.border-red-500]=\"\r\n isActiveOption(option) && isSeverity(option, 'danger')\r\n \"\r\n [class.text-red-600]=\"isSeverity(option, 'danger')\"\r\n [class.border-purple-500]=\"\r\n isActiveOption(option) && isSeverity(option, 'help')\r\n \"\r\n [class.text-purple-600]=\"isSeverity(option, 'help')\"\r\n [class.border-zinc-700]=\"\r\n isActiveOption(option) && isSeverity(option, 'contrast')\r\n \"\r\n [class.text-zinc-800]=\"isSeverity(option, 'contrast')\"\r\n [class.font-semibold]=\"isActiveOption(option)\"\r\n [class.border-transparent]=\"!isActiveOption(option)\"\r\n [class.text-surface-700]=\"\r\n !isActiveOption(option) && !hasNonPrimarySeverity(option)\r\n \"\r\n [class.font-medium]=\"!isActiveOption(option)\"\r\n [class.hover:text-primary-600]=\"\r\n !isActiveOption(option) &&\r\n !hasNonPrimarySeverity(option) &&\r\n !(disabled() || isOptionDisabled(option))\r\n \"\r\n [class.hover:text-slate-700]=\"\r\n !isActiveOption(option) && isSeverity(option, 'secondary')\r\n \"\r\n [class.hover:text-emerald-700]=\"\r\n !isActiveOption(option) && isSeverity(option, 'success')\r\n \"\r\n [class.hover:text-sky-700]=\"\r\n !isActiveOption(option) && isSeverity(option, 'info')\r\n \"\r\n [class.hover:text-amber-800]=\"\r\n !isActiveOption(option) && isSeverity(option, 'warn')\r\n \"\r\n [class.hover:text-red-700]=\"\r\n !isActiveOption(option) && isSeverity(option, 'danger')\r\n \"\r\n [class.hover:text-purple-700]=\"\r\n !isActiveOption(option) && isSeverity(option, 'help')\r\n \"\r\n [class.hover:text-zinc-900]=\"\r\n !isActiveOption(option) && isSeverity(option, 'contrast')\r\n \"\r\n [class.cursor-pointer]=\"!(disabled() || isOptionDisabled(option))\"\r\n [class.cursor-not-allowed]=\"disabled() || isOptionDisabled(option)\"\r\n [class.opacity-60]=\"disabled() || isOptionDisabled(option)\"\r\n (click)=\"onOptionSelect(option)\"\r\n >\r\n @if (resolveIcon(option); as icon) {\r\n <mt-icon [icon]=\"icon\" class=\"text-base\" />\r\n }\r\n\r\n <span class=\"truncate\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"tabLabel\"\r\n [ngTemplateOutletContext]=\"{ $implicit: option }\"\r\n />\r\n </span>\r\n\r\n @if (hasCountBadge(option)) {\r\n <span\r\n class=\"inline-grid min-w-[18px] place-items-center rounded-full px-1.5 text-[10px] leading-4 font-bold tabular-nums\"\r\n [class.bg-primary-50]=\"isSeverity(option, 'primary')\"\r\n [class.text-primary-700]=\"isSeverity(option, 'primary')\"\r\n [class.bg-slate-100]=\"isSeverity(option, 'secondary')\"\r\n [class.text-slate-700]=\"isSeverity(option, 'secondary')\"\r\n [class.bg-emerald-50]=\"isSeverity(option, 'success')\"\r\n [class.text-emerald-700]=\"isSeverity(option, 'success')\"\r\n [class.bg-sky-50]=\"isSeverity(option, 'info')\"\r\n [class.text-sky-700]=\"isSeverity(option, 'info')\"\r\n [class.bg-amber-50]=\"isSeverity(option, 'warn')\"\r\n [class.text-amber-800]=\"isSeverity(option, 'warn')\"\r\n [class.bg-red-50]=\"isSeverity(option, 'danger')\"\r\n [class.text-red-700]=\"isSeverity(option, 'danger')\"\r\n [class.bg-purple-50]=\"isSeverity(option, 'help')\"\r\n [class.text-purple-700]=\"isSeverity(option, 'help')\"\r\n [class.bg-zinc-100]=\"isSeverity(option, 'contrast')\"\r\n [class.text-zinc-800]=\"isSeverity(option, 'contrast')\"\r\n [class.bg-surface-100]=\"\r\n !isActiveOption(option) && !hasNonPrimarySeverity(option)\r\n \"\r\n [class.text-surface-500]=\"\r\n !isActiveOption(option) && !hasNonPrimarySeverity(option)\r\n \"\r\n >\r\n {{ resolveBadge(option) }}\r\n </span>\r\n }\r\n </button>\r\n }\r\n </div>\r\n\r\n @if (hasOverflow()) {\r\n <div\r\n #moreBlock\r\n class=\"flex shrink-0 items-center -mb-px border-b border-surface-200 pb-1\"\r\n >\r\n <!--\r\n The count is the only thing on the strip that says how much is behind\r\n this button. A project hides ten of its twenty-three tabs here, and an\r\n unqualified \"More\" reads as an afterthought rather than as a third of\r\n the workspace.\r\n -->\r\n <mt-button\r\n icon=\"arrow.chevron-down\"\r\n [label]=\"moreLabel()\"\r\n [badge]=\"overflowOptions().length.toString()\"\r\n size=\"small\"\r\n severity=\"primary\"\r\n [text]=\"true\"\r\n [rounded]=\"true\"\r\n (onClick)=\"morePopover.toggle($event)\"\r\n />\r\n <p-popover\r\n #morePopover\r\n appendTo=\"body\"\r\n (onHide)=\"onOverflowPopoverHide()\"\r\n >\r\n <div class=\"flex min-w-56 flex-col\">\r\n @if (showOverflowSearch()) {\r\n <div class=\"border-b border-surface-200 p-2\">\r\n <p-iconfield iconPosition=\"left\">\r\n <p-inputicon>\r\n <mt-icon icon=\"general.search-md\" />\r\n </p-inputicon>\r\n <input\r\n pInputText\r\n type=\"text\"\r\n [value]=\"searchTerm()\"\r\n (input)=\"onOverflowSearch($any($event.target).value)\"\r\n [placeholder]=\"'components.tabs.search' | transloco\"\r\n class=\"w-full\"\r\n />\r\n </p-iconfield>\r\n </div>\r\n }\r\n <div\r\n class=\"flex max-h-80 flex-col divide-y divide-surface-100 overflow-y-auto\"\r\n >\r\n @for (\r\n option of filteredOverflowOptions();\r\n track trackOption(option, $index)\r\n ) {\r\n <button\r\n type=\"button\"\r\n class=\"flex w-full cursor-pointer items-center justify-start gap-2 px-2 py-1 text-start text-sm transition-colors [&_.p-avatar]:h-7 [&_.p-avatar]:w-7 [&_.p-avatar]:text-sm\"\r\n [class.bg-primary-50]=\"\r\n isActiveOption(option) && isSeverity(option, 'primary')\r\n \"\r\n [class.text-primary]=\"\r\n isActiveOption(option) && isSeverity(option, 'primary')\r\n \"\r\n [class.bg-slate-50]=\"\r\n isActiveOption(option) && isSeverity(option, 'secondary')\r\n \"\r\n [class.text-slate-600]=\"isSeverity(option, 'secondary')\"\r\n [class.bg-emerald-50]=\"\r\n isActiveOption(option) && isSeverity(option, 'success')\r\n \"\r\n [class.text-emerald-600]=\"isSeverity(option, 'success')\"\r\n [class.bg-sky-50]=\"\r\n isActiveOption(option) && isSeverity(option, 'info')\r\n \"\r\n [class.text-sky-600]=\"isSeverity(option, 'info')\"\r\n [class.bg-amber-50]=\"\r\n isActiveOption(option) && isSeverity(option, 'warn')\r\n \"\r\n [class.text-amber-700]=\"isSeverity(option, 'warn')\"\r\n [class.bg-red-50]=\"\r\n isActiveOption(option) && isSeverity(option, 'danger')\r\n \"\r\n [class.text-red-600]=\"isSeverity(option, 'danger')\"\r\n [class.bg-purple-50]=\"\r\n isActiveOption(option) && isSeverity(option, 'help')\r\n \"\r\n [class.text-purple-600]=\"isSeverity(option, 'help')\"\r\n [class.bg-zinc-100]=\"\r\n isActiveOption(option) && isSeverity(option, 'contrast')\r\n \"\r\n [class.text-zinc-800]=\"isSeverity(option, 'contrast')\"\r\n [class.font-semibold]=\"isActiveOption(option)\"\r\n [class.text-surface-700]=\"\r\n !isActiveOption(option) && !hasNonPrimarySeverity(option)\r\n \"\r\n [class.hover:bg-surface-100]=\"!isActiveOption(option)\"\r\n [class.cursor-not-allowed]=\"\r\n disabled() || isOptionDisabled(option)\r\n \"\r\n [class.opacity-60]=\"disabled() || isOptionDisabled(option)\"\r\n [disabled]=\"disabled() || isOptionDisabled(option)\"\r\n (click)=\"onOptionSelect(option); morePopover.hide()\"\r\n >\r\n <mt-avatar\r\n [icon]=\"resolveIconOrDefault(option)\"\r\n size=\"normal\"\r\n shape=\"circle\"\r\n styleClass=\"!bg-surface-100 !text-surface-600\"\r\n />\r\n <span class=\"flex-1 truncate text-start\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"tabLabel\"\r\n [ngTemplateOutletContext]=\"{ $implicit: option }\"\r\n />\r\n </span>\r\n @if (hasCountBadge(option)) {\r\n <span\r\n class=\"inline-grid min-w-[18px] place-items-center rounded-full px-1.5 text-[10px] leading-4 font-bold tabular-nums\"\r\n [class.bg-primary-100]=\"isSeverity(option, 'primary')\"\r\n [class.text-primary-700]=\"isSeverity(option, 'primary')\"\r\n [class.bg-slate-100]=\"isSeverity(option, 'secondary')\"\r\n [class.text-slate-700]=\"isSeverity(option, 'secondary')\"\r\n [class.bg-emerald-50]=\"isSeverity(option, 'success')\"\r\n [class.text-emerald-700]=\"isSeverity(option, 'success')\"\r\n [class.bg-sky-50]=\"isSeverity(option, 'info')\"\r\n [class.text-sky-700]=\"isSeverity(option, 'info')\"\r\n [class.bg-amber-50]=\"isSeverity(option, 'warn')\"\r\n [class.text-amber-800]=\"isSeverity(option, 'warn')\"\r\n [class.bg-red-50]=\"isSeverity(option, 'danger')\"\r\n [class.text-red-700]=\"isSeverity(option, 'danger')\"\r\n [class.bg-purple-50]=\"isSeverity(option, 'help')\"\r\n [class.text-purple-700]=\"isSeverity(option, 'help')\"\r\n [class.bg-zinc-100]=\"isSeverity(option, 'contrast')\"\r\n [class.text-zinc-800]=\"isSeverity(option, 'contrast')\"\r\n [class.bg-surface-100]=\"\r\n !isActiveOption(option) &&\r\n !hasNonPrimarySeverity(option)\r\n \"\r\n [class.text-surface-500]=\"\r\n !isActiveOption(option) &&\r\n !hasNonPrimarySeverity(option)\r\n \"\r\n >\r\n {{ resolveBadge(option) }}\r\n </span>\r\n }\r\n </button>\r\n } @empty {\r\n <div class=\"px-3 py-4 text-center text-sm text-surface-500\">\r\n {{ \"components.tabs.no-results\" | transloco }}\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n </p-popover>\r\n </div>\r\n }\r\n </div>\r\n} @else {\r\n <p-selectbutton\r\n [options]=\"options()\"\r\n [(ngModel)]=\"active\"\r\n (ngModelChange)=\"onTabChange($event)\"\r\n [optionLabel]=\"optionLabel()\"\r\n [optionValue]=\"optionValue()\"\r\n styleClass=\"my-tabs-button\"\r\n [size]=\"size()\"\r\n [fluid]=\"fluid()\"\r\n [disabled]=\"disabled()\"\r\n unselectable\r\n >\r\n <ng-template #item let-option>\r\n <span class=\"inline-flex min-w-0 items-center gap-1.5\">\r\n <span class=\"truncate\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"tabLabel\"\r\n [ngTemplateOutletContext]=\"{ $implicit: option }\"\r\n />\r\n </span>\r\n\r\n @if (hasBadge(option)) {\r\n <span\r\n class=\"relative z-10 min-w-5 ms-auto inline-flex items-center justify-center rounded-full p-1 text-xs leading-none\"\r\n [class.bg-primary]=\"isActiveOption(option)\"\r\n [class.text-white]=\"isActiveOption(option)\"\r\n [class.bg-surface-100]=\"!isActiveOption(option)\"\r\n [class.text-surface-600]=\"!isActiveOption(option)\"\r\n >\r\n {{ resolveBadge(option) }}\r\n </span>\r\n }\r\n </span>\r\n </ng-template>\r\n </p-selectbutton>\r\n}\r\n\r\n<!-- Shared label slot. A tab whose title is still being resolved by the host\r\n (`option.loading`) renders a placeholder bar instead of a stand-in name;\r\n the real label stays in the accessibility tree throughout. -->\r\n<ng-template #tabLabel let-option>\r\n @if (isOptionLoading(option)) {\r\n <span class=\"sr-only\">{{ resolveLabel(option) }}</span>\r\n <span\r\n aria-hidden=\"true\"\r\n class=\"inline-block h-3 w-20 max-w-full animate-pulse rounded bg-surface-200 align-middle\"\r\n ></span>\r\n } @else {\r\n {{ resolveLabel(option) }}\r\n }\r\n</ng-template>\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AA2BA;AACA,MAAM,GAAG,GAAG,CAAC;AAEb;AACA,MAAM,mBAAmB,GAAG,EAAE;MAiEjB,IAAI,CAAA;AACE,IAAA,SAAS,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACrD,IAAA,OAAO,GAAG,KAAK,CAAe,EAAE,8EAAC;AACjC,IAAA,WAAW,GAAG,KAAK,CAAS,OAAO,kFAAC;AACpC,IAAA,WAAW,GAAG,KAAK,CAAS,OAAO,kFAAC;AACpC,IAAA,MAAM,GAAG,KAAK,CAAM,IAAI,6EAAC;AAChB,IAAA,IAAI,GAAG,KAAK,CAA0C,YAAY,2EAAC;AACnE,IAAA,SAAS,GAAG,KAAK,CACxB,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,sBAAsB,CAAC,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,WAAA,EAAA,CAAA,8BAAA,E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functions for brand display.
166
- */
167
- /**
168
- * Converts a hex color to a light shade (equivalent to primary-100 in Tailwind).
169
- * This creates a color with ~10% opacity or a very light tint by mixing with white.
170
- */
171
- function getLightColor(hexColor) {
172
- const hex = hexColor.replace('#', '');
173
- const r = parseInt(hex.substring(0, 2), 16);
174
- const g = parseInt(hex.substring(2, 4), 16);
175
- const b = parseInt(hex.substring(4, 6), 16);
176
- const lightR = Math.round(r * 0.1 + 255 * 0.9);
177
- const lightG = Math.round(g * 0.1 + 255 * 0.9);
178
- const lightB = Math.round(b * 0.1 + 255 * 0.9);
179
- return `#${lightR.toString(16).padStart(2, '0')}${lightG
180
- .toString(16)
181
- .padStart(2, '0')}${lightB.toString(16).padStart(2, '0')}`;
182
- }
183
- function getContrastColor(bgColor) {
184
- let r = 0, g = 0, b = 0;
185
- if (bgColor.startsWith('#')) {
186
- const hex = bgColor.slice(1);
187
- if (hex.length === 3) {
188
- r = parseInt(hex[0] + hex[0], 16);
189
- g = parseInt(hex[1] + hex[1], 16);
190
- b = parseInt(hex[2] + hex[2], 16);
191
- }
192
- else if (hex.length === 6) {
193
- r = parseInt(hex.slice(0, 2), 16);
194
- g = parseInt(hex.slice(2, 4), 16);
195
- b = parseInt(hex.slice(4, 6), 16);
196
- }
197
- }
198
- const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
199
- return luminance > 0.5 ? '' : '#ffffff';
200
- }
201
- /** Parses `#rgb` / `#rrggbb` into 0-255 channels. Null when unparseable. */
202
- function toRgb(hex) {
203
- const value = hex.trim().replace('#', '');
204
- const full = value.length === 3
205
- ? value
206
- .split('')
207
- .map((c) => c + c)
208
- .join('')
209
- : value;
210
- if (full.length !== 6 || !/^[0-9a-f]{6}$/i.test(full)) {
211
- return null;
212
- }
213
- return [
214
- parseInt(full.slice(0, 2), 16),
215
- parseInt(full.slice(2, 4), 16),
216
- parseInt(full.slice(4, 6), 16),
217
- ];
218
- }
219
- /**
220
- * WCAG 2.x relative luminance.
221
- *
222
- * Note this is NOT the 0.299/0.587/0.114 perceived-brightness formula used by
223
- * `getContrastColor` above — that one is fine for "is this light or dark?" but
224
- * it is not the definition a conformance ratio is measured against, so it
225
- * cannot be used to decide whether text passes AA.
226
- */
227
- function relativeLuminance(hex) {
228
- const rgb = toRgb(hex);
229
- if (!rgb) {
230
- return null;
231
- }
232
- const [r, g, b] = rgb.map((channel) => {
233
- const c = channel / 255;
234
- return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
235
- });
236
- return 0.2126 * r + 0.7152 * g + 0.0722 * b;
237
- }
238
- /** WCAG contrast ratio between two hex colours, 1–21. Null if either is bad. */
239
- function contrastRatio(foreground, background) {
240
- const l1 = relativeLuminance(foreground);
241
- const l2 = relativeLuminance(background);
242
- if (l1 === null || l2 === null) {
243
- return null;
244
- }
245
- return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
246
- }
247
- /** WCAG 1.4.3 Contrast Minimum, normal-size text. */
248
- const WCAG_AA_NORMAL_TEXT = 4.5;
249
- /**
250
- * The first shade at or below `preferred` on a generated ramp whose contrast
251
- * against `foreground` clears `minRatio`.
252
- *
253
- * This is how the brand colour stays fully tenant-configurable while the
254
- * primary button still passes AA (finding H-03). The shipped default
255
- * `#2AAEC0` gives white text 2.65:1 — the single most important control in the
256
- * product was the least legible one, and any tenant picking a light brand hit
257
- * the same wall. Rather than hardcode a darker teal, which fixes exactly one
258
- * tenant, we keep their hue and step down the ramp their own colour generated
259
- * until the text is readable.
260
- *
261
- * Returns `preferred` unchanged when it already passes, so a tenant whose brand
262
- * is dark enough sees no change at all. Returns the darkest available shade if
263
- * none passes — better to be as close as the palette allows than to give up.
264
- */
265
- function pickAccessibleShade(palette, preferred, foreground = '#ffffff', minRatio = WCAG_AA_NORMAL_TEXT) {
266
- const ladder = ['500', '600', '700', '800', '900'];
267
- const startIndex = ladder.indexOf(preferred);
268
- const candidates = startIndex >= 0 ? ladder.slice(startIndex) : ladder;
269
- let darkestAvailable = null;
270
- for (const step of candidates) {
271
- const shade = palette[step];
272
- if (!shade) {
273
- continue;
274
- }
275
- darkestAvailable = step;
276
- const ratio = contrastRatio(foreground, shade);
277
- if (ratio !== null && ratio >= minRatio) {
278
- return step;
279
- }
280
- }
281
- // Nothing on the ramp clears the threshold — return the darkest step the
282
- // palette actually has rather than one we already know fails. Falls back to
283
- // `preferred` only when the palette carried none of the ladder steps at all.
284
- return darkestAvailable ?? preferred;
285
- }
286
- /** Dark ink used when white text would not be legible on a status colour. */
287
- const READABLE_DARK_INK = '#1f2937';
288
- /**
289
- * Picks the more legible of white and a dark ink for text sitting on `bgColor`.
290
- *
291
- * Status and lookup colours come from a tenant's own catalog, so they can be
292
- * any hex at all — and the count badges on the Explore cards were painting
293
- * white on every one of them, which measured 2.59:1 at the low end (finding
294
- * H-03 / M-04). Rather than restrict what colours a tenant may choose, pick the
295
- * foreground that actually reads on the colour they chose.
296
- *
297
- * Measured with the WCAG relative-luminance ratio, not the perceived-brightness
298
- * shortcut in `getContrastColor`, because that shortcut is not the definition
299
- * conformance is judged against. Unparseable input falls back to white, which
300
- * is the behaviour every caller had before.
301
- */
302
- function readableTextOn(bgColor, dark = READABLE_DARK_INK, light = '#ffffff') {
303
- if (!bgColor) {
304
- return light;
305
- }
306
- const onLight = contrastRatio(light, bgColor);
307
- const onDark = contrastRatio(dark, bgColor);
308
- if (onLight === null || onDark === null) {
309
- return light;
310
- }
311
- return onDark > onLight ? dark : light;
312
- }
313
-
314
164
  /**
315
165
  * Masterteam Design System — raw palettes and scales.
316
166
  *
@@ -964,35 +814,11 @@ function getMTDesignIdentity() {
964
814
  function changePrimaryColor(color) {
965
815
  const isDS = activeDesignIdentity === 'experimental';
966
816
  const base = color || (isDS ? DS_DEFAULT_PRIMARY_COLOR : '#2AAEC0');
967
- const anchor = isDS ? '800' : '500';
968
- const palette = isDS
969
- ? generateTailwindPalette(base, '800')
970
- : generateTailwindPalette(base);
971
- const shade = accessiblePrimaryShade(palette, anchor);
972
817
  updatePreset({
973
818
  semantic: {
974
- primary: palette,
975
- colorScheme: {
976
- light: {
977
- // Re-resolve which step filled controls use, for THIS colour.
978
- //
979
- // The bootstrap preset picks the step from whatever colour the app
980
- // starts with, and a tenant's real brand arrives later — Brand
981
- // Settings pushes it through here. Without recomputing, the step
982
- // stayed the one chosen for the startup colour: the tenant's hue was
983
- // still honoured (the token is a `{primary.N}` reference, so it
984
- // follows the new ramp) but N was decided for a different colour, so
985
- // a light brand could still fail AA and a dark one could render
986
- // needlessly deep. Finding H-03 is only actually closed if this runs
987
- // on the colour the tenant configured.
988
- primary: {
989
- color: `{primary.${shade}}`,
990
- contrastColor: '#ffffff',
991
- hoverColor: `{primary.${shade}}`,
992
- activeColor: `{primary.${shade}}`,
993
- },
994
- },
995
- },
819
+ primary: isDS
820
+ ? generateTailwindPalette(base, '800')
821
+ : generateTailwindPalette(base),
996
822
  },
997
823
  });
998
824
  }
@@ -1028,29 +854,8 @@ function changeTextColor(color) {
1028
854
  },
1029
855
  });
1030
856
  }
1031
- /**
1032
- * The palette step a filled primary control should use so white text on it
1033
- * clears WCAG AA (4.5:1).
1034
- *
1035
- * Kept as a named helper because it is the whole of finding H-03: the shipped
1036
- * default `#2AAEC0` gives white text 2.65:1, so Add / New / Filter / Apply /
1037
- * Submit — the controls that most need to be legible — were the least legible
1038
- * in the product, and every tenant who configured a light brand colour hit the
1039
- * same wall. Darkening the shipped hex would have fixed exactly one tenant and
1040
- * changed the product's colour; this keeps the hue and moves one step down the
1041
- * ramp their own colour already generated. A brand that passes at 500 stays at
1042
- * 500 and looks identical.
1043
- */
1044
- function accessiblePrimaryShade(palette, anchor = '500') {
1045
- return pickAccessibleShade(palette, anchor, '#ffffff', WCAG_AA_NORMAL_TEXT);
1046
- }
1047
857
  const MTPreset = (themeOptions) => {
1048
858
  const textPalette = generateTailwindPalette(themeOptions?.textColor ?? '#334155', '700');
1049
- const primaryPalette = generateTailwindPalette(themeOptions?.primaryColor || '#2AAEC0');
1050
- // Which shade filled controls use. See `accessiblePrimaryShade` — the tenant's
1051
- // hue is untouched; only the step on their own ramp moves, and only when white
1052
- // text would otherwise fail WCAG AA (finding H-03).
1053
- const primaryActionShade = accessiblePrimaryShade(primaryPalette);
1054
859
  const configs = {
1055
860
  options: {
1056
861
  prefix: 'mt',
@@ -1062,16 +867,6 @@ const MTPreset = (themeOptions) => {
1062
867
  semantic: {
1063
868
  colorScheme: {
1064
869
  light: {
1065
- // Filled primary surfaces resolve to the first shade whose contrast
1066
- // with white text passes AA — usually 500, deeper only when the
1067
- // tenant's brand is too light. Borders/icons keep reading `primary.500`
1068
- // directly, so the brand accent itself is unchanged.
1069
- primary: {
1070
- color: `{primary.${primaryActionShade}}`,
1071
- contrastColor: '#ffffff',
1072
- hoverColor: `{primary.${primaryActionShade}}`,
1073
- activeColor: `{primary.${primaryActionShade}}`,
1074
- },
1075
870
  text: {
1076
871
  color: textPalette['700'],
1077
872
  hoverColor: textPalette['800'],
@@ -1088,7 +883,7 @@ const MTPreset = (themeOptions) => {
1088
883
  },
1089
884
  },
1090
885
  },
1091
- primary: primaryPalette,
886
+ primary: generateTailwindPalette(themeOptions?.primaryColor || '#2AAEC0'),
1092
887
  content: {
1093
888
  borderRadius: '{border.radius.lg}',
1094
889
  },
@@ -2380,6 +2175,119 @@ function isInvalid(control) {
2380
2175
  */
2381
2176
  const REQUEST_CONTEXT = new HttpContextToken(() => ({ useBaseUrl: false }));
2382
2177
 
2178
+ /**
2179
+ * Color utility functions for brand display.
2180
+ */
2181
+ /**
2182
+ * Converts a hex color to a light shade (equivalent to primary-100 in Tailwind).
2183
+ * This creates a color with ~10% opacity or a very light tint by mixing with white.
2184
+ */
2185
+ function getLightColor(hexColor) {
2186
+ const hex = hexColor.replace('#', '');
2187
+ const r = parseInt(hex.substring(0, 2), 16);
2188
+ const g = parseInt(hex.substring(2, 4), 16);
2189
+ const b = parseInt(hex.substring(4, 6), 16);
2190
+ const lightR = Math.round(r * 0.1 + 255 * 0.9);
2191
+ const lightG = Math.round(g * 0.1 + 255 * 0.9);
2192
+ const lightB = Math.round(b * 0.1 + 255 * 0.9);
2193
+ return `#${lightR.toString(16).padStart(2, '0')}${lightG
2194
+ .toString(16)
2195
+ .padStart(2, '0')}${lightB.toString(16).padStart(2, '0')}`;
2196
+ }
2197
+ function getContrastColor(bgColor) {
2198
+ let r = 0, g = 0, b = 0;
2199
+ if (bgColor.startsWith('#')) {
2200
+ const hex = bgColor.slice(1);
2201
+ if (hex.length === 3) {
2202
+ r = parseInt(hex[0] + hex[0], 16);
2203
+ g = parseInt(hex[1] + hex[1], 16);
2204
+ b = parseInt(hex[2] + hex[2], 16);
2205
+ }
2206
+ else if (hex.length === 6) {
2207
+ r = parseInt(hex.slice(0, 2), 16);
2208
+ g = parseInt(hex.slice(2, 4), 16);
2209
+ b = parseInt(hex.slice(4, 6), 16);
2210
+ }
2211
+ }
2212
+ const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
2213
+ return luminance > 0.5 ? '' : '#ffffff';
2214
+ }
2215
+ /** Parses `#rgb` / `#rrggbb` into 0-255 channels. Null when unparseable. */
2216
+ function toRgb(hex) {
2217
+ const value = hex.trim().replace('#', '');
2218
+ const full = value.length === 3
2219
+ ? value
2220
+ .split('')
2221
+ .map((c) => c + c)
2222
+ .join('')
2223
+ : value;
2224
+ if (full.length !== 6 || !/^[0-9a-f]{6}$/i.test(full)) {
2225
+ return null;
2226
+ }
2227
+ return [
2228
+ parseInt(full.slice(0, 2), 16),
2229
+ parseInt(full.slice(2, 4), 16),
2230
+ parseInt(full.slice(4, 6), 16),
2231
+ ];
2232
+ }
2233
+ /**
2234
+ * WCAG 2.x relative luminance.
2235
+ *
2236
+ * Note this is NOT the 0.299/0.587/0.114 perceived-brightness formula used by
2237
+ * `getContrastColor` above — that one is fine for "is this light or dark?" but
2238
+ * it is not the definition a conformance ratio is measured against, so it
2239
+ * cannot be used to decide whether text passes AA.
2240
+ */
2241
+ function relativeLuminance(hex) {
2242
+ const rgb = toRgb(hex);
2243
+ if (!rgb) {
2244
+ return null;
2245
+ }
2246
+ const [r, g, b] = rgb.map((channel) => {
2247
+ const c = channel / 255;
2248
+ return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
2249
+ });
2250
+ return 0.2126 * r + 0.7152 * g + 0.0722 * b;
2251
+ }
2252
+ /** WCAG contrast ratio between two hex colours, 1–21. Null if either is bad. */
2253
+ function contrastRatio(foreground, background) {
2254
+ const l1 = relativeLuminance(foreground);
2255
+ const l2 = relativeLuminance(background);
2256
+ if (l1 === null || l2 === null) {
2257
+ return null;
2258
+ }
2259
+ return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
2260
+ }
2261
+ /** WCAG 1.4.3 Contrast Minimum, normal-size text. */
2262
+ const WCAG_AA_NORMAL_TEXT = 4.5;
2263
+ /** Dark ink used when white text would not be legible on a status colour. */
2264
+ const READABLE_DARK_INK = '#1f2937';
2265
+ /**
2266
+ * Picks the more legible of white and a dark ink for text sitting on `bgColor`.
2267
+ *
2268
+ * Status and lookup colours come from a tenant's own catalog, so they can be
2269
+ * any hex at all — and the count badges on the Explore cards were painting
2270
+ * white on every one of them, which measured 2.59:1 at the low end (finding
2271
+ * H-03 / M-04). Rather than restrict what colours a tenant may choose, pick the
2272
+ * foreground that actually reads on the colour they chose.
2273
+ *
2274
+ * Measured with the WCAG relative-luminance ratio, not the perceived-brightness
2275
+ * shortcut in `getContrastColor`, because that shortcut is not the definition
2276
+ * conformance is judged against. Unparseable input falls back to white, which
2277
+ * is the behaviour every caller had before.
2278
+ */
2279
+ function readableTextOn(bgColor, dark = READABLE_DARK_INK, light = '#ffffff') {
2280
+ if (!bgColor) {
2281
+ return light;
2282
+ }
2283
+ const onLight = contrastRatio(light, bgColor);
2284
+ const onDark = contrastRatio(dark, bgColor);
2285
+ if (onLight === null || onDark === null) {
2286
+ return light;
2287
+ }
2288
+ return onDark > onLight ? dark : light;
2289
+ }
2290
+
2383
2291
  /**
2384
2292
  * A unique DOM id for a form field, shared by its control and its `<label for>`.
2385
2293
  *
@@ -2538,5 +2446,5 @@ function parseDateOnlyValue(value) {
2538
2446
  * Generated bundle index. Do not edit.
2539
2447
  */
2540
2448
 
2541
- export { BaseFacade, BaseFieldConfig, CheckboxFieldConfig, ColorPickerFieldConfig, CrudStateBase, DEFAULT_MT_DATE_FORMATS, DS_BLUE, DS_CHART_SERIES, DS_CONTROL_HEIGHT, DS_DEFAULT_PRIMARY_COLOR, DS_ERROR, DS_FONT_FAMILY, DS_GRAY, DS_INDIGO, DS_RADIUS, DS_SEMANTIC, DS_SHADOW, DS_SUCCESS, DS_WARNING, DateFieldConfig, EditorFieldConfig, EntityListFieldConfig, IconFieldConfig, LocationFieldConfig, LookupMatrixFieldConfig, LookupModuleCheckListFieldConfig, MTDateFormatPipe, MT_DATE_FORMATS, MT_DESIGN_IDENTITY_CLASS, MultiSelectFieldConfig, NumberFieldConfig, PickListFieldConfig, READABLE_DARK_INK, REQUEST_CONTEXT, RadioButtonFieldConfig, RadioCardsFieldConfig, ScheduleItemSelectorFieldConfig, SchedulePredecessorFieldConfig, SchemaConnectionFieldConfig, SelectFieldConfig, SliderFieldConfig, SpacerFieldConfig, TextFieldConfig, TextareaFieldConfig, ToggleFieldConfig, UploadFileFieldConfig, UserSearchFieldConfig, ValidatorConfig, WCAG_AA_NORMAL_TEXT, applyDesignIdentityClass, changeBackgroundColor, changePrimaryColor, changeTextColor, clockTimeToSeconds, contrastRatio, createCustomValidator, createEntityAdapter, dsChartSeries, dsIdentityConfigs, endLoading, formatClockTime, generateTailwindPalette, getContrastColor, getLightColor, getMTDesignIdentity, handleApiRequest, isInvalid, newFieldId, parseClockTime, pickAccessibleShade, provideMTComponents, provideMTConfirmation, provideMTDateFormats, provideMTMessages, readableTextOn, relativeLuminance, setLoadingError, setMTDesignIdentity, startLoading, toAngularDateFormat, toClockTimeParts, wrapValidatorWithMessage };
2449
+ export { BaseFacade, BaseFieldConfig, CheckboxFieldConfig, ColorPickerFieldConfig, CrudStateBase, DEFAULT_MT_DATE_FORMATS, DS_BLUE, DS_CHART_SERIES, DS_CONTROL_HEIGHT, DS_DEFAULT_PRIMARY_COLOR, DS_ERROR, DS_FONT_FAMILY, DS_GRAY, DS_INDIGO, DS_RADIUS, DS_SEMANTIC, DS_SHADOW, DS_SUCCESS, DS_WARNING, DateFieldConfig, EditorFieldConfig, EntityListFieldConfig, IconFieldConfig, LocationFieldConfig, LookupMatrixFieldConfig, LookupModuleCheckListFieldConfig, MTDateFormatPipe, MT_DATE_FORMATS, MT_DESIGN_IDENTITY_CLASS, MultiSelectFieldConfig, NumberFieldConfig, PickListFieldConfig, READABLE_DARK_INK, REQUEST_CONTEXT, RadioButtonFieldConfig, RadioCardsFieldConfig, ScheduleItemSelectorFieldConfig, SchedulePredecessorFieldConfig, SchemaConnectionFieldConfig, SelectFieldConfig, SliderFieldConfig, SpacerFieldConfig, TextFieldConfig, TextareaFieldConfig, ToggleFieldConfig, UploadFileFieldConfig, UserSearchFieldConfig, ValidatorConfig, WCAG_AA_NORMAL_TEXT, applyDesignIdentityClass, changeBackgroundColor, changePrimaryColor, changeTextColor, clockTimeToSeconds, contrastRatio, createCustomValidator, createEntityAdapter, dsChartSeries, dsIdentityConfigs, endLoading, formatClockTime, generateTailwindPalette, getContrastColor, getLightColor, getMTDesignIdentity, handleApiRequest, isInvalid, newFieldId, parseClockTime, provideMTComponents, provideMTConfirmation, provideMTDateFormats, provideMTMessages, readableTextOn, relativeLuminance, setLoadingError, setMTDesignIdentity, startLoading, toAngularDateFormat, toClockTimeParts, wrapValidatorWithMessage };
2542
2450
  //# sourceMappingURL=masterteam-components.mjs.map