@policystudio/policy-studio-ui-vue 1.1.89 → 1.1.90-access.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +1 -0
- package/.eslintrc.js +75 -67
- package/.github/workflows/deploy-storybook.yml +5 -5
- package/.nvmrc +1 -0
- package/dist/css/psui_styles_output.css +6617 -0
- package/dist/index.d.ts +51 -0
- package/dist/index.js +106 -0
- package/dist/index.js.map +1 -0
- package/dist/util/GeneralFunctions.d.ts +3 -0
- package/dist/util/GeneralFunctions.js +35 -0
- package/dist/util/GeneralFunctions.js.map +1 -0
- package/dist/util/directives.d.ts +1 -0
- package/dist/util/directives.js +22 -0
- package/dist/util/directives.js.map +1 -0
- package/dist/util/imageLoader.d.ts +6 -0
- package/dist/util/imageLoader.js +52 -0
- package/dist/util/imageLoader.js.map +1 -0
- package/doc/.nvmrc +1 -0
- package/doc/.storybook/PolicyStudio.ts +11 -0
- package/doc/.storybook/main.ts +27 -0
- package/doc/.storybook/manager.ts +7 -0
- package/{.storybook/preview.js → doc/.storybook/preview.ts} +2 -3
- package/doc/package-lock.json +22653 -0
- package/doc/package.json +71 -0
- package/doc/shims-vue.d.ts +6 -0
- package/{src/stories/Accordion.stories.js → doc/src/stories/Accordion.stories.ts} +4 -5
- package/{src/stories/BadgeWithIcon.stories.js → doc/src/stories/BadgeWithIcon.stories.ts} +2 -2
- package/{src/stories/BarChart.stories.js → doc/src/stories/BarChart.stories.ts} +2 -2
- package/{src/stories/Breadcrumb.stories.js → doc/src/stories/Breadcrumb.stories.ts} +2 -5
- package/{src/stories/Button.stories.js → doc/src/stories/Button.stories.ts} +130 -130
- package/{src/stories/CardInfos.stories.js → doc/src/stories/CardInfos.stories.ts} +2 -3
- package/{src/stories/ChartLegend.stories.js → doc/src/stories/ChartLegend.stories.ts} +2 -3
- package/{src/stories/Checkbox.stories.js → doc/src/stories/Checkbox.stories.ts} +2 -2
- package/{src/stories/CheckboxSimple.stories.js → doc/src/stories/CheckboxSimple.stories.ts} +2 -2
- package/{src/stories/Chips.stories.js → doc/src/stories/Chips.stories.ts} +22 -23
- package/{src/stories/ClimateZoneBadge.stories.js → doc/src/stories/ClimateZoneBadge.stories.ts} +3 -2
- package/doc/src/stories/Collapse.stories.ts +46 -0
- package/{src/stories/CostEffectBar.stories.js → doc/src/stories/CostEffectBar.stories.ts} +3 -2
- package/{src/stories/Datatable.stories.js → doc/src/stories/Datatable.stories.ts} +7 -4
- package/{src/stories/DateCardInfo.stories.js → doc/src/stories/DateCardInfo.stories.ts} +2 -6
- package/{src/stories/Dialog.stories.js → doc/src/stories/Dialog.stories.ts} +2 -2
- package/{src/stories/Draggable.stories.js → doc/src/stories/Draggable.stories.ts} +3 -2
- package/{src/stories/Dropdown.stories.js → doc/src/stories/Dropdown.stories.ts} +4 -3
- package/{src/stories/DropdownList.stories.js → doc/src/stories/DropdownList.stories.ts} +4 -2
- package/{src/stories/ElevationSystem.stories.mdx → doc/src/stories/ElevationSystem.mdx} +1 -1
- package/{src/stories/HighlightRippleDot.stories.js → doc/src/stories/HighlightRippleDot.stories.ts} +3 -2
- package/{src/stories/Icon.stories.js → doc/src/stories/Icon.stories.ts} +3 -1
- package/{src/stories/InlineSelector.stories.js → doc/src/stories/InlineSelector.stories.ts} +2 -2
- package/{src/stories/Input.stories.js → doc/src/stories/Input.stories.ts} +7 -4
- package/{src/stories/InputSelect.stories.js → doc/src/stories/InputSelect.stories.ts} +3 -2
- package/{src/stories/InputTextArea.stories.js → doc/src/stories/InputTextArea.stories.ts} +2 -2
- package/{src/stories/Introduction.stories.mdx → doc/src/stories/Introduction.mdx} +101 -101
- package/{src/stories/MiniTag.stories.js → doc/src/stories/MiniTag.stories.ts} +9 -2
- package/{src/stories/ProgressBar.stories.js → doc/src/stories/ProgressBar.stories.ts} +3 -2
- package/{src/stories/RadioButton.stories.js → doc/src/stories/RadioButton.stories.ts} +2 -2
- package/{src/stories/RadioButtonSimple.stories.js → doc/src/stories/RadioButtonSimple.stories.ts} +2 -2
- package/{src/stories/SimpleAlert.stories.js → doc/src/stories/SimpleAlert.stories.ts} +3 -2
- package/{src/stories/Slider.stories.js → doc/src/stories/Slider.stories.ts} +6 -2
- package/{src/stories/Switch.stories.js → doc/src/stories/Switch.stories.ts} +2 -2
- package/{src/stories/TabHeader.stories.js → doc/src/stories/TabHeader.stories.ts} +6 -1
- package/{src/stories/TableResults.stories.js → doc/src/stories/TableResults.stories.ts} +11 -7
- package/{src/stories/TagScope.stories.js → doc/src/stories/TagScope.stories.ts} +3 -2
- package/{src/stories/TestimonialCard.stories.js → doc/src/stories/TestimonialCard.stories.ts} +3 -3
- package/{src/stories/Toast.stories.js → doc/src/stories/Toast.stories.ts} +2 -2
- package/{src/stories/Toggle.stories.js → doc/src/stories/Toggle.stories.ts} +7 -4
- package/{src/stories/Tooltip.stories.js → doc/src/stories/Tooltip.stories.ts} +6 -6
- package/{src/stories/Typography.stories.mdx → doc/src/stories/Typography.mdx} +107 -105
- package/doc/tsconfig.json +17 -0
- package/package.json +43 -39
- package/scripts/gulp.js +11 -0
- package/scripts/kill-port.sh +12 -0
- package/src/App.vue +30 -0
- package/src/assets/scss/base.scss +3 -30
- package/src/assets/scss/components/PsAccordion.scss +2 -2
- package/src/assets/scss/components/PsButton.scss +7 -1
- package/src/assets/scss/components/PsChips.scss +12 -7
- package/src/assets/scss/components/PsCollapse.scss +71 -0
- package/src/assets/scss/components/PsCostEffectBar.scss +4 -4
- package/src/assets/scss/components/PsDataTable.scss +1 -1
- package/src/assets/scss/components/PsDateCardInfo.scss +4 -5
- package/src/assets/scss/components/PsDialog.scss +7 -0
- package/src/assets/scss/components/PsDropdownList.scss +1 -1
- package/src/assets/scss/components/PsInput.scss +9 -0
- package/src/assets/scss/components/PsProgressBar.scss +4 -4
- package/src/assets/scss/components/PsTabHeader.scss +57 -2
- package/src/assets/scss/components/PsTableResults.scss +51 -82
- package/src/assets/scss/components/PsTestimonialCard.scss +1 -1
- package/src/assets/scss/components/PsTooltip.scss +149 -145
- package/src/components/accordion/PsAccordion.vue +20 -21
- package/src/components/accordion/PsAccordionItem.vue +121 -81
- package/src/components/badges-and-tags/PsBadgeWithIcon.vue +37 -36
- package/src/components/badges-and-tags/PsCardInfos.vue +40 -40
- package/src/components/badges-and-tags/PsChartLegend.vue +50 -41
- package/src/components/badges-and-tags/PsClimateZoneBadge.vue +13 -19
- package/src/components/badges-and-tags/PsCostEffectBar.vue +28 -61
- package/src/components/badges-and-tags/PsDateCardInfo.vue +17 -18
- package/src/components/badges-and-tags/PsHighlightRippleDot.vue +4 -3
- package/src/components/badges-and-tags/PsMiniTag.vue +39 -41
- package/src/components/badges-and-tags/PsProgressBar.vue +72 -68
- package/src/components/badges-and-tags/PsTagScope.vue +17 -22
- package/src/components/badges-and-tags/PsTestimonialCard.vue +25 -30
- package/src/components/buttons/PsButton.vue +90 -98
- package/src/components/chips/PsChips.vue +118 -103
- package/src/components/collapse/PsCollapse.vue +124 -0
- package/src/components/controls/PsCheckbox.vue +86 -83
- package/src/components/controls/PsCheckboxSimple.vue +97 -97
- package/src/components/controls/PsDraggable.vue +100 -99
- package/src/components/controls/PsInlineSelector.vue +111 -113
- package/src/components/controls/PsRadioButton.vue +72 -60
- package/src/components/controls/PsRadioButtonSimple.vue +81 -77
- package/src/components/controls/PsSlider.vue +190 -181
- package/src/components/controls/PsSwitch.vue +63 -54
- package/src/components/controls/PsToggle.vue +62 -57
- package/src/components/data-graphics/PsBarChart.vue +22 -23
- package/src/components/datatable/PsDataTable.vue +70 -65
- package/src/components/datatable/PsDataTableItem.vue +30 -32
- package/src/components/forms/PsDropdown.vue +173 -166
- package/src/components/forms/PsDropdownList.vue +133 -130
- package/src/components/forms/PsInput.vue +163 -146
- package/src/components/forms/PsInputSelect.vue +121 -100
- package/src/components/forms/PsInputTextArea.vue +84 -74
- package/src/components/navigations/PsBreadcrumb.vue +25 -34
- package/src/components/notifications/PsDialog.vue +67 -60
- package/src/components/notifications/PsSimpleAlert.vue +47 -37
- package/src/components/notifications/PsToast.vue +48 -42
- package/src/components/table-results/PsTableResults.vue +527 -504
- package/src/components/table-results/PsTableResultsBody.vue +69 -68
- package/src/components/table-results/PsTableResultsHead.vue +108 -69
- package/src/components/table-results/PsTableResultsHeadComparison.vue +88 -69
- package/src/components/table-results/PsTableResultsHeadFlexible.vue +112 -72
- package/src/components/table-results/PsTableResultsRow.vue +61 -58
- package/src/components/tabs/PsTabHeader.vue +138 -116
- package/src/components/tooltip/PsDialogTooltip.vue +112 -107
- package/src/components/tooltip/PsRichTooltip.vue +46 -43
- package/src/components/tooltip/PsTooltip.vue +126 -122
- package/src/components/ui/PsDotLoader.vue +6 -10
- package/src/components/ui/PsIcon.vue +149 -134
- package/src/index.ts +159 -0
- package/src/tsconfig.json +12 -0
- package/src/types/index.d.ts +6 -0
- package/src/util/GeneralFunctions.js +16 -7
- package/src/util/directives.ts +24 -0
- package/src/util/imageLoader.js +14 -7
- package/tailwind.config.js +12 -3
- package/tsconfig.json +47 -0
- package/.storybook/PolicyStudio.js +0 -10
- package/.storybook/eventBus.js +0 -3
- package/.storybook/main.js +0 -25
- package/.storybook/manager.js +0 -6
- package/babel.config.js +0 -3
- package/backup-package-lock.json +0 -37194
- package/dist/css/psui_styles.css +0 -110965
- package/postcss.config.js +0 -8
- package/src/components/playground/PsScrollBar.vue +0 -248
- package/src/index.js +0 -167
- package/src/stories/Playground.stories.js +0 -16
- /package/{src → doc/src}/assets/images/multifamily-units.svg +0 -0
- /package/{src → doc/src}/assets/images/policy-studio.svg +0 -0
- /package/{src/contents/ComparisonData.js → doc/src/contents/ComparisonData.ts} +0 -0
- /package/{src/contents/FlexibleData.js → doc/src/contents/FlexibleData.ts} +0 -0
- /package/{src/contents/ResultsData.js → doc/src/contents/ResultsData.ts} +0 -0
- /package/{src/stories/Colors.stories.mdx → doc/src/stories/Colors.mdx} +0 -0
- /package/{src → doc/src}/stories/assets/code-brackets.svg +0 -0
- /package/{src → doc/src}/stories/assets/colors.svg +0 -0
- /package/{src → doc/src}/stories/assets/comments.svg +0 -0
- /package/{src → doc/src}/stories/assets/direction.svg +0 -0
- /package/{src → doc/src}/stories/assets/flow.svg +0 -0
- /package/{src → doc/src}/stories/assets/plugin.svg +0 -0
- /package/{src → doc/src}/stories/assets/repo.svg +0 -0
- /package/{src → doc/src}/stories/assets/stackalt.svg +0 -0
|
@@ -1,31 +1,26 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="psui-el-tag-scope"
|
|
2
|
+
<div
|
|
3
|
+
class="psui-el-tag-scope"
|
|
4
4
|
:class="getComponentClass"
|
|
5
5
|
>
|
|
6
6
|
<span class="psui-el-tag-scope-icon">{{ getComponentIcon }}</span>
|
|
7
7
|
</div>
|
|
8
8
|
</template>
|
|
9
9
|
|
|
10
|
-
<script>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
included: {
|
|
15
|
-
type: Boolean,
|
|
16
|
-
default: true
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
computed: {
|
|
20
|
-
getComponentClass() {
|
|
21
|
-
return `psui-el-tag-scope-${this.included}`
|
|
22
|
-
},
|
|
23
|
-
getComponentIcon() {
|
|
24
|
-
return this.included ? 'check' : 'remove'
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
}
|
|
28
|
-
</script>
|
|
10
|
+
<script setup>
|
|
11
|
+
import { computed } from 'vue'
|
|
12
|
+
|
|
13
|
+
const props = defineProps({})
|
|
29
14
|
|
|
30
|
-
|
|
15
|
+
const getComponentClass = computed(() => {
|
|
16
|
+
return `psui-el-tag-scope-${props.included}`
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const getComponentIcon = computed(() => {
|
|
20
|
+
return props.included ? 'check' : 'remove'
|
|
21
|
+
})
|
|
22
|
+
</script>
|
|
31
23
|
|
|
24
|
+
<style>
|
|
25
|
+
/* Please, use the file src/assets/scss/components/PsTagScope.scss */
|
|
26
|
+
</style>
|
|
@@ -8,41 +8,36 @@
|
|
|
8
8
|
display="flex"
|
|
9
9
|
/>
|
|
10
10
|
</div>
|
|
11
|
-
<p class="psui-el-testimonial-description">
|
|
11
|
+
<p class="psui-el-testimonial-description">
|
|
12
|
+
{{ description }}
|
|
13
|
+
</p>
|
|
12
14
|
<div class="psui-el-testimonial-info">
|
|
13
|
-
<span class="psui-el-testimonial-info-user"
|
|
14
|
-
<span class="psui-el-testimonial-info-position">{{position}}</span>
|
|
15
|
-
<span class="psui-el-testimonial-info-jurisdiction">{{jurisdiction}}</span>
|
|
15
|
+
<span class="psui-el-testimonial-info-user">{{ user }}</span>
|
|
16
|
+
<span class="psui-el-testimonial-info-position">{{ position }}</span>
|
|
17
|
+
<span class="psui-el-testimonial-info-jurisdiction">{{ jurisdiction }}</span>
|
|
16
18
|
</div>
|
|
17
19
|
</div>
|
|
18
20
|
</template>
|
|
19
21
|
|
|
20
|
-
<script>
|
|
22
|
+
<script setup>
|
|
21
23
|
import PsIcon from '../ui/PsIcon.vue'
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
jurisdiction:{
|
|
42
|
-
type: String,
|
|
43
|
-
default: '',
|
|
44
|
-
},
|
|
45
|
-
}
|
|
46
|
-
}
|
|
25
|
+
defineProps({
|
|
26
|
+
description: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: '',
|
|
29
|
+
},
|
|
30
|
+
user: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: '',
|
|
33
|
+
},
|
|
34
|
+
position: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: '',
|
|
37
|
+
},
|
|
38
|
+
jurisdiction: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: '',
|
|
41
|
+
},
|
|
42
|
+
})
|
|
47
43
|
</script>
|
|
48
|
-
|
|
@@ -1,113 +1,105 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<button
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
<svg
|
|
3
|
+
@click="onClick($event)"
|
|
4
|
+
@mouseenter="onMouseEnter"
|
|
5
|
+
@mouseleave="onMouseLeave"
|
|
6
|
+
class="psui-el-button"
|
|
7
|
+
:class="[getComponentClass, { hover: isHover && !disabled}, { disabled: disabled || loading }]"
|
|
8
|
+
>
|
|
9
|
+
<svg
|
|
10
|
+
v-if="loading"
|
|
10
11
|
class="psui-animate-spin psui-mr-3 psui-h-5 psui-w-5 psui-text-black"
|
|
11
12
|
:class="`${iconPosition == 'left' ? 'psui-mr-3' : 'psui-ml-3 psui--mr-1'}`"
|
|
12
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
14
|
+
fill="none"
|
|
15
|
+
viewBox="0 0 24 24"
|
|
16
|
+
>
|
|
17
|
+
<circle
|
|
18
|
+
class="psui-opacity-25"
|
|
19
|
+
cx="12"
|
|
20
|
+
cy="12"
|
|
21
|
+
r="10"
|
|
22
|
+
stroke="currentColor"
|
|
23
|
+
stroke-width="4"
|
|
24
|
+
/>
|
|
25
|
+
<path
|
|
26
|
+
class="psui-opacity-75"
|
|
27
|
+
fill="currentColor"
|
|
28
|
+
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
29
|
+
/>
|
|
15
30
|
</svg>
|
|
16
|
-
<i
|
|
31
|
+
<i
|
|
32
|
+
v-else-if="icon"
|
|
33
|
+
:class="iconClass"
|
|
34
|
+
class="material-icons-round"
|
|
35
|
+
>{{ icon }}</i>
|
|
17
36
|
<span v-if="label">{{ label }}</span>
|
|
18
37
|
</button>
|
|
19
38
|
</template>
|
|
20
39
|
|
|
21
|
-
<script>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
size: {
|
|
56
|
-
type: String,
|
|
57
|
-
default: 'big',
|
|
58
|
-
validator: (value) => ['small','medium','big'].includes(value)
|
|
59
|
-
},
|
|
60
|
-
/**
|
|
61
|
-
* It disable the button. All mouse event are disabled.
|
|
62
|
-
*/
|
|
63
|
-
disabled: {
|
|
64
|
-
type: Boolean,
|
|
65
|
-
default: false
|
|
66
|
-
},
|
|
67
|
-
/**
|
|
68
|
-
* It disable and add a spin icon to the button. All mouse event are disabled.
|
|
69
|
-
*/
|
|
70
|
-
loading: {
|
|
71
|
-
type: Boolean,
|
|
72
|
-
default: false
|
|
73
|
-
},
|
|
74
|
-
/**
|
|
75
|
-
* It set any further css style that might be needed.
|
|
76
|
-
*/
|
|
77
|
-
iconClass:{
|
|
78
|
-
type: String
|
|
79
|
-
}
|
|
40
|
+
<script setup>
|
|
41
|
+
import { computed, ref, } from 'vue'
|
|
42
|
+
|
|
43
|
+
const isHover = ref(false)
|
|
44
|
+
|
|
45
|
+
const emit = defineEmits(['click'])
|
|
46
|
+
|
|
47
|
+
const props = defineProps({
|
|
48
|
+
label: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: '',
|
|
51
|
+
},
|
|
52
|
+
layout: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: 'solid',
|
|
55
|
+
validator: (value) => ['solid', 'outline', 'ghost', 'onlytext', 'caution'].includes(value),
|
|
56
|
+
},
|
|
57
|
+
icon: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: '',
|
|
60
|
+
},
|
|
61
|
+
iconPosition: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: 'left',
|
|
64
|
+
validator: (value) => ['left', 'right'].includes(value),
|
|
65
|
+
},
|
|
66
|
+
size: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: 'big',
|
|
69
|
+
validator: (value) => ['small', 'medium', 'big'].includes(value),
|
|
70
|
+
},
|
|
71
|
+
disabled: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: false,
|
|
80
74
|
},
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
75
|
+
loading: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: false,
|
|
85
78
|
},
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
return `layout-${this.layout} size-${this.size} icon-${this.iconPosition}`
|
|
90
|
-
} else {
|
|
91
|
-
return `layout-${this.layout} size-${this.size}`
|
|
92
|
-
}
|
|
93
|
-
},
|
|
79
|
+
iconClass: {
|
|
80
|
+
type: String,
|
|
81
|
+
default: '',
|
|
94
82
|
},
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
this.isHover = true
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
onMouseLeave(){
|
|
106
|
-
if(!this.disabled){
|
|
107
|
-
this.isHover = false
|
|
108
|
-
}
|
|
109
|
-
}
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
const getComponentClass = computed(() => {
|
|
86
|
+
if (props.icon) {
|
|
87
|
+
return `layout-${props.layout} size-${props.size} icon-${props.iconPosition}`
|
|
88
|
+
} else {
|
|
89
|
+
return `layout-${props.layout} size-${props.size}`
|
|
110
90
|
}
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
const onClick = (event) => {
|
|
94
|
+
if (props.disabled) return
|
|
95
|
+
emit('click', event)
|
|
111
96
|
}
|
|
112
|
-
</script>
|
|
113
97
|
|
|
98
|
+
const onMouseEnter = () => {
|
|
99
|
+
isHover.value = true
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const onMouseLeave = () => {
|
|
103
|
+
isHover.value = false
|
|
104
|
+
}
|
|
105
|
+
</script>
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="psui-el-chips"
|
|
2
|
+
<div
|
|
3
|
+
class="psui-el-chips"
|
|
4
4
|
:class="[getComponentClass, `layout-${layout}`, `type-${type}`]"
|
|
5
|
+
v-tooltip="{
|
|
6
|
+
content: disabledText,
|
|
7
|
+
trigger: 'hover',
|
|
8
|
+
placement: 'bottom',
|
|
9
|
+
show: layout === 'disabled' && disabledText !== '' && isHovering
|
|
10
|
+
}"
|
|
11
|
+
@mouseover="isHovering = true"
|
|
12
|
+
@mouseleave="isHovering = false"
|
|
13
|
+
@click="emit('click')"
|
|
5
14
|
>
|
|
6
15
|
<input
|
|
7
16
|
@change="onChange"
|
|
@@ -10,17 +19,20 @@
|
|
|
10
19
|
:type="type"
|
|
11
20
|
:id="getInputId"
|
|
12
21
|
:checked="checked"
|
|
13
|
-
|
|
22
|
+
>
|
|
14
23
|
<label
|
|
15
24
|
:disabled="disabled"
|
|
16
25
|
:for="getInputId"
|
|
17
|
-
:class="{'checked':checked && type === 'button'}"
|
|
26
|
+
:class="{'checked': checked && type === 'button', 'layout-disabled': layout === 'disabled'}"
|
|
18
27
|
>
|
|
19
|
-
<i
|
|
28
|
+
<i
|
|
29
|
+
v-if="icon"
|
|
30
|
+
class="psui-el-chips-icon psui-el-chips-icon-prepend"
|
|
31
|
+
>{{ icon }}</i>
|
|
20
32
|
{{ label }}
|
|
21
|
-
<button
|
|
22
|
-
@click="onClose"
|
|
23
|
-
v-if="layout === 'rich'"
|
|
33
|
+
<button
|
|
34
|
+
@click="onClose"
|
|
35
|
+
v-if="layout === 'rich'"
|
|
24
36
|
class="psui-el-chips-close"
|
|
25
37
|
>
|
|
26
38
|
<span class="psui-el-chips-icon">close</span>
|
|
@@ -29,105 +41,108 @@
|
|
|
29
41
|
</div>
|
|
30
42
|
</template>
|
|
31
43
|
|
|
32
|
-
<script>
|
|
33
|
-
|
|
34
|
-
|
|
44
|
+
<script setup>
|
|
45
|
+
import { computed, useAttrs, ref } from 'vue'
|
|
46
|
+
|
|
47
|
+
import { randomString } from '../../util/GeneralFunctions.js'
|
|
48
|
+
|
|
49
|
+
const emit = defineEmits(['click', 'change', 'update:checked', 'close'])
|
|
50
|
+
|
|
51
|
+
const attrs = useAttrs()
|
|
35
52
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
* It sets if the button was checked or not checked.
|
|
72
|
-
*/
|
|
73
|
-
checked: {
|
|
74
|
-
type: Boolean,
|
|
75
|
-
default: false
|
|
76
|
-
},
|
|
77
|
-
/**
|
|
78
|
-
* It disables the chips button.
|
|
79
|
-
*/
|
|
80
|
-
disabled: {
|
|
81
|
-
type: Boolean,
|
|
82
|
-
default: false
|
|
83
|
-
},
|
|
84
|
-
/**
|
|
85
|
-
* It sets if the button is active or not.
|
|
86
|
-
*/
|
|
87
|
-
active: {
|
|
88
|
-
type: Boolean,
|
|
89
|
-
default: false
|
|
90
|
-
},
|
|
91
|
-
/**
|
|
92
|
-
* Add html attributes to the element input
|
|
93
|
-
*/
|
|
94
|
-
inputAttrs: {
|
|
95
|
-
type: Object,
|
|
96
|
-
default: () => ({})
|
|
97
|
-
},
|
|
53
|
+
const props = defineProps({
|
|
54
|
+
/**
|
|
55
|
+
* It sets the label of the chips button.
|
|
56
|
+
*/
|
|
57
|
+
label: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: '',
|
|
60
|
+
},
|
|
61
|
+
type: {
|
|
62
|
+
type: String,
|
|
63
|
+
required: true,
|
|
64
|
+
default: 'button',
|
|
65
|
+
validator: (type) => ['radio', 'checkbox', 'button'].includes(type),
|
|
66
|
+
},
|
|
67
|
+
/**
|
|
68
|
+
* It sets the layout of the chipsbutton. eg: simple, with-icon, rich.
|
|
69
|
+
*/
|
|
70
|
+
layout: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: 'simple',
|
|
73
|
+
validator: (value) => ['simple', 'with-icon', 'rich', 'disabled'].includes(value),
|
|
74
|
+
},
|
|
75
|
+
/**
|
|
76
|
+
* It sets the text key which will retrieve a icon from Google Fonts. Make sure to get the right description of your icon on https://fonts.google.com/.
|
|
77
|
+
*/
|
|
78
|
+
icon: {
|
|
79
|
+
type: String,
|
|
80
|
+
default: '',
|
|
81
|
+
},
|
|
82
|
+
/**
|
|
83
|
+
* It sets if the button was checked or not checked.
|
|
84
|
+
*/
|
|
85
|
+
checked: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: false,
|
|
98
88
|
},
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
return 'status-resting'
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
getInputId() {
|
|
109
|
-
if (this?.inputAttrs?.id) {
|
|
110
|
-
return this.inputAttrs.id
|
|
111
|
-
} else if (this?.$attrs?.id) {
|
|
112
|
-
return this.$attrs.id
|
|
113
|
-
} else {
|
|
114
|
-
return randomString(16)
|
|
115
|
-
}
|
|
116
|
-
},
|
|
89
|
+
/**
|
|
90
|
+
* It disables the chips button.
|
|
91
|
+
*/
|
|
92
|
+
disabled: {
|
|
93
|
+
type: Boolean,
|
|
94
|
+
default: false,
|
|
117
95
|
},
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
this.$emit('change', event)
|
|
125
|
-
},
|
|
126
|
-
onClose() {
|
|
127
|
-
this.$emit('close')
|
|
128
|
-
},
|
|
96
|
+
/**
|
|
97
|
+
* It sets if the button is active or not.
|
|
98
|
+
*/
|
|
99
|
+
active: {
|
|
100
|
+
type: Boolean,
|
|
101
|
+
default: false,
|
|
129
102
|
},
|
|
103
|
+
/**
|
|
104
|
+
* Add html attributes to the element input
|
|
105
|
+
*/
|
|
106
|
+
inputAttrs: {
|
|
107
|
+
type: Object,
|
|
108
|
+
default: () => ({}),
|
|
109
|
+
},
|
|
110
|
+
disabledText: {
|
|
111
|
+
type: String,
|
|
112
|
+
default: '',
|
|
113
|
+
}
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
const isHovering = ref(false)
|
|
117
|
+
|
|
118
|
+
const getComponentClass = computed(() => {
|
|
119
|
+
if (props.disabled) {
|
|
120
|
+
return 'status-disabled'
|
|
121
|
+
} else {
|
|
122
|
+
return 'status-resting'
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
const getInputId = computed(() => {
|
|
127
|
+
if (props?.inputAttrs?.id) {
|
|
128
|
+
return props.inputAttrs.id
|
|
129
|
+
} else if (attrs?.id) {
|
|
130
|
+
return attrs.id
|
|
131
|
+
} else {
|
|
132
|
+
return randomString(16)
|
|
133
|
+
}
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
const onChange = (event) => {
|
|
137
|
+
emit('update:checked', event.target.checked)
|
|
138
|
+
emit('change', event)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const onClose = () => {
|
|
142
|
+
emit('close')
|
|
130
143
|
}
|
|
131
144
|
</script>
|
|
132
145
|
|
|
133
|
-
<style>
|
|
146
|
+
<style>
|
|
147
|
+
/* Please, use the file src/assets/scss/components/PsChips.scss */
|
|
148
|
+
</style>
|