@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
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
<button
|
|
4
4
|
type="button"
|
|
5
5
|
v-for="(item, index) in items"
|
|
6
|
-
:key="index"
|
|
6
|
+
:key="getKeyValue(item) + index"
|
|
7
7
|
@click="selectOption(item)"
|
|
8
|
-
:class="{ 'status-active':
|
|
8
|
+
:class="{ 'status-active': selected == item }"
|
|
9
9
|
>
|
|
10
|
-
{{ item }}
|
|
10
|
+
{{ getKeyLabel(item) }}
|
|
11
11
|
</button>
|
|
12
12
|
</div>
|
|
13
13
|
</template>
|
|
@@ -18,26 +18,47 @@
|
|
|
18
18
|
export default {
|
|
19
19
|
name: 'PsToggle',
|
|
20
20
|
props: {
|
|
21
|
+
/**
|
|
22
|
+
* It sets the items which will be used to create the toggle tab. See Figma - Controls & Selector for more information.
|
|
23
|
+
*/
|
|
21
24
|
items: {
|
|
22
25
|
type: Array,
|
|
23
26
|
required: true
|
|
24
27
|
},
|
|
28
|
+
/**
|
|
29
|
+
* It sets the value selected.
|
|
30
|
+
*/
|
|
25
31
|
selected: {},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return false
|
|
33
|
-
}
|
|
32
|
+
/**
|
|
33
|
+
* It sets the key label of your items if needed.
|
|
34
|
+
*/
|
|
35
|
+
keyLabel: {
|
|
36
|
+
type: [String, Function],
|
|
37
|
+
default: 'label'
|
|
34
38
|
},
|
|
39
|
+
/**
|
|
40
|
+
* It sets the key value of your items if needed.
|
|
41
|
+
*/
|
|
42
|
+
keyValue: {
|
|
43
|
+
type: [String, Function],
|
|
44
|
+
default: 'value'
|
|
45
|
+
}
|
|
35
46
|
},
|
|
36
47
|
methods: {
|
|
37
48
|
selectOption(item) {
|
|
38
49
|
this.$emit('update:selected', item)
|
|
39
50
|
this.$emit('change', item)
|
|
40
|
-
}
|
|
51
|
+
},
|
|
52
|
+
getKeyLabel(item) {
|
|
53
|
+
if(typeof this.keyLabel == 'function') return this.keyLabel(item)
|
|
54
|
+
if(typeof item === 'object') return item[this.keyLabel]
|
|
55
|
+
return item
|
|
56
|
+
},
|
|
57
|
+
getKeyValue(item) {
|
|
58
|
+
if(typeof this.keyValue == 'function') return this.keyValue(item)
|
|
59
|
+
if(typeof item === 'object') return item[this.keyLabel]
|
|
60
|
+
return item
|
|
61
|
+
},
|
|
41
62
|
}
|
|
42
63
|
}
|
|
43
64
|
</script>
|
|
@@ -35,6 +35,9 @@ export const alignment = ['center', 'right', 'left']
|
|
|
35
35
|
export default {
|
|
36
36
|
name: 'PsDataTable',
|
|
37
37
|
props: {
|
|
38
|
+
/**
|
|
39
|
+
* It sets the type of the data table. eg: simple or rich.
|
|
40
|
+
*/
|
|
38
41
|
type: {
|
|
39
42
|
type: String,
|
|
40
43
|
required: true,
|
|
@@ -42,17 +45,31 @@ export default {
|
|
|
42
45
|
return ['simple', 'rich'].indexOf(value) !== -1
|
|
43
46
|
},
|
|
44
47
|
},
|
|
48
|
+
/**
|
|
49
|
+
* It sets the values which will be use to render the header.
|
|
50
|
+
*/
|
|
45
51
|
header: {
|
|
46
52
|
type: Array,
|
|
47
53
|
required: true,
|
|
48
54
|
},
|
|
55
|
+
/**
|
|
56
|
+
* It sets the values which will be use to render the body.
|
|
57
|
+
*/
|
|
49
58
|
data: {
|
|
50
59
|
type: Array,
|
|
51
|
-
|
|
60
|
+
default() {
|
|
61
|
+
return []
|
|
62
|
+
}
|
|
52
63
|
},
|
|
64
|
+
/**
|
|
65
|
+
* It sets the values which will be use to render the footer.
|
|
66
|
+
*/
|
|
53
67
|
footer: {
|
|
54
68
|
type: Array,
|
|
55
69
|
},
|
|
70
|
+
/**
|
|
71
|
+
* It sets the alignment of the whole context.
|
|
72
|
+
*/
|
|
56
73
|
align: {
|
|
57
74
|
type: String,
|
|
58
75
|
default: 'left',
|
|
@@ -60,6 +77,9 @@ export default {
|
|
|
60
77
|
return ['center', 'right', 'left'].indexOf(value) !== -1
|
|
61
78
|
}
|
|
62
79
|
},
|
|
80
|
+
/**
|
|
81
|
+
* It sets additional styling if needed.
|
|
82
|
+
*/
|
|
63
83
|
cssStyle: {
|
|
64
84
|
type: String,
|
|
65
85
|
default: 'psui-text-gray-60'
|
|
@@ -1,80 +1,74 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
<slot name="dropdownTrigger" ></slot>
|
|
2
|
+
<div class="psui-el-dropdown-menu" ref="PSDropdown" v-click-outside="close">
|
|
3
|
+
<div
|
|
4
|
+
ref="PSDropdownTrigger"
|
|
5
|
+
v-if="$slots.dropdownTrigger"
|
|
6
|
+
@click="show && !toggleWhenActive ? '' : toggle()"
|
|
7
|
+
>
|
|
8
|
+
<slot name="dropdownTrigger"></slot>
|
|
10
9
|
</div>
|
|
11
10
|
|
|
12
11
|
<button
|
|
13
12
|
v-else
|
|
14
|
-
@click="show && !toggleWhenActive ? '' : toggle()"
|
|
15
|
-
type="button"
|
|
16
|
-
class="psui-el-dropdown-menu-button"
|
|
17
|
-
:class="[buttonClasses]"
|
|
13
|
+
@click="show && !toggleWhenActive ? '' : toggle()"
|
|
14
|
+
type="button"
|
|
18
15
|
:id="id"
|
|
19
|
-
aria-haspopup="true"
|
|
16
|
+
aria-haspopup="true"
|
|
20
17
|
aria-expanded="true"
|
|
21
18
|
ref="PSDropdownTrigger"
|
|
22
19
|
>
|
|
23
|
-
<slot
|
|
20
|
+
<slot
|
|
21
|
+
v-if="show && $slots.buttonLabelOnShow"
|
|
22
|
+
name="buttonLabelOnShow"
|
|
23
|
+
></slot>
|
|
24
24
|
<slot v-else name="buttonLabel"></slot>
|
|
25
25
|
</button>
|
|
26
|
-
|
|
27
|
-
<div
|
|
26
|
+
<div
|
|
28
27
|
ref="PSDropdownDialog"
|
|
29
|
-
role="menu"
|
|
30
|
-
class="psui-el-dropdown-menu-dialog"
|
|
31
|
-
aria-orientation="vertical"
|
|
28
|
+
role="menu"
|
|
29
|
+
class="psui-el-dropdown-menu-dialog-wrapper psui-duration-300"
|
|
30
|
+
aria-orientation="vertical"
|
|
32
31
|
:aria-labelledby="id"
|
|
33
|
-
:
|
|
34
|
-
:style="{ minWidth: minWidthDropdown, marginLeft: marginLeft }"
|
|
32
|
+
:style="{ minWidth: minWidthDropDown }"
|
|
35
33
|
>
|
|
36
|
-
|
|
37
|
-
<div class="psui-el-dropdown-menu-dialog-category-divider">
|
|
38
|
-
<h2 class="ts--accent--1" v-if="title">{{ title }}</h2>
|
|
34
|
+
<div class="psui-el-dropdown-menu-dialog">
|
|
39
35
|
<slot name="items"></slot>
|
|
40
36
|
</div>
|
|
41
|
-
|
|
42
37
|
</div>
|
|
43
38
|
</div>
|
|
44
|
-
</div>
|
|
45
39
|
</template>
|
|
46
40
|
|
|
47
41
|
<script>
|
|
48
|
-
|
|
42
|
+
// Figma - 2.3 Dropdown with category divider https://www.figma.com/file/Tto8hrNlSfuPcwd1pfqogF/%E2%9A%A1%EF%B8%8F-Design-System?node-id=1768%3A64886
|
|
43
|
+
|
|
44
|
+
import {
|
|
45
|
+
randomString,
|
|
46
|
+
getParentScrollableEl,
|
|
47
|
+
} from '../../util/GeneralFunctions'
|
|
49
48
|
|
|
50
49
|
export default {
|
|
51
50
|
name: 'PsDropdown',
|
|
52
51
|
props: {
|
|
53
|
-
|
|
52
|
+
/**
|
|
53
|
+
* It sets a minimun width for the dropdown menu.
|
|
54
|
+
*/
|
|
55
|
+
minWidthDropDown: {
|
|
54
56
|
type: String,
|
|
55
|
-
default: '
|
|
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'
|
|
57
|
+
default: '240px',
|
|
70
58
|
},
|
|
59
|
+
/**
|
|
60
|
+
* It's a boolean responsible for showing a slot within the html tag button.
|
|
61
|
+
*/
|
|
71
62
|
buttonLabelOnShow: {
|
|
72
63
|
type: Boolean,
|
|
73
|
-
default: false
|
|
64
|
+
default: false,
|
|
74
65
|
},
|
|
66
|
+
/**
|
|
67
|
+
* It's a property responsible for toggling the dropdown menu. default: true.
|
|
68
|
+
*/
|
|
75
69
|
toggleWhenActive: {
|
|
76
70
|
type: Boolean,
|
|
77
|
-
default: true
|
|
71
|
+
default: true,
|
|
78
72
|
},
|
|
79
73
|
},
|
|
80
74
|
data() {
|
|
@@ -82,14 +76,14 @@ export default {
|
|
|
82
76
|
show: false,
|
|
83
77
|
id: randomString(8),
|
|
84
78
|
marginLeft: '-0px',
|
|
85
|
-
scrollableParentEl
|
|
79
|
+
scrollableParentEl: null,
|
|
86
80
|
}
|
|
87
81
|
},
|
|
88
82
|
computed: {
|
|
89
83
|
getMaxWidth() {
|
|
90
84
|
let bounds = this.$refs.PSDropdown.getBoundingClientRect()
|
|
91
|
-
return
|
|
92
|
-
}
|
|
85
|
+
return document.documentElement.clientWidth - bounds['left'] - 30
|
|
86
|
+
},
|
|
93
87
|
},
|
|
94
88
|
beforeDestroy() {
|
|
95
89
|
this.unwatchParentScrolling()
|
|
@@ -110,36 +104,41 @@ export default {
|
|
|
110
104
|
},
|
|
111
105
|
unwatchParentScrolling() {
|
|
112
106
|
if (this.scrollableParentEl) {
|
|
113
|
-
this.scrollableParentEl.removeEventListener(
|
|
107
|
+
this.scrollableParentEl.removeEventListener(
|
|
108
|
+
'scroll',
|
|
109
|
+
this.updatePosition
|
|
110
|
+
)
|
|
114
111
|
}
|
|
115
112
|
},
|
|
116
113
|
updatePosition() {
|
|
117
|
-
|
|
118
114
|
const PSDropdownDialog = this.$refs.PSDropdownDialog
|
|
119
115
|
const PSDropdownTrigger = this.$refs.PSDropdownTrigger
|
|
120
|
-
if (!PSDropdownDialog || !PSDropdownTrigger) return
|
|
116
|
+
if (!PSDropdownDialog || !PSDropdownTrigger) return
|
|
121
117
|
|
|
122
118
|
const rectTrigger = PSDropdownTrigger.getBoundingClientRect()
|
|
123
119
|
const rectDialog = PSDropdownDialog.getBoundingClientRect()
|
|
124
120
|
const windowWidth = document.documentElement.clientWidth
|
|
125
121
|
|
|
126
122
|
PSDropdownDialog.style.position = 'fixed'
|
|
127
|
-
PSDropdownDialog.style.top = `${rectTrigger.y + rectTrigger.height
|
|
128
|
-
|
|
129
|
-
if (
|
|
130
|
-
PSDropdownDialog.style.left = `${
|
|
131
|
-
|
|
123
|
+
PSDropdownDialog.style.top = `${rectTrigger.y + rectTrigger.height}px`
|
|
124
|
+
|
|
125
|
+
if (rectTrigger.x + rectDialog.width + 20 > windowWidth) {
|
|
126
|
+
PSDropdownDialog.style.left = `${
|
|
127
|
+
windowWidth - rectDialog.width - 30
|
|
128
|
+
}px`
|
|
129
|
+
} else {
|
|
132
130
|
PSDropdownDialog.style.left = `${rectTrigger.x}px`
|
|
133
131
|
}
|
|
134
132
|
|
|
135
|
-
if(rectTrigger.top < 10) {
|
|
133
|
+
if (rectTrigger.top < 10) {
|
|
136
134
|
this.close()
|
|
137
135
|
console.warn('The dropdown are too close from the top of the page')
|
|
138
136
|
return
|
|
139
137
|
}
|
|
140
138
|
|
|
141
|
-
setTimeout(() => {
|
|
142
|
-
|
|
139
|
+
setTimeout(() => {
|
|
140
|
+
PSDropdownDialog.style.opacity = 1
|
|
141
|
+
}, 10)
|
|
143
142
|
},
|
|
144
143
|
open() {
|
|
145
144
|
this.$emit('open')
|
|
@@ -149,9 +148,9 @@ export default {
|
|
|
149
148
|
setTimeout(() => {
|
|
150
149
|
this.updatePosition()
|
|
151
150
|
this.watchParentScrolling()
|
|
152
|
-
document.addEventListener(
|
|
153
|
-
window.addEventListener(
|
|
154
|
-
window.addEventListener(
|
|
151
|
+
document.addEventListener('keyup', this.handleEsc)
|
|
152
|
+
window.addEventListener('resize', this.updatePosition)
|
|
153
|
+
window.addEventListener('click', this.clickOutside)
|
|
155
154
|
}, 10)
|
|
156
155
|
},
|
|
157
156
|
close() {
|
|
@@ -162,51 +161,24 @@ export default {
|
|
|
162
161
|
this.show = false
|
|
163
162
|
this.unwatchParentScrolling()
|
|
164
163
|
}
|
|
165
|
-
document.removeEventListener(
|
|
166
|
-
document.removeEventListener(
|
|
167
|
-
document.removeEventListener(
|
|
164
|
+
document.removeEventListener('keyup', this.handleEsc)
|
|
165
|
+
document.removeEventListener('resize', this.updatePosition)
|
|
166
|
+
document.removeEventListener('click', this.clickOutside)
|
|
168
167
|
},
|
|
169
168
|
handleEsc(evt) {
|
|
170
169
|
if (this.show && evt.keyCode === 27) this.close()
|
|
171
170
|
},
|
|
172
171
|
clickOutside(event) {
|
|
173
|
-
if(!this.show) return
|
|
174
|
-
if (
|
|
172
|
+
if (!this.show) return
|
|
173
|
+
if (
|
|
174
|
+
!(
|
|
175
|
+
this.$refs.PSDropdown == event.target ||
|
|
176
|
+
this.$refs.PSDropdown.contains(event.target)
|
|
177
|
+
)
|
|
178
|
+
) {
|
|
175
179
|
this.close()
|
|
176
180
|
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
181
|
+
},
|
|
182
|
+
},
|
|
179
183
|
}
|
|
180
184
|
</script>
|
|
181
|
-
|
|
182
|
-
<style scoped>
|
|
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,82 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ul class="psui-el-dropdown-menu-list">
|
|
3
|
+
<li
|
|
4
|
+
v-for="item in getItems"
|
|
5
|
+
:key="getKeyValue(item)"
|
|
6
|
+
@click="selectItem(item)"
|
|
7
|
+
>
|
|
8
|
+
<span>{{ getKeyLabel(item) }}</span>
|
|
9
|
+
</li>
|
|
10
|
+
</ul>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
export default {
|
|
15
|
+
name: 'PsDropdownSimple',
|
|
16
|
+
props: {
|
|
17
|
+
/**
|
|
18
|
+
* It sets the text key which will retrieve a icon from Google Fonts. Make sure to get the correct description of your icon on https://fonts.google.com/.
|
|
19
|
+
*/
|
|
20
|
+
icon:{
|
|
21
|
+
type: String,
|
|
22
|
+
},
|
|
23
|
+
/**
|
|
24
|
+
* It sets the items which will be displayed on the dropdown menu.
|
|
25
|
+
*/
|
|
26
|
+
items: {
|
|
27
|
+
type: Array,
|
|
28
|
+
required: true
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* It sets the item selected on the dropdown menu.
|
|
32
|
+
*/
|
|
33
|
+
selected: {},
|
|
34
|
+
/**
|
|
35
|
+
* It sets the key label of your items if needed.
|
|
36
|
+
*/
|
|
37
|
+
keyLabel: {
|
|
38
|
+
type: [String, Function],
|
|
39
|
+
default: 'label'
|
|
40
|
+
},
|
|
41
|
+
/**
|
|
42
|
+
* It sets the key value of your items if needed.
|
|
43
|
+
*/
|
|
44
|
+
keyValue: {
|
|
45
|
+
type: [String, Function],
|
|
46
|
+
default: 'value'
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
computed: {
|
|
50
|
+
getSelected() {
|
|
51
|
+
if (this.selected) {
|
|
52
|
+
if (typeof this.selected === 'object' && this.selected[this.keyValue] ) {
|
|
53
|
+
return this.selected[this.keyValue]
|
|
54
|
+
} else {
|
|
55
|
+
return this.selected
|
|
56
|
+
}
|
|
57
|
+
} else {
|
|
58
|
+
return false
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
getItems() {
|
|
62
|
+
return this.items
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
methods: {
|
|
66
|
+
selectItem(item) {
|
|
67
|
+
this.$emit('update:selected', this.getKeyValue(item) )
|
|
68
|
+
this.$emit('change', item )
|
|
69
|
+
},
|
|
70
|
+
getKeyLabel(item) {
|
|
71
|
+
if(typeof this.keyLabel == 'function') return this.keyLabel(item)
|
|
72
|
+
if(typeof item === 'string') return item
|
|
73
|
+
return item[this.keyLabel]
|
|
74
|
+
},
|
|
75
|
+
getKeyValue(item) {
|
|
76
|
+
if(typeof this.keyValue == 'function') return this.keyValue(item)
|
|
77
|
+
if(typeof item === 'string') return item
|
|
78
|
+
return item[this.keyValue]
|
|
79
|
+
},
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
</script>
|
|
@@ -46,35 +46,62 @@
|
|
|
46
46
|
export default {
|
|
47
47
|
name: 'PsInput',
|
|
48
48
|
props: {
|
|
49
|
+
/**
|
|
50
|
+
* It sets the type of your button. default: text.
|
|
51
|
+
*/
|
|
49
52
|
type: {
|
|
50
53
|
type: String,
|
|
51
54
|
default: 'text'
|
|
52
55
|
},
|
|
56
|
+
/**
|
|
57
|
+
* It sets a placeholder for your button if needed.
|
|
58
|
+
*/
|
|
53
59
|
placeholder: {
|
|
54
60
|
type: String
|
|
55
61
|
},
|
|
62
|
+
/**
|
|
63
|
+
* It sets the label of the input if needed.
|
|
64
|
+
*/
|
|
56
65
|
label: {
|
|
57
66
|
type: String
|
|
58
67
|
},
|
|
68
|
+
/**
|
|
69
|
+
* It sets a text below the input. See Figma Text fileds & Forms.
|
|
70
|
+
*/
|
|
59
71
|
hint: {
|
|
60
72
|
type: String
|
|
61
|
-
},
|
|
73
|
+
},
|
|
74
|
+
/**
|
|
75
|
+
* It sets the layout of your button. eg: mini and default.
|
|
76
|
+
*/
|
|
62
77
|
layout: {
|
|
63
78
|
type: String,
|
|
64
79
|
default: 'default',
|
|
65
80
|
validator: (value) => ['default', 'mini'].includes(value)
|
|
66
81
|
},
|
|
82
|
+
/**
|
|
83
|
+
* It sets the value of the button.
|
|
84
|
+
*/
|
|
67
85
|
value: {
|
|
68
86
|
required: true,
|
|
69
87
|
},
|
|
88
|
+
/**
|
|
89
|
+
* It disables the input. All mouse events are disabled.
|
|
90
|
+
*/
|
|
70
91
|
disabled: {
|
|
71
92
|
type: Boolean,
|
|
72
93
|
default: false
|
|
73
94
|
},
|
|
95
|
+
/**
|
|
96
|
+
* It sets if the input found any error.
|
|
97
|
+
*/
|
|
74
98
|
hasError: {
|
|
75
99
|
type: [String, Boolean],
|
|
76
100
|
default: false
|
|
77
101
|
},
|
|
102
|
+
/**
|
|
103
|
+
* It sets a active css class based on a boolean property.
|
|
104
|
+
*/
|
|
78
105
|
active: {
|
|
79
106
|
type: Boolean,
|
|
80
107
|
default: false
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
export default {
|
|
19
19
|
name: 'PsSelectInput',
|
|
20
20
|
props: {
|
|
21
|
+
/**
|
|
22
|
+
* It sets the items which will be rendered within the select input.
|
|
23
|
+
*/
|
|
21
24
|
items: {
|
|
22
25
|
required: true
|
|
23
26
|
},
|
|
@@ -25,22 +28,40 @@ export default {
|
|
|
25
28
|
default: '',
|
|
26
29
|
required: true
|
|
27
30
|
},
|
|
31
|
+
/**
|
|
32
|
+
* It sets the value label of the select input if needed.
|
|
33
|
+
*/
|
|
28
34
|
label: {
|
|
29
35
|
default: ''
|
|
30
36
|
},
|
|
37
|
+
/**
|
|
38
|
+
* It sets a o optional label below the select input.
|
|
39
|
+
*/
|
|
31
40
|
optionalLabel:{
|
|
32
41
|
default:''
|
|
33
42
|
},
|
|
43
|
+
/**
|
|
44
|
+
* It sets the key label of your items if needed.
|
|
45
|
+
*/
|
|
34
46
|
keyLabel: {
|
|
35
47
|
default: 'label'
|
|
36
48
|
},
|
|
49
|
+
/**
|
|
50
|
+
* It sets the key value of yout items if needed.
|
|
51
|
+
*/
|
|
37
52
|
keyValue: {
|
|
38
53
|
default: 'value'
|
|
39
54
|
},
|
|
55
|
+
/**
|
|
56
|
+
* It disables the select input. All mouse events are disabled.
|
|
57
|
+
*/
|
|
40
58
|
disabled: {
|
|
41
59
|
type: Boolean,
|
|
42
60
|
default: false
|
|
43
61
|
},
|
|
62
|
+
/**
|
|
63
|
+
* It sets the layout of the select input. eg: default and mini.
|
|
64
|
+
*/
|
|
44
65
|
layout:{
|
|
45
66
|
type: String,
|
|
46
67
|
default: 'default',
|
|
@@ -21,50 +21,63 @@
|
|
|
21
21
|
|
|
22
22
|
<script>
|
|
23
23
|
export default {
|
|
24
|
-
name:
|
|
24
|
+
name: 'PsInputTextArea',
|
|
25
25
|
props: {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
}
|
|
26
|
+
/**
|
|
27
|
+
* It sets the placeholder of the textarea input.
|
|
28
|
+
*/
|
|
29
|
+
placeholder: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: ''
|
|
63
32
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
33
|
+
/**
|
|
34
|
+
* It sets the value selected of the textarea input.
|
|
35
|
+
*/
|
|
36
|
+
value: {
|
|
37
|
+
required: true,
|
|
38
|
+
},
|
|
39
|
+
/**
|
|
40
|
+
* It sets the label of the textarea input.
|
|
41
|
+
*/
|
|
42
|
+
label: {
|
|
43
|
+
type: String,
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* It sets a optional label if needed.
|
|
47
|
+
*/
|
|
48
|
+
optionalLabel:{
|
|
49
|
+
type: String,
|
|
50
|
+
},
|
|
51
|
+
/**
|
|
52
|
+
* It sets aria-required property. eg: true or false.
|
|
53
|
+
*/
|
|
54
|
+
required:{
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default:true
|
|
57
|
+
},
|
|
58
|
+
/**
|
|
59
|
+
* It sets the type of autocapitalize. See mdn web-doc for full information. default: sentences.
|
|
60
|
+
*/
|
|
61
|
+
autocapitalize: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: 'sentences'
|
|
67
64
|
},
|
|
65
|
+
/**
|
|
66
|
+
* It sets the size of the textarea input.
|
|
67
|
+
*/
|
|
68
|
+
rows: {
|
|
69
|
+
type: Number,
|
|
70
|
+
default: 5
|
|
71
|
+
},
|
|
72
|
+
/**
|
|
73
|
+
* It disabled the textarea input. All mouse events are disabled.
|
|
74
|
+
*/
|
|
75
|
+
disabled: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: false,
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
methods: {
|
|
68
81
|
onBlur(){
|
|
69
82
|
this.$emit('blur', this.$event)
|
|
70
83
|
},
|