Skip to content

Commit

Permalink
Integrate Changes
Browse files Browse the repository at this point in the history
Integrate Changes
  • Loading branch information
caroltrindade committed Mar 14, 2024
2 parents c94f964 + e7d7d27 commit 2c94df3
Show file tree
Hide file tree
Showing 13 changed files with 197 additions and 70 deletions.
52 changes: 26 additions & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-polar-bear",
"version": "4.2.3",
"version": "4.3.0",
"author": "adapcon",
"scripts": {
"storybook": "start-storybook --quiet -p 6006 -s ./src/static",
Expand Down
5 changes: 5 additions & 0 deletions src/components/DataVisualization/Chips/Chips.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ import PbChips from './Chips.vue';
},
defaultValue: 'secondary',
},
disabled: {
type: 'boolean',
defaultValue: false,
},
chips: {
type: 'array',
defaultValue: [
Expand Down Expand Up @@ -63,6 +67,7 @@ export const Template = (args, { argTypes }) => ({
:showClearButton="showClearButton"
:clearButtonStyle="clearButtonStyle"
:color="color"
:disabled="disabled"
/>
`
});
Expand Down
85 changes: 56 additions & 29 deletions src/components/DataVisualization/Chips/Chips.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
<template>
<ul v-if="chips.length" class="chips-wrapper">
<ul
v-if="chips.length"
class="chips-wrapper"
>
<li
v-for="(chip, index) of chips"
:key="`${chip.title}||${index}`"
:style="chipsStyleHandler"
:class="{
'chips-disabled': disabled
}"
@click="removeChip(index)"
>
<small class="pb">
Expand All @@ -13,7 +19,14 @@
<PbIcon icon="fas fa-times fa-xs" style="margin-left: 10px" />
</li>

<li v-if="showClearButton" :style="clearButtonStyleHandler" @click="clearChips()">
<li
v-if="showClearButton"
:style="clearButtonStyleHandler"
:class="{
'chips-disabled': disabled
}"
@click="clearChips()"
>
<small class="pb">
<b>Limpar Todos</b>
</small>
Expand Down Expand Up @@ -61,6 +74,11 @@ export default {
default: 'secondary',
validator: color => ['primary', 'secondary', 'white'].includes(color),
},
disabled: {
type: Boolean,
default: false,
},
},
computed: {
Expand All @@ -75,6 +93,8 @@ export default {
methods: {
removeChip(index) {
if (this.disabled) return;
const newChips = this.copyChips();
const removedChips = newChips.splice(index, 1);
Expand All @@ -83,6 +103,8 @@ export default {
},
clearChips() {
if (this.disabled) return;
const newChips = this.copyChips();
const removedChips = newChips.splice(0);
Expand Down Expand Up @@ -131,34 +153,39 @@ export default {
</script>

<style lang="scss" scoped>
.chips-wrapper {
list-style: none;
user-select: none;
margin: 0;
padding: 0;
.chips-wrapper {
list-style: none;
user-select: none;
margin: 0;
padding: 0;
display: flex;
justify-content: flex-start;
align-items: flex-start;
flex-wrap: wrap;
width: 100%;
position: relative;
li {
display: flex;
justify-content: flex-start;
align-items: flex-start;
flex-wrap: wrap;
width: 100%;
position: relative;
li {
display: flex;
flex-wrap: nowrap;
align-items: center;
margin: 4px;
padding: 2px 14px;
border-radius: 40px;
cursor: pointer;
max-width: 100%;
small {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
flex-wrap: nowrap;
align-items: center;
margin: 4px;
padding: 2px 14px;
border-radius: 40px;
cursor: pointer;
max-width: 100%;
small {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
}
.chips-disabled {
opacity: 0.5;
cursor: not-allowed !important;
}
</style>
Loading

0 comments on commit 2c94df3

Please sign in to comment.