PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 1.2.31
Booking for Appointments and Events Calendar – Amelia v1.2.31
2.4.9 2.4.8 2.4.7 2.4.6 2.4.5 2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / v3 / src / views / _components / radio / AmRadio.vue
ameliabooking / v3 / src / views / _components / radio Last commit date
AmRadio.vue 1 year ago AmRadioGroup.vue 1 year ago
AmRadio.vue
291 lines
1 <template>
2 <div class="am-radio-wrapper">
3 <el-radio
4 ref="amRadio"
5 v-model="model"
6 class="am-radio"
7 :class="[`am-radio__${props.size}`]"
8 :value="props.value"
9 :label="props.label"
10 :disabled="props.disabled"
11 :border="props.border"
12 :name="props.name"
13 :style="{...cssVars}"
14 @change="(e) => $emit('change', e)"
15 >
16 <slot name="default"></slot>
17 </el-radio>
18 </div>
19 </template>
20
21 <script setup>
22 // * Composables
23 import { useColorTransparency } from '../../../assets/js/common/colorManipulation';
24
25 // * Import from Vue
26 import {
27 computed,
28 ref,
29 inject, toRefs
30 } from "vue";
31
32 /**
33 * Component Props
34 * */
35 const props = defineProps({
36 modelValue: {
37 type: [String, Number, Boolean]
38 },
39 value: {
40 type: [String, Number, Boolean]
41 },
42 label: {
43 // * the label of Radio. If there's no value, label will act as value
44 type: [String, Number, Boolean]
45 },
46 disabled: {
47 type: Boolean,
48 default: false
49 },
50 border: {
51 type: Boolean,
52 default: false
53 },
54 size: {
55 type: String,
56 default: 'default',
57 validator(value) {
58 return ['default', 'medium', 'small'].includes(value)
59 }
60 },
61 name: {
62 type: String,
63 default: ''
64 },
65 style: {
66 type: Object,
67 default: () => {
68 return {}
69 }
70 }
71 })
72
73 /**
74 * Component Emits
75 * */
76 const emits = defineEmits(['change', 'update:modelValue'])
77
78 /**
79 * Component model
80 */
81 let { modelValue } = toRefs(props)
82 let model = computed({
83 get: () => modelValue.value,
84 set: (val) => {
85 emits('update:modelValue', val)
86 }
87 })
88
89 const amRadio = ref(null)
90
91 // * Color Vars
92 let amColors = inject('amColors', ref({
93 colorPrimary: '#1246D6',
94 colorSuccess: '#019719',
95 colorError: '#B4190F',
96 colorWarning: '#CCA20C',
97 colorMainBgr: '#FFFFFF',
98 colorMainHeadingText: '#33434C',
99 colorMainText: '#1A2C37',
100 colorSbBgr: '#17295A',
101 colorSbText: '#FFFFFF',
102 colorInpBgr: '#FFFFFF',
103 colorInpBorder: '#D1D5D7',
104 colorInpText: '#1A2C37',
105 colorInpPlaceHolder: '#1A2C37',
106 colorDropBgr: '#FFFFFF',
107 colorDropBorder: '#D1D5D7',
108 colorDropText: '#0E1920',
109 colorBtnPrim: '#265CF2',
110 colorBtnPrimText: '#FFFFFF',
111 colorBtnSec: '#1A2C37',
112 colorBtnSecText: '#FFFFFF',
113 }))
114
115 const cssVars = computed(() => {
116 return {
117 '--am-c-radio-bgr': amColors.value.colorInpBgr,
118 '--am-c-radio-border': amColors.value.colorInpBorder,
119 '--am-c-radio-label': amColors.value.colorInpBorder,
120 '--am-c-radio-border-op30': useColorTransparency(amColors.value.colorInpText, 0.3),
121 '--am-c-radio-hover-bgr': useColorTransparency(amColors.value.colorInpText, 0.1),
122 '--am-c-radio-bgr-op80': useColorTransparency(amColors.value.colorInpText, 0.8),
123 '--am-c-radio-border-op60': useColorTransparency(amColors.value.colorPrimary, 0.6),
124 }
125 })
126
127 </script>
128
129 <style lang="scss">
130 @mixin am-radio-block {
131 // Radio Wrapper
132 .am-radio-wrapper {
133 // -c- color
134 // -bgr- background
135 --am-c-radio-bgr: transparent;
136 --am-c-radio-text: transparent;
137 --am-c-radio-border: var(--am-c-inp-border);
138 --am-c-radio-label: var(--am-c-main-text);
139 --am-c-radio-inp-text: var(--am-c-main-bgr);
140 align-self: flex-start;
141
142 // Element Radio
143 .el-radio {
144 display: flex;
145 align-items: center;
146 white-space: pre-line;
147 min-height: 32px;
148 height: auto;
149
150 // Inner
151 &__inner {
152 height: 16px;
153 width: 16px;
154 border: 1px solid var(--am-c-radio-border);
155 background-color: var(--am-c-radio-bgr);
156
157 &:after {
158 background-color: var(--am-c-radio-inp-text);
159 }
160 }
161
162 // Input
163 &__input {
164 padding: 4px 0;
165 display: flex;
166 align-items: center;
167 align-self: flex-start;
168
169 // After
170 &:after {
171 background-color: var(--am-c-radio-text);
172 }
173
174 // Checked
175 &.is-checked {
176 --am-c-radio-bgr: var(--am-c-primary);
177 --am-c-radio-border: var(--am-c-primary);
178 --am-c-radio-text: var(--am-c-main-bgr);
179
180 &:hover {
181 --am-c-radio-bgr: var(--am-c-primary);
182 }
183
184 // Disabled
185 &.is-disabled {
186 --am-c-radio-bgr: var(--am-c-radio-bgr-op80);
187 --am-c-radio-border: var(--am-c-radio-border-op60);
188 }
189 }
190 }
191
192 // Label
193 &__label {
194 display: inline-block;
195 font-size: 15px;
196 font-weight: 500;
197 line-height: 24px;
198 word-break: break-word;
199 white-space: pre-line;
200 align-self: flex-start;
201 color: var(--am-c-main-text);
202 padding-left: 0.75rem;
203 margin-right: 8px;
204 }
205
206 // Selected Label
207 .el-radio__input.is-checked:not(.is-disabled) + .el-radio__label {
208 margin-right: 8px;
209 }
210
211 // Hover
212 &:hover:not(.is-disabled):not(.is-checked) {
213
214 // Inner
215 .el-radio__inner {
216 border: 1px solid var(--am-c-radio-border);
217 box-shadow: inset 0 1px 1px rgba(20, 35, 61, 0.11);
218 background: var(--am-c-primary);
219 }
220 }
221
222 // Focus
223 &:focus:is(.is-focus) {
224
225 // Inner
226 .el-radio__inner {
227 border: 2px solid var(--am-c-radio-border-lighten80);
228 }
229 }
230
231 // Disabled
232 &.is-disabled {
233
234 // Inner
235 .el-radio__inner {
236 box-shadow: 0 1px 1px rgba(115, 134, 169, 0.06);
237 }
238
239 // Label
240 .el-radio__label {
241 color: var(--am-c-main-text);
242 }
243
244 &.is-checked {
245 .el-radio__inner {
246 border: 1px solid var(--am-c-radio-border);
247 background-color: var(--am-c-radio-border-lighten80);
248 }
249 }
250 }
251
252 // Label Right
253 &.is-label-right {
254
255 // Input
256 .el-radio__input {
257 margin-left: auto;
258 order: 2;
259 }
260
261 // Label
262 .el-radio__label {
263 padding-left: 0;
264 padding-right: 8px;
265 }
266 }
267
268 // With Description
269 &.is-with-description {
270 align-items: flex-start;
271
272 // Description
273 .am-radio__description {
274 font-weight: 400;
275 font-size: 13px;
276 line-height: 20px;
277 }
278 }
279 }
280 }
281 }
282 // public
283 .amelia-v2-booking #amelia-container {
284 @include am-radio-block;
285 }
286
287 // admin
288 #amelia-app-backend-new {
289 @include am-radio-block;
290 }
291 </style>