-
Notifications
You must be signed in to change notification settings - Fork 355
Feat#1417/add new menu component #3637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
m0ksem
merged 31 commits into
epicmaxco:develop
from
pogrib0k:feat#1417/add-new-menu-component
Dec 8, 2023
Merged
Changes from 24 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
3a8b043
[raw]
pogrib0k c93fefa
[raw]
pogrib0k 0654610
feat: add disabled property to va-menu-item
pogrib0k a870865
Merge branch 'develop' of github.com:epicmaxco/vuestic-ui into feat#1…
pogrib0k 90411b9
add groups of options in menu
pogrib0k ae0ea16
proxy dropdown props to menu component
pogrib0k e5c58be
Merge branch 'develop' into feat#1417/add-new-menu-component
pogrib0k 84d86e1
[raw]
pogrib0k 13dcfb4
feat: add more stories and refactored some pieces of code
m0ksem 4289019
feat: add color prop
m0ksem 3fd6799
raw
m0ksem d3378fc
Merge branch 'develop' into pr/pogrib0k/3637
m0ksem 27c3ab9
fix: improve VaMenuList
m0ksem ce4ac18
chore: eslint fix
m0ksem f00945a
feat(va-menu-list): keyboard navigation
m0ksem 767cb61
feat(va-menu): init component with dropdown and keyboard navigation
m0ksem 28c0dfd
docs(va-menu): init docs pages for va-menu and va-menu-item
m0ksem 32b3513
chore: eslint fix
m0ksem bc32112
fix: story tweaks
asvae c6a9b5b
fix: revert storybook changes
m0ksem 48228c9
fix(menu): stories fixes
m0ksem e43adc4
chore: eslint fix
m0ksem 54b99fd
feat(menu): use-menu
m0ksem 7ec193d
feat(menu): improve keyboard navigation
m0ksem 4ed064a
minor story updates
asvae 1ecc6b2
fix(menu): bug fixes
m0ksem 2fd8ec2
docs(menu): add api descriptions
m0ksem 2feea87
docs(menu): add example descriptions
m0ksem b62663e
docs(menu): improve descriptions
m0ksem d0dce4b
fix(menu): remove color prop
m0ksem 234ff72
docs(menu): improve use menu example
m0ksem File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
packages/docs/page-config/ui-elements/menu-list/examples/Default.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<template> | ||
<VaMenuList | ||
:options="['Option 1', 'Option 2', 'Option 3']" | ||
@selected="(v) => alert(v)" | ||
/> | ||
</template> | ||
|
||
<script setup> | ||
const alert = (...args) => window.alert(...args) | ||
</script> |
18 changes: 18 additions & 0 deletions
18
packages/docs/page-config/ui-elements/menu-list/examples/Group.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<template> | ||
<VaMenuList | ||
:options="options" | ||
@selected="(v) => alert(v)" | ||
/> | ||
</template> | ||
|
||
<script setup> | ||
const alert = (...args) => window.alert(...args) | ||
|
||
const options = [ | ||
{ id: '0', text: 'one', value: 'one', group: '' }, | ||
{ id: '1', text: 'two', value: 'two', group: 'Group 1' }, | ||
{ id: '2', text: 'three', value: 'three', group: '' }, | ||
{ id: '3', text: 'four', value: 'four', group: 'Group 2' }, | ||
{ id: '4', text: 'five', value: 'five', group: 'Group 2' }, | ||
] | ||
</script> |
18 changes: 18 additions & 0 deletions
18
packages/docs/page-config/ui-elements/menu-list/examples/Icon.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<template> | ||
<VaMenuList | ||
:options="options" | ||
@selected="(v) => alert(v)" | ||
/> | ||
</template> | ||
|
||
<script setup> | ||
const alert = (...args) => window.alert(...args) | ||
|
||
const options = [ | ||
{ id: '0', text: 'copy', value: 'one', icon: 'content_copy', rightIcon: '' }, | ||
{ id: '1', text: 'paste', value: 'two', icon: 'content_paste', rightIcon: '' }, | ||
{ id: '2', text: 'cut', value: 'three', icon: 'content_cut', rightIcon: '' }, | ||
{ id: '3', text: 'share', value: 'four', icon: '', rightIcon: 'share' }, | ||
{ id: '4', text: 'delete', value: 'five', icon: 'delete' }, | ||
] | ||
</script> |
17 changes: 17 additions & 0 deletions
17
packages/docs/page-config/ui-elements/menu-list/examples/MenuItem.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<template> | ||
<VaMenuList> | ||
<VaMenuItem @selected="alert"> | ||
Option 1 | ||
</VaMenuItem> | ||
<VaMenuItem @selected="alert"> | ||
Option 2 | ||
</VaMenuItem> | ||
<VaMenuItem @selected="alert"> | ||
Option 2 | ||
</VaMenuItem> | ||
</VaMenuList> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
const alert = (...args) => window.alert(...args) | ||
</script> |
27 changes: 27 additions & 0 deletions
27
packages/docs/page-config/ui-elements/menu-list/examples/WithDivider.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<template> | ||
<VaMenuList> | ||
<VaMenuItem @selected="alert"> | ||
Option 1 | ||
</VaMenuItem> | ||
<VaMenuItem @selected="alert"> | ||
Option 2 | ||
</VaMenuItem> | ||
<VaDivider /> | ||
<VaMenuItem @selected="alert"> | ||
Option 3 | ||
</VaMenuItem> | ||
<VaMenuItem @selected="alert"> | ||
Option 4 | ||
</VaMenuItem> | ||
<div> | ||
Custom divider | ||
</div> | ||
<VaMenuItem @selected="alert"> | ||
Option 5 | ||
</VaMenuItem> | ||
</VaMenuList> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
const alert = (...args) => window.alert(...args) | ||
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
export default definePageConfig({ | ||
blocks: [ | ||
block.title("Menu List"), | ||
block.paragraph("The `VaMenuList` component is used to display structured information in selectable list format."), | ||
|
||
|
||
block.link("VaMenu", "/ui-elements/menu", { preText: "See " }), | ||
|
||
block.subtitle("Examples"), | ||
|
||
block.example("Default", { | ||
title: "Basic usage", | ||
description: "To show menu items you can use `options` prop or `VaMenuItem` component.", | ||
}), | ||
block.example("MenuItem"), | ||
|
||
block.example("Icon", { | ||
title: "Icon", | ||
description: "You can use `icon `and `rightIcon` properties in options or `left-icon` and `right-icon` slots in `VaMenuItem` component.", | ||
}), | ||
|
||
block.example("Group", { | ||
title: "Group", | ||
description: "You can use `group` property in options or `VaMenuGroup` component.", | ||
}), | ||
|
||
block.example("WithDivider", { | ||
title: "With divider", | ||
description: "You can use `VaDivider` component in pair with `VaMenuItem` components.", | ||
}), | ||
|
||
block.api("VaMenuList", { | ||
props: { | ||
textBy: 'When `options` prop items are an objects, this key will be used as displayed text. Can be string (path to the key) or function of type: `(option) => option.text`', | ||
valueBy: 'When `options` prop items are an objects, this key will be used in `selected` event. Can be string (path to the key) or function of type: `(option) => option.value`', | ||
trackBy: 'When `options` prop items are an objects, this key will be used to track selected `options`. Can be string (path to the key) or function of type: `(option) => option.track`', | ||
groupBy: 'When `options` prop items are an objects, this key will be used to check correct option group', | ||
disabledBy: "Specify the key in the object to be used as item `disabled` prop. Can be string (path to the key) or function of type: `(option) => option.disabled`", | ||
options: "Available options that the user can select from", | ||
}, | ||
events: { | ||
selected: 'Emitted when an option is selected. Returns the selected option value as first argument and the selected option as second argument', | ||
} | ||
}), | ||
], | ||
}) |
20 changes: 20 additions & 0 deletions
20
packages/docs/page-config/ui-elements/menu/examples/Context.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<template> | ||
<VaMenu | ||
:options="['Option 1', 'Option 2', 'Option 3']" | ||
preset="context" | ||
@selected="(v) => alert(v)" | ||
> | ||
<template #anchor> | ||
<va-image | ||
class="h-[300px] w-[300px]" | ||
src="https://picsum.photos/1500" | ||
> | ||
<va-badge text="Right click this image" /> | ||
</va-image> | ||
</template> | ||
</VaMenu> | ||
</template> | ||
|
||
<script setup> | ||
const alert = (...args) => window.alert(...args) | ||
</script> |
14 changes: 14 additions & 0 deletions
14
packages/docs/page-config/ui-elements/menu/examples/Default.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<template> | ||
<VaMenu | ||
:options="['Option 1', 'Option 2', 'Option 3']" | ||
@selected="(v) => alert(v)" | ||
> | ||
<template #anchor> | ||
<VaButton>Open menu</VaButton> | ||
</template> | ||
</VaMenu> | ||
</template> | ||
|
||
<script setup> | ||
const alert = (...args) => window.alert(...args) | ||
</script> |
22 changes: 22 additions & 0 deletions
22
packages/docs/page-config/ui-elements/menu/examples/Group.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<template> | ||
<VaMenu | ||
:options="options" | ||
@selected="(v) => alert(v)" | ||
> | ||
<template #anchor> | ||
<VaButton>Open menu</VaButton> | ||
</template> | ||
</VaMenu> | ||
</template> | ||
|
||
<script setup> | ||
const alert = (...args) => window.alert(...args) | ||
|
||
const options = [ | ||
{ id: '0', text: 'one', value: 'one', group: '' }, | ||
{ id: '1', text: 'two', value: 'two', group: 'Group 1' }, | ||
{ id: '2', text: 'three', value: 'three', group: '' }, | ||
{ id: '3', text: 'four', value: 'four', group: 'Group 2' }, | ||
{ id: '4', text: 'five', value: 'five', group: 'Group 2' }, | ||
] | ||
</script> |
22 changes: 22 additions & 0 deletions
22
packages/docs/page-config/ui-elements/menu/examples/Icon.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<template> | ||
<VaMenu | ||
:options="options" | ||
@selected="(v) => alert(v)" | ||
> | ||
<template #anchor> | ||
<VaButton>Open menu</VaButton> | ||
</template> | ||
</VaMenu> | ||
</template> | ||
|
||
<script setup> | ||
const alert = (...args) => window.alert(...args) | ||
|
||
const options = [ | ||
{ text: 'copy', value: 'one', icon: 'content_copy' }, | ||
{ text: 'paste', value: 'two', icon: 'content_paste' }, | ||
{ text: 'cut', value: 'three', icon: 'content_cut' }, | ||
{ text: 'share', value: 'four', rightIcon: 'share' }, | ||
{ text: 'delete', value: 'five', icon: 'delete' }, | ||
] | ||
</script> |
21 changes: 21 additions & 0 deletions
21
packages/docs/page-config/ui-elements/menu/examples/MenuItem.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<template> | ||
<VaMenu> | ||
<template #anchor> | ||
<VaButton>Open menu</VaButton> | ||
</template> | ||
|
||
<VaMenuItem @selected="alert"> | ||
Option 1 | ||
</VaMenuItem> | ||
<VaMenuItem @selected="alert"> | ||
Option 2 | ||
</VaMenuItem> | ||
<VaMenuItem @selected="alert"> | ||
Option 2 | ||
</VaMenuItem> | ||
</VaMenu> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
const alert = (...args) => window.alert(...args) | ||
</script> |
27 changes: 27 additions & 0 deletions
27
packages/docs/page-config/ui-elements/menu/examples/UseMenu.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<template> | ||
<ul> | ||
<li | ||
v-for="user in 4" | ||
:key="user" | ||
@click.right="$event => show({ | ||
event: $event, | ||
options: [ | ||
{ text: 'Rename', icon: 'edit' }, | ||
{ text: 'Share', icon: 'share' }, | ||
{ text: 'Delete', icon: 'delete' }, | ||
], | ||
onSelected(option) { | ||
console.log(option, user) | ||
}, | ||
})" | ||
> | ||
User {{ user }} | ||
</li> | ||
</ul> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { useMenu } from 'vuestic-ui'; | ||
|
||
const { show } = useMenu() | ||
</script> |
31 changes: 31 additions & 0 deletions
31
packages/docs/page-config/ui-elements/menu/examples/WithDivider.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<template> | ||
<VaMenu> | ||
<template #anchor> | ||
<VaButton>Open menu</VaButton> | ||
</template> | ||
|
||
<VaMenuItem @selected="alert"> | ||
Option 1 | ||
</VaMenuItem> | ||
<VaMenuItem @selected="alert"> | ||
Option 2 | ||
</VaMenuItem> | ||
<VaDivider /> | ||
<VaMenuItem @selected="alert"> | ||
Option 3 | ||
</VaMenuItem> | ||
<VaMenuItem @selected="alert"> | ||
Option 4 | ||
</VaMenuItem> | ||
<div> | ||
Custom divider | ||
</div> | ||
<VaMenuItem @selected="alert"> | ||
Option 5 | ||
</VaMenuItem> | ||
</VaMenu> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
const alert = (...args) => window.alert(...args) | ||
</script> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.