@umbraco-ui/uui-menu-item 1.3.0 → 1.4.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/custom-elements.json +13 -0
- package/lib/index.js +152 -10
- package/lib/uui-menu-item.element.d.ts +7 -0
- package/package.json +5 -5
package/custom-elements.json
CHANGED
|
@@ -41,6 +41,12 @@
|
|
|
41
41
|
"type": "string",
|
|
42
42
|
"default": "\"undefined\""
|
|
43
43
|
},
|
|
44
|
+
{
|
|
45
|
+
"name": "select-mode",
|
|
46
|
+
"description": "Sets the selection mode.",
|
|
47
|
+
"type": "string",
|
|
48
|
+
"default": "\"undefined\""
|
|
49
|
+
},
|
|
44
50
|
{
|
|
45
51
|
"name": "select-only",
|
|
46
52
|
"description": "Enforce selection interaction and prevent all other interactions, set this when the UI is turned into Selection-Mode.",
|
|
@@ -117,6 +123,13 @@
|
|
|
117
123
|
"type": "string",
|
|
118
124
|
"default": "\"undefined\""
|
|
119
125
|
},
|
|
126
|
+
{
|
|
127
|
+
"name": "selectMode",
|
|
128
|
+
"attribute": "select-mode",
|
|
129
|
+
"description": "Sets the selection mode.",
|
|
130
|
+
"type": "string",
|
|
131
|
+
"default": "\"undefined\""
|
|
132
|
+
},
|
|
120
133
|
{
|
|
121
134
|
"name": "selectOnly",
|
|
122
135
|
"attribute": "select-only",
|
package/lib/index.js
CHANGED
|
@@ -118,9 +118,9 @@ let UUIMenuItemElement = class extends SelectOnlyMixin(
|
|
|
118
118
|
UUIMenuItemElement.styles = [
|
|
119
119
|
css`
|
|
120
120
|
:host {
|
|
121
|
+
box-sizing: border-box;
|
|
121
122
|
display: block;
|
|
122
123
|
--uui-menu-item-child-indent: calc(var(--uui-menu-item-indent, 0) + 1);
|
|
123
|
-
|
|
124
124
|
user-select: none;
|
|
125
125
|
}
|
|
126
126
|
|
|
@@ -133,7 +133,8 @@ UUIMenuItemElement.styles = [
|
|
|
133
133
|
white-space: nowrap;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
|
|
136
|
+
/** Not active, not selected, not disabled: */
|
|
137
|
+
:host(:not([active], [selected], [disabled], [select-mode='highlight']))
|
|
137
138
|
#menu-item
|
|
138
139
|
#label-button:hover
|
|
139
140
|
~ #label-button-background,
|
|
@@ -149,6 +150,7 @@ UUIMenuItemElement.styles = [
|
|
|
149
150
|
color: var(--uui-color-interactive-emphasis,#3544b1);
|
|
150
151
|
}
|
|
151
152
|
|
|
153
|
+
/** Active */
|
|
152
154
|
:host([active]) #label-button,
|
|
153
155
|
:host([active]) #caret-button {
|
|
154
156
|
color: var(--uui-color-current-contrast,#1b264f);
|
|
@@ -161,22 +163,127 @@ UUIMenuItemElement.styles = [
|
|
|
161
163
|
background-color: var(--uui-color-current-emphasis,rgb(248, 214, 211));
|
|
162
164
|
}
|
|
163
165
|
|
|
164
|
-
|
|
165
|
-
:host([
|
|
166
|
+
/** Disabled */
|
|
167
|
+
:host([disabled]) #menu-item {
|
|
168
|
+
color: var(--uui-color-disabled-contrast,#c4c4c4);
|
|
169
|
+
background-color: var(--uui-color-disabled,#f3f3f5);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/** Selected */
|
|
173
|
+
:host([selected]:not([select-mode='highlight'], [disabled]))
|
|
174
|
+
#label-button,
|
|
175
|
+
:host([selected]:not([select-mode='highlight'], [disabled]))
|
|
176
|
+
#caret-button {
|
|
166
177
|
color: var(--uui-color-selected-contrast,#fff);
|
|
167
178
|
}
|
|
168
|
-
:host([selected]
|
|
179
|
+
:host([selected]:not([select-mode='highlight'], [disabled]))
|
|
180
|
+
#label-button-background {
|
|
169
181
|
background-color: var(--uui-color-selected,#3544b1);
|
|
170
182
|
}
|
|
171
|
-
|
|
172
|
-
:host([selected]
|
|
183
|
+
/** Selected, not highlight mode */
|
|
184
|
+
:host([selected]:not([select-mode='highlight'], [disabled]))
|
|
185
|
+
#label-button:hover
|
|
186
|
+
~ #label-button-background,
|
|
187
|
+
:host([selected]:not([select-mode='highlight'], [disabled]))
|
|
188
|
+
#caret-button:hover {
|
|
173
189
|
background-color: var(--uui-color-selected-emphasis,rgb(70, 86, 200));
|
|
174
190
|
}
|
|
175
191
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
192
|
+
/** highlight mode, default */
|
|
193
|
+
:host([select-mode='highlight']:not([disabled], [active], [selectable]))
|
|
194
|
+
#menu-item
|
|
195
|
+
#label-button:hover
|
|
196
|
+
~ #label-button-background {
|
|
197
|
+
border-radius: var(--uui-border-radius,3px);
|
|
198
|
+
background-color: var(--uui-color-surface-emphasis,rgb(250, 250, 250));
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/** highlight mode, active */
|
|
202
|
+
:host([select-mode='highlight'][active]:not([disabled]))
|
|
203
|
+
#menu-item
|
|
204
|
+
#label-button-background {
|
|
205
|
+
border-radius: var(--uui-border-radius,3px);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/** highlight mode, active & selected */
|
|
209
|
+
:host([select-mode='highlight'][active][selected]:not([disabled]))
|
|
210
|
+
#menu-item
|
|
211
|
+
#label-button:hover
|
|
212
|
+
~ #label-button-background {
|
|
213
|
+
border-radius: var(--uui-border-radius,3px);
|
|
214
|
+
background-color: var(--uui-color-current-emphasis,rgb(248, 214, 211));
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** highlight mode, selected */
|
|
218
|
+
:host([select-mode='highlight'][selected]:not([disabled]))
|
|
219
|
+
#menu-item
|
|
220
|
+
#label-button,
|
|
221
|
+
:host([select-mode='highlight'][selected]:not([disabled]))
|
|
222
|
+
#menu-item
|
|
223
|
+
#caret-button {
|
|
224
|
+
color: var(--uui-color-interactive,#1b264f);
|
|
225
|
+
}
|
|
226
|
+
:host([select-mode='highlight'][selectable][selected]:not([disabled]))
|
|
227
|
+
#menu-item
|
|
228
|
+
#label-button:hover {
|
|
229
|
+
color: var(--uui-color-interactive-emphasis,#3544b1);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/** highlight mode, selected, selectable caret hover */
|
|
233
|
+
:host([selected][selectable][select-mode='highlight']:not([active]))
|
|
234
|
+
#menu-item
|
|
235
|
+
#caret-button:hover {
|
|
236
|
+
border-radius: var(--uui-border-radius,3px);
|
|
237
|
+
background-color: var(--uui-color-surface-emphasis,rgb(250, 250, 250));
|
|
238
|
+
color: var(--uui-color-interactive-emphasis,#3544b1);
|
|
179
239
|
}
|
|
240
|
+
|
|
241
|
+
/** Highlight borders */
|
|
242
|
+
|
|
243
|
+
:host([select-mode='highlight']:not([disabled]))
|
|
244
|
+
#menu-item
|
|
245
|
+
#label-button-background::after {
|
|
246
|
+
border-radius: var(--uui-border-radius,3px);
|
|
247
|
+
position: absolute;
|
|
248
|
+
content: '';
|
|
249
|
+
inset: 1px;
|
|
250
|
+
border: 2px solid var(--uui-color-selected,#3544b1);
|
|
251
|
+
opacity: 0;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
:host([select-mode='highlight'][selectable][selected]:not([disabled]))
|
|
255
|
+
#menu-item
|
|
256
|
+
#caret-button:hover::after {
|
|
257
|
+
border-top-left-radius: var(--uui-border-radius,3px);
|
|
258
|
+
border-bottom-left-radius: var(--uui-border-radius,3px);
|
|
259
|
+
position: absolute;
|
|
260
|
+
content: '';
|
|
261
|
+
inset: 1px 0 1px 1px;
|
|
262
|
+
border: 2px solid var(--uui-color-selected,#3544b1);
|
|
263
|
+
border-right: none;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
:host([select-mode='highlight'][selected]:not([disabled]))
|
|
267
|
+
#menu-item
|
|
268
|
+
#label-button-background::after {
|
|
269
|
+
opacity: 1;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
:host([select-mode='highlight'][selectable]:not([disabled]))
|
|
273
|
+
#menu-item
|
|
274
|
+
#label-button:hover
|
|
275
|
+
~ #label-button-background::after {
|
|
276
|
+
opacity: 0.33;
|
|
277
|
+
}
|
|
278
|
+
:host([select-mode='highlight'][selected]:not([disabled]))
|
|
279
|
+
#menu-item
|
|
280
|
+
#label-button:hover
|
|
281
|
+
~ #label-button-background::after {
|
|
282
|
+
opacity: 0.66;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/** Buttons */
|
|
286
|
+
|
|
180
287
|
:host([disabled]) #label-button {
|
|
181
288
|
cursor: default;
|
|
182
289
|
}
|
|
@@ -199,6 +306,7 @@ UUIMenuItemElement.styles = [
|
|
|
199
306
|
}
|
|
200
307
|
|
|
201
308
|
#label-button {
|
|
309
|
+
position: relative;
|
|
202
310
|
flex-grow: 1;
|
|
203
311
|
grid-column-start: 2;
|
|
204
312
|
white-space: nowrap;
|
|
@@ -226,6 +334,7 @@ UUIMenuItemElement.styles = [
|
|
|
226
334
|
}
|
|
227
335
|
|
|
228
336
|
#caret-button {
|
|
337
|
+
position: relative;
|
|
229
338
|
width: 100%;
|
|
230
339
|
height: 100%;
|
|
231
340
|
display: flex;
|
|
@@ -273,6 +382,36 @@ UUIMenuItemElement.styles = [
|
|
|
273
382
|
margin-left: 6px;
|
|
274
383
|
}
|
|
275
384
|
|
|
385
|
+
/** Focus styling */
|
|
386
|
+
|
|
387
|
+
:host([select-mode='highlight']) #label-button:focus-visible {
|
|
388
|
+
outline: none;
|
|
389
|
+
overflow: initial;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
:host([select-mode='highlight']) #label-button:focus-visible::after {
|
|
393
|
+
content: '';
|
|
394
|
+
border-radius: calc(var(--uui-border-radius,3px) - 1px);
|
|
395
|
+
position: absolute;
|
|
396
|
+
inset: 3px 3px 3px -5px;
|
|
397
|
+
border: 2px solid var(--uui-color-focus,#3879ff);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
:host([select-mode='highlight']) #caret-button:focus-visible {
|
|
401
|
+
outline: none;
|
|
402
|
+
overflow: initial;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
:host([select-mode='highlight']) #caret-button:focus-visible::after {
|
|
406
|
+
content: '';
|
|
407
|
+
position: absolute;
|
|
408
|
+
inset: 3px;
|
|
409
|
+
border-radius: calc(var(--uui-border-radius,3px) - 1px);
|
|
410
|
+
border: 2px solid var(--uui-color-focus,#3879ff);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/** Slots */
|
|
414
|
+
|
|
276
415
|
slot:not([name]) {
|
|
277
416
|
position: relative;
|
|
278
417
|
display: block;
|
|
@@ -308,6 +447,9 @@ __decorateClass([
|
|
|
308
447
|
__decorateClass([
|
|
309
448
|
property({ type: String })
|
|
310
449
|
], UUIMenuItemElement.prototype, "target", 2);
|
|
450
|
+
__decorateClass([
|
|
451
|
+
property({ type: String, attribute: "select-mode", reflect: true })
|
|
452
|
+
], UUIMenuItemElement.prototype, "selectMode", 2);
|
|
311
453
|
__decorateClass([
|
|
312
454
|
state()
|
|
313
455
|
], UUIMenuItemElement.prototype, "iconSlotHasContent", 2);
|
|
@@ -55,6 +55,13 @@ export declare class UUIMenuItemElement extends UUIMenuItemElement_base {
|
|
|
55
55
|
* @default undefined
|
|
56
56
|
*/
|
|
57
57
|
target?: '_blank' | '_parent' | '_self' | '_top';
|
|
58
|
+
/**
|
|
59
|
+
* Sets the selection mode.
|
|
60
|
+
* @type {string}
|
|
61
|
+
* @attr
|
|
62
|
+
* @default undefined
|
|
63
|
+
*/
|
|
64
|
+
selectMode?: 'highlight' | 'persisting';
|
|
58
65
|
private iconSlotHasContent;
|
|
59
66
|
connectedCallback(): void;
|
|
60
67
|
private _labelButtonChanged;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umbraco-ui/uui-menu-item",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0-rc.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Umbraco",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"custom-elements.json"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@umbraco-ui/uui-base": "1.
|
|
34
|
-
"@umbraco-ui/uui-loader-bar": "1.
|
|
35
|
-
"@umbraco-ui/uui-symbol-expand": "1.
|
|
33
|
+
"@umbraco-ui/uui-base": "1.4.0-rc.1",
|
|
34
|
+
"@umbraco-ui/uui-loader-bar": "1.4.0-rc.1",
|
|
35
|
+
"@umbraco-ui/uui-symbol-expand": "1.4.0-rc.1"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "npm run analyze && tsc --build --force && rollup -c rollup.config.js",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
45
|
"homepage": "https://uui.umbraco.com/?path=/story/uui-menu-item",
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "2ecc805ac912c25d89bc96eaf7f50b97aa85fff0"
|
|
47
47
|
}
|