File tree Expand file tree Collapse file tree 2 files changed +42
-6
lines changed Expand file tree Collapse file tree 2 files changed +42
-6
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import { UUIMenuItemEvent } from './UUIMenuItemEvent';
16
16
/**
17
17
* @element uui-menu-item
18
18
* @cssprop --uui-menu-item-indent - set indentation of the menu items
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
19
20
* @fires {UUIMenuItemEvent } show-children - fires when the expand icon is clicked to show nested menu items
20
21
* @fires {UUIMenuItemEvent } hide-children - fires when the expend icon is clicked to hide nested menu items
21
22
* @fires {UUIMenuItemEvent } click-label - fires when the label is clicked
@@ -200,13 +201,18 @@ export class UUIMenuItemElement extends SelectOnlyMixin(
200
201
display : block;
201
202
--uui-menu-item-child-indent : calc (var (--uui-menu-item-indent , 0 ) + 1 );
202
203
user-select : none;
204
+ --flat-structure-reversed : calc (
205
+ 1 - var (--uui-menu-item-flat-structure , 0 )
206
+ );
203
207
}
204
208
205
209
# menu-item {
206
210
position : relative;
207
211
padding-left : calc (var (--uui-menu-item-indent , 0 ) * var (--uui-size-4 ));
208
212
display : grid;
209
- grid-template-columns : var (--uui-size-8 ) 1fr ;
213
+ grid-template-columns :
214
+ calc (var (--flat-structure-reversed ) * var (--uui-size-8 ))
215
+ 1fr ;
210
216
grid-template-rows : 1fr ;
211
217
white-space : nowrap;
212
218
}
@@ -389,7 +395,10 @@ export class UUIMenuItemElement extends SelectOnlyMixin(
389
395
grid-column-start : 2 ;
390
396
white-space : nowrap;
391
397
overflow : hidden;
392
-
398
+ padding-right : var (--uui-size-space-3 );
399
+ padding-left : calc (
400
+ var (--uui-menu-item-flat-structure ) * var (--uui-size-space-3 )
401
+ );
393
402
display : inline-flex;
394
403
align-items : center;
395
404
text-decoration : none;
@@ -407,10 +416,6 @@ export class UUIMenuItemElement extends SelectOnlyMixin(
407
416
pointer-events : none; /* avoid hovering state on this. */
408
417
}
409
418
410
- # caret-button + # label-button {
411
- padding-left : 0 ;
412
- }
413
-
414
419
# caret-button {
415
420
position : relative;
416
421
width : 100% ;
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ export default {
32
32
} ,
33
33
argTypes : {
34
34
'--uui-menu-item-indent' : { control : { type : 'text' } } ,
35
+ '--uui-menu-item-flat-structure' : { control : { type : 'text' } } ,
35
36
selectMode : {
36
37
control : {
37
38
type : 'select' ,
@@ -397,6 +398,36 @@ ItemIndentation.parameters = {
397
398
} ,
398
399
} ;
399
400
401
+ export const FlatStructure : Story = ( props : any ) => html `
402
+ < uui-icon-registry-essential >
403
+ < uui-menu-item
404
+ style ="--uui-menu-item-flat-structure: 1 "
405
+ label =${ props . label }
406
+ ?loading =${ props . loading }
407
+ ?disabled=${ props . disabled }
408
+ ?has-children=${ props . hasChildren }
409
+ ?show-children=${ props . showChildren }
410
+ ?selected=${ props . selected }
411
+ ?active=${ props . active }
412
+ ?selectable=${ props . selectable }
413
+ href=${ props . href }
414
+ target=${ props . target } >
415
+ </ uui-menu-item >
416
+ </ uui-icon-registry-essential >
417
+ ` ;
418
+ FlatStructure . parameters = {
419
+ docs : {
420
+ source : {
421
+ code : html `
422
+ < uui-menu-item
423
+ style ="--uui-menu-item-flat-structure: 1 "
424
+ label ="Menu Item 1 ">
425
+ </ uui-menu-item >
426
+ ` . strings ,
427
+ } ,
428
+ } ,
429
+ } ;
430
+
400
431
export const SelectMode = ( props : any ) =>
401
432
html `< uui-menu-item
402
433
label ="Parent "
You can’t perform that action at this time.
0 commit comments