@policystudio/policy-studio-ui-vue 1.0.19 → 1.0.23
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/.eslintrc.js +1 -2
- package/.storybook/main.js +10 -2
- package/.storybook/preview.js +1 -1
- package/README.md +8 -0
- package/babel.config.js +3 -0
- package/backup-package-lock.json +37194 -0
- package/dist/css/psui_styles.css +15709 -14658
- package/package.json +32 -21
- package/postcss.config.js +2 -0
- package/src/assets/scss/base.scss +9 -29
- package/src/assets/scss/components/PsAccordion.scss +63 -0
- package/src/assets/scss/components/PsButton.scss +145 -0
- package/src/assets/scss/components/PsInput.scss +104 -0
- package/src/components/accordion/PsAccordion.vue +30 -21
- package/src/components/accordion/PsAccordionItem.vue +29 -67
- package/src/components/badges-and-tags/PsCardInfos.vue +38 -0
- package/src/components/badges-and-tags/PsChartLegend.vue +43 -0
- package/src/components/badges-and-tags/PsClimateZoneBadge.vue +18 -0
- package/src/components/badges-and-tags/PsCostEffectBar.vue +114 -0
- package/src/components/badges-and-tags/PsHighlightRippleDot.vue +78 -0
- package/src/components/badges-and-tags/PsMiniTag.vue +46 -0
- package/src/components/badges-and-tags/PsProgressBar.vue +0 -0
- package/src/components/buttons/PsButton.vue +43 -75
- package/src/components/chips/PsChips.vue +46 -38
- package/src/components/controls/PsCheckbox.vue +29 -16
- package/src/components/controls/PsDraggable.vue +174 -3
- package/src/components/controls/PsRadioButton.vue +74 -43
- package/src/components/controls/PsSwitch.vue +75 -76
- package/src/components/controls/PsToggle.vue +1 -1
- package/src/components/datatable/PsDataTable.vue +25 -29
- package/src/components/datatable/PsDataTableItem.vue +2 -2
- package/src/components/forms/PsInput.vue +122 -102
- package/src/components/notifications/PsDialog.vue +37 -18
- package/src/components/tabs/PsTabHeader.vue +3 -2
- package/src/components/tooltip/PsDialogTooltip.vue +79 -0
- package/src/components/tooltip/PsRichTooltip.vue +44 -0
- package/src/components/tooltip/PsTooltip.vue +118 -0
- package/src/components/ui/PsIcon.vue +87 -24
- package/src/index.js +29 -9
- package/src/stories/Accordion.stories.js +88 -28
- package/src/stories/Button.stories.js +86 -38
- package/src/stories/CardInfos.stories.js +16 -0
- package/src/stories/ChartLegend.stories.js +16 -0
- package/src/stories/Checkbox.stories.js +6 -6
- package/src/stories/Chips.stories.js +14 -8
- package/src/stories/ClimateZoneBadge.stories.js +24 -0
- package/src/stories/Colors.stories.mdx +35 -35
- package/src/stories/CostEffectBar.stories.js +23 -0
- package/src/stories/Datatable.stories.js +15 -8
- package/src/stories/Dialog.stories.js +150 -17
- package/src/stories/Draggable.stories.js +22 -0
- package/src/stories/Dropdown.stories.js +8 -10
- package/src/stories/HighlightRippleDot.stories.js +16 -0
- package/src/stories/Input.stories.js +71 -19
- package/src/stories/MiniTag.stories.js +46 -0
- package/src/stories/ProgressBar.stories.js +23 -0
- package/src/stories/RadioButton.stories.js +15 -15
- package/src/stories/Slider.stories.js +9 -9
- package/src/stories/Swith.stories.js +10 -10
- package/src/stories/TabHeader.stories.js +9 -9
- package/src/stories/Toast.stories.js +13 -13
- package/src/stories/Toggle.stories.js +12 -13
- package/src/stories/Tooltip.stories.js +114 -0
- package/src/util/GeneralFunctions.js +11 -12
- package/src/util/imageLoader.js +50 -0
- package/tailwind.config.js +71 -47
- package/src/assets/scss/tailwind.css +0 -70643
- package/src/assets/scss/tailwind.scss +0 -61088
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<table :class='cssAlign' class='table psui-w-full psui-border-2 psui-border-gray-10' >
|
|
3
3
|
<thead v-if="header">
|
|
4
4
|
<th
|
|
5
5
|
v-for="head in header"
|
|
6
6
|
:key="head"
|
|
7
|
-
|
|
7
|
+
class='psui-bg-gray-10 psui-text-gray-80 psui-capitalize psui-font-bold'
|
|
8
8
|
>
|
|
9
9
|
{{ head }}
|
|
10
10
|
</th>
|
|
@@ -21,26 +21,26 @@
|
|
|
21
21
|
<th
|
|
22
22
|
v-for="ft in footer"
|
|
23
23
|
:key="ft"
|
|
24
|
-
|
|
24
|
+
class='psui-bg-gray-10 psui-text-gray-80'
|
|
25
25
|
>
|
|
26
26
|
{{ ft }}
|
|
27
27
|
</th>
|
|
28
28
|
</tfoot>
|
|
29
|
-
</
|
|
29
|
+
</table>
|
|
30
30
|
</template>
|
|
31
31
|
|
|
32
32
|
<script>
|
|
33
|
-
export const type = [
|
|
34
|
-
export const alignment = [
|
|
33
|
+
export const type = ['simple', 'rich']
|
|
34
|
+
export const alignment = ['center', 'right', 'left']
|
|
35
35
|
|
|
36
36
|
export default {
|
|
37
|
-
name:
|
|
37
|
+
name: 'PsDataTable',
|
|
38
38
|
props: {
|
|
39
39
|
type: {
|
|
40
40
|
type: String,
|
|
41
41
|
required: true,
|
|
42
42
|
validator: (value) => {
|
|
43
|
-
return [
|
|
43
|
+
return ['simple', 'rich'].indexOf(value) !== -1
|
|
44
44
|
},
|
|
45
45
|
},
|
|
46
46
|
header: {
|
|
@@ -49,45 +49,41 @@ export default {
|
|
|
49
49
|
},
|
|
50
50
|
data: {
|
|
51
51
|
type: Array,
|
|
52
|
-
|
|
53
|
-
return []
|
|
54
|
-
}
|
|
52
|
+
required: true
|
|
55
53
|
},
|
|
56
54
|
footer: {
|
|
57
55
|
type: Array,
|
|
58
|
-
default: () => {
|
|
59
|
-
return []
|
|
60
|
-
}
|
|
61
56
|
},
|
|
62
57
|
align: {
|
|
63
58
|
type: String,
|
|
64
|
-
default:
|
|
59
|
+
default: 'left',
|
|
60
|
+
validator: (value) => {
|
|
61
|
+
return ['center', 'right', 'left'].indexOf(value) !== -1
|
|
62
|
+
}
|
|
65
63
|
},
|
|
64
|
+
cssStyle: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: 'psui-text-gray-60'
|
|
67
|
+
}
|
|
66
68
|
},
|
|
67
69
|
computed: {
|
|
68
70
|
cssAlign() {
|
|
69
|
-
if (this.align ===
|
|
70
|
-
if (this.align ===
|
|
71
|
-
return
|
|
71
|
+
if (this.align === 'right') return `psui-text-right ${this.cssStyle}`
|
|
72
|
+
if (this.align === 'center') return `psui-text-center ${this.cssStyle}`
|
|
73
|
+
return `psui-text-left ${this.cssStyle}`
|
|
72
74
|
},
|
|
73
75
|
},
|
|
74
76
|
}
|
|
75
77
|
</script>
|
|
76
78
|
|
|
77
|
-
<style>
|
|
78
|
-
.table {
|
|
79
|
-
width: fit-content;
|
|
80
|
-
border: 1px solid #e6ecf2;
|
|
81
|
-
border-radius: 4px;
|
|
82
|
-
}
|
|
79
|
+
<style scoped>
|
|
83
80
|
|
|
84
|
-
th,
|
|
85
|
-
td,
|
|
86
|
-
tr {
|
|
81
|
+
.table th,
|
|
82
|
+
.table td,
|
|
83
|
+
.table tr {
|
|
87
84
|
height: 40px;
|
|
88
85
|
border: 1px solid #e6ecf2;
|
|
89
86
|
padding: 11px 16px;
|
|
90
|
-
font-weight: 400;
|
|
91
|
-
color: #515e6a;
|
|
92
87
|
}
|
|
88
|
+
|
|
93
89
|
</style>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<tbody v-if="data">
|
|
3
|
-
<tr v-for="(dt, index) in data" :key="index">
|
|
4
|
-
<td v-for="(el, elIndex) in dt" :key="elIndex">
|
|
3
|
+
<tr v-for="(dt, index) in data" :key="index" >
|
|
4
|
+
<td v-for="(el, elIndex) in dt" :key="elIndex" class="psui-px-4 psui-py-2">
|
|
5
5
|
<div class="psui-flex psui-gap-1 psui-items-center">
|
|
6
6
|
<span class="psui-text-gray-80">
|
|
7
7
|
{{ el[Object.keys(el)[1]].toFixed(3) }}
|
|
@@ -1,102 +1,122 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
},
|
|
67
|
-
value: {
|
|
68
|
-
required: true,
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div class="psui-el-input" :class="[getComponentClass, `layout-${layout}`]" >
|
|
3
|
+
|
|
4
|
+
<label v-if="label"> {{ label }} </label>
|
|
5
|
+
|
|
6
|
+
<div
|
|
7
|
+
class="psui-el-input-wrapper"
|
|
8
|
+
@mouseenter="isHoveringInputWrapper = true"
|
|
9
|
+
@mouseleave="isHoveringInputWrapper = false"
|
|
10
|
+
:class="{ 'hover' : isHoveringInputWrapper }"
|
|
11
|
+
>
|
|
12
|
+
|
|
13
|
+
<div v-if="$slots.prepend" class="psui-el-input-prepend">
|
|
14
|
+
<slot name="prepend"></slot>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<input
|
|
18
|
+
:type="type"
|
|
19
|
+
:placeholder="placeholder"
|
|
20
|
+
:disabled="disabled"
|
|
21
|
+
:value="value"
|
|
22
|
+
@focus="onInputFocus"
|
|
23
|
+
@blur="onInputBlur"
|
|
24
|
+
@input="$emit('input', $event)"
|
|
25
|
+
@keydown="$emit('keydown', $event)"
|
|
26
|
+
@change="$emit('change', $event)"
|
|
27
|
+
v-bind="getAttrs"
|
|
28
|
+
:class="{ 'focus': isFocus }"
|
|
29
|
+
/>
|
|
30
|
+
|
|
31
|
+
<div v-if="$slots.append || hasError" class="psui-el-input-append">
|
|
32
|
+
<span v-if="hasError" class="material-icons psui-text-red-20 material-icons-sharp">error</span>
|
|
33
|
+
<slot v-else name="append"></slot>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<p v-if="hint || (hasError && typeof hasError === 'string')" class="psui-el-input-hint">
|
|
39
|
+
{{ typeof hasError === 'string' ? hasError : hint }}
|
|
40
|
+
</p>
|
|
41
|
+
|
|
42
|
+
</div>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<script>
|
|
46
|
+
export default {
|
|
47
|
+
name: 'PsInput',
|
|
48
|
+
props: {
|
|
49
|
+
type: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: 'text'
|
|
52
|
+
},
|
|
53
|
+
placeholder: {
|
|
54
|
+
type: String
|
|
55
|
+
},
|
|
56
|
+
label: {
|
|
57
|
+
type: String
|
|
58
|
+
},
|
|
59
|
+
hint: {
|
|
60
|
+
type: String
|
|
61
|
+
},
|
|
62
|
+
layout: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: 'default',
|
|
65
|
+
validator: (value) => ['default', 'mini'].includes(value)
|
|
66
|
+
},
|
|
67
|
+
value: {
|
|
68
|
+
required: true,
|
|
69
|
+
},
|
|
70
|
+
disabled: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
default: false
|
|
73
|
+
},
|
|
74
|
+
hasError: {
|
|
75
|
+
type: [String, Boolean],
|
|
76
|
+
default: false
|
|
77
|
+
},
|
|
78
|
+
active: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
default: false
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
data: () => ({
|
|
84
|
+
isHoveringInputWrapper: false,
|
|
85
|
+
isFocus: false,
|
|
86
|
+
}),
|
|
87
|
+
computed: {
|
|
88
|
+
getAttrs() {
|
|
89
|
+
const defaultAttrs = {
|
|
90
|
+
autocapitalize: 'sentences',
|
|
91
|
+
autocomplete: 'chrome-off',
|
|
92
|
+
autocorrect: 'off',
|
|
93
|
+
spellcheck: 'spellcheck'
|
|
94
|
+
}
|
|
95
|
+
return { ...defaultAttrs, ...this.$attrs }
|
|
96
|
+
},
|
|
97
|
+
getComponentClass() {
|
|
98
|
+
if (this.disabled) {
|
|
99
|
+
return 'status-disabled'
|
|
100
|
+
} else if (this.hasError) {
|
|
101
|
+
return 'status-error'
|
|
102
|
+
} else if (this.isFocus || this.isTyping || this.active ) {
|
|
103
|
+
return 'status-active'
|
|
104
|
+
} else {
|
|
105
|
+
return 'status-resting'
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
methods: {
|
|
110
|
+
onInputFocus($event) {
|
|
111
|
+
this.isFocus = true
|
|
112
|
+
this.$emit('focus', $event)
|
|
113
|
+
},
|
|
114
|
+
onInputBlur($event) {
|
|
115
|
+
this.isFocus = false
|
|
116
|
+
this.$emit('blur', $event)
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
</script>
|
|
121
|
+
|
|
122
|
+
<style> /* Please, use the file src/assets/scss/components/PsInput.scss */</style>
|
|
@@ -1,38 +1,57 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
<div class="psui-flex psui-justify-between psui-pr-3 psui-pl-2 psui-py-2 psui-rounded-md" :class="getDialogColor">
|
|
3
|
+
<div class="psui-flex psui-justify-between psui-gap-2">
|
|
4
|
+
<i class="material-icons-round">info</i>
|
|
5
|
+
<div class="psui-flex psui-flex-col">
|
|
6
|
+
<p v-if="message" class="psui-w-full">{{ message }}</p>
|
|
7
|
+
<slot v-else name="content"></slot>
|
|
8
|
+
<slot v-if="layout === 'vertical'" name="action"></slot>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="psui-flex psui-gap-3">
|
|
12
|
+
<slot v-if="layout === 'horizontal'" name="action"></slot>
|
|
13
|
+
<button @click="onClose" class="psui-w-4 psui-h-4 focus:psui-outline-none hover:opacity-70 transition-default">
|
|
14
|
+
<i class="material-icons-round">close</i>
|
|
15
|
+
</button>
|
|
16
|
+
</div>
|
|
6
17
|
</div>
|
|
7
18
|
</template>
|
|
8
19
|
|
|
9
20
|
<script>
|
|
10
|
-
|
|
21
|
+
|
|
11
22
|
export default {
|
|
12
23
|
name: 'PsDialog',
|
|
13
24
|
props: {
|
|
14
|
-
|
|
25
|
+
status: {
|
|
15
26
|
type: String,
|
|
16
27
|
default: 'informative',
|
|
17
|
-
validator: (value) =>
|
|
28
|
+
validator: (value) => ['informative', 'success', 'alert'].includes(value)
|
|
18
29
|
},
|
|
19
30
|
message: {
|
|
20
31
|
type: String,
|
|
21
|
-
|
|
32
|
+
},
|
|
33
|
+
layout:{
|
|
34
|
+
type: String,
|
|
35
|
+
default: 'horizontal',
|
|
36
|
+
validator: (value) => ['horizontal', 'vertical'].includes(value)
|
|
37
|
+
},
|
|
38
|
+
cssClass:{
|
|
39
|
+
type: String
|
|
22
40
|
}
|
|
23
41
|
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
42
|
+
emits:['close'],
|
|
43
|
+
computed: {
|
|
44
|
+
getDialogColor() {
|
|
45
|
+
let dialogColor = ''
|
|
46
|
+
if(this.status === 'informative') dialogColor = `psui-bg-blue-20 psui-text-blue-60 ${this.cssClass}`
|
|
47
|
+
if(this.status === 'success') dialogColor = `psui-bg-green-10 psui-text-green-70 ${this.cssClass}`
|
|
48
|
+
if(this.status === 'alert') dialogColor = `psui-bg-yellow-10 psui-text-yellow-70 ${this.cssClass}`
|
|
49
|
+
return dialogColor
|
|
31
50
|
}
|
|
32
51
|
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
52
|
+
methods:{
|
|
53
|
+
onClose(){
|
|
54
|
+
this.$emit('close')
|
|
36
55
|
}
|
|
37
56
|
}
|
|
38
57
|
}
|
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
:key="item[keyValue]"
|
|
7
7
|
@click="selectTab(item)"
|
|
8
8
|
:class="[
|
|
9
|
+
'transition-default',
|
|
9
10
|
classes,
|
|
10
11
|
{ 'psui-bg-blue-60 psui-text-white': getSelected === item[keyValue] && theme === 'standard' },
|
|
11
|
-
{ 'psui-border-
|
|
12
|
+
{ 'psui-border-blue-60 psui-text-blue-60': getSelected === item[keyValue] && theme === 'underline' },
|
|
12
13
|
{ 'psui-text-blue-60 psui-font-bold psui-bg-white hover:psui-text-blue-60': getSelected === item[keyValue] && theme === 'folder' }
|
|
13
14
|
]"
|
|
14
15
|
>
|
|
@@ -53,7 +54,7 @@ export default {
|
|
|
53
54
|
},
|
|
54
55
|
classes() {
|
|
55
56
|
if (this.theme === 'underline') {
|
|
56
|
-
return 'psui-text-gray-60 psui-pb-3 hover:psui-text-blue-60'
|
|
57
|
+
return 'psui-text-gray-60 psui-pb-3 psui-text-small psui-border-b-2 psui-border-transparent psui-font-bold hover:psui-text-blue-60'
|
|
57
58
|
}
|
|
58
59
|
if (this.theme === 'folder') {
|
|
59
60
|
return 'psui-bg-gray-10 psui-text-gray-50 psui-py-2 psui-px-4 psui-rounded-t-lg hover:psui-text-gray-60 active:psui-text-blue-60'
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<PsTooltip :cssClass="getCssClass.content" :title="title">
|
|
3
|
+
<template v-slot:trigger>
|
|
4
|
+
<slot></slot>
|
|
5
|
+
</template>
|
|
6
|
+
<template
|
|
7
|
+
v-slot:dialog
|
|
8
|
+
class="psui-flex psui-fkex-col psui-gap-3 psui-items-start"
|
|
9
|
+
>
|
|
10
|
+
<p :class="type === 'white' ? 'psui-text-gray-50' : ''">{{ text }}</p>
|
|
11
|
+
<button
|
|
12
|
+
v-if="buttonText"
|
|
13
|
+
class="psui-py-2 psui-px-4 psui-rounded-md"
|
|
14
|
+
:class="getCssClass.button"
|
|
15
|
+
@click="onClick"
|
|
16
|
+
>
|
|
17
|
+
{{ buttonText }}
|
|
18
|
+
</button>
|
|
19
|
+
</template>
|
|
20
|
+
</PsTooltip>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
import PsTooltip from "./PsTooltip.vue"
|
|
25
|
+
|
|
26
|
+
export default {
|
|
27
|
+
name: "PsDialogTooltip",
|
|
28
|
+
components: { PsTooltip },
|
|
29
|
+
props: {
|
|
30
|
+
text: {
|
|
31
|
+
type: String,
|
|
32
|
+
},
|
|
33
|
+
title: {
|
|
34
|
+
type: String,
|
|
35
|
+
},
|
|
36
|
+
buttonText: {
|
|
37
|
+
type: String,
|
|
38
|
+
},
|
|
39
|
+
type: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: "white",
|
|
42
|
+
validator: (value) => ["white", "dark", "color"].includes(value),
|
|
43
|
+
},
|
|
44
|
+
cssClass: {
|
|
45
|
+
type: String,
|
|
46
|
+
required: false,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
emits: ["click"],
|
|
50
|
+
computed: {
|
|
51
|
+
getCssClass() {
|
|
52
|
+
|
|
53
|
+
if (this.type === "dark")
|
|
54
|
+
return {
|
|
55
|
+
content: `psui-bg-blue-70 psui-text-white ${this.cssClass}`,
|
|
56
|
+
button: `psui-bg-blue-60 psui-text-white`,
|
|
57
|
+
}
|
|
58
|
+
if (this.type === "color")
|
|
59
|
+
return {
|
|
60
|
+
content: `psui-bg-blue-50 psui-text-white ${this.cssClass}`,
|
|
61
|
+
button: `psui-bg-blue-60 psui-text-white`,
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return { content: `psui-bg-white psui-text-gray-80 ${this.cssClass}`, button: `psui-bg-blue-20 psui-text-blue-60`,}
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
methods: {
|
|
68
|
+
onClick() {
|
|
69
|
+
this.$emit("click")
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
}
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<style scoped>
|
|
76
|
+
button {
|
|
77
|
+
width: fit-content;
|
|
78
|
+
}
|
|
79
|
+
</style>>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<PsTooltip :cssClass="`${textColorClass} ${cssClass}`" :title="title">
|
|
3
|
+
<template v-slot:trigger>
|
|
4
|
+
<slot></slot>
|
|
5
|
+
</template>
|
|
6
|
+
<template v-slot:dialog>
|
|
7
|
+
<p v-if="text">{{text}}</p>
|
|
8
|
+
</template>
|
|
9
|
+
</PsTooltip>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
import PsTooltip from "../tooltip/PsTooltip.vue"
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
name: "PsRichTooltip",
|
|
17
|
+
components: { PsTooltip },
|
|
18
|
+
props: {
|
|
19
|
+
title: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: "",
|
|
22
|
+
},
|
|
23
|
+
type: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: "gray",
|
|
26
|
+
validator: (type) => ["gray", "red", "blue"].includes(type),
|
|
27
|
+
},
|
|
28
|
+
text: {
|
|
29
|
+
type: String,
|
|
30
|
+
},
|
|
31
|
+
cssClass: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: "",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
computed: {
|
|
37
|
+
textColorClass() {
|
|
38
|
+
if (this.type === "red") return `psui-text-red-70 psui-bg-red-10 `
|
|
39
|
+
if (this.type === "blue") return `psui-bg-blue-70 psui-text-white`
|
|
40
|
+
return `psui-text-gray-80 psui-bg-gray-30 `
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
}
|
|
44
|
+
</script>
|