├── .browserslistrc ├── babel.config.js ├── postcss.config.js ├── docs ├── .vuepress │ ├── style.styl │ ├── config.js │ └── components │ │ └── DropdownMenuDemo.vue └── README.md ├── src ├── index.js └── components │ └── DropdownMenu.vue ├── .gitignore ├── .eslintrc.js ├── README.md ├── deploy.sh ├── package.json └── LICENCE.md /.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | ie 11 -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/app' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | autoprefixer: {} 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /docs/.vuepress/style.styl: -------------------------------------------------------------------------------- 1 | // showing default values 2 | $accentColor = #3eaf7c 3 | $textColor = #2c3e50 4 | $borderColor = #eaecef 5 | $codeBgColor = #282c34 6 | 7 | .navbar { 8 | position: fixed !important; 9 | } -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import DropdownMenu from './components/DropdownMenu' 2 | 3 | const install = (Vue) => { 4 | Vue.component('DropdownMenu', DropdownMenu) 5 | } 6 | 7 | // auto install if used in browser 8 | if (typeof window !== 'undefined' && window.Vue) { 9 | install(window.Vue) 10 | } 11 | 12 | export { DropdownMenu as default } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw? 22 | 23 | 24 | docs/.vuepress/dist -------------------------------------------------------------------------------- /docs/.vuepress/config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ga: 'UA-141652960-2', 3 | base: '/vue-dropdown-menu/', 4 | title: 'Dropdown menu library', 5 | description: 'Dropdown menu library by Innologica', 6 | themeConfig: { 7 | nav: [ 8 | { text: 'Github', link: 'https://github.com/Innologica/vue-dropdown-menu' } 9 | ], 10 | sidebar: 'auto' 11 | }, 12 | } -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true 5 | }, 6 | 'extends': [ 7 | 'plugin:vue/essential', 8 | 'eslint:recommended' 9 | ], 10 | rules: { 11 | 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', 12 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' 13 | }, 14 | parserOptions: { 15 | parser: 'babel-eslint' 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dropdown menu 2 | 3 | Universal dropdown menu component for Vue. Any element can be dropdown trigger and anything can be dropdown content. 4 | 5 | Fully customizable - supports left/right opening, open on hover/click, interactive mode ... 6 | 7 | ## Installation 8 | 9 | ```shell 10 | npm i @innologica/vue-dropdown-menu --save 11 | ``` 12 | 13 | or 14 | 15 | ```shell 16 | yarn add @innologica/vue-dropdown-menu 17 | ``` 18 | 19 | import to use: 20 | 21 | ```JS 22 | import DropdownMenu from '@innologica/vue-dropdown-menu' 23 | ``` 24 | 25 | ## Demo 26 | 27 | Demo and documentation at https://innologica.github.io/vue-dropdown-menu/ -------------------------------------------------------------------------------- /deploy.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # abort on errors 4 | set -e 5 | 6 | # build 7 | npm run docs:build 8 | 9 | # navigate into the build output directory 10 | cd docs/.vuepress/dist 11 | 12 | # if you are deploying to a custom domain 13 | # echo 'www.example.com' > CNAME 14 | 15 | git init 16 | git add -A 17 | git commit -m 'deploy' 18 | 19 | # if you are deploying to https://.github.io 20 | # git push -f git@github.com:/.github.io.git master 21 | 22 | # if you are deploying to https://.github.io/ 23 | git push -f git@github.com:Innologica/vue-dropdown-menu.git master:gh-pages 24 | 25 | 26 | cd - -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@innologica/vue-dropdown-menu", 3 | "version": "0.1.4", 4 | "scripts": { 5 | "lint": "vue-cli-service lint", 6 | "lib": "vue-cli-service build --target lib --name vue-dropdown-menu ./src/index.js", 7 | "docs:dev": "vuepress dev docs", 8 | "docs:build": "vuepress build docs", 9 | "prepublish": "npm run lib" 10 | }, 11 | "dependencies": { 12 | "core-js": "^2.6.5", 13 | "vue": "^2.6.10" 14 | }, 15 | "files": [ 16 | "dist", 17 | "src" 18 | ], 19 | "main": "dist/vue-dropdown-menu.umd.min.js", 20 | "jsnext:main": "dist/vue-dropdown-menu.umd.min.js", 21 | "devDependencies": { 22 | "@vue/cli-plugin-babel": "^3.8.0", 23 | "@vue/cli-plugin-eslint": "^3.8.0", 24 | "@vue/cli-service": "^3.8.0", 25 | "babel-eslint": "^10.0.1", 26 | "eslint": "^5.16.0", 27 | "eslint-plugin-vue": "^5.0.0", 28 | "node-sass": "^4.9.0", 29 | "sass-loader": "^7.1.0", 30 | "vue-template-compiler": "^2.6.10", 31 | "vuepress": "^0.14.11" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /LICENCE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Innologica Ltd 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # Dropdown menu 2 | 3 | Universal dropdown menu component for Vue. Any element can be dropdown trigger and anything can be dropdown content. 4 | 5 | Fully customizable - supports left/right opening, open on hover/click, interactive mode ... 6 | 7 | ## Installation 8 | 9 | ```shell 10 | npm i @innologica/vue-dropdown-menu --save 11 | ``` 12 | 13 | or 14 | 15 | ```shell 16 | yarn add @innologica/vue-dropdown-menu 17 | ``` 18 | 19 | import to use: 20 | 21 | ```JS 22 | import DropdownMenu from '@innologica/vue-dropdown-menu' 23 | ``` 24 | 25 | ## Example 26 | 27 | 28 | 29 | ### Demo source 30 | 31 | ```vue 32 | 38 | 41 | 46 | 47 | ``` 48 | 49 | ## Props 50 | 51 | | Prop | Type | Default |Description | 52 | | ------------- |:-------------| -----|-----| 53 | | value | Boolean | false |Opens/closes the dropdown. The component uses v-model to control the state of the dropdown.| 54 | | right | Boolean | false |Whether to stick the dropdown on the right side of the element.| 55 | | hover | Boolean | false |If true the menu is open on hover (after hover_time) else it is open on click.| 56 | | closeOnClickOutside | Boolean | true |Should the menu close when clicked outside| 57 | | hover_time | Integer | false |Time before the menu opens in hover model. Default: 100ms| 58 | | transition | String | '' |The vue transition name used to open the menu. | 59 | 60 | ## Slots 61 | 62 | ### default 63 | This slot is the element that triggers the dropdown. It can be any HTML element, the components surrounds it with a div which handles the events like hover/click etc. 64 | 65 | ### dropdown 66 | This slot is the content of the dropdown menu. 67 | -------------------------------------------------------------------------------- /src/components/DropdownMenu.vue: -------------------------------------------------------------------------------- 1 | 27 | 28 | -------------------------------------------------------------------------------- /docs/.vuepress/components/DropdownMenuDemo.vue: -------------------------------------------------------------------------------- 1 | 93 | 94 | 112 | 113 | 116 | 117 | --------------------------------------------------------------------------------