Skip to content

Commit b395012

Browse files
committed
feat(NcActions): add wide prop for full-width menus
Signed-off-by: Christian Hartmann <chris-hartmann@gmx.de>
1 parent fef17a7 commit b395012

2 files changed

Lines changed: 102 additions & 2 deletions

File tree

src/components/NcActions/NcActions.vue

Lines changed: 101 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,86 @@ export default {
545545
</script>
546546
```
547547

548+
### Wide buttons
549+
550+
```vue
551+
<template>
552+
<NcActions menu-name="Object management" wide>
553+
<template #icon>
554+
<IconPencilOutline :size="20" />
555+
</template>
556+
<NcActionButton>
557+
<template #icon>
558+
<IconPencilOutline :size="20" />
559+
</template>
560+
Rename
561+
</NcActionButton>
562+
<NcActionButton>
563+
<template #icon>
564+
<IconTrashCanOutline :size="20" />
565+
</template>
566+
Delete
567+
</NcActionButton>
568+
<NcActionButton>
569+
<template #icon>
570+
<IconArrowRight :size="20" />
571+
</template>
572+
Validate
573+
</NcActionButton>
574+
<NcActionButton>
575+
<template #icon>
576+
<IconTrayArrowDown :size="20" />
577+
</template>
578+
Download
579+
</NcActionButton>
580+
</NcActions>
581+
<NcActions wide>
582+
<template #icon>
583+
<IconPencilOutline :size="20" />
584+
</template>
585+
<NcActionButton>
586+
<template #icon>
587+
<IconPencilOutline :size="20" />
588+
</template>
589+
Rename
590+
</NcActionButton>
591+
<NcActionButton>
592+
<template #icon>
593+
<IconTrashCanOutline :size="20" />
594+
</template>
595+
Delete
596+
</NcActionButton>
597+
<NcActionButton>
598+
<template #icon>
599+
<IconArrowRight :size="20" />
600+
</template>
601+
Validate
602+
</NcActionButton>
603+
<NcActionButton>
604+
<template #icon>
605+
<IconTrayArrowDown :size="20" />
606+
</template>
607+
Download
608+
</NcActionButton>
609+
</NcActions>
610+
</template>
611+
<script>
612+
import IconArrowRight from 'vue-material-design-icons/ArrowRight.vue'
613+
import IconTrashCanOutline from 'vue-material-design-icons/TrashCanOutline.vue'
614+
import IconTrayArrowDown from 'vue-material-design-icons/TrayArrowDown.vue'
615+
import IconPencilOutline from 'vue-material-design-icons/PencilOutline.vue'
616+
617+
export default {
618+
components: {
619+
IconArrowRight,
620+
IconTrashCanOutline,
621+
IconTrayArrowDown,
622+
IconPencilOutline,
623+
},
624+
}
625+
</script>
626+
```
627+
548628
### Use cases
549629

550630
```vue
@@ -1094,6 +1174,14 @@ export default {
10941174
default: null,
10951175
},
10961176
1177+
/**
1178+
* Specifies whether the button should span all the available width.
1179+
*/
1180+
wide: {
1181+
type: Boolean,
1182+
default: false,
1183+
},
1184+
10971185
/**
10981186
* Specify the size used for trigger and single actions buttons.
10991187
*
@@ -1694,13 +1782,19 @@ export default {
16941782
mergeProps(
16951783
propsToForward,
16961784
{
1697-
class: 'action-item action-item--single',
1785+
class: [
1786+
'action-item action-item--single',
1787+
{
1788+
'action-item--wide': this.wide,
1789+
},
1790+
],
16981791
'aria-label': action?.props?.['aria-label'] || text,
16991792
title,
17001793
disabled: this.disabled || action?.props?.disabled,
17011794
pressed: action?.props?.modelValue,
17021795
size: this.size,
17031796
type,
1797+
wide: this.wide,
17041798
// If it has a menuName, we use a secondary button
17051799
variant: this.variant || (buttonText ? 'secondary' : 'tertiary'),
17061800
onFocus: this.onFocus,
@@ -1759,6 +1853,7 @@ export default {
17591853
disabled: this.disabled,
17601854
size: this.size,
17611855
variant: this.triggerButtonVariant,
1856+
wide: this.wide,
17621857
ref: 'triggerButton',
17631858
'aria-label': this.menuName ? null : this.ariaLabel,
17641859
// 'aria-controls' should only present together with a valid aria-haspopup
@@ -1861,6 +1956,7 @@ export default {
18611956
`action-item--${this.triggerButtonVariant}`,
18621957
{
18631958
'action-item--open': this.opened,
1959+
'action-item--wide': this.wide,
18641960
},
18651961
],
18661962
},
@@ -1913,6 +2009,10 @@ export default {
19132009
background-color: var(--open-background-color);
19142010
}
19152011
2012+
&.action-item--wide {
2013+
width: 100%;
2014+
}
2015+
19162016
&__menutoggle__icon {
19172017
width: 20px;
19182018
height: 20px;

src/components/NcButton/NcButton.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ function onClick(event: MouseEvent) {
861861
}
862862
863863
// Icon-only button
864-
&:has(#{&}__text:empty) {
864+
&:has(#{&}__text:empty):not(#{&}--wide) {
865865
--button-padding: var(--button-radius);
866866
line-height: 1;
867867
width: var(--button-size) !important;

0 commit comments

Comments
 (0)