@lilydesignsystem/angular-menu-picker 0.1.0 → 0.1.2

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/spec/index.md DELETED
@@ -1,124 +0,0 @@
1
- # MenuPicker (Angular) — spec
2
-
3
- **Package:** `@lilydesignsystem/angular-menu-picker` · **Canonical contract:** this file; the other seven catalogs port it.
4
- Topic summary: [spec/menu-picker](../../../spec/menu-picker/index.md).
5
-
6
- ## 1. Goal
7
-
8
- An icon button — a typical **hamburger** (three horizontal lines) — that opens a dropdown panel holding **whatever the app
9
- provides**: links, buttons, a search form, a small list of settings. It owns the whole interaction: open/close, focus,
10
- keyboard, tooltip. It owns no content and no words: the panel's content and every accessible name come from the consumer.
11
-
12
- ## 2. Non-goals
13
-
14
- - No default content, no English text, no routing, no data.
15
- - Not an ARIA menu: the panel is a named group of arbitrary content, so it has no `role="menu"` and no roving focus.
16
- - Not a site navigation bar (use `BreadcrumbNav`, `SectionNav`) and not a modal dialog (use `Dialog`).
17
- - No persistence.
18
-
19
- ## 3. Architectural decisions
20
-
21
- - **A disclosure of arbitrary content, not a menu.** `role="menu"` promises a roving-focus `menuitem` widget; arbitrary app
22
- content (links, inputs, headings) is not that, and the WAI-ARIA APG's disclosure pattern fits it exactly. The trigger carries
23
- `aria-expanded` and `aria-controls`; the panel is a `role="group"` named by `label`.
24
- - **Only the trigger composes headless** (`IconButton`); the panel is self-built, as in `link-picker` and `share-picker`.
25
- - **The app provides the panel's content** through `children` (a template, slot, `ChildContent`, children …). It receives
26
- `{ open, close }` so its own controls can close the panel.
27
- - **Closes on select by default.** Activating a link, a button or a `[role="menuitem"]` inside the panel closes it and returns
28
- focus to the button. `closeOnSelect={false}` turns that off for the whole panel; an ancestor with
29
- `data-menu-picker-keep-open` opts one element (or a region, e.g. a form) out.
30
- - **Focus is not moved on a click.** A disclosure must not steal focus on open; `ArrowDown`/`ArrowUp` on the button move into
31
- the panel's first/last focusable element for keyboard users.
32
-
33
- ## 4. Public API
34
-
35
- ### 4.1 Props
36
-
37
- | Prop | Type | Required | Notes |
38
- | --- | --- | --- | --- |
39
- | `label` | `string` | yes | Accessible name of the button **and** the panel; also the tooltip text. |
40
- | `[(open)]` | `boolean` (model) | no | Is the panel open? Default `false`. |
41
- | `closeOnSelect` | `boolean` | no | Close when a link/button/menuitem inside is activated. Default `true`. |
42
- | `(openChange)` | output `boolean` | no | Emitted whenever the open state changes (the `[(open)]` update). |
43
- | projected content | `<ng-content>` | no | The panel's content. Call `menu.close()` on a `#menu="lilyMenuPicker"` reference to close it. |
44
- | `<ng-template lilyMenuPickerIcon>` | context `{ open }` | no | Replaces the hamburger **icon** inside the button. |
45
- | `className` | `string` | no | Appended to the root class. |
46
- | `...rest` | | | Spread on the root. |
47
-
48
- ### 4.2 DOM contract
49
-
50
- ```html
51
- <div class="menu-picker {class}">
52
- <button class="menu-picker-button" type="button" aria-label="{label}" aria-expanded="false" aria-controls="{id}-panel">
53
- <svg class="menu-picker-icon" aria-hidden="true" viewBox="0 0 16 16" …three lines…/>
54
- </button>
55
- <div class="menu-picker-tooltip" role="tooltip" id="{id}-tooltip" hidden>{label}</div>
56
- <div class="menu-picker-panel" id="{id}-panel" role="group" aria-label="{label}" hidden>
57
- …whatever the app provides…
58
- </div>
59
- </div>
60
- ```
61
-
62
- ### 4.3 Re-exports
63
-
64
- `MenuPicker`, `MenuPickerIcon`, `nextMenuPickerId`, `FOCUSABLE`, type `ChildArgs`.
65
-
66
- **Differences from the Svelte contract (idiom, not behaviour).** Angular renders the same DOM in a `<lily-menu-picker>` element; the bindable `open` is a `model()` (`[(open)]`), the content is projected, the icon override is a projected `<ng-template lilyMenuPickerIcon>`, `class` is the `className` input, `close()` is a public method reachable through `exportAs: "lilyMenuPicker"`, and ids come from a module counter.
67
-
68
- ## 5. Behaviour
69
-
70
- ### 5.1 Activation
71
-
72
- Click toggles the panel; focus stays on the button. Activating a link, button or menuitem inside the panel closes it (see
73
- §3) and returns focus to the button.
74
-
75
- ### 5.2 Keyboard
76
-
77
- - Button: `Enter`/`Space` toggle; `ArrowDown` opens and focuses the panel's first focusable element (or moves into an open
78
- panel); `ArrowUp` focuses the last; `Escape` closes an open panel.
79
- - Panel: `Escape` closes and returns focus to the button; `Tab` closes and moves on (focus goes to the button first so the
80
- browser continues from the picker's position). Everything else is the app's content's own behaviour.
81
- - Clicking outside, or focus leaving the picker, closes the panel.
82
-
83
- ### 5.3 Tooltip
84
-
85
- `<div class="menu-picker-tooltip" role="tooltip" hidden>` holds the button's `label`. Visible while the pointer is over the
86
- button or the tooltip (hoverable) or while the button has keyboard focus (`:focus-visible`); `Escape` dismisses it wherever
87
- focus is; never shown while the panel is open. Not linked with `aria-describedby` (it duplicates the name).
88
-
89
- ## 6. Accessibility
90
-
91
- WCAG 2.2 AAA target. The button has an accessible name and `aria-expanded`/`aria-controls`; the icon is `aria-hidden`; the
92
- panel is a named group; focus stays visible; no motion. The content's own accessibility is the app's.
93
-
94
- ## 7. Testing acceptance criteria
95
-
96
- 1. Renders `div.menu-picker` containing `button.menu-picker-button`, a tooltip and a hidden `div.menu-picker-panel`.
97
- 2. The button's accessible name is `label`; it has `aria-expanded="false"` and `aria-controls` pointing at the panel.
98
- 3. The default icon is an `aria-hidden` SVG with class `menu-picker-icon`; `icon` replaces it.
99
- 4. The panel is a `role="group"` named with `label`.
100
- 5. The app's content renders inside the panel; with no content the panel is empty (nothing is invented).
101
- 6. Click opens: panel visible, `aria-expanded="true"`, focus stays on the button.
102
- 7. Click again closes.
103
- 8. `ArrowDown` on the button opens and focuses the first focusable element in the panel; `ArrowUp` focuses the last.
104
- 9. `Escape` closes and returns focus to the button.
105
- 10. `Tab` closes without teleporting focus.
106
- 11. Clicking outside closes.
107
- 12. Focus moving out of the picker closes.
108
- 13. Activating a link or button inside closes the panel and focuses the button; an element inside
109
- `data-menu-picker-keep-open` does not close it; `closeOnSelect=false` never closes on select.
110
- 14. The content receives `close()`, which closes the panel.
111
- 15. `open` is bindable and `onOpenChange` fires once per actual change.
112
- 16. The tooltip exists with `role="tooltip"`, holds `label`, and is hidden at rest.
113
- 17. The tooltip shows on hover, hides on `Escape`, and never shows while the panel is open.
114
- 18. The tooltip is not referenced by `aria-describedby`.
115
- 19. `class` is appended to the root; rest props are spread on the root.
116
- 20. Two instances get distinct ids.
117
- 21. The package source contains no stylesheet, no inline `style` and no English default text.
118
-
119
- ## 8. Tracking
120
-
121
- - Package: `@lilydesignsystem/angular-menu-picker`
122
- - Version: 0.1.0 (new, 2026-10-08)
123
- - Framework: Angular `>=20 <23` (signals, standalone, OnPush)
124
- - Test runner: vitest + TestBed
package/tsconfig.lib.json DELETED
@@ -1,13 +0,0 @@
1
- {
2
- "extends": "../tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "./out-tsc/lib",
5
- "declaration": true,
6
- "declarationMap": true,
7
- "types": []
8
- },
9
- "angularCompilerOptions": {
10
- "compilationMode": "partial"
11
- },
12
- "exclude": ["**/*.spec.ts", "node_modules", "dist"]
13
- }