@policystudio/policy-studio-ui-vue 1.0.26 → 1.0.30

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.
Files changed (74) hide show
  1. package/dist/css/psui_styles.css +6011 -496
  2. package/package.json +1 -1
  3. package/src/assets/scss/base.scss +40 -3
  4. package/src/assets/scss/components/PsButton.scss +115 -117
  5. package/src/assets/scss/components/PsCardInfos.scss +26 -0
  6. package/src/assets/scss/components/PsChartLegend.scss +25 -0
  7. package/src/assets/scss/components/PsCheckbox.scss +96 -0
  8. package/src/assets/scss/components/PsChips.scss +155 -0
  9. package/src/assets/scss/components/PsClimateZoneBadge.scss +26 -0
  10. package/src/assets/scss/components/PsCostEffectBar.scss +26 -0
  11. package/src/assets/scss/components/PsDataTable.scss +50 -0
  12. package/src/assets/scss/components/PsDialog.scss +10 -1
  13. package/src/assets/scss/components/PsDotLoader.scss +45 -0
  14. package/src/assets/scss/components/PsDropdown.scss +44 -0
  15. package/src/assets/scss/components/PsHighlightRippleDot.scss +48 -0
  16. package/src/assets/scss/components/PsInlineSelector.scss +96 -0
  17. package/src/assets/scss/components/PsInputSelect.scss +104 -0
  18. package/src/assets/scss/components/PsInputTextArea.scss +49 -0
  19. package/src/assets/scss/components/PsMiniTag.scss +36 -0
  20. package/src/assets/scss/components/PsProgressBar.scss +24 -0
  21. package/src/assets/scss/components/PsRadioButton.scss +78 -0
  22. package/src/assets/scss/components/PsSlider.scss +11 -0
  23. package/src/assets/scss/components/PsSwitch.scss +66 -0
  24. package/src/assets/scss/components/PsTabHeader.scss +10 -3
  25. package/src/assets/scss/components/PsToast.scss +52 -0
  26. package/src/assets/scss/components/PsToggle.scss +23 -0
  27. package/src/assets/scss/components/PsTooltip.scss +118 -0
  28. package/src/components/badges-and-tags/PsCardInfos.vue +14 -7
  29. package/src/components/badges-and-tags/PsChartLegend.vue +7 -13
  30. package/src/components/badges-and-tags/PsClimateZoneBadge.vue +15 -6
  31. package/src/components/badges-and-tags/PsCostEffectBar.vue +32 -70
  32. package/src/components/badges-and-tags/PsHighlightRippleDot.vue +3 -69
  33. package/src/components/badges-and-tags/PsMiniTag.vue +15 -24
  34. package/src/components/badges-and-tags/PsProgressBar.vue +42 -0
  35. package/src/components/buttons/PsButton.vue +78 -78
  36. package/src/components/chips/PsChips.vue +45 -87
  37. package/src/components/controls/PsCheckbox.vue +58 -134
  38. package/src/components/controls/PsInlineSelector.vue +123 -0
  39. package/src/components/controls/PsRadioButton.vue +33 -88
  40. package/src/components/controls/PsSlider.vue +5 -6
  41. package/src/components/controls/PsSwitch.vue +29 -81
  42. package/src/components/controls/PsToggle.vue +45 -39
  43. package/src/components/datatable/PsDataTable.vue +3 -15
  44. package/src/components/forms/PsDropdown.vue +28 -12
  45. package/src/components/forms/PsDropdownCopy.vue +212 -0
  46. package/src/components/forms/PsInputSelect.vue +88 -0
  47. package/src/components/forms/PsInputTextArea.vue +80 -0
  48. package/src/components/notifications/PsDialog.vue +3 -0
  49. package/src/components/notifications/PsToast.vue +16 -28
  50. package/src/components/tabs/PsTabHeader.vue +30 -12
  51. package/src/components/tooltip/PsDialogTooltip.vue +6 -31
  52. package/src/components/tooltip/PsRichTooltip.vue +37 -44
  53. package/src/components/tooltip/PsTooltip.vue +18 -28
  54. package/src/components/ui/PsDotLoader.vue +15 -0
  55. package/src/components/ui/PsIcon.vue +9 -9
  56. package/src/index.js +17 -4
  57. package/src/stories/Button.stories.js +102 -112
  58. package/src/stories/Checkbox.stories.js +34 -37
  59. package/src/stories/Chips.stories.js +43 -54
  60. package/src/stories/ClimateZoneBadge.stories.js +0 -7
  61. package/src/stories/Colors.stories.mdx +1 -0
  62. package/src/stories/Dialog.stories.js +1 -1
  63. package/src/stories/InlineSelector.stories.js +18 -0
  64. package/src/stories/InputSelect.stories.js +30 -0
  65. package/src/stories/InputTextArea.stories.js +25 -0
  66. package/src/stories/MiniTag.stories.js +12 -6
  67. package/src/stories/RadioButton.stories.js +32 -29
  68. package/src/stories/Switch.stories.js +33 -0
  69. package/src/stories/Toast.stories.js +40 -46
  70. package/src/stories/Tooltip.stories.js +86 -86
  71. package/tailwind.config.js +8 -1
  72. package/src/assets/images/check-checkbox-button.svg +0 -1
  73. package/src/assets/images/radio-checked-button.svg +0 -1
  74. package/src/stories/Swith.stories.js +0 -38
@@ -0,0 +1,212 @@
1
+ <template>
2
+ <div class="background-temporary">
3
+ <div
4
+ class="psui-el-dropdown-menu"
5
+ ref="PSDropdown"
6
+ >
7
+
8
+ <div class="psui-bg-red" ref="PSDropdownTrigger" v-if="$slots.dropdownTrigger" @click="show && !toggleWhenActive ? '' : toggle()" >
9
+ <slot name="dropdownTrigger" ></slot>
10
+ </div>
11
+
12
+ <button
13
+ v-else
14
+ @click="show && !toggleWhenActive ? '' : toggle()"
15
+ type="button"
16
+ class="psui-el-dropdown-menu-button"
17
+ :class="[buttonClasses]"
18
+ :id="id"
19
+ aria-haspopup="true"
20
+ aria-expanded="true"
21
+ ref="PSDropdownTrigger"
22
+ >
23
+ <slot v-if="show && $slots.buttonLabelOnShow" name="buttonLabelOnShow"></slot>
24
+ <slot v-else name="buttonLabel"></slot>
25
+ </button>
26
+
27
+ <div
28
+ ref="PSDropdownDialog"
29
+ role="menu"
30
+ class="psui-el-dropdown-menu-dialog"
31
+ aria-orientation="vertical"
32
+ :aria-labelledby="id"
33
+ :class="[dialogClasses]"
34
+ :style="{ minWidth: minWidthDropdown, marginLeft: marginLeft }"
35
+ >
36
+
37
+ <div class="psui-el-dropdown-menu-dialog-category-divider">
38
+ <h2 class="ts--accent--1" v-if="title">{{ title }}</h2>
39
+ <slot name="items"></slot>
40
+ </div>
41
+
42
+ </div>
43
+ </div>
44
+ </div>
45
+ </template>
46
+
47
+ <script>
48
+ import { randomString, getParentScrollableEl } from '../../util/GeneralFunctions'
49
+
50
+ export default {
51
+ name: 'PsDropdown',
52
+ props: {
53
+ buttonClasses: {
54
+ type: String,
55
+ default: 'psui-bg-white psui-border psui-border-blue'
56
+ },
57
+ title: {
58
+ type: String,
59
+ },
60
+ dialogClasses: {
61
+ type: String,
62
+ default: 'psui-p-6 psui-left-0 psui-bg-white'
63
+ },
64
+ minWidthDropdown: {
65
+ type: [String, Number],
66
+ },
67
+ maxWidthDropDown: {
68
+ type: String,
69
+ default: '340px'
70
+ },
71
+ buttonLabelOnShow: {
72
+ type: Boolean,
73
+ default: false
74
+ },
75
+ toggleWhenActive: {
76
+ type: Boolean,
77
+ default: true
78
+ },
79
+ },
80
+ data() {
81
+ return {
82
+ show: false,
83
+ id: randomString(8),
84
+ marginLeft: '-0px',
85
+ scrollableParentEl : null
86
+ }
87
+ },
88
+ computed: {
89
+ getMaxWidth() {
90
+ let bounds = this.$refs.PSDropdown.getBoundingClientRect()
91
+ return (document.documentElement.clientWidth - bounds['left']) -30
92
+ }
93
+ },
94
+ beforeDestroy() {
95
+ this.unwatchParentScrolling()
96
+ },
97
+ methods: {
98
+ toggle() {
99
+ if (!this.show) {
100
+ this.open()
101
+ } else {
102
+ this.close()
103
+ }
104
+ },
105
+ watchParentScrolling() {
106
+ this.scrollableParentEl = getParentScrollableEl(this.$refs.PSDropdown)
107
+ if (this.scrollableParentEl) {
108
+ this.scrollableParentEl.addEventListener('scroll', this.updatePosition)
109
+ }
110
+ },
111
+ unwatchParentScrolling() {
112
+ if (this.scrollableParentEl) {
113
+ this.scrollableParentEl.removeEventListener('scroll', this.updatePosition)
114
+ }
115
+ },
116
+ updatePosition() {
117
+
118
+ const PSDropdownDialog = this.$refs.PSDropdownDialog
119
+ const PSDropdownTrigger = this.$refs.PSDropdownTrigger
120
+ if (!PSDropdownDialog || !PSDropdownTrigger) return
121
+
122
+ const rectTrigger = PSDropdownTrigger.getBoundingClientRect()
123
+ const rectDialog = PSDropdownDialog.getBoundingClientRect()
124
+ const windowWidth = document.documentElement.clientWidth
125
+
126
+ PSDropdownDialog.style.position = 'fixed'
127
+ PSDropdownDialog.style.top = `${rectTrigger.y + rectTrigger.height }px`
128
+
129
+ if (( rectTrigger.x + rectDialog.width + 20 ) > windowWidth ) {
130
+ PSDropdownDialog.style.left = `${windowWidth - rectDialog.width - 30}px`
131
+ } else {
132
+ PSDropdownDialog.style.left = `${rectTrigger.x}px`
133
+ }
134
+
135
+ if(rectTrigger.top < 10) {
136
+ this.close()
137
+ console.warn('The dropdown are too close from the top of the page')
138
+ return
139
+ }
140
+
141
+ setTimeout(() => { PSDropdownDialog.style.opacity = 1 }, 10)
142
+
143
+ },
144
+ open() {
145
+ this.$emit('open')
146
+ this.show = true
147
+ this.$refs.PSDropdownDialog.style.opacity = 0
148
+ this.$refs.PSDropdownDialog.style.display = 'block'
149
+ setTimeout(() => {
150
+ this.updatePosition()
151
+ this.watchParentScrolling()
152
+ document.addEventListener("keyup", this.handleEsc)
153
+ window.addEventListener("resize", this.updatePosition)
154
+ window.addEventListener("click", this.clickOutside)
155
+ }, 10)
156
+ },
157
+ close() {
158
+ if (this.show) {
159
+ this.$emit('close')
160
+ this.$refs.PSDropdownDialog.style.display = 'none'
161
+ this.$refs.PSDropdownDialog.style.opacity = 0
162
+ this.show = false
163
+ this.unwatchParentScrolling()
164
+ }
165
+ document.removeEventListener("keyup", this.handleEsc)
166
+ document.removeEventListener("resize", this.updatePosition)
167
+ document.removeEventListener("click", this.clickOutside)
168
+ },
169
+ handleEsc(evt) {
170
+ if (this.show && evt.keyCode === 27) this.close()
171
+ },
172
+ clickOutside(event) {
173
+ if(!this.show) return
174
+ if (!(this.$refs.PSDropdown == event.target || this.$refs.PSDropdown.contains(event.target))) {
175
+ this.close()
176
+ }
177
+ }
178
+ }
179
+ }
180
+ </script>
181
+
182
+ <style>
183
+
184
+ .background-temporary {
185
+ width: 300px;
186
+ height: 200px;
187
+ left: 0;
188
+ top: 8px;
189
+
190
+ background-color: #e6ecf2;
191
+ border: 1.5px dashed #7b61ff;
192
+ display: flex;
193
+ align-items: center;
194
+ justify-content: center;
195
+ }
196
+
197
+ /* .dropdown-button {
198
+ background-color: transparent;
199
+ padding-top: 2.5px;
200
+ padding-bottom: 2.5px;
201
+ min-height: 27px;
202
+ } */
203
+
204
+ /* .dropdown-button:focus {
205
+ outline: none;
206
+ } */
207
+
208
+ /* .psui-dropdown-dialog {
209
+ transition: opacity 150ms ease-in-out;
210
+ } */
211
+
212
+ </style>
@@ -0,0 +1,88 @@
1
+ <template>
2
+ <div class="psui-el-input-select" :class="[{'disabled':disabled}, getComponentClass, {'selected':selectedClass}]">
3
+ <label :for='label' v-if="label" >{{ label }}</label>
4
+ <select
5
+ :name="label"
6
+ :id="label"
7
+ v-model="childValue"
8
+ >
9
+ <option value='' disabled>Select</option>
10
+ <option v-for="item in getItems" :value="item[keyValue]" :key="item[keyValue]">{{ item[keyLabel] }}</option>
11
+ </select>
12
+ <p v-if="optionalLabel && !disabled && layout !== 'mini'" class="psui-el-input-helper">{{ optionalLabel }}</p>
13
+ </div>
14
+ </template>
15
+
16
+ <script>
17
+
18
+ export default {
19
+ name: 'PsSelectInput',
20
+ props: {
21
+ items: {
22
+ required: true
23
+ },
24
+ value: {
25
+ default: '',
26
+ required: true
27
+ },
28
+ label: {
29
+ default: ''
30
+ },
31
+ optionalLabel:{
32
+ default:''
33
+ },
34
+ keyLabel: {
35
+ default: 'label'
36
+ },
37
+ keyValue: {
38
+ default: 'value'
39
+ },
40
+ disabled: {
41
+ type: Boolean,
42
+ default: false
43
+ },
44
+ layout:{
45
+ type: String,
46
+ default: 'default',
47
+ validator: (value) => ['default','mini'].includes(value)
48
+ }
49
+ },
50
+ data(){
51
+ return {
52
+ selectedClass: false,
53
+ }
54
+ },
55
+ computed: {
56
+ getComponentClass(){
57
+ return `layout-${this.layout}`
58
+ },
59
+ childValue: {
60
+ get() {
61
+ return this.value
62
+ },
63
+ set(value) {
64
+ if(this.isString) return this.$emit('input', value)
65
+ const finded = find(this.items, { [this.keyValue]: value })
66
+ this.$emit('input', value)
67
+ this.$emit('change', finded)
68
+ this.selectedClass = true
69
+ }
70
+ },
71
+ isString() {
72
+ return this.items.length > 0 && typeof this.items[0] === 'string'
73
+ },
74
+ getItems() {
75
+ if (this.items.length > 0 && typeof this.items[0] === 'string') {
76
+ return this.items.map((item) => {
77
+ return {
78
+ [this.keyLabel]: item,
79
+ [this.keyValue]: item,
80
+ }
81
+ })
82
+ } else {
83
+ return this.items
84
+ }
85
+ },
86
+ },
87
+ }
88
+ </script>
@@ -0,0 +1,80 @@
1
+ <template>
2
+ <div class="psui-el-input-textarea" :class="[{'disabled':disabled}]">
3
+ <div class="psui-el-input-textarea-wrapper">
4
+ <label :for="label" v-if="label">{{label}}</label>
5
+ <textarea
6
+ :id="label"
7
+ :autocapitalize="autocapitalize"
8
+ :aria-required="required"
9
+ :value="value"
10
+ @blur="onBlur"
11
+ @focus="onFocus"
12
+ @input="onInput"
13
+ :rows="rows"
14
+ :placeholder="placeholder"
15
+ :readonly='disabled'
16
+ />
17
+ </div>
18
+ <p class="psui-el-input-textarea-message" v-if="optionalLabel && !disabled">{{optionalLabel}}</p>
19
+ </div>
20
+ </template>
21
+
22
+ <script>
23
+ export default {
24
+ name: "PsInputTextArea",
25
+ props: {
26
+ placeholder: {
27
+ type: String,
28
+ default: ''
29
+ },
30
+ value: {
31
+ required: true,
32
+ },
33
+ label: {
34
+ type: String,
35
+ },
36
+ optionalLabel:{
37
+ type: String,
38
+ },
39
+ action: {
40
+ type: Function,
41
+ required: false
42
+ },
43
+ required:{
44
+ type: Boolean,
45
+ default:true
46
+ },
47
+ autocapitalize: {
48
+ type: String,
49
+ default: 'sentences'
50
+ },
51
+ autocomplete: {
52
+ type: Boolean,
53
+ default: true
54
+ },
55
+ rows: {
56
+ type: Number,
57
+ default: 5
58
+ },
59
+ disabled: {
60
+ type: Boolean,
61
+ default: false,
62
+ }
63
+ },
64
+ methods: {
65
+ makeAction() {
66
+ if(this.action && typeof(this.action) == 'function') this.action()
67
+ },
68
+ onBlur(){
69
+ this.$emit('blur', this.$event)
70
+ },
71
+ onFocus(){
72
+ this.$emit('focus',this.$event)
73
+ },
74
+ onInput(){
75
+ this.$emit('input', this.$event)
76
+ }
77
+ }
78
+ }
79
+ </script>
80
+
@@ -62,3 +62,6 @@ export default {
62
62
  }
63
63
  }
64
64
  </script>
65
+
66
+ <style> /* Please, use the file src/assets/scss/components/PsDialog.scss */</style>
67
+
@@ -1,53 +1,41 @@
1
1
  <template>
2
- <div :class="cssClass">
3
- <span class="material-icons psui-mr-4">{{ icon }}</span>
4
- <div class="psui-w-full">{{ message }}</div>
5
- <div class="psui-flex psui-space-x-4">
2
+ <div class='psui-el-toast' :class="getComponentClass">
3
+ <i class="material-icons-round psui-el-toast-icon">{{ icon }}</i>
4
+ <p class="psui-el-toast-message">{{ message }}</p>
5
+ <div class="psui-el-toast-actions">
6
6
  <slot></slot>
7
7
  </div>
8
8
  </div>
9
9
  </template>
10
10
 
11
11
  <script>
12
- export const typeOptions = ['info', 'success', 'warning', 'error']
13
- export const fillOptions = ['soft', 'intense']
14
12
  export default {
15
13
  name: 'PsToast',
16
14
  props: {
17
- type: {
15
+ layout: {
18
16
  type: String,
19
17
  default: 'info',
20
- validator: (value) => typeOptions.indexOf(value) !== -1
18
+ validator: (value) => ['info', 'success', 'warning', 'error'].includes(value)
21
19
  },
22
20
  fill: {
23
21
  type: String,
24
22
  default: 'intense',
25
- validator: (value) => fillOptions.indexOf(value) !== -1
23
+ validator: (value) => ['soft', 'intense'].includes(value)
26
24
  },
27
25
  message: {
28
26
  type: String,
29
- required: true
27
+ },
28
+ icon:{
29
+ type: String,
30
30
  }
31
31
  },
32
32
  computed: {
33
- icon() {
34
- if (this.type === 'info') return 'info'
35
- if (this.type === 'success') return 'check_circle'
36
- return 'warning'
37
- },
38
- cssClass() {
39
- const colors = {
40
- info: 'blue-60',
41
- success: 'green-20',
42
- warning: 'yellow-20',
43
- error: 'red-20'
44
- }
45
-
46
- const textColor = this.fill === 'intense' ? 'white': colors[this.type]
47
- const background = this.fill === 'soft'? `${colors[this.type].split('-', 1)}-10` : colors[this.type]
48
-
49
- return `psui-font-bold psui-shadow-md psui-rounded-md psui-p-3 psui-h-12 psui-flex psui-bg-${background} psui-text-${textColor}`
33
+ getComponentClass(){
34
+ return `layout-${this.layout} fill-${this.fill}`
50
35
  }
51
- }
36
+ },
52
37
  }
53
38
  </script>
39
+
40
+ <style> /* Please, use the file src/assets/scss/components/PsToast.scss */ </style>
41
+
@@ -5,22 +5,31 @@
5
5
  role="group"
6
6
  >
7
7
 
8
- <button
9
- type="button"
10
- v-for="item in getItems"
11
- :key="item[keyValue]"
12
- @click="selectTab(item)"
13
- :class="{ 'status-active': getSelected === item[keyValue] }"
14
- >
15
- {{ item[keyLabel] }}
16
- </button>
17
-
8
+ <template v-for="item in getItems">
9
+ <slot v-bind:item="item" >
10
+ <button
11
+ :key="item[keyValue]"
12
+ type="button"
13
+ @click="selectTab(item)"
14
+ :class="getButtonClass(item)"
15
+ >
16
+ <PsRichTooltip v-if="item.tooltip" :title="item.tooltip" layout="blue">
17
+ <template v-slot:trigger>
18
+ <span>{{ item[keyLabel] }}</span>
19
+ </template>
20
+ </PsRichTooltip>
21
+ <span v-else>{{ item[keyLabel] }}</span>
22
+ </button>
23
+ </slot>
24
+ </template>
18
25
  </div>
19
26
  </template>
20
27
 
21
28
  <script>
29
+ import PsRichTooltip from '../tooltip/PsRichTooltip.vue'
22
30
  export default {
23
31
  name: 'PsTabHeader',
32
+ components: { PsRichTooltip },
24
33
  props: {
25
34
  layout: {
26
35
  type: String,
@@ -82,8 +91,17 @@ export default {
82
91
  },
83
92
  methods: {
84
93
  selectTab(item) {
85
- this.$emit('update:selected', this.getIsObject ? item : item[this.keyValue] )
86
- this.$emit('change', this.getIsObject ? item : item[this.keyValue])
94
+ if (item.disabled !== true) {
95
+ this.$emit('update:selected', this.getIsObject ? item : item[this.keyValue] )
96
+ this.$emit('change', this.getIsObject ? item : item[this.keyValue])
97
+ }
98
+ },
99
+ getButtonClass(item) {
100
+ if (item.disabled) {
101
+ return ['status-disabled']
102
+ } else {
103
+ return { 'status-active': this.getSelected === item[this.keyValue], 'status-enabled' : true }
104
+ }
87
105
  }
88
106
  }
89
107
 
@@ -1,17 +1,14 @@
1
1
  <template>
2
- <PsTooltip :cssClass="getCssClass.content" :title="title">
2
+ <PsTooltip :layout="layout" :cssClass="cssClass" :title="title">
3
3
  <template v-slot:trigger>
4
- <slot></slot>
4
+ <slot name="trigger"></slot>
5
5
  </template>
6
6
  <template
7
- v-slot:dialog
8
- class="psui-flex psui-fkex-col psui-gap-3 psui-items-start"
7
+ v-slot:content
9
8
  >
10
- <p :class="type === 'white' ? 'psui-text-gray-50' : ''">{{ text }}</p>
9
+ <slot name="content"></slot>
11
10
  <button
12
11
  v-if="buttonText"
13
- class="psui-py-2 psui-px-4 psui-rounded-md"
14
- :class="getCssClass.button"
15
12
  @click="onClick"
16
13
  >
17
14
  {{ buttonText }}
@@ -36,7 +33,7 @@ export default {
36
33
  buttonText: {
37
34
  type: String,
38
35
  },
39
- type: {
36
+ layout: {
40
37
  type: String,
41
38
  default: "white",
42
39
  validator: (value) => ["white", "dark", "color"].includes(value),
@@ -47,33 +44,11 @@ export default {
47
44
  },
48
45
  },
49
46
  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
47
  methods: {
68
48
  onClick() {
69
- this.$emit("click")
49
+ this.$emit("click", this.$event)
70
50
  },
71
51
  },
72
52
  }
73
53
  </script>
74
54
 
75
- <style scoped>
76
- button {
77
- width: fit-content;
78
- }
79
- </style>>
@@ -1,44 +1,37 @@
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>
1
+ <template>
2
+ <PsTooltip :layout="layout" :title="title" :cssClass="cssClass">
3
+ <template v-slot:trigger>
4
+ <slot name="trigger"></slot>
5
+ </template>
6
+ <template v-slot:content>
7
+ <slot name="content"></slot>
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
+ layout: {
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
+ }
37
+ </script>