@reliability-design/web 1.0.3 → 1.0.6
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/dist/components/rel-accordion/README.md +132 -0
- package/dist/components/rel-accordion/rel-accordion.ts +43 -16
- package/dist/components/rel-alert/README.md +141 -0
- package/dist/components/rel-alert/rel-alert.ts +18 -7
- package/dist/components/rel-avatar/README.md +119 -0
- package/dist/components/rel-badge/README.md +86 -0
- package/dist/components/rel-badge/rel-badge.ts +6 -6
- package/dist/components/rel-breadcrumb/README.md +102 -0
- package/dist/components/rel-breadcrumb/rel-breadcrumb.ts +12 -6
- package/dist/components/rel-button/README.md +130 -0
- package/dist/components/rel-calendar/README.md +109 -0
- package/dist/components/rel-calendar/index.ts +1 -0
- package/dist/components/rel-calendar/rel-calendar.ts +467 -0
- package/dist/components/rel-card/README.md +94 -0
- package/dist/components/rel-card/rel-card.ts +12 -3
- package/dist/components/rel-cardmedia/README.md +127 -0
- package/dist/components/rel-cardmedia/rel-cardmedia.ts +14 -4
- package/dist/components/rel-carousel/README.md +166 -0
- package/dist/components/rel-carousel/index.ts +1 -0
- package/dist/components/rel-carousel/rel-carousel.ts +469 -0
- package/dist/components/rel-chart/README.md +286 -0
- package/dist/components/rel-chart/index.ts +1 -0
- package/dist/components/rel-chart/rel-chart.ts +736 -0
- package/dist/components/rel-checkbox/README.md +77 -0
- package/dist/components/rel-checkbox/rel-checkbox.ts +18 -10
- package/dist/components/rel-chip/README.md +114 -0
- package/dist/components/rel-chip/rel-chip.ts +20 -4
- package/dist/components/rel-container/README.md +99 -0
- package/dist/components/rel-date-picker/README.md +253 -0
- package/dist/components/rel-date-picker/index.ts +1 -0
- package/dist/components/rel-date-picker/rel-date-picker.ts +916 -0
- package/dist/components/rel-divider/README.md +100 -0
- package/dist/components/rel-drawer/README.md +200 -0
- package/dist/components/rel-drawer/index.ts +1 -0
- package/dist/components/rel-drawer/rel-drawer.ts +621 -0
- package/dist/components/rel-kbd/README.md +151 -0
- package/dist/components/rel-kbd/rel-kbd.ts +118 -0
- package/dist/components/rel-layout/README.md +88 -0
- package/dist/components/rel-menu/README.md +151 -0
- package/dist/components/rel-menu/rel-menu.ts +18 -10
- package/dist/components/rel-menubar/README.md +329 -0
- package/dist/components/rel-menubar/index.ts +2 -0
- package/dist/components/rel-menubar/rel-menubar-menu.ts +16 -0
- package/dist/components/rel-menubar/rel-menubar.ts +576 -0
- package/dist/components/rel-nav-menu/README.md +289 -0
- package/dist/components/rel-nav-menu/index.ts +3 -0
- package/dist/components/rel-nav-menu/rel-nav-menu-item.ts +143 -0
- package/dist/components/rel-nav-menu/rel-nav-menu-panel.ts +53 -0
- package/dist/components/rel-nav-menu/rel-nav-menu.ts +331 -0
- package/dist/components/rel-navbar/README.md +126 -0
- package/dist/components/rel-navbar/rel-navbar.ts +91 -0
- package/dist/components/rel-otp/README.md +440 -0
- package/dist/components/rel-otp/index.ts +1 -0
- package/dist/components/rel-otp/rel-otp.ts +504 -0
- package/dist/components/rel-pagination/README.md +410 -0
- package/dist/components/rel-pagination/index.ts +1 -0
- package/dist/components/rel-pagination/rel-pagination.ts +376 -0
- package/dist/components/rel-popover/README.md +568 -0
- package/dist/components/rel-popover/index.ts +2 -0
- package/dist/components/rel-popover/rel-popover-content.ts +55 -0
- package/dist/components/rel-popover/rel-popover.ts +327 -0
- package/dist/components/rel-progress/README.md +110 -0
- package/dist/components/rel-progress/rel-progress.ts +32 -5
- package/dist/components/rel-quote-page/README.md +166 -0
- package/dist/components/rel-quote-page/rel-quote-page.ts +816 -0
- package/dist/components/rel-radio/README.md +120 -0
- package/dist/components/rel-radio/rel-radio.ts +13 -5
- package/dist/components/rel-resizable/README.md +140 -0
- package/dist/components/rel-resizable/index.ts +3 -0
- package/dist/components/rel-resizable/rel-resizable-group.ts +374 -0
- package/dist/components/rel-resizable/rel-resizable-handle.ts +149 -0
- package/dist/components/rel-resizable/rel-resizable-panel.ts +47 -0
- package/dist/components/rel-segmented-button/README.md +141 -0
- package/dist/components/rel-segmented-button/rel-segmented-button.ts +18 -13
- package/dist/components/rel-select/README.md +107 -0
- package/dist/components/rel-select/rel-select.ts +14 -14
- package/dist/components/rel-sheet/README.md +224 -0
- package/dist/components/rel-sheet/rel-sheet.ts +683 -0
- package/dist/components/rel-sidebar/README.md +209 -0
- package/dist/components/rel-sidebar/rel-sidebar.ts +1158 -0
- package/dist/components/rel-slider/README.md +135 -0
- package/dist/components/rel-slider/rel-slider.ts +19 -7
- package/dist/components/rel-snackbar/README.md +134 -0
- package/dist/components/rel-snackbar/rel-snackbar.ts +67 -2
- package/dist/components/rel-stepper/README.md +160 -0
- package/dist/components/rel-stepper/rel-stepper.ts +6 -6
- package/dist/components/rel-switch/README.md +102 -0
- package/dist/components/rel-switch/rel-switch.ts +15 -6
- package/dist/components/rel-tab/README.md +163 -0
- package/dist/components/rel-tab/rel-tab.ts +36 -14
- package/dist/components/rel-table/README.md +178 -0
- package/dist/components/rel-table/rel-table-body.ts +16 -0
- package/dist/components/rel-table/rel-table-caption.ts +22 -0
- package/dist/components/rel-table/rel-table-cell.ts +49 -0
- package/dist/components/rel-table/rel-table-footer.ts +18 -0
- package/dist/components/rel-table/rel-table-head.ts +33 -0
- package/dist/components/rel-table/rel-table-header.ts +16 -0
- package/dist/components/rel-table/rel-table-row.ts +32 -0
- package/dist/components/rel-table/rel-table.ts +47 -0
- package/dist/components/rel-textfield/README.md +90 -0
- package/dist/components/rel-textfield/rel-textfield.ts +35 -19
- package/dist/components/rel-toast/README.md +148 -0
- package/dist/components/rel-toast/rel-toast.ts +32 -14
- package/dist/components/rel-tooltip/README.md +103 -0
- package/dist/components/rel-tooltip/rel-tooltip.ts +9 -9
- package/dist/index.d.mts +836 -1
- package/dist/index.d.ts +836 -1
- package/dist/index.js +10658 -1493
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10616 -1499
- package/dist/index.mjs.map +1 -1
- package/dist/styles/vars.css +293 -183
- package/dist/{vars-6ZIUPIU4.css → vars-ITL2K3KO.css} +293 -183
- package/package.json +1 -1
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
# rel-menubar
|
|
2
|
+
|
|
3
|
+
A horizontal menubar component with dropdown menus, submenus, checkbox items, and radio groups. Provides full keyboard navigation and accessibility features.
|
|
4
|
+
|
|
5
|
+
## What It Is
|
|
6
|
+
|
|
7
|
+
The menubar component consists of two custom elements:
|
|
8
|
+
- `<rel-menubar>` - The root container that manages state and interactions
|
|
9
|
+
- `<rel-menubar-menu>` - Individual menu definitions with their content
|
|
10
|
+
|
|
11
|
+
Content is authored using semantic HTML with data attributes, allowing the component to enhance it with proper menubar behavior.
|
|
12
|
+
|
|
13
|
+
## Basic Usage
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<rel-menubar>
|
|
17
|
+
<rel-menubar-menu label="File">
|
|
18
|
+
<button data-item>New Tab</button>
|
|
19
|
+
<button data-item>New Window</button>
|
|
20
|
+
<button data-item>Close</button>
|
|
21
|
+
</rel-menubar-menu>
|
|
22
|
+
|
|
23
|
+
<rel-menubar-menu label="Edit">
|
|
24
|
+
<button data-item>Undo</button>
|
|
25
|
+
<button data-item>Redo</button>
|
|
26
|
+
<div data-separator></div>
|
|
27
|
+
<button data-item>Cut</button>
|
|
28
|
+
<button data-item>Copy</button>
|
|
29
|
+
<button data-item>Paste</button>
|
|
30
|
+
</rel-menubar-menu>
|
|
31
|
+
|
|
32
|
+
<rel-menubar-menu label="View">
|
|
33
|
+
<button data-item>Zoom In</button>
|
|
34
|
+
<button data-item>Zoom Out</button>
|
|
35
|
+
</rel-menubar-menu>
|
|
36
|
+
</rel-menubar>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Submenu Example
|
|
40
|
+
|
|
41
|
+
Use `data-submenu` attribute with a `label` attribute to create nested menus:
|
|
42
|
+
|
|
43
|
+
```html
|
|
44
|
+
<rel-menubar>
|
|
45
|
+
<rel-menubar-menu label="File">
|
|
46
|
+
<button data-item>New Tab</button>
|
|
47
|
+
<div data-separator></div>
|
|
48
|
+
<div data-submenu label="Share">
|
|
49
|
+
<button data-item>Email link</button>
|
|
50
|
+
<button data-item>Messages</button>
|
|
51
|
+
<button data-item>Notes</button>
|
|
52
|
+
</div>
|
|
53
|
+
<div data-separator></div>
|
|
54
|
+
<button data-item>Close</button>
|
|
55
|
+
</rel-menubar-menu>
|
|
56
|
+
</rel-menubar>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Checkbox Example
|
|
60
|
+
|
|
61
|
+
Wrap a checkbox input in a label with `data-checkbox` attribute:
|
|
62
|
+
|
|
63
|
+
```html
|
|
64
|
+
<rel-menubar>
|
|
65
|
+
<rel-menubar-menu label="View">
|
|
66
|
+
<label data-checkbox>
|
|
67
|
+
<input type="checkbox" />
|
|
68
|
+
Always Show Bookmarks Bar
|
|
69
|
+
</label>
|
|
70
|
+
<label data-checkbox>
|
|
71
|
+
<input type="checkbox" checked />
|
|
72
|
+
Always Show Full URLs
|
|
73
|
+
</label>
|
|
74
|
+
</rel-menubar-menu>
|
|
75
|
+
</rel-menubar>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Radio Group Example
|
|
79
|
+
|
|
80
|
+
Use `data-radio-group` container with `data-radio` items:
|
|
81
|
+
|
|
82
|
+
```html
|
|
83
|
+
<rel-menubar>
|
|
84
|
+
<rel-menubar-menu label="Profile">
|
|
85
|
+
<div data-radio-group name="user-profile" value="andy">
|
|
86
|
+
<button data-radio value="andy">Andy</button>
|
|
87
|
+
<button data-radio value="benoit">Benoit</button>
|
|
88
|
+
<button data-radio value="luis">Luis</button>
|
|
89
|
+
</div>
|
|
90
|
+
</rel-menubar-menu>
|
|
91
|
+
</rel-menubar>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Shortcuts
|
|
95
|
+
|
|
96
|
+
Add keyboard shortcuts as text using the `data-shortcut` attribute:
|
|
97
|
+
|
|
98
|
+
```html
|
|
99
|
+
<rel-menubar>
|
|
100
|
+
<rel-menubar-menu label="Edit">
|
|
101
|
+
<button data-item data-shortcut="Ctrl+Z">Undo</button>
|
|
102
|
+
<button data-item data-shortcut="Ctrl+Y">Redo</button>
|
|
103
|
+
</rel-menubar-menu>
|
|
104
|
+
</rel-menubar>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Or use `<rel-kbd>` components in the button content for better styling:
|
|
108
|
+
|
|
109
|
+
```html
|
|
110
|
+
<rel-menubar>
|
|
111
|
+
<rel-menubar-menu label="Edit">
|
|
112
|
+
<button data-item>
|
|
113
|
+
Undo
|
|
114
|
+
<span style="margin-left: auto; display: flex; gap: 4px;">
|
|
115
|
+
<rel-kbd size="sm">Ctrl</rel-kbd>
|
|
116
|
+
<rel-kbd size="sm">Z</rel-kbd>
|
|
117
|
+
</span>
|
|
118
|
+
</button>
|
|
119
|
+
</rel-menubar-menu>
|
|
120
|
+
</rel-menubar>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Data Attributes
|
|
124
|
+
|
|
125
|
+
### Menu Items
|
|
126
|
+
|
|
127
|
+
| Attribute | Element | Description |
|
|
128
|
+
|-----------|---------|-------------|
|
|
129
|
+
| `data-item` | `<button>` | Standard clickable menu item |
|
|
130
|
+
| `data-separator` | `<div>` | Visual separator line |
|
|
131
|
+
| `data-submenu` | `<div>` | Container for submenu items (requires `label` attribute) |
|
|
132
|
+
| `data-checkbox` | `<label>` | Checkbox item (must contain `<input type="checkbox">`) |
|
|
133
|
+
| `data-radio-group` | `<div>` | Radio group container (requires `name` and `value` attributes) |
|
|
134
|
+
| `data-radio` | `<button>` | Radio button item (requires `value` attribute) |
|
|
135
|
+
| `data-shortcut` | `<button>` | Optional keyboard shortcut text |
|
|
136
|
+
|
|
137
|
+
### Properties
|
|
138
|
+
|
|
139
|
+
**rel-menubar-menu**
|
|
140
|
+
- `label` (string) - The text displayed on the menubar trigger button
|
|
141
|
+
|
|
142
|
+
## Events
|
|
143
|
+
|
|
144
|
+
### rel-menubar-change
|
|
145
|
+
|
|
146
|
+
Emitted when a checkbox is toggled or a radio button is selected.
|
|
147
|
+
|
|
148
|
+
**Checkbox Event Detail:**
|
|
149
|
+
```typescript
|
|
150
|
+
{
|
|
151
|
+
type: "checkbox",
|
|
152
|
+
label: string, // Label text of the checkbox
|
|
153
|
+
checked: boolean // New checked state
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**Radio Event Detail:**
|
|
158
|
+
```typescript
|
|
159
|
+
{
|
|
160
|
+
type: "radio",
|
|
161
|
+
name: string, // Name of the radio group
|
|
162
|
+
value: string // Selected value
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Usage Example:**
|
|
167
|
+
```javascript
|
|
168
|
+
const menubar = document.querySelector('rel-menubar');
|
|
169
|
+
menubar.addEventListener('rel-menubar-change', (event) => {
|
|
170
|
+
const { type, label, checked, name, value } = event.detail;
|
|
171
|
+
|
|
172
|
+
if (type === 'checkbox') {
|
|
173
|
+
console.log(`Checkbox "${label}" is now ${checked ? 'checked' : 'unchecked'}`);
|
|
174
|
+
} else if (type === 'radio') {
|
|
175
|
+
console.log(`Radio group "${name}" selected: ${value}`);
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Keyboard Navigation
|
|
181
|
+
|
|
182
|
+
The menubar provides comprehensive keyboard support:
|
|
183
|
+
|
|
184
|
+
| Key | Context | Action |
|
|
185
|
+
|-----|---------|--------|
|
|
186
|
+
| `Tab` / `Shift+Tab` | Menubar | Focus menubar triggers |
|
|
187
|
+
| `ArrowLeft` / `ArrowRight` | Menubar triggers | Navigate between menu triggers |
|
|
188
|
+
| `Enter` / `Space` | Focused trigger | Open the menu |
|
|
189
|
+
| `ArrowDown` | Open menu | Move to first item or next item |
|
|
190
|
+
| `ArrowUp` | Open menu | Move to previous item |
|
|
191
|
+
| `ArrowRight` | Submenu item | Open submenu |
|
|
192
|
+
| `ArrowLeft` | Open submenu | Close submenu and return to parent |
|
|
193
|
+
| `Escape` | Open menu | Close menu and return focus to trigger |
|
|
194
|
+
| `Enter` / `Space` | Menu item | Activate item (click, toggle checkbox, select radio) |
|
|
195
|
+
|
|
196
|
+
## Interaction Behavior
|
|
197
|
+
|
|
198
|
+
### Opening/Closing
|
|
199
|
+
- Click a trigger to open its menu
|
|
200
|
+
- Click outside to close all menus
|
|
201
|
+
- When a menu is open, clicking another trigger switches to it
|
|
202
|
+
- When a menu is open, hovering another trigger switches to it
|
|
203
|
+
|
|
204
|
+
### Submenus
|
|
205
|
+
- Click or hover a submenu item to open its submenu
|
|
206
|
+
- Submenu appears to the right of the parent menu
|
|
207
|
+
- ArrowRight/ArrowLeft navigate in/out of submenus
|
|
208
|
+
|
|
209
|
+
### State Management
|
|
210
|
+
- Checkbox state is maintained in the DOM
|
|
211
|
+
- Radio group value is stored on the `data-radio-group` element
|
|
212
|
+
- Selected radio items receive `data-checked` attribute
|
|
213
|
+
|
|
214
|
+
## Accessibility
|
|
215
|
+
|
|
216
|
+
- Proper ARIA roles and keyboard navigation
|
|
217
|
+
- Focus management with visual focus indicators
|
|
218
|
+
- Screen reader friendly with semantic HTML
|
|
219
|
+
- Disabled items are properly marked and non-interactive
|
|
220
|
+
- All interactive elements are keyboard accessible
|
|
221
|
+
|
|
222
|
+
## Styling Tokens
|
|
223
|
+
|
|
224
|
+
The component uses design tokens from the Reliability Design System:
|
|
225
|
+
|
|
226
|
+
### Colors
|
|
227
|
+
- `--rel-colors-gray-light` - Menubar background
|
|
228
|
+
- `--rel-colors-gray-background` - Trigger and item hover state
|
|
229
|
+
- `--rel-colors-gray-border` - Borders
|
|
230
|
+
- `--rel-colors-gray-divider` - Separators
|
|
231
|
+
- `--rel-colors-gray-heading` - Text color
|
|
232
|
+
- `--rel-colors-white` - Panel background
|
|
233
|
+
- `--rel-colors-blue-primary` - Focus outline and radio selected state
|
|
234
|
+
|
|
235
|
+
### Typography
|
|
236
|
+
- `--rel-fontFamilies-primary` - Font family (Poppins)
|
|
237
|
+
- `--rel-fontSizes-sm` - Default text size
|
|
238
|
+
- `--rel-fontSizes-xs` - Shortcut text size
|
|
239
|
+
- `--rel-lineHeights-sm` - Line height
|
|
240
|
+
|
|
241
|
+
### Spacing
|
|
242
|
+
- `--rel-spacing-space-3xs` (2px) - Menubar gap and panel padding
|
|
243
|
+
- `--rel-spacing-space-2xs` (4px) - Trigger padding vertical
|
|
244
|
+
- `--rel-spacing-space-xs` (8px) - Item padding vertical
|
|
245
|
+
- `--rel-spacing-space-sm` (12px) - Trigger and item horizontal padding
|
|
246
|
+
- `--rel-spacing-space-md` (16px) - Item padding and radio offset
|
|
247
|
+
|
|
248
|
+
### Borders
|
|
249
|
+
- `--rel-borders-width-stroke-100` (1px) - Border width
|
|
250
|
+
- `--rel-borders-width-stroke-150` (1.5px) - Radio border
|
|
251
|
+
- `--rel-borders-radius-border-radius-100` (2px) - Trigger border radius
|
|
252
|
+
- `--rel-borders-radius-border-radius-200` (8px) - Panel border radius
|
|
253
|
+
|
|
254
|
+
### Shadows
|
|
255
|
+
- `--rel-shadows-shadow-300` - Panel drop shadow
|
|
256
|
+
|
|
257
|
+
### Z-Index
|
|
258
|
+
- Menu panels: `z-index: 1000`
|
|
259
|
+
- Submenu panels: `z-index: 1001`
|
|
260
|
+
|
|
261
|
+
## Browser Support
|
|
262
|
+
|
|
263
|
+
Compatible with all modern browsers that support:
|
|
264
|
+
- Web Components (Custom Elements v1)
|
|
265
|
+
- Shadow DOM
|
|
266
|
+
- ES2020+ features
|
|
267
|
+
|
|
268
|
+
## Framework Integration
|
|
269
|
+
|
|
270
|
+
Works seamlessly with:
|
|
271
|
+
- Vanilla JavaScript
|
|
272
|
+
- Angular
|
|
273
|
+
- React (via wrapper)
|
|
274
|
+
- Vue
|
|
275
|
+
- Any framework that supports Web Components
|
|
276
|
+
|
|
277
|
+
## Complete Example
|
|
278
|
+
|
|
279
|
+
```html
|
|
280
|
+
<rel-menubar id="app-menubar">
|
|
281
|
+
<rel-menubar-menu label="File">
|
|
282
|
+
<button data-item data-shortcut="Ctrl+N">New Tab</button>
|
|
283
|
+
<button data-item data-shortcut="Ctrl+Shift+N">New Window</button>
|
|
284
|
+
<div data-separator></div>
|
|
285
|
+
<div data-submenu label="Share">
|
|
286
|
+
<button data-item>Email link</button>
|
|
287
|
+
<button data-item>Messages</button>
|
|
288
|
+
<button data-item>Notes</button>
|
|
289
|
+
</div>
|
|
290
|
+
<div data-separator></div>
|
|
291
|
+
<button data-item>Close</button>
|
|
292
|
+
</rel-menubar-menu>
|
|
293
|
+
|
|
294
|
+
<rel-menubar-menu label="Edit">
|
|
295
|
+
<button data-item data-shortcut="Ctrl+Z">Undo</button>
|
|
296
|
+
<button data-item data-shortcut="Ctrl+Y">Redo</button>
|
|
297
|
+
<div data-separator></div>
|
|
298
|
+
<button data-item data-shortcut="Ctrl+X">Cut</button>
|
|
299
|
+
<button data-item data-shortcut="Ctrl+C">Copy</button>
|
|
300
|
+
<button data-item data-shortcut="Ctrl+V">Paste</button>
|
|
301
|
+
</rel-menubar-menu>
|
|
302
|
+
|
|
303
|
+
<rel-menubar-menu label="View">
|
|
304
|
+
<button data-item>Zoom In</button>
|
|
305
|
+
<button data-item>Zoom Out</button>
|
|
306
|
+
<div data-separator></div>
|
|
307
|
+
<label data-checkbox>
|
|
308
|
+
<input type="checkbox" />
|
|
309
|
+
Always Show Bookmarks Bar
|
|
310
|
+
</label>
|
|
311
|
+
<label data-checkbox>
|
|
312
|
+
<input type="checkbox" checked />
|
|
313
|
+
Always Show Full URLs
|
|
314
|
+
</label>
|
|
315
|
+
<div data-separator></div>
|
|
316
|
+
<div data-radio-group name="profile" value="andy">
|
|
317
|
+
<button data-radio value="andy">Andy</button>
|
|
318
|
+
<button data-radio value="benoit">Benoit</button>
|
|
319
|
+
<button data-radio value="luis">Luis</button>
|
|
320
|
+
</div>
|
|
321
|
+
</rel-menubar-menu>
|
|
322
|
+
</rel-menubar>
|
|
323
|
+
|
|
324
|
+
<script>
|
|
325
|
+
document.getElementById('app-menubar').addEventListener('rel-menubar-change', (e) => {
|
|
326
|
+
console.log('Menubar change:', e.detail);
|
|
327
|
+
});
|
|
328
|
+
</script>
|
|
329
|
+
```
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LitElement, html } from "lit";
|
|
2
|
+
import { customElement, property } from "lit/decorators.js";
|
|
3
|
+
|
|
4
|
+
@customElement("rel-menubar-menu")
|
|
5
|
+
export class RelMenubarMenu extends LitElement {
|
|
6
|
+
@property({ type: String }) label = "";
|
|
7
|
+
|
|
8
|
+
// Disable shadow DOM to allow parent to access children
|
|
9
|
+
createRenderRoot() {
|
|
10
|
+
return this;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
render() {
|
|
14
|
+
return html`<slot></slot>`;
|
|
15
|
+
}
|
|
16
|
+
}
|