@lilydesignsystem/angular-link-picker 0.1.2 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,15 +15,18 @@ import { LinkPicker, type LinkItem } from "@lilydesignsystem/angular-link-picker
15
15
  selector: "app-header",
16
16
  standalone: true,
17
17
  imports: [LinkPicker],
18
- template: `<lily-link-picker label="Pages" [links]="links" />`,
18
+ template: `<lily-link-picker
19
+ label="Pages"
20
+ [links]="links"
21
+ />`,
19
22
  })
20
23
  export class AppHeader {
21
24
  links: LinkItem[] = [
22
- { label: "Home", href: "/" },
23
- { label: "About Us", href: "/about/" },
24
- { label: "Contact Us", href: "/contact/" },
25
- { label: "Privacy Policy", href: "/privacy/" },
26
- ];
25
+ { label: "Home", href: "/" },
26
+ { label: "About Us", href: "/about/" },
27
+ { label: "Contact Us", href: "/contact/" },
28
+ { label: "Privacy Policy", href: "/privacy/" },
29
+ ];
27
30
  }
28
31
  ```
29
32
 
@@ -40,17 +43,22 @@ import { LinkPicker } from "@lilydesignsystem/angular-link-picker";
40
43
  selector: "app-header",
41
44
  standalone: true,
42
45
  imports: [LinkPicker],
43
- template: `<lily-link-picker label="Pages" [links]="links()" [navigate]="go" />`,
46
+ template: `<lily-link-picker
47
+ label="Pages"
48
+ [links]="links()"
49
+ [navigate]="go"
50
+ />`,
44
51
  })
45
52
  export class AppHeader {
46
53
  private router = inject(Router);
47
54
  go = (href: string) => void this.router.navigateByUrl(href);
48
- links = () => [
49
- { label: "Home", href: "/" },
50
- { label: "About Us", href: "/about/" },
51
- { label: "Contact Us", href: "/contact/" },
52
- { label: "Privacy Policy", href: "/privacy/" },
53
- ].map((p) => ({ ...p, current: this.router.url === p.href }));
55
+ links = () =>
56
+ [
57
+ { label: "Home", href: "/" },
58
+ { label: "About Us", href: "/about/" },
59
+ { label: "Contact Us", href: "/contact/" },
60
+ { label: "Privacy Policy", href: "/privacy/" },
61
+ ].map((p) => ({ ...p, current: this.router.url === p.href }));
54
62
  }
55
63
  ```
56
64
 
@@ -58,13 +66,13 @@ Ctrl/Cmd/Shift/Alt-click, middle-click and `newTab` links always stay native bro
58
66
 
59
67
  ## `LinkItem`
60
68
 
61
- | Field | Notes |
62
- | --- | --- |
63
- | label | Visible text. Yours, so it localises. |
64
- | href | A route (`"/about/"`) or a full URL. |
65
- | id | Reported when a link is chosen; defaults to the href. |
66
- | current | Marks the current page with `aria-current="page"`. |
67
- | newTab | `target="_blank"` with `rel="noopener noreferrer"`. |
69
+ | Field | Notes |
70
+ | ------- | ----------------------------------------------------- |
71
+ | label | Visible text. Yours, so it localises. |
72
+ | href | A route (`"/about/"`) or a full URL. |
73
+ | id | Reported when a link is chosen; defaults to the href. |
74
+ | current | Marks the current page with `aria-current="page"`. |
75
+ | newTab | `target="_blank"` with `rel="noopener noreferrer"`. |
68
76
 
69
77
  ## Props
70
78
 
@@ -78,7 +86,7 @@ Ctrl/Cmd/Shift/Alt-click, middle-click and `newTab` links always stay native bro
78
86
  ## Styling
79
87
 
80
88
  Headless: no CSS ships. Hooks: `.link-picker`, `.link-picker-button`, `.link-picker-icon`, `.link-picker-tooltip`,
81
- `.link-picker-list` (carries `hidden` when closed), `.link-picker-list-item`, `.link-picker-link`. The monorepo's 45 `themes/`
89
+ `.link-picker-list` (carries `hidden` when closed), `.link-picker-list-item`, `.link-picker-link`. The monorepo's 57 `themes/`
82
90
  style them all, including the popup placement.
83
91
 
84
92
  ## Examples
@@ -1,6 +1,6 @@
1
1
  import { NgTemplateOutlet } from "@angular/common";
2
2
  import * as i0 from "@angular/core";
3
- import { ChangeDetectionStrategy, Component, Directive, TemplateRef, computed, contentChild, effect, input, output, signal, viewChild } from "@angular/core";
3
+ import { ChangeDetectionStrategy, Component, Directive, Injector, TemplateRef, afterNextRender, computed, contentChild, effect, inject, input, model, output, signal, viewChild } from "@angular/core";
4
4
  import { IconButton } from "@lilydesignsystem/angular-headless";
5
5
  function linkId(link) {
6
6
  return link.id ?? link.href;
@@ -17,7 +17,7 @@ var LinkPickerIcon = class LinkPickerIcon {
17
17
  static {
18
18
  this.ɵfac = i0.ɵɵngDeclareFactory({
19
19
  minVersion: "12.0.0",
20
- version: "22.2.1",
20
+ version: "22.2.4",
21
21
  ngImport: i0,
22
22
  type: LinkPickerIcon,
23
23
  deps: [],
@@ -27,7 +27,7 @@ var LinkPickerIcon = class LinkPickerIcon {
27
27
  static {
28
28
  this.ɵdir = i0.ɵɵngDeclareDirective({
29
29
  minVersion: "14.0.0",
30
- version: "22.2.1",
30
+ version: "22.2.4",
31
31
  type: LinkPickerIcon,
32
32
  isStandalone: true,
33
33
  selector: "ng-template[lilyLinkPickerIcon]",
@@ -37,7 +37,7 @@ var LinkPickerIcon = class LinkPickerIcon {
37
37
  };
38
38
  i0.ɵɵngDeclareClassMetadata({
39
39
  minVersion: "12.0.0",
40
- version: "22.2.1",
40
+ version: "22.2.4",
41
41
  ngImport: i0,
42
42
  type: LinkPickerIcon,
43
43
  decorators: [{
@@ -61,7 +61,12 @@ var LinkPicker = class LinkPicker {
61
61
  this.listRef = viewChild.required("listEl", ...ngDevMode ? [{ debugName: "listRef" }] : /* istanbul ignore next */ []);
62
62
  this.baseId = nextLinkPickerId();
63
63
  this.listId = `${this.baseId}-list`;
64
- this.open = signal(false, ...ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []);
64
+ this.open = model(false, ...ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []);
65
+ this.disabled = input(false, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
66
+ this.closeWhenDisabled = effect(() => {
67
+ if (this.disabled() && this.open()) this.open.set(false);
68
+ }, ...ngDevMode ? [{ debugName: "closeWhenDisabled" }] : /* istanbul ignore next */ []);
69
+ this.injector = inject(Injector);
65
70
  this.tooltipId = `${this.baseId}-tooltip`;
66
71
  this.hoverButton = signal(false, ...ngDevMode ? [{ debugName: "hoverButton" }] : /* istanbul ignore next */ []);
67
72
  this.hoverTooltip = signal(false, ...ngDevMode ? [{ debugName: "hoverTooltip" }] : /* istanbul ignore next */ []);
@@ -110,10 +115,10 @@ var LinkPicker = class LinkPicker {
110
115
  }
111
116
  openList(focusLast = false) {
112
117
  this.open.set(true);
113
- queueMicrotask(() => {
118
+ afterNextRender(() => {
114
119
  const all = this.items();
115
120
  (focusLast ? all[all.length - 1] : all[0])?.focus({ preventScroll: true });
116
- });
121
+ }, { injector: this.injector });
117
122
  }
118
123
  closeList(refocus = true) {
119
124
  if (!this.open()) return;
@@ -199,7 +204,7 @@ var LinkPicker = class LinkPicker {
199
204
  static {
200
205
  this.ɵfac = i0.ɵɵngDeclareFactory({
201
206
  minVersion: "12.0.0",
202
- version: "22.2.1",
207
+ version: "22.2.4",
203
208
  ngImport: i0,
204
209
  type: LinkPicker,
205
210
  deps: [],
@@ -209,7 +214,7 @@ var LinkPicker = class LinkPicker {
209
214
  static {
210
215
  this.ɵcmp = i0.ɵɵngDeclareComponent({
211
216
  minVersion: "17.0.0",
212
- version: "22.2.1",
217
+ version: "22.2.4",
213
218
  type: LinkPicker,
214
219
  isStandalone: true,
215
220
  selector: "lily-link-picker",
@@ -241,9 +246,26 @@ var LinkPicker = class LinkPicker {
241
246
  isSignal: true,
242
247
  isRequired: false,
243
248
  transformFunction: null
249
+ },
250
+ open: {
251
+ classPropertyName: "open",
252
+ publicName: "open",
253
+ isSignal: true,
254
+ isRequired: false,
255
+ transformFunction: null
256
+ },
257
+ disabled: {
258
+ classPropertyName: "disabled",
259
+ publicName: "disabled",
260
+ isSignal: true,
261
+ isRequired: false,
262
+ transformFunction: null
244
263
  }
245
264
  },
246
- outputs: { navigated: "navigated" },
265
+ outputs: {
266
+ navigated: "navigated",
267
+ open: "openChange"
268
+ },
247
269
  host: { listeners: { "document:click": "onDocumentClick($event)" } },
248
270
  queries: [{
249
271
  propertyName: "iconTemplate",
@@ -283,6 +305,7 @@ var LinkPicker = class LinkPicker {
283
305
  (focusout)="onRootFocusOut($event)"
284
306
  >
285
307
  <lily-icon-button
308
+ [disabled]="disabled()"
286
309
  #buttonEl
287
310
  [label]="label()"
288
311
  baseClass="link-picker-button"
@@ -390,7 +413,7 @@ var LinkPicker = class LinkPicker {
390
413
  };
391
414
  i0.ɵɵngDeclareClassMetadata({
392
415
  minVersion: "12.0.0",
393
- version: "22.2.1",
416
+ version: "22.2.4",
394
417
  ngImport: i0,
395
418
  type: LinkPicker,
396
419
  decorators: [{
@@ -408,6 +431,7 @@ i0.ɵɵngDeclareClassMetadata({
408
431
  (focusout)="onRootFocusOut($event)"
409
432
  >
410
433
  <lily-icon-button
434
+ [disabled]="disabled()"
411
435
  #buttonEl
412
436
  [label]="label()"
413
437
  baseClass="link-picker-button"
@@ -538,6 +562,25 @@ i0.ɵɵngDeclareClassMetadata({
538
562
  listRef: [{
539
563
  type: i0.ViewChild,
540
564
  args: ["listEl", { isSignal: true }]
565
+ }],
566
+ open: [{
567
+ type: i0.Input,
568
+ args: [{
569
+ isSignal: true,
570
+ alias: "open",
571
+ required: false
572
+ }]
573
+ }, {
574
+ type: i0.Output,
575
+ args: ["openChange"]
576
+ }],
577
+ disabled: [{
578
+ type: i0.Input,
579
+ args: [{
580
+ isSignal: true,
581
+ alias: "disabled",
582
+ required: false
583
+ }]
541
584
  }]
542
585
  }
543
586
  });
@@ -1 +1 @@
1
- {"version":3,"file":"lilydesignsystem-angular-link-picker.mjs","names":[],"sources":["../../link-picker.component.ts"],"sourcesContent":["import { NgTemplateOutlet } from \"@angular/common\";\nimport {\n ChangeDetectionStrategy,\n Component,\n Directive,\n ElementRef,\n TemplateRef,\n computed,\n contentChild,\n effect,\n input,\n output,\n signal,\n viewChild,\n} from \"@angular/core\";\n// Only the trigger button composes a headless primitive. The list below is real `<a>` navigation\n// with a roving-focus pattern of its own — not an ARIA listbox or menu: role=\"menuitem\" would strip\n// middle-click, open-in-new-tab and copy-link-address from ordinary links. See spec/index.md §3.\nimport { IconButton } from \"@lilydesignsystem/angular-headless\";\n\n/**\n * One destination in the list. The app defines them all: this package ships no routes and no\n * English — `label` is the consumer's text.\n */\nexport type LinkItem = {\n /** Stable identifier, passed back on the `navigated` output. Defaults to `href`. */\n id?: string;\n /** Visible link text. Consumer-supplied, so it localises. */\n label: string;\n /** Where the link goes: a route (\"/about/\") or a full URL. */\n href: string;\n /** Marks this link as the current page (`aria-current=\"page\"`). */\n current?: boolean;\n /** Open in a new tab (`target=\"_blank\"` with `rel=\"noopener noreferrer\"`). */\n newTab?: boolean;\n};\n\n/** Context passed to a custom icon `<ng-template>` (the button icon). */\nexport type ChildArgs = {\n /** Is the list open? */\n open: boolean;\n};\n\n/** Payload of the `navigated` output. */\nexport type LinkNavigatedEvent = {\n /** The chosen link's `id` (its `href` when it has none). */\n id: string;\n /** The chosen link's `href`. */\n href: string;\n};\n\n/** The id a link reports: its explicit `id`, else its `href`. */\nexport function linkId(link: LinkItem): string {\n return link.id ?? link.href;\n}\n\nlet uid = 0;\n/** Stable per-instance id prefix; SSR-safe (no Math.random / Date.now). */\nexport function nextLinkPickerId(): string {\n uid += 1;\n return `link-picker-${uid}`;\n}\n\n/**\n * Optional marker for the projected icon template. Gives consumers typed `let-` variables:\n *\n * ```html\n * <lily-link-picker label=\"Pages\" [links]=\"links\">\n * <ng-template lilyLinkPickerIcon let-args>{{ args.open ? \"×\" : \"☰\" }}</ng-template>\n * </lily-link-picker>\n * ```\n */\n@Directive({\n selector: \"ng-template[lilyLinkPickerIcon]\",\n standalone: true,\n})\nexport class LinkPickerIcon {\n static ngTemplateContextGuard(\n _dir: LinkPickerIcon,\n _ctx: unknown,\n ): _ctx is ChildArgs & { $implicit: ChildArgs } {\n return true;\n }\n}\n\n/**\n * LinkPicker — a headless page-links control.\n *\n * A single-icon button (a bundled home SVG) that opens a disclosure list of page links the app\n * defines. It applies nothing to the document and persists nothing. See `spec/index.md`.\n */\n@Component({\n selector: \"lily-link-picker\",\n standalone: true,\n imports: [NgTemplateOutlet, IconButton],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n \"(document:click)\": \"onDocumentClick($event)\",\n },\n template: `\n <div\n #rootEl\n class=\"link-picker {{ className() }}\"\n (focusout)=\"onRootFocusOut($event)\"\n >\n <lily-icon-button\n #buttonEl\n [label]=\"label()\"\n baseClass=\"link-picker-button\"\n [ariaExpanded]=\"open()\"\n [ariaControls]=\"listId\"\n (click)=\"onButtonClick(); hoverButton.set(false)\"\n (mouseenter)=\"onTooltipButtonEnter()\"\n (mouseleave)=\"hoverButton.set(false)\"\n (focusin)=\"onTooltipButtonFocusIn()\"\n (focusout)=\"onTooltipButtonFocusOut()\"\n (keydown)=\"onButtonKeydown($event); onTooltipKeydown($event)\"\n >\n @if (iconTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"childContext()\"\n />\n } @else {\n <svg\n class=\"link-picker-icon\"\n viewBox=\"0 0 16 16\"\n width=\"1.05rem\"\n height=\"1.05rem\"\n aria-hidden=\"true\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.6\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <path d=\"M1 8 8 1.5l7 6.5\" />\n <path d=\"M2.5 7v7.5h11V7\" />\n <path d=\"M6.5 14.5v-4h3v4\" />\n </svg>\n }\n </lily-icon-button>\n\n <!-- Purely visual: the same text is already the button's aria-label, so it is not wired\n with aria-describedby (that would announce the name twice). -->\n <div\n class=\"link-picker-tooltip\"\n role=\"tooltip\"\n [id]=\"tooltipId\"\n [attr.hidden]=\"tooltipVisible() ? null : ''\"\n (mouseenter)=\"hoverTooltip.set(true)\"\n (mouseleave)=\"hoverTooltip.set(false)\"\n >{{ label() }}</div>\n\n <!-- Named like the sibling pickers' popups: a screen reader entering the list hears what\n it is for. -->\n <ul\n #listEl\n class=\"link-picker-list\"\n [id]=\"listId\"\n [attr.aria-label]=\"label() || null\"\n [attr.hidden]=\"open() ? null : ''\"\n (keydown)=\"onListKeydown($event)\"\n >\n @for (link of links(); track idOf(link)) {\n <li class=\"link-picker-list-item\">\n <!-- A real link, not role=\"menuitem\": these ARE navigation. -->\n <a\n class=\"link-picker-link\"\n [attr.data-link-id]=\"idOf(link)\"\n [attr.href]=\"link.href\"\n [attr.aria-current]=\"link.current ? 'page' : null\"\n [attr.target]=\"link.newTab ? '_blank' : null\"\n [attr.rel]=\"link.newTab ? 'noopener noreferrer' : null\"\n (click)=\"onLinkClick($event, link)\"\n >{{ link.label }}</a\n >\n </li>\n }\n </ul>\n </div>\n `,\n})\nexport class LinkPicker {\n /** Accessible name for the button and the list. */\n readonly label = input.required<string>();\n /** The page links to offer. Defined by the app. */\n readonly links = input.required<LinkItem[]>();\n /**\n * Client-side navigation hook, e.g. a router's `navigateByUrl`. When given, a plain left click\n * on a link calls `navigate(href)` instead of letting the browser load the page; modified\n * clicks (Ctrl/Cmd/Shift/Alt, middle button) and `newTab` links stay native.\n */\n readonly navigate = input<((href: string) => void) | undefined>(undefined);\n /** Extra CSS class on the root div. */\n readonly className = input<string>(\"\");\n\n /** Fires after a link is chosen. */\n readonly navigated = output<LinkNavigatedEvent>();\n\n /** Projected icon template; replaces the default icon when supplied. */\n protected readonly iconTemplate = contentChild(TemplateRef);\n\n private readonly rootRef =\n viewChild.required<ElementRef<HTMLDivElement>>(\"rootEl\");\n // A template-ref-variable on a component tag resolves to the component INSTANCE, which is what\n // is needed to call the headless component's own public `focus()` method.\n private readonly buttonRef = viewChild.required<IconButton>(\"buttonEl\");\n private readonly listRef =\n viewChild.required<ElementRef<HTMLUListElement>>(\"listEl\");\n\n private readonly baseId = nextLinkPickerId();\n protected readonly listId = `${this.baseId}-list`;\n\n protected readonly open = signal(false);\n\n // Tooltip: shown while the pointer is over the button or the tooltip itself (hoverable, WCAG\n // 1.4.13) or while the button has keyboard focus; Escape dismisses it without moving focus;\n // never shown while the popup is open, since the popup then explains the control.\n protected readonly tooltipId = `${this.baseId}-tooltip`;\n protected readonly hoverButton = signal(false);\n protected readonly hoverTooltip = signal(false);\n protected readonly focusButton = signal(false);\n protected readonly dismissed = signal(false);\n protected readonly tooltipVisible = computed(\n () =>\n !this.open() &&\n !this.dismissed() &&\n (this.hoverButton() || this.hoverTooltip() || this.focusButton()),\n );\n\n protected onTooltipButtonEnter(): void {\n this.hoverButton.set(true);\n this.dismissed.set(false);\n }\n\n protected onTooltipButtonFocusIn(): void {\n // Keyboard focus only: a mouse click also focuses the button in Chromium, and the tooltip\n // should not stick after a click.\n try {\n this.focusButton.set(\n this.buttonRef().element?.matches(\":focus-visible\") ?? false,\n );\n } catch {\n this.focusButton.set(true); // engine without :focus-visible — err towards showing\n }\n }\n\n protected onTooltipButtonFocusOut(): void {\n this.focusButton.set(false);\n this.dismissed.set(false);\n }\n\n protected onTooltipKeydown(event: KeyboardEvent): void {\n if (event.key === \"Escape\" && this.tooltipVisible()) this.dismissed.set(true);\n }\n\n // WCAG 1.4.13 \"dismissable\": while the tooltip is visible, Escape works wherever focus is. The\n // listener exists only while visible; the effect cleanup removes it on hide and on destroy.\n private readonly tooltipEscapeListener = effect((onCleanup) => {\n if (!this.tooltipVisible() || typeof document === \"undefined\") return;\n const onKey = (event: KeyboardEvent): void => {\n if (event.key === \"Escape\") this.dismissed.set(true);\n };\n document.addEventListener(\"keydown\", onKey);\n onCleanup(() => document.removeEventListener(\"keydown\", onKey));\n });\n\n protected readonly childContext = computed(() => {\n const args: ChildArgs = { open: this.open() };\n return { $implicit: args, ...args };\n });\n\n protected idOf(link: LinkItem): string {\n return linkId(link);\n }\n\n /** Every focusable link in the list, in DOM order. */\n private items(): HTMLElement[] {\n return Array.from(\n this.listRef().nativeElement.querySelectorAll<HTMLElement>(\".link-picker-link\"),\n );\n }\n\n // ---------------------------------------------------------------\n // Open / close\n // ---------------------------------------------------------------\n\n /** Open the list, focusing the first link (or the last, if `focusLast`). */\n openList(focusLast = false): void {\n this.open.set(true);\n // Deferred so the `hidden` attribute is gone before focus is moved.\n queueMicrotask(() => {\n const all = this.items();\n (focusLast ? all[all.length - 1] : all[0])?.focus({ preventScroll: true });\n });\n }\n\n /** Close the list; `refocus` returns focus to the trigger. */\n closeList(refocus = true): void {\n if (!this.open()) return;\n this.open.set(false);\n if (refocus) queueMicrotask(() => this.buttonRef().focus({ preventScroll: true }));\n }\n\n protected onButtonClick(): void {\n if (this.open()) this.closeList();\n else this.openList();\n }\n\n protected onLinkClick(event: MouseEvent, link: LinkItem): void {\n this.navigated.emit({ id: linkId(link), href: link.href });\n const go = this.navigate();\n const modified =\n event.ctrlKey || event.metaKey || event.shiftKey || event.altKey || event.button !== 0;\n if (go && !link.newTab && !modified && !event.defaultPrevented) {\n event.preventDefault();\n go(link.href);\n }\n this.closeList();\n }\n\n // ---------------------------------------------------------------\n // Keyboard\n // ---------------------------------------------------------------\n\n protected onButtonKeydown(event: KeyboardEvent): void {\n // Enter and Space already produce a click; only the arrows need handling here.\n if (event.key === \"ArrowDown\") {\n event.preventDefault();\n if (!this.open()) this.openList();\n else this.items()[0]?.focus({ preventScroll: true });\n } else if (event.key === \"ArrowUp\") {\n event.preventDefault();\n if (!this.open()) this.openList(true);\n else {\n const all = this.items();\n all[all.length - 1]?.focus({ preventScroll: true });\n }\n }\n }\n\n private moveFocus(delta: number): void {\n const all = this.items();\n if (all.length === 0) return;\n const i = all.indexOf(document.activeElement as HTMLElement);\n // Clamp rather than wrap.\n const next = Math.min(Math.max((i < 0 ? 0 : i) + delta, 0), all.length - 1);\n all[next]?.focus({ preventScroll: true });\n }\n\n protected onListKeydown(event: KeyboardEvent): void {\n switch (event.key) {\n case \"ArrowDown\":\n event.preventDefault();\n this.moveFocus(1);\n break;\n case \"ArrowUp\":\n event.preventDefault();\n this.moveFocus(-1);\n break;\n case \"Home\":\n event.preventDefault();\n this.items()[0]?.focus({ preventScroll: true });\n break;\n case \"End\": {\n event.preventDefault();\n const all = this.items();\n all[all.length - 1]?.focus({ preventScroll: true });\n break;\n }\n case \"Escape\":\n event.preventDefault();\n this.closeList();\n break;\n case \"Tab\":\n // Focus goes to the button FIRST, without cancelling the key: hiding the list while a\n // link has focus drops focus to <body>, and the default Tab would restart from the top.\n this.buttonRef().focus?.({ preventScroll: true });\n this.closeList(false);\n break;\n default:\n break;\n }\n }\n\n protected onRootFocusOut(event: FocusEvent): void {\n const next = event.relatedTarget as Node | null;\n if (next && this.rootRef().nativeElement.contains(next)) return;\n this.closeList(false);\n }\n\n protected onDocumentClick(event: Event): void {\n if (!this.open()) return;\n const t = event.target as Node | null;\n if (t && !this.rootRef().nativeElement.contains(t)) this.closeList(false);\n }\n}\n"],"mappings":";;;;AAoDA,SAAgB,OAAO,MAAc;CACnC,OAAO,KAAK,MAAM,KAAK;AACzB;AAEA,IAAI,MAAM;AAEV,SAAgB,mBAAgB;CAC9B,OAAO;CACP,OAAO,eAAe;AACxB;AAeA,IAAa,iBAAb,MAAa,eAAc;CACzB,OAAO,uBACL,MACA,MAAa;EAEb,OAAO;CACT;CANW;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAc,MAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAAd;EAAA,KAAA,OAAA,GAAA,qBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,MAAA;GAAc,cAAA;GAAA,UAAA;GAAA,UAAA;EAAA,CAAA;CAAA;;AAAd,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAc,YAAA,CAAA;EAJ1B,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,YAAY;EACb,CAAA;;;AA4GD,IAAa,aAAb,MAAa,WAAU;CA5FvB,cAAA;EA8FW,KAAA,QAAQ,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;EAEhC,KAAA,QAAQ,MAAM,SAAsB,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CA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T,UAAQ,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAGG,YAAU,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAEnB,UAAQ,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"lilydesignsystem-angular-link-picker.mjs","names":[],"sources":["../../link-picker.component.ts"],"sourcesContent":["import { NgTemplateOutlet } from \"@angular/common\";\nimport {\n afterNextRender,\n ChangeDetectionStrategy,\n Component,\n computed,\n contentChild,\n Directive,\n effect,\n ElementRef,\n inject,\n Injector,\n input,\n model,\n output,\n signal,\n TemplateRef,\n viewChild,\n} from \"@angular/core\";\n// Only the trigger button composes a headless primitive. The list below is real `<a>` navigation\n// with a roving-focus pattern of its own — not an ARIA listbox or menu: role=\"menuitem\" would strip\n// middle-click, open-in-new-tab and copy-link-address from ordinary links. See spec/index.md §3.\nimport { IconButton } from \"@lilydesignsystem/angular-headless\";\n\n/**\n * One destination in the list. The app defines them all: this package ships no routes and no\n * English — `label` is the consumer's text.\n */\nexport type LinkItem = {\n /** Stable identifier, passed back on the `navigated` output. Defaults to `href`. */\n id?: string;\n /** Visible link text. Consumer-supplied, so it localises. */\n label: string;\n /** Where the link goes: a route (\"/about/\") or a full URL. */\n href: string;\n /** Marks this link as the current page (`aria-current=\"page\"`). */\n current?: boolean;\n /** Open in a new tab (`target=\"_blank\"` with `rel=\"noopener noreferrer\"`). */\n newTab?: boolean;\n};\n\n/** Context passed to a custom icon `<ng-template>` (the button icon). */\nexport type ChildArgs = {\n /** Is the list open? */\n open: boolean;\n};\n\n/** Payload of the `navigated` output. */\nexport type LinkNavigatedEvent = {\n /** The chosen link's `id` (its `href` when it has none). */\n id: string;\n /** The chosen link's `href`. */\n href: string;\n};\n\n/** The id a link reports: its explicit `id`, else its `href`. */\nexport function linkId(link: LinkItem): string {\n return link.id ?? link.href;\n}\n\nlet uid = 0;\n/** Stable per-instance id prefix; SSR-safe (no Math.random / Date.now). */\nexport function nextLinkPickerId(): string {\n uid += 1;\n return `link-picker-${uid}`;\n}\n\n/**\n * Optional marker for the projected icon template. Gives consumers typed `let-` variables:\n *\n * ```html\n * <lily-link-picker label=\"Pages\" [links]=\"links\">\n * <ng-template lilyLinkPickerIcon let-args>{{ args.open ? \"×\" : \"☰\" }}</ng-template>\n * </lily-link-picker>\n * ```\n */\n@Directive({\n selector: \"ng-template[lilyLinkPickerIcon]\",\n standalone: true,\n})\nexport class LinkPickerIcon {\n static ngTemplateContextGuard(\n _dir: LinkPickerIcon,\n _ctx: unknown,\n ): _ctx is ChildArgs & { $implicit: ChildArgs } {\n return true;\n }\n}\n\n/**\n * LinkPicker — a headless page-links control.\n *\n * A single-icon button (a bundled home SVG) that opens a disclosure list of page links the app\n * defines. It applies nothing to the document and persists nothing. See `spec/index.md`.\n */\n@Component({\n selector: \"lily-link-picker\",\n standalone: true,\n imports: [NgTemplateOutlet, IconButton],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n \"(document:click)\": \"onDocumentClick($event)\",\n },\n template: `\n <div\n #rootEl\n class=\"link-picker {{ className() }}\"\n (focusout)=\"onRootFocusOut($event)\"\n >\n <lily-icon-button\n [disabled]=\"disabled()\"\n #buttonEl\n [label]=\"label()\"\n baseClass=\"link-picker-button\"\n [ariaExpanded]=\"open()\"\n [ariaControls]=\"listId\"\n (click)=\"onButtonClick(); hoverButton.set(false)\"\n (mouseenter)=\"onTooltipButtonEnter()\"\n (mouseleave)=\"hoverButton.set(false)\"\n (focusin)=\"onTooltipButtonFocusIn()\"\n (focusout)=\"onTooltipButtonFocusOut()\"\n (keydown)=\"onButtonKeydown($event); onTooltipKeydown($event)\"\n >\n @if (iconTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"childContext()\"\n />\n } @else {\n <svg\n class=\"link-picker-icon\"\n viewBox=\"0 0 16 16\"\n width=\"1.05rem\"\n height=\"1.05rem\"\n aria-hidden=\"true\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.6\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <path d=\"M1 8 8 1.5l7 6.5\" />\n <path d=\"M2.5 7v7.5h11V7\" />\n <path d=\"M6.5 14.5v-4h3v4\" />\n </svg>\n }\n </lily-icon-button>\n\n <!-- Purely visual: the same text is already the button's aria-label, so it is not wired\n with aria-describedby (that would announce the name twice). -->\n <div\n class=\"link-picker-tooltip\"\n role=\"tooltip\"\n [id]=\"tooltipId\"\n [attr.hidden]=\"tooltipVisible() ? null : ''\"\n (mouseenter)=\"hoverTooltip.set(true)\"\n (mouseleave)=\"hoverTooltip.set(false)\"\n >{{ label() }}</div>\n\n <!-- Named like the sibling pickers' popups: a screen reader entering the list hears what\n it is for. -->\n <ul\n #listEl\n class=\"link-picker-list\"\n [id]=\"listId\"\n [attr.aria-label]=\"label() || null\"\n [attr.hidden]=\"open() ? null : ''\"\n (keydown)=\"onListKeydown($event)\"\n >\n @for (link of links(); track idOf(link)) {\n <li class=\"link-picker-list-item\">\n <!-- A real link, not role=\"menuitem\": these ARE navigation. -->\n <a\n class=\"link-picker-link\"\n [attr.data-link-id]=\"idOf(link)\"\n [attr.href]=\"link.href\"\n [attr.aria-current]=\"link.current ? 'page' : null\"\n [attr.target]=\"link.newTab ? '_blank' : null\"\n [attr.rel]=\"link.newTab ? 'noopener noreferrer' : null\"\n (click)=\"onLinkClick($event, link)\"\n >{{ link.label }}</a\n >\n </li>\n }\n </ul>\n </div>\n `,\n})\nexport class LinkPicker {\n /** Accessible name for the button and the list. */\n readonly label = input.required<string>();\n /** The page links to offer. Defined by the app. */\n readonly links = input.required<LinkItem[]>();\n /**\n * Client-side navigation hook, e.g. a router's `navigateByUrl`. When given, a plain left click\n * on a link calls `navigate(href)` instead of letting the browser load the page; modified\n * clicks (Ctrl/Cmd/Shift/Alt, middle button) and `newTab` links stay native.\n */\n readonly navigate = input<((href: string) => void) | undefined>(undefined);\n /** Extra CSS class on the root div. */\n readonly className = input<string>(\"\");\n\n /** Fires after a link is chosen. */\n readonly navigated = output<LinkNavigatedEvent>();\n\n /** Projected icon template; replaces the default icon when supplied. */\n protected readonly iconTemplate = contentChild(TemplateRef);\n\n private readonly rootRef = viewChild.required<ElementRef<HTMLDivElement>>(\"rootEl\");\n // A template-ref-variable on a component tag resolves to the component INSTANCE, which is what\n // is needed to call the headless component's own public `focus()` method.\n private readonly buttonRef = viewChild.required<IconButton>(\"buttonEl\");\n private readonly listRef = viewChild.required<ElementRef<HTMLUListElement>>(\"listEl\");\n\n private readonly baseId = nextLinkPickerId();\n protected readonly listId = `${this.baseId}-list`;\n\n /** Is the popup open? Two-way bindable: `[(open)]`; `openChange` fires for each change. */\n readonly open = model<boolean>(false);\n /** Disables the button; an open popup closes. */\n readonly disabled = input<boolean>(false);\n private readonly closeWhenDisabled = effect(() => {\n if (this.disabled() && this.open()) this.open.set(false);\n });\n private readonly injector = inject(Injector);\n\n // Tooltip: shown while the pointer is over the button or the tooltip itself (hoverable, WCAG\n // 1.4.13) or while the button has keyboard focus; Escape dismisses it without moving focus;\n // never shown while the popup is open, since the popup then explains the control.\n protected readonly tooltipId = `${this.baseId}-tooltip`;\n protected readonly hoverButton = signal(false);\n protected readonly hoverTooltip = signal(false);\n protected readonly focusButton = signal(false);\n protected readonly dismissed = signal(false);\n protected readonly tooltipVisible = computed(\n () =>\n !this.open() &&\n !this.dismissed() &&\n (this.hoverButton() || this.hoverTooltip() || this.focusButton()),\n );\n\n protected onTooltipButtonEnter(): void {\n this.hoverButton.set(true);\n this.dismissed.set(false);\n }\n\n protected onTooltipButtonFocusIn(): void {\n // Keyboard focus only: a mouse click also focuses the button in Chromium, and the tooltip\n // should not stick after a click.\n try {\n this.focusButton.set(this.buttonRef().element?.matches(\":focus-visible\") ?? false);\n } catch {\n this.focusButton.set(true); // engine without :focus-visible — err towards showing\n }\n }\n\n protected onTooltipButtonFocusOut(): void {\n this.focusButton.set(false);\n this.dismissed.set(false);\n }\n\n protected onTooltipKeydown(event: KeyboardEvent): void {\n if (event.key === \"Escape\" && this.tooltipVisible()) this.dismissed.set(true);\n }\n\n // WCAG 1.4.13 \"dismissable\": while the tooltip is visible, Escape works wherever focus is. The\n // listener exists only while visible; the effect cleanup removes it on hide and on destroy.\n private readonly tooltipEscapeListener = effect((onCleanup) => {\n if (!this.tooltipVisible() || typeof document === \"undefined\") return;\n const onKey = (event: KeyboardEvent): void => {\n if (event.key === \"Escape\") this.dismissed.set(true);\n };\n document.addEventListener(\"keydown\", onKey);\n onCleanup(() => document.removeEventListener(\"keydown\", onKey));\n });\n\n protected readonly childContext = computed(() => {\n const args: ChildArgs = { open: this.open() };\n return { $implicit: args, ...args };\n });\n\n protected idOf(link: LinkItem): string {\n return linkId(link);\n }\n\n /** Every focusable link in the list, in DOM order. */\n private items(): HTMLElement[] {\n return Array.from(\n this.listRef().nativeElement.querySelectorAll<HTMLElement>(\".link-picker-link\"),\n );\n }\n\n // ---------------------------------------------------------------\n // Open / close\n // ---------------------------------------------------------------\n\n /** Open the list, focusing the first link (or the last, if `focusLast`). */\n openList(focusLast = false): void {\n this.open.set(true);\n // After the next render, so the list's `hidden` attribute is gone: a hidden link cannot take\n // focus (a microtask ran before Angular rendered, and the focus silently went nowhere).\n afterNextRender(\n () => {\n const all = this.items();\n (focusLast ? all[all.length - 1] : all[0])?.focus({ preventScroll: true });\n },\n { injector: this.injector },\n );\n }\n\n /** Close the list; `refocus` returns focus to the trigger. */\n closeList(refocus = true): void {\n if (!this.open()) return;\n this.open.set(false);\n if (refocus) queueMicrotask(() => this.buttonRef().focus({ preventScroll: true }));\n }\n\n protected onButtonClick(): void {\n if (this.open()) this.closeList();\n else this.openList();\n }\n\n protected onLinkClick(event: MouseEvent, link: LinkItem): void {\n this.navigated.emit({ id: linkId(link), href: link.href });\n const go = this.navigate();\n const modified =\n event.ctrlKey || event.metaKey || event.shiftKey || event.altKey || event.button !== 0;\n if (go && !link.newTab && !modified && !event.defaultPrevented) {\n event.preventDefault();\n go(link.href);\n }\n this.closeList();\n }\n\n // ---------------------------------------------------------------\n // Keyboard\n // ---------------------------------------------------------------\n\n protected onButtonKeydown(event: KeyboardEvent): void {\n // Enter and Space already produce a click; only the arrows need handling here.\n if (event.key === \"ArrowDown\") {\n event.preventDefault();\n if (!this.open()) this.openList();\n else this.items()[0]?.focus({ preventScroll: true });\n } else if (event.key === \"ArrowUp\") {\n event.preventDefault();\n if (!this.open()) this.openList(true);\n else {\n const all = this.items();\n all[all.length - 1]?.focus({ preventScroll: true });\n }\n }\n }\n\n private moveFocus(delta: number): void {\n const all = this.items();\n if (all.length === 0) return;\n const i = all.indexOf(document.activeElement as HTMLElement);\n // Clamp rather than wrap.\n const next = Math.min(Math.max((i < 0 ? 0 : i) + delta, 0), all.length - 1);\n all[next]?.focus({ preventScroll: true });\n }\n\n protected onListKeydown(event: KeyboardEvent): void {\n switch (event.key) {\n case \"ArrowDown\":\n event.preventDefault();\n this.moveFocus(1);\n break;\n case \"ArrowUp\":\n event.preventDefault();\n this.moveFocus(-1);\n break;\n case \"Home\":\n event.preventDefault();\n this.items()[0]?.focus({ preventScroll: true });\n break;\n case \"End\": {\n event.preventDefault();\n const all = this.items();\n all[all.length - 1]?.focus({ preventScroll: true });\n break;\n }\n case \"Escape\":\n event.preventDefault();\n this.closeList();\n break;\n case \"Tab\":\n // Focus goes to the button FIRST, without cancelling the key: hiding the list while a\n // link has focus drops focus to <body>, and the default Tab would restart from the top.\n this.buttonRef().focus?.({ preventScroll: true });\n this.closeList(false);\n break;\n default:\n break;\n }\n }\n\n protected onRootFocusOut(event: FocusEvent): void {\n const next = event.relatedTarget as Node | null;\n if (next && this.rootRef().nativeElement.contains(next)) return;\n this.closeList(false);\n }\n\n protected onDocumentClick(event: Event): void {\n if (!this.open()) return;\n const t = event.target as Node | null;\n if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MAAA,GAAA;GAAA,MAAA,CAAA,WAAA;EAAA,CAAA;EAAA,cAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAAA,WAAW,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAEgB,UAAQ,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAGtB,YAAU,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CACM,UAAQ,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,GAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,YAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@lilydesignsystem/angular-link-picker",
3
- "version": "0.1.2",
3
+ "version": "0.2.1",
4
4
  "engines": {
5
- "node": "=26"
5
+ "node": ">=26"
6
6
  },
7
7
  "description": "Lily Design System Angular link picker: an icon button (a home icon) opening a disclosure of app-defined page links. Headless, SSR-safe, no CSS.",
8
8
  "dependencies": {
9
- "@lilydesignsystem/angular-headless": "^0.2.0",
9
+ "@lilydesignsystem/angular-headless": "^0.8.0",
10
10
  "tslib": "^2.3.0"
11
11
  },
12
12
  "peerDependencies": {
13
- "@angular/core": ">=20.0.0 <23.0.0",
14
- "@angular/common": ">=20.0.0 <23.0.0"
13
+ "@angular/common": ">=20.0.0 <23.0.0",
14
+ "@angular/core": ">=20.0.0 <23.0.0"
15
15
  },
16
16
  "sideEffects": false,
17
17
  "keywords": [
@@ -28,7 +28,7 @@
28
28
  "license": "MIT OR Apache-2.0 OR GPL-2.0-only OR GPL-3.0-only OR BSD-3-Clause",
29
29
  "repository": {
30
30
  "type": "git",
31
- "url": "git+https://github.com/LilyDesignSystem/lily-design-system-angular-helpers.git",
31
+ "url": "git+https://github.com/LilyDesignSystem/lily-design-system.git",
32
32
  "directory": "lily-design-system-angular-link-picker"
33
33
  },
34
34
  "homepage": "https://lilydesignsystem.com/",
@@ -56,39 +56,44 @@ export declare class LinkPickerIcon {
56
56
  */
57
57
  export declare class LinkPicker {
58
58
  /** Accessible name for the button and the list. */
59
- readonly label: import("@angular/core").InputSignal<string>;
59
+ readonly label: import("@angular/core/types/core").InputSignal<string>;
60
60
  /** The page links to offer. Defined by the app. */
61
- readonly links: import("@angular/core").InputSignal<LinkItem[]>;
61
+ readonly links: import("@angular/core/types/core").InputSignal<LinkItem[]>;
62
62
  /**
63
63
  * Client-side navigation hook, e.g. a router's `navigateByUrl`. When given, a plain left click
64
64
  * on a link calls `navigate(href)` instead of letting the browser load the page; modified
65
65
  * clicks (Ctrl/Cmd/Shift/Alt, middle button) and `newTab` links stay native.
66
66
  */
67
- readonly navigate: import("@angular/core").InputSignal<((href: string) => void) | undefined>;
67
+ readonly navigate: import("@angular/core/types/core").InputSignal<((href: string) => void) | undefined>;
68
68
  /** Extra CSS class on the root div. */
69
- readonly className: import("@angular/core").InputSignal<string>;
69
+ readonly className: import("@angular/core/types/core").InputSignal<string>;
70
70
  /** Fires after a link is chosen. */
71
- readonly navigated: import("@angular/core").OutputEmitterRef<LinkNavigatedEvent>;
71
+ readonly navigated: import("@angular/core/types/_api-chunk").OutputEmitterRef<LinkNavigatedEvent>;
72
72
  /** Projected icon template; replaces the default icon when supplied. */
73
- protected readonly iconTemplate: import("@angular/core").Signal<TemplateRef<any> | undefined>;
73
+ protected readonly iconTemplate: import("@angular/core/types/_chrome_dev_tools_performance-chunk").Signal<TemplateRef<any> | undefined>;
74
74
  private readonly rootRef;
75
75
  private readonly buttonRef;
76
76
  private readonly listRef;
77
77
  private readonly baseId;
78
78
  protected readonly listId: string;
79
- protected readonly open: import("@angular/core").WritableSignal<boolean>;
79
+ /** Is the popup open? Two-way bindable: `[(open)]`; `openChange` fires for each change. */
80
+ readonly open: import("@angular/core/types/core").ModelSignal<boolean>;
81
+ /** Disables the button; an open popup closes. */
82
+ readonly disabled: import("@angular/core/types/core").InputSignal<boolean>;
83
+ private readonly closeWhenDisabled;
84
+ private readonly injector;
80
85
  protected readonly tooltipId: string;
81
- protected readonly hoverButton: import("@angular/core").WritableSignal<boolean>;
82
- protected readonly hoverTooltip: import("@angular/core").WritableSignal<boolean>;
83
- protected readonly focusButton: import("@angular/core").WritableSignal<boolean>;
84
- protected readonly dismissed: import("@angular/core").WritableSignal<boolean>;
85
- protected readonly tooltipVisible: import("@angular/core").Signal<boolean>;
86
+ protected readonly hoverButton: import("@angular/core/types/_chrome_dev_tools_performance-chunk").WritableSignal<boolean>;
87
+ protected readonly hoverTooltip: import("@angular/core/types/_chrome_dev_tools_performance-chunk").WritableSignal<boolean>;
88
+ protected readonly focusButton: import("@angular/core/types/_chrome_dev_tools_performance-chunk").WritableSignal<boolean>;
89
+ protected readonly dismissed: import("@angular/core/types/_chrome_dev_tools_performance-chunk").WritableSignal<boolean>;
90
+ protected readonly tooltipVisible: import("@angular/core/types/_chrome_dev_tools_performance-chunk").Signal<boolean>;
86
91
  protected onTooltipButtonEnter(): void;
87
92
  protected onTooltipButtonFocusIn(): void;
88
93
  protected onTooltipButtonFocusOut(): void;
89
94
  protected onTooltipKeydown(event: KeyboardEvent): void;
90
95
  private readonly tooltipEscapeListener;
91
- protected readonly childContext: import("@angular/core").Signal<{
96
+ protected readonly childContext: import("@angular/core/types/_chrome_dev_tools_performance-chunk").Signal<{
92
97
  /** Is the list open? */
93
98
  open: boolean;
94
99
  $implicit: ChildArgs;
@@ -129,8 +134,19 @@ export declare class LinkPicker {
129
134
  "required": false;
130
135
  "isSignal": true;
131
136
  };
137
+ "open": {
138
+ "alias": "open";
139
+ "required": false;
140
+ "isSignal": true;
141
+ };
142
+ "disabled": {
143
+ "alias": "disabled";
144
+ "required": false;
145
+ "isSignal": true;
146
+ };
132
147
  }, {
133
148
  "navigated": "navigated";
149
+ "open": "openChange";
134
150
  }, ["iconTemplate"], never, true, never>;
135
151
  }
136
152
  export type { ChildArgs, LinkItem, LinkNavigatedEvent };
@@ -1 +1 @@
1
- {"version":3,"file":"lilydesignsystem-angular-link-picker.d.ts","names":[],"sources":["../../link-picker.component.ts"],"mappings":";;;;;;KAwBY;;EAEV;;EAEA;;EAEA;;EAEA;;EAEA;;;KAIU;;EAEV;;;KAIU;;EAEV;;EAEA;;;wBAIc,OAAO,MAAM;;wBAMb;;;;;;;;;;qBAkBH;SACJ,uBACL,MAAM,gBACN,gBACC,QAAQ;IAAc,WAAW;;SAJzB,MAAA,GAAA,qBAAA;SAAA,MAAA,GAAA,uBAAA;;;;;;;;qBA2GA;;WAEF,+BAAK;;WAEL,+BAAK,YAAA;;;;;;WAML,kCAAQ,cAAA;;WAER,mCAAS;;WAGT,mCAAS,iBAAA;;qBAGC,sCAAY,OAAA;mBAEd;mBAIA;mBACA;mBAGA;qBACE;qBAEA,8BAAI;qBAKJ;qBACA,qCAAW;qBACX,sCAAY;qBACZ,qCAAW;qBACX,mCAAS;qBACT,wCAAc;YAOvB;YAKA;YAYA;YAKA,iBAAiB,OAAO;mBAMjB;qBASE,sCAAY;;IApOzB;;;YAyOI,KAAK,MAAM;;UAKb;;EAWR,SAAS;;EAUT,UAAU;YAMA;YAKA,YAAY,OAAO,YAAY,MAAM;YAgBrC,gBAAgB,OAAO;UAgBzB;YASE,cAAc,OAAO;YAmCrB,eAAe,OAAO;YAMtB,gBAAgB,OAAO;SAjNtB,MAAA,GAAA,qBAAA;SAAA,MAAA,GAAA,uBAAA;IAAU;MAAA;MAA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