@umbraco-ui/uui-menu-item 0.0.6 → 0.2.0
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 +4 -0
- package/custom-elements.json +19 -5
- package/lib/index.js +28 -9
- package/lib/uui-menu-item.element.d.ts +3 -4
- package/package.json +5 -3
package/README.md
CHANGED
package/custom-elements.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"attributes": [
|
|
8
8
|
{
|
|
9
9
|
"name": "disabled",
|
|
10
|
-
"description": "Disables the menu item, changes the looks of it and prevents
|
|
10
|
+
"description": "Disables the menu item, changes the looks of it and prevents it from emitting the click event",
|
|
11
11
|
"type": "boolean",
|
|
12
12
|
"default": "\"false\""
|
|
13
13
|
},
|
|
@@ -59,12 +59,13 @@
|
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
"name": "active",
|
|
62
|
+
"description": "Set this boolean to true for then the related composition is sorted.",
|
|
62
63
|
"type": "boolean",
|
|
63
64
|
"default": "false"
|
|
64
65
|
},
|
|
65
66
|
{
|
|
66
67
|
"name": "label",
|
|
67
|
-
"description": "
|
|
68
|
+
"description": "Label to be used for aria-label and eventually as visual label",
|
|
68
69
|
"type": "string"
|
|
69
70
|
}
|
|
70
71
|
],
|
|
@@ -77,7 +78,7 @@
|
|
|
77
78
|
{
|
|
78
79
|
"name": "disabled",
|
|
79
80
|
"attribute": "disabled",
|
|
80
|
-
"description": "Disables the menu item, changes the looks of it and prevents
|
|
81
|
+
"description": "Disables the menu item, changes the looks of it and prevents it from emitting the click event",
|
|
81
82
|
"type": "boolean",
|
|
82
83
|
"default": "\"false\""
|
|
83
84
|
},
|
|
@@ -138,13 +139,14 @@
|
|
|
138
139
|
{
|
|
139
140
|
"name": "active",
|
|
140
141
|
"attribute": "active",
|
|
142
|
+
"description": "Set this boolean to true for then the related composition is sorted.",
|
|
141
143
|
"type": "boolean",
|
|
142
144
|
"default": "false"
|
|
143
145
|
},
|
|
144
146
|
{
|
|
145
147
|
"name": "label",
|
|
146
148
|
"attribute": "label",
|
|
147
|
-
"description": "
|
|
149
|
+
"description": "Label to be used for aria-label and eventually as visual label",
|
|
148
150
|
"type": "string"
|
|
149
151
|
}
|
|
150
152
|
],
|
|
@@ -160,12 +162,20 @@
|
|
|
160
162
|
{
|
|
161
163
|
"name": "click-label",
|
|
162
164
|
"description": "fires when the label is clicked"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"name": "selected",
|
|
168
|
+
"description": "fires when the media card is selected"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"name": "unselected",
|
|
172
|
+
"description": "fires when the media card is unselected"
|
|
163
173
|
}
|
|
164
174
|
],
|
|
165
175
|
"slots": [
|
|
166
176
|
{
|
|
167
177
|
"name": "",
|
|
168
|
-
"description": "
|
|
178
|
+
"description": "nested menu items go here"
|
|
169
179
|
},
|
|
170
180
|
{
|
|
171
181
|
"name": "icon",
|
|
@@ -174,6 +184,10 @@
|
|
|
174
184
|
{
|
|
175
185
|
"name": "actions",
|
|
176
186
|
"description": "actions area"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"name": "label",
|
|
190
|
+
"description": "area to place the label"
|
|
177
191
|
}
|
|
178
192
|
],
|
|
179
193
|
"cssProperties": [
|
package/lib/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SelectOnlyMixin, SelectableMixin, ActiveMixin, LabelMixin } from '@umbraco-ui/uui-base/lib/mixins';
|
|
2
2
|
import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
|
|
3
|
+
import { demandCustomElement } from '@umbraco-ui/uui-base/lib/utils';
|
|
4
|
+
import { LitElement, html, css } from 'lit';
|
|
3
5
|
import { property, state } from 'lit/decorators.js';
|
|
4
6
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
|
-
import { SelectOnlyMixin, SelectableMixin, ActiveMixin, LabelMixin } from '@umbraco-ui/uui-base/lib/mixins';
|
|
6
7
|
import { UUIEvent } from '@umbraco-ui/uui-base/lib/events';
|
|
7
8
|
|
|
8
9
|
class UUIMenuItemEvent extends UUIEvent {
|
|
@@ -35,6 +36,8 @@ let UUIMenuItemElement = class extends SelectOnlyMixin(SelectableMixin(ActiveMix
|
|
|
35
36
|
super.connectedCallback();
|
|
36
37
|
if (!this.hasAttribute("role"))
|
|
37
38
|
this.setAttribute("role", "menu");
|
|
39
|
+
demandCustomElement(this, "uui-symbol-expand");
|
|
40
|
+
demandCustomElement(this, "uui-loader-bar");
|
|
38
41
|
}
|
|
39
42
|
iconSlotChanged(e) {
|
|
40
43
|
this.iconSlotHasContent = e.target.assignedNodes({ flatten: true }).length > 0;
|
|
@@ -55,7 +58,8 @@ let UUIMenuItemElement = class extends SelectOnlyMixin(SelectableMixin(ActiveMix
|
|
|
55
58
|
id="icon"
|
|
56
59
|
style=${this.iconSlotHasContent ? "" : "display: none;"}
|
|
57
60
|
@slotchange=${this.iconSlotChanged}></slot>
|
|
58
|
-
${this.renderLabel()}
|
|
61
|
+
${this.renderLabel()}
|
|
62
|
+
<slot name="badge" id="badge"> </slot>`;
|
|
59
63
|
}
|
|
60
64
|
_renderLabelAsAnchor() {
|
|
61
65
|
if (this.disabled) {
|
|
@@ -65,7 +69,7 @@ let UUIMenuItemElement = class extends SelectOnlyMixin(SelectableMixin(ActiveMix
|
|
|
65
69
|
}
|
|
66
70
|
return html` <a
|
|
67
71
|
id="label-button"
|
|
68
|
-
href=${this.href}
|
|
72
|
+
href=${ifDefined(this.href)}
|
|
69
73
|
target=${ifDefined(this.target || void 0)}
|
|
70
74
|
rel=${ifDefined(this.target === "_blank" ? "noopener" : void 0)}
|
|
71
75
|
@click=${this.onLabelClicked}
|
|
@@ -103,8 +107,6 @@ UUIMenuItemElement.styles = [
|
|
|
103
107
|
css`
|
|
104
108
|
:host {
|
|
105
109
|
display: block;
|
|
106
|
-
background-color: var(--uui-interface-surface,#fefefe);
|
|
107
|
-
/** consider transparent. */
|
|
108
110
|
--uui-menu-item-child-indent: calc(var(--uui-menu-item-indent, 0) + 1);
|
|
109
111
|
|
|
110
112
|
user-select: none;
|
|
@@ -112,8 +114,7 @@ UUIMenuItemElement.styles = [
|
|
|
112
114
|
|
|
113
115
|
#menu-item {
|
|
114
116
|
position: relative;
|
|
115
|
-
|
|
116
|
-
align-items: stretch;
|
|
117
|
+
|
|
117
118
|
padding-left: calc(var(--uui-menu-item-indent, 0) * var(--uui-size-4,12px));
|
|
118
119
|
|
|
119
120
|
display: grid;
|
|
@@ -147,7 +148,6 @@ UUIMenuItemElement.styles = [
|
|
|
147
148
|
grid-column-start: 2;
|
|
148
149
|
white-space: nowrap;
|
|
149
150
|
overflow: hidden;
|
|
150
|
-
text-overflow: ellipsis;
|
|
151
151
|
|
|
152
152
|
display: inline-flex;
|
|
153
153
|
align-items: center;
|
|
@@ -156,6 +156,12 @@ UUIMenuItemElement.styles = [
|
|
|
156
156
|
min-height: var(--uui-size-12,36px);
|
|
157
157
|
z-index: 1;
|
|
158
158
|
}
|
|
159
|
+
|
|
160
|
+
#label-button .label {
|
|
161
|
+
white-space: nowrap;
|
|
162
|
+
overflow: hidden;
|
|
163
|
+
text-overflow: ellipsis;
|
|
164
|
+
}
|
|
159
165
|
span#label-button {
|
|
160
166
|
pointer-events: none; /* avoid hovering state on this. */
|
|
161
167
|
}
|
|
@@ -189,6 +195,11 @@ UUIMenuItemElement.styles = [
|
|
|
189
195
|
transition: opacity 120ms;
|
|
190
196
|
grid-column-start: 3;
|
|
191
197
|
}
|
|
198
|
+
:host(:not([disabled])) #menu-item:hover #actions-container,
|
|
199
|
+
:host(:not([disabled])) #menu-item:focus #actions-container,
|
|
200
|
+
:host(:not([disabled])) #menu-item:focus-within #actions-container {
|
|
201
|
+
opacity: 1;
|
|
202
|
+
}
|
|
192
203
|
|
|
193
204
|
#loader {
|
|
194
205
|
position: absolute;
|
|
@@ -202,6 +213,14 @@ UUIMenuItemElement.styles = [
|
|
|
202
213
|
margin-right: var(--uui-size-2,6px);
|
|
203
214
|
}
|
|
204
215
|
|
|
216
|
+
#badge {
|
|
217
|
+
font-size: 12px;
|
|
218
|
+
--uui-badge-position: relative;
|
|
219
|
+
--uui-badge-position: auto;
|
|
220
|
+
display: block;
|
|
221
|
+
margin-left: 6px;
|
|
222
|
+
}
|
|
223
|
+
|
|
205
224
|
:host([disabled]) {
|
|
206
225
|
color: var(--uui-interface-surface-contrast-disabled);
|
|
207
226
|
}
|
|
@@ -3,19 +3,18 @@ declare const UUIMenuItemElement_base: (new (...args: any[]) => import("@umbraco
|
|
|
3
3
|
/**
|
|
4
4
|
* @element uui-menu-item
|
|
5
5
|
* @cssprop --uui-menu-item-indent - set indentation of the menu items
|
|
6
|
-
* @property label - This functions both as the visible label as well as the aria label.
|
|
7
6
|
* @fires {UUIMenuItemEvent} show-children - fires when the expand icon is clicked to show nested menu items
|
|
8
7
|
* @fires {UUIMenuItemEvent} hide-children - fires when the expend icon is clicked to hide nested menu items
|
|
9
8
|
* @fires {UUIMenuItemEvent} click-label - fires when the label is clicked
|
|
10
|
-
* @slot
|
|
9
|
+
* @slot - nested menu items go here
|
|
11
10
|
* @slot icon - icon area
|
|
12
11
|
* @slot actions - actions area
|
|
13
|
-
*
|
|
12
|
+
* @slot label - area to place the label
|
|
14
13
|
*/
|
|
15
14
|
export declare class UUIMenuItemElement extends UUIMenuItemElement_base {
|
|
16
15
|
static styles: import("lit").CSSResult[];
|
|
17
16
|
/**
|
|
18
|
-
* Disables the menu item, changes the looks of it and prevents
|
|
17
|
+
* Disables the menu item, changes the looks of it and prevents it from emitting the click event
|
|
19
18
|
* @type {boolean}
|
|
20
19
|
* @attr
|
|
21
20
|
* @default false
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umbraco-ui/uui-menu-item",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Umbraco",
|
|
@@ -30,7 +30,9 @@
|
|
|
30
30
|
"custom-elements.json"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@umbraco-ui/uui-base": "0.0
|
|
33
|
+
"@umbraco-ui/uui-base": "0.2.0",
|
|
34
|
+
"@umbraco-ui/uui-loader-bar": "0.2.0",
|
|
35
|
+
"@umbraco-ui/uui-symbol-expand": "0.2.0"
|
|
34
36
|
},
|
|
35
37
|
"scripts": {
|
|
36
38
|
"build": "npm run analyze && tsc --build --force && rollup -c rollup.config.js",
|
|
@@ -41,5 +43,5 @@
|
|
|
41
43
|
"access": "public"
|
|
42
44
|
},
|
|
43
45
|
"homepage": "https://uui.umbraco.com/?path=/story/uui-menu-item",
|
|
44
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "5494b55e03c9fb3ba8f160e693d3ce59c02d21cd"
|
|
45
47
|
}
|