@forgeroute/ui 0.5.26 → 0.5.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/forgeroute-ui-card-list-item.mjs +30 -8
- package/fesm2022/forgeroute-ui-card-list-item.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-checkbox.mjs +2 -2
- package/fesm2022/forgeroute-ui-checkbox.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-color-input.mjs +2 -2
- package/fesm2022/forgeroute-ui-color-input.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-combobox.mjs +2 -2
- package/fesm2022/forgeroute-ui-combobox.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-contact-picker.mjs +4 -4
- package/fesm2022/forgeroute-ui-contact-picker.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-conversations.mjs +2 -0
- package/fesm2022/forgeroute-ui-conversations.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-data-table-core.mjs +2 -2
- package/fesm2022/forgeroute-ui-data-table-core.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-date-input.mjs +2 -2
- package/fesm2022/forgeroute-ui-date-input.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-datetime-input.mjs +2 -2
- package/fesm2022/forgeroute-ui-datetime-input.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-detail-card.mjs +20 -4
- package/fesm2022/forgeroute-ui-detail-card.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-dropdown.mjs +16 -2
- package/fesm2022/forgeroute-ui-dropdown.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-file-input.mjs +7 -5
- package/fesm2022/forgeroute-ui-file-input.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-icon-picker.mjs +2 -2
- package/fesm2022/forgeroute-ui-icon-picker.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-media.mjs +67 -2
- package/fesm2022/forgeroute-ui-media.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-messaging.mjs +3 -0
- package/fesm2022/forgeroute-ui-messaging.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-multi-select.mjs +2 -2
- package/fesm2022/forgeroute-ui-multi-select.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-notes.mjs +1 -0
- package/fesm2022/forgeroute-ui-notes.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-option-card.mjs +1 -0
- package/fesm2022/forgeroute-ui-option-card.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-payments.mjs +3 -0
- package/fesm2022/forgeroute-ui-payments.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-pdf.mjs +1 -0
- package/fesm2022/forgeroute-ui-pdf.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-quickbooks.mjs +1 -0
- package/fesm2022/forgeroute-ui-quickbooks.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-radio-matrix.mjs +2 -2
- package/fesm2022/forgeroute-ui-radio-matrix.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-radio.mjs +2 -2
- package/fesm2022/forgeroute-ui-radio.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-select.mjs +2 -2
- package/fesm2022/forgeroute-ui-select.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-setup.mjs +1 -0
- package/fesm2022/forgeroute-ui-setup.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-square.mjs +1 -0
- package/fesm2022/forgeroute-ui-square.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-star-rating.mjs +2 -2
- package/fesm2022/forgeroute-ui-star-rating.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-stripe.mjs +1 -0
- package/fesm2022/forgeroute-ui-stripe.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-swatch-picker.mjs +2 -2
- package/fesm2022/forgeroute-ui-swatch-picker.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-table-toolbar.mjs +17 -5
- package/fesm2022/forgeroute-ui-table-toolbar.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-text-input.mjs +2 -2
- package/fesm2022/forgeroute-ui-text-input.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-textarea-input.mjs +23 -36
- package/fesm2022/forgeroute-ui-textarea-input.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-time-input.mjs +2 -2
- package/fesm2022/forgeroute-ui-time-input.mjs.map +1 -1
- package/package.json +1 -1
- package/types/forgeroute-ui-card-list-item.d.ts +11 -3
- package/types/forgeroute-ui-detail-card.d.ts +7 -0
- package/types/forgeroute-ui-dropdown.d.ts +2 -0
- package/types/forgeroute-ui-media.d.ts +28 -0
- package/types/forgeroute-ui-messaging.d.ts +4 -4
- package/types/forgeroute-ui-payments.d.ts +1 -1
- package/types/forgeroute-ui-quickbooks.d.ts +1 -1
- package/types/forgeroute-ui-square.d.ts +4 -4
- package/types/forgeroute-ui-stripe.d.ts +4 -4
- package/types/forgeroute-ui-textarea-input.d.ts +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forgeroute-ui-color-input.mjs","names":[],"sources":["../../../projects/forgeroute-ui/color-input/src/lib/color-input/color-input.component.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, effect, forwardRef, input, output, signal, inject } from '@angular/core';\nimport { AbstractControl, ControlValueAccessor, NG_VALIDATORS, NG_VALUE_ACCESSOR, ValidationErrors, Validator } from '@angular/forms';\nimport { FieldIssue, UiFieldValidity, createFieldReveal, issueToErrors, requiredIssue } from '@forgeroute/ui/core';\nimport { UiLabelsService } from '@forgeroute/ui/core';\n\nlet nextColorId = 0;\n\n/** A preset swatch offered under the field. `label` is its accessible name. */\nexport interface ColorPreset { value: string; label: string; }\n\n/**\n * Normalises a CSS hex colour: `#fff` / `FFF` -> `#ffffff`, `#RRGGBB` -> lower case. With `allowAlpha`, `#rrggbbaa`\n * is accepted and kept at 8 digits (shorthand `#rgba` is never accepted). Returns null for anything else\n * (named colours, `rgb()`, wrong lengths, non-hex digits). The leading `#` is optional on input.\n */\nexport function normalizeHexColor(value: string | null | undefined, allowAlpha = false): string | null {\n if (typeof value !== 'string') return null;\n const m = /^#?([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(value.trim());\n if (!m) return null;\n let hex = m[1].toLowerCase();\n if (hex.length === 8 && !allowAlpha) return null;\n if (hex.length === 3) hex = hex.split('').map(c => c + c).join('');\n return '#' + hex;\n}\n\n/**\n * Colour input: ControlValueAccessor over a string holding a CSS hex colour. A swatch opens the operating system's\n * colour picker (native `<input type=\"color\">`) and a text field next to it shows / edits the hex; both stay in sync.\n *\n * <ui-color-input label=\"Brand colour\" [(ngModel)]=\"brand\" />\n * <ui-color-input label=\"Accent\" [presets]=\"presets\" [allowAlpha]=\"true\" [formControl]=\"accent\" />\n *\n * Value contract\n * - A valid colour is emitted normalised to lower-case `#rrggbb` (`#FFF` -> `#ffffff`; 8-digit `#rrggbbaa` only with\n * `allowAlpha`, kept at 8 digits). The user may type with or without the leading `#`; the control prepends it.\n * - Text the user typed that is not a valid colour is emitted as typed (with `#` prepended, `''` when cleared) so the host\n * sees what the user entered; the control is then invalid (the `colorInput.invalidHex` text, \"Enter a hex colour like #3b82f6.\" in English) and the form control gets\n * the `color` error. While typing, the text is not rewritten (`#fff` is emitted as `#ffffff` but stays `#fff` on screen)\n * and is normalised on blur.\n * - A value WRITTEN BY THE HOST (`writeValue` / `[ngModel]` / `[formControl]`) is never flagged as an invalid colour, even\n * when it is not a hex (`red`, `#fff8`, a legacy value), until the user changes it, so legacy data never blocks Save.\n * (Required is still checked for an empty value.) The native picker gets `#000000` for a non-hex value so it never throws.\n * - Picking in the native picker with an 8-digit value and `allowAlpha` keeps the existing alpha digits.\n *\n * Validity API (same as the other ui inputs): `Validator` (error keys `required`, `color`), signals `invalid` /\n * `errorMessage`, `invalidChange` output, `UiFieldValidity` token. Messages (built-in and a host `[error]`) show only after the user left the field; `[showErrors]=\"true\"` also reveals it on an untouched field. Disabled controls are never invalid.\n *\n * Cross-browser: the native swatch is styled with `-webkit-appearance` and the `::-webkit-color-swatch` / `::-moz-color-swatch`\n * pseudo-elements and sits invisibly over our own preview square, so it looks the same in Chrome, Edge, Firefox and Safari.\n * Preset swatches are real `<button>`s (Enter / Space work natively, `aria-pressed` marks the selected one).\n */\n@Component({\n selector: 'ui-color-input',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => ColorInputComponent), multi: true },\n { provide: NG_VALIDATORS, useExisting: forwardRef(() => ColorInputComponent), multi: true },\n { provide: UiFieldValidity, useExisting: forwardRef(() => ColorInputComponent) },\n ],\n template: `\n <div class=\"co-field\" [class.co-error]=\"_activeError()\" [class.co-disabled]=\"disabled()\">\n @if (label()) {\n <label class=\"co-label\" [for]=\"showText() ? _textId : _nativeId\">\n {{ label() }}\n @if (required()) { <span class=\"co-required\" aria-hidden=\"true\">*</span> }\n </label>\n }\n <div class=\"co-row\">\n <span class=\"co-swatch\" [class.co-swatch-wide]=\"!showText()\">\n <span class=\"co-preview\" [style.background-color]=\"_swatchColor()\" aria-hidden=\"true\"></span>\n @if (!showText()) {\n <span class=\"co-chip\" aria-hidden=\"true\" data-testid=\"color-input-chip\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 3a9 9 0 1 0 0 18c1.1 0 2-.9 2-2 0-.5-.2-1-.5-1.3-.3-.4-.5-.8-.5-1.3 0-1.1.9-2 2-2h2.4a3.6 3.6 0 0 0 3.6-3.6C21 6.8 17 3 12 3z\"/><circle cx=\"7.5\" cy=\"11.5\" r=\"1\"/><circle cx=\"10.5\" cy=\"7.5\" r=\"1\"/><circle cx=\"15.5\" cy=\"7.5\" r=\"1\"/></svg>\n </span>\n }\n <input\n class=\"co-native\"\n type=\"color\"\n [id]=\"_nativeId\"\n [value]=\"_nativeValue()\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"labels.t('colorInput.picker', { label: label() || ariaLabel() || labels.t('colorInput.colour') })\"\n [attr.aria-describedby]=\"!showText() && (_activeError() || hint()) ? _descId : null\"\n [attr.aria-invalid]=\"!showText() && _activeError() ? 'true' : null\"\n (input)=\"onNativeInput($event)\"\n (blur)=\"onNativeBlur()\" />\n </span>\n @if (showText()) {\n <input\n class=\"co-text\"\n type=\"text\"\n [id]=\"_textId\"\n [value]=\"_text()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [attr.maxlength]=\"allowAlpha() ? 9 : 7\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n [attr.required]=\"required() || null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-label]=\"label() ? null : (ariaLabel() || null)\"\n [attr.aria-invalid]=\"_activeError() ? 'true' : null\"\n [attr.aria-describedby]=\"(_activeError() || hint()) ? _descId : null\"\n (input)=\"onTextInput($event)\"\n (blur)=\"onTextBlur()\" />\n }\n </div>\n @if (presets().length) {\n <div class=\"co-presets\" role=\"group\" [attr.aria-label]=\"labels.t('colorInput.presets', { label: label() || ariaLabel() || labels.t('colorInput.colour') })\">\n @for (p of presets(); track $index) {\n <button\n type=\"button\"\n class=\"co-preset\"\n [class.co-preset-selected]=\"_isSelected(p)\"\n [style.background-color]=\"_presetColor(p)\"\n [attr.aria-label]=\"p.label\"\n [attr.aria-pressed]=\"_isSelected(p) ? 'true' : 'false'\"\n [disabled]=\"disabled()\"\n (click)=\"selectPreset(p)\"></button>\n }\n </div>\n }\n @if (_activeError()) {\n <p class=\"co-desc co-desc-error\" [id]=\"_descId\" role=\"alert\">{{ _activeError() }}</p>\n } @else if (hint()) {\n <p class=\"co-desc\" [id]=\"_descId\">{{ hint() }}</p>\n }\n </div>\n `,\n styles: [`\n :host { display: block; }\n .co-field { display: flex; flex-direction: column; gap: 6px; }\n .co-label { font-size: 0.8125rem; font-weight: 600; color: #374151; line-height: 1; }\n .co-required { color: #dc2626; margin-left: 2px; }\n .co-row { display: flex; align-items: center; gap: 8px; }\n\n .co-swatch {\n position: relative; flex-shrink: 0; width: 38px; height: 38px; box-sizing: border-box;\n border: 1px solid #7c8ba1; border-radius: 8px; overflow: hidden; background: #fff;\n transition: border-color 0.15s, box-shadow 0.15s;\n }\n .co-swatch-wide { flex: 1; width: auto; min-width: 0; height: 40px; cursor: pointer; }\n .co-swatch-wide:hover { border-color: #475569; }\n .co-chip { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center;\n width: 28px; height: 28px; border-radius: 6px; background: #fff; color: #334155; border: 1px solid #94a3b8; pointer-events: none; }\n .co-swatch:focus-within { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12); }\n .co-preview { position: absolute; inset: 0; display: block; }\n /* The real colour input sits invisibly over the preview so clicks and keyboard land on it. */\n .co-native {\n position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0;\n opacity: 0; cursor: pointer; -webkit-appearance: none; appearance: none; background: transparent;\n }\n .co-native::-webkit-color-swatch-wrapper { padding: 0; }\n .co-native::-webkit-color-swatch { border: 0; border-radius: 0; }\n .co-native::-moz-color-swatch { border: 0; border-radius: 0; }\n\n .co-text {\n flex: 1; min-width: 0; box-sizing: border-box;\n padding: 9px 12px; font-size: 0.875rem; font-family: inherit;\n color: #1e293b; background: #fff;\n border: 1px solid #7c8ba1; border-radius: 8px;\n outline: none; transition: border-color 0.15s, box-shadow 0.15s;\n }\n .co-text::placeholder { color: #64748b; opacity: 1; }\n .co-text:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12); }\n\n .co-presets { display: flex; flex-wrap: wrap; gap: 8px; }\n .co-preset {\n width: 28px; height: 28px; padding: 0; box-sizing: border-box; cursor: pointer;\n border: 1px solid #7c8ba1; border-radius: 50%;\n }\n .co-preset-selected { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #3b82f6; }\n .co-preset:focus { outline: 2px solid #3b82f6; outline-offset: 2px; }\n .co-preset:focus:not(:focus-visible) { outline: none; }\n\n .co-error .co-text, .co-error .co-swatch { border-color: #ef4444; }\n .co-error .co-text:focus { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12); }\n\n .co-disabled .co-text, .co-disabled .co-swatch, .co-disabled .co-preset { opacity: 0.5; cursor: not-allowed; }\n .co-disabled .co-native { cursor: not-allowed; }\n\n .co-desc { margin: 0; font-size: 0.75rem; line-height: 1.4; color: #64748b; }\n .co-desc-error { color: #dc2626; }\n\n @media (max-width: 480px) { .co-text { font-size: 1rem; } }\n @media (pointer: coarse), (max-width: 480px) {\n .co-text { min-height: 44px; }\n .co-swatch { width: 44px; height: 44px; }\n .co-swatch-wide { width: auto; height: 44px; }\n .co-preset { width: 44px; height: 44px; }\n }\n `],\n})\nexport class ColorInputComponent implements ControlValueAccessor, Validator, UiFieldValidity {\n protected readonly labels = inject(UiLabelsService);\n readonly label = input('');\n /** Accessible name for a field with no visible label. */\n readonly ariaLabel = input('');\n readonly placeholder = input('#3b82f6');\n readonly required = input(false);\n readonly hint = input('');\n /** Host error message; always wins over the built-in message. */\n readonly error = input('');\n /** The host's \"tried to submit\" flag (e.g. after a failed Save click). `true` reveals the message of an untouched field at once (the field also shows it after the user left THIS field); switching it from true back to false forgets that the field was left. */\n readonly showErrors = input(false);\n /** Accept (and keep) 8-digit `#rrggbbaa` values. */\n readonly allowAlpha = input(false);\n /** Show the hex text box next to the swatch (default). `false` = the swatch alone, stretched to a full-width colour field with a palette icon: the user only clicks it and picks. */\n readonly showText = input(true);\n /** Optional row of preset swatches. */\n readonly presets = input<ColorPreset[]>([]);\n\n /** Emits whenever the field becomes invalid / valid. */\n readonly invalidChange = output<boolean>();\n\n readonly _disabledInput = input(false, { alias: 'disabled' });\n private readonly _cvaDisabled = signal(false);\n protected readonly disabled = computed(() => this._disabledInput() || this._cvaDisabled());\n\n /** Current model value (what the form control holds). */\n private readonly _model = signal('');\n /** Text shown in the text field. */\n protected readonly _text = signal('');\n /** True once the user changed the value; host-written values are not format-checked before that. */\n private readonly _edited = signal(false);\n\n private readonly _reveal = createFieldReveal(this.showErrors);\n private readonly _issue = computed(() => this._check(this._model(), this._edited()));\n readonly invalid = computed(() => !!this.error() || !!this._issue());\n readonly errorMessage = computed(() => this._issue()?.message ?? '');\n protected readonly _activeError = computed(() => this._reveal.revealed() ? (this.error() || this.errorMessage()) : '');\n\n private readonly _valid = computed(() => normalizeHexColor(this._model(), this.allowAlpha()));\n /** Colour of the preview square: the value when it is a usable hex, otherwise transparent. */\n protected readonly _swatchColor = computed(() => this._valid() ?? 'transparent');\n /** Value for the native picker: always `#rrggbb`. */\n protected readonly _nativeValue = computed(() => (this._valid() ?? '#000000').slice(0, 7));\n\n private readonly _uid = nextColorId++;\n protected readonly _textId = `co-text-${this._uid}`;\n protected readonly _nativeId = `co-native-${this._uid}`;\n protected readonly _descId = `co-desc-${this._uid}`;\n\n private _onChange = (_: string) => {};\n private _onTouched = () => {};\n private _onValidatorChange = () => {};\n\n constructor() {\n effect(() => { this.invalidChange.emit(this.invalid()); });\n }\n\n /** Re-run the form control's validation when a rule input (required, allowAlpha, ...) changes. */\n ngOnChanges() { this._onValidatorChange(); }\n\n writeValue(val: string | null) {\n const text = val == null ? '' : String(val);\n this._model.set(text);\n this._text.set(text);\n this._edited.set(false);\n }\n registerOnChange(fn: (v: string) => void) { this._onChange = fn; }\n registerOnTouched(fn: () => void) { this._onTouched = fn; }\n registerOnValidatorChange(fn: () => void) { this._onValidatorChange = fn; }\n setDisabledState(d: boolean) { this._cvaDisabled.set(d); }\n\n validate(control: AbstractControl): ValidationErrors | null {\n const v = control.value;\n return issueToErrors(this._check(v == null ? '' : String(v), this._edited()));\n }\n\n protected onTextInput(event: Event) {\n const el = event.target as HTMLInputElement;\n let raw = el.value.trim();\n if (raw && !raw.startsWith('#')) raw = '#' + raw;\n if (raw === '#') raw = '';\n if (el.value !== raw) el.value = raw;\n this._text.set(raw);\n this._commit(normalizeHexColor(raw, this.allowAlpha()) ?? raw);\n }\n\n protected onNativeInput(event: Event) {\n const picked = (event.target as HTMLInputElement).value.toLowerCase();\n const current = this._valid();\n // Keep the alpha digits of an 8-digit value when the user only changes the colour.\n const next = this.allowAlpha() && current && current.length === 9 ? picked + current.slice(7) : picked;\n this._text.set(next);\n this._commit(next);\n }\n\n protected selectPreset(p: ColorPreset) {\n const next = normalizeHexColor(p.value, this.allowAlpha()) ?? p.value;\n this._text.set(next);\n this._commit(next);\n }\n\n protected _isSelected(p: ColorPreset): boolean {\n const a = normalizeHexColor(p.value, this.allowAlpha());\n return !!a && a === this._valid();\n }\n protected _presetColor(p: ColorPreset): string {\n return normalizeHexColor(p.value, this.allowAlpha()) ?? 'transparent';\n }\n\n protected onTextBlur() {\n const v = this._valid();\n if (this._edited() && v && this._text() !== v) this._text.set(v);\n this._touch();\n }\n /** Blur of the native picker only marks the field touched; it never rewrites the text. */\n protected onNativeBlur() { this._touch(); }\n\n private _touch() {\n this._onTouched();\n this._reveal.touched.set(true);\n }\n\n private _commit(value: string) {\n this._edited.set(true);\n this._model.set(value);\n this._onChange(value);\n }\n\n private _check(value: string, edited: boolean): FieldIssue | null {\n if (this.disabled()) return null;\n const text = value.trim();\n if (!text) return this.required() ? requiredIssue(this.label()) : null;\n if (!edited) return null;\n return normalizeHexColor(text, this.allowAlpha()) ? null : { key: 'color', message: this.labels.t('colorInput.invalidHex') };\n }\n}\n"],"mappings":";;;;AAKA,IAAI,cAAc;AAUlB,SAAgB,kBAAkB,OAAkC,aAAa,OAAK;CACpF,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,MAAM,IAAI,6CAA6C,KAAK,MAAM,KAAI,CAAE;CACxE,IAAI,CAAC,GAAG,OAAO;CACf,IAAI,MAAM,EAAE,EAAE,CAAC,YAAW;CAC1B,IAAI,IAAI,WAAW,KAAK,CAAC,YAAY,OAAO;CAC5C,IAAI,IAAI,WAAW,GAAG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A;IAAA;IAAA,SAAA;KAAA,mBAAA;KAAA,YAAA;KAAA,UAAA;KAAA,YAAA;KAAA,mBAAA;IAAA;IAAA,gBAAA;KAAA,mBAAA;KAAA,YAAA;KAAA,UAAA;KAAA,YAAA;KAAA,mBAAA;IAAA;GAAA;GAAA,SAAA,EAAA,eAAA,gBAAA;GAAA,WA3InB;IACT;KAAE,SAAS;KAAmB,aAAa,iBAAiB,mBAAmB;KAAG,OAAO;IAAI;IAC7F;KAAE,SAAS;KAAe,aAAa,iBAAiB,mBAAmB;KAAG,OAAO;IAAI;IACzF;KAAE,SAAS;KAAiB,aAAa,iBAAiB,mBAAmB;IAAC;GAC/E;GAAA,eAAA;GAAA,UAAA;GAAA,UACS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqET,UAAA;GAAA,QAAA,CAAA,6/EAAA;GAAA,iBAAA,GAAA,wBAAA;EAAA,CAAA;CAAA;;AAiEU,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAmB,YAAA,CAAA;EA/I/B,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAgB,YACd;GAAI,iBACC,wBAAwB;GAAM,WACpC;IACT;KAAE,SAAS;KAAmB,aAAa,iBAAgB,mBAAoB;KAAG,OAAO;IAAI;IAC7F;KAAE,SAAS;KAAe,aAAa,iBAAgB,mBAAoB;KAAG,OAAO;IAAI;IACzF;KAAE,SAAS;KAAiB,aAAa,iBAAgB,mBAAoB;IAAC;GAC/E;GAAA,UACS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqET,QAAA,CAAA,6/EAAA;EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"forgeroute-ui-color-input.mjs","names":[],"sources":["../../../projects/forgeroute-ui/color-input/src/lib/color-input/color-input.component.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, effect, forwardRef, input, output, signal, inject } from '@angular/core';\nimport { AbstractControl, ControlValueAccessor, NG_VALIDATORS, NG_VALUE_ACCESSOR, ValidationErrors, Validator } from '@angular/forms';\nimport { FieldIssue, UiFieldValidity, createFieldReveal, issueToErrors, requiredIssue } from '@forgeroute/ui/core';\nimport { UiLabelsService } from '@forgeroute/ui/core';\n\nlet nextColorId = 0;\n\n/** A preset swatch offered under the field. `label` is its accessible name. */\nexport interface ColorPreset { value: string; label: string; }\n\n/**\n * Normalises a CSS hex colour: `#fff` / `FFF` -> `#ffffff`, `#RRGGBB` -> lower case. With `allowAlpha`, `#rrggbbaa`\n * is accepted and kept at 8 digits (shorthand `#rgba` is never accepted). Returns null for anything else\n * (named colours, `rgb()`, wrong lengths, non-hex digits). The leading `#` is optional on input.\n */\nexport function normalizeHexColor(value: string | null | undefined, allowAlpha = false): string | null {\n if (typeof value !== 'string') return null;\n const m = /^#?([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(value.trim());\n if (!m) return null;\n let hex = m[1].toLowerCase();\n if (hex.length === 8 && !allowAlpha) return null;\n if (hex.length === 3) hex = hex.split('').map(c => c + c).join('');\n return '#' + hex;\n}\n\n/**\n * Colour input: ControlValueAccessor over a string holding a CSS hex colour. A swatch opens the operating system's\n * colour picker (native `<input type=\"color\">`) and a text field next to it shows / edits the hex; both stay in sync.\n *\n * <ui-color-input label=\"Brand colour\" [(ngModel)]=\"brand\" />\n * <ui-color-input label=\"Accent\" [presets]=\"presets\" [allowAlpha]=\"true\" [formControl]=\"accent\" />\n *\n * Value contract\n * - A valid colour is emitted normalised to lower-case `#rrggbb` (`#FFF` -> `#ffffff`; 8-digit `#rrggbbaa` only with\n * `allowAlpha`, kept at 8 digits). The user may type with or without the leading `#`; the control prepends it.\n * - Text the user typed that is not a valid colour is emitted as typed (with `#` prepended, `''` when cleared) so the host\n * sees what the user entered; the control is then invalid (the `colorInput.invalidHex` text, \"Enter a hex colour like #3b82f6.\" in English) and the form control gets\n * the `color` error. While typing, the text is not rewritten (`#fff` is emitted as `#ffffff` but stays `#fff` on screen)\n * and is normalised on blur.\n * - A value WRITTEN BY THE HOST (`writeValue` / `[ngModel]` / `[formControl]`) is never flagged as an invalid colour, even\n * when it is not a hex (`red`, `#fff8`, a legacy value), until the user changes it, so legacy data never blocks Save.\n * (Required is still checked for an empty value.) The native picker gets `#000000` for a non-hex value so it never throws.\n * - Picking in the native picker with an 8-digit value and `allowAlpha` keeps the existing alpha digits.\n *\n * Validity API (same as the other ui inputs): `Validator` (error keys `required`, `color`), signals `invalid` /\n * `errorMessage`, `invalidChange` output, `UiFieldValidity` token. Messages (built-in and a host `[error]`) show only after the user left the field; `[showErrors]=\"true\"` also reveals it on an untouched field. Disabled controls are never invalid.\n *\n * Cross-browser: the native swatch is styled with `-webkit-appearance` and the `::-webkit-color-swatch` / `::-moz-color-swatch`\n * pseudo-elements and sits invisibly over our own preview square, so it looks the same in Chrome, Edge, Firefox and Safari.\n * Preset swatches are real `<button>`s (Enter / Space work natively, `aria-pressed` marks the selected one).\n */\n@Component({\n selector: 'ui-color-input',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => ColorInputComponent), multi: true },\n { provide: NG_VALIDATORS, useExisting: forwardRef(() => ColorInputComponent), multi: true },\n { provide: UiFieldValidity, useExisting: forwardRef(() => ColorInputComponent) },\n ],\n template: `\n <div class=\"co-field\" [class.co-error]=\"_activeError()\" [class.co-disabled]=\"disabled()\">\n @if (label()) {\n <label class=\"co-label\" [for]=\"showText() ? _textId : _nativeId\">\n {{ label() }}\n @if (required()) { <span class=\"co-required\" aria-hidden=\"true\">*</span> }\n </label>\n }\n <div class=\"co-row\">\n <span class=\"co-swatch\" [class.co-swatch-wide]=\"!showText()\">\n <span class=\"co-preview\" [style.background-color]=\"_swatchColor()\" aria-hidden=\"true\"></span>\n @if (!showText()) {\n <span class=\"co-chip\" aria-hidden=\"true\" data-testid=\"color-input-chip\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 3a9 9 0 1 0 0 18c1.1 0 2-.9 2-2 0-.5-.2-1-.5-1.3-.3-.4-.5-.8-.5-1.3 0-1.1.9-2 2-2h2.4a3.6 3.6 0 0 0 3.6-3.6C21 6.8 17 3 12 3z\"/><circle cx=\"7.5\" cy=\"11.5\" r=\"1\"/><circle cx=\"10.5\" cy=\"7.5\" r=\"1\"/><circle cx=\"15.5\" cy=\"7.5\" r=\"1\"/></svg>\n </span>\n }\n <input\n class=\"co-native\"\n type=\"color\"\n [id]=\"_nativeId\"\n [value]=\"_nativeValue()\"\n [disabled]=\"disabled()\"\n [attr.aria-label]=\"labels.t('colorInput.picker', { label: label() || ariaLabel() || labels.t('colorInput.colour') })\"\n [attr.aria-describedby]=\"!showText() && (_activeError() || hint()) ? _descId : null\"\n [attr.aria-invalid]=\"!showText() && _activeError() ? 'true' : null\"\n (input)=\"onNativeInput($event)\"\n (blur)=\"onNativeBlur()\" />\n </span>\n @if (showText()) {\n <input\n class=\"co-text\"\n type=\"text\"\n [id]=\"_textId\"\n [value]=\"_text()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [attr.maxlength]=\"allowAlpha() ? 9 : 7\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n [attr.required]=\"required() || null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-label]=\"label() ? null : (ariaLabel() || null)\"\n [attr.aria-invalid]=\"_activeError() ? 'true' : null\"\n [attr.aria-describedby]=\"(_activeError() || hint()) ? _descId : null\"\n (input)=\"onTextInput($event)\"\n (blur)=\"onTextBlur()\" />\n }\n </div>\n @if (presets().length) {\n <div class=\"co-presets\" role=\"group\" [attr.aria-label]=\"labels.t('colorInput.presets', { label: label() || ariaLabel() || labels.t('colorInput.colour') })\">\n @for (p of presets(); track $index) {\n <button\n type=\"button\"\n class=\"co-preset\"\n [class.co-preset-selected]=\"_isSelected(p)\"\n [style.background-color]=\"_presetColor(p)\"\n [attr.aria-label]=\"p.label\"\n [attr.aria-pressed]=\"_isSelected(p) ? 'true' : 'false'\"\n [disabled]=\"disabled()\"\n (click)=\"selectPreset(p)\"></button>\n }\n </div>\n }\n @if (_activeError()) {\n <p class=\"co-desc co-desc-error\" [id]=\"_descId\" role=\"alert\">{{ _activeError() }}</p>\n } @else if (hint()) {\n <p class=\"co-desc\" [id]=\"_descId\">{{ hint() }}</p>\n }\n </div>\n `,\n styles: [`\n :host { display: block; }\n .co-field { display: flex; flex-direction: column; gap: 6px; }\n .co-label { font-size: 0.8125rem; font-weight: 600; color: #374151; line-height: 1; }\n .co-required { color: #dc2626; margin-left: 2px; }\n .co-row { display: flex; align-items: center; gap: 8px; }\n\n .co-swatch {\n position: relative; flex-shrink: 0; width: 38px; height: 38px; box-sizing: border-box;\n border: 1px solid #7c8ba1; border-radius: 8px; overflow: hidden; background: #fff;\n transition: border-color 0.15s, box-shadow 0.15s;\n }\n .co-swatch-wide { flex: 1; width: auto; min-width: 0; height: 40px; cursor: pointer; }\n .co-swatch-wide:hover { border-color: #475569; }\n .co-chip { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center;\n width: 28px; height: 28px; border-radius: 6px; background: #fff; color: #334155; border: 1px solid #94a3b8; pointer-events: none; }\n .co-swatch:focus-within { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12); }\n .co-preview { position: absolute; inset: 0; display: block; }\n /* The real colour input sits invisibly over the preview so clicks and keyboard land on it. */\n .co-native {\n position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0;\n opacity: 0; cursor: pointer; -webkit-appearance: none; appearance: none; background: transparent;\n }\n .co-native::-webkit-color-swatch-wrapper { padding: 0; }\n .co-native::-webkit-color-swatch { border: 0; border-radius: 0; }\n .co-native::-moz-color-swatch { border: 0; border-radius: 0; }\n\n .co-text {\n flex: 1; min-width: 0; box-sizing: border-box;\n padding: 9px 12px; font-size: 0.875rem; font-family: inherit;\n color: #1e293b; background: #fff;\n border: 1px solid #7c8ba1; border-radius: 8px;\n outline: none; transition: border-color 0.15s, box-shadow 0.15s;\n }\n .co-text::placeholder { color: #64748b; opacity: 1; }\n .co-text:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12); }\n\n .co-presets { display: flex; flex-wrap: wrap; gap: 8px; }\n .co-preset {\n width: 28px; height: 28px; padding: 0; box-sizing: border-box; cursor: pointer;\n border: 1px solid #7c8ba1; border-radius: 50%;\n }\n .co-preset-selected { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #3b82f6; }\n .co-preset:focus { outline: 2px solid #3b82f6; outline-offset: 2px; }\n .co-preset:focus:not(:focus-visible) { outline: none; }\n\n .co-error .co-text, .co-error .co-swatch { border-color: #ef4444; }\n .co-error .co-text:focus { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12); }\n\n .co-disabled .co-text, .co-disabled .co-swatch, .co-disabled .co-preset { opacity: 0.5; cursor: not-allowed; }\n .co-disabled .co-native { cursor: not-allowed; }\n\n .co-desc { margin: -6px 0 0; font-size: 0.75rem; line-height: 1.4; color: #64748b; }\n .co-desc-error { color: #dc2626; }\n\n @media (max-width: 480px) { .co-text { font-size: 1rem; } }\n @media (pointer: coarse), (max-width: 480px) {\n .co-text { min-height: 44px; }\n .co-swatch { width: 44px; height: 44px; }\n .co-swatch-wide { width: auto; height: 44px; }\n .co-preset { width: 44px; height: 44px; }\n }\n `],\n})\nexport class ColorInputComponent implements ControlValueAccessor, Validator, UiFieldValidity {\n protected readonly labels = inject(UiLabelsService);\n readonly label = input('');\n /** Accessible name for a field with no visible label. */\n readonly ariaLabel = input('');\n readonly placeholder = input('#3b82f6');\n readonly required = input(false);\n readonly hint = input('');\n /** Host error message; always wins over the built-in message. */\n readonly error = input('');\n /** The host's \"tried to submit\" flag (e.g. after a failed Save click). `true` reveals the message of an untouched field at once (the field also shows it after the user left THIS field); switching it from true back to false forgets that the field was left. */\n readonly showErrors = input(false);\n /** Accept (and keep) 8-digit `#rrggbbaa` values. */\n readonly allowAlpha = input(false);\n /** Show the hex text box next to the swatch (default). `false` = the swatch alone, stretched to a full-width colour field with a palette icon: the user only clicks it and picks. */\n readonly showText = input(true);\n /** Optional row of preset swatches. */\n readonly presets = input<ColorPreset[]>([]);\n\n /** Emits whenever the field becomes invalid / valid. */\n readonly invalidChange = output<boolean>();\n\n readonly _disabledInput = input(false, { alias: 'disabled' });\n private readonly _cvaDisabled = signal(false);\n protected readonly disabled = computed(() => this._disabledInput() || this._cvaDisabled());\n\n /** Current model value (what the form control holds). */\n private readonly _model = signal('');\n /** Text shown in the text field. */\n protected readonly _text = signal('');\n /** True once the user changed the value; host-written values are not format-checked before that. */\n private readonly _edited = signal(false);\n\n private readonly _reveal = createFieldReveal(this.showErrors);\n private readonly _issue = computed(() => this._check(this._model(), this._edited()));\n readonly invalid = computed(() => !!this.error() || !!this._issue());\n readonly errorMessage = computed(() => this._issue()?.message ?? '');\n protected readonly _activeError = computed(() => this._reveal.revealed() ? (this.error() || this.errorMessage()) : '');\n\n private readonly _valid = computed(() => normalizeHexColor(this._model(), this.allowAlpha()));\n /** Colour of the preview square: the value when it is a usable hex, otherwise transparent. */\n protected readonly _swatchColor = computed(() => this._valid() ?? 'transparent');\n /** Value for the native picker: always `#rrggbb`. */\n protected readonly _nativeValue = computed(() => (this._valid() ?? '#000000').slice(0, 7));\n\n private readonly _uid = nextColorId++;\n protected readonly _textId = `co-text-${this._uid}`;\n protected readonly _nativeId = `co-native-${this._uid}`;\n protected readonly _descId = `co-desc-${this._uid}`;\n\n private _onChange = (_: string) => {};\n private _onTouched = () => {};\n private _onValidatorChange = () => {};\n\n constructor() {\n effect(() => { this.invalidChange.emit(this.invalid()); });\n }\n\n /** Re-run the form control's validation when a rule input (required, allowAlpha, ...) changes. */\n ngOnChanges() { this._onValidatorChange(); }\n\n writeValue(val: string | null) {\n const text = val == null ? '' : String(val);\n this._model.set(text);\n this._text.set(text);\n this._edited.set(false);\n }\n registerOnChange(fn: (v: string) => void) { this._onChange = fn; }\n registerOnTouched(fn: () => void) { this._onTouched = fn; }\n registerOnValidatorChange(fn: () => void) { this._onValidatorChange = fn; }\n setDisabledState(d: boolean) { this._cvaDisabled.set(d); }\n\n validate(control: AbstractControl): ValidationErrors | null {\n const v = control.value;\n return issueToErrors(this._check(v == null ? '' : String(v), this._edited()));\n }\n\n protected onTextInput(event: Event) {\n const el = event.target as HTMLInputElement;\n let raw = el.value.trim();\n if (raw && !raw.startsWith('#')) raw = '#' + raw;\n if (raw === '#') raw = '';\n if (el.value !== raw) el.value = raw;\n this._text.set(raw);\n this._commit(normalizeHexColor(raw, this.allowAlpha()) ?? raw);\n }\n\n protected onNativeInput(event: Event) {\n const picked = (event.target as HTMLInputElement).value.toLowerCase();\n const current = this._valid();\n // Keep the alpha digits of an 8-digit value when the user only changes the colour.\n const next = this.allowAlpha() && current && current.length === 9 ? picked + current.slice(7) : picked;\n this._text.set(next);\n this._commit(next);\n }\n\n protected selectPreset(p: ColorPreset) {\n const next = normalizeHexColor(p.value, this.allowAlpha()) ?? p.value;\n this._text.set(next);\n this._commit(next);\n }\n\n protected _isSelected(p: ColorPreset): boolean {\n const a = normalizeHexColor(p.value, this.allowAlpha());\n return !!a && a === this._valid();\n }\n protected _presetColor(p: ColorPreset): string {\n return normalizeHexColor(p.value, this.allowAlpha()) ?? 'transparent';\n }\n\n protected onTextBlur() {\n const v = this._valid();\n if (this._edited() && v && this._text() !== v) this._text.set(v);\n this._touch();\n }\n /** Blur of the native picker only marks the field touched; it never rewrites the text. */\n protected onNativeBlur() { this._touch(); }\n\n private _touch() {\n this._onTouched();\n this._reveal.touched.set(true);\n }\n\n private _commit(value: string) {\n this._edited.set(true);\n this._model.set(value);\n this._onChange(value);\n }\n\n private _check(value: string, edited: boolean): FieldIssue | null {\n if (this.disabled()) return null;\n const text = value.trim();\n if (!text) return this.required() ? requiredIssue(this.label()) : null;\n if (!edited) return null;\n return normalizeHexColor(text, this.allowAlpha()) ? null : { key: 'color', message: this.labels.t('colorInput.invalidHex') };\n }\n}\n"],"mappings":";;;;AAKA,IAAI,cAAc;AAUlB,SAAgB,kBAAkB,OAAkC,aAAa,OAAK;CACpF,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,MAAM,IAAI,6CAA6C,KAAK,MAAM,KAAI,CAAE;CACxE,IAAI,CAAC,GAAG,OAAO;CACf,IAAI,MAAM,EAAE,EAAE,CAAC,YAAW;CAC1B,IAAI,IAAI,WAAW,KAAK,CAAC,YAAY,OAAO;CAC5C,IAAI,IAAI,WAAW,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC,CAAC,KAAI,MAAK,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE;CACjE,OAAO,MAAM;AACf;AA2KA,IAAa,sBAAb,MAAa,oBAAmB;CAsD9B,cAAA;EArDmB,KAAA,SAAS,OAAO,eAAe;EACzC,KAAA,QAAc,MAAM,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;EAEvB,KAAA,YAAc,MAAM,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;EACvB,KAAA,cAAc,MAAM,WAAU,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;EAC9B,KAAA,WAAc,MAAM,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;EAC1B,KAAA,OAAc,MAAM,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;EAEvB,KAAA,QAAc,MAAM,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QA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AAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAgB,YACd;GAAI,iBACC,wBAAwB;GAAM,WACpC;IACT;KAAE,SAAS;KAAmB,aAAa,iBAAgB,mBAAoB;KAAG,OAAO;IAAI;IAC7F;KAAE,SAAS;KAAe,aAAa,iBAAgB,mBAAoB;KAAG,OAAO;IAAI;IACzF;KAAE,SAAS;KAAiB,aAAa,iBAAgB,mBAAoB;IAAC;GAC/E;GAAA,UACS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqET,QAAA,CAAA,ogFAAA;EAAA,CAAA"}
|
|
@@ -514,7 +514,7 @@ var ComboboxComponent = class ComboboxComponent {
|
|
|
514
514
|
</div>
|
|
515
515
|
`,
|
|
516
516
|
isInline: true,
|
|
517
|
-
styles: [":host{display:block}.cb-field{display:flex;flex-direction:column;gap:6px}.cb-label{font-size:.8125rem;font-weight:600;color:#374151;line-height:1}.cb-required{color:#dc2626;margin-left:2px}.cb-control{position:relative}.cb-input{width:100%;box-sizing:border-box;padding:9px 12px;font-size:.875rem;font-family:inherit;color:#1e293b;background:#fff;border:1px solid #7c8ba1;border-radius:8px;outline:none;transition:border-color .15s,box-shadow .15s}.cb-input::placeholder{color:#64748b;opacity:1}.cb-input:focus{border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61f}.cb-has-clear{padding-right:40px}.cb-warning .cb-input{border-color:#f59e0b;background:#fffbeb}.cb-error .cb-input{border-color:#ef4444}.cb-error .cb-input:focus{box-shadow:0 0 0 3px #ef44441f}.cb-disabled .cb-input{opacity:.5;cursor:not-allowed}.cb-clear{position:absolute;top:50%;right:4px;transform:translateY(-50%);border:0;background:transparent;cursor:pointer;color:#64748b;font-size:1.25rem;line-height:1;min-width:32px;min-height:32px;padding:0 8px;border-radius:6px}.cb-clear:hover{color:#0f172a}.cb-clear:focus-visible{outline:2px solid #3b82f6}.cb-popup{position:absolute;z-index:30;left:0;right:0;top:100%;margin-top:4px;box-sizing:border-box;max-width:100%;max-height:min(260px,40vh);overflow-y:auto;overscroll-behavior:contain;background:#fff;border:1px solid #e2e8f0;border-radius:8px;box-shadow:0 8px 24px #0f172a1f}.cb-list:empty{display:none}.cb-status{padding:12px;font-size:.875rem;color:#64748b}.cb-option{display:flex;flex-direction:column;gap:2px;padding:8px 12px;min-height:40px;justify-content:center;box-sizing:border-box;cursor:pointer}.cb-option-active{background:#eff6ff}.cb-option-selected .cb-option-label{font-weight:600}.cb-option-disabled{opacity:.5;cursor:not-allowed}.cb-option-label{font-size:.875rem;color:#0f172a;overflow-wrap:anywhere}.cb-option-desc{font-size:.75rem;color:#64748b;overflow-wrap:anywhere}.cb-desc{margin
|
|
517
|
+
styles: [":host{display:block}.cb-field{display:flex;flex-direction:column;gap:6px}.cb-label{font-size:.8125rem;font-weight:600;color:#374151;line-height:1}.cb-required{color:#dc2626;margin-left:2px}.cb-control{position:relative}.cb-input{width:100%;box-sizing:border-box;padding:9px 12px;font-size:.875rem;font-family:inherit;color:#1e293b;background:#fff;border:1px solid #7c8ba1;border-radius:8px;outline:none;transition:border-color .15s,box-shadow .15s}.cb-input::placeholder{color:#64748b;opacity:1}.cb-input:focus{border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61f}.cb-has-clear{padding-right:40px}.cb-warning .cb-input{border-color:#f59e0b;background:#fffbeb}.cb-error .cb-input{border-color:#ef4444}.cb-error .cb-input:focus{box-shadow:0 0 0 3px #ef44441f}.cb-disabled .cb-input{opacity:.5;cursor:not-allowed}.cb-clear{position:absolute;top:50%;right:4px;transform:translateY(-50%);border:0;background:transparent;cursor:pointer;color:#64748b;font-size:1.25rem;line-height:1;min-width:32px;min-height:32px;padding:0 8px;border-radius:6px}.cb-clear:hover{color:#0f172a}.cb-clear:focus-visible{outline:2px solid #3b82f6}.cb-popup{position:absolute;z-index:30;left:0;right:0;top:100%;margin-top:4px;box-sizing:border-box;max-width:100%;max-height:min(260px,40vh);overflow-y:auto;overscroll-behavior:contain;background:#fff;border:1px solid #e2e8f0;border-radius:8px;box-shadow:0 8px 24px #0f172a1f}.cb-list:empty{display:none}.cb-status{padding:12px;font-size:.875rem;color:#64748b}.cb-option{display:flex;flex-direction:column;gap:2px;padding:8px 12px;min-height:40px;justify-content:center;box-sizing:border-box;cursor:pointer}.cb-option-active{background:#eff6ff}.cb-option-selected .cb-option-label{font-weight:600}.cb-option-disabled{opacity:.5;cursor:not-allowed}.cb-option-label{font-size:.875rem;color:#0f172a;overflow-wrap:anywhere}.cb-option-desc{font-size:.75rem;color:#64748b;overflow-wrap:anywhere}.cb-desc{margin:-6px 0 0;font-size:.75rem;line-height:1.4;color:#64748b}.cb-desc-error{color:#dc2626}.cb-live{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}@media(prefers-reduced-motion:reduce){.cb-input{transition:none}}@media(forced-colors:active){.cb-input:focus{outline:2px solid Highlight;outline-offset:1px}.cb-option-active{outline:2px solid Highlight;outline-offset:-2px}}@media(pointer:coarse),(max-width:480px){.cb-input{min-height:44px}.cb-clear{min-width:44px;min-height:44px}}@media(pointer:coarse){.cb-option{min-height:44px}}@media(max-width:480px){.cb-input{font-size:1rem}.cb-option{min-height:44px}}\n"],
|
|
518
518
|
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
519
519
|
});
|
|
520
520
|
}
|
|
@@ -618,7 +618,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
618
618
|
}
|
|
619
619
|
</div>
|
|
620
620
|
`,
|
|
621
|
-
styles: [":host{display:block}.cb-field{display:flex;flex-direction:column;gap:6px}.cb-label{font-size:.8125rem;font-weight:600;color:#374151;line-height:1}.cb-required{color:#dc2626;margin-left:2px}.cb-control{position:relative}.cb-input{width:100%;box-sizing:border-box;padding:9px 12px;font-size:.875rem;font-family:inherit;color:#1e293b;background:#fff;border:1px solid #7c8ba1;border-radius:8px;outline:none;transition:border-color .15s,box-shadow .15s}.cb-input::placeholder{color:#64748b;opacity:1}.cb-input:focus{border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61f}.cb-has-clear{padding-right:40px}.cb-warning .cb-input{border-color:#f59e0b;background:#fffbeb}.cb-error .cb-input{border-color:#ef4444}.cb-error .cb-input:focus{box-shadow:0 0 0 3px #ef44441f}.cb-disabled .cb-input{opacity:.5;cursor:not-allowed}.cb-clear{position:absolute;top:50%;right:4px;transform:translateY(-50%);border:0;background:transparent;cursor:pointer;color:#64748b;font-size:1.25rem;line-height:1;min-width:32px;min-height:32px;padding:0 8px;border-radius:6px}.cb-clear:hover{color:#0f172a}.cb-clear:focus-visible{outline:2px solid #3b82f6}.cb-popup{position:absolute;z-index:30;left:0;right:0;top:100%;margin-top:4px;box-sizing:border-box;max-width:100%;max-height:min(260px,40vh);overflow-y:auto;overscroll-behavior:contain;background:#fff;border:1px solid #e2e8f0;border-radius:8px;box-shadow:0 8px 24px #0f172a1f}.cb-list:empty{display:none}.cb-status{padding:12px;font-size:.875rem;color:#64748b}.cb-option{display:flex;flex-direction:column;gap:2px;padding:8px 12px;min-height:40px;justify-content:center;box-sizing:border-box;cursor:pointer}.cb-option-active{background:#eff6ff}.cb-option-selected .cb-option-label{font-weight:600}.cb-option-disabled{opacity:.5;cursor:not-allowed}.cb-option-label{font-size:.875rem;color:#0f172a;overflow-wrap:anywhere}.cb-option-desc{font-size:.75rem;color:#64748b;overflow-wrap:anywhere}.cb-desc{margin
|
|
621
|
+
styles: [":host{display:block}.cb-field{display:flex;flex-direction:column;gap:6px}.cb-label{font-size:.8125rem;font-weight:600;color:#374151;line-height:1}.cb-required{color:#dc2626;margin-left:2px}.cb-control{position:relative}.cb-input{width:100%;box-sizing:border-box;padding:9px 12px;font-size:.875rem;font-family:inherit;color:#1e293b;background:#fff;border:1px solid #7c8ba1;border-radius:8px;outline:none;transition:border-color .15s,box-shadow .15s}.cb-input::placeholder{color:#64748b;opacity:1}.cb-input:focus{border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61f}.cb-has-clear{padding-right:40px}.cb-warning .cb-input{border-color:#f59e0b;background:#fffbeb}.cb-error .cb-input{border-color:#ef4444}.cb-error .cb-input:focus{box-shadow:0 0 0 3px #ef44441f}.cb-disabled .cb-input{opacity:.5;cursor:not-allowed}.cb-clear{position:absolute;top:50%;right:4px;transform:translateY(-50%);border:0;background:transparent;cursor:pointer;color:#64748b;font-size:1.25rem;line-height:1;min-width:32px;min-height:32px;padding:0 8px;border-radius:6px}.cb-clear:hover{color:#0f172a}.cb-clear:focus-visible{outline:2px solid #3b82f6}.cb-popup{position:absolute;z-index:30;left:0;right:0;top:100%;margin-top:4px;box-sizing:border-box;max-width:100%;max-height:min(260px,40vh);overflow-y:auto;overscroll-behavior:contain;background:#fff;border:1px solid #e2e8f0;border-radius:8px;box-shadow:0 8px 24px #0f172a1f}.cb-list:empty{display:none}.cb-status{padding:12px;font-size:.875rem;color:#64748b}.cb-option{display:flex;flex-direction:column;gap:2px;padding:8px 12px;min-height:40px;justify-content:center;box-sizing:border-box;cursor:pointer}.cb-option-active{background:#eff6ff}.cb-option-selected .cb-option-label{font-weight:600}.cb-option-disabled{opacity:.5;cursor:not-allowed}.cb-option-label{font-size:.875rem;color:#0f172a;overflow-wrap:anywhere}.cb-option-desc{font-size:.75rem;color:#64748b;overflow-wrap:anywhere}.cb-desc{margin:-6px 0 0;font-size:.75rem;line-height:1.4;color:#64748b}.cb-desc-error{color:#dc2626}.cb-live{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}@media(prefers-reduced-motion:reduce){.cb-input{transition:none}}@media(forced-colors:active){.cb-input:focus{outline:2px solid Highlight;outline-offset:1px}.cb-option-active{outline:2px solid Highlight;outline-offset:-2px}}@media(pointer:coarse),(max-width:480px){.cb-input{min-height:44px}.cb-clear{min-width:44px;min-height:44px}}@media(pointer:coarse){.cb-option{min-height:44px}}@media(max-width:480px){.cb-input{font-size:1rem}.cb-option{min-height:44px}}\n"]
|
|
622
622
|
}]
|
|
623
623
|
}],
|
|
624
624
|
ctorParameters: () => [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forgeroute-ui-combobox.mjs","names":[],"sources":["../../../projects/forgeroute-ui/combobox/src/lib/combobox/combobox.component.ts"],"sourcesContent":["import {\n Component, ChangeDetectionStrategy, DestroyRef, ElementRef, Injector, afterNextRender, computed, effect, forwardRef,\n inject, input, linkedSignal, output, signal, untracked, viewChild,\n} from '@angular/core';\nimport { AbstractControl, ControlValueAccessor, NG_VALIDATORS, NG_VALUE_ACCESSOR, ValidationErrors, Validator } from '@angular/forms';\nimport { FieldIssue, UiFieldValidity, createFieldReveal, issueToErrors, requiredIssue } from '@forgeroute/ui/core';\nimport { UiLabelsService } from '@forgeroute/ui/core';\n\n/** One selectable row. `data` carries any host payload (a typed record, an id, ...) back through `(valueChange)`. */\nexport interface ComboboxOption<T = unknown> {\n value: string;\n label: string;\n /** Secondary line under the label (trade, customer name, ...). */\n description?: string;\n disabled?: boolean;\n data?: T;\n}\n\n/** The selected value: what `[value]` and `ngModel` / `FormControl` hold. */\nexport interface ComboboxSelection { value: string; label: string }\n\nlet nextComboboxId = 0;\n\n/**\n * Search-as-you-type single select (WAI-ARIA 1.2 combobox with listbox popup). The HOST fetches: the combobox emits\n * `(searchChange)` with the typed term (debounced) and renders whatever `[options]` currently is, so a host using\n * `switchMap` is race-safe and a stale array never \"sticks\" (the active option is re-validated on every change).\n *\n * ## API\n * - `[options]` `ComboboxOption[]` current results (`{ value, label, description?, disabled?, data? }`).\n * - `[value]` `{ value, label } | null` the selection. Also what `ngModel` / `formControl` hold (same shape).\n * - `[displayText]` text shown in the field instead of the selected label — use it for legacy / orphaned links:\n * `displayText=\"Not linked: Legacy Co\"` (with `[value]=\"null\"`) or `displayText=\"Acme (no longer exists)\"`.\n * Pair it with `[displayWarning]=\"true\"` for the amber \"needs attention\" style. A `displayText` with no `value` is\n * shown and has a clear button, but counts as EMPTY for `required`.\n * - `[loading]` shows \"Searching…\" and announces it. `[noResultsText]` (default \"No results found\").\n * - `[minChars]` (default 0): below it nothing is searched or listed (\"Type at least N characters\"). 0 = the list opens\n * on focus and `(searchChange)` fires with '' so the host can show its initial results.\n * - `[hideMinCharsHint]` (default false, added 2026-11-22): with a `minChars` above 0, do not open the dropdown at all until the minimum is typed, so no \"Type at least N characters\" line shows (a picker that must\n * list nothing up front). Searching and listing are unchanged; only the empty dropdown with that prompt is not drawn. Default = the prompt shows as before.\n * - `[debounce]` ms between the last keystroke and `(searchChange)` (default 250). Focus / ArrowDown-open emit immediately.\n * - `[label] [ariaLabel] [placeholder] [required] [hint] [error] [disabled] [showErrors]` like `ui-text-input`\n * (host `[error]` wins over the built-in \"<label> is required.\"; messages (built-in and host) show only after the user left the field, `showErrors` also reveals it on an untouched field).\n * - `(searchChange)` string, `(valueChange)` `ComboboxOption | null` (the full chosen option, null when cleared),\n * `(invalidChange)` boolean, `(focused)`, `(blurred)`. Validity: `UiFieldValidity` token + Angular `Validator`.\n *\n * ## Behaviour\n * - The field shows the selected label. Focusing it selects that text; typing starts a NEW search and the old value is\n * kept until another option is picked or the clear (x) button is pressed. Leaving the field (blur / Tab / Escape)\n * discards the typed text and shows the selection again.\n * - Escape: if the list is open it closes the list ONLY (stopPropagation, so a surrounding side panel / modal stays\n * open). If the list is already closed and text was typed, it discards the text (also stopped). Otherwise the key\n * passes through to the panel.\n * - Tab never selects: it closes the list and moves on.\n *\n * ## Keyboard\n * ArrowDown / ArrowUp open the list and move the active option (wraps, skips disabled). Home / End jump to the first /\n * last option while the list is open. Enter picks the active option (and does not submit a surrounding form while open).\n * Escape / Tab as above. Typing opens the list. Mouse: options are picked on mousedown so blur does not swallow it.\n *\n * ## ARIA\n * The inner `<input>` is `role=\"combobox\"` with `aria-expanded`, `aria-controls` (the listbox, while open),\n * `aria-autocomplete=\"list\"`, `aria-activedescendant`, `aria-invalid`, `aria-required`, `aria-describedby` (hint / error);\n * the `<label for>` names it. The popup is `role=\"listbox\"` of `role=\"option\"` rows (`aria-selected` = active row,\n * stable ids). A polite `role=\"status\"` region announces \"Searching\", \"N results available\" or the no-results text.\n *\n * ## Example\n * ```html\n * <ui-combobox label=\"Subcontractor\" [required]=\"true\" [options]=\"opts()\" [loading]=\"loading()\"\n * [value]=\"sub()\" [displayText]=\"legacyName() ? 'Not linked: ' + legacyName() : ''\" [error]=\"err()\"\n * (searchChange)=\"search$.next($event)\" (valueChange)=\"onPick($event)\" />\n * ```\n */\n@Component({\n selector: 'ui-combobox',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [{\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => ComboboxComponent),\n multi: true,\n }, {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => ComboboxComponent),\n multi: true,\n }, {\n provide: UiFieldValidity,\n useExisting: forwardRef(() => ComboboxComponent),\n }],\n template: `\n <div class=\"cb-field\" [class.cb-error]=\"_activeError()\" [class.cb-disabled]=\"disabled()\" [class.cb-warning]=\"displayWarning()\">\n @if (label()) {\n <label class=\"cb-label\" [for]=\"_inputId\">\n {{ label() }}\n @if (required()) { <span class=\"cb-required\" aria-hidden=\"true\">*</span> }\n </label>\n }\n <div class=\"cb-control\">\n <input\n #field\n class=\"cb-input\"\n type=\"text\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n autocomplete=\"off\"\n [id]=\"_inputId\"\n [class.cb-has-clear]=\"_showClear()\"\n [placeholder]=\"placeholder()\"\n [value]=\"_inputText()\"\n [disabled]=\"disabled()\"\n [attr.aria-disabled]=\"disabled() ? 'true' : null\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-expanded]=\"_popupVisible() ? 'true' : 'false'\"\n [attr.aria-controls]=\"_popupVisible() ? _listId : null\"\n [attr.aria-activedescendant]=\"_activeDescendant()\"\n [attr.aria-invalid]=\"_activeError() ? 'true' : null\"\n [attr.aria-required]=\"required() || null\"\n [attr.aria-describedby]=\"(_activeError() || hint()) ? _descId : null\"\n (input)=\"onInput($event)\"\n (focus)=\"onFocus($event)\"\n (click)=\"onClick()\"\n (blur)=\"onBlur()\"\n (keydown)=\"onKeydown($event)\"\n />\n @if (_showClear()) {\n <button type=\"button\" class=\"cb-clear\" data-testid=\"combobox-clear\" [attr.aria-label]=\"labels.t('combobox.clearNamed', { name: label() || ariaLabel() || labels.t('combobox.selection') })\"\n (mousedown)=\"$event.preventDefault()\" (click)=\"clear()\">×</button>\n }\n @if (_popupVisible()) {\n <div class=\"cb-popup\" (mousedown)=\"$event.preventDefault()\">\n <div class=\"cb-list\" role=\"listbox\" [id]=\"_listId\" [attr.aria-label]=\"label() || ariaLabel() || null\">\n @if (_belowMin() === false) {\n @for (o of options(); track o.value; let i = $index) {\n <div class=\"cb-option\" role=\"option\" [id]=\"_optionId(i)\"\n [class.cb-option-active]=\"i === _activeIndex()\"\n [class.cb-option-disabled]=\"o.disabled\"\n [class.cb-option-selected]=\"o.value === _selected()?.value\"\n [attr.aria-selected]=\"i === _activeIndex() ? 'true' : 'false'\"\n [attr.aria-disabled]=\"o.disabled ? 'true' : null\"\n (mousedown)=\"onOptionMouseDown($event, o)\"\n (mousemove)=\"onOptionHover(i, o)\">\n <span class=\"cb-option-label\">{{ o.label }}</span>\n @if (o.description) { <span class=\"cb-option-desc\">{{ o.description }}</span> }\n </div>\n }\n }\n </div>\n @if (_statusText(); as status) {\n <div class=\"cb-status\" data-testid=\"combobox-status\">{{ status }}</div>\n }\n </div>\n }\n </div>\n <span class=\"cb-live\" role=\"status\" aria-live=\"polite\">{{ _liveText() }}</span>\n @if (_activeError()) {\n <p class=\"cb-desc cb-desc-error\" [id]=\"_descId\" role=\"alert\">{{ _activeError() }}</p>\n } @else if (hint()) {\n <p class=\"cb-desc\" [id]=\"_descId\">{{ hint() }}</p>\n }\n </div>\n `,\n styles: [`\n :host { display: block; }\n\n .cb-field { display: flex; flex-direction: column; gap: 6px; }\n .cb-label { font-size: 0.8125rem; font-weight: 600; color: #374151; line-height: 1; }\n .cb-required { color: #dc2626; margin-left: 2px; }\n\n .cb-control { position: relative; }\n .cb-input {\n width: 100%; box-sizing: border-box;\n padding: 9px 12px; font-size: 0.875rem; font-family: inherit;\n color: #1e293b; background: #fff;\n border: 1px solid #7c8ba1; border-radius: 8px;\n outline: none; transition: border-color 0.15s, box-shadow 0.15s;\n &::placeholder { color: #64748b; opacity: 1; }\n &:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12); }\n }\n .cb-has-clear { padding-right: 40px; }\n\n .cb-warning .cb-input { border-color: #f59e0b; background: #fffbeb; }\n .cb-error .cb-input {\n border-color: #ef4444;\n &:focus { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12); }\n }\n .cb-disabled .cb-input { opacity: 0.5; cursor: not-allowed; }\n\n .cb-clear {\n position: absolute; top: 50%; right: 4px; transform: translateY(-50%);\n border: 0; background: transparent; cursor: pointer; color: #64748b;\n font-size: 1.25rem; line-height: 1; min-width: 32px; min-height: 32px; padding: 0 8px; border-radius: 6px;\n &:hover { color: #0f172a; }\n &:focus-visible { outline: 2px solid #3b82f6; }\n }\n\n .cb-popup {\n position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin-top: 4px; box-sizing: border-box;\n max-width: 100%; max-height: min(260px, 40vh); overflow-y: auto; overscroll-behavior: contain;\n background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);\n }\n .cb-list:empty { display: none; }\n .cb-status { padding: 12px; font-size: 0.875rem; color: #64748b; }\n .cb-option {\n display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; min-height: 40px; justify-content: center;\n box-sizing: border-box; cursor: pointer;\n }\n .cb-option-active { background: #eff6ff; }\n .cb-option-selected .cb-option-label { font-weight: 600; }\n .cb-option-disabled { opacity: 0.5; cursor: not-allowed; }\n .cb-option-label { font-size: 0.875rem; color: #0f172a; overflow-wrap: anywhere; }\n .cb-option-desc { font-size: 0.75rem; color: #64748b; overflow-wrap: anywhere; }\n\n .cb-desc { margin: 0; font-size: 0.75rem; line-height: 1.4; color: #64748b; }\n .cb-desc-error { color: #dc2626; }\n\n .cb-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }\n\n /* Reduced motion: no transition on the field. Forced colors (Windows high contrast) drop box-shadow, so the focus\n ring and the active option fall back to real outlines. */\n @media (prefers-reduced-motion: reduce) { .cb-input { transition: none; } }\n @media (forced-colors: active) {\n .cb-input:focus { outline: 2px solid Highlight; outline-offset: 1px; }\n .cb-option-active { outline: 2px solid Highlight; outline-offset: -2px; }\n }\n\n /* Touch targets: the field and its clear (x) button are at least 44px on touch devices and phones. */\n @media (pointer: coarse), (max-width: 480px) {\n .cb-input { min-height: 44px; }\n .cb-clear { min-width: 44px; min-height: 44px; }\n }\n @media (pointer: coarse) { .cb-option { min-height: 44px; } }\n @media (max-width: 480px) {\n .cb-input { font-size: 1rem; }\n .cb-option { min-height: 44px; }\n }\n `],\n})\nexport class ComboboxComponent<T = unknown> implements ControlValueAccessor, Validator, UiFieldValidity {\n protected readonly labels = inject(UiLabelsService);\n readonly label = input('');\n /** Accessible name for a field with no visible label. */\n readonly ariaLabel = input('');\n readonly placeholder = input('');\n readonly required = input(false);\n readonly hint = input('');\n /** Host error message; always wins over the built-in message. */\n readonly error = input('');\n readonly showErrors = input(false);\n /** Current results (host-owned). */\n readonly options = input<ComboboxOption<T>[]>([]);\n readonly loading = input(false);\n readonly noResultsTextInput = input<string | null>(null, { alias: 'noResultsText' });\n readonly noResultsText = computed(() => this.noResultsTextInput() ?? this.labels.t('combobox.noResultsText'));\n /** Characters needed before searching / listing. 0 = open on focus. */\n readonly minChars = input(0);\n readonly hideMinCharsHint = input(false);\n /** Milliseconds between the last keystroke and `(searchChange)`. */\n readonly debounce = input(250);\n /** The selection. */\n readonly value = input<ComboboxSelection | null>(null);\n /** Text shown instead of the selected label (legacy / orphaned links). */\n readonly displayText = input('');\n /** Amber style for a legacy / orphaned `displayText`. */\n readonly displayWarning = input(false);\n\n /** Typed term, debounced (immediate on focus / open). */\n readonly searchChange = output<string>();\n /** The chosen option, or null when cleared. */\n readonly valueChange = output<ComboboxOption<T> | null>();\n readonly invalidChange = output<boolean>();\n readonly focused = output<void>();\n readonly blurred = output<void>();\n\n /** Disables the field (`[disabled]=\"x()\"`). Public so templates compile; ngModel / FormControl `disable()` still works (effective disabled = this OR the forms API). */\n readonly _disabledInput = input(false, { alias: 'disabled' });\n private readonly _cvaDisabled = signal(false);\n protected readonly disabled = computed(() => this._disabledInput() || this._cvaDisabled());\n\n private readonly _field = viewChild<ElementRef<HTMLInputElement>>('field');\n private readonly _host = inject(ElementRef) as ElementRef<HTMLElement>;\n private readonly _injector = inject(Injector);\n private readonly _destroyRef = inject(DestroyRef);\n\n /** Follows `[value]`; ngModel / formControl writes and user picks override it until `[value]` changes. */\n protected readonly _selected = linkedSignal<ComboboxSelection | null>(() => this.value());\n private readonly _text = signal('');\n private readonly _editing = signal(false);\n protected readonly _open = signal(false);\n /** Reset to the first enabled option whenever `[options]` changes, so a stale index never survives new results. */\n protected readonly _activeIndex = linkedSignal<ComboboxOption<T>[], number>({\n source: this.options,\n computation: opts => this._firstEnabled(opts),\n });\n\n protected readonly _uid = ++nextComboboxId;\n protected readonly _inputId = `cb-${this._uid}`;\n protected readonly _listId = `cb-list-${this._uid}`;\n protected readonly _descId = `cb-desc-${this._uid}`;\n\n private readonly _reveal = createFieldReveal(this.showErrors);\n private readonly _issue = computed(() => this._check(this._selected()));\n readonly invalid = computed(() => !!this.error() || !!this._issue());\n readonly errorMessage = computed(() => this._issue()?.message ?? '');\n protected readonly _activeError = computed(() => this._reveal.revealed() ? (this.error() || this.errorMessage()) : '');\n\n protected readonly _inputText = computed(() =>\n this._editing() ? this._text() : (this.displayText() || this._selected()?.label || ''));\n protected readonly _showClear = computed(() => !this.disabled() && !this._editing() && !!(this._selected() || this.displayText()));\n protected readonly _belowMin = computed(() => this._term().length < this.minChars());\n /** The dropdown is drawn: open, except below the minimum when the host asked not to show the \"Type at least N characters\" prompt. */\n protected readonly _popupVisible = computed(() => this._open() && !(this.hideMinCharsHint() && this._belowMin()));\n protected readonly _statusText = computed(() => {\n if (this._belowMin()) return this.labels.t(this.minChars() === 1 ? 'combobox.typeAtLeast_one' : 'combobox.typeAtLeast_other', { count: this.minChars() });\n if (this.loading()) return this.labels.t('search.searching') + '…';\n return this.options().length === 0 ? this.noResultsText() : '';\n });\n protected readonly _liveText = computed(() => {\n if (!this._open() || this._belowMin()) return '';\n if (this.loading()) return this.labels.t('search.searching');\n const n = this.options().length;\n if (n === 0) return this.noResultsText();\n return this.labels.t(n === 1 ? 'combobox.resultsAvailable_one' : 'combobox.resultsAvailable_other', { count: n });\n });\n protected readonly _activeDescendant = computed(() => {\n const i = this._activeIndex();\n return this._open() && !this._belowMin() && i >= 0 && i < this.options().length ? this._optionId(i) : null;\n });\n\n private _debounceTimer: ReturnType<typeof setTimeout> | null = null;\n private _onChange = (_: ComboboxSelection | null) => {};\n private _onTouched = () => {};\n private _onValidatorChange = () => {};\n\n constructor() {\n effect(() => { this.invalidChange.emit(this.invalid()); });\n // Becoming disabled closes an open list, drops a pending search and discards typed text.\n effect(() => { if (this.disabled()) untracked(() => { this._cancelTimer(); this._open.set(false); this._editing.set(false); this._text.set(''); }); });\n this._destroyRef.onDestroy(() => this._cancelTimer());\n }\n\n ngOnChanges() { this._onValidatorChange(); }\n\n // ── CVA / Validator ───────────────────────────────────────────────\n writeValue(val: ComboboxSelection | null) { this._selected.set(val ?? null); }\n validate(control: AbstractControl): ValidationErrors | null {\n return issueToErrors(this._check((control.value as ComboboxSelection | null) ?? null));\n }\n registerOnValidatorChange(fn: () => void) { this._onValidatorChange = fn; }\n registerOnChange(fn: (v: ComboboxSelection | null) => void) { this._onChange = fn; }\n registerOnTouched(fn: () => void) { this._onTouched = fn; }\n setDisabledState(d: boolean) { this._cvaDisabled.set(d); }\n\n private _check(sel: ComboboxSelection | null): FieldIssue | null {\n if (this.disabled()) return null;\n return !sel && this.required() ? requiredIssue(this.label()) : null;\n }\n\n // ── Helpers ───────────────────────────────────────────────────────\n /** What the user typed (trimmed); '' while not editing. */\n private _term(): string { return this._editing() ? this._text().trim() : ''; }\n protected _optionId(i: number) { return `${this._listId}-opt-${i}`; }\n private _firstEnabled(opts: ComboboxOption<T>[]) { return opts.findIndex(o => !o.disabled); }\n\n private _emitSearch() { this._cancelTimer(); if (!this._belowMin()) this.searchChange.emit(this._term()); }\n private _cancelTimer() { if (this._debounceTimer != null) { clearTimeout(this._debounceTimer); this._debounceTimer = null; } }\n\n private _revert() { this._cancelTimer(); this._editing.set(false); this._text.set(''); }\n\n private _openList() {\n if (this.disabled()) return;\n if (!this._open()) { this._open.set(true); this._emitSearch(); }\n }\n\n private _move(dir: 1 | -1) {\n const opts = this.options();\n if (!opts.length || opts.every(o => o.disabled)) return;\n let i = this._activeIndex();\n for (let step = 0; step < opts.length; step++) {\n i = ((i < 0 ? (dir === 1 ? -1 : 0) : i) + dir + opts.length) % opts.length;\n if (!opts[i].disabled) break;\n }\n this._setActive(i);\n }\n\n private _setActive(i: number) {\n this._activeIndex.set(i);\n afterNextRender(() => {\n const el = this._host.nativeElement.querySelector(`#${this._optionId(i)}`) as HTMLElement | null;\n if (el && typeof el.scrollIntoView === 'function') el.scrollIntoView({ block: 'nearest' });\n }, { injector: this._injector });\n }\n\n // ── Events ────────────────────────────────────────────────────────\n protected onInput(event: Event) {\n if (this.disabled()) return;\n this._text.set((event.target as HTMLInputElement).value);\n this._editing.set(true);\n this._open.set(true);\n this._cancelTimer();\n if (this._belowMin()) return;\n this._debounceTimer = setTimeout(() => { this._debounceTimer = null; this._emitSearch(); }, this.debounce());\n }\n\n protected onFocus(event: FocusEvent) {\n this.focused.emit();\n const el = event.target as HTMLInputElement;\n if (this._selected() || this.displayText()) el.select?.();\n this._openList();\n }\n\n protected onClick() { this._openList(); }\n\n protected onBlur() {\n this._open.set(false);\n this._revert();\n this._onTouched();\n this.blurred.emit();\n this._reveal.touched.set(true);\n }\n\n protected onKeydown(e: KeyboardEvent) {\n const opts = this.options();\n const listing = this._open() && !this._belowMin();\n switch (e.key) {\n case 'ArrowDown':\n case 'ArrowUp':\n if (this._open() && !this._popupVisible()) return;\n e.preventDefault();\n if (!this._open()) { this._openList(); return; }\n this._move(e.key === 'ArrowDown' ? 1 : -1);\n return;\n case 'Home':\n case 'End':\n if (listing && opts.length) {\n e.preventDefault();\n const idx = e.key === 'Home' ? opts.findIndex(o => !o.disabled) : opts.map(o => !o.disabled).lastIndexOf(true);\n if (idx >= 0) this._setActive(idx);\n }\n return;\n case 'Enter':\n if (this._popupVisible()) {\n e.preventDefault();\n const i = this._activeIndex();\n if (listing && i >= 0 && i < opts.length && !opts[i].disabled) this.choose(opts[i]);\n }\n return;\n case 'Escape':\n if (this._popupVisible()) { e.preventDefault(); e.stopPropagation(); this._cancelTimer(); this._open.set(false); }\n else if (this._editing()) { e.preventDefault(); e.stopPropagation(); this._revert(); }\n return;\n case 'Tab':\n this._open.set(false);\n return;\n }\n }\n\n protected onOptionMouseDown(e: MouseEvent, o: ComboboxOption<T>) {\n e.preventDefault();\n if (!o.disabled) this.choose(o);\n }\n\n protected onOptionHover(i: number, o: ComboboxOption<T>) {\n if (!o.disabled && i !== this._activeIndex()) this._activeIndex.set(i);\n }\n\n /** Select `o` (also callable by a host through a template ref). */\n choose(o: ComboboxOption<T>) {\n if (this.disabled()) return;\n const sel = { value: o.value, label: o.label };\n this._selected.set(sel);\n this._revert();\n this._open.set(false);\n this._onChange(sel);\n this.valueChange.emit(o);\n }\n\n /** Clear the selection (the x button). */\n clear() {\n if (this.disabled()) return;\n this._selected.set(null);\n this._revert();\n this._open.set(false);\n this._onChange(null);\n this.valueChange.emit(null);\n afterNextRender(() => this._field()?.nativeElement.focus(), { injector: this._injector });\n }\n}\n"],"mappings":";;;;AAqBA,IAAI,iBAAiB;AAwNrB,IAAa,oBAAb,MAAa,kBAAiB;CA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AA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,SAAA;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,SAAA;EAAA,CAAA;EAAA,gBAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,SAAO,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"forgeroute-ui-combobox.mjs","names":[],"sources":["../../../projects/forgeroute-ui/combobox/src/lib/combobox/combobox.component.ts"],"sourcesContent":["import {\n Component, ChangeDetectionStrategy, DestroyRef, ElementRef, Injector, afterNextRender, computed, effect, forwardRef,\n inject, input, linkedSignal, output, signal, untracked, viewChild,\n} from '@angular/core';\nimport { AbstractControl, ControlValueAccessor, NG_VALIDATORS, NG_VALUE_ACCESSOR, ValidationErrors, Validator } from '@angular/forms';\nimport { FieldIssue, UiFieldValidity, createFieldReveal, issueToErrors, requiredIssue } from '@forgeroute/ui/core';\nimport { UiLabelsService } from '@forgeroute/ui/core';\n\n/** One selectable row. `data` carries any host payload (a typed record, an id, ...) back through `(valueChange)`. */\nexport interface ComboboxOption<T = unknown> {\n value: string;\n label: string;\n /** Secondary line under the label (trade, customer name, ...). */\n description?: string;\n disabled?: boolean;\n data?: T;\n}\n\n/** The selected value: what `[value]` and `ngModel` / `FormControl` hold. */\nexport interface ComboboxSelection { value: string; label: string }\n\nlet nextComboboxId = 0;\n\n/**\n * Search-as-you-type single select (WAI-ARIA 1.2 combobox with listbox popup). The HOST fetches: the combobox emits\n * `(searchChange)` with the typed term (debounced) and renders whatever `[options]` currently is, so a host using\n * `switchMap` is race-safe and a stale array never \"sticks\" (the active option is re-validated on every change).\n *\n * ## API\n * - `[options]` `ComboboxOption[]` current results (`{ value, label, description?, disabled?, data? }`).\n * - `[value]` `{ value, label } | null` the selection. Also what `ngModel` / `formControl` hold (same shape).\n * - `[displayText]` text shown in the field instead of the selected label — use it for legacy / orphaned links:\n * `displayText=\"Not linked: Legacy Co\"` (with `[value]=\"null\"`) or `displayText=\"Acme (no longer exists)\"`.\n * Pair it with `[displayWarning]=\"true\"` for the amber \"needs attention\" style. A `displayText` with no `value` is\n * shown and has a clear button, but counts as EMPTY for `required`.\n * - `[loading]` shows \"Searching…\" and announces it. `[noResultsText]` (default \"No results found\").\n * - `[minChars]` (default 0): below it nothing is searched or listed (\"Type at least N characters\"). 0 = the list opens\n * on focus and `(searchChange)` fires with '' so the host can show its initial results.\n * - `[hideMinCharsHint]` (default false, added 2026-11-22): with a `minChars` above 0, do not open the dropdown at all until the minimum is typed, so no \"Type at least N characters\" line shows (a picker that must\n * list nothing up front). Searching and listing are unchanged; only the empty dropdown with that prompt is not drawn. Default = the prompt shows as before.\n * - `[debounce]` ms between the last keystroke and `(searchChange)` (default 250). Focus / ArrowDown-open emit immediately.\n * - `[label] [ariaLabel] [placeholder] [required] [hint] [error] [disabled] [showErrors]` like `ui-text-input`\n * (host `[error]` wins over the built-in \"<label> is required.\"; messages (built-in and host) show only after the user left the field, `showErrors` also reveals it on an untouched field).\n * - `(searchChange)` string, `(valueChange)` `ComboboxOption | null` (the full chosen option, null when cleared),\n * `(invalidChange)` boolean, `(focused)`, `(blurred)`. Validity: `UiFieldValidity` token + Angular `Validator`.\n *\n * ## Behaviour\n * - The field shows the selected label. Focusing it selects that text; typing starts a NEW search and the old value is\n * kept until another option is picked or the clear (x) button is pressed. Leaving the field (blur / Tab / Escape)\n * discards the typed text and shows the selection again.\n * - Escape: if the list is open it closes the list ONLY (stopPropagation, so a surrounding side panel / modal stays\n * open). If the list is already closed and text was typed, it discards the text (also stopped). Otherwise the key\n * passes through to the panel.\n * - Tab never selects: it closes the list and moves on.\n *\n * ## Keyboard\n * ArrowDown / ArrowUp open the list and move the active option (wraps, skips disabled). Home / End jump to the first /\n * last option while the list is open. Enter picks the active option (and does not submit a surrounding form while open).\n * Escape / Tab as above. Typing opens the list. Mouse: options are picked on mousedown so blur does not swallow it.\n *\n * ## ARIA\n * The inner `<input>` is `role=\"combobox\"` with `aria-expanded`, `aria-controls` (the listbox, while open),\n * `aria-autocomplete=\"list\"`, `aria-activedescendant`, `aria-invalid`, `aria-required`, `aria-describedby` (hint / error);\n * the `<label for>` names it. The popup is `role=\"listbox\"` of `role=\"option\"` rows (`aria-selected` = active row,\n * stable ids). A polite `role=\"status\"` region announces \"Searching\", \"N results available\" or the no-results text.\n *\n * ## Example\n * ```html\n * <ui-combobox label=\"Subcontractor\" [required]=\"true\" [options]=\"opts()\" [loading]=\"loading()\"\n * [value]=\"sub()\" [displayText]=\"legacyName() ? 'Not linked: ' + legacyName() : ''\" [error]=\"err()\"\n * (searchChange)=\"search$.next($event)\" (valueChange)=\"onPick($event)\" />\n * ```\n */\n@Component({\n selector: 'ui-combobox',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [{\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => ComboboxComponent),\n multi: true,\n }, {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => ComboboxComponent),\n multi: true,\n }, {\n provide: UiFieldValidity,\n useExisting: forwardRef(() => ComboboxComponent),\n }],\n template: `\n <div class=\"cb-field\" [class.cb-error]=\"_activeError()\" [class.cb-disabled]=\"disabled()\" [class.cb-warning]=\"displayWarning()\">\n @if (label()) {\n <label class=\"cb-label\" [for]=\"_inputId\">\n {{ label() }}\n @if (required()) { <span class=\"cb-required\" aria-hidden=\"true\">*</span> }\n </label>\n }\n <div class=\"cb-control\">\n <input\n #field\n class=\"cb-input\"\n type=\"text\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n autocomplete=\"off\"\n [id]=\"_inputId\"\n [class.cb-has-clear]=\"_showClear()\"\n [placeholder]=\"placeholder()\"\n [value]=\"_inputText()\"\n [disabled]=\"disabled()\"\n [attr.aria-disabled]=\"disabled() ? 'true' : null\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-expanded]=\"_popupVisible() ? 'true' : 'false'\"\n [attr.aria-controls]=\"_popupVisible() ? _listId : null\"\n [attr.aria-activedescendant]=\"_activeDescendant()\"\n [attr.aria-invalid]=\"_activeError() ? 'true' : null\"\n [attr.aria-required]=\"required() || null\"\n [attr.aria-describedby]=\"(_activeError() || hint()) ? _descId : null\"\n (input)=\"onInput($event)\"\n (focus)=\"onFocus($event)\"\n (click)=\"onClick()\"\n (blur)=\"onBlur()\"\n (keydown)=\"onKeydown($event)\"\n />\n @if (_showClear()) {\n <button type=\"button\" class=\"cb-clear\" data-testid=\"combobox-clear\" [attr.aria-label]=\"labels.t('combobox.clearNamed', { name: label() || ariaLabel() || labels.t('combobox.selection') })\"\n (mousedown)=\"$event.preventDefault()\" (click)=\"clear()\">×</button>\n }\n @if (_popupVisible()) {\n <div class=\"cb-popup\" (mousedown)=\"$event.preventDefault()\">\n <div class=\"cb-list\" role=\"listbox\" [id]=\"_listId\" [attr.aria-label]=\"label() || ariaLabel() || null\">\n @if (_belowMin() === false) {\n @for (o of options(); track o.value; let i = $index) {\n <div class=\"cb-option\" role=\"option\" [id]=\"_optionId(i)\"\n [class.cb-option-active]=\"i === _activeIndex()\"\n [class.cb-option-disabled]=\"o.disabled\"\n [class.cb-option-selected]=\"o.value === _selected()?.value\"\n [attr.aria-selected]=\"i === _activeIndex() ? 'true' : 'false'\"\n [attr.aria-disabled]=\"o.disabled ? 'true' : null\"\n (mousedown)=\"onOptionMouseDown($event, o)\"\n (mousemove)=\"onOptionHover(i, o)\">\n <span class=\"cb-option-label\">{{ o.label }}</span>\n @if (o.description) { <span class=\"cb-option-desc\">{{ o.description }}</span> }\n </div>\n }\n }\n </div>\n @if (_statusText(); as status) {\n <div class=\"cb-status\" data-testid=\"combobox-status\">{{ status }}</div>\n }\n </div>\n }\n </div>\n <span class=\"cb-live\" role=\"status\" aria-live=\"polite\">{{ _liveText() }}</span>\n @if (_activeError()) {\n <p class=\"cb-desc cb-desc-error\" [id]=\"_descId\" role=\"alert\">{{ _activeError() }}</p>\n } @else if (hint()) {\n <p class=\"cb-desc\" [id]=\"_descId\">{{ hint() }}</p>\n }\n </div>\n `,\n styles: [`\n :host { display: block; }\n\n .cb-field { display: flex; flex-direction: column; gap: 6px; }\n .cb-label { font-size: 0.8125rem; font-weight: 600; color: #374151; line-height: 1; }\n .cb-required { color: #dc2626; margin-left: 2px; }\n\n .cb-control { position: relative; }\n .cb-input {\n width: 100%; box-sizing: border-box;\n padding: 9px 12px; font-size: 0.875rem; font-family: inherit;\n color: #1e293b; background: #fff;\n border: 1px solid #7c8ba1; border-radius: 8px;\n outline: none; transition: border-color 0.15s, box-shadow 0.15s;\n &::placeholder { color: #64748b; opacity: 1; }\n &:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12); }\n }\n .cb-has-clear { padding-right: 40px; }\n\n .cb-warning .cb-input { border-color: #f59e0b; background: #fffbeb; }\n .cb-error .cb-input {\n border-color: #ef4444;\n &:focus { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12); }\n }\n .cb-disabled .cb-input { opacity: 0.5; cursor: not-allowed; }\n\n .cb-clear {\n position: absolute; top: 50%; right: 4px; transform: translateY(-50%);\n border: 0; background: transparent; cursor: pointer; color: #64748b;\n font-size: 1.25rem; line-height: 1; min-width: 32px; min-height: 32px; padding: 0 8px; border-radius: 6px;\n &:hover { color: #0f172a; }\n &:focus-visible { outline: 2px solid #3b82f6; }\n }\n\n .cb-popup {\n position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin-top: 4px; box-sizing: border-box;\n max-width: 100%; max-height: min(260px, 40vh); overflow-y: auto; overscroll-behavior: contain;\n background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);\n }\n .cb-list:empty { display: none; }\n .cb-status { padding: 12px; font-size: 0.875rem; color: #64748b; }\n .cb-option {\n display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; min-height: 40px; justify-content: center;\n box-sizing: border-box; cursor: pointer;\n }\n .cb-option-active { background: #eff6ff; }\n .cb-option-selected .cb-option-label { font-weight: 600; }\n .cb-option-disabled { opacity: 0.5; cursor: not-allowed; }\n .cb-option-label { font-size: 0.875rem; color: #0f172a; overflow-wrap: anywhere; }\n .cb-option-desc { font-size: 0.75rem; color: #64748b; overflow-wrap: anywhere; }\n\n .cb-desc { margin: -6px 0 0; font-size: 0.75rem; line-height: 1.4; color: #64748b; }\n .cb-desc-error { color: #dc2626; }\n\n .cb-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }\n\n /* Reduced motion: no transition on the field. Forced colors (Windows high contrast) drop box-shadow, so the focus\n ring and the active option fall back to real outlines. */\n @media (prefers-reduced-motion: reduce) { .cb-input { transition: none; } }\n @media (forced-colors: active) {\n .cb-input:focus { outline: 2px solid Highlight; outline-offset: 1px; }\n .cb-option-active { outline: 2px solid Highlight; outline-offset: -2px; }\n }\n\n /* Touch targets: the field and its clear (x) button are at least 44px on touch devices and phones. */\n @media (pointer: coarse), (max-width: 480px) {\n .cb-input { min-height: 44px; }\n .cb-clear { min-width: 44px; min-height: 44px; }\n }\n @media (pointer: coarse) { .cb-option { min-height: 44px; } }\n @media (max-width: 480px) {\n .cb-input { font-size: 1rem; }\n .cb-option { min-height: 44px; }\n }\n `],\n})\nexport class ComboboxComponent<T = unknown> implements ControlValueAccessor, Validator, UiFieldValidity {\n protected readonly labels = inject(UiLabelsService);\n readonly label = input('');\n /** Accessible name for a field with no visible label. */\n readonly ariaLabel = input('');\n readonly placeholder = input('');\n readonly required = input(false);\n readonly hint = input('');\n /** Host error message; always wins over the built-in message. */\n readonly error = input('');\n readonly showErrors = input(false);\n /** Current results (host-owned). */\n readonly options = input<ComboboxOption<T>[]>([]);\n readonly loading = input(false);\n readonly noResultsTextInput = input<string | null>(null, { alias: 'noResultsText' });\n readonly noResultsText = computed(() => this.noResultsTextInput() ?? this.labels.t('combobox.noResultsText'));\n /** Characters needed before searching / listing. 0 = open on focus. */\n readonly minChars = input(0);\n readonly hideMinCharsHint = input(false);\n /** Milliseconds between the last keystroke and `(searchChange)`. */\n readonly debounce = input(250);\n /** The selection. */\n readonly value = input<ComboboxSelection | null>(null);\n /** Text shown instead of the selected label (legacy / orphaned links). */\n readonly displayText = input('');\n /** Amber style for a legacy / orphaned `displayText`. */\n readonly displayWarning = input(false);\n\n /** Typed term, debounced (immediate on focus / open). */\n readonly searchChange = output<string>();\n /** The chosen option, or null when cleared. */\n readonly valueChange = output<ComboboxOption<T> | null>();\n readonly invalidChange = output<boolean>();\n readonly focused = output<void>();\n readonly blurred = output<void>();\n\n /** Disables the field (`[disabled]=\"x()\"`). Public so templates compile; ngModel / FormControl `disable()` still works (effective disabled = this OR the forms API). */\n readonly _disabledInput = input(false, { alias: 'disabled' });\n private readonly _cvaDisabled = signal(false);\n protected readonly disabled = computed(() => this._disabledInput() || this._cvaDisabled());\n\n private readonly _field = viewChild<ElementRef<HTMLInputElement>>('field');\n private readonly _host = inject(ElementRef) as ElementRef<HTMLElement>;\n private readonly _injector = inject(Injector);\n private readonly _destroyRef = inject(DestroyRef);\n\n /** Follows `[value]`; ngModel / formControl writes and user picks override it until `[value]` changes. */\n protected readonly _selected = linkedSignal<ComboboxSelection | null>(() => this.value());\n private readonly _text = signal('');\n private readonly _editing = signal(false);\n protected readonly _open = signal(false);\n /** Reset to the first enabled option whenever `[options]` changes, so a stale index never survives new results. */\n protected readonly _activeIndex = linkedSignal<ComboboxOption<T>[], number>({\n source: this.options,\n computation: opts => this._firstEnabled(opts),\n });\n\n protected readonly _uid = ++nextComboboxId;\n protected readonly _inputId = `cb-${this._uid}`;\n protected readonly _listId = `cb-list-${this._uid}`;\n protected readonly _descId = `cb-desc-${this._uid}`;\n\n private readonly _reveal = createFieldReveal(this.showErrors);\n private readonly _issue = computed(() => this._check(this._selected()));\n readonly invalid = computed(() => !!this.error() || !!this._issue());\n readonly errorMessage = computed(() => this._issue()?.message ?? '');\n protected readonly _activeError = computed(() => this._reveal.revealed() ? (this.error() || this.errorMessage()) : '');\n\n protected readonly _inputText = computed(() =>\n this._editing() ? this._text() : (this.displayText() || this._selected()?.label || ''));\n protected readonly _showClear = computed(() => !this.disabled() && !this._editing() && !!(this._selected() || this.displayText()));\n protected readonly _belowMin = computed(() => this._term().length < this.minChars());\n /** The dropdown is drawn: open, except below the minimum when the host asked not to show the \"Type at least N characters\" prompt. */\n protected readonly _popupVisible = computed(() => this._open() && !(this.hideMinCharsHint() && this._belowMin()));\n protected readonly _statusText = computed(() => {\n if (this._belowMin()) return this.labels.t(this.minChars() === 1 ? 'combobox.typeAtLeast_one' : 'combobox.typeAtLeast_other', { count: this.minChars() });\n if (this.loading()) return this.labels.t('search.searching') + '…';\n return this.options().length === 0 ? this.noResultsText() : '';\n });\n protected readonly _liveText = computed(() => {\n if (!this._open() || this._belowMin()) return '';\n if (this.loading()) return this.labels.t('search.searching');\n const n = this.options().length;\n if (n === 0) return this.noResultsText();\n return this.labels.t(n === 1 ? 'combobox.resultsAvailable_one' : 'combobox.resultsAvailable_other', { count: n });\n });\n protected readonly _activeDescendant = computed(() => {\n const i = this._activeIndex();\n return this._open() && !this._belowMin() && i >= 0 && i < this.options().length ? this._optionId(i) : null;\n });\n\n private _debounceTimer: ReturnType<typeof setTimeout> | null = null;\n private _onChange = (_: ComboboxSelection | null) => {};\n private _onTouched = () => {};\n private _onValidatorChange = () => {};\n\n constructor() {\n effect(() => { this.invalidChange.emit(this.invalid()); });\n // Becoming disabled closes an open list, drops a pending search and discards typed text.\n effect(() => { if (this.disabled()) untracked(() => { this._cancelTimer(); this._open.set(false); this._editing.set(false); this._text.set(''); }); });\n this._destroyRef.onDestroy(() => this._cancelTimer());\n }\n\n ngOnChanges() { this._onValidatorChange(); }\n\n // ── CVA / Validator ───────────────────────────────────────────────\n writeValue(val: ComboboxSelection | null) { this._selected.set(val ?? null); }\n validate(control: AbstractControl): ValidationErrors | null {\n return issueToErrors(this._check((control.value as ComboboxSelection | null) ?? null));\n }\n registerOnValidatorChange(fn: () => void) { this._onValidatorChange = fn; }\n registerOnChange(fn: (v: ComboboxSelection | null) => void) { this._onChange = fn; }\n registerOnTouched(fn: () => void) { this._onTouched = fn; }\n setDisabledState(d: boolean) { this._cvaDisabled.set(d); }\n\n private _check(sel: ComboboxSelection | null): FieldIssue | null {\n if (this.disabled()) return null;\n return !sel && this.required() ? requiredIssue(this.label()) : null;\n }\n\n // ── Helpers ───────────────────────────────────────────────────────\n /** What the user typed (trimmed); '' while not editing. */\n private _term(): string { return this._editing() ? this._text().trim() : ''; }\n protected _optionId(i: number) { return `${this._listId}-opt-${i}`; }\n private _firstEnabled(opts: ComboboxOption<T>[]) { return opts.findIndex(o => !o.disabled); }\n\n private _emitSearch() { this._cancelTimer(); if (!this._belowMin()) this.searchChange.emit(this._term()); }\n private _cancelTimer() { if (this._debounceTimer != null) { clearTimeout(this._debounceTimer); this._debounceTimer = null; } }\n\n private _revert() { this._cancelTimer(); this._editing.set(false); this._text.set(''); }\n\n private _openList() {\n if (this.disabled()) return;\n if (!this._open()) { this._open.set(true); this._emitSearch(); }\n }\n\n private _move(dir: 1 | -1) {\n const opts = this.options();\n if (!opts.length || opts.every(o => o.disabled)) return;\n let i = this._activeIndex();\n for (let step = 0; step < opts.length; step++) {\n i = ((i < 0 ? (dir === 1 ? -1 : 0) : i) + dir + opts.length) % opts.length;\n if (!opts[i].disabled) break;\n }\n this._setActive(i);\n }\n\n private _setActive(i: number) {\n this._activeIndex.set(i);\n afterNextRender(() => {\n const el = this._host.nativeElement.querySelector(`#${this._optionId(i)}`) as HTMLElement | null;\n if (el && typeof el.scrollIntoView === 'function') el.scrollIntoView({ block: 'nearest' });\n }, { injector: this._injector });\n }\n\n // ── Events ────────────────────────────────────────────────────────\n protected onInput(event: Event) {\n if (this.disabled()) return;\n this._text.set((event.target as HTMLInputElement).value);\n this._editing.set(true);\n this._open.set(true);\n this._cancelTimer();\n if (this._belowMin()) return;\n this._debounceTimer = setTimeout(() => { this._debounceTimer = null; this._emitSearch(); }, this.debounce());\n }\n\n protected onFocus(event: FocusEvent) {\n this.focused.emit();\n const el = event.target as HTMLInputElement;\n if (this._selected() || this.displayText()) el.select?.();\n this._openList();\n }\n\n protected onClick() { this._openList(); }\n\n protected onBlur() {\n this._open.set(false);\n this._revert();\n this._onTouched();\n this.blurred.emit();\n this._reveal.touched.set(true);\n }\n\n protected onKeydown(e: KeyboardEvent) {\n const opts = this.options();\n const listing = this._open() && !this._belowMin();\n switch (e.key) {\n case 'ArrowDown':\n case 'ArrowUp':\n if (this._open() && !this._popupVisible()) return;\n e.preventDefault();\n if (!this._open()) { this._openList(); return; }\n this._move(e.key === 'ArrowDown' ? 1 : -1);\n return;\n case 'Home':\n case 'End':\n if (listing && opts.length) {\n e.preventDefault();\n const idx = e.key === 'Home' ? opts.findIndex(o => !o.disabled) : opts.map(o => !o.disabled).lastIndexOf(true);\n if (idx >= 0) this._setActive(idx);\n }\n return;\n case 'Enter':\n if (this._popupVisible()) {\n e.preventDefault();\n const i = this._activeIndex();\n if (listing && i >= 0 && i < opts.length && !opts[i].disabled) this.choose(opts[i]);\n }\n return;\n case 'Escape':\n if (this._popupVisible()) { e.preventDefault(); e.stopPropagation(); this._cancelTimer(); this._open.set(false); }\n else if (this._editing()) { e.preventDefault(); e.stopPropagation(); this._revert(); }\n return;\n case 'Tab':\n this._open.set(false);\n return;\n }\n }\n\n protected onOptionMouseDown(e: MouseEvent, o: ComboboxOption<T>) {\n e.preventDefault();\n if (!o.disabled) this.choose(o);\n }\n\n protected onOptionHover(i: number, o: ComboboxOption<T>) {\n if (!o.disabled && i !== this._activeIndex()) this._activeIndex.set(i);\n }\n\n /** Select `o` (also callable by a host through a template ref). */\n choose(o: ComboboxOption<T>) {\n if (this.disabled()) return;\n const sel = { value: o.value, label: o.label };\n this._selected.set(sel);\n this._revert();\n this._open.set(false);\n this._onChange(sel);\n this.valueChange.emit(o);\n }\n\n /** Clear the selection (the x button). */\n clear() {\n if (this.disabled()) return;\n this._selected.set(null);\n this._revert();\n this._open.set(false);\n this._onChange(null);\n this.valueChange.emit(null);\n afterNextRender(() => this._field()?.nativeElement.focus(), { injector: this._injector });\n }\n}\n"],"mappings":";;;;AAqBA,IAAI,iBAAiB;AAwNrB,IAAa,oBAAb,MAAa,kBAAiB;CAgG5B,cAAA;EA/FmB,KAAA,SAAS,OAAO,eAAe;EACzC,KAAA,QAAkB,MAAM,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;EAE3B,KAAA,YAAkB,MAAM,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;EAC3B,KAAA,cAAkB,MAAM,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;EAC3B,KAAA,WAAkB,MAAM,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;EAC9B,KAAA,OAAkB,MAAM,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;EAE3B,KAAA,QAAkB,MAAM,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;EAC3B,KAAA,aAAkB,MAAM,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,aAAA,CAAA,+BAAA,CAAA,CAAA;EAE9B,KAAA,UAAkB,MAA2B,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;EAChD,KAAA,UAAkB,MAAM,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;EAC9B,KAAA,qBAAqB,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;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,cAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,cAAA;EAAA,CAAA;EAAA,aAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,aAAA;EAAA,CAAA;EAAA,eAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,eAAA;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,SAAA;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,SAAA;EAAA,CAAA;EAAA,gBAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,SAAO,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
@@ -389,7 +389,7 @@ var ContactPickerComponent = class ContactPickerComponent {
|
|
|
389
389
|
[attr.aria-expanded]="showResults()"
|
|
390
390
|
[attr.aria-controls]="showResults() ? listboxId : null"
|
|
391
391
|
[attr.aria-activedescendant]="activeDescendant()"
|
|
392
|
-
[(ngModel)]="query"
|
|
392
|
+
[(ngModel)]="query" [ngModelOptions]="{ standalone: true }"
|
|
393
393
|
autocomplete="off"
|
|
394
394
|
(input)="onInput()"
|
|
395
395
|
(focus)="onFocus()"
|
|
@@ -470,7 +470,7 @@ var ContactPickerComponent = class ContactPickerComponent {
|
|
|
470
470
|
[attr.aria-expanded]="showResults()"
|
|
471
471
|
[attr.aria-controls]="showResults() ? listboxId : null"
|
|
472
472
|
[attr.aria-activedescendant]="activeDescendant()"
|
|
473
|
-
[(ngModel)]="query"
|
|
473
|
+
[(ngModel)]="query" [ngModelOptions]="{ standalone: true }"
|
|
474
474
|
autocomplete="off"
|
|
475
475
|
(input)="onInput()"
|
|
476
476
|
(focus)="onFocus()"
|
|
@@ -632,7 +632,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
632
632
|
[attr.aria-expanded]="showResults()"
|
|
633
633
|
[attr.aria-controls]="showResults() ? listboxId : null"
|
|
634
634
|
[attr.aria-activedescendant]="activeDescendant()"
|
|
635
|
-
[(ngModel)]="query"
|
|
635
|
+
[(ngModel)]="query" [ngModelOptions]="{ standalone: true }"
|
|
636
636
|
autocomplete="off"
|
|
637
637
|
(input)="onInput()"
|
|
638
638
|
(focus)="onFocus()"
|
|
@@ -713,7 +713,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
713
713
|
[attr.aria-expanded]="showResults()"
|
|
714
714
|
[attr.aria-controls]="showResults() ? listboxId : null"
|
|
715
715
|
[attr.aria-activedescendant]="activeDescendant()"
|
|
716
|
-
[(ngModel)]="query"
|
|
716
|
+
[(ngModel)]="query" [ngModelOptions]="{ standalone: true }"
|
|
717
717
|
autocomplete="off"
|
|
718
718
|
(input)="onInput()"
|
|
719
719
|
(focus)="onFocus()"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forgeroute-ui-contact-picker.mjs","names":[],"sources":["../../../projects/forgeroute-ui/contact-picker/src/lib/contact-picker/contact-picker.component.ts"],"sourcesContent":["import { Component, inject, signal, computed, ChangeDetectionStrategy, input, output, effect, DestroyRef, ElementRef, Injector, afterNextRender } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { FORGEROUTE_CONFIG } from '@forgeroute/ui/core';\nimport { Subject, debounceTime, switchMap, of, catchError } from 'rxjs';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FormsModule } from '@angular/forms';\nimport { CheckboxComponent } from '@forgeroute/ui/checkbox';\nimport { UiFieldValidity, createFieldReveal, requiredIssue } from '@forgeroute/ui/core';\nimport { UiLabelsService } from '@forgeroute/ui/core';\n\nexport interface ContactLookup {\n id: string;\n name: string;\n phone: string | null;\n email: string | null;\n smsOptedIn: boolean;\n}\n\nlet nextPickerId = 0;\n\nfunction formatPhone(raw: string | null | undefined): string {\n if (!raw) return '';\n const normalized = raw.startsWith('+1') && raw.replace(/\\D/g, '').length === 11 ? raw.slice(2) : raw;\n if (normalized.startsWith('+')) return normalized;\n const digits = normalized.replace(/\\D/g, '');\n const d = digits.startsWith('1') && digits.length === 11 ? digits.slice(1) : digits.slice(0, 10);\n if (d.length <= 3) return d;\n if (d.length <= 6) return `(${d.slice(0, 3)}) ${d.slice(3)}`;\n return `(${d.slice(0, 3)}) ${d.slice(3, 6)}-${d.slice(6)}`;\n}\n\n@Component({\n selector: 'ui-contact-picker',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [FormsModule, CheckboxComponent],\n providers: [{\n // `invalid` is already a public input of this picker (host flag), so the token is backed by a small adapter\n // exposing the combined state (`fieldInvalid` = host `[invalid]` OR required-and-empty).\n provide: UiFieldValidity,\n useFactory: () => {\n const c = inject(ContactPickerComponent);\n return { invalid: c.fieldInvalid, errorMessage: c.errorMessage } satisfies UiFieldValidity;\n },\n }],\n template: `\n <div class=\"picker-wrapper\">\n @if (label()) {\n <label class=\"picker-label\" [id]=\"labelId\" [attr.for]=\"inputFocusable() ? inputId : null\">{{ label() }}@if (required()) {<span class=\"picker-req\"> *</span>}</label>\n }\n\n <!-- ── Multi-select mode ── -->\n @if (isMultiSelect()) {\n @if (showChips() && selectedMultiple().length > 0) {\n <div class=\"multi-chips\">\n @for (c of selectedMultiple(); track c.id) {\n <span class=\"multi-chip\">\n {{ c.name }}\n <button type=\"button\" class=\"chip-remove\" (mousedown)=\"onChipMouseDown(c)\" (click)=\"onChipClick(c)\" [attr.aria-label]=\"labels.t('common.removeNamed', { name: c.name })\">×</button>\n </span>\n }\n </div>\n }\n <input\n class=\"picker-input\"\n type=\"text\"\n [id]=\"inputId\"\n [placeholder]=\"placeholder()\"\n [attr.aria-describedby]=\"describedBy()\"\n [attr.aria-invalid]=\"ariaInvalid() ? 'true' : null\"\n [attr.aria-required]=\"required() || null\"\n [attr.aria-label]=\"label() ? null : fallbackName()\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n [attr.aria-expanded]=\"showResults()\"\n [attr.aria-controls]=\"showResults() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [(ngModel)]=\"query\"\n autocomplete=\"off\"\n (input)=\"onInput()\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur()\"\n (keydown)=\"onKeydown($event)\"\n />\n @if (showResults()) {\n <div class=\"picker-dropdown\" role=\"listbox\" [id]=\"listboxId\" aria-multiselectable=\"true\"\n [attr.aria-labelledby]=\"label() ? labelId : null\" [attr.aria-label]=\"label() ? null : fallbackName()\"\n (mousedown)=\"$event.preventDefault()\">\n @if (loading() || (pending() && results().length === 0)) {\n <div class=\"picker-loading\">{{ labels.t('contactPicker.searching') }}</div>\n } @else if (results().length === 0 && query.length >= 2) {\n <div class=\"picker-empty\">{{ labels.t('contactPicker.noContactsFound') }}</div>\n } @else {\n @for (c of options(); track c.id; let i = $index) {\n <div class=\"picker-option picker-option--check\" role=\"option\"\n [id]=\"optionId(i)\" [class.picker-option--active]=\"i === activeIndex()\"\n [attr.aria-selected]=\"i === activeIndex()\"\n (mousedown)=\"onOptionMouseDown(); toggleContact(c)\"\n (click)=\"onOptionClick($event, c)\">\n <!-- Presentational: the listbox is the only interaction surface (no nested tab stop). -->\n <span class=\"option-check\" aria-hidden=\"true\" inert>\n <ui-checkbox [checked]=\"isSelected(c)\" />\n </span>\n <span class=\"option-body\">\n <span class=\"option-name\">{{ c.name }}</span>\n @if (c.email || c.phone) {\n <span class=\"option-detail\">{{ c.email || c.phone }}</span>\n }\n </span>\n </div>\n }\n }\n </div>\n }\n\n <!-- ── Single-select mode ── -->\n } @else {\n @if (selected()) {\n <div class=\"selected-input\" role=\"group\" tabindex=\"-1\" (focusout)=\"onSelectedFocusOut()\" [attr.aria-labelledby]=\"label() ? labelId : null\"\n [attr.aria-describedby]=\"describedBy()\" [attr.aria-invalid]=\"ariaInvalid() ? 'true' : null\">\n <span>{{ selected()!.name }}</span>\n <button type=\"button\" class=\"clear-btn\" (click)=\"clear()\" [attr.aria-label]=\"labels.t('contactPicker.clearSelection')\">×</button>\n </div>\n @if (showDetails()) {\n <div class=\"recipient-details\">\n <span class=\"details-label\">{{ labels.t('contactPicker.recipientDetails') }}</span>\n <div class=\"details-card\">\n <div class=\"detail-row\">\n <span class=\"detail-key\">{{ labels.t('common.name') }}</span>\n <span class=\"detail-val\">{{ selected()!.name }}</span>\n </div>\n <div class=\"detail-row\">\n <span class=\"detail-key\">{{ labels.t('common.email') }}</span>\n <span class=\"detail-val\">{{ selected()!.email || '—' }}</span>\n </div>\n <div class=\"detail-row last\">\n <span class=\"detail-key\">{{ labels.t('common.phone') }}</span>\n <span class=\"detail-val\">{{ formatPhone(selected()!.phone) || '—' }}</span>\n </div>\n </div>\n </div>\n }\n } @else {\n <input\n class=\"picker-input\"\n type=\"text\"\n [id]=\"inputId\"\n [placeholder]=\"placeholder()\"\n [attr.aria-describedby]=\"describedBy()\"\n [attr.aria-invalid]=\"ariaInvalid() ? 'true' : null\"\n [attr.aria-required]=\"required() || null\"\n [attr.aria-label]=\"label() ? null : fallbackName()\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n [attr.aria-expanded]=\"showResults()\"\n [attr.aria-controls]=\"showResults() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [(ngModel)]=\"query\"\n autocomplete=\"off\"\n (input)=\"onInput()\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur()\"\n (keydown)=\"onKeydown($event)\"\n />\n @if (showResults()) {\n <div class=\"picker-dropdown\" role=\"listbox\" [id]=\"listboxId\"\n [attr.aria-labelledby]=\"label() ? labelId : null\" [attr.aria-label]=\"label() ? null : fallbackName()\"\n (mousedown)=\"$event.preventDefault()\">\n @if (loading() || (pending() && results().length === 0)) {\n <div class=\"picker-loading\">{{ labels.t('contactPicker.searching') }}</div>\n } @else if (results().length === 0 && query.length >= 2) {\n <div class=\"picker-empty\">{{ labels.t('contactPicker.noContactsFound') }}</div>\n } @else {\n @for (c of results(); track c.id; let i = $index) {\n <button type=\"button\" class=\"picker-option\" role=\"option\" tabindex=\"-1\"\n [id]=\"optionId(i)\" [class.picker-option--active]=\"i === activeIndex()\"\n [attr.aria-selected]=\"i === activeIndex()\"\n (mousedown)=\"onOptionMouseDown(); selectContact(c)\"\n (click)=\"onOptionClick($event, c)\">\n <span class=\"option-name\">{{ c.name }}</span>\n <span class=\"option-detail\">{{ c.email || c.phone || '' }}</span>\n </button>\n }\n }\n </div>\n }\n }\n }\n\n <!-- Announces the result count to screen readers while the list is open. -->\n <span class=\"picker-sr\" role=\"status\" aria-live=\"polite\" aria-atomic=\"true\">{{ liveText() }}</span>\n\n @if (hint() && showHint()) {\n <p class=\"picker-hint\" [id]=\"hintId\">{{ hint() }}</p>\n }\n </div>\n `,\n styles: [`\n .picker-wrapper { position: relative; overflow: visible; }\n .picker-label { display: block; font-size: 0.8125rem; font-weight: 600; color: #374151; margin-bottom: 6px; }\n .picker-req { color: #dc2626; }\n .picker-hint { margin: 6px 0 0; font-size: 0.75rem; line-height: 1.4; color: #64748b; }\n .picker-input {\n width: 100%; padding: 9px 12px; border: 1px solid #7c8ba1; border-radius: 8px;\n font-size: 0.875rem; color: #1e293b; font-family: inherit; outline: none; box-sizing: border-box;\n &::placeholder { color: #64748b; opacity: 1; }\n &:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.12); }\n }\n .picker-input:focus-visible { outline: 2px solid transparent; }\n /* 16px on phones stops iOS Safari zooming the page when the field is focused (matches ui-text-input). */\n @media (max-width: 480px) { .picker-input { font-size: 1rem; } }\n .picker-sr {\n position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;\n overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;\n }\n .picker-dropdown {\n position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 9999;\n background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;\n box-shadow: 0 6px 16px rgba(0,0,0,0.1); max-height: 240px; overflow-y: auto;\n }\n /* Touch: 44px rows / hit areas and a list that never outgrows a phone screen. Desktop (fine pointer, wide) is unchanged. */\n @media (pointer: coarse), (max-width: 480px) {\n .picker-input { min-height: 44px; }\n .picker-dropdown { max-height: min(240px, 40vh); overscroll-behavior: contain; }\n .picker-option { min-height: 44px; justify-content: center; box-sizing: border-box; }\n .picker-option--check { min-height: 44px; }\n .chip-remove { position: relative; }\n .chip-remove::after { content: ''; position: absolute; inset: -13px; }\n }\n /* Inside a ui-modal on a phone the dialog is a bottom sheet that is only as tall as its content, so a floating list would hang below\n the screen (or be clipped by the sheet). There the list flows under the field instead: the sheet grows to hold it, and the list\n is capped by the visible viewport (keyboard included, via --ui-vvh) so the footer stays on screen. */\n @media (max-width: 480px) {\n :host-context(.m-body) .picker-dropdown {\n position: static; margin-top: 4px;\n max-height: min(240px, calc(var(--ui-vvh, 100dvh) * 0.3));\n }\n }\n .picker-option {\n display: flex; flex-direction: column; gap: 2px; width: 100%;\n padding: 10px 12px; border: none; background: none; text-align: left;\n cursor: pointer; font-family: inherit;\n &:hover, &.picker-option--active { background: #f8fafc; }\n &:first-child { border-radius: 8px 8px 0 0; }\n &:last-child { border-radius: 0 0 8px 8px; }\n }\n /* Multi-select rows (checkbox + name). Written flat: \"&--check\" is not valid CSS nesting and was silently dropped. */\n .picker-option--check {\n flex-direction: row; align-items: center; gap: 10px;\n .option-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }\n .option-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n .option-detail { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n }\n .option-check { display: flex; pointer-events: none; }\n .option-name { font-size: 0.875rem; font-weight: 600; color: #1e293b; overflow-wrap: anywhere; }\n .option-detail { font-size: 0.75rem; color: #94a3b8; overflow-wrap: anywhere; }\n .picker-loading, .picker-empty { padding: 12px; font-size: 0.8125rem; color: #94a3b8; text-align: center; }\n\n .selected-input {\n display: flex; align-items: center; justify-content: space-between;\n padding: 9px 12px; border: 1px solid #e2e8f0; border-radius: 8px; background: #f8fafc;\n font-size: 0.875rem; font-weight: 600; color: #1e293b; gap: 8px; overflow-wrap: anywhere; min-width: 0;\n }\n .selected-input:focus { outline: none; }\n .selected-input:focus-visible { outline: 2px solid #3b82f6; outline-offset: 2px; }\n .clear-btn {\n width: 18px; height: 18px; border: none; background: #e2e8f0; border-radius: 50%;\n cursor: pointer; font-size: 0.75rem; color: #64748b; display: flex; align-items: center; justify-content: center;\n position: relative; flex-shrink: 0;\n &:focus-visible { outline: 2px solid #3b82f6; outline-offset: 2px; }\n &:hover { background: #cbd5e1; color: #1e293b; }\n /* Invisible 44x44 touch target around the 18px glyph (no visual change). */\n &::after { content: ''; position: absolute; inset: -13px; }\n }\n\n .recipient-details { margin-top: 16px; }\n .details-label {\n display: block; font-size: 0.6875rem; font-weight: 600; color: #94a3b8;\n text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px;\n }\n .details-card { border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; }\n .detail-row {\n display: flex; justify-content: space-between; align-items: center;\n padding: 10px 14px; border-bottom: 1px solid #f1f5f9;\n &.last { border-bottom: none; }\n &:nth-child(even) { background: #f8fafc; }\n }\n .detail-key { font-size: 0.8125rem; color: #94a3b8; font-weight: 500; }\n .detail-val { font-size: 0.875rem; color: #1e293b; font-weight: 600; }\n\n .multi-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }\n .multi-chip {\n display: inline-flex; align-items: center; gap: 4px;\n padding: 4px 8px 4px 10px; background: #dbeafe; border-radius: 20px;\n font-size: 0.8125rem; font-weight: 500; color: #1e40af;\n }\n .chip-remove {\n width: 18px; height: 18px; border: none; background: rgba(30,64,175,0.15);\n border-radius: 50%; cursor: pointer; font-size: 0.875rem; line-height: 1;\n color: #1e40af; display: flex; align-items: center; justify-content: center; flex-shrink: 0;\n &:hover { background: rgba(30,64,175,0.3); }\n &:focus-visible { outline: 2px solid #1e40af; outline-offset: 2px; }\n }\n /* Forced colors (Windows high contrast) drops box-shadow: the focus ring and the active row become real outlines. */\n @media (forced-colors: active) {\n .picker-input:focus { outline: 2px solid Highlight; outline-offset: 1px; }\n .picker-option--active { outline: 2px solid Highlight; outline-offset: -2px; }\n }\n `],\n})\nexport class ContactPickerComponent {\n protected readonly labels = inject(UiLabelsService);\n readonly formatPhone = formatPhone;\n\n readonly label = input('');\n readonly placeholderInput = input<string | null>(null, { alias: 'placeholder' });\n readonly placeholder = computed(() => this.placeholderInput() ?? this.labels.t('contactPicker.placeholder'));\n /** Helper text under the picker (linked to the search input via aria-describedby). */\n readonly hint = input('');\n readonly required = input(false);\n /** Id of an external error element (e.g. `<ui-error>` under the picker); added to aria-describedby. */\n readonly errorId = input('');\n /** Marks the combobox / selected group `aria-invalid=\"true\"`. The picker renders no error text itself. */\n readonly invalid = input(false);\n /** The host's \"tried to submit\" flag (e.g. after a failed Save click). `true` reveals `visibleErrorMessage` (and `ariaInvalid`) on a picker the user has not left. */\n readonly showErrors = input(false);\n readonly showDetails = input(true);\n readonly isMultiSelect = input(false);\n readonly showChips = input(true);\n readonly initialContact = input<ContactLookup | null>(null);\n\n readonly contactSelected = output<ContactLookup | null>();\n readonly contactsSelected = output<ContactLookup[]>();\n /** Emits whenever `fieldInvalid` flips. */\n readonly invalidChange = output<boolean>();\n\n private readonly http = inject(HttpClient);\n /** API root from FORGEROUTE_CONFIG (e.g. a cross-origin prod API); falls back to same-origin `/api`. */\n private readonly apiBase = inject(FORGEROUTE_CONFIG, { optional: true })?.baseUrl ?? '/api';\n private readonly destroyRef = inject(DestroyRef);\n private readonly search$ = new Subject<string>();\n\n /** Unique ids tie the visible label to the search input (and to the selected-contact group). */\n private readonly uid = `ui-contact-picker-${nextPickerId++}`;\n readonly inputId = `${this.uid}-input`;\n readonly labelId = `${this.uid}-label`;\n readonly hintId = `${this.uid}-hint`;\n readonly listboxId = `${this.uid}-listbox`;\n\n query = '';\n readonly results = signal<ContactLookup[]>([]);\n readonly loading = signal(false);\n readonly selected = signal<ContactLookup | null>(null);\n readonly selectedMultiple = signal<ContactLookup[]>([]);\n readonly showResults = signal(false);\n /** True from the first keystroke of a >=2-char query until its results arrive (covers the debounce). */\n readonly pending = signal(false);\n /** Index of the keyboard-highlighted option in `options()`; -1 = none (aria-activedescendant unset). */\n readonly activeIndex = signal(-1);\n\n private readonly reveal = createFieldReveal(this.showErrors);\n /** True when `required` and nothing is picked (single: no contact; multi: no contacts). */\n private readonly requiredEmpty = computed(() =>\n this.required() && (this.isMultiSelect() ? this.selectedMultiple().length === 0 : !this.selected()));\n /** Validity for `UiFieldValidity`: the host `[invalid]` flag OR required-and-empty. */\n readonly fieldInvalid = computed(() => this.invalid() || this.requiredEmpty());\n /** \"<label> is required.\" while required-and-empty ('' otherwise), shown or not. */\n readonly errorMessage = computed(() => this.requiredEmpty() ? requiredIssue(this.label()).message : '');\n /** `errorMessage` only after the user left the picker (or `showErrors` is true) — render it in a `<ui-error>` under the picker. */\n readonly visibleErrorMessage = computed(() => this.reveal.revealed() ? this.errorMessage() : '');\n /** aria-invalid: only once the user left the picker or `showErrors` is true, and then when the host `[invalid]` flag is set or it is required-and-empty. Never before that: the host flag alone does not mark an untouched picker. */\n readonly ariaInvalid = computed(() => this.reveal.revealed() && (this.invalid() || this.requiredEmpty()));\n\n /** The hint is search guidance: hidden while a contact is selected (single-select), back after clear. */\n readonly showHint = computed(() => this.isMultiSelect() || !this.selected());\n\n /** Space-joined ids of the hint (when rendered) and the external error element; null when neither. */\n readonly describedBy = computed(() => {\n const ids = [this.hint() && this.showHint() ? this.hintId : '', this.errorId()].filter(Boolean);\n return ids.length ? ids.join(' ') : null;\n });\n\n /** The options currently offered: single-select shows every result, multi-select hides already-picked ones. */\n readonly options = computed(() =>\n this.isMultiSelect() ? this.results().filter(c => !this.isSelected(c)) : this.results());\n\n /** The search input only exists while nothing is selected (single mode) — the label's `for` must not dangle. */\n readonly inputFocusable = computed(() => this.isMultiSelect() || !this.selected());\n\n readonly activeDescendant = computed(() => {\n const i = this.activeIndex();\n return this.showResults() && i >= 0 && i < this.options().length ? this.optionId(i) : null;\n });\n\n readonly liveText = computed(() => {\n // While a lookup is pending/in flight only \"Searching\" is announced — never \"No results\" (or the previous\n // query's count) during the 250ms debounce.\n if (!this.showResults()) return '';\n if (this.loading() || this.pending()) return this.labels.t('search.searching');\n const n = this.options().length;\n if (n === 0) return this.query.length >= 2 ? this.labels.t('contactPicker.noResults') : '';\n return this.labels.t(n === 1 ? 'contactPicker.resultCount_one' : 'contactPicker.resultCount_other', { count: n });\n });\n\n private blurTimer: ReturnType<typeof setTimeout> | null = null;\n /** Timestamp of the last mousedown activation — a click right after it is the same gesture, not a second pick. */\n private lastMouseActivation = 0;\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly injector = inject(Injector);\n\n /** Accessible name of the search input and listbox when the picker has no visible label. */\n readonly fallbackName = computed(() => this.placeholder() || this.labels.t('contactPicker.searchContacts'));\n\n optionId(i: number): string { return `${this.uid}-opt-${i}`; }\n\n constructor() {\n this.destroyRef.onDestroy(() => this.clearBlurTimer());\n effect(() => { this.invalidChange.emit(this.fieldInvalid()); });\n effect(() => { this.selected.set(this.initialContact()); });\n\n this.search$.pipe(\n debounceTime(250),\n switchMap(q => {\n if (q.length < 2) { this.results.set([]); this.loading.set(false); this.pending.set(false); return of([]); }\n this.loading.set(true);\n return this.http.get<ContactLookup[]>(`${this.apiBase}/contacts/lookup`, { params: { search: q } }).pipe(\n catchError(() => of([])),\n );\n }),\n takeUntilDestroyed(this.destroyRef),\n ).subscribe(results => { this.results.set(results); this.activeIndex.set(-1); this.loading.set(false); this.pending.set(false); });\n }\n\n onInput() {\n this.clearBlurTimer();\n this.activeIndex.set(-1);\n this.pending.set(this.query.length >= 2);\n this.search$.next(this.query);\n this.showResults.set(this.query.length >= 2);\n }\n\n onFocus() {\n this.clearBlurTimer();\n if (this.query.length >= 2) this.showResults.set(true);\n }\n\n /** Focus left the selected-contact group (its clear button or the group itself): the picker counts as touched, so a host `[invalid]` can mark it. */\n onSelectedFocusOut() { this.reveal.touched.set(true); }\n\n /** Delayed so a click on an option still lands; cancelled if focus returns (or the user types) first. */\n onBlur() {\n this.reveal.touched.set(true);\n this.clearBlurTimer();\n this.blurTimer = setTimeout(() => {\n this.blurTimer = null;\n this.showResults.set(false);\n this.activeIndex.set(-1);\n }, 200);\n }\n\n private clearBlurTimer() {\n if (this.blurTimer !== null) { clearTimeout(this.blurTimer); this.blurTimer = null; }\n }\n\n /** ARIA combobox keyboard support: Up/Down (wrapping), Home/End, Enter to pick, Escape to close. */\n onKeydown(event: KeyboardEvent) {\n this.clearBlurTimer();\n const n = this.options().length;\n const open = this.showResults();\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowUp': {\n if (!open) {\n if (this.query.length < 2) return;\n this.showResults.set(true);\n event.preventDefault();\n return;\n }\n event.preventDefault();\n if (n === 0) return;\n const cur = this.activeIndex();\n const next = event.key === 'ArrowDown'\n ? (cur + 1) % n\n : (cur <= 0 ? n - 1 : cur - 1);\n this.activeIndex.set(next);\n this.scrollActiveIntoView(next);\n return;\n }\n case 'Home':\n case 'End':\n if (!open || n === 0) return;\n event.preventDefault();\n this.activeIndex.set(event.key === 'Home' ? 0 : n - 1);\n this.scrollActiveIntoView(this.activeIndex());\n return;\n case 'Enter': {\n const i = this.activeIndex();\n if (!open || i < 0 || i >= n) return;\n event.preventDefault();\n const c = this.options()[i];\n if (this.isMultiSelect()) this.toggleContact(c); else this.selectContact(c);\n return;\n }\n case 'Escape':\n if (!open) return;\n // Close the list only — don't let the same Escape also close a hosting panel/modal.\n event.preventDefault();\n event.stopPropagation();\n this.showResults.set(false);\n this.activeIndex.set(-1);\n return;\n }\n }\n\n private scrollActiveIntoView(i: number) {\n (this.host.nativeElement as HTMLElement).querySelector<HTMLElement>(`#${this.optionId(i)}`)?.scrollIntoView?.({ block: 'nearest' });\n }\n\n onOptionMouseDown() { this.lastMouseActivation = Date.now(); }\n\n /**\n * Activation by assistive tech / virtual cursor arrives as a click without a preceding mousedown.\n * A real mouse click follows its mousedown (already handled) — ignore that one.\n */\n onOptionClick(event: MouseEvent, c: ContactLookup) {\n if (Date.now() - this.lastMouseActivation < 500) return;\n if (this.isMultiSelect()) this.toggleContact(c); else this.selectContact(c);\n }\n\n selectContact(c: ContactLookup) {\n // The search input is replaced by the selected-contact group: keep a keyboard / screen-reader user's place by\n // moving focus there (only when focus was in this picker — never when a host sets `initialContact`).\n const hadFocus = this.host.nativeElement.contains(document.activeElement);\n this.selected.set(c);\n this.query = '';\n this.pending.set(false);\n this.showResults.set(false);\n this.activeIndex.set(-1);\n this.contactSelected.emit(c);\n if (hadFocus) this.focusAfterRender('.selected-input');\n }\n\n clear() {\n this.selected.set(null);\n this.query = '';\n this.results.set([]);\n this.pending.set(false);\n this.showResults.set(false);\n this.contactSelected.emit(null);\n // The clear button disappears with the group: return focus to the search input.\n this.focusAfterRender('.picker-input');\n }\n\n private focusAfterRender(selector: string) {\n afterNextRender(() => this.host.nativeElement.querySelector<HTMLElement>(selector)?.focus(), { injector: this.injector });\n }\n\n isSelected(c: ContactLookup): boolean {\n return this.selectedMultiple().some(s => s.id === c.id);\n }\n\n toggleContact(c: ContactLookup) {\n const current = this.selectedMultiple();\n const next = this.isSelected(c)\n ? current.filter(s => s.id !== c.id)\n : [...current, c];\n this.selectedMultiple.set(next);\n // The offered options re-index (picked contacts are filtered out): drop the highlight so a repeated\n // Enter can never pick a contact the user did not just focus.\n this.activeIndex.set(-1);\n this.contactsSelected.emit(next);\n }\n\n removeContact(c: ContactLookup) {\n this.selectedMultiple.set(this.selectedMultiple().filter(s => s.id !== c.id));\n this.activeIndex.set(-1);\n this.contactsSelected.emit(this.selectedMultiple());\n }\n\n /** Chip remove: a mouse press removes at once (as before); the click that follows it is the same gesture. */\n onChipMouseDown(c: ContactLookup) { this.lastMouseActivation = Date.now(); this.removeContact(c); }\n\n /** Keyboard (Enter / Space) and assistive-tech activation arrive as a click with no mousedown. */\n onChipClick(c: ContactLookup) {\n if (Date.now() - this.lastMouseActivation < 500) return;\n this.removeContact(c);\n // The focused chip button is gone: keep focus in the picker.\n this.focusAfterRender('.picker-input');\n }\n}\n"],"mappings":";;;;;;;;;AAkBA,IAAI,eAAe;AAEnB,SAAS,YAAY,KAA8B;CACjD,IAAI,CAAC,KAAK,OAAO;CACjB,MAAM,aAAa,IAAI,WAAW,IAAI,KAAK,IAAI,QAAQ,OAAO,EAAE,CAAC,CAAC,WAAW,KAAK,IAAI,MAAM,CAAC,IAAI;CACjG,IAAI,WAAW,WAAW,GAAG,GAAG,OAAO;CACvC,MAAM,SAAS,WAAW,QAAQ,OAAO,EAAE;CAC3C,MAAM,IAAI,OAAO,WAAW,GAAG,KAAK,OAAO,WAAW,KAAK,OAAO,MAAM,CAAC,IAAI,OAAO,MAAM,GAAG,EAAE;CAC/F,IAAI,EAAE,UAAU,GAAG,OAAO;CAC1B,IAAI,EAAE,UAAU,GAAG,OAAO,IAAI,EAAE,MAAM,GAAG,CAAC,EAAC,IAAK,EAAE,MAAM,CAAC;CACzD,OAAO,IAAI,EAAE,MAAM,GAAG,CAAC,EAAC,IAAK,EAAE,MAAM,GAAG,CAAC,EAAC,GAAI,EAAE,MAAM,CAAC;AACzD;AA2RA,IAAa,yBAAb,MAAa,uBAAsB;CAuGjC,SAAS,GAAS;EAAY,OAAO,GAAG,KAAK,IAAG,OAAQ;CAAK;CAE7D,cAAA;EAxGmB,KAAA,SAAS,OAAO,eAAe;EACzC,KAAA,cAAc;EAEd,KAAA,QAAiB,MAAM,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA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AA;MAAA;KAAA;IAAA;GAAA;GAAA,iBAAA,GAAA,wBAAA;EAAA,CAAA;CAAA;;AAqR7B,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAsB,YAAA,CAAA;EAzRlC,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAmB,YACjB;GAAI,iBACC,wBAAwB;GAAM,SACtC,CAAC,aAAa,iBAAiB;GAAC,WAC9B,CAAC;IAGV,SAAS;IACT,kBAAiB;KACf,MAAM,IAAI,OAAM,sBAAA;KAChB,OAAO;MAAE,SAAS,EAAE;MAAc,cAAc,EAAE;KAAY;IAChE;GACD,CAAA;GAAC,UACQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyJT,QAAA,CAAA,05IAAA;EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"forgeroute-ui-contact-picker.mjs","names":[],"sources":["../../../projects/forgeroute-ui/contact-picker/src/lib/contact-picker/contact-picker.component.ts"],"sourcesContent":["import { Component, inject, signal, computed, ChangeDetectionStrategy, input, output, effect, DestroyRef, ElementRef, Injector, afterNextRender } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { FORGEROUTE_CONFIG } from '@forgeroute/ui/core';\nimport { Subject, debounceTime, switchMap, of, catchError } from 'rxjs';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FormsModule } from '@angular/forms';\nimport { CheckboxComponent } from '@forgeroute/ui/checkbox';\nimport { UiFieldValidity, createFieldReveal, requiredIssue } from '@forgeroute/ui/core';\nimport { UiLabelsService } from '@forgeroute/ui/core';\n\nexport interface ContactLookup {\n id: string;\n name: string;\n phone: string | null;\n email: string | null;\n smsOptedIn: boolean;\n}\n\nlet nextPickerId = 0;\n\nfunction formatPhone(raw: string | null | undefined): string {\n if (!raw) return '';\n const normalized = raw.startsWith('+1') && raw.replace(/\\D/g, '').length === 11 ? raw.slice(2) : raw;\n if (normalized.startsWith('+')) return normalized;\n const digits = normalized.replace(/\\D/g, '');\n const d = digits.startsWith('1') && digits.length === 11 ? digits.slice(1) : digits.slice(0, 10);\n if (d.length <= 3) return d;\n if (d.length <= 6) return `(${d.slice(0, 3)}) ${d.slice(3)}`;\n return `(${d.slice(0, 3)}) ${d.slice(3, 6)}-${d.slice(6)}`;\n}\n\n@Component({\n selector: 'ui-contact-picker',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [FormsModule, CheckboxComponent],\n providers: [{\n // `invalid` is already a public input of this picker (host flag), so the token is backed by a small adapter\n // exposing the combined state (`fieldInvalid` = host `[invalid]` OR required-and-empty).\n provide: UiFieldValidity,\n useFactory: () => {\n const c = inject(ContactPickerComponent);\n return { invalid: c.fieldInvalid, errorMessage: c.errorMessage } satisfies UiFieldValidity;\n },\n }],\n template: `\n <div class=\"picker-wrapper\">\n @if (label()) {\n <label class=\"picker-label\" [id]=\"labelId\" [attr.for]=\"inputFocusable() ? inputId : null\">{{ label() }}@if (required()) {<span class=\"picker-req\"> *</span>}</label>\n }\n\n <!-- ── Multi-select mode ── -->\n @if (isMultiSelect()) {\n @if (showChips() && selectedMultiple().length > 0) {\n <div class=\"multi-chips\">\n @for (c of selectedMultiple(); track c.id) {\n <span class=\"multi-chip\">\n {{ c.name }}\n <button type=\"button\" class=\"chip-remove\" (mousedown)=\"onChipMouseDown(c)\" (click)=\"onChipClick(c)\" [attr.aria-label]=\"labels.t('common.removeNamed', { name: c.name })\">×</button>\n </span>\n }\n </div>\n }\n <input\n class=\"picker-input\"\n type=\"text\"\n [id]=\"inputId\"\n [placeholder]=\"placeholder()\"\n [attr.aria-describedby]=\"describedBy()\"\n [attr.aria-invalid]=\"ariaInvalid() ? 'true' : null\"\n [attr.aria-required]=\"required() || null\"\n [attr.aria-label]=\"label() ? null : fallbackName()\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n [attr.aria-expanded]=\"showResults()\"\n [attr.aria-controls]=\"showResults() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [(ngModel)]=\"query\" [ngModelOptions]=\"{ standalone: true }\"\n autocomplete=\"off\"\n (input)=\"onInput()\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur()\"\n (keydown)=\"onKeydown($event)\"\n />\n @if (showResults()) {\n <div class=\"picker-dropdown\" role=\"listbox\" [id]=\"listboxId\" aria-multiselectable=\"true\"\n [attr.aria-labelledby]=\"label() ? labelId : null\" [attr.aria-label]=\"label() ? null : fallbackName()\"\n (mousedown)=\"$event.preventDefault()\">\n @if (loading() || (pending() && results().length === 0)) {\n <div class=\"picker-loading\">{{ labels.t('contactPicker.searching') }}</div>\n } @else if (results().length === 0 && query.length >= 2) {\n <div class=\"picker-empty\">{{ labels.t('contactPicker.noContactsFound') }}</div>\n } @else {\n @for (c of options(); track c.id; let i = $index) {\n <div class=\"picker-option picker-option--check\" role=\"option\"\n [id]=\"optionId(i)\" [class.picker-option--active]=\"i === activeIndex()\"\n [attr.aria-selected]=\"i === activeIndex()\"\n (mousedown)=\"onOptionMouseDown(); toggleContact(c)\"\n (click)=\"onOptionClick($event, c)\">\n <!-- Presentational: the listbox is the only interaction surface (no nested tab stop). -->\n <span class=\"option-check\" aria-hidden=\"true\" inert>\n <ui-checkbox [checked]=\"isSelected(c)\" />\n </span>\n <span class=\"option-body\">\n <span class=\"option-name\">{{ c.name }}</span>\n @if (c.email || c.phone) {\n <span class=\"option-detail\">{{ c.email || c.phone }}</span>\n }\n </span>\n </div>\n }\n }\n </div>\n }\n\n <!-- ── Single-select mode ── -->\n } @else {\n @if (selected()) {\n <div class=\"selected-input\" role=\"group\" tabindex=\"-1\" (focusout)=\"onSelectedFocusOut()\" [attr.aria-labelledby]=\"label() ? labelId : null\"\n [attr.aria-describedby]=\"describedBy()\" [attr.aria-invalid]=\"ariaInvalid() ? 'true' : null\">\n <span>{{ selected()!.name }}</span>\n <button type=\"button\" class=\"clear-btn\" (click)=\"clear()\" [attr.aria-label]=\"labels.t('contactPicker.clearSelection')\">×</button>\n </div>\n @if (showDetails()) {\n <div class=\"recipient-details\">\n <span class=\"details-label\">{{ labels.t('contactPicker.recipientDetails') }}</span>\n <div class=\"details-card\">\n <div class=\"detail-row\">\n <span class=\"detail-key\">{{ labels.t('common.name') }}</span>\n <span class=\"detail-val\">{{ selected()!.name }}</span>\n </div>\n <div class=\"detail-row\">\n <span class=\"detail-key\">{{ labels.t('common.email') }}</span>\n <span class=\"detail-val\">{{ selected()!.email || '—' }}</span>\n </div>\n <div class=\"detail-row last\">\n <span class=\"detail-key\">{{ labels.t('common.phone') }}</span>\n <span class=\"detail-val\">{{ formatPhone(selected()!.phone) || '—' }}</span>\n </div>\n </div>\n </div>\n }\n } @else {\n <input\n class=\"picker-input\"\n type=\"text\"\n [id]=\"inputId\"\n [placeholder]=\"placeholder()\"\n [attr.aria-describedby]=\"describedBy()\"\n [attr.aria-invalid]=\"ariaInvalid() ? 'true' : null\"\n [attr.aria-required]=\"required() || null\"\n [attr.aria-label]=\"label() ? null : fallbackName()\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n [attr.aria-expanded]=\"showResults()\"\n [attr.aria-controls]=\"showResults() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [(ngModel)]=\"query\" [ngModelOptions]=\"{ standalone: true }\"\n autocomplete=\"off\"\n (input)=\"onInput()\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur()\"\n (keydown)=\"onKeydown($event)\"\n />\n @if (showResults()) {\n <div class=\"picker-dropdown\" role=\"listbox\" [id]=\"listboxId\"\n [attr.aria-labelledby]=\"label() ? labelId : null\" [attr.aria-label]=\"label() ? null : fallbackName()\"\n (mousedown)=\"$event.preventDefault()\">\n @if (loading() || (pending() && results().length === 0)) {\n <div class=\"picker-loading\">{{ labels.t('contactPicker.searching') }}</div>\n } @else if (results().length === 0 && query.length >= 2) {\n <div class=\"picker-empty\">{{ labels.t('contactPicker.noContactsFound') }}</div>\n } @else {\n @for (c of results(); track c.id; let i = $index) {\n <button type=\"button\" class=\"picker-option\" role=\"option\" tabindex=\"-1\"\n [id]=\"optionId(i)\" [class.picker-option--active]=\"i === activeIndex()\"\n [attr.aria-selected]=\"i === activeIndex()\"\n (mousedown)=\"onOptionMouseDown(); selectContact(c)\"\n (click)=\"onOptionClick($event, c)\">\n <span class=\"option-name\">{{ c.name }}</span>\n <span class=\"option-detail\">{{ c.email || c.phone || '' }}</span>\n </button>\n }\n }\n </div>\n }\n }\n }\n\n <!-- Announces the result count to screen readers while the list is open. -->\n <span class=\"picker-sr\" role=\"status\" aria-live=\"polite\" aria-atomic=\"true\">{{ liveText() }}</span>\n\n @if (hint() && showHint()) {\n <p class=\"picker-hint\" [id]=\"hintId\">{{ hint() }}</p>\n }\n </div>\n `,\n styles: [`\n .picker-wrapper { position: relative; overflow: visible; }\n .picker-label { display: block; font-size: 0.8125rem; font-weight: 600; color: #374151; margin-bottom: 6px; }\n .picker-req { color: #dc2626; }\n .picker-hint { margin: 6px 0 0; font-size: 0.75rem; line-height: 1.4; color: #64748b; }\n .picker-input {\n width: 100%; padding: 9px 12px; border: 1px solid #7c8ba1; border-radius: 8px;\n font-size: 0.875rem; color: #1e293b; font-family: inherit; outline: none; box-sizing: border-box;\n &::placeholder { color: #64748b; opacity: 1; }\n &:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.12); }\n }\n .picker-input:focus-visible { outline: 2px solid transparent; }\n /* 16px on phones stops iOS Safari zooming the page when the field is focused (matches ui-text-input). */\n @media (max-width: 480px) { .picker-input { font-size: 1rem; } }\n .picker-sr {\n position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;\n overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;\n }\n .picker-dropdown {\n position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 9999;\n background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;\n box-shadow: 0 6px 16px rgba(0,0,0,0.1); max-height: 240px; overflow-y: auto;\n }\n /* Touch: 44px rows / hit areas and a list that never outgrows a phone screen. Desktop (fine pointer, wide) is unchanged. */\n @media (pointer: coarse), (max-width: 480px) {\n .picker-input { min-height: 44px; }\n .picker-dropdown { max-height: min(240px, 40vh); overscroll-behavior: contain; }\n .picker-option { min-height: 44px; justify-content: center; box-sizing: border-box; }\n .picker-option--check { min-height: 44px; }\n .chip-remove { position: relative; }\n .chip-remove::after { content: ''; position: absolute; inset: -13px; }\n }\n /* Inside a ui-modal on a phone the dialog is a bottom sheet that is only as tall as its content, so a floating list would hang below\n the screen (or be clipped by the sheet). There the list flows under the field instead: the sheet grows to hold it, and the list\n is capped by the visible viewport (keyboard included, via --ui-vvh) so the footer stays on screen. */\n @media (max-width: 480px) {\n :host-context(.m-body) .picker-dropdown {\n position: static; margin-top: 4px;\n max-height: min(240px, calc(var(--ui-vvh, 100dvh) * 0.3));\n }\n }\n .picker-option {\n display: flex; flex-direction: column; gap: 2px; width: 100%;\n padding: 10px 12px; border: none; background: none; text-align: left;\n cursor: pointer; font-family: inherit;\n &:hover, &.picker-option--active { background: #f8fafc; }\n &:first-child { border-radius: 8px 8px 0 0; }\n &:last-child { border-radius: 0 0 8px 8px; }\n }\n /* Multi-select rows (checkbox + name). Written flat: \"&--check\" is not valid CSS nesting and was silently dropped. */\n .picker-option--check {\n flex-direction: row; align-items: center; gap: 10px;\n .option-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }\n .option-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n .option-detail { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n }\n .option-check { display: flex; pointer-events: none; }\n .option-name { font-size: 0.875rem; font-weight: 600; color: #1e293b; overflow-wrap: anywhere; }\n .option-detail { font-size: 0.75rem; color: #94a3b8; overflow-wrap: anywhere; }\n .picker-loading, .picker-empty { padding: 12px; font-size: 0.8125rem; color: #94a3b8; text-align: center; }\n\n .selected-input {\n display: flex; align-items: center; justify-content: space-between;\n padding: 9px 12px; border: 1px solid #e2e8f0; border-radius: 8px; background: #f8fafc;\n font-size: 0.875rem; font-weight: 600; color: #1e293b; gap: 8px; overflow-wrap: anywhere; min-width: 0;\n }\n .selected-input:focus { outline: none; }\n .selected-input:focus-visible { outline: 2px solid #3b82f6; outline-offset: 2px; }\n .clear-btn {\n width: 18px; height: 18px; border: none; background: #e2e8f0; border-radius: 50%;\n cursor: pointer; font-size: 0.75rem; color: #64748b; display: flex; align-items: center; justify-content: center;\n position: relative; flex-shrink: 0;\n &:focus-visible { outline: 2px solid #3b82f6; outline-offset: 2px; }\n &:hover { background: #cbd5e1; color: #1e293b; }\n /* Invisible 44x44 touch target around the 18px glyph (no visual change). */\n &::after { content: ''; position: absolute; inset: -13px; }\n }\n\n .recipient-details { margin-top: 16px; }\n .details-label {\n display: block; font-size: 0.6875rem; font-weight: 600; color: #94a3b8;\n text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px;\n }\n .details-card { border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; }\n .detail-row {\n display: flex; justify-content: space-between; align-items: center;\n padding: 10px 14px; border-bottom: 1px solid #f1f5f9;\n &.last { border-bottom: none; }\n &:nth-child(even) { background: #f8fafc; }\n }\n .detail-key { font-size: 0.8125rem; color: #94a3b8; font-weight: 500; }\n .detail-val { font-size: 0.875rem; color: #1e293b; font-weight: 600; }\n\n .multi-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }\n .multi-chip {\n display: inline-flex; align-items: center; gap: 4px;\n padding: 4px 8px 4px 10px; background: #dbeafe; border-radius: 20px;\n font-size: 0.8125rem; font-weight: 500; color: #1e40af;\n }\n .chip-remove {\n width: 18px; height: 18px; border: none; background: rgba(30,64,175,0.15);\n border-radius: 50%; cursor: pointer; font-size: 0.875rem; line-height: 1;\n color: #1e40af; display: flex; align-items: center; justify-content: center; flex-shrink: 0;\n &:hover { background: rgba(30,64,175,0.3); }\n &:focus-visible { outline: 2px solid #1e40af; outline-offset: 2px; }\n }\n /* Forced colors (Windows high contrast) drops box-shadow: the focus ring and the active row become real outlines. */\n @media (forced-colors: active) {\n .picker-input:focus { outline: 2px solid Highlight; outline-offset: 1px; }\n .picker-option--active { outline: 2px solid Highlight; outline-offset: -2px; }\n }\n `],\n})\nexport class ContactPickerComponent {\n protected readonly labels = inject(UiLabelsService);\n readonly formatPhone = formatPhone;\n\n readonly label = input('');\n readonly placeholderInput = input<string | null>(null, { alias: 'placeholder' });\n readonly placeholder = computed(() => this.placeholderInput() ?? this.labels.t('contactPicker.placeholder'));\n /** Helper text under the picker (linked to the search input via aria-describedby). */\n readonly hint = input('');\n readonly required = input(false);\n /** Id of an external error element (e.g. `<ui-error>` under the picker); added to aria-describedby. */\n readonly errorId = input('');\n /** Marks the combobox / selected group `aria-invalid=\"true\"`. The picker renders no error text itself. */\n readonly invalid = input(false);\n /** The host's \"tried to submit\" flag (e.g. after a failed Save click). `true` reveals `visibleErrorMessage` (and `ariaInvalid`) on a picker the user has not left. */\n readonly showErrors = input(false);\n readonly showDetails = input(true);\n readonly isMultiSelect = input(false);\n readonly showChips = input(true);\n readonly initialContact = input<ContactLookup | null>(null);\n\n readonly contactSelected = output<ContactLookup | null>();\n readonly contactsSelected = output<ContactLookup[]>();\n /** Emits whenever `fieldInvalid` flips. */\n readonly invalidChange = output<boolean>();\n\n private readonly http = inject(HttpClient);\n /** API root from FORGEROUTE_CONFIG (e.g. a cross-origin prod API); falls back to same-origin `/api`. */\n private readonly apiBase = inject(FORGEROUTE_CONFIG, { optional: true })?.baseUrl ?? '/api';\n private readonly destroyRef = inject(DestroyRef);\n private readonly search$ = new Subject<string>();\n\n /** Unique ids tie the visible label to the search input (and to the selected-contact group). */\n private readonly uid = `ui-contact-picker-${nextPickerId++}`;\n readonly inputId = `${this.uid}-input`;\n readonly labelId = `${this.uid}-label`;\n readonly hintId = `${this.uid}-hint`;\n readonly listboxId = `${this.uid}-listbox`;\n\n query = '';\n readonly results = signal<ContactLookup[]>([]);\n readonly loading = signal(false);\n readonly selected = signal<ContactLookup | null>(null);\n readonly selectedMultiple = signal<ContactLookup[]>([]);\n readonly showResults = signal(false);\n /** True from the first keystroke of a >=2-char query until its results arrive (covers the debounce). */\n readonly pending = signal(false);\n /** Index of the keyboard-highlighted option in `options()`; -1 = none (aria-activedescendant unset). */\n readonly activeIndex = signal(-1);\n\n private readonly reveal = createFieldReveal(this.showErrors);\n /** True when `required` and nothing is picked (single: no contact; multi: no contacts). */\n private readonly requiredEmpty = computed(() =>\n this.required() && (this.isMultiSelect() ? this.selectedMultiple().length === 0 : !this.selected()));\n /** Validity for `UiFieldValidity`: the host `[invalid]` flag OR required-and-empty. */\n readonly fieldInvalid = computed(() => this.invalid() || this.requiredEmpty());\n /** \"<label> is required.\" while required-and-empty ('' otherwise), shown or not. */\n readonly errorMessage = computed(() => this.requiredEmpty() ? requiredIssue(this.label()).message : '');\n /** `errorMessage` only after the user left the picker (or `showErrors` is true) — render it in a `<ui-error>` under the picker. */\n readonly visibleErrorMessage = computed(() => this.reveal.revealed() ? this.errorMessage() : '');\n /** aria-invalid: only once the user left the picker or `showErrors` is true, and then when the host `[invalid]` flag is set or it is required-and-empty. Never before that: the host flag alone does not mark an untouched picker. */\n readonly ariaInvalid = computed(() => this.reveal.revealed() && (this.invalid() || this.requiredEmpty()));\n\n /** The hint is search guidance: hidden while a contact is selected (single-select), back after clear. */\n readonly showHint = computed(() => this.isMultiSelect() || !this.selected());\n\n /** Space-joined ids of the hint (when rendered) and the external error element; null when neither. */\n readonly describedBy = computed(() => {\n const ids = [this.hint() && this.showHint() ? this.hintId : '', this.errorId()].filter(Boolean);\n return ids.length ? ids.join(' ') : null;\n });\n\n /** The options currently offered: single-select shows every result, multi-select hides already-picked ones. */\n readonly options = computed(() =>\n this.isMultiSelect() ? this.results().filter(c => !this.isSelected(c)) : this.results());\n\n /** The search input only exists while nothing is selected (single mode) — the label's `for` must not dangle. */\n readonly inputFocusable = computed(() => this.isMultiSelect() || !this.selected());\n\n readonly activeDescendant = computed(() => {\n const i = this.activeIndex();\n return this.showResults() && i >= 0 && i < this.options().length ? this.optionId(i) : null;\n });\n\n readonly liveText = computed(() => {\n // While a lookup is pending/in flight only \"Searching\" is announced — never \"No results\" (or the previous\n // query's count) during the 250ms debounce.\n if (!this.showResults()) return '';\n if (this.loading() || this.pending()) return this.labels.t('search.searching');\n const n = this.options().length;\n if (n === 0) return this.query.length >= 2 ? this.labels.t('contactPicker.noResults') : '';\n return this.labels.t(n === 1 ? 'contactPicker.resultCount_one' : 'contactPicker.resultCount_other', { count: n });\n });\n\n private blurTimer: ReturnType<typeof setTimeout> | null = null;\n /** Timestamp of the last mousedown activation — a click right after it is the same gesture, not a second pick. */\n private lastMouseActivation = 0;\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly injector = inject(Injector);\n\n /** Accessible name of the search input and listbox when the picker has no visible label. */\n readonly fallbackName = computed(() => this.placeholder() || this.labels.t('contactPicker.searchContacts'));\n\n optionId(i: number): string { return `${this.uid}-opt-${i}`; }\n\n constructor() {\n this.destroyRef.onDestroy(() => this.clearBlurTimer());\n effect(() => { this.invalidChange.emit(this.fieldInvalid()); });\n effect(() => { this.selected.set(this.initialContact()); });\n\n this.search$.pipe(\n debounceTime(250),\n switchMap(q => {\n if (q.length < 2) { this.results.set([]); this.loading.set(false); this.pending.set(false); return of([]); }\n this.loading.set(true);\n return this.http.get<ContactLookup[]>(`${this.apiBase}/contacts/lookup`, { params: { search: q } }).pipe(\n catchError(() => of([])),\n );\n }),\n takeUntilDestroyed(this.destroyRef),\n ).subscribe(results => { this.results.set(results); this.activeIndex.set(-1); this.loading.set(false); this.pending.set(false); });\n }\n\n onInput() {\n this.clearBlurTimer();\n this.activeIndex.set(-1);\n this.pending.set(this.query.length >= 2);\n this.search$.next(this.query);\n this.showResults.set(this.query.length >= 2);\n }\n\n onFocus() {\n this.clearBlurTimer();\n if (this.query.length >= 2) this.showResults.set(true);\n }\n\n /** Focus left the selected-contact group (its clear button or the group itself): the picker counts as touched, so a host `[invalid]` can mark it. */\n onSelectedFocusOut() { this.reveal.touched.set(true); }\n\n /** Delayed so a click on an option still lands; cancelled if focus returns (or the user types) first. */\n onBlur() {\n this.reveal.touched.set(true);\n this.clearBlurTimer();\n this.blurTimer = setTimeout(() => {\n this.blurTimer = null;\n this.showResults.set(false);\n this.activeIndex.set(-1);\n }, 200);\n }\n\n private clearBlurTimer() {\n if (this.blurTimer !== null) { clearTimeout(this.blurTimer); this.blurTimer = null; }\n }\n\n /** ARIA combobox keyboard support: Up/Down (wrapping), Home/End, Enter to pick, Escape to close. */\n onKeydown(event: KeyboardEvent) {\n this.clearBlurTimer();\n const n = this.options().length;\n const open = this.showResults();\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowUp': {\n if (!open) {\n if (this.query.length < 2) return;\n this.showResults.set(true);\n event.preventDefault();\n return;\n }\n event.preventDefault();\n if (n === 0) return;\n const cur = this.activeIndex();\n const next = event.key === 'ArrowDown'\n ? (cur + 1) % n\n : (cur <= 0 ? n - 1 : cur - 1);\n this.activeIndex.set(next);\n this.scrollActiveIntoView(next);\n return;\n }\n case 'Home':\n case 'End':\n if (!open || n === 0) return;\n event.preventDefault();\n this.activeIndex.set(event.key === 'Home' ? 0 : n - 1);\n this.scrollActiveIntoView(this.activeIndex());\n return;\n case 'Enter': {\n const i = this.activeIndex();\n if (!open || i < 0 || i >= n) return;\n event.preventDefault();\n const c = this.options()[i];\n if (this.isMultiSelect()) this.toggleContact(c); else this.selectContact(c);\n return;\n }\n case 'Escape':\n if (!open) return;\n // Close the list only — don't let the same Escape also close a hosting panel/modal.\n event.preventDefault();\n event.stopPropagation();\n this.showResults.set(false);\n this.activeIndex.set(-1);\n return;\n }\n }\n\n private scrollActiveIntoView(i: number) {\n (this.host.nativeElement as HTMLElement).querySelector<HTMLElement>(`#${this.optionId(i)}`)?.scrollIntoView?.({ block: 'nearest' });\n }\n\n onOptionMouseDown() { this.lastMouseActivation = Date.now(); }\n\n /**\n * Activation by assistive tech / virtual cursor arrives as a click without a preceding mousedown.\n * A real mouse click follows its mousedown (already handled) — ignore that one.\n */\n onOptionClick(event: MouseEvent, c: ContactLookup) {\n if (Date.now() - this.lastMouseActivation < 500) return;\n if (this.isMultiSelect()) this.toggleContact(c); else this.selectContact(c);\n }\n\n selectContact(c: ContactLookup) {\n // The search input is replaced by the selected-contact group: keep a keyboard / screen-reader user's place by\n // moving focus there (only when focus was in this picker — never when a host sets `initialContact`).\n const hadFocus = this.host.nativeElement.contains(document.activeElement);\n this.selected.set(c);\n this.query = '';\n this.pending.set(false);\n this.showResults.set(false);\n this.activeIndex.set(-1);\n this.contactSelected.emit(c);\n if (hadFocus) this.focusAfterRender('.selected-input');\n }\n\n clear() {\n this.selected.set(null);\n this.query = '';\n this.results.set([]);\n this.pending.set(false);\n this.showResults.set(false);\n this.contactSelected.emit(null);\n // The clear button disappears with the group: return focus to the search input.\n this.focusAfterRender('.picker-input');\n }\n\n private focusAfterRender(selector: string) {\n afterNextRender(() => this.host.nativeElement.querySelector<HTMLElement>(selector)?.focus(), { injector: this.injector });\n }\n\n isSelected(c: ContactLookup): boolean {\n return this.selectedMultiple().some(s => s.id === c.id);\n }\n\n toggleContact(c: ContactLookup) {\n const current = this.selectedMultiple();\n const next = this.isSelected(c)\n ? current.filter(s => s.id !== c.id)\n : [...current, c];\n this.selectedMultiple.set(next);\n // The offered options re-index (picked contacts are filtered out): drop the highlight so a repeated\n // Enter can never pick a contact the user did not just focus.\n this.activeIndex.set(-1);\n this.contactsSelected.emit(next);\n }\n\n removeContact(c: ContactLookup) {\n this.selectedMultiple.set(this.selectedMultiple().filter(s => s.id !== c.id));\n this.activeIndex.set(-1);\n this.contactsSelected.emit(this.selectedMultiple());\n }\n\n /** Chip remove: a mouse press removes at once (as before); the click that follows it is the same gesture. */\n onChipMouseDown(c: ContactLookup) { this.lastMouseActivation = Date.now(); this.removeContact(c); }\n\n /** Keyboard (Enter / Space) and assistive-tech activation arrive as a click with no mousedown. */\n onChipClick(c: ContactLookup) {\n if (Date.now() - this.lastMouseActivation < 500) return;\n this.removeContact(c);\n // The focused chip button is gone: keep focus in the picker.\n this.focusAfterRender('.picker-input');\n }\n}\n"],"mappings":";;;;;;;;;AAkBA,IAAI,eAAe;AAEnB,SAAS,YAAY,KAA8B;CACjD,IAAI,CAAC,KAAK,OAAO;CACjB,MAAM,aAAa,IAAI,WAAW,IAAI,KAAK,IAAI,QAAQ,OAAO,EAAE,CAAC,CAAC,WAAW,KAAK,IAAI,MAAM,CAAC,IAAI;CACjG,IAAI,WAAW,WAAW,GAAG,GAAG,OAAO;CACvC,MAAM,SAAS,WAAW,QAAQ,OAAO,EAAE;CAC3C,MAAM,IAAI,OAAO,WAAW,GAAG,KAAK,OAAO,WAAW,KAAK,OAAO,MAAM,CAAC,IAAI,OAAO,MAAM,GAAG,EAAE;CAC/F,IAAI,EAAE,UAAU,GAAG,OAAO;CAC1B,IAAI,EAAE,UAAU,GAAG,OAAO,IAAI,EAAE,MAAM,GAAG,CAAC,EAAC,IAAK,EAAE,MAAM,CAAC;CACzD,OAAO,IAAI,EAAE,MAAM,GAAG,CAAC,EAAC,IAAK,EAAE,MAAM,GAAG,CAAC,EAAC,GAAI,EAAE,MAAM,CAAC;AACzD;AA2RA,IAAa,yBAAb,MAAa,uBAAsB;CAuGjC,SAAS,GAAS;EAAY,OAAO,GAAG,KAAK,IAAG,OAAQ;CAAK;CAE7D,cAAA;EAxGmB,KAAA,SAAS,OAAO,eAAe;EACzC,KAAA,cAAc;EAEd,KAAA,QAAiB,MAAM,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;EAC1B,KAAA,mBAAmB,MAAqB,M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