@m3e/menu 1.0.0-rc.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/LICENSE +22 -0
- package/README.md +315 -0
- package/cem.config.mjs +16 -0
- package/demo/index.html +112 -0
- package/dist/css-custom-data.json +362 -0
- package/dist/custom-elements.json +1590 -0
- package/dist/html-custom-data.json +106 -0
- package/dist/index.js +1274 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +276 -0
- package/dist/index.min.js.map +1 -0
- package/dist/src/MenuElement.d.ts +143 -0
- package/dist/src/MenuElement.d.ts.map +1 -0
- package/dist/src/MenuItemCheckboxElement.d.ts +76 -0
- package/dist/src/MenuItemCheckboxElement.d.ts.map +1 -0
- package/dist/src/MenuItemElement.d.ts +113 -0
- package/dist/src/MenuItemElement.d.ts.map +1 -0
- package/dist/src/MenuItemElementBase.d.ts +21 -0
- package/dist/src/MenuItemElementBase.d.ts.map +1 -0
- package/dist/src/MenuItemGroupElement.d.ts +28 -0
- package/dist/src/MenuItemGroupElement.d.ts.map +1 -0
- package/dist/src/MenuItemRadioElement.d.ts +77 -0
- package/dist/src/MenuItemRadioElement.d.ts.map +1 -0
- package/dist/src/MenuPosition.d.ts +5 -0
- package/dist/src/MenuPosition.d.ts.map +1 -0
- package/dist/src/MenuTriggerElement.d.ts +86 -0
- package/dist/src/MenuTriggerElement.d.ts.map +1 -0
- package/dist/src/index.d.ts +8 -0
- package/dist/src/index.d.ts.map +1 -0
- package/eslint.config.mjs +13 -0
- package/package.json +48 -0
- package/rollup.config.js +32 -0
- package/src/MenuElement.ts +449 -0
- package/src/MenuItemCheckboxElement.ts +178 -0
- package/src/MenuItemElement.ts +210 -0
- package/src/MenuItemElementBase.ts +158 -0
- package/src/MenuItemGroupElement.ts +37 -0
- package/src/MenuItemRadioElement.ts +169 -0
- package/src/MenuPosition.ts +5 -0
- package/src/MenuTriggerElement.ts +154 -0
- package/src/index.ts +7 -0
- package/tsconfig.json +9 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 matraic
|
|
4
|
+
Contact: matraic@yahoo.com
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
# @m3e/menu
|
|
2
|
+
|
|
3
|
+
The `@m3e/menu` package provides a cohesive set of components for constructing accessible, anchored menus that align with Material 3 design guidance. It supports both single and multi-selection patterns, nested menu hierarchies, and dynamically positioned floating panels. Menus are triggered from interactive elements and present checkable or exclusive choices using item variants. Grouping primitives establish selection boundaries, while nested flows support layered navigation and progressive disclosure.
|
|
4
|
+
|
|
5
|
+
> **Part of the [M3E](../../README.md) monorepo**
|
|
6
|
+
> This package is maintained within the unified M3E repository, which provides a suite of Material 3 web components.
|
|
7
|
+
|
|
8
|
+
## 📦 Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @m3e/menu
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## 💻 Editor Integration
|
|
15
|
+
|
|
16
|
+
This package includes a [Custom Elements Manifest](https://github.com/webcomponents/custom-elements-manifest) to support enhanced editor tooling and developer experience.
|
|
17
|
+
|
|
18
|
+
### Visual Studio Code
|
|
19
|
+
|
|
20
|
+
To enable autocomplete and hover documentation for `@m3e/menu`, install the [Custom Elements Manifest Language Server](https://marketplace.visualstudio.com/items?itemName=pwrs.cem-language-server-vscode) extension. It will automatically detect the manifest bundled with this package and surface tag names, attributes, slots, and events in supported files.
|
|
21
|
+
|
|
22
|
+
Alternately, you can explicitly reference the `html-custom-data.json` and `css-custom-data.json` in your workspace settings:
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"html.customData": ["./node_modules/@m3e/menu/dist/html-custom-data.json"],
|
|
27
|
+
"css.customData": ["./node_modules/@m3e/menu/dist/css-custom-data.json"]
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## 🚀 Browser Usage
|
|
32
|
+
|
|
33
|
+
This package uses [JavaScript Modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#module_specifiers). To use it directly in a browser without a bundler, use a module script similar to the following.
|
|
34
|
+
|
|
35
|
+
```html
|
|
36
|
+
<script type="module" src="/node_modules/@m3e/menu/dist/index.js"></script>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
In addition, you must use an [import map](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/script/type/importmap) to include dependencies.
|
|
40
|
+
|
|
41
|
+
```html
|
|
42
|
+
<script type="importmap">
|
|
43
|
+
{
|
|
44
|
+
"imports": {
|
|
45
|
+
"lit": "https://cdn.jsdelivr.net/npm/lit@3.3.0/+esm",
|
|
46
|
+
"@m3e/core": "/node_modules/@m3e/core/dist/index.js",
|
|
47
|
+
"@m3e/core/a11y": "/node_modules/@m3e/core/dist/a11y.js",
|
|
48
|
+
"@m3e/core/anchoring": "/node_modules/@m3e/core/dist/anchoring.js"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
</script>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
> For production, use index.min.js, a11y.min.js, and anchoring.min.js for faster load times.
|
|
55
|
+
|
|
56
|
+
## 🗂️ Elements
|
|
57
|
+
|
|
58
|
+
- `m3e-menu` — Presents a list of choices on a temporary surface.
|
|
59
|
+
- `m3e-menu-item` — An item of a menu.
|
|
60
|
+
- `m3e-menu-item-checkbox` — An item of a menu which supports a checkable state.
|
|
61
|
+
- `m3e-menu-item-radio` — An item of a menu which supports a mutually exclusive checkable state.
|
|
62
|
+
- `m3e-menu-item-group` — Groups related items (such a radios) in a menu.
|
|
63
|
+
- `m3e-menu-trigger` — An element, nested within a clickable element, used to open a menu.
|
|
64
|
+
|
|
65
|
+
## 🧪 Examples
|
|
66
|
+
|
|
67
|
+
The following example illustrates a basic menu. The `m3e-menu-trigger` is used to trigger a `m3e-menu` specified by the `for` attribute when its parenting element is activated.
|
|
68
|
+
|
|
69
|
+
```html
|
|
70
|
+
<m3e-button>
|
|
71
|
+
<m3e-menu-trigger for="menu1">Basic menu</m3e-menu-trigger>
|
|
72
|
+
</m3e-button>
|
|
73
|
+
<m3e-menu id="menu1">
|
|
74
|
+
<m3e-menu-item>Apple</m3e-menu-item>
|
|
75
|
+
<m3e-menu-item>Apricot</m3e-menu-item>
|
|
76
|
+
<m3e-menu-item>Avocado</m3e-menu-item>
|
|
77
|
+
<m3e-menu-item>Green Apple</m3e-menu-item>
|
|
78
|
+
<m3e-menu-item>Green Grapes</m3e-menu-item>
|
|
79
|
+
<m3e-menu-item>Olive</m3e-menu-item>
|
|
80
|
+
<m3e-menu-item>Orange</m3e-menu-item>
|
|
81
|
+
</m3e-menu>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The next example illustrates nested menus. Submenus are triggered by placing a `m3e-menu-trigger` inside a `m3e-menu-item`.
|
|
85
|
+
|
|
86
|
+
```html
|
|
87
|
+
<m3e-button>
|
|
88
|
+
<m3e-menu-trigger for="menu2">Nested menus</m3e-menu-trigger>
|
|
89
|
+
</m3e-button>
|
|
90
|
+
<m3e-menu id="menu2">
|
|
91
|
+
<m3e-menu-item>
|
|
92
|
+
<m3e-menu-trigger for="menu3">Fruits with A</m3e-menu-trigger>
|
|
93
|
+
</m3e-menu-item>
|
|
94
|
+
<m3e-menu-item>Grapes</m3e-menu-item>
|
|
95
|
+
<m3e-menu-item>Olive</m3e-menu-item>
|
|
96
|
+
<m3e-menu-item>Orange</m3e-menu-item>
|
|
97
|
+
</m3e-menu>
|
|
98
|
+
<m3e-menu id="menu3">
|
|
99
|
+
<m3e-menu-item>Apricot</m3e-menu-item>
|
|
100
|
+
<m3e-menu-item>Avocado</m3e-menu-item>
|
|
101
|
+
<m3e-menu-item>
|
|
102
|
+
<m3e-menu-trigger for="menu4">Apples</m3e-menu-trigger>
|
|
103
|
+
</m3e-menu-item>
|
|
104
|
+
</m3e-menu>
|
|
105
|
+
<m3e-menu id="menu4">
|
|
106
|
+
<m3e-menu-item>Fuji</m3e-menu-item>
|
|
107
|
+
<m3e-menu-item>Granny Smith</m3e-menu-item>
|
|
108
|
+
<m3e-menu-item>Red Delicious</m3e-menu-item>
|
|
109
|
+
</m3e-menu>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## 📖 API Reference
|
|
113
|
+
|
|
114
|
+
### 🗂️ m3e-menu
|
|
115
|
+
|
|
116
|
+
This section details the attributes, events, slots and CSS custom properties available for the `m3e-menu` component.
|
|
117
|
+
|
|
118
|
+
#### ⚙️ Attributes
|
|
119
|
+
|
|
120
|
+
| Attribute | Type | Default | Description |
|
|
121
|
+
| ------------ | ----------------------- | --------- | ---------------------------------------- |
|
|
122
|
+
| `position-x` | `"before"` \| `"after"` | `"after"` | The position of the menu, on the x-axis. |
|
|
123
|
+
| `position-y` | `"above"` \| `"below"` | `"below"` | The position of the menu, on the y-axis. |
|
|
124
|
+
|
|
125
|
+
#### 🔔 Events
|
|
126
|
+
|
|
127
|
+
| Event | Description |
|
|
128
|
+
| -------------- | ------------------------------------------- |
|
|
129
|
+
| `beforetoggle` | Dispatched before the toggle state changes. |
|
|
130
|
+
| `toggle` | Dispatched after the toggle state changes. |
|
|
131
|
+
|
|
132
|
+
#### 🧩 Slots
|
|
133
|
+
|
|
134
|
+
| Slot | Description |
|
|
135
|
+
| ----------- | --------------------------------- |
|
|
136
|
+
| _(default)_ | Renders the contents of the menu. |
|
|
137
|
+
|
|
138
|
+
#### 🎛️ CSS Custom Properties
|
|
139
|
+
|
|
140
|
+
| Property | Description |
|
|
141
|
+
| ------------------------------------ | ------------------------------------------------------- |
|
|
142
|
+
| `--m3e-menu-container-shape` | Controls the corner radius of the menu container. |
|
|
143
|
+
| `--m3e-menu-container-min-width` | Minimum width of the menu container. |
|
|
144
|
+
| `--m3e-menu-container-max-width` | Maximum width of the menu container. |
|
|
145
|
+
| `--m3e-menu-container-max-height` | Maximum height of the menu container. |
|
|
146
|
+
| `--m3e-menu-container-padding-block` | Vertical padding inside the menu container. |
|
|
147
|
+
| `--m3e-menu-container-color` | Background color of the menu container. |
|
|
148
|
+
| `--m3e-menu-container-elevation` | Box shadow elevation of the menu container. |
|
|
149
|
+
| `--m3e-menu-divider-spacing` | Vertical spacing around slotted `m3e-divider` elements. |
|
|
150
|
+
|
|
151
|
+
### 🗂️ m3e-menu-item
|
|
152
|
+
|
|
153
|
+
This section details the attributes, slots and CSS custom properties available for the `m3e-menu-item` component.
|
|
154
|
+
|
|
155
|
+
#### ⚙️ Attributes
|
|
156
|
+
|
|
157
|
+
| Attribute | Type | Default | Description |
|
|
158
|
+
| ---------- | --------- | ------- | ----------------------------------------------------------------------------------------------------------- |
|
|
159
|
+
| `disabled` | `boolean` | `false` | Whether the element is disabled. |
|
|
160
|
+
| `download` | `string` | | Whether the `target` of the link button will be downloaded, optionally specifying the new name of the file. |
|
|
161
|
+
| `href` | `string` | | The URL to which the link button points. |
|
|
162
|
+
| `rel` | `string` | | The relationship between the `target` of the link button and the document. |
|
|
163
|
+
| `target` | `string` | | The target of the link button. |
|
|
164
|
+
|
|
165
|
+
#### 🧩 Slots
|
|
166
|
+
|
|
167
|
+
| Slot | Description |
|
|
168
|
+
| --------------- | ----------------------------------------- |
|
|
169
|
+
| _(default)_ | Renders the label of the item. |
|
|
170
|
+
| `icon` | Renders an icon before the items's label. |
|
|
171
|
+
| `trailing-icon` | Renders an icon after the item's label. |
|
|
172
|
+
|
|
173
|
+
#### 🎛️ CSS Custom Properties
|
|
174
|
+
|
|
175
|
+
| Property | Description |
|
|
176
|
+
| ------------------------------------------------ | ------------------------------------------------ |
|
|
177
|
+
| `--m3e-menu-item-container-height` | Height of the menu item container. |
|
|
178
|
+
| `--m3e-menu-item-color` | Text color for unselected, enabled menu items. |
|
|
179
|
+
| `--m3e-menu-item-container-hover-color` | State layer hover color for unselected items. |
|
|
180
|
+
| `--m3e-menu-item-container-focus-color` | State layer focus color for unselected items. |
|
|
181
|
+
| `--m3e-menu-item-ripple-color` | Ripple color for unselected items. |
|
|
182
|
+
| `--m3e-menu-selected-color` | Text color for selected or expanded items. |
|
|
183
|
+
| `--m3e-menu-selected-container-color` | Background color for selected or expanded items. |
|
|
184
|
+
| `--m3e-menu-item-selected-container-hover-color` | State layer hover color for selected items. |
|
|
185
|
+
| `--m3e-menu-item-selected-container-focus-color` | State layer focus color for selected items. |
|
|
186
|
+
| `--m3e-menu-item-selected-ripple-color` | Ripple color for selected items. |
|
|
187
|
+
| `--m3e-menu-item-disabled-color` | Base color for disabled items. |
|
|
188
|
+
| `--m3e-menu-item-disabled-opacity` | Opacity percentage for disabled item color mix. |
|
|
189
|
+
| `--m3e-menu-item-icon-label-space` | Horizontal gap between icon and content. |
|
|
190
|
+
| `--m3e-menu-item-padding-start` | Start padding for the item wrapper. |
|
|
191
|
+
| `--m3e-menu-item-padding-end` | End padding for the item wrapper. |
|
|
192
|
+
| `--m3e-menu-item-label-text-font-size` | Font size for menu item text. |
|
|
193
|
+
| `--m3e-menu-item-label-text-font-weight` | Font weight for menu item text. |
|
|
194
|
+
| `--m3e-menu-item-label-text-line-height` | Line height for menu item text. |
|
|
195
|
+
| `--m3e-menu-item-label-text-tracking` | Letter spacing for menu item text. |
|
|
196
|
+
| `--m3e-menu-item-focus-ring-shape` | Border radius for the focus ring. |
|
|
197
|
+
| `--m3e-menu-item-icon-size` | Font size for leading and trailing icons. |
|
|
198
|
+
|
|
199
|
+
### 🗂️ m3e-menu-item-checkbox
|
|
200
|
+
|
|
201
|
+
This section details the attributes, slots and CSS custom properties available for the `m3e-menu-item-checkbox` component.
|
|
202
|
+
|
|
203
|
+
#### ⚙️ Attributes
|
|
204
|
+
|
|
205
|
+
| Attribute | Type | Default | Description |
|
|
206
|
+
| ---------- | --------- | ------- | -------------------------------- |
|
|
207
|
+
| `disabled` | `boolean` | `false` | Whether the element is disabled. |
|
|
208
|
+
| `checked` | `boolean` | `false` | Whether the element is checked. |
|
|
209
|
+
|
|
210
|
+
#### 🧩 Slots
|
|
211
|
+
|
|
212
|
+
| Slot | Description |
|
|
213
|
+
| --------------- | ----------------------------------------- |
|
|
214
|
+
| _(default)_ | Renders the label of the item. |
|
|
215
|
+
| `icon` | Renders an icon before the items's label. |
|
|
216
|
+
| `trailing-icon` | Renders an icon after the item's label. |
|
|
217
|
+
|
|
218
|
+
#### 🎛️ CSS Custom Properties
|
|
219
|
+
|
|
220
|
+
| Property | Description |
|
|
221
|
+
| ------------------------------------------------ | ------------------------------------------------ |
|
|
222
|
+
| `--m3e-menu-item-container-height` | Height of the menu item container. |
|
|
223
|
+
| `--m3e-menu-item-color` | Text color for unselected, enabled menu items. |
|
|
224
|
+
| `--m3e-menu-item-container-hover-color` | State layer hover color for unselected items. |
|
|
225
|
+
| `--m3e-menu-item-container-focus-color` | State layer focus color for unselected items. |
|
|
226
|
+
| `--m3e-menu-item-ripple-color` | Ripple color for unselected items. |
|
|
227
|
+
| `--m3e-menu-selected-color` | Text color for selected or expanded items. |
|
|
228
|
+
| `--m3e-menu-selected-container-color` | Background color for selected or expanded items. |
|
|
229
|
+
| `--m3e-menu-item-selected-container-hover-color` | State layer hover color for selected items. |
|
|
230
|
+
| `--m3e-menu-item-selected-container-focus-color` | State layer focus color for selected items. |
|
|
231
|
+
| `--m3e-menu-item-selected-ripple-color` | Ripple color for selected items. |
|
|
232
|
+
| `--m3e-menu-item-disabled-color` | Base color for disabled items. |
|
|
233
|
+
| `--m3e-menu-item-disabled-opacity` | Opacity percentage for disabled item color mix. |
|
|
234
|
+
| `--m3e-menu-item-icon-label-space` | Horizontal gap between icon and content. |
|
|
235
|
+
| `--m3e-menu-item-padding-start` | Start padding for the item wrapper. |
|
|
236
|
+
| `--m3e-menu-item-padding-end` | End padding for the item wrapper. |
|
|
237
|
+
| `--m3e-menu-item-label-text-font-size` | Font size for menu item text. |
|
|
238
|
+
| `--m3e-menu-item-label-text-font-weight` | Font weight for menu item text. |
|
|
239
|
+
| `--m3e-menu-item-label-text-line-height` | Line height for menu item text. |
|
|
240
|
+
| `--m3e-menu-item-label-text-tracking` | Letter spacing for menu item text. |
|
|
241
|
+
| `--m3e-menu-item-focus-ring-shape` | Border radius for the focus ring. |
|
|
242
|
+
| `--m3e-menu-item-icon-size` | Font size for leading and trailing icons. |
|
|
243
|
+
|
|
244
|
+
### 🗂️ m3e-menu-item-radio
|
|
245
|
+
|
|
246
|
+
This section details the attributes, slots and CSS custom properties available for the `m3e-menu-item-radio` component.
|
|
247
|
+
|
|
248
|
+
#### ⚙️ Attributes
|
|
249
|
+
|
|
250
|
+
| Attribute | Type | Default | Description |
|
|
251
|
+
| ---------- | --------- | ------- | -------------------------------- |
|
|
252
|
+
| `disabled` | `boolean` | `false` | Whether the element is disabled. |
|
|
253
|
+
| `checked` | `boolean` | `false` | Whether the element is checked. |
|
|
254
|
+
|
|
255
|
+
#### 🧩 Slots
|
|
256
|
+
|
|
257
|
+
| Slot | Description |
|
|
258
|
+
| --------------- | ----------------------------------------- |
|
|
259
|
+
| _(default)_ | Renders the label of the item. |
|
|
260
|
+
| `icon` | Renders an icon before the items's label. |
|
|
261
|
+
| `trailing-icon` | Renders an icon after the item's label. |
|
|
262
|
+
|
|
263
|
+
#### 🎛️ CSS Custom Properties
|
|
264
|
+
|
|
265
|
+
| Property | Description |
|
|
266
|
+
| ------------------------------------------------ | ------------------------------------------------ |
|
|
267
|
+
| `--m3e-menu-item-container-height` | Height of the menu item container. |
|
|
268
|
+
| `--m3e-menu-item-color` | Text color for unselected, enabled menu items. |
|
|
269
|
+
| `--m3e-menu-item-container-hover-color` | State layer hover color for unselected items. |
|
|
270
|
+
| `--m3e-menu-item-container-focus-color` | State layer focus color for unselected items. |
|
|
271
|
+
| `--m3e-menu-item-ripple-color` | Ripple color for unselected items. |
|
|
272
|
+
| `--m3e-menu-selected-color` | Text color for selected or expanded items. |
|
|
273
|
+
| `--m3e-menu-selected-container-color` | Background color for selected or expanded items. |
|
|
274
|
+
| `--m3e-menu-item-selected-container-hover-color` | State layer hover color for selected items. |
|
|
275
|
+
| `--m3e-menu-item-selected-container-focus-color` | State layer focus color for selected items. |
|
|
276
|
+
| `--m3e-menu-item-selected-ripple-color` | Ripple color for selected items. |
|
|
277
|
+
| `--m3e-menu-item-disabled-color` | Base color for disabled items. |
|
|
278
|
+
| `--m3e-menu-item-disabled-opacity` | Opacity percentage for disabled item color mix. |
|
|
279
|
+
| `--m3e-menu-item-icon-label-space` | Horizontal gap between icon and content. |
|
|
280
|
+
| `--m3e-menu-item-padding-start` | Start padding for the item wrapper. |
|
|
281
|
+
| `--m3e-menu-item-padding-end` | End padding for the item wrapper. |
|
|
282
|
+
| `--m3e-menu-item-label-text-font-size` | Font size for menu item text. |
|
|
283
|
+
| `--m3e-menu-item-label-text-font-weight` | Font weight for menu item text. |
|
|
284
|
+
| `--m3e-menu-item-label-text-line-height` | Line height for menu item text. |
|
|
285
|
+
| `--m3e-menu-item-label-text-tracking` | Letter spacing for menu item text. |
|
|
286
|
+
| `--m3e-menu-item-focus-ring-shape` | Border radius for the focus ring. |
|
|
287
|
+
| `--m3e-menu-item-icon-size` | Font size for leading and trailing icons. |
|
|
288
|
+
|
|
289
|
+
### 🗂️ m3e-menu-item-group
|
|
290
|
+
|
|
291
|
+
This section details the slots available for the `m3e-menu-item-group` component.
|
|
292
|
+
|
|
293
|
+
#### 🧩 Slots
|
|
294
|
+
|
|
295
|
+
| Slot | Description |
|
|
296
|
+
| ----------- | ---------------------------------- |
|
|
297
|
+
| _(default)_ | Renders the contents of the group. |
|
|
298
|
+
|
|
299
|
+
### 🗂️ m3e-menu-trigger
|
|
300
|
+
|
|
301
|
+
This section details the slots available for the `m3e-menu-trigger` component.
|
|
302
|
+
|
|
303
|
+
#### 🧩 Slots
|
|
304
|
+
|
|
305
|
+
| Slot | Description |
|
|
306
|
+
| ----------- | ------------------------------------ |
|
|
307
|
+
| _(default)_ | Renders the contents of the trigger. |
|
|
308
|
+
|
|
309
|
+
## 🤝 Contributing
|
|
310
|
+
|
|
311
|
+
See the root monorepo `CONTRIBUTING.md` for guidelines on contributing to this package.
|
|
312
|
+
|
|
313
|
+
## 📄 License
|
|
314
|
+
|
|
315
|
+
This package is licensed under the MIT License.
|
package/cem.config.mjs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { customElementVsCodePlugin } from "custom-element-vs-code-integration";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
globs: ["src/**/*.ts"],
|
|
5
|
+
exclude: ["src/**/*.spec.ts"],
|
|
6
|
+
packagejson: true,
|
|
7
|
+
outdir: "dist",
|
|
8
|
+
litelement: true,
|
|
9
|
+
plugins: [
|
|
10
|
+
customElementVsCodePlugin({
|
|
11
|
+
outdir: "dist",
|
|
12
|
+
htmlFileName: "html-custom-data.json",
|
|
13
|
+
cssFileName: "css-custom-data.json",
|
|
14
|
+
}),
|
|
15
|
+
],
|
|
16
|
+
};
|
package/demo/index.html
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en" style="overflow-y: auto">
|
|
3
|
+
<head>
|
|
4
|
+
<title>Menu for M3E</title>
|
|
5
|
+
<meta charset="utf-8" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
|
+
<meta name="description" content="Menu for M3E" />
|
|
8
|
+
<base href="./" />
|
|
9
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
10
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
11
|
+
<link
|
|
12
|
+
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap"
|
|
13
|
+
rel="stylesheet"
|
|
14
|
+
/>
|
|
15
|
+
<link
|
|
16
|
+
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0..1,0"
|
|
17
|
+
rel="stylesheet"
|
|
18
|
+
/>
|
|
19
|
+
<script type="importmap">
|
|
20
|
+
{
|
|
21
|
+
"imports": {
|
|
22
|
+
"lit": "https://cdn.jsdelivr.net/npm/lit@3.3.0/+esm",
|
|
23
|
+
"@m3e/core": "../../core/dist/index.min.js",
|
|
24
|
+
"@m3e/core/a11y": "../../core/dist/a11y.min.js",
|
|
25
|
+
"@m3e/core/anchoring": "../../core/dist/anchoring.min.js"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
</script>
|
|
29
|
+
<script type="module" src="../../button/dist/index.min.js"></script>
|
|
30
|
+
<script type="module" src="../../icon/dist/index.min.js"></script>
|
|
31
|
+
<script type="module" src="../../divider/dist/index.min.js"></script>
|
|
32
|
+
<script type="module" src="../../theme/dist/index.min.js"></script>
|
|
33
|
+
<script type="module" src="../dist/index.min.js"></script>
|
|
34
|
+
<style>
|
|
35
|
+
body {
|
|
36
|
+
font-family: "Roboto";
|
|
37
|
+
}
|
|
38
|
+
*:not(:defined) {
|
|
39
|
+
display: none;
|
|
40
|
+
}
|
|
41
|
+
</style>
|
|
42
|
+
</head>
|
|
43
|
+
<body>
|
|
44
|
+
<m3e-theme strong-focus>
|
|
45
|
+
<m3e-button>
|
|
46
|
+
<m3e-menu-trigger for="menu1">Basic menu</m3e-menu-trigger>
|
|
47
|
+
</m3e-button>
|
|
48
|
+
<m3e-menu id="menu1">
|
|
49
|
+
<m3e-menu-item>Apple</m3e-menu-item>
|
|
50
|
+
<m3e-menu-item>Apricot</m3e-menu-item>
|
|
51
|
+
<m3e-menu-item>Avocado</m3e-menu-item>
|
|
52
|
+
<m3e-menu-item>Green Apple</m3e-menu-item>
|
|
53
|
+
<m3e-menu-item>Green Grapes</m3e-menu-item>
|
|
54
|
+
<m3e-menu-item>Olive</m3e-menu-item>
|
|
55
|
+
<m3e-menu-item>Orange</m3e-menu-item>
|
|
56
|
+
</m3e-menu>
|
|
57
|
+
|
|
58
|
+
<m3e-button>
|
|
59
|
+
<m3e-menu-trigger for="menu2">Nested menus</m3e-menu-trigger>
|
|
60
|
+
</m3e-button>
|
|
61
|
+
<m3e-menu id="menu2">
|
|
62
|
+
<m3e-menu-item>
|
|
63
|
+
<m3e-menu-trigger for="menu3">Fruits with A</m3e-menu-trigger>
|
|
64
|
+
</m3e-menu-item>
|
|
65
|
+
<m3e-menu-item>Grapes</m3e-menu-item>
|
|
66
|
+
<m3e-menu-item>Olive</m3e-menu-item>
|
|
67
|
+
<m3e-menu-item>Orange</m3e-menu-item>
|
|
68
|
+
</m3e-menu>
|
|
69
|
+
<m3e-menu id="menu3">
|
|
70
|
+
<m3e-menu-item>Apricot</m3e-menu-item>
|
|
71
|
+
<m3e-menu-item>Avocado</m3e-menu-item>
|
|
72
|
+
<m3e-menu-item>
|
|
73
|
+
<m3e-menu-trigger for="menu4">Apples</m3e-menu-trigger>
|
|
74
|
+
</m3e-menu-item>
|
|
75
|
+
</m3e-menu>
|
|
76
|
+
<m3e-menu id="menu4">
|
|
77
|
+
<m3e-menu-item>Fuji</m3e-menu-item>
|
|
78
|
+
<m3e-menu-item>Granny Smith</m3e-menu-item>
|
|
79
|
+
<m3e-menu-item>Red Delicious</m3e-menu-item>
|
|
80
|
+
</m3e-menu>
|
|
81
|
+
|
|
82
|
+
<m3e-button>
|
|
83
|
+
<m3e-menu-trigger for="menu5">Menu with checkboxes</m3e-menu-trigger>
|
|
84
|
+
</m3e-button>
|
|
85
|
+
<m3e-menu id="menu5">
|
|
86
|
+
<m3e-menu-item-checkbox>Bold</m3e-menu-item-checkbox>
|
|
87
|
+
<m3e-menu-item-checkbox>Italic</m3e-menu-item-checkbox>
|
|
88
|
+
<m3e-menu-item-checkbox>Underline</m3e-menu-item-checkbox>
|
|
89
|
+
</m3e-menu>
|
|
90
|
+
|
|
91
|
+
<m3e-button>
|
|
92
|
+
<m3e-menu-trigger for="menu6">Menu with checkboxes and icons</m3e-menu-trigger>
|
|
93
|
+
</m3e-button>
|
|
94
|
+
<m3e-menu id="menu6">
|
|
95
|
+
<m3e-menu-item-checkbox><m3e-icon slot="icon" name="format_bold"></m3e-icon>Bold</m3e-menu-item-checkbox>
|
|
96
|
+
<m3e-menu-item-checkbox><m3e-icon slot="icon" name="format_italic"></m3e-icon>Italic</m3e-menu-item-checkbox>
|
|
97
|
+
<m3e-menu-item-checkbox>
|
|
98
|
+
<m3e-icon slot="icon" name="format_underlined"></m3e-icon>
|
|
99
|
+
Underline
|
|
100
|
+
</m3e-menu-item-checkbox>
|
|
101
|
+
</m3e-menu>
|
|
102
|
+
|
|
103
|
+
<m3e-button>
|
|
104
|
+
<m3e-menu-trigger for="menu7">Menu with radios</m3e-menu-trigger>
|
|
105
|
+
</m3e-button>
|
|
106
|
+
<m3e-menu id="menu7">
|
|
107
|
+
<m3e-menu-item-radio>Ascending</m3e-menu-item-radio>
|
|
108
|
+
<m3e-menu-item-radio>Descending</m3e-menu-item-radio>
|
|
109
|
+
</m3e-menu>
|
|
110
|
+
</m3e-theme>
|
|
111
|
+
</body>
|
|
112
|
+
</html>
|