Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 101 additions & 1 deletion src/components/NcActions/NcActions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,86 @@
</script>
```

### Wide buttons

```vue
<template>
<NcActions menu-name="Object management" wide>
<template #icon>
<IconPencilOutline :size="20" />
</template>
<NcActionButton>
<template #icon>
<IconPencilOutline :size="20" />
</template>
Rename
</NcActionButton>
<NcActionButton>
<template #icon>
<IconTrashCanOutline :size="20" />
</template>
Delete
</NcActionButton>
<NcActionButton>
<template #icon>
<IconArrowRight :size="20" />
</template>
Validate
</NcActionButton>
<NcActionButton>
<template #icon>
<IconTrayArrowDown :size="20" />
</template>
Download
</NcActionButton>
</NcActions>
<NcActions wide>
<template #icon>
<IconPencilOutline :size="20" />
</template>
<NcActionButton>
<template #icon>
<IconPencilOutline :size="20" />
</template>
Rename
</NcActionButton>
<NcActionButton>
<template #icon>
<IconTrashCanOutline :size="20" />
</template>
Delete
</NcActionButton>
<NcActionButton>
<template #icon>
<IconArrowRight :size="20" />
</template>
Validate
</NcActionButton>
<NcActionButton>
<template #icon>
<IconTrayArrowDown :size="20" />
</template>
Download
</NcActionButton>
</NcActions>
</template>
<script>
import IconArrowRight from 'vue-material-design-icons/ArrowRight.vue'
import IconTrashCanOutline from 'vue-material-design-icons/TrashCanOutline.vue'
import IconTrayArrowDown from 'vue-material-design-icons/TrayArrowDown.vue'
import IconPencilOutline from 'vue-material-design-icons/PencilOutline.vue'

export default {
components: {
IconArrowRight,
IconTrashCanOutline,
IconTrayArrowDown,
IconPencilOutline,
},
}
</script>
```

### Use cases

```vue
Expand Down Expand Up @@ -1094,6 +1174,14 @@
default: null,
},

/**
* Specifies whether the button should span all the available width.
*/
wide: {
type: Boolean,
default: false,
},

/**
* Specify the size used for trigger and single actions buttons.
*
Expand Down Expand Up @@ -1665,7 +1753,7 @@
* Render the provided action
*
* @param {import('vue').VNode} action the action to render
* @return {Function} the vue render function

Check warning on line 1756 in src/components/NcActions/NcActions.vue

View workflow job for this annotation

GitHub Actions / eslint

Prefer a more specific type to `Function`
*/
const renderInlineAction = (action) => {
const iconProp = action?.props?.icon
Expand Down Expand Up @@ -1694,13 +1782,19 @@
mergeProps(
propsToForward,
{
class: 'action-item action-item--single',
class: [
'action-item action-item--single',
{
'action-item--wide': this.wide,
},
],
'aria-label': action?.props?.['aria-label'] || text,
title,
disabled: this.disabled || action?.props?.disabled,
pressed: action?.props?.modelValue,
size: this.size,
type,
wide: this.wide,
// If it has a menuName, we use a secondary button
variant: this.variant || (buttonText ? 'secondary' : 'tertiary'),
onFocus: this.onFocus,
Expand All @@ -1720,7 +1814,7 @@
* Render the actions popover
*
* @param {Array} actions the actions to render within
* @return {Function} the vue render function

Check warning on line 1817 in src/components/NcActions/NcActions.vue

View workflow job for this annotation

GitHub Actions / eslint

Prefer a more specific type to `Function`
*/
const renderActionsPopover = (actions) => {
const triggerIcon = isSlotPopulated(this.$slots.icon?.())
Expand Down Expand Up @@ -1759,6 +1853,7 @@
disabled: this.disabled,
size: this.size,
variant: this.triggerButtonVariant,
wide: this.wide,
ref: 'triggerButton',
'aria-label': this.menuName ? null : this.ariaLabel,
// 'aria-controls' should only present together with a valid aria-haspopup
Expand Down Expand Up @@ -1861,6 +1956,7 @@
`action-item--${this.triggerButtonVariant}`,
{
'action-item--open': this.opened,
'action-item--wide': this.wide,
},
],
},
Expand Down Expand Up @@ -1913,6 +2009,10 @@
background-color: var(--open-background-color);
}

&.action-item--wide {
width: 100%;
}

&__menutoggle__icon {
width: 20px;
height: 20px;
Expand Down
2 changes: 1 addition & 1 deletion src/components/NcButton/NcButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ function onClick(event: MouseEvent) {
}

// Icon-only button
&:has(#{&}__text:empty) {
&:has(#{&}__text:empty):not(#{&}--wide) {
--button-padding: var(--button-radius);
line-height: 1;
width: var(--button-size) !important;
Expand Down
Loading