@forgeroute/ui 0.5.26 → 0.5.28

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.
Files changed (75) hide show
  1. package/fesm2022/forgeroute-ui-card-list-item.mjs +72 -35
  2. package/fesm2022/forgeroute-ui-card-list-item.mjs.map +1 -1
  3. package/fesm2022/forgeroute-ui-checkbox.mjs +2 -2
  4. package/fesm2022/forgeroute-ui-checkbox.mjs.map +1 -1
  5. package/fesm2022/forgeroute-ui-color-input.mjs +2 -2
  6. package/fesm2022/forgeroute-ui-color-input.mjs.map +1 -1
  7. package/fesm2022/forgeroute-ui-combobox.mjs +2 -2
  8. package/fesm2022/forgeroute-ui-combobox.mjs.map +1 -1
  9. package/fesm2022/forgeroute-ui-contact-picker.mjs +4 -4
  10. package/fesm2022/forgeroute-ui-contact-picker.mjs.map +1 -1
  11. package/fesm2022/forgeroute-ui-conversations.mjs +2 -0
  12. package/fesm2022/forgeroute-ui-conversations.mjs.map +1 -1
  13. package/fesm2022/forgeroute-ui-data-table-core.mjs +2 -2
  14. package/fesm2022/forgeroute-ui-data-table-core.mjs.map +1 -1
  15. package/fesm2022/forgeroute-ui-date-input.mjs +2 -2
  16. package/fesm2022/forgeroute-ui-date-input.mjs.map +1 -1
  17. package/fesm2022/forgeroute-ui-datetime-input.mjs +2 -2
  18. package/fesm2022/forgeroute-ui-datetime-input.mjs.map +1 -1
  19. package/fesm2022/forgeroute-ui-detail-card.mjs +20 -4
  20. package/fesm2022/forgeroute-ui-detail-card.mjs.map +1 -1
  21. package/fesm2022/forgeroute-ui-dropdown.mjs +16 -2
  22. package/fesm2022/forgeroute-ui-dropdown.mjs.map +1 -1
  23. package/fesm2022/forgeroute-ui-file-input.mjs +7 -5
  24. package/fesm2022/forgeroute-ui-file-input.mjs.map +1 -1
  25. package/fesm2022/forgeroute-ui-icon-picker.mjs +2 -2
  26. package/fesm2022/forgeroute-ui-icon-picker.mjs.map +1 -1
  27. package/fesm2022/forgeroute-ui-media.mjs +67 -2
  28. package/fesm2022/forgeroute-ui-media.mjs.map +1 -1
  29. package/fesm2022/forgeroute-ui-messaging.mjs +3 -0
  30. package/fesm2022/forgeroute-ui-messaging.mjs.map +1 -1
  31. package/fesm2022/forgeroute-ui-multi-select.mjs +2 -2
  32. package/fesm2022/forgeroute-ui-multi-select.mjs.map +1 -1
  33. package/fesm2022/forgeroute-ui-notes.mjs +1 -0
  34. package/fesm2022/forgeroute-ui-notes.mjs.map +1 -1
  35. package/fesm2022/forgeroute-ui-option-card.mjs +1 -0
  36. package/fesm2022/forgeroute-ui-option-card.mjs.map +1 -1
  37. package/fesm2022/forgeroute-ui-payments.mjs +3 -0
  38. package/fesm2022/forgeroute-ui-payments.mjs.map +1 -1
  39. package/fesm2022/forgeroute-ui-pdf.mjs +1 -0
  40. package/fesm2022/forgeroute-ui-pdf.mjs.map +1 -1
  41. package/fesm2022/forgeroute-ui-quickbooks.mjs +1 -0
  42. package/fesm2022/forgeroute-ui-quickbooks.mjs.map +1 -1
  43. package/fesm2022/forgeroute-ui-radio-matrix.mjs +2 -2
  44. package/fesm2022/forgeroute-ui-radio-matrix.mjs.map +1 -1
  45. package/fesm2022/forgeroute-ui-radio.mjs +2 -2
  46. package/fesm2022/forgeroute-ui-radio.mjs.map +1 -1
  47. package/fesm2022/forgeroute-ui-select.mjs +2 -2
  48. package/fesm2022/forgeroute-ui-select.mjs.map +1 -1
  49. package/fesm2022/forgeroute-ui-setup.mjs +1 -0
  50. package/fesm2022/forgeroute-ui-setup.mjs.map +1 -1
  51. package/fesm2022/forgeroute-ui-square.mjs +1 -0
  52. package/fesm2022/forgeroute-ui-square.mjs.map +1 -1
  53. package/fesm2022/forgeroute-ui-star-rating.mjs +2 -2
  54. package/fesm2022/forgeroute-ui-star-rating.mjs.map +1 -1
  55. package/fesm2022/forgeroute-ui-stripe.mjs +1 -0
  56. package/fesm2022/forgeroute-ui-stripe.mjs.map +1 -1
  57. package/fesm2022/forgeroute-ui-swatch-picker.mjs +2 -2
  58. package/fesm2022/forgeroute-ui-swatch-picker.mjs.map +1 -1
  59. package/fesm2022/forgeroute-ui-table-toolbar.mjs +17 -5
  60. package/fesm2022/forgeroute-ui-table-toolbar.mjs.map +1 -1
  61. package/fesm2022/forgeroute-ui-text-input.mjs +2 -2
  62. package/fesm2022/forgeroute-ui-text-input.mjs.map +1 -1
  63. package/fesm2022/forgeroute-ui-textarea-input.mjs +23 -36
  64. package/fesm2022/forgeroute-ui-textarea-input.mjs.map +1 -1
  65. package/fesm2022/forgeroute-ui-time-input.mjs +2 -2
  66. package/fesm2022/forgeroute-ui-time-input.mjs.map +1 -1
  67. package/package.json +1 -1
  68. package/types/forgeroute-ui-card-list-item.d.ts +21 -11
  69. package/types/forgeroute-ui-detail-card.d.ts +7 -0
  70. package/types/forgeroute-ui-dropdown.d.ts +2 -0
  71. package/types/forgeroute-ui-media.d.ts +28 -0
  72. package/types/forgeroute-ui-quickbooks.d.ts +1 -1
  73. package/types/forgeroute-ui-square.d.ts +4 -4
  74. package/types/forgeroute-ui-stripe.d.ts +4 -4
  75. package/types/forgeroute-ui-textarea-input.d.ts +9 -9
@@ -1 +1 @@
1
- {"version":3,"file":"forgeroute-ui-checkbox.mjs","names":[],"sources":["../../../projects/forgeroute-ui/checkbox/src/lib/checkbox/checkbox-trailing.directive.ts","../../../projects/forgeroute-ui/checkbox/src/lib/checkbox/checkbox.component.ts"],"sourcesContent":["import { Directive } from '@angular/core';\n\n/**\n * Marks content that a single `ui-checkbox` shows at the END of its row, outside the clickable label (a badge, a price, a link):\n *\n * <ui-checkbox label=\"Priority handling\" description=\"Ships first\" [(ngModel)]=\"priority\">\n * <span checkbox-trailing>$5.00</span>\n * </ui-checkbox>\n *\n * Import this directive in the host component (it is how the checkbox knows a trailing slot is in use); without it the checkbox\n * renders exactly as before. Clicking the trailing content does not toggle the box.\n */\n@Directive({\n selector: '[checkbox-trailing]',\n standalone: true,\n})\nexport class CheckboxTrailingDirective {}\n","import { Component, input, model, output, signal, computed, effect, forwardRef, inject, contentChild, ElementRef, ChangeDetectionStrategy } from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { AbstractControl, ControlValueAccessor, NG_VALIDATORS, NG_VALUE_ACCESSOR, ValidationErrors, Validator } from '@angular/forms';\nimport { CheckboxTrailingDirective } from './checkbox-trailing.directive';\nimport { FieldIssue, UiFieldValidity, createFieldReveal, issueToErrors, requiredIssue } from '@forgeroute/ui/core';\nimport { opensInNewTab, safeLinkHref } from '@forgeroute/ui/utils';\nimport { UiLabelsService } from '@forgeroute/ui/core';\n\n/** One checkbox of a group (`options`). */\nexport interface CheckboxOption {\n value: string;\n label: string;\n /** Helper text under the option. */\n description?: string;\n disabled?: boolean;\n /** `data-testid` of this option's native checkbox (e.g. for end-to-end tests); none when omitted. */\n testId?: string;\n /** `data-testid` of this option's label text; none when omitted. */\n labelTestId?: string;\n}\n\n/** A link a single `ui-checkbox` label can hold: the label text names it with `{key}`, `labelLinks` says what `{key}` shows and where it goes. */\nexport interface CheckboxLabelLink {\n /** The link's text (plain text, never HTML). A link with no text is not drawn. */\n label: string;\n /** Where it goes: `http:`, `https:`, `mailto:`, `tel:` or an in-app path (`/terms`, `#top`). Anything else (`javascript:`, `data:`, `//host`, empty) draws the text without a link. */\n url: string;\n /** `data-testid` of the link; none when omitted. */\n testId?: string;\n}\n\n/** One piece of a label that holds links: plain text, or a link when `href` is set. */\ninterface CheckboxLabelSegment {\n text: string;\n href?: string;\n newTab?: boolean;\n testId?: string;\n}\n\n@Component({\n selector: 'ui-checkbox, ui-checkbox-group',\n standalone: true,\n imports: [NgTemplateOutlet],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [{\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => CheckboxComponent),\n multi: true,\n }, {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => CheckboxComponent),\n multi: true,\n }, {\n provide: UiFieldValidity,\n useExisting: forwardRef(() => CheckboxComponent),\n }],\n template: `\n @if (groupMode()) {\n <fieldset class=\"cb-group\" [class.cb-indent]=\"indent()\" [class.cb-error]=\"_activeError()\" [disabled]=\"disabled()\"\n [attr.aria-invalid]=\"_activeError() ? 'true' : null\"\n [attr.aria-describedby]=\"(_activeError() || hint()) ? _descId : null\">\n @if (_legend()) {\n <!-- aria-required is not allowed on a fieldset / group, so \"required\" is part of the legend's text for assistive technology -->\n <legend class=\"cb-legend\">{{ _legend() }}@if (required()) { <span class=\"cb-required\" aria-hidden=\"true\">*</span><span class=\"cb-sr-only\"> {{ labels.t('common.required') }}</span> }</legend>\n }\n <div class=\"cb-options\" [class.cb-horizontal]=\"orientation() === 'horizontal'\">\n @for (opt of options(); track opt.value; let i = $index) {\n <div class=\"cb-option\">\n <label class=\"cb-wrap\" [class.cb-disabled]=\"disabled() || opt.disabled\">\n <span class=\"cb-box\" [class.cb-checked]=\"isSelected(opt.value)\" [class.cb-disabled]=\"disabled() || opt.disabled\">\n @if (isSelected(opt.value)) {\n <svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"#fff\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <path d=\"M20 6 9 17l-5-5\"/>\n </svg>\n }\n </span>\n <input\n type=\"checkbox\"\n class=\"cb-hidden\"\n [checked]=\"isSelected(opt.value)\"\n [attr.value]=\"opt.value\"\n [attr.data-testid]=\"opt.testId || null\"\n [disabled]=\"disabled() || !!opt.disabled\"\n [attr.aria-describedby]=\"opt.description ? _descId + '-' + i : null\"\n (change)=\"onToggleOption(opt.value, $event)\"\n />\n <span class=\"cb-label\" [attr.data-testid]=\"opt.labelTestId || null\">{{ opt.label }}</span>\n </label>\n @if (opt.description) {\n <p class=\"cb-desc\" [id]=\"_descId + '-' + i\">{{ opt.description }}</p>\n }\n </div>\n }\n </div>\n @if (_activeError()) {\n <p class=\"cb-desc cb-desc-error cb-group-desc\" [id]=\"_descId\" role=\"alert\">{{ _activeError() }}</p>\n } @else if (hint()) {\n <p class=\"cb-desc cb-group-desc\" [id]=\"_descId\">{{ hint() }}</p>\n }\n </fieldset>\n } @else {\n <div class=\"cb-field\" [class.cb-indent]=\"indent()\" [class.cb-error]=\"_activeError()\" [class.cb-has-trailing]=\"_trailing()\">\n <ng-template #labelRow>\n <label class=\"cb-wrap\" [class.cb-disabled]=\"disabled()\">\n <span class=\"cb-box\" [class.cb-checked]=\"checked()\" [class.cb-indeterminate]=\"indeterminate() && !checked()\" [class.cb-disabled]=\"disabled()\">\n @if (checked()) {\n <svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"#fff\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <path d=\"M20 6 9 17l-5-5\"/>\n </svg>\n } @else if (indeterminate()) {\n <svg width=\"10\" height=\"2\" viewBox=\"0 0 10 2\" fill=\"none\" aria-hidden=\"true\">\n <line x1=\"0\" y1=\"1\" x2=\"10\" y2=\"1\" stroke=\"#fff\" stroke-width=\"2\" stroke-linecap=\"round\"/>\n </svg>\n }\n </span>\n <input\n type=\"checkbox\"\n class=\"cb-hidden\"\n [checked]=\"checked()\"\n [disabled]=\"disabled()\"\n [attr.data-testid]=\"testId() || null\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-checked]=\"indeterminate() && !checked() ? 'mixed' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-invalid]=\"_activeError() ? 'true' : null\"\n [attr.aria-describedby]=\"_singleDescribedBy()\"\n (change)=\"onToggle($event)\"\n />\n @if (label()) {\n <span class=\"cb-label\" [attr.data-testid]=\"labelTestId() || null\" [attr.role]=\"headingLevel() ? 'heading' : null\" [attr.aria-level]=\"headingLevel() || null\">@if (_labelSegments(); as segments) {@for (seg of segments; track $index) {@if (seg.href) {<a class=\"cb-link\" [attr.href]=\"seg.href\" [attr.target]=\"seg.newTab ? '_blank' : null\" [attr.rel]=\"seg.newTab ? 'noopener noreferrer' : null\" [attr.data-testid]=\"seg.testId || null\">{{ seg.text }}@if (seg.newTab) {<span class=\"cb-sr-only\"> {{ labels.t('dataTable.opensInNewTab') }}</span>}</a>} @else {<ng-container>{{ seg.text }}</ng-container>}}} @else {<ng-container>{{ label() }}</ng-container>}</span>\n }\n <ng-content />\n </label>\n </ng-template>\n @if (_trailing()) {\n <div class=\"cb-row\">\n <ng-container [ngTemplateOutlet]=\"labelRow\" />\n <span class=\"cb-trailing\"><ng-content select=\"[checkbox-trailing]\" /></span>\n </div>\n } @else {\n <ng-container [ngTemplateOutlet]=\"labelRow\" />\n }\n @if (description()) {\n <p class=\"cb-desc\" [id]=\"_descId + '-d'\">{{ description() }}</p>\n }\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 `,\n styles: [`\n /* vertical-align: top - an inline-flex box sits on the text baseline of the host's line, and the checkbox's baseline changes when it is ticked (the check mark\n appears), which moved the whole control by 2px. */\n .cb-field { display: inline-flex; flex-direction: column; gap: 4px; vertical-align: top; }\n\n /* Group mode: a native fieldset with a legend */\n .cb-group { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }\n .cb-legend { padding: 0; margin: 0 0 8px; font-size: 0.8125rem; font-weight: 600; color: #374151; line-height: 1.2; }\n .cb-required { color: #dc2626; margin-left: 2px; }\n .cb-sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }\n .cb-options { display: flex; flex-direction: column; gap: 10px; }\n .cb-options.cb-horizontal { flex-direction: row; flex-wrap: wrap; gap: 8px 20px; }\n /* Single mode with [checkbox-trailing]: the label on the left, the trailing content pushed to the end of the row. */\n .cb-field.cb-has-trailing { display: flex; }\n .cb-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }\n .cb-trailing { display: inline-flex; align-items: center; flex-shrink: 0; }\n .cb-option { display: flex; flex-direction: column; gap: 4px; }\n .cb-group-desc { margin-left: 0; }\n /* A dependent option (single checkbox or whole group): lines up under the parent checkbox's label (20px box + 9px gap). After .cb-group so its margin reset does not win. */\n .cb-indent { margin-left: 29px; }\n .cb-desc { margin: 0 0 0 29px; font-size: 0.75rem; line-height: 1.4; color: #64748b; }\n .cb-desc-error { color: #dc2626; }\n .cb-error .cb-box:not(.cb-checked) { border-color: #ef4444; }\n\n .cb-wrap {\n position: relative; /* contains the absolutely positioned hidden input, so it can never extend a scroll container or the page */\n vertical-align: top; /* an inline-flex box sits on the text baseline; the box's baseline changes when it is ticked, which moved the row */\n display: inline-flex;\n align-items: center;\n gap: 9px;\n cursor: pointer;\n user-select: none;\n &.cb-disabled { cursor: not-allowed; opacity: 0.5; }\n }\n\n /* Visually hidden but accessible to keyboard/screen readers */\n .cb-hidden {\n position: absolute; width: 1px; height: 1px;\n margin: -1px; padding: 0; overflow: hidden;\n clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;\n }\n\n /* Show focus ring on the visual box when the hidden input is focused via keyboard */\n .cb-wrap:has(.cb-hidden:focus-visible) .cb-box {\n outline: 2px solid #3b82f6;\n outline-offset: 2px;\n }\n\n /* Touch targets: on touch devices and phones the real (otherwise 1px, clipped) input becomes a transparent 44px square\n centred on the 20px box, so the control has a >= 44px hit area; the box looks the same (desktop unchanged). */\n @media (pointer: coarse), (max-width: 480px) {\n .cb-wrap { position: relative; }\n .cb-hidden {\n width: 44px; height: 44px; margin: 0; clip: auto; overflow: visible;\n left: -12px; top: 50%; transform: translateY(-50%);\n opacity: 0; cursor: pointer; z-index: 1;\n }\n .cb-wrap.cb-disabled .cb-hidden { cursor: not-allowed; }\n /* The whole label row is the target: >= 44px high (the rows of a vertical group then touch, so their 10px gap goes). Desktop pointers keep the compact 20px row. */\n .cb-wrap { min-height: 44px; }\n .cb-options:not(.cb-horizontal) { gap: 0; }\n }\n\n .cb-box {\n flex-shrink: 0;\n box-sizing: border-box; /* the 20px box includes its 2px border, with or without a global border-box reset */\n width: 20px;\n height: 20px;\n border: 2px solid #7c8ba1;\n border-radius: 5px;\n background: #fff;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: background 0.12s, border-color 0.12s;\n\n &.cb-checked, &.cb-indeterminate {\n background: #3b82f6;\n border-color: #3b82f6;\n }\n\n &:not(.cb-checked):not(.cb-disabled) {\n .cb-wrap:hover & { border-color: #3b82f6; }\n }\n }\n\n /* Touch: grow the hit area to 44x44 around the 20px box without moving it (no layout shift). */\n @media (max-width: 640px), (pointer: coarse) {\n .cb-box { position: relative; }\n .cb-box::after { content: ''; position: absolute; inset: -12px; }\n }\n\n .cb-label {\n font-size: 0.875rem;\n color: #334155;\n line-height: 1.4;\n }\n /* A link inside the label (labelLinks). Clicking it follows the link; it never toggles the box (a link inside a <label> is its own activation target). */\n .cb-link { color: #2563eb; text-decoration: underline; cursor: pointer; border-radius: 2px; }\n .cb-link:hover { color: #1d4ed8; }\n .cb-link:focus-visible { outline: 2px solid #3b82f6; outline-offset: 2px; }\n `],\n})\n/**\n * Styled checkbox (ControlValueAccessor, boolean value).\n * Optional validation (nothing changes when unused): `required` means the box must be ticked -> \"<label> is required.\"\n * (or `requiredMessage`); `error` is a host message that wins; `hint` is helper text. Messages (built-in and host `error`) show only after the user\n * toggled the box (or left the group); `[showErrors]=\"true\"` also reveals it on an untouched checkbox, and true -> false forgets the interaction. Angular `Validator`, signals `invalid` / `errorMessage`, `invalidChange`\n * output, provides `UiFieldValidity`. Disabled checkboxes are never invalid.\n */\nexport class CheckboxComponent implements ControlValueAccessor, Validator, UiFieldValidity {\n protected readonly labels = inject(UiLabelsService);\n readonly label = input('');\n /** Accessible name for the native checkbox when there is no visible `label` (e.g. a table row's selector). */\n readonly ariaLabel = input('');\n /** `data-testid` of the native checkbox (single mode), for end-to-end tests; none when empty. (Group options have their own `testId`.) */\n readonly testId = input('');\n /** `data-testid` of the label text (single mode), e.g. to find a product name that is also its checkbox label; none when empty. */\n readonly labelTestId = input('');\n /**\n * 1-6 makes the label text a real heading for screen readers (`role=\"heading\"` + `aria-level`) while it stays the checkbox's label and\n * clicking it still toggles the box - e.g. a product name that is both the heading of its card and the label of its checkbox.\n * Default null: plain label text, exactly as before. Single mode only.\n */\n readonly headingLevel = input<1 | 2 | 3 | 4 | 5 | 6 | null>(null);\n readonly indeterminate = input(false);\n readonly checked = model(false);\n /**\n * GROUP MODE (optional): with `options` the component renders a native `<fieldset>` with a `<legend>` and one checkbox per option,\n * and its value (ngModel / forms) is the array of ticked option values (in option order). Without `options` it is the single\n * boolean checkbox it always was. In group mode `label` / `checked` / `indeterminate` are not used; `required` means at least one\n * option must be ticked (\"<legend> is required.\").\n */\n readonly options = input<CheckboxOption[]>([]);\n /** Group heading (the fieldset's legend). */\n readonly legend = input('');\n /**\n * `ui-checkbox-group` is the same component under a group-friendly tag: `<ui-checkbox-group legend=\"Interests\" [options]=\"opts\" [(ngModel)]=\"picked\" />`\n * (value = array of ticked option values). On the `<ui-checkbox-group>` tag the legend falls back to `label` when `legend` is empty (`<ui-checkbox [options]>` ignores `label` as before).\n */\n protected readonly _legend = computed(() => this.legend() || (this._host.nativeElement.tagName === 'UI-CHECKBOX-GROUP' ? this.label() : ''));\n /** Group mode: lay the options out in a column (default) or in a wrapping row. */\n readonly orientation = input<'vertical' | 'horizontal'>('vertical');\n /**\n * Group mode: the ticked option values as a two-way model (`[(values)]`), an alternative to ngModel / forms. Unset (default) = the\n * group is driven by ngModel / FormControl only. Values that are not an option are dropped and the order follows `options`.\n */\n readonly values = model<string[] | undefined>(undefined);\n /**\n * Single mode: links inside the label. The label text names where each link goes with `{key}` and this object says what it is, so a sentence can hold links\n * without HTML and without the host assembling markup:\n *\n * <ui-checkbox label=\"I agree to the {terms} and the {privacy}\" [labelLinks]=\"{ terms: { label: 'Terms of Service', url: '/terms' }, privacy: { label: 'Privacy Policy', url: '/privacy' } }\" />\n *\n * Only `http:`, `https:`, `mailto:`, `tel:` addresses and in-app paths are linked (see `CheckboxLabelLink`); a link whose address is unsafe or empty still shows its text,\n * just not as a link, and a link without text is left out. An absolute http(s) address opens in a new tab (`noopener noreferrer`, with \"(opens in a new tab)\" for\n * screen readers). A `{key}` that is not in `labelLinks` stays as typed. Clicking a link follows it and does not toggle the box; clicking the rest of the label does.\n * The checkbox's name is the whole sentence; the \"required\" message uses the sentence with the link texts in place of the `{key}`s. Without `labelLinks` (default) the\n * label is plain text exactly as before.\n */\n readonly labelLinks = input<Record<string, CheckboxLabelLink>>({});\n /** The label as text and links, or null when the label has no `{key}` that `labelLinks` knows (then it is drawn as plain text, as before). */\n protected readonly _labelSegments = computed((): CheckboxLabelSegment[] | null => {\n const label = this.label();\n const links = this.labelLinks();\n if (!label || !links || Object.keys(links).length === 0) return null;\n const segments: CheckboxLabelSegment[] = [];\n let used = false;\n let last = 0;\n for (const m of label.matchAll(/\\{([A-Za-z0-9_-]+)\\}/g)) {\n const link = Object.prototype.hasOwnProperty.call(links, m[1]) ? links[m[1]] : undefined;\n if (!link) continue; // not a known link: the {key} stays as typed\n used = true;\n const at = m.index ?? 0;\n if (at > last) segments.push({ text: label.slice(last, at) });\n const text = link.label ?? '';\n const href = safeLinkHref(link.url);\n if (text.trim()) segments.push(href ? { text, href, newTab: opensInNewTab(href), testId: link.testId } : { text });\n last = at + m[0].length;\n }\n if (!used) return null;\n if (last < label.length) segments.push({ text: label.slice(last) });\n return segments;\n });\n /** The label as plain text: the link texts in place of their `{key}`s (used for the \"required\" message). */\n protected readonly _plainLabel = computed(() => this._labelSegments()?.map(s => s.text).join('') ?? this.label());\n /** Single mode: small helper text under the label, linked to the native checkbox with `aria-describedby`. None when empty (default). */\n readonly description = input('');\n /** Set when the host projects a `[checkbox-trailing]` element (see `CheckboxTrailingDirective`). */\n private readonly _trailingContent = contentChild(CheckboxTrailingDirective);\n protected readonly _trailing = computed(() => !this.groupMode() && !!this._trailingContent());\n private readonly _host = inject<ElementRef<HTMLElement>>(ElementRef);\n /** `aria-describedby` of the single checkbox: its description, then the error / hint; none when neither exists (as before). */\n protected readonly _singleDescribedBy = computed(() => {\n const ids = [\n this.description() ? this._descId + '-d' : '',\n (this._activeError() || this.hint()) ? this._descId : '',\n ].filter(Boolean);\n return ids.length ? ids.join(' ') : null;\n });\n /** Indent this checkbox (or the whole group) under its parent option, aligned with the parent's label. */\n readonly indent = input(false);\n protected readonly groupMode = computed(() => this.options().length > 0);\n private readonly _selected = signal<string[]>([]);\n protected isSelected(value: string): boolean { return this._selected().includes(value); }\n /** The box must be ticked. */\n readonly required = input(false);\n /** Replaces the built-in \"<label> is required.\" message. */\n readonly requiredMessage = input('');\n readonly hint = input('');\n /** Host-provided error message (wins over the built-in one). */\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 control at once (it also shows after the user left THIS control); switching it from true back to false forgets that the control was left. */\n readonly showErrors = input(false);\n\n protected readonly _descId = `cb-${Math.random().toString(36).slice(2, 8)}-desc`;\n private readonly _reveal = createFieldReveal(this.showErrors);\n private readonly _issue = computed((): FieldIssue | null => this._check(this.groupMode() ? this._selected().length > 0 : this.checked()));\n /** True while a required box is unticked or the host passed an `[error]`. */\n readonly invalid = computed(() => !!this.error() || !!this._issue());\n /** Message of the broken built-in rule ('' when valid), shown or not. */\n readonly errorMessage = computed(() => this._issue()?.message ?? '');\n /** Emits whenever the field becomes invalid / valid. */\n readonly invalidChange = output<boolean>();\n protected readonly _activeError = computed(() => this._reveal.revealed() ? (this.error() || this.errorMessage()) : '');\n private _onValidatorChange = () => {};\n\n constructor() {\n // Kept unconditional on purpose: output subscribers are attached after construction (and an unobserved\n // OutputEmitterRef.emit is a no-op), so skipping the effect would need Angular-internal listener checks and risk\n // missing a late subscriber. Table row checkboxes pay one effect each; `invalid`/`errorMessage` computeds are lazy.\n effect(() => { this.invalidChange.emit(this.invalid()); });\n // `[(values)]` (group mode): follow the host's array; skipped while it is unset or already equal to the selection.\n effect(() => {\n const v = this.values();\n if (!v) return;\n const next = this.inOptionOrder(v);\n const cur = this._selected();\n if (next.length !== cur.length || next.some((x, i) => x !== cur[i])) this._selected.set(next);\n });\n }\n\n /**\n * Puts the box back to a state chosen by the host after it refused a change (e.g. a confirm was declined). Writes the model, the\n * native input(s) and the form control, which re-setting the same bound value cannot do (the one-way binding sees no change\n * while the DOM and the internal state already moved). Single mode: `reset(false)` / `reset(true)`; group mode: `reset(['a'])`.\n */\n reset(value: boolean | string[] = false): void {\n if (this.groupMode()) {\n const next = this.inOptionOrder(Array.isArray(value) ? value : []);\n this._selected.set(next);\n if (this.values() !== undefined) this.values.set(next);\n this._syncNative(opt => next.includes(opt));\n this.onChange(next);\n } else {\n const on = Array.isArray(value) ? value.length > 0 : !!value;\n this.checked.set(on);\n this._syncNative(() => on);\n this.onChange(on);\n }\n }\n\n /** Sets every native checkbox of this component to the state the component holds (the DOM may have moved ahead of it). */\n private _syncNative(isOn: (optionValue: string) => boolean): void {\n this._host.nativeElement.querySelectorAll<HTMLInputElement>('input[type=\"checkbox\"]').forEach(el => {\n el.checked = this.groupMode() ? isOn(el.getAttribute('value') ?? '') : isOn('');\n });\n }\n\n /** Re-run the form control's validation when a rule input (`required`, `requiredMessage`, `label`) changes. */\n ngOnChanges() { this._onValidatorChange(); }\n\n validate(control: AbstractControl): ValidationErrors | null {\n const v = control.value;\n return issueToErrors(this._check(Array.isArray(v) ? v.length > 0 : !!v));\n }\n registerOnValidatorChange(fn: () => void) { this._onValidatorChange = fn; }\n\n private _check(checked: boolean): FieldIssue | null {\n if (this.disabled() || !this.required() || checked) return null;\n const rm = this.requiredMessage();\n return rm ? { key: 'required', message: rm } : requiredIssue(this.groupMode() ? this._legend() : this._plainLabel());\n }\n\n /** Public so a host template can bind `[disabled]` (a protected input fails strict template type-checking, TS2445). */\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 onChange = (_: boolean | string[]) => {};\n private onTouched = () => {};\n\n writeValue(val: boolean | string[] | null) {\n if (Array.isArray(val)) this._selected.set(this.inOptionOrder(val));\n else if (this.groupMode()) this._selected.set([]); // form.reset() / null clears the group\n else this.checked.set(!!val);\n }\n registerOnChange(fn: (v: boolean | string[]) => void) { this.onChange = fn; }\n registerOnTouched(fn: () => void) { this.onTouched = fn; }\n setDisabledState(d: boolean) { this._cvaDisabled.set(d); }\n\n onToggle(event: Event) {\n if (this.disabled()) return;\n const val = (event.target as HTMLInputElement).checked;\n this.checked.set(val);\n this.onChange(val);\n this.onTouched();\n this._reveal.touched.set(true);\n }\n\n /** The values keep the option order, and values that are not an option are dropped. */\n private inOptionOrder(values: string[]): string[] {\n const opts = this.options();\n return opts.length === 0 ? [...values] : opts.map(o => o.value).filter(v => values.includes(v));\n }\n\n /** Group mode: ticks / unticks one option; the form gets the full list of ticked values. */\n onToggleOption(value: string, event: Event) {\n if (this.disabled() || this.options().find(o => o.value === value)?.disabled) return;\n const on = (event.target as HTMLInputElement).checked;\n const next = this.inOptionOrder(on ? [...this._selected(), value] : this._selected().filter(v => v !== value));\n this._selected.set(next);\n if (this.values() !== undefined) this.values.set(next);\n this.onChange(next);\n this.onTouched();\n this._reveal.touched.set(true);\n }\n}\n"],"mappings":";;;;;;AAgBA,IAAa,4BAAb,MAAa,0BAAyB;CAAzB;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAyB,MAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAAzB;EAAA,KAAA,OAAA,GAAA,qBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,MAAA;GAAyB,cAAA;GAAA,UAAA;GAAA,UAAA;EAAA,CAAA;CAAA;;AAAzB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UA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EAAA,CAAA;EAAA,eAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,eAAA;EAAA,CAAA;EAAA,gBAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"forgeroute-ui-checkbox.mjs","names":[],"sources":["../../../projects/forgeroute-ui/checkbox/src/lib/checkbox/checkbox-trailing.directive.ts","../../../projects/forgeroute-ui/checkbox/src/lib/checkbox/checkbox.component.ts"],"sourcesContent":["import { Directive } from '@angular/core';\n\n/**\n * Marks content that a single `ui-checkbox` shows at the END of its row, outside the clickable label (a badge, a price, a link):\n *\n * <ui-checkbox label=\"Priority handling\" description=\"Ships first\" [(ngModel)]=\"priority\">\n * <span checkbox-trailing>$5.00</span>\n * </ui-checkbox>\n *\n * Import this directive in the host component (it is how the checkbox knows a trailing slot is in use); without it the checkbox\n * renders exactly as before. Clicking the trailing content does not toggle the box.\n */\n@Directive({\n selector: '[checkbox-trailing]',\n standalone: true,\n})\nexport class CheckboxTrailingDirective {}\n","import { Component, input, model, output, signal, computed, effect, forwardRef, inject, contentChild, ElementRef, ChangeDetectionStrategy } from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { AbstractControl, ControlValueAccessor, NG_VALIDATORS, NG_VALUE_ACCESSOR, ValidationErrors, Validator } from '@angular/forms';\nimport { CheckboxTrailingDirective } from './checkbox-trailing.directive';\nimport { FieldIssue, UiFieldValidity, createFieldReveal, issueToErrors, requiredIssue } from '@forgeroute/ui/core';\nimport { opensInNewTab, safeLinkHref } from '@forgeroute/ui/utils';\nimport { UiLabelsService } from '@forgeroute/ui/core';\n\n/** One checkbox of a group (`options`). */\nexport interface CheckboxOption {\n value: string;\n label: string;\n /** Helper text under the option. */\n description?: string;\n disabled?: boolean;\n /** `data-testid` of this option's native checkbox (e.g. for end-to-end tests); none when omitted. */\n testId?: string;\n /** `data-testid` of this option's label text; none when omitted. */\n labelTestId?: string;\n}\n\n/** A link a single `ui-checkbox` label can hold: the label text names it with `{key}`, `labelLinks` says what `{key}` shows and where it goes. */\nexport interface CheckboxLabelLink {\n /** The link's text (plain text, never HTML). A link with no text is not drawn. */\n label: string;\n /** Where it goes: `http:`, `https:`, `mailto:`, `tel:` or an in-app path (`/terms`, `#top`). Anything else (`javascript:`, `data:`, `//host`, empty) draws the text without a link. */\n url: string;\n /** `data-testid` of the link; none when omitted. */\n testId?: string;\n}\n\n/** One piece of a label that holds links: plain text, or a link when `href` is set. */\ninterface CheckboxLabelSegment {\n text: string;\n href?: string;\n newTab?: boolean;\n testId?: string;\n}\n\n@Component({\n selector: 'ui-checkbox, ui-checkbox-group',\n standalone: true,\n imports: [NgTemplateOutlet],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [{\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => CheckboxComponent),\n multi: true,\n }, {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => CheckboxComponent),\n multi: true,\n }, {\n provide: UiFieldValidity,\n useExisting: forwardRef(() => CheckboxComponent),\n }],\n template: `\n @if (groupMode()) {\n <fieldset class=\"cb-group\" [class.cb-indent]=\"indent()\" [class.cb-error]=\"_activeError()\" [disabled]=\"disabled()\"\n [attr.aria-invalid]=\"_activeError() ? 'true' : null\"\n [attr.aria-describedby]=\"(_activeError() || hint()) ? _descId : null\">\n @if (_legend()) {\n <!-- aria-required is not allowed on a fieldset / group, so \"required\" is part of the legend's text for assistive technology -->\n <legend class=\"cb-legend\">{{ _legend() }}@if (required()) { <span class=\"cb-required\" aria-hidden=\"true\">*</span><span class=\"cb-sr-only\"> {{ labels.t('common.required') }}</span> }</legend>\n }\n <div class=\"cb-options\" [class.cb-horizontal]=\"orientation() === 'horizontal'\">\n @for (opt of options(); track opt.value; let i = $index) {\n <div class=\"cb-option\">\n <label class=\"cb-wrap\" [class.cb-disabled]=\"disabled() || opt.disabled\">\n <span class=\"cb-box\" [class.cb-checked]=\"isSelected(opt.value)\" [class.cb-disabled]=\"disabled() || opt.disabled\">\n @if (isSelected(opt.value)) {\n <svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"#fff\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <path d=\"M20 6 9 17l-5-5\"/>\n </svg>\n }\n </span>\n <input\n type=\"checkbox\"\n class=\"cb-hidden\"\n [checked]=\"isSelected(opt.value)\"\n [attr.value]=\"opt.value\"\n [attr.data-testid]=\"opt.testId || null\"\n [disabled]=\"disabled() || !!opt.disabled\"\n [attr.aria-describedby]=\"opt.description ? _descId + '-' + i : null\"\n (change)=\"onToggleOption(opt.value, $event)\"\n />\n <span class=\"cb-label\" [attr.data-testid]=\"opt.labelTestId || null\">{{ opt.label }}</span>\n </label>\n @if (opt.description) {\n <p class=\"cb-desc\" [id]=\"_descId + '-' + i\">{{ opt.description }}</p>\n }\n </div>\n }\n </div>\n @if (_activeError()) {\n <p class=\"cb-desc cb-desc-error cb-group-desc\" [id]=\"_descId\" role=\"alert\">{{ _activeError() }}</p>\n } @else if (hint()) {\n <p class=\"cb-desc cb-group-desc\" [id]=\"_descId\">{{ hint() }}</p>\n }\n </fieldset>\n } @else {\n <div class=\"cb-field\" [class.cb-indent]=\"indent()\" [class.cb-error]=\"_activeError()\" [class.cb-has-trailing]=\"_trailing()\">\n <ng-template #labelRow>\n <label class=\"cb-wrap\" [class.cb-disabled]=\"disabled()\">\n <span class=\"cb-box\" [class.cb-checked]=\"checked()\" [class.cb-indeterminate]=\"indeterminate() && !checked()\" [class.cb-disabled]=\"disabled()\">\n @if (checked()) {\n <svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"#fff\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <path d=\"M20 6 9 17l-5-5\"/>\n </svg>\n } @else if (indeterminate()) {\n <svg width=\"10\" height=\"2\" viewBox=\"0 0 10 2\" fill=\"none\" aria-hidden=\"true\">\n <line x1=\"0\" y1=\"1\" x2=\"10\" y2=\"1\" stroke=\"#fff\" stroke-width=\"2\" stroke-linecap=\"round\"/>\n </svg>\n }\n </span>\n <input\n type=\"checkbox\"\n class=\"cb-hidden\"\n [checked]=\"checked()\"\n [disabled]=\"disabled()\"\n [attr.data-testid]=\"testId() || null\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-checked]=\"indeterminate() && !checked() ? 'mixed' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-invalid]=\"_activeError() ? 'true' : null\"\n [attr.aria-describedby]=\"_singleDescribedBy()\"\n (change)=\"onToggle($event)\"\n />\n @if (label()) {\n <span class=\"cb-label\" [attr.data-testid]=\"labelTestId() || null\" [attr.role]=\"headingLevel() ? 'heading' : null\" [attr.aria-level]=\"headingLevel() || null\">@if (_labelSegments(); as segments) {@for (seg of segments; track $index) {@if (seg.href) {<a class=\"cb-link\" [attr.href]=\"seg.href\" [attr.target]=\"seg.newTab ? '_blank' : null\" [attr.rel]=\"seg.newTab ? 'noopener noreferrer' : null\" [attr.data-testid]=\"seg.testId || null\">{{ seg.text }}@if (seg.newTab) {<span class=\"cb-sr-only\"> {{ labels.t('dataTable.opensInNewTab') }}</span>}</a>} @else {<ng-container>{{ seg.text }}</ng-container>}}} @else {<ng-container>{{ label() }}</ng-container>}</span>\n }\n <ng-content />\n </label>\n </ng-template>\n @if (_trailing()) {\n <div class=\"cb-row\">\n <ng-container [ngTemplateOutlet]=\"labelRow\" />\n <span class=\"cb-trailing\"><ng-content select=\"[checkbox-trailing]\" /></span>\n </div>\n } @else {\n <ng-container [ngTemplateOutlet]=\"labelRow\" />\n }\n @if (description()) {\n <p class=\"cb-desc\" [id]=\"_descId + '-d'\">{{ description() }}</p>\n }\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 `,\n styles: [`\n /* vertical-align: top - an inline-flex box sits on the text baseline of the host's line, and the checkbox's baseline changes when it is ticked (the check mark\n appears), which moved the whole control by 2px. */\n .cb-field { display: inline-flex; flex-direction: column; gap: 4px; vertical-align: top; }\n\n /* Group mode: a native fieldset with a legend */\n .cb-group { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }\n .cb-legend { padding: 0; margin: 0 0 8px; font-size: 0.8125rem; font-weight: 600; color: #374151; line-height: 1.2; }\n .cb-required { color: #dc2626; margin-left: 2px; }\n .cb-sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }\n .cb-options { display: flex; flex-direction: column; gap: 10px; }\n .cb-options.cb-horizontal { flex-direction: row; flex-wrap: wrap; gap: 8px 20px; }\n /* Single mode with [checkbox-trailing]: the label on the left, the trailing content pushed to the end of the row. */\n .cb-field.cb-has-trailing { display: flex; }\n .cb-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }\n .cb-trailing { display: inline-flex; align-items: center; flex-shrink: 0; }\n .cb-option { display: flex; flex-direction: column; gap: 4px; }\n .cb-group-desc { margin-left: 0; }\n /* A dependent option (single checkbox or whole group): lines up under the parent checkbox's label (20px box + 9px gap). After .cb-group so its margin reset does not win. */\n .cb-indent { margin-left: 29px; }\n .cb-desc { margin: -4px 0 0 29px; font-size: 0.75rem; line-height: 1.4; color: #64748b; }\n .cb-desc-error { color: #dc2626; }\n .cb-group > .cb-group-desc { margin-top: -8px; } /* the group's 8px flex gap is cancelled too */\n .cb-error .cb-box:not(.cb-checked) { border-color: #ef4444; }\n\n .cb-wrap {\n position: relative; /* contains the absolutely positioned hidden input, so it can never extend a scroll container or the page */\n vertical-align: top; /* an inline-flex box sits on the text baseline; the box's baseline changes when it is ticked, which moved the row */\n display: inline-flex;\n align-items: center;\n gap: 9px;\n cursor: pointer;\n user-select: none;\n &.cb-disabled { cursor: not-allowed; opacity: 0.5; }\n }\n\n /* Visually hidden but accessible to keyboard/screen readers */\n .cb-hidden {\n position: absolute; width: 1px; height: 1px;\n margin: -1px; padding: 0; overflow: hidden;\n clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;\n }\n\n /* Show focus ring on the visual box when the hidden input is focused via keyboard */\n .cb-wrap:has(.cb-hidden:focus-visible) .cb-box {\n outline: 2px solid #3b82f6;\n outline-offset: 2px;\n }\n\n /* Touch targets: on touch devices and phones the real (otherwise 1px, clipped) input becomes a transparent 44px square\n centred on the 20px box, so the control has a >= 44px hit area; the box looks the same (desktop unchanged). */\n @media (pointer: coarse), (max-width: 480px) {\n .cb-wrap { position: relative; }\n .cb-hidden {\n width: 44px; height: 44px; margin: 0; clip: auto; overflow: visible;\n left: -12px; top: 50%; transform: translateY(-50%);\n opacity: 0; cursor: pointer; z-index: 1;\n }\n .cb-wrap.cb-disabled .cb-hidden { cursor: not-allowed; }\n /* The whole label row is the target: >= 44px high (the rows of a vertical group then touch, so their 10px gap goes). Desktop pointers keep the compact 20px row. */\n .cb-wrap { min-height: 44px; }\n .cb-options:not(.cb-horizontal) { gap: 0; }\n }\n\n .cb-box {\n flex-shrink: 0;\n box-sizing: border-box; /* the 20px box includes its 2px border, with or without a global border-box reset */\n width: 20px;\n height: 20px;\n border: 2px solid #7c8ba1;\n border-radius: 5px;\n background: #fff;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: background 0.12s, border-color 0.12s;\n\n &.cb-checked, &.cb-indeterminate {\n background: #3b82f6;\n border-color: #3b82f6;\n }\n\n &:not(.cb-checked):not(.cb-disabled) {\n .cb-wrap:hover & { border-color: #3b82f6; }\n }\n }\n\n /* Touch: grow the hit area to 44x44 around the 20px box without moving it (no layout shift). */\n @media (max-width: 640px), (pointer: coarse) {\n .cb-box { position: relative; }\n .cb-box::after { content: ''; position: absolute; inset: -12px; }\n }\n\n .cb-label {\n font-size: 0.875rem;\n color: #334155;\n line-height: 1.4;\n }\n /* A link inside the label (labelLinks). Clicking it follows the link; it never toggles the box (a link inside a <label> is its own activation target). */\n .cb-link { color: #2563eb; text-decoration: underline; cursor: pointer; border-radius: 2px; }\n .cb-link:hover { color: #1d4ed8; }\n .cb-link:focus-visible { outline: 2px solid #3b82f6; outline-offset: 2px; }\n `],\n})\n/**\n * Styled checkbox (ControlValueAccessor, boolean value).\n * Optional validation (nothing changes when unused): `required` means the box must be ticked -> \"<label> is required.\"\n * (or `requiredMessage`); `error` is a host message that wins; `hint` is helper text. Messages (built-in and host `error`) show only after the user\n * toggled the box (or left the group); `[showErrors]=\"true\"` also reveals it on an untouched checkbox, and true -> false forgets the interaction. Angular `Validator`, signals `invalid` / `errorMessage`, `invalidChange`\n * output, provides `UiFieldValidity`. Disabled checkboxes are never invalid.\n */\nexport class CheckboxComponent implements ControlValueAccessor, Validator, UiFieldValidity {\n protected readonly labels = inject(UiLabelsService);\n readonly label = input('');\n /** Accessible name for the native checkbox when there is no visible `label` (e.g. a table row's selector). */\n readonly ariaLabel = input('');\n /** `data-testid` of the native checkbox (single mode), for end-to-end tests; none when empty. (Group options have their own `testId`.) */\n readonly testId = input('');\n /** `data-testid` of the label text (single mode), e.g. to find a product name that is also its checkbox label; none when empty. */\n readonly labelTestId = input('');\n /**\n * 1-6 makes the label text a real heading for screen readers (`role=\"heading\"` + `aria-level`) while it stays the checkbox's label and\n * clicking it still toggles the box - e.g. a product name that is both the heading of its card and the label of its checkbox.\n * Default null: plain label text, exactly as before. Single mode only.\n */\n readonly headingLevel = input<1 | 2 | 3 | 4 | 5 | 6 | null>(null);\n readonly indeterminate = input(false);\n readonly checked = model(false);\n /**\n * GROUP MODE (optional): with `options` the component renders a native `<fieldset>` with a `<legend>` and one checkbox per option,\n * and its value (ngModel / forms) is the array of ticked option values (in option order). Without `options` it is the single\n * boolean checkbox it always was. In group mode `label` / `checked` / `indeterminate` are not used; `required` means at least one\n * option must be ticked (\"<legend> is required.\").\n */\n readonly options = input<CheckboxOption[]>([]);\n /** Group heading (the fieldset's legend). */\n readonly legend = input('');\n /**\n * `ui-checkbox-group` is the same component under a group-friendly tag: `<ui-checkbox-group legend=\"Interests\" [options]=\"opts\" [(ngModel)]=\"picked\" />`\n * (value = array of ticked option values). On the `<ui-checkbox-group>` tag the legend falls back to `label` when `legend` is empty (`<ui-checkbox [options]>` ignores `label` as before).\n */\n protected readonly _legend = computed(() => this.legend() || (this._host.nativeElement.tagName === 'UI-CHECKBOX-GROUP' ? this.label() : ''));\n /** Group mode: lay the options out in a column (default) or in a wrapping row. */\n readonly orientation = input<'vertical' | 'horizontal'>('vertical');\n /**\n * Group mode: the ticked option values as a two-way model (`[(values)]`), an alternative to ngModel / forms. Unset (default) = the\n * group is driven by ngModel / FormControl only. Values that are not an option are dropped and the order follows `options`.\n */\n readonly values = model<string[] | undefined>(undefined);\n /**\n * Single mode: links inside the label. The label text names where each link goes with `{key}` and this object says what it is, so a sentence can hold links\n * without HTML and without the host assembling markup:\n *\n * <ui-checkbox label=\"I agree to the {terms} and the {privacy}\" [labelLinks]=\"{ terms: { label: 'Terms of Service', url: '/terms' }, privacy: { label: 'Privacy Policy', url: '/privacy' } }\" />\n *\n * Only `http:`, `https:`, `mailto:`, `tel:` addresses and in-app paths are linked (see `CheckboxLabelLink`); a link whose address is unsafe or empty still shows its text,\n * just not as a link, and a link without text is left out. An absolute http(s) address opens in a new tab (`noopener noreferrer`, with \"(opens in a new tab)\" for\n * screen readers). A `{key}` that is not in `labelLinks` stays as typed. Clicking a link follows it and does not toggle the box; clicking the rest of the label does.\n * The checkbox's name is the whole sentence; the \"required\" message uses the sentence with the link texts in place of the `{key}`s. Without `labelLinks` (default) the\n * label is plain text exactly as before.\n */\n readonly labelLinks = input<Record<string, CheckboxLabelLink>>({});\n /** The label as text and links, or null when the label has no `{key}` that `labelLinks` knows (then it is drawn as plain text, as before). */\n protected readonly _labelSegments = computed((): CheckboxLabelSegment[] | null => {\n const label = this.label();\n const links = this.labelLinks();\n if (!label || !links || Object.keys(links).length === 0) return null;\n const segments: CheckboxLabelSegment[] = [];\n let used = false;\n let last = 0;\n for (const m of label.matchAll(/\\{([A-Za-z0-9_-]+)\\}/g)) {\n const link = Object.prototype.hasOwnProperty.call(links, m[1]) ? links[m[1]] : undefined;\n if (!link) continue; // not a known link: the {key} stays as typed\n used = true;\n const at = m.index ?? 0;\n if (at > last) segments.push({ text: label.slice(last, at) });\n const text = link.label ?? '';\n const href = safeLinkHref(link.url);\n if (text.trim()) segments.push(href ? { text, href, newTab: opensInNewTab(href), testId: link.testId } : { text });\n last = at + m[0].length;\n }\n if (!used) return null;\n if (last < label.length) segments.push({ text: label.slice(last) });\n return segments;\n });\n /** The label as plain text: the link texts in place of their `{key}`s (used for the \"required\" message). */\n protected readonly _plainLabel = computed(() => this._labelSegments()?.map(s => s.text).join('') ?? this.label());\n /** Single mode: small helper text under the label, linked to the native checkbox with `aria-describedby`. None when empty (default). */\n readonly description = input('');\n /** Set when the host projects a `[checkbox-trailing]` element (see `CheckboxTrailingDirective`). */\n private readonly _trailingContent = contentChild(CheckboxTrailingDirective);\n protected readonly _trailing = computed(() => !this.groupMode() && !!this._trailingContent());\n private readonly _host = inject<ElementRef<HTMLElement>>(ElementRef);\n /** `aria-describedby` of the single checkbox: its description, then the error / hint; none when neither exists (as before). */\n protected readonly _singleDescribedBy = computed(() => {\n const ids = [\n this.description() ? this._descId + '-d' : '',\n (this._activeError() || this.hint()) ? this._descId : '',\n ].filter(Boolean);\n return ids.length ? ids.join(' ') : null;\n });\n /** Indent this checkbox (or the whole group) under its parent option, aligned with the parent's label. */\n readonly indent = input(false);\n protected readonly groupMode = computed(() => this.options().length > 0);\n private readonly _selected = signal<string[]>([]);\n protected isSelected(value: string): boolean { return this._selected().includes(value); }\n /** The box must be ticked. */\n readonly required = input(false);\n /** Replaces the built-in \"<label> is required.\" message. */\n readonly requiredMessage = input('');\n readonly hint = input('');\n /** Host-provided error message (wins over the built-in one). */\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 control at once (it also shows after the user left THIS control); switching it from true back to false forgets that the control was left. */\n readonly showErrors = input(false);\n\n protected readonly _descId = `cb-${Math.random().toString(36).slice(2, 8)}-desc`;\n private readonly _reveal = createFieldReveal(this.showErrors);\n private readonly _issue = computed((): FieldIssue | null => this._check(this.groupMode() ? this._selected().length > 0 : this.checked()));\n /** True while a required box is unticked or the host passed an `[error]`. */\n readonly invalid = computed(() => !!this.error() || !!this._issue());\n /** Message of the broken built-in rule ('' when valid), shown or not. */\n readonly errorMessage = computed(() => this._issue()?.message ?? '');\n /** Emits whenever the field becomes invalid / valid. */\n readonly invalidChange = output<boolean>();\n protected readonly _activeError = computed(() => this._reveal.revealed() ? (this.error() || this.errorMessage()) : '');\n private _onValidatorChange = () => {};\n\n constructor() {\n // Kept unconditional on purpose: output subscribers are attached after construction (and an unobserved\n // OutputEmitterRef.emit is a no-op), so skipping the effect would need Angular-internal listener checks and risk\n // missing a late subscriber. Table row checkboxes pay one effect each; `invalid`/`errorMessage` computeds are lazy.\n effect(() => { this.invalidChange.emit(this.invalid()); });\n // `[(values)]` (group mode): follow the host's array; skipped while it is unset or already equal to the selection.\n effect(() => {\n const v = this.values();\n if (!v) return;\n const next = this.inOptionOrder(v);\n const cur = this._selected();\n if (next.length !== cur.length || next.some((x, i) => x !== cur[i])) this._selected.set(next);\n });\n }\n\n /**\n * Puts the box back to a state chosen by the host after it refused a change (e.g. a confirm was declined). Writes the model, the\n * native input(s) and the form control, which re-setting the same bound value cannot do (the one-way binding sees no change\n * while the DOM and the internal state already moved). Single mode: `reset(false)` / `reset(true)`; group mode: `reset(['a'])`.\n */\n reset(value: boolean | string[] = false): void {\n if (this.groupMode()) {\n const next = this.inOptionOrder(Array.isArray(value) ? value : []);\n this._selected.set(next);\n if (this.values() !== undefined) this.values.set(next);\n this._syncNative(opt => next.includes(opt));\n this.onChange(next);\n } else {\n const on = Array.isArray(value) ? value.length > 0 : !!value;\n this.checked.set(on);\n this._syncNative(() => on);\n this.onChange(on);\n }\n }\n\n /** Sets every native checkbox of this component to the state the component holds (the DOM may have moved ahead of it). */\n private _syncNative(isOn: (optionValue: string) => boolean): void {\n this._host.nativeElement.querySelectorAll<HTMLInputElement>('input[type=\"checkbox\"]').forEach(el => {\n el.checked = this.groupMode() ? isOn(el.getAttribute('value') ?? '') : isOn('');\n });\n }\n\n /** Re-run the form control's validation when a rule input (`required`, `requiredMessage`, `label`) changes. */\n ngOnChanges() { this._onValidatorChange(); }\n\n validate(control: AbstractControl): ValidationErrors | null {\n const v = control.value;\n return issueToErrors(this._check(Array.isArray(v) ? v.length > 0 : !!v));\n }\n registerOnValidatorChange(fn: () => void) { this._onValidatorChange = fn; }\n\n private _check(checked: boolean): FieldIssue | null {\n if (this.disabled() || !this.required() || checked) return null;\n const rm = this.requiredMessage();\n return rm ? { key: 'required', message: rm } : requiredIssue(this.groupMode() ? this._legend() : this._plainLabel());\n }\n\n /** Public so a host template can bind `[disabled]` (a protected input fails strict template type-checking, TS2445). */\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 onChange = (_: boolean | string[]) => {};\n private onTouched = () => {};\n\n writeValue(val: boolean | string[] | null) {\n if (Array.isArray(val)) this._selected.set(this.inOptionOrder(val));\n else if (this.groupMode()) this._selected.set([]); // form.reset() / null clears the group\n else this.checked.set(!!val);\n }\n registerOnChange(fn: (v: boolean | string[]) => void) { this.onChange = fn; }\n registerOnTouched(fn: () => void) { this.onTouched = fn; }\n setDisabledState(d: boolean) { this._cvaDisabled.set(d); }\n\n onToggle(event: Event) {\n if (this.disabled()) return;\n const val = (event.target as HTMLInputElement).checked;\n this.checked.set(val);\n this.onChange(val);\n this.onTouched();\n this._reveal.touched.set(true);\n }\n\n /** The values keep the option order, and values that are not an option are dropped. */\n private inOptionOrder(values: string[]): string[] {\n const opts = this.options();\n return opts.length === 0 ? [...values] : opts.map(o => o.value).filter(v => values.includes(v));\n }\n\n /** Group mode: ticks / unticks one option; the form gets the full list of ticked values. */\n onToggleOption(value: string, event: Event) {\n if (this.disabled() || this.options().find(o => o.value === value)?.disabled) return;\n const on = (event.target as HTMLInputElement).checked;\n const next = this.inOptionOrder(on ? [...this._selected(), value] : this._selected().filter(v => v !== value));\n this._selected.set(next);\n if (this.values() !== undefined) this.values.set(next);\n this.onChange(next);\n this.onTouched();\n this._reveal.touched.set(true);\n }\n}\n"],"mappings":";;;;;;AAgBA,IAAa,4BAAb,MAAa,0BAAyB;CAAzB;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAyB,MAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAAzB;EAAA,KAAA,OAAA,GAAA,qBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,MAAA;GAAyB,cAAA;GAAA,UAAA;GAAA,UAAA;EAAA,CAAA;CAAA;;AAAzB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAyB,YAAA,CAAA;EAJrC,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,YAAY;EACb,CAAA;;;ACyPD,IAAa,oBAAb,MAAa,kBAAiB;CA8FlB,WAAW,OAAa;EAAa,OAAO,KAAK,UAAS,CAAE,CAAC,SAAS,KAAK;CAAG;CAuBxF,cAAA;EApHmB,KAAA,SAAS,OAAO,eAAe;EACzC,KAAA,QAAQ,MAAM,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;EAEjB,KAAA,YAAY,MAAM,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;EAErB,KAA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CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAAA,yBAAyB,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,iBAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,YAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,eAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,eAAA;EAAA,CAAA;EAAA,gBAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
@@ -320,7 +320,7 @@ var ColorInputComponent = class ColorInputComponent {
320
320
  </div>
321
321
  `,
322
322
  isInline: true,
323
- styles: [":host{display:block}.co-field{display:flex;flex-direction:column;gap:6px}.co-label{font-size:.8125rem;font-weight:600;color:#374151;line-height:1}.co-required{color:#dc2626;margin-left:2px}.co-row{display:flex;align-items:center;gap:8px}.co-swatch{position:relative;flex-shrink:0;width:38px;height:38px;box-sizing:border-box;border:1px solid #7c8ba1;border-radius:8px;overflow:hidden;background:#fff;transition:border-color .15s,box-shadow .15s}.co-swatch-wide{flex:1;width:auto;min-width:0;height:40px;cursor:pointer}.co-swatch-wide:hover{border-color:#475569}.co-chip{position:absolute;top:50%;right:8px;transform:translateY(-50%);display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:6px;background:#fff;color:#334155;border:1px solid #94a3b8;pointer-events:none}.co-swatch:focus-within{border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61f}.co-preview{position:absolute;inset:0;display:block}.co-native{position:absolute;inset:0;width:100%;height:100%;margin:0;padding:0;border:0;opacity:0;cursor:pointer;-webkit-appearance:none;appearance:none;background:transparent}.co-native::-webkit-color-swatch-wrapper{padding:0}.co-native::-webkit-color-swatch{border:0;border-radius:0}.co-native::-moz-color-swatch{border:0;border-radius:0}.co-text{flex:1;min-width:0;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}.co-text::placeholder{color:#64748b;opacity:1}.co-text:focus{border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61f}.co-presets{display:flex;flex-wrap:wrap;gap:8px}.co-preset{width:28px;height:28px;padding:0;box-sizing:border-box;cursor:pointer;border:1px solid #7c8ba1;border-radius:50%}.co-preset-selected{box-shadow:0 0 0 2px #fff,0 0 0 4px #3b82f6}.co-preset:focus{outline:2px solid #3b82f6;outline-offset:2px}.co-preset:focus:not(:focus-visible){outline:none}.co-error .co-text,.co-error .co-swatch{border-color:#ef4444}.co-error .co-text:focus{box-shadow:0 0 0 3px #ef44441f}.co-disabled .co-text,.co-disabled .co-swatch,.co-disabled .co-preset{opacity:.5;cursor:not-allowed}.co-disabled .co-native{cursor:not-allowed}.co-desc{margin:0;font-size:.75rem;line-height:1.4;color:#64748b}.co-desc-error{color:#dc2626}@media(max-width:480px){.co-text{font-size:1rem}}@media(pointer:coarse),(max-width:480px){.co-text{min-height:44px}.co-swatch{width:44px;height:44px}.co-swatch-wide{width:auto;height:44px}.co-preset{width:44px;height:44px}}\n"],
323
+ styles: [":host{display:block}.co-field{display:flex;flex-direction:column;gap:6px}.co-label{font-size:.8125rem;font-weight:600;color:#374151;line-height:1}.co-required{color:#dc2626;margin-left:2px}.co-row{display:flex;align-items:center;gap:8px}.co-swatch{position:relative;flex-shrink:0;width:38px;height:38px;box-sizing:border-box;border:1px solid #7c8ba1;border-radius:8px;overflow:hidden;background:#fff;transition:border-color .15s,box-shadow .15s}.co-swatch-wide{flex:1;width:auto;min-width:0;height:40px;cursor:pointer}.co-swatch-wide:hover{border-color:#475569}.co-chip{position:absolute;top:50%;right:8px;transform:translateY(-50%);display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:6px;background:#fff;color:#334155;border:1px solid #94a3b8;pointer-events:none}.co-swatch:focus-within{border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61f}.co-preview{position:absolute;inset:0;display:block}.co-native{position:absolute;inset:0;width:100%;height:100%;margin:0;padding:0;border:0;opacity:0;cursor:pointer;-webkit-appearance:none;appearance:none;background:transparent}.co-native::-webkit-color-swatch-wrapper{padding:0}.co-native::-webkit-color-swatch{border:0;border-radius:0}.co-native::-moz-color-swatch{border:0;border-radius:0}.co-text{flex:1;min-width:0;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}.co-text::placeholder{color:#64748b;opacity:1}.co-text:focus{border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61f}.co-presets{display:flex;flex-wrap:wrap;gap:8px}.co-preset{width:28px;height:28px;padding:0;box-sizing:border-box;cursor:pointer;border:1px solid #7c8ba1;border-radius:50%}.co-preset-selected{box-shadow:0 0 0 2px #fff,0 0 0 4px #3b82f6}.co-preset:focus{outline:2px solid #3b82f6;outline-offset:2px}.co-preset:focus:not(:focus-visible){outline:none}.co-error .co-text,.co-error .co-swatch{border-color:#ef4444}.co-error .co-text:focus{box-shadow:0 0 0 3px #ef44441f}.co-disabled .co-text,.co-disabled .co-swatch,.co-disabled .co-preset{opacity:.5;cursor:not-allowed}.co-disabled .co-native{cursor:not-allowed}.co-desc{margin:-6px 0 0;font-size:.75rem;line-height:1.4;color:#64748b}.co-desc-error{color:#dc2626}@media(max-width:480px){.co-text{font-size:1rem}}@media(pointer:coarse),(max-width:480px){.co-text{min-height:44px}.co-swatch{width:44px;height:44px}.co-swatch-wide{width:auto;height:44px}.co-preset{width:44px;height:44px}}\n"],
324
324
  changeDetection: i0.ChangeDetectionStrategy.OnPush
325
325
  });
326
326
  }
@@ -422,7 +422,7 @@ i0.ɵɵngDeclareClassMetadata({
422
422
  }
423
423
  </div>
424
424
  `,
425
- styles: [":host{display:block}.co-field{display:flex;flex-direction:column;gap:6px}.co-label{font-size:.8125rem;font-weight:600;color:#374151;line-height:1}.co-required{color:#dc2626;margin-left:2px}.co-row{display:flex;align-items:center;gap:8px}.co-swatch{position:relative;flex-shrink:0;width:38px;height:38px;box-sizing:border-box;border:1px solid #7c8ba1;border-radius:8px;overflow:hidden;background:#fff;transition:border-color .15s,box-shadow .15s}.co-swatch-wide{flex:1;width:auto;min-width:0;height:40px;cursor:pointer}.co-swatch-wide:hover{border-color:#475569}.co-chip{position:absolute;top:50%;right:8px;transform:translateY(-50%);display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:6px;background:#fff;color:#334155;border:1px solid #94a3b8;pointer-events:none}.co-swatch:focus-within{border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61f}.co-preview{position:absolute;inset:0;display:block}.co-native{position:absolute;inset:0;width:100%;height:100%;margin:0;padding:0;border:0;opacity:0;cursor:pointer;-webkit-appearance:none;appearance:none;background:transparent}.co-native::-webkit-color-swatch-wrapper{padding:0}.co-native::-webkit-color-swatch{border:0;border-radius:0}.co-native::-moz-color-swatch{border:0;border-radius:0}.co-text{flex:1;min-width:0;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}.co-text::placeholder{color:#64748b;opacity:1}.co-text:focus{border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61f}.co-presets{display:flex;flex-wrap:wrap;gap:8px}.co-preset{width:28px;height:28px;padding:0;box-sizing:border-box;cursor:pointer;border:1px solid #7c8ba1;border-radius:50%}.co-preset-selected{box-shadow:0 0 0 2px #fff,0 0 0 4px #3b82f6}.co-preset:focus{outline:2px solid #3b82f6;outline-offset:2px}.co-preset:focus:not(:focus-visible){outline:none}.co-error .co-text,.co-error .co-swatch{border-color:#ef4444}.co-error .co-text:focus{box-shadow:0 0 0 3px #ef44441f}.co-disabled .co-text,.co-disabled .co-swatch,.co-disabled .co-preset{opacity:.5;cursor:not-allowed}.co-disabled .co-native{cursor:not-allowed}.co-desc{margin:0;font-size:.75rem;line-height:1.4;color:#64748b}.co-desc-error{color:#dc2626}@media(max-width:480px){.co-text{font-size:1rem}}@media(pointer:coarse),(max-width:480px){.co-text{min-height:44px}.co-swatch{width:44px;height:44px}.co-swatch-wide{width:auto;height:44px}.co-preset{width:44px;height:44px}}\n"]
425
+ styles: [":host{display:block}.co-field{display:flex;flex-direction:column;gap:6px}.co-label{font-size:.8125rem;font-weight:600;color:#374151;line-height:1}.co-required{color:#dc2626;margin-left:2px}.co-row{display:flex;align-items:center;gap:8px}.co-swatch{position:relative;flex-shrink:0;width:38px;height:38px;box-sizing:border-box;border:1px solid #7c8ba1;border-radius:8px;overflow:hidden;background:#fff;transition:border-color .15s,box-shadow .15s}.co-swatch-wide{flex:1;width:auto;min-width:0;height:40px;cursor:pointer}.co-swatch-wide:hover{border-color:#475569}.co-chip{position:absolute;top:50%;right:8px;transform:translateY(-50%);display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:6px;background:#fff;color:#334155;border:1px solid #94a3b8;pointer-events:none}.co-swatch:focus-within{border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61f}.co-preview{position:absolute;inset:0;display:block}.co-native{position:absolute;inset:0;width:100%;height:100%;margin:0;padding:0;border:0;opacity:0;cursor:pointer;-webkit-appearance:none;appearance:none;background:transparent}.co-native::-webkit-color-swatch-wrapper{padding:0}.co-native::-webkit-color-swatch{border:0;border-radius:0}.co-native::-moz-color-swatch{border:0;border-radius:0}.co-text{flex:1;min-width:0;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}.co-text::placeholder{color:#64748b;opacity:1}.co-text:focus{border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61f}.co-presets{display:flex;flex-wrap:wrap;gap:8px}.co-preset{width:28px;height:28px;padding:0;box-sizing:border-box;cursor:pointer;border:1px solid #7c8ba1;border-radius:50%}.co-preset-selected{box-shadow:0 0 0 2px #fff,0 0 0 4px #3b82f6}.co-preset:focus{outline:2px solid #3b82f6;outline-offset:2px}.co-preset:focus:not(:focus-visible){outline:none}.co-error .co-text,.co-error .co-swatch{border-color:#ef4444}.co-error .co-text:focus{box-shadow:0 0 0 3px #ef44441f}.co-disabled .co-text,.co-disabled .co-swatch,.co-disabled .co-preset{opacity:.5;cursor:not-allowed}.co-disabled .co-native{cursor:not-allowed}.co-desc{margin:-6px 0 0;font-size:.75rem;line-height:1.4;color:#64748b}.co-desc-error{color:#dc2626}@media(max-width:480px){.co-text{font-size:1rem}}@media(pointer:coarse),(max-width:480px){.co-text{min-height:44px}.co-swatch{width:44px;height:44px}.co-swatch-wide{width:auto;height:44px}.co-preset{width:44px;height:44px}}\n"]
426
426
  }]
427
427
  }],
428
428
  ctorParameters: () => [],
@@ -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,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;EAE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,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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AA,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,ogFAAA;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,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: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"],
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: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"]
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()\">&times;</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;CAgG5B,cAAA;EA/FmB,K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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()\">&times;</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,MAAqB,MAAI;GAAA,GAAA,Y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