@policystudio/policy-studio-ui-vue 1.0.21 → 1.0.25
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/dist/css/psui_styles.css +1264 -61
- package/package.json +5 -3
- package/src/assets/scss/base.scss +8 -0
- package/src/assets/scss/components/PsAccordion.scss +67 -0
- package/src/assets/scss/components/PsButton.scss +147 -0
- package/src/assets/scss/components/PsDialog.scss +71 -0
- package/src/assets/scss/components/PsInput.scss +48 -33
- package/src/assets/scss/components/PsTabHeader.scss +98 -0
- package/src/components/accordion/PsAccordion.vue +28 -24
- package/src/components/accordion/PsAccordionItem.vue +36 -67
- package/src/components/badges-and-tags/PsCardInfos.vue +38 -0
- package/src/components/badges-and-tags/PsChartLegend.vue +17 -102
- package/src/components/buttons/PsButton.vue +42 -93
- package/src/components/controls/PsToggle.vue +1 -1
- package/src/components/forms/PsInput.vue +1 -1
- package/src/components/notifications/PsDialog.vue +29 -23
- package/src/components/tabs/PsTabHeader.vue +25 -30
- package/src/index.js +6 -0
- package/src/stories/Accordion.stories.js +70 -16
- package/src/stories/Button.stories.js +93 -35
- package/src/stories/CardInfos.stories.js +16 -0
- package/src/stories/Dialog.stories.js +14 -50
- package/src/stories/Input.stories.js +36 -15
- package/src/stories/TabHeader.stories.js +6 -6
- package/tailwind.config.js +3 -2
|
@@ -1,34 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="
|
|
3
|
-
<div
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class="
|
|
7
|
-
psui-flex psui-cursor-pointer psui-transition-all psui-justify-between
|
|
8
|
-
"
|
|
9
|
-
>
|
|
10
|
-
<div
|
|
11
|
-
v-if="title"
|
|
12
|
-
:class="display ? 'selected' : ''"
|
|
13
|
-
class="psui-font-bold psui-gray04"
|
|
14
|
-
>
|
|
15
|
-
{{ title }}
|
|
16
|
-
</div>
|
|
17
|
-
<i v-if="!display" class="material-icons">{{ iconClass.closed }}</i>
|
|
18
|
-
<i v-else :class="display ? 'selected' : ''" class="material-icons">{{
|
|
19
|
-
iconClass.open
|
|
20
|
-
}}</i>
|
|
2
|
+
<div class="psui-el-accordion-item" :class="`status-${isOpen ? 'opened' : 'closed'}`">
|
|
3
|
+
<div @click="toggle" class="psui-el-accordion-item-header">
|
|
4
|
+
<h2 v-if="title" class="psui-el-accordion-item-title">{{ title }}</h2>
|
|
5
|
+
<i class="psui-el-accordion-item-icon material-icons">{{ getIcon }}</i>
|
|
21
6
|
</div>
|
|
22
|
-
<div v-if="
|
|
7
|
+
<div v-if="isOpen" class="psui-el-accordion-item-content">
|
|
23
8
|
<slot></slot>
|
|
24
9
|
</div>
|
|
25
10
|
</div>
|
|
26
11
|
</template>
|
|
27
12
|
|
|
28
13
|
<script>
|
|
29
|
-
export const iconTypes = ["mathsign", "chevron"]
|
|
30
|
-
export const fontCss = ["medium", "big"]
|
|
31
|
-
|
|
32
14
|
export default {
|
|
33
15
|
name: "PsAccordionItem",
|
|
34
16
|
props: {
|
|
@@ -36,67 +18,54 @@ export default {
|
|
|
36
18
|
type: String,
|
|
37
19
|
required: true,
|
|
38
20
|
},
|
|
39
|
-
|
|
21
|
+
'iconOpened': {
|
|
40
22
|
type: String,
|
|
41
|
-
default: "chevron",
|
|
42
23
|
},
|
|
43
|
-
|
|
24
|
+
'iconClosed': {
|
|
44
25
|
type: String,
|
|
45
|
-
default: "medium",
|
|
46
26
|
},
|
|
27
|
+
opened: {
|
|
28
|
+
type: [Boolean],
|
|
29
|
+
default: false
|
|
30
|
+
}
|
|
47
31
|
},
|
|
48
32
|
data() {
|
|
49
33
|
return {
|
|
50
|
-
|
|
34
|
+
localOpened: null,
|
|
51
35
|
}
|
|
52
36
|
},
|
|
53
37
|
computed: {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return { closed: "add", open: "remove" }
|
|
38
|
+
getIcons() {
|
|
39
|
+
return {
|
|
40
|
+
'iconOpened' : this.iconOpened ?? this.getParentVueComponentByName(this.$parent, 'PsAccordion').getIcons.iconOpened,
|
|
41
|
+
'iconClosed' : this.iconClosed ?? this.getParentVueComponentByName(this.$parent, 'PsAccordion').getIcons.iconClosed,
|
|
59
42
|
}
|
|
60
|
-
return ''
|
|
61
43
|
},
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
return "medium"
|
|
44
|
+
getIcon() {
|
|
45
|
+
return this.isOpen ? this.getIcons.iconOpened : this.getIcons.iconClosed
|
|
65
46
|
},
|
|
47
|
+
isOpen() {
|
|
48
|
+
return this.localOpened !== null ? this.localOpened : this.opened
|
|
49
|
+
}
|
|
66
50
|
},
|
|
67
51
|
methods: {
|
|
68
|
-
|
|
69
|
-
this.
|
|
52
|
+
toggle() {
|
|
53
|
+
if (this.localOpened === null) {
|
|
54
|
+
this.localOpened = !this.opened
|
|
55
|
+
} else {
|
|
56
|
+
this.localOpened = !this.localOpened
|
|
57
|
+
}
|
|
70
58
|
},
|
|
71
|
-
|
|
59
|
+
getParentVueComponentByName(comp, name) {
|
|
60
|
+
if (comp.$options.name === name) {
|
|
61
|
+
return comp
|
|
62
|
+
} else {
|
|
63
|
+
return this.getParentVueComponentByName(comp.$parent, name)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
72
67
|
}
|
|
73
68
|
</script>
|
|
74
69
|
|
|
75
|
-
<style
|
|
76
|
-
.container {
|
|
77
|
-
border-bottom: 1px solid #e6ecf2;
|
|
78
|
-
padding-top: 16px;
|
|
79
|
-
padding-bottom: 16px;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
span {
|
|
83
|
-
font-weight: 700;
|
|
84
|
-
color: #e6ecf2;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.selected {
|
|
88
|
-
color: #318fac;
|
|
89
|
-
transition: color 300ms;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.big {
|
|
93
|
-
font-size: 18px;
|
|
94
|
-
line-height: 130%;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.medium {
|
|
98
|
-
font-size: 16px;
|
|
99
|
-
line-height: 130%;
|
|
100
|
-
}
|
|
101
|
-
</style>
|
|
70
|
+
<style> /* Please, use the file src/assets/scss/components/PsAccordion.scss */</style>
|
|
102
71
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="psui-border psui-border-gray-20 psui-rounded-md psui-flex psui-flex-col psui-items-center psui-justify-center psui-px-3 psui-py-2 psui-space-y-2">
|
|
3
|
+
<h5 class="psui-text-xsmall psui-font-bold psui-text-gray-40">
|
|
4
|
+
<span class="psui-text-gray-60">{{ title }} </span>{{ subtitle }}
|
|
5
|
+
</h5>
|
|
6
|
+
<div class="psui-w-full psui-flex psui-justify-center psui-items-center psui-space-x-2 psui-text-p">
|
|
7
|
+
<span class="psui-text-blue-50 material-icons-round">{{ icon }}</span>
|
|
8
|
+
<h5 class="psui-text-gray-80">{{ total }}</h5>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
export default {
|
|
15
|
+
name: 'PsCardInfos',
|
|
16
|
+
props: {
|
|
17
|
+
title: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: 'Total',
|
|
20
|
+
},
|
|
21
|
+
subtitle: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: '',
|
|
24
|
+
},
|
|
25
|
+
icon: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: 'edit',
|
|
28
|
+
},
|
|
29
|
+
total: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: '',
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<style scoped>
|
|
38
|
+
</style>
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="
|
|
3
|
-
<div class="
|
|
4
|
-
<div class="psui-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
</div>
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
<span :class="isBar"></span>
|
|
11
|
-
<span :class="isPercentage">{{ percentage }}</span>
|
|
12
|
-
</div>
|
|
2
|
+
<div class="psui-flex psui-p-2 psui-rounded">
|
|
3
|
+
<div class="psui-flex psui-flex-shrink-0">
|
|
4
|
+
<div class="dot psui-rounded-full" :style="dotColor"></div>
|
|
5
|
+
</div>
|
|
6
|
+
<div class="psui-flex-grow-1">
|
|
7
|
+
<div class="psui-text-xsmall psui-text-gray-50 psui-font-bold psui-mb-1">{{ text }}</div>
|
|
8
|
+
<span v-if="this.total" class="psui-text-p psui-text-gray-80">{{ total }}</span>
|
|
9
|
+
<span class="psui-text-gray-50" v-if="percentage"><span class="psui-text-gray-30" v-if="total && percentage"> | </span>{{ percentage }}%</span>
|
|
13
10
|
</div>
|
|
14
11
|
</div>
|
|
15
12
|
</template>
|
|
@@ -21,108 +18,26 @@ export default {
|
|
|
21
18
|
type: String,
|
|
22
19
|
default: 'Climate Zone 10',
|
|
23
20
|
},
|
|
24
|
-
|
|
25
|
-
type:
|
|
26
|
-
// required: true,
|
|
21
|
+
total: {
|
|
22
|
+
type: String,
|
|
27
23
|
default: null,
|
|
28
24
|
},
|
|
29
25
|
percentage: {
|
|
30
26
|
type: String,
|
|
31
|
-
|
|
32
|
-
default: '',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
computed: {
|
|
36
|
-
isValue() {
|
|
37
|
-
if (this.value) {
|
|
38
|
-
return 'value'
|
|
39
|
-
} else {
|
|
40
|
-
return 'hide'
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
isPercentage() {
|
|
44
|
-
if (this.percentage) {
|
|
45
|
-
return 'percentage'
|
|
46
|
-
} else {
|
|
47
|
-
return 'hide'
|
|
48
|
-
}
|
|
27
|
+
default: null,
|
|
49
28
|
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
} else {
|
|
54
|
-
return 'hide'
|
|
55
|
-
}
|
|
29
|
+
dotColor: {
|
|
30
|
+
type: Object,
|
|
31
|
+
default: null
|
|
56
32
|
},
|
|
57
33
|
},
|
|
58
34
|
}
|
|
59
35
|
</script>
|
|
60
36
|
|
|
61
37
|
<style scoped>
|
|
62
|
-
.toView {
|
|
63
|
-
/* display: flex; */
|
|
64
|
-
/* flex-direction: row; */
|
|
65
|
-
/* padding: 32px; */
|
|
66
|
-
|
|
67
|
-
width: 351px;
|
|
68
|
-
height: 119px;
|
|
69
|
-
|
|
70
|
-
background: #f3ebfa;
|
|
71
|
-
border: 1.5px dashed #7b61ff;
|
|
72
|
-
/* border-radius: 5px; */
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.container {
|
|
76
|
-
/* padding: 8px; */
|
|
77
|
-
|
|
78
|
-
width: fit-content;
|
|
79
|
-
height: fit-content;
|
|
80
|
-
|
|
81
|
-
background: #ffffff;
|
|
82
|
-
/* border-radius: 4px; */
|
|
83
|
-
|
|
84
|
-
/* margin: 0px 32px; */
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.hide {
|
|
88
|
-
display: none;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
38
|
.dot {
|
|
92
|
-
width: 14px;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
border-radius: 8px;
|
|
96
|
-
margin: 0px 6px 0px 0px;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.text {
|
|
100
|
-
font-weight: bold;
|
|
101
|
-
font-size: 12px;
|
|
102
|
-
line-height: 120%;
|
|
103
|
-
|
|
104
|
-
color: #798490;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.container1 {
|
|
108
|
-
margin: 0px 0px 0px 20px;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.value {
|
|
112
|
-
color: #28323b;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.percentage {
|
|
116
|
-
color: #798490;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.bar {
|
|
120
|
-
background-color: #d6dde5;
|
|
121
|
-
height: 14px;
|
|
122
|
-
|
|
123
|
-
border-radius: 2px;
|
|
124
|
-
|
|
125
|
-
padding: 0px 1px;
|
|
126
|
-
margin-right: 3px;
|
|
39
|
+
width: 14px; height: 14px;
|
|
40
|
+
background-color: #43cec2;
|
|
41
|
+
margin-right: 6px;
|
|
127
42
|
}
|
|
128
43
|
</style>
|
|
@@ -1,129 +1,78 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<button
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
>
|
|
11
|
-
{{ icon }}
|
|
12
|
-
</i>
|
|
13
|
-
<span
|
|
14
|
-
v-if="label"
|
|
15
|
-
class="psui-flex-grow psui-text-left"
|
|
16
|
-
>{{ label }}
|
|
17
|
-
</span>
|
|
18
|
-
<i
|
|
19
|
-
v-if="iconRight"
|
|
20
|
-
:class="['psui-ml-2', iconClasses]"
|
|
21
|
-
>
|
|
22
|
-
{{ iconRight }}
|
|
23
|
-
</i>
|
|
3
|
+
@click="onClick()"
|
|
4
|
+
@mouseenter="onMouseEnter"
|
|
5
|
+
@mouseleave="onMouseLeave"
|
|
6
|
+
class='psui-el-button'
|
|
7
|
+
:class="[getComponentClass, {'hover': isHover}, {'disabled': disabled}]"
|
|
8
|
+
>
|
|
9
|
+
<i v-if="icon" :class='iconClass' class='material-icons-round'>{{icon}}</i>
|
|
10
|
+
<span v-if="label">{{ label }}</span>
|
|
24
11
|
</button>
|
|
25
12
|
</template>
|
|
26
13
|
|
|
27
14
|
<script>
|
|
28
|
-
export const sizes = ['big', 'medium', 'small']
|
|
29
15
|
export default {
|
|
30
16
|
props: {
|
|
31
17
|
label: {
|
|
32
18
|
type: String,
|
|
33
19
|
},
|
|
34
|
-
|
|
35
|
-
type:
|
|
36
|
-
default:
|
|
37
|
-
|
|
38
|
-
ghost: {
|
|
39
|
-
type: Boolean,
|
|
40
|
-
default: false
|
|
41
|
-
},
|
|
42
|
-
textOnly: {
|
|
43
|
-
type: Boolean,
|
|
44
|
-
default: false
|
|
20
|
+
layout: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: 'solid',
|
|
23
|
+
validator: (value) => ['solid','outline','ghost','onlytext'].includes(value)
|
|
45
24
|
},
|
|
46
25
|
icon: {
|
|
47
26
|
type: String,
|
|
48
27
|
},
|
|
49
|
-
|
|
28
|
+
iconPosition:{
|
|
50
29
|
type: String,
|
|
30
|
+
default: 'left',
|
|
31
|
+
validator: (value) => ['left','right'].includes(value)
|
|
51
32
|
},
|
|
52
33
|
size: {
|
|
53
34
|
type: String,
|
|
54
35
|
default: 'big',
|
|
55
|
-
validator: (value) =>
|
|
36
|
+
validator: (value) => ['small','medium','big','custom'].includes(value)
|
|
56
37
|
},
|
|
57
38
|
disabled: {
|
|
58
|
-
type:
|
|
59
|
-
|
|
60
|
-
'text-color': {
|
|
61
|
-
type: String,
|
|
62
|
-
default: ''
|
|
63
|
-
},
|
|
64
|
-
'icon-color': {
|
|
65
|
-
type: String,
|
|
66
|
-
default: ''
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: false
|
|
67
41
|
},
|
|
68
|
-
|
|
69
|
-
type: String
|
|
70
|
-
|
|
42
|
+
iconClass:{
|
|
43
|
+
type: String
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
data(){
|
|
47
|
+
return {
|
|
48
|
+
isHover: false,
|
|
71
49
|
}
|
|
72
50
|
},
|
|
73
51
|
computed: {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
classes() {
|
|
80
|
-
let sizeCss = ''
|
|
81
|
-
|
|
82
|
-
if (this.size === 'medium') sizeCss = 'medium'
|
|
83
|
-
if (this.size === 'small') sizeCss = 'small'
|
|
84
|
-
if (this.size === 'big') sizeCss = 'big'
|
|
85
|
-
|
|
86
|
-
if (this.outline) return `${sizeCss} psui-bg-white psui-border ${this.disabled ? 'psui-border-gray-40 psui-text-gray-40 psui-cursor-default' : 'psui-border-blue-60 psui-text-blue-60'}`
|
|
87
|
-
if (this.ghost) return `${sizeCss} ${this.disabled ? 'psui-bg-gray-20 psui-text-gray-40 psui-cursor-default' : 'psui-bg-blue-20 psui-text-blue-60 active:psui-shadow-inner'}`
|
|
88
|
-
if (this.textOnly) {
|
|
89
|
-
const hasTextColor = this.textColor.length > 0
|
|
90
|
-
const color = hasTextColor ? this.textColor.split('hover:')[0] : ''
|
|
91
|
-
const hover = hasTextColor ? this.textColor.split('hover:')[1] : ''
|
|
92
|
-
|
|
93
|
-
let textCss = 'psui-text-blue-50 hover:psui-text-blue-60'
|
|
94
|
-
if (this.disabled) textCss = 'psui-text-gray-40 psui-cursor-default'
|
|
95
|
-
|
|
96
|
-
if (hasTextColor) textCss = `psui-text-${color}`
|
|
97
|
-
if (hover) textCss += `hover:psui-text-${hover}`
|
|
98
|
-
|
|
99
|
-
return `${sizeCss} ${textCss}`
|
|
52
|
+
getComponentClass(){
|
|
53
|
+
if (this.size != 'custom') {
|
|
54
|
+
return `layout-${this.layout} size-${this.size} icon-${this.iconPosition}`
|
|
55
|
+
} else {
|
|
56
|
+
return `layout-${this.layout} icon-${this.iconPosition}`
|
|
100
57
|
}
|
|
101
|
-
|
|
102
|
-
return `${sizeCss} psui-bg-blue-60 hover:psui-bg-blue-50 psui-text-white active:psui-shadow-inner psui-cursor-pointer`
|
|
103
|
-
}
|
|
58
|
+
}
|
|
104
59
|
},
|
|
105
60
|
methods: {
|
|
106
61
|
onClick() {
|
|
107
|
-
if (this.disabled) return
|
|
62
|
+
if (this.disabled) return
|
|
108
63
|
this.$emit('click')
|
|
64
|
+
},
|
|
65
|
+
onMouseEnter(){
|
|
66
|
+
if(!this.disabled){
|
|
67
|
+
this.isHover = true
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
onMouseLeave(){
|
|
71
|
+
if(!this.disabled){
|
|
72
|
+
this.isHover = false
|
|
73
|
+
}
|
|
109
74
|
}
|
|
110
75
|
}
|
|
111
76
|
}
|
|
112
77
|
</script>
|
|
113
78
|
|
|
114
|
-
<style scoped>
|
|
115
|
-
.small {
|
|
116
|
-
padding: 4px 8px 4px 8px;
|
|
117
|
-
font-size: 14px;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.medium{
|
|
121
|
-
padding: 7px 16px 7px 16px;
|
|
122
|
-
font-size: 14px;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.big{
|
|
126
|
-
padding: 9.5px 16px 9.5px 16px;
|
|
127
|
-
font-size: 16px;
|
|
128
|
-
}
|
|
129
|
-
</style>
|
|
@@ -1,28 +1,33 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="psui-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
<div class="psui-el-dialog" :class="getComponentClass">
|
|
3
|
+
<div class="psui-el-dialog-icon">
|
|
4
|
+
<i class="material-icons-round">{{icon}}</i>
|
|
5
|
+
</div>
|
|
6
|
+
<div class="psui-el-dialog-wrapper">
|
|
7
|
+
<div class="psui-el-dialog-default">
|
|
8
|
+
<slot>
|
|
9
|
+
<p class="psui-el-dialog-message">{{ message }}</p>
|
|
10
|
+
</slot>
|
|
10
11
|
</div>
|
|
11
|
-
<div class="psui-
|
|
12
|
-
<slot
|
|
13
|
-
<button @click="onClose" class="psui-w-4 psui-h-4 focus:psui-outline-none">
|
|
14
|
-
<i class="material-icons-round">close</i>
|
|
15
|
-
</button>
|
|
12
|
+
<div class="psui-el-dialog-action">
|
|
13
|
+
<slot name="action"></slot>
|
|
16
14
|
</div>
|
|
15
|
+
</div>
|
|
16
|
+
<button
|
|
17
|
+
class="psui-el-dialog-close"
|
|
18
|
+
v-if="hasClose"
|
|
19
|
+
@click="onClose">
|
|
20
|
+
<i class="material-icons-round">close</i>
|
|
21
|
+
</button>
|
|
17
22
|
</div>
|
|
18
23
|
</template>
|
|
19
24
|
|
|
20
25
|
<script>
|
|
21
|
-
|
|
26
|
+
// Figma - 3. Inline Dialog https://www.figma.com/file/Tto8hrNlSfuPcwd1pfqogF/%E2%9A%A1%EF%B8%8F-Design-System?node-id=3694%3A55841
|
|
22
27
|
export default {
|
|
23
28
|
name: 'PsDialog',
|
|
24
29
|
props: {
|
|
25
|
-
|
|
30
|
+
theme: {
|
|
26
31
|
type: String,
|
|
27
32
|
default: 'informative',
|
|
28
33
|
validator: (value) => ['informative', 'success', 'alert'].includes(value)
|
|
@@ -35,18 +40,19 @@ export default {
|
|
|
35
40
|
default: 'horizontal',
|
|
36
41
|
validator: (value) => ['horizontal', 'vertical'].includes(value)
|
|
37
42
|
},
|
|
38
|
-
|
|
39
|
-
type:
|
|
43
|
+
hasClose: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: true
|
|
46
|
+
},
|
|
47
|
+
icon: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: 'info'
|
|
40
50
|
}
|
|
41
51
|
},
|
|
42
52
|
emits:['close'],
|
|
43
53
|
computed: {
|
|
44
|
-
|
|
45
|
-
|
|
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
|
|
54
|
+
getComponentClass() {
|
|
55
|
+
return [`layout-${this.layout}`, `theme-${this.theme}`, `close-${this.hasClose ? 'on' : 'off'}` ]
|
|
50
56
|
}
|
|
51
57
|
},
|
|
52
58
|
methods:{
|
|
@@ -1,37 +1,36 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
|
+
class="psui-el-tab-header"
|
|
4
|
+
:class="[getComponentClass, `layout-${layout}`]"
|
|
5
|
+
role="group"
|
|
6
|
+
>
|
|
7
|
+
|
|
3
8
|
<button
|
|
4
9
|
type="button"
|
|
5
10
|
v-for="item in getItems"
|
|
6
11
|
:key="item[keyValue]"
|
|
7
12
|
@click="selectTab(item)"
|
|
8
|
-
:class="[
|
|
9
|
-
classes,
|
|
10
|
-
{ 'psui-bg-blue-60 psui-text-white': getSelected === item[keyValue] && theme === 'standard' },
|
|
11
|
-
{ 'psui-border-b-2 psui-border-blue-60 psui-text-blue-60 psui-font-bold': getSelected === item[keyValue] && theme === 'underline' },
|
|
12
|
-
{ 'psui-text-blue-60 psui-font-bold psui-bg-white hover:psui-text-blue-60': getSelected === item[keyValue] && theme === 'folder' }
|
|
13
|
-
]"
|
|
13
|
+
:class="{ 'status-active': getSelected === item[keyValue] }"
|
|
14
14
|
>
|
|
15
15
|
{{ item[keyLabel] }}
|
|
16
16
|
</button>
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
</div>
|
|
18
19
|
</template>
|
|
19
20
|
|
|
20
21
|
<script>
|
|
21
|
-
export const themeOptions = ['standard', 'underline', 'folder']
|
|
22
22
|
export default {
|
|
23
23
|
name: 'PsTabHeader',
|
|
24
24
|
props: {
|
|
25
|
-
|
|
25
|
+
layout: {
|
|
26
26
|
type: String,
|
|
27
27
|
default: 'standard',
|
|
28
|
-
validator: (value) =>
|
|
28
|
+
validator: (value) => ['standard', 'underline', 'folder'].includes(value)
|
|
29
29
|
},
|
|
30
30
|
items: {
|
|
31
31
|
type: Array,
|
|
32
32
|
required: true
|
|
33
33
|
},
|
|
34
|
-
selected: {},
|
|
35
34
|
keyLabel: {
|
|
36
35
|
type: String,
|
|
37
36
|
default: 'label'
|
|
@@ -39,26 +38,20 @@ export default {
|
|
|
39
38
|
keyValue: {
|
|
40
39
|
type: String,
|
|
41
40
|
default: 'value'
|
|
42
|
-
}
|
|
41
|
+
},
|
|
42
|
+
disabled: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: false
|
|
45
|
+
},
|
|
46
|
+
selected: {},
|
|
43
47
|
},
|
|
44
48
|
computed: {
|
|
45
|
-
|
|
46
|
-
if (this.
|
|
47
|
-
return '
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return 'psui-flex psui-space-x-1'
|
|
51
|
-
}
|
|
52
|
-
return 'psui-inline-flex psui-rounded-md psui-flex psui-gap-x-px'
|
|
53
|
-
},
|
|
54
|
-
classes() {
|
|
55
|
-
if (this.theme === 'underline') {
|
|
56
|
-
return 'psui-text-gray-60 psui-pb-3 hover:psui-text-blue-60'
|
|
57
|
-
}
|
|
58
|
-
if (this.theme === 'folder') {
|
|
59
|
-
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'
|
|
49
|
+
getComponentClass() {
|
|
50
|
+
if (this.disabled) {
|
|
51
|
+
return 'status-disabled'
|
|
52
|
+
} else {
|
|
53
|
+
return 'status-resting'
|
|
60
54
|
}
|
|
61
|
-
return 'psui-bg-gray-10 psui-px-4 psui-py-2 psui-text-gray-60 hover:psui-text-blue-60 last:psui-rounded-r-lg first:psui-rounded-l-lg active:psui-text-white active:psui-bg-blue-60'
|
|
62
55
|
},
|
|
63
56
|
getIsObject() {
|
|
64
57
|
return typeof this.selected === 'object'
|
|
@@ -85,7 +78,7 @@ export default {
|
|
|
85
78
|
} else {
|
|
86
79
|
return this.items
|
|
87
80
|
}
|
|
88
|
-
}
|
|
81
|
+
},
|
|
89
82
|
},
|
|
90
83
|
methods: {
|
|
91
84
|
selectTab(item) {
|
|
@@ -96,3 +89,5 @@ export default {
|
|
|
96
89
|
|
|
97
90
|
}
|
|
98
91
|
</script>
|
|
92
|
+
|
|
93
|
+
<style> /* Please, use the file src/assets/scss/components/PsTabHeader.scss */</style>
|