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