@@ -17,6 +17,15 @@ import { UUIMenuItemEvent } from './UUIMenuItemEvent';
17
17
* @element uui-menu-item
18
18
* @cssprop --uui-menu-item-indent - set indentation of the menu items
19
19
* @cssprop --uui-menu-item-flat-structure - set to 1 to remove the indentation of the chevron. Use this when you have a flat menu structure
20
+ * @cssprop --uui-menu-item-background-color-hover - background color when hovering
21
+ * @cssprop --uui-menu-item-color-hover - text color when hovering
22
+ * @cssprop --uui-menu-item-background-color-active - background color when active
23
+ * @cssprop --uui-menu-item-color-active - text color when active
24
+ * @cssprop --uui-menu-item-background-color-disabled - background color when disabled
25
+ * @cssprop --uui-menu-item-color-disabled - text color when disabled
26
+ * @cssprop --uui-menu-item-background-color-selected - background color when selected
27
+ * @cssprop --uui-menu-item-color-selected - text color when selected
28
+ * @cssprop --uui-menu-item-color-background-selected-hover - text color when selected
20
29
* @fires {UUIMenuItemEvent } show-children - fires when the expand icon is clicked to show nested menu items
21
30
* @fires {UUIMenuItemEvent } hide-children - fires when the expend icon is clicked to hide nested menu items
22
31
* @fires {UUIMenuItemEvent } click-label - fires when the label is clicked
@@ -225,52 +234,82 @@ export class UUIMenuItemElement extends SelectOnlyMixin(
225
234
: host (: not ([active ], [selected ], [disabled ]))
226
235
# menu-item
227
236
# caret-button : hover {
228
- background-color : var (--uui-color-surface-emphasis );
237
+ background-color : var (
238
+ --uui-menu-item-background-color-hover ,
239
+ var (--uui-color-surface-emphasis )
240
+ );
229
241
}
230
242
: host (: not ([active ], [selected ], [disabled ]))
231
243
# menu-item
232
244
# label-button : hover ,
233
245
: host (: not ([active ], [selected ])) # menu-item # caret-button : hover {
234
- color : var (--uui-color-interactive-emphasis );
246
+ color : var (
247
+ --uui-menu-item-color-hover ,
248
+ var (--uui-color-interactive-emphasis )
249
+ );
235
250
}
236
251
237
252
/** Active */
238
253
: host ([active ]) # label-button ,
239
254
: host ([active ]) # caret-button {
240
- color : var (--uui-color-current-contrast );
255
+ color : var (
256
+ --uui-menu-item-color-active ,
257
+ var (--uui-color-current-contrast )
258
+ );
241
259
}
242
260
: host ([active ]) # label-button-background {
243
- background-color : var (--uui-color-current );
261
+ background-color : var (
262
+ --uui-menu-item-background-color-active ,
263
+ var (--uui-color-current )
264
+ );
244
265
}
245
266
: host ([active ]) # label-button : hover ~ # label-button-background ,
246
267
: host ([active ]) # caret-button : hover {
247
- background-color : var (--uui-color-current-emphasis );
268
+ background-color : var (
269
+ --uui-menu-item-background-color-active-hover ,
270
+ var (--uui-color-current-emphasis )
271
+ );
248
272
}
249
273
250
274
/** Disabled */
251
275
: host ([disabled ]) # menu-item {
252
- color : var (--uui-color-disabled-contrast );
253
- background-color : var (--uui-color-disabled );
276
+ color : var (
277
+ --uui-menu-item-color-disabled ,
278
+ var (--uui-color-disabled-contrast )
279
+ );
280
+ background-color : var (
281
+ --uui-menu-item-background-color-disabled ,
282
+ var (--uui-color-disabled )
283
+ );
254
284
}
255
285
256
286
/** Selected */
257
287
: host ([selected ]: not ([select-mode = 'highlight' ], [disabled ]))
258
288
# label-button ,
259
289
: host ([selected ]: not ([select-mode = 'highlight' ], [disabled ]))
260
290
# caret-button {
261
- color : var (--uui-color-selected-contrast );
291
+ color : var (
292
+ --uui-menu-item-color-selected ,
293
+ var (--uui-color-selected-contrast )
294
+ );
262
295
}
263
296
: host ([selected ]: not ([select-mode = 'highlight' ], [disabled ]))
264
297
# label-button-background {
265
- background-color : var (--uui-color-selected );
298
+ background-color : var (
299
+ --uui-menu-item-background-color-selected ,
300
+ var (--uui-color-selected )
301
+ );
266
302
}
267
303
/** Selected, not highlight mode */
268
304
: host ([selected ]: not ([select-mode = 'highlight' ], [disabled ]))
269
305
# label-button : hover
270
306
~ # label-button-background ,
271
307
: host ([selected ]: not ([select-mode = 'highlight' ], [disabled ]))
272
308
# caret-button : hover {
273
- background-color : var (--uui-color-selected-emphasis );
309
+ background-color : var (
310
+ --uui-menu-item-background-color-selected-hover ,
311
+ var (--uui-color-selected-emphasis )
312
+ );
274
313
}
275
314
276
315
/** highlight mode, default */
@@ -279,7 +318,10 @@ export class UUIMenuItemElement extends SelectOnlyMixin(
279
318
# label-button : hover
280
319
~ # label-button-background {
281
320
border-radius : var (--uui-border-radius );
282
- background-color : var (--uui-color-surface-emphasis );
321
+ background-color : var (
322
+ --uui-menu-item-background-color-highlight ,
323
+ var (--uui-color-surface-emphasis )
324
+ );
283
325
}
284
326
285
327
/** highlight mode, active */
@@ -295,7 +337,10 @@ export class UUIMenuItemElement extends SelectOnlyMixin(
295
337
# label-button : hover
296
338
~ # label-button-background {
297
339
border-radius : var (--uui-border-radius );
298
- background-color : var (--uui-color-current-emphasis );
340
+ background-color : var (
341
+ --uui-menu-item-background-color-highlight-active-selected ,
342
+ var (--uui-color-current-emphasis )
343
+ );
299
344
}
300
345
301
346
/** highlight mode, selected */
@@ -305,21 +350,33 @@ export class UUIMenuItemElement extends SelectOnlyMixin(
305
350
: host ([select-mode = 'highlight' ][selected ]: not ([disabled ]))
306
351
# menu-item
307
352
# caret-button {
308
- color : var (--uui-color-interactive );
353
+ color : var (
354
+ --uui-menu-item-color-highlight-selected ,
355
+ var (--uui-color-interactive )
356
+ );
309
357
}
310
358
: host ([select-mode = 'highlight' ][selectable ][selected ]: not ([disabled ]))
311
359
# menu-item
312
360
# label-button : hover {
313
- color : var (--uui-color-interactive-emphasis );
361
+ color : var (
362
+ --uui-menu-item-background-color-highlight-selectable-selected ,
363
+ var (--uui-color-interactive-emphasis )
364
+ );
314
365
}
315
366
316
367
/** highlight mode, selected, selectable caret hover */
317
368
: host ([selected ][selectable ][select-mode = 'highlight' ]: not ([active ]))
318
369
# menu-item
319
370
# caret-button : hover {
320
371
border-radius : var (--uui-border-radius );
321
- background-color : var (--uui-color-surface-emphasis );
322
- color : var (--uui-color-interactive-emphasis );
372
+ background-color : var (
373
+ --uui-menu-item-background-color-highlight-selectable-selected ,
374
+ var (--uui-color-surface-emphasis )
375
+ );
376
+ color : var (
377
+ --uui-menu-item-color-highlight-selectable-selected ,
378
+ var (--uui-color-interactive-emphasis )
379
+ );
323
380
}
324
381
325
382
/** Highlight borders */
@@ -331,7 +388,8 @@ export class UUIMenuItemElement extends SelectOnlyMixin(
331
388
position : absolute;
332
389
content : '' ;
333
390
inset : 1px ;
334
- border : 2px solid var (--uui-color-selected );
391
+ border : 2px solid
392
+ var (--uui-menu-item-border-color-highlight , var (--uui-color-selected ));
335
393
opacity : 0 ;
336
394
}
337
395
@@ -343,7 +401,8 @@ export class UUIMenuItemElement extends SelectOnlyMixin(
343
401
position : absolute;
344
402
content : '' ;
345
403
inset : 1px 0 1px 1px ;
346
- border : 2px solid var (--uui-color-selected );
404
+ border : 2px solid
405
+ var (--uui-menu-item-border-color-highlight , var (--uui-color-selected ));
347
406
border-right : none;
348
407
}
349
408
0 commit comments