@rcarls/rc-menubar 0.0.0-next-20260921045401
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/CHANGELOG.md +107 -0
- package/README.md +172 -0
- package/dist/custom-elements.json +512 -0
- package/dist/rc-menubar-DCZFgZvn.js +284 -0
- package/dist/rc-menubar-DCZFgZvn.js.map +1 -0
- package/dist/rc-menubar-define.js +7 -0
- package/dist/rc-menubar-define.js.map +1 -0
- package/dist/rc-menubar.js +5 -0
- package/dist/rc-menubar.js.map +1 -0
- package/dist/types/packages/rc-menubar/src/define.d.ts +1 -0
- package/dist/types/packages/rc-menubar/src/index.d.ts +1 -0
- package/dist/types/packages/rc-menubar/src/rc-menubar.d.ts +124 -0
- package/dist/types/packages/rc-menubar/src/rc-menubar.styles.d.ts +2 -0
- package/package.json +68 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# @rcarls/rc-menubar
|
|
2
|
+
|
|
3
|
+
## 0.0.0-next-20260921045401
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [50d5610]
|
|
8
|
+
- Updated dependencies [4341311]
|
|
9
|
+
- Updated dependencies [94dc987]
|
|
10
|
+
- @rcarls/rc-common@0.0.0-next-20260921045401
|
|
11
|
+
- @rcarls/rc-menu-button@0.0.0-next-20260921045401
|
|
12
|
+
- @rcarls/rc-menu@0.0.0-next-20260921045401
|
|
13
|
+
|
|
14
|
+
## 0.6.0
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [7382c71]
|
|
19
|
+
- Updated dependencies [6683eb9]
|
|
20
|
+
- Updated dependencies [ee7ba6c]
|
|
21
|
+
- Updated dependencies [30eb232]
|
|
22
|
+
- Updated dependencies [30eb232]
|
|
23
|
+
- Updated dependencies [57370e4]
|
|
24
|
+
- @rcarls/rc-menu@0.6.0
|
|
25
|
+
- @rcarls/rc-menu-button@0.6.0
|
|
26
|
+
- @rcarls/rc-common@0.6.0
|
|
27
|
+
|
|
28
|
+
## 0.5.0
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Updated dependencies [4ae2ef0]
|
|
33
|
+
- Updated dependencies [d33b92f]
|
|
34
|
+
- Updated dependencies [689340c]
|
|
35
|
+
- @rcarls/rc-common@0.5.0
|
|
36
|
+
- @rcarls/rc-menu-button@0.5.0
|
|
37
|
+
- @rcarls/rc-menu@0.5.0
|
|
38
|
+
|
|
39
|
+
## 0.4.2
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- @rcarls/rc-common@0.4.2
|
|
44
|
+
- @rcarls/rc-menu@0.4.2
|
|
45
|
+
- @rcarls/rc-menu-button@0.4.2
|
|
46
|
+
|
|
47
|
+
## 0.4.1
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- @rcarls/rc-common@0.4.1
|
|
52
|
+
- @rcarls/rc-menu@0.4.1
|
|
53
|
+
- @rcarls/rc-menu-button@0.4.1
|
|
54
|
+
|
|
55
|
+
## 0.4.0
|
|
56
|
+
|
|
57
|
+
### Patch Changes
|
|
58
|
+
|
|
59
|
+
- 1ba0be2: Document the `label` and `orientation` attributes in the class JSDoc, and fix
|
|
60
|
+
the package README's read-only getters and `focusItem()` signature to use the
|
|
61
|
+
`$`-prefixed names the component has shipped for some time (`$items`,
|
|
62
|
+
`$menuButtons`, `$firstItem`, `$lastItem`, `$nextItem`, `$previousItem`).
|
|
63
|
+
- Updated dependencies [e57277f]
|
|
64
|
+
- Updated dependencies [69e31c1]
|
|
65
|
+
- Updated dependencies [4cb5551]
|
|
66
|
+
- Updated dependencies [ccca8e2]
|
|
67
|
+
- Updated dependencies [037b1b3]
|
|
68
|
+
- Updated dependencies [3e89095]
|
|
69
|
+
- @rcarls/rc-common@0.4.0
|
|
70
|
+
- @rcarls/rc-menu-button@0.4.0
|
|
71
|
+
- @rcarls/rc-menu@0.4.0
|
|
72
|
+
|
|
73
|
+
## 0.3.2
|
|
74
|
+
|
|
75
|
+
### Patch Changes
|
|
76
|
+
|
|
77
|
+
- Updated dependencies [88b4086]
|
|
78
|
+
- @rcarls/rc-common@0.3.2
|
|
79
|
+
- @rcarls/rc-menu@0.3.2
|
|
80
|
+
- @rcarls/rc-menu-button@0.3.2
|
|
81
|
+
|
|
82
|
+
## 0.3.1
|
|
83
|
+
|
|
84
|
+
### Patch Changes
|
|
85
|
+
|
|
86
|
+
- @rcarls/rc-common@0.3.1
|
|
87
|
+
- @rcarls/rc-menu@0.3.1
|
|
88
|
+
- @rcarls/rc-menu-button@0.3.1
|
|
89
|
+
|
|
90
|
+
## 0.3.0
|
|
91
|
+
|
|
92
|
+
### Changed
|
|
93
|
+
|
|
94
|
+
- Configure child menu-button triggers through a flat inherited token contract.
|
|
95
|
+
- Update package metadata, README intro, and docs links.
|
|
96
|
+
|
|
97
|
+
### Dependencies
|
|
98
|
+
|
|
99
|
+
- Sync internal dependencies to 0.3.0.
|
|
100
|
+
|
|
101
|
+
## 0.2.0
|
|
102
|
+
|
|
103
|
+
### Patch Changes
|
|
104
|
+
|
|
105
|
+
- @rcarls/rc-common@0.2.0
|
|
106
|
+
- @rcarls/rc-menu@0.2.0
|
|
107
|
+
- @rcarls/rc-menu-button@0.2.0
|
package/README.md
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# `@rcarls/rc-menubar`
|
|
2
|
+
|
|
3
|
+
Menubar coordinator for `rc-menu-button` children with roving tabindex and submenu handoff, following the [WAI-ARIA Menubar pattern](https://www.w3.org/WAI/ARIA/apg/patterns/menubar/).
|
|
4
|
+
|
|
5
|
+
Docs: [https://richardcarls.github.io/rc-webcomponents/components/rc-menubar](https://richardcarls.github.io/rc-webcomponents/components/rc-menubar).
|
|
6
|
+
|
|
7
|
+
Manages roving tabindex across `rc-menu-button` triggers and cascades menu open/close as the user navigates. Built with [Lit 3](https://lit.dev).
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @rcarls/rc-menubar
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Import
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
import '@rcarls/rc-menubar/define'; // side-effect: registers <rc-menubar>
|
|
21
|
+
import { RCMenubar } from '@rcarls/rc-menubar'; // named class export
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`rc-menubar` depends on `rc-menu-button` and `rc-menu`. Ensure all three are installed.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Basic usage
|
|
29
|
+
|
|
30
|
+
Place `rc-menu-button` elements as direct children. The menubar manages focus and opens the appropriate menu as the user navigates.
|
|
31
|
+
|
|
32
|
+
```html
|
|
33
|
+
<rc-menubar label="Application menu">
|
|
34
|
+
<rc-menu-button>
|
|
35
|
+
<button slot="trigger">File</button>
|
|
36
|
+
<rc-menu label="File">
|
|
37
|
+
<button>New</button>
|
|
38
|
+
<button>Open…</button>
|
|
39
|
+
<button>Save</button>
|
|
40
|
+
</rc-menu>
|
|
41
|
+
</rc-menu-button>
|
|
42
|
+
|
|
43
|
+
<rc-menu-button>
|
|
44
|
+
<button slot="trigger">Edit</button>
|
|
45
|
+
<rc-menu label="Edit">
|
|
46
|
+
<button>Undo</button>
|
|
47
|
+
<button>Redo</button>
|
|
48
|
+
<button>Cut</button>
|
|
49
|
+
<button>Copy</button>
|
|
50
|
+
<button>Paste</button>
|
|
51
|
+
</rc-menu>
|
|
52
|
+
</rc-menu-button>
|
|
53
|
+
|
|
54
|
+
<rc-menu-button>
|
|
55
|
+
<button slot="trigger">View</button>
|
|
56
|
+
<rc-menu label="View">
|
|
57
|
+
<button>Zoom In</button>
|
|
58
|
+
<button>Zoom Out</button>
|
|
59
|
+
</rc-menu>
|
|
60
|
+
</rc-menu-button>
|
|
61
|
+
</rc-menubar>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## API
|
|
67
|
+
|
|
68
|
+
### Properties / attributes
|
|
69
|
+
|
|
70
|
+
| Property | Attribute | Type | Default | Description |
|
|
71
|
+
| ------------- | ------------- | ---------------------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
72
|
+
| `label` | `label` | `string` | `'Menu'` | `aria-label` for the menubar. Required — no visible label is rendered by the component. |
|
|
73
|
+
| `orientation` | `orientation` | `'horizontal' \| 'vertical'` | `'horizontal'` | Layout direction and keyboard navigation axis. Propagated to child `rc-menu-button` elements for arrow-key open direction. |
|
|
74
|
+
|
|
75
|
+
### CSS custom properties
|
|
76
|
+
|
|
77
|
+
| Property | Default | Description |
|
|
78
|
+
| -------------------------------------- | ------------------------------------------------ | ------------------------------------------------- |
|
|
79
|
+
| `--rc-menubar-gap` | `var(--rc-control-gap)` | Gap between menu buttons |
|
|
80
|
+
| `--rc-menubar-padding-inline` | `var(--rc-control-padding-inline)` | Inline padding on the menubar container |
|
|
81
|
+
| `--rc-menubar-padding-block` | `var(--rc-control-padding-block)` | Block padding on the menubar container |
|
|
82
|
+
| `--rc-menubar-border` | `var(--rc-border)` | Menubar container border |
|
|
83
|
+
| `--rc-menubar-radius` | `var(--rc-control-radius)` | Menubar container border radius |
|
|
84
|
+
| `--rc-menubar-background` | `Canvas` | Menubar container background |
|
|
85
|
+
| `--rc-menubar-color` | `CanvasText` | Menubar container text color |
|
|
86
|
+
| `--rc-menubar-item-block-size` | `2.25em` | Minimum block size for child menu-button triggers |
|
|
87
|
+
| `--rc-menubar-item-padding-block` | `0.25em` | Child trigger block-axis padding |
|
|
88
|
+
| `--rc-menubar-item-padding-inline` | `0.75em` | Child trigger inline-axis padding |
|
|
89
|
+
| `--rc-menubar-item-gap` | `var(--rc-item-gap)` | Gap between flex children inside child triggers |
|
|
90
|
+
| `--rc-menubar-item-border` | `1px solid transparent` | Child trigger border |
|
|
91
|
+
| `--rc-menubar-item-radius` | `var(--rc-control-radius)` | Child trigger border radius |
|
|
92
|
+
| `--rc-menubar-item-background` | `transparent` | Child trigger background |
|
|
93
|
+
| `--rc-menubar-item-color` | `inherit` | Child trigger text color |
|
|
94
|
+
| `--rc-menubar-item-transition` | — | Child trigger state transition |
|
|
95
|
+
| `--rc-menubar-item-hover-background` | `color-mix(in srgb, Highlight 8%, transparent)` | Child trigger hover background |
|
|
96
|
+
| `--rc-menubar-item-hover-color` | `inherit` | Child trigger hover text color |
|
|
97
|
+
| `--rc-menubar-item-hover-border-color` | `transparent` | Child trigger hover border color |
|
|
98
|
+
| `--rc-menubar-item-open-background` | `color-mix(in srgb, Highlight 12%, transparent)` | Child trigger background while its menu is open |
|
|
99
|
+
| `--rc-menubar-item-open-color` | `inherit` | Child trigger text color while its menu is open |
|
|
100
|
+
| `--rc-menubar-item-open-border-color` | `transparent` | Child trigger border color while its menu is open |
|
|
101
|
+
|
|
102
|
+
### CSS parts
|
|
103
|
+
|
|
104
|
+
| Part | Element | Description |
|
|
105
|
+
| ------ | ----------- | ---------------------------- |
|
|
106
|
+
| `root` | Inner `div` | The visual menubar container |
|
|
107
|
+
|
|
108
|
+
### Slots
|
|
109
|
+
|
|
110
|
+
| Slot | Description |
|
|
111
|
+
| ----------- | ------------------------------------------------------------------------------------------------------- |
|
|
112
|
+
| _(default)_ | `rc-menu-button` elements. Non-menu-button elements are rendered but excluded from keyboard navigation. |
|
|
113
|
+
|
|
114
|
+
### Events
|
|
115
|
+
|
|
116
|
+
`rc-menubar` dispatches no events of its own. Listen for `rc-menu-button-toggle` and `rc-menu-activate` bubbling up from child components.
|
|
117
|
+
|
|
118
|
+
### Public methods
|
|
119
|
+
|
|
120
|
+
```ts
|
|
121
|
+
focusItem($item?: HTMLElement | null): void
|
|
122
|
+
// Focus a specific trigger element.
|
|
123
|
+
|
|
124
|
+
closeActiveMenu(): void
|
|
125
|
+
// Close the currently open menu without returning focus to the trigger.
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Read-only getters
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
$items: HTMLElement[] // All trigger elements across all child rc-menu-buttons
|
|
132
|
+
$menuButtons: RCMenuButton[] // All child rc-menu-button elements
|
|
133
|
+
$firstItem: HTMLElement | undefined
|
|
134
|
+
$lastItem: HTMLElement | undefined
|
|
135
|
+
$nextItem: HTMLElement | undefined // Relative to last-focused trigger
|
|
136
|
+
$previousItem: HTMLElement | undefined
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Keyboard behaviour
|
|
142
|
+
|
|
143
|
+
Horizontal orientation (default):
|
|
144
|
+
|
|
145
|
+
| Key | Action |
|
|
146
|
+
| ------------ | ------------------------------------------------------------------------------------ |
|
|
147
|
+
| `ArrowRight` | Focus next trigger (wraps); if a menu is open, closes current and opens next |
|
|
148
|
+
| `ArrowLeft` | Focus previous trigger (wraps); if a menu is open, closes current and opens previous |
|
|
149
|
+
| `Home` | Focus first trigger |
|
|
150
|
+
| `End` | Focus last trigger |
|
|
151
|
+
| `Escape` | Close the active menu; focus remains on trigger |
|
|
152
|
+
| `Tab` | Leaves the menubar (standard tab order) |
|
|
153
|
+
|
|
154
|
+
For vertical orientation, `ArrowDown`/`ArrowUp` replace `ArrowRight`/`ArrowLeft`. The `rc-menu-button` children automatically inherit the menubar's orientation to determine their own open-axis arrow keys.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## ARIA
|
|
159
|
+
|
|
160
|
+
| Attribute | Where | Value |
|
|
161
|
+
| ------------------ | ------------------ | ------------------------------------------------ |
|
|
162
|
+
| `role="menubar"` | Host element | — |
|
|
163
|
+
| `aria-orientation` | Host element | `"horizontal"` or `"vertical"` |
|
|
164
|
+
| `aria-label` | Host element | Value of `label` property |
|
|
165
|
+
| `tabindex="0"` | Active trigger | One trigger tabbable at a time (roving tabindex) |
|
|
166
|
+
| `tabindex="-1"` | All other triggers | Removed from tab order |
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Browser support
|
|
171
|
+
|
|
172
|
+
All modern browsers. Requires Web Components support (Chrome 67+, Firefox 63+, Safari 12.1+).
|