Skip to content

Commit

Permalink
Merge branch 'pre-release-0.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
guastallaigor committed Dec 8, 2021
2 parents 4be8bd8 + d71bc0c commit 0302164
Show file tree
Hide file tree
Showing 9 changed files with 5,607 additions and 6,107 deletions.
8 changes: 4 additions & 4 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module.exports = {
stories: [
'../stories/**/*.stories.js'
],
stories: ['../stories/**/*.stories.js'],
logLevel: 'debug',
addons: [
'@storybook/addon-essentials',
'@storybook/addon-controls',
'@storybook/addon-docs',
'@storybook/addon-a11y'
]
}
4 changes: 4 additions & 0 deletions .storybook/manager.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { addons } from '@storybook/addons'
import theme from './theme'

addons.setConfig({ theme })
37 changes: 37 additions & 0 deletions .storybook/theme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { create } from '@storybook/theming/create'

export default create({
base: 'light',

colorPrimary: '#0052c0',
colorSecondary: '#0052c0',

// UI
appBg: '#F7FAFC',
appContentBg: '#EDF2F7',
appBorderColor: '#CBD5E0',
appBorderRadius: 4,

// Typography
fontBase: '-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Open Sans", sans-serif',
fontCode: 'monospace',

// Text colors
textColor: '#1A202C',
textInverseColor: 'rgba(255,255,255,0.9)',

// Toolbar default and active colors
barTextColor: 'silver',
barSelectedColor: '#FFFFFF',
barBg: '#35495e',

// Form colors
inputBg: 'white',
inputBorder: 'silver',
inputTextColor: '#1A202C',
inputBorderRadius: 4,

brandTitle: 'Vue List Picker',
brandUrl: 'https://github.com/guastallaigor/vue-list-picker',
brandImage: 'https://github.com/guastallaigor/vue-list-picker/blob/master/.github/logo.png?raw=true'
})
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
presets: [
'@vue/app'
'@vue/cli-plugin-babel/preset'
]
}
67 changes: 35 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"name": "vue-list-picker",
"version": "0.2.0",
"version": "0.3.0",
"description": "Just a simple list picker component made with Vue.js",
"homepage": "https://github.com/guastallaigor/vue-list-picker#readme",
"author": "Igor Guastalla de Lima <[email protected]>",
"private": false,
"scripts": {
"lint": "vue-cli-service lint",
Expand All @@ -14,41 +17,41 @@
"build-storybook": "build-storybook"
},
"dependencies": {
"vue": "^2.6.12"
"vue": "^2.6.14"
},
"devDependencies": {
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@storybook/addon-actions": "^6.0.21",
"@storybook/addon-backgrounds": "^6.0.21",
"@storybook/addon-controls": "^6.0.21",
"@storybook/addon-essentials": "^6.0.21",
"@storybook/addon-knobs": "^6.0.21",
"@storybook/addon-links": "^6.0.21",
"@storybook/vue": "^6.0.21",
"@vue/cli-plugin-babel": "^4.5.6",
"@vue/cli-plugin-eslint": "^4.5.6",
"@vue/cli-plugin-unit-jest": "^4.5.6",
"@vue/cli-service": "^4.5.6",
"@vue/eslint-config-standard": "^5.1.2",
"@vue/test-utils": "^1.1.0",
"babel-core": "7.0.0-bridge.0",
"@babel/core": "^7.16.0",
"@commitlint/cli": "^15.0.0",
"@commitlint/config-conventional": "^15.0.0",
"@storybook/addon-a11y": "^6.4.8",
"@storybook/addon-actions": "^6.4.8",
"@storybook/addon-backgrounds": "^6.4.8",
"@storybook/addon-controls": "^6.4.8",
"@storybook/addon-essentials": "^6.4.8",
"@storybook/addon-links": "^6.4.8",
"@storybook/theming": "^6.4.8",
"@storybook/vue": "^6.4.8",
"@vue/cli-plugin-babel": "^4.5.15",
"@vue/cli-plugin-eslint": "^4.5.15",
"@vue/cli-plugin-unit-jest": "^4.5.15",
"@vue/cli-service": "^4.5.15",
"@vue/eslint-config-standard": "^6.1.0",
"@vue/test-utils": "^1.3.0",
"babel-eslint": "^10.1.0",
"babel-jest": "^23.6.0",
"babel-loader": "^8.1.0",
"babel-jest": "^27.4.2",
"babel-loader": "^8.2.3",
"babel-preset-vue": "^2.0.2",
"commitizen": "^4.2.1",
"core-js": "^3.6.5",
"eslint": "^7.9.0",
"eslint-plugin-import": "^2.22.0",
"commitizen": "^4.2.4",
"core-js": "^3.19.3",
"eslint": "^7.32.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"eslint-plugin-vue": "^6.2.2",
"husky": "^4.3.0",
"react-is": "^16.13.1",
"vue-cli-plugin-storybook": "^1.3.0",
"vue-template-compiler": "^2.6.12"
"eslint-plugin-promise": "^5.2.0",
"eslint-plugin-standard": "^4.1.0",
"eslint-plugin-vue": "^8.2.0",
"husky": "^7.0.4",
"vue-cli-plugin-storybook": "^2.1.0",
"vue-template-compiler": "^2.6.14"
},
"bugs": {
"url": "https://github.com/guastallaigor/vue-list-picker/issues"
Expand Down Expand Up @@ -113,7 +116,7 @@
"plugins": {
"autoprefixer": {}
}
},
},
"browserslist": [
"> 1%",
"last 2 versions"
Expand Down
16 changes: 7 additions & 9 deletions src/components/VueListPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="vue-list-picker">
<div class="list-picker-container list-picker-left">
<div class="list-picker-title" :class="getTitleClasses">
{{ titleLeft | textSubstr(titleSubstr) }}
{{ textSubstr(titleLeft, titleSubstr) }}
</div>
<div class="list-picker-panel" ref="moverleft" :style="getStyles">
<div class="list-picker-item"
Expand All @@ -13,7 +13,7 @@
@mousemove="selectItem(item, selectedItems)"
@mousedown="startDrag"
>
{{ item[contentAttr] | textSubstr(contentSubstr) }}
{{ textSubstr(item[contentAttr], contentSubstr) }}
</div>
</div>
</div>
Expand Down Expand Up @@ -41,7 +41,7 @@
</div>
<div class="list-picker-container list-picker-right">
<div class="list-picker-title" :class="getTitleClasses">
{{ titleRight | textSubstr(titleSubstr) }}
{{ textSubstr(titleRight, titleSubstr) }}
</div>
<div class="list-picker-panel" ref="moverright" :style="getStyles">
<div class="list-picker-item"
Expand All @@ -52,7 +52,7 @@
@mousemove="selectItem(item, selectedItems)"
@mousedown="startDrag"
>
{{ item[contentAttr] | textSubstr(contentSubstr) }}
{{ textSubstr(item[contentAttr], contentSubstr) }}
</div>
</div>
</div>
Expand Down Expand Up @@ -141,11 +141,6 @@ export default {
dragging: false,
lastMovedItem: null
}),
filters: {
textSubstr (value, qtd = 250, mask = '...') {
return value && value.length > qtd ? `${value.substring(0, qtd)}${mask}` : value
}
},
computed: {
unselectedItems: {
get () {
Expand Down Expand Up @@ -199,6 +194,9 @@ export default {
document.removeEventListener('mouseup', this.stopDrag)
},
methods: {
textSubstr (value, qtd = 250, mask = '...') {
return value && value.length > qtd ? `${value.substring(0, qtd)}${mask}` : value
},
startDrag () {
this.dragging = true
},
Expand Down
14 changes: 12 additions & 2 deletions stories/index.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ export default {
title: 'VueListPicker',
component: VueListPicker,
parameters: {
a11y: {
// optional selector which element to inspect
element: '#root',
// axe-core configurationOptions (https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#parameters-1)
config: {},
// axe-core optionsParameter (https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#options-parameter)
options: {},
// optional flag to prevent the automatic check
manual: true
},
controls: {
hideNoControlsWarning: true,
expanded: true
Expand Down Expand Up @@ -36,7 +46,7 @@ export default {
movedItemLocation: {
control: {
type: 'inline-radio',
options: ['top', 'bottom'],
options: ['top', 'bottom']
}
},
titleLeft: {
Expand Down Expand Up @@ -113,7 +123,7 @@ const actionsData = {
moveAllLeft: action('move-all-left'),
moveAllRight: action('move-all-right'),
unselectAll: action('unselect-all')
};
}

export const Default = () => ({
components: { VueListPicker },
Expand Down
45 changes: 30 additions & 15 deletions vue-list-picker.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,37 @@
// Import vue component
import VueListPicker from './src/components/VueListPicker.vue'

// Export components
const Components = {
VueListPicker
// install function executed by Vue.use()
const install = function (Vue) {
if (install.installed) return
install.installed = true
Vue.component('VueListPicker', VueListPicker)
}

const VueListPickerPlugin = {
install (Vue) {
Object.keys(Components).forEach((name) => {
Vue.component(name, Components[name])
})
}
}
// Create module definition for Vue.use()
const plugin = { install }

// To auto-install when vue is found
// eslint-disable-next-line no-redeclare
/* global window, global */
let GlobalVue = null

// Export as a plugin
export default VueListPickerPlugin
if (typeof window !== 'undefined') {
GlobalVue = window.Vue
} else if (typeof global !== 'undefined') {
GlobalVue = global.Vue
}

// Export as individual components
export {
VueListPicker
if (GlobalVue) {
GlobalVue.use(plugin)
}

// Inject install function into component - allows component
// to be registered via Vue.use() as well as Vue.component()
VueListPicker.install = install

// Export component by default
export default VueListPicker

// Export single (backwards compatibility)
export { VueListPicker }
Loading

0 comments on commit 0302164

Please sign in to comment.