@policystudio/policy-studio-ui-vue 1.0.30 → 1.0.33
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 +36 -35
- package/.storybook/preview.js +7 -1
- package/README.md +6 -2
- package/babel.config.js +1 -1
- package/dist/css/psui_styles.css +483 -143
- package/package.json +16 -5
- package/postcss.config.js +1 -1
- package/src/assets/images/multifamily-units.svg +10 -0
- package/src/assets/scss/base.scss +2 -0
- package/src/assets/scss/components/PsAccordion.scss +28 -11
- package/src/assets/scss/components/PsButton.scss +21 -4
- package/src/assets/scss/components/PsCardInfos.scss +1 -1
- package/src/assets/scss/components/PsCheckbox.scss +4 -5
- package/src/assets/scss/components/PsChips.scss +17 -12
- package/src/assets/scss/components/PsDataTable.scss +17 -0
- package/src/assets/scss/components/PsDialog.scss +5 -2
- package/src/assets/scss/components/PsDraggable.scss +64 -0
- package/src/assets/scss/components/PsDropdown.scss +9 -24
- package/src/assets/scss/components/PsDropdownList.scss +19 -0
- package/src/assets/scss/components/PsInput.scss +8 -3
- package/src/assets/scss/components/PsInputSelect.scss +6 -3
- package/src/assets/scss/components/PsInputTextArea.scss +5 -2
- package/src/assets/scss/components/PsRadioButton.scss +5 -5
- package/src/assets/scss/components/PsSwitch.scss +4 -4
- package/src/assets/scss/components/PsTabHeader.scss +14 -0
- package/src/assets/scss/components/PsToast.scss +3 -3
- package/src/assets/scss/components/PsToggle.scss +6 -2
- package/src/assets/scss/components/PsTooltip.scss +50 -18
- package/src/components/accordion/PsAccordion.vue +7 -23
- package/src/components/accordion/PsAccordionItem.vue +42 -26
- package/src/components/badges-and-tags/PsCardInfos.vue +12 -0
- package/src/components/badges-and-tags/PsChartLegend.vue +13 -0
- package/src/components/badges-and-tags/PsClimateZoneBadge.vue +7 -0
- package/src/components/badges-and-tags/PsCostEffectBar.vue +6 -0
- package/src/components/badges-and-tags/PsHighlightRippleDot.vue +3 -1
- package/src/components/badges-and-tags/PsMiniTag.vue +6 -0
- package/src/components/badges-and-tags/PsProgressBar.vue +17 -9
- package/src/components/buttons/PsButton.vue +22 -1
- package/src/components/chips/PsChips.vue +33 -12
- package/src/components/controls/PsCheckbox.vue +32 -16
- package/src/components/controls/PsDraggable.vue +39 -150
- package/src/components/controls/PsInlineSelector.vue +30 -0
- package/src/components/controls/PsRadioButton.vue +28 -15
- package/src/components/controls/PsSwitch.vue +17 -11
- package/src/components/controls/PsToggle.vue +33 -12
- package/src/components/datatable/PsDataTable.vue +21 -1
- package/src/components/datatable/PsDataTableItem.vue +1 -1
- package/src/components/forms/PsDropdown.vue +73 -101
- package/src/components/forms/PsDropdownList.vue +82 -0
- package/src/components/forms/PsInput.vue +28 -1
- package/src/components/forms/PsInputSelect.vue +21 -0
- package/src/components/forms/PsInputTextArea.vue +54 -41
- package/src/components/notifications/PsDialog.vue +15 -0
- package/src/components/notifications/PsToast.vue +12 -0
- package/src/components/playground/PsScrollBar.vue +248 -0
- package/src/components/tabs/PsTabHeader.vue +31 -5
- package/src/components/tooltip/PsDialogTooltip.vue +107 -24
- package/src/components/tooltip/PsRichTooltip.vue +12 -9
- package/src/components/tooltip/PsTooltip.vue +27 -11
- package/src/components/ui/PsIcon.vue +30 -0
- package/src/index.js +30 -2
- package/src/stories/Accordion.stories.js +12 -48
- package/src/stories/Button.stories.js +30 -7
- package/src/stories/Chips.stories.js +11 -24
- package/src/stories/Dropdown.stories.js +81 -14
- package/src/stories/Icon.stories.js +21 -0
- package/src/stories/InlineSelector.stories.js +1 -1
- package/src/stories/Playground.stories.js +16 -0
- package/src/stories/Switch.stories.js +8 -2
- package/src/stories/Toast.stories.js +16 -16
- package/src/stories/Tooltip.stories.js +6 -6
- package/src/stories/Typography.stories.mdx +22 -18
- package/src/util/GeneralFunctions.js +8 -0
- package/src/util/imageLoader.js +1 -1
- package/tailwind.config.js +7 -3
- package/vetur/attributes.json +1376 -0
- package/vetur/tags.json +632 -0
- package/src/components/forms/PsDropdownCopy.vue +0 -212
|
@@ -27,23 +27,38 @@
|
|
|
27
27
|
export default {
|
|
28
28
|
name: 'PsDialog',
|
|
29
29
|
props: {
|
|
30
|
+
/**
|
|
31
|
+
* It sets the theme of the dialog. eg: informative, success and alert.
|
|
32
|
+
*/
|
|
30
33
|
theme: {
|
|
31
34
|
type: String,
|
|
32
35
|
default: 'informative',
|
|
33
36
|
validator: (value) => ['informative', 'success', 'alert'].includes(value)
|
|
34
37
|
},
|
|
38
|
+
/**
|
|
39
|
+
* It set the which will be displayed when component is rendered.
|
|
40
|
+
*/
|
|
35
41
|
message: {
|
|
36
42
|
type: String,
|
|
37
43
|
},
|
|
44
|
+
/**
|
|
45
|
+
* It sets the direction of the items within the dialog. See Figma Notifications for full information.
|
|
46
|
+
*/
|
|
38
47
|
layout:{
|
|
39
48
|
type: String,
|
|
40
49
|
default: 'horizontal',
|
|
41
50
|
validator: (value) => ['horizontal', 'vertical'].includes(value)
|
|
42
51
|
},
|
|
52
|
+
/**
|
|
53
|
+
* It sets a close button if needed.
|
|
54
|
+
*/
|
|
43
55
|
hasClose: {
|
|
44
56
|
type: Boolean,
|
|
45
57
|
default: true
|
|
46
58
|
},
|
|
59
|
+
/**
|
|
60
|
+
* It sets the text key to get the svg icon in Google Fonts. Make sure to get the correct description of your icon on https://fonts.google.com/.
|
|
61
|
+
*/
|
|
47
62
|
icon: {
|
|
48
63
|
type: String,
|
|
49
64
|
default: 'info'
|
|
@@ -12,19 +12,31 @@
|
|
|
12
12
|
export default {
|
|
13
13
|
name: 'PsToast',
|
|
14
14
|
props: {
|
|
15
|
+
/**
|
|
16
|
+
* It sets the layout of the toast. eg: info, success, warning and error.
|
|
17
|
+
*/
|
|
15
18
|
layout: {
|
|
16
19
|
type: String,
|
|
17
20
|
default: 'info',
|
|
18
21
|
validator: (value) => ['info', 'success', 'warning', 'error'].includes(value)
|
|
19
22
|
},
|
|
23
|
+
/**
|
|
24
|
+
* It sets a supportive layout. eg: soft and intese. See Figma - Notification for full information.
|
|
25
|
+
*/
|
|
20
26
|
fill: {
|
|
21
27
|
type: String,
|
|
22
28
|
default: 'intense',
|
|
23
29
|
validator: (value) => ['soft', 'intense'].includes(value)
|
|
24
30
|
},
|
|
31
|
+
/**
|
|
32
|
+
* It sets the message which will be displayed when component is rendered.
|
|
33
|
+
*/
|
|
25
34
|
message: {
|
|
26
35
|
type: String,
|
|
27
36
|
},
|
|
37
|
+
/**
|
|
38
|
+
* It sets the text key to get the svg icon in Google Fonts. Make sure to get the correct description of your icon on https://fonts.google.com/.
|
|
39
|
+
*/
|
|
28
40
|
icon:{
|
|
29
41
|
type: String,
|
|
30
42
|
}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="wrapper psui-flex psui-gap-4">
|
|
3
|
+
<div
|
|
4
|
+
class="visible-scrollbar psui-flex psui-flex-col psui-h-full psui-w-56 psui-bg-gray-30 psui-p-2"
|
|
5
|
+
@click="onClick"
|
|
6
|
+
>
|
|
7
|
+
<h2 class="psui-font-bold">Scrollbar Playground (click over here to copy the computed style to clipboard)</h2>
|
|
8
|
+
<p >Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem, id.</p>
|
|
9
|
+
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem, id.</p>
|
|
10
|
+
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem, id.</p>
|
|
11
|
+
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem, id.</p>
|
|
12
|
+
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem, id.</p>
|
|
13
|
+
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem, id.</p>
|
|
14
|
+
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem, id.</p>
|
|
15
|
+
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem, id.</p>
|
|
16
|
+
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem, id.</p>
|
|
17
|
+
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem, id.</p>
|
|
18
|
+
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem, id.</p>
|
|
19
|
+
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem, id.</p>
|
|
20
|
+
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem, id.</p>
|
|
21
|
+
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem, id.</p>
|
|
22
|
+
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem, id.</p>
|
|
23
|
+
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem, id.</p>
|
|
24
|
+
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem, id.</p>
|
|
25
|
+
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem, id.</p>
|
|
26
|
+
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem, id.</p>
|
|
27
|
+
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem, id.</p>
|
|
28
|
+
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem, id.</p>
|
|
29
|
+
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem, id.</p>
|
|
30
|
+
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem, id.</p>
|
|
31
|
+
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem, id.</p>
|
|
32
|
+
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem, id.</p>
|
|
33
|
+
</div>
|
|
34
|
+
<div class="psui-flex psui-bg-gray-60 psui-p-2 psui-gap-4">
|
|
35
|
+
<div class="psui-flex psui-flex-col">
|
|
36
|
+
<div class="psui-flex psui-flex-col psui-w-48">
|
|
37
|
+
<label for="width">Scroll Width (px)</label>
|
|
38
|
+
<input type="text" id="width" name="width" @change="onChange">
|
|
39
|
+
</div>
|
|
40
|
+
<div class="psui-flex psui-flex-col psui-w-48">
|
|
41
|
+
<label for="width">Scroll Height (px)</label>
|
|
42
|
+
<input type="text" id="height" name="height" @change="onChange">
|
|
43
|
+
</div>
|
|
44
|
+
<div class="psui-flex psui-flex-col psui-w-48">
|
|
45
|
+
<label for="width">ScrollTrack Color</label>
|
|
46
|
+
<input type="text" id="track" name="track" @change="onChange">
|
|
47
|
+
</div>
|
|
48
|
+
<div class="psui-flex psui-flex-col psui-w-48">
|
|
49
|
+
<label for="width">Thumb Color</label>
|
|
50
|
+
<input type="text" id="thumb" name="thumb" @change="onChange">
|
|
51
|
+
</div>
|
|
52
|
+
<div class="psui-flex psui-flex-col psui-w-48">
|
|
53
|
+
<label for="width">Thumb Border-Radius (px)</label>
|
|
54
|
+
<input type="text" id="thumb-radius" name="thumb-radius" @change="onChange">
|
|
55
|
+
</div>
|
|
56
|
+
<div class="psui-flex psui-flex-col psui-w-48">
|
|
57
|
+
<label for="width">Thumb Border Size(px)</label>
|
|
58
|
+
<input type="text" id="thumb-border" name="thumb-border" @change="onChange">
|
|
59
|
+
</div>
|
|
60
|
+
<div class="psui-flex psui-flex-col psui-w-48">
|
|
61
|
+
<label for="width">Thumb Border Color</label>
|
|
62
|
+
<input type="text" id="thumb-border-color" name="thumb-border-color" @change="onChange">
|
|
63
|
+
</div>
|
|
64
|
+
<div class="psui-flex psui-flex-col psui-w-48">
|
|
65
|
+
<label for="width">Thumb Border Style</label>
|
|
66
|
+
<select id="thumb-border-style" name="thumb-border-style" v-model="selectedStyle">
|
|
67
|
+
<option value="" hidden selected></option>
|
|
68
|
+
<option
|
|
69
|
+
v-for="(style, index) in borderStyle"
|
|
70
|
+
:value="style"
|
|
71
|
+
:key="index"
|
|
72
|
+
>{{style}}</option>
|
|
73
|
+
</select>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
<div class="psui-flex psui-flex-col">
|
|
77
|
+
<div class="psui-flex psui-flex-col psui-w-48">
|
|
78
|
+
<label for="width">Thumb Hover Color</label>
|
|
79
|
+
<input type="text" id="thumb-hover-color" name="thumb-hover-color" @change="onChange">
|
|
80
|
+
</div>
|
|
81
|
+
<div class="psui-flex psui-flex-col psui-w-48">
|
|
82
|
+
<label for="width">Thumb Hover Border Size</label>
|
|
83
|
+
<input type="text" id="thumb-hover-border-size" name="thumb-hover-border-size" @change="onChange">
|
|
84
|
+
</div>
|
|
85
|
+
<div class="psui-flex psui-flex-col psui-w-48">
|
|
86
|
+
<label for="width">Thumb Hover Border Color</label>
|
|
87
|
+
<input type="text" id="thumb-hover-border-color" name="thumb-hover-border-color" @change="onChange">
|
|
88
|
+
</div>
|
|
89
|
+
<div class="psui-flex psui-flex-col psui-w-48">
|
|
90
|
+
<label for="width">Thumb Border Style</label>
|
|
91
|
+
<select id="thumb-border-style" name="thumb-border-style" v-model="selectedHoverStyle">
|
|
92
|
+
<option value="" hidden selected></option>
|
|
93
|
+
<option
|
|
94
|
+
v-for="(style, index) in borderStyle"
|
|
95
|
+
:value="style"
|
|
96
|
+
:key="index"
|
|
97
|
+
>{{style}}</option>
|
|
98
|
+
</select>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
</template>
|
|
104
|
+
|
|
105
|
+
<script>
|
|
106
|
+
|
|
107
|
+
export default {
|
|
108
|
+
name: 'PsScrollBar',
|
|
109
|
+
data(){
|
|
110
|
+
return {
|
|
111
|
+
borderStyle: ['dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'ouset'],
|
|
112
|
+
selectedStyle: null,
|
|
113
|
+
selectedHoverStyle: null
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
watch:{
|
|
117
|
+
selectedStyle(){
|
|
118
|
+
const visibleScrollBar = document.querySelector('.visible-scrollbar')
|
|
119
|
+
visibleScrollBar.style.setProperty('--scrollbar-thumb-border-style', this.selectedStyle)
|
|
120
|
+
},
|
|
121
|
+
selectedHoverStyle(){
|
|
122
|
+
const visibleScrollBar = document.querySelector('.visible-scrollbar')
|
|
123
|
+
visibleScrollBar.style.setProperty('--scrollbar-thumb-hover-border-style', this.selectedHoverStyle)
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
methods:{
|
|
127
|
+
onChange(event){
|
|
128
|
+
|
|
129
|
+
const visibleScrollBar = document.querySelector('.visible-scrollbar')
|
|
130
|
+
|
|
131
|
+
switch(event.target.id){
|
|
132
|
+
case 'width':
|
|
133
|
+
visibleScrollBar.style.setProperty('--scrollbar-width', `${event.target.value}px`)
|
|
134
|
+
break
|
|
135
|
+
case 'thumb':
|
|
136
|
+
visibleScrollBar.style.setProperty('--scrollbar-thumb-color', event.target.value)
|
|
137
|
+
break
|
|
138
|
+
case 'track':
|
|
139
|
+
visibleScrollBar.style.setProperty('--scrollbar-track-color', event.target.value)
|
|
140
|
+
break
|
|
141
|
+
case 'thumb-radius':
|
|
142
|
+
visibleScrollBar.style.setProperty('--scrollbar-thumb-radius', `${event.target.value}px`)
|
|
143
|
+
break
|
|
144
|
+
case 'thumb-border':
|
|
145
|
+
visibleScrollBar.style.setProperty('--scrollbar-thumb-border', `${event.target.value}px`)
|
|
146
|
+
break
|
|
147
|
+
case 'thumb-border-color':
|
|
148
|
+
visibleScrollBar.style.setProperty('--scrollbar-thumb-border-color', event.target.value)
|
|
149
|
+
break
|
|
150
|
+
case 'height':
|
|
151
|
+
visibleScrollBar.style.setProperty('--scrollbar-height', `${event.target.value}px`)
|
|
152
|
+
break
|
|
153
|
+
case 'thumb-hover-color':
|
|
154
|
+
visibleScrollBar.style.setProperty('--scrollbar-thumb-hover-color', event.target.value)
|
|
155
|
+
break
|
|
156
|
+
case 'thumb-hover-border-size':
|
|
157
|
+
visibleScrollBar.style.setProperty('--scrollbar-thumb-hover-border-size', `${event.target.value}px`)
|
|
158
|
+
break
|
|
159
|
+
case 'thumb-hover-border-color':
|
|
160
|
+
visibleScrollBar.style.setProperty('--scrollbar-thumb-hover-border-color', event.target.value)
|
|
161
|
+
break
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
},
|
|
165
|
+
onClick(){
|
|
166
|
+
const visibleScrollBar = document.querySelector('.visible-scrollbar')
|
|
167
|
+
|
|
168
|
+
const styleScrollBar = getComputedStyle(visibleScrollBar, '::-webkit-scrollbar')
|
|
169
|
+
const styleScrollBarTrack = getComputedStyle(visibleScrollBar, '::-webkit-scrollbar-track')
|
|
170
|
+
const styleScrollBarThumb = getComputedStyle(visibleScrollBar, '::-webkit-scrollbar-thumb')
|
|
171
|
+
const styleScrollBarThumbHover = getComputedStyle(visibleScrollBar, '::-webkit-scrollbar-thumb:hover')
|
|
172
|
+
const styleScrollBarCorner = getComputedStyle(visibleScrollBar, '::-webkit-scrollbar-corner')
|
|
173
|
+
|
|
174
|
+
navigator.clipboard.writeText(`
|
|
175
|
+
::-webkit-scrollbar {
|
|
176
|
+
display: ${styleScrollBar.display};
|
|
177
|
+
width: ${styleScrollBar.width};
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
::-webkit-scrollbar-track {
|
|
181
|
+
background-color: ${styleScrollBarTrack.backgroundColor};
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
::-webkit-scrollbar-thumb {
|
|
185
|
+
background-color: ${styleScrollBarThumb.backgroundColor};
|
|
186
|
+
border-radius: ${styleScrollBarThumb.borderRadius};
|
|
187
|
+
border: ${styleScrollBarThumb.border};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
::-webkit-scrollbar-thumb:hover {
|
|
191
|
+
background-color: ${styleScrollBarThumbHover.backgroundColor};
|
|
192
|
+
border: ${styleScrollBarThumbHover.border};
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
::-webkit-scrollbar-corner {
|
|
196
|
+
display: ${styleScrollBarCorner.display};
|
|
197
|
+
background-color: ${styleScrollBarCorner.backgroundColor};
|
|
198
|
+
height: ${styleScrollBarCorner.height};
|
|
199
|
+
width: ${styleScrollBarCorner.width};
|
|
200
|
+
}
|
|
201
|
+
`)
|
|
202
|
+
|
|
203
|
+
window.alert('Copied to clipboard')
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
</script>
|
|
209
|
+
|
|
210
|
+
<style scoped>
|
|
211
|
+
|
|
212
|
+
.visible-scrollbar{
|
|
213
|
+
overflow: scroll;
|
|
214
|
+
white-space: nowrap;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.visible-scrollbar::-webkit-scrollbar {
|
|
218
|
+
display: block;
|
|
219
|
+
width: var(--scrollbar-width, 10px);
|
|
220
|
+
height: var(--scrollbar-height, 10px);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.visible-scrollbar::-webkit-scrollbar-track {
|
|
224
|
+
background: var(--scrollbar-track-color, gray);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.visible-scrollbar::-webkit-scrollbar-thumb {
|
|
228
|
+
background: var(--scrollbar-thumb-color,black);
|
|
229
|
+
border-radius: var(--scrollbar-thumb-radius);
|
|
230
|
+
border: var(--scrollbar-thumb-border) var(--scrollbar-thumb-border-style) var(--scrollbar-thumb-border-color);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.visible-scrollbar::-webkit-scrollbar-thumb:hover {
|
|
234
|
+
background: var(--scrollbar-thumb-hover-color, black);
|
|
235
|
+
border: var(--scrollbar-thumb-hover-border-size) var(--scrollbar-thumb-hover-border-style) var(--scrollbar-thumb-hover-border-color);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.visible-scrollbar::-webkit-scrollbar-corner {
|
|
239
|
+
display: none;
|
|
240
|
+
background-color: var(--scrollbar-track-color, gray);
|
|
241
|
+
height: var(--scrollbar-height, 10px);
|
|
242
|
+
width: var(--scrollbar-width, 10px);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.wrapper {
|
|
246
|
+
height: 450px;
|
|
247
|
+
}
|
|
248
|
+
</style>
|
|
@@ -7,18 +7,26 @@
|
|
|
7
7
|
|
|
8
8
|
<template v-for="item in getItems">
|
|
9
9
|
<slot v-bind:item="item" >
|
|
10
|
+
<PsRichTooltip v-if="item.tooltip" :title="item.tooltip" layout="blue">
|
|
11
|
+
<template v-slot:trigger>
|
|
12
|
+
<button
|
|
13
|
+
:key="item[keyValue]"
|
|
14
|
+
type="button"
|
|
15
|
+
@click="selectTab(item)"
|
|
16
|
+
:class="getButtonClass(item)"
|
|
17
|
+
>
|
|
18
|
+
<span>{{ item[keyLabel] }}</span>
|
|
19
|
+
</button>
|
|
20
|
+
</template>
|
|
21
|
+
</PsRichTooltip>
|
|
10
22
|
<button
|
|
23
|
+
v-else
|
|
11
24
|
:key="item[keyValue]"
|
|
12
25
|
type="button"
|
|
13
26
|
@click="selectTab(item)"
|
|
14
27
|
:class="getButtonClass(item)"
|
|
15
28
|
>
|
|
16
|
-
<PsRichTooltip v-if="item.tooltip" :title="item.tooltip" layout="blue">
|
|
17
|
-
<template v-slot:trigger>
|
|
18
29
|
<span>{{ item[keyLabel] }}</span>
|
|
19
|
-
</template>
|
|
20
|
-
</PsRichTooltip>
|
|
21
|
-
<span v-else>{{ item[keyLabel] }}</span>
|
|
22
30
|
</button>
|
|
23
31
|
</slot>
|
|
24
32
|
</template>
|
|
@@ -31,27 +39,45 @@ export default {
|
|
|
31
39
|
name: 'PsTabHeader',
|
|
32
40
|
components: { PsRichTooltip },
|
|
33
41
|
props: {
|
|
42
|
+
/**
|
|
43
|
+
* It sets the layout of the tabheader. eg: standard, underline and folder.
|
|
44
|
+
*/
|
|
34
45
|
layout: {
|
|
35
46
|
type: String,
|
|
36
47
|
default: 'standard',
|
|
37
48
|
validator: (value) => ['standard', 'underline', 'folder'].includes(value)
|
|
38
49
|
},
|
|
50
|
+
/**
|
|
51
|
+
* It sets the tabs which will be rendered.
|
|
52
|
+
*/
|
|
39
53
|
items: {
|
|
40
54
|
type: Array,
|
|
41
55
|
required: true
|
|
42
56
|
},
|
|
57
|
+
/**
|
|
58
|
+
* It sets the key label of the items if needed.
|
|
59
|
+
*/
|
|
43
60
|
keyLabel: {
|
|
44
61
|
type: String,
|
|
45
62
|
default: 'label'
|
|
46
63
|
},
|
|
64
|
+
/**
|
|
65
|
+
* It sets the key value of the items if needed.
|
|
66
|
+
*/
|
|
47
67
|
keyValue: {
|
|
48
68
|
type: String,
|
|
49
69
|
default: 'value'
|
|
50
70
|
},
|
|
71
|
+
/**
|
|
72
|
+
* It disabled the tab header. All mouse events are disabled.
|
|
73
|
+
*/
|
|
51
74
|
disabled: {
|
|
52
75
|
type: Boolean,
|
|
53
76
|
default: false
|
|
54
77
|
},
|
|
78
|
+
/**
|
|
79
|
+
* It sets the tab seleced.
|
|
80
|
+
*/
|
|
55
81
|
selected: {},
|
|
56
82
|
},
|
|
57
83
|
computed: {
|
|
@@ -1,52 +1,135 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
2
|
+
<div @mouseenter="open" v-click-outside="close" ref="tooltip" class='psui-el-tooltip'>
|
|
3
|
+
<div ref="tooltiptrigger" class='psui-el-tooltip-trigger'>
|
|
4
4
|
<slot name="trigger"></slot>
|
|
5
|
-
</
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<div class='psui-el-tooltip-wrapper'>
|
|
8
|
+
<div
|
|
9
|
+
role="menu"
|
|
10
|
+
ref="dialog"
|
|
11
|
+
class='psui-el-tooltip-dialog'
|
|
12
|
+
:class="cssClass"
|
|
13
13
|
>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
<div
|
|
15
|
+
class="psui-el-tooltip-content"
|
|
16
|
+
aria-orientation="vertical"
|
|
17
|
+
:class="getComponentClass"
|
|
18
|
+
>
|
|
19
|
+
<h2 v-if="title">{{ title}}</h2>
|
|
20
|
+
<div class="psui-el-tooltip-content-wrapper">
|
|
21
|
+
<slot name="content"></slot>
|
|
22
|
+
<button
|
|
23
|
+
v-if="buttonText"
|
|
24
|
+
@click="onClick"
|
|
25
|
+
>
|
|
26
|
+
{{ buttonText }}
|
|
27
|
+
</button>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
18
33
|
</template>
|
|
19
34
|
|
|
20
35
|
<script>
|
|
21
|
-
import PsTooltip from "./PsTooltip.vue"
|
|
22
36
|
|
|
23
37
|
export default {
|
|
24
|
-
name:
|
|
25
|
-
components: { PsTooltip },
|
|
38
|
+
name: 'PsDialogTooltip',
|
|
26
39
|
props: {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
40
|
+
/**
|
|
41
|
+
* It sets the title of the tooltip if needed.
|
|
42
|
+
*/
|
|
30
43
|
title: {
|
|
31
44
|
type: String,
|
|
32
45
|
},
|
|
46
|
+
/**
|
|
47
|
+
* It sets the label of the button within the tooltip if needed.
|
|
48
|
+
*/
|
|
33
49
|
buttonText: {
|
|
34
50
|
type: String,
|
|
35
51
|
},
|
|
52
|
+
/**
|
|
53
|
+
* It sets the layout of the tooltip. eg: white, dark and color.
|
|
54
|
+
*/
|
|
36
55
|
layout: {
|
|
37
56
|
type: String,
|
|
38
|
-
default:
|
|
39
|
-
validator: (value) => [
|
|
57
|
+
default: 'white',
|
|
58
|
+
validator: (value) => ['white', 'dark', 'color'].includes(value),
|
|
40
59
|
},
|
|
60
|
+
/**
|
|
61
|
+
* It sets a additional styling if needed.
|
|
62
|
+
*/
|
|
41
63
|
cssClass: {
|
|
42
64
|
type: String,
|
|
43
65
|
required: false,
|
|
44
66
|
},
|
|
45
67
|
},
|
|
46
|
-
|
|
68
|
+
inheritAttrs: true,
|
|
69
|
+
emits: ['show', 'click'],
|
|
70
|
+
data() {
|
|
71
|
+
return {
|
|
72
|
+
show: false,
|
|
73
|
+
closingTimeout: null,
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
computed:{
|
|
77
|
+
getComponentClass(){
|
|
78
|
+
return `layout-${this.layout}`
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
mounted() {
|
|
82
|
+
document.addEventListener('resize', this.updatePosition)
|
|
83
|
+
},
|
|
84
|
+
beforeDestroy() {
|
|
85
|
+
document.removeEventListener('resize', this.updatePosition)
|
|
86
|
+
},
|
|
47
87
|
methods: {
|
|
88
|
+
open() {
|
|
89
|
+
if (this.show || this.ignoreDialog) return
|
|
90
|
+
this.$emit('show')
|
|
91
|
+
this.show = true
|
|
92
|
+
|
|
93
|
+
this.$refs.dialog.style.display = 'block'
|
|
94
|
+
this.$refs.dialog.style.opacity = 0
|
|
95
|
+
|
|
96
|
+
setTimeout(() => {
|
|
97
|
+
this.updatePosition()
|
|
98
|
+
}, 10)
|
|
99
|
+
},
|
|
100
|
+
close() {
|
|
101
|
+
if (this.show && this.$refs.dialog) {
|
|
102
|
+
this.$emit('close')
|
|
103
|
+
this.show = false
|
|
104
|
+
|
|
105
|
+
this.$refs.dialog.style.display = 'none'
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
updatePosition() {
|
|
109
|
+
const dialog = this.$refs.dialog
|
|
110
|
+
const trigger = this.$refs.tooltiptrigger
|
|
111
|
+
|
|
112
|
+
const rectDialog = dialog.getBoundingClientRect()
|
|
113
|
+
const rectTrigger = trigger.getBoundingClientRect()
|
|
114
|
+
const windowWidth = document.documentElement.clientWidth
|
|
115
|
+
dialog.style.top = `${rectTrigger.y + rectTrigger.height + 8}px`
|
|
116
|
+
|
|
117
|
+
if (rectTrigger.x + rectDialog.width + 20 > windowWidth) {
|
|
118
|
+
dialog.style.left = `${windowWidth - rectDialog.width - 30}px`
|
|
119
|
+
} else if (rectTrigger.x - Math.abs(rectTrigger.width-rectDialog.width) < 0) {
|
|
120
|
+
dialog.style.left = `${rectTrigger.x + 10}px`
|
|
121
|
+
} else if (rectDialog.width >= rectTrigger.width){
|
|
122
|
+
dialog.style.left = `${rectTrigger.x - ((rectDialog.width - rectTrigger.width)/2)}px`
|
|
123
|
+
} else {
|
|
124
|
+
dialog.style.left = `${rectTrigger.x + ((rectTrigger.width - rectDialog.width)/2)}px`
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
setTimeout(() => {
|
|
128
|
+
dialog.style.opacity = 100
|
|
129
|
+
}, 100)
|
|
130
|
+
},
|
|
48
131
|
onClick() {
|
|
49
|
-
this.$emit(
|
|
132
|
+
this.$emit('click', this.$event)
|
|
50
133
|
},
|
|
51
134
|
},
|
|
52
135
|
}
|
|
@@ -10,27 +10,30 @@
|
|
|
10
10
|
</template>
|
|
11
11
|
|
|
12
12
|
<script>
|
|
13
|
-
import PsTooltip from
|
|
13
|
+
import PsTooltip from '../tooltip/PsTooltip.vue'
|
|
14
14
|
|
|
15
15
|
export default {
|
|
16
|
-
name:
|
|
16
|
+
name: 'PsRichTooltip',
|
|
17
17
|
components: { PsTooltip },
|
|
18
18
|
props: {
|
|
19
|
+
/**
|
|
20
|
+
* It sets the title of the tooltip if needed.
|
|
21
|
+
*/
|
|
19
22
|
title: {
|
|
20
23
|
type: String,
|
|
21
|
-
default:
|
|
24
|
+
default: '',
|
|
22
25
|
},
|
|
26
|
+
/**
|
|
27
|
+
* It sets the layout of the tooltip. eg: gray, red and blue.
|
|
28
|
+
*/
|
|
23
29
|
layout: {
|
|
24
30
|
type: String,
|
|
25
|
-
default:
|
|
26
|
-
validator: (type) => [
|
|
27
|
-
},
|
|
28
|
-
text: {
|
|
29
|
-
type: String,
|
|
31
|
+
default: 'gray',
|
|
32
|
+
validator: (type) => ['gray', 'red', 'blue'].includes(type),
|
|
30
33
|
},
|
|
31
34
|
cssClass: {
|
|
32
35
|
type: String,
|
|
33
|
-
default:
|
|
36
|
+
default: '',
|
|
34
37
|
},
|
|
35
38
|
},
|
|
36
39
|
}
|