@policystudio/policy-studio-ui-vue 1.0.27 → 1.0.28
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 +4752 -586
- package/package.json +1 -1
- package/src/assets/scss/base.scss +38 -3
- package/src/assets/scss/components/PsButton.scss +114 -120
- package/src/assets/scss/components/PsCardInfos.scss +26 -0
- package/src/assets/scss/components/PsChartLegend.scss +25 -0
- package/src/assets/scss/components/PsCheckbox.scss +96 -0
- package/src/assets/scss/components/PsChips.scss +155 -0
- package/src/assets/scss/components/PsClimateZoneBadge.scss +26 -0
- package/src/assets/scss/components/PsCostEffectBar.scss +31 -0
- package/src/assets/scss/components/PsDataTable.scss +50 -0
- package/src/assets/scss/components/PsDropdown.scss +44 -0
- package/src/assets/scss/components/PsHighlightRippleDot.scss +48 -0
- package/src/assets/scss/components/PsInlineSelector.scss +5 -0
- package/src/assets/scss/components/PsInputSelect.scss +62 -0
- package/src/assets/scss/components/PsInputTextArea.scss +49 -0
- package/src/assets/scss/components/PsProgressBar.scss +24 -0
- package/src/assets/scss/components/PsRadioButton.scss +78 -0
- package/src/assets/scss/components/PsSlider.scss +11 -0
- package/src/assets/scss/components/PsSwitch.scss +66 -0
- package/src/assets/scss/components/PsTabHeader.scss +10 -3
- package/src/assets/scss/components/PsToast.scss +52 -0
- package/src/assets/scss/components/PsToggle.scss +23 -0
- package/src/assets/scss/components/PsTooltip.scss +118 -0
- package/src/components/badges-and-tags/PsCardInfos.vue +14 -7
- package/src/components/badges-and-tags/PsChartLegend.vue +7 -13
- package/src/components/badges-and-tags/PsClimateZoneBadge.vue +15 -6
- package/src/components/badges-and-tags/PsCostEffectBar.Copy.vue +72 -0
- package/src/components/badges-and-tags/PsCostEffectBar.vue +33 -70
- package/src/components/badges-and-tags/PsHighlightRippleDot.vue +3 -69
- package/src/components/badges-and-tags/PsProgressBar.vue +42 -0
- package/src/components/buttons/PsButton.vue +74 -78
- package/src/components/chips/PsChips.vue +46 -87
- package/src/components/controls/PsCheckbox.vue +58 -134
- package/src/components/controls/PsInlineSelector.vue +15 -0
- package/src/components/controls/PsRadioButton.vue +33 -88
- package/src/components/controls/PsSlider.vue +4 -5
- package/src/components/controls/PsSwitch.vue +29 -81
- package/src/components/controls/PsToggle.vue +45 -39
- package/src/components/datatable/PsDataTable.vue +3 -15
- package/src/components/forms/PsDropdown.vue +27 -11
- package/src/components/forms/PsInputSelect.vue +80 -0
- package/src/components/forms/PsInputTextArea.vue +80 -0
- package/src/components/notifications/PsDialog.vue +3 -0
- package/src/components/notifications/PsToast.vue +13 -28
- package/src/components/tabs/PsTabHeader.vue +30 -12
- package/src/components/tooltip/PsDialogTooltip.vue +6 -31
- package/src/components/tooltip/PsRichTooltip.vue +37 -44
- package/src/components/tooltip/PsTooltip.vue +18 -28
- package/src/components/ui/PsIcon.vue +9 -9
- package/src/index.js +9 -0
- package/src/stories/Button.stories.js +102 -112
- package/src/stories/Checkbox.stories.js +34 -37
- package/src/stories/Chips.stories.js +43 -54
- package/src/stories/ClimateZoneBadge.stories.js +0 -7
- package/src/stories/InlineSelector.stories.js +16 -0
- package/src/stories/InputSelect.stories.js +22 -0
- package/src/stories/InputTextArea.stories.js +25 -0
- package/src/stories/RadioButton.stories.js +32 -29
- package/src/stories/Switch.stories.js +33 -0
- package/src/stories/Toast.stories.js +40 -46
- package/src/stories/Tooltip.stories.js +86 -86
- package/tailwind.config.js +7 -1
- package/src/assets/images/check-checkbox-button.svg +0 -1
- package/src/assets/images/radio-checked-button.svg +0 -1
- package/src/stories/Swith.stories.js +0 -38
|
@@ -1,58 +1,68 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
:
|
|
5
|
-
:class="getCssClass"
|
|
6
|
-
class="
|
|
7
|
-
psui-flex
|
|
8
|
-
psui-gap-2
|
|
9
|
-
psui-bg-gray-10
|
|
10
|
-
psui-text-gray-50
|
|
11
|
-
psui-px-2
|
|
12
|
-
psui-py-1
|
|
13
|
-
psui-rounded-md
|
|
14
|
-
psui-items-center
|
|
15
|
-
"
|
|
2
|
+
<div
|
|
3
|
+
class="psui-el-chips"
|
|
4
|
+
:class="[getComponentClass, `layout-${layout}`, `type-${type}`]"
|
|
16
5
|
>
|
|
17
6
|
<input
|
|
18
7
|
@change="onChange"
|
|
19
|
-
v-if="type
|
|
8
|
+
v-if="type != 'button'"
|
|
20
9
|
:type="type"
|
|
21
|
-
:id="
|
|
10
|
+
:id="label"
|
|
22
11
|
:checked="checked"
|
|
23
12
|
/>
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
13
|
+
<label
|
|
14
|
+
@click="onClick"
|
|
15
|
+
:for="label"
|
|
16
|
+
:class="getCssClass"
|
|
17
|
+
>
|
|
18
|
+
<i v-if="icon" class="psui-el-chips-icon psui-el-chips-icon-prepend">{{ icon }}</i>
|
|
19
|
+
{{ label }}
|
|
20
|
+
{{ layout }}
|
|
21
|
+
<button
|
|
22
|
+
@click="onClose"
|
|
23
|
+
v-if="layout === 'rich'"
|
|
24
|
+
class="psui-el-chips-close"
|
|
25
|
+
>
|
|
26
|
+
<span class="psui-el-chips-icon">close</span>
|
|
27
|
+
</button>
|
|
28
|
+
</label>
|
|
29
|
+
</div>
|
|
30
30
|
</template>
|
|
31
31
|
|
|
32
32
|
<script>
|
|
33
|
-
export const type = ["
|
|
33
|
+
export const type = ["radio", "checkbox", "button"]
|
|
34
34
|
|
|
35
35
|
export default {
|
|
36
36
|
name: "PsChips",
|
|
37
37
|
props: {
|
|
38
|
-
|
|
38
|
+
label: {
|
|
39
39
|
type: String,
|
|
40
40
|
default: "",
|
|
41
41
|
},
|
|
42
42
|
type: {
|
|
43
43
|
type: String,
|
|
44
44
|
required: true,
|
|
45
|
-
|
|
45
|
+
default: 'button',
|
|
46
|
+
validator: (type) => ["radio", "checkbox", "button"].includes(type)
|
|
47
|
+
},
|
|
48
|
+
layout: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: 'simple',
|
|
51
|
+
validator: (value) => ['simple', 'with-icon', 'rich'].includes(value)
|
|
46
52
|
},
|
|
47
53
|
icon: {
|
|
48
54
|
type: String,
|
|
49
55
|
default: "",
|
|
50
56
|
},
|
|
51
|
-
|
|
57
|
+
checked: {
|
|
52
58
|
type: Boolean,
|
|
53
|
-
default: false
|
|
59
|
+
default: false
|
|
54
60
|
},
|
|
55
|
-
|
|
61
|
+
disabled: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
default: false
|
|
64
|
+
},
|
|
65
|
+
active: {
|
|
56
66
|
type: Boolean,
|
|
57
67
|
default: false
|
|
58
68
|
},
|
|
@@ -64,6 +74,13 @@ export default {
|
|
|
64
74
|
}
|
|
65
75
|
},
|
|
66
76
|
computed: {
|
|
77
|
+
getComponentClass() {
|
|
78
|
+
if (this.disabled) {
|
|
79
|
+
return 'status-disabled'
|
|
80
|
+
} else {
|
|
81
|
+
return 'status-resting'
|
|
82
|
+
}
|
|
83
|
+
},
|
|
67
84
|
getCssClass() {
|
|
68
85
|
let cssClass = ''
|
|
69
86
|
|
|
@@ -93,62 +110,4 @@ export default {
|
|
|
93
110
|
}
|
|
94
111
|
</script>
|
|
95
112
|
|
|
96
|
-
<style
|
|
97
|
-
input[type="radio"] {
|
|
98
|
-
-webkit-appearance: none;
|
|
99
|
-
-moz-appearance: none;
|
|
100
|
-
appearance: none;
|
|
101
|
-
|
|
102
|
-
display: inline-block;
|
|
103
|
-
width: 16px;
|
|
104
|
-
height: 16px;
|
|
105
|
-
border-radius: 50%;
|
|
106
|
-
border: 1px solid #d6dde5;
|
|
107
|
-
cursor: pointer;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
input[type="checkbox"] {
|
|
111
|
-
-webkit-appearance: none;
|
|
112
|
-
-moz-appearance: none;
|
|
113
|
-
appearance: none;
|
|
114
|
-
|
|
115
|
-
display: inline-block;
|
|
116
|
-
width: 16px;
|
|
117
|
-
height: 16px;
|
|
118
|
-
border-radius: 25%;
|
|
119
|
-
border: 1px solid #d6dde5;
|
|
120
|
-
cursor: pointer;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
input[type="radio"]:hover,
|
|
124
|
-
input[type="checkbox"]:hover {
|
|
125
|
-
border-color: #64b5ce;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
input[type="radio"]:checked {
|
|
129
|
-
border-color: #64b5ce;
|
|
130
|
-
background: url("../../assets/images/radio-checked-button.svg") #ffffff
|
|
131
|
-
no-repeat center;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
input[type="checkbox"]:checked {
|
|
135
|
-
border-color: #64b5ce;
|
|
136
|
-
background: url("../../assets/images/check-checkbox-button.svg") #64b5ce
|
|
137
|
-
no-repeat center;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
label {
|
|
141
|
-
width: fit-content;
|
|
142
|
-
cursor: pointer;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
label:hover {
|
|
146
|
-
color: #64b5ce;
|
|
147
|
-
background: #ffffff;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
button {
|
|
151
|
-
outline: none;
|
|
152
|
-
}
|
|
153
|
-
</style>
|
|
154
|
-
|
|
113
|
+
<style> /* Please, use the file src/assets/scss/components/PsChips.scss */</style>
|
|
@@ -1,134 +1,58 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
type: String,
|
|
39
|
-
default: '',
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
this.$emit('input', newValue)
|
|
60
|
-
this.$emit('change', newValue)
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
classes() {
|
|
64
|
-
return `${
|
|
65
|
-
this.disabled ? 'psui-border-gray-40' : 'psui-border-gray-50'
|
|
66
|
-
} ${this.checkboxClasses}`
|
|
67
|
-
},
|
|
68
|
-
getSize() {
|
|
69
|
-
return {
|
|
70
|
-
width: `${this.size}px`,
|
|
71
|
-
height: `${this.size}px`,
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
}
|
|
76
|
-
</script>
|
|
77
|
-
|
|
78
|
-
<style scoped>
|
|
79
|
-
.container {
|
|
80
|
-
display: block;
|
|
81
|
-
position: relative;
|
|
82
|
-
cursor: pointer;
|
|
83
|
-
-webkit-user-select: none;
|
|
84
|
-
-moz-user-select: none;
|
|
85
|
-
-ms-user-select: none;
|
|
86
|
-
user-select: none;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.container input {
|
|
90
|
-
position: absolute;
|
|
91
|
-
opacity: 0;
|
|
92
|
-
cursor: pointer;
|
|
93
|
-
height: 0;
|
|
94
|
-
width: 0;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.checkmark {
|
|
98
|
-
position: absolute;
|
|
99
|
-
top: 0;
|
|
100
|
-
left: 0;
|
|
101
|
-
height: 18px;
|
|
102
|
-
width: 18px;
|
|
103
|
-
background-color: #fff;
|
|
104
|
-
border-radius: 2px;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.container input:checked ~ .checkmark {
|
|
108
|
-
background-color: #64b5ce;
|
|
109
|
-
border: none;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.checkmark:after {
|
|
113
|
-
content: '';
|
|
114
|
-
position: absolute;
|
|
115
|
-
display: none;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.container input:checked ~ .checkmark:after {
|
|
119
|
-
display: block;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.container .checkmark:after {
|
|
123
|
-
left: 35%;
|
|
124
|
-
top: 8%;
|
|
125
|
-
width: 35%;
|
|
126
|
-
height: 65%;
|
|
127
|
-
border: solid white;
|
|
128
|
-
border-radius: 1px;
|
|
129
|
-
border-width: 0 2px 2px 0;
|
|
130
|
-
-webkit-transform: rotate(45deg);
|
|
131
|
-
-ms-transform: rotate(45deg);
|
|
132
|
-
transform: rotate(45deg);
|
|
133
|
-
}
|
|
134
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class='psui-el-checkbox' :class="[getComponentClass, {'disabled':disabled}]" >
|
|
3
|
+
<input
|
|
4
|
+
:id="label"
|
|
5
|
+
type="checkbox"
|
|
6
|
+
:value="label"
|
|
7
|
+
@change="onChange"
|
|
8
|
+
:checked="checked"
|
|
9
|
+
:disabled='disabled'
|
|
10
|
+
/>
|
|
11
|
+
<label :for="label" class="psui-el-checkmark"><span>{{ label }}</span></label>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script>
|
|
16
|
+
//FIGMA CONTROLS & SELECTORS https://www.figma.com/file/Tto8hrNlSfuPcwd1pfqogF/%E2%9A%A1%EF%B8%8F-Design-System?node-id=1768%3A64852
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
name: 'PsCheckbox',
|
|
20
|
+
props: {
|
|
21
|
+
label: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: '',
|
|
24
|
+
},
|
|
25
|
+
disabled: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: false,
|
|
28
|
+
},
|
|
29
|
+
size: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: 'big',
|
|
32
|
+
validator: (value)=> ['big', 'small'].includes(value)
|
|
33
|
+
},
|
|
34
|
+
checked:{
|
|
35
|
+
type: Boolean,
|
|
36
|
+
},
|
|
37
|
+
layout:{
|
|
38
|
+
type: String,
|
|
39
|
+
default: 'default',
|
|
40
|
+
validator: (value)=> ['default','mixed'].includes(value)
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
emits:['@update:checked', 'value'],
|
|
44
|
+
computed:{
|
|
45
|
+
getComponentClass(){
|
|
46
|
+
return `size-${this.size} layout-${this.layout}`
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
methods:{
|
|
50
|
+
onChange(event){
|
|
51
|
+
if(!this.disabled){
|
|
52
|
+
this.$emit('value', event.target.value)
|
|
53
|
+
this.$emit('update:checked', event.target.checked)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
</script>
|
|
@@ -1,110 +1,55 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
:
|
|
9
|
-
|
|
2
|
+
<div class='psui-el-radio' :class="[getComponentClass, {'disabled':disabled}]" >
|
|
3
|
+
<input
|
|
4
|
+
:id="label"
|
|
5
|
+
type="radio"
|
|
6
|
+
:value="label"
|
|
7
|
+
@change="onChange"
|
|
8
|
+
:checked="checked"
|
|
9
|
+
:disabled='disabled'
|
|
10
10
|
/>
|
|
11
|
-
<
|
|
12
|
-
</
|
|
11
|
+
<label :for="label" class="psui-el-checkmark"><span>{{ label }}</span></label>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
13
14
|
</template>
|
|
14
15
|
|
|
15
16
|
<script>
|
|
17
|
+
//FIGMA CONTROLS & SELECTORS https://www.figma.com/file/Tto8hrNlSfuPcwd1pfqogF/%E2%9A%A1%EF%B8%8F-Design-System?node-id=1768%3A64852
|
|
18
|
+
|
|
16
19
|
export default {
|
|
17
20
|
name: 'PsRadioButton',
|
|
18
21
|
props: {
|
|
19
22
|
label: {
|
|
20
23
|
type: String,
|
|
21
24
|
default: '',
|
|
22
|
-
required: true,
|
|
23
25
|
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
disabled: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false
|
|
26
29
|
},
|
|
27
|
-
|
|
30
|
+
size: {
|
|
28
31
|
type: String,
|
|
29
|
-
default:
|
|
32
|
+
default: 'big',
|
|
33
|
+
validator: (value) => ['big', 'small'].includes(value)
|
|
30
34
|
},
|
|
31
|
-
|
|
35
|
+
checked:{
|
|
32
36
|
type: Boolean,
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
model: {
|
|
37
|
-
prop: 'modelValue',
|
|
38
|
-
event: 'change',
|
|
37
|
+
}
|
|
39
38
|
},
|
|
39
|
+
emits:['@update:checked', 'value'],
|
|
40
40
|
computed: {
|
|
41
|
-
|
|
42
|
-
return this.
|
|
43
|
-
}
|
|
41
|
+
getComponentClass(){
|
|
42
|
+
return `size-${this.size}`
|
|
43
|
+
}
|
|
44
44
|
},
|
|
45
|
+
methods:{
|
|
46
|
+
onChange(event){
|
|
47
|
+
if(!this.disabled){
|
|
48
|
+
this.$emit('value', event.target.value)
|
|
49
|
+
this.$emit('update:checked', event.target.checked)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
45
53
|
}
|
|
46
54
|
</script>
|
|
47
55
|
|
|
48
|
-
<style scoped>
|
|
49
|
-
.wrapper {
|
|
50
|
-
display: block;
|
|
51
|
-
position: relative;
|
|
52
|
-
padding-left: 32px;
|
|
53
|
-
cursor: pointer;
|
|
54
|
-
-webkit-user-select: none;
|
|
55
|
-
-moz-user-select: none;
|
|
56
|
-
-ms-user-select: none;
|
|
57
|
-
user-select: none;
|
|
58
|
-
}
|
|
59
|
-
.wrapper input {
|
|
60
|
-
position: absolute;
|
|
61
|
-
opacity: 0;
|
|
62
|
-
cursor: pointer;
|
|
63
|
-
height: 0;
|
|
64
|
-
width: 0;
|
|
65
|
-
}
|
|
66
|
-
.checkmark {
|
|
67
|
-
position: absolute;
|
|
68
|
-
top: 0;
|
|
69
|
-
left: 0;
|
|
70
|
-
height: 24px;
|
|
71
|
-
width: 24px;
|
|
72
|
-
border-radius: 50%;
|
|
73
|
-
background-color: white;
|
|
74
|
-
border: 2px solid #a2acb7;
|
|
75
|
-
}
|
|
76
|
-
.checkmark-small {
|
|
77
|
-
top: 3px;
|
|
78
|
-
height: 18px !important;
|
|
79
|
-
width: 18px !important;
|
|
80
|
-
}
|
|
81
|
-
.wrapper input:checked ~ .checkmark {
|
|
82
|
-
background-color: white;
|
|
83
|
-
border-color: #64b5ce;
|
|
84
|
-
border-width: 2px;
|
|
85
|
-
}
|
|
86
|
-
.checkmark:after {
|
|
87
|
-
content: '';
|
|
88
|
-
position: absolute;
|
|
89
|
-
display: none;
|
|
90
|
-
}
|
|
91
|
-
.wrapper input:checked ~ .checkmark:after {
|
|
92
|
-
display: block;
|
|
93
|
-
}
|
|
94
|
-
.wrapper .checkmark:after {
|
|
95
|
-
top: 4px;
|
|
96
|
-
left: 4px;
|
|
97
|
-
width: 12px;
|
|
98
|
-
height: 12px;
|
|
99
|
-
border-radius: 50%;
|
|
100
|
-
background: #64b5ce;
|
|
101
|
-
}
|
|
102
|
-
.wrapper .checkmark-small:after {
|
|
103
|
-
top: 3px;
|
|
104
|
-
left: 3px;
|
|
105
|
-
width: 8px;
|
|
106
|
-
height: 8px;
|
|
107
|
-
border-radius: 50%;
|
|
108
|
-
background: #64b5ce;
|
|
109
|
-
}
|
|
110
|
-
</style>
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<div v-if="label" class="psui-
|
|
4
|
-
<
|
|
5
|
-
<div>{{ label }}</div>
|
|
2
|
+
<div class="psui-el-slider">
|
|
3
|
+
<div v-if="label" class="psui-el-slider-label">
|
|
4
|
+
<span>{{label}}</span>
|
|
6
5
|
</div>
|
|
7
|
-
<div
|
|
6
|
+
<div :class="{'psui-flex psui-items-center': !label && !bubble }">
|
|
8
7
|
<div
|
|
9
8
|
v-if="bubble"
|
|
10
9
|
class="psui-relative psui-bg-gray-40 psui-text-gray-20 psui-rounded-md psui-text-white psui-font-bold psui-w-10 psui-text-center range-value"
|
|
@@ -1,97 +1,45 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class=
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
>
|
|
8
|
-
<div class="button"></div>
|
|
9
|
-
</div>
|
|
10
|
-
<div class="switch-button-label">
|
|
11
|
-
<slot></slot>
|
|
12
|
-
</div>
|
|
2
|
+
<div class='psui-el-switch' :class="getComponentClass">
|
|
3
|
+
<input type="checkbox" :id='label' @change="onChange">
|
|
4
|
+
<transition>
|
|
5
|
+
<label :for="label" class='psui-el-switch-button' :class="getToggleClass" />
|
|
6
|
+
</transition>
|
|
13
7
|
</div>
|
|
14
8
|
</template>
|
|
15
9
|
|
|
16
10
|
<script>
|
|
11
|
+
//FIGMA CONTROLS & SELECTORS https://www.figma.com/file/Tto8hrNlSfuPcwd1pfqogF/%E2%9A%A1%EF%B8%8F-Design-System?node-id=1768%3A64852
|
|
12
|
+
|
|
17
13
|
export default {
|
|
18
14
|
name: 'PsSwitch',
|
|
19
15
|
props: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
label:{
|
|
17
|
+
type: String,
|
|
18
|
+
},
|
|
19
|
+
value:{
|
|
20
|
+
type: Boolean,
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
size:{
|
|
23
24
|
type: String,
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
default: 'big',
|
|
26
|
+
validator: (value)=> ['small', 'big'].includes(value)
|
|
26
27
|
}
|
|
27
28
|
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
computed:{
|
|
30
|
+
getToggleClass(){
|
|
31
|
+
return `toggle-${this.value.toString()}`
|
|
32
|
+
},
|
|
33
|
+
getComponentClass(){
|
|
34
|
+
return `size-${this.size}`
|
|
35
|
+
}
|
|
31
36
|
},
|
|
32
|
-
methods:
|
|
33
|
-
|
|
34
|
-
this
|
|
37
|
+
methods:{
|
|
38
|
+
onChange(event){
|
|
39
|
+
this.value = event.target.checked
|
|
40
|
+
this.$emit('update:value', event.target.value)
|
|
35
41
|
}
|
|
36
42
|
}
|
|
37
|
-
}
|
|
43
|
+
}
|
|
38
44
|
</script>
|
|
39
45
|
|
|
40
|
-
<style scoped>
|
|
41
|
-
.switch-button-control {
|
|
42
|
-
display: flex;
|
|
43
|
-
flex-direction: row;
|
|
44
|
-
align-items: center;
|
|
45
|
-
}
|
|
46
|
-
.switch-button-control .switch-button {
|
|
47
|
-
height: 24px;
|
|
48
|
-
width: calc(24px * 2);
|
|
49
|
-
background-color: #A2ACB7;
|
|
50
|
-
border: 2px solid #A2ACB7;
|
|
51
|
-
border-radius: 24px;
|
|
52
|
-
transition: all 0.3s ease-in-out;
|
|
53
|
-
cursor: pointer;
|
|
54
|
-
}
|
|
55
|
-
.switch-button-control .switch-button-small {
|
|
56
|
-
height: 16px;
|
|
57
|
-
width: calc(16px * 2);
|
|
58
|
-
background-color: #A2ACB7;
|
|
59
|
-
border: 2px solid #A2ACB7;
|
|
60
|
-
border-radius: 16px;
|
|
61
|
-
transition: all 0.3s ease-in-out;
|
|
62
|
-
cursor: pointer;
|
|
63
|
-
}
|
|
64
|
-
.switch-button-control .switch-button .button {
|
|
65
|
-
height: calc(24px - (2 * 2px));
|
|
66
|
-
width: calc(24px - (2 * 2px));
|
|
67
|
-
border-radius: calc(24px - (2 * 2px));
|
|
68
|
-
background:#F3F6F9;
|
|
69
|
-
transition: all 0.3s ease-in-out;
|
|
70
|
-
}
|
|
71
|
-
.switch-button-control .switch-button-small .button {
|
|
72
|
-
height: calc(16px - (2 * 2px));
|
|
73
|
-
width: calc(16px - (2 * 2px));
|
|
74
|
-
border-radius: calc(16px - (2 * 2px));
|
|
75
|
-
background:#F3F6F9;
|
|
76
|
-
transition: all 0.3s ease-in-out;
|
|
77
|
-
}
|
|
78
|
-
.switch-button-control .switch-button.enabled {
|
|
79
|
-
background-color: var(--color);
|
|
80
|
-
border: 2px solid var(--color);
|
|
81
|
-
}
|
|
82
|
-
.switch-button-control .switch-button-small.enabled {
|
|
83
|
-
background-color: var(--color);
|
|
84
|
-
border: 2px solid var(--color);
|
|
85
|
-
}
|
|
86
|
-
.switch-button-control .switch-button.enabled .button {
|
|
87
|
-
background: white;
|
|
88
|
-
transform: translateX(calc(calc(24px - (2 * 2px)) + (2 *2px)));
|
|
89
|
-
}
|
|
90
|
-
.switch-button-control .switch-button-small.enabled .button {
|
|
91
|
-
background: white;
|
|
92
|
-
transform: translateX(calc(calc(16px - (2 * 2px)) + (2 *2px)));
|
|
93
|
-
}
|
|
94
|
-
.switch-button-control .switch-button-label {
|
|
95
|
-
margin-left: 10px;
|
|
96
|
-
}
|
|
97
|
-
</style>
|