@policystudio/policy-studio-ui-vue 1.0.19 → 1.0.23
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 +1 -2
- package/.storybook/main.js +10 -2
- package/.storybook/preview.js +1 -1
- package/README.md +8 -0
- package/babel.config.js +3 -0
- package/backup-package-lock.json +37194 -0
- package/dist/css/psui_styles.css +15709 -14658
- package/package.json +32 -21
- package/postcss.config.js +2 -0
- package/src/assets/scss/base.scss +9 -29
- package/src/assets/scss/components/PsAccordion.scss +63 -0
- package/src/assets/scss/components/PsButton.scss +145 -0
- package/src/assets/scss/components/PsInput.scss +104 -0
- package/src/components/accordion/PsAccordion.vue +30 -21
- package/src/components/accordion/PsAccordionItem.vue +29 -67
- package/src/components/badges-and-tags/PsCardInfos.vue +38 -0
- package/src/components/badges-and-tags/PsChartLegend.vue +43 -0
- package/src/components/badges-and-tags/PsClimateZoneBadge.vue +18 -0
- package/src/components/badges-and-tags/PsCostEffectBar.vue +114 -0
- package/src/components/badges-and-tags/PsHighlightRippleDot.vue +78 -0
- package/src/components/badges-and-tags/PsMiniTag.vue +46 -0
- package/src/components/badges-and-tags/PsProgressBar.vue +0 -0
- package/src/components/buttons/PsButton.vue +43 -75
- package/src/components/chips/PsChips.vue +46 -38
- package/src/components/controls/PsCheckbox.vue +29 -16
- package/src/components/controls/PsDraggable.vue +174 -3
- package/src/components/controls/PsRadioButton.vue +74 -43
- package/src/components/controls/PsSwitch.vue +75 -76
- package/src/components/controls/PsToggle.vue +1 -1
- package/src/components/datatable/PsDataTable.vue +25 -29
- package/src/components/datatable/PsDataTableItem.vue +2 -2
- package/src/components/forms/PsInput.vue +122 -102
- package/src/components/notifications/PsDialog.vue +37 -18
- package/src/components/tabs/PsTabHeader.vue +3 -2
- package/src/components/tooltip/PsDialogTooltip.vue +79 -0
- package/src/components/tooltip/PsRichTooltip.vue +44 -0
- package/src/components/tooltip/PsTooltip.vue +118 -0
- package/src/components/ui/PsIcon.vue +87 -24
- package/src/index.js +29 -9
- package/src/stories/Accordion.stories.js +88 -28
- package/src/stories/Button.stories.js +86 -38
- package/src/stories/CardInfos.stories.js +16 -0
- package/src/stories/ChartLegend.stories.js +16 -0
- package/src/stories/Checkbox.stories.js +6 -6
- package/src/stories/Chips.stories.js +14 -8
- package/src/stories/ClimateZoneBadge.stories.js +24 -0
- package/src/stories/Colors.stories.mdx +35 -35
- package/src/stories/CostEffectBar.stories.js +23 -0
- package/src/stories/Datatable.stories.js +15 -8
- package/src/stories/Dialog.stories.js +150 -17
- package/src/stories/Draggable.stories.js +22 -0
- package/src/stories/Dropdown.stories.js +8 -10
- package/src/stories/HighlightRippleDot.stories.js +16 -0
- package/src/stories/Input.stories.js +71 -19
- package/src/stories/MiniTag.stories.js +46 -0
- package/src/stories/ProgressBar.stories.js +23 -0
- package/src/stories/RadioButton.stories.js +15 -15
- package/src/stories/Slider.stories.js +9 -9
- package/src/stories/Swith.stories.js +10 -10
- package/src/stories/TabHeader.stories.js +9 -9
- package/src/stories/Toast.stories.js +13 -13
- package/src/stories/Toggle.stories.js +12 -13
- package/src/stories/Tooltip.stories.js +114 -0
- package/src/util/GeneralFunctions.js +11 -12
- package/src/util/imageLoader.js +50 -0
- package/tailwind.config.js +71 -47
- package/src/assets/scss/tailwind.css +0 -70643
- package/src/assets/scss/tailwind.scss +0 -61088
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="psui-flex psui-p-2 psui-rounded">
|
|
3
|
+
<div class="psui-flex psui-flex-shrink-0">
|
|
4
|
+
<div :class="dotClass" 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>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
export default {
|
|
16
|
+
props: {
|
|
17
|
+
text: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: 'Climate Zone 10',
|
|
20
|
+
},
|
|
21
|
+
total: {
|
|
22
|
+
type: Number,
|
|
23
|
+
default: null,
|
|
24
|
+
},
|
|
25
|
+
percentage: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: false,
|
|
28
|
+
},
|
|
29
|
+
dotColor: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: ''
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<style scoped>
|
|
38
|
+
.dot {
|
|
39
|
+
width: 14px; height: 14px;
|
|
40
|
+
background-color: #43cec2;
|
|
41
|
+
margin-right: 6px;
|
|
42
|
+
}
|
|
43
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<button
|
|
3
|
+
class="psui-flex psui-p-3 psui-bg-gray-10 psui-text-gray-50 hover:psui-text-blue-60 hover:psui-bg-blue-20 psui-transition-all psui-duration-300 psui-ease-out psui-shadow-lg psui-rounded"
|
|
4
|
+
>
|
|
5
|
+
<i v-if="icon" class="material-icons psui-text-base"> {{ icon }} </i>
|
|
6
|
+
<p class="psui-text-sm">10</p>
|
|
7
|
+
</button>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
export default {
|
|
12
|
+
props: {
|
|
13
|
+
icon: {
|
|
14
|
+
type: String,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="container">
|
|
4
|
+
<div
|
|
5
|
+
class="loading-bar"
|
|
6
|
+
:class="{
|
|
7
|
+
'psui-bg-blue-20': value >= breakEven,
|
|
8
|
+
'psui-bg-red-10': value < breakEven,
|
|
9
|
+
}"
|
|
10
|
+
>
|
|
11
|
+
<span class="breakEven" :style="breakEvenPosition"> </span>
|
|
12
|
+
|
|
13
|
+
<input
|
|
14
|
+
type="number"
|
|
15
|
+
min="0"
|
|
16
|
+
max="100"
|
|
17
|
+
class="percentage"
|
|
18
|
+
:style="{ width: `${value}px` }"
|
|
19
|
+
:class="{
|
|
20
|
+
'psui-bg-blue-60': value >= breakEven,
|
|
21
|
+
'psui-bg-red-20': value < breakEven,
|
|
22
|
+
}"
|
|
23
|
+
/>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script>
|
|
30
|
+
export default {
|
|
31
|
+
props: {
|
|
32
|
+
value: {
|
|
33
|
+
type: Number,
|
|
34
|
+
required: true,
|
|
35
|
+
default: 0,
|
|
36
|
+
},
|
|
37
|
+
breakEven: {
|
|
38
|
+
type: Number,
|
|
39
|
+
required: true,
|
|
40
|
+
default: 1,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
data() {
|
|
44
|
+
return {
|
|
45
|
+
errors: [],
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
computed: {
|
|
50
|
+
valueBar() {
|
|
51
|
+
if (this.value > 100) return 100
|
|
52
|
+
else if (this.value < 0) return 0
|
|
53
|
+
else return this.value
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
breakEvenPosition() {
|
|
57
|
+
return `left: ${this.breakEven}px`
|
|
58
|
+
},
|
|
59
|
+
getIsBreakEven() {
|
|
60
|
+
if (this.breakEven < 0) return 0
|
|
61
|
+
else if (this.breakEven > 100) return 100
|
|
62
|
+
else return this.breakEven
|
|
63
|
+
// else return true;
|
|
64
|
+
// return this.value > this.breakEven ? true : false;
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
}
|
|
68
|
+
</script>
|
|
69
|
+
|
|
70
|
+
<style scoped>
|
|
71
|
+
.container {
|
|
72
|
+
overflow: visible;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.loading-bar {
|
|
76
|
+
position: relative;
|
|
77
|
+
width: 100px;
|
|
78
|
+
height: 8px;
|
|
79
|
+
border-radius: 15px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.loading-bar .percentage {
|
|
83
|
+
position: absolute;
|
|
84
|
+
display: block;
|
|
85
|
+
max-width: 100px;
|
|
86
|
+
height: 100%;
|
|
87
|
+
border-radius: 15px;
|
|
88
|
+
overflow: visible;
|
|
89
|
+
background-size: 30px 30px;
|
|
90
|
+
animation: animate-stripes 3s linear infinite;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.breakEven {
|
|
94
|
+
position: absolute;
|
|
95
|
+
background-color: #d6dde5;
|
|
96
|
+
width: 2px;
|
|
97
|
+
height: 14px;
|
|
98
|
+
/* max-width: 100px; */
|
|
99
|
+
border-radius: 2px;
|
|
100
|
+
top: -3px;
|
|
101
|
+
z-index: 1;
|
|
102
|
+
/* left: 2px; */
|
|
103
|
+
/* right: -2px; */
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@keyframes animate-stripes {
|
|
107
|
+
0% {
|
|
108
|
+
background-position: 0 0;
|
|
109
|
+
}
|
|
110
|
+
100% {
|
|
111
|
+
background-position: 60px 0;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
</style>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="example">
|
|
3
|
+
<div class="dot"></div>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
export default {}
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<style scoped>
|
|
12
|
+
.example {
|
|
13
|
+
position: static;
|
|
14
|
+
/* margin: 0px 32px; */
|
|
15
|
+
/* width: 275px;
|
|
16
|
+
height: 229px; */
|
|
17
|
+
/* left: 0px;
|
|
18
|
+
top: 0px; */
|
|
19
|
+
/* border: 1.5px dashed #9b51e0; */
|
|
20
|
+
/* background: #f3f6f9; */
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
}
|
|
23
|
+
.dot {
|
|
24
|
+
background: #5db883;
|
|
25
|
+
/* border: solid 1px #2bb24c; */
|
|
26
|
+
border-radius: 50%;
|
|
27
|
+
/* box-shadow: 0px 0 2px #2bb24c; */
|
|
28
|
+
width: 8px;
|
|
29
|
+
height: 8px;
|
|
30
|
+
/* left: 6px;
|
|
31
|
+
top: 6px; */
|
|
32
|
+
margin: 100px auto;
|
|
33
|
+
position: relative;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.dot::before,
|
|
37
|
+
.dot::after {
|
|
38
|
+
background: #def8e8;
|
|
39
|
+
border: solid 0px #2bb24c;
|
|
40
|
+
border-radius: 50%;
|
|
41
|
+
content: '';
|
|
42
|
+
width: 36px;
|
|
43
|
+
height: 36px;
|
|
44
|
+
left: -8px;
|
|
45
|
+
top: -8px;
|
|
46
|
+
position: absolute;
|
|
47
|
+
transform-origin: center center;
|
|
48
|
+
transform: scale(1) translate(-1px, -1px);
|
|
49
|
+
}
|
|
50
|
+
.dot::before {
|
|
51
|
+
animation: ripple 1s infinite;
|
|
52
|
+
}
|
|
53
|
+
.dot::after {
|
|
54
|
+
animation: ripple 1s infinite;
|
|
55
|
+
/* animation-delay: 0.4s; */
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@keyframes ripple {
|
|
59
|
+
0% {
|
|
60
|
+
/* transform: scale(1) translate(-1px, -1px);
|
|
61
|
+
opacity: 0.75; */
|
|
62
|
+
left: 5px;
|
|
63
|
+
top: 5px;
|
|
64
|
+
opacity: 0.95;
|
|
65
|
+
width: 0;
|
|
66
|
+
height: 0;
|
|
67
|
+
}
|
|
68
|
+
100% {
|
|
69
|
+
/* transform: scale(2) translate(-1px, -1px);
|
|
70
|
+
opacity: 0; */
|
|
71
|
+
left: -13px;
|
|
72
|
+
top: -13px;
|
|
73
|
+
opacity: 0;
|
|
74
|
+
width: 36px;
|
|
75
|
+
height: 36px;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
</style>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="cssClass">
|
|
3
|
+
<div class="psui-w-full">{{ message }}</div>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
export const typeOptions = ['informative', 'success', 'warning', 'error']
|
|
9
|
+
export default {
|
|
10
|
+
name: 'PsMiniTag',
|
|
11
|
+
props: {
|
|
12
|
+
type: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: 'informative',
|
|
15
|
+
validator: (value) => typeOptions.indexOf(value) !== -1,
|
|
16
|
+
},
|
|
17
|
+
message: {
|
|
18
|
+
type: String,
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
data() {
|
|
23
|
+
return {
|
|
24
|
+
colors: {
|
|
25
|
+
informative: { background: 'blue-20', color: 'blue-60' },
|
|
26
|
+
success: { background: 'green-10', color: 'green-70' },
|
|
27
|
+
warning: { background: 'yellow-10', color: 'yellow-70' },
|
|
28
|
+
error: { background: 'red-10', color: 'red-20' },
|
|
29
|
+
},
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
computed: {
|
|
33
|
+
cssClass() {
|
|
34
|
+
return `fit-content psui-flex psui-rounded-lg psui-px-2 psui-items-center psui-justify-center psui-flex-row psui-mx-6 psui-bg-${
|
|
35
|
+
this.colors[this.type].background
|
|
36
|
+
} psui-text-${this.colors[this.type].color}`
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<style scoped>
|
|
43
|
+
.fit-content {
|
|
44
|
+
width: fit-content;
|
|
45
|
+
}
|
|
46
|
+
</style>
|
|
File without changes
|
|
@@ -1,109 +1,77 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<button
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
>
|
|
11
|
-
{{ icon }}
|
|
12
|
-
</i>
|
|
13
|
-
<div
|
|
14
|
-
v-if="label"
|
|
15
|
-
class="psui-flex-grow psui-text-left"
|
|
16
|
-
>{{ label }}
|
|
17
|
-
</div>
|
|
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}, {'active': isActive}, {'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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
type: Boolean,
|
|
40
|
-
default: false
|
|
41
|
-
},
|
|
42
|
-
textOnly: {
|
|
43
|
-
type: Boolean,
|
|
44
|
-
default: false
|
|
20
|
+
layout: {
|
|
21
|
+
type: String,
|
|
22
|
+
required: true,
|
|
23
|
+
default: 'solid',
|
|
24
|
+
validator: (value) => ['solid','outline','ghost','onlytext'].includes(value)
|
|
45
25
|
},
|
|
46
26
|
icon: {
|
|
47
27
|
type: String,
|
|
48
28
|
},
|
|
49
|
-
|
|
29
|
+
iconPosition:{
|
|
50
30
|
type: String,
|
|
31
|
+
default: 'right',
|
|
32
|
+
validator: (value) => ['left','right'].includes(value)
|
|
51
33
|
},
|
|
52
34
|
size: {
|
|
53
35
|
type: String,
|
|
54
36
|
default: 'big',
|
|
55
|
-
validator: (value) =>
|
|
37
|
+
validator: (value) => ['small','medium','big'].includes(value)
|
|
56
38
|
},
|
|
57
39
|
disabled: {
|
|
58
|
-
type:
|
|
59
|
-
|
|
60
|
-
'text-color': {
|
|
61
|
-
type: String,
|
|
62
|
-
default: ''
|
|
63
|
-
},
|
|
64
|
-
'icon-color': {
|
|
65
|
-
type: String,
|
|
66
|
-
default: ''
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: false
|
|
67
42
|
},
|
|
68
|
-
|
|
69
|
-
type: String
|
|
70
|
-
|
|
43
|
+
iconClass:{
|
|
44
|
+
type: String
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
data(){
|
|
48
|
+
return {
|
|
49
|
+
isHover: false,
|
|
50
|
+
isActive: false,
|
|
71
51
|
}
|
|
72
52
|
},
|
|
73
53
|
computed: {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return `psui-my-auto material-icons ${size} ${color}`
|
|
78
|
-
},
|
|
79
|
-
classes() {
|
|
80
|
-
let sizeCss = 'psui-px-4 psui-py-2'
|
|
81
|
-
if (this.size === 'medium') sizeCss = 'psui-px-4 psui-py-1'
|
|
82
|
-
if (this.size === 'small') sizeCss = 'psui-px-2 psui-py-psui-px psui-text-sm'
|
|
83
|
-
if (this.outline) return `${sizeCss} psui-bg-white psui-border ${this.disabled ? 'psui-border-gray-40 psui-text-gray-40' : 'psui-border-blue-60 psui-text-blue-60'}`
|
|
84
|
-
if (this.ghost) return `${sizeCss} ${this.disabled ? 'psui-bg-gray-20 psui-text-gray-40' : 'psui-bg-blue-20 psui-text-blue-60 active:psui-shadow-inner'}`
|
|
85
|
-
if (this.textOnly) {
|
|
86
|
-
const hasTextColor = this.textColor.length > 0
|
|
87
|
-
const color = hasTextColor ? this.textColor.split('hover:')[0] : ''
|
|
88
|
-
const hover = hasTextColor ? this.textColor.split('hover:')[1] : ''
|
|
89
|
-
|
|
90
|
-
let textCss = 'psui-text-blue-50 hover:psui-text-blue-60'
|
|
91
|
-
if (this.disabled) textCss = 'psui-text-gray-40'
|
|
92
|
-
|
|
93
|
-
if (hasTextColor) textCss = `psui-text-${color}`
|
|
94
|
-
if (hover) textCss += `hover:psui-text-${hover}`
|
|
95
|
-
|
|
96
|
-
return `${sizeCss} ${textCss}`
|
|
97
|
-
}
|
|
98
|
-
if (this.disabled) return `${sizeCss} psui-bg-gray-20 psui-text-gray-40`
|
|
99
|
-
return `${sizeCss} psui-bg-blue-60 hover:psui-bg-blue-50 psui-text-white active:psui-shadow-inner`
|
|
100
|
-
}
|
|
54
|
+
getComponentClass(){
|
|
55
|
+
return `layout-${this.layout} ${this.size} ${this.iconPosition}`
|
|
56
|
+
}
|
|
101
57
|
},
|
|
102
58
|
methods: {
|
|
103
59
|
onClick() {
|
|
104
|
-
if (this.disabled) return
|
|
60
|
+
if (this.disabled) return
|
|
61
|
+
this.isActive = true,
|
|
105
62
|
this.$emit('click')
|
|
63
|
+
},
|
|
64
|
+
onMouseEnter(){
|
|
65
|
+
if(!this.disabled){
|
|
66
|
+
this.isHover = true
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
onMouseLeave(){
|
|
70
|
+
if(!this.disabled){
|
|
71
|
+
this.isHover = false
|
|
72
|
+
}
|
|
106
73
|
}
|
|
107
74
|
}
|
|
108
75
|
}
|
|
109
76
|
</script>
|
|
77
|
+
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<label
|
|
3
3
|
@click="onClick"
|
|
4
|
-
|
|
5
4
|
:for="title"
|
|
6
|
-
|
|
7
|
-
:class="cssClass"
|
|
8
|
-
|
|
5
|
+
:class="getCssClass"
|
|
9
6
|
class="
|
|
10
7
|
psui-flex
|
|
11
|
-
psui-items-center
|
|
12
8
|
psui-gap-2
|
|
13
|
-
psui-justify-center
|
|
14
9
|
psui-bg-gray-10
|
|
15
|
-
psui-text-gray-
|
|
16
|
-
psui-rounded-md
|
|
17
|
-
psui-py-1
|
|
10
|
+
psui-text-gray-50
|
|
18
11
|
psui-px-2
|
|
19
|
-
psui-
|
|
12
|
+
psui-py-1
|
|
13
|
+
psui-rounded-md
|
|
14
|
+
psui-items-center
|
|
20
15
|
"
|
|
21
16
|
>
|
|
22
|
-
<input
|
|
17
|
+
<input
|
|
18
|
+
@change="onChange"
|
|
19
|
+
v-if="type !== 'text'"
|
|
20
|
+
:type="type"
|
|
21
|
+
:id="title"
|
|
22
|
+
:checked="checked"
|
|
23
|
+
/>
|
|
23
24
|
<i v-if="icon" class="material-icons">{{ icon }}</i>
|
|
24
25
|
{{ title }}
|
|
25
26
|
<button @click="onClose" v-if="rich" class="psui-flex psui-items-center">
|
|
@@ -41,15 +42,20 @@ export default {
|
|
|
41
42
|
type: {
|
|
42
43
|
type: String,
|
|
43
44
|
required: true,
|
|
45
|
+
validator: (type) => ["text", "radio", "checkbox", "button"].includes(type)
|
|
44
46
|
},
|
|
45
47
|
icon: {
|
|
46
48
|
type: String,
|
|
47
49
|
default: "",
|
|
48
50
|
},
|
|
49
51
|
rich: {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: false,
|
|
54
|
+
},
|
|
55
|
+
checked: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: false
|
|
58
|
+
},
|
|
53
59
|
},
|
|
54
60
|
emits: ["click", "change"],
|
|
55
61
|
data() {
|
|
@@ -58,42 +64,36 @@ export default {
|
|
|
58
64
|
}
|
|
59
65
|
},
|
|
60
66
|
computed: {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
67
|
+
getCssClass() {
|
|
68
|
+
let cssClass = ''
|
|
69
|
+
|
|
70
|
+
if (this.checked === true ) {
|
|
71
|
+
cssClass = "psui-text-blue-50 psui-bg-blue-20"
|
|
64
72
|
}
|
|
65
73
|
|
|
66
|
-
|
|
67
|
-
return "psui-text-blue-50"
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (this.isChecked === true){
|
|
71
|
-
return "psui-text-blue-50"
|
|
72
|
-
}
|
|
73
|
-
return "psui-text-blue-50"
|
|
74
|
+
return cssClass
|
|
74
75
|
},
|
|
75
76
|
},
|
|
76
77
|
methods: {
|
|
77
78
|
onClick() {
|
|
78
|
-
|
|
79
|
-
if (this.type !== "checkbox" || this.type !== "radio") {
|
|
80
|
-
this.isChecked = !this.isChecked
|
|
81
|
-
}
|
|
79
|
+
this.isChecked = !this.isChecked
|
|
82
80
|
this.$emit("click")
|
|
83
81
|
},
|
|
84
82
|
onChange(event) {
|
|
83
|
+
|
|
85
84
|
this.isChecked = event.target.checked
|
|
85
|
+
|
|
86
|
+
this.$emit('update:checked', event.target.checked)
|
|
86
87
|
this.$emit("change")
|
|
87
88
|
},
|
|
88
|
-
onClose(){
|
|
89
|
+
onClose() {
|
|
89
90
|
this.$emit("close")
|
|
90
|
-
}
|
|
91
|
-
}
|
|
91
|
+
},
|
|
92
|
+
},
|
|
92
93
|
}
|
|
93
94
|
</script>
|
|
94
95
|
|
|
95
96
|
<style scoped>
|
|
96
|
-
|
|
97
97
|
input[type="radio"] {
|
|
98
98
|
-webkit-appearance: none;
|
|
99
99
|
-moz-appearance: none;
|
|
@@ -103,7 +103,8 @@ input[type="radio"] {
|
|
|
103
103
|
width: 16px;
|
|
104
104
|
height: 16px;
|
|
105
105
|
border-radius: 50%;
|
|
106
|
-
border: 1px solid #
|
|
106
|
+
border: 1px solid #d6dde5;
|
|
107
|
+
cursor: pointer;
|
|
107
108
|
}
|
|
108
109
|
|
|
109
110
|
input[type="checkbox"] {
|
|
@@ -115,7 +116,8 @@ input[type="checkbox"] {
|
|
|
115
116
|
width: 16px;
|
|
116
117
|
height: 16px;
|
|
117
118
|
border-radius: 25%;
|
|
118
|
-
border: 1px solid #
|
|
119
|
+
border: 1px solid #d6dde5;
|
|
120
|
+
cursor: pointer;
|
|
119
121
|
}
|
|
120
122
|
|
|
121
123
|
input[type="radio"]:hover,
|
|
@@ -125,16 +127,19 @@ input[type="checkbox"]:hover {
|
|
|
125
127
|
|
|
126
128
|
input[type="radio"]:checked {
|
|
127
129
|
border-color: #64b5ce;
|
|
128
|
-
background: url(
|
|
130
|
+
background: url("../../assets/images/radio-checked-button.svg") #ffffff
|
|
131
|
+
no-repeat center;
|
|
129
132
|
}
|
|
130
133
|
|
|
131
134
|
input[type="checkbox"]:checked {
|
|
132
135
|
border-color: #64b5ce;
|
|
133
|
-
background: url(
|
|
136
|
+
background: url("../../assets/images/check-checkbox-button.svg") #64b5ce
|
|
137
|
+
no-repeat center;
|
|
134
138
|
}
|
|
135
139
|
|
|
136
140
|
label {
|
|
137
|
-
|
|
141
|
+
width: fit-content;
|
|
142
|
+
cursor: pointer;
|
|
138
143
|
}
|
|
139
144
|
|
|
140
145
|
label:hover {
|
|
@@ -142,5 +147,8 @@ label:hover {
|
|
|
142
147
|
background: #ffffff;
|
|
143
148
|
}
|
|
144
149
|
|
|
150
|
+
button {
|
|
151
|
+
outline: none;
|
|
152
|
+
}
|
|
145
153
|
</style>
|
|
146
154
|
|