@policystudio/policy-studio-ui-vue 1.0.29 → 1.0.32
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 +1580 -185
- package/package.json +16 -5
- package/postcss.config.js +1 -1
- package/src/assets/scss/base.scss +3 -0
- package/src/assets/scss/components/PsAccordion.scss +28 -11
- package/src/assets/scss/components/PsButton.scss +39 -18
- 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 +13 -8
- package/src/assets/scss/components/PsClimateZoneBadge.scss +1 -1
- package/src/assets/scss/components/PsCostEffectBar.scss +22 -27
- package/src/assets/scss/components/PsDataTable.scss +17 -0
- package/src/assets/scss/components/PsDialog.scss +5 -2
- package/src/assets/scss/components/PsDotLoader.scss +45 -0
- 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/PsInlineSelector.scss +40 -25
- 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/PsMiniTag.scss +3 -3
- 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 +27 -2
- package/src/components/chips/PsChips.vue +33 -13
- package/src/components/controls/PsCheckbox.vue +32 -16
- package/src/components/controls/PsDraggable.vue +39 -150
- package/src/components/controls/PsInlineSelector.vue +34 -16
- package/src/components/controls/PsRadioButton.vue +28 -15
- package/src/components/controls/PsSlider.vue +1 -1
- package/src/components/controls/PsSwitch.vue +20 -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 +54 -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/PsDotLoader.vue +15 -0
- package/src/components/ui/PsIcon.vue +30 -0
- package/src/index.js +39 -7
- package/src/stories/Accordion.stories.js +12 -48
- package/src/stories/Button.stories.js +30 -7
- package/src/stories/Chips.stories.js +16 -4
- package/src/stories/Colors.stories.mdx +1 -0
- package/src/stories/Dropdown.stories.js +81 -14
- 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 +8 -3
- package/vetur/attributes.json +1376 -0
- package/vetur/tags.json +632 -0
- package/src/components/forms/PsDropdownCopy.vue +0 -212
|
@@ -1,212 +0,0 @@
|
|
|
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>
|